@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
@@ -0,0 +1,53 @@
1
+ /** Parse and bound one inbound AG-UI run request (`RunAgentInput`) for a host route.
2
+ * Pure: the history bound and the id generator are host inputs, so no host default or Node
3
+ * built-in lives here. The route that calls this owns authentication and the HTTP answer. */
4
+ /** One history turn a run may carry: only user and assistant text survives parsing. */
5
+ export interface AgUiChatMessage {
6
+ role: 'user' | 'assistant';
7
+ content: string;
8
+ }
9
+ /** A validated run request. `threadId`, `runId` and `requestId` are always present; the three
10
+ * forwarded fields are `undefined` when the caller sent none or sent a malformed one. */
11
+ export interface AgUiRunInput {
12
+ frontendBindToken: string | undefined;
13
+ frontendTabId: string | undefined;
14
+ threadId: string;
15
+ runId: string;
16
+ requestId: string;
17
+ agentId: string | undefined;
18
+ messages: AgUiChatMessage[];
19
+ secretRedacted: boolean;
20
+ }
21
+ /** The raw request body: every field is untrusted until parsed here. */
22
+ export interface AgUiRunBody {
23
+ threadId?: unknown;
24
+ runId?: unknown;
25
+ messages?: unknown;
26
+ forwardedProps?: unknown;
27
+ }
28
+ /** Mints the ids a caller left out. The host injects it, so tests pin ids and this file stays universal. */
29
+ export interface AgUiRunIdPort {
30
+ newId(): string;
31
+ }
32
+ /** Validates and bounds the client-supplied `messages` array: malformed entries are dropped, not
33
+ * refused (history is passive background context, not something the caller just authored this
34
+ * instant), and only the trailing `maxHistoryMessages` are kept. The bound is the host's: each turn
35
+ * re-sends its whole history, so an unbounded one makes every later message in a long chat more
36
+ * expensive than the last.
37
+ * @complexity O(h) time and space in the supplied history. */
38
+ export declare function resolveAgUiMessages({ raw, maxHistoryMessages }: {
39
+ raw: unknown;
40
+ maxHistoryMessages: number;
41
+ }, _optional?: Record<string, never>): AgUiChatMessage[];
42
+ /** Validates and normalizes one AG-UI run request body, or `null` when it fails the one hard
43
+ * requirement: a non-empty `messages` array ending in a user turn. A caller-supplied `threadId` /
44
+ * `runId` is echoed as given (AG-UI expects the caller to own them); an absent or empty one is
45
+ * minted so a well-formed-but-partial request still gets a coherent stream. Ids are minted in the
46
+ * order thread, run, request.
47
+ * @complexity O(h) time and space in the supplied history; attachment fields are constant work. */
48
+ export declare function resolveAgUiRunInput({ body, maxHistoryMessages, ids }: {
49
+ body: AgUiRunBody;
50
+ maxHistoryMessages: number;
51
+ ids: AgUiRunIdPort;
52
+ }, _optional?: Record<string, never>): AgUiRunInput | null;
53
+ //# sourceMappingURL=run-input.d.ts.map
@@ -0,0 +1,87 @@
1
+ /** Parse and bound one inbound AG-UI run request (`RunAgentInput`) for a host route.
2
+ * Pure: the history bound and the id generator are host inputs, so no host default or Node
3
+ * built-in lives here. The route that calls this owns authentication and the HTTP answer. */
4
+ function isPlainMessage(value) {
5
+ return typeof value === 'object' && value !== null;
6
+ }
7
+ /** Validates one raw history entry, same fail-soft posture as `resolveAgUiMessages`'s own doc:
8
+ * `null` for anything malformed rather than throwing, since history is passive background context,
9
+ * not something the caller just authored this instant. Split out of `resolveAgUiMessages` so the
10
+ * per-entry branching is scored in this function's own complexity budget, not the loop's. */
11
+ function parseAgUiMessage({ entry }, _optional = {}) {
12
+ if (!isPlainMessage(entry))
13
+ return null;
14
+ const role = entry.role === 'user' || entry.role === 'assistant' ? entry.role : null;
15
+ const content = typeof entry.content === 'string' ? entry.content : null;
16
+ if (role === null || content === null || content.length === 0)
17
+ return null;
18
+ return { role, content };
19
+ }
20
+ /** Validates and bounds the client-supplied `messages` array: malformed entries are dropped, not
21
+ * refused (history is passive background context, not something the caller just authored this
22
+ * instant), and only the trailing `maxHistoryMessages` are kept. The bound is the host's: each turn
23
+ * re-sends its whole history, so an unbounded one makes every later message in a long chat more
24
+ * expensive than the last.
25
+ * @complexity O(h) time and space in the supplied history. */
26
+ export function resolveAgUiMessages({ raw, maxHistoryMessages }, _optional = {}) {
27
+ if (!Array.isArray(raw))
28
+ return [];
29
+ const messages = [];
30
+ for (const entry of raw) {
31
+ const message = parseAgUiMessage({ entry });
32
+ if (message)
33
+ messages.push(message);
34
+ }
35
+ return messages.slice(-maxHistoryMessages);
36
+ }
37
+ /** `value` when it's a non-empty string, else `undefined` — the shared shape behind `threadId`,
38
+ * `runId`, and `agentId`'s "caller-supplied or minted" resolution below. */
39
+ function resolveNonEmptyString({ value }, _optional = {}) {
40
+ return typeof value === 'string' && value.length > 0 ? value : undefined;
41
+ }
42
+ /** `RunAgentInput.forwardedProps` has no declared shape of its own (`z.ZodAny` in `@ag-ui/core`) —
43
+ * it's the schema's documented passthrough extension point, and a host's agent-selector value rides
44
+ * there as `forwardedProps.agentId` (there is no top-level `agentId` field on a real
45
+ * `RunAgentInput`; that's a separate, unrelated `AgentConfig`-level concept in `@ag-ui/client`). */
46
+ function resolveForwardedAgentId({ forwardedProps }, _optional = {}) {
47
+ if (typeof forwardedProps !== 'object' || forwardedProps === null)
48
+ return undefined;
49
+ return resolveNonEmptyString({ value: forwardedProps.agentId });
50
+ }
51
+ /** Read only the bounded attachment identity fields, never a surface id or tool handler. The
52
+ * daemon's registry verifies the token against the authenticated principal and originating tab.
53
+ * @complexity O(1) time and space. */
54
+ function resolveForwardedBindingField({ forwardedProps, field }, _optional = {}) {
55
+ if (typeof forwardedProps !== 'object' || forwardedProps === null)
56
+ return undefined;
57
+ const value = forwardedProps[field];
58
+ return typeof value === 'string' && value.length > 0 && value.length <= 256 ? value : undefined;
59
+ }
60
+ /** Only the literal `true` counts: the request carries a boolean signal, never the redacted text. */
61
+ function resolveSecretRedacted({ forwardedProps }, _optional = {}) {
62
+ return typeof forwardedProps === 'object' && forwardedProps !== null
63
+ && forwardedProps.secretRedacted === true;
64
+ }
65
+ /** Validates and normalizes one AG-UI run request body, or `null` when it fails the one hard
66
+ * requirement: a non-empty `messages` array ending in a user turn. A caller-supplied `threadId` /
67
+ * `runId` is echoed as given (AG-UI expects the caller to own them); an absent or empty one is
68
+ * minted so a well-formed-but-partial request still gets a coherent stream. Ids are minted in the
69
+ * order thread, run, request.
70
+ * @complexity O(h) time and space in the supplied history; attachment fields are constant work. */
71
+ export function resolveAgUiRunInput({ body, maxHistoryMessages, ids }, _optional = {}) {
72
+ const messages = resolveAgUiMessages({ raw: body.messages, maxHistoryMessages });
73
+ if (messages.length === 0 || messages[messages.length - 1]?.role !== 'user')
74
+ return null;
75
+ const { forwardedProps } = body;
76
+ return {
77
+ threadId: resolveNonEmptyString({ value: body.threadId }) ?? ids.newId(),
78
+ runId: resolveNonEmptyString({ value: body.runId }) ?? ids.newId(),
79
+ requestId: ids.newId(),
80
+ agentId: resolveForwardedAgentId({ forwardedProps }),
81
+ frontendBindToken: resolveForwardedBindingField({ forwardedProps, field: 'frontendBindToken' }),
82
+ frontendTabId: resolveForwardedBindingField({ forwardedProps, field: 'frontendTabId' }),
83
+ secretRedacted: resolveSecretRedacted({ forwardedProps }),
84
+ messages,
85
+ };
86
+ }
87
+ //# sourceMappingURL=run-input.js.map
@@ -11,7 +11,7 @@
11
11
  * Chat outcomes belong here; generic capability vocabulary belongs to @jini-ai/agentic so
