@lushly-dev/afd-server 2.3.0 → 2.5.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 +277 -31
- package/dist/app-call-registry.d.ts +31 -0
- package/dist/app-call-registry.d.ts.map +1 -0
- package/dist/app-call-registry.js +56 -0
- package/dist/app-call-registry.js.map +1 -0
- package/dist/approval-admission.d.ts +93 -0
- package/dist/approval-admission.d.ts.map +1 -0
- package/dist/approval-admission.js +165 -0
- package/dist/approval-admission.js.map +1 -0
- package/dist/approval-crypto.d.ts +22 -16
- package/dist/approval-crypto.d.ts.map +1 -1
- package/dist/approval-crypto.js +41 -66
- package/dist/approval-crypto.js.map +1 -1
- package/dist/approval-process-state.d.ts +20 -0
- package/dist/approval-process-state.d.ts.map +1 -0
- package/dist/approval-process-state.js +28 -0
- package/dist/approval-process-state.js.map +1 -0
- package/dist/approval-relay.d.ts +171 -8
- package/dist/approval-relay.d.ts.map +1 -1
- package/dist/approval-relay.js +42 -3
- package/dist/approval-relay.js.map +1 -1
- package/dist/approval-up-front.d.ts +40 -0
- package/dist/approval-up-front.d.ts.map +1 -0
- package/dist/approval-up-front.js +365 -0
- package/dist/approval-up-front.js.map +1 -0
- package/dist/approval.d.ts +17 -12
- package/dist/approval.d.ts.map +1 -1
- package/dist/approval.js +178 -41
- package/dist/approval.js.map +1 -1
- package/dist/approver.d.ts +84 -0
- package/dist/approver.d.ts.map +1 -0
- package/dist/approver.js +107 -0
- package/dist/approver.js.map +1 -0
- package/dist/bootstrap/afd-docs.d.ts.map +1 -1
- package/dist/bootstrap/afd-docs.js +4 -0
- package/dist/bootstrap/afd-docs.js.map +1 -1
- package/dist/bootstrap/afd-help.d.ts +2 -1
- package/dist/bootstrap/afd-help.d.ts.map +1 -1
- package/dist/bootstrap/afd-help.js +17 -4
- package/dist/bootstrap/afd-help.js.map +1 -1
- package/dist/bootstrap/described-command.d.ts +2 -1
- package/dist/bootstrap/described-command.d.ts.map +1 -1
- package/dist/bootstrap/described-command.js.map +1 -1
- package/dist/command-timeout.d.ts +17 -0
- package/dist/command-timeout.d.ts.map +1 -0
- package/dist/command-timeout.js +92 -0
- package/dist/command-timeout.js.map +1 -0
- package/dist/context-fields.d.ts.map +1 -1
- package/dist/context-fields.js +9 -9
- package/dist/context-fields.js.map +1 -1
- package/dist/credentials.d.ts +17 -0
- package/dist/credentials.d.ts.map +1 -0
- package/dist/credentials.js +16 -0
- package/dist/credentials.js.map +1 -0
- package/dist/define-core.d.ts +27 -1
- package/dist/define-core.d.ts.map +1 -1
- package/dist/define-core.js +8 -1
- package/dist/define-core.js.map +1 -1
- package/dist/define.d.ts +3 -2
- package/dist/define.d.ts.map +1 -1
- package/dist/define.js +1 -1
- package/dist/define.js.map +1 -1
- package/dist/direct-registry.d.ts +27 -3
- package/dist/direct-registry.d.ts.map +1 -1
- package/dist/direct-registry.js +41 -6
- package/dist/direct-registry.js.map +1 -1
- package/dist/direct-tool-surface.d.ts +1 -1
- package/dist/direct-tool-surface.d.ts.map +1 -1
- package/dist/direct-tool-surface.js +14 -4
- package/dist/direct-tool-surface.js.map +1 -1
- package/dist/direct.d.ts +3 -1
- package/dist/direct.d.ts.map +1 -1
- package/dist/direct.js +2 -1
- package/dist/direct.js.map +1 -1
- package/dist/elicitation-state.d.ts +5 -1
- package/dist/elicitation-state.d.ts.map +1 -1
- package/dist/elicitation-state.js +4 -1
- package/dist/elicitation-state.js.map +1 -1
- package/dist/execution.d.ts +17 -0
- package/dist/execution.d.ts.map +1 -1
- package/dist/execution.js +78 -7
- package/dist/execution.js.map +1 -1
- package/dist/http-handler.d.ts +26 -2
- package/dist/http-handler.d.ts.map +1 -1
- package/dist/http-handler.js +154 -19
- package/dist/http-handler.js.map +1 -1
- package/dist/http-security.d.ts +14 -1
- package/dist/http-security.d.ts.map +1 -1
- package/dist/http-security.js +79 -17
- package/dist/http-security.js.map +1 -1
- package/dist/http-sessions.d.ts +45 -7
- package/dist/http-sessions.d.ts.map +1 -1
- package/dist/http-sessions.js +44 -12
- package/dist/http-sessions.js.map +1 -1
- package/dist/index.d.ts +18 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +18 -3
- package/dist/index.js.map +1 -1
- package/dist/instance-state.d.ts +46 -0
- package/dist/instance-state.d.ts.map +1 -0
- package/dist/instance-state.js +91 -0
- package/dist/instance-state.js.map +1 -0
- package/dist/journal-replay.d.ts.map +1 -1
- package/dist/journal-replay.js +41 -3
- package/dist/journal-replay.js.map +1 -1
- package/dist/journal.d.ts +10 -1
- package/dist/journal.d.ts.map +1 -1
- package/dist/journal.js +95 -10
- package/dist/journal.js.map +1 -1
- package/dist/json-rpc.d.ts +3 -2
- package/dist/json-rpc.d.ts.map +1 -1
- package/dist/json-rpc.js +5 -3
- package/dist/json-rpc.js.map +1 -1
- package/dist/lazy-tools.d.ts +16 -1
- package/dist/lazy-tools.d.ts.map +1 -1
- package/dist/lazy-tools.js +13 -2
- package/dist/lazy-tools.js.map +1 -1
- package/dist/mcp-auth-bearer.d.ts +25 -0
- package/dist/mcp-auth-bearer.d.ts.map +1 -0
- package/dist/mcp-auth-bearer.js +50 -0
- package/dist/mcp-auth-bearer.js.map +1 -0
- package/dist/mcp-auth-dispatch.d.ts +38 -0
- package/dist/mcp-auth-dispatch.d.ts.map +1 -0
- package/dist/mcp-auth-dispatch.js +113 -0
- package/dist/mcp-auth-dispatch.js.map +1 -0
- package/dist/mcp-auth-jwt.d.ts +179 -0
- package/dist/mcp-auth-jwt.d.ts.map +1 -0
- package/dist/mcp-auth-jwt.js +365 -0
- package/dist/mcp-auth-jwt.js.map +1 -0
- package/dist/mcp-auth-resource.d.ts +78 -0
- package/dist/mcp-auth-resource.d.ts.map +1 -0
- package/dist/mcp-auth-resource.js +197 -0
- package/dist/mcp-auth-resource.js.map +1 -0
- package/dist/mcp-auth-rules.d.ts +135 -0
- package/dist/mcp-auth-rules.d.ts.map +1 -0
- package/dist/mcp-auth-rules.js +306 -0
- package/dist/mcp-auth-rules.js.map +1 -0
- package/dist/mcp-auth-scopes.d.ts +84 -0
- package/dist/mcp-auth-scopes.d.ts.map +1 -0
- package/dist/mcp-auth-scopes.js +125 -0
- package/dist/mcp-auth-scopes.js.map +1 -0
- package/dist/mcp-auth-view.d.ts +50 -0
- package/dist/mcp-auth-view.d.ts.map +1 -0
- package/dist/mcp-auth-view.js +166 -0
- package/dist/mcp-auth-view.js.map +1 -0
- package/dist/mcp-auth.d.ts +157 -0
- package/dist/mcp-auth.d.ts.map +1 -0
- package/dist/mcp-auth.js +442 -0
- package/dist/mcp-auth.js.map +1 -0
- package/dist/mcp-modern.d.ts +15 -1
- package/dist/mcp-modern.d.ts.map +1 -1
- package/dist/mcp-modern.js +218 -31
- package/dist/mcp-modern.js.map +1 -1
- package/dist/meta-argument.d.ts +8 -8
- package/dist/meta-argument.d.ts.map +1 -1
- package/dist/meta-argument.js +17 -10
- package/dist/meta-argument.js.map +1 -1
- package/dist/meta-tools.js +1 -1
- package/dist/meta-tools.js.map +1 -1
- package/dist/middleware.d.ts.map +1 -1
- package/dist/middleware.js +16 -6
- package/dist/middleware.js.map +1 -1
- package/dist/output-budget.d.ts +77 -0
- package/dist/output-budget.d.ts.map +1 -0
- package/dist/output-budget.js +200 -0
- package/dist/output-budget.js.map +1 -0
- package/dist/request-context.d.ts +7 -1
- package/dist/request-context.d.ts.map +1 -1
- package/dist/request-context.js +14 -3
- package/dist/request-context.js.map +1 -1
- package/dist/resources.d.ts +35 -10
- package/dist/resources.d.ts.map +1 -1
- package/dist/resources.js +59 -18
- package/dist/resources.js.map +1 -1
- package/dist/scope-view.d.ts +59 -0
- package/dist/scope-view.d.ts.map +1 -0
- package/dist/scope-view.js +44 -0
- package/dist/scope-view.js.map +1 -0
- package/dist/server-types.d.ts +191 -26
- package/dist/server-types.d.ts.map +1 -1
- package/dist/server-types.js.map +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +165 -18
- package/dist/server.js.map +1 -1
- package/dist/skills.d.ts.map +1 -1
- package/dist/skills.js +99 -3
- package/dist/skills.js.map +1 -1
- package/dist/strict-json.d.ts +17 -0
- package/dist/strict-json.d.ts.map +1 -0
- package/dist/strict-json.js +93 -0
- package/dist/strict-json.js.map +1 -0
- package/dist/task-dispatch.d.ts +34 -0
- package/dist/task-dispatch.d.ts.map +1 -0
- package/dist/task-dispatch.js +26 -0
- package/dist/task-dispatch.js.map +1 -0
- package/dist/tasks-runtime.d.ts +113 -0
- package/dist/tasks-runtime.d.ts.map +1 -0
- package/dist/tasks-runtime.js +687 -0
- package/dist/tasks-runtime.js.map +1 -0
- package/dist/tasks.d.ts +210 -0
- package/dist/tasks.d.ts.map +1 -0
- package/dist/tasks.js +289 -0
- package/dist/tasks.js.map +1 -0
- package/dist/tool-router.d.ts +4 -0
- package/dist/tool-router.d.ts.map +1 -1
- package/dist/tool-router.js +103 -26
- package/dist/tool-router.js.map +1 -1
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js +11 -18
- package/dist/tools.js.map +1 -1
- package/dist/up-front-steps.d.ts +27 -0
- package/dist/up-front-steps.d.ts.map +1 -0
- package/dist/up-front-steps.js +110 -0
- package/dist/up-front-steps.js.map +1 -0
- package/dist/validation.d.ts +24 -3
- package/dist/validation.d.ts.map +1 -1
- package/dist/validation.js +56 -6
- package/dist/validation.js.map +1 -1
- package/dist/verified-credentials.d.ts +42 -0
- package/dist/verified-credentials.d.ts.map +1 -0
- package/dist/verified-credentials.js +84 -0
- package/dist/verified-credentials.js.map +1 -0
- package/package.json +12 -7
|
@@ -0,0 +1,365 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview One up-front approval for an `afd-batch` or `afd-pipe` (#459, option A).
|
|
3
|
+
*
|
|
4
|
+
* Asking mid-run would run the earlier steps again on the retry, so the approval middleware
|
|
5
|
+
* decides the whole call before any step's handler runs, the first time a step reaches it:
|
|
6
|
+
*
|
|
7
|
+
* - a gated pipeline step whose input comes from an earlier step (`$prev`, `$first`, `$steps`)
|
|
8
|
+
* cannot be shown to the human up front, so nothing runs and the agent is told to split the
|
|
9
|
+
* pipeline there;
|
|
10
|
+
* - otherwise, when the request carries the human's acceptance of every gated step (each bound to
|
|
11
|
+
* its command, canonical validated input and actor, with a MAC, an expiry and a nonce), each
|
|
12
|
+
* nonce is spent and the call runs: each gated step then takes one approval matching its own
|
|
13
|
+
* binding, once. The engine runs every step on the input validated here, never on a second
|
|
14
|
+
* validation of it (#1414), so the input that runs is the one the human was shown;
|
|
15
|
+
* - a decline refuses the call; anything else asks once, listing every gated step.
|
|
16
|
+
*
|
|
17
|
+
* While the plan is not to run, every step answers without calling `next`, and the router answers
|
|
18
|
+
* the call with the refusal (or the lane with the elicitation), so no handler runs.
|
|
19
|
+
*
|
|
20
|
+
* Only the MCP lane loads this module (through its relay's `upFront`): a host that runs commands
|
|
21
|
+
* in process, with or without the approval middleware or the tool surface, never does.
|
|
22
|
+
*/
|
|
23
|
+
import { ErrorCodes, failure } from '@lushly-dev/afd-core';
|
|
24
|
+
import { actorJson, base64url, canonicalJson, canonicalOrUndefined, inputChanged, inputNotCanonical, } from './approval-crypto.js';
|
|
25
|
+
import { releaseUpFrontApproval, shownInput, } from './approval-relay.js';
|
|
26
|
+
import { batchSteps, pipelineSteps, sentKey } from './up-front-steps.js';
|
|
27
|
+
/** The most gated steps one question lists; a person cannot weigh more at once. */
|
|
28
|
+
export const MAX_UP_FRONT_APPROVALS = 20;
|
|
29
|
+
/**
|
|
30
|
+
* The most characters (UTF-16 code units) of approved input one question keeps in the
|
|
31
|
+
* `requestState`, over all its steps. A step past it is validated again by the request that brings the answer, as every step
|
|
32
|
+
* was before #1414.
|
|
33
|
+
*/
|
|
34
|
+
export const MAX_KEPT_INPUT = 32_768;
|
|
35
|
+
/** A digest of the request as sent: an approved input serves the request it was validated for. */
|
|
36
|
+
async function callDigest(call) {
|
|
37
|
+
const bytes = await globalThis.crypto.subtle.digest('SHA-256', new TextEncoder().encode(call));
|
|
38
|
+
return base64url(new Uint8Array(bytes));
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* The up-front approval of one `afd-batch` or `afd-pipe` request that can carry a form
|
|
42
|
+
* elicitation, asking and reading answers through `relay`. Its steps are worked out only when a
|
|
43
|
+
* step whose command has an approval policy is about to run, or an approval middleware asks.
|
|
44
|
+
*/
|
|
45
|
+
export function createUpFrontApproval(relay, tool, request, commands) {
|
|
46
|
+
let steps;
|
|
47
|
+
/**
|
|
48
|
+
* The inputs the human approved for this request's steps in an earlier round; the latest
|
|
49
|
+
* answer wins. None when the answers cannot be read: the middleware reports that itself.
|
|
50
|
+
*/
|
|
51
|
+
async function approvedInputs() {
|
|
52
|
+
const approved = new Map();
|
|
53
|
+
try {
|
|
54
|
+
const kept = (await relay.answers()).accepted.flatMap((answer) => answer.step ?? []);
|
|
55
|
+
if (kept.length === 0)
|
|
56
|
+
return approved;
|
|
57
|
+
const call = await callDigest(upFront.call);
|
|
58
|
+
for (const step of kept) {
|
|
59
|
+
if (step.call === call)
|
|
60
|
+
approved.set(step.index, step.input);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
catch {
|
|
64
|
+
approved.clear();
|
|
65
|
+
}
|
|
66
|
+
return approved;
|
|
67
|
+
}
|
|
68
|
+
// Steps whose validated input the engine already took: two steps sent alike take one each.
|
|
69
|
+
const taken = new Set();
|
|
70
|
+
const upFront = {
|
|
71
|
+
tool,
|
|
72
|
+
relay,
|
|
73
|
+
call: requestJson(tool, request),
|
|
74
|
+
conditional: 'steps' in request && request.steps.some((step) => step.when !== undefined),
|
|
75
|
+
steps: () => {
|
|
76
|
+
steps ??= approvedInputs().then((approved) => 'steps' in request
|
|
77
|
+
? pipelineSteps(request, commands, approved)
|
|
78
|
+
: batchSteps(request, commands, approved));
|
|
79
|
+
return steps;
|
|
80
|
+
},
|
|
81
|
+
command: (name) => commands.find((candidate) => candidate.name === name),
|
|
82
|
+
validated: async (command, input) => {
|
|
83
|
+
// Only a command that may need approval: any other runs as it does on its own.
|
|
84
|
+
const policy = upFront.command(command)?.approval;
|
|
85
|
+
if (policy === undefined || policy === 'not-required')
|
|
86
|
+
return undefined;
|
|
87
|
+
const sent = sentKey(input);
|
|
88
|
+
if (sent === undefined)
|
|
89
|
+
return undefined;
|
|
90
|
+
let known;
|
|
91
|
+
try {
|
|
92
|
+
known = await upFront.steps();
|
|
93
|
+
}
|
|
94
|
+
catch {
|
|
95
|
+
// The step is validated as usual, and the middleware reports what failed.
|
|
96
|
+
return undefined;
|
|
97
|
+
}
|
|
98
|
+
// No await between finding a step and taking it, so concurrent steps take one each.
|
|
99
|
+
const step = known.find((candidate) => candidate.valid &&
|
|
100
|
+
candidate.command === command &&
|
|
101
|
+
candidate.sent === sent &&
|
|
102
|
+
!taken.has(candidate));
|
|
103
|
+
if (!step)
|
|
104
|
+
return undefined;
|
|
105
|
+
taken.add(step);
|
|
106
|
+
return { input: step.input };
|
|
107
|
+
},
|
|
108
|
+
run: (deps, command, input, context, next) => gateFor(deps)(upFront, command, input, context, next),
|
|
109
|
+
};
|
|
110
|
+
return upFront;
|
|
111
|
+
}
|
|
112
|
+
/** The request an up-front approval is bound to, as canonical JSON (the wire sends plain JSON). */
|
|
113
|
+
function requestJson(tool, request) {
|
|
114
|
+
try {
|
|
115
|
+
return canonicalJson([tool, request]);
|
|
116
|
+
}
|
|
117
|
+
catch {
|
|
118
|
+
return JSON.stringify([tool, request]);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
/** One gate per approval middleware, so each keeps its own plans. */
|
|
122
|
+
const gates = new WeakMap();
|
|
123
|
+
function gateFor(deps) {
|
|
124
|
+
let gate = gates.get(deps);
|
|
125
|
+
if (!gate) {
|
|
126
|
+
gate = createUpFrontGate(deps);
|
|
127
|
+
gates.set(deps, gate);
|
|
128
|
+
}
|
|
129
|
+
return gate;
|
|
130
|
+
}
|
|
131
|
+
/** Create the gate an approval middleware runs each step of an up-front call through. */
|
|
132
|
+
function createUpFrontGate(deps) {
|
|
133
|
+
// One plan per call, shared by its steps (concurrent ones too) and decided before any runs.
|
|
134
|
+
const plans = new WeakMap();
|
|
135
|
+
const tags = new WeakMap();
|
|
136
|
+
/** Approvals are bound to the call, so one given for this request covers no other. */
|
|
137
|
+
function callTags(upFront) {
|
|
138
|
+
let tagged = tags.get(upFront);
|
|
139
|
+
if (!tagged) {
|
|
140
|
+
tagged = deps.callTags(upFront.call);
|
|
141
|
+
tags.set(upFront, tagged);
|
|
142
|
+
}
|
|
143
|
+
return tagged;
|
|
144
|
+
}
|
|
145
|
+
async function decide(upFront, context) {
|
|
146
|
+
const steps = await upFront.steps();
|
|
147
|
+
const late = steps.find((step) => step.dynamic && deps.mayRequireApproval(step.command, context));
|
|
148
|
+
if (late)
|
|
149
|
+
return { kind: 'refuse', error: splitError(upFront.tool, late.index, late.command) };
|
|
150
|
+
const scope = await callTags(upFront);
|
|
151
|
+
const now = deps.clock.now();
|
|
152
|
+
const actor = actorJson(context.actor);
|
|
153
|
+
const gated = [];
|
|
154
|
+
for (const step of steps) {
|
|
155
|
+
if (step.dynamic || !step.valid)
|
|
156
|
+
continue;
|
|
157
|
+
// Before the policy runs, so a policy that changes the input is caught.
|
|
158
|
+
const before = deps.mayRequireApproval(step.command, context)
|
|
159
|
+
? canonicalOrUndefined(step.input)
|
|
160
|
+
: undefined;
|
|
161
|
+
if (!(await deps.requiresApproval(step.command, step.input, context)))
|
|
162
|
+
continue;
|
|
163
|
+
// No approval can bind it, so nothing runs and nobody is asked.
|
|
164
|
+
const input = canonicalOrUndefined(step.input);
|
|
165
|
+
if (input === undefined)
|
|
166
|
+
return { kind: 'refuse', error: inputNotCanonical(step.command) };
|
|
167
|
+
if (input !== before)
|
|
168
|
+
return { kind: 'refuse', error: inputChanged(step.command) };
|
|
169
|
+
gated.push({
|
|
170
|
+
index: step.index,
|
|
171
|
+
command: step.command,
|
|
172
|
+
input,
|
|
173
|
+
summary: deps.summarize(step.command, step.input, context),
|
|
174
|
+
bindings: await deps.bindings(scope, step.command, input, actor),
|
|
175
|
+
});
|
|
176
|
+
if (gated.length > MAX_UP_FRONT_APPROVALS) {
|
|
177
|
+
return { kind: 'refuse', error: tooManyError(upFront.tool) };
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
if (gated.length === 0)
|
|
181
|
+
return { kind: 'run', approved: [] };
|
|
182
|
+
const answers = await upFront.relay.answers();
|
|
183
|
+
const declined = gated.filter((step) => step.bindings.some((binding) => answers.declined.includes(binding)));
|
|
184
|
+
if (declined.length > 0)
|
|
185
|
+
return { kind: 'refuse', error: declinedError(upFront.tool, gated) };
|
|
186
|
+
// Each gated step takes a distinct genuine acceptance of its own binding, so two identical
|
|
187
|
+
// steps need two. The latest answer wins: later answers are read last.
|
|
188
|
+
const pool = [...answers.accepted];
|
|
189
|
+
const matched = [];
|
|
190
|
+
for (const step of gated) {
|
|
191
|
+
let found = -1;
|
|
192
|
+
for (let at = pool.length - 1; at >= 0; at--) {
|
|
193
|
+
const answer = pool[at];
|
|
194
|
+
if (step.bindings.includes(answer.binding) &&
|
|
195
|
+
(await deps.genuine(answer, step.bindings, now))) {
|
|
196
|
+
found = at;
|
|
197
|
+
break;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
if (found < 0)
|
|
201
|
+
break;
|
|
202
|
+
matched.push(...pool.splice(found, 1));
|
|
203
|
+
}
|
|
204
|
+
if (matched.length === gated.length) {
|
|
205
|
+
// Spend every nonce before anything runs: a replay of this request runs nothing.
|
|
206
|
+
let fresh = true;
|
|
207
|
+
for (const answer of matched) {
|
|
208
|
+
if (!(await deps.spend(answer.nonce, answer.expiresAt, now)))
|
|
209
|
+
fresh = false;
|
|
210
|
+
}
|
|
211
|
+
if (fresh) {
|
|
212
|
+
return {
|
|
213
|
+
kind: 'run',
|
|
214
|
+
approved: matched.map((answer) => ({ binding: answer.binding, used: false })),
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
// Ask once for every gated step, saying why when earlier approvals did not hold.
|
|
219
|
+
// Each question keeps its step's input, so the request that brings the answer runs it.
|
|
220
|
+
// In step order, while they fit: a step past the limit is validated again by the retry.
|
|
221
|
+
const call = await callDigest(upFront.call);
|
|
222
|
+
let room = MAX_KEPT_INPUT;
|
|
223
|
+
const kept = gated.map((step) => {
|
|
224
|
+
room -= step.input.length;
|
|
225
|
+
return room < 0 ? undefined : { index: step.index, input: step.input, call };
|
|
226
|
+
});
|
|
227
|
+
const questions = await Promise.all(gated.map(async (step, at) => {
|
|
228
|
+
const question = await deps.question(step.bindings, now);
|
|
229
|
+
const keep = kept[at];
|
|
230
|
+
return keep ? { ...question, step: keep } : question;
|
|
231
|
+
}));
|
|
232
|
+
upFront.relay.holdSteps({
|
|
233
|
+
questions,
|
|
234
|
+
message: stepsRelayMessage(upFront, gated, answers.accepted.length > 0
|
|
235
|
+
? 'The earlier approval expired, was already used or no longer matches; approve again to run it.'
|
|
236
|
+
: undefined),
|
|
237
|
+
});
|
|
238
|
+
return { kind: 'refuse', error: pendingError(upFront.tool, gated) };
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Run one step of an up-front call: nothing runs until the plan is to run, and then a gated
|
|
242
|
+
* step runs only on an unused approval of its own binding.
|
|
243
|
+
*/
|
|
244
|
+
return async function runStep(upFront, commandName, input, context, next) {
|
|
245
|
+
// The input this step is decided on, before any await, and the one it is admitted on.
|
|
246
|
+
const decidedOn = deps.mayRequireApproval(commandName, context)
|
|
247
|
+
? canonicalOrUndefined(input)
|
|
248
|
+
: undefined;
|
|
249
|
+
let plan = plans.get(upFront);
|
|
250
|
+
if (!plan) {
|
|
251
|
+
plan = decide(upFront, context);
|
|
252
|
+
plans.set(upFront, plan);
|
|
253
|
+
}
|
|
254
|
+
const decided = await plan;
|
|
255
|
+
if (decided.kind === 'refuse') {
|
|
256
|
+
upFront.refusal ??= decided.error;
|
|
257
|
+
return failure(decided.error);
|
|
258
|
+
}
|
|
259
|
+
// The handler, and any command it runs, never sees the up-front approval.
|
|
260
|
+
releaseUpFrontApproval(context);
|
|
261
|
+
if (!(await deps.requiresApproval(commandName, input, context)))
|
|
262
|
+
return next(decidedOn);
|
|
263
|
+
if (decidedOn === undefined)
|
|
264
|
+
return failure(inputNotCanonical(commandName));
|
|
265
|
+
const inputBinding = decidedOn;
|
|
266
|
+
const bindings = await deps.bindings(await callTags(upFront), commandName, inputBinding, actorJson(context.actor));
|
|
267
|
+
// A step whose batch or pipeline already timed out or was cancelled never starts: its
|
|
268
|
+
// caller was told it did not run.
|
|
269
|
+
if (context.signal?.aborted)
|
|
270
|
+
return failure(cancelledError(upFront.tool, commandName));
|
|
271
|
+
// No await between finding and taking it, so concurrent steps cannot take the same one.
|
|
272
|
+
// Its expiry was checked when the call started, as a single command's is.
|
|
273
|
+
const approval = decided.approved.find((item) => !item.used && bindings.includes(item.binding));
|
|
274
|
+
if (approval) {
|
|
275
|
+
approval.used = true;
|
|
276
|
+
return next(inputBinding);
|
|
277
|
+
}
|
|
278
|
+
return failure(unplannedError(upFront.tool, commandName));
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
function toolName(tool) {
|
|
282
|
+
return tool === 'afd-batch' ? 'batch' : 'pipeline';
|
|
283
|
+
}
|
|
284
|
+
/** A gated step whose input is not known until the pipeline runs: nothing ran. */
|
|
285
|
+
function splitError(tool, index, command) {
|
|
286
|
+
return {
|
|
287
|
+
code: ErrorCodes.APPROVAL_REQUIRED,
|
|
288
|
+
message: `${command} (the step at index ${index}) needs approval, and its input comes from an earlier step, so the user cannot approve it before the ${toolName(tool)} runs. Nothing ran.`,
|
|
289
|
+
suggestion: `Split the ${toolName(tool)} before the step at index ${index}: run the steps before it with ${tool}, then call ${command} on its own with the input they returned, so the client can ask the user.`,
|
|
290
|
+
retryable: false,
|
|
291
|
+
details: { reason: 'input-not-known', step: index, command },
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
function declinedError(tool, gated) {
|
|
295
|
+
const names = [...new Set(gated.map((step) => step.command))].join(', ');
|
|
296
|
+
return {
|
|
297
|
+
code: ErrorCodes.APPROVAL_REQUIRED,
|
|
298
|
+
message: `The user did not approve ${names}; nothing in the ${toolName(tool)} ran`,
|
|
299
|
+
suggestion: 'Do not run this again without asking the user first; the user chose not to approve it.',
|
|
300
|
+
retryable: false,
|
|
301
|
+
details: { reason: 'declined', summary: gated.map((step) => step.summary).join('; ') },
|
|
302
|
+
};
|
|
303
|
+
}
|
|
304
|
+
/** More gated steps than one question may list: nothing ran. */
|
|
305
|
+
function tooManyError(tool) {
|
|
306
|
+
return {
|
|
307
|
+
code: ErrorCodes.APPROVAL_REQUIRED,
|
|
308
|
+
message: `The ${toolName(tool)} has more than ${MAX_UP_FRONT_APPROVALS} steps that need approval, more than the user can be asked about at once. Nothing ran.`,
|
|
309
|
+
suggestion: `Split it into calls of ${tool} with at most ${MAX_UP_FRONT_APPROVALS} steps that need approval each.`,
|
|
310
|
+
retryable: false,
|
|
311
|
+
details: { reason: 'too-many-approvals', limit: MAX_UP_FRONT_APPROVALS },
|
|
312
|
+
};
|
|
313
|
+
}
|
|
314
|
+
/** A step whose call already timed out or was cancelled. */
|
|
315
|
+
function cancelledError(tool, command) {
|
|
316
|
+
return {
|
|
317
|
+
code: ErrorCodes.COMMAND_CANCELLED,
|
|
318
|
+
message: `${command} did not run: the ${toolName(tool)} timed out or was cancelled first`,
|
|
319
|
+
suggestion: `Check which steps ran before running the ${toolName(tool)} again; the user is asked again for a new approval.`,
|
|
320
|
+
retryable: false,
|
|
321
|
+
};
|
|
322
|
+
}
|
|
323
|
+
/** The result while the human is asked; the lane answers with the elicitation instead. */
|
|
324
|
+
function pendingError(tool, gated) {
|
|
325
|
+
const summary = gated.map((step) => step.summary).join('; ');
|
|
326
|
+
return {
|
|
327
|
+
code: ErrorCodes.APPROVAL_REQUIRED,
|
|
328
|
+
message: `The ${toolName(tool)} needs approval before it runs`,
|
|
329
|
+
suggestion: `Wait for the user to approve "${summary}" in the client.`,
|
|
330
|
+
retryable: false,
|
|
331
|
+
details: { summary },
|
|
332
|
+
};
|
|
333
|
+
}
|
|
334
|
+
/** A gated step the human was not asked about up front (its policy changed its mind). */
|
|
335
|
+
function unplannedError(tool, command) {
|
|
336
|
+
return {
|
|
337
|
+
code: ErrorCodes.APPROVAL_REQUIRED,
|
|
338
|
+
message: `${command} needs approval before it runs`,
|
|
339
|
+
suggestion: `Ask the user to approve it; the client could not be asked for this step of the ${toolName(tool)}. Call ${command} on its own so the client can ask the user.`,
|
|
340
|
+
retryable: false,
|
|
341
|
+
details: { summary: `Run ${command}` },
|
|
342
|
+
};
|
|
343
|
+
}
|
|
344
|
+
/**
|
|
345
|
+
* The question of an up-front approval: what the call is, then each gated step's summary,
|
|
346
|
+
* command and canonical input, so the human sees exactly what would run.
|
|
347
|
+
*/
|
|
348
|
+
function stepsRelayMessage(upFront, steps, note) {
|
|
349
|
+
const what = upFront.tool === 'afd-batch' ? 'batch' : 'pipeline';
|
|
350
|
+
const count = steps.length === 1 ? 'a step that needs' : `${steps.length} steps that need`;
|
|
351
|
+
const lines = [
|
|
352
|
+
...(note ? [note] : []),
|
|
353
|
+
`This ${what} includes ${count} your approval. Approving lets each run once, exactly as shown; if you do not approve, nothing in the ${what} runs.`,
|
|
354
|
+
...(upFront.conditional
|
|
355
|
+
? [
|
|
356
|
+
'Some steps run only when their conditions hold, so one step may run while another is skipped.',
|
|
357
|
+
]
|
|
358
|
+
: []),
|
|
359
|
+
];
|
|
360
|
+
for (const step of steps) {
|
|
361
|
+
lines.push('', `Step ${step.index + 1}: ${step.summary}`, `Command: ${step.command}`, `Input: ${shownInput(step.input)}`);
|
|
362
|
+
}
|
|
363
|
+
return lines.join('\n');
|
|
364
|
+
}
|
|
365
|
+
//# sourceMappingURL=approval-up-front.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"approval-up-front.js","sourceRoot":"","sources":["../src/approval-up-front.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AASH,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AAC;gBACA,+FAA+F;aAC/F;YACF,CAAC,CAAC,EAAE,CAAC;KACN,CAAC;IACF,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QAC1B,KAAK,CAAC,IAAI,CACT,EAAE,EACF,QAAQ,IAAI,CAAC,KAAK,GAAG,CAAC,KAAK,IAAI,CAAC,OAAO,EAAE,EACzC,YAAY,IAAI,CAAC,OAAO,EAAE,EAC1B,UAAU,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAClC,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACzB,CAAC"}
|
package/dist/approval.d.ts
CHANGED
|
@@ -38,7 +38,7 @@ export interface ApprovalCommand {
|
|
|
38
38
|
confirmPrompt?: string;
|
|
39
39
|
}
|
|
40
40
|
/** Why a supplied approval token was not accepted. */
|
|
41
|
-
export type ApprovalRejection = 'malformed' | 'invalid-signature' | 'expired' | 'command-mismatch' | 'input-mismatch' | 'actor-mismatch' | 'already-used';
|
|
41
|
+
export type ApprovalRejection = 'malformed' | 'invalid-signature' | 'expired' | 'command-mismatch' | 'input-mismatch' | 'actor-mismatch' | 'credentials-mismatch' | 'already-used';
|
|
42
42
|
/**
|
|
43
43
|
* Records which single-use tokens have been spent. The default keeps them in memory, which
|
|
44
44
|
* holds only within one process: give servers that run several instances a shared store.
|
|
@@ -72,11 +72,13 @@ export interface ApprovalMiddlewareOptions {
|
|
|
72
72
|
*/
|
|
73
73
|
secret: ApprovalSecret | readonly ApprovalSecret[];
|
|
74
74
|
/**
|
|
75
|
-
* The
|
|
76
|
-
* `createDirectRegistry
|
|
77
|
-
*
|
|
75
|
+
* Optional. The middleware decides from the policy and `confirmPrompt` of the command each call
|
|
76
|
+
* runs (under `createMcpServer` and `createDirectRegistry`), and also from the policy this list
|
|
77
|
+
* gives that command: a call is held when either holds it, so a gate declared only here still
|
|
78
|
+
* holds. Outside those engines, where no engine names the command, only this list decides, and
|
|
79
|
+
* a command missing from it is not held. Each policy given is validated.
|
|
78
80
|
*/
|
|
79
|
-
commands
|
|
81
|
+
commands?: Iterable<ApprovalCommand>;
|
|
80
82
|
/** How long a token stays valid, in milliseconds. Default: 300000 (5 minutes); at most 24 hours. */
|
|
81
83
|
ttlMs?: number;
|
|
82
84
|
/**
|
|
@@ -111,8 +113,10 @@ export interface ApprovalMiddlewareOptions {
|
|
|
111
113
|
* the application obtains the approval out of band. `'mcp-elicitation'`: a call to a single
|
|
112
114
|
* command from an MCP client that declares form elicitation is answered with a form
|
|
113
115
|
* elicitation showing the summary, and runs once the human accepts. No token is issued on that
|
|
114
|
-
* path.
|
|
115
|
-
*
|
|
116
|
+
* path. An `afd-batch` or `afd-pipe` from such a client is asked about once, before any step
|
|
117
|
+
* runs, listing every gated step; a pipeline whose gated step takes its input from an earlier
|
|
118
|
+
* step runs nothing and fails with `APPROVAL_REQUIRED`. Calls that cannot elicit (no
|
|
119
|
+
* capability, a 2025-era HTTP request) still fail with `APPROVAL_REQUIRED`.
|
|
116
120
|
*
|
|
117
121
|
* This trusts the MCP client application to show the question to a human: the server cannot
|
|
118
122
|
* tell a person's answer from client code that accepts on its own. Leave it off when the
|
|
@@ -141,16 +145,17 @@ export interface ApprovalMiddlewareOptions {
|
|
|
141
145
|
* tokens are bound to the actor. `context.approval` must only ever be set by trusted surface
|
|
142
146
|
* code once a human approved, never from tool arguments: whoever holds a token can use it.
|
|
143
147
|
*
|
|
148
|
+
* Under `createMcpServer` and `createDirectRegistry` it decides from each command's own policy.
|
|
149
|
+
* Without it, those engines refuse a command whose policy is not `'not-required'` with
|
|
150
|
+
* `APPROVAL_UNAVAILABLE`, so a declared policy always holds.
|
|
151
|
+
*
|
|
144
152
|
* @example
|
|
145
153
|
* ```typescript
|
|
146
|
-
* const commands = [todoDelete, todoList];
|
|
147
154
|
* const server = createMcpServer({
|
|
148
155
|
* name: 'todo',
|
|
149
156
|
* version: '1.0.0',
|
|
150
|
-
* commands,
|
|
151
|
-
* middleware: [
|
|
152
|
-
* createApprovalMiddleware({ secret: process.env.AFD_APPROVAL_SECRET!, commands }),
|
|
153
|
-
* ],
|
|
157
|
+
* commands: [todoDelete, todoList],
|
|
158
|
+
* middleware: [createApprovalMiddleware({ secret: process.env.AFD_APPROVAL_SECRET! })],
|
|
154
159
|
* });
|
|
155
160
|
* ```
|
|
156
161
|
*
|
package/dist/approval.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"approval.d.ts","sourceRoot":"","sources":["../src/approval.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,KAAK,EACX,KAAK,EAEL,cAAc,EACd,KAAK,EACL,cAAc,EACd,iBAAiB,EACjB,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"approval.d.ts","sourceRoot":"","sources":["../src/approval.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,KAAK,EACX,KAAK,EAEL,cAAc,EACd,KAAK,EACL,cAAc,EACd,iBAAiB,EACjB,MAAM,sBAAsB,CAAC;AAQ9B,OAAO,EAEN,KAAK,cAAc,EAInB,aAAa,EAWb,MAAM,sBAAsB,CAAC;AAY9B,OAAO,EAAE,KAAK,cAAc,EAAE,aAAa,EAAE,CAAC;AAQ9C,mGAAmG;AACnG,MAAM,WAAW,eAAe;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,cAAc,CAAC,KAAK,CAAC,CAAC;IACjC,aAAa,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,sDAAsD;AACtD,MAAM,MAAM,iBAAiB,GAC1B,WAAW,GACX,mBAAmB,GACnB,SAAS,GACT,kBAAkB,GAClB,gBAAgB,GAChB,gBAAgB,GAChB,sBAAsB,GACtB,cAAc,CAAC;AAElB;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IAClC;;;;OAIG;IAC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