@lushly-dev/afd-server 2.5.0 → 3.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/README.md +100 -21
- package/dist/admission.d.ts +137 -0
- package/dist/admission.d.ts.map +1 -0
- package/dist/admission.js +144 -0
- package/dist/admission.js.map +1 -0
- package/dist/app-call-registry.d.ts +2 -2
- package/dist/app-call-registry.d.ts.map +1 -1
- package/dist/app-call-registry.js +12 -4
- package/dist/app-call-registry.js.map +1 -1
- package/dist/approval-admission.d.ts +47 -1
- package/dist/approval-admission.d.ts.map +1 -1
- package/dist/approval-admission.js +87 -0
- package/dist/approval-admission.js.map +1 -1
- package/dist/approval-crypto.d.ts +16 -2
- package/dist/approval-crypto.d.ts.map +1 -1
- package/dist/approval-crypto.js +45 -11
- package/dist/approval-crypto.js.map +1 -1
- package/dist/approval-process-state.d.ts +3 -0
- package/dist/approval-process-state.d.ts.map +1 -1
- package/dist/approval-process-state.js +2 -0
- package/dist/approval-process-state.js.map +1 -1
- package/dist/approval-relay.d.ts +41 -5
- package/dist/approval-relay.d.ts.map +1 -1
- package/dist/approval-relay.js +8 -11
- package/dist/approval-relay.js.map +1 -1
- package/dist/approval-up-front.d.ts.map +1 -1
- package/dist/approval-up-front.js +62 -13
- package/dist/approval-up-front.js.map +1 -1
- package/dist/approval.d.ts +55 -3
- package/dist/approval.d.ts.map +1 -1
- package/dist/approval.js +208 -54
- package/dist/approval.js.map +1 -1
- package/dist/approver.d.ts +2 -2
- package/dist/approver.d.ts.map +1 -1
- package/dist/approver.js +6 -6
- package/dist/approver.js.map +1 -1
- package/dist/auth-middleware-check.d.ts +23 -0
- package/dist/auth-middleware-check.d.ts.map +1 -0
- package/dist/auth-middleware-check.js +48 -0
- package/dist/auth-middleware-check.js.map +1 -0
- package/dist/bootstrap/afd-context.d.ts.map +1 -1
- package/dist/bootstrap/afd-context.js +27 -3
- package/dist/bootstrap/afd-context.js.map +1 -1
- package/dist/bootstrap/afd-help.d.ts +3 -1
- package/dist/bootstrap/afd-help.d.ts.map +1 -1
- package/dist/bootstrap/afd-help.js +2 -0
- 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-allow.d.ts +4 -4
- package/dist/command-allow.d.ts.map +1 -1
- package/dist/command-allow.js +10 -15
- package/dist/command-allow.js.map +1 -1
- package/dist/command-routing.d.ts +56 -8
- package/dist/command-routing.d.ts.map +1 -1
- package/dist/command-routing.js +82 -16
- package/dist/command-routing.js.map +1 -1
- package/dist/command-timeout.d.ts.map +1 -1
- package/dist/command-timeout.js +8 -1
- package/dist/command-timeout.js.map +1 -1
- package/dist/confirmation-gate.d.ts +7 -7
- package/dist/confirmation-gate.d.ts.map +1 -1
- package/dist/confirmation-gate.js +44 -26
- package/dist/confirmation-gate.js.map +1 -1
- package/dist/confirmations.d.ts +46 -3
- package/dist/confirmations.d.ts.map +1 -1
- package/dist/confirmations.js +6 -7
- package/dist/confirmations.js.map +1 -1
- package/dist/context-fields.d.ts +16 -1
- package/dist/context-fields.d.ts.map +1 -1
- package/dist/context-fields.js +21 -4
- package/dist/context-fields.js.map +1 -1
- package/dist/context-scope.d.ts +3 -3
- package/dist/context-scope.d.ts.map +1 -1
- package/dist/context-scope.js +7 -8
- package/dist/context-scope.js.map +1 -1
- package/dist/define-core.d.ts +39 -3
- package/dist/define-core.d.ts.map +1 -1
- package/dist/define-core.js +20 -4
- package/dist/define-core.js.map +1 -1
- package/dist/define.d.ts +2 -2
- package/dist/define.d.ts.map +1 -1
- package/dist/define.js.map +1 -1
- package/dist/direct-registry.d.ts +30 -8
- package/dist/direct-registry.d.ts.map +1 -1
- package/dist/direct-registry.js +26 -5
- package/dist/direct-registry.js.map +1 -1
- package/dist/direct-tool-surface.d.ts +3 -1
- package/dist/direct-tool-surface.d.ts.map +1 -1
- package/dist/direct-tool-surface.js +22 -5
- package/dist/direct-tool-surface.js.map +1 -1
- package/dist/direct.d.ts +4 -2
- package/dist/direct.d.ts.map +1 -1
- package/dist/direct.js +2 -0
- package/dist/direct.js.map +1 -1
- package/dist/execution.d.ts +35 -6
- package/dist/execution.d.ts.map +1 -1
- package/dist/execution.js +108 -15
- package/dist/execution.js.map +1 -1
- package/dist/frontmatter.js +16 -13
- package/dist/frontmatter.js.map +1 -1
- package/dist/host-state.d.ts +96 -0
- package/dist/host-state.d.ts.map +1 -0
- package/dist/host-state.js +62 -0
- package/dist/host-state.js.map +1 -0
- package/dist/http-handler.d.ts +31 -12
- package/dist/http-handler.d.ts.map +1 -1
- package/dist/http-handler.js +138 -102
- package/dist/http-handler.js.map +1 -1
- package/dist/http-security.js +2 -2
- package/dist/http-security.js.map +1 -1
- package/dist/http-sessions.d.ts +10 -0
- package/dist/http-sessions.d.ts.map +1 -1
- package/dist/http-sessions.js +12 -2
- package/dist/http-sessions.js.map +1 -1
- package/dist/http-sse.d.ts +9 -0
- package/dist/http-sse.d.ts.map +1 -1
- package/dist/http-sse.js +12 -3
- package/dist/http-sse.js.map +1 -1
- package/dist/human-relay.d.ts +195 -0
- package/dist/human-relay.d.ts.map +1 -0
- package/dist/human-relay.js +697 -0
- package/dist/human-relay.js.map +1 -0
- package/dist/idempotency-step.d.ts +243 -0
- package/dist/idempotency-step.d.ts.map +1 -0
- package/dist/idempotency-step.js +419 -0
- package/dist/idempotency-step.js.map +1 -0
- package/dist/idempotency-store.d.ts +107 -0
- package/dist/idempotency-store.d.ts.map +1 -0
- package/dist/idempotency-store.js +100 -0
- package/dist/idempotency-store.js.map +1 -0
- package/dist/index.d.ts +10 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -5
- package/dist/index.js.map +1 -1
- package/dist/instance-state.d.ts +7 -0
- package/dist/instance-state.d.ts.map +1 -1
- package/dist/instance-state.js +5 -2
- package/dist/instance-state.js.map +1 -1
- package/dist/journal-off-tape.d.ts +52 -0
- package/dist/journal-off-tape.d.ts.map +1 -0
- package/dist/journal-off-tape.js +150 -0
- package/dist/journal-off-tape.js.map +1 -0
- package/dist/journal-replay.d.ts.map +1 -1
- package/dist/journal-replay.js +7 -0
- package/dist/journal-replay.js.map +1 -1
- package/dist/journal-view.d.ts +50 -0
- package/dist/journal-view.d.ts.map +1 -0
- package/dist/journal-view.js +214 -0
- package/dist/journal-view.js.map +1 -0
- package/dist/journal.d.ts +24 -5
- package/dist/journal.d.ts.map +1 -1
- package/dist/journal.js +91 -40
- package/dist/journal.js.map +1 -1
- package/dist/lazy-tools.d.ts +13 -3
- package/dist/lazy-tools.d.ts.map +1 -1
- package/dist/lazy-tools.js +9 -2
- package/dist/lazy-tools.js.map +1 -1
- package/dist/mcp-auth-dispatch.d.ts +1 -1
- package/dist/mcp-auth-dispatch.d.ts.map +1 -1
- package/dist/mcp-auth-dispatch.js +2 -1
- package/dist/mcp-auth-dispatch.js.map +1 -1
- package/dist/mcp-auth-jwt.d.ts +11 -4
- package/dist/mcp-auth-jwt.d.ts.map +1 -1
- package/dist/mcp-auth-jwt.js +11 -9
- package/dist/mcp-auth-jwt.js.map +1 -1
- package/dist/mcp-auth-resource.d.ts +27 -3
- package/dist/mcp-auth-resource.d.ts.map +1 -1
- package/dist/mcp-auth-resource.js +37 -10
- package/dist/mcp-auth-resource.js.map +1 -1
- package/dist/mcp-auth-rules.d.ts +97 -18
- package/dist/mcp-auth-rules.d.ts.map +1 -1
- package/dist/mcp-auth-rules.js +194 -37
- package/dist/mcp-auth-rules.js.map +1 -1
- package/dist/mcp-auth-view.d.ts +3 -3
- package/dist/mcp-auth-view.d.ts.map +1 -1
- package/dist/mcp-auth-view.js +62 -25
- package/dist/mcp-auth-view.js.map +1 -1
- package/dist/mcp-auth.d.ts +27 -4
- package/dist/mcp-auth.d.ts.map +1 -1
- package/dist/mcp-auth.js +55 -14
- package/dist/mcp-auth.js.map +1 -1
- package/dist/mcp-modern.d.ts +70 -7
- package/dist/mcp-modern.d.ts.map +1 -1
- package/dist/mcp-modern.js +225 -111
- package/dist/mcp-modern.js.map +1 -1
- package/dist/meta-argument.d.ts +2 -1
- package/dist/meta-argument.d.ts.map +1 -1
- package/dist/meta-argument.js +13 -2
- package/dist/meta-argument.js.map +1 -1
- package/dist/meta-tools.js +2 -2
- package/dist/meta-tools.js.map +1 -1
- package/dist/middleware.d.ts +18 -3
- package/dist/middleware.d.ts.map +1 -1
- package/dist/middleware.js +53 -7
- package/dist/middleware.js.map +1 -1
- package/dist/output-budget.d.ts.map +1 -1
- package/dist/output-budget.js +2 -0
- package/dist/output-budget.js.map +1 -1
- package/dist/principal-binding.js +1 -1
- package/dist/principal-binding.js.map +1 -1
- package/dist/relay-evidence.d.ts +74 -0
- package/dist/relay-evidence.d.ts.map +1 -0
- package/dist/relay-evidence.js +143 -0
- package/dist/relay-evidence.js.map +1 -0
- package/dist/request-context.d.ts +4 -0
- package/dist/request-context.d.ts.map +1 -1
- package/dist/request-context.js +12 -2
- package/dist/request-context.js.map +1 -1
- package/dist/resources.js +1 -1
- package/dist/resources.js.map +1 -1
- package/dist/schema.d.ts +4 -3
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +3 -3
- package/dist/schema.js.map +1 -1
- package/dist/scope-view.d.ts +18 -5
- package/dist/scope-view.d.ts.map +1 -1
- package/dist/scope-view.js +9 -8
- package/dist/scope-view.js.map +1 -1
- package/dist/server-types.d.ts +44 -16
- package/dist/server-types.d.ts.map +1 -1
- package/dist/server-types.js.map +1 -1
- package/dist/server.d.ts +26 -0
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +359 -89
- package/dist/server.js.map +1 -1
- package/dist/task-dispatch.d.ts +12 -6
- package/dist/task-dispatch.d.ts.map +1 -1
- package/dist/task-dispatch.js +11 -12
- package/dist/task-dispatch.js.map +1 -1
- package/dist/task-input.d.ts +29 -0
- package/dist/task-input.d.ts.map +1 -0
- package/dist/task-input.js +75 -0
- package/dist/task-input.js.map +1 -0
- package/dist/tasks-input-gate.d.ts +61 -0
- package/dist/tasks-input-gate.d.ts.map +1 -0
- package/dist/tasks-input-gate.js +325 -0
- package/dist/tasks-input-gate.js.map +1 -0
- package/dist/tasks-input-runner.d.ts +125 -0
- package/dist/tasks-input-runner.d.ts.map +1 -0
- package/dist/tasks-input-runner.js +1017 -0
- package/dist/tasks-input-runner.js.map +1 -0
- package/dist/tasks-runtime.d.ts +34 -7
- package/dist/tasks-runtime.d.ts.map +1 -1
- package/dist/tasks-runtime.js +545 -94
- package/dist/tasks-runtime.js.map +1 -1
- package/dist/tasks.d.ts +196 -25
- package/dist/tasks.d.ts.map +1 -1
- package/dist/tasks.js +188 -26
- package/dist/tasks.js.map +1 -1
- package/dist/tool-router.d.ts +62 -3
- package/dist/tool-router.d.ts.map +1 -1
- package/dist/tool-router.js +251 -101
- package/dist/tool-router.js.map +1 -1
- package/dist/tools.d.ts +32 -0
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js +154 -40
- package/dist/tools.js.map +1 -1
- package/dist/up-front-steps.d.ts +8 -0
- package/dist/up-front-steps.d.ts.map +1 -1
- package/dist/up-front-steps.js +50 -1
- package/dist/up-front-steps.js.map +1 -1
- package/dist/validation.d.ts +14 -0
- package/dist/validation.d.ts.map +1 -1
- package/dist/validation.js +62 -17
- package/dist/validation.js.map +1 -1
- package/package.json +15 -11
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Whether afd-auth's middleware on a server with MCP token authorization can tell
|
|
3
|
+
* a token's call from a local session's.
|
|
4
|
+
*
|
|
5
|
+
* afd-auth's `createAuthMiddleware` marks itself under a registered symbol with whether it was
|
|
6
|
+
* given `isVerifiedCredentials`. Without it, a call carrying the credentials this server verified
|
|
7
|
+
* is gated on the local adapter's session and runs as the session's user. A server with `auth`
|
|
8
|
+
* refuses to be built with such a middleware, directly in `middleware` or inside
|
|
9
|
+
* `composeMiddleware`, rather than serve every token's call as that user.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Mark `composed` as unable to recognise verified credentials when any of `parts` is: one such
|
|
13
|
+
* part in a composition is enough to stamp the session on a token's call.
|
|
14
|
+
*/
|
|
15
|
+
export declare function carryAuthMiddlewareMark(composed: object, parts: readonly unknown[]): void;
|
|
16
|
+
/**
|
|
17
|
+
* Throw when a server with `auth` runs afd-auth's middleware without `isVerifiedCredentials`.
|
|
18
|
+
*
|
|
19
|
+
* @param hasAuth - whether the server verifies bearer tokens (its `auth` option)
|
|
20
|
+
* @param middleware - the server's `middleware` option
|
|
21
|
+
*/
|
|
22
|
+
export declare function assertAuthMiddlewareRecognisesTokens(hasAuth: boolean, middleware: readonly unknown[] | undefined): void;
|
|
23
|
+
//# sourceMappingURL=auth-middleware-check.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth-middleware-check.d.ts","sourceRoot":"","sources":["../src/auth-middleware-check.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAgBH;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,OAAO,EAAE,GAAG,IAAI,CAQzF;AAED;;;;;GAKG;AACH,wBAAgB,oCAAoC,CACnD,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,SAAS,OAAO,EAAE,GAAG,SAAS,GACxC,IAAI,CAUN"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Whether afd-auth's middleware on a server with MCP token authorization can tell
|
|
3
|
+
* a token's call from a local session's.
|
|
4
|
+
*
|
|
5
|
+
* afd-auth's `createAuthMiddleware` marks itself under a registered symbol with whether it was
|
|
6
|
+
* given `isVerifiedCredentials`. Without it, a call carrying the credentials this server verified
|
|
7
|
+
* is gated on the local adapter's session and runs as the session's user. A server with `auth`
|
|
8
|
+
* refuses to be built with such a middleware, directly in `middleware` or inside
|
|
9
|
+
* `composeMiddleware`, rather than serve every token's call as that user.
|
|
10
|
+
*/
|
|
11
|
+
/** Registered, so a middleware made by any installed copy of afd-auth is recognised. */
|
|
12
|
+
const MARK = Symbol.for('dev.afd/auth-middleware-credentials');
|
|
13
|
+
function markOf(middleware) {
|
|
14
|
+
return typeof middleware === 'function' && Object.hasOwn(middleware, MARK)
|
|
15
|
+
? middleware[MARK]
|
|
16
|
+
: undefined;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Mark `composed` as unable to recognise verified credentials when any of `parts` is: one such
|
|
20
|
+
* part in a composition is enough to stamp the session on a token's call.
|
|
21
|
+
*/
|
|
22
|
+
export function carryAuthMiddlewareMark(composed, parts) {
|
|
23
|
+
const marks = parts.map(markOf).filter((mark) => mark !== undefined);
|
|
24
|
+
if (marks.length === 0)
|
|
25
|
+
return;
|
|
26
|
+
Object.defineProperty(composed, MARK, {
|
|
27
|
+
value: {
|
|
28
|
+
recognisesVerifiedCredentials: marks.every((mark) => mark.recognisesVerifiedCredentials),
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Throw when a server with `auth` runs afd-auth's middleware without `isVerifiedCredentials`.
|
|
34
|
+
*
|
|
35
|
+
* @param hasAuth - whether the server verifies bearer tokens (its `auth` option)
|
|
36
|
+
* @param middleware - the server's `middleware` option
|
|
37
|
+
*/
|
|
38
|
+
export function assertAuthMiddlewareRecognisesTokens(hasAuth, middleware) {
|
|
39
|
+
if (!hasAuth)
|
|
40
|
+
return;
|
|
41
|
+
if ((middleware ?? []).some((step) => markOf(step)?.recognisesVerifiedCredentials === false)) {
|
|
42
|
+
throw new Error('afd-auth middleware on a server with auth needs isVerifiedCredentials: without it every ' +
|
|
43
|
+
"token's call is gated on the local adapter's session and runs as its user. Pass " +
|
|
44
|
+
'createAuthMiddleware(adapter, { isVerifiedCredentials }), importing isVerifiedCredentials ' +
|
|
45
|
+
'from @lushly-dev/afd-server/credentials');
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=auth-middleware-check.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth-middleware-check.js","sourceRoot":"","sources":["../src/auth-middleware-check.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,wFAAwF;AACxF,MAAM,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC,qCAAqC,CAAC,CAAC;AAO/D,SAAS,MAAM,CAAC,UAAmB;IAClC,OAAO,OAAO,UAAU,KAAK,UAAU,IAAI,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,IAAI,CAAC;QACzE,CAAC,CAAE,UAA4D,CAAC,IAAI,CAAC;QACrE,CAAC,CAAC,SAAS,CAAC;AACd,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,uBAAuB,CAAC,QAAgB,EAAE,KAAyB;IAClF,MAAM,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC;IACrE,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO;IAC/B,MAAM,CAAC,cAAc,CAAC,QAAQ,EAAE,IAAI,EAAE;QACrC,KAAK,EAAE;YACN,6BAA6B,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,6BAA6B,CAAC;SACxF;KACD,CAAC,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,oCAAoC,CACnD,OAAgB,EAChB,UAA0C;IAE1C,IAAI,CAAC,OAAO;QAAE,OAAO;IACrB,IAAI,CAAC,UAAU,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,6BAA6B,KAAK,KAAK,CAAC,EAAE,CAAC;QAC9F,MAAM,IAAI,KAAK,CACd,0FAA0F;YACzF,kFAAkF;YAClF,4FAA4F;YAC5F,yCAAyC,CAC1C,CAAC;IACH,CAAC;AACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"afd-context.d.ts","sourceRoot":"","sources":["../../src/bootstrap/afd-context.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"afd-context.d.ts","sourceRoot":"","sources":["../../src/bootstrap/afd-context.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAkB,iBAAiB,EAAiB,MAAM,sBAAsB,CAAC;AAE7F,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EACN,KAAK,YAAY,EAGjB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAQxD,OAAO,EACN,KAAK,YAAY,EACjB,kBAAkB,EAClB,yBAAyB,GACzB,MAAM,qBAAqB,CAAC;AA2B7B,iFAAiF;AACjF,eAAO,MAAM,oBAAoB,oBAAoB,CAAC;AAQtD,QAAA,MAAM,eAAe,gCAAe,CAAC;AAErC,UAAU,WAAW;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,UAAU,iBAAiB;IAC1B,QAAQ,EAAE,WAAW,EAAE,CAAC;IACxB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B;AAED;;GAEG;AACH,wBAAgB,2BAA2B,CAC1C,WAAW,EAAE,MAAM,aAAa,EAAE,EAClC,YAAY,EAAE,YAAY,GACxB,iBAAiB,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,EAAE,iBAAiB,CAAC,CAmCvE;AAMD,QAAA,MAAM,gBAAgB;;iBAEpB,CAAC;AAEH,UAAU,kBAAkB;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,6EAA6E;IAC7E,SAAS,CAAC,EAAE,KAAK,CAAC;CAClB;AAED;;GAEG;AACH,wBAAgB,4BAA4B,CAC3C,WAAW,EAAE,MAAM,aAAa,EAAE,EAClC,YAAY,EAAE,YAAY,GACxB,iBAAiB,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,EAAE,kBAAkB,CAAC,CAoEzE;AAMD,QAAA,MAAM,eAAe,gCAAe,CAAC;AAErC,UAAU,iBAAiB;IAC1B,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,8EAA8E;IAC9E,SAAS,CAAC,EAAE,KAAK,CAAC;CAClB;AAED;;GAEG;AACH,wBAAgB,2BAA2B,CAC1C,YAAY,EAAE,YAAY,GACxB,iBAAiB,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,EAAE,iBAAiB,CAAC,CAkCvE"}
|
|
@@ -4,15 +4,31 @@
|
|
|
4
4
|
* Context management commands for dynamic tool scoping.
|
|
5
5
|
* Always available regardless of active context (universal tools).
|
|
6
6
|
*/
|
|
7
|
-
import { failure, success } from '@lushly-dev/afd-core';
|
|
7
|
+
import { AFD_CONTEXT_COMMAND_NAMES, failure, success } from '@lushly-dev/afd-core';
|
|
8
8
|
import { z } from 'zod';
|
|
9
|
+
import { canCall } from '../command-routing.js';
|
|
9
10
|
import { DEFAULT_CONTEXT_MAX_DEPTH, resolveContextState, } from '../context-scope.js';
|
|
11
|
+
import { scopeViewOf } from '../scope-view.js';
|
|
10
12
|
// ═══════════════════════════════════════════════════════════════════════════════
|
|
11
13
|
// CONTEXT STATE
|
|
12
14
|
// ═══════════════════════════════════════════════════════════════════════════════
|
|
13
15
|
// The state lives in `context-scope.ts`, beside its binding, so that `createDirectRegistry` can
|
|
14
16
|
// scope calls without loading these commands.
|
|
15
17
|
export { createContextState, DEFAULT_CONTEXT_MAX_DEPTH, } from '../context-scope.js';
|
|
18
|
+
/**
|
|
19
|
+
* Whether the caller of `context` can call the context command `name` (`spec/recovery.md`,
|
|
20
|
+
* "Engine errors"). The three are registered together, with one exposure and no contexts of
|
|
21
|
+
* their own, so a caller that reached one can call another unless the call's `allow` list or MCP
|
|
22
|
+
* authorization refuses it.
|
|
23
|
+
*/
|
|
24
|
+
function canCallContextCommand(context, name) {
|
|
25
|
+
const surface = {
|
|
26
|
+
metaTools: false,
|
|
27
|
+
command: (command) => (AFD_CONTEXT_COMMAND_NAMES.includes(command) ? {} : undefined),
|
|
28
|
+
shown: (command) => scopeViewOf(context)?.shown(command) ?? true,
|
|
29
|
+
};
|
|
30
|
+
return canCall(surface, name, context, null);
|
|
31
|
+
}
|
|
16
32
|
/** Failure for context changes requested by a caller that has no session to hold them. */
|
|
17
33
|
function sessionRequired() {
|
|
18
34
|
return failure({
|
|
@@ -91,10 +107,14 @@ export function createAfdContextEnterCommand(getContexts, contextState) {
|
|
|
91
107
|
const exists = configs.some((c) => c.name === contextName);
|
|
92
108
|
if (!exists) {
|
|
93
109
|
const available = configs.map((c) => c.name).join(', ');
|
|
110
|
+
const list = canCallContextCommand(context, 'afd-context-list');
|
|
94
111
|
return failure({
|
|
95
112
|
code: 'CONTEXT_NOT_FOUND',
|
|
96
113
|
message: `Context '${contextName}' is not configured`,
|
|
97
|
-
suggestion:
|
|
114
|
+
suggestion: list
|
|
115
|
+
? `Available contexts: ${available}. Use afd-context-list to see all contexts.`
|
|
116
|
+
: `Available contexts: ${available}.`,
|
|
117
|
+
...(list && { recovery: { kind: 'call', command: 'afd-context-list' } }),
|
|
98
118
|
});
|
|
99
119
|
}
|
|
100
120
|
const previous = state.getActive();
|
|
@@ -106,10 +126,14 @@ export function createAfdContextEnterCommand(getContexts, contextState) {
|
|
|
106
126
|
}
|
|
107
127
|
const maxDepth = state.maxDepth ?? DEFAULT_CONTEXT_MAX_DEPTH;
|
|
108
128
|
if (state.stack.length >= maxDepth) {
|
|
129
|
+
const exit = canCallContextCommand(context, 'afd-context-exit');
|
|
109
130
|
return failure({
|
|
110
131
|
code: 'CONTEXT_DEPTH_EXCEEDED',
|
|
111
132
|
message: `Context stack is limited to ${maxDepth} levels`,
|
|
112
|
-
suggestion:
|
|
133
|
+
suggestion: exit
|
|
134
|
+
? 'Call afd-context-exit to leave a context before entering another'
|
|
135
|
+
: 'Leave a context before entering another',
|
|
136
|
+
...(exit && { recovery: { kind: 'call', command: 'afd-context-exit', thenRetry: true } }),
|
|
113
137
|
});
|
|
114
138
|
}
|
|
115
139
|
state.enter(contextName);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"afd-context.js","sourceRoot":"","sources":["../../src/bootstrap/afd-context.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"afd-context.js","sourceRoot":"","sources":["../../src/bootstrap/afd-context.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,yBAAyB,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACnF,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAEN,yBAAyB,EACzB,mBAAmB,GACnB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAG/C,kFAAkF;AAClF,gBAAgB;AAChB,kFAAkF;AAElF,gGAAgG;AAChG,8CAA8C;AAC9C,OAAO,EAEN,kBAAkB,EAClB,yBAAyB,GACzB,MAAM,qBAAqB,CAAC;AAE7B;;;;;GAKG;AACH,SAAS,qBAAqB,CAAC,OAAmC,EAAE,IAAY;I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AC,CAAC,mBAAmB,MAAM,IAAI,OAAO,CAAC,CAAC,CAAC,aAAa,OAAO,GAAG,CAAC,CAAC,CAAC,qBAAqB,EAAE;oBAC1F,CAAC,CAAC,2BAA2B;gBAC9B,UAAU,EAAE,GAAG;aACf,CACD,CAAC;QACH,CAAC;KACD,CAAC;AACH,CAAC"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* List all available commands with tags and grouping.
|
|
5
5
|
*/
|
|
6
|
-
import type { CommandExample, OutputBudget } from '@lushly-dev/afd-core';
|
|
6
|
+
import type { CommandExample, IdempotencySupport, OutputBudget } from '@lushly-dev/afd-core';
|
|
7
7
|
import { z } from 'zod';
|
|
8
8
|
import type { ContextField } from '../context-fields.js';
|
|
9
9
|
import { type DescribedContextField } from '../context-fields-describe.js';
|
|
@@ -24,6 +24,8 @@ interface CommandInfo {
|
|
|
24
24
|
category?: string;
|
|
25
25
|
tags?: string[];
|
|
26
26
|
mutation?: boolean;
|
|
27
|
+
/** What the command declares about repeats (`spec/idempotency.md`, D3), when set. */
|
|
28
|
+
idempotency?: IdempotencySupport;
|
|
27
29
|
destructive?: boolean;
|
|
28
30
|
undoable?: boolean;
|
|
29
31
|
requires?: string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"afd-help.d.ts","sourceRoot":"","sources":["../../src/bootstrap/afd-help.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"afd-help.d.ts","sourceRoot":"","sources":["../../src/bootstrap/afd-help.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAE7F,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,YAAY,EAAE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C;CACjD;AAED,gGAAgG;AAChG,MAAM,WAAW,WAAW;IAC3B,YAAY,EAAE,YAAY,CAAC;IAC3B,sEAAsE;IACtE,eAAe,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,uFAAuF;IACvF,aAAa,CAAC,EAAE,SAAS,YAAY,EAAE,CAAC;CACxC;AAED;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CACnC,WAAW,EAAE,oBAAoB,EACjC,WAAW,CAAC,EAAE,WAAW,GACvB,oBAAoB,CAAC,OAAO,WAAW,EAAE,UAAU,CAAC,CAwGtD"}
|
|
@@ -67,6 +67,8 @@ export function createAfdHelpCommand(getCommands, toolSurface) {
|
|
|
67
67
|
if (cmd.tags?.length)
|
|
68
68
|
info.tags = cmd.tags;
|
|
69
69
|
info.mutation = cmd.mutation;
|
|
70
|
+
if (cmd.idempotency !== undefined)
|
|
71
|
+
info.idempotency = cmd.idempotency;
|
|
70
72
|
info.destructive = cmd.destructive;
|
|
71
73
|
info.undoable = cmd.undoable;
|
|
72
74
|
if (cmd.examples?.length)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"afd-help.js","sourceRoot":"","sources":["../../src/bootstrap/afd-help.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,oBAAoB,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAA8B,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAClG,OAAO,EAAE,aAAa,EAA6B,MAAM,cAAc,CAAC;AACxE,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,OAAO,EAAE,mBAAmB,EAA6B,MAAM,wBAAwB,CAAC;AAExF,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5B,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,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command shape the bootstrap tools describe.
|
|
3
3
|
*/
|
|
4
|
-
import type { ApprovalPolicy, CommandContext, CommandExample, CommandParameter, ExposeOptions, JsonSchema, OutputBudget } from '@lushly-dev/afd-core';
|
|
4
|
+
import type { ApprovalPolicy, CommandContext, CommandExample, CommandParameter, ExposeOptions, IdempotencySupport, JsonSchema, OutputBudget } from '@lushly-dev/afd-core';
|
|
5
5
|
/**
|
|
6
6
|
* What afd-help, afd-docs and afd-schema read from a command. Both core
|
|
7
7
|
* `CommandDefinition`s (with `parameters`) and `ZodCommandDefinition`s (with
|
|
@@ -14,6 +14,7 @@ export interface DescribedCommand {
|
|
|
14
14
|
category?: string;
|
|
15
15
|
tags?: string[];
|
|
16
16
|
mutation?: boolean;
|
|
17
|
+
idempotency?: IdempotencySupport;
|
|
17
18
|
destructive?: boolean;
|
|
18
19
|
confirmPrompt?: string;
|
|
19
20
|
undoable?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"described-command.d.ts","sourceRoot":"","sources":["../../src/bootstrap/described-command.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EACX,cAAc,EACd,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,aAAa,EACb,UAAU,EACV,YAAY,EACZ,MAAM,sBAAsB,CAAC;AAG9B;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,cAAc,CAAC,KAAK,CAAC,CAAC;IACjC,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E,cAAc,EAAE,CAAC;IAC5B,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,UAAU,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAChC,UAAU,CAAC,EAAE,UAAU,CAAC;CACxB;AAED;;;GAGG;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,OAAO,CAAC,EAAE,cAAc,KAAK,SAAS,gBAAgB,EAAE,CAAC;AAE7F;;;GAGG;AACH,wBAAgB,mBAAmB,CAClC,WAAW,EAAE,oBAAoB,EACjC,OAAO,CAAC,EAAE,cAAc,GACtB,gBAAgB,EAAE,CAEpB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"described-command.js","sourceRoot":"","sources":["../../src/bootstrap/described-command.ts"],"names":[],"mappings":"AAAA;;GAEG;
|
|
1
|
+
{"version":3,"file":"described-command.js","sourceRoot":"","sources":["../../src/bootstrap/described-command.ts"],"names":[],"mappings":"AAAA;;GAEG;AAYH,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAiCpD;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAClC,WAAiC,EACjC,OAAwB;IAExB,OAAO,WAAW,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC;AACxE,CAAC"}
|
package/dist/command-allow.d.ts
CHANGED
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
* one call.
|
|
4
4
|
*
|
|
5
5
|
* `DirectClient` passes its `allow` predicate to the registry as a call option, beside
|
|
6
|
-
* `activeContext`. The registry binds it to the call's
|
|
6
|
+
* `activeContext`. The registry binds it to the call's host state (`host-state.ts`), as it binds
|
|
7
7
|
* the context state (`context-scope.ts`), so the copies made for `afd-call`, batch items, pipeline
|
|
8
8
|
* steps and grouped tools all carry it, and the engine and the tool router check every command the
|
|
9
9
|
* call runs.
|
|
10
10
|
*
|
|
11
|
-
* The context holds
|
|
12
|
-
*
|
|
13
|
-
*
|
|
11
|
+
* The context holds the host state's opaque frozen token, never the predicate: a handler that lists
|
|
12
|
+
* its context's symbols finds an empty object it cannot call, read or swap for another predicate
|
|
13
|
+
* (a forged token denies everything). Tool
|
|
14
14
|
* arguments and `createContext` values are plain JSON and string keys, so they cannot carry one. A
|
|
15
15
|
* token handed back to `execute` (a handler passing its own context on) only narrows the next
|
|
16
16
|
* call, never widens it. Nothing binds a token on the MCP lanes, so they are unchanged.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-allow.d.ts","sourceRoot":"","sources":["../src/command-allow.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,KAAK,WAAW,EAAgB,MAAM,4CAA4C,CAAC;
|
|
1
|
+
{"version":3,"file":"command-allow.d.ts","sourceRoot":"","sources":["../src/command-allow.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,KAAK,WAAW,EAAgB,MAAM,4CAA4C,CAAC;AAU5F;;;GAGG;AACH,wBAAgB,gBAAgB,CAC/B,OAAO,EAAE,cAAc,EACvB,KAAK,EAAE,WAAW,GAAG,SAAS,GAC5B,cAAc,CAQhB;AAED,wEAAwE;AACxE,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,cAAc,GAAG,SAAS,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAG3F;AAED,iFAAiF;AACjF,wBAAgB,aAAa,CAAC,CAAC,SAAS;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,EACvD,KAAK,EAAE,CAAC,EAAE,EACV,OAAO,EAAE,cAAc,GAAG,SAAS,GACjC,CAAC,EAAE,CAGL"}
|
package/dist/command-allow.js
CHANGED
|
@@ -3,28 +3,26 @@
|
|
|
3
3
|
* one call.
|
|
4
4
|
*
|
|
5
5
|
* `DirectClient` passes its `allow` predicate to the registry as a call option, beside
|
|
6
|
-
* `activeContext`. The registry binds it to the call's
|
|
6
|
+
* `activeContext`. The registry binds it to the call's host state (`host-state.ts`), as it binds
|
|
7
7
|
* the context state (`context-scope.ts`), so the copies made for `afd-call`, batch items, pipeline
|
|
8
8
|
* steps and grouped tools all carry it, and the engine and the tool router check every command the
|
|
9
9
|
* call runs.
|
|
10
10
|
*
|
|
11
|
-
* The context holds
|
|
12
|
-
*
|
|
13
|
-
*
|
|
11
|
+
* The context holds the host state's opaque frozen token, never the predicate: a handler that lists
|
|
12
|
+
* its context's symbols finds an empty object it cannot call, read or swap for another predicate
|
|
13
|
+
* (a forged token denies everything). Tool
|
|
14
14
|
* arguments and `createContext` values are plain JSON and string keys, so they cannot carry one. A
|
|
15
15
|
* token handed back to `execute` (a handler passing its own context on) only narrows the next
|
|
16
16
|
* call, never widens it. Nothing binds a token on the MCP lanes, so they are unchanged.
|
|
17
17
|
*/
|
|
18
18
|
import { directAllows } from '@lushly-dev/afd-core/internal/direct-allow';
|
|
19
|
-
|
|
20
|
-
/** Tokens the registry minted, and the predicate each stands for. */
|
|
21
|
-
const predicates = new WeakMap();
|
|
19
|
+
import { hostState, withHostState } from './host-state.js';
|
|
22
20
|
/** The predicate bound to `context`: none when nothing is bound, deny-all for a forged token. */
|
|
23
21
|
function boundAllow(context) {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
return
|
|
22
|
+
const state = hostState(context);
|
|
23
|
+
if (state.forged)
|
|
24
|
+
return () => false;
|
|
25
|
+
return state.commandAllow;
|
|
28
26
|
}
|
|
29
27
|
/**
|
|
30
28
|
* Return `context` bound to `allow`, combined with any predicate it already carries: both must
|
|
@@ -37,10 +35,7 @@ export function bindCommandAllow(context, allow) {
|
|
|
37
35
|
const combined = allow && carried
|
|
38
36
|
? (name) => directAllows(carried, name) && directAllows(allow, name)
|
|
39
37
|
: (allow ?? carried);
|
|
40
|
-
|
|
41
|
-
predicates.set(token, combined);
|
|
42
|
-
const bound = { ...context, [ALLOW]: token };
|
|
43
|
-
return bound;
|
|
38
|
+
return withHostState(context, { commandAllow: combined });
|
|
44
39
|
}
|
|
45
40
|
/** Whether the predicate bound to `context`, if any, permits `name`. */
|
|
46
41
|
export function isCommandAllowed(context, name) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-allow.js","sourceRoot":"","sources":["../src/command-allow.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,EAAoB,YAAY,EAAE,MAAM,4CAA4C,CAAC;
|
|
1
|
+
{"version":3,"file":"command-allow.js","sourceRoot":"","sources":["../src/command-allow.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,EAAoB,YAAY,EAAE,MAAM,4CAA4C,CAAC;AAC5F,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAE3D,iGAAiG;AACjG,SAAS,UAAU,CAAC,OAAmC;IACtD,MAAM,KAAK,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC;IACjC,IAAI,KAAK,CAAC,MAAM;QAAE,OAAO,GAAG,EAAE,CAAC,KAAK,CAAC;IACrC,OAAO,KAAK,CAAC,YAAY,CAAC;AAC3B,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAC/B,OAAuB,EACvB,KAA8B;IAE9B,MAAM,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC;IACpC,IAAI,CAAC,KAAK,IAAI,CAAC,OAAO;QAAE,OAAO,OAAO,CAAC;IACvC,MAAM,QAAQ,GACb,KAAK,IAAI,OAAO;QACf,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,YAAY,CAAC,OAAO,EAAE,IAAI,CAAC,IAAI,YAAY,CAAC,KAAK,EAAE,IAAI,CAAC;QACpE,CAAC,CAAE,CAAC,KAAK,IAAI,OAAO,CAAiB,CAAC;IACxC,OAAO,aAAa,CAAC,OAAO,EAAE,EAAE,YAAY,EAAE,QAAQ,EAAE,CAAC,CAAC;AAC3D,CAAC;AAED,wEAAwE;AACxE,MAAM,UAAU,gBAAgB,CAAC,OAAmC,EAAE,IAAY;IACjF,MAAM,KAAK,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC;IAClC,OAAO,CAAC,KAAK,IAAI,YAAY,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;AAC5C,CAAC;AAED,iFAAiF;AACjF,MAAM,UAAU,aAAa,CAC5B,KAAU,EACV,OAAmC;IAEnC,MAAM,KAAK,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC;IAClC,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,YAAY,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;AAC/E,CAAC"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @fileoverview Shared helpers for tool listing, tool routing, discovery and
|
|
3
3
|
* execution: group/action derivation for the grouped strategy and context scoping.
|
|
4
4
|
*/
|
|
5
|
-
import type { CommandError } from '@lushly-dev/afd-core';
|
|
5
|
+
import type { CommandContext, CommandError } from '@lushly-dev/afd-core';
|
|
6
6
|
import type { ZodCommandDefinition } from './schema.js';
|
|
7
7
|
/** Derives a grouped-strategy tool name from a command (`McpServerOptions.groupByFn`). */
|
|
8
8
|
export type GroupByFn = (command: ZodCommandDefinition) => string | undefined;
|
|
@@ -30,25 +30,73 @@ export declare function commandAction(command: Pick<ZodCommandDefinition, 'name'
|
|
|
30
30
|
export declare function isAccessibleInContext(command: Contextual, activeContext: string | null | undefined): boolean;
|
|
31
31
|
/** Commands accessible in the active context (all of them when none is active). */
|
|
32
32
|
export declare function filterByContext<T extends Contextual>(commands: T[], activeContext: string | null | undefined): T[];
|
|
33
|
+
/**
|
|
34
|
+
* The meta-tools the tool router serves, as core's `AFD_META_TOOL_NAMES` lists them (a test keeps
|
|
35
|
+
* the two equal). Written out here because the engine, which `/direct` and Loam's first paint
|
|
36
|
+
* bundle, reads them, and importing core's `builtin-tools` would split it into a chunk of its own.
|
|
37
|
+
*/
|
|
38
|
+
export declare const ROUTED_META_TOOL_NAMES: readonly string[];
|
|
39
|
+
/**
|
|
40
|
+
* What a surface serves, for {@link canCall}: whether it routes the meta-tools, and the command
|
|
41
|
+
* it registers and exposes to the caller's interface under a name.
|
|
42
|
+
*/
|
|
43
|
+
export interface CallableSurface {
|
|
44
|
+
/** Whether the surface serves the meta-tools (`afd-discover`, `afd-call` and the rest). */
|
|
45
|
+
metaTools: boolean;
|
|
46
|
+
/** The command registered and exposed under `name` on this surface, if any. */
|
|
47
|
+
command(name: string): Contextual | undefined;
|
|
48
|
+
/**
|
|
49
|
+
* Whether the caller of `context` is shown `name` under MCP authorization (M6). Absent, every
|
|
50
|
+
* command is shown. The callers that hold the request's scope view pass it in, so this module,
|
|
51
|
+
* which `/direct` and the engine bundle, never loads `scope-view`.
|
|
52
|
+
*/
|
|
53
|
+
shown?(name: string, context: CommandContext | undefined): boolean;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Whether the caller of `context` can call `name` on `surface` (`spec/recovery.md`, rule 2 and
|
|
57
|
+
* "Engine errors"): served (a meta-tool on a surface that routes them) or registered and exposed,
|
|
58
|
+
* admitted by the call's `allow` list, shown to the caller under MCP authorization, and allowed in
|
|
59
|
+
* the active context. A refusal names a command, in its suggestion and in a `call` recovery,
|
|
60
|
+
* only when this holds, so the two never disagree. A meta-tool is called as its own tool, and
|
|
61
|
+
* the context and authorization checks do not apply to it.
|
|
62
|
+
*/
|
|
63
|
+
export declare function canCall(surface: CallableSurface, name: string, context: CommandContext | undefined, activeContext: string | null | undefined): boolean;
|
|
64
|
+
/** The commands a `COMMAND_NOT_FOUND` suggestion and recovery may point to, in order. */
|
|
65
|
+
declare const NOT_FOUND_NEXT: readonly ['afd-discover', 'afd-help'];
|
|
66
|
+
/** The command a `COMMAND_NOT_FOUND` names next: the first of {@link NOT_FOUND_NEXT} `can` admits. */
|
|
67
|
+
export type NotFoundNext = (typeof NOT_FOUND_NEXT)[number];
|
|
68
|
+
/** The first command a not-found answer may point to, of those `can` admits; `null` for none. */
|
|
69
|
+
export declare function notFoundNext(can: (name: string) => boolean): NotFoundNext | null;
|
|
33
70
|
/**
|
|
34
71
|
* Recovery guidance for an unknown command name: at most
|
|
35
72
|
* {@link MAX_NOT_FOUND_MATCHES} close matches (bounded fuzzy matching; none for
|
|
36
|
-
* very long names) and a pointer to `afd-discover`. It never lists every
|
|
73
|
+
* very long names) and a pointer to `afd-discover` or `afd-help`. It never lists every
|
|
37
74
|
* command, which in lazy mode would load the whole surface into the agent's
|
|
38
75
|
* context on a single typo.
|
|
39
76
|
*
|
|
40
77
|
* @param commandName - The unknown name (untrusted; never echoed)
|
|
41
78
|
* @param commandNames - Names the caller may call
|
|
42
|
-
* @param
|
|
43
|
-
* as Rust's and C++'s do (`spec/error-codes.md`, "Suggestions name
|
|
79
|
+
* @param next - The command the caller can call to list the others ({@link notFoundNext}). With
|
|
80
|
+
* `null` the suggestion ends as Rust's and C++'s do (`spec/error-codes.md`, "Suggestions name
|
|
81
|
+
* only tools the host provides")
|
|
82
|
+
*/
|
|
83
|
+
export declare function notFoundSuggestion(commandName: string, commandNames: string[], next?: NotFoundNext | null): string;
|
|
84
|
+
/**
|
|
85
|
+
* The `COMMAND_NOT_FOUND` error for an unknown name at lookup (a call, `afd-call`, a batch item or
|
|
86
|
+
* a pipeline step). Its suggestion and its recovery name the same command, `next`, or none
|
|
87
|
+
* (`spec/recovery.md`, "Engine errors").
|
|
44
88
|
*/
|
|
45
|
-
export declare function
|
|
89
|
+
export declare function notFoundError(commandName: string, commandNames: string[], next: NotFoundNext | null): CommandError;
|
|
46
90
|
/**
|
|
47
91
|
* The `COMMAND_NOT_IN_CONTEXT` error for a command outside the active context.
|
|
48
92
|
*
|
|
49
|
-
* @param belongsTo - The command's contexts
|
|
50
|
-
*
|
|
93
|
+
* @param belongsTo - The command's contexts
|
|
94
|
+
* @param can - Whether the caller can call a command ({@link canCall}). When it can call
|
|
95
|
+
* `afd-context-list`, the suggestion and the recovery name it (and the suggestion names
|
|
96
|
+
* `afd-context-enter` too, when the caller can call that); otherwise the suggestion names the
|
|
97
|
+
* command's contexts, as Rust's and C++'s do, and the error carries no recovery. Default: every
|
|
98
|
+
* command can be called
|
|
51
99
|
*/
|
|
52
|
-
export declare function notInContextError(commandName: string, activeContext: string, belongsTo?: readonly string[]): CommandError;
|
|
100
|
+
export declare function notInContextError(commandName: string, activeContext: string, belongsTo?: readonly string[], can?: (name: string) => boolean): CommandError;
|
|
53
101
|
export {};
|
|
54
102
|
//# sourceMappingURL=command-routing.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-routing.d.ts","sourceRoot":"","sources":["../src/command-routing.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"command-routing.d.ts","sourceRoot":"","sources":["../src/command-routing.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAGzE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAExD,0FAA0F;AAC1F,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,EAAE,oBAAoB,KAAK,MAAM,GAAG,SAAS,CAAC;AAE9E,uDAAuD;AACvD,KAAK,UAAU,GAAG,IAAI,CAAC,oBAAoB,EAAE,UAAU,CAAC,CAAC;AAEzD;;;GAGG;AACH,wBAAgB,mBAAmB,CAClC,OAAO,EAAE,IAAI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,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC;AAE3D,iGAAiG;AACjG,wBAAgB,YAAY,CAAC,GAAG,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,GAAG,YAAY,GAAG,IAAI,CAEhF;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,kBAAkB,CACjC,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,MAAM,EAAE,EACtB,IAAI,GAAE,YAAY,GAAG,IAAqB,GACxC,MAAM,CAUR;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAC5B,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,MAAM,EAAE,EACtB,IAAI,EAAE,YAAY,GAAG,IAAI,GACvB,YAAY,CAOd;AAED;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAChC,WAAW,EAAE,MAAM,EACnB,aAAa,EAAE,MAAM,EACrB,SAAS,GAAE,SAAS,MAAM,EAAO,EACjC,GAAG,GAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAoB,GACzC,YAAY,CAiBd"}
|
package/dist/command-routing.js
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
* @fileoverview Shared helpers for tool listing, tool routing, discovery and
|
|
3
3
|
* execution: group/action derivation for the grouped strategy and context scoping.
|
|
4
4
|
*/
|
|
5
|
-
import { findSimilarTools } from '@lushly-dev/afd-core';
|
|
5
|
+
import { findSimilarTools, truncateName } from '@lushly-dev/afd-core';
|
|
6
|
+
import { isCommandAllowed } from './command-allow.js';
|
|
6
7
|
/**
|
|
7
8
|
* Default group (and discovery category) of a command: its `category`, else the
|
|
8
9
|
* first kebab-case segment of its name, else `'general'`.
|
|
@@ -42,45 +43,110 @@ export function filterByContext(commands, activeContext) {
|
|
|
42
43
|
return commands;
|
|
43
44
|
return commands.filter((command) => isAccessibleInContext(command, activeContext));
|
|
44
45
|
}
|
|
46
|
+
/**
|
|
47
|
+
* The meta-tools the tool router serves, as core's `AFD_META_TOOL_NAMES` lists them (a test keeps
|
|
48
|
+
* the two equal). Written out here because the engine, which `/direct` and Loam's first paint
|
|
49
|
+
* bundle, reads them, and importing core's `builtin-tools` would split it into a chunk of its own.
|
|
50
|
+
*/
|
|
51
|
+
export const ROUTED_META_TOOL_NAMES = [
|
|
52
|
+
'afd-call',
|
|
53
|
+
'afd-batch',
|
|
54
|
+
'afd-pipe',
|
|
55
|
+
'afd-discover',
|
|
56
|
+
'afd-detail',
|
|
57
|
+
];
|
|
58
|
+
/**
|
|
59
|
+
* Whether the caller of `context` can call `name` on `surface` (`spec/recovery.md`, rule 2 and
|
|
60
|
+
* "Engine errors"): served (a meta-tool on a surface that routes them) or registered and exposed,
|
|
61
|
+
* admitted by the call's `allow` list, shown to the caller under MCP authorization, and allowed in
|
|
62
|
+
* the active context. A refusal names a command, in its suggestion and in a `call` recovery,
|
|
63
|
+
* only when this holds, so the two never disagree. A meta-tool is called as its own tool, and
|
|
64
|
+
* the context and authorization checks do not apply to it.
|
|
65
|
+
*/
|
|
66
|
+
export function canCall(surface, name, context, activeContext) {
|
|
67
|
+
if (!isCommandAllowed(context, name))
|
|
68
|
+
return false;
|
|
69
|
+
if (ROUTED_META_TOOL_NAMES.includes(name))
|
|
70
|
+
return surface.metaTools;
|
|
71
|
+
const command = surface.command(name);
|
|
72
|
+
if (!command)
|
|
73
|
+
return false;
|
|
74
|
+
if (surface.shown && !surface.shown(name, context))
|
|
75
|
+
return false;
|
|
76
|
+
return isAccessibleInContext(command, activeContext);
|
|
77
|
+
}
|
|
45
78
|
/** How many close matches a `COMMAND_NOT_FOUND` suggestion names at most. */
|
|
46
79
|
const MAX_NOT_FOUND_MATCHES = 3;
|
|
80
|
+
/** The commands a `COMMAND_NOT_FOUND` suggestion and recovery may point to, in order. */
|
|
81
|
+
const NOT_FOUND_NEXT = ['afd-discover', 'afd-help'];
|
|
82
|
+
/** The first command a not-found answer may point to, of those `can` admits; `null` for none. */
|
|
83
|
+
export function notFoundNext(can) {
|
|
84
|
+
return NOT_FOUND_NEXT.find((name) => can(name)) ?? null;
|
|
85
|
+
}
|
|
47
86
|
/**
|
|
48
87
|
* Recovery guidance for an unknown command name: at most
|
|
49
88
|
* {@link MAX_NOT_FOUND_MATCHES} close matches (bounded fuzzy matching; none for
|
|
50
|
-
* very long names) and a pointer to `afd-discover`. It never lists every
|
|
89
|
+
* very long names) and a pointer to `afd-discover` or `afd-help`. It never lists every
|
|
51
90
|
* command, which in lazy mode would load the whole surface into the agent's
|
|
52
91
|
* context on a single typo.
|
|
53
92
|
*
|
|
54
93
|
* @param commandName - The unknown name (untrusted; never echoed)
|
|
55
94
|
* @param commandNames - Names the caller may call
|
|
56
|
-
* @param
|
|
57
|
-
* as Rust's and C++'s do (`spec/error-codes.md`, "Suggestions name
|
|
95
|
+
* @param next - The command the caller can call to list the others ({@link notFoundNext}). With
|
|
96
|
+
* `null` the suggestion ends as Rust's and C++'s do (`spec/error-codes.md`, "Suggestions name
|
|
97
|
+
* only tools the host provides")
|
|
58
98
|
*/
|
|
59
|
-
export function notFoundSuggestion(commandName, commandNames,
|
|
60
|
-
const
|
|
61
|
-
?
|
|
99
|
+
export function notFoundSuggestion(commandName, commandNames, next = 'afd-discover') {
|
|
100
|
+
const pointer = next
|
|
101
|
+
? `Use ${next} to list all commands.`
|
|
62
102
|
: 'Check the command name against the available commands.';
|
|
63
103
|
const [best, ...others] = findSimilarTools(commandName, commandNames, MAX_NOT_FOUND_MATCHES);
|
|
64
104
|
if (best === undefined)
|
|
65
|
-
return
|
|
105
|
+
return pointer;
|
|
66
106
|
const alsoClose = others.length
|
|
67
107
|
? ` Other close matches: ${others.map((name) => `'${name}'`).join(', ')}.`
|
|
68
108
|
: '';
|
|
69
|
-
return `Did you mean '${best}'?${alsoClose} ${
|
|
109
|
+
return `Did you mean '${best}'?${alsoClose} ${pointer}`;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* The `COMMAND_NOT_FOUND` error for an unknown name at lookup (a call, `afd-call`, a batch item or
|
|
113
|
+
* a pipeline step). Its suggestion and its recovery name the same command, `next`, or none
|
|
114
|
+
* (`spec/recovery.md`, "Engine errors").
|
|
115
|
+
*/
|
|
116
|
+
export function notFoundError(commandName, commandNames, next) {
|
|
117
|
+
return {
|
|
118
|
+
code: 'COMMAND_NOT_FOUND',
|
|
119
|
+
message: `Command '${truncateName(commandName)}' not found`,
|
|
120
|
+
suggestion: notFoundSuggestion(commandName, commandNames, next),
|
|
121
|
+
...(next && { recovery: { kind: 'call', command: next } }),
|
|
122
|
+
};
|
|
70
123
|
}
|
|
71
124
|
/**
|
|
72
125
|
* The `COMMAND_NOT_IN_CONTEXT` error for a command outside the active context.
|
|
73
126
|
*
|
|
74
|
-
* @param belongsTo - The command's contexts
|
|
75
|
-
*
|
|
127
|
+
* @param belongsTo - The command's contexts
|
|
128
|
+
* @param can - Whether the caller can call a command ({@link canCall}). When it can call
|
|
129
|
+
* `afd-context-list`, the suggestion and the recovery name it (and the suggestion names
|
|
130
|
+
* `afd-context-enter` too, when the caller can call that); otherwise the suggestion names the
|
|
131
|
+
* command's contexts, as Rust's and C++'s do, and the error carries no recovery. Default: every
|
|
132
|
+
* command can be called
|
|
76
133
|
*/
|
|
77
|
-
export function notInContextError(commandName, activeContext, belongsTo) {
|
|
78
|
-
|
|
134
|
+
export function notInContextError(commandName, activeContext, belongsTo = [], can = () => true) {
|
|
135
|
+
const error = {
|
|
79
136
|
code: 'COMMAND_NOT_IN_CONTEXT',
|
|
80
137
|
message: `Command '${commandName}' is not available in context '${activeContext}'`,
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
138
|
+
};
|
|
139
|
+
const list = 'afd-context-list';
|
|
140
|
+
if (!can(list)) {
|
|
141
|
+
return {
|
|
142
|
+
...error,
|
|
143
|
+
suggestion: `Switch to a context this command belongs to (${belongsTo.map((name) => `'${name}'`).join(', ')}), or call it with no active context.`,
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
return {
|
|
147
|
+
...error,
|
|
148
|
+
suggestion: `Use ${list} to see available contexts${can('afd-context-enter') ? ', or afd-context-enter to switch' : ''}.`,
|
|
149
|
+
recovery: { kind: 'call', command: list },
|
|
84
150
|
};
|
|
85
151
|
}
|
|
86
152
|
//# sourceMappingURL=command-routing.js.map
|