opencode-agent-orchestration-kit 1.0.45 → 1.1.1

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 (107) hide show
  1. package/CONTRIBUTING.md +0 -1
  2. package/NOTICE.md +1 -5
  3. package/README.md +37 -49
  4. package/compatibility.json +7 -0
  5. package/docs/cli.md +69 -1
  6. package/docs/commands.md +1 -1
  7. package/docs/comparison.md +3 -3
  8. package/docs/compatibility.md +33 -14
  9. package/docs/installation.md +2 -0
  10. package/docs/models.md +1 -1
  11. package/docs/open-design.md +2 -0
  12. package/docs/opencode-v2.md +190 -0
  13. package/docs/releases/v1.1.0.md +91 -0
  14. package/docs/releases/v1.1.1.md +54 -0
  15. package/docs/supply-chain.md +10 -8
  16. package/docs/threat-model.md +16 -6
  17. package/docs/troubleshooting.md +7 -4
  18. package/docs/workflows.md +27 -4
  19. package/opencode/AGENTS.md +18 -10
  20. package/opencode/agents/designer.md +1 -1
  21. package/opencode/agents/developer.md +60 -6
  22. package/opencode/agents/lead.md +19 -9
  23. package/opencode/agents/reviewer.md +7 -0
  24. package/opencode/agents/scoper.md +1 -0
  25. package/opencode/agents/specifier.md +1 -0
  26. package/opencode/commands/autonomous.md +175 -24
  27. package/opencode/docs/ai/evolution/README.md +5 -4
  28. package/opencode/docs/ai/evolution/benchmarks/adversarial-scenarios.jsonl +3 -0
  29. package/opencode/docs/ai/evolution/session-sources.md +12 -0
  30. package/opencode/docs/ai/harness/agents.md +8 -6
  31. package/opencode/docs/ai/harness/checks.md +3 -2
  32. package/opencode/docs/ai/harness/commands.md +7 -4
  33. package/opencode/docs/ai/harness/skill_registry.json +107 -1
  34. package/opencode/docs/ai/harness/skill_registry.md +5 -0
  35. package/opencode/docs/ai/specs/mission-runtime.md +9 -0
  36. package/opencode/opencode.json +0 -1
  37. package/opencode/plugins/mission-runtime.test.mjs +15 -3
  38. package/opencode/plugins/mission-runtime.ts +11 -39
  39. package/opencode/plugins/oak-tui/server.ts +8 -0
  40. package/opencode/plugins/oak-tui/tui.tsx +81 -0
  41. package/opencode/plugins/open-design.ts +12 -0
  42. package/opencode/plugins/shell-export-guard.ts +13 -23
  43. package/opencode/plugins/token-tree-usage.tsx +4 -1
  44. package/opencode/runtime/v1/mission-runtime.ts +73 -0
  45. package/opencode/runtime/v1/shell-export-guard.ts +9 -0
  46. package/opencode/runtime/v2/mission-events.d.mts +13 -0
  47. package/opencode/runtime/v2/mission-events.mjs +64 -0
  48. package/opencode/runtime/v2/mission-events.test.mjs +120 -0
  49. package/opencode/runtime/v2/mission-runtime.ts +26 -0
  50. package/opencode/runtime/v2/open-design.ts +17 -0
  51. package/opencode/runtime/v2/shell-export-guard.ts +8 -0
  52. package/opencode/runtime/v2/token-usage.d.mts +15 -0
  53. package/opencode/runtime/v2/token-usage.mjs +35 -0
  54. package/opencode/runtime/v2/token-usage.test.mjs +30 -0
  55. package/opencode/scripts/adversarial-harness.test.mjs +50 -1
  56. package/opencode/scripts/check-harness.mjs +142 -33
  57. package/opencode/scripts/check-harness.test.mjs +81 -8
  58. package/opencode/scripts/collect-session-evidence.mjs +59 -43
  59. package/opencode/scripts/collect-session-evidence.test.mjs +164 -0
  60. package/opencode/scripts/deliver.d.mts +37 -0
  61. package/opencode/scripts/deliver.mjs +204 -0
  62. package/opencode/scripts/deliver.test.mjs +245 -0
  63. package/opencode/scripts/loop-state.mjs +50 -1
  64. package/opencode/scripts/loop-state.test.mjs +33 -0
  65. package/opencode/scripts/mission-runtime.test.mjs +1 -1
  66. package/opencode/scripts/mission-status.test.mjs +2 -0
  67. package/opencode/scripts/runtime-permission-policy.mjs +1 -1
  68. package/opencode/scripts/runtime-permission-policy.test.mjs +3 -2
  69. package/opencode/scripts/session-sources.d.mts +6 -0
  70. package/opencode/scripts/session-sources.mjs +49 -0
  71. package/opencode/scripts/session-sources.test.mjs +41 -0
  72. package/opencode/scripts/shell-export-guard-core.d.mts +2 -0
  73. package/opencode/scripts/shell-export-guard-core.mjs +21 -0
  74. package/opencode/scripts/shell-export-guard-core.test.mjs +43 -0
  75. package/opencode/scripts/task-run.d.mts +63 -0
  76. package/opencode/scripts/task-run.mjs +224 -0
  77. package/opencode/scripts/task-run.test.mjs +178 -0
  78. package/opencode/skills/debugging-and-error-recovery/SKILL.md +20 -0
  79. package/opencode/skills/oak-adversarial-review/SKILL.md +138 -0
  80. package/opencode/skills/oak-commit/SKILL.md +69 -0
  81. package/opencode/skills/oak-enrich-task/SKILL.md +109 -0
  82. package/opencode/skills/oak-runtime-verification/SKILL.md +103 -0
  83. package/opencode/skills/oak-update-docs/SKILL.md +54 -0
  84. package/opencode/tools/open-design-tools.d.mts +17 -0
  85. package/opencode/tools/open-design-tools.mjs +254 -0
  86. package/opencode/tools/open_design.ts +26 -259
  87. package/package.json +4 -3
  88. package/scripts/benchmark-tool-paths.mjs +1 -1
  89. package/scripts/check-compatibility.mjs +58 -4
  90. package/scripts/check-compatibility.test.mjs +159 -11
  91. package/scripts/check-public-boundary.mjs +3 -0
  92. package/scripts/check-supply-chain.mjs +24 -57
  93. package/scripts/check-supply-chain.test.mjs +37 -35
  94. package/scripts/check.sh +42 -7
  95. package/scripts/manage-installation.mjs +34 -20
  96. package/scripts/manage-installation.test.mjs +29 -0
  97. package/scripts/oak.mjs +72 -2
  98. package/scripts/oak.test.mjs +69 -1
  99. package/scripts/open-design-http.test.mjs +1 -1
  100. package/scripts/open-design-tools.test.mjs +49 -0
  101. package/scripts/opencode-compat-smoke.sh +45 -4
  102. package/scripts/opencode-v2-smoke.mjs +197 -0
  103. package/scripts/opencode-v2-smoke.test.mjs +59 -0
  104. package/scripts/package-smoke.test.mjs +3 -3
  105. package/scripts/version.test.mjs +2 -2
  106. package/supply-chain.json +0 -4
  107. package/docs/superpowers.md +0 -41
