@open-agent-toolkit/cli 0.2.26 → 0.2.27

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 (64) hide show
  1. package/assets/NOTICES.md +156 -0
  2. package/assets/docs/contributing/explainer-kit-verification.md +125 -0
  3. package/assets/docs/contributing/index.md +1 -0
  4. package/assets/docs/reference/troubleshooting.md +47 -0
  5. package/assets/docs/workflows/projects/artifacts.md +24 -6
  6. package/assets/docs/workflows/skills/explainer-kit-providers.md +144 -0
  7. package/assets/docs/workflows/skills/explainer-kit.md +121 -69
  8. package/assets/docs/workflows/skills/index.md +1 -0
  9. package/assets/public-package-versions.json +4 -4
  10. package/assets/skills/explainer-kit/SKILL.md +18 -3
  11. package/assets/skills/explainer-kit/recipes/project-recap.json +43 -16
  12. package/assets/skills/explainer-kit/references/contracts.md +167 -20
  13. package/assets/skills/explainer-kit/references/golden-conformance.md +80 -0
  14. package/assets/skills/explainer-kit/references/visual-authoring.md +92 -0
  15. package/assets/skills/explainer-kit/references/visual-review.md +57 -0
  16. package/assets/skills/explainer-kit/schemas/author-request.v2.schema.json +172 -1
  17. package/assets/skills/explainer-kit/schemas/build-record.schema.json +7 -1
  18. package/assets/skills/explainer-kit/schemas/fact-base.schema.json +38 -2
  19. package/assets/skills/explainer-kit/schemas/manifest.schema.json +25 -1
  20. package/assets/skills/explainer-kit/schemas/run-request.schema.json +4 -0
  21. package/assets/skills/explainer-kit/schemas/set-plan.v1.schema.json +149 -0
  22. package/assets/skills/explainer-kit/schemas/visual-review-request.v1.schema.json +117 -0
  23. package/assets/skills/explainer-kit/schemas/visual-review-result.v1.schema.json +80 -0
  24. package/assets/skills/explainer-kit/scripts/lib/browser-runtime.mjs +148 -4
  25. package/assets/skills/explainer-kit/scripts/lib/catalog.mjs +243 -0
  26. package/assets/skills/explainer-kit/scripts/lib/contracts.mjs +586 -8
  27. package/assets/skills/explainer-kit/scripts/lib/diagram.mjs +285 -8
  28. package/assets/skills/explainer-kit/scripts/lib/durability.mjs +35 -0
  29. package/assets/skills/explainer-kit/scripts/lib/fact-base.mjs +144 -8
  30. package/assets/skills/explainer-kit/scripts/lib/package-coverage.mjs +379 -0
  31. package/assets/skills/explainer-kit/scripts/lib/png.mjs +287 -0
  32. package/assets/skills/explainer-kit/scripts/lib/qa.mjs +280 -8
  33. package/assets/skills/explainer-kit/scripts/lib/recipes.mjs +132 -3
  34. package/assets/skills/explainer-kit/scripts/lib/records.mjs +513 -21
  35. package/assets/skills/explainer-kit/scripts/lib/render.mjs +67 -3
  36. package/assets/skills/explainer-kit/scripts/lib/s3-static.mjs +43 -1
  37. package/assets/skills/explainer-kit/scripts/lib/set-plan.mjs +208 -0
  38. package/assets/skills/explainer-kit/scripts/lib/source-backlinks.mjs +218 -0
  39. package/assets/skills/explainer-kit/scripts/lib/visual-review.mjs +380 -0
  40. package/assets/skills/explainer-kit/scripts/render-qa.mjs +48 -10
  41. package/assets/skills/explainer-kit/scripts/run.mjs +859 -134
  42. package/assets/skills/oat-explainer-kit/SKILL.md +40 -12
  43. package/assets/skills/oat-explainer-kit/references/author-callback.md +12 -10
  44. package/assets/skills/oat-explainer-kit/references/lifecycle-contract.md +40 -2
  45. package/assets/skills/oat-explainer-kit/references/visual-review-callback.md +72 -0
  46. package/assets/skills/oat-explainer-kit/scripts/bind-project-sources.mjs +167 -5
  47. package/assets/skills/oat-explainer-kit/scripts/finalize-tracked-run.mjs +92 -5
  48. package/assets/skills/oat-explainer-kit/scripts/run.mjs +324 -2
  49. package/dist/commands/project/archive/archive-utils.d.ts +1 -0
  50. package/dist/commands/project/archive/archive-utils.d.ts.map +1 -1
  51. package/dist/commands/project/archive/archive-utils.js +109 -42
  52. package/dist/commands/project/archive/explainer-package-coverage.d.ts +14 -0
  53. package/dist/commands/project/archive/explainer-package-coverage.d.ts.map +1 -0
  54. package/dist/commands/project/archive/explainer-package-coverage.js +27 -0
  55. package/dist/commands/project/archive/explainer-source-backlinks.d.ts +18 -0
  56. package/dist/commands/project/archive/explainer-source-backlinks.d.ts.map +1 -0
  57. package/dist/commands/project/archive/explainer-source-backlinks.js +27 -0
  58. package/dist/commands/project/archive/push-runner.d.ts +2 -1
  59. package/dist/commands/project/archive/push-runner.d.ts.map +1 -1
  60. package/dist/commands/project/archive/push-runner.js +5 -1
  61. package/dist/release/public-package-contract.d.ts +6 -0
  62. package/dist/release/public-package-contract.d.ts.map +1 -1
  63. package/dist/release/public-package-contract.js +75 -0
  64. package/package.json +2 -2
