@mgamadeus/ddd-agents 0.11.12 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +138 -6
- package/boundary.json +5 -0
- package/dist/admin.js +13712 -0
- package/dist/admin.js.map +1 -0
- package/dist/chat.js +1627 -109
- package/dist/chat.js.map +1 -1
- package/dist/chunks/{AgentsConversationClientContext-C4T7g_Qk.js → AgentsConversationClientContext-B_UJSLXU.js} +2 -2
- package/dist/chunks/{AgentsConversationClientContext-C4T7g_Qk.js.map → AgentsConversationClientContext-B_UJSLXU.js.map} +1 -1
- package/dist/chunks/{ConversationMarkdown-D-aP3Ssl.js → ConversationMarkdown-DlvwT3Qk.js} +5 -4
- package/dist/chunks/{ConversationMarkdown-D-aP3Ssl.js.map → ConversationMarkdown-DlvwT3Qk.js.map} +1 -1
- package/dist/chunks/{ConversationMessageInputComposerWidgets-7HNAmZE1.js → ConversationMessageInputComposerWidgets-TchR1lPj.js} +6 -6
- package/dist/chunks/{ConversationMessageInputComposerWidgets-7HNAmZE1.js.map → ConversationMessageInputComposerWidgets-TchR1lPj.js.map} +1 -1
- package/dist/chunks/{VoiceBarsIcon-FhLAcgLG.js → VoiceBarsIcon-y3mgSqbn.js} +4 -4
- package/dist/chunks/{VoiceBarsIcon-FhLAcgLG.js.map → VoiceBarsIcon-y3mgSqbn.js.map} +1 -1
- package/dist/chunks/{WebSearchResultsConversationWidget-dEq19U7k.js → WebSearchResultsConversationWidget-l9Aek_lG.js} +3 -2
- package/dist/chunks/WebSearchResultsConversationWidget-l9Aek_lG.js.map +1 -0
- package/dist/chunks/agents-http-trace-mappers-LWNi-3a4.js +759 -0
- package/dist/chunks/agents-http-trace-mappers-LWNi-3a4.js.map +1 -0
- package/dist/chunks/{browser-request-interception-ydNOzeUL.js → browser-request-interception-D678IemW.js} +2 -2
- package/dist/chunks/{browser-request-interception-ydNOzeUL.js.map → browser-request-interception-D678IemW.js.map} +1 -1
- package/dist/chunks/{canvas-reducers-BInd3xNz.js → canvas-reducers-BYArW_Ji.js} +2 -2
- package/dist/chunks/{canvas-reducers-BInd3xNz.js.map → canvas-reducers-BYArW_Ji.js.map} +1 -1
- package/dist/chunks/{canvas-title-slot-context-BI1PLnPn.js → canvas-title-slot-context-BRGnFzYP.js} +3 -3
- package/dist/chunks/{canvas-title-slot-context-BI1PLnPn.js.map → canvas-title-slot-context-BRGnFzYP.js.map} +1 -1
- package/dist/chunks/{canvasBodies-CRVh8pCw.js → canvasBodies-BjXypuHf.js} +4 -4
- package/dist/chunks/{canvasBodies-CRVh8pCw.js.map → canvasBodies-BjXypuHf.js.map} +1 -1
- package/dist/chunks/{canvasStorage-Cr3omZeI.js → canvasStorage-DSspwRMg.js} +2 -2
- package/dist/chunks/{canvasStorage-Cr3omZeI.js.map → canvasStorage-DSspwRMg.js.map} +1 -1
- package/dist/chunks/content-from-unified-diff-CovnmG2Q.js +2927 -0
- package/dist/chunks/content-from-unified-diff-CovnmG2Q.js.map +1 -0
- package/dist/chunks/{contract-C18owGKs.js → contract-886XjdID.js} +2 -2
- package/dist/chunks/{contract-C18owGKs.js.map → contract-886XjdID.js.map} +1 -1
- package/dist/chunks/{conversation-CbWEHPbL.js → conversation-B7-evdj_.js} +4 -4
- package/dist/chunks/{conversation-CbWEHPbL.js.map → conversation-B7-evdj_.js.map} +1 -1
- package/dist/chunks/{icon-names-Di6c4zLo.js → icon-names-C5PeVvkJ.js} +32 -1
- package/dist/chunks/icon-names-C5PeVvkJ.js.map +1 -0
- package/dist/chunks/{link-navigation-DRHt6g7U.js → index-DZovGMpG.js} +65 -106
- package/dist/chunks/index-DZovGMpG.js.map +1 -0
- package/dist/chunks/link-navigation-a_sRfmsj.js +49 -0
- package/dist/chunks/link-navigation-a_sRfmsj.js.map +1 -0
- package/dist/chunks/{widget-name-resolver-Dq6Ejo7d.js → widget-name-resolver-DS3zH_5W.js} +5 -4
- package/dist/chunks/{widget-name-resolver-Dq6Ejo7d.js.map → widget-name-resolver-DS3zH_5W.js.map} +1 -1
- package/dist/chunks/{withPollingChangeSubscription-ClyOABgu.js → withPollingChangeSubscription-XvCpjGmd.js} +13 -2
- package/dist/chunks/{withPollingChangeSubscription-ClyOABgu.js.map → withPollingChangeSubscription-XvCpjGmd.js.map} +1 -1
- package/dist/client-testing.js +5 -5
- package/dist/client.js +50 -231
- package/dist/client.js.map +1 -1
- package/dist/contract.js +5 -5
- package/dist/files/i18n-keys.json +18091 -1287
- package/dist/files/widgets/DriveFilesConversationWidget/DriveFilesConversationWidget.md +3 -3
- package/dist/image-render.js +7 -7
- package/dist/index.js +62 -61
- package/dist/index.js.map +1 -1
- package/dist/kit.js +2 -2
- package/dist/preview.js +7 -7
- package/dist/provider.js +57 -56
- package/dist/provider.js.map +1 -1
- package/dist/renderer.js +15 -15
- package/dist/styles.css +2962 -15
- package/dist/types/admin/blocks/CodeBlock.d.ts +28 -0
- package/dist/types/admin/blocks/DetailModal.d.ts +34 -0
- package/dist/types/admin/blocks/Disclosure.d.ts +25 -0
- package/dist/types/admin/blocks/JsonTree.d.ts +18 -0
- package/dist/types/admin/blocks/LineDiffView.d.ts +18 -0
- package/dist/types/admin/blocks/ProportionBar.d.ts +43 -0
- package/dist/types/admin/blocks/TokenFigure.d.ts +14 -0
- package/dist/types/admin/blocks/json-tree.d.ts +40 -0
- package/dist/types/admin/blocks/line-diff.d.ts +46 -0
- package/dist/types/admin/blocks/proportion-bar.d.ts +34 -0
- package/dist/types/admin/blocks/series-fill-classes.d.ts +13 -0
- package/dist/types/admin/blocks/token-figure.d.ts +8 -0
- package/dist/types/admin/connections/AgentConnectionCard.d.ts +21 -0
- package/dist/types/admin/connections/AgentConnectionDriveRootSpaces.d.ts +25 -0
- package/dist/types/admin/connections/AgentConnectionDriveScopeDialog.d.ts +20 -0
- package/dist/types/admin/connections/AgentConnectionDriveSearchFilters.d.ts +34 -0
- package/dist/types/admin/connections/AgentConnectionDrivesDrawer.d.ts +39 -0
- package/dist/types/admin/connections/AgentConnectionLevelsDrawer.d.ts +27 -0
- package/dist/types/admin/connections/AgentConnectionSharingDialog.d.ts +12 -0
- package/dist/types/admin/connections/AgentConnectionsPanel.d.ts +97 -0
- package/dist/types/admin/connections/AgentConnectionsScreen.d.ts +18 -0
- package/dist/types/admin/connections/ConnectDialogs.d.ts +22 -0
- package/dist/types/admin/connections/agent-connection-drive-scope.d.ts +112 -0
- package/dist/types/admin/connections/agent-connection-drives.d.ts +107 -0
- package/dist/types/admin/connections/agent-connection-format.d.ts +82 -0
- package/dist/types/admin/connections/agent-connection-oauth.d.ts +122 -0
- package/dist/types/admin/connections/agent-connections-api.d.ts +420 -0
- package/dist/types/admin/connections/agent-connections-context.d.ts +60 -0
- package/dist/types/admin/connections/agent-connections-types.d.ts +447 -0
- package/dist/types/admin/connections/connection-logos.d.ts +53 -0
- package/dist/types/admin/connections/connection-parts.d.ts +84 -0
- package/dist/types/admin/connections/use-agent-connect.d.ts +25 -0
- package/dist/types/admin/context/CompactionThresholdBanner.d.ts +13 -0
- package/dist/types/admin/context/ContextCompositionPanel.d.ts +27 -0
- package/dist/types/admin/context/ContextSegmentList.d.ts +20 -0
- package/dist/types/admin/context/SentPayloadPanel.d.ts +37 -0
- package/dist/types/admin/context/agent-inspect-context-api.d.ts +53 -0
- package/dist/types/admin/context/agent-inspect-context-types.d.ts +98 -0
- package/dist/types/admin/context/context-composition-grouping.d.ts +78 -0
- package/dist/types/admin/context/context-segment-families.d.ts +18 -0
- package/dist/types/admin/context/context-segment-label-texts.d.ts +19 -0
- package/dist/types/admin/context/context-segment-labels.d.ts +18 -0
- package/dist/types/admin/control-panel/AgentControlPanelScreen.d.ts +71 -0
- package/dist/types/admin/control-panel/BudgetsTab.d.ts +13 -0
- package/dist/types/admin/control-panel/SettingsTab.d.ts +22 -0
- package/dist/types/admin/control-panel/SpacesTab.d.ts +24 -0
- package/dist/types/admin/control-panel/StatisticsTab.d.ts +26 -0
- package/dist/types/admin/control-panel/TimeSeriesChartCard.d.ts +37 -0
- package/dist/types/admin/control-panel/ToolResponseSamplesDrawer.d.ts +22 -0
- package/dist/types/admin/control-panel/agent-control-panel-api.d.ts +104 -0
- package/dist/types/admin/control-panel/agent-control-panel-types.d.ts +241 -0
- package/dist/types/admin/control-panel/budget-meters.d.ts +35 -0
- package/dist/types/admin/control-panel/control-panel-statistics.d.ts +49 -0
- package/dist/types/admin/control-panel/runtime-settings-form.d.ts +44 -0
- package/dist/types/admin/control-panel/time-series-chart.d.ts +54 -0
- package/dist/types/admin/conversations/AgentConversationDetailScreen.d.ts +128 -0
- package/dist/types/admin/conversations/AgentConversationsScreen.d.ts +60 -0
- package/dist/types/admin/conversations/ContextPanel.d.ts +9 -0
- package/dist/types/admin/conversations/ConversationActions.d.ts +32 -0
- package/dist/types/admin/conversations/ConversationTurns.d.ts +56 -0
- package/dist/types/admin/conversations/DebugSwitchBar.d.ts +23 -0
- package/dist/types/admin/conversations/DelegationPanel.d.ts +6 -0
- package/dist/types/admin/conversations/ModelContextDialog.d.ts +31 -0
- package/dist/types/admin/conversations/RequestCompositionRows.d.ts +14 -0
- package/dist/types/admin/conversations/RequestsPanel.d.ts +21 -0
- package/dist/types/admin/conversations/SandboxPanel.d.ts +42 -0
- package/dist/types/admin/conversations/StepDetailDialog.d.ts +19 -0
- package/dist/types/admin/conversations/agent-inspect-api.d.ts +259 -0
- package/dist/types/admin/conversations/agent-inspect-mappers.d.ts +23 -0
- package/dist/types/admin/conversations/agent-inspect-types.d.ts +517 -0
- package/dist/types/admin/conversations/conversation-list-export.d.ts +64 -0
- package/dist/types/admin/conversations/conversation-list-filters.d.ts +59 -0
- package/dist/types/admin/conversations/debug-switches.d.ts +27 -0
- package/dist/types/admin/conversations/delegation-swimlanes.d.ts +78 -0
- package/dist/types/admin/conversations/header-facts.d.ts +23 -0
- package/dist/types/admin/conversations/inspect-format.d.ts +44 -0
- package/dist/types/admin/conversations/inspect-parts.d.ts +42 -0
- package/dist/types/admin/conversations/inspect-scope.d.ts +92 -0
- package/dist/types/admin/conversations/model-call-rows.d.ts +78 -0
- package/dist/types/admin/conversations/step-descriptions.d.ts +43 -0
- package/dist/types/admin/conversations/touched-files-tree.d.ts +47 -0
- package/dist/types/admin/conversations/turn-paging.d.ts +56 -0
- package/dist/types/admin/conversations/turn-segments.d.ts +36 -0
- package/dist/types/admin/conversations/turn-timeline.d.ts +22 -0
- package/dist/types/admin/conversations/use-query-loader.d.ts +8 -0
- package/dist/types/admin/period/AdminPeriodControl.d.ts +15 -0
- package/dist/types/admin/period/admin-period.d.ts +51 -0
- package/dist/types/admin/quality/AgentQualityEvalRunScreen.d.ts +30 -0
- package/dist/types/admin/quality/AgentQualityScreen.d.ts +38 -0
- package/dist/types/admin/quality/SaveAsEvalCaseDialog.d.ts +27 -0
- package/dist/types/admin/quality/agent-quality-api.d.ts +86 -0
- package/dist/types/admin/quality/agent-quality-format.d.ts +52 -0
- package/dist/types/admin/quality/agent-quality-types.d.ts +161 -0
- package/dist/types/admin/schedules/AgentSchedulesPanel.d.ts +43 -0
- package/dist/types/admin/schedules/agent-schedules-api.d.ts +116 -0
- package/dist/types/admin/schedules/agent-schedules-format.d.ts +25 -0
- package/dist/types/admin/schedules/agent-schedules-types.d.ts +113 -0
- package/dist/types/admin/shared/AdminHrefLink.d.ts +13 -0
- package/dist/types/admin/skills/AgentSkillCatalogScreen.d.ts +51 -0
- package/dist/types/admin/skills/SharedBlocksPanel.d.ts +14 -0
- package/dist/types/admin/skills/SkillPurposesPanel.d.ts +16 -0
- package/dist/types/admin/skills/SkillTreeRowView.d.ts +31 -0
- package/dist/types/admin/skills/ToolSchemaDrawer.d.ts +21 -0
- package/dist/types/admin/skills/agent-skill-catalog-api.d.ts +89 -0
- package/dist/types/admin/skills/agent-skill-catalog-types.d.ts +223 -0
- package/dist/types/admin/skills/skill-catalog-colors.d.ts +10 -0
- package/dist/types/admin/skills/skill-catalog-tree.d.ts +159 -0
- package/dist/types/admin/skills/skill-purpose-texts.d.ts +11 -0
- package/dist/types/admin/wire/admin-wire.d.ts +21 -0
- package/dist/types/chat/controller/AgentChatController.d.ts +22 -0
- package/dist/types/chat/controller/turn-initiators.d.ts +21 -0
- package/dist/types/chat/trace/BackgroundTasksList.d.ts +35 -0
- package/dist/types/chat/trace/ChangeSetCard.d.ts +34 -0
- package/dist/types/chat/trace/ChangedFilesPane.d.ts +33 -0
- package/dist/types/chat/trace/ChangedRecordsList.d.ts +34 -0
- package/dist/types/chat/trace/ConsentRequestCard.d.ts +23 -0
- package/dist/types/chat/trace/ContextRing.d.ts +19 -0
- package/dist/types/chat/trace/ConversationChildTrace.d.ts +18 -0
- package/dist/types/chat/trace/ConversationTurnTrace.d.ts +48 -0
- package/dist/types/chat/trace/EntityChip.d.ts +23 -0
- package/dist/types/chat/trace/FileChangesSummary.d.ts +14 -0
- package/dist/types/chat/trace/FileEditBlock.d.ts +42 -0
- package/dist/types/chat/trace/LoadedSkillsDisclosure.d.ts +16 -0
- package/dist/types/chat/trace/QueuedMessageChip.d.ts +17 -0
- package/dist/types/chat/trace/RunStatusLine.d.ts +27 -0
- package/dist/types/chat/trace/StepKindDetails.d.ts +59 -0
- package/dist/types/chat/trace/SubAgentStepGroup.d.ts +53 -0
- package/dist/types/chat/trace/TaskPlanPane.d.ts +31 -0
- package/dist/types/chat/trace/TaskPlanRow.d.ts +28 -0
- package/dist/types/chat/trace/TerminalBlock.d.ts +16 -0
- package/dist/types/chat/trace/ThinkingBlock.d.ts +19 -0
- package/dist/types/chat/trace/ToolStepDetail.d.ts +49 -0
- package/dist/types/chat/trace/ToolStepGroup.d.ts +58 -0
- package/dist/types/chat/trace/ToolStepRow.d.ts +52 -0
- package/dist/types/chat/trace/TraceViewModeSwitch.d.ts +14 -0
- package/dist/types/chat/trace/TurnMetaLine.d.ts +27 -0
- package/dist/types/chat/trace/content-from-unified-diff.d.ts +25 -0
- package/dist/types/chat/trace/conversation-trace-loader.d.ts +133 -0
- package/dist/types/chat/trace/index.d.ts +34 -0
- package/dist/types/chat/trace/parse-unified-diff.d.ts +51 -0
- package/dist/types/chat/trace/task-plan-counts.d.ts +41 -0
- package/dist/types/chat/trace/trace-collect.d.ts +91 -0
- package/dist/types/chat/trace/trace-counts.d.ts +21 -0
- package/dist/types/chat/trace/trace-format.d.ts +73 -0
- package/dist/types/chat/trace/trace-labels.d.ts +60 -0
- package/dist/types/chat/trace/trace-parts.d.ts +63 -0
- package/dist/types/chat/trace/trace-step-focus.d.ts +12 -0
- package/dist/types/chat/trace/trace-types.d.ts +370 -0
- package/dist/types/chat/trace/use-conversation-trace.d.ts +47 -0
- package/dist/types/client/AgentsConversationClient.d.ts +20 -0
- package/dist/types/client/http/agents-http-trace-mappers.d.ts +31 -0
- package/dist/types/client/http/agents-http-trace-wire.d.ts +433 -0
- package/dist/types/contract/conversation-trace.d.ts +594 -0
- package/dist/types/entries/admin.d.ts +85 -0
- package/dist/types/entries/chat.d.ts +3 -1
- package/dist/types/entries/client.d.ts +2 -0
- package/dist/types/entries/contract.d.ts +1 -0
- package/dist/types/provider/components/icon-names.d.ts +4 -2
- package/dist/types/provider/components/types.d.ts +3 -1
- package/dist/types/widgets/DriveFilesConversationWidget/shared/drive-files.d.ts +1 -1
- package/dist/voice.js +3 -3
- package/dist/widgets.js +6 -6
- package/package.json +7 -3
- package/public-api.json +1036 -3
- package/dist/chunks/WebSearchResultsConversationWidget-dEq19U7k.js.map +0 -1
- package/dist/chunks/icon-names-Di6c4zLo.js.map +0 -1
- package/dist/chunks/link-navigation-DRHt6g7U.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import "./conversation-
|
|
2
|
+
import "./conversation-B7-evdj_.js";
|
|
3
3
|
import { t as textKey } from "./text-key-DnoZ4lAk.js";
|
|
4
4
|
const PHONE_CALL_LIFECYCLE_SIGNAL_SOURCES = ["PHONE_CALL_STARTED", "PHONE_CALL_ENDED"];
|
|
5
5
|
const REPEATED_TEXT_SUPPRESSED_SIGNAL_SOURCE = "REPEATED_TEXT_SUPPRESSED";
|
|
@@ -128,4 +128,4 @@ export {
|
|
|
128
128
|
deriveAgentActivity as d,
|
|
129
129
|
lastWireMessageIsUnansweredUserMessage as l
|
|
130
130
|
};
|
|
131
|
-
//# sourceMappingURL=contract-
|
|
131
|
+
//# sourceMappingURL=contract-886XjdID.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract-C18owGKs.js","sources":["../../src/chat/last-wire-message-is-unanswered-user-message.ts","../../src/chat/controller/derive-agent-activity.ts","../../src/chat/controller/changed-messages-request.ts"],"sourcesContent":["import type { ChatMessage } from \"./chat-message\";\n\n/** The phone call's started / ended markers — the call marker chip, structural context, never owed work. */\nexport const PHONE_CALL_LIFECYCLE_SIGNAL_SOURCES: readonly string[] = [\"PHONE_CALL_STARTED\", \"PHONE_CALL_ENDED\"];\n/** The loop dropped a repeat of an already delivered text — bookkeeping behind the agent's answer, never owed work. */\nconst REPEATED_TEXT_SUPPRESSED_SIGNAL_SOURCE = \"REPEATED_TEXT_SUPPRESSED\";\n/** The platform wrote a widget on its own (e.g. a follow-up question under the final text) — a notice, never owed work. */\nconst PLATFORM_WIDGET_EMITTED_SIGNAL_SOURCE = \"PLATFORM_WIDGET_EMITTED\";\n/** The frontend's render report of a message's widgets — context for the next turn, never owed work. */\nconst FRONTEND_WIDGET_RENDER_REPORT_SIGNAL_SOURCE = \"FRONTEND_WIDGET_RENDER_REPORT\";\n/**\n * The SIGNAL rows that owe no work — the backend's `owesWork() === false` on a SIGNAL row, pinned by\n * `signal-source-parity.json` (`_signal-source-parity.spec.ts`).\n */\nexport const SIGNAL_SOURCES_THAT_OWE_NO_WORK: readonly string[] = [\n ...PHONE_CALL_LIFECYCLE_SIGNAL_SOURCES,\n REPEATED_TEXT_SUPPRESSED_SIGNAL_SOURCE,\n PLATFORM_WIDGET_EMITTED_SIGNAL_SOURCE,\n FRONTEND_WIDGET_RENDER_REPORT_SIGNAL_SOURCE,\n];\n\n/**\n * Whether the newest WIRE message is the customer's own, still unanswered — the backend's `hasUnansweredInboundMessage`\n * seen from the frontend, walked the same way: ERROR / CHECKPOINT rows are bookkeeping (never rendered, never an\n * answer); a TOOL_MESSAGE (a tool's own widget to the customer, stored role ASSISTANT) is NOT the agent's answer — a\n * customer question followed only by a tool's status widget stays owed; the phone-call lifecycle chips are structural\n * context, never owed work, and so is the platform's notice that it wrote a widget on its own; any other trailing SIGNAL (a widget click, a memory-conflict clarify) IS owed work, exactly\n * like a user message. Only then does a failed run have something to RETRY — the persisted\n * message is re-driven server-side instead of asking the customer to send it again. A walk that diverges from the\n * backend's shows the error card without the button while the backend would accept the retry — keep the two in step.\n *\n * The slice keeps `messages` ordered by `indexInConversation`; the sort here is belt-and-suspenders for a caller that\n * hands in an unordered page, not a fix for an upstream ordering defect.\n */\nexport const lastWireMessageIsUnansweredUserMessage = (messages: ChatMessage[] | null): boolean => {\n if (!messages?.length) {\n return false;\n }\n const sorted = [...messages].sort((a, b) => (a.indexInConversation ?? 0) - (b.indexInConversation ?? 0));\n for (let position = sorted.length - 1; position >= 0; position--) {\n const message = sorted[position];\n if (\n message.messageType === \"ERROR\" ||\n message.messageType === \"CHECKPOINT\" ||\n message.messageType === \"TOOL_MESSAGE\"\n ) {\n continue;\n }\n if (message.messageType === \"SIGNAL\") {\n if (SIGNAL_SOURCES_THAT_OWE_NO_WORK.includes(message.signalSource ?? \"\")) {\n continue;\n }\n return true;\n }\n return message.authorType === \"USER\";\n }\n return false;\n};\n","import type { ConversationMessageStatus } from \"../../contract/conversation\";\nimport type { ChatMessage } from \"../chat-message\";\nimport { textKey } from \"../../provider/text-key\";\nimport { SIGNAL_SOURCES_THAT_OWE_NO_WORK } from \"../last-wire-message-is-unanswered-user-message\";\n\n/** Mirrors App\\Domain\\AI\\Entities\\Conversations\\Agent\\Tools\\DelegateTool::NAME. */\nconst DELEGATE_TOOL_NAME = \"delegate\";\n\n/** Terminal tool-call statuses — mirrors ToolCall::isResolved (COMPLETED / FAILED / CANCELLED). */\nconst RESOLVED_STATUSES: string[] = [\"COMPLETED\", \"FAILED\", \"CANCELLED\"] satisfies ConversationMessageStatus[];\nconst isResolved = (status?: string | null): boolean => status != null && RESOLVED_STATUSES.includes(status);\n\n/** Terminal child run-states — mirrors AIConversationRunState::TERMINAL (COMPLETED / FAILED / CANCELLED). */\nconst TERMINAL_RUN_STATES: string[] = [\"COMPLETED\", \"FAILED\", \"CANCELLED\"];\n\n/** A sub-agent run still waiting to start or actively working (mirrors DelegationSubAgentRun::STATUS_*). */\nconst UNRESOLVED_RUN_STATUSES: string[] = [\"QUEUED\", \"RUNNING\"];\n\n/**\n * A tool call is EFFECTIVELY resolved when its stored status says so — or, for a `delegate` call, when every\n * expanded child already reached a terminal run state: the children are the truth of a fan-out, the stored\n * status is a mirror that a write race can leave stale (a delegate call left RUNNING kept the whole customer\n * chat \"thinking\" for the rest of a setup). An empty or missing expansion proves nothing and falls back to the status.\n */\n/**\n * Rows that never start or continue a turn: the bookkeeping rows (ERROR, CHECKPOINT) and the SIGNAL rows that owe no\n * work (the frontend's widget render report, the platform's own widget notice, phone call markers, a suppressed\n * repeat). They are stored with role USER and may land after the agent's answer; read as the tail they would keep the\n * \"Working on it…\" line under a finished answer forever.\n */\nconst isRowThatOwesNoWork = (message: ChatMessage): boolean =>\n message.messageType === \"ERROR\" ||\n message.messageType === \"CHECKPOINT\" ||\n (message.messageType === \"SIGNAL\" && SIGNAL_SOURCES_THAT_OWE_NO_WORK.includes(message.signalSource ?? \"\"));\n\nconst isEffectivelyResolved = (message: ChatMessage | undefined): boolean => {\n if (message == null) return false;\n if (isResolved(message.toolCall?.status)) return true;\n if (message.toolCall?.name !== DELEGATE_TOOL_NAME) return false;\n const children = message.delegatedConversations ?? [];\n if (children.length === 0) return false;\n // A partial expansion (page cap) proves nothing: the call declared N tasks, N children must be visible.\n const declaredTasks = (message.toolCall?.arguments as { tasks?: unknown[] } | undefined)?.tasks;\n if (Array.isArray(declaredTasks) && declaredTasks.length > children.length) return false;\n return children.every((child) => TERMINAL_RUN_STATES.includes(child.runState ?? \"\"));\n};\n\n/** How many sub-agents spawned by this message are still working. */\nexport const countOutstandingChildren = (message: ChatMessage): number => {\n const children = message.delegatedConversations ?? [];\n if (children.length > 0) {\n return children.filter((child) => !TERMINAL_RUN_STATES.includes(child.runState ?? \"\")).length;\n }\n if (message.toolCall?.name !== DELEGATE_TOOL_NAME) {\n return 0;\n }\n // A NEW row (one `delegate` call = one sub-agent) carries its own run record instead of\n // `delegatedConversations`; no child expanded, so the record's CURRENT run is the truth of whether it is done.\n const subAgent = message.subAgent;\n if (subAgent != null) {\n const currentRun = (subAgent.runs ?? []).find((run) => run.runNumber === subAgent.currentRunNumber);\n return currentRun != null && UNRESOLVED_RUN_STATUSES.includes(currentRun.status ?? \"\") ? 1 : 0;\n }\n if (isResolved(message.toolCall?.status)) {\n return 0;\n }\n const declaredTasks = (message.toolCall?.arguments as { tasks?: unknown[] } | undefined)?.tasks;\n return Array.isArray(declaredTasks) && declaredTasks.length > 0 ? declaredTasks.length : 1;\n};\n\n/** A tool call whose result is still to come — its progress lives in `toolCall.status`, never in the row's status. */\nexport const hasUnresolvedToolCall = (message: ChatMessage): boolean =>\n message.toolCall != null && !isEffectivelyResolved(message);\n\n/** Whether this message's delegation can still change: a child is still working, or the call is not resolved yet. */\nexport const hasDelegationInFlight = (message: ChatMessage): boolean =>\n countOutstandingChildren(message) > 0 ||\n (message.toolCall?.name === DELEGATE_TOOL_NAME && !isEffectivelyResolved(message));\n\nexport type AgentActivity = {\n /** Whether a turn is in flight — drives the indicator's visibility (ConversationView aiThinking). */\n active: boolean;\n /**\n * Translation source string for \"what the agent is doing right now\" (empty when nothing to show). Rendered through\n * the chat's `Text`, so this is the translatable key with %placeholders% — NOT pre-interpolated. The dynamic values\n * arrive via {@link AgentActivity.replacements} and plural form via {@link AgentActivity.context}.\n */\n label: string;\n /** Dynamic values substituted into the %placeholders% of {@link AgentActivity.label} by <Text>. */\n replacements?: Record<string, string | number>;\n /** Plural selector for <Text> when the label is count-dependent. */\n context?: \"one\" | \"other\";\n /** A non-delegate tool is running → show the ASCII wrench spinner instead of a text label. */\n toolRunning?: boolean;\n};\n\n/**\n * Derive \"what the agent is doing right now\" for the agent activity indicator PURELY from the\n * live conversation data: the message tree (refreshed on each realtime-signal tick / on open) plus the signal's\n * coarse runStatus (\"running\" | \"idle\" | \"failed\" | null). No network. Mirrors the backend truth —\n * AIConversation.runState (IDLE/RUNNING/AWAITING_DELEGATES/…) and per-message status/messageType/toolCall — but reads\n * it off the messages the FE already holds, so the indicator is correct even before the first signal emission.\n */\nexport const deriveAgentActivity = (\n messages: ChatMessage[] | null,\n runStatus: string | null,\n): AgentActivity => {\n if (runStatus === \"failed\") {\n // Failure surfaces via ConversationView's error state, not the activity line.\n return { active: false, label: \"\" };\n }\n\n // An optimistic (just-sent, not yet server-assigned) row carries no index — it belongs at the TAIL, the newest\n // thing in the conversation, never at the front, where `?? 0` would park it ahead of every real message.\n const sorted = [...(messages ?? [])].filter((message) => !isRowThatOwesNoWork(message)).sort(\n (a, b) => (a.indexInConversation ?? Number.POSITIVE_INFINITY) - (b.indexInConversation ?? Number.POSITIVE_INFINITY),\n );\n const lastMessage = sorted[sorted.length - 1];\n\n // The owner just sent — the optimistic bubble, or a saved row still awaiting the first response — starts the face\n // thinking immediately, before the server's \"running\" ping arrives (which can lag the send by about a second);\n // checked before the `idle` short-circuit below, whose `runStatus` can still report the PREVIOUS turn's rest state.\n // A rejected POST resets `aiThinking` itself (conversations-message-post.case.ts), so no separate reset is needed.\n if (lastMessage?.role === \"USER\") {\n return { active: true, label: \"\" };\n }\n\n // Sub-agents still working → the orchestrator is parked on its children (backend runState AWAITING_DELEGATES).\n // Counted per CHILD, not per delegate message: a fan-out (`delegate` with N tasks, or a tool result carrying\n // `delegationTasks`, e.g. a LARGE website edit's page packets) is ONE message with N children. The expanded\n // `delegatedConversations` carry each child's runState; without the expand, a `delegate` call still awaiting its\n // verdict counts its declared tasks, else one.\n const unresolvedDelegateCount = sorted.reduce((count, message) => count + countOutstandingChildren(message), 0);\n\n // The turn is at rest and nothing is outstanding → idle, no indicator.\n if (runStatus === \"idle\" && unresolvedDelegateCount === 0) {\n return { active: false, label: \"\" };\n }\n\n if (unresolvedDelegateCount > 0) {\n return {\n active: true,\n label: textKey(\"Waiting for %count% delegations...\"),\n replacements: { count: unresolvedDelegateCount },\n context: unresolvedDelegateCount === 1 ? \"one\" : \"other\",\n };\n }\n\n // A tool-call that hasn't resolved yet → that tool is running now (a delegate call whose children all finished\n // is resolved in effect, whatever its stored status says).\n if (lastMessage?.messageType === \"TOOL_CALL\" && !isEffectivelyResolved(lastMessage)) {\n return {\n active: true,\n label: textKey(\"Running: %tool%...\"),\n replacements: { tool: lastMessage.toolCall?.name ?? \"Tool\" },\n toolRunning: true,\n };\n }\n\n // The model is producing a turn (signal running) — a trailing owner row was already caught above.\n if (runStatus === \"running\") {\n return { active: true, label: \"\" };\n }\n\n return { active: false, label: \"\" };\n};\n","import type { ChangedMessagesRequest, ConversationMessageStatus } from \"../../contract/conversation\";\nimport type { ChatMessage } from \"../chat-message\";\nimport { hasDelegationInFlight, hasUnresolvedToolCall } from \"./derive-agent-activity\";\n\n/** Row statuses that are not final yet (today only a waiting signal row carries one, PENDING until a turn reads it). */\nconst CHANGING_STATUSES: string[] = [\"PENDING\", \"RUNNING\", \"CANCEL_REQUESTED\"] satisfies ConversationMessageStatus[];\n\nconst canStillChange = (message: ChatMessage): boolean =>\n CHANGING_STATUSES.includes(message.status ?? \"\") || hasUnresolvedToolCall(message) || hasDelegationInFlight(message);\n\n/**\n * What a live update reads, given the loaded messages: every row written since the newest loaded one, plus every\n * message from the lowest one that can still change. \"Written since\" goes by id, not index: ids grow with every write,\n * while an index can be taken below the newest loaded one (a call row persisted after the row its execution emitted)\n * or reused (a re-drive after an admin delete-from). The index start never lies below the newest page (a newest-first\n * page of `pageSize` cannot return older rows anyway), so a row a dead worker left pending cannot pin it. Nothing\n * loaded yet → null: the caller reads the newest page as on open. How the request reaches the wire (the filter string)\n * is the binding's matter (`AgentsConversationClient.getChangedMessages`).\n */\nexport const buildChangedMessagesRequest = (\n messages: ChatMessage[] | null,\n pageSize: number,\n): ChangedMessagesRequest | null => {\n const loaded = (messages ?? []).filter((message) => message.indexInConversation != null);\n if (loaded.length === 0) {\n return null;\n }\n const indexes = (list: ChatMessage[]) => list.map((message) => message.indexInConversation as number);\n const highestIndex = Math.max(...indexes(loaded));\n const changing = loaded.filter(canStillChange);\n const fromIndex = Math.max(\n changing.length > 0 ? Math.min(...indexes(changing)) : highestIndex + 1,\n highestIndex - pageSize + 1,\n );\n const highestKnownId = Math.max(...loaded.map((message) => message.id ?? 0));\n return { highestKnownId, fromIndex, pageSize };\n};\n"],"names":[],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"contract-886XjdID.js","sources":["../../src/chat/last-wire-message-is-unanswered-user-message.ts","../../src/chat/controller/derive-agent-activity.ts","../../src/chat/controller/changed-messages-request.ts"],"sourcesContent":["import type { ChatMessage } from \"./chat-message\";\n\n/** The phone call's started / ended markers — the call marker chip, structural context, never owed work. */\nexport const PHONE_CALL_LIFECYCLE_SIGNAL_SOURCES: readonly string[] = [\"PHONE_CALL_STARTED\", \"PHONE_CALL_ENDED\"];\n/** The loop dropped a repeat of an already delivered text — bookkeeping behind the agent's answer, never owed work. */\nconst REPEATED_TEXT_SUPPRESSED_SIGNAL_SOURCE = \"REPEATED_TEXT_SUPPRESSED\";\n/** The platform wrote a widget on its own (e.g. a follow-up question under the final text) — a notice, never owed work. */\nconst PLATFORM_WIDGET_EMITTED_SIGNAL_SOURCE = \"PLATFORM_WIDGET_EMITTED\";\n/** The frontend's render report of a message's widgets — context for the next turn, never owed work. */\nconst FRONTEND_WIDGET_RENDER_REPORT_SIGNAL_SOURCE = \"FRONTEND_WIDGET_RENDER_REPORT\";\n/**\n * The SIGNAL rows that owe no work — the backend's `owesWork() === false` on a SIGNAL row, pinned by\n * `signal-source-parity.json` (`_signal-source-parity.spec.ts`).\n */\nexport const SIGNAL_SOURCES_THAT_OWE_NO_WORK: readonly string[] = [\n ...PHONE_CALL_LIFECYCLE_SIGNAL_SOURCES,\n REPEATED_TEXT_SUPPRESSED_SIGNAL_SOURCE,\n PLATFORM_WIDGET_EMITTED_SIGNAL_SOURCE,\n FRONTEND_WIDGET_RENDER_REPORT_SIGNAL_SOURCE,\n];\n\n/**\n * Whether the newest WIRE message is the customer's own, still unanswered — the backend's `hasUnansweredInboundMessage`\n * seen from the frontend, walked the same way: ERROR / CHECKPOINT rows are bookkeeping (never rendered, never an\n * answer); a TOOL_MESSAGE (a tool's own widget to the customer, stored role ASSISTANT) is NOT the agent's answer — a\n * customer question followed only by a tool's status widget stays owed; the phone-call lifecycle chips are structural\n * context, never owed work, and so is the platform's notice that it wrote a widget on its own; any other trailing SIGNAL (a widget click, a memory-conflict clarify) IS owed work, exactly\n * like a user message. Only then does a failed run have something to RETRY — the persisted\n * message is re-driven server-side instead of asking the customer to send it again. A walk that diverges from the\n * backend's shows the error card without the button while the backend would accept the retry — keep the two in step.\n *\n * The slice keeps `messages` ordered by `indexInConversation`; the sort here is belt-and-suspenders for a caller that\n * hands in an unordered page, not a fix for an upstream ordering defect.\n */\nexport const lastWireMessageIsUnansweredUserMessage = (messages: ChatMessage[] | null): boolean => {\n if (!messages?.length) {\n return false;\n }\n const sorted = [...messages].sort((a, b) => (a.indexInConversation ?? 0) - (b.indexInConversation ?? 0));\n for (let position = sorted.length - 1; position >= 0; position--) {\n const message = sorted[position];\n if (\n message.messageType === \"ERROR\" ||\n message.messageType === \"CHECKPOINT\" ||\n message.messageType === \"TOOL_MESSAGE\"\n ) {\n continue;\n }\n if (message.messageType === \"SIGNAL\") {\n if (SIGNAL_SOURCES_THAT_OWE_NO_WORK.includes(message.signalSource ?? \"\")) {\n continue;\n }\n return true;\n }\n return message.authorType === \"USER\";\n }\n return false;\n};\n","import type { ConversationMessageStatus } from \"../../contract/conversation\";\nimport type { ChatMessage } from \"../chat-message\";\nimport { textKey } from \"../../provider/text-key\";\nimport { SIGNAL_SOURCES_THAT_OWE_NO_WORK } from \"../last-wire-message-is-unanswered-user-message\";\n\n/** Mirrors App\\Domain\\AI\\Entities\\Conversations\\Agent\\Tools\\DelegateTool::NAME. */\nconst DELEGATE_TOOL_NAME = \"delegate\";\n\n/** Terminal tool-call statuses — mirrors ToolCall::isResolved (COMPLETED / FAILED / CANCELLED). */\nconst RESOLVED_STATUSES: string[] = [\"COMPLETED\", \"FAILED\", \"CANCELLED\"] satisfies ConversationMessageStatus[];\nconst isResolved = (status?: string | null): boolean => status != null && RESOLVED_STATUSES.includes(status);\n\n/** Terminal child run-states — mirrors AIConversationRunState::TERMINAL (COMPLETED / FAILED / CANCELLED). */\nconst TERMINAL_RUN_STATES: string[] = [\"COMPLETED\", \"FAILED\", \"CANCELLED\"];\n\n/** A sub-agent run still waiting to start or actively working (mirrors DelegationSubAgentRun::STATUS_*). */\nconst UNRESOLVED_RUN_STATUSES: string[] = [\"QUEUED\", \"RUNNING\"];\n\n/**\n * A tool call is EFFECTIVELY resolved when its stored status says so — or, for a `delegate` call, when every\n * expanded child already reached a terminal run state: the children are the truth of a fan-out, the stored\n * status is a mirror that a write race can leave stale (a delegate call left RUNNING kept the whole customer\n * chat \"thinking\" for the rest of a setup). An empty or missing expansion proves nothing and falls back to the status.\n */\n/**\n * Rows that never start or continue a turn: the bookkeeping rows (ERROR, CHECKPOINT) and the SIGNAL rows that owe no\n * work (the frontend's widget render report, the platform's own widget notice, phone call markers, a suppressed\n * repeat). They are stored with role USER and may land after the agent's answer; read as the tail they would keep the\n * \"Working on it…\" line under a finished answer forever.\n */\nconst isRowThatOwesNoWork = (message: ChatMessage): boolean =>\n message.messageType === \"ERROR\" ||\n message.messageType === \"CHECKPOINT\" ||\n (message.messageType === \"SIGNAL\" && SIGNAL_SOURCES_THAT_OWE_NO_WORK.includes(message.signalSource ?? \"\"));\n\nconst isEffectivelyResolved = (message: ChatMessage | undefined): boolean => {\n if (message == null) return false;\n if (isResolved(message.toolCall?.status)) return true;\n if (message.toolCall?.name !== DELEGATE_TOOL_NAME) return false;\n const children = message.delegatedConversations ?? [];\n if (children.length === 0) return false;\n // A partial expansion (page cap) proves nothing: the call declared N tasks, N children must be visible.\n const declaredTasks = (message.toolCall?.arguments as { tasks?: unknown[] } | undefined)?.tasks;\n if (Array.isArray(declaredTasks) && declaredTasks.length > children.length) return false;\n return children.every((child) => TERMINAL_RUN_STATES.includes(child.runState ?? \"\"));\n};\n\n/** How many sub-agents spawned by this message are still working. */\nexport const countOutstandingChildren = (message: ChatMessage): number => {\n const children = message.delegatedConversations ?? [];\n if (children.length > 0) {\n return children.filter((child) => !TERMINAL_RUN_STATES.includes(child.runState ?? \"\")).length;\n }\n if (message.toolCall?.name !== DELEGATE_TOOL_NAME) {\n return 0;\n }\n // A NEW row (one `delegate` call = one sub-agent) carries its own run record instead of\n // `delegatedConversations`; no child expanded, so the record's CURRENT run is the truth of whether it is done.\n const subAgent = message.subAgent;\n if (subAgent != null) {\n const currentRun = (subAgent.runs ?? []).find((run) => run.runNumber === subAgent.currentRunNumber);\n return currentRun != null && UNRESOLVED_RUN_STATUSES.includes(currentRun.status ?? \"\") ? 1 : 0;\n }\n if (isResolved(message.toolCall?.status)) {\n return 0;\n }\n const declaredTasks = (message.toolCall?.arguments as { tasks?: unknown[] } | undefined)?.tasks;\n return Array.isArray(declaredTasks) && declaredTasks.length > 0 ? declaredTasks.length : 1;\n};\n\n/** A tool call whose result is still to come — its progress lives in `toolCall.status`, never in the row's status. */\nexport const hasUnresolvedToolCall = (message: ChatMessage): boolean =>\n message.toolCall != null && !isEffectivelyResolved(message);\n\n/** Whether this message's delegation can still change: a child is still working, or the call is not resolved yet. */\nexport const hasDelegationInFlight = (message: ChatMessage): boolean =>\n countOutstandingChildren(message) > 0 ||\n (message.toolCall?.name === DELEGATE_TOOL_NAME && !isEffectivelyResolved(message));\n\nexport type AgentActivity = {\n /** Whether a turn is in flight — drives the indicator's visibility (ConversationView aiThinking). */\n active: boolean;\n /**\n * Translation source string for \"what the agent is doing right now\" (empty when nothing to show). Rendered through\n * the chat's `Text`, so this is the translatable key with %placeholders% — NOT pre-interpolated. The dynamic values\n * arrive via {@link AgentActivity.replacements} and plural form via {@link AgentActivity.context}.\n */\n label: string;\n /** Dynamic values substituted into the %placeholders% of {@link AgentActivity.label} by <Text>. */\n replacements?: Record<string, string | number>;\n /** Plural selector for <Text> when the label is count-dependent. */\n context?: \"one\" | \"other\";\n /** A non-delegate tool is running → show the ASCII wrench spinner instead of a text label. */\n toolRunning?: boolean;\n};\n\n/**\n * Derive \"what the agent is doing right now\" for the agent activity indicator PURELY from the\n * live conversation data: the message tree (refreshed on each realtime-signal tick / on open) plus the signal's\n * coarse runStatus (\"running\" | \"idle\" | \"failed\" | null). No network. Mirrors the backend truth —\n * AIConversation.runState (IDLE/RUNNING/AWAITING_DELEGATES/…) and per-message status/messageType/toolCall — but reads\n * it off the messages the FE already holds, so the indicator is correct even before the first signal emission.\n */\nexport const deriveAgentActivity = (\n messages: ChatMessage[] | null,\n runStatus: string | null,\n): AgentActivity => {\n if (runStatus === \"failed\") {\n // Failure surfaces via ConversationView's error state, not the activity line.\n return { active: false, label: \"\" };\n }\n\n // An optimistic (just-sent, not yet server-assigned) row carries no index — it belongs at the TAIL, the newest\n // thing in the conversation, never at the front, where `?? 0` would park it ahead of every real message.\n const sorted = [...(messages ?? [])].filter((message) => !isRowThatOwesNoWork(message)).sort(\n (a, b) => (a.indexInConversation ?? Number.POSITIVE_INFINITY) - (b.indexInConversation ?? Number.POSITIVE_INFINITY),\n );\n const lastMessage = sorted[sorted.length - 1];\n\n // The owner just sent — the optimistic bubble, or a saved row still awaiting the first response — starts the face\n // thinking immediately, before the server's \"running\" ping arrives (which can lag the send by about a second);\n // checked before the `idle` short-circuit below, whose `runStatus` can still report the PREVIOUS turn's rest state.\n // A rejected POST resets `aiThinking` itself (conversations-message-post.case.ts), so no separate reset is needed.\n if (lastMessage?.role === \"USER\") {\n return { active: true, label: \"\" };\n }\n\n // Sub-agents still working → the orchestrator is parked on its children (backend runState AWAITING_DELEGATES).\n // Counted per CHILD, not per delegate message: a fan-out (`delegate` with N tasks, or a tool result carrying\n // `delegationTasks`, e.g. a LARGE website edit's page packets) is ONE message with N children. The expanded\n // `delegatedConversations` carry each child's runState; without the expand, a `delegate` call still awaiting its\n // verdict counts its declared tasks, else one.\n const unresolvedDelegateCount = sorted.reduce((count, message) => count + countOutstandingChildren(message), 0);\n\n // The turn is at rest and nothing is outstanding → idle, no indicator.\n if (runStatus === \"idle\" && unresolvedDelegateCount === 0) {\n return { active: false, label: \"\" };\n }\n\n if (unresolvedDelegateCount > 0) {\n return {\n active: true,\n label: textKey(\"Waiting for %count% delegations...\"),\n replacements: { count: unresolvedDelegateCount },\n context: unresolvedDelegateCount === 1 ? \"one\" : \"other\",\n };\n }\n\n // A tool-call that hasn't resolved yet → that tool is running now (a delegate call whose children all finished\n // is resolved in effect, whatever its stored status says).\n if (lastMessage?.messageType === \"TOOL_CALL\" && !isEffectivelyResolved(lastMessage)) {\n return {\n active: true,\n label: textKey(\"Running: %tool%...\"),\n replacements: { tool: lastMessage.toolCall?.name ?? \"Tool\" },\n toolRunning: true,\n };\n }\n\n // The model is producing a turn (signal running) — a trailing owner row was already caught above.\n if (runStatus === \"running\") {\n return { active: true, label: \"\" };\n }\n\n return { active: false, label: \"\" };\n};\n","import type { ChangedMessagesRequest, ConversationMessageStatus } from \"../../contract/conversation\";\nimport type { ChatMessage } from \"../chat-message\";\nimport { hasDelegationInFlight, hasUnresolvedToolCall } from \"./derive-agent-activity\";\n\n/** Row statuses that are not final yet (today only a waiting signal row carries one, PENDING until a turn reads it). */\nconst CHANGING_STATUSES: string[] = [\"PENDING\", \"RUNNING\", \"CANCEL_REQUESTED\"] satisfies ConversationMessageStatus[];\n\nconst canStillChange = (message: ChatMessage): boolean =>\n CHANGING_STATUSES.includes(message.status ?? \"\") || hasUnresolvedToolCall(message) || hasDelegationInFlight(message);\n\n/**\n * What a live update reads, given the loaded messages: every row written since the newest loaded one, plus every\n * message from the lowest one that can still change. \"Written since\" goes by id, not index: ids grow with every write,\n * while an index can be taken below the newest loaded one (a call row persisted after the row its execution emitted)\n * or reused (a re-drive after an admin delete-from). The index start never lies below the newest page (a newest-first\n * page of `pageSize` cannot return older rows anyway), so a row a dead worker left pending cannot pin it. Nothing\n * loaded yet → null: the caller reads the newest page as on open. How the request reaches the wire (the filter string)\n * is the binding's matter (`AgentsConversationClient.getChangedMessages`).\n */\nexport const buildChangedMessagesRequest = (\n messages: ChatMessage[] | null,\n pageSize: number,\n): ChangedMessagesRequest | null => {\n const loaded = (messages ?? []).filter((message) => message.indexInConversation != null);\n if (loaded.length === 0) {\n return null;\n }\n const indexes = (list: ChatMessage[]) => list.map((message) => message.indexInConversation as number);\n const highestIndex = Math.max(...indexes(loaded));\n const changing = loaded.filter(canStillChange);\n const fromIndex = Math.max(\n changing.length > 0 ? Math.min(...indexes(changing)) : highestIndex + 1,\n highestIndex - pageSize + 1,\n );\n const highestKnownId = Math.max(...loaded.map((message) => message.id ?? 0));\n return { highestKnownId, fromIndex, pageSize };\n};\n"],"names":[],"mappings":"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"}
|
|
@@ -30,11 +30,11 @@ class AgentsClientError extends Error {
|
|
|
30
30
|
}
|
|
31
31
|
const isAgentsClientError = (value) => value instanceof AgentsClientError;
|
|
32
32
|
export {
|
|
33
|
-
|
|
33
|
+
AgentsClientError as A,
|
|
34
34
|
CONVERSATION_RUN_STATES_THAT_END_THE_CONVERSATION as C,
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
AGENTS_CLIENT_ERROR_CODE_REQUEST_ABORTED as a,
|
|
36
|
+
AGENTS_CLIENT_CONTEXT_LIMITS as b,
|
|
37
37
|
isAgentsClientError as i,
|
|
38
38
|
readConversationRunStatusOfRunState as r
|
|
39
39
|
};
|
|
40
|
-
//# sourceMappingURL=conversation-
|
|
40
|
+
//# sourceMappingURL=conversation-B7-evdj_.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation-CbWEHPbL.js","sources":["../../src/contract/conversation.ts"],"sourcesContent":["/**\n * The conversation contract of the package: plain TypeScript types the conversation client port\n * (`client/AgentsConversationClient.ts`) returns and the chat reads. Every field is derived from what the chat files and\n * the chat controller read from the server today (the host application's generated `AIConversation`, `AIConversationMessage`,\n * `AgentActivityLine`, `SemanticSearchHit`, `AIConversationSearchGroup`, `AgentCustomerSelectableModel`); nothing the\n * chat does not read is here.\n *\n * Naming: a field keeps the wire name where the name is neutral (`message`, `indexInConversation`, `role`, `status`,\n * `toolCall`); a name that carries an app's vocabulary is renamed (`aiConversationId` → `conversationId`,\n * the app's own key of the thing the agent works for → `agentSpaceKey`, `summary.title` → `title`). Each field carries a\n * one-line note:\n * - `generic` — every app that runs the agent conversation backend has it;\n * - `app extension` — read by the chat today but specific to one app's backend or debug surface; optional, and a\n * binding may leave it out.\n *\n * Client-side state is NOT part of the contract: the `fresh` tag of a live-arrived message, the optimistic user\n * message without an id and the `isNewConversation` / `isReopenedConversation` flags belong to the package store.\n */\n\n// ── Vocabulary ───────────────────────────────────────────────────────────────────────────────────────────────────\n\n/** The run state of a conversation as the server stores it (`AIConversationRunState`). */\nexport type ConversationRunState =\n | \"IDLE\"\n | \"QUEUED\"\n | \"RUNNING\"\n | \"AWAITING_DELEGATES\"\n | \"FAILED\"\n | \"COMPLETED\"\n | \"CANCELLED\";\n\n/** The three-value run status the live-update signal speaks; the chat keys its indicator and error card off it. */\nexport type ConversationRunStatus = \"running\" | \"idle\" | \"failed\";\n\nexport type ConversationMessageRole = \"SYSTEM\" | \"USER\" | \"ASSISTANT\";\n\nexport type ConversationMessageType = \"TEXT\" | \"TOOL_CALL\" | \"CHECKPOINT\" | \"ERROR\" | \"SIGNAL\" | \"TOOL_MESSAGE\";\n\nexport type ConversationMessageStatus =\n | \"PENDING\"\n | \"RUNNING\"\n | \"CANCEL_REQUESTED\"\n | \"CANCELLED\"\n | \"COMPLETED\"\n | \"FAILED\";\n\nexport type ConversationMessageAuthorType = \"USER\" | \"ASSISTANT\" | \"AGENT\" | \"TOOL\";\n\n/** Run states after which nothing runs any more and the server refuses further customer input. */\nexport const CONVERSATION_RUN_STATES_THAT_END_THE_CONVERSATION: readonly ConversationRunState[] = [\n \"COMPLETED\",\n \"CANCELLED\",\n];\n\n/** Maps a stored run state onto the signal's three-value status (`runStateToSignalStatus` of the live-update hook). */\nexport const readConversationRunStatusOfRunState = (\n runState: string | null | undefined,\n): ConversationRunStatus | null => {\n if (!runState) return null;\n if (runState === \"FAILED\") return \"failed\";\n if (runState === \"RUNNING\" || runState === \"AWAITING_DELEGATES\" || runState === \"QUEUED\") return \"running\";\n return \"idle\";\n};\n\n// ── Conversation ─────────────────────────────────────────────────────────────────────────────────────────────────\n\n/** One step of the progress stepper a purposed conversation declares (`CustomerProgressStep`). */\nexport interface ConversationProgressStep {\n /** generic */\n key: string;\n /** generic — already in the owner's language */\n label: string;\n /** generic */\n status: \"done\" | \"active\" | \"upcoming\";\n}\n\n/** A conversation as the chat, the conversation list and the window around the chat read it. */\nexport interface AgentsConversation {\n /** generic */\n id: number;\n /** generic — the key of the agent space the conversation belongs to */\n agentSpaceKey: number | null;\n /** generic */\n runState: ConversationRunState | null;\n /**\n * generic — set while the server owes a turn on an IDLE conversation (a failed hand-over the recovery re-drives);\n * an IDLE conversation with this set counts as running (`effectiveRunState`)\n */\n agentTurnOwedAt: string | null;\n /** generic — the display title (`summary.title`); null until the first title was generated */\n title: string | null;\n /** generic — the owner set the title by hand; the generated title never replaces it then */\n titleManuallyEdited: boolean;\n /** generic — the generated summary of what the conversation is about (`summary.text`); null until generated */\n summary: string | null;\n /** generic — when the conversation was created, in the server's date-time format */\n created: string | null;\n /** generic — when the conversation was last modified, in the server's date-time format */\n updated: string | null;\n /** generic — the purpose of a purposed conversation (e.g. `Example.Build`, a first-run setup purpose); null otherwise */\n purposeName: string | null;\n /** generic — who started the conversation (`SCHEDULE` for a run of a scheduled task) */\n initiatorType: string | null;\n /** generic — the scheduled task a `SCHEDULE` conversation is a run of */\n scheduleId: number | null;\n /** generic — the entry point a start came from; a start from the same entry point reopens this conversation */\n entryPointKey: string | null;\n /** generic — empty unless the purpose declares a progress stepper */\n progressSteps: ConversationProgressStep[];\n /**\n * generic — the id of the newest stored message; null before the first. The polling default of the live updates\n * (`client/polling/`) reads it to see a new message while the run status stays the same, and hands it to the rules as\n * the signal's `lastMessageId`. Optional: a binding with a push transport may leave it out (the host application's metadata\n * read does not carry it); without it the poller treats every poll of a running turn as a change.\n */\n lastMessageId?: number | null;\n /** app extension — the prompt extension of the host application's older AI-Extensions chat */\n promptExtensionId?: number | null;\n /** app extension — the category of that prompt extension (its colour and product name in the conversation list) */\n promptExtensionCategory?: { alias: string | null; name: string | null } | null;\n}\n\n/**\n * What the server's run-state read answers (`GET …/{id}/runState`): the lean subset of a conversation the live updates\n * poll. Every `AgentsConversation` is one, so a binding without the read may answer it with the metadata read.\n */\nexport type ConversationRunStateRead = Pick<\n AgentsConversation,\n \"id\" | \"runState\" | \"agentTurnOwedAt\" | \"title\" | \"titleManuallyEdited\" | \"summary\" | \"updated\"\n> & {\n /** generic — the id of the newest stored message; null before the first */\n lastMessageId?: number | null;\n};\n\n// ── Messages ─────────────────────────────────────────────────────────────────────────────────────────────────────\n\n/** A sub-agent conversation a delegation started, as far as the chat reads it (`delegatedConversations(select=id,runState)`). */\nexport interface ConversationDelegatedConversation {\n /** generic */\n id: number;\n /** generic */\n runState: ConversationRunState | null;\n}\n\n/** One run of a sub-agent, as the activity derivation reads it (`DelegationSubAgentRun`). */\nexport interface ConversationSubAgentRun {\n /** generic */\n runNumber: number | null;\n /** generic */\n status: string | null;\n}\n\n/** The sub-agent record a newer `delegate` call row carries instead of expanded children (`DelegationSubAgentRecord`). */\nexport interface ConversationSubAgent {\n /** generic */\n currentRunNumber: number | null;\n /** generic */\n runs: ConversationSubAgentRun[];\n}\n\n/** The tool call a `TOOL_CALL` row carries, as far as the chat reads it. */\nexport interface ConversationToolCall {\n /** generic */\n toolCallId: string | null;\n /** generic */\n name: string | null;\n /** generic — the call's arguments as the model wrote them (the `delegate` call's `tasks` is read) */\n arguments: unknown;\n /** generic — the call's own progress; a row's `status` says nothing about it */\n status: string | null;\n}\n\n/** The admin debug numbers of one message (the message forensics panel). */\nexport interface ConversationMessageForensics {\n /** app extension */\n inputTokens: number | null;\n /** app extension */\n outputTokens: number | null;\n /** app extension */\n costInUSD: number | null;\n /** app extension — the stored request snapshot of the model call (model name, reasoning effort, sent at) */\n requestSnapshot: unknown;\n}\n\n/** One stored message of a conversation. */\nexport interface AgentsConversationMessage {\n /** generic */\n id: number;\n /** generic */\n conversationId: number | null;\n /** generic — the position in the conversation; the merge key of every page */\n indexInConversation: number | null;\n /** generic */\n role: ConversationMessageRole | null;\n /** generic */\n messageType: ConversationMessageType | null;\n /** generic — non-final only on a waiting signal row */\n status: ConversationMessageStatus | null;\n /** generic */\n authorType: ConversationMessageAuthorType | null;\n /** generic — the source of a SIGNAL or ERROR row (`AI_BUDGET_REACHED`, `FRONTEND_WIDGET_CLICK`, …) */\n signalSource: string | null;\n /** generic — the text in markdown, widget blocks included */\n message: string;\n /** generic */\n createdDate: string | null;\n /** generic */\n toolCall: ConversationToolCall | null;\n /** generic — the sub-agent conversations a `delegate` call started (older rows) */\n delegatedConversations: ConversationDelegatedConversation[];\n /** generic — the sub-agent record of a `delegate` call (newer rows) */\n subAgent: ConversationSubAgent | null;\n /** app extension — admin debug numbers; absent outside the admin surfaces */\n forensics?: ConversationMessageForensics;\n}\n\n/** A file from the app's media library that rides along with a message. */\nexport interface ConversationAttachmentReference {\n /** generic — the app's id of the file (host application: the media manager file id) */\n fileId: string | number | null;\n /** generic */\n fileName: string | null;\n /** generic — a URL the model and the tools can fetch */\n publicUrl: string | null;\n}\n\n// ── Pages and results of the port ────────────────────────────────────────────────────────────────────────────────\n\n/** A page of messages read newest first (the newest page on open, an older page on scroll-up). */\nexport interface ConversationMessagesPage {\n /** generic — in any order; the store merges by `indexInConversation` */\n messages: AgentsConversationMessage[];\n /** generic — an older page exists */\n hasMoreOlder: boolean;\n}\n\n/**\n * What a live update reads: every message written since the newest known id, plus every message from the lowest\n * loaded index that can still change (`build-live-refetch-query.ts`). The package computes both values.\n */\nexport interface ChangedMessagesRequest {\n /** generic — the highest message id loaded */\n highestKnownId: number;\n /** generic — the lowest index that can still change, never below the newest page */\n fromIndex: number;\n /** generic — the page size of the read; the binding's default (host application: 50, as the chat sends) when omitted */\n pageSize?: number;\n}\n\n/** The answer of a changed-messages read; it says nothing about older pages (the store keeps `hasMoreOlder`). */\nexport interface ChangedConversationMessages {\n /** generic */\n messages: AgentsConversationMessage[];\n}\n\n/** The answer of a start: the new conversation with what it holds so far, or the reopened one of the entry point. */\nexport interface StartedConversation {\n /** generic */\n conversation: AgentsConversation;\n /** generic — the stored messages of a new conversation; empty for a reopened one (the chat reads its newest page) */\n messages: AgentsConversationMessage[];\n /** generic — the start returned the recent conversation of its entry point; nothing was appended, no turn started */\n reopenedExisting: boolean;\n}\n\n/**\n * The record a conversation is about: the entity class as the record's `objectType` and its id. The server checks\n * both (a class the application does not allow and a record the user cannot read answer 404).\n */\nexport interface ConversationSubject {\n /** generic — the record's entity class, e.g. `App\\\\Domain\\\\Support\\\\Entities\\\\Tickets\\\\SupportTicket` */\n entityClass: string;\n /** generic */\n entityId: number;\n}\n\n/** The record a purposed conversation works on ({@link ConversationSubject}); the name of before free conversations had subjects. */\nexport type PurposeSubject = ConversationSubject;\n\n/**\n * The record one conversation is bound to, with what the application said about it when the conversation started:\n * its display name and where the owner opens it. `purposeId` is null for a free conversation about the record.\n */\nexport interface BoundConversationSubject extends ConversationSubject {\n /** generic — the conversation that is bound to the record; null for a record named without a conversation */\n conversationId: number | null;\n /** generic — the record's display name when the conversation started; data, never markup */\n name: string | null;\n /** generic — an absolute URL or a path of the application */\n link: string | null;\n /** generic — the purpose of a purposed conversation for the record */\n purposeId: string | null;\n}\n\n/**\n * The user's conversations about one record (`listConversationsOfSubject`) and the record itself as the application\n * names it now: `subject` carries its name and link (no purpose), also when no conversation about it exists yet;\n * null when the answer named no record.\n */\nexport interface ConversationsOfSubject {\n subject: BoundConversationSubject | null;\n /** generic — root conversations, newest first */\n conversations: AgentsConversation[];\n}\n\n/** The start of a purposed conversation (`startPurpose`). */\nexport interface PurposeStartRequest {\n /** generic — the purpose's name, e.g. `Support.AnswerTicket` */\n purposeId: string;\n /** generic — the space the purpose runs in; omitted when the application's route answers its own space */\n agentSpaceKey?: number;\n /** generic — with a subject the open conversation of the same space, purpose and record is reopened */\n subject?: PurposeSubject;\n /** generic — text added to the kickoff of a NEW conversation (at most 4,000 characters) */\n prefill?: string;\n}\n\n/** The conversation a purposed start opened or reopened; the client opens it by its id. */\nexport interface StartedPurposeConversation {\n /** generic */\n conversationId: number;\n /** generic — the open conversation of the same space, purpose (and subject) was reopened */\n resumedExisting: boolean;\n /** generic — the prefill reached the kickoff (false on a reopen and without a prefill) */\n prefillDelivered: boolean;\n}\n\n/** The answer of a post: the conversation's messages so far (the reply arrives through live updates). */\nexport interface PostedMessage {\n /** generic */\n messages: AgentsConversationMessage[];\n}\n\n/** A model-visible, owner-invisible note into a conversation (a widget click, a render report, a correction). */\n/**\n * What the owner's client shows while the owner writes: the route, its parameters, the record on screen and the tab.\n * Sent with a start, a posted message and an injected signal; the server stores it on that owner row and the agent reads\n * the newest one as one line beside the owner's newest message. Each field is optional and capped\n * ({@link AGENTS_CLIENT_CONTEXT_LIMITS}); the server refuses a request with a field over its cap (HTTP 400).\n */\nexport interface AgentsClientContext {\n /** The path of the route the client shows, e.g. `/tickets/42`. */\n routePath?: string | null;\n /** The parameters of that route by name, values as text. */\n routeParameters?: Record<string, string> | null;\n /** The kind of the record on screen, as the application names it, e.g. `ticket`. */\n recordKind?: string | null;\n /** The id of the record on screen. */\n recordId?: string | number | null;\n /** The tab the client shows. */\n tab?: string | null;\n}\n\n/** The caps of {@link AgentsClientContext} (characters; the route parameters as their `name=value&…` text). */\nexport const AGENTS_CLIENT_CONTEXT_LIMITS = {\n routePathChars: 512,\n routeParametersChars: 512,\n routeParameterCount: 20,\n recordKindChars: 64,\n recordIdChars: 128,\n tabChars: 64,\n} as const;\n\nexport interface ConversationSignal {\n /** generic */\n text: string;\n /** generic — the signal source; the server's default applies when omitted (a widget click) */\n source?: string;\n}\n\n/** How a list read pages and which conversations it includes. */\nexport interface ConversationListQueryOptions {\n /** generic — include conversations that have no summary (title) yet, e.g. a just-started one */\n includeUnsummarized?: boolean;\n /** generic — the host application's history reads the newest 50 */\n paging?: { top?: number; skip?: number };\n}\n\n/** The size of a search answer. */\nexport interface ConversationSearchOptions {\n /** generic — the most groups (or hits) returned; the host application's chat asks for 10 */\n limit?: number;\n /** generic — the excerpt length in characters; the host application's chat asks for 420 */\n excerptLength?: number;\n}\n\n/** app extension — the reconstructed request a model call was sent with (the admin details panel); opaque data. */\nexport type ConversationMessageSentPayload = unknown[];\n\n/** One matched message of a message search (`SemanticSearchHit`). */\nexport interface ConversationMessageSearchHit {\n /** generic */\n messageId: number | null;\n /** generic */\n conversationId: number | null;\n /** generic */\n indexInConversation: number | null;\n /** generic */\n role: string | null;\n /** generic */\n excerpt: string;\n /** generic */\n relevance: number;\n /** generic */\n created: string | null;\n /** generic */\n updated: string | null;\n /** generic — the conversation's title */\n title: string | null;\n}\n\n/** One conversation of a search across conversations, with its matched messages (`AIConversationSearchGroup`). */\nexport interface ConversationSearchGroup {\n /** generic */\n conversationId: number | null;\n /** generic */\n title: string | null;\n /** generic */\n summary: string | null;\n /** generic */\n created: string | null;\n /** generic */\n updated: string | null;\n /** generic */\n relevance: number;\n /** generic */\n hits: ConversationMessageSearchHit[];\n}\n\n/** One generated line of what the agent is doing (`AgentActivityLine`). */\nexport interface ConversationActivityElement {\n /** generic — the row the line narrates; the merge key */\n toolCallMessageId: number;\n /** generic */\n batchId: string | null;\n /** generic */\n state: \"queued\" | \"running\" | \"finished\" | \"failed\" | \"skipped\" | null;\n /** generic */\n kind: \"tool\" | \"delegation\" | \"background\" | \"long\" | \"turnStart\" | null;\n /** generic */\n childCount: number | null;\n /** generic — the 1-based delegation helper that ran the step; null for the assistant's own steps */\n helperIndex: number | null;\n /** generic — the sentence; null while the narrator has not answered */\n line: string | null;\n}\n\n/** The activity of one turn (`GET …/activity`). */\nexport interface ConversationActivity {\n /** generic — the message that started the narrated turn */\n turnMessageId: number | null;\n /** generic */\n turnRunning: boolean;\n /** generic */\n elements: ConversationActivityElement[];\n}\n\n/** A model the owner (host application: an impersonating admin) may pick for the next turns (`AgentCustomerSelectableModel`). */\nexport interface SelectableModel {\n /** generic — the name a send carries */\n name: string;\n /** generic */\n displayName: string;\n /** generic */\n description: string;\n /** generic */\n strengthLevel: number | null;\n /** generic */\n speedLevel: number | null;\n /** app extension — the host application's credit multiplier of the model */\n creditsMultiplier?: number | null;\n}\n\n// ── Live updates ─────────────────────────────────────────────────────────────────────────────────────────────────\n\n/**\n * What a live update carries: a claim check, never content. The chat reads the conversation again when\n * `changeCounter` advances, at once on a terminal status, and until `lastMessageId` is loaded.\n */\nexport interface ConversationChangeSignal {\n /** generic — advances on every change of the conversation */\n changeCounter: number;\n /** generic — the newest message the server wrote; null before the first */\n lastMessageId: number | null;\n /** generic */\n runStatus: ConversationRunStatus | null;\n /** generic — advances when the title or summary was generated again (a light metadata read is enough then) */\n summaryUpdatedAt: number | null;\n /**\n * generic — the binding produced this emission from a run-state read, not from a pushed change (a binding without\n * push, or a push transport whose path is not proven readable, or a check that corrects a stale status). It carries\n * only `runStatus` as news: `changeCounter`, `lastMessageId` and `summaryUpdatedAt` repeat the last pushed values\n * (before any push: a counter that counts down from -1, never equal to a pushed one). The package sets the status\n * from it and reads the conversation again on a status change while the push path is not alive (`isPushPathAlive`).\n */\n isStatusCheck?: boolean;\n /**\n * generic, on a status-check emission — the binding's push path delivers: a pushed change arrived and the path was not\n * denied since. False after a denied read until a push arrives again; then the status checks are the live path and a\n * status change reads the conversation again. A binding without push leaves it out: the package then counts the\n * pushed changes it saw itself.\n */\n isPushPathAlive?: boolean;\n}\n\n/** Why a subscription ended for good: the conversation was deleted or is no longer readable, or the account lost access. */\nexport type ConversationSubscriptionEndReason = \"gone\" | \"forbidden\";\n\n// ── Errors ───────────────────────────────────────────────────────────────────────────────────────────────────────\n\n/**\n * What went wrong, as the chat tells the owner. The codes the chat's error handling reads today map\n * onto it: `AI_BUDGET_REACHED` → `budget`, HTTP 429 / `RATE_LIMIT_EXCEEDED` → `rateLimit`, `CONVERSATION_CLOSED` →\n * `closed`, the not-found and no-access answers → `notFound` / `forbidden` (`conversation-not-found.ts`), no answer or a\n * server failure → `network`, everything else (a refused retry, a cancelled request) → `other` with its `code`.\n */\nexport type AgentsClientErrorKind = \"budget\" | \"rateLimit\" | \"closed\" | \"notFound\" | \"forbidden\" | \"network\" | \"other\";\n\n/** The code `other` carries for a request the client cancelled; the chat shows no error card for it. */\nexport const AGENTS_CLIENT_ERROR_CODE_REQUEST_ABORTED = \"REQUEST_ABORTED\";\n\n/** The one error shape every port function rejects with. */\nexport class AgentsClientError extends Error {\n readonly kind: AgentsClientErrorKind;\n /** The server's stable error code, or the client's own code (`REQUEST_ABORTED`); null when none arrived. */\n readonly code: string | null;\n /** Seconds until a quota frees up again; set only for `rateLimit`. */\n readonly retryAfterSeconds: number | null;\n /** The HTTP status when one arrived (not part of the contract's shape; kept for diagnostics). */\n readonly httpStatus: number | null;\n\n constructor(\n kind: AgentsClientErrorKind,\n details: { message?: string; code?: string | null; retryAfterSeconds?: number | null; httpStatus?: number | null } = {},\n ) {\n super(details.message ?? kind);\n this.name = \"AgentsClientError\";\n this.kind = kind;\n this.code = details.code ?? null;\n this.retryAfterSeconds = kind === \"rateLimit\" ? (details.retryAfterSeconds ?? null) : null;\n this.httpStatus = details.httpStatus ?? null;\n }\n}\n\nexport const isAgentsClientError = (value: unknown): value is AgentsClientError => value instanceof AgentsClientError;\n"],"names":[],"mappings":";AAiDO,MAAM,oDAAqF;AAAA,EAChG;AAAA,EACA;AACF;AAGO,MAAM,sCAAsC,CACjD,aACiC;AACjC,MAAI,CAAC,SAAU,QAAO;AACtB,MAAI,aAAa,SAAU,QAAO;AAClC,MAAI,aAAa,aAAa,aAAa,wBAAwB,aAAa,SAAU,QAAO;AACjG,SAAO;AACT;AAoSO,MAAM,+BAA+B;AAAA,EAC1C,gBAAgB;AAAA,EAChB,sBAAsB;AAAA,EACtB,qBAAqB;AAAA,EACrB,iBAAiB;AAAA,EACjB,eAAe;AAAA,EACf,UAAU;AACZ;AA8JO,MAAM,2CAA2C;AAGjD,MAAM,0BAA0B,MAAM;AAAA,EAS3C,YACE,MACA,UAAqH,IACrH;AACA,UAAM,QAAQ,WAAW,IAAI;AAC7B,SAAK,OAAO;AACZ,SAAK,OAAO;AACZ,SAAK,OAAO,QAAQ,QAAQ;AAC5B,SAAK,oBAAoB,SAAS,cAAe,QAAQ,qBAAqB,OAAQ;AACtF,SAAK,aAAa,QAAQ,cAAc;AAAA,EAC1C;AACF;AAEO,MAAM,sBAAsB,CAAC,UAA+C,iBAAiB;"}
|
|
1
|
+
{"version":3,"file":"conversation-B7-evdj_.js","sources":["../../src/contract/conversation.ts"],"sourcesContent":["/**\n * The conversation contract of the package: plain TypeScript types the conversation client port\n * (`client/AgentsConversationClient.ts`) returns and the chat reads. Every field is derived from what the chat files and\n * the chat controller read from the server today (the host application's generated `AIConversation`, `AIConversationMessage`,\n * `AgentActivityLine`, `SemanticSearchHit`, `AIConversationSearchGroup`, `AgentCustomerSelectableModel`); nothing the\n * chat does not read is here.\n *\n * Naming: a field keeps the wire name where the name is neutral (`message`, `indexInConversation`, `role`, `status`,\n * `toolCall`); a name that carries an app's vocabulary is renamed (`aiConversationId` → `conversationId`,\n * the app's own key of the thing the agent works for → `agentSpaceKey`, `summary.title` → `title`). Each field carries a\n * one-line note:\n * - `generic` — every app that runs the agent conversation backend has it;\n * - `app extension` — read by the chat today but specific to one app's backend or debug surface; optional, and a\n * binding may leave it out.\n *\n * Client-side state is NOT part of the contract: the `fresh` tag of a live-arrived message, the optimistic user\n * message without an id and the `isNewConversation` / `isReopenedConversation` flags belong to the package store.\n */\n\n// ── Vocabulary ───────────────────────────────────────────────────────────────────────────────────────────────────\n\n/** The run state of a conversation as the server stores it (`AIConversationRunState`). */\nexport type ConversationRunState =\n | \"IDLE\"\n | \"QUEUED\"\n | \"RUNNING\"\n | \"AWAITING_DELEGATES\"\n | \"FAILED\"\n | \"COMPLETED\"\n | \"CANCELLED\";\n\n/** The three-value run status the live-update signal speaks; the chat keys its indicator and error card off it. */\nexport type ConversationRunStatus = \"running\" | \"idle\" | \"failed\";\n\nexport type ConversationMessageRole = \"SYSTEM\" | \"USER\" | \"ASSISTANT\";\n\nexport type ConversationMessageType = \"TEXT\" | \"TOOL_CALL\" | \"CHECKPOINT\" | \"ERROR\" | \"SIGNAL\" | \"TOOL_MESSAGE\";\n\nexport type ConversationMessageStatus =\n | \"PENDING\"\n | \"RUNNING\"\n | \"CANCEL_REQUESTED\"\n | \"CANCELLED\"\n | \"COMPLETED\"\n | \"FAILED\";\n\nexport type ConversationMessageAuthorType = \"USER\" | \"ASSISTANT\" | \"AGENT\" | \"TOOL\";\n\n/** Run states after which nothing runs any more and the server refuses further customer input. */\nexport const CONVERSATION_RUN_STATES_THAT_END_THE_CONVERSATION: readonly ConversationRunState[] = [\n \"COMPLETED\",\n \"CANCELLED\",\n];\n\n/** Maps a stored run state onto the signal's three-value status (`runStateToSignalStatus` of the live-update hook). */\nexport const readConversationRunStatusOfRunState = (\n runState: string | null | undefined,\n): ConversationRunStatus | null => {\n if (!runState) return null;\n if (runState === \"FAILED\") return \"failed\";\n if (runState === \"RUNNING\" || runState === \"AWAITING_DELEGATES\" || runState === \"QUEUED\") return \"running\";\n return \"idle\";\n};\n\n// ── Conversation ─────────────────────────────────────────────────────────────────────────────────────────────────\n\n/** One step of the progress stepper a purposed conversation declares (`CustomerProgressStep`). */\nexport interface ConversationProgressStep {\n /** generic */\n key: string;\n /** generic — already in the owner's language */\n label: string;\n /** generic */\n status: \"done\" | \"active\" | \"upcoming\";\n}\n\n/** A conversation as the chat, the conversation list and the window around the chat read it. */\nexport interface AgentsConversation {\n /** generic */\n id: number;\n /** generic — the key of the agent space the conversation belongs to */\n agentSpaceKey: number | null;\n /** generic */\n runState: ConversationRunState | null;\n /**\n * generic — set while the server owes a turn on an IDLE conversation (a failed hand-over the recovery re-drives);\n * an IDLE conversation with this set counts as running (`effectiveRunState`)\n */\n agentTurnOwedAt: string | null;\n /** generic — the display title (`summary.title`); null until the first title was generated */\n title: string | null;\n /** generic — the owner set the title by hand; the generated title never replaces it then */\n titleManuallyEdited: boolean;\n /** generic — the generated summary of what the conversation is about (`summary.text`); null until generated */\n summary: string | null;\n /** generic — when the conversation was created, in the server's date-time format */\n created: string | null;\n /** generic — when the conversation was last modified, in the server's date-time format */\n updated: string | null;\n /** generic — the purpose of a purposed conversation (e.g. `Example.Build`, a first-run setup purpose); null otherwise */\n purposeName: string | null;\n /** generic — who started the conversation (`SCHEDULE` for a run of a scheduled task) */\n initiatorType: string | null;\n /** generic — the scheduled task a `SCHEDULE` conversation is a run of */\n scheduleId: number | null;\n /** generic — the entry point a start came from; a start from the same entry point reopens this conversation */\n entryPointKey: string | null;\n /** generic — empty unless the purpose declares a progress stepper */\n progressSteps: ConversationProgressStep[];\n /**\n * generic — the id of the newest stored message; null before the first. The polling default of the live updates\n * (`client/polling/`) reads it to see a new message while the run status stays the same, and hands it to the rules as\n * the signal's `lastMessageId`. Optional: a binding with a push transport may leave it out (the host application's metadata\n * read does not carry it); without it the poller treats every poll of a running turn as a change.\n */\n lastMessageId?: number | null;\n /** app extension — the prompt extension of the host application's older AI-Extensions chat */\n promptExtensionId?: number | null;\n /** app extension — the category of that prompt extension (its colour and product name in the conversation list) */\n promptExtensionCategory?: { alias: string | null; name: string | null } | null;\n}\n\n/**\n * What the server's run-state read answers (`GET …/{id}/runState`): the lean subset of a conversation the live updates\n * poll. Every `AgentsConversation` is one, so a binding without the read may answer it with the metadata read.\n */\nexport type ConversationRunStateRead = Pick<\n AgentsConversation,\n \"id\" | \"runState\" | \"agentTurnOwedAt\" | \"title\" | \"titleManuallyEdited\" | \"summary\" | \"updated\"\n> & {\n /** generic — the id of the newest stored message; null before the first */\n lastMessageId?: number | null;\n};\n\n// ── Messages ─────────────────────────────────────────────────────────────────────────────────────────────────────\n\n/** A sub-agent conversation a delegation started, as far as the chat reads it (`delegatedConversations(select=id,runState)`). */\nexport interface ConversationDelegatedConversation {\n /** generic */\n id: number;\n /** generic */\n runState: ConversationRunState | null;\n}\n\n/** One run of a sub-agent, as the activity derivation reads it (`DelegationSubAgentRun`). */\nexport interface ConversationSubAgentRun {\n /** generic */\n runNumber: number | null;\n /** generic */\n status: string | null;\n}\n\n/** The sub-agent record a newer `delegate` call row carries instead of expanded children (`DelegationSubAgentRecord`). */\nexport interface ConversationSubAgent {\n /** generic */\n currentRunNumber: number | null;\n /** generic */\n runs: ConversationSubAgentRun[];\n}\n\n/** The tool call a `TOOL_CALL` row carries, as far as the chat reads it. */\nexport interface ConversationToolCall {\n /** generic */\n toolCallId: string | null;\n /** generic */\n name: string | null;\n /** generic — the call's arguments as the model wrote them (the `delegate` call's `tasks` is read) */\n arguments: unknown;\n /** generic — the call's own progress; a row's `status` says nothing about it */\n status: string | null;\n}\n\n/** The admin debug numbers of one message (the message forensics panel). */\nexport interface ConversationMessageForensics {\n /** app extension */\n inputTokens: number | null;\n /** app extension */\n outputTokens: number | null;\n /** app extension */\n costInUSD: number | null;\n /** app extension — the stored request snapshot of the model call (model name, reasoning effort, sent at) */\n requestSnapshot: unknown;\n}\n\n/** One stored message of a conversation. */\nexport interface AgentsConversationMessage {\n /** generic */\n id: number;\n /** generic */\n conversationId: number | null;\n /** generic — the position in the conversation; the merge key of every page */\n indexInConversation: number | null;\n /** generic */\n role: ConversationMessageRole | null;\n /** generic */\n messageType: ConversationMessageType | null;\n /** generic — non-final only on a waiting signal row */\n status: ConversationMessageStatus | null;\n /** generic */\n authorType: ConversationMessageAuthorType | null;\n /** generic — the source of a SIGNAL or ERROR row (`AI_BUDGET_REACHED`, `FRONTEND_WIDGET_CLICK`, …) */\n signalSource: string | null;\n /** generic — the text in markdown, widget blocks included */\n message: string;\n /** generic */\n createdDate: string | null;\n /** generic */\n toolCall: ConversationToolCall | null;\n /** generic — the sub-agent conversations a `delegate` call started (older rows) */\n delegatedConversations: ConversationDelegatedConversation[];\n /** generic — the sub-agent record of a `delegate` call (newer rows) */\n subAgent: ConversationSubAgent | null;\n /** app extension — admin debug numbers; absent outside the admin surfaces */\n forensics?: ConversationMessageForensics;\n}\n\n/** A file from the app's media library that rides along with a message. */\nexport interface ConversationAttachmentReference {\n /** generic — the app's id of the file (host application: the media manager file id) */\n fileId: string | number | null;\n /** generic */\n fileName: string | null;\n /** generic — a URL the model and the tools can fetch */\n publicUrl: string | null;\n}\n\n// ── Pages and results of the port ────────────────────────────────────────────────────────────────────────────────\n\n/** A page of messages read newest first (the newest page on open, an older page on scroll-up). */\nexport interface ConversationMessagesPage {\n /** generic — in any order; the store merges by `indexInConversation` */\n messages: AgentsConversationMessage[];\n /** generic — an older page exists */\n hasMoreOlder: boolean;\n}\n\n/**\n * What a live update reads: every message written since the newest known id, plus every message from the lowest\n * loaded index that can still change (`build-live-refetch-query.ts`). The package computes both values.\n */\nexport interface ChangedMessagesRequest {\n /** generic — the highest message id loaded */\n highestKnownId: number;\n /** generic — the lowest index that can still change, never below the newest page */\n fromIndex: number;\n /** generic — the page size of the read; the binding's default (host application: 50, as the chat sends) when omitted */\n pageSize?: number;\n}\n\n/** The answer of a changed-messages read; it says nothing about older pages (the store keeps `hasMoreOlder`). */\nexport interface ChangedConversationMessages {\n /** generic */\n messages: AgentsConversationMessage[];\n}\n\n/** The answer of a start: the new conversation with what it holds so far, or the reopened one of the entry point. */\nexport interface StartedConversation {\n /** generic */\n conversation: AgentsConversation;\n /** generic — the stored messages of a new conversation; empty for a reopened one (the chat reads its newest page) */\n messages: AgentsConversationMessage[];\n /** generic — the start returned the recent conversation of its entry point; nothing was appended, no turn started */\n reopenedExisting: boolean;\n}\n\n/**\n * The record a conversation is about: the entity class as the record's `objectType` and its id. The server checks\n * both (a class the application does not allow and a record the user cannot read answer 404).\n */\nexport interface ConversationSubject {\n /** generic — the record's entity class, e.g. `App\\\\Domain\\\\Support\\\\Entities\\\\Tickets\\\\SupportTicket` */\n entityClass: string;\n /** generic */\n entityId: number;\n}\n\n/** The record a purposed conversation works on ({@link ConversationSubject}); the name of before free conversations had subjects. */\nexport type PurposeSubject = ConversationSubject;\n\n/**\n * The record one conversation is bound to, with what the application said about it when the conversation started:\n * its display name and where the owner opens it. `purposeId` is null for a free conversation about the record.\n */\nexport interface BoundConversationSubject extends ConversationSubject {\n /** generic — the conversation that is bound to the record; null for a record named without a conversation */\n conversationId: number | null;\n /** generic — the record's display name when the conversation started; data, never markup */\n name: string | null;\n /** generic — an absolute URL or a path of the application */\n link: string | null;\n /** generic — the purpose of a purposed conversation for the record */\n purposeId: string | null;\n}\n\n/**\n * The user's conversations about one record (`listConversationsOfSubject`) and the record itself as the application\n * names it now: `subject` carries its name and link (no purpose), also when no conversation about it exists yet;\n * null when the answer named no record.\n */\nexport interface ConversationsOfSubject {\n subject: BoundConversationSubject | null;\n /** generic — root conversations, newest first */\n conversations: AgentsConversation[];\n}\n\n/** The start of a purposed conversation (`startPurpose`). */\nexport interface PurposeStartRequest {\n /** generic — the purpose's name, e.g. `Support.AnswerTicket` */\n purposeId: string;\n /** generic — the space the purpose runs in; omitted when the application's route answers its own space */\n agentSpaceKey?: number;\n /** generic — with a subject the open conversation of the same space, purpose and record is reopened */\n subject?: PurposeSubject;\n /** generic — text added to the kickoff of a NEW conversation (at most 4,000 characters) */\n prefill?: string;\n}\n\n/** The conversation a purposed start opened or reopened; the client opens it by its id. */\nexport interface StartedPurposeConversation {\n /** generic */\n conversationId: number;\n /** generic — the open conversation of the same space, purpose (and subject) was reopened */\n resumedExisting: boolean;\n /** generic — the prefill reached the kickoff (false on a reopen and without a prefill) */\n prefillDelivered: boolean;\n}\n\n/** The answer of a post: the conversation's messages so far (the reply arrives through live updates). */\nexport interface PostedMessage {\n /** generic */\n messages: AgentsConversationMessage[];\n}\n\n/** A model-visible, owner-invisible note into a conversation (a widget click, a render report, a correction). */\n/**\n * What the owner's client shows while the owner writes: the route, its parameters, the record on screen and the tab.\n * Sent with a start, a posted message and an injected signal; the server stores it on that owner row and the agent reads\n * the newest one as one line beside the owner's newest message. Each field is optional and capped\n * ({@link AGENTS_CLIENT_CONTEXT_LIMITS}); the server refuses a request with a field over its cap (HTTP 400).\n */\nexport interface AgentsClientContext {\n /** The path of the route the client shows, e.g. `/tickets/42`. */\n routePath?: string | null;\n /** The parameters of that route by name, values as text. */\n routeParameters?: Record<string, string> | null;\n /** The kind of the record on screen, as the application names it, e.g. `ticket`. */\n recordKind?: string | null;\n /** The id of the record on screen. */\n recordId?: string | number | null;\n /** The tab the client shows. */\n tab?: string | null;\n}\n\n/** The caps of {@link AgentsClientContext} (characters; the route parameters as their `name=value&…` text). */\nexport const AGENTS_CLIENT_CONTEXT_LIMITS = {\n routePathChars: 512,\n routeParametersChars: 512,\n routeParameterCount: 20,\n recordKindChars: 64,\n recordIdChars: 128,\n tabChars: 64,\n} as const;\n\nexport interface ConversationSignal {\n /** generic */\n text: string;\n /** generic — the signal source; the server's default applies when omitted (a widget click) */\n source?: string;\n}\n\n/** How a list read pages and which conversations it includes. */\nexport interface ConversationListQueryOptions {\n /** generic — include conversations that have no summary (title) yet, e.g. a just-started one */\n includeUnsummarized?: boolean;\n /** generic — the host application's history reads the newest 50 */\n paging?: { top?: number; skip?: number };\n}\n\n/** The size of a search answer. */\nexport interface ConversationSearchOptions {\n /** generic — the most groups (or hits) returned; the host application's chat asks for 10 */\n limit?: number;\n /** generic — the excerpt length in characters; the host application's chat asks for 420 */\n excerptLength?: number;\n}\n\n/** app extension — the reconstructed request a model call was sent with (the admin details panel); opaque data. */\nexport type ConversationMessageSentPayload = unknown[];\n\n/** One matched message of a message search (`SemanticSearchHit`). */\nexport interface ConversationMessageSearchHit {\n /** generic */\n messageId: number | null;\n /** generic */\n conversationId: number | null;\n /** generic */\n indexInConversation: number | null;\n /** generic */\n role: string | null;\n /** generic */\n excerpt: string;\n /** generic */\n relevance: number;\n /** generic */\n created: string | null;\n /** generic */\n updated: string | null;\n /** generic — the conversation's title */\n title: string | null;\n}\n\n/** One conversation of a search across conversations, with its matched messages (`AIConversationSearchGroup`). */\nexport interface ConversationSearchGroup {\n /** generic */\n conversationId: number | null;\n /** generic */\n title: string | null;\n /** generic */\n summary: string | null;\n /** generic */\n created: string | null;\n /** generic */\n updated: string | null;\n /** generic */\n relevance: number;\n /** generic */\n hits: ConversationMessageSearchHit[];\n}\n\n/** One generated line of what the agent is doing (`AgentActivityLine`). */\nexport interface ConversationActivityElement {\n /** generic — the row the line narrates; the merge key */\n toolCallMessageId: number;\n /** generic */\n batchId: string | null;\n /** generic */\n state: \"queued\" | \"running\" | \"finished\" | \"failed\" | \"skipped\" | null;\n /** generic */\n kind: \"tool\" | \"delegation\" | \"background\" | \"long\" | \"turnStart\" | null;\n /** generic */\n childCount: number | null;\n /** generic — the 1-based delegation helper that ran the step; null for the assistant's own steps */\n helperIndex: number | null;\n /** generic — the sentence; null while the narrator has not answered */\n line: string | null;\n}\n\n/** The activity of one turn (`GET …/activity`). */\nexport interface ConversationActivity {\n /** generic — the message that started the narrated turn */\n turnMessageId: number | null;\n /** generic */\n turnRunning: boolean;\n /** generic */\n elements: ConversationActivityElement[];\n}\n\n/** A model the owner (host application: an impersonating admin) may pick for the next turns (`AgentCustomerSelectableModel`). */\nexport interface SelectableModel {\n /** generic — the name a send carries */\n name: string;\n /** generic */\n displayName: string;\n /** generic */\n description: string;\n /** generic */\n strengthLevel: number | null;\n /** generic */\n speedLevel: number | null;\n /** app extension — the host application's credit multiplier of the model */\n creditsMultiplier?: number | null;\n}\n\n// ── Live updates ─────────────────────────────────────────────────────────────────────────────────────────────────\n\n/**\n * What a live update carries: a claim check, never content. The chat reads the conversation again when\n * `changeCounter` advances, at once on a terminal status, and until `lastMessageId` is loaded.\n */\nexport interface ConversationChangeSignal {\n /** generic — advances on every change of the conversation */\n changeCounter: number;\n /** generic — the newest message the server wrote; null before the first */\n lastMessageId: number | null;\n /** generic */\n runStatus: ConversationRunStatus | null;\n /** generic — advances when the title or summary was generated again (a light metadata read is enough then) */\n summaryUpdatedAt: number | null;\n /**\n * generic — the binding produced this emission from a run-state read, not from a pushed change (a binding without\n * push, or a push transport whose path is not proven readable, or a check that corrects a stale status). It carries\n * only `runStatus` as news: `changeCounter`, `lastMessageId` and `summaryUpdatedAt` repeat the last pushed values\n * (before any push: a counter that counts down from -1, never equal to a pushed one). The package sets the status\n * from it and reads the conversation again on a status change while the push path is not alive (`isPushPathAlive`).\n */\n isStatusCheck?: boolean;\n /**\n * generic, on a status-check emission — the binding's push path delivers: a pushed change arrived and the path was not\n * denied since. False after a denied read until a push arrives again; then the status checks are the live path and a\n * status change reads the conversation again. A binding without push leaves it out: the package then counts the\n * pushed changes it saw itself.\n */\n isPushPathAlive?: boolean;\n}\n\n/** Why a subscription ended for good: the conversation was deleted or is no longer readable, or the account lost access. */\nexport type ConversationSubscriptionEndReason = \"gone\" | \"forbidden\";\n\n// ── Errors ───────────────────────────────────────────────────────────────────────────────────────────────────────\n\n/**\n * What went wrong, as the chat tells the owner. The codes the chat's error handling reads today map\n * onto it: `AI_BUDGET_REACHED` → `budget`, HTTP 429 / `RATE_LIMIT_EXCEEDED` → `rateLimit`, `CONVERSATION_CLOSED` →\n * `closed`, the not-found and no-access answers → `notFound` / `forbidden` (`conversation-not-found.ts`), no answer or a\n * server failure → `network`, everything else (a refused retry, a cancelled request) → `other` with its `code`.\n */\nexport type AgentsClientErrorKind = \"budget\" | \"rateLimit\" | \"closed\" | \"notFound\" | \"forbidden\" | \"network\" | \"other\";\n\n/** The code `other` carries for a request the client cancelled; the chat shows no error card for it. */\nexport const AGENTS_CLIENT_ERROR_CODE_REQUEST_ABORTED = \"REQUEST_ABORTED\";\n\n/** The one error shape every port function rejects with. */\nexport class AgentsClientError extends Error {\n readonly kind: AgentsClientErrorKind;\n /** The server's stable error code, or the client's own code (`REQUEST_ABORTED`); null when none arrived. */\n readonly code: string | null;\n /** Seconds until a quota frees up again; set only for `rateLimit`. */\n readonly retryAfterSeconds: number | null;\n /** The HTTP status when one arrived (not part of the contract's shape; kept for diagnostics). */\n readonly httpStatus: number | null;\n\n constructor(\n kind: AgentsClientErrorKind,\n details: { message?: string; code?: string | null; retryAfterSeconds?: number | null; httpStatus?: number | null } = {},\n ) {\n super(details.message ?? kind);\n this.name = \"AgentsClientError\";\n this.kind = kind;\n this.code = details.code ?? null;\n this.retryAfterSeconds = kind === \"rateLimit\" ? (details.retryAfterSeconds ?? null) : null;\n this.httpStatus = details.httpStatus ?? null;\n }\n}\n\nexport const isAgentsClientError = (value: unknown): value is AgentsClientError => value instanceof AgentsClientError;\n"],"names":[],"mappings":";AAiDO,MAAM,oDAAqF;AAAA,EAChG;AAAA,EACA;AACF;AAGO,MAAM,sCAAsC,CACjD,aACiC;AACjC,MAAI,CAAC,SAAU,QAAO;AACtB,MAAI,aAAa,SAAU,QAAO;AAClC,MAAI,aAAa,aAAa,aAAa,wBAAwB,aAAa,SAAU,QAAO;AACjG,SAAO;AACT;AAoSO,MAAM,+BAA+B;AAAA,EAC1C,gBAAgB;AAAA,EAChB,sBAAsB;AAAA,EACtB,qBAAqB;AAAA,EACrB,iBAAiB;AAAA,EACjB,eAAe;AAAA,EACf,UAAU;AACZ;AA8JO,MAAM,2CAA2C;AAGjD,MAAM,0BAA0B,MAAM;AAAA,EAS3C,YACE,MACA,UAAqH,IACrH;AACA,UAAM,QAAQ,WAAW,IAAI;AAC7B,SAAK,OAAO;AACZ,SAAK,OAAO;AACZ,SAAK,OAAO,QAAQ,QAAQ;AAC5B,SAAK,oBAAoB,SAAS,cAAe,QAAQ,qBAAqB,OAAQ;AACtF,SAAK,aAAa,QAAQ,cAAc;AAAA,EAC1C;AACF;AAEO,MAAM,sBAAsB,CAAC,UAA+C,iBAAiB;"}
|
|
@@ -7,6 +7,7 @@ const AGENTS_ICON_NAMES = [
|
|
|
7
7
|
"arrowRight",
|
|
8
8
|
"arrowUp",
|
|
9
9
|
"barChart",
|
|
10
|
+
"branch",
|
|
10
11
|
"browser",
|
|
11
12
|
"budget",
|
|
12
13
|
"business",
|
|
@@ -15,10 +16,17 @@ const AGENTS_ICON_NAMES = [
|
|
|
15
16
|
"caretLeft",
|
|
16
17
|
"caretUp",
|
|
17
18
|
"check",
|
|
19
|
+
"chevronDown",
|
|
20
|
+
"chevronRight",
|
|
18
21
|
"clock",
|
|
19
22
|
"close",
|
|
20
23
|
"closeCanvas",
|
|
24
|
+
"code",
|
|
25
|
+
"compaction",
|
|
26
|
+
"copy",
|
|
27
|
+
"cost",
|
|
21
28
|
"dash",
|
|
29
|
+
"decision",
|
|
22
30
|
"desktop",
|
|
23
31
|
"details",
|
|
24
32
|
"directions",
|
|
@@ -28,6 +36,13 @@ const AGENTS_ICON_NAMES = [
|
|
|
28
36
|
"edit",
|
|
29
37
|
"event",
|
|
30
38
|
"exclamation",
|
|
39
|
+
"external",
|
|
40
|
+
"file",
|
|
41
|
+
"fileAdd",
|
|
42
|
+
"fileDelete",
|
|
43
|
+
"fileEdit",
|
|
44
|
+
"fileMove",
|
|
45
|
+
"folderAdd",
|
|
31
46
|
"google",
|
|
32
47
|
"help",
|
|
33
48
|
"home",
|
|
@@ -48,6 +63,7 @@ const AGENTS_ICON_NAMES = [
|
|
|
48
63
|
"messageNeutral",
|
|
49
64
|
"minimize",
|
|
50
65
|
"mobile",
|
|
66
|
+
"model",
|
|
51
67
|
"newTab",
|
|
52
68
|
"news",
|
|
53
69
|
"notification",
|
|
@@ -57,6 +73,7 @@ const AGENTS_ICON_NAMES = [
|
|
|
57
73
|
"pinFilled",
|
|
58
74
|
"play",
|
|
59
75
|
"post",
|
|
76
|
+
"preview",
|
|
60
77
|
"prize",
|
|
61
78
|
"question",
|
|
62
79
|
"refresh",
|
|
@@ -65,17 +82,31 @@ const AGENTS_ICON_NAMES = [
|
|
|
65
82
|
"searchEngines",
|
|
66
83
|
"settings",
|
|
67
84
|
"shield",
|
|
85
|
+
"signal",
|
|
86
|
+
"skill",
|
|
68
87
|
"sorting",
|
|
69
88
|
"star",
|
|
70
89
|
"starActive",
|
|
90
|
+
"stepDone",
|
|
91
|
+
"stepError",
|
|
92
|
+
"stepFailed",
|
|
93
|
+
"stepWaiting",
|
|
94
|
+
"steps",
|
|
95
|
+
"subAgent",
|
|
71
96
|
"tablet",
|
|
72
97
|
"tag",
|
|
98
|
+
"terminal",
|
|
73
99
|
"text",
|
|
100
|
+
"thinking",
|
|
101
|
+
"toolRead",
|
|
102
|
+
"toolWrite",
|
|
74
103
|
"trash",
|
|
104
|
+
"undo",
|
|
75
105
|
"upload",
|
|
76
106
|
"user",
|
|
77
107
|
"visibility",
|
|
78
108
|
"warning",
|
|
109
|
+
"widget",
|
|
79
110
|
"wizard"
|
|
80
111
|
];
|
|
81
112
|
const isAgentsIconName = (value) => typeof value === "string" && AGENTS_ICON_NAMES.includes(value);
|
|
@@ -83,4 +114,4 @@ export {
|
|
|
83
114
|
AGENTS_ICON_NAMES as A,
|
|
84
115
|
isAgentsIconName as i
|
|
85
116
|
};
|
|
86
|
-
//# sourceMappingURL=icon-names-
|
|
117
|
+
//# sourceMappingURL=icon-names-C5PeVvkJ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icon-names-C5PeVvkJ.js","sources":["../../src/provider/components/icon-names.ts"],"sourcesContent":["/**\n * The icons package code uses, by name. The list is the contract: an app's `Icon` replacement maps every name, the\n * package default draws every name. Extend it only together with the default drawing. It holds the names package\n * components draw and every name a composed `Icon` node may carry (`IconComposedViewNode::ICON_NAMES`). The names of\n * the trace blocks (`chat/trace`: `terminal`, `thinking`, `subAgent`, `fileEdit`, `stepDone`, …) are drawn by the\n * default as line drawings (`$agents-icon-line-drawings`), every other name as a text glyph.\n */\nexport const AGENTS_ICON_NAMES = [\n \"add\",\n \"ai\",\n \"arrowDown\",\n \"arrowLeft\",\n \"arrowRight\",\n \"arrowUp\",\n \"barChart\",\n \"branch\",\n \"browser\",\n \"budget\",\n \"business\",\n \"calendar\",\n \"caretDown\",\n \"caretLeft\",\n \"caretUp\",\n \"check\",\n \"chevronDown\",\n \"chevronRight\",\n \"clock\",\n \"close\",\n \"closeCanvas\",\n \"code\",\n \"compaction\",\n \"copy\",\n \"cost\",\n \"dash\",\n \"decision\",\n \"desktop\",\n \"details\",\n \"directions\",\n \"document\",\n \"download\",\n \"duplicate\",\n \"edit\",\n \"event\",\n \"exclamation\",\n \"external\",\n \"file\",\n \"fileAdd\",\n \"fileDelete\",\n \"fileEdit\",\n \"fileMove\",\n \"folderAdd\",\n \"google\",\n \"help\",\n \"home\",\n \"image\",\n \"info\",\n \"like\",\n \"lineChart\",\n \"link\",\n \"location\",\n \"lock\",\n \"lockOpen\",\n \"mail\",\n \"maps\",\n \"maximize\",\n \"message\",\n \"messageBad\",\n \"messageGood\",\n \"messageNeutral\",\n \"minimize\",\n \"mobile\",\n \"model\",\n \"newTab\",\n \"news\",\n \"notification\",\n \"pause\",\n \"phone\",\n \"photo\",\n \"pinFilled\",\n \"play\",\n \"post\",\n \"preview\",\n \"prize\",\n \"question\",\n \"refresh\",\n \"remove\",\n \"search\",\n \"searchEngines\",\n \"settings\",\n \"shield\",\n \"signal\",\n \"skill\",\n \"sorting\",\n \"star\",\n \"starActive\",\n \"stepDone\",\n \"stepError\",\n \"stepFailed\",\n \"stepWaiting\",\n \"steps\",\n \"subAgent\",\n \"tablet\",\n \"tag\",\n \"terminal\",\n \"text\",\n \"thinking\",\n \"toolRead\",\n \"toolWrite\",\n \"trash\",\n \"undo\",\n \"upload\",\n \"user\",\n \"visibility\",\n \"warning\",\n \"widget\",\n \"wizard\",\n] as const;\n\nexport type AgentsIconName = (typeof AGENTS_ICON_NAMES)[number];\n\n/** Whether a string is a package icon name (a name a model or a record wrote). */\nexport const isAgentsIconName = (value: unknown): value is AgentsIconName =>\n typeof value === \"string\" && (AGENTS_ICON_NAMES as readonly string[]).includes(value);\n"],"names":[],"mappings":";AAOO,MAAM,oBAAoB;AAAA,EAC/B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAKO,MAAM,mBAAmB,CAAC,UAC/B,OAAO,UAAU,YAAa,kBAAwC,SAAS,KAAK;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
3
3
|
import { useSyncExternalStore, useMemo, useRef, useEffect, useState, useCallback, useContext, createContext } from "react";
|
|
4
|
-
import { A as AgentsConversationClientProvider } from "./AgentsConversationClientContext-
|
|
4
|
+
import { A as AgentsConversationClientProvider } from "./AgentsConversationClientContext-B_UJSLXU.js";
|
|
5
5
|
import ReactMarkdown from "react-markdown";
|
|
6
6
|
import remarkGfm from "remark-gfm";
|
|
7
7
|
const SLICE_NAME = "widgetHydrationSlice";
|
|
@@ -418,7 +418,8 @@ const DefaultSplitView = (props) => {
|
|
|
418
418
|
const coversMain = coversBelowWidth !== void 0 && splitViewWidth !== null && splitViewWidth < coversBelowWidth;
|
|
419
419
|
const isMainCovered = isSideOpen && coversMain;
|
|
420
420
|
const floatsReopenOverMain = coversMain && !isSideOpen && !sideToggle?.mainPaneShowsReopen;
|
|
421
|
-
const
|
|
421
|
+
const floatsCloseOverSide = isMainCovered && !sideToggle?.sidePaneShowsClose;
|
|
422
|
+
const togglesFloat = floatsCloseOverSide || floatsReopenOverMain;
|
|
422
423
|
const toggleLabel = useTranslatedText(isSideOpen ? "Close canvas" : "Re-open canvas");
|
|
423
424
|
const sidePaneRef = useRef(null);
|
|
424
425
|
const lastFocusedInMainRef = useRef(null);
|
|
@@ -1126,121 +1127,79 @@ const ConversationSearchResultsList = (props) => {
|
|
|
1126
1127
|
const { ConversationSearchResultsList: ConversationSearchResultsListComponent } = useAgentsComponents();
|
|
1127
1128
|
return /* @__PURE__ */ jsx(ConversationSearchResultsListComponent, { ...props });
|
|
1128
1129
|
};
|
|
1129
|
-
const openInNewTab = (href) => {
|
|
1130
|
-
window.open(href, "_blank", "noopener,noreferrer");
|
|
1131
|
-
};
|
|
1132
|
-
const openLinkThroughEnvironment = (environment, href, event) => {
|
|
1133
|
-
if (environment.onNavigate?.(href, event) === true) return;
|
|
1134
|
-
openInNewTab(href);
|
|
1135
|
-
};
|
|
1136
|
-
const readNativeEvent = (event) => event === void 0 ? null : "nativeEvent" in event ? event.nativeEvent : event;
|
|
1137
|
-
const useAgentsLinkNavigation = () => {
|
|
1138
|
-
const { onNavigate } = useAgentsEnvironment();
|
|
1139
|
-
return useMemo(
|
|
1140
|
-
() => ({
|
|
1141
|
-
openLink: (href, event) => openLinkThroughEnvironment({ onNavigate }, href, readNativeEvent(event)),
|
|
1142
|
-
handleLinkClick: (event, href) => {
|
|
1143
|
-
const target = href ?? event.currentTarget.getAttribute("href") ?? "";
|
|
1144
|
-
if (!target || !onNavigate) return;
|
|
1145
|
-
if (onNavigate(target, event.nativeEvent) === true) event.preventDefault();
|
|
1146
|
-
}
|
|
1147
|
-
}),
|
|
1148
|
-
[onNavigate]
|
|
1149
|
-
);
|
|
1150
|
-
};
|
|
1151
|
-
const AgentsLink = (props) => {
|
|
1152
|
-
const { node, href, onClick, children, ...anchorProps } = props;
|
|
1153
|
-
const { handleLinkClick } = useAgentsLinkNavigation();
|
|
1154
|
-
return /* @__PURE__ */ jsx(
|
|
1155
|
-
"a",
|
|
1156
|
-
{
|
|
1157
|
-
target: "_blank",
|
|
1158
|
-
rel: "noopener noreferrer",
|
|
1159
|
-
...anchorProps,
|
|
1160
|
-
href,
|
|
1161
|
-
onClick: (event) => {
|
|
1162
|
-
onClick?.(event);
|
|
1163
|
-
if (!event.defaultPrevented && href) handleLinkClick(event, href);
|
|
1164
|
-
},
|
|
1165
|
-
children
|
|
1166
|
-
}
|
|
1167
|
-
);
|
|
1168
|
-
};
|
|
1169
1130
|
export {
|
|
1170
|
-
|
|
1171
|
-
|
|
1131
|
+
setAgentsEnvironment as $,
|
|
1132
|
+
AgentsProvider as A,
|
|
1172
1133
|
Button as B,
|
|
1173
1134
|
Checkbox as C,
|
|
1174
1135
|
DEFAULT_AGENTS_COMPONENTS as D,
|
|
1175
|
-
|
|
1176
|
-
|
|
1136
|
+
classNames as E,
|
|
1137
|
+
escapePlainTextForText as F,
|
|
1177
1138
|
GlowFrame as G,
|
|
1178
1139
|
HeroRow as H,
|
|
1179
1140
|
Icon as I,
|
|
1180
|
-
|
|
1181
|
-
|
|
1141
|
+
getAgentDisplayName as J,
|
|
1142
|
+
getAgentsEnvironment as K,
|
|
1182
1143
|
LoadingSpinner as L,
|
|
1183
1144
|
Map as M,
|
|
1184
|
-
|
|
1185
|
-
|
|
1145
|
+
getFurtherCanvasBehaviours as N,
|
|
1146
|
+
getFurtherWidgetClickSignalSources as O,
|
|
1186
1147
|
ProgressBar as P,
|
|
1187
|
-
|
|
1148
|
+
getGoogleMapWidgetNames as Q,
|
|
1188
1149
|
RadioGroup as R,
|
|
1189
1150
|
SegmentBar as S,
|
|
1190
1151
|
Tabs as T,
|
|
1191
|
-
|
|
1192
|
-
|
|
1152
|
+
getSandboxLegacyAliases as U,
|
|
1153
|
+
getWidgetImageCaptureReadPathPrefix as V,
|
|
1193
1154
|
WidgetFeatureGate as W,
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
};
|
|
1246
|
-
//# sourceMappingURL=link-navigation-DRHt6g7U.js.map
|
|
1155
|
+
getWidgetSelfHydrationKeyFieldName as X,
|
|
1156
|
+
openImageGallery as Y,
|
|
1157
|
+
reportRunningTurn as Z,
|
|
1158
|
+
reportWidgetCrash as _,
|
|
1159
|
+
ConversationSearchResultsList as a,
|
|
1160
|
+
translateText as a0,
|
|
1161
|
+
useAgentsActiveAgentSpaceKey as a1,
|
|
1162
|
+
useAgentsBudgetLimit as a2,
|
|
1163
|
+
useAgentsComponents as a3,
|
|
1164
|
+
useAgentsEnvironment as a4,
|
|
1165
|
+
useAgentsMapsLoader as a5,
|
|
1166
|
+
useAgentsOwnerSettings as a6,
|
|
1167
|
+
useAgentsStateDispatch as a7,
|
|
1168
|
+
useAgentsStateSelector as a8,
|
|
1169
|
+
useAgentsTexts as a9,
|
|
1170
|
+
AgentsWidgetHydrationStateContainer as aa,
|
|
1171
|
+
WidgetHydrationReducer as ab,
|
|
1172
|
+
WidgetHydrationSlice as ac,
|
|
1173
|
+
createAgentsWidgetHydrationStateStore as ad,
|
|
1174
|
+
getDefaultAgentsStateStore as ae,
|
|
1175
|
+
canStartConversationInPersonalSpace as af,
|
|
1176
|
+
startConversationInPersonalSpace as ag,
|
|
1177
|
+
canOpenConnectionPermissions as ah,
|
|
1178
|
+
openConnectionPermissions as ai,
|
|
1179
|
+
DEFAULT_AGENTS_TEXTS as b,
|
|
1180
|
+
DEFAULT_WIDGET_IMAGE_CAPTURE_READ_PATH_PREFIX as c,
|
|
1181
|
+
DEFAULT_WIDGET_SELF_HYDRATION_KEY_FIELD_NAME as d,
|
|
1182
|
+
DateInput as e,
|
|
1183
|
+
HeroValue as f,
|
|
1184
|
+
InteractiveSurface as g,
|
|
1185
|
+
MapMarker as h,
|
|
1186
|
+
Markdown as i,
|
|
1187
|
+
ModalLayer as j,
|
|
1188
|
+
RangeSlider as k,
|
|
1189
|
+
Select as l,
|
|
1190
|
+
Skeleton as m,
|
|
1191
|
+
SkeletonText as n,
|
|
1192
|
+
SplitView as o,
|
|
1193
|
+
StatusBadge as p,
|
|
1194
|
+
StatusChip as q,
|
|
1195
|
+
Text as r,
|
|
1196
|
+
TextArea as s,
|
|
1197
|
+
TextInput as t,
|
|
1198
|
+
Tooltip as u,
|
|
1199
|
+
TrendDelta as v,
|
|
1200
|
+
WidgetText as w,
|
|
1201
|
+
appendAnotherAgentSpaceToOwnerText as x,
|
|
1202
|
+
buildUnnamedAgentSpaceLabel as y,
|
|
1203
|
+
buildWidgetOfAnotherAgentSpaceExplanation as z
|
|
1204
|
+
};
|
|
1205
|
+
//# sourceMappingURL=index-DZovGMpG.js.map
|