agentfootprint
Version:
The explainable agent framework — backtrack a wrong answer to the exact context that caused it (evidence, not guesses). Built on footprintjs.
71 lines • 4.23 kB
JavaScript
;
/**
* thinking — extended-thinking subsystem (v2.14+).
*
* **Two-layer architecture:**
*
* • CONSUMER-FACING: `ThinkingHandler` — simple function-pair
* implemented by provider authors.
* • FRAMEWORK-INTERNAL: each handler is auto-wrapped in a real
* footprintjs subflow at chart build time;
* shows in trace as own runtimeStageId.
*
* **Declared by the provider:**
*
* ```ts
* import { Agent } from 'agentfootprint';
*
* // anthropic() declares `thinkingHandler: anthropicThinkingHandler`;
* // the agent mounts it as a sub-subflow of sf-call-llm. A wrapper that
* // forwards the field (withRetry, withFallback, your own) keeps it.
* const agent = Agent.create({ provider: anthropic({...}), model: '...' })
* .build();
*
* // Opt out:
* // .thinkingHandler(null)
* // Override with a custom handler:
* // .thinkingHandler(myCustomHandler)
* ```
*
* **Custom handlers:**
*
* ```ts
* import { type ThinkingHandler } from 'agentfootprint/providers';
*
* export const geminiThinkingHandler: ThinkingHandler = {
* id: 'gemini',
* normalize(raw) { ... },
* parseChunk(chunk) { ... }, // optional
* };
* // …declared by the adapter: { name: 'gemini', thinkingHandler: geminiThinkingHandler, … }
* ```
*
* Failure isolation: handler `normalize()` throws are caught by the
* framework — emit `agentfootprint.agent.thinking_parse_failed`, drop
* the blocks, continue. Same graceful pattern as v2.11.6
* `tools.discovery_failed`.
*
* Not an import path of its own since 9.0.0. This is the implementation barrel
* behind `agentfootprint/providers`, which re-exports every name here — same
* symbols, one door. Import from the door.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.thinkingHandlerFor = exports.SHIPPED_THINKING_HANDLERS = exports.extractInlineThinking = exports.ollamaThinkingHandler = exports.openAIThinkingHandler = exports.anthropicThinkingHandler = exports.mockOpenAIRaw = exports.mockAnthropicRaw = exports.mockThinkingHandler = exports.UnsupportedThinkingError = void 0;
var errors_js_1 = require("./errors.js");
Object.defineProperty(exports, "UnsupportedThinkingError", { enumerable: true, get: function () { return errors_js_1.UnsupportedThinkingError; } });
var MockThinkingHandler_js_1 = require("./MockThinkingHandler.js");
Object.defineProperty(exports, "mockThinkingHandler", { enumerable: true, get: function () { return MockThinkingHandler_js_1.mockThinkingHandler; } });
Object.defineProperty(exports, "mockAnthropicRaw", { enumerable: true, get: function () { return MockThinkingHandler_js_1.mockAnthropicRaw; } });
Object.defineProperty(exports, "mockOpenAIRaw", { enumerable: true, get: function () { return MockThinkingHandler_js_1.mockOpenAIRaw; } });
var AnthropicThinkingHandler_js_1 = require("./AnthropicThinkingHandler.js");
Object.defineProperty(exports, "anthropicThinkingHandler", { enumerable: true, get: function () { return AnthropicThinkingHandler_js_1.anthropicThinkingHandler; } });
var OpenAIThinkingHandler_js_1 = require("./OpenAIThinkingHandler.js");
Object.defineProperty(exports, "openAIThinkingHandler", { enumerable: true, get: function () { return OpenAIThinkingHandler_js_1.openAIThinkingHandler; } });
var OllamaThinkingHandler_js_1 = require("./OllamaThinkingHandler.js");
Object.defineProperty(exports, "ollamaThinkingHandler", { enumerable: true, get: function () { return OllamaThinkingHandler_js_1.ollamaThinkingHandler; } });
Object.defineProperty(exports, "extractInlineThinking", { enumerable: true, get: function () { return OllamaThinkingHandler_js_1.extractInlineThinking; } });
var registry_js_1 = require("./registry.js");
Object.defineProperty(exports, "SHIPPED_THINKING_HANDLERS", { enumerable: true, get: function () { return registry_js_1.SHIPPED_THINKING_HANDLERS; } });
var thinkingHandlerFor_js_1 = require("./thinkingHandlerFor.js");
Object.defineProperty(exports, "thinkingHandlerFor", { enumerable: true, get: function () { return thinkingHandlerFor_js_1.thinkingHandlerFor; } });
//# sourceMappingURL=index.js.map