@nichollasf/ai-kit 1.0.1

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.
Files changed (39) hide show
  1. package/.agents/archetypes/implementer-senior.md +46 -0
  2. package/.agents/archetypes/implementer.md +46 -0
  3. package/.agents/archetypes/orchestrator.md +54 -0
  4. package/.agents/archetypes/planner.md +54 -0
  5. package/.agents/archetypes/quick.md +46 -0
  6. package/.agents/archetypes/researcher.md +46 -0
  7. package/.agents/archetypes/reviewer.md +46 -0
  8. package/.agents/catalog/catalog-v2.schema.json +1641 -0
  9. package/.agents/catalog/personal.json +370 -0
  10. package/.agents/skills/ai-kit-model-calibration/SKILL.md +57 -0
  11. package/.agents/skills/ai-kit-model-calibration/assets/scorecard.md +61 -0
  12. package/.agents/skills/ai-kit-model-calibration/references/rubric.md +41 -0
  13. package/.agents/skills/ai-kit-task-routing/SKILL.md +44 -0
  14. package/.agents/skills/ai-kit-task-routing/references/handoff.md +29 -0
  15. package/LICENSE +21 -0
  16. package/README.md +151 -0
  17. package/dist/catalog.d.ts +99 -0
  18. package/dist/catalog.js +590 -0
  19. package/dist/catalog.js.map +1 -0
  20. package/dist/cli.d.ts +10 -0
  21. package/dist/cli.js +201 -0
  22. package/dist/cli.js.map +1 -0
  23. package/dist/diagnostics.d.ts +2 -0
  24. package/dist/diagnostics.js +301 -0
  25. package/dist/diagnostics.js.map +1 -0
  26. package/dist/installer.d.ts +18 -0
  27. package/dist/installer.js +303 -0
  28. package/dist/installer.js.map +1 -0
  29. package/dist/legacy.d.ts +7 -0
  30. package/dist/legacy.js +69 -0
  31. package/dist/legacy.js.map +1 -0
  32. package/dist/manifest.d.ts +50 -0
  33. package/dist/manifest.js +223 -0
  34. package/dist/manifest.js.map +1 -0
  35. package/dist/transaction.d.ts +10 -0
  36. package/dist/transaction.js +187 -0
  37. package/dist/transaction.js.map +1 -0
  38. package/docs/architecture.md +61 -0
  39. package/package.json +62 -0
