@ai-matrx/chat 0.3.11 → 0.3.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. package/CHANGELOG.md +83 -0
  2. package/dist/agent-copy/export.d.ts +10 -2
  3. package/dist/agent-copy/export.js +3 -2
  4. package/dist/agents/components/agent-widgets/chat-assistant/CompactAssistantInput.js +1 -1
  5. package/dist/agents/components/debug/SandboxFileViewer.js +1 -3
  6. package/dist/agents/components/inputs/AgentVariablesInline.js +1 -1
  7. package/dist/agents/components/inputs/smart-input/AgentTextarea.js +1 -1
  8. package/dist/agents/components/inputs/smart-input/InputActionButtons.js +1 -1
  9. package/dist/agents/components/inputs/smart-input/composer/ComposerAgentPeek.js +6 -6
  10. package/dist/agents/components/messages-display/TranscriptIntegrityCopyButton.js +4 -4
  11. package/dist/agents/components/messages-display/user/UserActionBar.js +3 -18
  12. package/dist/agents/components/run/AgentRunHeader.js +1 -2
  13. package/dist/agents/components/shared/AgentConversationColumn.js +1 -1
  14. package/dist/agents/components/shared/AgentHeader.js +1 -2
  15. package/dist/agents/components/shared/AgentHeaderMobile.js +1 -2
  16. package/dist/agents/components/working-document/DocumentLinkPicker.d.ts +1 -1
  17. package/dist/agents/components/working-document/WorkingDocumentPanel.js +1 -1
  18. package/dist/agents/components/working-document/documents-workspace/DocumentsListRail.js +2 -2
  19. package/dist/agents/components/working-document/documents-workspace/DocumentsWorkspace.js +2 -2
  20. package/dist/agents/hooks/useInstanceInputUndoRedo.d.ts +1 -1
  21. package/dist/agents/hooks/useInstanceInputUndoRedo.js +1 -1
  22. package/dist/agents/hooks/useWorkingDocument.js +7 -6
  23. package/dist/agents/model-registry/model-classes.d.ts +1 -43
  24. package/dist/agents/model-registry/model-classes.js +1 -40
  25. package/dist/agents/model-registry/parse.d.ts +1 -88
  26. package/dist/agents/model-registry/parse.js +1 -246
  27. package/dist/agents/prompt-preview/PromptPreviewContent.js +1 -3
  28. package/dist/agents/redux/agent-definition/selectors.d.ts +8 -8
  29. package/dist/agents/redux/execution-system/active-requests/active-requests.selectors.d.ts +14 -0
  30. package/dist/agents/redux/execution-system/active-requests/active-requests.selectors.js +30 -0
  31. package/dist/agents/redux/execution-system/client-capabilities/desktop-native.provider.js +10 -1
  32. package/dist/agents/redux/execution-system/instance-working-document/cx-working-document.service.d.ts +18 -16
  33. package/dist/agents/redux/execution-system/instance-working-document/cx-working-document.service.js +101 -52
  34. package/dist/agents/redux/execution-system/instance-working-document/instance-working-document.slice.d.ts +2 -2
  35. package/dist/agents/redux/execution-system/instance-working-document/instance-working-document.thunks.d.ts +1 -1
  36. package/dist/agents/redux/execution-system/instance-working-document/scratchpad.thunks.d.ts +1 -1
  37. package/dist/agents/redux/execution-system/message-crud/refetch-single-message.thunk.js +5 -0
  38. package/dist/agents/redux/execution-system/thunks/process-stream.js +2 -2
  39. package/dist/agents/redux/execution-system/utils/stream-block-accumulator.d.ts +14 -0
  40. package/dist/agents/redux/execution-system/utils/stream-block-accumulator.js +28 -0
  41. package/dist/agents/utils/platform-keys.d.ts +15 -0
  42. package/dist/agents/utils/platform-keys.js +69 -0
  43. package/dist/context/sources/scopes.d.ts +1 -1
  44. package/dist/cx-chat/components/user-input/ConversationInput.js +1 -1
  45. package/dist/cx-conversation/ConversationInput.js +1 -1
  46. package/dist/host/db-types.d.ts +23242 -23071
  47. package/dist/host/ui-slots.d.ts +50 -64
  48. package/dist/host/ui-slots.js +12 -52
  49. package/dist/public-chat/components/GuidedVariableInputs.js +1 -1
  50. package/dist/public-chat/components/PublicVariableInputs.js +1 -1
  51. package/dist/react.cjs +11 -23
  52. package/dist/react.cjs.map +1 -1
  53. package/dist/react.js +11 -23
  54. package/dist/react.js.map +1 -1
  55. package/dist/surfaces/manifests/_conversation-document.manifest.js +1 -1
  56. package/dist/tool-call-visualization/registry/registry.js +13 -0
  57. package/dist/ui/composer/useTouchOnlyDevice.js +1 -1
  58. package/dist/ui/skills-types.d.ts +1 -275
  59. package/dist/ui/skills-types.js +1 -0
  60. package/dist/voice-agent/components/VoiceDebugPanel.js +1 -3
  61. package/package.json +60 -34
  62. package/dist/agents/components/run/run-sidebar/AgentRunsSidebar.d.ts +0 -15
  63. package/dist/agents/components/run/run-sidebar/AgentRunsSidebar.js +0 -201
  64. package/dist/agents/components/run-controls/AgentExecutionTestModal.d.ts +0 -36
  65. package/dist/agents/components/run-controls/AgentExecutionTestModal.js +0 -440
  66. package/dist/agents/components/run-controls/AgentLauncherSidebarTester.d.ts +0 -6
  67. package/dist/agents/components/run-controls/AgentLauncherSidebarTester.js +0 -127
  68. package/dist/agents/components/run-controls/AgentWidgetInvokerTester.d.ts +0 -6
  69. package/dist/agents/components/run-controls/AgentWidgetInvokerTester.js +0 -84
  70. package/dist/agents/components/run-controls/CreatorRunPanel.d.ts +0 -22
  71. package/dist/agents/components/run-controls/CreatorRunPanel.js +0 -108
  72. package/dist/agents/components/run-controls/CreatorRunTabContent.d.ts +0 -30
  73. package/dist/agents/components/run-controls/CreatorRunTabContent.js +0 -319
  74. package/dist/agents/components/run-controls/PayloadTab.d.ts +0 -5
  75. package/dist/agents/components/run-controls/PayloadTab.js +0 -388
  76. package/dist/agents/components/run-controls/TesterSettingsPanel.d.ts +0 -71
  77. package/dist/agents/components/run-controls/TesterSettingsPanel.js +0 -470
  78. package/dist/agents/components/shared/AgentOptionsMenu.d.ts +0 -8
  79. package/dist/agents/components/shared/AgentOptionsMenu.js +0 -776
  80. package/dist/agents/components/shared/AgentPeekDuplicateButton.d.ts +0 -8
  81. package/dist/agents/components/shared/AgentPeekDuplicateButton.js +0 -66
  82. package/dist/agents/components/shared/AgentSaveStatus.d.ts +0 -7
  83. package/dist/agents/components/shared/AgentSaveStatus.js +0 -128
  84. package/dist/agents/components/shared/AgentSaveTapButton.d.ts +0 -18
  85. package/dist/agents/components/shared/AgentSaveTapButton.js +0 -105
  86. package/dist/agents/components/shared/useAgentSaveAction.d.ts +0 -33
  87. package/dist/agents/components/shared/useAgentSaveAction.js +0 -179
  88. package/dist/agents/components/shell/AgentsListHeader.d.ts +0 -1
  89. package/dist/agents/components/shell/AgentsListHeader.js +0 -69
  90. package/dist/agents/components/undo-history/AgentEditHistory.d.ts +0 -9
  91. package/dist/agents/components/undo-history/AgentEditHistory.js +0 -244
  92. package/dist/agents/components/unused/AgentSharedHeader.d.ts +0 -3
  93. package/dist/agents/components/unused/AgentSharedHeader.js +0 -134
  94. package/dist/agents/components/widgets/AgentWidgetsPage.d.ts +0 -11
  95. package/dist/agents/components/widgets/AgentWidgetsPage.js +0 -571
  96. package/dist/agents/components/widgets/WidgetVariableInputs.d.ts +0 -8
  97. package/dist/agents/components/widgets/WidgetVariableInputs.js +0 -80
  98. package/dist/agents/components/widgets/build-widget-launch.d.ts +0 -70
  99. package/dist/agents/components/widgets/build-widget-launch.js +0 -90
  100. package/dist/agents/hooks/useAgentAutoSave.d.ts +0 -1
  101. package/dist/agents/hooks/useAgentAutoSave.js +0 -127
  102. package/dist/agents/hooks/useAgentBuilderWriteHandlers.d.ts +0 -9
  103. package/dist/agents/hooks/useAgentBuilderWriteHandlers.js +0 -102
  104. package/dist/agents/hooks/useAgentDuplicateFlow.d.ts +0 -25
  105. package/dist/agents/hooks/useAgentDuplicateFlow.js +0 -133
  106. package/dist/agents/hooks/useAgentUndoRedo.d.ts +0 -31
  107. package/dist/agents/hooks/useAgentUndoRedo.js +0 -134
  108. package/dist/agents/hooks/useAgentUsages.d.ts +0 -17
  109. package/dist/agents/hooks/useAgentUsages.js +0 -36
  110. package/dist/agents/hooks/useDriftAlerts.d.ts +0 -11
  111. package/dist/agents/hooks/useDriftAlerts.js +0 -36
  112. package/dist/agents/hooks/useDriftReport.d.ts +0 -20
  113. package/dist/agents/hooks/useDriftReport.js +0 -34
  114. package/dist/agents/lifecycle/useAgentLifecycleActions.d.ts +0 -17
  115. package/dist/agents/lifecycle/useAgentLifecycleActions.js +0 -63
  116. package/dist/agents/message-flags/useMessageFlags.d.ts +0 -8
  117. package/dist/agents/message-flags/useMessageFlags.js +0 -68
  118. package/dist/agents/services/agent-definition-snapshot.service.d.ts +0 -15
  119. package/dist/agents/services/agent-definition-snapshot.service.js +0 -20
  120. package/dist/agents/surface-catalog-profile.d.ts +0 -96
  121. package/dist/agents/surface-catalog-profile.js +0 -79
  122. package/dist/cx-chat/hooks/useAgentBootstrap.d.ts +0 -1
  123. package/dist/cx-chat/hooks/useAgentBootstrap.js +0 -110
  124. package/dist/host/builder-door.d.ts +0 -61
  125. package/dist/host/builder-door.js +0 -25
  126. package/dist/next/lazy/CreatorRunPanel.d.ts +0 -1
  127. package/dist/next/lazy/CreatorRunPanel.js +0 -11
  128. package/dist/ui/composer/composerSubmit.d.ts +0 -50
  129. package/dist/ui/composer/composerSubmit.js +0 -32