12
12
  * non-chat consumers can use it independently of chat.
13
13
  */
14
- import type { CapabilityDef } from '@jini-ai/agentic';
14
+ import type { CapabilityDef } from '@jini-ai/core/contracts/capabilities';
15
15
  /** The bounded, explicit set of chat-pane capabilities every transport surface hosts. */
16
16
  export declare const CHAT_CAPABILITIES: readonly CapabilityDef[];
17
17
  //# sourceMappingURL=chat-capabilities.d.ts.map
@@ -1,9 +1,7 @@
1
1
  /**
2
2
  * Internal chat capability barrel, re-exported by chat/core rather than a public ./agentic subpath.
3
- * CHAT_CAPABILITIES belongs to chat; generic capability vocabulary belongs to @jini-ai/agentic.
4
- * The type re-exports preserve public compatibility. New code should import vocabulary from its
5
- * owner, @jini-ai/agentic.
3
+ * CHAT_CAPABILITIES belongs to chat; the generic capability vocabulary lives in
4
+ * @jini-ai/core/contracts/capabilities.
6
5
  */
7
6
  export { CHAT_CAPABILITIES } from './chat-capabilities.js';
8
- export type { CapabilityDef, CapabilityInputSchema, CapabilityRisk } from '@jini-ai/agentic';
9
7
  //# sourceMappingURL=index.d.ts.map
