@ai-matrx/chat 0.7.6 → 0.7.8

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 (65) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/dist/agents/api/fetch-pending-calls.js +4 -3
  3. package/dist/agents/api/submit-tool-results.js +3 -6
  4. package/dist/agents/components/chat/begin-fresh-chat.js +2 -2
  5. package/dist/agents/components/inputs/smart-input/InputActionButtons.d.ts +2 -2
  6. package/dist/agents/components/inputs/smart-input/InputActionButtons.js +3 -1
  7. package/dist/agents/components/inputs/smart-input/SmartAgentInputStacked.js +8 -3
  8. package/dist/agents/components/inputs/smart-input/composer/ComposerSplash.js +2 -3
  9. package/dist/agents/components/inputs/smart-input/composer/useComposerMode.js +4 -2
  10. package/dist/agents/components/live-run/LiveRunDisplay.d.ts +7 -1
  11. package/dist/agents/components/live-run/LiveRunDisplay.js +3 -1
  12. package/dist/agents/components/messages-display/assistant/AssistantMessageFooter.js +4 -2
  13. package/dist/agents/components/shared/transcript-layout.d.ts +9 -8
  14. package/dist/agents/components/shared/transcript-layout.js +2 -2
  15. package/dist/agents/redux/agent-definition/agent-cache-bust-request.js +7 -7
  16. package/dist/agents/redux/execution-system/context-rules/receipt-check.js +2 -2
  17. package/dist/agents/redux/execution-system/inbox/inbox.thunks.d.ts +2 -2
  18. package/dist/agents/redux/execution-system/inbox/inbox.thunks.js +7 -15
  19. package/dist/agents/redux/execution-system/observational-memory/fetch-memory-cost.thunk.d.ts +1 -1
  20. package/dist/agents/redux/execution-system/observational-memory/fetch-memory-cost.thunk.js +7 -4
  21. package/dist/agents/redux/execution-system/selectors/aggregate.selectors.d.ts +1 -114
  22. package/dist/agents/redux/execution-system/selectors/aggregate.selectors.js +28 -43
  23. package/dist/agents/redux/execution-system/thunks/call-conversation-api.d.ts +44 -0
  24. package/dist/agents/redux/execution-system/thunks/call-conversation-api.js +78 -0
  25. package/dist/agents/redux/execution-system/thunks/continue-agent-json.d.ts +41 -0
  26. package/dist/agents/redux/execution-system/thunks/continue-agent-json.js +66 -0
  27. package/dist/agents/redux/execution-system/thunks/execute-instance.thunk.d.ts +20 -0
  28. package/dist/agents/redux/execution-system/thunks/execute-instance.thunk.js +9 -2
  29. package/dist/agents/redux/execution-system/thunks/launch-agent-execution.thunk.js +4 -6
  30. package/dist/agents/redux/execution-system/thunks/notify-and-play-dispatcher.d.ts +1 -5
  31. package/dist/agents/redux/execution-system/thunks/notify-and-play-dispatcher.js +2 -1
  32. package/dist/agents/redux/execution-system/thunks/resolve-base-url.js +7 -17
  33. package/dist/agents/redux/execution-system/thunks/settle-after-stop.thunk.js +2 -2
  34. package/dist/agents/redux/execution-system/thunks/smart-execute.thunk.js +3 -3
  35. package/dist/agents/redux/execution-system/utils/continuation-body.d.ts +8 -2
  36. package/dist/agents/redux/execution-system/utils/continuation-body.js +3 -3
  37. package/dist/agents/redux/execution-system/utils/required-organization.d.ts +18 -0
  38. package/dist/agents/redux/execution-system/utils/required-organization.js +14 -10
  39. package/dist/agents/services/mcp-connections.service.js +5 -8
  40. package/dist/agents/ui-first-tools/dispatcher/dispatch-ui-first-tool.thunk.js +2 -1
  41. package/dist/host/defaults/files-host.js +11 -1
  42. package/dist/host/defaults/server-api.d.ts +1 -15
  43. package/dist/host/defaults/server-api.js +0 -21
  44. package/dist/host/defaults/server.d.ts +2 -1
  45. package/dist/host/defaults/server.js +8 -6
  46. package/dist/host/request-headers.d.ts +26 -0
  47. package/dist/host/request-headers.js +17 -0
  48. package/dist/host/server/call-api.d.ts +0 -13
  49. package/dist/host/server/call-api.js +0 -2
  50. package/dist/host/server/matrx-transport.d.ts +0 -1
  51. package/dist/host/server/matrx-transport.js +0 -2
  52. package/dist/store/root-state.d.ts +4 -21
  53. package/dist/surfaces/hooks/useSurfaceConfig.js +2 -1
  54. package/dist/surfaces/manifests/agent-builder.manifest.d.ts +8 -0
  55. package/dist/surfaces/manifests/agent-builder.manifest.js +62 -2
  56. package/dist/surfaces/runtime/surface-feedback.js +2 -2
  57. package/dist/ui/mandates-storage/mandateStorage.d.ts +36 -0
  58. package/dist/ui/mandates-storage/shortcutStorage.d.ts +9 -0
  59. package/dist/ui/markdown-stream/EnhancedChatMarkdown.js +22 -0
  60. package/dist/ui/markdown-stream/MarkdownStreamImpl.js +3 -3
  61. package/dist/ui/markdown-stream/StreamTextFallback.d.ts +6 -0
  62. package/dist/ui/markdown-stream/StreamTextFallback.js +23 -0
  63. package/dist/ui/markdown-stream/merge-thinking-across-hidden.d.ts +19 -0
  64. package/dist/ui/markdown-stream/merge-thinking-across-hidden.js +21 -0
  65. package/package.json +16 -11
