@ai-matrx/agents 0.31.0 → 0.33.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 (42) hide show
  1. package/CHANGELOG.md +16 -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.map +1 -1
  7. package/dist/context/index.d.cts +13 -2
  8. package/dist/context/index.d.ts +13 -2
  9. package/dist/context/index.js.map +1 -1
  10. package/dist/context/react/index.cjs +23 -10
  11. package/dist/context/react/index.cjs.map +1 -1
  12. package/dist/context/react/index.d.cts +14 -3
  13. package/dist/context/react/index.d.ts +14 -3
  14. package/dist/context/react/index.js +23 -10
  15. package/dist/context/react/index.js.map +1 -1
  16. package/dist/envelope/index.cjs +208 -0
  17. package/dist/envelope/index.cjs.map +1 -0
  18. package/dist/envelope/index.d.cts +314 -0
  19. package/dist/envelope/index.d.ts +314 -0
  20. package/dist/envelope/index.js +192 -0
  21. package/dist/envelope/index.js.map +1 -0
  22. package/dist/field-flags/index.cjs +63 -0
  23. package/dist/field-flags/index.cjs.map +1 -0
  24. package/dist/field-flags/index.d.cts +40 -0
  25. package/dist/field-flags/index.d.ts +40 -0
  26. package/dist/field-flags/index.js +42 -0
  27. package/dist/field-flags/index.js.map +1 -0
  28. package/dist/mandates/index.cjs +57 -2
  29. package/dist/mandates/index.cjs.map +1 -1
  30. package/dist/mandates/index.d.cts +85 -5
  31. package/dist/mandates/index.d.ts +85 -5
  32. package/dist/mandates/index.js +57 -2
  33. package/dist/mandates/index.js.map +1 -1
  34. package/dist/models/index.cjs +267 -0
  35. package/dist/models/index.cjs.map +1 -0
  36. package/dist/models/index.d.cts +118 -0
  37. package/dist/models/index.d.ts +118 -0
  38. package/dist/models/index.js +244 -0
  39. package/dist/models/index.js.map +1 -0
  40. package/mandates/snapshots/keys.0.32.0.json +653 -0
  41. package/mandates/snapshots/keys.0.33.0.json +653 -0
  42. package/package.json +35 -4
@@ -83,14 +83,25 @@ interface ContextViewedText {
83
83
  text: string;
84
84
  chars: number;
85
85
  sha256: string;
86
- /** `fetched_now`: a `fetchable` text — what the agent gets if it asks now. */
87
- source: "preview" | "wire" | "conversation_prompt" | "turn_record" | "fetched_now";
86
+ /**
87
+ * `fetched_now`: read at request time — a `fetchable` text (what the agent
88
+ * gets if it asks now) or a lazy `on_request` value the agent never read.
89
+ * `tool_result`: exactly what the `context` tool returned to the agent.
90
+ */
91
+ source: "preview" | "wire" | "conversation_prompt" | "turn_record" | "fetched_now" | "tool_result";
88
92
  /**
89
93
  * `fetchable` only: `false` when the turn's agent cannot call the tool that
90
94
  * returns it (tools off, excluded, a structured-output turn). `text` is then
91
95
  * `""`; the screen says so with state, never shows content as fetchable.
92
96
  */
93
97
  available?: boolean;
98
+ /**
99
+ * A lazy `on_request` value of a SENT turn only (a document, a file family,
100
+ * a scope — the turn never reads one): `true` — the agent called `context`
101
+ * for it and `text` is what the tool returned; `false` — the agent never
102
+ * read it and `text` is what it returns now (the screen says so).
103
+ */
104
+ fetched?: boolean | null;
94
105
  }
95
106
  /** The host's door to the viewer API — called only when a person opens a value. */
96
107
  type ContextViewLoader = (target: ContextViewTarget) => Promise<ContextViewedText>;
