agentfootprint 7.17.0 → 7.18.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/AGENTS.md +1 -1
- package/CLAUDE.md +2 -2
- package/ai-instructions/claude-code/SKILL.md +1 -1
- package/dist/core/Agent.js +51 -2
- package/dist/core/Agent.js.map +1 -1
- package/dist/core/RunnerBase.js +16 -1
- package/dist/core/RunnerBase.js.map +1 -1
- package/dist/core/agent/AgentBuilder.js +117 -1
- package/dist/core/agent/AgentBuilder.js.map +1 -1
- package/dist/core/agent/middleware/errors.js +54 -0
- package/dist/core/agent/middleware/errors.js.map +1 -0
- package/dist/core/agent/middleware/index.js +23 -0
- package/dist/core/agent/middleware/index.js.map +1 -0
- package/dist/core/agent/middleware/ledger.js +61 -0
- package/dist/core/agent/middleware/ledger.js.map +1 -0
- package/dist/core/agent/middleware/outcomes.js +66 -0
- package/dist/core/agent/middleware/outcomes.js.map +1 -0
- package/dist/core/agent/middleware/runChain.js +144 -0
- package/dist/core/agent/middleware/runChain.js.map +1 -0
- package/dist/core/agent/middleware/types.js +41 -0
- package/dist/core/agent/middleware/types.js.map +1 -0
- package/dist/core/agent/stages/prepareFinal.js +10 -0
- package/dist/core/agent/stages/prepareFinal.js.map +1 -1
- package/dist/core/agent/stages/route.js +62 -1
- package/dist/core/agent/stages/route.js.map +1 -1
- package/dist/core/agent/stages/seed.js +130 -85
- package/dist/core/agent/stages/seed.js.map +1 -1
- package/dist/core/agent/stages/toolCalls.js +195 -8
- package/dist/core/agent/stages/toolCalls.js.map +1 -1
- package/dist/core/pause.js +19 -1
- package/dist/core/pause.js.map +1 -1
- package/dist/esm/core/Agent.d.ts +9 -1
- package/dist/esm/core/Agent.js +52 -3
- package/dist/esm/core/Agent.js.map +1 -1
- package/dist/esm/core/RunnerBase.js +16 -1
- package/dist/esm/core/RunnerBase.js.map +1 -1
- package/dist/esm/core/agent/AgentBuilder.d.ts +97 -0
- package/dist/esm/core/agent/AgentBuilder.js +117 -1
- package/dist/esm/core/agent/AgentBuilder.js.map +1 -1
- package/dist/esm/core/agent/buildAgentChart.d.ts +2 -2
- package/dist/esm/core/agent/middleware/errors.d.ts +51 -0
- package/dist/esm/core/agent/middleware/errors.js +50 -0
- package/dist/esm/core/agent/middleware/errors.js.map +1 -0
- package/dist/esm/core/agent/middleware/index.d.ts +16 -0
- package/dist/esm/core/agent/middleware/index.js +16 -0
- package/dist/esm/core/agent/middleware/index.js.map +1 -0
- package/dist/esm/core/agent/middleware/ledger.d.ts +40 -0
- package/dist/esm/core/agent/middleware/ledger.js +57 -0
- package/dist/esm/core/agent/middleware/ledger.js.map +1 -0
- package/dist/esm/core/agent/middleware/outcomes.d.ts +45 -0
- package/dist/esm/core/agent/middleware/outcomes.js +60 -0
- package/dist/esm/core/agent/middleware/outcomes.js.map +1 -0
- package/dist/esm/core/agent/middleware/runChain.d.ts +104 -0
- package/dist/esm/core/agent/middleware/runChain.js +139 -0
- package/dist/esm/core/agent/middleware/runChain.js.map +1 -0
- package/dist/esm/core/agent/middleware/types.d.ts +191 -0
- package/dist/esm/core/agent/middleware/types.js +40 -0
- package/dist/esm/core/agent/middleware/types.js.map +1 -0
- package/dist/esm/core/agent/stages/prepareFinal.d.ts +10 -0
- package/dist/esm/core/agent/stages/prepareFinal.js +10 -0
- package/dist/esm/core/agent/stages/prepareFinal.js.map +1 -1
- package/dist/esm/core/agent/stages/route.d.ts +29 -0
- package/dist/esm/core/agent/stages/route.js +60 -0
- package/dist/esm/core/agent/stages/route.js.map +1 -1
- package/dist/esm/core/agent/stages/seed.d.ts +16 -1
- package/dist/esm/core/agent/stages/seed.js +130 -85
- package/dist/esm/core/agent/stages/seed.js.map +1 -1
- package/dist/esm/core/agent/stages/toolCalls.d.ts +23 -0
- package/dist/esm/core/agent/stages/toolCalls.js +195 -8
- package/dist/esm/core/agent/stages/toolCalls.js.map +1 -1
- package/dist/esm/core/agent/types.d.ts +18 -0
- package/dist/esm/core/pause.d.ts +42 -0
- package/dist/esm/core/pause.js +17 -0
- package/dist/esm/core/pause.js.map +1 -1
- package/dist/esm/events/dispatcher.d.ts +1 -1
- package/dist/esm/events/dispatcher.js.map +1 -1
- package/dist/esm/events/payloads.d.ts +26 -0
- package/dist/esm/events/registry.d.ts +5 -1
- package/dist/esm/events/registry.js +4 -0
- package/dist/esm/events/registry.js.map +1 -1
- package/dist/esm/index.d.ts +2 -1
- package/dist/esm/index.js +13 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lib/mcp/mcpServe.js +39 -6
- package/dist/esm/lib/mcp/mcpServe.js.map +1 -1
- package/dist/esm/lib/mcp/types.d.ts +16 -0
- package/dist/events/dispatcher.js.map +1 -1
- package/dist/events/registry.js +4 -0
- package/dist/events/registry.js.map +1 -1
- package/dist/index.js +31 -14
- package/dist/index.js.map +1 -1
- package/dist/lib/mcp/mcpServe.js +39 -6
- package/dist/lib/mcp/mcpServe.js.map +1 -1
- package/dist/types/core/Agent.d.ts +9 -1
- package/dist/types/core/Agent.d.ts.map +1 -1
- package/dist/types/core/RunnerBase.d.ts.map +1 -1
- package/dist/types/core/agent/AgentBuilder.d.ts +97 -0
- package/dist/types/core/agent/AgentBuilder.d.ts.map +1 -1
- package/dist/types/core/agent/buildAgentChart.d.ts +2 -2
- package/dist/types/core/agent/buildAgentChart.d.ts.map +1 -1
- package/dist/types/core/agent/middleware/errors.d.ts +52 -0
- package/dist/types/core/agent/middleware/errors.d.ts.map +1 -0
- package/dist/types/core/agent/middleware/index.d.ts +17 -0
- package/dist/types/core/agent/middleware/index.d.ts.map +1 -0
- package/dist/types/core/agent/middleware/ledger.d.ts +41 -0
- package/dist/types/core/agent/middleware/ledger.d.ts.map +1 -0
- package/dist/types/core/agent/middleware/outcomes.d.ts +46 -0
- package/dist/types/core/agent/middleware/outcomes.d.ts.map +1 -0
- package/dist/types/core/agent/middleware/runChain.d.ts +105 -0
- package/dist/types/core/agent/middleware/runChain.d.ts.map +1 -0
- package/dist/types/core/agent/middleware/types.d.ts +192 -0
- package/dist/types/core/agent/middleware/types.d.ts.map +1 -0
- package/dist/types/core/agent/stages/prepareFinal.d.ts +10 -0
- package/dist/types/core/agent/stages/prepareFinal.d.ts.map +1 -1
- package/dist/types/core/agent/stages/route.d.ts +29 -0
- package/dist/types/core/agent/stages/route.d.ts.map +1 -1
- package/dist/types/core/agent/stages/seed.d.ts +16 -1
- package/dist/types/core/agent/stages/seed.d.ts.map +1 -1
- package/dist/types/core/agent/stages/toolCalls.d.ts +23 -0
- package/dist/types/core/agent/stages/toolCalls.d.ts.map +1 -1
- package/dist/types/core/agent/types.d.ts +18 -0
- package/dist/types/core/agent/types.d.ts.map +1 -1
- package/dist/types/core/pause.d.ts +42 -0
- package/dist/types/core/pause.d.ts.map +1 -1
- package/dist/types/events/dispatcher.d.ts +1 -1
- package/dist/types/events/dispatcher.d.ts.map +1 -1
- package/dist/types/events/payloads.d.ts +26 -0
- package/dist/types/events/payloads.d.ts.map +1 -1
- package/dist/types/events/registry.d.ts +5 -1
- package/dist/types/events/registry.d.ts.map +1 -1
- package/dist/types/index.d.ts +2 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/lib/mcp/mcpServe.d.ts.map +1 -1
- package/dist/types/lib/mcp/types.d.ts +16 -0
- package/dist/types/lib/mcp/types.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -128,6 +128,10 @@ export class AgentBuilder {
|
|
|
128
128
|
* Undefined = no window stage exists, the ReAct loop target is unchanged,
|
|
129
129
|
* and the run is byte-identical to an agent that never heard of them. */
|
|
130
130
|
windowStrategyValue;
|
|
131
|
+
/** The tool-dispatch chain, in call order. Empty = no chain, no ledger. */
|
|
132
|
+
toolMiddlewareList = [];
|
|
133
|
+
/** The message chain, in call order. Empty = no chain, no ledger. */
|
|
134
|
+
messageMiddlewareList = [];
|
|
131
135
|
constructor(opts) {
|
|
132
136
|
this.opts = opts;
|
|
133
137
|
// Cache layer: opts.caching === 'off' propagates to scope's
|
|
@@ -922,6 +926,118 @@ export class AgentBuilder {
|
|
|
922
926
|
* .checkIn({ evidence: 'standard' })
|
|
923
927
|
* .build();
|
|
924
928
|
*/
|
|
929
|
+
/**
|
|
930
|
+
* Wrap every tool dispatch in a governance chain.
|
|
931
|
+
*
|
|
932
|
+
* Each middleware answers with one of three verbs — `allow()`, `deny(reason)`
|
|
933
|
+
* or `ask({ question })` — and there is deliberately no fourth. In
|
|
934
|
+
* particular there is no way to return a result: whatever the chain decides,
|
|
935
|
+
* the answer the model finally reads is the real tool's output or a refusal.
|
|
936
|
+
* A rule cannot quietly become the tool.
|
|
937
|
+
*
|
|
938
|
+
* - **`allow()`** passes the call through. **`allow(args, why)`** replaces
|
|
939
|
+
* the args and the run commits BOTH versions with your `why` beside them,
|
|
940
|
+
* so a slice taken later can find the moment they changed and who changed
|
|
941
|
+
* them.
|
|
942
|
+
* - **`deny(reason)`** refuses. The reason reaches the model verbatim, as
|
|
943
|
+
* the tool result, and the loop continues — the agent adapts in-flight. A
|
|
944
|
+
* denial is data, not a crash.
|
|
945
|
+
* - **`ask({ question })`** suspends the run for a person, on the same
|
|
946
|
+
* checkpoint machinery `checkIn` and `askHuman` use. The answer is a
|
|
947
|
+
* DECISION, not a result: approve and the chain resumes and the real tool
|
|
948
|
+
* runs; decline and it becomes a denial the model reads.
|
|
949
|
+
*
|
|
950
|
+
* Order is call order, and each middleware sees the previous one's output.
|
|
951
|
+
* The first non-allow answer wins and the rest of the chain does not run. A
|
|
952
|
+
* middleware that throws is a denial carrying the error as its reason —
|
|
953
|
+
* never a silent pass.
|
|
954
|
+
*
|
|
955
|
+
* An existing `PermissionChecker` still decides FIRST: it is not part of
|
|
956
|
+
* this chain, it runs ahead of it, so a call it denies never reaches a
|
|
957
|
+
* middleware. `gatedTools` is a different layer again — it decides which
|
|
958
|
+
* tools the model can SEE; this decides what happens when one is called.
|
|
959
|
+
*
|
|
960
|
+
* Omit this and nothing changes: no chain walk, no committed ledger key, the
|
|
961
|
+
* same request bytes.
|
|
962
|
+
*
|
|
963
|
+
* @example
|
|
964
|
+
* ```ts
|
|
965
|
+
* import { Agent, allow, deny } from 'agentfootprint';
|
|
966
|
+
*
|
|
967
|
+
* const agent = Agent.create({ provider, model })
|
|
968
|
+
* .toolMiddleware({
|
|
969
|
+
* name: 'no-prod-writes',
|
|
970
|
+
* onToolCall: (call) =>
|
|
971
|
+
* call.args.env === 'prod' ? deny('writes to prod need a change ticket') : allow(),
|
|
972
|
+
* })
|
|
973
|
+
* .build();
|
|
974
|
+
* ```
|
|
975
|
+
*/
|
|
976
|
+
toolMiddleware(...middleware) {
|
|
977
|
+
for (const mw of middleware)
|
|
978
|
+
this.assertMiddleware(mw, 'toolMiddleware', 'onToolCall');
|
|
979
|
+
this.toolMiddlewareList = [...this.toolMiddlewareList, ...middleware];
|
|
980
|
+
return this;
|
|
981
|
+
}
|
|
982
|
+
/**
|
|
983
|
+
* Wrap the message boundary in a governance chain — the input before the
|
|
984
|
+
* model sees it, the output before the caller receives it.
|
|
985
|
+
*
|
|
986
|
+
* Same verbs as {@link toolMiddleware} minus one: there is no `ask` here,
|
|
987
|
+
* and the type says so. Tool dispatch runs inside a pausable stage, so it
|
|
988
|
+
* has a checkpoint to suspend on; the message boundary is a plain stage, and
|
|
989
|
+
* inventing a second pause to give it one would be a worse answer than not
|
|
990
|
+
* offering it.
|
|
991
|
+
*
|
|
992
|
+
* The `'input'` half runs at the very top of the run, BEFORE the message is
|
|
993
|
+
* committed. That placement is the point: everything downstream reads
|
|
994
|
+
* `scope.history` — the window strategies, the injections, all three slots,
|
|
995
|
+
* the bytes on the wire and every slice taken afterwards — so the
|
|
996
|
+
* transformed text is what the whole run agrees was said. The `'output'`
|
|
997
|
+
* half runs where the final answer is captured, so the record and the caller
|
|
998
|
+
* receive the same string.
|
|
999
|
+
*
|
|
1000
|
+
* `deny(reason)` at either phase raises a `MessageDeniedError` rather than
|
|
1001
|
+
* returning. At `'input'` there is no model to tell; at `'output'` the
|
|
1002
|
+
* middleware has just refused to release an answer, and handing the caller a
|
|
1003
|
+
* string in its place is the one substitution they must never make without
|
|
1004
|
+
* noticing. The error carries the reason, the phase and the middleware's
|
|
1005
|
+
* name — never the refused content.
|
|
1006
|
+
*
|
|
1007
|
+
* @example
|
|
1008
|
+
* ```ts
|
|
1009
|
+
* import { Agent, allow } from 'agentfootprint';
|
|
1010
|
+
*
|
|
1011
|
+
* const agent = Agent.create({ provider, model })
|
|
1012
|
+
* .messageMiddleware({
|
|
1013
|
+
* name: 'mask-card-numbers',
|
|
1014
|
+
* onMessage: (msg) => {
|
|
1015
|
+
* const clean = msg.content.replace(/\b(?:\d[ -]?){13,16}\b/g, '[card]');
|
|
1016
|
+
* return clean === msg.content ? allow() : allow(clean, 'masked a card number');
|
|
1017
|
+
* },
|
|
1018
|
+
* })
|
|
1019
|
+
* .build();
|
|
1020
|
+
* ```
|
|
1021
|
+
*/
|
|
1022
|
+
messageMiddleware(...middleware) {
|
|
1023
|
+
for (const mw of middleware)
|
|
1024
|
+
this.assertMiddleware(mw, 'messageMiddleware', 'onMessage');
|
|
1025
|
+
this.messageMiddlewareList = [...this.messageMiddlewareList, ...middleware];
|
|
1026
|
+
return this;
|
|
1027
|
+
}
|
|
1028
|
+
/** Shared shape check — a chain built from a typo fails at build time, not
|
|
1029
|
+
* as a silent no-op on the one call that needed governing. */
|
|
1030
|
+
assertMiddleware(mw, method, hook) {
|
|
1031
|
+
if (mw === null ||
|
|
1032
|
+
typeof mw !== 'object' ||
|
|
1033
|
+
typeof mw.name !== 'string' ||
|
|
1034
|
+
mw.name.length === 0 ||
|
|
1035
|
+
typeof mw[hook] !== 'function') {
|
|
1036
|
+
throw new Error(`AgentBuilder.${method}: expected an object with a non-empty \`name\` and a ` +
|
|
1037
|
+
`\`${hook}(...)\` method, got ${typeof mw}. The name is what every ledger row and ` +
|
|
1038
|
+
`event says decided the call, so it cannot be blank.`);
|
|
1039
|
+
}
|
|
1040
|
+
}
|
|
925
1041
|
checkIn(opts = {}) {
|
|
926
1042
|
if (this.checkInConfig !== undefined) {
|
|
927
1043
|
throw new Error('AgentBuilder.checkIn: already configured. Call it at most once.');
|
|
@@ -985,7 +1101,7 @@ export class AgentBuilder {
|
|
|
985
1101
|
const toolProvider = selfExplainBinding
|
|
986
1102
|
? buildSelfExplainToolProvider(selfExplainBinding, this.selfExplainConfig, this.toolProviderRef)
|
|
987
1103
|
: this.toolProviderRef;
|
|
988
|
-
const agent = new Agent(opts, this.systemPromptValue, this.registry, voice, injections, this.memoryList, this.outputSchemaParser, toolProvider, this.systemPromptCachePolicy, this.cachingDisabledValue, this.cacheStrategyOverride, this.outputFallbackCfg, this.reliabilityConfig, this.thinkingHandlerValue, this.thinkingBudgetValue, this.skillGraphNextSkill, this.skillGraphReachable, this.skillGraphScoreEntries, this.checkInConfig, this.runConfigFn, this.windowStrategyValue);
|
|
1104
|
+
const agent = new Agent(opts, this.systemPromptValue, this.registry, voice, injections, this.memoryList, this.outputSchemaParser, toolProvider, this.systemPromptCachePolicy, this.cachingDisabledValue, this.cacheStrategyOverride, this.outputFallbackCfg, this.reliabilityConfig, this.thinkingHandlerValue, this.thinkingBudgetValue, this.skillGraphNextSkill, this.skillGraphReachable, this.skillGraphScoreEntries, this.checkInConfig, this.runConfigFn, this.windowStrategyValue, this.toolMiddlewareList, this.messageMiddlewareList);
|
|
989
1105
|
// Attach builder-collected recorders so they receive events from
|
|
990
1106
|
// the very first run. Mirrors what consumers would do post-build
|
|
991
1107
|
// via `agent.attach(rec)`; the builder method is purely sugar.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgentBuilder.js","sourceRoot":"","sources":["../../../../src/core/agent/AgentBuilder.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACL,uBAAuB,GAGxB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,2BAA2B,GAI5B,MAAM,sBAAsB,CAAC;AAI9B,OAAO,EAAE,iBAAiB,EAAE,MAAM,2DAA2D,CAA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ACpB,CAAC;QACD,IAAI,kBAAkB,EAAE,CAAC;YACvB,iEAAiE;YACjE,iEAAiE;YACjE,kBAAkB,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,eAAe,EAAE,CAAC,CAAC;YACzD,KAAK,CAAC,MAAM,CAAC,kBAAkB,CAAC,QAAQ,EAAE,CAAC,CAAC;QAC9C,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;CACF"}
|
|
@@ -63,9 +63,9 @@ export interface AgentChartDeps {
|
|
|
63
63
|
/** Hard ReAct iteration cap, threaded into CacheDecision's
|
|
64
64
|
* inputMapper for max-iteration policies. */
|
|
65
65
|
readonly maxIterations: number;
|
|
66
|
-
readonly seed: (scope: never) => void
|
|
66
|
+
readonly seed: (scope: never) => void | Promise<void>;
|
|
67
67
|
readonly callLLM: (scope: never) => Promise<void>;
|
|
68
|
-
readonly routeDecider: (scope: never) => 'tool-calls' | 'final'
|
|
68
|
+
readonly routeDecider: (scope: never) => 'tool-calls' | 'final' | Promise<'tool-calls' | 'final'>;
|
|
69
69
|
readonly toolCallsHandler: import('footprintjs').PausableHandler<never>;
|
|
70
70
|
readonly injectionEngineSubflow: FlowChart;
|
|
71
71
|
/** Relevance entry router (`entryByRelevance`) — a once-per-turn function stage
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MessageDeniedError — typed error thrown by `Agent.run()` when a
|
|
3
|
+
* `messageMiddleware` returns `deny(reason)`.
|
|
4
|
+
*
|
|
5
|
+
* Pattern: Typed Error (the `PolicyHaltError` shape, for the same reason).
|
|
6
|
+
* Role: Surface layer for the message boundary. The stage writes the
|
|
7
|
+
* refusal to scope; `Agent.finalizeResult` translates it here, so
|
|
8
|
+
* a caller can `instanceof` it and route on `.phase` / `.middleware`.
|
|
9
|
+
* Emits: N/A — `agentfootprint.middleware.decision` fires from the stage
|
|
10
|
+
* at the moment the refusal is decided.
|
|
11
|
+
*
|
|
12
|
+
* ## Why a refusal is not returned as an answer
|
|
13
|
+
*
|
|
14
|
+
* At the `'input'` phase there is no model to tell: the message never
|
|
15
|
+
* reached one, so there is nothing in the run for a denial to become. At
|
|
16
|
+
* the `'output'` phase there IS an answer, and the middleware has just
|
|
17
|
+
* refused to release it — handing the caller a string in its place is the
|
|
18
|
+
* one substitution a caller must never be able to make silently. Both
|
|
19
|
+
* phases therefore raise, exactly the way a policy halt does.
|
|
20
|
+
*
|
|
21
|
+
* ## What it deliberately does not carry
|
|
22
|
+
*
|
|
23
|
+
* Never the refused content. A middleware that suppressed an answer would
|
|
24
|
+
* be undone by an error object that carried the answer out anyway. The
|
|
25
|
+
* content stays where the run put it — in the commit log, under whatever
|
|
26
|
+
* redaction the run configured.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* try {
|
|
30
|
+
* await agent.run({ message: userText });
|
|
31
|
+
* } catch (e) {
|
|
32
|
+
* if (e instanceof MessageDeniedError) {
|
|
33
|
+
* console.log(`${e.middleware} refused this ${e.phase}: ${e.reason}`);
|
|
34
|
+
* } else throw e;
|
|
35
|
+
* }
|
|
36
|
+
*/
|
|
37
|
+
export interface MessageDeniedContext {
|
|
38
|
+
/** The refusal text the middleware returned. */
|
|
39
|
+
readonly reason: string;
|
|
40
|
+
/** Which boundary refused. */
|
|
41
|
+
readonly phase: 'input' | 'output';
|
|
42
|
+
/** `name` of the middleware that returned `deny`. */
|
|
43
|
+
readonly middleware: string;
|
|
44
|
+
}
|
|
45
|
+
export declare class MessageDeniedError extends Error {
|
|
46
|
+
readonly code: "ERR_MESSAGE_DENIED";
|
|
47
|
+
readonly reason: string;
|
|
48
|
+
readonly phase: 'input' | 'output';
|
|
49
|
+
readonly middleware: string;
|
|
50
|
+
constructor(ctx: MessageDeniedContext);
|
|
51
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MessageDeniedError — typed error thrown by `Agent.run()` when a
|
|
3
|
+
* `messageMiddleware` returns `deny(reason)`.
|
|
4
|
+
*
|
|
5
|
+
* Pattern: Typed Error (the `PolicyHaltError` shape, for the same reason).
|
|
6
|
+
* Role: Surface layer for the message boundary. The stage writes the
|
|
7
|
+
* refusal to scope; `Agent.finalizeResult` translates it here, so
|
|
8
|
+
* a caller can `instanceof` it and route on `.phase` / `.middleware`.
|
|
9
|
+
* Emits: N/A — `agentfootprint.middleware.decision` fires from the stage
|
|
10
|
+
* at the moment the refusal is decided.
|
|
11
|
+
*
|
|
12
|
+
* ## Why a refusal is not returned as an answer
|
|
13
|
+
*
|
|
14
|
+
* At the `'input'` phase there is no model to tell: the message never
|
|
15
|
+
* reached one, so there is nothing in the run for a denial to become. At
|
|
16
|
+
* the `'output'` phase there IS an answer, and the middleware has just
|
|
17
|
+
* refused to release it — handing the caller a string in its place is the
|
|
18
|
+
* one substitution a caller must never be able to make silently. Both
|
|
19
|
+
* phases therefore raise, exactly the way a policy halt does.
|
|
20
|
+
*
|
|
21
|
+
* ## What it deliberately does not carry
|
|
22
|
+
*
|
|
23
|
+
* Never the refused content. A middleware that suppressed an answer would
|
|
24
|
+
* be undone by an error object that carried the answer out anyway. The
|
|
25
|
+
* content stays where the run put it — in the commit log, under whatever
|
|
26
|
+
* redaction the run configured.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* try {
|
|
30
|
+
* await agent.run({ message: userText });
|
|
31
|
+
* } catch (e) {
|
|
32
|
+
* if (e instanceof MessageDeniedError) {
|
|
33
|
+
* console.log(`${e.middleware} refused this ${e.phase}: ${e.reason}`);
|
|
34
|
+
* } else throw e;
|
|
35
|
+
* }
|
|
36
|
+
*/
|
|
37
|
+
export class MessageDeniedError extends Error {
|
|
38
|
+
code = 'ERR_MESSAGE_DENIED';
|
|
39
|
+
reason;
|
|
40
|
+
phase;
|
|
41
|
+
middleware;
|
|
42
|
+
constructor(ctx) {
|
|
43
|
+
super(`Message denied at '${ctx.phase}' by '${ctx.middleware}': ${ctx.reason}`);
|
|
44
|
+
this.name = 'MessageDeniedError';
|
|
45
|
+
this.reason = ctx.reason;
|
|
46
|
+
this.phase = ctx.phase;
|
|
47
|
+
this.middleware = ctx.middleware;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../../../src/core/agent/middleware/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAWH,MAAM,OAAO,kBAAmB,SAAQ,KAAK;IAClC,IAAI,GAAG,oBAA6B,CAAC;IACrC,MAAM,CAAS;IACf,KAAK,CAAqB;IAC1B,UAAU,CAAS;IAE5B,YAAY,GAAyB;QACnC,KAAK,CAAC,sBAAsB,GAAG,CAAC,KAAK,SAAS,GAAG,CAAC,UAAU,MAAM,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC;QAChF,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAC;QACjC,IAAI,CAAC,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC;QACzB,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC;QACvB,IAAI,CAAC,UAAU,GAAG,GAAG,CAAC,UAAU,CAAC;IACnC,CAAC;CACF"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* middleware — PUBLIC barrel. The governance chain family.
|
|
3
|
+
*
|
|
4
|
+
* Two chains, one vocabulary:
|
|
5
|
+
*
|
|
6
|
+
* `.toolMiddleware(...)` wraps every tool dispatch
|
|
7
|
+
* `.messageMiddleware(...)` wraps the message boundary — the input
|
|
8
|
+
* before the model sees it, the output before
|
|
9
|
+
* the caller receives it
|
|
10
|
+
*
|
|
11
|
+
* Three verbs: `allow`, `deny`, `ask`. There is no fourth, and in
|
|
12
|
+
* particular there is no way to return a result — see `types.ts`.
|
|
13
|
+
*/
|
|
14
|
+
export { allow, ask, deny } from './outcomes.js';
|
|
15
|
+
export { MessageDeniedError, type MessageDeniedContext } from './errors.js';
|
|
16
|
+
export type { AllowOutcome, AskOutcome, AskPayload, DenyOutcome, MessageMiddleware, MessageMiddlewareContext, MessageOutcome, MiddlewareDecision, ToolMiddleware, ToolMiddlewareContext, ToolOutcome, } from './types.js';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* middleware — PUBLIC barrel. The governance chain family.
|
|
3
|
+
*
|
|
4
|
+
* Two chains, one vocabulary:
|
|
5
|
+
*
|
|
6
|
+
* `.toolMiddleware(...)` wraps every tool dispatch
|
|
7
|
+
* `.messageMiddleware(...)` wraps the message boundary — the input
|
|
8
|
+
* before the model sees it, the output before
|
|
9
|
+
* the caller receives it
|
|
10
|
+
*
|
|
11
|
+
* Three verbs: `allow`, `deny`, `ask`. There is no fourth, and in
|
|
12
|
+
* particular there is no way to return a result — see `types.ts`.
|
|
13
|
+
*/
|
|
14
|
+
export { allow, ask, deny } from './outcomes.js';
|
|
15
|
+
export { MessageDeniedError } from './errors.js';
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/core/agent/middleware/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,kBAAkB,EAA6B,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* middleware/ledger — INTERNAL. Where a chain's decisions become record.
|
|
3
|
+
*
|
|
4
|
+
* Pattern: one writer for one committed key.
|
|
5
|
+
* Role: core/ layer. `runChain` decides; this file is the only thing
|
|
6
|
+
* that commits what it decided and emits the matching event, so
|
|
7
|
+
* the three call sites cannot record the same fact three
|
|
8
|
+
* different ways.
|
|
9
|
+
* Emits: `agentfootprint.middleware.decision`, one per row.
|
|
10
|
+
*
|
|
11
|
+
* ## Why the original value is committed too
|
|
12
|
+
*
|
|
13
|
+
* A transform makes the trace and the wire disagree — the model saw one
|
|
14
|
+
* string, the run remembers another. Committing the pair, with the
|
|
15
|
+
* middleware's name and its `why` beside it, is what turns that
|
|
16
|
+
* disagreement from a lie into a record. Every slice taken afterwards can
|
|
17
|
+
* then find the moment the value changed and who changed it.
|
|
18
|
+
*
|
|
19
|
+
* This is not a redaction layer, and it is not trying to be one. For the
|
|
20
|
+
* `'input'` phase in particular, the ledger row is the ONLY copy of the
|
|
21
|
+
* pre-scrub text anywhere in the run — the seed stage commits the
|
|
22
|
+
* transformed message and nothing else ever holds the original. If your
|
|
23
|
+
* threat model says the original must not survive in the commit log,
|
|
24
|
+
* configure footprintjs redaction over this key; it scrubs `before` /
|
|
25
|
+
* `after` at write time and the row itself survives, so the run still says
|
|
26
|
+
* a scrub happened and who did it.
|
|
27
|
+
*/
|
|
28
|
+
import type { MiddlewareDecision } from './types.js';
|
|
29
|
+
/** The scope surface this file needs. Structurally a `TypedScope<AgentState>`. */
|
|
30
|
+
export interface LedgerScope {
|
|
31
|
+
middlewareDecisions?: readonly MiddlewareDecision[];
|
|
32
|
+
$emit(name: string, payload?: unknown): void;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Append decision rows to the run's ledger and emit one event per row.
|
|
36
|
+
*
|
|
37
|
+
* No-op on an empty list, so an agent with no middleware never writes the
|
|
38
|
+
* key at all and its commit log is the one it always had.
|
|
39
|
+
*/
|
|
40
|
+
export declare function recordDecisions(scope: LedgerScope, rows: readonly MiddlewareDecision[]): void;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* middleware/ledger — INTERNAL. Where a chain's decisions become record.
|
|
3
|
+
*
|
|
4
|
+
* Pattern: one writer for one committed key.
|
|
5
|
+
* Role: core/ layer. `runChain` decides; this file is the only thing
|
|
6
|
+
* that commits what it decided and emits the matching event, so
|
|
7
|
+
* the three call sites cannot record the same fact three
|
|
8
|
+
* different ways.
|
|
9
|
+
* Emits: `agentfootprint.middleware.decision`, one per row.
|
|
10
|
+
*
|
|
11
|
+
* ## Why the original value is committed too
|
|
12
|
+
*
|
|
13
|
+
* A transform makes the trace and the wire disagree — the model saw one
|
|
14
|
+
* string, the run remembers another. Committing the pair, with the
|
|
15
|
+
* middleware's name and its `why` beside it, is what turns that
|
|
16
|
+
* disagreement from a lie into a record. Every slice taken afterwards can
|
|
17
|
+
* then find the moment the value changed and who changed it.
|
|
18
|
+
*
|
|
19
|
+
* This is not a redaction layer, and it is not trying to be one. For the
|
|
20
|
+
* `'input'` phase in particular, the ledger row is the ONLY copy of the
|
|
21
|
+
* pre-scrub text anywhere in the run — the seed stage commits the
|
|
22
|
+
* transformed message and nothing else ever holds the original. If your
|
|
23
|
+
* threat model says the original must not survive in the commit log,
|
|
24
|
+
* configure footprintjs redaction over this key; it scrubs `before` /
|
|
25
|
+
* `after` at write time and the row itself survives, so the run still says
|
|
26
|
+
* a scrub happened and who did it.
|
|
27
|
+
*/
|
|
28
|
+
import { typedEmit } from '../../../recorders/core/typedEmit.js';
|
|
29
|
+
/**
|
|
30
|
+
* Append decision rows to the run's ledger and emit one event per row.
|
|
31
|
+
*
|
|
32
|
+
* No-op on an empty list, so an agent with no middleware never writes the
|
|
33
|
+
* key at all and its commit log is the one it always had.
|
|
34
|
+
*/
|
|
35
|
+
export function recordDecisions(scope, rows) {
|
|
36
|
+
if (rows.length === 0)
|
|
37
|
+
return;
|
|
38
|
+
const prev = scope.middlewareDecisions ?? [];
|
|
39
|
+
// Spread into a plain local array first: a TypedScope array read is a live
|
|
40
|
+
// deep-proxy view, and both the commit and the event payloads below must be
|
|
41
|
+
// detached plain data (RFC-001 'clone' capture under deferred delivery).
|
|
42
|
+
scope.middlewareDecisions = [...prev, ...rows];
|
|
43
|
+
for (const row of rows) {
|
|
44
|
+
typedEmit(scope, 'agentfootprint.middleware.decision', {
|
|
45
|
+
middleware: row.middleware,
|
|
46
|
+
at: row.at,
|
|
47
|
+
...(row.phase !== undefined && { phase: row.phase }),
|
|
48
|
+
...(row.toolName !== undefined && { toolName: row.toolName }),
|
|
49
|
+
...(row.toolCallId !== undefined && { toolCallId: row.toolCallId }),
|
|
50
|
+
iteration: row.iteration,
|
|
51
|
+
outcome: row.outcome,
|
|
52
|
+
changed: row.changed,
|
|
53
|
+
...(row.why !== undefined && { why: row.why }),
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=ledger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ledger.js","sourceRoot":"","sources":["../../../../../src/core/agent/middleware/ledger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AASjE;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAC,KAAkB,EAAE,IAAmC;IACrF,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO;IAC9B,MAAM,IAAI,GAAI,KAAK,CAAC,mBAAiE,IAAI,EAAE,CAAC;IAC5F,2EAA2E;IAC3E,4EAA4E;IAC5E,yEAAyE;IACzE,KAAK,CAAC,mBAAmB,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,IAAI,CAAC,CAAC;IAC/C,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,SAAS,CAAC,KAAK,EAAE,oCAAoC,EAAE;YACrD,UAAU,EAAE,GAAG,CAAC,UAAU;YAC1B,EAAE,EAAE,GAAG,CAAC,EAAE;YACV,GAAG,CAAC,GAAG,CAAC,KAAK,KAAK,SAAS,IAAI,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,EAAE,CAAC;YACpD,GAAG,CAAC,GAAG,CAAC,QAAQ,KAAK,SAAS,IAAI,EAAE,QAAQ,EAAE,GAAG,CAAC,QAAQ,EAAE,CAAC;YAC7D,GAAG,CAAC,GAAG,CAAC,UAAU,KAAK,SAAS,IAAI,EAAE,UAAU,EAAE,GAAG,CAAC,UAAU,EAAE,CAAC;YACnE,SAAS,EAAE,GAAG,CAAC,SAAS;YACxB,OAAO,EAAE,GAAG,CAAC,OAAO;YACpB,OAAO,EAAE,GAAG,CAAC,OAAO;YACpB,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,SAAS,IAAI,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,EAAE,CAAC;SAC/C,CAAC,CAAC;IACL,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* middleware/outcomes — PUBLIC. The three verbs a middleware speaks.
|
|
3
|
+
*
|
|
4
|
+
* Pattern: Smart constructors over a closed union.
|
|
5
|
+
* Role: core/ layer. `allow` / `deny` / `ask` are the entire vocabulary
|
|
6
|
+
* of both chains, which is why they are short: they are written
|
|
7
|
+
* inside every middleware body, several times, and a governance
|
|
8
|
+
* rule reads better as `deny('writes to prod need a ticket')` than
|
|
9
|
+
* as a namespaced ceremony.
|
|
10
|
+
* Emits: N/A.
|
|
11
|
+
*
|
|
12
|
+
* The `allow` overloads carry a rule: you can pass the value through
|
|
13
|
+
* untouched with no explanation, but you cannot CHANGE it without one. A
|
|
14
|
+
* transform is the only thing here that makes the trace and the wire
|
|
15
|
+
* disagree, so it is the only thing required to say why.
|
|
16
|
+
*/
|
|
17
|
+
import type { AllowOutcome, AskOutcome, AskPayload, DenyOutcome } from './types.js';
|
|
18
|
+
/** Pass the value through untouched. */
|
|
19
|
+
export declare function allow(): AllowOutcome<never>;
|
|
20
|
+
/**
|
|
21
|
+
* Replace the value and say why.
|
|
22
|
+
*
|
|
23
|
+
* The `why` is mandatory and lands in the ledger next to the before/after
|
|
24
|
+
* pair, so a run that was scrubbed can be read back as a run that was
|
|
25
|
+
* scrubbed rather than as a run whose input was always that way.
|
|
26
|
+
*/
|
|
27
|
+
export declare function allow<T>(value: T, why: string): AllowOutcome<T>;
|
|
28
|
+
/**
|
|
29
|
+
* Refuse the call.
|
|
30
|
+
*
|
|
31
|
+
* For a tool the reason reaches the model verbatim, as the tool's result,
|
|
32
|
+
* and the loop continues — the agent gets to adapt. For a message it
|
|
33
|
+
* surfaces as a `MessageDeniedError`.
|
|
34
|
+
*/
|
|
35
|
+
export declare function deny(reason: string): DenyOutcome;
|
|
36
|
+
/**
|
|
37
|
+
* Suspend the run and put the question to a person. Tool dispatch only —
|
|
38
|
+
* `MessageOutcome` has no `ask` arm, so this cannot be returned from a
|
|
39
|
+
* message middleware.
|
|
40
|
+
*
|
|
41
|
+
* The answer is a decision, not a result: approve and the chain continues
|
|
42
|
+
* and the REAL tool runs; decline and it becomes a denial the model reads.
|
|
43
|
+
* A middleware never gets to write the answer itself.
|
|
44
|
+
*/
|
|
45
|
+
export declare function ask(payload: AskPayload): AskOutcome;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* middleware/outcomes — PUBLIC. The three verbs a middleware speaks.
|
|
3
|
+
*
|
|
4
|
+
* Pattern: Smart constructors over a closed union.
|
|
5
|
+
* Role: core/ layer. `allow` / `deny` / `ask` are the entire vocabulary
|
|
6
|
+
* of both chains, which is why they are short: they are written
|
|
7
|
+
* inside every middleware body, several times, and a governance
|
|
8
|
+
* rule reads better as `deny('writes to prod need a ticket')` than
|
|
9
|
+
* as a namespaced ceremony.
|
|
10
|
+
* Emits: N/A.
|
|
11
|
+
*
|
|
12
|
+
* The `allow` overloads carry a rule: you can pass the value through
|
|
13
|
+
* untouched with no explanation, but you cannot CHANGE it without one. A
|
|
14
|
+
* transform is the only thing here that makes the trace and the wire
|
|
15
|
+
* disagree, so it is the only thing required to say why.
|
|
16
|
+
*/
|
|
17
|
+
export function allow(value, why) {
|
|
18
|
+
if (value === undefined)
|
|
19
|
+
return { kind: 'allow' };
|
|
20
|
+
if (typeof why !== 'string' || why.length === 0) {
|
|
21
|
+
throw new Error('allow(value, why): a transform must say why. Pass a short reason — it is what the ' +
|
|
22
|
+
'ledger shows next to the before/after pair. To pass the value through unchanged, ' +
|
|
23
|
+
'call allow() with no arguments.');
|
|
24
|
+
}
|
|
25
|
+
return { kind: 'allow', value, why };
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Refuse the call.
|
|
29
|
+
*
|
|
30
|
+
* For a tool the reason reaches the model verbatim, as the tool's result,
|
|
31
|
+
* and the loop continues — the agent gets to adapt. For a message it
|
|
32
|
+
* surfaces as a `MessageDeniedError`.
|
|
33
|
+
*/
|
|
34
|
+
export function deny(reason) {
|
|
35
|
+
if (typeof reason !== 'string' || reason.length === 0) {
|
|
36
|
+
throw new Error('deny(reason): a refusal must carry a reason. For a tool it is the text the model ' +
|
|
37
|
+
'reads and adapts to, so write it for the model, not for a log line.');
|
|
38
|
+
}
|
|
39
|
+
return { kind: 'deny', reason };
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Suspend the run and put the question to a person. Tool dispatch only —
|
|
43
|
+
* `MessageOutcome` has no `ask` arm, so this cannot be returned from a
|
|
44
|
+
* message middleware.
|
|
45
|
+
*
|
|
46
|
+
* The answer is a decision, not a result: approve and the chain continues
|
|
47
|
+
* and the REAL tool runs; decline and it becomes a denial the model reads.
|
|
48
|
+
* A middleware never gets to write the answer itself.
|
|
49
|
+
*/
|
|
50
|
+
export function ask(payload) {
|
|
51
|
+
if (payload === null ||
|
|
52
|
+
typeof payload !== 'object' ||
|
|
53
|
+
typeof payload.question !== 'string' ||
|
|
54
|
+
payload.question.length === 0) {
|
|
55
|
+
throw new Error('ask(payload): expected { question, detail? } with a non-empty question. The question ' +
|
|
56
|
+
'is what a person is shown when the run pauses.');
|
|
57
|
+
}
|
|
58
|
+
return { kind: 'ask', payload };
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=outcomes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"outcomes.js","sourceRoot":"","sources":["../../../../../src/core/agent/middleware/outcomes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAcH,MAAM,UAAU,KAAK,CAAI,KAAS,EAAE,GAAY;IAC9C,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;IAClD,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAChD,MAAM,IAAI,KAAK,CACb,oFAAoF;YAClF,mFAAmF;YACnF,iCAAiC,CACpC,CAAC;IACJ,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC;AACvC,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,IAAI,CAAC,MAAc;IACjC,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACtD,MAAM,IAAI,KAAK,CACb,mFAAmF;YACjF,qEAAqE,CACxE,CAAC;IACJ,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;AAClC,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,GAAG,CAAC,OAAmB;IACrC,IACE,OAAO,KAAK,IAAI;QAChB,OAAO,OAAO,KAAK,QAAQ;QAC3B,OAAO,OAAO,CAAC,QAAQ,KAAK,QAAQ;QACpC,OAAO,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,EAC7B,CAAC;QACD,MAAM,IAAI,KAAK,CACb,uFAAuF;YACrF,gDAAgD,CACnD,CAAC;IACJ,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;AAClC,CAAC"}
|