agent-contracts-runtime 0.5.1 → 0.5.2
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/dist/adapters/claude-agent-sdk.d.ts +13 -5
- package/dist/adapters/claude-agent-sdk.js +36 -2
- package/dist/adapters/claude-agent-sdk.js.map +1 -1
- package/dist/adapters/cursor-sdk.d.ts +13 -6
- package/dist/adapters/cursor-sdk.js +35 -2
- package/dist/adapters/cursor-sdk.js.map +1 -1
- package/dist/{chunk-OEGPQAWA.js → chunk-TSVIMZ5N.js} +4 -2
- package/dist/chunk-TSVIMZ5N.js.map +1 -0
- package/dist/{chunk-W4BDBZYV.js → chunk-UEHOLHZV.js} +80 -2
- package/dist/chunk-UEHOLHZV.js.map +1 -0
- package/dist/cli/index.js +41 -10
- package/dist/cli/index.js.map +1 -1
- package/dist/generator/index.d.ts +4 -0
- package/dist/generator/index.js +1 -1
- package/dist/guardrail-hooks-5MSNWxnl.d.ts +59 -0
- package/dist/index.d.ts +32 -52
- package/dist/index.js +7 -1
- package/package.json +1 -1
- package/dist/chunk-OEGPQAWA.js.map +0 -1
- package/dist/chunk-W4BDBZYV.js.map +0 -1
package/dist/cli/index.js
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
buildTaskPrompt,
|
|
4
|
+
loadPlugins,
|
|
4
5
|
pluginRegistry,
|
|
5
6
|
runWorkflow
|
|
6
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-UEHOLHZV.js";
|
|
7
8
|
import {
|
|
8
9
|
checkFreshness,
|
|
9
10
|
generate,
|
|
10
11
|
loadConfig
|
|
11
|
-
} from "../chunk-
|
|
12
|
+
} from "../chunk-TSVIMZ5N.js";
|
|
12
13
|
|
|
13
14
|
// src/cli/index.ts
|
|
14
15
|
import { existsSync } from "fs";
|
|
@@ -46,7 +47,7 @@ function createProgram(handlers2, version) {
|
|
|
46
47
|
}
|
|
47
48
|
|
|
48
49
|
// src/cli/index.ts
|
|
49
|
-
var VERSION = "0.5.
|
|
50
|
+
var VERSION = "0.5.2";
|
|
50
51
|
async function loadGeneratedContracts(configPath) {
|
|
51
52
|
const config = await loadConfig(configPath);
|
|
52
53
|
const basePath = `${config.generatedDir}/index`;
|
|
@@ -61,14 +62,27 @@ async function loadGeneratedContracts(configPath) {
|
|
|
61
62
|
);
|
|
62
63
|
}
|
|
63
64
|
const mod = await import(new URL(`file://${indexPath}`).href);
|
|
65
|
+
let guardrailHooks;
|
|
66
|
+
const hooksBasePath = `${config.generatedDir}/hooks/index`;
|
|
67
|
+
const hooksPath = existsSync(`${hooksBasePath}.js`) ? `${hooksBasePath}.js` : existsSync(`${hooksBasePath}.ts`) ? `${hooksBasePath}.ts` : null;
|
|
68
|
+
if (hooksPath) {
|
|
69
|
+
try {
|
|
70
|
+
const hooksMod = await import(new URL(`file://${hooksPath}`).href);
|
|
71
|
+
if (hooksMod.guardrailHooks) {
|
|
72
|
+
guardrailHooks = hooksMod.guardrailHooks;
|
|
73
|
+
}
|
|
74
|
+
} catch {
|
|
75
|
+
}
|
|
76
|
+
}
|
|
64
77
|
return {
|
|
65
78
|
agentRegistry: mod.agentRegistry ?? mod.agents?.agentRegistry ?? {},
|
|
66
79
|
taskRegistry: mod.taskRegistry ?? mod.tasks?.taskRegistry ?? {},
|
|
67
80
|
handoffSchemas: mod.handoffSchemas ?? mod.handoffs?.handoffSchemas ?? {},
|
|
68
|
-
workflowRegistry: mod.workflowRegistry ?? mod.workflows?.workflowRegistry ?? {}
|
|
81
|
+
workflowRegistry: mod.workflowRegistry ?? mod.workflows?.workflowRegistry ?? {},
|
|
82
|
+
guardrailHooks
|
|
69
83
|
};
|
|
70
84
|
}
|
|
71
|
-
async function createAdapter(adapterName) {
|
|
85
|
+
async function createAdapter(adapterName, guardrailHooks) {
|
|
72
86
|
switch (adapterName) {
|
|
73
87
|
case "mock": {
|
|
74
88
|
const { MockAdapter } = await import("../adapters/mock.js");
|
|
@@ -76,7 +90,7 @@ async function createAdapter(adapterName) {
|
|
|
76
90
|
}
|
|
77
91
|
case "claude": {
|
|
78
92
|
const { ClaudeAgentSdkAdapter } = await import("../adapters/claude-agent-sdk.js");
|
|
79
|
-
return new ClaudeAgentSdkAdapter({});
|
|
93
|
+
return new ClaudeAgentSdkAdapter({ guardrailHooks });
|
|
80
94
|
}
|
|
81
95
|
case "cursor": {
|
|
82
96
|
const { CursorSdkAdapter } = await import("../adapters/cursor-sdk.js");
|
|
@@ -84,7 +98,7 @@ async function createAdapter(adapterName) {
|
|
|
84
98
|
if (!apiKey) {
|
|
85
99
|
throw new Error("CURSOR_API_KEY environment variable is required for the cursor adapter");
|
|
86
100
|
}
|
|
87
|
-
return CursorSdkAdapter.create({ apiKey });
|
|
101
|
+
return CursorSdkAdapter.create({ apiKey, guardrailHooks });
|
|
88
102
|
}
|
|
89
103
|
default:
|
|
90
104
|
throw new Error(`Unknown adapter: ${adapterName}. Available: mock, claude, cursor`);
|
|
@@ -145,6 +159,17 @@ var handlers = {
|
|
|
145
159
|
console.error("Generated files are stale or missing. Run `agent-runtime generate` first.");
|
|
146
160
|
process.exit(3);
|
|
147
161
|
}
|
|
162
|
+
const config = await loadConfig(configPath);
|
|
163
|
+
const pluginResult = await loadPlugins({
|
|
164
|
+
pluginPaths: config.pluginPaths.length > 0 ? config.pluginPaths : void 0,
|
|
165
|
+
projectDir: config.configDir
|
|
166
|
+
});
|
|
167
|
+
if (pluginResult.loaded > 0 && !globalOpts.quiet) {
|
|
168
|
+
console.error(`Loaded ${pluginResult.loaded} plugin(s) from ${pluginResult.files.length} file(s)`);
|
|
169
|
+
}
|
|
170
|
+
for (const err of pluginResult.errors) {
|
|
171
|
+
console.error(`Plugin load error (${err.file}): ${err.error}`);
|
|
172
|
+
}
|
|
148
173
|
let contracts;
|
|
149
174
|
try {
|
|
150
175
|
contracts = await loadGeneratedContracts(configPath);
|
|
@@ -162,13 +187,12 @@ var handlers = {
|
|
|
162
187
|
const adapterName = options.adapter ?? "mock";
|
|
163
188
|
let adapter;
|
|
164
189
|
try {
|
|
165
|
-
adapter = await createAdapter(adapterName);
|
|
190
|
+
adapter = await createAdapter(adapterName, contracts.guardrailHooks);
|
|
166
191
|
} catch (err) {
|
|
167
192
|
console.error(err.message);
|
|
168
193
|
process.exit(1);
|
|
169
194
|
return;
|
|
170
195
|
}
|
|
171
|
-
const config = await loadConfig(configPath);
|
|
172
196
|
const recovery = config.recovery;
|
|
173
197
|
const maxRetries = options.maxRetries ? parseInt(options.maxRetries, 10) : void 0;
|
|
174
198
|
const maxFollowUps = options.maxFollowUps ? parseInt(options.maxFollowUps, 10) : void 0;
|
|
@@ -287,11 +311,18 @@ var handlers = {
|
|
|
287
311
|
process.exit(1);
|
|
288
312
|
return;
|
|
289
313
|
}
|
|
314
|
+
const pluginsApplied = options.withPlugins ?? false;
|
|
315
|
+
if (pluginsApplied) {
|
|
316
|
+
const showPromptConfig = await loadConfig(configPath);
|
|
317
|
+
await loadPlugins({
|
|
318
|
+
pluginPaths: showPromptConfig.pluginPaths.length > 0 ? showPromptConfig.pluginPaths : void 0,
|
|
319
|
+
projectDir: showPromptConfig.configDir
|
|
320
|
+
});
|
|
321
|
+
}
|
|
290
322
|
const userRequest = options.userRequest ?? "(preview)";
|
|
291
323
|
let prompt = buildTaskPrompt(agent, task, { user_request: userRequest }, {
|
|
292
324
|
handoffSchemas: contracts.handoffSchemas
|
|
293
325
|
});
|
|
294
|
-
const pluginsApplied = options.withPlugins ?? false;
|
|
295
326
|
if (pluginsApplied) {
|
|
296
327
|
prompt = pluginRegistry.applyPromptEnhancers(taskId, prompt, { user_request: userRequest });
|
|
297
328
|
}
|
package/dist/cli/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/cli/index.ts","../../src/generated/cli/program.ts"],"sourcesContent":["#!/usr/bin/env node\n\n/**\n * agent-runtime CLI entry point\n *\n * Uses auto-generated program from cli-contract.yaml.\n */\n\nimport { existsSync } from \"node:fs\";\nimport { createProgram, type CommandHandlers } from \"../generated/cli/program.js\";\nimport { generate, loadConfig, checkFreshness } from \"../generator/index.js\";\nimport {\n buildTaskPrompt,\n pluginRegistry,\n runWorkflow,\n type AgentContractLike,\n type TaskContractLike,\n type SdkAdapter,\n type WorkflowContractLike,\n} from \"../index.js\";\nimport type { z } from \"zod\";\n\nconst VERSION = \"0.5.1\";\n\n/**\n * Dynamically import the generated contracts from the configured generated_dir.\n * Handles both .ts (via tsx/ts-node) and .js (compiled) files,\n * and both flat exports and namespace exports.\n */\nasync function loadGeneratedContracts(configPath: string): Promise<{\n agentRegistry: Record<string, AgentContractLike>;\n taskRegistry: Record<string, TaskContractLike>;\n handoffSchemas: Record<string, z.ZodTypeAny>;\n workflowRegistry: Record<string, WorkflowContractLike>;\n}> {\n const config = await loadConfig(configPath);\n const basePath = `${config.generatedDir}/index`;\n\n let indexPath: string;\n if (existsSync(`${basePath}.js`)) {\n indexPath = `${basePath}.js`;\n } else if (existsSync(`${basePath}.ts`)) {\n indexPath = `${basePath}.ts`;\n } else {\n throw new Error(\n `Generated index file not found at ${basePath}.{js,ts}. Run \\`agent-runtime generate\\` first.`,\n );\n }\n\n const mod = await import(new URL(`file://${indexPath}`).href);\n\n return {\n agentRegistry: mod.agentRegistry ?? mod.agents?.agentRegistry ?? {},\n taskRegistry: mod.taskRegistry ?? mod.tasks?.taskRegistry ?? {},\n handoffSchemas: mod.handoffSchemas ?? mod.handoffs?.handoffSchemas ?? {},\n workflowRegistry: mod.workflowRegistry ?? mod.workflows?.workflowRegistry ?? {},\n };\n}\n\nasync function createAdapter(adapterName: string): Promise<SdkAdapter> {\n switch (adapterName) {\n case \"mock\": {\n const { MockAdapter } = await import(\"../adapters/mock.js\");\n return new MockAdapter();\n }\n case \"claude\": {\n const { ClaudeAgentSdkAdapter } = await import(\"../adapters/claude-agent-sdk.js\");\n return new ClaudeAgentSdkAdapter({});\n }\n case \"cursor\": {\n const { CursorSdkAdapter } = await import(\"../adapters/cursor-sdk.js\");\n const apiKey = process.env.CURSOR_API_KEY;\n if (!apiKey) {\n throw new Error(\"CURSOR_API_KEY environment variable is required for the cursor adapter\");\n }\n return CursorSdkAdapter.create({ apiKey });\n }\n default:\n throw new Error(`Unknown adapter: ${adapterName}. Available: mock, claude, cursor`);\n }\n}\n\nfunction formatTable(headers: string[], rows: string[][]): string {\n const widths = headers.map((h, i) =>\n Math.max(h.length, ...rows.map((r) => (r[i] ?? \"\").length)),\n );\n const sep = widths.map((w) => \"-\".repeat(w)).join(\" \");\n const pad = (s: string, w: number) => s.padEnd(w);\n const headerLine = headers.map((h, i) => pad(h, widths[i])).join(\" \");\n const dataLines = rows.map((r) =>\n r.map((c, i) => pad(c ?? \"\", widths[i])).join(\" \"),\n );\n return [headerLine, sep, ...dataLines].join(\"\\n\");\n}\n\nconst handlers: CommandHandlers = {\n async init(options, _globalOpts) {\n console.log(\"agent-runtime init — not yet implemented\");\n console.log(\"Options:\", JSON.stringify(options));\n },\n\n async generate(options, globalOpts) {\n try {\n const configPath = (globalOpts.config as string) ?? \"./agent-runtime.config.yaml\";\n const result = await generate({\n clean: options.clean,\n check: options.check,\n templates: options.templates,\n configPath,\n });\n\n if (result.checkMode) {\n if (result.hasDifferences) {\n console.error(\"Generated files are out of date. Run `agent-runtime generate` to update.\");\n process.exit(1);\n }\n console.log(JSON.stringify({ ...result, status: \"up-to-date\" }, null, 2));\n } else {\n console.log(JSON.stringify(result, null, 2));\n }\n } catch (err) {\n console.error(\"Generate failed:\", (err as Error).message);\n process.exit(1);\n }\n },\n\n async run(workflowId, userRequest, options, globalOpts) {\n if (!workflowId) {\n console.error(\"Error: workflow-id is required\");\n process.exit(1);\n }\n if (!userRequest) {\n console.error(\"Error: user-request is required\");\n process.exit(1);\n }\n\n const configPath = (globalOpts.config as string) ?? \"./agent-runtime.config.yaml\";\n\n const fresh = await checkFreshness(configPath);\n if (!fresh) {\n console.error(\"Generated files are stale or missing. Run `agent-runtime generate` first.\");\n process.exit(3);\n }\n\n let contracts: Awaited<ReturnType<typeof loadGeneratedContracts>>;\n try {\n contracts = await loadGeneratedContracts(configPath);\n } catch (err) {\n console.error(`Failed to load generated contracts: ${(err as Error).message}`);\n process.exit(1);\n return;\n }\n\n if (!contracts.workflowRegistry[workflowId]) {\n console.error(`Unknown workflow: ${workflowId}`);\n console.error(`Available workflows: ${Object.keys(contracts.workflowRegistry).join(\", \")}`);\n process.exit(1);\n return;\n }\n\n const adapterName = (options.adapter as string) ?? \"mock\";\n let adapter: SdkAdapter;\n try {\n adapter = await createAdapter(adapterName);\n } catch (err) {\n console.error((err as Error).message);\n process.exit(1);\n return;\n }\n\n const config = await loadConfig(configPath);\n const recovery = config.recovery;\n const maxRetries = options.maxRetries\n ? parseInt(options.maxRetries, 10)\n : undefined;\n const maxFollowUps = options.maxFollowUps\n ? parseInt(options.maxFollowUps, 10)\n : undefined;\n\n const result = await runWorkflow(adapter, workflowId, {\n user_request: userRequest,\n maxRetries: maxRetries ?? recovery.max_retries,\n maxFollowUps: maxFollowUps ?? recovery.max_follow_ups,\n onGate: options.autoApproveGates\n ? async () => true\n : async (gateKind, description) => {\n console.error(`Gate \"${gateKind}\": ${description}`);\n console.error(\"Use --auto-approve-gates to auto-approve. Rejecting by default.\");\n return false;\n },\n }, {\n workflowRegistry: contracts.workflowRegistry,\n taskRegistry: contracts.taskRegistry,\n agentRegistry: contracts.agentRegistry,\n handoffSchemas: contracts.handoffSchemas,\n });\n\n console.log(JSON.stringify(result, null, 2));\n\n if (result.status !== \"completed\") {\n process.exit(1);\n }\n },\n\n async list(resource, options, globalOpts) {\n if (!resource) {\n console.error(\"Error: resource is required (workflows, tasks, agents)\");\n process.exit(1);\n }\n\n const validResources = [\"workflows\", \"tasks\", \"agents\"];\n if (!validResources.includes(resource)) {\n console.error(`Unknown resource: ${resource}`);\n console.error(`Available resources: ${validResources.join(\", \")}`);\n process.exit(1);\n return;\n }\n\n const configPath = (globalOpts.config as string) ?? \"./agent-runtime.config.yaml\";\n\n let contracts: Awaited<ReturnType<typeof loadGeneratedContracts>>;\n try {\n contracts = await loadGeneratedContracts(configPath);\n } catch (err) {\n console.error(`Failed to load generated contracts: ${(err as Error).message}`);\n console.error(\"Run `agent-runtime generate` first.\");\n process.exit(1);\n return;\n }\n\n const format = options.format ?? \"table\";\n\n if (resource === \"agents\") {\n const agents = Object.values(contracts.agentRegistry);\n if (format === \"json\") {\n console.log(JSON.stringify(agents, null, 2));\n } else {\n if (agents.length === 0) {\n console.log(\"No agents defined.\");\n return;\n }\n console.log(formatTable(\n [\"ID\", \"Role\", \"Mode\", \"Purpose\"],\n agents.map((a) => [a.id, a.role_name, a.mode, a.purpose]),\n ));\n }\n } else if (resource === \"tasks\") {\n const tasks = Object.values(contracts.taskRegistry);\n if (format === \"json\") {\n console.log(JSON.stringify(tasks, null, 2));\n } else {\n if (tasks.length === 0) {\n console.log(\"No tasks defined.\");\n return;\n }\n console.log(formatTable(\n [\"ID\", \"Agent\", \"Description\"],\n tasks.map((t) => [t.id, t.target_agent, t.description]),\n ));\n }\n } else {\n const workflows = Object.values(contracts.workflowRegistry);\n if (format === \"json\") {\n console.log(JSON.stringify(workflows, null, 2));\n } else {\n if (workflows.length === 0) {\n console.log(\"No workflows defined.\");\n return;\n }\n console.log(formatTable(\n [\"ID\", \"Steps\", \"Description\"],\n workflows.map((w) => [w.id, String(w.steps.length), w.description]),\n ));\n }\n }\n },\n\n async showPrompt(taskId, options, globalOpts) {\n if (!taskId) {\n console.error(\"Error: task-id is required\");\n process.exit(1);\n }\n\n const configPath = (globalOpts.config as string) ?? \"./agent-runtime.config.yaml\";\n\n let contracts: Awaited<ReturnType<typeof loadGeneratedContracts>>;\n try {\n contracts = await loadGeneratedContracts(configPath);\n } catch (err) {\n console.error(`Failed to load generated contracts: ${(err as Error).message}`);\n console.error(\"Run `agent-runtime generate` first.\");\n process.exit(1);\n return;\n }\n\n const task = contracts.taskRegistry[taskId];\n if (!task) {\n console.error(`Unknown task: ${taskId}`);\n console.error(`Available tasks: ${Object.keys(contracts.taskRegistry).join(\", \")}`);\n process.exit(1);\n return;\n }\n\n const agent = contracts.agentRegistry[task.target_agent];\n if (!agent) {\n console.error(`Unknown agent: ${task.target_agent} (referenced by task ${taskId})`);\n process.exit(1);\n return;\n }\n\n const userRequest = options.userRequest ?? \"(preview)\";\n let prompt = buildTaskPrompt(agent, task, { user_request: userRequest }, {\n handoffSchemas: contracts.handoffSchemas,\n });\n\n const pluginsApplied = options.withPlugins ?? false;\n if (pluginsApplied) {\n prompt = pluginRegistry.applyPromptEnhancers(taskId, prompt, { user_request: userRequest });\n }\n\n const format = options.format ?? \"markdown\";\n if (format === \"json\") {\n console.log(JSON.stringify({\n task_id: taskId,\n agent_id: task.target_agent,\n prompt,\n handoff_schema: task.result_handoff,\n plugins_applied: pluginsApplied,\n }, null, 2));\n } else {\n console.log(prompt);\n }\n },\n\n async doctor(_globalOpts) {\n console.log(\"agent-runtime doctor — not yet implemented\");\n },\n\n async replay(runDir, options, _globalOpts) {\n console.log(\"agent-runtime replay — not yet implemented\");\n console.log(`Run dir: ${runDir}`);\n console.log(\"Options:\", JSON.stringify(options));\n },\n};\n\nconst program = createProgram(handlers, VERSION);\nprogram.parse();\n","// Auto-generated by cli-contracts. Do not edit.\nimport { Command } from \"commander\";\n\nexport interface CommandHandlers {\n init: (options: { adapter?: string; output?: string; force?: boolean }, parentOpts: Record<string, unknown>) => Promise<void>;\n generate: (options: { clean?: boolean; check?: boolean; templates?: string }, parentOpts: Record<string, unknown>) => Promise<void>;\n run: (workflowId: string | undefined, userRequest: string | undefined, options: { adapter?: string; maxRetries?: string; maxFollowUps?: string; dryRun?: boolean; autoApproveGates?: boolean }, parentOpts: Record<string, unknown>) => Promise<void>;\n list: (resource: string | undefined, options: { format?: string }, parentOpts: Record<string, unknown>) => Promise<void>;\n showPrompt: (taskId: string | undefined, options: { userRequest?: string; format?: string; withPlugins?: boolean }, parentOpts: Record<string, unknown>) => Promise<void>;\n doctor: (parentOpts: Record<string, unknown>) => Promise<void>;\n replay: (runDir: string | undefined, options: { validateOnly?: boolean }, parentOpts: Record<string, unknown>) => Promise<void>;\n}\n\nexport function createProgram(\n handlers: CommandHandlers,\n version: string,\n): Command {\n const program = new Command();\n program\n .name(\"agent-runtime\")\n .version(version, \"-V, --version\")\n .description(\"CLI for agent-contracts-runtime — generate, run, and manage agent workflows.\");\n\n program.option(\"-c, --config <value>\", \"Path to agent-runtime.config.yaml.\", \"./agent-runtime.config.yaml\");\n program.option(\"-v, --verbose\", \"Enable verbose output.\", false);\n program.option(\"-q, --quiet\", \"Suppress non-error output.\", false);\n\n program\n .command(\"init\")\n .description(\"Initialize runtime scaffolding for a project.\")\n .option(\"-a, --adapter <value>\", \"Default SDK adapter to configure.\", \"mock\")\n .option(\"-o, --output <value>\", \"Output directory for generated scaffolding.\", \".\")\n .option(\"-f, --force\", \"Overwrite existing files without prompting.\", false)\n .action(async (opts, cmd) => {\n await handlers.init(opts, cmd.optsWithGlobals());\n });\n\n program\n .command(\"generate\")\n .description(\"Generate runtime contracts and hooks from DSL.\")\n .option(\"--clean\", \"Delete generated_dir before regenerating.\\nRemoves stale files that may remain from previous generations.\\n\", false)\n .option(\"--check\", \"Dry-run mode for CI. Does not write files.\\nCompares current generated output with what would be regenerated.\\nExits with code 1 if any differences are found.\\n\", false)\n .option(\"-t, --templates <value>\", \"Custom templates directory. Overrides built-in templates.\")\n .action(async (opts, cmd) => {\n await handlers.generate(opts, cmd.optsWithGlobals());\n });\n\n program\n .command(\"run\")\n .description(\"Execute a workflow.\")\n .argument(\"<workflow-id>\", \"ID of the workflow to execute (e.g. feature-implement, issue-fix).\")\n .argument(\"<user-request>\", \"Natural language description of what to do.\")\n .option(\"-a, --adapter <value>\", \"SDK adapter to use. Overrides config.\")\n .option(\"-r, --max-retries <value>\", \"Override default max retries per step.\")\n .option(\"-f, --max-follow-ups <value>\", \"Override default max follow-ups per step.\")\n .option(\"-n, --dry-run\", \"Simulate execution without calling the SDK adapter.\", false)\n .option(\"--auto-approve-gates\", \"Automatically approve all gate steps.\", false)\n .action(async (workflowId, userRequest, opts, cmd) => {\n await handlers.run(workflowId, userRequest, opts, cmd.optsWithGlobals());\n });\n\n program\n .command(\"list\")\n .description(\"List available workflows, tasks, or agents.\")\n .argument(\"<resource>\", \"Type of resource to list.\")\n .option(\"--format <value>\", \"Output format.\", \"table\")\n .action(async (resource, opts, cmd) => {\n await handlers.list(resource, opts, cmd.optsWithGlobals());\n });\n\n program\n .command(\"show-prompt\")\n .description(\"Display the generated prompt for a task.\")\n .argument(\"<task-id>\", \"ID of the task to show the prompt for (e.g. plan-and-implement, audit-tests).\")\n .option(\"-u, --user-request <value>\", \"User request text to include in the prompt preview.\", \"(preview)\")\n .option(\"--format <value>\", \"Output format.\", \"markdown\")\n .option(\"--with-plugins\", \"Apply registered plugin prompt enhancers to the output.\", false)\n .action(async (taskId, opts, cmd) => {\n await handlers.showPrompt(taskId, opts, cmd.optsWithGlobals());\n });\n\n program\n .command(\"doctor\")\n .description(\"Verify configuration, generated files, and SDK connectivity.\")\n .action(async (opts, cmd) => {\n await handlers.doctor({}, cmd.optsWithGlobals());\n });\n\n program\n .command(\"replay\")\n .description(\"Replay a past workflow execution from logs.\")\n .argument(\"<run-dir>\", \"Path to the .agent-runs/<run-id> directory.\")\n .option(\"--validate-only\", \"Only validate the run log without re-execution.\", false)\n .action(async (runDir, opts, cmd) => {\n await handlers.replay(runDir, opts, cmd.optsWithGlobals());\n });\n\n return program;\n}\n"],"mappings":";;;;;;;;;;;;;AAQA,SAAS,kBAAkB;;;ACP3B,SAAS,eAAe;AAYjB,SAAS,cACdA,WACA,SACS;AACT,QAAMC,WAAU,IAAI,QAAQ;AAC5B,EAAAA,SACG,KAAK,eAAe,EACpB,QAAQ,SAAS,eAAe,EAChC,YAAY,mFAA8E;AAE7F,EAAAA,SAAQ,OAAO,wBAAwB,sCAAsC,6BAA6B;AAC1G,EAAAA,SAAQ,O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;","names":["handlers","program"]}
|
|
1
|
+
{"version":3,"sources":["../../src/cli/index.ts","../../src/generated/cli/program.ts"],"sourcesContent":["#!/usr/bin/env node\n\n/**\n * agent-runtime CLI entry point\n *\n * Uses auto-generated program from cli-contract.yaml.\n */\n\nimport { existsSync } from \"node:fs\";\nimport { createProgram, type CommandHandlers } from \"../generated/cli/program.js\";\nimport { generate, loadConfig, checkFreshness } from \"../generator/index.js\";\nimport {\n buildTaskPrompt,\n pluginRegistry,\n runWorkflow,\n type AgentContractLike,\n type TaskContractLike,\n type SdkAdapter,\n type WorkflowContractLike,\n type GuardrailHooks,\n} from \"../index.js\";\nimport { loadPlugins } from \"../lib/plugin-loader.js\";\nimport type { z } from \"zod\";\n\nconst VERSION = \"0.5.2\";\n\n/**\n * Dynamically import the generated contracts from the configured generated_dir.\n * Handles both .ts (via tsx/ts-node) and .js (compiled) files,\n * and both flat exports and namespace exports.\n */\nasync function loadGeneratedContracts(configPath: string): Promise<{\n agentRegistry: Record<string, AgentContractLike>;\n taskRegistry: Record<string, TaskContractLike>;\n handoffSchemas: Record<string, z.ZodTypeAny>;\n workflowRegistry: Record<string, WorkflowContractLike>;\n guardrailHooks?: GuardrailHooks;\n}> {\n const config = await loadConfig(configPath);\n const basePath = `${config.generatedDir}/index`;\n\n let indexPath: string;\n if (existsSync(`${basePath}.js`)) {\n indexPath = `${basePath}.js`;\n } else if (existsSync(`${basePath}.ts`)) {\n indexPath = `${basePath}.ts`;\n } else {\n throw new Error(\n `Generated index file not found at ${basePath}.{js,ts}. Run \\`agent-runtime generate\\` first.`,\n );\n }\n\n const mod = await import(new URL(`file://${indexPath}`).href);\n\n let guardrailHooks: GuardrailHooks | undefined;\n const hooksBasePath = `${config.generatedDir}/hooks/index`;\n const hooksPath = existsSync(`${hooksBasePath}.js`)\n ? `${hooksBasePath}.js`\n : existsSync(`${hooksBasePath}.ts`)\n ? `${hooksBasePath}.ts`\n : null;\n if (hooksPath) {\n try {\n const hooksMod = await import(new URL(`file://${hooksPath}`).href);\n if (hooksMod.guardrailHooks) {\n guardrailHooks = hooksMod.guardrailHooks;\n }\n } catch {\n // Guardrail hooks not available — continue without them\n }\n }\n\n return {\n agentRegistry: mod.agentRegistry ?? mod.agents?.agentRegistry ?? {},\n taskRegistry: mod.taskRegistry ?? mod.tasks?.taskRegistry ?? {},\n handoffSchemas: mod.handoffSchemas ?? mod.handoffs?.handoffSchemas ?? {},\n workflowRegistry: mod.workflowRegistry ?? mod.workflows?.workflowRegistry ?? {},\n guardrailHooks,\n };\n}\n\nasync function createAdapter(adapterName: string, guardrailHooks?: GuardrailHooks): Promise<SdkAdapter> {\n switch (adapterName) {\n case \"mock\": {\n const { MockAdapter } = await import(\"../adapters/mock.js\");\n return new MockAdapter();\n }\n case \"claude\": {\n const { ClaudeAgentSdkAdapter } = await import(\"../adapters/claude-agent-sdk.js\");\n return new ClaudeAgentSdkAdapter({ guardrailHooks });\n }\n case \"cursor\": {\n const { CursorSdkAdapter } = await import(\"../adapters/cursor-sdk.js\");\n const apiKey = process.env.CURSOR_API_KEY;\n if (!apiKey) {\n throw new Error(\"CURSOR_API_KEY environment variable is required for the cursor adapter\");\n }\n return CursorSdkAdapter.create({ apiKey, guardrailHooks });\n }\n default:\n throw new Error(`Unknown adapter: ${adapterName}. Available: mock, claude, cursor`);\n }\n}\n\nfunction formatTable(headers: string[], rows: string[][]): string {\n const widths = headers.map((h, i) =>\n Math.max(h.length, ...rows.map((r) => (r[i] ?? \"\").length)),\n );\n const sep = widths.map((w) => \"-\".repeat(w)).join(\" \");\n const pad = (s: string, w: number) => s.padEnd(w);\n const headerLine = headers.map((h, i) => pad(h, widths[i])).join(\" \");\n const dataLines = rows.map((r) =>\n r.map((c, i) => pad(c ?? \"\", widths[i])).join(\" \"),\n );\n return [headerLine, sep, ...dataLines].join(\"\\n\");\n}\n\nconst handlers: CommandHandlers = {\n async init(options, _globalOpts) {\n console.log(\"agent-runtime init — not yet implemented\");\n console.log(\"Options:\", JSON.stringify(options));\n },\n\n async generate(options, globalOpts) {\n try {\n const configPath = (globalOpts.config as string) ?? \"./agent-runtime.config.yaml\";\n const result = await generate({\n clean: options.clean,\n check: options.check,\n templates: options.templates,\n configPath,\n });\n\n if (result.checkMode) {\n if (result.hasDifferences) {\n console.error(\"Generated files are out of date. Run `agent-runtime generate` to update.\");\n process.exit(1);\n }\n console.log(JSON.stringify({ ...result, status: \"up-to-date\" }, null, 2));\n } else {\n console.log(JSON.stringify(result, null, 2));\n }\n } catch (err) {\n console.error(\"Generate failed:\", (err as Error).message);\n process.exit(1);\n }\n },\n\n async run(workflowId, userRequest, options, globalOpts) {\n if (!workflowId) {\n console.error(\"Error: workflow-id is required\");\n process.exit(1);\n }\n if (!userRequest) {\n console.error(\"Error: user-request is required\");\n process.exit(1);\n }\n\n const configPath = (globalOpts.config as string) ?? \"./agent-runtime.config.yaml\";\n\n const fresh = await checkFreshness(configPath);\n if (!fresh) {\n console.error(\"Generated files are stale or missing. Run `agent-runtime generate` first.\");\n process.exit(3);\n }\n\n const config = await loadConfig(configPath);\n\n // Load plugins before running the workflow\n const pluginResult = await loadPlugins({\n pluginPaths: config.pluginPaths.length > 0 ? config.pluginPaths : undefined,\n projectDir: config.configDir,\n });\n if (pluginResult.loaded > 0 && !(globalOpts.quiet as boolean)) {\n console.error(`Loaded ${pluginResult.loaded} plugin(s) from ${pluginResult.files.length} file(s)`);\n }\n for (const err of pluginResult.errors) {\n console.error(`Plugin load error (${err.file}): ${err.error}`);\n }\n\n let contracts: Awaited<ReturnType<typeof loadGeneratedContracts>>;\n try {\n contracts = await loadGeneratedContracts(configPath);\n } catch (err) {\n console.error(`Failed to load generated contracts: ${(err as Error).message}`);\n process.exit(1);\n return;\n }\n\n if (!contracts.workflowRegistry[workflowId]) {\n console.error(`Unknown workflow: ${workflowId}`);\n console.error(`Available workflows: ${Object.keys(contracts.workflowRegistry).join(\", \")}`);\n process.exit(1);\n return;\n }\n\n const adapterName = (options.adapter as string) ?? \"mock\";\n let adapter: SdkAdapter;\n try {\n adapter = await createAdapter(adapterName, contracts.guardrailHooks);\n } catch (err) {\n console.error((err as Error).message);\n process.exit(1);\n return;\n }\n\n const recovery = config.recovery;\n const maxRetries = options.maxRetries\n ? parseInt(options.maxRetries, 10)\n : undefined;\n const maxFollowUps = options.maxFollowUps\n ? parseInt(options.maxFollowUps, 10)\n : undefined;\n\n const result = await runWorkflow(adapter, workflowId, {\n user_request: userRequest,\n maxRetries: maxRetries ?? recovery.max_retries,\n maxFollowUps: maxFollowUps ?? recovery.max_follow_ups,\n onGate: options.autoApproveGates\n ? async () => true\n : async (gateKind: string, description: string) => {\n console.error(`Gate \"${gateKind}\": ${description}`);\n console.error(\"Use --auto-approve-gates to auto-approve. Rejecting by default.\");\n return false;\n },\n }, {\n workflowRegistry: contracts.workflowRegistry,\n taskRegistry: contracts.taskRegistry,\n agentRegistry: contracts.agentRegistry,\n handoffSchemas: contracts.handoffSchemas,\n });\n\n console.log(JSON.stringify(result, null, 2));\n\n if (result.status !== \"completed\") {\n process.exit(1);\n }\n },\n\n async list(resource, options, globalOpts) {\n if (!resource) {\n console.error(\"Error: resource is required (workflows, tasks, agents)\");\n process.exit(1);\n }\n\n const validResources = [\"workflows\", \"tasks\", \"agents\"];\n if (!validResources.includes(resource)) {\n console.error(`Unknown resource: ${resource}`);\n console.error(`Available resources: ${validResources.join(\", \")}`);\n process.exit(1);\n return;\n }\n\n const configPath = (globalOpts.config as string) ?? \"./agent-runtime.config.yaml\";\n\n let contracts: Awaited<ReturnType<typeof loadGeneratedContracts>>;\n try {\n contracts = await loadGeneratedContracts(configPath);\n } catch (err) {\n console.error(`Failed to load generated contracts: ${(err as Error).message}`);\n console.error(\"Run `agent-runtime generate` first.\");\n process.exit(1);\n return;\n }\n\n const format = options.format ?? \"table\";\n\n if (resource === \"agents\") {\n const agents = Object.values(contracts.agentRegistry);\n if (format === \"json\") {\n console.log(JSON.stringify(agents, null, 2));\n } else {\n if (agents.length === 0) {\n console.log(\"No agents defined.\");\n return;\n }\n console.log(formatTable(\n [\"ID\", \"Role\", \"Mode\", \"Purpose\"],\n agents.map((a) => [a.id, a.role_name, a.mode, a.purpose]),\n ));\n }\n } else if (resource === \"tasks\") {\n const tasks = Object.values(contracts.taskRegistry);\n if (format === \"json\") {\n console.log(JSON.stringify(tasks, null, 2));\n } else {\n if (tasks.length === 0) {\n console.log(\"No tasks defined.\");\n return;\n }\n console.log(formatTable(\n [\"ID\", \"Agent\", \"Description\"],\n tasks.map((t) => [t.id, t.target_agent, t.description]),\n ));\n }\n } else {\n const workflows = Object.values(contracts.workflowRegistry);\n if (format === \"json\") {\n console.log(JSON.stringify(workflows, null, 2));\n } else {\n if (workflows.length === 0) {\n console.log(\"No workflows defined.\");\n return;\n }\n console.log(formatTable(\n [\"ID\", \"Steps\", \"Description\"],\n workflows.map((w) => [w.id, String(w.steps.length), w.description]),\n ));\n }\n }\n },\n\n async showPrompt(taskId, options, globalOpts) {\n if (!taskId) {\n console.error(\"Error: task-id is required\");\n process.exit(1);\n }\n\n const configPath = (globalOpts.config as string) ?? \"./agent-runtime.config.yaml\";\n\n let contracts: Awaited<ReturnType<typeof loadGeneratedContracts>>;\n try {\n contracts = await loadGeneratedContracts(configPath);\n } catch (err) {\n console.error(`Failed to load generated contracts: ${(err as Error).message}`);\n console.error(\"Run `agent-runtime generate` first.\");\n process.exit(1);\n return;\n }\n\n const task = contracts.taskRegistry[taskId];\n if (!task) {\n console.error(`Unknown task: ${taskId}`);\n console.error(`Available tasks: ${Object.keys(contracts.taskRegistry).join(\", \")}`);\n process.exit(1);\n return;\n }\n\n const agent = contracts.agentRegistry[task.target_agent];\n if (!agent) {\n console.error(`Unknown agent: ${task.target_agent} (referenced by task ${taskId})`);\n process.exit(1);\n return;\n }\n\n const pluginsApplied = options.withPlugins ?? false;\n if (pluginsApplied) {\n const showPromptConfig = await loadConfig(configPath);\n await loadPlugins({\n pluginPaths: showPromptConfig.pluginPaths.length > 0 ? showPromptConfig.pluginPaths : undefined,\n projectDir: showPromptConfig.configDir,\n });\n }\n\n const userRequest = options.userRequest ?? \"(preview)\";\n let prompt = buildTaskPrompt(agent, task, { user_request: userRequest }, {\n handoffSchemas: contracts.handoffSchemas,\n });\n\n if (pluginsApplied) {\n prompt = pluginRegistry.applyPromptEnhancers(taskId, prompt, { user_request: userRequest });\n }\n\n const format = options.format ?? \"markdown\";\n if (format === \"json\") {\n console.log(JSON.stringify({\n task_id: taskId,\n agent_id: task.target_agent,\n prompt,\n handoff_schema: task.result_handoff,\n plugins_applied: pluginsApplied,\n }, null, 2));\n } else {\n console.log(prompt);\n }\n },\n\n async doctor(_globalOpts) {\n console.log(\"agent-runtime doctor — not yet implemented\");\n },\n\n async replay(runDir, options, _globalOpts) {\n console.log(\"agent-runtime replay — not yet implemented\");\n console.log(`Run dir: ${runDir}`);\n console.log(\"Options:\", JSON.stringify(options));\n },\n};\n\nconst program = createProgram(handlers, VERSION);\nprogram.parse();\n","// Auto-generated by cli-contracts. Do not edit.\nimport { Command } from \"commander\";\n\nexport interface CommandHandlers {\n init: (options: { adapter?: string; output?: string; force?: boolean }, parentOpts: Record<string, unknown>) => Promise<void>;\n generate: (options: { clean?: boolean; check?: boolean; templates?: string }, parentOpts: Record<string, unknown>) => Promise<void>;\n run: (workflowId: string | undefined, userRequest: string | undefined, options: { adapter?: string; maxRetries?: string; maxFollowUps?: string; dryRun?: boolean; autoApproveGates?: boolean }, parentOpts: Record<string, unknown>) => Promise<void>;\n list: (resource: string | undefined, options: { format?: string }, parentOpts: Record<string, unknown>) => Promise<void>;\n showPrompt: (taskId: string | undefined, options: { userRequest?: string; format?: string; withPlugins?: boolean }, parentOpts: Record<string, unknown>) => Promise<void>;\n doctor: (parentOpts: Record<string, unknown>) => Promise<void>;\n replay: (runDir: string | undefined, options: { validateOnly?: boolean }, parentOpts: Record<string, unknown>) => Promise<void>;\n}\n\nexport function createProgram(\n handlers: CommandHandlers,\n version: string,\n): Command {\n const program = new Command();\n program\n .name(\"agent-runtime\")\n .version(version, \"-V, --version\")\n .description(\"CLI for agent-contracts-runtime — generate, run, and manage agent workflows.\");\n\n program.option(\"-c, --config <value>\", \"Path to agent-runtime.config.yaml.\", \"./agent-runtime.config.yaml\");\n program.option(\"-v, --verbose\", \"Enable verbose output.\", false);\n program.option(\"-q, --quiet\", \"Suppress non-error output.\", false);\n\n program\n .command(\"init\")\n .description(\"Initialize runtime scaffolding for a project.\")\n .option(\"-a, --adapter <value>\", \"Default SDK adapter to configure.\", \"mock\")\n .option(\"-o, --output <value>\", \"Output directory for generated scaffolding.\", \".\")\n .option(\"-f, --force\", \"Overwrite existing files without prompting.\", false)\n .action(async (opts, cmd) => {\n await handlers.init(opts, cmd.optsWithGlobals());\n });\n\n program\n .command(\"generate\")\n .description(\"Generate runtime contracts and hooks from DSL.\")\n .option(\"--clean\", \"Delete generated_dir before regenerating.\\nRemoves stale files that may remain from previous generations.\\n\", false)\n .option(\"--check\", \"Dry-run mode for CI. Does not write files.\\nCompares current generated output with what would be regenerated.\\nExits with code 1 if any differences are found.\\n\", false)\n .option(\"-t, --templates <value>\", \"Custom templates directory. Overrides built-in templates.\")\n .action(async (opts, cmd) => {\n await handlers.generate(opts, cmd.optsWithGlobals());\n });\n\n program\n .command(\"run\")\n .description(\"Execute a workflow.\")\n .argument(\"<workflow-id>\", \"ID of the workflow to execute (e.g. feature-implement, issue-fix).\")\n .argument(\"<user-request>\", \"Natural language description of what to do.\")\n .option(\"-a, --adapter <value>\", \"SDK adapter to use. Overrides config.\")\n .option(\"-r, --max-retries <value>\", \"Override default max retries per step.\")\n .option(\"-f, --max-follow-ups <value>\", \"Override default max follow-ups per step.\")\n .option(\"-n, --dry-run\", \"Simulate execution without calling the SDK adapter.\", false)\n .option(\"--auto-approve-gates\", \"Automatically approve all gate steps.\", false)\n .action(async (workflowId, userRequest, opts, cmd) => {\n await handlers.run(workflowId, userRequest, opts, cmd.optsWithGlobals());\n });\n\n program\n .command(\"list\")\n .description(\"List available workflows, tasks, or agents.\")\n .argument(\"<resource>\", \"Type of resource to list.\")\n .option(\"--format <value>\", \"Output format.\", \"table\")\n .action(async (resource, opts, cmd) => {\n await handlers.list(resource, opts, cmd.optsWithGlobals());\n });\n\n program\n .command(\"show-prompt\")\n .description(\"Display the generated prompt for a task.\")\n .argument(\"<task-id>\", \"ID of the task to show the prompt for (e.g. plan-and-implement, audit-tests).\")\n .option(\"-u, --user-request <value>\", \"User request text to include in the prompt preview.\", \"(preview)\")\n .option(\"--format <value>\", \"Output format.\", \"markdown\")\n .option(\"--with-plugins\", \"Apply registered plugin prompt enhancers to the output.\", false)\n .action(async (taskId, opts, cmd) => {\n await handlers.showPrompt(taskId, opts, cmd.optsWithGlobals());\n });\n\n program\n .command(\"doctor\")\n .description(\"Verify configuration, generated files, and SDK connectivity.\")\n .action(async (opts, cmd) => {\n await handlers.doctor({}, cmd.optsWithGlobals());\n });\n\n program\n .command(\"replay\")\n .description(\"Replay a past workflow execution from logs.\")\n .argument(\"<run-dir>\", \"Path to the .agent-runs/<run-id> directory.\")\n .option(\"--validate-only\", \"Only validate the run log without re-execution.\", false)\n .action(async (runDir, opts, cmd) => {\n await handlers.replay(runDir, opts, cmd.optsWithGlobals());\n });\n\n return program;\n}\n"],"mappings":";;;;;;;;;;;;;;AAQA,SAAS,kBAAkB;;;ACP3B,SAAS,eAAe;AAYjB,SAAS,cACdA,WACA,SACS;AACT,QAAMC,WAAU,IAAI,QAAQ;AAC5B,EAAAA,SACG,KAAK,eAAe,EACpB,QAAQ,SAAS,eAAe,EAChC,YAAY,mFAA8E;AAE7F,EAAAA,SAAQ,OAAO,wBAAwB,sCAAsC,6BAA6B;AAC1G,EAAAA,SAAQ,OAAO,iBAAiB,0BAA0B,KAAK;AAC/D,EAAAA,SAAQ,OAAO,eAAe,8BAA8B,KAAK;AAEjE,EAAAA,SACG,QAAQ,MAAM,EACd,YAAY,+CAA+C,EAC3D,OAAO,yBAAyB,qCAAqC,MAAM,EAC3E,OAAO,wBAAwB,+CAA+C,GAAG,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,OAAO,MAAM,EAAE,cAAc,YAAY,GAAG;AAAA,MACvE,gBAAgB,UAAU;AAAA,IAC5B,CAAC;AAED,QAAI,gBAAgB;AAClB,eAAS,eAAe,qBAAqB,QAAQ,QAAQ,EAAE,cAAc,YAAY,CAAC;AAAA,IAC5F;AAEA,UAAM,SAAS,QAAQ,UAAU;AACjC,QAAI,WAAW,QAAQ;AACrB,cAAQ,IAAI,KAAK,UAAU;AAAA,QACzB,SAAS;AAAA,QACT,UAAU,KAAK;AAAA,QACf;AAAA,QACA,gBAAgB,KAAK;AAAA,QACrB,iBAAiB;AAAA,MACnB,GAAG,MAAM,CAAC,CAAC;AAAA,IACb,OAAO;AACL,cAAQ,IAAI,MAAM;AAAA,IACpB;AAAA,EACF;AAAA,EAEA,MAAM,OAAO,aAAa;AACxB,YAAQ,IAAI,iDAA4C;AAAA,EAC1D;AAAA,EAEA,MAAM,OAAO,QAAQ,SAAS,aAAa;AACzC,YAAQ,IAAI,iDAA4C;AACxD,YAAQ,IAAI,YAAY,MAAM,EAAE;AAChC,YAAQ,IAAI,YAAY,KAAK,UAAU,OAAO,CAAC;AAAA,EACjD;AACF;AAEA,IAAM,UAAU,cAAc,UAAU,OAAO;AAC/C,QAAQ,MAAM;","names":["handlers","program"]}
|
|
@@ -10,6 +10,7 @@ declare const RuntimeConfigSchema: z.ZodObject<{
|
|
|
10
10
|
bindings: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
11
11
|
active_guardrail_policy: z.ZodOptional<z.ZodString>;
|
|
12
12
|
templates_dir: z.ZodOptional<z.ZodString>;
|
|
13
|
+
plugins: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
13
14
|
recovery: z.ZodDefault<z.ZodObject<{
|
|
14
15
|
max_follow_ups: z.ZodDefault<z.ZodNumber>;
|
|
15
16
|
max_retries: z.ZodDefault<z.ZodNumber>;
|
|
@@ -24,6 +25,7 @@ declare const RuntimeConfigSchema: z.ZodObject<{
|
|
|
24
25
|
dsl: string;
|
|
25
26
|
generated_dir: string;
|
|
26
27
|
bindings: string[];
|
|
28
|
+
plugins: string[];
|
|
27
29
|
recovery: {
|
|
28
30
|
max_follow_ups: number;
|
|
29
31
|
max_retries: number;
|
|
@@ -36,6 +38,7 @@ declare const RuntimeConfigSchema: z.ZodObject<{
|
|
|
36
38
|
bindings?: string[] | undefined;
|
|
37
39
|
active_guardrail_policy?: string | undefined;
|
|
38
40
|
templates_dir?: string | undefined;
|
|
41
|
+
plugins?: string[] | undefined;
|
|
39
42
|
recovery?: {
|
|
40
43
|
max_follow_ups?: number | undefined;
|
|
41
44
|
max_retries?: number | undefined;
|
|
@@ -48,6 +51,7 @@ interface ResolvedConfig extends RuntimeConfig {
|
|
|
48
51
|
generatedDir: string;
|
|
49
52
|
bindingPaths: string[];
|
|
50
53
|
templatesDir: string | undefined;
|
|
54
|
+
pluginPaths: string[];
|
|
51
55
|
}
|
|
52
56
|
declare function loadConfig(configPath: string): Promise<ResolvedConfig>;
|
|
53
57
|
|
package/dist/generator/index.js
CHANGED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SDK Guardrail Hook Bridge — generic adapter from guardrail check functions
|
|
3
|
+
* + plugin guardrails to SDK-compatible hook responses.
|
|
4
|
+
*
|
|
5
|
+
* The generated hooks/index.ts calls createGuardrailHooks() with the
|
|
6
|
+
* DSL-generated check functions. All logic lives here in the lib.
|
|
7
|
+
*/
|
|
8
|
+
interface GuardrailCheckResult {
|
|
9
|
+
guardrail_id: string;
|
|
10
|
+
passed: boolean;
|
|
11
|
+
action: "block" | "warn" | "shadow" | "info";
|
|
12
|
+
message: string;
|
|
13
|
+
}
|
|
14
|
+
interface HookResponse {
|
|
15
|
+
permission?: "deny";
|
|
16
|
+
user_message?: string;
|
|
17
|
+
agent_message?: string;
|
|
18
|
+
additionalContext?: string;
|
|
19
|
+
}
|
|
20
|
+
interface GuardrailCheckFunctions {
|
|
21
|
+
checkCommand: (command: string) => GuardrailCheckResult[];
|
|
22
|
+
checkFilePath: (filePath: string) => GuardrailCheckResult[];
|
|
23
|
+
checkContent: (filePath: string, content: string) => GuardrailCheckResult[];
|
|
24
|
+
}
|
|
25
|
+
interface HookContext {
|
|
26
|
+
command?: string;
|
|
27
|
+
filePath?: string;
|
|
28
|
+
content?: string;
|
|
29
|
+
}
|
|
30
|
+
interface GuardrailHooks {
|
|
31
|
+
beforeShellExecution: (input: {
|
|
32
|
+
command?: string;
|
|
33
|
+
}) => HookResponse;
|
|
34
|
+
preToolUse: (input: {
|
|
35
|
+
tool_name?: string;
|
|
36
|
+
tool_input?: {
|
|
37
|
+
file_path?: string;
|
|
38
|
+
path?: string;
|
|
39
|
+
};
|
|
40
|
+
}) => HookResponse;
|
|
41
|
+
afterFileEdit: (input: {
|
|
42
|
+
file_path?: string;
|
|
43
|
+
content?: string;
|
|
44
|
+
}) => HookResponse;
|
|
45
|
+
runChecks: (ctx: HookContext) => GuardrailCheckResult[];
|
|
46
|
+
}
|
|
47
|
+
declare function getBlockingViolations(results: GuardrailCheckResult[]): GuardrailCheckResult[];
|
|
48
|
+
declare function getWarnings(results: GuardrailCheckResult[]): GuardrailCheckResult[];
|
|
49
|
+
declare function hasBlockingViolation(results: GuardrailCheckResult[]): boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Create SDK hook functions from generated guardrail check functions.
|
|
52
|
+
*
|
|
53
|
+
* Merges DSL-generated checks with plugin-registered guardrails and
|
|
54
|
+
* returns hook functions in the format expected by Cursor / Claude SDKs,
|
|
55
|
+
* plus a generic runChecks() for programmatic use.
|
|
56
|
+
*/
|
|
57
|
+
declare function createGuardrailHooks(checks: GuardrailCheckFunctions): GuardrailHooks;
|
|
58
|
+
|
|
59
|
+
export { type GuardrailHooks as G, type HookContext as H, type GuardrailCheckFunctions as a, type GuardrailCheckResult as b, type HookResponse as c, createGuardrailHooks as d, getWarnings as e, getBlockingViolations as g, hasBlockingViolation as h };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { T as TaskOutcome, a as TaskContext, S as SdkAdapter, b as TaskContractLike, A as AgentContractLike, P as PromptBuilderOptions } from './task-runner-DuZwv4zJ.js';
|
|
2
2
|
export { R as RetryDecision, c as TaskRunOptions, d as TaskRunResult, e as buildRetryFollowUp, f as buildTaskPrompt, g as extractStructuredResult, r as runTask, z as zodSchemaToPromptDescription, h as zodSchemaToYamlExample } from './task-runner-DuZwv4zJ.js';
|
|
3
3
|
import { z } from 'zod';
|
|
4
|
+
export { a as GuardrailCheckFunctions, b as GuardrailCheckResult, G as GuardrailHooks, H as HookContext, c as HookResponse, d as createGuardrailHooks, g as getBlockingViolations, e as getWarnings, h as hasBlockingViolation } from './guardrail-hooks-5MSNWxnl.js';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Workflow Runner — orchestrates a DSL workflow as a sequence of task executions
|
|
@@ -155,61 +156,40 @@ declare class PluginRegistry {
|
|
|
155
156
|
declare const pluginRegistry: PluginRegistry;
|
|
156
157
|
|
|
157
158
|
/**
|
|
158
|
-
*
|
|
159
|
-
* + plugin guardrails to SDK-compatible hook responses.
|
|
159
|
+
* Plugin Loader — auto-discovers and registers user plugin files
|
|
160
160
|
*
|
|
161
|
-
*
|
|
162
|
-
*
|
|
161
|
+
* Discovery strategies (in priority order):
|
|
162
|
+
* 1. Config-based: `plugins` array in agent-runtime.config.yaml
|
|
163
|
+
* 2. Convention-based: scan `src/plugins/` for files exporting AgentPlugin
|
|
164
|
+
*
|
|
165
|
+
* Each discovered module is dynamically import()'d. Exports that satisfy the
|
|
166
|
+
* AgentPlugin interface (have an `id` string property) are registered with
|
|
167
|
+
* the pluginRegistry singleton.
|
|
163
168
|
*/
|
|
164
|
-
interface
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
permission?: "deny";
|
|
172
|
-
user_message?: string;
|
|
173
|
-
agent_message?: string;
|
|
174
|
-
additionalContext?: string;
|
|
175
|
-
}
|
|
176
|
-
interface GuardrailCheckFunctions {
|
|
177
|
-
checkCommand: (command: string) => GuardrailCheckResult[];
|
|
178
|
-
checkFilePath: (filePath: string) => GuardrailCheckResult[];
|
|
179
|
-
checkContent: (filePath: string, content: string) => GuardrailCheckResult[];
|
|
180
|
-
}
|
|
181
|
-
interface HookContext {
|
|
182
|
-
command?: string;
|
|
183
|
-
filePath?: string;
|
|
184
|
-
content?: string;
|
|
169
|
+
interface PluginLoadResult {
|
|
170
|
+
loaded: number;
|
|
171
|
+
files: string[];
|
|
172
|
+
errors: Array<{
|
|
173
|
+
file: string;
|
|
174
|
+
error: string;
|
|
175
|
+
}>;
|
|
185
176
|
}
|
|
186
|
-
interface GuardrailHooks {
|
|
187
|
-
beforeShellExecution: (input: {
|
|
188
|
-
command?: string;
|
|
189
|
-
}) => HookResponse;
|
|
190
|
-
preToolUse: (input: {
|
|
191
|
-
tool_name?: string;
|
|
192
|
-
tool_input?: {
|
|
193
|
-
file_path?: string;
|
|
194
|
-
path?: string;
|
|
195
|
-
};
|
|
196
|
-
}) => HookResponse;
|
|
197
|
-
afterFileEdit: (input: {
|
|
198
|
-
file_path?: string;
|
|
199
|
-
content?: string;
|
|
200
|
-
}) => HookResponse;
|
|
201
|
-
runChecks: (ctx: HookContext) => GuardrailCheckResult[];
|
|
202
|
-
}
|
|
203
|
-
declare function getBlockingViolations(results: GuardrailCheckResult[]): GuardrailCheckResult[];
|
|
204
|
-
declare function getWarnings(results: GuardrailCheckResult[]): GuardrailCheckResult[];
|
|
205
|
-
declare function hasBlockingViolation(results: GuardrailCheckResult[]): boolean;
|
|
206
177
|
/**
|
|
207
|
-
*
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
*
|
|
178
|
+
* Load plugins from explicit paths (config-based discovery).
|
|
179
|
+
*/
|
|
180
|
+
declare function loadPluginsFromPaths(paths: string[], baseDir: string): Promise<PluginLoadResult>;
|
|
181
|
+
/**
|
|
182
|
+
* Load plugins using convention-based directory scanning.
|
|
183
|
+
* Scans `<projectDir>/src/plugins/` by default.
|
|
184
|
+
*/
|
|
185
|
+
declare function loadPluginsFromDirectory(dir: string): Promise<PluginLoadResult>;
|
|
186
|
+
/**
|
|
187
|
+
* Auto-discover and load plugins. Uses config-based paths if provided,
|
|
188
|
+
* otherwise falls back to convention-based scanning of src/plugins/.
|
|
212
189
|
*/
|
|
213
|
-
declare function
|
|
190
|
+
declare function loadPlugins(options: {
|
|
191
|
+
pluginPaths?: string[];
|
|
192
|
+
projectDir: string;
|
|
193
|
+
}): Promise<PluginLoadResult>;
|
|
214
194
|
|
|
215
|
-
export { AgentContractLike, type AgentPlugin, type DelegateStep, type GateStep, type
|
|
195
|
+
export { AgentContractLike, type AgentPlugin, type DelegateStep, type GateStep, type GuardrailResult, type PluginLoadResult, PluginRegistry, type PromptBuilderArgs, PromptBuilderOptions, SdkAdapter, type StepCompleteEvent, type StepResult, TaskContext, TaskContractLike, TaskOutcome, type WorkflowContractLike, type WorkflowResult, type WorkflowRunOptions, type WorkflowStep, loadPlugins, loadPluginsFromDirectory, loadPluginsFromPaths, pluginRegistry, runWorkflow };
|
package/dist/index.js
CHANGED
|
@@ -7,12 +7,15 @@ import {
|
|
|
7
7
|
getBlockingViolations,
|
|
8
8
|
getWarnings,
|
|
9
9
|
hasBlockingViolation,
|
|
10
|
+
loadPlugins,
|
|
11
|
+
loadPluginsFromDirectory,
|
|
12
|
+
loadPluginsFromPaths,
|
|
10
13
|
pluginRegistry,
|
|
11
14
|
runTask,
|
|
12
15
|
runWorkflow,
|
|
13
16
|
zodSchemaToPromptDescription,
|
|
14
17
|
zodSchemaToYamlExample
|
|
15
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-UEHOLHZV.js";
|
|
16
19
|
export {
|
|
17
20
|
PluginRegistry,
|
|
18
21
|
buildRetryFollowUp,
|
|
@@ -22,6 +25,9 @@ export {
|
|
|
22
25
|
getBlockingViolations,
|
|
23
26
|
getWarnings,
|
|
24
27
|
hasBlockingViolation,
|
|
28
|
+
loadPlugins,
|
|
29
|
+
loadPluginsFromDirectory,
|
|
30
|
+
loadPluginsFromPaths,
|
|
25
31
|
pluginRegistry,
|
|
26
32
|
runTask,
|
|
27
33
|
runWorkflow,
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/generator/index.ts","../src/generator/config.ts","../src/generator/template-engine.ts","../src/generator/context.ts"],"sourcesContent":["/**\n * Generator — orchestrates DSL-to-TypeScript code generation\n */\n\nimport { readFile, writeFile, mkdir, rm, stat } from \"node:fs/promises\";\nimport { resolve, join, relative } from \"node:path\";\nimport { createHash } from \"node:crypto\";\nimport YAML from \"yaml\";\nimport { loadConfig, type ResolvedConfig } from \"./config.js\";\nimport { renderTemplate } from \"./template-engine.js\";\nimport { buildContractContext, buildGuardrailContext } from \"./context.js\";\n\nexport interface GenerateOptions {\n clean?: boolean;\n check?: boolean;\n templates?: string;\n configPath?: string;\n}\n\nexport interface GenerateResult {\n filesGenerated: string[];\n dslHash: string;\n generationInputHash: string;\n cleaned: boolean;\n checkMode: boolean;\n hasDifferences: boolean;\n}\n\nconst DO_NOT_EDIT_HEADER = `/**\n * AUTO-GENERATED by agent-contracts-runtime. DO NOT EDIT.\n *\n * Regenerate via: npx agent-runtime generate\n */\n\n`;\n\nasync function loadYaml(filePath: string): Promise<unknown> {\n const raw = await readFile(filePath, \"utf8\");\n return YAML.parse(raw);\n}\n\nfunction computeHash(data: string): string {\n return createHash(\"sha256\").update(data).digest(\"hex\");\n}\n\n/**\n * Load DSL — tries agent-contracts resolve if available, falls back to raw YAML.\n */\nasync function loadDsl(dslPath: string): Promise<Record<string, unknown>> {\n try {\n const modName = \"agent-contracts\";\n const mod = await import(/* webpackIgnore: true */ modName);\n if (mod.loadDsl) {\n const result = await mod.loadDsl(dslPath);\n return (result as { data: Record<string, unknown> }).data;\n }\n } catch {\n // agent-contracts not available — use raw YAML\n }\n return (await loadYaml(dslPath)) as Record<string, unknown>;\n}\n\nconst CONTRACT_TEMPLATES = [\n { template: \"agents.ts.hbs\", output: \"agents.ts\" },\n { template: \"tasks.ts.hbs\", output: \"tasks.ts\" },\n { template: \"workflows.ts.hbs\", output: \"workflows.ts\" },\n { template: \"handoffs.ts.hbs\", output: \"handoffs.ts\" },\n { template: \"contracts-index.ts.hbs\", output: \"index.ts\" },\n];\n\nconst GUARDRAIL_TEMPLATES = [\n { template: \"guardrails.ts.hbs\", output: \"hooks/guardrails.ts\" },\n { template: \"hooks-index.ts.hbs\", output: \"hooks/index.ts\" },\n];\n\nexport async function generate(options: GenerateOptions = {}): Promise<GenerateResult> {\n const configPath = options.configPath ?? \"./agent-runtime.config.yaml\";\n const config = await loadConfig(configPath);\n\n const templatesDir = options.templates ?? config.templatesDir;\n const checkMode = options.check ?? false;\n const cleaned = options.clean ?? false;\n\n if (cleaned && !checkMode) {\n try {\n await rm(config.generatedDir, { recursive: true, force: true });\n } catch {\n // directory may not exist\n }\n }\n\n const dsl = await loadDsl(config.dslPath);\n const dslCanonical = JSON.stringify(dsl, Object.keys(dsl).sort(), 0);\n const dslHash = computeHash(dslCanonical);\n\n const contractCtx = buildContractContext(dsl);\n\n const filesGenerated: string[] = [];\n const generatedContents: Map<string, string> = new Map();\n\n // Phase 1: Contract files\n for (const { template, output } of CONTRACT_TEMPLATES) {\n const rendered = DO_NOT_EDIT_HEADER + await renderTemplate(template, contractCtx as unknown as Record<string, unknown>, templatesDir);\n const outPath = join(config.generatedDir, output);\n filesGenerated.push(relative(config.configDir, outPath));\n generatedContents.set(outPath, rendered);\n }\n\n // Phase 2: Guardrail hooks (only if bindings are configured)\n if (config.bindingPaths.length > 0) {\n for (const bindingPath of config.bindingPaths) {\n const binding = await loadYaml(bindingPath);\n const guardrailCtx = buildGuardrailContext(\n dsl,\n binding,\n config.active_guardrail_policy,\n );\n\n if (guardrailCtx.hasGuardrails) {\n for (const { template, output } of GUARDRAIL_TEMPLATES) {\n const rendered = DO_NOT_EDIT_HEADER + await renderTemplate(\n template,\n guardrailCtx as unknown as Record<string, unknown>,\n templatesDir,\n );\n const outPath = join(config.generatedDir, output);\n filesGenerated.push(relative(config.configDir, outPath));\n generatedContents.set(outPath, rendered);\n }\n }\n }\n }\n\n // Compute generation input hash (DSL + binding + generator version)\n const generationInputParts = [dslCanonical];\n for (const bp of config.bindingPaths) {\n try {\n generationInputParts.push(await readFile(bp, \"utf8\"));\n } catch {\n // binding may not exist\n }\n }\n const generationInputHash = computeHash(generationInputParts.join(\"\\n---\\n\"));\n\n // Check mode — compare without writing\n let hasDifferences = false;\n if (checkMode) {\n for (const [outPath, content] of generatedContents) {\n try {\n const existing = await readFile(outPath, \"utf8\");\n if (existing !== content) {\n hasDifferences = true;\n break;\n }\n } catch {\n hasDifferences = true;\n break;\n }\n }\n } else {\n // Write files\n for (const [outPath, content] of generatedContents) {\n const dir = resolve(outPath, \"..\");\n await mkdir(dir, { recursive: true });\n await writeFile(outPath, content, \"utf8\");\n }\n\n // Write manifest\n const manifest = {\n generatedAt: new Date().toISOString(),\n dslHash,\n generationInputHash,\n files: filesGenerated,\n };\n const manifestPath = join(config.generatedDir, \".manifest.json\");\n await mkdir(resolve(manifestPath, \"..\"), { recursive: true });\n await writeFile(manifestPath, JSON.stringify(manifest, null, 2) + \"\\n\", \"utf8\");\n }\n\n return {\n filesGenerated,\n dslHash,\n generationInputHash,\n cleaned,\n checkMode,\n hasDifferences,\n };\n}\n\nexport async function checkFreshness(configPath?: string): Promise<boolean> {\n const config = await loadConfig(configPath ?? \"./agent-runtime.config.yaml\");\n const manifestPath = join(config.generatedDir, \".manifest.json\");\n\n try {\n const raw = await readFile(manifestPath, \"utf8\");\n const manifest = JSON.parse(raw) as { dslHash: string };\n\n const dsl = await loadDsl(config.dslPath);\n const dslCanonical = JSON.stringify(dsl, Object.keys(dsl).sort(), 0);\n const currentHash = computeHash(dslCanonical);\n\n return manifest.dslHash === currentHash;\n } catch {\n return false;\n }\n}\n\nexport { loadConfig, type ResolvedConfig } from \"./config.js\";\nexport { buildContractContext, buildGuardrailContext } from \"./context.js\";\n","/**\n * Generator configuration — loads and validates agent-runtime.config.yaml\n */\n\nimport { readFile } from \"node:fs/promises\";\nimport { resolve, dirname } from \"node:path\";\nimport { z } from \"zod\";\nimport YAML from \"yaml\";\n\nconst RecoverySchema = z.object({\n max_follow_ups: z.number().int().min(0).default(2),\n max_retries: z.number().int().min(0).default(0),\n}).default({});\n\nexport const RuntimeConfigSchema = z.object({\n dsl: z.string().default(\"./agent-contracts.yaml\"),\n generated_dir: z.string().default(\"./agent/generated\"),\n bindings: z.array(z.string()).default([]),\n active_guardrail_policy: z.string().optional(),\n templates_dir: z.string().optional(),\n recovery: RecoverySchema,\n});\n\nexport type RuntimeConfig = z.infer<typeof RuntimeConfigSchema>;\n\nexport interface ResolvedConfig extends RuntimeConfig {\n configDir: string;\n dslPath: string;\n generatedDir: string;\n bindingPaths: string[];\n templatesDir: string | undefined;\n}\n\nexport async function loadConfig(configPath: string): Promise<ResolvedConfig> {\n const absPath = resolve(configPath);\n const raw = await readFile(absPath, \"utf8\");\n const parsed = YAML.parse(raw);\n const config = RuntimeConfigSchema.parse(parsed);\n const configDir = dirname(absPath);\n\n return {\n ...config,\n configDir,\n dslPath: resolve(configDir, config.dsl),\n generatedDir: resolve(configDir, config.generated_dir),\n bindingPaths: config.bindings.map((b) => resolve(configDir, b)),\n templatesDir: config.templates_dir\n ? resolve(configDir, config.templates_dir)\n : undefined,\n };\n}\n","/**\n * Handlebars template engine with custom helpers for TypeScript code generation\n */\n\nimport { readFile } from \"node:fs/promises\";\nimport { resolve, join } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport Handlebars from \"handlebars\";\n\nimport { existsSync } from \"node:fs\";\n\nconst __dirname = fileURLToPath(new URL(\".\", import.meta.url));\n\nfunction findPackageRoot(): string {\n let dir = __dirname;\n for (let i = 0; i < 5; i++) {\n if (existsSync(join(dir, \"package.json\"))) return dir;\n dir = resolve(dir, \"..\");\n }\n return resolve(__dirname, \"..\");\n}\n\nconst BUILTIN_TEMPLATES_DIR = join(findPackageRoot(), \"templates\");\n\nfunction toCamelCase(str: string): string {\n return str.replace(/-([a-z])/g, (_, c: string) => c.toUpperCase());\n}\n\nfunction toPascalCase(str: string): string {\n const camel = toCamelCase(str);\n return camel.charAt(0).toUpperCase() + camel.slice(1);\n}\n\nconst hbs = Handlebars.create();\n\nhbs.registerHelper(\"camelCase\", (str: string) => toCamelCase(str));\nhbs.registerHelper(\"PascalCase\", (str: string) => toPascalCase(str));\n\nhbs.registerHelper(\"eq\", (a: unknown, b: unknown) => a === b);\nhbs.registerHelper(\"notEmpty\", (arr: unknown) =>\n Array.isArray(arr) ? arr.length > 0 : !!arr,\n);\n\nhbs.registerHelper(\"json\", (value: unknown) =>\n new Handlebars.SafeString(JSON.stringify(value, null, 2)),\n);\n\nhbs.registerHelper(\"jsonInline\", (value: unknown) =>\n new Handlebars.SafeString(JSON.stringify(value)),\n);\n\nhbs.registerHelper(\"indent\", (text: string, spaces: number) => {\n if (typeof text !== \"string\") return text;\n const pad = \" \".repeat(spaces);\n return text\n .split(\"\\n\")\n .map((line, i) => (i === 0 ? line : pad + line))\n .join(\"\\n\");\n});\n\nhbs.registerHelper(\"zodType\", function zodType(schema: Record<string, unknown>): string {\n if (!schema || typeof schema !== \"object\") return \"z.unknown()\";\n\n if (schema.enum) {\n const vals = (schema.enum as string[]).map((v) => `\"${v}\"`).join(\", \");\n return `z.enum([${vals}])`;\n }\n\n if (schema.const !== undefined) {\n return `z.literal(${JSON.stringify(schema.const)})`;\n }\n\n const type = schema.type as string | undefined;\n\n if (type === \"string\") return \"z.string()\";\n if (type === \"number\" || type === \"integer\") return \"z.number()\";\n if (type === \"boolean\") return \"z.boolean()\";\n\n if (type === \"array\") {\n const items = schema.items as Record<string, unknown> | undefined;\n const inner = items ? zodType(items) : \"z.unknown()\";\n return `z.array(${inner})`;\n }\n\n if (type === \"object\") {\n const props = schema.properties as Record<string, Record<string, unknown>> | undefined;\n if (!props) return \"z.record(z.string(), z.unknown())\";\n\n const required = (schema.required as string[]) ?? [];\n const fields = Object.entries(props)\n .map(([key, val]) => {\n const base = zodType(val);\n const opt = required.includes(key) ? \"\" : \".optional()\";\n return ` ${key}: ${base}${opt},`;\n })\n .join(\"\\n\");\n return `z.object({\\n${fields}\\n})`;\n }\n\n if (schema.allOf) {\n const parts = (schema.allOf as Record<string, unknown>[]).map(zodType);\n if (parts.length === 1) return parts[0];\n return parts.join(\".merge(\") + \")\".repeat(parts.length - 1);\n }\n\n return \"z.unknown()\";\n});\n\nhbs.registerHelper(\"regexEscape\", (str: string) => {\n if (typeof str !== \"string\") return str;\n return str.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n});\n\nhbs.registerHelper(\"stringArray\", (arr: unknown) => {\n if (!Array.isArray(arr)) return \"[]\";\n return \"[\" + arr.map((s) => `\"${s}\"`).join(\", \") + \"]\";\n});\n\n/**\n * Load a template by name, with custom dir override fallback to built-in.\n */\nasync function loadTemplate(\n name: string,\n customDir?: string,\n): Promise<string> {\n if (customDir) {\n try {\n return await readFile(join(customDir, name), \"utf8\");\n } catch {\n // fallback to built-in\n }\n }\n return readFile(join(BUILTIN_TEMPLATES_DIR, name), \"utf8\");\n}\n\nexport async function renderTemplate(\n name: string,\n context: Record<string, unknown>,\n customDir?: string,\n): Promise<string> {\n const source = await loadTemplate(name, customDir);\n const compiled = hbs.compile(source, { noEscape: true });\n return compiled(context);\n}\n\nexport { hbs, toCamelCase, toPascalCase };\n","/**\n * Build template contexts from resolved DSL data\n */\n\nimport { toCamelCase, toPascalCase } from \"./template-engine.js\";\n\nexport interface AgentEntry {\n id: string;\n varName: string;\n role_name: string;\n purpose: string;\n mode: string;\n dispatch_only: boolean;\n can_read_artifacts: string[];\n can_write_artifacts: string[];\n can_execute_tools: string[];\n can_invoke_agents: string[];\n can_return_handoffs: string[];\n responsibilities: string[];\n constraints: string[];\n rules: Array<{ id: string; description: string; severity: string }>;\n escalation_criteria: Array<{ condition: string; action: string }>;\n}\n\nexport interface TaskEntry {\n id: string;\n varName: string;\n description: string;\n target_agent: string;\n allowed_from_agents: string[];\n workflow: string;\n invocation_handoff: string;\n result_handoff: string;\n input_artifacts: string[];\n responsibilities: string[];\n completion_criteria: string[];\n optional: boolean;\n}\n\nexport interface WorkflowStepEntry {\n type: string;\n task?: string;\n from_agent?: string;\n description?: string;\n optional?: boolean;\n max_retries?: number;\n max_follow_ups?: number;\n gate_kind?: string;\n retry?: { condition: string; fix_task: string; revalidate_task?: string };\n}\n\nexport interface WorkflowEntry {\n id: string;\n varName: string;\n description: string;\n trigger: string;\n entry_conditions: string[];\n steps: WorkflowStepEntry[];\n}\n\nexport interface HandoffEntry {\n id: string;\n varName: string;\n pascalName: string;\n schemaName: string;\n description: string;\n schema: Record<string, unknown>;\n}\n\nexport interface ContractContext {\n agentEntries: AgentEntry[];\n taskEntries: TaskEntry[];\n workflowEntries: WorkflowEntry[];\n handoffEntries: HandoffEntry[];\n}\n\n/**\n * Determine if a task is optional by checking if any workflow step referencing it is optional.\n */\nfunction isTaskOptional(\n taskId: string,\n workflows: Record<string, { steps: Array<{ type: string; task?: string; optional?: boolean }> }>,\n): boolean {\n for (const wf of Object.values(workflows)) {\n for (const step of wf.steps) {\n if (step.type === \"delegate\" && step.task === taskId && step.optional) {\n return true;\n }\n }\n }\n return false;\n}\n\n/**\n * Compute max_retries from workflow step or fallback to 0.\n */\nfunction getMaxRetries(\n taskId: string,\n workflows: Record<string, { steps: Array<Record<string, unknown>> }>,\n): number {\n for (const wf of Object.values(workflows)) {\n for (const step of wf.steps) {\n if (step.type === \"delegate\" && step.task === taskId) {\n const retry = step.retry as { condition: string } | undefined;\n return retry ? 1 : 0;\n }\n }\n }\n return 0;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function buildContractContext(dsl: any): ContractContext {\n const agents = (dsl.agents ?? {}) as Record<string, Record<string, unknown>>;\n const tasks = (dsl.tasks ?? {}) as Record<string, Record<string, unknown>>;\n const workflows = (dsl.workflow ?? {}) as Record<string, Record<string, unknown>>;\n const handoffTypes = (dsl.handoff_types ?? {}) as Record<string, Record<string, unknown>>;\n\n const agentEntries: AgentEntry[] = Object.entries(agents).map(([id, agent]) => ({\n id,\n varName: toCamelCase(id),\n role_name: (agent.role_name as string) ?? id,\n purpose: (agent.purpose as string) ?? \"\",\n mode: (agent.mode as string) ?? \"read-write\",\n dispatch_only: (agent.dispatch_only as boolean) ?? false,\n can_read_artifacts: (agent.can_read_artifacts as string[]) ?? [],\n can_write_artifacts: (agent.can_write_artifacts as string[]) ?? [],\n can_execute_tools: (agent.can_execute_tools as string[]) ?? [],\n can_invoke_agents: (agent.can_invoke_agents as string[]) ?? [],\n can_return_handoffs: (agent.can_return_handoffs as string[]) ?? [],\n responsibilities: (agent.responsibilities as string[]) ?? [],\n constraints: (agent.constraints as string[]) ?? [],\n rules: (agent.rules as AgentEntry[\"rules\"]) ?? [],\n escalation_criteria: (agent.escalation_criteria as AgentEntry[\"escalation_criteria\"]) ?? [],\n }));\n\n const taskEntries: TaskEntry[] = Object.entries(tasks).map(([id, task]) => ({\n id,\n varName: toCamelCase(id),\n description: (task.description as string) ?? \"\",\n target_agent: (task.target_agent as string) ?? \"\",\n allowed_from_agents: (task.allowed_from_agents as string[]) ?? [],\n workflow: (task.workflow as string) ?? \"\",\n invocation_handoff: (task.invocation_handoff as string) ?? \"\",\n result_handoff: (task.result_handoff as string) ?? \"\",\n input_artifacts: (task.input_artifacts as string[]) ?? [],\n responsibilities: (task.responsibilities as string[]) ?? [],\n completion_criteria: (task.completion_criteria as string[]) ?? [],\n optional: isTaskOptional(id, workflows as Record<string, { steps: Array<{ type: string; task?: string; optional?: boolean }> }>),\n }));\n\n const workflowEntries: WorkflowEntry[] = Object.entries(workflows).map(\n ([id, wf]) => {\n const steps = ((wf.steps as Array<Record<string, unknown>>) ?? []).map((step) => {\n const entry: WorkflowStepEntry = { type: step.type as string };\n if (step.type === \"delegate\") {\n entry.task = step.task as string;\n entry.from_agent = step.from_agent as string;\n entry.description = step.description as string;\n const wfStep = step as Record<string, unknown>;\n entry.optional = isTaskOptional(\n step.task as string,\n workflows as Record<string, { steps: Array<{ type: string; task?: string; optional?: boolean }> }>,\n );\n entry.max_retries = (wfStep.max_retries as number | undefined) ?? (wfStep.retry ? 1 : 0);\n entry.max_follow_ups = wfStep.max_follow_ups as number | undefined;\n if (wfStep.retry) {\n const r = wfStep.retry as Record<string, unknown>;\n entry.retry = {\n condition: r.condition as string,\n fix_task: r.fix_task as string,\n revalidate_task: r.revalidate_task as string | undefined,\n };\n }\n } else if (step.type === \"gate\") {\n entry.gate_kind = step.gate_kind as string;\n entry.description = step.description as string;\n }\n return entry;\n });\n\n return {\n id,\n varName: toCamelCase(id),\n description: (wf.description as string) ?? \"\",\n trigger: (wf.trigger as string) ?? \"\",\n entry_conditions: (wf.entry_conditions as string[]) ?? [],\n steps,\n };\n },\n );\n\n const handoffEntries: HandoffEntry[] = Object.entries(handoffTypes).map(\n ([id, ht]) => ({\n id,\n varName: toCamelCase(id),\n pascalName: toPascalCase(id),\n schemaName: toPascalCase(id) + \"Schema\",\n description: (ht.description as string) ?? \"\",\n schema: (ht.schema as Record<string, unknown>) ?? {},\n }),\n );\n\n return { agentEntries, taskEntries, workflowEntries, handoffEntries };\n}\n\nexport interface GuardrailCheckEntry {\n guardrail_id: string;\n description: string;\n severity: string;\n action: string;\n matcher_type: string;\n pattern: string;\n message: string;\n file_glob?: string;\n exclude_glob?: string;\n}\n\nexport interface GuardrailContext {\n commandChecks: GuardrailCheckEntry[];\n fileChecks: GuardrailCheckEntry[];\n contentChecks: GuardrailCheckEntry[];\n allChecks: GuardrailCheckEntry[];\n hasGuardrails: boolean;\n}\n\n/**\n * Build guardrail context from DSL guardrails, binding guardrail_impl, and active policy.\n * Mirrors the agent-contracts resolveChecks pattern.\n */\nexport function buildGuardrailContext(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n dsl: any,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n binding: any,\n policyName?: string,\n): GuardrailContext {\n const empty: GuardrailContext = {\n commandChecks: [],\n fileChecks: [],\n contentChecks: [],\n allChecks: [],\n hasGuardrails: false,\n };\n\n if (!binding?.guardrail_impl) return empty;\n\n const guardrails = dsl.guardrails ?? {};\n const policies = dsl.guardrail_policies ?? {};\n const policy = policyName ? policies[policyName] : undefined;\n\n const allChecks: GuardrailCheckEntry[] = [];\n\n for (const [guardrailId, impl] of Object.entries(\n binding.guardrail_impl as Record<string, { checks: Array<Record<string, unknown>> }>,\n )) {\n const guardrail = guardrails[guardrailId] as Record<string, unknown> | undefined;\n const description = (guardrail?.description as string) ?? guardrailId;\n\n const policyRule = policy?.rules?.find(\n (r: Record<string, unknown>) => r.guardrail === guardrailId,\n );\n const severity = (policyRule?.severity as string) ?? \"warning\";\n const action = (policyRule?.action as string) ?? \"warn\";\n\n for (const check of impl.checks) {\n const matcher = check.matcher as Record<string, unknown> | undefined;\n if (!matcher) continue;\n\n allChecks.push({\n guardrail_id: guardrailId,\n description,\n severity,\n action,\n matcher_type: matcher.type as string,\n pattern: matcher.pattern as string,\n message: (check.message as string) ?? description,\n file_glob: matcher.file_glob as string | undefined,\n exclude_glob: matcher.exclude_glob as string | undefined,\n });\n }\n }\n\n return {\n commandChecks: allChecks.filter((c) => c.matcher_type === \"command_regex\"),\n fileChecks: allChecks.filter((c) => c.matcher_type === \"file_glob\"),\n contentChecks: allChecks.filter((c) => c.matcher_type === \"content_regex\"),\n allChecks,\n hasGuardrails: allChecks.length > 0,\n };\n}\n"],"mappings":";AAIA,SAAS,YAAAA,WAAU,WAAW,OAAO,UAAgB;AACrD,SAAS,WAAAC,UAAS,QAAAC,OAAM,gBAAgB;AACxC,SAAS,kBAAkB;AAC3B,OAAOC,WAAU;;;ACHjB,SAAS,gBAAgB;AACzB,SAAS,SAAS,eAAe;AACjC,SAAS,SAAS;AAClB,OAAO,UAAU;A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