opencode-agent-orchestration-kit 1.0.44 → 1.1.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.
- package/CONTRIBUTING.md +0 -1
- package/NOTICE.md +1 -5
- package/README.md +37 -49
- package/compatibility.json +7 -0
- package/docs/cli.md +69 -1
- package/docs/commands.md +1 -1
- package/docs/comparison.md +3 -3
- package/docs/compatibility.md +33 -14
- package/docs/installation.md +2 -0
- package/docs/models.md +1 -1
- package/docs/open-design.md +2 -0
- package/docs/opencode-v2.md +190 -0
- package/docs/releases/v1.0.45.md +77 -0
- package/docs/releases/v1.1.0.md +91 -0
- package/docs/supply-chain.md +4 -7
- package/docs/threat-model.md +16 -6
- package/docs/troubleshooting.md +7 -4
- package/docs/workflows.md +27 -4
- package/opencode/AGENTS.md +18 -10
- package/opencode/agents/designer.md +1 -1
- package/opencode/agents/developer.md +60 -6
- package/opencode/agents/lead.md +59 -10
- package/opencode/agents/reviewer.md +7 -0
- package/opencode/agents/scoper.md +1 -0
- package/opencode/agents/specifier.md +1 -0
- package/opencode/commands/autonomous.md +175 -24
- package/opencode/docs/ai/evolution/README.md +5 -4
- package/opencode/docs/ai/evolution/benchmarks/adversarial-scenarios.jsonl +3 -0
- package/opencode/docs/ai/evolution/session-sources.md +12 -0
- package/opencode/docs/ai/harness/agents.md +23 -6
- package/opencode/docs/ai/harness/checks.md +3 -2
- package/opencode/docs/ai/harness/commands.md +7 -4
- package/opencode/docs/ai/harness/skill_registry.json +107 -1
- package/opencode/docs/ai/harness/skill_registry.md +5 -0
- package/opencode/docs/ai/specs/mission-runtime.md +9 -0
- package/opencode/opencode.json +0 -1
- package/opencode/plugins/mission-runtime.test.mjs +15 -3
- package/opencode/plugins/mission-runtime.ts +11 -39
- package/opencode/plugins/oak-tui/server.ts +8 -0
- package/opencode/plugins/oak-tui/tui.tsx +81 -0
- package/opencode/plugins/open-design.ts +12 -0
- package/opencode/plugins/shell-export-guard.ts +13 -23
- package/opencode/plugins/token-tree-usage.tsx +4 -1
- package/opencode/runtime/v1/mission-runtime.ts +73 -0
- package/opencode/runtime/v1/shell-export-guard.ts +9 -0
- package/opencode/runtime/v2/mission-events.d.mts +13 -0
- package/opencode/runtime/v2/mission-events.mjs +64 -0
- package/opencode/runtime/v2/mission-events.test.mjs +120 -0
- package/opencode/runtime/v2/mission-runtime.ts +26 -0
- package/opencode/runtime/v2/open-design.ts +17 -0
- package/opencode/runtime/v2/shell-export-guard.ts +8 -0
- package/opencode/runtime/v2/token-usage.d.mts +15 -0
- package/opencode/runtime/v2/token-usage.mjs +35 -0
- package/opencode/runtime/v2/token-usage.test.mjs +30 -0
- package/opencode/scripts/adversarial-harness.test.mjs +50 -1
- package/opencode/scripts/check-harness.mjs +150 -33
- package/opencode/scripts/check-harness.test.mjs +81 -8
- package/opencode/scripts/collect-session-evidence.mjs +57 -39
- package/opencode/scripts/collect-session-evidence.test.mjs +164 -0
- package/opencode/scripts/deliver.d.mts +37 -0
- package/opencode/scripts/deliver.mjs +204 -0
- package/opencode/scripts/deliver.test.mjs +245 -0
- package/opencode/scripts/loop-state.mjs +50 -1
- package/opencode/scripts/loop-state.test.mjs +33 -0
- package/opencode/scripts/mission-runtime.test.mjs +1 -1
- package/opencode/scripts/mission-status.test.mjs +2 -0
- package/opencode/scripts/runtime-permission-policy.mjs +1 -1
- package/opencode/scripts/runtime-permission-policy.test.mjs +3 -2
- package/opencode/scripts/session-sources.d.mts +6 -0
- package/opencode/scripts/session-sources.mjs +49 -0
- package/opencode/scripts/shell-export-guard-core.d.mts +2 -0
- package/opencode/scripts/shell-export-guard-core.mjs +21 -0
- package/opencode/scripts/shell-export-guard-core.test.mjs +43 -0
- package/opencode/scripts/task-run.d.mts +63 -0
- package/opencode/scripts/task-run.mjs +224 -0
- package/opencode/scripts/task-run.test.mjs +178 -0
- package/opencode/skills/debugging-and-error-recovery/SKILL.md +20 -0
- package/opencode/skills/oak-adversarial-review/SKILL.md +138 -0
- package/opencode/skills/oak-commit/SKILL.md +69 -0
- package/opencode/skills/oak-enrich-task/SKILL.md +109 -0
- package/opencode/skills/oak-runtime-verification/SKILL.md +103 -0
- package/opencode/skills/oak-update-docs/SKILL.md +54 -0
- package/opencode/tools/open-design-tools.d.mts +17 -0
- package/opencode/tools/open-design-tools.mjs +254 -0
- package/opencode/tools/open_design.ts +26 -259
- package/package.json +6 -3
- package/scripts/benchmark-tool-paths.mjs +1 -1
- package/scripts/check-compatibility.mjs +58 -4
- package/scripts/check-compatibility.test.mjs +159 -11
- package/scripts/check-public-boundary.mjs +3 -0
- package/scripts/check-supply-chain.mjs +26 -58
- package/scripts/check-supply-chain.test.mjs +39 -36
- package/scripts/check.sh +42 -7
- package/scripts/manage-installation.mjs +34 -20
- package/scripts/manage-installation.test.mjs +29 -0
- package/scripts/oak.mjs +72 -2
- package/scripts/oak.test.mjs +69 -1
- package/scripts/open-design-http.test.mjs +1 -1
- package/scripts/open-design-tools.test.mjs +49 -0
- package/scripts/opencode-compat-smoke.sh +45 -4
- package/scripts/opencode-v2-smoke.mjs +197 -0
- package/scripts/opencode-v2-smoke.test.mjs +59 -0
- package/scripts/package-smoke.mjs +14 -0
- package/scripts/package-smoke.test.mjs +45 -2
- package/scripts/version.test.mjs +2 -2
- package/supply-chain.json +0 -4
- package/docker/open-design/data/app.sqlite +0 -0
- package/docker/open-design/data/app.sqlite-shm +0 -0
- package/docker/open-design/data/app.sqlite-wal +0 -0
- package/docker/open-design/opencode-auth/log/2026-05-02T105802.log +0 -17
- package/docker/open-design/opencode-auth/log/2026-05-04T102127.log +0 -16
- package/docker/open-design/opencode-auth/opencode.db +0 -0
- package/docker/open-design/opencode-auth/opencode.db-shm +0 -0
- package/docker/open-design/opencode-auth/opencode.db-wal +0 -0
- package/docs/superpowers.md +0 -41
|
@@ -9,9 +9,10 @@ import { compareStableVersions, parseStableVersion } from "./version.mjs";
|
|
|
9
9
|
const SCRIPT_PATH = fileURLToPath(import.meta.url);
|
|
10
10
|
const REPOSITORY_ROOT = path.dirname(path.dirname(SCRIPT_PATH));
|
|
11
11
|
const EXACT_KEYS = {
|
|
12
|
-
root: ["schema_version", "node", "opencode", "sdk"],
|
|
12
|
+
root: ["schema_version", "node", "opencode", "opencode_v2", "sdk"],
|
|
13
13
|
node: ["engines", "blocking_majors", "canary_major"],
|
|
14
14
|
opencode: ["supported_range", "minimum_tested", "stable_tested", "canary"],
|
|
15
|
+
opencode_v2: ["status", "supported_range", "minimum_tested", "canary", "plugin_sdk"],
|
|
15
16
|
sdk: ["opencode_plugin", "opentui_core", "opentui_solid"],
|
|
16
17
|
};
|
|
17
18
|
const STATUS_TERMS = new Set(["tested", "supported", "experimental", "unsupported"]);
|
|
@@ -24,7 +25,6 @@ const STATIC_MATRIX_STATUSES = [
|
|
|
24
25
|
["Native Windows", "unsupported"],
|
|
25
26
|
["Token usage plugin", "experimental"],
|
|
26
27
|
["Open Design Docker adapter", "experimental"],
|
|
27
|
-
["Superpowers", "experimental"],
|
|
28
28
|
["Impeccable", "experimental"],
|
|
29
29
|
];
|
|
30
30
|
|
|
@@ -70,8 +70,11 @@ function expectedMatrixStatuses(data) {
|
|
|
70
70
|
[`OpenCode ${data.opencode.minimum_tested}`, "tested"],
|
|
71
71
|
[`OpenCode ${data.opencode.stable_tested}`, "tested"],
|
|
72
72
|
[`OpenCode ${data.opencode.supported_range}`, "supported"],
|
|
73
|
-
[`OpenCode
|
|
73
|
+
[`OpenCode ${data.opencode_v2.minimum_tested}`, "tested"],
|
|
74
|
+
[`OpenCode ${data.opencode_v2.supported_range}`, data.opencode_v2.status],
|
|
75
|
+
[`OpenCode <${data.opencode.minimum_tested}, >=2.0.0 <${data.opencode_v2.minimum_tested}, or >=3.0.0`, "unsupported"],
|
|
74
76
|
[`@opencode-ai/plugin ${data.sdk.opencode_plugin}`, "tested"],
|
|
77
|
+
[`@opencode/plugin ${data.opencode_v2.plugin_sdk}`, "tested"],
|
|
75
78
|
[openTuiSurface, "tested"],
|
|
76
79
|
...STATIC_MATRIX_STATUSES,
|
|
77
80
|
]);
|
|
@@ -143,6 +146,24 @@ function validateCanonicalData(data) {
|
|
|
143
146
|
throw invalid("supported_range must begin at minimum_tested and end before 2.0.0");
|
|
144
147
|
}
|
|
145
148
|
if (data.opencode.canary !== "latest") throw invalid("opencode.canary must be latest");
|
|
149
|
+
assertExactKeys(data.opencode_v2, EXACT_KEYS.opencode_v2, "opencode_v2");
|
|
150
|
+
if (!["experimental", "supported"].includes(data.opencode_v2.status)) {
|
|
151
|
+
throw invalid("opencode_v2.status must be experimental or supported");
|
|
152
|
+
}
|
|
153
|
+
for (const field of ["minimum_tested", "plugin_sdk"]) {
|
|
154
|
+
try {
|
|
155
|
+
parseStableVersion(data.opencode_v2[field]);
|
|
156
|
+
} catch {
|
|
157
|
+
throw invalid(`opencode_v2.${field} must use MAJOR.MINOR.PATCH`);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
if (parseStableVersion(data.opencode_v2.minimum_tested).major !== 2) {
|
|
161
|
+
throw invalid("opencode_v2.minimum_tested must be a 2.x release");
|
|
162
|
+
}
|
|
163
|
+
if (data.opencode_v2.supported_range !== `>=${data.opencode_v2.minimum_tested} <3.0.0`) {
|
|
164
|
+
throw invalid("opencode_v2.supported_range must begin at minimum_tested and end before 3.0.0");
|
|
165
|
+
}
|
|
166
|
+
if (data.opencode_v2.canary !== "latest") throw invalid("opencode_v2.canary must be latest");
|
|
146
167
|
for (const [field, value] of Object.entries(data.sdk)) {
|
|
147
168
|
try {
|
|
148
169
|
parseStableVersion(value);
|
|
@@ -219,6 +240,10 @@ function validatePackages(root, data, fsOps) {
|
|
|
219
240
|
);
|
|
220
241
|
}
|
|
221
242
|
}
|
|
243
|
+
const typecheckV2 = readJson(root, "typecheck/v2/package.json", fsOps);
|
|
244
|
+
if (typecheckV2.devDependencies?.["@opencode/plugin"] !== data.opencode_v2.plugin_sdk) {
|
|
245
|
+
throw invalid("typecheck/v2/package.json @opencode/plugin must match compatibility.json opencode_v2.plugin_sdk");
|
|
246
|
+
}
|
|
222
247
|
}
|
|
223
248
|
|
|
224
249
|
export function extractMarkedSection(text, start, end) {
|
|
@@ -236,6 +261,9 @@ export function extractMarkedSection(text, start, end) {
|
|
|
236
261
|
if (start.includes("compatibility-canary")) {
|
|
237
262
|
throw invalid("compatibility canary must contain exactly one marker pair");
|
|
238
263
|
}
|
|
264
|
+
if (start.includes("opencode-v2")) {
|
|
265
|
+
throw invalid("OpenCode 2 workflow must contain exactly one opencode-v2 marker pair");
|
|
266
|
+
}
|
|
239
267
|
throw invalid("workflow must contain exactly one compatibility blocking marker pair");
|
|
240
268
|
}
|
|
241
269
|
if (last <= first) {
|
|
@@ -248,6 +276,9 @@ export function extractMarkedSection(text, start, end) {
|
|
|
248
276
|
if (start.includes("compatibility-canary")) {
|
|
249
277
|
throw invalid("compatibility canary markers must be in order");
|
|
250
278
|
}
|
|
279
|
+
if (start.includes("opencode-v2")) {
|
|
280
|
+
throw invalid("OpenCode 2 workflow markers must be in order");
|
|
281
|
+
}
|
|
251
282
|
throw invalid("workflow compatibility blocking markers must be in order");
|
|
252
283
|
}
|
|
253
284
|
return text.slice(first + start.length, last);
|
|
@@ -290,13 +321,14 @@ function validateDocumentation(root, data, fsOps) {
|
|
|
290
321
|
data.opencode.supported_range,
|
|
291
322
|
data.opencode.minimum_tested,
|
|
292
323
|
data.opencode.stable_tested,
|
|
324
|
+
data.opencode_v2.supported_range,
|
|
325
|
+
data.opencode_v2.minimum_tested,
|
|
293
326
|
...data.node.blocking_majors.map((major) => `Node.js ${major}`),
|
|
294
327
|
`Node.js ${data.node.canary_major}`,
|
|
295
328
|
"WSL2",
|
|
296
329
|
"Native Windows",
|
|
297
330
|
"Token usage plugin",
|
|
298
331
|
"Open Design Docker adapter",
|
|
299
|
-
"Superpowers",
|
|
300
332
|
"Impeccable",
|
|
301
333
|
]) {
|
|
302
334
|
if (!matrix.includes(token) && !docs.includes(token)) {
|
|
@@ -652,11 +684,33 @@ function validateCompatibilityCanary(root, data, fsOps) {
|
|
|
652
684
|
}
|
|
653
685
|
}
|
|
654
686
|
|
|
687
|
+
function validateOpenCodeV2Workflow(root, data, fsOps) {
|
|
688
|
+
const workflow = readRegularText(root, ".github/workflows/opencode-v2.yml", fsOps);
|
|
689
|
+
const section = extractMarkedSection(workflow, "# opencode-v2:start", "# opencode-v2:end");
|
|
690
|
+
for (const token of [
|
|
691
|
+
"run: npm run typecheck:v2",
|
|
692
|
+
"run: npm --prefix typecheck/v2 ci --ignore-scripts",
|
|
693
|
+
`opencode: "${data.opencode_v2.minimum_tested}"`,
|
|
694
|
+
`opencode: ${data.opencode_v2.canary}`,
|
|
695
|
+
'run: node scripts/opencode-v2-smoke.mjs "${{ matrix.mode }}" "${{ matrix.opencode }}"',
|
|
696
|
+
]) {
|
|
697
|
+
if (!section.includes(token)) throw invalid(`OpenCode 2 workflow must contain: ${token}`);
|
|
698
|
+
}
|
|
699
|
+
if (/\$\{\{\s*secrets\./.test(workflow)) throw invalid("OpenCode 2 workflow must not use secrets");
|
|
700
|
+
if (!/^permissions:\n contents: read$/m.test(workflow) || /^\s*[^#\n]+:\s*(?:write|write-all)\s*$/m.test(workflow)) {
|
|
701
|
+
throw invalid("OpenCode 2 workflow must use read-only permissions");
|
|
702
|
+
}
|
|
703
|
+
if (/^ permissions\s*:/m.test(workflow)) {
|
|
704
|
+
throw invalid("OpenCode 2 workflow job-level permissions are forbidden");
|
|
705
|
+
}
|
|
706
|
+
}
|
|
707
|
+
|
|
655
708
|
function validateSurfaces(root, data, fsOps) {
|
|
656
709
|
validatePackages(root, data, fsOps);
|
|
657
710
|
validateDocumentation(root, data, fsOps);
|
|
658
711
|
validateWorkflow(root, data, fsOps);
|
|
659
712
|
validateCompatibilityCanary(root, data, fsOps);
|
|
713
|
+
validateOpenCodeV2Workflow(root, data, fsOps);
|
|
660
714
|
const installSmoke = readRegularText(root, "scripts/install-smoke.sh", fsOps);
|
|
661
715
|
if (!/^\s*npm ci --ignore-scripts\s*$/m.test(installSmoke)) {
|
|
662
716
|
throw invalid("installation smoke must use npm ci --ignore-scripts");
|
|
@@ -23,6 +23,13 @@ const VALID_COMPATIBILITY = {
|
|
|
23
23
|
stable_tested: "1.18.4",
|
|
24
24
|
canary: "latest",
|
|
25
25
|
},
|
|
26
|
+
opencode_v2: {
|
|
27
|
+
status: "experimental",
|
|
28
|
+
supported_range: ">=2.0.18 <3.0.0",
|
|
29
|
+
minimum_tested: "2.0.18",
|
|
30
|
+
canary: "latest",
|
|
31
|
+
plugin_sdk: "2.0.18",
|
|
32
|
+
},
|
|
26
33
|
sdk: {
|
|
27
34
|
opencode_plugin: "1.14.41",
|
|
28
35
|
opentui_core: "0.2.5",
|
|
@@ -43,6 +50,13 @@ const REVISED_COMPATIBILITY = {
|
|
|
43
50
|
stable_tested: "1.19.0",
|
|
44
51
|
canary: "latest",
|
|
45
52
|
},
|
|
53
|
+
opencode_v2: {
|
|
54
|
+
status: "experimental",
|
|
55
|
+
supported_range: ">=2.0.18 <3.0.0",
|
|
56
|
+
minimum_tested: "2.0.18",
|
|
57
|
+
canary: "latest",
|
|
58
|
+
plugin_sdk: "2.0.18",
|
|
59
|
+
},
|
|
46
60
|
sdk: {
|
|
47
61
|
opencode_plugin: "1.15.0",
|
|
48
62
|
opentui_core: "0.3.0",
|
|
@@ -96,8 +110,11 @@ Canonical Node engine: \`${VALID_COMPATIBILITY.node.engines}\`.
|
|
|
96
110
|
| OpenCode 1.14.41 | tested | minimum boundary in the blocking core smoke |
|
|
97
111
|
| OpenCode 1.18.4 | tested | pinned stable boundary in the blocking core smoke |
|
|
98
112
|
| OpenCode >=1.14.41 <2.0.0 | supported | boundary-tested compatibility promise |
|
|
99
|
-
| OpenCode
|
|
113
|
+
| OpenCode 2.0.18 | tested | minimum OpenCode 2 boundary in the non-blocking OpenCode 2 workflow |
|
|
114
|
+
| OpenCode >=2.0.18 <3.0.0 | experimental | dual-runtime adapters; non-blocking CI; see docs/opencode-v2.md |
|
|
115
|
+
| OpenCode <1.14.41, >=2.0.0 <2.0.18, or >=3.0.0 | unsupported | requires a reviewed policy change |
|
|
100
116
|
| \`@opencode-ai/plugin\` 1.14.41 | tested | exact pin with install, import, and typecheck evidence |
|
|
117
|
+
| \`@opencode/plugin\` 2.0.18 | tested | type-only pin in typecheck/v2; never installed with the harness |
|
|
101
118
|
| OpenTUI core/solid 0.2.5 | tested | exact pins with install, import, and typecheck evidence |
|
|
102
119
|
| Ubuntu GitHub runner | tested | blocking Node 22 and 24 jobs |
|
|
103
120
|
| macOS GitHub runner | tested | blocking Node 24 job; runner details recorded |
|
|
@@ -106,7 +123,6 @@ Canonical Node engine: \`${VALID_COMPATIBILITY.node.engines}\`.
|
|
|
106
123
|
| Native Windows | unsupported | Bash lifecycle wrappers have no native contract |
|
|
107
124
|
| Token usage plugin | experimental | compile/import is tested; runtime session-tree behavior is not stable API evidence |
|
|
108
125
|
| Open Design Docker adapter | experimental | optional pinned image inputs, no blocking integration smoke |
|
|
109
|
-
| Superpowers | experimental | optional upstream Git plugin, not part of core smoke |
|
|
110
126
|
| Impeccable | experimental | optional externally installed skill |
|
|
111
127
|
<!-- compatibility-matrix:end -->
|
|
112
128
|
`;
|
|
@@ -282,6 +298,72 @@ jobs:
|
|
|
282
298
|
run: npm run installation-smoke
|
|
283
299
|
`;
|
|
284
300
|
|
|
301
|
+
const VALID_OPENCODE_V2_WORKFLOW = `name: OpenCode 2
|
|
302
|
+
|
|
303
|
+
on:
|
|
304
|
+
pull_request:
|
|
305
|
+
push:
|
|
306
|
+
branches:
|
|
307
|
+
- master
|
|
308
|
+
workflow_dispatch:
|
|
309
|
+
schedule:
|
|
310
|
+
- cron: "37 6 * * 1"
|
|
311
|
+
|
|
312
|
+
permissions:
|
|
313
|
+
contents: read
|
|
314
|
+
|
|
315
|
+
jobs:
|
|
316
|
+
# opencode-v2:start
|
|
317
|
+
typecheck:
|
|
318
|
+
runs-on: ubuntu-latest
|
|
319
|
+
steps:
|
|
320
|
+
- name: Checkout
|
|
321
|
+
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
|
|
322
|
+
with:
|
|
323
|
+
persist-credentials: false
|
|
324
|
+
|
|
325
|
+
- name: Setup Node
|
|
326
|
+
uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6
|
|
327
|
+
with:
|
|
328
|
+
node-version: 24
|
|
329
|
+
|
|
330
|
+
- name: Install OpenCode 1 tool dependencies
|
|
331
|
+
run: npm --prefix opencode ci --ignore-scripts
|
|
332
|
+
|
|
333
|
+
- name: Install OpenCode 2 type dependencies
|
|
334
|
+
run: npm --prefix typecheck/v2 ci --ignore-scripts
|
|
335
|
+
|
|
336
|
+
- name: Typecheck OpenCode 2 adapters
|
|
337
|
+
run: npm run typecheck:v2
|
|
338
|
+
|
|
339
|
+
smoke:
|
|
340
|
+
runs-on: ubuntu-latest
|
|
341
|
+
strategy:
|
|
342
|
+
fail-fast: false
|
|
343
|
+
matrix:
|
|
344
|
+
include:
|
|
345
|
+
- mode: core
|
|
346
|
+
opencode: "2.0.18"
|
|
347
|
+
- mode: default
|
|
348
|
+
opencode: "2.0.18"
|
|
349
|
+
- mode: core
|
|
350
|
+
opencode: latest
|
|
351
|
+
steps:
|
|
352
|
+
- name: Checkout
|
|
353
|
+
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
|
|
354
|
+
with:
|
|
355
|
+
persist-credentials: false
|
|
356
|
+
|
|
357
|
+
- name: Setup Node
|
|
358
|
+
uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6
|
|
359
|
+
with:
|
|
360
|
+
node-version: 24
|
|
361
|
+
|
|
362
|
+
- name: Smoke OpenCode 2
|
|
363
|
+
run: node scripts/opencode-v2-smoke.mjs "\${{ matrix.mode }}" "\${{ matrix.opencode }}"
|
|
364
|
+
# opencode-v2:end
|
|
365
|
+
`;
|
|
366
|
+
|
|
285
367
|
function writeJson(root, relative, value) {
|
|
286
368
|
const full = path.join(root, relative);
|
|
287
369
|
fs.mkdirSync(path.dirname(full), { recursive: true });
|
|
@@ -301,11 +383,16 @@ function makeFixture(t, compatibility = VALID_COMPATIBILITY) {
|
|
|
301
383
|
writeJson(root, "package.json", ROOT_PACKAGE);
|
|
302
384
|
writeJson(root, "opencode/package.json", PACKAGED_PACKAGE);
|
|
303
385
|
writeJson(root, "opencode/package-lock.json", PACKAGED_LOCK);
|
|
386
|
+
writeJson(root, "typecheck/v2/package.json", {
|
|
387
|
+
private: true,
|
|
388
|
+
devDependencies: { "@opencode/plugin": compatibility.opencode_v2?.plugin_sdk ?? "2.0.18" },
|
|
389
|
+
});
|
|
304
390
|
writeText(root, "docs/compatibility.md", COMPATIBILITY_MATRIX);
|
|
305
391
|
writeText(root, "README.md", README);
|
|
306
392
|
writeText(root, "docs/installation.md", INSTALLATION);
|
|
307
393
|
writeText(root, ".github/workflows/check.yml", VALID_WORKFLOW);
|
|
308
394
|
writeText(root, ".github/workflows/compatibility-canary.yml", VALID_CANARY_WORKFLOW);
|
|
395
|
+
writeText(root, ".github/workflows/opencode-v2.yml", VALID_OPENCODE_V2_WORKFLOW);
|
|
309
396
|
writeText(root, "scripts/install-smoke.sh", "#!/usr/bin/env bash\nnpm ci --ignore-scripts\n");
|
|
310
397
|
return root;
|
|
311
398
|
}
|
|
@@ -358,6 +445,45 @@ test("alternative supported OpenCode range is rejected", (t) => {
|
|
|
358
445
|
);
|
|
359
446
|
});
|
|
360
447
|
|
|
448
|
+
for (const [label, mutate, message] of [
|
|
449
|
+
["an OpenCode 2 range that skips minimum_tested", (data) => { data.opencode_v2.supported_range = ">=2.0.0 <3.0.0"; }, /opencode_v2.supported_range must begin at minimum_tested and end before 3.0.0/],
|
|
450
|
+
["an OpenCode 2 minimum outside 2.x", (data) => { data.opencode_v2.minimum_tested = "1.18.4"; }, /opencode_v2.minimum_tested must be a 2.x release/],
|
|
451
|
+
["an unknown OpenCode 2 status", (data) => { data.opencode_v2.status = "stable"; }, /opencode_v2.status must be experimental or supported/],
|
|
452
|
+
["a missing OpenCode 2 contract", (data) => { delete data.opencode_v2; }, /compatibility keys must be exactly/],
|
|
453
|
+
]) {
|
|
454
|
+
test(`OpenCode 2 compatibility rejects ${label}`, (t) => {
|
|
455
|
+
const data = structuredClone(VALID_COMPATIBILITY);
|
|
456
|
+
mutate(data);
|
|
457
|
+
const root = makeFixture(t, data);
|
|
458
|
+
assertInvalidCompatibility(() => checkCompatibility(root, { surfaces: false }), message);
|
|
459
|
+
});
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
for (const [label, mutate, message] of [
|
|
463
|
+
["without the latest canary", (text) => text.replace(" opencode: latest\n", ""), /OpenCode 2 workflow must contain: opencode: latest/],
|
|
464
|
+
["without the type workspace install", (text) => text.replace("run: npm --prefix typecheck/v2 ci --ignore-scripts", "run: true"), /OpenCode 2 workflow must contain: run: npm --prefix typecheck\/v2 ci --ignore-scripts/],
|
|
465
|
+
["with secrets", (text) => `${text}\n# \${{ secrets.TOKEN }}\n`, /must not use secrets/],
|
|
466
|
+
["with write permissions", (text) => text.replace(" contents: read\n", " contents: write\n"), /must use read-only permissions/],
|
|
467
|
+
["with an extra write scope", (text) => text.replace(" contents: read\n", " contents: read\n id-token: write\n"), /must use read-only permissions/],
|
|
468
|
+
["with job-level permissions", (text) => text.replace(" runs-on: ubuntu-latest\n", " runs-on: ubuntu-latest\n permissions:\n contents: read\n"), /job-level permissions are forbidden/],
|
|
469
|
+
["without markers", (text) => text.replace(" # opencode-v2:end\n", ""), /exactly one opencode-v2 marker pair/],
|
|
470
|
+
]) {
|
|
471
|
+
test(`OpenCode 2 workflow is rejected ${label}`, (t) => {
|
|
472
|
+
const root = makeFixture(t);
|
|
473
|
+
writeText(root, ".github/workflows/opencode-v2.yml", mutate(VALID_OPENCODE_V2_WORKFLOW));
|
|
474
|
+
assertInvalidCompatibility(() => checkCompatibility(root), message);
|
|
475
|
+
});
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
test("OpenCode 2 type pin drift names the typecheck workspace", (t) => {
|
|
479
|
+
const root = makeFixture(t);
|
|
480
|
+
writeJson(root, "typecheck/v2/package.json", { private: true, devDependencies: { "@opencode/plugin": "2.0.19" } });
|
|
481
|
+
assertInvalidCompatibility(
|
|
482
|
+
() => checkCompatibility(root),
|
|
483
|
+
/typecheck\/v2\/package\.json @opencode\/plugin must match compatibility\.json opencode_v2\.plugin_sdk/,
|
|
484
|
+
);
|
|
485
|
+
});
|
|
486
|
+
|
|
361
487
|
for (const [label, node, message] of [
|
|
362
488
|
["non-caret engine", { engines: ">=22", blocking_majors: [22], canary_major: 26 }, /node\.engines/],
|
|
363
489
|
["engine major drift", { engines: "^22.10.0 || ^25.0.0", blocking_majors: [22, 24], canary_major: 27 }, /blocking_majors/],
|
|
@@ -524,7 +650,6 @@ for (const [surface, currentStatus, replacement, expectedStatus] of [
|
|
|
524
650
|
["WSL2", "experimental", "supported", "experimental"],
|
|
525
651
|
["Token usage plugin", "experimental", "supported", "experimental"],
|
|
526
652
|
["Open Design Docker adapter", "experimental", "supported", "experimental"],
|
|
527
|
-
["Superpowers", "experimental", "supported", "experimental"],
|
|
528
653
|
["Impeccable", "experimental", "supported", "experimental"],
|
|
529
654
|
]) {
|
|
530
655
|
test(`documentation rejects the wrong status for ${surface}`, (t) => {
|
|
@@ -553,7 +678,6 @@ for (const surface of [
|
|
|
553
678
|
"Native Windows",
|
|
554
679
|
"Token usage plugin",
|
|
555
680
|
"Open Design Docker adapter",
|
|
556
|
-
"Superpowers",
|
|
557
681
|
"Impeccable",
|
|
558
682
|
]) {
|
|
559
683
|
test(`documentation requires the ${surface} boundary`, (t) => {
|
|
@@ -1211,12 +1335,7 @@ function makeCompatibilitySmokeFixture(t, options = {}) {
|
|
|
1211
1335
|
writeText(root, "opencode/node_modules/excluded", "must not be copied\n");
|
|
1212
1336
|
writeText(root, "opencode/.oak/excluded", "must not be copied\n");
|
|
1213
1337
|
writeText(root, "opencode/plugins/token-tree-usage.tsx", "export default {};\n");
|
|
1214
|
-
writeJson(root, "opencode/opencode.json", {
|
|
1215
|
-
default_agent: "lead",
|
|
1216
|
-
plugin: [
|
|
1217
|
-
"superpowers@git+https://github.com/obra/superpowers.git#d884ae04edebef577e82ff7c4e143debd0bbec99",
|
|
1218
|
-
],
|
|
1219
|
-
});
|
|
1338
|
+
writeJson(root, "opencode/opencode.json", { default_agent: "lead" });
|
|
1220
1339
|
|
|
1221
1340
|
const quotedRoot = shellQuote(root);
|
|
1222
1341
|
const realNpm = spawnSync("which", ["npm"], { encoding: "utf8" }).stdout.trim();
|
|
@@ -1256,7 +1375,7 @@ case "${options.mode ?? "core"}" in
|
|
|
1256
1375
|
;;
|
|
1257
1376
|
default)
|
|
1258
1377
|
test -f "$2/plugins/token-tree-usage.tsx"
|
|
1259
|
-
node -e 'const c=require(process.argv[1]);
|
|
1378
|
+
node -e 'const c=require(process.argv[1]); if (Object.hasOwn(c, "plugin")) process.exit(1)' "$2/opencode.json"
|
|
1260
1379
|
;;
|
|
1261
1380
|
esac
|
|
1262
1381
|
`);
|
|
@@ -1307,6 +1426,21 @@ case "$1" in
|
|
|
1307
1426
|
grep -q '^mode: primary$' "$OPENCODE_CONFIG_DIR/agents/lead.md"
|
|
1308
1427
|
printf '{\"name\":\"lead\",\"mode\":\"primary\",\"config\":\"%s\"${leak}}\\n' "$OPENCODE_CONFIG_DIR"
|
|
1309
1428
|
;;
|
|
1429
|
+
-e)
|
|
1430
|
+
test "$#" -eq 2
|
|
1431
|
+
test "$BUN_BE_BUN" = 1
|
|
1432
|
+
test "$OAK_PLUGIN_DIR" = "$OPENCODE_CONFIG_DIR/plugins"
|
|
1433
|
+
${options.pluginImportFailure ? "exit 1" : ":"}
|
|
1434
|
+
;;
|
|
1435
|
+
--print-logs)
|
|
1436
|
+
test "$#" -eq 6
|
|
1437
|
+
test "$2" = --log-level
|
|
1438
|
+
test "$3" = ERROR
|
|
1439
|
+
test "$4" = debug
|
|
1440
|
+
test "$5" = agent
|
|
1441
|
+
test "$6" = designer
|
|
1442
|
+
printf '{\"name\":\"designer\",\"mode\":\"subagent\",\"tools\":{\"open_design_health\":${options.designerTools === false ? "false" : "true"}}}\\n'
|
|
1443
|
+
;;
|
|
1310
1444
|
*) exit 43;;
|
|
1311
1445
|
esac
|
|
1312
1446
|
`);
|
|
@@ -1352,6 +1486,20 @@ test("default OpenCode compatibility smoke packs and loads the unmodified packag
|
|
|
1352
1486
|
);
|
|
1353
1487
|
});
|
|
1354
1488
|
|
|
1489
|
+
for (const [label, option, message] of [
|
|
1490
|
+
["a plugin that fails to import", { pluginImportFailure: true }, /an OAK plugin failed to import/],
|
|
1491
|
+
["unregistered Open Design tools", { designerTools: false }, /Open Design tools did not register/],
|
|
1492
|
+
]) {
|
|
1493
|
+
test(`default OpenCode compatibility smoke rejects ${label}`, (t) => {
|
|
1494
|
+
const root = makeCompatibilitySmokeFixture(t, { mode: "default", request: "1.18.4", ...option });
|
|
1495
|
+
const result = runCompatibilitySmoke(root, ["default", "1.18.4"]);
|
|
1496
|
+
|
|
1497
|
+
assert.notEqual(result.status, 0);
|
|
1498
|
+
assert.equal(result.stdout, "");
|
|
1499
|
+
assert.match(result.stderr, message);
|
|
1500
|
+
});
|
|
1501
|
+
}
|
|
1502
|
+
|
|
1355
1503
|
test("default OpenCode compatibility smoke does not fall back when npm pack fails", (t) => {
|
|
1356
1504
|
const root = makeCompatibilitySmokeFixture(t, {
|
|
1357
1505
|
mode: "default",
|
|
@@ -11,6 +11,9 @@ const REQUIRED_FILES = [
|
|
|
11
11
|
"opencode/commands/loop-status.md",
|
|
12
12
|
"opencode/docs/ai/specs/mission-runtime.md",
|
|
13
13
|
"opencode/plugins/mission-runtime.ts",
|
|
14
|
+
"opencode/runtime/v1/mission-runtime.ts",
|
|
15
|
+
"opencode/runtime/v2/mission-runtime.ts",
|
|
16
|
+
"opencode/runtime/v2/mission-events.mjs",
|
|
14
17
|
"opencode/scripts/mission-runtime-observer.mjs",
|
|
15
18
|
"opencode/scripts/mission-runtime-observer.d.mts",
|
|
16
19
|
"opencode/scripts/mission-status.mjs",
|
|
@@ -11,7 +11,6 @@ const REPOSITORY_ROOT = path.dirname(path.dirname(SCRIPT_PATH));
|
|
|
11
11
|
const EXACT_KEYS = {
|
|
12
12
|
root: ["schema_version", "external_refs", "npm_overrides"],
|
|
13
13
|
externalRefs: [
|
|
14
|
-
"superpowers",
|
|
15
14
|
"actions_checkout",
|
|
16
15
|
"actions_setup_node",
|
|
17
16
|
"open_design",
|
|
@@ -19,7 +18,6 @@ const EXACT_KEYS = {
|
|
|
19
18
|
"pnpm",
|
|
20
19
|
"opencode_ai",
|
|
21
20
|
],
|
|
22
|
-
integration: ["release", "commit"],
|
|
23
21
|
action: ["release", "commit"],
|
|
24
22
|
commit: ["commit"],
|
|
25
23
|
image: ["tag", "digest"],
|
|
@@ -33,7 +31,8 @@ const ACTION_RELEASE = /^v[1-9][0-9]*$/;
|
|
|
33
31
|
const NODE_IMAGE_TAG = /^[1-9][0-9]*-bookworm-slim$/;
|
|
34
32
|
const PACKAGE_FILES = [
|
|
35
33
|
"CODE_OF_CONDUCT.md", "CONTRIBUTING.md", "NOTICE.md", "README.md",
|
|
36
|
-
"SECURITY.md", "compatibility.json", "docker/",
|
|
34
|
+
"SECURITY.md", "compatibility.json", "docker/",
|
|
35
|
+
"!docker/open-design/data/", "!docker/open-design/opencode-auth/", "docs/", "doctor.sh",
|
|
37
36
|
"env.example", "install.sh", "opencode/", "rollback.sh", "scripts/",
|
|
38
37
|
"supply-chain.json", "uninstall.sh", "upgrade.sh",
|
|
39
38
|
];
|
|
@@ -72,7 +71,6 @@ function assertStableVersion(value, field) {
|
|
|
72
71
|
export function validateSupplyChainData(data) {
|
|
73
72
|
assertExactKeys(data, EXACT_KEYS.root, "supply chain");
|
|
74
73
|
assertExactKeys(data.external_refs, EXACT_KEYS.externalRefs, "external_refs");
|
|
75
|
-
assertExactKeys(data.external_refs.superpowers, EXACT_KEYS.integration, "external_refs.superpowers");
|
|
76
74
|
assertExactKeys(data.external_refs.actions_checkout, EXACT_KEYS.action, "external_refs.actions_checkout");
|
|
77
75
|
assertExactKeys(data.external_refs.actions_setup_node, EXACT_KEYS.action, "external_refs.actions_setup_node");
|
|
78
76
|
assertExactKeys(data.external_refs.open_design, EXACT_KEYS.commit, "external_refs.open_design");
|
|
@@ -83,17 +81,6 @@ export function validateSupplyChainData(data) {
|
|
|
83
81
|
|
|
84
82
|
if (data.schema_version !== 1) throw invalid("schema_version must be 1");
|
|
85
83
|
|
|
86
|
-
const superpowers = data.external_refs.superpowers;
|
|
87
|
-
if (typeof superpowers.release !== "string" || !superpowers.release.startsWith("v")) {
|
|
88
|
-
throw invalid("external_refs.superpowers.release must use canonical vMAJOR.MINOR.PATCH syntax");
|
|
89
|
-
}
|
|
90
|
-
try {
|
|
91
|
-
parseStableVersion(superpowers.release.slice(1));
|
|
92
|
-
} catch {
|
|
93
|
-
throw invalid("external_refs.superpowers.release must use canonical vMAJOR.MINOR.PATCH syntax");
|
|
94
|
-
}
|
|
95
|
-
assertCommit(superpowers.commit, "external_refs.superpowers.commit");
|
|
96
|
-
|
|
97
84
|
for (const field of ["actions_checkout", "actions_setup_node"]) {
|
|
98
85
|
const action = data.external_refs[field];
|
|
99
86
|
if (typeof action.release !== "string" || !ACTION_RELEASE.test(action.release)) {
|
|
@@ -241,24 +228,28 @@ function validatePackages(root, data, fsOps) {
|
|
|
241
228
|
}
|
|
242
229
|
}
|
|
243
230
|
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
if (name === "") continue;
|
|
250
|
-
if (
|
|
251
|
-
!entry
|
|
252
|
-
|| typeof entry !== "object"
|
|
253
|
-
|| typeof entry.resolved !== "string"
|
|
254
|
-
|| !/^https:\/\/registry\.npmjs\.org\/[^?#\s]+$/.test(entry.resolved)
|
|
255
|
-
) {
|
|
256
|
-
throw invalid(`opencode/package-lock.json ${name} must include a canonical npm registry resolved URL`);
|
|
231
|
+
// CI also installs the OpenCode 2 type workspace, so its lockfile follows the same rules.
|
|
232
|
+
for (const relative of ["opencode/package-lock.json", "typecheck/v2/package-lock.json"]) {
|
|
233
|
+
const packages = readJson(root, relative, fsOps).packages;
|
|
234
|
+
if (!packages || typeof packages !== "object" || Array.isArray(packages)) {
|
|
235
|
+
throw invalid(`${relative} packages must be an object`);
|
|
257
236
|
}
|
|
258
|
-
|
|
259
|
-
|
|
237
|
+
for (const [name, entry] of Object.entries(packages)) {
|
|
238
|
+
if (name === "") continue;
|
|
239
|
+
if (
|
|
240
|
+
!entry
|
|
241
|
+
|| typeof entry !== "object"
|
|
242
|
+
|| typeof entry.resolved !== "string"
|
|
243
|
+
|| !/^https:\/\/registry\.npmjs\.org\/[^?#\s]+$/.test(entry.resolved)
|
|
244
|
+
) {
|
|
245
|
+
throw invalid(`${relative} ${name} must include a canonical npm registry resolved URL`);
|
|
246
|
+
}
|
|
247
|
+
if (typeof entry.integrity !== "string" || !/^sha512-[A-Za-z0-9+/]+={0,2}$/.test(entry.integrity)) {
|
|
248
|
+
throw invalid(`${relative} ${name} must include non-empty sha512 integrity`);
|
|
249
|
+
}
|
|
260
250
|
}
|
|
261
251
|
}
|
|
252
|
+
const lock = readJson(root, "opencode/package-lock.json", fsOps);
|
|
262
253
|
for (const dependency of EXACT_KEYS.overrides) {
|
|
263
254
|
const entry = lock.packages?.[`node_modules/${dependency}`];
|
|
264
255
|
if (entry?.version !== data.npm_overrides[dependency]) {
|
|
@@ -385,24 +376,11 @@ function activeCommandFiles(root, fsOps) {
|
|
|
385
376
|
return files;
|
|
386
377
|
}
|
|
387
378
|
|
|
388
|
-
function validateStarterConfig(root,
|
|
379
|
+
function validateStarterConfig(root, fsOps) {
|
|
389
380
|
const relative = "opencode/opencode.json";
|
|
390
381
|
const config = readJson(root, relative, fsOps);
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
throw invalid(`${relative} plugin must be an array containing the exact Superpowers full reviewed commit`);
|
|
394
|
-
}
|
|
395
|
-
if (config.plugin.filter((plugin) => plugin === expected).length !== 1) {
|
|
396
|
-
throw invalid(`${relative} superpowers plugin must use the exact full reviewed commit ${data.external_refs.superpowers.commit}`);
|
|
397
|
-
}
|
|
398
|
-
for (const plugin of config.plugin) {
|
|
399
|
-
if (typeof plugin !== "string") throw invalid(`${relative} plugin entries must be strings`);
|
|
400
|
-
if (plugin.includes("git+https") && plugin !== expected) {
|
|
401
|
-
throw invalid(`${relative} git+https plugin must use the exact full reviewed commit`);
|
|
402
|
-
}
|
|
403
|
-
if (plugin.includes("@latest")) {
|
|
404
|
-
throw invalid(`${relative} must not use @latest in a stable input`);
|
|
405
|
-
}
|
|
382
|
+
if (Object.hasOwn(config, "plugin")) {
|
|
383
|
+
throw invalid(`${relative} must not declare external plugins`);
|
|
406
384
|
}
|
|
407
385
|
}
|
|
408
386
|
|
|
@@ -414,6 +392,7 @@ function validateWorkflowActions(root, data, fsOps) {
|
|
|
414
392
|
for (const relative of [
|
|
415
393
|
".github/workflows/check.yml",
|
|
416
394
|
".github/workflows/compatibility-canary.yml",
|
|
395
|
+
".github/workflows/opencode-v2.yml",
|
|
417
396
|
]) {
|
|
418
397
|
const workflow = readText(root, relative, fsOps);
|
|
419
398
|
const seen = new Map([...approved.keys()].map((action) => [action, 0]));
|
|
@@ -510,7 +489,6 @@ function canonicalDocumentationPinBlock(data) {
|
|
|
510
489
|
return `<!-- supply-chain-pins:start -->
|
|
511
490
|
| Surface | Reviewed label | Immutable identifier |
|
|
512
491
|
|---|---|---|
|
|
513
|
-
| Superpowers | ${data.external_refs.superpowers.release} | \`${data.external_refs.superpowers.commit}\` |
|
|
514
492
|
| actions/checkout | ${data.external_refs.actions_checkout.release} | \`${data.external_refs.actions_checkout.commit}\` |
|
|
515
493
|
| actions/setup-node | ${data.external_refs.actions_setup_node.release} | \`${data.external_refs.actions_setup_node.commit}\` |
|
|
516
494
|
| Open Design | reviewed commit | \`${data.external_refs.open_design.commit}\` |
|
|
@@ -538,7 +516,6 @@ function validateDocumentation(root, data, fsOps) {
|
|
|
538
516
|
const actualBlock = policy.slice(startIndex, endIndex + end.length);
|
|
539
517
|
if (actualBlock !== canonicalDocumentationPinBlock(data)) {
|
|
540
518
|
const rowPositions = [
|
|
541
|
-
"| Superpowers |",
|
|
542
519
|
"| actions/checkout |",
|
|
543
520
|
"| actions/setup-node |",
|
|
544
521
|
"| Open Design |",
|
|
@@ -572,15 +549,6 @@ function validateDocumentation(root, data, fsOps) {
|
|
|
572
549
|
if (!policy.includes(required)) throw invalid(message);
|
|
573
550
|
}
|
|
574
551
|
|
|
575
|
-
const expected = `superpowers@git+https://github.com/obra/superpowers.git#${data.external_refs.superpowers.commit}`;
|
|
576
|
-
const referencePattern = /superpowers@git\+https:\/\/github\.com\/obra\/superpowers\.git(?:#[A-Za-z0-9._-]+)?/g;
|
|
577
|
-
for (const activeDoc of ["README.md", "docs/superpowers.md"]) {
|
|
578
|
-
const references = readText(root, activeDoc, fsOps).match(referencePattern) ?? [];
|
|
579
|
-
if (references.length === 0 || references.some((reference) => reference !== expected)) {
|
|
580
|
-
throw invalid(`${activeDoc} active Superpowers reference must use the full reviewed commit`);
|
|
581
|
-
}
|
|
582
|
-
}
|
|
583
|
-
|
|
584
552
|
const documentationRequirements = new Map([
|
|
585
553
|
["README.md", [
|
|
586
554
|
["npm ci --ignore-scripts", "frozen install command"],
|
|
@@ -625,7 +593,7 @@ function validateDocumentation(root, data, fsOps) {
|
|
|
625
593
|
function validateSurfaces(root, data, fsOps) {
|
|
626
594
|
validatePackages(root, data, fsOps);
|
|
627
595
|
validateAutomatedInstalls(root, fsOps);
|
|
628
|
-
validateStarterConfig(root,
|
|
596
|
+
validateStarterConfig(root, fsOps);
|
|
629
597
|
validateWorkflowActions(root, data, fsOps);
|
|
630
598
|
validateStableWorkflowCommands(root, fsOps);
|
|
631
599
|
validateDockerfile(root, data, fsOps);
|