@ai-matrx/content-ir-react 0.14.0 → 0.15.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.
@@ -62,6 +62,28 @@ interface DirectiveAskRequest {
62
62
  items: Record<string, unknown>[];
63
63
  /** The noun's human label ("Task"), from the host's catalog when it has one. */
64
64
  nounLabel: string;
65
+ /**
66
+ * True for "Run again": the ledger already holds this block, and a yes runs
67
+ * it a SECOND time (`force`) — another copy for a create, the same fields
68
+ * written again for an update, another delete for a restored record. The
69
+ * question must say so.
70
+ */
71
+ again?: boolean;
72
+ }
73
+ /**
74
+ * The shell a card hands its host — the two keys, plus WHERE it sits.
75
+ *
76
+ * `conversationId` is the conversation the card renders in (a chat message),
77
+ * absent in a person's own content (a note). It is the idempotency NAMESPACE:
78
+ * a card in an agent's message must apply under the SAME key as that
79
+ * proposal's Approve button, or the one action could run twice.
80
+ */
81
+ interface DirectiveShell {
82
+ __kind: string;
83
+ items: Record<string, unknown>[];
84
+ conversationId?: string;
85
+ /** "Run again": skip the ledger's dedup and apply a second time. */
86
+ force?: boolean;
65
87
  }
66
88
  interface DirectiveOpenItemOptions {
67
89
  /** The item, `__kind`-stamped when the shape has an item kind. */
@@ -90,10 +112,7 @@ interface DirectiveHost {
90
112
  * item against the registered model and runs the ONE handler; idempotent).
91
113
  * Reject with an Error whose message is safe to show.
92
114
  */
93
- confirm?: (shell: {
94
- __kind: string;
95
- items: Record<string, unknown>[];
96
- }) => Promise<DirectiveApplyResult>;
115
+ confirm?: (shell: DirectiveShell) => Promise<DirectiveApplyResult>;
97
116
  /**
98
117
  * Ask the person BEFORE anything runs, naming the consequence (the records,
99
118
  * what changes). Resolve `true` to go ahead, `false` to leave the card as it
@@ -113,10 +132,7 @@ interface DirectiveHost {
113
132
  * read: the card reports it and offers Apply, which is safe because `confirm`
114
133
  * is idempotent. Absent → the card starts at Apply, as before.
115
134
  */
116
- applyState?: (shell: {
117
- __kind: string;
118
- items: Record<string, unknown>[];
119
- }) => Promise<DirectiveApplyState>;
135
+ applyState?: (shell: DirectiveShell) => Promise<DirectiveApplyState>;
120
136
  /**
121
137
  * Draw ONE existing record by its live name, as a way to open it. Used on
122
138
  * update/delete rows (the record that will change), in the host's own ask
@@ -135,6 +151,20 @@ interface DirectiveHost {
135
151
  /** Where a decode failure or an unhonourable shell is reported. Default: console.error. */
136
152
  reportError?: (message: string) => void;
137
153
  }