@@ -0,0 +1,156 @@
1
+ # NOTICES
2
+
3
+ This file records attribution for externally-sourced prose incorporated
4
+ into this repository. When you adapt or lift prose from an external
5
+ project into a skill, template, or doc, add an entry here — do not
6
+ add attribution footers to the skill files themselves.
7
+
8
+ ## Obra Superpowers
9
+
10
+ **Source:** https://github.com/obra/superpowers
11
+ **License:** MIT
12
+ **Version referenced:** 5.0.7
13
+
14
+ ### `brainstorming` skill
15
+
16
+ Source file: `skills/brainstorming/SKILL.md`
17
+
18
+ Passages adapted or lifted verbatim into OAT:
19
+
20
+ - "Exploring approaches" (4 lines) — used in `oat-project-design` Component 3.5 (approach reaffirmation)
21
+ - "Presenting the design" (5 lines) — used in `oat-project-design` Component 4 (section iterator)
22
+ - "Design for isolation and clarity" (4 lines) — used as a principle in `oat-project-design`
23
+ - Self-review four-check template — used in `oat-project-design` Component 6
24
+ - User-review gate phrasing — used in `oat-project-design` Component 7
25
+
26
+ Consumer OAT skills: `oat-project-design`, `oat-project-quick-start`
27
+ (via lightweight-design mode choice inheriting the same prose).
28
+
29
+ ### Upstream MIT license
30
+
31
+ ```text
32
+ MIT License
33
+
34
+ Copyright (c) 2025 Jesse Vincent
35
+
36
+ Permission is hereby granted, free of charge, to any person obtaining a copy
37
+ of this software and associated documentation files (the "Software"), to deal
38
+ in the Software without restriction, including without limitation the rights
39
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
40
+ copies of the Software, and to permit persons to whom the Software is
41
+ furnished to do so, subject to the following conditions:
42
+
43
+ The above copyright notice and this permission notice shall be included in all
44
+ copies or substantial portions of the Software.
45
+
46
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
47
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
48
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
49
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
50
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
51
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
52
+ SOFTWARE.
53
+ ```
54
+
55
+ ### `brainstorming` skill — visual companion
56
+
57
+ Source files: `skills/brainstorming/scripts/{server.cjs, start-server.sh,
58
+ stop-server.sh, frame-template.html, helper.js}` and
59
+ `skills/brainstorming/visual-companion.md`.
60
+
61
+ Files lifted into OAT (under `.agents/skills/oat-brainstorm/`):
62
+
63
+ - `scripts/server.cjs`, `scripts/stop-server.sh`, `scripts/frame-template.html`,
64
+ `scripts/helper.js` — verbatim from upstream.
65
+ - `scripts/start-server.sh` — verbatim except for default persistence-path
66
+ changes (`.superpowers/brainstorm/` → OAT-managed prefixes:
67
+ `<project>/.oat/brainstorm/`, `<repo-root>/.oat/brainstorm/`,
68
+ `~/.oat/brainstorm/`).
69
+ - `references/visual-companion.md` — adapted prose: persistence paths and
70
+ example invocations updated to OAT conventions.
71
+
72
+ Consumer OAT skills: `oat-brainstorm`.
73
+
74
+ ## shadcn/improve
75
+
76
+ **Source:** https://github.com/shadcn/improve/tree/main/skills/improve
77
+ **License:** MIT
78
+ **Version referenced:** `main` (retrieved 2026-07-12)
79
+
80
+ ### `improve` skill
81
+
82
+ Source files: `skills/improve/SKILL.md` and
83
+ `skills/improve/references/{audit-playbook.md,closing-the-loop.md,plan-template.md}`.
84
+
85
+ Files copied into `.agents/skills/oat-repo-improve/`; the skill identifier,
86
+ heading, invocation examples, and generated-plan attribution were renamed for
87
+ the OAT repository namespace.
88
+
89
+ ### Upstream MIT license
90
+
91
+ ```text
92
+ MIT License
93
+
94
+ Copyright (c) 2026 shadcn
95
+
96
+ Permission is hereby granted, free of charge, to any person obtaining a copy
97
+ of this software and associated documentation files (the "Software"), to deal
98
+ in the Software without restriction, including without limitation the rights
99
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
100
+ copies of the Software, and to permit persons to whom the Software is
101
+ furnished to do so, subject to the following conditions:
102
+
103
+ The above copyright notice and this permission notice shall be included in all
104
+ copies or substantial portions of the Software.
105
+
106
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
107
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
108
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
109
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
110
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
111
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
112
+ SOFTWARE.
113
+ ```
114
+
115
+ ## visual-explainer
116
+
117
+ **Source:** https://github.com/nicobailon/visual-explainer
118
+ **License:** MIT
119
+ **Version referenced:** 0.8.1
120
+
121
+ ### Explainer templates and render QA
122
+
123
+ Visual presentation and QA patterns were adapted into
124
+ `.agents/skills/explainer-kit/`, including self-contained HTML shells,
125
+ responsive navigation, slide-deck interaction and print behavior, overflow
126
+ containment, reduced-motion handling, and structural/render checks.
127
+
128
+ The OAT implementation replaces upstream branding, destinations, invocation
129
+ commands, and example content with destination-neutral contracts, themes,
130
+ templates, and fixtures. Consumer OAT skill: `explainer-kit`.
131
+
132
+ ### Upstream MIT license
133
+
134
+ ```text
135
+ MIT License
136
+
137
+ Copyright (c) 2025 Nico Bailon
138
+
139
+ Permission is hereby granted, free of charge, to any person obtaining a copy
140
+ of this software and associated documentation files (the "Software"), to deal
141
+ in the Software without restriction, including without limitation the rights
142
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
143
+ copies of the Software, and to permit persons to whom the Software is
144
+ furnished to do so, subject to the following conditions:
145
+
146
+ The above copyright notice and this permission notice shall be included in all
147
+ copies or substantial portions of the Software.
148
+
149
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
150
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
151
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
152
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
153
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
154
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
155
+ SOFTWARE.
156
+ ```
@@ -0,0 +1,125 @@
1
+ ---
2
+ title: Verifying Explainer Kit
3
+ description: 'Maintainer runbook for semantic golden cases, temporary real-Chromium evidence, and release validation.'
4
+ ---
5
+
6
+ # Verifying Explainer Kit
7
+
8
+ Explainer Kit uses portable behavioral goldens and a real-browser release gate.
9
+ The goal is not pixel identity: output may change markup, spacing, and
10
+ composition when it preserves the same meaning, topology, interactions, and
11
+ evidence quality.
12
+
13
+ ## Golden cases
14
+
15
+ The suite under
16
+ `.agents/skills/explainer-kit/tests/fixtures/golden/` contains three
17
+ portable semantic cases:
18
+
19
+ | Case | What it proves |
20
+ | ------------------------------ | ---------------------------------------------------------- |
21
+ | `simple` | Viewport-sized lead evidence and a cohesive baseline recap |
22
+ | `non-linear` | Exact branch, fan-in, and cycle preservation |
23
+ | `explainer-authoring-redesign` | Archive-only rebuild from a dense completed project record |
24
+
25
+ Every case retains only its descriptor, source input, and content-addressed
26
+ source record. The three cases share one rubric. Generated artifacts, browser
27
+ evidence, screenshots, manifests, catalogs, and review results stay in a
28
+ temporary test directory and are never committed. Paths are
29
+ repository-relative; machine roots, home-relative paths, `file://` URLs,
30
+ Windows drive paths, and UNC paths are rejected.
31
+
32
+ ## Prerequisites
33
+
34
+ - Install workspace dependencies.
35
+ - Ensure the repository-supported Chromium runtime is installed and launchable.
36
+ - Run from the repository root.
37
+
38
+ The end-to-end benchmarks require an actual launched Chromium session. A
39
+ deterministic fixture session is valid only for bounded unit/integration tests
40
+ and cannot satisfy a golden production path.
41
+
42
+ ## Run the golden suite
43
+
44
+ ```bash
45
+ node --test \
46
+ .agents/skills/explainer-kit/tests/golden-conformance.test.mjs
47
+ ```
48
+
49
+ A passing run proves:
50
+
51
+ - one planner-owned hub, architecture view, and deck;
52
+ - source and terminology cohesion;
53
+ - exact topology and catalog parity;
54
+ - mobile, tablet, and desktop Chromium evidence;
55
+ - one independent critic invocation; and
56
+ - a passing terminal review without correction.
57
+
58
+ The focused integration suites below separately exercise the one-correction
59
+ ceiling.
60
+
61
+ The suite recomputes semantic-input hashes, grounds every claim in retained
62
+ source evidence, and evaluates the shared rubric against live runtime output.
63
+ A prose claim or status label without runtime proof does not pass.
64
+
65
+ ## Inspect generated evidence
66
+
67
+ The suite materializes each case's runtime package under its temporary working
68
+ directory, validates it, and removes it at test completion. Add a local
69
+ debugger breakpoint or temporarily disable cleanup when diagnosing a failure;
70
+ do not add generated runtime output to the fixture directories.
71
+
72
+ ## Focused integrity suites
73
+
74
+ Use these when changing browser identity, immutable evidence, resume, or archive
75
+ contracts:
76
+
77
+ ```bash
78
+ node --test \
79
+ .agents/skills/explainer-kit/tests/records.test.mjs \
80
+ .agents/skills/explainer-kit/tests/run.integration.test.mjs
81
+
82
+ node --test \
83
+ .agents/skills/explainer-kit/tests/browser-runtime.test.mjs \
84
+ .agents/skills/explainer-kit/tests/qa.test.mjs \
85
+ .agents/skills/explainer-kit/tests/contracts.test.mjs \
86
+ .agents/skills/explainer-kit/tests/durability.test.mjs \
87
+ .agents/skills/explainer-kit/tests/rebuildability.test.mjs
88
+
89
+ pnpm --filter @open-agent-toolkit/cli exec vitest run \
90
+ src/commands/project/archive/archive-utils.test.ts \
91
+ src/release/public-package-contract.test.ts
92
+
93
+ node --test tools/smoke/explainer-kit/*.test.mjs
94
+ ```
95
+
96
+ ## Release gate
97
+
98
+ The required publishable-package gate is:
99
+
100
+ ```bash
101
+ pnpm release:validate
102
+ ```
103
+
104
+ It validates all five lockstep public package tarballs and then runs the bounded
105
+ curated-style/template matrix in real Chromium. The visual gate retains 65
106
+ machine-readable viewport, clipping, motion, keyboard, no-JavaScript, and print
107
+ measurements. Missing Chromium or untrusted retained evidence fails closed.
108
+
109
+ For the full repository closeout, also run the standard checks documented in
110
+ the root `AGENTS.md`:
111
+
112
+ ```bash
113
+ pnpm check
114
+ pnpm type-check
115
+ pnpm test
116
+ pnpm build
117
+ pnpm lint
118
+ pnpm format
119
+ pnpm build:docs
120
+ git diff --check
121
+ ```
122
+
123
+ Do not treat an isolated transient timeout as a product pass or failure without
124
+ reproducing the failing test. Preserve the exact-head successful rerun evidence
125
+ used for release closure.
@@ -17,4 +17,5 @@ Use this section when you are changing OAT itself rather than consuming it as a
17
17
  - [Commit Conventions](commit-conventions.md) - Traceable commit patterns for project and docs work.