@@ -23,10 +23,6 @@ const PACKAGE_FILES = [
23
23
  const VALID = {
24
24
  schema_version: 1,
25
25
  external_refs: {
26
- superpowers: {
27
- release: "v6.1.1",
28
- commit: "d884ae04edebef577e82ff7c4e143debd0bbec99",
29
- },
30
26
  actions_checkout: {
31
27
  release: "v6",
32
28
  commit: "d23441a48e516b6c34aea4fa41551a30e30af803",
@@ -75,7 +71,6 @@ function withFixture(data, callback) {
75
71
  }
76
72
  }
77
73
 
78
- const SUPERPOWERS_REF = `superpowers@git+https://github.com/obra/superpowers.git#${VALID.external_refs.superpowers.commit}`;
79
74
  const CHECKOUT_USE = `actions/checkout@${VALID.external_refs.actions_checkout.commit} # ${VALID.external_refs.actions_checkout.release}`;
80
75
  const SETUP_NODE_USE = `actions/setup-node@${VALID.external_refs.actions_setup_node.commit} # ${VALID.external_refs.actions_setup_node.release}`;
81
76
 
@@ -85,7 +80,6 @@ function canonicalPolicy() {
85
80
  <!-- supply-chain-pins:start -->
86
81
  | Surface | Reviewed label | Immutable identifier |
87
82
  |---|---|---|
88
- | Superpowers | ${VALID.external_refs.superpowers.release} | \`${VALID.external_refs.superpowers.commit}\` |
89
83
  | actions/checkout | ${VALID.external_refs.actions_checkout.release} | \`${VALID.external_refs.actions_checkout.commit}\` |
90
84
  | actions/setup-node | ${VALID.external_refs.actions_setup_node.release} | \`${VALID.external_refs.actions_setup_node.commit}\` |
91
85
  | Open Design | reviewed commit | \`${VALID.external_refs.open_design.commit}\` |
@@ -110,9 +104,8 @@ function writeValidDocumentation(root) {
110
104
  fs.writeFileSync(path.join(root, "docs/supply-chain.md"), canonicalPolicy());
111
105
  fs.writeFileSync(
112
106
  path.join(root, "README.md"),
113
- `${SUPERPOWERS_REF}\nnpm ci --ignore-scripts\nsqlite3\nsudo apt-get install -y sqlite3\n`,
107
+ `npm ci --ignore-scripts\nsqlite3\nsudo apt-get install -y sqlite3\n`,
114
108
  );
115
- fs.writeFileSync(path.join(root, "docs/superpowers.md"), `${SUPERPOWERS_REF}\n`);
116
109
  fs.writeFileSync(
117
110
  path.join(root, "docs/docker-open-design.md"),
118
111
  `node:${VALID.external_refs.node_image.tag}@${VALID.external_refs.node_image.digest}\nOPEN_DESIGN_REF=${VALID.external_refs.open_design.commit}\nOPENCODE_AI_VERSION=${VALID.external_refs.opencode_ai.version}\npnpm@${VALID.external_refs.pnpm.version} with pnpm install --frozen-lockfile\n`,
@@ -126,9 +119,19 @@ function writeValidDocumentation(root) {
126
119
 
127
120
  function writeValidSurfaceFiles(root) {
128
121
  fs.mkdirSync(path.join(root, "opencode"), { recursive: true });
129
- fs.writeFileSync(path.join(root, "opencode/opencode.json"), `${JSON.stringify({
130
- plugin: [SUPERPOWERS_REF],
122
+ fs.mkdirSync(path.join(root, "typecheck/v2"), { recursive: true });
123
+ fs.writeFileSync(path.join(root, "typecheck/v2/package-lock.json"), `${JSON.stringify({
124
+ lockfileVersion: 3,
125
+ packages: {
126
+ "": {},
127
+ "node_modules/typescript": {
128
+ version: "5.9.3",
129
+ resolved: "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz",
130
+ integrity: "sha512-typescript",
131
+ },
132
+ },
131
133
  })}\n`);
134
+ fs.writeFileSync(path.join(root, "opencode/opencode.json"), `${JSON.stringify({})}\n`);
132
135
  fs.mkdirSync(path.join(root, ".github/workflows"), { recursive: true });
133
136
  fs.writeFileSync(
134
137
  path.join(root, ".github/workflows/check.yml"),
@@ -138,6 +141,10 @@ function writeValidSurfaceFiles(root) {
138
141
  path.join(root, ".github/workflows/compatibility-canary.yml"),
139
142
  `# compatibility-canary:start\nsteps:\n - uses: ${CHECKOUT_USE}\n - uses: ${SETUP_NODE_USE}\n - run: bash scripts/opencode-compat-smoke.sh latest\n# compatibility-canary:end\n`,
140
143
  );
144
+ fs.writeFileSync(
145
+ path.join(root, ".github/workflows/opencode-v2.yml"),
146
+ `steps:\n - uses: ${CHECKOUT_USE}\n - uses: ${SETUP_NODE_USE}\n - run: npm --prefix typecheck/v2 ci --ignore-scripts\n`,
147
+ );
141
148
  fs.mkdirSync(path.join(root, "docker/open-design"), { recursive: true });
142
149
  fs.writeFileSync(
143
150
  path.join(root, "docker/open-design/Dockerfile"),
@@ -260,7 +267,7 @@ test("rejects missing and unknown keys at every schema level", () => {
260
267
  expectInvalid((data) => { data.unknown = true; }, "supply chain keys");
261
268
  expectInvalid((data) => delete data.external_refs.pnpm, "external_refs keys");
262
269
  expectInvalid((data) => { data.external_refs.unknown = {}; }, "external_refs keys");
263
- expectInvalid((data) => delete data.external_refs.superpowers.commit, "external_refs.superpowers keys");
270
+ expectInvalid((data) => delete data.external_refs.actions_checkout.commit, "external_refs.actions_checkout keys");
264
271
  expectInvalid((data) => { data.external_refs.node_image.unknown = true; }, "external_refs.node_image keys");
265
272
  expectInvalid((data) => delete data.npm_overrides.uuid, "npm_overrides keys");
266
273
  expectInvalid((data) => { data.npm_overrides.extra = "1.0.0"; }, "npm_overrides keys");
@@ -272,8 +279,8 @@ test("requires schema version 1", () => {
272
279
 
273
280
  test("requires lowercase full-length immutable commits", () => {
274
281
  expectInvalid(
275
- (data) => { data.external_refs.superpowers.commit = "D884AE04EDEBEF577E82FF7C4E143DEBD0BBEC99"; },
276
- "external_refs.superpowers.commit",
282
+ (data) => { data.external_refs.actions_checkout.commit = "D23441A48E516B6C34AEA4FA41551A30E30AF803"; },
283
+ "external_refs.actions_checkout.commit",
277
284
  );
278
285
  expectInvalid(
279
286
  (data) => { data.external_refs.open_design.commit = "1592beb"; },
@@ -293,10 +300,6 @@ test("requires a lowercase sha256 digest", () => {
293
300
  });
294
301
 
295
302
  test("requires canonical release labels", () => {
296
- expectInvalid(
297
- (data) => { data.external_refs.superpowers.release = "6.1.1"; },
298
- "external_refs.superpowers.release",
299
- );
300
303
  expectInvalid(
301
304
  (data) => { data.external_refs.actions_checkout.release = "v0"; },
302
305
  "external_refs.actions_checkout.release",
@@ -360,13 +363,13 @@ test("surface validation requires exactly the canonical oak and oc-switch bins",
360
363
  }
361
364
  });
362
365
 
363
- test("surface validation requires the exact Superpowers commit", () => {
366
+ test("starter config must not reference external plugins", () => {
364
367
  withSurfaceFixture((root) => {
365
368
  const relative = "opencode/opencode.json";
366
369
  const config = JSON.parse(fs.readFileSync(path.join(root, relative), "utf8"));
367
- config.plugin = ["superpowers@git+https://github.com/obra/superpowers.git"];
370
+ config.plugin = ["superpowers@git+https://github.com/obra/superpowers.git#d884ae04edebef577e82ff7c4e143debd0bbec99"];
368
371
  fs.writeFileSync(path.join(root, relative), `${JSON.stringify(config)}\n`);
369
- assert.throws(() => checkSupplyChain(root), /superpowers.*full reviewed commit/i);
372
+ assert.throws(() => checkSupplyChain(root), /opencode\/opencode\.json must not declare external plugins/);
370
373
  });
371
374
  });
372
375
 
@@ -559,7 +562,7 @@ test("documentation validation requires one ordered canonical supply-chain pin b
559
562
  (policy) => policy.replace("<!-- supply-chain-pins:start -->\n", ""),
560
563
  (policy) => `${policy}\n${policy}`,
561
564
  (policy) => policy.replace(
562
- /\| Superpowers \|[^\n]+\n\| actions\/checkout \|[^\n]+/,
565
+ /\| actions\/checkout \|[^\n]+\n\| actions\/setup-node \|[^\n]+/,
563
566
  (pair) => pair.split("\n").reverse().join("\n"),
564
567
  ),
565
568
  ]) {
@@ -572,8 +575,6 @@ test("documentation validation requires one ordered canonical supply-chain pin b
572
575
  });
573
576
 
574
577
  for (const [label, current, replacement] of [
575
- ["Superpowers release", `| Superpowers | ${VALID.external_refs.superpowers.release} |`, "| Superpowers | DRIFTED |"],
576
- ["Superpowers commit", `| \`${VALID.external_refs.superpowers.commit}\` |`, "| `DRIFTED` |"],
577
578
  ["checkout release", `| actions/checkout | ${VALID.external_refs.actions_checkout.release} |`, "| actions/checkout | DRIFTED |"],
578
579
  ["checkout commit", `| \`${VALID.external_refs.actions_checkout.commit}\` |`, "| `DRIFTED` |"],
579
580
  ["setup-node release", `| actions/setup-node | ${VALID.external_refs.actions_setup_node.release} |`, "| actions/setup-node | DRIFTED |"],
@@ -610,18 +611,6 @@ for (const [label, current, message] of [
610
611
  });
611
612
  }
612
613
 
613
- for (const relative of ["README.md", "docs/superpowers.md"]) {
614
- test(`documentation validation requires active Superpowers examples in ${relative} to use the full commit`, () => {
615
- withSurfaceFixture((root) => {
616
- fs.writeFileSync(
617
- path.join(root, relative),
618
- "superpowers@git+https://github.com/obra/superpowers.git#v6.1.1\n",
619
- );
620
- assert.throws(() => checkSupplyChain(root), /active Superpowers reference.*full reviewed commit/i);
621
- });
622
- });
623
- }
624
-
625
614
  test("documentation validation excludes historical plans, specs, and releases", () => {
626
615
  withSurfaceFixture((root) => {
627
616
  for (const relative of [
@@ -700,6 +689,19 @@ for (const [dependency, mutation] of [
700
689
  });
701
690
  }
702
691
 
692
+ test("surface validation rejects a non-registry entry in the OpenCode 2 type workspace lockfile", () => {
693
+ withSurfaceFixture((root) => {
694
+ const relative = "typecheck/v2/package-lock.json";
695
+ const lock = JSON.parse(fs.readFileSync(path.join(root, relative), "utf8"));
696
+ lock.packages["node_modules/typescript"].resolved = "https://example.invalid/typescript.tgz";
697
+ fs.writeFileSync(path.join(root, relative), `${JSON.stringify(lock)}\n`);
698
+ assert.throws(
699
+ () => checkSupplyChain(root),
700
+ /typecheck\/v2\/package-lock\.json node_modules\/typescript must include a canonical npm registry resolved URL/,
701
+ );
702
+ });
703
+ });
704
+
703
705
  test("surface validation rejects a lockfile not regenerated to the Babel override", () => {
704
706
  withSurfaceFixture((root) => {
705
707
  const relative = "opencode/package-lock.json";
package/scripts/check.sh CHANGED
@@ -37,6 +37,9 @@ scripts/package-smoke.test.mjs
37
37
  scripts/benchmark-tool-paths.mjs
38
38
  scripts/benchmark-tool-paths.test.mjs
39
39
  scripts/opencode-compat-smoke.sh
40
+ scripts/opencode-v2-smoke.mjs
41
+ scripts/opencode-v2-smoke.test.mjs
42
+ .github/workflows/opencode-v2.yml
40
43
  scripts/manage-installation.mjs
41
44
  scripts/manage-installation.test.mjs
42
45
  scripts/oak.mjs
@@ -49,11 +52,36 @@ opencode/.gitignore
49
52
  opencode/package.json
50
53
  opencode/package-lock.json
51
54
  opencode/plugins/token-tree-usage.tsx
55
+ opencode/plugins/oak-tui/server.ts
56
+ opencode/plugins/oak-tui/tui.tsx
57
+ opencode/runtime/v2/token-usage.mjs
58
+ opencode/runtime/v2/token-usage.d.mts
59
+ opencode/runtime/v2/token-usage.test.mjs
52
60
  opencode/plugins/shell-export-guard.ts
61
+ opencode/runtime/v1/shell-export-guard.ts
62
+ opencode/runtime/v2/shell-export-guard.ts
63
+ opencode/scripts/shell-export-guard-core.mjs
64
+ opencode/scripts/shell-export-guard-core.d.mts
65
+ opencode/scripts/shell-export-guard-core.test.mjs
66
+ opencode/scripts/session-sources.mjs
67
+ opencode/scripts/session-sources.d.mts
68
+ typecheck/v2/package.json
69
+ typecheck/v2/package-lock.json
70
+ typecheck/v2/tsconfig.json
53
71
  opencode/plugins/mission-runtime.ts
72
+ opencode/runtime/v1/mission-runtime.ts
73
+ opencode/runtime/v2/mission-runtime.ts
74
+ opencode/runtime/v2/mission-events.mjs
75
+ opencode/runtime/v2/mission-events.d.mts
76
+ opencode/runtime/v2/mission-events.test.mjs
54
77
  opencode/plugins/mission-runtime.test.mjs
55
78
  opencode/tools/open_design.ts
56
79
  opencode/tools/open-design-http.mjs
80
+ opencode/tools/open-design-tools.mjs
81
+ opencode/tools/open-design-tools.d.mts
82
+ opencode/runtime/v2/open-design.ts
83
+ opencode/plugins/open-design.ts
84
+ scripts/open-design-tools.test.mjs
57
85
  opencode/tools/open-design-http.d.mts
58
86
  opencode/scripts/check-harness.mjs
59
87
  opencode/scripts/mission-runtime-observer.mjs
@@ -66,6 +94,12 @@ opencode/scripts/runtime-permission-policy.test.mjs
66
94
  opencode/scripts/shell-export-policy.mjs
67
95
  opencode/scripts/shell-export-policy.d.mts
68
96
  opencode/scripts/shell-export-policy.test.mjs
97
+ opencode/scripts/task-run.mjs
98
+ opencode/scripts/task-run.d.mts
99
+ opencode/scripts/task-run.test.mjs
100
+ opencode/scripts/deliver.mjs
101
+ opencode/scripts/deliver.d.mts
102
+ opencode/scripts/deliver.test.mjs
69
103
  opencode/commands/loop.md
70
104
  opencode/commands/loop-status.md
71
105
  opencode/commands/plan.md
@@ -170,7 +204,6 @@ grep -q '"default_agent": "lead"' opencode/opencode.json
170
204
  grep -q './plugins/token-tree-usage.tsx' opencode/tui.json
171
205
 
172
206
  grep -q 'Open Design' README.md
173
- grep -q 'Superpowers' README.md
174
207
  grep -q 'oak check' README.md
175
208
  grep -q 'oak replay' README.md
176
209
  grep -q 'OPENCODE_CONFIG_DIR' docs/cli.md
@@ -180,7 +213,7 @@ grep -q 'Impeccable' README.md
180
213
 
181
214
  grep -q '"open-design": allow' opencode/agents/designer.md
182
215
  grep -q '"impeccable": allow' opencode/agents/designer.md
183
- grep -q '"superpowers"' opencode/agents/designer.md && { echo 'designer should not allow superpowers' >&2; exit 1; } || true
216
+ ! grep -qi 'superpowers' opencode/agents/*.md opencode/AGENTS.md opencode/opencode.json || { echo 'Superpowers must not be referenced by OAK agents or config' >&2; exit 1; }
184
217
  grep -q 'mode: all' opencode/agents/developer.md
185
218
  grep -q 'Direct mode without slash commands' opencode/agents/developer.md
186
219
  grep -q 'Default behavior without slash commands' opencode/agents/lead.md
@@ -210,10 +243,10 @@ grep -q 'evaluator' opencode/commands/evolve.md
210
243
  grep -q 'debugger' opencode/commands/evolve.md
211
244
  grep -q 'evolver' opencode/commands/evolve.md
212
245
 
213
- grep -q 'OPEN_DESIGN_URL' opencode/tools/open_design.ts
214
- grep -q 'baseUrl: tool.schema.string().optional()' opencode/tools/open_design.ts
215
- ! grep -q 'randomUUID' opencode/tools/open_design.ts
216
- ! grep -q 'from "node:crypto"' opencode/tools/open_design.ts
246
+ grep -q 'OPEN_DESIGN_URL' opencode/tools/open-design-tools.mjs
247
+ grep -q 'baseUrl: "optional"' opencode/tools/open-design-tools.mjs
248
+ ! grep -q 'randomUUID' opencode/tools/open-design-tools.mjs opencode/tools/open_design.ts
249
+ ! grep -q 'from "node:crypto"' opencode/tools/open-design-tools.mjs opencode/tools/open_design.ts
217
250
 
218
251
  node <<'NODE'
219
252
  const fs = require('fs')
@@ -243,6 +276,9 @@ NODE
243
276
  grep -q 'Lead' opencode/plugins/token-tree-usage.tsx
244
277
  grep -q 'Subagents' opencode/plugins/token-tree-usage.tsx
245
278
  grep -q 'Partial total' opencode/plugins/token-tree-usage.tsx
279
+ grep -q 'sidebar.content' opencode/plugins/oak-tui/tui.tsx
280
+ grep -q 'Subagents' opencode/plugins/oak-tui/tui.tsx
281
+ grep -q 'setup() {}' opencode/plugins/token-tree-usage.tsx
246
282
 
247
283
  node scripts/check-public-boundary.mjs
248
284
 
@@ -250,6 +286,5 @@ grep -q 'Apache License' LICENSE
250
286
  grep -q 'OpenCode' NOTICE.md
251
287
  grep -q 'Open Design' NOTICE.md
252
288
  grep -q 'Impeccable' NOTICE.md
253
- grep -q 'Superpowers' NOTICE.md
254
289
 
255
290
  echo 'check ok'
@@ -117,18 +117,25 @@ function nodeSatisfiesCanonicalEngines(versionValue, engines) {
117
117
  });
118
118
  }
119
119
 
120
- function opencodeSatisfiesCompatibility(versionValue, compatibility) {
121
- const version = parseRuntimeVersion(versionValue, "OpenCode");
122
- const minimum = parseRuntimeVersion(compatibility.opencode.minimum_tested, "OpenCode compatibility");
123
- const range = /^>=(\d+\.\d+\.\d+) <(\d+\.\d+\.\d+)$/.exec(compatibility.opencode.supported_range);
124
- if (!range) throw invalid("OpenCode compatibility contract is invalid");
125
- const lower = parseRuntimeVersion(range[1], "OpenCode compatibility");
126
- const upper = parseRuntimeVersion(range[2], "OpenCode compatibility");
127
- if (lower.canonical !== minimum.canonical) {
120
+ function versionInRange(canonical, range, minimum, label) {
121
+ const match = /^>=(\d+\.\d+\.\d+) <(\d+\.\d+\.\d+)$/.exec(range);
122
+ if (!match) throw invalid("OpenCode compatibility contract is invalid");
123
+ const lower = parseRuntimeVersion(match[1], label);
124
+ const upper = parseRuntimeVersion(match[2], label);
125
+ if (lower.canonical !== parseRuntimeVersion(minimum, label).canonical) {
128
126
  throw invalid("OpenCode compatibility contract is invalid");
129
127
  }
130
- return compareStableVersions(version.canonical, minimum.canonical) >= 0
131
- && compareStableVersions(version.canonical, upper.canonical) < 0;
128
+ return compareStableVersions(canonical, lower.canonical) >= 0
129
+ && compareStableVersions(canonical, upper.canonical) < 0;
130
+ }
131
+
132
+ function opencodeCompatibilityLine(versionValue, compatibility) {
133
+ const version = parseRuntimeVersion(versionValue, "OpenCode");
134
+ const v1 = compatibility.opencode; // oak:v1-only
135
+ if (versionInRange(version.canonical, v1.supported_range, v1.minimum_tested, "OpenCode compatibility")) return "v1"; // oak:v1-only
136
+ const v2 = compatibility.opencode_v2;
137
+ if (v2 && versionInRange(version.canonical, v2.supported_range, v2.minimum_tested, "OpenCode 2 compatibility")) return "v2";
138
+ return null;
132
139
  }
133
140
 
134
141
  const COMMAND_FLAGS = {
@@ -1778,15 +1785,20 @@ export function createInstallationManager(options) {
1778
1785
  "install OpenCode or correct PATH",
1779
1786
  );
1780
1787
  } else {
1781
- const parsed = parseRuntimeVersion(String(observed.stdout ?? "").split(/\r?\n/, 1)[0], "OpenCode");
1782
- opencodeCheck = opencodeSatisfiesCompatibility(parsed.canonical, compatibility)
1788
+ // OpenCode 2 prefixes its version with `opencode v`; OpenCode 1 prints it bare.
1789
+ const banner = String(observed.stdout ?? "").split(/\r?\n/, 1)[0].trim().replace(/^opencode\s+/, "");
1790
+ const parsed = parseRuntimeVersion(banner, "OpenCode");
1791
+ const line = opencodeCompatibilityLine(parsed.canonical, compatibility);
1792
+ opencodeCheck = line === "v1" || (line === "v2" && compatibility.opencode_v2.status === "supported")
1783
1793
  ? doctorCheck("opencode-version", "pass", `OpenCode ${parsed.canonical} is supported`)
1784
- : doctorCheck(
1785
- "opencode-version",
1786
- "action-required",
1787
- `OpenCode ${parsed.canonical} is outside the supported range`,
1788
- `use OpenCode ${compatibility.opencode.supported_range}`,
1789
- );
1794
+ : line === "v2"
1795
+ ? doctorCheck("opencode-version", "info", `OpenCode ${parsed.canonical} is supported experimentally`)
1796
+ : doctorCheck(
1797
+ "opencode-version",
1798
+ "action-required",
1799
+ `OpenCode ${parsed.canonical} is outside the supported range`,
1800
+ `use OpenCode ${compatibility.opencode.supported_range} or ${compatibility.opencode_v2?.supported_range ?? "a supported release"}`,
1801
+ );
1790
1802
  }
1791
1803
  } catch {
1792
1804
  opencodeCheck = doctorCheck(
@@ -1814,9 +1826,11 @@ export function createInstallationManager(options) {
1814
1826
  ownership.executables,
1815
1827
  registry,
1816
1828
  nodeCheck.status === "pass"
1817
- && opencodeCheck.status === "pass"
1829
+ && ["pass", "info"].includes(opencodeCheck.status)
1818
1830
  && dependencies.status !== "action-required"
1819
- ? doctorCheck("compatibility", "pass", "runtime compatibility is satisfied")
1831
+ ? opencodeCheck.status === "pass"
1832
+ ? doctorCheck("compatibility", "pass", "runtime compatibility is satisfied")
1833
+ : doctorCheck("compatibility", "info", "runtime compatibility is experimental")
1820
1834
  : doctorCheck(
1821
1835
  "compatibility",
1822
1836
  "action-required",
@@ -220,6 +220,13 @@ function doctorCompatibility(overrides = {}) {
220
220
  stable_tested: "1.18.4",
221
221
  canary: "latest",
222
222
  },
223
+ opencode_v2: {
224
+ status: "experimental",
225
+ supported_range: ">=2.0.18 <3.0.0",
226
+ minimum_tested: "2.0.18",
227
+ canary: "latest",
228
+ plugin_sdk: "2.0.18",
229
+ },
223
230
  sdk: {
224
231
  opencode_plugin: "1.14.41",
225
232
  opentui_core: "0.2.5",
@@ -363,12 +370,32 @@ test("[D002] doctor diagnostic node-version uses the canonical engine", async (t
363
370
  }
364
371
  });
365
372
 
373
+ test("[D003] doctor treats OpenCode 2 as supported once the contract promotes it", async (t) => {
374
+ const { sourceRoot, targetRoot } = makeFixture(t);
375
+ put(sourceRoot, "agents/lead.md", "lead\n");
376
+ const promoted = doctorCompatibility();
377
+ promoted.opencode_v2 = { ...promoted.opencode_v2, status: "supported" };
378
+ const result = await managerFixture(sourceRoot, {
379
+ compatibilityProvider: () => promoted,
380
+ nodeVersionProvider: () => "v24.14.1",
381
+ commandRunner: () => ({ status: 0, stdout: "opencode v2.0.18\n", stderr: "" }),
382
+ }).run("doctor", { targetRoot });
383
+ for (const id of ["opencode-version", "compatibility"]) {
384
+ assert.equal(result.report.checks.find((entry) => entry.id === id).status, "pass", id);
385
+ }
386
+ });
387
+
366
388
  test("[D003] doctor diagnostic opencode-version is bounded and sanitized", async (t) => {
367
389
  for (const [version, expected] of [
368
390
  ["1.18.4", "pass"],
369
391
  ["1.14.41", "pass"],
370
392
  ["1.14.40", "action-required"],
371
393
  ["2.0.0", "action-required"],
394
+ ["2.0.17", "action-required"],
395
+ ["2.0.18", "info"],
396
+ ["opencode v2.0.18", "info"],
397
+ ["2.9.1", "info"],
398
+ ["3.0.0", "action-required"],
372
399
  ["invalid", "action-required"],
373
400
  ]) {
374
401
  await t.test(version, async (child) => {
@@ -386,6 +413,8 @@ test("[D003] doctor diagnostic opencode-version is bounded and sanitized", async
386
413
  }).run("doctor", { targetRoot });
387
414
  const check = result.report.checks.find((entry) => entry.id === "opencode-version");
388
415
  assert.equal(check.status, expected);
416
+ const compatibility = result.report.checks.find((entry) => entry.id === "compatibility");
417
+ assert.equal(compatibility.status, expected);
389
418
  assert.equal(JSON.stringify(result.report).includes(canary), false);
390
419
  assert.equal(calls[0].command, "opencode");
391
420
  assert.deepEqual(calls[0].args, ["--version"]);
package/scripts/oak.mjs CHANGED
@@ -14,6 +14,8 @@ export const OAK_COMMANDS = [
14
14
  "check",
15
15
  "replay",
16
16
  "state",
17
+ "run",
18
+ "deliver",
17
19
  "uninstall",
18
20
  "rollback",
19
21
  "version",
@@ -28,6 +30,8 @@ export const OAK_ENTRYPOINTS = Object.freeze({
28
30
  check: path.join(REPOSITORY_ROOT, "opencode", "scripts", "check-harness.mjs"),
29
31
  replay: path.join(REPOSITORY_ROOT, "opencode", "scripts", "replay-routing.mjs"),
30
32
  state: path.join(REPOSITORY_ROOT, "opencode", "scripts", "loop-state.mjs"),
33
+ run: path.join(REPOSITORY_ROOT, "opencode", "scripts", "task-run.mjs"),
34
+ deliver: path.join(REPOSITORY_ROOT, "opencode", "scripts", "deliver.mjs"),
31
35
  });
32
36
 
33
37
  export const OAK_REPLAY_DEFAULTS = Object.freeze({
@@ -57,7 +61,9 @@ const HELP = {
57
61
  doctor: "Usage: oak doctor [--accept-preserved PATH] [--target PATH]",
58
62
  check: "Usage: oak check [--target PATH]",
59
63
  replay: "Usage: oak replay [--corpus PATH] [--fixtures PATH] [--output PATH]",
60
- state: "Usage: oak state <init|resume|record|release|inspect|repair|migrate> --root PATH [options]",
64
+ state: "Usage: oak state <init|resume|record|release|inspect|attest-review|repair|migrate> --root PATH [options]",
65
+ run: "Usage: oak run <start|status|event|close> --root PATH [options]",
66
+ deliver: "Usage: oak deliver <pr|checks> --root PATH [options]",
61
67
  uninstall: "Usage: oak uninstall [--dry-run] [--yes] [--target PATH]",
62
68
  rollback: "Usage: oak rollback [--dry-run] [--target PATH]",
63
69
  version: "Usage: oak version",
@@ -158,7 +164,7 @@ function dispatchReplay(args, runtime) {
158
164
 
159
165
  function dispatchState(args, runtime) {
160
166
  const [action, ...options] = args;
161
- const actions = new Set(["init", "resume", "record", "release", "inspect", "repair", "migrate"]);
167
+ const actions = new Set(["init", "resume", "record", "release", "inspect", "attest-review", "repair", "migrate"]);
162
168
  const valueFlags = new Set([
163
169
  "--root",
164
170
  "--slug",
@@ -172,6 +178,9 @@ function dispatchState(args, runtime) {
172
178
  "--blocking-cause",
173
179
  "--status",
174
180
  "--approval-status",
181
+ "--reviewer-session-id",
182
+ "--reviewer-agent",
183
+ "--reviewer-verdict",
175
184
  ]);
176
185
  const booleanFlags = new Set(["--release-lock", "--truncate-tail"]);
177
186
  if (!actions.has(action)) return invalid(runtime.stderr, "invalid state action");
@@ -198,6 +207,65 @@ function dispatchState(args, runtime) {
198
207
  );
199
208
  }
200
209
 
210
+ function dispatchRun(args, runtime) {
211
+ const [action, ...options] = args;
212
+ const actions = new Set(["start", "status", "event", "close"]);
213
+ const valueFlags = new Set(["--root", "--slug", "--kind", "--type", "--output"]);
214
+ if (!actions.has(action)) return invalid(runtime.stderr, "invalid run action");
215
+
216
+ let root;
217
+ for (let index = 0; index < options.length; index += 1) {
218
+ const token = options[index];
219
+ if (!token.startsWith("--")) {
220
+ if (action !== "event" || token.indexOf("=") <= 0) return invalid(runtime.stderr, "invalid run arguments");
221
+ continue;
222
+ }
223
+ if (!valueFlags.has(token)) return invalid(runtime.stderr, "invalid run arguments");
224
+ const value = options[index + 1];
225
+ if (!value || value.startsWith("--")) return invalid(runtime.stderr, "invalid run arguments");
226
+ if (token === "--root") {
227
+ if (root !== undefined) return invalid(runtime.stderr, "invalid run arguments");
228
+ root = value;
229
+ }
230
+ index += 1;
231
+ }
232
+ if (root === undefined) return invalid(runtime.stderr, "run requires --root PATH");
233
+ return runNode(
234
+ OAK_ENTRYPOINTS.run,
235
+ args,
236
+ { cwd: path.resolve(root), env: runtime.env, label: "run" },
237
+ runtime,
238
+ );
239
+ }
240
+
241
+ // There is no merge action, by design: delivery ends at an open pull request.
242
+ function dispatchDeliver(args, runtime) {
243
+ const [action, ...options] = args;
244
+ const actions = new Set(["pr", "checks"]);
245
+ const valueFlags = new Set(["--root", "--slug", "--title", "--body-file", "--pr"]);
246
+ if (!actions.has(action)) return invalid(runtime.stderr, "invalid deliver action");
247
+
248
+ let root;
249
+ for (let index = 0; index < options.length; index += 1) {
250
+ const flag = options[index];
251
+ if (!valueFlags.has(flag)) return invalid(runtime.stderr, "invalid deliver arguments");
252
+ const value = options[index + 1];
253
+ if (!value || value.startsWith("--")) return invalid(runtime.stderr, "invalid deliver arguments");
254
+ if (flag === "--root") {
255
+ if (root !== undefined) return invalid(runtime.stderr, "invalid deliver arguments");
256
+ root = value;
257
+ }
258
+ index += 1;
259
+ }
260
+ if (root === undefined) return invalid(runtime.stderr, "deliver requires --root PATH");
261
+ return runNode(
262
+ OAK_ENTRYPOINTS.deliver,
263
+ args,
264
+ { cwd: path.resolve(root), env: runtime.env, label: "deliver" },
265
+ runtime,
266
+ );
267
+ }
268
+
201
269
  export function dispatchOak(argv, deps = {}) {
202
270
  const runtime = {
203
271
  run: deps.run ?? spawnSync,
@@ -230,6 +298,8 @@ export function dispatchOak(argv, deps = {}) {
230
298
  if (command === "check") return dispatchCheck(rest, runtime);
231
299
  if (command === "replay") return dispatchReplay(rest, runtime);
232
300
  if (command === "state") return dispatchState(rest, runtime);
301
+ if (command === "run") return dispatchRun(rest, runtime);
302
+ if (command === "deliver") return dispatchDeliver(rest, runtime);
233
303
  if (LIFECYCLE_COMMANDS.has(command)) {
234
304
  return runNode(
235
305
  OAK_ENTRYPOINTS.manager,
@@ -82,6 +82,8 @@ test("[O001] command set is closed and ordered", () => {
82
82
  "check",
83
83
  "replay",
84
84
  "state",
85
+ "run",
86
+ "deliver",
85
87
  "uninstall",
86
88
  "rollback",
87
89
  "version",
@@ -294,10 +296,27 @@ test("[O010] state delegates only an explicit loop-state command and root", () =
294
296
  assert.equal(calls[0].options.cwd, "/tmp/oak-target");
295
297
  assert.equal(calls[0].options.shell, false);
296
298
 
299
+ const attest = [
300
+ "state",
301
+ "attest-review",
302
+ "--root",
303
+ "/tmp/oak-target",
304
+ "--slug",
305
+ "example",
306
+ "--reviewer-session-id",
307
+ "child-1",
308
+ "--reviewer-agent",
309
+ "reviewer",
310
+ "--reviewer-verdict",
311
+ "APPROVE",
312
+ ];
313
+ const attestCalls = [];
314
+ assert.equal(dispatchOak(attest, runnerDeps(attestCalls)), 0);
315
+ assert.deepEqual(attestCalls[0].args, [OAK_ENTRYPOINTS.state, ...attest.slice(1)]);
316
+
297
317
  for (const argv of [
298
318
  ["state"],
299
319
  ["state", "unknown", "--root", "/tmp/oak-target"],
300
- ["state", "attest-review", "--root", "/tmp/oak-target"],
301
320
  ["state", "init", "--slug", "example"],
302
321
  ["state", "init", "--root", "/tmp/oak-target", "--root", "/tmp/other"],
303
322
  ["state", "init", "--root"],
@@ -306,6 +325,55 @@ test("[O010] state delegates only an explicit loop-state command and root", () =
306
325
  }
307
326
  });
308
327
 
328
+ test("[O010b] run delegates each task-run action with an explicit root", () => {
329
+ for (const args of [
330
+ ["run", "start", "--root", "/tmp/oak-target", "--slug", "add-login", "--kind", "production"],
331
+ ["run", "status", "--root", "/tmp/oak-target"],
332
+ ["run", "event", "--root", "/tmp/oak-target", "--type", "review", "blocking=0", "verdict=safe_to_commit"],
333
+ ["run", "close", "--root", "/tmp/oak-target", "--output", "docs/ai/runs/2026-09-26-add-login/run-summary.json"],
334
+ ]) {
335
+ const calls = [];
336
+ assert.equal(dispatchOak(args, runnerDeps(calls)), 0);
337
+ assert.deepEqual(calls[0].args, [OAK_ENTRYPOINTS.run, ...args.slice(1)]);
338
+ assert.equal(calls[0].options.cwd, "/tmp/oak-target");
339
+ assert.equal(calls[0].options.shell, false);
340
+ }
341
+
342
+ for (const argv of [
343
+ ["run"],
344
+ ["run", "unknown", "--root", "/tmp/oak-target"],
345
+ ["run", "status", "--slug", "example"],
346
+ ["run", "status", "--root", "/tmp/oak-target", "blocking=0"],
347
+ ["run", "event", "--root", "/tmp/oak-target", "--type", "review", "=0"],
348
+ ["run", "start", "--root", "/tmp/oak-target", "--root", "/tmp/other"],
349
+ ]) {
350
+ assert.equal(dispatchOak(argv, runnerDeps()), 2);
351
+ }
352
+ });
353
+
354
+ test("[O010c] deliver delegates pr and checks with an explicit root and has no merge", () => {
355
+ for (const args of [
356
+ ["deliver", "pr", "--root", "/tmp/oak-target", "--slug", "task", "--title", "Add x", "--body-file", "pr-body.md"],
357
+ ["deliver", "checks", "--root", "/tmp/oak-target", "--pr", "7"],
358
+ ]) {
359
+ const calls = [];
360
+ assert.equal(dispatchOak(args, runnerDeps(calls)), 0);
361
+ assert.deepEqual(calls[0].args, [OAK_ENTRYPOINTS.deliver, ...args.slice(1)]);
362
+ assert.equal(calls[0].options.cwd, "/tmp/oak-target");
363
+ assert.equal(calls[0].options.shell, false);
364
+ }
365
+
366
+ for (const argv of [
367
+ ["deliver"],
368
+ ["deliver", "merge", "--root", "/tmp/oak-target", "--pr", "7"],
369
+ ["deliver", "pr", "--slug", "task"],
370
+ ["deliver", "pr", "--root", "/tmp/oak-target", "--force", "yes"],
371
+ ["deliver", "checks", "--root", "/tmp/oak-target", "--root", "/tmp/other"],
372
+ ]) {
373
+ assert.equal(dispatchOak(argv, runnerDeps()), 2);
374
+ }
375
+ });
376
+
309
377
  test("[O011] symlinked oak executable runs its CLI", (t) => {
310
378
  const root = tempRoot(t);
311
379
  const executable = path.join(root, "oak");
@@ -38,7 +38,7 @@ test("Open Design exposes bounded HTTP and SSE transport helpers", () => {
38
38
  });
39
39
 
40
40
  test("the Open Design tool delegates network reads to the bounded transport", () => {
41
- const source = fs.readFileSync(path.join(ROOT, "opencode/tools/open_design.ts"), "utf8");
41
+ const source = fs.readFileSync(path.join(ROOT, "opencode/tools/open-design-tools.mjs"), "utf8");
42
42
  assert.match(source, /from ["']\.\/open-design-http\.mjs["']/);
43
43
  assert.doesNotMatch(source, /await fetch\(/);
44
44
  assert.doesNotMatch(source, /await res\.text\(/);