@ai-matrx/chat 0.6.6 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +42 -0
- package/README.md +1 -1
- package/dist/agents/components/agent-widgets/AgentChatHistorySidebar.js +16 -55
- package/dist/agents/components/chat/chat-door.d.ts +67 -0
- package/dist/agents/components/chat/chat-door.js +100 -0
- package/dist/agents/components/conversation-history/AgentConversationList.d.ts +83 -0
- package/dist/agents/components/conversation-history/AgentConversationList.js +252 -0
- package/dist/agents/components/conversation-history/ConversationArchiveSection.d.ts +5 -1
- package/dist/agents/components/conversation-history/ConversationArchiveSection.js +22 -4
- package/dist/agents/components/conversation-history/ConversationHistorySidebar.js +20 -65
- package/dist/agents/components/inputs/input-components/TextareaInput.js +2 -0
- package/dist/agents/components/inputs/input-components/VariableInputComponent.js +7 -6
- package/dist/agents/components/inputs/smart-input/ConversationCompanionPills.d.ts +3 -0
- package/dist/agents/components/inputs/smart-input/ConversationCompanionPills.js +40 -0
- package/dist/agents/components/inputs/smart-input/ConversationContextRail.js +6 -29
- package/dist/agents/components/inputs/smart-input/DeviceToolsModeRow.d.ts +3 -0
- package/dist/agents/components/inputs/smart-input/DeviceToolsModeRow.js +35 -0
- package/dist/agents/components/inputs/smart-input/InboxQueueStrip.js +0 -8
- package/dist/agents/components/inputs/smart-input/RunToolPicker.js +15 -11
- package/dist/agents/components/inputs/smart-input/composer/ComposerPlusMenu.js +22 -0
- package/dist/agents/components/inputs/smart-input/rail-pill.d.ts +35 -0
- package/dist/agents/components/inputs/smart-input/rail-pill.js +30 -0
- package/dist/agents/components/inputs/variable-input-variations/AgentVariableForm.js +52 -48
- package/dist/agents/components/run-controls/panels/shared.d.ts +1 -1
- package/dist/agents/components/shared/AgentModeController.js +3 -2
- package/dist/agents/components/shell/AgentRunSidebarMenu.js +15 -54
- package/dist/agents/components/working-document/documents-workspace/DocumentsListRail.js +1 -2
- package/dist/agents/engine.d.ts +15 -0
- package/dist/agents/engine.js +17 -0
- package/dist/agents/hooks/useModelControls.js +3 -175
- package/dist/agents/redux/agent-definition/selectors.d.ts +237 -237
- package/dist/agents/redux/agent-shortcut-categories/selectors.d.ts +50 -50
- package/dist/agents/redux/agent-shortcuts/selectors.d.ts +147 -147
- package/dist/agents/redux/conversation-history/thunks.js +6 -18
- package/dist/agents/redux/conversation-list/conversation-list.selectors.d.ts +1 -73
- package/dist/agents/redux/conversation-list/conversation-list.selectors.js +2 -36
- package/dist/agents/redux/conversation-list/conversation-list.slice.d.ts +7 -22
- package/dist/agents/redux/conversation-list/conversation-list.slice.js +7 -62
- package/dist/agents/redux/conversation-list/conversation-list.thunks.d.ts +0 -25
- package/dist/agents/redux/conversation-list/conversation-list.thunks.js +2 -58
- package/dist/agents/redux/conversation-list/conversation-list.types.d.ts +0 -5
- package/dist/agents/redux/conversation-list/conversation-rows.d.ts +16 -0
- package/dist/agents/redux/conversation-list/conversation-rows.js +24 -0
- package/dist/agents/redux/conversation-list/conversation-trash.thunks.d.ts +1 -0
- package/dist/agents/redux/conversation-list/conversation-trash.thunks.js +13 -18
- package/dist/agents/redux/execution-system/active-requests/active-requests.selectors.d.ts +54 -54
- package/dist/agents/redux/execution-system/context-state/context-state.selectors.d.ts +14 -14
- package/dist/agents/redux/execution-system/conversations/conversations.selectors.d.ts +5 -5
- package/dist/agents/redux/execution-system/instance-context/instance-context.selectors.d.ts +3 -3
- package/dist/agents/redux/execution-system/instance-resources/instance-resources.selectors.d.ts +8 -8
- package/dist/agents/redux/execution-system/instance-ui-state/instance-ui-state.selectors.d.ts +5 -5
- package/dist/agents/redux/execution-system/instance-variable-values/instance-variable-values.selectors.d.ts +7 -7
- package/dist/agents/redux/execution-system/messages/messages.selectors.d.ts +1 -1
- package/dist/agents/redux/execution-system/observability/observability.selectors.d.ts +7 -7
- package/dist/agents/redux/execution-system/observational-memory/observational-memory.selectors.d.ts +1 -1
- package/dist/agents/redux/execution-system/selectors/aggregate.selectors.d.ts +14 -14
- package/dist/agents/redux/execution-system/thunks/create-instance.thunk.d.ts +10 -1
- package/dist/agents/redux/execution-system/thunks/create-instance.thunk.js +114 -265
- package/dist/agents/redux/execution-system/thunks/dispatch-matrx-extend-tool.thunk.js +18 -2
- package/dist/agents/redux/execution-system/thunks/dispatch-surface-client-tool.thunk.js +10 -28
- package/dist/agents/redux/execution-system/thunks/dispatch-surface-write.thunk.js +10 -25
- package/dist/agents/redux/execution-system/thunks/execute-instance.thunk.js +20 -0
- package/dist/agents/redux/execution-system/thunks/execute-manual-instance.thunk.js +6 -1
- package/dist/agents/redux/execution-system/thunks/notify-and-play-dispatcher.d.ts +58 -0
- package/dist/agents/redux/execution-system/thunks/notify-and-play-dispatcher.js +62 -0
- package/dist/agents/redux/execution-system/thunks/post-delegated-tool-outcome.d.ts +23 -0
- package/dist/agents/redux/execution-system/thunks/post-delegated-tool-outcome.js +37 -0
- package/dist/agents/redux/execution-system/thunks/resume-instance.thunk.js +10 -2
- package/dist/agents/redux/execution-system/utils/build-tool-injection.d.ts +7 -0
- package/dist/agents/redux/execution-system/utils/build-tool-injection.js +18 -6
- package/dist/agents/redux/execution-system/utils/host-turn.d.ts +45 -0
- package/dist/agents/redux/execution-system/utils/host-turn.js +119 -0
- package/dist/agents/redux/proposed-directives/proposedDirectivesSlice.d.ts +1 -1
- package/dist/agents/scribe-tools/dispatcher/dispatch-scribe-tool.thunk.d.ts +50 -20
- package/dist/agents/scribe-tools/dispatcher/dispatch-scribe-tool.thunk.js +9 -101
- package/dist/agents/types/tool-injection.types.d.ts +18 -2
- package/dist/agents/ui-first-tools/redux/agent-lists.selectors.d.ts +2 -2
- package/dist/agents/ui-first-tools/redux/pending-asks.slice.d.ts +2 -1
- package/dist/agents/ui-first-tools/redux/resolve-asks-with-input.thunk.js +1 -1
- package/dist/agents/ui-first-tools/tools/ask-response.d.ts +29 -0
- package/dist/agents/ui-first-tools/tools/ask-response.js +15 -0
- package/dist/agents/ui-first-tools/tools/schemas.d.ts +3 -25
- package/dist/agents/ui-first-tools/tools/schemas.js +1 -12
- package/dist/agents/ui-first-tools/ui/ApprovalCard.js +1 -1
- package/dist/agents/ui-first-tools/ui/AskWizard.d.ts +1 -1
- package/dist/agents/ui-first-tools/ui/AskWizard.js +1 -1
- package/dist/cx-chat/_legacy-stubs.d.ts +5 -5
- package/dist/cx-chat/components/SsrSidebarChats.js +13 -15
- package/dist/cx-chat/components/messages/UserMessage.d.ts +2 -2
- package/dist/cx-chat/types/conversation.d.ts +6 -6
- package/dist/cx-chat/utils/buildContentBlocksForSave.d.ts +1 -1
- package/dist/cx-chat/utils/cx-content-converter.d.ts +1 -1
- package/dist/host/bare-host-chrome.js +9 -3
- package/dist/host/composer-extensions.d.ts +75 -0
- package/dist/host/composer-extensions.js +92 -0
- package/dist/host/configure.js +1 -0
- package/dist/host/contract.d.ts +105 -13
- package/dist/host/defaults/confirm.d.ts +15 -0
- package/dist/host/defaults/confirm.js +25 -0
- package/dist/host/defaults/files-ui.d.ts +85 -0
- package/dist/host/defaults/files-ui.js +158 -0
- package/dist/host/defaults/gates.d.ts +27 -0
- package/dist/host/defaults/gates.js +72 -0
- package/dist/host/defaults/media-client.d.ts +15 -0
- package/dist/host/defaults/media-client.js +40 -0
- package/dist/host/defaults/voice.d.ts +81 -0
- package/dist/host/defaults/voice.js +239 -0
- package/dist/host/device-tool-handoff.d.ts +26 -0
- package/dist/host/device-tool-handoff.js +45 -0
- package/dist/host/index.d.ts +1 -0
- package/dist/host/index.js +4 -1
- package/dist/host/microphone.d.ts +11 -0
- package/dist/host/microphone.js +17 -0
- package/dist/host/ui-slots.d.ts +29 -74
- package/dist/host/ui-slots.js +40 -42
- package/dist/store/create-chat-store.d.ts +2 -2
- package/dist/store/middlewares.d.ts +5 -5
- package/dist/store/slices.d.ts +1 -1
- package/dist/surfaces/redux/selectors.d.ts +2 -2
- package/dist/tool-call-visualization/components/ToolCallVisualization.js +3 -2
- package/dist/tool-call-visualization/configured-rows/ConfiguredRowRenderer.d.ts +15 -0
- package/dist/tool-call-visualization/configured-rows/ConfiguredRowRenderer.js +36 -0
- package/dist/tool-call-visualization/configured-rows/ConfiguredToolRow.d.ts +40 -0
- package/dist/tool-call-visualization/configured-rows/ConfiguredToolRow.js +296 -0
- package/dist/tool-call-visualization/configured-rows/CopyToolButton.d.ts +23 -0
- package/dist/tool-call-visualization/configured-rows/CopyToolButton.js +62 -0
- package/dist/tool-call-visualization/configured-rows/ToolProgressView.d.ts +23 -0
- package/dist/tool-call-visualization/configured-rows/ToolProgressView.js +147 -0
- package/dist/tool-call-visualization/configured-rows/field-components.d.ts +15 -0
- package/dist/tool-call-visualization/configured-rows/field-components.js +244 -0
- package/dist/tool-call-visualization/configured-rows/helpers.d.ts +39 -0
- package/dist/tool-call-visualization/configured-rows/helpers.js +110 -0
- package/dist/tool-call-visualization/configured-rows/register.d.ts +25 -0
- package/dist/tool-call-visualization/configured-rows/register.js +51 -0
- package/dist/tool-call-visualization/configured-rows/registries.d.ts +27 -0
- package/dist/tool-call-visualization/configured-rows/registries.js +14 -0
- package/dist/tool-call-visualization/configured-rows/to-row-entry.d.ts +8 -0
- package/dist/tool-call-visualization/configured-rows/to-row-entry.js +38 -0
- package/dist/tool-call-visualization/configured-rows/transforms.d.ts +14 -0
- package/dist/tool-call-visualization/configured-rows/transforms.js +30 -0
- package/dist/tool-call-visualization/configured-rows/types.d.ts +140 -0
- package/dist/tool-call-visualization/redux/selectors.d.ts +1 -1
- package/dist/tool-call-visualization/registry/registry.d.ts +1 -1
- package/dist/tool-call-visualization/registry/registry.js +8 -1
- package/dist/tool-call-visualization/types.d.ts +1 -1
- package/dist/ui/chat-protocol-types.d.ts +0 -1
- package/dist/ui/ownership.d.ts +25 -0
- package/dist/ui/ownership.js +18 -0
- package/dist/voice-agent/audio/audioCapture.js +11 -6
- package/dist/window-panels/windows/agents/AgentRunHistoryWindow.d.ts +1 -2
- package/dist/window-panels/windows/agents/AgentRunHistoryWindow.js +21 -181
- package/dist/window-panels/windows/agents/AgentRunWindow.js +26 -13
- package/package.json +4627 -125
- package/dist/agents/components/agent-widgets/chat-assistant/AssistantMessageCard.d.ts +0 -7
- package/dist/agents/components/agent-widgets/chat-assistant/AssistantMessageCard.js +0 -33
- package/dist/agents/components/agent-widgets/chat-assistant/StatusCard.d.ts +0 -6
- package/dist/agents/components/agent-widgets/chat-assistant/StatusCard.js +0 -21
- package/dist/agents/components/agent-widgets/chat-assistant/UserMessageCard.d.ts +0 -6
- package/dist/agents/components/agent-widgets/chat-assistant/UserMessageCard.js +0 -11
- package/dist/agents/components/agent-widgets/chat-assistant/VariableInputCard.d.ts +0 -12
- package/dist/agents/components/agent-widgets/chat-assistant/VariableInputCard.js +0 -7
- package/dist/agents/components/agent-widgets/execution-gates/PreExecutionCard.d.ts +0 -4
- package/dist/agents/components/agent-widgets/execution-gates/PreExecutionCard.js +0 -81
- package/dist/agents/components/run/run-sidebar/SidebarHeader.d.ts +0 -21
- package/dist/agents/components/run/run-sidebar/SidebarHeader.js +0 -50
- package/dist/agents/components/run-controls/AdvancedRunSettings/index.d.ts +0 -6
- package/dist/agents/components/run-controls/AdvancedRunSettings/index.js +0 -32
- package/dist/agents/components/run-controls/RunSettingsModal.d.ts +0 -5
- package/dist/agents/components/run-controls/RunSettingsModal.js +0 -22
- package/dist/agents/components/shell/AgentBuildSidebarExtras.d.ts +0 -6
- package/dist/agents/components/shell/AgentBuildSidebarExtras.js +0 -30
- package/dist/agents/constants/agent-system-competitors.d.ts +0 -9
- package/dist/agents/constants/agent-system-competitors.js +0 -125
- package/dist/agents/hooks/message-crud/useMessageActions.d.ts +0 -29
- package/dist/agents/hooks/message-crud/useMessageActions.js +0 -119
- package/dist/agents/hooks/useConversationPendingCalls.d.ts +0 -30
- package/dist/agents/hooks/useConversationPendingCalls.js +0 -42
- package/dist/agents/model-registry/model-classes.d.ts +0 -1
- package/dist/agents/model-registry/model-classes.js +0 -1
- package/dist/agents/redux/conversation-history/index.d.ts +0 -18
- package/dist/agents/redux/conversation-history/index.js +0 -4
- package/dist/agents/redux/execution-system/instance-variable-values/instance-variable-values.thunks.d.ts +0 -38
- package/dist/agents/redux/execution-system/instance-variable-values/instance-variable-values.thunks.js +0 -42
- package/dist/agents/redux/execution-system/message-crud/server/compact-turns.thunk.d.ts +0 -58
- package/dist/agents/redux/execution-system/message-crud/server/compact-turns.thunk.js +0 -50
- package/dist/agents/redux/execution-system/message-crud/server/fork-and-run-server.thunk.d.ts +0 -76
- package/dist/agents/redux/execution-system/message-crud/server/fork-and-run-server.thunk.js +0 -101
- package/dist/agents/redux/execution-system/thunks/attach-workflow-run.d.ts +0 -38
- package/dist/agents/redux/execution-system/thunks/attach-workflow-run.js +0 -25
- package/dist/agents/redux/execution-system/utils/source-slice-helpers.d.ts +0 -45
- package/dist/agents/redux/execution-system/utils/source-slice-helpers.js +0 -50
- package/dist/agents/runtime/realtime/launchRealtimeSession.thunk.d.ts +0 -25
- package/dist/agents/runtime/realtime/launchRealtimeSession.thunk.js +0 -15
- package/dist/agents/services/agentService.d.ts +0 -12
- package/dist/agents/services/agentService.js +0 -92
- package/dist/agents/utils/escape-code-fences.d.ts +0 -15
- package/dist/agents/utils/escape-code-fences.js +0 -9
- package/dist/agents/utils/normalize-managed-options.d.ts +0 -30
- package/dist/agents/utils/normalize-managed-options.js +0 -29
- package/dist/agents/utils/processedDocumentContext.d.ts +0 -51
- package/dist/agents/utils/processedDocumentContext.js +0 -51
- package/dist/agents/utils/variable-validation.d.ts +0 -28
- package/dist/agents/utils/variable-validation.js +0 -54
- package/dist/cx-chat/components/ChatConversationSkeleton.d.ts +0 -9
- package/dist/cx-chat/components/ChatConversationSkeleton.js +0 -45
- package/dist/cx-chat/components/ChatPanelBackButton.d.ts +0 -1
- package/dist/cx-chat/components/ChatPanelBackButton.js +0 -26
- package/dist/cx-chat/components/messages/MessageErrorBoundary.d.ts +0 -20
- package/dist/cx-chat/components/messages/MessageErrorBoundary.js +0 -40
- package/dist/cx-chat/components/variable-inputs/CheckboxGroupInput.d.ts +0 -14
- package/dist/cx-chat/components/variable-inputs/CheckboxGroupInput.js +0 -160
- package/dist/cx-chat/components/variable-inputs/NumberInput.d.ts +0 -15
- package/dist/cx-chat/components/variable-inputs/NumberInput.js +0 -79
- package/dist/cx-chat/components/variable-inputs/RadioGroupInput.d.ts +0 -14
- package/dist/cx-chat/components/variable-inputs/RadioGroupInput.js +0 -125
- package/dist/cx-chat/components/variable-inputs/SelectInput.d.ts +0 -14
- package/dist/cx-chat/components/variable-inputs/SelectInput.js +0 -92
- package/dist/cx-chat/components/variable-inputs/TextareaInput.d.ts +0 -14
- package/dist/cx-chat/components/variable-inputs/TextareaInput.js +0 -46
- package/dist/cx-chat/components/variable-inputs/ToggleInput.d.ts +0 -14
- package/dist/cx-chat/components/variable-inputs/ToggleInput.js +0 -46
- package/dist/cx-chat/hooks/useChatPersistence.d.ts +0 -28
- package/dist/cx-chat/hooks/useChatPersistence.js +0 -180
- package/dist/cx-chat/hooks/useInstanceBootstrap.d.ts +0 -1
- package/dist/cx-chat/hooks/useInstanceBootstrap.js +0 -115
- package/dist/cx-chat/types/content.d.ts +0 -184
- package/dist/cx-chat/types/content.js +0 -91
- package/dist/cx-chat/types/cx-tables.d.ts +0 -176
- package/dist/cx-chat/utils/settings-diff.d.ts +0 -13
- package/dist/cx-chat/utils/settings-diff.js +0 -25
- package/dist/public-chat/components/AgentSelector.d.ts +0 -22
- package/dist/public-chat/components/AgentSelector.js +0 -80
- package/dist/public-chat/components/GuidedVariableInputs.d.ts +0 -25
- package/dist/public-chat/components/GuidedVariableInputs.js +0 -623
- package/dist/public-chat/components/PublicVariableInputs.d.ts +0 -29
- package/dist/public-chat/components/PublicVariableInputs.js +0 -172
- package/dist/public-chat/types/content.d.ts +0 -184
- package/dist/public-chat/types/content.js +0 -91
- package/dist/tool-call-visualization/renderers/_shared-entity/EntityOpenActions.d.ts +0 -15
- package/dist/tool-call-visualization/renderers/_shared-entity/EntityOpenActions.js +0 -31
- package/dist/tool-call-visualization/utils/toolCallBlockToLifecycleEntry.d.ts +0 -24
- package/dist/tool-call-visualization/utils/toolCallBlockToLifecycleEntry.js +0 -26
- package/dist/ui/AudioOutputBlockSkeleton.d.ts +0 -17
- package/dist/ui/AudioOutputBlockSkeleton.js +0 -78
- package/dist/ui/lazy/PublicChatVariableInputs.d.ts +0 -2
- package/dist/ui/lazy/PublicChatVariableInputs.js +0 -16
- package/dist/utils/xml/readXmlTag.d.ts +0 -12
- package/dist/utils/xml/readXmlTag.js +0 -66
- /package/dist/{cx-chat/types/cx-tables.js → tool-call-visualization/configured-rows/types.js} +0 -0
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Display config shapes for the per-tool registry. Every visual segment is
|
|
3
|
+
* `PhaseAware` so a tool can show different text/icons/colors while running,
|
|
4
|
+
* after success, and after failure (e.g. "Getting X" → "Got X" → "Failed to
|
|
5
|
+
* get X"). All fields are optional — anything left out falls back to the
|
|
6
|
+
* default rendering used by tools that aren't registered at all.
|
|
7
|
+
*/
|
|
8
|
+
import type { ComponentType } from 'react';
|
|
9
|
+
/** One incremental update a long-running tool reported (a `tool_progress` event). */
|
|
10
|
+
export interface ToolProgressRow {
|
|
11
|
+
/** Arrival time, ms since epoch. */
|
|
12
|
+
at: number;
|
|
13
|
+
/** Short status line shown to the person. */
|
|
14
|
+
label?: string | undefined;
|
|
15
|
+
/** Named step id: groups updates for checklist display. */
|
|
16
|
+
step?: string | undefined;
|
|
17
|
+
status?: 'pending' | 'active' | 'done' | 'error' | undefined;
|
|
18
|
+
/** 0-1 (fraction) or 0-100 (percent); the view normalizes either. */
|
|
19
|
+
percent?: number | undefined;
|
|
20
|
+
data?: unknown;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* What a configured row reads: one tool call in the flat shape the config paths address
|
|
24
|
+
* (`args.x`, `output.y`, `message`). The package folds a `ToolLifecycleEntry` into it
|
|
25
|
+
* (`toRowEntry`); a host with its own call records can build it directly.
|
|
26
|
+
*/
|
|
27
|
+
export interface ToolRowEntry {
|
|
28
|
+
callId: string;
|
|
29
|
+
toolName: string;
|
|
30
|
+
startedAt: number;
|
|
31
|
+
endedAt?: number | undefined;
|
|
32
|
+
phase: 'started' | 'completed' | 'error';
|
|
33
|
+
args?: unknown;
|
|
34
|
+
output?: unknown;
|
|
35
|
+
message?: string | undefined;
|
|
36
|
+
progress?: ToolProgressRow[] | undefined;
|
|
37
|
+
}
|
|
38
|
+
export type Phase = 'started' | 'completed' | 'error';
|
|
39
|
+
export type PhaseMap<T> = Partial<Record<Phase, T>>;
|
|
40
|
+
export type PhaseAware<T> = T | PhaseMap<T>;
|
|
41
|
+
export type IconName = string;
|
|
42
|
+
export type ColorToken = 'blue' | 'sky' | 'emerald' | 'amber' | 'red' | 'violet' | 'slate' | 'primary' | 'muted';
|
|
43
|
+
/**
|
|
44
|
+
* Name of a registered value transformer. The generic ones (`titleCase`, `textClean`, `truncate80`, ...)
|
|
45
|
+
* ship with the package; a host adds its own with `registerRowTransforms`.
|
|
46
|
+
*/
|
|
47
|
+
export type TransformName = string;
|
|
48
|
+
export interface InfoSpec {
|
|
49
|
+
path: string;
|
|
50
|
+
transform?: TransformName | TransformName[];
|
|
51
|
+
fallback?: string;
|
|
52
|
+
}
|
|
53
|
+
export interface InlineConfig {
|
|
54
|
+
hidden?: PhaseAware<boolean>;
|
|
55
|
+
/**
|
|
56
|
+
* Lucide icon name OR an `InfoSpec` whose path resolves to either:
|
|
57
|
+
* - a lucide icon name (string passed through `transforms` is fine, e.g.
|
|
58
|
+
* `browserCategoryIcon` mapping `args.category` → lucide name)
|
|
59
|
+
* - a URL (http(s):// or data:) — rendered as an `<img>` instead of a
|
|
60
|
+
* lucide component. Useful for favicons.
|
|
61
|
+
* If the resolution returns nothing, falls back to the phase-default icon.
|
|
62
|
+
*/
|
|
63
|
+
icon?: PhaseAware<IconName | InfoSpec>;
|
|
64
|
+
prefix?: PhaseAware<string>;
|
|
65
|
+
/**
|
|
66
|
+
* Default: titleCase(toolName). Pass `''` to suppress, a literal string to
|
|
67
|
+
* override, or an `InfoSpec` to pull the name from args/output (e.g. the
|
|
68
|
+
* category passed into `load_chrome_tools`, or the title of the active tab).
|
|
69
|
+
*/
|
|
70
|
+
name?: PhaseAware<string | InfoSpec>;
|
|
71
|
+
suffix?: PhaseAware<string>;
|
|
72
|
+
info?: PhaseAware<string | InfoSpec>;
|
|
73
|
+
color?: PhaseAware<ColorToken>;
|
|
74
|
+
isMultiline?: boolean;
|
|
75
|
+
spinIcon?: PhaseAware<boolean>;
|
|
76
|
+
/**
|
|
77
|
+
* Shimmer the label while phase is `started`. Default: true. Set false to
|
|
78
|
+
* suppress (e.g. very fast tools where the shimmer is overkill).
|
|
79
|
+
*/
|
|
80
|
+
shimmerOnRunning?: boolean;
|
|
81
|
+
}
|
|
82
|
+
export interface ArgsConfig {
|
|
83
|
+
hidden?: PhaseAware<boolean>;
|
|
84
|
+
displayType?: 'json' | 'key-value' | 'values-only';
|
|
85
|
+
}
|
|
86
|
+
export interface ResultsConfig {
|
|
87
|
+
hidden?: PhaseAware<boolean>;
|
|
88
|
+
displayType?: 'json' | 'key-value' | 'values-only' | 'custom';
|
|
89
|
+
keysInfo?: KeyDisplay[];
|
|
90
|
+
/**
|
|
91
|
+
* When true (and phase is `completed`), render the result content directly
|
|
92
|
+
* under the row — visible by default, no click required. The click-to-expand
|
|
93
|
+
* still works for inspecting args + raw JSON. Use for tools whose result
|
|
94
|
+
* payload IS the point (screenshots, charts).
|
|
95
|
+
*/
|
|
96
|
+
alwaysShow?: boolean;
|
|
97
|
+
}
|
|
98
|
+
export type FieldComponentName = 'BoldLabel' | 'TextDisplay' | 'Markdown' | 'Code' | 'Json' | 'Image' | 'Base64Image' | 'Badge' | 'Chips' | 'TabCard' | 'Table';
|
|
99
|
+
export interface KeyDisplay {
|
|
100
|
+
key: string;
|
|
101
|
+
component: FieldComponentName;
|
|
102
|
+
className?: string;
|
|
103
|
+
transform?: TransformName | TransformName[] | null;
|
|
104
|
+
fallback?: string;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* How to render a tool's incremental progress updates (the `progress[]` log
|
|
108
|
+
* a long-running tool emits via server `tool_progress` events or client
|
|
109
|
+
* `ctx.reportProgress`). Entirely optional: a tool with no progress entries
|
|
110
|
+
* renders nothing extra. When entries DO exist, the generic default ('log',
|
|
111
|
+
* auto-collapse) applies even without a config block — registering one only
|
|
112
|
+
* customizes the presentation.
|
|
113
|
+
*/
|
|
114
|
+
export type ProgressDisplayMode =
|
|
115
|
+
/** Chronological list of recent updates; collapses to a summary on completion. */
|
|
116
|
+
'log'
|
|
117
|
+
/** Single status line that the latest update replaces. */
|
|
118
|
+
| 'latest'
|
|
119
|
+
/** Named steps (grouped by `step`) ticking pending → active → done/error. */
|
|
120
|
+
| 'steps';
|
|
121
|
+
export interface ProgressConfig {
|
|
122
|
+
hidden?: PhaseAware<boolean>;
|
|
123
|
+
/** Default 'log'. */
|
|
124
|
+
mode?: ProgressDisplayMode;
|
|
125
|
+
/** 'log' mode: how many recent lines to keep visible while running. Default 4. */
|
|
126
|
+
visibleWhileRunning?: number;
|
|
127
|
+
/** Keep progress expanded after completion instead of collapsing. Default false. */
|
|
128
|
+
showWhenComplete?: boolean;
|
|
129
|
+
}
|
|
130
|
+
export interface ToolDisplayEntry {
|
|
131
|
+
inline?: InlineConfig;
|
|
132
|
+
args?: ArgsConfig;
|
|
133
|
+
results?: ResultsConfig;
|
|
134
|
+
/** Opt-in incremental-progress display for long-running tools. */
|
|
135
|
+
progress?: ProgressConfig;
|
|
136
|
+
CustomComponent?: ComponentType<{
|
|
137
|
+
entry: ToolRowEntry;
|
|
138
|
+
kind: 'server' | 'client';
|
|
139
|
+
}>;
|
|
140
|
+
}
|
|
@@ -26,7 +26,7 @@ export declare const selectOrderedToolLifecycles: (requestId: string) => ((state
|
|
|
26
26
|
voiceAgent: import("../../voice-agent/types.js").VoiceAgentState;
|
|
27
27
|
agentDefinition: import("../../agents/types/agent-definition.types.js").AgentDefinitionSliceState;
|
|
28
28
|
conversationList: import("../../agents/redux/conversation-list/conversation-list.types.js").ConversationListState;
|
|
29
|
-
conversationHistory: import("../../agents/redux/conversation-history/
|
|
29
|
+
conversationHistory: import("../../agents/redux/conversation-history/types.js").ConversationHistoryState;
|
|
30
30
|
agentShortcut: import("../../agents/redux/agent-shortcuts/types.js").AgentShortcutSliceState;
|
|
31
31
|
agentShortcutCategory: import("../../agents/redux/agent-shortcut-categories/types.js").AgentShortcutCategorySliceState;
|
|
32
32
|
surfaceUserState: import("../../surfaces/redux/userStateSlice.js").SurfaceUserStateSlice;
|
|
@@ -53,7 +53,7 @@ export declare function getToolGlyph(toolName: string | null): ToolGlyphSpec;
|
|
|
53
53
|
* own header + menu, so the shell drops the fold line once complete), "line"
|
|
54
54
|
* (default) uses the slim collapsible verb-phrase row.
|
|
55
55
|
*/
|
|
56
|
-
export declare function getToolChrome(toolName: string | null): "line" | "card";
|
|
56
|
+
export declare function getToolChrome(toolName: string | null): "line" | "card" | "row";
|
|
57
57
|
export declare function getToolDisplayName(toolName: string | null): string;
|
|
58
58
|
/**
|
|
59
59
|
* Resolve the verb-phrase label for a tool's slim row.
|
|
@@ -53,7 +53,14 @@ const WorkbookOverlay = clientLazy(() => import("../renderers/workbook/WorkbookO
|
|
|
53
53
|
const DictionaryInline = clientLazy(() => import("../renderers/dictionary/DictionaryInline.js").then((m) => ({ default: m.DictionaryInline })));
|
|
54
54
|
const DictionaryOverlay = clientLazy(() => import("../renderers/dictionary/DictionaryOverlay.js").then((m) => ({ default: m.DictionaryOverlay })));
|
|
55
55
|
const ResearchInline = clientLazy(() => import("../renderers/research/ResearchInline.js").then((m) => ({ default: m.ResearchInline })));
|
|
56
|
-
|
|
56
|
+
const ResearchReportTab = clientLazy(() => import("../renderers/research/ResearchOverlay.js").then((m) => ({ default: m.ResearchReportTab })));
|
|
57
|
+
const ResearchSourcesTab = clientLazy(() => import("../renderers/research/ResearchOverlay.js").then((m) => ({ default: m.ResearchSourcesTab })));
|
|
58
|
+
const ResearchFullTextTab = clientLazy(() => import("../renderers/research/ResearchOverlay.js").then((m) => ({ default: m.ResearchFullTextTab })));
|
|
59
|
+
const researchOverlayTabs = [
|
|
60
|
+
{ id: "report", label: "Report", Component: ResearchReportTab },
|
|
61
|
+
{ id: "sources", label: "Sources", Component: ResearchSourcesTab },
|
|
62
|
+
{ id: "fulltext", label: "Full Text", Component: ResearchFullTextTab }
|
|
63
|
+
];
|
|
57
64
|
const RandomWheelInline = clientLazy(() => import("../renderers/random-wheel/RandomWheelInline.js").then((m) => ({ default: m.RandomWheelInline })));
|
|
58
65
|
const RecordsInline = clientLazy(() => import("../renderers/records/RecordsInline.js").then((m) => ({ default: m.RecordsInline })));
|
|
59
66
|
const CtxGetInline = clientLazy(() => import("../renderers/ctx/CtxGetInline.js").then((m) => ({ default: m.CtxGetInline })));
|
|
@@ -161,7 +161,7 @@ export interface ToolRenderer {
|
|
|
161
161
|
* icons — the component's own header (`EntityCard`) carries the name +
|
|
162
162
|
* "Open in" menu. While still streaming it shows the slim row.
|
|
163
163
|
*/
|
|
164
|
-
chrome?: "line" | "card";
|
|
164
|
+
chrome?: "line" | "card" | "row";
|
|
165
165
|
/**
|
|
166
166
|
* Optional verb-phrase labels for the slim row. When omitted, the shell
|
|
167
167
|
* falls back to a small built-in map (for common widget tools) and then
|
|
@@ -17,7 +17,6 @@
|
|
|
17
17
|
* USAGE
|
|
18
18
|
* ─────
|
|
19
19
|
* import type { CanonicalMessage, CanonicalBlock } from '@/lib/chat-protocol/types';
|
|
20
|
-
* const messages = buildCanonicalMessages(dbMessages, toolCalls);
|
|
21
20
|
* const streaming = buildStreamingState(streamEvents);
|
|
22
21
|
*/
|
|
23
22
|
/** Bump this when the shape of CanonicalMessage or CanonicalBlock changes. */
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure record transforms chat writes with (gap 9, AUDIT-C) — package code, never host slots: a
|
|
3
|
+
* slot left them throwing on a bare host, and a wrong answer here would corrupt a write.
|
|
4
|
+
* Same rules as matrx-frontend's `lib/organizations/globalOwnership` + `lib/row-access`.
|
|
5
|
+
*
|
|
6
|
+
* GLOBAL OWNERSHIP. Storage homes a global row in the SYSTEM organization (the column is NOT
|
|
7
|
+
* NULL); the client's scope model reads "global" as "no owner". So a row read from the system
|
|
8
|
+
* org goes out with no organization AND no person (storage stamps the acting admin onto a global
|
|
9
|
+
* write, and a person reads as "personal scope"); a record written back gets the system org again.
|
|
10
|
+
*/
|
|
11
|
+
interface OwnedRecord {
|
|
12
|
+
organizationId?: string | null;
|
|
13
|
+
userId?: string | null;
|
|
14
|
+
}
|
|
15
|
+
/** A record owned by the system organization is GLOBAL: present it with no owner at all. */
|
|
16
|
+
export declare function toGlobalOwnershipRecord<T extends OwnedRecord>(record: T, systemOrgId: string): T;
|
|
17
|
+
/** The inverse, for writing a record read through the rule back: "no owner" is the system org. */
|
|
18
|
+
export declare function fromGlobalOwnershipRecord<T extends OwnedRecord>(record: T, systemOrgId: string): T;
|
|
19
|
+
/** The write for "Publish to the web" / "Stop publishing": the switch, when, and who flipped it. */
|
|
20
|
+
export declare function publishedToWebPatch(on: boolean, userId: string | null): {
|
|
21
|
+
published_to_web: boolean;
|
|
22
|
+
published_to_web_at: string | null;
|
|
23
|
+
published_to_web_by: string | null;
|
|
24
|
+
};
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
function toGlobalOwnershipRecord(record, systemOrgId) {
|
|
2
|
+
if (!record || record.organizationId !== systemOrgId) return record;
|
|
3
|
+
const out = { ...record, organizationId: null };
|
|
4
|
+
if ("userId" in record) out.userId = null;
|
|
5
|
+
return out;
|
|
6
|
+
}
|
|
7
|
+
function fromGlobalOwnershipRecord(record, systemOrgId) {
|
|
8
|
+
if (!record || record.organizationId) return record;
|
|
9
|
+
return { ...record, organizationId: systemOrgId };
|
|
10
|
+
}
|
|
11
|
+
function publishedToWebPatch(on, userId) {
|
|
12
|
+
return { published_to_web: on, published_to_web_at: (/* @__PURE__ */ new Date()).toISOString(), published_to_web_by: userId };
|
|
13
|
+
}
|
|
14
|
+
export {
|
|
15
|
+
fromGlobalOwnershipRecord,
|
|
16
|
+
publishedToWebPatch,
|
|
17
|
+
toGlobalOwnershipRecord
|
|
18
|
+
};
|
|
@@ -5,6 +5,8 @@ import {
|
|
|
5
5
|
} from "../constants.js";
|
|
6
6
|
import { writeAmplitude } from "./amplitudeBus.js";
|
|
7
7
|
import { acquireMicStream, releaseMicStream } from "@ai-matrx/browser-audio/core";
|
|
8
|
+
import { getChatHost, isChatHostConfigured } from "../../host/configure.js";
|
|
9
|
+
import { withMicrophoneGrant } from "../../host/microphone.js";
|
|
8
10
|
const WORKLET_PATH = "/pcm-processor-worklet.js";
|
|
9
11
|
function createAudioCapture(options = {}) {
|
|
10
12
|
const sampleRateHz = options.sampleRateHz ?? SAMPLE_RATE_HZ;
|
|
@@ -79,12 +81,15 @@ function createAudioCapture(options = {}) {
|
|
|
79
81
|
return true;
|
|
80
82
|
};
|
|
81
83
|
try {
|
|
82
|
-
stream = await
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
84
|
+
stream = await withMicrophoneGrant(
|
|
85
|
+
() => acquireMicStream({
|
|
86
|
+
echoCancellation: true,
|
|
87
|
+
noiseSuppression: true,
|
|
88
|
+
autoGainControl: true,
|
|
89
|
+
sampleRate: sampleRateHz
|
|
90
|
+
}),
|
|
91
|
+
isChatHostConfigured() ? getChatHost().microphone : null
|
|
92
|
+
);
|
|
88
93
|
holdingMic = true;
|
|
89
94
|
} catch (err) {
|
|
90
95
|
const code = err?.name === "NotAllowedError" ? "permission-denied" : err?.name === "NotFoundError" ? "no-microphone" : err?.name === "NotReadableError" ? "device-busy" : "unknown";
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import React from "react";
|
|
2
1
|
interface AgentRunHistoryWindowProps {
|
|
3
2
|
isOpen: boolean;
|
|
4
3
|
onClose: () => void;
|
|
@@ -7,7 +6,7 @@ interface AgentRunHistoryWindowProps {
|
|
|
7
6
|
/** What the history is of ("Recipe Scaler") — see the opener. */
|
|
8
7
|
subject?: string | null;
|
|
9
8
|
}
|
|
10
|
-
export default function AgentRunHistoryWindow({ isOpen, onClose, agentId, initialSelectedConversationId, subject, }: AgentRunHistoryWindowProps):
|
|
9
|
+
export default function AgentRunHistoryWindow({ isOpen, onClose, agentId, initialSelectedConversationId, subject, }: AgentRunHistoryWindowProps): import("react").JSX.Element | null;
|
|
11
10
|
/** The window's title: the caller's subject while its agent is shown, else the agent's name. */
|
|
12
11
|
export declare function runHistoryWindowTitle(args: {
|
|
13
12
|
agentId: string | null;
|
|
@@ -1,18 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
3
|
+
import { useCallback, useEffect, useRef, useState } from "react";
|
|
4
4
|
import {
|
|
5
|
-
useCallback,
|
|
6
|
-
useEffect,
|
|
7
|
-
useMemo,
|
|
8
|
-
useRef,
|
|
9
|
-
useState
|
|
10
|
-
} from "react";
|
|
11
|
-
import {
|
|
12
|
-
ChevronDown,
|
|
13
|
-
ChevronRight,
|
|
14
5
|
Clock,
|
|
15
|
-
MessageSquare,
|
|
16
6
|
Loader2,
|
|
17
7
|
History,
|
|
18
8
|
Workflow
|
|
@@ -20,17 +10,16 @@ import {
|
|
|
20
10
|
import { WindowPanel } from "../../../host/ui-slots.js";
|
|
21
11
|
import { useAppDispatch, useAppSelector } from "../../../store/hooks.js";
|
|
22
12
|
import { selectAgentById } from "../../../agents/redux/agent-definition/selectors.js";
|
|
23
|
-
import {
|
|
24
|
-
|
|
13
|
+
import {
|
|
14
|
+
AgentVersionGroupedList,
|
|
15
|
+
useAgentConversationList
|
|
16
|
+
} from "../../../agents/components/conversation-history/AgentConversationList.js";
|
|
25
17
|
import { AgentConversationDisplay } from "../../../agents/components/messages-display/AgentConversationDisplay.js";
|
|
26
18
|
import { loadConversation } from "../../../agents/redux/execution-system/thunks/load-conversation.thunk.js";
|
|
27
19
|
import { followWhatIsStillInFlight } from "../../../agents/runtime-reconnect/follow-what-is-still-in-flight.js";
|
|
28
20
|
import { createManualInstance } from "../../../agents/redux/execution-system/thunks/create-instance.thunk.js";
|
|
29
21
|
import { useAppStore } from "../../../store/hooks.js";
|
|
30
22
|
import { AgentListDropdown } from "@ai-matrx/agents/catalog/react";
|
|
31
|
-
import { ItemRow } from "../../../host/ui-slots.js";
|
|
32
|
-
import { buildConversationMenu } from "../../../agents/components/conversation-actions/conversationActionRegistry.js";
|
|
33
|
-
import { renameConversation } from "../../../agents/redux/conversation-list/conversation-row-actions.thunks.js";
|
|
34
23
|
import { SurfaceRuntimeProvider } from "../../../surfaces/runtime/SurfaceRuntimeContext.js";
|
|
35
24
|
import { AGENT_RUN_HISTORY_SURFACE_NAME } from "../../../surfaces/manifests/agent-run-history.manifest.js";
|
|
36
25
|
import { NonEditableContextMenu } from "../../../host/ui-slots.js";
|
|
@@ -41,109 +30,7 @@ import {
|
|
|
41
30
|
} from "./agent-run-history-scope.js";
|
|
42
31
|
import { ErrorAlchemyMenu } from "../../../host/ui-slots.js";
|
|
43
32
|
import { CHAT_WINDOWS } from "../../../host/windows.js";
|
|
44
|
-
import { Button } from "@ai-matrx/design-system/controls";
|
|
45
33
|
const SURFACE_KEY = "agent-run-history-window";
|
|
46
|
-
function formatDate(iso) {
|
|
47
|
-
if (!iso) return "";
|
|
48
|
-
const d = new Date(iso);
|
|
49
|
-
const now = /* @__PURE__ */ new Date();
|
|
50
|
-
const diffDays = Math.floor((now.getTime() - d.getTime()) / 864e5);
|
|
51
|
-
if (diffDays === 0)
|
|
52
|
-
return d.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" });
|
|
53
|
-
if (diffDays === 1) return "Yesterday";
|
|
54
|
-
if (diffDays < 7) return `${diffDays}d ago`;
|
|
55
|
-
return d.toLocaleDateString([], { month: "short", day: "numeric" });
|
|
56
|
-
}
|
|
57
|
-
function groupByVersion(conversations) {
|
|
58
|
-
const map = /* @__PURE__ */ new Map();
|
|
59
|
-
for (const conv of conversations) {
|
|
60
|
-
const v = conv.agentVersionNumber ?? 0;
|
|
61
|
-
const group = map.get(v);
|
|
62
|
-
if (group) {
|
|
63
|
-
group.push(conv);
|
|
64
|
-
} else {
|
|
65
|
-
map.set(v, [conv]);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
return Array.from(map.entries()).sort(([a], [b]) => b - a).map(([versionNumber, convs]) => ({
|
|
69
|
-
versionNumber,
|
|
70
|
-
conversations: [...convs].sort(
|
|
71
|
-
(a, b) => new Date(b.updatedAt).getTime() - new Date(a.updatedAt).getTime()
|
|
72
|
-
)
|
|
73
|
-
}));
|
|
74
|
-
}
|
|
75
|
-
function VersionGroupRow({
|
|
76
|
-
group,
|
|
77
|
-
agentId,
|
|
78
|
-
selectedId,
|
|
79
|
-
onSelect,
|
|
80
|
-
defaultOpen
|
|
81
|
-
}) {
|
|
82
|
-
const [open, setOpen] = useState(defaultOpen);
|
|
83
|
-
const hasActive = group.conversations.some(
|
|
84
|
-
(c) => c.conversationId === selectedId
|
|
85
|
-
);
|
|
86
|
-
return /* @__PURE__ */ jsxs("div", { children: [
|
|
87
|
-
/* @__PURE__ */ jsxs(Button, { variant: "quiet", pressed: hasActive, icon: open ? /* @__PURE__ */ jsx(ChevronDown, {}) : /* @__PURE__ */ jsx(ChevronRight, {}), onClick: () => setOpen((v) => !v), className: "w-full", children: [
|
|
88
|
-
/* @__PURE__ */ jsx("span", { className: "text-[11px] font-semibold text-muted-foreground uppercase tracking-wide flex-1 min-w-0 truncate", children: group.versionNumber ? `Version ${group.versionNumber}` : "Latest" }),
|
|
89
|
-
/* @__PURE__ */ jsx("span", { className: "text-[10px] text-muted-foreground/60 shrink-0 ml-1", children: group.conversations.length })
|
|
90
|
-
] }),
|
|
91
|
-
open && /* @__PURE__ */ jsx("div", { className: "pl-2", children: group.conversations.map((conv) => /* @__PURE__ */ jsx(
|
|
92
|
-
VersionConversationRow,
|
|
93
|
-
{
|
|
94
|
-
conv,
|
|
95
|
-
agentId,
|
|
96
|
-
isActive: conv.conversationId === selectedId,
|
|
97
|
-
onSelect
|
|
98
|
-
},
|
|
99
|
-
conv.conversationId
|
|
100
|
-
)) })
|
|
101
|
-
] });
|
|
102
|
-
}
|
|
103
|
-
function VersionConversationRow({
|
|
104
|
-
conv,
|
|
105
|
-
agentId,
|
|
106
|
-
isActive,
|
|
107
|
-
onSelect
|
|
108
|
-
}) {
|
|
109
|
-
const dispatch = useAppDispatch();
|
|
110
|
-
const date = formatDate(conv.updatedAt);
|
|
111
|
-
const href = `/agents/go/${agentId}/run?conversationId=${conv.conversationId}`;
|
|
112
|
-
return /* @__PURE__ */ jsx(
|
|
113
|
-
ItemRow,
|
|
114
|
-
{
|
|
115
|
-
sourceFeature: "agent-runner",
|
|
116
|
-
label: conv.title?.trim() || "Untitled",
|
|
117
|
-
active: isActive,
|
|
118
|
-
size: "sm",
|
|
119
|
-
onOpen: () => onSelect(conv.conversationId),
|
|
120
|
-
menu: () => buildConversationMenu({
|
|
121
|
-
conversationId: conv.conversationId,
|
|
122
|
-
title: conv.title,
|
|
123
|
-
isFavorite: conv.isFavorite ?? false,
|
|
124
|
-
isArchived: conv.status === "archived",
|
|
125
|
-
excludeFromKg: conv.excludeFromKg ?? false,
|
|
126
|
-
href,
|
|
127
|
-
dispatch
|
|
128
|
-
}),
|
|
129
|
-
rename: {
|
|
130
|
-
value: conv.title ?? "",
|
|
131
|
-
emptyFallback: "Untitled",
|
|
132
|
-
onCommit: (next) => void dispatch(
|
|
133
|
-
renameConversation({
|
|
134
|
-
conversationId: conv.conversationId,
|
|
135
|
-
title: next
|
|
136
|
-
})
|
|
137
|
-
)
|
|
138
|
-
},
|
|
139
|
-
trailing: /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1 text-[10px] text-muted-foreground/70", children: [
|
|
140
|
-
/* @__PURE__ */ jsx(MessageSquare, { className: "w-2.5 h-2.5 shrink-0" }),
|
|
141
|
-
conv.messageCount,
|
|
142
|
-
date ? ` \xB7 ${date}` : ""
|
|
143
|
-
] })
|
|
144
|
-
}
|
|
145
|
-
);
|
|
146
|
-
}
|
|
147
34
|
function RunHistorySidebar({
|
|
148
35
|
agentId,
|
|
149
36
|
selectedConversationId,
|
|
@@ -152,42 +39,16 @@ function RunHistorySidebar({
|
|
|
152
39
|
onScope,
|
|
153
40
|
subjectLabel
|
|
154
41
|
}) {
|
|
155
|
-
const
|
|
156
|
-
const
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
() => canonicalAgentId ? makeSelectAgentConversations(canonicalAgentId, null) : null,
|
|
166
|
-
[canonicalAgentId]
|
|
167
|
-
);
|
|
168
|
-
const conversationState = useAppSelector(
|
|
169
|
-
(state) => selectConversations ? selectConversations(state) : null
|
|
170
|
-
);
|
|
171
|
-
const status = conversationState?.status ?? "idle";
|
|
172
|
-
const conversations = conversationState?.conversations ?? [];
|
|
173
|
-
const archived = conversationState?.archived ?? [];
|
|
174
|
-
const error = conversationState?.error ?? null;
|
|
175
|
-
const [showArchived, setShowArchived] = useState(false);
|
|
176
|
-
useEffect(() => {
|
|
177
|
-
if (canonicalAgentId && status === "idle") {
|
|
178
|
-
dispatch(
|
|
179
|
-
fetchAgentConversations({
|
|
180
|
-
agentId: canonicalAgentId,
|
|
181
|
-
versionFilter: null
|
|
182
|
-
})
|
|
183
|
-
);
|
|
184
|
-
}
|
|
185
|
-
}, [canonicalAgentId, status, dispatch]);
|
|
186
|
-
const versionGroups = useMemo(
|
|
187
|
-
() => groupByVersion(conversations),
|
|
188
|
-
[conversations]
|
|
189
|
-
);
|
|
190
|
-
const archivedGroups = useMemo(() => groupByVersion(archived), [archived]);
|
|
42
|
+
const list = useAgentConversationList(agentId);
|
|
43
|
+
const {
|
|
44
|
+
canonicalAgentId,
|
|
45
|
+
agentName,
|
|
46
|
+
status,
|
|
47
|
+
error,
|
|
48
|
+
conversations,
|
|
49
|
+
archived,
|
|
50
|
+
versionGroups
|
|
51
|
+
} = list;
|
|
191
52
|
useEffect(() => {
|
|
192
53
|
if (!canonicalAgentId) {
|
|
193
54
|
onScope(null);
|
|
@@ -197,7 +58,7 @@ function RunHistorySidebar({
|
|
|
197
58
|
canonicalAgentId,
|
|
198
59
|
status,
|
|
199
60
|
error,
|
|
200
|
-
fetchedAt:
|
|
61
|
+
fetchedAt: list.fetchedAt,
|
|
201
62
|
conversations,
|
|
202
63
|
versionGroups: versionGroups.map((g) => ({
|
|
203
64
|
versionNumber: g.versionNumber,
|
|
@@ -209,7 +70,7 @@ function RunHistorySidebar({
|
|
|
209
70
|
canonicalAgentId,
|
|
210
71
|
status,
|
|
211
72
|
error,
|
|
212
|
-
|
|
73
|
+
list.fetchedAt,
|
|
213
74
|
conversations,
|
|
214
75
|
versionGroups
|
|
215
76
|
]);
|
|
@@ -252,35 +113,14 @@ function RunHistorySidebar({
|
|
|
252
113
|
/* @__PURE__ */ jsx(History, { className: "w-6 h-6 text-muted-foreground mb-2 opacity-40" }),
|
|
253
114
|
/* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: "No conversations yet" })
|
|
254
115
|
] }),
|
|
255
|
-
agentId &&
|
|
256
|
-
|
|
116
|
+
agentId && /* @__PURE__ */ jsx(
|
|
117
|
+
AgentVersionGroupedList,
|
|
257
118
|
{
|
|
258
|
-
group,
|
|
259
119
|
agentId,
|
|
120
|
+
list,
|
|
260
121
|
selectedId: selectedConversationId,
|
|
261
122
|
onSelect,
|
|
262
|
-
|
|
263
|
-
},
|
|
264
|
-
group.versionNumber
|
|
265
|
-
)),
|
|
266
|
-
agentId && /* @__PURE__ */ jsx(
|
|
267
|
-
ArchivedDisclosure,
|
|
268
|
-
{
|
|
269
|
-
count: archived.length,
|
|
270
|
-
open: showArchived,
|
|
271
|
-
onOpenChange: setShowArchived,
|
|
272
|
-
className: "mx-1 mt-1",
|
|
273
|
-
children: archivedGroups.map((group) => /* @__PURE__ */ jsx(
|
|
274
|
-
VersionGroupRow,
|
|
275
|
-
{
|
|
276
|
-
group,
|
|
277
|
-
agentId,
|
|
278
|
-
selectedId: selectedConversationId,
|
|
279
|
-
onSelect,
|
|
280
|
-
defaultOpen: false
|
|
281
|
-
},
|
|
282
|
-
group.versionNumber
|
|
283
|
-
))
|
|
123
|
+
sourceFeature: "agent-runner"
|
|
284
124
|
}
|
|
285
125
|
)
|
|
286
126
|
]
|
|
@@ -3,7 +3,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import { logFailure } from "../../../ui/expectedRefusal.js";
|
|
4
4
|
import { useCallback, useEffect, useRef, useState } from "react";
|
|
5
5
|
import { AlertTriangle, Brain, Loader2, RotateCw, SquarePen } from "lucide-react";
|
|
6
|
-
import { Button } from "@ai-matrx/design-system/controls";
|
|
6
|
+
import { Button, SegmentedControl } from "@ai-matrx/design-system/controls";
|
|
7
7
|
import { WindowPanel } from "../../../host/ui-slots.js";
|
|
8
8
|
import { useAppDispatch, useAppSelector } from "../../../store/hooks.js";
|
|
9
9
|
import { toast } from "../../../host/notify.js";
|
|
@@ -134,30 +134,43 @@ function AgentRunWindowSidebar({
|
|
|
134
134
|
},
|
|
135
135
|
chat.conversationId
|
|
136
136
|
)) }) : null;
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
137
|
+
const [listScope, setListScope] = useState("all");
|
|
138
|
+
const agentOnly = listScope === "agent" && !!canonicalAgentId;
|
|
139
|
+
const scopeToggle = /* @__PURE__ */ jsx("div", { className: "shrink-0 px-2 pt-2 pb-1", children: /* @__PURE__ */ jsx(
|
|
140
|
+
SegmentedControl,
|
|
141
|
+
{
|
|
142
|
+
"aria-label": "Which chats to list",
|
|
143
|
+
fill: true,
|
|
144
|
+
value: agentOnly ? "agent" : "all",
|
|
145
|
+
onValueChange: (next) => setListScope(next),
|
|
146
|
+
data: [
|
|
147
|
+
{ value: "all", label: "All agents" },
|
|
148
|
+
{
|
|
149
|
+
value: "agent",
|
|
150
|
+
label: "This agent",
|
|
151
|
+
title: canonicalAgentId ? "Only chats with the agent in the title bar" : "Pick an agent in the title bar first",
|
|
152
|
+
disabled: !canonicalAgentId
|
|
153
|
+
}
|
|
154
|
+
]
|
|
155
|
+
}
|
|
156
|
+
) });
|
|
146
157
|
return /* @__PURE__ */ jsx(
|
|
147
158
|
ConversationHistorySidebar,
|
|
148
159
|
{
|
|
149
160
|
variant: "consumer",
|
|
150
|
-
scopeId: `${surfaceKey ?? "agent-run-window"}:history:${canonicalAgentId}`,
|
|
151
|
-
agentIds: [canonicalAgentId],
|
|
161
|
+
scopeId: agentOnly ? `${surfaceKey ?? "agent-run-window"}:history:${canonicalAgentId}` : `${surfaceKey ?? "agent-run-window"}:history:all`,
|
|
162
|
+
agentIds: agentOnly && canonicalAgentId ? [canonicalAgentId] : [],
|
|
152
163
|
surfaceId: "agent-runner",
|
|
153
164
|
activeConversationId: null,
|
|
154
165
|
onOpenConversation: handleOpenConversation,
|
|
155
166
|
openInPlace: true,
|
|
156
167
|
surfaceKey: surfaceKey ?? void 0,
|
|
157
168
|
getConversationHref,
|
|
169
|
+
headerSlot: scopeToggle,
|
|
158
170
|
topSlot: sessionSection,
|
|
159
171
|
className: "bg-transparent"
|
|
160
|
-
}
|
|
172
|
+
},
|
|
173
|
+
agentOnly ? `agent:${canonicalAgentId}` : "all"
|
|
161
174
|
);
|
|
162
175
|
}
|
|
163
176
|
function AgentRunWindowNewRunButton({
|