@ai-matrx/agents 0.30.0 → 0.32.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.
@@ -83,8 +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";
92
+ /**
93
+ * `fetchable` only: `false` when the turn's agent cannot call the tool that
94
+ * returns it (tools off, excluded, a structured-output turn). `text` is then
95
+ * `""`; the screen says so with state, never shows content as fetchable.
96
+ */
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;
88
105
  }
89
106
  /** The host's door to the viewer API — called only when a person opens a value. */
90
107
  type ContextViewLoader = (target: ContextViewTarget) => Promise<ContextViewedText>;
@@ -283,7 +300,7 @@ declare function InlineMaxInput({ value, inherited, cap, onCommit, disabled, lab
283
300
  * the value the page will send, labelled so).
284
301
  */
285
302
  declare function ContextDeliveredValue({ row, load, className, }: {
286
- row: Pick<ResolvedContextRow, "key" | "delivered" | "onRequest" | "deliveredBlocks">;
303
+ row: Pick<ResolvedContextRow, "key" | "delivered" | "onRequest" | "deliveredBlocks"> & Partial<Pick<ResolvedContextRow, "delivery">>;
287
304
  /** The host's viewer door; without one, sizes show and the text reads "—". */
288
305
  load?: ContextViewLoader | undefined;
289
306
  className?: string;
@@ -83,8 +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";
92
+ /**
93
+ * `fetchable` only: `false` when the turn's agent cannot call the tool that
94
+ * returns it (tools off, excluded, a structured-output turn). `text` is then
95
+ * `""`; the screen says so with state, never shows content as fetchable.
96
+ */
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;
88
105
  }
89
106
  /** The host's door to the viewer API — called only when a person opens a value. */
90
107
  type ContextViewLoader = (target: ContextViewTarget) => Promise<ContextViewedText>;
@@ -283,7 +300,7 @@ declare function InlineMaxInput({ value, inherited, cap, onCommit, disabled, lab
283
300
  * the value the page will send, labelled so).
284
301
  */
285
302
  declare function ContextDeliveredValue({ row, load, className, }: {
286
- row: Pick<ResolvedContextRow, "key" | "delivered" | "onRequest" | "deliveredBlocks">;
303
+ row: Pick<ResolvedContextRow, "key" | "delivered" | "onRequest" | "deliveredBlocks"> & Partial<Pick<ResolvedContextRow, "delivery">>;
287
304
  /** The host's viewer door; without one, sizes show and the text reads "—". */
288
305
  load?: ContextViewLoader | undefined;
289
306
  className?: string;
@@ -407,7 +407,7 @@ function ContextRulesTable({
407
407
  const comfortable = density === "comfortable";
408
408
  const present = GROUPS.filter((g) => rows.some((r) => r.origin === g.origin));
409
409
  const grouped = present.length > 1;
410
- 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: [
411
411
  /* @__PURE__ */ jsxs3(
412
412
  "div",
413
413
  {
@@ -424,7 +424,7 @@ function ContextRulesTable({
424
424
  ]
425
425
  }
426
426
  ),
427
- 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: [
428
428
  grouped ? /* @__PURE__ */ jsx3(
429
429
  "div",
430
430
  {
@@ -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,
@@ -823,7 +827,14 @@ function DeliveredSection({
823
827
  setLoaded({ state: "loading" });
824
828
  load({ kind, key }).then(
825
829
  (viewed) => {
826
- if (live) setLoaded({ state: "done", text: viewed.text, chars: viewed.chars });
830
+ if (live)
831
+ setLoaded({
832
+ state: "done",
833
+ text: viewed.text,
834
+ chars: viewed.chars,
835
+ available: viewed.available !== false,
836
+ fetched: viewed.fetched ?? null
837
+ });
827
838
  },
828
839
  (error) => {
829
840
  if (live)
@@ -837,12 +848,28 @@ function DeliveredSection({
837
848
  live = false;
838
849
  };
839
850
  }, [load, kind, key, attempt]);
851
+ const unavailable = loaded.state === "done" && !loaded.available;
840
852
  return /* @__PURE__ */ jsxs5("section", { className: "flex flex-col gap-1", "aria-label": title, "data-view-kind": kind, "data-view-key": key, children: [
841
853
  /* @__PURE__ */ jsxs5("div", { className: "flex items-baseline gap-2 text-xs", children: [
842
854
  /* @__PURE__ */ jsx5("span", { className: "font-medium", children: title }),
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
855
+ unavailable ? /* @__PURE__ */ jsx5(
856
+ "span",
857
+ {
858
+ "data-testid": "context-delivered-unavailable",
859
+ className: "rounded border border-border px-1.5 text-[11px] text-muted-foreground",
860
+ children: "Not available to this agent"
861
+ }
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
844
871
  ] }),
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: [
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: [
846
873
  /* @__PURE__ */ jsx5("span", { className: "min-w-0 truncate", title: loaded.message, children: loaded.message }),
847
874
  /* @__PURE__ */ jsx5(
848
875
  "button",
@@ -1100,7 +1127,7 @@ function ContextRulesPanelBody({
1100
1127
  Input2,
1101
1128
  {
1102
1129
  type: "search",
1103
- "aria-label": "Search context",
1130
+ "aria-label": "Search values",
1104
1131
  placeholder: "Search",
1105
1132
  value: query,
1106
1133
  onChange: (e) => setQuery(e.target.value),