@jini-ai/chat 0.7.2 → 0.7.3-next.1

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 (205) hide show
  1. package/CHANGELOG.md +2 -12
  2. package/README.md +3 -3
  3. package/dist/contracts/chat-bubble-style.d.ts +1 -1
  4. package/dist/contracts/chat-bubble-style.js +1 -1
  5. package/dist/core/ag-ui/event-projection.d.ts +125 -0
  6. package/dist/core/ag-ui/event-projection.js +275 -0
  7. package/dist/core/ag-ui/event-reduction.d.ts +39 -0
  8. package/dist/core/ag-ui/event-reduction.js +99 -0
  9. package/dist/core/ag-ui/run-input.d.ts +53 -0
  10. package/dist/core/ag-ui/run-input.js +87 -0
  11. package/dist/core/agentic/chat-capabilities.d.ts +1 -1
  12. package/dist/core/agentic/index.d.ts +2 -4
  13. package/dist/core/agentic/index.js +2 -3
  14. package/dist/core/agents-port.d.ts +50 -0
  15. package/dist/core/agents-port.js +2 -0
  16. package/dist/core/assistant-client/ag-ui-fetch-agent.d.ts +16 -0
  17. package/dist/core/assistant-client/ag-ui-fetch-agent.js +24 -0
  18. package/dist/core/assistant-client/ag-ui-transport.d.ts +15 -1
  19. package/dist/core/assistant-client/ag-ui-transport.js +167 -145
  20. package/dist/core/assistant-client/attachment-liveness.js +13 -11
  21. package/dist/core/assistant-client/durable-run-subscription.d.ts +3 -2
  22. package/dist/core/assistant-client/durable-run-subscription.js +6 -5
  23. package/dist/core/assistant-client/messages.d.ts +7 -4
  24. package/dist/core/assistant-client/messages.js +5 -4
  25. package/dist/core/assistant-client/transport.d.ts +1 -1
  26. package/dist/core/assistant-client/transport.js +4 -4
  27. package/dist/core/index.d.ts +2 -0
  28. package/dist/core/index.js +1 -0
  29. package/dist/core/page-port.d.ts +15 -0
  30. package/dist/core/page-port.js +2 -0
  31. package/dist/core/run-activity.js +1 -1
  32. package/dist/core/run-events/entry.js +1 -0
  33. package/dist/core/user-text-redaction.d.ts +1 -3
  34. package/dist/core/user-text-redaction.js +3 -61
  35. package/dist/embed-widget/browser/agent-inventory.d.ts +37 -0
  36. package/dist/embed-widget/browser/agent-inventory.js +36 -0
  37. package/dist/embed-widget/browser/frontend-session-bridge.d.ts +2 -2
  38. package/dist/embed-widget/browser/frontend-session-bridge.js +17 -14
  39. package/dist/embed-widget/react/dialog.hooks.d.ts +16 -0
  40. package/dist/embed-widget/react/dialog.hooks.js +15 -0
  41. package/dist/embed-widget/react/embed.d.ts +7 -2
  42. package/dist/embed-widget/react/embed.js +6 -16
  43. package/dist/embed-widget/react/header.d.ts +4 -1
  44. package/dist/embed-widget/react/header.js +2 -2
  45. package/dist/embed-widget/vanilla/state.js +2 -2
  46. package/dist/embed-widget/vanilla/style.css +4 -4
  47. package/dist/react/components/A2uiSurfaceCard.d.ts +18 -4
  48. package/dist/react/components/A2uiSurfaceCard.hooks.d.ts +36 -0
  49. package/dist/react/components/A2uiSurfaceCard.hooks.js +174 -0
  50. package/dist/react/components/A2uiSurfaceCard.js +14 -227
  51. package/dist/react/components/A2uiSurfaceCard.rules.d.ts +14 -0
  52. package/dist/react/components/A2uiSurfaceCard.rules.js +24 -0
  53. package/dist/react/components/AttachmentPreviewModal.d.ts +21 -1
  54. package/dist/react/components/AttachmentPreviewModal.hooks.js +1 -3
  55. package/dist/react/components/AttachmentPreviewModal.js +11 -9
  56. package/dist/react/components/AttachmentTray.d.ts +11 -1
  57. package/dist/react/components/AttachmentTray.js +12 -8
  58. package/dist/react/components/ChatFab.d.ts +10 -1
  59. package/dist/react/components/ChatFab.js +2 -2
  60. package/dist/react/components/ChatSettingsDialog.d.ts +4 -3
  61. package/dist/react/components/ChatSettingsDialog.js +9 -6
  62. package/dist/react/components/ChatSettingsSegmented.d.ts +1 -1
  63. package/dist/react/components/ChatSettingsSegmented.js +1 -1
  64. package/dist/react/components/Composer.d.ts +9 -1
  65. package/dist/react/components/Composer.hooks.d.ts +79 -0
  66. package/dist/react/components/Composer.hooks.js +336 -0
  67. package/dist/react/components/Composer.js +40 -341
  68. package/dist/react/components/ComposerDiscovery.js +1 -1
  69. package/dist/react/components/ConversationList.d.ts +34 -1
  70. package/dist/react/components/ConversationList.hooks.d.ts +37 -0
  71. package/dist/react/components/ConversationList.hooks.js +177 -1
  72. package/dist/react/components/ConversationList.js +7 -174
  73. package/dist/react/components/ConversationTitleEditor.d.ts +17 -2
  74. package/dist/react/components/ConversationTitleEditor.hooks.d.ts +15 -0
  75. package/dist/react/components/ConversationTitleEditor.hooks.js +36 -0
  76. package/dist/react/components/ConversationTitleEditor.js +11 -34
  77. package/dist/react/components/CopyMessageButton.d.ts +6 -1
  78. package/dist/react/components/CopyMessageButton.js +4 -4
  79. package/dist/react/components/ExtEventErrorBoundary.d.ts +2 -0
  80. package/dist/react/components/ExtEventErrorBoundary.js +5 -3
  81. package/dist/react/components/FolderChips.d.ts +11 -1
  82. package/dist/react/components/FolderChips.hooks.d.ts +12 -0
  83. package/dist/react/components/FolderChips.hooks.js +10 -0
  84. package/dist/react/components/FolderChips.js +9 -9
  85. package/dist/react/components/Markdown.js +7 -5
  86. package/dist/react/components/McpUiSurfaceCard.d.ts +29 -5
  87. package/dist/react/components/McpUiSurfaceCard.js +29 -16
  88. package/dist/react/components/MessageList.d.ts +10 -1
  89. package/dist/react/components/MessageList.hooks.d.ts +0 -4
  90. package/dist/react/components/MessageList.hooks.js +6 -18
  91. package/dist/react/components/MessageList.js +17 -20
  92. package/dist/react/components/MessageList.rules.d.ts +0 -5
  93. package/dist/react/components/MessageList.rules.js +0 -4
  94. package/dist/react/components/MessageRow.d.ts +46 -2
  95. package/dist/react/components/MessageRow.hooks.d.ts +60 -0
  96. package/dist/react/components/MessageRow.hooks.js +94 -0
  97. package/dist/react/components/MessageRow.js +53 -113
  98. package/dist/react/components/MidRunUserMessage.d.ts +6 -1
  99. package/dist/react/components/MidRunUserMessage.js +5 -5
  100. package/dist/react/components/NextStepActions.d.ts +3 -1
  101. package/dist/react/components/NextStepActions.js +3 -3
  102. package/dist/react/components/QuestionForm.answers.hooks.d.ts +26 -0
  103. package/dist/react/components/QuestionForm.answers.hooks.js +89 -0
  104. package/dist/react/components/QuestionForm.d.ts +6 -0
  105. package/dist/react/components/QuestionForm.js +23 -261
  106. package/dist/react/components/QuestionForm.values.d.ts +22 -0
  107. package/dist/react/components/QuestionForm.values.js +58 -0
  108. package/dist/react/components/QuestionFormField.d.ts +17 -0
  109. package/dist/react/components/QuestionFormField.js +114 -0
  110. package/dist/react/components/QuestionsPanel.d.ts +3 -1
  111. package/dist/react/components/QuestionsPanel.js +7 -3
  112. package/dist/react/components/SentAttachment.d.ts +11 -2
  113. package/dist/react/components/SentAttachment.hooks.d.ts +1 -1
  114. package/dist/react/components/SentAttachment.hooks.js +6 -5
  115. package/dist/react/components/SentAttachment.js +5 -3
  116. package/dist/react/components/TodoCard.d.ts +3 -1
  117. package/dist/react/components/TodoCard.js +9 -4
  118. package/dist/react/components/ToolCallGroup.d.ts +11 -1
  119. package/dist/react/components/ToolCallGroup.js +10 -4
  120. package/dist/react/components/ToolCard.d.ts +6 -1
  121. package/dist/react/components/ToolCard.js +79 -69
  122. package/dist/react/components/mcp-ui-question-input.d.ts +1 -1
  123. package/dist/react/components/mcp-ui-question-input.js +3 -3
  124. package/dist/react/components/mcp-ui-surface-state.d.ts +1 -1
  125. package/dist/react/features/chat-pane/agent-tools.d.ts +1 -1
  126. package/dist/react/features/chat-pane/antigravity/model-options.d.ts +2 -0
  127. package/dist/react/features/chat-pane/antigravity/model-options.js +2 -0
  128. package/dist/react/features/chat-pane/claude/model-options.d.ts +2 -0
  129. package/dist/react/features/chat-pane/claude/model-options.js +2 -0
  130. package/dist/react/features/chat-pane/codex/model-options.d.ts +2 -0
  131. package/dist/react/features/chat-pane/codex/model-options.js +2 -0
  132. package/dist/react/features/chat-pane/components/AgentPluginUsage.d.ts +4 -1
  133. package/dist/react/features/chat-pane/components/AgentPluginUsage.js +2 -2
  134. package/dist/react/features/chat-pane/components/AgentRuntimePicker.d.ts +10 -6
  135. package/dist/react/features/chat-pane/components/AgentRuntimePicker.js +18 -132
  136. package/dist/react/features/chat-pane/components/ChatPane.d.ts +24 -2
  137. package/dist/react/features/chat-pane/components/ChatPane.js +45 -297
  138. package/dist/react/features/chat-pane/components/ChatPaneComposerArea.d.ts +33 -0
  139. package/dist/react/features/chat-pane/components/ChatPaneComposerArea.js +119 -0
  140. package/dist/react/features/chat-pane/components/ChatPaneLayout.d.ts +42 -0
  141. package/dist/react/features/chat-pane/components/ChatPaneLayout.js +54 -0
  142. package/dist/react/features/chat-pane/components/ChatPaneStatus.d.ts +27 -0
  143. package/dist/react/features/chat-pane/components/ChatPaneStatus.js +91 -0
  144. package/dist/react/features/chat-pane/components/RuntimeDropUp.d.ts +6 -1
  145. package/dist/react/features/chat-pane/components/RuntimeDropUp.js +20 -19
  146. package/dist/react/features/chat-pane/components/RuntimePickerSections.d.ts +62 -0
  147. package/dist/react/features/chat-pane/components/RuntimePickerSections.js +122 -0
  148. package/dist/react/features/chat-pane/create-mcp-ui-tool-caller.d.ts +1 -1
  149. package/dist/react/features/chat-pane/hooks/useChatPane.hooks.d.ts +5 -3
  150. package/dist/react/features/chat-pane/hooks/useChatPane.hooks.js +78 -26
  151. package/dist/react/features/chat-pane/hooks/useChatPaneAgentControl.hooks.js +6 -6
  152. package/dist/react/features/chat-pane/hooks/useChatPaneFileDrop.hooks.d.ts +5 -1
  153. package/dist/react/features/chat-pane/hooks/useChatPaneFileDrop.hooks.js +7 -7
  154. package/dist/react/features/chat-pane/hooks/useRuntimeDropUp.hooks.d.ts +7 -0
  155. package/dist/react/features/chat-pane/hooks/useRuntimeDropUp.hooks.js +5 -0
  156. package/dist/react/features/chat-pane/model-options.js +7 -4
  157. package/dist/react/features/chat-pane/styles.d.ts +1 -1
  158. package/dist/react/features/chat-pane/styles.js +25 -41
  159. package/dist/react/features/chat-pane/types.d.ts +29 -1
  160. package/dist/react/hooks/assistant-chats-contracts.d.ts +1 -1
  161. package/dist/react/hooks/attachment-preview-cache.d.ts +1 -1
  162. package/dist/react/hooks/attachment-preview-cache.js +1 -1
  163. package/dist/react/hooks/fab-position.js +16 -18
  164. package/dist/react/hooks/useConversation.d.ts +6 -1
  165. package/dist/react/hooks/useConversation.js +11 -10
  166. package/dist/react/hooks/useRunStream.d.ts +3 -0
  167. package/dist/react/hooks/useRunStream.js +12 -12
  168. package/dist/react/hooks/useSurfaceRecovery.d.ts +1 -1
  169. package/dist/react/hooks/useSurfaceRecovery.js +2 -2
  170. package/dist/react/index.d.ts +6 -3
  171. package/dist/react/index.js +5 -3
  172. package/dist/react/styles/chat-settings.css +9 -9
  173. package/dist/react/surfaces.d.ts +91 -0
  174. package/dist/react/surfaces.js +28 -0
  175. package/dist/server/durable-runs/recover.d.ts +4 -3
  176. package/dist/server/durable-runs/recover.js +4 -3
  177. package/dist/store/legacy/sqlite/conversations.d.ts +1 -2
  178. package/dist/store/legacy/sqlite/conversations.js +1 -1
  179. package/dist/store/legacy/sqlite/messages.d.ts +2 -3
  180. package/dist/store/legacy/sqlite/messages.js +6 -6
  181. package/dist/store/pglite/index.d.ts +7 -7
  182. package/dist/store/pglite/index.js +1 -1
  183. package/dist/store/ports.d.ts +5 -2
  184. package/dist/store/postgres/index.d.ts +7 -7
  185. package/dist/store/postgres/index.js +1 -1
  186. package/dist/store/runtime/chat-expiry-sweep.js +2 -4
  187. package/dist/store/runtime/chat-history-store.js +2 -3
  188. package/dist/store/runtime/durable-run-store.js +16 -2
  189. package/dist/store/runtime/history-tools.js +33 -11
  190. package/dist/store/runtime/kernel.d.ts +3 -2
  191. package/dist/store/runtime/run-ledger.js +2 -2
  192. package/dist/store/sql/boundary.d.ts +5 -5
  193. package/dist/store/sql/maintenance.d.ts +3 -2
  194. package/dist/store/sql/store.d.ts +16 -8
  195. package/dist/store/sql/store.js +31 -14
  196. package/dist/store/sqlite/index.d.ts +11 -12
  197. package/dist/store/sqlite/index.js +5 -5
  198. package/dist/store/sqlite/schema.d.ts +1 -1
  199. package/package.json +46 -24
  200. package/dist/core/ag-ui/entry.d.ts +0 -84
  201. package/dist/core/ag-ui/entry.js +0 -225
  202. package/dist/core/browser/page-actions.d.ts +0 -121
  203. package/dist/core/browser/page-actions.js +0 -113
  204. package/dist/embed-widget/browser/page-actions.d.ts +0 -2
  205. package/dist/embed-widget/browser/page-actions.js +0 -3
