@ai-matrx/content-ir-react 0.10.0 → 0.11.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.
Files changed (40) hide show
  1. package/CHANGELOG.md +67 -0
  2. package/dist/db-component.d.cts +8 -8
  3. package/dist/db-component.d.ts +8 -8
  4. package/dist/directive-host-DAb7Keg8.d.cts +63 -0
  5. package/dist/directive-host-DAb7Keg8.d.ts +63 -0
  6. package/dist/directives.cjs +382 -0
  7. package/dist/directives.cjs.map +1 -0
  8. package/dist/directives.d.cts +70 -0
  9. package/dist/directives.d.ts +70 -0
  10. package/dist/directives.js +369 -0
  11. package/dist/directives.js.map +1 -0
  12. package/dist/{host-types-CDcLW0TD.d.cts → host-types-C8jR31Wk.d.cts} +9 -0
  13. package/dist/{host-types-CpItjcYh.d.ts → host-types-IUEDmso7.d.ts} +9 -0
  14. package/dist/host.cjs +14 -4
  15. package/dist/host.cjs.map +1 -1
  16. package/dist/host.d.cts +5 -4
  17. package/dist/host.d.ts +5 -4
  18. package/dist/host.js +14 -4
  19. package/dist/host.js.map +1 -1
  20. package/dist/index.cjs +474 -47
  21. package/dist/index.cjs.map +1 -1
  22. package/dist/index.d.cts +85 -21
  23. package/dist/index.d.ts +85 -21
  24. package/dist/index.js +479 -36
  25. package/dist/index.js.map +1 -1
  26. package/dist/react.cjs +401 -46
  27. package/dist/react.cjs.map +1 -1
  28. package/dist/react.d.cts +11 -10
  29. package/dist/react.d.ts +11 -10
  30. package/dist/react.js +404 -33
  31. package/dist/react.js.map +1 -1
  32. package/dist/{route-QL2Vqf2e.d.cts → route-B9U-9QCw.d.cts} +117 -3
  33. package/dist/{route-PUuEuEug.d.ts → route-gNpJ8zzW.d.ts} +117 -3
  34. package/dist/route.cjs +52 -2
  35. package/dist/route.cjs.map +1 -1
  36. package/dist/route.d.cts +1 -1
  37. package/dist/route.d.ts +1 -1
  38. package/dist/route.js +55 -2
  39. package/dist/route.js.map +1 -1
  40. package/package.json +15 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,72 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.11.1 — 2026-09-09
4
+
5
+ - **A completed partial kind now hands off directly to its real renderer.**
6
+ Workflow run pages shadow the raw text channel while server-built blocks
7
+ stream, so a `superseded` terminal can arrive on a completed `code` block
8
+ without a verified `__ir` envelope. The shared route now reconstructs a
9
+ render-local complete envelope from the block's closed JSON, verifies that
10
+ its root `__kind` matches the producer-confirmed kind, and routes through the
11
+ normal component path in that same frame. Retracted, malformed, and
12
+ mismatched terminals remain on the host's honest fallback.
13
+
14
+ ### Consumer action
15
+
16
+ - Hosts rendering server-built workflow blocks should call the new
17
+ `resolveSupersededKindRender` binding before ordinary kind routing so a
18
+ finished node cannot flash raw Shape JSON while sibling nodes continue.
19
+
20
+ ## 0.11.0 — 2026-09-08
21
+
22
+ **THE DIRECTIVE TIER — `/directives`.** Every AI Matrx UI draws a Kind
23
+ Directive through ONE renderer, from the package. Until now the side-effect
24
+ card, the fallback floor, the Apply control and the renderer registry with
25
+ THE PREFIX TIER lived only in matrx-frontend (`features/matrx-envelope/`);
26
+ Workflow Studio had none of it and showed the agent builder's
27
+ `directive_v1_action_create_agent_definition` envelope as raw JSON text.
28
+
29
+ - `DirectiveRender` — decode (JSON text or a value) → host-registered
30
+ renderer (exact slug, then class) → `SideEffectDirectiveCard` for every
31
+ create/update/delete/action shape → `DirectiveFallbackCard` for any other
32
+ class. Never null; a non-directive is a raw `<pre>`; an unhonourable shell is
33
+ REPORTED through the host and falls to raw.
34
+ - `SideEffectDirectiveCard` — the card a person approves a write from: named
35
+ from the catalog, one flat row per item titled from authority, scalar fact
36
+ chips, `View` through the host's open seam with `__kind` stamped (THE
37
+ DIRECTIVE⇄KIND SEAM), copy through the host's chrome, Apply through the
38
+ host's confirm seam. `DirectiveFallbackCard` and `ApplyDirectiveButton` are
39
+ exported too. Glyphs are inline SVG (Lucide paths) — this package depends on
40
+ no icon library.
41
+ - `registerDirectiveRenderer` / `getDirectiveRenderer` — the registry on a
42
+ `globalThis` slot; a host registers its bespoke renderers (reference chips,
43
+ plan trees) and they win over the package tier.
44
+ - `DirectiveHostProvider` + `useDirectiveHost` + `DirectiveHost` — the seams:
45
+ `confirm` (absent → the Apply control is ABSENT, never dead), `openItem`,
46
+ `renderCopy`, `nouns`, `itemKind`, `reportError`. `ContentIrHost` gained an
47
+ optional `directives` field and `ContentIrRenderProvider` provides it; a host
48
+ that has not adopted the render provider mounts `DirectiveHostProvider`
49
+ alone.
50
+ - **The route**: `applyIrKindRoute` types a reserved-slug block to
51
+ `DIRECTIVE_BLOCK_TYPE` (`"matrx"`, marker `{ by: "directive" }`) BEFORE the
52
+ component resolver — a directive has no `kind_component` row by design, so
53
+ the `unregistered` / `no-component` floors must never claim one.
54
+ `KindInstanceRender` draws a reserved slug through `DirectiveRender` and
55
+ `kindIsRoutable` answers true for it.
56
+
57
+ ### Consumer action
58
+
59
+ - **matrx-frontend**: `MatrxEnvelopeBlock` becomes a thin wrapper around
60
+ `DirectiveRender`; delete `EnvelopeFallbackCard`, `ApplyDirectiveButton`,
61
+ `directives/sideEffect/{SideEffectDirectiveCard,classIcon}` and the
62
+ registry core in `features/matrx-envelope/registry.tsx` (keep the
63
+ reference-chip / plan-tree / context-groom / create-project registrations,
64
+ now calling the package's `registerDirectiveRenderer`). Wire
65
+ `matrxContentIrHost.directives` (`confirm` → `confirmDirective`, `openItem`
66
+ → the directive-item window, `renderCopy` → `CopyButtons`, `nouns` /
67
+ `itemKind` → the generated catalog tables).
68
+ - **Workflow Studio**: adopted in the same commit (`StudioDirectiveHost`).
69
+
3
70
  ## 0.10.0 — 2026-08-31
4
71
 
5
72
  - **A failed list load is not truth — retry, then settle.** 0.9.0's posture
@@ -1,4 +1,4 @@
1
- import * as React from 'react';
1
+ import * as react from 'react';
2
2
  import { C as ComponentResolution, a as ContentIrErrorReporter } from './component-resolution.types-C1MzCf2s.cjs';
3
3
 
4
4
  /**
@@ -97,7 +97,7 @@ interface DbKindComponentRenderProps {
97
97
  uiOptions?: KindComponentUiOptions;
98
98
  }
99
99
  interface CompiledDbKindComponent {
100
- Component: React.ComponentType<DbKindComponentRenderProps>;
100
+ Component: react.ComponentType<DbKindComponentRenderProps>;
101
101
  /** Compiled `props_transform`, or null when the row declares none. */
102
102
  transform: ((data: unknown) => unknown) | null;
103
103
  }
@@ -147,7 +147,7 @@ type DbKindComponentCompiler = (args: {
147
147
  code: string;
148
148
  allowedImports: string[];
149
149
  }) => {
150
- Component: React.ComponentType<Record<string, unknown>> | null;
150
+ Component: react.ComponentType<Record<string, unknown>> | null;
151
151
  error: string | null;
152
152
  };
153
153
  interface DbKindComponentCachePorts {
@@ -234,8 +234,8 @@ interface DbKindComponentErrorBoundaryProps {
234
234
  kind: string;
235
235
  /** The resolved component's `updated_at`; a change means a new version. */
236
236
  resetSignal: string | null;
237
- fallback: React.ReactNode;
238
- children: React.ReactNode;
237
+ fallback: react.ReactNode;
238
+ children: react.ReactNode;
239
239
  /**
240
240
  * Where the catch lands. A host binds structured capture + incident filing
241
241
  * here; the default screams to the console. NOTE for hosts whose console
@@ -256,12 +256,12 @@ interface State {
256
256
  */
257
257
  signalAtLastRender: string | null;
258
258
  }
259
- declare class DbKindComponentErrorBoundary extends React.Component<DbKindComponentErrorBoundaryProps, State> {
259
+ declare class DbKindComponentErrorBoundary extends react.Component<DbKindComponentErrorBoundaryProps, State> {
260
260
  constructor(props: DbKindComponentErrorBoundaryProps);
261
261
  static getDerivedStateFromError(): Partial<State>;
262
262
  static getDerivedStateFromProps(props: DbKindComponentErrorBoundaryProps, state: State): State | null;
263
- componentDidCatch(error: Error, errorInfo: React.ErrorInfo): void;
264
- render(): React.ReactNode;
263
+ componentDidCatch(error: Error, errorInfo: react.ErrorInfo): void;
264
+ render(): react.ReactNode;
265
265
  }
266
266
 
267
267
  export { type CompiledDbKindComponent, type DbKindActionResult, type DbKindCompileResult, type DbKindComponentCache, type DbKindComponentCachePorts, type DbKindComponentCompiler, DbKindComponentErrorBoundary, type DbKindComponentErrorBoundaryProps, type DbKindComponentIncident, type DbKindComponentIncidentSink, type DbKindComponentIncidentType, type DbKindComponentRenderProps, type KindComponentUiOptions, type ResolveKindValue, type RunDbKindAction, createDbKindComponentCache, isDbKindComponentBodyPending };
@@ -1,4 +1,4 @@
1
- import * as React from 'react';
1
+ import * as react from 'react';
2
2
  import { C as ComponentResolution, a as ContentIrErrorReporter } from './component-resolution.types-C1MzCf2s.js';
3
3
 
4
4
  /**
@@ -97,7 +97,7 @@ interface DbKindComponentRenderProps {
97
97
  uiOptions?: KindComponentUiOptions;
98
98
  }
99
99
  interface CompiledDbKindComponent {
100
- Component: React.ComponentType<DbKindComponentRenderProps>;
100
+ Component: react.ComponentType<DbKindComponentRenderProps>;
101
101
  /** Compiled `props_transform`, or null when the row declares none. */
102
102
  transform: ((data: unknown) => unknown) | null;
103
103
  }
@@ -147,7 +147,7 @@ type DbKindComponentCompiler = (args: {
147
147
  code: string;
148
148
  allowedImports: string[];
149
149
  }) => {
150
- Component: React.ComponentType<Record<string, unknown>> | null;
150
+ Component: react.ComponentType<Record<string, unknown>> | null;
151
151
  error: string | null;
152
152
  };
153
153
  interface DbKindComponentCachePorts {
@@ -234,8 +234,8 @@ interface DbKindComponentErrorBoundaryProps {
234
234
  kind: string;
235
235
  /** The resolved component's `updated_at`; a change means a new version. */
236
236
  resetSignal: string | null;
237
- fallback: React.ReactNode;
238
- children: React.ReactNode;
237
+ fallback: react.ReactNode;
238
+ children: react.ReactNode;
239
239
  /**
240
240
  * Where the catch lands. A host binds structured capture + incident filing
241
241
  * here; the default screams to the console. NOTE for hosts whose console
@@ -256,12 +256,12 @@ interface State {
256
256
  */
257
257
  signalAtLastRender: string | null;
258
258
  }
259
- declare class DbKindComponentErrorBoundary extends React.Component<DbKindComponentErrorBoundaryProps, State> {
259
+ declare class DbKindComponentErrorBoundary extends react.Component<DbKindComponentErrorBoundaryProps, State> {
260
260
  constructor(props: DbKindComponentErrorBoundaryProps);
261
261
  static getDerivedStateFromError(): Partial<State>;
262
262
  static getDerivedStateFromProps(props: DbKindComponentErrorBoundaryProps, state: State): State | null;
263
- componentDidCatch(error: Error, errorInfo: React.ErrorInfo): void;
264
- render(): React.ReactNode;
263
+ componentDidCatch(error: Error, errorInfo: react.ErrorInfo): void;
264
+ render(): react.ReactNode;
265
265
  }
266
266
 
267
267
  export { type CompiledDbKindComponent, type DbKindActionResult, type DbKindCompileResult, type DbKindComponentCache, type DbKindComponentCachePorts, type DbKindComponentCompiler, DbKindComponentErrorBoundary, type DbKindComponentErrorBoundaryProps, type DbKindComponentIncident, type DbKindComponentIncidentSink, type DbKindComponentIncidentType, type DbKindComponentRenderProps, type KindComponentUiOptions, type ResolveKindValue, type RunDbKindAction, createDbKindComponentCache, isDbKindComponentBodyPending };
@@ -0,0 +1,63 @@
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 };
@@ -0,0 +1,63 @@
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 };