@pentoshi/clai 3.5.1 → 3.6.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 +1 -1
- package/dist/agent/context-manager.js +8 -2
- package/dist/agent/context-manager.js.map +1 -1
- package/dist/agent/loop-guard.d.ts +2 -0
- package/dist/agent/loop-guard.js +39 -2
- package/dist/agent/loop-guard.js.map +1 -1
- package/dist/agent/plan-tool.d.ts +22 -0
- package/dist/agent/plan-tool.js +357 -44
- package/dist/agent/plan-tool.js.map +1 -1
- package/dist/agent/project-root.d.ts +33 -0
- package/dist/agent/project-root.js +158 -0
- package/dist/agent/project-root.js.map +1 -0
- package/dist/agent/runner.js +1119 -240
- package/dist/agent/runner.js.map +1 -1
- package/dist/agent/task-evidence.d.ts +103 -0
- package/dist/agent/task-evidence.js +413 -0
- package/dist/agent/task-evidence.js.map +1 -0
- package/dist/agent/tool-call-parser.d.ts +16 -0
- package/dist/agent/tool-call-parser.js +86 -28
- package/dist/agent/tool-call-parser.js.map +1 -1
- package/dist/agent/tool-history.d.ts +27 -0
- package/dist/agent/tool-history.js +150 -0
- package/dist/agent/tool-history.js.map +1 -0
- package/dist/agent/workspace-orient.d.ts +64 -0
- package/dist/agent/workspace-orient.js +418 -0
- package/dist/agent/workspace-orient.js.map +1 -0
- package/dist/app/controllers/session-controller.js +4 -0
- package/dist/app/controllers/session-controller.js.map +1 -1
- package/dist/commands/doctor.js +3 -0
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/update.js +1 -1
- package/dist/llm/adapters/anthropic-tools.d.ts +99 -0
- package/dist/llm/adapters/anthropic-tools.js +225 -0
- package/dist/llm/adapters/anthropic-tools.js.map +1 -0
- package/dist/llm/adapters/gemini-tools.d.ts +54 -0
- package/dist/llm/adapters/gemini-tools.js +139 -0
- package/dist/llm/adapters/gemini-tools.js.map +1 -0
- package/dist/llm/adapters/ollama-tools.d.ts +22 -0
- package/dist/llm/adapters/ollama-tools.js +62 -0
- package/dist/llm/adapters/ollama-tools.js.map +1 -0
- package/dist/llm/adapters/openai-tools.d.ts +39 -0
- package/dist/llm/adapters/openai-tools.js +71 -0
- package/dist/llm/adapters/openai-tools.js.map +1 -0
- package/dist/llm/agentrouter.js +23 -4
- package/dist/llm/agentrouter.js.map +1 -1
- package/dist/llm/anthropic.js +93 -92
- package/dist/llm/anthropic.js.map +1 -1
- package/dist/llm/aws-mantle.js +93 -56
- package/dist/llm/aws-mantle.js.map +1 -1
- package/dist/llm/bynara.js +23 -4
- package/dist/llm/bynara.js.map +1 -1
- package/dist/llm/capabilities.d.ts +7 -0
- package/dist/llm/capabilities.js +74 -0
- package/dist/llm/capabilities.js.map +1 -1
- package/dist/llm/gemini.js +63 -48
- package/dist/llm/gemini.js.map +1 -1
- package/dist/llm/groq.js +23 -4
- package/dist/llm/groq.js.map +1 -1
- package/dist/llm/http.d.ts +22 -17
- package/dist/llm/http.js +99 -26
- package/dist/llm/http.js.map +1 -1
- package/dist/llm/kimchi.js +23 -4
- package/dist/llm/kimchi.js.map +1 -1
- package/dist/llm/nvidia.js +23 -4
- package/dist/llm/nvidia.js.map +1 -1
- package/dist/llm/ollama.js +49 -31
- package/dist/llm/ollama.js.map +1 -1
- package/dist/llm/openai.js +23 -4
- package/dist/llm/openai.js.map +1 -1
- package/dist/llm/openrouter.js +23 -4
- package/dist/llm/openrouter.js.map +1 -1
- package/dist/llm/qwen-cloud.js +23 -4
- package/dist/llm/qwen-cloud.js.map +1 -1
- package/dist/llm/router.js +48 -6
- package/dist/llm/router.js.map +1 -1
- package/dist/llm/tool-protocol.d.ts +73 -0
- package/dist/llm/tool-protocol.js +282 -0
- package/dist/llm/tool-protocol.js.map +1 -0
- package/dist/modes/ask.js +74 -20
- package/dist/modes/ask.js.map +1 -1
- package/dist/prompts/index.d.ts +13 -5
- package/dist/prompts/index.js +116 -18
- package/dist/prompts/index.js.map +1 -1
- package/dist/repl.js +7 -0
- package/dist/repl.js.map +1 -1
- package/dist/store/config.d.ts +7 -0
- package/dist/store/config.js +1 -0
- package/dist/store/config.js.map +1 -1
- package/dist/store/plan.d.ts +2 -0
- package/dist/store/plan.js.map +1 -1
- package/dist/tools/capabilities.d.ts +2 -0
- package/dist/tools/capabilities.js +101 -6
- package/dist/tools/capabilities.js.map +1 -1
- package/dist/tools/command-intent.d.ts +1 -0
- package/dist/tools/command-intent.js +31 -0
- package/dist/tools/command-intent.js.map +1 -1
- package/dist/tools/definitions.d.ts +20 -0
- package/dist/tools/definitions.js +509 -0
- package/dist/tools/definitions.js.map +1 -0
- package/dist/tools/fs.js +12 -3
- package/dist/tools/fs.js.map +1 -1
- package/dist/tools/net-ping-sweep.js +69 -16
- package/dist/tools/net-ping-sweep.js.map +1 -1
- package/dist/tools/nmap-runner.d.ts +8 -7
- package/dist/tools/nmap-runner.js +126 -65
- package/dist/tools/nmap-runner.js.map +1 -1
- package/dist/tools/registry.js +45 -7
- package/dist/tools/registry.js.map +1 -1
- package/dist/tools/validate.d.ts +11 -0
- package/dist/tools/validate.js +53 -0
- package/dist/tools/validate.js.map +1 -1
- package/dist/tools/web/search.js +48 -4
- package/dist/tools/web/search.js.map +1 -1
- package/dist/tui-v2/components/transcript/tool-card.js +1 -1
- package/dist/tui-v2/components/transcript/tool-card.js.map +1 -1
- package/dist/tui-v2/rendering/tool-presenter.d.ts +6 -1
- package/dist/tui-v2/rendering/tool-presenter.js +66 -2
- package/dist/tui-v2/rendering/tool-presenter.js.map +1 -1
- package/dist/types.d.ts +58 -0
- package/dist/ui/ansi-box.d.ts +2 -0
- package/dist/ui/ansi-box.js +8 -1
- package/dist/ui/ansi-box.js.map +1 -1
- package/package.json +1 -1
|
@@ -67,12 +67,43 @@ const LONG_RUNNING_PATTERNS = [
|
|
|
67
67
|
function backgroundsAProcess(command) {
|
|
68
68
|
return /(?:^|[^&\d>])\s&(?:\s|$)/.test(command);
|
|
69
69
|
}
|
|
70
|
+
/**
|
|
71
|
+
* One-shot project scaffolders — finish and exit. Must stay in the
|
|
72
|
+
* foreground even when the command string mentions `vite` / `next`.
|
|
73
|
+
*/
|
|
74
|
+
const SCAFFOLD_FOREGROUND_PATTERNS = [
|
|
75
|
+
/\bnpm\s+create\b/i,
|
|
76
|
+
/\bnpm\s+init\b/i,
|
|
77
|
+
/\byarn\s+create\b/i,
|
|
78
|
+
/\bpnpm\s+create\b/i,
|
|
79
|
+
/\bbun\s+create\b/i,
|
|
80
|
+
/\bnpx\s+(?:--yes\s+)?create-[\w-]+/i,
|
|
81
|
+
/\bnpmx?\s+create-[\w-]+/i,
|
|
82
|
+
/\bdeno\s+run\b.*\bcreate\b/i,
|
|
83
|
+
// Non-JS one-shot project creators (must stay foreground)
|
|
84
|
+
/\bcargo\s+new\b/i,
|
|
85
|
+
/\bcargo\s+init\b/i,
|
|
86
|
+
/\bgo\s+mod\s+init\b/i,
|
|
87
|
+
/\bpoetry\s+new\b/i,
|
|
88
|
+
/\bdjango-admin\s+startproject\b/i,
|
|
89
|
+
/\brails\s+new\b/i,
|
|
90
|
+
/\bcomposer\s+create-project\b/i,
|
|
91
|
+
/\bmix\s+new\b/i,
|
|
92
|
+
/\bflutter\s+create\b/i,
|
|
93
|
+
/\bdotnet\s+new\b/i,
|
|
94
|
+
];
|
|
95
|
+
export function looksLikeOneShotScaffolder(command) {
|
|
96
|
+
return SCAFFOLD_FOREGROUND_PATTERNS.some((p) => p.test(command));
|
|
97
|
+
}
|
|
70
98
|
/**
|
|
71
99
|
* Returns true if the command appears to be a long-running process that
|
|
72
100
|
* should not block the foreground shell. This is a heuristic — false
|
|
73
101
|
* negatives are safer than false positives.
|
|
74
102
|
*/
|
|
75
103
|
export function looksLongRunning(command) {
|
|
104
|
+
// X5: npm create vite / create-next-app exit; do not background them.
|
|
105
|
+
if (looksLikeOneShotScaffolder(command))
|
|
106
|
+
return false;
|
|
76
107
|
return (backgroundsAProcess(command) ||
|
|
77
108
|
LONG_RUNNING_PATTERNS.some((pattern) => pattern.test(command)));
|
|
78
109
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-intent.js","sourceRoot":"","sources":["../../src/tools/command-intent.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,qBAAqB,GAAa;IACtC,wEAAwE;IACxE,mDAAmD;IACnD,mCAAmC;IACnC,wBAAwB;IAExB,sBAAsB;IACtB,sCAAsC;IACtC,0CAA0C;IAE1C,sBAAsB;IACtB,sBAAsB;IACtB,iBAAiB;IACjB,iBAAiB;IACjB,gBAAgB;IAChB,oBAAoB;IACpB,oBAAoB;IACpB,cAAc;IACd,uBAAuB;IACvB,iBAAiB;IACjB,iBAAiB;IAEjB,2BAA2B;IAC3B,qBAAqB;IACrB,wBAAwB;IACxB,aAAa;IACb,oBAAoB;IAEpB,SAAS;IACT,2BAA2B;IAC3B,4BAA4B;IAC5B,0BAA0B;IAE1B,yBAAyB;IACzB,cAAc;IACd,eAAe;IACf,kBAAkB;IAClB,2BAA2B;IAC3B,cAAc;IAEd,oBAAoB;IACpB,eAAe;IACf,cAAc;IACd,iBAAiB;IAEjB,iBAAiB;IACjB,mBAAmB;IACnB,sBAAsB;IACtB,+BAA+B;IAE/B,oBAAoB;IACpB,cAAc;IACd,gBAAgB;IAChB,mBAAmB;IAEnB,wEAAwE;IACxE,sBAAsB;IACtB,aAAa;IACb,mBAAmB;IACnB,aAAa;IACb,eAAe;IACf,oBAAoB;IACpB,kBAAkB;CACnB,CAAC;AAEF;;;;;GAKG;AACH,SAAS,mBAAmB,CAAC,OAAe;IAC1C,OAAO,0BAA0B,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AAClD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAAe;IAC9C,OAAO,CACL,mBAAmB,CAAC,OAAO,CAAC;QAC5B,qBAAqB,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAC/D,CAAC;AACJ,CAAC"}
|
|
1
|
+
{"version":3,"file":"command-intent.js","sourceRoot":"","sources":["../../src/tools/command-intent.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,qBAAqB,GAAa;IACtC,wEAAwE;IACxE,mDAAmD;IACnD,mCAAmC;IACnC,wBAAwB;IAExB,sBAAsB;IACtB,sCAAsC;IACtC,0CAA0C;IAE1C,sBAAsB;IACtB,sBAAsB;IACtB,iBAAiB;IACjB,iBAAiB;IACjB,gBAAgB;IAChB,oBAAoB;IACpB,oBAAoB;IACpB,cAAc;IACd,uBAAuB;IACvB,iBAAiB;IACjB,iBAAiB;IAEjB,2BAA2B;IAC3B,qBAAqB;IACrB,wBAAwB;IACxB,aAAa;IACb,oBAAoB;IAEpB,SAAS;IACT,2BAA2B;IAC3B,4BAA4B;IAC5B,0BAA0B;IAE1B,yBAAyB;IACzB,cAAc;IACd,eAAe;IACf,kBAAkB;IAClB,2BAA2B;IAC3B,cAAc;IAEd,oBAAoB;IACpB,eAAe;IACf,cAAc;IACd,iBAAiB;IAEjB,iBAAiB;IACjB,mBAAmB;IACnB,sBAAsB;IACtB,+BAA+B;IAE/B,oBAAoB;IACpB,cAAc;IACd,gBAAgB;IAChB,mBAAmB;IAEnB,wEAAwE;IACxE,sBAAsB;IACtB,aAAa;IACb,mBAAmB;IACnB,aAAa;IACb,eAAe;IACf,oBAAoB;IACpB,kBAAkB;CACnB,CAAC;AAEF;;;;;GAKG;AACH,SAAS,mBAAmB,CAAC,OAAe;IAC1C,OAAO,0BAA0B,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AAClD,CAAC;AAED;;;GAGG;AACH,MAAM,4BAA4B,GAAa;IAC7C,mBAAmB;IACnB,iBAAiB;IACjB,oBAAoB;IACpB,oBAAoB;IACpB,mBAAmB;IACnB,qCAAqC;IACrC,0BAA0B;IAC1B,6BAA6B;IAC7B,0DAA0D;IAC1D,kBAAkB;IAClB,mBAAmB;IACnB,sBAAsB;IACtB,mBAAmB;IACnB,kCAAkC;IAClC,kBAAkB;IAClB,gCAAgC;IAChC,gBAAgB;IAChB,uBAAuB;IACvB,mBAAmB;CACpB,CAAC;AAEF,MAAM,UAAU,0BAA0B,CAAC,OAAe;IACxD,OAAO,4BAA4B,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;AACnE,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAAe;IAC9C,sEAAsE;IACtE,IAAI,0BAA0B,CAAC,OAAO,CAAC;QAAE,OAAO,KAAK,CAAC;IACtD,OAAO,CACL,mBAAmB,CAAC,OAAO,CAAC;QAC5B,qBAAqB,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAC/D,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ToolDefinition } from "../types.js";
|
|
2
|
+
/** Plan tools dispatched specially in the runner (not in toolRegistry). */
|
|
3
|
+
export declare const PLAN_TOOL_NAMES: Set<string>;
|
|
4
|
+
/** Meta tools with no registry handler (plan + ask-mode handoff). */
|
|
5
|
+
export declare const NON_REGISTRY_TOOL_NAMES: Set<string>;
|
|
6
|
+
export declare const TOOL_DEFINITIONS: ToolDefinition[];
|
|
7
|
+
export declare function getToolDefinition(name: string): ToolDefinition | undefined;
|
|
8
|
+
export declare function getToolDefinitions(filter?: {
|
|
9
|
+
askMode?: boolean;
|
|
10
|
+
names?: string[];
|
|
11
|
+
compact?: boolean;
|
|
12
|
+
}): ToolDefinition[];
|
|
13
|
+
export declare function getCompactToolDefinitions(): ToolDefinition[];
|
|
14
|
+
export declare function wireNameFor(canonical: string): string;
|
|
15
|
+
export declare function canonicalNameFor(wire: string): string | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* Every registry key must have a definition; every definition must have a
|
|
18
|
+
* handler unless it is a plan meta-tool.
|
|
19
|
+
*/
|
|
20
|
+
export declare function assertDefinitionRegistryConsistency(registryKeys: string[]): void;
|
|
@@ -0,0 +1,509 @@
|
|
|
1
|
+
import { registerWireNamesFor, toSnakeWireName, toWireName, } from "../llm/tool-protocol.js";
|
|
2
|
+
function def(name, description, parameters, flags = {}) {
|
|
3
|
+
// Primary wire keeps camelCase (fs_writeMany); also register snake alias.
|
|
4
|
+
const wireName = registerWireNamesFor(name);
|
|
5
|
+
return {
|
|
6
|
+
name,
|
|
7
|
+
wireName,
|
|
8
|
+
description,
|
|
9
|
+
parameters,
|
|
10
|
+
...flags,
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
const emptyObject = {
|
|
14
|
+
type: "object",
|
|
15
|
+
properties: {},
|
|
16
|
+
additionalProperties: false,
|
|
17
|
+
};
|
|
18
|
+
/** Plan tools dispatched specially in the runner (not in toolRegistry). */
|
|
19
|
+
export const PLAN_TOOL_NAMES = new Set(["plan.create", "task.update"]);
|
|
20
|
+
/** Meta tools with no registry handler (plan + ask-mode handoff). */
|
|
21
|
+
export const NON_REGISTRY_TOOL_NAMES = new Set([
|
|
22
|
+
...PLAN_TOOL_NAMES,
|
|
23
|
+
"agent.handoff",
|
|
24
|
+
]);
|
|
25
|
+
export const TOOL_DEFINITIONS = [
|
|
26
|
+
def("fs.read", "Read a file. Use for inspecting source, configs, or outputs. Prefer offset/limit for large files.", {
|
|
27
|
+
type: "object",
|
|
28
|
+
properties: {
|
|
29
|
+
path: {
|
|
30
|
+
type: "string",
|
|
31
|
+
description: "File path (absolute, relative, or ~)",
|
|
32
|
+
},
|
|
33
|
+
offset: {
|
|
34
|
+
type: "integer",
|
|
35
|
+
description: "1-indexed start line for paging",
|
|
36
|
+
},
|
|
37
|
+
limit: { type: "integer", description: "Max lines to return" },
|
|
38
|
+
maxBytes: { type: "integer", description: "Max bytes to read" },
|
|
39
|
+
},
|
|
40
|
+
required: ["path"],
|
|
41
|
+
additionalProperties: false,
|
|
42
|
+
}, { readOnly: true, askMode: true }),
|
|
43
|
+
def("fs.write", "Create or fully overwrite a file with complete content in one call. Prefer this over append for new files.", {
|
|
44
|
+
type: "object",
|
|
45
|
+
properties: {
|
|
46
|
+
path: { type: "string" },
|
|
47
|
+
content: {
|
|
48
|
+
type: "string",
|
|
49
|
+
description: "Full file contents in one call",
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
required: ["path", "content"],
|
|
53
|
+
additionalProperties: false,
|
|
54
|
+
}, { mutates: true }),
|
|
55
|
+
def("fs.writeMany", "Write multiple complete files in one call (scaffold). Max 50 files.", {
|
|
56
|
+
type: "object",
|
|
57
|
+
properties: {
|
|
58
|
+
files: {
|
|
59
|
+
type: "array",
|
|
60
|
+
maxItems: 50,
|
|
61
|
+
items: {
|
|
62
|
+
type: "object",
|
|
63
|
+
properties: {
|
|
64
|
+
path: { type: "string" },
|
|
65
|
+
content: { type: "string" },
|
|
66
|
+
},
|
|
67
|
+
required: ["path", "content"],
|
|
68
|
+
additionalProperties: false,
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
required: ["files"],
|
|
73
|
+
additionalProperties: false,
|
|
74
|
+
}, { mutates: true }),
|
|
75
|
+
def("fs.list", "List directory entries.", {
|
|
76
|
+
type: "object",
|
|
77
|
+
properties: {
|
|
78
|
+
path: { type: "string" },
|
|
79
|
+
maxEntries: { type: "integer" },
|
|
80
|
+
},
|
|
81
|
+
required: [],
|
|
82
|
+
additionalProperties: false,
|
|
83
|
+
}, { readOnly: true, askMode: true }),
|
|
84
|
+
def("fs.search", "Search file contents by pattern (ripgrep-style).", {
|
|
85
|
+
type: "object",
|
|
86
|
+
properties: {
|
|
87
|
+
pattern: { type: "string" },
|
|
88
|
+
path: { type: "string" },
|
|
89
|
+
},
|
|
90
|
+
required: ["pattern"],
|
|
91
|
+
additionalProperties: false,
|
|
92
|
+
}, { readOnly: true, askMode: true }),
|
|
93
|
+
def("fs.edit", "Surgical in-place edit: replace exact oldText with newText.", {
|
|
94
|
+
type: "object",
|
|
95
|
+
properties: {
|
|
96
|
+
path: { type: "string" },
|
|
97
|
+
oldText: { type: "string" },
|
|
98
|
+
newText: { type: "string" },
|
|
99
|
+
expectedReplacements: { type: "integer" },
|
|
100
|
+
},
|
|
101
|
+
required: ["path", "oldText", "newText"],
|
|
102
|
+
additionalProperties: false,
|
|
103
|
+
}, { mutates: true }),
|
|
104
|
+
def("fs.replaceLines", "Replace a 1-indexed inclusive line range after reading the file. Empty content (or delete:true) deletes that range.", {
|
|
105
|
+
type: "object",
|
|
106
|
+
properties: {
|
|
107
|
+
path: { type: "string" },
|
|
108
|
+
startLine: { type: "integer" },
|
|
109
|
+
endLine: { type: "integer" },
|
|
110
|
+
content: {
|
|
111
|
+
type: "string",
|
|
112
|
+
description: "Replacement text. Empty string deletes the line range (no space hack).",
|
|
113
|
+
},
|
|
114
|
+
delete: {
|
|
115
|
+
type: "boolean",
|
|
116
|
+
description: "If true, delete the range (same as content:\"\")",
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
required: ["path", "startLine", "endLine"],
|
|
120
|
+
additionalProperties: false,
|
|
121
|
+
}, { mutates: true }),
|
|
122
|
+
def("fs.append", "Append (or prepend) content. Use after truncation notices with expectedPriorBytes.", {
|
|
123
|
+
type: "object",
|
|
124
|
+
properties: {
|
|
125
|
+
path: { type: "string" },
|
|
126
|
+
content: { type: "string" },
|
|
127
|
+
position: { type: "string", enum: ["start", "end"] },
|
|
128
|
+
expectedPriorBytes: {
|
|
129
|
+
type: "integer",
|
|
130
|
+
description: "From prior write receipt; required after truncation salvage",
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
required: ["path", "content"],
|
|
134
|
+
additionalProperties: false,
|
|
135
|
+
}, { mutates: true }),
|
|
136
|
+
def("fs.delete", "Delete a file or directory.", {
|
|
137
|
+
type: "object",
|
|
138
|
+
properties: {
|
|
139
|
+
path: { type: "string" },
|
|
140
|
+
recursive: { type: "boolean" },
|
|
141
|
+
},
|
|
142
|
+
required: ["path"],
|
|
143
|
+
additionalProperties: false,
|
|
144
|
+
}, { mutates: true }),
|
|
145
|
+
def("shell.exec", "Run a shell command and wait for completion. Use shell.start for long-running servers.", {
|
|
146
|
+
type: "object",
|
|
147
|
+
properties: {
|
|
148
|
+
command: { type: "string" },
|
|
149
|
+
cwd: { type: "string" },
|
|
150
|
+
timeoutMs: { type: "integer" },
|
|
151
|
+
},
|
|
152
|
+
required: ["command"],
|
|
153
|
+
additionalProperties: false,
|
|
154
|
+
}, { mutates: true }),
|
|
155
|
+
def("shell.start", "Start a long-running command in the background; returns a job id.", {
|
|
156
|
+
type: "object",
|
|
157
|
+
properties: {
|
|
158
|
+
command: { type: "string" },
|
|
159
|
+
cwd: { type: "string" },
|
|
160
|
+
name: { type: "string" },
|
|
161
|
+
},
|
|
162
|
+
required: ["command"],
|
|
163
|
+
additionalProperties: false,
|
|
164
|
+
}, { mutates: true }),
|
|
165
|
+
def("shell.jobs", "List background jobs.", emptyObject, { readOnly: true }),
|
|
166
|
+
def("shell.tail", "Read recent output from a background job.", {
|
|
167
|
+
type: "object",
|
|
168
|
+
properties: {
|
|
169
|
+
id: { type: "string" },
|
|
170
|
+
bytes: { type: "integer" },
|
|
171
|
+
},
|
|
172
|
+
required: ["id"],
|
|
173
|
+
additionalProperties: false,
|
|
174
|
+
}, { readOnly: true }),
|
|
175
|
+
def("shell.stop", "Stop a background job.", {
|
|
176
|
+
type: "object",
|
|
177
|
+
properties: { id: { type: "string" } },
|
|
178
|
+
required: ["id"],
|
|
179
|
+
additionalProperties: false,
|
|
180
|
+
}, { mutates: true }),
|
|
181
|
+
def("pkg.install", "Install a package via the OS package manager if the binary is missing.", {
|
|
182
|
+
type: "object",
|
|
183
|
+
properties: {
|
|
184
|
+
tool: { type: "string" },
|
|
185
|
+
checkBinary: { type: "string" },
|
|
186
|
+
},
|
|
187
|
+
required: ["tool"],
|
|
188
|
+
additionalProperties: false,
|
|
189
|
+
}, { mutates: true }),
|
|
190
|
+
def("net.scan", "Port/service scan a target with nmap (confirm required for live scans).", {
|
|
191
|
+
type: "object",
|
|
192
|
+
properties: {
|
|
193
|
+
target: { type: "string" },
|
|
194
|
+
ports: { type: "string" },
|
|
195
|
+
profile: {
|
|
196
|
+
type: "object",
|
|
197
|
+
description: "Structured nmap profile",
|
|
198
|
+
},
|
|
199
|
+
flags: {
|
|
200
|
+
type: "string",
|
|
201
|
+
description: "Legacy flags string",
|
|
202
|
+
},
|
|
203
|
+
},
|
|
204
|
+
required: ["target"],
|
|
205
|
+
additionalProperties: false,
|
|
206
|
+
}, { mutates: true }),
|
|
207
|
+
def("net.context", "Local network context (interfaces, routes summary).", emptyObject, { readOnly: true, askMode: true }),
|
|
208
|
+
def("net.pingSweep", "Discover live hosts on a subnet/CIDR.", {
|
|
209
|
+
type: "object",
|
|
210
|
+
properties: {
|
|
211
|
+
target: { type: "string" },
|
|
212
|
+
method: {
|
|
213
|
+
type: "string",
|
|
214
|
+
enum: ["auto", "nmap", "arp", "native"],
|
|
215
|
+
},
|
|
216
|
+
timeoutMs: { type: "integer" },
|
|
217
|
+
},
|
|
218
|
+
required: ["target"],
|
|
219
|
+
additionalProperties: false,
|
|
220
|
+
}, { readOnly: true }),
|
|
221
|
+
def("http.fetch", "HTTP request (GET/HEAD preferred). Confirm for mutating methods.", {
|
|
222
|
+
type: "object",
|
|
223
|
+
properties: {
|
|
224
|
+
url: { type: "string" },
|
|
225
|
+
method: { type: "string" },
|
|
226
|
+
body: { type: "string" },
|
|
227
|
+
headers: {
|
|
228
|
+
type: "object",
|
|
229
|
+
additionalProperties: { type: "string" },
|
|
230
|
+
},
|
|
231
|
+
maxBytes: { type: "integer" },
|
|
232
|
+
iOwnThis: { type: "boolean" },
|
|
233
|
+
own: { type: "boolean" },
|
|
234
|
+
retries: { type: "integer" },
|
|
235
|
+
},
|
|
236
|
+
required: ["url"],
|
|
237
|
+
additionalProperties: false,
|
|
238
|
+
}, { readOnly: true, askMode: true }),
|
|
239
|
+
def("dns.lookup", "DNS query for a single record type.", {
|
|
240
|
+
type: "object",
|
|
241
|
+
properties: {
|
|
242
|
+
target: { type: "string" },
|
|
243
|
+
record: {
|
|
244
|
+
type: "string",
|
|
245
|
+
description: "A, AAAA, MX, TXT, ...",
|
|
246
|
+
},
|
|
247
|
+
},
|
|
248
|
+
required: ["target"],
|
|
249
|
+
additionalProperties: false,
|
|
250
|
+
}, { readOnly: true, askMode: true }),
|
|
251
|
+
def("whois.lookup", "WHOIS lookup for domain or IP ownership.", {
|
|
252
|
+
type: "object",
|
|
253
|
+
properties: { target: { type: "string" } },
|
|
254
|
+
required: ["target"],
|
|
255
|
+
additionalProperties: false,
|
|
256
|
+
}, { readOnly: true, askMode: true }),
|
|
257
|
+
def("pentest.recon", "Bundled whois/dns/nmap recon. Prefer discrete tools when only one step is needed.", {
|
|
258
|
+
type: "object",
|
|
259
|
+
properties: {
|
|
260
|
+
target: { type: "string" },
|
|
261
|
+
whois: { type: "boolean" },
|
|
262
|
+
dns: { type: "boolean" },
|
|
263
|
+
nmap: { type: "boolean" },
|
|
264
|
+
},
|
|
265
|
+
required: ["target"],
|
|
266
|
+
additionalProperties: false,
|
|
267
|
+
}, { mutates: true }),
|
|
268
|
+
def("web.search", "Search the web for current information. Use for volatile facts and research.", {
|
|
269
|
+
type: "object",
|
|
270
|
+
properties: {
|
|
271
|
+
query: { type: "string" },
|
|
272
|
+
maxResults: { type: "integer" },
|
|
273
|
+
fetchTop: {
|
|
274
|
+
type: "integer",
|
|
275
|
+
description: "Fetch top N pages (0-3)",
|
|
276
|
+
},
|
|
277
|
+
},
|
|
278
|
+
required: ["query"],
|
|
279
|
+
additionalProperties: false,
|
|
280
|
+
}, { readOnly: true, askMode: true }),
|
|
281
|
+
def("web.fetch", "Fetch a URL as readable text or metadata for research.", {
|
|
282
|
+
type: "object",
|
|
283
|
+
properties: {
|
|
284
|
+
url: { type: "string" },
|
|
285
|
+
maxBytes: { type: "integer" },
|
|
286
|
+
includeHeaders: { type: "boolean" },
|
|
287
|
+
includeTls: { type: "boolean" },
|
|
288
|
+
includeTiming: { type: "boolean" },
|
|
289
|
+
includeRedirectChain: { type: "boolean" },
|
|
290
|
+
responseMode: {
|
|
291
|
+
type: "string",
|
|
292
|
+
enum: ["readable", "raw"],
|
|
293
|
+
description: "Body formatting: readable (default) or raw. Headers/TLS are separate booleans.",
|
|
294
|
+
},
|
|
295
|
+
redactSensitive: { type: "boolean" },
|
|
296
|
+
},
|
|
297
|
+
required: ["url"],
|
|
298
|
+
additionalProperties: false,
|
|
299
|
+
}, { readOnly: true, askMode: true }),
|
|
300
|
+
def("sysinfo", "OS/environment facts for this machine.", emptyObject, {
|
|
301
|
+
readOnly: true,
|
|
302
|
+
askMode: true,
|
|
303
|
+
}),
|
|
304
|
+
def("tool.check", 'Check whether binaries/tools are available on PATH (and versions). Pass tools as an array, e.g. {"tools":["nmap","ffuf"]}.', {
|
|
305
|
+
type: "object",
|
|
306
|
+
properties: {
|
|
307
|
+
tools: {
|
|
308
|
+
type: "array",
|
|
309
|
+
items: { type: "string" },
|
|
310
|
+
minItems: 1,
|
|
311
|
+
maxItems: 20,
|
|
312
|
+
description: 'Tool names, e.g. ["nmap","ffuf"]',
|
|
313
|
+
},
|
|
314
|
+
},
|
|
315
|
+
required: ["tools"],
|
|
316
|
+
additionalProperties: false,
|
|
317
|
+
}, { readOnly: true, askMode: true }),
|
|
318
|
+
def("tool.batch", "Run multiple read-only tool calls concurrently (max 20).", {
|
|
319
|
+
type: "object",
|
|
320
|
+
properties: {
|
|
321
|
+
calls: {
|
|
322
|
+
type: "array",
|
|
323
|
+
items: {
|
|
324
|
+
type: "object",
|
|
325
|
+
properties: {
|
|
326
|
+
name: { type: "string" },
|
|
327
|
+
args: { type: "object" },
|
|
328
|
+
},
|
|
329
|
+
required: ["name", "args"],
|
|
330
|
+
},
|
|
331
|
+
},
|
|
332
|
+
},
|
|
333
|
+
required: ["calls"],
|
|
334
|
+
additionalProperties: false,
|
|
335
|
+
}, { readOnly: true, askMode: true }),
|
|
336
|
+
def("wordlist.find", "Locate wordlists on disk for fuzzing/directory scans.", {
|
|
337
|
+
type: "object",
|
|
338
|
+
properties: {
|
|
339
|
+
query: { type: "string" },
|
|
340
|
+
expand: { type: "boolean" },
|
|
341
|
+
},
|
|
342
|
+
required: ["query"],
|
|
343
|
+
additionalProperties: false,
|
|
344
|
+
}, { readOnly: true }),
|
|
345
|
+
def("image.ocr", "OCR text from an image file (fallback when vision is unavailable).", {
|
|
346
|
+
type: "object",
|
|
347
|
+
properties: {
|
|
348
|
+
path: { type: "string" },
|
|
349
|
+
lang: { type: "string" },
|
|
350
|
+
maxBytes: { type: "integer" },
|
|
351
|
+
},
|
|
352
|
+
required: ["path"],
|
|
353
|
+
additionalProperties: false,
|
|
354
|
+
}, { readOnly: true, askMode: true }),
|
|
355
|
+
def("pdf.read", "Extract text from a PDF (OCR fallback for scanned pages).", {
|
|
356
|
+
type: "object",
|
|
357
|
+
properties: {
|
|
358
|
+
path: { type: "string" },
|
|
359
|
+
maxPages: { type: "integer" },
|
|
360
|
+
maxBytes: { type: "integer" },
|
|
361
|
+
},
|
|
362
|
+
required: ["path"],
|
|
363
|
+
additionalProperties: false,
|
|
364
|
+
}, { readOnly: true, askMode: true }),
|
|
365
|
+
def("plan.create", "Create or revise a durable multi-step session plan with task checklist.", {
|
|
366
|
+
type: "object",
|
|
367
|
+
properties: {
|
|
368
|
+
goal: { type: "string" },
|
|
369
|
+
detail: { type: "string" },
|
|
370
|
+
tasks: {
|
|
371
|
+
type: "array",
|
|
372
|
+
items: {
|
|
373
|
+
oneOf: [
|
|
374
|
+
{ type: "string" },
|
|
375
|
+
{
|
|
376
|
+
type: "object",
|
|
377
|
+
properties: {
|
|
378
|
+
title: { type: "string" },
|
|
379
|
+
task: { type: "string" },
|
|
380
|
+
name: { type: "string" },
|
|
381
|
+
},
|
|
382
|
+
},
|
|
383
|
+
],
|
|
384
|
+
},
|
|
385
|
+
},
|
|
386
|
+
kind: { type: "string" },
|
|
387
|
+
},
|
|
388
|
+
required: ["goal", "tasks"],
|
|
389
|
+
additionalProperties: true,
|
|
390
|
+
}, { mutates: true }),
|
|
391
|
+
def("task.update", "Update a plan task state. taskId MUST be t1, t2, … from the ACTIVE PLAN context (not a free-form title slug).", {
|
|
392
|
+
type: "object",
|
|
393
|
+
properties: {
|
|
394
|
+
taskId: {
|
|
395
|
+
type: "string",
|
|
396
|
+
description: "Canonical id from plan context: t1, t2, t3, … (aliases accepted if listed)",
|
|
397
|
+
},
|
|
398
|
+
state: {
|
|
399
|
+
type: "string",
|
|
400
|
+
enum: ["pending", "in_progress", "done", "failed", "skipped"],
|
|
401
|
+
},
|
|
402
|
+
note: { type: "string" },
|
|
403
|
+
},
|
|
404
|
+
required: ["taskId", "state"],
|
|
405
|
+
additionalProperties: true,
|
|
406
|
+
}, { mutates: true }),
|
|
407
|
+
def("agent.handoff", "Hand a task that needs agent mode (writes, shell, installs) back to the user. Ask mode cannot execute mutations — use this instead of inventing write tools.", {
|
|
408
|
+
type: "object",
|
|
409
|
+
properties: {
|
|
410
|
+
task: {
|
|
411
|
+
type: "string",
|
|
412
|
+
description: "Exact task restatement for agent mode",
|
|
413
|
+
},
|
|
414
|
+
reason: {
|
|
415
|
+
type: "string",
|
|
416
|
+
description: "Short reason agent mode is required",
|
|
417
|
+
},
|
|
418
|
+
},
|
|
419
|
+
required: ["task", "reason"],
|
|
420
|
+
additionalProperties: false,
|
|
421
|
+
}),
|
|
422
|
+
];
|
|
423
|
+
const byName = new Map(TOOL_DEFINITIONS.map((d) => [d.name, d]));
|
|
424
|
+
const byWire = new Map();
|
|
425
|
+
for (const d of TOOL_DEFINITIONS) {
|
|
426
|
+
byWire.set(d.wireName, d);
|
|
427
|
+
const snake = toSnakeWireName(d.name);
|
|
428
|
+
if (snake !== d.wireName)
|
|
429
|
+
byWire.set(snake, d);
|
|
430
|
+
}
|
|
431
|
+
export function getToolDefinition(name) {
|
|
432
|
+
return byName.get(name) ?? byWire.get(name);
|
|
433
|
+
}
|
|
434
|
+
export function getToolDefinitions(filter) {
|
|
435
|
+
let defs = TOOL_DEFINITIONS;
|
|
436
|
+
if (filter?.askMode) {
|
|
437
|
+
defs = defs.filter((d) => d.askMode);
|
|
438
|
+
}
|
|
439
|
+
if (filter?.names) {
|
|
440
|
+
const allow = new Set(filter.names);
|
|
441
|
+
defs = defs.filter((d) => allow.has(d.name));
|
|
442
|
+
}
|
|
443
|
+
if (filter?.compact) {
|
|
444
|
+
// Core set for low-TPM models + recon/network essentials (no net.scan
|
|
445
|
+
// mutator — that still needs the full set / confirm UX).
|
|
446
|
+
const core = new Set([
|
|
447
|
+
"fs.read",
|
|
448
|
+
"fs.write",
|
|
449
|
+
"fs.writeMany",
|
|
450
|
+
"fs.list",
|
|
451
|
+
"fs.search",
|
|
452
|
+
"fs.edit",
|
|
453
|
+
"fs.append",
|
|
454
|
+
"fs.delete",
|
|
455
|
+
"shell.exec",
|
|
456
|
+
"shell.start",
|
|
457
|
+
"shell.jobs",
|
|
458
|
+
"shell.tail",
|
|
459
|
+
"shell.stop",
|
|
460
|
+
"web.search",
|
|
461
|
+
"web.fetch",
|
|
462
|
+
"http.fetch",
|
|
463
|
+
"dns.lookup",
|
|
464
|
+
"whois.lookup",
|
|
465
|
+
"net.context",
|
|
466
|
+
"pentest.recon",
|
|
467
|
+
"wordlist.find",
|
|
468
|
+
"sysinfo",
|
|
469
|
+
"tool.check",
|
|
470
|
+
"plan.create",
|
|
471
|
+
"task.update",
|
|
472
|
+
]);
|
|
473
|
+
defs = defs.filter((d) => core.has(d.name));
|
|
474
|
+
}
|
|
475
|
+
return defs.map((d) => ({ ...d }));
|
|
476
|
+
}
|
|
477
|
+
export function getCompactToolDefinitions() {
|
|
478
|
+
return getToolDefinitions({ compact: true });
|
|
479
|
+
}
|
|
480
|
+
export function wireNameFor(canonical) {
|
|
481
|
+
return byName.get(canonical)?.wireName ?? toWireName(canonical);
|
|
482
|
+
}
|
|
483
|
+
export function canonicalNameFor(wire) {
|
|
484
|
+
return byWire.get(wire)?.name;
|
|
485
|
+
}
|
|
486
|
+
/**
|
|
487
|
+
* Every registry key must have a definition; every definition must have a
|
|
488
|
+
* handler unless it is a plan meta-tool.
|
|
489
|
+
*/
|
|
490
|
+
export function assertDefinitionRegistryConsistency(registryKeys) {
|
|
491
|
+
const reg = new Set(registryKeys);
|
|
492
|
+
const defNames = new Set(TOOL_DEFINITIONS.map((d) => d.name));
|
|
493
|
+
const wires = new Set();
|
|
494
|
+
for (const d of TOOL_DEFINITIONS) {
|
|
495
|
+
if (wires.has(d.wireName)) {
|
|
496
|
+
throw new Error(`Duplicate wire name: ${d.wireName}`);
|
|
497
|
+
}
|
|
498
|
+
wires.add(d.wireName);
|
|
499
|
+
if (!NON_REGISTRY_TOOL_NAMES.has(d.name) && !reg.has(d.name)) {
|
|
500
|
+
throw new Error(`Definition "${d.name}" has no toolRegistry handler (and is not a meta tool)`);
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
for (const key of registryKeys) {
|
|
504
|
+
if (!defNames.has(key)) {
|
|
505
|
+
throw new Error(`toolRegistry key "${key}" has no ToolDefinition`);
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
//# sourceMappingURL=definitions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/tools/definitions.ts"],"names":[],"mappings":"AACA,OAAO,EACL,oBAAoB,EACpB,eAAe,EACf,UAAU,GACX,MAAM,yBAAyB,CAAC;AAEjC,SAAS,GAAG,CACV,IAAY,EACZ,WAAmB,EACnB,UAAwC,EACxC,QAA2E,EAAE;IAE7E,0EAA0E;IAC1E,MAAM,QAAQ,GAAG,oBAAoB,CAAC,IAAI,CAAC,CAAC;IAC5C,OAAO;QACL,IAAI;QACJ,QAAQ;QACR,WAAW;QACX,UAAU;QACV,GAAG,KAAK;KACT,CAAC;AACJ,CAAC;A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CAAC;YAC7D,MAAM,IAAI,KAAK,CACb,eAAe,CAAC,CAAC,IAAI,wDAAwD,CAC9E,CAAC;QACJ,CAAC;IACH,CAAC;IACD,KAAK,MAAM,GAAG,IAAI,YAAY,EAAE,CAAC;QAC/B,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;YACvB,MAAM,IAAI,KAAK,CAAC,qBAAqB,GAAG,yBAAyB,CAAC,CAAC;QACrE,CAAC;IACH,CAAC;AACH,CAAC"}
|
package/dist/tools/fs.js
CHANGED
|
@@ -6,6 +6,7 @@ import { execa } from "execa";
|
|
|
6
6
|
import { getConfig } from "../store/config.js";
|
|
7
7
|
import { isSecretPath } from "../safety/patterns.js";
|
|
8
8
|
import { safeCwd } from "../os/cwd.js";
|
|
9
|
+
import { remapAgentCwdWrite, resolveToolPath, } from "../agent/project-root.js";
|
|
9
10
|
/** Compact integrity footer so the model trusts a write without re-reading. */
|
|
10
11
|
function describeWrite(path, content, verb) {
|
|
11
12
|
const bytes = Buffer.byteLength(content, "utf8");
|
|
@@ -41,9 +42,10 @@ function expandHome(path) {
|
|
|
41
42
|
}
|
|
42
43
|
return path;
|
|
43
44
|
}
|
|
44
|
-
/** Resolve path with tilde expansion. */
|
|
45
|
+
/** Resolve path with tilde expansion + sticky plan project root for relatives. */
|
|
45
46
|
function resolvePath(path) {
|
|
46
|
-
|
|
47
|
+
const resolved = resolveToolPath(path);
|
|
48
|
+
return remapAgentCwdWrite(resolved, path);
|
|
47
49
|
}
|
|
48
50
|
function ensureNotSecret(resolved) {
|
|
49
51
|
if (isSecretPath(resolved)) {
|
|
@@ -208,7 +210,14 @@ export async function fsReplaceLines(path, startLine, endLine, content, options
|
|
|
208
210
|
await unlink(temp).catch(() => undefined);
|
|
209
211
|
throw error;
|
|
210
212
|
}
|
|
211
|
-
|
|
213
|
+
// X10: receipt with line count + hash so the model notices size changes.
|
|
214
|
+
const verb = content === ""
|
|
215
|
+
? `Deleted lines ${startLine}-${endLine} in`
|
|
216
|
+
: `Replaced lines ${startLine}-${endLine} in`;
|
|
217
|
+
return {
|
|
218
|
+
ok: true,
|
|
219
|
+
output: describeWrite(resolved, next, verb),
|
|
220
|
+
};
|
|
212
221
|
}
|
|
213
222
|
const WRITE_MANY_MAX_FILES = 50;
|
|
214
223
|
/**
|