@@ -1,5 +1,7 @@
1
+ import { describeErrorForLog } from '@jini-ai/core/model-facing-tool-errors';
1
2
  import { EventType } from "@ag-ui/core";
2
- import { createAgUiToAgentTranslationState, translateAgUiEventToAgentEvent } from "../ag-ui/entry.js";
3
+ import { createAgUiToAgentTranslationState, translateAgUiEventToAgentEvent } from "../ag-ui/event-reduction.js";
4
+ export { createAgUiFetchAgent } from "./ag-ui-fetch-agent.js";
3
5
  /** Only the originating attachment can authorize page execution. Read its token and tab for every
4
6
  * turn; caller-supplied tool definitions never authorize or execute a transcript event.
5
7
  * @complexity O(1) time and space.
@@ -12,159 +14,179 @@ function frontendBinding({ input }, _options = {}) {
12
14
  ...(typeof tabId === "string" && tabId.length > 0 ? { frontendTabId: tabId } : {}),
13
15
  };
14
16
  }
15
- /** Bind the official client without adding its dependency to every chat consumer. */
16
- export function createAgUiRunClient({ ports }, _options = {}) {
17
- /** In-flight AG-UI turns' driving `HttpAgent`, keyed by the client-minted runId — the ONLY way
18
- * {@link stopAgUiRun} can cancel a turn: like BYOK, there is no server-side run record on THIS
19
- * path to `POST .../cancel` against. Storing the agent (not a bare `AbortController`) lets
20
- * `stopAgUiRun` call its own `abortRun()`, which both aborts the fetch AND (per the package's own
21
- * convention) surfaces a clean `RUN_ERROR{code:"abort"}` through the normal event path rather than
22
- * a raw network error. */
23
- const agUiAgents = new Map();
24
- /**
25
- * Dispatches one already-parsed AG-UI event. `HttpAgent` owns SSE framing and per-event zod
26
- * validation entirely, and hands us finished event objects. `RUN_ERROR` with `code: "abort"` is the
27
- * real package's own convention for a mid-stream abort (see module doc) — routed to `finish()`, not
28
- * `onError`. Every other event is reduced through {@link translateAgUiEventToAgentEvent} and
29
- * forwarded to both `collected` (the final transcript `onDone` receives) and `handlers.onEvent`
30
- * (live rendering).
31
- */
32
- function handleAgUiEvent(event, ctx) {
33
- if (event.type === EventType.RUN_ERROR) {
34
- if (event.code === "abort") {
35
- ctx.finish();
36
- return;
37
- }
38
- ctx.handlers.onError(new Error(event.message || "AG-UI run failed"));
39
- return;
40
- }
41
- if (event.type === EventType.RUN_FINISHED) {
17
+ /**
18
+ * Dispatches one already-parsed AG-UI event. `HttpAgent` owns SSE framing and per-event zod
19
+ * validation entirely, and hands us finished event objects. `RUN_ERROR` with `code: "abort"` is the
20
+ * real package's own convention for a mid-stream abort (see module doc) — routed to `finish()`, not
21
+ * `onError`. Every other event is reduced through {@link translateAgUiEventToAgentEvent} and
22
+ * forwarded to both `collected` (the final transcript `onDone` receives) and `handlers.onEvent`
23
+ * (live rendering).
24
+ */
25
+ function handleAgUiEvent({ event, ctx, onLiveEvent }, _optional = {}) {
26
+ if (event.type === EventType.RUN_ERROR) {
27
+ if (event.code === "abort") {
42
28
  ctx.finish();
43
29
  return;
44
30
  }
45
- for (const translated of translateAgUiEventToAgentEvent({ event, state: ctx.state }, {})) {
46
- ctx.collected.push(translated);
47
- ctx.handlers.onEvent(translated);
48
- }
31
+ ctx.handlers.onError(new Error(event.message || "AG-UI run failed"));
32
+ return;
49
33
  }
50
- /** Every AG-UI message role requires an id; preserve ChatMessage.id across translation. */
51
- function toAgUiMessage(message) {
52
- if (message.role === "user")
53
- return { id: message.id, role: "user", content: message.content };
54
- return { id: message.id, role: "assistant", content: message.content };
34
+ if (event.type === EventType.RUN_FINISHED) {
35
+ onLiveEvent?.({ event });
36
+ ctx.finish();
37
+ return;
55
38
  }
56
- /**
57
- * The AG-UI canary run path (ADR-059) — drives a real `@ag-ui/client` `HttpAgent` against
58
- * `assistant-ag-ui.ts`'s route, same one-turn-per-call shape as `startByokRun`. `credentials:
59
- * "same-origin"` is explicit even though modern `fetch()` already defaults to it for same-origin
60
- * requests, matching this transport's other paths' explicitness about the session cookie.
61
- */
62
- async function startAgUiRun(input, handlers) {
63
- const runId = `${ports.runIdPrefix}${ports.mintId({}, {})}`;
64
- // The conversation-level id, stable across turns — a genuine AG-UI `threadId`, distinct from the
65
- // per-turn `runId` minted fresh above. Falls back to minting one only for a conversation that has
66
- // none yet (e.g. the very first turn).
67
- const threadId = input.conversationId ?? ports.mintId({}, {});
68
- const agent = ports.createAgent({ url: ports.endpoint, threadId }, {});
69
- if (input.signal.aborted)
70
- throw new DOMException("Run cancelled", "AbortError");
71
- agUiAgents.set(runId, agent);
72
- const abort = () => agent.abortRun();
73
- input.signal.addEventListener("abort", abort, { once: true });
74
- const messages = input.history.filter((message) => message.content.trim().length > 0).map(toAgUiMessage);
75
- const runAgentInput = {
76
- threadId,
77
- runId,
78
- state: null,
79
- messages,
80
- tools: [],
81
- context: [],
82
- forwardedProps: {
83
- ...frontendBinding({ input }),
84
- ...(input.agentId ? { agentId: input.agentId } : {}),
85
- ...(input.history.findLast(message => message.role === "user")?.secretRedaction?.secretRedacted ? { secretRedacted: true } : {}),
39
+ if (onLiveEvent?.({ event }))
40
+ return;
41
+ for (const translated of translateAgUiEventToAgentEvent({ event, state: ctx.state }, {})) {
42
+ ctx.collected.push(translated);
43
+ ctx.handlers.onEvent(translated);
44
+ }
45
+ }
46
+ /** Every AG-UI message role requires an id; preserve ChatMessage.id across translation. */
47
+ function toAgUiMessage({ message }, _optional = {}) {
48
+ if (message.role === "user")
49
+ return { id: message.id, role: "user", content: message.content };
50
+ return { id: message.id, role: "assistant", content: message.content };
51
+ }
52
+ /** The request body of one turn. The daemon owns tool registrations, so `tools` stays empty; blank
53
+ * messages are left out because they carry nothing to answer. */
54
+ function toRunAgentInput({ input, runId, threadId }, _optional = {}) {
55
+ return {
56
+ threadId,
57
+ runId,
58
+ state: null,
59
+ messages: input.history.filter((message) => message.content.trim().length > 0).map((message) => toAgUiMessage({ message })),
60
+ tools: [],
61
+ context: [],
62
+ forwardedProps: {
63
+ ...frontendBinding({ input }),
64
+ ...(input.agentId ? { agentId: input.agentId } : {}),
65
+ ...(input.history.findLast(message => message.role === "user")?.secretRedaction?.secretRedacted ? { secretRedacted: true } : {}),
66
+ },
67
+ };
68
+ }
69
+ /** Drops the turn's two handles: its registry entry (so `stopAgUiRun` cannot reach a dead agent) and
70
+ * its listener on the host signal. Safe to repeat. */
71
+ function forgetRun({ turn }, _optional = {}) {
72
+ turn.agents.delete(turn.runId);
73
+ turn.signal.removeEventListener("abort", turn.abort);
74
+ }
75
+ /** The one place a turn is finished: `onDone` receives the collected events exactly once, however
76
+ * many of RUN_FINISHED, an abort, a stream error and `complete` arrive. */
77
+ function settleRunOnce({ turn }, _optional = {}) {
78
+ if (turn.settled)
79
+ return;
80
+ turn.settled = true;
81
+ forgetRun({ turn });
82
+ turn.handlers.onDone(turn.collected);
83
+ }
84
+ /**
85
+ * Deliberately racing the Observable's first `next`/`error`/`complete` against this Promise rather than
86
+ * awaiting it directly — `HttpAgent.run()` returns a cold Observable, never a Promise (module
87
+ * doc). The subscription itself keeps running after this Promise settles, driving `handlers`
88
+ * through to `settleRunOnce` in the background — matching `startByokRun`'s "resolves once STARTED, not
89
+ * once finished" contract.
90
+ */
91
+ function subscribeRun({ turn, runAgentInput, state, ports }, _optional = {}) {
92
+ const finish = () => settleRunOnce({ turn });
93
+ return new Promise((resolve, reject) => {
94
+ let startSettled = false;
95
+ turn.agent.run(runAgentInput).subscribe({
96
+ next: (event) => {
97
+ if (!startSettled) {
98
+ startSettled = true;
99
+ resolve({ runId: turn.runId });
100
+ }
101
+ handleAgUiEvent({ event: event, onLiveEvent: ports.onLiveEvent, ctx: { collected: turn.collected, handlers: turn.handlers, state, finish } });
86
102
  },
87
- };
88
- const collected = [];
89
- let settled = false;
90
- const finish = () => {
91
- if (settled)
92
- return;
93
- settled = true;
94
- agUiAgents.delete(runId);
95
- input.signal.removeEventListener("abort", abort);
96
- handlers.onDone(collected);
97
- };
98
- const state = createAgUiToAgentTranslationState({ customEventNames: ports.customEventNames }, {});
99
- // Deliberately racing the Observable's first `next`/`error`/`complete` against this Promise rather than
100
- // awaiting it directly — `HttpAgent.run()` returns a cold Observable, never a Promise (module
101
- // doc). The subscription itself keeps running after this Promise settles, driving `handlers`
102
- // through to `finish()` in the background — matching `startByokRun`'s "resolves once STARTED, not
103
- // once finished" contract.
104
- return new Promise((resolve, reject) => {
105
- let startSettled = false;
106
- agent.run(runAgentInput).subscribe({
107
- next: (event) => {
108
- if (!startSettled) {
109
- startSettled = true;
110
- resolve({ runId });
111
- }
112
- handleAgUiEvent(event, { collected, handlers, state, finish });
113
- },
114
- error: (error) => {
115
- agUiAgents.delete(runId);
116
- input.signal.removeEventListener("abort", abort);
117
- const err = error instanceof Error ? error : new Error(String(error));
118
- if (!startSettled) {
119
- startSettled = true;
120
- reject(err);
121
- return;
122
- }
123
- // Aborting BEFORE headers arrive rejects the underlying fetch() itself, surfacing here
124
- // rather than through `handleAgUiEvent`'s `code: "abort"` check (module doc).
125
- if (agent.abortController.signal.aborted) {
126
- finish();
127
- return;
128
- }
129
- // Error THEN finish: an errored Observable never calls `complete`, so without this the turn
130
- // is never settled and the events collected before the failure never reach `onDone`. Same
131
- // order as `subscribeToRun`'s `end` listener, so the run is still recorded as failed.
132
- handlers.onError(err);
133
- finish();
134
- },
135
- complete: () => {
136
- // An empty stream has no first notification to settle the start promise.
137
- if (!startSettled) {
138
- startSettled = true;
139
- resolve({ runId });
140
- }
103
+ error: (error) => {
104
+ forgetRun({ turn });
105
+ const err = runStreamError({ error });
106
+ if (!startSettled) {
107
+ startSettled = true;
108
+ reject(err);
109
+ return;
110
+ }
111
+ // Aborting BEFORE headers arrive rejects the underlying fetch() itself, surfacing here
112
+ // rather than through `handleAgUiEvent`'s `code: "abort"` check (module doc).
113
+ if (turn.agent.abortController.signal.aborted) {
141
114
  finish();
142
- },
143
- });
115
+ return;
116
+ }
117
+ // Error THEN finish: an errored Observable never calls `complete`, so without this the turn
118
+ // is never settled and the events collected before the failure never reach `onDone`. Same
119
+ // order as `subscribeToRun`'s `end` listener, so the run is still recorded as failed.
120
+ turn.handlers.onError(err);
121
+ finish();
122
+ },
123
+ complete: () => {
124
+ // An empty stream has no first notification to settle the start promise.
125
+ if (!startSettled) {
126
+ startSettled = true;
127
+ resolve({ runId: turn.runId });
128
+ }
129
+ finish();
130
+ },
144
131
  });
145
- }
146
- /** No server-side run record exists on this path (module doc) — a reload has already discarded the
147
- * original `fetch()`'s response body, so there is nothing to resume. Same honest "already over"
148
- * answer `assistant-transport.ts`'s BYOK branch gives for the identical situation. */
149
- async function reattachAgUiRun(handlers) {
150
- handlers.onDone([]);
151
- }
152
- /** Same reasoning as {@link reattachAgUiRun} — no server-side run record to fetch status for. */
153
- async function fetchAgUiRunStatus() {
154
- return null;
155
- }
156
- /** An AG-UI run's only cancellation handle is the `HttpAgent` {@link startAgUiRun} registered for
157
- * this exact id — same shape as BYOK's `stopRun` branch. */
158
- async function stopAgUiRun(runId) {
159
- agUiAgents.get(runId)?.abortRun();
160
- }
132
+ });
133
+ }
134
+ function runStreamError({ error }, _optional = {}) {
135
+ const status = error instanceof Error && "status" in error && typeof error.status === "number" ? `HTTP ${error.status}, ` : "";
136
+ return new Error(`The agent run stream stopped with an error (${status}${describeErrorForLog({ err: error })}); send the message again.`, { cause: error });
137
+ }
138
+ /**
139
+ * The AG-UI canary run path (ADR-059) — drives a real `@ag-ui/client` `HttpAgent` against
140
+ * `assistant-ag-ui.ts`'s route, same one-turn-per-call shape as `startByokRun`. `credentials:
141
+ * "same-origin"` is explicit even though modern `fetch()` already defaults to it for same-origin
142
+ * requests, matching this transport's other paths' explicitness about the session cookie.
143
+ */
144
+ async function startRun({ ports, agents, input, handlers, resume }, _optional = {}) {
145
+ const runId = `${ports.runIdPrefix}${ports.mintId({}, {})}`;
146
+ // The conversation-level id, stable across turns — a genuine AG-UI `threadId`, distinct from the
147
+ // per-turn `runId` minted fresh above. Falls back to minting one only for a conversation that has
148
+ // none yet (e.g. the very first turn).
149
+ const threadId = resume?.threadId ?? input.conversationId ?? ports.mintId({}, {});
150
+ const agent = ports.createAgent({ url: ports.endpoint, threadId }, {});
151
+ if (input.signal.aborted)
152
+ throw new DOMException("Run cancelled", "AbortError");
153
+ agents.set(runId, agent);
154
+ const abort = () => agent.abortRun();
155
+ input.signal.addEventListener("abort", abort, { once: true });
156
+ const turn = { runId, agent, signal: input.signal, abort, handlers, collected: [], agents, settled: false };
157
+ const state = createAgUiToAgentTranslationState({ customEventNames: ports.customEventNames }, {});
158
+ return subscribeRun({ turn, runAgentInput: { ...toRunAgentInput({ input, runId, threadId }),
159
+ ...(resume ? { parentRunId: resume.parentRunId, resume: resume.resume } : {}) }, state, ports });
160
+ }
161
+ /** No server-side run record exists on this path (module doc) — a reload has already discarded the
162
+ * original `fetch()`'s response body, so there is nothing to resume. Same honest "already over"
163
+ * answer `assistant-transport.ts`'s BYOK branch gives for the identical situation. */
164
+ async function reattachAgUiRun({ handlers }, _optional = {}) {
165
+ handlers.onDone([]);
166
+ }
167
+ /** Same reasoning as {@link reattachAgUiRun} — no server-side run record to fetch status for. */
168
+ async function fetchAgUiRunStatus(_required, _optional = {}) {
169
+ return null;
170
+ }
171
+ /** Bind the official client without adding its dependency to every chat consumer. */
172
+ export function createAgUiRunClient({ ports }, _options = {}) {
173
+ /** In-flight AG-UI turns' driving `HttpAgent`, keyed by the client-minted runId — the ONLY way
174
+ * `stopAgUiRun` can cancel a turn: like BYOK, there is no server-side run record on THIS
175
+ * path to `POST .../cancel` against. Storing the agent (not a bare `AbortController`) lets
176
+ * `stopAgUiRun` call its own `abortRun()`, which both aborts the fetch AND (per the package's own
177
+ * convention) surfaces a clean `RUN_ERROR{code:"abort"}` through the normal event path rather than
178
+ * a raw network error. */
179
+ const agents = new Map();
161
180
  return {
162
- isAgUiRunId: ({ runId }, _options = {}) => runId.startsWith(ports.runIdPrefix),
163
- handleAgUiEvent: ({ event, ctx }, _options = {}) => handleAgUiEvent(event, ctx),
164
- startAgUiRun: ({ input, handlers }, _options = {}) => startAgUiRun(input, handlers),
165
- reattachAgUiRun: ({ handlers }, _options = {}) => reattachAgUiRun(handlers),
166
- fetchAgUiRunStatus: (_required, _options = {}) => fetchAgUiRunStatus(),
167
- stopAgUiRun: ({ runId }, _options = {}) => stopAgUiRun(runId),
181
+ isAgUiRunId: ({ runId }, _optional = {}) => runId.startsWith(ports.runIdPrefix),
182
+ handleAgUiEvent: ({ event, ctx }, _optional = {}) => handleAgUiEvent({ event, ctx, onLiveEvent: ports.onLiveEvent }),
183
+ startAgUiRun: ({ input, handlers }, _optional = {}) => startRun({ ports, agents, input, handlers }),
184
+ resumeAgUiRun: ({ input, handlers, threadId, parentRunId, resume }, _optional = {}) => startRun({ ports, agents, input, handlers, resume: { threadId, parentRunId, resume } }),
185
+ reattachAgUiRun,
186
+ fetchAgUiRunStatus,
187
+ /** An AG-UI run's only cancellation handle is the `HttpAgent` {@link startRun} registered for
188
+ * this exact id — same shape as BYOK's `stopRun` branch. */
189
+ stopAgUiRun: async ({ runId }, _optional = {}) => { agents.get(runId)?.abortRun(); },
168
190
  };
169
191
  }
170
192
  //# sourceMappingURL=ag-ui-transport.js.map
@@ -1,3 +1,4 @@
1
+ import { orFallback } from "@jini-ai/core/errors/idioms";
1
2
  /**
2
3
  * @file Restore cached attachment references only after the host confirms their bytes still exist.
3
4
  * Drafts persist references separately from text; staged bytes have a host-defined TTL. Dropping
@@ -23,19 +24,20 @@ const DEFAULT_TIMEOUT_MS = 10_000;
23
24
  * @complexity O(1); one request, abandoned after `timeoutMs`.
24
25
  */
25
26
  async function isAttachmentStillServed(ref, options) {
26
- try {
27
- const response = await options.fetchImpl(options.endpoint({ ref }, {}), {
28
- method: "HEAD",
29
- credentials: "same-origin",
30
- signal: AbortSignal.timeout(options.timeoutMs),
31
- });
32
- return response.ok;
33
- }
34
- catch {
27
+ return orFallback({
28
+ work: async () => {
29
+ const response = await options.fetchImpl(options.endpoint({ ref }, {}), {
30
+ method: "HEAD",
31
+ credentials: "same-origin",
32
+ signal: AbortSignal.timeout(options.timeoutMs),
33
+ });
34
+ return response.ok;
35
+ },
35
36
  // A network fault, an abort, or a same-origin policy refusal. Indistinguishable from here, and
36
37
  // all mean the same thing: nothing was confirmed, so the reference does not come back.
37
- return false;
38
- }
38
+ fallback: false,
39
+ step: "probe saved attachment",
40
+ });
39
41
  }
40
42
  /**
41
43
  * Runs `probe` over `refs` with at most `concurrency` in flight, answering positionally.
@@ -1,3 +1,4 @@
1
+ import { type Logger } from '@jini-ai/core/primitives';
1
2
  import type { ChatMessage } from "../messages.js";
2
3
  import type { RunHandlers } from "../transport.js";
3
4
  import type { RunNotices } from "../run-events/entry.js";
@@ -38,8 +39,8 @@ export declare function followDurableRun({ runId: initialRunId, handlers, signal
38
39
  ports: DurableSubscriptionPorts;
39
40
  notices: RunNotices;
40
41
  bindings: Map<string, DurableRunBinding>;
41
- }, { logger }?: {
42
- logger?: Pick<Console, "info">;
42
+ }, { report }?: {
43
+ report?: Pick<Logger, "info">;
43
44
  }): () => void;
44
45
  export {};
45
46
  //# sourceMappingURL=durable-run-subscription.d.ts.map
@@ -1,8 +1,9 @@
1
+ import { createConsoleLogger } from '@jini-ai/core/primitives';
1
2
  import { translateRunFrame } from "../run-events/entry.js";
2
3
  /** SSE is a view of one attempt. The saved message owns terminal state and can point at a new
3
4
  * attempt after recovery; neither a browser 404 nor a closed stream may fail the logical run.
4
5
  * An explicit "gone" result ends observation and releases the caller's streaming state. */
5
- export function followDurableRun({ runId: initialRunId, handlers, signal, binding, ports, notices, bindings }, { logger = console } = {}) {
6
+ export function followDurableRun({ runId: initialRunId, handlers, signal, binding, ports, notices, bindings }, { report = createConsoleLogger({ prefix: '' }) } = {}) {
6
7
  let streamEpoch = 0;
7
8
  let runId = initialRunId;
8
9
  let cursor = "";
@@ -36,12 +37,12 @@ export function followDurableRun({ runId: initialRunId, handlers, signal, bindin
36
37
  stopStream = ports.stream({ runId, cursor,
37
38
  frame: (...args) => { if (epoch === streamEpoch)
38
39
  frame(...args); },
39
- dropped: reason => { if (epoch === streamEpoch)
40
- disconnected(reason); },
40
+ dropped: () => { if (epoch === streamEpoch)
41
+ disconnected(); },
41
42
  }, {});
42
43
  }
43
44
  /** One timer owns reconnects, including faults during a checkpoint read. No cursor reset. */
44
- function disconnected(reason = "stream-error") {
45
+ function disconnected() {
45
46
  if (stopped || dropped)
46
47
  return;
47
48
  dropped = true;
@@ -49,7 +50,7 @@ export function followDurableRun({ runId: initialRunId, handlers, signal, bindin
49
50
  recoveryPending = true;
50
51
  reconnectDelayMs = Math.min(30_000, Math.max(1_000, reconnectDelayMs * 2));
51
52
  // Metadata only: neither frame contents nor saved user messages belong in transport logs.
52
- logger.info("[durable-subscription] " + JSON.stringify({ runId, reason, cursor, retryDelayMs: reconnectDelayMs }));
53
+ report.info({ message: "[durable-subscription] Stream disconnected; retrying." }, { meta: { runId, cursor, retryDelayMs: reconnectDelayMs } });
53
54
  stopStream?.();
54
55
  if (!reading)
55
56
  scheduleRead();
@@ -8,7 +8,8 @@ export interface AssistantConversation {
8
8
  updatedAt: number;
9
9
  }
10
10
  /**
11
- * The subset of a live transcript that is worth writing: accepted user turns, and assistant turns whose run
11
+ * The subset of a live transcript that is worth writing: accepted user turns (or pending ones when
12
+ * the host opts in), and assistant turns whose run
12
13
  * has reached a terminal status.
13
14
  *
14
15
  * An assistant message that is still `queued` or `running` is rewritten on every delta, so
@@ -26,8 +27,10 @@ export interface AssistantConversation {
26
27
  * Deleting them here would trade a history bug for a forensics hole.
27
28
  */
28
29
  export declare function persistableMessages({ messages }: {
29
- messages: ChatMessage[];
30
- }, _options?: Record<string, never>): ChatMessage[];
30
+ messages: readonly ChatMessage[];
31
+ }, { includePendingUser }?: {
32
+ includePendingUser?: boolean;
33
+ }): ChatMessage[];
31
34
  /**
32
35
  * The key the admin's chat writers use to remember "this message is already saved": the message id,
33
36
  * plus the run id when there is one.
@@ -59,7 +62,7 @@ export declare function messageWriteKey({ message }: {
59
62
  * race — recording ITS id as "the current run" would point a future reattach at the wrong turn.
60
63
  *
61
64
  * `saveMessage`'s server-side route upserts by message id (`ON CONFLICT(id) DO UPDATE`,
62
- * `Jini/packages/sqlite`'s `chat-history/store.ts`), so this stub write and the message's eventual
65
+ * `packages/chat/src/store/sql/store.ts`), so this stub write and the message's eventual
63
66
  * terminal-state write (through the normal {@link persistableMessages} path) converge on the same
64
67
  * row rather than creating two — the terminal write simply overwrites `run_status`/`content`/
65
68
  * `events_json` in place once the run settles.
@@ -1,6 +1,7 @@
1
1
  import { isTerminalRunStatus } from "../messages.js";
2
2
  /**
3
- * The subset of a live transcript that is worth writing: accepted user turns, and assistant turns whose run
3
+ * The subset of a live transcript that is worth writing: accepted user turns (or pending ones when
4
+ * the host opts in), and assistant turns whose run
4
5
  * has reached a terminal status.
5
6
  *
6
7
  * An assistant message that is still `queued` or `running` is rewritten on every delta, so
@@ -17,8 +18,8 @@ import { isTerminalRunStatus } from "../messages.js";
17
18
  * side instead — see `assistant-transport.ts`'s `historyForTranscript`/`isAnsweredAssistantTurn`.
18
19
  * Deleting them here would trade a history bug for a forensics hole.
19
20
  */
20
- export function persistableMessages({ messages }, _options = {}) {
21
- return messages.filter((message) => message.role === "user" ? !message.inputPending : isTerminalRunStatus({ status: message.runStatus }));
21
+ export function persistableMessages({ messages }, { includePendingUser = false } = {}) {
22
+ return messages.filter((message) => message.role === "user" ? includePendingUser || !message.inputPending : isTerminalRunStatus({ status: message.runStatus }));
22
23
  }
23
24
  /**
24
25
  * The key the admin's chat writers use to remember "this message is already saved": the message id,
@@ -51,7 +52,7 @@ export function messageWriteKey({ message }, _options = {}) {
51
52
  * race — recording ITS id as "the current run" would point a future reattach at the wrong turn.
52
53
  *
53
54
  * `saveMessage`'s server-side route upserts by message id (`ON CONFLICT(id) DO UPDATE`,
54
- * `Jini/packages/sqlite`'s `chat-history/store.ts`), so this stub write and the message's eventual
55
+ * `packages/chat/src/store/sql/store.ts`), so this stub write and the message's eventual
55
56
  * terminal-state write (through the normal {@link persistableMessages} path) converge on the same
56
57
  * row rather than creating two — the terminal write simply overwrites `run_status`/`content`/
57
58
  * `events_json` in place once the run settles.
@@ -43,7 +43,7 @@ export interface AssistantTransportOptions {
43
43
  * agentId this set contains: "the caller trusts this adapter's CLI to carry its own multi-turn
44
44
  * conversation memory... and should skip resending the rendered transcript on follow-up turns"
45
45
  * (`types.ts`). Resending it anyway would duplicate everything the daemon's own `--resume`/
46
- * `session/load` already restores (`agent-session-resume.ts`).
46
+ * `session/load` already restores (`packages/daemon/src/session-coordination.ts`).
47
47
  *
48
48
  * Read fresh on every `startRun` call, same "never captured" convention {@link getExecutionConfig}/
49
49
  * {@link getAgUiEnabled} already establish: the admin's own `/api/agents` probe resolves
@@ -10,20 +10,20 @@ export function createAssistantTransportClient({ ports }, _options = {}) {
10
10
  const terminalReasonNotice = (reason) => runEvents.terminalReasonNotice({ reason, notice: ports.notices.toolStepLimit }, {});
11
11
  const translateRunAgentPayload = (payload) => runEvents.translateRunAgentPayload({ payload }, {});
12
12
  /**
13
- * Shared HTTP implementation of `@jini-ai/chat/react`'s `ChatTransport` port (originally ADR-049).
13
+ * Shared HTTP implementation of `@jini-ai/chat/react`'s `ChatTransport` port.
14
14
  *
15
15
  * TWO run paths live here, selected per-turn by `getExecutionConfig()` (see
16
16
  * `createAssistantTransport`'s own doc):
17
17
  *
18
18
  * 1. **Local CLI** (the original, unchanged path): binds to the real `@jini-ai/http` run surface
19
- * `src/server/modules/assistant.ts` mounts — `POST /api/runs` to start, `GET
19
+ * the host app's `src/server/runtime/composition/modules/assistant.ts` mounts — `POST /api/runs` to start, `GET
20
20
  * /api/runs/:runId/events` (native `EventSource`) to stream, `GET /api/runs/:runId` for status,
21
21
  * `POST /api/runs/:runId/cancel` to stop. Every SSE frame's `data` is a full `@jini-ai/protocol`
22
22
  * `RunProtocolEvent` (`{kind, payload, ...}`), not chat-core's own `AgentEvent` — chat-core's own
23
23
  * module doc is explicit that this reduction is a transport concern ("a host's transport adapter
24
24
  * is responsible for reducing wire deltas... into the persisted/renderable AgentEvent items"), so
25
25
  * `translateRunAgentPayload` below does that translation.
26
- * 2. **API · BYOK** (2026-08-04, ADR-049's picker): binds to `src/server/modules/assistant-byok.ts`'s
26
+ * 2. **API · BYOK** (2026-08-04, the execution picker): binds to the host app's `src/server/runtime/composition/modules/assistant-byok.ts`'s
27
27
  * `POST /api/admin/v1/assistant/byok-turn` — one request/response holding the WHOLE turn open,
28
28
  * no separate `EventSource`/reattach/cancel-by-runId (see that route's own header for why, and
29
29
  * what it costs). Its SSE frames carry the SAME `payload.type` vocabulary
@@ -454,7 +454,7 @@ export function createAssistantTransportClient({ ports }, _options = {}) {
454
454
  * (`AssistantDock.tsx` supplies it from the live `FrontendSessionBridge`).
455
455
  *
456
456
  * Read by name rather than spreading the whole `input.context` blob: `contextRef` is a shared
457
- * envelope that the host's proxy also writes `principalId` into (`src/server/modules/assistant.ts`),
457
+ * envelope that the host's proxy also writes `principalId` into (the host app's `src/server/runtime/composition/modules/assistant.ts`),
458
458
  * and a spread would let any future `runContext` key silently shadow it — an identity field being
459
459
  * overwritten by a UI prop is not a failure mode worth leaving open to save one line.
460
460
  *
@@ -40,4 +40,6 @@ export { formatUsageCost } from './usage-format.js';
40
40
  export * from './accepted-input.js';
41
41
  export * from './question-answer.js';
42
42
  export { checkpointIntervalMs, checkpointProgress } from './checkpoint-interval.js';
43
+ export type { ChatAgentFailurePort, ChatAgentPolicyPort } from './agents-port.js';
44
+ export { persistableMessages } from "./assistant-client/messages.js";
43
45
  //# sourceMappingURL=index.d.ts.map
@@ -39,4 +39,5 @@ export { formatUsageCost } from './usage-format.js';
39
39
  export * from './accepted-input.js';
40
40
  export * from './question-answer.js';
41
41
  export { checkpointIntervalMs, checkpointProgress } from './checkpoint-interval.js';
42
+ export { persistableMessages } from "./assistant-client/messages.js";
42
43
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,15 @@
1
+ /**
2
+ * @file The page-capability runtime port: chat only forwards page-control requests, it never calls driver
3
+ * methods. The host binds the implementation (a DOM driver, a native shell, a test fake) once.
4
+ */
5
+ export interface ChatPagePort {
6
+ /** Ids of the page capabilities the host can execute. */
7
+ readonly capabilityIds: readonly string[];
8
+ execute(required: {
9
+ capabilityId: string;
10
+ input: Record<string, unknown>;
11
+ }, optional?: {
12
+ signal?: AbortSignal;
13
+ }): Promise<unknown>;
14
+ }
15
+ //# sourceMappingURL=page-port.d.ts.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=page-port.js.map
@@ -17,7 +17,7 @@
17
17
  * - `code: 'tool_progress'`, `data: { elapsedSeconds }` — a tool call is still running.
18
18
  * - `code: 'thinking'` — the model is reasoning (keeps the idle timer honest).
19
19
  */
20
- import { a2uiSurfaceIdOf, displayOnlySurfaceIdOf } from '@jini-ai/agentic/a2ui';
20
+ import { a2uiSurfaceIdOf, displayOnlySurfaceIdOf } from '@jini-ai/protocol/a2ui';
21
21
  import { isDelegatedWrapperToolName } from './tool-events.js';
22
22
  import { MID_RUN_USER_MESSAGE_EVENT_NAME } from './turn-usage.js';
23
23
  import { SURFACE_QUESTION_META_KEY } from './question-answer.js';
@@ -151,6 +151,7 @@ function translateEnvelopePayload(payload) {
151
151
  // `examples/reference-web/src/daemon-transport.ts`.
152
152
  case "a2ui":
153
153
  return { kind: "ext", name: "a2ui", data: payload.message };
154
+ // The wire has `thinking_start` alone. Drop it to preserve the existing reduction across transports.
154
155
  case "thinking_start":
155
156
  return null;
156
157
  // Streamed tool input (with `--include-partial-messages`): the finished `tool_use` carries the
@@ -18,9 +18,7 @@ export interface UserTextRedactionOptions {
18
18
  }
19
19
  export declare const SECRET_REDACTED_NOTICE = "I removed what looked like a key from your message. If it was real, rotate it. Use the secure form to save it.";
20
20
  export declare const CREDENTIAL_CARD_GUIDANCE = "Use the secure form to save keys, tokens, passwords, and secrets. Chat answers are sent to the assistant.";
21
- /** Stricter than error redaction: also detects unlabelled long tokens, while retaining ordinary URLs,
22
- * filesystem paths, hexadecimal hashes, identifiers and prose. Strong credential syntax inside
23
- * URLs or paths is still caught. */
21
+ /** Masks recognisable secrets only (shared rules plus the chat rules above); paths, file names, ids and prose stay as typed. */
24
22
  export declare function redactUserText({ text }: {
25
23
  readonly text: string;
26
24
  }, { secretField }?: {