18
18
  - [Hooks and Safety](hooks-and-safety.md) - Safety and mutation contracts for provider-sync behavior.
19
19
  - [Smoke Testing](smoke-testing.md) - Runbook for the live workflow smoke runner: prerequisites, scenarios, evidence reports, and recovery.
20
+ - [Verifying Explainer Kit](explainer-kit-verification.md) - Golden recap cases, real-Chromium evidence, fixture regeneration, and release validation.
20
21
  - [Verifying Cursor Pins](verifying-cursor-pins.md) - Runbook for probe-verifying a Cursor model pin before shipping it.
@@ -113,9 +113,56 @@ oat tools has <pack> --scope user
113
113
  - Reconcile `state.md`, `plan.md` review table, and `implementation.md`.
114
114
  - Ensure phase/review status has been updated after reviews and fix cycles.
115
115
 
116
+ ## An Explainer Kit recap ends as `built-needs-review`
117
+
118
+ `built-needs-review` means the required unattended visual-review chain did not
119
+ reach a valid `pass`. The run retains available output for diagnosis, but OAT
120
+ will not finalize, archive, attest, publish, or push it as a successful recap.
121
+ Do not bypass the review gate by copying the package into a durable location.
122
+
123
+ Inspect:
124
+
125
+ 1. `build-record.json` and `manifest.json` for the terminal outcome and warning.
126
+ 2. `qa/browser/` for all required mobile, tablet, and desktop PNG/metrics pairs.
127
+ 3. `qa/visual-review/attempt-*/request.json` and `result.json` for request
128
+ binding, critic disposition, and findings.
129
+ 4. `qa/visual-review/revision.json` when a correction was requested.
130
+ 5. Adapter logs for missing or invalid `browserSession`, `visualCritic`, or
131
+ correction-provider modules.
132
+
133
+ Common causes include unavailable Chromium, a fixture or unbranded session,
134
+ missing screenshots, invalid decoded PNG dimensions, runtime/capture identity
135
+ drift, critic exceptions, evidence mutation, `fail`, and an unresolved
136
+ correction. Fix the provider or artifact problem and rebuild the recap; partial
137
+ evidence is diagnostic only.
138
+
139
+ See
140
+ [Explainer Provider Integration](../workflows/skills/explainer-kit-providers.md)
141
+ for the trusted-session and critic contracts.
142
+
143
+ ## Explainer Kit resume fails with `E_APPROVAL_RESUME`
144
+
145
+ Interactive resume is same-request only. Keep the opaque `ekrt2` token returned
146
+ as `approval.resumeToken` outside the package and provide it as
147
+ `reviewedSource.resumeToken` with the complete original request.
148
+
149
+ The error is expected when:
150
+
151
+ - the token is missing, malformed, or not `ekrt2`;
152
+ - the configured output root or retained run root moved;
153
+ - `run-request.json` or a retained set-plan record changed;
154
+ - the current request differs in source binding, recipe, mode, theme, render
155
+ strategy, privacy, public URL, durability, or publish destination; or
156
+ - the package contains a legacy `ekrt1` token.
157
+
158
+ Do not edit retained files or weaken the current request to force a match.
159
+ Restore the exact original request and package bytes. Legacy paused runs cannot
160
+ be upgraded in place; restart them to receive an authenticated `ekrt2` token.
161
+
116
162
  ## Reference artifacts
