intentdna 1.5.18 → 1.5.19

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.18",
12
+ "version": "1.5.19",
13
13
  "author": {
14
14
  "name": "Samuel"
15
15
  },
@@ -25,5 +25,5 @@
25
25
  ]
26
26
  }
27
27
  ],
28
- "version": "1.5.18"
28
+ "version": "1.5.19"
29
29
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "intentdna",
3
- "version": "1.5.18",
3
+ "version": "1.5.19",
4
4
  "description": "Declarative policy layer for AI agent behavior",
5
5
  "author": {
6
6
  "name": "Samuel"
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
- if (stopOutput.suppressOutput) {
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
- if (stopOutput.suppressOutput) {
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)
@@ -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
  /**
@@ -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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "intentdna",
3
- "version": "1.5.18",
3
+ "version": "1.5.19",
4
4
  "description": "Intent DNA — Declarative policy layer for AI agent behavior",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",