intentdna 1.5.18 → 1.5.20
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.5.
|
|
12
|
+
"version": "1.5.20",
|
|
13
13
|
"author": {
|
|
14
14
|
"name": "Samuel"
|
|
15
15
|
},
|
|
@@ -25,5 +25,5 @@
|
|
|
25
25
|
]
|
|
26
26
|
}
|
|
27
27
|
],
|
|
28
|
-
"version": "1.5.
|
|
28
|
+
"version": "1.5.20"
|
|
29
29
|
}
|
package/dist/hooks/cli.js
CHANGED
|
@@ -18,7 +18,7 @@ import { readFile, realpath, stat } from "node:fs/promises";
|
|
|
18
18
|
import { spawn } from "node:child_process";
|
|
19
19
|
import { dirname, isAbsolute, join, relative, resolve } from "node:path";
|
|
20
20
|
import { randomUUID } from "node:crypto";
|
|
21
|
-
import { readStdin, writeOutput, silentOutput, allowOutput, blockOutput } from "./protocol.js";
|
|
21
|
+
import { readStdin, writeOutput, silentOutput, allowOutput, blockOutput, stopOutput } from "./protocol.js";
|
|
22
22
|
import { validateHookInput } from "./schema.js";
|
|
23
23
|
import { enforcePreToolUse, enforcePostToolUse, enforceUserPromptSubmit, enforceSubagentStop, enforcePreCompact, enforceNotification, enforceSessionStart, enforceStop, extractBashWritePaths, checkReflectionLimit, checkContextReadiness, checkWorkflowBoundary, } from "./enforce.js";
|
|
24
24
|
import { appendAudit, readWorkflowState, appendTrace, rotateTraces, readTraces, cleanStaleState, readSurgeonAttempts, writeSurgeonAttempts, appendSessionRead, readSessionReads, appendVerifierResult } from "./state.js";
|
|
@@ -176,12 +176,7 @@ async function main() {
|
|
|
176
176
|
const summary = computeSummary(traces);
|
|
177
177
|
const summaryText = formatSummary(summary);
|
|
178
178
|
if (summaryText) {
|
|
179
|
-
|
|
180
|
-
stopOutput = allowOutput(summaryText, "Stop");
|
|
181
|
-
}
|
|
182
|
-
else if (stopOutput.reason) {
|
|
183
|
-
stopOutput.reason += "\n\n" + summaryText;
|
|
184
|
-
}
|
|
179
|
+
stopOutput = appendOutputText(stopOutput, summaryText, "Stop");
|
|
185
180
|
}
|
|
186
181
|
}
|
|
187
182
|
catch { /* fail-open: summary failure never blocks */ }
|
|
@@ -191,12 +186,7 @@ async function main() {
|
|
|
191
186
|
try {
|
|
192
187
|
const guidance = await buildWorkflowGuidance(projectDir, wfState, sessionId);
|
|
193
188
|
if (guidance) {
|
|
194
|
-
|
|
195
|
-
stopOutput = allowOutput(guidance, "Stop");
|
|
196
|
-
}
|
|
197
|
-
else if (stopOutput.reason) {
|
|
198
|
-
stopOutput.reason += "\n\n" + guidance;
|
|
199
|
-
}
|
|
189
|
+
stopOutput = appendOutputText(stopOutput, guidance, "Stop");
|
|
200
190
|
}
|
|
201
191
|
}
|
|
202
192
|
catch { /* fail-open */ }
|
|
@@ -468,6 +458,8 @@ const MAX_VERIFIER_EVIDENCE_BYTES = 4096;
|
|
|
468
458
|
function appendOutputText(output, text, hookEventName) {
|
|
469
459
|
if (!text)
|
|
470
460
|
return output;
|
|
461
|
+
if (hookEventName === "Stop")
|
|
462
|
+
return stopOutputForText(output, text);
|
|
471
463
|
if (output.continue === false) {
|
|
472
464
|
return {
|
|
473
465
|
...output,
|
|
@@ -488,6 +480,18 @@ function appendOutputText(output, text, hookEventName) {
|
|
|
488
480
|
}
|
|
489
481
|
return allowOutput(text, hookEventName);
|
|
490
482
|
}
|
|
483
|
+
function stopOutputForText(output, text) {
|
|
484
|
+
if (!text)
|
|
485
|
+
return output;
|
|
486
|
+
if (output.continue === false) {
|
|
487
|
+
return {
|
|
488
|
+
...output,
|
|
489
|
+
reason: output.reason ? `${output.reason}\n${text}` : text,
|
|
490
|
+
};
|
|
491
|
+
}
|
|
492
|
+
const existing = output.systemMessage;
|
|
493
|
+
return stopOutput(existing ? `${existing}\n${text}` : text);
|
|
494
|
+
}
|
|
491
495
|
export function appendStopVerifierWarnings(output, verifierResults, currentStep) {
|
|
492
496
|
const warningVerifierFailures = verifierResults.filter((result) => result.status === "fail" && result.severity === "warn");
|
|
493
497
|
if (warningVerifierFailures.length === 0)
|
package/dist/hooks/protocol.d.ts
CHANGED
|
@@ -48,6 +48,7 @@ export interface HookOutput {
|
|
|
48
48
|
decision?: "block" | "allow";
|
|
49
49
|
reason?: string;
|
|
50
50
|
suppressOutput?: boolean;
|
|
51
|
+
systemMessage?: string;
|
|
51
52
|
hookSpecificOutput?: {
|
|
52
53
|
hookEventName?: string;
|
|
53
54
|
additionalContext?: string;
|
|
@@ -71,6 +72,8 @@ export declare function allowOutput(additionalContext?: string, hookEventName?:
|
|
|
71
72
|
export declare function blockOutput(reason: string): HookOutput;
|
|
72
73
|
/** Create an escalate output (ask user for permission). */
|
|
73
74
|
export declare function escalateOutput(reason: string): HookOutput;
|
|
75
|
+
/** Create a Stop-compatible allow output with a system message. */
|
|
76
|
+
export declare function stopOutput(systemMessage?: string): HookOutput;
|
|
74
77
|
/** Create a silent allow output (no visible output to user). */
|
|
75
78
|
export declare function silentOutput(): HookOutput;
|
|
76
79
|
/**
|
package/dist/hooks/protocol.js
CHANGED
|
@@ -38,6 +38,10 @@ export function escalateOutput(reason) {
|
|
|
38
38
|
},
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
|
+
/** Create a Stop-compatible allow output with a system message. */
|
|
42
|
+
export function stopOutput(systemMessage) {
|
|
43
|
+
return systemMessage ? { continue: true, systemMessage } : { continue: true };
|
|
44
|
+
}
|
|
41
45
|
/** Create a silent allow output (no visible output to user). */
|
|
42
46
|
export function silentOutput() {
|
|
43
47
|
return { continue: true, suppressOutput: true };
|
|
@@ -271,11 +271,11 @@ roles:
|
|
|
271
271
|
test_runner:
|
|
272
272
|
description: "Runs tests and reports progress delta."
|
|
273
273
|
tool_permissions:
|
|
274
|
-
allow: [Read, Grep, Glob, Bash]
|
|
275
|
-
deny: [Edit,
|
|
274
|
+
allow: [Read, Grep, Glob, Bash, Write]
|
|
275
|
+
deny: [Edit, NotebookEdit]
|
|
276
276
|
scope:
|
|
277
277
|
read: ["**/*"]
|
|
278
|
-
write: []
|
|
278
|
+
write: [".dna/fix-progress/**"]
|
|
279
279
|
instructions:
|
|
280
280
|
- "Run flutter test for the target module"
|
|
281
281
|
- "Parse output: green/red/skip counts"
|
|
@@ -435,7 +435,13 @@ workflows:
|
|
|
435
435
|
blocked_items_path: "docs/behavior/blocked_items.md"
|
|
436
436
|
description: "Fix issues according to diagnosis spec classifications"
|
|
437
437
|
prompt: |
|
|
438
|
-
This invocation is one fix round.
|
|
438
|
+
This invocation is one fix round.
|
|
439
|
+
|
|
440
|
+
Before editing, check whether .dna/fix-progress/$ARGUMENTS.md exists.
|
|
441
|
+
- If it exists, read it before the diagnosis spec and continue from its Next Round Focus.
|
|
442
|
+
- If it records REQUEST_CHANGES or BLOCKED_BY_REVIEW, address those review issues before starting unrelated diagnosis items.
|
|
443
|
+
- Use Failed approaches / Do not repeat to avoid repeating unsuccessful fixes.
|
|
444
|
+
- If it does not exist, treat this as round 1.
|
|
439
445
|
|
|
440
446
|
Read context + diagnosis spec first.
|
|
441
447
|
|
|
@@ -489,7 +495,7 @@ workflows:
|
|
|
489
495
|
}
|
|
490
496
|
```
|
|
491
497
|
|
|
492
|
-
REQUEST_CHANGES → include failure_reason and concrete next_round_focus for the next fix invocation.
|
|
498
|
+
REQUEST_CHANGES → include failure_reason and concrete next_round_focus for the next fix invocation. The next_round_focus must name the priority/classification and specific test file or evidence path to address first.
|
|
493
499
|
handoff:
|
|
494
500
|
consumes:
|
|
495
501
|
- type: git_commit
|
|
@@ -528,6 +534,16 @@ workflows:
|
|
|
528
534
|
- Failure reason: why progress stopped, if any
|
|
529
535
|
- Next round focus: the priority/classification/test file to continue with, if verdict is CONTINUE or REQUEST_CHANGES
|
|
530
536
|
|
|
537
|
+
Always write or update .dna/fix-progress/$ARGUMENTS.md before finishing, even when review blocks verification. Include these sections:
|
|
538
|
+
- Current verdict: Verdict, Review, Last fix commit, Updated at
|
|
539
|
+
- Round summary: Fixed, New red, Blocked, Remaining, Failure reason
|
|
540
|
+
- Next Round Focus: non-empty when Verdict is CONTINUE or REQUEST_CHANGES
|
|
541
|
+
- Review Issues To Address First: reviewer issues when Review is REQUEST_CHANGES
|
|
542
|
+
- Failed approaches / Do not repeat: approaches that failed or caused regressions
|
|
543
|
+
- Evidence: commands run and relevant paths
|
|
544
|
+
|
|
545
|
+
If Verdict is PASS, mark the module complete in .dna/fix-progress/$ARGUMENTS.md.
|
|
546
|
+
|
|
531
547
|
Verdict meanings:
|
|
532
548
|
- PASS: all approved diagnosis items are fixed or intentionally skipped
|
|
533
549
|
- CONTINUE: this round made progress and remaining approved items should continue in the next fix invocation
|
|
@@ -545,5 +561,8 @@ workflows:
|
|
|
545
561
|
path: ".dna/specs/diagnosis-$ARGUMENTS.md"
|
|
546
562
|
description: "Diagnosis spec"
|
|
547
563
|
produces:
|
|
564
|
+
- type: file
|
|
565
|
+
path: ".dna/fix-progress/$ARGUMENTS.md"
|
|
566
|
+
description: "Durable cumulative fix-progress artifact for the next fix invocation"
|
|
548
567
|
- type: summary
|
|
549
568
|
description: "Verification report with test delta"
|