@open-agent-toolkit/cli 0.2.72 → 0.2.74

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 (165) hide show
  1. package/assets/agents/oat-reviewer.md +4 -3
  2. package/assets/agents/recon-worker.md +42 -8
  3. package/assets/bundle-metadata.json +1 -1
  4. package/assets/docs/cli-utilities/configuration.md +3 -56
  5. package/assets/docs/cli-utilities/tool-packs.md +4 -4
  6. package/assets/docs/contributing/code.md +2 -2
  7. package/assets/docs/contributing/index.md +0 -1
  8. package/assets/docs/reference/cli-reference.md +1 -1
  9. package/assets/docs/reference/troubleshooting.md +17 -40
  10. package/assets/docs/workflows/projects/artifacts.md +16 -34
  11. package/assets/docs/workflows/projects/lifecycle.md +20 -19
  12. package/assets/docs/workflows/skills/explainer-kit.md +180 -440
  13. package/assets/docs/workflows/skills/index.md +1 -2
  14. package/assets/docs/workflows/skills/recon.md +114 -23
  15. package/assets/public-package-versions.json +4 -4
  16. package/assets/skills/explainer-kit/SKILL.md +96 -171
  17. package/assets/skills/explainer-kit/recipes/engineer-tour.json +1 -22
  18. package/assets/skills/explainer-kit/recipes/program-recap.json +1 -29
  19. package/assets/skills/explainer-kit/recipes/project-explainer.json +1 -22
  20. package/assets/skills/explainer-kit/recipes/project-recap.v2.json +1 -43
  21. package/assets/skills/explainer-kit/references/fact-base-contract.md +76 -101
  22. package/assets/skills/explainer-kit/references/recap-authoring.md +99 -0
  23. package/assets/skills/explainer-kit/schemas/manifest.schema.json +13 -135
  24. package/assets/skills/explainer-kit/scripts/bundle.mjs +712 -0
  25. package/assets/skills/explainer-kit/scripts/lib/claim-subject.mjs +40 -0
  26. package/assets/skills/explainer-kit/scripts/lib/contracts.mjs +113 -1504
  27. package/assets/skills/explainer-kit/scripts/lib/failure.mjs +13 -0
  28. package/assets/skills/explainer-kit/scripts/lib/package-coverage.mjs +57 -403
  29. package/assets/skills/explainer-kit/scripts/lib/qa-result.mjs +168 -0
  30. package/assets/skills/explainer-kit/scripts/lib/qa.mjs +90 -488
  31. package/assets/skills/explainer-kit/scripts/lib/recipes.mjs +28 -545
  32. package/assets/skills/explainer-kit/scripts/lib/run-package.mjs +120 -0
  33. package/assets/skills/explainer-kit/scripts/lib/sanitize.mjs +42 -0
  34. package/assets/skills/explainer-kit/scripts/record.mjs +335 -0
  35. package/assets/skills/explainer-kit/scripts/verify.mjs +648 -0
  36. package/assets/skills/oat-explainer-kit/SKILL.md +57 -117
  37. package/assets/skills/oat-explainer-kit/references/config-contract.md +20 -64
  38. package/assets/skills/oat-explainer-kit/references/lifecycle-contract.md +85 -237
  39. package/assets/skills/oat-explainer-kit/scripts/bind-project-sources.mjs +18 -10
  40. package/assets/skills/oat-explainer-kit/scripts/check-core.mjs +1 -0
  41. package/assets/skills/oat-explainer-kit/scripts/check-terminal-outcome.mjs +256 -21
  42. package/assets/skills/oat-explainer-kit/scripts/persist-intent.mjs +82 -3
  43. package/assets/skills/oat-explainer-kit/scripts/resolve-config.mjs +0 -162
  44. package/assets/skills/oat-explainer-kit/scripts/resolve-intent.mjs +57 -123
  45. package/assets/skills/oat-project-autonomous/SKILL.md +14 -13
  46. package/assets/skills/oat-project-autonomous/references/gate-inventory.md +165 -165
  47. package/assets/skills/oat-project-complete/SKILL.md +168 -349
  48. package/assets/skills/oat-project-complete/scripts/consume-persisted-recap-intent.mjs +125 -0
  49. package/assets/skills/oat-project-complete/scripts/execute-synced-archive-entry.mjs +0 -30
  50. package/assets/skills/oat-project-complete/scripts/parse-completion-retry-fields.mjs +4 -37
  51. package/assets/skills/oat-project-complete/scripts/parse-synced-archive-resume-fields.mjs +17 -16
  52. package/assets/skills/oat-project-complete/scripts/recover-completion-receipts.mjs +9 -174
  53. package/assets/skills/oat-project-complete/scripts/resolve-completion-retry.mjs +1 -2
  54. package/assets/skills/oat-project-document/SKILL.md +1 -1
  55. package/assets/skills/oat-project-document/references/docs/autonomy-contract.md +165 -165
  56. package/assets/skills/oat-project-implement/SKILL.md +1 -1
  57. package/assets/skills/oat-project-implement/references/completion-and-closeout.md +44 -56
  58. package/assets/skills/oat-project-implement/references/docs/autonomy-contract.md +165 -165
  59. package/assets/skills/oat-project-lite/SKILL.md +1 -1
  60. package/assets/skills/oat-project-lite/references/docs/autonomy-contract.md +165 -165
  61. package/assets/skills/oat-project-plan/SKILL.md +5 -6
  62. package/assets/skills/oat-project-pr-final/SKILL.md +1 -1
  63. package/assets/skills/oat-project-pr-final/references/docs/autonomy-contract.md +165 -165
  64. package/assets/skills/oat-project-quick-start/SKILL.md +1 -1
  65. package/assets/skills/oat-project-quick-start/references/docs/autonomy-contract.md +165 -165
  66. package/assets/skills/oat-project-review-receive/SKILL.md +14 -1
  67. package/assets/skills/oat-project-summary/SKILL.md +35 -25
  68. package/assets/skills/oat-wave-execute/SKILL.md +11 -36
  69. package/assets/skills/oat-wave-program/SKILL.md +13 -37
  70. package/assets/skills/recon/SKILL.md +103 -40
  71. package/assets/skills/recon/references/packet-contract.md +150 -67
  72. package/assets/skills/recon/references/profiles.md +38 -16
  73. package/assets/skills/recon/references/worker-contract.md +39 -8
  74. package/assets/skills/recon/scripts/lib/contracts.mjs +703 -55
  75. package/assets/skills/recon/scripts/lib/routing.mjs +588 -0
  76. package/assets/skills/recon/scripts/lib/validated-run.mjs +2 -0
  77. package/assets/skills/recon/scripts/prepare-routing.mjs +88 -0
  78. package/assets/skills/recon/scripts/render-packet.mjs +69 -1
  79. package/assets/skills/recon/scripts/validate-packet.mjs +473 -56
  80. package/assets/skills/subagent-orchestration/SKILL.md +18 -9
  81. package/assets/skills/subagent-orchestration/references/model-selection-principles.md +17 -8
  82. package/dist/commands/config/index.d.ts.map +1 -1
  83. package/dist/commands/config/index.js +9 -113
  84. package/dist/commands/project/archive/archive-utils.d.ts.map +1 -1
  85. package/dist/commands/project/archive/archive-utils.js +32 -184
  86. package/dist/commands/project/archive/explainer-package-coverage.d.ts +3 -8
  87. package/dist/commands/project/archive/explainer-package-coverage.d.ts.map +1 -1
  88. package/dist/commands/project/archive/explainer-package-coverage.js +1 -1
  89. package/dist/config/oat-config.d.ts +0 -11
  90. package/dist/config/oat-config.d.ts.map +1 -1
  91. package/dist/config/oat-config.js +0 -34
  92. package/dist/config/resolve.d.ts.map +1 -1
  93. package/dist/config/resolve.js +0 -8
  94. package/dist/release/public-package-contract.d.ts.map +1 -1
  95. package/dist/release/public-package-contract.js +2 -10
  96. package/dist/validation/project-state.d.ts.map +1 -1
  97. package/dist/validation/project-state.js +42 -3
  98. package/package.json +2 -2
  99. package/assets/docs/contributing/explainer-kit-verification.md +0 -133
  100. package/assets/docs/workflows/skills/explainer-kit-providers.md +0 -155
  101. package/assets/skills/explainer-kit/briefs/deep-dive.md +0 -35
  102. package/assets/skills/explainer-kit/briefs/project-page.md +0 -38
  103. package/assets/skills/explainer-kit/briefs/supporting-diagram.md +0 -28
  104. package/assets/skills/explainer-kit/briefs/walkthrough-deck.md +0 -35
  105. package/assets/skills/explainer-kit/examples/project-explainer/content.md +0 -31
  106. package/assets/skills/explainer-kit/examples/project-explainer/fact-base.md +0 -22
  107. package/assets/skills/explainer-kit/examples/project-recap/content.md +0 -77
  108. package/assets/skills/explainer-kit/examples/project-recap/fact-base.json +0 -104
  109. package/assets/skills/explainer-kit/examples/project-recap/fact-base.md +0 -44
  110. package/assets/skills/explainer-kit/examples/theme-bundle.json +0 -87
  111. package/assets/skills/explainer-kit/recipes/project-recap.v1.json +0 -93
  112. package/assets/skills/explainer-kit/references/contracts.md +0 -324
  113. package/assets/skills/explainer-kit/references/destination-contract.md +0 -210
  114. package/assets/skills/explainer-kit/references/extension-contract.md +0 -80
  115. package/assets/skills/explainer-kit/references/golden-conformance.md +0 -80
  116. package/assets/skills/explainer-kit/references/visual-review.md +0 -71
  117. package/assets/skills/explainer-kit/schemas/author-request.v2.schema.json +0 -212
  118. package/assets/skills/explainer-kit/schemas/author-request.v3.schema.json +0 -241
  119. package/assets/skills/explainer-kit/schemas/author-result.v2.schema.json +0 -52
  120. package/assets/skills/explainer-kit/schemas/build-record.schema.json +0 -98
  121. package/assets/skills/explainer-kit/schemas/durability-evidence.schema.json +0 -53
  122. package/assets/skills/explainer-kit/schemas/publish-receipt.v1.schema.json +0 -97
  123. package/assets/skills/explainer-kit/schemas/publish-receipt.v2.schema.json +0 -215
  124. package/assets/skills/explainer-kit/schemas/publish-request.v1.schema.json +0 -32
  125. package/assets/skills/explainer-kit/schemas/publish-request.v2.schema.json +0 -34
  126. package/assets/skills/explainer-kit/schemas/run-request.schema.json +0 -147
  127. package/assets/skills/explainer-kit/schemas/set-plan.v1.schema.json +0 -149
  128. package/assets/skills/explainer-kit/schemas/terminal-evidence.v1.schema.json +0 -81
  129. package/assets/skills/explainer-kit/schemas/visual-review-evidence.v1.schema.json +0 -66
  130. package/assets/skills/explainer-kit/schemas/visual-review-request.v1.schema.json +0 -117
  131. package/assets/skills/explainer-kit/schemas/visual-review-result.v1.schema.json +0 -80
  132. package/assets/skills/explainer-kit/scripts/lib/catalog.mjs +0 -349
  133. package/assets/skills/explainer-kit/scripts/lib/content-approval.mjs +0 -418
  134. package/assets/skills/explainer-kit/scripts/lib/diagram.mjs +0 -514
  135. package/assets/skills/explainer-kit/scripts/lib/durability.mjs +0 -643
  136. package/assets/skills/explainer-kit/scripts/lib/fact-base.mjs +0 -664
  137. package/assets/skills/explainer-kit/scripts/lib/internal-references.mjs +0 -538
  138. package/assets/skills/explainer-kit/scripts/lib/markdown.mjs +0 -414
  139. package/assets/skills/explainer-kit/scripts/lib/publication-policy.mjs +0 -54
  140. package/assets/skills/explainer-kit/scripts/lib/records.mjs +0 -954
  141. package/assets/skills/explainer-kit/scripts/lib/render.mjs +0 -703
  142. package/assets/skills/explainer-kit/scripts/lib/s3-roots.mjs +0 -353
  143. package/assets/skills/explainer-kit/scripts/lib/s3-static.mjs +0 -759
  144. package/assets/skills/explainer-kit/scripts/lib/set-plan.mjs +0 -209
  145. package/assets/skills/explainer-kit/scripts/lib/source-backlinks.mjs +0 -218
  146. package/assets/skills/explainer-kit/scripts/lib/terminal-evidence.mjs +0 -157
  147. package/assets/skills/explainer-kit/scripts/lib/visual-review.mjs +0 -400
  148. package/assets/skills/explainer-kit/scripts/publish.mjs +0 -76
  149. package/assets/skills/explainer-kit/scripts/record-durability.mjs +0 -64
  150. package/assets/skills/explainer-kit/scripts/render-qa.mjs +0 -461
  151. package/assets/skills/explainer-kit/scripts/run.mjs +0 -3038
  152. package/assets/skills/explainer-kit/scripts/validate.mjs +0 -59
  153. package/assets/skills/oat-explainer-kit/references/author-callback.md +0 -53
  154. package/assets/skills/oat-explainer-kit/references/migration.md +0 -144
  155. package/assets/skills/oat-explainer-kit/references/visual-review-callback.md +0 -83
  156. package/assets/skills/oat-explainer-kit/scripts/derive-destination.mjs +0 -91
  157. package/assets/skills/oat-explainer-kit/scripts/finalize-tracked-run.mjs +0 -531
  158. package/assets/skills/oat-explainer-kit/scripts/probe-recap-seams.mjs +0 -371
  159. package/assets/skills/oat-explainer-kit/scripts/run.mjs +0 -905
  160. package/dist/commands/project/archive/explainer-source-backlinks.d.ts +0 -18
  161. package/dist/commands/project/archive/explainer-source-backlinks.d.ts.map +0 -1
  162. package/dist/commands/project/archive/explainer-source-backlinks.js +0 -27
  163. package/dist/commands/project/archive/explainer-terminal-evidence.d.ts +0 -29
  164. package/dist/commands/project/archive/explainer-terminal-evidence.d.ts.map +0 -1
  165. package/dist/commands/project/archive/explainer-terminal-evidence.js +0 -37
