agentfootprint 2.3.0 → 2.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (212) hide show
  1. package/README.md +293 -247
  2. package/dist/adapters/llm/AnthropicProvider.js +2 -2
  3. package/dist/adapters/llm/AnthropicProvider.js.map +1 -1
  4. package/dist/adapters/llm/BedrockProvider.js +2 -2
  5. package/dist/adapters/llm/BedrockProvider.js.map +1 -1
  6. package/dist/adapters/llm/BrowserAnthropicProvider.js +96 -28
  7. package/dist/adapters/llm/BrowserAnthropicProvider.js.map +1 -1
  8. package/dist/adapters/llm/OpenAIProvider.js +2 -2
  9. package/dist/adapters/llm/OpenAIProvider.js.map +1 -1
  10. package/dist/adapters/memory/agentcore.js +9 -3
  11. package/dist/adapters/memory/agentcore.js.map +1 -1
  12. package/dist/adapters/memory/redis.js +9 -3
  13. package/dist/adapters/memory/redis.js.map +1 -1
  14. package/dist/core/Agent.js +493 -79
  15. package/dist/core/Agent.js.map +1 -1
  16. package/dist/core/flowchartAsTool.js +188 -0
  17. package/dist/core/flowchartAsTool.js.map +1 -0
  18. package/dist/core/outputSchema.js +119 -0
  19. package/dist/core/outputSchema.js.map +1 -0
  20. package/dist/core/slots/buildSystemPromptSlot.js +8 -0
  21. package/dist/core/slots/buildSystemPromptSlot.js.map +1 -1
  22. package/dist/core/slots/buildToolsSlot.js +56 -5
  23. package/dist/core/slots/buildToolsSlot.js.map +1 -1
  24. package/dist/esm/adapters/llm/AnthropicProvider.js +2 -2
  25. package/dist/esm/adapters/llm/AnthropicProvider.js.map +1 -1
  26. package/dist/esm/adapters/llm/BedrockProvider.js +2 -2
  27. package/dist/esm/adapters/llm/BedrockProvider.js.map +1 -1
  28. package/dist/esm/adapters/llm/BrowserAnthropicProvider.js +96 -28
  29. package/dist/esm/adapters/llm/BrowserAnthropicProvider.js.map +1 -1
  30. package/dist/esm/adapters/llm/OpenAIProvider.js +2 -2
  31. package/dist/esm/adapters/llm/OpenAIProvider.js.map +1 -1
  32. package/dist/esm/adapters/memory/agentcore.js +9 -3
  33. package/dist/esm/adapters/memory/agentcore.js.map +1 -1
  34. package/dist/esm/adapters/memory/redis.js +9 -3
  35. package/dist/esm/adapters/memory/redis.js.map +1 -1
  36. package/dist/esm/core/Agent.js +492 -78
  37. package/dist/esm/core/Agent.js.map +1 -1
  38. package/dist/esm/core/flowchartAsTool.js +184 -0
  39. package/dist/esm/core/flowchartAsTool.js.map +1 -0
  40. package/dist/esm/core/outputSchema.js +113 -0
  41. package/dist/esm/core/outputSchema.js.map +1 -0
  42. package/dist/esm/core/slots/buildSystemPromptSlot.js +8 -0
  43. package/dist/esm/core/slots/buildSystemPromptSlot.js.map +1 -1
  44. package/dist/esm/core/slots/buildToolsSlot.js +56 -5
  45. package/dist/esm/core/slots/buildToolsSlot.js.map +1 -1
  46. package/dist/esm/index.js +34 -5
  47. package/dist/esm/index.js.map +1 -1
  48. package/dist/esm/lib/injection-engine/SkillRegistry.js +181 -0
  49. package/dist/esm/lib/injection-engine/SkillRegistry.js.map +1 -0
  50. package/dist/esm/lib/injection-engine/factories/defineSkill.js +35 -0
  51. package/dist/esm/lib/injection-engine/factories/defineSkill.js.map +1 -1
  52. package/dist/esm/lib/injection-engine/index.js +9 -1
  53. package/dist/esm/lib/injection-engine/index.js.map +1 -1
  54. package/dist/esm/lib/injection-engine/skillTools.js +125 -0
  55. package/dist/esm/lib/injection-engine/skillTools.js.map +1 -0
  56. package/dist/esm/lib/injection-engine/types.js +8 -0
  57. package/dist/esm/lib/injection-engine/types.js.map +1 -1
  58. package/dist/esm/lib/lazyRequire.js +33 -0
  59. package/dist/esm/lib/lazyRequire.js.map +1 -0
  60. package/dist/esm/lib/mcp/mcpClient.js +4 -6
  61. package/dist/esm/lib/mcp/mcpClient.js.map +1 -1
  62. package/dist/esm/llm-providers.js +31 -0
  63. package/dist/esm/llm-providers.js.map +1 -0
  64. package/dist/esm/locales/index.js +144 -0
  65. package/dist/esm/locales/index.js.map +1 -0
  66. package/dist/esm/memory-providers.js +44 -0
  67. package/dist/esm/memory-providers.js.map +1 -0
  68. package/dist/esm/providers.js +11 -0
  69. package/dist/esm/providers.js.map +1 -1
  70. package/dist/esm/recorders/core/contextEngineering.js +155 -0
  71. package/dist/esm/recorders/core/contextEngineering.js.map +1 -0
  72. package/dist/esm/recorders/observability/commentary/commentaryTemplates.js +6 -1
  73. package/dist/esm/recorders/observability/commentary/commentaryTemplates.js.map +1 -1
  74. package/dist/esm/security/PermissionPolicy.js +135 -0
  75. package/dist/esm/security/PermissionPolicy.js.map +1 -0
  76. package/dist/esm/security/index.js +38 -0
  77. package/dist/esm/security/index.js.map +1 -0
  78. package/dist/esm/tool-providers/gatedTools.js +52 -0
  79. package/dist/esm/tool-providers/gatedTools.js.map +1 -0
  80. package/dist/esm/tool-providers/index.js +43 -0
  81. package/dist/esm/tool-providers/index.js.map +1 -0
  82. package/dist/esm/tool-providers/skillScopedTools.js +63 -0
  83. package/dist/esm/tool-providers/skillScopedTools.js.map +1 -0
  84. package/dist/esm/tool-providers/staticTools.js +33 -0
  85. package/dist/esm/tool-providers/staticTools.js.map +1 -0
  86. package/dist/esm/tool-providers/types.js +53 -0
  87. package/dist/esm/tool-providers/types.js.map +1 -0
  88. package/dist/index.js +57 -12
  89. package/dist/index.js.map +1 -1
  90. package/dist/lib/injection-engine/SkillRegistry.js +185 -0
  91. package/dist/lib/injection-engine/SkillRegistry.js.map +1 -0
  92. package/dist/lib/injection-engine/factories/defineSkill.js +37 -1
  93. package/dist/lib/injection-engine/factories/defineSkill.js.map +1 -1
  94. package/dist/lib/injection-engine/index.js +14 -1
  95. package/dist/lib/injection-engine/index.js.map +1 -1
  96. package/dist/lib/injection-engine/skillTools.js +130 -0
  97. package/dist/lib/injection-engine/skillTools.js.map +1 -0
  98. package/dist/lib/injection-engine/types.js +8 -0
  99. package/dist/lib/injection-engine/types.js.map +1 -1
  100. package/dist/lib/lazyRequire.js +37 -0
  101. package/dist/lib/lazyRequire.js.map +1 -0
  102. package/dist/lib/mcp/mcpClient.js +4 -6
  103. package/dist/lib/mcp/mcpClient.js.map +1 -1
  104. package/dist/llm-providers.js +47 -0
  105. package/dist/llm-providers.js.map +1 -0
  106. package/dist/locales/index.js +149 -0
  107. package/dist/locales/index.js.map +1 -0
  108. package/dist/memory-providers.js +49 -0
  109. package/dist/memory-providers.js.map +1 -0
  110. package/dist/providers.js +11 -0
  111. package/dist/providers.js.map +1 -1
  112. package/dist/recorders/core/contextEngineering.js +161 -0
  113. package/dist/recorders/core/contextEngineering.js.map +1 -0
  114. package/dist/recorders/observability/commentary/commentaryTemplates.js +6 -1
  115. package/dist/recorders/observability/commentary/commentaryTemplates.js.map +1 -1
  116. package/dist/security/PermissionPolicy.js +139 -0
  117. package/dist/security/PermissionPolicy.js.map +1 -0
  118. package/dist/security/index.js +42 -0
  119. package/dist/security/index.js.map +1 -0
  120. package/dist/tool-providers/gatedTools.js +56 -0
  121. package/dist/tool-providers/gatedTools.js.map +1 -0
  122. package/dist/tool-providers/index.js +51 -0
  123. package/dist/tool-providers/index.js.map +1 -0
  124. package/dist/tool-providers/skillScopedTools.js +67 -0
  125. package/dist/tool-providers/skillScopedTools.js.map +1 -0
  126. package/dist/tool-providers/staticTools.js +37 -0
  127. package/dist/tool-providers/staticTools.js.map +1 -0
  128. package/dist/tool-providers/types.js +54 -0
  129. package/dist/tool-providers/types.js.map +1 -0
  130. package/dist/types/adapters/llm/AnthropicProvider.d.ts.map +1 -1
  131. package/dist/types/adapters/llm/BedrockProvider.d.ts.map +1 -1
  132. package/dist/types/adapters/llm/BrowserAnthropicProvider.d.ts.map +1 -1
  133. package/dist/types/adapters/llm/OpenAIProvider.d.ts.map +1 -1
  134. package/dist/types/adapters/memory/agentcore.d.ts +7 -1
  135. package/dist/types/adapters/memory/agentcore.d.ts.map +1 -1
  136. package/dist/types/adapters/memory/redis.d.ts +7 -1
  137. package/dist/types/adapters/memory/redis.d.ts.map +1 -1
  138. package/dist/types/core/Agent.d.ts +216 -2
  139. package/dist/types/core/Agent.d.ts.map +1 -1
  140. package/dist/types/core/flowchartAsTool.d.ts +161 -0
  141. package/dist/types/core/flowchartAsTool.d.ts.map +1 -0
  142. package/dist/types/core/outputSchema.d.ts +128 -0
  143. package/dist/types/core/outputSchema.d.ts.map +1 -0
  144. package/dist/types/core/slots/buildSystemPromptSlot.d.ts.map +1 -1
  145. package/dist/types/core/slots/buildToolsSlot.d.ts +10 -0
  146. package/dist/types/core/slots/buildToolsSlot.d.ts.map +1 -1
  147. package/dist/types/index.d.ts +8 -4
  148. package/dist/types/index.d.ts.map +1 -1
  149. package/dist/types/lib/injection-engine/SkillRegistry.d.ts +148 -0
  150. package/dist/types/lib/injection-engine/SkillRegistry.d.ts.map +1 -0
  151. package/dist/types/lib/injection-engine/factories/defineSkill.d.ts +99 -0
  152. package/dist/types/lib/injection-engine/factories/defineSkill.d.ts.map +1 -1
  153. package/dist/types/lib/injection-engine/index.d.ts +5 -2
  154. package/dist/types/lib/injection-engine/index.d.ts.map +1 -1
  155. package/dist/types/lib/injection-engine/skillTools.d.ts +73 -0
  156. package/dist/types/lib/injection-engine/skillTools.d.ts.map +1 -0
  157. package/dist/types/lib/injection-engine/types.d.ts +28 -0
  158. package/dist/types/lib/injection-engine/types.d.ts.map +1 -1
  159. package/dist/types/lib/lazyRequire.d.ts +30 -0
  160. package/dist/types/lib/lazyRequire.d.ts.map +1 -0
  161. package/dist/types/lib/mcp/mcpClient.d.ts.map +1 -1
  162. package/dist/types/llm-providers.d.ts +31 -0
  163. package/dist/types/llm-providers.d.ts.map +1 -0
  164. package/dist/types/locales/index.d.ts +133 -0
  165. package/dist/types/locales/index.d.ts.map +1 -0
  166. package/dist/types/memory-providers.d.ts +41 -0
  167. package/dist/types/memory-providers.d.ts.map +1 -0
  168. package/dist/types/providers.d.ts +11 -0
  169. package/dist/types/providers.d.ts.map +1 -1
  170. package/dist/types/recorders/core/contextEngineering.d.ts +137 -0
  171. package/dist/types/recorders/core/contextEngineering.d.ts.map +1 -0
  172. package/dist/types/recorders/observability/commentary/commentaryTemplates.d.ts.map +1 -1
  173. package/dist/types/security/PermissionPolicy.d.ts +125 -0
  174. package/dist/types/security/PermissionPolicy.d.ts.map +1 -0
  175. package/dist/types/security/index.d.ts +40 -0
  176. package/dist/types/security/index.d.ts.map +1 -0
  177. package/dist/types/tool-providers/gatedTools.d.ts +37 -0
  178. package/dist/types/tool-providers/gatedTools.d.ts.map +1 -0
  179. package/dist/types/tool-providers/index.d.ts +42 -0
  180. package/dist/types/tool-providers/index.d.ts.map +1 -0
  181. package/dist/types/tool-providers/skillScopedTools.d.ts +46 -0
  182. package/dist/types/tool-providers/skillScopedTools.d.ts.map +1 -0
  183. package/dist/types/tool-providers/staticTools.d.ts +22 -0
  184. package/dist/types/tool-providers/staticTools.d.ts.map +1 -0
  185. package/dist/types/tool-providers/types.d.ts +103 -0
  186. package/dist/types/tool-providers/types.d.ts.map +1 -0
  187. package/package.json +62 -9
  188. package/README.proposed.md +0 -258
  189. package/dist/instructions.js +0 -21
  190. package/dist/instructions.js.map +0 -1
  191. package/dist/lib/instructions/defineInstruction.js +0 -35
  192. package/dist/lib/instructions/defineInstruction.js.map +0 -1
  193. package/dist/lib/instructions/evaluator.js +0 -38
  194. package/dist/lib/instructions/evaluator.js.map +0 -1
  195. package/dist/lib/instructions/index.js +0 -48
  196. package/dist/lib/instructions/index.js.map +0 -1
  197. package/dist/lib/instructions/types.js +0 -22
  198. package/dist/lib/instructions/types.js.map +0 -1
  199. package/dist/memory/conversationHelpers.js +0 -39
  200. package/dist/memory/conversationHelpers.js.map +0 -1
  201. package/dist/types/instructions.d.ts +0 -5
  202. package/dist/types/instructions.d.ts.map +0 -1
  203. package/dist/types/lib/instructions/defineInstruction.d.ts +0 -22
  204. package/dist/types/lib/instructions/defineInstruction.d.ts.map +0 -1
  205. package/dist/types/lib/instructions/evaluator.d.ts +0 -11
  206. package/dist/types/lib/instructions/evaluator.d.ts.map +0 -1
  207. package/dist/types/lib/instructions/index.d.ts +0 -44
  208. package/dist/types/lib/instructions/index.d.ts.map +0 -1
  209. package/dist/types/lib/instructions/types.d.ts +0 -100
  210. package/dist/types/lib/instructions/types.d.ts.map +0 -1
  211. package/dist/types/memory/conversationHelpers.d.ts +0 -19
  212. package/dist/types/memory/conversationHelpers.d.ts.map +0 -1
