opencode-agent-orchestration-kit 1.0.28 → 1.0.29

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.
@@ -53,6 +53,14 @@ const REVISED_COMPATIBILITY = {
53
53
  const ROOT_PACKAGE = {
54
54
  name: "opencode-agent-orchestration-kit",
55
55
  engines: { node: VALID_COMPATIBILITY.node.engines },
56
+ scripts: {
57
+ "check:supply-chain": "node scripts/check-supply-chain.mjs",
58
+ "dependency-audit": "npm --prefix opencode audit --omit=dev --audit-level=low",
59
+ "dependency-signature-audit": "npm --prefix opencode audit signatures",
60
+ "installation-smoke": "bash scripts/install-smoke.sh",
61
+ "package-smoke": "bash scripts/package-smoke.sh",
62
+ "check:release": "npm --prefix opencode ci --ignore-scripts && npm run check && npm run typecheck && npm run dependency-audit && npm run dependency-signature-audit && npm run installation-smoke && npm run package-smoke",
63
+ },
56
64
  };
57
65
 
58
66
  const PACKAGED_PACKAGE = {
@@ -114,20 +122,24 @@ const OPENCODE_BOUNDARY_JOB = `
114
122
  strategy:
115
123
  fail-fast: false
116
124
  matrix:
117
- opencode:
118
- - "1.14.41"
119
- - "1.18.4"
125
+ include:
126
+ - mode: core
127
+ opencode: "1.14.41"
128
+ - mode: core
129
+ opencode: "1.18.4"
130
+ - mode: default
131
+ opencode: "1.18.4"
120
132
  steps:
121
133
  - name: Checkout
122
- uses: actions/checkout@v4
134
+ uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
123
135
 
124
136
  - name: Setup Node
125
- uses: actions/setup-node@v4
137
+ uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6
126
138
  with:
127
139
  node-version: 24
128
140
 
129
141
  - name: Smoke OpenCode boundary
130
- run: bash scripts/opencode-compat-smoke.sh "\${{ matrix.opencode }}"
142
+ run: bash scripts/opencode-compat-smoke.sh "\${{ matrix.mode }}" "\${{ matrix.opencode }}"
131
143
  # opencode-boundaries:end
132
144
  `;
133
145
 
@@ -164,10 +176,10 @@ jobs:
164
176
  runs-on: \${{ matrix.os }}
165
177
  steps:
166
178
  - name: Checkout
167
- uses: actions/checkout@v4
179
+ uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
168
180
 
169
181
  - name: Setup Node
170
- uses: actions/setup-node@v4
182
+ uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6
171
183
  with:
172
184
  node-version: \${{ matrix.node }}
173
185
 
@@ -190,17 +202,25 @@ jobs:
190
202
 
191
203
  - name: Install OpenCode tool dependencies
192
204
  working-directory: opencode
193
- run: npm ci
205
+ run: npm ci --ignore-scripts
194
206
 
195
207
  - name: Audit OpenCode tool dependencies
196
208
  if: matrix.canonical
197
209
  run: npm run dependency-audit
198
210
 
211
+ - name: Verify dependency signatures
212
+ if: matrix.canonical
213
+ run: npm run dependency-signature-audit
214
+
199
215
  - name: Typecheck TUI token plugin
200
216
  run: npm run typecheck
201
217
 
202
218
  - name: Installation smoke
203
219
  run: npm run installation-smoke
220
+
221
+ - name: Smoke npm package
222
+ if: matrix.canonical
223
+ run: npm run package-smoke
204
224
  ${OPENCODE_BOUNDARY_JOB}`;
205
225
 
206
226
  const VALID_CANARY_WORKFLOW = `name: Compatibility Canary
@@ -219,17 +239,17 @@ jobs:
219
239
  runs-on: ubuntu-latest
220
240
  steps:
221
241
  - name: Checkout
222
- uses: actions/checkout@v4
242
+ uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
223
243
  with:
224
244
  persist-credentials: false
225
245
 
226
246
  - name: Setup Node
227
- uses: actions/setup-node@v4
247
+ uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6
228
248
  with:
229
249
  node-version: 26
230
250
 
231
251
  - name: Smoke latest OpenCode
232
- run: bash scripts/opencode-compat-smoke.sh latest
252
+ run: bash scripts/opencode-compat-smoke.sh core latest
233
253
  # compatibility-canary:end
234
254
  `;
235
255
 
@@ -241,7 +261,7 @@ jobs:
241
261
  runs-on: ubuntu-latest
242
262
  steps:
243
263
  - name: Setup Node
244
- uses: actions/setup-node@v4
264
+ uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6
245
265
  with:
246
266
  node-version: 24
247
267
  - name: Validate release tag
@@ -253,7 +273,7 @@ jobs:
253
273
  run: npm run unit-and-script-tests
254
274
  - name: Install OpenCode tool dependencies
255
275
  working-directory: opencode
256
- run: npm ci
276
+ run: npm ci --ignore-scripts
257
277
  - name: Audit OpenCode tool dependencies
258
278
  run: npm run dependency-audit
259
279
  - name: Typecheck TUI token plugin
@@ -286,6 +306,7 @@ function makeFixture(t, compatibility = VALID_COMPATIBILITY) {
286
306
  writeText(root, "docs/installation.md", INSTALLATION);
287
307
  writeText(root, ".github/workflows/check.yml", VALID_WORKFLOW);
288
308
  writeText(root, ".github/workflows/compatibility-canary.yml", VALID_CANARY_WORKFLOW);
309
+ writeText(root, "scripts/install-smoke.sh", "#!/usr/bin/env bash\nnpm ci --ignore-scripts\n");
289
310
  return root;
290
311
  }
291
312
 
@@ -624,6 +645,19 @@ test("blocking workflow accepts exactly the supported Node and OS matrix", (t) =
624
645
  assert.equal(checkCompatibility(root).schema_version, 1);
625
646
  });
626
647
 
648
+ test("blocking workflow rejects mutable Action major tags", (t) => {
649
+ const root = makeFixture(t);
650
+ writeText(
651
+ root,
652
+ ".github/workflows/check.yml",
653
+ VALID_WORKFLOW.replaceAll(
654
+ "actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6",
655
+ "actions/checkout@v6",
656
+ ),
657
+ );
658
+ assertInvalidCompatibility(() => checkCompatibility(root), /workflow|OpenCode boundary job/);
659
+ });
660
+
627
661
  test("the previous single Ubuntu Node 24 job is rejected", (t) => {
628
662
  const root = makeFixture(t);
629
663
  writeText(root, ".github/workflows/check.yml", SINGLE_JOB_WORKFLOW);
@@ -654,9 +688,30 @@ test("blocking workflow requires fail-fast false", (t) => {
654
688
  assertInvalidCompatibility(() => checkCompatibility(root), /workflow strategy must set fail-fast to false/);
655
689
  });
656
690
 
691
+ test("release gate requires the exact reproducible artifact command order", (t) => {
692
+ const root = makeFixture(t);
693
+ const packageData = { ...ROOT_PACKAGE, scripts: { ...ROOT_PACKAGE.scripts } };
694
+ packageData.scripts["check:release"] = packageData.scripts["check:release"].replace(
695
+ "npm run dependency-signature-audit && ",
696
+ "",
697
+ );
698
+ writeJson(root, "package.json", packageData);
699
+ assertInvalidCompatibility(() => checkCompatibility(root), /check:release.*exact/i);
700
+ });
701
+
702
+ test("release scripts require the supply-chain checker", (t) => {
703
+ const root = makeFixture(t);
704
+ const packageData = { ...ROOT_PACKAGE, scripts: { ...ROOT_PACKAGE.scripts } };
705
+ delete packageData.scripts["check:supply-chain"];
706
+ writeJson(root, "package.json", packageData);
707
+ assertInvalidCompatibility(() => checkCompatibility(root), /check:supply-chain.*exact/i);
708
+ });
709
+
657
710
  for (const [label, current, replacement, message] of [
658
711
  ["tag validation", "if: matrix.canonical && startsWith(github.ref, 'refs/tags/')", "if: startsWith(github.ref, 'refs/tags/')", /tag validation guard/],
659
712
  ["dependency audit", "if: matrix.canonical\n run: npm run dependency-audit", "if: success()\n run: npm run dependency-audit", /dependency audit guard/],
713
+ ["dependency signature audit", "if: matrix.canonical\n run: npm run dependency-signature-audit", "if: success()\n run: npm run dependency-signature-audit", /dependency signature audit guard/],
714
+ ["package smoke", "if: matrix.canonical\n run: npm run package-smoke", "if: success()\n run: npm run package-smoke", /package smoke guard/],
660
715
  ]) {
661
716
  test(`blocking workflow requires the exact ${label} guard`, (t) => {
662
717
  const root = makeFixture(t);
@@ -668,7 +723,7 @@ for (const [label, current, replacement, message] of [
668
723
  for (const [label, current, message] of [
669
724
  ["matrix runner", "runs-on: ${{ matrix.os }}", /matrix\.os/],
670
725
  ["matrix Node setup", "node-version: ${{ matrix.node }}", /matrix\.node/],
671
- ["dependency installation", "working-directory: opencode\n run: npm ci", /install OpenCode tool dependencies/],
726
+ ["dependency installation", "working-directory: opencode\n run: npm ci --ignore-scripts", /install OpenCode tool dependencies/],
672
727
  ["contract check", "run: npm run contract-check", /contract check/],
673
728
  ["unit and script tests", "run: npm run unit-and-script-tests", /unit and script tests/],
674
729
  ["token plugin typecheck", "run: npm run typecheck", /token plugin typecheck/],
@@ -681,6 +736,15 @@ for (const [label, current, message] of [
681
736
  });
682
737
  }
683
738
 
739
+ test("installation smoke requires the frozen npm ci command", (t) => {
740
+ const root = makeFixture(t);
741
+ writeText(root, "scripts/install-smoke.sh", "#!/usr/bin/env bash\nnpm ci\n");
742
+ assertInvalidCompatibility(
743
+ () => checkCompatibility(root),
744
+ /installation smoke must use npm ci --ignore-scripts/,
745
+ );
746
+ });
747
+
684
748
  test("a sidecar job cannot satisfy a required blocking check step", (t) => {
685
749
  const root = makeFixture(t);
686
750
  const workflow = VALID_WORKFLOW
@@ -770,6 +834,53 @@ test("workflow rejects publish commands", (t) => {
770
834
  assertInvalidCompatibility(() => checkCompatibility(root), /must not publish/);
771
835
  });
772
836
 
837
+ for (const [label, command] of [
838
+ ["GitHub release upload", "gh release upload v1 artifact.tgz"],
839
+ ["GitHub release edit", "gh release edit v1 --draft=false"],
840
+ ["GitHub release delete", "gh release delete v1 --yes"],
841
+ ["GitHub API PATCH", "gh api repos/example/project/releases/1 -X PATCH -f draft=false"],
842
+ ["GitHub API DELETE", "gh api --method=DELETE repos/example/project/releases/1"],
843
+ ["npm dist-tag add", "npm dist-tag add pkg@1 latest"],
844
+ ["npm dist-tag rm", "npm dist-tag rm pkg latest"],
845
+ ["npm unpublish", "npm unpublish pkg@1"],
846
+ ["npm deprecate", "npm deprecate pkg@1 obsolete"],
847
+ ["repository push", "git push origin HEAD"],
848
+ ["cache action", "uses: actions/cache@v4"],
849
+ ["artifact action", "uses: actions/upload-artifact@v4"],
850
+ ]) {
851
+ test(`workflow rejects ${label}`, (t) => {
852
+ const root = makeFixture(t);
853
+ writeText(
854
+ root,
855
+ ".github/workflows/check.yml",
856
+ VALID_WORKFLOW.replace(
857
+ " # opencode-boundaries:start",
858
+ ` - run: ${command}\n\n # opencode-boundaries:start`,
859
+ ),
860
+ );
861
+ assertInvalidCompatibility(() => checkCompatibility(root), /must not publish, release, upload, mutate, cache, or use artifacts/);
862
+ });
863
+ }
864
+
865
+ for (const [label, command] of [
866
+ ["GitHub release view", "gh release view v1"],
867
+ ["GitHub API GET", "gh api repos/example/project/releases/1"],
868
+ ["npm view", "npm view pkg@1 dist.integrity"],
869
+ ]) {
870
+ test(`workflow accepts read-only ${label}`, (t) => {
871
+ const root = makeFixture(t);
872
+ writeText(
873
+ root,
874
+ ".github/workflows/check.yml",
875
+ VALID_WORKFLOW.replace(
876
+ " # opencode-boundaries:start",
877
+ ` - run: ${command}\n\n # opencode-boundaries:start`,
878
+ ),
879
+ );
880
+ assert.equal(checkCompatibility(root).schema_version, 1);
881
+ });
882
+ }
883
+
773
884
  test("workflow requires exactly one ordered blocking marker pair", (t) => {
774
885
  const root = makeFixture(t);
775
886
  writeText(
@@ -805,20 +916,21 @@ test("OpenCode boundary job accepts the exact blocking matrix", (t) => {
805
916
  });
806
917
 
807
918
  for (const [label, mutate] of [
808
- ["minimum tested version", (workflow) => workflow.replace(' - "1.14.41"\n', "")],
809
- ["stable tested version", (workflow) => workflow.replace(' - "1.18.4"\n', "")],
919
+ ["minimum core tested version", (workflow) => workflow.replace(' - mode: core\n opencode: "1.14.41"\n', "")],
920
+ ["stable core tested version", (workflow) => workflow.replace(' - mode: core\n opencode: "1.18.4"\n', "")],
921
+ ["stable default tested version", (workflow) => workflow.replace(' - mode: default\n opencode: "1.18.4"\n', "")],
810
922
  ["Node 24 setup", (workflow) => workflow.replace(" node-version: 24", " node-version: 22")],
811
923
  [
812
924
  "matrix-version wrapper invocation",
813
925
  (workflow) => workflow.replace(
814
- 'run: bash scripts/opencode-compat-smoke.sh "${{ matrix.opencode }}"',
926
+ 'run: bash scripts/opencode-compat-smoke.sh "${{ matrix.mode }}" "${{ matrix.opencode }}"',
815
927
  "run: bash scripts/opencode-compat-smoke.sh 1.18.4",
816
928
  ),
817
929
  ],
818
930
  [
819
931
  "isolated wrapper instead of the operator binary",
820
932
  (workflow) => workflow.replace(
821
- 'run: bash scripts/opencode-compat-smoke.sh "${{ matrix.opencode }}"',
933
+ 'run: bash scripts/opencode-compat-smoke.sh "${{ matrix.mode }}" "${{ matrix.opencode }}"',
822
934
  "run: opencode --version",
823
935
  ),
824
936
  ],
@@ -855,8 +967,8 @@ for (const [label, mutate] of [
855
967
  (workflow) => workflow.replace(
856
968
  OPENCODE_BOUNDARY_JOB,
857
969
  OPENCODE_BOUNDARY_JOB.replace(
858
- " - name: Setup Node\n uses: actions/setup-node@v4",
859
- " - name: Install dependencies\n run: npm ci\n\n - name: Setup Node\n uses: actions/setup-node@v4",
970
+ " - name: Setup Node\n uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6",
971
+ " - name: Install dependencies\n run: npm ci\n\n - name: Setup Node\n uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6",
860
972
  ),
861
973
  ),
862
974
  ],
@@ -872,14 +984,14 @@ test("OpenCode boundary job cannot borrow its smoke from another job", (t) => {
872
984
  const root = makeFixture(t);
873
985
  const workflow = VALID_WORKFLOW
874
986
  .replace(
875
- ' run: bash scripts/opencode-compat-smoke.sh "${{ matrix.opencode }}"',
987
+ ' run: bash scripts/opencode-compat-smoke.sh "${{ matrix.mode }}" "${{ matrix.opencode }}"',
876
988
  " run: echo skipped-boundary-smoke",
877
989
  )
878
990
  .concat(`
879
991
  sidecar-smoke:
880
992
  runs-on: ubuntu-latest
881
993
  steps:
882
- - run: bash scripts/opencode-compat-smoke.sh "\${{ matrix.opencode }}"
994
+ - run: bash scripts/opencode-compat-smoke.sh "\${{ matrix.mode }}" "\${{ matrix.opencode }}"
883
995
  `);
884
996
  writeText(root, ".github/workflows/check.yml", workflow);
885
997
  assertInvalidCompatibility(() => checkCompatibility(root), /OpenCode boundary job/);
@@ -953,13 +1065,26 @@ test("compatibility canary accepts the exact scheduled and manual latest smoke",
953
1065
  assert.equal(checkCompatibility(root).schema_version, 1);
954
1066
  });
955
1067
 
1068
+ test("compatibility canary rejects mutable Action major tags", (t) => {
1069
+ const root = makeFixture(t);
1070
+ writeText(
1071
+ root,
1072
+ ".github/workflows/compatibility-canary.yml",
1073
+ VALID_CANARY_WORKFLOW.replace(
1074
+ "actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6",
1075
+ "actions/setup-node@v6",
1076
+ ),
1077
+ );
1078
+ assertInvalidCompatibility(() => checkCompatibility(root), /compatibility canary/i);
1079
+ });
1080
+
956
1081
  for (const [label, mutate] of [
957
1082
  ["schedule trigger", (workflow) => workflow.replace(' schedule:\n - cron: "17 6 * * 1"\n', "")],
958
1083
  ["workflow_dispatch trigger", (workflow) => workflow.replace(" workflow_dispatch:\n", "")],
959
1084
  ["push trigger", (workflow) => workflow.replace(" workflow_dispatch:\n", " workflow_dispatch:\n push:\n")],
960
1085
  ["pull_request trigger", (workflow) => workflow.replace(" workflow_dispatch:\n", " workflow_dispatch:\n pull_request:\n")],
961
1086
  ["canonical canary Node", (workflow) => workflow.replace(" node-version: 26", " node-version: 24")],
962
- ["canonical latest argument", (workflow) => workflow.replace("opencode-compat-smoke.sh latest", "opencode-compat-smoke.sh 1.18.4")],
1087
+ ["canonical latest argument", (workflow) => workflow.replace("opencode-compat-smoke.sh core latest", "opencode-compat-smoke.sh core 1.18.4")],
963
1088
  ["read-only permissions", (workflow) => workflow.replace("contents: read", "contents: write")],
964
1089
  ["blocking failure behavior", (workflow) => workflow.replace(" runs-on: ubuntu-latest", " continue-on-error: true\n runs-on: ubuntu-latest")],
965
1090
  ["credential-free behavior", (workflow) => workflow.replace(" runs-on: ubuntu-latest", ' env:\n GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n runs-on: ubuntu-latest')],
@@ -968,7 +1093,7 @@ for (const [label, mutate] of [
968
1093
  ["issue creation ban", (workflow) => workflow.replace(" - name: Smoke latest OpenCode", " - run: gh issue create --title canary\n\n - name: Smoke latest OpenCode")],
969
1094
  ["dependency update ban", (workflow) => workflow.replace(" - name: Smoke latest OpenCode", " - run: npm update\n\n - name: Smoke latest OpenCode")],
970
1095
  ["npm ci ban", (workflow) => workflow.replace(" - name: Smoke latest OpenCode", " - run: npm ci\n\n - name: Smoke latest OpenCode")],
971
- ["checkout cache ban", (workflow) => workflow.replace(" uses: actions/checkout@v4", " uses: actions/checkout@v4\n with:\n cache: npm")],
1096
+ ["checkout cache ban", (workflow) => workflow.replace(" uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6", " uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6\n with:\n cache: npm")],
972
1097
  ["cache action ban", (workflow) => workflow.replace(" - name: Smoke latest OpenCode", " - uses: actions/cache@v4\n\n - name: Smoke latest OpenCode")],
973
1098
  ["artifact action ban", (workflow) => workflow.replace(" - name: Smoke latest OpenCode", " - uses: actions/upload-artifact@v4\n\n - name: Smoke latest OpenCode")],
974
1099
  ["repository mutation ban", (workflow) => workflow.replace(" - name: Smoke latest OpenCode", " - run: git push origin HEAD\n\n - name: Smoke latest OpenCode")],
@@ -1064,6 +1189,11 @@ function makeCompatibilitySmokeFixture(t, options = {}) {
1064
1189
  fs.chmodSync(path.join(root, "scripts/opencode-compat-smoke.sh"), 0o755);
1065
1190
  }
1066
1191
 
1192
+ writeJson(root, "package.json", {
1193
+ name: "compat-smoke-fixture",
1194
+ version: "1.0.0",
1195
+ files: ["opencode"],
1196
+ });
1067
1197
  writeText(root, "agents/lead.md", "---\nmode: all\n---\n");
1068
1198
  if (options.packagedLead !== "missing") {
1069
1199
  writeText(
@@ -1080,11 +1210,23 @@ function makeCompatibilitySmokeFixture(t, options = {}) {
1080
1210
  });
1081
1211
  writeText(root, "opencode/node_modules/excluded", "must not be copied\n");
1082
1212
  writeText(root, "opencode/.oak/excluded", "must not be copied\n");
1213
+ 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
+ });
1083
1220
 
1084
1221
  const quotedRoot = shellQuote(root);
1222
+ const realNpm = spawnSync("which", ["npm"], { encoding: "utf8" }).stdout.trim();
1085
1223
  writeExecutable(root, "fake-bin/npm", `#!/bin/sh
1086
1224
  set -eu
1087
- touch ${shellQuote(path.join(root, "npm-called"))}
1225
+ if [ "\${1-}" = pack ]; then
1226
+ touch ${shellQuote(path.join(root, "npm-pack-called"))}
1227
+ ${options.packFailure ? "exit 51" : `exec ${shellQuote(realNpm)} "$@"`}
1228
+ fi
1229
+ touch ${shellQuote(path.join(root, "npm-ci-called"))}
1088
1230
  smoke_root=\${HOME%/home}
1089
1231
  smoke_home="$(CDPATH= cd "$HOME" && pwd -P)"
1090
1232
  test "$(pwd -P)" = "$smoke_home"
@@ -1107,6 +1249,16 @@ test -f "$2/agents/lead.md"
1107
1249
  test ! -e "$2/opencode"
1108
1250
  test ! -e "$2/node_modules"
1109
1251
  test ! -e "$2/.oak"
1252
+ case "${options.mode ?? "core"}" in
1253
+ core)
1254
+ test ! -e "$2/plugins"
1255
+ node -e 'const c=require(process.argv[1]); if (!Array.isArray(c.plugin) || c.plugin.length !== 0) process.exit(1)' "$2/opencode.json"
1256
+ ;;
1257
+ default)
1258
+ test -f "$2/plugins/token-tree-usage.tsx"
1259
+ node -e 'const c=require(process.argv[1]); const p=c.plugin; if (!Array.isArray(p) || p.length !== 1 || p[0] !== "superpowers@git+https://github.com/obra/superpowers.git#d884ae04edebef577e82ff7c4e143debd0bbec99") process.exit(1)' "$2/opencode.json"
1260
+ ;;
1261
+ esac
1110
1262
  `);
1111
1263
 
1112
1264
  const request = options.request ?? "1.14.41";
@@ -1161,7 +1313,7 @@ esac
1161
1313
  return root;
1162
1314
  }
1163
1315
 
1164
- function runCompatibilitySmoke(root, args = ["1.14.41"]) {
1316
+ function runCompatibilitySmoke(root, args = ["core", "1.14.41"]) {
1165
1317
  return spawnSync(
1166
1318
  "bash",
1167
1319
  [path.join(root, "scripts/opencode-compat-smoke.sh"), ...args],
@@ -1177,17 +1329,43 @@ function runCompatibilitySmoke(root, args = ["1.14.41"]) {
1177
1329
  );
1178
1330
  }
1179
1331
 
1180
- test("OpenCode compatibility smoke uses only the packaged isolated config", (t) => {
1332
+ test("core OpenCode compatibility smoke strips optional plugins from the working-tree copy", (t) => {
1181
1333
  const root = makeCompatibilitySmokeFixture(t);
1182
1334
  const result = runCompatibilitySmoke(root);
1183
1335
 
1184
1336
  assert.equal(result.status, 0, result.stderr || result.error?.message);
1185
1337
  assert.equal(
1186
1338
  result.stdout,
1187
- "opencode compatibility smoke ok: requested=1.14.41 resolved=1.14.41\n",
1339
+ "opencode compatibility smoke ok: mode=core requested=1.14.41 resolved=1.14.41\n",
1340
+ );
1341
+ });
1342
+
1343
+ test("default OpenCode compatibility smoke packs and loads the unmodified package config", (t) => {
1344
+ const root = makeCompatibilitySmokeFixture(t, { mode: "default", request: "1.18.4" });
1345
+ const result = runCompatibilitySmoke(root, ["default", "1.18.4"]);
1346
+
1347
+ assert.equal(result.status, 0, result.stderr || result.error?.message);
1348
+ assert.equal(fs.existsSync(path.join(root, "npm-pack-called")), true);
1349
+ assert.equal(
1350
+ result.stdout,
1351
+ "opencode compatibility smoke ok: mode=default requested=1.18.4 resolved=1.18.4\n",
1188
1352
  );
1189
1353
  });
1190
1354
 
1355
+ test("default OpenCode compatibility smoke does not fall back when npm pack fails", (t) => {
1356
+ const root = makeCompatibilitySmokeFixture(t, {
1357
+ mode: "default",
1358
+ request: "1.18.4",
1359
+ packFailure: true,
1360
+ });
1361
+ const result = runCompatibilitySmoke(root, ["default", "1.18.4"]);
1362
+
1363
+ assert.notEqual(result.status, 0);
1364
+ assert.equal(fs.existsSync(path.join(root, "npm-pack-called")), true);
1365
+ assert.equal(fs.existsSync(path.join(root, "npm-ci-called")), false);
1366
+ assert.equal(fs.existsSync(path.join(root, "npx-called")), false);
1367
+ });
1368
+
1191
1369
  test("OpenCode compatibility smoke suppresses temporary stderr paths without failing", (t) => {
1192
1370
  const root = makeCompatibilitySmokeFixture(t, { stderrLeak: "smoke" });
1193
1371
  const result = runCompatibilitySmoke(root);
@@ -1195,14 +1373,14 @@ test("OpenCode compatibility smoke suppresses temporary stderr paths without fai
1195
1373
  assert.equal(result.status, 0, result.stderr || result.error?.message);
1196
1374
  assert.equal(
1197
1375
  result.stdout,
1198
- "opencode compatibility smoke ok: requested=1.14.41 resolved=1.14.41\n",
1376
+ "opencode compatibility smoke ok: mode=core requested=1.14.41 resolved=1.14.41\n",
1199
1377
  );
1200
1378
  assert.equal(result.stderr.includes("SMOKE_TEMP_MARKER"), false);
1201
1379
  });
1202
1380
 
1203
1381
  test("OpenCode compatibility smoke rejects a non-canonical explicit version before tools run", (t) => {
1204
1382
  const root = makeCompatibilitySmokeFixture(t, { request: "01.14.41" });
1205
- const result = runCompatibilitySmoke(root, ["01.14.41"]);
1383
+ const result = runCompatibilitySmoke(root, ["core", "01.14.41"]);
1206
1384
 
1207
1385
  assert.equal(result.status, 2);
1208
1386
  assert.equal(result.stdout, "");
@@ -1215,7 +1393,7 @@ test("OpenCode compatibility smoke rejects a non-canonical latest resolution", (
1215
1393
  request: "latest",
1216
1394
  resolvedVersion: "01.18.4",
1217
1395
  });
1218
- const result = runCompatibilitySmoke(root, ["latest"]);
1396
+ const result = runCompatibilitySmoke(root, ["core", "latest"]);
1219
1397
 
1220
1398
  assert.notEqual(result.status, 0);
1221
1399
  assert.equal(result.stdout, "");
@@ -1241,6 +1419,24 @@ for (const [label, leakPath] of [
1241
1419
  });
1242
1420
  }
1243
1421
 
1422
+ for (const args of [
1423
+ [],
1424
+ ["core"],
1425
+ ["unknown", "1.14.41"],
1426
+ ["default", "latest"],
1427
+ ["core", "1.14.41", "extra"],
1428
+ ]) {
1429
+ test(`OpenCode compatibility smoke rejects invalid interface: ${JSON.stringify(args)}`, (t) => {
1430
+ const root = makeCompatibilitySmokeFixture(t);
1431
+ const result = runCompatibilitySmoke(root, args);
1432
+
1433
+ assert.equal(result.status, 2);
1434
+ assert.equal(fs.existsSync(path.join(root, "npm-pack-called")), false);
1435
+ assert.equal(fs.existsSync(path.join(root, "npm-ci-called")), false);
1436
+ assert.equal(fs.existsSync(path.join(root, "npx-called")), false);
1437
+ });
1438
+ }
1439
+
1244
1440
  for (const [label, leakPath] of [
1245
1441
  ["original repository", "root"],
1246
1442
  ["original home", process.env.HOME],