agentfootprint 7.23.0 → 7.25.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.
Files changed (150) hide show
  1. package/README.md +34 -0
  2. package/dist/adapters/hosting/agentcore.js +112 -1
  3. package/dist/adapters/hosting/agentcore.js.map +1 -1
  4. package/dist/core/agent/AgentBuilder.js +117 -1
  5. package/dist/core/agent/AgentBuilder.js.map +1 -1
  6. package/dist/core/agent/act.js +143 -0
  7. package/dist/core/agent/act.js.map +1 -0
  8. package/dist/core/agent/middleware/index.js +5 -0
  9. package/dist/core/agent/middleware/index.js.map +1 -1
  10. package/dist/core/agent/middleware/ledger.js +7 -0
  11. package/dist/core/agent/middleware/ledger.js.map +1 -1
  12. package/dist/core/agent/middleware/outcomes.js +9 -2
  13. package/dist/core/agent/middleware/outcomes.js.map +1 -1
  14. package/dist/core/agent/middleware/runChain.js +97 -3
  15. package/dist/core/agent/middleware/runChain.js.map +1 -1
  16. package/dist/core/agent/middleware/types.js +30 -0
  17. package/dist/core/agent/middleware/types.js.map +1 -1
  18. package/dist/core/agent/moments.js +53 -0
  19. package/dist/core/agent/moments.js.map +1 -0
  20. package/dist/core/agent/stages/toolCalls.js +130 -7
  21. package/dist/core/agent/stages/toolCalls.js.map +1 -1
  22. package/dist/esm/adapters/hosting/agentcore.d.ts +50 -1
  23. package/dist/esm/adapters/hosting/agentcore.js +110 -0
  24. package/dist/esm/adapters/hosting/agentcore.js.map +1 -1
  25. package/dist/esm/core/agent/AgentBuilder.d.ts +71 -0
  26. package/dist/esm/core/agent/AgentBuilder.js +117 -1
  27. package/dist/esm/core/agent/AgentBuilder.js.map +1 -1
  28. package/dist/esm/core/agent/act.d.ts +69 -0
  29. package/dist/esm/core/agent/act.js +139 -0
  30. package/dist/esm/core/agent/act.js.map +1 -0
  31. package/dist/esm/core/agent/middleware/index.d.ts +6 -1
  32. package/dist/esm/core/agent/middleware/index.js +5 -0
  33. package/dist/esm/core/agent/middleware/index.js.map +1 -1
  34. package/dist/esm/core/agent/middleware/ledger.d.ts +6 -0
  35. package/dist/esm/core/agent/middleware/ledger.js +7 -0
  36. package/dist/esm/core/agent/middleware/ledger.js.map +1 -1
  37. package/dist/esm/core/agent/middleware/outcomes.d.ts +15 -0
  38. package/dist/esm/core/agent/middleware/outcomes.js +9 -2
  39. package/dist/esm/core/agent/middleware/outcomes.js.map +1 -1
  40. package/dist/esm/core/agent/middleware/runChain.d.ts +47 -0
  41. package/dist/esm/core/agent/middleware/runChain.js +95 -2
  42. package/dist/esm/core/agent/middleware/runChain.js.map +1 -1
  43. package/dist/esm/core/agent/middleware/types.d.ts +132 -10
  44. package/dist/esm/core/agent/middleware/types.js +30 -0
  45. package/dist/esm/core/agent/middleware/types.js.map +1 -1
  46. package/dist/esm/core/agent/moments.d.ts +55 -0
  47. package/dist/esm/core/agent/moments.js +49 -0
  48. package/dist/esm/core/agent/moments.js.map +1 -0
  49. package/dist/esm/core/agent/stages/toolCalls.d.ts +6 -1
  50. package/dist/esm/core/agent/stages/toolCalls.js +131 -8
  51. package/dist/esm/core/agent/stages/toolCalls.js.map +1 -1
  52. package/dist/esm/events/payloads.d.ts +4 -0
  53. package/dist/esm/hosting/errors.d.ts +44 -2
  54. package/dist/esm/hosting/errors.js +63 -0
  55. package/dist/esm/hosting/errors.js.map +1 -1
  56. package/dist/esm/hosting/headers.d.ts +16 -0
  57. package/dist/esm/hosting/headers.js +24 -0
  58. package/dist/esm/hosting/headers.js.map +1 -0
  59. package/dist/esm/hosting/httpHost.d.ts +70 -4
  60. package/dist/esm/hosting/httpHost.js +211 -47
  61. package/dist/esm/hosting/httpHost.js.map +1 -1
  62. package/dist/esm/hosting/index.d.ts +23 -8
  63. package/dist/esm/hosting/index.js +21 -6
  64. package/dist/esm/hosting/index.js.map +1 -1
  65. package/dist/esm/hosting/nodeHost.d.ts +23 -0
  66. package/dist/esm/hosting/nodeHost.js +21 -1
  67. package/dist/esm/hosting/nodeHost.js.map +1 -1
  68. package/dist/esm/hosting/types.d.ts +212 -6
  69. package/dist/esm/hosting/types.js +7 -5
  70. package/dist/esm/hosting/types.js.map +1 -1
  71. package/dist/esm/hosting/webSocketConversation.d.ts +101 -0
  72. package/dist/esm/hosting/webSocketConversation.js +341 -0
  73. package/dist/esm/hosting/webSocketConversation.js.map +1 -0
  74. package/dist/esm/hosting/webSocketFrames.d.ts +164 -0
  75. package/dist/esm/hosting/webSocketFrames.js +284 -0
  76. package/dist/esm/hosting/webSocketFrames.js.map +1 -0
  77. package/dist/esm/hosting-providers.d.ts +7 -2
  78. package/dist/esm/hosting-providers.js +7 -2
  79. package/dist/esm/hosting-providers.js.map +1 -1
  80. package/dist/esm/index.d.ts +3 -1
  81. package/dist/esm/index.js +7 -0
  82. package/dist/esm/index.js.map +1 -1
  83. package/dist/esm/lib/mcp/mcpServe.js +25 -1
  84. package/dist/esm/lib/mcp/mcpServe.js.map +1 -1
  85. package/dist/hosting/errors.js +66 -1
  86. package/dist/hosting/errors.js.map +1 -1
  87. package/dist/hosting/headers.js +28 -0
  88. package/dist/hosting/headers.js.map +1 -0
  89. package/dist/hosting/httpHost.js +211 -47
  90. package/dist/hosting/httpHost.js.map +1 -1
  91. package/dist/hosting/index.js +23 -6
  92. package/dist/hosting/index.js.map +1 -1
  93. package/dist/hosting/nodeHost.js +20 -0
  94. package/dist/hosting/nodeHost.js.map +1 -1
  95. package/dist/hosting/types.js +7 -5
  96. package/dist/hosting/types.js.map +1 -1
  97. package/dist/hosting/webSocketConversation.js +345 -0
  98. package/dist/hosting/webSocketConversation.js.map +1 -0
  99. package/dist/hosting/webSocketFrames.js +297 -0
  100. package/dist/hosting/webSocketFrames.js.map +1 -0
  101. package/dist/hosting-providers.js +8 -2
  102. package/dist/hosting-providers.js.map +1 -1
  103. package/dist/index.js +12 -2
  104. package/dist/index.js.map +1 -1
  105. package/dist/lib/mcp/mcpServe.js +24 -0
  106. package/dist/lib/mcp/mcpServe.js.map +1 -1
  107. package/dist/types/adapters/hosting/agentcore.d.ts +50 -1
  108. package/dist/types/adapters/hosting/agentcore.d.ts.map +1 -1
  109. package/dist/types/core/agent/AgentBuilder.d.ts +71 -0
  110. package/dist/types/core/agent/AgentBuilder.d.ts.map +1 -1
  111. package/dist/types/core/agent/act.d.ts +70 -0
  112. package/dist/types/core/agent/act.d.ts.map +1 -0
  113. package/dist/types/core/agent/middleware/index.d.ts +6 -1
  114. package/dist/types/core/agent/middleware/index.d.ts.map +1 -1
  115. package/dist/types/core/agent/middleware/ledger.d.ts +6 -0
  116. package/dist/types/core/agent/middleware/ledger.d.ts.map +1 -1
  117. package/dist/types/core/agent/middleware/outcomes.d.ts +15 -0
  118. package/dist/types/core/agent/middleware/outcomes.d.ts.map +1 -1
  119. package/dist/types/core/agent/middleware/runChain.d.ts +47 -0
  120. package/dist/types/core/agent/middleware/runChain.d.ts.map +1 -1
  121. package/dist/types/core/agent/middleware/types.d.ts +132 -10
  122. package/dist/types/core/agent/middleware/types.d.ts.map +1 -1
  123. package/dist/types/core/agent/moments.d.ts +56 -0
  124. package/dist/types/core/agent/moments.d.ts.map +1 -0
  125. package/dist/types/core/agent/stages/toolCalls.d.ts +6 -1
  126. package/dist/types/core/agent/stages/toolCalls.d.ts.map +1 -1
  127. package/dist/types/events/payloads.d.ts +4 -0
  128. package/dist/types/events/payloads.d.ts.map +1 -1
  129. package/dist/types/hosting/errors.d.ts +44 -2
  130. package/dist/types/hosting/errors.d.ts.map +1 -1
  131. package/dist/types/hosting/headers.d.ts +17 -0
  132. package/dist/types/hosting/headers.d.ts.map +1 -0
  133. package/dist/types/hosting/httpHost.d.ts +70 -4
  134. package/dist/types/hosting/httpHost.d.ts.map +1 -1
  135. package/dist/types/hosting/index.d.ts +23 -8
  136. package/dist/types/hosting/index.d.ts.map +1 -1
  137. package/dist/types/hosting/nodeHost.d.ts +23 -0
  138. package/dist/types/hosting/nodeHost.d.ts.map +1 -1
  139. package/dist/types/hosting/types.d.ts +212 -6
  140. package/dist/types/hosting/types.d.ts.map +1 -1
  141. package/dist/types/hosting/webSocketConversation.d.ts +102 -0
  142. package/dist/types/hosting/webSocketConversation.d.ts.map +1 -0
  143. package/dist/types/hosting/webSocketFrames.d.ts +165 -0
  144. package/dist/types/hosting/webSocketFrames.d.ts.map +1 -0
  145. package/dist/types/hosting-providers.d.ts +7 -2
  146. package/dist/types/hosting-providers.d.ts.map +1 -1
  147. package/dist/types/index.d.ts +3 -1
  148. package/dist/types/index.d.ts.map +1 -1
  149. package/dist/types/lib/mcp/mcpServe.d.ts.map +1 -1
  150. package/package.json +1 -1
