@ai-matrx/chat 0.3.15 → 0.3.20

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 (116) hide show
  1. package/CHANGELOG.md +53 -0
  2. package/dist/agents/components/agent-widgets/chat-assistant/CompactAssistantInput.js +1 -1
  3. package/dist/agents/components/inputs/AgentVariablesInline.js +1 -1
  4. package/dist/agents/components/inputs/smart-input/AgentTextarea.js +1 -1
  5. package/dist/agents/components/inputs/smart-input/InputActionButtons.js +1 -1
  6. package/dist/agents/components/inputs/smart-input/composer/ComposerAgentPeek.js +6 -6
  7. package/dist/agents/components/run/AgentRunHeader.js +1 -2
  8. package/dist/agents/components/shared/AgentConversationColumn.js +1 -1
  9. package/dist/agents/components/shared/AgentHeader.js +1 -2
  10. package/dist/agents/components/shared/AgentHeaderMobile.js +1 -2
  11. package/dist/agents/components/working-document/DocumentLinkPicker.d.ts +1 -1
  12. package/dist/agents/components/working-document/WorkingDocumentPanel.js +1 -1
  13. package/dist/agents/components/working-document/documents-workspace/DocumentsListRail.js +2 -2
  14. package/dist/agents/components/working-document/documents-workspace/DocumentsWorkspace.js +2 -2
  15. package/dist/agents/hooks/useInstanceInputUndoRedo.d.ts +1 -1
  16. package/dist/agents/hooks/useInstanceInputUndoRedo.js +1 -1
  17. package/dist/agents/hooks/useWorkingDocument.js +11 -7
  18. package/dist/agents/model-registry/model-classes.d.ts +1 -43
  19. package/dist/agents/model-registry/model-classes.js +1 -40
  20. package/dist/agents/model-registry/parse.d.ts +1 -88
  21. package/dist/agents/model-registry/parse.js +1 -246
  22. package/dist/agents/redux/agent-definition/selectors.d.ts +8 -8
  23. package/dist/agents/redux/execution-system/instance-working-document/cx-working-document.service.d.ts +18 -16
  24. package/dist/agents/redux/execution-system/instance-working-document/cx-working-document.service.js +101 -52
  25. package/dist/agents/redux/execution-system/instance-working-document/instance-working-document.slice.d.ts +2 -2
  26. package/dist/agents/redux/execution-system/instance-working-document/instance-working-document.thunks.d.ts +1 -1
  27. package/dist/agents/redux/execution-system/instance-working-document/scratchpad.thunks.d.ts +1 -1
  28. package/dist/agents/utils/platform-keys.d.ts +15 -0
  29. package/dist/agents/utils/platform-keys.js +69 -0
  30. package/dist/cx-chat/components/user-input/ConversationInput.js +1 -1
  31. package/dist/cx-conversation/ConversationInput.js +1 -1
  32. package/dist/host/db-types.d.ts +1123 -1691
  33. package/dist/host/ui-slots.d.ts +47 -64
  34. package/dist/host/ui-slots.js +10 -52
  35. package/dist/public-chat/components/GuidedVariableInputs.js +1 -1
  36. package/dist/public-chat/components/PublicVariableInputs.js +1 -1
  37. package/dist/react.cjs +11 -23
  38. package/dist/react.cjs.map +1 -1
  39. package/dist/react.js +11 -23
  40. package/dist/react.js.map +1 -1
  41. package/dist/surfaces/manifests/_conversation-document.manifest.js +1 -1
  42. package/dist/tool-call-visualization/registry/registry.js +13 -0
  43. package/dist/tool-call-visualization/result-fields/KeyValueGrid.d.ts +6 -0
  44. package/dist/tool-call-visualization/result-fields/KeyValueGrid.js +10 -2
  45. package/dist/ui/composer/useTouchOnlyDevice.js +1 -1
  46. package/dist/ui/skills-types.d.ts +1 -275
  47. package/dist/ui/skills-types.js +1 -0
  48. package/package.json +59 -33
  49. package/dist/agents/components/run/run-sidebar/AgentRunsSidebar.d.ts +0 -15
  50. package/dist/agents/components/run/run-sidebar/AgentRunsSidebar.js +0 -201
  51. package/dist/agents/components/run-controls/AgentExecutionTestModal.d.ts +0 -36
  52. package/dist/agents/components/run-controls/AgentExecutionTestModal.js +0 -440
  53. package/dist/agents/components/run-controls/AgentLauncherSidebarTester.d.ts +0 -6
  54. package/dist/agents/components/run-controls/AgentLauncherSidebarTester.js +0 -127
  55. package/dist/agents/components/run-controls/AgentWidgetInvokerTester.d.ts +0 -6
  56. package/dist/agents/components/run-controls/AgentWidgetInvokerTester.js +0 -84
  57. package/dist/agents/components/run-controls/CreatorRunPanel.d.ts +0 -22
  58. package/dist/agents/components/run-controls/CreatorRunPanel.js +0 -108
  59. package/dist/agents/components/run-controls/CreatorRunTabContent.d.ts +0 -30
  60. package/dist/agents/components/run-controls/CreatorRunTabContent.js +0 -319
  61. package/dist/agents/components/run-controls/PayloadTab.d.ts +0 -5
  62. package/dist/agents/components/run-controls/PayloadTab.js +0 -388
  63. package/dist/agents/components/run-controls/TesterSettingsPanel.d.ts +0 -71
  64. package/dist/agents/components/run-controls/TesterSettingsPanel.js +0 -470
  65. package/dist/agents/components/shared/AgentOptionsMenu.d.ts +0 -8
  66. package/dist/agents/components/shared/AgentOptionsMenu.js +0 -776
  67. package/dist/agents/components/shared/AgentPeekDuplicateButton.d.ts +0 -8
  68. package/dist/agents/components/shared/AgentPeekDuplicateButton.js +0 -66
  69. package/dist/agents/components/shared/AgentSaveStatus.d.ts +0 -7
  70. package/dist/agents/components/shared/AgentSaveStatus.js +0 -128
  71. package/dist/agents/components/shared/AgentSaveTapButton.d.ts +0 -18
  72. package/dist/agents/components/shared/AgentSaveTapButton.js +0 -105
  73. package/dist/agents/components/shared/useAgentSaveAction.d.ts +0 -33
  74. package/dist/agents/components/shared/useAgentSaveAction.js +0 -179
  75. package/dist/agents/components/shell/AgentsListHeader.d.ts +0 -1
  76. package/dist/agents/components/shell/AgentsListHeader.js +0 -69
  77. package/dist/agents/components/undo-history/AgentEditHistory.d.ts +0 -9
  78. package/dist/agents/components/undo-history/AgentEditHistory.js +0 -244
  79. package/dist/agents/components/unused/AgentSharedHeader.d.ts +0 -3
  80. package/dist/agents/components/unused/AgentSharedHeader.js +0 -134
  81. package/dist/agents/components/widgets/AgentWidgetsPage.d.ts +0 -11
  82. package/dist/agents/components/widgets/AgentWidgetsPage.js +0 -571
  83. package/dist/agents/components/widgets/WidgetVariableInputs.d.ts +0 -8
  84. package/dist/agents/components/widgets/WidgetVariableInputs.js +0 -80
  85. package/dist/agents/components/widgets/build-widget-launch.d.ts +0 -70
  86. package/dist/agents/components/widgets/build-widget-launch.js +0 -90
  87. package/dist/agents/hooks/useAgentAutoSave.d.ts +0 -1
  88. package/dist/agents/hooks/useAgentAutoSave.js +0 -127
  89. package/dist/agents/hooks/useAgentBuilderWriteHandlers.d.ts +0 -9
  90. package/dist/agents/hooks/useAgentBuilderWriteHandlers.js +0 -102
  91. package/dist/agents/hooks/useAgentDuplicateFlow.d.ts +0 -25
  92. package/dist/agents/hooks/useAgentDuplicateFlow.js +0 -133
  93. package/dist/agents/hooks/useAgentUndoRedo.d.ts +0 -31
  94. package/dist/agents/hooks/useAgentUndoRedo.js +0 -134
  95. package/dist/agents/hooks/useAgentUsages.d.ts +0 -17
  96. package/dist/agents/hooks/useAgentUsages.js +0 -36
  97. package/dist/agents/hooks/useDriftAlerts.d.ts +0 -11
  98. package/dist/agents/hooks/useDriftAlerts.js +0 -36
  99. package/dist/agents/hooks/useDriftReport.d.ts +0 -20
  100. package/dist/agents/hooks/useDriftReport.js +0 -34
  101. package/dist/agents/lifecycle/useAgentLifecycleActions.d.ts +0 -17
  102. package/dist/agents/lifecycle/useAgentLifecycleActions.js +0 -63
  103. package/dist/agents/message-flags/useMessageFlags.d.ts +0 -8
  104. package/dist/agents/message-flags/useMessageFlags.js +0 -68
  105. package/dist/agents/services/agent-definition-snapshot.service.d.ts +0 -15
  106. package/dist/agents/services/agent-definition-snapshot.service.js +0 -20
  107. package/dist/agents/surface-catalog-profile.d.ts +0 -96
  108. package/dist/agents/surface-catalog-profile.js +0 -79
  109. package/dist/cx-chat/hooks/useAgentBootstrap.d.ts +0 -1
  110. package/dist/cx-chat/hooks/useAgentBootstrap.js +0 -110
  111. package/dist/host/builder-door.d.ts +0 -61
  112. package/dist/host/builder-door.js +0 -25
  113. package/dist/next/lazy/CreatorRunPanel.d.ts +0 -1
  114. package/dist/next/lazy/CreatorRunPanel.js +0 -11
  115. package/dist/ui/composer/composerSubmit.d.ts +0 -50
  116. 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";
@@ -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;
@@ -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>;