intentdna 1.4.1 → 1.4.3

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.
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "hooks": {
3
- "PreToolUse": [{ "matcher": "*", "hooks": [{ "type": "command", "command": "dna-hook PreToolUse", "timeout": 5000 }] }],
4
- "PostToolUse": [{ "matcher": "*", "hooks": [{ "type": "command", "command": "dna-hook PostToolUse", "timeout": 3000 }] }],
5
- "UserPromptSubmit": [{ "matcher": "*", "hooks": [{ "type": "command", "command": "dna-hook UserPromptSubmit", "timeout": 5000 }] }],
6
- "SubagentStop": [{ "matcher": "*", "hooks": [{ "type": "command", "command": "dna-hook SubagentStop", "timeout": 3000 }] }],
7
- "PreCompact": [{ "matcher": "*", "hooks": [{ "type": "command", "command": "dna-hook PreCompact", "timeout": 3000 }] }],
8
- "Notification": [{ "matcher": "*", "hooks": [{ "type": "command", "command": "dna-hook Notification", "timeout": 3000 }] }],
9
- "Stop": [{ "matcher": "*", "hooks": [{ "type": "command", "command": "dna-hook Stop", "timeout": 3000 }] }],
10
- "SessionStart": [{ "matcher": "*", "hooks": [{ "type": "command", "command": "dna-hook SessionStart", "timeout": 5000 }] }]
3
+ "PreToolUse": [{ "matcher": "*", "hooks": [{ "type": "command", "command": "dna-hook PreToolUse", "timeout": 5 }] }],
4
+ "PostToolUse": [{ "matcher": "*", "hooks": [{ "type": "command", "command": "dna-hook PostToolUse", "timeout": 3 }] }],
5
+ "UserPromptSubmit": [{ "matcher": "*", "hooks": [{ "type": "command", "command": "dna-hook UserPromptSubmit", "timeout": 5 }] }],
6
+ "SubagentStop": [{ "matcher": "*", "hooks": [{ "type": "command", "command": "dna-hook SubagentStop", "timeout": 3 }] }],
7
+ "PreCompact": [{ "matcher": "*", "hooks": [{ "type": "command", "command": "dna-hook PreCompact", "timeout": 3 }] }],
8
+ "Notification": [{ "matcher": "*", "hooks": [{ "type": "command", "command": "dna-hook Notification", "timeout": 3 }] }],
9
+ "Stop": [{ "matcher": "*", "hooks": [{ "type": "command", "command": "dna-hook Stop", "timeout": 3 }] }],
10
+ "SessionStart": [{ "matcher": "*", "hooks": [{ "type": "command", "command": "dna-hook SessionStart", "timeout": 5 }] }]
11
11
  }
12
12
  }
@@ -1,11 +1,15 @@
1
1
  {
2
2
  "name": "intentdna",
3
- "description": "Declarative policy layer for AI agent governance — compile DNA templates to hooks, agents, and constraints",
3
+ "description": "Declarative policy layer for AI agent governance",
4
+ "owner": {
5
+ "name": "Samuel",
6
+ "email": "wanglushan3344@gmail.com"
7
+ },
4
8
  "plugins": [
5
9
  {
6
10
  "name": "intentdna",
7
11
  "description": "DNA template compilation + runtime enforcement",
8
- "version": "1.4.0",
12
+ "version": "1.4.3",
9
13
  "source": "./"
10
14
  }
11
15
  ]
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "intentdna",
3
- "version": "0.6.0",
3
+ "version": "1.4.3",
4
4
  "description": "Declarative policy layer for AI agent governance"
5
5
  }
package/dist/hooks/cli.js CHANGED
@@ -102,6 +102,10 @@ async function main() {
102
102
  const decision = output.continue === false ? "block"
103
103
  : output.hookSpecificOutput?.additionalContext?.startsWith("WARN") ? "warn"
104
104
  : "allow";
105
+ // Extract target file path from tool_input (Write/Edit/Read)
106
+ const toolInput = typeof rawInput.tool_input === "object" && rawInput.tool_input !== null
107
+ ? rawInput.tool_input : undefined;
108
+ const targetPath = typeof toolInput?.file_path === "string" ? toolInput.file_path : undefined;
105
109
  appendTrace(projectDir, {
106
110
  trace_id: randomUUID(),
107
111
  event,
@@ -110,6 +114,8 @@ async function main() {
110
114
  workflow: state.workflowState?.workflow,
111
115
  step: state.workflowState?.current_step,
112
116
  decision: decision,
117
+ reason: decision !== "allow" ? output.reason : undefined,
118
+ target_path: decision !== "allow" ? targetPath : undefined,
113
119
  duration_ms: durationMs,
114
120
  timestamp: new Date().toISOString(),
115
121
  }).catch(() => { }); // Fail-open
@@ -187,7 +187,7 @@ export function enforceSessionStart(ir, input) {
187
187
  if (stats.length > 0) {
188
188
  lines.push(` Enforcement: ${stats.join(", ")}`);
189
189
  }
190
- return allowOutput(lines.join("\n"));
190
+ return allowOutput(lines.join("\n"), "SessionStart");
191
191
  }
192
192
  /**
193
193
  * Enforce Stop hook — verify workflow checkpoint completion.
@@ -55,7 +55,7 @@ export interface HookOutput {
55
55
  };
56
56
  }
57
57
  /** Create an allow output, optionally injecting text into the conversation. */
58
- export declare function allowOutput(additionalContext?: string): HookOutput;
58
+ export declare function allowOutput(additionalContext?: string, hookEventName?: string): HookOutput;
59
59
  /** Create a block output with reason. */
60
60
  export declare function blockOutput(reason: string): HookOutput;
61
61
  /** Create an escalate output (ask user for permission). */
@@ -8,11 +8,14 @@
8
8
  */
9
9
  // ── Output Helpers ─────────────────────────────────────────
10
10
  /** Create an allow output, optionally injecting text into the conversation. */
11
- export function allowOutput(additionalContext) {
11
+ export function allowOutput(additionalContext, hookEventName) {
12
12
  if (additionalContext) {
13
13
  return {
14
14
  continue: true,
15
- hookSpecificOutput: { additionalContext },
15
+ hookSpecificOutput: {
16
+ ...(hookEventName ? { hookEventName } : {}),
17
+ additionalContext,
18
+ },
16
19
  };
17
20
  }
18
21
  return { continue: true };
@@ -71,6 +71,8 @@ export interface TraceEntry {
71
71
  workflow?: string;
72
72
  step?: string;
73
73
  decision: "allow" | "block" | "warn";
74
+ reason?: string;
75
+ target_path?: string;
74
76
  duration_ms: number;
75
77
  timestamp: string;
76
78
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "intentdna",
3
- "version": "1.4.1",
3
+ "version": "1.4.3",
4
4
  "description": "Intent DNA — Declarative policy layer for AI agent behavior",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",