mythik 0.1.4 → 0.2.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 (97) hide show
  1. package/README.md +72 -38
  2. package/dist/actions/dispatcher.d.ts.map +1 -1
  3. package/dist/actions/dispatcher.js +8 -1
  4. package/dist/actions/dispatcher.js.map +1 -1
  5. package/dist/actions/transaction-engine.d.ts +10 -0
  6. package/dist/actions/transaction-engine.d.ts.map +1 -1
  7. package/dist/actions/transaction-engine.js +13 -1
  8. package/dist/actions/transaction-engine.js.map +1 -1
  9. package/dist/agent-context/inventory.d.ts +62 -0
  10. package/dist/agent-context/inventory.d.ts.map +1 -0
  11. package/dist/agent-context/inventory.js +248 -0
  12. package/dist/agent-context/inventory.js.map +1 -0
  13. package/dist/data/data-sources.d.ts +12 -0
  14. package/dist/data/data-sources.d.ts.map +1 -1
  15. package/dist/data/data-sources.js +13 -0
  16. package/dist/data/data-sources.js.map +1 -1
  17. package/dist/design/background/patterns/resolver.d.ts.map +1 -1
  18. package/dist/design/background/patterns/resolver.js +5 -1
  19. package/dist/design/background/patterns/resolver.js.map +1 -1
  20. package/dist/design/background/sanitizer.d.ts.map +1 -1
  21. package/dist/design/background/sanitizer.js +64 -16
  22. package/dist/design/background/sanitizer.js.map +1 -1
  23. package/dist/index.d.ts +12 -2
  24. package/dist/index.d.ts.map +1 -1
  25. package/dist/index.js +5 -0
  26. package/dist/index.js.map +1 -1
  27. package/dist/renderer/deps.d.ts.map +1 -1
  28. package/dist/renderer/deps.js +4 -0
  29. package/dist/renderer/deps.js.map +1 -1
  30. package/dist/reveal/context.d.ts +22 -0
  31. package/dist/reveal/context.d.ts.map +1 -0
  32. package/dist/reveal/context.js +159 -0
  33. package/dist/reveal/context.js.map +1 -0
  34. package/dist/reveal/index.d.ts +7 -0
  35. package/dist/reveal/index.d.ts.map +1 -0
  36. package/dist/reveal/index.js +7 -0
  37. package/dist/reveal/index.js.map +1 -0
  38. package/dist/reveal/protocol.d.ts +28 -0
  39. package/dist/reveal/protocol.d.ts.map +1 -0
  40. package/dist/reveal/protocol.js +2 -0
  41. package/dist/reveal/protocol.js.map +1 -0
  42. package/dist/reveal/recorder.d.ts +20 -0
  43. package/dist/reveal/recorder.d.ts.map +1 -0
  44. package/dist/reveal/recorder.js +31 -0
  45. package/dist/reveal/recorder.js.map +1 -0
  46. package/dist/reveal/redaction.d.ts +12 -0
  47. package/dist/reveal/redaction.d.ts.map +1 -0
  48. package/dist/reveal/redaction.js +85 -0
  49. package/dist/reveal/redaction.js.map +1 -0
  50. package/dist/reveal/truncation.d.ts +4 -0
  51. package/dist/reveal/truncation.d.ts.map +1 -0
  52. package/dist/reveal/truncation.js +48 -0
  53. package/dist/reveal/truncation.js.map +1 -0
  54. package/dist/reveal/types.d.ts +104 -0
  55. package/dist/reveal/types.d.ts.map +1 -0
  56. package/dist/reveal/types.js +2 -0
  57. package/dist/reveal/types.js.map +1 -0
  58. package/dist/runtime/mount-spec-runtime.d.ts +5 -0
  59. package/dist/runtime/mount-spec-runtime.d.ts.map +1 -1
  60. package/dist/runtime/mount-spec-runtime.js +1 -0
  61. package/dist/runtime/mount-spec-runtime.js.map +1 -1
  62. package/docs/consumer/README.md +11 -0
  63. package/docs/consumer/WHERE-TO-LOOK.md +2 -2
  64. package/docs/consumer/ai-context-runtime-semantics.md +15 -12
  65. package/docs/consumer/ai-context.md +99 -23
  66. package/docs/consumer/reference-doc.md +134 -35
  67. package/docs/llms.txt +6 -1
  68. package/docs/wiki/compiled/README.md +9 -7
  69. package/docs/wiki/compiled/_gaps.md +1 -1
  70. package/docs/wiki/compiled/_index.md +11 -7
  71. package/docs/wiki/compiled/_inventory.md +22 -14
  72. package/docs/wiki/compiled/_lint.md +21 -17
  73. package/docs/wiki/compiled/antipattern-store-save-bypass.md +13 -8
  74. package/docs/wiki/compiled/cli-agent.md +70 -0
  75. package/docs/wiki/compiled/cli-existing-spec-edit-loop.md +9 -8
  76. package/docs/wiki/compiled/cli-overview.md +12 -7
  77. package/docs/wiki/compiled/cli-patch.md +14 -11
  78. package/docs/wiki/compiled/cli-programmatic-api.md +17 -7
  79. package/docs/wiki/compiled/cli-push.md +36 -24
  80. package/docs/wiki/compiled/cli-reveal.md +64 -0
  81. package/docs/wiki/compiled/cli-toon.md +9 -9
  82. package/docs/wiki/compiled/cli-versioning-author.md +19 -15
  83. package/docs/wiki/compiled/concept-agent-context-protocol.md +76 -0
  84. package/docs/wiki/compiled/concept-background-layer-kinds.md +1 -1
  85. package/docs/wiki/compiled/concept-mythik-reveal.md +63 -0
  86. package/docs/wiki/compiled/concept-package-layout.md +7 -6
  87. package/docs/wiki/compiled/concept-pattern-primitives.md +2 -2
  88. package/docs/wiki/compiled/concept-public-package-names.md +9 -5
  89. package/docs/wiki/compiled/concept-shape-animations.md +4 -2
  90. package/docs/wiki/compiled/concept-spec-store-interface.md +7 -4
  91. package/docs/wiki/compiled/concept-spec-store-layering.md +5 -5
  92. package/docs/wiki/compiled/concept-versioned-store.md +8 -5
  93. package/docs/wiki/compiled/expression-platform.md +14 -6
  94. package/docs/wiki/compiled/pattern-git-vs-db-versioning.md +8 -6
  95. package/docs/wiki/compiled/pattern-push-vs-patch.md +13 -12
  96. package/docs/wiki/compiled/primitive-screen.md +9 -3
  97. package/package.json +3 -4
