@ai-matrx/agents 0.59.262 → 0.59.263

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.
package/CHANGELOG.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Changelog
2
2
 
3
- ## 0.59.262
3
+ ## 0.59.263
4
4
  ### no second star read after a catalog or search read (FW-014)
5
5
 
6
6
  - `ensureLoaded()` and `searchServer()` no longer follow each read with `ues_get_bulk('agent', every id)`.
@@ -470,7 +470,9 @@ function receiptRowToResolved(row, blocks) {
470
470
  surfaceKey: row.surface_key,
471
471
  origin,
472
472
  value: void 0,
473
- chars: row.delivered && isServerAuthoritativeKey(row.key) ? row.delivered.chars + attached.reduce((n, b) => n + b.delivered.chars, 0) : row.chars,
473
+ // The server's own count of the text it sent (the text View opens); the value's
474
+ // size on the page is only the fallback for a receipt that states none.
475
+ chars: row.delivered && isServerAuthoritativeKey(row.key) ? row.delivered.chars + attached.reduce((n, b) => n + b.delivered.chars, 0) : row.delivered?.chars ?? row.on_request?.chars ?? row.chars,
474
476
  userRule: normalizeUserRule(row.user_rule),
475
477
  include: row.include,
476
478
  max_inline_chars: row.max_inline_chars,
@@ -407,7 +407,9 @@ function receiptRowToResolved(row, blocks) {
407
407
  surfaceKey: row.surface_key,
408
408
  origin,
409
409
  value: void 0,
410
- chars: row.delivered && isServerAuthoritativeKey(row.key) ? row.delivered.chars + attached.reduce((n, b) => n + b.delivered.chars, 0) : row.chars,
410
+ // The server's own count of the text it sent (the text View opens); the value's
411
+ // size on the page is only the fallback for a receipt that states none.
412
+ chars: row.delivered && isServerAuthoritativeKey(row.key) ? row.delivered.chars + attached.reduce((n, b) => n + b.delivered.chars, 0) : row.delivered?.chars ?? row.on_request?.chars ?? row.chars,
411
413
  userRule: normalizeUserRule(row.user_rule),
412
414
  include: row.include,
413
415
  max_inline_chars: row.max_inline_chars,
@@ -205,6 +205,20 @@ function buildContextLevels(rows, hierarchy) {
205
205
  for (const level of out) level.groups = stableSort(level.groups, (g) => g.ref);
206
206
  return stableSort(out, (level) => level.ref);
207
207
  }
208
+ function mergeLevels(a, b) {
209
+ const groups = a.groups.map((g) => ({ ref: g.ref, rows: [...g.rows] }));
210
+ for (const g of b.groups) {
211
+ const hit = groups.find((x) => x.ref.id === g.ref.id);
212
+ if (hit) hit.rows.push(...g.rows);
213
+ else groups.push({ ref: g.ref, rows: [...g.rows] });
214
+ }
215
+ return {
216
+ ref: { ...a.ref, order: Math.min(a.ref.order ?? 0, b.ref.order ?? 0) },
217
+ rows: [...a.rows, ...b.rows],
218
+ groups,
219
+ master: a.master ?? b.master
220
+ };
221
+ }
208
222
  function buildContextTree(levels) {
209
223
  const roots = [];
210
224
  const byId = /* @__PURE__ */ new Map();
@@ -228,7 +242,7 @@ function buildContextTree(levels) {
228
242
  last = hit;
229
243
  siblings = hit.children;
230
244
  }
231
- if (last) last.level = level;
245
+ if (last) last.level = last.level ? mergeLevels(last.level, level) : level;
232
246
  }
233
247
  const sort = (list) => {
234
248
  const sorted = stableSort(list, (n) => ({ order: rank.get(n) ?? 0 }));
@@ -857,7 +871,7 @@ var import_controls = require("@ai-matrx/design-system/controls");
857
871
  var import_design_system4 = require("@ai-matrx/design-system");
858
872
  var import_icons7 = require("@ai-matrx/design-system/icons");
859
873
  var import_jsx_runtime4 = require("react/jsx-runtime");
860
- var BLIND_TOOLTIP = "This model can't read these values";
874
+ var BLIND_TOOLTIP = "Not sent to this model";
861
875
  var BLIND_LABEL = "Not read";
862
876
  function IconButton({
863
877
  label,
@@ -1107,11 +1121,8 @@ function DeliveredSection({
1107
1121
  });
1108
1122
  },
1109
1123
  (error) => {
1110
- if (live)
1111
- setLoaded({
1112
- state: "error",
1113
- message: error instanceof Error && error.message ? error.message : "Couldn't load"
1114
- });
1124
+ void error;
1125
+ if (live) setLoaded({ state: "error" });
1115
1126
  }
1116
1127
  );
1117
1128
  return () => {
@@ -1139,18 +1150,21 @@ function DeliveredSection({
1139
1150
  }
1140
1151
  ) : null
1141
1152
  ] }),
1142
- unavailable ? null : !load ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "text-xs text-muted-foreground", children: "\u2014" }) : loaded.state === "loading" ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_design_system5.Skeleton, { "data-testid": "context-delivered-loading", className: "h-16 w-full" }) : loaded.state === "error" ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_design_system5.ErrorBox, { as: "div", message: loaded.message, className: "flex items-center gap-2 text-xs text-destructive", children: [
1143
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "min-w-0 truncate", title: loaded.message, children: loaded.message }),
1144
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1145
- "button",
1146
- {
1147
- type: "button",
1148
- onClick: () => setAttempt((n) => n + 1),
1149
- className: "shrink-0 rounded px-1.5 py-0.5 text-foreground hover:bg-accent",
1150
- children: "Retry"
1151
- }
1152
- )
1153
- ] }) : loaded.text === "" ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { "data-testid": "context-delivered-empty", className: "text-xs text-muted-foreground", children: "None" }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1153
+ unavailable ? null : !load ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "text-xs text-muted-foreground", children: "\u2014" }) : loaded.state === "loading" ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_design_system5.Skeleton, { "data-testid": "context-delivered-loading", className: "h-16 w-full" }) : loaded.state === "error" ? (
1154
+ // Calm and one line: the server's words never reach the person (the host's loader files the error).
1155
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { "data-testid": "context-delivered-unavailable", className: "flex items-center gap-2 text-xs text-muted-foreground", children: [
1156
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "min-w-0 truncate", children: "Text not kept for this message" }),
1157
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1158
+ "button",
1159
+ {
1160
+ type: "button",
1161
+ onClick: () => setAttempt((n) => n + 1),
1162
+ className: "shrink-0 rounded px-1.5 py-0.5 text-foreground hover:bg-accent",
1163
+ children: "Try again"
1164
+ }
1165
+ )
1166
+ ] })
1167
+ ) : loaded.text === "" ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { "data-testid": "context-delivered-empty", className: "text-xs text-muted-foreground", children: "None" }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1154
1168
  "pre",