@@ -0,0 +1,161 @@
1
+ /**
2
+ * flowchartAsTool — wrap a footprintjs `FlowChart` as an Agent `Tool`.
3
+ *
4
+ * The Block A7 piece. footprintjs is the substrate; agentfootprint is
5
+ * the agent layer above it. When a multi-step procedure is already
6
+ * expressed as a footprintjs flowchart (intake validation, refund
7
+ * processing, claim adjudication — anything with branches, loops, or
8
+ * decision evidence), let the LLM call it as ONE tool. The flowchart's
9
+ * step-by-step recorders, narrative, and pause/resume continue to work
10
+ * exactly as they do outside the agent.
11
+ *
12
+ * Why this matters:
13
+ *
14
+ * 1. **Composition over re-write.** A team with a non-trivial
15
+ * footprintjs flowchart shouldn't have to flatten it into N
16
+ * separate tools to expose it to an agent. Wrap it once.
17
+ *
18
+ * 2. **Observability stays free.** Every flowchart stage emits typed
19
+ * events. The Agent's recorders see the wrapping tool call;
20
+ * footprintjs's recorders see everything inside. Two layers,
21
+ * one observation tree.
22
+ *
23
+ * 3. **Pause/resume composes.** A pausable handler inside the
24
+ * flowchart pauses the inner executor; the outer agent treats
25
+ * the pause as an unfinished tool call. Resume the agent and the
26
+ * inner flowchart resumes from its checkpoint. (Today: surfaces
27
+ * the pause as a thrown error with the checkpoint attached;
28
+ * polished agent-side pause integration in v2.6.)
29
+ *
30
+ * Pattern: Adapter (GoF) over `FlowChartExecutor.run()`. Translates
31
+ * `Tool.execute(args, ctx)` into `executor.run({ input: args,
32
+ * env: { signal: ctx.signal } })` and the result back to a
33
+ * string via `resultMapper` (or a default JSON stringify).
34
+ *
35
+ * Role: Layer-6 (Agent) → Layer-1 (footprintjs) bridge. Pure
36
+ * interop; no new abstraction in either layer.
37
+ *
38
+ * @example Single-stage flowchart as a tool
39
+ * import { flowChart } from 'footprintjs';
40
+ * import { flowchartAsTool } from 'agentfootprint';
41
+ *
42
+ * const refundChart = flowChart<{ orderId: string; reason: string }>(
43
+ * 'RefundFlow',
44
+ * async (scope) => {
45
+ * const refundId = await refundService.process(scope.$getArgs().orderId);
46
+ * scope.refundId = refundId;
47
+ * },
48
+ * 'refund-flow',
49
+ * ).build();
50
+ *
51
+ * const refundTool = flowchartAsTool({
52
+ * name: 'process_refund',
53
+ * description: 'Process a refund for an order. Returns refundId on success.',
54
+ * inputSchema: {
55
+ * type: 'object',
56
+ * properties: {
57
+ * orderId: { type: 'string' },
58
+ * reason: { type: 'string' },
59
+ * },
60
+ * required: ['orderId', 'reason'],
61
+ * },
62
+ * flowchart: refundChart,
63
+ * resultMapper: (snapshot) =>
64
+ * JSON.stringify({ refundId: snapshot.values.refundId, status: 'processed' }),
65
+ * });
66
+ *
67
+ * agent.tool(refundTool);
68
+ *
69
+ * @example Multi-stage flowchart with decide() + recorders
70
+ * const triageChart = flowChart<TriageState>('Triage', validateInput, 'validate')
71
+ * .addDeciderFunction('Classify', classifyDecider, 'classify')
72
+ * .addFunctionBranch('high', 'Escalate', escalate)
73
+ * .addFunctionBranch('low', 'Auto-handle', autoHandle)
74
+ * .end()
75
+ * .build();
76
+ *
77
+ * const triageTool = flowchartAsTool({
78
+ * name: 'triage_request',
79
+ * description: 'Triage an incoming request and return the decision.',
80
+ * inputSchema: { ... },
81
+ * flowchart: triageChart,
82
+ * });
83
+ */
84
+ import { type FlowChart } from 'footprintjs';
85
+ import type { Tool } from './tools.js';
86
+ /**
87
+ * Pruned snapshot view passed to `resultMapper`. We keep this minimal
88
+ * (the values bag + the chart's narrative entries) to avoid leaking
89
+ * internal scope plumbing. Consumers needing the full snapshot can
90
+ * pass a `passthrough` resultMapper that ignores the prune.
91
+ */
92
+ export interface FlowchartToolSnapshot {
93
+ /**
94
+ * Final scope state — the merged result of every stage's writes.
95
+ * This is what `executor.getSnapshot().values` returns.
96
+ */
97
+ readonly values: Readonly<Record<string, unknown>>;
98
+ /**
99
+ * The flowchart's combined narrative entries (flow + data).
100
+ * Useful for resultMappers that want to extract specific commit
101
+ * artifacts or audit a decision path.
102
+ */
103
+ readonly narrative: readonly {
104
+ readonly type?: string;
105
+ readonly text?: string;
106
+ }[];
107
+ }
108
+ /**
109
+ * Optional result mapper. Receives the flowchart's final snapshot
110
+ * (pruned to `FlowchartToolSnapshot`) and returns the string the LLM
111
+ * sees as the tool result.
112
+ *
113
+ * If omitted, the default behavior is `JSON.stringify(snapshot.values)`.
114
+ *
115
+ * Errors thrown from the mapper become the tool result with a
116
+ * `[mapper-error: ...]` prefix so the LLM sees a useful diagnostic.
117
+ */
118
+ export type FlowchartResultMapper = (snapshot: FlowchartToolSnapshot) => string;
119
+ /**
120
+ * Options for `flowchartAsTool`.
121
+ */
122
+ export interface FlowchartAsToolOptions {
123
+ /** Tool name the LLM dispatches by. Must be unique across the agent's tools. */
124
+ readonly name: string;
125
+ /** Tool description shown to the LLM. */
126
+ readonly description: string;
127
+ /**
128
+ * JSON Schema describing the input args the LLM must produce.
129
+ * Becomes `flowchart.run({ input: args })`. Default: `{ type: 'object', properties: {} }`.
130
+ */
131
+ readonly inputSchema?: Readonly<Record<string, unknown>>;
132
+ /**
133
+ * The footprintjs flowchart to mount as the tool's body.
134
+ * The chart's stages receive args via `scope.$getArgs()`.
135
+ */
136
+ readonly flowchart: FlowChart;
137
+ /**
138
+ * Optional shaping function. Default: `JSON.stringify(snapshot.values)`.
139
+ * Errors throw into the tool's `[mapper-error: ...]` envelope.
140
+ */
141
+ readonly resultMapper?: FlowchartResultMapper;
142
+ }
143
+ /**
144
+ * Wrap a footprintjs `FlowChart` as a `Tool` the Agent's LLM can call.
145
+ *
146
+ * On execute:
147
+ * 1. Constructs a fresh `FlowChartExecutor(flowchart)` per call (so
148
+ * consecutive invocations don't share state).
149
+ * 2. Calls `executor.run({ input: args, env: { signal } })` with the
150
+ * LLM-supplied args + the agent's abort signal.
151
+ * 3. If the run paused, throws an Error with the checkpoint attached
152
+ * (`error.checkpoint`) so the agent loop can surface it. Polished
153
+ * agent-side pause integration is v2.6 work.
154
+ * 4. If the run completed, calls `resultMapper(snapshot)` (or the
155
+ * default JSON.stringify) and returns the string.
156
+ * 5. If the run threw, the error propagates — the Agent's
157
+ * tool-call handler converts it to a synthetic error string for
158
+ * the LLM to see + recover from.
159
+ */
160
+ export declare function flowchartAsTool(opts: FlowchartAsToolOptions): Tool;
161
+ //# sourceMappingURL=flowchartAsTool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flowchartAsTool.d.ts","sourceRoot":"","sources":["../../../src/core/flowchartAsTool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkFG;AAEH,OAAO,EAAqB,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAEhE,OAAO,KAAK,EAAE,IAAI,EAAwB,MAAM,YAAY,CAAC;AAE7D;;;;;GAKG;AACH,MAAM,WAAW,qBAAqB;IACpC;;;OAGG;IACH,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACnD;;;;OAIG;IACH,QAAQ,CAAC,SAAS,EAAE,SAAS;QAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CACnF;AAED;;;;;;;;;GASG;AACH,MAAM,MAAM,qBAAqB,GAAG,CAAC,QAAQ,EAAE,qBAAqB,KAAK,MAAM,CAAC;AAEhF;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,gFAAgF;IAChF,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,yCAAyC;IACzC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B;;;OAGG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACzD;;;OAGG;IACH,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAC9B;;;OAGG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,qBAAqB,CAAC;CAC/C;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,sBAAsB,GAAG,IAAI,CAsDlE"}
@@ -0,0 +1,128 @@
1
+ /**
2
+ * outputSchema — declarative terminal contract for an Agent's final answer.
3
+ *
4
+ * The Block A6 piece. Lets a consumer say:
5
+ *
6
+ * "Whatever this agent says at the end of a run, it MUST be JSON
7
+ * matching this Zod (or Zod-like) schema. Auto-instruct the LLM,
8
+ * parse + validate the final answer for me."
9
+ *
10
+ * Why a typed contract matters: agentic code that calls an LLM and
11
+ * then JSON.parses the string answer is brittle. The schema serves
12
+ * three jobs at once:
13
+ *
14
+ * 1. **Instruction**: a system-prompt sentence telling the LLM the
15
+ * output shape (auto-generated from `schema.description` /
16
+ * JSON-schema introspection where available, or from a consumer-
17
+ * supplied `instruction` override).
18
+ *
19
+ * 2. **Validation**: a `parser.parse(rawString)` step on the run's
20
+ * final answer, throwing `OutputSchemaError` on parse / shape
21
+ * failure rather than returning malformed data.
22
+ *
23
+ * 3. **Type narrowing**: `agent.runTyped({...})` returns the inferred
24
+ * shape `T` instead of `string`, so callers stop reaching for
25
+ * `as MyType` casts.
26
+ *
27
+ * Pattern: Strategy (GoF) over the parser interface; structural
28
+ * duck-typing (Zod / Valibot / ArkType / hand-written —
29
+ * anything with a `parse(unknown): T` method satisfies it).
30
+ *
31
+ * Role: Layer-6 (Agent) — terminal contract on the run output.
32
+ * NOT a context-engineering Injection per se, but composes
33
+ * with the InjectionEngine (auto-injects an Instruction).
34
+ *
35
+ * @example zod schema
36
+ * import { z } from 'zod';
37
+ * const Output = z.object({ status: z.enum(['ok', 'err']), items: z.array(z.string()) });
38
+ *
39
+ * const agent = Agent.create({ ... })
40
+ * .system('You answer support tickets.')
41
+ * .outputSchema(Output)
42
+ * .build();
43
+ *
44
+ * const typed = await agent.runTyped({ message: 'list pending tickets' });
45
+ * typed.status; // narrowed to 'ok' | 'err'
46
+ *
47
+ * @example valibot / arktype / hand-written parser
48
+ * const Output = { parse(v: unknown): MyType { ... } };
49
+ * const agent = Agent.create({...}).outputSchema(Output, { instruction: '...' }).build();
50
+ */
51
+ /**
52
+ * Minimum shape any validation library must expose to satisfy
53
+ * `outputSchema`. Covers Zod (`schema.parse`), Valibot
54
+ * (`v.parse(schema, value)` — pass `{ parse: v => v.parse(schema, v) }`),
55
+ * ArkType (`type.assert`), and hand-written parsers.
56
+ *
57
+ * Implementations MUST throw on validation failure (the runtime
58
+ * catches the throw, wraps it in `OutputSchemaError`, and emits the
59
+ * diagnostic event).
60
+ */
61
+ export interface OutputSchemaParser<T> {
62
+ parse(value: unknown): T;
63
+ /**
64
+ * Human-readable description of the output shape. Used by
65
+ * `outputSchema` to auto-build the system-prompt instruction when
66
+ * `opts.instruction` is not provided. Zod schemas expose this via
67
+ * `.describe('...')`; consumers can attach the field directly on
68
+ * hand-written parsers.
69
+ */
70
+ readonly description?: string;
71
+ }
72
+ /**
73
+ * Optional configuration for `outputSchema`.
74
+ */
75
+ export interface OutputSchemaOptions {
76
+ /**
77
+ * Injection id for the auto-generated "respond with this shape"
78
+ * instruction. Defaults to `'output-schema'`. Override when you
79
+ * have multiple agents with different schemas in one process and
80
+ * want the diagnostic events to disambiguate.
81
+ */
82
+ readonly name?: string;
83
+ /**
84
+ * Custom system-prompt instruction text. Defaults to a generic
85
+ * "Respond with valid JSON matching the output schema. Do not
86
+ * include prose." sentence (extended with `parser.description`
87
+ * when present). Override when the LLM benefits from a
88
+ * domain-specific framing.
89
+ */
90
+ readonly instruction?: string;
91
+ }
92
+ /**
93
+ * Thrown by `agent.parseOutput(...)` / `agent.runTyped(...)` when the
94
+ * agent's final answer fails JSON parsing OR schema validation.
95
+ *
96
+ * `cause` carries the underlying parse error (Zod's ZodError, etc.).
97
+ * `rawOutput` carries the agent's untyped string output so callers
98
+ * can log / persist the failed response for triage.
99
+ */
100
+ export declare class OutputSchemaError extends Error {
101
+ readonly rawOutput: string;
102
+ readonly stage: 'json-parse' | 'schema-validate';
103
+ readonly cause?: unknown;
104
+ constructor(message: string, opts: {
105
+ rawOutput: string;
106
+ stage: 'json-parse' | 'schema-validate';
107
+ cause?: unknown;
108
+ });
109
+ }
110
+ /**
111
+ * Default instruction template — used when `opts.instruction` is not
112
+ * provided. Concatenates the parser's `.description` (if present) so
113
+ * Zod schemas authored with `.describe('...')` propagate naturally.
114
+ */
115
+ export declare function buildDefaultInstruction(parser: OutputSchemaParser<unknown>): string;
116
+ /**
117
+ * Parse + validate a raw string answer against a parser. Used by
118
+ * `agent.parseOutput()` / `agent.runTyped()`. Centralized here so
119
+ * both call sites share identical error-mapping behavior.
120
+ *
121
+ * Two-stage error reporting:
122
+ * - JSON parse failure → `stage: 'json-parse'` (LLM emitted prose
123
+ * or malformed JSON)
124
+ * - Schema validation failure → `stage: 'schema-validate'` (JSON
125
+ * was valid but didn't match the contracted shape)
126
+ */
127
+ export declare function applyOutputSchema<T>(raw: string, parser: OutputSchemaParser<T>): T;
128
+ //# sourceMappingURL=outputSchema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"outputSchema.d.ts","sourceRoot":"","sources":["../../../src/core/outputSchema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AAEH;;;;;;;;;GASG;AACH,MAAM,WAAW,kBAAkB,CAAC,CAAC;IACnC,KAAK,CAAC,KAAK,EAAE,OAAO,GAAG,CAAC,CAAC;IACzB;;;;;;OAMG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CA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AsB;IACrC,4EAA4E;IAC5E,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,cAAc,CAAC;IACzC,yCAAyC;IACzC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,mFAAmF;IACnF,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AAWD;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,sBAAsB,GAAG,SAAS,CA8D/E"}
1
+ {"version":3,"file":"buildSystemPromptSlot.d.ts","sourceRoot":"","sources":["../../../../src/core/slots/buildSystemPromptSlot.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAc,MAAM,aAAa,CAAC;AAOzD;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,IAAI,EAAE;IAClC,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B,KAAK,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AAE/B,MAAM,WAAW,sBAAsB;IACrC,4EAA4E;IAC5E,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,cAAc,CAAC;IACzC,yCAAyC;IACzC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,mFAAmF;IACnF,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AAWD;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,sBAAsB,GAAG,SAAS,CAqE/E"}
@@ -12,9 +12,19 @@
12
12
  */
13
13
  import type { FlowChart } from 'footprintjs';
14
14
  import type { LLMToolSchema } from '../../adapters/types.js';
15
+ import type { ToolProvider } from '../../tool-providers/types.js';
15
16
  export interface ToolsSlotConfig {
16
17
  /** Tool registry exposed to the LLM. Empty → empty slot (LLMCall case). */
17
18
  readonly tools: readonly LLMToolSchema[];
19
+ /**
20
+ * Optional `ToolProvider` consulted PER-ITERATION (Block A5 follow-up).
21
+ * When set, the slot calls `provider.list(ctx)` each iteration with
22
+ * the current `{ iteration, activeSkillId, identity }`. Provider-
23
+ * supplied tool schemas are MERGED with the static `tools` registry
24
+ * — both flow to the LLM. This is what makes Dynamic ReAct's tool
25
+ * list reshape per iteration.
26
+ */
27
+ readonly toolProvider?: ToolProvider;
18
28
  /** Budget cap (chars). Default: 2000. */
19
29
  readonly budgetCap?: number;
20
30
  }
@@ -1 +1 @@
1
- {"version":3,"file":"buildToolsSlot.d.ts","sourceRoot":"","sources":["../../../../src/core/slots/buildToolsSlot.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAc,MAAM,aAAa,CAAC;AACzD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAO7D,MAAM,WAAW,eAAe;IAC9B,2EAA2E;IAC3E,QAAQ,CAAC,KAAK,EAAE,SAAS,aAAa,EAAE,CAAC;IACzC,yCAAyC;IACzC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAMD;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,eAAe,GAAG,SAAS,CAmEjE"}
1
+ {"version":3,"file":"buildToolsSlot.d.ts","sourceRoot":"","sources":["../../../../src/core/slots/buildToolsSlot.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAc,MAAM,aAAa,CAAC;AACzD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAK7D,OAAO,KAAK,EAAE,YAAY,EAAuB,MAAM,+BAA+B,CAAC;AAGvF,MAAM,WAAW,eAAe;IAC9B,2EAA2E;IAC3E,QAAQ,CAAC,KAAK,EAAE,SAAS,aAAa,EAAE,CAAC;IACzC;;;;;;;OAOG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,YAAY,CAAC;IACrC,yCAAyC;IACzC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAMD;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,eAAe,GAAG,SAAS,CA+HjE"}
@@ -5,6 +5,7 @@
5
5
  * Role: Single entry point consumers import from.
6
6
  * Emits: N/A.
7
7
  */
8
+ export type { CombinedRecorder, Recorder, FlowRecorder, EmitRecorder, WriteEvent, ReadEvent, CommitEvent, StageEvent, ErrorEvent, FlowStageEvent, FlowNextEvent, FlowDecisionEvent, FlowForkEvent, FlowSelectedEvent, FlowSubflowEvent, FlowSubflowRegisteredEvent, FlowLoopEvent, FlowBreakEvent, FlowErrorEvent, TraversalContext, EmitEvent, RedactionPolicy, RedactionReport, } from 'footprintjs';
8
9
  export * from './events/types.js';
9
10
  export * from './events/payloads.js';
10
11
  export { EVENT_NAMES, ALL_EVENT_TYPES, type AgentfootprintEvent, type AgentfootprintEventMap, type AgentfootprintEventType, } from './events/registry.js';
@@ -14,6 +15,7 @@ export { INJECTION_KEYS, injectionKeyForSlot, isInjectionKey, type InjectionKey,
14
15
  export { COMPOSITION_KEYS, type BudgetPressureRecord, type CompositionKey, type EvictionRecord, type InjectionRecord, type SlotComposition, } from './recorders/core/types.js';
15
16
  export { buildEventMeta, parseSubflowPath, type RunContext } from './bridge/eventMeta.js';
16
17
  export { ContextRecorder, type ContextRecorderOptions } from './recorders/core/ContextRecorder.js';
18
+ export { contextEngineering, isEngineeredSource, isBaselineSource, ENGINEERED_SOURCES, BASELINE_SOURCES, type ContextEngineeringHandle, type ContextEngineeringUnsubscribe, type ContextInjectedEvent, type ContextInjectedListener, } from './recorders/core/contextEngineering.js';
17
19
  export { EmitBridge, type EmitBridgeOptions } from './recorders/core/EmitBridge.js';
18
20
  export { streamRecorder, type StreamRecorderOptions } from './recorders/core/StreamRecorder.js';
19
21
  export { agentRecorder, type AgentRecorderOptions } from './recorders/core/AgentRecorder.js';
@@ -35,6 +37,8 @@ export { defaultCommentaryTemplates, selectCommentaryKey, extractCommentaryVars,
35
37
  export { defaultThinkingTemplates, selectThinkingState, renderThinkingLine, type ThinkingContext, type ThinkingState, type ThinkingStateKind, type ThinkingTemplates, } from './recorders/observability/thinking/thinkingTemplates.js';
36
38
  export { LLMCall, LLMCallBuilder, type LLMCallInput, type LLMCallOptions, type LLMCallOutput, } from './core/LLMCall.js';
37
39
  export { Agent, AgentBuilder, type AgentInput, type AgentOptions, type AgentOutput, } from './core/Agent.js';
40
+ export { OutputSchemaError, applyOutputSchema, buildDefaultInstruction, type OutputSchemaParser, type OutputSchemaOptions, } from './core/outputSchema.js';
41
+ export { flowchartAsTool, type FlowchartAsToolOptions, type FlowchartResultMapper, type FlowchartToolSnapshot, } from './core/flowchartAsTool.js';
38
42
  export type { Tool, ToolExecutionContext, ToolRegistryEntry, DefineToolOptions, } from './core/tools.js';
39
43
  export { defineTool } from './core/tools.js';
40
44
  export { Sequence, SequenceBuilder, type SequenceInput, type SequenceOptions, type SequenceOutput, } from './core-flow/Sequence.js';
@@ -42,14 +46,11 @@ export { Parallel, ParallelBuilder, type BranchOutcome, type MergeFn, type Merge
42
46
  export { Conditional, ConditionalBuilder, type ConditionalInput, type ConditionalOptions, type ConditionalOutput, type Predicate, } from './core-flow/Conditional.js';
43
47
  export { Loop, LoopBuilder, type LoopInput, type LoopOptions, type LoopOutput, type UntilGuard, } from './core-flow/Loop.js';
44
48
  export { MockProvider, mock, type MockProviderOptions, type MockReply, } from './adapters/llm/MockProvider.js';
45
- export { anthropic, AnthropicProvider, type AnthropicProviderOptions, } from './adapters/llm/AnthropicProvider.js';
46
- export { openai, OpenAIProvider, ollama, type OpenAIProviderOptions, } from './adapters/llm/OpenAIProvider.js';
47
- export { bedrock, BedrockProvider, type BedrockProviderOptions, } from './adapters/llm/BedrockProvider.js';
48
49
  export { browserAnthropic, BrowserAnthropicProvider, type BrowserAnthropicProviderOptions, } from './adapters/llm/BrowserAnthropicProvider.js';
49
50
  export { browserOpenai, BrowserOpenAIProvider, type BrowserOpenAIProviderOptions, } from './adapters/llm/BrowserOpenAIProvider.js';
50
51
  export { createProvider, type ProviderKind, type CreateProviderOptions, } from './adapters/llm/createProvider.js';
51
52
  export { toSSE, SSEFormatter, encodeSSE, type ToSSEOptions } from './stream.js';
52
- export { type Injection, type InjectionTrigger, type InjectionContent, type InjectionContext, type InjectionEvaluation, evaluateInjections, buildInjectionEngineSubflow, type InjectionEngineConfig, defineInstruction, type DefineInstructionOptions, defineSkill, type DefineSkillOptions, defineSteering, type DefineSteeringOptions, defineFact, type DefineFactOptions, } from './lib/injection-engine/index.js';
53
+ export { type Injection, type InjectionTrigger, type InjectionContent, type InjectionContext, type InjectionEvaluation, evaluateInjections, buildInjectionEngineSubflow, projectActiveInjection, type InjectionEngineConfig, type ActiveInjection, defineInstruction, type DefineInstructionOptions, defineSkill, resolveSurfaceMode, SkillRegistry, type SkillRegistryOptions, buildListSkillsTool, buildReadSkillTool, type SkillToolPair, type DefineSkillOptions, type SurfaceMode, type RefreshPolicy, type AutoActivateMode, defineSteering, type DefineSteeringOptions, defineFact, type DefineFactOptions, } from './lib/injection-engine/index.js';
53
54
  export * from './patterns/index.js';
54
55
  export { defaultPipeline, ephemeralPipeline, factPipeline, narrativePipeline, semanticPipeline, autoPipeline, } from './memory/pipeline/index.js';
55
56
  export { heuristicExtractor, llmExtractor, } from './memory/beats/index.js';
@@ -57,4 +58,7 @@ export { patternFactExtractor, llmFactExtractor, } from './memory/facts/index.js
57
58
  export { defineMemory, MEMORY_TYPES, MEMORY_STRATEGIES, MEMORY_TIMING, SNAPSHOT_PROJECTIONS, type MemoryType, type MemoryStrategyKind, type MemoryTiming, type SnapshotProjection, type Strategy, type MemoryDefinition, type DefineMemoryOptions, InMemoryStore, mockEmbedder, identityNamespace, type MemoryIdentity, type Embedder, } from './memory/index.js';
58
59
  export { defineRAG, type DefineRAGOptions, indexDocuments, type IndexDocumentsOptions, type RagDocument, } from './lib/rag/index.js';
59
60
  export { mcpClient, mockMcpClient, type McpClient, type McpClientOptions, type McpHttpTransport, type McpStdioTransport, type McpTransport, type McpSdkClient, type MockMcpClientOptions, type MockMcpTool, } from './lib/mcp/index.js';
61
+ export { staticTools, gatedTools, skillScopedTools, type ToolProvider, type ToolDispatchContext, type ToolGatePredicate, } from './tool-providers/index.js';
62
+ export { PermissionPolicy, type RoleAllowlist, type PermissionPolicyOptions, } from './security/index.js';
63
+ export { defaultCommentaryMessages, defaultThinkingMessages, composeMessages, validateMessages, type MessageCatalog, } from './locales/index.js';
60
64
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,OAAO,EACL,WAAW,EACX,eAAe,EACf,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,GAC7B,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EACL,eAAe,EACf,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,cAAc,EACnB,KAAK,WAAW,EAChB,KAAK,oBAAoB,GAC1B,MAAM,wBAAwB,CAAC;AAGhC,cAAc,qBAAqB,CAAC;AAIpC,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,cAAc,EACd,KAAK,YAAY,GAClB,MAAM,kBAAkB,CAAC;AAM1B,OAAO,EACL,gBAAgB,EAChB,KAAK,oBAAoB,EACzB,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,eAAe,GACrB,MAAM,2BAA2B,CAAC;AAGnC,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,KAAK,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAG1F,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AS,EACd,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,oBAAoB,EACzB,KAAK,WAAW,GACjB,MAAM,oBAAoB,CAAC;AAO5B,OAAO,EACL,WAAW,EACX,UAAU,EACV,gBAAgB,EAChB,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,GACvB,MAAM,2BAA2B,CAAC;AAKnC,OAAO,EACL,gBAAgB,EAChB,KAAK,aAAa,EAClB,KAAK,uBAAuB,GAC7B,MAAM,qBAAqB,CAAC;AAK7B,OAAO,EACL,yBAAyB,EACzB,uBAAuB,EACvB,eAAe,EACf,gBAAgB,EAChB,KAAK,cAAc,GACpB,MAAM,oBAAoB,CAAC"}
@@ -0,0 +1,148 @@
1
+ /**
2
+ * SkillRegistry — centralized governance for Skills across one or
3
+ * more Agents.
4
+ *
5
+ * Most apps register Skills directly on the Agent via `.skill(s)`.
6
+ * Once you have multiple Agents that share a common skill catalog
7
+ * (a customer-support pool, a research team, a multi-step workflow
8
+ * where each step uses different overlapping skills), hand-syncing
9
+ * `.skill()` calls per Agent gets fragile.
10
+ *
11
+ * `SkillRegistry` is the answer: register once, attach to many
12
+ * Agents via `.skills(registry)`. Add a Skill to the registry and
13
+ * every consumer Agent picks it up at next build.
14
+ *
15
+ * @example
16
+ * const registry = new SkillRegistry();
17
+ * registry.register(billingSkill);
18
+ * registry.register(refundSkill);
19
+ *
20
+ * const supportAgent = Agent.create({ provider }).skills(registry).build();
21
+ * const escalationAgent = Agent.create({ provider }).skills(registry).build();
22
+ *
23
+ * // Add a new skill — both agents pick it up at next build.
24
+ * registry.register(complianceSkill);
25
+ */
26
+ import type { Injection } from './types.js';
27
+ import { type SkillToolPair } from './skillTools.js';
28
+ import { type SurfaceMode } from './factories/defineSkill.js';
29
+ /**
30
+ * Options for `new SkillRegistry({...})`. All fields are optional;
31
+ * the empty-object form (`new SkillRegistry()`) is the v2.4 surface.
32
+ *
33
+ * @see SkillRegistry.resolveForSkill — applies the cascade
34
+ */
35
+ export interface SkillRegistryOptions {
36
+ /**
37
+ * Registry-level default `surfaceMode`. Applies to skills whose own
38
+ * `surfaceMode` is `'auto'` (the `defineSkill` default). Per-skill
39
+ * `surfaceMode` always wins; this is the fallback BEFORE the global
40
+ * `resolveSurfaceMode(provider, model)` rule.
41
+ *
42
+ * Use case: a registry shared across agents pointed at the same
43
+ * provider can lock surfaceMode here once instead of repeating it
44
+ * on every `defineSkill`.
45
+ */
46
+ readonly surfaceMode?: SurfaceMode;
47
+ /**
48
+ * Provider name used as a hint when resolving `surfaceMode: 'auto'`
49
+ * inside this registry. Most consumers don't set this — runtime code
50
+ * passes the provider name into `resolveForSkill(skill, provider, model)`
51
+ * directly. This field is for cases where the registry is composed
52
+ * far from the agent (test fixtures, design-time inspectors).
53
+ *
54
+ * Match the provider's `name` field — `'anthropic'`, `'openai'`,
55
+ * `'mock'`, etc.
56
+ */
57
+ readonly providerHint?: string;
58
+ }
59
+ export declare class SkillRegistry {
60
+ private readonly skills;
61
+ private readonly opts;
62
+ /**
63
+ * Construct an empty registry. Optional `{ surfaceMode, providerHint }`
64
+ * fields set registry-level defaults; absent both, the registry is a
65
+ * pure container (the v2.4 surface).
66
+ */
67
+ constructor(opts?: SkillRegistryOptions);
68
+ /** Registry-level default `surfaceMode`, or `undefined` if unset. */
69
+ get surfaceMode(): SurfaceMode | undefined;
70
+ /** Registry-level provider hint, or `undefined` if unset. */
71
+ get providerHint(): string | undefined;
72
+ /**
73
+ * Register a skill. Throws if `skill.flavor !== 'skill'` or if a
74
+ * skill with the same id is already registered (use `.replace(...)`
75
+ * to overwrite intentionally).
76
+ */
77
+ register(skill: Injection): this;
78
+ /** Replace an existing skill by id. Throws if id is not registered. */
79
+ replace(id: string, skill: Injection): this;
80
+ /** Remove a skill by id. No-op if not registered. */
81
+ unregister(id: string): this;
82
+ /** Look up by id. Returns undefined if not registered. */
83
+ get(id: string): Injection | undefined;
84
+ /** True iff a skill with the given id is registered. */
85
+ has(id: string): boolean;
86
+ /** All registered skills. Order matches registration order. */
87
+ list(): readonly Injection[];
88
+ /** Number of registered skills. */
89
+ get size(): number;
90
+ /** Drop all registrations. */
91
+ clear(): void;
92
+ /**
93
+ * Materialize the LLM-facing skill discovery tools from the current
94
+ * registry contents. Returns `{ listSkills, readSkill }`:
95
+ *
96
+ * - `list_skills` — no-arg tool the LLM calls to enumerate
97
+ * `{ id, description }` for every registered skill. Lets the
98
+ * LLM discover skills without paying the prompt-token cost of
99
+ * a static catalog in the system prompt.
100
+ *
101
+ * - `read_skill({ id })` — activates the named skill for the
102
+ * NEXT iteration. The Agent's tool-calls subflow inspects this
103
+ * tool call by name and updates `scope.activatedInjectionIds`
104
+ * so the InjectionEngine on iter N+1 includes the skill in the
105
+ * active set (body lands in the system slot; gated tools land
106
+ * in the tools slot).
107
+ *
108
+ * Both entries are `undefined` when the registry is empty — filter
109
+ * before adding to a tool list:
110
+ *
111
+ * const { listSkills, readSkill } = registry.toTools();
112
+ * const tools = [listSkills, readSkill, ...other].filter(Boolean) as Tool[];
113
+ *
114
+ * Composes with `gatedTools` from `agentfootprint/tool-providers`
115
+ * so PermissionPolicy can scope which roles see the skill discovery
116
+ * surface.
117
+ *
118
+ * @returns A `SkillToolPair` (`{ listSkills, readSkill }`).
119
+ */
120
+ toTools(): SkillToolPair;
121
+ /**
122
+ * Resolve the effective `surfaceMode` for a skill, applying the
123
+ * cascade:
124
+ *
125
+ * 1. If the skill's own `metadata.surfaceMode` is concrete
126
+ * (`'system-prompt'` / `'tool-only'` / `'both'`), return it.
127
+ * Per-skill explicit choice always wins.
128
+ * 2. Else if the registry was constructed with a concrete
129
+ * `surfaceMode`, return that.
130
+ * 3. Else delegate to `resolveSurfaceMode(provider, model)` using
131
+ * the explicit `provider` arg (or `this.providerHint` if
132
+ * omitted). Falls back to `'tool-only'` when no provider is
133
+ * known.
134
+ *
135
+ * Forward-compat for Block C / v2.5 per-mode runtime routing: the
136
+ * runtime calls this with the agent's provider + model to decide
137
+ * how to materialize the skill's body into slots.
138
+ *
139
+ * Throws if the skill is not registered (catches typos at the
140
+ * caller site rather than silently resolving against a stranger).
141
+ *
142
+ * @param skillOrId A registered Skill `Injection` OR its `id`.
143
+ * @param provider Provider name override (wins over `providerHint`).
144
+ * @param model Model name for the per-provider attention rule.
145
+ */
146
+ resolveForSkill(skillOrId: Injection | string, provider?: string, model?: string): Exclude<SurfaceMode, 'auto'>;
147
+ }
148
+ //# sourceMappingURL=SkillRegistry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SkillRegistry.d.ts","sourceRoot":"","sources":["../../../../src/lib/injection-engine/SkillRegistry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAA2C,KAAK,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC9F,OAAO,EAAsB,KAAK,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAElF;;;;;GAKG;AACH,MAAM,WAAW,oBAAoB;IACnC;;;;;;;;;OASG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,WAAW,CAAC;IAEnC;;;;;;;;;OASG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;CAChC;AAED,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAgC;IACvD,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAuB;IAE5C;;;;OAIG;gBACS,IAAI,GAAE,oBAAyB;IAI3C,qEAAqE;IACrE,IAAI,WAAW,IAAI,WAAW,GAAG,SAAS,CAEzC;IAED,6DAA6D;IAC7D,IAAI,YAAY,IAAI,MAAM,GAAG,SAAS,CAErC;IAED;;;;OAIG;IACH,QAAQ,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI;IAehC,uEAAuE;IACvE,O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