agentfootprint 7.12.0 → 7.13.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 (94) hide show
  1. package/dist/core/Agent.js +39 -5
  2. package/dist/core/Agent.js.map +1 -1
  3. package/dist/core/agent/AgentBuilder.js +59 -1
  4. package/dist/core/agent/AgentBuilder.js.map +1 -1
  5. package/dist/core/agent/buildAgentChart.js +6 -0
  6. package/dist/core/agent/buildAgentChart.js.map +1 -1
  7. package/dist/core/agent/buildDynamicAgentChart.js +14 -0
  8. package/dist/core/agent/buildDynamicAgentChart.js.map +1 -1
  9. package/dist/core/agent/stages/callLLM.js +10 -4
  10. package/dist/core/agent/stages/callLLM.js.map +1 -1
  11. package/dist/core/agent/stages/seed.js +16 -0
  12. package/dist/core/agent/stages/seed.js.map +1 -1
  13. package/dist/core/slots/buildSystemPromptSlot.js +2 -1
  14. package/dist/core/slots/buildSystemPromptSlot.js.map +1 -1
  15. package/dist/esm/core/Agent.d.ts +7 -3
  16. package/dist/esm/core/Agent.js +39 -5
  17. package/dist/esm/core/Agent.js.map +1 -1
  18. package/dist/esm/core/agent/AgentBuilder.d.ts +48 -1
  19. package/dist/esm/core/agent/AgentBuilder.js +59 -1
  20. package/dist/esm/core/agent/AgentBuilder.js.map +1 -1
  21. package/dist/esm/core/agent/buildAgentChart.js +6 -0
  22. package/dist/esm/core/agent/buildAgentChart.js.map +1 -1
  23. package/dist/esm/core/agent/buildDynamicAgentChart.js +14 -0
  24. package/dist/esm/core/agent/buildDynamicAgentChart.js.map +1 -1
  25. package/dist/esm/core/agent/stages/callLLM.d.ts +9 -0
  26. package/dist/esm/core/agent/stages/callLLM.js +10 -4
  27. package/dist/esm/core/agent/stages/callLLM.js.map +1 -1
  28. package/dist/esm/core/agent/stages/seed.d.ts +10 -1
  29. package/dist/esm/core/agent/stages/seed.js +16 -0
  30. package/dist/esm/core/agent/stages/seed.js.map +1 -1
  31. package/dist/esm/core/agent/types.d.ts +44 -0
  32. package/dist/esm/core/slots/buildSystemPromptSlot.d.ts +19 -4
  33. package/dist/esm/core/slots/buildSystemPromptSlot.js +2 -1
  34. package/dist/esm/core/slots/buildSystemPromptSlot.js.map +1 -1
  35. package/dist/esm/lib/injection-engine/index.d.ts +1 -0
  36. package/dist/esm/lib/injection-engine/index.js +4 -0
  37. package/dist/esm/lib/injection-engine/index.js.map +1 -1
  38. package/dist/esm/lib/injection-engine/skillsFromDir.d.ts +80 -0
  39. package/dist/esm/lib/injection-engine/skillsFromDir.js +243 -0
  40. package/dist/esm/lib/injection-engine/skillsFromDir.js.map +1 -0
  41. package/dist/esm/lib/mcp/index.d.ts +6 -5
  42. package/dist/esm/lib/mcp/index.js +5 -4
  43. package/dist/esm/lib/mcp/index.js.map +1 -1
  44. package/dist/esm/lib/mcp/mcpClient.js +21 -9
  45. package/dist/esm/lib/mcp/mcpClient.js.map +1 -1
  46. package/dist/esm/lib/mcp/mcpServe.d.ts +70 -0
  47. package/dist/esm/lib/mcp/mcpServe.js +374 -0
  48. package/dist/esm/lib/mcp/mcpServe.js.map +1 -0
  49. package/dist/esm/lib/mcp/types.d.ts +130 -17
  50. package/dist/esm/lib/mcp/types.js +10 -10
  51. package/dist/esm/tool-providers/index.d.ts +8 -2
  52. package/dist/esm/tool-providers/index.js +7 -1
  53. package/dist/esm/tool-providers/index.js.map +1 -1
  54. package/dist/lib/injection-engine/index.js +6 -1
  55. package/dist/lib/injection-engine/index.js.map +1 -1
  56. package/dist/lib/injection-engine/skillsFromDir.js +270 -0
  57. package/dist/lib/injection-engine/skillsFromDir.js.map +1 -0
  58. package/dist/lib/mcp/index.js +7 -5
  59. package/dist/lib/mcp/index.js.map +1 -1
  60. package/dist/lib/mcp/mcpClient.js +21 -9
  61. package/dist/lib/mcp/mcpClient.js.map +1 -1
  62. package/dist/lib/mcp/mcpServe.js +401 -0
  63. package/dist/lib/mcp/mcpServe.js.map +1 -0
  64. package/dist/lib/mcp/types.js +10 -10
  65. package/dist/tool-providers/index.js +8 -1
  66. package/dist/tool-providers/index.js.map +1 -1
  67. package/dist/types/core/Agent.d.ts +7 -3
  68. package/dist/types/core/Agent.d.ts.map +1 -1
  69. package/dist/types/core/agent/AgentBuilder.d.ts +48 -1
  70. package/dist/types/core/agent/AgentBuilder.d.ts.map +1 -1
  71. package/dist/types/core/agent/buildAgentChart.d.ts.map +1 -1
  72. package/dist/types/core/agent/buildDynamicAgentChart.d.ts.map +1 -1
  73. package/dist/types/core/agent/stages/callLLM.d.ts +9 -0
  74. package/dist/types/core/agent/stages/callLLM.d.ts.map +1 -1
  75. package/dist/types/core/agent/stages/seed.d.ts +10 -1
  76. package/dist/types/core/agent/stages/seed.d.ts.map +1 -1
  77. package/dist/types/core/agent/types.d.ts +44 -0
  78. package/dist/types/core/agent/types.d.ts.map +1 -1
  79. package/dist/types/core/slots/buildSystemPromptSlot.d.ts +19 -4
  80. package/dist/types/core/slots/buildSystemPromptSlot.d.ts.map +1 -1
  81. package/dist/types/lib/injection-engine/index.d.ts +1 -0
  82. package/dist/types/lib/injection-engine/index.d.ts.map +1 -1
  83. package/dist/types/lib/injection-engine/skillsFromDir.d.ts +81 -0
  84. package/dist/types/lib/injection-engine/skillsFromDir.d.ts.map +1 -0
  85. package/dist/types/lib/mcp/index.d.ts +6 -5
  86. package/dist/types/lib/mcp/index.d.ts.map +1 -1
  87. package/dist/types/lib/mcp/mcpClient.d.ts.map +1 -1
  88. package/dist/types/lib/mcp/mcpServe.d.ts +71 -0
  89. package/dist/types/lib/mcp/mcpServe.d.ts.map +1 -0
  90. package/dist/types/lib/mcp/types.d.ts +130 -17
  91. package/dist/types/lib/mcp/types.d.ts.map +1 -1
  92. package/dist/types/tool-providers/index.d.ts +8 -2
  93. package/dist/types/tool-providers/index.d.ts.map +1 -1
  94. package/package.json +2 -1