@@ -0,0 +1,104 @@
1
+ export type RevealRendererKind = 'react' | 'react-native' | 'server' | 'unknown';
2
+ export type RevealRequestKind = 'context' | 'current' | 'screen' | 'element';
3
+ export type RevealEventKind = 'action' | 'transaction' | 'dataSource' | 'renderError' | 'navigation' | 'lifecycle';
4
+ export interface RevealRedactionPolicy {
5
+ sensitiveKeys?: string[];
6
+ includePaths?: string[];
7
+ redactPaths?: string[];
8
+ }
9
+ export interface RevealLimits {
10
+ maxBytes?: number;
11
+ maxEvents?: number;
12
+ maxStateValueBytes?: number;
13
+ }
14
+ export interface RevealContextRequestSummary {
15
+ kind: RevealRequestKind;
16
+ screenId?: string;
17
+ elementId?: string;
18
+ }
19
+ export interface RevealRuntimeSummary {
20
+ renderer: RevealRendererKind;
21
+ appName?: string;
22
+ dev: boolean;
23
+ url?: string;
24
+ platform?: string;
25
+ }
26
+ export interface RevealEnvironmentSummary {
27
+ id: string;
28
+ label?: string;
29
+ source: 'host' | 'store' | 'implicit';
30
+ storeKind?: string;
31
+ specId?: string;
32
+ loadedVersion?: number | string;
33
+ pointerVersion?: number | string;
34
+ }
35
+ export interface RevealSpecSummary {
36
+ root: string;
37
+ screenId?: string;
38
+ elementCount: number;
39
+ templateCount?: number;
40
+ dataSourceCount?: number;
41
+ editorSessionCount?: number;
42
+ }
43
+ export interface RevealElementSummary {
44
+ id: string;
45
+ type: string;
46
+ childIds: string[];
47
+ dependencies: string[];
48
+ resolvedProps?: Record<string, unknown>;
49
+ visible?: unknown;
50
+ }
51
+ export interface RevealStateSummary {
52
+ included: Record<string, unknown>;
53
+ omitted: string[];
54
+ }
55
+ export interface RevealDiagnosticsSummary {
56
+ renderErrors: unknown[];
57
+ warnings: string[];
58
+ }
59
+ export interface RevealEventSummary {
60
+ id: string;
61
+ kind: RevealEventKind;
62
+ at: string;
63
+ label: string;
64
+ status?: 'start' | 'success' | 'error' | 'rollback' | 'deferred';
65
+ details?: Record<string, unknown>;
66
+ }
67
+ export interface RevealPatchTarget {
68
+ canPatch: boolean;
69
+ screenId?: string;
70
+ environmentId?: string;
71
+ baseVersion?: number | string;
72
+ reason?: string;
73
+ }
74
+ export interface RevealRedactionSummary {
75
+ redactedPaths: string[];
76
+ redactedKeys: string[];
77
+ }
78
+ export interface RevealLimitsSummary {
79
+ maxBytes: number;
80
+ maxEvents: number;
81
+ truncated: boolean;
82
+ reason?: string;
83
+ }
84
+ export interface RevealContext {
85
+ kind: 'mythik.reveal.context';
86
+ schemaVersion: 1;
87
+ generatedAt: string;
88
+ request: RevealContextRequestSummary;
89
+ runtime: RevealRuntimeSummary;
90
+ environment: RevealEnvironmentSummary;
91
+ spec: RevealSpecSummary;
92
+ screen?: {
93
+ id: string;
94
+ root: string;
95
+ };
96
+ element?: RevealElementSummary;
97
+ state: RevealStateSummary;
98
+ diagnostics: RevealDiagnosticsSummary;
99
+ events: unknown[];
100
+ patchTarget: RevealPatchTarget;
101
+ redaction: RevealRedactionSummary;
102
+ limits: RevealLimitsSummary;
103
+ }
104
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/reveal/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,kBAAkB,GAAG,OAAO,GAAG,cAAc,GAAG,QAAQ,GAAG,SAAS,CAAC;AACjF,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,CAAC;AAC7E,MAAM,MAAM,eAAe,GACvB,QAAQ,GACR,aAAa,GACb,YAAY,GACZ,aAAa,GACb,YAAY,GACZ,WAAW,CAAC;AAEhB,MAAM,WAAW,qBAAqB;IACpC,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;CACxB;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,MAAM,WAAW,2BAA2B;IAC1C,IAAI,EAAE,iBAAiB,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,OAAO,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW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types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/reveal/types.ts"],"names":[],"mappings":""}
@@ -1,3 +1,4 @@
1
+ import { type DataSourcesObserver } from '../data/data-sources.js';
1
2
  import type { EditorSessionEngine } from '../editor-session/types.js';
