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,17 @@
|
|
|
1
|
+
export type OpenDesignArgPresence = "required" | "optional";
|
|
2
|
+
|
|
3
|
+
export type OpenDesignToolDefinition = {
|
|
4
|
+
readonly name: string;
|
|
5
|
+
readonly description: string;
|
|
6
|
+
readonly args: Readonly<Record<string, OpenDesignArgPresence>>;
|
|
7
|
+
execute(args: Record<string, string | undefined>): Promise<string>;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export const OPEN_DESIGN_TOOLS: readonly OpenDesignToolDefinition[];
|
|
11
|
+
|
|
12
|
+
export function openDesignJsonSchema(args: Readonly<Record<string, OpenDesignArgPresence>>): {
|
|
13
|
+
type: "object";
|
|
14
|
+
properties: Record<string, { type: "string" }>;
|
|
15
|
+
required: string[];
|
|
16
|
+
additionalProperties: false;
|
|
17
|
+
};
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
// Runtime-neutral Open Design tool definitions. OpenCode 1 wraps them in
|
|
2
|
+
// tools/open_design.ts; OpenCode 2 registers them from runtime/v2/open-design.ts.
|
|
3
|
+
import { requestJson, streamOpenDesignChat } from "./open-design-http.mjs";
|
|
4
|
+
|
|
5
|
+
function runtime() {
|
|
6
|
+
return globalThis;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
function getEnv(name) {
|
|
10
|
+
const g = runtime();
|
|
11
|
+
return g.process?.env?.[name] ?? g.Bun?.env?.[name];
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function randomId(length = 8) {
|
|
15
|
+
const g = runtime();
|
|
16
|
+
const bytes = new Uint8Array(Math.ceil(length / 2));
|
|
17
|
+
g.crypto?.getRandomValues?.(bytes);
|
|
18
|
+
|
|
19
|
+
if (bytes.some((byte) => byte !== 0)) {
|
|
20
|
+
return Array.from(bytes)
|
|
21
|
+
.map((byte) => byte.toString(16).padStart(2, "0"))
|
|
22
|
+
.join("")
|
|
23
|
+
.slice(0, length);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return `${Date.now().toString(36)}${Math.random().toString(36).slice(2)}`
|
|
27
|
+
.replace(/[^a-z0-9]/gi, "")
|
|
28
|
+
.slice(0, length);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function baseUrl(input) {
|
|
32
|
+
const raw = input || getEnv("OPEN_DESIGN_URL");
|
|
33
|
+
if (!raw) {
|
|
34
|
+
throw new Error("OPEN_DESIGN_URL is not set. Example: export OPEN_DESIGN_URL='https://open-design.example.com'");
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const url = raw.replace(/\/+$/, "");
|
|
38
|
+
if (/\/projects(?:\/|$)/.test(url)) {
|
|
39
|
+
throw new Error("OPEN_DESIGN_URL must be the Open Design base URL, not a project or file URL.");
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return url;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function safeSlug(input) {
|
|
46
|
+
return input
|
|
47
|
+
.toLowerCase()
|
|
48
|
+
.normalize("NFKD")
|
|
49
|
+
.replace(/[^\w\s-]/g, "")
|
|
50
|
+
.replace(/\s+/g, "-")
|
|
51
|
+
.replace(/-+/g, "-")
|
|
52
|
+
.replace(/^-|-$/g, "")
|
|
53
|
+
.slice(0, 80) || "open-design-project";
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function projectUrl(base, projectId) {
|
|
57
|
+
return `${base}/projects/${encodeURIComponent(projectId)}`;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function projectFileUrl(base, projectId, fileName) {
|
|
61
|
+
const safeFile = fileName.split("/").map(encodeURIComponent).join("/");
|
|
62
|
+
return `${base}/projects/${encodeURIComponent(projectId)}/files/${safeFile}`;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function rawFileUrl(base, projectId, fileName) {
|
|
66
|
+
const safeFile = fileName.split("/").map(encodeURIComponent).join("/");
|
|
67
|
+
return `${base}/api/projects/${encodeURIComponent(projectId)}/files/${safeFile}`;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function composeSystemPrompt(input) {
|
|
71
|
+
return [
|
|
72
|
+
"# Open Design Runtime",
|
|
73
|
+
"",
|
|
74
|
+
"You are a senior visual designer and frontend prototyper working inside Open Design.",
|
|
75
|
+
"Produce a high-quality, implementable artifact. Prefer writing real files, especially index.html, so the workbench can preview them.",
|
|
76
|
+
"",
|
|
77
|
+
"Rules:",
|
|
78
|
+
"- Follow the active Open Design skill.",
|
|
79
|
+
"- Follow the active design system when provided.",
|
|
80
|
+
"- Avoid generic AI-looking layouts.",
|
|
81
|
+
"- Do not invent fake metrics, testimonials, or brand assets.",
|
|
82
|
+
"- Use accessible contrast and responsive layout.",
|
|
83
|
+
"- Create complete files, not only prose.",
|
|
84
|
+
"",
|
|
85
|
+
`## Active skill: ${input.skillId}`,
|
|
86
|
+
"",
|
|
87
|
+
input.skillBody,
|
|
88
|
+
"",
|
|
89
|
+
input.designSystemBody
|
|
90
|
+
? `## Active design system: ${input.designSystemId}\n\n${input.designSystemBody}`
|
|
91
|
+
: "## Active design system\n\nNo explicit design system selected. Use a restrained, professional default.",
|
|
92
|
+
].join("\n");
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export function openDesignJsonSchema(args) {
|
|
96
|
+
return {
|
|
97
|
+
type: "object",
|
|
98
|
+
properties: Object.fromEntries(Object.keys(args).map((key) => [key, { type: "string" }])),
|
|
99
|
+
required: Object.keys(args).filter((key) => args[key] === "required"),
|
|
100
|
+
additionalProperties: false,
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export const OPEN_DESIGN_TOOLS = Object.freeze([
|
|
105
|
+
{
|
|
106
|
+
name: "health",
|
|
107
|
+
description: "Check whether the Open Design workbench is reachable.",
|
|
108
|
+
args: { baseUrl: "optional" },
|
|
109
|
+
async execute(args) {
|
|
110
|
+
const base = baseUrl(args.baseUrl);
|
|
111
|
+
const data = await requestJson(base, "/api/health");
|
|
112
|
+
return JSON.stringify({ baseUrl: base, health: data }, null, 2);
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
name: "list_agents",
|
|
117
|
+
description: "List local agent CLIs detected by Open Design.",
|
|
118
|
+
args: { baseUrl: "optional" },
|
|
119
|
+
async execute(args) {
|
|
120
|
+
const base = baseUrl(args.baseUrl);
|
|
121
|
+
const data = await requestJson(base, "/api/agents");
|
|
122
|
+
return JSON.stringify(data, null, 2);
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
name: "list_skills",
|
|
127
|
+
description: "List Open Design skills available in the workbench.",
|
|
128
|
+
args: { baseUrl: "optional" },
|
|
129
|
+
async execute(args) {
|
|
130
|
+
const base = baseUrl(args.baseUrl);
|
|
131
|
+
const data = await requestJson(base, "/api/skills");
|
|
132
|
+
return JSON.stringify(data, null, 2);
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
name: "list_design_systems",
|
|
137
|
+
description: "List Open Design design systems available in the workbench.",
|
|
138
|
+
args: { baseUrl: "optional" },
|
|
139
|
+
async execute(args) {
|
|
140
|
+
const base = baseUrl(args.baseUrl);
|
|
141
|
+
const data = await requestJson(base, "/api/design-systems");
|
|
142
|
+
return JSON.stringify(data, null, 2);
|
|
143
|
+
},
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
name: "create_project",
|
|
147
|
+
description: "Create an Open Design project and return its workbench URL without running generation.",
|
|
148
|
+
args: {
|
|
149
|
+
baseUrl: "optional",
|
|
150
|
+
name: "required",
|
|
151
|
+
prompt: "required",
|
|
152
|
+
skillId: "optional",
|
|
153
|
+
designSystemId: "optional",
|
|
154
|
+
kind: "optional",
|
|
155
|
+
fidelity: "optional",
|
|
156
|
+
},
|
|
157
|
+
async execute(args) {
|
|
158
|
+
const base = baseUrl(args.baseUrl);
|
|
159
|
+
const projectId = `${safeSlug(args.name)}-${randomId(8)}`;
|
|
160
|
+
const body = {
|
|
161
|
+
id: projectId,
|
|
162
|
+
name: args.name,
|
|
163
|
+
skillId: args.skillId ?? "web-prototype",
|
|
164
|
+
designSystemId: args.designSystemId ?? null,
|
|
165
|
+
pendingPrompt: args.prompt,
|
|
166
|
+
metadata: {
|
|
167
|
+
kind: args.kind ?? "prototype",
|
|
168
|
+
fidelity: args.fidelity ?? "high-fidelity",
|
|
169
|
+
},
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
const created = await requestJson(base, "/api/projects", { method: "POST", body: JSON.stringify(body) });
|
|
173
|
+
return JSON.stringify({ projectId, url: projectUrl(base, projectId), created }, null, 2);
|
|
174
|
+
},
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
name: "run_design",
|
|
178
|
+
description: "Create an Open Design project and run a design generation.",
|
|
179
|
+
args: {
|
|
180
|
+
baseUrl: "optional",
|
|
181
|
+
name: "required",
|
|
182
|
+
prompt: "required",
|
|
183
|
+
skillId: "required",
|
|
184
|
+
designSystemId: "optional",
|
|
185
|
+
agentId: "optional",
|
|
186
|
+
model: "optional",
|
|
187
|
+
kind: "optional",
|
|
188
|
+
fidelity: "optional",
|
|
189
|
+
},
|
|
190
|
+
async execute(args) {
|
|
191
|
+
const base = baseUrl(args.baseUrl);
|
|
192
|
+
const projectId = `${safeSlug(args.name)}-${randomId(8)}`;
|
|
193
|
+
|
|
194
|
+
await requestJson(base, "/api/projects", {
|
|
195
|
+
method: "POST",
|
|
196
|
+
body: JSON.stringify({
|
|
197
|
+
id: projectId,
|
|
198
|
+
name: args.name,
|
|
199
|
+
skillId: args.skillId,
|
|
200
|
+
designSystemId: args.designSystemId ?? null,
|
|
201
|
+
pendingPrompt: args.prompt,
|
|
202
|
+
metadata: {
|
|
203
|
+
kind: args.kind ?? "prototype",
|
|
204
|
+
fidelity: args.fidelity ?? "high-fidelity",
|
|
205
|
+
},
|
|
206
|
+
}),
|
|
207
|
+
});
|
|
208
|
+
|
|
209
|
+
const skill = await requestJson(base, `/api/skills/${encodeURIComponent(args.skillId)}`);
|
|
210
|
+
const designSystem = args.designSystemId
|
|
211
|
+
? await requestJson(base, `/api/design-systems/${encodeURIComponent(args.designSystemId)}`)
|
|
212
|
+
: null;
|
|
213
|
+
|
|
214
|
+
const systemPrompt = composeSystemPrompt({
|
|
215
|
+
skillId: args.skillId,
|
|
216
|
+
skillBody: String(skill?.body ?? ""),
|
|
217
|
+
designSystemId: args.designSystemId ?? null,
|
|
218
|
+
designSystemBody: designSystem?.body ? String(designSystem.body) : null,
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
const result = await streamOpenDesignChat(base, {
|
|
222
|
+
agentId: args.agentId ?? "opencode",
|
|
223
|
+
message: args.prompt,
|
|
224
|
+
systemPrompt,
|
|
225
|
+
projectId,
|
|
226
|
+
attachments: [],
|
|
227
|
+
model: args.model ?? null,
|
|
228
|
+
reasoning: null,
|
|
229
|
+
});
|
|
230
|
+
|
|
231
|
+
const filesData = await requestJson(base, `/api/projects/${encodeURIComponent(projectId)}/files`);
|
|
232
|
+
const files = Array.isArray(filesData?.files) ? filesData.files : [];
|
|
233
|
+
|
|
234
|
+
return JSON.stringify(
|
|
235
|
+
{
|
|
236
|
+
projectId,
|
|
237
|
+
projectUrl: projectUrl(base, projectId),
|
|
238
|
+
files: files.map((file) => ({
|
|
239
|
+
name: file.name,
|
|
240
|
+
kind: file.kind,
|
|
241
|
+
size: file.size,
|
|
242
|
+
uiUrl: projectFileUrl(base, projectId, file.name),
|
|
243
|
+
rawUrl: rawFileUrl(base, projectId, file.name),
|
|
244
|
+
})),
|
|
245
|
+
outputPreview: result.stdout.slice(-4000),
|
|
246
|
+
stderrPreview: result.stderr.slice(-1000),
|
|
247
|
+
eventsCount: result.eventsCount,
|
|
248
|
+
},
|
|
249
|
+
null,
|
|
250
|
+
2,
|
|
251
|
+
);
|
|
252
|
+
},
|
|
253
|
+
},
|
|
254
|
+
]);
|
|
@@ -1,260 +1,27 @@
|
|
|
1
|
+
// oak:v1-only — OpenCode 1 discovers file-based tools here. OpenCode 2 registers
|
|
2
|
+
// the same definitions from runtime/v2/open-design.ts. Delete with the OpenCode 1 line.
|
|
1
3
|
import { tool } from "@opencode-ai/plugin"
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
.map((byte) => byte.toString(16).padStart(2, "0"))
|
|
27
|
-
.join("")
|
|
28
|
-
.slice(0, length)
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
return `${Date.now().toString(36)}${Math.random().toString(36).slice(2)}`
|
|
32
|
-
.replace(/[^a-z0-9]/gi, "")
|
|
33
|
-
.slice(0, length)
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
function baseUrl(input?: string) {
|
|
37
|
-
const raw = input || getEnv("OPEN_DESIGN_URL")
|
|
38
|
-
if (!raw) {
|
|
39
|
-
throw new Error("OPEN_DESIGN_URL is not set. Example: export OPEN_DESIGN_URL='https://open-design.example.com'")
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
const url = raw.replace(/\/+$/, "")
|
|
43
|
-
if (/\/projects(?:\/|$)/.test(url)) {
|
|
44
|
-
throw new Error("OPEN_DESIGN_URL must be the Open Design base URL, not a project or file URL.")
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
return url
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
function safeSlug(input: string) {
|
|
51
|
-
return input
|
|
52
|
-
.toLowerCase()
|
|
53
|
-
.normalize("NFKD")
|
|
54
|
-
.replace(/[^\w\s-]/g, "")
|
|
55
|
-
.replace(/\s+/g, "-")
|
|
56
|
-
.replace(/-+/g, "-")
|
|
57
|
-
.replace(/^-|-$/g, "")
|
|
58
|
-
.slice(0, 80) || "open-design-project"
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
function projectUrl(base: string, projectId: string) {
|
|
62
|
-
return `${base}/projects/${encodeURIComponent(projectId)}`
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
function projectFileUrl(base: string, projectId: string, fileName: string) {
|
|
66
|
-
const safeFile = fileName.split("/").map(encodeURIComponent).join("/")
|
|
67
|
-
return `${base}/projects/${encodeURIComponent(projectId)}/files/${safeFile}`
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
function rawFileUrl(base: string, projectId: string, fileName: string) {
|
|
71
|
-
const safeFile = fileName.split("/").map(encodeURIComponent).join("/")
|
|
72
|
-
return `${base}/api/projects/${encodeURIComponent(projectId)}/files/${safeFile}`
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
function composeSystemPrompt(input: {
|
|
76
|
-
skillId: string
|
|
77
|
-
skillBody: string
|
|
78
|
-
designSystemId?: string | null
|
|
79
|
-
designSystemBody?: string | null
|
|
80
|
-
}) {
|
|
81
|
-
return [
|
|
82
|
-
"# Open Design Runtime",
|
|
83
|
-
"",
|
|
84
|
-
"You are a senior visual designer and frontend prototyper working inside Open Design.",
|
|
85
|
-
"Produce a high-quality, implementable artifact. Prefer writing real files, especially index.html, so the workbench can preview them.",
|
|
86
|
-
"",
|
|
87
|
-
"Rules:",
|
|
88
|
-
"- Follow the active Open Design skill.",
|
|
89
|
-
"- Follow the active design system when provided.",
|
|
90
|
-
"- Avoid generic AI-looking layouts.",
|
|
91
|
-
"- Do not invent fake metrics, testimonials, or brand assets.",
|
|
92
|
-
"- Use accessible contrast and responsive layout.",
|
|
93
|
-
"- Create complete files, not only prose.",
|
|
94
|
-
"",
|
|
95
|
-
`## Active skill: ${input.skillId}`,
|
|
96
|
-
"",
|
|
97
|
-
input.skillBody,
|
|
98
|
-
"",
|
|
99
|
-
input.designSystemBody
|
|
100
|
-
? `## Active design system: ${input.designSystemId}\n\n${input.designSystemBody}`
|
|
101
|
-
: "## Active design system\n\nNo explicit design system selected. Use a restrained, professional default.",
|
|
102
|
-
].join("\n")
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
export const health = tool({
|
|
106
|
-
description: "Check whether the Open Design workbench is reachable.",
|
|
107
|
-
args: {
|
|
108
|
-
baseUrl: tool.schema.string().optional(),
|
|
109
|
-
},
|
|
110
|
-
async execute(args) {
|
|
111
|
-
const base = baseUrl(args.baseUrl)
|
|
112
|
-
const data = await requestJson(base, "/api/health")
|
|
113
|
-
return JSON.stringify({ baseUrl: base, health: data }, null, 2)
|
|
114
|
-
},
|
|
115
|
-
})
|
|
116
|
-
|
|
117
|
-
export const list_agents = tool({
|
|
118
|
-
description: "List local agent CLIs detected by Open Design.",
|
|
119
|
-
args: {
|
|
120
|
-
baseUrl: tool.schema.string().optional(),
|
|
121
|
-
},
|
|
122
|
-
async execute(args) {
|
|
123
|
-
const base = baseUrl(args.baseUrl)
|
|
124
|
-
const data = await requestJson(base, "/api/agents")
|
|
125
|
-
return JSON.stringify(data, null, 2)
|
|
126
|
-
},
|
|
127
|
-
})
|
|
128
|
-
|
|
129
|
-
export const list_skills = tool({
|
|
130
|
-
description: "List Open Design skills available in the workbench.",
|
|
131
|
-
args: {
|
|
132
|
-
baseUrl: tool.schema.string().optional(),
|
|
133
|
-
},
|
|
134
|
-
async execute(args) {
|
|
135
|
-
const base = baseUrl(args.baseUrl)
|
|
136
|
-
const data = await requestJson(base, "/api/skills")
|
|
137
|
-
return JSON.stringify(data, null, 2)
|
|
138
|
-
},
|
|
139
|
-
})
|
|
140
|
-
|
|
141
|
-
export const list_design_systems = tool({
|
|
142
|
-
description: "List Open Design design systems available in the workbench.",
|
|
143
|
-
args: {
|
|
144
|
-
baseUrl: tool.schema.string().optional(),
|
|
145
|
-
},
|
|
146
|
-
async execute(args) {
|
|
147
|
-
const base = baseUrl(args.baseUrl)
|
|
148
|
-
const data = await requestJson(base, "/api/design-systems")
|
|
149
|
-
return JSON.stringify(data, null, 2)
|
|
150
|
-
},
|
|
151
|
-
})
|
|
152
|
-
|
|
153
|
-
export const create_project = tool({
|
|
154
|
-
description: "Create an Open Design project and return its workbench URL without running generation.",
|
|
155
|
-
args: {
|
|
156
|
-
baseUrl: tool.schema.string().optional(),
|
|
157
|
-
name: tool.schema.string(),
|
|
158
|
-
prompt: tool.schema.string(),
|
|
159
|
-
skillId: tool.schema.string().optional(),
|
|
160
|
-
designSystemId: tool.schema.string().optional(),
|
|
161
|
-
kind: tool.schema.string().optional(),
|
|
162
|
-
fidelity: tool.schema.string().optional(),
|
|
163
|
-
},
|
|
164
|
-
async execute(args) {
|
|
165
|
-
const base = baseUrl(args.baseUrl)
|
|
166
|
-
const projectId = `${safeSlug(args.name)}-${randomId(8)}`
|
|
167
|
-
const body = {
|
|
168
|
-
id: projectId,
|
|
169
|
-
name: args.name,
|
|
170
|
-
skillId: args.skillId ?? "web-prototype",
|
|
171
|
-
designSystemId: args.designSystemId ?? null,
|
|
172
|
-
pendingPrompt: args.prompt,
|
|
173
|
-
metadata: {
|
|
174
|
-
kind: args.kind ?? "prototype",
|
|
175
|
-
fidelity: args.fidelity ?? "high-fidelity",
|
|
176
|
-
},
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
const created = await requestJson(base, "/api/projects", { method: "POST", body: JSON.stringify(body) })
|
|
180
|
-
return JSON.stringify({ projectId, url: projectUrl(base, projectId), created }, null, 2)
|
|
181
|
-
},
|
|
182
|
-
})
|
|
183
|
-
|
|
184
|
-
export const run_design = tool({
|
|
185
|
-
description: "Create an Open Design project and run a design generation.",
|
|
186
|
-
args: {
|
|
187
|
-
baseUrl: tool.schema.string().optional(),
|
|
188
|
-
name: tool.schema.string(),
|
|
189
|
-
prompt: tool.schema.string(),
|
|
190
|
-
skillId: tool.schema.string(),
|
|
191
|
-
designSystemId: tool.schema.string().optional(),
|
|
192
|
-
agentId: tool.schema.string().optional(),
|
|
193
|
-
model: tool.schema.string().optional(),
|
|
194
|
-
kind: tool.schema.string().optional(),
|
|
195
|
-
fidelity: tool.schema.string().optional(),
|
|
196
|
-
},
|
|
197
|
-
async execute(args) {
|
|
198
|
-
const base = baseUrl(args.baseUrl)
|
|
199
|
-
const projectId = `${safeSlug(args.name)}-${randomId(8)}`
|
|
200
|
-
|
|
201
|
-
await requestJson(base, "/api/projects", {
|
|
202
|
-
method: "POST",
|
|
203
|
-
body: JSON.stringify({
|
|
204
|
-
id: projectId,
|
|
205
|
-
name: args.name,
|
|
206
|
-
skillId: args.skillId,
|
|
207
|
-
designSystemId: args.designSystemId ?? null,
|
|
208
|
-
pendingPrompt: args.prompt,
|
|
209
|
-
metadata: {
|
|
210
|
-
kind: args.kind ?? "prototype",
|
|
211
|
-
fidelity: args.fidelity ?? "high-fidelity",
|
|
212
|
-
},
|
|
213
|
-
}),
|
|
214
|
-
})
|
|
215
|
-
|
|
216
|
-
const skill = (await requestJson(base, `/api/skills/${encodeURIComponent(args.skillId)}`)) as any
|
|
217
|
-
const designSystem = args.designSystemId
|
|
218
|
-
? ((await requestJson(base, `/api/design-systems/${encodeURIComponent(args.designSystemId)}`)) as any)
|
|
219
|
-
: null
|
|
220
|
-
|
|
221
|
-
const systemPrompt = composeSystemPrompt({
|
|
222
|
-
skillId: args.skillId,
|
|
223
|
-
skillBody: String(skill?.body ?? ""),
|
|
224
|
-
designSystemId: args.designSystemId ?? null,
|
|
225
|
-
designSystemBody: designSystem?.body ? String(designSystem.body) : null,
|
|
226
|
-
})
|
|
227
|
-
|
|
228
|
-
const result = await streamOpenDesignChat(base, {
|
|
229
|
-
agentId: args.agentId ?? "opencode",
|
|
230
|
-
message: args.prompt,
|
|
231
|
-
systemPrompt,
|
|
232
|
-
projectId,
|
|
233
|
-
attachments: [],
|
|
234
|
-
model: args.model ?? null,
|
|
235
|
-
reasoning: null,
|
|
236
|
-
})
|
|
237
|
-
|
|
238
|
-
const filesData = (await requestJson(base, `/api/projects/${encodeURIComponent(projectId)}/files`)) as any
|
|
239
|
-
const files = Array.isArray(filesData?.files) ? filesData.files : []
|
|
240
|
-
|
|
241
|
-
return JSON.stringify(
|
|
242
|
-
{
|
|
243
|
-
projectId,
|
|
244
|
-
projectUrl: projectUrl(base, projectId),
|
|
245
|
-
files: files.map((file: any) => ({
|
|
246
|
-
name: file.name,
|
|
247
|
-
kind: file.kind,
|
|
248
|
-
size: file.size,
|
|
249
|
-
uiUrl: projectFileUrl(base, projectId, file.name),
|
|
250
|
-
rawUrl: rawFileUrl(base, projectId, file.name),
|
|
251
|
-
})),
|
|
252
|
-
outputPreview: result.stdout.slice(-4000),
|
|
253
|
-
stderrPreview: result.stderr.slice(-1000),
|
|
254
|
-
eventsCount: result.eventsCount,
|
|
255
|
-
},
|
|
256
|
-
null,
|
|
257
|
-
2,
|
|
258
|
-
)
|
|
259
|
-
},
|
|
260
|
-
})
|
|
4
|
+
import { OPEN_DESIGN_TOOLS } from "./open-design-tools.mjs"
|
|
5
|
+
|
|
6
|
+
function v1Tool(name: string) {
|
|
7
|
+
const definition = OPEN_DESIGN_TOOLS.find((entry) => entry.name === name)
|
|
8
|
+
if (!definition) throw new Error(`unknown Open Design tool ${name}`)
|
|
9
|
+
const args = Object.fromEntries(
|
|
10
|
+
Object.entries(definition.args).map(([key, presence]) => [
|
|
11
|
+
key,
|
|
12
|
+
presence === "optional" ? tool.schema.string().optional() : tool.schema.string(),
|
|
13
|
+
]),
|
|
14
|
+
)
|
|
15
|
+
return tool({
|
|
16
|
+
description: definition.description,
|
|
17
|
+
args,
|
|
18
|
+
execute: (input) => definition.execute(input as Record<string, string | undefined>),
|
|
19
|
+
})
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export const health = v1Tool("health")
|
|
23
|
+
export const list_agents = v1Tool("list_agents")
|
|
24
|
+
export const list_skills = v1Tool("list_skills")
|
|
25
|
+
export const list_design_systems = v1Tool("list_design_systems")
|
|
26
|
+
export const create_project = v1Tool("create_project")
|
|
27
|
+
export const run_design = v1Tool("run_design")
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-agent-orchestration-kit",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Open-source multi-agent orchestration harness for OpenCode with specialized agents, durable workflows, review gates, and reproducible software-engineering processes.",
|
|
6
6
|
"keywords": [
|
|
@@ -60,8 +60,9 @@
|
|
|
60
60
|
"check:compatibility": "node scripts/check-compatibility.mjs",
|
|
61
61
|
"check:supply-chain": "node scripts/check-supply-chain.mjs",
|
|
62
62
|
"contract-check": "bash scripts/check.sh",
|
|
63
|
-
"unit-and-script-tests": "node --test scripts/*.test.mjs opencode/scripts/*.test.mjs opencode/plugins/mission-runtime.test.mjs",
|
|
64
|
-
"typecheck": "npm --prefix opencode exec -- tsc --noEmit --jsx preserve --jsxImportSource @opentui/solid --module NodeNext --moduleResolution NodeNext --target ES2022 --strict --skipLibCheck opencode/plugins/token-tree-usage.tsx opencode/
|
|
63
|
+
"unit-and-script-tests": "node --test scripts/*.test.mjs opencode/scripts/*.test.mjs opencode/plugins/mission-runtime.test.mjs opencode/runtime/v2/*.test.mjs",
|
|
64
|
+
"typecheck": "npm --prefix opencode exec -- tsc --noEmit --jsx preserve --jsxImportSource @opentui/solid --module NodeNext --moduleResolution NodeNext --target ES2022 --strict --skipLibCheck opencode/plugins/token-tree-usage.tsx opencode/runtime/v1/shell-export-guard.ts opencode/runtime/v1/mission-runtime.ts opencode/tools/open_design.ts",
|
|
65
|
+
"typecheck:v2": "npm --prefix typecheck/v2 exec -- tsc -p typecheck/v2/tsconfig.json",
|
|
65
66
|
"dependency-audit": "npm --prefix opencode audit --omit=dev --audit-level=low",
|
|
66
67
|
"dependency-signature-audit": "npm --prefix opencode audit signatures",
|
|
67
68
|
"installation-smoke": "bash scripts/install-smoke.sh",
|
|
@@ -143,7 +143,7 @@ async function benchmarkFixture(fixture, iterations, temporaryRoot) {
|
|
|
143
143
|
const result = await createInstallationManager({
|
|
144
144
|
sourceRoot: fixture.sourceRoot,
|
|
145
145
|
repositoryRoot: fixture.root,
|
|
146
|
-
versionProvider: () => "1.0
|
|
146
|
+
versionProvider: () => "1.1.0",
|
|
147
147
|
}).run("install", { targetRoot });
|
|
148
148
|
if (result.exitCode !== 0) throw invalid(`installation benchmark failed for ${fixture.id}`);
|
|
149
149
|
} finally {
|