@ai-matrx/agents 0.40.0 → 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.
@@ -1,19 +1,5 @@
1
1
  import * as react from 'react';
2
2
 
3
- /**
4
- * @ai-matrx/agents/context — the context value rules, headless.
5
- *
6
- * Contract: common-docs/systems/scopes-context/context-delivery/RULES.md.
7
- * Parity corpus: ./rules-corpus.json (run here by rules.test.ts and by aidream's
8
- * pytest against the Python twin `resolve_context_rule`). Every function here
9
- * is pure, zero-React, and safe to import on a server.
10
- *
11
- * The one flow a client runs per turn:
12
- * rows = values.map(v => resolveContextRow(v, savedRows, cap)) // what the table shows
13
- * context = buildContextWire(rows) // what the request sends
14
- * …on `context_receipt`: compareReceipt(rows, receipt) // screen vs server
15
- */
16
-
17
3
  /** Which layer decided a field — lowest to highest. */
18
4
  type ContextLayer = "default" | "page" | "agent" | "you";
19
5
  type ContextDelivery = "inline" | "on_request" | "off";
@@ -128,7 +114,7 @@ type ContextViewLoader = (target: ContextViewTarget) => Promise<ContextViewedTex
128
114
  interface ContextReceiptBlock {
129
115
  /** Stable id: the per-turn slot it rode in, or the system-prompt addition's name. */
130
116
  id: string;
131
- /** The id in words (`humanizeContextKey`). */
117
+ /** The id in words (`humanizeIdentifier`, `@ai-matrx/kit/text-case`). */
132
118
  label: string;
133
119
  /** Size and hash; the text comes from the viewer (`kind: "block"`). */
134
120
  delivered: ContextDeliveredRef;
@@ -301,13 +287,20 @@ interface ContextRulesTableProps {
301
287
  * switch still shows).
302
288
  */
303
289
  onSetInclude?: ((changes: ContextRuleChange[]) => void) | undefined;
290
+ /**
291
+ * Host slots inside a row's Item cell, never a second renderer: `renderRowLead`
292
+ * before the label (a status mark), `renderRowTrail` after it (an admin's
293
+ * machine name). Each renders inline and truncates with the label.
294
+ */
295
+ renderRowLead?: ((row: ResolvedContextRow) => react.ReactNode) | undefined;
296
+ renderRowTrail?: ((row: ResolvedContextRow) => react.ReactNode) | undefined;
304
297
  className?: string;
305
298
  }
306
299
  /**
307
300
  * The context rules table: Item | Include | Chars | Inline max. Presentational
308
301
  * and state-agnostic — every edit goes out through `onChange`.
309
302
  */
310
- declare function ContextRulesTable({ rows, cap, readOnly, mismatches, onChange, onOpenRow, density, selectedKey, hierarchy, onSetInclude, className, }: ContextRulesTableProps): react.JSX.Element;
303
+ declare function ContextRulesTable({ rows, cap, readOnly, mismatches, onChange, onOpenRow, density, selectedKey, hierarchy, onSetInclude, renderRowLead, renderRowTrail, className, }: ContextRulesTableProps): react.JSX.Element;
311
304
 
312
305
  /**
313
306
  * The header's "N · chars" total. A row whose size is not known yet (an
@@ -1,19 +1,5 @@
1
1
  import * as react from 'react';
2
2
 
3
- /**
4
- * @ai-matrx/agents/context — the context value rules, headless.
5
- *
6
- * Contract: common-docs/systems/scopes-context/context-delivery/RULES.md.
7
- * Parity corpus: ./rules-corpus.json (run here by rules.test.ts and by aidream's
8
- * pytest against the Python twin `resolve_context_rule`). Every function here
9
- * is pure, zero-React, and safe to import on a server.
10
- *
11
- * The one flow a client runs per turn:
12
- * rows = values.map(v => resolveContextRow(v, savedRows, cap)) // what the table shows
13
- * context = buildContextWire(rows) // what the request sends
14
- * …on `context_receipt`: compareReceipt(rows, receipt) // screen vs server
15
- */
16
-
17
3
  /** Which layer decided a field — lowest to highest. */
18
4
  type ContextLayer = "default" | "page" | "agent" | "you";
19
5
  type ContextDelivery = "inline" | "on_request" | "off";
