@proletariat/cli 0.3.102 → 0.3.103

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,17 +1,18 @@
1
1
  /**
2
2
  * Orchestrate Engine
3
3
  *
4
- * The core daemon loop that:
5
- * 1. Loads hook configuration from DB (synced from YAML/presets/CLI)
6
- * 2. Subscribes to EventBus events
7
- * 3. Executes matching hooks with mode-aware behavior
8
- * 4. Optionally polls external sources for events
4
+ * Thin orchestration layer that configures a HookManager with mode-aware
5
+ * execution, built-in action handlers, and confirmation routing.
9
6
  *
10
- * The engine extends the existing HookManager with mode support
11
- * and built-in action execution.
7
+ * The engine itself handles:
8
+ * - Configuring HookManager with the correct callbacks and action handlers
9
+ * - Exposing the OrchestrateActionResult API expected by callers
10
+ * - Start/stop lifecycle management
11
+ *
12
+ * All hook matching, mode checking, and execution is delegated to HookManager.
12
13
  */
13
14
  import type Database from 'better-sqlite3';
14
- import type { OrchestrateEventContext, OrchestrateActionResult } from './types.js';
15
+ import type { OrchestrateActionResult } from './types.js';
15
16
  export interface OrchestrateEngineOptions {
16
17
  /** Database connection */
17
18
  db: Database.Database;
@@ -23,17 +24,11 @@ export interface OrchestrateEngineOptions {
23
24
  onNotify?: (hookName: string, event: string, action: string, result: OrchestrateActionResult) => void;
24
25
  }
25
26
  export declare class OrchestrateEngine {
26
- private db;
27
- private hookStorage;
28
- private unsubscribers;
29
- private log;
30
- private onConfirm?;
31
- private onNotify?;
27
+ private manager;
32
28
  private running;
33
- private pendingConfirmations;
34
29
  constructor(options: OrchestrateEngineOptions);
35
30
  /**
36
- * Start the orchestrate engine — subscribe to all orchestrate events.
31
+ * Start the orchestrate engine — delegates to HookManager.
37
32
  */
38
33
  start(): void;
39
34
  /**
@@ -44,11 +39,17 @@ export declare class OrchestrateEngine {
44
39
  * Fire an event manually (used by `prlt hook fire`).
45
40
  * This is the entry point for external event sources (GitHub Actions, polling, etc.).
46
41
  */
47
- fireEvent(event: string, ctx: OrchestrateEventContext): Promise<OrchestrateActionResult[]>;
42
+ fireEvent(event: string, ctx: Record<string, unknown>): Promise<OrchestrateActionResult[]>;
48
43
  /**
49
44
  * Get pending confirmations for hooks in confirm mode.
50
45
  */
51
- getPendingConfirmations(): typeof this.pendingConfirmations;
46
+ getPendingConfirmations(): Array<{
47
+ hookName: string;
48
+ event: string;
49
+ action: string;
50
+ ctx: Record<string, unknown>;
51
+ config?: Record<string, unknown>;
52
+ }>;
52
53
  /**
53
54
  * Approve a pending confirmation and execute it.
54
55
  */
@@ -57,27 +58,6 @@ export declare class OrchestrateEngine {
57
58
  * Deny a pending confirmation.
58
59
  */
59
60
  denyConfirmation(index: number): boolean;
60
- /**
61
- * Handle an event by finding and executing matching hooks.
62
- */
63
- private handleEvent;
64
- /**
65
- * Get hooks for a given event from the database, ordered by priority.
66
- */
67
- private getHooksForEvent;
68
- /**
69
- * Build an OrchestrateEventContext from raw event data.
70
- */
71
- private buildContext;
72
- /**
73
- * Resolve the action name from a hook row.
74
- * Built-in actions are referenced by name; shell hooks use the raw command.
75
- */
76
- private resolveActionName;
77
- /**
78
- * Execute an action — either built-in or shell fallback.
79
- */
80
- private executeAction;
81
61
  }
82
62
  /**
83
63
  * Initialize and start the orchestrate engine.
@@ -1,263 +1,99 @@
1
1
  /**
2
2
  * Orchestrate Engine
3
3
  *
4
- * The core daemon loop that:
5
- * 1. Loads hook configuration from DB (synced from YAML/presets/CLI)
6
- * 2. Subscribes to EventBus events
7
- * 3. Executes matching hooks with mode-aware behavior
8
- * 4. Optionally polls external sources for events
4
+ * Thin orchestration layer that configures a HookManager with mode-aware
5
+ * execution, built-in action handlers, and confirmation routing.
9
6
  *
10
- * The engine extends the existing HookManager with mode support
11
- * and built-in action execution.
7
+ * The engine itself handles:
8
+ * - Configuring HookManager with the correct callbacks and action handlers
9
+ * - Exposing the OrchestrateActionResult API expected by callers
10
+ * - Start/stop lifecycle management
11
+ *
12
+ * All hook matching, mode checking, and execution is delegated to HookManager.
12
13
  */
13
- import { execSync } from 'node:child_process';
14
- import { getEventBus } from '../events/event-bus.js';
15
- import { WorkHookStorage } from '../work-lifecycle/hooks/storage.js';
16
- import { executeBuiltinAction, ACTION_HANDLERS } from './actions.js';
14
+ import { HookManager } from '../work-lifecycle/hooks/manager.js';
15
+ import { ACTION_HANDLERS } from './actions.js';
17
16
  export class OrchestrateEngine {
18
- db;
19
- hookStorage;
20
- unsubscribers = [];
21
- log;
22
- onConfirm;
23
- onNotify;
17
+ manager;
24
18
  running = false;
25
- pendingConfirmations = [];
26
19
  constructor(options) {
27
- this.db = options.db;
28
- this.hookStorage = new WorkHookStorage(options.db);
29
- this.log = options.log ?? (() => { });
30
- this.onConfirm = options.onConfirm;
31
- this.onNotify = options.onNotify;
20
+ // Map OrchestrateActionResult-based onNotify to HookExecutionResult-based onNotify
21
+ const onNotify = options.onNotify
22
+ ? (hookName, event, action, result) => {
23
+ options.onNotify(hookName, event, action, toActionResult(result));
24
+ }
25
+ : undefined;
26
+ this.manager = new HookManager({
27
+ db: options.db,
28
+ log: options.log,
29
+ onConfirm: options.onConfirm,
30
+ onNotify,
31
+ actionHandlers: ACTION_HANDLERS,
32
+ });
32
33
  }
33
34
  /**
34
- * Start the orchestrate engine — subscribe to all orchestrate events.
35
+ * Start the orchestrate engine — delegates to HookManager.
35
36
  */
36
37
  start() {
37
38
  if (this.running)
38
39
  return;
39
40
  this.running = true;
40
- const bus = getEventBus();
41
- // Subscribe to standard RuntimeEventMap events
42
- const standardEvents = [
43
- 'work:started',
44
- 'work:status_changed',
45
- 'work:pr_created',
46
- 'work:pr_merged',
47
- 'work:pr_closed',
48
- 'work:completed',
49
- 'agent:spawned',
50
- 'agent:stopped',
51
- ];
52
- for (const eventName of standardEvents) {
53
- this.unsubscribers.push(bus.on(eventName, (payload) => {
54
- void this.handleEvent(eventName, payload);
55
- }));
56
- }
57
- this.log('[orchestrate] Engine started, listening for events');
41
+ this.manager.start();
42
+ // Log is internal to the manager, but we can't access it here easily.
43
+ // The manager's log callback will handle logging.
58
44
  }
59
45
  /**
60
46
  * Stop the engine and clean up subscriptions.
61
47
  */
62
48
  stop() {
63
49
  this.running = false;
64
- for (const unsub of this.unsubscribers) {
65
- unsub();
66
- }
67
- this.unsubscribers = [];
68
- this.pendingConfirmations = [];
69
- this.log('[orchestrate] Engine stopped');
50
+ this.manager.stop();
70
51
  }
71
52
  /**
72
53
  * Fire an event manually (used by `prlt hook fire`).
73
54
  * This is the entry point for external event sources (GitHub Actions, polling, etc.).
74
55
  */
75
56
  async fireEvent(event, ctx) {
76
- return this.handleEvent(event, ctx);
57
+ const results = await this.manager.fireEvent(event, ctx);
58
+ return results.map(toActionResult);
77
59
  }
78
60
  /**
79
61
  * Get pending confirmations for hooks in confirm mode.
80
62
  */
81
63
  getPendingConfirmations() {
82
- return [...this.pendingConfirmations];
64
+ return this.manager.getPendingConfirmations();
83
65
  }
84
66
  /**
85
67
  * Approve a pending confirmation and execute it.
86
68
  */
87
69
  async approveConfirmation(index) {
88
- if (index < 0 || index >= this.pendingConfirmations.length)
89
- return null;
90
- const pending = this.pendingConfirmations.splice(index, 1)[0];
91
- const result = executeBuiltinAction(pending.action, pending.ctx, pending.config);
92
- this.log(`[orchestrate] Approved: ${pending.hookName} → ${pending.action} (${result.success ? 'success' : 'failed'})`);
93
- return result;
70
+ const result = await this.manager.approveConfirmation(index);
71
+ return result ? toActionResult(result) : null;
94
72
  }
95
73
  /**
96
74
  * Deny a pending confirmation.
97
75
  */
98
76
  denyConfirmation(index) {
99
- if (index < 0 || index >= this.pendingConfirmations.length)
100
- return false;
101
- const pending = this.pendingConfirmations.splice(index, 1)[0];
102
- this.log(`[orchestrate] Denied: ${pending.hookName} → ${pending.action}`);
103
- return true;
104
- }
105
- // ===========================================================================
106
- // Private
107
- // ===========================================================================
108
- /**
109
- * Handle an event by finding and executing matching hooks.
110
- */
111
- async handleEvent(eventName, eventData) {
112
- const results = [];
113
- try {
114
- // Query hooks matching this event, ordered by priority
115
- const hooks = this.getHooksForEvent(eventName);
116
- if (hooks.length === 0)
117
- return results;
118
- // Build event context from the payload
119
- const ctx = this.buildContext(eventName, eventData);
120
- for (const hook of hooks) {
121
- const mode = (hook.mode || 'auto');
122
- const config = hook.config ? JSON.parse(hook.config) : undefined;
123
- // Determine action — either a built-in action name or the raw action_value
124
- const actionName = this.resolveActionName(hook);
125
- if (mode === 'off') {
126
- results.push({ action: actionName, success: true, durationMs: 0, skipped: true });
127
- continue;
128
- }
129
- if (mode === 'confirm') {
130
- // Queue for confirmation
131
- if (this.onConfirm) {
132
- const approved = await this.onConfirm(hook.name, eventName, actionName);
133
- if (!approved) {
134
- this.log(`[orchestrate] Skipped (not confirmed): ${hook.name} → ${actionName}`);
135
- results.push({ action: actionName, success: true, durationMs: 0, skipped: true });
136
- continue;
137
- }
138
- }
139
- else {
140
- // No confirm handler — queue for later approval
141
- this.pendingConfirmations.push({
142
- hookName: hook.name,
143
- event: eventName,
144
- action: actionName,
145
- ctx,
146
- config,
147
- });
148
- this.log(`[orchestrate] Queued for confirmation: ${hook.name} → ${actionName}`);
149
- results.push({ action: actionName, success: true, durationMs: 0, awaitingConfirmation: true });
150
- continue;
151
- }
152
- }
153
- // Execute the action
154
- const result = this.executeAction(actionName, ctx, config);
155
- results.push(result);
156
- this.log(`[orchestrate] ${hook.name} → ${actionName}: ${result.success ? 'success' : `failed: ${result.error}`} (${result.durationMs}ms)`);
157
- // For notify mode, also fire the notification callback
158
- if (mode === 'notify' && this.onNotify) {
159
- this.onNotify(hook.name, eventName, actionName, result);
160
- }
161
- }
162
- }
163
- catch (err) {
164
- this.log(`[orchestrate] Error handling event ${eventName}: ${err instanceof Error ? err.message : String(err)}`);
165
- }
166
- return results;
167
- }
168
- /**
169
- * Get hooks for a given event from the database, ordered by priority.
170
- */
171
- getHooksForEvent(eventName) {
172
- try {
173
- return this.db.prepare(`
174
- SELECT id, name, event, action_type, action_value, enabled, description, mode, priority, config
175
- FROM pmo_work_hooks
176
- WHERE event = ? AND enabled = 1
177
- ORDER BY priority ASC, created_at ASC
178
- `).all(eventName);
179
- }
180
- catch {
181
- // Fallback without mode/priority columns (pre-migration)
182
- try {
183
- const basic = this.db.prepare(`
184
- SELECT id, name, event, action_type, action_value, enabled, description
185
- FROM pmo_work_hooks
186
- WHERE event = ? AND enabled = 1
187
- ORDER BY created_at ASC
188
- `).all(eventName);
189
- return basic;
190
- }
191
- catch {
192
- return [];
193
- }
194
- }
195
- }
196
- /**
197
- * Build an OrchestrateEventContext from raw event data.
198
- */
199
- buildContext(eventName, data) {
200
- return {
201
- event: eventName,
202
- ticket: (data.ticketId ?? data.workItemId ?? data.ticket),
203
- pr: (data.prNumber ?? data.pr),
204
- branch: data.branch,
205
- agent: (data.agentName ?? data.agent ?? data.sessionId),
206
- container: data.containerId,
207
- executionId: data.executionId,
208
- prUrl: data.prUrl,
209
- projectId: data.projectId,
210
- ...data,
211
- };
212
- }
213
- /**
214
- * Resolve the action name from a hook row.
215
- * Built-in actions are referenced by name; shell hooks use the raw command.
216
- */
217
- resolveActionName(hook) {
218
- // If the action_value starts with "prlt hook fire", extract the --action value
219
- const actionMatch = hook.action_value.match(/--action\s+(\S+)/);
220
- if (actionMatch)
221
- return actionMatch[1];
222
- // If it's a known built-in action name directly
223
- if (ACTION_HANDLERS[hook.action_value])
224
- return hook.action_value;
225
- // Otherwise it's a raw shell command — use the action_value as-is
226
- return hook.action_value;
227
- }
228
- /**
229
- * Execute an action — either built-in or shell fallback.
230
- */
231
- executeAction(actionName, ctx, config) {
232
- // Try built-in action first
233
- if (ACTION_HANDLERS[actionName]) {
234
- return executeBuiltinAction(actionName, ctx, config);
235
- }
236
- // Fallback to shell execution
237
- const start = Date.now();
238
- try {
239
- const env = {
240
- ...process.env,
241
- PRLT_HOOK_EVENT: ctx.event,
242
- PRLT_HOOK_TICKET: ctx.ticket ?? '',
243
- PRLT_HOOK_PR: ctx.pr ? String(ctx.pr) : '',
244
- PRLT_HOOK_BRANCH: ctx.branch ?? '',
245
- PRLT_HOOK_AGENT: ctx.agent ?? '',
246
- };
247
- execSync(actionName, { env, timeout: 30_000, stdio: 'pipe' });
248
- return { action: actionName, success: true, durationMs: Date.now() - start };
249
- }
250
- catch (err) {
251
- return {
252
- action: actionName,
253
- success: false,
254
- error: err instanceof Error ? err.message : String(err),
255
- durationMs: Date.now() - start,
256
- };
257
- }
77
+ return this.manager.denyConfirmation(index);
258
78
  }
259
79
  }
260
80
  // =============================================================================
81
+ // Result Mapping
82
+ // =============================================================================
83
+ /**
84
+ * Convert a HookExecutionResult to an OrchestrateActionResult.
85
+ */
86
+ function toActionResult(result) {
87
+ return {
88
+ action: result.action,
89
+ success: result.success,
90
+ error: result.error,
91
+ durationMs: result.durationMs,
92
+ skipped: result.skipped,
93
+ awaitingConfirmation: result.awaitingConfirmation,
94
+ };
95
+ }
96
+ // =============================================================================
261
97
  // Singleton
262
98
  // =============================================================================
263
99
  let _engine;
@@ -1 +1 @@
1
- {"version":3,"file":"engine.js","sourceRoot":"","sources":["../../../src/lib/orchestrate/engine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAE7C,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAA;AACpE,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAyCpE,MAAM,OAAO,iBAAiB;IACpB,EAAE,CAAmB;IACrB,WAAW,CAAiB;IAC5B,aAAa,GAAsB,EAAE,CAAA;IACrC,GAAG,CAAuB;IAC1B,SAAS,CAAwE;IACjF,QAAQ,CAA6F;IACrG,OAAO,GAAG,KAAK,CAAA;IACf,oBAAoB,GAMvB,EAAE,CAAA;IAEP,YAAY,OAAiC;QAC3C,IAAI,CAAC,EAAE,GAAG,OAAO,CAAC,EAAE,CAAA;QACpB,IAAI,CAAC,WAAW,GAA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ent = 'work:started' | 'work:status_changed' | 'work:pr_created' | 'work:pr_merged' | 'work:pr_closed' | 'work:completed' | 'agent:spawned' | 'agent:stopped' | 'on_ci_green' | 'on_ci_failed' | 'on_pr_opened' | 'on_pr_merged' | 'on_pr_conflicting' | 'on_ticket_ready' | 'on_agent_spawned' | 'on_agent_died' | 'on_agent_completed' | 'on_agent_idle' | 'on_version_published';
13
13
  /** All valid orchestrate event names. */
14
14
  export declare const ORCHESTRATE_EVENTS: OrchestrateEvent[];
15
- /**
16
- * Automation level for a hook.
17
- *
18
- * - auto: fires immediately, no human needed
19
- * - confirm: pauses, notifies, waits for approval
20
- * - notify: fires but also pings (log, Slack, dashboard)
21
- * - off: disabled
22
- */
23
- export type HookMode = 'auto' | 'confirm' | 'notify' | 'off';
24
- /** All valid hook modes. */
25
- export declare const HOOK_MODES: HookMode[];
15
+ import type { HookMode as _HookMode } from '../work-lifecycle/hooks/types.js';
16
+ export type HookMode = _HookMode;
17
+ export { HOOK_MODES } from '../work-lifecycle/hooks/types.js';
26
18
  /**
27
19
  * Built-in orchestrate actions.
28
20
  * These are first-class actions the daemon knows how to execute natively.
@@ -27,8 +27,7 @@ export const ORCHESTRATE_EVENTS = [
27
27
  'on_agent_idle',
28
28
  'on_version_published',
29
29
  ];
30
- /** All valid hook modes. */
31
- export const HOOK_MODES = ['auto', 'confirm', 'notify', 'off'];
30
+ export { HOOK_MODES } from '../work-lifecycle/hooks/types.js';
32
31
  /** All valid built-in action names. */
33
32
  export const BUILTIN_ACTIONS = [
34
33
  'merge-pr',
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/lib/orchestrate/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAiCH,yCAAyC;AACzC,MAAM,CAAC,MAAM,kBAAkB,GAAuB;IACpD,cAAc;IACd,qBAAqB;IACrB,iBAAiB;IACjB,gBAAgB;IAChB,gBAAgB;IAChB,gBAAgB;IAChB,eAAe;IACf,eAAe;IACf,aAAa;IACb,cAAc;IACd,cAAc;IACd,cAAc;IACd,mBAAmB;IACnB,iBAAiB;IACjB,kBAAkB;IAClB,eAAe;IACf,oBAAoB;IACpB,eAAe;IACf,sBAAsB;CACvB,CAAA;AAgBD,4BAA4B;AAC5B,MAAM,CAAC,MAAM,UAAU,GAAe,CAAC,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAA;AAsB1E,uCAAuC;AACvC,MAAM,CAAC,MAAM,eAAe,GAAoB;IAC9C,UAAU;IACV,aAAa;IACb,wBAAwB;IACxB,aAAa;IACb,SAAS;IACT,QAAQ;IACR,mBAAmB;IACnB,iBAAiB;IACjB,cAAc;IACd,kBAAkB;CACnB,CAAA;AAmDD,8BAA8B;AAC9B,MAAM,CAAC,MAAM,YAAY,GAAiB,CAAC,YAAY,EAAE,cAAc,EAAE,YAAY,CAAC,CAAA"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/lib/orchestrate/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAiCH,yCAAyC;AACzC,MAAM,CAAC,MAAM,kBAAkB,GAAuB;IACpD,cAAc;IACd,qBAAqB;IACrB,iBAAiB;IACjB,gBAAgB;IAChB,gBAAgB;IAChB,gBAAgB;IAChB,eAAe;IACf,eAAe;IACf,aAAa;IACb,cAAc;IACd,cAAc;IACd,cAAc;IACd,mBAAmB;IACnB,iBAAiB;IACjB,kBAAkB;IAClB,eAAe;IACf,oBAAoB;IACpB,eAAe;IACf,sBAAsB;CACvB,CAAA;AASD,OAAO,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAA;AAsB7D,uCAAuC;AACvC,MAAM,CAAC,MAAM,eAAe,GAAoB;IAC9C,UAAU;IACV,aAAa;IACb,wBAAwB;IACxB,aAAa;IACb,SAAS;IACT,QAAQ;IACR,mBAAmB;IACnB,iBAAiB;IACjB,cAAc;IACd,kBAAkB;CACnB,CAAA;AAmDD,8BAA8B;AAC9B,MAAM,CAAC,MAAM,YAAY,GAAiB,CAAC,YAAY,EAAE,cAAc,EAAE,YAAY,CAAC,CAAA"}
@@ -85,6 +85,7 @@ export function executeHook(hook, eventName, eventData) {
85
85
  return {
86
86
  hookId: hook.id,
87
87
  hookName: hook.name,
88
+ action: hook.actionValue,
88
89
  success: true,
89
90
  durationMs: Date.now() - start,
90
91
  };
@@ -93,6 +94,7 @@ export function executeHook(hook, eventName, eventData) {
93
94
  return {
94
95
  hookId: hook.id,
95
96
  hookName: hook.name,
97
+ action: hook.actionValue,
96
98
  success: false,
97
99
  error: err instanceof Error ? err.message : String(err),
98
100
  durationMs: Date.now() - start,
@@ -1 +1 @@
1
- {"version":3,"file":"executor.js","sourceRoot":"","sources":["../../../../src/lib/work-lifecycle/hooks/executor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAG7C;;;GAGG;AACH,SAAS,YAAY,CAAC,SAAiB,EAAE,SAAkC;IACzE,MAAM,GAAG,GAA2B;QAClC,eAAe,EAAE,SAAS;KAC3B,CAAA;IAED,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC;QACrD,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS;YAAE,SAAQ;QACnD,MAAM,MAAM,GAAG,aAAa,GAAG,CAAC,OAAO,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC,WAAW,EAAE,EAAE,CAAA;QAC1E,IAAI,KAAK,YAAY,IAAI,EAAE,CAAC;YAC1B,GAAG,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC,WAAW,EAAE,CAAA;QACnC,CAAC;aAAM,CAAC;YACN,GAAG,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,CAAA;QAC7B,CAAC;IACH,CAAC;IAED,OAAO,GAAG,CAAA;AACZ,CAAC;AAED;;GAEG;AACH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A;gBACD,MAAK;YACP,CAAC;YAED,KAAK,KAAK,CAAC,CAAC,CAAC;gBACX,MAAM,OAAO,GAAG,WAAW,CAAC,IAAI,CAAC,WAAW,EAAE,SAAS,EAAE,SAAS,CAAC,CAAA;gBACnE,sCAAsC;gBACtC,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC,CAAA;gBAC7C,MAAK;YACP,CAAC;QACH,CAAC;QAED,OAAO;YACL,MAAM,EAAE,IAAI,CAAC,EAAE;YACf,QAAQ,EAAE,IAAI,CAAC,IAAI;YACnB,MAAM,EAAE,IAAI,CAAC,WAAW;YACxB,OAAO,EAAE,IAAI;YACb,UAAU,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,KAAK;SAC/B,CAAA;IACH,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO;YACL,MAAM,EAAE,IAAI,CAAC,EAAE;YACf,QAAQ,EAAE,IAAI,CAAC,IAAI;YACnB,MAAM,EAAE,IAAI,CAAC,WAAW;YACxB,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC;YACvD,UAAU,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,KAAK;SAC/B,CAAA;IACH,CAAC;AACH,CAAC"}
@@ -3,10 +3,12 @@
3
3
  *
4
4
  * Configurable event-driven actions for work lifecycle events.
5
5
  * Hooks subscribe to the EventBus and execute user-configured
6
- * actions (shell commands, webhooks, log messages) when events fire.
6
+ * actions (shell commands, webhooks, log messages, built-in actions)
7
+ * when events fire, with mode-aware behavior (auto/confirm/notify/off).
7
8
  */
8
- export type { HookableEvent, HookActionType, WorkHookConfig, WorkHookRow, HookExecutionResult, } from './types.js';
9
- export { HOOKABLE_EVENTS } from './types.js';
9
+ export type { HookableEvent, HookActionType, HookMode, WorkHookConfig, WorkHookRow, HookExecutionResult, HookActionHandler, } from './types.js';
10
+ export { HOOKABLE_EVENTS, HOOK_MODES } from './types.js';
10
11
  export { WorkHookStorage, HOOKS_TABLE, HOOKS_TABLE_SCHEMA, HOOKS_TABLE_INDEX, ensureHooksTable, } from './storage.js';
11
12
  export { executeHook } from './executor.js';
12
13
  export { HookManager, initHookManager, stopHookManager, } from './manager.js';
14
+ export type { HookManagerOptions } from './manager.js';
@@ -3,9 +3,10 @@
3
3
  *
4
4
  * Configurable event-driven actions for work lifecycle events.
5
5
  * Hooks subscribe to the EventBus and execute user-configured
6
- * actions (shell commands, webhooks, log messages) when events fire.
6
+ * actions (shell commands, webhooks, log messages, built-in actions)
7
+ * when events fire, with mode-aware behavior (auto/confirm/notify/off).
7
8
  */
8
- export { HOOKABLE_EVENTS } from './types.js';
9
+ export { HOOKABLE_EVENTS, HOOK_MODES } from './types.js';
9
10
  export { WorkHookStorage, HOOKS_TABLE, HOOKS_TABLE_SCHEMA, HOOKS_TABLE_INDEX, ensureHooksTable, } from './storage.js';
10
11
  export { executeHook } from './executor.js';
11
12
  export { HookManager, initHookManager, stopHookManager, } from './manager.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/lib/work-lifecycle/hooks/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAUH,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAE5C,OAAO,EACL,eAAe,EACf,WAAW,EACX,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,cAAc,CAAA;AAErB,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAE3C,OAAO,EACL,WAAW,EACX,eAAe,EACf,eAAe,GAChB,MAAM,cAAc,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/lib/work-lifecycle/hooks/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAYH,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAExD,OAAO,EACL,eAAe,EACf,WAAW,EACX,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,cAAc,CAAA;AAErB,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAE3C,OAAO,EACL,WAAW,EACX,eAAe,EACf,eAAe,GAChB,MAAM,cAAc,CAAA"}