@@ -1,8 +1,7 @@
1
1
  /**
2
2
  * Internal chat capability barrel, re-exported by chat/core rather than a public ./agentic subpath.
3
- * CHAT_CAPABILITIES belongs to chat; generic capability vocabulary belongs to @jini-ai/agentic.
4
- * The type re-exports preserve public compatibility. New code should import vocabulary from its
5
- * owner, @jini-ai/agentic.
3
+ * CHAT_CAPABILITIES belongs to chat; the generic capability vocabulary lives in
4
+ * @jini-ai/core/contracts/capabilities.
6
5
  */
7
6
  export { CHAT_CAPABILITIES } from './chat-capabilities.js';
8
7
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,50 @@
1
+ /** @file What chat needs from an agent runtime, as ports the host binds. Chat states the shapes with vocabulary from
2
+ * `@jini-ai/core/contracts/agents`; it does not pick the runtime. */
3
+ import type { AgentServiceFailureCode, ModelIdentityKind, NativeToolPolicyInput, RuntimeModelOption, RuntimeReasoningOption } from '@jini-ai/core/contracts/agents';
4
+ /** Model-selection and native-tool policy are the agent runtime's domain rules; chat receives them (React: through the chat kit's `agents` slot). */
5
+ export interface ChatAgentPolicyPort {
6
+ modelIdentityKind(required: {
7
+ id: string;
8
+ }): ModelIdentityKind;
9
+ concreteModelOptions(required: {
10
+ models?: readonly RuntimeModelOption[];
11
+ supportsConcreteModelSelection?: boolean;
12
+ defaultModelResolution?: {
13
+ status: string;
14
+ id?: string;
15
+ };
16
+ }): RuntimeModelOption[];
17
+ modelReasoningOptions(required: {
18
+ agent: {
19
+ reasoningOptions?: readonly RuntimeReasoningOption[];
20
+ reasoningInModelId?: {
21
+ levels: readonly RuntimeReasoningOption[];
22
+ };
23
+ };
24
+ model?: Pick<RuntimeModelOption, 'reasoning'>;
25
+ }): RuntimeReasoningOption[];
26
+ /** A plain-words refusal to show before sending, or `null` when the policy allows the run. */
27
+ assessNativeToolPolicy(required: {
28
+ def: {
29
+ name: string;
30
+ supportsNativeToolAccess?: boolean;
31
+ fullCliAccessOnly?: boolean;
32
+ };
33
+ policy: NativeToolPolicyInput;
34
+ }): string | null;
35
+ }
36
+ /** Server side: durable-run recovery classifies saved failures. */
37
+ export interface ChatAgentFailurePort {
38
+ /** `null` for an ordinary failure that belongs to no service class. */
39
+ classifyServiceFailure(required: {
40
+ text: string;
41
+ }): AgentServiceFailureCode | null;
42
+ startupFailureMessage(required: {
43
+ stage: string;
44
+ error: unknown;
45
+ }, optional?: {
46
+ exactSecrets?: readonly string[];
47
+ notice?: string;
48
+ }): string;
49
+ }
50
+ //# sourceMappingURL=agents-port.d.ts.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=agents-port.js.map
@@ -0,0 +1,16 @@
1
+ import { type RunAgentInput } from '@ag-ui/core';
2
+ import type { AgUiClient } from './ag-ui-transport.js';
3
+ declare function readAgUiResponse({ request, input, signal, observer }: {
4
+ request: (required: {
5
+ input: RunAgentInput;
6
+ signal: AbortSignal;
7
+ }) => Promise<Response>;
8
+ input: RunAgentInput;
9
+ signal: AbortSignal;
10
+ observer: Parameters<ReturnType<AgUiClient['run']>['subscribe']>[0];
11
+ }): Promise<void>;
12
+ export declare function createAgUiFetchAgent({ request }: {
13
+ request: Parameters<typeof readAgUiResponse>[0]['request'];
14
+ }, _optional?: Record<string, never>): AgUiClient;
15
+ export {};
16
+ //# sourceMappingURL=ag-ui-fetch-agent.d.ts.map
@@ -0,0 +1,24 @@
1
+ import { EventSchemas } from '@ag-ui/core';
2
+ import { readSseFrames } from '../run-events/entry.js';
3
+ async function readAgUiResponse({ request, input, signal, observer }) {
4
+ const response = await request({ input, signal });
5
+ if (!response.body)
6
+ throw new Error('The agent response has no event stream');
7
+ const body = response.body.pipeThrough(new TransformStream(), { signal });
8
+ for await (const frame of readSseFrames({ body })) {
9
+ observer.next(EventSchemas.parse(JSON.parse(frame.data)));
10
+ }
11
+ }
12
+ export function createAgUiFetchAgent({ request }, _optional = {}) {
13
+ const abortController = new AbortController();
14
+ return {
15
+ abortController,
16
+ abortRun: () => abortController.abort(),
17
+ run: (input) => ({
18
+ subscribe(observer) {
19
+ return readAgUiResponse({ request, input, signal: abortController.signal, observer }).then(() => observer.complete(), (error) => observer.error(error));
20
+ },
21
+ }),
22
+ };
23
+ }
24
+ //# sourceMappingURL=ag-ui-fetch-agent.js.map
@@ -9,9 +9,11 @@
9
9
  * there so an intentional stop cannot become a user-facing failure.
