intentdna 1.9.5 → 1.9.6
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.
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
{
|
|
10
10
|
"name": "intentdna",
|
|
11
11
|
"description": "Declarative policy layer for AI agent behavior with plugin-managed hook runtime for Claude Code.",
|
|
12
|
-
"version": "1.9.
|
|
12
|
+
"version": "1.9.6",
|
|
13
13
|
"author": {
|
|
14
14
|
"name": "Samuel"
|
|
15
15
|
},
|
|
@@ -25,5 +25,5 @@
|
|
|
25
25
|
]
|
|
26
26
|
}
|
|
27
27
|
],
|
|
28
|
-
"version": "1.9.
|
|
28
|
+
"version": "1.9.6"
|
|
29
29
|
}
|
package/dist/cli/commands/run.js
CHANGED
|
@@ -170,15 +170,15 @@ function readCanonicalMetadata(value) {
|
|
|
170
170
|
|| !hasExactKeys(value.provider, [
|
|
171
171
|
"kind",
|
|
172
172
|
"executable",
|
|
173
|
-
"max_budget_usd",
|
|
173
|
+
...(value.provider.max_budget_usd === undefined ? [] : ["max_budget_usd"]),
|
|
174
174
|
"permission_mode",
|
|
175
175
|
])
|
|
176
176
|
|| (value.provider.kind !== "claude" && value.provider.kind !== "codex")
|
|
177
177
|
|| (value.provider.executable !== null && (typeof value.provider.executable !== "string"
|
|
178
178
|
|| value.provider.executable.length === 0))
|
|
179
|
-
|| typeof value.provider.max_budget_usd !== "number"
|
|
180
|
-
|
|
181
|
-
|
|
179
|
+
|| (value.provider.max_budget_usd !== undefined && (typeof value.provider.max_budget_usd !== "number"
|
|
180
|
+
|| !Number.isFinite(value.provider.max_budget_usd)
|
|
181
|
+
|| value.provider.max_budget_usd <= 0))
|
|
182
182
|
|| typeof value.provider.permission_mode !== "string"
|
|
183
183
|
|| value.provider.permission_mode.length === 0
|
|
184
184
|
|| typeof value.max_concurrency !== "number"
|
|
@@ -220,7 +220,9 @@ function providerConfiguration(metadata) {
|
|
|
220
220
|
...(metadata.provider.executable === null
|
|
221
221
|
? {}
|
|
222
222
|
: { executable: metadata.provider.executable }),
|
|
223
|
-
|
|
223
|
+
...(metadata.provider.max_budget_usd === undefined
|
|
224
|
+
? {}
|
|
225
|
+
: { max_budget_usd: metadata.provider.max_budget_usd }),
|
|
224
226
|
permission_mode: metadata.provider.permission_mode,
|
|
225
227
|
},
|
|
226
228
|
credential_references: [],
|
|
@@ -299,8 +301,8 @@ function createProvider(binding) {
|
|
|
299
301
|
}
|
|
300
302
|
const maxBudget = configuration.options.max_budget_usd;
|
|
301
303
|
const permissionMode = configuration.options.permission_mode;
|
|
302
|
-
if (
|
|
303
|
-
throw new Error("Claude run binding is missing launch
|
|
304
|
+
if (permissionMode === undefined) {
|
|
305
|
+
throw new Error("Claude run binding is missing launch permission mode");
|
|
304
306
|
}
|
|
305
307
|
const mcpConfigPath = findProjectMcpConfig(binding.workspace_root);
|
|
306
308
|
return createClaudeExecutionProvider({
|
|
@@ -308,8 +310,7 @@ function createProvider(binding) {
|
|
|
308
310
|
agentName: (packet) => `dna-${toKebabCase(packet.role)}`,
|
|
309
311
|
mcpConfigPath,
|
|
310
312
|
extraArgs: [
|
|
311
|
-
"--max-budget-usd",
|
|
312
|
-
String(maxBudget),
|
|
313
|
+
...(maxBudget === undefined ? [] : ["--max-budget-usd", String(maxBudget)]),
|
|
313
314
|
"--permission-mode",
|
|
314
315
|
permissionMode,
|
|
315
316
|
],
|
|
@@ -425,7 +426,9 @@ function startMetadata(opts, projectDirectory) {
|
|
|
425
426
|
provider: {
|
|
426
427
|
kind: provider,
|
|
427
428
|
executable: opts.providerExecutable === undefined ? null : requireText(opts.providerExecutable, "--provider-executable"),
|
|
428
|
-
|
|
429
|
+
...(opts.maxBudget === undefined
|
|
430
|
+
? {}
|
|
431
|
+
: { max_budget_usd: requirePositiveNumber(opts.maxBudget, "--max-budget") }),
|
|
429
432
|
// Durable workers have no interactive prompt available for tool approvals.
|
|
430
433
|
// Keep an explicitly supplied mode unchanged, but make the unattended
|
|
431
434
|
// default writable so required artifacts can be produced.
|
package/dist/cli/index.js
CHANGED
|
@@ -310,7 +310,7 @@ Options:
|
|
|
310
310
|
--max-concurrency <n> Maximum simultaneously active Steps (default: 1)
|
|
311
311
|
--timeout-ms <n> Per-attempt timeout in milliseconds
|
|
312
312
|
--cancellation-grace-ms <n> Process-tree cancellation grace period (default: 5000)
|
|
313
|
-
--max-budget <usd> Claude budget per Step attempt (default
|
|
313
|
+
--max-budget <usd> Optional Claude budget per Step attempt (no budget by default)
|
|
314
314
|
--permission-mode <mode> Claude permission mode (default: bypassPermissions for unattended runs)
|
|
315
315
|
--agents <dir> Project agent output directory (default: .claude/agents)
|
|
316
316
|
--reason <text> Cancellation or closure reason
|
|
@@ -588,9 +588,9 @@ async function main() {
|
|
|
588
588
|
context: runValues.context,
|
|
589
589
|
vars: Object.keys(vars).length > 0 ? vars : undefined,
|
|
590
590
|
dryRun: runValues["dry-run"],
|
|
591
|
-
maxBudget: runValues["max-budget"]
|
|
592
|
-
?
|
|
593
|
-
:
|
|
591
|
+
maxBudget: runValues["max-budget"] === undefined
|
|
592
|
+
? undefined
|
|
593
|
+
: Number(runValues["max-budget"]),
|
|
594
594
|
logDir: runValues["log-dir"],
|
|
595
595
|
permissionMode: runValues["permission-mode"],
|
|
596
596
|
agentsDir: runValues.agents,
|
|
@@ -19,7 +19,7 @@ import type { WorkflowPlan } from "../schema/types.js";
|
|
|
19
19
|
export interface WorkflowShellOptions {
|
|
20
20
|
/** Agent name prefix (default "dna-") */
|
|
21
21
|
agentPrefix?: string;
|
|
22
|
-
/**
|
|
22
|
+
/** Optional max budget per agent in USD; no budget unless explicitly set */
|
|
23
23
|
maxBudgetPerAgent?: number;
|
|
24
24
|
/** Output format for agent results (default "json") */
|
|
25
25
|
outputFormat?: "json" | "text";
|
|
@@ -111,7 +111,9 @@ function generateHeader(plan, options) {
|
|
|
111
111
|
lines.push("");
|
|
112
112
|
// Variables
|
|
113
113
|
lines.push("# Configuration");
|
|
114
|
-
|
|
114
|
+
if (options.maxBudgetPerAgent !== undefined) {
|
|
115
|
+
lines.push(`MAX_BUDGET="${options.maxBudgetPerAgent}"`);
|
|
116
|
+
}
|
|
115
117
|
lines.push(`LOG_DIR="${options.logDir}"`);
|
|
116
118
|
lines.push('mkdir -p "$LOG_DIR"');
|
|
117
119
|
lines.push("");
|
|
@@ -142,7 +144,9 @@ function generateRunAgentFn(options) {
|
|
|
142
144
|
lines.push(' echo "$prompt" | claude -p \\');
|
|
143
145
|
lines.push(' --agent "$agent" \\');
|
|
144
146
|
lines.push(` --output-format ${options.outputFormat} \\`);
|
|
145
|
-
|
|
147
|
+
if (options.maxBudgetPerAgent !== undefined) {
|
|
148
|
+
lines.push(' --max-budget-usd "$MAX_BUDGET" \\');
|
|
149
|
+
}
|
|
146
150
|
lines.push(` --permission-mode ${options.permissionMode} \\`);
|
|
147
151
|
lines.push(' --session-id "$(uuidgen | tr \'[:upper:]\' \'[:lower:]\')" \\');
|
|
148
152
|
lines.push(' --no-session-persistence \\');
|
|
@@ -469,9 +473,12 @@ function generateFailureChecks(plan) {
|
|
|
469
473
|
* RunController through `dna run` for canonical execution.
|
|
470
474
|
*/
|
|
471
475
|
export function compileWorkflowToShell(plan, options) {
|
|
476
|
+
if (options?.maxBudgetPerAgent !== undefined && (!Number.isFinite(options.maxBudgetPerAgent) || options.maxBudgetPerAgent <= 0)) {
|
|
477
|
+
throw new TypeError("maxBudgetPerAgent must be a positive finite number");
|
|
478
|
+
}
|
|
472
479
|
const opts = {
|
|
473
480
|
agentPrefix: options?.agentPrefix ?? "dna-",
|
|
474
|
-
maxBudgetPerAgent: options?.maxBudgetPerAgent
|
|
481
|
+
maxBudgetPerAgent: options?.maxBudgetPerAgent,
|
|
475
482
|
outputFormat: options?.outputFormat ?? "json",
|
|
476
483
|
permissionMode: options?.permissionMode ?? "default",
|
|
477
484
|
logDir: options?.logDir ?? ".",
|