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.
- package/.claude-plugin/hooks/hooks.json +8 -8
- package/.claude-plugin/marketplace.json +6 -2
- package/.claude-plugin/plugin.json +1 -1
- package/dist/hooks/cli.js +6 -0
- package/dist/hooks/enforce.js +1 -1
- package/dist/hooks/protocol.d.ts +1 -1
- package/dist/hooks/protocol.js +5 -2
- package/dist/hooks/state.d.ts +2 -0
- package/package.json +1 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"hooks": {
|
|
3
|
-
"PreToolUse": [{ "matcher": "*", "hooks": [{ "type": "command", "command": "dna-hook PreToolUse", "timeout":
|
|
4
|
-
"PostToolUse": [{ "matcher": "*", "hooks": [{ "type": "command", "command": "dna-hook PostToolUse", "timeout":
|
|
5
|
-
"UserPromptSubmit": [{ "matcher": "*", "hooks": [{ "type": "command", "command": "dna-hook UserPromptSubmit", "timeout":
|
|
6
|
-
"SubagentStop": [{ "matcher": "*", "hooks": [{ "type": "command", "command": "dna-hook SubagentStop", "timeout":
|
|
7
|
-
"PreCompact": [{ "matcher": "*", "hooks": [{ "type": "command", "command": "dna-hook PreCompact", "timeout":
|
|
8
|
-
"Notification": [{ "matcher": "*", "hooks": [{ "type": "command", "command": "dna-hook Notification", "timeout":
|
|
9
|
-
"Stop": [{ "matcher": "*", "hooks": [{ "type": "command", "command": "dna-hook Stop", "timeout":
|
|
10
|
-
"SessionStart": [{ "matcher": "*", "hooks": [{ "type": "command", "command": "dna-hook SessionStart", "timeout":
|
|
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
|
|
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.
|
|
12
|
+
"version": "1.4.3",
|
|
9
13
|
"source": "./"
|
|
10
14
|
}
|
|
11
15
|
]
|
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
|
package/dist/hooks/enforce.js
CHANGED
|
@@ -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.
|
package/dist/hooks/protocol.d.ts
CHANGED
|
@@ -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). */
|
package/dist/hooks/protocol.js
CHANGED
|
@@ -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: {
|
|
15
|
+
hookSpecificOutput: {
|
|
16
|
+
...(hookEventName ? { hookEventName } : {}),
|
|
17
|
+
additionalContext,
|
|
18
|
+
},
|
|
16
19
|
};
|
|
17
20
|
}
|
|
18
21
|
return { continue: true };
|
package/dist/hooks/state.d.ts
CHANGED