@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
@@ -48,11 +48,6 @@ interface InputSlotProps {
48
48
  interface TextInputDialogProps extends OpenChangeProps {
49
49
  onConfirm?: (value: string) => void | Promise<void>;
50
50
  }
51
- interface ModelListDropdownProps {
52
- onValueChange?: (modelId: string) => void;
53
- onOfferingPinChange?: (offeringId: string | undefined) => void;
54
- [extra: string]: any;
55
- }
56
51
  interface ItemMenuProps {
57
52
  onCloseAutoFocus?: (event: Event) => void;
58
53
  [extra: string]: any;
@@ -311,7 +306,6 @@ export interface ChatUiSlots {
311
306
  OrganizationContextNotice: AnyComponent;
312
307
  JsonInspector: AnyComponent;
313
308
  ConfirmDialog: SlotComponent<OpenChangeProps>;
314
- ModelListDropdown: SlotComponent<ModelListDropdownProps>;
315
309
  TextWithDoors: AnyComponent;
316
310
  EntityDoorControls: AnyComponent;
317
311
  StructuredValueView: AnyComponent;
@@ -530,7 +524,7 @@ export declare const ResourcePickerMenu: SlotComponent<ResourcePickerMenuProps>;
530
524
  export declare const FilesResourcePicker: SlotComponent<FilesPickerProps>;
531
525
  export declare const NotePickerPopover: SlotComponent<NotePickerProps>;
532
526
  export declare const SmartInputMessageTemplatePicker: SlotComponent<TemplatePickerProps>;
533
- /** A host with no resource picker offers no items. */
527
+ /** A host with no resource picker gets the package's own item list (labels + icons for every view). */
534
528
  export declare const flattenResourcePickerItems: () => Array<{
535
529
  id: string;
536
530
  label: string;
@@ -574,11 +568,17 @@ export declare const ReadFailure: AnyComponent;
574
568
  export declare const ItemRow: ComponentType<ItemRowProps>;
575
569
  export declare const UntrustedCount: AnyComponent;
576
570
  export declare const StaleDataNotice: AnyComponent;
571
+ /** A bare host gets the package's own organization picker (`defaults/workspace-gate`). */
577
572
  export declare const WorkspaceGate: AnyComponent;
578
573
  export declare const OrganizationContextNotice: AnyComponent;
579
574
  export declare const JsonInspector: AnyComponent;
580
575
  export declare const ConfirmDialog: SlotComponent<OpenChangeProps>;
581
- export declare const ModelListDropdown: SlotComponent<ModelListDropdownProps>;
576
+ /**
577
+ * THE model picker is the agents package's own (`@ai-matrx/agents/models/react`), not a slot: a
578
+ * bare host gets the real list (`BareHostChrome` mounts the catalog over `host.db`), a host with
579
+ * its own catalog mounts `ModelCatalogProvider` above the chat (matrx-frontend: ModelCatalogHost).
580
+ */
581
+ export { ModelListDropdown } from "@ai-matrx/agents/models/react";
582
582
  export declare const TextWithDoors: AnyComponent;
583
583
  export declare const EntityDoorControls: AnyComponent;
584
584
  export declare const StructuredValueView: AnyComponent;
@@ -1,9 +1,11 @@
1
1
  "use client";
2
+ import { defaultResourcePickerItems } from "../agents/resources/default-picker-items.js";
2
3
  import { isRfc9562Uuid } from "@ai-matrx/kit/uuid";
3
4
  import { createElement, Fragment, useRef } from "react";
4
5
  import { formatCost, usdToPoints } from "@ai-matrx/kit/format";
5
6
  import { reportUnregisteredHostSlot as reportUnregistered } from "./diagnostics.js";
6
7
  import { DefaultWebpageSnapshotView } from "./defaults/webpage-snapshot-view.js";
8
+ import { DefaultWorkspaceGate } from "./defaults/workspace-gate.js";
7
9
  import { DefaultFullScreenOverlay, DefaultWindowPanel } from "./defaults/window-panel.js";
8
10
  import { copyText } from "@ai-matrx/kit/clipboard";
9
11
  const slots = {};
@@ -264,7 +266,7 @@ const SmartInputMessageTemplatePicker = slotComponent(
264
266
  "SmartInputMessageTemplatePicker",
265
267
  unregisteredWidget("SmartInputMessageTemplatePicker")
266
268
  );
267
- const flattenResourcePickerItems = slotFn("flattenResourcePickerItems", () => []);
269
+ const flattenResourcePickerItems = slotFn("flattenResourcePickerItems", defaultResourcePickerItems);
268
270
  const useRunControlCounts = slotFn("useRunControlCounts", () => ({}));
269
271
  const useAttachResourcePicker = slotFn("useAttachResourcePicker", () => (_options) => void 0);
270
272
  const usePopoutContainer = slotFn("usePopoutContainer", () => void 0);
@@ -308,11 +310,11 @@ const ReadFailure = slotComponent("ReadFailure", unregisteredWidget("ReadFailure
308
310
  const ItemRow = slotComponent("ItemRow", unregisteredWidget("ItemRow"));
309
311
  const UntrustedCount = slotComponent("UntrustedCount", unregisteredWidget("UntrustedCount"));
310
312
  const StaleDataNotice = slotComponent("StaleDataNotice", unregisteredWidget("StaleDataNotice"));
311
- const WorkspaceGate = slotComponent("WorkspaceGate", unregisteredWidget("WorkspaceGate"));
313
+ const WorkspaceGate = slotComponent("WorkspaceGate", DefaultWorkspaceGate);
312
314
  const OrganizationContextNotice = slotComponent("OrganizationContextNotice", unregisteredWidget("OrganizationContextNotice"));
313
315
  const JsonInspector = slotComponent("JsonInspector", unregisteredWidget("JsonInspector"));
314
316
  const ConfirmDialog = slotComponent("ConfirmDialog", unregisteredWidget("ConfirmDialog"));
315
- const ModelListDropdown = slotComponent("ModelListDropdown", unregisteredWidget("ModelListDropdown"));
317
+ import { ModelListDropdown } from "@ai-matrx/agents/models/react";
316
318
  const TextWithDoors = slotComponent("TextWithDoors", unregisteredWidget("TextWithDoors"));
317
319
  const EntityDoorControls = slotComponent("EntityDoorControls", unregisteredWidget("EntityDoorControls"));
318
320
  const StructuredValueView = slotComponent("StructuredValueView", unregisteredWidget("StructuredValueView"));
@@ -8,6 +8,7 @@ import {
8
8
  import { extractErrorMessage } from "@ai-matrx/data/net";
9
9
  import { useAppSelector } from "../store/hooks.js";
10
10
  import { selectOrganizationId } from "../host/org.js";
11
+ import { chatHostHasDatabase } from "../host/configure.js";
11
12
  function useMandate(mandateKey, options = {}) {
12
13
  const hasMandateKey = mandateKey.trim().length > 0;
13
14
  const resolvableKey = hasMandateKey ? mandateKey : null;
@@ -45,6 +46,18 @@ function useMandate(mandateKey, options = {}) {
45
46
  const epoch = state.epoch;
46
47
  useEffect(() => {
47
48
  if (resolvableKey === null) return;
49
+ if (!chatHostHasDatabase()) {
50
+ setState((prev) => ({
51
+ ...prev,
52
+ key: question,
53
+ mandate: null,
54
+ loading: false,
55
+ error: null,
56
+ absent: true,
57
+ organizationPending: false
58
+ }));
59
+ return;
60
+ }
48
61
  let cancelled = false;
49
62
  const org = options.organizationId ?? null;
50
63
  const resolution = options.optional ? resolveMandate(resolvableKey, {
@@ -22,7 +22,7 @@ import { EmailInputDialog } from "../../host/ui-slots.js";
22
22
  import { AuthGateDialog } from "../../host/ui-slots.js";
23
23
  import { notesCreate } from "../../host/ui-slots.js";
24
24
  import { toast } from "../../host/notify.js";
25
- import { useSelector } from "react-redux";
25
+ import { useAppSelector as useSelector } from "../../store/hooks.js";
26
26
  import { selectIsAuthenticated } from "../../host/identity.js";
27
27
  import { useAppDispatch } from "../../store/hooks.js";
28
28
  import { openOverlay, CHAT_WINDOWS } from "../../host/windows.js";
@@ -9,6 +9,7 @@ export interface CreateChatStoreOptions {
9
9
  files?: Omit<FilesHost, "store">;
10
10
  }
11
11
  export declare function createChatStore(preloadedState?: Partial<ChatState>, options?: CreateChatStoreOptions): import("@reduxjs/toolkit").EnhancedStore<{
12
+ cloudFiles: import("@ai-matrx/media/files/engine").CloudFilesState;
12
13
  voiceAgent: import("../voice-agent/types.js").VoiceAgentState;
13
14
  agentDefinition: import("../agents/types/agent-definition.types.js").AgentDefinitionSliceState;
14
15
  conversationList: import("../agents/redux/conversation-list/conversation-list.types.js").ConversationListState;
@@ -51,9 +52,10 @@ export declare function createChatStore(preloadedState?: Partial<ChatState>, opt
51
52
  agentSettings: import("../agents/redux/agent-settings/types.js").AgentSettingsState;
52
53
  conversationAttachments: import("../agents/connectors/attachments.slice.js").AttachmentsSliceState;
53
54
  chatHost: import("./chat-host.slice.js").ChatHostState;
54
- cloudFiles: import("@ai-matrx/media/files/engine").CloudFilesState;
55
+ hostConversations: import("../agents/redux/execution-system/host-conversations/host-conversations.slice.js").HostConversationsState;
55
56
  }, import("redux").UnknownAction, import("@reduxjs/toolkit").Tuple<[import("redux").StoreEnhancer<{
56
57
  dispatch: import("redux-thunk").ThunkDispatch<{
58
+ cloudFiles: import("@ai-matrx/media/files/engine").CloudFilesState;
57
59
  voiceAgent: import("../voice-agent/types.js").VoiceAgentState;
58
60
  agentDefinition: import("../agents/types/agent-definition.types.js").AgentDefinitionSliceState;
59
61
  conversationList: import("../agents/redux/conversation-list/conversation-list.types.js").ConversationListState;
@@ -96,7 +98,7 @@ export declare function createChatStore(preloadedState?: Partial<ChatState>, opt
96
98
  agentSettings: import("../agents/redux/agent-settings/types.js").AgentSettingsState;
97
99
  conversationAttachments: import("../agents/connectors/attachments.slice.js").AttachmentsSliceState;
98
100
  chatHost: import("./chat-host.slice.js").ChatHostState;
99
- cloudFiles: import("@ai-matrx/media/files/engine").CloudFilesState;
101
+ hostConversations: import("../agents/redux/execution-system/host-conversations/host-conversations.slice.js").HostConversationsState;
100
102
  }, undefined, import("redux").UnknownAction>;
101
103
  }>, import("redux").StoreEnhancer]>>;
102
104
  export type ChatStore = ReturnType<typeof createChatStore>;
@@ -42,6 +42,7 @@ export declare function chatMiddlewares(): readonly [Middleware<{}, any, import(
42
42
  agentSettings: import("../agents/redux/agent-settings/types.js").AgentSettingsState;
43
43
  conversationAttachments: import("../agents/connectors/attachments.slice.js").AttachmentsSliceState;
44
44
  chatHost: import("./chat-host.slice.js").ChatHostState;
45
+ hostConversations: import("../agents/redux/execution-system/host-conversations/host-conversations.slice.js").HostConversationsState;
45
46
  } & import("./root-state.js").ChatHostReadSlices, import("redux").Dispatch<import("redux").UnknownAction>>, Middleware<Record<string, never>, {
46
47
  voiceAgent: import("../voice-agent/types.js").VoiceAgentState;
47
48
  agentDefinition: import("../agents/types/agent-definition.types.js").AgentDefinitionSliceState;
@@ -85,6 +86,7 @@ export declare function chatMiddlewares(): readonly [Middleware<{}, any, import(
85
86
  agentSettings: import("../agents/redux/agent-settings/types.js").AgentSettingsState;
86
87
  conversationAttachments: import("../agents/connectors/attachments.slice.js").AttachmentsSliceState;
87
88
  chatHost: import("./chat-host.slice.js").ChatHostState;
89
+ hostConversations: import("../agents/redux/execution-system/host-conversations/host-conversations.slice.js").HostConversationsState;
88
90
  } & import("./root-state.js").ChatHostReadSlices, import("redux").Dispatch<import("redux").UnknownAction>>, Middleware<object, {
89
91
  voiceAgent: import("../voice-agent/types.js").VoiceAgentState;
90
92
  agentDefinition: import("../agents/types/agent-definition.types.js").AgentDefinitionSliceState;
@@ -128,6 +130,7 @@ export declare function chatMiddlewares(): readonly [Middleware<{}, any, import(
128
130
  agentSettings: import("../agents/redux/agent-settings/types.js").AgentSettingsState;
129
131
  conversationAttachments: import("../agents/connectors/attachments.slice.js").AttachmentsSliceState;
130
132
  chatHost: import("./chat-host.slice.js").ChatHostState;
133
+ hostConversations: import("../agents/redux/execution-system/host-conversations/host-conversations.slice.js").HostConversationsState;
131
134
  } & import("./root-state.js").ChatHostReadSlices, import("redux").Dispatch<import("redux").UnknownAction>>, Middleware<object, {
132
135
  voiceAgent: import("../voice-agent/types.js").VoiceAgentState;
133
136
  agentDefinition: import("../agents/types/agent-definition.types.js").AgentDefinitionSliceState;
@@ -171,6 +174,7 @@ export declare function chatMiddlewares(): readonly [Middleware<{}, any, import(
171
174
  agentSettings: import("../agents/redux/agent-settings/types.js").AgentSettingsState;
172
175
  conversationAttachments: import("../agents/connectors/attachments.slice.js").AttachmentsSliceState;
173
176
  chatHost: import("./chat-host.slice.js").ChatHostState;
177
+ hostConversations: import("../agents/redux/execution-system/host-conversations/host-conversations.slice.js").HostConversationsState;
174
178
  } & import("./root-state.js").ChatHostReadSlices, import("redux").Dispatch<import("redux").UnknownAction>>, Middleware<object, {
175
179
  voiceAgent: import("../voice-agent/types.js").VoiceAgentState;
176
180
  agentDefinition: import("../agents/types/agent-definition.types.js").AgentDefinitionSliceState;
@@ -214,4 +218,5 @@ export declare function chatMiddlewares(): readonly [Middleware<{}, any, import(
214
218
  agentSettings: import("../agents/redux/agent-settings/types.js").AgentSettingsState;
215
219
  conversationAttachments: import("../agents/connectors/attachments.slice.js").AttachmentsSliceState;
216
220
  chatHost: import("./chat-host.slice.js").ChatHostState;
221
+ hostConversations: import("../agents/redux/execution-system/host-conversations/host-conversations.slice.js").HostConversationsState;
217
222
  } & import("./root-state.js").ChatHostReadSlices, import("redux").Dispatch<import("redux").UnknownAction>>];
@@ -41,6 +41,7 @@ export declare const chatReducers: {
41
41
  agentSettings: import("redux").Reducer<import("../agents/redux/agent-settings/types.js").AgentSettingsState>;
42
42
  conversationAttachments: import("redux").Reducer<import("../agents/connectors/attachments.slice.js").AttachmentsSliceState>;
43
43
  chatHost: import("redux").Reducer<import("./chat-host.slice.js").ChatHostState>;
44
+ hostConversations: import("redux").Reducer<import("../agents/redux/execution-system/host-conversations/host-conversations.slice.js").HostConversationsState>;
44
45
  };
45
46
  export type ChatReducers = typeof chatReducers;
46
47
  export type ChatSliceKey = keyof ChatReducers;
@@ -40,6 +40,7 @@ import proposedDirectivesReducer from "../agents/redux/proposed-directives/propo
40
40
  import agentSettingsReducer from "../agents/redux/agent-settings/agentSettingsSlice.js";
41
41
  import conversationAttachmentsReducer from "../agents/connectors/attachments.slice.js";
42
42
  import { chatHostReducer } from "./chat-host.slice.js";
43
+ import { hostConversationsReducer } from "../agents/redux/execution-system/host-conversations/host-conversations.slice.js";
43
44
  const chatReducers = {
44
45
  voiceAgent: voiceAgentReducer,
45
46
  agentDefinition: agentDefinitionReducer,
@@ -89,7 +90,9 @@ const chatReducers = {
89
90
  conversationAttachments: conversationAttachmentsReducer,
90
91
  // The AI model catalogue every picker and label reads; package-owned since P17b.
91
92
  // Host state the package reads (identity, active org, server, prefs), synced by <ChatProvider> (P3).
92
- chatHost: chatHostReducer
93
+ chatHost: chatHostReducer,
94
+ // Conversations a host-owned message source carries (host/source, HOST-OWNED-SOURCE-PLAN P28a).
95
+ hostConversations: hostConversationsReducer
93
96
  };
94
97
  export {
95
98
  chatReducers
@@ -48,6 +48,7 @@ export declare const selectActiveSurfaces: ((state: {
48
48
  agentSettings: import("../../agents/redux/agent-settings/types.js").AgentSettingsState;
49
49
  conversationAttachments: import("../../agents/connectors/attachments.slice.js").AttachmentsSliceState;
50
50
  chatHost: import("../../store/chat-host.slice.js").ChatHostState;
51
+ hostConversations: import("../../agents/redux/execution-system/host-conversations/host-conversations.slice.js").HostConversationsState;
51
52
  } & import("../../store/root-state.js").ChatHostReadSlices) => import("../services/surfaces.service.js").SurfaceWithStats[]) & {
52
53
  clearCache: () => void;
53
54
  resultsCount: () => number;
@@ -120,6 +121,7 @@ export declare const makeSelectBindingsForAgent: (agentId: string) => ((state: {
120
121
  agentSettings: import("../../agents/redux/agent-settings/types.js").AgentSettingsState;
121
122
  conversationAttachments: import("../../agents/connectors/attachments.slice.js").AttachmentsSliceState;
122
123
  chatHost: import("../../store/chat-host.slice.js").ChatHostState;
124
+ hostConversations: import("../../agents/redux/execution-system/host-conversations/host-conversations.slice.js").HostConversationsState;
123
125
  } & import("../../store/root-state.js").ChatHostReadSlices) => AgentSurfaceBinding[]) & {
124
126
  clearCache: () => void;
125
127
  resultsCount: () => number;
@@ -0,0 +1,35 @@
1
+ /**
2
+ * The turn harness (HOST-OWNED-SOURCE-PLAN §3, shared with P24g): a recorded corpus turn as the
3
+ * real server bytes, a recording diagnostics port, and an in-memory prefs port — so a suite runs a
4
+ * real turn through `processStream` on the package's private store without a network.
5
+ *
6
+ * Every stream in it is the LIVE-captured NDJSON in `fixtures/corpus/` (a synthetic stream is a
7
+ * defect — vitest.config.ts).
8
+ */
9
+ import type { ChatDiagnosticContext, ChatDiagnosticsPort, ChatPrefsPort } from "../host/contract.js";
10
+ /** The recorded corpus file's raw NDJSON text. */
11
+ export declare function corpusText(name: string): string;
12
+ /**
13
+ * The corpus file as a streamed `Response`, one line per chunk — the way it came off the wire.
14
+ * `hold` stops before the last `n` lines until `release()` (a turn still running).
15
+ */
16
+ export declare function corpusResponse(name: string, options?: {
17
+ hold?: number;
18
+ }): {
19
+ response: Response;
20
+ release: () => void;
21
+ };
22
+ export interface RecordingDiagnostics extends ChatDiagnosticsPort {
23
+ entries: Array<{
24
+ error: unknown;
25
+ ctx: ChatDiagnosticContext;
26
+ stack: string;
27
+ }>;
28
+ /** Every feature the no-database stand-in refused. */
29
+ noDatabase(): string[];
30
+ }
31
+ export declare function createRecordingDiagnostics(): RecordingDiagnostics;
32
+ /** A host prefs port over a Map (what a host bridge — a file, IPC — would back). */
33
+ export declare function createMemoryPrefs(store?: Map<string, string>): ChatPrefsPort & {
34
+ store: Map<string, string>;
35
+ };
@@ -0,0 +1,85 @@
1
+ import { readFileSync } from "node:fs";
2
+ import { join } from "node:path";
3
+ import { NO_DATABASE_CODE_PREFIX } from "../host/no-database.js";
4
+ const CORPUS = join(__dirname, "..", "..", "fixtures", "corpus");
5
+ function corpusText(name) {
6
+ return readFileSync(join(CORPUS, `${name}.ndjson`), "utf8");
7
+ }
8
+ function corpusResponse(name, options = {}) {
9
+ const lines = corpusText(name).split("\n").filter((l) => l.trim().length > 0);
10
+ const encoder = new TextEncoder();
11
+ let release = () => {
12
+ };
13
+ const gate = new Promise((resolve) => {
14
+ release = resolve;
15
+ });
16
+ const holdAt = options.hold ? lines.length - options.hold : lines.length;
17
+ let i = 0;
18
+ const body = new ReadableStream({
19
+ async pull(controller) {
20
+ if (i === holdAt && options.hold) await gate;
21
+ if (i >= lines.length) {
22
+ controller.close();
23
+ return;
24
+ }
25
+ controller.enqueue(encoder.encode(`${lines[i]}
26
+ `));
27
+ i += 1;
28
+ }
29
+ });
30
+ return {
31
+ response: new Response(body, { status: 200, headers: { "content-type": "application/x-ndjson" } }),
32
+ release: () => release()
33
+ };
34
+ }
35
+ function createRecordingDiagnostics() {
36
+ const entries = [];
37
+ return {
38
+ entries,
39
+ capture(error, ctx) {
40
+ entries.push({ error, ctx, stack: new Error().stack ?? "" });
41
+ },
42
+ noDatabase() {
43
+ return entries.filter((e) => e.ctx.code.startsWith(NO_DATABASE_CODE_PREFIX)).map((e) => e.ctx.code.slice(NO_DATABASE_CODE_PREFIX.length));
44
+ }
45
+ };
46
+ }
47
+ function createMemoryPrefs(store = /* @__PURE__ */ new Map()) {
48
+ const listeners = /* @__PURE__ */ new Set();
49
+ const emit = (key) => {
50
+ for (const l of listeners) l(key);
51
+ };
52
+ return {
53
+ store,
54
+ get: (key) => store.get(key) ?? null,
55
+ set: (key, value) => {
56
+ store.set(key, value);
57
+ emit(key);
58
+ },
59
+ remove: (key) => {
60
+ store.delete(key);
61
+ emit(key);
62
+ },
63
+ subscribe: (listener) => {
64
+ listeners.add(listener);
65
+ return () => listeners.delete(listener);
66
+ },
67
+ knob: (key, fallback) => {
68
+ const raw = store.get(key);
69
+ if (raw == null) return fallback;
70
+ if (typeof fallback === "number") {
71
+ const n = Number(raw);
72
+ return Number.isFinite(n) ? n : fallback;
73
+ }
74
+ if (typeof fallback === "boolean") return raw === "true";
75
+ return raw;
76
+ },
77
+ snapshot: () => Object.fromEntries(store)
78
+ };
79
+ }
80
+ export {
81
+ corpusResponse,
82
+ corpusText,
83
+ createMemoryPrefs,
84
+ createRecordingDiagnostics
85
+ };
@@ -65,6 +65,7 @@ export declare const selectOrderedToolLifecycles: (requestId: string) => ((state
65
65
  agentSettings: import("../../agents/redux/agent-settings/types.js").AgentSettingsState;
66
66
  conversationAttachments: import("../../agents/connectors/attachments.slice.js").AttachmentsSliceState;
67
67
  chatHost: import("../../store/chat-host.slice.js").ChatHostState;
68
+ hostConversations: import("../../agents/redux/execution-system/host-conversations/host-conversations.slice.js").HostConversationsState;
68
69
  } & import("../../store/root-state.js").ChatHostReadSlices) => ToolLifecycleEntry[]) & {
69
70
  clearCache: () => void;
70
71
  resultsCount: () => number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-matrx/chat",
3
- "version": "0.4.0",
3
+ "version": "0.4.2",
4
4
  "description": "THE one AI Matrx person-to-agent chat system: the full chat (running agents, conversations, tool calls, streaming, context, surfaces, voice) as per-module subpaths @ai-matrx/chat/<domain>/<module> over a host contract (/host, /host/react) whose only required value is a db; plus the kernel compatibility entries (., /external-store, /matrx, /react, /tools, styles.css, tokens.css) until P28.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -229,11 +229,11 @@
229
229
  "@ai-matrx/agents": "latest",
230
230
  "@ai-matrx/alchemy": "latest",
231
231
  "@ai-matrx/associations": "latest",
232
+ "@ai-matrx/browser-audio": "latest",
232
233
  "@ai-matrx/canvas": "latest",
233
234
  "@ai-matrx/content-ir": "latest",
234
- "@ai-matrx/browser-audio": "latest",
235
- "@ai-matrx/content-ir-react": "latest",
236
235
  "@ai-matrx/data": "latest",
236
+ "@ai-matrx/content-ir-react": "latest",
237
237
  "@ai-matrx/design-system": "latest",
238
238
  "@ai-matrx/diff": "latest",
239
239
  "@ai-matrx/icons": "latest",
@@ -243,6 +243,7 @@
243
243
  "@ai-matrx/realtime": "latest",
244
244
  "@ai-matrx/records": "latest",
245
245
  "@ai-matrx/records-ui": "latest",
246
+ "@ai-matrx/rich-content": "latest",
246
247
  "@ai-matrx/tap-target": "latest"
247
248
  },
248
249
  "devDependencies": {
@@ -304,8 +305,9 @@
304
305
  "scripts": {
305
306
  "build": "pnpm clean && tsup && node ./scripts/copy-css.mjs && node ./scripts/tsc-own.mjs -p tsconfig.build.json && node ./scripts/finish-build.mjs",
306
307
  "clean": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\"",
307
- "check:package": "pnpm build && node ../scripts/check-exports-agreement.mjs && pnpm check:canonical-pickers && publint && pnpm verify:tarball && pnpm verify:modules-tarball && pnpm check:front-door:self-test && pnpm check:host-boundary && pnpm check:no-builder-tier && pnpm check:one-holder",
308
+ "check:package": "pnpm build && node ../scripts/check-exports-agreement.mjs && pnpm check:canonical-pickers && publint && pnpm verify:tarball && pnpm verify:modules-tarball && pnpm check:front-door:self-test && pnpm check:front-door:canary && pnpm check:host-boundary && pnpm check:no-builder-tier && pnpm check:one-holder && pnpm check:host-doors",
308
309
  "check:host-boundary": "node ./scripts/check-host-boundary.mjs && node ./scripts/check-host-boundary.mjs --self-test",
310
+ "check:host-doors": "node ./scripts/check-host-source-doors.mjs && node ./scripts/check-host-source-doors.mjs --self-test",
309
311
  "check:one-holder": "node ./scripts/check-chat-one-holder.mjs && node ./scripts/check-chat-one-holder.mjs --self-test",
310
312
  "check:no-builder-tier": "node ./scripts/check-chat-has-no-builder-tier.mjs && node ./scripts/check-chat-has-no-builder-tier.mjs --self-test",
311
313
  "typecheck": "node ./node_modules/typescript/bin/tsc -p tsconfig.json --noEmit && node ./scripts/tsc-own.mjs -p tsconfig.modules.json",
@@ -320,6 +322,7 @@
320
322
  "verify:modules-tarball": "node ./scripts/verify-modules-tarball.mjs",
321
323
  "check:front-door": "node ./scripts/check-front-door.mjs",
322
324
  "check:front-door:self-test": "node ./scripts/check-front-door.mjs --self-test",
325
+ "check:front-door:canary": "node ./scripts/check-front-door.mjs --root ./canary/src",
323
326
  "deps:write": "node ./scripts/finish-build.mjs --write-deps"
324
327
  }
325
328
  }