@@ -19,7 +19,7 @@ import type { CheckInBuilderOptions } from '../checkin.js';
19
19
  import type { ToolProvider } from '../../tool-providers/types.js';
20
20
  import { type SelfExplainOptions } from '../../lib/trace-toolpack/selfExplain.js';
21
21
  import { Agent } from '../Agent.js';
22
- import type { AgentOptions } from './types.js';
22
+ import type { AgentOptions, RunConfigFn } from './types.js';
23
23
  /**
24
24
  * Fluent builder. `tool()` accepts any Tool<TArgs, TResult> and registers
25
25
  * it by its schema.name. Duplicate names throw at build time.
@@ -121,6 +121,9 @@ export declare class AgentBuilder {
121
121
  private thinkingBudgetValue?;
122
122
  private selfExplainConfig?;
123
123
  private checkInConfig?;
124
+ /** Per-run config resolver set via `.configure()`. Undefined = the agent
125
+ * runs on its build-time model + system prompt, unchanged. */
126
+ private runConfigFn?;
124
127
  constructor(opts: AgentOptions);
125
128
  /**
126
129
  * Set the base system prompt.
@@ -183,6 +186,50 @@ export declare class AgentBuilder {
183
186
  * .build();
184
187
  */
185
188
  toolProvider(provider: ToolProvider): this;
