@ai-matrx/agents 0.59.262 → 0.59.264
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 +1 -1
- package/dist/context/index.cjs +3 -1
- package/dist/context/index.js +3 -1
- package/dist/context/react/index.cjs +52 -29
- package/dist/context/react/index.d.cts +0 -6
- package/dist/context/react/index.d.ts +0 -6
- package/dist/context/react/index.js +53 -30
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
package/dist/context/index.cjs
CHANGED
|
@@ -470,7 +470,9 @@ function receiptRowToResolved(row, blocks) {
|
|
|
470
470
|
surfaceKey: row.surface_key,
|
|
471
471
|
origin,
|
|
472
472
|
value: void 0,
|
|
473
|
-
|
|
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,
|
package/dist/context/index.js
CHANGED
|
@@ -407,7 +407,9 @@ function receiptRowToResolved(row, blocks) {
|
|
|
407
407
|
surfaceKey: row.surface_key,
|
|
408
408
|
origin,
|
|
409
409
|
value: void 0,
|
|
410
|
-
|
|
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 }));
|
|
@@ -500,6 +514,7 @@ function useNarrow(ref) {
|
|
|
500
514
|
}
|
|
501
515
|
var INDENT = ["", "pl-2", "pl-4", "pl-6"];
|
|
502
516
|
var indent = (depth) => INDENT[Math.min(depth, INDENT.length - 1)];
|
|
517
|
+
var OWN_LOCK_REASON = "This page's own chat never gets itself";
|
|
503
518
|
function ContextRulesTable({
|
|
504
519
|
rows,
|
|
505
520
|
cap,
|
|
@@ -763,16 +778,24 @@ function ContextRuleRow({
|
|
|
763
778
|
]
|
|
764
779
|
}
|
|
765
780
|
),
|
|
766
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { role: "cell", className: (0, import_design_system3.cn)("flex justify-center", narrow && "order-last"), children: readOnly ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(FrozenInclude, { name: row.label, checked: row.include }) :
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
781
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { role: "cell", className: (0, import_design_system3.cn)("flex justify-center", narrow && "order-last"), children: readOnly ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(FrozenInclude, { name: row.label, checked: row.include }) : (() => {
|
|
782
|
+
const locked = row.layers?.surface?.own === true;
|
|
783
|
+
const control = /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
784
|
+
import_design_system3.Switch,
|
|
785
|
+
{
|
|
786
|
+
size: "sm",
|
|
787
|
+
"aria-label": `Include ${row.label}`,
|
|
788
|
+
checked: row.include,
|
|
789
|
+
disabled: locked,
|
|
790
|
+
onCheckedChange: (next) => onChange(row.key, row.surfaceKey, withInclude(row, next))
|
|
791
|
+
}
|
|
792
|
+
);
|
|
793
|
+
if (!locked) return control;
|
|
794
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_design_system3.Tooltip, { children: [
|
|
795
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_design_system3.TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "inline-flex", children: control }) }),
|
|
796
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_design_system3.TooltipContent, { children: OWN_LOCK_REASON })
|
|
797
|
+
] });
|
|
798
|
+
})() }),
|
|
776
799
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
777
800
|
"div",
|
|
778
801
|
{
|
|
@@ -857,7 +880,7 @@ var import_controls = require("@ai-matrx/design-system/controls");
|
|
|
857
880
|
var import_design_system4 = require("@ai-matrx/design-system");
|
|
858
881
|
var import_icons7 = require("@ai-matrx/design-system/icons");
|
|
859
882
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
860
|
-
var BLIND_TOOLTIP = "
|
|
883
|
+
var BLIND_TOOLTIP = "Not sent to this model";
|
|
861
884
|
var BLIND_LABEL = "Not read";
|
|
862
885
|
function IconButton({
|
|
863
886
|
label,
|
|
@@ -1107,11 +1130,8 @@ function DeliveredSection({
|
|
|
1107
1130
|
});
|
|
1108
1131
|
},
|
|
1109
1132
|
(error) => {
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
state: "error",
|
|
1113
|
-
message: error instanceof Error && error.message ? error.message : "Couldn't load"
|
|
1114
|
-
});
|
|
1133
|
+
void error;
|
|
1134
|
+
if (live) setLoaded({ state: "error" });
|
|
1115
1135
|
}
|
|
1116
1136
|
);
|
|
1117
1137
|
return () => {
|
|
@@ -1139,18 +1159,21 @@ function DeliveredSection({
|
|
|
1139
1159
|
}
|
|
1140
1160
|
) : null
|
|
1141
1161
|
] }),
|
|
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" ?
|
|
1143
|
-
|
|
1144
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.
|
|
1145
|
-
"
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1162
|
+
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" ? (
|
|
1163
|
+
// Calm and one line: the server's words never reach the person (the host's loader files the error).
|
|
1164
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { "data-testid": "context-delivered-unavailable", className: "flex items-center gap-2 text-xs text-muted-foreground", children: [
|
|
1165
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "min-w-0 truncate", children: "Text not kept for this message" }),
|
|
1166
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1167
|
+
"button",
|
|
1168
|
+
{
|
|
1169
|
+
type: "button",
|
|
1170
|
+
onClick: () => setAttempt((n) => n + 1),
|
|
1171
|
+
className: "shrink-0 rounded px-1.5 py-0.5 text-foreground hover:bg-accent",
|
|
1172
|
+
children: "Try again"
|
|
1173
|
+
}
|
|
1174
|
+
)
|
|
1175
|
+
] })
|
|
1176
|
+
) : 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
1177
|
"pre",
|
|
1155
1178
|
{
|
|
1156
1179
|
"data-testid": "context-delivered-text",
|
|
@@ -313,12 +313,6 @@ interface ContextRulesTableProps {
|
|
|
313
313
|
renderRowTrail?: ((row: ResolvedContextRow) => React.ReactNode) | undefined;
|
|
314
314
|
className?: string;
|
|
315
315
|
}
|
|
316
|
-
/**
|
|
317
|
-
* The context rules table: Item | Include | Chars | Inline max, under nested
|
|
318
|
-
* heading rows — section ("Marketing"), page ("Marketing Brand Cockpit"), the
|
|
319
|
-
* page's own groups — each heading full width with its switch. Presentational
|
|
320
|
-
* and state-agnostic — every edit goes out through `onChange`.
|
|
321
|
-
*/
|
|
322
316
|
declare function ContextRulesTable({ rows, cap, readOnly, onChange, onOpenRow, density, selectedKey, hierarchy, onSetInclude, renderRowLead, renderRowTrail, className, }: ContextRulesTableProps): React.JSX.Element;
|
|
323
317
|
|
|
324
318
|
/**
|
|
@@ -313,12 +313,6 @@ interface ContextRulesTableProps {
|
|
|
313
313
|
renderRowTrail?: ((row: ResolvedContextRow) => React.ReactNode) | undefined;
|
|
314
314
|
className?: string;
|
|
315
315
|
}
|
|
316
|
-
/**
|
|
317
|
-
* The context rules table: Item | Include | Chars | Inline max, under nested
|
|
318
|
-
* heading rows — section ("Marketing"), page ("Marketing Brand Cockpit"), the
|
|
319
|
-
* page's own groups — each heading full width with its switch. Presentational
|
|
320
|
-
* and state-agnostic — every edit goes out through `onChange`.
|
|
321
|
-
*/
|
|
322
316
|
declare function ContextRulesTable({ rows, cap, readOnly, onChange, onOpenRow, density, selectedKey, hierarchy, onSetInclude, renderRowLead, renderRowTrail, className, }: ContextRulesTableProps): React.JSX.Element;
|
|
323
317
|
|
|
324
318
|
/**
|
|
@@ -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 }));
|
|
@@ -468,6 +482,7 @@ function useNarrow(ref) {
|
|
|
468
482
|
}
|
|
469
483
|
var INDENT = ["", "pl-2", "pl-4", "pl-6"];
|
|
470
484
|
var indent = (depth) => INDENT[Math.min(depth, INDENT.length - 1)];
|
|
485
|
+
var OWN_LOCK_REASON = "This page's own chat never gets itself";
|
|
471
486
|
function ContextRulesTable({
|
|
472
487
|
rows,
|
|
473
488
|
cap,
|
|
@@ -731,16 +746,24 @@ function ContextRuleRow({
|
|
|
731
746
|
]
|
|
732
747
|
}
|
|
733
748
|
),
|
|
734
|
-
/* @__PURE__ */ jsx3("div", { role: "cell", className: cn3("flex justify-center", narrow && "order-last"), children: readOnly ? /* @__PURE__ */ jsx3(FrozenInclude, { name: row.label, checked: row.include }) :
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
749
|
+
/* @__PURE__ */ jsx3("div", { role: "cell", className: cn3("flex justify-center", narrow && "order-last"), children: readOnly ? /* @__PURE__ */ jsx3(FrozenInclude, { name: row.label, checked: row.include }) : (() => {
|
|
750
|
+
const locked = row.layers?.surface?.own === true;
|
|
751
|
+
const control = /* @__PURE__ */ jsx3(
|
|
752
|
+
Switch,
|
|
753
|
+
{
|
|
754
|
+
size: "sm",
|
|
755
|
+
"aria-label": `Include ${row.label}`,
|
|
756
|
+
checked: row.include,
|
|
757
|
+
disabled: locked,
|
|
758
|
+
onCheckedChange: (next) => onChange(row.key, row.surfaceKey, withInclude(row, next))
|
|
759
|
+
}
|
|
760
|
+
);
|
|
761
|
+
if (!locked) return control;
|
|
762
|
+
return /* @__PURE__ */ jsxs3(Tooltip3, { children: [
|
|
763
|
+
/* @__PURE__ */ jsx3(TooltipTrigger3, { asChild: true, children: /* @__PURE__ */ jsx3("span", { className: "inline-flex", children: control }) }),
|
|
764
|
+
/* @__PURE__ */ jsx3(TooltipContent3, { children: OWN_LOCK_REASON })
|
|
765
|
+
] });
|
|
766
|
+
})() }),
|
|
744
767
|
/* @__PURE__ */ jsxs3(
|
|
745
768
|
"div",
|
|
746
769
|
{
|
|
@@ -836,7 +859,7 @@ import {
|
|
|
836
859
|
} from "@ai-matrx/design-system";
|
|
837
860
|
import { EyeOffIcon, PanelRightIcon } from "@ai-matrx/design-system/icons";
|
|
838
861
|
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
839
|
-
var BLIND_TOOLTIP = "
|
|
862
|
+
var BLIND_TOOLTIP = "Not sent to this model";
|
|
840
863
|
var BLIND_LABEL = "Not read";
|
|
841
864
|
function IconButton({
|
|
842
865
|
label,
|
|
@@ -1012,7 +1035,7 @@ import { ChevronLeftIcon, SearchIcon } from "@ai-matrx/design-system/icons";
|
|
|
1012
1035
|
|
|
1013
1036
|
// context/react/ContextDeliveredValue.tsx
|
|
1014
1037
|
import * as React4 from "react";
|
|
1015
|
-
import {
|
|
1038
|
+
import { Skeleton, cn as cn5 } from "@ai-matrx/design-system";
|
|
1016
1039
|
import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1017
1040
|
function ContextDeliveredValue({
|
|
1018
1041
|
row,
|
|
@@ -1091,11 +1114,8 @@ function DeliveredSection({
|
|
|
1091
1114
|
});
|
|
1092
1115
|
},
|
|
1093
1116
|
(error) => {
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
state: "error",
|
|
1097
|
-
message: error instanceof Error && error.message ? error.message : "Couldn't load"
|
|
1098
|
-
});
|
|
1117
|
+
void error;
|
|
1118
|
+
if (live) setLoaded({ state: "error" });
|
|
1099
1119
|
}
|
|
1100
1120
|
);
|
|
1101
1121
|
return () => {
|
|
@@ -1123,18 +1143,21 @@ function DeliveredSection({
|
|
|
1123
1143
|
}
|
|
1124
1144
|
) : null
|
|
1125
1145
|
] }),
|
|
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" ?
|
|
1127
|
-
|
|
1128
|
-
/* @__PURE__ */
|
|
1129
|
-
"
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1146
|
+
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" ? (
|
|
1147
|
+
// Calm and one line: the server's words never reach the person (the host's loader files the error).
|
|
1148
|
+
/* @__PURE__ */ jsxs5("span", { "data-testid": "context-delivered-unavailable", className: "flex items-center gap-2 text-xs text-muted-foreground", children: [
|
|
1149
|
+
/* @__PURE__ */ jsx5("span", { className: "min-w-0 truncate", children: "Text not kept for this message" }),
|
|
1150
|
+
/* @__PURE__ */ jsx5(
|
|
1151
|
+
"button",
|
|
1152
|
+
{
|
|
1153
|
+
type: "button",
|
|
1154
|
+
onClick: () => setAttempt((n) => n + 1),
|
|
1155
|
+
className: "shrink-0 rounded px-1.5 py-0.5 text-foreground hover:bg-accent",
|
|
1156
|
+
children: "Try again"
|
|
1157
|
+
}
|
|
1158
|
+
)
|
|
1159
|
+
] })
|
|
1160
|
+
) : loaded.text === "" ? /* @__PURE__ */ jsx5("span", { "data-testid": "context-delivered-empty", className: "text-xs text-muted-foreground", children: "None" }) : /* @__PURE__ */ jsx5(
|
|
1138
1161
|
"pre",
|
|
1139
1162
|
{
|
|
1140
1163
|
"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.
|
|
3
|
+
"version": "0.59.264",
|
|
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": "
|
|
565
|
+
"gitHead": "aa81498da0e3d04438e28682980d2f32240b3f2a"
|
|
566
566
|
}
|