@object-ui/plugin-chatbot 17.6.0 → 18.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/CHANGELOG.md +2814 -0
  2. package/README.md +84 -28
  3. package/dist/AiPendingActionsInbox.d.ts +8 -2
  4. package/dist/AiPendingActionsInbox.d.ts.map +1 -1
  5. package/dist/ChatbotEnhanced.d.ts +235 -101
  6. package/dist/ChatbotEnhanced.d.ts.map +1 -1
  7. package/dist/FloatingChatbot.d.ts +1 -1
  8. package/dist/FloatingChatbot.d.ts.map +1 -1
  9. package/dist/chatMessageAdapter.d.ts +18 -6
  10. package/dist/chatMessageAdapter.d.ts.map +1 -1
  11. package/dist/elements/conversation.d.ts +1 -1
  12. package/dist/elements/conversation.d.ts.map +1 -1
  13. package/dist/elements/index.d.ts +10 -10
  14. package/dist/elements/message.d.ts +1 -1
  15. package/dist/elements/message.d.ts.map +1 -1
  16. package/dist/elements/prompt-input.d.ts +10 -2
  17. package/dist/elements/prompt-input.d.ts.map +1 -1
  18. package/dist/elements/tool.d.ts +13 -1
  19. package/dist/elements/tool.d.ts.map +1 -1
  20. package/dist/index.d.ts +48 -59
  21. package/dist/index.d.ts.map +1 -1
  22. package/dist/index.js +3217 -1945
  23. package/dist/index.umd.cjs +3 -3
  24. package/dist/mapMessages.d.ts +309 -6
  25. package/dist/mapMessages.d.ts.map +1 -1
  26. package/dist/recordLink.d.ts +34 -0
  27. package/dist/recordLink.d.ts.map +1 -0
  28. package/dist/tool-display.d.ts +97 -26
  29. package/dist/tool-display.d.ts.map +1 -1
  30. package/dist/useAgents.d.ts +5 -0
  31. package/dist/useAgents.d.ts.map +1 -1
  32. package/dist/useAiApprovalsTranslation.d.ts +76 -0
  33. package/dist/useAiApprovalsTranslation.d.ts.map +1 -0
  34. package/dist/useAiModels.d.ts +3 -1
  35. package/dist/useAiModels.d.ts.map +1 -1
  36. package/dist/useHitlInChat.d.ts +2 -2
  37. package/dist/useHitlInChat.d.ts.map +1 -1
  38. package/dist/useObjectChat.d.ts +94 -27
  39. package/dist/useObjectChat.d.ts.map +1 -1
  40. package/dist/usePendingActions.d.ts +5 -0
  41. package/dist/usePendingActions.d.ts.map +1 -1
  42. package/package.json +11 -15
