@aaac/runtime 0.1.55 → 0.2.0
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/README.md +6 -11
- package/dist/adapters/adk-sdk.d.ts +3 -3
- package/dist/adapters/adk-sdk.js +6 -8
- package/dist/adapters/adk-sdk.js.map +1 -1
- package/dist/adapters/claude-agent-sdk.d.ts +3 -3
- package/dist/adapters/claude-agent-sdk.js +22 -23
- package/dist/adapters/claude-agent-sdk.js.map +1 -1
- package/dist/adapters/mock.d.ts +2 -3
- package/dist/adapters/openai-agents-sdk.d.ts +3 -3
- package/dist/adapters/openai-agents-sdk.js +6 -5
- package/dist/adapters/openai-agents-sdk.js.map +1 -1
- package/dist/chunk-2INQL5TG.js +298 -0
- package/dist/chunk-2INQL5TG.js.map +1 -0
- package/dist/chunk-3CLWG72V.js +47 -0
- package/dist/chunk-3CLWG72V.js.map +1 -0
- package/dist/chunk-3DDB34BU.js +237 -0
- package/dist/chunk-3DDB34BU.js.map +1 -0
- package/dist/chunk-ABXDSTUV.js +685 -0
- package/dist/chunk-ABXDSTUV.js.map +1 -0
- package/dist/{chunk-3H3PVPPF.js → chunk-F5R46S7I.js} +151 -204
- package/dist/chunk-F5R46S7I.js.map +1 -0
- package/dist/chunk-FKAI54OM.js +234 -0
- package/dist/chunk-FKAI54OM.js.map +1 -0
- package/dist/chunk-KTVMMG33.js +1111 -0
- package/dist/chunk-KTVMMG33.js.map +1 -0
- package/dist/chunk-MSVIEEGR.js +269 -0
- package/dist/chunk-MSVIEEGR.js.map +1 -0
- package/dist/chunk-VJXGCWSZ.js +36 -0
- package/dist/chunk-VJXGCWSZ.js.map +1 -0
- package/dist/claude-bundles/full.js +311 -309
- package/dist/claude-bundles/lean.js +6 -6
- package/dist/claude-bundles/prompt.js +17 -0
- package/dist/generator/index.d.ts +2 -2
- package/dist/generator/index.js +8 -7
- package/dist/guardrail-hooks-CB23nhZV.d.ts +202 -0
- package/dist/hook-protocol-CFnNudiV.d.ts +96 -0
- package/dist/hooks-lite-CoWWnCRH.d.ts +428 -0
- package/dist/index-BlSepCSZ.d.ts +296 -0
- package/dist/index.d.ts +785 -105
- package/dist/index.js +2189 -634
- package/dist/index.js.map +1 -1
- package/dist/lib/claude-native/hooks-lite.d.ts +3 -26
- package/dist/lib/claude-native/hooks-lite.js +18 -36
- package/dist/lib/claude-native/hooks-prompt.d.ts +5 -0
- package/dist/lib/claude-native/hooks-prompt.js +33 -0
- package/dist/lib/claude-native/hooks-prompt.js.map +1 -0
- package/dist/lib/claude-native/index.d.ts +56 -214
- package/dist/lib/claude-native/index.js +79 -280
- package/dist/lib/claude-native/index.js.map +1 -1
- package/dist/{navigation-context-D_E1NIUf.d.ts → navigation-context-B-RpUg3_.d.ts} +1 -1
- package/dist/navigation-index-prompt-CbrS5laO.d.ts +43 -0
- package/dist/{task-runner-DfIEorkU.d.ts → task-runner-GWoI7_71.d.ts} +100 -493
- package/dist/workspace-user-prompt-submit-D11Iu0zO.d.ts +269 -0
- package/package.json +15 -6
- package/dist/chunk-3H3PVPPF.js.map +0 -1
- package/dist/chunk-DBM5XN67.js +0 -354
- package/dist/chunk-DBM5XN67.js.map +0 -1
- package/dist/chunk-KXGUWBGK.js +0 -370
- package/dist/chunk-KXGUWBGK.js.map +0 -1
- package/dist/chunk-LDCQZPDG.js +0 -11
- package/dist/chunk-LDCQZPDG.js.map +0 -1
- package/dist/chunk-N4KNGDYY.js +0 -1963
- package/dist/chunk-N4KNGDYY.js.map +0 -1
- package/dist/chunk-NMX4C6LC.js +0 -332
- package/dist/chunk-NMX4C6LC.js.map +0 -1
- package/dist/chunk-QVH5KKBR.js +0 -374
- package/dist/chunk-QVH5KKBR.js.map +0 -1
- package/dist/context-DKkamYX_.d.ts +0 -31
- package/dist/guardrail-hooks-slK-z0Dz.d.ts +0 -83
- package/dist/index-LqEvaRk-.d.ts +0 -299
- package/dist/workspace-pre-tool-use-C6nidc0q.d.ts +0 -333
package/dist/chunk-NMX4C6LC.js
DELETED
|
@@ -1,332 +0,0 @@
|
|
|
1
|
-
// src/lib/plugin.ts
|
|
2
|
-
var PluginRegistry = class {
|
|
3
|
-
plugins = [];
|
|
4
|
-
register(plugin) {
|
|
5
|
-
if (this.plugins.some((p) => p.id === plugin.id)) {
|
|
6
|
-
throw new Error(`Plugin "${plugin.id}" is already registered`);
|
|
7
|
-
}
|
|
8
|
-
this.plugins.push(plugin);
|
|
9
|
-
}
|
|
10
|
-
getAll() {
|
|
11
|
-
return this.plugins;
|
|
12
|
-
}
|
|
13
|
-
async runBeforeTask(taskId, context) {
|
|
14
|
-
let ctx = context;
|
|
15
|
-
for (const plugin of this.plugins) {
|
|
16
|
-
if (!plugin.beforeTask || ctx === null) continue;
|
|
17
|
-
ctx = await plugin.beforeTask(taskId, ctx);
|
|
18
|
-
}
|
|
19
|
-
return ctx;
|
|
20
|
-
}
|
|
21
|
-
async runAfterTask(taskId, outcome) {
|
|
22
|
-
let result = outcome;
|
|
23
|
-
for (const plugin of this.plugins) {
|
|
24
|
-
if (!plugin.afterTask) continue;
|
|
25
|
-
result = await plugin.afterTask(taskId, result);
|
|
26
|
-
}
|
|
27
|
-
return result;
|
|
28
|
-
}
|
|
29
|
-
applyContextEnhancers(taskId, context) {
|
|
30
|
-
let ctx = context;
|
|
31
|
-
for (const plugin of this.plugins) {
|
|
32
|
-
if (!plugin.contextEnhancer) continue;
|
|
33
|
-
ctx = plugin.contextEnhancer(taskId, ctx);
|
|
34
|
-
}
|
|
35
|
-
return ctx;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Try plugin promptBuilder hooks. Returns custom prompt if any plugin provides one,
|
|
39
|
-
* or null to use the default buildTaskPrompt.
|
|
40
|
-
*/
|
|
41
|
-
applyPromptBuilder(args) {
|
|
42
|
-
for (const plugin of this.plugins) {
|
|
43
|
-
if (!plugin.promptBuilder) continue;
|
|
44
|
-
const result = plugin.promptBuilder(args);
|
|
45
|
-
if (result !== null) return result;
|
|
46
|
-
}
|
|
47
|
-
return null;
|
|
48
|
-
}
|
|
49
|
-
applyPromptEnhancers(taskId, prompt, context) {
|
|
50
|
-
let enhanced = prompt;
|
|
51
|
-
for (const plugin of this.plugins) {
|
|
52
|
-
if (!plugin.promptEnhancer) continue;
|
|
53
|
-
enhanced = plugin.promptEnhancer(taskId, enhanced, context);
|
|
54
|
-
}
|
|
55
|
-
return enhanced;
|
|
56
|
-
}
|
|
57
|
-
evaluateCommandGuardrails(command) {
|
|
58
|
-
const results = [];
|
|
59
|
-
for (const plugin of this.plugins) {
|
|
60
|
-
if (!plugin.customGuardrails?.evaluateCommand) continue;
|
|
61
|
-
results.push(...plugin.customGuardrails.evaluateCommand(command));
|
|
62
|
-
}
|
|
63
|
-
return results;
|
|
64
|
-
}
|
|
65
|
-
evaluateFilePathGuardrails(filePath) {
|
|
66
|
-
const results = [];
|
|
67
|
-
for (const plugin of this.plugins) {
|
|
68
|
-
if (!plugin.customGuardrails?.evaluateFilePath) continue;
|
|
69
|
-
results.push(...plugin.customGuardrails.evaluateFilePath(filePath));
|
|
70
|
-
}
|
|
71
|
-
return results;
|
|
72
|
-
}
|
|
73
|
-
evaluateFileContentGuardrails(filePath, content) {
|
|
74
|
-
const results = [];
|
|
75
|
-
for (const plugin of this.plugins) {
|
|
76
|
-
if (!plugin.customGuardrails?.evaluateFileContent) continue;
|
|
77
|
-
results.push(...plugin.customGuardrails.evaluateFileContent(filePath, content));
|
|
78
|
-
}
|
|
79
|
-
return results;
|
|
80
|
-
}
|
|
81
|
-
async runBeforeWorkflow(workflowId, userRequest) {
|
|
82
|
-
for (const plugin of this.plugins) {
|
|
83
|
-
if (!plugin.beforeWorkflow) continue;
|
|
84
|
-
await plugin.beforeWorkflow(workflowId, userRequest);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
async runAfterWorkflow(workflowId, result) {
|
|
88
|
-
for (const plugin of this.plugins) {
|
|
89
|
-
if (!plugin.afterWorkflow) continue;
|
|
90
|
-
await plugin.afterWorkflow(workflowId, result);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
};
|
|
94
|
-
var pluginRegistry = new PluginRegistry();
|
|
95
|
-
|
|
96
|
-
// src/lib/guardrail-hooks.ts
|
|
97
|
-
function globFragmentToRegex(fragment) {
|
|
98
|
-
let out = "";
|
|
99
|
-
for (const ch of fragment) {
|
|
100
|
-
if (ch === "*") out += "[^/]*";
|
|
101
|
-
else if (ch === "?") out += "[^/]";
|
|
102
|
-
else if (".+^$|()[]\\".includes(ch)) out += "\\" + ch;
|
|
103
|
-
else out += ch;
|
|
104
|
-
}
|
|
105
|
-
return out;
|
|
106
|
-
}
|
|
107
|
-
function expandDirectoryPattern(pattern) {
|
|
108
|
-
return pattern.endsWith("/") ? `${pattern}**` : pattern;
|
|
109
|
-
}
|
|
110
|
-
function matchGlob(rawPattern, path) {
|
|
111
|
-
const pattern = expandDirectoryPattern(rawPattern);
|
|
112
|
-
let regex = "";
|
|
113
|
-
let i = 0;
|
|
114
|
-
while (i < pattern.length) {
|
|
115
|
-
if (pattern[i] === "*" && pattern[i + 1] === "*" && pattern[i + 2] === "/") {
|
|
116
|
-
regex += "(?:.+/)?";
|
|
117
|
-
i += 3;
|
|
118
|
-
} else if (pattern[i] === "*" && pattern[i + 1] === "*") {
|
|
119
|
-
regex += ".*";
|
|
120
|
-
i += 2;
|
|
121
|
-
} else if (pattern[i] === "*") {
|
|
122
|
-
regex += "[^/]*";
|
|
123
|
-
i += 1;
|
|
124
|
-
} else if (pattern[i] === "?") {
|
|
125
|
-
regex += "[^/]";
|
|
126
|
-
i += 1;
|
|
127
|
-
} else if (pattern[i] === "{") {
|
|
128
|
-
const end = pattern.indexOf("}", i);
|
|
129
|
-
if (end !== -1) {
|
|
130
|
-
const alts = pattern.slice(i + 1, end).split(",").map(globFragmentToRegex);
|
|
131
|
-
regex += "(?:" + alts.join("|") + ")";
|
|
132
|
-
i = end + 1;
|
|
133
|
-
} else {
|
|
134
|
-
regex += "\\{";
|
|
135
|
-
i += 1;
|
|
136
|
-
}
|
|
137
|
-
} else if (".+^$|()[]\\".includes(pattern[i])) {
|
|
138
|
-
regex += "\\" + pattern[i];
|
|
139
|
-
i += 1;
|
|
140
|
-
} else {
|
|
141
|
-
regex += pattern[i];
|
|
142
|
-
i += 1;
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
return new RegExp("^" + regex + "$").test(path);
|
|
146
|
-
}
|
|
147
|
-
function getBlockingViolations(results) {
|
|
148
|
-
return results.filter((r) => !r.passed && r.action === "block");
|
|
149
|
-
}
|
|
150
|
-
function getWarnings(results) {
|
|
151
|
-
return results.filter((r) => !r.passed && r.action === "warn");
|
|
152
|
-
}
|
|
153
|
-
function hasBlockingViolation(results) {
|
|
154
|
-
return results.some((r) => !r.passed && r.action === "block");
|
|
155
|
-
}
|
|
156
|
-
function pluginResultToCheckResult(r) {
|
|
157
|
-
return {
|
|
158
|
-
guardrail_id: r.guardrail_id,
|
|
159
|
-
passed: !r.matched,
|
|
160
|
-
action: r.action,
|
|
161
|
-
message: r.matched ? r.message : ""
|
|
162
|
-
};
|
|
163
|
-
}
|
|
164
|
-
function createGuardrailHooks(checks) {
|
|
165
|
-
function runChecks(ctx) {
|
|
166
|
-
const results = [];
|
|
167
|
-
if (ctx.command) {
|
|
168
|
-
results.push(...checks.checkCommand(ctx.command));
|
|
169
|
-
results.push(
|
|
170
|
-
...pluginRegistry.evaluateCommandGuardrails(ctx.command).map(pluginResultToCheckResult)
|
|
171
|
-
);
|
|
172
|
-
}
|
|
173
|
-
if (ctx.filePath) {
|
|
174
|
-
results.push(...checks.checkFilePath(ctx.filePath));
|
|
175
|
-
results.push(
|
|
176
|
-
...pluginRegistry.evaluateFilePathGuardrails(ctx.filePath).map(pluginResultToCheckResult)
|
|
177
|
-
);
|
|
178
|
-
}
|
|
179
|
-
if (ctx.filePath && ctx.content) {
|
|
180
|
-
results.push(...checks.checkContent(ctx.filePath, ctx.content));
|
|
181
|
-
results.push(
|
|
182
|
-
...pluginRegistry.evaluateFileContentGuardrails(ctx.filePath, ctx.content).map(pluginResultToCheckResult)
|
|
183
|
-
);
|
|
184
|
-
}
|
|
185
|
-
return results;
|
|
186
|
-
}
|
|
187
|
-
function beforeShellExecution(input) {
|
|
188
|
-
const command = input.command ?? "";
|
|
189
|
-
if (!command) return {};
|
|
190
|
-
const results = runChecks({ command });
|
|
191
|
-
const blocks = getBlockingViolations(results);
|
|
192
|
-
const warns = getWarnings(results);
|
|
193
|
-
if (blocks.length > 0) {
|
|
194
|
-
const msg = blocks.map((r) => `[${r.guardrail_id}] ${r.message}`).join("\n");
|
|
195
|
-
return { permission: "deny", user_message: msg, agent_message: msg };
|
|
196
|
-
}
|
|
197
|
-
if (warns.length > 0) {
|
|
198
|
-
return {
|
|
199
|
-
additionalContext: warns.map((r) => `[${r.guardrail_id}] ${r.message}`).join("\n")
|
|
200
|
-
};
|
|
201
|
-
}
|
|
202
|
-
return {};
|
|
203
|
-
}
|
|
204
|
-
function preToolUse(input) {
|
|
205
|
-
const filePath = input.tool_input?.file_path ?? input.tool_input?.path ?? "";
|
|
206
|
-
if (!filePath) return {};
|
|
207
|
-
const results = runChecks({ filePath });
|
|
208
|
-
const blocks = getBlockingViolations(results);
|
|
209
|
-
if (blocks.length > 0) {
|
|
210
|
-
const msg = blocks.map((r) => `[${r.guardrail_id}] ${r.message}`).join("\n");
|
|
211
|
-
return { permission: "deny", user_message: msg, agent_message: msg };
|
|
212
|
-
}
|
|
213
|
-
return {};
|
|
214
|
-
}
|
|
215
|
-
function afterFileEdit(input) {
|
|
216
|
-
const filePath = input.file_path ?? "";
|
|
217
|
-
const content = input.content ?? "";
|
|
218
|
-
if (!filePath) return {};
|
|
219
|
-
const results = runChecks({ filePath, content });
|
|
220
|
-
const blocks = getBlockingViolations(results);
|
|
221
|
-
if (blocks.length > 0) {
|
|
222
|
-
const msg = blocks.map((r) => `[${r.guardrail_id}] ${r.message}`).join("\n");
|
|
223
|
-
return { permission: "deny", user_message: msg, agent_message: msg };
|
|
224
|
-
}
|
|
225
|
-
return {};
|
|
226
|
-
}
|
|
227
|
-
return { beforeShellExecution, preToolUse, afterFileEdit, runChecks };
|
|
228
|
-
}
|
|
229
|
-
function createGuardrailHooksForAgent(agentId, perAgent) {
|
|
230
|
-
const rules = perAgent.get(agentId);
|
|
231
|
-
if (!rules) {
|
|
232
|
-
return createGuardrailHooks({
|
|
233
|
-
checkCommand: () => [],
|
|
234
|
-
checkFilePath: () => [],
|
|
235
|
-
checkContent: () => []
|
|
236
|
-
});
|
|
237
|
-
}
|
|
238
|
-
const hooks = createGuardrailHooksFromRules(rules);
|
|
239
|
-
const baseRunChecks = hooks.runChecks;
|
|
240
|
-
return {
|
|
241
|
-
...hooks,
|
|
242
|
-
runChecks(ctx) {
|
|
243
|
-
return baseRunChecks({ ...ctx, agentId });
|
|
244
|
-
}
|
|
245
|
-
};
|
|
246
|
-
}
|
|
247
|
-
function compileGuardrailPattern(pattern) {
|
|
248
|
-
if (pattern.startsWith("(?i)")) {
|
|
249
|
-
return new RegExp(pattern.slice(4), "i");
|
|
250
|
-
}
|
|
251
|
-
return new RegExp(pattern);
|
|
252
|
-
}
|
|
253
|
-
function createGuardrailHooksFromRules(rules) {
|
|
254
|
-
const commandChecks = rules.commandRules.map((rule) => ({
|
|
255
|
-
guardrail_id: rule.guardrail_id,
|
|
256
|
-
pattern: compileGuardrailPattern(rule.pattern),
|
|
257
|
-
action: rule.action,
|
|
258
|
-
message: rule.message
|
|
259
|
-
}));
|
|
260
|
-
const fileChecks = rules.fileRules;
|
|
261
|
-
const contentChecks = rules.contentRules.map((rule) => ({
|
|
262
|
-
guardrail_id: rule.guardrail_id,
|
|
263
|
-
pattern: compileGuardrailPattern(rule.pattern),
|
|
264
|
-
action: rule.action,
|
|
265
|
-
message: rule.message,
|
|
266
|
-
file_glob: rule.file_glob,
|
|
267
|
-
exclude_glob: rule.exclude_glob
|
|
268
|
-
}));
|
|
269
|
-
return createGuardrailHooks({
|
|
270
|
-
checkCommand(command) {
|
|
271
|
-
const results = [];
|
|
272
|
-
for (const check of commandChecks) {
|
|
273
|
-
const passed = !check.pattern.test(command);
|
|
274
|
-
results.push({
|
|
275
|
-
guardrail_id: check.guardrail_id,
|
|
276
|
-
passed,
|
|
277
|
-
action: check.action,
|
|
278
|
-
message: passed ? "" : check.message
|
|
279
|
-
});
|
|
280
|
-
}
|
|
281
|
-
return results;
|
|
282
|
-
},
|
|
283
|
-
checkFilePath(filePath) {
|
|
284
|
-
const results = [];
|
|
285
|
-
for (const check of fileChecks) {
|
|
286
|
-
if (check.exclude_glob && matchGlob(check.exclude_glob, filePath)) {
|
|
287
|
-
continue;
|
|
288
|
-
}
|
|
289
|
-
const matched = matchGlob(check.pattern, filePath);
|
|
290
|
-
results.push({
|
|
291
|
-
guardrail_id: check.guardrail_id,
|
|
292
|
-
passed: !matched,
|
|
293
|
-
action: check.action,
|
|
294
|
-
message: matched ? check.message : ""
|
|
295
|
-
});
|
|
296
|
-
}
|
|
297
|
-
return results;
|
|
298
|
-
},
|
|
299
|
-
checkContent(filePath, content) {
|
|
300
|
-
const results = [];
|
|
301
|
-
for (const check of contentChecks) {
|
|
302
|
-
if (check.file_glob && !matchGlob(check.file_glob, filePath)) {
|
|
303
|
-
continue;
|
|
304
|
-
}
|
|
305
|
-
if (check.exclude_glob && matchGlob(check.exclude_glob, filePath)) {
|
|
306
|
-
continue;
|
|
307
|
-
}
|
|
308
|
-
const matched = check.pattern.test(content);
|
|
309
|
-
results.push({
|
|
310
|
-
guardrail_id: check.guardrail_id,
|
|
311
|
-
passed: !matched,
|
|
312
|
-
action: check.action,
|
|
313
|
-
message: matched ? check.message : ""
|
|
314
|
-
});
|
|
315
|
-
}
|
|
316
|
-
return results;
|
|
317
|
-
}
|
|
318
|
-
});
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
export {
|
|
322
|
-
PluginRegistry,
|
|
323
|
-
pluginRegistry,
|
|
324
|
-
matchGlob,
|
|
325
|
-
getBlockingViolations,
|
|
326
|
-
getWarnings,
|
|
327
|
-
hasBlockingViolation,
|
|
328
|
-
createGuardrailHooks,
|
|
329
|
-
createGuardrailHooksForAgent,
|
|
330
|
-
createGuardrailHooksFromRules
|
|
331
|
-
};
|
|
332
|
-
//# sourceMappingURL=chunk-NMX4C6LC.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/lib/plugin.ts","../src/lib/guardrail-hooks.ts"],"sourcesContent":["/**\n * Plugin Interface — extension points for user code injection\n */\n\nimport type { TaskContext, TaskOutcome, AgentContractLike, TaskContractLike, PromptBuilderOptions } from \"./task-runner.js\";\nimport type { WorkflowResult } from \"./workflow-runner.js\";\n\nexport interface GuardrailResult {\n matched: boolean;\n guardrail_id: string;\n severity: \"critical\" | \"mandatory\" | \"warning\" | \"info\";\n action: \"block\" | \"warn\" | \"shadow\" | \"info\";\n message: string;\n}\n\nexport interface PromptBuilderArgs {\n agent: AgentContractLike;\n task: TaskContractLike;\n context: TaskContext;\n options?: PromptBuilderOptions;\n}\n\nexport interface AgentPlugin {\n readonly id: string;\n beforeTask?(taskId: string, context: TaskContext): Promise<TaskContext | null>;\n afterTask?(taskId: string, outcome: TaskOutcome): Promise<TaskOutcome>;\n /**\n * Enrich the structured TaskContext before prompt generation.\n * Unlike beforeTask (which can skip a task by returning null),\n * this hook is purely for context augmentation.\n */\n contextEnhancer?(taskId: string, context: TaskContext): TaskContext;\n /**\n * Lightweight prompt post-processor. Applied after the prompt is built.\n * Use for appending instructions or modifying sections.\n */\n promptEnhancer?(taskId: string, prompt: string, context: TaskContext): string;\n /**\n * Full prompt builder override. If provided and returns a non-null string,\n * replaces the default buildTaskPrompt output entirely.\n * Receives the agent/task contracts and context so the plugin can build\n * a completely custom prompt.\n */\n promptBuilder?(args: PromptBuilderArgs): string | null;\n customGuardrails?: {\n evaluateCommand?(command: string): GuardrailResult[];\n evaluateFilePath?(filePath: string): GuardrailResult[];\n evaluateFileContent?(filePath: string, content: string): GuardrailResult[];\n };\n beforeWorkflow?(workflowId: string, userRequest: string): Promise<void>;\n afterWorkflow?(workflowId: string, result: WorkflowResult): Promise<void>;\n}\n\nexport class PluginRegistry {\n private plugins: AgentPlugin[] = [];\n\n register(plugin: AgentPlugin): void {\n if (this.plugins.some((p) => p.id === plugin.id)) {\n throw new Error(`Plugin \"${plugin.id}\" is already registered`);\n }\n this.plugins.push(plugin);\n }\n\n getAll(): readonly AgentPlugin[] {\n return this.plugins;\n }\n\n async runBeforeTask(taskId: string, context: TaskContext): Promise<TaskContext | null> {\n let ctx: TaskContext | null = context;\n for (const plugin of this.plugins) {\n if (!plugin.beforeTask || ctx === null) continue;\n ctx = await plugin.beforeTask(taskId, ctx);\n }\n return ctx;\n }\n\n async runAfterTask(taskId: string, outcome: TaskOutcome): Promise<TaskOutcome> {\n let result = outcome;\n for (const plugin of this.plugins) {\n if (!plugin.afterTask) continue;\n result = await plugin.afterTask(taskId, result);\n }\n return result;\n }\n\n applyContextEnhancers(taskId: string, context: TaskContext): TaskContext {\n let ctx = context;\n for (const plugin of this.plugins) {\n if (!plugin.contextEnhancer) continue;\n ctx = plugin.contextEnhancer(taskId, ctx);\n }\n return ctx;\n }\n\n /**\n * Try plugin promptBuilder hooks. Returns custom prompt if any plugin provides one,\n * or null to use the default buildTaskPrompt.\n */\n applyPromptBuilder(args: PromptBuilderArgs): string | null {\n for (const plugin of this.plugins) {\n if (!plugin.promptBuilder) continue;\n const result = plugin.promptBuilder(args);\n if (result !== null) return result;\n }\n return null;\n }\n\n applyPromptEnhancers(taskId: string, prompt: string, context: TaskContext): string {\n let enhanced = prompt;\n for (const plugin of this.plugins) {\n if (!plugin.promptEnhancer) continue;\n enhanced = plugin.promptEnhancer(taskId, enhanced, context);\n }\n return enhanced;\n }\n\n evaluateCommandGuardrails(command: string): GuardrailResult[] {\n const results: GuardrailResult[] = [];\n for (const plugin of this.plugins) {\n if (!plugin.customGuardrails?.evaluateCommand) continue;\n results.push(...plugin.customGuardrails.evaluateCommand(command));\n }\n return results;\n }\n\n evaluateFilePathGuardrails(filePath: string): GuardrailResult[] {\n const results: GuardrailResult[] = [];\n for (const plugin of this.plugins) {\n if (!plugin.customGuardrails?.evaluateFilePath) continue;\n results.push(...plugin.customGuardrails.evaluateFilePath(filePath));\n }\n return results;\n }\n\n evaluateFileContentGuardrails(filePath: string, content: string): GuardrailResult[] {\n const results: GuardrailResult[] = [];\n for (const plugin of this.plugins) {\n if (!plugin.customGuardrails?.evaluateFileContent) continue;\n results.push(...plugin.customGuardrails.evaluateFileContent(filePath, content));\n }\n return results;\n }\n\n async runBeforeWorkflow(workflowId: string, userRequest: string): Promise<void> {\n for (const plugin of this.plugins) {\n if (!plugin.beforeWorkflow) continue;\n await plugin.beforeWorkflow(workflowId, userRequest);\n }\n }\n\n async runAfterWorkflow(workflowId: string, result: WorkflowResult): Promise<void> {\n for (const plugin of this.plugins) {\n if (!plugin.afterWorkflow) continue;\n await plugin.afterWorkflow(workflowId, result);\n }\n }\n}\n\nexport const pluginRegistry = new PluginRegistry();\n","/**\n * SDK Guardrail Hook Bridge — generic adapter from guardrail check functions\n * + plugin guardrails to SDK-compatible hook responses.\n *\n * Embedded guardrail rules are converted via createGuardrailHooksFromRules(),\n * which delegates to createGuardrailHooks(). All hook logic lives here.\n */\n\nimport { pluginRegistry } from \"./plugin.js\";\n\nexport interface GuardrailCheckResult {\n guardrail_id: string;\n passed: boolean;\n action: \"block\" | \"warn\" | \"shadow\" | \"info\";\n message: string;\n}\n\nexport interface HookResponse {\n permission?: \"deny\";\n user_message?: string;\n agent_message?: string;\n additionalContext?: string;\n}\n\nexport interface GuardrailRule {\n guardrail_id: string;\n pattern: string;\n action: \"block\" | \"warn\" | \"shadow\" | \"info\";\n message: string;\n file_glob?: string;\n exclude_glob?: string;\n}\n\nexport interface GuardrailRuleData {\n commandRules: GuardrailRule[];\n fileRules: GuardrailRule[];\n contentRules: GuardrailRule[];\n}\n\nexport interface GuardrailCheckFunctions {\n checkCommand: (command: string) => GuardrailCheckResult[];\n checkFilePath: (filePath: string) => GuardrailCheckResult[];\n checkContent: (filePath: string, content: string) => GuardrailCheckResult[];\n}\n\nfunction globFragmentToRegex(fragment: string): string {\n let out = \"\";\n for (const ch of fragment) {\n if (ch === \"*\") out += \"[^/]*\";\n else if (ch === \"?\") out += \"[^/]\";\n else if (\".+^$|()[]\\\\\".includes(ch)) out += \"\\\\\" + ch;\n else out += ch;\n }\n return out;\n}\n\n/**\n * A pattern ending in `/` denotes a DIRECTORY and matches everything under it\n * (#262). This is the dominant style in artifact `path_patterns` — the embedded\n * dev-team DSL (`src/`, `lib/`, `tests/`, `.cursor/rules/`) and every\n * artifact-contracts registry rely on it. Without this, such a pattern compiles\n * to `^src/$`, which no file path can ever equal, so path → artifact reverse\n * lookup silently matched nothing and the artifact edit guard never fired.\n *\n * The rewrite is monotonic: file paths never end in `/`, so a pattern that\n * matched something before still matches exactly the same paths.\n */\nfunction expandDirectoryPattern(pattern: string): string {\n return pattern.endsWith(\"/\") ? `${pattern}**` : pattern;\n}\n\nexport function matchGlob(rawPattern: string, path: string): boolean {\n const pattern = expandDirectoryPattern(rawPattern);\n let regex = \"\";\n let i = 0;\n while (i < pattern.length) {\n if (pattern[i] === \"*\" && pattern[i + 1] === \"*\" && pattern[i + 2] === \"/\") {\n regex += \"(?:.+/)?\";\n i += 3;\n } else if (pattern[i] === \"*\" && pattern[i + 1] === \"*\") {\n regex += \".*\";\n i += 2;\n } else if (pattern[i] === \"*\") {\n regex += \"[^/]*\";\n i += 1;\n } else if (pattern[i] === \"?\") {\n regex += \"[^/]\";\n i += 1;\n } else if (pattern[i] === \"{\") {\n const end = pattern.indexOf(\"}\", i);\n if (end !== -1) {\n const alts = pattern.slice(i + 1, end).split(\",\").map(globFragmentToRegex);\n regex += \"(?:\" + alts.join(\"|\") + \")\";\n i = end + 1;\n } else {\n regex += \"\\\\{\";\n i += 1;\n }\n } else if (\".+^$|()[]\\\\\".includes(pattern[i])) {\n regex += \"\\\\\" + pattern[i];\n i += 1;\n } else {\n regex += pattern[i];\n i += 1;\n }\n }\n return new RegExp(\"^\" + regex + \"$\").test(path);\n}\n\nexport interface HookContext {\n /** Agent id for per-agent guardrail filtering. */\n agentId?: string;\n command?: string;\n filePath?: string;\n content?: string;\n}\n\nexport interface GuardrailHooks {\n beforeShellExecution: (input: { command?: string }) => HookResponse;\n preToolUse: (input: {\n tool_name?: string;\n tool_input?: { file_path?: string; path?: string };\n }) => HookResponse;\n afterFileEdit: (input: { file_path?: string; content?: string }) => HookResponse;\n runChecks: (ctx: HookContext) => GuardrailCheckResult[];\n}\n\nexport function getBlockingViolations(results: GuardrailCheckResult[]): GuardrailCheckResult[] {\n return results.filter((r) => !r.passed && r.action === \"block\");\n}\n\nexport function getWarnings(results: GuardrailCheckResult[]): GuardrailCheckResult[] {\n return results.filter((r) => !r.passed && r.action === \"warn\");\n}\n\nexport function hasBlockingViolation(results: GuardrailCheckResult[]): boolean {\n return results.some((r) => !r.passed && r.action === \"block\");\n}\n\nfunction pluginResultToCheckResult(r: {\n matched: boolean;\n guardrail_id: string;\n action: string;\n message: string;\n}): GuardrailCheckResult {\n return {\n guardrail_id: r.guardrail_id,\n passed: !r.matched,\n action: r.action as GuardrailCheckResult[\"action\"],\n message: r.matched ? r.message : \"\",\n };\n}\n\n/**\n * Create SDK hook functions from generated guardrail check functions.\n *\n * Merges DSL-generated checks with plugin-registered guardrails and\n * returns hook functions in the format expected by the Claude SDK,\n * plus a generic runChecks() for programmatic use.\n */\nexport function createGuardrailHooks(checks: GuardrailCheckFunctions): GuardrailHooks {\n function runChecks(ctx: HookContext): GuardrailCheckResult[] {\n const results: GuardrailCheckResult[] = [];\n\n if (ctx.command) {\n results.push(...checks.checkCommand(ctx.command));\n results.push(\n ...pluginRegistry.evaluateCommandGuardrails(ctx.command).map(pluginResultToCheckResult),\n );\n }\n\n if (ctx.filePath) {\n results.push(...checks.checkFilePath(ctx.filePath));\n results.push(\n ...pluginRegistry.evaluateFilePathGuardrails(ctx.filePath).map(pluginResultToCheckResult),\n );\n }\n\n if (ctx.filePath && ctx.content) {\n results.push(...checks.checkContent(ctx.filePath, ctx.content));\n results.push(\n ...pluginRegistry\n .evaluateFileContentGuardrails(ctx.filePath, ctx.content)\n .map(pluginResultToCheckResult),\n );\n }\n\n return results;\n }\n\n function beforeShellExecution(input: { command?: string }): HookResponse {\n const command = input.command ?? \"\";\n if (!command) return {};\n\n const results = runChecks({ command });\n const blocks = getBlockingViolations(results);\n const warns = getWarnings(results);\n\n if (blocks.length > 0) {\n const msg = blocks.map((r) => `[${r.guardrail_id}] ${r.message}`).join(\"\\n\");\n return { permission: \"deny\", user_message: msg, agent_message: msg };\n }\n\n if (warns.length > 0) {\n return {\n additionalContext: warns.map((r) => `[${r.guardrail_id}] ${r.message}`).join(\"\\n\"),\n };\n }\n\n return {};\n }\n\n function preToolUse(input: {\n tool_name?: string;\n tool_input?: { file_path?: string; path?: string };\n }): HookResponse {\n const filePath = input.tool_input?.file_path ?? input.tool_input?.path ?? \"\";\n if (!filePath) return {};\n\n const results = runChecks({ filePath });\n const blocks = getBlockingViolations(results);\n\n if (blocks.length > 0) {\n const msg = blocks.map((r) => `[${r.guardrail_id}] ${r.message}`).join(\"\\n\");\n return { permission: \"deny\", user_message: msg, agent_message: msg };\n }\n\n return {};\n }\n\n function afterFileEdit(input: { file_path?: string; content?: string }): HookResponse {\n const filePath = input.file_path ?? \"\";\n const content = input.content ?? \"\";\n if (!filePath) return {};\n\n const results = runChecks({ filePath, content });\n const blocks = getBlockingViolations(results);\n\n if (blocks.length > 0) {\n const msg = blocks.map((r) => `[${r.guardrail_id}] ${r.message}`).join(\"\\n\");\n return { permission: \"deny\", user_message: msg, agent_message: msg };\n }\n\n return {};\n }\n\n return { beforeShellExecution, preToolUse, afterFileEdit, runChecks };\n}\n\n/**\n * Create SDK hook functions from embedded guardrail rule data.\n */\n/**\n * Create SDK hooks scoped to a single agent from a per-agent guardrail map.\n * Returns empty-passing hooks when the agent has no rules in the map.\n */\nexport function createGuardrailHooksForAgent(\n agentId: string,\n perAgent: Map<string, GuardrailRuleData>,\n): GuardrailHooks {\n const rules = perAgent.get(agentId);\n if (!rules) {\n return createGuardrailHooks({\n checkCommand: () => [],\n checkFilePath: () => [],\n checkContent: () => [],\n });\n }\n const hooks = createGuardrailHooksFromRules(rules);\n const baseRunChecks = hooks.runChecks;\n return {\n ...hooks,\n runChecks(ctx: HookContext) {\n return baseRunChecks({ ...ctx, agentId });\n },\n };\n}\n\n/** Compile a guardrail regex pattern, supporting inline `(?i)` case-insensitivity prefix. */\nexport function compileGuardrailPattern(pattern: string): RegExp {\n if (pattern.startsWith(\"(?i)\")) {\n return new RegExp(pattern.slice(4), \"i\");\n }\n return new RegExp(pattern);\n}\n\nexport function createGuardrailHooksFromRules(rules: GuardrailRuleData): GuardrailHooks {\n const commandChecks = rules.commandRules.map((rule) => ({\n guardrail_id: rule.guardrail_id,\n pattern: compileGuardrailPattern(rule.pattern),\n action: rule.action,\n message: rule.message,\n }));\n\n const fileChecks = rules.fileRules;\n\n const contentChecks = rules.contentRules.map((rule) => ({\n guardrail_id: rule.guardrail_id,\n pattern: compileGuardrailPattern(rule.pattern),\n action: rule.action,\n message: rule.message,\n file_glob: rule.file_glob,\n exclude_glob: rule.exclude_glob,\n }));\n\n return createGuardrailHooks({\n checkCommand(command: string): GuardrailCheckResult[] {\n const results: GuardrailCheckResult[] = [];\n for (const check of commandChecks) {\n const passed = !check.pattern.test(command);\n results.push({\n guardrail_id: check.guardrail_id,\n passed,\n action: check.action,\n message: passed ? \"\" : check.message,\n });\n }\n return results;\n },\n\n checkFilePath(filePath: string): GuardrailCheckResult[] {\n const results: GuardrailCheckResult[] = [];\n for (const check of fileChecks) {\n if (check.exclude_glob && matchGlob(check.exclude_glob, filePath)) {\n continue;\n }\n const matched = matchGlob(check.pattern, filePath);\n results.push({\n guardrail_id: check.guardrail_id,\n passed: !matched,\n action: check.action,\n message: matched ? check.message : \"\",\n });\n }\n return results;\n },\n\n checkContent(filePath: string, content: string): GuardrailCheckResult[] {\n const results: GuardrailCheckResult[] = [];\n for (const check of contentChecks) {\n if (check.file_glob && !matchGlob(check.file_glob, filePath)) {\n continue;\n }\n if (check.exclude_glob && matchGlob(check.exclude_glob, filePath)) {\n continue;\n }\n const matched = check.pattern.test(content);\n results.push({\n guardrail_id: check.guardrail_id,\n passed: !matched,\n action: check.action,\n message: matched ? check.message : \"\",\n });\n }\n return results;\n },\n });\n}\n"],"mappings":";AAqDO,IAAM,iBAAN,MAAqB;AAAA,EAClB,UAAyB,CAAC;AAAA,EAElC,SAAS,QAA2B;AAClC,QAAI,KAAK,QAAQ,KAAK,CAAC,MAAM,EAAE,OAAO,OAAO,EAAE,GAAG;AAChD,YAAM,IAAI,MAAM,WAAW,OAAO,EAAE,yBAAyB;AAAA,IAC/D;AACA,SAAK,QAAQ,KAAK,MAAM;AAAA,EAC1B;AAAA,EAEA,SAAiC;AAC/B,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,MAAM,cAAc,QAAgB,SAAmD;AACrF,QAAI,MAA0B;AAC9B,eAAW,UAAU,KAAK,SAAS;AACjC,UAAI,CAAC,OAAO,cAAc,QAAQ,KAAM;AACxC,YAAM,MAAM,OAAO,WAAW,QAAQ,GAAG;AAAA,IAC3C;AACA,WAAO;AAAA,EACT;AAAA,EAEA,MAAM,aAAa,QAAgB,SAA4C;AAC7E,QAAI,SAAS;AACb,eAAW,UAAU,KAAK,SAAS;AACjC,UAAI,CAAC,OAAO,UAAW;AACvB,eAAS,MAAM,OAAO,UAAU,QAAQ,MAAM;AAAA,IAChD;AACA,WAAO;AAAA,EACT;AAAA,EAEA,sBAAsB,QAAgB,SAAmC;AACvE,QAAI,MAAM;AACV,eAAW,UAAU,KAAK,SAAS;AACjC,UAAI,CAAC,OAAO,gBAAiB;AAC7B,YAAM,OAAO,gBAAgB,QAAQ,GAAG;AAAA,IAC1C;AACA,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AA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