@ai-matrx/agents 0.29.1 → 0.30.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 (39) hide show
  1. package/CHANGELOG.md +5 -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 +17 -4
  9. package/dist/context/index.d.ts +17 -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 +15 -4
  13. package/dist/context/react/index.cjs.map +1 -1
  14. package/dist/context/react/index.d.cts +14 -5
  15. package/dist/context/react/index.d.ts +14 -5
  16. package/dist/context/react/index.js +16 -5
  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/package.json +1 -1
@@ -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,8 @@ 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";
82
88
  }
83
89
  /** The host's door to the viewer API — called only when a person opens a value. */
84
90
  type ContextViewLoader = (target: ContextViewTarget) => Promise<ContextViewedText>;
@@ -269,7 +275,9 @@ declare function InlineMaxInput({ value, inherited, cap, onCommit, disabled, lab
269
275
  * What the model READ for one value — fetched from the viewer when the detail
270
276
  * opens, never pushed (RULES.md §5b): its own element (`delivered`), the blocks
271
277
  * it rode with (`deliveredBlocks` — the Organization's catalog), and for an
272
- * on-request value what the `context` tool returns (`onRequest`). Verbatim;
278
+ * on-request value what the `context` tool returns (`onRequest`), and for a
279
+ * value the agent reads through a tool (`CONTEXT_FETCHABLE_ROWS`) what that tool
280
+ * returns now (`fetchable`, sized once loaded). Verbatim;
273
281
  * never the client's copy. With no receipt yet: a server-authoritative value
274
282
  * says the server fills it; anything else renders nothing (the host may show
275
283
  * the value the page will send, labelled so).
@@ -284,7 +292,8 @@ declare function ContextDeliveredValue({ row, load, className, }: {
284
292
  declare function DeliveredSection({ title, target, ref_, load, }: {
285
293
  title: string;
286
294
  target: ContextViewTarget;
287
- ref_: ContextDeliveredRef;
295
+ /** The receipt's size; absent for a `fetchable` text, sized once it loads. */
296
+ ref_?: ContextDeliveredRef | undefined;
288
297
  load?: ContextViewLoader | undefined;
289
298
  }): react.JSX.Element;
290
299
 
@@ -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,8 @@ 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";
82
88
  }
83
89
  /** The host's door to the viewer API — called only when a person opens a value. */
84
90
  type ContextViewLoader = (target: ContextViewTarget) => Promise<ContextViewedText>;
@@ -269,7 +275,9 @@ declare function InlineMaxInput({ value, inherited, cap, onCommit, disabled, lab
269
275
  * What the model READ for one value — fetched from the viewer when the detail
270
276
  * opens, never pushed (RULES.md §5b): its own element (`delivered`), the blocks
271
277
  * it rode with (`deliveredBlocks` — the Organization's catalog), and for an
272
- * on-request value what the `context` tool returns (`onRequest`). Verbatim;
278
+ * on-request value what the `context` tool returns (`onRequest`), and for a
279
+ * value the agent reads through a tool (`CONTEXT_FETCHABLE_ROWS`) what that tool
280
+ * returns now (`fetchable`, sized once loaded). Verbatim;
273
281
  * never the client's copy. With no receipt yet: a server-authoritative value
274
282
  * says the server fills it; anything else renders nothing (the host may show
275
283
  * the value the page will send, labelled so).
@@ -284,7 +292,8 @@ declare function ContextDeliveredValue({ row, load, className, }: {
284
292
  declare function DeliveredSection({ title, target, ref_, load, }: {
285
293
  title: string;
286
294
  target: ContextViewTarget;
287
- ref_: ContextDeliveredRef;
295
+ /** The receipt's size; absent for a `fetchable` text, sized once it loads. */
296
+ ref_?: ContextDeliveredRef | undefined;
288
297
  load?: ContextViewLoader | undefined;
289
298
  }): react.JSX.Element;
290
299
 
@@ -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);
@@ -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,7 @@ 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) setLoaded({ state: "done", text: viewed.text, chars: viewed.chars });
816
827
  },
817
828
  (error) => {
818
829
  if (live)
@@ -829,9 +840,9 @@ function DeliveredSection({
829
840
  return /* @__PURE__ */ jsxs5("section", { className: "flex flex-col gap-1", "aria-label": title, "data-view-kind": kind, "data-view-key": key, children: [
830
841
  /* @__PURE__ */ jsxs5("div", { className: "flex items-baseline gap-2 text-xs", children: [
831
842
  /* @__PURE__ */ jsx5("span", { className: "font-medium", children: title }),
832
- /* @__PURE__ */ jsx5("span", { className: "tabular-nums text-muted-foreground", children: `${formatChars(ref_.chars)} chars` })
843
+ 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
844
  ] }),
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: [
845
+ !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
846
  /* @__PURE__ */ jsx5("span", { className: "min-w-0 truncate", title: loaded.message, children: loaded.message }),
836
847
  /* @__PURE__ */ jsx5(
837
848
  "button",
@@ -842,7 +853,7 @@ function DeliveredSection({
842
853
  children: "Retry"
843
854
  }
844
855
  )
845
- ] }) : /* @__PURE__ */ jsx5(
856
+ ] }) : loaded.text === "" ? /* @__PURE__ */ jsx5("span", { "data-testid": "context-delivered-empty", className: "text-xs text-muted-foreground", children: "None" }) : /* @__PURE__ */ jsx5(
846
857
  "pre",
847
858
  {
848
859
  "data-testid": "context-delivered-text",