@ai-matrx/agents 0.29.1 → 0.31.0

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 (40) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/content-transfer/index.cjs.map +1 -1
  3. package/dist/content-transfer/index.js.map +1 -1
  4. package/dist/content-transfer/react/index.cjs.map +1 -1
  5. package/dist/content-transfer/react/index.js.map +1 -1
  6. package/dist/context/index.cjs +4 -0
  7. package/dist/context/index.cjs.map +1 -1
  8. package/dist/context/index.d.cts +23 -4
  9. package/dist/context/index.d.ts +23 -4
  10. package/dist/context/index.js +4 -0
  11. package/dist/context/index.js.map +1 -1
  12. package/dist/context/react/index.cjs +32 -7
  13. package/dist/context/react/index.cjs.map +1 -1
  14. package/dist/context/react/index.d.cts +20 -5
  15. package/dist/context/react/index.d.ts +20 -5
  16. package/dist/context/react/index.js +33 -8
  17. package/dist/context/react/index.js.map +1 -1
  18. package/dist/mandates/index.cjs +2 -2
  19. package/dist/mandates/index.cjs.map +1 -1
  20. package/dist/mandates/index.d.cts +4 -4
  21. package/dist/mandates/index.d.ts +4 -4
  22. package/dist/mandates/index.js +2 -2
  23. package/dist/mandates/index.js.map +1 -1
  24. package/dist/portable/index.cjs +8 -0
  25. package/dist/portable/index.cjs.map +1 -1
  26. package/dist/portable/index.d.cts +12 -3
  27. package/dist/portable/index.d.ts +12 -3
  28. package/dist/portable/index.js +8 -0
  29. package/dist/portable/index.js.map +1 -1
  30. package/dist/portable/mcp.cjs +3 -3
  31. package/dist/portable/mcp.cjs.map +1 -1
  32. package/dist/portable/mcp.d.cts +3 -3
  33. package/dist/portable/mcp.d.ts +3 -3
  34. package/dist/portable/mcp.js +3 -3
  35. package/dist/portable/mcp.js.map +1 -1
  36. package/dist/{types.generated-BydVlqDC.d.cts → types.generated-BDphyhqo.d.cts} +16 -1
  37. package/dist/{types.generated-BydVlqDC.d.ts → types.generated-BDphyhqo.d.ts} +16 -1
  38. package/mandates/snapshots/keys.0.30.0.json +653 -0
  39. package/mandates/snapshots/keys.0.31.0.json +653 -0
  40. package/package.json +2 -2
@@ -61,8 +61,13 @@ interface ContextDeliveredRef {
61
61
  /** SHA-256 hex of that text (UTF-8). */
62
62
  sha256: string;
63
63
  }
