Skip to content

feat(tools): builtin GitHub tool Installable in the catalogue; mint derives brokerId - #1670

Merged
lilyshen0722 merged 5 commits into
mainfrom
wren/piece2-github-tool-installable
Sep 11, 2026
Merged

lilyshen0722 merged 5 commits into
mainfrom
wren/piece2-github-tool-installable

Conversation

@lilyshen0722

Copy link
Copy Markdown
Contributor

Summary

Piece 2 follow-up on the tools plan (§2, §6). lily-shen found (67719) that GET /api/installables returned only channel providers: no tool Installable, no mcp-server component, no tool list, and the mint took a brokerId the client had no source for. Wren's ruling (67724): the builtin GitHub Installable lands in the same catalogue, tagged by list, and the mint derives the broker server-side.

  • backend/scripts/seed-builtin-tools.ts upserts the builtin GitHub Installable at boot: one mcp-server component named for the broker (commonly-grant-broker, the MCP server name routes/mcpGrants.ts declares), transport: 'http', and enabledTools projected from TOOL_DEFINITIONS, never hand-written, so catalogue, mint and broker read one list. Separate from the connector seeder so the connector tests never import the broker.
  • GET /api/installables is one response, two lists (Sam's option A, 67407). Every entry carries list: 'channels' | 'tools'. A tool entry adds broker: { id }, tools: [{ name, description, requiredWriteMode, irreversible }], and connections: [{ connectionId, owner, repo }] (the caller's own connected, unrevoked GitHub App rows, the Add form's mint source). No credential and no Connection _id leaves the route. Integration.find runs only when a tool row exists.
  • POST /api/grants reads brokerId from the seeded row's component and ignores the body's. A tool outside enabledTools is 400 invalid_tools; no seed row is 503 broker_unavailable.
  • V2ConnectorsPage filters list: 'tools' out of its rows.
  • Plan doc §2 and §6 amended to say the above. Ledger untouched: args_digest, never args.

Named tests

  • the builtin GitHub Installable enables exactly the broker's GitHub tools (+ projectTools narrowing, resolveBrokerFor refusal) in backend/__tests__/unit/services/toolInstallables.test.js
  • brokerId comes from the tool Installable, never the body; the mint refuses a tool the Installable does not enable; the mint refuses with broker_unavailable when no tool Installable is seeded in backend/__tests__/unit/routes/grants.mint.test.js
  • the catalogue returns the GitHub tool Installable with its tools, broker and the caller's connections, on the tools list in installableCatalogService.test.js (also asserts list: 'channels' on existing rows and that no key material leaks)
  • a tool Installable in the catalogue never renders as a channel row in V2ConnectorsPage.test.tsx

Verification

  • Backend: the five suites above plus roomGrantService and installables route suites pass locally (34 tests). tsc --noEmit clean on every touched file.
  • Frontend: this workspace's frontend/node_modules is missing jest-environment-jsdom and @babel/preset-env, so the connectors page suite could not run locally. CI is the check for that one.

Out of scope

installationId on the mint still comes from the body (pre-existing). The Tools page (wave/piece4-tools-page) reads these entries; #1668's read routes are unchanged.

🤖 Generated with Claude Code

lilyshen0722 and others added 3 commits September 11, 2026 13:09
…erives brokerId

Piece 2 follow-up (tools plan §2, §6). The catalogue returned only channel
providers, so the Tools page had no not-yet row, no allow-list and no broker
to mint against (lily-shen 67719).

- seed-builtin-tools.ts upserts the builtin GitHub Installable at boot with one
  mcp-server component named for the broker (commonly-grant-broker) and
  enabledTools projected from TOOL_DEFINITIONS, never hand-written.
- GET /api/installables is one response, two lists: every entry carries
  list: 'channels' | 'tools'. A tool entry adds broker, tools (name, tier,
  irreversible) and the caller's own connected GitHub App connections
  (connectionId, owner, repo). No credential or Connection _id leaves the route.
- POST /api/grants reads brokerId from the seeded row and ignores the body's;
  a tool outside enabledTools is 400 invalid_tools, no seed row is 503
  broker_unavailable.
- V2ConnectorsPage filters list: 'tools' out of its rows.

Named tests: the builtin GitHub Installable enables exactly the broker's GitHub
tools; brokerId comes from the tool Installable, never the body; the mint
refuses a tool the Installable does not enable; the catalogue returns the
GitHub tool Installable with its tools, broker and the caller's connections, on
the tools list; a tool Installable in the catalogue never renders as a channel
row.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Vera 67728: the field naming who holds the credential must not be
caller-written. A body carrying brokerId is now 400 invalid_broker; the
server still sets it from the seeded tool Installable. Named test: a
client-supplied brokerId is refused.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
…ays free of GitHub crypto

After the rebase onto #1668, grants.read.test.js mounted routes/grants.ts
unmocked and the new resolveBrokerFor import pulled toolBrokerService →
githubAppService → jsonwebtoken at load, which throws on Node 26
(SlowBuffer is gone). The broker definitions are only needed when seeding
or projecting tools, so require them on first use.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@lilyshen0722
lilyshen0722 merged commit aef4c27 into main Sep 11, 2026
14 checks passed
samxu01 pushed a commit that referenced this pull request Sep 11, 2026
… from the catalogue (#1670), with direction-A marks

The seam closes on Wren's catalogue: GET /api/installables now lists the
GitHub tool Installable (list: 'tools') with its projected allow-list and the
caller's Connections, so the page draws what the server enforces:

- not-yet row per tool Installable with no live grant — dashed dot, muted name,
  what it does, `read, or read and write`, `not granted`, Add (ink); without a
  Connection or on an unconfigured instance the row says so and offers no Add.
- Add opens in the aside: room, connection (when more than one), a writeMode
  segment, the allow-list the mode admits (read → read tools; write modes →
  all), what asks first (the catalogue's irreversible tools under `write`),
  every non-internal seat in the room checked, expiry 7/30/90 days, Grant (ink).
  The mint body is the server's: connectionId, installationId, target, tools,
  writeMode, audience, expiresAt — never a brokerId (Vera 67728).
- Change access pre-fills from the grant (effectiveAudience, not the raw
  snapshot — Vera 67568) and is a new grant plus a revoke of the old one;
  Grant again on an expired/revoked row only mints.
- "what asks first" under `write` lists the catalogue's irreversible tools.
- direction A (Sam 2026-09-11): the grant's mode and a trail line's outcome
  carry a 14px mark with the word in `title`; the granted row no longer repeats
  the tool's description sentence.

glyphs.tsx is the same file #1671 adds (identical content, merges clean).

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_016DspLEe1mFV94dPGCqA1u5
lilyshen0722 added a commit that referenced this pull request Sep 12, 2026
…tallationId from the connection (#1677)

Piece-2 follow-up owed to Vera (67821), after #1670 merged.

Seed: the upsert is keyed on { installableId, source: 'builtin' } instead
of the id alone, and the seed first checks who holds the id — a row another
source published under 'github' is left untouched with a warning rather than
overwritten or tripped over (installableId is unique).

Mint: the grant's installationId is copied from the loaded connection
(top-level installationId, falling back to config.installationId); a
connection without one is connection_mismatch, and a body that carries
installationId is refused 400 invalid_installation, the same way brokerId is.
A grant on connection A can no longer name installation B.

Tests: `the seed never claims a non-builtin row`, `the seed creates the
builtin row once and updates it in place` (real memory Mongo, unique index
in play); `installationId comes from the connection, never the body`,
`a client-supplied installationId is refused`, `a connection without an
installation is a mismatch`. Plan §3 notes the derived field.

Co-authored-by: Claude Fable 5.1 <[email protected]>
samxu01 pushed a commit that referenced this pull request Sep 12, 2026
… from the catalogue (#1670), with direction-A marks

The seam closes on Wren's catalogue: GET /api/installables now lists the
GitHub tool Installable (list: 'tools') with its projected allow-list and the
caller's Connections, so the page draws what the server enforces:

- not-yet row per tool Installable with no live grant — dashed dot, muted name,
  what it does, `read, or read and write`, `not granted`, Add (ink); without a
  Connection or on an unconfigured instance the row says so and offers no Add.
- Add opens in the aside: room, connection (when more than one), a writeMode
  segment, the allow-list the mode admits (read → read tools; write modes →
  all), what asks first (the catalogue's irreversible tools under `write`),
  every non-internal seat in the room checked, expiry 7/30/90 days, Grant (ink).
  The mint body is the server's: connectionId, installationId, target, tools,
  writeMode, audience, expiresAt — never a brokerId (Vera 67728).
- Change access pre-fills from the grant (effectiveAudience, not the raw
  snapshot — Vera 67568) and is a new grant plus a revoke of the old one;
  Grant again on an expired/revoked row only mints.
- "what asks first" under `write` lists the catalogue's irreversible tools.
- direction A (Sam 2026-09-11): the grant's mode and a trail line's outcome
  carry a 14px mark with the word in `title`; the granted row no longer repeats
  the tool's description sentence.

glyphs.tsx is the same file #1671 adds (identical content, merges clean).

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_016DspLEe1mFV94dPGCqA1u5
lilyshen0722 added a commit that referenced this pull request Sep 12, 2026
…ption A) (#1669)

* feat(v2): Tools on the Connectors page — the granted half (piece 4, option A)

Tools plan §6: a second list under the channels in the same row grammar, one
row per RoomGrant the person can see (live · pulsing when used in the last
10 min · hollow when revoked or expired), the aside from the projected grant
(who granted it and when it ends, the agents allowed, the allow-list under its
write mode, what asks a person first, budget, two-click Revoke) and the trail
from the broker's rows — one muted mono line per ToolCall with the three
COUNT(*) numbers in display 22 / mono 11. Heading with the mono count, a
search field and a segment on the same line. 390 as the channels list.

SEAM (Wren 67724/67725): the not-yet row, the Add form and Change access wait
on the builtin GitHub Installable landing in GET /api/installables with its
McpServer.enabledTools; the server derives brokerId. Until then `catalog` is
empty and those controls do not render — nothing pretends to grant.

Reads only /api/pods/:podId/grants, /api/grants/:id/calls,
/api/registry/pods/:podId/agents (#1668). GitHub glyph added to the platform
set. Layout invariants: trail line is muted mono with no semantic colour;
counts are 22/11; the display titles reset under :lang(zh).

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_016DspLEe1mFV94dPGCqA1u5

* feat(v2): Tools — the not-yet row, Add, Change access and Grant again from the catalogue (#1670), with direction-A marks

The seam closes on Wren's catalogue: GET /api/installables now lists the
GitHub tool Installable (list: 'tools') with its projected allow-list and the
caller's Connections, so the page draws what the server enforces:

- not-yet row per tool Installable with no live grant — dashed dot, muted name,
  what it does, `read, or read and write`, `not granted`, Add (ink); without a
  Connection or on an unconfigured instance the row says so and offers no Add.
- Add opens in the aside: room, connection (when more than one), a writeMode
  segment, the allow-list the mode admits (read → read tools; write modes →
  all), what asks first (the catalogue's irreversible tools under `write`),
  every non-internal seat in the room checked, expiry 7/30/90 days, Grant (ink).
  The mint body is the server's: connectionId, installationId, target, tools,
  writeMode, audience, expiresAt — never a brokerId (Vera 67728).
- Change access pre-fills from the grant (effectiveAudience, not the raw
  snapshot — Vera 67568) and is a new grant plus a revoke of the old one;
  Grant again on an expired/revoked row only mints.
- "what asks first" under `write` lists the catalogue's irreversible tools.
- direction A (Sam 2026-09-11): the grant's mode and a trail line's outcome
  carry a 14px mark with the word in `title`; the granted row no longer repeats
  the tool's description sentence.

glyphs.tsx is the same file #1671 adds (identical content, merges clean).

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_016DspLEe1mFV94dPGCqA1u5

* fix(v2): the Add form sends no installationId — the mint takes it from the Connection (#1677)

Vera 67821 via #1677: a grant on connection A must not be able to name
installation B, so the mint derives installationId from the Connection and
refuses a client-supplied one. The body is now exactly the six keys the route
takes — audience, connectionId, expiresAt, target, tools, writeMode — pinned
by key list, with brokerId and installationId both asserted absent.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_016DspLEe1mFV94dPGCqA1u5

* fix(v2): Tools — Revoke and Change access are the granter's; a failed revoke after Change access is retried alone; the trail says "awaiting a person"

Vera 67912 / Wren 67913 on 0368992:
- Revoke and Change access render only when grant.grantedBy is the viewer —
  the route 403s anyone else, so the page never draws a control the server
  would refuse. A member still reads the grant and its trail.
- Change access keeps the minted grant whatever happens next. If the revoke
  of the old grant fails, the aside says the old one is still live and offers
  "Revoke the old grant", which retries only the revoke — never a third mint.
- A trail line's outcome reads like the count: pending_approval → "awaiting a
  person" (the mark's title too).

Tests: "Revoke renders only for the granter"; the failed-revoke retry pins the
three POSTs as mint, revoke, revoke.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_016DspLEe1mFV94dPGCqA1u5

---------

Co-authored-by: Claude Fable 5.1 <[email protected]>
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