@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.
- package/CHANGELOG.md +2 -12
- package/README.md +3 -3
- package/dist/contracts/chat-bubble-style.d.ts +1 -1
- package/dist/contracts/chat-bubble-style.js +1 -1
- package/dist/core/ag-ui/event-projection.d.ts +125 -0
- package/dist/core/ag-ui/event-projection.js +275 -0
- package/dist/core/ag-ui/event-reduction.d.ts +39 -0
- package/dist/core/ag-ui/event-reduction.js +99 -0
- package/dist/core/ag-ui/run-input.d.ts +53 -0
- package/dist/core/ag-ui/run-input.js +87 -0
- package/dist/core/agentic/chat-capabilities.d.ts +1 -1
- package/dist/core/agentic/index.d.ts +2 -4
- package/dist/core/agentic/index.js +2 -3
- package/dist/core/agents-port.d.ts +50 -0
- package/dist/core/agents-port.js +2 -0
- package/dist/core/assistant-client/ag-ui-fetch-agent.d.ts +16 -0
- package/dist/core/assistant-client/ag-ui-fetch-agent.js +24 -0
- package/dist/core/assistant-client/ag-ui-transport.d.ts +15 -1
- package/dist/core/assistant-client/ag-ui-transport.js +167 -145
- package/dist/core/assistant-client/attachment-liveness.js +13 -11
- package/dist/core/assistant-client/durable-run-subscription.d.ts +3 -2
- package/dist/core/assistant-client/durable-run-subscription.js +6 -5
- package/dist/core/assistant-client/messages.d.ts +7 -4
- package/dist/core/assistant-client/messages.js +5 -4
- package/dist/core/assistant-client/transport.d.ts +1 -1
- package/dist/core/assistant-client/transport.js +4 -4
- package/dist/core/index.d.ts +2 -0
- package/dist/core/index.js +1 -0
- package/dist/core/page-port.d.ts +15 -0
- package/dist/core/page-port.js +2 -0
- package/dist/core/run-activity.js +1 -1
- package/dist/core/run-events/entry.js +1 -0
- package/dist/core/user-text-redaction.d.ts +1 -3
- package/dist/core/user-text-redaction.js +3 -61
- package/dist/embed-widget/browser/agent-inventory.d.ts +37 -0
- package/dist/embed-widget/browser/agent-inventory.js +36 -0
- package/dist/embed-widget/browser/frontend-session-bridge.d.ts +2 -2
- package/dist/embed-widget/browser/frontend-session-bridge.js +17 -14
- package/dist/embed-widget/react/dialog.hooks.d.ts +16 -0
- package/dist/embed-widget/react/dialog.hooks.js +15 -0
- package/dist/embed-widget/react/embed.d.ts +7 -2
- package/dist/embed-widget/react/embed.js +6 -16
- package/dist/embed-widget/react/header.d.ts +4 -1
- package/dist/embed-widget/react/header.js +2 -2
- package/dist/embed-widget/vanilla/state.js +2 -2
- package/dist/embed-widget/vanilla/style.css +4 -4
- package/dist/react/components/A2uiSurfaceCard.d.ts +18 -4
- package/dist/react/components/A2uiSurfaceCard.hooks.d.ts +36 -0
- package/dist/react/components/A2uiSurfaceCard.hooks.js +174 -0
- package/dist/react/components/A2uiSurfaceCard.js +14 -227
- package/dist/react/components/A2uiSurfaceCard.rules.d.ts +14 -0
- package/dist/react/components/A2uiSurfaceCard.rules.js +24 -0
- package/dist/react/components/AttachmentPreviewModal.d.ts +21 -1
- package/dist/react/components/AttachmentPreviewModal.hooks.js +1 -3
- package/dist/react/components/AttachmentPreviewModal.js +11 -9
- package/dist/react/components/AttachmentTray.d.ts +11 -1
- package/dist/react/components/AttachmentTray.js +12 -8
- package/dist/react/components/ChatFab.d.ts +10 -1
- package/dist/react/components/ChatFab.js +2 -2
- package/dist/react/components/ChatSettingsDialog.d.ts +4 -3
- package/dist/react/components/ChatSettingsDialog.js +9 -6
- package/dist/react/components/ChatSettingsSegmented.d.ts +1 -1
- package/dist/react/components/ChatSettingsSegmented.js +1 -1
- package/dist/react/components/Composer.d.ts +9 -1
- package/dist/react/components/Composer.hooks.d.ts +79 -0
- package/dist/react/components/Composer.hooks.js +336 -0
- package/dist/react/components/Composer.js +40 -341
- package/dist/react/components/ComposerDiscovery.js +1 -1
- package/dist/react/components/ConversationList.d.ts +34 -1
- package/dist/react/components/ConversationList.hooks.d.ts +37 -0
- package/dist/react/components/ConversationList.hooks.js +177 -1
- package/dist/react/components/ConversationList.js +7 -174
- package/dist/react/components/ConversationTitleEditor.d.ts +17 -2
- package/dist/react/components/ConversationTitleEditor.hooks.d.ts +15 -0
- package/dist/react/components/ConversationTitleEditor.hooks.js +36 -0
- package/dist/react/components/ConversationTitleEditor.js +11 -34
- package/dist/react/components/CopyMessageButton.d.ts +6 -1
- package/dist/react/components/CopyMessageButton.js +4 -4
- package/dist/react/components/ExtEventErrorBoundary.d.ts +2 -0
- package/dist/react/components/ExtEventErrorBoundary.js +5 -3
- package/dist/react/components/FolderChips.d.ts +11 -1
- package/dist/react/components/FolderChips.hooks.d.ts +12 -0
- package/dist/react/components/FolderChips.hooks.js +10 -0
- package/dist/react/components/FolderChips.js +9 -9
- package/dist/react/components/Markdown.js +7 -5
- package/dist/react/components/McpUiSurfaceCard.d.ts +29 -5
- package/dist/react/components/McpUiSurfaceCard.js +29 -16
- package/dist/react/components/MessageList.d.ts +10 -1
- package/dist/react/components/MessageList.hooks.d.ts +0 -4
- package/dist/react/components/MessageList.hooks.js +6 -18
- package/dist/react/components/MessageList.js +17 -20
- package/dist/react/components/MessageList.rules.d.ts +0 -5
- package/dist/react/components/MessageList.rules.js +0 -4
- package/dist/react/components/MessageRow.d.ts +46 -2
- package/dist/react/components/MessageRow.hooks.d.ts +60 -0
- package/dist/react/components/MessageRow.hooks.js +94 -0
- package/dist/react/components/MessageRow.js +53 -113
- package/dist/react/components/MidRunUserMessage.d.ts +6 -1
- package/dist/react/components/MidRunUserMessage.js +5 -5
- package/dist/react/components/NextStepActions.d.ts +3 -1
- package/dist/react/components/NextStepActions.js +3 -3
- package/dist/react/components/QuestionForm.answers.hooks.d.ts +26 -0
- package/dist/react/components/QuestionForm.answers.hooks.js +89 -0
- package/dist/react/components/QuestionForm.d.ts +6 -0
- package/dist/react/components/QuestionForm.js +23 -261
- package/dist/react/components/QuestionForm.values.d.ts +22 -0
- package/dist/react/components/QuestionForm.values.js +58 -0
- package/dist/react/components/QuestionFormField.d.ts +17 -0
- package/dist/react/components/QuestionFormField.js +114 -0
- package/dist/react/components/QuestionsPanel.d.ts +3 -1
- package/dist/react/components/QuestionsPanel.js +7 -3
- package/dist/react/components/SentAttachment.d.ts +11 -2
- package/dist/react/components/SentAttachment.hooks.d.ts +1 -1
- package/dist/react/components/SentAttachment.hooks.js +6 -5
- package/dist/react/components/SentAttachment.js +5 -3
- package/dist/react/components/TodoCard.d.ts +3 -1
- package/dist/react/components/TodoCard.js +9 -4
- package/dist/react/components/ToolCallGroup.d.ts +11 -1
- package/dist/react/components/ToolCallGroup.js +10 -4
- package/dist/react/components/ToolCard.d.ts +6 -1
- package/dist/react/components/ToolCard.js +79 -69
- package/dist/react/components/mcp-ui-question-input.d.ts +1 -1
- package/dist/react/components/mcp-ui-question-input.js +3 -3
- package/dist/react/components/mcp-ui-surface-state.d.ts +1 -1
- package/dist/react/features/chat-pane/agent-tools.d.ts +1 -1
- package/dist/react/features/chat-pane/antigravity/model-options.d.ts +2 -0
- package/dist/react/features/chat-pane/antigravity/model-options.js +2 -0
- package/dist/react/features/chat-pane/claude/model-options.d.ts +2 -0
- package/dist/react/features/chat-pane/claude/model-options.js +2 -0
- package/dist/react/features/chat-pane/codex/model-options.d.ts +2 -0
- package/dist/react/features/chat-pane/codex/model-options.js +2 -0
- package/dist/react/features/chat-pane/components/AgentPluginUsage.d.ts +4 -1
- package/dist/react/features/chat-pane/components/AgentPluginUsage.js +2 -2
- package/dist/react/features/chat-pane/components/AgentRuntimePicker.d.ts +10 -6
- package/dist/react/features/chat-pane/components/AgentRuntimePicker.js +18 -132
- package/dist/react/features/chat-pane/components/ChatPane.d.ts +24 -2
- package/dist/react/features/chat-pane/components/ChatPane.js +45 -297
- package/dist/react/features/chat-pane/components/ChatPaneComposerArea.d.ts +33 -0
- package/dist/react/features/chat-pane/components/ChatPaneComposerArea.js +119 -0
- package/dist/react/features/chat-pane/components/ChatPaneLayout.d.ts +42 -0
- package/dist/react/features/chat-pane/components/ChatPaneLayout.js +54 -0
- package/dist/react/features/chat-pane/components/ChatPaneStatus.d.ts +27 -0
- package/dist/react/features/chat-pane/components/ChatPaneStatus.js +91 -0
- package/dist/react/features/chat-pane/components/RuntimeDropUp.d.ts +6 -1
- package/dist/react/features/chat-pane/components/RuntimeDropUp.js +20 -19
- package/dist/react/features/chat-pane/components/RuntimePickerSections.d.ts +62 -0
- package/dist/react/features/chat-pane/components/RuntimePickerSections.js +122 -0
- package/dist/react/features/chat-pane/create-mcp-ui-tool-caller.d.ts +1 -1
- package/dist/react/features/chat-pane/hooks/useChatPane.hooks.d.ts +5 -3
- package/dist/react/features/chat-pane/hooks/useChatPane.hooks.js +78 -26
- package/dist/react/features/chat-pane/hooks/useChatPaneAgentControl.hooks.js +6 -6
- package/dist/react/features/chat-pane/hooks/useChatPaneFileDrop.hooks.d.ts +5 -1
- package/dist/react/features/chat-pane/hooks/useChatPaneFileDrop.hooks.js +7 -7
- package/dist/react/features/chat-pane/hooks/useRuntimeDropUp.hooks.d.ts +7 -0
- package/dist/react/features/chat-pane/hooks/useRuntimeDropUp.hooks.js +5 -0
- package/dist/react/features/chat-pane/model-options.js +7 -4
- package/dist/react/features/chat-pane/styles.d.ts +1 -1
- package/dist/react/features/chat-pane/styles.js +25 -41
- package/dist/react/features/chat-pane/types.d.ts +29 -1
- package/dist/react/hooks/assistant-chats-contracts.d.ts +1 -1
- package/dist/react/hooks/attachment-preview-cache.d.ts +1 -1
- package/dist/react/hooks/attachment-preview-cache.js +1 -1
- package/dist/react/hooks/fab-position.js +16 -18
- package/dist/react/hooks/useConversation.d.ts +6 -1
- package/dist/react/hooks/useConversation.js +11 -10
- package/dist/react/hooks/useRunStream.d.ts +3 -0
- package/dist/react/hooks/useRunStream.js +12 -12
- package/dist/react/hooks/useSurfaceRecovery.d.ts +1 -1
- package/dist/react/hooks/useSurfaceRecovery.js +2 -2
- package/dist/react/index.d.ts +6 -3
- package/dist/react/index.js +5 -3
- package/dist/react/styles/chat-settings.css +9 -9
- package/dist/react/surfaces.d.ts +91 -0
- package/dist/react/surfaces.js +28 -0
- package/dist/server/durable-runs/recover.d.ts +4 -3
- package/dist/server/durable-runs/recover.js +4 -3
- package/dist/store/legacy/sqlite/conversations.d.ts +1 -2
- package/dist/store/legacy/sqlite/conversations.js +1 -1
- package/dist/store/legacy/sqlite/messages.d.ts +2 -3
- package/dist/store/legacy/sqlite/messages.js +6 -6
- package/dist/store/pglite/index.d.ts +7 -7
- package/dist/store/pglite/index.js +1 -1
- package/dist/store/ports.d.ts +5 -2
- package/dist/store/postgres/index.d.ts +7 -7
- package/dist/store/postgres/index.js +1 -1
- package/dist/store/runtime/chat-expiry-sweep.js +2 -4
- package/dist/store/runtime/chat-history-store.js +2 -3
- package/dist/store/runtime/durable-run-store.js +16 -2
- package/dist/store/runtime/history-tools.js +33 -11
- package/dist/store/runtime/kernel.d.ts +3 -2
- package/dist/store/runtime/run-ledger.js +2 -2
- package/dist/store/sql/boundary.d.ts +5 -5
- package/dist/store/sql/maintenance.d.ts +3 -2
- package/dist/store/sql/store.d.ts +16 -8
- package/dist/store/sql/store.js +31 -14
- package/dist/store/sqlite/index.d.ts +11 -12
- package/dist/store/sqlite/index.js +5 -5
- package/dist/store/sqlite/schema.d.ts +1 -1
- package/package.json +46 -24
- package/dist/core/ag-ui/entry.d.ts +0 -84
- package/dist/core/ag-ui/entry.js +0 -225
- package/dist/core/browser/page-actions.d.ts +0 -121
- package/dist/core/browser/page-actions.js +0 -113
- package/dist/embed-widget/browser/page-actions.d.ts +0 -2
- package/dist/embed-widget/browser/page-actions.js +0 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jini-ai/chat",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.3-next.1",
|
|
4
4
|
"description": "Jini's chat/artifact frontend, consolidated into one package with two subpaths: framework-free chat vocabulary and pure parsers in `/core`, headless hooks + presentational components + slots in `/react`. Import only the layer you need.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -27,12 +27,15 @@
|
|
|
27
27
|
"./store/legacy/sqlite": "node",
|
|
28
28
|
"./core/run-events": "universal",
|
|
29
29
|
"./core/ag-ui": "universal",
|
|
30
|
+
"./core/ag-ui/reduction": "universal",
|
|
31
|
+
"./server/ag-ui/run-input": "universal",
|
|
30
32
|
"./server/run-finalizer": "universal",
|
|
31
33
|
"./react/embed": "browser",
|
|
32
34
|
"./transports/fetch-sse": "universal",
|
|
33
35
|
"./transports/http": "universal",
|
|
34
36
|
"./transports/ag-ui": "universal",
|
|
35
37
|
"./browser/session-store": "browser",
|
|
38
|
+
"./browser/agent-inventory": "browser",
|
|
36
39
|
"./server/durable-runs": "node",
|
|
37
40
|
"./store/runtime": "node",
|
|
38
41
|
"./vanilla": "browser",
|
|
@@ -63,7 +66,6 @@
|
|
|
63
66
|
"@radix-ui/react-select": "opt-in: interactive ui controls; import @jini-ai/chat/react — Interactive UI controls could not load @radix-ui/react-select. Install @radix-ui/react-select to enable this feature, or check its installed version and native binaries.",
|
|
64
67
|
"@radix-ui/react-slot": "opt-in: interactive ui controls — Interactive UI controls could not load @radix-ui/react-slot. Install @radix-ui/react-slot to enable this feature, or check its installed version and native binaries.",
|
|
65
68
|
"@jini-ai/agent-runtime": "opt-in: agent execution adapters; import @jini-ai/chat/react — Agent execution adapters could not load @jini-ai/agent-runtime. Install @jini-ai/agent-runtime to enable this feature, or check its installed version and native binaries.",
|
|
66
|
-
"@jini-ai/protocol": "opt-in: agent protocol adapters; import @jini-ai/chat/server/durable-runs — Agent protocol adapters could not load @jini-ai/protocol. Install @jini-ai/protocol to enable this feature, or check its installed version and native binaries.",
|
|
67
69
|
"@jini-ai/ui": "opt-in: ui integrations; import @jini-ai/chat/react — UI integrations could not load @jini-ai/ui. Install @jini-ai/ui to enable this feature, or check its installed version and native binaries.",
|
|
68
70
|
"react": "opt-in: react chat ui; import @jini-ai/chat/react — React chat UI could not load react. Install react to enable this feature, or check its installed version.",
|
|
69
71
|
"react-dom": "opt-in: react chat ui; import @jini-ai/chat/react — React chat UI could not load react-dom. Install react-dom to enable this feature, or check its installed version."
|
|
@@ -134,9 +136,19 @@
|
|
|
134
136
|
"default": "./dist/core/run-events/entry.js"
|
|
135
137
|
},
|
|
136
138
|
"./core/ag-ui": {
|
|
137
|
-
"types": "./dist/core/ag-ui/
|
|
138
|
-
"import": "./dist/core/ag-ui/
|
|
139
|
-
"default": "./dist/core/ag-ui/
|
|
139
|
+
"types": "./dist/core/ag-ui/event-projection.d.ts",
|
|
140
|
+
"import": "./dist/core/ag-ui/event-projection.js",
|
|
141
|
+
"default": "./dist/core/ag-ui/event-projection.js"
|
|
142
|
+
},
|
|
143
|
+
"./core/ag-ui/reduction": {
|
|
144
|
+
"types": "./dist/core/ag-ui/event-reduction.d.ts",
|
|
145
|
+
"import": "./dist/core/ag-ui/event-reduction.js",
|
|
146
|
+
"default": "./dist/core/ag-ui/event-reduction.js"
|
|
147
|
+
},
|
|
148
|
+
"./server/ag-ui/run-input": {
|
|
149
|
+
"types": "./dist/core/ag-ui/run-input.d.ts",
|
|
150
|
+
"import": "./dist/core/ag-ui/run-input.js",
|
|
151
|
+
"default": "./dist/core/ag-ui/run-input.js"
|
|
140
152
|
},
|
|
141
153
|
"./server/run-finalizer": {
|
|
142
154
|
"types": "./dist/server/run-finalizer/entry.d.ts",
|
|
@@ -168,6 +180,11 @@
|
|
|
168
180
|
"import": "./dist/embed-widget/browser/session-store.js",
|
|
169
181
|
"default": "./dist/embed-widget/browser/session-store.js"
|
|
170
182
|
},
|
|
183
|
+
"./browser/agent-inventory": {
|
|
184
|
+
"types": "./dist/embed-widget/browser/agent-inventory.d.ts",
|
|
185
|
+
"import": "./dist/embed-widget/browser/agent-inventory.js",
|
|
186
|
+
"default": "./dist/embed-widget/browser/agent-inventory.js"
|
|
187
|
+
},
|
|
171
188
|
"./server/durable-runs": {
|
|
172
189
|
"types": "./dist/server/durable-runs/entry.d.ts",
|
|
173
190
|
"import": "./dist/server/durable-runs/entry.js",
|
|
@@ -216,10 +233,10 @@
|
|
|
216
233
|
},
|
|
217
234
|
"dependencies": {
|
|
218
235
|
"kysely": "^0.29.6",
|
|
219
|
-
"@jini-ai/core": "^0.7.
|
|
220
|
-
"@jini-ai/db": "^0.7.
|
|
221
|
-
"@jini-ai/diagnostics": "^0.7.
|
|
222
|
-
"@jini-ai/
|
|
236
|
+
"@jini-ai/core": "^0.7.3-next.1",
|
|
237
|
+
"@jini-ai/db": "^0.7.3-next.1",
|
|
238
|
+
"@jini-ai/diagnostics": "^0.7.3-next.1",
|
|
239
|
+
"@jini-ai/protocol": "^0.7.3-next.1"
|
|
223
240
|
},
|
|
224
241
|
"peerDependencies": {
|
|
225
242
|
"react": "^18.3.0 || ^19.0.0",
|
|
@@ -234,9 +251,8 @@
|
|
|
234
251
|
"@radix-ui/react-radio-group": "^1.4.7",
|
|
235
252
|
"@radix-ui/react-select": "^2.3.7",
|
|
236
253
|
"@radix-ui/react-slot": "^1.3.3",
|
|
237
|
-
"@jini-ai/agent-runtime": "^0.7.
|
|
238
|
-
"@jini-ai/
|
|
239
|
-
"@jini-ai/ui": "^0.7.0"
|
|
254
|
+
"@jini-ai/agent-runtime": "^0.7.3-next.1",
|
|
255
|
+
"@jini-ai/ui": "^0.7.3-next.1"
|
|
240
256
|
},
|
|
241
257
|
"devDependencies": {
|
|
242
258
|
"@mcp-ui/client": "7.1.1",
|
|
@@ -263,14 +279,14 @@
|
|
|
263
279
|
"pg": "8.23.0",
|
|
264
280
|
"@ag-ui/core": "0.0.58",
|
|
265
281
|
"fast-check": "4.3.0",
|
|
266
|
-
"@jini-ai/
|
|
267
|
-
"@jini-ai/db": "0.7.
|
|
268
|
-
"@jini-ai/
|
|
269
|
-
"@jini-ai/
|
|
270
|
-
"@jini-ai/
|
|
271
|
-
"@jini-ai/
|
|
272
|
-
"@jini-ai/diagnostics": "^0.7.
|
|
273
|
-
"@jini-ai/
|
|
282
|
+
"@jini-ai/ui-kit": "^0.7.3-next.1",
|
|
283
|
+
"@jini-ai/db": "0.7.3-next.1",
|
|
284
|
+
"@jini-ai/agent-runtime": "0.7.3-next.1",
|
|
285
|
+
"@jini-ai/ui": "^0.7.3-next.1",
|
|
286
|
+
"@jini-ai/agentic": "^0.7.3-next.1",
|
|
287
|
+
"@jini-ai/core": "^0.7.3-next.1",
|
|
288
|
+
"@jini-ai/diagnostics": "^0.7.3-next.1",
|
|
289
|
+
"@jini-ai/protocol": "^0.7.3-next.1"
|
|
274
290
|
},
|
|
275
291
|
"typesVersions": {
|
|
276
292
|
"*": {
|
|
@@ -302,7 +318,13 @@
|
|
|
302
318
|
"./dist/core/run-events/entry.d.ts"
|
|
303
319
|
],
|
|
304
320
|
"core/ag-ui": [
|
|
305
|
-
"./dist/core/ag-ui/
|
|
321
|
+
"./dist/core/ag-ui/event-projection.d.ts"
|
|
322
|
+
],
|
|
323
|
+
"core/ag-ui/reduction": [
|
|
324
|
+
"./dist/core/ag-ui/event-reduction.d.ts"
|
|
325
|
+
],
|
|
326
|
+
"server/ag-ui/run-input": [
|
|
327
|
+
"./dist/core/ag-ui/run-input.d.ts"
|
|
306
328
|
],
|
|
307
329
|
"server/run-finalizer": [
|
|
308
330
|
"./dist/server/run-finalizer/entry.d.ts"
|
|
@@ -322,6 +344,9 @@
|
|
|
322
344
|
"browser/session-store": [
|
|
323
345
|
"./dist/embed-widget/browser/session-store.d.ts"
|
|
324
346
|
],
|
|
347
|
+
"browser/agent-inventory": [
|
|
348
|
+
"./dist/embed-widget/browser/agent-inventory.d.ts"
|
|
349
|
+
],
|
|
325
350
|
"server/durable-runs": [
|
|
326
351
|
"./dist/server/durable-runs/entry.d.ts"
|
|
327
352
|
],
|
|
@@ -373,9 +398,6 @@
|
|
|
373
398
|
"@jini-ai/agent-runtime": {
|
|
374
399
|
"optional": true
|
|
375
400
|
},
|
|
376
|
-
"@jini-ai/protocol": {
|
|
377
|
-
"optional": true
|
|
378
|
-
},
|
|
379
401
|
"@jini-ai/ui": {
|
|
380
402
|
"optional": true
|
|
381
403
|
},
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
/** Pure chat-event to AG-UI projection; lifecycle state belongs to one run.
|
|
2
|
-
* This legacy wire reducer is independent of saved-chat reduction: partial tool input remains
|
|
3
|
-
* a CUSTOM extension, while media stays in run-event vocabulary and is absent from TOOL_CALL_RESULT.
|
|
4
|
-
* Strict interruption ordering closes a message before a tool starts. IDs and custom event names
|
|
5
|
-
* are injected, with official AG-UI types authoritative; auth, routes and encoder stay with the host.
|
|
6
|
-
* The host emits RUN_STARTED and terminal RUN_FINISHED/RUN_ERROR outside this pure projection. */
|
|
7
|
-
import { EventType, type AGUIEvent } from '@ag-ui/core';
|
|
8
|
-
import type { AgentEvent } from '../events.js';
|
|
9
|
-
export interface EventIdGenerator {
|
|
10
|
-
next(args: {
|
|
11
|
-
prefix: string;
|
|
12
|
-
ordinal: number;
|
|
13
|
-
}): string;
|
|
14
|
-
}
|
|
15
|
-
export interface CustomEventNames {
|
|
16
|
-
readonly usage: string;
|
|
17
|
-
readonly status: string;
|
|
18
|
-
readonly extensionPrefix: string;
|
|
19
|
-
}
|
|
20
|
-
export interface RunAgentWirePayload {
|
|
21
|
-
readonly type: string;
|
|
22
|
-
readonly [key: string]: unknown;
|
|
23
|
-
}
|
|
24
|
-
/** Preserve the legacy AG-UI wire reduction, including partial input as extension events.
|
|
25
|
-
* Unlike the saved-chat reducer, this projection carries partial tool-input extensions. */
|
|
26
|
-
export declare function reduceAgentWirePayload({ payload }: {
|
|
27
|
-
payload: RunAgentWirePayload;
|
|
28
|
-
}): AgentEvent | null;
|
|
29
|
-
export type AgUiEvent = Extract<AGUIEvent, {
|
|
30
|
-
type: EventType.RUN_STARTED | EventType.RUN_FINISHED | EventType.RUN_ERROR | EventType.TEXT_MESSAGE_START | EventType.TEXT_MESSAGE_CONTENT | EventType.TEXT_MESSAGE_END | EventType.REASONING_START | EventType.REASONING_MESSAGE_START | EventType.REASONING_MESSAGE_CONTENT | EventType.REASONING_MESSAGE_END | EventType.REASONING_END | EventType.TOOL_CALL_START | EventType.TOOL_CALL_ARGS | EventType.TOOL_CALL_END | EventType.TOOL_CALL_RESULT | EventType.RAW | EventType.CUSTOM;
|
|
31
|
-
}>;
|
|
32
|
-
export interface AgUiTranslationState {
|
|
33
|
-
openTextMessageId: string | null;
|
|
34
|
-
openReasoningMessageId: string | null;
|
|
35
|
-
nextId: number;
|
|
36
|
-
readonly ids: EventIdGenerator;
|
|
37
|
-
readonly customEventNames: CustomEventNames;
|
|
38
|
-
}
|
|
39
|
-
/** Create isolated per-run translation state with explicit IDs and custom-event wire names. */
|
|
40
|
-
export declare function createAgUiTranslationState({ ids, customEventNames }: {
|
|
41
|
-
ids: EventIdGenerator;
|
|
42
|
-
customEventNames: CustomEventNames;
|
|
43
|
-
}): AgUiTranslationState;
|
|
44
|
-
/** Emit ordered message/tool lifecycles; a tool call closes the preceding message first. */
|
|
45
|
-
export declare function translateAgentEventToAgUi({ event, state }: {
|
|
46
|
-
event: AgentEvent;
|
|
47
|
-
state: AgUiTranslationState;
|
|
48
|
-
}): AgUiEvent[];
|
|
49
|
-
/** Close open text/reasoning before the host emits RUN_FINISHED or RUN_ERROR. */
|
|
50
|
-
export declare function closeAgUiRun({ state }: {
|
|
51
|
-
state: AgUiTranslationState;
|
|
52
|
-
}): AgUiEvent[];
|
|
53
|
-
/**
|
|
54
|
-
* Accumulates `TOOL_CALL_ARGS` deltas by `toolCallId` between a call's `TOOL_CALL_START` and
|
|
55
|
-
* `TOOL_CALL_END` — the inverse of `assistant-ag-ui.ts`'s server-side translator, which emits all
|
|
56
|
-
* three tool-call events back-to-back for one chat `tool_use` event today, but this side is written
|
|
57
|
-
* to accumulate real streamed deltas too (a future daemon driver that streams `tool_input_delta`
|
|
58
|
-
* incrementally needs no transport-layer change to render correctly). One instance per run, NOT a
|
|
59
|
-
* module-level singleton — the same reasoning `assistant-ag-ui.ts`'s `AgUiTranslationState` gives.
|
|
60
|
-
*/
|
|
61
|
-
export interface AgUiToAgentTranslationState {
|
|
62
|
-
toolCalls: Map<string, {
|
|
63
|
-
name: string;
|
|
64
|
-
argsJson: string;
|
|
65
|
-
}>;
|
|
66
|
-
readonly customEventNames: CustomEventNames;
|
|
67
|
-
}
|
|
68
|
-
export declare function createAgUiToAgentTranslationState({ customEventNames }: {
|
|
69
|
-
customEventNames: CustomEventNames;
|
|
70
|
-
}, _options?: Record<string, never>): AgUiToAgentTranslationState;
|
|
71
|
-
/**
|
|
72
|
-
* Translates one AG-UI event into zero or more chat-core `AgentEvent`s, threading `state` across
|
|
73
|
-
* calls within a single run for tool-call argument accumulation.
|
|
74
|
-
*
|
|
75
|
-
* `TEXT_MESSAGE_START` preserves an explicit step boundary so two assistant messages cannot fuse
|
|
76
|
-
* into one word. End/reasoning markers carry no text. The two cases
|
|
77
|
-
* with real internal branching (`TOOL_CALL_END`, `CUSTOM`) and the one with a guard (`TOOL_CALL_ARGS`)
|
|
78
|
-
* are pulled into their own named functions above so this switch's own cost is just its case count.
|
|
79
|
-
*/
|
|
80
|
-
export declare function translateAgUiEventToAgentEvent({ event, state }: {
|
|
81
|
-
event: AgUiEvent;
|
|
82
|
-
state: AgUiToAgentTranslationState;
|
|
83
|
-
}, _options?: Record<string, never>): AgentEvent[];
|
|
84
|
-
//# sourceMappingURL=entry.d.ts.map
|
package/dist/core/ag-ui/entry.js
DELETED
|
@@ -1,225 +0,0 @@
|
|
|
1
|
-
/** Pure chat-event to AG-UI projection; lifecycle state belongs to one run.
|
|
2
|
-
* This legacy wire reducer is independent of saved-chat reduction: partial tool input remains
|
|
3
|
-
* a CUSTOM extension, while media stays in run-event vocabulary and is absent from TOOL_CALL_RESULT.
|
|
4
|
-
* Strict interruption ordering closes a message before a tool starts. IDs and custom event names
|
|
5
|
-
* are injected, with official AG-UI types authoritative; auth, routes and encoder stay with the host.
|
|
6
|
-
* The host emits RUN_STARTED and terminal RUN_FINISHED/RUN_ERROR outside this pure projection. */
|
|
7
|
-
import { EventType } from '@ag-ui/core';
|
|
8
|
-
function asString(v) {
|
|
9
|
-
if (typeof v === "string")
|
|
10
|
-
return v;
|
|
11
|
-
return v == null ? "" : JSON.stringify(v);
|
|
12
|
-
}
|
|
13
|
-
function reduceUsagePayload(payload) {
|
|
14
|
-
const usage = (payload.usage ?? {});
|
|
15
|
-
return {
|
|
16
|
-
kind: "usage",
|
|
17
|
-
...(typeof usage.input_tokens === "number" ? { inputTokens: usage.input_tokens } : {}),
|
|
18
|
-
...(typeof usage.output_tokens === "number" ? { outputTokens: usage.output_tokens } : {}),
|
|
19
|
-
...(typeof payload.costUsd === "number" ? { costUsd: payload.costUsd } : {}),
|
|
20
|
-
...(typeof payload.cumulativeCostUsd === "number" ? { cumulativeCostUsd: payload.cumulativeCostUsd } : {}),
|
|
21
|
-
...(typeof payload.costSessionId === "string" ? { costSessionId: payload.costSessionId } : {}),
|
|
22
|
-
...(typeof payload.durationMs === "number" ? { durationMs: payload.durationMs } : {}),
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
const WIRE_PAYLOAD_REDUCERS = {
|
|
26
|
-
status: (payload) => ({ kind: "status", label: asString(payload.label), ...(payload.detail ? { detail: asString(payload.detail) } : {}) }),
|
|
27
|
-
text_delta: (payload) => ({ kind: "text", text: asString(payload.delta) }),
|
|
28
|
-
thinking_delta: (payload) => ({ kind: "thinking", text: asString(payload.delta) }),
|
|
29
|
-
tool_use: (payload) => ({ kind: "tool_use", id: asString(payload.id), name: asString(payload.name), input: payload.input }),
|
|
30
|
-
tool_result: (payload) => ({
|
|
31
|
-
kind: "tool_result",
|
|
32
|
-
toolUseId: asString(payload.toolUseId),
|
|
33
|
-
content: asString(payload.content),
|
|
34
|
-
isError: Boolean(payload.isError),
|
|
35
|
-
}),
|
|
36
|
-
usage: reduceUsagePayload,
|
|
37
|
-
raw: (payload) => ({ kind: "raw", line: asString(payload.line) }),
|
|
38
|
-
"mcp-ui": (payload) => ({ kind: "ext", name: "mcp-ui", data: payload.resource }),
|
|
39
|
-
a2ui: (payload) => ({ kind: "ext", name: "a2ui", data: payload.message }),
|
|
40
|
-
thinking_start: () => null,
|
|
41
|
-
};
|
|
42
|
-
/** Preserve the legacy AG-UI wire reduction, including partial input as extension events.
|
|
43
|
-
* Unlike the saved-chat reducer, this projection carries partial tool-input extensions. */
|
|
44
|
-
export function reduceAgentWirePayload({ payload }) {
|
|
45
|
-
const reducer = Object.hasOwn(WIRE_PAYLOAD_REDUCERS, payload.type) ? WIRE_PAYLOAD_REDUCERS[payload.type] : undefined;
|
|
46
|
-
return reducer ? reducer(payload) : { kind: "ext", name: payload.type, data: payload };
|
|
47
|
-
}
|
|
48
|
-
/** Create isolated per-run translation state with explicit IDs and custom-event wire names. */
|
|
49
|
-
export function createAgUiTranslationState({ ids, customEventNames }) {
|
|
50
|
-
return { openTextMessageId: null, openReasoningMessageId: null, nextId: 0, ids, customEventNames: { ...customEventNames } };
|
|
51
|
-
}
|
|
52
|
-
function mintId(state, prefix) {
|
|
53
|
-
state.nextId += 1;
|
|
54
|
-
return state.ids.next({ prefix, ordinal: state.nextId });
|
|
55
|
-
}
|
|
56
|
-
function closeOpenMessages(state) {
|
|
57
|
-
const events = [];
|
|
58
|
-
if (state.openTextMessageId) {
|
|
59
|
-
events.push({ type: EventType.TEXT_MESSAGE_END, messageId: state.openTextMessageId });
|
|
60
|
-
state.openTextMessageId = null;
|
|
61
|
-
}
|
|
62
|
-
if (state.openReasoningMessageId) {
|
|
63
|
-
const messageId = state.openReasoningMessageId;
|
|
64
|
-
events.push({ type: EventType.REASONING_MESSAGE_END, messageId });
|
|
65
|
-
events.push({ type: EventType.REASONING_END, messageId });
|
|
66
|
-
state.openReasoningMessageId = null;
|
|
67
|
-
}
|
|
68
|
-
return events;
|
|
69
|
-
}
|
|
70
|
-
function handleTextAgentEvent(event, state) {
|
|
71
|
-
const events = [];
|
|
72
|
-
if (state.openReasoningMessageId)
|
|
73
|
-
events.push(...closeOpenMessages(state));
|
|
74
|
-
if (!state.openTextMessageId) {
|
|
75
|
-
state.openTextMessageId = mintId(state, "msg");
|
|
76
|
-
events.push({ type: EventType.TEXT_MESSAGE_START, messageId: state.openTextMessageId, role: "assistant" });
|
|
77
|
-
}
|
|
78
|
-
events.push({ type: EventType.TEXT_MESSAGE_CONTENT, messageId: state.openTextMessageId, delta: event.text });
|
|
79
|
-
return events;
|
|
80
|
-
}
|
|
81
|
-
function handleThinkingAgentEvent(event, state) {
|
|
82
|
-
const events = [];
|
|
83
|
-
if (state.openTextMessageId)
|
|
84
|
-
events.push(...closeOpenMessages(state));
|
|
85
|
-
if (!state.openReasoningMessageId) {
|
|
86
|
-
state.openReasoningMessageId = mintId(state, "reasoning");
|
|
87
|
-
events.push({ type: EventType.REASONING_START, messageId: state.openReasoningMessageId });
|
|
88
|
-
events.push({ type: EventType.REASONING_MESSAGE_START, messageId: state.openReasoningMessageId, role: "reasoning" });
|
|
89
|
-
}
|
|
90
|
-
events.push({ type: EventType.REASONING_MESSAGE_CONTENT, messageId: state.openReasoningMessageId, delta: event.text });
|
|
91
|
-
return events;
|
|
92
|
-
}
|
|
93
|
-
function handleToolUseAgentEvent(event, state) {
|
|
94
|
-
const events = [];
|
|
95
|
-
if (state.openTextMessageId || state.openReasoningMessageId)
|
|
96
|
-
events.push(...closeOpenMessages(state));
|
|
97
|
-
events.push({ type: EventType.TOOL_CALL_START, toolCallId: event.id, toolCallName: event.name });
|
|
98
|
-
events.push({ type: EventType.TOOL_CALL_ARGS, toolCallId: event.id, delta: JSON.stringify(event.input ?? {}) });
|
|
99
|
-
events.push({ type: EventType.TOOL_CALL_END, toolCallId: event.id });
|
|
100
|
-
return events;
|
|
101
|
-
}
|
|
102
|
-
/** Emit ordered message/tool lifecycles; a tool call closes the preceding message first. */
|
|
103
|
-
export function translateAgentEventToAgUi({ event, state }) {
|
|
104
|
-
switch (event.kind) {
|
|
105
|
-
case "text":
|
|
106
|
-
return handleTextAgentEvent(event, state);
|
|
107
|
-
case "thinking":
|
|
108
|
-
return handleThinkingAgentEvent(event, state);
|
|
109
|
-
case "tool_use":
|
|
110
|
-
return handleToolUseAgentEvent(event, state);
|
|
111
|
-
case "tool_result":
|
|
112
|
-
return [
|
|
113
|
-
{
|
|
114
|
-
type: EventType.TOOL_CALL_RESULT,
|
|
115
|
-
messageId: mintId(state, "tool_result_msg"),
|
|
116
|
-
toolCallId: event.toolUseId,
|
|
117
|
-
content: event.content,
|
|
118
|
-
role: "tool",
|
|
119
|
-
},
|
|
120
|
-
];
|
|
121
|
-
case "usage":
|
|
122
|
-
return [{ type: EventType.CUSTOM, name: state.customEventNames.usage, value: event }];
|
|
123
|
-
case "status":
|
|
124
|
-
return [{ type: EventType.CUSTOM, name: state.customEventNames.status, value: event }];
|
|
125
|
-
case "raw":
|
|
126
|
-
return [{ type: EventType.RAW, event: event.line }];
|
|
127
|
-
case "ext":
|
|
128
|
-
return [{ type: EventType.CUSTOM, name: `${state.customEventNames.extensionPrefix}${event.name}`, value: event.data }];
|
|
129
|
-
default: {
|
|
130
|
-
const neverEvent = event;
|
|
131
|
-
throw new Error(`translateAgentEventToAgUi: unhandled AgentEvent.kind ${JSON.stringify(neverEvent)}`);
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
/** Close open text/reasoning before the host emits RUN_FINISHED or RUN_ERROR. */
|
|
136
|
-
export function closeAgUiRun({ state }) {
|
|
137
|
-
return closeOpenMessages(state);
|
|
138
|
-
}
|
|
139
|
-
export function createAgUiToAgentTranslationState({ customEventNames }, _options = {}) {
|
|
140
|
-
return { toolCalls: new Map(), customEventNames: { ...customEventNames } };
|
|
141
|
-
}
|
|
142
|
-
/** The `TOOL_CALL_ARGS` case of {@link translateAgUiEventToAgentEvent} — accumulates one delta onto
|
|
143
|
-
* the in-flight call's buffer, a silent no-op for an id with no matching `TOOL_CALL_START`. Split
|
|
144
|
-
* out so this `if` is scored in its own complexity budget rather than the switch's. */
|
|
145
|
-
function accumulateToolCallArgs(toolCallId, delta, state) {
|
|
146
|
-
const call = state.toolCalls.get(toolCallId);
|
|
147
|
-
if (call)
|
|
148
|
-
call.argsJson += delta;
|
|
149
|
-
}
|
|
150
|
-
/** `TEXT_MESSAGE_START` keeps an explicit step boundary so two assistant messages cannot fuse into
|
|
151
|
-
* one word; every other unmapped event translates to nothing. Split out so this `if` is scored in
|
|
152
|
-
* its own complexity budget rather than the switch's. */
|
|
153
|
-
function translateAgUiStepStart({ event }, _options = {}) {
|
|
154
|
-
if (event.type !== EventType.TEXT_MESSAGE_START)
|
|
155
|
-
return [];
|
|
156
|
-
return [{ kind: 'status', code: 'step_start', label: '', data: { messageId: event.messageId } }];
|
|
157
|
-
}
|
|
158
|
-
/** The `TOOL_CALL_END` case of {@link translateAgUiEventToAgentEvent} — parses the accumulated
|
|
159
|
-
* args buffer (already removed from `state` by the caller) into one `tool_use` event, or `[]` for
|
|
160
|
-
* an id with no matching `TOOL_CALL_START`. */
|
|
161
|
-
function finalizeToolCallAgentEvent(toolCallId, call) {
|
|
162
|
-
if (!call)
|
|
163
|
-
return [];
|
|
164
|
-
let input = {};
|
|
165
|
-
try {
|
|
166
|
-
input = call.argsJson.length > 0 ? JSON.parse(call.argsJson) : {};
|
|
167
|
-
}
|
|
168
|
-
catch {
|
|
169
|
-
// A malformed/partial args buffer must not throw and drop the whole tool call — the raw
|
|
170
|
-
// string is still more useful to a human than nothing.
|
|
171
|
-
input = call.argsJson;
|
|
172
|
-
}
|
|
173
|
-
return [{ kind: "tool_use", id: toolCallId, name: call.name, input }];
|
|
174
|
-
}
|
|
175
|
-
/** The `CUSTOM` case of {@link translateAgUiEventToAgentEvent}. */
|
|
176
|
-
function translateAgUiCustomEvent(event, names) {
|
|
177
|
-
// Host-supplied usage/status names: the server's own translator put the ORIGINAL `AgentEvent`
|
|
178
|
-
// straight into `.value` (see `assistant-ag-ui.ts`'s `translateAgentEventToAgUi`), so this is
|
|
179
|
-
// an exact round trip, not a re-derivation.
|
|
180
|
-
if (event.name === names.usage || event.name === names.status)
|
|
181
|
-
return [event.value];
|
|
182
|
-
if (event.name.startsWith(names.extensionPrefix))
|
|
183
|
-
return [{ kind: "ext", name: event.name.slice(names.extensionPrefix.length), data: event.value }];
|
|
184
|
-
return [{ kind: "ext", name: event.name, data: event.value }];
|
|
185
|
-
}
|
|
186
|
-
/**
|
|
187
|
-
* Translates one AG-UI event into zero or more chat-core `AgentEvent`s, threading `state` across
|
|
188
|
-
* calls within a single run for tool-call argument accumulation.
|
|
189
|
-
*
|
|
190
|
-
* `TEXT_MESSAGE_START` preserves an explicit step boundary so two assistant messages cannot fuse
|
|
191
|
-
* into one word. End/reasoning markers carry no text. The two cases
|
|
192
|
-
* with real internal branching (`TOOL_CALL_END`, `CUSTOM`) and the one with a guard (`TOOL_CALL_ARGS`)
|
|
193
|
-
* are pulled into their own named functions above so this switch's own cost is just its case count.
|
|
194
|
-
*/
|
|
195
|
-
export function translateAgUiEventToAgentEvent({ event, state }, _options = {}) {
|
|
196
|
-
switch (event.type) {
|
|
197
|
-
case EventType.TEXT_MESSAGE_CONTENT:
|
|
198
|
-
return [{ kind: "text", text: event.delta }];
|
|
199
|
-
case EventType.REASONING_MESSAGE_CONTENT:
|
|
200
|
-
return [{ kind: "thinking", text: event.delta }];
|
|
201
|
-
case EventType.TOOL_CALL_START:
|
|
202
|
-
state.toolCalls.set(event.toolCallId, { name: event.toolCallName, argsJson: "" });
|
|
203
|
-
return [];
|
|
204
|
-
case EventType.TOOL_CALL_ARGS:
|
|
205
|
-
accumulateToolCallArgs(event.toolCallId, event.delta, state);
|
|
206
|
-
return [];
|
|
207
|
-
case EventType.TOOL_CALL_END: {
|
|
208
|
-
const call = state.toolCalls.get(event.toolCallId);
|
|
209
|
-
state.toolCalls.delete(event.toolCallId);
|
|
210
|
-
return finalizeToolCallAgentEvent(event.toolCallId, call);
|
|
211
|
-
}
|
|
212
|
-
case EventType.TOOL_CALL_RESULT:
|
|
213
|
-
// AG-UI's `ToolCallResultEvent` carries no `isError` field (verified against the real schema)
|
|
214
|
-
// — a genuine protocol-level fidelity gap, not a translator bug: chat's `isError` flag cannot
|
|
215
|
-
// survive the round trip through AG-UI's wire shape, so it always reconstructs as `false`.
|
|
216
|
-
return [{ kind: "tool_result", toolUseId: event.toolCallId, content: event.content, isError: false }];
|
|
217
|
-
case EventType.RAW:
|
|
218
|
-
return [{ kind: "raw", line: asString(event.event) }];
|
|
219
|
-
case EventType.CUSTOM:
|
|
220
|
-
return translateAgUiCustomEvent(event, state.customEventNames);
|
|
221
|
-
default:
|
|
222
|
-
return translateAgUiStepStart({ event });
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
//# sourceMappingURL=entry.js.map
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
/** Resolved target supplied by the host; the client never derives a path from a title. */
|
|
2
|
-
export interface ResolvedPageTarget {
|
|
3
|
-
readonly slug: string;
|
|
4
|
-
readonly title: string;
|
|
5
|
-
readonly path: string;
|
|
6
|
-
}
|
|
7
|
-
export type PageAction = {
|
|
8
|
-
readonly type: 'navigate';
|
|
9
|
-
readonly target: ResolvedPageTarget;
|
|
10
|
-
readonly auto: boolean;
|
|
11
|
-
} | {
|
|
12
|
-
readonly type: 'scroll_to' | 'highlight';
|
|
13
|
-
readonly target: ResolvedPageTarget;
|
|
14
|
-
};
|
|
15
|
-
export type NavigateAction = Extract<PageAction, {
|
|
16
|
-
type: 'navigate';
|
|
17
|
-
}>;
|
|
18
|
-
export type NonNavigateAction = Exclude<PageAction, {
|
|
19
|
-
type: 'navigate';
|
|
20
|
-
}>;
|
|
21
|
-
export interface DirectiveCarryingEvent {
|
|
22
|
-
readonly kind: string;
|
|
23
|
-
readonly name?: string;
|
|
24
|
-
readonly data?: unknown;
|
|
25
|
-
}
|
|
26
|
-
export interface SplitPageActions {
|
|
27
|
-
readonly navigate: NavigateAction | null;
|
|
28
|
-
readonly other: NonNavigateAction | null;
|
|
29
|
-
}
|
|
30
|
-
/** Narrows an untrusted, bare queued action. URL authorization remains a separate host policy. O(1). */
|
|
31
|
-
export declare function isQueuedPageAction(args: {
|
|
32
|
-
value: unknown;
|
|
33
|
-
}): args is {
|
|
34
|
-
value: PageAction;
|
|
35
|
-
};
|
|
36
|
-
/** Narrows an untrusted directive envelope, dropping unknown kinds. O(1). */
|
|
37
|
-
export declare function isPageActionDirective(args: {
|
|
38
|
-
value: unknown;
|
|
39
|
-
}): args is {
|
|
40
|
-
value: {
|
|
41
|
-
kind: 'page_action';
|
|
42
|
-
action: PageAction;
|
|
43
|
-
};
|
|
44
|
-
};
|
|
45
|
-
/** Preserves valid action order while ignoring unrelated events. O(events) time and output space. */
|
|
46
|
-
export declare function extractPageActions({ events, directiveEventName }: {
|
|
47
|
-
events: readonly DirectiveCarryingEvent[] | undefined;
|
|
48
|
-
directiveEventName: string;
|
|
49
|
-
}): PageAction[];
|
|
50
|
-
/** Returns only the first navigation and first page treatment. O(actions), O(1) extra space. */
|
|
51
|
-
export declare function splitPageActions({ actions }: {
|
|
52
|
-
actions: readonly PageAction[];
|
|
53
|
-
}): SplitPageActions;
|
|
54
|
-
export interface TargetSelectionPolicy {
|
|
55
|
-
readonly candidateSelector: string;
|
|
56
|
-
readonly excludedAncestorSelector: string;
|
|
57
|
-
}
|
|
58
|
-
/** Exact title match first, case-insensitive fallback; never searches excluded UI. O(candidates). */
|
|
59
|
-
export declare function findTargetElement({ title, root, selection }: {
|
|
60
|
-
title: string;
|
|
61
|
-
root: Pick<ParentNode, 'querySelectorAll'>;
|
|
62
|
-
selection: TargetSelectionPolicy;
|
|
63
|
-
}): Element | null;
|
|
64
|
-
export interface PageActionTimerPort {
|
|
65
|
-
schedule(args: {
|
|
66
|
-
callback: () => void;
|
|
67
|
-
delayMs: number;
|
|
68
|
-
}): unknown;
|
|
69
|
-
cancel(args: {
|
|
70
|
-
handle: unknown;
|
|
71
|
-
}): void;
|
|
72
|
-
}
|
|
73
|
-
export interface PageActionPort {
|
|
74
|
-
allows(args: {
|
|
75
|
-
action: PageAction;
|
|
76
|
-
}): boolean;
|
|
77
|
-
navigate(args: {
|
|
78
|
-
action: NavigateAction;
|
|
79
|
-
}): boolean;
|
|
80
|
-
execute(args: {
|
|
81
|
-
action: NonNavigateAction;
|
|
82
|
-
}): boolean;
|
|
83
|
-
clearHighlight(args: Record<string, never>): void;
|
|
84
|
-
}
|
|
85
|
-
export interface BrowserPageActionController extends PageActionPort {
|
|
86
|
-
applyHighlight(args: {
|
|
87
|
-
element: Element;
|
|
88
|
-
}): void;
|
|
89
|
-
scrollToElement(args: {
|
|
90
|
-
element: Element;
|
|
91
|
-
}): void;
|
|
92
|
-
}
|
|
93
|
-
export interface BrowserPageActionsArgs {
|
|
94
|
-
readonly root: Pick<ParentNode, 'querySelectorAll'>;
|
|
95
|
-
readonly selection: TargetSelectionPolicy;
|
|
96
|
-
readonly allowPath: (args: {
|
|
97
|
-
path: string;
|
|
98
|
-
}) => boolean;
|
|
99
|
-
readonly navigate: (args: {
|
|
100
|
-
path: string;
|
|
101
|
-
}) => void;
|
|
102
|
-
readonly reducedMotion: (args: Record<string, never>) => boolean;
|
|
103
|
-
readonly scroll: (args: {
|
|
104
|
-
element: Element;
|
|
105
|
-
options: ScrollIntoViewOptions;
|
|
106
|
-
}) => void;
|
|
107
|
-
readonly timers: PageActionTimerPort;
|
|
108
|
-
readonly highlightClass: string;
|
|
109
|
-
readonly fadeAnimationName: string;
|
|
110
|
-
readonly cleanupFallbackMs: number;
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* Creates page effects with injected DOM, navigation, URL policy, scroll and timers.
|
|
114
|
-
* At most one highlight belongs to this instance; cleanup and navigation remove it.
|
|
115
|
-
* URL policy is checked before queueing, navigation or page effects. Stale timers and descendant
|
|
116
|
-
* animation events cannot remove the current highlight. Navigation paths are resolved by the host,
|
|
117
|
-
* never guessed from a title; each controller owns its mutable highlight state.
|
|
118
|
-
* @complexity Execute O(candidates); other operations O(1), with one timer/listener retained.
|
|
119
|
-
*/
|
|
120
|
-
export declare function createBrowserPageActions(args: BrowserPageActionsArgs): BrowserPageActionController;
|
|
121
|
-
//# sourceMappingURL=page-actions.d.ts.map
|