opencode-agent-orchestration-kit 1.0.27 → 1.0.28

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/scripts/check.sh CHANGED
@@ -19,8 +19,12 @@ upgrade.sh
19
19
  doctor.sh
20
20
  rollback.sh
21
21
  package.json
22
+ compatibility.json
22
23
  scripts/version.mjs
23
24
  scripts/version.test.mjs
25
+ scripts/check-compatibility.mjs
26
+ scripts/check-compatibility.test.mjs
27
+ scripts/opencode-compat-smoke.sh
24
28
  scripts/manage-installation.mjs
25
29
  scripts/manage-installation.test.mjs
26
30
  docs/releases/v${kit_version}.md
@@ -57,6 +61,7 @@ CONTRIBUTING.md
57
61
  .github/PULL_REQUEST_TEMPLATE.md
58
62
  .github/CODEOWNERS
59
63
  .github/workflows/check.yml
64
+ .github/workflows/compatibility-canary.yml
60
65
  .github/ISSUE_TEMPLATE/config.yml
61
66
  .github/ISSUE_TEMPLATE/bug_report.yml
62
67
  .github/ISSUE_TEMPLATE/feature_request.yml
@@ -67,11 +72,12 @@ for file in $required_files; do
67
72
  test -f "$file" || { echo "Missing required file: $file" >&2; exit 1; }
68
73
  done
69
74
 
70
- for file in install.sh uninstall.sh upgrade.sh doctor.sh rollback.sh scripts/check.sh; do
75
+ for file in install.sh uninstall.sh upgrade.sh doctor.sh rollback.sh scripts/check.sh scripts/opencode-compat-smoke.sh; do
71
76
  test -x "$file" || { echo "Not executable: $file" >&2; exit 1; }
72
77
  done
73
78
 
74
79
  node scripts/version.mjs --check
80
+ node scripts/check-compatibility.mjs
75
81
 
76
82
  node -e "JSON.parse(require('fs').readFileSync('opencode/opencode.json','utf8')); JSON.parse(require('fs').readFileSync('docker/open-design/opencode-od/opencode.json','utf8')); console.log('json ok')"
77
83
  (cd opencode && node scripts/check-harness.mjs)