@@ -14,6 +14,7 @@ import { defaultCommentaryTemplates } from '../../recorders/observability/commen
14
14
  import { defaultStatusTemplates } from '../../recorders/observability/status/statusTemplates.js';
15
15
  import { buildSelfExplainSkill, buildSelfExplainToolProvider, SelfExplainBinding, } from '../../lib/trace-toolpack/selfExplain.js';
16
16
  import { Agent } from '../Agent.js';
17
+ import { resolveAct } from './act.js';
17
18
  import { resolveCompactionOptions } from './window/options.js';
18
19
  import { summarizeOldest } from './window/strategies/summarizeOldest.js';
19
20
  /**
@@ -133,6 +134,8 @@ export class AgentBuilder {
133
134
  toolMiddlewareList = [];
134
135
  /** The message chain, in call order. Empty = no chain, no ledger. */
135
136
  messageMiddlewareList = [];
137
+ /** `.act()` is the posture block: one per agent. See the method. */
138
+ actCalled = false;
136
139
  constructor(opts) {
137
140
  this.opts = opts;
138
141
  // Cache layer: opts.caching === 'off' propagates to scope's
@@ -280,6 +283,81 @@ export class AgentBuilder {
280
283
  this.runConfigFn = fn;
281
284
  return this;
282
285
  }
286
+ /**
287
+ * Everything this agent DOES about its own loop, in one block.
288
+ *
289
+ * Tools do the work. `.act()` decides about the work. `watch` remembers
290
+ * both — and nothing can act without being watched.
291
+ *
292
+ * Five keys, one per moment of a turn, each optional and each the exact
293
+ * argument the individual door takes:
294
+ *
295
+ * ```ts
296
+ * const agent = Agent.create({ provider, model })
297
+ * .act({
298
+ * input: [scrubSSNs], // the message, before the run commits it
299
+ * beforeTool: [refundCeiling], // every call, before it is dispatched
300
+ * afterTool: [hideRawPII], // every result, before the model reads it
301
+ * window: slidingWindow({ keepRecentTurns: 12 }),
302
+ * output: [noInternalCodenames],
303
+ * })
304
+ * .build();
305
+ * ```
306
+ *
307
+ * **It is sugar, and provably so.** Each key is forwarded to the door that
308
+ * already owned it — `.messageMiddleware()`, `.toolMiddleware()`,
309
+ * `.window()` — so the agent it builds sends the same request bytes and
310
+ * files the same records as the same rules spelled out one call at a time.
311
+ * That equivalence is pinned per key by tests, the way `.compaction()`'s is.
312
+ *
313
+ * **The keys cannot fall behind the loop.** They are locked at compile time
314
+ * against `LoopMoment`, so a sixth moment cannot ship without a key here.
315
+ *
316
+ * **A rule speaks where its hooks say, not where you filed it.** `beforeTool`
317
+ * and `afterTool` are one chain; an entry with both `onToolCall` and
318
+ * `onToolResult` runs at both moments whichever key you wrote it under —
319
+ * the KEYS are named for the moments, the HOOKS for what they receive — and
320
+ * an entry named
321
+ * under both keys is the same object attached once. A governance rule that
322
+ * silently did not run because it was written in the wrong bucket is exactly
323
+ * the failure this library exists to make impossible — so the bucket is
324
+ * checked for the hook it names, and the hooks decide the rest.
325
+ *
326
+ * **Call it once.** A second `.act()` throws: two posture blocks means the
327
+ * answer to "what does this agent do at each moment?" is in two places, and
328
+ * the second one silently wins. Adding one piece to an agent somebody else
329
+ * built — a plugin, a policy pack — is what the individual doors are for,
330
+ * and they stay open for exactly that.
331
+ *
332
+ * @param options - One key per moment. `input` / `output` take message
333
+ * middleware, `beforeTool` / `afterTool` take tool middleware, `window`
334
+ * takes a `WindowStrategy`. Unknown keys throw.
335
+ */
336
+ act(options) {
337
+ if (this.actCalled) {
338
+ throw new Error('AgentBuilder.act: already called. One posture block per agent — a second would put ' +
339
+ 'the answer to "what does this agent do at each moment of its loop?" in two places, ' +
340
+ 'with the later one silently winning. To ADD one rule to an agent that already has ' +
341
+ 'a posture, use the individual door for that moment (.toolMiddleware(), ' +
342
+ '.messageMiddleware(), .window()); they compose incrementally by design.');
343
+ }
344
+ // Resolved BEFORE anything is attached: a bundle with a bad key must
345
+ // leave the builder exactly as it found it, not half-configured. Every
346
+ // entry is validated inside `resolveAct`, and the window — the one key
347
+ // whose validation lives on its own door — goes first for the same
348
+ // reason.
349
+ const resolved = resolveAct(options);
350
+ if (resolved.window !== undefined) {
351
+ this.assertNoWindowStrategy('act');
352
+ this.window(resolved.window);
353
+ }
354
+ this.actCalled = true;
355
+ if (resolved.message.length > 0)
356
+ this.messageMiddleware(...resolved.message);
357
+ if (resolved.tool.length > 0)
358
+ this.toolMiddleware(...resolved.tool);
359
+ return this;
360
+ }
283
361
  /**
284
362
  * Choose how the live context window is kept inside its budget.
285
363
  *
@@ -398,6 +476,12 @@ export class AgentBuilder {
398
476
  const existing = this.windowStrategyValue;
399
477
  if (existing === undefined)
400
478
  return;
479
+ if (door === 'act') {
480
+ throw new Error(`AgentBuilder.act: this agent already has a window strategy ('${existing.name}'), set ` +
481
+ 'by .window() or .compaction(). One window strategy per agent, whichever door set ' +
482
+ 'it — a second would silently override the first, and a window policy that quietly ' +
483
+ 'changed is a policy you cannot audit. Move it into the `window` key, or drop the key.');
484
+ }
401
485
  if (door === 'compaction') {
402
486
  throw new Error('AgentBuilder.compaction: already set. One compaction policy per agent — a second ' +
403
487
  'one would silently override the first, and a budget that quietly changed is a ' +
@@ -968,6 +1052,16 @@ export class AgentBuilder {
968
1052
  * middleware that throws is a denial carrying the error as its reason —
969
1053
  * never a silent pass.
970
1054
  *
1055
+ * A link may also carry an **`onToolResult`** hook, which decides about the
1056
+ * RESULT once the tool has run and before the model reads it — `allow()`,
1057
+ * `allow(value, why)` or `deny(reason)`, and no `ask`, because the tool has
1058
+ * already run and there is nothing left for a person to prevent. That half
1059
+ * of the chain is walked BACKWARDS, so the first-declared rule has the first
1060
+ * word about the call and the last word about the answer. A link with only
1061
+ * `onToolResult` takes no part in dispatch at all.
1062
+ *
1063
+ * `.act({ beforeTool, afterTool })` is the same chain, named by moment.
1064
+ *
971
1065
  * An existing `PermissionChecker` still decides FIRST: it is not part of
972
1066
  * this chain, it runs ahead of it, so a call it denies never reaches a
973
1067
  * middleware. `gatedTools` is a different layer again — it decides which
@@ -991,10 +1085,32 @@ export class AgentBuilder {
991
1085
  */
992
1086
  toolMiddleware(...middleware) {
993
1087
  for (const mw of middleware)
994
- this.assertMiddleware(mw, 'toolMiddleware', 'onToolCall');
1088
+ this.assertToolMiddleware(mw);
995
1089
  this.toolMiddlewareList = [...this.toolMiddlewareList, ...middleware];
996
1090
  return this;
997
1091
  }
1092
+ /**
1093
+ * A tool link needs a name and at least one hook. Both are optional
1094
+ * INDIVIDUALLY — a rule about calls, a rule about results, or both — but a
1095
+ * link with neither is a governance rule that can never run, and finding
1096
+ * that out from a quiet run rather than from `build()` is the whole disease.
1097
+ */
1098
+ assertToolMiddleware(mw) {
1099
+ const shaped = mw !== null &&
1100
+ typeof mw === 'object' &&
1101
+ typeof mw.name === 'string' &&
1102
+ mw.name.length > 0;
1103
+ const record = mw;
1104
+ const hooks = shaped &&
1105
+ (typeof record?.onToolCall === 'function' || typeof record?.onToolResult === 'function');
1106
+ if (!hooks) {
1107
+ throw new Error(`AgentBuilder.toolMiddleware: expected an object with a non-empty \`name\` and at ` +
1108
+ `least one of \`onToolCall(call)\` (decides about the call) or ` +
1109
+ `\`onToolResult(call)\` ` +
1110
+ `(decides about the result), got ${typeof mw}. The name is what every ledger row ` +
1111
+ `and event says decided the call, so it cannot be blank.`);
1112
+ }
1113
+ }
998
1114
  /**
999
1115
  * Wrap the message boundary in a governance chain — the input before the
1000
1116
  * model sees it, the output before the caller receives it.
@@ -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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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"}
@@ -0,0 +1,69 @@
1
+ /**
2
+ * act — PUBLIC. One bundle for every place a rule may speak.
3
+ *
4
+ * Pattern: Facade over five doors, with the facade's KEYS type-locked to the
5
+ * list of moments they cover.
6
+ * Role: core/ layer. `.act()` builds nothing new: it validates a bundle
7
+ * and calls `.messageMiddleware()`, `.toolMiddleware()` and
8
+ * `.window()` with exactly what a person would have passed by hand.
9
+ * Everything about a run is decided by those doors, here and there
10
+ * alike.
11
+ * Emits: N/A.
12
+ *
13
+ * ## Why a bundle at all, when the doors already exist
14
+ *
15
+ * Because the doors are findable one at a time and the POSTURE is not. An
16
+ * agent's governance currently reads as four unrelated calls scattered
17
+ * through a builder chain, and the question a reviewer actually has —
18
+ * "what does this agent do at each point in its loop?" — has no place to be
19
+ * answered. `.act({ … })` is that place: five optional keys, named for the
20
+ * five moments, so autocomplete on an empty object teaches the loop.
21
+ *
22
+ * ## The completeness lock
23
+ *
24
+ * The keys of {@link ActOptions} are pinned, at compile time, against
25
+ * `ActKey<LoopMoment>` — the moment list, camel-cased. Add a sixth moment to
26
+ * `LOOP_MOMENTS` and this file stops compiling until the bundle grows the key
27
+ * for it; delete a key and the same. A surface that claims to be complete has
28
+ * to be made unable to fall behind, or the claim is just a sentence in a doc.
29
+ *
30
+ * The runtime half is derived from the same list: the accepted key set is
31
+ * `LOOP_MOMENTS.map(actKeyFor)`, so a typo'd key is refused by a validator
32
+ * that cannot drift from the type it is validating.
33
+ */
34
+ import type { MessageMiddleware, ToolMiddleware } from './middleware/types.js';
35
+ import { type ActKey } from './moments.js';
36
+ import type { WindowStrategy } from './window/strategy.js';
37
+ /**
38
+ * The whole steering wheel: one key per moment of the loop, each optional.
39
+ *
40
+ * The declaration order below is the order the loop reaches them.
41
+ */
42
+ export interface ActOptions {
43
+ /** The user's message, before the run commits it. */
44
+ readonly input?: readonly MessageMiddleware[];
45
+ /** Every tool call, before it is dispatched. */
46
+ readonly beforeTool?: readonly ToolMiddleware[];
47
+ /** Every tool result, after the tool ran and before the model reads it. */
48
+ readonly afterTool?: readonly ToolMiddleware[];
49
+ /** What the live context window keeps, at each iteration boundary. */
50
+ readonly window?: WindowStrategy;
51
+ /** The final answer, before the caller receives it. */
52
+ readonly output?: readonly MessageMiddleware[];
53
+ }
54
+ /** The keys `.act()` accepts, derived from the moment list rather than typed. */
55
+ export declare const ACT_KEYS: readonly ActKey[];
56
+ /** What `.act()` hands to the five doors. */
57
+ export interface ResolvedAct {
58
+ readonly message: readonly MessageMiddleware[];
59
+ readonly tool: readonly ToolMiddleware[];
60
+ readonly window?: WindowStrategy;
61
+ }
62
+ /**
63
+ * Validate a bundle and turn it into the arguments the five doors take.
64
+ *
65
+ * Pure — it throws or it returns; it touches no builder state. `.act()` is
66
+ * the caller that hands the result to the doors, which is what makes the
67
+ * sugar provably the same agent.
68
+ */
69
+ export declare function resolveAct(options: ActOptions): ResolvedAct;
@@ -0,0 +1,139 @@
1
+ /**
2
+ * act — PUBLIC. One bundle for every place a rule may speak.
3
+ *
4
+ * Pattern: Facade over five doors, with the facade's KEYS type-locked to the
5
+ * list of moments they cover.
6
+ * Role: core/ layer. `.act()` builds nothing new: it validates a bundle
7
+ * and calls `.messageMiddleware()`, `.toolMiddleware()` and
8
+ * `.window()` with exactly what a person would have passed by hand.
9
+ * Everything about a run is decided by those doors, here and there
10
+ * alike.
11
+ * Emits: N/A.
12
+ *
13
+ * ## Why a bundle at all, when the doors already exist
14
+ *
15
+ * Because the doors are findable one at a time and the POSTURE is not. An
16
+ * agent's governance currently reads as four unrelated calls scattered
17
+ * through a builder chain, and the question a reviewer actually has —
18
+ * "what does this agent do at each point in its loop?" — has no place to be
19
+ * answered. `.act({ … })` is that place: five optional keys, named for the
20
+ * five moments, so autocomplete on an empty object teaches the loop.
21
+ *
22
+ * ## The completeness lock
23
+ *
24
+ * The keys of {@link ActOptions} are pinned, at compile time, against
25
+ * `ActKey<LoopMoment>` — the moment list, camel-cased. Add a sixth moment to
26
+ * `LOOP_MOMENTS` and this file stops compiling until the bundle grows the key
27
+ * for it; delete a key and the same. A surface that claims to be complete has
28
+ * to be made unable to fall behind, or the claim is just a sentence in a doc.
29
+ *
30
+ * The runtime half is derived from the same list: the accepted key set is
31
+ * `LOOP_MOMENTS.map(actKeyFor)`, so a typo'd key is refused by a validator
32
+ * that cannot drift from the type it is validating.
33
+ */
34
+ import { allow } from './middleware/outcomes.js';
35
+ import { actKeyFor, LOOP_MOMENTS } from './moments.js';
36
+ const _keysAreExactlyTheMoments = true;
37
+ void _keysAreExactlyTheMoments;
38
+ /** The keys `.act()` accepts, derived from the moment list rather than typed. */
39
+ export const ACT_KEYS = LOOP_MOMENTS.map(actKeyFor);
40
+ /**
41
+ * Restrict a message middleware to ONE phase.
42
+ *
43
+ * `.messageMiddleware()` attaches a link to both halves of the boundary and
44
+ * lets it read `msg.phase`; the bundle names the phases instead, so an entry
45
+ * written for one of them is wrapped in exactly the guard a person writes by
46
+ * hand today. The pass-through at the other phase is a real walk with a real
47
+ * row, because it is a real link in the chain — the same run, the same
48
+ * record, whichever spelling put it there.
49
+ */
50
+ function onlyAt(phase, mw) {
51
+ return {
52
+ name: mw.name,
53
+ onMessage: (msg) => (msg.phase === phase ? mw.onMessage(msg) : allow()),
54
+ };
55
+ }
56
+ function assertList(value, key) {
57
+ if (!Array.isArray(value)) {
58
+ throw new Error(`AgentBuilder.act: '${key}' expects an array of middleware, got ${typeof value}. ` +
59
+ `Wrap a single rule in an array — the bundle is a list per moment.`);
60
+ }
61
+ return value;
62
+ }
63
+ function assertNamedHook(mw, key, hook) {
64
+ if (mw === null ||
65
+ typeof mw !== 'object' ||
66
+ typeof mw.name !== 'string' ||
67
+ mw.name.length === 0 ||
68
+ typeof mw[hook] !== 'function') {
69
+ throw new Error(`AgentBuilder.act: every '${key}' entry needs a non-empty \`name\` and a \`${hook}(...)\` ` +
70
+ `method. The name is what every ledger row and event says decided the call, so it ` +
71
+ `cannot be blank` +
72
+ (hook === 'onToolCall'
73
+ ? `; a rule that only has \`onToolResult\` belongs under 'afterTool'.`
74
+ : hook === 'onToolResult'
75
+ ? `; a rule that only has \`onToolCall\` belongs under 'beforeTool'.`
76
+ : `.`));
77
+ }
78
+ }
79
+ /**
80
+ * Validate a bundle and turn it into the arguments the five doors take.
81
+ *
82
+ * Pure — it throws or it returns; it touches no builder state. `.act()` is
83
+ * the caller that hands the result to the doors, which is what makes the
84
+ * sugar provably the same agent.
85
+ */
86
+ export function resolveAct(options) {
87
+ if (options === null || typeof options !== 'object' || Array.isArray(options)) {
88
+ throw new Error(`AgentBuilder.act: expected an options object, got ${Array.isArray(options) ? 'an array' : typeof options}. The keys are ${ACT_KEYS.join(', ')}.`);
89
+ }
90
+ for (const key of Object.keys(options)) {
91
+ if (!ACT_KEYS.includes(key)) {
92
+ throw new Error(`AgentBuilder.act: unknown key '${key}'. The loop has ${LOOP_MOMENTS.length} moments and ` +
93
+ `this bundle has one key for each: ${ACT_KEYS.join(', ')}. A key nobody reads is a ` +
94
+ `governance rule that silently never runs, so it is refused here rather than ignored.`);
95
+ }
96
+ }
97
+ // ── The message halves ──────────────────────────────────────────────
98
+ // A link named at BOTH phases is attached once, unguarded — which is the
99
+ // plain `.messageMiddleware(mw)` spelling, and the one that files one row
100
+ // per phase instead of two.
101
+ const input = assertList(options.input ?? [], 'input');
102
+ const output = assertList(options.output ?? [], 'output');
103
+ for (const mw of input)
104
+ assertNamedHook(mw, 'input', 'onMessage');
105
+ for (const mw of output)
106
+ assertNamedHook(mw, 'output', 'onMessage');
107
+ const message = [];
108
+ for (const mw of input) {
109
+ message.push(output.includes(mw) ? mw : onlyAt('input', mw));
110
+ }
111
+ for (const mw of output) {
112
+ if (!input.includes(mw))
113
+ message.push(onlyAt('output', mw));
114
+ }
115
+ // ── The tool moments ────────────────────────────────────────────────
116
+ // One list, walked forwards for calls and backwards for results. The
117
+ // buckets are named for the MOMENTS (`afterTool` ⇄ `'after-tool'`); the
118
+ // hooks are named for what they RECEIVE (`onToolResult`). The bucket says
119
+ // where a rule is MEANT to speak and is checked for the hook it names; what
120
+ // it actually does is decided by the hooks it has, so a rule can never
121
+ // silently fail to run because it was written in the other bucket.
122
+ const beforeTool = assertList(options.beforeTool ?? [], 'beforeTool');
123
+ const afterTool = assertList(options.afterTool ?? [], 'afterTool');
124
+ for (const mw of beforeTool)
125
+ assertNamedHook(mw, 'beforeTool', 'onToolCall');
126
+ for (const mw of afterTool)
127
+ assertNamedHook(mw, 'afterTool', 'onToolResult');
128
+ const tool = [...beforeTool];
129
+ for (const mw of afterTool) {
130
+ if (!tool.includes(mw))
131
+ tool.push(mw);
132
+ }
133
+ return {
134
+ message,
135
+ tool,
136
+ ...(options.window !== undefined && { window: options.window }),
137
+ };
138
+ }
139
+ //# sourceMappingURL=act.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"act.js","sourceRoot":"","sources":["../../../../src/core/agent/act.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AAEjD,OAAO,EAAE,SAAS,EAAE,YAAY,EAAgC,MAAM,cAAc,CAAC;AA4BrF,MAAM,yBAAyB,GAA4D,IAAI,CAAC;AAChG,KAAK,yBAAyB,CAAC;AAE/B,iFAAiF;AACjF,MAAM,CAAC,MAAM,QAAQ,GAAsB,YAAY,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;AASvE;;;;;;;;;GASG;AACH,SAAS,MAAM,CAAC,KAAyB,EAAE,EAAqB;IAC9D,OAAO;QACL,IAAI,EAAE,EAAE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ACxB,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC;YAAE,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC;IAC9D,CAAC;IAED,uEAAuE;IACvE,qEAAqE;IACrE,wEAAwE;IACxE,0EAA0E;IAC1E,4EAA4E;IAC5E,uEAAuE;IACvE,mEAAmE;IACnE,MAAM,UAAU,GAAG,UAAU,CAC3B,OAAO,CAAC,UAAU,IAAI,EAAE,EACxB,YAAY,CACgB,CAAC;IAC/B,MAAM,SAAS,GAAG,UAAU,CAAC,OAAO,CAAC,SAAS,IAAI,EAAE,EAAE,WAAW,CAA8B,CAAC;IAChG,KAAK,MAAM,EAAE,IAAI,UAAU;QAAE,eAAe,CAAC,EAAE,EAAE,YAAY,EAAE,YAAY,CAAC,CAAC;IAC7E,KAAK,MAAM,EAAE,IAAI,SAAS;QAAE,eAAe,CAAC,EAAE,EAAE,WAAW,EAAE,cAAc,CAAC,CAAC;IAE7E,MAAM,IAAI,GAAqB,CAAC,GAAG,UAAU,CAAC,CAAC;IAC/C,KAAK,MAAM,EAAE,IAAI,SAAS,EAAE,CAAC;QAC3B,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;YAAE,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACxC,CAAC;IAED,OAAO;QACL,OAAO;QACP,IAAI;QACJ,GAAG,CAAC,OAAO,CAAC,MAAM,KAAK,SAAS,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC;KAChE,CAAC;AACJ,CAAC"}
@@ -10,7 +10,12 @@
10
10
  *
11
11
  * Three verbs: `allow`, `deny`, `ask`. There is no fourth, and in
12
12
  * particular there is no way to return a result — see `types.ts`.
13
+ *
14
+ * A tool link may speak twice: `onToolCall` about the call, `onToolResult`
15
+ * about the result. The chain is walked forwards for the first and backwards for the
16
+ * second, so the first-declared link has the first word going in and the last
17
+ * word coming out.
13
18
  */
14
19
  export { allow, ask, deny } from './outcomes.js';
15
20
  export { MessageDeniedError, type MessageDeniedContext } from './errors.js';
16
- export type { AllowOutcome, AskOutcome, AskPayload, DenyOutcome, MessageMiddleware, MessageMiddlewareContext, MessageOutcome, MiddlewareDecision, ToolMiddleware, ToolMiddlewareContext, ToolOutcome, } from './types.js';
21
+ export type { AllowOutcome, AskOutcome, AskPayload, DenyOutcome, MessageMiddleware, MessageMiddlewareContext, MessageOutcome, MiddlewareDecision, ToolCallMiddleware, ToolMiddleware, ToolMiddlewareContext, ToolOutcome, ToolResultContext, ToolResultMiddleware, ToolResultOutcome, } from './types.js';
@@ -10,6 +10,11 @@
10
10
  *
11
11
  * Three verbs: `allow`, `deny`, `ask`. There is no fourth, and in
12
12
  * particular there is no way to return a result — see `types.ts`.
13
+ *
14
+ * A tool link may speak twice: `onToolCall` about the call, `onToolResult`
15
+ * about the result. The chain is walked forwards for the first and backwards for the
16
+ * second, so the first-declared link has the first word going in and the last
17
+ * word coming out.
13
18
  */
14
19
  export { allow, ask, deny } from './outcomes.js';
15
20
  export { MessageDeniedError } from './errors.js';
@@ -1 +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"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/core/agent/middleware/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,kBAAkB,EAA6B,MAAM,aAAa,CAAC"}
@@ -16,6 +16,12 @@
16
16
  * disagreement from a lie into a record. Every slice taken afterwards can
17
17
  * then find the moment the value changed and who changed it.
18
18
  *
19
+ * The same reasoning covers the `'after-tool'` moment from the other side. A
20
+ * result the model was not allowed to read still HAPPENED — the tool ran, the
21
+ * side effect landed — so the refusal row carries the real result. A run that
22
+ * dropped it would record an agent that called a tool and got nothing back,
23
+ * which is not what occurred.
24
+ *
19
25
  * This is not a redaction layer, and it is not trying to be one. For the
20
26
  * `'input'` phase in particular, the ledger row is the ONLY copy of the
21
27
  * pre-scrub text anywhere in the run — the seed stage commits the
@@ -16,6 +16,12 @@
16
16
  * disagreement from a lie into a record. Every slice taken afterwards can
17
17
  * then find the moment the value changed and who changed it.
18
18
  *
19
+ * The same reasoning covers the `'after-tool'` moment from the other side. A
20
+ * result the model was not allowed to read still HAPPENED — the tool ran, the
21
+ * side effect landed — so the refusal row carries the real result. A run that
22
+ * dropped it would record an agent that called a tool and got nothing back,
23
+ * which is not what occurred.
24
+ *
19
25
  * This is not a redaction layer, and it is not trying to be one. For the
20
26
  * `'input'` phase in particular, the ledger row is the ONLY copy of the
