@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.
Files changed (57) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/dist/catalog/index.cjs +3 -1
  3. package/dist/catalog/index.cjs.map +1 -1
  4. package/dist/catalog/index.d.cts +2 -2
  5. package/dist/catalog/index.d.ts +2 -2
  6. package/dist/catalog/index.js +3 -1
  7. package/dist/catalog/index.js.map +1 -1
  8. package/dist/catalog/native/index.cjs +4 -1
  9. package/dist/catalog/native/index.cjs.map +1 -1
  10. package/dist/catalog/native/index.d.cts +8 -3
  11. package/dist/catalog/native/index.d.ts +8 -3
  12. package/dist/catalog/native/index.js +4 -1
  13. package/dist/catalog/native/index.js.map +1 -1
  14. package/dist/catalog/react/index.cjs +1 -0
  15. package/dist/catalog/react/index.cjs.map +1 -1
  16. package/dist/catalog/react/index.d.cts +13 -1
  17. package/dist/catalog/react/index.d.ts +13 -1
  18. package/dist/catalog/react/index.js +1 -0
  19. package/dist/catalog/react/index.js.map +1 -1
  20. package/dist/content-transfer/index.cjs.map +1 -1
  21. package/dist/content-transfer/index.js.map +1 -1
  22. package/dist/content-transfer/react/index.cjs.map +1 -1
  23. package/dist/content-transfer/react/index.js.map +1 -1
  24. package/dist/context/index.cjs +0 -25
  25. package/dist/context/index.cjs.map +1 -1
  26. package/dist/context/index.d.cts +2 -17
  27. package/dist/context/index.d.ts +2 -17
  28. package/dist/context/index.js +0 -25
  29. package/dist/context/index.js.map +1 -1
  30. package/dist/context/react/index.cjs +280 -98
  31. package/dist/context/react/index.cjs.map +1 -1
  32. package/dist/context/react/index.d.cts +134 -16
  33. package/dist/context/react/index.d.ts +134 -16
  34. package/dist/context/react/index.js +283 -101
  35. package/dist/context/react/index.js.map +1 -1
  36. package/dist/index.cjs +6 -3
  37. package/dist/index.cjs.map +1 -1
  38. package/dist/index.d.cts +9 -6
  39. package/dist/index.d.ts +9 -6
  40. package/dist/index.js +6 -3
  41. package/dist/index.js.map +1 -1
  42. package/dist/{keys.generated-DxG5tgWt.d.cts → keys.generated-ClN6zfUo.d.cts} +4 -4
  43. package/dist/{keys.generated-DxG5tgWt.d.ts → keys.generated-ClN6zfUo.d.ts} +4 -4
  44. package/dist/mandates/index.cjs +2 -2
  45. package/dist/mandates/index.cjs.map +1 -1
  46. package/dist/mandates/index.d.cts +2 -2
  47. package/dist/mandates/index.d.ts +2 -2
  48. package/dist/mandates/index.js +2 -2
  49. package/dist/mandates/index.js.map +1 -1
  50. package/dist/matrx/index.d.cts +1 -1
  51. package/dist/matrx/index.d.ts +1 -1
  52. package/dist/{orchestra-zpGHwOag.d.cts → orchestra-CiaTu58J.d.cts} +7 -0
  53. package/dist/{orchestra-zpGHwOag.d.ts → orchestra-CiaTu58J.d.ts} +7 -0
  54. package/mandates/snapshots/keys.0.39.0.json +653 -0
  55. package/mandates/snapshots/keys.0.40.0.json +653 -0
  56. package/mandates/snapshots/keys.0.41.0.json +653 -0
  57. package/package.json +4 -4