189
+ /**
190
+ * Decide this run's model and/or system prompt when the run starts.
191
+ *
192
+ * An agent is built once and run many times, but not every run wants the
193
+ * same model or the same instructions: a long message may deserve the
194
+ * bigger model, a tenant may have its own house rules, a canary may want
195
+ * last week's prompt. Rebuilding the whole agent per request works and is
196
+ * wasteful; reaching in and mutating one is worse, because the trace then
197
+ * describes an agent that no longer exists.
198
+ *
199
+ * The resolver runs ONCE per `run()`, at the start of the run, and what it
200
+ * returns is **committed to the trace** — `resolvedModel` and
201
+ * `resolvedInstructions` land in the run's commit log before the first LLM
202
+ * call, and the LLM call reads them from there. So the recording says which
203
+ * model actually answered instead of which model the agent was built with.
204
+ *
205
+ * Return `{}` (or nothing) to keep the defaults; `ctx.defaults` carries
206
+ * them, so a resolver can decide relative to what was built rather than
207
+ * restating it. Omit `.configure()` entirely and every run behaves — and
208
+ * records — exactly as it did before.
209
+ *
210
+ * This is the RUN axis only. Tools are the iteration axis and already have
211
+ * an owner: `.toolProvider()`, consulted every iteration.
212
+ *
213
+ * Throws if called more than once (same rule as `.toolProvider()` — a
214
+ * silently-overridden resolver is a config that lies).
215
+ *
216
+ * @example Bigger model for a bigger question
217
+ * const agent = Agent.create({ provider, model: 'small-model' })
218
+ * .system('You answer support questions.')
219
+ * .configure(({ message, defaults }) =>
220
+ * message.length > 500 ? { model: 'big-model' } : {},
221
+ * )
222
+ * .build();
223
+ *
224
+ * @example Per-tenant house rules
225
+ * const agent = Agent.create({ provider, model })
226
+ * .system('You answer support questions.')
227
+ * .configure(({ identity, defaults }) => ({
228
+ * instructions: `${defaults.instructions}\n\n${rulesFor(identity?.tenant)}`,
229
+ * }))
230
+ * .build();
231
+ */
232
+ configure(fn: RunConfigFn): this;
186
233
  /**
187
234
  * Override the ReAct iteration cap set via `Agent.create({
188
235
  * maxIterations })`. Convenience for builder-style code that prefers
@@ -1 +1 @@
1
- {"version":3,"file":"AgentBuilder.d.ts","sourceRoot":"","sources":["../../../../src/core/agent/AgentBuilder.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAEL,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACxB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAGL,KAAK,qBAAqB,EAE3B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,WAAW,EAAiB,MAAM,sBAAsB,CAAC;AACvE,OAAO,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AACvF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0CAA0C,CAAC;AAE7E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,KAAK,EAAE,IAAI,EAAqB,MAAM,aAAa,CAAC;AAC3D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAC3D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAGlE,O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,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1D,QAAQ,CAAC,mBAAmB,EAAE,SAAS,CAAC;IACxC,QAAQ,CAAC,eAAe,EAAE,SAAS,CAAC;IACpC,QAAQ,CAAC,YAAY,EAAE,SAAS,CAAC;IACjC;;;;;;OAMG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,SAAS,CAAC;IAMrC,QAAQ,CAAC,uBAAuB,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IAEzD;;;;;;;OAOG;IACH,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAE5B;;;;;OAKG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;IAG3C;;;;0CAIsC;IACtC,QAAQ,CAAC,kBAAkB,CAAC,EAAE,SAAS,iBAAiB,EAAE,CAAC;CAC5D;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,cAAc,GAAG,SAAS,CA2W/D"}
@@ -1 +1 @@
1
- {"version":3,"file":"buildDynamicAgentChart.d.ts","sourceRoot":"","sources":["../../../../src/core/agent/buildDynamicAgentChart.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AAIH,OAAO,KAAK,EAAE,SAAS,EAAc,MAAM,aAAa,CAAC;AAezD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAgD3D;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,cAAc,GAAG,SAAS,CA0WtE"}
1
+ {"version":3,"file":"buildDynamicAgentChart.d.ts","sourceRoot":"","sources":["../../../../src/core/agent/buildDynamicAgentChart.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AAIH,OAAO,KAAK,EAAE,SAAS,EAAc,MAAM,aAAa,CAAC;AAezD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAgD3D;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,cAAc,GAAG,SAAS,CAwXtE"}
@@ -65,6 +65,15 @@ export interface CallLLMStageDeps {
65
65
  * carries `thinking: { budget }` so the provider activates extended
66
66
  * thinking. Undefined = no activation (default). */
67
67
  readonly thinkingBudget?: number;
68
+ /**
69
+ * True when the agent was built with `.configure()`. Only then does this
70
+ * stage read `scope.resolvedModel` — the per-run model seed committed.
71
+ * Gating on a build-time flag (rather than always reading and falling
72
+ * back) keeps an unconfigured agent's recorded reads unchanged, which is
73
+ * what "absent option = byte-identical" has to mean for a library whose
74
+ * product is the recording.
75
+ */
76
+ readonly runConfigured?: boolean;
68
77
  }
69
78
  /**
70
79
  * Build the callLLM stage function. Captures the LLM provider + model
@@ -1 +1 @@
1
- {"version":3,"file":"callLLM.d.ts","sourceRoot":"","sources":["../../../../../src/core/agent/stages/callLLM.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,KAAK,EAEV,WAAW,EAGX,aAAa,EACb,YAAY,EACb,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAe,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAK1E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAqB,KAAK,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAMnF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,MAAM,WAAW,gBAAgB;IAC/B,kCAAkC;IAClC,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC;IAC/B,2DAA2D;IAC3D,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,qCAAqC;IACrC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import type { AgentState } from '../types.js';
21
+ import type { AgentInput, AgentState, RunConfig } from '../types.js';
22
22
  export interface SeedStageDeps {
23
23
  /** Resolved `clampIterations(opts.maxIterations ?? 10)`. Frozen at
24
24
  * chart-build time. */
