@burtson-labs/agent-core 1.6.13
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 +201 -0
- package/README.md +88 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +52 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp/activation.d.ts +60 -0
- package/dist/mcp/activation.d.ts.map +1 -0
- package/dist/mcp/activation.js +139 -0
- package/dist/mcp/activation.js.map +1 -0
- package/dist/mcp/clientPool.d.ts +202 -0
- package/dist/mcp/clientPool.d.ts.map +1 -0
- package/dist/mcp/clientPool.js +469 -0
- package/dist/mcp/clientPool.js.map +1 -0
- package/dist/mcp/index.d.ts +18 -0
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/mcp/index.js +28 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/mcp/server.d.ts +43 -0
- package/dist/mcp/server.d.ts.map +1 -0
- package/dist/mcp/server.js +130 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/mcp/toolAdapter.d.ts +57 -0
- package/dist/mcp/toolAdapter.d.ts.map +1 -0
- package/dist/mcp/toolAdapter.js +223 -0
- package/dist/mcp/toolAdapter.js.map +1 -0
- package/dist/mcp/types.d.ts +122 -0
- package/dist/mcp/types.d.ts.map +1 -0
- package/dist/mcp/types.js +15 -0
- package/dist/mcp/types.js.map +1 -0
- package/dist/providers/deterministic-provider.d.ts +21 -0
- package/dist/providers/deterministic-provider.d.ts.map +1 -0
- package/dist/providers/deterministic-provider.js +80 -0
- package/dist/providers/deterministic-provider.js.map +1 -0
- package/dist/providers/provider-client.d.ts +12 -0
- package/dist/providers/provider-client.d.ts.map +1 -0
- package/dist/providers/provider-client.js +11 -0
- package/dist/providers/provider-client.js.map +1 -0
- package/dist/runtime/AgentRuntime.d.ts +67 -0
- package/dist/runtime/AgentRuntime.d.ts.map +1 -0
- package/dist/runtime/AgentRuntime.js +382 -0
- package/dist/runtime/AgentRuntime.js.map +1 -0
- package/dist/security/secretPatterns.d.ts +76 -0
- package/dist/security/secretPatterns.d.ts.map +1 -0
- package/dist/security/secretPatterns.js +290 -0
- package/dist/security/secretPatterns.js.map +1 -0
- package/dist/tools/ask-user-tool.d.ts +19 -0
- package/dist/tools/ask-user-tool.d.ts.map +1 -0
- package/dist/tools/ask-user-tool.js +148 -0
- package/dist/tools/ask-user-tool.js.map +1 -0
- package/dist/tools/compactMessages.d.ts +52 -0
- package/dist/tools/compactMessages.d.ts.map +1 -0
- package/dist/tools/compactMessages.js +158 -0
- package/dist/tools/compactMessages.js.map +1 -0
- package/dist/tools/core-tools.d.ts +29 -0
- package/dist/tools/core-tools.d.ts.map +1 -0
- package/dist/tools/core-tools.js +2214 -0
- package/dist/tools/core-tools.js.map +1 -0
- package/dist/tools/git-tools.d.ts +32 -0
- package/dist/tools/git-tools.d.ts.map +1 -0
- package/dist/tools/git-tools.js +330 -0
- package/dist/tools/git-tools.js.map +1 -0
- package/dist/tools/index.d.ts +15 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +31 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/language-adapters.d.ts +48 -0
- package/dist/tools/language-adapters.d.ts.map +1 -0
- package/dist/tools/language-adapters.js +299 -0
- package/dist/tools/language-adapters.js.map +1 -0
- package/dist/tools/loop/compactionTrigger.d.ts +47 -0
- package/dist/tools/loop/compactionTrigger.d.ts.map +1 -0
- package/dist/tools/loop/compactionTrigger.js +32 -0
- package/dist/tools/loop/compactionTrigger.js.map +1 -0
- package/dist/tools/loop/finalAnswerNudges.d.ts +68 -0
- package/dist/tools/loop/finalAnswerNudges.d.ts.map +1 -0
- package/dist/tools/loop/finalAnswerNudges.js +87 -0
- package/dist/tools/loop/finalAnswerNudges.js.map +1 -0
- package/dist/tools/loop/goalAnchor.d.ts +72 -0
- package/dist/tools/loop/goalAnchor.d.ts.map +1 -0
- package/dist/tools/loop/goalAnchor.js +76 -0
- package/dist/tools/loop/goalAnchor.js.map +1 -0
- package/dist/tools/loop/llmStream.d.ts +70 -0
- package/dist/tools/loop/llmStream.d.ts.map +1 -0
- package/dist/tools/loop/llmStream.js +181 -0
- package/dist/tools/loop/llmStream.js.map +1 -0
- package/dist/tools/loop/parallelExecute.d.ts +57 -0
- package/dist/tools/loop/parallelExecute.d.ts.map +1 -0
- package/dist/tools/loop/parallelExecute.js +54 -0
- package/dist/tools/loop/parallelExecute.js.map +1 -0
- package/dist/tools/loop/singleToolExecute.d.ts +71 -0
- package/dist/tools/loop/singleToolExecute.d.ts.map +1 -0
- package/dist/tools/loop/singleToolExecute.js +139 -0
- package/dist/tools/loop/singleToolExecute.js.map +1 -0
- package/dist/tools/loop/toolCallNormalize.d.ts +57 -0
- package/dist/tools/loop/toolCallNormalize.d.ts.map +1 -0
- package/dist/tools/loop/toolCallNormalize.js +99 -0
- package/dist/tools/loop/toolCallNormalize.js.map +1 -0
- package/dist/tools/loop/turnSetup.d.ts +43 -0
- package/dist/tools/loop/turnSetup.d.ts.map +1 -0
- package/dist/tools/loop/turnSetup.js +48 -0
- package/dist/tools/loop/turnSetup.js.map +1 -0
- package/dist/tools/ocr.d.ts +52 -0
- package/dist/tools/ocr.d.ts.map +1 -0
- package/dist/tools/ocr.js +238 -0
- package/dist/tools/ocr.js.map +1 -0
- package/dist/tools/post-edit-checks.d.ts +46 -0
- package/dist/tools/post-edit-checks.d.ts.map +1 -0
- package/dist/tools/post-edit-checks.js +236 -0
- package/dist/tools/post-edit-checks.js.map +1 -0
- package/dist/tools/skill-loader.d.ts +94 -0
- package/dist/tools/skill-loader.d.ts.map +1 -0
- package/dist/tools/skill-loader.js +422 -0
- package/dist/tools/skill-loader.js.map +1 -0
- package/dist/tools/skill-registry.d.ts +44 -0
- package/dist/tools/skill-registry.d.ts.map +1 -0
- package/dist/tools/skill-registry.js +118 -0
- package/dist/tools/skill-registry.js.map +1 -0
- package/dist/tools/skill-types.d.ts +38 -0
- package/dist/tools/skill-types.d.ts.map +1 -0
- package/dist/tools/skill-types.js +10 -0
- package/dist/tools/skill-types.js.map +1 -0
- package/dist/tools/skills/code-review-skill.d.ts +9 -0
- package/dist/tools/skills/code-review-skill.d.ts.map +1 -0
- package/dist/tools/skills/code-review-skill.js +66 -0
- package/dist/tools/skills/code-review-skill.js.map +1 -0
- package/dist/tools/skills/core-skill.d.ts +13 -0
- package/dist/tools/skills/core-skill.d.ts.map +1 -0
- package/dist/tools/skills/core-skill.js +23 -0
- package/dist/tools/skills/core-skill.js.map +1 -0
- package/dist/tools/skills/git-skill.d.ts +10 -0
- package/dist/tools/skills/git-skill.d.ts.map +1 -0
- package/dist/tools/skills/git-skill.js +30 -0
- package/dist/tools/skills/git-skill.js.map +1 -0
- package/dist/tools/skills/index.d.ts +17 -0
- package/dist/tools/skills/index.d.ts.map +1 -0
- package/dist/tools/skills/index.js +49 -0
- package/dist/tools/skills/index.js.map +1 -0
- package/dist/tools/skills/interaction-skill.d.ts +14 -0
- package/dist/tools/skills/interaction-skill.d.ts.map +1 -0
- package/dist/tools/skills/interaction-skill.js +24 -0
- package/dist/tools/skills/interaction-skill.js.map +1 -0
- package/dist/tools/skills/mail-search-skill.d.ts +25 -0
- package/dist/tools/skills/mail-search-skill.d.ts.map +1 -0
- package/dist/tools/skills/mail-search-skill.js +343 -0
- package/dist/tools/skills/mail-search-skill.js.map +1 -0
- package/dist/tools/skills/plan-skill.d.ts +10 -0
- package/dist/tools/skills/plan-skill.d.ts.map +1 -0
- package/dist/tools/skills/plan-skill.js +126 -0
- package/dist/tools/skills/plan-skill.js.map +1 -0
- package/dist/tools/skills/semantic-search-skill.d.ts +22 -0
- package/dist/tools/skills/semantic-search-skill.d.ts.map +1 -0
- package/dist/tools/skills/semantic-search-skill.js +244 -0
- package/dist/tools/skills/semantic-search-skill.js.map +1 -0
- package/dist/tools/skills/test-gen-skill.d.ts +9 -0
- package/dist/tools/skills/test-gen-skill.d.ts.map +1 -0
- package/dist/tools/skills/test-gen-skill.js +123 -0
- package/dist/tools/skills/test-gen-skill.js.map +1 -0
- package/dist/tools/tool-registry.d.ts +60 -0
- package/dist/tools/tool-registry.d.ts.map +1 -0
- package/dist/tools/tool-registry.js +200 -0
- package/dist/tools/tool-registry.js.map +1 -0
- package/dist/tools/tool-types.d.ts +281 -0
- package/dist/tools/tool-types.d.ts.map +1 -0
- package/dist/tools/tool-types.js +10 -0
- package/dist/tools/tool-types.js.map +1 -0
- package/dist/tools/tool-use-loop.d.ts +231 -0
- package/dist/tools/tool-use-loop.d.ts.map +1 -0
- package/dist/tools/tool-use-loop.js +2057 -0
- package/dist/tools/tool-use-loop.js.map +1 -0
- package/dist/tools/tool-use-parser.d.ts +78 -0
- package/dist/tools/tool-use-parser.d.ts.map +1 -0
- package/dist/tools/tool-use-parser.js +427 -0
- package/dist/tools/tool-use-parser.js.map +1 -0
- package/dist/tools/toolAvailabilityDetector.d.ts +48 -0
- package/dist/tools/toolAvailabilityDetector.d.ts.map +1 -0
- package/dist/tools/toolAvailabilityDetector.js +156 -0
- package/dist/tools/toolAvailabilityDetector.js.map +1 -0
- package/dist/tools/unified-patch.d.ts +87 -0
- package/dist/tools/unified-patch.d.ts.map +1 -0
- package/dist/tools/unified-patch.js +217 -0
- package/dist/tools/unified-patch.js.map +1 -0
- package/dist/types/agent.d.ts +69 -0
- package/dist/types/agent.d.ts.map +1 -0
- package/dist/types/agent.js +54 -0
- package/dist/types/agent.js.map +1 -0
- package/dist/types/tasks.d.ts +22 -0
- package/dist/types/tasks.d.ts.map +1 -0
- package/dist/types/tasks.js +3 -0
- package/dist/types/tasks.js.map +1 -0
- package/dist/utils/event-emitter.d.ts +13 -0
- package/dist/utils/event-emitter.d.ts.map +1 -0
- package/dist/utils/event-emitter.js +54 -0
- package/dist/utils/event-emitter.js.map +1 -0
- package/package.json +33 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool-availability self-correction detector.
|
|
3
|
+
*
|
|
4
|
+
* Failure mode: after a compaction-heavy turn, OR when an earlier tool
|
|
5
|
+
* call errored, the model sometimes claims a tool "isn't available" /
|
|
6
|
+
* "I don't have access to X" / "no X tool exists" — even though the
|
|
7
|
+
* tool IS registered and would have shown up in the native-tools
|
|
8
|
+
* schema sent on this very turn. The model is hallucinating absence,
|
|
9
|
+
* usually because a prior error message ("Error: tool 'X' not
|
|
10
|
+
* registered" from a typo, or "Expected object, received string"
|
|
11
|
+
* from a schema rejection) survived into the compacted history while
|
|
12
|
+
* the actual success path didn't.
|
|
13
|
+
*
|
|
14
|
+
* Captured 2026-05-25 (Mark, live CLI session): model said it couldn't
|
|
15
|
+
* trash messages even though `burtson-labs.trashMessage` was registered
|
|
16
|
+
* in the MCP pool with 119 other tools. Restarting Bandit "fixed" it.
|
|
17
|
+
* That's a band-aid; the framework should detect the false claim and
|
|
18
|
+
* correct the model inline.
|
|
19
|
+
*
|
|
20
|
+
* Strategy: if the model's response (with no tool_call) contains a
|
|
21
|
+
* negation phrase paired with a tool-name-shaped token that matches
|
|
22
|
+
* a registered tool, push a corrective user message that lists the
|
|
23
|
+
* actually-available tools by name. Capped per-turn to avoid loops.
|
|
24
|
+
*/
|
|
25
|
+
export interface ToolAvailabilityCheckResult {
|
|
26
|
+
/** True iff the response claims a tool is missing AND that tool IS registered. */
|
|
27
|
+
detected: boolean;
|
|
28
|
+
/** Names of registered tools that the model appears to be denying access to. */
|
|
29
|
+
matchedToolNames: string[];
|
|
30
|
+
/** Subset of registered tool names relevant to the model's claim, for the nudge body. */
|
|
31
|
+
suggestedTools: string[];
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Pure check — does the response text appear to deny access to a
|
|
35
|
+
* tool that's actually registered?
|
|
36
|
+
*
|
|
37
|
+
* @param response Model's most recent assistant message (post-strip).
|
|
38
|
+
* @param registeredTools Names of every tool currently in the registry.
|
|
39
|
+
* MCP namespacing preserved ("burtson-labs.trashMessage").
|
|
40
|
+
* @returns ToolAvailabilityCheckResult — see field docs.
|
|
41
|
+
*/
|
|
42
|
+
export declare function detectFalseToolAbsence(response: string, registeredTools: string[]): ToolAvailabilityCheckResult;
|
|
43
|
+
/**
|
|
44
|
+
* Build the corrective user message body. Lists the actually-registered
|
|
45
|
+
* tool names so the model sees concrete evidence its claim was wrong.
|
|
46
|
+
*/
|
|
47
|
+
export declare function buildToolAvailabilityNudge(result: ToolAvailabilityCheckResult): string;
|
|
48
|
+
//# sourceMappingURL=toolAvailabilityDetector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toolAvailabilityDetector.d.ts","sourceRoot":"","sources":["../../src/tools/toolAvailabilityDetector.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AA+BH,MAAM,WAAW,2BAA2B;IAC1C,kFAAkF;IAClF,QAAQ,EAAE,OAAO,CAAC;IAClB,gFAAgF;IAChF,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,yFAAyF;IACzF,cAAc,EAAE,MAAM,EAAE,CAAC;CAC1B;AAED;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,MAAM,EAChB,eAAe,EAAE,MAAM,EAAE,GACxB,2BAA2B,CA6D7B;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,2BAA2B,GAAG,MAAM,CAWtF"}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Tool-availability self-correction detector.
|
|
4
|
+
*
|
|
5
|
+
* Failure mode: after a compaction-heavy turn, OR when an earlier tool
|
|
6
|
+
* call errored, the model sometimes claims a tool "isn't available" /
|
|
7
|
+
* "I don't have access to X" / "no X tool exists" — even though the
|
|
8
|
+
* tool IS registered and would have shown up in the native-tools
|
|
9
|
+
* schema sent on this very turn. The model is hallucinating absence,
|
|
10
|
+
* usually because a prior error message ("Error: tool 'X' not
|
|
11
|
+
* registered" from a typo, or "Expected object, received string"
|
|
12
|
+
* from a schema rejection) survived into the compacted history while
|
|
13
|
+
* the actual success path didn't.
|
|
14
|
+
*
|
|
15
|
+
* Captured 2026-05-25 (Mark, live CLI session): model said it couldn't
|
|
16
|
+
* trash messages even though `burtson-labs.trashMessage` was registered
|
|
17
|
+
* in the MCP pool with 119 other tools. Restarting Bandit "fixed" it.
|
|
18
|
+
* That's a band-aid; the framework should detect the false claim and
|
|
19
|
+
* correct the model inline.
|
|
20
|
+
*
|
|
21
|
+
* Strategy: if the model's response (with no tool_call) contains a
|
|
22
|
+
* negation phrase paired with a tool-name-shaped token that matches
|
|
23
|
+
* a registered tool, push a corrective user message that lists the
|
|
24
|
+
* actually-available tools by name. Capped per-turn to avoid loops.
|
|
25
|
+
*/
|
|
26
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
+
exports.detectFalseToolAbsence = detectFalseToolAbsence;
|
|
28
|
+
exports.buildToolAvailabilityNudge = buildToolAvailabilityNudge;
|
|
29
|
+
/**
|
|
30
|
+
* Phrases that signal the model is asserting tool unavailability.
|
|
31
|
+
* Tuned for sensitivity — we'd rather false-positive once than miss
|
|
32
|
+
* the failure mode. The verification step (does the named tool ACTUALLY
|
|
33
|
+
* exist in the registry?) is what gates the corrective nudge, so a
|
|
34
|
+
* false positive here is harmless.
|
|
35
|
+
*/
|
|
36
|
+
const ABSENCE_PHRASES = [
|
|
37
|
+
// "I don't have access to" / "I do not have a … tool"
|
|
38
|
+
/\b(?:I|we)\s+(?:do\s+not|don'?t|does\s+not|doesn'?t)\s+have\s+(?:access\s+to\s+)?/i,
|
|
39
|
+
// "I am unable to find/locate/access"
|
|
40
|
+
/\b(?:I'?m|I am)\s+unable\s+to\s+(?:find|locate|access|use)/i,
|
|
41
|
+
// "cannot find / locate / access X tool"
|
|
42
|
+
/\b(?:cannot|can'?t)\s+(?:find|locate|access|use|call|invoke)\s+/i,
|
|
43
|
+
// "no such tool" / "no … tool is available"
|
|
44
|
+
/\bno\s+(?:such\s+)?\S+(?:\s+\S+){0,3}\s+tool\b/i,
|
|
45
|
+
/\bthere\s+is\s+no\s+\S+(?:\s+\S+){0,3}\s+tool\b/i,
|
|
46
|
+
// "X is not available / unavailable"
|
|
47
|
+
/\b(?:is\s+not\s+available|isn'?t\s+available|are\s+not\s+available|aren'?t\s+available|is\s+unavailable|are\s+unavailable)\b/i,
|
|
48
|
+
/\b(?:not\s+available|unavailable)\s+(?:in|for|to|here|right\s+now|at\s+the\s+moment)/i,
|
|
49
|
+
// "I don't see / can't see X tool in"
|
|
50
|
+
/\b(?:do\s+not|don'?t|cannot|can'?t)\s+see\s+(?:a\s+|an\s+|the\s+)?/i,
|
|
51
|
+
];
|
|
52
|
+
/** Verb keywords that hint the model is talking about an actionable tool. */
|
|
53
|
+
const ACTION_HINTS = [
|
|
54
|
+
/\b(?:trash|archive|delete|remove|send|create|update|modify|read|list|search|fetch|get|post|move|reply)\b/i,
|
|
55
|
+
];
|
|
56
|
+
/**
|
|
57
|
+
* Pure check — does the response text appear to deny access to a
|
|
58
|
+
* tool that's actually registered?
|
|
59
|
+
*
|
|
60
|
+
* @param response Model's most recent assistant message (post-strip).
|
|
61
|
+
* @param registeredTools Names of every tool currently in the registry.
|
|
62
|
+
* MCP namespacing preserved ("burtson-labs.trashMessage").
|
|
63
|
+
* @returns ToolAvailabilityCheckResult — see field docs.
|
|
64
|
+
*/
|
|
65
|
+
function detectFalseToolAbsence(response, registeredTools) {
|
|
66
|
+
if (!response || registeredTools.length === 0) {
|
|
67
|
+
return { detected: false, matchedToolNames: [], suggestedTools: [] };
|
|
68
|
+
}
|
|
69
|
+
const hasAbsencePhrase = ABSENCE_PHRASES.some((re) => re.test(response));
|
|
70
|
+
if (!hasAbsencePhrase) {
|
|
71
|
+
return { detected: false, matchedToolNames: [], suggestedTools: [] };
|
|
72
|
+
}
|
|
73
|
+
// Find any registered tool whose bare name (post-MCP-namespace strip)
|
|
74
|
+
// appears in the response. We test the bare name first because the
|
|
75
|
+
// model rarely uses the full "burtson-labs." prefix when complaining
|
|
76
|
+
// — it'll say "trashMessage" or "trash message" or "delete email".
|
|
77
|
+
const matched = [];
|
|
78
|
+
for (const full of registeredTools) {
|
|
79
|
+
const bare = stripNamespace(full);
|
|
80
|
+
// Exact bare-name substring (case-insensitive). Use word boundaries
|
|
81
|
+
// when feasible — guards against "createFilter" matching mid-word.
|
|
82
|
+
const bareRe = new RegExp(`\\b${escapeRegex(bare)}\\b`, 'i');
|
|
83
|
+
if (bareRe.test(response)) {
|
|
84
|
+
matched.push(full);
|
|
85
|
+
continue;
|
|
86
|
+
}
|
|
87
|
+
// snake_case → space match: trashMessage → "trash message"
|
|
88
|
+
const spaced = bare.replace(/([a-z])([A-Z])/g, '$1 $2').replace(/_/g, ' ').toLowerCase();
|
|
89
|
+
if (spaced !== bare.toLowerCase()) {
|
|
90
|
+
const spacedRe = new RegExp(`\\b${escapeRegex(spaced)}\\b`, 'i');
|
|
91
|
+
if (spacedRe.test(response)) {
|
|
92
|
+
matched.push(full);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
if (matched.length === 0) {
|
|
97
|
+
// Fallback: model said "I don't have access to a Gmail tool" without
|
|
98
|
+
// naming the exact registered name. If the response contains an
|
|
99
|
+
// action verb AND any MCP tool exists that starts with a matching
|
|
100
|
+
// verb stem, suggest those. Conservative — only kicks in when an
|
|
101
|
+
// action hint is present so we don't false-positive on general
|
|
102
|
+
// chitchat.
|
|
103
|
+
const hasAction = ACTION_HINTS.some((re) => re.test(response));
|
|
104
|
+
if (!hasAction) {
|
|
105
|
+
return { detected: false, matchedToolNames: [], suggestedTools: [] };
|
|
106
|
+
}
|
|
107
|
+
// Heuristic: pick the first 6 registered tools whose bare name starts
|
|
108
|
+
// with one of the action verbs the model mentioned. Caps the prompt
|
|
109
|
+
// budget on the corrective message.
|
|
110
|
+
const verbMatches = ACTION_HINTS
|
|
111
|
+
.map((re) => response.match(re)?.[0]?.toLowerCase() ?? '')
|
|
112
|
+
.filter(Boolean);
|
|
113
|
+
if (verbMatches.length === 0) {
|
|
114
|
+
return { detected: false, matchedToolNames: [], suggestedTools: [] };
|
|
115
|
+
}
|
|
116
|
+
const fallback = registeredTools.filter((full) => {
|
|
117
|
+
const bare = stripNamespace(full).toLowerCase();
|
|
118
|
+
return verbMatches.some((v) => bare.startsWith(v));
|
|
119
|
+
});
|
|
120
|
+
if (fallback.length === 0) {
|
|
121
|
+
return { detected: false, matchedToolNames: [], suggestedTools: [] };
|
|
122
|
+
}
|
|
123
|
+
return { detected: true, matchedToolNames: [], suggestedTools: fallback.slice(0, 6) };
|
|
124
|
+
}
|
|
125
|
+
return { detected: true, matchedToolNames: matched, suggestedTools: matched.slice(0, 6) };
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Build the corrective user message body. Lists the actually-registered
|
|
129
|
+
* tool names so the model sees concrete evidence its claim was wrong.
|
|
130
|
+
*/
|
|
131
|
+
function buildToolAvailabilityNudge(result) {
|
|
132
|
+
const names = result.suggestedTools.length > 0 ? result.suggestedTools : result.matchedToolNames;
|
|
133
|
+
const list = names.map((n) => ` - ${n}`).join('\n');
|
|
134
|
+
return ('You claimed a tool is unavailable, but the following tool(s) ARE registered for this turn ' +
|
|
135
|
+
'(check the system tool list — they were sent in the native-tools schema, even if a prior compaction collapsed earlier results):\n' +
|
|
136
|
+
`${list}\n\n` +
|
|
137
|
+
'Re-attempt the action with the correct tool name from the list above. If you have already tried these and they errored, ' +
|
|
138
|
+
'explain WHICH parameter or precondition failed — do not claim absence. If none of these match the user\'s ask, ' +
|
|
139
|
+
'state honestly which capability you lack rather than guessing.');
|
|
140
|
+
}
|
|
141
|
+
function stripNamespace(toolName) {
|
|
142
|
+
const dotIdx = toolName.indexOf('.');
|
|
143
|
+
if (dotIdx > 0)
|
|
144
|
+
return toolName.slice(dotIdx + 1);
|
|
145
|
+
const underIdx = toolName.indexOf('__');
|
|
146
|
+
if (underIdx > 0 && toolName.startsWith('mcp__')) {
|
|
147
|
+
const after = toolName.slice(underIdx + 2);
|
|
148
|
+
const next = after.indexOf('__');
|
|
149
|
+
return next > 0 ? after.slice(next + 2) : after;
|
|
150
|
+
}
|
|
151
|
+
return toolName;
|
|
152
|
+
}
|
|
153
|
+
function escapeRegex(s) {
|
|
154
|
+
return s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
155
|
+
}
|
|
156
|
+
//# sourceMappingURL=toolAvailabilityDetector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toolAvailabilityDetector.js","sourceRoot":"","sources":["../../src/tools/toolAvailabilityDetector.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;;AAiDH,wDAgEC;AAMD,gEAWC;AAhID;;;;;;GAMG;AACH,MAAM,eAAe,GAAa;IAChC,sDAAsD;IACtD,oFAAoF;IACpF,sCAAsC;IACtC,6DAA6D;IAC7D,yCAAyC;IACzC,kEAAkE;IAClE,4CAA4C;IAC5C,iDAAiD;IACjD,kDAAkD;IAClD,qCAAqC;IACrC,+HAA+H;IAC/H,uFAAuF;IACvF,sCAAsC;IACtC,qEAAqE;CACtE,CAAC;AAEF,6EAA6E;AAC7E,MAAM,YAAY,GAAa;IAC7B,2GAA2G;CAC5G,CAAC;AAWF;;;;;;;;GAQG;AACH,SAAgB,sBAAsB,CACpC,QAAgB,EAChB,eAAyB;IAEzB,IAAI,CAAC,QAAQ,IAAI,eAAe,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC9C,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,gBAAgB,EAAE,EAAE,EAAE,cAAc,EAAE,EAAE,EAAE,CAAC;IACvE,CAAC;IACD,MAAM,gBAAgB,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;IACzE,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACtB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CAAC,CAAC,KAAK,CAAC;IAClD,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,SAAS,WAAW,CAAC,CAAS;IAC5B,OAAO,CAAC,CAAC,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC;AAClD,CAAC"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimal unified-diff parser + applier.
|
|
3
|
+
*
|
|
4
|
+
* Models trained on github code have seen far more unified-diff format
|
|
5
|
+
* than they have seen our `apply_edit` find/replace shape, and patches
|
|
6
|
+
* carry built-in context lines that double as preview-friendly diffs
|
|
7
|
+
* for approval UIs. This module powers the `apply_patch` tool —
|
|
8
|
+
* deliberately small, no external deps, just enough to handle the
|
|
9
|
+
* common cases (one or more hunks per file, ~3 lines of context, no
|
|
10
|
+
* binary patches, no rename headers).
|
|
11
|
+
*
|
|
12
|
+
* Format reminder:
|
|
13
|
+
*
|
|
14
|
+
* @@ -10,5 +10,7 @@
|
|
15
|
+
* unchanged line
|
|
16
|
+
* another unchanged
|
|
17
|
+
* -removed line
|
|
18
|
+
* +added line
|
|
19
|
+
* +another added
|
|
20
|
+
* unchanged line
|
|
21
|
+
*
|
|
22
|
+
* What we DO support:
|
|
23
|
+
* - Multiple hunks per patch
|
|
24
|
+
* - File header lines (`--- a/…` / `+++ b/…`) — parsed and ignored;
|
|
25
|
+
* the caller owns the path
|
|
26
|
+
* - Trailing-newline absence on the final hunk
|
|
27
|
+
* - Small context drift (find the hunk by content even if the
|
|
28
|
+
* line numbers are off by a few)
|
|
29
|
+
*
|
|
30
|
+
* What we DON'T support (yet):
|
|
31
|
+
* - Binary patches
|
|
32
|
+
* - Rename / mode-change headers
|
|
33
|
+
* - `git diff --no-index` style headers
|
|
34
|
+
* - Whitespace-only matches across mixed-indent context
|
|
35
|
+
*/
|
|
36
|
+
export interface PatchHunk {
|
|
37
|
+
/** 1-based starting line in the original file (per @@ header). */
|
|
38
|
+
oldStart: number;
|
|
39
|
+
/** Lines of the original this hunk modifies (per @@ header). */
|
|
40
|
+
oldCount: number;
|
|
41
|
+
/** 1-based starting line in the new file. */
|
|
42
|
+
newStart: number;
|
|
43
|
+
/** Lines of the new file produced by this hunk. */
|
|
44
|
+
newCount: number;
|
|
45
|
+
/** Raw body lines including the leading marker (` ` / `-` / `+`). */
|
|
46
|
+
bodyLines: string[];
|
|
47
|
+
}
|
|
48
|
+
export interface ParsedPatch {
|
|
49
|
+
/** Whatever path appeared on the `--- a/…` line, if present. The
|
|
50
|
+
* caller should still pass an explicit `path` argument to the tool;
|
|
51
|
+
* this is informational only. */
|
|
52
|
+
oldPath?: string;
|
|
53
|
+
/** Whatever path appeared on the `+++ b/…` line, if present. */
|
|
54
|
+
newPath?: string;
|
|
55
|
+
hunks: PatchHunk[];
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Parse a unified-diff string into hunks. Returns null when the input
|
|
59
|
+
* doesn't look like a unified diff (no `@@` header found).
|
|
60
|
+
*/
|
|
61
|
+
export declare function parseUnifiedPatch(patch: string): ParsedPatch | null;
|
|
62
|
+
export interface ApplyResult {
|
|
63
|
+
ok: true;
|
|
64
|
+
next: string;
|
|
65
|
+
}
|
|
66
|
+
export interface ApplyError {
|
|
67
|
+
ok: false;
|
|
68
|
+
hunkIndex: number;
|
|
69
|
+
reason: string;
|
|
70
|
+
/** Lines of the file near where the hunk was expected — included in
|
|
71
|
+
* the error so the model can see what's actually there and adjust
|
|
72
|
+
* the patch on retry. */
|
|
73
|
+
contextSnippet?: string;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Apply a parsed patch to a string. Tolerates small line-number drift
|
|
77
|
+
* (the @@ header says "line 42" but the actual matching context is at
|
|
78
|
+
* line 39) by searching forward + backward up to FUZZ lines.
|
|
79
|
+
*
|
|
80
|
+
* Lines in the source preserve their original line endings via the
|
|
81
|
+
* caller (we operate on `\n`-split arrays and re-join at the end).
|
|
82
|
+
* Files with `\r\n` should be normalised by the caller before parsing
|
|
83
|
+
* the patch — keeping that detail outside this module avoids having
|
|
84
|
+
* to thread a "preserve CRLF" flag through every code path.
|
|
85
|
+
*/
|
|
86
|
+
export declare function applyParsedPatch(source: string, patch: ParsedPatch): ApplyResult | ApplyError;
|
|
87
|
+
//# sourceMappingURL=unified-patch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unified-patch.d.ts","sourceRoot":"","sources":["../../src/tools/unified-patch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,MAAM,WAAW,SAAS;IACxB,kEAAkE;IAClE,QAAQ,EAAE,MAAM,CAAC;IACjB,gEAAgE;IAChE,QAAQ,EAAE,MAAM,CAAC;IACjB,6CAA6C;IAC7C,QAAQ,EAAE,MAAM,CAAC;IACjB,mDAAmD;IACnD,QAAQ,EAAE,MAAM,CAAC;IACjB,qEAAqE;IACrE,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB;AAED,MAAM,WAAW,WAAW;IAC1B;;sCAEkC;IAClC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gEAAgE;IAChE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,SAAS,EAAE,CAAC;CACpB;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI,CAsEnE;AAED,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,IAAI,CAAC;IACT,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,KAAK,CAAC;IACV,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf;;8BAE0B;IAC1B,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,GAAG,WAAW,GAAG,UAAU,CAuC7F"}
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Minimal unified-diff parser + applier.
|
|
4
|
+
*
|
|
5
|
+
* Models trained on github code have seen far more unified-diff format
|
|
6
|
+
* than they have seen our `apply_edit` find/replace shape, and patches
|
|
7
|
+
* carry built-in context lines that double as preview-friendly diffs
|
|
8
|
+
* for approval UIs. This module powers the `apply_patch` tool —
|
|
9
|
+
* deliberately small, no external deps, just enough to handle the
|
|
10
|
+
* common cases (one or more hunks per file, ~3 lines of context, no
|
|
11
|
+
* binary patches, no rename headers).
|
|
12
|
+
*
|
|
13
|
+
* Format reminder:
|
|
14
|
+
*
|
|
15
|
+
* @@ -10,5 +10,7 @@
|
|
16
|
+
* unchanged line
|
|
17
|
+
* another unchanged
|
|
18
|
+
* -removed line
|
|
19
|
+
* +added line
|
|
20
|
+
* +another added
|
|
21
|
+
* unchanged line
|
|
22
|
+
*
|
|
23
|
+
* What we DO support:
|
|
24
|
+
* - Multiple hunks per patch
|
|
25
|
+
* - File header lines (`--- a/…` / `+++ b/…`) — parsed and ignored;
|
|
26
|
+
* the caller owns the path
|
|
27
|
+
* - Trailing-newline absence on the final hunk
|
|
28
|
+
* - Small context drift (find the hunk by content even if the
|
|
29
|
+
* line numbers are off by a few)
|
|
30
|
+
*
|
|
31
|
+
* What we DON'T support (yet):
|
|
32
|
+
* - Binary patches
|
|
33
|
+
* - Rename / mode-change headers
|
|
34
|
+
* - `git diff --no-index` style headers
|
|
35
|
+
* - Whitespace-only matches across mixed-indent context
|
|
36
|
+
*/
|
|
37
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
+
exports.parseUnifiedPatch = parseUnifiedPatch;
|
|
39
|
+
exports.applyParsedPatch = applyParsedPatch;
|
|
40
|
+
/**
|
|
41
|
+
* Parse a unified-diff string into hunks. Returns null when the input
|
|
42
|
+
* doesn't look like a unified diff (no `@@` header found).
|
|
43
|
+
*/
|
|
44
|
+
function parseUnifiedPatch(patch) {
|
|
45
|
+
const lines = patch.split('\n');
|
|
46
|
+
let i = 0;
|
|
47
|
+
let oldPath;
|
|
48
|
+
let newPath;
|
|
49
|
+
// Optional file headers — strip them off if present so we land on
|
|
50
|
+
// the first @@ hunk header.
|
|
51
|
+
while (i < lines.length) {
|
|
52
|
+
const line = lines[i];
|
|
53
|
+
if (line.startsWith('--- ')) {
|
|
54
|
+
oldPath = line.slice(4).trim();
|
|
55
|
+
i++;
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
if (line.startsWith('+++ ')) {
|
|
59
|
+
newPath = line.slice(4).trim();
|
|
60
|
+
i++;
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
if (line.startsWith('diff ') || line.startsWith('index ')) {
|
|
64
|
+
i++;
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
67
|
+
break;
|
|
68
|
+
}
|
|
69
|
+
const hunks = [];
|
|
70
|
+
while (i < lines.length) {
|
|
71
|
+
const header = lines[i];
|
|
72
|
+
const headerMatch = /^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/.exec(header);
|
|
73
|
+
if (!headerMatch) {
|
|
74
|
+
// Skip blank lines or trailing junk between hunks; bail if we
|
|
75
|
+
// hit something that isn't a header AND isn't whitespace.
|
|
76
|
+
if (header.trim() === '') {
|
|
77
|
+
i++;
|
|
78
|
+
continue;
|
|
79
|
+
}
|
|
80
|
+
if (hunks.length === 0)
|
|
81
|
+
return null;
|
|
82
|
+
break;
|
|
83
|
+
}
|
|
84
|
+
const oldStart = parseInt(headerMatch[1], 10);
|
|
85
|
+
const oldCount = headerMatch[2] !== undefined ? parseInt(headerMatch[2], 10) : 1;
|
|
86
|
+
const newStart = parseInt(headerMatch[3], 10);
|
|
87
|
+
const newCount = headerMatch[4] !== undefined ? parseInt(headerMatch[4], 10) : 1;
|
|
88
|
+
i++;
|
|
89
|
+
const bodyLines = [];
|
|
90
|
+
let oldSeen = 0;
|
|
91
|
+
let newSeen = 0;
|
|
92
|
+
while (i < lines.length && (oldSeen < oldCount || newSeen < newCount)) {
|
|
93
|
+
const line = lines[i];
|
|
94
|
+
if (line.startsWith('@@'))
|
|
95
|
+
break;
|
|
96
|
+
if (line.startsWith(' ')) {
|
|
97
|
+
oldSeen++;
|
|
98
|
+
newSeen++;
|
|
99
|
+
}
|
|
100
|
+
else if (line.startsWith('-')) {
|
|
101
|
+
oldSeen++;
|
|
102
|
+
}
|
|
103
|
+
else if (line.startsWith('+')) {
|
|
104
|
+
newSeen++;
|
|
105
|
+
}
|
|
106
|
+
else if (line.startsWith('\\')) { /* "" — ignore */ }
|
|
107
|
+
else if (line === '') {
|
|
108
|
+
// Empty line in the body — treat as a blank context line.
|
|
109
|
+
// Some diff tools omit the leading space on empty context.
|
|
110
|
+
oldSeen++;
|
|
111
|
+
newSeen++;
|
|
112
|
+
bodyLines.push(' ');
|
|
113
|
+
i++;
|
|
114
|
+
continue;
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
// Anything else is junk; bail on this hunk.
|
|
118
|
+
break;
|
|
119
|
+
}
|
|
120
|
+
bodyLines.push(line);
|
|
121
|
+
i++;
|
|
122
|
+
}
|
|
123
|
+
hunks.push({ oldStart, oldCount, newStart, newCount, bodyLines });
|
|
124
|
+
}
|
|
125
|
+
if (hunks.length === 0)
|
|
126
|
+
return null;
|
|
127
|
+
return { oldPath, newPath, hunks };
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Apply a parsed patch to a string. Tolerates small line-number drift
|
|
131
|
+
* (the @@ header says "line 42" but the actual matching context is at
|
|
132
|
+
* line 39) by searching forward + backward up to FUZZ lines.
|
|
133
|
+
*
|
|
134
|
+
* Lines in the source preserve their original line endings via the
|
|
135
|
+
* caller (we operate on `\n`-split arrays and re-join at the end).
|
|
136
|
+
* Files with `\r\n` should be normalised by the caller before parsing
|
|
137
|
+
* the patch — keeping that detail outside this module avoids having
|
|
138
|
+
* to thread a "preserve CRLF" flag through every code path.
|
|
139
|
+
*/
|
|
140
|
+
function applyParsedPatch(source, patch) {
|
|
141
|
+
const FUZZ = 5;
|
|
142
|
+
const lines = source.split('\n');
|
|
143
|
+
// Track the running line offset induced by prior hunks so the next
|
|
144
|
+
// hunk can search relative to its position in the modified file.
|
|
145
|
+
let runningDelta = 0;
|
|
146
|
+
for (let h = 0; h < patch.hunks.length; h++) {
|
|
147
|
+
const hunk = patch.hunks[h];
|
|
148
|
+
// Build the "original" context (every body line that's a delete
|
|
149
|
+
// or context, in order) so we can find the actual position of the
|
|
150
|
+
// hunk in `lines` even when line numbers have drifted.
|
|
151
|
+
const originalContext = [];
|
|
152
|
+
const newBody = [];
|
|
153
|
+
for (const raw of hunk.bodyLines) {
|
|
154
|
+
const marker = raw[0] ?? ' ';
|
|
155
|
+
const body = raw.slice(1);
|
|
156
|
+
if (marker === ' ') {
|
|
157
|
+
originalContext.push(body);
|
|
158
|
+
newBody.push(body);
|
|
159
|
+
}
|
|
160
|
+
else if (marker === '-') {
|
|
161
|
+
originalContext.push(body);
|
|
162
|
+
}
|
|
163
|
+
else if (marker === '+') {
|
|
164
|
+
newBody.push(body);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
// Find the original-context block in `lines`. Start by checking
|
|
168
|
+
// the header-claimed position (adjusted for prior hunk deltas);
|
|
169
|
+
// if that doesn't match, scan a small window forward and back.
|
|
170
|
+
const expected = (hunk.oldStart - 1) + runningDelta;
|
|
171
|
+
const matchIndex = findContextIndex(lines, originalContext, expected, FUZZ);
|
|
172
|
+
if (matchIndex < 0) {
|
|
173
|
+
const sample = lines.slice(Math.max(0, expected - 2), expected + 5).join('\n');
|
|
174
|
+
return {
|
|
175
|
+
ok: false,
|
|
176
|
+
hunkIndex: h,
|
|
177
|
+
reason: `hunk ${h + 1} did not apply at or near line ${hunk.oldStart}: the - / context lines don't match the file. Re-read the file with read_file and regenerate the patch with current line content.`,
|
|
178
|
+
contextSnippet: sample
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
// Splice in the new body in place of the original-context block.
|
|
182
|
+
lines.splice(matchIndex, originalContext.length, ...newBody);
|
|
183
|
+
runningDelta += newBody.length - originalContext.length;
|
|
184
|
+
}
|
|
185
|
+
return { ok: true, next: lines.join('\n') };
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Locate the run of `context` inside `lines`, preferring a position
|
|
189
|
+
* close to `expected`. Returns -1 when no match within `fuzz` lines on
|
|
190
|
+
* either side.
|
|
191
|
+
*/
|
|
192
|
+
function findContextIndex(lines, context, expected, fuzz) {
|
|
193
|
+
if (context.length === 0) {
|
|
194
|
+
// Pure-insert hunk (no - or context lines) — use the expected
|
|
195
|
+
// position directly. Clamp to bounds.
|
|
196
|
+
return Math.max(0, Math.min(expected, lines.length));
|
|
197
|
+
}
|
|
198
|
+
const matches = (start) => {
|
|
199
|
+
if (start < 0 || start + context.length > lines.length)
|
|
200
|
+
return false;
|
|
201
|
+
for (let i = 0; i < context.length; i++) {
|
|
202
|
+
if (lines[start + i] !== context[i])
|
|
203
|
+
return false;
|
|
204
|
+
}
|
|
205
|
+
return true;
|
|
206
|
+
};
|
|
207
|
+
if (matches(expected))
|
|
208
|
+
return expected;
|
|
209
|
+
for (let d = 1; d <= fuzz; d++) {
|
|
210
|
+
if (matches(expected - d))
|
|
211
|
+
return expected - d;
|
|
212
|
+
if (matches(expected + d))
|
|
213
|
+
return expected + d;
|
|
214
|
+
}
|
|
215
|
+
return -1;
|
|
216
|
+
}
|
|
217
|
+
//# sourceMappingURL=unified-patch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unified-patch.js","sourceRoot":"","sources":["../../src/tools/unified-patch.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;;AA6BH,8CAsEC;AA4BD,4CAuCC;AA7ID;;;GAGG;AACH,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;QAC/B,IAAI,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;YAAE,OAAO,QAAQ,GAAG,CAAC,CAAC;QAC/C,IAAI,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;YAAE,OAAO,QAAQ,GAAG,CAAC,CAAC;IACjD,CAAC;IACD,OAAO,CAAC,CAAC,CAAC;AACZ,CAAC"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
export type AgentStepStatus = "pending" | "in_progress" | "completed" | "failed";
|
|
2
|
+
export interface AgentStep {
|
|
3
|
+
id: string;
|
|
4
|
+
title: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
status?: AgentStepStatus;
|
|
7
|
+
command?: string;
|
|
8
|
+
metadata?: Record<string, unknown>;
|
|
9
|
+
}
|
|
10
|
+
export interface AgentPlan {
|
|
11
|
+
id: string;
|
|
12
|
+
goal: string;
|
|
13
|
+
summary: string;
|
|
14
|
+
steps: AgentStep[];
|
|
15
|
+
createdAt: number;
|
|
16
|
+
version: string;
|
|
17
|
+
}
|
|
18
|
+
export interface AgentContext {
|
|
19
|
+
files: string[];
|
|
20
|
+
goals: string[];
|
|
21
|
+
repository?: string;
|
|
22
|
+
metadata?: Record<string, unknown>;
|
|
23
|
+
}
|
|
24
|
+
export interface AgentEvent<TPayload = unknown> {
|
|
25
|
+
type: string;
|
|
26
|
+
payload?: TPayload;
|
|
27
|
+
timestamp: number;
|
|
28
|
+
}
|
|
29
|
+
export interface AgentDiff {
|
|
30
|
+
path: string;
|
|
31
|
+
type: "create" | "update" | "delete";
|
|
32
|
+
preview?: string;
|
|
33
|
+
metadata?: Record<string, unknown>;
|
|
34
|
+
}
|
|
35
|
+
export interface AgentExecutionResult {
|
|
36
|
+
stepId: string;
|
|
37
|
+
status: AgentStepStatus;
|
|
38
|
+
diff?: AgentDiff[];
|
|
39
|
+
logs?: string[];
|
|
40
|
+
metadata?: Record<string, unknown>;
|
|
41
|
+
}
|
|
42
|
+
export interface AgentReport {
|
|
43
|
+
goal: string;
|
|
44
|
+
summary: string;
|
|
45
|
+
steps: AgentExecutionResult[];
|
|
46
|
+
startedAt: number;
|
|
47
|
+
completedAt: number;
|
|
48
|
+
metadata?: Record<string, unknown>;
|
|
49
|
+
}
|
|
50
|
+
export interface AgentAskResult {
|
|
51
|
+
prompt: string;
|
|
52
|
+
response: string;
|
|
53
|
+
durationMs: number;
|
|
54
|
+
metadata?: Record<string, unknown>;
|
|
55
|
+
}
|
|
56
|
+
export type PlanValidationResult = {
|
|
57
|
+
ok: true;
|
|
58
|
+
plan: AgentPlan;
|
|
59
|
+
} | {
|
|
60
|
+
ok: false;
|
|
61
|
+
errors: string[];
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* Structural validator for AgentPlan objects returned by the planner.
|
|
65
|
+
* Used to catch malformed or incomplete plans before they reach the executor.
|
|
66
|
+
* Emits a PLAN_PARSE_FAILED event so the runtime can surface the error cleanly.
|
|
67
|
+
*/
|
|
68
|
+
export declare function validateAgentPlan(raw: unknown): PlanValidationResult;
|
|
69
|
+
//# sourceMappingURL=agent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../src/types/agent.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG,aAAa,GAAG,WAAW,GAAG,QAAQ,CAAC;AAEjF,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AAED,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CA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