@hyperwindmill/caretaker-cli 0.19.0 → 0.21.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/mcp.js +5 -5
- package/dist/cli/web/mcp_bridge.d.ts +1 -1
- package/dist/cli/web/mcp_bridge.d.ts.map +1 -1
- package/dist/cli/web/mcp_bridge.js +23 -7
- package/dist/cli/web/scheduler/heartbeat.d.ts +2 -2
- package/dist/cli/web/scheduler/heartbeat.d.ts.map +1 -1
- package/dist/cli/web/scheduler/locks.d.ts +6 -0
- package/dist/cli/web/scheduler/locks.d.ts.map +1 -1
- package/dist/cli/web/scheduler/locks.js +6 -0
- package/dist/cli/web/scheduler/strategy.d.ts +3 -3
- package/dist/cli/web/scheduler/strategy.d.ts.map +1 -1
- package/dist/cli/web/scheduler/task_roles.d.ts +0 -4
- package/dist/cli/web/scheduler/task_roles.d.ts.map +1 -1
- package/dist/cli/web/scheduler/task_roles.js +12 -2
- package/dist/cli/web/scheduler/task_strategy.d.ts.map +1 -1
- package/dist/cli/web/scheduler/task_strategy.js +86 -4
- package/dist/cli/web/scheduler/telegram.d.ts.map +1 -1
- package/dist/cli/web/scheduler/telegram.js +4 -1
- package/dist/cli/web/server.d.ts.map +1 -1
- package/dist/cli/web/server.js +121 -10
- package/dist/harness/claude_code_runner.d.ts.map +1 -1
- package/dist/harness/claude_code_runner.js +5 -1
- package/dist/harness/tools/builtin/email_tools.d.ts +5 -0
- package/dist/harness/tools/builtin/email_tools.d.ts.map +1 -0
- package/dist/harness/tools/builtin/email_tools.js +182 -0
- package/dist/harness/tools/builtin/index.d.ts +2 -1
- package/dist/harness/tools/builtin/index.d.ts.map +1 -1
- package/dist/harness/tools/builtin/index.js +7 -1
- package/dist/harness/tools/builtin/task_tools.d.ts.map +1 -1
- package/dist/harness/tools/builtin/task_tools.js +48 -6
- package/dist/harness/tools/resolve.d.ts.map +1 -1
- package/dist/harness/tools/resolve.js +9 -4
- package/dist/lib/email.d.ts +132 -0
- package/dist/lib/email.d.ts.map +1 -0
- package/dist/lib/email.js +306 -0
- package/dist/lib/repo_url.d.ts +12 -0
- package/dist/lib/repo_url.d.ts.map +1 -0
- package/dist/lib/repo_url.js +36 -0
- package/dist/lib/task_git.d.ts +53 -1
- package/dist/lib/task_git.d.ts.map +1 -1
- package/dist/lib/task_git.js +197 -5
- package/dist/mcp/builtin_server.d.ts +13 -0
- package/dist/mcp/builtin_server.d.ts.map +1 -0
- package/dist/mcp/builtin_server.js +65 -0
- package/dist/store/json.d.ts +1 -0
- package/dist/store/json.d.ts.map +1 -1
- package/dist/store/json.js +15 -0
- package/dist/tui/agents.js +36 -14
- package/dist/webview/standalone.js +1511 -1068
- package/dist/webview/standalone.js.map +4 -4
- package/package.json +8 -3
- package/dist/mcp/task_server.d.ts +0 -9
- package/dist/mcp/task_server.d.ts.map +0 -1
- package/dist/mcp/task_server.js +0 -48
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builtin_server.d.ts","sourceRoot":"","sources":["../../src/mcp/builtin_server.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAGnE,OAAO,KAAK,EAAE,IAAI,EAAe,MAAM,2BAA2B,CAAC;AACnE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,eAAO,MAAM,WAAW,gBAAgB,CAAC;AACzC,eAAO,MAAM,YAAY,iBAAiB,CAAC;AAQ3C,wBAAgB,eAAe,IAAI,IAAI,EAAE,CAExC;AAED,wBAAgB,qBAAqB,CACnC,IAAI,GAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAiD,EACtF,IAAI,GAAE;IAAE,WAAW,CAAC,EAAE,WAAW,CAAA;CAAO,GACvC,MAAM,CAoCR"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
// Shared builder: wraps the built-in `mcp__<ns>__*` registry tools as an MCP
|
|
2
|
+
// Server. Used by BOTH the per-task HTTP bridge (cli/web/mcp_bridge.ts) and the
|
|
3
|
+
// general stdio subcommand (cli/mcp.ts) so this surface has one definition and
|
|
4
|
+
// one wrapping. Two namespaces today — `task` (drive the autonomous task state
|
|
5
|
+
// machine) and `email` (send mail through a configured account); a new tool in
|
|
6
|
+
// either is picked up by both consumers through the prefix filter, never a
|
|
7
|
+
// second allowlist.
|
|
8
|
+
//
|
|
9
|
+
// The tools are context-free (they take task_id / account by argument), so a
|
|
10
|
+
// stub ToolContext is sufficient — except for the caller's identity, which the
|
|
11
|
+
// email tools use to scope which accounts exist for this agent. The HTTP bridge
|
|
12
|
+
// passes it (resolved from the per-run token); the stdio server does not have
|
|
13
|
+
// one and is unscoped by design, its trust boundary being local process access
|
|
14
|
+
// to CARETAKER_HOME.
|
|
15
|
+
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
16
|
+
import { ListToolsRequestSchema, CallToolRequestSchema } from '@modelcontextprotocol/sdk/types.js';
|
|
17
|
+
import { tools as registry } from '../harness/tools/instance.js';
|
|
18
|
+
export const TASK_PREFIX = 'mcp__task__';
|
|
19
|
+
export const EMAIL_PREFIX = 'mcp__email__';
|
|
20
|
+
const SERVED_PREFIXES = [TASK_PREFIX, EMAIL_PREFIX];
|
|
21
|
+
/** `mcp__task__task_complete` → `task_complete`, `mcp__email__email_send` → `email_send`. */
|
|
22
|
+
function externalName(name) {
|
|
23
|
+
return name.replace(/^mcp__[a-z]+__/, '');
|
|
24
|
+
}
|
|
25
|
+
export function builtinMcpTools() {
|
|
26
|
+
return registry.list().filter((t) => SERVED_PREFIXES.some((p) => t.name.startsWith(p)));
|
|
27
|
+
}
|
|
28
|
+
export function buildBuiltinMcpServer(info = { name: 'caretaker-task', version: '0.0.0' }, opts = {}) {
|
|
29
|
+
const server = new Server(info, { capabilities: { tools: {} } });
|
|
30
|
+
server.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
31
|
+
tools: builtinMcpTools().map((t) => ({
|
|
32
|
+
name: externalName(t.name),
|
|
33
|
+
description: t.description,
|
|
34
|
+
inputSchema: t.parameters,
|
|
35
|
+
})),
|
|
36
|
+
}));
|
|
37
|
+
server.setRequestHandler(CallToolRequestSchema, async (req) => {
|
|
38
|
+
const tool = builtinMcpTools().find((t) => externalName(t.name) === req.params.name);
|
|
39
|
+
if (!tool) {
|
|
40
|
+
return {
|
|
41
|
+
content: [{ type: 'text', text: `Error: unknown tool "${req.params.name}"` }],
|
|
42
|
+
isError: true,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
// ponytail: the task tools ignore ctx entirely; the email tools read only
|
|
46
|
+
// callerAgent. A stub covers the rest.
|
|
47
|
+
const ctx = {
|
|
48
|
+
workingDir: process.cwd(),
|
|
49
|
+
signal: new AbortController().signal,
|
|
50
|
+
readPaths: new Set(),
|
|
51
|
+
callerAgent: opts.callerAgent,
|
|
52
|
+
};
|
|
53
|
+
try {
|
|
54
|
+
const result = await tool.execute(req.params.arguments ?? {}, ctx);
|
|
55
|
+
return { content: [{ type: 'text', text: result.content }] };
|
|
56
|
+
}
|
|
57
|
+
catch (err) {
|
|
58
|
+
return {
|
|
59
|
+
content: [{ type: 'text', text: `Error: ${err?.message ?? String(err)}` }],
|
|
60
|
+
isError: true,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
return server;
|
|
65
|
+
}
|
package/dist/store/json.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { AgentConfig, CaretakerConfig, McpServersFile, PluginsFile } from '../types.js';
|
|
2
|
+
export { validateRepositoryUrl } from '../lib/repo_url.js';
|
|
2
3
|
export declare function dataDir(): string;
|
|
3
4
|
export declare function configPath(): string;
|
|
4
5
|
export declare function agentsPath(): string;
|
package/dist/store/json.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json.d.ts","sourceRoot":"","sources":["../../src/store/json.ts"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CAAC,CAAC,CAAC,CAO5E"}
|
package/dist/store/json.js
CHANGED
|
@@ -3,6 +3,10 @@ import { join } from 'node:path';
|
|
|
3
3
|
import { mkdir, readFile, writeFile, chmod, rename } from 'node:fs/promises';
|
|
4
4
|
import { existsSync } from 'node:fs';
|
|
5
5
|
import { encrypt, isEncrypted } from '../lib/encryption.js';
|
|
6
|
+
// Re-exported through the package's `./store` entry point so every surface that
|
|
7
|
+
// persists config (web server, VSCode extension) enforces the same rule on
|
|
8
|
+
// `projects[].repositoryUrl` before calling saveConfig.
|
|
9
|
+
export { validateRepositoryUrl } from '../lib/repo_url.js';
|
|
6
10
|
// Path accessors are resolved at call time, not import time, so test runs
|
|
7
11
|
// that share a process can switch CARETAKER_HOME between suites.
|
|
8
12
|
export function dataDir() {
|
|
@@ -86,6 +90,17 @@ export async function saveConfig(c) {
|
|
|
86
90
|
task.telegramBotToken = encrypt(task.telegramBotToken);
|
|
87
91
|
}
|
|
88
92
|
}
|
|
93
|
+
if (task.type === 'email' && task.imapPassword && !isEncrypted(task.imapPassword)) {
|
|
94
|
+
task.imapPassword = encrypt(task.imapPassword);
|
|
95
|
+
}
|
|
96
|
+
if (task.type === 'email' && task.smtpPassword && !isEncrypted(task.smtpPassword)) {
|
|
97
|
+
task.smtpPassword = encrypt(task.smtpPassword);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
for (const project of c.projects || []) {
|
|
102
|
+
if (project.repositoryToken && !isEncrypted(project.repositoryToken)) {
|
|
103
|
+
project.repositoryToken = encrypt(project.repositoryToken);
|
|
89
104
|
}
|
|
90
105
|
}
|
|
91
106
|
if (c.voice?.apiKey && !isEncrypted(c.voice.apiKey)) {
|
package/dist/tui/agents.js
CHANGED
|
@@ -252,6 +252,26 @@ const CLAUDE_CODE_PERMISSION_MODES = [
|
|
|
252
252
|
'dontAsk',
|
|
253
253
|
'plan',
|
|
254
254
|
];
|
|
255
|
+
const NAMESPACE_DESCRIPTIONS = {
|
|
256
|
+
mcp__task__: 'Manage autonomous tasks & checklists',
|
|
257
|
+
mcp__email__: 'List the configured email accounts and send mail',
|
|
258
|
+
};
|
|
259
|
+
/** The picker's tool list: one synthetic entry per `mcp__<ns>__` namespace in
|
|
260
|
+
* place of its individual tools, everything else as-is. */
|
|
261
|
+
function namespacedToolList(tools) {
|
|
262
|
+
const namespaces = [
|
|
263
|
+
...new Set(tools.map((t) => /^mcp__[a-z]+__/.exec(t.name)?.[0]).filter((p) => !!p)),
|
|
264
|
+
];
|
|
265
|
+
return [
|
|
266
|
+
...tools.filter((t) => !namespaces.some((p) => t.name.startsWith(p))),
|
|
267
|
+
...namespaces.map((p) => ({
|
|
268
|
+
name: `${p}*`,
|
|
269
|
+
description: `${NAMESPACE_DESCRIPTIONS[p] ?? p} (enables all ${p}* tools)`,
|
|
270
|
+
parameters: { type: 'object', properties: {} },
|
|
271
|
+
execute: async () => ({ content: '' }),
|
|
272
|
+
})),
|
|
273
|
+
];
|
|
274
|
+
}
|
|
255
275
|
// Computes the step sequence for a given form flavor, so claude-code's
|
|
256
276
|
// skip-tools/plugins/maxTurns + insert-permissionMode branching lives in one
|
|
257
277
|
// place instead of scattered across every transition.
|
|
@@ -283,12 +303,22 @@ function AgentForm({ providers, existingNames, initial, onSave, onCancel, }) {
|
|
|
283
303
|
const [systemPrompt, setSystemPrompt] = useState(initial?.systemPrompt ?? '');
|
|
284
304
|
const [permissionMode, setPermissionMode] = useState(initial?.permissionMode ?? '');
|
|
285
305
|
const [strictMcp, setStrictMcp] = useState(initial?.strictMcp ?? false);
|
|
306
|
+
// The picker offers one entry per `mcp__<ns>__` namespace (task, email, …),
|
|
307
|
+
// not the individual tools, so a stored per-tool selection is collapsed onto
|
|
308
|
+
// the wildcard. resolveAgentTools expands it back at run time.
|
|
286
309
|
const normalizeTools = (tools) => {
|
|
287
|
-
const
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
310
|
+
const wildcards = new Set();
|
|
311
|
+
const rest = tools.filter((t) => {
|
|
312
|
+
const ns = /^mcp__[a-z]+__/.exec(t);
|
|
313
|
+
if (!ns || t.endsWith('*'))
|
|
314
|
+
return !ns;
|
|
315
|
+
wildcards.add(`${ns[0]}*`);
|
|
316
|
+
return false;
|
|
317
|
+
});
|
|
318
|
+
for (const t of tools)
|
|
319
|
+
if (t.endsWith('*') && t.startsWith('mcp__'))
|
|
320
|
+
wildcards.add(t);
|
|
321
|
+
return [...rest, ...wildcards];
|
|
292
322
|
};
|
|
293
323
|
const [allowedTools, setAllowedTools] = useState(normalizeTools(initial?.allowedTools ?? []));
|
|
294
324
|
const [confirmTools, setConfirmTools] = useState(normalizeTools(initial?.confirmTools ?? []));
|
|
@@ -387,15 +417,7 @@ function AgentForm({ providers, existingNames, initial, onSave, onCancel, }) {
|
|
|
387
417
|
setModel(id);
|
|
388
418
|
setError(null);
|
|
389
419
|
setStep(nextAfter('model'));
|
|
390
|
-
} })) : ['name', 'provider'].includes(step) ? (_jsx(Text, { dimColor: true, children: "(pending)" })) : (_jsx(Text, { children: model }))] }), _jsxs(Box, { children: [_jsx(Text, { children: "prompt: " }), managed ? (_jsxs(Text, { children: [_jsxs(Text, { children: [(systemPrompt || '(empty)').slice(0, 80), systemPrompt.length > 80 ? '…' : ''] }), _jsx(Text, { dimColor: true, children: ' (managed by plugin)' })] })) : step === 'systemPrompt' ? (_jsx(TextInput, { value: systemPrompt, onChange: setSystemPrompt, onSubmit: advance, placeholder: isEdit ? '(enter to keep current)' : '(optional system prompt)' })) : ['name', 'provider', 'model'].includes(step) ? (_jsx(Text, { dimColor: true, children: "(pending)" })) : (_jsx(Text, { children: systemPrompt || '(empty)' }))] }), !isClaudeCode && (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { children: "tools:" }), step === 'tools' ? (_jsx(ToolPicker, { tools:
|
|
391
|
-
...toolRegistry.list().filter((t) => !t.name.startsWith('mcp__task__')),
|
|
392
|
-
{
|
|
393
|
-
name: 'mcp__task__*',
|
|
394
|
-
description: 'Manage autonomous tasks & checklists (enables all mcp__task__* tools)',
|
|
395
|
-
parameters: { type: 'object', properties: {} },
|
|
396
|
-
execute: async () => ({ content: '' }),
|
|
397
|
-
},
|
|
398
|
-
], allowed: allowedTools, confirm: confirmTools, onChange: (a, c) => {
|
|
420
|
+
} })) : ['name', 'provider'].includes(step) ? (_jsx(Text, { dimColor: true, children: "(pending)" })) : (_jsx(Text, { children: model }))] }), _jsxs(Box, { children: [_jsx(Text, { children: "prompt: " }), managed ? (_jsxs(Text, { children: [_jsxs(Text, { children: [(systemPrompt || '(empty)').slice(0, 80), systemPrompt.length > 80 ? '…' : ''] }), _jsx(Text, { dimColor: true, children: ' (managed by plugin)' })] })) : step === 'systemPrompt' ? (_jsx(TextInput, { value: systemPrompt, onChange: setSystemPrompt, onSubmit: advance, placeholder: isEdit ? '(enter to keep current)' : '(optional system prompt)' })) : ['name', 'provider', 'model'].includes(step) ? (_jsx(Text, { dimColor: true, children: "(pending)" })) : (_jsx(Text, { children: systemPrompt || '(empty)' }))] }), !isClaudeCode && (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { children: "tools:" }), step === 'tools' ? (_jsx(ToolPicker, { tools: namespacedToolList(toolRegistry.list()), allowed: allowedTools, confirm: confirmTools, onChange: (a, c) => {
|
|
399
421
|
setAllowedTools(a);
|
|
400
422
|
setConfirmTools(c);
|
|
401
423
|
}, onSubmit: advance })) : ['name', 'provider', 'model', 'systemPrompt'].includes(step) ? (_jsx(Text, { dimColor: true, children: " (pending)" })) : (_jsx(Text, { children: ` ${allowedTools.length === 0 ? '(none)' : formatToolsForDetail(allowedTools, confirmTools)}` }))] })), !isClaudeCode && (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { children: "plugins:" }), step === 'plugins' ? (_jsx(PluginPicker, { plugins: discoveredPlugins, value: activePlugins, onChange: setActivePlugins, onSubmit: advance })) : ['name', 'provider', 'model', 'systemPrompt', 'tools'].includes(step) ? (_jsx(Text, { dimColor: true, children: " (pending)" })) : (_jsx(Text, { children: ` ${activePlugins.length === 0 ? '(none)' : activePlugins.join(', ')}` }))] })), _jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { children: "mcp:" }), step === 'mcpServers' ? (_jsx(McpPicker, { servers: mcpServers, value: activeMcp, onChange: setActiveMcp, onSubmit: advance })) : ['name', 'provider', 'model', 'systemPrompt', 'tools', 'plugins'].includes(step) ? (_jsx(Text, { dimColor: true, children: " (pending)" })) : (_jsx(Text, { children: ` ${activeMcp.length === 0
|