agentfootprint 2.4.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.
- package/README.md +21 -3
- package/dist/adapters/llm/AnthropicProvider.js +2 -2
- package/dist/adapters/llm/AnthropicProvider.js.map +1 -1
- package/dist/adapters/llm/BedrockProvider.js +2 -2
- package/dist/adapters/llm/BedrockProvider.js.map +1 -1
- package/dist/adapters/llm/BrowserAnthropicProvider.js +96 -28
- package/dist/adapters/llm/BrowserAnthropicProvider.js.map +1 -1
- package/dist/adapters/llm/OpenAIProvider.js +2 -2
- package/dist/adapters/llm/OpenAIProvider.js.map +1 -1
- package/dist/adapters/memory/agentcore.js +9 -3
- package/dist/adapters/memory/agentcore.js.map +1 -1
- package/dist/adapters/memory/redis.js +9 -3
- package/dist/adapters/memory/redis.js.map +1 -1
- package/dist/core/Agent.js +477 -79
- package/dist/core/Agent.js.map +1 -1
- package/dist/core/flowchartAsTool.js +188 -0
- package/dist/core/flowchartAsTool.js.map +1 -0
- package/dist/core/outputSchema.js +119 -0
- package/dist/core/outputSchema.js.map +1 -0
- package/dist/core/slots/buildSystemPromptSlot.js +8 -0
- package/dist/core/slots/buildSystemPromptSlot.js.map +1 -1
- package/dist/core/slots/buildToolsSlot.js +56 -5
- package/dist/core/slots/buildToolsSlot.js.map +1 -1
- package/dist/esm/adapters/llm/AnthropicProvider.js +2 -2
- package/dist/esm/adapters/llm/AnthropicProvider.js.map +1 -1
- package/dist/esm/adapters/llm/BedrockProvider.js +2 -2
- package/dist/esm/adapters/llm/BedrockProvider.js.map +1 -1
- package/dist/esm/adapters/llm/BrowserAnthropicProvider.js +96 -28
- package/dist/esm/adapters/llm/BrowserAnthropicProvider.js.map +1 -1
- package/dist/esm/adapters/llm/OpenAIProvider.js +2 -2
- package/dist/esm/adapters/llm/OpenAIProvider.js.map +1 -1
- package/dist/esm/adapters/memory/agentcore.js +9 -3
- package/dist/esm/adapters/memory/agentcore.js.map +1 -1
- package/dist/esm/adapters/memory/redis.js +9 -3
- package/dist/esm/adapters/memory/redis.js.map +1 -1
- package/dist/esm/core/Agent.js +476 -78
- package/dist/esm/core/Agent.js.map +1 -1
- package/dist/esm/core/flowchartAsTool.js +184 -0
- package/dist/esm/core/flowchartAsTool.js.map +1 -0
- package/dist/esm/core/outputSchema.js +113 -0
- package/dist/esm/core/outputSchema.js.map +1 -0
- package/dist/esm/core/slots/buildSystemPromptSlot.js +8 -0
- package/dist/esm/core/slots/buildSystemPromptSlot.js.map +1 -1
- package/dist/esm/core/slots/buildToolsSlot.js +56 -5
- package/dist/esm/core/slots/buildToolsSlot.js.map +1 -1
- package/dist/esm/index.js +34 -5
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lib/injection-engine/SkillRegistry.js +98 -0
- package/dist/esm/lib/injection-engine/SkillRegistry.js.map +1 -1
- package/dist/esm/lib/injection-engine/factories/defineSkill.js +1 -0
- package/dist/esm/lib/injection-engine/factories/defineSkill.js.map +1 -1
- package/dist/esm/lib/injection-engine/index.js +7 -0
- package/dist/esm/lib/injection-engine/index.js.map +1 -1
- package/dist/esm/lib/injection-engine/skillTools.js +125 -0
- package/dist/esm/lib/injection-engine/skillTools.js.map +1 -0
- package/dist/esm/lib/injection-engine/types.js +8 -0
- package/dist/esm/lib/injection-engine/types.js.map +1 -1
- package/dist/esm/lib/lazyRequire.js +33 -0
- package/dist/esm/lib/lazyRequire.js.map +1 -0
- package/dist/esm/lib/mcp/mcpClient.js +4 -6
- package/dist/esm/lib/mcp/mcpClient.js.map +1 -1
- package/dist/esm/llm-providers.js +31 -0
- package/dist/esm/llm-providers.js.map +1 -0
- package/dist/esm/locales/index.js +144 -0
- package/dist/esm/locales/index.js.map +1 -0
- package/dist/esm/memory-providers.js +44 -0
- package/dist/esm/memory-providers.js.map +1 -0
- package/dist/esm/providers.js +11 -0
- package/dist/esm/providers.js.map +1 -1
- package/dist/esm/recorders/core/contextEngineering.js +155 -0
- package/dist/esm/recorders/core/contextEngineering.js.map +1 -0
- package/dist/esm/recorders/observability/commentary/commentaryTemplates.js +6 -1
- package/dist/esm/recorders/observability/commentary/commentaryTemplates.js.map +1 -1
- package/dist/esm/security/PermissionPolicy.js +135 -0
- package/dist/esm/security/PermissionPolicy.js.map +1 -0
- package/dist/esm/security/index.js +38 -0
- package/dist/esm/security/index.js.map +1 -0
- package/dist/esm/tool-providers/gatedTools.js +52 -0
- package/dist/esm/tool-providers/gatedTools.js.map +1 -0
- package/dist/esm/tool-providers/index.js +43 -0
- package/dist/esm/tool-providers/index.js.map +1 -0
- package/dist/esm/tool-providers/skillScopedTools.js +63 -0
- package/dist/esm/tool-providers/skillScopedTools.js.map +1 -0
- package/dist/esm/tool-providers/staticTools.js +33 -0
- package/dist/esm/tool-providers/staticTools.js.map +1 -0
- package/dist/esm/tool-providers/types.js +53 -0
- package/dist/esm/tool-providers/types.js.map +1 -0
- package/dist/index.js +55 -12
- package/dist/index.js.map +1 -1
- package/dist/lib/injection-engine/SkillRegistry.js +98 -0
- package/dist/lib/injection-engine/SkillRegistry.js.map +1 -1
- package/dist/lib/injection-engine/factories/defineSkill.js +1 -0
- package/dist/lib/injection-engine/factories/defineSkill.js.map +1 -1
- package/dist/lib/injection-engine/index.js +11 -1
- package/dist/lib/injection-engine/index.js.map +1 -1
- package/dist/lib/injection-engine/skillTools.js +130 -0
- package/dist/lib/injection-engine/skillTools.js.map +1 -0
- package/dist/lib/injection-engine/types.js +8 -0
- package/dist/lib/injection-engine/types.js.map +1 -1
- package/dist/lib/lazyRequire.js +37 -0
- package/dist/lib/lazyRequire.js.map +1 -0
- package/dist/lib/mcp/mcpClient.js +4 -6
- package/dist/lib/mcp/mcpClient.js.map +1 -1
- package/dist/llm-providers.js +47 -0
- package/dist/llm-providers.js.map +1 -0
- package/dist/locales/index.js +149 -0
- package/dist/locales/index.js.map +1 -0
- package/dist/memory-providers.js +49 -0
- package/dist/memory-providers.js.map +1 -0
- package/dist/providers.js +11 -0
- package/dist/providers.js.map +1 -1
- package/dist/recorders/core/contextEngineering.js +161 -0
- package/dist/recorders/core/contextEngineering.js.map +1 -0
- package/dist/recorders/observability/commentary/commentaryTemplates.js +6 -1
- package/dist/recorders/observability/commentary/commentaryTemplates.js.map +1 -1
- package/dist/security/PermissionPolicy.js +139 -0
- package/dist/security/PermissionPolicy.js.map +1 -0
- package/dist/security/index.js +42 -0
- package/dist/security/index.js.map +1 -0
- package/dist/tool-providers/gatedTools.js +56 -0
- package/dist/tool-providers/gatedTools.js.map +1 -0
- package/dist/tool-providers/index.js +51 -0
- package/dist/tool-providers/index.js.map +1 -0
- package/dist/tool-providers/skillScopedTools.js +67 -0
- package/dist/tool-providers/skillScopedTools.js.map +1 -0
- package/dist/tool-providers/staticTools.js +37 -0
- package/dist/tool-providers/staticTools.js.map +1 -0
- package/dist/tool-providers/types.js +54 -0
- package/dist/tool-providers/types.js.map +1 -0
- package/dist/types/adapters/llm/AnthropicProvider.d.ts.map +1 -1
- package/dist/types/adapters/llm/BedrockProvider.d.ts.map +1 -1
- package/dist/types/adapters/llm/BrowserAnthropicProvider.d.ts.map +1 -1
- package/dist/types/adapters/llm/OpenAIProvider.d.ts.map +1 -1
- package/dist/types/adapters/memory/agentcore.d.ts +7 -1
- package/dist/types/adapters/memory/agentcore.d.ts.map +1 -1
- package/dist/types/adapters/memory/redis.d.ts +7 -1
- package/dist/types/adapters/memory/redis.d.ts.map +1 -1
- package/dist/types/core/Agent.d.ts +202 -2
- package/dist/types/core/Agent.d.ts.map +1 -1
- package/dist/types/core/flowchartAsTool.d.ts +161 -0
- package/dist/types/core/flowchartAsTool.d.ts.map +1 -0
- package/dist/types/core/outputSchema.d.ts +128 -0
- package/dist/types/core/outputSchema.d.ts.map +1 -0
- package/dist/types/core/slots/buildSystemPromptSlot.d.ts.map +1 -1
- package/dist/types/core/slots/buildToolsSlot.d.ts +10 -0
- package/dist/types/core/slots/buildToolsSlot.d.ts.map +1 -1
- package/dist/types/index.d.ts +8 -4
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/lib/injection-engine/SkillRegistry.d.ts +98 -0
- package/dist/types/lib/injection-engine/SkillRegistry.d.ts.map +1 -1
- package/dist/types/lib/injection-engine/factories/defineSkill.d.ts +33 -6
- package/dist/types/lib/injection-engine/factories/defineSkill.d.ts.map +1 -1
- package/dist/types/lib/injection-engine/index.d.ts +5 -3
- package/dist/types/lib/injection-engine/index.d.ts.map +1 -1
- package/dist/types/lib/injection-engine/skillTools.d.ts +73 -0
- package/dist/types/lib/injection-engine/skillTools.d.ts.map +1 -0
- package/dist/types/lib/injection-engine/types.d.ts +18 -0
- package/dist/types/lib/injection-engine/types.d.ts.map +1 -1
- package/dist/types/lib/lazyRequire.d.ts +30 -0
- package/dist/types/lib/lazyRequire.d.ts.map +1 -0
- package/dist/types/lib/mcp/mcpClient.d.ts.map +1 -1
- package/dist/types/llm-providers.d.ts +31 -0
- package/dist/types/llm-providers.d.ts.map +1 -0
- package/dist/types/locales/index.d.ts +133 -0
- package/dist/types/locales/index.d.ts.map +1 -0
- package/dist/types/memory-providers.d.ts +41 -0
- package/dist/types/memory-providers.d.ts.map +1 -0
- package/dist/types/providers.d.ts +11 -0
- package/dist/types/providers.d.ts.map +1 -1
- package/dist/types/recorders/core/contextEngineering.d.ts +137 -0
- package/dist/types/recorders/core/contextEngineering.d.ts.map +1 -0
- package/dist/types/recorders/observability/commentary/commentaryTemplates.d.ts.map +1 -1
- package/dist/types/security/PermissionPolicy.d.ts +125 -0
- package/dist/types/security/PermissionPolicy.d.ts.map +1 -0
- package/dist/types/security/index.d.ts +40 -0
- package/dist/types/security/index.d.ts.map +1 -0
- package/dist/types/tool-providers/gatedTools.d.ts +37 -0
- package/dist/types/tool-providers/gatedTools.d.ts.map +1 -0
- package/dist/types/tool-providers/index.d.ts +42 -0
- package/dist/types/tool-providers/index.d.ts.map +1 -0
- package/dist/types/tool-providers/skillScopedTools.d.ts +46 -0
- package/dist/types/tool-providers/skillScopedTools.d.ts.map +1 -0
- package/dist/types/tool-providers/staticTools.d.ts +22 -0
- package/dist/types/tool-providers/staticTools.d.ts.map +1 -0
- package/dist/types/tool-providers/types.d.ts +103 -0
- package/dist/types/tool-providers/types.d.ts.map +1 -0
- package/package.json +36 -2
|
@@ -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,CAAC;CAC/B;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;;;OAKG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB;;;;;;OAMG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED;;;;;;;GAOG;AACH,qBAAa,iBAAkB,SAAQ,KAAK;IAC1C,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,KAAK,EAAE,YAAY,GAAG,iBAAiB,CAAC;IACjD,SAAkB,KAAK,CAAC,EAAE,OAAO,CAAC;gBAGhC,OAAO,EAAE,MAAM,EACf,IAAI,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,YAAY,GAAG,iBAAiB,CAAC;QAAC,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE;CAQxF;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,kBAAkB,CAAC,OAAO,CAAC,GAAG,MAAM,CAOnF;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,kBAAkB,CAAC,CAAC,CAAC,GAAG,CAAC,CAmBlF"}
|
|
@@ -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,
|
|
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;
|
|
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"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -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, resolveSurfaceMode, SkillRegistry, type DefineSkillOptions, type SurfaceMode, type RefreshPolicy, 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;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAOH,YAAY,EAEV,gBAAgB,EAChB,QAAQ,EACR,YAAY,EACZ,YAAY,EAEZ,UAAU,EACV,SAAS,EACT,WAAW,EACX,UAAU,EACV,UAAU,EAEV,cAAc,EACd,aAAa,EACb,iBAAiB,EACjB,aAAa,EACb,iBAAiB,EACjB,gBAAgB,EAChB,0BAA0B,EAC1B,aAAa,EACb,cAAc,EACd,cAAc,EACd,gBAAgB,EAEhB,SAAS,EAET,eAAe,EACf,eAAe,GAChB,MAAM,aAAa,CAAC;AAGrB,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,C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UAAU,EACf,KAAK,kBAAkB,EACvB,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACvB,KAAK,QAAQ,EACb,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EAIxB,aAAa,EACb,YAAY,EACZ,iBAAiB,EACjB,KAAK,cAAc,EACnB,KAAK,QAAQ,GACd,MAAM,mBAAmB,CAAC;AAK3B,OAAO,EACL,SAAS,EACT,KAAK,gBAAgB,EACrB,cAAc,EACd,KAAK,qBAAqB,EAC1B,KAAK,WAAW,GACjB,MAAM,oBAAoB,CAAC;AAM5B,OAAO,EACL,SAAS,EACT,aAAa,EACb,KAAK,SAAS,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"}
|
|
@@ -24,8 +24,51 @@
|
|
|
24
24
|
* registry.register(complianceSkill);
|
|
25
25
|
*/
|
|
26
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
|
+
}
|
|
27
59
|
export declare class SkillRegistry {
|
|
28
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;
|
|
29
72
|
/**
|
|
30
73
|
* Register a skill. Throws if `skill.flavor !== 'skill'` or if a
|
|
31
74
|
* skill with the same id is already registered (use `.replace(...)`
|
|
@@ -46,5 +89,60 @@ export declare class SkillRegistry {
|
|
|
46
89
|
get size(): number;
|
|
47
90
|
/** Drop all registrations. */
|
|
48
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'>;
|
|
49
147
|
}
|
|
50
148
|
//# sourceMappingURL=SkillRegistry.d.ts.map
|
|
@@ -1 +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;
|
|
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,iB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,CAAC,EAAE,MAAM,GACb,OAAO,CAAC,WAAW,EAAE,MAAM,CAAC;CAuBhC"}
|
|
@@ -43,12 +43,13 @@ import type { Tool } from '../../../core/tools.js';
|
|
|
43
43
|
* - `'auto'` — the library picks per provider via `resolveSurfaceMode`.
|
|
44
44
|
* `'both'` on Claude ≥ 3.5; `'tool-only'` everywhere else.
|
|
45
45
|
*
|
|
46
|
-
* **
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
46
|
+
* **v2.5 runtime dispatch (Block C):** modes now route differently:
|
|
47
|
+
* - `'system-prompt'` → body in system slot, tool result is confirmation
|
|
48
|
+
* - `'tool-only'` → body SUPPRESSED from system slot, tool result IS the body
|
|
49
|
+
* - `'both'` → body in system slot AND in tool result
|
|
50
|
+
* - `'auto'` → keeps v2.4 behavior (body in system slot, tool result is confirmation)
|
|
51
|
+
* The Block A4 cascade resolves `'auto'` against provider/model context
|
|
52
|
+
* at a future runtime layer (Claude ≥ 3.5 → `'both'`; else `'tool-only'`).
|
|
52
53
|
*/
|
|
53
54
|
export type SurfaceMode = 'auto' | 'system-prompt' | 'tool-only' | 'both';
|
|
54
55
|
/**
|
|
@@ -101,7 +102,33 @@ export interface DefineSkillOptions {
|
|
|
101
102
|
* long-context attention decay. Default: undefined (no refresh).
|
|
102
103
|
*/
|
|
103
104
|
readonly refreshPolicy?: RefreshPolicy;
|
|
105
|
+
/**
|
|
106
|
+
* Per-skill tool gating intent. Block A5 / v2.5.
|
|
107
|
+
*
|
|
108
|
+
* - `'currentSkill'` — when this Skill is the only active one, the
|
|
109
|
+
* agent's tool list should narrow to this Skill's `tools` (plus
|
|
110
|
+
* the consumer-composed baseline). Used with
|
|
111
|
+
* `skillScopedTools(id, tools)` from `agentfootprint/tool-providers`
|
|
112
|
+
* to materialize the gate. Block C wires this into the runtime
|
|
113
|
+
* automatically.
|
|
114
|
+
* - `undefined` (default) — current additive behavior: this Skill's
|
|
115
|
+
* tools are added to the agent's registry on activation, alongside
|
|
116
|
+
* every other tool already registered.
|
|
117
|
+
*
|
|
118
|
+
* The field is a forward-compat marker today: the metadata stores
|
|
119
|
+
* it; consumers can read `skill.metadata.autoActivate` to drive
|
|
120
|
+
* their own ToolProvider composition. v2.5 runtime wiring builds
|
|
121
|
+
* on this contract without API change.
|
|
122
|
+
*/
|
|
123
|
+
readonly autoActivate?: AutoActivateMode;
|
|
104
124
|
}
|
|
125
|
+
/**
|
|
126
|
+
* Per-skill tool gating mode. See `DefineSkillOptions.autoActivate`.
|
|
127
|
+
*
|
|
128
|
+
* Reserved future values: `'always'` (always show this Skill's tools
|
|
129
|
+
* regardless of activation), `'group'` (gate by a named skill group).
|
|
130
|
+
*/
|
|
131
|
+
export type AutoActivateMode = 'currentSkill';
|
|
105
132
|
/**
|
|
106
133
|
* Resolve `surfaceMode: 'auto'` to a concrete mode based on provider
|
|
107
134
|
* + model. The defaults match the per-provider attention profile
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defineSkill.d.ts","sourceRoot":"","sources":["../../../../../src/lib/injection-engine/factories/defineSkill.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAEnD
|
|
1
|
+
{"version":3,"file":"defineSkill.d.ts","sourceRoot":"","sources":["../../../../../src/lib/injection-engine/factories/defineSkill.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAEnD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,eAAe,GAAG,WAAW,GAAG,MAAM,CAAC;AAE1E;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,aAAa;IAC5B;;;;OAIG;IACH,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B;;;OAGG;IACH,QAAQ,CAAC,GAAG,EAAE,aAAa,CAAC;CAC7B;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,gEAAgE;IAChE,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,8DAA8D;IAC9D,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,uEAAuE;IACvE,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,IAAI,EAAE,CAAC;IACjC;;;;OAIG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B;;;OAGG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,WAAW,CAAC;IACnC;;;OAGG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,aAAa,CAAC;IACvC;;;;;;;;;;;;;;;;;OAiBG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,gBAAgB,CAAC;CAC1C;AAED;;;;;GAKG;AACH,MAAM,MAAM,gBAAgB,GAAG,cAAc,CAAC;AAE9C;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,WAAW,CAahF;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,kBAAkB,GAAG,SAAS,CAkC/D"}
|
|
@@ -5,12 +5,14 @@
|
|
|
5
5
|
* One `Injection` type. One `InjectionEngine` subflow. N typed sugar
|
|
6
6
|
* factories. See `README.md` in this folder for the full concept.
|
|
7
7
|
*/
|
|
8
|
-
export type { Injection, InjectionTrigger, InjectionContent, InjectionContext, InjectionEvaluation, } from './types.js';
|
|
8
|
+
export type { Injection, InjectionTrigger, InjectionContent, InjectionContext, InjectionEvaluation, ActiveInjection, } from './types.js';
|
|
9
|
+
export { projectActiveInjection } from './types.js';
|
|
9
10
|
export { evaluateInjections } from './evaluator.js';
|
|
10
11
|
export { buildInjectionEngineSubflow, type InjectionEngineConfig, } from './buildInjectionEngineSubflow.js';
|
|
11
12
|
export { defineInstruction, type DefineInstructionOptions } from './factories/defineInstruction.js';
|
|
12
|
-
export { defineSkill, resolveSurfaceMode, type DefineSkillOptions, type SurfaceMode, type RefreshPolicy, } from './factories/defineSkill.js';
|
|
13
|
-
export { SkillRegistry } from './SkillRegistry.js';
|
|
13
|
+
export { defineSkill, resolveSurfaceMode, type DefineSkillOptions, type SurfaceMode, type RefreshPolicy, type AutoActivateMode, } from './factories/defineSkill.js';
|
|
14
|
+
export { SkillRegistry, type SkillRegistryOptions } from './SkillRegistry.js';
|
|
15
|
+
export { buildListSkillsTool, buildReadSkillTool, type SkillToolPair } from './skillTools.js';
|
|
14
16
|
export { defineSteering, type DefineSteeringOptions } from './factories/defineSteering.js';
|
|
15
17
|
export { defineFact, type DefineFactOptions } from './factories/defineFact.js';
|
|
16
18
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -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,
|
|
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;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"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Skill-tool builders — shared source of truth for `list_skills` and
|
|
3
|
+
* `read_skill` tools used by the Agent's auto-attach path AND by
|
|
4
|
+
* `SkillRegistry.toTools()` (explicit composition path).
|
|
5
|
+
*
|
|
6
|
+
* Both tools work over the SAME catalog (a list of `Injection` skills).
|
|
7
|
+
* Pulling them out of `core/Agent.ts` removes the v2.4 duplication
|
|
8
|
+
* risk: the Agent auto-attaches its own `read_skill`, the registry
|
|
9
|
+
* builds a sibling — they MUST agree on schema + execute semantics.
|
|
10
|
+
*
|
|
11
|
+
* Pattern: pure builder functions over an `Injection[]` catalog.
|
|
12
|
+
* Tool execute is identity-style (returns confirmation
|
|
13
|
+
* string); the agent's tool-calls subflow inspects the
|
|
14
|
+
* tool name + args and updates `scope.activatedInjectionIds`
|
|
15
|
+
* so the next iteration's InjectionEngine sees the new
|
|
16
|
+
* activation.
|
|
17
|
+
*
|
|
18
|
+
* Closes Neo gap #3 (of 8) by making the LLM-facing skill discovery
|
|
19
|
+
* surface composable — consumers can plug `listSkills` / `readSkill`
|
|
20
|
+
* into their own ToolProvider chain (e.g., gatedTools → permission
|
|
21
|
+
* filter → static + skill-tools).
|
|
22
|
+
*/
|
|
23
|
+
import type { Tool } from '../../core/tools.js';
|
|
24
|
+
import type { Injection } from './types.js';
|
|
25
|
+
/**
|
|
26
|
+
* Build the `list_skills` tool — a no-arg tool that returns the
|
|
27
|
+
* registered skills as `{ id, description }[]`. Lets the LLM discover
|
|
28
|
+
* skills without paying the prompt-token cost of embedding the
|
|
29
|
+
* catalog into every system prompt.
|
|
30
|
+
*
|
|
31
|
+
* Pairs with `read_skill` (which actually activates a skill by id).
|
|
32
|
+
*
|
|
33
|
+
* Returns `undefined` when there are no skills — callers should
|
|
34
|
+
* guard or filter undefined out of their tool list.
|
|
35
|
+
*/
|
|
36
|
+
export declare function buildListSkillsTool(skills: readonly Injection[]): Tool | undefined;
|
|
37
|
+
/**
|
|
38
|
+
* Build the `read_skill` tool — activates a skill for the next
|
|
39
|
+
* iteration. The LLM picks WHICH skill via the `id` argument.
|
|
40
|
+
*
|
|
41
|
+
* Tool execute() returns a confirmation string. The actual bookkeeping
|
|
42
|
+
* (appending the requested skill id to `scope.activatedInjectionIds`)
|
|
43
|
+
* is handled by the Agent's tool-calls subflow, which inspects every
|
|
44
|
+
* `read_skill` tool call by name. The next iteration's InjectionEngine
|
|
45
|
+
* matches Skills with `trigger.kind: 'llm-activated'` by id and
|
|
46
|
+
* includes them in the active set; slot subflows then inject the body
|
|
47
|
+
* + tools.
|
|
48
|
+
*
|
|
49
|
+
* The tool's description lists each Skill's `id` + `description` so
|
|
50
|
+
* the LLM can choose meaningfully without first calling `list_skills`
|
|
51
|
+
* (a perf trade-off — small registries can afford the inline catalog;
|
|
52
|
+
* large ones should use `list_skills` for discovery and rely on the
|
|
53
|
+
* shorter `read_skill` description.) See `surfaceMode` (Block A4) for
|
|
54
|
+
* tunable trade-offs.
|
|
55
|
+
*
|
|
56
|
+
* Returns `undefined` when there are no skills — callers should
|
|
57
|
+
* guard or filter undefined out of their tool list.
|
|
58
|
+
*/
|
|
59
|
+
export declare function buildReadSkillTool(skills: readonly Injection[]): Tool | undefined;
|
|
60
|
+
/**
|
|
61
|
+
* The pair returned by `SkillRegistry.toTools()`. Either entry may be
|
|
62
|
+
* undefined when the registry is empty. Consumers typically destructure:
|
|
63
|
+
*
|
|
64
|
+
* const { listSkills, readSkill } = registry.toTools();
|
|
65
|
+
* const tools = [listSkills, readSkill, ...other].filter(Boolean) as Tool[];
|
|
66
|
+
*/
|
|
67
|
+
export interface SkillToolPair {
|
|
68
|
+
/** The `list_skills` tool, or `undefined` if registry is empty. */
|
|
69
|
+
readonly listSkills: Tool | undefined;
|
|
70
|
+
/** The `read_skill` tool, or `undefined` if registry is empty. */
|
|
71
|
+
readonly readSkill: Tool | undefined;
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=skillTools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skillTools.d.ts","sourceRoot":"","sources":["../../../../src/lib/injection-engine/skillTools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAGH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,SAAS,SAAS,EAAE,GAAG,IAAI,GAAG,SAAS,CAqBlF;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,SAAS,SAAS,EAAE,GAAG,IAAI,GAAG,SAAS,CAwDjF;AAED;;;;;;GAMG;AACH,MAAM,WAAW,aAAa;IAC5B,mEAAmE;IACnE,QAAQ,CAAC,UAAU,EAAE,IAAI,GAAG,SAAS,CAAC;IACtC,kEAAkE;IAClE,QAAQ,CAAC,SAAS,EAAE,IAAI,GAAG,SAAS,CAAC;CACtC"}
|
|
@@ -167,6 +167,24 @@ export interface ActiveInjection {
|
|
|
167
167
|
readonly id: string;
|
|
168
168
|
readonly flavor: import('../../events/types.js').ContextSource;
|
|
169
169
|
readonly description?: string;
|
|
170
|
+
/**
|
|
171
|
+
* Resolved surfaceMode (Skill flavor only). Drives Block C runtime
|
|
172
|
+
* dispatch — slot subflows skip system-slot injection when this is
|
|
173
|
+
* `'tool-only'`; the read_skill tool delivers the body in its
|
|
174
|
+
* result for `'tool-only'` and `'both'`.
|
|
175
|
+
*
|
|
176
|
+
* `'auto'` and absent both mean "keep v2.4 behavior" (body in
|
|
177
|
+
* system slot, tool result is confirmation only). The Block A4
|
|
178
|
+
* cascade resolves 'auto' against provider/model context at a
|
|
179
|
+
* later layer; this projection stays declarative.
|
|
180
|
+
*/
|
|
181
|
+
readonly surfaceMode?: 'auto' | 'system-prompt' | 'tool-only' | 'both';
|
|
182
|
+
/**
|
|
183
|
+
* Per-skill tool gating intent (Skill flavor only). Reserved for
|
|
184
|
+
* Block C+ runtime auto-wiring of `skillScopedTools`. Today
|
|
185
|
+
* consumers wire this manually via `agentfootprint/tool-providers`.
|
|
186
|
+
*/
|
|
187
|
+
readonly autoActivate?: 'currentSkill';
|
|
170
188
|
readonly inject: {
|
|
171
189
|
readonly systemPrompt?: string;
|
|
172
190
|
readonly messages?: ReadonlyArray<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/lib/injection-engine/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAIxE;;;;GAIG;AACH,MAAM,MAAM,gBAAgB;AAC1B,yDAAyD;AACv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a,CAAC;YAC7B,QAAQ,CAAC,MAAM,EAAE,OAAO,yBAAyB,EAAE,aAAa,CAAC;YACjE,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;SAC9B,CAAC,CAAC;KACJ,CAAC;CACH;AAED,wEAAwE;AACxE,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,SAAS,GAAG,eAAe,CAyBtE"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* lazyRequire — module-path-indirect `require()` wrapper for lazy
|
|
3
|
+
* peer-dep loading.
|
|
4
|
+
*
|
|
5
|
+
* Why a wrapper: bundlers (Vite, esbuild, webpack, Rollup) statically
|
|
6
|
+
* analyze `require('literal-string')` calls and try to resolve the
|
|
7
|
+
* dependency at BUILD time — even when the function is never called
|
|
8
|
+
* at runtime. For optional peer-deps (`@modelcontextprotocol/sdk`,
|
|
9
|
+
* `@anthropic-ai/sdk`, `ioredis`, `@aws-sdk/client-bedrock-*`), this
|
|
10
|
+
* means consumers who never instantiate the matching adapter still
|
|
11
|
+
* get a build error if the peer-dep isn't installed.
|
|
12
|
+
*
|
|
13
|
+
* Wrapping the call in a function with a string PARAMETER hides the
|
|
14
|
+
* specifier from static analysis. At runtime this is exactly the
|
|
15
|
+
* same as inline `require()`, including the throwing behavior when
|
|
16
|
+
* the peer-dep isn't installed.
|
|
17
|
+
*
|
|
18
|
+
* Pattern: indirect require — used by Node's `createRequire`-style
|
|
19
|
+
* fallbacks for the same reason.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* try {
|
|
23
|
+
* const mod = lazyRequire<typeof import('ioredis')>('ioredis');
|
|
24
|
+
* this._client = new mod.default(...);
|
|
25
|
+
* } catch {
|
|
26
|
+
* throw new Error('install ioredis to use RedisStore');
|
|
27
|
+
* }
|
|
28
|
+
*/
|
|
29
|
+
export declare function lazyRequire<T = unknown>(specifier: string): T;
|
|
30
|
+
//# sourceMappingURL=lazyRequire.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lazyRequire.d.ts","sourceRoot":"","sources":["../../../src/lib/lazyRequire.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,WAAW,CAAC,CAAC,GAAG,OAAO,EAAE,SAAS,EAAE,MAAM,GAAG,CAAC,CAG7D"}
|
|
@@ -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;
|
|
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"}
|