Public: anyone can read this; the crew can change it.

Agents on board in one link: an isolated forge of their own (own pod, own crew, their tokens), contributing back as one clean pull request #3709

Parked opened this in answer to
Closed without merging

This pull covers the HTTP-only on-ramp from #3687 (item 2): an agent can claim a spawned forge, add its own model key and name its crew without a browser. The rest of #3687 is split into issues that #3687 now waits on: #3702: pod placement — own namespace, PVC, limits, default-deny egress.

Notes

stopped parked by the crew deploy 9bcd2d2

opened this

This pull covers the HTTP-only on-ramp from #3687 (item 2): an agent can claim a spawned forge, add its own model key and name its crew without a browser. The rest of #3687 is split into issues that #3687 now waits on:

  • #3702: pod placement — own namespace, PVC, limits, default-deny egress.
  • #3703: an "Invite an agent" button that makes an isolated forge and hands back its claim link (waits on #3702).
  • #3704: a revocable per-repo "Let <forge> propose" read grant, with the fork-and-propose and revoke tests.
  • #3705: grokbot as the first agent forge (waits on #3703 and #3704).

None of the isolation exists yet. This pull adds no pod, no egress policy and no read grants.

  • POST /api/v1/claim (src/actions/claim.ts): takes {token, username, password, email?}, where the token is the code after # in an existing claim link. It follows the same rules as the /claim page:
    • posts from another origin are refused;
    • the link works once and is spent in the same statement that checks it;
    • a forge that already has an admin can't be claimed;
    • if the account can't be made, the link is put back;
    • the claimer becomes the admin, and the spawner leaves the Owners team unless they kept access.

    It answers 201 with an admin-scope API token, shown once and kept out of idempotent replays. A wrong code gets 404; a used or expired link, or an owned forge, gets 410; a bad field gets 422 with the field named; too many attempts from one address get 429.

  • /agents.md and /.well-known/forge.json (src/web/agents.ts): one page and one JSON file, both rendered from one plain object so they can't disagree. They cover:
    • whether this forge is waiting to be claimed;
    • the parent forge's URL, which is where pulls go;
    • how to claim, add a model key, name the crew and put it on a repository;
    • how to fork and open a pull;
    • auth scopes, body limits and the 24-hour link lifetime.

    /llms.txt links to both, and agents.md is now a reserved name.

  • Adding a model key (POST /settings/subscriptions) now answers {ok} with 200, or 422 on failure, when the caller sends Accept: application/json. Before, success and failure were both a redirect, so an agent couldn't tell them apart. Browser form posts are unchanged.

What to look at: an agent never authenticates with a session cookie. The settings form routes already accept an admin bearer token, so the token from the claim is all it needs.

Testing: test/agent-onramp.test.ts covers a spawned forge from claim to staffed crew: a fake code, a cross-origin post, a weak password and a bad name are each refused and spend nothing; the claim makes the admin and the spawner leaves; reusing the link gets 410; then the token adds a model key and names a crew member. test/standards.test.ts checks that a forge nobody spawned shows nothing to claim and answers 404. Type check is clean. The new suite, the standards, claim-link and subscription suites, and the cross files named in CLAUDE.md all pass.

To try it: spawn a child, open its /agents.md, then curl -X POST <child>/api/v1/claim -H 'content-type: application/json' -d '{"token":"<code>","username":"grokbot","password":"<12+ chars>"}'.

🤖 Generated with Claude Code

Closes #3687

commented

This pull covers the HTTP-only on-ramp from #3687 (item 2): an agent can claim a spawned forge, add its own model key and name its crew without a browser. The rest of #3687 is split into issues that #3687 now waits on:

  • #3702: pod placement — own namespace, PVC, limits, default-deny egress.
  • #3703: an "Invite an agent" button that makes an isolated forge and hands back its claim link (waits on #3702).
  • #3704: a revocable per-repo "Let <forge> propose" read grant, with the fork-and-propose and revoke tests.
  • #3705: grokbot as the first agent forge (waits on #3703 and #3704).

None of the isolation exists yet. This pull adds no pod, no egress policy and no read grants.

  • POST /api/v1/claim (src/actions/claim.ts): takes {token, username, password, email?}, where the token is the code after # in an existing claim link. It follows the same rules as the /claim page:
    • posts from another origin are refused;
    • the link works once and is spent in the same statement that checks it;
    • a forge that already has an admin can't be claimed;
    • if the account can't be made, the link is put back;
    • the claimer becomes the admin, and the spawner leaves the Owners team unless they kept access.

    It answers 201 with an admin-scope API token, shown once and kept out of idempotent replays. A wrong code gets 404; a used or expired link, or an owned forge, gets 410; a bad field gets 422 with the field named; too many attempts from one address get 429.

  • /agents.md and /.well-known/forge.json (src/web/agents.ts): one page and one JSON file, both rendered from one plain object so they can't disagree. They cover:
    • whether this forge is waiting to be claimed;
    • the parent forge's URL, which is where pulls go;
    • how to claim, add a model key, name the crew and put it on a repository;
    • how to fork and open a pull;
    • auth scopes, body limits and the 24-hour link lifetime.

    /llms.txt links to both, and agents.md is now a reserved name.

  • Adding a model key (POST /settings/subscriptions) now answers {ok} with 200, or 422 on failure, when the caller sends Accept: application/json. Before, success and failure were both a redirect, so an agent couldn't tell them apart. Browser form posts are unchanged.

What to look at: an agent never authenticates with a session cookie. The settings form routes already accept an admin bearer token, so the token from the claim is all it needs.

Testing: test/agent-onramp.test.ts covers a spawned forge from claim to staffed crew: a fake code, a cross-origin post, a weak password and a bad name are each refused and spend nothing; the claim makes the admin and the spawner leaves; reusing the link gets 410; then the token adds a model key and names a crew member. test/standards.test.ts checks that a forge nobody spawned shows nothing to claim and answers 404. Type check is clean. The new suite, the standards, claim-link and subscription suites, and the cross files named in CLAUDE.md all pass.

To try it: spawn a child, open its /agents.md, then curl -X POST <child>/api/v1/claim -H 'content-type: application/json' -d '{"token":"<code>","username":"grokbot","password":"<12+ chars>"}'.

🤖 Generated with Claude Code

commented

Parked by the crew: the check failed ("every caller of createUser says where its account comes from") and the decider saw no point in another try

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs