Repository navigation
docs(#6380 slice 3): API docs for public interfaces (#11190) #11809
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| # fleet verb reference | ||
|
|
||
| Contract for each verb of the `fleet` multicall binary. The code is the | ||
| source of truth: the dispatch in `crates/fleet/src/main.rs` and the domain | ||
| handlers. The `subcommands` arrays in `crates/fleet-registry/src/lib.rs` are | ||
| stale (the queue domain lists about 16 verbs, the code dispatches 31); do not | ||
| generate docs from them until they are fixed. | ||
|
|
||
| Invocation: `fleet <domain> <verb> [args]`, or the domain's alias as argv0 | ||
| (`repo-queue`, `queue-broker`, `secrets-broker`, `laptop-agent-broker`, | ||
| `atlas-search`, `laptop-agent`). | ||
|
|
||
| ## Root | ||
|
|
||
| | Verb | Contract | | ||
| |------|----------| | ||
| | `init` | Initialise fleet configuration. | | ||
| | `version`, `--version`, `-V` | Print the version. | | ||
| | `capabilities` | List available domains and their state. | | ||
| | `help [domain]` | Print help for the binary or one domain. | | ||
|
|
||
| Exit codes: `0` success; `2` usage error; `69` (`EX_UNAVAILABLE`) when a | ||
| domain is unavailable (capability stub). | ||
|
|
||
| ## queue | ||
|
|
||
| Client for the repo-queue broker (`crates/fleet-queue/src/client.rs`). | ||
|
|
||
| | Verb | Contract | | ||
| |------|----------| | ||
| | `validate` | Validate a packet without writing it. | | ||
| | `enqueue` | Add a packet to the queue. | | ||
| | `list` | List items, with filters. | | ||
| | `claim` | Claim the highest-priority eligible item for a worker and lane. | | ||
| | `release` | Release a claim (requires `--reason`). | | ||
| | `lane` | Inspect or set lane state. | | ||
| | `bind` | Bind an item to a task reference. | | ||
| | `heartbeat` | Extend a claim's lease. | | ||
| | `checkpoint` | Record progress and the next action on a claimed item. | | ||
| | `park` | Park an item until its delay or a wake. | | ||
| | `wake` | Return a parked item to eligible. | | ||
| | `block`, `unblock` | Mark an item blocked with a reason class, or clear it. | | ||
| | `dep-recheck` | Re-evaluate dependency edges. | | ||
| | `quarantine-recheck` | Re-evaluate quarantined items. | | ||
| | `cancel` | Cancel an item. | | ||
| | `revive` | Reopen a failed or cancelled item. | | ||
| | `fail` | Mark a claimed item failed, with a reason class. | | ||
| | `complete` | Mark a claimed item done with a structured result. | | ||
| | `verify-disposition` | Verify a recorded disposition. | | ||
| | `timeline`, `history` | Event timeline for one item (same handler). | | ||
| | `models` | Model catalog and pool information. | | ||
| | `health` | Broker health and per-queue counts. | | ||
| | `signal` | Send a signal to a worker or item. | | ||
| | `fallback` | `scan`, `status`, `claim`, `heartbeat`, `release` (fallback mode). | | ||
| | `dispatch` | `status`, `launch`, `enqueue` (`placement.rs`). | | ||
| | `session` | Placement session commands. | | ||
| | `surfaces` | Print the placement surface registry (`pkgs/fleet/fleet-surfaces.json`) as JSON. Read-only; takes `[--registry PATH]`. | | ||
| | `outbox` | Creation outbox group. | | ||
| | `stack` | Stack group. | | ||
|
|
||
| ## Other domains | ||
|
|
||
| | Domain and verb | Contract | | ||
| |-----------------|----------| | ||
| | `serve` | Serve role (`fleet-serve`). | | ||
| | `proxy serve`, `connect`, `init`, `ssh`, `splice`, `get`, `put` | Proxy leaves. `connect` takes connection flags; `put` takes mode and no-resume flags. | | ||
| | `dispatch status`, `launch`, `enqueue` | Dispatch status, launch a run, enqueue work (`crates/fleet-dispatch`). | | ||
| | `dispatch-test scan`, `submit`, `status` | Test-dispatch scan, submit and status (`crates/fleet-dispatch-test`). | | ||
| | `secrets get`, `list` | Secret lookup and listing. | | ||
| | `gh <args>`, `tiers`, `cache-serve`, `cache-status`, `--raw` | Pass-through to `gh`; tier information; cache serve and status. | | ||
| | `search search`, `get-chunk` | Search the index and fetch a chunk. The `serve` alias is also accepted. | | ||
| | `laptop-agent health`, `jobs`, `kill`, `exec`, `run`, `poll`, `fetch` | Laptop-agent broker operations. | | ||
|
|
||
| Note: `scripts/fleet` is a directory of helper scripts, not the multicall | ||
| binary. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,87 @@ | ||
| # MCP tool reference | ||
|
|
||
| API-level reference for the tools mcpx exposes to MCP clients. For the | ||
| route and CLI mapping of every operation, see [Parity](parity.md). For the | ||
| protocol, see [MCP](mcp.md). | ||
|
|
||
| This page describes the surface as implemented in | ||
| `internal/mcpserver/server.go` (hand-written tools) and | ||
| `internal/mcpserver/ops.go` (generated tools). It documents behaviour; it | ||
| does not change it. | ||
|
|
||
| ## Surfaces | ||
|
|
||
| | Surface | Tools | Source | | ||
| |---------|-------|--------| | ||
| | Hand-written | 12 | `internal/mcpserver/server.go`, `Tools()` | | ||
| | Generated | one `mcpx_<op>` per operation | `internal/mcpserver/ops.go`, `OpTools` | | ||
| | Dynamic | adapter, OpenAPI, recipe, reactive, passthrough, raw | `internal/cli/serve.go` | | ||
|
|
||
| Dynamic tools exist only when their upstream or configuration is present. | ||
| Their names are derived from the upstream: `<adapter>_<tool>`, OpenAPI | ||
| `operationId` (with `_2`-style suffixes for collisions), `recipe_<name>`, | ||
| and `<namespace>_<tool>` on the raw surface (`?codemode=false`). | ||
|
|
||
| ## Hand-written tools | ||
|
|
||
| | Tool | Parameters | Purpose | | ||
| |------|------------|---------| | ||
| | `mcpx_namespaces` | none | List configured namespaces. | | ||
| | `mcpx_catalog` | `budget`, `bias` | Catalog of available tools, sized to a budget. | | ||
| | `mcpx_types` | `namespaces` | TypeScript signatures for namespaces. | | ||
| | `mcpx_search` | `query`, `limit` | Search tools by name or description. | | ||
| | `mcpx_call` | `namespace`, `tool`, `arguments` | Call one upstream tool. | | ||
| | `mcpx_exec` | `source`, `timeoutSec` | Run a Code Mode script. | | ||
| | `mcpx_log` | `since`, `level`, `event`, `limit` | Read daemon log entries. | | ||
| | `mcpx_stats` | `dimension` (enum) | Usage and timing statistics. | | ||
| | `mcpx_registry` | `query`, `limit` | Search the server registry. | | ||
| | `mcpx_status` | none | Daemon status. | | ||
| | `mcpx_batch` | `calls`, `stopOnError`, `parallel` | Run several calls in one request. | | ||
| | `batch_call` | as `mcpx_batch` | Alias of `mcpx_batch`. The reactive-surface version has a different schema. | | ||
|
|
||
| ## Generated tools | ||
|
|
||
| Each operation in `internal/api/ops.go` `Ops()` produces one | ||
| `mcpx_<op>` tool, except: | ||
|
|
||
| - operations covered by a hand-written tool (`status`, `namespaces`, | ||
| `search`, `types`, `catalog`, `call`, `call_path`, `batch`, `exec`); | ||
| - streaming operations (`events`); | ||
| - operations marked `NoTool` (`secrets_set`). | ||
|
|
||
| Input schemas come from each operation's `Params` through `InputSchema()`. | ||
| Annotations are derived from the operation: | ||
|
|
||
| | Annotation | Value | | ||
| |------------|-------| | ||
| | `readOnlyHint` | `!Mutating` | | ||
| | `idempotentHint` | `!Mutating \|\| Idempotent` | | ||
| | `destructiveHint` | from the operation | | ||
| | `openWorldHint` | `true` | | ||
|
|
||
| The per-operation name, method, path and CLI mapping is in | ||
| [Parity](parity.md). Because that table is generated from `Ops()`, prefer | ||
| it over any hand-maintained list. | ||
|
|
||
| ## Return values | ||
|
|
||
| - Operation tools return pretty-printed JSON text, or raw text when the | ||
| operation sets `Text`. | ||
| - An empty upstream body returns `(the daemon answered with an empty body)`. | ||
| - Tool failures return a result with `isError: true` and the error text. | ||
| Text the tool produced before failing is kept ahead of the error. | ||
|
|
||
| ## Errors | ||
|
|
||
| | Condition | Result | | ||
| |-----------|--------| | ||
| | Invalid parameters | JSON-RPC error `-32602`. | | ||
| | Upstream JSON-RPC error | Relayed as `UpstreamError`. | | ||
| | Unknown name on the raw surface | `no tool named "<name>" on the raw surface (codemode=false)`. | | ||
|
|
||
| ## Known gaps | ||
|
|
||
| - Tool inputs and outputs are not yet validated against their JSON Schemas | ||
| (see [Protocol](protocol.md), known gaps). | ||
| - Operation counts in [interfaces](interfaces.md) and [HTTP API](http-api.md) | ||
| predate the current operation set; the live count comes from `Ops()`. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| # pm-stack aggregator routes | ||
|
|
||
| HTTP routes served by the aggregator (`pm-stack/aggregator/src/server.ts`). | ||
| Routing is a single handler: each path is a branch in sequence, and unknown | ||
| paths return the not-found response. The page list is in | ||
| `pm-stack/aggregator/src/pages.ts` (`PAGES`); derive any table from it rather | ||
| than maintaining one by hand. | ||
|
|
||
| Method rule: a route marked GET answers GET as its contract. Other methods | ||
| on GET-only routes are unsupported. Some routes are not method-guarded in the | ||
| code, so do not rely on them rejecting other methods. | ||
|
|
||
| ## GET JSON (machine surface) | ||
|
|
||
| Each HTML page has a JSON twin, plus a few JSON-only endpoints: | ||
|
|
||
| - `/api/overview.json`, `/api/today.json`, `/api/digest.json`, | ||
| `/api/digests.json`, `/api/attention.json`, `/api/needs-drew.json` | ||
| - `/api/queue.json`, `/api/orchestration.json`, `/api/board.json`, | ||
| `/api/roadmap.json`, `/api/releases.json` | ||
| - `/api/quota.json`, `/api/quota/service.json`, `/api/quota-analytics.json`, | ||
| `/api/flow-analytics.json`, `/api/forecasts.json` | ||
| - `/api/dns.json`, `/api/aa.json`, `/api/search.json`, `/api/registry.json`, | ||
| `/api/conflicts.json`, `/api/projects.json`, `/api/program.json`, | ||
| `/api/program-project.json` | ||
| - `/api/events.json`, `/api/activity.json`, `/api/views.json`, | ||
| `/api/actions.json`, `/api/comments.json`, `/api/comments/queue.json`, | ||
| `/api/coverage.json`, `/api/alerts.json`, `/api/alerts/preferences.json`, | ||
| `/api/notifications.json`, `/api/freshness-events.json` | ||
| - `/api/health`, `/api/author-identities` | ||
| - `/api/item/<id>.json` | ||
|
|
||
| ## GET HTML pages | ||
|
|
||
| `/`, `/board`, `/today`, `/digest`, `/queue`, `/roadmap`, `/quota`, | ||
| `/quota/service/<id>`, `/attention`, `/decisions`, `/decisions/<id>`, | ||
| `/answer/<id>`, `/dns`, `/aa`, `/sessions`, `/search`, `/events`, | ||
| `/projects` (redirects to `/program`), `/conflicts`, `/program`, | ||
| `/program/<id>`, `/health`, `/pages`, `/comments`, `/alerts`, | ||
| `/alerts/preferences`, `/notifications`, `/item/<id>`, `/discuss/<id>`. | ||
|
|
||
| Fragments for live updates: `/frag/overview`, `/frag/board`, `/frag/today`, | ||
| `/frag/queue`, `/frag/attention/header`, `/frag/attention/queues`, | ||
| `/frag/attention/sessions`. | ||
|
|
||
| Stream: `GET /freshness/stream` (server-sent events). | ||
|
|
||
| ## Writes (POST unless noted) | ||
|
|
||
| | Route | Methods | Purpose | | ||
| |-------|---------|---------| | ||
| | `/api/roadmap/annotations`, `/api/roadmap/annotations/alias` | POST | Roadmap annotations. | | ||
| | `/api/comments`, `/api/comments/triage`, `/api/comments/github-result` | POST | Comment submission, triage and result. | | ||
| | `/api/actions`, `/api/actions/batch`, `/api/actions/result` | POST | Action submission and results. | | ||
| | `/quota/refresh`, `/api/quota/refresh` | POST | Refresh quota data. | | ||
| | `/api/alerts` | POST | Create an alert. | | ||
| | `/api/alerts/<id>/ack`, `/api/alerts/<id>/close` | POST | Acknowledge or close an alert. | | ||
| | `/api/decision-sets`, `/api/decision-sets/submit` | POST | Create and submit decision sets. | | ||
| | `/api/decision-sets/<id>/events` | GET, POST | Decision-set events. | | ||
| | `/api/decisions/<id>/submit`, `/defer`, `/request-info` | POST | Decision actions. | | ||
| | `/api/decisions/<id>/drafts` | GET, POST | Decision drafts. | | ||
| | `/api/decisions/<id>/events` | GET, POST | Decision events. | | ||
| | `/api/needs-drew/<id>/answer` | POST | Answer a needs-Drew item. | | ||
| | `/api/sw-probe` | POST records; GET summarises | Service-worker probe. | | ||
| | `/api/push/subscriptions` | POST (create), DELETE (remove) | Push subscriptions; other methods return 405. | | ||
| | `/api/push/test`, `/api/push/test-class` | POST | Push test sends. | | ||
| | `/api/admin/identity-registry` | GET, POST, DELETE | Identity registry administration. | | ||
|
|
||
| ## Static and PWA assets | ||
|
|
||
| `/sw.js`, `/manifest.webmanifest`, `/icons/icon-192.png`, | ||
| `/icons/icon-512.png`, `/icons/icon-maskable-512.png`, | ||
| `/icons/apple-touch-icon.png`, `/assets/app.css`, `/assets/datastar.js`, | ||
| `/assets/aa-explorer-computations.js`, `/assets/push-client.js`, | ||
| `/assets/freshness-client.js`. | ||
|
|
||
| ## Other listeners | ||
|
|
||
| `freshness-ipc.ts` exposes `POST /publish` on its own listener, separate | ||
| from the dashboard handler. |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For operators configuring a new host,
fleet initdoes not initialise configuration: its help explicitly says “Autostart this host's fleet roles if they are not running” (crates/fleet-proxy/src/client.rs,INIT_USAGE). The implementation reads the existing host configuration and can start the proxy and secrets broker; an unknown location instead exits 69 without configuring anything. Document the autostart behavior so readers do not unexpectedly launch services when intending only to initialise configuration.Useful? React with 👍 / 👎.