@ai-matrx/agents 0.38.4 → 0.41.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 +29 -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 +0 -25
- package/dist/context/index.cjs.map +1 -1
- package/dist/context/index.d.cts +2 -17
- package/dist/context/index.d.ts +2 -17
- package/dist/context/index.js +0 -25
- package/dist/context/index.js.map +1 -1
- package/dist/context/react/index.cjs +280 -98
- package/dist/context/react/index.cjs.map +1 -1
- package/dist/context/react/index.d.cts +134 -16
- package/dist/context/react/index.d.ts +134 -16
- package/dist/context/react/index.js +283 -101
- package/dist/context/react/index.js.map +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-DxG5tgWt.d.cts → keys.generated-ClN6zfUo.d.cts} +4 -4
- package/dist/{keys.generated-DxG5tgWt.d.ts → keys.generated-ClN6zfUo.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/mandates/snapshots/keys.0.39.0.json +653 -0
- package/mandates/snapshots/keys.0.40.0.json +653 -0
- package/mandates/snapshots/keys.0.41.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,
|
|
@@ -96,24 +97,6 @@ function resolveContextRule(input) {
|
|
|
96
97
|
clamped
|
|
97
98
|
};
|
|
98
99
|
}
|
|
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
100
|
function formatChars(n) {
|
|
118
101
|
if (n === null || n === void 0 || !Number.isFinite(n)) return "\u2014";
|
|
119
102
|
const abs = Math.abs(n);
|
|
@@ -193,6 +176,79 @@ var ArrowDownToLineIcon = icon(
|
|
|
193
176
|
] })
|
|
194
177
|
);
|
|
195
178
|
|
|
179
|
+
// context/react/hierarchy.ts
|
|
180
|
+
var AI_MATRX_LEVEL = { id: "ai_matrx", path: ["AI Matrx"], order: 900 };
|
|
181
|
+
var ATTACHED_LEVEL = { id: "attached", path: ["Attached"], order: 500 };
|
|
182
|
+
var PAGE_LEVEL = { id: "page", path: ["Page"], order: 100 };
|
|
183
|
+
var ORIGIN_LEVEL = {
|
|
184
|
+
page: PAGE_LEVEL,
|
|
185
|
+
attached: ATTACHED_LEVEL,
|
|
186
|
+
system: AI_MATRX_LEVEL
|
|
187
|
+
};
|
|
188
|
+
function placeByOrigin(row) {
|
|
189
|
+
return { level: ORIGIN_LEVEL[row.origin] };
|
|
190
|
+
}
|
|
191
|
+
function stableSort(list, ref) {
|
|
192
|
+
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);
|
|
193
|
+
}
|
|
194
|
+
function buildContextLevels(rows, hierarchy) {
|
|
195
|
+
const place = hierarchy?.place ?? placeByOrigin;
|
|
196
|
+
const levels = /* @__PURE__ */ new Map();
|
|
197
|
+
const levelFor = (ref) => {
|
|
198
|
+
let node = levels.get(ref.id);
|
|
199
|
+
if (!node) {
|
|
200
|
+
node = { ref, rows: [], groups: [], master: null };
|
|
201
|
+
levels.set(ref.id, node);
|
|
202
|
+
}
|
|
203
|
+
return node;
|
|
204
|
+
};
|
|
205
|
+
for (const master of hierarchy?.masters ?? []) levelFor(master.level).master = master;
|
|
206
|
+
for (const row of rows) {
|
|
207
|
+
const where = place(row);
|
|
208
|
+
const level = levelFor(where.level);
|
|
209
|
+
if (!where.group) {
|
|
210
|
+
level.rows.push(row);
|
|
211
|
+
continue;
|
|
212
|
+
}
|
|
213
|
+
let group = level.groups.find((g) => g.ref.id === where.group.id);
|
|
214
|
+
if (!group) {
|
|
215
|
+
group = { ref: where.group, rows: [] };
|
|
216
|
+
level.groups.push(group);
|
|
217
|
+
}
|
|
218
|
+
group.rows.push(row);
|
|
219
|
+
}
|
|
220
|
+
const out = [...levels.values()];
|
|
221
|
+
for (const level of out) level.groups = stableSort(level.groups, (g) => g.ref);
|
|
222
|
+
return stableSort(out, (level) => level.ref);
|
|
223
|
+
}
|
|
224
|
+
function levelRows(level) {
|
|
225
|
+
return [...level.rows, ...level.groups.flatMap((g) => g.rows)];
|
|
226
|
+
}
|
|
227
|
+
function inheritedInclude(row, cap) {
|
|
228
|
+
return resolveContextRule({
|
|
229
|
+
...row.layers ?? {},
|
|
230
|
+
chars: row.chars,
|
|
231
|
+
cap,
|
|
232
|
+
user: null,
|
|
233
|
+
identity: isServerAuthoritativeKey(row.key)
|
|
234
|
+
}).include;
|
|
235
|
+
}
|
|
236
|
+
function includeChanges(rows, include, cap) {
|
|
237
|
+
const changes = [];
|
|
238
|
+
for (const row of rows) {
|
|
239
|
+
if (row.include === include) continue;
|
|
240
|
+
const next = { ...row.userRule ?? {} };
|
|
241
|
+
if (inheritedInclude(row, cap) === include) delete next.include;
|
|
242
|
+
else next.include = include;
|
|
243
|
+
changes.push({
|
|
244
|
+
key: row.key,
|
|
245
|
+
surfaceKey: row.surfaceKey,
|
|
246
|
+
rule: Object.keys(next).length === 0 ? null : next
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
return changes;
|
|
250
|
+
}
|
|
251
|
+
|
|
196
252
|
// context/react/InlineMaxInput.tsx
|
|
197
253
|
import * as React from "react";
|
|
198
254
|
import {
|
|
@@ -380,13 +436,24 @@ function InlineMaxInput({
|
|
|
380
436
|
] });
|
|
381
437
|
}
|
|
382
438
|
|
|
439
|
+
// context/react/summary.ts
|
|
440
|
+
function summarizeContextRows(rows) {
|
|
441
|
+
let count = 0;
|
|
442
|
+
let chars = 0;
|
|
443
|
+
let known = 0;
|
|
444
|
+
for (const r of rows) {
|
|
445
|
+
if (!r.include) continue;
|
|
446
|
+
count += 1;
|
|
447
|
+
if (r.chars === null || r.chars === void 0) continue;
|
|
448
|
+
chars += r.chars;
|
|
449
|
+
known += 1;
|
|
450
|
+
}
|
|
451
|
+
const charsLabel = count > 0 && known === 0 ? "\u2014" : known < count ? `${formatChars(chars)}+` : formatChars(chars);
|
|
452
|
+
return { count, chars, charsLabel };
|
|
453
|
+
}
|
|
454
|
+
|
|
383
455
|
// context/react/ContextRulesTable.tsx
|
|
384
456
|
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
457
|
var CONTEXT_RULES_GRID = {
|
|
391
458
|
compact: "grid grid-cols-[minmax(0,1fr)_2.75rem_4rem_6.5rem] items-center gap-x-2 px-2",
|
|
392
459
|
// Phone widths (375px): the fixed columns stay compact so Item always keeps
|
|
@@ -402,11 +469,37 @@ function ContextRulesTable({
|
|
|
402
469
|
onOpenRow,
|
|
403
470
|
density = "compact",
|
|
404
471
|
selectedKey,
|
|
472
|
+
hierarchy,
|
|
473
|
+
onSetInclude,
|
|
474
|
+
renderRowLead,
|
|
475
|
+
renderRowTrail,
|
|
405
476
|
className
|
|
406
477
|
}) {
|
|
407
478
|
const comfortable = density === "comfortable";
|
|
408
|
-
const
|
|
409
|
-
const
|
|
479
|
+
const levels = buildContextLevels(rows, hierarchy);
|
|
480
|
+
const headed = Boolean(hierarchy) || levels.length > 1;
|
|
481
|
+
const renderRow = (row, depth) => /* @__PURE__ */ jsx3(
|
|
482
|
+
ContextRuleRow,
|
|
483
|
+
{
|
|
484
|
+
row,
|
|
485
|
+
cap,
|
|
486
|
+
density,
|
|
487
|
+
depth: headed ? depth : 0,
|
|
488
|
+
readOnly,
|
|
489
|
+
selected: selectedKey === row.key,
|
|
490
|
+
mismatches: mismatches?.filter((m) => m.key === row.key) ?? [],
|
|
491
|
+
onChange,
|
|
492
|
+
onOpenRow,
|
|
493
|
+
comfortable,
|
|
494
|
+
lead: renderRowLead?.(row),
|
|
495
|
+
trail: renderRowTrail?.(row)
|
|
496
|
+
},
|
|
497
|
+
rowId(row)
|
|
498
|
+
);
|
|
499
|
+
const bulk = (list) => onSetInclude && !readOnly ? (next) => {
|
|
500
|
+
const changes = includeChanges(list, next, cap);
|
|
501
|
+
if (changes.length > 0) onSetInclude(changes);
|
|
502
|
+
} : void 0;
|
|
410
503
|
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
504
|
/* @__PURE__ */ jsxs3(
|
|
412
505
|
"div",
|
|
@@ -424,43 +517,115 @@ function ContextRulesTable({
|
|
|
424
517
|
]
|
|
425
518
|
}
|
|
426
519
|
),
|
|
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
|
-
|
|
520
|
+
levels.length === 0 ? /* @__PURE__ */ jsx3("div", { className: "px-2 py-3 text-center text-muted-foreground", children: "None" }) : levels.map((level) => {
|
|
521
|
+
const all = levelRows(level);
|
|
522
|
+
const name = level.ref.path.join(" \u203A ");
|
|
523
|
+
return /* @__PURE__ */ jsxs3("div", { role: "rowgroup", "aria-label": headed ? name : void 0, "data-level": level.ref.id, children: [
|
|
524
|
+
headed ? /* @__PURE__ */ jsx3(
|
|
525
|
+
LevelHeading,
|
|
526
|
+
{
|
|
527
|
+
kind: "level",
|
|
528
|
+
path: level.ref.path,
|
|
529
|
+
rows: all,
|
|
530
|
+
density,
|
|
531
|
+
readOnly,
|
|
532
|
+
...levelSwitch(level, bulk(all))
|
|
533
|
+
}
|
|
534
|
+
) : null,
|
|
535
|
+
level.rows.map((row) => renderRow(row, 1)),
|
|
536
|
+
level.groups.map((group) => /* @__PURE__ */ jsxs3("div", { role: "rowgroup", "aria-label": group.ref.label, "data-group": group.ref.id, children: [
|
|
537
|
+
/* @__PURE__ */ jsx3(
|
|
538
|
+
LevelHeading,
|
|
539
|
+
{
|
|
540
|
+
kind: "group",
|
|
541
|
+
path: [group.ref.label],
|
|
542
|
+
rows: group.rows,
|
|
543
|
+
density,
|
|
544
|
+
readOnly,
|
|
545
|
+
onToggle: bulk(group.rows),
|
|
546
|
+
checked: group.rows.some((r) => r.include)
|
|
547
|
+
}
|
|
548
|
+
),
|
|
549
|
+
group.rows.map((row) => renderRow(row, 2))
|
|
550
|
+
] }, group.ref.id))
|
|
551
|
+
] }, level.ref.id);
|
|
552
|
+
})
|
|
452
553
|
] }) });
|
|
453
554
|
}
|
|
555
|
+
function levelSwitch(level, bulk) {
|
|
556
|
+
if (level.master) return { checked: level.master.on, onToggle: level.master.onToggle };
|
|
557
|
+
return { checked: levelRows(level).some((r) => r.include), onToggle: bulk };
|
|
558
|
+
}
|
|
559
|
+
function LevelHeading({
|
|
560
|
+
kind,
|
|
561
|
+
path,
|
|
562
|
+
rows,
|
|
563
|
+
density,
|
|
564
|
+
readOnly,
|
|
565
|
+
checked,
|
|
566
|
+
onToggle
|
|
567
|
+
}) {
|
|
568
|
+
const name = path.join(" \u203A ");
|
|
569
|
+
const { count, charsLabel } = summarizeContextRows(rows);
|
|
570
|
+
const total = rows.length;
|
|
571
|
+
const showSwitch = Boolean(onToggle) || readOnly && total > 0;
|
|
572
|
+
return /* @__PURE__ */ jsxs3(
|
|
573
|
+
"div",
|
|
574
|
+
{
|
|
575
|
+
role: "row",
|
|
576
|
+
"data-heading": kind,
|
|
577
|
+
className: cn2(
|
|
578
|
+
CONTEXT_RULES_GRID[density],
|
|
579
|
+
"border-b border-border/50 font-medium",
|
|
580
|
+
density === "comfortable" ? "min-h-11" : "h-7",
|
|
581
|
+
kind === "level" ? "bg-muted/60 text-foreground" : "bg-muted/25 text-muted-foreground"
|
|
582
|
+
),
|
|
583
|
+
children: [
|
|
584
|
+
/* @__PURE__ */ jsxs3("div", { role: "cell", className: cn2("flex min-w-0 items-center gap-1", kind === "group" && "pl-2"), children: [
|
|
585
|
+
/* @__PURE__ */ jsx3("span", { className: "flex min-w-0 items-center gap-1 overflow-hidden", title: name, children: path.map((part, i) => /* @__PURE__ */ jsxs3(React2.Fragment, { children: [
|
|
586
|
+
i > 0 ? /* @__PURE__ */ jsx3("span", { className: "shrink-0 text-muted-foreground", children: "\u203A" }) : null,
|
|
587
|
+
/* @__PURE__ */ jsx3(
|
|
588
|
+
"span",
|
|
589
|
+
{
|
|
590
|
+
className: cn2(
|
|
591
|
+
"truncate",
|
|
592
|
+
i < path.length - 1 ? "max-w-[45%] shrink-0 text-muted-foreground" : "min-w-0"
|
|
593
|
+
),
|
|
594
|
+
children: part
|
|
595
|
+
}
|
|
596
|
+
)
|
|
597
|
+
] }, `${i}:${part}`)) }),
|
|
598
|
+
total > 0 ? /* @__PURE__ */ jsx3("span", { className: "shrink-0 font-normal tabular-nums text-muted-foreground", children: count === total ? total : `${count}/${total}` }) : null
|
|
599
|
+
] }),
|
|
600
|
+
/* @__PURE__ */ jsx3("div", { role: "cell", className: "flex justify-center", children: showSwitch ? /* @__PURE__ */ jsx3(
|
|
601
|
+
Switch,
|
|
602
|
+
{
|
|
603
|
+
size: "sm",
|
|
604
|
+
"aria-label": `Include ${name}`,
|
|
605
|
+
checked,
|
|
606
|
+
disabled: readOnly || !onToggle,
|
|
607
|
+
onCheckedChange: (next) => onToggle?.(next)
|
|
608
|
+
}
|
|
609
|
+
) : null }),
|
|
610
|
+
/* @__PURE__ */ jsx3("div", { role: "cell", className: "text-right font-normal tabular-nums text-muted-foreground", children: total > 0 ? charsLabel : null }),
|
|
611
|
+
/* @__PURE__ */ jsx3("div", { role: "cell" })
|
|
612
|
+
]
|
|
613
|
+
}
|
|
614
|
+
);
|
|
615
|
+
}
|
|
454
616
|
function ContextRuleRow({
|
|
455
617
|
row,
|
|
456
618
|
cap,
|
|
457
619
|
density,
|
|
620
|
+
depth,
|
|
458
621
|
comfortable,
|
|
459
622
|
readOnly,
|
|
460
623
|
selected,
|
|
461
624
|
mismatches,
|
|
462
625
|
onChange,
|
|
463
|
-
onOpenRow
|
|
626
|
+
onOpenRow,
|
|
627
|
+
lead,
|
|
628
|
+
trail
|
|
464
629
|
}) {
|
|
465
630
|
const selfChecked = row.blockedBy === "self_check" || mismatches.some((m) => m.reason === "self_check");
|
|
466
631
|
const decided = selfChecked ? SELF_CHECK_TOOLTIP : row.serverResolved ? SERVER_RESOLVED_TOOLTIP : `Include: ${LAYER_LABEL[row.decided_by.include]} \xB7 Limit: ${LAYER_LABEL[row.decided_by.max_inline_chars]}`;
|
|
@@ -490,27 +655,41 @@ function ContextRuleRow({
|
|
|
490
655
|
selected && "bg-accent"
|
|
491
656
|
),
|
|
492
657
|
children: [
|
|
493
|
-
/* @__PURE__ */ jsxs3(
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
658
|
+
/* @__PURE__ */ jsxs3(
|
|
659
|
+
"div",
|
|
660
|
+
{
|
|
661
|
+
role: "cell",
|
|
662
|
+
className: cn2(
|
|
663
|
+
"flex min-w-0 items-center gap-1.5",
|
|
664
|
+
depth === 1 && "pl-2",
|
|
665
|
+
depth === 2 && "pl-4",
|
|
666
|
+
!row.include && "opacity-50"
|
|
667
|
+
),
|
|
668
|
+
children: [
|
|
669
|
+
mismatches.length > 0 ? /* @__PURE__ */ jsxs3(Tooltip2, { children: [
|
|
670
|
+
/* @__PURE__ */ jsx3(TooltipTrigger2, { asChild: true, children: /* @__PURE__ */ jsx3(
|
|
671
|
+
"span",
|
|
672
|
+
{
|
|
673
|
+
role: "img",
|
|
674
|
+
"aria-label": "Mismatch",
|
|
675
|
+
className: "inline-flex shrink-0 text-warning",
|
|
676
|
+
children: /* @__PURE__ */ jsx3(TriangleAlertIcon, { className: "h-3.5 w-3.5" })
|
|
677
|
+
}
|
|
678
|
+
) }),
|
|
679
|
+
/* @__PURE__ */ jsx3(TooltipContent2, { children: describeMismatches(mismatches) })
|
|
680
|
+
] }) : null,
|
|
681
|
+
lead ? /* @__PURE__ */ jsx3("span", { className: "inline-flex shrink-0 items-center", children: lead }) : null,
|
|
682
|
+
/* @__PURE__ */ jsxs3(Tooltip2, { children: [
|
|
683
|
+
/* @__PURE__ */ jsx3(TooltipTrigger2, { asChild: true, children: labelNode }),
|
|
684
|
+
/* @__PURE__ */ jsxs3(TooltipContent2, { children: [
|
|
685
|
+
/* @__PURE__ */ jsx3("div", { children: row.label }),
|
|
686
|
+
/* @__PURE__ */ jsx3("div", { className: "font-normal text-muted-foreground", children: decided })
|
|
687
|
+
] })
|
|
688
|
+
] }),
|
|
689
|
+
trail ? /* @__PURE__ */ jsx3("span", { className: "min-w-0 max-w-[45%] shrink truncate text-muted-foreground", children: trail }) : null
|
|
690
|
+
]
|
|
691
|
+
}
|
|
692
|
+
),
|
|
514
693
|
/* @__PURE__ */ jsx3("div", { role: "cell", className: "flex justify-center", children: /* @__PURE__ */ jsx3(
|
|
515
694
|
Switch,
|
|
516
695
|
{
|
|
@@ -554,7 +733,7 @@ function ContextRuleRow({
|
|
|
554
733
|
}
|
|
555
734
|
|
|
556
735
|
// context/react/ContextRulesChip.tsx
|
|
557
|
-
import * as
|
|
736
|
+
import * as React3 from "react";
|
|
558
737
|
import {
|
|
559
738
|
BottomSheet,
|
|
560
739
|
Popover,
|
|
@@ -570,20 +749,6 @@ import {
|
|
|
570
749
|
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
571
750
|
var BLIND_TOOLTIP = "This model can't read these values";
|
|
572
751
|
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
752
|
function IconButton({
|
|
588
753
|
label,
|
|
589
754
|
onClick,
|
|
@@ -613,6 +778,8 @@ function ContextRulesChip({
|
|
|
613
778
|
cap,
|
|
614
779
|
on,
|
|
615
780
|
onToggleAll,
|
|
781
|
+
hierarchy,
|
|
782
|
+
onSetInclude,
|
|
616
783
|
onChange,
|
|
617
784
|
onResetAll,
|
|
618
785
|
onOpenFullView,
|
|
@@ -626,7 +793,7 @@ function ContextRulesChip({
|
|
|
626
793
|
onOpenChange,
|
|
627
794
|
className
|
|
628
795
|
}) {
|
|
629
|
-
const [openState, setOpenState] =
|
|
796
|
+
const [openState, setOpenState] = React3.useState(false);
|
|
630
797
|
const open = openProp ?? openState;
|
|
631
798
|
const setOpen = (next) => {
|
|
632
799
|
if (openProp === void 0) setOpenState(next);
|
|
@@ -639,7 +806,8 @@ function ContextRulesChip({
|
|
|
639
806
|
const blind = !modelReadsContext;
|
|
640
807
|
const warn = mismatchCount > 0 && !blind;
|
|
641
808
|
const comfortable = !!isMobile;
|
|
642
|
-
const hasPage = on !== void 0;
|
|
809
|
+
const hasPage = on !== void 0 && !hierarchy;
|
|
810
|
+
const headerName = hierarchy ? "" : name;
|
|
643
811
|
const eyeOpen = !blind && on !== false;
|
|
644
812
|
const faceButton = /* @__PURE__ */ jsxs4(
|
|
645
813
|
"button",
|
|
@@ -683,7 +851,7 @@ function ContextRulesChip({
|
|
|
683
851
|
),
|
|
684
852
|
children: [
|
|
685
853
|
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
|
-
|
|
854
|
+
headerName ? /* @__PURE__ */ jsx4("span", { className: "min-w-0 truncate text-sm font-medium", children: headerName }) : null,
|
|
687
855
|
/* @__PURE__ */ jsx4("span", { className: "shrink-0 text-xs tabular-nums text-muted-foreground", children: `${count} \xB7 ${charsLabel} chars` }),
|
|
688
856
|
/* @__PURE__ */ jsxs4("div", { className: "ml-auto flex shrink-0 items-center gap-0.5", children: [
|
|
689
857
|
blind ? /* @__PURE__ */ jsx4("span", { className: "mr-1 text-xs text-muted-foreground", children: BLIND_LABEL }) : null,
|
|
@@ -723,6 +891,8 @@ function ContextRulesChip({
|
|
|
723
891
|
readOnly,
|
|
724
892
|
density: comfortable ? "comfortable" : "compact",
|
|
725
893
|
onChange,
|
|
894
|
+
hierarchy,
|
|
895
|
+
onSetInclude,
|
|
726
896
|
...mismatches ? { mismatches } : {},
|
|
727
897
|
...onOpenRow ? { onOpenRow } : {}
|
|
728
898
|
}
|
|
@@ -748,7 +918,7 @@ function ContextRulesChip({
|
|
|
748
918
|
}
|
|
749
919
|
|
|
750
920
|
// context/react/ContextRulesPanelBody.tsx
|
|
751
|
-
import * as
|
|
921
|
+
import * as React5 from "react";
|
|
752
922
|
import {
|
|
753
923
|
Input as Input2,
|
|
754
924
|
Switch as Switch3,
|
|
@@ -757,7 +927,7 @@ import {
|
|
|
757
927
|
} from "@ai-matrx/design-system";
|
|
758
928
|
|
|
759
929
|
// context/react/ContextDeliveredValue.tsx
|
|
760
|
-
import * as
|
|
930
|
+
import * as React4 from "react";
|
|
761
931
|
import { ErrorBox, Skeleton, cn as cn4 } from "@ai-matrx/design-system";
|
|
762
932
|
import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
763
933
|
function ContextDeliveredValue({
|
|
@@ -818,10 +988,10 @@ function DeliveredSection({
|
|
|
818
988
|
ref_,
|
|
819
989
|
load
|
|
820
990
|
}) {
|
|
821
|
-
const [loaded, setLoaded] =
|
|
822
|
-
const [attempt, setAttempt] =
|
|
991
|
+
const [loaded, setLoaded] = React4.useState({ state: "loading" });
|
|
992
|
+
const [attempt, setAttempt] = React4.useState(0);
|
|
823
993
|
const { kind, key } = target;
|
|
824
|
-
|
|
994
|
+
React4.useEffect(() => {
|
|
825
995
|
if (!load) return;
|
|
826
996
|
let live = true;
|
|
827
997
|
setLoaded({ state: "loading" });
|
|
@@ -970,7 +1140,7 @@ function ContextReceiptBlockDetail({
|
|
|
970
1140
|
}
|
|
971
1141
|
|
|
972
1142
|
// context/react/ContextRulesPanelBody.tsx
|
|
973
|
-
import { Fragment as
|
|
1143
|
+
import { Fragment as Fragment3, jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
974
1144
|
function layerCells(row) {
|
|
975
1145
|
const { surface, agent, default_max } = row.layers ?? {};
|
|
976
1146
|
const declared = agent?.declared === true;
|
|
@@ -1092,15 +1262,17 @@ function ContextRulesPanelBody({
|
|
|
1092
1262
|
loadView,
|
|
1093
1263
|
readOnly,
|
|
1094
1264
|
onChange,
|
|
1265
|
+
hierarchy,
|
|
1266
|
+
onSetInclude,
|
|
1095
1267
|
renderDetail,
|
|
1096
1268
|
isMobile,
|
|
1097
1269
|
selectedKey: selectedProp,
|
|
1098
1270
|
onSelectedKeyChange,
|
|
1099
1271
|
className
|
|
1100
1272
|
}) {
|
|
1101
|
-
const [selectedState, setSelectedState] =
|
|
1102
|
-
const [query, setQuery] =
|
|
1103
|
-
const [openBlockId, setOpenBlockId] =
|
|
1273
|
+
const [selectedState, setSelectedState] = React5.useState(null);
|
|
1274
|
+
const [query, setQuery] = React5.useState("");
|
|
1275
|
+
const [openBlockId, setOpenBlockId] = React5.useState(null);
|
|
1104
1276
|
const selectedKey = selectedProp !== void 0 ? selectedProp : selectedState;
|
|
1105
1277
|
const select = (key) => {
|
|
1106
1278
|
setOpenBlockId(null);
|
|
@@ -1145,6 +1317,8 @@ function ContextRulesPanelBody({
|
|
|
1145
1317
|
density: comfortable ? "comfortable" : "compact",
|
|
1146
1318
|
selectedKey,
|
|
1147
1319
|
onChange,
|
|
1320
|
+
hierarchy,
|
|
1321
|
+
onSetInclude,
|
|
1148
1322
|
onOpenRow: (key) => select(key),
|
|
1149
1323
|
...mismatches ? { mismatches } : {}
|
|
1150
1324
|
}
|
|
@@ -1173,7 +1347,7 @@ function ContextRulesPanelBody({
|
|
|
1173
1347
|
}
|
|
1174
1348
|
) : null;
|
|
1175
1349
|
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(
|
|
1350
|
+
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
1351
|
/* @__PURE__ */ jsx7("div", { className: "flex h-12 shrink-0 items-center border-b border-border px-1", children: /* @__PURE__ */ jsxs7(
|
|
1178
1352
|
"button",
|
|
1179
1353
|
{
|
|
@@ -1187,7 +1361,7 @@ function ContextRulesPanelBody({
|
|
|
1187
1361
|
}
|
|
1188
1362
|
) }),
|
|
1189
1363
|
/* @__PURE__ */ jsx7("div", { className: "min-h-0 flex-1 overflow-y-auto", children: detail })
|
|
1190
|
-
] }) : /* @__PURE__ */ jsxs7(
|
|
1364
|
+
] }) : /* @__PURE__ */ jsxs7(Fragment3, { children: [
|
|
1191
1365
|
search,
|
|
1192
1366
|
table
|
|
1193
1367
|
] }) }) });
|
|
@@ -1201,6 +1375,8 @@ function ContextRulesPanelBody({
|
|
|
1201
1375
|
] }) });
|
|
1202
1376
|
}
|
|
1203
1377
|
export {
|
|
1378
|
+
AI_MATRX_LEVEL,
|
|
1379
|
+
ATTACHED_LEVEL,
|
|
1204
1380
|
ContextDeliveredValue,
|
|
1205
1381
|
ContextReceiptBlockDetail,
|
|
1206
1382
|
ContextReceiptBlocks,
|
|
@@ -1209,6 +1385,12 @@ export {
|
|
|
1209
1385
|
ContextRulesTable,
|
|
1210
1386
|
DeliveredSection,
|
|
1211
1387
|
InlineMaxInput,
|
|
1388
|
+
PAGE_LEVEL,
|
|
1389
|
+
buildContextLevels,
|
|
1390
|
+
includeChanges,
|
|
1391
|
+
inheritedInclude,
|
|
1392
|
+
levelRows,
|
|
1393
|
+
placeByOrigin,
|
|
1212
1394
|
summarizeContextRows
|
|
1213
1395
|
};
|
|
1214
1396
|
//# sourceMappingURL=index.js.map
|