@backendkit-labs/agent-core 0.37.2 → 0.38.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 +132 -43
- package/dist/delegation/DelegationBus.d.ts +8 -1
- package/dist/delegation/DelegationBus.d.ts.map +1 -1
- package/dist/delegation/DelegationBus.js +2 -1
- package/dist/delegation/DelegationBus.js.map +1 -1
- package/dist/engine/AgentEngine.d.ts +108 -3
- package/dist/engine/AgentEngine.d.ts.map +1 -1
- package/dist/engine/AgentEngine.js +463 -43
- package/dist/engine/AgentEngine.js.map +1 -1
- package/dist/engine/createBaseEngine.d.ts +28 -0
- package/dist/engine/createBaseEngine.d.ts.map +1 -1
- package/dist/engine/createBaseEngine.js +7 -0
- package/dist/engine/createBaseEngine.js.map +1 -1
- package/dist/engine/package-install.d.ts +7 -0
- package/dist/engine/package-install.d.ts.map +1 -1
- package/dist/engine/package-install.js +17 -0
- package/dist/engine/package-install.js.map +1 -1
- package/dist/governance/approval-store.d.ts +32 -0
- package/dist/governance/approval-store.d.ts.map +1 -0
- package/dist/governance/approval-store.js +129 -0
- package/dist/governance/approval-store.js.map +1 -0
- package/dist/governance/approval.d.ts +35 -0
- package/dist/governance/approval.d.ts.map +1 -0
- package/dist/governance/approval.js +65 -0
- package/dist/governance/approval.js.map +1 -0
- package/dist/governance/approvers.d.ts +24 -0
- package/dist/governance/approvers.d.ts.map +1 -0
- package/dist/governance/approvers.js +69 -0
- package/dist/governance/approvers.js.map +1 -0
- package/dist/governance/audit.d.ts +101 -0
- package/dist/governance/audit.d.ts.map +1 -0
- package/dist/governance/audit.js +178 -0
- package/dist/governance/audit.js.map +1 -0
- package/dist/governance/hooks.d.ts +60 -0
- package/dist/governance/hooks.d.ts.map +1 -0
- package/dist/governance/hooks.js +26 -0
- package/dist/governance/hooks.js.map +1 -0
- package/dist/governance/policy.d.ts +28 -0
- package/dist/governance/policy.d.ts.map +1 -0
- package/dist/governance/policy.js +101 -0
- package/dist/governance/policy.js.map +1 -0
- package/dist/governance/types.d.ts +162 -0
- package/dist/governance/types.d.ts.map +1 -0
- package/dist/governance/types.js +3 -0
- package/dist/governance/types.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +28 -2
- package/dist/index.js.map +1 -1
- package/dist/mcp/tool-server-http.d.ts +2 -6
- package/dist/mcp/tool-server-http.d.ts.map +1 -1
- package/dist/mcp/tool-server-http.js +4 -20
- package/dist/mcp/tool-server-http.js.map +1 -1
- package/dist/mcp/tool-server.d.ts +18 -4
- package/dist/mcp/tool-server.d.ts.map +1 -1
- package/dist/mcp/tool-server.js +110 -22
- package/dist/mcp/tool-server.js.map +1 -1
- package/dist/shared/utils/canonical-json.d.ts +12 -0
- package/dist/shared/utils/canonical-json.d.ts.map +1 -0
- package/dist/shared/utils/canonical-json.js +29 -0
- package/dist/shared/utils/canonical-json.js.map +1 -0
- package/dist/shared/utils/loopback.d.ts +10 -0
- package/dist/shared/utils/loopback.d.ts.map +1 -0
- package/dist/shared/utils/loopback.js +25 -0
- package/dist/shared/utils/loopback.js.map +1 -0
- package/dist/types/index.d.ts +10 -0
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -4,8 +4,6 @@ The foundation engine for the BackendKit Labs agent framework. Provides everythi
|
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/@backendkit-labs/agent-core)
|
|
6
6
|
|
|
7
|
-
> **Status: `core`** — Required by the enterprise use case. Breaking changes go through full review before merging.
|
|
8
|
-
|
|
9
7
|
## Table of contents
|
|
10
8
|
|
|
11
9
|
- [Installation](#installation)
|
|
@@ -286,7 +284,7 @@ new AgentEngine({
|
|
|
286
284
|
|
|
287
285
|
// Observability
|
|
288
286
|
observability: obsManager,
|
|
289
|
-
|
|
287
|
+
audit: new NdjsonAuditSink('/path/to/audit.ndjson'), // one AuditEvent per tool call (see Observability → Audit)
|
|
290
288
|
|
|
291
289
|
// Context injected into the system prompt
|
|
292
290
|
projectContext: 'You are working in project X...',
|
|
@@ -323,7 +321,7 @@ await engine.run('Analyze the database schema', {
|
|
|
323
321
|
| `'step-by-step'` | Calls `onStep` after every iteration; return `false` to stop |
|
|
324
322
|
| `'interactive'` | Calls `onIterationLimit` when cap is reached; return `true` to continue. Without that callback the run stops at the cap |
|
|
325
323
|
|
|
326
|
-
Tool approval is independent of the mode: whenever `onToolApproval` is set, the engine asks before `write_file`, `edit_file`, `run_command` and package installs.
|
|
324
|
+
Tool approval is independent of the mode: whenever `onToolApproval` is set, the engine asks before `write_file`, `edit_file`, `run_command` and package installs. That is the legacy gate, and it is what coding agents should keep using for now. For approval decided by what tools declare (`readOnly`, `destructive`), by a policy, or by another agent or a service, see [Policy and approval](#policy-and-approval-per-call).
|
|
327
325
|
|
|
328
326
|
```typescript
|
|
329
327
|
// Approval — user approves destructive tool calls
|
|
@@ -475,7 +473,7 @@ stored history is corrected and a `guardrail` event carries the `replacement` fo
|
|
|
475
473
|
until the answer is checked: nothing unchecked is ever shown, but there is no streaming.
|
|
476
474
|
|
|
477
475
|
Every redaction, block and error emits a `{ type: 'guardrail', name, phase, action, reason, ... }` event, is written to the
|
|
478
|
-
`auditLog` as `guardrail:<phase>:<name>`, and is counted in `MetricsSnapshot.guardrails`.
|
|
476
|
+
legacy `auditLog` as `guardrail:<phase>:<name>`, and is counted in `MetricsSnapshot.guardrails`.
|
|
479
477
|
|
|
480
478
|
---
|
|
481
479
|
|
|
@@ -610,43 +608,29 @@ await engine.run("What's my name?"); // → "Your name is Alice."
|
|
|
610
608
|
|
|
611
609
|
## MCP client
|
|
612
610
|
|
|
613
|
-
`MCPClientManager` connects to external MCP (Model Context Protocol) servers, discovers their tools, and makes them available to the engine.
|
|
611
|
+
`MCPClientManager` connects to external MCP (Model Context Protocol) servers, discovers their tools, and makes them available to the engine. One `MCPServerConfig` per server decides the transport:
|
|
612
|
+
|
|
613
|
+
- `command` (+ `args`, `env`) — a local subprocess over stdio.
|
|
614
|
+
- `url` (+ `headers`) — a remote server over Streamable HTTP, falling back to SSE when the server answers 4xx; force one with `remoteTransport: 'streamable-http' | 'sse'`.
|
|
615
|
+
- When both are set, `url` wins.
|
|
614
616
|
|
|
615
|
-
###
|
|
617
|
+
### Standalone
|
|
616
618
|
|
|
617
619
|
```typescript
|
|
618
620
|
import { MCPClientManager } from '@backendkit-labs/agent-core';
|
|
619
621
|
|
|
620
|
-
const mcp = new MCPClientManager(
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
command: 'npx',
|
|
625
|
-
args: ['-y', '@modelcontextprotocol/server-filesystem', '/workspace'],
|
|
626
|
-
env: {},
|
|
627
|
-
});
|
|
628
|
-
|
|
629
|
-
const tools = mcp.getTools(); // ToolDefinition[] — discovered from the server
|
|
630
|
-
```
|
|
631
|
-
|
|
632
|
-
### HTTP transport
|
|
622
|
+
const mcp = new MCPClientManager([
|
|
623
|
+
{ name: 'filesystem', command: 'npx', args: ['-y', '@modelcontextprotocol/server-filesystem', '/workspace'] },
|
|
624
|
+
{ name: 'remote', url: 'https://mcp.example.com/v1', headers: { Authorization: `Bearer ${process.env.MCP_TOKEN}` } },
|
|
625
|
+
]);
|
|
633
626
|
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
apiKey: process.env.MCP_API_KEY,
|
|
639
|
-
});
|
|
627
|
+
await mcp.initialize(); // connects every configured server
|
|
628
|
+
const tools = mcp.getTools(); // ToolDefinition[], named mcp__{server}__{tool}
|
|
629
|
+
mcp.isConnected('remote'); // per-server status
|
|
630
|
+
await mcp.disconnect();
|
|
640
631
|
```
|
|
641
632
|
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
```typescript
|
|
645
|
-
await mcp.connectSSE({
|
|
646
|
-
name: 'legacy-server',
|
|
647
|
-
url: 'http://localhost:8080/sse',
|
|
648
|
-
});
|
|
649
|
-
```
|
|
633
|
+
Other useful fields: `timeoutMs` (per tool call, default 30 s), `connectTimeoutMs`, `trustAnnotations` (believe the server's `readOnlyHint` and `_meta`; off by default), `mode: 'tools' | 'agent'` and `assignTo` (which agents get the tools).
|
|
650
634
|
|
|
651
635
|
### Multiple servers via engine options
|
|
652
636
|
|
|
@@ -672,8 +656,8 @@ The client detects server crashes via `client.onclose` and marks them `'failed'`
|
|
|
672
656
|
// For manual use:
|
|
673
657
|
mcp.setDisconnectHandler((serverName) => {
|
|
674
658
|
console.warn(`MCP server "${serverName}" disconnected`);
|
|
675
|
-
// Re-attempt connection on next engine.run() call
|
|
676
659
|
});
|
|
660
|
+
await mcp.reconnectFailed(); // retry the servers marked 'failed'
|
|
677
661
|
```
|
|
678
662
|
|
|
679
663
|
---
|
|
@@ -820,7 +804,7 @@ const memory = createMemorySystem({
|
|
|
820
804
|
path: '~/.bk-agent/projects/my-project/memory/patterns.json',
|
|
821
805
|
},
|
|
822
806
|
retention: {
|
|
823
|
-
maxEpisodes: 500, // prunes by relevance score when exceeded
|
|
807
|
+
maxEpisodes: 500, // prunes by relevance score when exceeded
|
|
824
808
|
summarizeAfter: 50,
|
|
825
809
|
// Optional: compress old episodes with an LLM summary
|
|
826
810
|
summarizeFn: async (episodes) => {
|
|
@@ -871,7 +855,7 @@ await procedural.add({
|
|
|
871
855
|
const deploySteps = await procedural.get('deploy-to-staging');
|
|
872
856
|
```
|
|
873
857
|
|
|
874
|
-
### Forgetting curve
|
|
858
|
+
### Forgetting curve
|
|
875
859
|
|
|
876
860
|
When `maxEpisodes` is set and the limit is exceeded, `EpisodicMemory` prunes by **relevance score** rather than raw age:
|
|
877
861
|
|
|
@@ -917,7 +901,7 @@ interface MemoryStoreBackend {
|
|
|
917
901
|
upsert(id: string, record: StoredRecord): void;
|
|
918
902
|
getAll(): StoredRecord[];
|
|
919
903
|
deleteOldest(keepNewest: number): void;
|
|
920
|
-
deleteByIds(ids: string[]): void; //
|
|
904
|
+
deleteByIds(ids: string[]): void; // used by relevance-based pruning
|
|
921
905
|
count(): number;
|
|
922
906
|
}
|
|
923
907
|
```
|
|
@@ -1011,18 +995,123 @@ const tracer = new Tracer({
|
|
|
1011
995
|
});
|
|
1012
996
|
```
|
|
1013
997
|
|
|
1014
|
-
### Audit
|
|
998
|
+
### Audit (one event per tool call)
|
|
1015
999
|
|
|
1016
|
-
|
|
1000
|
+
Give the engine one or more `AuditSink`s and it records **exactly one `AuditEvent` per tool call**, whether it ran or was refused (not found, not in `allowedTools`, blocked by a guardrail or the sandbox, rejected by the approver), plus one per `ask_agent` delegation. Arguments are recorded only as a SHA-256 of their canonical JSON, never in clear.
|
|
1017
1001
|
|
|
1018
1002
|
```typescript
|
|
1019
|
-
|
|
1003
|
+
import { createBaseEngine, HashChainAuditSink, NdjsonAuditSink, verifyAuditChain } from '@backendkit-labs/agent-core';
|
|
1004
|
+
|
|
1005
|
+
const engine = createBaseEngine({
|
|
1006
|
+
...opts,
|
|
1007
|
+
identity: { tenantId: 'acme', userId: 'u-42', roles: ['treasury'] }, // part of every event's principal
|
|
1008
|
+
audit: [
|
|
1009
|
+
new NdjsonAuditSink('/var/log/agent/events.ndjson'), // plain, one JSON line per event
|
|
1010
|
+
new HashChainAuditSink('/var/log/agent/chain.log', { secret: process.env.AUDIT_KEY }), // tamper-evident
|
|
1011
|
+
],
|
|
1012
|
+
});
|
|
1013
|
+
|
|
1014
|
+
// Later, or on another host:
|
|
1015
|
+
verifyAuditChain('/var/log/agent/chain.log', { secret: process.env.AUDIT_KEY });
|
|
1016
|
+
// → { ok: true, entries, head } or { ok: false, brokenAt, reason }
|
|
1017
|
+
```
|
|
1018
|
+
|
|
1019
|
+
An event carries `at`, `principal` (agent, session, delegation chain, tenant, user), `tool`, `argsHash`, `decision` (`allow`, `deny`, `ask`, `not_found`, `not_allowed`, `sandbox_denied`, `guardrail_blocked`), `outcome` when it ran (`ok`, `error`, `timeout`, `aborted`), `durationMs`, the sandbox decisions taken during the call and the tool's `meta`. Sinks receive events one at a time in call order; a failing sink is reported on the transport (`system` warning) and never changes the result. `HashChainAuditSink` links every entry to the previous one, so editing, removing or reordering entries is detected; with a `secret` a log rewritten by someone without it does not verify either. It refuses to extend a log that is already broken.
|
|
1020
|
+
|
|
1021
|
+
`auditLog: '/path.ndjson'` (the older option) still works unchanged but is deprecated: it writes up to 200 characters of the arguments in clear. It will be removed in 0.40.
|
|
1022
|
+
|
|
1023
|
+
### Policy and approval (per call)
|
|
1024
|
+
|
|
1025
|
+
A `ToolPolicy` decides every tool call and every `ask_agent` delegation: `allow`, `deny` or `ask`. It sees the principal (agent, delegation chain, tenant, user, roles) and the call (the tool with its declared facts, the arguments after guardrails). An `ask` goes to the `approver` (a person, another agent, a service), or is stored as pending in `approvals` when nobody answers now.
|
|
1026
|
+
|
|
1027
|
+
```typescript
|
|
1028
|
+
import { createBaseEngine, type ToolPolicy, type Approver } from '@backendkit-labs/agent-core';
|
|
1029
|
+
|
|
1030
|
+
const treasuryRules: ToolPolicy = {
|
|
1031
|
+
decide(principal, call) {
|
|
1032
|
+
if (call.tool.name === 'pay_invoice' && (call.args.amount as number) > 10_000) {
|
|
1033
|
+
return { effect: 'ask', reason: 'payment above 10k', accepts: ['human'] };
|
|
1034
|
+
}
|
|
1035
|
+
if (!principal.roles?.includes('treasury') && !call.tool.readOnly) {
|
|
1036
|
+
return { effect: 'deny', reason: 'only treasury writes' };
|
|
1037
|
+
}
|
|
1038
|
+
return { effect: 'allow' };
|
|
1039
|
+
},
|
|
1040
|
+
};
|
|
1041
|
+
|
|
1042
|
+
const engine = createBaseEngine({
|
|
1020
1043
|
...opts,
|
|
1021
|
-
|
|
1022
|
-
//
|
|
1044
|
+
identity: { tenantId: 'acme', userId: 'u-42', roles: ['treasury'] },
|
|
1045
|
+
policy: treasuryRules, // several combine: deny > ask > allow; a throwing policy denies
|
|
1046
|
+
approver: myApprover, // { ref, request(req) → { decision, by: { kind, id }, at } }
|
|
1047
|
+
audit: new HashChainAuditSink('audit.log'),
|
|
1023
1048
|
});
|
|
1024
1049
|
```
|
|
1025
1050
|
|
|
1051
|
+
- **Without `policy`**, but with someone to ask, `defaultToolPolicy` applies. Tools declared `readOnly` run. Tools declared `destructive` always ask a person. Anything else asks.
|
|
1052
|
+
- **Approvals are validated before they count:**
|
|
1053
|
+
- the approver's kind must be accepted;
|
|
1054
|
+
- nobody approves their own request or one from their delegation chain;
|
|
1055
|
+
- an agent approves only what it could do itself.
|
|
1056
|
+
|
|
1057
|
+
Every approval is audited with who gave it.
|
|
1058
|
+
- **`allow` can carry a mode.** `mode: 'dry_run'` runs the tool with `ctx.dryRun = true`. `mode: 'sandboxed'` requires a configured sandbox.
|
|
1059
|
+
- **Opt-in.** Setting `policy`, `approver` or `approvals` switches to this path. Without them, `onToolApproval` behaves exactly as before. With them, `onToolApproval` is adapted as the approver: "approve all" never covers destructive tools or package installs.
|
|
1060
|
+
|
|
1061
|
+
### Durable approvals
|
|
1062
|
+
|
|
1063
|
+
If nobody can answer an `ask` right now, give the engine an `approvals` store. The call is stored as pending, the model is told it did not run, and whoever decides later runs it with `runApproved`.
|
|
1064
|
+
|
|
1065
|
+
```typescript
|
|
1066
|
+
import { createBaseEngine, FileApprovalStore, agentApprover, consoleApprover } from '@backendkit-labs/agent-core';
|
|
1067
|
+
|
|
1068
|
+
const approvals = new FileApprovalStore('/var/lib/agent/approvals');
|
|
1069
|
+
const engine = createBaseEngine({ ...opts, approvals });
|
|
1070
|
+
|
|
1071
|
+
await engine.run('pay the October invoices'); // asks become pending requests
|
|
1072
|
+
|
|
1073
|
+
// Later, maybe in another process (a UI, Hermes, a CLI):
|
|
1074
|
+
const [req] = await approvals.list({ status: 'pending' });
|
|
1075
|
+
await approvals.resolve(req.id, { decision: 'approve', by: { kind: 'human', id: 'ana' }, at: new Date().toISOString() });
|
|
1076
|
+
const result = await engine.runApproved(req.id); // runs once; a second call throws
|
|
1077
|
+
|
|
1078
|
+
// Approvers that answer right away:
|
|
1079
|
+
createBaseEngine({ ...opts, approver: consoleApprover() }); // a person at the terminal
|
|
1080
|
+
createBaseEngine({ ...opts, approver: agentApprover((id, q) => engine.consultAgent(id, q), 'supervisor') }); // another agent
|
|
1081
|
+
```
|
|
1082
|
+
|
|
1083
|
+
- **One decision and one execution per request.** `FileApprovalStore` allows exactly one decision and one execution per request, even across processes that share the directory.
|
|
1084
|
+
- **Everything is checked again.** `runApproved` repeats every check. A stored approval only satisfies an `ask` whose `accepts` admits the approver: an approval from an agent never covers a destructive tool.
|
|
1085
|
+
- **An invalid approval is spent.** If the approval turns out not to be valid, it is consumed and audited as `deny`.
|
|
1086
|
+
|
|
1087
|
+
### Lifecycle hooks
|
|
1088
|
+
|
|
1089
|
+
Hooks let a vertical plug into a turn without new engine options. Every hook of one turn shares a `RunContext`: the principal, the input, a `state` map and an abort `signal`.
|
|
1090
|
+
|
|
1091
|
+
```typescript
|
|
1092
|
+
import { createBaseEngine, type EngineHooks } from '@backendkit-labs/agent-core';
|
|
1093
|
+
|
|
1094
|
+
const review: EngineHooks = {
|
|
1095
|
+
name: 'review',
|
|
1096
|
+
beforeRun: (ctx) => ctx.state.set('task', classify(ctx.input)),
|
|
1097
|
+
systemPrompt: (ctx, profile) => profile.id === 'general' ? `## Task\n${describe(ctx.state.get('task'))}` : undefined,
|
|
1098
|
+
afterTurn: (ctx, turn) => !ctx.state.get('reviewed') && turn.profile.id === 'general'
|
|
1099
|
+
? { action: 'continue', agentId: 'reviewer', message: 'Review the answer above.' } // another pass, as another agent
|
|
1100
|
+
: undefined,
|
|
1101
|
+
beforeTool: (ctx, call) => metrics.start(call.tool.name),
|
|
1102
|
+
afterTool: (ctx, call, result) => metrics.end(call.tool.name, result.success),
|
|
1103
|
+
afterRun: (ctx, result) => store.save(ctx.state.get('task'), result.text),
|
|
1104
|
+
};
|
|
1105
|
+
|
|
1106
|
+
const engine = createBaseEngine({ ...opts, hooks: [review], maxHookContinues: 3 });
|
|
1107
|
+
```
|
|
1108
|
+
|
|
1109
|
+
- **Order.** Hooks run in registration order.
|
|
1110
|
+
- **`systemPrompt`** adds sections to the active agent and to delegates.
|
|
1111
|
+
- **`afterTurn`** runs when the model answers without asking for tools. The first hook that asks to `continue` wins. The number of extra passes is capped by `maxHookContinues` (default 5) and by `maxIterations`.
|
|
1112
|
+
- **`beforeTool` / `afterTool`** wrap only the calls the policy allowed.
|
|
1113
|
+
- **Errors.** A hook that throws fails the turn, and the error names the hook and the point.
|
|
1114
|
+
|
|
1026
1115
|
---
|
|
1027
1116
|
|
|
1028
1117
|
## Skills and slash commands
|
|
@@ -14,6 +14,11 @@ export interface DelegationRequest {
|
|
|
14
14
|
* slots are occupied by agents that are themselves waiting for nested delegations.
|
|
15
15
|
*/
|
|
16
16
|
depth?: number;
|
|
17
|
+
/**
|
|
18
|
+
* Delegation chain of the agent that asks, oldest first (SPEC-0014 principal). The delegate's chain is this
|
|
19
|
+
* plus its own id. When absent, `[fromAgentId]` is assumed.
|
|
20
|
+
*/
|
|
21
|
+
chain?: string[];
|
|
17
22
|
}
|
|
18
23
|
export interface DelegationResult {
|
|
19
24
|
agentId: string;
|
|
@@ -31,7 +36,9 @@ export interface DelegationBusOptions {
|
|
|
31
36
|
maxDepth?: number;
|
|
32
37
|
agents: AgentRegistry;
|
|
33
38
|
transport: Transport;
|
|
34
|
-
runAgent(agentId: string, question: string, context?: string, depth?: number, outputBuffer?: AgentEvent[]
|
|
39
|
+
runAgent(agentId: string, question: string, context?: string, depth?: number, outputBuffer?: AgentEvent[],
|
|
40
|
+
/** Chain of the delegate itself: the caller's chain plus the delegate's id. */
|
|
41
|
+
chain?: string[]): Promise<DelegationResult>;
|
|
35
42
|
}
|
|
36
43
|
export declare class DelegationBus {
|
|
37
44
|
private readonly opts;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DelegationBus.d.ts","sourceRoot":"","sources":["../../src/delegation/DelegationBus.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,KAAK,EAAE,UAAU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BAAoB;IACjC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,2GAA2G;IAC3G,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,aAAa,CAAC;IACtB,SAAS,EAAE,SAAS,CAAC;IACrB,QAAQ,CACJ,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,MAAM,EAChB,KAAK,CAAC,EAAE,MAAM,EACd,YAAY,CAAC,EAAE,UAAU,EAAE;IAC3B,+EAA+E;IAC/E,KAAK,CAAC,EAAE,MAAM,EAAE,GACjB,OAAO,CAAC,gBAAgB,CAAC,CAAC;CAChC;AAED,qBAAa,aAAa;IASV,OAAO,CAAC,QAAQ,CAAC,IAAI;IARjC;;;;;OAKG;IACH,OAAO,CAAC,QAAQ,CAAC,SAAS,CAA+B;gBAE5B,IAAI,EAAE,oBAAoB;IAIvD,OAAO,CAAC,WAAW;IAenB;;;;;;;OAOG;IACG,WAAW,CAAC,QAAQ,EAAE,iBAAiB,EAAE,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC;IAgBvE,SAAS,CAAC,OAAO,EAAE,iBAAiB,EAAE,YAAY,CAAC,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC,gBAAgB,CAAC;IA0DnG,kBAAkB;CAGrB"}
|
|
@@ -86,7 +86,8 @@ class DelegationBus {
|
|
|
86
86
|
to_name: profile.name,
|
|
87
87
|
to_icon: profile.icon,
|
|
88
88
|
});
|
|
89
|
-
|
|
89
|
+
const callerChain = request.chain ?? (request.fromAgentId ? [request.fromAgentId] : []);
|
|
90
|
+
return this.opts.runAgent(request.agentId, request.question, request.context, depth, outputBuffer, [...callerChain, request.agentId]);
|
|
90
91
|
};
|
|
91
92
|
try {
|
|
92
93
|
return await this.bulkheadFor(depth).execute(execute);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DelegationBus.js","sourceRoot":"","sources":["../../src/delegation/DelegationBus.ts"],"names":[],"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QACN,CAAC;IACL,CAAC;IAED,kBAAkB;QACd,OAAO,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC;IAC5C,CAAC;CACJ;AAjHD,sCAiHC"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { type EngineHooks } from '../governance/hooks';
|
|
2
|
+
import type { ApprovalStore, Approver, AuditSink, Identity, ToolPolicy } from '../governance/types';
|
|
1
3
|
import type { EngineOptions, SessionMemoryData } from '../types';
|
|
2
4
|
import type { Transport } from '../transport/Transport';
|
|
3
5
|
import type { AgentRegistry } from './AgentRegistry';
|
|
@@ -91,8 +93,44 @@ export interface AgentEngineOptions extends EngineOptions {
|
|
|
91
93
|
* Path to an append-only NDJSON file for tool call audit records.
|
|
92
94
|
* Each executed tool call is appended as one JSON line with: ts, session, agent, tool, inputPreview, success, durationMs.
|
|
93
95
|
* Directory is created automatically. Optional — no audit file written when absent.
|
|
96
|
+
* @deprecated Writes up to 200 characters of the arguments in clear. Use `audit` (an `AuditSink`, e.g.
|
|
97
|
+
* `new NdjsonAuditSink(path)` or `new HashChainAuditSink(path)`), whose events carry only a hash of the
|
|
98
|
+
* arguments. Kept unchanged, same file format, until 0.40.
|
|
94
99
|
*/
|
|
95
100
|
auditLog?: string;
|
|
101
|
+
/**
|
|
102
|
+
* Where every tool call (and every `ask_agent` delegation) is recorded, accepted or refused: exactly one
|
|
103
|
+
* `AuditEvent` per call, arguments as a SHA-256 only. Several sinks receive the same events in the same order.
|
|
104
|
+
*/
|
|
105
|
+
audit?: AuditSink | AuditSink[];
|
|
106
|
+
/** Who this engine acts for (tenant, user, roles...). Becomes part of the `Principal` of every call. */
|
|
107
|
+
identity?: Identity;
|
|
108
|
+
/**
|
|
109
|
+
* Decides every tool call and delegation (allow, deny, ask) after allowedTools, the sandbox and the argument
|
|
110
|
+
* guardrails. Several policies combine: deny wins, then ask, then allow. When absent but there is someone to
|
|
111
|
+
* ask (`approver`, `approvals` or `onToolApproval`), `defaultToolPolicy` applies: readOnly runs, everything else
|
|
112
|
+
* asks, destructive asks a person. Setting any of `policy`, `approver` or `approvals` switches the engine to this
|
|
113
|
+
* path; with none of them the legacy `onToolApproval` gate keeps working exactly as before.
|
|
114
|
+
*/
|
|
115
|
+
policy?: ToolPolicy | ToolPolicy[];
|
|
116
|
+
/**
|
|
117
|
+
* Who answers an `ask` right away: a person through a UI, a supervising agent, a service such as Hermes. Its
|
|
118
|
+
* answers are checked (accepted kind, no self-approval, an agent approves only what it can do) and audited.
|
|
119
|
+
* Without it, `onToolApproval` is adapted as the approver.
|
|
120
|
+
*/
|
|
121
|
+
approver?: Approver;
|
|
122
|
+
/**
|
|
123
|
+
* Durable approvals: when nobody answers right away, an `ask` is stored here as pending and the model is told
|
|
124
|
+
* the call did not run (resubmission, SPEC-0014 §6).
|
|
125
|
+
*/
|
|
126
|
+
approvals?: ApprovalStore;
|
|
127
|
+
/**
|
|
128
|
+
* Lifecycle hooks (SPEC-0014 §3): before/after a turn, system prompt sections, after the model's final answer
|
|
129
|
+
* (may force another pass), before/after each tool call. Run in registration order; a throwing hook fails the turn.
|
|
130
|
+
*/
|
|
131
|
+
hooks?: EngineHooks[];
|
|
132
|
+
/** Most extra passes `afterTurn` hooks may force in one turn. Default 5. */
|
|
133
|
+
maxHookContinues?: number;
|
|
96
134
|
/**
|
|
97
135
|
* Called by updateWorkingDir after the workingDir changes (e.g. /workspace switch).
|
|
98
136
|
* Should return the new projectContext string built from the new cwd
|
|
@@ -114,6 +152,19 @@ export declare class AgentEngine {
|
|
|
114
152
|
/** Uncalibrated token estimate of the last request sent by runLoop, to calibrate against real usage. */
|
|
115
153
|
private lastRequestEstimate;
|
|
116
154
|
private readonly auditLogger;
|
|
155
|
+
private readonly audit;
|
|
156
|
+
/** Policy path (SPEC-0014 F2) instead of the legacy ApprovalGate: on when policy, approver or approvals is set. */
|
|
157
|
+
private readonly governed;
|
|
158
|
+
private readonly policies;
|
|
159
|
+
private readonly approver?;
|
|
160
|
+
/** Set when the approver is the adapted onToolApproval callback, so disable/enableToolApproval reach it. */
|
|
161
|
+
private readonly callbackApprover?;
|
|
162
|
+
private readonly hooks;
|
|
163
|
+
/** Context shared by the hooks of the turn in progress; undefined between turns. */
|
|
164
|
+
private runCtx?;
|
|
165
|
+
private runController?;
|
|
166
|
+
/** Last final answer of the model in the current turn (for afterRun). */
|
|
167
|
+
private lastAnswer;
|
|
117
168
|
private currentAgentId;
|
|
118
169
|
private aborted;
|
|
119
170
|
private abortController;
|
|
@@ -191,7 +242,30 @@ export declare class AgentEngine {
|
|
|
191
242
|
private getProviderForProfile;
|
|
192
243
|
run(input: string): Promise<void>;
|
|
193
244
|
private _run;
|
|
245
|
+
/** Sections the `systemPrompt` hooks add for `profile`. */
|
|
246
|
+
private hookPromptSections;
|
|
247
|
+
/** The first `afterTurn` hook that asks to continue wins; the rest still run (they may only observe). */
|
|
248
|
+
private afterTurnHooks;
|
|
249
|
+
/** Arguments the model produced, as an object (anything else becomes `{}`). */
|
|
250
|
+
private parseArgs;
|
|
251
|
+
/** Context for a tool hook: the turn's context with the principal of the agent that makes the call. */
|
|
252
|
+
private toolHookContext;
|
|
194
253
|
runWorkflow(defOrBuilder: WorkflowDef | WorkflowBuilder, opts?: WorkflowRunOptions): Promise<WorkflowResult>;
|
|
254
|
+
/**
|
|
255
|
+
* Runs a tool call that was stored as pending and has since been approved (SPEC-0014 §6, resubmission).
|
|
256
|
+
*
|
|
257
|
+
* - At most once: the store marks it executed atomically before it runs; a second call throws.
|
|
258
|
+
* - Everything is checked again (allowedTools, sandbox, guardrails, policies); the stored approval only
|
|
259
|
+
* satisfies an `ask`, and only if its approver is one that ask accepts. An approval that turns out not to be
|
|
260
|
+
* valid is consumed and audited as `deny`.
|
|
261
|
+
* - The result is returned to the caller (e.g. Hermes or a UI); it is not added to the conversation.
|
|
262
|
+
*/
|
|
263
|
+
runApproved(approvalId: string): Promise<string>;
|
|
264
|
+
/**
|
|
265
|
+
* Puts one question to an agent outside the conversation and returns its answer (its tool calls are governed
|
|
266
|
+
* like any other). Used by `agentApprover` to let a supervising agent approve or reject requests.
|
|
267
|
+
*/
|
|
268
|
+
consultAgent(agentId: string, question: string): Promise<string>;
|
|
195
269
|
abort(): void;
|
|
196
270
|
/** Change the iteration mode at runtime — takes effect on the next run(). */
|
|
197
271
|
setIterationMode(mode: IterationMode): void;
|
|
@@ -252,16 +326,36 @@ export declare class AgentEngine {
|
|
|
252
326
|
private sandboxFor;
|
|
253
327
|
/** The message for the model when the sandbox policy refuses `tool` for `agentId`; undefined when allowed. */
|
|
254
328
|
private sandboxRefusal;
|
|
329
|
+
/**
|
|
330
|
+
* Reports a sandbox decision on the transport and the legacy audit log, and, when `collect` is given, adds it to
|
|
331
|
+
* the decisions the single `AuditEvent` of the current tool call will carry.
|
|
332
|
+
*/
|
|
255
333
|
private reportSandboxDecision;
|
|
256
334
|
/**
|
|
257
335
|
* Unified tool execution used by both runLoop (primary agent) and
|
|
258
336
|
* runAgentInternal (sub-agents via ask_agent).
|
|
259
|
-
* Handles: allowedTools
|
|
337
|
+
* Handles: allowedTools → sandbox refusal → argument guardrails → policy/approval (or the legacy gate)
|
|
338
|
+
* → execute → result guardrails → audit → transport.
|
|
260
339
|
*/
|
|
261
340
|
private executeToolCall;
|
|
262
341
|
/** Approval checks never overlap and run in call order, even inside a parallel wave. */
|
|
263
342
|
private gateQueue;
|
|
264
|
-
private
|
|
343
|
+
private serialize;
|
|
344
|
+
/** The legacy gate (onToolApproval + the built-in list of tools that ask), unchanged, as a verdict. */
|
|
345
|
+
private decideLegacy;
|
|
346
|
+
private noApproverForSandbox;
|
|
347
|
+
/**
|
|
348
|
+
* The policy path (SPEC-0014 §2, F2): the policies decide on the arguments that would really run (after the
|
|
349
|
+
* guardrails), a sandbox that wants approval adds an `ask`, and an `ask` goes to the approver in call order or,
|
|
350
|
+
* when nobody answers now, to the durable store.
|
|
351
|
+
*/
|
|
352
|
+
private decideGoverned;
|
|
353
|
+
private resolveAsk;
|
|
354
|
+
/**
|
|
355
|
+
* Rule 3 of SPEC-0014 §6.2: an agent approves only what it could do itself. It must be registered, have the
|
|
356
|
+
* tool in its allowedTools, and the policies must allow the same call with that agent as principal.
|
|
357
|
+
*/
|
|
358
|
+
private agentCanPerform;
|
|
265
359
|
private runToolDef;
|
|
266
360
|
/**
|
|
267
361
|
* Disconnects an MCP server at runtime — reverts all tool assignments and
|
|
@@ -273,10 +367,21 @@ export declare class AgentEngine {
|
|
|
273
367
|
* For mode='tools' servers, agents fall back to shell commands automatically.
|
|
274
368
|
*/
|
|
275
369
|
unregisterMCPServer(serverName: string): void;
|
|
276
|
-
/**
|
|
370
|
+
/**
|
|
371
|
+
* Disable approval for the rest of this session (approve_all). In the policy path it affects only the adapted
|
|
372
|
+
* onToolApproval callback, and never covers what only a person may approve (destructive tools, package installs).
|
|
373
|
+
*/
|
|
277
374
|
disableToolApproval(): void;
|
|
278
375
|
/** Re-enable approval gate (e.g. after /iteration manual). */
|
|
279
376
|
enableToolApproval(): void;
|
|
377
|
+
/** The principal of a call: this engine's identity, the executing agent and its delegation chain. */
|
|
378
|
+
private principalFor;
|
|
379
|
+
/**
|
|
380
|
+
* Writes the single `AuditEvent` of a tool call (or delegation). Arguments only as a hash: the raw JSON string
|
|
381
|
+
* the model produced is parsed when it can be (so equal arguments hash equal whatever their key order) and
|
|
382
|
+
* hashed as text when it cannot.
|
|
383
|
+
*/
|
|
384
|
+
private recordAudit;
|
|
280
385
|
private buildContext;
|
|
281
386
|
}
|
|
282
387
|
//# sourceMappingURL=AgentEngine.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgentEngine.d.ts","sourceRoot":"","sources":["../../src/engine/AgentEngine.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AgentEngine.d.ts","sourceRoot":"","sources":["../../src/engine/AgentEngine.ts"],"names":[],"mappings":"AAcA,OAAO,EAA2D,KAAK,WAAW,EAAmB,MAAM,qBAAqB,CAA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