117
163
 
118
164
  - `.oat/projects/<scope>/<project>/implementation.md`
119
165
  - `.oat/projects/<scope>/<project>/reviews/`
166
+ - `.oat/projects/<scope>/<project>/explainers/<slug>/qa/`
120
167
  - `packages/cli/src/commands/doctor/index.ts`
121
168
  - `packages/cli/src/commands/instructions/`
@@ -57,12 +57,30 @@ The archive exports at most one selected recap package. It preserves structured
57
57
  failure outcomes and successful intermediates, rejects an existing dated
58
58
  destination, and requires the selected path to stay under the project's
59
59
  `explainers/` directory with a `project-recap` manifest. Verification covers
60
- the exact retained bytes for the privacy-safe request, content approval, fact
61
- base JSON and Markdown, declared author results, authored content, resolved
62
- theme, and every built artifact. Canonical fact-base and theme hashes remain
63
- normalized-object identities; `manifest.immutableHashes` independently covers
64
- serialized file bytes. Missing, stale, or tampered coverage fails before the
65
- active project is deleted.
60
+ the complete mode-aware package:
61
+
62
+ - privacy-safe request and content approval;
63
+ - fact-base JSON and Markdown;
64
+ - the five immutable set-plan records and authored drafts;
65
+ - declared author results and authored content;
66
+ - resolved theme and every built artifact;
67
+ - canonical mobile, tablet, and desktop screenshots;
68
+ - paired `browser-evidence/v2` metrics with launched Chromium name, version,
69
+ and capture identity;
70
+ - cohesion observations and each visual-review request/result; and
71
+ - the bounded revision record when a correction occurred.
72
+
73
+ Canonical object hashes identify normalized fact-base, theme, runtime, and
74
+ capture objects; `manifest.immutableHashes` independently covers serialized file
75
+ bytes. The archive requires one complete, internally consistent browser and
76
+ review chain for a successful unattended recap. Missing, stale, forged,
77
+ cross-record-mismatched, or tampered coverage fails before the active project is
78
+ deleted.
79
+
80
+ `built-needs-review` is a terminal review-gate outcome, not a non-durable
81
+ success. Its partial evidence remains available for diagnosis, but it cannot be
82
+ finalized, exported, attested, archived, or pushed. Review and rebuild the recap
83
+ to a passing visual-review outcome first.
66
84
 