@@ -44,6 +44,15 @@ export interface SeedStageDeps {
44
44
  * Returns `undefined` only in degenerate (test) cases.
45
45
  */
46
46
  readonly getCurrentRunId: () => string | undefined;
47
+ /**
48
+ * Per-run config resolver from `.configure()`. Seed is where run-level
49
+ * facts are decided AND committed (identity, iteration budget, turn
50
+ * number all land here), so this rides the same commit rather than
51
+ * inventing a second place a run can change itself. Undefined when the
52
+ * consumer never called `.configure()` — and then nothing extra is
53
+ * written, so the commit log is byte-identical to earlier releases.
54
+ */
55
+ readonly resolveRunConfig?: (input: AgentInput) => RunConfig | undefined;
47
56
  }
48
57
  /**
49
58
  * Build the seed stage function for an Agent instance. Captures both
@@ -1 +1 @@
1
- {"version":3,"file":"seed.d.ts","sourceRoot":"","sources":["../../../../../src/core/agent/stages/seed.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAE5E,OAAO,KAAK,EAAc,UAAU,EAAE,MAAM,aAAa,CAAC;AAE1D,MAAM,WAAW,aAAa;IAC5B;4BACwB;IACxB,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,0EAA0E;IAC1E,QAAQ,CAAC,eAAe,EAAE,OAAO,CAAC;IAClC;;iEAE6D;IAC7D,QAAQ,CAAC,WAAW,EAAE,SAAS,aAAa,EAAE,CAAC;IAC/C;;;;;;OAMG;IACH,QAAQ,CAAC,2BAA2B,EAAE,MAAM,SAAS,UAAU,EAAE,GAAG,SAAS,CAAC;IAC9E;;;;;OAKG;IACH,QAAQ,CAAC,eAAe,EAAE,MAAM,MAAM,GAAG,SAAS,CAAC;CACpD;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,aAAa,GAAG,CAAC,KAAK,EAAE,UAAU,CAAC,UAAU,CAAC,KAAK,IAAI,CA2E3F"}
1
+ {"version":3,"file":"seed.d.ts","sourceRoot":"","sources":["../../../../../src/core/agent/stages/seed.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAE5E,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAErE,MAAM,WAAW,aAAa;IAC5B;4BACwB;IACxB,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,0EAA0E;IAC1E,QAAQ,CAAC,eAAe,EAAE,OAAO,CAAC;IAClC;;iEAE6D;IAC7D,QAAQ,CAAC,WAAW,EAAE,SAAS,aAAa,EAAE,CAAC;IAC/C;;;;;;OAMG;IACH,QAAQ,CAAC,2BAA2B,EAAE,MAAM,SAAS,UAAU,EAAE,GAAG,SAAS,CAAC;IAC9E;;;;;OAKG;IACH,QAAQ,CAAC,eAAe,EAAE,MAAM,MAAM,GAAG,SAAS,CAAC;IACnD;;;;;;;OAOG;IACH,QAAQ,CAAC,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,SAAS,GAAG,SAAS,CAAC;CAC1E;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,aAAa,GAAG,CAAC,KAAK,EAAE,UAAU,CAAC,UAAU,CAAC,KAAK,IAAI,CA0F3F"}
@@ -256,6 +256,39 @@ export interface AgentOptions {
256
256
  */
257
257
  readonly observerDeliveryOptions?: ObserverDeliveryOptions;
258
258
  }