@@ -5185,6 +5185,7 @@ declare const mandateContextMenuView: (supabase: Client) => import("@supabase/su
5185
5185
  last_seen_revision: string | null;
5186
5186
  last_seen_scan_id: string | null;
5187
5187
  line: number | null;
5188
+ line_end: number | null;
5188
5189
  mandate_id: string | null;
5189
5190
  mandate_key: string;
5190
5191
  metadata: import("@ai-matrx/data/types").Json;
@@ -5227,6 +5228,7 @@ declare const mandateContextMenuView: (supabase: Client) => import("@supabase/su
5227
5228
  last_seen_revision?: string | null;
5228
5229
  last_seen_scan_id?: string | null;
5229
5230
  line?: number | null;
5231
+ line_end?: number | null;
5230
5232
  mandate_id?: string | null;
5231
5233
  mandate_key: string;
5232
5234
  metadata?: import("@ai-matrx/data/types").Json;
@@ -5269,6 +5271,7 @@ declare const mandateContextMenuView: (supabase: Client) => import("@supabase/su
5269
5271
  last_seen_revision?: string | null;
5270
5272
  last_seen_scan_id?: string | null;
5271
5273
  line?: number | null;
5274
+ line_end?: number | null;
5272
5275
  mandate_id?: string | null;
5273
5276
  mandate_key?: string;
5274
5277
  metadata?: import("@ai-matrx/data/types").Json;
@@ -6063,6 +6066,12 @@ declare const mandateContextMenuView: (supabase: Client) => import("@supabase/su
6063
6066
  };
6064
6067
  Returns: boolean;
6065
6068
  };
6069
+ code_locations: {
6070
+ Args: {
6071
+ p_keys?: string[];
6072
+ };
6073
+ Returns: import("@ai-matrx/data/types").Json;
6074
+ };
6066
6075
  definition_restore: {
6067
6076
  Args: {
6068
6077
  p_mandate_id: string;
@@ -1,5 +1,6 @@
1
1
  "use client";
2
2
  import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { mergeThinkingAcrossHidden } from "./merge-thinking-across-hidden.js";
3
4
  import { useState, useEffect, useLayoutEffect, useMemo, useCallback, useRef } from "react";
4
5
  import { cn } from "@ai-matrx/design-system";
5
6
  import { WIDE_FIGURE_HOST_CLASS, WIDE_FIGURE_PROSE_CLIP_CLASS } from "../../agents/components/shared/assistant-message-layout.js";
@@ -370,6 +371,18 @@ const EnhancedChatMarkdownInternal = ({
370
371
  );
371
372
  const isSettled = !isStreamActive;
372
373
  const workGroupedSlots = useMemo(() => {
374
+ if (!machineFramesVisible) {
375
+ return mergeThinkingAcrossHidden(groupedSlots, {
376
+ isThinking: (slot) => slot.kind === "thinking",
377
+ isHidden: (slot) => {
378
+ if (slot.kind === "tool_batch") return true;
379
+ if (slot.kind !== "tool") return false;
380
+ const status = toolLifecycleMap?.[slot.callId]?.status;
381
+ return status === "completed" || status === "error";
382
+ },
383
+ merge: (first, next) => first.kind === "thinking" && next.kind === "thinking" ? next.chunkEndIndex === void 0 ? { kind: "thinking", chunkStartIndex: first.chunkStartIndex, seq: first.seq, ...first.timelineIndex !== void 0 ? { timelineIndex: first.timelineIndex } : {} } : { ...first, chunkEndIndex: next.chunkEndIndex } : first
384
+ });
385
+ }
373
386
  if (!isSettled) return groupedSlots;
374
387
  if (messageId && !settledFromRecord) return groupedSlots;
375
388
  if (!machineFramesVisible) return groupedSlots;
@@ -412,6 +425,15 @@ const EnhancedChatMarkdownInternal = ({
412
425
  machineFramesVisible
413
426
  ]);
414
427
  const workGroupedSegments = useMemo(() => {
428
+ if (!machineFramesVisible) {
429
+ return mergeThinkingAcrossHidden(groupedSegments, {
430
+ isThinking: (seg) => seg.type === "thinking",
431
+ isHidden: (seg) => seg.type === "db_tool" || seg.type === "db_tool_batch",
432
+ merge: (first, next) => first.type === "thinking" && next.type === "thinking" ? { ...first, content: `${first.content}
433
+
434
+ ${next.content}` } : first
435
+ });
436
+ }
415
437
  if (!isSettled) return groupedSegments;
416
438
  if (!machineFramesVisible) return groupedSegments;
417
439
  const dbToolSpan = (seg) => toolSpan(seg.record?.startedAt, seg.record?.completedAt);
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { Fragment, jsx } from "react/jsx-runtime";
3
3
  import { RichContentHostGate } from "@ai-matrx/rich-content/host";
4
- import { PlainTextFallback } from "@ai-matrx/rich-content/display/chat-markdown/internal-handlers/PlainTextFallback";
4
+ import { StreamTextFallback } from "./StreamTextFallback.js";
5
5
  import { MarkdownErrorBoundary } from "@ai-matrx/rich-content/display/chat-markdown/internal-handlers/MarkdownErrorBoundary";
6
6
  import { StreamAwareChatMarkdown } from "./StreamAwareChatMarkdown.js";
7
7
  import { BlockRenderingProvider } from "@ai-matrx/rich-content/display/chat-markdown/BlockRenderingContext";
@@ -37,11 +37,11 @@ const MarkdownStreamImpl = ({
37
37
  const rendered = /* @__PURE__ */ jsx(
38
38
  RichContentHostGate,
39
39
  {
40
- fallback: /* @__PURE__ */ jsx(PlainTextFallback, { content, className }),
40
+ fallback: /* @__PURE__ */ jsx(StreamTextFallback, { content, requestId, className }),
41
41
  children: /* @__PURE__ */ jsx(BlockRenderingProvider, { strictServerData, children: /* @__PURE__ */ jsx(
42
42
  MarkdownErrorBoundary,
43
43
  {
44
- fallback: /* @__PURE__ */ jsx(PlainTextFallback, { content, className }),
44
+ fallback: /* @__PURE__ */ jsx(StreamTextFallback, { content, requestId, className }),
45
45
  onError: (error, errorInfo) => {
46
46
  console.error(
47
47
  "[MarkdownStream] Top-level error boundary caught:",
@@ -0,0 +1,6 @@
1
+ import React from "react";
2
+ export declare function StreamTextFallback({ content, requestId, className, }: {
3
+ content: string;
4
+ requestId?: string;
5
+ className?: string;
6
+ }): React.JSX.Element;
@@ -0,0 +1,23 @@
1
+ "use client";
2
+ import { jsx } from "react/jsx-runtime";
3
+ import React from "react";
4
+ import { PlainTextFallback } from "@ai-matrx/rich-content/display/chat-markdown/internal-handlers/PlainTextFallback";
5
+ import { useAppSelector } from "../../store/hooks.js";
6
+ import { selectAnswerText } from "../../agents/redux/execution-system/active-requests/active-requests.selectors.js";
7
+ const selectNoText = () => "";
8
+ function StreamTextFallback({
9
+ content,
10
+ requestId,
11
+ className
12
+ }) {
13
+ const selector = React.useMemo(() => requestId ? selectAnswerText(requestId) : selectNoText, [requestId]);
14
+ const requestText = useAppSelector(selector);
15
+ const text = content.trim() ? content : requestText;
16
+ if (!text.trim() && requestId) {
17
+ return /* @__PURE__ */ jsx(PlainTextFallback, { content: "Loading\u2026", className });
18
+ }
19
+ return /* @__PURE__ */ jsx(PlainTextFallback, { content: text, className });
20
+ }
21
+ export {
22
+ StreamTextFallback
23
+ };
@@ -0,0 +1,19 @@
1
+ /**
2
+ * ONE THINKING BLOCK WHERE THE PERSON SEES ONE (Applet audit, 2026-10-09).
3
+ *
4
+ * A research agent thinks, calls a tool, thinks, calls a tool — forty times. Where machine frames are
5
+ * hidden (an Expert, an Applet visitor) a settled tool call renders NOTHING, so those forty separate
6
+ * thinking runs stacked up as forty identical "Thought process" rows above the answer
7
+ * (state-regulatory-research, regional-itad-challenge-generator). Thinking runs separated only by items
8
+ * that render nothing are one thinking block to the person reading; they are merged into the first.
9
+ *
10
+ * Pure and generic: the live slots and the persisted segments each say what thinking is, what renders
11
+ * nothing, and how two thinking items join. Hidden items stay in place (they still render nothing).
12
+ */
13
+ export interface MergeThinkingRules<T> {
14
+ isThinking(item: T): boolean;
15
+ /** Renders nothing in this view (e.g. a settled tool call with machine frames hidden). */
16
+ isHidden(item: T): boolean;
17
+ merge(first: T, next: T): T;
18
+ }
19
+ export declare function mergeThinkingAcrossHidden<T>(items: readonly T[], rules: MergeThinkingRules<T>): T[];
@@ -0,0 +1,21 @@
1
+ function mergeThinkingAcrossHidden(items, rules) {
2
+ const out = [];
3
+ let open = -1;
4
+ for (const item of items) {
5
+ if (rules.isThinking(item)) {
6
+ if (open >= 0) {
7
+ out[open] = rules.merge(out[open], item);
8
+ continue;
9
+ }
10
+ open = out.length;
11
+ out.push(item);
12
+ continue;
13
+ }
14
+ if (!rules.isHidden(item)) open = -1;
15
+ out.push(item);
16
+ }
17
+ return out;
18
+ }
19
+ export {
20
+ mergeThinkingAcrossHidden
21
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-matrx/chat",
3
- "version": "0.7.6",
3
+ "version": "0.7.8",
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 explicit per-module subpaths @ai-matrx/chat/<domain>/<module> (no wildcards: scripts/public-modules.json) over a host contract (/host, /host/react) whose only required value is a db. One chat, one renderer: the old kernel entries (., /external-store, /matrx, /react, /tools, styles.css, tokens.css) are retired.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -2180,6 +2180,11 @@
2180
2180
  "import": "./dist/agents/redux/execution-system/thunks/launch-conversation.thunk.js",
2181
2181
  "default": "./dist/agents/redux/execution-system/thunks/launch-conversation.thunk.js"
2182
2182
  },
2183
+ "./agents/redux/execution-system/thunks/continue-agent-json": {
2184
+ "types": "./dist/agents/redux/execution-system/thunks/continue-agent-json.d.ts",
2185
+ "import": "./dist/agents/redux/execution-system/thunks/continue-agent-json.js",
2186
+ "default": "./dist/agents/redux/execution-system/thunks/continue-agent-json.js"
2187
+ },
2183
2188
  "./agents/redux/execution-system/thunks/load-agent-call-child.thunk": {
2184
2189
  "types": "./dist/agents/redux/execution-system/thunks/load-agent-call-child.thunk.d.ts",
2185
2190
  "import": "./dist/agents/redux/execution-system/thunks/load-agent-call-child.thunk.js",
@@ -4666,25 +4671,25 @@
4666
4671
  "server-only": "^0.0.1",
4667
4672
  "uuid": "^14.0.2",
4668
4673
  "zod": "^4.6.5",
4674
+ "@ai-matrx/agents": "latest",
4675
+ "@ai-matrx/alchemy": "latest",
4669
4676
  "@ai-matrx/browser-audio": "latest",
4670
4677
  "@ai-matrx/canvas": "latest",
4671
- "@ai-matrx/associations": "latest",
4672
4678
  "@ai-matrx/content-ir": "latest",
4673
- "@ai-matrx/content-ir-react": "latest",
4674
4679
  "@ai-matrx/data": "latest",
4675
4680
  "@ai-matrx/design-system": "latest",
4676
- "@ai-matrx/diff": "latest",
4677
- "@ai-matrx/icons": "latest",
4678
- "@ai-matrx/kit": "latest",
4681
+ "@ai-matrx/associations": "latest",
4679
4682
  "@ai-matrx/media": "latest",
4680
4683
  "@ai-matrx/print": "latest",
4681
- "@ai-matrx/realtime": "latest",
4682
- "@ai-matrx/agents": "latest",
4683
4684
  "@ai-matrx/records": "latest",
4685
+ "@ai-matrx/records-ui": "latest",
4684
4686
  "@ai-matrx/rich-content": "latest",
4685
4687
  "@ai-matrx/rich-editor": "latest",
4686
- "@ai-matrx/records-ui": "latest",
4687
- "@ai-matrx/alchemy": "latest"
4688
+ "@ai-matrx/content-ir-react": "latest",
4689
+ "@ai-matrx/realtime": "latest",
4690
+ "@ai-matrx/icons": "latest",
4691
+ "@ai-matrx/diff": "latest",
4692
+ "@ai-matrx/kit": "latest"
4688
4693
  },
4689
4694
  "devDependencies": {
4690
4695
  "@arethetypeswrong/cli": "^0.18.5",
@@ -4803,5 +4808,5 @@
4803
4808
  "check:side-effects": "node ../scripts/check-side-effects-listed.mjs . && node ../scripts/check-side-effects-listed.mjs --self-test",
4804
4809
  "check:public-surface": "node ./scripts/sync-public-surface.mjs --check && node ./scripts/sync-public-surface.mjs --self-test"
4805
4810
  },
4806
- "gitHead": "393a0a08beeb948741a57c8efcbe806d24e64c4a"
4811
+ "gitHead": "4c54bc1bb8dc51252d281330da514c601944e0ad"
4807
4812
  }