@@ -0,0 +1,174 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ canonical_version_re='^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$'
5
+
6
+ if [[ $# -ne 1 ]] || [[ "$1" != "latest" && ! "$1" =~ $canonical_version_re ]]; then
7
+ echo "usage: $0 MAJOR.MINOR.PATCH|latest" >&2
8
+ exit 2
9
+ fi
10
+
11
+ request="$1"
12
+ root="$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)"
13
+ original_home="${HOME-}"
14
+ temp_base="${TMPDIR:-/tmp}"
15
+ temp_base="${temp_base%/}"
16
+ smoke_root=""
17
+
18
+ cleanup() {
19
+ if [[ -n "$smoke_root" ]]; then
20
+ case "$smoke_root" in
21
+ "$temp_base"/oak-opencode-compat.??????)
22
+ rm -rf -- "$smoke_root"
23
+ ;;
24
+ esac
25
+ fi
26
+ }
27
+ trap cleanup EXIT
28
+
29
+ smoke_root="$(mktemp -d "$temp_base/oak-opencode-compat.XXXXXX")"
30
+ mkdir -p \
31
+ "$smoke_root/home" \
32
+ "$smoke_root/config" \
33
+ "$smoke_root/data" \
34
+ "$smoke_root/cache" \
35
+ "$smoke_root/state" \
36
+ "$smoke_root/npm"
37
+ diagnostics_file="$smoke_root/diagnostics"
38
+ : >"$diagnostics_file"
39
+ test -f "$diagnostics_file" && test ! -L "$diagnostics_file"
40
+
41
+ source_config="$root/opencode"
42
+ target_config="$smoke_root/config/opencode"
43
+ test ! -e "$target_config"
44
+
45
+ node - "$source_config" "$target_config" <<'NODE'
46
+ const fs = require("node:fs");
47
+ const path = require("node:path");
48
+
49
+ const sourceRoot = process.argv[2];
50
+ const targetRoot = process.argv[3];
51
+
52
+ fs.cpSync(sourceRoot, targetRoot, {
53
+ recursive: true,
54
+ filter(source) {
55
+ const stat = fs.lstatSync(source);
56
+ if (stat.isSymbolicLink()) {
57
+ throw new Error("packaged OpenCode config must not contain symlinks");
58
+ }
59
+
60
+ const relative = path.relative(sourceRoot, source);
61
+ if (relative === "") return true;
62
+ return !relative.split(path.sep).some((component) =>
63
+ component === "node_modules" || component === ".oak"
64
+ );
65
+ },
66
+ });
67
+ NODE
68
+
69
+ if [[ ! -f "$target_config/agents/lead.md" || -e "$target_config/opencode" ]]; then
70
+ echo "packaged OpenCode config has an invalid layout" >&2
71
+ exit 1
72
+ fi
73
+
74
+ run_isolated() (
75
+ cd "$smoke_root/home"
76
+ env -i \
77
+ PATH="$PATH" \
78
+ HOME="$smoke_root/home" \
79
+ XDG_CONFIG_HOME="$smoke_root/config" \
80
+ XDG_DATA_HOME="$smoke_root/data" \
81
+ XDG_CACHE_HOME="$smoke_root/cache" \
82
+ XDG_STATE_HOME="$smoke_root/state" \
83
+ npm_config_cache="$smoke_root/npm" \
84
+ OPENCODE_CONFIG_DIR="$target_config" \
85
+ "$@"
86
+ )
87
+
88
+ run_opencode() {
89
+ run_isolated npx --yes --package "opencode-ai@$request" opencode "$@"
90
+ }
91
+
92
+ contains_forbidden_path() {
93
+ local output="$1"
94
+ local forbidden
95
+ for forbidden in "$original_home" "$root"; do
96
+ if [[ -n "$forbidden" && "$output" == *"$forbidden"* ]]; then
97
+ return 0
98
+ fi
99
+ done
100
+ return 1
101
+ }
102
+
103
+ emit_safe_diagnostics() {
104
+ local line
105
+ while IFS= read -r line || [[ -n "$line" ]]; do
106
+ if [[ "$line" != *"$smoke_root"* ]]; then
107
+ printf '%s\n' "$line" >&2
108
+ fi
109
+ done <"$diagnostics_file"
110
+ }
111
+
112
+ fail_with_diagnostics() {
113
+ local message="$1"
114
+ local diagnostics
115
+ diagnostics="$(<"$diagnostics_file")"
116
+ if contains_forbidden_path "$diagnostics"; then
117
+ echo "captured diagnostics contained a private path" >&2
118
+ else
119
+ emit_safe_diagnostics
120
+ echo "$message" >&2
121
+ fi
122
+ exit 1
123
+ }
124
+
125
+ if ! run_isolated npm --prefix "$target_config" ci --ignore-scripts \
126
+ >/dev/null 2>>"$diagnostics_file"; then
127
+ fail_with_diagnostics "isolated npm install failed"
128
+ fi
129
+
130
+ if ! actual="$(run_opencode --version 2>>"$diagnostics_file")"; then
131
+ fail_with_diagnostics "OpenCode version command failed"
132
+ fi
133
+ if [[ "$request" == "latest" ]]; then
134
+ if [[ ! "$actual" =~ $canonical_version_re ]]; then
135
+ fail_with_diagnostics "latest OpenCode did not resolve to a canonical version"
136
+ fi
137
+ elif [[ "$actual" != "$request" ]]; then
138
+ fail_with_diagnostics "resolved OpenCode version did not match the request"
139
+ fi
140
+
141
+ if ! agent_json="$(run_opencode debug agent lead --pure 2>>"$diagnostics_file")"; then
142
+ fail_with_diagnostics "OpenCode lead debug command failed"
143
+ fi
144
+
145
+ for output in "$actual" "$agent_json"; do
146
+ if contains_forbidden_path "$output"; then
147
+ fail_with_diagnostics "OpenCode output contained a private path"
148
+ fi
149
+ done
150
+
151
+ if ! printf '%s' "$agent_json" | node -e '
152
+ let input = "";
153
+ process.stdin.setEncoding("utf8");
154
+ process.stdin.on("data", (chunk) => { input += chunk; });
155
+ process.stdin.on("end", () => {
156
+ let agent;
157
+ try {
158
+ agent = JSON.parse(input);
159
+ } catch {
160
+ process.exit(1);
161
+ }
162
+ if (agent?.name !== "lead" || agent?.mode !== "primary") process.exit(1);
163
+ });
164
+ '; then
165
+ fail_with_diagnostics "packaged lead did not resolve as a primary agent"
166
+ fi
167
+
168
+ diagnostics="$(<"$diagnostics_file")"
169
+ if contains_forbidden_path "$diagnostics"; then
170
+ echo "captured diagnostics contained a private path" >&2
171
+ exit 1
172
+ fi
173
+ emit_safe_diagnostics
174
+ printf 'opencode compatibility smoke ok: requested=%s resolved=%s\n' "$request" "$actual"
@@ -98,6 +98,18 @@ function isDeclaredNonKitVersion(relative, line) {
98
98
  || /opencode\/package\.json must (?:pin|override)/.test(line));
99
99
  }
100
100
 