@@ -1,59 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- import { readFile } from 'node:fs/promises';
4
- import { pathToFileURL } from 'node:url';
5
-
6
- import { validateContract } from './lib/contracts.mjs';
7
-
8
- export async function runValidationCli(
9
- argv = process.argv.slice(2),
10
- io = console,
11
- ) {
12
- const [kind, inputPath] = argv;
13
- if (!kind || !inputPath) {
14
- const result = {
15
- valid: false,
16
- errors: [
17
- {
18
- path: '$',
19
- code: 'usage',
20
- message: 'Usage: validate.mjs <contract-kind> <json-path>',
21
- },
22
- ],
23
- };
24
- io.log(JSON.stringify(result, null, 2));
25
- return 1;
26
- }
27
-
28
- try {
29
- const value = JSON.parse(await readFile(inputPath, 'utf8'));
30
- const result = validateContract(kind, value);
31
- io.log(JSON.stringify(result, null, 2));
32
- return result.valid ? 0 : 1;
33
- } catch (error) {
34
- io.log(
35
- JSON.stringify(
36
- {
37
- valid: false,
38
- errors: [
39
- {
40
- path: '$',
41
- code: 'input',
42
- message: error instanceof Error ? error.message : String(error),
43
- },
44
- ],
45
- },
46
- null,
47
- 2,
48
- ),
49
- );
50
- return 1;
51
- }
52
- }
53
-
54
- if (
55
- process.argv[1] &&
56
- pathToFileURL(process.argv[1]).href === import.meta.url
57
- ) {
58
- process.exitCode = await runValidationCli();
59
- }
@@ -1,53 +0,0 @@
1
- # Author callback contract
2
-
3
- Lifecycle callers own the executable author seam; the explainer core owns
4
- construction of each author request. In-process callers pass an `author`
5
- callback to `runOatExplainer`. JSON-only and official CLI callers pass
6
- `authorModulePath`, which must name a module with an `author` function export.
7
- Provide exactly one of those inputs in both interactive and unattended modes.
8
- The callback or module may use any provider, but its request and result remain
9
- provider-neutral.
10
-
11
- ## Request handling
12
-
13
- The callback receives one `explainer-kit.author-request/v2` per artifact. The
14
- core constructs that request from recipe-owned policy:
15
-
16
- - `brief` contains the prose loaded from the floor entry or expansion profile's
17
- `briefRef`; the author must treat the inlined brief as its editorial contract.
18
- - `visualAuthoringGuidance` contains the installed core's bundled
19
- representation, hierarchy, responsive-navigation, table, diagram, and deck
20
- rules. Treat it as the medium baseline; do not read ambient or home-directory
21
- guidance.
22
- - `factBase` contains the reconciled evidence for the run. Ground claims in that
23
- fact base and do not replace it with ambient project context.
24
- - `authoring` selects the output path. Return Markdown for `markdown` and a
25
- complete HTML document for `html`.
26
- - `theme` is attached to every request. HTML requests also carry the
27
- recipe-selected `shell`; use it as the starting canvas while following the
28
- brief's license to elaborate.
29
- - A floor request may include `floor.requiredNarrative`, which identifies the
30
- narrative coverage checked later as non-blocking guidelines.
31
- - `setContext` is the complete immutable planner-owned portfolio and shared
32
- ledger. `plannedArtifact` is the exact entry assigned to this callback;
33
- preserve its identity, sources, draft, and visual intent.
34
-
35
- Return one matching `explainer-kit.author-result/v2`: preserve `artifactId`,
36
- set exactly one of `content.markdown` or `content.html`, and include
37
- `provenance`. Do not persist provider credentials or callback configuration in
38
- the result.
39
-
40
- ## Planner-owned expansion
41
-
42
- The set planner finalizes the complete floor and expansion portfolio before any
43
- author runs. Authors must not return `proposedArtifacts` or otherwise add,
44
- remove, replace, or reorder portfolio entries. Handle only the supplied
45
- `plannedArtifact`; the core rejects author-driven expansion after planning.
46
-
47
- ## Lifecycle invocation
48
-
49
- Automated project-completion and implementation-tail recaps always call
50
- `runOatExplainer` with `mode: unattended`. They construct the author seam before
51
- invocation and supply it alongside the existing provider-neutral `critic` or
52
- validated `criticModulePath`. Interactive invocations use the same author
53
- contract; only the later approval behavior differs.
@@ -1,144 +0,0 @@
1
- # Private-wrapper migration
2
-
3
- This runbook migrates the externally owned private wrapper from the monolithic
4
- `oat-explainer-kit` 0.4.1 workflow to the frozen v1 pre/core/post seam. Keep the
5
- 0.4.1 installation and its private configuration available until one unchanged
6
- release candidate passes every acceptance gate.
7
-
8
- ## Prepare the private wrapper
9
-
10
- 1. Back up the installed 0.4.1 skill, private presets, Stoa configuration, and
11
- Google Docs settings. Confirm the backup contains `SKILL.md`, scripts,
12
- references, and templates.
13
- 2. Install the candidate `explainer-kit` at user scope and verify that the
14
- wrapper resolves that installed copy, never a source checkout.
15
- 3. Change wrapper pre-resolution to produce one
16
- `explainer-kit.run-request/v1`. Keep preset selection, vault/Stoa paths,
17
- Google account data, authentication choices, and personal destination
18
- topology in private wrapper configuration.
19
- 4. Invoke the core once, consume only `explainer-kit.manifest/v1` and the
20
- optional `explainer-kit.publish-receipt/v2` (while retaining v1 replay),
21
- then perform Stoa notes, Google Docs sync, and
22
- private link maintenance as post-run work.
23
-
24
- Do not add a plugin, inject private work between core stages, or add private
25
- lanes to public OAT config.
26
-
27
- ### Private `presets.example.json`
28
-
29
- The private wrapper's `personal-oat` example should carry the confirmed public
30
- root:
31
-
32
- ```json
33
- {
34
- "presets": {
35
- "personal-oat": {
36
- "publicBaseUrl": "https://dy4vzrzaexuy5.cloudfront.net"
37
- }
38
- }
39
- }
40
- ```
41
-
42
- Copy `presets.example.json` to an untracked `presets.json` before adding
43
- accounts or authentication details.
44
-
45
- ### Private Stoa configuration
46
-
47
- The eventual private Stoa configuration may use the same confirmed public root
48
- to create manifest-derived links:
49
-
50
- ```json
51
- {
52
- "explainerLinks": {
53
- "publicBaseUrl": "https://dy4vzrzaexuy5.cloudfront.net",
54
- "source": "explainer-kit.manifest/v1"
55
- }
56
- }
57
- ```
58
-
59
- This is private-wrapper migration/config context, not a public core default or
60
- neutral fixture.
61
-
62
- ## Release-candidate sequence
63
-
64
- 1. Build and retain the packaged RC in a dedicated builder-owned directory;
65
- record its immutable RC identity:
66
-
67
- ```bash
68
- node tools/release/build-explainer-rc.mjs \
69
- --output dist/explainer-kit-rc \
70
- --record .oat/repo/reference/explainer-kit-acceptance/v1/rc.json
71
- ```
72
-
73
- The builder rejects repository/source roots, symlinks, and unowned existing
74
- directories. Reuse only an output carrying its ownership marker.
75
-
76
- 2. Run packaged direct-core and OAT-adapter build-only smoke tests.
77
- 3. Migrate the real private wrapper against that exact RC.
78
- 4. Run the operator-owned wrapper E2E as an executable pre/core/post sequence:
79
- resolve the private preset and external request; invoke the packaged core;
80
- then publish the manifest, retain its complete receipt, and perform
81
- vault/Stoa, Google Docs, and personal-link work. Verify all post-run evidence
82
- against the immutable core execution record.
83
- 5. Run the live S3/CDN acceptance against the same unchanged RC.
84
- 6. Promote only when both retained acceptance records pass and reference the
85
- same RC identity.
86
-
87
- Every packaged invocation supplies the retained artifacts explicitly; there is
88
- no current-working-directory fallback. The wrapper core stage does not declare
89
- post-run receipt evidence:
90
-
91
- ```bash
92
- node tools/release/run-explainer-rc.mjs \
93
- --rc-manifest .oat/repo/reference/explainer-kit-acceptance/v1/rc.json \
94
- --artifacts-dir dist/explainer-kit-rc \
95
- --entry scripts/run.mjs \
96
- --record .oat/repo/reference/explainer-kit-acceptance/v1/private-wrapper-execution.json \
97
- -- \
98
- --request /path/to/private/run-request.json
99
- ```
100
-
101
- The packaged CLI emits exactly one complete JSON result document; pretty
102
- printing across lines is valid and progress text is not. After that command
103
- returns, the private wrapper publishes and links the core manifest. Retain
104
- `private-wrapper-manifest.json`,
105
- `private-wrapper-publish-receipt.json`, and
106
- `private-wrapper-result.json` beside the RC identity. Wrapper acceptance reads
107
- and validates the full receipt as a separate post-run stage and rejects a
108
- foreign run ID, sentinel, artifact set, or manifest hash even when caller-owned
109
- files repeat the same receipt hash.
110
-
111
- The live connector stage is a separate packaged invocation:
112
-
113
- ```bash
114
- node tools/release/run-explainer-rc.mjs \
115
- --rc-manifest .oat/repo/reference/explainer-kit-acceptance/v1/rc.json \
116
- --artifacts-dir dist/explainer-kit-rc \
117
- --entry scripts/publish.mjs \
118
- --record .oat/repo/reference/explainer-kit-acceptance/v1/live-publish-result.json \
119
- -- \
120
- --request .oat/repo/reference/explainer-kit-acceptance/v1/live-publish-request.json \
121
- --receipt .oat/repo/reference/explainer-kit-acceptance/v1/publish-receipt.json \
122
- --confirm-publish
123
- ```
124
-
125
- Retain the execution record produced by that command. Acceptance binds it to
126
- the canonical request, manifest, receipt, and core run ID and rejects stale
127
- cross-run evidence.
128
-
129
- The in-repository compatibility fixture is a development guard. It does not
130
- satisfy the operator-owned real-wrapper gate.
131
-
132
- ## Rollback
133
-
134
- If migration or acceptance fails, do not promote the candidate:
135
-
136
- 1. Preserve the failed candidate's sanitized diagnostics and issue a new RC
137
- only after correcting the public seam or private wrapper.
138
- 2. Restore the backed-up 0.4.1 skill and private configuration.
139
- 3. Remove the candidate user-scope core and refresh provider views with
140
- `oat sync --scope all`.
141
- 4. Verify one known-good 0.4.1 build before resuming normal wrapper use.
142
-
143
- Do not retire the backup until the unchanged promoted RC has passed the
144
- operator-owned wrapper and live-publish gates.
@@ -1,83 +0,0 @@
1
- # Browser and visual-review callbacks
2
-
3
- Unattended project recaps require two provider-neutral executable seams. Supply
4
- each seam either directly or through a module path, never both:
5
-
6
- | Role | Direct input | Module-path input | Required export |
7
- | ---------------- | ---------------- | -------------------------- | ---------------- |
8
- | Browser evidence | `browserSession` | `browserSessionModulePath` | `browserSession` |
9
- | Whole-set review | `visualCritic` | `visualCriticModulePath` | `visualCritic` |
10
-
11
- Do not route these callbacks through `coreOptions`. The adapter resolves and
12
- validates both providers before core invocation and keeps callbacks and module
13
- paths out of retained requests.
14
-
15
- ## Browser evidence
16
-
17
- Create the direct descriptor with the compatible core's
18
- `createBrowserProbeSession()`. A module-path provider exports that branded
19
- descriptor as `browserSession`; it does not export a bare callback or a
20
- caller-authored metadata object. The core derives Chromium type and version
21
- from the launched `Browser` instance and validates the private session brand.
22
- Callers remain responsible for closing the session.
23
-
24
- The descriptor's probe receives one provider-neutral request for each artifact,
25
- viewport, and required interaction scenario. The request includes the rendered
26
- artifact, exact viewport dimensions, scenario, interaction expectations, and,
27
- for the default scenario, an absolute `screenshotPath`. The probe writes a PNG
28
- to that path and returns measured browser facts:
29
-
30
- - `pageOverflowX` as a boolean;
31
- - `clippedX`, `viewportClipped`, and `unreadableHeadings` as arrays;
32
- - `reducedMotion` as a boolean;
33
- - `keyboard` as an object describing observed key behavior; and
34
- - applicable deck, theme-toggle, animation, and layout measurements.
35
-
36
- For unattended project recaps the core chooses the canonical 320, 768, and 1440
37
- widths. The retained PNG signature and IHDR dimensions must match the requested
38
- viewport. The core writes paired metrics JSON itself; callback assertions do
39
- not substitute for retained evidence. Those
40
- `explainer-kit.browser-evidence/v2` records retain the launched Chromium name,
41
- version, capture settings, and stable capture identity. Deterministic fixture
42
- sessions are explicit test-only descriptors and are rejected by unattended
43
- project-recap production paths.
44
-
45
- ## Whole-set visual review
46
-
47
- The visual critic receives one
48
- `explainer-kit.visual-review-request/v1` plus a confined evidence reader. The
49
- request contains every rendered artifact, exact rendered-content hashes,
50
- viewport-matched screenshot and metrics hashes, observed cohesion claims, and
51
- the exact browser runtime and capture identity shared by every evidence record.
52
- Use the evidence reader to inspect the byte snapshot named by the request.
53
-
54
- Judge the rendered set as prose-led visual work. Cover typography, hierarchy,
55
- composition, density, medium leverage, template repetition, diagram semantics,
56
- and cross-artifact cohesion. Use the set plan and shared ledger to distinguish
57
- intentional variation from drift. Do not turn those judgments into numeric
58
- scores, geometry thresholds, or deterministic style checks.
59
-
60
- Return `explainer-kit.visual-review-result/v1` with:
61
-
62
- - a safe `reviewId`;
63
- - the request's exact `requestId` and `requestHash`;
64
- - an ISO `reviewedAt`;
65
- - `disposition` equal to `pass`, `correct`, or `fail`;
66
- - the complete reviewed `artifactIds`; and
67
- - structured `findings`.
68
-
69
- Return `pass` only when the full set needs no required correction. Return
70
- `correct` when one bounded review round can address every finding, and give
71
- each finding an actionable correction tied to an artifact and visible evidence.
72
- The result shape and its `pass`/`correct`/`fail` dispositions remain unchanged.
73
-
74
- The callback must not mutate rendered files, screenshots, or metrics. The core
75
- revalidates all bound bytes after the callback returns.
76
-
77
- ## Correction and terminal behavior
78
-
79
- `correct` permits one correction callback and exactly one final review. There
80
- is never a second correction or third review. Missing evidence, invalid
81
- contracts, thrown callbacks, byte mutation, unresolved correction, or a `fail`
82
- disposition produces `built-needs-review`. Such a run retains available review
83
- evidence but invokes neither durability nor publication.
@@ -1,91 +0,0 @@
1
- const INVOCATIONS = new Set(['project', 'repo', 'direct']);
2
-
3
- export function deriveExplainerDestination({
4
- invocation,
5
- projectSlug,
6
- s3Uri,
7
- publicBaseUrl,
8
- }) {
9
- if (!INVOCATIONS.has(invocation)) {
10
- throw new Error(`Unsupported explainer invocation: ${invocation}`);
11
- }
12
- const roots = {
13
- s3Uri: normalizeRoot(s3Uri, 's3Uri', 's3:'),
14
- publicBaseUrl: normalizeRoot(publicBaseUrl, 'publicBaseUrl', 'https:'),
15
- };
16
- if (invocation !== 'project') {
17
- return roots;
18
- }
19
-
20
- const encodedSlug = encodeProjectSlug(projectSlug);
21
- return {
22
- s3Uri: `${roots.s3Uri}/projects/${encodedSlug}`,
23
- publicBaseUrl: `${roots.publicBaseUrl}/projects/${encodedSlug}`,
24
- };
25
- }
26
-
27
- function encodeProjectSlug(projectSlug) {
28
- if (
29
- typeof projectSlug !== 'string' ||
30
- !projectSlug.trim() ||
31
- projectSlug === '.' ||
32
- projectSlug === '..' ||
33
- projectSlug.includes('/') ||
34
- projectSlug.includes('\\') ||
35
- projectSlug.includes('\0')
36
- ) {
37
- throw new Error(
38
- 'Project slug must be a non-empty, safe path segment without traversal or separators.',
39
- );
40
- }
41
- return encodeURIComponent(projectSlug);
42
- }
43
-
44
- function normalizeRoot(value, label, protocol) {
45
- if (typeof value !== 'string') {
46
- throw new Error(`${label} must be a valid destination root.`);
47
- }
48
- const root = value.trim();
49
- const authorityStart = `${protocol}//`;
50
- if (
51
- !root.startsWith(authorityStart) ||
52
- /\s|\\/.test(root) ||
53
- root.includes('?') ||
54
- root.includes('#')
55
- ) {
56
- throw new Error(`${label} must be a valid destination root.`);
57
- }
58
-
59
- let parsed;
60
- try {
61
- parsed = new URL(root);
62
- } catch {
63
- throw new Error(`${label} must be a valid destination root.`);
64
- }
65
- const authority = root.slice(authorityStart.length).split('/', 1)[0];
66
- if (
67
- parsed.protocol !== protocol ||
68
- !isValidRawAuthority(authority, protocol) ||
69
- !parsed.hostname ||
70
- parsed.username ||
71
- parsed.password ||
72
- parsed.search ||
73
- parsed.hash
74
- ) {
75
- throw new Error(`${label} must be a valid destination root.`);
76
- }
77
- return root.replace(/\/+$/, '');
78
- }
79
-
80
- function isValidRawAuthority(authority, protocol) {
81
- if (!authority || authority.includes('@')) {
82
- return false;
83
- }
84
- if (protocol === 's3:') {
85
- return /^[A-Za-z0-9](?:[A-Za-z0-9.-]*[A-Za-z0-9])?$/.test(authority);
86
- }
87
- if (authority.startsWith('[')) {
88
- return /^\[[^\]]+\](?::\d+)?$/.test(authority);
89
- }
90
- return /^[^:]+(?::\d+)?$/.test(authority);
91
- }