opencode-agent-orchestration-kit 1.0.38 → 1.0.40
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/README.md +12 -3
- package/docker/open-design/Dockerfile +3 -1
- package/docker/open-design/entrypoint.mjs +61 -0
- package/docs/docker-open-design.md +5 -0
- package/docs/models.md +1 -1
- package/docs/open-design.md +8 -0
- package/docs/performance/native-tools-benchmark.md +33 -0
- package/docs/releases/v1.0.39.md +44 -0
- package/docs/releases/v1.0.40.md +55 -0
- package/docs/sync-boundary.md +27 -0
- package/opencode/commands/loop-status.md +24 -0
- package/opencode/commands/loop.md +8 -0
- package/opencode/docs/ai/harness/agents.md +8 -0
- package/opencode/docs/ai/harness/checks.md +6 -0
- package/opencode/docs/ai/harness/commands.md +10 -0
- package/opencode/docs/ai/harness/orchestration-contracts.json +9 -1
- package/opencode/docs/ai/specs/mission-runtime.md +44 -0
- package/opencode/plugins/mission-runtime.test.mjs +46 -0
- package/opencode/plugins/mission-runtime.ts +41 -0
- package/opencode/scripts/check-harness.mjs +111 -0
- package/opencode/scripts/check-harness.test.mjs +37 -1
- package/opencode/scripts/loop-state.mjs +5 -0
- package/opencode/scripts/loop-state.test.mjs +13 -0
- package/opencode/scripts/mission-runtime-observer.d.mts +25 -0
- package/opencode/scripts/mission-runtime-observer.mjs +124 -0
- package/opencode/scripts/mission-runtime.test.mjs +97 -0
- package/opencode/scripts/mission-status.mjs +136 -0
- package/opencode/scripts/mission-status.test.mjs +196 -0
- package/opencode/scripts/project-capability-snapshot.mjs +2 -1
- package/opencode/scripts/project-capability-snapshot.test.mjs +17 -0
- package/opencode/scripts/runtime-permission-policy.mjs +72 -0
- package/opencode/scripts/runtime-permission-policy.test.mjs +89 -0
- package/opencode/tools/open-design-http.d.mts +45 -0
- package/opencode/tools/open-design-http.mjs +387 -0
- package/opencode/tools/open_design.ts +2 -103
- package/package.json +3 -3
- package/scripts/benchmark-tool-paths.mjs +226 -0
- package/scripts/benchmark-tool-paths.test.mjs +29 -0
- package/scripts/check-public-boundary.mjs +89 -0
- package/scripts/check-public-boundary.test.mjs +32 -0
- package/scripts/check.sh +17 -10
- package/scripts/install-smoke.sh +17 -0
- package/scripts/manage-installation.mjs +90 -7
- package/scripts/manage-installation.test.mjs +36 -0
- package/scripts/open-design-entrypoint.test.mjs +54 -0
- package/scripts/open-design-http.test.mjs +211 -0
- package/scripts/package-smoke.mjs +52 -3
- package/scripts/package-smoke.test.mjs +6 -6
- package/scripts/version.test.mjs +2 -2
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
parseCliArgs,
|
|
21
21
|
resolveTarget,
|
|
22
22
|
validateManifest,
|
|
23
|
+
validateReleaseProvenance,
|
|
23
24
|
validateTransaction,
|
|
24
25
|
} from "./manage-installation.mjs";
|
|
25
26
|
|
|
@@ -52,6 +53,8 @@ function capture() {
|
|
|
52
53
|
|
|
53
54
|
const HASH_A = "a".repeat(64);
|
|
54
55
|
const HASH_B = "b".repeat(64);
|
|
56
|
+
const COMMIT_A = "a".repeat(40);
|
|
57
|
+
const COMMIT_B = "b".repeat(40);
|
|
55
58
|
const REPOSITORY_ROOT = path.dirname(path.dirname(fileURLToPath(import.meta.url)));
|
|
56
59
|
|
|
57
60
|
function validManifest(overrides = {}) {
|
|
@@ -1043,6 +1046,39 @@ test("[V015] manifest digest includes kit version", () => {
|
|
|
1043
1046
|
);
|
|
1044
1047
|
});
|
|
1045
1048
|
|
|
1049
|
+
test("release provenance is optional for old state and bound to new payloads", async (t) => {
|
|
1050
|
+
const provenance = {
|
|
1051
|
+
source_commit: COMMIT_A,
|
|
1052
|
+
public_commit: COMMIT_B,
|
|
1053
|
+
kit_version: "1.0.27",
|
|
1054
|
+
payload_sha256: HASH_A,
|
|
1055
|
+
checks_result: "passed",
|
|
1056
|
+
};
|
|
1057
|
+
validateReleaseProvenance(provenance, { kitVersion: "1.0.27", payloadSha256: HASH_A });
|
|
1058
|
+
validateManifest(validManifest({ release_provenance: provenance }));
|
|
1059
|
+
assert.throws(() => validateManifest(validManifest({
|
|
1060
|
+
release_provenance: { ...provenance, payload_sha256: HASH_B },
|
|
1061
|
+
})), /payload_sha256 does not match manifest/i);
|
|
1062
|
+
assert.throws(() => validateManifest(validManifest({
|
|
1063
|
+
release_provenance: { ...provenance, checks_result: "failed" },
|
|
1064
|
+
})), /checks_result/i);
|
|
1065
|
+
|
|
1066
|
+
const { sourceRoot, targetRoot } = makeFixture(t);
|
|
1067
|
+
put(sourceRoot, "agents/lead.md", "lead\n");
|
|
1068
|
+
const result = await managerFixture(sourceRoot, {
|
|
1069
|
+
releaseProvenance: {
|
|
1070
|
+
source_commit: COMMIT_A,
|
|
1071
|
+
public_commit: COMMIT_B,
|
|
1072
|
+
checks_result: "passed",
|
|
1073
|
+
},
|
|
1074
|
+
}).run("install", { targetRoot });
|
|
1075
|
+
assert.equal(result.exitCode, 0);
|
|
1076
|
+
assert.deepEqual(result.plan.nextManifest.release_provenance, {
|
|
1077
|
+
...provenance,
|
|
1078
|
+
payload_sha256: result.plan.nextManifest.payload_sha256,
|
|
1079
|
+
});
|
|
1080
|
+
});
|
|
1081
|
+
|
|
1046
1082
|
test("[V016] a newer source version commits a manifest-only upgrade", async (t) => {
|
|
1047
1083
|
const { sourceRoot, targetRoot } = makeFixture(t);
|
|
1048
1084
|
put(sourceRoot, "agents/lead.md", "lead\n");
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import fs from "node:fs";
|
|
3
|
+
import os from "node:os";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
import { spawnSync } from "node:child_process";
|
|
6
|
+
import test from "node:test";
|
|
7
|
+
import { fileURLToPath } from "node:url";
|
|
8
|
+
|
|
9
|
+
import { daemonArguments, parsePort } from "../docker/open-design/entrypoint.mjs";
|
|
10
|
+
|
|
11
|
+
const ROOT = path.dirname(path.dirname(fileURLToPath(import.meta.url)));
|
|
12
|
+
const ENTRYPOINT = path.join(ROOT, "docker/open-design/entrypoint.mjs");
|
|
13
|
+
const DOCKERFILE = path.join(ROOT, "docker/open-design/Dockerfile");
|
|
14
|
+
|
|
15
|
+
test("[OD001] parsePort accepts decimal ports in the valid range", () => {
|
|
16
|
+
for (const [raw, expected] of [["1", 1], ["7456", 7456], ["65535", 65535], ["07456", 7456]]) {
|
|
17
|
+
assert.equal(parsePort(raw), expected, raw);
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
for (const raw of ["", "0", "65536", "7456 ", " 7456", "+7456", "7456; touch marker", "7456\n--help"]) {
|
|
22
|
+
test(`[OD002] parsePort rejects unsafe value ${JSON.stringify(raw)}`, () => {
|
|
23
|
+
assert.throws(() => parsePort(raw), /OD_PORT.*1 and 65535/);
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
test("[OD003] daemon arguments keep the port as one argument", () => {
|
|
28
|
+
assert.deepEqual(daemonArguments(parsePort("7456")), [
|
|
29
|
+
"apps/daemon/dist/cli.js",
|
|
30
|
+
"--port",
|
|
31
|
+
"7456",
|
|
32
|
+
"--no-open",
|
|
33
|
+
]);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
test("[OD004] a shell metacharacter fails before any daemon can start", () => {
|
|
37
|
+
const marker = path.join(os.tmpdir(), `open-design-entrypoint-${process.pid}-marker`);
|
|
38
|
+
const result = spawnSync(process.execPath, [ENTRYPOINT], {
|
|
39
|
+
cwd: ROOT,
|
|
40
|
+
encoding: "utf8",
|
|
41
|
+
env: { ...process.env, OD_PORT: `7456; touch ${marker}` },
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
assert.equal(result.status, 1, result.stderr);
|
|
45
|
+
assert.match(result.stderr, /OD_PORT/);
|
|
46
|
+
assert.equal(fs.existsSync(marker), false);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
test("[OD005] Docker uses an exec-form Node entrypoint without shell interpolation", () => {
|
|
50
|
+
const dockerfile = fs.readFileSync(DOCKERFILE, "utf8");
|
|
51
|
+
assert.match(dockerfile, /COPY entrypoint\.mjs \/usr\/local\/bin\/open-design-entrypoint\.mjs/);
|
|
52
|
+
assert.match(dockerfile, /ENTRYPOINT \["node", "\/usr\/local\/bin\/open-design-entrypoint\.mjs"\]/);
|
|
53
|
+
assert.doesNotMatch(dockerfile, /sh\s+-lc|\$\{OD_PORT/);
|
|
54
|
+
});
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import fs from "node:fs";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import test from "node:test";
|
|
5
|
+
import { fileURLToPath } from "node:url";
|
|
6
|
+
|
|
7
|
+
const openDesign = await import("../opencode/tools/open-design-http.mjs");
|
|
8
|
+
const { requestJson, streamOpenDesignChat } = openDesign;
|
|
9
|
+
const ROOT = path.dirname(path.dirname(fileURLToPath(import.meta.url)));
|
|
10
|
+
|
|
11
|
+
function trackedStream(chunks, state = {}) {
|
|
12
|
+
let index = 0;
|
|
13
|
+
return new ReadableStream({
|
|
14
|
+
pull(controller) {
|
|
15
|
+
if (index < chunks.length) {
|
|
16
|
+
controller.enqueue(new TextEncoder().encode(chunks[index++]));
|
|
17
|
+
} else {
|
|
18
|
+
controller.close();
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
cancel() {
|
|
22
|
+
state.cancelled = true;
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function chatResponse(chunks, state = {}) {
|
|
28
|
+
return new Response(trackedStream(chunks, state), { status: 200 });
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function options(fetchImpl, overrides = {}) {
|
|
32
|
+
return { fetchImpl, ...overrides };
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
test("Open Design exposes bounded HTTP and SSE transport helpers", () => {
|
|
36
|
+
assert.equal(typeof requestJson, "function");
|
|
37
|
+
assert.equal(typeof streamOpenDesignChat, "function");
|
|
38
|
+
});
|
|
39
|
+
|
|
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");
|
|
42
|
+
assert.match(source, /from ["']\.\/open-design-http\.mjs["']/);
|
|
43
|
+
assert.doesNotMatch(source, /await fetch\(/);
|
|
44
|
+
assert.doesNotMatch(source, /await res\.text\(/);
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
test("requestJson aborts a request that stalls before response headers", async () => {
|
|
48
|
+
await assert.rejects(
|
|
49
|
+
requestJson("http://open-design.test", "/api/health", {}, options(() => new Promise(() => {}), {
|
|
50
|
+
connectTimeoutMs: 100,
|
|
51
|
+
})),
|
|
52
|
+
/timed out while connecting/,
|
|
53
|
+
);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
test("requestJson cancels an oversized response before parsing it", async () => {
|
|
57
|
+
const state = {};
|
|
58
|
+
const response = new Response(trackedStream(["x".repeat(2_048), "x"], state), {
|
|
59
|
+
status: 200,
|
|
60
|
+
headers: { "content-length": "2048" },
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
await assert.rejects(
|
|
64
|
+
requestJson("http://open-design.test", "/api/health", {}, options(async () => response, {
|
|
65
|
+
maxJsonBytes: 1_024,
|
|
66
|
+
})),
|
|
67
|
+
/response exceeds 1024 bytes/,
|
|
68
|
+
);
|
|
69
|
+
assert.equal(state.cancelled, true);
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
test("streamOpenDesignChat parses partial CRLF-framed SSE events", async () => {
|
|
73
|
+
const chunks = [
|
|
74
|
+
"event: stdout\r\ndata: {\"chunk\":\"hel",
|
|
75
|
+
"lo\"}\r\n\r\nevent: agent\r\ndata: {\"delta\":\" world\"}\r\n\r\nevent: end\r\ndata: {\"code\":0}\r\n\r\n",
|
|
76
|
+
];
|
|
77
|
+
|
|
78
|
+
const result = await streamOpenDesignChat(
|
|
79
|
+
"http://open-design.test",
|
|
80
|
+
{ prompt: "test" },
|
|
81
|
+
options(async () => chatResponse(chunks), { maxEvents: 10 }),
|
|
82
|
+
);
|
|
83
|
+
|
|
84
|
+
assert.equal(result.stdout, "hello world");
|
|
85
|
+
assert.equal(result.stderr, "");
|
|
86
|
+
assert.equal(result.eventsCount, 3);
|
|
87
|
+
assert.deepEqual(result.end, { code: 0 });
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
test("streamOpenDesignChat keeps the tail of bounded stderr on non-zero exit", async () => {
|
|
91
|
+
const stderr = `head-marker ${"x".repeat(1_500)} tail-marker`;
|
|
92
|
+
const frames = [
|
|
93
|
+
`event: stderr\ndata: ${JSON.stringify({ chunk: stderr })}\n\n`,
|
|
94
|
+
"event: end\ndata: {\"code\":2}\n\n",
|
|
95
|
+
];
|
|
96
|
+
|
|
97
|
+
await assert.rejects(
|
|
98
|
+
streamOpenDesignChat(
|
|
99
|
+
"http://open-design.test",
|
|
100
|
+
{ prompt: "test" },
|
|
101
|
+
options(async () => chatResponse(frames)),
|
|
102
|
+
),
|
|
103
|
+
/tail-marker/,
|
|
104
|
+
);
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
test("streamOpenDesignChat cancels the reader when output exceeds its cap", async () => {
|
|
108
|
+
const state = {};
|
|
109
|
+
const frame = `event: stdout\ndata: ${JSON.stringify({ chunk: "x".repeat(1_500) })}\n\n`;
|
|
110
|
+
|
|
111
|
+
await assert.rejects(
|
|
112
|
+
streamOpenDesignChat(
|
|
113
|
+
"http://open-design.test",
|
|
114
|
+
{ prompt: "test" },
|
|
115
|
+
options(async () => chatResponse([frame, frame], state), { maxOutputBytes: 1_024 }),
|
|
116
|
+
),
|
|
117
|
+
/stdout\/stderr output exceeds 1024 bytes/,
|
|
118
|
+
);
|
|
119
|
+
assert.equal(state.cancelled, true);
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
test("streamOpenDesignChat rejects an oversized SSE body and cancels the reader", async () => {
|
|
123
|
+
const state = {};
|
|
124
|
+
const oversizedComment = `: ${"x".repeat(1_500)}\n\n`;
|
|
125
|
+
|
|
126
|
+
await assert.rejects(
|
|
127
|
+
streamOpenDesignChat(
|
|
128
|
+
"http://open-design.test",
|
|
129
|
+
{ prompt: "test" },
|
|
130
|
+
options(async () => chatResponse([oversizedComment, oversizedComment], state), {
|
|
131
|
+
maxSseBytes: 1_024,
|
|
132
|
+
}),
|
|
133
|
+
),
|
|
134
|
+
/SSE response exceeds 1024 bytes/,
|
|
135
|
+
);
|
|
136
|
+
assert.equal(state.cancelled, true);
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
test("streamOpenDesignChat rejects an excessive event count and cancels the reader", async () => {
|
|
140
|
+
const state = {};
|
|
141
|
+
const frame = "event: stdout\ndata: {\"chunk\":\"x\"}\n\n";
|
|
142
|
+
|
|
143
|
+
await assert.rejects(
|
|
144
|
+
streamOpenDesignChat(
|
|
145
|
+
"http://open-design.test",
|
|
146
|
+
{ prompt: "test" },
|
|
147
|
+
options(async () => chatResponse([frame + frame + frame, frame], state), { maxEvents: 2 }),
|
|
148
|
+
),
|
|
149
|
+
/SSE event count exceeds 2/,
|
|
150
|
+
);
|
|
151
|
+
assert.equal(state.cancelled, true);
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
test("streamOpenDesignChat cancels an idle stream deterministically", async () => {
|
|
155
|
+
const state = {};
|
|
156
|
+
const response = new Response(new ReadableStream({
|
|
157
|
+
pull() {
|
|
158
|
+
return new Promise(() => {});
|
|
159
|
+
},
|
|
160
|
+
cancel() {
|
|
161
|
+
state.cancelled = true;
|
|
162
|
+
},
|
|
163
|
+
}), { status: 200 });
|
|
164
|
+
|
|
165
|
+
await assert.rejects(
|
|
166
|
+
streamOpenDesignChat(
|
|
167
|
+
"http://open-design.test",
|
|
168
|
+
{ prompt: "test" },
|
|
169
|
+
options(async () => response, { idleTimeoutMs: 100, totalTimeoutMs: 2_000 }),
|
|
170
|
+
),
|
|
171
|
+
/timed out while reading/,
|
|
172
|
+
);
|
|
173
|
+
assert.equal(state.cancelled, true);
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
test("streamOpenDesignChat enforces the total request timeout", async () => {
|
|
177
|
+
const state = {};
|
|
178
|
+
const response = new Response(new ReadableStream({
|
|
179
|
+
pull() {
|
|
180
|
+
return new Promise(() => {});
|
|
181
|
+
},
|
|
182
|
+
cancel() {
|
|
183
|
+
state.cancelled = true;
|
|
184
|
+
},
|
|
185
|
+
}), { status: 200 });
|
|
186
|
+
|
|
187
|
+
await assert.rejects(
|
|
188
|
+
streamOpenDesignChat(
|
|
189
|
+
"http://open-design.test",
|
|
190
|
+
{ prompt: "test" },
|
|
191
|
+
options(async () => response, { idleTimeoutMs: 2_000, totalTimeoutMs: 1_000 }),
|
|
192
|
+
),
|
|
193
|
+
/Open Design request timed out$/,
|
|
194
|
+
);
|
|
195
|
+
assert.equal(state.cancelled, true);
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
test("streamOpenDesignChat cancels the reader on an agent error event", async () => {
|
|
199
|
+
const state = {};
|
|
200
|
+
const errorFrame = "event: error\ndata: {\"message\":\"upstream failed\"}\n\n";
|
|
201
|
+
|
|
202
|
+
await assert.rejects(
|
|
203
|
+
streamOpenDesignChat(
|
|
204
|
+
"http://open-design.test",
|
|
205
|
+
{ prompt: "test" },
|
|
206
|
+
options(async () => chatResponse([errorFrame, "event: stdout\ndata: {}\n\n"], state)),
|
|
207
|
+
),
|
|
208
|
+
/Open Design agent error: upstream failed/,
|
|
209
|
+
);
|
|
210
|
+
assert.equal(state.cancelled, true);
|
|
211
|
+
});
|
|
@@ -5,7 +5,7 @@ import fs from "node:fs";
|
|
|
5
5
|
import os from "node:os";
|
|
6
6
|
import path from "node:path";
|
|
7
7
|
import { spawnSync } from "node:child_process";
|
|
8
|
-
import { fileURLToPath } from "node:url";
|
|
8
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
9
9
|
|
|
10
10
|
const SCRIPT_PATH = fileURLToPath(import.meta.url);
|
|
11
11
|
const REPOSITORY_ROOT = path.dirname(path.dirname(SCRIPT_PATH));
|
|
@@ -218,7 +218,7 @@ function hashFile(file) {
|
|
|
218
218
|
};
|
|
219
219
|
}
|
|
220
220
|
|
|
221
|
-
function safeEnvironment(tempRoot) {
|
|
221
|
+
function safeEnvironment(tempRoot, extra = {}) {
|
|
222
222
|
const home = path.join(tempRoot, "home");
|
|
223
223
|
const cache = path.join(tempRoot, "npm-cache");
|
|
224
224
|
fs.mkdirSync(home);
|
|
@@ -231,6 +231,44 @@ function safeEnvironment(tempRoot) {
|
|
|
231
231
|
npm_config_userconfig: path.join(home, ".npmrc"),
|
|
232
232
|
CI: "true",
|
|
233
233
|
LANG: process.env.LANG ?? "C",
|
|
234
|
+
...extra,
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
function readGitCommit(repositoryRoot) {
|
|
239
|
+
const result = spawnSync("git", ["rev-parse", "HEAD"], {
|
|
240
|
+
cwd: repositoryRoot,
|
|
241
|
+
encoding: "utf8",
|
|
242
|
+
});
|
|
243
|
+
const commit = result.status === 0 ? result.stdout.trim() : "";
|
|
244
|
+
if (!/^[0-9a-f]{40}$/.test(commit)) throw smokeError("release provenance requires a checked-out public commit");
|
|
245
|
+
return commit;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
function readProjectionSourceCommit(repositoryRoot) {
|
|
249
|
+
let boundary;
|
|
250
|
+
try {
|
|
251
|
+
boundary = fs.readFileSync(path.join(repositoryRoot, "docs", "sync-boundary.md"), "utf8");
|
|
252
|
+
} catch {
|
|
253
|
+
throw smokeError("release provenance source commit marker is missing");
|
|
254
|
+
}
|
|
255
|
+
const match = boundary.match(/<!--\s*projection-source-commit:\s*([0-9a-f]{40})\s*-->/);
|
|
256
|
+
if (!match) throw smokeError("release provenance source commit marker is invalid");
|
|
257
|
+
return match[1];
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
function readReleaseProvenance(repositoryRoot) {
|
|
261
|
+
const sourceCommit = process.env.OAK_RELEASE_SOURCE_COMMIT ?? readProjectionSourceCommit(repositoryRoot);
|
|
262
|
+
const publicCommit = process.env.OAK_RELEASE_PUBLIC_COMMIT ?? readGitCommit(repositoryRoot);
|
|
263
|
+
const checksResult = process.env.OAK_RELEASE_CHECKS_RESULT ?? "passed";
|
|
264
|
+
if (!/^[0-9a-f]{40}$/.test(sourceCommit) || !/^[0-9a-f]{40}$/.test(publicCommit)) {
|
|
265
|
+
throw smokeError("release provenance commit identities are invalid");
|
|
266
|
+
}
|
|
267
|
+
if (checksResult !== "passed") throw smokeError("release provenance checks result must be passed");
|
|
268
|
+
return {
|
|
269
|
+
OAK_RELEASE_SOURCE_COMMIT: sourceCommit,
|
|
270
|
+
OAK_RELEASE_PUBLIC_COMMIT: publicCommit,
|
|
271
|
+
OAK_RELEASE_CHECKS_RESULT: checksResult,
|
|
234
272
|
};
|
|
235
273
|
}
|
|
236
274
|
|
|
@@ -278,6 +316,7 @@ export async function smokeTarball(options = {}) {
|
|
|
278
316
|
const run = options.run ?? ((command, args, commandOptions = {}) => runCommand(command, args, commandOptions));
|
|
279
317
|
|
|
280
318
|
const canonical = readRootPackage(repositoryRoot);
|
|
319
|
+
const releaseProvenance = readReleaseProvenance(repositoryRoot);
|
|
281
320
|
const expectedBasename = `${canonical.name}-${canonical.version}.tgz`;
|
|
282
321
|
if (basename !== expectedBasename) throw smokeError(`tarball filename must be ${expectedBasename}`);
|
|
283
322
|
|
|
@@ -308,7 +347,7 @@ export async function smokeTarball(options = {}) {
|
|
|
308
347
|
|
|
309
348
|
const extracted = path.join(temporary.root, "extracted");
|
|
310
349
|
fs.mkdirSync(extracted);
|
|
311
|
-
const environment = safeEnvironment(temporary.root);
|
|
350
|
+
const environment = safeEnvironment(temporary.root, releaseProvenance);
|
|
312
351
|
run("tar", ["-xzf", capturedTarball, "-C", extracted], { label: "archive extraction failed" });
|
|
313
352
|
|
|
314
353
|
let packed;
|
|
@@ -324,6 +363,9 @@ export async function smokeTarball(options = {}) {
|
|
|
324
363
|
const packedRoot = path.join(extracted, "package");
|
|
325
364
|
validatePackedOak({ packed, packedRoot });
|
|
326
365
|
const opencodeRoot = path.join(packedRoot, "opencode");
|
|
366
|
+
const { inventorySource } = await import(pathToFileURL(path.join(packedRoot, "scripts", "manage-installation.mjs")).href);
|
|
367
|
+
const packedPayload = inventorySource(opencodeRoot).payloadSha256;
|
|
368
|
+
environment.OAK_RELEASE_PAYLOAD_SHA256 = packedPayload;
|
|
327
369
|
run("npm", ["ci", "--ignore-scripts"], {
|
|
328
370
|
cwd: opencodeRoot,
|
|
329
371
|
env: environment,
|
|
@@ -371,6 +413,13 @@ export async function smokeTarball(options = {}) {
|
|
|
371
413
|
sha256: hashes.sha256,
|
|
372
414
|
sha1: hashes.sha1,
|
|
373
415
|
sha512: hashes.sha512,
|
|
416
|
+
release_provenance: {
|
|
417
|
+
source_commit: releaseProvenance.OAK_RELEASE_SOURCE_COMMIT,
|
|
418
|
+
public_commit: releaseProvenance.OAK_RELEASE_PUBLIC_COMMIT,
|
|
419
|
+
kit_version: canonical.version,
|
|
420
|
+
payload_sha256: packedPayload,
|
|
421
|
+
checks_result: releaseProvenance.OAK_RELEASE_CHECKS_RESULT,
|
|
422
|
+
},
|
|
374
423
|
};
|
|
375
424
|
} finally {
|
|
376
425
|
removeTempRoot(temporary.parent, temporary.root);
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
|
|
18
18
|
const ROOT = path.dirname(path.dirname(fileURLToPath(import.meta.url)));
|
|
19
19
|
const HASH = "a".repeat(64);
|
|
20
|
-
const BASENAME = "opencode-agent-orchestration-kit-1.0.
|
|
20
|
+
const BASENAME = "opencode-agent-orchestration-kit-1.0.40.tgz";
|
|
21
21
|
const REQUIRED = [
|
|
22
22
|
"package/package.json",
|
|
23
23
|
"package/supply-chain.json",
|
|
@@ -210,7 +210,7 @@ test("smokeTarball validates both archive listings before extraction", async ()
|
|
|
210
210
|
await assert.rejects(
|
|
211
211
|
smokeTarball({
|
|
212
212
|
repositoryRoot: ROOT,
|
|
213
|
-
tarball: "/public/opencode-agent-orchestration-kit-1.0.
|
|
213
|
+
tarball: "/public/opencode-agent-orchestration-kit-1.0.40.tgz",
|
|
214
214
|
captureTarball(_source, destination) {
|
|
215
215
|
fs.writeFileSync(destination, "fixture");
|
|
216
216
|
return { size: 1 };
|
|
@@ -228,7 +228,7 @@ test("smokeTarball validates both archive listings before extraction", async ()
|
|
|
228
228
|
assert.deepEqual(calls.map((call) => call.slice(0, 2)), [["tar", "-tzf"], ["tar", "-tvzf"]]);
|
|
229
229
|
});
|
|
230
230
|
|
|
231
|
-
test("the wrapper smokes a packed tarball and verifies checksum before extraction", { timeout:
|
|
231
|
+
test("the wrapper smokes a packed tarball and verifies checksum before extraction", { timeout: 300_000 }, () => {
|
|
232
232
|
const temp = fs.mkdtempSync(path.join(os.tmpdir(), "package-smoke-integration-"));
|
|
233
233
|
try {
|
|
234
234
|
const packed = spawnSync("npm", ["pack", "--json", "--pack-destination", temp], {
|
|
@@ -243,7 +243,7 @@ test("the wrapper smokes a packed tarball and verifies checksum before extractio
|
|
|
243
243
|
const direct = spawnSync("bash", ["scripts/package-smoke.sh", tarball], {
|
|
244
244
|
cwd: ROOT,
|
|
245
245
|
encoding: "utf8",
|
|
246
|
-
timeout:
|
|
246
|
+
timeout: 240_000,
|
|
247
247
|
});
|
|
248
248
|
assert.equal(direct.status, 0, direct.stderr);
|
|
249
249
|
const evidence = JSON.parse(direct.stdout);
|
|
@@ -255,7 +255,7 @@ test("the wrapper smokes a packed tarball and verifies checksum before extractio
|
|
|
255
255
|
const verified = spawnSync("bash", ["scripts/package-smoke.sh", "--checksum", checksum, tarball], {
|
|
256
256
|
cwd: ROOT,
|
|
257
257
|
encoding: "utf8",
|
|
258
|
-
timeout:
|
|
258
|
+
timeout: 240_000,
|
|
259
259
|
});
|
|
260
260
|
assert.equal(verified.status, 0, verified.stderr);
|
|
261
261
|
|
|
@@ -274,7 +274,7 @@ test("the wrapper smokes a packed tarball and verifies checksum before extractio
|
|
|
274
274
|
}
|
|
275
275
|
});
|
|
276
276
|
|
|
277
|
-
test("smokeTarball is unaffected when the original tarball changes between validation phases", { timeout:
|
|
277
|
+
test("smokeTarball is unaffected when the original tarball changes between validation phases", { timeout: 300_000 }, async () => {
|
|
278
278
|
const temp = fs.mkdtempSync(path.join(os.tmpdir(), "package-smoke-snapshot-test-"));
|
|
279
279
|
try {
|
|
280
280
|
const packed = spawnSync("npm", ["pack", "--json", "--pack-destination", temp], {
|
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.0.40\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.0.40\n", wrapper);
|
|
122
122
|
}
|
|
123
123
|
});
|
|
124
124
|
|