bosun 0.41.10 → 0.42.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/agent/agent-hooks.mjs +56 -1
- package/agent/hook-library.mjs +1383 -0
- package/agent/hook-profiles.mjs +55 -3
- package/infra/library-manager.mjs +4 -2
- package/package.json +4 -1
- package/server/ui-server.mjs +239 -7
- package/ui/tabs/workflows.js +260 -10
- package/workflow/execution-ledger.mjs +140 -0
- package/workflow/workflow-engine.mjs +635 -27
- package/workflow/workflow-nodes.mjs +126 -42
package/agent/agent-hooks.mjs
CHANGED
|
@@ -144,7 +144,7 @@ export const HOOK_EVENTS = Object.freeze([
|
|
|
144
144
|
* Canonical SDK names.
|
|
145
145
|
* @type {readonly string[]}
|
|
146
146
|
*/
|
|
147
|
-
const VALID_SDKS = Object.freeze(["codex", "copilot", "claude", "opencode"]);
|
|
147
|
+
const VALID_SDKS = Object.freeze(["codex", "copilot", "claude", "opencode", "gemini"]);
|
|
148
148
|
|
|
149
149
|
/**
|
|
150
150
|
* Wildcard indicating a hook applies to all SDKs.
|
|
@@ -1198,3 +1198,58 @@ function _truncate(str, maxLen) {
|
|
|
1198
1198
|
if (!str || str.length <= maxLen) return str ?? "";
|
|
1199
1199
|
return str.slice(0, maxLen) + "\n... (truncated)";
|
|
1200
1200
|
}
|
|
1201
|
+
|
|
1202
|
+
// ── Hook Library Integration ────────────────────────────────────────────────
|
|
1203
|
+
|
|
1204
|
+
/**
|
|
1205
|
+
* Register hooks from the hook-library into the agent-hooks runtime registry.
|
|
1206
|
+
* This bridges the declarative hook catalog with the execution engine.
|
|
1207
|
+
*
|
|
1208
|
+
* @param {Record<string, Array<{id: string, command: string, description?: string, timeout?: number, blocking?: boolean, sdks?: string[], builtin?: boolean, retryable?: boolean, maxRetries?: number, env?: Record<string,string>}>>} hooksByEvent
|
|
1209
|
+
* - Output of getHooksForRegistration() from hook-library.mjs
|
|
1210
|
+
* @returns {{ registered: number, skipped: number }}
|
|
1211
|
+
*/
|
|
1212
|
+
export function registerLibraryHooks(hooksByEvent) {
|
|
1213
|
+
let registered = 0;
|
|
1214
|
+
let skipped = 0;
|
|
1215
|
+
|
|
1216
|
+
if (!hooksByEvent || typeof hooksByEvent !== "object") {
|
|
1217
|
+
return { registered, skipped };
|
|
1218
|
+
}
|
|
1219
|
+
|
|
1220
|
+
for (const [event, hooks] of Object.entries(hooksByEvent)) {
|
|
1221
|
+
if (!HOOK_EVENTS.includes(event)) {
|
|
1222
|
+
console.warn(`${TAG} unknown hook event from library: ${event}`);
|
|
1223
|
+
skipped += hooks.length;
|
|
1224
|
+
continue;
|
|
1225
|
+
}
|
|
1226
|
+
|
|
1227
|
+
for (const hook of hooks) {
|
|
1228
|
+
// Skip if a hook with this ID is already registered (built-in takes priority)
|
|
1229
|
+
const existing = (_registry.get(event) ?? []).find((h) => h.id === hook.id);
|
|
1230
|
+
if (existing) {
|
|
1231
|
+
skipped++;
|
|
1232
|
+
continue;
|
|
1233
|
+
}
|
|
1234
|
+
|
|
1235
|
+
registerHook(event, {
|
|
1236
|
+
id: hook.id,
|
|
1237
|
+
command: hook.command,
|
|
1238
|
+
description: hook.description ?? "",
|
|
1239
|
+
timeout: hook.timeout ?? DEFAULT_TIMEOUT_MS,
|
|
1240
|
+
blocking: hook.blocking ?? false,
|
|
1241
|
+
sdks: hook.sdks ?? [SDK_WILDCARD],
|
|
1242
|
+
builtin: hook.builtin ?? false,
|
|
1243
|
+
retryable: hook.retryable ?? false,
|
|
1244
|
+
maxRetries: hook.maxRetries,
|
|
1245
|
+
env: hook.env,
|
|
1246
|
+
});
|
|
1247
|
+
registered++;
|
|
1248
|
+
}
|
|
1249
|
+
}
|
|
1250
|
+
|
|
1251
|
+
if (registered > 0) {
|
|
1252
|
+
console.log(`${TAG} registered ${registered} hook(s) from hook library`);
|
|
1253
|
+
}
|
|
1254
|
+
return { registered, skipped };
|
|
1255
|
+
}
|