Skip to content

Commit 0d68ce2

Browse files
feat(chat): a Continue button for a stopped ask turn — spec resume field and data-turn-end part, plugin-chatbot UI (#38698)
<!-- claude-projects-attribution: {"github_login":"os-warren"} --> _Requested by **Warren** · [project thread](https://claude.ai/code/project/chan_01U5RdnAAmkSQmZbqh6FtqZ8?thread=cmsg_01U5RdnAAmkSQmZbqh6FtqZ88TCniMD3icYaF2RmC5L5B5)_ Part of #38609 Clause-②: yes (widening) Metadata-protocol: added Skills-docs: none — the added keys are the AI chat route's wire (`resume`) and its stream part and stored message field (`turnEnd`), written by the AI service and read by the console chat; no metadata author writes them and no published skill teaches the chat wire ## 维护者速读 - 用户能看到什么变化:在控制台的问答里,回答因时间、额度或轮数触顶而停下、且服务端表示可以续跑时,最后一条回答下出现「继续查」按钮并显示还能继续几次;点了不新增提问气泡,答案接着写进同一轮,刷新页面后按钮仍在。 - 为什么做:这是「继续查」的协议与界面一半,服务端续跑那一半在云端卡(AI 服务按同一轮重建并续跑)上;协议先落,云端那一半才能接。 - 出错会怎样:服务端没发「回合结束」信息之前界面什么都不画,现有对话不受影响;全是新增的可选字段,撤回即删。 - 要你做什么:无(契约审核由席位安排)。 ## What changes **Spec (`@objectstack/spec`) — three additions, all closed shapes:** - `TurnEndSchema` + `TURN_END_PART_TYPE = 'data-turn-end'` in a new `packages/spec/src/ai/turn-end.zod.ts` (modelled on `draft-review.zod.ts`): `{ reason, wrapUp, resumable, resumesLeft, turnId }`. `reason` is a non-empty string, not an enum: the producer's vocabulary includes every turn-refusal kind and grows with it, and the chat decides nothing from it. `resumable` is the server's verdict alone. - `AiChatRequestSchema.resume`: optional `{ turnId }` (closed, `turnId` non-empty). Its text says a resume names its turn itself (the top-level `turnId` is not read on a resume, and `turnId`'s own description says so) and that the resume stream's `start` chunk carries the request's `messageId` or none. - `AiConversationMessageSchema.turnEnd`: optional, nullable `TurnEndSchema`, on the turn's last message, so a reload knows the turn end too. - Regenerated: `api-surface`, `export-origins`, `declaration-map`, references docs, strictness ledger counts, authorable-surface and json-schema manifest projections (`check:generated --fix`, only the five it proved stale). **UI (`@object-ui/plugin-chatbot`, `@object-ui/app-shell`, `@object-ui/i18n`):** - `mapMessages.extractTurnEnd` reads the newest `data-turn-end` part through `TurnEndSchema` onto `ChatbotEnhancedMessage.turnEnd`; a refused part is no turn end. - New `chat/ContinueTurnButton.tsx` (the control) and `chat/resumableTurn.ts` (`resumableTurnOf`, where it is drawn). `ChatbotEnhanced` takes `onResumeTurn(turnId)` and draws Continue under the conversation's **last** answer only when its turn end is `resumable` with `resumesLeft > 0`, nothing streams, and the view is not read-only. A message sent afterwards makes the answer no longer last, so the control goes. - New `resumeTurn.ts`; `useObjectChat` returns `resumeTurn(turnId)` in API mode: the chat runtime's `sendMessage(undefined, { body: { resume: { turnId } } })` sends the conversation as it stands (no user message, no bubble) and streams into the last assistant message, sending the answer's id as `messageId`. `withTurnId` stamps the turn id on every request except a resume. The runtime's no-message send addresses the newest answer holding an `approval-responded` tool part rather than the last answer, and offers no public way to name the target, so the hook offers `resumeTurn` only while that send addresses the last answer (`resumeAddressesLastAnswer`); otherwise no Continue is drawn. - The turn end is a kept data part (`STORED_ANSWER_DATA_PARTS.turnEnd`; write in `storedAnswerParts`, read in `storedAnswerData`), so it survives API mode's store rebuild and the message cache; `toUIMessages` writes a stored `turnEnd` field back as that part, so server history and cache are read by one reader. - Console wiring: `ChatPane` passes `resumeTurn`; the schema renderer passes it in both chat surfaces. - `chatbot.continueTurn.*` strings in all eleven locales (zh-Hant regenerated from zh-Hans by its generator); README and the frontend docs page document the control. **Where the stream comes from.** The console's ask chat is served by the cloud AI service (agent route + stream encoder), not by this repository. Until it sends `data-turn-end` and accepts `resume`, nothing is drawn and no resume is sent. That half — persist `turnEnd`, emit the part, accept and execute `resume`, and the ADR-0013 D3 amendment — is objectstack-ai/cloud#5239. This PR is therefore `Part of`: the card's done-when also needs the spec released into the pin cloud consumes and a check against cloud#5239's endpoint. ## Why Maintainer-directed (filing gate ③ on the card): a turn that stops on a limit today can only be continued by typing, which starts a new turn that cannot see the tool results the stopped one already read. A server-side resume of the same turn needs the request field, an end-of-turn signal the UI can read live and after a reload, and a button. ## Tests - `packages/spec/src/ai/turn-end.test.ts` — the part name; admits a resumable wrap-up and a finished answer; refuses an unknown key (`unrecognized_keys`), each missing key by path, a negative or fractional count, an empty reason or turn id; `resume` admitted and kept, refused when empty, missing `turnId` or carrying an unknown key; `turnEnd` admitted, null or absent, and refused through the same closed shape. - `ui/packages/plugin-chatbot/src/__tests__/continueTurn-38609.test.tsx` — the kept-part entry equals `TURN_END_PART_TYPE`; lift / refuse / newest wins / stored-part round trip; where Continue is drawn and every hide case (not resumable, none left, streaming, a later user or assistant message, loading, read-only, no handler); the request body (`resume` and `messageId`, no top-level `turnId`; CONTROL: without `resume` it is stamped); and three tests through the **real** chat runtime with a stubbed stream: a restored thread draws Continue, the click sends `resume: { turnId }` with exactly the two existing messages, `messageId: 'a1'` and no `turnId`, the rest of the answer lands in the same bubble with no new user bubble, and the new turn end hides the control; a `start` naming the request's `messageId` keeps one answer bubble; CONTROL: a `start` naming another id draws a second answer; the resume-target rule (last answer; an earlier answered approval wins; the last answer holding one is still last); a restored thread with an earlier `approval-responded` part draws no Continue and sends nothing (CONTROL: with that approval already run, Continue resumes `a1`). - `ui/packages/app-shell/src/console/ai/__tests__/AiChatPage.turnEndReload-38609.test.tsx` — server history (stored `turnEnd` field) and cache fallback both restore Continue; CONTROL: a refused, null or absent stored turn end offers nothing. - Ablation (each reverted after): dropping the `resume` body turns the request pin and the runtime test red (2 failed); not writing the stored `turnEnd` back in `toUIMessages` turns the server-history pin red (1 failed); stamping `turnId` on a resume again turns the request pin and the runtime test red (2 failed); offering `resumeTurn` whatever the target turns the earlier-approval pin red (1 failed). **Local gates:** the derived family run (`dispatch-gates.mjs --commands`, 119 commands) ran beside the first CI run; its readings, with the head they were taken on, are in the os-dev report comment on #38609. Spec package: `pnpm --filter @objectstack/spec test` 914 files / 28919 tests passed, `typecheck` exit 0. Spec `check:generated`: all 14 artifacts up to date. UI `type-check` (plugin-chatbot, i18n, app-shell): exit 0. UI tests (plugin-chatbot, i18n, app-shell `console/ai` + `hooks`): 337 files, 1 failure (zh-Hant not regenerated) fixed by running its generator, then green. ## Acceptance notes - Surface beyond the claim's list: the `chatbot.continueTurn.*` keys in every `ui/packages/i18n` locale (key-parity test), one prop line in `ChatPane.tsx` and `ui/packages/plugin-chatbot/README.md` are admitted by claim amendment 7269233060; the `content/docs/frontend/plugins/plugin-chatbot.mdx` section (`ui/AGENTS.md` commandment 2) is admitted by the seat's further amendment after the contract review. - `Clause-②:` is written `yes (widening)` (the claim's `yes`, with the arm its own text states: additive, optional). - `Metadata-protocol:` is `added`, not the claim's `none`: measured from the diff, the change moves the `authorable-surface` shards (`ai/TurnEnd:*`, `api/AiChatRequest:resume`, `api/AiConversationMessage:turnEnd`), and `check-changeset-no-major` reads that as a key entered. `@objectstack/spec` is graded `minor` accordingly; the UI packages stay `patch`. - `packages/spec/llms.txt` counts the new schema module (ai 18, 233 in all) with a Turn End row, as `check:llms-txt` requires. - No browser E2E against a live stack: the console's chat is served by the cloud AI service, which neither emits `data-turn-end` nor accepts `resume` before cloud#5239. The runtime-level test above drives the real AI SDK chat with a stubbed stream instead; the card's "verified against cloud#5239's resume endpoint" stays open. - `extractTurnEnd` is not re-exported from the package root (only the chat itself reads the part). ## For cloud#5239 Not fixed here: they belong to the server half, which picks them up from this list (contract review comment 7271059472 on this PR). - `AIConversationMessage` in `packages/spec/src/contracts/ai-service.ts` names `AiConversationMessageSchema` as its wire shape but carries `turnId` only, and `addMessage` has no way to write a turn end. How the turn end is stored is the server half's; widen the contract there, so the spec is not released twice for one feature. - A turn replayed by its `turnId` (ADR-0013 D1, nothing ran) sends no turn end, so a Retry of a wrapped-up answer loses Continue until a reload restores it from the stored field. Declared behaviour and a producer choice. - A retried resume has no idempotency key: nothing in `resume: { turnId }` tells a network retry of one press from the next press, so one press can spend two resumes. The shape is closed, so any such key is a later widening. ## Verification Two minutes: `pnpm --dir ui exec vitest run packages/plugin-chatbot/src/__tests__/continueTurn-38609.test.tsx` — 19 passed, including the runtime tests that click Continue, read the sent body and count the answer bubbles. Read first (by risk): 1. `ui/packages/plugin-chatbot/src/useObjectChat.ts` `resumeTurn` + `resumeTurn.ts` — relies on the AI SDK sending the current messages and streaming into the last assistant message when `sendMessage` gets no message (ai 7.0.118, `AbstractChat.sendMessage` / `makeRequest`). 2. `packages/spec/src/api/protocol.zod.ts` — the two new keys on published wire schemas. 3. `ui/packages/plugin-chatbot/src/chat/resumableTurn.ts` `resumableTurnOf` — the show/hide rule. ## Human Minimum - [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic. - [x] 2. Every name I added uses the casing for its kind. - [x] 3. No formatter ran; `pnpm lint` passes (CI). - [x] 4. One issue, one branch off an up-to-date `main`, one pull request. - [x] 5. A change that publishes carries a changeset, and both declaration lines are filled in here and in the changeset. - [x] 6. `packages/spec` touched: its generated artifacts are regenerated and committed. - [x] 7. No hand edits to `content/docs/references/`, `packages/*/CHANGELOG.md` or `content/docs/releases/`. - [x] 8. Title, body and comments are in English. - [x] The *Before Submitting* list in CONTRIBUTING.md is done. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01JQwxbYmVBS2cvoZWKGbx92 --- _Generated by [Claude Code](https://claude.ai/code/session_01JQwxbYmVBS2cvoZWKGbx92)_ <!-- signed: repo:objectstack@os-warren · os-warren · session_01JQwxbYmVBS2cvoZWKGbx92 --> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent a1ef710 commit 0d68ce2

48 files changed

Lines changed: 1225 additions & 30 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
'@objectstack/spec': minor
3+
'@object-ui/plugin-chatbot': patch
4+
'@object-ui/app-shell': patch
5+
'@object-ui/i18n': patch
6+
---
7+
8+
feat(chat): a Continue control under an answer whose stopped turn the server can carry on
9+
10+
Clause-②: yes (widening)
11+
Metadata-protocol: added
12+
13+
An ask turn that stops on a limit answers with what it read so far. When the server can carry that turn on, the chat now offers Continue under the answer; pressing it streams the rest of the answer into the same turn, with no new user message.
14+
15+
- `@objectstack/spec`: `TurnEndSchema` and `TURN_END_PART_TYPE` (`data-turn-end`) in `/ai` — `{ reason, wrapUp, resumable, resumesLeft, turnId }`, closed. The chat request (`AiChatRequestSchema`) gains an optional `resume: { turnId }`, closed (a resume names its turn itself, so the request's top-level `turnId` is not read on it, and the resume stream's `start` carries the request's `messageId` or none), and a stored conversation message (`AiConversationMessageSchema`) an optional, nullable `turnEnd`. All three are additions; nothing an existing producer or caller sends changes meaning.
16+
- `@object-ui/plugin-chatbot`: the message mapper reads the `data-turn-end` part through `TurnEndSchema` onto `ChatbotEnhancedMessage.turnEnd` (a part the schema refuses is no turn end; the newest part wins). `ChatbotEnhanced` takes `onResumeTurn(turnId)` and draws Continue under the conversation's last answer when its turn end is resumable with resumes left, nothing streams and the view is interactive. `useObjectChat` returns `resumeTurn(turnId)` in API mode, which sends `resume: { turnId }` with the conversation as it stands and no top-level `turnId`. The turn end is a kept data part (`STORED_ANSWER_DATA_PARTS.turnEnd`), so it survives the store rebuild.
17+
- `@object-ui/app-shell`: the console's ask chat passes `resumeTurn` through, and a reload keeps Continue — from server history (the message's stored `turnEnd`) and from the message cache.
18+
- `@object-ui/i18n`: the `chatbot.continueTurn.*` strings, in every locale.
19+
20+
The server half — accepting `resume`, rebuilding the turn and sending `data-turn-end` — is the AI service's; until it sends the part, nothing is drawn.

‎content/docs/frontend/plugins/plugin-chatbot.mdx‎

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -660,6 +660,51 @@ export function TurnDrafts({ review, navigate }: {
660660
card.
661661
- Strings come from the `chatbot.draftReview.*` keys of `@object-ui/i18n`.
662662

663+
### Continue a stopped turn
664+
665+
An ask turn can stop before it is done, on a time, token or round limit,
666+
answering with what it read so far. When the server can carry that turn on, it
667+
ends the turn with one `data-turn-end` part (`TURN_END_PART_TYPE`, whose data
668+
is a `TurnEndSchema` object from `@objectstack/spec/ai`) and stores the same
669+
object on the turn's last message (`AiConversationMessageSchema.turnEnd`).
670+
`ChatbotEnhanced` reads it through that schema and draws a Continue control
671+
under the answer; a part the schema refuses draws nothing.
672+
673+
```tsx
674+
import { ChatbotEnhanced, toRuntimeMessages, useObjectChat } from '@object-ui/plugin-chatbot';
675+
676+
export function AskChat({ api, conversationId }: { api: string; conversationId: string }) {
677+
const chat = useObjectChat({ api, conversationId });
678+
return (
679+
<ChatbotEnhanced
680+
messages={toRuntimeMessages(chat.messages)}
681+
isLoading={chat.isLoading}
682+
onSendMessage={chat.sendMessage}
683+
onResumeTurn={chat.resumeTurn} // API mode only; absent, no Continue is drawn
684+
/>
685+
);
686+
}
687+
```
688+
689+
- Continue is drawn only under the conversation's last answer, when the turn
690+
end says `resumable: true` with `resumesLeft` above zero, nothing is
691+
streaming and the view is not read-only. It shows how many resumes are left.
692+
It is not offered while an earlier answer still holds an answered tool
693+
approval: the chat runtime would write the resume into that answer instead.
694+
Whether a turn may be resumed is the server's call; the chat never reads it
695+
from `reason`.
696+
- Pressing it calls `onResumeTurn` with the turn end's `turnId`.
697+
`useObjectChat().resumeTurn` sends a chat request with
698+
`resume: { turnId }` (`AiChatRequestSchema.resume`) and no new user message,
699+
so no user bubble appears, and the rest of the answer streams into the same
700+
answer. The newest turn end on that answer decides whether Continue is
701+
offered again.
702+
- A message sent after the answer makes it no longer the last one, so Continue
703+
goes away.
704+
- The turn end is one of `STORED_ANSWER_DATA_PARTS`, so Continue survives a
705+
reload from server history and from the message cache.
706+
- Strings come from the `chatbot.continueTurn.*` keys of `@object-ui/i18n`.
707+
663708
## Examples
664709

665710
### Simple AI Chat

‎content/docs/references/ai/index.mdx‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: AI Protocol — complete schema reference
33
navTitle: AI Protocol
4-
description: "The ObjectStack AI Protocol in 17 reference pages: every schema in @objectstack/spec with its properties, types, defaults and a TypeScript example."
4+
description: "The ObjectStack AI Protocol in 18 reference pages: every schema in @objectstack/spec with its properties, types, defaults and a TypeScript example."
55
---
66

77
{/* ⚠️ AUTO-GENERATED — DO NOT EDIT. Run build-docs.ts to regenerate. Hand-written docs live in the module folders under content/docs/. */}
@@ -25,5 +25,6 @@ This section contains all protocol schemas for the ai layer of ObjectStack.
2525
<Card href="/docs/references/ai/skill" title="Skill" description="Source: packages/spec/src/ai/skill.zod.ts" />
2626
<Card href="/docs/references/ai/solution-blueprint" title="Solution Blueprint" description="Source: packages/spec/src/ai/solution-blueprint.zod.ts" />
2727
<Card href="/docs/references/ai/tool" title="Tool" description="Source: packages/spec/src/ai/tool.zod.ts" />
28+
<Card href="/docs/references/ai/turn-end" title="Turn End" description="Source: packages/spec/src/ai/turn-end.zod.ts" />
2829
<Card href="/docs/references/ai/usage" title="Usage" description="Source: packages/spec/src/ai/usage.zod.ts" />
2930
</Cards>

‎content/docs/references/ai/meta.json‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
"draft-review",
2222
"object-query-source",
2323
"record-citation",
24-
"record-context-tools"
24+
"record-context-tools",
25+
"turn-end"
2526
]
2627
}
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
---
2+
title: Turn End schema — AI Protocol reference
3+
navTitle: Turn End
4+
description: "The turn end — why an ask turn stopped, and whether the person may ask the server to carry the same turn on from where it stopped."
5+
---
6+
7+
{/* ⚠️ AUTO-GENERATED — DO NOT EDIT. Run build-docs.ts to regenerate. Hand-written docs live in the module folders under content/docs/. */}
8+
9+
The turn end — why an ask turn stopped, and whether the person may ask the
10+
server to carry the same turn on from where it stopped.
11+
12+
## Who writes it, who reads it
13+
14+
- **Producer:** the host that runs the ask turn. At the end of a streamed
15+
turn, before the stream's `finish`, it sends one UI-message-stream data
16+
part named `TURN_END_PART_TYPE` whose `data` is a
17+
`TurnEndSchema` object. It stores the same object with the turn's
18+
last message, and the conversation routes return it there as
19+
`AiConversationMessageSchema.turnEnd`, so a reloaded conversation knows
20+
it too. A turn replayed by its `turnId` (nothing ran) sends none.
21+
- **Reader:** the console's chat (`extractTurnEnd` in
22+
`@object-ui/plugin-chatbot`). It reads the part, or the stored field,
23+
through this schema; one the schema refuses is no turn end at all, and the
24+
answer renders as it does without one.
25+
26+
## What the chat does with it
27+
28+
Under the conversation's last answer, while nothing is streaming, the chat
29+
offers a Continue control when `resumable` is `true` and `resumesLeft` is
30+
above zero. Pressing it sends a chat request carrying
31+
`resume: { turnId }` (`AiChatRequestSchema.resume`) and no new user message;
32+
the server rebuilds the stopped turn from what it stored and streams the
33+
rest of the answer into the same turn. The request carries no top-level
34+
`turnId` (a resume names its turn itself), and its `messageId` is the
35+
answer's id: the resume stream's `start` chunk carries that id or none, or
36+
the chat draws the rest as a second answer. Whether a turn may be resumed
37+
is the server's decision alone: the chat never infers it from `reason`, and
38+
the server refuses a resume it did not offer.
39+
40+
<Callout type="info">
41+
**Source:** `packages/spec/src/ai/turn-end.zod.ts`
42+
</Callout>
43+
44+
## TypeScript Usage
45+
46+
```typescript
47+
import { TurnEndSchema } from '@objectstack/spec/ai';
48+
import type { TurnEnd } from '@objectstack/spec/ai';
49+
50+
// Validate data
51+
const result = TurnEndSchema.parse(data);
52+
```
53+
54+
---
55+
56+
## TurnEnd
57+
58+
### Properties
59+
60+
| Property | Type | Required | Description |
61+
| :--- | :--- | :--- | :--- |
62+
| **reason** | `string` | ✅ | Why the turn ended, in the producer's own words: `answered` when the model ended it, `tool_ended` when a tool did, the limit that sent it to a wrap-up answer (`time_limit`, `token_budget`, `max_iterations`, …), or the kind of refusal that stopped it. Informational: the chat decides nothing from it |
63+
| **wrapUp** | `boolean` | ✅ | `true` when the answer is the wrap-up the turn gave on reaching a limit, written from what the turn had read so far, rather than an answer the model finished on its own |
64+
| **resumable** | `boolean` | ✅ | The server's verdict that a resume of this turn would be accepted now. The chat offers Continue only when it is `true` and `resumesLeft` is above zero |
65+
| **resumesLeft** | `integer` | ✅ | How many more times this turn may be resumed; `0` once none are left |
66+
| **turnId** | `string` | ✅ | The turn this end belongs to: the `turnId` a resume names in `AiChatRequestSchema.resume.turnId` |
67+
68+
69+
---
70+

‎content/docs/references/index.mdx‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Protocol reference — every schema by module
33
navTitle: Protocol Reference
4-
description: Every schema published by @objectstack/spec — 1745 schemas across 14 protocol modules
4+
description: Every schema published by @objectstack/spec — 1746 schemas across 14 protocol modules
55
---
66

77
{/* ⚠️ AUTO-GENERATED — DO NOT EDIT. Run build-docs.ts to regenerate. Hand-written docs live in the module folders under content/docs/. */}
@@ -22,7 +22,7 @@ counts are sums of the rows they head. Regenerate with
2222

2323
| Module | Pages | Schemas | Description |
2424
| :--- | ---: | ---: | :--- |
25-
| [AI Protocol](/docs/references/ai) | 17 | 105 | Agents, tools, skills, RAG and knowledge sources, model registry, conversations. |
25+
| [AI Protocol](/docs/references/ai) | 18 | 106 | Agents, tools, skills, RAG and knowledge sources, model registry, conversations. |
2626
| [API Protocol](https://github.com/objectstack-ai/objectstack/tree/main/packages/spec/docs/references/api) | 37 | 528 | REST contracts, endpoints, routing, realtime, batch, discovery. |
2727
| [Automation Protocol](/docs/references/automation) | 16 | 82 | Flows and their nodes, approvals, ETL pipelines, webhooks, state machines, execution records. |
2828
| [Data Protocol](/docs/references/data) | 35 | 197 | Objects, fields, queries, filters, datasources and drivers — the ObjectQL layer. |
@@ -36,13 +36,13 @@ counts are sums of the rows they head. Regenerate with
3636
| [Studio Protocol](https://github.com/objectstack-ai/objectstack/tree/main/packages/spec/docs/references/studio) | 3 | 35 | Studio designer metadata — the authoring surfaces for the protocols above. |
3737
| [System Protocol](https://github.com/objectstack-ai/objectstack/tree/main/packages/spec/docs/references/system) | 40 | 298 | The runtime environment — logging, jobs, cache, metrics, notifications, i18n and compliance. |
3838
| [UI Protocol](/docs/references/ui) | 17 | 187 | Apps, pages, views, dashboards, reports, actions and themes — the ObjectUI layer. |
39-
| **Total** | **223** | **1745** | 14 protocol modules |
39+
| **Total** | **224** | **1746** | 14 protocol modules |
4040

4141
---
4242

4343
## AI Protocol
4444

45-
**Source:** `packages/spec/src/ai/` · **Import:** `@objectstack/spec/ai` · **17 pages, 105 schemas**
45+
**Source:** `packages/spec/src/ai/` · **Import:** `@objectstack/spec/ai` · **18 pages, 106 schemas**
4646

4747
Agents, tools, skills, RAG and knowledge sources, model registry, conversations.
4848

@@ -64,6 +64,7 @@ Agents, tools, skills, RAG and knowledge sources, model registry, conversations.
6464
| [`skill.zod.ts`](/docs/references/ai/skill) | `Skill`, `SkillTriggerCondition` |
6565
| [`solution-blueprint.zod.ts`](/docs/references/ai/solution-blueprint) | `BlueprintApp`, `BlueprintCondition`, `BlueprintDashboard`, `BlueprintField`, `BlueprintNavItem`, `BlueprintObject`, `BlueprintSeed`, `BlueprintSummaryOperations`, `BlueprintView`, `BlueprintWidgetCondition`, `SolutionBlueprint`, `SolutionBlueprintStrict` |
6666
| [`tool.zod.ts`](/docs/references/ai/tool) | `Tool` |
67+
| [`turn-end.zod.ts`](/docs/references/ai/turn-end) | `TurnEnd` |
6768
| [`usage.zod.ts`](/docs/references/ai/usage) | `AIUsageRecord`, `TokenUsage` |
6869

6970
---

‎docs/audits/2026-07-unknown-key-strictness-ledger.counts/ai.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ hand-patch a number here** — fix the code or the verdict and regenerate.
1919

2020
| Dir | Sites |
2121
|---|---|
22-
| `ai/` | 121 |
22+
| `ai/` | 122 |

‎docs/audits/2026-07-unknown-key-strictness-ledger.counts/api.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ hand-patch a number here** — fix the code or the verdict and regenerate.
1919

2020
| Dir | Sites |
2121
|---|---|
22-
| `api/` | 543 |
22+
| `api/` | 544 |

‎packages/spec/api-surface/ai.json‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,7 @@
290290
"StructuredOutputConfigSchema (const)",
291291
"StructuredOutputFormat (type)",
292292
"StructuredOutputFormatSchema (const)",
293+
"TURN_END_PART_TYPE (const)",
293294
"TextContent (type)",
294295
"TextContentSchema (const)",
295296
"TokenBudgetConfig (type)",
@@ -309,6 +310,9 @@
309310
"ToolSchema (const)",
310311
"TransformPipelineStep (type)",
311312
"TransformPipelineStepSchema (const)",
313+
"TurnEnd (type)",
314+
"TurnEndParsed (type)",
315+
"TurnEndSchema (const)",
312316
"agentForm (const)",
313317
"aiContextForm (const)",
314318
"aiContextWhereFields (function)",

‎packages/spec/authorable-surface/ai.json‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -575,6 +575,11 @@
575575
"ai/Tool:protection",
576576
"ai/ToolCall:function",
577577
"ai/ToolCall:id",
578-
"ai/ToolCall:type"
578+
"ai/ToolCall:type",
579+
"ai/TurnEnd:reason",
580+
"ai/TurnEnd:resumable",
581+
"ai/TurnEnd:resumesLeft",
582+
"ai/TurnEnd:turnId",
583+
"ai/TurnEnd:wrapUp"
579584
]
580585
}

0 commit comments

Comments
 (0)