@@ -114,7 +114,7 @@ type ContextViewLoader = (target: ContextViewTarget) => Promise<ContextViewedTex
114
114
  interface ContextReceiptBlock {
115
115
  /** Stable id: the per-turn slot it rode in, or the system-prompt addition's name. */
116
116
  id: string;
117
- /** The id in words (`humanizeContextKey`). */
117
+ /** The id in words (`humanizeIdentifier`, `@ai-matrx/kit/text-case`). */
118
118
  label: string;
119
119
  /** Size and hash; the text comes from the viewer (`kind: "block"`). */
120
120
  delivered: ContextDeliveredRef;
@@ -173,6 +173,95 @@ interface ContextReceiptMismatch {
173
173
  reason?: "self_check";
174
174
  }
175
175
 
176
+ /**
177
+ * THE HIERARCHY of the context rules table — where each value sits, and the
178
+ * switch at every level (Arman, 2026-10-02: "AI Matrx" for the platform's own
179
+ * values; the page by its section and real name; under it the page's own
180
+ * declared groups; a switch per level).
181
+ *
182
+ * The package never knows a page's groups: the host PLACES each row (level +
183
+ * group, both already-human labels) and may give a level a host switch (the
184
+ * page's own on/off). Without a host placement every row is placed by its
185
+ * origin. A level or group switch is NOT a new kind of rule: it is the
186
+ * person's per-value include rules for every value in it, written at once
187
+ * (`includeChanges`), so the server's gate and receipt see exactly the rules
188
+ * they already honour.
189
+ */
190
+
191
+ /** A level of the table: the platform, a page, the chat's attachments. */
192
+ interface ContextLevelRef {
193
+ /** Stable id (a surface key, `ai_matrx`, `attached`). */
194
+ id: string;
195
+ /** Heading, root first: `["Marketing", "Marketing Brand Cockpit"]`, `["AI Matrx"]`. */
196
+ path: readonly string[];
197
+ /** Sort order between levels (lower first). */
198
+ order?: number;
199
+ }
200
+ /** A group inside a level — the page's own declared group, label as declared. */
201
+ interface ContextGroupRef {
202
+ id: string;
203
+ label: string;
204
+ order?: number;
205
+ }
206
+ /** Where one row sits. */
207
+ interface ContextRowPlace {
208
+ level: ContextLevelRef;
209
+ /** Null: directly under the level. */
210
+ group?: ContextGroupRef | null;
211
+ }
212
+ /**
213
+ * A level whose switch is the host's own (the page on/off for this
214
+ * conversation) rather than the person's per-value rules. Shown even when the
215
+ * level has no rows, so the switch never disappears with its values.
216
+ */
217
+ interface ContextLevelMaster {
218
+ level: ContextLevelRef;
219
+ on: boolean;
220
+ onToggle?: ((next: boolean) => void) | undefined;
221
+ }
222
+ interface ContextHierarchy {
223
+ place: (row: ResolvedContextRow) => ContextRowPlace;
224
+ masters?: readonly ContextLevelMaster[];
225
+ }
226
+ interface ContextGroupNode {
227
+ ref: ContextGroupRef;
228
+ rows: ResolvedContextRow[];
229
+ }
230
+ interface ContextLevelNode {
231
+ ref: ContextLevelRef;
232
+ /** Rows directly under the level (no group). */
233
+ rows: ResolvedContextRow[];
234
+ groups: ContextGroupNode[];
235
+ master: ContextLevelMaster | null;
236
+ }
237
+ /** The platform's own values: the person, their organization, the client. */
238
+ declare const AI_MATRX_LEVEL: ContextLevelRef;
239
+ /** Files and documents attached to the conversation. */
240
+ declare const ATTACHED_LEVEL: ContextLevelRef;
241
+ /** A page the host has not named. */
242
+ declare const PAGE_LEVEL: ContextLevelRef;
243
+ /** The placement a host without one gets: by origin. */
244
+ declare function placeByOrigin(row: ResolvedContextRow): ContextRowPlace;
245
+ /** Rows → levels → groups, in the host's order (stable within equal orders). */
246
+ declare function buildContextLevels(rows: readonly ResolvedContextRow[], hierarchy?: ContextHierarchy | null): ContextLevelNode[];
247
+ /** Every row of a level, groups included. */
248
+ declare function levelRows(level: ContextLevelNode): ResolvedContextRow[];
249
+ /** What the row's include would be with no rule of the person's. */
250
+ declare function inheritedInclude(row: ResolvedContextRow, cap: number): boolean;
251
+ /** One person-rule write: `rule: null` removes the person's rule for that value. */
252
+ interface ContextRuleChange {
253
+ key: string;
254
+ surfaceKey: string;
255
+ rule: SavedContextRule | null;
256
+ }
257
+ /**
258
+ * A level or group switch: the person's include rule for every value in it
259
+ * that is not already `include`. A value whose default already gives
260
+ * `include` loses its own include rule instead (back to the default) — the
261
+ * saved rules stay minimal and "Reset all" means what it says.
262
+ */
263
+ declare function includeChanges(rows: readonly ResolvedContextRow[], include: boolean, cap: number): ContextRuleChange[];
264
+
176
265
  type ContextRulesDensity = "compact" | "comfortable";
177
266
  interface ContextRulesTableProps {
178
267
  rows: readonly ResolvedContextRow[];
@@ -187,13 +276,42 @@ interface ContextRulesTableProps {
187
276
  density?: ContextRulesDensity;
188
277
  /** Highlights the open row (master/detail). */
189
278
  selectedKey?: string | null;
279
+ /**
280
+ * Where each row sits (level → group) and the host's level switches. Omit:
281
+ * rows sit under their origin ("Page", "Attached", "AI Matrx").
282
+ */
283
+ hierarchy?: ContextHierarchy | null | undefined;
284
+ /**
285
+ * A level or group switch: the person's per-value rules for every value in
286
+ * it, at once. Omit: level and group switches are hidden (a host master
287
+ * switch still shows).
288
+ */
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;
190
297
  className?: string;
191
298
  }
192
299
  /**
193
300
  * The context rules table: Item | Include | Chars | Inline max. Presentational
194
301
  * and state-agnostic — every edit goes out through `onChange`.
195
302
  */
196
- declare function ContextRulesTable({ rows, cap, readOnly, mismatches, onChange, onOpenRow, density, selectedKey, 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;
304
+
305
+ /**
306
+ * The header's "N · chars" total. A row whose size is not known yet (an
307
+ * attachment the server has not measured) never counts as 0: with some sizes
308
+ * unknown the total is a floor ("1.2k+"), with none known it is "—".
309
+ */
310
+ declare function summarizeContextRows(rows: readonly ResolvedContextRow[]): {
311
+ count: number;
312
+ chars: number;
313
+ charsLabel: string;
314
+ };
197
315
 
198
316
  interface ContextRulesChipProps {
199
317
  /**
@@ -205,9 +323,16 @@ interface ContextRulesChipProps {
205
323
  label?: string | null | undefined;
206
324
  rows: readonly ResolvedContextRow[];
207
325
  cap: number;
208
- /** Page context on/off. Omit when there is no page: the master switch is hidden. */
326
+ /**
327
+ * Page context on/off (the face's eye). With no `hierarchy`, also the
328
+ * header's master switch; with one, the page's switch is its level's
329
+ * (`hierarchy.masters`) and the header has none.
330
+ */
209
331
  on?: boolean | undefined;
210
332
  onToggleAll?: ((next: boolean) => void) | undefined;
333
+ /** Levels and groups with a switch each (see `ContextRulesTable`). */
334
+ hierarchy?: ContextHierarchy | null | undefined;
335
+ onSetInclude?: ((changes: ContextRuleChange[]) => void) | undefined;
211
336
  /** False: this turn's model cannot read context — muted face, no amber. */
212
337
  modelReadsContext?: boolean | undefined;
213
338
  onChange: (key: string, surfaceKey: string, next: SavedContextRule | null) => void;
@@ -223,22 +348,12 @@ interface ContextRulesChipProps {
223
348
  onOpenChange?: (open: boolean) => void;
224
349
  className?: string;
225
350
  }
226
- /**
227
- * The header's "N · chars" total. A row whose size is not known yet (an
228
- * attachment the server has not measured) never counts as 0: with some sizes
229
- * unknown the total is a floor ("1.2k+"), with none known it is "—".
230
- */
231
- declare function summarizeContextRows(rows: readonly ResolvedContextRow[]): {
232
- count: number;
233
- chars: number;
234
- charsLabel: string;
235
- };
236
351
  /**
237
352
  * The composer's value-group chip — far right of the composer's one row — and the surface it opens: a header (label,
238
353
  * "N · chars" summary, page master switch, reset-all, full view) over the
239
354
  * compact rules table. Popover on desktop, bottom sheet on mobile.
240
355
  */
241
- declare function ContextRulesChip({ label, rows, cap, on, onToggleAll, onChange, onResetAll, onOpenFullView, mismatchCount, modelReadsContext, mismatches, onOpenRow, isMobile, readOnly, open: openProp, onOpenChange, className, }: ContextRulesChipProps): react.JSX.Element;
356
+ declare function ContextRulesChip({ label, rows, cap, on, onToggleAll, hierarchy, onSetInclude, onChange, onResetAll, onOpenFullView, mismatchCount, modelReadsContext, mismatches, onOpenRow, isMobile, readOnly, open: openProp, onOpenChange, className, }: ContextRulesChipProps): react.JSX.Element;
242
357
 
243
358
  interface ContextRulesPanelBodyProps {
244
359
  rows: readonly ResolvedContextRow[];
@@ -250,6 +365,9 @@ interface ContextRulesPanelBodyProps {
250
365
  loadView?: ContextViewLoader;
251
366
  readOnly?: boolean | undefined;
252
367
  onChange: (key: string, surfaceKey: string, next: SavedContextRule | null) => void;
368
+ /** Levels and groups with a switch each (see `ContextRulesTable`). */
369
+ hierarchy?: ContextHierarchy | null | undefined;
370
+ onSetInclude?: ((changes: ContextRuleChange[]) => void) | undefined;
253
371
  /** Host content under the built-in controls (a value preview, source link…). */
254
372
  renderDetail?: (row: ResolvedContextRow) => react.ReactNode;
255
373
  isMobile?: boolean;
@@ -263,7 +381,7 @@ interface ContextRulesPanelBodyProps {
263
381
  * the left, the open row's controls, layer breakdown and host detail on the
264
382
  * right. On mobile: list, then detail with Back.
265
383
  */
266
- declare function ContextRulesPanelBody({ rows, cap, mismatches, blocks, loadView, readOnly, onChange, renderDetail, isMobile, selectedKey: selectedProp, onSelectedKeyChange, className, }: ContextRulesPanelBodyProps): react.JSX.Element;
384
+ declare function ContextRulesPanelBody({ rows, cap, mismatches, blocks, loadView, readOnly, onChange, hierarchy, onSetInclude, renderDetail, isMobile, selectedKey: selectedProp, onSelectedKeyChange, className, }: ContextRulesPanelBodyProps): react.JSX.Element;
267
385
 
268
386
  interface InlineMaxInputProps {
269
387
  /** The person's own limit, or null when inherited. */
@@ -335,4 +453,4 @@ declare function ContextReceiptBlockDetail({ block, load, className, }: {
335
453
  className?: string;
336
454
  }): react.JSX.Element;
337
455
 
338
- export { ContextDeliveredValue, ContextReceiptBlockDetail, ContextReceiptBlocks, type ContextReceiptBlocksProps, ContextRulesChip, type ContextRulesChipProps, type ContextRulesDensity, ContextRulesPanelBody, type ContextRulesPanelBodyProps, ContextRulesTable, type ContextRulesTableProps, DeliveredSection, InlineMaxInput, type InlineMaxInputProps, summarizeContextRows };
456
+ export { AI_MATRX_LEVEL, ATTACHED_LEVEL, ContextDeliveredValue, type ContextGroupNode, type ContextGroupRef, type ContextHierarchy, type ContextLevelMaster, type ContextLevelNode, type ContextLevelRef, ContextReceiptBlockDetail, ContextReceiptBlocks, type ContextReceiptBlocksProps, type ContextRowPlace, type ContextRuleChange, ContextRulesChip, type ContextRulesChipProps, type ContextRulesDensity, ContextRulesPanelBody, type ContextRulesPanelBodyProps, ContextRulesTable, type ContextRulesTableProps, DeliveredSection, InlineMaxInput, type InlineMaxInputProps, PAGE_LEVEL, buildContextLevels, includeChanges, inheritedInclude, levelRows, placeByOrigin, summarizeContextRows };
@@ -114,7 +114,7 @@ type ContextViewLoader = (target: ContextViewTarget) => Promise<ContextViewedTex
114
114
  interface ContextReceiptBlock {
115
115
  /** Stable id: the per-turn slot it rode in, or the system-prompt addition's name. */
116
116
  id: string;
117
- /** The id in words (`humanizeContextKey`). */
117
+ /** The id in words (`humanizeIdentifier`, `@ai-matrx/kit/text-case`). */
118
118
  label: string;
119
119
  /** Size and hash; the text comes from the viewer (`kind: "block"`). */
120
120
  delivered: ContextDeliveredRef;
@@ -173,6 +173,95 @@ interface ContextReceiptMismatch {
173
173
  reason?: "self_check";
174
174
  }
175
175
 
176
+ /**
177
+ * THE HIERARCHY of the context rules table — where each value sits, and the
178
+ * switch at every level (Arman, 2026-10-02: "AI Matrx" for the platform's own
179
+ * values; the page by its section and real name; under it the page's own
180
+ * declared groups; a switch per level).
181
+ *
182
+ * The package never knows a page's groups: the host PLACES each row (level +
183
+ * group, both already-human labels) and may give a level a host switch (the
184
+ * page's own on/off). Without a host placement every row is placed by its
185
+ * origin. A level or group switch is NOT a new kind of rule: it is the
186
+ * person's per-value include rules for every value in it, written at once
187
+ * (`includeChanges`), so the server's gate and receipt see exactly the rules
188
+ * they already honour.
189
+ */
190
+
191
+ /** A level of the table: the platform, a page, the chat's attachments. */
192
+ interface ContextLevelRef {
193
+ /** Stable id (a surface key, `ai_matrx`, `attached`). */
194
+ id: string;
195
+ /** Heading, root first: `["Marketing", "Marketing Brand Cockpit"]`, `["AI Matrx"]`. */
196
+ path: readonly string[];
197
+ /** Sort order between levels (lower first). */
198
+ order?: number;
199
+ }
200
+ /** A group inside a level — the page's own declared group, label as declared. */
201
+ interface ContextGroupRef {
202
+ id: string;
203
+ label: string;
204
+ order?: number;
205
+ }
206
+ /** Where one row sits. */
207
+ interface ContextRowPlace {
208
+ level: ContextLevelRef;
209
+ /** Null: directly under the level. */
210
+ group?: ContextGroupRef | null;
211
+ }
212
+ /**
213
+ * A level whose switch is the host's own (the page on/off for this
214
+ * conversation) rather than the person's per-value rules. Shown even when the
215
+ * level has no rows, so the switch never disappears with its values.
216
+ */
217
+ interface ContextLevelMaster {
218
+ level: ContextLevelRef;
219
+ on: boolean;
220
+ onToggle?: ((next: boolean) => void) | undefined;
221
+ }
222
+ interface ContextHierarchy {
223
+ place: (row: ResolvedContextRow) => ContextRowPlace;
224
+ masters?: readonly ContextLevelMaster[];
225
+ }
226
+ interface ContextGroupNode {
227
+ ref: ContextGroupRef;
228
+ rows: ResolvedContextRow[];
229
+ }
230
+ interface ContextLevelNode {
231
+ ref: ContextLevelRef;
232
+ /** Rows directly under the level (no group). */
233
+ rows: ResolvedContextRow[];
234
+ groups: ContextGroupNode[];
235
+ master: ContextLevelMaster | null;
236
+ }
237
+ /** The platform's own values: the person, their organization, the client. */
238
+ declare const AI_MATRX_LEVEL: ContextLevelRef;
239
+ /** Files and documents attached to the conversation. */
240
+ declare const ATTACHED_LEVEL: ContextLevelRef;
241
+ /** A page the host has not named. */
242
+ declare const PAGE_LEVEL: ContextLevelRef;
243
+ /** The placement a host without one gets: by origin. */
244
+ declare function placeByOrigin(row: ResolvedContextRow): ContextRowPlace;
245
+ /** Rows → levels → groups, in the host's order (stable within equal orders). */
246
+ declare function buildContextLevels(rows: readonly ResolvedContextRow[], hierarchy?: ContextHierarchy | null): ContextLevelNode[];
247
+ /** Every row of a level, groups included. */
248
+ declare function levelRows(level: ContextLevelNode): ResolvedContextRow[];
249
+ /** What the row's include would be with no rule of the person's. */
250
+ declare function inheritedInclude(row: ResolvedContextRow, cap: number): boolean;
251
+ /** One person-rule write: `rule: null` removes the person's rule for that value. */
252
+ interface ContextRuleChange {
253
+ key: string;
254
+ surfaceKey: string;
255
+ rule: SavedContextRule | null;
256
+ }
257
+ /**
258
+ * A level or group switch: the person's include rule for every value in it
259
+ * that is not already `include`. A value whose default already gives
260
+ * `include` loses its own include rule instead (back to the default) — the
261
+ * saved rules stay minimal and "Reset all" means what it says.
262
+ */
263
+ declare function includeChanges(rows: readonly ResolvedContextRow[], include: boolean, cap: number): ContextRuleChange[];
264
+
176
265
  type ContextRulesDensity = "compact" | "comfortable";
177
266
  interface ContextRulesTableProps {
178
267
  rows: readonly ResolvedContextRow[];
@@ -187,13 +276,42 @@ interface ContextRulesTableProps {
187
276
  density?: ContextRulesDensity;
188
277
  /** Highlights the open row (master/detail). */
189
278
  selectedKey?: string | null;
279
+ /**
280
+ * Where each row sits (level → group) and the host's level switches. Omit:
281
+ * rows sit under their origin ("Page", "Attached", "AI Matrx").
282
+ */
283
+ hierarchy?: ContextHierarchy | null | undefined;
284
+ /**
285
+ * A level or group switch: the person's per-value rules for every value in
286
+ * it, at once. Omit: level and group switches are hidden (a host master
287
+ * switch still shows).
288
+ */
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;
190
297
  className?: string;
191
298
  }
192
299
  /**
193
300
  * The context rules table: Item | Include | Chars | Inline max. Presentational
194
301
  * and state-agnostic — every edit goes out through `onChange`.
195
302
  */
196
- declare function ContextRulesTable({ rows, cap, readOnly, mismatches, onChange, onOpenRow, density, selectedKey, 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;
304
+
305
+ /**
306
+ * The header's "N · chars" total. A row whose size is not known yet (an
307
+ * attachment the server has not measured) never counts as 0: with some sizes
308
+ * unknown the total is a floor ("1.2k+"), with none known it is "—".
309
+ */
310
+ declare function summarizeContextRows(rows: readonly ResolvedContextRow[]): {
311
+ count: number;
312
+ chars: number;
313
+ charsLabel: string;
314
+ };
197
315
 
198
316
  interface ContextRulesChipProps {
199
317
  /**
@@ -205,9 +323,16 @@ interface ContextRulesChipProps {
205
323
  label?: string | null | undefined;
206
324
  rows: readonly ResolvedContextRow[];
207
325
  cap: number;
208
- /** Page context on/off. Omit when there is no page: the master switch is hidden. */
326
+ /**
327
+ * Page context on/off (the face's eye). With no `hierarchy`, also the
328
+ * header's master switch; with one, the page's switch is its level's
329
+ * (`hierarchy.masters`) and the header has none.
330
+ */
209
331
  on?: boolean | undefined;
210
332
  onToggleAll?: ((next: boolean) => void) | undefined;
333
+ /** Levels and groups with a switch each (see `ContextRulesTable`). */
334
+ hierarchy?: ContextHierarchy | null | undefined;
335
+ onSetInclude?: ((changes: ContextRuleChange[]) => void) | undefined;
211
336
  /** False: this turn's model cannot read context — muted face, no amber. */
212
337
  modelReadsContext?: boolean | undefined;
213
338
  onChange: (key: string, surfaceKey: string, next: SavedContextRule | null) => void;
@@ -223,22 +348,12 @@ interface ContextRulesChipProps {
223
348
  onOpenChange?: (open: boolean) => void;
224
349
  className?: string;
225
350
  }
226
- /**
227
- * The header's "N · chars" total. A row whose size is not known yet (an
228
- * attachment the server has not measured) never counts as 0: with some sizes
229
- * unknown the total is a floor ("1.2k+"), with none known it is "—".
230
- */
231
- declare function summarizeContextRows(rows: readonly ResolvedContextRow[]): {
232
- count: number;
233
- chars: number;
234
- charsLabel: string;
235
- };
236
351
  /**
237
352
  * The composer's value-group chip — far right of the composer's one row — and the surface it opens: a header (label,
238
353
  * "N · chars" summary, page master switch, reset-all, full view) over the
239
354
  * compact rules table. Popover on desktop, bottom sheet on mobile.
240
355
  */
241
- declare function ContextRulesChip({ label, rows, cap, on, onToggleAll, onChange, onResetAll, onOpenFullView, mismatchCount, modelReadsContext, mismatches, onOpenRow, isMobile, readOnly, open: openProp, onOpenChange, className, }: ContextRulesChipProps): react.JSX.Element;
356
+ declare function ContextRulesChip({ label, rows, cap, on, onToggleAll, hierarchy, onSetInclude, onChange, onResetAll, onOpenFullView, mismatchCount, modelReadsContext, mismatches, onOpenRow, isMobile, readOnly, open: openProp, onOpenChange, className, }: ContextRulesChipProps): react.JSX.Element;
242
357
 
243
358
  interface ContextRulesPanelBodyProps {
244
359
  rows: readonly ResolvedContextRow[];
@@ -250,6 +365,9 @@ interface ContextRulesPanelBodyProps {
250
365
  loadView?: ContextViewLoader;
251
366
  readOnly?: boolean | undefined;
252
367
  onChange: (key: string, surfaceKey: string, next: SavedContextRule | null) => void;
368
+ /** Levels and groups with a switch each (see `ContextRulesTable`). */
369
+ hierarchy?: ContextHierarchy | null | undefined;
370
+ onSetInclude?: ((changes: ContextRuleChange[]) => void) | undefined;
253
371
  /** Host content under the built-in controls (a value preview, source link…). */
254
372
  renderDetail?: (row: ResolvedContextRow) => react.ReactNode;
255
373
  isMobile?: boolean;
@@ -263,7 +381,7 @@ interface ContextRulesPanelBodyProps {
263
381
  * the left, the open row's controls, layer breakdown and host detail on the
264
382
  * right. On mobile: list, then detail with Back.
265
383
  */
266
- declare function ContextRulesPanelBody({ rows, cap, mismatches, blocks, loadView, readOnly, onChange, renderDetail, isMobile, selectedKey: selectedProp, onSelectedKeyChange, className, }: ContextRulesPanelBodyProps): react.JSX.Element;
384
+ declare function ContextRulesPanelBody({ rows, cap, mismatches, blocks, loadView, readOnly, onChange, hierarchy, onSetInclude, renderDetail, isMobile, selectedKey: selectedProp, onSelectedKeyChange, className, }: ContextRulesPanelBodyProps): react.JSX.Element;
267
385
 
268
386
  interface InlineMaxInputProps {
269
387
  /** The person's own limit, or null when inherited. */
@@ -335,4 +453,4 @@ declare function ContextReceiptBlockDetail({ block, load, className, }: {
335
453
  className?: string;
336
454
  }): react.JSX.Element;
337
455
 
338
- export { ContextDeliveredValue, ContextReceiptBlockDetail, ContextReceiptBlocks, type ContextReceiptBlocksProps, ContextRulesChip, type ContextRulesChipProps, type ContextRulesDensity, ContextRulesPanelBody, type ContextRulesPanelBodyProps, ContextRulesTable, type ContextRulesTableProps, DeliveredSection, InlineMaxInput, type InlineMaxInputProps, summarizeContextRows };
456
+ export { AI_MATRX_LEVEL, ATTACHED_LEVEL, ContextDeliveredValue, type ContextGroupNode, type ContextGroupRef, type ContextHierarchy, type ContextLevelMaster, type ContextLevelNode, type ContextLevelRef, ContextReceiptBlockDetail, ContextReceiptBlocks, type ContextReceiptBlocksProps, type ContextRowPlace, type ContextRuleChange, ContextRulesChip, type ContextRulesChipProps, type ContextRulesDensity, ContextRulesPanelBody, type ContextRulesPanelBodyProps, ContextRulesTable, type ContextRulesTableProps, DeliveredSection, InlineMaxInput, type InlineMaxInputProps, PAGE_LEVEL, buildContextLevels, includeChanges, inheritedInclude, levelRows, placeByOrigin, summarizeContextRows };