21
27
  * pre-scrub text anywhere in the run — the seed stage commits the
@@ -43,6 +49,7 @@ export function recordDecisions(scope, rows) {
43
49
  for (const row of rows) {
44
50
  typedEmit(scope, 'agentfootprint.middleware.decision', {
45
51
  middleware: row.middleware,
52
+ moment: row.moment,
46
53
  at: row.at,
47
54
  ...(row.phase !== undefined && { phase: row.phase }),
48
55
  ...(row.toolName !== undefined && { toolName: row.toolName }),
@@ -1 +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,KAA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C,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,MAAM,EAAE,GAAG,CAAC,MAAM;YAClB,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"}
@@ -17,6 +17,15 @@
17
17
  import type { AllowOutcome, AskOutcome, AskPayload, DenyOutcome } from './types.js';
18
18
  /** Pass the value through untouched. */
19
19
  export declare function allow(): AllowOutcome<never>;
20
+ /**
21
+ * Pass the value through untouched, and say why you were comfortable.
22
+ *
23
+ * The row still reads `changed: false` — nothing moved — but it carries the
24
+ * reason, which is what a rule that remembers an earlier decision needs:
25
+ * "approved by dana@ops at 14:02" belongs in the record of the call it
26
+ * silently permitted, not only in the record of the call that asked.
27
+ */
28
+ export declare function allow(value: undefined, why: string): AllowOutcome<never>;
20
29
  /**
21
30
  * Replace the value and say why.
22
31
  *
@@ -31,6 +40,12 @@ export declare function allow<T>(value: T, why: string): AllowOutcome<T>;
31
40
  * For a tool the reason reaches the model verbatim, as the tool's result,
32
41
  * and the loop continues — the agent gets to adapt. For a message it
33
42
  * surfaces as a `MessageDeniedError`.
43
+ *
44
+ * At the after-tool moment it means "the model does not get to read this" — the
45
+ * tool has already run, so the refusal replaces what the model reads while
46
+ * the run keeps the real result in the ledger. Refusing there hides an answer
47
+ * from the model; it cannot un-happen a side effect, and it does not pretend
48
+ * to.
34
49
  */
35
50
  export declare function deny(reason: string): DenyOutcome;
36
51
  /**
@@ -15,8 +15,9 @@
15
15
  * disagree, so it is the only thing required to say why.
16
16
  */
17
17
  export function allow(value, why) {
18
- if (value === undefined)
19
- return { kind: 'allow' };
18
+ if (value === undefined) {
19
+ return typeof why === 'string' && why.length > 0 ? { kind: 'allow', why } : { kind: 'allow' };
20
+ }
20
21
  if (typeof why !== 'string' || why.length === 0) {
21
22
  throw new Error('allow(value, why): a transform must say why. Pass a short reason — it is what the ' +
22
23
  'ledger shows next to the before/after pair. To pass the value through unchanged, ' +
@@ -30,6 +31,12 @@ export function allow(value, why) {
30
31
  * For a tool the reason reaches the model verbatim, as the tool's result,
31
32
  * and the loop continues — the agent gets to adapt. For a message it
32
33
  * surfaces as a `MessageDeniedError`.
34
+ *
35
+ * At the after-tool moment it means "the model does not get to read this" — the
36
+ * tool has already run, so the refusal replaces what the model reads while
37
+ * the run keeps the real result in the ledger. Refusing there hides an answer
38
+ * from the model; it cannot un-happen a side effect, and it does not pretend
39
+ * to.
33
40
  */
34
41
  export function deny(reason) {
35
42
  if (typeof reason !== 'string' || reason.length === 0) {
@@ -1 +1 @@
1
- {"version":3,"file":"outcomes.js","sourceRoot":"","sources":["../../../../../src/core/agent/middleware/outcomes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAcH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