opencode-agent-orchestration-kit 1.0.45 → 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.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 +19 -9
- 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 +8 -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 +142 -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 +4 -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 +24 -57
- package/scripts/check-supply-chain.test.mjs +37 -35
- 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.test.mjs +3 -3
- package/scripts/version.test.mjs +2 -2
- package/supply-chain.json +0 -4
- package/docs/superpowers.md +0 -41
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import test from "node:test";
|
|
3
|
+
|
|
4
|
+
const { OPEN_DESIGN_TOOLS, openDesignJsonSchema } = await import("../opencode/tools/open-design-tools.mjs");
|
|
5
|
+
|
|
6
|
+
test("defines the six Open Design tools in their historical order", () => {
|
|
7
|
+
assert.deepEqual(
|
|
8
|
+
OPEN_DESIGN_TOOLS.map((definition) => definition.name),
|
|
9
|
+
["health", "list_agents", "list_skills", "list_design_systems", "create_project", "run_design"],
|
|
10
|
+
);
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
test("every tool accepts an optional baseUrl", () => {
|
|
14
|
+
for (const definition of OPEN_DESIGN_TOOLS) {
|
|
15
|
+
assert.equal(definition.args.baseUrl, "optional", definition.name);
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
test("run_design requires name, prompt and skillId", () => {
|
|
20
|
+
const runDesign = OPEN_DESIGN_TOOLS.find((definition) => definition.name === "run_design");
|
|
21
|
+
assert.deepEqual(openDesignJsonSchema(runDesign.args).required, ["name", "prompt", "skillId"]);
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
test("JSON schema is a closed object of strings", () => {
|
|
25
|
+
assert.deepEqual(openDesignJsonSchema({ baseUrl: "optional", name: "required" }), {
|
|
26
|
+
type: "object",
|
|
27
|
+
properties: { baseUrl: { type: "string" }, name: { type: "string" } },
|
|
28
|
+
required: ["name"],
|
|
29
|
+
additionalProperties: false,
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
test("rejects a project URL as the base URL before any network call", async () => {
|
|
34
|
+
const health = OPEN_DESIGN_TOOLS.find((definition) => definition.name === "health");
|
|
35
|
+
await assert.rejects(
|
|
36
|
+
health.execute({ baseUrl: "https://open-design.example.com/projects/abc" }),
|
|
37
|
+
/must be the Open Design base URL/,
|
|
38
|
+
);
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
test("requires OPEN_DESIGN_URL when no baseUrl is given", async (t) => {
|
|
42
|
+
const previous = process.env.OPEN_DESIGN_URL;
|
|
43
|
+
delete process.env.OPEN_DESIGN_URL;
|
|
44
|
+
t.after(() => {
|
|
45
|
+
if (previous !== undefined) process.env.OPEN_DESIGN_URL = previous;
|
|
46
|
+
});
|
|
47
|
+
const health = OPEN_DESIGN_TOOLS.find((definition) => definition.name === "health");
|
|
48
|
+
await assert.rejects(health.execute({}), /OPEN_DESIGN_URL is not set/);
|
|
49
|
+
});
|
|
@@ -145,16 +145,13 @@ const root = process.argv[2];
|
|
|
145
145
|
const mode = process.argv[3];
|
|
146
146
|
const config = JSON.parse(fs.readFileSync(path.join(root, "opencode.json"), "utf8"));
|
|
147
147
|
const plugins = path.join(root, "plugins");
|
|
148
|
-
const superpowers = "superpowers@git+https://github.com/obra/superpowers.git#d884ae04edebef577e82ff7c4e143debd0bbec99";
|
|
149
148
|
|
|
150
149
|
if (mode === "core") {
|
|
151
150
|
if (!Array.isArray(config.plugin) || config.plugin.length !== 0 || fs.existsSync(plugins)) {
|
|
152
151
|
process.exit(1);
|
|
153
152
|
}
|
|
154
153
|
} else if (
|
|
155
|
-
|
|
156
|
-
|| config.plugin.length !== 1
|
|
157
|
-
|| config.plugin[0] !== superpowers
|
|
154
|
+
Object.hasOwn(config, "plugin")
|
|
158
155
|
|| !fs.statSync(path.join(plugins, "token-tree-usage.tsx")).isFile()
|
|
159
156
|
) {
|
|
160
157
|
process.exit(1);
|
|
@@ -255,6 +252,50 @@ if ! printf '%s' "$agent_json" | node -e '
|
|
|
255
252
|
fail_with_diagnostics "packaged lead did not resolve as a primary agent"
|
|
256
253
|
fi
|
|
257
254
|
|
|
255
|
+
if [[ "$mode" == "default" ]]; then
|
|
256
|
+
# OpenCode 1 reports a plugin file that fails to import only as a session
|
|
257
|
+
# error event, never in its logs. Import every plugin file it scans with the
|
|
258
|
+
# Bun runtime embedded in the same OpenCode binary, and require the loader's
|
|
259
|
+
# default-export shape.
|
|
260
|
+
if ! run_isolated env BUN_BE_BUN=1 OAK_PLUGIN_DIR="$target_config/plugins" \
|
|
261
|
+
npx --yes --package "opencode-ai@$request" opencode -e '
|
|
262
|
+
const fs = require("node:fs");
|
|
263
|
+
const path = require("node:path");
|
|
264
|
+
const dir = process.env.OAK_PLUGIN_DIR;
|
|
265
|
+
let failed = false;
|
|
266
|
+
for (const name of fs.readdirSync(dir).filter((entry) => /\.(ts|js)$/.test(entry)).sort()) {
|
|
267
|
+
try {
|
|
268
|
+
const mod = await import(path.join(dir, name));
|
|
269
|
+
if (typeof mod.default?.server !== "function") throw new Error("missing server");
|
|
270
|
+
} catch {
|
|
271
|
+
failed = true;
|
|
272
|
+
console.error(`plugin ${name} did not load`);
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
if (failed) process.exit(1);
|
|
276
|
+
' >/dev/null 2>>"$diagnostics_file"; then
|
|
277
|
+
fail_with_diagnostics "an OAK plugin failed to import"
|
|
278
|
+
fi
|
|
279
|
+
# A plugin whose server hook throws is logged as "failed to load plugin".
|
|
280
|
+
plugin_log="$smoke_root/plugin-load.log"
|
|
281
|
+
if ! designer_json="$(run_opencode --print-logs --log-level ERROR debug agent designer 2>"$plugin_log")"; then
|
|
282
|
+
fail_with_diagnostics "OpenCode designer debug command failed"
|
|
283
|
+
fi
|
|
284
|
+
if grep -qi 'failed to load plugin' "$plugin_log"; then
|
|
285
|
+
fail_with_diagnostics "an OAK or configured plugin failed to load"
|
|
286
|
+
fi
|
|
287
|
+
if ! printf '%s' "$designer_json" | node -e '
|
|
288
|
+
let input = "";
|
|
289
|
+
process.stdin.on("data", (chunk) => { input += chunk; });
|
|
290
|
+
process.stdin.on("end", () => {
|
|
291
|
+
const agent = JSON.parse(input);
|
|
292
|
+
if (agent?.tools?.open_design_health !== true) process.exit(1);
|
|
293
|
+
});
|
|
294
|
+
'; then
|
|
295
|
+
fail_with_diagnostics "Open Design tools did not register"
|
|
296
|
+
fi
|
|
297
|
+
fi
|
|
298
|
+
|
|
258
299
|
diagnostics="$(<"$diagnostics_file")"
|
|
259
300
|
if contains_forbidden_path "$diagnostics"; then
|
|
260
301
|
echo "captured diagnostics contained a private path" >&2
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { spawn, spawnSync } from "node:child_process";
|
|
3
|
+
import crypto from "node:crypto";
|
|
4
|
+
import fs from "node:fs";
|
|
5
|
+
import net from "node:net";
|
|
6
|
+
import os from "node:os";
|
|
7
|
+
import path from "node:path";
|
|
8
|
+
import { setTimeout as sleep } from "node:timers/promises";
|
|
9
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
10
|
+
|
|
11
|
+
const ROOT = path.dirname(path.dirname(fileURLToPath(import.meta.url)));
|
|
12
|
+
const CANONICAL = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/;
|
|
13
|
+
const ACTIVATION_TIMEOUT_MS = 120_000;
|
|
14
|
+
export const EXPECTED_LOCAL_PLUGINS = Object.freeze([
|
|
15
|
+
"oak.mission-runtime",
|
|
16
|
+
"oak.open-design",
|
|
17
|
+
"oak.shell-export-guard",
|
|
18
|
+
"oak.tui",
|
|
19
|
+
]);
|
|
20
|
+
|
|
21
|
+
export function parseSmokeArgs(argv) {
|
|
22
|
+
const [mode, request] = argv;
|
|
23
|
+
const valid = argv.length === 2
|
|
24
|
+
&& ["core", "default"].includes(mode)
|
|
25
|
+
&& (request === "latest" || CANONICAL.test(request ?? ""))
|
|
26
|
+
&& !(mode === "default" && request === "latest");
|
|
27
|
+
if (!valid) throw new Error("usage: opencode-v2-smoke.mjs core MAJOR.MINOR.PATCH|latest | default MAJOR.MINOR.PATCH");
|
|
28
|
+
return { mode, request };
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// OpenCode 2 prints `opencode v2.0.18`.
|
|
32
|
+
export function parseVersion(output) {
|
|
33
|
+
const version = String(output).trim().split(/\s+/).at(-1)?.replace(/^v/, "") ?? "";
|
|
34
|
+
return CANONICAL.test(version) ? version : null;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function readList(body) {
|
|
38
|
+
if (Array.isArray(body)) return body;
|
|
39
|
+
if (Array.isArray(body?.data)) return body.data;
|
|
40
|
+
throw new Error("plugin.list returned an unexpected shape");
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// A local plugin that fails to import is listed without an id, so failures
|
|
44
|
+
// are named by file, never by path or error text.
|
|
45
|
+
function localFailures(list) {
|
|
46
|
+
return list
|
|
47
|
+
.filter((plugin) => plugin?.source?.type === "local" && plugin.state?.status !== "active")
|
|
48
|
+
.map((plugin) => plugin.id ?? path.basename(String(plugin.source.path ?? "unknown")));
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function settled(list) {
|
|
52
|
+
const ids = new Set(list.map((plugin) => plugin?.id));
|
|
53
|
+
return EXPECTED_LOCAL_PLUGINS.every((id) => ids.has(id)) || localFailures(list).length > 0;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export function assertPluginsActive(body) {
|
|
57
|
+
const list = readList(body);
|
|
58
|
+
const byId = new Map(list.map((plugin) => [plugin?.id, plugin]));
|
|
59
|
+
const problems = localFailures(list).map((name) => `${name} failed`);
|
|
60
|
+
for (const id of EXPECTED_LOCAL_PLUGINS) {
|
|
61
|
+
if (!byId.has(id)) problems.push(`${id} missing`);
|
|
62
|
+
}
|
|
63
|
+
// `serve` never loads CLI entries; this at least proves OpenCode 2 found tui.tsx.
|
|
64
|
+
if (byId.has("oak.tui") && byId.get("oak.tui")?.features?.tui !== true) problems.push("oak.tui has no CLI entry");
|
|
65
|
+
if (problems.length > 0) throw new Error(`OpenCode 2 plugins: ${[...new Set(problems)].join(", ")}`);
|
|
66
|
+
return EXPECTED_LOCAL_PLUGINS.filter((id) => byId.get(id)?.state?.status === "active");
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function freePort() {
|
|
70
|
+
return new Promise((resolve, reject) => {
|
|
71
|
+
const server = net.createServer();
|
|
72
|
+
server.once("error", reject);
|
|
73
|
+
server.listen(0, "127.0.0.1", () => {
|
|
74
|
+
const { port } = server.address();
|
|
75
|
+
server.close(() => resolve(port));
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function signalGroup(child, name) {
|
|
81
|
+
try {
|
|
82
|
+
process.kill(-child.pid, name);
|
|
83
|
+
return true;
|
|
84
|
+
} catch {
|
|
85
|
+
return false; // The process group is gone.
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// The server runs in its own process group; npx can exit before the OpenCode
|
|
90
|
+
// process it started, so wait for the whole group and force it down if needed.
|
|
91
|
+
async function stop(child) {
|
|
92
|
+
signalGroup(child, "SIGTERM");
|
|
93
|
+
const deadline = Date.now() + 10_000;
|
|
94
|
+
while (Date.now() < deadline && signalGroup(child, 0)) await sleep(200);
|
|
95
|
+
signalGroup(child, "SIGKILL");
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
async function main() {
|
|
99
|
+
const { mode, request } = parseSmokeArgs(process.argv.slice(2));
|
|
100
|
+
const smokeRoot = fs.mkdtempSync(path.join(os.tmpdir(), "oak-opencode-v2."));
|
|
101
|
+
const privatePaths = [smokeRoot, fs.realpathSync(smokeRoot), ROOT, os.homedir()].filter(Boolean);
|
|
102
|
+
const safe = (text) => privatePaths.reduce((value, hidden) => value.split(hidden).join("<redacted>"), String(text));
|
|
103
|
+
let server;
|
|
104
|
+
// A detached server does not receive the terminal's interrupt; clean up for it.
|
|
105
|
+
for (const name of ["SIGINT", "SIGTERM"]) {
|
|
106
|
+
process.once(name, () => {
|
|
107
|
+
if (server) signalGroup(server, "SIGKILL");
|
|
108
|
+
fs.rmSync(smokeRoot, { recursive: true, force: true });
|
|
109
|
+
process.exit(name === "SIGINT" ? 130 : 143);
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
try {
|
|
113
|
+
const config = path.join(smokeRoot, "config", "opencode");
|
|
114
|
+
fs.cpSync(path.join(ROOT, "opencode"), config, {
|
|
115
|
+
recursive: true,
|
|
116
|
+
filter: (source) => !source.split(path.sep).some((part) => part === "node_modules" || part === ".oak"),
|
|
117
|
+
});
|
|
118
|
+
const configPath = path.join(config, "opencode.json");
|
|
119
|
+
const parsed = JSON.parse(fs.readFileSync(configPath, "utf8"));
|
|
120
|
+
if (mode === "core") {
|
|
121
|
+
parsed.plugin = [];
|
|
122
|
+
fs.writeFileSync(configPath, `${JSON.stringify(parsed, null, 2)}\n`);
|
|
123
|
+
} else if (Object.hasOwn(parsed, "plugin")) {
|
|
124
|
+
throw new Error("the default config must not declare external plugins");
|
|
125
|
+
}
|
|
126
|
+
for (const dir of ["home", "data", "cache", "state", "npm"]) fs.mkdirSync(path.join(smokeRoot, dir), { recursive: true });
|
|
127
|
+
const env = {
|
|
128
|
+
PATH: process.env.PATH,
|
|
129
|
+
HOME: path.join(smokeRoot, "home"),
|
|
130
|
+
XDG_CONFIG_HOME: path.join(smokeRoot, "config"),
|
|
131
|
+
XDG_DATA_HOME: path.join(smokeRoot, "data"),
|
|
132
|
+
XDG_CACHE_HOME: path.join(smokeRoot, "cache"),
|
|
133
|
+
XDG_STATE_HOME: path.join(smokeRoot, "state"),
|
|
134
|
+
npm_config_cache: path.join(smokeRoot, "npm"),
|
|
135
|
+
OPENCODE_CONFIG_DIR: config,
|
|
136
|
+
OPENCODE_PASSWORD: crypto.randomBytes(18).toString("hex"),
|
|
137
|
+
};
|
|
138
|
+
const opencodeArgs = (...args) => ["--yes", "--package", `@opencode/cli@${request}`, "opencode", ...args];
|
|
139
|
+
const run = (command, args) => {
|
|
140
|
+
const result = spawnSync(command, args, {
|
|
141
|
+
cwd: env.HOME,
|
|
142
|
+
env,
|
|
143
|
+
encoding: "utf8",
|
|
144
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
145
|
+
timeout: 600_000,
|
|
146
|
+
maxBuffer: 64 * 1024 * 1024,
|
|
147
|
+
});
|
|
148
|
+
if (result.status !== 0) throw new Error(`${command} ${args[0] ?? ""} failed: ${safe(result.stderr).slice(-2000)}`);
|
|
149
|
+
return result.stdout;
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
run("npm", ["--prefix", config, "ci", "--ignore-scripts"]);
|
|
153
|
+
const version = parseVersion(run("npx", opencodeArgs("--version")));
|
|
154
|
+
if (!version || !version.startsWith("2.") || (request !== "latest" && version !== request)) {
|
|
155
|
+
throw new Error(`resolved OpenCode ${safe(version)} does not match ${request}`);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// `api --standalone` answers before plugins activate, so query a private server until they settle.
|
|
159
|
+
const port = await freePort();
|
|
160
|
+
server = spawn("npx", opencodeArgs("serve", "--hostname", "127.0.0.1", "--port", String(port)), {
|
|
161
|
+
cwd: env.HOME,
|
|
162
|
+
env,
|
|
163
|
+
stdio: "ignore",
|
|
164
|
+
detached: true,
|
|
165
|
+
});
|
|
166
|
+
const api = (...args) => JSON.parse(run("npx", opencodeArgs("api", "--server", `http://127.0.0.1:${port}`, ...args)));
|
|
167
|
+
const deadline = Date.now() + ACTIVATION_TIMEOUT_MS;
|
|
168
|
+
let plugins = null;
|
|
169
|
+
while (Date.now() < deadline) {
|
|
170
|
+
try {
|
|
171
|
+
plugins = api("plugin.list");
|
|
172
|
+
if (settled(readList(plugins))) break;
|
|
173
|
+
} catch {
|
|
174
|
+
// The server is still starting.
|
|
175
|
+
}
|
|
176
|
+
await sleep(1_000);
|
|
177
|
+
}
|
|
178
|
+
if (!plugins) throw new Error("OpenCode 2 server did not answer plugin.list");
|
|
179
|
+
const ids = assertPluginsActive(plugins);
|
|
180
|
+
const lead = api("agent.get", "--param", "agentID=lead");
|
|
181
|
+
const agent = lead?.data ?? lead;
|
|
182
|
+
if (agent?.id !== "lead" || agent?.mode !== "primary") throw new Error("lead did not resolve as a primary agent");
|
|
183
|
+
console.log(`opencode v2 smoke ok: mode=${mode} requested=${request} resolved=${version} plugins=${ids.length}`);
|
|
184
|
+
} catch (error) {
|
|
185
|
+
throw new Error(safe(error instanceof Error ? error.message : error));
|
|
186
|
+
} finally {
|
|
187
|
+
if (server) await stop(server);
|
|
188
|
+
fs.rmSync(smokeRoot, { recursive: true, force: true });
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
if (import.meta.url === pathToFileURL(process.argv[1] ?? "").href) {
|
|
193
|
+
main().catch((error) => {
|
|
194
|
+
console.error(error instanceof Error ? error.message : "opencode v2 smoke failed");
|
|
195
|
+
process.exit(1);
|
|
196
|
+
});
|
|
197
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import test from "node:test";
|
|
3
|
+
import { EXPECTED_LOCAL_PLUGINS, assertPluginsActive, parseSmokeArgs, parseVersion } from "./opencode-v2-smoke.mjs";
|
|
4
|
+
|
|
5
|
+
const active = (id, type = "local") => ({
|
|
6
|
+
id,
|
|
7
|
+
source: { type },
|
|
8
|
+
features: id === "oak.tui" ? { server: true, tui: true } : { server: true },
|
|
9
|
+
state: { status: "active" },
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
test("parses mode and version", () => {
|
|
13
|
+
assert.deepEqual(parseSmokeArgs(["core", "2.0.18"]), { mode: "core", request: "2.0.18" });
|
|
14
|
+
assert.deepEqual(parseSmokeArgs(["core", "latest"]), { mode: "core", request: "latest" });
|
|
15
|
+
assert.deepEqual(parseSmokeArgs(["default", "2.0.18"]), { mode: "default", request: "2.0.18" });
|
|
16
|
+
for (const argv of [[], ["core"], ["other", "2.0.18"], ["core", "2.0"], ["default", "latest"]]) {
|
|
17
|
+
assert.throws(() => parseSmokeArgs(argv), /usage:/);
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
test("reads the version from the OpenCode 2 banner", () => {
|
|
22
|
+
assert.equal(parseVersion("opencode v2.0.18\n"), "2.0.18");
|
|
23
|
+
assert.equal(parseVersion("2.1.0"), "2.1.0");
|
|
24
|
+
assert.equal(parseVersion("opencode vnext"), null);
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
test("accepts a bare array or a data envelope with every OAK plugin active", () => {
|
|
28
|
+
const list = [...EXPECTED_LOCAL_PLUGINS.map((id) => active(id)), active("opencode.agent", "builtin")];
|
|
29
|
+
assert.deepEqual(assertPluginsActive(list).sort(), [...EXPECTED_LOCAL_PLUGINS].sort());
|
|
30
|
+
assert.deepEqual(assertPluginsActive({ data: list }).sort(), [...EXPECTED_LOCAL_PLUGINS].sort());
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
test("rejects a failed or missing OAK plugin without echoing error text or paths", () => {
|
|
34
|
+
const list = EXPECTED_LOCAL_PLUGINS.map((id) => active(id));
|
|
35
|
+
list[0] = { ...list[0], state: { status: "failed", error: "/private/path boom" } };
|
|
36
|
+
assert.throws(
|
|
37
|
+
() => assertPluginsActive(list),
|
|
38
|
+
(error) => /failed/.test(error.message) && !error.message.includes("/private/path"),
|
|
39
|
+
);
|
|
40
|
+
assert.throws(() => assertPluginsActive(list.slice(1)), /missing/);
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
test("rejects a local plugin that failed before it reported an id", () => {
|
|
44
|
+
const list = [
|
|
45
|
+
...EXPECTED_LOCAL_PLUGINS.slice(1).map((id) => active(id)),
|
|
46
|
+
{ source: { type: "local", path: "/private/cfg/plugins/mission-runtime.ts" }, state: { status: "failed" } },
|
|
47
|
+
];
|
|
48
|
+
assert.throws(
|
|
49
|
+
() => assertPluginsActive(list),
|
|
50
|
+
(error) => /mission-runtime\.ts failed/.test(error.message) && !error.message.includes("/private/cfg"),
|
|
51
|
+
);
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
test("rejects an oak.tui plugin without its CLI entry", () => {
|
|
55
|
+
const list = EXPECTED_LOCAL_PLUGINS.map((id) => active(id));
|
|
56
|
+
const tui = list.find((plugin) => plugin.id === "oak.tui");
|
|
57
|
+
tui.features = { server: true };
|
|
58
|
+
assert.throws(() => assertPluginsActive(list), /oak\.tui has no CLI entry/);
|
|
59
|
+
});
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
|
|
19
19
|
const ROOT = path.dirname(path.dirname(fileURLToPath(import.meta.url)));
|
|
20
20
|
const HASH = "a".repeat(64);
|
|
21
|
-
const BASENAME = "opencode-agent-orchestration-kit-1.0.
|
|
21
|
+
const BASENAME = "opencode-agent-orchestration-kit-1.1.0.tgz";
|
|
22
22
|
const REQUIRED = [
|
|
23
23
|
"package/package.json",
|
|
24
24
|
"package/supply-chain.json",
|
|
@@ -228,7 +228,7 @@ test("smokeTarball checks the tracked set before extraction", async () => {
|
|
|
228
228
|
await assert.rejects(
|
|
229
229
|
smokeTarball({
|
|
230
230
|
repositoryRoot: ROOT,
|
|
231
|
-
tarball: "/public/opencode-agent-orchestration-kit-1.0.
|
|
231
|
+
tarball: "/public/opencode-agent-orchestration-kit-1.1.0.tgz",
|
|
232
232
|
captureTarball(_source, destination) {
|
|
233
233
|
fs.writeFileSync(destination, "fixture");
|
|
234
234
|
return { size: 1 };
|
|
@@ -253,7 +253,7 @@ test("smokeTarball validates both archive listings before extraction", async ()
|
|
|
253
253
|
await assert.rejects(
|
|
254
254
|
smokeTarball({
|
|
255
255
|
repositoryRoot: ROOT,
|
|
256
|
-
tarball: "/public/opencode-agent-orchestration-kit-1.0.
|
|
256
|
+
tarball: "/public/opencode-agent-orchestration-kit-1.1.0.tgz",
|
|
257
257
|
captureTarball(_source, destination) {
|
|
258
258
|
fs.writeFileSync(destination, "fixture");
|
|
259
259
|
return { size: 1 };
|
package/scripts/version.test.mjs
CHANGED
|
@@ -109,7 +109,7 @@ test("[V004] direct version entrypoints are exact and mutation-free", (t) => {
|
|
|
109
109
|
for (const args of [["scripts/version.mjs"], ["scripts/manage-installation.mjs", "--version"]]) {
|
|
110
110
|
const result = run(process.execPath, args, { HOME: home });
|
|
111
111
|
assert.equal(result.status, 0, result.stderr);
|
|
112
|
-
assert.equal(result.stdout, "opencode-agent-orchestration-kit 1.0
|
|
112
|
+
assert.equal(result.stdout, "opencode-agent-orchestration-kit 1.1.0\n");
|
|
113
113
|
assert.equal(fs.existsSync(target), false);
|
|
114
114
|
}
|
|
115
115
|
});
|
|
@@ -118,7 +118,7 @@ test("[V005] all lifecycle wrappers expose the canonical version", () => {
|
|
|
118
118
|
for (const wrapper of ["install.sh", "upgrade.sh", "doctor.sh", "uninstall.sh", "rollback.sh"]) {
|
|
119
119
|
const result = run(path.join(REPOSITORY_ROOT, wrapper), ["--version"]);
|
|
120
120
|
assert.equal(result.status, 0, `${wrapper}: ${result.stderr}`);
|
|
121
|
-
assert.equal(result.stdout, "opencode-agent-orchestration-kit 1.0
|
|
121
|
+
assert.equal(result.stdout, "opencode-agent-orchestration-kit 1.1.0\n", wrapper);
|
|
122
122
|
}
|
|
123
123
|
});
|
|
124
124
|
|
package/supply-chain.json
CHANGED
package/docs/superpowers.md
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
# Superpowers
|
|
2
|
-
|
|
3
|
-
Superpowers is not vendored in this repository.
|
|
4
|
-
|
|
5
|
-
The starter config references it through the upstream OpenCode plugin:
|
|
6
|
-
|
|
7
|
-
```json
|
|
8
|
-
{
|
|
9
|
-
"plugin": ["superpowers@git+https://github.com/obra/superpowers.git#d884ae04edebef577e82ff7c4e143debd0bbec99"]
|
|
10
|
-
}
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
The commit is the immutable identifier reviewed for upstream release `v6.1.1`.
|
|
14
|
-
When OpenCode starts, the plugin is resolved from upstream if plugin support
|
|
15
|
-
and network access are available. If you keep an existing `opencode.json`, you
|
|
16
|
-
must add this exact plugin entry yourself.
|
|
17
|
-
|
|
18
|
-
It provides workflow skills for:
|
|
19
|
-
|
|
20
|
-
- brainstorming;
|
|
21
|
-
- writing plans;
|
|
22
|
-
- executing plans;
|
|
23
|
-
- test-driven development;
|
|
24
|
-
- systematic debugging;
|
|
25
|
-
- verification before completion;
|
|
26
|
-
- requesting and receiving code review;
|
|
27
|
-
- finishing a development branch.
|
|
28
|
-
|
|
29
|
-
The kit uses Superpowers as discipline for the orchestrator, developer, and reviewer. It is not used by `designer`, which is intentionally restricted to `open-design` and `impeccable`.
|
|
30
|
-
|
|
31
|
-
Do not replace the commit with a tag-only reference. Updates follow the
|
|
32
|
-
[reviewed supply-chain checklist](supply-chain.md):
|
|
33
|
-
|
|
34
|
-
```json
|
|
35
|
-
{
|
|
36
|
-
"plugin": ["superpowers@git+https://github.com/obra/superpowers.git#d884ae04edebef577e82ff7c4e143debd0bbec99"]
|
|
37
|
-
}
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
Superpowers remains experimental. The default-config smoke proves this exact
|
|
41
|
-
starter pin loads, while the supported core smoke runs without it.
|