10
10
  */
11
11
  import type { RunAgentInput } from "@ag-ui/core";
12
- import type { AgUiEvent, AgUiToAgentTranslationState, CustomEventNames } from "../ag-ui/entry.js";
12
+ import type { AgUiToAgentTranslationState } from "../ag-ui/event-reduction.js";
13
+ import type { AgUiEvent, CustomEventNames } from "../ag-ui/event-projection.js";
13
14
  import type { AgentEvent } from "../events.js";
14
15
  import type { RunHandlers, StartRunInput } from "../transport.js";
16
+ export { createAgUiFetchAgent } from "./ag-ui-fetch-agent.js";
15
17
  export interface AgUiClient {
16
18
  readonly abortController: AbortController;
17
19
  abortRun(): void;
@@ -24,6 +26,9 @@ export interface AgUiClient {
24
26
  };
25
27
  }
26
28
  export interface AgUiClientPorts {
29
+ readonly onLiveEvent?: (required: {
30
+ event: AgUiEvent;
31
+ }) => boolean;
27
32
  readonly endpoint: string;
28
33
  readonly runIdPrefix: string;
29
34
  readonly customEventNames: CustomEventNames;
@@ -53,6 +58,15 @@ export interface AgUiRunClient {
53
58
  }, optional?: Record<string, never>): Promise<{
54
59
  runId: string;
55
60
  }>;
61
+ resumeAgUiRun(required: {
62
+ input: StartRunInput;
63
+ handlers: RunHandlers;
64
+ threadId: string;
65
+ parentRunId: string;
66
+ resume: NonNullable<RunAgentInput["resume"]>;
67
+ }, optional?: Record<string, never>): Promise<{
68
+ runId: string;
69
+ }>;
56
70
  reattachAgUiRun(required: {
57
71
  handlers: RunHandlers;
58
72
  }, optional?: Record<string, never>): Promise<void>;