67
85
  Local-scope projects are not archived through this export path. Their explainer
68
86
  packages inherit the local project's untracked posture and remain
@@ -0,0 +1,144 @@
1
+ ---
2
+ title: Explainer Provider Integration
3
+ description: 'Provider-neutral planner, author, browser-session, and visual-critic contracts for Explainer Kit integrators.'
4
+ ---
5
+
6
+ # Explainer Provider Integration
7
+
8
+ Explainer Kit keeps model and browser providers outside its retained request
9
+ contracts. Integrators supply executable seams in process or through validated
10
+ module exports; the core owns schemas, evidence binding, and terminal outcomes.
11
+
12
+ For recipes, authoring behavior, themes, and lifecycle policy, start with
13
+ [Explainer Kit](explainer-kit.md).
14
+
15
+ ## Provider boundaries
16
+
17
+ Use exactly one form for each required role:
18
+
19
+ | Role | Direct input | Module-path input | Required export |
20
+ | ------------------ | ---------------- | -------------------------- | ----------------------------------- |
21
+ | Set planning | `planSet` | `planSetModulePath` | `planSet` function |
22
+ | Artifact authoring | `author` | `authorModulePath` | `author` function |
23
+ | Browser evidence | `browserSession` | `browserSessionModulePath` | branded `browserSession` descriptor |
24
+ | Whole-set review | `visualCritic` | `visualCriticModulePath` | `visualCritic` function |
25
+
26
+ `project-recap` requires all four roles. Other recipes require the author and
27
+ use their recipe-specific planning behavior. Direct-plus-module conflicts,
28
+ missing files, and invalid exports fail at the adapter boundary before core
29
+ execution.
30
+
31
+ Do not place browser or visual-review providers in `coreOptions`. Executable
32
+ callbacks, descriptors, and module paths are transient and never enter
33
+ `ExplainerRunRequestV1`, `run-request.json`, or immutable package hashes.
34
+
35
+ ## Set planner
36
+
37
+ The provider-neutral `planSet` callback runs once after fact reconciliation and
38
+ before any author callback. It returns the complete portfolio and one shared
39
+ claim ledger.
40
+
41
+ For a project recap, the portfolio must contain the required hub, architecture
42
+ view, and deck. Optional entries must use a recipe-licensed profile, remain
43
+ inside recipe and per-profile limits, and carry source-backed justification.
44
+ Duplicate identities, undeclared sources, conflicting shared terms, and
45
+ unjustified optionals fail validation.
46
+
47
+ Every author request receives the immutable set context and its matching planned
48
+ artifact. Authors cannot add, remove, replace, or rename portfolio entries.
49
+
50
+ ## Artifact author
51
+
52
+ The core invokes `author` once per planned artifact with
53
+ `explainer-kit.author-request/v2`. The request contains:
54
+
55
+ - artifact identity, type, and authoring path;
56
+ - the versioned brief and bundled medium-specific guidance;
57
+ - reconciled facts and the shared set context;
58
+ - the matching planned artifact;
59
+ - the resolved theme; and
60
+ - the bundled shell for artistic HTML.
61
+
62
+ Return `explainer-kit.author-result/v2` with exactly one of
63
+ `content.markdown` or `content.html` and non-secret provenance. The core
64
+ validates source overlap, path ownership, script identity, and structural
65
+ contracts after the callback returns.
66
+
67
+ The author, fact critic, browser probe, and visual critic must have distinct
68
+ callback identities. One provider implementation may back multiple roles, but
69
+ the adapter still requires separate executable boundaries.
70
+
71
+ ## Trusted browser session
72
+
73
+ Create a direct session with the compatible core:
74
+
75
+ ```js
76
+ const browserSession = await core.createBrowserProbeSession();
77
+
78
+ try {
79
+ await runOatExplainer(request, {
80
+ planSet,
81
+ author,
82
+ browserSession,
83
+ visualCritic,
84
+ });
85
+ } finally {
86
+ await browserSession.close();
87
+ }
88
+ ```
89
+
90
+ The factory launches Chromium and derives the runtime name and version from the
91
+ actual browser instance. A private in-memory brand prevents a plain object with
92
+ caller-authored `{name, version}` metadata from impersonating a trusted
93
+ session. Module providers export the already branded descriptor as
94
+ `browserSession`, not a bare callback.
95
+
96
+ For unattended project recaps, the core chooses 320, 768, and 1440 widths and
97
+ requires default-scenario PNGs. It validates the PNG signature, decoded
98
+ dimensions, and pixel payload, then writes paired
99
+ `explainer-kit.browser-evidence/v2` metrics. Every record retains:
100
+
101
+ - launched Chromium name and version;
102
+ - fixed capture settings;
103
+ - one derived capture identity;
104
+ - viewport and scenario;
105
+ - screenshot path and byte binding; and
106
+ - measured overflow, clipping, readability, motion, keyboard, deck, and theme
107
+ behavior.
108
+
109
+ All records in one review chain must carry the same runtime and capture
110
+ identity. Deterministic fixture sessions are explicit test helpers and are
111
+ rejected by unattended production recap paths.
112
+
113
+ ## Whole-set visual critic
114
+
115
+ The `visualCritic` receives one
116
+ `explainer-kit.visual-review-request/v1` plus a confined evidence reader. The
117
+ request binds:
118
+
119
+ - every rendered artifact and its exact content hash;
120
+ - every viewport-matched screenshot and metrics hash;
121
+ - cohesion observations from the shared ledger; and
122
+ - the trusted browser runtime and capture identity.
123
+
124
+ Return `explainer-kit.visual-review-result/v1` with the exact request identity,
125
+ all reviewed artifact IDs, structured findings, and one disposition:
126
+
127
+ - `pass` completes the review gate;
128
+ - `correct` requests one bounded correction and one final review; or
129
+ - `fail` terminates the gate.
130
+
131
+ The critic must not mutate rendered files or evidence. The core revalidates all
132
+ bound bytes after each callback.
133
+
134
+ ## Terminal behavior
135
+
136
+ There is never a second correction or third review. Missing, malformed, forged,
137
+ stale, cross-record-mismatched, or mutated evidence; a thrown callback; a
138
+ `fail`; or an unresolved correction produces `built-needs-review`.
139
+
140
+ That outcome retains available artifacts and review evidence for diagnosis, but
141
+ invokes neither durability nor publication. It cannot be finalized, archived,
142
+ attested, or pushed as a successful recap.
143
+
144
+ See [Troubleshooting](../../reference/troubleshooting.md) for recovery steps.