@ai-matrx/chat 0.4.0 → 0.4.2

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 (102) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/dist/agents/addressing/useAgentHref.js +4 -1
  3. package/dist/agents/api/submit-tool-results.js +11 -1
  4. package/dist/agents/components/chat/useCanvasScopedToConversation.js +1 -1
  5. package/dist/agents/components/messages-display/AgentConversationDisplay.js +4 -1
  6. package/dist/agents/components/run-controls/panels/shared.d.ts +1 -0
  7. package/dist/agents/components/shared/AgentConversationColumn.js +3 -2
  8. package/dist/agents/components/working-document/workingDocumentSurface.d.ts +1 -1
  9. package/dist/agents/identity/model-catalog.js +5 -3
  10. package/dist/agents/redux/agent-definition/selectors.d.ts +237 -0
  11. package/dist/agents/redux/agent-settings/selectors.d.ts +12 -0
  12. package/dist/agents/redux/agent-shortcut-categories/selectors.d.ts +50 -0
  13. package/dist/agents/redux/agent-shortcuts/selectors.d.ts +147 -0
  14. package/dist/agents/redux/conversation-history/selectors.d.ts +16 -0
  15. package/dist/agents/redux/conversation-list/conversation-list.selectors.d.ts +2 -0
  16. package/dist/agents/redux/execution-system/active-requests/active-requests.selectors.d.ts +54 -0
  17. package/dist/agents/redux/execution-system/context-state/context-state.selectors.d.ts +14 -0
  18. package/dist/agents/redux/execution-system/conversations/conversations.selectors.d.ts +5 -0
  19. package/dist/agents/redux/execution-system/host-conversations/conversation-abilities.d.ts +12 -0
  20. package/dist/agents/redux/execution-system/host-conversations/conversation-abilities.js +25 -0
  21. package/dist/agents/redux/execution-system/host-conversations/host-conversation.thunks.d.ts +50 -0
  22. package/dist/agents/redux/execution-system/host-conversations/host-conversation.thunks.js +367 -0
  23. package/dist/agents/redux/execution-system/host-conversations/host-conversations.selectors.d.ts +28 -0
  24. package/dist/agents/redux/execution-system/host-conversations/host-conversations.selectors.js +41 -0
  25. package/dist/agents/redux/execution-system/host-conversations/host-conversations.slice.d.ts +43 -0
  26. package/dist/agents/redux/execution-system/host-conversations/host-conversations.slice.js +38 -0
  27. package/dist/agents/redux/execution-system/host-conversations/source-registry.d.ts +9 -0
  28. package/dist/agents/redux/execution-system/host-conversations/source-registry.js +15 -0
  29. package/dist/agents/redux/execution-system/host-conversations/useHostConversation.d.ts +4 -0
  30. package/dist/agents/redux/execution-system/host-conversations/useHostConversation.js +24 -0
  31. package/dist/agents/redux/execution-system/instance-context/instance-context.selectors.d.ts +3 -0
  32. package/dist/agents/redux/execution-system/instance-resources/default-remark-durability.d.ts +22 -0
  33. package/dist/agents/redux/execution-system/instance-resources/default-remark-durability.js +164 -0
  34. package/dist/agents/redux/execution-system/instance-resources/instance-resources.selectors.d.ts +8 -0
  35. package/dist/agents/redux/execution-system/instance-ui-state/instance-ui-state.selectors.d.ts +5 -0
  36. package/dist/agents/redux/execution-system/instance-user-input/composer-draft-store.js +20 -0
  37. package/dist/agents/redux/execution-system/instance-user-input/useComposerDraftRestore.js +2 -1
  38. package/dist/agents/redux/execution-system/instance-variable-values/instance-variable-values.selectors.d.ts +7 -0
  39. package/dist/agents/redux/execution-system/messages/messages.selectors.d.ts +1 -0
  40. package/dist/agents/redux/execution-system/observability/observability.selectors.d.ts +7 -0
  41. package/dist/agents/redux/execution-system/observational-memory/observational-memory.selectors.d.ts +1 -0
  42. package/dist/agents/redux/execution-system/selectors/aggregate.selectors.d.ts +14 -0
  43. package/dist/agents/redux/execution-system/thunks/execute-instance.thunk.js +2 -1
  44. package/dist/agents/redux/execution-system/thunks/execute-manual-instance.thunk.js +2 -1
  45. package/dist/agents/redux/execution-system/thunks/load-conversation.thunk.js +6 -0
  46. package/dist/agents/redux/execution-system/thunks/load-older-messages.thunk.js +12 -0
  47. package/dist/agents/redux/execution-system/thunks/process-stream.js +5 -3
  48. package/dist/agents/redux/execution-system/thunks/resolve-base-url.js +1 -1
  49. package/dist/agents/redux/execution-system/thunks/smart-execute.thunk.js +43 -0
  50. package/dist/agents/redux/execution-system/utils/continuation-body.d.ts +1 -0
  51. package/dist/agents/redux/execution-system/utils/continuation-body.js +2 -1
  52. package/dist/agents/redux/proposed-directives/proposedDirectivesSlice.d.ts +1 -0
  53. package/dist/agents/redux/tools/tools.selectors.d.ts +1 -0
  54. package/dist/agents/resources/default-picker-items.d.ts +17 -0
  55. package/dist/agents/resources/default-picker-items.js +48 -0
  56. package/dist/agents/types/instance.types.d.ts +2 -1
  57. package/dist/agents/ui-first-tools/redux/agent-lists.selectors.d.ts +2 -0
  58. package/dist/cx-chat/components/SsrSidebarChats.js +1 -1
  59. package/dist/cx-chat/components/sidebar/SidebarUserFooter.js +1 -1
  60. package/dist/host/app-identity.d.ts +20 -0
  61. package/dist/host/app-identity.js +21 -0
  62. package/dist/host/bare-host-chrome.d.ts +14 -0
  63. package/dist/host/bare-host-chrome.js +44 -0
  64. package/dist/host/configure.d.ts +9 -1
  65. package/dist/host/configure.js +44 -8
  66. package/dist/host/content-ir-slots.d.ts +5 -1
  67. package/dist/host/content-ir-slots.js +5 -1
  68. package/dist/host/contract.d.ts +39 -2
  69. package/dist/host/db-types.d.ts +99 -1
  70. package/dist/host/defaults/navigation-hooks.d.ts +2 -0
  71. package/dist/host/defaults/navigation-hooks.js +7 -1
  72. package/dist/host/defaults/navigation.d.ts +4 -3
  73. package/dist/host/defaults/navigation.js +38 -7
  74. package/dist/host/defaults/org.d.ts +12 -4
  75. package/dist/host/defaults/org.js +39 -1
  76. package/dist/host/defaults/workspace-gate.d.ts +16 -0
  77. package/dist/host/defaults/workspace-gate.js +88 -0
  78. package/dist/host/diagnostics.d.ts +7 -2
  79. package/dist/host/diagnostics.js +6 -0
  80. package/dist/host/identity.js +2 -1
  81. package/dist/host/index.d.ts +5 -2
  82. package/dist/host/index.js +21 -1
  83. package/dist/host/no-database.d.ts +38 -0
  84. package/dist/host/no-database.js +107 -0
  85. package/dist/host/react.d.ts +1 -0
  86. package/dist/host/react.js +25 -2
  87. package/dist/host/registered-source.js +2 -2
  88. package/dist/host/source.d.ts +109 -0
  89. package/dist/host/source.js +86 -0
  90. package/dist/host/ui-slots.d.ts +8 -8
  91. package/dist/host/ui-slots.js +5 -3
  92. package/dist/mandates/useMandate.js +13 -0
  93. package/dist/public-chat/components/PublicMessageOptionsMenu.js +1 -1
  94. package/dist/store/create-chat-store.d.ts +4 -2
  95. package/dist/store/middlewares.d.ts +5 -0
  96. package/dist/store/slices.d.ts +1 -0
  97. package/dist/store/slices.js +4 -1
  98. package/dist/surfaces/redux/selectors.d.ts +2 -0
  99. package/dist/testing/turn-harness.d.ts +35 -0
  100. package/dist/testing/turn-harness.js +85 -0
  101. package/dist/tool-call-visualization/redux/selectors.d.ts +1 -0
  102. package/package.json +7 -4
