@amaranthic/hernex 0.0.0-stage → 0.2.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/LICENSE +21 -0
- package/README.md +66 -2
- package/dist/ai.d.ts +11 -0
- package/dist/ai.d.ts.map +1 -0
- package/dist/ai.js +11 -0
- package/dist/ai.js.map +1 -0
- package/dist/checkpoints/FileCheckpointStore.d.ts +95 -0
- package/dist/checkpoints/FileCheckpointStore.d.ts.map +1 -0
- package/dist/checkpoints/FileCheckpointStore.js +412 -0
- package/dist/checkpoints/FileCheckpointStore.js.map +1 -0
- package/dist/checkpoints/index.d.ts +7 -0
- package/dist/checkpoints/index.d.ts.map +1 -0
- package/dist/checkpoints/index.js +7 -0
- package/dist/checkpoints/index.js.map +1 -0
- package/dist/checkpoints/types.d.ts +157 -0
- package/dist/checkpoints/types.d.ts.map +1 -0
- package/dist/checkpoints/types.js +6 -0
- package/dist/checkpoints/types.js.map +1 -0
- package/dist/engine/AgentEngine.d.ts +156 -0
- package/dist/engine/AgentEngine.d.ts.map +1 -0
- package/dist/engine/AgentEngine.js +288 -0
- package/dist/engine/AgentEngine.js.map +1 -0
- package/dist/engine/engineConfig.d.ts +138 -0
- package/dist/engine/engineConfig.d.ts.map +1 -0
- package/dist/engine/engineConfig.js +6 -0
- package/dist/engine/engineConfig.js.map +1 -0
- package/dist/engine/eventQueue.d.ts +42 -0
- package/dist/engine/eventQueue.d.ts.map +1 -0
- package/dist/engine/eventQueue.js +93 -0
- package/dist/engine/eventQueue.js.map +1 -0
- package/dist/engine/index.d.ts +7 -0
- package/dist/engine/index.d.ts.map +1 -0
- package/dist/engine/index.js +6 -0
- package/dist/engine/index.js.map +1 -0
- package/dist/engine/runTurn.d.ts +17 -0
- package/dist/engine/runTurn.d.ts.map +1 -0
- package/dist/engine/runTurn.js +684 -0
- package/dist/engine/runTurn.js.map +1 -0
- package/dist/errors.d.ts +142 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +174 -0
- package/dist/errors.js.map +1 -0
- package/dist/events/checkpointEvents.d.ts +20 -0
- package/dist/events/checkpointEvents.d.ts.map +1 -0
- package/dist/events/checkpointEvents.js +6 -0
- package/dist/events/checkpointEvents.js.map +1 -0
- package/dist/events/errorEvents.d.ts +23 -0
- package/dist/events/errorEvents.d.ts.map +1 -0
- package/dist/events/errorEvents.js +6 -0
- package/dist/events/errorEvents.js.map +1 -0
- package/dist/events/index.d.ts +11 -0
- package/dist/events/index.d.ts.map +1 -0
- package/dist/events/index.js +6 -0
- package/dist/events/index.js.map +1 -0
- package/dist/events/stepEvents.d.ts +68 -0
- package/dist/events/stepEvents.d.ts.map +1 -0
- package/dist/events/stepEvents.js +6 -0
- package/dist/events/stepEvents.js.map +1 -0
- package/dist/events/streamEvents.d.ts +41 -0
- package/dist/events/streamEvents.d.ts.map +1 -0
- package/dist/events/streamEvents.js +6 -0
- package/dist/events/streamEvents.js.map +1 -0
- package/dist/events/toolEvents.d.ts +62 -0
- package/dist/events/toolEvents.d.ts.map +1 -0
- package/dist/events/toolEvents.js +6 -0
- package/dist/events/toolEvents.js.map +1 -0
- package/dist/events/types.d.ts +37 -0
- package/dist/events/types.d.ts.map +1 -0
- package/dist/events/types.js +6 -0
- package/dist/events/types.js.map +1 -0
- package/dist/hooks/composeAgentHooks.d.ts +14 -0
- package/dist/hooks/composeAgentHooks.d.ts.map +1 -0
- package/dist/hooks/composeAgentHooks.js +142 -0
- package/dist/hooks/composeAgentHooks.js.map +1 -0
- package/dist/hooks/index.d.ts +7 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +6 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/hooks/types.d.ts +133 -0
- package/dist/hooks/types.d.ts.map +1 -0
- package/dist/hooks/types.js +6 -0
- package/dist/hooks/types.js.map +1 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +25 -0
- package/dist/index.js.map +1 -0
- package/dist/model/ProviderRegistry.d.ts +62 -0
- package/dist/model/ProviderRegistry.d.ts.map +1 -0
- package/dist/model/ProviderRegistry.js +114 -0
- package/dist/model/ProviderRegistry.js.map +1 -0
- package/dist/model/providers/alibaba.d.ts +11 -0
- package/dist/model/providers/alibaba.d.ts.map +1 -0
- package/dist/model/providers/alibaba.js +16 -0
- package/dist/model/providers/alibaba.js.map +1 -0
- package/dist/model/providers/anthropic.d.ts +11 -0
- package/dist/model/providers/anthropic.d.ts.map +1 -0
- package/dist/model/providers/anthropic.js +16 -0
- package/dist/model/providers/anthropic.js.map +1 -0
- package/dist/model/providers/cohere.d.ts +11 -0
- package/dist/model/providers/cohere.d.ts.map +1 -0
- package/dist/model/providers/cohere.js +16 -0
- package/dist/model/providers/cohere.js.map +1 -0
- package/dist/model/providers/compatible.d.ts +11 -0
- package/dist/model/providers/compatible.d.ts.map +1 -0
- package/dist/model/providers/compatible.js +17 -0
- package/dist/model/providers/compatible.js.map +1 -0
- package/dist/model/providers/deepseek.d.ts +11 -0
- package/dist/model/providers/deepseek.d.ts.map +1 -0
- package/dist/model/providers/deepseek.js +16 -0
- package/dist/model/providers/deepseek.js.map +1 -0
- package/dist/model/providers/google.d.ts +11 -0
- package/dist/model/providers/google.d.ts.map +1 -0
- package/dist/model/providers/google.js +16 -0
- package/dist/model/providers/google.js.map +1 -0
- package/dist/model/providers/groq.d.ts +11 -0
- package/dist/model/providers/groq.d.ts.map +1 -0
- package/dist/model/providers/groq.js +16 -0
- package/dist/model/providers/groq.js.map +1 -0
- package/dist/model/providers/mistral.d.ts +11 -0
- package/dist/model/providers/mistral.d.ts.map +1 -0
- package/dist/model/providers/mistral.js +16 -0
- package/dist/model/providers/mistral.js.map +1 -0
- package/dist/model/providers/openai.d.ts +11 -0
- package/dist/model/providers/openai.d.ts.map +1 -0
- package/dist/model/providers/openai.js +16 -0
- package/dist/model/providers/openai.js.map +1 -0
- package/dist/model/providers/openrouter.d.ts +14 -0
- package/dist/model/providers/openrouter.d.ts.map +1 -0
- package/dist/model/providers/openrouter.js +20 -0
- package/dist/model/providers/openrouter.js.map +1 -0
- package/dist/model/providers/togetherai.d.ts +11 -0
- package/dist/model/providers/togetherai.d.ts.map +1 -0
- package/dist/model/providers/togetherai.js +16 -0
- package/dist/model/providers/togetherai.js.map +1 -0
- package/dist/model/providers/vercelGateway.d.ts +14 -0
- package/dist/model/providers/vercelGateway.d.ts.map +1 -0
- package/dist/model/providers/vercelGateway.js +19 -0
- package/dist/model/providers/vercelGateway.js.map +1 -0
- package/dist/model/providers/xai.d.ts +11 -0
- package/dist/model/providers/xai.d.ts.map +1 -0
- package/dist/model/providers/xai.js +16 -0
- package/dist/model/providers/xai.js.map +1 -0
- package/dist/model/resolveModel.d.ts +45 -0
- package/dist/model/resolveModel.d.ts.map +1 -0
- package/dist/model/resolveModel.js +109 -0
- package/dist/model/resolveModel.js.map +1 -0
- package/dist/model/types.d.ts +98 -0
- package/dist/model/types.d.ts.map +1 -0
- package/dist/model/types.js +6 -0
- package/dist/model/types.js.map +1 -0
- package/dist/runtime.d.ts +74 -0
- package/dist/runtime.d.ts.map +1 -0
- package/dist/runtime.js +41 -0
- package/dist/runtime.js.map +1 -0
- package/dist/storage/atomicFile.d.ts +28 -0
- package/dist/storage/atomicFile.d.ts.map +1 -0
- package/dist/storage/atomicFile.js +56 -0
- package/dist/storage/atomicFile.js.map +1 -0
- package/dist/storage/homeDirectory.d.ts +21 -0
- package/dist/storage/homeDirectory.d.ts.map +1 -0
- package/dist/storage/homeDirectory.js +36 -0
- package/dist/storage/homeDirectory.js.map +1 -0
- package/dist/storage/index.d.ts +10 -0
- package/dist/storage/index.d.ts.map +1 -0
- package/dist/storage/index.js +10 -0
- package/dist/storage/index.js.map +1 -0
- package/dist/storage/jsonl.d.ts +46 -0
- package/dist/storage/jsonl.d.ts.map +1 -0
- package/dist/storage/jsonl.js +121 -0
- package/dist/storage/jsonl.js.map +1 -0
- package/dist/storage/lock.d.ts +47 -0
- package/dist/storage/lock.d.ts.map +1 -0
- package/dist/storage/lock.js +126 -0
- package/dist/storage/lock.js.map +1 -0
- package/dist/storage/valueCodec.d.ts +68 -0
- package/dist/storage/valueCodec.d.ts.map +1 -0
- package/dist/storage/valueCodec.js +140 -0
- package/dist/storage/valueCodec.js.map +1 -0
- package/dist/tasks/TaskManager.d.ts +155 -0
- package/dist/tasks/TaskManager.d.ts.map +1 -0
- package/dist/tasks/TaskManager.js +774 -0
- package/dist/tasks/TaskManager.js.map +1 -0
- package/dist/tasks/index.d.ts +7 -0
- package/dist/tasks/index.d.ts.map +1 -0
- package/dist/tasks/index.js +6 -0
- package/dist/tasks/index.js.map +1 -0
- package/dist/tasks/types.d.ts +160 -0
- package/dist/tasks/types.d.ts.map +1 -0
- package/dist/tasks/types.js +8 -0
- package/dist/tasks/types.js.map +1 -0
- package/dist/threads/FileThreadStore.d.ts +118 -0
- package/dist/threads/FileThreadStore.d.ts.map +1 -0
- package/dist/threads/FileThreadStore.js +320 -0
- package/dist/threads/FileThreadStore.js.map +1 -0
- package/dist/threads/index.d.ts +7 -0
- package/dist/threads/index.d.ts.map +1 -0
- package/dist/threads/index.js +7 -0
- package/dist/threads/index.js.map +1 -0
- package/dist/threads/types.d.ts +230 -0
- package/dist/threads/types.d.ts.map +1 -0
- package/dist/threads/types.js +6 -0
- package/dist/threads/types.js.map +1 -0
- package/dist/tools/AgentTool.d.ts +38 -0
- package/dist/tools/AgentTool.d.ts.map +1 -0
- package/dist/tools/AgentTool.js +6 -0
- package/dist/tools/AgentTool.js.map +1 -0
- package/dist/tools/BashTool.d.ts +61 -0
- package/dist/tools/BashTool.d.ts.map +1 -0
- package/dist/tools/BashTool.js +142 -0
- package/dist/tools/BashTool.js.map +1 -0
- package/dist/tools/EditFileTool.d.ts +49 -0
- package/dist/tools/EditFileTool.d.ts.map +1 -0
- package/dist/tools/EditFileTool.js +114 -0
- package/dist/tools/EditFileTool.js.map +1 -0
- package/dist/tools/GlobTool.d.ts +48 -0
- package/dist/tools/GlobTool.d.ts.map +1 -0
- package/dist/tools/GlobTool.js +117 -0
- package/dist/tools/GlobTool.js.map +1 -0
- package/dist/tools/GrepTool.d.ts +73 -0
- package/dist/tools/GrepTool.d.ts.map +1 -0
- package/dist/tools/GrepTool.js +250 -0
- package/dist/tools/GrepTool.js.map +1 -0
- package/dist/tools/ReadFileTool.d.ts +51 -0
- package/dist/tools/ReadFileTool.d.ts.map +1 -0
- package/dist/tools/ReadFileTool.js +153 -0
- package/dist/tools/ReadFileTool.js.map +1 -0
- package/dist/tools/TaskManagerTool.d.ts +102 -0
- package/dist/tools/TaskManagerTool.d.ts.map +1 -0
- package/dist/tools/TaskManagerTool.js +130 -0
- package/dist/tools/TaskManagerTool.js.map +1 -0
- package/dist/tools/ToolExecutionContext.d.ts +61 -0
- package/dist/tools/ToolExecutionContext.d.ts.map +1 -0
- package/dist/tools/ToolExecutionContext.js +8 -0
- package/dist/tools/ToolExecutionContext.js.map +1 -0
- package/dist/tools/ToolRegistry.d.ts +82 -0
- package/dist/tools/ToolRegistry.d.ts.map +1 -0
- package/dist/tools/ToolRegistry.js +116 -0
- package/dist/tools/ToolRegistry.js.map +1 -0
- package/dist/tools/WriteFileTool.d.ts +46 -0
- package/dist/tools/WriteFileTool.d.ts.map +1 -0
- package/dist/tools/WriteFileTool.js +87 -0
- package/dist/tools/WriteFileTool.js.map +1 -0
- package/dist/tools/index.d.ts +17 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +17 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/internal/bashEnvironment.d.ts +20 -0
- package/dist/tools/internal/bashEnvironment.d.ts.map +1 -0
- package/dist/tools/internal/bashEnvironment.js +65 -0
- package/dist/tools/internal/bashEnvironment.js.map +1 -0
- package/dist/tools/internal/pathGuard.d.ts +27 -0
- package/dist/tools/internal/pathGuard.d.ts.map +1 -0
- package/dist/tools/internal/pathGuard.js +99 -0
- package/dist/tools/internal/pathGuard.js.map +1 -0
- package/dist/tools/prompts.d.ts +33 -0
- package/dist/tools/prompts.d.ts.map +1 -0
- package/dist/tools/prompts.js +48 -0
- package/dist/tools/prompts.js.map +1 -0
- package/package.json +64 -4
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Built-in tool for managing background shell tasks spawned by BashTool.
|
|
3
|
+
* Restricts model actions to inspecting and managing active/recent tasks:
|
|
4
|
+
* listing tasks, line-paged log inspection, interactive stdin delivery,
|
|
5
|
+
* process termination, and deleting completed task logs.
|
|
6
|
+
* @packageDocumentation
|
|
7
|
+
*/
|
|
8
|
+
import { z } from "zod";
|
|
9
|
+
import { taskManagerDescription } from "./prompts.js";
|
|
10
|
+
/**
|
|
11
|
+
* Zod schema for TaskManagerTool inputs using a discriminated union on the "action" field.
|
|
12
|
+
* Restricts model actions to inspecting and managing existing tasks (list, read, sendInput, stop, delete).
|
|
13
|
+
* Task creation is performed exclusively by the model via BashTool.
|
|
14
|
+
*/
|
|
15
|
+
export const taskManagerInputSchema = z.discriminatedUnion("action", [
|
|
16
|
+
z.object({
|
|
17
|
+
action: z
|
|
18
|
+
.literal("list")
|
|
19
|
+
.describe("List all active and recently completed background tasks."),
|
|
20
|
+
}),
|
|
21
|
+
z.object({
|
|
22
|
+
action: z
|
|
23
|
+
.literal("read")
|
|
24
|
+
.describe("Read a line-paged slice of output logs from a task."),
|
|
25
|
+
taskId: z.string().describe("The unique task identifier to inspect."),
|
|
26
|
+
offset: z
|
|
27
|
+
.number()
|
|
28
|
+
.int()
|
|
29
|
+
.min(1)
|
|
30
|
+
.describe("1-based line number to begin reading from (required)."),
|
|
31
|
+
limit: z
|
|
32
|
+
.number()
|
|
33
|
+
.int()
|
|
34
|
+
.min(1)
|
|
35
|
+
.max(500)
|
|
36
|
+
.describe("Maximum number of lines to return, up to 500 (required)."),
|
|
37
|
+
}),
|
|
38
|
+
z.object({
|
|
39
|
+
action: z
|
|
40
|
+
.literal("sendInput")
|
|
41
|
+
.describe("Deliver text into standard input of a running background task."),
|
|
42
|
+
taskId: z.string().describe("The unique task identifier of the target process."),
|
|
43
|
+
input: z.string().describe("Text payload to write into stdin."),
|
|
44
|
+
newline: z
|
|
45
|
+
.boolean()
|
|
46
|
+
.optional()
|
|
47
|
+
.describe("Whether to append a trailing newline (defaults to true)."),
|
|
48
|
+
}),
|
|
49
|
+
z.object({
|
|
50
|
+
action: z
|
|
51
|
+
.literal("stop")
|
|
52
|
+
.describe("Terminate a background task process and its process tree."),
|
|
53
|
+
taskId: z.string().describe("The unique task identifier to terminate."),
|
|
54
|
+
signal: z
|
|
55
|
+
.enum(["SIGTERM", "SIGKILL"])
|
|
56
|
+
.optional()
|
|
57
|
+
.describe("Termination signal to dispatch (defaults to SIGTERM)."),
|
|
58
|
+
}),
|
|
59
|
+
z.object({
|
|
60
|
+
action: z
|
|
61
|
+
.literal("delete")
|
|
62
|
+
.describe("Delete a completed or terminated task record and its logs."),
|
|
63
|
+
taskId: z.string().describe("The unique task identifier to delete."),
|
|
64
|
+
}),
|
|
65
|
+
]);
|
|
66
|
+
/**
|
|
67
|
+
* Built-in tool for managing background shell tasks.
|
|
68
|
+
*/
|
|
69
|
+
export class TaskManagerTool {
|
|
70
|
+
static toolName = "taskManager";
|
|
71
|
+
name = TaskManagerTool.toolName;
|
|
72
|
+
description = taskManagerDescription;
|
|
73
|
+
inputSchema = taskManagerInputSchema;
|
|
74
|
+
/**
|
|
75
|
+
* Executes task management actions against background processes.
|
|
76
|
+
*
|
|
77
|
+
* @param parameters - Discriminated union of task management parameters (list, read, sendInput, stop, delete).
|
|
78
|
+
* @param context - The execution context containing taskManager.
|
|
79
|
+
* @returns The action-specific execution output.
|
|
80
|
+
* @throws Error if taskManager is not configured in the session.
|
|
81
|
+
*/
|
|
82
|
+
async execute(parameters, context) {
|
|
83
|
+
const taskManager = context.taskManager;
|
|
84
|
+
if (!taskManager) {
|
|
85
|
+
throw new Error("TaskManager is not active in this session. Background task management requires TaskManager to be configured.");
|
|
86
|
+
}
|
|
87
|
+
switch (parameters.action) {
|
|
88
|
+
case "list": {
|
|
89
|
+
const tasks = taskManager.listTasks();
|
|
90
|
+
return {
|
|
91
|
+
action: "list",
|
|
92
|
+
tasks,
|
|
93
|
+
count: tasks.length,
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
case "read": {
|
|
97
|
+
const result = await taskManager.readTask(parameters.taskId, parameters.offset, parameters.limit);
|
|
98
|
+
return {
|
|
99
|
+
action: "read",
|
|
100
|
+
...result,
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
case "sendInput": {
|
|
104
|
+
const result = await taskManager.sendTaskInput(parameters.taskId, parameters.input, { newline: parameters.newline });
|
|
105
|
+
return {
|
|
106
|
+
action: "sendInput",
|
|
107
|
+
...result,
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
case "stop": {
|
|
111
|
+
const result = await taskManager.stopTask(parameters.taskId, {
|
|
112
|
+
signal: parameters.signal,
|
|
113
|
+
});
|
|
114
|
+
return {
|
|
115
|
+
action: "stop",
|
|
116
|
+
...result,
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
case "delete": {
|
|
120
|
+
const deleted = await taskManager.deleteTask(parameters.taskId);
|
|
121
|
+
return {
|
|
122
|
+
action: "delete",
|
|
123
|
+
taskId: parameters.taskId,
|
|
124
|
+
deleted,
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
//# sourceMappingURL=TaskManagerTool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TaskManagerTool.js","sources":["../../src/tools/TaskManagerTool.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAQtD;;;;GAIG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CA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AC;gBACjB,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,aAAa,CAC5C,UAAU,CAAC,MAAM,EACjB,UAAU,CAAC,KAAK,EAChB,EAAE,OAAO,EAAE,UAAU,CAAC,OAAO,EAAE,CAChC,CAAC;gBACF,OAAO;oBACL,MAAM,EAAE,WAAW;oBACnB,GAAG,MAAM;iBACV,CAAC;YACJ,CAAC;YAED,KAAK,MAAM,EAAE,CAAC;gBACZ,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,QAAQ,CAAC,UAAU,CAAC,MAAM,EAAE;oBAC3D,MAAM,EAAE,UAAU,CAAC,MAAM;iBAC1B,CAAC,CAAC;gBACH,OAAO;oBACL,MAAM,EAAE,MAAM;oBACd,GAAG,MAAM;iBACV,CAAC;YACJ,CAAC;YAED,KAAK,QAAQ,EAAE,CAAC;gBACd,MAAM,OAAO,GAAG,MAAM,WAAW,CAAC,UAAU,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;gBAChE,OAAO;oBACL,MAAM,EAAE,QAAQ;oBAChB,MAAM,EAAE,UAAU,CAAC,MAAM;oBACzB,OAAO;iBACR,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file ToolExecutionContext.ts
|
|
3
|
+
* @description Context provided to every tool during execution.
|
|
4
|
+
* Encapsulates thread identity, execution call ID, workspace directory,
|
|
5
|
+
* cancellation signal, and progress streaming callbacks.
|
|
6
|
+
*/
|
|
7
|
+
import type { CheckpointStore } from "../checkpoints/index.js";
|
|
8
|
+
import type { TaskManager } from "../tasks/TaskManager.js";
|
|
9
|
+
/**
|
|
10
|
+
* Execution context supplied to every tool execution.
|
|
11
|
+
*/
|
|
12
|
+
export interface ToolExecutionContext {
|
|
13
|
+
/**
|
|
14
|
+
* The unique identifier of the active thread session.
|
|
15
|
+
*/
|
|
16
|
+
readonly threadId: string;
|
|
17
|
+
/**
|
|
18
|
+
* The unique identifier of this specific tool invocation generated by the model.
|
|
19
|
+
*/
|
|
20
|
+
readonly toolCallId: string;
|
|
21
|
+
/**
|
|
22
|
+
* The absolute workspace root directory for resolving file paths and shell commands.
|
|
23
|
+
*/
|
|
24
|
+
readonly workingDirectory: string;
|
|
25
|
+
/**
|
|
26
|
+
* Optional zero-based turn index of the current agent turn.
|
|
27
|
+
*/
|
|
28
|
+
readonly turnIndex?: number | undefined;
|
|
29
|
+
/**
|
|
30
|
+
* Optional abort signal for immediate cancellation of in-flight operations.
|
|
31
|
+
*/
|
|
32
|
+
readonly abortSignal?: AbortSignal | undefined;
|
|
33
|
+
/**
|
|
34
|
+
* Optional CheckpointStore instance for capturing file delta snapshots.
|
|
35
|
+
*/
|
|
36
|
+
readonly checkpointStore?: CheckpointStore | undefined;
|
|
37
|
+
/**
|
|
38
|
+
* Whether checkpointing is actively enabled for this thread session.
|
|
39
|
+
*/
|
|
40
|
+
readonly isCheckpointEnabled?: boolean | undefined;
|
|
41
|
+
/**
|
|
42
|
+
* Optional TaskManager instance for background shell process registration and management.
|
|
43
|
+
*/
|
|
44
|
+
readonly taskManager?: TaskManager | undefined;
|
|
45
|
+
/**
|
|
46
|
+
* Optional callback invoked by tools when a checkpoint snapshot is created.
|
|
47
|
+
*/
|
|
48
|
+
readonly onCheckpointCreated?: ((event: {
|
|
49
|
+
readonly checkpointId: string;
|
|
50
|
+
readonly sequence: number;
|
|
51
|
+
readonly label: string;
|
|
52
|
+
readonly filesTouched: readonly string[];
|
|
53
|
+
}) => void) | undefined;
|
|
54
|
+
/**
|
|
55
|
+
* Optional callback to emit streaming progress chunks (e.g. progressive shell output).
|
|
56
|
+
*
|
|
57
|
+
* @param chunk - The incremental text chunk emitted by the tool.
|
|
58
|
+
*/
|
|
59
|
+
readonly emitProgress?: ((chunk: string) => void) | undefined;
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=ToolExecutionContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{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0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file ToolExecutionContext.ts
|
|
3
|
+
* @description Context provided to every tool during execution.
|
|
4
|
+
* Encapsulates thread identity, execution call ID, workspace directory,
|
|
5
|
+
* cancellation signal, and progress streaming callbacks.
|
|
6
|
+
*/
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=ToolExecutionContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToolExecutionContext.js","sources":["../../src/tools/ToolExecutionContext.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Centralized registry managing built-in and external tools in Hernex.
|
|
3
|
+
* Handles registration, lookups, and native AI SDK v7 tool definition bridging.
|
|
4
|
+
* @packageDocumentation
|
|
5
|
+
*/
|
|
6
|
+
import { type Tool } from "ai";
|
|
7
|
+
import type { AgentTool } from "./AgentTool.js";
|
|
8
|
+
/**
|
|
9
|
+
* Configuration options when instantiating a `ToolRegistry`.
|
|
10
|
+
*/
|
|
11
|
+
export interface ToolRegistryOptions {
|
|
12
|
+
/**
|
|
13
|
+
* Whether to automatically register the 7 standard built-in tools
|
|
14
|
+
* (readFile, writeFile, editFile, bash, taskManager, glob, grep). Defaults to true.
|
|
15
|
+
*/
|
|
16
|
+
readonly includeDefaults?: boolean;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Central tool registry managing discovery, validation, and AI SDK adaptation.
|
|
20
|
+
*/
|
|
21
|
+
export declare class ToolRegistry {
|
|
22
|
+
private readonly tools;
|
|
23
|
+
/**
|
|
24
|
+
* Constructs a new ToolRegistry instance, optionally pre-loading built-in tools.
|
|
25
|
+
*
|
|
26
|
+
* @param options - Optional registry configuration options.
|
|
27
|
+
*/
|
|
28
|
+
constructor(options?: ToolRegistryOptions);
|
|
29
|
+
/**
|
|
30
|
+
* Registers a tool instance into the registry.
|
|
31
|
+
*
|
|
32
|
+
* @param agentTool - The AgentTool instance to register.
|
|
33
|
+
* @param options - Optional registration parameters, such as allowing explicit overrides.
|
|
34
|
+
* @throws Error if the tool name is empty, invalid, or already registered without allowOverride.
|
|
35
|
+
*/
|
|
36
|
+
register(agentTool: AgentTool, options?: {
|
|
37
|
+
readonly allowOverride?: boolean;
|
|
38
|
+
}): void;
|
|
39
|
+
/**
|
|
40
|
+
* Unregisters a tool by name.
|
|
41
|
+
*
|
|
42
|
+
* @param name - The unique name of the tool to remove.
|
|
43
|
+
* @returns True if a tool was found and removed, false otherwise.
|
|
44
|
+
*/
|
|
45
|
+
unregister(name: string): boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Resolves a registered tool by its name.
|
|
48
|
+
*
|
|
49
|
+
* @param name - The unique name of the tool to look up.
|
|
50
|
+
* @returns The AgentTool instance, or undefined if not registered.
|
|
51
|
+
*/
|
|
52
|
+
resolve(name: string): AgentTool | undefined;
|
|
53
|
+
/**
|
|
54
|
+
* Checks whether a tool with the given name is currently registered.
|
|
55
|
+
*
|
|
56
|
+
* @param name - The tool name to check.
|
|
57
|
+
* @returns True if registered, false otherwise.
|
|
58
|
+
*/
|
|
59
|
+
has(name: string): boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Returns a snapshot array of all currently registered tools.
|
|
62
|
+
*
|
|
63
|
+
* @returns Readonly array of AgentTool instances.
|
|
64
|
+
*/
|
|
65
|
+
list(): readonly AgentTool[];
|
|
66
|
+
/**
|
|
67
|
+
* Converts all registered tools into native Vercel AI SDK v7 `Tool` definitions
|
|
68
|
+
* without execute handlers.
|
|
69
|
+
*
|
|
70
|
+
* This allows the autonomous engine turn loop to pass tool schemas to the model
|
|
71
|
+
* while retaining complete control over tool execution, permission checks,
|
|
72
|
+
* mutating file checkpoints, and progress streaming.
|
|
73
|
+
*
|
|
74
|
+
* @returns A map of tool names to AI SDK v7 `Tool` objects without execute handlers.
|
|
75
|
+
*/
|
|
76
|
+
toSdkToolDefinitions(): Record<string, Tool>;
|
|
77
|
+
/**
|
|
78
|
+
* Populates the registry with the default suite of 7 core agent tools.
|
|
79
|
+
*/
|
|
80
|
+
private registerDefaultTools;
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=ToolRegistry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToolRegistry.d.ts","sources":["../../src/tools/ToolRegistry.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,KAAK,IAAI,EAAQ,MAAM,IAAI,CAAC;AACrC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAShD;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;OAGG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,OAAO,CAAC;CACpC;AAED;;GAEG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAgC;IAEtD;;;;OAIG;IACH,YAAmB,OAAO,CAAC,EAAE,mBAAmB,EAK/C;IAED;;;;;;OAMG;IACI,QAAQ,CACb,SAAS,EAAE,SAAS,EACpB,OAAO,CAAC,EAAE;QAAE,QAAQ,CAAC,aAAa,CAAC,EAAE,OAAO,CAAA;KAAE,GAC7C,IAAI,CAeN;IAED;;;;;OAKG;IACI,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEvC;IAED;;;;;OAKG;IACI,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAElD;IAED;;;;;OAKG;IACI,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEhC;IAED;;;;OAIG;IACI,IAAI,IAAI,SAAS,SAAS,EAAE,CAElC;IAED;;;;;;;;;OASG;IACI,oBAAoB,IAAI,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAWlD;IAED;;OAEG;IACH,OAAO,CAAC,oBAAoB;CAS7B"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Centralized registry managing built-in and external tools in Hernex.
|
|
3
|
+
* Handles registration, lookups, and native AI SDK v7 tool definition bridging.
|
|
4
|
+
* @packageDocumentation
|
|
5
|
+
*/
|
|
6
|
+
import { tool } from "ai";
|
|
7
|
+
import { BashTool } from "./BashTool.js";
|
|
8
|
+
import { EditFileTool } from "./EditFileTool.js";
|
|
9
|
+
import { GlobTool } from "./GlobTool.js";
|
|
10
|
+
import { GrepTool } from "./GrepTool.js";
|
|
11
|
+
import { ReadFileTool } from "./ReadFileTool.js";
|
|
12
|
+
import { TaskManagerTool } from "./TaskManagerTool.js";
|
|
13
|
+
import { WriteFileTool } from "./WriteFileTool.js";
|
|
14
|
+
/**
|
|
15
|
+
* Central tool registry managing discovery, validation, and AI SDK adaptation.
|
|
16
|
+
*/
|
|
17
|
+
export class ToolRegistry {
|
|
18
|
+
tools = new Map();
|
|
19
|
+
/**
|
|
20
|
+
* Constructs a new ToolRegistry instance, optionally pre-loading built-in tools.
|
|
21
|
+
*
|
|
22
|
+
* @param options - Optional registry configuration options.
|
|
23
|
+
*/
|
|
24
|
+
constructor(options) {
|
|
25
|
+
const includeDefaults = options?.includeDefaults ?? true;
|
|
26
|
+
if (includeDefaults) {
|
|
27
|
+
this.registerDefaultTools();
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Registers a tool instance into the registry.
|
|
32
|
+
*
|
|
33
|
+
* @param agentTool - The AgentTool instance to register.
|
|
34
|
+
* @param options - Optional registration parameters, such as allowing explicit overrides.
|
|
35
|
+
* @throws Error if the tool name is empty, invalid, or already registered without allowOverride.
|
|
36
|
+
*/
|
|
37
|
+
register(agentTool, options) {
|
|
38
|
+
if (!agentTool.name ||
|
|
39
|
+
typeof agentTool.name !== "string" ||
|
|
40
|
+
agentTool.name.trim().length === 0) {
|
|
41
|
+
throw new Error("Tool name must be a non-empty string.");
|
|
42
|
+
}
|
|
43
|
+
if (this.tools.has(agentTool.name) && !options?.allowOverride) {
|
|
44
|
+
throw new Error(`Tool "${agentTool.name}" is already registered. Duplicate tool registration is not allowed. Pass { allowOverride: true } or unregister the tool first.`);
|
|
45
|
+
}
|
|
46
|
+
this.tools.set(agentTool.name, agentTool);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Unregisters a tool by name.
|
|
50
|
+
*
|
|
51
|
+
* @param name - The unique name of the tool to remove.
|
|
52
|
+
* @returns True if a tool was found and removed, false otherwise.
|
|
53
|
+
*/
|
|
54
|
+
unregister(name) {
|
|
55
|
+
return this.tools.delete(name);
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Resolves a registered tool by its name.
|
|
59
|
+
*
|
|
60
|
+
* @param name - The unique name of the tool to look up.
|
|
61
|
+
* @returns The AgentTool instance, or undefined if not registered.
|
|
62
|
+
*/
|
|
63
|
+
resolve(name) {
|
|
64
|
+
return this.tools.get(name);
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Checks whether a tool with the given name is currently registered.
|
|
68
|
+
*
|
|
69
|
+
* @param name - The tool name to check.
|
|
70
|
+
* @returns True if registered, false otherwise.
|
|
71
|
+
*/
|
|
72
|
+
has(name) {
|
|
73
|
+
return this.tools.has(name);
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Returns a snapshot array of all currently registered tools.
|
|
77
|
+
*
|
|
78
|
+
* @returns Readonly array of AgentTool instances.
|
|
79
|
+
*/
|
|
80
|
+
list() {
|
|
81
|
+
return Array.from(this.tools.values());
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Converts all registered tools into native Vercel AI SDK v7 `Tool` definitions
|
|
85
|
+
* without execute handlers.
|
|
86
|
+
*
|
|
87
|
+
* This allows the autonomous engine turn loop to pass tool schemas to the model
|
|
88
|
+
* while retaining complete control over tool execution, permission checks,
|
|
89
|
+
* mutating file checkpoints, and progress streaming.
|
|
90
|
+
*
|
|
91
|
+
* @returns A map of tool names to AI SDK v7 `Tool` objects without execute handlers.
|
|
92
|
+
*/
|
|
93
|
+
toSdkToolDefinitions() {
|
|
94
|
+
const sdkTools = {};
|
|
95
|
+
for (const agentTool of this.tools.values()) {
|
|
96
|
+
sdkTools[agentTool.name] = tool({
|
|
97
|
+
description: agentTool.description,
|
|
98
|
+
inputSchema: agentTool.inputSchema,
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
return sdkTools;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Populates the registry with the default suite of 7 core agent tools.
|
|
105
|
+
*/
|
|
106
|
+
registerDefaultTools() {
|
|
107
|
+
this.register(new ReadFileTool());
|
|
108
|
+
this.register(new WriteFileTool());
|
|
109
|
+
this.register(new EditFileTool());
|
|
110
|
+
this.register(new BashTool());
|
|
111
|
+
this.register(new TaskManagerTool());
|
|
112
|
+
this.register(new GlobTool());
|
|
113
|
+
this.register(new GrepTool());
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
//# sourceMappingURL=ToolRegistry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToolRegistry.js","sources":["../../src/tools/ToolRegistry.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAa,IAAI,EAAE,MAAM,IAAI,CAAC;AAErC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAanD;;GAEG;AACH,MAAM,OAAO,YAAY;IACN,KAAK,GAAG,IAAI,GAAG,EAAqB,CAAC;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C;IAED;;;;;;;;;OASG;IACI,oBAAoB;QACzB,MAAM,QAAQ,GAAyB,EAAE,CAAC;QAE1C,KAAK,MAAM,SAAS,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC;YAC5C,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;gBAC9B,WAAW,EAAE,SAAS,CAAC,WAAW;gBAClC,WAAW,EAAE,SAAS,CAAC,WAAW;aACnC,CAAC,CAAC;QACL,CAAC;QAED,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED;;OAEG;IACK,oBAAoB;QAC1B,IAAI,CAAC,QAAQ,CAAC,IAAI,YAAY,EAAE,CAAC,CAAC;QAClC,IAAI,CAAC,QAAQ,CAAC,IAAI,aAAa,EAAE,CAAC,CAAC;QACnC,IAAI,CAAC,QAAQ,CAAC,IAAI,YAAY,EAAE,CAAC,CAAC;QAClC,IAAI,CAAC,QAAQ,CAAC,IAAI,QAAQ,EAAE,CAAC,CAAC;QAC9B,IAAI,CAAC,QAAQ,CAAC,IAAI,eAAe,EAAE,CAAC,CAAC;QACrC,IAAI,CAAC,QAAQ,CAAC,IAAI,QAAQ,EAAE,CAAC,CAAC;QAC9B,IAAI,CAAC,QAAQ,CAAC,IAAI,QAAQ,EAAE,CAAC,CAAC;IAChC,CAAC;CACF"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Built-in tool for writing files to the workspace.
|
|
3
|
+
* Handles automatic parent directory creation and atomic writes to avoid partial writes.
|
|
4
|
+
* @packageDocumentation
|
|
5
|
+
*/
|
|
6
|
+
import { z } from "zod";
|
|
7
|
+
import type { AgentTool } from "./AgentTool.js";
|
|
8
|
+
import type { ToolExecutionContext } from "./ToolExecutionContext.js";
|
|
9
|
+
/**
|
|
10
|
+
* Input parameter schema for WriteFileTool.
|
|
11
|
+
*/
|
|
12
|
+
export declare const writeFileInputSchema: z.ZodObject<{
|
|
13
|
+
filePath: z.ZodString;
|
|
14
|
+
content: z.ZodString;
|
|
15
|
+
}, z.core.$strip>;
|
|
16
|
+
/**
|
|
17
|
+
* Result structure produced by WriteFileTool.
|
|
18
|
+
*/
|
|
19
|
+
export interface WriteFileOutput {
|
|
20
|
+
readonly filePath: string;
|
|
21
|
+
readonly bytesWritten: number;
|
|
22
|
+
readonly linesWritten: number;
|
|
23
|
+
readonly status: "created" | "overwritten";
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Built-in tool for creating or overwriting files.
|
|
27
|
+
*/
|
|
28
|
+
export declare class WriteFileTool implements AgentTool<typeof writeFileInputSchema, WriteFileOutput> {
|
|
29
|
+
static readonly toolName = "writeFile";
|
|
30
|
+
readonly name = "writeFile";
|
|
31
|
+
readonly description: string;
|
|
32
|
+
readonly inputSchema: z.ZodObject<{
|
|
33
|
+
filePath: z.ZodString;
|
|
34
|
+
content: z.ZodString;
|
|
35
|
+
}, z.core.$strip>;
|
|
36
|
+
/**
|
|
37
|
+
* Executes the file writing operation atomically, automatically capturing
|
|
38
|
+
* a content-addressed checkpoint snapshot if checkpointing is enabled on the session.
|
|
39
|
+
*
|
|
40
|
+
* @param parameters - Validated parameters containing filePath and content.
|
|
41
|
+
* @param context - The execution context with workingDirectory and checkpoint store.
|
|
42
|
+
* @returns A promise resolving to the structured write result.
|
|
43
|
+
*/
|
|
44
|
+
execute(parameters: z.infer<typeof writeFileInputSchema>, context: ToolExecutionContext): Promise<WriteFileOutput>;
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=WriteFileTool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WriteFileTool.d.ts","sources":["../../src/tools/WriteFileTool.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAKtE;;GAEG;AACH,eAAO,MAAM,oBAAoB;;;iBAO/B,CAAC;AAEH;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,SAAS,GAAG,aAAa,CAAC;CAC5C;AAED;;GAEG;AACH,qBAAa,aACX,YAAW,SAAS,CAAC,OAAO,oBAAoB,EAAE,eAAe,CAAC;IAElE,gBAAuB,QAAQ,eAAe;IAE9C,SAAgB,IAAI,eAA0B;IAC9C,SAAgB,WAAW,SAAwB;IACnD,SAAgB,WAAW;;;sBAAwB;IAEnD;;;;;;;OAOG;IACU,OAAO,CAClB,UAAU,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,EAChD,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,eAAe,CAAC,CAiE1B;CACF"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Built-in tool for writing files to the workspace.
|
|
3
|
+
* Handles automatic parent directory creation and atomic writes to avoid partial writes.
|
|
4
|
+
* @packageDocumentation
|
|
5
|
+
*/
|
|
6
|
+
import { existsSync } from "node:fs";
|
|
7
|
+
import path from "node:path";
|
|
8
|
+
import { z } from "zod";
|
|
9
|
+
import { resolvePathWithinWorkspace } from "./internal/pathGuard.js";
|
|
10
|
+
import { atomicWriteFile } from "../storage/atomicFile.js";
|
|
11
|
+
import { writeFileDescription } from "./prompts.js";
|
|
12
|
+
/**
|
|
13
|
+
* Input parameter schema for WriteFileTool.
|
|
14
|
+
*/
|
|
15
|
+
export const writeFileInputSchema = z.object({
|
|
16
|
+
filePath: z
|
|
17
|
+
.string()
|
|
18
|
+
.describe("The relative or absolute file path to create or overwrite."),
|
|
19
|
+
content: z
|
|
20
|
+
.string()
|
|
21
|
+
.describe("The complete text content to write into the file."),
|
|
22
|
+
});
|
|
23
|
+
/**
|
|
24
|
+
* Built-in tool for creating or overwriting files.
|
|
25
|
+
*/
|
|
26
|
+
export class WriteFileTool {
|
|
27
|
+
static toolName = "writeFile";
|
|
28
|
+
name = WriteFileTool.toolName;
|
|
29
|
+
description = writeFileDescription;
|
|
30
|
+
inputSchema = writeFileInputSchema;
|
|
31
|
+
/**
|
|
32
|
+
* Executes the file writing operation atomically, automatically capturing
|
|
33
|
+
* a content-addressed checkpoint snapshot if checkpointing is enabled on the session.
|
|
34
|
+
*
|
|
35
|
+
* @param parameters - Validated parameters containing filePath and content.
|
|
36
|
+
* @param context - The execution context with workingDirectory and checkpoint store.
|
|
37
|
+
* @returns A promise resolving to the structured write result.
|
|
38
|
+
*/
|
|
39
|
+
async execute(parameters, context) {
|
|
40
|
+
const fullPath = resolvePathWithinWorkspace(parameters.filePath, context.workingDirectory);
|
|
41
|
+
const fileExisted = existsSync(fullPath);
|
|
42
|
+
const relativeFilePath = path.relative(context.workingDirectory, fullPath);
|
|
43
|
+
let checkpointId;
|
|
44
|
+
// 1. Pre-mutation checkpoint capture
|
|
45
|
+
if (context.isCheckpointEnabled && context.checkpointStore) {
|
|
46
|
+
try {
|
|
47
|
+
const cpRecord = await context.checkpointStore.createCheckpoint(context.threadId, {
|
|
48
|
+
workingDirectory: context.workingDirectory,
|
|
49
|
+
turnIndex: context.turnIndex ?? 0,
|
|
50
|
+
label: `writeFile: ${parameters.filePath}`,
|
|
51
|
+
files: [relativeFilePath],
|
|
52
|
+
source: { toolName: WriteFileTool.toolName },
|
|
53
|
+
});
|
|
54
|
+
checkpointId = cpRecord.id;
|
|
55
|
+
}
|
|
56
|
+
catch (error) {
|
|
57
|
+
throw new Error(`Failed to record pre-mutation checkpoint for '${parameters.filePath}': ${error instanceof Error ? error.message : String(error)}`);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
const buffer = Buffer.from(parameters.content, "utf-8");
|
|
61
|
+
// 2. Perform file write atomically
|
|
62
|
+
await atomicWriteFile(fullPath, buffer);
|
|
63
|
+
// 3. Post-mutation checkpoint finalization
|
|
64
|
+
if (context.isCheckpointEnabled && context.checkpointStore && checkpointId) {
|
|
65
|
+
try {
|
|
66
|
+
const updatedRecord = await context.checkpointStore.updateCheckpoint(context.threadId, checkpointId, context.workingDirectory);
|
|
67
|
+
context.onCheckpointCreated?.({
|
|
68
|
+
checkpointId: updatedRecord.id,
|
|
69
|
+
sequence: updatedRecord.sequence,
|
|
70
|
+
label: updatedRecord.label,
|
|
71
|
+
filesTouched: [relativeFilePath],
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
catch (error) {
|
|
75
|
+
throw new Error(`Failed to record post-mutation checkpoint for '${parameters.filePath}': ${error instanceof Error ? error.message : String(error)}`);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
const lineCount = parameters.content.split("\n").length;
|
|
79
|
+
return {
|
|
80
|
+
filePath: parameters.filePath,
|
|
81
|
+
bytesWritten: buffer.length,
|
|
82
|
+
linesWritten: lineCount,
|
|
83
|
+
status: fileExisted ? "overwritten" : "created",
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=WriteFileTool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WriteFileTool.js","sources":["../../src/tools/WriteFileTool.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;AACrE,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,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,IAAI,CAAC,CAAC,MAAM,CAAC;QAExD,OAAO;YACL,QAAQ,EAAE,UAAU,CAAC,QAAQ;YAC7B,YAAY,EAAE,MAAM,CAAC,MAAM;YAC3B,YAAY,EAAE,SAAS;YACvB,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,SAAS;SAChD,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Built-in tools and registry export barrel for Hernex.
|
|
3
|
+
* @packageDocumentation
|
|
4
|
+
*/
|
|
5
|
+
export * from "./AgentTool.js";
|
|
6
|
+
export * from "./ToolExecutionContext.js";
|
|
7
|
+
export * from "./ToolRegistry.js";
|
|
8
|
+
export * from "./prompts.js";
|
|
9
|
+
export * from "./ReadFileTool.js";
|
|
10
|
+
export * from "./WriteFileTool.js";
|
|
11
|
+
export * from "./EditFileTool.js";
|
|
12
|
+
export * from "./BashTool.js";
|
|
13
|
+
export * from "./TaskManagerTool.js";
|
|
14
|
+
export * from "../tasks/index.js";
|
|
15
|
+
export * from "./GlobTool.js";
|
|
16
|
+
export * from "./GrepTool.js";
|
|
17
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,gBAAgB,CAAC;AAC/B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Built-in tools and registry export barrel for Hernex.
|
|
3
|
+
* @packageDocumentation
|
|
4
|
+
*/
|
|
5
|
+
export * from "./AgentTool.js";
|
|
6
|
+
export * from "./ToolExecutionContext.js";
|
|
7
|
+
export * from "./ToolRegistry.js";
|
|
8
|
+
export * from "./prompts.js";
|
|
9
|
+
export * from "./ReadFileTool.js";
|
|
10
|
+
export * from "./WriteFileTool.js";
|
|
11
|
+
export * from "./EditFileTool.js";
|
|
12
|
+
export * from "./BashTool.js";
|
|
13
|
+
export * from "./TaskManagerTool.js";
|
|
14
|
+
export * from "../tasks/index.js";
|
|
15
|
+
export * from "./GlobTool.js";
|
|
16
|
+
export * from "./GrepTool.js";
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,gBAAgB,CAAC;AAC/B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Shell process environment sanitization and filtering.
|
|
3
|
+
* @packageDocumentation
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Constructs a sanitized environment dictionary for shell command execution.
|
|
7
|
+
*
|
|
8
|
+
* Filters out all host API keys, authentication tokens, and secrets by default,
|
|
9
|
+
* while forwarding standard execution variables (PATH, HOME, USER, etc.).
|
|
10
|
+
*
|
|
11
|
+
* @param extraAllowlist - Optional list of additional environment variable names to forward.
|
|
12
|
+
* @returns Clean environment record safe for subprocess execution.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```typescript
|
|
16
|
+
* const env = getSafeBashEnvironment(["CUSTOM_VAR"]);
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export declare function getSafeBashEnvironment(extraAllowlist?: readonly string[]): Record<string, string>;
|
|
20
|
+
//# sourceMappingURL=bashEnvironment.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bashEnvironment.d.ts","sources":["../../../src/tools/internal/bashEnvironment.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAgCH;;;;;;;;;;;;;GAaG;AACH,wBAAgB,sBAAsB,CACpC,cAAc,CAAC,EAAE,SAAS,MAAM,EAAE,GACjC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAuBxB"}
|