@@ -1,4 +1,4 @@
1
- import { ChatMessage, ChatToolInvocation, ChatBuildProgress } from './ChatbotEnhanced';
1
+ import { ChatbotEnhancedMessage as ChatMessage, ChatbotEnhancedToolInvocation as ChatToolInvocation, ChatBuildProgress } from './ChatbotEnhanced.js';
2
2
  interface AnyPart {
3
3
  type?: string;
4
4
  text?: string;
@@ -10,7 +10,29 @@ interface AnyPart {
10
10
  args?: unknown;
11
11
  result?: unknown;
12
12
  errorText?: string;
13
- state?: ChatToolInvocation['state'];
13
+ /**
14
+ * Free-form on purpose. `AnyPart` absorbs whatever a producer hands the
15
+ * mapper, and `state` is NOT one namespace: a tool part carries the
16
+ * tool-invocation lifecycle, while `@ai-sdk/react`'s text and reasoning
17
+ * parts carry `'streaming' | 'done'`. Typing this member against the
18
+ * OUTPUT contract made the deliberately-permissive input interface
19
+ * stricter than the union it exists to absorb, so the SDK's own
20
+ * `UIMessage[]` — the documented input of the exported mappers — was
21
+ * refused outright (objectui#8214). `isToolState` below is what keeps the
22
+ * output checked; this stays open.
23
+ */
24
+ state?: string;
25
+ /**
26
+ * The chat runtime's approval envelope, as it arrives on a tool part.
27
+ *
28
+ * `unknown`, like every other absorbing member here, and deliberately NOT
29
+ * the envelope's declared shape: this interface exists to take whatever a
30
+ * producer hands the mapper, and the one time a member was typed against the
31
+ * OUTPUT contract it made the permissive input interface stricter than the
32
+ * union it absorbs (objectui#8214, the `state` member). {@link liftApproval}
33
+ * is what keeps the OUTPUT checked; this stays open.
34
+ */
35
+ approval?: unknown;
14
36
  url?: string;
15
37
  href?: string;
16
38
  title?: string;
@@ -45,13 +67,29 @@ interface AnyUIMessage {
45
67
  * still-pending proposal as "Completed" (#787 finding B / #2362).
46
68
  */
47
69
  export declare function parseResultEnvelope(result: unknown): Record<string, unknown> | undefined;
70
+ /**
71
+ * The ObjectStack HITL envelope a tool result carries when the framework's
72
+ * `action-tools.ts` proposes a destructive action:
73
+ * `{ status: 'pending_approval', pendingActionId: 'pa_…', … }`.
74
+ *
75
+ * Exported (objectui#8442) so the app-shell's HYDRATION mapper derives the id
76
+ * from the same parse the live mapper uses. The id is never persisted as a part
77
+ * key — it exists in rehydrated history only inside this envelope — so a second
78
+ * hand-rolled reader there would be a second dialect of one contract, which is
79
+ * exactly what AGENTS.md Commandment #0.1 refuses.
80
+ */
81
+ export declare function detectPendingApproval(result: unknown): {
82
+ pendingActionId: string;
83
+ raw: Record<string, unknown>;
84
+ } | undefined;
48
85
  /**
49
86
  * Best-effort detector for the framework's ADR-0033 draft envelopes. Metadata
50
87
  * authoring tools stage changes as DRAFTS and return one of:
51
88
  * • single — `{ status:'drafted', type, name, summary, changedKeys }`
52
89
  * (create_object / add_field / create_metadata / update_metadata / …)
53
90
  * • batch — `{ status:'drafted', drafted:[{type,name}], failed, summary }`
54
- * (apply_blueprint)
91
+ * (apply_blueprint), or the same batch with `kind:'edit'` (apply_edit,
92
+ * an INCREMENTAL edit — objectui#10109)
55
93
  * We lift the reviewable `{ type, name }` targets so the chat can render a
56
94
  * "Review N change(s)" affordance that opens the designer's review/diff.
57
95
  * `blueprint_proposed` (propose_blueprint) has no draft yet → not surfaced here.
@@ -63,9 +101,25 @@ export interface DraftReview {
63
101
  }>;
64
102
  summary?: string;
65
103
  packageId?: string;
104
+ /**
105
+ * Backend lifecycle intent (from the tool result). `true` for whole-app
106
+ * builds (apply_blueprint) — eligible for the auto-publish "magic moment".
107
+ * Omitted for incremental edits, which stay drafts for explicit review.
108
+ */
66
109
  autoPublishable?: boolean;
110
+ /** Count of artifacts that failed in a partial build, surfaced not hidden. */
67
111
  failedCount?: number;
112
+ /**
113
+ * ADR-0045: the build was MATERIALIZED in-turn — real tables and seed
114
+ * rows exist; the app is live but `hidden` (unlisted). Preview should
115
+ * open the REAL app URL, not the draft overlay.
116
+ */
68
117
  materialized?: boolean;
118
+ /**
119
+ * ADR-0038 L1 graph-lint verdict for the staged build. Rendered as a
120
+ * verified/issues chip so "drafted" and "verified" read as the two
121
+ * separate statements they are. Absent on older tool output.
122
+ */
69
123
  verification?: {
70
124
  errors: number;
71
125
  warnings: number;
@@ -90,6 +144,18 @@ export interface DraftReview {
90
144
  * status panel, never asserted as done).
91
145
  */
92
146
  nextSteps?: string[];
147
+ /**
148
+ * objectui#10109 — the producer's marker for an INCREMENTAL edit, lifted
149
+ * from the envelope's own `kind`: `apply_edit` answers `kind: 'edit'`, and a
150
+ * whole-app `apply_blueprint` build carries no `kind`. An edit's `items` may
151
+ * honestly include the `app` artifact it re-staged (an `add_object` op
152
+ * merges the nav), so the readers that infer a whole-app build from a draft
153
+ * review's staged artifact types check this first: `buildProgressFromDraftReview`
154
+ * here, and app-shell's built-moment transition (`detectBuiltAppPackage` reads
155
+ * the envelope's own `kind` instead). Only the value those readers act on is
156
+ * declared: an envelope that does not say `'edit'` lifts nothing here.
157
+ */
158
+ kind?: 'edit';
93
159
  }
94
160
  /**
95
161
  * The lifecycle stage BEFORE a draft. `propose_blueprint` returns
@@ -102,11 +168,37 @@ export interface DraftReview {
102
168
  */
103
169
  export interface ProposedPlan {
104
170
  summary?: string;
105
- /** Objects (tables) the build will create — machine name, label, field count. */
171
+ /**
172
+ * objectui#12724 — the app's display label (`blueprint.app.label`, the
173
+ * spec's `BlueprintAppSchema`), for the card's 「方案 · APP」 header. Absent
174
+ * when the blueprint names no app label.
175
+ */
176
+ appLabel?: string;
177
+ /**
178
+ * Objects (tables) the build will create — machine name, label, field count.
179
+ * objectui#12724 — `fields` lifts the name and label of each declared field
180
+ * (`blueprint.objects[].fields`, the spec's `BlueprintFieldSchema`) so the
181
+ * card can draw one chip per field. Absent when no entry carries a name (a
182
+ * cache-fallback reload keeps only the count), and the card then draws the
183
+ * object chip with its count, as before.
184
+ */
106
185
  objects: Array<{
107
186
  name: string;
108
187
  label?: string;
109
188
  fieldCount: number;
189
+ fields?: Array<{
190
+ name: string;
191
+ label?: string;
192
+ }>;
193
+ }>;
194
+ /**
195
+ * objectui#12724 — the views the build will create (`blueprint.views`, the
196
+ * spec's `BlueprintViewSchema`), by name and label. Absent when the
197
+ * blueprint declares none.
198
+ */
199
+ views?: Array<{
200
+ name: string;
201
+ label?: string;
110
202
  }>;
111
203
  /** Totals for a compact "N objects · N views · …" line. */
112
204
  counts: {
@@ -127,17 +219,142 @@ export interface ProposedPlan {
127
219
  text: string;
128
220
  options: string[];
129
221
  }>;
130
- /** Assumptions the agent made from an underspecified goal (may be empty). */
222
+ /**
223
+ * Assumptions the agent made from an underspecified goal (may be empty).
224
+ * objectui#12724 — read from `planCard.assumptions` when the envelope
225
+ * carries a plan card, else from `blueprint.assumptions` as before.
226
+ */
131
227
  assumptions: string[];
132
228
  /** Extend mode: the existing app the new objects would be added into. */
133
229
  targetApp?: string;
230
+ /**
231
+ * objectui#12724 — the plan card's v2 rows, from the envelope's `planCard`.
232
+ * Absent on a producer that predates it, and the card then draws the rows
233
+ * above as before.
234
+ */
235
+ planCard?: ProposedPlanCard;
236
+ /**
237
+ * objectui#12724 — one line per view (the envelope's `viewIntents`). The card
238
+ * reads it only when there is no `planCard`, whose views carry the same line.
239
+ */
240
+ viewIntents?: ProposedPlanViewLine[];
241
+ }
242
+ /** One view's intent line: `viewIntents[]` and `planCard.views[]` both carry it. */
243
+ export interface ProposedPlanViewLine {
244
+ view: string;
245
+ object: string;
246
+ label?: string;
247
+ line: string;
248
+ }
249
+ /**
250
+ * objectui#12724 — the keys of `propose_blueprint`'s `planCard` that the plan
251
+ * card draws. The producer's contract is objectstack-ai/cloud's
252
+ * `ProposeBlueprintCardPayload` (`packages/service-ai-studio/schema/build-cards.schema.json`,
253
+ * vendored beside this package's tests); keys this card does not draw are not
254
+ * lifted.
255
+ */
256
+ export interface ProposedPlanCard {
257
+ objects: Array<{
258
+ name: string;
259
+ label: string;
260
+ fields: Array<{
261
+ name: string;
262
+ label: string;
263
+ /** The format the sample data is held to, as the chip's words (`format.label`). */
264
+ format?: {
265
+ label: string;
266
+ };
267
+ /**
268
+ * objectui#12994 — the stage field's lifecycle, as the chip's words
269
+ * (`lifecycle.label`, e.g. 「借出 · 已还 ✓完成 · 逾期 ⚠」). The producer's
270
+ * `options` are not drawn, so they are not lifted.
271
+ */
272
+ lifecycle?: {
273
+ label: string;
274
+ };
275
+ /** The model added this field; the user's words did not name it. */
276
+ suggested?: true;
277
+ }>;
278
+ /**
279
+ * The record's name field, when the plan declares one. `generated`
280
+ * (objectui#13004) is present when the title is composed for the user, not
281
+ * typed: the card draws its `line` (e.g. 「名称:自动生成「{图书} · {读者} ·
282
+ * {借出日期}」,表单里不出现」) in place of 「名称:LABEL」. The producer's
283
+ * `template` is not drawn, so it is not lifted.
284
+ */
285
+ nameField?: {
286
+ name: string;
287
+ label: string;
288
+ generated?: {
289
+ line: string;
290
+ };
291
+ };
292
+ }>;
293
+ views: ProposedPlanViewLine[];
294
+ assumptions: string[];
295
+ /** The sample data the build stages, as one line. Absent when it stages none. */
296
+ sampleData?: {
297
+ line: string;
298
+ };
299
+ }
300
+ /**
301
+ * objectui#12724 — the keys of the result card's `checklist` that the card
302
+ * draws, from `apply_blueprint`'s and `verify_build`'s envelopes
303
+ * (objectstack-ai/cloud's `BuildResultCardPayload`).
304
+ */
305
+ export interface BuildResultChecklist {
306
+ status: 'passed' | 'failed';
307
+ passed: number;
308
+ total: number;
309
+ /** Objects, then views, then the sample data, each measured on the build. */
310
+ lines: Array<{
311
+ kind: 'object' | 'view' | 'sampleData';
312
+ status: 'passed' | 'failed';
313
+ line: string;
314
+ }>;
315
+ /** The app 打开应用 opens. */
316
+ app?: {
317
+ name: string;
318
+ label?: string;
319
+ };
320
+ /** The package 在 Studio 中查看 opens. */
321
+ packageId?: string;
134
322
  }
135
323
  export declare function detectProposedPlan(result: unknown): ProposedPlan | undefined;
324
+ /**
325
+ * objectui#12724 — the result card's `checklist`, on `apply_blueprint`'s
326
+ * envelope (drafted, or published in-turn) and on `verify_build`'s, which
327
+ * re-measures it after a repair. The schema requires `status`, `passed`,
328
+ * `total` and `lines`; without all four there is no checklist, and the card
329
+ * keeps its earlier rows.
330
+ */
331
+ export declare function detectBuildChecklist(result: unknown): BuildResultChecklist | undefined;
332
+ /**
333
+ * cloud#2924 — how a copilot change to a package lands, as the change envelopes
334
+ * carry it (cloud `postureEnvelope`): `draft` when the app is live and its
335
+ * tables hold `liveRecords` records, so the change is saved as a Studio draft;
336
+ * `publish` when it goes live in the turn (a first build, an app holding no
337
+ * records, a platform package).
338
+ */
339
+ export interface ChangePosture {
340
+ mode: 'draft' | 'publish';
341
+ /** Records the package's live tables hold. */
342
+ liveRecords: number;
343
+ /** The package is a platform package; the posture by state is not read there. */
344
+ platformPackage?: true;
345
+ /** In the turn that applied a blueprint: the rows that build seeded, left out of `liveRecords`. */
346
+ buildTurnRows?: number;
347
+ }
136
348
  /**
137
349
  * A granular metadata-change preview (confirm-before-change). A mutating tool
138
350
  * that has NOT been approved this turn returns
139
351
  * { status: 'changes_proposed', changes: [...], summary? } instead of
140
352
  * committing, so the chat renders a "确认修改" card. Mirrors detectProposedPlan.
353
+ *
354
+ * objectui#12894 — cloud#2924 adds `posture` and `primaryAction`, read before
355
+ * the card is shown. Both are absent from an older cloud, and from an
356
+ * environment that does not publish AI changes in the turn; the card then
357
+ * draws as it did before.
141
358
  */
142
359
  export interface ProposedChanges {
143
360
  summary?: string;
@@ -147,8 +364,48 @@ export interface ProposedChanges {
147
364
  field?: string;
148
365
  type?: string;
149
366
  name?: string;
367
+ /** cloud#2924 — the row's parameters in small type (label · default · required), in the user's language. */
150
368
  details?: string;
151
369
  }>;
370
+ /** cloud#2924 — how the change will land once confirmed. */
371
+ posture?: ChangePosture;
372
+ /** cloud#2924 — the card's primary action: `save_draft` reads 存为草稿, `confirm` keeps the host's label. */
373
+ primaryAction?: 'save_draft' | 'confirm';
374
+ }
375
+ /** One pending draft, as Studio's 变更 list names it (cloud `PendingDraft`). */
376
+ export interface PendingDraftItem {
377
+ type: string;
378
+ name: string;
379
+ }
380
+ /**
381
+ * cloud#2924 — the package's pending drafts, read after the change landed
382
+ * through `listDrafts`, the read Studio's 变更 badge makes (cloud `DraftState`).
383
+ */
384
+ export interface ChangeDraftState {
385
+ /** Pending drafts in the package — the number Studio's 变更 badge shows. */
386
+ pending: number;
387
+ items: PendingDraftItem[];
388
+ /** Pending drafts this change did not stage (an earlier edit, the user's own). */
389
+ others: number;
390
+ }
391
+ /**
392
+ * cloud#2924 — a field the change added to a table that already holds records:
393
+ * every one of those `rows` has no value for it (cloud `ExistingRowsLine`).
394
+ */
395
+ export interface ExistingRowsLine {
396
+ object: string;
397
+ field: string;
398
+ label: string;
399
+ rows: number;
400
+ }
401
+ /**
402
+ * cloud#2924 — the applied card of a change saved as a draft, in the user's
403
+ * language: its title (「已存为草稿 · 2 项未发布」) and its lines
404
+ * (「已有 12 条记录的续借次数为空」, 「核对:结构 ✓」).
405
+ */
406
+ export interface AppliedCard {
407
+ title: string;
408
+ lines: string[];
152
409
  }
153
410
  /**
154
411
  * ADR-0057 P4 — the `ask` agent's `suggest_builder` structured decline. Result
@@ -161,6 +418,23 @@ export interface BuilderHandoff {
161
418
  packageId?: string;
162
419
  }
163
420
  export declare function detectBuilderHandoff(result: unknown): BuilderHandoff | undefined;
421
+ /**
422
+ * cloud#1658 — the ask agent's `open_record` structured hand-off: the OTHER
423
+ * ending of a write request. Envelope
424
+ * `{ status:'record_handoff', handoff:'record', objectName, recordId, label?, reason? }`.
425
+ * Lifted so the chat renders an explicit "打开这条记录 →" action landing on the
426
+ * record the agent already resolved — the whole point is that the user never
427
+ * re-finds a record the agent has in hand. Both ids are REQUIRED: a hand-off
428
+ * with either missing is dropped here exactly as the server refuses to emit
429
+ * one, because a card pointing nowhere is worse than the prose it replaces.
430
+ */
431
+ export interface RecordHandoff {
432
+ objectName: string;
433
+ recordId: string;
434
+ label?: string;
435
+ reason?: string;
436
+ }
437
+ export declare function detectRecordHandoff(result: unknown): RecordHandoff | undefined;
164
438
  export declare function detectProposedChanges(result: unknown): ProposedChanges | undefined;
165
439
  /**
166
440
  * objectui#5695 — the terminal verdict of a confirm-replay.
@@ -193,6 +467,27 @@ export interface ReplayOutcome {
193
467
  * so the card never says 未生效 over a change that actually landed.
194
468
  */
195
469
  dispatchError?: boolean;
470
+ /**
471
+ * objectui#12894 — on a `drafted` outcome only, what cloud#2924's
472
+ * `describeLandedChange` stamps after the change landed: the package's
473
+ * pending drafts, the existing rows a new field leaves empty, and the
474
+ * applied card's title and lines. Each is absent from an older cloud, and
475
+ * the card then draws the drafted badge as before.
476
+ */
477
+ draftState?: ChangeDraftState;
478
+ existingRows?: ExistingRowsLine[];
479
+ appliedCard?: AppliedCard;
480
+ /**
481
+ * objectui#12968 — on a `drafted` outcome only, the items THIS replay
482
+ * drafted (the envelope's `drafted[]`, lifted as {@link detectDraftResult}
483
+ * lifts it), so the applied card can preview them. Not `draftState.items`,
484
+ * which lists every pending draft of the package. Absent when the envelope
485
+ * names none.
486
+ */
487
+ items?: Array<{
488
+ type: string;
489
+ name: string;
490
+ }>;
196
491
  }
197
492
  export declare function detectReplayOutcome(toolCallId: string | undefined, result: unknown): ReplayOutcome | undefined;
198
493
  /**
@@ -213,6 +508,12 @@ export declare function detectAuthoringVerdict(result: unknown): {
213
508
  * `drafted[]` + `packageId`), so keying the built-moment transition on
214
509
  * `draftReview` (drafted-only) missed every staging/cloud build — measured
215
510
  * live: reopening a built conversation stayed on the full page.
511
+ *
512
+ * objectui#10109 — an envelope that says `kind: 'edit'` is an INCREMENTAL
513
+ * edit (`apply_edit`), never a whole-app build, even when its `drafted[]`
514
+ * honestly lists the `app` artifact it re-staged (an `add_object` op merges
515
+ * the nav). The producer declares the difference on the envelope, so it is
516
+ * read here rather than inferred from which artifact types were staged.
216
517
  */
217
518
  export declare function detectBuiltAppPackage(result: unknown): string | undefined;
218
519
  export declare function detectDraftResult(result: unknown): DraftReview | undefined;
@@ -224,7 +525,9 @@ export declare function detectDraftResult(result: unknown): DraftReview | undefi
224
525
  * reconstruct the done-state from the draft result, which IS persisted, so the
225
526
  * summary + its preview/open affordances survive a refresh. Only whole-app
226
527
  * builds (a draft set that includes an `app`) get a panel — incremental edits
227
- * keep their draft card but no build tree, matching the live behaviour.
528
+ * keep their draft card but no build tree, matching the live behaviour. An
529
+ * edit is known by the producer's `kind: 'edit'`, not by its staged types: it
530
+ * can re-stage the `app` artifact too (objectui#10109).
228
531
  */
229
532
  export declare function buildProgressFromDraftReview(draft: DraftReview | undefined): ChatBuildProgress | undefined;
230
533
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"mapMessages.d.ts","sourceRoot":"","sources":["../src/mapMessages.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,KAAK,EAAE,WAAW,EAAE,kBAAkB,EAAc,iBAAiB,EAAoC,MAAM,mBAAmB,CAAC;AAE1I,UAAU,OAAO;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,kBAAkB,CAAC,OAAO,CAAC,CAAC;IACpC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,4EAA4E;IAC5E,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,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AE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC/C;AAqBD,wBAAgB,mBAAmB,CACjC,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,MAAM,EAAE,OAAO,GACd,aAAa,GAAG,SAAS,CAyC3B;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,OAAO,GACd;IAAE,IAAI,EAAE,WAAW,GAAG,SAAS,GAAG,QAAQ,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAS9E;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAczE;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,OAAO,GAAG,WAAW,GAAG,SAAS,CAsE1E;AAWD;;;;;;;;;;;GAWG;AACH,wBAAgB,4BAA4B,CAC1C,KAAK,EAAE,WAAW,GAAG,SAAS,GAC7B,iBAAiB,GAAG,SAAS,CAY/B;AA0SD;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CACpC,GAAG,EAAE,YAAY,EACjB,IAAI,GAAE;IAAE,SAAS,CAAC,EAAE,OAAO,CAAA;CAAO,GACjC,WAAW,CAoCb;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,YAAY,EAAE,EACxB,IAAI,GAAE;IAAE,WAAW,CAAC,EAAE,OAAO,CAAA;CAAO,GACnC,WAAW,EAAE,CASf"}
@@ -0,0 +1,34 @@
1
+ import { LinkSafetyConfig } from 'streamdown';
2
+ /** The record a record link names. */
3
+ export type RecordLinkTarget = {
4
+ objectName: string;
5
+ recordId: string;
6
+ };
7
+ /** The host's way to open a record (the chat's `onOpenRecord`). */
8
+ export type OpenRecordLink = (target: RecordLinkTarget) => void;
9
+ /**
10
+ * The one record-link form, as streamdown hands the href to `onLinkCheck`.
11
+ * (rehype-harden normalises `./record/...` to `/record/...` before that, and
12
+ * drops a bare `record/...`.)
13
+ */
14
+ export declare const RECORD_LINK_PATTERN: RegExp;
15
+ /** The record a link names, or `null` when the href is not the record form. */
16
+ export declare function parseRecordLink(href: string | null | undefined): RecordLinkTarget | null;
17
+ /**
18
+ * The host's record opener for the answers rendered below it. `null` (no
19
+ * host handler) leaves every link, the record form included, on streamdown's
20
+ * default link safety.
21
+ */
22
+ export declare const RecordLinkContext: import('react').Context<OpenRecordLink | null>;
23
+ /**
24
+ * `linkSafety` for an answer: the caller's config, with the record form routed
25
+ * to `open`.
26
+ *
27
+ * streamdown's link click awaits `onLinkCheck(url)`: `true` opens the url in a
28
+ * new tab, anything else opens the confirmation dialog. A record link wants
29
+ * neither, so after handing the record to `open` the check returns a promise
30
+ * that never settles, and the click ends there (a fresh promise per click, so
31
+ * nothing accumulates once the click's continuation is dropped).
32
+ */
33
+ export declare function withRecordLinks(base: LinkSafetyConfig | undefined, open: OpenRecordLink | null): LinkSafetyConfig | undefined;
34
+ //# sourceMappingURL=recordLink.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recordLink.d.ts","sourceRoot":"","sources":["../src/recordLink.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAiCH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEnD,sCAAsC;AACtC,MAAM,MAAM,gBAAgB,GAAG;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC;AAExE,mEAAmE;AACnE,MAAM,MAAM,cAAc,GAAG,CAAC,MAAM,EAAE,gBAAgB,KAAK,IAAI,CAAC;AAEhE;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,QAC0B,CAAC;AAE3D,+EAA+E;AAC/E,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,gBAAgB,GAAG,IAAI,CAMxF;AAED;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,gDAA6C,CAAC;AAE5E;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,gBAAgB,GAAG,SAAS,EAClC,IAAI,EAAE,cAAc,GAAG,IAAI,GAC1B,gBAAgB,GAAG,SAAS,CAiB9B"}
@@ -9,15 +9,39 @@
9
9
  * peel the envelope, parse the inner JSON when possible, and produce a
10
10
  * human-friendly title for snake_case tool names.
11
11
  */
12
+ /**
13
+ * A translator for tool titles. Takes the i18n key and the English fallback
14
+ * this module would otherwise have produced, and returns whatever the active
15
+ * locale has — or the fallback when that locale carries no entry.
16
+ *
17
+ * Shaped to accept `useSafeTranslate()` directly, so a caller passes the hook's
18
+ * result and nothing else changes.
19
+ */
20
+ export type ToolTitleTranslator = (key: string, fallback: string) => string;
21
+ /** The i18n key a tool title is looked up under. */
22
+ export declare function toolTitleKey(name: string): string;
12
23
  /**
13
24
  * Convert a snake_case / kebab-case tool name into a human-readable title.
14
25
  *
26
+ * With no translator this is what it always was: an ENGLISH title-caser. That
27
+ * is why a fully Chinese conversation still read
28
+ * `Describe object 已完成 / Visualize data 已完成` (cloud#1658) — every other
29
+ * string on the card was localized and the tool name could not be, because the
30
+ * name never passed through i18n at all. The step the user most needs to read
31
+ * ("what is it doing right now?") was the one left in a foreign language.
32
+ *
33
+ * Pass `translate` (e.g. `useSafeTranslate()`) to look the title up as
34
+ * `chatbot.tool.<tool_name>`; a locale with no entry for that tool falls back
35
+ * to the same English title as before, so packs can be filled in gradually and
36
+ * an unknown//custom tool is never worse off than today.
37
+ *
15
38
  * @example
16
- * humanizeToolName('list_objects') // → 'List objects'
17
- * humanizeToolName('query_records') // → 'Query records'
18
- * humanizeToolName('describe-api-tool') // → 'Describe API tool'
39
+ * humanizeToolName('list_objects') // → 'List objects'
40
+ * humanizeToolName('query_records') // → 'Query records'
41
+ * humanizeToolName('describe-api-tool') // → 'Describe API tool'
42
+ * humanizeToolName('describe_object', tt) // → '查看对象结构' (zh)
19
43
  */
20
- export declare function humanizeToolName(name: string | undefined | null): string;
44
+ export declare function humanizeToolName(name: string | undefined | null, translate?: ToolTitleTranslator): string;
21
45
  /**
22
46
  * Detect the MCP-style `{ type: 'text', value: '<json|text>' }` envelope used
23
47
  * by `@objectstack/service-ai` tool outputs and peel it. When the inner value
@@ -38,8 +62,17 @@ export declare function summarizeChatError(err: unknown): {
38
62
  summary: string;
39
63
  details?: string;
40
64
  };
41
- /** AI quota refusal codes emitted by the cloud token guardrail (HTTP 429). */
42
- export type AiQuotaCode = 'ai_design_quota_exhausted' | 'ai_data_chat_trial_exhausted' | 'ai_allowance_exhausted';
65
+ /**
66
+ * AI quota refusal codes emitted by the cloud token guardrail (HTTP 429).
67
+ *
68
+ * TWO vocabularies, both live. cloud#1238 (the cloud#1168 convergence) landed
69
+ * the SCREAMING_SNAKE ledger codes — which is what a spec-conformant
70
+ * `error.code` must be, an `ErrorCode` ledger member. The lowercase trio is
71
+ * the legacy vocabulary that transition-period producers still emit, so it is
72
+ * KEPT rather than swapped out: dropping it would silently stop parsing every
73
+ * producer that has not converged yet (objectui#3804).
74
+ */
75
+ export type AiQuotaCode = 'AI_DESIGN_QUOTA_EXHAUSTED' | 'AI_DATA_CHAT_TRIAL_EXHAUSTED' | 'AI_ALLOWANCE_EXHAUSTED' | 'ai_design_quota_exhausted' | 'ai_data_chat_trial_exhausted' | 'ai_allowance_exhausted';
43
76
  export interface AiQuotaError {
44
77
  code: AiQuotaCode;
45
78
  /** Localized (zh) message from the backend. */
@@ -50,6 +83,31 @@ export interface AiQuotaError {
50
83
  upgrade: boolean;
51
84
  /** Paid tier -> buy a credit top-up pack. */
52
85
  topUp: boolean;
86
+ /**
87
+ * The allowance replenishes at the next daily reset, so "wait" is a real
88
+ * option alongside the CTA. Only set when the producer sends an actual
89
+ * boolean: the landed envelope carries this inside `error.details`
90
+ * (cloud#1238) and that POSITION is measured, but an absent or
91
+ * otherwise-typed value stays `undefined` rather than being coerced to a
92
+ * `false` no producer declared.
93
+ *
94
+ * ⚠️ objectui#7587 — measured on this tree: NOTHING reads this field once the
95
+ * parse fills it in. `useAiQuotaCopy` (ChatbotEnhanced), the only consumer of
96
+ * the parsed shape's fields, builds the banner from `message` / `messageEn` /
97
+ * `topUp`; the other two `parseAiQuotaError` call sites use the parse as a
98
+ * yes/no predicate. So cloud PR #1852's free-plan inversion (`true` ->
99
+ * `false`, the rolling 7-day window) changes nothing on screen, and the ISO
100
+ * `resetsAt` that producer now sends beside this flag is deliberately NOT
101
+ * read here: with no renderer for it, a read would pin a wire position this
102
+ * repo cannot measure (`objectstack-ai/cloud` is out of scope) and would add
103
+ * a second unread field rather than answer anyone's question. Both halves are
104
+ * pinned — the flag's inertness by
105
+ * `__tests__/ChatbotEnhanced.quotaResetPromise-7587.test.tsx`, the parse's
106
+ * silence about the instant by `tool-display.test.ts`. Wiring reset copy to
107
+ * this BOOLEAN is the one move to avoid: it is `false` for exactly the plan
108
+ * that needs the answer.
109
+ */
110
+ resetsTonight?: boolean;
53
111
  }
54
112
  /**
55
113
  * Recognize the cloud AI token guardrail's 429 quota refusals so the chat UI can
@@ -60,26 +118,39 @@ export interface AiQuotaError {
60
118
  * strip the same retry/format prefixes summarizeChatError handles, locate the
61
119
  * JSON object, and find the code in it. Returns null for anything else.
62
120
  *
63
- * ## Three dialects, one code set
64
- *
65
- * The two cloud 429 producers fill the same `error` key in OPPOSITE ways, and
66
- * ADR-0112 declares a third shape they are converging on (objectui#3491,
67
- * cloud#944). All three are read here so the consumer is ready BEFORE the
68
- * producers move (cloud#1168) — the alternative is a silent misfit at the
69
- * moment they converge:
70
- *
71
- * | dialect | shape |
72
- * |------------------------------|------------------------------------------------|
73
- * | declared envelope (ADR-0112) | `{ success: false, error: { code, message } }` |
74
- * | flat guardrail | `{ error: CODE, message, upgrade, topUp }` |
75
- * | service-ai sibling key | `{ error: PROSE, code: CODE }` |
76
- *
77
- * Only the code's LOCATION widens; the recognized code set is unchanged, so an
78
- * unknown shape still degrades to today's behavior (null). Note that a
79
- * spec-conformant `error.code` must be an `ErrorCode` ledger member
80
- * (SCREAMING_SNAKE) and none of these three codes is registered today, so the
81
- * nested branch matches the legacy vocabulary only — aligning the vocabulary is
82
- * cloud#1168's call and needs a follow-up here, not a guess now.
121
+ * ## Four dialects, two vocabularies
122
+ *
123
+ * The two cloud 429 producers fill the same `error` key in OPPOSITE ways
124
+ * (objectui#3491, cloud#944), and ADR-0112's declared envelope has now LANDED
125
+ * on the producer side (cloud#1168 -> cloud PR #1238), adding a fourth
126
+ * dialect: the declared envelope carrying the SCREAMING_SNAKE ledger
127
+ * vocabulary with its companion fields inside `error.details`. All four are
128
+ * read here, because the producers converge asymmetrically and the legacy
129
+ * dialects are still live (objectui#3804):
130
+ *
131
+ * | dialect | shape |
132
+ * |-------------------------------|-------------------------------------------------|
133
+ * | declared envelope + ledger | `{ error: { code: AI_*, message, details } }` |
134
+ * | declared envelope + legacy | `{ success: false, error: { code, message } }` |
135
+ * | flat guardrail | `{ error: CODE, message, upgrade, topUp }` |
136
+ * | service-ai sibling key | `{ error: PROSE, code: CODE }` |
137
+ *
138
+ * Both the code's LOCATION and the recognized code SET widen; an unknown shape
139
+ * still degrades to today's behavior (null).
140
+ *
141
+ * ## What this deliberately does NOT recognize: generic `QUOTA_EXCEEDED`
142
+ *
143
+ * `POST /api/v1/ai/agents/:name/chat`'s per-turn message cap keeps emitting the
144
+ * standard `QUOTA_EXCEEDED` (`error.details.resetAt`, `category: 'rate_limit'`)
145
+ * and did NOT move to the three `AI_*` codes — it has no upgrade / top-up /
146
+ * trial next step, which is exactly the distinction the 2026-08-11 Option A
147
+ * ruling drew when it admitted the three codes to the closed ledger.
148
+ *
149
+ * It is NOT dropped, it is handled one branch along: `isUnsentSendError` +
150
+ * `isRateLimitError` route it to the "you're sending too quickly" notice, with
151
+ * the user's text restored. Returning an `AiQuotaError` for it here would put
152
+ * an "Upgrade plan" CTA in front of a user whose cap resets in a minute.
153
+ * `tool-display.test.ts` pins that routing so the split cannot close silently.
83
154
  *
84
155
  * ## Parse priority (a total order, deliberately)
85
156
  *
@@ -1 +1 @@
1
- {"version":3,"file":"tool-display.d.ts","sourceRoot":"","sources":["../src/tool-display.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAeH;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,MAAM,CAoBxE;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAqCxD;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,OAAO,GAAG;IAChD,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAiCA;AAED,8EAA8E;AAC9E,MAAM,MAAM,WAAW,GACnB,2BAA2B,GAC3B,8BAA8B,GAC9B,wBAAwB,CAAC;AAE7B,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,WAAW,CAAC;IAClB,+CAA+C;IAC/C,OAAO,EAAE,MAAM,CAAC;IAChB,wCAAwC;IACxC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2CAA2C;IAC3C,OAAO,EAAE,OAAO,CAAC;IACjB,6CAA6C;IAC7C,KAAK,EAAE,OAAO,CAAC;CAChB;AAwBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,OAAO,GAAG,YAAY,GAAG,IAAI,CA8CnE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAIvD;AAED,wFAAwF;AACxF,wBAAgB,eAAe,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAIhE;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,OAAO,GAAG,OA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