1155
1169
  {
1156
1170
  "data-testid": "context-delivered-text",
@@ -167,6 +167,20 @@ function buildContextLevels(rows, hierarchy) {
167
167
  for (const level of out) level.groups = stableSort(level.groups, (g) => g.ref);
168
168
  return stableSort(out, (level) => level.ref);
169
169
  }
170
+ function mergeLevels(a, b) {
171
+ const groups = a.groups.map((g) => ({ ref: g.ref, rows: [...g.rows] }));
172
+ for (const g of b.groups) {
173
+ const hit = groups.find((x) => x.ref.id === g.ref.id);
174
+ if (hit) hit.rows.push(...g.rows);
175
+ else groups.push({ ref: g.ref, rows: [...g.rows] });
176
+ }
177
+ return {
178
+ ref: { ...a.ref, order: Math.min(a.ref.order ?? 0, b.ref.order ?? 0) },
179
+ rows: [...a.rows, ...b.rows],
180
+ groups,
181
+ master: a.master ?? b.master
182
+ };
183
+ }
170
184
  function buildContextTree(levels) {
171
185
  const roots = [];
172
186
  const byId = /* @__PURE__ */ new Map();
@@ -190,7 +204,7 @@ function buildContextTree(levels) {
190
204
  last = hit;
191
205
  siblings = hit.children;
192
206
  }
193
- if (last) last.level = level;
207
+ if (last) last.level = last.level ? mergeLevels(last.level, level) : level;
194
208
  }
195
209
  const sort = (list) => {
196
210
  const sorted = stableSort(list, (n) => ({ order: rank.get(n) ?? 0 }));
@@ -836,7 +850,7 @@ import {
836
850
  } from "@ai-matrx/design-system";
837
851
  import { EyeOffIcon, PanelRightIcon } from "@ai-matrx/design-system/icons";
838
852
  import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
839
- var BLIND_TOOLTIP = "This model can't read these values";
853
+ var BLIND_TOOLTIP = "Not sent to this model";
840
854
  var BLIND_LABEL = "Not read";
841
855
  function IconButton({
842
856
  label,
@@ -1012,7 +1026,7 @@ import { ChevronLeftIcon, SearchIcon } from "@ai-matrx/design-system/icons";
1012
1026
 
1013
1027
  // context/react/ContextDeliveredValue.tsx
1014
1028
  import * as React4 from "react";
1015
- import { ErrorBox, Skeleton, cn as cn5 } from "@ai-matrx/design-system";
1029
+ import { Skeleton, cn as cn5 } from "@ai-matrx/design-system";
1016
1030
  import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
1017
1031
  function ContextDeliveredValue({
1018
1032
  row,
@@ -1091,11 +1105,8 @@ function DeliveredSection({
1091
1105
  });
1092
1106
  },
1093
1107
  (error) => {
1094
- if (live)
1095
- setLoaded({
1096
- state: "error",
1097
- message: error instanceof Error && error.message ? error.message : "Couldn't load"
1098
- });
1108
+ void error;
1109
+ if (live) setLoaded({ state: "error" });
1099
1110
  }
1100
1111
  );
1101
1112
  return () => {
@@ -1123,18 +1134,21 @@ function DeliveredSection({
1123
1134
  }
1124
1135
  ) : null
1125
1136
  ] }),
1126
- 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: [
1127
- /* @__PURE__ */ jsx5("span", { className: "min-w-0 truncate", title: loaded.message, children: loaded.message }),
1128
- /* @__PURE__ */ jsx5(
1129
- "button",
1130
- {
1131
- type: "button",
1132
- onClick: () => setAttempt((n) => n + 1),
1133
- className: "shrink-0 rounded px-1.5 py-0.5 text-foreground hover:bg-accent",
1134
- children: "Retry"
1135
- }
1136
- )
1137
- ] }) : loaded.text === "" ? /* @__PURE__ */ jsx5("span", { "data-testid": "context-delivered-empty", className: "text-xs text-muted-foreground", children: "None" }) : /* @__PURE__ */ jsx5(
1137
+ 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" ? (
1138
+ // Calm and one line: the server's words never reach the person (the host's loader files the error).
1139
+ /* @__PURE__ */ jsxs5("span", { "data-testid": "context-delivered-unavailable", className: "flex items-center gap-2 text-xs text-muted-foreground", children: [
1140
+ /* @__PURE__ */ jsx5("span", { className: "min-w-0 truncate", children: "Text not kept for this message" }),
1141
+ /* @__PURE__ */ jsx5(
1142
+ "button",
1143
+ {
1144
+ type: "button",
1145
+ onClick: () => setAttempt((n) => n + 1),
1146
+ className: "shrink-0 rounded px-1.5 py-0.5 text-foreground hover:bg-accent",
1147
+ children: "Try again"
1148
+ }
1149
+ )
1150
+ ] })
1151
+ ) : loaded.text === "" ? /* @__PURE__ */ jsx5("span", { "data-testid": "context-delivered-empty", className: "text-xs text-muted-foreground", children: "None" }) : /* @__PURE__ */ jsx5(
1138
1152
  "pre",
1139
1153
  {
1140
1154
  "data-testid": "context-delivered-text",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-matrx/agents",
3
- "version": "0.59.262",
3
+ "version": "0.59.263",
4
4
  "description": "Portable AI Matrx agent stream protocol, event projection, and safe result-presentation primitives.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -562,5 +562,5 @@
562
562
  "verify:tarball": "node ./scripts/verify-tarball.mjs",
563
563
  "typegen:self-test": "node scripts/typegen/drop-guard.self-test.mjs && node scripts/typegen/check-api-types-fresh.mjs --self-test"
564
564
  },
565
- "gitHead": "de2b95873473d1fd1878b0e3b06ce75570190a1b"
565
+ "gitHead": "6201da503daf423d01eadb1c5ff2efa5bc846bc0"
566
566
  }