64
- /** What to view: a value's `delivered` element, its `on_request` text, or a `block`. */
65
- type ContextViewKind = "delivered" | "on_request" | "block";
64
+ /**
65
+ * What to view: a value's `delivered` element, its `on_request` text, a
66
+ * `block`, or what the agent can `fetchable` for a value through a tool (the
67
+ * Organization: its selected scopes' values via `scope_system` — rendered when
68
+ * opened, never on the receipt; `source: "fetched_now"`).
69
+ */
70
+ type ContextViewKind = "delivered" | "on_request" | "block" | "fetchable";
66
71
  interface ContextViewTarget {
67
72
  kind: ContextViewKind;
68
73
  /** The value's key, or the block's id. */
@@ -78,7 +83,14 @@ interface ContextViewedText {
78
83
  text: string;
79
84
  chars: number;
80
85
  sha256: string;
81
- source: "preview" | "wire" | "conversation_prompt" | "turn_record";
86
+ /** `fetched_now`: a `fetchable` text — what the agent gets if it asks now. */
87
+ source: "preview" | "wire" | "conversation_prompt" | "turn_record" | "fetched_now";
88
+ /**
89
+ * `fetchable` only: `false` when the turn's agent cannot call the tool that
90
+ * returns it (tools off, excluded, a structured-output turn). `text` is then
91
+ * `""`; the screen says so with state, never shows content as fetchable.
92
+ */
93
+ available?: boolean;
82
94
  }
83
95
  /** The host's door to the viewer API — called only when a person opens a value. */
84
96
  type ContextViewLoader = (target: ContextViewTarget) => Promise<ContextViewedText>;
@@ -269,7 +281,9 @@ declare function InlineMaxInput({ value, inherited, cap, onCommit, disabled, lab
269
281
  * What the model READ for one value — fetched from the viewer when the detail
270
282
  * opens, never pushed (RULES.md §5b): its own element (`delivered`), the blocks
271
283
  * it rode with (`deliveredBlocks` — the Organization's catalog), and for an
272
- * on-request value what the `context` tool returns (`onRequest`). Verbatim;
284
+ * on-request value what the `context` tool returns (`onRequest`), and for a
285
+ * value the agent reads through a tool (`CONTEXT_FETCHABLE_ROWS`) what that tool
286
+ * returns now (`fetchable`, sized once loaded). Verbatim;
273
287
  * never the client's copy. With no receipt yet: a server-authoritative value
274
288
  * says the server fills it; anything else renders nothing (the host may show
275
289
  * the value the page will send, labelled so).
@@ -284,7 +298,8 @@ declare function ContextDeliveredValue({ row, load, className, }: {
284
298
  declare function DeliveredSection({ title, target, ref_, load, }: {
285
299
  title: string;
286
300
  target: ContextViewTarget;
287
- ref_: ContextDeliveredRef;
301
+ /** The receipt's size; absent for a `fetchable` text, sized once it loads. */
302
+ ref_?: ContextDeliveredRef | undefined;
288
303
  load?: ContextViewLoader | undefined;
289
304
  }): react.JSX.Element;
290
305
 
@@ -61,8 +61,13 @@ interface ContextDeliveredRef {
61
61
  /** SHA-256 hex of that text (UTF-8). */
62
62
  sha256: string;
63
63
  }
64
- /** What to view: a value's `delivered` element, its `on_request` text, or a `block`. */
65
- type ContextViewKind = "delivered" | "on_request" | "block";
64
+ /**
65
+ * What to view: a value's `delivered` element, its `on_request` text, a
66
+ * `block`, or what the agent can `fetchable` for a value through a tool (the
67
+ * Organization: its selected scopes' values via `scope_system` — rendered when
68
+ * opened, never on the receipt; `source: "fetched_now"`).
69
+ */
70
+ type ContextViewKind = "delivered" | "on_request" | "block" | "fetchable";
66
71
  interface ContextViewTarget {
67
72
  kind: ContextViewKind;
68
73
  /** The value's key, or the block's id. */
@@ -78,7 +83,14 @@ interface ContextViewedText {
78
83
  text: string;
79
84
  chars: number;
80
85
  sha256: string;
81
- source: "preview" | "wire" | "conversation_prompt" | "turn_record";
86
+ /** `fetched_now`: a `fetchable` text — what the agent gets if it asks now. */
87
+ source: "preview" | "wire" | "conversation_prompt" | "turn_record" | "fetched_now";
88
+ /**
89
+ * `fetchable` only: `false` when the turn's agent cannot call the tool that
90
+ * returns it (tools off, excluded, a structured-output turn). `text` is then
91
+ * `""`; the screen says so with state, never shows content as fetchable.
92
+ */
93
+ available?: boolean;
82
94
  }
83
95
  /** The host's door to the viewer API — called only when a person opens a value. */
84
96
  type ContextViewLoader = (target: ContextViewTarget) => Promise<ContextViewedText>;
@@ -269,7 +281,9 @@ declare function InlineMaxInput({ value, inherited, cap, onCommit, disabled, lab
269
281
  * What the model READ for one value — fetched from the viewer when the detail
270
282
  * opens, never pushed (RULES.md §5b): its own element (`delivered`), the blocks
271
283
  * it rode with (`deliveredBlocks` — the Organization's catalog), and for an
272
- * on-request value what the `context` tool returns (`onRequest`). Verbatim;
284
+ * on-request value what the `context` tool returns (`onRequest`), and for a
285
+ * value the agent reads through a tool (`CONTEXT_FETCHABLE_ROWS`) what that tool
286
+ * returns now (`fetchable`, sized once loaded). Verbatim;
273
287
  * never the client's copy. With no receipt yet: a server-authoritative value
274
288
  * says the server fills it; anything else renders nothing (the host may show
275
289
  * the value the page will send, labelled so).
@@ -284,7 +298,8 @@ declare function ContextDeliveredValue({ row, load, className, }: {
284
298
  declare function DeliveredSection({ title, target, ref_, load, }: {
285
299
  title: string;
286
300
  target: ContextViewTarget;
287
- ref_: ContextDeliveredRef;
301
+ /** The receipt's size; absent for a `fetchable` text, sized once it loads. */
302
+ ref_?: ContextDeliveredRef | undefined;
288
303
  load?: ContextViewLoader | undefined;
289
304
  }): react.JSX.Element;
290
305
 
@@ -16,6 +16,9 @@ var DEFAULT_INLINE_CAP = 5e4;
16
16
  var CONTEXT_ROW_BLOCKS = {
17
17
  organization: ["organization_catalog"]
18
18
  };
19
+ var CONTEXT_FETCHABLE_ROWS = {
20
+ organization: "scope_system"
21
+ };
19
22
  function unclaimedBlocks(blocks, rowKeys) {
20
23
  const claimed = /* @__PURE__ */ new Set();
21
24
  for (const key of rowKeys) for (const id of CONTEXT_ROW_BLOCKS[key] ?? []) claimed.add(id);
@@ -404,7 +407,7 @@ function ContextRulesTable({
404
407
  const comfortable = density === "comfortable";
405
408
  const present = GROUPS.filter((g) => rows.some((r) => r.origin === g.origin));
406
409
  const grouped = present.length > 1;
407
- return /* @__PURE__ */ jsx3(TooltipProvider, { delayDuration: 300, titleTooltips: false, children: /* @__PURE__ */ jsxs3("div", { role: "table", "aria-label": "Context", "data-density": density, className: cn2("text-xs", className), children: [
410
+ return /* @__PURE__ */ jsx3(TooltipProvider, { delayDuration: 300, titleTooltips: false, children: /* @__PURE__ */ jsxs3("div", { role: "table", "aria-label": "Values", "data-density": density, className: cn2("text-xs", className), children: [
408
411
  /* @__PURE__ */ jsxs3(
409
412
  "div",
410
413
  {
@@ -421,7 +424,7 @@ function ContextRulesTable({
421
424
  ]
422
425
  }
423
426
  ),
424
- rows.length === 0 ? /* @__PURE__ */ jsx3("div", { className: "px-2 py-3 text-center text-muted-foreground", children: "Nothing in context" }) : present.map((g) => /* @__PURE__ */ jsxs3("div", { role: "rowgroup", "aria-label": grouped ? g.label : void 0, children: [
427
+ rows.length === 0 ? /* @__PURE__ */ jsx3("div", { className: "px-2 py-3 text-center text-muted-foreground", children: "None" }) : present.map((g) => /* @__PURE__ */ jsxs3("div", { role: "rowgroup", "aria-label": grouped ? g.label : void 0, children: [
425
428
  grouped ? /* @__PURE__ */ jsx3(
426
429
  "div",
427
430
  {
@@ -755,7 +758,7 @@ import {
755
758
 
756
759
  // context/react/ContextDeliveredValue.tsx
757
760
  import * as React3 from "react";
758
- import { Skeleton, cn as cn4 } from "@ai-matrx/design-system";
761
+ import { ErrorBox, Skeleton, cn as cn4 } from "@ai-matrx/design-system";
759
762
  import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
760
763
  function ContextDeliveredValue({
761
764
  row,
@@ -794,6 +797,14 @@ function ContextDeliveredValue({
794
797
  ref_: row.onRequest,
795
798
  load
796
799
  }
800
+ ) : null,
801
+ row.delivered && CONTEXT_FETCHABLE_ROWS[row.key] ? /* @__PURE__ */ jsx5(
802
+ DeliveredSection,
803
+ {
804
+ title: "Agent can fetch",
805
+ target: { kind: "fetchable", key: row.key },
806
+ load
807
+ }
797
808
  ) : null
798
809
  ] });
799
810
  }
@@ -812,7 +823,13 @@ function DeliveredSection({
812
823
  setLoaded({ state: "loading" });
813
824
  load({ kind, key }).then(
814
825
  (viewed) => {
815
- if (live) setLoaded({ state: "done", text: viewed.text });
826
+ if (live)
827
+ setLoaded({
828
+ state: "done",
829
+ text: viewed.text,
830
+ chars: viewed.chars,
831
+ available: viewed.available !== false
832
+ });
816
833
  },
817
834
  (error) => {
818
835
  if (live)
@@ -826,12 +843,20 @@ function DeliveredSection({
826
843
  live = false;
827
844
  };
828
845
  }, [load, kind, key, attempt]);
846
+ const unavailable = loaded.state === "done" && !loaded.available;
829
847
  return /* @__PURE__ */ jsxs5("section", { className: "flex flex-col gap-1", "aria-label": title, "data-view-kind": kind, "data-view-key": key, children: [
830
848
  /* @__PURE__ */ jsxs5("div", { className: "flex items-baseline gap-2 text-xs", children: [
831
849
  /* @__PURE__ */ jsx5("span", { className: "font-medium", children: title }),
832
- /* @__PURE__ */ jsx5("span", { className: "tabular-nums text-muted-foreground", children: `${formatChars(ref_.chars)} chars` })
850
+ unavailable ? /* @__PURE__ */ jsx5(
851
+ "span",
852
+ {
853
+ "data-testid": "context-delivered-unavailable",
854
+ className: "rounded border border-border px-1.5 text-[11px] text-muted-foreground",
855
+ children: "Not available to this agent"
856
+ }
857
+ ) : ref_ || loaded.state === "done" ? /* @__PURE__ */ jsx5("span", { className: "tabular-nums text-muted-foreground", children: `${formatChars(ref_ ? ref_.chars : loaded.state === "done" ? loaded.chars : 0)} chars` }) : null
833
858
  ] }),
834
- !load ? /* @__PURE__ */ jsx5("span", { className: "text-xs text-muted-foreground", children: "\u2014" }) : loaded.state === "loading" ? /* @__PURE__ */ jsx5(Skeleton, { "data-testid": "context-delivered-loading", className: "h-16 w-full" }) : loaded.state === "error" ? /* @__PURE__ */ jsxs5("div", { className: "flex items-center gap-2 text-xs text-destructive", role: "alert", children: [
859
+ unavailable ? null : !load ? /* @__PURE__ */ jsx5("span", { className: "text-xs text-muted-foreground", children: "\u2014" }) : loaded.state === "loading" ? /* @__PURE__ */ jsx5(Skeleton, { "data-testid": "context-delivered-loading", className: "h-16 w-full" }) : loaded.state === "error" ? /* @__PURE__ */ jsxs5(ErrorBox, { as: "div", message: loaded.message, className: "flex items-center gap-2 text-xs text-destructive", children: [
835
860
  /* @__PURE__ */ jsx5("span", { className: "min-w-0 truncate", title: loaded.message, children: loaded.message }),
836
861
  /* @__PURE__ */ jsx5(
837
862
  "button",
@@ -842,7 +867,7 @@ function DeliveredSection({
842
867
  children: "Retry"
843
868
  }
844
869
  )
845
- ] }) : /* @__PURE__ */ jsx5(
870
+ ] }) : loaded.text === "" ? /* @__PURE__ */ jsx5("span", { "data-testid": "context-delivered-empty", className: "text-xs text-muted-foreground", children: "None" }) : /* @__PURE__ */ jsx5(
846
871
  "pre",
847
872
  {
848
873
  "data-testid": "context-delivered-text",
@@ -1089,7 +1114,7 @@ function ContextRulesPanelBody({
1089
1114
  Input2,
1090
1115
  {
1091
1116
  type: "search",
1092
- "aria-label": "Search context",
1117
+ "aria-label": "Search values",
1093
1118
  placeholder: "Search",
1094
1119
  value: query,
1095
1120
  onChange: (e) => setQuery(e.target.value),