@@ -289,7 +300,7 @@ declare function InlineMaxInput({ value, inherited, cap, onCommit, disabled, lab
289
300
  * the value the page will send, labelled so).
290
301
  */
291
302
  declare function ContextDeliveredValue({ row, load, className, }: {
292
- row: Pick<ResolvedContextRow, "key" | "delivered" | "onRequest" | "deliveredBlocks">;
303
+ row: Pick<ResolvedContextRow, "key" | "delivered" | "onRequest" | "deliveredBlocks"> & Partial<Pick<ResolvedContextRow, "delivery">>;
293
304
  /** The host's viewer door; without one, sizes show and the text reads "—". */
294
305
  load?: ContextViewLoader | undefined;
295
306
  className?: string;
@@ -83,14 +83,25 @@ interface ContextViewedText {
83
83
  text: string;
84
84
  chars: number;
85
85
  sha256: string;
86
- /** `fetched_now`: a `fetchable` text — what the agent gets if it asks now. */
87
- source: "preview" | "wire" | "conversation_prompt" | "turn_record" | "fetched_now";
86
+ /**
87
+ * `fetched_now`: read at request time — a `fetchable` text (what the agent
88
+ * gets if it asks now) or a lazy `on_request` value the agent never read.
89
+ * `tool_result`: exactly what the `context` tool returned to the agent.
90
+ */
91
+ source: "preview" | "wire" | "conversation_prompt" | "turn_record" | "fetched_now" | "tool_result";
88
92
  /**
89
93
  * `fetchable` only: `false` when the turn's agent cannot call the tool that
90
94
  * returns it (tools off, excluded, a structured-output turn). `text` is then
91
95
  * `""`; the screen says so with state, never shows content as fetchable.
92
96
  */
93
97
  available?: boolean;
98
+ /**
99
+ * A lazy `on_request` value of a SENT turn only (a document, a file family,
100
+ * a scope — the turn never reads one): `true` — the agent called `context`
101
+ * for it and `text` is what the tool returned; `false` — the agent never
102
+ * read it and `text` is what it returns now (the screen says so).
103
+ */
104
+ fetched?: boolean | null;
94
105
  }
95
106
  /** The host's door to the viewer API — called only when a person opens a value. */
96
107
  type ContextViewLoader = (target: ContextViewTarget) => Promise<ContextViewedText>;
@@ -289,7 +300,7 @@ declare function InlineMaxInput({ value, inherited, cap, onCommit, disabled, lab
289
300
  * the value the page will send, labelled so).
290
301
  */
291
302
  declare function ContextDeliveredValue({ row, load, className, }: {
292
- row: Pick<ResolvedContextRow, "key" | "delivered" | "onRequest" | "deliveredBlocks">;
303
+ row: Pick<ResolvedContextRow, "key" | "delivered" | "onRequest" | "deliveredBlocks"> & Partial<Pick<ResolvedContextRow, "delivery">>;
293
304
  /** The host's viewer door; without one, sizes show and the text reads "—". */
294
305
  load?: ContextViewLoader | undefined;
295
306
  className?: string;
@@ -789,14 +789,18 @@ function ContextDeliveredValue({
789
789
  },
790
790
  block.id
791
791
  )),
792
- row.onRequest ? /* @__PURE__ */ jsx5(
793
- DeliveredSection,
794
- {
795
- title: "Returned on request",
796
- target: { kind: "on_request", key: row.key },
797
- ref_: row.onRequest,
798
- load
799
- }
792
+ row.onRequest || row.delivery === "on_request" && row.delivered ? (
793
+ // A lazy value (a document, a file family …) carries no ref: the turn never reads
794
+ // it. It is fetched — and sized — when opened.
795
+ /* @__PURE__ */ jsx5(
796
+ DeliveredSection,
797
+ {
798
+ title: "Returned on request",
799
+ target: { kind: "on_request", key: row.key },
800
+ ref_: row.onRequest,
801
+ load
802
+ }
803
+ )
800
804
  ) : null,
801
805
  row.delivered && CONTEXT_FETCHABLE_ROWS[row.key] ? /* @__PURE__ */ jsx5(
802
806
  DeliveredSection,
@@ -828,7 +832,8 @@ function DeliveredSection({
828
832
  state: "done",
829
833
  text: viewed.text,
830
834
  chars: viewed.chars,
831
- available: viewed.available !== false
835
+ available: viewed.available !== false,
836
+ fetched: viewed.fetched ?? null
832
837
  });
833
838
  },
834
839
  (error) => {
@@ -854,7 +859,15 @@ function DeliveredSection({
854
859
  className: "rounded border border-border px-1.5 text-[11px] text-muted-foreground",
855
860
  children: "Not available to this agent"
856
861
  }
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
862
+ ) : 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,
863
+ loaded.state === "done" && loaded.fetched === false ? /* @__PURE__ */ jsx5(
864
+ "span",
865
+ {
866
+ "data-testid": "context-delivered-not-read",
867
+ className: "rounded border border-border px-1.5 text-[11px] text-muted-foreground",
868
+ children: "Not read by the agent"
869
+ }
870
+ ) : null
858
871
  ] }),
859
872
  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: [
860
873
  /* @__PURE__ */ jsx5("span", { className: "min-w-0 truncate", title: loaded.message, children: loaded.message }),