Repository navigation
Commit 04e776b
docs(spec, docs): App.defaultAgent and actions-as-tools name the agent route as the one chat door (#21976)
Fixes #21968
**Merge gate:** this PR merges only once objectstack-ai/cloud#2651 has
merged. That PR removes the three assistant routes. Until it lands, the
corrected text would be ahead of the server.
Clause-②: no
## What changed
The `App.defaultAgent` docblock and one docs callout named `POST
/api/v1/ai/assistant/chat`, a route the maintainer's ruling on
objectstack-ai/cloud#2621 retires. Both texts now name the agent route,
`POST /api/v1/ai/agents/:agentName/chat`, as the one chat door.
- **`packages/spec/src/ui/app.zod.ts`, the `App.defaultAgent`
docblock.** It no longer says a server route reads the key. It now
describes the reader that exists, objectui at the `.objectui-sha` pin
`0abd4f9f87`: the chat dock passes the active app's `defaultAgent` to
the console's one surface-to-agent resolver. That resolver honours the
value only when it names `ask` or `build` (legacy aliases included) and
otherwise falls back to the surface default. The resolved agent is then
called by name on the agent route, where the `:agentName` path segment
selects the agent. The sentence on the bare `POST /api/v1/ai/chat` route
stays, shortened: it reads no agent, so the key does not scope it. The
ADR-0063 surface-binding paragraph and the rule that only the two
platform agents resolve are unchanged.
- **`content/docs/ai/actions-as-tools.mdx`.** The in-product chat-route
callout lists the agent route only. It keeps its account of how the
principal is taken from `req.user` and forwarded as
`toolExecutionContext`.
- **Changeset** `@objectstack/spec` `patch`. Measured: after `pnpm
--filter @objectstack/spec build`, the new docblock text has 1 hit in
each of `dist/ui/index.mjs` and `dist/ui/index.js`, and in the
`dist/browser` bundles. The old route string has 0 hits in `dist`. The
positive control, the unchanged ADR-0063 paragraph, has 1 hit in
`dist/ui/index.mjs`. The package's `files` list also ships
`src/**/*.zod.ts`. The `.d.ts` files do not carry the docblock.
No schema, parse, `.describe()`, export, type or accept-set change.
`check:generated` confirms that no generated reference moved.
## How the console reads the key (objectui at `0abd4f9f87`, read-only)
- `ConsoleLayout.tsx` passes `activeApp?.defaultAgent` to the chat dock,
both on desktop and in the mobile sheet.
- `ChatDock.tsx` (`ChatDockConversation`) calls
`resolveSurfaceAgent('default', { agents, appDefaultAgent: defaultAgent,
aiStudioEnabled, canAuthorMetadata })`. It posts to
`apiBase/agents/NAME/chat`, with the resolved name URL-encoded.
- `surfaceAgent.ts` (`resolveSurfaceAgent`) runs these steps in order:
1. It keeps the value only if `isBuiltinAgentName` holds. That means
`build`, `metadata_assistant`, `ask` or `data_chat`. Any other value is
dropped.
2. With no kept value, the surface default applies: `build` on
`studio-build`, `ask` everywhere else.
3. A `build` request falls back to `ask` when AI Studio is off.
4. An `ask` request becomes `build` for a principal who may author
metadata, when the catalog serves `build`.
5. The result is matched against the live catalog, alias-aware. If
nothing matches, the catalog's platform default is used.
## Census of the three retired routes, and of claims that a server route
reads `defaultAgent`
Searched at `c9761cd2fb` (`git grep`, outside `content/docs/releases/`):
| Hit | Lane | Disposition |
|---|---|---|
| `packages/spec/src/ui/app.zod.ts:1658` | spec | moved with this card |
| `content/docs/ai/actions-as-tools.mdx:275` | docs | moved with this
card |
| `packages/spec/CHANGELOG.md:29568`,
`packages/client/CHANGELOG.md:3498`,
`packages/runtime/CHANGELOG.md:31673` | release-owned | listed, not
edited. These are historical entries. |
| `packages/spec/liveness/agent.json:3` and `:70` cite cloud
`routes/assistant-routes.ts#buildAssistantRoutes` | spec, ledger
evidence | listed, not edited. They name the handler file, not a route
path, and are anchored at `cloud cb8ee7ff`, where they stay true.
`planning.maxIterations` is still live through `agent-routes.ts` and
`eval-runner.ts`. This lane cannot read cloud to re-anchor them. |
`skills/**`, `.claude/**`, `docs/adr/**` and `examples/**` have zero
hits for the three routes. No text in `content/docs`, `skills` or
`examples` says a server route reads `defaultAgent`. No test asserts the
docblock text, so no needle moves.
## Tests
All runs are at `7f6089bd50` (HEAD). The spec build was taken at
`4e79442153`, whose source is the same; the build-input stamp matched.
- `pnpm --filter @objectstack/spec build`: VERDICT command-exit 0.
- `pnpm --filter @objectstack/spec check:generated`: exit 0, "All 15
generated artifacts are up to date".
- `pnpm --filter @objectstack/spec run typecheck`: VERDICT command-exit
0.
- `vitest run --project local` over the six `src/ui/app*.test.ts` files:
6 files, 203 tests passed. This is a declared narrowing. The diff is a
comment in `app.zod.ts`, so the full spec suite is left to CI.
- `node scripts/pm/dispatch-gates.mjs --ran`: 101 derived, 100 run, 1
NOT MEASURED, 0 UNRUN.
- Five gates first refused with PREREQUISITE NOT MET (exit 3):
`check:doc-formula-expressions`, `check:doc-security-posture`,
`check:skill-examples`, `check:docs-transcript-drift` and
`check:lean-entry-closure`. After a build of formula, lint, client,
client-react and objectql, all five exited 0.
- NOT MEASURED: `check:dual-build-cjs-loads`, reason: it needs `dist`
for the whole workspace (87 packages). As a narrowed stand-in, all 19
`require` entries of `@objectstack/spec` load. CI's `Lint & Repo Gates`
runs the full gate.
- The six artifact-roster gates flagged under my paths also exited 0:
`check-changeset-fixed`, `check:authz-resolver`,
`check:error-code-casing`, `check:filter-alias-parity`,
`check:meta-url-spelling` and `check:spec-changes`.
- **Lint, narrowed:** `eslint --no-inline-config --format json` over the
two edited source files.
- Population, read from eslint's own answer: `app.zod.ts` is linted,
with 0 errors and 0 warnings. The `.mdx` file is outside the population
("no matching configuration").
- Invariance: `eslint.config.mjs` never enables type-aware linting (it
has no `parserOptions.project`), so this diff cannot move the result for
any file it does not touch.
## Acceptance notes
- objectui's `AiChatPage.tsx` also takes a `defaultAgent` prop, and
resolves it with `resolveDefaultAgentName`, which is not bounded to
`ask` / `build`. But the console mounts it in `apps/console/src/App.tsx`
with no props, so `app.defaultAgent` never reaches it there. The
docblock therefore describes only the dock path. This is noted, not
filed: nothing passes the key down that path. Carrier: none.
- Whether `defaultAgent` needs a server consumer is not this card's
question (triage).
---
_Generated by [Claude
Code](https://claude.ai/code/session_01T9u38rswFp5Rw8DswRUReJ)_
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent dcf3eb4 commit 04e776b
3 files changed
Lines changed: 27 additions & 12 deletions
File tree
- .changeset
- content/docs/ai
- packages/spec/src/ui
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
271 | 271 | | |
272 | 272 | | |
273 | 273 | | |
274 | | - | |
275 | | - | |
276 | | - | |
277 | | - | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
278 | 277 | | |
279 | 278 | | |
280 | 279 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1655 | 1655 | | |
1656 | 1656 | | |
1657 | 1657 | | |
1658 | | - | |
1659 | | - | |
1660 | | - | |
1661 | | - | |
1662 | | - | |
| 1658 | + | |
| 1659 | + | |
| 1660 | + | |
| 1661 | + | |
| 1662 | + | |
| 1663 | + | |
| 1664 | + | |
| 1665 | + | |
1663 | 1666 | | |
1664 | | - | |
1665 | | - | |
1666 | | - | |
| 1667 | + | |
| 1668 | + | |
| 1669 | + | |
1667 | 1670 | | |
1668 | 1671 | | |
1669 | 1672 | | |
| |||
0 commit comments