101
+ function excludeOpenCodeBoundarySection(relative, contents) {
102
+ if (relative !== ".github/workflows/check.yml") return contents;
103
+ const start = "# opencode-boundaries:start";
104
+ const end = "# opencode-boundaries:end";
105
+ const startCount = contents.split(start).length - 1;
106
+ const endCount = contents.split(end).length - 1;
107
+ const startIndex = contents.indexOf(start);
108
+ const endIndex = contents.indexOf(end);
109
+ if (startCount !== 1 || endCount !== 1 || endIndex <= startIndex) return contents;
110
+ return `${contents.slice(0, startIndex)}${contents.slice(endIndex + end.length)}`;
111
+ }
112
+
101
113
  export function checkVersionContract(options = {}) {
102
114
  const repositoryRoot = options.repositoryRoot;
103
115
  const fsOps = options.fsOps ?? fs;
@@ -122,11 +134,12 @@ export function checkVersionContract(options = {}) {
122
134
 
123
135
  for (const relative of OPERATIONAL_VERSION_SURFACES) {
124
136
  const contents = readRegularFile(path.join(repositoryRoot, relative), relative, fsOps);
125
- const competing = contents.split(/\r?\n/).flatMap((line) => (
126
- isDeclaredNonKitVersion(relative, line)
127
- ? []
128
- : [...line.matchAll(CONCRETE_STABLE_VERSION)].map((match) => match[0])
129
- ));
137
+ const competing = excludeOpenCodeBoundarySection(relative, contents)
138
+ .split(/\r?\n/).flatMap((line) => (
139
+ isDeclaredNonKitVersion(relative, line)
140
+ ? []
141
+ : [...line.matchAll(CONCRETE_STABLE_VERSION)].map((match) => match[0])
142
+ ));
130
143
  if (competing.length > 0) {
131
144
  throw invalid(`${relative} contains a competing stable version declaration`);
132
145
  }
@@ -108,7 +108,7 @@ test("[V004] direct version entrypoints are exact and mutation-free", (t) => {
108
108
  for (const args of [["scripts/version.mjs"], ["scripts/manage-installation.mjs", "--version"]]) {
109
109
  const result = run(process.execPath, args, { HOME: home });
110
110
  assert.equal(result.status, 0, result.stderr);
111
- assert.equal(result.stdout, "opencode-agent-orchestration-kit 1.0.27\n");
111
+ assert.equal(result.stdout, "opencode-agent-orchestration-kit 1.0.28\n");
112
112
  assert.equal(fs.existsSync(target), false);
113
113
  }
114
114
  });
@@ -117,7 +117,7 @@ test("[V005] all lifecycle wrappers expose the canonical version", () => {
117
117
  for (const wrapper of ["install.sh", "upgrade.sh", "doctor.sh", "uninstall.sh", "rollback.sh"]) {
118
118
  const result = run(path.join(REPOSITORY_ROOT, wrapper), ["--version"]);
119
119
  assert.equal(result.status, 0, `${wrapper}: ${result.stderr}`);
120
- assert.equal(result.stdout, "opencode-agent-orchestration-kit 1.0.27\n", wrapper);
120
+ assert.equal(result.stdout, "opencode-agent-orchestration-kit 1.0.28\n", wrapper);
121
121
  }
122
122
  });
123
123
 
@@ -191,5 +191,55 @@ test("[V011] workflow remains non-publishing and scenario IDs are unique", () =>
191
191
  .map((relative) => fs.readFileSync(path.join(REPOSITORY_ROOT, relative), "utf8"))
192
192
  .join("\n");
193
193
  const ids = [...sources.matchAll(/\[V(\d{3})\]/g)].map((match) => Number(match[1]));
194
- assert.deepEqual(ids.sort((left, right) => left - right), Array.from({ length: 27 }, (_, index) => index + 1));
194
+ assert.deepEqual(ids.sort((left, right) => left - right), Array.from({ length: 28 }, (_, index) => index + 1));
195
+ });
196
+
197
+ test("[V028] only the marked OpenCode boundary section may declare non-kit stable versions", async (t) => {
198
+ const workflow = `name: Check
199
+ jobs:
200
+ # opencode-boundaries:start
201
+ opencode-compatibility:
202
+ strategy:
203
+ matrix:
204
+ opencode:
205
+ - "1.14.41"
206
+ - "1.18.4"
207
+ # opencode-boundaries:end
208
+ `;
209
+
210
+ assert.doesNotThrow(() => checkVersionContract({
211
+ repositoryRoot: makeContractRepository(t, { ".github/workflows/check.yml": workflow }),
212
+ }));
213
+
214
+ for (const [label, contents] of [
215
+ ["outside the section", `${workflow}env:\n OTHER_VERSION: "9.8.7"\n`],
216
+ [
217
+ "without markers",
218
+ workflow
219
+ .replace(" # opencode-boundaries:start\n", "")
220
+ .replace(" # opencode-boundaries:end\n", ""),
221
+ ],
222
+ [
223
+ "with a duplicated marker",
224
+ workflow.replace(
225
+ " # opencode-boundaries:start",
226
+ " # opencode-boundaries:start\n # opencode-boundaries:start",
227
+ ),
228
+ ],
229
+ [
230
+ "with markers out of order",
231
+ workflow
232
+ .replace("# opencode-boundaries:start", "# opencode-boundaries:temporary")
233
+ .replace("# opencode-boundaries:end", "# opencode-boundaries:start")
234
+ .replace("# opencode-boundaries:temporary", "# opencode-boundaries:end"),
235
+ ],
236
+ ]) {
237
+ await t.test(label, (child) => {
238
+ const root = makeContractRepository(child, { ".github/workflows/check.yml": contents });
239
+ assert.throws(
240
+ () => checkVersionContract({ repositoryRoot: root }),
241
+ /competing stable version declaration/,
242
+ );
243
+ });
244
+ }
195
245
  });