@@ -128,7 +114,7 @@ type ContextViewLoader = (target: ContextViewTarget) => Promise<ContextViewedTex
128
114
  interface ContextReceiptBlock {
129
115
  /** Stable id: the per-turn slot it rode in, or the system-prompt addition's name. */
130
116
  id: string;
131
- /** The id in words (`humanizeContextKey`). */
117
+ /** The id in words (`humanizeIdentifier`, `@ai-matrx/kit/text-case`). */
132
118
  label: string;
133
119
  /** Size and hash; the text comes from the viewer (`kind: "block"`). */
134
120
  delivered: ContextDeliveredRef;
@@ -301,13 +287,20 @@ interface ContextRulesTableProps {
301
287
  * switch still shows).
302
288
  */
303
289
  onSetInclude?: ((changes: ContextRuleChange[]) => void) | undefined;
290
+ /**
291
+ * Host slots inside a row's Item cell, never a second renderer: `renderRowLead`
292
+ * before the label (a status mark), `renderRowTrail` after it (an admin's
293
+ * machine name). Each renders inline and truncates with the label.
294
+ */
295
+ renderRowLead?: ((row: ResolvedContextRow) => react.ReactNode) | undefined;
296
+ renderRowTrail?: ((row: ResolvedContextRow) => react.ReactNode) | undefined;
304
297
  className?: string;
305
298
  }
306
299
  /**
307
300
  * The context rules table: Item | Include | Chars | Inline max. Presentational
308
301
  * and state-agnostic — every edit goes out through `onChange`.
309
302
  */
310
- declare function ContextRulesTable({ rows, cap, readOnly, mismatches, onChange, onOpenRow, density, selectedKey, hierarchy, onSetInclude, className, }: ContextRulesTableProps): react.JSX.Element;
303
+ declare function ContextRulesTable({ rows, cap, readOnly, mismatches, onChange, onOpenRow, density, selectedKey, hierarchy, onSetInclude, renderRowLead, renderRowTrail, className, }: ContextRulesTableProps): react.JSX.Element;
311
304
 
312
305
  /**
313
306
  * The header's "N · chars" total. A row whose size is not known yet (an
@@ -12,7 +12,6 @@ import {
12
12
  } from "@ai-matrx/design-system";
13
13
 
14
14
  // context/index.ts
15
- import { IDENTIFIER_ACRONYMS, humanizeIdentifier } from "@ai-matrx/kit/text-case";
16
15
  var DEFAULT_INLINE_MAX_CHARS = 200;
17
16
  var DEFAULT_INLINE_CAP = 5e4;
18
17
  var CONTEXT_ROW_BLOCKS = {
@@ -472,6 +471,8 @@ function ContextRulesTable({
472
471
  selectedKey,
473
472
  hierarchy,
474
473
  onSetInclude,
474
+ renderRowLead,
475
+ renderRowTrail,
475
476
  className
476
477
  }) {
477
478
  const comfortable = density === "comfortable";
@@ -489,7 +490,9 @@ function ContextRulesTable({
489
490
  mismatches: mismatches?.filter((m) => m.key === row.key) ?? [],
490
491
  onChange,
491
492
  onOpenRow,
492
- comfortable
493
+ comfortable,
494
+ lead: renderRowLead?.(row),
495
+ trail: renderRowTrail?.(row)
493
496
  },
494
497
  rowId(row)
495
498
  );
@@ -579,9 +582,18 @@ function LevelHeading({
579
582
  ),
580
583
  children: [
581
584
  /* @__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: [
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: [
583
586
  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 })
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
+ )
585
597
  ] }, `${i}:${part}`)) }),
586
598
  total > 0 ? /* @__PURE__ */ jsx3("span", { className: "shrink-0 font-normal tabular-nums text-muted-foreground", children: count === total ? total : `${count}/${total}` }) : null
587
599
  ] }),
@@ -611,7 +623,9 @@ function ContextRuleRow({
611
623
  selected,
612
624
  mismatches,
613
625
  onChange,
614
- onOpenRow
626
+ onOpenRow,
627
+ lead,
628
+ trail
615
629
  }) {
616
630
  const selfChecked = row.blockedBy === "self_check" || mismatches.some((m) => m.reason === "self_check");
617
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]}`;
@@ -664,13 +678,15 @@ function ContextRuleRow({
664
678
  ) }),
665
679
  /* @__PURE__ */ jsx3(TooltipContent2, { children: describeMismatches(mismatches) })
666
680
  ] }) : null,
681
+ lead ? /* @__PURE__ */ jsx3("span", { className: "inline-flex shrink-0 items-center", children: lead }) : null,
667
682
  /* @__PURE__ */ jsxs3(Tooltip2, { children: [
668
683
  /* @__PURE__ */ jsx3(TooltipTrigger2, { asChild: true, children: labelNode }),
669
684
  /* @__PURE__ */ jsxs3(TooltipContent2, { children: [
670
685
  /* @__PURE__ */ jsx3("div", { children: row.label }),
671
686
  /* @__PURE__ */ jsx3("div", { className: "font-normal text-muted-foreground", children: decided })
672
687
  ] })
673
- ] })
688
+ ] }),
689
+ trail ? /* @__PURE__ */ jsx3("span", { className: "min-w-0 max-w-[45%] shrink truncate text-muted-foreground", children: trail }) : null
674
690
  ]
675
691
  }
676
692
  ),