@@ -1,246 +1 @@
1
- import { captureError } from "../../host/diagnostics.js";
2
- import {
3
- DEFAULT_CAPABILITIES,
4
- isContentType,
5
- isFeatureKey,
6
- isInteractionMode
7
- } from "@ai-matrx/agents/models";
8
- const CANONICAL_CAPABILITY_KEYS = /* @__PURE__ */ new Set([
9
- "input",
10
- "output",
11
- "features",
12
- "interaction",
13
- "multilingual",
14
- "image_reference_roles"
15
- ]);
16
- const reportedUnknowns = /* @__PURE__ */ new Set();
17
- function reportUnknownCapabilityValue(field, value, context) {
18
- try {
19
- const modelId = context?.modelId ?? "unknown";
20
- const key = `${modelId}|${field}|${JSON.stringify(value)}`;
21
- if (reportedUnknowns.has(key)) return;
22
- reportedUnknowns.add(key);
23
- const message = `Unknown capabilities.${field} value ${JSON.stringify(value)} on model ${modelId}${context?.modelName ? ` (${context.modelName})` : ""} \u2014 not in the FE vocabulary (features/ai-models/capabilities/types.ts); value ignored until the vocabulary is extended.`;
24
- console.warn(`[parseCapabilities] ${message}`);
25
- captureError({
26
- source: "data-shape",
27
- relation: "ai.model_definition.capabilities",
28
- message,
29
- details: JSON.stringify({ field, value, modelId, modelName: context?.modelName })?.slice(0, 500)
30
- });
31
- } catch {
32
- }
33
- }
34
- function collect(field, raw, guard, context) {
35
- if (!Array.isArray(raw)) return [];
36
- const out = [];
37
- for (const value of raw) {
38
- if (guard(value)) {
39
- if (!out.includes(value)) out.push(value);
40
- } else {
41
- reportUnknownCapabilityValue(field, value, context);
42
- }
43
- }
44
- return out;
45
- }
46
- function parseCapabilities(raw, context) {
47
- if (typeof raw !== "object" || raw === null || Array.isArray(raw)) {
48
- return { ...DEFAULT_CAPABILITIES };
49
- }
50
- const obj = raw;
51
- for (const key of Object.keys(obj)) {
52
- if (!CANONICAL_CAPABILITY_KEYS.has(key)) {
53
- reportUnknownCapabilityValue(key, obj[key], context);
54
- }
55
- }
56
- const input = collect("input", obj.input, isContentType, context);
57
- const output = collect("output", obj.output, isContentType, context);
58
- const features = collect("features", obj.features, isFeatureKey, context);
59
- let interaction;
60
- if (isInteractionMode(obj.interaction)) {
61
- interaction = obj.interaction;
62
- } else {
63
- if (obj.interaction !== void 0) {
64
- reportUnknownCapabilityValue("interaction", obj.interaction, context);
65
- }
66
- interaction = "turn";
67
- }
68
- let multilingual = false;
69
- if (typeof obj.multilingual === "boolean") {
70
- multilingual = obj.multilingual;
71
- } else if (obj.multilingual !== void 0) {
72
- reportUnknownCapabilityValue("multilingual", obj.multilingual, context);
73
- }
74
- return {
75
- input: input.length > 0 ? input : ["text"],
76
- output: output.length > 0 ? output : ["text"],
77
- features,
78
- interaction,
79
- multilingual
80
- };
81
- }
82
- function requireCanonicalCapabilities(raw, context) {
83
- const location = context?.modelId ? `ai.model_definition.${context.modelId}.capabilities` : "ai.model_definition.capabilities";
84
- if (typeof raw !== "object" || raw === null || Array.isArray(raw)) {
85
- throw new Error(`Invalid ${location}: expected a canonical capabilities object.`);
86
- }
87
- const value = raw;
88
- for (const key of Object.keys(value)) {
89
- if (!CANONICAL_CAPABILITY_KEYS.has(key)) {
90
- throw new Error(`Invalid ${location}.${key}: unknown canonical capability key.`);
91
- }
92
- }
93
- const requireMembers = (field, guard) => {
94
- const members = value[field];
95
- if (!Array.isArray(members)) {
96
- throw new Error(`Invalid ${location}.${field}: expected an array.`);
97
- }
98
- const canonical = [];
99
- for (const member of members) {
100
- if (!guard(member)) {
101
- throw new Error(
102
- `Invalid ${location}.${field}: unknown capability value ${JSON.stringify(member)}.`
103
- );
104
- }
105
- if (!canonical.includes(member)) canonical.push(member);
106
- }
107
- return canonical;
108
- };
109
- const input = requireMembers("input", isContentType);
110
- const output = requireMembers("output", isContentType);
111
- const features = requireMembers("features", isFeatureKey);
112
- if (!isInteractionMode(value.interaction)) {
113
- throw new Error(`Invalid ${location}.interaction: unknown interaction mode.`);
114
- }
115
- if (value.multilingual !== void 0 && typeof value.multilingual !== "boolean") {
116
- throw new Error(`Invalid ${location}.multilingual: expected a boolean.`);
117
- }
118
- return {
119
- input: input.length > 0 ? input : ["text"],
120
- output: output.length > 0 ? output : ["text"],
121
- features,
122
- interaction: value.interaction,
123
- multilingual: value.multilingual ?? false
124
- };
125
- }
126
- function toAuditRecord(caps) {
127
- return {
128
- text_input: caps.input.includes("text"),
129
- text_output: caps.output.includes("text"),
130
- image_input: caps.input.includes("image"),
131
- image_output: caps.output.includes("image"),
132
- audio_input: caps.input.includes("audio"),
133
- audio_output: caps.output.includes("audio"),
134
- video_input: caps.input.includes("video"),
135
- document_input: caps.input.includes("document"),
136
- // vision is set explicitly OR implied by image input.
137
- vision: caps.features.includes("vision") || caps.input.includes("image"),
138
- code_execution: caps.features.includes("code_execution"),
139
- function_calling: caps.features.includes("function_calling"),
140
- streaming: caps.features.includes("streaming"),
141
- web_search: caps.features.includes("web_search"),
142
- json_mode: caps.features.includes("json_mode"),
143
- structured_output: caps.features.includes("structured_output"),
144
- system_prompt: caps.features.includes("system_prompt"),
145
- multi_turn: caps.features.includes("multi_turn"),
146
- embeddings: caps.features.includes("embeddings"),
147
- fine_tuning: caps.features.includes("fine_tuning"),
148
- batch_api: caps.features.includes("batch_api")
149
- };
150
- }
151
- const AUDIT_FLAG_LOCATION = {
152
- text_input: { array: "input", value: "text" },
153
- image_input: { array: "input", value: "image" },
154
- audio_input: { array: "input", value: "audio" },
155
- video_input: { array: "input", value: "video" },
156
- document_input: { array: "input", value: "document" },
157
- text_output: { array: "output", value: "text" },
158
- image_output: { array: "output", value: "image" },
159
- audio_output: { array: "output", value: "audio" },
160
- // NOTE: `vision` maps to the `vision` FEATURE only. The read projection
161
- // (`toAuditRecord`) also implies vision from image input, so toggling
162
- // vision OFF while image input stays on will still project true — that
163
- // asymmetry is inherent to the flat view, not a data loss.
164
- vision: { array: "features", value: "vision" },
165
- code_execution: { array: "features", value: "code_execution" },
166
- function_calling: { array: "features", value: "function_calling" },
167
- streaming: { array: "features", value: "streaming" },
168
- web_search: { array: "features", value: "web_search" },
169
- json_mode: { array: "features", value: "json_mode" },
170
- structured_output: { array: "features", value: "structured_output" },
171
- system_prompt: { array: "features", value: "system_prompt" },
172
- multi_turn: { array: "features", value: "multi_turn" },
173
- embeddings: { array: "features", value: "embeddings" },
174
- fine_tuning: { array: "features", value: "fine_tuning" },
175
- batch_api: { array: "features", value: "batch_api" }
176
- };
177
- function mergeAuditRecordIntoCapabilities(raw, edited, context) {
178
- const base = typeof raw === "object" && raw !== null && !Array.isArray(raw) ? { ...raw } : { input: ["text"], output: ["text"], features: [], interaction: "turn" };
179
- for (const key of ["input", "output", "features"]) {
180
- base[key] = Array.isArray(base[key]) ? [...base[key]] : [];
181
- }
182
- const baseline = toAuditRecord(parseCapabilities(raw, context));
183
- for (const flag of Object.keys(AUDIT_FLAG_LOCATION)) {
184
- const desired = edited[flag];
185
- if (desired === void 0 || desired === baseline[flag]) continue;
186
- const { array, value } = AUDIT_FLAG_LOCATION[flag];
187
- const members = base[array];
188
- if (desired) {
189
- if (!members.includes(value)) members.push(value);
190
- } else {
191
- const idx = members.indexOf(value);
192
- if (idx !== -1) members.splice(idx, 1);
193
- }
194
- }
195
- return base;
196
- }
197
- import {
198
- CONTENT_TYPES,
199
- FEATURE_KEYS,
200
- INTERACTION_MODES,
201
- DEFAULT_CAPABILITIES as DEFAULT_CAPABILITIES2
202
- } from "@ai-matrx/agents/models";
203
- function findNonCanonicalCapabilityValues(raw) {
204
- if (typeof raw !== "object" || raw === null || Array.isArray(raw)) {
205
- return [
206
- "capabilities must be the canonical { input, output, features, interaction, multilingual } object"
207
- ];
208
- }
209
- const obj = raw;
210
- const problems = [];
211
- for (const key of Object.keys(obj)) {
212
- if (!CANONICAL_CAPABILITY_KEYS.has(key)) problems.push(`unknown key "${key}"`);
213
- }
214
- const scan = (field, guard) => {
215
- const value = obj[field];
216
- if (value === void 0) return;
217
- if (!Array.isArray(value)) {
218
- problems.push(`${field} must be an array of strings`);
219
- return;
220
- }
221
- for (const member of value) {
222
- if (!guard(member)) problems.push(`${field} value ${JSON.stringify(member)}`);
223
- }
224
- };
225
- scan("input", isContentType);
226
- scan("output", isContentType);
227
- scan("features", isFeatureKey);
228
- if (obj.interaction !== void 0 && !isInteractionMode(obj.interaction)) {
229
- problems.push(`interaction ${JSON.stringify(obj.interaction)}`);
230
- }
231
- if (obj.multilingual !== void 0 && typeof obj.multilingual !== "boolean") {
232
- problems.push("multilingual must be a boolean");
233
- }
234
- return problems;
235
- }
236
- export {
237
- CONTENT_TYPES,
238
- DEFAULT_CAPABILITIES2 as DEFAULT_CAPABILITIES,
239
- FEATURE_KEYS,
240
- INTERACTION_MODES,
241
- findNonCanonicalCapabilityValues,
242
- mergeAuditRecordIntoCapabilities,
243
- parseCapabilities,
244
- requireCanonicalCapabilities,
245
- toAuditRecord
246
- };
1
+ export * from "@ai-matrx/agents/models";
@@ -5,7 +5,6 @@ import { toast as copyToast } from "../../host/notify.js";
5
5
  import { useEffect, useState } from "react";