@@ -0,0 +1,590 @@
1
+ import { lstat, readFile } from "node:fs/promises";
2
+ import path from "node:path";
3
+ import { resolveOwnedPath, sha256 } from "./manifest.js";
4
+ export const ROLE_NAMES = [
5
+ "planner",
6
+ "orchestrator",
7
+ "implementer-senior",
8
+ "implementer",
9
+ "quick",
10
+ "researcher",
11
+ "reviewer",
12
+ ];
13
+ export const HARNESS_NAMES = ["codex", "claude-code", "opencode"];
14
+ export const COMPLEXITIES = ["low", "medium", "high"];
15
+ export const EFFORTS = ["low", "medium", "high", "xhigh"];
16
+ export const ROUTES = ["gpt", "claude"];
17
+ export const CATALOG_SCHEMA_PATH = ".agents/catalog/catalog-v2.schema.json";
18
+ export const BASE_CATALOG_PATH = ".agents/catalog/personal.json";
19
+ export const LOCAL_CATALOG_PATH = ".agents/catalog/local.json";
20
+ export const PROMPT_PATHS = ROLE_NAMES.map((role) => `.agents/archetypes/${role}.md`);
21
+ export const CATALOG_PATHS = [
22
+ CATALOG_SCHEMA_PATH,
23
+ BASE_CATALOG_PATH,
24
+ ...PROMPT_PATHS,
25
+ ];
26
+ export const SKILL_PATHS = [
27
+ ".agents/skills/ai-kit-model-calibration/SKILL.md",
28
+ ".agents/skills/ai-kit-model-calibration/assets/scorecard.md",
29
+ ".agents/skills/ai-kit-model-calibration/references/rubric.md",
30
+ ".agents/skills/ai-kit-task-routing/SKILL.md",
31
+ ".agents/skills/ai-kit-task-routing/references/handoff.md",
32
+ ];
33
+ export const REQUIRED_TASK_FIELDS = [
34
+ "ID",
35
+ "Objective",
36
+ "Role",
37
+ "Binding",
38
+ "Effort",
39
+ "Dependencies",
40
+ "Write Scope",
41
+ "Acceptance Criteria",
42
+ "Validation Commands",
43
+ ];
44
+ export const HANDOFF_FIELDS = [
45
+ "Objective",
46
+ "Evidence",
47
+ "Work Or Findings",
48
+ "Validation",
49
+ "Risks",
50
+ "Escalation",
51
+ ];
52
+ function object(value, label, allowed, required = allowed) {
53
+ if (value === null || typeof value !== "object" || Array.isArray(value))
54
+ throw new Error(`${label} must be an object.`);
55
+ const result = value;
56
+ for (const key of Object.keys(result))
57
+ if (!allowed.includes(key))
58
+ throw new Error(`${label} has unknown field: ${key}.`);
59
+ for (const key of required)
60
+ if (!(key in result))
61
+ throw new Error(`${label} is missing field: ${key}.`);
62
+ return result;
63
+ }
64
+ function exact(value, expected, label) {
65
+ // Object key order is not part of the JSON contract.
66
+ const canonical = (entry) => {
67
+ if (Array.isArray(entry))
68
+ return `[${entry.map(canonical).join(",")}]`;
69
+ if (entry !== null && typeof entry === "object")
70
+ return `{${Object.entries(entry)
71
+ .sort(([a], [b]) => a.localeCompare(b))
72
+ .map(([key, item]) => `${JSON.stringify(key)}:${canonical(item)}`)
73
+ .join(",")}}`;
74
+ return JSON.stringify(entry);
75
+ };
76
+ if (canonical(value) !== canonical(expected))
77
+ throw new Error(`${label} violates the catalog contract.`);
78
+ }
79
+ function string(value, label) {
80
+ if (typeof value !== "string" || value.length === 0)
81
+ throw new Error(`${label} must be a non-empty string.`);
82
+ return value;
83
+ }
84
+ export function normalizeSelection(value) {
85
+ const root = object(value, "selection", ["harnesses", "archetypes", "method", "primary"], ["harnesses", "archetypes", "method"]);
86
+ for (const [key, names] of [
87
+ ["harnesses", HARNESS_NAMES],
88
+ ["archetypes", ROLE_NAMES],
89
+ ]) {
90
+ const entries = root[key];
91
+ if (!Array.isArray(entries) ||
92
+ entries.length === 0 ||
93
+ entries.some((entry) => !names.includes(entry)) ||
94
+ new Set(entries).size !== entries.length)
95
+ throw new Error(`selection.${key} must contain unique supported values.`);
96
+ }
97
+ if (root.method !== "symlink" && root.method !== "copy")
98
+ throw new Error("selection.method must be symlink or copy.");
99
+ if ("primary" in root &&
100
+ (typeof root.primary !== "string" ||
101
+ !value.archetypes.includes(root.primary)))
102
+ throw new Error("selection.primary must be one of the selected archetypes.");
103
+ if (orchestrationEnabled(value) &&
104
+ root.primary !== undefined &&
105
+ root.primary !== "orchestrator")
106
+ throw new Error("A full team uses Orchestrator as its primary role.");
107
+ return {
108
+ harnesses: HARNESS_NAMES.filter((name) => value.harnesses.includes(name)),
109
+ archetypes: ROLE_NAMES.filter((name) => value.archetypes.includes(name)),
110
+ method: root.method,
111
+ ...(root.primary === undefined
112
+ ? {}
113
+ : { primary: root.primary }),
114
+ };
115
+ }
116
+ export function orchestrationEnabled(selection) {
117
+ return ROLE_NAMES.every((role) => selection.archetypes.includes(role));
118
+ }
119
+ const MODEL_KEYS = [
120
+ "astra",
121
+ "sol",
122
+ "terra",
123
+ "luna",
124
+ "fable",
125
+ "opus",
126
+ "sonnet",
127
+ "haiku",
128
+ ];
129
+ const GPT_MODELS = {
130
+ planner: "astra",
131
+ orchestrator: "sol",
132
+ "implementer-senior": "sol",
133
+ implementer: "terra",
134
+ quick: "luna",
135
+ researcher: "luna",
136
+ reviewer: "sol",
137
+ };
138
+ const CLAUDE_MODELS = {
139
+ planner: "fable",
140
+ orchestrator: "opus",
141
+ "implementer-senior": "opus",
142
+ implementer: "sonnet",
143
+ quick: "haiku",
144
+ researcher: "haiku",
145
+ reviewer: "opus",
146
+ };
147
+ const ROLE_EFFORTS = {
148
+ planner: ["medium", "high", "xhigh"],
149
+ orchestrator: ["xhigh"],
150
+ "implementer-senior": ["xhigh"],
151
+ implementer: ["low", "medium", "high"],
152
+ quick: ["low", "medium"],
153
+ researcher: ["low", "medium", "high"],
154
+ reviewer: ["xhigh"],
155
+ };
156
+ export function validateCatalog(value) {
157
+ const root = object(value, "catalog", [
158
+ "schemaVersion",
159
+ "profile",
160
+ "maxConcurrency",
161
+ "roles",
162
+ "models",
163
+ "bindings",
164
+ "presets",
165
+ "taskContract",
166
+ "reviewGate",
167
+ "handoff",
168
+ ]);
169
+ exact(root.schemaVersion, 2, "schemaVersion");
170
+ exact(root.profile, "personal", "profile");
171
+ if (!Number.isInteger(root.maxConcurrency) ||
172
+ root.maxConcurrency < 1 ||
173
+ root.maxConcurrency > 4)
174
+ throw new Error("maxConcurrency must be an integer from 1 to 4.");
175
+ const roles = object(root.roles, "roles", ROLE_NAMES);
176
+ for (const role of ROLE_NAMES) {
177
+ const scopes = role === "planner"
178
+ ? [".agents/plans/**"]
179
+ : ["implementer-senior", "implementer", "quick"].includes(role)
180
+ ? ["task write scope"]
181
+ : [];
182
+ exact(roles[role], {
183
+ archetype: `.agents/archetypes/${role}.md`,
184
+ capabilities: {
185
+ read: true,
186
+ write: { enabled: scopes.length > 0, scopes },
187
+ delegate: role === "orchestrator",
188
+ review: role === "reviewer",
189
+ },
190
+ }, `roles.${role}`);
191
+ }
192
+ const models = object(root.models, "models", MODEL_KEYS);
193
+ const ids = new Set();
194
+ for (const key of MODEL_KEYS) {
195
+ const model = object(models[key], `models.${key}`, [
196
+ "family",
197
+ "id",
198
+ "harnesses",
199
+ ]);
200
+ const family = ["astra", "sol", "terra", "luna"].includes(key)
201
+ ? "gpt"
202
+ : "claude";
203
+ exact(model.family, family, `models.${key}.family`);
204
+ const id = string(model.id, `models.${key}.id`);
205
+ if (!/^[a-z][a-z0-9.-]*\d[a-z0-9.-]*$/.test(id) ||
206
+ /latest|:|\//.test(id) ||
207
+ !id.startsWith(family === "gpt" ? "gpt-" : "claude-") ||
208
+ ids.has(id))
209
+ throw new Error(`models.${key}.id must be a unique explicit versioned model ID, never latest.`);
210
+ ids.add(id);
211
+ const harness = family === "gpt" ? "codex" : "claude-code";
212
+ exact(model.harnesses, {
213
+ [harness]: id,
214
+ opencode: `${family === "gpt" ? "openai" : "anthropic"}/${id}`,
215
+ }, `models.${key}.harnesses`);
216
+ }
217
+ const bindings = object(root.bindings, "bindings", ROLE_NAMES.flatMap((role) => ROUTES.map((route) => `${role}:${route}`)));
218
+ for (const role of ROLE_NAMES)
219
+ for (const route of ROUTES) {
220
+ const model = (route === "gpt" ? GPT_MODELS : CLAUDE_MODELS)[role];
221
+ const efforts = model === "haiku" ? [] : ROLE_EFFORTS[role];
222
+ const effort = Object.fromEntries(COMPLEXITIES.flatMap((complexity, index) => efforts.length === 0
223
+ ? []
224
+ : efforts.length === 1
225
+ ? [[complexity, efforts[0]]]
226
+ : efforts[index] === undefined
227
+ ? []
228
+ : [[complexity, efforts[index]]]));
229
+ exact(bindings[`${role}:${route}`], {
230
+ archetype: role,
231
+ route,
232
+ model,
233
+ effortSupport: efforts.length > 0 ? "supported" : "unsupported",
234
+ supportedEfforts: efforts,
235
+ effort,
236
+ }, `bindings.${role}:${route}`);
237
+ }
238
+ exact(root.presets, {
239
+ codex: Object.fromEntries(ROLE_NAMES.map((role) => [role, `${role}:gpt`])),
240
+ "claude-code": Object.fromEntries(ROLE_NAMES.map((role) => [role, `${role}:claude`])),
241
+ opencode: { defaultRoute: "gpt", routes: ["gpt", "claude"] },
242
+ }, "presets");
243
+ exact(root.taskContract, {
244
+ requiredFields: REQUIRED_TASK_FIELDS,
245
+ approvalMarker: "Approved-Plan-SHA256",
246
+ digestAlgorithm: "sha256",
247
+ }, "taskContract");
248
+ exact(root.reviewGate, { requiredFor: "non-trivial", role: "reviewer", independent: true }, "reviewGate");
249
+ exact(root.handoff, HANDOFF_FIELDS, "handoff");
250
+ return structuredClone(value);
251
+ }
252
+ /** Own frontmatter is deliberately limited to two scalar keys; it is not a YAML parser. */
253
+ export function parseArchetype(content, role) {
254
+ if (content.includes("\r") || !content.startsWith("---\n"))
255
+ throw new Error(`${role}: archetype requires UTF-8/LF frontmatter.`);
256
+ const end = content.indexOf("\n---\n", 4);
257
+ if (end < 0)
258
+ throw new Error(`${role}: unterminated frontmatter.`);
259
+ const values = new Map();
260
+ for (const line of content.slice(4, end).split("\n")) {
261
+ const match = /^(description|mode): (.+)$/.exec(line);
262
+ if (!match || values.has(match[1]))
263
+ throw new Error(`${role}: unsupported or duplicate frontmatter field.`);
264
+ values.set(match[1], match[2]);
265
+ }
266
+ if (values.size !== 2 ||
267
+ values.get("mode") !== (role === "orchestrator" ? "primary" : "subagent"))
268
+ throw new Error(`${role}: invalid canonical mode.`);
269
+ let description;
270
+ try {
271
+ description = JSON.parse(values.get("description"));
272
+ }
273
+ catch {
274
+ throw new Error(`${role}: description must be a JSON quoted scalar.`);
275
+ }
276
+ string(description, `${role}.description`);
277
+ const body = content.slice(end + 5).trim() + "\n";
278
+ for (const heading of [
279
+ "Mission",
280
+ "Activation Criteria",
281
+ "Inputs",
282
+ "Deliverables",
283
+ "Allowed Actions",
284
+ "Prohibitions",
285
+ "Write Scope",
286
+ "Escalation Criteria",
287
+ "Handoff",
288
+ ])
289
+ if (!body.includes(`## ${heading}\n`))
290
+ throw new Error(`${role}: missing ${heading}.`);
291
+ if (!body.includes(HANDOFF_FIELDS.join("; ")))
292
+ throw new Error(`${role}: missing handoff contract.`);
293
+ return { description: description, body };
294
+ }
295
+ async function sourceAsset(packageRoot, assetPath) {
296
+ const parts = assetPath.split("/");
297
+ for (let i = 1; i <= parts.length; i++) {
298
+ const entry = await lstat(resolveOwnedPath(packageRoot, parts.slice(0, i).join("/")));
299
+ if (entry.isSymbolicLink() ||
300
+ (i === parts.length ? !entry.isFile() : !entry.isDirectory()))
301
+ throw new Error(`Packaged asset must have real ancestors and be a regular file: ${assetPath}`);
302
+ }
303
+ const content = await readFile(resolveOwnedPath(packageRoot, assetPath));
304
+ return { path: assetPath, kind: "file", content, sha256: sha256(content) };
305
+ }
306
+ export async function loadCatalog(packageRoot, _target) {
307
+ // Local overlays are intentionally never read or merged. The installer handles legacy conflicts.
308
+ const catalogAssets = await Promise.all(CATALOG_PATHS.map((name) => sourceAsset(packageRoot, name)));
309
+ const skillAssets = await Promise.all(SKILL_PATHS.map((name) => sourceAsset(packageRoot, name)));
310
+ const base = catalogAssets.find((asset) => asset.path === BASE_CATALOG_PATH);
311
+ const catalog = validateCatalog(JSON.parse(base.content.toString("utf8")));
312
+ const schema = JSON.parse(catalogAssets
313
+ .find((asset) => asset.path === CATALOG_SCHEMA_PATH)
314
+ .content.toString("utf8"));
315
+ if (schema.$schema !== "https://json-schema.org/draft/2020-12/schema" ||
316
+ schema.additionalProperties !== false)
317
+ throw new Error("Packaged catalog schema is invalid.");
318
+ const prompts = {};
319
+ const descriptions = {};
320
+ for (const role of ROLE_NAMES) {
321
+ const parsed = parseArchetype(catalogAssets
322
+ .find((asset) => asset.path === catalog.roles[role].archetype)
323
+ .content.toString("utf8"), role);
324
+ prompts[role] = parsed.body;
325
+ descriptions[role] = parsed.description;
326
+ }
327
+ return {
328
+ catalog,
329
+ baseChecksum: base.sha256,
330
+ catalogAssets,
331
+ skillAssets,
332
+ prompts,
333
+ descriptions,
334
+ };
335
+ }
336
+ export function getBinding(catalog, role, harness, route) {
337
+ const selected = harness === "opencode"
338
+ ? (route ?? catalog.presets.opencode.defaultRoute)
339
+ : harness === "codex"
340
+ ? "gpt"
341
+ : "claude";
342
+ if (route !== undefined && route !== selected)
343
+ throw new Error(`${harness} does not support route ${route}.`);
344
+ const binding = catalog.bindings[`${role}:${selected}`];
345
+ if (!binding || !catalog.models[binding.model]?.harnesses[harness])
346
+ throw new Error(`No compatible binding for ${harness}/${role}/${selected}.`);
347
+ return binding;
348
+ }
349
+ export function defaultEffort(binding) {
350
+ return binding.effort.medium ?? binding.effort.low ?? binding.effort.high;
351
+ }
352
+ export function profileName(catalog, role, binding, effort) {
353
+ return `${role}-${catalog.models[binding.model].id}${effort === undefined ? "" : `-${effort}`}`;
354
+ }
355
+ function asset(assetPath, content) {
356
+ const buffer = Buffer.from(content);
357
+ return {
358
+ path: assetPath,
359
+ kind: "file",
360
+ content: buffer,
361
+ sha256: sha256(buffer),
362
+ };
363
+ }
364
+ function connect(source, discoveryPath, method) {
365
+ if (method === "copy")
366
+ return { ...source, path: discoveryPath };
367
+ // Windows stores file symlinks with native separators; record those exact bytes.
368
+ const linkTarget = path.posix
369
+ .relative(path.posix.dirname(discoveryPath), source.path)
370
+ .split("/")
371
+ .join(path.sep);
372
+ return {
373
+ path: discoveryPath,
374
+ kind: "symlink",
375
+ linkTarget,
376
+ content: Buffer.from(linkTarget),
377
+ sha256: sha256(linkTarget),
378
+ };
379
+ }
380
+ function frontmatter(lines) {
381
+ return `---\n${lines.join("\n")}\n---\n\n`;
382
+ }
383
+ function boundPrompt(loaded, role, binding, effort, active) {
384
+ const route = `Fixed catalog binding ${role}:${binding.route}; model ${loaded.catalog.models[binding.model].id}; effort ${effort ?? "unsupported (omit parameter)"}. Never substitute a model or silently fall back. If this selected route is unavailable, report it and return to Orchestrator or the user.`;
385
+ const mode = !active
386
+ ? "This is an individual installation. The orchestration workflow is disabled because the full team is not installed. Do not delegate or activate the orchestration workflow."
387
+ : "Only Orchestrator may dispatch the exact model and effort profile in the approved plan. Workers must not delegate.";
388
+ return `${loaded.prompts[role]}\n${route}\n\n${mode}\n`;
389
+ }
390
+ function variants(loaded, role, harness) {
391
+ const result = [];
392
+ for (const route of harness === "opencode"
393
+ ? ROUTES
394
+ : [harness === "codex" ? "gpt" : "claude"]) {
395
+ const binding = getBinding(loaded.catalog, role, harness, route);
396
+ for (const effort of binding.effortSupport === "unsupported"
397
+ ? [undefined]
398
+ : binding.supportedEfforts)
399
+ result.push({
400
+ name: profileName(loaded.catalog, role, binding, effort),
401
+ binding,
402
+ effort,
403
+ });
404
+ if (harness === "opencode" && route === "claude")
405
+ result.push({
406
+ name: `${role}-claude`,
407
+ binding,
408
+ effort: defaultEffort(binding),
409
+ });
410
+ }
411
+ const binding = getBinding(loaded.catalog, role, harness);
412
+ result.push({ name: role, binding, effort: defaultEffort(binding) });
413
+ return result;
414
+ }
415
+ function codexProfiles(loaded, selection) {
416
+ const active = orchestrationEnabled(selection);
417
+ const rendered = [];
418
+ const registered = [];
419
+ for (const role of selection.archetypes.filter((name) => name !== "orchestrator"))
420
+ for (const { name, binding, effort } of variants(loaded, role, "codex")) {
421
+ const writable = ["implementer-senior", "implementer", "quick"].includes(role);
422
+ const prompt = `${boundPrompt(loaded, role, binding, effort, active)}\nHarness enforcement: this worker configuration disables delegation. ${writable ? "The workspace sandbox does not enforce the approved task path scope; that remains a behavioral rule." : "The read-only sandbox prevents filesystem mutation. Planner must return a plan artifact in its handoff for the user to save."}`;
423
+ const content = `model = ${JSON.stringify(loaded.catalog.models[binding.model].harnesses.codex)}\nmodel_reasoning_effort = ${JSON.stringify(effort)}\nsandbox_mode = ${JSON.stringify(writable ? "workspace-write" : "read-only")}\ndeveloper_instructions = ${JSON.stringify(prompt)}\n\n[agents]\nenabled = false\n`;
424
+ rendered.push(asset(`.agents/generated/codex/agents/${name}.toml`, content));
425
+ registered.push({ name, role });
426
+ }
427
+ // Orchestrator is exclusively a main context. Unregistered role TOML files
428
+ // would also be auto-discovered as malformed workers by Codex doctor.
429
+ const mainRole = active
430
+ ? "orchestrator"
431
+ : (selection.primary ?? selection.archetypes[0]);
432
+ const main = getBinding(loaded.catalog, mainRole, "codex");
433
+ // Workers inherit the parent's sandbox ceiling. A read-only main context can
434
+ // prevent implementation workers from writing even with their own config.
435
+ const mainWritable = active || ["implementer-senior", "implementer", "quick"].includes(mainRole);
436
+ const dispatch = active
437
+ ? `\nDispatch only these registered workers: ${registered.map(({ name }) => name).join(", ")}. Pass the exact approved profile/model/effort. agents.enabled=false in every configured worker disables its delegation. Codex also exposes built-in agent types: the restriction to these registered profiles is behavioral, not an enforced allowlist. The main workspace-write sandbox allows implementation workers to inherit write access. Orchestrator must not edit product files: that prohibition, task write scopes and approval verification remain behavioral requirements. Initial planning occurs in a manually selected Planner main context before this workflow activates. In a partial installation, select Planner with --primary planner. Start dispatch only with a complete and actually approved plan.`
438
+ : "";
439
+ let config = `model = ${JSON.stringify(loaded.catalog.models[main.model].harnesses.codex)}\nmodel_reasoning_effort = ${JSON.stringify(defaultEffort(main))}\nsandbox_mode = ${JSON.stringify(mainWritable ? "workspace-write" : "read-only")}\ndeveloper_instructions = ${JSON.stringify(boundPrompt(loaded, mainRole, main, defaultEffort(main), active) + dispatch)}\n`;
440
+ if (selection.archetypes.includes("reviewer"))
441
+ config += `review_model = ${JSON.stringify(loaded.catalog.models[getBinding(loaded.catalog, "reviewer", "codex").model].harnesses.codex)}\n`;
442
+ config += `\n[agents]\nenabled = ${active}\nmax_concurrent_threads_per_session = ${loaded.catalog.maxConcurrency}\n`;
443
+ for (const { name, role } of registered)
444
+ config += `\n[agents.${JSON.stringify(name)}]\ndescription = ${JSON.stringify(loaded.descriptions[role])}\nconfig_file = ${JSON.stringify(`agents/${name}.toml`)}\n`;
445
+ rendered.push(asset(".agents/generated/codex/config.toml", config));
446
+ return rendered;
447
+ }
448
+ function markdownProfiles(loaded, selection, harness) {
449
+ const active = orchestrationEnabled(selection);
450
+ const primary = active
451
+ ? "orchestrator"
452
+ : (selection.primary ?? selection.archetypes[0]);
453
+ const rendered = [];
454
+ const profiles = selection.archetypes.flatMap((role) => variants(loaded, role, harness).map((variant) => ({ role, ...variant })));
455
+ const workers = profiles
456
+ .filter(({ role }) => role !== "orchestrator")
457
+ .map(({ name }) => name);
458
+ for (const { role, name, binding, effort } of profiles) {
459
+ const delegating = active && role === "orchestrator";
460
+ const writable = ["implementer-senior", "implementer", "quick"].includes(role);
461
+ let fields;
462
+ if (harness === "claude-code") {
463
+ const tools = [
464
+ "Read",
465
+ "Glob",
466
+ "Grep",
467
+ ...(writable ? ["Edit", "Write", "Bash"] : []),
468
+ ...(role === "planner" ? ["Write", "Edit"] : []),
469
+ ...(role === "researcher" ? ["WebFetch", "WebSearch"] : []),
470
+ ...(delegating ? [`Agent(${workers.join(",")})`] : []),
471
+ ];
472
+ // The comma-bearing Agent(...) expression must be one YAML list item.
473
+ fields = [
474
+ `name: ${name}`,
475
+ `description: ${JSON.stringify(loaded.descriptions[role])}`,
476
+ `model: ${JSON.stringify(loaded.catalog.models[binding.model].harnesses[harness])}`,
477
+ ...(effort === undefined ? [] : [`effort: ${effort}`]),
478
+ "tools:",
479
+ ...tools.map((tool) => ` - ${JSON.stringify(tool)}`),
480
+ "disallowedTools:",
481
+ ...(!delegating ? [' - "Agent"', ' - "Task"'] : []),
482
+ ...(!writable ? [' - "Bash"', ' - "NotebookEdit"'] : []),
483
+ ...(!writable && role !== "planner"
484
+ ? [' - "Write"', ' - "Edit"']
485
+ : []),
486
+ ];
487
+ if (delegating)
488
+ fields.push("permissionMode: default");
489
+ }
490
+ else {
491
+ const mode = delegating
492
+ ? "primary"
493
+ : !active || role === "planner"
494
+ ? "all"
495
+ : "subagent";
496
+ fields = [
497
+ `description: ${JSON.stringify(loaded.descriptions[role])}`,
498
+ `mode: ${mode}`,
499
+ `model: ${JSON.stringify(loaded.catalog.models[binding.model].harnesses.opencode)}`,
500
+ ];
501
+ if (effort !== undefined) {
502
+ if (binding.route === "gpt")
503
+ fields.push(`reasoningEffort: ${effort}`);
504
+ else
505
+ fields.push(`effort: ${effort}`, "thinking:", " type: adaptive", " display: summarized");
506
+ }
507
+ fields.push("permission:", " external_directory: deny");
508
+ if (delegating)
509
+ fields.push(" task:", ' "*": deny', ...workers.map((worker) => ` ${JSON.stringify(worker)}: allow`));
510
+ else
511
+ fields.push(" task: deny");
512
+ if (role === "planner")
513
+ fields.push(" edit:", ' "*": deny', ' ".agents/plans/**": allow', " bash: deny");
514
+ else if (!writable)
515
+ fields.push(" edit: deny", " bash: deny");
516
+ }
517
+ let notes = harness === "claude-code"
518
+ ? "Claude tools/disallowedTools restrict the exposed tools. Task write scopes and the four-worker cap remain behavioral requirements; the Agent allowlist applies only when this profile runs as the main agent. Planner file scope is behavioral because Write/Edit are not path-scoped by this frontmatter."
519
+ : "OpenCode task permissions enforce the explicit worker allowlist and deny nested delegation. Task write scopes and the four-worker concurrency cap remain behavioral; subagent_depth limits nesting.";
520
+ if (role === "orchestrator" && !active)
521
+ notes +=
522
+ " This Orchestrator profile is dormant and has no delegation tool.";
523
+ rendered.push(asset(`.agents/generated/${harness}/agents/${name}.md`, frontmatter(fields) +
524
+ boundPrompt(loaded, role, binding, effort, active) +
525
+ `\n${notes}\n`));
526
+ }
527
+ if (harness === "claude-code")
528
+ rendered.push(asset(".agents/generated/claude-code/settings.json", JSON.stringify({
529
+ ...(primary !== undefined
530
+ ? {
531
+ agent: primary,
532
+ ...(defaultEffort(getBinding(loaded.catalog, primary, "claude-code")) === undefined
533
+ ? {}
534
+ : {
535
+ effortLevel: defaultEffort(getBinding(loaded.catalog, primary, "claude-code")),
536
+ }),
537
+ }
538
+ : {}),
539
+ env: {
540
+ CLAUDE_CODE_MAX_SUBAGENT_SPAWN_DEPTH: "1",
541
+ CLAUDE_CODE_MAX_CONCURRENT_SUBAGENTS: String(loaded.catalog.maxConcurrency),
542
+ },
543
+ }, null, 2) + "\n"));
544
+ else
545
+ rendered.push(asset(".agents/generated/opencode/opencode.json", JSON.stringify({
546
+ $schema: "https://opencode.ai/config.json",
547
+ ...(primary === undefined ? {} : { default_agent: primary }),
548
+ subagent_depth: 1,
549
+ }, null, 2) + "\n"));
550
+ return rendered;
551
+ }
552
+ export function materialize(loaded, value) {
553
+ const selection = normalizeSelection(value);
554
+ validateCatalog(loaded.catalog);
555
+ const desired = loaded.catalogAssets.filter(({ path: assetPath }) => !assetPath.startsWith(".agents/archetypes/") ||
556
+ selection.archetypes.some((role) => assetPath === loaded.catalog.roles[role].archetype));
557
+ desired.push(...loaded.skillAssets);
558
+ desired.push(asset(".agents/generated/selection.json", JSON.stringify({
559
+ ...selection,
560
+ orchestrationEnabled: orchestrationEnabled(selection),
561
+ presets: loaded.catalog.presets,
562
+ }, null, 2) + "\n"));
563
+ for (const harness of selection.harnesses) {
564
+ const rendered = harness === "codex"
565
+ ? codexProfiles(loaded, selection)
566
+ : markdownProfiles(loaded, selection, harness);
567
+ for (const source of rendered) {
568
+ const suffix = source.path.slice(`.agents/generated/${harness}/`.length);
569
+ const discovery = harness === "codex"
570
+ ? `.codex/${suffix}`
571
+ : harness === "claude-code"
572
+ ? `.claude/${suffix}`
573
+ : suffix === "opencode.json"
574
+ ? "opencode.json"
575
+ : `.opencode/${suffix}`;
576
+ desired.push(source, connect(source, discovery, selection.method));
577
+ }
578
+ if (harness === "claude-code")
579
+ for (const source of loaded.skillAssets)
580
+ desired.push(connect(source, source.path.replace(/^\.agents\//, ".claude/"), selection.method));
581
+ }
582
+ const paths = new Set();
583
+ for (const item of desired) {
584
+ if (paths.has(item.path))
585
+ throw new Error(`Duplicate materialized path: ${item.path}`);
586
+ paths.add(item.path);
587
+ }
588
+ return desired.sort((a, b) => a.path.localeCompare(b.path));
589
+ }
590
+ //# sourceMappingURL=catalog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"catalog.js","sourceRoot":"","sources":["../src/catalog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAc,MAAM,eAAe,CAAC;AAErE,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,SAAS;IACT,cAAc;IACd,oBAAoB;IACpB,aAAa;IACb,OAAO;IACP,YAAY;IACZ,UAAU;CACF,CAAC;AAEX,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,OAAO,EAAE,aAAa,EAAE,UAAU,CAAU,CAAC;AAS3E,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,KAAK,EAAE,QAAQ,EAAE,MAAM,CAAU,CAAC;AAE/D,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAU,CAAC;AAEnE,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,KAAK,EAAE,QAAQ,CAAU,CAAC;AAEjD,MAAM,CAAC,MAAM,mBAAmB,GAAG,wCAAwC,CAAC;AAC5E,MAAM,CAAC,MAAM,iBAAiB,GAAG,+BAA+B,CAAC;AACjE,MAAM,CAAC,MAAM,kBAAkB,GAAG,4BAA4B,CAAC;AAC/D,MAAM,CAAC,MAAM,YAAY,GAAG,UAAU,CAAC,GAAG,CACxC,CAAC,IAAI,EAAE,EAAE,CAAC,sBAAsB,IAAI,KAAK,CAC1C,CAAC;AACF,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,mBAAmB;IACnB,iBAAiB;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C9C,SAAS,CAAC,MAAM,CACjB,CACF,CAAC;IACR,CAAC;IACD,MAAM,KAAK,GAAG,IAAI,GAAG,EAAU,CAAC;IAChC,KAAK,MAAM,IAAI,IAAI,OAAO,EAAE,CAAC;QAC3B,IAAI,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC;YACtB,MAAM,IAAI,KAAK,CAAC,gCAAgC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;QAC/D,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACvB,CAAC;IACD,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;AAC9D,CAAC"}
package/dist/cli.d.ts ADDED
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env node
2
+ import { type CommandName, type RunOptions } from "./installer.js";
3
+ export interface CliArguments {
4
+ command: CommandName;
5
+ options: RunOptions;
6
+ yes: boolean;
7
+ help: boolean;
8
+ }
9
+ export declare function parseArguments(args: readonly string[], cwd?: string): CliArguments;
10
+ export declare function wizard(options: RunOptions, question: (prompt: string) => Promise<string>, log: (line: string) => void): Promise<RunOptions | undefined>;