Skip to content

feat: free-join providers + flag/de-route enforcement + stake ranking#4

Merged
biwasxyz merged 3 commits into
mainfrom
feat/inference-v1-engage
Jun 29, 2026
Merged

feat: free-join providers + flag/de-route enforcement + stake ranking#4
biwasxyz merged 3 commits into
mainfrom
feat/inference-v1-engage

Conversation

@biwasxyz

Copy link
Copy Markdown
Contributor

What

Aligns the gateway with the agreed v1 model.

  • Free earning: removes the provider bond gate. Community providers earn with no bond or stake.
  • Flag → de-route enforcement: a flagged provider field + POST /v1/providers/:id/flag (admin-token gated; disabled on mainnet unless ADMIN_TOKEN is set). Flagged providers are de-routed everywhere and excluded from the catalog. Enforcement lives in the gateway, not the inference plane.
  • Stake ranking: src/legion.ts reads legion-engage.get-stake and ranks higher-staked providers first in routing + catalog (best-effort; degrades to registration order, never blocks routing). Staking is optional and only buys ranking.
  • Keeps the testnet payout-address fix (accept ST/SN as well as SP/SM).

Tested locally (wrangler dev, no deploy)

  • Free earning (community model, no bond) → reaches settlement ✅
  • Flag → de-route, unflag → restore ✅
  • Catalog excludes flagged ✅
  • get-stake decode + ranking sort (unit) ✅ — live stake read needs legion-engage deployed
  • tsc: no new errors; bundle builds clean

Depends on

legion-engage (aibtcdev/legions#5) for the stake read. Until it is deployed and LEGION_ENGAGE is set, ranking is a safe no-op.

Not deployed

Nothing deployed. For review.

Aligns the gateway with the v1 model: earning is free, enforcement is
gateway routing (not on-chain slashing), and staking only buys ranking.

- Remove the provider bond gate: community providers earn with no bond.
- Add a `flagged` provider field + setFlag + POST /v1/providers/:id/flag
  (admin-token gated; disabled on mainnet unless ADMIN_TOKEN is set).
  Flagged providers are de-routed everywhere and excluded from the catalog.
- src/legion.ts: read legion-engage.get-stake and rank higher-staked
  providers first in routing + catalog (best-effort; never blocks routing).
- Keep the testnet payout-address fix (accept ST/SN as well as SP/SM).

Tested locally (wrangler dev): free earning, flag/de-route, unflag,
catalog exclusion, stake decode + ranking sort. Not deployed.
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 29, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
inference-marketplace b9098c8 Commit Preview URL

Branch Preview URL
Jun 29 2026, 04:49 PM

@biwasxyz
biwasxyz changed the base branch from feat/legion-fee-rail-settlement to main June 29, 2026 15:36
biwasxyz and others added 2 commits June 29, 2026 21:32
State plainly, where agents look, that flagging is a manual operator
action (admin-token gated, not a key/multisig, not a crowd vote), that
there's no auto-detection yet, that flagged status is public, and that
moving the decision to a legion-gov vote is on the roadmap.

- skill.md (agent guide): new "Enforcement & trust" section + flag endpoint
- GET / : new `trust` block + flagProvider endpoint
- README: "Enforcement & trust" section + flag endpoint row
Repoint the testnet/staging Legion fee-rail from the agent-03 demand bundle
(STBEMQQ…) to the v1 provider-Legion guild bundle (legion-agent-06, STGX5YP…)
and add LEGION_ENGAGE so the gateway's stake-ranking (src/legion.ts rankByStake)
reads the deployed engagement-stake contract. This matches the tested local
.dev.vars; the committed staging config was stale.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@biwasxyz

Copy link
Copy Markdown
Contributor Author

Added b9098c8 (deploy: point staging env at v1 guild bundle + wire LEGION_ENGAGE):

  • Repointed staging LEGION_FEES/LEGION_TREASURY from the agent-03 demand bundle (STBEMQQ…) → the v1 provider-Legion guild bundle (legion-agent-06, STGX5YP…).
  • Added LEGION_ENGAGE = STGX5YP…​.legion-engage (deployed on testnet, tx 0aae819c…) so rankByStake (src/legion.ts) reads it.
  • This brings the committed staging config in line with the already-tested local .dev.vars.

One open call for the reviewer: staging RECIPIENT_ADDRESS is still ST2VN1G6… (agent-05), while local .dev.vars uses the bonded provider ST2DV4Z0…. Left as-is since it's a payout target (and the comment notes it may be overridden via wrangler secret put). Say the word and I'll align it.

@biwasxyz
biwasxyz merged commit d2297ea into main Jun 29, 2026
1 check passed
@biwasxyz
biwasxyz deleted the feat/inference-v1-engage branch June 29, 2026 16:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant