@ai-matrx/content-ir-react 0.10.0 → 0.11.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 (40) hide show
  1. package/CHANGELOG.md +50 -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 +437 -46
  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 +435 -30
  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 +398 -29
  31. package/dist/react.js.map +1 -1
  32. package/dist/{route-QL2Vqf2e.d.cts → route-Bu85A41G.d.cts} +83 -3
  33. package/dist/{route-PUuEuEug.d.ts → route-DoFoDKBn.d.ts} +83 -3
  34. package/dist/route.cjs +14 -0
  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 +15 -0
  39. package/dist/route.js.map +1 -1
  40. package/package.json +15 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,55 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.11.0 — 2026-09-08
4
+
5
+ **THE DIRECTIVE TIER — `/directives`.** Every AI Matrx UI draws a Kind
6
+ Directive through ONE renderer, from the package. Until now the side-effect
7
+ card, the fallback floor, the Apply control and the renderer registry with
8
+ THE PREFIX TIER lived only in matrx-frontend (`features/matrx-envelope/`);
9
+ Workflow Studio had none of it and showed the agent builder's
10
+ `directive_v1_action_create_agent_definition` envelope as raw JSON text.
11
+
12
+ - `DirectiveRender` — decode (JSON text or a value) → host-registered
13
+ renderer (exact slug, then class) → `SideEffectDirectiveCard` for every
14
+ create/update/delete/action shape → `DirectiveFallbackCard` for any other
15
+ class. Never null; a non-directive is a raw `<pre>`; an unhonourable shell is
16
+ REPORTED through the host and falls to raw.
17
+ - `SideEffectDirectiveCard` — the card a person approves a write from: named
18
+ from the catalog, one flat row per item titled from authority, scalar fact
19
+ chips, `View` through the host's open seam with `__kind` stamped (THE
20
+ DIRECTIVE⇄KIND SEAM), copy through the host's chrome, Apply through the
21
+ host's confirm seam. `DirectiveFallbackCard` and `ApplyDirectiveButton` are
22
+ exported too. Glyphs are inline SVG (Lucide paths) — this package depends on
23
+ no icon library.
24
+ - `registerDirectiveRenderer` / `getDirectiveRenderer` — the registry on a
25
+ `globalThis` slot; a host registers its bespoke renderers (reference chips,
26
+ plan trees) and they win over the package tier.
27
+ - `DirectiveHostProvider` + `useDirectiveHost` + `DirectiveHost` — the seams:
28
+ `confirm` (absent → the Apply control is ABSENT, never dead), `openItem`,
29
+ `renderCopy`, `nouns`, `itemKind`, `reportError`. `ContentIrHost` gained an
30
+ optional `directives` field and `ContentIrRenderProvider` provides it; a host
31
+ that has not adopted the render provider mounts `DirectiveHostProvider`
32
+ alone.
33
+ - **The route**: `applyIrKindRoute` types a reserved-slug block to
34
+ `DIRECTIVE_BLOCK_TYPE` (`"matrx"`, marker `{ by: "directive" }`) BEFORE the
35
+ component resolver — a directive has no `kind_component` row by design, so
36
+ the `unregistered` / `no-component` floors must never claim one.
37
+ `KindInstanceRender` draws a reserved slug through `DirectiveRender` and
38
+ `kindIsRoutable` answers true for it.
39
+
40
+ ### Consumer action
41
+
42
+ - **matrx-frontend**: `MatrxEnvelopeBlock` becomes a thin wrapper around
43
+ `DirectiveRender`; delete `EnvelopeFallbackCard`, `ApplyDirectiveButton`,
44
+ `directives/sideEffect/{SideEffectDirectiveCard,classIcon}` and the
45
+ registry core in `features/matrx-envelope/registry.tsx` (keep the
46
+ reference-chip / plan-tree / context-groom / create-project registrations,
47
+ now calling the package's `registerDirectiveRenderer`). Wire
48
+ `matrxContentIrHost.directives` (`confirm` → `confirmDirective`, `openItem`
49
+ → the directive-item window, `renderCopy` → `CopyButtons`, `nouns` /
50
+ `itemKind` → the generated catalog tables).
51
+ - **Workflow Studio**: adopted in the same commit (`StudioDirectiveHost`).
52
+
3
53
  ## 0.10.0 — 2026-08-31
4
54
 
5
55
  - **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 };