kagent-ts 0.1.3 → 0.1.5
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/LICENSE +68 -21
- package/README.md +27 -371
- package/dist/compression/progressive-compressor.d.ts +66 -0
- package/dist/compression/progressive-compressor.d.ts.map +1 -0
- package/dist/compression/progressive-compressor.js +367 -0
- package/dist/compression/progressive-compressor.js.map +1 -0
- package/dist/compression/types.d.ts +1 -5
- package/dist/compression/types.d.ts.map +1 -1
- package/dist/context/context-manager.d.ts +34 -15
- package/dist/context/context-manager.d.ts.map +1 -1
- package/dist/context/context-manager.js +78 -28
- package/dist/context/context-manager.js.map +1 -1
- package/dist/context/types.d.ts +20 -4
- package/dist/context/types.d.ts.map +1 -1
- package/dist/core/agent.d.ts +407 -35
- package/dist/core/agent.d.ts.map +1 -1
- package/dist/core/agent.js +685 -70
- package/dist/core/agent.js.map +1 -1
- package/dist/core/fusion-agent.d.ts +207 -0
- package/dist/core/fusion-agent.d.ts.map +1 -0
- package/dist/core/fusion-agent.js +769 -0
- package/dist/core/fusion-agent.js.map +1 -0
- package/dist/core/hooks.d.ts +19 -7
- package/dist/core/hooks.d.ts.map +1 -1
- package/dist/core/plan-solve-agent.d.ts +1 -15
- package/dist/core/plan-solve-agent.d.ts.map +1 -1
- package/dist/core/plan-solve-agent.js +144 -117
- package/dist/core/plan-solve-agent.js.map +1 -1
- package/dist/core/react-agent.d.ts +0 -13
- package/dist/core/react-agent.d.ts.map +1 -1
- package/dist/core/react-agent.js +128 -101
- package/dist/core/react-agent.js.map +1 -1
- package/dist/core/response-schema.d.ts +65 -0
- package/dist/core/response-schema.d.ts.map +1 -1
- package/dist/core/response-schema.js +174 -1
- package/dist/core/response-schema.js.map +1 -1
- package/dist/core/system-prompts.d.ts +27 -0
- package/dist/core/system-prompts.d.ts.map +1 -0
- package/dist/core/system-prompts.js +112 -0
- package/dist/core/system-prompts.js.map +1 -0
- package/dist/eval/benchmark.d.ts +81 -0
- package/dist/eval/benchmark.d.ts.map +1 -0
- package/dist/eval/benchmark.js +292 -0
- package/dist/eval/benchmark.js.map +1 -0
- package/dist/eval/eval-runner.d.ts +79 -0
- package/dist/eval/eval-runner.d.ts.map +1 -0
- package/dist/eval/eval-runner.js +252 -0
- package/dist/eval/eval-runner.js.map +1 -0
- package/dist/eval/index.d.ts +7 -0
- package/dist/eval/index.d.ts.map +1 -0
- package/dist/eval/index.js +13 -0
- package/dist/eval/index.js.map +1 -0
- package/dist/eval/tool-call-evaluator.d.ts +72 -0
- package/dist/eval/tool-call-evaluator.d.ts.map +1 -0
- package/dist/eval/tool-call-evaluator.js +265 -0
- package/dist/eval/tool-call-evaluator.js.map +1 -0
- package/dist/eval/types.d.ts +219 -0
- package/dist/eval/types.d.ts.map +1 -0
- package/dist/eval/types.js +3 -0
- package/dist/eval/types.js.map +1 -0
- package/dist/index.d.ts +61 -14
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +121 -8
- package/dist/index.js.map +1 -1
- package/dist/llm/anthropic-provider.d.ts +141 -0
- package/dist/llm/anthropic-provider.d.ts.map +1 -0
- package/dist/llm/anthropic-provider.js +486 -0
- package/dist/llm/anthropic-provider.js.map +1 -0
- package/dist/llm/errors.d.ts +26 -0
- package/dist/llm/errors.d.ts.map +1 -0
- package/dist/llm/errors.js +19 -0
- package/dist/llm/errors.js.map +1 -0
- package/dist/llm/factory.d.ts +73 -0
- package/dist/llm/factory.d.ts.map +1 -0
- package/dist/llm/factory.js +77 -0
- package/dist/llm/factory.js.map +1 -0
- package/dist/llm/fallback-provider.d.ts +47 -0
- package/dist/llm/fallback-provider.d.ts.map +1 -0
- package/dist/llm/fallback-provider.js +91 -0
- package/dist/llm/fallback-provider.js.map +1 -0
- package/dist/llm/interface.d.ts +54 -11
- package/dist/llm/interface.d.ts.map +1 -1
- package/dist/llm/interface.js +34 -0
- package/dist/llm/interface.js.map +1 -1
- package/dist/llm/model-router.d.ts +126 -0
- package/dist/llm/model-router.d.ts.map +1 -0
- package/dist/llm/model-router.js +178 -0
- package/dist/llm/model-router.js.map +1 -0
- package/dist/llm/openai-provider.d.ts +8 -32
- package/dist/llm/openai-provider.d.ts.map +1 -1
- package/dist/llm/openai-provider.js +27 -60
- package/dist/llm/openai-provider.js.map +1 -1
- package/dist/llm/rate-limiter.d.ts +41 -0
- package/dist/llm/rate-limiter.d.ts.map +1 -0
- package/dist/llm/rate-limiter.js +93 -0
- package/dist/llm/rate-limiter.js.map +1 -0
- package/dist/llm/retry.d.ts +26 -0
- package/dist/llm/retry.d.ts.map +1 -0
- package/dist/llm/retry.js +44 -0
- package/dist/llm/retry.js.map +1 -0
- package/dist/llm/token-budget.d.ts +97 -0
- package/dist/llm/token-budget.d.ts.map +1 -0
- package/dist/llm/token-budget.js +115 -0
- package/dist/llm/token-budget.js.map +1 -0
- package/dist/logging/index.d.ts +2 -0
- package/dist/logging/index.d.ts.map +1 -0
- package/dist/logging/index.js +7 -0
- package/dist/logging/index.js.map +1 -0
- package/dist/logging/logger.d.ts +38 -0
- package/dist/logging/logger.d.ts.map +1 -0
- package/dist/logging/logger.js +34 -0
- package/dist/logging/logger.js.map +1 -0
- package/dist/mcp/index.d.ts +4 -0
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/mcp/index.js +8 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/mcp/mcp-client-manager.d.ts +72 -0
- package/dist/mcp/mcp-client-manager.d.ts.map +1 -0
- package/dist/mcp/mcp-client-manager.js +235 -0
- package/dist/mcp/mcp-client-manager.js.map +1 -0
- package/dist/mcp/mcp-types.d.ts +58 -0
- package/dist/mcp/mcp-types.d.ts.map +1 -0
- package/dist/mcp/mcp-types.js +20 -0
- package/dist/mcp/mcp-types.js.map +1 -0
- package/dist/memory/index.d.ts +3 -0
- package/dist/memory/index.d.ts.map +1 -0
- package/dist/memory/index.js +6 -0
- package/dist/memory/index.js.map +1 -0
- package/dist/memory/memory-manager.d.ts +119 -0
- package/dist/memory/memory-manager.d.ts.map +1 -0
- package/dist/memory/memory-manager.js +334 -0
- package/dist/memory/memory-manager.js.map +1 -0
- package/dist/messages/types.d.ts +2 -0
- package/dist/messages/types.d.ts.map +1 -1
- package/dist/orchestrator/index.d.ts +5 -0
- package/dist/orchestrator/index.d.ts.map +1 -0
- package/dist/orchestrator/index.js +13 -0
- package/dist/orchestrator/index.js.map +1 -0
- package/dist/orchestrator/json-extractor.d.ts +18 -0
- package/dist/orchestrator/json-extractor.d.ts.map +1 -0
- package/dist/orchestrator/json-extractor.js +111 -0
- package/dist/orchestrator/json-extractor.js.map +1 -0
- package/dist/orchestrator/orchestrator-agent.d.ts +152 -0
- package/dist/orchestrator/orchestrator-agent.d.ts.map +1 -0
- package/dist/orchestrator/orchestrator-agent.js +675 -0
- package/dist/orchestrator/orchestrator-agent.js.map +1 -0
- package/dist/orchestrator/orchestrator-response.d.ts +40 -0
- package/dist/orchestrator/orchestrator-response.d.ts.map +1 -0
- package/dist/orchestrator/orchestrator-response.js +275 -0
- package/dist/orchestrator/orchestrator-response.js.map +1 -0
- package/dist/orchestrator/orchestrator-types.d.ts +116 -0
- package/dist/orchestrator/orchestrator-types.d.ts.map +1 -0
- package/dist/orchestrator/orchestrator-types.js +3 -0
- package/dist/orchestrator/orchestrator-types.js.map +1 -0
- package/dist/preferences/preference-manager.d.ts +8 -3
- package/dist/preferences/preference-manager.d.ts.map +1 -1
- package/dist/preferences/preference-manager.js +17 -4
- package/dist/preferences/preference-manager.js.map +1 -1
- package/dist/rag/chroma-store.d.ts +52 -0
- package/dist/rag/chroma-store.d.ts.map +1 -0
- package/dist/rag/chroma-store.js +110 -0
- package/dist/rag/chroma-store.js.map +1 -0
- package/dist/rag/document-loader.d.ts +21 -0
- package/dist/rag/document-loader.d.ts.map +1 -0
- package/dist/rag/document-loader.js +129 -0
- package/dist/rag/document-loader.js.map +1 -0
- package/dist/rag/embedding-provider.d.ts +36 -0
- package/dist/rag/embedding-provider.d.ts.map +1 -0
- package/dist/rag/embedding-provider.js +74 -0
- package/dist/rag/embedding-provider.js.map +1 -0
- package/dist/rag/index.d.ts +17 -0
- package/dist/rag/index.d.ts.map +1 -0
- package/dist/rag/index.js +27 -0
- package/dist/rag/index.js.map +1 -0
- package/dist/rag/keyword-index.d.ts +53 -0
- package/dist/rag/keyword-index.d.ts.map +1 -0
- package/dist/rag/keyword-index.js +161 -0
- package/dist/rag/keyword-index.js.map +1 -0
- package/dist/rag/llm-reranker.d.ts +36 -0
- package/dist/rag/llm-reranker.d.ts.map +1 -0
- package/dist/rag/llm-reranker.js +95 -0
- package/dist/rag/llm-reranker.js.map +1 -0
- package/dist/rag/rag-manager.d.ts +54 -0
- package/dist/rag/rag-manager.d.ts.map +1 -0
- package/dist/rag/rag-manager.js +179 -0
- package/dist/rag/rag-manager.js.map +1 -0
- package/dist/rag/rag-types.d.ts +143 -0
- package/dist/rag/rag-types.d.ts.map +1 -0
- package/dist/rag/rag-types.js +9 -0
- package/dist/rag/rag-types.js.map +1 -0
- package/dist/rag/rrf.d.ts +47 -0
- package/dist/rag/rrf.d.ts.map +1 -0
- package/dist/rag/rrf.js +70 -0
- package/dist/rag/rrf.js.map +1 -0
- package/dist/rag/search-knowledge.d.ts +24 -0
- package/dist/rag/search-knowledge.d.ts.map +1 -0
- package/dist/rag/search-knowledge.js +86 -0
- package/dist/rag/search-knowledge.js.map +1 -0
- package/dist/rag/text-splitter.d.ts +25 -0
- package/dist/rag/text-splitter.d.ts.map +1 -0
- package/dist/rag/text-splitter.js +136 -0
- package/dist/rag/text-splitter.js.map +1 -0
- package/dist/rag/vector-store.d.ts +34 -0
- package/dist/rag/vector-store.d.ts.map +1 -0
- package/dist/rag/vector-store.js +73 -0
- package/dist/rag/vector-store.js.map +1 -0
- package/dist/reflection/error-notebook.d.ts +125 -0
- package/dist/reflection/error-notebook.d.ts.map +1 -0
- package/dist/reflection/error-notebook.js +368 -0
- package/dist/reflection/error-notebook.js.map +1 -0
- package/dist/reflection/index.d.ts +8 -0
- package/dist/reflection/index.d.ts.map +1 -0
- package/dist/reflection/index.js +12 -0
- package/dist/reflection/index.js.map +1 -0
- package/dist/reflection/memory-reflector.d.ts +97 -0
- package/dist/reflection/memory-reflector.d.ts.map +1 -0
- package/dist/reflection/memory-reflector.js +215 -0
- package/dist/reflection/memory-reflector.js.map +1 -0
- package/dist/reflection/reflection-agent.d.ts +105 -0
- package/dist/reflection/reflection-agent.d.ts.map +1 -0
- package/dist/reflection/reflection-agent.js +234 -0
- package/dist/reflection/reflection-agent.js.map +1 -0
- package/dist/reflection/reflection-hook.d.ts +50 -0
- package/dist/reflection/reflection-hook.d.ts.map +1 -0
- package/dist/reflection/reflection-hook.js +108 -0
- package/dist/reflection/reflection-hook.js.map +1 -0
- package/dist/rules/project-rules.d.ts +47 -0
- package/dist/rules/project-rules.d.ts.map +1 -0
- package/dist/rules/project-rules.js +166 -0
- package/dist/rules/project-rules.js.map +1 -0
- package/dist/security/boundaries.d.ts +81 -0
- package/dist/security/boundaries.d.ts.map +1 -0
- package/dist/security/boundaries.js +158 -0
- package/dist/security/boundaries.js.map +1 -0
- package/dist/security/index.d.ts +2 -0
- package/dist/security/index.d.ts.map +1 -0
- package/dist/security/index.js +11 -0
- package/dist/security/index.js.map +1 -0
- package/dist/session/session-types.d.ts +25 -4
- package/dist/session/session-types.d.ts.map +1 -1
- package/dist/skills/file-skill-loader.d.ts +9 -20
- package/dist/skills/file-skill-loader.d.ts.map +1 -1
- package/dist/skills/file-skill-loader.js +35 -164
- package/dist/skills/file-skill-loader.js.map +1 -1
- package/dist/skills/index.d.ts +1 -1
- package/dist/skills/index.d.ts.map +1 -1
- package/dist/skills/index.js +1 -2
- package/dist/skills/index.js.map +1 -1
- package/dist/skills/skill-manager.d.ts +22 -29
- package/dist/skills/skill-manager.d.ts.map +1 -1
- package/dist/skills/skill-manager.js +63 -85
- package/dist/skills/skill-manager.js.map +1 -1
- package/dist/skills/types.d.ts +4 -16
- package/dist/skills/types.d.ts.map +1 -1
- package/dist/subagent/index.d.ts +4 -0
- package/dist/subagent/index.d.ts.map +1 -0
- package/dist/subagent/index.js +8 -0
- package/dist/subagent/index.js.map +1 -0
- package/dist/subagent/subagent-loader.d.ts +53 -0
- package/dist/subagent/subagent-loader.d.ts.map +1 -0
- package/dist/subagent/subagent-loader.js +155 -0
- package/dist/subagent/subagent-loader.js.map +1 -0
- package/dist/subagent/subagent-manager.d.ts +161 -0
- package/dist/subagent/subagent-manager.d.ts.map +1 -0
- package/dist/subagent/subagent-manager.js +468 -0
- package/dist/subagent/subagent-manager.js.map +1 -0
- package/dist/subagent/subagent-types.d.ts +77 -0
- package/dist/subagent/subagent-types.d.ts.map +1 -0
- package/dist/subagent/subagent-types.js +3 -0
- package/dist/subagent/subagent-types.js.map +1 -0
- package/dist/tools/builtin/bash.d.ts +3 -0
- package/dist/tools/builtin/bash.d.ts.map +1 -0
- package/dist/tools/builtin/bash.js +87 -0
- package/dist/tools/builtin/bash.js.map +1 -0
- package/dist/tools/builtin/edit-file.d.ts.map +1 -1
- package/dist/tools/builtin/edit-file.js +1 -0
- package/dist/tools/builtin/edit-file.js.map +1 -1
- package/dist/tools/builtin/index.d.ts +14 -0
- package/dist/tools/builtin/index.d.ts.map +1 -1
- package/dist/tools/builtin/index.js +45 -1
- package/dist/tools/builtin/index.js.map +1 -1
- package/dist/tools/builtin/list-errors.d.ts +7 -0
- package/dist/tools/builtin/list-errors.d.ts.map +1 -0
- package/dist/tools/builtin/list-errors.js +64 -0
- package/dist/tools/builtin/list-errors.js.map +1 -0
- package/dist/tools/builtin/list-subagents.d.ts +7 -0
- package/dist/tools/builtin/list-subagents.d.ts.map +1 -0
- package/dist/tools/builtin/list-subagents.js +21 -0
- package/dist/tools/builtin/list-subagents.js.map +1 -0
- package/dist/tools/builtin/recall.d.ts +11 -0
- package/dist/tools/builtin/recall.d.ts.map +1 -0
- package/dist/tools/builtin/recall.js +60 -0
- package/dist/tools/builtin/recall.js.map +1 -0
- package/dist/tools/builtin/remember.d.ts +12 -0
- package/dist/tools/builtin/remember.d.ts.map +1 -0
- package/dist/tools/builtin/remember.js +72 -0
- package/dist/tools/builtin/remember.js.map +1 -0
- package/dist/tools/builtin/skill.d.ts +14 -0
- package/dist/tools/builtin/skill.d.ts.map +1 -0
- package/dist/tools/builtin/skill.js +71 -0
- package/dist/tools/builtin/skill.js.map +1 -0
- package/dist/tools/builtin/spawn-subagent.d.ts +7 -0
- package/dist/tools/builtin/spawn-subagent.d.ts.map +1 -0
- package/dist/tools/builtin/spawn-subagent.js +43 -0
- package/dist/tools/builtin/spawn-subagent.js.map +1 -0
- package/dist/tools/builtin/web-fetch.d.ts +3 -0
- package/dist/tools/builtin/web-fetch.d.ts.map +1 -0
- package/dist/tools/builtin/web-fetch.js +101 -0
- package/dist/tools/builtin/web-fetch.js.map +1 -0
- package/dist/tools/builtin/write-file.d.ts.map +1 -1
- package/dist/tools/builtin/write-file.js +1 -0
- package/dist/tools/builtin/write-file.js.map +1 -1
- package/dist/tools/circuit-breaker.d.ts +19 -10
- package/dist/tools/circuit-breaker.d.ts.map +1 -1
- package/dist/tools/circuit-breaker.js +22 -11
- package/dist/tools/circuit-breaker.js.map +1 -1
- package/dist/tools/error-tracker.d.ts +28 -44
- package/dist/tools/error-tracker.d.ts.map +1 -1
- package/dist/tools/error-tracker.js +39 -156
- package/dist/tools/error-tracker.js.map +1 -1
- package/dist/tools/tool-filter.d.ts +70 -0
- package/dist/tools/tool-filter.d.ts.map +1 -0
- package/dist/tools/tool-filter.js +92 -0
- package/dist/tools/tool-filter.js.map +1 -0
- package/dist/tools/tool-output-truncator.d.ts +36 -0
- package/dist/tools/tool-output-truncator.d.ts.map +1 -0
- package/dist/tools/tool-output-truncator.js +117 -0
- package/dist/tools/tool-output-truncator.js.map +1 -0
- package/dist/tools/tool-registry.d.ts +25 -9
- package/dist/tools/tool-registry.d.ts.map +1 -1
- package/dist/tools/tool-registry.js +77 -28
- package/dist/tools/tool-registry.js.map +1 -1
- package/dist/tools/tool-validator.d.ts +13 -0
- package/dist/tools/tool-validator.d.ts.map +1 -0
- package/dist/tools/tool-validator.js +116 -0
- package/dist/tools/tool-validator.js.map +1 -0
- package/dist/tools/types.d.ts +86 -3
- package/dist/tools/types.d.ts.map +1 -1
- package/dist/tools/types.js +51 -2
- package/dist/tools/types.js.map +1 -1
- package/dist/trace/trace-logger.d.ts +30 -4
- package/dist/trace/trace-logger.d.ts.map +1 -1
- package/dist/trace/trace-logger.js +83 -7
- package/dist/trace/trace-logger.js.map +1 -1
- package/package.json +14 -4
- package/dist/compression/sliding-window.d.ts +0 -21
- package/dist/compression/sliding-window.d.ts.map +0 -1
- package/dist/compression/sliding-window.js +0 -44
- package/dist/compression/sliding-window.js.map +0 -1
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.ToolOutputTruncator = void 0;
|
|
37
|
+
const fs = __importStar(require("fs"));
|
|
38
|
+
const path = __importStar(require("path"));
|
|
39
|
+
/**
|
|
40
|
+
* Truncator for tool outputs that exceed a byte threshold.
|
|
41
|
+
*
|
|
42
|
+
* When a tool returns a very large result it fills the context window
|
|
43
|
+
* and wastes tokens. This component saves the full result to disk and
|
|
44
|
+
* returns a short preview + a file path, so the LLM can decide whether
|
|
45
|
+
* to read the full content via the normal file-reading tools.
|
|
46
|
+
*/
|
|
47
|
+
class ToolOutputTruncator {
|
|
48
|
+
maxBytes;
|
|
49
|
+
keepBytes;
|
|
50
|
+
outputDir;
|
|
51
|
+
/**
|
|
52
|
+
* @param maxBytes Outputs larger than this are truncated (0 = off).
|
|
53
|
+
* @param keepBytes How many bytes to keep from the start of the output
|
|
54
|
+
* when truncating.
|
|
55
|
+
* @param outputDir Directory where full outputs are saved.
|
|
56
|
+
*/
|
|
57
|
+
constructor(maxBytes = 0, keepBytes = 2048, outputDir) {
|
|
58
|
+
this.maxBytes = maxBytes;
|
|
59
|
+
this.keepBytes = keepBytes;
|
|
60
|
+
this.outputDir = path.resolve(outputDir ?? ".kagent-tool-outputs");
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Whether truncation is active (maxBytes > 0).
|
|
64
|
+
*/
|
|
65
|
+
get enabled() {
|
|
66
|
+
return this.maxBytes > 0;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Truncate a tool result string if it exceeds the configured threshold.
|
|
70
|
+
*
|
|
71
|
+
* - If the result is within `maxBytes`, returns it unchanged.
|
|
72
|
+
* - Otherwise saves the full output to disk and returns the first
|
|
73
|
+
* `keepBytes` bytes + a marker pointing to the saved file.
|
|
74
|
+
*
|
|
75
|
+
* @param toolName Name of the tool that produced this result.
|
|
76
|
+
* @param result The raw result string from tool execution.
|
|
77
|
+
*/
|
|
78
|
+
truncate(toolName, result) {
|
|
79
|
+
if (!this.enabled)
|
|
80
|
+
return result;
|
|
81
|
+
const byteLength = Buffer.byteLength(result, "utf-8");
|
|
82
|
+
if (byteLength <= this.maxBytes)
|
|
83
|
+
return result;
|
|
84
|
+
// Ensure output directory exists
|
|
85
|
+
fs.mkdirSync(this.outputDir, { recursive: true });
|
|
86
|
+
// Generate a unique filename: toolname_<timestamp>_<hash>.txt
|
|
87
|
+
const now = Date.now();
|
|
88
|
+
const hash = djb2(toolName + now + result.slice(0, 128));
|
|
89
|
+
const filename = `${sanitizeFilename(toolName)}_${now}_${hash}.txt`;
|
|
90
|
+
const filePath = path.join(this.outputDir, filename);
|
|
91
|
+
fs.writeFileSync(filePath, result, "utf-8");
|
|
92
|
+
const preview = result.slice(0, this.keepBytes);
|
|
93
|
+
const truncatedSize = byteLength - this.keepBytes;
|
|
94
|
+
const marker = `\n\n---\n` +
|
|
95
|
+
`[Output truncated: ${(byteLength / 1024).toFixed(1)} KB total | ` +
|
|
96
|
+
`showing first ${(this.keepBytes / 1024).toFixed(1)} KB | ` +
|
|
97
|
+
`${truncatedSize} bytes truncated.]\n` +
|
|
98
|
+
`[Full output saved to: ${filePath}]\n` +
|
|
99
|
+
`[Use the read_file tool with file_path="${filePath}" to read the complete output.]`;
|
|
100
|
+
return preview + marker;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
exports.ToolOutputTruncator = ToolOutputTruncator;
|
|
104
|
+
// ─── Helpers ────────────────────────────────────────────────────────────────
|
|
105
|
+
/** Simple djb2 hash (non-crypto, for filename dedup). */
|
|
106
|
+
function djb2(str) {
|
|
107
|
+
let hash = 5381;
|
|
108
|
+
for (let i = 0; i < str.length; i++) {
|
|
109
|
+
hash = ((hash << 5) + hash + str.charCodeAt(i)) & 0xffffffff;
|
|
110
|
+
}
|
|
111
|
+
return (hash >>> 0).toString(16).padStart(8, "0");
|
|
112
|
+
}
|
|
113
|
+
/** Replace non-filename-safe characters. */
|
|
114
|
+
function sanitizeFilename(name) {
|
|
115
|
+
return name.replace(/[^a-zA-Z0-9_\-.]/g, "_");
|
|
116
|
+
}
|
|
117
|
+
//# sourceMappingURL=tool-output-truncator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-output-truncator.js","sourceRoot":"","sources":["../../src/tools/tool-output-truncator.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,2CAA6B;AAE7B;;;;;;;GAOG;AACH,MAAa,mBAAmB;IACtB,QAAQ,CAAS;IACjB,SAAS,CAAS;IAClB,SAAS,CAAS;IAE1B;;;;;OAKG;IACH,YACE,WAAmB,CAAC,EACpB,YAAoB,IAAI,EACxB,SAAkB;QAElB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,IAAI,sBAAsB,CAAC,CAAC;IACrE,CAAC;IAED;;OAEG;IACH,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC;IAC3B,CAAC;IAED;;;;;;;;;OASG;IACH,QAAQ,CAAC,QAAgB,EAAE,MAAc;QACvC,IAAI,CAAC,IAAI,CAAC,OAAO;YAAE,OAAO,MAAM,CAAC;QAEjC,MAAM,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC,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AW;IACvB,IAAI,IAAI,GAAG,IAAI,CAAC;IAChB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACpC,IAAI,GAAG,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,GAAG,IAAI,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC;IAC/D,CAAC;IACD,OAAO,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;AACpD,CAAC;AAED,4CAA4C;AAC5C,SAAS,gBAAgB,CAAC,IAAY;IACpC,OAAO,IAAI,CAAC,OAAO,CAAC,mBAAmB,EAAE,GAAG,CAAC,CAAC;AAChD,CAAC"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { Tool, BreakerStatus } from "./types";
|
|
1
|
+
import { Tool, ToolResult, BreakerStatus } from "./types";
|
|
2
2
|
import { ToolErrorTracker } from "./error-tracker";
|
|
3
|
+
import { ToolOutputTruncator } from "./tool-output-truncator";
|
|
4
|
+
import { ToolFilter } from "./tool-filter";
|
|
3
5
|
/**
|
|
4
6
|
* Registry that manages tool definitions together with circuit breakers.
|
|
5
7
|
*
|
|
@@ -13,12 +15,15 @@ export declare class ToolRegistry {
|
|
|
13
15
|
private breakers;
|
|
14
16
|
private retryCount;
|
|
15
17
|
private errorTracker?;
|
|
18
|
+
private truncator;
|
|
16
19
|
/**
|
|
17
20
|
* @param retryCount Number of retries allowed after the first failure
|
|
18
21
|
* (default: 2 → 3 total attempts before circuit opens).
|
|
19
22
|
* @param errorTracker Optional ToolErrorTracker for recording failure chains.
|
|
23
|
+
* @param truncator Optional ToolOutputTruncator for truncating large
|
|
24
|
+
* tool outputs (default: enabled with default limits).
|
|
20
25
|
*/
|
|
21
|
-
constructor(retryCount?: number, errorTracker?: ToolErrorTracker);
|
|
26
|
+
constructor(retryCount?: number, errorTracker?: ToolErrorTracker, truncator?: ToolOutputTruncator);
|
|
22
27
|
/**
|
|
23
28
|
* Register a tool. Creates a circuit breaker for it automatically.
|
|
24
29
|
*/
|
|
@@ -51,18 +56,29 @@ export declare class ToolRegistry {
|
|
|
51
56
|
* Get all registered tool names.
|
|
52
57
|
*/
|
|
53
58
|
get toolNames(): string[];
|
|
59
|
+
/**
|
|
60
|
+
* Create a new ToolRegistry containing only tools that pass the given
|
|
61
|
+
* filter. Circuit breaker state is NOT copied — each filtered registry
|
|
62
|
+
* starts fresh (appropriate for sub-agents).
|
|
63
|
+
*
|
|
64
|
+
* @param filter The filter to apply.
|
|
65
|
+
* @returns A new ToolRegistry with the filtered tool set.
|
|
66
|
+
*/
|
|
67
|
+
filter(filter: ToolFilter): ToolRegistry;
|
|
54
68
|
/**
|
|
55
69
|
* Execute a tool with circuit-breaker protection and retry guidance.
|
|
56
70
|
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
* - If execution fails and retries remain, returns a message telling the LLM
|
|
60
|
-
* to analyze the error and retry with corrected parameters.
|
|
61
|
-
* - If execution succeeds, records a success (resets failure count).
|
|
71
|
+
* Returns a structured {@link ToolResult} with a machine-readable
|
|
72
|
+
* {@link ToolErrorCode} so callers can react precisely.
|
|
62
73
|
*
|
|
63
|
-
*
|
|
74
|
+
* Possible error codes:
|
|
75
|
+
* - `SUCCESS` — tool completed normally.
|
|
76
|
+
* - `UNKNOWN_TOOL` — tool name not registered.
|
|
77
|
+
* - `CIRCUIT_OPEN` — tool is disabled (too many failures).
|
|
78
|
+
* - `EXECUTION_FAILURE` — tool threw an exception; retries may remain.
|
|
79
|
+
* - `TRUNCATED_OUTPUT` — tool output was truncated.
|
|
64
80
|
*/
|
|
65
|
-
execute(name: string, args: Record<string, unknown>): Promise<
|
|
81
|
+
execute(name: string, args: Record<string, unknown>): Promise<ToolResult>;
|
|
66
82
|
/**
|
|
67
83
|
* Get the error tracker instance, if one is configured.
|
|
68
84
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-registry.d.ts","sourceRoot":"","sources":["../../src/tools/tool-registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"tool-registry.d.ts","sourceRoot":"","sources":["../../src/tools/tool-registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAyC,aAAa,EAAE,MAAM,SAAS,CAAC;AAEjG,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C;;;;;;;GAOG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,KAAK,CAAgC;IAC7C,OAAO,CAAC,QAAQ,CAA0C;IAC1D,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,YAAY,CAAC,CAAmB;IACxC,OAAO,CAAC,SAAS,CAAsB;IAEvC;;;;;;OAMG;gBAED,UAAU,CAAC,EAAE,MAAM,EACnB,YAAY,CAAC,EAAE,gBAAgB,EAC/B,SAAS,CAAC,EAAE,mBAAmB;IAOjC;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI;IAc1B;;OAEG;IACH,YAAY,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,IAAI;IAMjC;;OAEG;IACH,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS;IAIvC;;OAEG;IACH,QAAQ,IAAI,IAAI,EAAE;IAIlB;;OAEG;IACH,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAK7B;;OAEG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAI1B;;OAEG;IACH,IAAI,KAAK,IAAI,MAAM,CAElB;IAED;;OAEG;IACH,IAAI,SAAS,IAAI,MAAM,EAAE,CAExB;IAID;;;;;;;OAOG;IACH,MAAM,CAAC,MAAM,EAAE,UAAU,GAAG,YAAY;IAgBxC;;;;;;;;;;;;OAYG;IACG,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC;IA+G/E;;OAEG;IACH,eAAe,IAAI,gBAAgB,GAAG,SAAS;IAI/C;;OAEG;IACH,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS;IAIzD;;OAEG;IACH,qBAAqB,IAAI,aAAa,EAAE;IAIxC;;OAEG;IACH,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAIhC;;OAEG;IACH,gBAAgB,IAAI,IAAI;CAKzB"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ToolRegistry = void 0;
|
|
4
|
+
const types_1 = require("./types");
|
|
4
5
|
const circuit_breaker_1 = require("./circuit-breaker");
|
|
6
|
+
const tool_output_truncator_1 = require("./tool-output-truncator");
|
|
5
7
|
/**
|
|
6
8
|
* Registry that manages tool definitions together with circuit breakers.
|
|
7
9
|
*
|
|
@@ -15,14 +17,18 @@ class ToolRegistry {
|
|
|
15
17
|
breakers = new Map();
|
|
16
18
|
retryCount;
|
|
17
19
|
errorTracker;
|
|
20
|
+
truncator;
|
|
18
21
|
/**
|
|
19
22
|
* @param retryCount Number of retries allowed after the first failure
|
|
20
23
|
* (default: 2 → 3 total attempts before circuit opens).
|
|
21
24
|
* @param errorTracker Optional ToolErrorTracker for recording failure chains.
|
|
25
|
+
* @param truncator Optional ToolOutputTruncator for truncating large
|
|
26
|
+
* tool outputs (default: enabled with default limits).
|
|
22
27
|
*/
|
|
23
|
-
constructor(retryCount, errorTracker) {
|
|
28
|
+
constructor(retryCount, errorTracker, truncator) {
|
|
24
29
|
this.retryCount = retryCount ?? 2;
|
|
25
30
|
this.errorTracker = errorTracker;
|
|
31
|
+
this.truncator = truncator ?? new tool_output_truncator_1.ToolOutputTruncator();
|
|
26
32
|
}
|
|
27
33
|
/**
|
|
28
34
|
* Register a tool. Creates a circuit breaker for it automatically.
|
|
@@ -82,73 +88,116 @@ class ToolRegistry {
|
|
|
82
88
|
get toolNames() {
|
|
83
89
|
return Array.from(this.tools.keys());
|
|
84
90
|
}
|
|
91
|
+
// ─── Tool Filter ───────────────────────────────────────────────────────
|
|
92
|
+
/**
|
|
93
|
+
* Create a new ToolRegistry containing only tools that pass the given
|
|
94
|
+
* filter. Circuit breaker state is NOT copied — each filtered registry
|
|
95
|
+
* starts fresh (appropriate for sub-agents).
|
|
96
|
+
*
|
|
97
|
+
* @param filter The filter to apply.
|
|
98
|
+
* @returns A new ToolRegistry with the filtered tool set.
|
|
99
|
+
*/
|
|
100
|
+
filter(filter) {
|
|
101
|
+
const registry = new ToolRegistry(this.retryCount, this.errorTracker, this.truncator);
|
|
102
|
+
for (const tool of this.tools.values()) {
|
|
103
|
+
if (filter.filter(tool)) {
|
|
104
|
+
registry.register(tool);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
return registry;
|
|
108
|
+
}
|
|
85
109
|
// ─── Circuit Breaker ───────────────────────────────────────────────────
|
|
86
110
|
/**
|
|
87
111
|
* Execute a tool with circuit-breaker protection and retry guidance.
|
|
88
112
|
*
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
* - If execution fails and retries remain, returns a message telling the LLM
|
|
92
|
-
* to analyze the error and retry with corrected parameters.
|
|
93
|
-
* - If execution succeeds, records a success (resets failure count).
|
|
113
|
+
* Returns a structured {@link ToolResult} with a machine-readable
|
|
114
|
+
* {@link ToolErrorCode} so callers can react precisely.
|
|
94
115
|
*
|
|
95
|
-
*
|
|
116
|
+
* Possible error codes:
|
|
117
|
+
* - `SUCCESS` — tool completed normally.
|
|
118
|
+
* - `UNKNOWN_TOOL` — tool name not registered.
|
|
119
|
+
* - `CIRCUIT_OPEN` — tool is disabled (too many failures).
|
|
120
|
+
* - `EXECUTION_FAILURE` — tool threw an exception; retries may remain.
|
|
121
|
+
* - `TRUNCATED_OUTPUT` — tool output was truncated.
|
|
96
122
|
*/
|
|
97
123
|
async execute(name, args) {
|
|
98
124
|
const tool = this.tools.get(name);
|
|
99
125
|
if (!tool) {
|
|
100
|
-
return (`
|
|
101
|
-
`
|
|
126
|
+
return (0, types_1.toolError)(types_1.ToolErrorCode.UNKNOWN_TOOL, `[FATAL:UNKNOWN_TOOL] The tool "${name}" is not registered. ` +
|
|
127
|
+
`Available tools: ${this.toolNames.join(", ")}. ` +
|
|
128
|
+
`Please use one of the available tools instead.`, "fatal");
|
|
102
129
|
}
|
|
103
130
|
const breaker = this.breakers.get(name);
|
|
104
131
|
// Circuit breaker check — circuit is OPEN
|
|
105
132
|
if (!breaker.isAvailable) {
|
|
106
133
|
const status = breaker.getStatus();
|
|
107
|
-
return (`
|
|
134
|
+
return (0, types_1.toolError)(types_1.ToolErrorCode.CIRCUIT_OPEN, `[FATAL:CIRCUIT_OPEN] Tool "${name}" has been disabled after ${status.failureCount} consecutive failures. ` +
|
|
108
135
|
`It cannot be used again in this session. ` +
|
|
109
|
-
`Please
|
|
110
|
-
`Available alternatives: ${this.toolNames.filter((n) => n !== name).join(", ") || "none — try a different method."}
|
|
136
|
+
`Please find a completely different approach. ` +
|
|
137
|
+
`Available alternatives: ${this.toolNames.filter((n) => n !== name).join(", ") || "none — try a different method."}`, "fatal");
|
|
111
138
|
}
|
|
112
139
|
// Execute with failure tracking and retry guidance
|
|
113
140
|
try {
|
|
114
|
-
const
|
|
115
|
-
|
|
141
|
+
const rawResult = await tool.execute(args);
|
|
142
|
+
const truncated = this.truncator.truncate(name, rawResult);
|
|
143
|
+
const wasTruncated = truncated !== rawResult;
|
|
144
|
+
// Success after previous failures — record recovery + reset breaker.
|
|
145
|
+
// Only include the recovery message in the LLM context when an
|
|
146
|
+
// error tracker is active (meaning the LLM was previously informed
|
|
147
|
+
// of the failures via error-analysis injection).
|
|
116
148
|
if (breaker.currentFailureCount > 0) {
|
|
117
|
-
|
|
149
|
+
let hadActiveTrace = false;
|
|
118
150
|
if (this.errorTracker) {
|
|
119
151
|
const activeTrace = this.errorTracker.getActiveTraceId(name);
|
|
120
152
|
if (activeTrace) {
|
|
121
153
|
this.errorTracker.recordRecovery(name, activeTrace, `Tool "${name}" executed successfully after ${breaker.currentFailureCount} failure(s).`);
|
|
154
|
+
hadActiveTrace = true;
|
|
122
155
|
}
|
|
123
156
|
}
|
|
124
157
|
breaker.recordSuccess();
|
|
125
|
-
|
|
126
|
-
|
|
158
|
+
if (hadActiveTrace) {
|
|
159
|
+
const content = wasTruncated
|
|
160
|
+
? `${truncated}\n\n[Tool "${name}" has recovered after previous failures. The failure counter has been reset.]\n[Note: Output was truncated due to size limits.]`
|
|
161
|
+
: `${truncated}\n\n[Tool "${name}" has recovered after previous failures. The failure counter has been reset.]`;
|
|
162
|
+
return {
|
|
163
|
+
success: true,
|
|
164
|
+
severity: "success",
|
|
165
|
+
errorCode: wasTruncated ? types_1.ToolErrorCode.TRUNCATED_OUTPUT : types_1.ToolErrorCode.SUCCESS,
|
|
166
|
+
content,
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
// Breaker was reset but no active error trace — silent recovery.
|
|
170
|
+
return (0, types_1.toolSuccess)(truncated);
|
|
127
171
|
}
|
|
128
172
|
breaker.recordSuccess();
|
|
129
|
-
return
|
|
173
|
+
return (0, types_1.toolSuccess)(truncated);
|
|
130
174
|
}
|
|
131
175
|
catch (err) {
|
|
132
176
|
const rawMessage = err instanceof Error ? err.message : String(err);
|
|
133
177
|
const remaining = breaker.recordFailure();
|
|
134
178
|
// Record the failure in the error tracker
|
|
135
179
|
if (this.errorTracker) {
|
|
136
|
-
this.errorTracker.recordFailure(name, args, rawMessage, remaining);
|
|
180
|
+
this.errorTracker.recordFailure(name, args, rawMessage, remaining, breaker.state);
|
|
137
181
|
}
|
|
138
182
|
// Circuit just opened — no retries left
|
|
139
183
|
if (!breaker.isAvailable) {
|
|
140
|
-
return (`
|
|
141
|
-
`This was the final attempt. The tool
|
|
142
|
-
`
|
|
184
|
+
return (0, types_1.toolError)(types_1.ToolErrorCode.EXECUTION_FAILURE, `[FATAL:EXECUTION_FAILURE] Tool "${name}" threw an exception: ${rawMessage}\n\n` +
|
|
185
|
+
`This was the final attempt. The tool is now disabled after ${breaker.currentFailureCount} consecutive failures. ` +
|
|
186
|
+
`Do NOT retry "${name}". Find a different approach or tool.`, "fatal");
|
|
143
187
|
}
|
|
144
|
-
// Retries still available —
|
|
188
|
+
// Retries still available — circuit is HALF_OPEN (degraded)
|
|
145
189
|
const attemptNum = breaker.currentFailureCount;
|
|
146
190
|
const totalAllowed = breaker.effectiveThreshold;
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
191
|
+
const stateWarning = remaining === 0
|
|
192
|
+
? `\n⚠️ The circuit breaker for "${name}" is now in a degraded state (HALF_OPEN). ` +
|
|
193
|
+
`The NEXT failure will permanently disable this tool. Proceed with extreme caution.`
|
|
194
|
+
: `\n⚠️ The circuit breaker for "${name}" is now in a degraded state (HALF_OPEN). ` +
|
|
195
|
+
`After ${remaining} more failure(s), the tool will be permanently disabled.`;
|
|
196
|
+
return (0, types_1.toolError)(types_1.ToolErrorCode.EXECUTION_FAILURE, `[RETRYABLE:EXECUTION_FAILURE] Tool "${name}" threw an exception: ${rawMessage}\n\n` +
|
|
197
|
+
`This is attempt ${attemptNum} of ${totalAllowed}. ` +
|
|
198
|
+
`You have ${remaining} retry attempt${remaining > 1 ? "s" : ""} remaining.${stateWarning}\n` +
|
|
199
|
+
`Analyze the error, correct the parameters, and retry. ` +
|
|
200
|
+
`If the approach is fundamentally wrong, try a different method.`, "retryable");
|
|
152
201
|
}
|
|
153
202
|
}
|
|
154
203
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-registry.js","sourceRoot":"","sources":["../../src/tools/tool-registry.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"tool-registry.js","sourceRoot":"","sources":["../../src/tools/tool-registry.ts"],"names":[],"mappings":";;;AAAA,mCAAiG;AACjG,uDAAmD;AAEnD,mEAA8D;AAG9D;;;;;;;GAOG;AACH,MAAa,YAAY;IACf,KAAK,GAAsB,IAAI,GAAG,EAAE,CAAC;IACrC,QAAQ,GAAgC,IAAI,GAAG,EAAE,CAAC;IAClD,UAAU,CAAS;IACnB,YAAY,CAAoB;IAChC,SAAS,CAAsB;IAEvC;;;;;;OAMG;IACH,YACE,UAAmB,EACnB,YAA+B,EAC/B,SAA+B;QAE/B,IAAI,CAAC,UAAU,GAAG,UAAU,IAAI,CAAC,CAAC;QAClC,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,SAAS,GAAG,SAAS,IAAI,IAAI,2CAAmB,EAAE,CAAC;IAC1D,CAAC;IAED;;OAEG;IACH,QAAQ,CAAC,IAAU;QACjB,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YAC9B,MAAM,IAAI,KAAK,CAAC,SAAS,IAAI,CAAC,IAAI,0BAA0B,CAAC,CAAC;QAChE,CAAC;QACD,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAChC,IAAI,CAAC,QAAQ,CAAC,GAAG,CACf,IAAI,CAAC,IAAI,EACT,IAAI,gCAAc,CAAC;YACjB,QAAQ,EAAE,IAAI,CAAC,IAAI;YACnB,UAAU,EAAE,IAAI,CAAC,UAAU;SAC5B,CAAC,CACH,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,YAAY,CAAC,KAA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IAAY;QAC3B,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,SAAS,EAAE,CAAC;IAC9C,CAAC;IAED;;OAEG;IACH,qBAAqB;QACnB,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC;IACtE,CAAC;IAED;;OAEG;IACH,YAAY,CAAC,IAAY;QACvB,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,CAAC;IACnC,CAAC;IAED;;OAEG;IACH,gBAAgB;QACd,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,EAAE,CAAC;YAC7C,OAAO,CAAC,KAAK,EAAE,CAAC;QAClB,CAAC;IACH,CAAC;CACF;AAvRD,oCAuRC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ToolResult } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* Validate tool arguments against the tool's JSON Schema.
|
|
4
|
+
*
|
|
5
|
+
* @param toolName — The tool's name (for error messages).
|
|
6
|
+
* @param parameters — The tool's JSON Schema definition (`Tool.parameters`).
|
|
7
|
+
* @param args — The parsed arguments from the LLM.
|
|
8
|
+
*
|
|
9
|
+
* @returns `null` when validation passes (no error), or a {@link ToolResult}
|
|
10
|
+
* with `VALIDATION_ERROR` when the arguments are invalid.
|
|
11
|
+
*/
|
|
12
|
+
export declare function validateToolArgs(toolName: string, parameters: Record<string, unknown>, args: Record<string, unknown>): ToolResult | null;
|
|
13
|
+
//# sourceMappingURL=tool-validator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-validator.d.ts","sourceRoot":"","sources":["../../src/tools/tool-validator.ts"],"names":[],"mappings":"AACA,OAAO,EAA4B,UAAU,EAAE,MAAM,SAAS,CAAC;AA2D/D;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACnC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC5B,UAAU,GAAG,IAAI,CAqDnB"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.validateToolArgs = validateToolArgs;
|
|
7
|
+
const ajv_1 = __importDefault(require("ajv"));
|
|
8
|
+
const types_1 = require("./types");
|
|
9
|
+
/**
|
|
10
|
+
* Validates tool arguments against the tool's JSON Schema definition.
|
|
11
|
+
*
|
|
12
|
+
* Uses ajv to compile each tool's `parameters` schema once, then validates
|
|
13
|
+
* incoming arguments before the tool is executed — catching missing required
|
|
14
|
+
* params, wrong types, etc. before wasting an LLM round-trip on a call that
|
|
15
|
+
* would fail.
|
|
16
|
+
*/
|
|
17
|
+
const ajv = new ajv_1.default({
|
|
18
|
+
allErrors: true, // collect all errors, not just the first
|
|
19
|
+
strict: false, // allow non-strict JSON Schema keywords LLMs may emit
|
|
20
|
+
coerceTypes: false, // don't silently coerce — surface type errors
|
|
21
|
+
});
|
|
22
|
+
/** Cache of compiled validators keyed by a per-tool stable key. */
|
|
23
|
+
const validatorCache = new Map();
|
|
24
|
+
/**
|
|
25
|
+
* Build a stable cache key from a tool's name and parameters hash.
|
|
26
|
+
*
|
|
27
|
+
* We hash `JSON.stringify(parameters)` so that if a tool's schema changes at
|
|
28
|
+
* runtime (e.g. MCP tools reconnecting with a different schema) the cache
|
|
29
|
+
* invalidates automatically.
|
|
30
|
+
*/
|
|
31
|
+
function cacheKey(toolName, parameters) {
|
|
32
|
+
return `${toolName}::${JSON.stringify(parameters)}`;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Check whether the JSON Schema has any real constraints worth validating.
|
|
36
|
+
*
|
|
37
|
+
* An empty schema (`{}` or `{"type": "object"}` with no properties/required)
|
|
38
|
+
* imposes no constraints, so we skip compilation.
|
|
39
|
+
*/
|
|
40
|
+
function hasConstraints(schema) {
|
|
41
|
+
const keys = Object.keys(schema);
|
|
42
|
+
if (keys.length === 0)
|
|
43
|
+
return false;
|
|
44
|
+
if (keys.length === 1 && keys[0] === "type")
|
|
45
|
+
return false;
|
|
46
|
+
return true;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Format ajv errors into a human-readable (and LLM-readable) message.
|
|
50
|
+
*
|
|
51
|
+
* Each error line follows the pattern:
|
|
52
|
+
* - /fieldName: <message>
|
|
53
|
+
* - /: <message> (root-level errors)
|
|
54
|
+
*/
|
|
55
|
+
function formatErrors(errors) {
|
|
56
|
+
const lines = errors.map((err) => {
|
|
57
|
+
const path = err.instancePath || "/";
|
|
58
|
+
return ` - ${path}: ${err.message}`;
|
|
59
|
+
});
|
|
60
|
+
return lines.join("\n");
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Validate tool arguments against the tool's JSON Schema.
|
|
64
|
+
*
|
|
65
|
+
* @param toolName — The tool's name (for error messages).
|
|
66
|
+
* @param parameters — The tool's JSON Schema definition (`Tool.parameters`).
|
|
67
|
+
* @param args — The parsed arguments from the LLM.
|
|
68
|
+
*
|
|
69
|
+
* @returns `null` when validation passes (no error), or a {@link ToolResult}
|
|
70
|
+
* with `VALIDATION_ERROR` when the arguments are invalid.
|
|
71
|
+
*/
|
|
72
|
+
function validateToolArgs(toolName, parameters, args) {
|
|
73
|
+
// ── Guard: nothing to validate ────────────────────────────────────────
|
|
74
|
+
if (!hasConstraints(parameters)) {
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
// ── Compile (or fetch cached) validator ───────────────────────────────
|
|
78
|
+
const key = cacheKey(toolName, parameters);
|
|
79
|
+
let validate;
|
|
80
|
+
if (validatorCache.has(key)) {
|
|
81
|
+
validate = validatorCache.get(key);
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
try {
|
|
85
|
+
validate = ajv.compile(parameters);
|
|
86
|
+
validatorCache.set(key, validate);
|
|
87
|
+
}
|
|
88
|
+
catch (compileErr) {
|
|
89
|
+
// Schema itself is malformed — log and skip validation for this tool.
|
|
90
|
+
// The LLM will still get error feedback from the actual tool call.
|
|
91
|
+
const msg = compileErr instanceof Error ? compileErr.message : String(compileErr);
|
|
92
|
+
console.warn(`[tool-validator] Failed to compile schema for tool "${toolName}": ${msg}`);
|
|
93
|
+
return null;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
// ── Validate ──────────────────────────────────────────────────────────
|
|
97
|
+
const valid = validate(args);
|
|
98
|
+
if (valid) {
|
|
99
|
+
return null; // all good
|
|
100
|
+
}
|
|
101
|
+
// ── Build structured error for the LLM ────────────────────────────────
|
|
102
|
+
const errors = validate.errors ?? [];
|
|
103
|
+
const errorList = formatErrors(errors);
|
|
104
|
+
const requiredFields = parameters.required && Array.isArray(parameters.required)
|
|
105
|
+
? parameters.required.join('", "')
|
|
106
|
+
: "";
|
|
107
|
+
let content = `[RETRYABLE:VALIDATION_ERROR] Tool "${toolName}" was called with invalid arguments.\n\n`;
|
|
108
|
+
content += `Validation errors:\n${errorList}\n`;
|
|
109
|
+
if (requiredFields) {
|
|
110
|
+
content += `\nRequired fields: "${requiredFields}"\n`;
|
|
111
|
+
}
|
|
112
|
+
content += `\nReceived arguments: ${JSON.stringify(args, null, 2)}\n\n`;
|
|
113
|
+
content += `Please correct the arguments and re-invoke the tool with valid parameters.`;
|
|
114
|
+
return (0, types_1.toolError)(types_1.ToolErrorCode.VALIDATION_ERROR, content, "retryable");
|
|
115
|
+
}
|
|
116
|
+
//# sourceMappingURL=tool-validator.js.map
|
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