@hyperwindmill/caretaker-cli 0.26.0 → 0.27.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/dist/cli/web/scheduler/task_roles.d.ts.map +1 -1
- package/dist/cli/web/scheduler/task_roles.js +8 -4
- package/dist/cli/web/scheduler/task_strategy.d.ts.map +1 -1
- package/dist/cli/web/scheduler/task_strategy.js +8 -5
- package/dist/cli/web/server.d.ts.map +1 -1
- package/dist/cli/web/server.js +18 -8
- package/dist/harness/agent_refresh.d.ts +16 -0
- package/dist/harness/agent_refresh.d.ts.map +1 -0
- package/dist/harness/agent_refresh.js +23 -0
- package/dist/harness/index.d.ts +2 -0
- package/dist/harness/index.d.ts.map +1 -1
- package/dist/harness/index.js +1 -0
- package/dist/harness/tools/builtin/delete.d.ts +3 -0
- package/dist/harness/tools/builtin/delete.d.ts.map +1 -0
- package/dist/harness/tools/builtin/delete.js +57 -0
- package/dist/harness/tools/builtin/index.d.ts.map +1 -1
- package/dist/harness/tools/builtin/index.js +4 -0
- package/dist/harness/tools/builtin/move.d.ts +3 -0
- package/dist/harness/tools/builtin/move.d.ts.map +1 -0
- package/dist/harness/tools/builtin/move.js +63 -0
- package/dist/harness/tools/builtin/task_tools.d.ts.map +1 -1
- package/dist/harness/tools/builtin/task_tools.js +8 -3
- package/dist/plugins/fetchers/git.js +1 -1
- package/dist/plugins/loader.d.ts.map +1 -1
- package/dist/plugins/loader.js +2 -3
- package/dist/plugins/source_manager.d.ts.map +1 -1
- package/dist/plugins/source_manager.js +2 -3
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"task_roles.d.ts","sourceRoot":"","sources":["../../../../src/cli/web/scheduler/task_roles.ts"],"names":[],"mappings":"AAGA,OAAO,EAAY,IAAI,EAAe,MAAM,sBAAsB,CAAC;AACnE,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACpE,OA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gB,sBAAsB,CACpC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,iBAAiB,CAAC,EACnC,OAAO,CAAC,EAAE,IAAI,CAAC,aAAa,EAAE,iBAAiB,CAAC,GAAG,IAAI,GACtD,OAAO,CAET;AAED,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,eAAe,CAAC,EACjC,OAAO,CAAC,EAAE,IAAI,CAAC,aAAa,EAAE,eAAe,CAAC,GAAG,IAAI,GACpD,OAAO,CAET;AAED,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,YAAY,CAAC,EAC9B,OAAO,CAAC,EAAE,IAAI,CAAC,aAAa,EAAE,YAAY,CAAC,GAAG,IAAI,GACjD,OAAO,CAET;AAED;;;;GAIG;AACH,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,aAAa,GAAG,SAAS,GACjC,OAAO,CAAC,UAAU,GAAG,QAAQ,CAAC,CAIhC;AAYD,eAAO,MAAM,qBAAqB,aAOhC,CAAC;AAwBH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,GAAG,UAAQ,GAAG,IAAI,EAAE,CAOrE"}
|
|
@@ -67,10 +67,13 @@ export const PLANNER_TOOL_DENYLIST = new Set([
|
|
|
67
67
|
'write',
|
|
68
68
|
'edit',
|
|
69
69
|
'multiedit',
|
|
70
|
+
'delete',
|
|
71
|
+
'move',
|
|
70
72
|
...PLANNER_ALWAYS_DENIED,
|
|
71
73
|
]);
|
|
72
|
-
/** Tools the SDD wrapper applies to: workspace writers that take a `path`
|
|
73
|
-
|
|
74
|
+
/** Tools the SDD wrapper applies to: workspace writers that take a `path`
|
|
75
|
+
* arg (`move`: `from` + `to`). */
|
|
76
|
+
const SDD_WRAPPED_TOOLS = new Set(['write', 'edit', 'multiedit', 'delete', 'move']);
|
|
74
77
|
/** Wrap a writing tool so it only accepts markdown targets. Everything else
|
|
75
78
|
* about the tool (schema, sandbox, read-before-write guard) is unchanged —
|
|
76
79
|
* the guard runs before delegation. Guard-rail, not a security boundary. */
|
|
@@ -79,8 +82,9 @@ function markdownOnly(tool) {
|
|
|
79
82
|
...tool,
|
|
80
83
|
description: `${tool.description} In this planning phase, only markdown (.md) files are accepted.`,
|
|
81
84
|
execute: async (args, ctx) => {
|
|
82
|
-
const
|
|
83
|
-
|
|
85
|
+
const a = args;
|
|
86
|
+
const paths = ['path', 'from', 'to'].filter((k) => k in a).map((k) => a[k]);
|
|
87
|
+
if (paths.length === 0 || paths.some((p) => typeof p !== 'string' || !p.toLowerCase().endsWith('.md'))) {
|
|
84
88
|
return { content: 'Error: planning phase (SDD mode): only markdown (.md) files may be written.' };
|
|
85
89
|
}
|
|
86
90
|
return tool.execute(args, ctx);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"task_strategy.d.ts","sourceRoot":"","sources":["../../../../src/cli/web/scheduler/task_strategy.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"task_strategy.d.ts","sourceRoot":"","sources":["../../../../src/cli/web/scheduler/task_strategy.ts"],"names":[],"mappings":"AA8HA,wBAAsB,oBAAoB,CAAC,GAAG,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAidnE"}
|
|
@@ -42,12 +42,15 @@ On each invocation:
|
|
|
42
42
|
- which tools you used and what the results were
|
|
43
43
|
- what the recommended next step is
|
|
44
44
|
- any issues encountered or decisions made
|
|
45
|
-
7.
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
7. End the invocation with exactly ONE of these, in this order of checks:
|
|
46
|
+
- **The objective is met and every checklist item is done → call \`task_complete\`.**
|
|
47
|
+
Never \`task_yield\` a finished task: a yielded task stays active and runs again.
|
|
48
|
+
- You need human input to proceed → call \`task_block\` with a clear explanation.
|
|
49
|
+
- Work remains → call \`task_yield\` with a short note on the next step (or simply stop);
|
|
50
|
+
you will continue in the next cycle.
|
|
48
51
|
|
|
49
|
-
Do
|
|
50
|
-
|
|
52
|
+
Do ONE meaningful step per invocation, then document and end it as above.
|
|
53
|
+
If that step finishes the objective, complete the task now — do not leave it for another cycle.
|
|
51
54
|
|
|
52
55
|
TASK ID: ${taskId}
|
|
53
56
|
TITLE: ${taskTitle}`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../src/cli/web/server.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,OAAO,MAAM,wBAAwB,CAAC;AA4ClD,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAgC,MAAM,gBAAgB,CAAC;AAChG,OAAO,KAAK,EAAe,eAAe,EAA0B,MAAM,mBAAmB,CAAC;AA+B9F,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,UAAU,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IAC9D,YAAY,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACpD,UAAU,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,KAAK,OAAO,CAAC,eAAe,CAAC,CAAC;IACtF,OAAO,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,gBAAgB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;CAChD;AAED,qBAAa,oBAAoB;IAQ7B,OAAO,CAAC,QAAQ,CAAC,IAAI;IAPvB,OAAO,CAAC,UAAU,CAAkC;IACpD,OAAO,CAAC,OAAO,CAAuB;IACt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I,IAAI;CAGd;AAED,wBAAsB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA2sC3E"}
|
package/dist/cli/web/server.js
CHANGED
|
@@ -776,6 +776,10 @@ export async function startServer(port, host) {
|
|
|
776
776
|
maybeAutoStartBackend();
|
|
777
777
|
wss.on('connection', async (ws) => {
|
|
778
778
|
let controller = null;
|
|
779
|
+
// Set when the agent or its provider changed on disk: the controller holds
|
|
780
|
+
// the config it was built with, so the next turn rebuilds it (history is
|
|
781
|
+
// reloaded from disk via currentSessionId). A running turn is never cut.
|
|
782
|
+
let controllerStale = false;
|
|
779
783
|
let currentAgent = null;
|
|
780
784
|
let currentProvider = null;
|
|
781
785
|
let currentTools = null;
|
|
@@ -820,14 +824,16 @@ export async function startServer(port, host) {
|
|
|
820
824
|
if (currentAgent) {
|
|
821
825
|
const freshAgent = agents.find((a) => a.id === currentAgent.id);
|
|
822
826
|
if (freshAgent) {
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
(
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
currentAgent =
|
|
829
|
-
|
|
830
|
-
|
|
827
|
+
const r = harness.refreshAgentRuntime({ agent: currentAgent, provider: currentProvider }, freshAgent, providers);
|
|
828
|
+
if (!r.ok) {
|
|
829
|
+
post({ type: 'error', message: r.error });
|
|
830
|
+
return;
|
|
831
|
+
}
|
|
832
|
+
currentAgent = r.agent;
|
|
833
|
+
currentProvider = r.provider;
|
|
834
|
+
if (r.changed)
|
|
835
|
+
controllerStale = true;
|
|
836
|
+
if (r.toolsChanged) {
|
|
831
837
|
currentTools = await harness.resolveAgentTools(currentAgent, harness.tools);
|
|
832
838
|
post({ type: 'contextUsage', usage: controller?.getContextUsage() ?? null });
|
|
833
839
|
}
|
|
@@ -971,6 +977,10 @@ export async function startServer(port, host) {
|
|
|
971
977
|
const workspaceFolder = (currentAgent.workingDir && currentAgent.workingDir.trim())
|
|
972
978
|
? currentAgent.workingDir.trim()
|
|
973
979
|
: process.cwd();
|
|
980
|
+
if (controllerStale && !controller?.isRunning) {
|
|
981
|
+
controller = null;
|
|
982
|
+
controllerStale = false;
|
|
983
|
+
}
|
|
974
984
|
if (!controller) {
|
|
975
985
|
controller = new WebSessionController({
|
|
976
986
|
agent: currentAgent,
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { AgentConfig, ProviderConfig } from '../types.js';
|
|
2
|
+
export type AgentRefresh = {
|
|
3
|
+
ok: true;
|
|
4
|
+
agent: AgentConfig;
|
|
5
|
+
provider: ProviderConfig;
|
|
6
|
+
toolsChanged: boolean;
|
|
7
|
+
changed: boolean;
|
|
8
|
+
} | {
|
|
9
|
+
ok: false;
|
|
10
|
+
error: string;
|
|
11
|
+
};
|
|
12
|
+
export declare function refreshAgentRuntime(current: {
|
|
13
|
+
agent: AgentConfig;
|
|
14
|
+
provider: ProviderConfig | null;
|
|
15
|
+
}, freshAgent: AgentConfig, providers: ProviderConfig[]): AgentRefresh;
|
|
16
|
+
//# sourceMappingURL=agent_refresh.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent_refresh.d.ts","sourceRoot":"","sources":["../../src/harness/agent_refresh.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE/D,MAAM,MAAM,YAAY,GACpB;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,WAAW,CAAC;IAAC,QAAQ,EAAE,cAAc,CAAC;IAAC,YAAY,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,GACnG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAEjC,wBAAgB,mBAAmB,CACjC,OAAO,EAAE;IAAE,KAAK,EAAE,WAAW,CAAC;IAAC,QAAQ,EAAE,cAAc,GAAG,IAAI,CAAA;CAAE,EAChE,UAAU,EAAE,WAAW,EACvB,SAAS,EAAE,cAAc,EAAE,GAC1B,YAAY,CAiBd"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// Shared in-place agent refresh for interactive chat surfaces (web, VSCode).
|
|
2
|
+
//
|
|
3
|
+
// When the config files change on disk, the selected agent is re-read and its
|
|
4
|
+
// provider is re-resolved by name — never carried over, or a provider switch
|
|
5
|
+
// pairs the new model with the old endpoint. `changed` tells the surface to
|
|
6
|
+
// drop its idle session controller, which captured agent/provider/tools at
|
|
7
|
+
// construction; the next turn rebuilds it and reloads history from disk.
|
|
8
|
+
export function refreshAgentRuntime(current, freshAgent, providers) {
|
|
9
|
+
const provider = providers.find((p) => p.name === freshAgent.provider);
|
|
10
|
+
if (!provider) {
|
|
11
|
+
return {
|
|
12
|
+
ok: false,
|
|
13
|
+
error: `Provider "${freshAgent.provider}" for agent "${freshAgent.name}" is missing from caretaker.json.`,
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
const prev = current.agent;
|
|
17
|
+
const toolsChanged = freshAgent.allowedTools.join('|') !== prev.allowedTools.join('|') ||
|
|
18
|
+
(freshAgent.plugins ?? []).join('|') !== (prev.plugins ?? []).join('|') ||
|
|
19
|
+
(freshAgent.mcpServers ?? []).join('|') !== (prev.mcpServers ?? []).join('|');
|
|
20
|
+
const changed = JSON.stringify(freshAgent) !== JSON.stringify(prev) ||
|
|
21
|
+
JSON.stringify(provider) !== JSON.stringify(current.provider);
|
|
22
|
+
return { ok: true, agent: { ...freshAgent }, provider, toolsChanged, changed };
|
|
23
|
+
}
|
package/dist/harness/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export { run } from './loop.js';
|
|
2
2
|
export { ConfirmGateState } from './confirm_gate.js';
|
|
3
|
+
export { refreshAgentRuntime } from './agent_refresh.js';
|
|
4
|
+
export type { AgentRefresh } from './agent_refresh.js';
|
|
3
5
|
export type { RunOptions, RunCallbacks, RunResult, ConfirmDecision } from './loop.js';
|
|
4
6
|
export { resolveAgentTools, ToolRegistry, registerBuiltins, toOpenAiTool } from './tools/index.js';
|
|
5
7
|
export type { Tool, ToolContext, ToolResult, ConfirmGate, OpenAiFunctionTool, } from './tools/index.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/harness/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAChC,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAEtF,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACnG,YAAY,EACV,IAAI,EACJ,WAAW,EACX,UAAU,EACV,WAAW,EACX,kBAAkB,GACnB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAE5C,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AACrD,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/harness/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAChC,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,YAAY,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAEtF,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACnG,YAAY,EACV,IAAI,EACJ,WAAW,EACX,UAAU,EACV,WAAW,EACX,kBAAkB,GACnB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAE5C,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AACrD,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/harness/index.js
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
// stable surface exposed via `caretaker-cli/harness`.
|
|
5
5
|
export { run } from './loop.js';
|
|
6
6
|
export { ConfirmGateState } from './confirm_gate.js';
|
|
7
|
+
export { refreshAgentRuntime } from './agent_refresh.js';
|
|
7
8
|
export { resolveAgentTools, ToolRegistry, registerBuiltins, toOpenAiTool } from './tools/index.js';
|
|
8
9
|
export { tools } from './tools/instance.js';
|
|
9
10
|
export { fetchOpenAiStyleModels } from './models.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete.d.ts","sourceRoot":"","sources":["../../../../src/harness/tools/builtin/delete.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAGxC,eAAO,MAAM,UAAU,EAAE,IAkDxB,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
// Delete a file or an empty directory. Deliberately not recursive: a
|
|
2
|
+
// directory is emptied file by file, so one mistaken call cannot wipe a tree.
|
|
3
|
+
// Symlinks are removed themselves (lstat), never their targets.
|
|
4
|
+
import { lstat, rmdir, unlink } from 'node:fs/promises';
|
|
5
|
+
import * as path from 'node:path';
|
|
6
|
+
import { assertWithinRoot, OutsideRootError } from '../sandbox.js';
|
|
7
|
+
export const deleteTool = {
|
|
8
|
+
name: 'delete',
|
|
9
|
+
description: 'Delete a file or an empty directory. Not recursive: delete the files ' +
|
|
10
|
+
'inside a directory first.',
|
|
11
|
+
parameters: {
|
|
12
|
+
type: 'object',
|
|
13
|
+
properties: {
|
|
14
|
+
path: { type: 'string', description: 'Path within the working directory.' },
|
|
15
|
+
},
|
|
16
|
+
required: ['path'],
|
|
17
|
+
additionalProperties: false,
|
|
18
|
+
},
|
|
19
|
+
dangerous: true,
|
|
20
|
+
async execute(args, ctx) {
|
|
21
|
+
const a = args;
|
|
22
|
+
if (typeof a.path !== 'string' || !a.path.trim()) {
|
|
23
|
+
return { content: 'Error: path must be a non-empty string' };
|
|
24
|
+
}
|
|
25
|
+
let abs;
|
|
26
|
+
try {
|
|
27
|
+
abs = assertWithinRoot(ctx.workingDir, a.path);
|
|
28
|
+
}
|
|
29
|
+
catch (err) {
|
|
30
|
+
if (err instanceof OutsideRootError)
|
|
31
|
+
return { content: `Error: ${err.message}` };
|
|
32
|
+
throw err;
|
|
33
|
+
}
|
|
34
|
+
if (abs === path.resolve(ctx.workingDir)) {
|
|
35
|
+
return { content: 'Error: refusing to delete the working directory itself' };
|
|
36
|
+
}
|
|
37
|
+
const st = await lstat(abs).catch(() => null);
|
|
38
|
+
if (!st)
|
|
39
|
+
return { content: `Error: ${a.path} does not exist` };
|
|
40
|
+
try {
|
|
41
|
+
if (st.isDirectory()) {
|
|
42
|
+
await rmdir(abs);
|
|
43
|
+
return { content: `Deleted empty directory ${a.path}` };
|
|
44
|
+
}
|
|
45
|
+
await unlink(abs);
|
|
46
|
+
}
|
|
47
|
+
catch (err) {
|
|
48
|
+
const code = err.code;
|
|
49
|
+
if (code === 'ENOTEMPTY' || code === 'EEXIST') {
|
|
50
|
+
return { content: `Error: directory ${a.path} is not empty; delete its contents first` };
|
|
51
|
+
}
|
|
52
|
+
return { content: `Error: ${err instanceof Error ? err.message : String(err)}` };
|
|
53
|
+
}
|
|
54
|
+
ctx.readPaths.delete(abs);
|
|
55
|
+
return { content: `Deleted file ${a.path}` };
|
|
56
|
+
},
|
|
57
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/harness/tools/builtin/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/harness/tools/builtin/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAG/C,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO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AgB,EAChB,cAAc,EACd,qBAAqB,EACrB,qBAAqB,EACrB,aAAa,EACb,cAAc,EACd,cAAc,GACf,CAAC"}
|
|
@@ -8,6 +8,8 @@ import { readAttachmentTool } from './read_attachment.js';
|
|
|
8
8
|
import { writeTool } from './write.js';
|
|
9
9
|
import { editTool } from './edit.js';
|
|
10
10
|
import { multieditTool } from './multiedit.js';
|
|
11
|
+
import { deleteTool } from './delete.js';
|
|
12
|
+
import { moveTool } from './move.js';
|
|
11
13
|
import { globTool } from './glob.js';
|
|
12
14
|
import { grepTool } from './grep.js';
|
|
13
15
|
import { fetchTool } from './fetch.js';
|
|
@@ -31,6 +33,8 @@ export function registerBuiltins(registry) {
|
|
|
31
33
|
registry.register(writeTool);
|
|
32
34
|
registry.register(editTool);
|
|
33
35
|
registry.register(multieditTool);
|
|
36
|
+
registry.register(deleteTool);
|
|
37
|
+
registry.register(moveTool);
|
|
34
38
|
registry.register(globTool);
|
|
35
39
|
registry.register(grepTool);
|
|
36
40
|
// Network.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"move.d.ts","sourceRoot":"","sources":["../../../../src/harness/tools/builtin/move.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAGxC,eAAO,MAAM,QAAQ,EAAE,IAwDtB,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
// Move or rename a file or directory inside the working directory. Never
|
|
2
|
+
// overwrites: an existing destination is refused, so a move cannot silently
|
|
3
|
+
// destroy a file. The destination's parent directories are created.
|
|
4
|
+
import { lstat, mkdir, rename } from 'node:fs/promises';
|
|
5
|
+
import * as path from 'node:path';
|
|
6
|
+
import { assertWithinRoot, OutsideRootError } from '../sandbox.js';
|
|
7
|
+
export const moveTool = {
|
|
8
|
+
name: 'move',
|
|
9
|
+
description: 'Move or rename a file or directory. Fails if the destination already ' +
|
|
10
|
+
'exists (delete it first if replacing it is intended).',
|
|
11
|
+
parameters: {
|
|
12
|
+
type: 'object',
|
|
13
|
+
properties: {
|
|
14
|
+
from: { type: 'string', description: 'Existing path within the working directory.' },
|
|
15
|
+
to: { type: 'string', description: 'New path within the working directory.' },
|
|
16
|
+
},
|
|
17
|
+
required: ['from', 'to'],
|
|
18
|
+
additionalProperties: false,
|
|
19
|
+
},
|
|
20
|
+
dangerous: true,
|
|
21
|
+
async execute(args, ctx) {
|
|
22
|
+
const a = args;
|
|
23
|
+
if (typeof a.from !== 'string' || !a.from.trim()) {
|
|
24
|
+
return { content: 'Error: from must be a non-empty string' };
|
|
25
|
+
}
|
|
26
|
+
if (typeof a.to !== 'string' || !a.to.trim()) {
|
|
27
|
+
return { content: 'Error: to must be a non-empty string' };
|
|
28
|
+
}
|
|
29
|
+
let from;
|
|
30
|
+
let to;
|
|
31
|
+
try {
|
|
32
|
+
from = assertWithinRoot(ctx.workingDir, a.from);
|
|
33
|
+
to = assertWithinRoot(ctx.workingDir, a.to);
|
|
34
|
+
}
|
|
35
|
+
catch (err) {
|
|
36
|
+
if (err instanceof OutsideRootError)
|
|
37
|
+
return { content: `Error: ${err.message}` };
|
|
38
|
+
throw err;
|
|
39
|
+
}
|
|
40
|
+
const root = path.resolve(ctx.workingDir);
|
|
41
|
+
if (from === root || to === root) {
|
|
42
|
+
return { content: 'Error: refusing to move the working directory itself' };
|
|
43
|
+
}
|
|
44
|
+
if (!(await lstat(from).catch(() => null))) {
|
|
45
|
+
return { content: `Error: ${a.from} does not exist` };
|
|
46
|
+
}
|
|
47
|
+
// ponytail: check-then-rename race; rename() would overwrite a file
|
|
48
|
+
// created in between. Fine for a soft jail, not a security boundary.
|
|
49
|
+
if (await lstat(to).catch(() => null)) {
|
|
50
|
+
return { content: `Error: ${a.to} already exists; delete it first to replace it` };
|
|
51
|
+
}
|
|
52
|
+
try {
|
|
53
|
+
await mkdir(path.dirname(to), { recursive: true });
|
|
54
|
+
await rename(from, to);
|
|
55
|
+
}
|
|
56
|
+
catch (err) {
|
|
57
|
+
return { content: `Error: ${err instanceof Error ? err.message : String(err)}` };
|
|
58
|
+
}
|
|
59
|
+
if (ctx.readPaths.delete(from))
|
|
60
|
+
ctx.readPaths.add(to);
|
|
61
|
+
return { content: `Moved ${a.from} to ${a.to}` };
|
|
62
|
+
},
|
|
63
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"task_tools.d.ts","sourceRoot":"","sources":["../../../../src/harness/tools/builtin/task_tools.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,IAAI,EAAc,MAAM,aAAa,CAAC;AAepD,eAAO,MAAM,gBAAgB,EAAE,IAmD9B,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,IAqCrC,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,IAoDjC,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,IAmEnC,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,IAiC5B,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,IAgD9B,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,IAoC3B,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,
|
|
1
|
+
{"version":3,"file":"task_tools.d.ts","sourceRoot":"","sources":["../../../../src/harness/tools/builtin/task_tools.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,IAAI,EAAc,MAAM,aAAa,CAAC;AAepD,eAAO,MAAM,gBAAgB,EAAE,IAmD9B,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,IAqCrC,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,IAoDjC,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,IAmEnC,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,IAiC5B,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,IAgD9B,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,IAoC3B,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,IA2C3B,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,IA4B7B,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,IAgG5B,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,IA+B5B,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,IAwC7B,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,IAoC9B,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,IAwC7B,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,IA+CrC,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,IAkC7B,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,IA8B/B,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,IA0D5B,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,IAgD9B,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,IAuC5B,CAAC"}
|
|
@@ -242,7 +242,7 @@ export const addMessageTool = {
|
|
|
242
242
|
};
|
|
243
243
|
export const completeTaskTool = {
|
|
244
244
|
name: 'mcp__task__task_complete',
|
|
245
|
-
description: 'Mark the task as done.
|
|
245
|
+
description: 'Mark the task as done. Call it as soon as the objective is fully achieved and every checklist item is done, in the same invocation that finishes the work. Do not task_yield a finished task: it would stay active and run again.',
|
|
246
246
|
parameters: {
|
|
247
247
|
type: 'object',
|
|
248
248
|
properties: {
|
|
@@ -317,7 +317,7 @@ export const blockTaskTool = {
|
|
|
317
317
|
};
|
|
318
318
|
export const yieldTaskTool = {
|
|
319
319
|
name: 'mcp__task__task_yield',
|
|
320
|
-
description: '
|
|
320
|
+
description: 'End this invocation while work still REMAINS: the task stays active and the next cycle continues it. Never use it to finish — when the objective is met, call task_complete instead.',
|
|
321
321
|
parameters: {
|
|
322
322
|
type: 'object',
|
|
323
323
|
properties: {
|
|
@@ -345,7 +345,12 @@ export const yieldTaskTool = {
|
|
|
345
345
|
agentId: null,
|
|
346
346
|
});
|
|
347
347
|
}
|
|
348
|
-
|
|
348
|
+
// Flash-class models often yield a finished task instead of completing it.
|
|
349
|
+
// Not auto-completed: a done checklist does not prove the objective is met.
|
|
350
|
+
const allDone = task.checklist.length > 0 && task.checklist.every((c) => c.status === 'done');
|
|
351
|
+
return ok(allDone
|
|
352
|
+
? { reminder: 'Every checklist item is done. If the objective is met, call task_complete now: a yielded task stays active and runs another cycle.' }
|
|
353
|
+
: {});
|
|
349
354
|
},
|
|
350
355
|
};
|
|
351
356
|
export const projectListTool = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Git source fetcher for plugin sources. Each source has its own cache dir
|
|
2
|
-
// at
|
|
2
|
+
// at $CARETAKER_HOME/plugin-cache/<sourceId> (UUID, no collision with the
|
|
3
3
|
// caretaker server's numeric ids if both run on the same host).
|
|
4
4
|
//
|
|
5
5
|
// Auth tokens stored in the source row are decrypted on demand via
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../src/plugins/loader.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../src/plugins/loader.ts"],"names":[],"mappings":"AAiBA,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB;qEACiE;IACjE,MAAM,EAAE,MAAM,CAAC;CAChB;AAiBD;;;;GAIG;AACH,wBAAsB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAYjF;AAgCD;;;;;;GAMG;AACH,wBAAsB,gBAAgB,CAAC,WAAW,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,CAiBrF;AAED;;;;;;;GAOG;AACH,wBAAsB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAmCjG"}
|
package/dist/plugins/loader.js
CHANGED
|
@@ -9,8 +9,7 @@
|
|
|
9
9
|
// skill names; `read_skill` reads exactly one file.
|
|
10
10
|
import { readFile, stat } from 'node:fs/promises';
|
|
11
11
|
import * as path from 'node:path';
|
|
12
|
-
import
|
|
13
|
-
import { loadPlugins } from '../store/json.js';
|
|
12
|
+
import { dataDir, loadPlugins } from '../store/json.js';
|
|
14
13
|
const SKILL_FILE_BYTE_CAP = 100_000;
|
|
15
14
|
function isInside(root, candidate) {
|
|
16
15
|
const resolvedRoot = path.resolve(root);
|
|
@@ -19,7 +18,7 @@ function isInside(root, candidate) {
|
|
|
19
18
|
return !rel.startsWith('..') && !path.isAbsolute(rel);
|
|
20
19
|
}
|
|
21
20
|
function pluginCacheRoot() {
|
|
22
|
-
return process.env.PLUGIN_CACHE_DIR ?? path.join(
|
|
21
|
+
return process.env.PLUGIN_CACHE_DIR ?? path.join(dataDir(), 'plugin-cache');
|
|
23
22
|
}
|
|
24
23
|
function rootForSource(src) {
|
|
25
24
|
return src.kind === 'git' ? path.join(pluginCacheRoot(), src.id) : src.url;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"source_manager.d.ts","sourceRoot":"","sources":["../../src/plugins/source_manager.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"source_manager.d.ts","sourceRoot":"","sources":["../../src/plugins/source_manager.ts"],"names":[],"mappings":"AA4BA,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE9D,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,KAAK,GAAG,MAAM,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,MAAM,WAAW,gBAAgB;IAC/B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,MAAM,WAAW,cAAc;IAC7B,YAAY,EAAE,MAAM,CAAC;IACrB,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB;AAYD,wBAAsB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC,YAAY,CAAC,CAiBlF;AAED,wBAAsB,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAc/D;AAED,wBAAsB,WAAW,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC,CAG3D;AAED,wBAAsB,SAAS,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAGxE;AAED,wBAAsB,WAAW,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC,CAG3D;AAED,wBAAsB,WAAW,CAC/B,EAAE,EAAE,MAAM,EACV,KAAK,EAAE,gBAAgB,GACtB,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAe9B;AA+GD,wBAAgB,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CAMjE"}
|
|
@@ -10,9 +10,8 @@
|
|
|
10
10
|
// whole pipeline — sequential CRUD is fine.
|
|
11
11
|
import { rm } from 'node:fs/promises';
|
|
12
12
|
import * as path from 'node:path';
|
|
13
|
-
import * as os from 'node:os';
|
|
14
13
|
import { randomUUID } from 'node:crypto';
|
|
15
|
-
import { loadPlugins, savePlugins } from '../store/json.js';
|
|
14
|
+
import { dataDir, loadPlugins, savePlugins } from '../store/json.js';
|
|
16
15
|
import { encrypt } from '../lib/encryption.js';
|
|
17
16
|
import { syncManagedMcpServers } from '../mcp/server_manager.js';
|
|
18
17
|
import { syncManagedAgents } from '../agents/sync.js';
|
|
@@ -21,7 +20,7 @@ import { fetchGit } from './fetchers/git.js';
|
|
|
21
20
|
import { fetchPath, validatePathInput } from './fetchers/path.js';
|
|
22
21
|
const inFlight = new Map();
|
|
23
22
|
function pluginCacheRoot() {
|
|
24
|
-
return process.env.PLUGIN_CACHE_DIR ?? path.join(
|
|
23
|
+
return process.env.PLUGIN_CACHE_DIR ?? path.join(dataDir(), 'plugin-cache');
|
|
25
24
|
}
|
|
26
25
|
function cacheDirForSource(id) {
|
|
27
26
|
return path.join(pluginCacheRoot(), id);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hyperwindmill/caretaker-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.27.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Caretaker — in-process agent harness, TUI, file-based state.",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE",
|
|
@@ -89,8 +89,8 @@
|
|
|
89
89
|
"typescript": "^5.9.3",
|
|
90
90
|
"typescript-eslint": "^8.59.2",
|
|
91
91
|
"zod": "^4.4.3",
|
|
92
|
-
"caretaker-types": "0.
|
|
93
|
-
"webview-ui": "0.
|
|
92
|
+
"caretaker-types": "0.27.0",
|
|
93
|
+
"webview-ui": "0.27.0"
|
|
94
94
|
},
|
|
95
95
|
"dependencies": {
|
|
96
96
|
"@agentclientprotocol/sdk": "^1.4.0",
|