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.
- package/README.md +293 -247
- 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 +493 -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 +492 -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 +181 -0
- package/dist/esm/lib/injection-engine/SkillRegistry.js.map +1 -0
- package/dist/esm/lib/injection-engine/factories/defineSkill.js +35 -0
- package/dist/esm/lib/injection-engine/factories/defineSkill.js.map +1 -1
- package/dist/esm/lib/injection-engine/index.js +9 -1
- 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 +57 -12
- package/dist/index.js.map +1 -1
- package/dist/lib/injection-engine/SkillRegistry.js +185 -0
- package/dist/lib/injection-engine/SkillRegistry.js.map +1 -0
- package/dist/lib/injection-engine/factories/defineSkill.js +37 -1
- package/dist/lib/injection-engine/factories/defineSkill.js.map +1 -1
- package/dist/lib/injection-engine/index.js +14 -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 +216 -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 +148 -0
- package/dist/types/lib/injection-engine/SkillRegistry.d.ts.map +1 -0
- package/dist/types/lib/injection-engine/factories/defineSkill.d.ts +99 -0
- package/dist/types/lib/injection-engine/factories/defineSkill.d.ts.map +1 -1
- package/dist/types/lib/injection-engine/index.d.ts +5 -2
- 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 +28 -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 +62 -9
- package/README.proposed.md +0 -258
- package/dist/instructions.js +0 -21
- package/dist/instructions.js.map +0 -1
- package/dist/lib/instructions/defineInstruction.js +0 -35
- package/dist/lib/instructions/defineInstruction.js.map +0 -1
- package/dist/lib/instructions/evaluator.js +0 -38
- package/dist/lib/instructions/evaluator.js.map +0 -1
- package/dist/lib/instructions/index.js +0 -48
- package/dist/lib/instructions/index.js.map +0 -1
- package/dist/lib/instructions/types.js +0 -22
- package/dist/lib/instructions/types.js.map +0 -1
- package/dist/memory/conversationHelpers.js +0 -39
- package/dist/memory/conversationHelpers.js.map +0 -1
- package/dist/types/instructions.d.ts +0 -5
- package/dist/types/instructions.d.ts.map +0 -1
- package/dist/types/lib/instructions/defineInstruction.d.ts +0 -22
- package/dist/types/lib/instructions/defineInstruction.d.ts.map +0 -1
- package/dist/types/lib/instructions/evaluator.d.ts +0 -11
- package/dist/types/lib/instructions/evaluator.d.ts.map +0 -1
- package/dist/types/lib/instructions/index.d.ts +0 -44
- package/dist/types/lib/instructions/index.d.ts.map +0 -1
- package/dist/types/lib/instructions/types.d.ts +0 -100
- package/dist/types/lib/instructions/types.d.ts.map +0 -1
- package/dist/types/memory/conversationHelpers.d.ts +0 -19
- package/dist/types/memory/conversationHelpers.d.ts.map +0 -1
|
@@ -28,6 +28,56 @@
|
|
|
28
28
|
*/
|
|
29
29
|
import type { Injection } from '../types.js';
|
|
30
30
|
import type { Tool } from '../../../core/tools.js';
|
|
31
|
+
/**
|
|
32
|
+
* Where the Skill's body lands when activated.
|
|
33
|
+
*
|
|
34
|
+
* - `'system-prompt'` — body appended to the system slot on the
|
|
35
|
+
* iteration after activation. Best on Claude ≥ 3.5 (training-time
|
|
36
|
+
* adherence to system-prompt instructions is strong).
|
|
37
|
+
* - `'tool-only'` — body delivered ONLY via the `read_skill` tool's
|
|
38
|
+
* result. Recency-first by protocol; doesn't rely on the model's
|
|
39
|
+
* training to honor system-prompt anchoring. Default for every
|
|
40
|
+
* non-Claude provider.
|
|
41
|
+
* - `'both'` — body lands in both the system slot AND the tool result.
|
|
42
|
+
* Belt-and-suspenders for high-stakes Skills on long-context runs.
|
|
43
|
+
* - `'auto'` — the library picks per provider via `resolveSurfaceMode`.
|
|
44
|
+
* `'both'` on Claude ≥ 3.5; `'tool-only'` everywhere else.
|
|
45
|
+
*
|
|
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'`).
|
|
53
|
+
*/
|
|
54
|
+
export type SurfaceMode = 'auto' | 'system-prompt' | 'tool-only' | 'both';
|
|
55
|
+
/**
|
|
56
|
+
* When (if ever) to re-deliver a Skill's body in long-running runs.
|
|
57
|
+
*
|
|
58
|
+
* Even on providers with strong system-prompt adherence, attention to
|
|
59
|
+
* the system slot decays past long contexts. `refreshPolicy` re-injects
|
|
60
|
+
* the body via tool result past a token threshold so the LLM sees it
|
|
61
|
+
* fresh again.
|
|
62
|
+
*
|
|
63
|
+
* **v2.4 status:** the field is reserved + typed; the runtime hook
|
|
64
|
+
* lands in v2.5 as part of the long-context attention work. Specifying
|
|
65
|
+
* `refreshPolicy` today is non-breaking — the engine ignores it until
|
|
66
|
+
* the hook is implemented.
|
|
67
|
+
*/
|
|
68
|
+
export interface RefreshPolicy {
|
|
69
|
+
/**
|
|
70
|
+
* Re-inject the Skill body once the run has consumed this many input
|
|
71
|
+
* tokens since the Skill was last surfaced. Recommended: 50_000 for
|
|
72
|
+
* 200k-context models; 20_000 for 32k-context models.
|
|
73
|
+
*/
|
|
74
|
+
readonly afterTokens: number;
|
|
75
|
+
/**
|
|
76
|
+
* How to re-inject. `'tool-result'` synthesizes a fresh tool result
|
|
77
|
+
* carrying the body text (recency-first). Other modes reserved.
|
|
78
|
+
*/
|
|
79
|
+
readonly via: 'tool-result';
|
|
80
|
+
}
|
|
31
81
|
export interface DefineSkillOptions {
|
|
32
82
|
readonly id: string;
|
|
33
83
|
/** Visible to the LLM via the activation tool's description. */
|
|
@@ -42,6 +92,55 @@ export interface DefineSkillOptions {
|
|
|
42
92
|
* the LLM picks WHICH skill via the tool's argument.
|
|
43
93
|
*/
|
|
44
94
|
readonly viaToolName?: string;
|
|
95
|
+
/**
|
|
96
|
+
* Where the body lands when activated. See `SurfaceMode`. Default
|
|
97
|
+
* `'auto'` — the library resolves per provider via `resolveSurfaceMode`.
|
|
98
|
+
*/
|
|
99
|
+
readonly surfaceMode?: SurfaceMode;
|
|
100
|
+
/**
|
|
101
|
+
* Re-deliver the body past a token threshold to defend against
|
|
102
|
+
* long-context attention decay. Default: undefined (no refresh).
|
|
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;
|
|
45
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';
|
|
132
|
+
/**
|
|
133
|
+
* Resolve `surfaceMode: 'auto'` to a concrete mode based on provider
|
|
134
|
+
* + model. The defaults match the per-provider attention profile
|
|
135
|
+
* documented in the Skills, explained essay:
|
|
136
|
+
*
|
|
137
|
+
* - Claude >= 3.5 → 'both' (cheap to cache, high adherence)
|
|
138
|
+
* - Claude pre-3.5 → 'tool-only' (recency-first more reliable)
|
|
139
|
+
* - OpenAI / Bedrock / Ollama / Mock / unknown → 'tool-only'
|
|
140
|
+
*
|
|
141
|
+
* Pure function — no side effects. Consumers can call directly to
|
|
142
|
+
* inspect what `'auto'` will resolve to in their stack.
|
|
143
|
+
*/
|
|
144
|
+
export declare function resolveSurfaceMode(provider: string, model?: string): SurfaceMode;
|
|
46
145
|
export declare function defineSkill(opts: DefineSkillOptions): Injection;
|
|
47
146
|
//# sourceMappingURL=defineSkill.d.ts.map
|
|
@@ -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;A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AC,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,11 +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, type DefineSkillOptions } from './factories/defineSkill.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';
|
|
13
16
|
export { defineSteering, type DefineSteeringOptions } from './factories/defineSteering.js';
|
|
14
17
|
export { defineFact, type DefineFactOptions } from './factories/defineFact.js';
|
|
15
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"}
|
|
@@ -131,6 +131,16 @@ export interface Injection {
|
|
|
131
131
|
readonly trigger: InjectionTrigger;
|
|
132
132
|
/** WHAT to contribute (one or more slots). */
|
|
133
133
|
readonly inject: InjectionContent;
|
|
134
|
+
/**
|
|
135
|
+
* Optional flavor-specific metadata. Engine ignores keys it doesn't
|
|
136
|
+
* recognize; flavor factories use this for opt-in fields without
|
|
137
|
+
* widening the Injection contract.
|
|
138
|
+
*
|
|
139
|
+
* Known keys:
|
|
140
|
+
* - `surfaceMode` (Skill) — `'auto' | 'system-prompt' | 'tool-only' | 'both'`
|
|
141
|
+
* - `refreshPolicy` (Skill) — `{ afterTokens, via }`
|
|
142
|
+
*/
|
|
143
|
+
readonly metadata?: Readonly<Record<string, unknown>>;
|
|
134
144
|
}
|
|
135
145
|
/**
|
|
136
146
|
* Returned by `evaluateInjections()`. Slot subflows consume `active`;
|
|
@@ -157,6 +167,24 @@ export interface ActiveInjection {
|
|
|
157
167
|
readonly id: string;
|
|
158
168
|
readonly flavor: import('../../events/types.js').ContextSource;
|
|
159
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';
|
|
160
188
|
readonly inject: {
|
|
161
189
|
readonly systemPrompt?: string;
|
|
162
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;AACvD;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAA;CAAE;AAC7B,wDAAwD;GACtD;IACE,QAAQ,CAAC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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"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* agentfootprint/llm-providers — LLM provider adapters (canonical subpath).
|
|
3
|
+
*
|
|
4
|
+
* The Block B canonical name. Mirrors the parallel structure shipped in
|
|
5
|
+
* v2.5:
|
|
6
|
+
*
|
|
7
|
+
* agentfootprint/llm-providers ← LLM provider adapters (this file)
|
|
8
|
+
* agentfootprint/tool-providers ← tool dispatch + tool sources
|
|
9
|
+
* agentfootprint/memory-providers ← memory store adapters
|
|
10
|
+
* agentfootprint/security ← cross-cutting authorization
|
|
11
|
+
*
|
|
12
|
+
* The legacy `agentfootprint/providers` subpath stays available as an
|
|
13
|
+
* alias through the v2.x line — it points at the same exports. New
|
|
14
|
+
* code SHOULD import from `agentfootprint/llm-providers` for clarity:
|
|
15
|
+
* grep'ing for "llm-providers" finds every LLM-side import in one
|
|
16
|
+
* shot, parallel to "tool-providers" and "memory-providers".
|
|
17
|
+
*
|
|
18
|
+
* Pattern: Adapter (GoF) — concrete `LLMProvider` implementations that
|
|
19
|
+
* translate the agentfootprint port to a specific vendor SDK.
|
|
20
|
+
* Role: Outer ring (Hexagonal). Swappable at runtime; the Agent
|
|
21
|
+
* knows nothing about vendor specifics.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* // New canonical import
|
|
25
|
+
* import { mock, AnthropicProvider } from 'agentfootprint/llm-providers';
|
|
26
|
+
*
|
|
27
|
+
* // Legacy alias (still works through v2.x)
|
|
28
|
+
* import { mock, AnthropicProvider } from 'agentfootprint/providers';
|
|
29
|
+
*/
|
|
30
|
+
export * from './providers.js';
|
|
31
|
+
//# sourceMappingURL=llm-providers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"llm-providers.d.ts","sourceRoot":"","sources":["../../src/llm-providers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,cAAc,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* agentfootprint/locales — Message Catalog Pattern.
|
|
3
|
+
*
|
|
4
|
+
* The Block D piece. agentfootprint emits user-facing prose at two
|
|
5
|
+
* audience levels:
|
|
6
|
+
*
|
|
7
|
+
* - **Commentary** — third-person prose for the bottom panel of any
|
|
8
|
+
* viewer (Lens, CLI tail, log files). "The agent dispatched the
|
|
9
|
+
* refund tool, which returned successfully."
|
|
10
|
+
* - **Thinking** — first-person status for chat-bubble UIs.
|
|
11
|
+
* "Looking up your order…"
|
|
12
|
+
*
|
|
13
|
+
* v2.4 shipped these as `defaultCommentaryTemplates` and
|
|
14
|
+
* `defaultThinkingTemplates` (flat `Record<string, string>` maps with
|
|
15
|
+
* `{{var}}` substitution). The names worked but the framing was
|
|
16
|
+
* generic — "templates" collides with TypeScript / templating-engine
|
|
17
|
+
* terminology, and there was no first-class place to ship locale
|
|
18
|
+
* packs.
|
|
19
|
+
*
|
|
20
|
+
* **Block D formalizes this as the Message Catalog Pattern:**
|
|
21
|
+
*
|
|
22
|
+
* - `defaultCommentaryMessages` / `defaultThinkingMessages` —
|
|
23
|
+
* canonical English bundles. Aliases of the v2.4 names; symbol
|
|
24
|
+
* identity preserved (`defaultCommentaryMessages ===
|
|
25
|
+
* defaultCommentaryTemplates`).
|
|
26
|
+
* - `composeMessages(defaults, overrides)` — spread overrides on
|
|
27
|
+
* top of defaults; missing keys fall back to the default bundle.
|
|
28
|
+
* - `validateMessages(catalog, requiredKeys)` — assert every
|
|
29
|
+
* required key is present (and non-empty). Catches drift between
|
|
30
|
+
* a consumer's locale pack and the framework's required key set.
|
|
31
|
+
*
|
|
32
|
+
* The natural consumer pattern is to ship locale packs alongside the
|
|
33
|
+
* agent code:
|
|
34
|
+
*
|
|
35
|
+
* import { defaultCommentaryMessages, composeMessages } from 'agentfootprint/locales';
|
|
36
|
+
* import { esCommentaryMessages } from './locales/es.js';
|
|
37
|
+
*
|
|
38
|
+
* const merged = composeMessages(defaultCommentaryMessages, esCommentaryMessages);
|
|
39
|
+
*
|
|
40
|
+
* const agent = Agent.create({...})
|
|
41
|
+
* .commentaryTemplates(merged)
|
|
42
|
+
* .build();
|
|
43
|
+
*
|
|
44
|
+
* Pattern: i18n locale resolution (Resource Bundle, Fowler 2002) +
|
|
45
|
+
* plain object merge for overrides. No catalog inheritance
|
|
46
|
+
* chain — overrides win OR fall back to defaults.
|
|
47
|
+
*
|
|
48
|
+
* @example Locale pack drop-in
|
|
49
|
+
* const esThinking = composeMessages(defaultThinkingMessages, {
|
|
50
|
+
* 'stream.llm_start.iter1': '{{appName}} está pensando...',
|
|
51
|
+
* 'stream.tool_start': 'Llamando a {{toolName}}...',
|
|
52
|
+
* });
|
|
53
|
+
* const agent = Agent.create({...}).thinkingTemplates(esThinking).build();
|
|
54
|
+
*
|
|
55
|
+
* @example Validate a locale pack against the framework's required keys
|
|
56
|
+
* import { defaultCommentaryMessages, validateMessages } from 'agentfootprint/locales';
|
|
57
|
+
*
|
|
58
|
+
* const myCatalog = composeMessages(defaultCommentaryMessages, customOverrides);
|
|
59
|
+
* validateMessages(myCatalog, Object.keys(defaultCommentaryMessages));
|
|
60
|
+
* // throws on first missing OR empty key — fail-fast at boot
|
|
61
|
+
*/
|
|
62
|
+
export type { CommentaryTemplates as MessageCatalog } from '../recorders/observability/commentary/commentaryTemplates.js';
|
|
63
|
+
/**
|
|
64
|
+
* Canonical English commentary bundle. Alias of v2.4's
|
|
65
|
+
* `defaultCommentaryTemplates` — same symbol, friendlier framing.
|
|
66
|
+
*
|
|
67
|
+
* Keys mirror agentfootprint event types; values may contain
|
|
68
|
+
* `{{var}}` placeholders for runtime substitution.
|
|
69
|
+
*/
|
|
70
|
+
export declare const defaultCommentaryMessages: Readonly<Record<string, string>>;
|
|
71
|
+
/**
|
|
72
|
+
* Canonical English thinking bundle. Alias of v2.4's
|
|
73
|
+
* `defaultThinkingTemplates`.
|
|
74
|
+
*
|
|
75
|
+
* Keys mirror agentfootprint event types; values may contain
|
|
76
|
+
* `{{var}}` placeholders for runtime substitution.
|
|
77
|
+
*/
|
|
78
|
+
export declare const defaultThinkingMessages: Readonly<Record<string, string>>;
|
|
79
|
+
/**
|
|
80
|
+
* Spread `overrides` on top of `defaults` so every key in `defaults`
|
|
81
|
+
* has a value (the override or the original). The result is a fresh
|
|
82
|
+
* object — neither input is mutated.
|
|
83
|
+
*
|
|
84
|
+
* Missing override keys fall back to the default; extra override
|
|
85
|
+
* keys are preserved (forward-compat for consumer-defined keys).
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
* const merged = composeMessages(defaultCommentaryMessages, {
|
|
89
|
+
* 'stream.llm_start.iter1': 'My custom thinking line',
|
|
90
|
+
* });
|
|
91
|
+
*/
|
|
92
|
+
export declare function composeMessages<T extends Readonly<Record<string, string>>>(defaults: T, overrides?: Readonly<Record<string, string>>): Readonly<Record<string, string>>;
|
|
93
|
+
/**
|
|
94
|
+
* Validation options for `validateMessages`.
|
|
95
|
+
*/
|
|
96
|
+
export interface ValidateMessagesOptions {
|
|
97
|
+
/**
|
|
98
|
+
* Optional label for the error message (e.g., `'es-MX commentary'`).
|
|
99
|
+
* Defaults to `'message catalog'`.
|
|
100
|
+
*/
|
|
101
|
+
readonly label?: string;
|
|
102
|
+
/**
|
|
103
|
+
* When `true`, empty-string values FAIL validation (treated like a
|
|
104
|
+
* missing key). When `false` (default), empty strings are valid —
|
|
105
|
+
* the framework's default catalogs intentionally use empty values
|
|
106
|
+
* for events the consumer should skip rendering for.
|
|
107
|
+
*/
|
|
108
|
+
readonly forbidEmpty?: boolean;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Assert that every key in `requiredKeys` is present in `catalog`.
|
|
112
|
+
* Throws an Error listing every missing key — batched so consumers
|
|
113
|
+
* fix all at once instead of error-by-error.
|
|
114
|
+
*
|
|
115
|
+
* Useful at boot to catch drift between a consumer's locale pack and
|
|
116
|
+
* the framework's required key set.
|
|
117
|
+
*
|
|
118
|
+
* Empty-string values are VALID by default — the framework's default
|
|
119
|
+
* catalogs use `''` to signal "render nothing for this event."
|
|
120
|
+
* Pass `{ forbidEmpty: true }` to also reject empty values.
|
|
121
|
+
*
|
|
122
|
+
* @param catalog The (composed) message catalog to validate.
|
|
123
|
+
* @param requiredKeys The keys consumers must define. Typically
|
|
124
|
+
* `Object.keys(defaultCommentaryMessages)` or
|
|
125
|
+
* `Object.keys(defaultThinkingMessages)`.
|
|
126
|
+
* @param opts Optional `{ label, forbidEmpty }` (or a bare
|
|
127
|
+
* string label for back-compat with simple use).
|
|
128
|
+
*
|
|
129
|
+
* @throws Error when any required key is missing (or empty under
|
|
130
|
+
* `forbidEmpty`).
|
|
131
|
+
*/
|
|
132
|
+
export declare function validateMessages(catalog: Readonly<Record<string, string>>, requiredKeys: readonly string[], opts?: ValidateMessagesOptions | string): void;
|
|
133
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/locales/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4DG;AAKH,YAAY,EAAE,mBAAmB,IAAI,cAAc,EAAE,MAAM,8DAA8D,CAAC;AAE1H;;;;;;GAMG;AACH,eAAO,MAAM,yBAAyB,kCAA6B,CAAC;AAEpE;;;;;;GAMG;AACH,eAAO,MAAM,uBAAuB,kCAA2B,CAAC;AAEhE;;;;;;;;;;;;GAYG;AACH,wBAAgB,eAAe,CAAC,CAAC,SAAS,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,EACxE,QAAQ,EAAE,CAAC,EACX,SAAS,GAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAM,GAC/C,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAElC;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC;;;OAGG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB;;;;;OAKG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC;CAChC;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,EACzC,YAAY,EAAE,SAAS,MAAM,EAAE,EAC/B,IAAI,GAAE,uBAAuB,GAAG,MAAW,GAC1C,IAAI,CAwBN"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* agentfootprint/memory-providers — memory store adapters (canonical subpath).
|
|
3
|
+
*
|
|
4
|
+
* The Block B canonical name. Mirrors the parallel structure shipped in
|
|
5
|
+
* v2.5:
|
|
6
|
+
*
|
|
7
|
+
* agentfootprint/llm-providers ← LLM provider adapters
|
|
8
|
+
* agentfootprint/tool-providers ← tool dispatch + tool sources
|
|
9
|
+
* agentfootprint/memory-providers ← memory store adapters (this file)
|
|
10
|
+
* agentfootprint/security ← cross-cutting authorization
|
|
11
|
+
*
|
|
12
|
+
* One subpath that grows — RedisStore, AgentCoreStore, and future
|
|
13
|
+
* stores (DynamoDB, Postgres, Pinecone, …) all live here. No more
|
|
14
|
+
* adding `agentfootprint/memory-<vendor>` per-adapter subpath each
|
|
15
|
+
* time a new store ships.
|
|
16
|
+
*
|
|
17
|
+
* Per-adapter aliases (`agentfootprint/memory-redis`,
|
|
18
|
+
* `agentfootprint/memory-agentcore`) stay available through the v2.x
|
|
19
|
+
* line — they point at the same files. New code SHOULD import from
|
|
20
|
+
* `agentfootprint/memory-providers`:
|
|
21
|
+
*
|
|
22
|
+
* import { RedisStore, AgentCoreStore } from 'agentfootprint/memory-providers';
|
|
23
|
+
*
|
|
24
|
+
* Pattern: Adapter (GoF) — each store translates the `MemoryStore`
|
|
25
|
+
* interface onto a specific backend (Redis, DynamoDB-style
|
|
26
|
+
* AWS Bedrock AgentCore Memory, etc.).
|
|
27
|
+
* Role: Outer ring (Hexagonal). All store adapters lazy-require
|
|
28
|
+
* their vendor SDKs at construction time, so importing this
|
|
29
|
+
* barrel costs ZERO peer-dep load — only the stores you
|
|
30
|
+
* actually instantiate pull their SDK in.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* // New canonical import
|
|
34
|
+
* import { RedisStore } from 'agentfootprint/memory-providers';
|
|
35
|
+
*
|
|
36
|
+
* // Legacy per-adapter alias (still works through v2.x)
|
|
37
|
+
* import { RedisStore } from 'agentfootprint/memory-redis';
|
|
38
|
+
*/
|
|
39
|
+
export { RedisStore, type RedisStoreOptions, type RedisLikeClient, type RedisLikePipeline, } from './adapters/memory/redis.js';
|
|
40
|
+
export { AgentCoreStore, type AgentCoreStoreOptions, type AgentCoreLikeClient, } from './adapters/memory/agentcore.js';
|
|
41
|
+
//# sourceMappingURL=memory-providers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memory-providers.d.ts","sourceRoot":"","sources":["../../src/memory-providers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAKH,OAAO,EACL,UAAU,EACV,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,iBAAiB,GACvB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EACL,cAAc,EACd,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,GACzB,MAAM,gCAAgC,CAAC"}
|
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* agentfootprint/providers — LLM provider adapters.
|
|
3
3
|
*
|
|
4
|
+
* **DEPRECATION NOTICE (v2.5):** This subpath is now the legacy alias.
|
|
5
|
+
* The canonical name in v2.5+ is `agentfootprint/llm-providers`,
|
|
6
|
+
* matching the parallel structure (`tool-providers` /
|
|
7
|
+
* `memory-providers` / `security`). Existing imports keep working
|
|
8
|
+
* unchanged through the v2.x line; the alias is removed in v3.0.
|
|
9
|
+
*
|
|
10
|
+
* // Old (still works through v2.x):
|
|
11
|
+
* import { mock } from 'agentfootprint/providers';
|
|
12
|
+
* // New canonical:
|
|
13
|
+
* import { mock } from 'agentfootprint/llm-providers';
|
|
14
|
+
*
|
|
4
15
|
* Pattern: Adapter (GoF) — concrete `LLMProvider` implementations that
|
|
5
16
|
* translate the agentfootprint port to a specific vendor SDK.
|
|
6
17
|
* Role: Outer ring (Hexagonal). Swappable at runtime; the Agent
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"providers.d.ts","sourceRoot":"","sources":["../../src/providers.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"providers.d.ts","sourceRoot":"","sources":["../../src/providers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,EACL,YAAY,EACZ,IAAI,EACJ,KAAK,mBAAmB,EACxB,KAAK,SAAS,GACf,MAAM,gCAAgC,CAAC;AAExC,OAAO,EACL,SAAS,EACT,iBAAiB,EACjB,KAAK,wBAAwB,GAC9B,MAAM,qCAAqC,CAAC;AAE7C,OAAO,EACL,MAAM,EACN,cAAc,EACd,MAAM,EACN,KAAK,qBAAqB,GAC3B,MAAM,kCAAkC,CAAC;AAE1C,OAAO,EACL,OAAO,EACP,eAAe,EACf,KAAK,sBAAsB,GAC5B,MAAM,mCAAmC,CAAC;AAE3C,OAAO,EACL,gBAAgB,EAChB,wBAAwB,EACxB,KAAK,+BAA+B,GACrC,MAAM,4CAA4C,CAAC;AAEpD,OAAO,EACL,aAAa,EACb,qBAAqB,EACrB,KAAK,4BAA4B,GAClC,MAAM,yCAAyC,CAAC;AAEjD,OAAO,EACL,cAAc,EACd,KAAK,YAAY,EACjB,KAAK,qBAAqB,GAC3B,MAAM,kCAAkC,CAAC;AAE1C,YAAY,EACV,WAAW,EACX,UAAU,EACV,WAAW,EACX,QAAQ,EACR,UAAU,EACV,aAAa,GACd,MAAM,qBAAqB,CAAC"}
|