@ai-matrx/agents 0.38.3 → 0.40.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.
- package/CHANGELOG.md +27 -0
- package/dist/catalog/index.cjs +3 -1
- package/dist/catalog/index.cjs.map +1 -1
- package/dist/catalog/index.d.cts +2 -2
- package/dist/catalog/index.d.ts +2 -2
- package/dist/catalog/index.js +3 -1
- package/dist/catalog/index.js.map +1 -1
- package/dist/catalog/native/index.cjs +4 -1
- package/dist/catalog/native/index.cjs.map +1 -1
- package/dist/catalog/native/index.d.cts +8 -3
- package/dist/catalog/native/index.d.ts +8 -3
- package/dist/catalog/native/index.js +4 -1
- package/dist/catalog/native/index.js.map +1 -1
- package/dist/catalog/react/index.cjs +1 -0
- package/dist/catalog/react/index.cjs.map +1 -1
- package/dist/catalog/react/index.d.cts +13 -1
- package/dist/catalog/react/index.d.ts +13 -1
- package/dist/catalog/react/index.js +1 -0
- package/dist/catalog/react/index.js.map +1 -1
- package/dist/content-transfer/index.cjs.map +1 -1
- package/dist/content-transfer/index.js.map +1 -1
- package/dist/content-transfer/react/index.cjs.map +1 -1
- package/dist/content-transfer/react/index.js.map +1 -1
- package/dist/context/index.cjs +3 -23
- package/dist/context/index.cjs.map +1 -1
- package/dist/context/index.d.cts +10 -13
- package/dist/context/index.d.ts +10 -13
- package/dist/context/index.js +5 -23
- package/dist/context/index.js.map +1 -1
- package/dist/context/react/index.cjs +263 -97
- package/dist/context/react/index.cjs.map +1 -1
- package/dist/context/react/index.d.cts +140 -15
- package/dist/context/react/index.d.ts +140 -15
- package/dist/context/react/index.js +266 -100
- package/dist/context/react/index.js.map +1 -1
- package/dist/generated/api-types.cjs.map +1 -1
- package/dist/generated/api-types.d.cts +1 -1
- package/dist/generated/api-types.d.ts +1 -1
- package/dist/index.cjs +6 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -6
- package/dist/index.d.ts +9 -6
- package/dist/index.js +6 -3
- package/dist/index.js.map +1 -1
- package/dist/{keys.generated-BdQt09qH.d.cts → keys.generated-myjGAtI0.d.cts} +4 -4
- package/dist/{keys.generated-BdQt09qH.d.ts → keys.generated-myjGAtI0.d.ts} +4 -4
- package/dist/mandates/index.cjs +2 -2
- package/dist/mandates/index.cjs.map +1 -1
- package/dist/mandates/index.d.cts +2 -2
- package/dist/mandates/index.d.ts +2 -2
- package/dist/mandates/index.js +2 -2
- package/dist/mandates/index.js.map +1 -1
- package/dist/matrx/index.d.cts +1 -1
- package/dist/matrx/index.d.ts +1 -1
- package/dist/{orchestra-zpGHwOag.d.cts → orchestra-CiaTu58J.d.cts} +7 -0
- package/dist/{orchestra-zpGHwOag.d.ts → orchestra-CiaTu58J.d.ts} +7 -0
- package/generated/api-types.ts +1 -1
- package/mandates/snapshots/keys.0.38.4.json +653 -0
- package/mandates/snapshots/keys.0.39.0.json +653 -0
- package/mandates/snapshots/keys.0.40.0.json +653 -0
- package/package.json +4 -4
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
// context/react/ContextRulesTable.tsx
|
|
4
|
+
import * as React2 from "react";
|
|
4
5
|
import {
|
|
5
6
|
Switch,
|
|
6
7
|
Tooltip as Tooltip2,
|
|
@@ -11,6 +12,7 @@ import {
|
|
|
11
12
|
} from "@ai-matrx/design-system";
|
|
12
13
|
|
|
13
14
|
// context/index.ts
|
|
15
|
+
import { IDENTIFIER_ACRONYMS, humanizeIdentifier } from "@ai-matrx/kit/text-case";
|
|
14
16
|
var DEFAULT_INLINE_MAX_CHARS = 200;
|
|
15
17
|
var DEFAULT_INLINE_CAP = 5e4;
|
|
16
18
|
var CONTEXT_ROW_BLOCKS = {
|
|
@@ -96,24 +98,6 @@ function resolveContextRule(input) {
|
|
|
96
98
|
clamped
|
|
97
99
|
};
|
|
98
100
|
}
|
|
99
|
-
var CONTEXT_KEY_ACRONYMS = [
|
|
100
|
-
"ID",
|
|
101
|
-
"URL",
|
|
102
|
-
"PDF",
|
|
103
|
-
"HTML",
|
|
104
|
-
"JSON",
|
|
105
|
-
"API",
|
|
106
|
-
"AI",
|
|
107
|
-
"UI",
|
|
108
|
-
"CSV",
|
|
109
|
-
"SMS",
|
|
110
|
-
"SEO",
|
|
111
|
-
"LLM",
|
|
112
|
-
"MCP",
|
|
113
|
-
"UUID",
|
|
114
|
-
"ISO"
|
|
115
|
-
];
|
|
116
|
-
var ACRONYM_SET = new Set(CONTEXT_KEY_ACRONYMS.map((a) => a.toLowerCase()));
|
|
117
101
|
function formatChars(n) {
|
|
118
102
|
if (n === null || n === void 0 || !Number.isFinite(n)) return "\u2014";
|
|
119
103
|
const abs = Math.abs(n);
|
|
@@ -193,6 +177,79 @@ var ArrowDownToLineIcon = icon(
|
|
|
193
177
|
] })
|
|
194
178
|
);
|
|
195
179
|
|
|
180
|
+
// context/react/hierarchy.ts
|
|
181
|
+
var AI_MATRX_LEVEL = { id: "ai_matrx", path: ["AI Matrx"], order: 900 };
|
|
182
|
+
var ATTACHED_LEVEL = { id: "attached", path: ["Attached"], order: 500 };
|
|
183
|
+
var PAGE_LEVEL = { id: "page", path: ["Page"], order: 100 };
|
|
184
|
+
var ORIGIN_LEVEL = {
|
|
185
|
+
page: PAGE_LEVEL,
|
|
186
|
+
attached: ATTACHED_LEVEL,
|
|
187
|
+
system: AI_MATRX_LEVEL
|
|
188
|
+
};
|
|
189
|
+
function placeByOrigin(row) {
|
|
190
|
+
return { level: ORIGIN_LEVEL[row.origin] };
|
|
191
|
+
}
|
|
192
|
+
function stableSort(list, ref) {
|
|
193
|
+
return list.map((item, i) => ({ item, i })).sort((a, b) => (ref(a.item).order ?? 0) - (ref(b.item).order ?? 0) || a.i - b.i).map(({ item }) => item);
|
|
194
|
+
}
|
|
195
|
+
function buildContextLevels(rows, hierarchy) {
|
|
196
|
+
const place = hierarchy?.place ?? placeByOrigin;
|
|
197
|
+
const levels = /* @__PURE__ */ new Map();
|
|
198
|
+
const levelFor = (ref) => {
|
|
199
|
+
let node = levels.get(ref.id);
|
|
200
|
+
if (!node) {
|
|
201
|
+
node = { ref, rows: [], groups: [], master: null };
|
|
202
|
+
levels.set(ref.id, node);
|
|
203
|
+
}
|
|
204
|
+
return node;
|
|
205
|
+
};
|
|
206
|
+
for (const master of hierarchy?.masters ?? []) levelFor(master.level).master = master;
|
|
207
|
+
for (const row of rows) {
|
|
208
|
+
const where = place(row);
|
|
209
|
+
const level = levelFor(where.level);
|
|
210
|
+
if (!where.group) {
|
|
211
|
+
level.rows.push(row);
|
|
212
|
+
continue;
|
|
213
|
+
}
|
|
214
|
+
let group = level.groups.find((g) => g.ref.id === where.group.id);
|
|
215
|
+
if (!group) {
|
|
216
|
+
group = { ref: where.group, rows: [] };
|
|
217
|
+
level.groups.push(group);
|
|
218
|
+
}
|
|
219
|
+
group.rows.push(row);
|
|
220
|
+
}
|
|
221
|
+
const out = [...levels.values()];
|
|
222
|
+
for (const level of out) level.groups = stableSort(level.groups, (g) => g.ref);
|
|
223
|
+
return stableSort(out, (level) => level.ref);
|
|
224
|
+
}
|
|
225
|
+
function levelRows(level) {
|
|
226
|
+
return [...level.rows, ...level.groups.flatMap((g) => g.rows)];
|
|
227
|
+
}
|
|
228
|
+
function inheritedInclude(row, cap) {
|
|
229
|
+
return resolveContextRule({
|
|
230
|
+
...row.layers ?? {},
|
|
231
|
+
chars: row.chars,
|
|
232
|
+
cap,
|
|
233
|
+
user: null,
|
|
234
|
+
identity: isServerAuthoritativeKey(row.key)
|
|
235
|
+
}).include;
|
|
236
|
+
}
|
|
237
|
+
function includeChanges(rows, include, cap) {
|
|
238
|
+
const changes = [];
|
|
239
|
+
for (const row of rows) {
|
|
240
|
+
if (row.include === include) continue;
|
|
241
|
+
const next = { ...row.userRule ?? {} };
|
|
242
|
+
if (inheritedInclude(row, cap) === include) delete next.include;
|
|
243
|
+
else next.include = include;
|
|
244
|
+
changes.push({
|
|
245
|
+
key: row.key,
|
|
246
|
+
surfaceKey: row.surfaceKey,
|
|
247
|
+
rule: Object.keys(next).length === 0 ? null : next
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
return changes;
|
|
251
|
+
}
|
|
252
|
+
|
|
196
253
|
// context/react/InlineMaxInput.tsx
|
|
197
254
|
import * as React from "react";
|
|
198
255
|
import {
|
|
@@ -380,13 +437,24 @@ function InlineMaxInput({
|
|
|
380
437
|
] });
|
|
381
438
|
}
|
|
382
439
|
|
|
440
|
+
// context/react/summary.ts
|
|
441
|
+
function summarizeContextRows(rows) {
|
|
442
|
+
let count = 0;
|
|
443
|
+
let chars = 0;
|
|
444
|
+
let known = 0;
|
|
445
|
+
for (const r of rows) {
|
|
446
|
+
if (!r.include) continue;
|
|
447
|
+
count += 1;
|
|
448
|
+
if (r.chars === null || r.chars === void 0) continue;
|
|
449
|
+
chars += r.chars;
|
|
450
|
+
known += 1;
|
|
451
|
+
}
|
|
452
|
+
const charsLabel = count > 0 && known === 0 ? "\u2014" : known < count ? `${formatChars(chars)}+` : formatChars(chars);
|
|
453
|
+
return { count, chars, charsLabel };
|
|
454
|
+
}
|
|
455
|
+
|
|
383
456
|
// context/react/ContextRulesTable.tsx
|
|
384
457
|
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
385
|
-
var GROUPS = [
|
|
386
|
-
{ origin: "page", label: "Page" },
|
|
387
|
-
{ origin: "attached", label: "Attached" },
|
|
388
|
-
{ origin: "system", label: "System" }
|
|
389
|
-
];
|
|
390
458
|
var CONTEXT_RULES_GRID = {
|
|
391
459
|
compact: "grid grid-cols-[minmax(0,1fr)_2.75rem_4rem_6.5rem] items-center gap-x-2 px-2",
|
|
392
460
|
// Phone widths (375px): the fixed columns stay compact so Item always keeps
|
|
@@ -402,11 +470,33 @@ function ContextRulesTable({
|
|
|
402
470
|
onOpenRow,
|
|
403
471
|
density = "compact",
|
|
404
472
|
selectedKey,
|
|
473
|
+
hierarchy,
|
|
474
|
+
onSetInclude,
|
|
405
475
|
className
|
|
406
476
|
}) {
|
|
407
477
|
const comfortable = density === "comfortable";
|
|
408
|
-
const
|
|
409
|
-
const
|
|
478
|
+
const levels = buildContextLevels(rows, hierarchy);
|
|
479
|
+
const headed = Boolean(hierarchy) || levels.length > 1;
|
|
480
|
+
const renderRow = (row, depth) => /* @__PURE__ */ jsx3(
|
|
481
|
+
ContextRuleRow,
|
|
482
|
+
{
|
|
483
|
+
row,
|
|
484
|
+
cap,
|
|
485
|
+
density,
|
|
486
|
+
depth: headed ? depth : 0,
|
|
487
|
+
readOnly,
|
|
488
|
+
selected: selectedKey === row.key,
|
|
489
|
+
mismatches: mismatches?.filter((m) => m.key === row.key) ?? [],
|
|
490
|
+
onChange,
|
|
491
|
+
onOpenRow,
|
|
492
|
+
comfortable
|
|
493
|
+
},
|
|
494
|
+
rowId(row)
|
|
495
|
+
);
|
|
496
|
+
const bulk = (list) => onSetInclude && !readOnly ? (next) => {
|
|
497
|
+
const changes = includeChanges(list, next, cap);
|
|
498
|
+
if (changes.length > 0) onSetInclude(changes);
|
|
499
|
+
} : void 0;
|
|
410
500
|
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
501
|
/* @__PURE__ */ jsxs3(
|
|
412
502
|
"div",
|
|
@@ -424,37 +514,98 @@ function ContextRulesTable({
|
|
|
424
514
|
]
|
|
425
515
|
}
|
|
426
516
|
),
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
517
|
+
levels.length === 0 ? /* @__PURE__ */ jsx3("div", { className: "px-2 py-3 text-center text-muted-foreground", children: "None" }) : levels.map((level) => {
|
|
518
|
+
const all = levelRows(level);
|
|
519
|
+
const name = level.ref.path.join(" \u203A ");
|
|
520
|
+
return /* @__PURE__ */ jsxs3("div", { role: "rowgroup", "aria-label": headed ? name : void 0, "data-level": level.ref.id, children: [
|
|
521
|
+
headed ? /* @__PURE__ */ jsx3(
|
|
522
|
+
LevelHeading,
|
|
523
|
+
{
|
|
524
|
+
kind: "level",
|
|
525
|
+
path: level.ref.path,
|
|
526
|
+
rows: all,
|
|
527
|
+
density,
|
|
528
|
+
readOnly,
|
|
529
|
+
...levelSwitch(level, bulk(all))
|
|
530
|
+
}
|
|
531
|
+
) : null,
|
|
532
|
+
level.rows.map((row) => renderRow(row, 1)),
|
|
533
|
+
level.groups.map((group) => /* @__PURE__ */ jsxs3("div", { role: "rowgroup", "aria-label": group.ref.label, "data-group": group.ref.id, children: [
|
|
534
|
+
/* @__PURE__ */ jsx3(
|
|
535
|
+
LevelHeading,
|
|
536
|
+
{
|
|
537
|
+
kind: "group",
|
|
538
|
+
path: [group.ref.label],
|
|
539
|
+
rows: group.rows,
|
|
540
|
+
density,
|
|
541
|
+
readOnly,
|
|
542
|
+
onToggle: bulk(group.rows),
|
|
543
|
+
checked: group.rows.some((r) => r.include)
|
|
544
|
+
}
|
|
545
|
+
),
|
|
546
|
+
group.rows.map((row) => renderRow(row, 2))
|
|
547
|
+
] }, group.ref.id))
|
|
548
|
+
] }, level.ref.id);
|
|
549
|
+
})
|
|
452
550
|
] }) });
|
|
453
551
|
}
|
|
552
|
+
function levelSwitch(level, bulk) {
|
|
553
|
+
if (level.master) return { checked: level.master.on, onToggle: level.master.onToggle };
|
|
554
|
+
return { checked: levelRows(level).some((r) => r.include), onToggle: bulk };
|
|
555
|
+
}
|
|
556
|
+
function LevelHeading({
|
|
557
|
+
kind,
|
|
558
|
+
path,
|
|
559
|
+
rows,
|
|
560
|
+
density,
|
|
561
|
+
readOnly,
|
|
562
|
+
checked,
|
|
563
|
+
onToggle
|
|
564
|
+
}) {
|
|
565
|
+
const name = path.join(" \u203A ");
|
|
566
|
+
const { count, charsLabel } = summarizeContextRows(rows);
|
|
567
|
+
const total = rows.length;
|
|
568
|
+
const showSwitch = Boolean(onToggle) || readOnly && total > 0;
|
|
569
|
+
return /* @__PURE__ */ jsxs3(
|
|
570
|
+
"div",
|
|
571
|
+
{
|
|
572
|
+
role: "row",
|
|
573
|
+
"data-heading": kind,
|
|
574
|
+
className: cn2(
|
|
575
|
+
CONTEXT_RULES_GRID[density],
|
|
576
|
+
"border-b border-border/50 font-medium",
|
|
577
|
+
density === "comfortable" ? "min-h-11" : "h-7",
|
|
578
|
+
kind === "level" ? "bg-muted/60 text-foreground" : "bg-muted/25 text-muted-foreground"
|
|
579
|
+
),
|
|
580
|
+
children: [
|
|
581
|
+
/* @__PURE__ */ jsxs3("div", { role: "cell", className: cn2("flex min-w-0 items-center gap-1", kind === "group" && "pl-2"), children: [
|
|
582
|
+
/* @__PURE__ */ jsx3("span", { className: "flex min-w-0 items-center gap-1 truncate", title: name, children: path.map((part, i) => /* @__PURE__ */ jsxs3(React2.Fragment, { children: [
|
|
583
|
+
i > 0 ? /* @__PURE__ */ jsx3("span", { className: "shrink-0 text-muted-foreground", children: "\u203A" }) : null,
|
|
584
|
+
/* @__PURE__ */ jsx3("span", { className: cn2("truncate", i < path.length - 1 && "text-muted-foreground"), children: part })
|
|
585
|
+
] }, `${i}:${part}`)) }),
|
|
586
|
+
total > 0 ? /* @__PURE__ */ jsx3("span", { className: "shrink-0 font-normal tabular-nums text-muted-foreground", children: count === total ? total : `${count}/${total}` }) : null
|
|
587
|
+
] }),
|
|
588
|
+
/* @__PURE__ */ jsx3("div", { role: "cell", className: "flex justify-center", children: showSwitch ? /* @__PURE__ */ jsx3(
|
|
589
|
+
Switch,
|
|
590
|
+
{
|
|
591
|
+
size: "sm",
|
|
592
|
+
"aria-label": `Include ${name}`,
|
|
593
|
+
checked,
|
|
594
|
+
disabled: readOnly || !onToggle,
|
|
595
|
+
onCheckedChange: (next) => onToggle?.(next)
|
|
596
|
+
}
|
|
597
|
+
) : null }),
|
|
598
|
+
/* @__PURE__ */ jsx3("div", { role: "cell", className: "text-right font-normal tabular-nums text-muted-foreground", children: total > 0 ? charsLabel : null }),
|
|
599
|
+
/* @__PURE__ */ jsx3("div", { role: "cell" })
|
|
600
|
+
]
|
|
601
|
+
}
|
|
602
|
+
);
|
|
603
|
+
}
|
|
454
604
|
function ContextRuleRow({
|
|
455
605
|
row,
|
|
456
606
|
cap,
|
|
457
607
|
density,
|
|
608
|
+
depth,
|
|
458
609
|
comfortable,
|
|
459
610
|
readOnly,
|
|
460
611
|
selected,
|
|
@@ -490,27 +641,39 @@ function ContextRuleRow({
|
|
|
490
641
|
selected && "bg-accent"
|
|
491
642
|
),
|
|
492
643
|
children: [
|
|
493
|
-
/* @__PURE__ */ jsxs3(
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
644
|
+
/* @__PURE__ */ jsxs3(
|
|
645
|
+
"div",
|
|
646
|
+
{
|
|
647
|
+
role: "cell",
|
|
648
|
+
className: cn2(
|
|
649
|
+
"flex min-w-0 items-center gap-1.5",
|
|
650
|
+
depth === 1 && "pl-2",
|
|
651
|
+
depth === 2 && "pl-4",
|
|
652
|
+
!row.include && "opacity-50"
|
|
653
|
+
),
|
|
654
|
+
children: [
|
|
655
|
+
mismatches.length > 0 ? /* @__PURE__ */ jsxs3(Tooltip2, { children: [
|
|
656
|
+
/* @__PURE__ */ jsx3(TooltipTrigger2, { asChild: true, children: /* @__PURE__ */ jsx3(
|
|
657
|
+
"span",
|
|
658
|
+
{
|
|
659
|
+
role: "img",
|
|
660
|
+
"aria-label": "Mismatch",
|
|
661
|
+
className: "inline-flex shrink-0 text-warning",
|
|
662
|
+
children: /* @__PURE__ */ jsx3(TriangleAlertIcon, { className: "h-3.5 w-3.5" })
|
|
663
|
+
}
|
|
664
|
+
) }),
|
|
665
|
+
/* @__PURE__ */ jsx3(TooltipContent2, { children: describeMismatches(mismatches) })
|
|
666
|
+
] }) : null,
|
|
667
|
+
/* @__PURE__ */ jsxs3(Tooltip2, { children: [
|
|
668
|
+
/* @__PURE__ */ jsx3(TooltipTrigger2, { asChild: true, children: labelNode }),
|
|
669
|
+
/* @__PURE__ */ jsxs3(TooltipContent2, { children: [
|
|
670
|
+
/* @__PURE__ */ jsx3("div", { children: row.label }),
|
|
671
|
+
/* @__PURE__ */ jsx3("div", { className: "font-normal text-muted-foreground", children: decided })
|
|
672
|
+
] })
|
|
673
|
+
] })
|
|
674
|
+
]
|
|
675
|
+
}
|
|
676
|
+
),
|
|
514
677
|
/* @__PURE__ */ jsx3("div", { role: "cell", className: "flex justify-center", children: /* @__PURE__ */ jsx3(
|
|
515
678
|
Switch,
|
|
516
679
|
{
|
|
@@ -554,7 +717,7 @@ function ContextRuleRow({
|
|
|
554
717
|
}
|
|
555
718
|
|
|
556
719
|
// context/react/ContextRulesChip.tsx
|
|
557
|
-
import * as
|
|
720
|
+
import * as React3 from "react";
|
|
558
721
|
import {
|
|
559
722
|
BottomSheet,
|
|
560
723
|
Popover,
|
|
@@ -570,20 +733,6 @@ import {
|
|
|
570
733
|
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
571
734
|
var BLIND_TOOLTIP = "This model can't read these values";
|
|
572
735
|
var BLIND_LABEL = "Not read";
|
|
573
|
-
function summarizeContextRows(rows) {
|
|
574
|
-
let count = 0;
|
|
575
|
-
let chars = 0;
|
|
576
|
-
let known = 0;
|
|
577
|
-
for (const r of rows) {
|
|
578
|
-
if (!r.include) continue;
|
|
579
|
-
count += 1;
|
|
580
|
-
if (r.chars === null || r.chars === void 0) continue;
|
|
581
|
-
chars += r.chars;
|
|
582
|
-
known += 1;
|
|
583
|
-
}
|
|
584
|
-
const charsLabel = count > 0 && known === 0 ? "\u2014" : known < count ? `${formatChars(chars)}+` : formatChars(chars);
|
|
585
|
-
return { count, chars, charsLabel };
|
|
586
|
-
}
|
|
587
736
|
function IconButton({
|
|
588
737
|
label,
|
|
589
738
|
onClick,
|
|
@@ -613,6 +762,8 @@ function ContextRulesChip({
|
|
|
613
762
|
cap,
|
|
614
763
|
on,
|
|
615
764
|
onToggleAll,
|
|
765
|
+
hierarchy,
|
|
766
|
+
onSetInclude,
|
|
616
767
|
onChange,
|
|
617
768
|
onResetAll,
|
|
618
769
|
onOpenFullView,
|
|
@@ -626,7 +777,7 @@ function ContextRulesChip({
|
|
|
626
777
|
onOpenChange,
|
|
627
778
|
className
|
|
628
779
|
}) {
|
|
629
|
-
const [openState, setOpenState] =
|
|
780
|
+
const [openState, setOpenState] = React3.useState(false);
|
|
630
781
|
const open = openProp ?? openState;
|
|
631
782
|
const setOpen = (next) => {
|
|
632
783
|
if (openProp === void 0) setOpenState(next);
|
|
@@ -639,7 +790,8 @@ function ContextRulesChip({
|
|
|
639
790
|
const blind = !modelReadsContext;
|
|
640
791
|
const warn = mismatchCount > 0 && !blind;
|
|
641
792
|
const comfortable = !!isMobile;
|
|
642
|
-
const hasPage = on !== void 0;
|
|
793
|
+
const hasPage = on !== void 0 && !hierarchy;
|
|
794
|
+
const headerName = hierarchy ? "" : name;
|
|
643
795
|
const eyeOpen = !blind && on !== false;
|
|
644
796
|
const faceButton = /* @__PURE__ */ jsxs4(
|
|
645
797
|
"button",
|
|
@@ -683,7 +835,7 @@ function ContextRulesChip({
|
|
|
683
835
|
),
|
|
684
836
|
children: [
|
|
685
837
|
eyeOpen ? /* @__PURE__ */ jsx4(EyeIcon, { className: "h-4 w-4 shrink-0 text-muted-foreground" }) : /* @__PURE__ */ jsx4(EyeOffIcon, { className: "h-4 w-4 shrink-0 text-muted-foreground" }),
|
|
686
|
-
|
|
838
|
+
headerName ? /* @__PURE__ */ jsx4("span", { className: "min-w-0 truncate text-sm font-medium", children: headerName }) : null,
|
|
687
839
|
/* @__PURE__ */ jsx4("span", { className: "shrink-0 text-xs tabular-nums text-muted-foreground", children: `${count} \xB7 ${charsLabel} chars` }),
|
|
688
840
|
/* @__PURE__ */ jsxs4("div", { className: "ml-auto flex shrink-0 items-center gap-0.5", children: [
|
|
689
841
|
blind ? /* @__PURE__ */ jsx4("span", { className: "mr-1 text-xs text-muted-foreground", children: BLIND_LABEL }) : null,
|
|
@@ -723,6 +875,8 @@ function ContextRulesChip({
|
|
|
723
875
|
readOnly,
|
|
724
876
|
density: comfortable ? "comfortable" : "compact",
|
|
725
877
|
onChange,
|
|
878
|
+
hierarchy,
|
|
879
|
+
onSetInclude,
|
|
726
880
|
...mismatches ? { mismatches } : {},
|
|
727
881
|
...onOpenRow ? { onOpenRow } : {}
|
|
728
882
|
}
|
|
@@ -748,7 +902,7 @@ function ContextRulesChip({
|
|
|
748
902
|
}
|
|
749
903
|
|
|
750
904
|
// context/react/ContextRulesPanelBody.tsx
|
|
751
|
-
import * as
|
|
905
|
+
import * as React5 from "react";
|
|
752
906
|
import {
|
|
753
907
|
Input as Input2,
|
|
754
908
|
Switch as Switch3,
|
|
@@ -757,7 +911,7 @@ import {
|
|
|
757
911
|
} from "@ai-matrx/design-system";
|
|
758
912
|
|
|
759
913
|
// context/react/ContextDeliveredValue.tsx
|
|
760
|
-
import * as
|
|
914
|
+
import * as React4 from "react";
|
|
761
915
|
import { ErrorBox, Skeleton, cn as cn4 } from "@ai-matrx/design-system";
|
|
762
916
|
import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
763
917
|
function ContextDeliveredValue({
|
|
@@ -818,10 +972,10 @@ function DeliveredSection({
|
|
|
818
972
|
ref_,
|
|
819
973
|
load
|
|
820
974
|
}) {
|
|
821
|
-
const [loaded, setLoaded] =
|
|
822
|
-
const [attempt, setAttempt] =
|
|
975
|
+
const [loaded, setLoaded] = React4.useState({ state: "loading" });
|
|
976
|
+
const [attempt, setAttempt] = React4.useState(0);
|
|
823
977
|
const { kind, key } = target;
|
|
824
|
-
|
|
978
|
+
React4.useEffect(() => {
|
|
825
979
|
if (!load) return;
|
|
826
980
|
let live = true;
|
|
827
981
|
setLoaded({ state: "loading" });
|
|
@@ -970,7 +1124,7 @@ function ContextReceiptBlockDetail({
|
|
|
970
1124
|
}
|
|
971
1125
|
|
|
972
1126
|
// context/react/ContextRulesPanelBody.tsx
|
|
973
|
-
import { Fragment as
|
|
1127
|
+
import { Fragment as Fragment3, jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
974
1128
|
function layerCells(row) {
|
|
975
1129
|
const { surface, agent, default_max } = row.layers ?? {};
|
|
976
1130
|
const declared = agent?.declared === true;
|
|
@@ -1092,15 +1246,17 @@ function ContextRulesPanelBody({
|
|
|
1092
1246
|
loadView,
|
|
1093
1247
|
readOnly,
|
|
1094
1248
|
onChange,
|
|
1249
|
+
hierarchy,
|
|
1250
|
+
onSetInclude,
|
|
1095
1251
|
renderDetail,
|
|
1096
1252
|
isMobile,
|
|
1097
1253
|
selectedKey: selectedProp,
|
|
1098
1254
|
onSelectedKeyChange,
|
|
1099
1255
|
className
|
|
1100
1256
|
}) {
|
|
1101
|
-
const [selectedState, setSelectedState] =
|
|
1102
|
-
const [query, setQuery] =
|
|
1103
|
-
const [openBlockId, setOpenBlockId] =
|
|
1257
|
+
const [selectedState, setSelectedState] = React5.useState(null);
|
|
1258
|
+
const [query, setQuery] = React5.useState("");
|
|
1259
|
+
const [openBlockId, setOpenBlockId] = React5.useState(null);
|
|
1104
1260
|
const selectedKey = selectedProp !== void 0 ? selectedProp : selectedState;
|
|
1105
1261
|
const select = (key) => {
|
|
1106
1262
|
setOpenBlockId(null);
|
|
@@ -1145,6 +1301,8 @@ function ContextRulesPanelBody({
|
|
|
1145
1301
|
density: comfortable ? "comfortable" : "compact",
|
|
1146
1302
|
selectedKey,
|
|
1147
1303
|
onChange,
|
|
1304
|
+
hierarchy,
|
|
1305
|
+
onSetInclude,
|
|
1148
1306
|
onOpenRow: (key) => select(key),
|
|
1149
1307
|
...mismatches ? { mismatches } : {}
|
|
1150
1308
|
}
|
|
@@ -1173,7 +1331,7 @@ function ContextRulesPanelBody({
|
|
|
1173
1331
|
}
|
|
1174
1332
|
) : null;
|
|
1175
1333
|
if (isMobile) {
|
|
1176
|
-
return /* @__PURE__ */ jsx7(TooltipProvider3, { delayDuration: 300, titleTooltips: false, children: /* @__PURE__ */ jsx7("div", { className: cn6("flex h-full min-h-0 flex-col", className), children: detail ? /* @__PURE__ */ jsxs7(
|
|
1334
|
+
return /* @__PURE__ */ jsx7(TooltipProvider3, { delayDuration: 300, titleTooltips: false, children: /* @__PURE__ */ jsx7("div", { className: cn6("flex h-full min-h-0 flex-col", className), children: detail ? /* @__PURE__ */ jsxs7(Fragment3, { children: [
|
|
1177
1335
|
/* @__PURE__ */ jsx7("div", { className: "flex h-12 shrink-0 items-center border-b border-border px-1", children: /* @__PURE__ */ jsxs7(
|
|
1178
1336
|
"button",
|
|
1179
1337
|
{
|
|
@@ -1187,7 +1345,7 @@ function ContextRulesPanelBody({
|
|
|
1187
1345
|
}
|
|
1188
1346
|
) }),
|
|
1189
1347
|
/* @__PURE__ */ jsx7("div", { className: "min-h-0 flex-1 overflow-y-auto", children: detail })
|
|
1190
|
-
] }) : /* @__PURE__ */ jsxs7(
|
|
1348
|
+
] }) : /* @__PURE__ */ jsxs7(Fragment3, { children: [
|
|
1191
1349
|
search,
|
|
1192
1350
|
table
|
|
1193
1351
|
] }) }) });
|
|
@@ -1201,6 +1359,8 @@ function ContextRulesPanelBody({
|
|
|
1201
1359
|
] }) });
|
|
1202
1360
|
}
|
|
1203
1361
|
export {
|
|
1362
|
+
AI_MATRX_LEVEL,
|
|
1363
|
+
ATTACHED_LEVEL,
|
|
1204
1364
|
ContextDeliveredValue,
|
|
1205
1365
|
ContextReceiptBlockDetail,
|
|
1206
1366
|
ContextReceiptBlocks,
|
|
@@ -1209,6 +1369,12 @@ export {
|
|
|
1209
1369
|
ContextRulesTable,
|
|
1210
1370
|
DeliveredSection,
|
|
1211
1371
|
InlineMaxInput,
|
|
1372
|
+
PAGE_LEVEL,
|
|
1373
|
+
buildContextLevels,
|
|
1374
|
+
includeChanges,
|
|
1375
|
+
inheritedInclude,
|
|
1376
|
+
levelRows,
|
|
1377
|
+
placeByOrigin,
|
|
1212
1378
|
summarizeContextRows
|
|
1213
1379
|
};
|
|
1214
1380
|
//# sourceMappingURL=index.js.map
|