2
3
  import type { Spec } from '../types.js';
3
4
  import type { StateStore } from '../state/store.js';
@@ -50,6 +51,10 @@ export interface MountSpecRuntimeDeps {
50
51
  json: () => Promise<unknown>;
51
52
  }>;
52
53
  urlGuard?: UrlGuard;
54
+ reveal?: RevealRuntimeHooks;
55
+ }
56
+ export interface RevealRuntimeHooks {
57
+ dataSources?: DataSourcesObserver;
53
58
  }
54
59
  export interface SpecRuntime {
55
60
  unmount: () => void;
@@ -1 +1 @@
1
- {"version":3,"file":"mount-spec-runtime.d.ts","sourceRoot":"","sources":["../../src/runtime/mount-spec-runtime.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AACzE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAG7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,UAAU,CAAC;IAClB,QAAQ,EAAE,QAAQ,CAAC;IACnB,UAAU,EAAE,wBAAwB,CAAC;IACrC,kBAAkB,EAAE,kBAAkB,CAAC;IACvC,kFAAkF;IAClF,OAAO,CAAC,EAAE,CAAC,GAAG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AClF,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC;QAAE,EAAE,EAAE,OAAO,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAA;KAAE,CAAC,CAAC;IACzH,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,MAAM,CAAC,EAAE,kBAAkB,CAAC;CAC7B;AAED,MAAM,WAAW,kBAAkB;IACjC,WAAW,CAAC,EAAE,mBAAmB,CAAC;CACnC;AAED,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,mBAAmB,CAAC,EAAE,mBAAmB,GAAG,IAAI,CAAC;CAClD;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,oBAAoB,GAAG,WAAW,CA6EpF"}
@@ -45,6 +45,7 @@ export function mountSpecRuntime(spec, deps) {
45
45
  resolver,
46
46
  dataSources: spec.dataSources,
47
47
  fetcher,
48
+ observer: deps.reveal?.dataSources,
48
49
  });
49
50
  // Register refreshDataSource action with the per-renderer dispatcher
50
51
  // (silent overwrite via Map.set — safe across re-mounts within same renderer).
@@ -1 +1 @@
1
- {"version":3,"file":"mount-spec-runtime.js","sourceRoot":"","sources":["../../src/runtime/mount-spec-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAqB,MAAM,wBAAwB,CAAC;AAC/E,OAAO,EAAE,uBAAuB,EAA0B,MAAM,yBAAyB,CAAC;AAC1F,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAQxE,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAmD5D,MAAM,UAAU,gBAAgB,CAAC,IAAU,EAAE,IAA0B;IACrE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,kBAAkB,EA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QACL,mBAAmB;QACnB,OAAO;YACL,gBAAgB;YAChB,iBAAiB,EAAE,OAAO,EAAE,CAAC;YAC7B,mBAAmB,EAAE,OAAO,EAAE,CAAC;YAC/B,mBAAmB,GAAG,IAAI,CAAC;YAC3B,kEAAkE;YAClE,KAAK,IAAI,CAAC,GAAG,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;gBAC9C,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC;YAChB,CAAC;YACD,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC;YACpB,YAAY,EAAE,OAAO,EAAE,CAAC;YACxB,wEAAwE;YACxE,YAAY,GAAG,IAAI,CAAC;YACpB,iBAAiB,GAAG,IAAI,CAAC;QAC3B,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -15,6 +15,17 @@ Everything an AI or developer building apps with Mythik needs. **This is the pub
15
15
  | `reference-doc.md` | Full rule catalog — exhaustive consumer-facing reference |
16
16
  | `WHERE-TO-LOOK.md` | Source navigation map — which framework file to read for deep-customization or runtime-debugging cases the docs above do not fully cover. Fallback only; check the relevant `ai-context-*.md` first. |
17
17
 
18
+ Mythik Reveal is documented in `ai-context.md` and `reference-doc.md`.
19
+ For runtime debugging, agents should use Reveal before guessing from
20
+ source files: it exposes the running app's live contract, selected
21
+ state, events, diagnostics, and render errors as structured context.
22
+
23
+ Mythik Agent Context and Agent Protocol are documented in `ai-context.md`
24
+ and `reference-doc.md`. Fresh agents should run `mythik agent init ...`
25
+ and `mythik agent context ...` before editing specs so the active store,
26
+ required CLI loop, lint scope, TOON guidance, and local-file source-of-truth
27
+ rules are explicit in the project.
28
+
18
29
  ## Reading order
19
30
 
20
31
  For first-time spec generation: `ai-context.md` is the entry point. It declares the other files as companion modules to read on demand.
@@ -16,14 +16,14 @@ This file maps **"I need to understand or customize X"** to which framework sour
16
16
  - Rule lookup → `reference-doc.md`.
17
17
  - ApiSpec / server contract surface → `ai-context-api.md`.
18
18
  - Runtime behavior reference (timing matrix, reserved state paths, store coordination) → `ai-context-runtime-semantics.md`. **Read this before reaching for source.**
19
- - Routine edits to an existing persisted spec. Use the CLI loop instead: `mythik manifest <id>` -> `mythik elements <id> <ids>` -> `mythik patch <id> --from-file patch.json` -> verify. Source reading is not a substitute for inspecting the live persisted spec.
19
+ - Routine edits to an existing persisted spec. Use the CLI loop instead: `mythik manifest <id>` -> `mythik elements <id> <ids>` -> `mythik patch <id> --from-file patch.json --author <agent>` -> validate -> verify. Source reading is not a substitute for inspecting the live persisted spec.
20
20
 
21
21
  ## How source paths in this file work
22
22
 
23
23
  Paths are relative to the framework repo root and use the layout the framework publishes in.
24
24
 
25
25
  - **In the framework repo (or unpacked tarball):** `packages/<package>/src/<path>` — TypeScript source. Authoritative for behavior questions.
26
- - **In `node_modules/<public-mythik-package>/`:** the published artifact ships `dist/` only (compiled `.js` + `.d.ts`). `.d.ts` is enough for type-shape questions; for behavior questions, fetch the `src/` from the GitHub repo or the unpacked tarball. Public package names are unscoped (`mythik`, `mythik-react`, `mythik-cli`, and `mythik-server`). React Native work is a repository preview track, not part of the supported npm publish surface yet.
26
+ - **In `node_modules/<public-mythik-package>/`:** the published artifact ships `dist/` only (compiled `.js` + `.d.ts`). `.d.ts` is enough for type-shape questions; for behavior questions, fetch the `src/` from the GitHub repo or the unpacked tarball. Public package names are unscoped (`mythik`, `mythik-react`, `mythik-cli`, `mythik-server`, and `mythik-react-native`). React Native support has an explicit primitive support matrix; do not assume unsupported web primitives render natively.
27
27
 
28
28
  When in doubt, prefer reading `src/`. `dist/` is generated and may obscure intent (minified, stripped comments, transpiled control flow).
29
29
 
@@ -375,7 +375,7 @@ The framework auto-tracks device context and writes to `/ui/device/*`:
375
375
  - `/ui/device/orientation` — `"portrait"` | `"landscape"` (updated on orientation change)
376
376
  - `/ui/device/colorScheme` — `"light"` | `"dark"` (OS color scheme)
377
377
 
378
- **Read pattern:** prefer the dedicated expressions `$breakpoint` (for responsive values), `$platform` (for cross-platform branching) over direct state reads. These expressions abstract over the paths and handle default fallbacks (reference-doc rule 37).
378
+ **Read pattern:** prefer the dedicated expressions `$breakpoint` (for responsive values), `$platform` (for cross-platform branching) over direct state reads. These expressions abstract over the device paths and participate in render-cache invalidation (reference-doc rule 37). `$platform` matches exact platform keys first, falls back from `ios`/`android` to `native`, and resolves to `undefined` when no key matches; it does not have a `default` key.
379
379
 
380
380
  **Write-owner:** device context hook (React-side). Not configurable by consumer specs.
381
381
 
@@ -755,12 +755,12 @@ The persistence layer has distinct paths used at different levels. Understanding
755
755
  - **`store.save(id, doc)`** - low-level persistence primitive. Accepts `doc: unknown`. No validation. Called by validated orchestration after checks succeed. **Never called from application code** - treat as `@internal`. Calling `store.save()` from your app bypasses validation and produces silently-broken specs.
756
756
  - **`store.saveVersion(id, doc, meta)`** - versioned write. Writes a row to `screen_versions` table and updates the current spec. Enables diff/rollback/promote/bisect.
757
757
  - **`SpecEngine.patch(id, patches)`** - validated orchestration. Applies RFC-6902 patches, runs DocumentHandler validation, short-circuits on error, and persists the patched document through `store.save`.
758
- - **CLI/API `mythik push` / `runPush`** - validates and handles `--author` / `author` by writing through `saveVersion` when the resolved store is versioned.
759
- - **CLI/API `mythik patch` / `runPatch`** - uses `SpecEngine.patch` for patch application + validation. Without `author`, it persists through the normal `store.save` path. With a versioned store + `author`, it captures the patched document and writes once through `saveVersion`, so lazy bootstrap preserves the pre-patch current spec as v1 and the patch becomes the next version. JSON/TOON success output includes `versioned: boolean` and `version?: number`.
758
+ - **CLI/API `mythik push` / `runPush`** - validates and handles `--author` / `author` by writing through `saveVersion` when the resolved store is versioned. Existing specs require explicit `--replace` for full replacement.
759
+ - **CLI/API `mythik patch` / `runPatch`** - uses `SpecEngine.patch` for patch application + validation. With a versioned store + `author`, it captures the patched document and writes once through `saveVersion`, so lazy bootstrap preserves the pre-patch current spec as v1 and the patch becomes the next version. JSON/TOON success output includes `versioned: boolean` and `version?: number`. Without `author`, persisted writes are rejected unless `allowUnversioned` / `--allow-unversioned` is explicit.
760
760
 
761
761
  **Consumer rule (to be enforced by Item I linter):** never call `store.save()` from application code. Use:
762
762
 
763
- - `mythik push <id>` / `mythik patch <id>` for interactive/shell work
763
+ - `mythik push <id> --from-file spec.json --author <name>` / `mythik patch <id> --from-file patch.json --author <name>` for interactive/shell work
764
764
  - `runPush` / `runPatch` from `mythik-cli/api` for programmatic work (Item F exposes these as public exports)
765
765
 
766
766
  Implementation:
@@ -810,14 +810,14 @@ The framework supports two axes of workflow choice: **how you modify specs** (pu
810
810
  **Push paradigm:**
811
811
 
812
812
  - Specs live in git under `specs/*.json`
813
- - Modify locally, run `mythik push <id>`, CLI sends the full spec doc to the DB
813
+ - Modify locally, run `mythik push <id> --from-file spec.json --author <name>`, CLI sends the full spec doc to the DB
814
814
  - Diff-reviewable in CI (normal git diff on the JSON file)
815
815
  - Full-spec bandwidth cost per write
816
816
 
817
817
  **Patch paradigm:**
818
818
 
819
819
  - Specs live in the DB; local files are optional (working copy)
820
- - Modify via `mythik patch <id> --from-file patch.json` for shell-safe surgical writes
820
+ - Modify via `mythik patch <id> --from-file patch.json --author <name>` for shell-safe surgical writes
821
821
  - ~11x token efficiency vs full push (framework-internal measurement for typical single-element edits)
822
822
  - Requires `mythik pull <id>` to sync any local `specs/*.json` snapshot after a DB patch
823
823
 
@@ -837,12 +837,15 @@ The framework supports two axes of workflow choice: **how you modify specs** (pu
837
837
 
838
838
  ### 6.2 Git-backed vs DB-versioned history
839
839
 
840
- **Git-backed history:**
841
-
842
- - Specs in repo, `git log` + `git blame` serve as audit trail
843
- - No `--author` flag needed on push/patch
844
- - CLI writes via `store.save` (unversioned path, see §5.4)
845
- - Best for: single-env apps, dev-loop iteration, specs-as-code
840
+ **Git-backed history:**
841
+
842
+ - Specs in repo, `git log` + `git blame` serve as audit trail
843
+ - Persisted CLI writes must still be explicit: use `--author <name>`
844
+ whenever the resolved store supports versioning, or
845
+ `--allow-unversioned` only when the project intentionally uses a
846
+ non-versioned store
847
+ - CLI writes via `store.save` only on the explicit unversioned path (see §5.4)
848
+ - Best for: single-env apps, dev-loop iteration, specs-as-code
846
849
 
847
850
  **DB-versioned history:**
848
851
 
@@ -108,10 +108,17 @@ mythik init-store --dialect postgres --dry-run # Print SQL store DDL f
108
108
  mythik init-store --dialect sqlserver --server localhost --database Mythik --user "$DB_USER" --password "$DB_PASSWORD" --encrypt false --trust-server-certificate
109
109
  mythik manifest <screen> # See structural tree
110
110
  mythik elements <screen> <id1,id2> # Get element details
111
- mythik patch <screen> --from-file patch.json # Apply RFC 6902 patches
112
- mythik pull <screen> # Export full spec for backup/review
113
- mythik push <screen> # Create or intentionally replace a full spec
114
- mythik validate <screen> # Validate spec
111
+ mythik patch <screen> --from-file patch.json --author <agent> # Apply versioned RFC 6902 patches
112
+ mythik pull <screen> # Export full spec for backup/review
113
+ mythik push <screen> --from-file spec.json --author <agent> # Create a new spec
114
+ mythik push <screen> --from-file spec.json --replace --author <agent> # Intentional full replacement
115
+ mythik validate <screen> # Validate spec
116
+ mythik reveal start # Start local runtime context bridge
117
+ mythik reveal apps --json # List connected running apps
118
+ mythik reveal context --app <name> # Read live app contract/state/diagnostics
119
+ mythik reveal element <id> --app <name> # Inspect one live element
120
+ mythik agent init codex|claude|all # Install project-local AI operating protocol
121
+ mythik agent context --app <app-id> --include-screens --out .mythik/agent/context.md
115
122
  ```
116
123
 
117
124
  ### Required edit loop for existing specs
@@ -121,20 +128,76 @@ When an AI agent modifies an existing Mythik spec, use this loop by default:
121
128
  1. `mythik manifest <screen>` - inspect the current structure and identify candidate element IDs.
122
129
  2. `mythik elements <screen> <id1,id2,...>` - inspect only the exact elements and nearby containers that will change.
123
130
  3. Write a small RFC 6902 patch file.
124
- 4. `mythik patch <screen> --from-file patch.json` - apply the surgical change through the validated CLI path.
125
- 5. Re-run `mythik manifest <screen>` or `mythik elements <screen> <ids>` to verify the changed surface.
131
+ 4. `mythik patch <screen> --from-file patch.json --author <agent>` - apply the surgical change through the validated, versioned CLI path.
132
+ 5. Run `mythik validate <screen>`.
133
+ 6. Re-run `mythik manifest <screen>` or `mythik elements <screen> <ids>` to verify the changed surface.
134
+
135
+ Do not edit database rows directly, do not call `SpecStore.save()` from app code, and do not replace a whole screen with `push` when a targeted `patch` can express the change. `pull` is for backup, migration, review, or full-spec creation workflows; it is not the normal first step for a small edit.
126
136
 
127
- Do not edit database rows directly, do not call `SpecStore.save()` from app code, and do not replace a whole screen with `push` when a targeted `patch` can express the change. `pull` is for backup, migration, review, or full-spec creation workflows; it is not the normal first step for a small edit.
137
+ **Patch rules:** `"op": "add"` with numeric index **inserts before** (not replace). Use `/-` to append. Use `"op": "replace"` to overwrite. Prefer `mythik patch <id> --from-file patch.json --author <agent>` for any patch containing `$state`, `$template`, `$auth`, or other shell-sensitive strings.
128
138
 
129
- **Patch rules:** `"op": "add"` with numeric index **inserts before** (not replace). Use `/-` to append. Use `"op": "replace"` to overwrite. Prefer `mythik patch <id> --from-file patch.json` for any patch containing `$state`, `$template`, `$auth`, or other shell-sensitive strings.
130
-
131
- **Patch input precedence:** explicit sources win. `--from-file <path>` reads that file even if the host process has non-TTY stdin (common in PowerShell/agent runners). Stdin still works via `--from-file -` or by piping without `--from-file`: `cat patch.json | mythik patch <id>`.
139
+ **Patch input precedence:** explicit sources win. `--from-file <path>` reads that file even if the host process has non-TTY stdin (common in PowerShell/agent runners). Stdin still works via `--from-file -` or by piping without `--from-file`: `cat patch.json | mythik patch <id> --author <agent>`.
132
140
 
133
141
  All commands accept `--json`, `--table <name>`, `--store`, `--url`, `--key`. Never pass API keys inline — use `.mythikrc` + env vars.
134
142
 
143
+ ### Mythik Reveal: live context for AI agents
144
+
145
+ Use Mythik Reveal when debugging or changing a running app. Lint,
146
+ validate, `manifest`, and `elements` inspect stored specs; Reveal
147
+ inspects the live runtime. It exposes the active renderer, environment,
148
+ mounted spec summary, selected screen/element, resolved public props,
149
+ included state paths, render errors, warnings, and action/dataSource
150
+ events as structured JSON.
151
+
152
+ Start the local bridge:
153
+
154
+ ```bash
155
+ mythik reveal start --port 17373
156
+ ```
157
+
158
+ Pass the printed `MYTHIK_REVEAL_URL` and `MYTHIK_REVEAL_TOKEN` to the
159
+ host app's `reveal` config. In React, memoize the object so the bridge
160
+ client is stable:
161
+
162
+ ```tsx
163
+ const reveal = React.useMemo(() => ({
164
+ enabled: import.meta.env.DEV,
165
+ appName: 'my-app',
166
+ bridgeUrl: import.meta.env.VITE_MYTHIK_REVEAL_URL,
167
+ token: import.meta.env.VITE_MYTHIK_REVEAL_TOKEN,
168
+ environment: { id: 'dev', source: 'host' as const },
169
+ includeStatePaths: ['/ui', '/form'],
170
+ redactStatePaths: ['/auth', '/secrets'],
171
+ }), []);
172
+
173
+ <MythikApp appSpec={appSpec} specStore={specStore} reveal={reveal} />
174
+ ```
175
+
176
+ Then inspect the running app:
177
+
178
+ ```bash
179
+ mythik reveal apps --json
180
+ mythik reveal context --app my-app
181
+ mythik reveal current --app my-app
182
+ mythik reveal screen dashboard --app my-app
183
+ mythik reveal element save-button --app my-app
184
+ ```
185
+
186
+ For React Native Android emulator smoke, reverse the bridge port:
187
+
188
+ ```bash
189
+ adb reverse tcp:17373 tcp:17373
190
+ ```
191
+
192
+ Reveal is development tooling. Do not enable it in production, do not
193
+ commit tokens, and expose only the state paths the agent needs.
194
+ Redact auth, secrets, tokens, passwords, API keys, and session values.
195
+ When a runtime symptom is visible but the cause is unknown, agents
196
+ should ask Reveal before proposing a patch.
197
+
135
198
  ### CLI store configuration
136
199
 
137
- The CLI can read and write specs from `memory`, `file`, `supabase`, `sqlserver`, `postgres`, `mysql`, and `sqlite` stores. SQL stores share the same commands and the same required edit loop: `manifest -> elements -> patch -> validate`.
200
+ The CLI can read and write specs from `memory`, `file`, `supabase`, `sqlserver`, `postgres`, `mysql`, and `sqlite` stores. SQL stores share the same commands and the same required edit loop: `manifest -> elements -> patch --from-file --author -> validate -> verify`.
138
201
 
139
202
  ```bash
140
203
  # SQLite: local development, tests, demos, lightweight deployments
@@ -166,11 +229,13 @@ Environment equivalents: `MYTHIK_STORE`, `MYTHIK_DATABASE_URL`, `MYTHIK_SQLITE_F
166
229
 
167
230
  Per reference-doc rule 248: three approved forms.
168
231
 
169
- - **Shell**: `mythik push <id> --from-file spec.json` and `mythik patch <id> --from-file patch.json` (cross-shell ergonomic for any spec/patch containing `$state`, `$template`, `$auth`, or `$row`)
170
- - **Bulk**: `mythik push --from-dir <folder>` — sequential per-file push of every `*.json`. Continue-on-error: failures don't stop subsequent specs. No rollback. Partial state recovers by fixing failures and re-running.
171
- - **Programmatic**: `import { runPush, runPatch, parsePatchInput, type PushResult } from 'mythik-cli/api'` — same code path as the binary, no shell. Pass `json: true` in options to receive structured command output via `JSON.parse(result.output)`. `runPatch` success output includes `versioned: boolean` and `version?: number` when a versioned store + `author` creates history.
172
-
173
- `SpecStore.save()` is `@internal` — calling it from application code skips validation and produces runtime errors only at render time. The three forms above are the only validated paths.
232
+ - **Shell**: `mythik push <id> --from-file spec.json --author <agent>` and `mythik patch <id> --from-file patch.json --author <agent>` (cross-shell ergonomic for any spec/patch containing `$state`, `$template`, `$auth`, or `$row`)
233
+ - **Bulk**: `mythik push --from-dir <folder> --author <agent>` — sequential per-file push of every `*.json`. Continue-on-error: failures don't stop subsequent specs. No rollback. Partial state recovers by fixing failures and re-running.
234
+ - **Programmatic**: `import { runPush, runPatch, parsePatchInput, type PushResult } from 'mythik-cli/api'` — same code path as the binary, no shell. Pass `json: true` in options to receive structured command output via `JSON.parse(result.output)`. `runPatch` success output includes `versioned: boolean` and `version?: number` when a versioned store + `author` creates history.
235
+
236
+ `SpecStore.save()` is `@internal` — calling it from application code skips validation and produces runtime errors only at render time. The three forms above are the only validated paths.
237
+
238
+ Existing persisted specs are protected by the Agent Protocol: full replacements require `--replace`, and persisted writes require `--author <name>` for versioned stores or explicit `--allow-unversioned` for intentionally unversioned stores.
174
239
 
175
240
  ### Pre-push linting
176
241
 
@@ -271,18 +336,26 @@ Resolves by current platform. `"native"` alias matches ios and android. Specific
271
336
  - `$breakpoint`: Layout adaptation (columns, gaps, padding, direction) — same component, different sizing
272
337
  - `$platform`: Platform-specific techniques (CSS blur vs native BlurView, hover vs press, web sidebar vs native tabs) — different implementation, same feature
273
338
 
274
- **Root-level `$platform`** for fundamentally different platform layouts:
339
+ **Keep `root` stable.** The top-level `root` value is a string element id. Do not put `$platform` directly in `root`. For platform differences, branch at localized props/children/style points, or create separate screen specs when the platform experience is fundamentally different:
275
340
  ```json
276
341
  {
277
- "root": { "$platform": { "web": "layout-web", "native": "layout-native" } },
342
+ "root": "layout",
278
343
  "elements": {
279
- "layout-web": { "type": "stack", "style": { "backdropFilter": "blur(24px)" } },
280
- "layout-native": { "type": "screen", "props": { "title": "Dashboard" } },
344
+ "layout": {
345
+ "type": "stack",
346
+ "props": {
347
+ "direction": { "$platform": { "web": "horizontal", "native": "vertical" } }
348
+ },
349
+ "style": {
350
+ "backdropFilter": { "$platform": { "web": "blur(24px)", "native": null } }
351
+ },
352
+ "children": ["shared-form"]
353
+ },
281
354
  "shared-form": { "type": "stack", "children": ["..."] }
282
355
  }
283
356
  }
284
357
  ```
285
- State, initialActions, and forms are shared only presentation branches per platform.
358
+ State, initialActions, and forms stay shared while only the presentation technique branches per platform.
286
359
 
287
360
  ### Math & Data
288
361
 
@@ -1448,12 +1521,12 @@ When the framework changes the schema in a future version, this section will gai
1448
1521
  82. Use `editorSessions.<id>.persistence` plus `editorSave` for generic editor document persistence. The AI should not hand-compose `transaction` + `editorMarkSaved` for normal editor saves. `editorSave` captures the tracked paths snapshot, persists it through the host fetcher with URL-guard checks, and marks only the sent snapshot as saved after success. Failed saves keep `dirty: true` and expose save metadata under `/ui/editorSessions/<id>`.
1449
1522
  83. Use `navigation.editorSessionGuard` for generic unsaved-changes protection in app specs instead of hand-rolled JSON dirty checks. Configure `sessions`, render your own JSON modal from `/ui/navigationGuard/pending`, call `navigationGuardCancel`, `navigationGuardSaveAndProceed`, `navigationGuardProceed`, or `navigationGuardDiscardAndProceed`, and keep `pendingPath` under a consumer-owned `/ui/<segment>` path that does not collide with reserved framework paths. `navigationGuardSaveAndProceed` is the normal save-first UX for persisted editor sessions; `navigationGuardProceed` is a low-level non-destructive retry that only resumes after the pending editor sessions are already clean; use `navigationGuardDiscardAndProceed` when the user explicitly chooses to abandon unsaved tracked-path changes.
1450
1523
  84. In React apps without auth framework fetch, pass `fetcher` to `MythikApp` when editor sessions use `editorSave` or `navigationGuardSaveAndProceed`. Auth-enabled apps continue to use the framework fetch produced by auth interceptors. Do not route save-and-continue through `/ui/lastError` or a hand-composed fetch action; the editor session engine owns save metadata under `/ui/editorSessions/<id>`.
1451
- 85. For existing spec edits, the required AI loop is `mythik manifest` -> `mythik elements` -> `mythik patch --from-file` -> verify. Manifest tells you the structure; elements gives the exact JSON you are changing; patch is the validated write path. Do not skip directly to full-spec `pull`/rewrite/push for a local change, do not mutate DB rows manually, and do not call `SpecStore.save()` from app code. Use `push` for new specs or intentional full replacement only.
1524
+ 85. For existing spec edits, the required AI loop is `mythik manifest` -> `mythik elements` -> `mythik patch --from-file --author` -> `mythik validate` -> verify. Manifest tells you the structure; elements gives the exact JSON you are changing; patch is the validated write path. Do not skip directly to full-spec `pull`/rewrite/push for a local change, do not mutate DB rows manually, and do not call `SpecStore.save()` from app code. Use `push` for new specs or intentional full replacement only; existing specs require explicit `--replace`.
1452
1525
  86. Mythik's AI documentation ships with the `mythik` npm package. Before generating or modifying specs, locate it with `mythik docs path` and start from `docs/llms.txt`, `docs/consumer/ai-context.md`, and `docs/wiki/compiled/README.md`. Use `mythik docs copy ./mythik-docs` when a project-local copy is easier to hand to an AI agent.
1453
1526
  87. DNA numeric seeds (`roundness`, `density`, `depth`, `formality`) are canonical `0–1` values. Generate `0.7`, not `70`. The runtime tolerates legacy `0–100` values by normalizing any numeric seed greater than `1` with `/100` during DNA derivation, including initial AppSpec load and runtime `updateTokens`.
1454
1527
  88. API query endpoints can combine `pagination: "offset"` with `scopeFilter`. For generated counts, Mythik applies the scope filter to the source query before `COUNT(*)`, so paginated totals remain tenant-scoped. Prefer generated counts. If a custom `endpoint.count` is truly needed with `scopeFilter`, include `{{scopeWhere[:alias]}}` or `{{scopeAnd[:alias]}}`; Mythik expands the macro to the correct scope predicate and removes it for bypass roles. Other custom count SQL is left verbatim. Use `:alias` for JOIN/subquery counts, and do not reference internal scope params directly.
1455
1528
  89. Transaction `confirm` failures from `fetch` preserve backend error details for `onError`. Read `/tx/error/message` for the best available message; when the backend returns `{ error: { code, message } }`, Mythik keeps that message, `code`, HTTP `status`, and raw `data` after rollback. Do not parse `/ui/lastError` from transaction specs.
1456
- 90. For SQL-backed stores and servers, use the generic `mythik/server` SQL boundary. Initialize tables with `mythik init-store --dialect <sqlserver|postgres|mysql|sqlite>` or inspect DDL with `--dry-run`; configure the CLI with `--store`, `--url`/`--filename`/SQL Server flags, or `MYTHIK_*` environment variables; and keep spec edits on the required `manifest -> elements -> patch --from-file -> validate` loop. Write custom API SQL in the selected dialect with Mythik named params (`@name`); Mythik does not translate custom SQL between dialects.
1529
+ 90. For SQL-backed stores and servers, use the generic `mythik/server` SQL boundary. Initialize tables with `mythik init-store --dialect <sqlserver|postgres|mysql|sqlite>` or inspect DDL with `--dry-run`; configure the CLI with `--store`, `--url`/`--filename`/SQL Server flags, or `MYTHIK_*` environment variables; and keep spec edits on the required `manifest -> elements -> patch --from-file --author -> validate -> verify` loop. Write custom API SQL in the selected dialect with Mythik named params (`@name`); Mythik does not translate custom SQL between dialects.
1457
1530
  91. Event arrays may mix normal actions and transaction bindings. Mythik executes them sequentially and awaits each transaction before continuing. Use this when a flow needs a small action before or after an optimistic transaction; do not wrap a transaction inside another transaction phase.
1458
1531
  92. `$ref` and `$template` placeholders can read nested values from `$let` object bindings with dot notation, for example `{ "$ref": "user.name" }` or `${user.name}`. If a dotted `$ref` segment is missing, runtime throws an unknown `$ref` error rather than silently returning undefined.
1459
1532
  93. Use `params.skipIf` for a dispatch-time action guard when an action should be skipped but the surrounding action chain should continue. `skipIf` is resolved before other params and is removed before the action handler runs. Do not use `skipIf` as a substitute for form validation or transaction rollback.
@@ -1461,3 +1534,6 @@ When the framework changes the schema in a future version, this section will gai
1461
1534
  95. `select.options` accepts strings, `{ label, value }` objects, or catalog-shaped objects when `labelKey` and `valueKey` are provided. Example: `{ "options": { "$state": "/cat/services/data" }, "labelKey": "name", "valueKey": "id" }`. Values are emitted as strings from `on.change`; malformed option data renders disabled diagnostics instead of blank clickable rows or crashes.
1462
1535
  96. SQL adapters are optional peer dependencies, not installed-by-default runtime payload. Browser-only apps install `mythik mythik-react` without database drivers. SQL-backed stores/servers must install exactly one selected adapter: `mssql`, `pg`, `mysql2`, or `better-sqlite3`. SQLite uses native `better-sqlite3`; native-build helper warnings from that adapter are not Mythik runtime failures.
1463
1536
  97. Missing SQL adapter errors are actionable. The thrown `SqlDriverError` includes `packageName`, `installCommand`, and a message with the exact `npm install ...` command for the selected dialect.
1537
+ 98. For native Expo apps, install renderer peer packages with `npx expo install react-native-svg react-native-reanimated react-native-worklets ...` before installing `mythik mythik-react-native`, so Expo selects native module versions that match the app SDK. Keep `react-native-reanimated/plugin` last in the app Babel config. Keep `root` as a stable string element id; use `$platform` only inside localized props, style, children, or values. `$platform` matches exact platform keys first, then falls back from `ios`/`android` to `native`; it has no `default` key. Before using a primitive in native specs, check `REACT_NATIVE_PRIMITIVE_SUPPORT` or `getReactNativePrimitiveSupport` from `mythik-react-native`; native-milestone primitives should fail visibly instead of being treated as supported.
1538
+ 99. Use Mythik Reveal before guessing about running-app behavior. Start `mythik reveal start`, wire the host `reveal` config in development, then inspect with `mythik reveal apps`, `context`, `current`, `screen`, or `element`. Reveal returns live renderer/environment/spec/state/diagnostics/events with redaction, so agents can diagnose runtime behavior from structured context instead of screenshots, stale pulled specs, or source-code assumptions. Never enable Reveal in production, never commit the token, and include/redact state paths deliberately.
1539
+ 100. **Use Mythik Agent Context and Agent Protocol for fresh AI agents**. Run `mythik agent init codex`, `mythik agent init claude`, or `mythik agent init all` to install project-local agent instructions. `codex` creates/updates `AGENTS.md`, `claude` creates/updates `CLAUDE.md`, and `all` updates both; existing file content outside the Mythik-managed `<!-- mythik-agent-protocol:start -->` / `<!-- mythik-agent-protocol:end -->` block is preserved. Generate live project context with `mythik agent context --app <id> --include-screens --out .mythik/agent/context.md`. Existing stored specs stay on `manifest -> elements -> patch --from-file --author -> validate -> verify`. The active store is the source of truth; local spec files are drafts/snapshots/migrations/fixtures unless a file store is intentionally configured. Use TOON for large reads when supported, and use `mythik lint` for new local drafts, replacement files, bulk imports/migrations, and relevant consumer code changes.