154
+ /** Where a directive renders — today, the conversation it sits in (if any). */
155
+ interface DirectiveScope {
156
+ conversationId?: string | null;
157
+ }
158
+ /**
159
+ * Tell every card below WHERE it renders. A host draws a chat message's
160
+ * directives inside one of these (or passes `conversationId` to
161
+ * `DirectiveRender`), so the card applies in that conversation's namespace —
162
+ * the same key the agent's proposal approves under. A note mounts none.
163
+ */
164
+ declare function DirectiveScopeProvider({ conversationId, children, }: DirectiveScope & {
165
+ children: ReactNode;
166
+ }): react.JSX.Element;
167
+ declare function useDirectiveScope(): DirectiveScope;
138
168
  interface DirectiveHostProviderProps {
139
169
  host: DirectiveHost;
140
170
  children: ReactNode;
@@ -635,4 +665,4 @@ interface KindRouteBinding {
635
665
  /** Bind the pure routes to one host's env + owned block types. */
636
666
  declare function createKindRouteBinding(env: KindRouteEnv, options?: KindRouteOptions): KindRouteBinding;
637
667
 
638
- export { isProvisionalBlock as A, kindServerDataFromStoredValue as B, type ContentIrHost as C, DB_KIND_COMPONENT_KEY as D, markKindPartialUnsafe as E, readIrRouteMarker as F, GENERIC_STRUCTURED_COMPONENT_KEY as G, resetPartialUnsafeKinds as H, IR_PROVISIONAL_KEY as I, resetSourcelessDbRowReports as J, type KindRouteEnv as K, resolveAnnouncedKindLoading as L, resolveProvisionalKindRender as M, resolveSupersededKindRender as N, routeEnvOf as O, type PartialRenderOptions as P, useDirectiveHost as Q, type StructuredValueRenderProps as S, type KindDefinitionSource as a, type ContentIrRenderSeams as b, DIRECTIVE_BLOCK_TYPE as c, type DirectiveApplyResult as d, type DirectiveApplyState as e, type DirectiveAskRequest as f, type DirectiveCopyProps as g, type DirectiveHost as h, DirectiveHostProvider as i, type DirectiveHostProviderProps as j, type DirectiveOpenItemOptions as k, type DirectiveRecordProps as l, type DirectiveRecordRef as m, type GenericFallbackReason as n, IR_ROUTE_KEY as o, type IrRenderBlock as p, type IrRoutableBlock as q, type IrRouteMarker as r, type KindRouteBinding as s, type KindRouteOptions as t, type ProvisionalKindRender as u, type SupersededKindRender as v, applyIrKindRoute as w, createKindRouteBinding as x, envelopeFromPartialKind as y, isPartialReadyKind as z };
668
+ export { createKindRouteBinding as A, envelopeFromPartialKind as B, type ContentIrHost as C, DB_KIND_COMPONENT_KEY as D, isPartialReadyKind as E, isProvisionalBlock as F, GENERIC_STRUCTURED_COMPONENT_KEY as G, kindServerDataFromStoredValue as H, IR_PROVISIONAL_KEY as I, markKindPartialUnsafe as J, type KindRouteEnv as K, readIrRouteMarker as L, resetPartialUnsafeKinds as M, resetSourcelessDbRowReports as N, resolveAnnouncedKindLoading as O, type PartialRenderOptions as P, resolveProvisionalKindRender as Q, resolveSupersededKindRender as R, type StructuredValueRenderProps as S, routeEnvOf as T, useDirectiveHost as U, useDirectiveScope as V, type KindDefinitionSource as a, type ContentIrRenderSeams as b, DIRECTIVE_BLOCK_TYPE as c, type DirectiveApplyResult as d, type DirectiveApplyState as e, type DirectiveAskRequest as f, type DirectiveCopyProps as g, type DirectiveHost as h, DirectiveHostProvider as i, type DirectiveHostProviderProps as j, type DirectiveOpenItemOptions as k, type DirectiveRecordProps as l, type DirectiveRecordRef as m, type DirectiveScope as n, DirectiveScopeProvider as o, type DirectiveShell as p, type GenericFallbackReason as q, IR_ROUTE_KEY as r, type IrRenderBlock as s, type IrRoutableBlock as t, type IrRouteMarker as u, type KindRouteBinding as v, type KindRouteOptions as w, type ProvisionalKindRender as x, type SupersededKindRender as y, applyIrKindRoute as z };
@@ -62,6 +62,28 @@ interface DirectiveAskRequest {
62
62
  items: Record<string, unknown>[];
63
63
  /** The noun's human label ("Task"), from the host's catalog when it has one. */
64
64
  nounLabel: string;
65
+ /**
66
+ * True for "Run again": the ledger already holds this block, and a yes runs
67
+ * it a SECOND time (`force`) — another copy for a create, the same fields
68
+ * written again for an update, another delete for a restored record. The
69
+ * question must say so.
70
+ */
71
+ again?: boolean;
72
+ }
73
+ /**
74
+ * The shell a card hands its host — the two keys, plus WHERE it sits.
75
+ *
76
+ * `conversationId` is the conversation the card renders in (a chat message),
77
+ * absent in a person's own content (a note). It is the idempotency NAMESPACE:
78
+ * a card in an agent's message must apply under the SAME key as that
79
+ * proposal's Approve button, or the one action could run twice.
80
+ */
81
+ interface DirectiveShell {
82
+ __kind: string;
83
+ items: Record<string, unknown>[];
84
+ conversationId?: string;
85
+ /** "Run again": skip the ledger's dedup and apply a second time. */
86
+ force?: boolean;
65
87
  }
66
88
  interface DirectiveOpenItemOptions {
67
89
  /** The item, `__kind`-stamped when the shape has an item kind. */
@@ -90,10 +112,7 @@ interface DirectiveHost {
90
112
  * item against the registered model and runs the ONE handler; idempotent).
91
113
  * Reject with an Error whose message is safe to show.
92
114
  */
93
- confirm?: (shell: {
94
- __kind: string;
95
- items: Record<string, unknown>[];
96
- }) => Promise<DirectiveApplyResult>;
115
+ confirm?: (shell: DirectiveShell) => Promise<DirectiveApplyResult>;
97
116
  /**
98
117
  * Ask the person BEFORE anything runs, naming the consequence (the records,
99
118
  * what changes). Resolve `true` to go ahead, `false` to leave the card as it
@@ -113,10 +132,7 @@ interface DirectiveHost {
113
132
  * read: the card reports it and offers Apply, which is safe because `confirm`
114
133
  * is idempotent. Absent → the card starts at Apply, as before.
115
134
  */
116
- applyState?: (shell: {
117
- __kind: string;
118
- items: Record<string, unknown>[];
119
- }) => Promise<DirectiveApplyState>;
135
+ applyState?: (shell: DirectiveShell) => Promise<DirectiveApplyState>;
120
136
  /**
121
137
  * Draw ONE existing record by its live name, as a way to open it. Used on
122
138
  * update/delete rows (the record that will change), in the host's own ask
@@ -135,6 +151,20 @@ interface DirectiveHost {
135
151
  /** Where a decode failure or an unhonourable shell is reported. Default: console.error. */
136
152
  reportError?: (message: string) => void;
137
153
  }
154
+ /** Where a directive renders — today, the conversation it sits in (if any). */
155
+ interface DirectiveScope {
156
+ conversationId?: string | null;
157
+ }
158
+ /**
159
+ * Tell every card below WHERE it renders. A host draws a chat message's
160
+ * directives inside one of these (or passes `conversationId` to
161
+ * `DirectiveRender`), so the card applies in that conversation's namespace —
162
+ * the same key the agent's proposal approves under. A note mounts none.
163
+ */
164
+ declare function DirectiveScopeProvider({ conversationId, children, }: DirectiveScope & {
165
+ children: ReactNode;
166
+ }): react.JSX.Element;
167
+ declare function useDirectiveScope(): DirectiveScope;
138
168
  interface DirectiveHostProviderProps {
139
169
  host: DirectiveHost;
140
170
  children: ReactNode;
@@ -635,4 +665,4 @@ interface KindRouteBinding {
635
665
  /** Bind the pure routes to one host's env + owned block types. */
636
666
  declare function createKindRouteBinding(env: KindRouteEnv, options?: KindRouteOptions): KindRouteBinding;
637
667
 
638
- export { isProvisionalBlock as A, kindServerDataFromStoredValue as B, type ContentIrHost as C, DB_KIND_COMPONENT_KEY as D, markKindPartialUnsafe as E, readIrRouteMarker as F, GENERIC_STRUCTURED_COMPONENT_KEY as G, resetPartialUnsafeKinds as H, IR_PROVISIONAL_KEY as I, resetSourcelessDbRowReports as J, type KindRouteEnv as K, resolveAnnouncedKindLoading as L, resolveProvisionalKindRender as M, resolveSupersededKindRender as N, routeEnvOf as O, type PartialRenderOptions as P, useDirectiveHost as Q, type StructuredValueRenderProps as S, type KindDefinitionSource as a, type ContentIrRenderSeams as b, DIRECTIVE_BLOCK_TYPE as c, type DirectiveApplyResult as d, type DirectiveApplyState as e, type DirectiveAskRequest as f, type DirectiveCopyProps as g, type DirectiveHost as h, DirectiveHostProvider as i, type DirectiveHostProviderProps as j, type DirectiveOpenItemOptions as k, type DirectiveRecordProps as l, type DirectiveRecordRef as m, type GenericFallbackReason as n, IR_ROUTE_KEY as o, type IrRenderBlock as p, type IrRoutableBlock as q, type IrRouteMarker as r, type KindRouteBinding as s, type KindRouteOptions as t, type ProvisionalKindRender as u, type SupersededKindRender as v, applyIrKindRoute as w, createKindRouteBinding as x, envelopeFromPartialKind as y, isPartialReadyKind as z };
668
+ export { createKindRouteBinding as A, envelopeFromPartialKind as B, type ContentIrHost as C, DB_KIND_COMPONENT_KEY as D, isPartialReadyKind as E, isProvisionalBlock as F, GENERIC_STRUCTURED_COMPONENT_KEY as G, kindServerDataFromStoredValue as H, IR_PROVISIONAL_KEY as I, markKindPartialUnsafe as J, type KindRouteEnv as K, readIrRouteMarker as L, resetPartialUnsafeKinds as M, resetSourcelessDbRowReports as N, resolveAnnouncedKindLoading as O, type PartialRenderOptions as P, resolveProvisionalKindRender as Q, resolveSupersededKindRender as R, type StructuredValueRenderProps as S, routeEnvOf as T, useDirectiveHost as U, useDirectiveScope as V, type KindDefinitionSource as a, type ContentIrRenderSeams as b, DIRECTIVE_BLOCK_TYPE as c, type DirectiveApplyResult as d, type DirectiveApplyState as e, type DirectiveAskRequest as f, type DirectiveCopyProps as g, type DirectiveHost as h, DirectiveHostProvider as i, type DirectiveHostProviderProps as j, type DirectiveOpenItemOptions as k, type DirectiveRecordProps as l, type DirectiveRecordRef as m, type DirectiveScope as n, DirectiveScopeProvider as o, type DirectiveShell as p, type GenericFallbackReason as q, IR_ROUTE_KEY as r, type IrRenderBlock as s, type IrRoutableBlock as t, type IrRouteMarker as u, type KindRouteBinding as v, type KindRouteOptions as w, type ProvisionalKindRender as x, type SupersededKindRender as y, applyIrKindRoute 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, n as GenericFallbackReason, I as IR_PROVISIONAL_KEY, o as IR_ROUTE_KEY, r as IrRouteMarker, s as KindRouteBinding, t as KindRouteOptions, P as PartialRenderOptions, u as ProvisionalKindRender, v as SupersededKindRender, w as applyIrKindRoute, x as createKindRouteBinding, y as envelopeFromPartialKind, z as isPartialReadyKind, A as isProvisionalBlock, B as kindServerDataFromStoredValue, E as markKindPartialUnsafe, F as readIrRouteMarker, H as resetPartialUnsafeKinds, J as resetSourcelessDbRowReports, L as resolveAnnouncedKindLoading, M as resolveProvisionalKindRender, N as resolveSupersededKindRender } from './route-Bf-kciHw.cjs';
1
+ export { D as DB_KIND_COMPONENT_KEY, c as DIRECTIVE_BLOCK_TYPE, G as GENERIC_STRUCTURED_COMPONENT_KEY, q as GenericFallbackReason, I as IR_PROVISIONAL_KEY, r as IR_ROUTE_KEY, u as IrRouteMarker, v as KindRouteBinding, w as KindRouteOptions, P as PartialRenderOptions, x as ProvisionalKindRender, y as SupersededKindRender, z as applyIrKindRoute, A as createKindRouteBinding, B as envelopeFromPartialKind, E as isPartialReadyKind, F as isProvisionalBlock, H as kindServerDataFromStoredValue, J as markKindPartialUnsafe, L as readIrRouteMarker, M as resetPartialUnsafeKinds, N as resetSourcelessDbRowReports, O as resolveAnnouncedKindLoading, Q as resolveProvisionalKindRender, R as resolveSupersededKindRender } from './route-BCtPhF7W.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, n as GenericFallbackReason, I as IR_PROVISIONAL_KEY, o as IR_ROUTE_KEY, r as IrRouteMarker, s as KindRouteBinding, t as KindRouteOptions, P as PartialRenderOptions, u as ProvisionalKindRender, v as SupersededKindRender, w as applyIrKindRoute, x as createKindRouteBinding, y as envelopeFromPartialKind, z as isPartialReadyKind, A as isProvisionalBlock, B as kindServerDataFromStoredValue, E as markKindPartialUnsafe, F as readIrRouteMarker, H as resetPartialUnsafeKinds, J as resetSourcelessDbRowReports, L as resolveAnnouncedKindLoading, M as resolveProvisionalKindRender, N as resolveSupersededKindRender } from './route-ymqupVjr.js';
1
+ export { D as DB_KIND_COMPONENT_KEY, c as DIRECTIVE_BLOCK_TYPE, G as GENERIC_STRUCTURED_COMPONENT_KEY, q as GenericFallbackReason, I as IR_PROVISIONAL_KEY, r as IR_ROUTE_KEY, u as IrRouteMarker, v as KindRouteBinding, w as KindRouteOptions, P as PartialRenderOptions, x as ProvisionalKindRender, y as SupersededKindRender, z as applyIrKindRoute, A as createKindRouteBinding, B as envelopeFromPartialKind, E as isPartialReadyKind, F as isProvisionalBlock, H as kindServerDataFromStoredValue, J as markKindPartialUnsafe, L as readIrRouteMarker, M as resetPartialUnsafeKinds, N as resetSourcelessDbRowReports, O as resolveAnnouncedKindLoading, Q as resolveProvisionalKindRender, R as resolveSupersededKindRender } from './route-DDbgc-ID.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.14.0",
3
+ "version": "0.15.0",
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",