@@ -46,6 +46,7 @@ export declare const selectUserRequestsForConversation: (conversationId: string)
46
46
  agentSettings: import("../../agent-settings/types.js").AgentSettingsState;
47
47
  conversationAttachments: import("../../../connectors/attachments.slice.js").AttachmentsSliceState;
48
48
  chatHost: import("../../../../store/chat-host.slice.js").ChatHostState;
49
+ hostConversations: import("../host-conversations/host-conversations.slice.js").HostConversationsState;
49
50
  } & import("../../../../store/root-state.js").ChatHostReadSlices) => CxUserRequestRecord[]) & {
50
51
  clearCache: () => void;
51
52
  resultsCount: () => number;
@@ -111,6 +112,7 @@ export declare const selectRequestsForUserRequest: (userRequestId: string) => ((
111
112
  agentSettings: import("../../agent-settings/types.js").AgentSettingsState;
112
113
  conversationAttachments: import("../../../connectors/attachments.slice.js").AttachmentsSliceState;
113
114
  chatHost: import("../../../../store/chat-host.slice.js").ChatHostState;
115
+ hostConversations: import("../host-conversations/host-conversations.slice.js").HostConversationsState;
114
116
  } & import("../../../../store/root-state.js").ChatHostReadSlices) => CxRequestRecord[]) & {
115
117
  clearCache: () => void;
116
118
  resultsCount: () => number;
@@ -175,6 +177,7 @@ export declare const selectToolCallsForUserRequest: (userRequestId: string) => (
175
177
  agentSettings: import("../../agent-settings/types.js").AgentSettingsState;
176
178
  conversationAttachments: import("../../../connectors/attachments.slice.js").AttachmentsSliceState;
177
179
  chatHost: import("../../../../store/chat-host.slice.js").ChatHostState;
180
+ hostConversations: import("../host-conversations/host-conversations.slice.js").HostConversationsState;
178
181
  } & import("../../../../store/root-state.js").ChatHostReadSlices) => CxToolCallRecord[]) & {
179
182
  clearCache: () => void;
180
183
  resultsCount: () => number;
@@ -251,6 +254,7 @@ export declare const selectToolCallsForMessage: (messageId: string) => ((state:
251
254
  agentSettings: import("../../agent-settings/types.js").AgentSettingsState;
252
255
  conversationAttachments: import("../../../connectors/attachments.slice.js").AttachmentsSliceState;
253
256
  chatHost: import("../../../../store/chat-host.slice.js").ChatHostState;
257
+ hostConversations: import("../host-conversations/host-conversations.slice.js").HostConversationsState;
254
258
  } & import("../../../../store/root-state.js").ChatHostReadSlices) => CxToolCallRecord[]) & {
255
259
  clearCache: () => void;
256
260
  resultsCount: () => number;
@@ -324,6 +328,7 @@ export declare const selectToolCallsForConversation: (conversationId: string) =>
324
328
  agentSettings: import("../../agent-settings/types.js").AgentSettingsState;
325
329
  conversationAttachments: import("../../../connectors/attachments.slice.js").AttachmentsSliceState;
326
330
  chatHost: import("../../../../store/chat-host.slice.js").ChatHostState;
331
+ hostConversations: import("../host-conversations/host-conversations.slice.js").HostConversationsState;
327
332
  } & import("../../../../store/root-state.js").ChatHostReadSlices) => CxToolCallRecord[]) & {
328
333
  clearCache: () => void;
329
334
  resultsCount: () => number;
@@ -397,6 +402,7 @@ export declare const selectCorrectedToolCallIds: (conversationId: string) => ((s
397
402
  agentSettings: import("../../agent-settings/types.js").AgentSettingsState;
398
403
  conversationAttachments: import("../../../connectors/attachments.slice.js").AttachmentsSliceState;
399
404
  chatHost: import("../../../../store/chat-host.slice.js").ChatHostState;
405
+ hostConversations: import("../host-conversations/host-conversations.slice.js").HostConversationsState;
400
406
  } & import("../../../../store/root-state.js").ChatHostReadSlices) => ReadonlySet<string>) & {
401
407
  clearCache: () => void;
402
408
  resultsCount: () => number;
@@ -452,6 +458,7 @@ export declare const selectCorrectedToolCallIds: (conversationId: string) => ((s
452
458
  agentSettings: import("../../agent-settings/types.js").AgentSettingsState;
453
459
  conversationAttachments: import("../../../connectors/attachments.slice.js").AttachmentsSliceState;
454
460
  chatHost: import("../../../../store/chat-host.slice.js").ChatHostState;
461
+ hostConversations: import("../host-conversations/host-conversations.slice.js").HostConversationsState;
455
462
  } & import("../../../../store/root-state.js").ChatHostReadSlices) => CxToolCallRecord[]) & {
456
463
  clearCache: () => void;
457
464
  resultsCount: () => number;
@@ -66,6 +66,7 @@ export declare const selectRecentMemoryEvents: (conversationId: string | null |
66
66
  agentSettings: import("../../agent-settings/types.js").AgentSettingsState;
67
67
  conversationAttachments: import("../../../connectors/attachments.slice.js").AttachmentsSliceState;
68
68
  chatHost: import("../../../../store/chat-host.slice.js").ChatHostState;
69
+ hostConversations: import("../host-conversations/host-conversations.slice.js").HostConversationsState;
69
70
  } & import("../../../../store/root-state.js").ChatHostReadSlices) => MemoryEventEntry[]) & {
70
71
  clearCache: () => void;
71
72
  resultsCount: () => number;
@@ -113,6 +113,7 @@ export declare const selectLatestAnswerText: (conversationId: string) => ((state
113
113
  agentSettings: import("../../agent-settings/types.js").AgentSettingsState;
114
114
  conversationAttachments: import("../../../connectors/attachments.slice.js").AttachmentsSliceState;
115
115
  chatHost: import("../../../../store/chat-host.slice.js").ChatHostState;
116
+ hostConversations: import("../host-conversations/host-conversations.slice.js").HostConversationsState;
116
117
  } & import("../../../../store/root-state.js").ChatHostReadSlices) => string) & {
117
118
  clearCache: () => void;
118
119
  resultsCount: () => number;
@@ -185,6 +186,7 @@ export declare const selectLatestAccumulatedText: (conversationId: string) => ((
185
186
  agentSettings: import("../../agent-settings/types.js").AgentSettingsState;
186
187
  conversationAttachments: import("../../../connectors/attachments.slice.js").AttachmentsSliceState;
187
188
  chatHost: import("../../../../store/chat-host.slice.js").ChatHostState;
189
+ hostConversations: import("../host-conversations/host-conversations.slice.js").HostConversationsState;
188
190
  } & import("../../../../store/root-state.js").ChatHostReadSlices) => string) & {
189
191
  clearCache: () => void;
190
192
  resultsCount: () => number;
@@ -314,6 +316,7 @@ export declare const selectPendingToolCallsForInstance: (conversationId: string)
314
316
  agentSettings: import("../../agent-settings/types.js").AgentSettingsState;
315
317
  conversationAttachments: import("../../../connectors/attachments.slice.js").AttachmentsSliceState;
316
318
  chatHost: import("../../../../store/chat-host.slice.js").ChatHostState;
319
+ hostConversations: import("../host-conversations/host-conversations.slice.js").HostConversationsState;
317
320
  } & import("../../../../store/root-state.js").ChatHostReadSlices) => PendingToolCall[] | undefined) & {
318
321
  clearCache: () => void;
319
322
  resultsCount: () => number;
@@ -408,6 +411,7 @@ export declare function makeSelectAssembledRequest(conversationId: string): ((st
408
411
  agentSettings: import("../../agent-settings/types.js").AgentSettingsState;
409
412
  conversationAttachments: import("../../../connectors/attachments.slice.js").AttachmentsSliceState;
410
413
  chatHost: import("../../../../store/chat-host.slice.js").ChatHostState;
414
+ hostConversations: import("../host-conversations/host-conversations.slice.js").HostConversationsState;
411
415
  } & import("../../../../store/root-state.js").ChatHostReadSlices) => AssembledAgentStartRequest | null) & {
412
416
  clearCache: () => void;
413
417
  resultsCount: () => number;
@@ -530,6 +534,7 @@ export declare const selectInstanceSummary: (conversationId: string) => ((state:
530
534
  agentSettings: import("../../agent-settings/types.js").AgentSettingsState;
531
535
  conversationAttachments: import("../../../connectors/attachments.slice.js").AttachmentsSliceState;
532
536
  chatHost: import("../../../../store/chat-host.slice.js").ChatHostState;
537
+ hostConversations: import("../host-conversations/host-conversations.slice.js").HostConversationsState;
533
538
  } & import("../../../../store/root-state.js").ChatHostReadSlices) => {
534
539
  conversationId: string;
535
540
  agentId: string;
@@ -694,6 +699,7 @@ export declare const makeSelectInstanceDisplaySnapshot: () => ((state: {
694
699
  agentSettings: import("../../agent-settings/types.js").AgentSettingsState;
695
700
  conversationAttachments: import("../../../connectors/attachments.slice.js").AttachmentsSliceState;
696
701
  chatHost: import("../../../../store/chat-host.slice.js").ChatHostState;
702
+ hostConversations: import("../host-conversations/host-conversations.slice.js").HostConversationsState;
697
703
  } & import("../../../../store/root-state.js").ChatHostReadSlices, conversationId: string) => {
698
704
  readonly displayMode: import("../../agent-shortcuts/types.js").ResultDisplayMode;
699
705
  readonly isExpanded: boolean;
@@ -791,6 +797,7 @@ export declare const selectActiveInstancesByDisplayMode: ((state: {
791
797
  agentSettings: import("../../agent-settings/types.js").AgentSettingsState;
792
798
  conversationAttachments: import("../../../connectors/attachments.slice.js").AttachmentsSliceState;
793
799
  chatHost: import("../../../../store/chat-host.slice.js").ChatHostState;
800
+ hostConversations: import("../host-conversations/host-conversations.slice.js").HostConversationsState;
794
801
  } & import("../../../../store/root-state.js").ChatHostReadSlices) => Record<string, string[]> | undefined) & {
795
802
  clearCache: () => void;
796
803
  resultsCount: () => number;
@@ -859,6 +866,7 @@ export declare const selectOverlayInstancesByDisplayMode: ((state: {
859
866
  agentSettings: import("../../agent-settings/types.js").AgentSettingsState;
860
867
  conversationAttachments: import("../../../connectors/attachments.slice.js").AttachmentsSliceState;
861
868
  chatHost: import("../../../../store/chat-host.slice.js").ChatHostState;
869
+ hostConversations: import("../host-conversations/host-conversations.slice.js").HostConversationsState;
862
870
  } & import("../../../../store/root-state.js").ChatHostReadSlices) => Record<string, string[]> | undefined) & {
863
871
  clearCache: () => void;
864
872
  resultsCount: () => number;
@@ -926,6 +934,7 @@ export declare const selectActiveModalInstanceIds: ((state: {
926
934
  agentSettings: import("../../agent-settings/types.js").AgentSettingsState;
927
935
  conversationAttachments: import("../../../connectors/attachments.slice.js").AttachmentsSliceState;
928
936
  chatHost: import("../../../../store/chat-host.slice.js").ChatHostState;
937
+ hostConversations: import("../host-conversations/host-conversations.slice.js").HostConversationsState;
929
938
  } & import("../../../../store/root-state.js").ChatHostReadSlices) => string[] | undefined) & {
930
939
  clearCache: () => void;
931
940
  resultsCount: () => number;
@@ -993,6 +1002,7 @@ export declare const selectActivePanelInstanceIds: ((state: {
993
1002
  agentSettings: import("../../agent-settings/types.js").AgentSettingsState;
994
1003
  conversationAttachments: import("../../../connectors/attachments.slice.js").AttachmentsSliceState;
995
1004
  chatHost: import("../../../../store/chat-host.slice.js").ChatHostState;
1005
+ hostConversations: import("../host-conversations/host-conversations.slice.js").HostConversationsState;
996
1006
  } & import("../../../../store/root-state.js").ChatHostReadSlices) => string[] | undefined) & {
997
1007
  clearCache: () => void;
998
1008
  resultsCount: () => number;
@@ -1071,6 +1081,7 @@ export declare const selectLatestRenderBlocks: (conversationId: string) => ((sta
1071
1081
  agentSettings: import("../../agent-settings/types.js").AgentSettingsState;
1072
1082
  conversationAttachments: import("../../../connectors/attachments.slice.js").AttachmentsSliceState;
1073
1083
  chatHost: import("../../../../store/chat-host.slice.js").ChatHostState;
1084
+ hostConversations: import("../host-conversations/host-conversations.slice.js").HostConversationsState;
1074
1085
  } & import("../../../../store/root-state.js").ChatHostReadSlices) => RenderBlockPayload[] | undefined) & {
1075
1086
  clearCache: () => void;
1076
1087
  resultsCount: () => number;
@@ -1143,6 +1154,7 @@ export declare const selectLatestActiveTools: (conversationId: string) => ((stat
1143
1154
  agentSettings: import("../../agent-settings/types.js").AgentSettingsState;
1144
1155
  conversationAttachments: import("../../../connectors/attachments.slice.js").AttachmentsSliceState;
1145
1156
  chatHost: import("../../../../store/chat-host.slice.js").ChatHostState;
1157
+ hostConversations: import("../host-conversations/host-conversations.slice.js").HostConversationsState;
1146
1158
  } & import("../../../../store/root-state.js").ChatHostReadSlices) => ToolLifecycleEntry[] | undefined) & {
1147
1159
  clearCache: () => void;
1148
1160
  resultsCount: () => number;
@@ -1211,6 +1223,7 @@ export declare const selectLatestToolLifecycles: (conversationId: string) => ((s
1211
1223
  agentSettings: import("../../agent-settings/types.js").AgentSettingsState;
1212
1224
  conversationAttachments: import("../../../connectors/attachments.slice.js").AttachmentsSliceState;
1213
1225
  chatHost: import("../../../../store/chat-host.slice.js").ChatHostState;
1226
+ hostConversations: import("../host-conversations/host-conversations.slice.js").HostConversationsState;
1214
1227
  } & import("../../../../store/root-state.js").ChatHostReadSlices) => ToolLifecycleEntry[] | undefined) & {
1215
1228
  clearCache: () => void;
1216
1229
  resultsCount: () => number;
@@ -1324,6 +1337,7 @@ export declare const makeSelectAvailableShortcuts: (context: ShortcutContext) =>
1324
1337
  agentSettings: import("../../agent-settings/types.js").AgentSettingsState;
1325
1338
  conversationAttachments: import("../../../connectors/attachments.slice.js").AttachmentsSliceState;
1326
1339
  chatHost: import("../../../../store/chat-host.slice.js").ChatHostState;
1340
+ hostConversations: import("../host-conversations/host-conversations.slice.js").HostConversationsState;
1327
1341
  } & import("../../../../store/root-state.js").ChatHostReadSlices) => import("../../agent-shortcuts/types.js").AgentShortcutRecord[]) & {
1328
1342
  clearCache: () => void;
1329
1343
  resultsCount: () => number;
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  executionRejectionMeta
3
3
  } from "./execution-rejection-meta.js";
4
+ import { attributionForSend } from "../../../../host/app-identity.js";
4
5
  import { mintClientTempId } from "@ai-matrx/kit/ids";
5
6
  import { createAsyncThunk } from "@reduxjs/toolkit";
6
7
  import { toast } from "../../../../host/notify.js";
@@ -188,7 +189,7 @@ function assembleRequest(state, conversationId, opts) {
188
189
  (id) => !!id
189
190
  );
190
191
  const active_scope_type_ids = selectActiveScopeTypeIds(state) ?? [];
191
- const { sourceApp, sourceFeature } = instance;
192
+ const { sourceApp, sourceFeature } = attributionForSend(instance);
192
193
  const block_mode = selectIsBlockMode(state);
193
194
  const snapshot = selectIsSnapshot(state);
194
195
  const memoryToggle = selectMemoryToggleRequest(conversationId)(state);
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  executionRejectionMeta
3
3
  } from "./execution-rejection-meta.js";
4
+ import { attributionForSend } from "../../../../host/app-identity.js";
4
5
  import { selectAgentById } from "../../agent-definition/selectors.js";
5
6
  import { mintClientTempId } from "@ai-matrx/kit/ids";
6
7
  import { createAsyncThunk } from "@reduxjs/toolkit";
@@ -263,7 +264,7 @@ async function assembleManualRequest(state, conversationId, opts) {
263
264
  mcp: mcpServers
264
265
  };
265
266
  }
266
- const { sourceApp, sourceFeature } = instance;
267
+ const { sourceApp, sourceFeature } = attributionForSend(instance);
267
268
  const isEphemeral = instance.isEphemeral === true;
268
269
  const organization_id = requireExecutionOrganizationId(state, conversationId);
269
270
  const request = {
@@ -1,3 +1,5 @@
1
+ import { selectHostConversation } from "../host-conversations/host-conversations.selectors.js";
2
+ import { loadHostHistory } from "../host-conversations/host-conversation.thunks.js";
1
3
  import { selectAgentById } from "../../agent-definition/selectors.js";
2
4
  import { createAsyncThunk } from "@reduxjs/toolkit";
3
5
  import { supabase } from "../../../../host/db.js";
@@ -84,6 +86,10 @@ const loadConversation = createAsyncThunk(
84
86
  displayOverrides,
85
87
  agentBehindApp = false
86
88
  }, { dispatch, getState }) => {
89
+ if (selectHostConversation(conversationId)(getState())) {
90
+ await loadHostHistory(dispatch, getState, conversationId);
91
+ return { conversationId };
92
+ }
87
93
  let authedUserId = null;
88
94
  try {
89
95
  const { data: authData } = await getClaimsUser(supabase);
@@ -1,3 +1,5 @@
1
+ import { selectHostConversation } from "../host-conversations/host-conversations.selectors.js";
2
+ import { loadHostHistory } from "../host-conversations/host-conversation.thunks.js";
1
3
  import { createAsyncThunk } from "@reduxjs/toolkit";
2
4
  import { prependMessages, setOlderLoading } from "../messages/messages.slice.js";
3
5
  import { mergeToolCalls } from "../observability/observability.slice.js";
@@ -10,6 +12,16 @@ import {
10
12
  const loadOlderMessages = createAsyncThunk(
11
13
  "conversations/loadOlder",
12
14
  async ({ conversationId, pageSize = 50 }, { dispatch, getState, rejectWithValue }) => {
15
+ if (selectHostConversation(conversationId)(getState())) {
16
+ const before = getState().messages.byConversationId[conversationId]?.orderedIds.length ?? 0;
17
+ await loadHostHistory(dispatch, getState, conversationId, { older: true });
18
+ const after = getState().messages.byConversationId[conversationId];
19
+ return {
20
+ conversationId,
21
+ prependedCount: Math.max(0, (after?.orderedIds.length ?? 0) - before),
22
+ hasMoreOlder: after?.hasMoreOlder ?? false
23
+ };
24
+ }
13
25
  const entry = getState().messages.byConversationId[conversationId];
14
26
  if (!entry) {
15
27
  return rejectWithValue({ reason: "no-entry" });
@@ -1,3 +1,4 @@
1
+ import { selectHostConversation } from "../host-conversations/host-conversations.selectors.js";
1
2
  import {
2
3
  applyServerUsageState,
3
4
  applyUsageRefusal,
@@ -2340,8 +2341,9 @@ async function processStream({
2340
2341
  }
2341
2342
  } else if (assistantBlocks.length > 0) {
2342
2343
  const conv = finalState.conversations.byConversationId[conversationId];
2343
- (conv?.isEphemeral === true ? console.info : console.error)(
2344
- `[stream:${requestId.slice(0, 8)}] no assistant reservation arrived but ${assistantBlocks.length} content block(s) were produced \u2014 committing to a client-temp message to avoid transcript loss. DIAGNOSIS isEphemeral=${conv?.isEphemeral ?? false} apiEndpointMode=${conv?.apiEndpointMode ?? "agent"} userRequestReserved=${reservedUserRequestId !== null} toolReservations=${toolCallIdByProviderCallId.size} streamError=${!!finalErrorMessage}. ` + (conv?.isEphemeral === true ? `Expected for an ephemeral (incognito) turn: the server reserves no message rows for store:false.` : `isEphemeral=false: the server should have reserved a cx_message(role=assistant) \u2014 a backend reservation gap (userRequestReserved alone proves nothing; the preamble announces it even for store:false).`)
2344
+ const clientMintsIds = conv?.isEphemeral === true || selectHostConversation(conversationId)(finalState) !== null;
2345
+ (clientMintsIds ? console.info : console.error)(
2346
+ `[stream:${requestId.slice(0, 8)}] no assistant reservation arrived but ${assistantBlocks.length} content block(s) were produced \u2014 committing to a client-temp message to avoid transcript loss. DIAGNOSIS isEphemeral=${conv?.isEphemeral ?? false} apiEndpointMode=${conv?.apiEndpointMode ?? "agent"} userRequestReserved=${reservedUserRequestId !== null} toolReservations=${toolCallIdByProviderCallId.size} streamError=${!!finalErrorMessage}. ` + (clientMintsIds ? `Expected: the client mints this conversation's message ids (incognito, or a host-owned source), so no reservation arrives.` : `isEphemeral=false: the server should have reserved a cx_message(role=assistant) \u2014 a backend reservation gap (userRequestReserved alone proves nothing; the preamble announces it even for store:false).`)
2345
2347
  );
2346
2348
  const tempId = mintClientTempId("assistant", requestId);
2347
2349
  const existingById = finalState.messages.byConversationId[conversationId]?.byId ?? {};
@@ -2464,7 +2466,7 @@ async function processStream({
2464
2466
  if (!textProtected && !hasUnsentResources) {
2465
2467
  dispatch(resetUserVariableValues(conversationId));
2466
2468
  }
2467
- if (finalErrorMessage === null && materializeTargets.length > 0) {
2469
+ if (finalErrorMessage === null && materializeTargets.length > 0 && selectHostConversation(conversationId)(getState()) === null) {
2468
2470
  void Promise.all(
2469
2471
  materializeTargets.map(
2470
2472
  (target) => materializeMessageArtifacts({
@@ -14,7 +14,7 @@ import {
14
14
  supportsLocalAgentExecution
15
15
  } from "../../../../host/server/local-engine.js";
16
16
  import { selectOrganizationId } from "../../../../host/org.js";
17
- const EC2_SANDBOX_SERVER_URL = process.env.NEXT_PUBLIC_EC2_SANDBOX_SERVER_URL || "";
17
+ const EC2_SANDBOX_SERVER_URL = typeof process !== "undefined" && process.env.NEXT_PUBLIC_EC2_SANDBOX_SERVER_URL || "";
18
18
  function dedicatedEc2ServerForConversation(state, conversationId) {
19
19
  if (selectActiveServer(state) !== "production") return null;
20
20
  const ref = resolveAgentSandboxRef(state, conversationId);
@@ -38,6 +38,9 @@ import {
38
38
  } from "./settle-after-stop.thunk.js";
39
39
  import { cancelAgentRunRequest } from "../../../../host/server/matrx-transport.js";
40
40
  import { toast } from "../../../../host/notify.js";
41
+ import { selectHostConversation } from "../host-conversations/host-conversations.selectors.js";
42
+ import { sendToHost, stopHostTurn } from "../host-conversations/host-conversation.thunks.js";
43
+ import { isHostSendRefused } from "../../../../host/source.js";
41
44
  import { refreshSurfaceScope } from "./refresh-surface-scope.thunk.js";
42
45
  import {
43
46
  ensureExecutionOrganization,
@@ -173,6 +176,36 @@ const smartExecute = createAsyncThunk(
173
176
  }
174
177
  }
175
178
  let submission = handed ?? captureSubmission(entryState, conversationId);
179
+ const hosted = selectHostConversation(conversationId)(entryState);
180
+ if (hosted) {
181
+ if (isEmptySubmission(submission)) return;
182
+ if (!hosted.canSend) {
183
+ toast.info("This chat is read-only here");
184
+ return;
185
+ }
186
+ if (hosted.held) {
187
+ toast.info("Not sent yet", { description: hosted.held });
188
+ return;
189
+ }
190
+ const busy = selectIsExecuting(conversationId)(entryState);
191
+ if (busy && hosted.whileBusy === "refuse") {
192
+ toast.info("Wait for the answer to finish", {
193
+ description: "This chat takes the next message once the current one ends."
194
+ });
195
+ return;
196
+ }
197
+ const mode = busy ? hosted.whileBusy === "steer" ? "steer" : "queue" : "send";
198
+ if (!handed) detachFromComposer(dispatch, getState, conversationId, submission);
199
+ try {
200
+ await sendToHost(dispatch, getState, conversationId, submission.text, mode);
201
+ } catch (error) {
202
+ returnToComposer(dispatch, getState, conversationId, submission);
203
+ toast.error("Message not sent", {
204
+ description: isHostSendRefused(error) ? error.message : error instanceof Error ? error.message : String(error)
205
+ });
206
+ }
207
+ return;
208
+ }
176
209
  if (isSendInFlight(conversationId)) {
177
210
  if (!handed) {
178
211
  if (isEmptySubmission(submission)) return;
@@ -418,6 +451,11 @@ const cancelExecution = createAsyncThunk(
418
451
  "instances/cancelExecution",
419
452
  async (conversationId, { getState, dispatch }) => {
420
453
  const state = getState();
454
+ if (selectHostConversation(conversationId)(state)) {
455
+ await stopHostTurn(conversationId);
456
+ dispatch(resetSubmissionPhase(conversationId));
457
+ return;
458
+ }
421
459
  const serverRequestId = latestServerRequestId(state, conversationId);
422
460
  abortConversation(conversationId);
423
461
  if (serverRequestId) {
@@ -465,6 +503,11 @@ const interruptAndSend = createAsyncThunk(
465
503
  "instances/interruptAndSend",
466
504
  async ({ conversationId, surfaceKey }, { getState, dispatch }) => {
467
505
  const initial = getState();
506
+ if (selectHostConversation(conversationId)(initial)) {
507
+ await stopHostTurn(conversationId);
508
+ await dispatch(smartExecute({ conversationId, surfaceKey }));
509
+ return;
510
+ }
468
511
  if (!selectIsExecuting(conversationId)(initial)) {
469
512
  await dispatch(smartExecute({ conversationId, surfaceKey }));
470
513
  return;
@@ -56,6 +56,7 @@ export declare const CONTINUATION_FIELD_ROUTING: {
56
56
  readonly max_iterations: "not assembled by this thunk";
57
57
  readonly max_retries_per_iteration: "not assembled by this thunk";
58
58
  readonly responder_agent_id: "coding-mirror replies only; not assembled by this thunk";
59
+ readonly host_turn: "host-owned turns only; not assembled by this thunk";
59
60
  };
60
61
  export interface ContinuationBodyOptions {
61
62
  retry: boolean;
@@ -49,7 +49,8 @@ const CONTINUATION_FIELD_ROUTING = {
49
49
  allow_context_create: "not assembled by this thunk",
50
50
  max_iterations: "not assembled by this thunk",
51
51
  max_retries_per_iteration: "not assembled by this thunk",
52
- responder_agent_id: "coding-mirror replies only; not assembled by this thunk"
52
+ responder_agent_id: "coding-mirror replies only; not assembled by this thunk",
53
+ host_turn: "host-owned turns only; not assembled by this thunk"
53
54
  };
54
55
  const EMPTY_IS_MEANINGFUL = /* @__PURE__ */ new Set(["tools", "output_kinds"]);
55
56
  const FALSE_IS_MEANINGFUL = /* @__PURE__ */ new Set(["memory", "tools_replace", "context_withheld"]);
@@ -110,6 +110,7 @@ export declare const selectProposedDirectives: (conversationId: string) => ((sta
110
110
  agentSettings: import("../agent-settings/types.js").AgentSettingsState;
111
111
  conversationAttachments: import("../../connectors/attachments.slice.js").AttachmentsSliceState;
112
112
  chatHost: import("../../../store/chat-host.slice.js").ChatHostState;
113
+ hostConversations: import("../execution-system/host-conversations/host-conversations.slice.js").HostConversationsState;
113
114
  } & import("../../../store/root-state.js").ChatHostReadSlices) => ProposedDirective[]) & {
114
115
  clearCache: () => void;
115
116
  resultsCount: () => number;
@@ -124,6 +124,7 @@ export declare const makeSelectToolById: () => ((state: {
124
124
  agentSettings: import("../agent-settings/types.js").AgentSettingsState;
125
125
  conversationAttachments: import("../../connectors/attachments.slice.js").AttachmentsSliceState;
126
126
  chatHost: import("../../../store/chat-host.slice.js").ChatHostState;
127
+ hostConversations: import("../execution-system/host-conversations/host-conversations.slice.js").HostConversationsState;
127
128
  } & import("../../../store/root-state.js").ChatHostReadSlices, toolId: string) => {
128
129
  admin_only: boolean;
129
130
  annotations: import("../../../host/db-types.js").Json | null;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * The resource picker's item list as a bare host sees it: every view id with its label and icon.
3
+ * matrx-frontend registers its own list (brand icons, tints, capability gates) through the
4
+ * `flattenResourcePickerItems` slot; a host that registers none gets these, so the composer's
5
+ * Tools / Connections / Skills doors and the workspace rows have a label instead of throwing.
6
+ */
7
+ import { type LucideIcon } from "lucide-react";
8
+ import type { ResourcePickerViewId } from "./picker-view-id.js";
9
+ export interface DefaultResourcePickerItem {
10
+ id: Exclude<ResourcePickerViewId, null>;
11
+ label: string;
12
+ icon: LucideIcon;
13
+ iconClassName: string;
14
+ requiresCapability: null | "supportsImageUrls" | "supportsFileUrls" | "supportsYoutubeVideos" | "supportsAudio";
15
+ }
16
+ export declare const DEFAULT_RESOURCE_PICKER_ITEMS: readonly DefaultResourcePickerItem[];
17
+ export declare function defaultResourcePickerItems(): DefaultResourcePickerItem[];
@@ -0,0 +1,48 @@
1
+ import {
2
+ AppWindow,
3
+ CheckSquare,
4
+ CirclePlay,
5
+ File,
6
+ FileText,
7
+ FolderOpen,
8
+ Globe,
9
+ Image,
10
+ Layers,
11
+ Lightbulb,
12
+ MessagesSquare,
13
+ Mic,
14
+ Notebook,
15
+ Plug,
16
+ Search,
17
+ StickyNote,
18
+ Table2,
19
+ Wrench
20
+ } from "lucide-react";
21
+ const item = (id, label, icon, requiresCapability = null) => ({ id, label, icon, iconClassName: "", requiresCapability });
22
+ const DEFAULT_RESOURCE_PICKER_ITEMS = [
23
+ item("files", "Files", FolderOpen),
24
+ item("audio", "Voice Pad", Mic),
25
+ item("webpage", "Web page", Globe),
26
+ item("google", "Google", Search),
27
+ item("cloud_browser", "Cloud browser", AppWindow),
28
+ item("tools", "Tools", Wrench),
29
+ item("connections", "Connections", Plug),
30
+ item("skills", "Skills", Lightbulb),
31
+ item("conversations", "Chats", MessagesSquare),
32
+ item("tables", "Tables", Table2),
33
+ item("notes", "Notes", StickyNote),
34
+ item("tasks", "Tasks", CheckSquare),
35
+ item("workbooks", "Workbooks", Notebook),
36
+ item("documents", "Documents", FileText),
37
+ item("context_values", "Context values", Layers),
38
+ item("image_url", "Image link", Image, "supportsImageUrls"),
39
+ item("file_url", "File link", File, "supportsFileUrls"),
40
+ item("youtube", "YouTube", CirclePlay, "supportsYoutubeVideos")
41
+ ];
42
+ function defaultResourcePickerItems() {
43
+ return [...DEFAULT_RESOURCE_PICKER_ITEMS];
44
+ }
45
+ export {
46
+ DEFAULT_RESOURCE_PICKER_ITEMS,
47
+ defaultResourcePickerItems
48
+ };
@@ -58,7 +58,8 @@ export type UnregisteredSourceApp = string & {
58
58
  export type SourceAppValue = SourceApp | UnregisteredSourceApp;
59
59
  /** Preserve DB fidelity while preventing new producer call sites from inventing strings. */
60
60
  export declare function sourceAppFromStorage(value: string): SourceAppValue;
61
- export type ApiEndpointMode = "agent" | "manual";
61
+ /** "host": a host-owned message source carries the turn (`host/source`), never a server door. */
62
+ export type ApiEndpointMode = "agent" | "manual" | "host";
62
63
  /**
63
64
  * Client attestation of HOW an AI request was triggered — the only provenance
64
65
  * input the client may send. The server DERIVES `origin_class` from witnessed
@@ -55,6 +55,7 @@ export declare const selectAgentTaskCounts: (conversationId: string) => ((state:
55
55
  agentSettings: import("../../redux/agent-settings/types.js").AgentSettingsState;
56
56
  conversationAttachments: import("../../connectors/attachments.slice.js").AttachmentsSliceState;
57
57
  chatHost: import("../../../store/chat-host.slice.js").ChatHostState;
58
+ hostConversations: import("../../redux/execution-system/host-conversations/host-conversations.slice.js").HostConversationsState;
58
59
  } & import("../../../store/root-state.js").ChatHostReadSlices) => {
59
60
  total: number;
60
61
  done: number;
@@ -139,6 +140,7 @@ export declare const selectUserTodoCounts: (conversationId: string) => ((state:
139
140
  agentSettings: import("../../redux/agent-settings/types.js").AgentSettingsState;
140
141
  conversationAttachments: import("../../connectors/attachments.slice.js").AttachmentsSliceState;
141
142
  chatHost: import("../../../store/chat-host.slice.js").ChatHostState;
143
+ hostConversations: import("../../redux/execution-system/host-conversations/host-conversations.slice.js").HostConversationsState;
142
144
  } & import("../../../store/root-state.js").ChatHostReadSlices) => {
143
145
  total: number;
144
146
  done: number;
@@ -9,7 +9,7 @@ import {
9
9
  Share2,
10
10
  Users
11
11
  } from "lucide-react";
12
- import { useSelector } from "react-redux";
12
+ import { useAppSelector as useSelector } from "../../store/hooks.js";
13
13
  import { selectUserId } from "../../host/identity.js";
14
14
  import {
15
15
  DropdownMenu,
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { jsx, jsxs } from "react/jsx-runtime";
3
3
  import { Link } from "../../../host/navigation.js";
4
- import { useSelector } from "react-redux";
4
+ import { useAppSelector as useSelector } from "../../../store/hooks.js";
5
5
  import {
6
6
  selectUserId,
7
7
  selectDisplayName,
@@ -0,0 +1,20 @@
1
+ /**
2
+ * host/app-identity — what the app calls itself on the conversations it starts.
3
+ *
4
+ * Every send stamps `source_app` (and `source_feature`) on the request; the host's `app` option
5
+ * decides them (contract: `ChatHost.app`). A host that named no app is the neutral `chat`
6
+ * producer — said once — never the main frontend's label. Non-React code reads the configured
7
+ * host at call time; with no host configured the instance's own stamp stands.
8
+ */
9
+ import type { ChatAppIdentity } from "./contract.js";
10
+ export interface WireAttribution {
11
+ sourceApp: string | undefined;
12
+ sourceFeature: string | undefined;
13
+ }
14
+ /** The identity this app stamps (the host's `app`, else the neutral default). */
15
+ export declare function currentChatApp(): ChatAppIdentity | null;
16
+ /** The `source_app` / `source_feature` a send carries: the host's identity over the instance's own. */
17
+ export declare function attributionForSend(instance: {
18
+ sourceApp?: string | undefined;
19
+ sourceFeature?: string | undefined;
20
+ }): WireAttribution;
@@ -0,0 +1,21 @@
1
+ import { DEFAULT_CHAT_APP, getChatHost, isChatHostConfigured } from "./configure.js";
2
+ import { announceOnce } from "./errors.js";
3
+ function currentChatApp() {
4
+ return isChatHostConfigured() ? getChatHost().app : null;
5
+ }
6
+ function attributionForSend(instance) {
7
+ const app = currentChatApp();
8
+ if (!app) return { sourceApp: instance.sourceApp, sourceFeature: instance.sourceFeature };
9
+ if (app === DEFAULT_CHAT_APP) {
10
+ announceOnce(
11
+ "chat-host-app-unnamed",
12
+ `The host named no \`app\`, so its conversations are labelled "${app.sourceApp}". Pass app: { sourceApp, sourceFeature? } to ChatProvider's host to name it.`,
13
+ "info"
14
+ );
15
+ }
16
+ return { sourceApp: app.sourceApp, sourceFeature: app.sourceFeature ?? instance.sourceFeature };
17
+ }
18
+ export {
19
+ attributionForSend,
20
+ currentChatApp
21
+ };
@@ -0,0 +1,14 @@
1
+ /**
2
+ * What a bare host (a private chat store: extension, desktop, a fresh Vite app) gets mounted
3
+ * for it, because the chat UI cannot render without them and the host has nothing to say about
4
+ * them beyond the db it already gave: one tooltip provider, one associations store over
5
+ * `host.db`, the model catalog + favorites, and the agent catalog the host resolves (`host.catalog()`, built over `db`). A host that passes its own `store` (matrx-frontend) already mounts both above the
6
+ * chat with its own ports, so they are never shadowed there.
7
+ * Proof: canary/ (P29a) renders the transcript and composer with only `{ db }`.
8
+ */
9
+ import { type ReactNode } from "react";
10
+ import type { ResolvedChatHost } from "./contract.js";
11
+ export declare function BareHostChrome({ host, children }: {
12
+ host: ResolvedChatHost;
13
+ children?: ReactNode;
14
+ }): import("react").JSX.Element;
@@ -0,0 +1,44 @@
1
+ "use client";
2
+ import { jsx } from "react/jsx-runtime";
3
+ import { useState } from "react";
4
+ import { TooltipProvider } from "@ai-matrx/design-system";
5
+ import { createAssociationsStore } from "@ai-matrx/associations/core";
6
+ import { AssociationsProvider } from "@ai-matrx/associations/react";
7
+ import { AgentCatalogProvider } from "@ai-matrx/agents/catalog/react";
8
+ import { createModelCatalog, createModelFavorites } from "@ai-matrx/agents/models";
9
+ import { ModelCatalogProvider } from "@ai-matrx/agents/models/react";
10
+ import { hasChatScopes, registerChatScopes } from "../context/sources/scopes.js";
11
+ const SAVE_REASON = "save this";
12
+ function BareHostChrome({ host, children }) {
13
+ const [associations] = useState(
14
+ () => createAssociationsStore({
15
+ dataSource: host.db,
16
+ identity: {
17
+ requireUserId: () => {
18
+ const userId = host.identity.current().userId;
19
+ if (!userId) throw new Error("@ai-matrx/chat: no one is signed in, so this cannot be saved.");
20
+ return userId;
21
+ },
22
+ // A variable, not a literal: finish-build reads `require("…")` as an import.
23
+ ensureOrgId: () => host.org.require(SAVE_REASON)
24
+ }
25
+ })
26
+ );
27
+ useState(() => {
28
+ if (!hasChatScopes("associationsService")) {
29
+ registerChatScopes({
30
+ associationsService: associations.services.associations,
31
+ getAssociationsStore: (() => associations)
32
+ });
33
+ }
34
+ });
35
+ const [catalog] = useState(() => host.catalog());
36
+ const [models] = useState(() => ({
37
+ catalog: createModelCatalog({ client: host.db }),
38
+ favorites: createModelFavorites({ client: host.db })
39
+ }));
40
+ return /* @__PURE__ */ jsx(TooltipProvider, { delayDuration: 200, children: /* @__PURE__ */ jsx(AgentCatalogProvider, { catalog, children: /* @__PURE__ */ jsx(AssociationsProvider, { store: associations, children: /* @__PURE__ */ jsx(ModelCatalogProvider, { catalog: models.catalog, favorites: models.favorites, children }) }) }) });
41
+ }
42
+ export {
43
+ BareHostChrome
44
+ };