@auxiora/runtime 1.10.9 → 1.10.11
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/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +118 -1
- package/dist/index.js.map +1 -1
- package/dist/tool-approval-gate.d.ts +46 -0
- package/dist/tool-approval-gate.d.ts.map +1 -0
- package/dist/tool-approval-gate.js +72 -0
- package/dist/tool-approval-gate.js.map +1 -0
- package/package.json +81 -79
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ToolApprovalGate — interactive approval gate for sensitive tool invocations.
|
|
3
|
+
*
|
|
4
|
+
* Tools listed in `requireApproval` are held pending until a human resolves
|
|
5
|
+
* them (approve / reject) or the timeout expires.
|
|
6
|
+
*/
|
|
7
|
+
export interface ToolApprovalGateConfig {
|
|
8
|
+
/** Tool names that require explicit approval before execution. */
|
|
9
|
+
requireApproval: string[];
|
|
10
|
+
/** Milliseconds before an unresolved request is auto-rejected. Default: 30 000. */
|
|
11
|
+
timeoutMs?: number;
|
|
12
|
+
}
|
|
13
|
+
export interface ApprovalCheckResult {
|
|
14
|
+
allowed: boolean;
|
|
15
|
+
reason?: string;
|
|
16
|
+
}
|
|
17
|
+
export interface PendingApproval {
|
|
18
|
+
id: string;
|
|
19
|
+
toolName: string;
|
|
20
|
+
args: unknown;
|
|
21
|
+
createdAt: number;
|
|
22
|
+
}
|
|
23
|
+
export declare class ToolApprovalGate {
|
|
24
|
+
private readonly requireApproval;
|
|
25
|
+
private readonly timeoutMs;
|
|
26
|
+
private readonly pending;
|
|
27
|
+
constructor(config: ToolApprovalGateConfig);
|
|
28
|
+
/**
|
|
29
|
+
* Check whether a tool call is allowed.
|
|
30
|
+
*
|
|
31
|
+
* If the tool is not in the approval list the returned promise resolves
|
|
32
|
+
* immediately with `{ allowed: true }`. Otherwise a pending approval
|
|
33
|
+
* request is created and the promise resolves when `resolve()` is called
|
|
34
|
+
* or the timeout expires.
|
|
35
|
+
*/
|
|
36
|
+
check(toolName: string, args: unknown): Promise<ApprovalCheckResult>;
|
|
37
|
+
/** Return a snapshot of all pending approval requests. */
|
|
38
|
+
getPending(): PendingApproval[];
|
|
39
|
+
/**
|
|
40
|
+
* Resolve a pending approval request.
|
|
41
|
+
*
|
|
42
|
+
* @returns The resolved request, or `undefined` if the id was not found.
|
|
43
|
+
*/
|
|
44
|
+
resolve(id: string, approved: boolean, comment?: string): PendingApproval | undefined;
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=tool-approval-gate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-approval-gate.d.ts","sourceRoot":"","sources":["../src/tool-approval-gate.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,MAAM,WAAW,sBAAsB;IACrC,kEAAkE;IAClE,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,mFAAmF;IACnF,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,OAAO,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;CACnB;AAgBD,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAc;IAC9C,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IACnC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAmC;gBAE/C,MAAM,EAAE,sBAAsB;IAK1C;;;;;;;OAOG;IACG,KAAK,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAuB1E,0DAA0D;IAC1D,UAAU,IAAI,eAAe,EAAE;IAI/B;;;;OAIG;IACH,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS;CAetF"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ToolApprovalGate — interactive approval gate for sensitive tool invocations.
|
|
3
|
+
*
|
|
4
|
+
* Tools listed in `requireApproval` are held pending until a human resolves
|
|
5
|
+
* them (approve / reject) or the timeout expires.
|
|
6
|
+
*/
|
|
7
|
+
import * as crypto from 'node:crypto';
|
|
8
|
+
// ── Helpers ─────────────────────────────────────────────────────────
|
|
9
|
+
function generateId() {
|
|
10
|
+
return 'apr_' + crypto.randomUUID().replace(/-/g, '').slice(0, 12);
|
|
11
|
+
}
|
|
12
|
+
// ── Gate ────────────────────────────────────────────────────────────
|
|
13
|
+
export class ToolApprovalGate {
|
|
14
|
+
requireApproval;
|
|
15
|
+
timeoutMs;
|
|
16
|
+
pending = new Map();
|
|
17
|
+
constructor(config) {
|
|
18
|
+
this.requireApproval = new Set(config.requireApproval);
|
|
19
|
+
this.timeoutMs = config.timeoutMs ?? 30_000;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Check whether a tool call is allowed.
|
|
23
|
+
*
|
|
24
|
+
* If the tool is not in the approval list the returned promise resolves
|
|
25
|
+
* immediately with `{ allowed: true }`. Otherwise a pending approval
|
|
26
|
+
* request is created and the promise resolves when `resolve()` is called
|
|
27
|
+
* or the timeout expires.
|
|
28
|
+
*/
|
|
29
|
+
async check(toolName, args) {
|
|
30
|
+
if (!this.requireApproval.has(toolName)) {
|
|
31
|
+
return { allowed: true };
|
|
32
|
+
}
|
|
33
|
+
return new Promise((promiseResolve) => {
|
|
34
|
+
const id = generateId();
|
|
35
|
+
const request = {
|
|
36
|
+
id,
|
|
37
|
+
toolName,
|
|
38
|
+
args,
|
|
39
|
+
createdAt: Date.now(),
|
|
40
|
+
};
|
|
41
|
+
const timer = setTimeout(() => {
|
|
42
|
+
this.pending.delete(id);
|
|
43
|
+
promiseResolve({ allowed: false, reason: `Approval timeout after ${this.timeoutMs}ms` });
|
|
44
|
+
}, this.timeoutMs);
|
|
45
|
+
this.pending.set(id, { request, resolve: promiseResolve, timer });
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
/** Return a snapshot of all pending approval requests. */
|
|
49
|
+
getPending() {
|
|
50
|
+
return [...this.pending.values()].map((e) => e.request);
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Resolve a pending approval request.
|
|
54
|
+
*
|
|
55
|
+
* @returns The resolved request, or `undefined` if the id was not found.
|
|
56
|
+
*/
|
|
57
|
+
resolve(id, approved, comment) {
|
|
58
|
+
const entry = this.pending.get(id);
|
|
59
|
+
if (!entry)
|
|
60
|
+
return undefined;
|
|
61
|
+
clearTimeout(entry.timer);
|
|
62
|
+
this.pending.delete(id);
|
|
63
|
+
if (approved) {
|
|
64
|
+
entry.resolve({ allowed: true });
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
entry.resolve({ allowed: false, reason: comment ?? 'Rejected' });
|
|
68
|
+
}
|
|
69
|
+
return entry.request;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=tool-approval-gate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-approval-gate.js","sourceRoot":"","sources":["../src/tool-approval-gate.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AA6BtC,uEAAuE;AAEvE,SAAS,UAAU;IACjB,OAAO,MAAM,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;AACrE,CAAC;AAED,uEAAuE;AAEvE,MAAM,OAAO,gBAAgB;IACV,eAAe,CAA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C,CAAC,CAAC,OAAO,CAAC,CAAC;IAC1D,CAAC;IAED;;;;OAIG;IACH,OAAO,CAAC,EAAU,EAAE,QAAiB,EAAE,OAAgB;QACrD,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACnC,IAAI,CAAC,KAAK;YAAE,OAAO,SAAS,CAAC;QAE7B,YAAY,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAC1B,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QAExB,IAAI,QAAQ,EAAE,CAAC;YACb,KAAK,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;QACnC,CAAC;aAAM,CAAC;YACN,KAAK,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,IAAI,UAAU,EAAE,CAAC,CAAC;QACnE,CAAC;QAED,OAAO,KAAK,CAAC,OAAO,CAAC;IACvB,CAAC;CACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@auxiora/runtime",
|
|
3
|
-
"version": "1.10.
|
|
3
|
+
"version": "1.10.11",
|
|
4
4
|
"description": "Runtime that connects all Auxiora components",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -13,89 +13,91 @@
|
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"express": "^5.1.0",
|
|
16
|
-
"
|
|
17
|
-
"@auxiora/
|
|
18
|
-
"@auxiora/ambient": "1.10.
|
|
19
|
-
"@auxiora/
|
|
20
|
-
"@auxiora/
|
|
21
|
-
"@auxiora/
|
|
22
|
-
"@auxiora/
|
|
23
|
-
"@auxiora/
|
|
24
|
-
"@auxiora/backup": "
|
|
25
|
-
"@auxiora/
|
|
26
|
-
"@auxiora/
|
|
27
|
-
"@auxiora/
|
|
28
|
-
"@auxiora/
|
|
29
|
-
"@auxiora/
|
|
30
|
-
"@auxiora/
|
|
31
|
-
"@auxiora/
|
|
32
|
-
"@auxiora/
|
|
33
|
-
"@auxiora/
|
|
34
|
-
"@auxiora/
|
|
35
|
-
"@auxiora/connector-
|
|
36
|
-
"@auxiora/connector-
|
|
37
|
-
"@auxiora/
|
|
38
|
-
"@auxiora/connector-notion": "1.10.
|
|
39
|
-
"@auxiora/
|
|
40
|
-
"@auxiora/connector-
|
|
41
|
-
"@auxiora/
|
|
42
|
-
"@auxiora/connector-
|
|
43
|
-
"@auxiora/
|
|
44
|
-
"@auxiora/
|
|
45
|
-
"@auxiora/
|
|
46
|
-
"@auxiora/
|
|
47
|
-
"@auxiora/
|
|
48
|
-
"@auxiora/
|
|
49
|
-
"@auxiora/
|
|
50
|
-
"@auxiora/
|
|
51
|
-
"@auxiora/
|
|
52
|
-
"@auxiora/email-intelligence": "1.10.
|
|
53
|
-
"@auxiora/
|
|
54
|
-
"@auxiora/
|
|
55
|
-
"@auxiora/
|
|
56
|
-
"@auxiora/
|
|
57
|
-
"@auxiora/
|
|
58
|
-
"@auxiora/
|
|
59
|
-
"@auxiora/
|
|
60
|
-
"@auxiora/
|
|
61
|
-
"@auxiora/
|
|
62
|
-
"@auxiora/media": "1.10.
|
|
63
|
-
"@auxiora/
|
|
64
|
-
"@auxiora/
|
|
65
|
-
"@auxiora/
|
|
66
|
-
"@auxiora/
|
|
67
|
-
"@auxiora/
|
|
68
|
-
"@auxiora/
|
|
69
|
-
"@auxiora/
|
|
70
|
-
"@auxiora/
|
|
71
|
-
"@auxiora/
|
|
72
|
-
"@auxiora/
|
|
73
|
-
"@auxiora/
|
|
74
|
-
"@auxiora/
|
|
75
|
-
"@auxiora/
|
|
76
|
-
"@auxiora/
|
|
77
|
-
"@auxiora/sessions": "1.10.
|
|
78
|
-
"@auxiora/
|
|
79
|
-
"@auxiora/
|
|
80
|
-
"@auxiora/
|
|
81
|
-
"@auxiora/
|
|
82
|
-
"@auxiora/
|
|
83
|
-
"@auxiora/
|
|
84
|
-
"@auxiora/tts": "1.10.
|
|
85
|
-
"@auxiora/tools": "1.10.
|
|
86
|
-
"@auxiora/
|
|
87
|
-
"@auxiora/workflows": "1.10.
|
|
88
|
-
"@auxiora/
|
|
16
|
+
"ws": "^8.18.0",
|
|
17
|
+
"@auxiora/agent-protocol": "1.10.11",
|
|
18
|
+
"@auxiora/ambient": "1.10.11",
|
|
19
|
+
"@auxiora/approval-queue": "1.10.11",
|
|
20
|
+
"@auxiora/audit": "1.10.11",
|
|
21
|
+
"@auxiora/model-registry": "1.10.11",
|
|
22
|
+
"@auxiora/provider-openrouter": "1.10.11",
|
|
23
|
+
"@auxiora/provider-huggingface": "1.10.11",
|
|
24
|
+
"@auxiora/backup": "1.10.11",
|
|
25
|
+
"@auxiora/autonomy": "1.10.11",
|
|
26
|
+
"@auxiora/behaviors": "1.10.11",
|
|
27
|
+
"@auxiora/browser": "1.10.11",
|
|
28
|
+
"@auxiora/calendar-intelligence": "1.10.11",
|
|
29
|
+
"@auxiora/canvas": "1.10.11",
|
|
30
|
+
"@auxiora/a2a": "1.10.11",
|
|
31
|
+
"@auxiora/config": "1.10.11",
|
|
32
|
+
"@auxiora/code-interpreter": "1.10.11",
|
|
33
|
+
"@auxiora/connector-github": "1.10.11",
|
|
34
|
+
"@auxiora/connector-google-workspace": "1.10.11",
|
|
35
|
+
"@auxiora/connector-homeassistant": "1.10.11",
|
|
36
|
+
"@auxiora/connector-linear": "1.10.11",
|
|
37
|
+
"@auxiora/compose": "1.10.11",
|
|
38
|
+
"@auxiora/connector-notion": "1.10.11",
|
|
39
|
+
"@auxiora/channels": "1.10.11",
|
|
40
|
+
"@auxiora/connector-hue": "1.10.11",
|
|
41
|
+
"@auxiora/connector-microsoft": "1.10.11",
|
|
42
|
+
"@auxiora/connector-social": "1.10.11",
|
|
43
|
+
"@auxiora/connector-spotify": "1.10.11",
|
|
44
|
+
"@auxiora/connector-obsidian": "1.10.11",
|
|
45
|
+
"@auxiora/consciousness": "1.10.11",
|
|
46
|
+
"@auxiora/connectors": "1.10.11",
|
|
47
|
+
"@auxiora/conversation": "1.10.11",
|
|
48
|
+
"@auxiora/conversation-branch": "1.10.11",
|
|
49
|
+
"@auxiora/contacts": "1.10.11",
|
|
50
|
+
"@auxiora/core": "1.10.11",
|
|
51
|
+
"@auxiora/dashboard": "1.10.11",
|
|
52
|
+
"@auxiora/email-intelligence": "1.10.11",
|
|
53
|
+
"@auxiora/evaluation": "1.10.11",
|
|
54
|
+
"@auxiora/gateway": "1.10.11",
|
|
55
|
+
"@auxiora/guardrails": "1.10.11",
|
|
56
|
+
"@auxiora/intent": "1.10.11",
|
|
57
|
+
"@auxiora/introspection": "1.10.11",
|
|
58
|
+
"@auxiora/image-gen": "1.10.11",
|
|
59
|
+
"@auxiora/knowledge-graph": "1.10.11",
|
|
60
|
+
"@auxiora/logger": "1.10.11",
|
|
61
|
+
"@auxiora/mcp": "1.10.11",
|
|
62
|
+
"@auxiora/media": "1.10.11",
|
|
63
|
+
"@auxiora/nl-automation": "1.10.11",
|
|
64
|
+
"@auxiora/job-queue": "1.10.11",
|
|
65
|
+
"@auxiora/memory": "1.10.11",
|
|
66
|
+
"@auxiora/orchestrator": "1.10.11",
|
|
67
|
+
"@auxiora/plugins": "1.10.11",
|
|
68
|
+
"@auxiora/personality": "1.10.11",
|
|
69
|
+
"@auxiora/providers": "1.10.11",
|
|
70
|
+
"@auxiora/rag": "1.10.11",
|
|
71
|
+
"@auxiora/react-loop": "1.10.11",
|
|
72
|
+
"@auxiora/research": "1.10.11",
|
|
73
|
+
"@auxiora/os-bridge": "1.10.11",
|
|
74
|
+
"@auxiora/notification-hub": "1.10.11",
|
|
75
|
+
"@auxiora/self-awareness": "1.10.11",
|
|
76
|
+
"@auxiora/router": "1.10.11",
|
|
77
|
+
"@auxiora/sessions": "1.10.11",
|
|
78
|
+
"@auxiora/screen": "1.10.11",
|
|
79
|
+
"@auxiora/sandbox": "1.10.11",
|
|
80
|
+
"@auxiora/social": "1.10.11",
|
|
81
|
+
"@auxiora/updater": "1.10.11",
|
|
82
|
+
"@auxiora/vector-store": "1.10.11",
|
|
83
|
+
"@auxiora/stt": "1.10.11",
|
|
84
|
+
"@auxiora/tts": "1.10.11",
|
|
85
|
+
"@auxiora/tools": "1.10.11",
|
|
86
|
+
"@auxiora/webhooks": "1.10.11",
|
|
87
|
+
"@auxiora/workflows": "1.10.11",
|
|
88
|
+
"@auxiora/voice": "1.10.11",
|
|
89
|
+
"@auxiora/vault": "1.10.11"
|
|
89
90
|
},
|
|
90
91
|
"devDependencies": {
|
|
91
92
|
"@types/express": "^5.0.0",
|
|
93
|
+
"@types/ws": "^8.5.10",
|
|
92
94
|
"@types/supertest": "^6.0.0",
|
|
93
95
|
"supertest": "^7.1.0",
|
|
94
|
-
"@auxiora/
|
|
95
|
-
"@auxiora/
|
|
96
|
-
"@auxiora/
|
|
97
|
-
"@auxiora/
|
|
98
|
-
"@auxiora/
|
|
96
|
+
"@auxiora/callgraph": "1.10.11",
|
|
97
|
+
"@auxiora/event-bus": "1.10.11",
|
|
98
|
+
"@auxiora/telemetry": "1.10.11",
|
|
99
|
+
"@auxiora/reasoning": "1.10.11",
|
|
100
|
+
"@auxiora/overseer": "1.10.11"
|
|
99
101
|
},
|
|
100
102
|
"engines": {
|
|
101
103
|
"node": ">=22.0.0"
|