@vorionsys/a3i 0.1.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/LICENSE +190 -0
- package/dist/api/handlers.d.ts +231 -0
- package/dist/api/handlers.d.ts.map +1 -0
- package/dist/api/handlers.js +279 -0
- package/dist/api/handlers.js.map +1 -0
- package/dist/api/index.d.ts +24 -0
- package/dist/api/index.d.ts.map +1 -0
- package/dist/api/index.js +27 -0
- package/dist/api/index.js.map +1 -0
- package/dist/api/middleware.d.ts +106 -0
- package/dist/api/middleware.d.ts.map +1 -0
- package/dist/api/middleware.js +186 -0
- package/dist/api/middleware.js.map +1 -0
- package/dist/api/routes.d.ts +41 -0
- package/dist/api/routes.d.ts.map +1 -0
- package/dist/api/routes.js +91 -0
- package/dist/api/routes.js.map +1 -0
- package/dist/authorization/constraints.d.ts +75 -0
- package/dist/authorization/constraints.d.ts.map +1 -0
- package/dist/authorization/constraints.js +302 -0
- package/dist/authorization/constraints.js.map +1 -0
- package/dist/authorization/decision.d.ts +98 -0
- package/dist/authorization/decision.d.ts.map +1 -0
- package/dist/authorization/decision.js +202 -0
- package/dist/authorization/decision.js.map +1 -0
- package/dist/authorization/engine.d.ts +141 -0
- package/dist/authorization/engine.d.ts.map +1 -0
- package/dist/authorization/engine.js +339 -0
- package/dist/authorization/engine.js.map +1 -0
- package/dist/authorization/index.d.ts +10 -0
- package/dist/authorization/index.d.ts.map +1 -0
- package/dist/authorization/index.js +13 -0
- package/dist/authorization/index.js.map +1 -0
- package/dist/banding/band-calculator.d.ts +137 -0
- package/dist/banding/band-calculator.d.ts.map +1 -0
- package/dist/banding/band-calculator.js +252 -0
- package/dist/banding/band-calculator.js.map +1 -0
- package/dist/banding/bands.d.ts +56 -0
- package/dist/banding/bands.d.ts.map +1 -0
- package/dist/banding/bands.js +200 -0
- package/dist/banding/bands.js.map +1 -0
- package/dist/banding/hysteresis.d.ts +64 -0
- package/dist/banding/hysteresis.d.ts.map +1 -0
- package/dist/banding/hysteresis.js +143 -0
- package/dist/banding/hysteresis.js.map +1 -0
- package/dist/banding/index.d.ts +10 -0
- package/dist/banding/index.d.ts.map +1 -0
- package/dist/banding/index.js +10 -0
- package/dist/banding/index.js.map +1 -0
- package/dist/canary/canary-service.d.ts +123 -0
- package/dist/canary/canary-service.d.ts.map +1 -0
- package/dist/canary/canary-service.js +353 -0
- package/dist/canary/canary-service.js.map +1 -0
- package/dist/canary/index.d.ts +12 -0
- package/dist/canary/index.d.ts.map +1 -0
- package/dist/canary/index.js +14 -0
- package/dist/canary/index.js.map +1 -0
- package/dist/canary/probe-library.d.ts +43 -0
- package/dist/canary/probe-library.d.ts.map +1 -0
- package/dist/canary/probe-library.js +655 -0
- package/dist/canary/probe-library.js.map +1 -0
- package/dist/execution/engine.d.ts +120 -0
- package/dist/execution/engine.d.ts.map +1 -0
- package/dist/execution/engine.js +220 -0
- package/dist/execution/engine.js.map +1 -0
- package/dist/execution/index.d.ts +7 -0
- package/dist/execution/index.d.ts.map +1 -0
- package/dist/execution/index.js +7 -0
- package/dist/execution/index.js.map +1 -0
- package/dist/gate/index.d.ts +12 -0
- package/dist/gate/index.d.ts.map +1 -0
- package/dist/gate/index.js +14 -0
- package/dist/gate/index.js.map +1 -0
- package/dist/gate/pre-action-gate.d.ts +87 -0
- package/dist/gate/pre-action-gate.d.ts.map +1 -0
- package/dist/gate/pre-action-gate.js +286 -0
- package/dist/gate/pre-action-gate.js.map +1 -0
- package/dist/gate/risk-classifier.d.ts +43 -0
- package/dist/gate/risk-classifier.d.ts.map +1 -0
- package/dist/gate/risk-classifier.js +157 -0
- package/dist/gate/risk-classifier.js.map +1 -0
- package/dist/hooks/executor.d.ts +56 -0
- package/dist/hooks/executor.d.ts.map +1 -0
- package/dist/hooks/executor.js +217 -0
- package/dist/hooks/executor.js.map +1 -0
- package/dist/hooks/index.d.ts +45 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +49 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/hooks/manager.d.ts +156 -0
- package/dist/hooks/manager.d.ts.map +1 -0
- package/dist/hooks/manager.js +267 -0
- package/dist/hooks/manager.js.map +1 -0
- package/dist/hooks/registry.d.ts +130 -0
- package/dist/hooks/registry.d.ts.map +1 -0
- package/dist/hooks/registry.js +238 -0
- package/dist/hooks/registry.js.map +1 -0
- package/dist/hooks/types.d.ts +226 -0
- package/dist/hooks/types.d.ts.map +1 -0
- package/dist/hooks/types.js +41 -0
- package/dist/hooks/types.js.map +1 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +31 -0
- package/dist/index.js.map +1 -0
- package/dist/observation/attestation.d.ts +102 -0
- package/dist/observation/attestation.d.ts.map +1 -0
- package/dist/observation/attestation.js +127 -0
- package/dist/observation/attestation.js.map +1 -0
- package/dist/observation/ceilings.d.ts +60 -0
- package/dist/observation/ceilings.d.ts.map +1 -0
- package/dist/observation/ceilings.js +110 -0
- package/dist/observation/ceilings.js.map +1 -0
- package/dist/observation/index.d.ts +11 -0
- package/dist/observation/index.d.ts.map +1 -0
- package/dist/observation/index.js +14 -0
- package/dist/observation/index.js.map +1 -0
- package/dist/observation/tiers.d.ts +96 -0
- package/dist/observation/tiers.d.ts.map +1 -0
- package/dist/observation/tiers.js +225 -0
- package/dist/observation/tiers.js.map +1 -0
- package/dist/orchestrator/index.d.ts +8 -0
- package/dist/orchestrator/index.d.ts.map +1 -0
- package/dist/orchestrator/index.js +8 -0
- package/dist/orchestrator/index.js.map +1 -0
- package/dist/orchestrator/orchestrator.d.ts +225 -0
- package/dist/orchestrator/orchestrator.d.ts.map +1 -0
- package/dist/orchestrator/orchestrator.js +302 -0
- package/dist/orchestrator/orchestrator.js.map +1 -0
- package/dist/orchestrator/proof-plane-adapter.d.ts +80 -0
- package/dist/orchestrator/proof-plane-adapter.d.ts.map +1 -0
- package/dist/orchestrator/proof-plane-adapter.js +78 -0
- package/dist/orchestrator/proof-plane-adapter.js.map +1 -0
- package/dist/trust/calculator.d.ts +60 -0
- package/dist/trust/calculator.d.ts.map +1 -0
- package/dist/trust/calculator.js +163 -0
- package/dist/trust/calculator.js.map +1 -0
- package/dist/trust/dimensions.d.ts +133 -0
- package/dist/trust/dimensions.d.ts.map +1 -0
- package/dist/trust/dimensions.js +257 -0
- package/dist/trust/dimensions.js.map +1 -0
- package/dist/trust/index.d.ts +14 -0
- package/dist/trust/index.d.ts.map +1 -0
- package/dist/trust/index.js +25 -0
- package/dist/trust/index.js.map +1 -0
- package/dist/trust/profile-service.d.ts +179 -0
- package/dist/trust/profile-service.d.ts.map +1 -0
- package/dist/trust/profile-service.js +378 -0
- package/dist/trust/profile-service.js.map +1 -0
- package/dist/trust/profile-store.d.ts +122 -0
- package/dist/trust/profile-store.d.ts.map +1 -0
- package/dist/trust/profile-store.js +132 -0
- package/dist/trust/profile-store.js.map +1 -0
- package/dist/trust/trust-calculator.d.ts +111 -0
- package/dist/trust/trust-calculator.d.ts.map +1 -0
- package/dist/trust/trust-calculator.js +271 -0
- package/dist/trust/trust-calculator.js.map +1 -0
- package/dist/trust/trust-dynamics.d.ts +152 -0
- package/dist/trust/trust-dynamics.d.ts.map +1 -0
- package/dist/trust/trust-dynamics.js +302 -0
- package/dist/trust/trust-dynamics.js.map +1 -0
- package/dist/trust/weights.d.ts +57 -0
- package/dist/trust/weights.d.ts.map +1 -0
- package/dist/trust/weights.js +75 -0
- package/dist/trust/weights.js.map +1 -0
- package/package.json +81 -0
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hook Executor - Executes hooks in the proper order
|
|
3
|
+
*
|
|
4
|
+
* Handles timeout, error recovery, filtering, and abort logic.
|
|
5
|
+
*/
|
|
6
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
7
|
+
/**
|
|
8
|
+
* Default execution options
|
|
9
|
+
*/
|
|
10
|
+
const DEFAULT_OPTIONS = {
|
|
11
|
+
stopOnAbort: true,
|
|
12
|
+
stopOnError: true,
|
|
13
|
+
timeoutMs: 5000,
|
|
14
|
+
parallel: false,
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Create a success hook result
|
|
18
|
+
*/
|
|
19
|
+
export function successResult(durationMs, modified) {
|
|
20
|
+
return {
|
|
21
|
+
success: true,
|
|
22
|
+
durationMs,
|
|
23
|
+
modified,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Create an abort hook result
|
|
28
|
+
*/
|
|
29
|
+
export function abortResult(reason, durationMs) {
|
|
30
|
+
return {
|
|
31
|
+
success: true,
|
|
32
|
+
abort: true,
|
|
33
|
+
abortReason: reason,
|
|
34
|
+
durationMs,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Create an error hook result
|
|
39
|
+
*/
|
|
40
|
+
export function errorResult(error, durationMs) {
|
|
41
|
+
return {
|
|
42
|
+
success: false,
|
|
43
|
+
error,
|
|
44
|
+
durationMs,
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Execute a single hook with timeout
|
|
49
|
+
*/
|
|
50
|
+
async function executeHookWithTimeout(hook, context, timeoutMs) {
|
|
51
|
+
const startTime = Date.now();
|
|
52
|
+
return new Promise((resolve) => {
|
|
53
|
+
const timeoutId = setTimeout(() => {
|
|
54
|
+
resolve({
|
|
55
|
+
success: false,
|
|
56
|
+
error: new Error(`Hook '${hook.name}' timed out after ${timeoutMs}ms`),
|
|
57
|
+
durationMs: Date.now() - startTime,
|
|
58
|
+
});
|
|
59
|
+
}, timeoutMs);
|
|
60
|
+
Promise.resolve()
|
|
61
|
+
.then(() => hook.handler(context))
|
|
62
|
+
.then((result) => {
|
|
63
|
+
clearTimeout(timeoutId);
|
|
64
|
+
resolve(result);
|
|
65
|
+
})
|
|
66
|
+
.catch((error) => {
|
|
67
|
+
clearTimeout(timeoutId);
|
|
68
|
+
resolve({
|
|
69
|
+
success: false,
|
|
70
|
+
error: error instanceof Error ? error : new Error(String(error)),
|
|
71
|
+
durationMs: Date.now() - startTime,
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* HookExecutor - Executes hooks from a registry
|
|
78
|
+
*/
|
|
79
|
+
export class HookExecutor {
|
|
80
|
+
registry;
|
|
81
|
+
constructor(registry) {
|
|
82
|
+
this.registry = registry;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Execute all hooks for a phase
|
|
86
|
+
*/
|
|
87
|
+
async execute(phase, context, options = {}) {
|
|
88
|
+
const opts = { ...DEFAULT_OPTIONS, ...options };
|
|
89
|
+
const startTime = Date.now();
|
|
90
|
+
// Get enabled hooks for this phase
|
|
91
|
+
const hooks = this.registry.getEnabledByPhase(phase);
|
|
92
|
+
// Build full context
|
|
93
|
+
const fullContext = {
|
|
94
|
+
executionId: uuidv4(),
|
|
95
|
+
correlationId: context.correlationId ?? uuidv4(),
|
|
96
|
+
startedAt: new Date(),
|
|
97
|
+
metadata: {},
|
|
98
|
+
...context,
|
|
99
|
+
};
|
|
100
|
+
const results = [];
|
|
101
|
+
let succeeded = 0;
|
|
102
|
+
let failed = 0;
|
|
103
|
+
let skipped = 0;
|
|
104
|
+
let aborted = false;
|
|
105
|
+
let abortReason;
|
|
106
|
+
if (opts.parallel) {
|
|
107
|
+
// Execute hooks in parallel
|
|
108
|
+
const promises = hooks.map(async (hook) => {
|
|
109
|
+
// Check filter
|
|
110
|
+
if (hook.filter && !hook.filter(fullContext)) {
|
|
111
|
+
skipped++;
|
|
112
|
+
return { hookId: hook.id, hookName: hook.name, skipped: true };
|
|
113
|
+
}
|
|
114
|
+
const timeout = opts.timeoutMs ?? hook.timeoutMs ?? 5000;
|
|
115
|
+
const result = await executeHookWithTimeout(hook, fullContext, timeout);
|
|
116
|
+
return { hookId: hook.id, hookName: hook.name, result };
|
|
117
|
+
});
|
|
118
|
+
const hookResults = await Promise.all(promises);
|
|
119
|
+
for (const hr of hookResults) {
|
|
120
|
+
if ('skipped' in hr && hr.skipped) {
|
|
121
|
+
continue;
|
|
122
|
+
}
|
|
123
|
+
const { hookId, hookName, result } = hr;
|
|
124
|
+
results.push({ hookId, hookName, result });
|
|
125
|
+
if (result.success) {
|
|
126
|
+
succeeded++;
|
|
127
|
+
if (result.abort && !aborted) {
|
|
128
|
+
aborted = true;
|
|
129
|
+
abortReason = result.abortReason;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
failed++;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
// Execute hooks sequentially
|
|
139
|
+
for (const hook of hooks) {
|
|
140
|
+
// Check filter
|
|
141
|
+
if (hook.filter && !hook.filter(fullContext)) {
|
|
142
|
+
skipped++;
|
|
143
|
+
continue;
|
|
144
|
+
}
|
|
145
|
+
const timeout = opts.timeoutMs ?? hook.timeoutMs ?? 5000;
|
|
146
|
+
const result = await executeHookWithTimeout(hook, fullContext, timeout);
|
|
147
|
+
results.push({
|
|
148
|
+
hookId: hook.id,
|
|
149
|
+
hookName: hook.name,
|
|
150
|
+
result,
|
|
151
|
+
});
|
|
152
|
+
if (result.success) {
|
|
153
|
+
succeeded++;
|
|
154
|
+
if (result.abort) {
|
|
155
|
+
aborted = true;
|
|
156
|
+
abortReason = result.abortReason;
|
|
157
|
+
if (opts.stopOnAbort) {
|
|
158
|
+
break;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
else {
|
|
163
|
+
failed++;
|
|
164
|
+
if (!hook.continueOnError && opts.stopOnError) {
|
|
165
|
+
break;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
return {
|
|
171
|
+
phase,
|
|
172
|
+
hooksExecuted: succeeded + failed,
|
|
173
|
+
succeeded,
|
|
174
|
+
failed,
|
|
175
|
+
skipped,
|
|
176
|
+
aborted,
|
|
177
|
+
abortReason,
|
|
178
|
+
totalDurationMs: Date.now() - startTime,
|
|
179
|
+
results,
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Execute a specific hook by ID
|
|
184
|
+
*/
|
|
185
|
+
async executeById(hookId, context, timeoutMs) {
|
|
186
|
+
const hook = this.registry.get(hookId);
|
|
187
|
+
if (!hook || !hook.enabled) {
|
|
188
|
+
return null;
|
|
189
|
+
}
|
|
190
|
+
const fullContext = {
|
|
191
|
+
executionId: uuidv4(),
|
|
192
|
+
correlationId: context.correlationId ?? uuidv4(),
|
|
193
|
+
startedAt: new Date(),
|
|
194
|
+
metadata: {},
|
|
195
|
+
...context,
|
|
196
|
+
};
|
|
197
|
+
// Check filter
|
|
198
|
+
if (hook.filter && !hook.filter(fullContext)) {
|
|
199
|
+
return null;
|
|
200
|
+
}
|
|
201
|
+
const timeout = timeoutMs ?? hook.timeoutMs ?? 5000;
|
|
202
|
+
return executeHookWithTimeout(hook, fullContext, timeout);
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Get the registry
|
|
206
|
+
*/
|
|
207
|
+
getRegistry() {
|
|
208
|
+
return this.registry;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Create a hook executor
|
|
213
|
+
*/
|
|
214
|
+
export function createHookExecutor(registry) {
|
|
215
|
+
return new HookExecutor(registry);
|
|
216
|
+
}
|
|
217
|
+
//# sourceMappingURL=executor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executor.js","sourceRoot":"","sources":["../../src/hooks/executor.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAC;AAyBpC;;GAEG;AACH,MAAM,eAAe,GAAkC;IACrD,WAAW,EAAE,IAAI;IACjB,WAAW,EAAE,IAAI;IACjB,SAAS,EAAE,I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YACX,eAAe,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS;YACvC,OAAO;SACR,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,WAAW,CACf,MAAc,EACd,OAAmC,EACnC,SAAkB;QAElB,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAI,MAAM,CAAC,CAAC;QAC1C,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;YAC3B,OAAO,IAAI,CAAC;QACd,CAAC;QAED,MAAM,WAAW,GAAM;YACrB,WAAW,EAAE,MAAM,EAAE;YACrB,aAAa,EAAG,OAAmC,CAAC,aAAuB,IAAI,MAAM,EAAE;YACvF,SAAS,EAAE,IAAI,IAAI,EAAE;YACrB,QAAQ,EAAE,EAAE;YACZ,GAAG,OAAO;SACN,CAAC;QAEP,eAAe;QACf,IAAI,IAAI,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC;YAC7C,OAAO,IAAI,CAAC;QACd,CAAC;QAED,MAAM,OAAO,GAAG,SAAS,IAAI,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC;QACpD,OAAO,sBAAsB,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC;IAC5D,CAAC;IAED;;OAEG;IACH,WAAW;QACT,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;CACF;AAED;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAC,QAAsB;IACvD,OAAO,IAAI,YAAY,CAAC,QAAQ,CAAC,CAAC;AACpC,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hooks module - Extensibility system for Vorion platform
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* ```typescript
|
|
6
|
+
* import { createHookManager, HookPhase, HookPriority } from '@vorion/a3i/hooks';
|
|
7
|
+
*
|
|
8
|
+
* const hooks = createHookManager();
|
|
9
|
+
*
|
|
10
|
+
* // Register a pre-authorize hook
|
|
11
|
+
* hooks.onPreAuthorize('audit-logger', async (ctx) => {
|
|
12
|
+
* console.log(`Authorizing intent ${ctx.intent.intentId}`);
|
|
13
|
+
* return { success: true, durationMs: 0 };
|
|
14
|
+
* }, { priority: HookPriority.MONITOR });
|
|
15
|
+
*
|
|
16
|
+
* // Register a hook that can abort
|
|
17
|
+
* hooks.onPreAuthorize('rate-limiter', async (ctx) => {
|
|
18
|
+
* if (isRateLimited(ctx.intent.agentId)) {
|
|
19
|
+
* return {
|
|
20
|
+
* success: true,
|
|
21
|
+
* abort: true,
|
|
22
|
+
* abortReason: 'Rate limit exceeded',
|
|
23
|
+
* durationMs: 1,
|
|
24
|
+
* };
|
|
25
|
+
* }
|
|
26
|
+
* return { success: true, durationMs: 1 };
|
|
27
|
+
* }, { priority: HookPriority.HIGH });
|
|
28
|
+
*
|
|
29
|
+
* // Execute hooks
|
|
30
|
+
* const summary = await hooks.executePreAuthorize({
|
|
31
|
+
* correlationId: 'xxx',
|
|
32
|
+
* intent: myIntent,
|
|
33
|
+
* profile: agentProfile,
|
|
34
|
+
* });
|
|
35
|
+
*
|
|
36
|
+
* if (summary.aborted) {
|
|
37
|
+
* console.log(`Authorization aborted: ${summary.abortReason}`);
|
|
38
|
+
* }
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
export { HookPhase, HookPriority, type HookResult, type HookContext, type PreAuthorizeContext, type PostAuthorizeContext, type PreExecuteContext, type PostExecuteContext, type ExecutionFailedContext, type TrustChangeContext, type TrustViolationContext, type EventEmittedContext, type AnyHookContext, type HookHandler, type HookDefinition, type HookExecutionSummary, } from './types.js';
|
|
42
|
+
export { HookRegistry, createHookRegistry, getGlobalHookRegistry, resetGlobalHookRegistry, HookRegistryError, HookRegistryErrorCode, type RegisterHookOptions, } from './registry.js';
|
|
43
|
+
export { HookExecutor, createHookExecutor, type ExecuteHooksOptions, } from './executor.js';
|
|
44
|
+
export { HookManager, createHookManager, successResult, abortResult, errorResult, type HookManagerConfig, type SimpleHookOptions, } from './manager.js';
|
|
45
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAGH,OAAO,EACL,SAAS,EACT,YAAY,EACZ,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,sBAAsB,EAC3B,KAAK,kBAAkB,EACvB,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EACxB,KAAK,cAAc,EACnB,KAAK,WAAW,EAChB,KAAK,cAAc,EACnB,KAAK,oBAAoB,GAC1B,MAAM,YAAY,CAAC;AAGpB,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,qBAAqB,EACrB,uBAAuB,EACvB,iBAAiB,EACjB,qBAAqB,EACrB,KAAK,mBAAmB,GACzB,MAAM,eAAe,CAAC;AAGvB,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,KAAK,mBAAmB,GACzB,MAAM,eAAe,CAAC;AAGvB,OAAO,EACL,WAAW,EACX,iBAAiB,EACjB,aAAa,EACb,WAAW,EACX,WAAW,EACX,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,GACvB,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hooks module - Extensibility system for Vorion platform
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* ```typescript
|
|
6
|
+
* import { createHookManager, HookPhase, HookPriority } from '@vorion/a3i/hooks';
|
|
7
|
+
*
|
|
8
|
+
* const hooks = createHookManager();
|
|
9
|
+
*
|
|
10
|
+
* // Register a pre-authorize hook
|
|
11
|
+
* hooks.onPreAuthorize('audit-logger', async (ctx) => {
|
|
12
|
+
* console.log(`Authorizing intent ${ctx.intent.intentId}`);
|
|
13
|
+
* return { success: true, durationMs: 0 };
|
|
14
|
+
* }, { priority: HookPriority.MONITOR });
|
|
15
|
+
*
|
|
16
|
+
* // Register a hook that can abort
|
|
17
|
+
* hooks.onPreAuthorize('rate-limiter', async (ctx) => {
|
|
18
|
+
* if (isRateLimited(ctx.intent.agentId)) {
|
|
19
|
+
* return {
|
|
20
|
+
* success: true,
|
|
21
|
+
* abort: true,
|
|
22
|
+
* abortReason: 'Rate limit exceeded',
|
|
23
|
+
* durationMs: 1,
|
|
24
|
+
* };
|
|
25
|
+
* }
|
|
26
|
+
* return { success: true, durationMs: 1 };
|
|
27
|
+
* }, { priority: HookPriority.HIGH });
|
|
28
|
+
*
|
|
29
|
+
* // Execute hooks
|
|
30
|
+
* const summary = await hooks.executePreAuthorize({
|
|
31
|
+
* correlationId: 'xxx',
|
|
32
|
+
* intent: myIntent,
|
|
33
|
+
* profile: agentProfile,
|
|
34
|
+
* });
|
|
35
|
+
*
|
|
36
|
+
* if (summary.aborted) {
|
|
37
|
+
* console.log(`Authorization aborted: ${summary.abortReason}`);
|
|
38
|
+
* }
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
// Types
|
|
42
|
+
export { HookPhase, HookPriority, } from './types.js';
|
|
43
|
+
// Registry
|
|
44
|
+
export { HookRegistry, createHookRegistry, getGlobalHookRegistry, resetGlobalHookRegistry, HookRegistryError, HookRegistryErrorCode, } from './registry.js';
|
|
45
|
+
// Executor
|
|
46
|
+
export { HookExecutor, createHookExecutor, } from './executor.js';
|
|
47
|
+
// Manager
|
|
48
|
+
export { HookManager, createHookManager, successResult, abortResult, errorResult, } from './manager.js';
|
|
49
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAEH,QAAQ;AACR,OAAO,EACL,SAAS,EACT,YAAY,GAeb,MAAM,YAAY,CAAC;AAEpB,WAAW;AACX,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,qBAAqB,EACrB,uBAAuB,EACvB,iBAAiB,EACjB,qBAAqB,GAEtB,MAAM,eAAe,CAAC;AAEvB,WAAW;AACX,OAAO,EACL,YAAY,EACZ,kBAAkB,GAEnB,MAAM,eAAe,CAAC;AAEvB,UAAU;AACV,OAAO,EACL,WAAW,EACX,iBAAiB,EACjB,aAAa,EACb,WAAW,EACX,WAAW,GAGZ,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hook Manager - High-level API for the hook system
|
|
3
|
+
*
|
|
4
|
+
* Provides a unified interface for registering and executing hooks.
|
|
5
|
+
*/
|
|
6
|
+
import { HookPhase, HookPriority, type HookHandler, type HookExecutionSummary, type PreAuthorizeContext, type PostAuthorizeContext, type PreExecuteContext, type PostExecuteContext, type ExecutionFailedContext, type TrustChangeContext, type TrustViolationContext, type EventEmittedContext, type AnyHookContext, type HookDefinition } from './types.js';
|
|
7
|
+
import { HookRegistry, type RegisterHookOptions } from './registry.js';
|
|
8
|
+
import { HookExecutor, type ExecuteHooksOptions, successResult, abortResult, errorResult } from './executor.js';
|
|
9
|
+
/**
|
|
10
|
+
* Configuration for the hook manager
|
|
11
|
+
*/
|
|
12
|
+
export interface HookManagerConfig {
|
|
13
|
+
/** Custom registry (creates new if not provided) */
|
|
14
|
+
registry?: HookRegistry;
|
|
15
|
+
/** Default execution options */
|
|
16
|
+
defaultExecutionOptions?: ExecuteHooksOptions;
|
|
17
|
+
/** Enable hook execution logging */
|
|
18
|
+
enableLogging?: boolean;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Simplified hook registration options
|
|
22
|
+
*/
|
|
23
|
+
export interface SimpleHookOptions {
|
|
24
|
+
/** Hook priority */
|
|
25
|
+
priority?: HookPriority;
|
|
26
|
+
/** Timeout in ms */
|
|
27
|
+
timeoutMs?: number;
|
|
28
|
+
/** Continue on error */
|
|
29
|
+
continueOnError?: boolean;
|
|
30
|
+
/** Whether enabled */
|
|
31
|
+
enabled?: boolean;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* HookManager - High-level hook management API
|
|
35
|
+
*/
|
|
36
|
+
export declare class HookManager {
|
|
37
|
+
private readonly registry;
|
|
38
|
+
private readonly executor;
|
|
39
|
+
private readonly config;
|
|
40
|
+
constructor(config?: HookManagerConfig);
|
|
41
|
+
/**
|
|
42
|
+
* Register a pre-authorize hook
|
|
43
|
+
*/
|
|
44
|
+
onPreAuthorize(name: string, handler: HookHandler<PreAuthorizeContext>, options?: SimpleHookOptions): HookDefinition<PreAuthorizeContext>;
|
|
45
|
+
/**
|
|
46
|
+
* Register a post-authorize hook
|
|
47
|
+
*/
|
|
48
|
+
onPostAuthorize(name: string, handler: HookHandler<PostAuthorizeContext>, options?: SimpleHookOptions): HookDefinition<PostAuthorizeContext>;
|
|
49
|
+
/**
|
|
50
|
+
* Register a pre-execute hook
|
|
51
|
+
*/
|
|
52
|
+
onPreExecute(name: string, handler: HookHandler<PreExecuteContext>, options?: SimpleHookOptions): HookDefinition<PreExecuteContext>;
|
|
53
|
+
/**
|
|
54
|
+
* Register a post-execute hook
|
|
55
|
+
*/
|
|
56
|
+
onPostExecute(name: string, handler: HookHandler<PostExecuteContext>, options?: SimpleHookOptions): HookDefinition<PostExecuteContext>;
|
|
57
|
+
/**
|
|
58
|
+
* Register an execution-failed hook
|
|
59
|
+
*/
|
|
60
|
+
onExecutionFailed(name: string, handler: HookHandler<ExecutionFailedContext>, options?: SimpleHookOptions): HookDefinition<ExecutionFailedContext>;
|
|
61
|
+
/**
|
|
62
|
+
* Register a trust-change hook
|
|
63
|
+
*/
|
|
64
|
+
onTrustChange(name: string, handler: HookHandler<TrustChangeContext>, options?: SimpleHookOptions): HookDefinition<TrustChangeContext>;
|
|
65
|
+
/**
|
|
66
|
+
* Register a trust-violation hook
|
|
67
|
+
*/
|
|
68
|
+
onTrustViolation(name: string, handler: HookHandler<TrustViolationContext>, options?: SimpleHookOptions): HookDefinition<TrustViolationContext>;
|
|
69
|
+
/**
|
|
70
|
+
* Register an event-emitted hook
|
|
71
|
+
*/
|
|
72
|
+
onEventEmitted(name: string, handler: HookHandler<EventEmittedContext>, options?: SimpleHookOptions): HookDefinition<EventEmittedContext>;
|
|
73
|
+
/**
|
|
74
|
+
* Register a hook with full options
|
|
75
|
+
*/
|
|
76
|
+
register<T extends AnyHookContext>(options: RegisterHookOptions<T>): HookDefinition<T>;
|
|
77
|
+
/**
|
|
78
|
+
* Execute pre-authorize hooks
|
|
79
|
+
*/
|
|
80
|
+
executePreAuthorize(context: Omit<PreAuthorizeContext, 'executionId' | 'startedAt' | 'metadata'>, options?: ExecuteHooksOptions): Promise<HookExecutionSummary>;
|
|
81
|
+
/**
|
|
82
|
+
* Execute post-authorize hooks
|
|
83
|
+
*/
|
|
84
|
+
executePostAuthorize(context: Omit<PostAuthorizeContext, 'executionId' | 'startedAt' | 'metadata'>, options?: ExecuteHooksOptions): Promise<HookExecutionSummary>;
|
|
85
|
+
/**
|
|
86
|
+
* Execute pre-execute hooks
|
|
87
|
+
*/
|
|
88
|
+
executePreExecute(context: Omit<PreExecuteContext, 'executionId' | 'startedAt' | 'metadata'>, options?: ExecuteHooksOptions): Promise<HookExecutionSummary>;
|
|
89
|
+
/**
|
|
90
|
+
* Execute post-execute hooks
|
|
91
|
+
*/
|
|
92
|
+
executePostExecute(context: Omit<PostExecuteContext, 'executionId' | 'startedAt' | 'metadata'>, options?: ExecuteHooksOptions): Promise<HookExecutionSummary>;
|
|
93
|
+
/**
|
|
94
|
+
* Execute execution-failed hooks
|
|
95
|
+
*/
|
|
96
|
+
executeExecutionFailed(context: Omit<ExecutionFailedContext, 'executionId' | 'startedAt' | 'metadata'>, options?: ExecuteHooksOptions): Promise<HookExecutionSummary>;
|
|
97
|
+
/**
|
|
98
|
+
* Execute trust-change hooks
|
|
99
|
+
*/
|
|
100
|
+
executeTrustChange(context: Omit<TrustChangeContext, 'executionId' | 'startedAt' | 'metadata'>, options?: ExecuteHooksOptions): Promise<HookExecutionSummary>;
|
|
101
|
+
/**
|
|
102
|
+
* Execute trust-violation hooks
|
|
103
|
+
*/
|
|
104
|
+
executeTrustViolation(context: Omit<TrustViolationContext, 'executionId' | 'startedAt' | 'metadata'>, options?: ExecuteHooksOptions): Promise<HookExecutionSummary>;
|
|
105
|
+
/**
|
|
106
|
+
* Execute event-emitted hooks
|
|
107
|
+
*/
|
|
108
|
+
executeEventEmitted(context: Omit<EventEmittedContext, 'executionId' | 'startedAt' | 'metadata'>, options?: ExecuteHooksOptions): Promise<HookExecutionSummary>;
|
|
109
|
+
/**
|
|
110
|
+
* Execute hooks for a phase
|
|
111
|
+
*/
|
|
112
|
+
execute(phase: HookPhase, context: Record<string, unknown>, options?: ExecuteHooksOptions): Promise<HookExecutionSummary>;
|
|
113
|
+
/**
|
|
114
|
+
* Unregister a hook
|
|
115
|
+
*/
|
|
116
|
+
unregister(hookId: string): boolean;
|
|
117
|
+
/**
|
|
118
|
+
* Enable a hook
|
|
119
|
+
*/
|
|
120
|
+
enable(hookId: string): boolean;
|
|
121
|
+
/**
|
|
122
|
+
* Disable a hook
|
|
123
|
+
*/
|
|
124
|
+
disable(hookId: string): boolean;
|
|
125
|
+
/**
|
|
126
|
+
* Get a hook by ID
|
|
127
|
+
*/
|
|
128
|
+
getHook<T extends AnyHookContext>(hookId: string): HookDefinition<T> | undefined;
|
|
129
|
+
/**
|
|
130
|
+
* Get all hooks for a phase
|
|
131
|
+
*/
|
|
132
|
+
getHooksForPhase<T extends AnyHookContext>(phase: HookPhase): HookDefinition<T>[];
|
|
133
|
+
/**
|
|
134
|
+
* Get hook statistics
|
|
135
|
+
*/
|
|
136
|
+
getStats(): ReturnType<HookRegistry['getStats']>;
|
|
137
|
+
/**
|
|
138
|
+
* Clear all hooks
|
|
139
|
+
*/
|
|
140
|
+
clear(): void;
|
|
141
|
+
/**
|
|
142
|
+
* Get the underlying registry
|
|
143
|
+
*/
|
|
144
|
+
getRegistry(): HookRegistry;
|
|
145
|
+
/**
|
|
146
|
+
* Get the underlying executor
|
|
147
|
+
*/
|
|
148
|
+
getExecutor(): HookExecutor;
|
|
149
|
+
private logSummary;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Create a hook manager
|
|
153
|
+
*/
|
|
154
|
+
export declare function createHookManager(config?: HookManagerConfig): HookManager;
|
|
155
|
+
export { successResult, abortResult, errorResult };
|
|
156
|
+
//# sourceMappingURL=manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../src/hooks/manager.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,SAAS,EACT,YAAY,EACZ,KAAK,WAAW,EAChB,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,sBAAsB,EAC3B,KAAK,kBAAkB,EACvB,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EACxB,KAAK,cAAc,EACnB,KAAK,cAAc,EACpB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,YAAY,EAEZ,KAAK,mBAAmB,EACzB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,YAAY,EAEZ,KAAK,mBAAmB,EACxB,aAAa,EACb,WAAW,EACX,WAAW,EACZ,MAAM,eAAe,CAAC;AAEvB;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,oDAAoD;IACpD,QAAQ,CAAC,EAAE,YAAY,CAAC;IACxB,gCAAgC;IAChC,uBAAuB,CAAC,EAAE,mBAAm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