@ai-matrx/content-ir-react 0.11.11 → 0.12.1

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.
@@ -6,6 +6,43 @@ import { DecodedDirective, DirectiveNounCatalog, DirectiveItemKindLookup, KindDe
6
6
  interface DirectiveApplyResult {
7
7
  applied: number;
8
8
  failed: number;
9
+ /**
10
+ * The server's own receipt sentence ("Deleted task “Ship it”."), shown in
11
+ * place of a bare count. Never composed client-side.
12
+ */
13
+ message?: string | null;
14
+ /**
15
+ * The records the apply created or changed, so the tally is a way IN to them
16
+ * (no dead ends). Rendered through `renderRecord`; absent → the sentence alone.
17
+ */
18
+ records?: DirectiveRecordRef[];
19
+ }
20
+ /** One record a directive names: the noun it is, and its id. */
21
+ interface DirectiveRecordRef {
22
+ noun: string;
23
+ id: string;
24
+ }
25
+ interface DirectiveRecordProps extends DirectiveRecordRef {
26
+ /**
27
+ * What to show until (or unless) the host resolves the live name —
28
+ * "Task 1a2b3c4d". Never blank, never "Item".
29
+ */
30
+ fallback: string;
31
+ /** Where it is drawn: an item row, the confirm dialog, or the applied tally. */
32
+ context: "row" | "dialog" | "applied";
33
+ /**
34
+ * True when the record is (about to be) in the trash — the host may still
35
+ * name it but should not promise it opens as a live record.
36
+ */
37
+ trashed?: boolean;
38
+ }
39
+ /** What the person is being asked to approve — everything the card knows. */
40
+ interface DirectiveAskRequest {
41
+ directive: DecodedDirective;
42
+ /** The items, exactly as they will be sent. */
43
+ items: Record<string, unknown>[];
44
+ /** The noun's human label ("Task"), from the host's catalog when it has one. */
45
+ nounLabel: string;
9
46
  }
10
47
  interface DirectiveOpenItemOptions {
11
48
  /** The item, `__kind`-stamped when the shape has an item kind. */
@@ -38,6 +75,22 @@ interface DirectiveHost {
38
75
  __kind: string;
39
76
  items: Record<string, unknown>[];
40
77
  }) => Promise<DirectiveApplyResult>;
78
+ /**
79
+ * Ask the person BEFORE anything runs, naming the consequence (the records,
80
+ * what changes). Resolve `true` to go ahead, `false` to leave the card as it
81
+ * was. The Apply control stays idle while this is open — nothing reads as
82
+ * "applying" until the person has said yes. Absent → `confirm` is called
83
+ * directly (a host that asks inside `confirm` keeps working, but its card
84
+ * will read "Applying…" while its dialog is up).
85
+ */
86
+ ask?: (request: DirectiveAskRequest) => Promise<boolean>;
87
+ /**
88
+ * Draw ONE existing record by its live name, as a way to open it. Used on
89
+ * update/delete rows (the record that will change), in the host's own ask
90
+ * dialog if it likes, and on the applied tally (what was written). Absent →
91
+ * the fallback text, unlinked.
92
+ */
93
+ renderRecord?: (props: DirectiveRecordProps) => ReactNode;
41
94
  /** Open ONE item to read it properly before approving the write. */
42
95
  openItem?: (options: DirectiveOpenItemOptions) => void;
43
96
  /** Host copy controls. */
@@ -549,4 +602,4 @@ interface KindRouteBinding {
549
602
  /** Bind the pure routes to one host's env + owned block types. */
550
603
  declare function createKindRouteBinding(env: KindRouteEnv, options?: KindRouteOptions): KindRouteBinding;
551
604
 
552
- export { resetPartialUnsafeKinds as A, resetSourcelessDbRowReports as B, type ContentIrHost as C, DB_KIND_COMPONENT_KEY as D, resolveAnnouncedKindLoading as E, resolveProvisionalKindRender as F, GENERIC_STRUCTURED_COMPONENT_KEY as G, resolveSupersededKindRender as H, IR_PROVISIONAL_KEY as I, routeEnvOf as J, type KindRouteEnv as K, useDirectiveHost as L, type PartialRenderOptions as P, type StructuredValueRenderProps as S, type KindDefinitionSource as a, type ContentIrRenderSeams as b, DIRECTIVE_BLOCK_TYPE as c, type DirectiveApplyResult as d, type DirectiveCopyProps as e, type DirectiveHost as f, DirectiveHostProvider as g, type DirectiveHostProviderProps as h, type DirectiveOpenItemOptions as i, type GenericFallbackReason as j, IR_ROUTE_KEY as k, type IrRenderBlock as l, type IrRoutableBlock as m, type IrRouteMarker as n, type KindRouteBinding as o, type KindRouteOptions as p, type ProvisionalKindRender as q, type SupersededKindRender as r, applyIrKindRoute as s, createKindRouteBinding as t, envelopeFromPartialKind as u, isPartialReadyKind as v, isProvisionalBlock as w, kindServerDataFromStoredValue as x, markKindPartialUnsafe as y, readIrRouteMarker as z };
605
+ export { kindServerDataFromStoredValue as A, markKindPartialUnsafe as B, type ContentIrHost as C, DB_KIND_COMPONENT_KEY as D, readIrRouteMarker as E, resetPartialUnsafeKinds as F, GENERIC_STRUCTURED_COMPONENT_KEY as G, resetSourcelessDbRowReports as H, IR_PROVISIONAL_KEY as I, resolveAnnouncedKindLoading as J, type KindRouteEnv as K, resolveProvisionalKindRender as L, resolveSupersededKindRender as M, routeEnvOf as N, useDirectiveHost as O, type PartialRenderOptions as P, type StructuredValueRenderProps as S, type KindDefinitionSource as a, type ContentIrRenderSeams as b, DIRECTIVE_BLOCK_TYPE as c, type DirectiveApplyResult as d, type DirectiveAskRequest as e, type DirectiveCopyProps as f, type DirectiveHost as g, DirectiveHostProvider as h, type DirectiveHostProviderProps as i, type DirectiveOpenItemOptions as j, type DirectiveRecordProps as k, type DirectiveRecordRef as l, type GenericFallbackReason as m, IR_ROUTE_KEY as n, type IrRenderBlock as o, type IrRoutableBlock as p, type IrRouteMarker as q, type KindRouteBinding as r, type KindRouteOptions as s, type ProvisionalKindRender as t, type SupersededKindRender as u, applyIrKindRoute as v, createKindRouteBinding as w, envelopeFromPartialKind as x, isPartialReadyKind as y, isProvisionalBlock as z };
@@ -6,6 +6,43 @@ import { DecodedDirective, DirectiveNounCatalog, DirectiveItemKindLookup, KindDe
6
6
  interface DirectiveApplyResult {
7
7
  applied: number;
8
8
  failed: number;
9
+ /**
10
+ * The server's own receipt sentence ("Deleted task “Ship it”."), shown in
11
+ * place of a bare count. Never composed client-side.
12
+ */
13
+ message?: string | null;
14
+ /**
15
+ * The records the apply created or changed, so the tally is a way IN to them
16
+ * (no dead ends). Rendered through `renderRecord`; absent → the sentence alone.
17
+ */
18
+ records?: DirectiveRecordRef[];
19
+ }
20
+ /** One record a directive names: the noun it is, and its id. */
21
+ interface DirectiveRecordRef {
22
+ noun: string;
23
+ id: string;
24
+ }
25
+ interface DirectiveRecordProps extends DirectiveRecordRef {
26
+ /**
27
+ * What to show until (or unless) the host resolves the live name —
28
+ * "Task 1a2b3c4d". Never blank, never "Item".
29
+ */
30
+ fallback: string;
31
+ /** Where it is drawn: an item row, the confirm dialog, or the applied tally. */
32
+ context: "row" | "dialog" | "applied";
33
+ /**
34
+ * True when the record is (about to be) in the trash — the host may still
35
+ * name it but should not promise it opens as a live record.
36
+ */
37
+ trashed?: boolean;
38
+ }
39
+ /** What the person is being asked to approve — everything the card knows. */
40
+ interface DirectiveAskRequest {
41
+ directive: DecodedDirective;
42
+ /** The items, exactly as they will be sent. */
43
+ items: Record<string, unknown>[];
44
+ /** The noun's human label ("Task"), from the host's catalog when it has one. */
45
+ nounLabel: string;
9
46
  }
10
47
  interface DirectiveOpenItemOptions {
11
48
  /** The item, `__kind`-stamped when the shape has an item kind. */
@@ -38,6 +75,22 @@ interface DirectiveHost {
38
75
  __kind: string;
39
76
  items: Record<string, unknown>[];
40
77
  }) => Promise<DirectiveApplyResult>;
78
+ /**
79
+ * Ask the person BEFORE anything runs, naming the consequence (the records,
80
+ * what changes). Resolve `true` to go ahead, `false` to leave the card as it
81
+ * was. The Apply control stays idle while this is open — nothing reads as
82
+ * "applying" until the person has said yes. Absent → `confirm` is called
83
+ * directly (a host that asks inside `confirm` keeps working, but its card
84
+ * will read "Applying…" while its dialog is up).
85
+ */
86
+ ask?: (request: DirectiveAskRequest) => Promise<boolean>;
87
+ /**
88
+ * Draw ONE existing record by its live name, as a way to open it. Used on
89
+ * update/delete rows (the record that will change), in the host's own ask
90
+ * dialog if it likes, and on the applied tally (what was written). Absent →
91
+ * the fallback text, unlinked.
92
+ */
93
+ renderRecord?: (props: DirectiveRecordProps) => ReactNode;
41
94
  /** Open ONE item to read it properly before approving the write. */
42
95
  openItem?: (options: DirectiveOpenItemOptions) => void;
43
96
  /** Host copy controls. */
@@ -549,4 +602,4 @@ interface KindRouteBinding {
549
602
  /** Bind the pure routes to one host's env + owned block types. */
550
603
  declare function createKindRouteBinding(env: KindRouteEnv, options?: KindRouteOptions): KindRouteBinding;
551
604
 
552
- export { resetPartialUnsafeKinds as A, resetSourcelessDbRowReports as B, type ContentIrHost as C, DB_KIND_COMPONENT_KEY as D, resolveAnnouncedKindLoading as E, resolveProvisionalKindRender as F, GENERIC_STRUCTURED_COMPONENT_KEY as G, resolveSupersededKindRender as H, IR_PROVISIONAL_KEY as I, routeEnvOf as J, type KindRouteEnv as K, useDirectiveHost as L, type PartialRenderOptions as P, type StructuredValueRenderProps as S, type KindDefinitionSource as a, type ContentIrRenderSeams as b, DIRECTIVE_BLOCK_TYPE as c, type DirectiveApplyResult as d, type DirectiveCopyProps as e, type DirectiveHost as f, DirectiveHostProvider as g, type DirectiveHostProviderProps as h, type DirectiveOpenItemOptions as i, type GenericFallbackReason as j, IR_ROUTE_KEY as k, type IrRenderBlock as l, type IrRoutableBlock as m, type IrRouteMarker as n, type KindRouteBinding as o, type KindRouteOptions as p, type ProvisionalKindRender as q, type SupersededKindRender as r, applyIrKindRoute as s, createKindRouteBinding as t, envelopeFromPartialKind as u, isPartialReadyKind as v, isProvisionalBlock as w, kindServerDataFromStoredValue as x, markKindPartialUnsafe as y, readIrRouteMarker as z };
605
+ export { kindServerDataFromStoredValue as A, markKindPartialUnsafe as B, type ContentIrHost as C, DB_KIND_COMPONENT_KEY as D, readIrRouteMarker as E, resetPartialUnsafeKinds as F, GENERIC_STRUCTURED_COMPONENT_KEY as G, resetSourcelessDbRowReports as H, IR_PROVISIONAL_KEY as I, resolveAnnouncedKindLoading as J, type KindRouteEnv as K, resolveProvisionalKindRender as L, resolveSupersededKindRender as M, routeEnvOf as N, useDirectiveHost as O, type PartialRenderOptions as P, type StructuredValueRenderProps as S, type KindDefinitionSource as a, type ContentIrRenderSeams as b, DIRECTIVE_BLOCK_TYPE as c, type DirectiveApplyResult as d, type DirectiveAskRequest as e, type DirectiveCopyProps as f, type DirectiveHost as g, DirectiveHostProvider as h, type DirectiveHostProviderProps as i, type DirectiveOpenItemOptions as j, type DirectiveRecordProps as k, type DirectiveRecordRef as l, type GenericFallbackReason as m, IR_ROUTE_KEY as n, type IrRenderBlock as o, type IrRoutableBlock as p, type IrRouteMarker as q, type KindRouteBinding as r, type KindRouteOptions as s, type ProvisionalKindRender as t, type SupersededKindRender as u, applyIrKindRoute as v, createKindRouteBinding as w, envelopeFromPartialKind as x, isPartialReadyKind as y, isProvisionalBlock as z };
package/dist/route.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- export { D as DB_KIND_COMPONENT_KEY, c as DIRECTIVE_BLOCK_TYPE, G as GENERIC_STRUCTURED_COMPONENT_KEY, j as GenericFallbackReason, I as IR_PROVISIONAL_KEY, k as IR_ROUTE_KEY, n as IrRouteMarker, o as KindRouteBinding, p as KindRouteOptions, P as PartialRenderOptions, q as ProvisionalKindRender, r as SupersededKindRender, s as applyIrKindRoute, t as createKindRouteBinding, u as envelopeFromPartialKind, v as isPartialReadyKind, w as isProvisionalBlock, x as kindServerDataFromStoredValue, y as markKindPartialUnsafe, z as readIrRouteMarker, A as resetPartialUnsafeKinds, B as resetSourcelessDbRowReports, E as resolveAnnouncedKindLoading, F as resolveProvisionalKindRender, H as resolveSupersededKindRender } from './route-B9U-9QCw.cjs';
1
+ export { D as DB_KIND_COMPONENT_KEY, c as DIRECTIVE_BLOCK_TYPE, G as GENERIC_STRUCTURED_COMPONENT_KEY, m as GenericFallbackReason, I as IR_PROVISIONAL_KEY, n as IR_ROUTE_KEY, q as IrRouteMarker, r as KindRouteBinding, s as KindRouteOptions, P as PartialRenderOptions, t as ProvisionalKindRender, u as SupersededKindRender, v as applyIrKindRoute, w as createKindRouteBinding, x as envelopeFromPartialKind, y as isPartialReadyKind, z as isProvisionalBlock, A as kindServerDataFromStoredValue, B as markKindPartialUnsafe, E as readIrRouteMarker, F as resetPartialUnsafeKinds, H as resetSourcelessDbRowReports, J as resolveAnnouncedKindLoading, L as resolveProvisionalKindRender, M as resolveSupersededKindRender } from './route-DxK1SoPh.cjs';
2
2
  import './component-resolution.types-DLO2w-0n.cjs';
3
3
  import 'react';
4
4
  import '@ai-matrx/content-ir';
package/dist/route.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { D as DB_KIND_COMPONENT_KEY, c as DIRECTIVE_BLOCK_TYPE, G as GENERIC_STRUCTURED_COMPONENT_KEY, j as GenericFallbackReason, I as IR_PROVISIONAL_KEY, k as IR_ROUTE_KEY, n as IrRouteMarker, o as KindRouteBinding, p as KindRouteOptions, P as PartialRenderOptions, q as ProvisionalKindRender, r as SupersededKindRender, s as applyIrKindRoute, t as createKindRouteBinding, u as envelopeFromPartialKind, v as isPartialReadyKind, w as isProvisionalBlock, x as kindServerDataFromStoredValue, y as markKindPartialUnsafe, z as readIrRouteMarker, A as resetPartialUnsafeKinds, B as resetSourcelessDbRowReports, E as resolveAnnouncedKindLoading, F as resolveProvisionalKindRender, H as resolveSupersededKindRender } from './route-gNpJ8zzW.js';
1
+ export { D as DB_KIND_COMPONENT_KEY, c as DIRECTIVE_BLOCK_TYPE, G as GENERIC_STRUCTURED_COMPONENT_KEY, m as GenericFallbackReason, I as IR_PROVISIONAL_KEY, n as IR_ROUTE_KEY, q as IrRouteMarker, r as KindRouteBinding, s as KindRouteOptions, P as PartialRenderOptions, t as ProvisionalKindRender, u as SupersededKindRender, v as applyIrKindRoute, w as createKindRouteBinding, x as envelopeFromPartialKind, y as isPartialReadyKind, z as isProvisionalBlock, A as kindServerDataFromStoredValue, B as markKindPartialUnsafe, E as readIrRouteMarker, F as resetPartialUnsafeKinds, H as resetSourcelessDbRowReports, J as resolveAnnouncedKindLoading, L as resolveProvisionalKindRender, M as resolveSupersededKindRender } from './route-JGZfl2nL.js';
2
2
  import './component-resolution.types-DLO2w-0n.js';
3
3
  import 'react';
4
4
  import '@ai-matrx/content-ir';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-matrx/content-ir-react",
3
- "version": "0.11.11",
3
+ "version": "0.12.1",
4
4
  "description": "The shared AI Matrx Content IR RENDER layer: kind routing, the component resolver, provisional (streaming) rendering, the runtime-wrapper chrome, and the generic structured floor — as portable React.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -124,7 +124,8 @@
124
124
  "react": ">=19.0.0"
125
125
  },
126
126
  "dependencies": {
127
- "@ai-matrx/content-ir": "latest"
127
+ "@ai-matrx/content-ir": "latest",
128
+ "@ai-matrx/kit": "latest"
128
129
  },
129
130
  "devDependencies": {
130
131
  "@arethetypeswrong/cli": "^0.18.5",
@@ -1,63 +0,0 @@
1
- import * as react from 'react';
2
- import { ReactNode } from 'react';
3
- import { DecodedDirective, DirectiveNounCatalog, DirectiveItemKindLookup } from '@ai-matrx/content-ir';
4
-
5
- interface DirectiveApplyResult {
6
- applied: number;
7
- failed: number;
8
- }
9
- interface DirectiveOpenItemOptions {
10
- /** The item, `__kind`-stamped when the shape has an item kind. */
11
- item: Record<string, unknown>;
12
- /** The content-IR kind this item IS, or null when the shape has none. */
13
- itemKind: string | null;
14
- /** What the item is called — the same title the card shows. */
15
- title: string;
16
- /** "Run Create agent definition · item 1 of 1". */
17
- subtitle: string | null;
18
- directive: DecodedDirective;
19
- index: number;
20
- total: number;
21
- }
22
- interface DirectiveCopyProps {
23
- label: string;
24
- /** The value to copy — the whole shell or one item. */
25
- value: unknown;
26
- /** The item's kind, when copying an item. */
27
- kind?: string | null;
28
- size: "icon" | "xs";
29
- }
30
- interface DirectiveHost {
31
- /**
32
- * Apply a side-effect directive as the user (the server re-validates every
33
- * item against the registered model and runs the ONE handler; idempotent).
34
- * Reject with an Error whose message is safe to show.
35
- */
36
- confirm?: (shell: {
37
- __kind: string;
38
- items: Record<string, unknown>[];
39
- }) => Promise<DirectiveApplyResult>;
40
- /** Open ONE item to read it properly before approving the write. */
41
- openItem?: (options: DirectiveOpenItemOptions) => void;
42
- /** Host copy controls. */
43
- renderCopy?: (props: DirectiveCopyProps) => ReactNode;
44
- /** The mirrored noun catalog (label / family / title column). */
45
- nouns?: DirectiveNounCatalog;
46
- /** slug → the kind ONE item is (THE DIRECTIVE⇄KIND SEAM), or null. */
47
- itemKind?: DirectiveItemKindLookup;
48
- /** Where a decode failure or an unhonourable shell is reported. Default: console.error. */
49
- reportError?: (message: string) => void;
50
- }
51
- interface DirectiveHostProviderProps {
52
- host: DirectiveHost;
53
- children: ReactNode;
54
- }
55
- declare function DirectiveHostProvider({ host, children }: DirectiveHostProviderProps): react.JSX.Element;
56
- /**
57
- * The wired directive host. Unlike the render host this does NOT throw when
58
- * unwired: a directive still renders (named, itemised, copy-less, apply-less)
59
- * — degrading the chrome is honest, hiding the content is not.
60
- */
61
- declare function useDirectiveHost(): DirectiveHost;
62
-
63
- export { type DirectiveApplyResult as D, type DirectiveCopyProps as a, type DirectiveHost as b, DirectiveHostProvider as c, type DirectiveHostProviderProps as d, type DirectiveOpenItemOptions as e, useDirectiveHost as u };
@@ -1,63 +0,0 @@
1
- import * as react from 'react';
2
- import { ReactNode } from 'react';
3
- import { DecodedDirective, DirectiveNounCatalog, DirectiveItemKindLookup } from '@ai-matrx/content-ir';
4
-
5
- interface DirectiveApplyResult {
6
- applied: number;
7
- failed: number;
8
- }
9
- interface DirectiveOpenItemOptions {
10
- /** The item, `__kind`-stamped when the shape has an item kind. */
11
- item: Record<string, unknown>;
12
- /** The content-IR kind this item IS, or null when the shape has none. */
13
- itemKind: string | null;
14
- /** What the item is called — the same title the card shows. */
15
- title: string;
16
- /** "Run Create agent definition · item 1 of 1". */
17
- subtitle: string | null;
18
- directive: DecodedDirective;
19
- index: number;
20
- total: number;
21
- }
22
- interface DirectiveCopyProps {
23
- label: string;
24
- /** The value to copy — the whole shell or one item. */
25
- value: unknown;
26
- /** The item's kind, when copying an item. */
27
- kind?: string | null;
28
- size: "icon" | "xs";
29
- }
30
- interface DirectiveHost {
31
- /**
32
- * Apply a side-effect directive as the user (the server re-validates every
33
- * item against the registered model and runs the ONE handler; idempotent).
34
- * Reject with an Error whose message is safe to show.
35
- */
36
- confirm?: (shell: {
37
- __kind: string;
38
- items: Record<string, unknown>[];
39
- }) => Promise<DirectiveApplyResult>;
40
- /** Open ONE item to read it properly before approving the write. */
41
- openItem?: (options: DirectiveOpenItemOptions) => void;
42
- /** Host copy controls. */
43
- renderCopy?: (props: DirectiveCopyProps) => ReactNode;
44
- /** The mirrored noun catalog (label / family / title column). */
45
- nouns?: DirectiveNounCatalog;
46
- /** slug → the kind ONE item is (THE DIRECTIVE⇄KIND SEAM), or null. */
47
- itemKind?: DirectiveItemKindLookup;
48
- /** Where a decode failure or an unhonourable shell is reported. Default: console.error. */
49
- reportError?: (message: string) => void;
50
- }
51
- interface DirectiveHostProviderProps {
52
- host: DirectiveHost;
53
- children: ReactNode;
54
- }
55
- declare function DirectiveHostProvider({ host, children }: DirectiveHostProviderProps): react.JSX.Element;
56
- /**
57
- * The wired directive host. Unlike the render host this does NOT throw when
58
- * unwired: a directive still renders (named, itemised, copy-less, apply-less)
59
- * — degrading the chrome is honest, hiding the content is not.
60
- */
61
- declare function useDirectiveHost(): DirectiveHost;
62
-
63
- export { type DirectiveApplyResult as D, type DirectiveCopyProps as a, type DirectiveHost as b, DirectiveHostProvider as c, type DirectiveHostProviderProps as d, type DirectiveOpenItemOptions as e, useDirectiveHost as u };