259
+ /**
260
+ * What `.configure(fn)` may change for one run. Both fields are
261
+ * optional; returning `{}` (or nothing) means "use the built defaults",
262
+ * which is exactly what an agent without `.configure()` does.
263
+ *
264
+ * Deliberately NOT the tools axis — `.toolProvider()` already owns that,
265
+ * and it is consulted every iteration rather than once per run.
266
+ */
267
+ export interface RunConfig {
268
+ /** Model id for every LLM call in this run. */
269
+ readonly model?: string;
270
+ /** Replaces the base system prompt set by `.system(...)` for this run. */
271
+ readonly instructions?: string;
272
+ }
273
+ /** What a `.configure(fn)` resolver is given. */
274
+ export interface RunConfigContext {
275
+ /** The message this run was started with. */
276
+ readonly message: string;
277
+ /** The memory identity passed to `run({ identity })`, when there was one. */
278
+ readonly identity?: MemoryIdentity;
279
+ /** This run's id — the same one that stamps every typed event's `meta.runId`. */
280
+ readonly runId: string;
281
+ /** What the agent was BUILT with, so a resolver can decide relative to it. */
282
+ readonly defaults: {
283
+ readonly model: string;
284
+ readonly instructions: string;
285
+ };
286
+ }
287
+ /**
288
+ * Per-run configuration resolver — see `AgentBuilder.configure`. Called
289
+ * exactly once per run, synchronously, at the start of the run.
290
+ */
291
+ export type RunConfigFn = (ctx: RunConfigContext) => RunConfig | undefined;
259
292
  export interface AgentInput {
260
293
  readonly message: string;
261
294
  /**
@@ -363,6 +396,17 @@ export interface AgentState {
363
396
  /** Name of the entry scorer that produced `entryScores` (`'keyword'` /
364
397
  * `'embedding'` / a custom scorer's name). */
365
398
  entryScorer?: string;
399
+ /** The model `.configure()` resolved for THIS run, written by seed and read
400
+ * by CallLLM. Present only when a resolver returned one — a run that did
401
+ * not change its model records nothing here, so an agent without
402
+ * `.configure()` commits exactly what it always did. The point of writing
403
+ * it at all is that the trace must say which model actually answered:
404
+ * a run that switched models without recording it would be a trace that
405
+ * lies about its own most expensive fact. */
406
+ resolvedModel?: string;
407
+ /** The base system prompt `.configure()` resolved for THIS run, replacing
408
+ * `.system(...)`. Same rule: absent unless a resolver returned one. */
409
+ resolvedInstructions?: string;
366
410
  /** Set when a `PermissionChecker` returns `{ result: 'halt', ... }`.
367
411
  * `Agent.run()` reads these at the API boundary and throws a typed
368
412
  * `PolicyHaltError` carrying the same context — the chart $break's
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/core/agent/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EACV,qBAAqB,EACrB,wBAAwB,EACxB,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EACjB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,KAAK,EACV,UAAU,EACV,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,YAAY,EACb,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACvE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AACrE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAInE;;;;;;;;GAQG;AACH,MAAM,MAAM,uBAAuB,GAAG,IAAI,CAAC,qBAAqB,EAAE,UAAU,CAAC,CAAC;AAE9E;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,GAAG,WAAW,CAAC,wBAAwB,CAAC,iBAAiB,CAAC,CAAC,CAAC;AAE3F,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC;IAC/B,qEAAqE;IACrE,QAAQ,CAAC,IAAI,C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QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;KAC5B,CAAC,CAAC;IACH;mDAC+C;IAC/C,WAAW,CAAC,EAAE,MAAM,CAAC;IAGrB;;;;;;kDAM8C;IAC9C,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;4EACwE;IACxE,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAG9B;;;;0EAIsE;IACtE,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;0BAEsB;IACtB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,qEAAqE;IACrE,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,cAAc,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACnD,yCAAyC;IACzC,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,kEAAkE;IAClE,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAG7B;;;6EAGyE;IACzE,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;;0CAIsC;IACtC,cAAc,EAAE,SAAS,aAAa,EAAE,CAAC;IAGzC;;;;;;iFAM6E;IAC7E,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,sBAAsB,CAAC,EAAE,gBAAgB,CAAC,aAAa,CAAC,CAAC;IACzD,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B;kEAC8D;IAC9D,2BAA2B,CAAC,EAAE,MAAM,CAAC;IACrC,wBAAwB,CAAC,EAAE,MAAM,CAAC;CACnC"}
@@ -17,17 +17,32 @@ import type { FlowChart } from 'footprintjs';
17
17
  * Function that produces the system prompt string given runtime scope
18
18
  * context. Receives the subflow's $getArgs() payload.
19
19
  */
20
- export type SystemPromptFn = (args: {
20
+ export type SystemPromptFn = (args: SystemPromptSlotArgs) => string | Promise<string>;
21
+ /**
22
+ * What the slot's `$getArgs()` carries. `instructions` is present only when
23
+ * the Agent's `.configure()` resolved a per-run system prompt — the mount's
24
+ * inputMapper omits the key entirely otherwise, so an unconfigured agent
25
+ * seeds this subflow with exactly the state it always did.
26
+ */
27
+ export interface SystemPromptSlotArgs {
21
28
  readonly userMessage?: string;
22
29
  readonly iteration?: number;
23
- }) => string | Promise<string>;
30
+ readonly instructions?: string;
31
+ }
24
32
  export interface SystemPromptSlotConfig {
25
33
  /** Static string OR a function. Empty string → no injection, empty slot. */
26
34
  readonly prompt: string | SystemPromptFn;
27
35
  /** Budget cap (chars). Default: 4000. */
28
36
  readonly budgetCap?: number;
29
- /** Optional description — where this prompt originated (e.g. "agent.system()"). */
30
- readonly reason?: string;
37
+ /**
38
+ * Where this prompt originated, recorded on the base InjectionRecord
39
+ * (e.g. `"agent.system()"`). A function when the origin depends on the
40
+ * run — an Agent with `.configure()` reports `Agent.configure()` on the
41
+ * runs that actually overrode the prompt and `Agent.system()` on the rest,
42
+ * so the context record names the real author rather than a build-time
43
+ * guess.
44
+ */
45
+ readonly reason?: string | ((args: SystemPromptSlotArgs) => string);
31
46
  }
32
47
  /**
33
48
  * Build the System-Prompt slot subflow.
@@ -1 +1 @@
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,CAsF/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,oBAAoB,KAAK,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AAEtF;;;;;GAKG;AACH,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;CAChC;AAED,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;;;;;;;OAOG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,IAAI,EAAE,oBAAoB,KAAK,MAAM,CAAC,CAAC;CACrE;AAWD;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,sBAAsB,GAAG,SAAS,CAuF/E"}
@@ -13,6 +13,7 @@ export { defineInstruction, type DefineInstructionOptions } from './factories/de
13
13
  export { defineRelevanceHint, type RelevanceHintOptions } from './factories/defineRelevanceHint.js';
14
14
  export { defineSkill, resolveSurfaceMode, type DefineSkillOptions, type SurfaceMode, type RefreshPolicy, type AutoActivateMode, } from './factories/defineSkill.js';
15
15
  export { SkillRegistry, type SkillRegistryOptions } from './SkillRegistry.js';
16
+ export { skillsFromDir, type SkillsFromDirOptions } from './skillsFromDir.js';
16
17
  export { buildListSkillsTool, buildReadSkillTool, type SkillToolPair } from './skillTools.js';
17
18
  export { defineSteering, type DefineSteeringOptions } from './factories/defineSteering.js';
18
19
  export { defineFact, type DefineFactOptions } from './factories/defineFact.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/injection-engine/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,YAAY,EACV,SAAS,EACT,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,mBAAmB,EACnB,eAAe,GAChB,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAGpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EACL,2BAA2B,EAC3B,KAAK,qBAAqB,GAC3B,MAAM,kCAAkC,CAAC;AAG1C,OAAO,EAAE,iBAAiB,EAAE,KAAK,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AACpG,OAAO,EAAE,mBAAmB,EAAE,KAAK,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAEpG,OAAO,EACL,WAAW,EACX,kBAAkB,EAClB,KAAK,kBAAkB,EACvB,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,gBAAgB,GACtB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAE,aAAa,EAAE,KAAK,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAM9E,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,KAAK,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAE9F,OAAO,EAAE,cAAc,EAAE,KAAK,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAE3F,OAAO,EAAE,UAAU,EAAE,KAAK,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAK/E,OAAO,EACL,eAAe,EACf,KAAK,sBAAsB,EAC3B,KAAK,eAAe,GACrB,MAAM,gCAAgC,CAAC;AAIxC,OAAO,EACL,UAAU,EACV,WAAW,EACX,wBAAwB,EACxB,KAAK,UAAU,EACf,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,KAAK,aAAa,EAClB,KAAK,SAAS,EACd,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACrB,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACrB,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,gBAAgB,GACtB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,aAAa,EACb,eAAe,EACf,WAAW,EACX,KAAK,WAAW,EAChB,KAAK,gBAAgB,EACrB,KAAK,cAAc,GACpB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/injection-engine/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,YAAY,EACV,SAAS,EACT,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,mBAAmB,EACnB,eAAe,GAChB,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAGpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EACL,2BAA2B,EAC3B,KAAK,qBAAqB,GAC3B,MAAM,kCAAkC,CAAC;AAG1C,OAAO,EAAE,iBAAiB,EAAE,KAAK,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AACpG,OAAO,EA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AAE,kBAAkB,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC"}
@@ -0,0 +1,81 @@
1
+ /**
2
+ * skillsFromDir — load Skills that were AUTHORED AS FILES.
3
+ *
4
+ * The just-in-time half of skills already ships: `defineSkill` produces an
5
+ * Injection whose `description` is all the model sees until it calls
6
+ * `read_skill(<id>)`, at which point the body enters the context. What did not
7
+ * ship was the other half — a way to keep those bodies where prose belongs, in
8
+ * files, next to the code they describe, reviewable in a diff.
9
+ *
10
+ * This is that loader, and nothing more. It reads a directory of `SKILL.md`
11
+ * files and hands each one to `defineSkill`. The progressive disclosure, the
12
+ * activation tool, the slot routing — all unchanged, all upstream of here.
13
+ *
14
+ * skills/
15
+ * billing/SKILL.md
16
+ * refunds/SKILL.md
17
+ *
18
+ * ---
19
+ * name: billing
20
+ * description: Use for refunds, charges and billing questions.
21
+ * ---
22
+ * When handling billing: confirm identity first, then …
23
+ *
24
+ * const skills = await skillsFromDir('./skills');
25
+ * const agent = Agent.create({ provider, model }).skills({ list: () => skills }).build();
26
+ *
27
+ * The frontmatter is the disclosure stub (`name` + `description` — what the
28
+ * model reads when deciding), and everything after the closing fence is the
29
+ * body (what it reads after deciding). That is the same file convention Claude
30
+ * Code made familiar, so a skill folder is portable between the two.
31
+ *
32
+ * ── Why authorship is decided here, at load time ─────────────────────────────
33
+ * A Skill body is *instructions to a model*. Where it came from is therefore a
34
+ * security property, not a convenience: content fetched at run time from
35
+ * somewhere else is content someone else can change after you reviewed it.
36
+ * This loader accepts a local directory and nothing else — a URL is refused BY
37
+ * NAME rather than fetched — because "these files are mine" is a claim you can
38
+ * only make about a path on your own disk at build time. Each file is read
39
+ * ONCE, here; a later edit does not reach a run already in flight.
40
+ *
41
+ * Node-only. `node:fs/promises` and `node:path` are imported lazily inside the
42
+ * call, the same gating `lib/tool-lint/cli.ts` uses: this module is reachable
43
+ * from the `agentfootprint/injection-engine` barrel, and a TOP-LEVEL node:fs
44
+ * import detonates a browser bundle at module-eval even when nothing calls it.
45
+ */
46
+ import type { Injection } from './types.js';
47
+ import { type SurfaceMode } from './factories/defineSkill.js';
48
+ export interface SkillsFromDirOptions {
49
+ /**
50
+ * Override the activation tool name for every loaded skill. Defaults to
51
+ * `defineSkill`'s own default, `'read_skill'`.
52
+ */
53
+ readonly viaToolName?: string;
54
+ /**
55
+ * Where a loaded skill's body lands once activated. Defaults to
56
+ * `defineSkill`'s own default, `'auto'`. See {@link SurfaceMode}.
57
+ */
58
+ readonly surfaceMode?: SurfaceMode;
59
+ }
60
+ /**
61
+ * Load every `SKILL.md` under `dir` as a Skill Injection.
62
+ *
63
+ * Two layouts are accepted, and they can be mixed:
64
+ * - `dir/<anything>/SKILL.md` — one folder per skill (the portable layout,
65
+ * and the one to prefer: the folder can hold the skill's other assets).
66
+ * - `dir/SKILL.md` — the directory IS one skill.
67
+ *
68
+ * The returned array is sorted by skill name, so a chart built from it is
69
+ * stable regardless of the order the filesystem happened to hand back.
70
+ *
71
+ * @param dir - A local filesystem path. A URL (or any `scheme://` string, or a
72
+ * UNC network path) is refused by name — see the module header for why.
73
+ * @param opts - Applied uniformly to every loaded skill.
74
+ *
75
+ * @throws when `dir` is not a local path, does not exist, is not a directory,
76
+ * or contains no `SKILL.md` at all; when a file's frontmatter is malformed
77
+ * (the message names the file); or when two files claim the same skill name
78
+ * (the message names both).
79
+ */
80
+ export declare function skillsFromDir(dir: string, opts?: SkillsFromDirOptions): Promise<readonly Injection[]>;
81
+ //# sourceMappingURL=skillsFromDir.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skillsFromDir.d.ts","sourceRoot":"","sources":["../../../../src/lib/injection-engine/skillsFromDir.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAe,KAAK,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAe3E,MAAM,WAAW,oBAAoB;IACnC;;;OAGG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B;;;OAGG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,WAAW,CAAC;CACpC;AAeD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,aAAa,CACjC,GAAG,EAAE,MAAM,EACX,IAAI,GAAE,oBAAyB,GAC9B,OAAO,CAAC,SAAS,SAAS,EAAE,CAAC,CA+E/B"}
@@ -1,10 +1,11 @@
1
1
  /**
2
- * MCP — Model Context Protocol client integration. Connect to an MCP
3
- * server, register its tools on your Agent. Server-side support is
4
- * separate (consumer exposes their agent as an MCP tool — different
5
- * use case, not yet shipped).
2
+ * MCP — Model Context Protocol, both directions. `mcpClient` connects to
3
+ * someone else's MCP server and registers its tools on your Agent;
4
+ * `mcpServe` exposes your own tools AS an MCP server so any MCP client
5
+ * can call them.
6
6
  */
7
7
  export { mcpClient } from './mcpClient.js';
8
+ export { mcpServe } from './mcpServe.js';
8
9
  export { mockMcpClient, type MockMcpClientOptions, type MockMcpTool } from './mockMcpClient.js';
9
- export type { McpClient, McpClientOptions, McpHttpTransport, McpStdioTransport, McpTransport, McpSdkClient, } from './types.js';
10
+ export type { McpClient, McpClientOptions, McpHttpTransport, McpStdioTransport, McpTransport, McpSdkClient, McpServeOptions, McpServeHandle, McpServeTransport, McpHttpServeTransport, McpStdioServeTransport, McpSdkServer, } from './types.js';
10
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/mcp/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,KAAK,oBAAoB,EAAE,KAAK,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAChG,YAAY,EACV,SAAS,EACT,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EACjB,YAAY,EACZ,YAAY,GACb,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/mcp/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,KAAK,oBAAoB,EAAE,KAAK,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAChG,YAAY,EACV,SAAS,EACT,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,qBAAqB,EACrB,sBAAsB,EACtB,YAAY,GACb,MAAM,YAAY,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"mcpClient.d.ts","sourceRoot":"","sources":["../../../../src/lib/mcp/mcpClient.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAA8B,MAAM,YAAY,CAAC;AAW1F;;;;;;;;GAQG;AACH,wBAAsB,SAAS,CAAC,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAAC,SAAS,CAAC,CAyC1E"}
1
+ {"version":3,"file":"mcpClient.d.ts","sourceRoot":"","sources":["../../../../src/lib/mcp/mcpClient.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAA8B,MAAM,YAAY,CAAC;AAW1F;;;;;;;;GAQG;AACH,wBAAsB,SAAS,CAAC,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAAC,SAAS,CAAC,CA6C1E"}
@@ -0,0 +1,71 @@
1
+ /**
2
+ * mcpServe — expose your agentfootprint tools AS an MCP server.
3
+ *
4
+ * const handle = await mcpServe([lookupTool, refundTool], {
5
+ * name: 'support-desk',
6
+ * version: '1.0.0',
7
+ * });
8
+ *
9
+ * // …later
10
+ * await handle.close();
11
+ *
12
+ * `mcpClient` pulls someone else's tools in. This pushes yours out, so
13
+ * the tool you already wrote, tested and governed can be called by any
14
+ * MCP client — a desktop host, another team's agent, an IDE — without
15
+ * being rewritten against a second tool interface.
16
+ *
17
+ * Pattern: Adapter (GoF), pointed the other way. `mcpClient` translates
18
+ * MCP → `Tool`; this translates `Tool` → MCP. Same SDK, same
19
+ * lazy-require discipline, mirrored lifecycle (`close()`).
20
+ *
21
+ * ── The one promise worth stating plainly ────────────────────────────
22
+ * A served tool is THE SAME OBJECT you passed in. `mcpServe` holds your
23
+ * `Tool` by reference and calls `tool.execute(args, ctx)` — it never
24
+ * copies the schema and re-implements the body, never unwraps a
25
+ * decorator, never reaches past a wrapper to an inner tool. So whatever
26
+ * governance you composed around that tool — a permission check inside
27
+ * `execute`, a redaction step, an audit hook — is still the thing that
28
+ * runs when a remote client calls it. Serving is not a second door into
29
+ * your tool; it is the same door with a longer corridor.
30
+ *
31
+ * Two demands the library CANNOT keep over MCP are refused at
32
+ * construction rather than silently dropped:
33
+ * - `checkIn` (human consent before the tool runs) needs a pause
34
+ * channel that a request/response protocol does not have.
35
+ * - `needs` (declare-and-push credentials) needs a provider; without
36
+ * one the tool would run with `ctx.credential` undefined.
37
+ *
38
+ * ── Schemas ──────────────────────────────────────────────────────────
39
+ * Tools already carry JSON Schema in `schema.inputSchema`, and MCP's
40
+ * `tools/list` wants JSON Schema, so the mapping is the identity
41
+ * function. That is also why this builds on the SDK's low-level
42
+ * `Server` rather than its `McpServer` convenience wrapper — the latter
43
+ * takes zod schemas, which would mean converting a JSON Schema you
44
+ * already have into zod (a new dependency) to convert it straight back.
45
+ */
46
+ import type { Tool } from '../../core/tools.js';
47
+ import type { McpServeHandle, McpServeOptions } from './types.js';
48
+ /**
49
+ * Serve `tools` over MCP. Resolves once the transport is connected (for
50
+ * `http`, once the socket is listening), so holding the handle means the
51
+ * server is live.
52
+ *
53
+ * @throws at construction when `tools` is empty, when two tools share a
54
+ * name, when a tool declares `checkIn`, or when a tool declares `needs`
55
+ * without `opts.credentials` — see the module header. Also throws when
56
+ * `@modelcontextprotocol/sdk` is not installed.
57
+ */
58
+ export declare function mcpServe(tools: readonly Tool[], opts?: McpServeOptions): Promise<McpServeHandle>;
59
+ /**
60
+ * Sentinels handed to an injected `_server` in place of the SDK's zod
61
+ * schemas. Exported so a test can tell the two handlers apart.
62
+ * @internal
63
+ */
64
+ export declare const LIST_TOOLS_SENTINEL: Readonly<{
65
+ method: "tools/list";
66
+ }>;
67
+ /** @internal @see LIST_TOOLS_SENTINEL */
68
+ export declare const CALL_TOOL_SENTINEL: Readonly<{
69
+ method: "tools/call";
70
+ }>;
71
+ //# sourceMappingURL=mcpServe.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcpServe.d.ts","sourceRoot":"","sources":["../../../../src/lib/mcp/mcpServe.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AAMH,OAAO,KAAK,EAAE,IAAI,EAAwB,MAAM,qBAAqB,CAAC;AAGtE,OAAO,KAAK,EAIV,cAAc,EACd,eAAe,EAEhB,MAAM,YAAY,CAAC;AAOpB;;;;;;;;;GASG;AACH,wBAAsB,QAAQ,CAC5B,KAAK,EAAE,SAAS,IAAI,EAAE,EACtB,IAAI,GAAE,eAAoB,GACzB,OAAO,CAAC,cAAc,CAAC,CA2FzB;AAmKD;;;;GAIG;AACH,eAAO,MAAM,mBAAmB;;EAA0C,CAAC;AAC3E,yCAAyC;AACzC,eAAO,MAAM,kBAAkB;;EAA0C,CAAC"}