6
6
  import { Loader2, Copy, RefreshCw, AlertTriangle } from "lucide-react";
7
7
  import { Button } from "@ai-matrx/design-system/controls";
8
- import { toast } from "../../host/notify.js";
9
8
  import { useAppStore } from "../../store/hooks.js";
10
9
  import { requestPromptPreview } from "./service.js";
11
10
  import { ErrorAlchemyMenu } from "../../host/ui-slots.js";
@@ -43,8 +42,7 @@ function PromptPreviewContent({
43
42
  };
44
43
  }, [conversationId, store, nonce]);
45
44
  const copy = async (label, text) => {
46
- if (!await copyText(text)) return;
47
- toast.success(`${label} copied`);
45
+ if (!await copyText(text, `${label} copied`)) return;
48
46
  };
49
47
  return /* @__PURE__ */ jsxs("div", { className: "flex min-h-0 flex-1 flex-col gap-3 bg-textured p-4", children: [
50
48
  /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-2", children: [
@@ -9328,18 +9328,18 @@ export declare const selectAgentSkillConfig: ((state: {
9328
9328
  conversationAttachments: import("../../connectors/attachments.slice.js").AttachmentsSliceState;
9329
9329
  modelRegistry: import("../../model-registry/modelRegistrySlice.js").ModelRegistryState;
9330
9330
  chatHost: import("../../../store/chat-host.slice.js").ChatHostState;
9331
- } & import("../../../store/root-state.js").ChatHostReadSlices, id: string) => import("../../../ui/skills-types.js").SkillConfig) & {
9331
+ } & import("../../../store/root-state.js").ChatHostReadSlices, id: string) => import("@ai-matrx/agents/skills").SkillConfig) & {
9332
9332
  clearCache: () => void;
9333
9333
  resultsCount: () => number;
9334
9334
  resetResultsCount: () => void;
9335
9335
  } & {
9336
- resultFunc: (resultFuncArgs_0: AgentDefinitionRecord | undefined) => import("../../../ui/skills-types.js").SkillConfig;
9337
- memoizedResultFunc: ((resultFuncArgs_0: AgentDefinitionRecord | undefined) => import("../../../ui/skills-types.js").SkillConfig) & {
9336
+ resultFunc: (resultFuncArgs_0: AgentDefinitionRecord | undefined) => import("@ai-matrx/agents/skills").SkillConfig;
9337
+ memoizedResultFunc: ((resultFuncArgs_0: AgentDefinitionRecord | undefined) => import("@ai-matrx/agents/skills").SkillConfig) & {
9338
9338
  clearCache: () => void;
9339
9339
  resultsCount: () => number;
9340
9340
  resetResultsCount: () => void;
9341
9341
  };
9342
- lastResult: () => import("../../../ui/skills-types.js").SkillConfig;
9342
+ lastResult: () => import("@ai-matrx/agents/skills").SkillConfig;
9343
9343
  dependencies: [((state: {
9344
9344
  voiceAgent: import("../../../voice-agent/types.js").VoiceAgentState;
9345
9345
  agentDefinition: import("../../types/agent-definition.types.js").AgentDefinitionSliceState;
@@ -14241,7 +14241,7 @@ export declare const selectAgentFieldOriginalValue: ((state: {
14241
14241
  output_quality?: number | undefined;
14242
14242
  seconds?: number | undefined;
14243
14243
  duration?: number | undefined;
14244
- } | import("../../types/json-schema.js").OutputSchema | import("../../../ui/skills-types.js").SkillConfig | {
14244
+ } | import("../../types/json-schema.js").OutputSchema | import("@ai-matrx/agents/skills").SkillConfig | {
14245
14245
  tools?: boolean | undefined;
14246
14246
  image_urls?: boolean | undefined;
14247
14247
  file_urls?: boolean | undefined;
@@ -14502,7 +14502,7 @@ export declare const selectAgentFieldOriginalValue: ((state: {
14502
14502
  output_quality?: number | undefined;
14503
14503
  seconds?: number | undefined;
14504
14504
  duration?: number | undefined;
14505
- } | import("../../types/json-schema.js").OutputSchema | import("../../../ui/skills-types.js").SkillConfig | {
14505
+ } | import("../../types/json-schema.js").OutputSchema | import("@ai-matrx/agents/skills").SkillConfig | {
14506
14506
  tools?: boolean | undefined;
14507
14507
  image_urls?: boolean | undefined;
14508
14508
  file_urls?: boolean | undefined;
@@ -14759,7 +14759,7 @@ export declare const selectAgentFieldOriginalValue: ((state: {
14759
14759
  output_quality?: number | undefined;
14760
14760
  seconds?: number | undefined;
14761
14761
  duration?: number | undefined;
14762
- } | import("../../types/json-schema.js").OutputSchema | import("../../../ui/skills-types.js").SkillConfig | {
14762
+ } | import("../../types/json-schema.js").OutputSchema | import("@ai-matrx/agents/skills").SkillConfig | {
14763
14763
  tools?: boolean | undefined;
14764
14764
  image_urls?: boolean | undefined;
14765
14765
  file_urls?: boolean | undefined;
@@ -15020,7 +15020,7 @@ export declare const selectAgentFieldOriginalValue: ((state: {
15020
15020
  output_quality?: number | undefined;
15021
15021
  seconds?: number | undefined;
15022
15022
  duration?: number | undefined;
15023
- } | import("../../types/json-schema.js").OutputSchema | import("../../../ui/skills-types.js").SkillConfig | {
15023
+ } | import("../../types/json-schema.js").OutputSchema | import("@ai-matrx/agents/skills").SkillConfig | {
15024
15024
  tools?: boolean | undefined;
15025
15025
  image_urls?: boolean | undefined;
15026
15026
  file_urls?: boolean | undefined;
@@ -122,6 +122,20 @@ export declare const NON_ANSWER_BLOCK_TYPES: Set<string>;
122
122
  * chunk text. `editedText` wins, mirroring the selectors.
123
123
  */
124
124
  export declare function deriveAnswerText(request: Pick<ActiveRequest, "renderBlockOrder" | "renderBlocks" | "editedText">): string;
125
+ /**
126
+ * The answer text FOR DATA CAPTURE (JSON extraction). Identical to
127
+ * {@link deriveAnswerText} except where a JSON wrapper holding kinds was split
128
+ * for display (A7: kinds + a residual that has the kinds REMOVED): those
129
+ * blocks are replaced by the bytes they were cut from. Without this, a
130
+ * structured answer whose arrays hold `{"__kind": …}` items was captured with
131
+ * those arrays EMPTY — an Applet's `sources` saved as `[]` (2026-10-07).
132
+ * A split whose blocks are no longer all present (a rewind) falls back to the
133
+ * blocks themselves.
134
+ */
135
+ export declare function deriveAnswerDataText(request: Pick<ActiveRequest, "renderBlockOrder" | "renderBlocks" | "editedText">, wrapperSplits: ReadonlyArray<{
136
+ blockIds: string[];
137
+ source: string;
138
+ }>): string;
125
139
  /**
126
140
  * Lossless document projection of an answer for string destinations that
127
141
  * intentionally accept Content IR. Plain-answer consumers keep using
@@ -47,6 +47,35 @@ function deriveAnswerText(request) {
47
47
  const answer = order.map((id) => blocks[id]).filter((b) => b && !NON_ANSWER_BLOCK_TYPES.has(b.type)).map((b) => b?.content ?? "").filter(Boolean).join("\n");
48
48
  return stripThinkingStreaming(answer).visible;
49
49
  }
50
+ function deriveAnswerDataText(request, wrapperSplits) {
51
+ if (wrapperSplits.length === 0) return deriveAnswerText(request);
52
+ const { renderBlockOrder: order, renderBlocks: blocks, editedText } = request;
53
+ if (editedText !== null && editedText !== void 0) return editedText;
54
+ if (!order || !blocks || order.length === 0) return "";
55
+ const present = new Set(order);
56
+ const splitOf = /* @__PURE__ */ new Map();
57
+ for (const split of wrapperSplits) {
58
+ if (split.blockIds.length === 0) continue;
59
+ if (!split.blockIds.every((id) => present.has(id))) continue;
60
+ for (const id of split.blockIds) splitOf.set(id, split);
61
+ }
62
+ const emitted = /* @__PURE__ */ new Set();
63
+ const parts = [];
64
+ for (const id of order) {
65
+ const split = splitOf.get(id);
66
+ if (split) {
67
+ if (!emitted.has(split)) {
68
+ emitted.add(split);
69
+ parts.push(split.source);
70
+ }
71
+ continue;
72
+ }
73
+ const block = blocks[id];
74
+ if (!block || NON_ANSWER_BLOCK_TYPES.has(block.type)) continue;
75
+ if (block.content) parts.push(block.content);
76
+ }
77
+ return stripThinkingStreaming(parts.join("\n")).visible;
78
+ }
50
79
  function hasKindMarker(value) {
51
80
  return typeof value === "object" && value !== null && !Array.isArray(value) && typeof value.__kind === "string";
52
81
  }
@@ -1169,6 +1198,7 @@ export {
1169
1198
  NON_ANSWER_BLOCK_TYPES,
1170
1199
  blockCarriesDataNotText,
1171
1200
  blockHasSomethingToRender,
1201
+ deriveAnswerDataText,
1172
1202
  deriveAnswerDocumentText,
1173
1203
  deriveAnswerText,
1174
1204
  deriveDecisionResultText,
@@ -1,11 +1,20 @@
1
1
  import { getLiveDesktopInstance } from "./desktop-presence.js";
2
2
  import { registerClientCapability } from "./registry.js";
3
+ import { isChatHostConfigured, onChatHostConfigured } from "../../../../host/configure.js";
3
4
  function toSysPlatform(platform) {
4
5
  return platform === "windows" ? "win32" : platform;
5
6
  }
6
7
  const PRESENCE_BUDGET_MS = 150;
7
8
  if (typeof window !== "undefined") {
8
- setTimeout(() => void getLiveDesktopInstance(), 0);
9
+ const warm = () => setTimeout(() => void getLiveDesktopInstance(), 0);
10
+ if (isChatHostConfigured()) {
11
+ warm();
12
+ } else {
13
+ const stop = onChatHostConfigured(() => {
14
+ stop();
15
+ warm();
16
+ });
17
+ }
9
18
  }
10
19
  registerClientCapability({
11
20
  name: "desktop-native",
@@ -1,7 +1,10 @@
1
1
  /**
2
- * cx-working-document.service — Supabase access for `workbench.working_documents`
3
- * (the canonical working-document entity) + its M2M links to conversations via
4
- * `platform.associations`.
2
+ * cx-working-document.service — Supabase access for chat working documents and
3
+ * scratchpads, stored in THE content store (`content.document`, document types
4
+ * `working_document` / `scratch`) + their M2M links to conversations via
5
+ * `platform.associations` (source type `document`). The retired table moved
6
+ * here on 2026-10-07 (cleanup C5c) with its ids, owners, organizations, times
7
+ * and version history.
5
8
  *
6
9
  * The chat-conversation analog of Scribe's `studio_documents`, generalised to a
7
10
  * first-class, versioned, owner-scoped entity. A working document is a piece of
@@ -17,7 +20,7 @@
17
20
  * committed. So an enabled-but-untouched document leaves zero records.
18
21
  *
19
22
  * RELATIONSHIPS: chat↔doc links are `platform.associations` edges
20
- * (`working_document` source → `conversation` target), reached ONLY through the
23
+ * (`document` source → `conversation` target), reached ONLY through the
21
24
  * canonical `associationsService`. The per-link opt-in flag + the doc kind live
22
25
  * on the edge `metadata` (`{enabled, doc_kind}`). The bespoke
23
26
  * `cx_conversation_documents` junction is retired.
@@ -34,11 +37,12 @@
34
37
  */
35
38
  import { type ResourceAccess } from "../../../../ui/access-core.js";
36
39
  export type WorkingDocumentKind = "working" | "scratch";
40
+ /** A `content.document` row as this service selects it (body = the text). */
37
41
  export interface CxWorkingDocumentRow {
38
42
  id: string;
39
- kind: string;
43
+ document_type_id: string;
40
44
  title: string;
41
- content: string;
45
+ body: string;
42
46
  version: number;
43
47
  metadata?: {
44
48
  origin_conversation_id?: string | null;
@@ -63,6 +67,10 @@ export interface CxWorkingDocument {
63
67
  updatedAt: string;
64
68
  }
65
69
  export declare function rowToCxWorkingDocument(row: CxWorkingDocumentRow): CxWorkingDocument;
70
+ /** The entity token of every working document and scratchpad: a content-store document. */
71
+ export declare const WORKING_DOCUMENT_ENTITY = "document";
72
+ /** The `platform.categories` ids of the two document types, read once. */
73
+ export declare function workingDocumentTypeIds(): Promise<Record<WorkingDocumentKind, string>>;
66
74
  /**
67
75
  * The caller's access to a document via the canonical view-vs-edit gate
68
76
  * (`get_resource_access` — same model RLS enforces). Never throws; failures
@@ -148,7 +156,7 @@ export interface MaterializeArgs {
148
156
  content: string;
149
157
  }
150
158
  /**
151
- * Create (or resolve, idempotently) the durable `workbench.working_documents`
159
+ * Create (or resolve, idempotently) the durable `content.document`
152
160
  * row for a reserved id, writing the first content + title. The owner
153
161
  * (`created_by`) is stamped by the DB trigger from `auth.uid()`. Returns the row
154
162
  * (with its `version`).
@@ -199,11 +207,9 @@ export declare function setConversationDocumentEnabled(documentId: string, conve
199
207
  export declare function listConversationDocuments(conversationId: string): Promise<ConversationDocumentLink[]>;
200
208
  /** Every conversation a document is attached to (for the "linked in N chats" UI). */
201
209
  export declare function listDocumentConversations(documentId: string): Promise<string[]>;
202
- /** The entity token the working document registers under. */
203
- export declare const WORKING_DOCUMENT_TOKEN = "working_document";
204
210
  export interface WorkingDocumentVersion {
205
211
  version: number;
206
- /** DB operation that produced this version (INSERT / UPDATE / DELETE). */
212
+ /** What changed in this version: content / lifecycle / governance. */
207
213
  operation: string;
208
214
  /** Who made the edit — the agent (service actor) or the user. Null when unknown. */
209
215
  actorId: string | null;
@@ -213,11 +219,7 @@ export interface WorkingDocumentVersion {
213
219
  }
214
220
  /** List a working document's durable versions, newest first. */
215
221
  export declare function listWorkingDocumentVersions(documentId: string, limit?: number): Promise<WorkingDocumentVersion[]>;
216
- /** The full text content captured at a given version (from the row snapshot). */
222
+ /** The text of one version (null when the version carries no body). */
217
223
  export declare function getWorkingDocumentVersionContent(documentId: string, version: number): Promise<string | null>;
218
- /**
219
- * Restore a working document to a prior version (content columns only — never
220
- * identity/ownership). Returns the NEW version number (restore itself captures a
221
- * fresh version, so history is preserved). Editor access required.
222
- */
224
+ /** Restore a past version as a NEW version; returns the new version number. */
223
225
  export declare function restoreWorkingDocumentVersion(documentId: string, version: number): Promise<number>;