@leverageaiapps/locus 2.2.1 → 2.2.3
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/agent/agent-loop.d.ts +19 -0
- package/dist/agent/agent-loop.d.ts.map +1 -0
- package/dist/agent/agent-loop.js +936 -0
- package/dist/agent/agent-loop.js.map +1 -0
- package/dist/agent/claude-client.d.ts +48 -0
- package/dist/agent/claude-client.d.ts.map +1 -0
- package/dist/agent/claude-client.js +341 -0
- package/dist/agent/claude-client.js.map +1 -0
- package/dist/agent/compaction.d.ts +31 -0
- package/dist/agent/compaction.d.ts.map +1 -0
- package/dist/agent/compaction.js +295 -0
- package/dist/agent/compaction.js.map +1 -0
- package/dist/agent/local-tools.d.ts +21 -0
- package/dist/agent/local-tools.d.ts.map +1 -0
- package/dist/agent/local-tools.js +130 -0
- package/dist/agent/local-tools.js.map +1 -0
- package/dist/agent/tool-defs.d.ts +17 -0
- package/dist/agent/tool-defs.d.ts.map +1 -0
- package/dist/agent/tool-defs.js +217 -0
- package/dist/agent/tool-defs.js.map +1 -0
- package/dist/agent/types.d.ts +80 -0
- package/dist/agent/types.d.ts.map +1 -0
- package/dist/agent/types.js +9 -0
- package/dist/agent/types.js.map +1 -0
- package/dist/agent/worker-proxy.d.ts +39 -0
- package/dist/agent/worker-proxy.d.ts.map +1 -0
- package/dist/agent/worker-proxy.js +135 -0
- package/dist/agent/worker-proxy.js.map +1 -0
- package/dist/vortex-tunnel.d.ts.map +1 -1
- package/dist/vortex-tunnel.js +119 -18
- package/dist/vortex-tunnel.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Tool Definitions for PC Agent — adapted from container-agent/src/tool-defs.ts
|
|
4
|
+
*
|
|
5
|
+
* Differences from sandbox tools:
|
|
6
|
+
* - Removed: browser_action (no browser automation on Mac)
|
|
7
|
+
* - Removed: request_human_help (no VNC desktop)
|
|
8
|
+
* - Updated descriptions: "user's computer" instead of "sandbox"
|
|
9
|
+
*/
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.WEB_FETCH_SERVER_TOOL = exports.WEB_SEARCH_SERVER_TOOL = exports.PC_TOOLS = void 0;
|
|
12
|
+
exports.buildToolList = buildToolList;
|
|
13
|
+
// ─── Client-Side Tools (executed locally on user's Mac) ───────────
|
|
14
|
+
exports.PC_TOOLS = [
|
|
15
|
+
{
|
|
16
|
+
name: 'bash',
|
|
17
|
+
description: "Execute a bash command on the user's computer terminal. Has full access to installed tools, packages, and the filesystem.",
|
|
18
|
+
input_schema: {
|
|
19
|
+
type: 'object',
|
|
20
|
+
properties: {
|
|
21
|
+
command: { type: 'string', description: 'The bash command to execute' },
|
|
22
|
+
},
|
|
23
|
+
required: ['command'],
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
name: 'write_file',
|
|
28
|
+
description: 'Write content to a file (create or overwrite). Prefer this over bash heredoc/echo for reliability.',
|
|
29
|
+
input_schema: {
|
|
30
|
+
type: 'object',
|
|
31
|
+
properties: {
|
|
32
|
+
path: { type: 'string', description: 'Absolute file path (e.g., /Users/username/Desktop/report.html)' },
|
|
33
|
+
content: { type: 'string', description: 'The complete file content to write' },
|
|
34
|
+
},
|
|
35
|
+
required: ['path', 'content'],
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
name: 'read_file',
|
|
40
|
+
description: 'Read the contents of a file.',
|
|
41
|
+
input_schema: {
|
|
42
|
+
type: 'object',
|
|
43
|
+
properties: {
|
|
44
|
+
path: { type: 'string', description: 'Absolute file path to read' },
|
|
45
|
+
},
|
|
46
|
+
required: ['path'],
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
name: 'show_file',
|
|
51
|
+
description: "Send a file to the user's phone for preview/download.",
|
|
52
|
+
input_schema: {
|
|
53
|
+
type: 'object',
|
|
54
|
+
properties: {
|
|
55
|
+
path: { type: 'string', description: 'Absolute file path to show' },
|
|
56
|
+
},
|
|
57
|
+
required: ['path'],
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
name: 'search_files',
|
|
62
|
+
description: 'Search for files by name or pattern in a directory.',
|
|
63
|
+
input_schema: {
|
|
64
|
+
type: 'object',
|
|
65
|
+
properties: {
|
|
66
|
+
directory: { type: 'string', description: 'Directory to search in' },
|
|
67
|
+
pattern: { type: 'string', description: 'File name pattern (glob or regex)' },
|
|
68
|
+
},
|
|
69
|
+
required: ['directory', 'pattern'],
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
// ── Memory Tools ──
|
|
73
|
+
{
|
|
74
|
+
name: 'save_memory',
|
|
75
|
+
description: "Save information to today's daily memory log (memory/YYYY-MM-DD.md). Use for user preferences, project details, decisions, or any info that should persist.",
|
|
76
|
+
input_schema: {
|
|
77
|
+
type: 'object',
|
|
78
|
+
properties: {
|
|
79
|
+
content: { type: 'string', description: 'The information to save' },
|
|
80
|
+
category: { type: 'string', description: 'Memory category: "preference", "project", "workflow", "decision", "person", "general"' },
|
|
81
|
+
section: { type: 'string', description: 'Alias for category (backward compatible)' },
|
|
82
|
+
},
|
|
83
|
+
required: ['content'],
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
name: 'search_memory',
|
|
88
|
+
description: 'Search long-term memory (MEMORY.md) and daily logs by keyword matching. Returns snippets with file:line references.',
|
|
89
|
+
input_schema: {
|
|
90
|
+
type: 'object',
|
|
91
|
+
properties: {
|
|
92
|
+
query: { type: 'string', description: 'Search query (keywords)' },
|
|
93
|
+
category: { type: 'string', description: 'Optional: limit search to a specific category' },
|
|
94
|
+
max_results: { type: 'number', description: 'Max results to return (default: 5, max: 10)' },
|
|
95
|
+
},
|
|
96
|
+
required: ['query'],
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
name: 'read_memory',
|
|
101
|
+
description: 'Read a specific section of a memory file. Use after search_memory to get full context.',
|
|
102
|
+
input_schema: {
|
|
103
|
+
type: 'object',
|
|
104
|
+
properties: {
|
|
105
|
+
file: { type: 'string', description: 'File name: "MEMORY.md" or "2026-02-20.md"' },
|
|
106
|
+
from_line: { type: 'number', description: 'Starting line number (1-indexed, default: 1)' },
|
|
107
|
+
lines: { type: 'number', description: 'Number of lines to read (default: 50, max: 200)' },
|
|
108
|
+
},
|
|
109
|
+
required: ['file'],
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
name: 'update_memory',
|
|
114
|
+
description: 'Rewrite the curated long-term memory file (MEMORY.md). Provide the COMPLETE new content.',
|
|
115
|
+
input_schema: {
|
|
116
|
+
type: 'object',
|
|
117
|
+
properties: {
|
|
118
|
+
content: { type: 'string', description: 'Complete new content for MEMORY.md (replaces entire file)' },
|
|
119
|
+
},
|
|
120
|
+
required: ['content'],
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
// ── Schedule Tool ──
|
|
124
|
+
{
|
|
125
|
+
name: 'manage_schedule',
|
|
126
|
+
description: 'Manage scheduled tasks (create, list, update, delete, pause, resume).',
|
|
127
|
+
input_schema: {
|
|
128
|
+
type: 'object',
|
|
129
|
+
properties: {
|
|
130
|
+
action: { type: 'string', enum: ['create', 'list', 'update', 'delete', 'pause', 'resume'] },
|
|
131
|
+
job_id: { type: 'string', description: 'Job ID (for update/delete/pause/resume)' },
|
|
132
|
+
name: { type: 'string', description: 'Task name (for create)' },
|
|
133
|
+
schedule: { type: 'string', description: 'Cron expression or natural language (for create)' },
|
|
134
|
+
command: { type: 'string', description: 'Task instruction for the AI agent (for create)' },
|
|
135
|
+
notify: { type: 'boolean', description: 'Notify user on completion (default: true)' },
|
|
136
|
+
},
|
|
137
|
+
required: ['action'],
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
// ── Skill Tools ──
|
|
141
|
+
{
|
|
142
|
+
name: 'get_skill',
|
|
143
|
+
description: "Load detailed instructions for a specific skill. Call only when the user's task matches an available skill.",
|
|
144
|
+
input_schema: {
|
|
145
|
+
type: 'object',
|
|
146
|
+
properties: {
|
|
147
|
+
skill_id: { type: 'string', description: 'The skill_id to load' },
|
|
148
|
+
},
|
|
149
|
+
required: ['skill_id'],
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
name: 'create_skill',
|
|
154
|
+
description: 'Create a new custom skill.',
|
|
155
|
+
input_schema: {
|
|
156
|
+
type: 'object',
|
|
157
|
+
properties: {
|
|
158
|
+
skill_id: { type: 'string', description: 'Unique identifier (lowercase, hyphens)' },
|
|
159
|
+
name: { type: 'string', description: 'Human-readable skill name' },
|
|
160
|
+
description: { type: 'string', description: 'What this skill does' },
|
|
161
|
+
full_prompt: { type: 'string', description: 'Detailed AI instructions' },
|
|
162
|
+
category: { type: 'string', enum: ['productivity', 'development', 'system', 'lifestyle', 'custom'] },
|
|
163
|
+
},
|
|
164
|
+
required: ['skill_id', 'name', 'full_prompt'],
|
|
165
|
+
},
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
name: 'upload_skill_resource',
|
|
169
|
+
description: 'Upload a resource file (script, template, etc.) for a skill.',
|
|
170
|
+
input_schema: {
|
|
171
|
+
type: 'object',
|
|
172
|
+
properties: {
|
|
173
|
+
skill_id: { type: 'string', description: 'Which skill this resource belongs to' },
|
|
174
|
+
filename: { type: 'string', description: 'Resource filename' },
|
|
175
|
+
content: { type: 'string', description: 'File content (text)' },
|
|
176
|
+
content_type: { type: 'string', description: 'MIME type (default: text/plain)' },
|
|
177
|
+
},
|
|
178
|
+
required: ['skill_id', 'filename', 'content'],
|
|
179
|
+
},
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
name: 'install_skill',
|
|
183
|
+
description: 'Install a skill from a URL (e.g., clawhub.ai/user/skill-name).',
|
|
184
|
+
input_schema: {
|
|
185
|
+
type: 'object',
|
|
186
|
+
properties: {
|
|
187
|
+
url: { type: 'string', description: 'URL to install the skill from' },
|
|
188
|
+
skill_id: { type: 'string', description: 'Override skill_id (optional)' },
|
|
189
|
+
},
|
|
190
|
+
required: ['url'],
|
|
191
|
+
},
|
|
192
|
+
},
|
|
193
|
+
];
|
|
194
|
+
// ─── Server-Side Tools (executed by Anthropic API) ────────────────
|
|
195
|
+
exports.WEB_SEARCH_SERVER_TOOL = {
|
|
196
|
+
type: 'web_search_20250305',
|
|
197
|
+
name: 'web_search',
|
|
198
|
+
max_uses: 5,
|
|
199
|
+
};
|
|
200
|
+
exports.WEB_FETCH_SERVER_TOOL = {
|
|
201
|
+
type: 'web_fetch_20250910',
|
|
202
|
+
name: 'web_fetch',
|
|
203
|
+
max_uses: 5,
|
|
204
|
+
};
|
|
205
|
+
/**
|
|
206
|
+
* Build the full tools array, excluding specified tool names.
|
|
207
|
+
*/
|
|
208
|
+
function buildToolList(excludeTools = []) {
|
|
209
|
+
const excludeSet = new Set(excludeTools);
|
|
210
|
+
const clientTools = exports.PC_TOOLS.filter(t => !excludeSet.has(t.name));
|
|
211
|
+
return [
|
|
212
|
+
...clientTools,
|
|
213
|
+
exports.WEB_SEARCH_SERVER_TOOL,
|
|
214
|
+
exports.WEB_FETCH_SERVER_TOOL,
|
|
215
|
+
];
|
|
216
|
+
}
|
|
217
|
+
//# sourceMappingURL=tool-defs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-defs.js","sourceRoot":"","sources":["../../src/agent/tool-defs.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;AA4MH,sCAQC;AAhND,qEAAqE;AAExD,QAAA,QAAQ,GAAW;IAC9B;QACE,IAAI,EAAE,MAAM;QACZ,WAAW,EAAE,2HAA2H;QACxI,YAAY,EAAE;YACZ,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,6BAA6B,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AG,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,+BAA+B,EAAE;gBACrE,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,8BAA8B,EAAE;aAC1E;YACD,QAAQ,EAAE,CAAC,KAAK,CAAC;SAClB;KACF;CACF,CAAC;AAEF,qEAAqE;AAExD,QAAA,sBAAsB,GAAS;IAC1C,IAAI,EAAE,qBAAqB;IAC3B,IAAI,EAAE,YAAY;IAClB,QAAQ,EAAE,CAAC;CACZ,CAAC;AAEW,QAAA,qBAAqB,GAAS;IACzC,IAAI,EAAE,oBAAoB;IAC1B,IAAI,EAAE,WAAW;IACjB,QAAQ,EAAE,CAAC;CACZ,CAAC;AAEF;;GAEG;AACH,SAAgB,aAAa,CAAC,eAAyB,EAAE;IACvD,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,YAAY,CAAC,CAAC;IACzC,MAAM,WAAW,GAAG,gBAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;IAClE,OAAO;QACL,GAAG,WAAW;QACd,8BAAsB;QACtB,6BAAqB;KACtB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
export interface Message {
|
|
2
|
+
role: 'user' | 'assistant';
|
|
3
|
+
content: string | ContentBlock[];
|
|
4
|
+
}
|
|
5
|
+
export interface ContentBlock {
|
|
6
|
+
type: string;
|
|
7
|
+
text?: string;
|
|
8
|
+
id?: string;
|
|
9
|
+
name?: string;
|
|
10
|
+
input?: Record<string, any>;
|
|
11
|
+
tool_use_id?: string;
|
|
12
|
+
content?: string | ContentBlock[];
|
|
13
|
+
is_error?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export interface ToolResult {
|
|
16
|
+
type: 'tool_result';
|
|
17
|
+
tool_use_id: string;
|
|
18
|
+
content: string;
|
|
19
|
+
is_error?: boolean;
|
|
20
|
+
}
|
|
21
|
+
export interface ChatResponse {
|
|
22
|
+
content: ContentBlock[];
|
|
23
|
+
stop_reason: string;
|
|
24
|
+
usage: {
|
|
25
|
+
input_tokens: number;
|
|
26
|
+
output_tokens: number;
|
|
27
|
+
};
|
|
28
|
+
model: string;
|
|
29
|
+
}
|
|
30
|
+
export interface ToolDef {
|
|
31
|
+
name: string;
|
|
32
|
+
description: string;
|
|
33
|
+
input_schema: Record<string, any>;
|
|
34
|
+
}
|
|
35
|
+
export interface ServerTool {
|
|
36
|
+
type: string;
|
|
37
|
+
name: string;
|
|
38
|
+
[key: string]: any;
|
|
39
|
+
}
|
|
40
|
+
export interface AgentRunRequest {
|
|
41
|
+
taskId: string;
|
|
42
|
+
userId: string;
|
|
43
|
+
sandboxId: string;
|
|
44
|
+
message: string;
|
|
45
|
+
images?: string[];
|
|
46
|
+
model?: string;
|
|
47
|
+
sessionId: string;
|
|
48
|
+
workerUrl: string;
|
|
49
|
+
token: string;
|
|
50
|
+
enableContext?: boolean;
|
|
51
|
+
workingDirectory?: string;
|
|
52
|
+
connectionId?: string;
|
|
53
|
+
cronJobId?: string;
|
|
54
|
+
cronRunId?: string;
|
|
55
|
+
}
|
|
56
|
+
export interface EmitEventPayload {
|
|
57
|
+
taskId: string;
|
|
58
|
+
userId: string;
|
|
59
|
+
conversationId: string;
|
|
60
|
+
sequence: number;
|
|
61
|
+
eventType: string;
|
|
62
|
+
data: Record<string, any>;
|
|
63
|
+
}
|
|
64
|
+
export interface ContextResponse {
|
|
65
|
+
conversationHistory: Message[];
|
|
66
|
+
systemPrompt: string;
|
|
67
|
+
enabledSkills: {
|
|
68
|
+
skill_id: string;
|
|
69
|
+
name: string;
|
|
70
|
+
}[];
|
|
71
|
+
hasSkills: boolean;
|
|
72
|
+
}
|
|
73
|
+
export interface ToolExecResult {
|
|
74
|
+
output: string;
|
|
75
|
+
isError: boolean;
|
|
76
|
+
}
|
|
77
|
+
export declare const MAX_AGENT_TURNS = 50;
|
|
78
|
+
export declare const LOOP_TIMEOUT: number;
|
|
79
|
+
export declare const TOOL_OUTPUT_LIMIT = 10000;
|
|
80
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/agent/types.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC;IAC3B,OAAO,EAAE,MAAM,GAAG,YAAY,EAAE,CAAC;CAClC;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAE5B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,GAAG,YAAY,EAAE,CAAC;IAClC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,aAAa,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE;QAAE,YAAY,EAAE,MAAM,CAAC;QAAC,aAAa,EAAE,MAAM,CAAA;KAAE,CAAC;IACvD,KAAK,EAAE,MAAM,CAAC;CACf;AAID,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CACnC;AAED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AAO,MAAM,YAAY,QAAiB,CAAC;AAC3C,eAAO,MAAM,iBAAiB,QAAQ,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// ─── Shared Types ────────────────────────────────────────────────
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.TOOL_OUTPUT_LIMIT = exports.LOOP_TIMEOUT = exports.MAX_AGENT_TURNS = void 0;
|
|
5
|
+
// ─── Constants ───────────────────────────────────────────────────
|
|
6
|
+
exports.MAX_AGENT_TURNS = 50;
|
|
7
|
+
exports.LOOP_TIMEOUT = 10 * 60 * 1000; // 10 minutes
|
|
8
|
+
exports.TOOL_OUTPUT_LIMIT = 10000; // chars
|
|
9
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/agent/types.ts"],"names":[],"mappings":";AAAA,oEAAoE;;;AA0FpE,oEAAoE;AAEvD,QAAA,eAAe,GAAG,EAAE,CAAC;AACrB,QAAA,YAAY,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,aAAa;AAC5C,QAAA,iBAAiB,GAAG,KAAK,CAAC,CAAC,QAAQ"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Worker Proxy Client — Locus agent calls back to the Worker
|
|
3
|
+
* for D1/R2 operations, event emission, and Claude API calls.
|
|
4
|
+
*
|
|
5
|
+
* Claude API calls are proxied through the Worker so API keys
|
|
6
|
+
* never leave Cloudflare (keys stay in Worker env secrets).
|
|
7
|
+
*/
|
|
8
|
+
import type { Message, ChatResponse, EmitEventPayload, ContextResponse } from './types';
|
|
9
|
+
export declare class WorkerProxy {
|
|
10
|
+
private workerUrl;
|
|
11
|
+
private token;
|
|
12
|
+
private taskId;
|
|
13
|
+
private userId;
|
|
14
|
+
constructor(workerUrl: string, token: string, taskId: string, userId: string);
|
|
15
|
+
private post;
|
|
16
|
+
emitEvents(events: EmitEventPayload[]): Promise<void>;
|
|
17
|
+
updateTaskStatus(status: 'running' | 'completed' | 'failed', errorMessage?: string): Promise<void>;
|
|
18
|
+
finalizeCronRun(cronRunId: string, cronJobId: string, sandboxId: string, status: 'completed' | 'failed', output?: string, error?: string): Promise<void>;
|
|
19
|
+
loadContext(sandboxId: string, sessionId: string, isCronTask: boolean, memoryContent?: string, recentNotes?: string, workingDirectory?: string): Promise<ContextResponse>;
|
|
20
|
+
saveTurn(sandboxId: string, sessionId: string, userMessage: string, assistantSummary: string): Promise<void>;
|
|
21
|
+
memoryOp(tool: 'backup_memory' | 'restore_memory', filePath: string, content?: string): Promise<string>;
|
|
22
|
+
skillOp(tool: 'get_skill' | 'create_skill' | 'upload_skill_resource', input: Record<string, any>): Promise<string>;
|
|
23
|
+
scheduleOp(sandboxId: string, input: Record<string, any>): Promise<string>;
|
|
24
|
+
uploadToR2(sandboxId: string, filePath: string, contentBase64: string, fileSize: number): Promise<{
|
|
25
|
+
downloadUrl: string;
|
|
26
|
+
}>;
|
|
27
|
+
claudeChat(messages: Message[], options: {
|
|
28
|
+
model?: string;
|
|
29
|
+
maxTokens?: number;
|
|
30
|
+
temperature?: number;
|
|
31
|
+
systemPrompt?: string;
|
|
32
|
+
tools?: any[];
|
|
33
|
+
toolChoice?: {
|
|
34
|
+
type: string;
|
|
35
|
+
name?: string;
|
|
36
|
+
};
|
|
37
|
+
}): Promise<ChatResponse>;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=worker-proxy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worker-proxy.d.ts","sourceRoot":"","sources":["../../src/agent/worker-proxy.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EACV,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,eAAe,EACzD,MAAM,SAAS,CAAC;AAEjB,qBAAa,WAAW;IACtB,OAAO,C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GACzB,OAAO,CAAC,MAAM,CAAC;IAWZ,UAAU,CACd,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GACzB,OAAO,CAAC,MAAM,CAAC;IAWZ,UAAU,CACd,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,aAAa,EAAE,MAAM,EACrB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC;QAAE,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC;IAY7B,UAAU,CACd,QAAQ,EAAE,OAAO,EAAE,EACnB,OAAO,EAAE;QACP,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,KAAK,CAAC,EAAE,GAAG,EAAE,CAAC;QACd,UAAU,CAAC,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,IAAI,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC;KAC9C,GACA,OAAO,CAAC,YAAY,CAAC;CAWzB"}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Worker Proxy Client — Locus agent calls back to the Worker
|
|
4
|
+
* for D1/R2 operations, event emission, and Claude API calls.
|
|
5
|
+
*
|
|
6
|
+
* Claude API calls are proxied through the Worker so API keys
|
|
7
|
+
* never leave Cloudflare (keys stay in Worker env secrets).
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.WorkerProxy = void 0;
|
|
11
|
+
class WorkerProxy {
|
|
12
|
+
constructor(workerUrl, token, taskId, userId) {
|
|
13
|
+
// Remove trailing slash
|
|
14
|
+
this.workerUrl = workerUrl.replace(/\/$/, '');
|
|
15
|
+
this.token = token;
|
|
16
|
+
this.taskId = taskId;
|
|
17
|
+
this.userId = userId;
|
|
18
|
+
}
|
|
19
|
+
async post(path, body) {
|
|
20
|
+
const url = `${this.workerUrl}/api/internal/agent${path}`;
|
|
21
|
+
const res = await fetch(url, {
|
|
22
|
+
method: 'POST',
|
|
23
|
+
headers: {
|
|
24
|
+
'Content-Type': 'application/json',
|
|
25
|
+
'Authorization': `Bearer ${this.token}`,
|
|
26
|
+
'X-Task-Id': this.taskId,
|
|
27
|
+
'X-User-Id': this.userId,
|
|
28
|
+
},
|
|
29
|
+
body: JSON.stringify(body),
|
|
30
|
+
});
|
|
31
|
+
if (!res.ok) {
|
|
32
|
+
const errText = await res.text().catch(() => '');
|
|
33
|
+
throw new Error(`Worker proxy ${path} failed (${res.status}): ${errText}`);
|
|
34
|
+
}
|
|
35
|
+
return res.json();
|
|
36
|
+
}
|
|
37
|
+
// ─── Event Emission ───────────────────────────────────────────
|
|
38
|
+
async emitEvents(events) {
|
|
39
|
+
await this.post('/emit-events', { events });
|
|
40
|
+
}
|
|
41
|
+
// ─── Task Status ──────────────────────────────────────────────
|
|
42
|
+
async updateTaskStatus(status, errorMessage) {
|
|
43
|
+
await this.post('/task-status', {
|
|
44
|
+
taskId: this.taskId,
|
|
45
|
+
userId: this.userId,
|
|
46
|
+
status,
|
|
47
|
+
errorMessage,
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
// ─── Cron Finalization ───────────────────────────────────────
|
|
51
|
+
async finalizeCronRun(cronRunId, cronJobId, sandboxId, status, output = '', error) {
|
|
52
|
+
await this.post('/finalize-cron', {
|
|
53
|
+
cronRunId,
|
|
54
|
+
cronJobId,
|
|
55
|
+
sandboxId,
|
|
56
|
+
status,
|
|
57
|
+
output,
|
|
58
|
+
error,
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
// ─── Context Loading ──────────────────────────────────────────
|
|
62
|
+
async loadContext(sandboxId, sessionId, isCronTask, memoryContent, recentNotes, workingDirectory) {
|
|
63
|
+
return await this.post('/context', {
|
|
64
|
+
userId: this.userId,
|
|
65
|
+
sandboxId,
|
|
66
|
+
sessionId,
|
|
67
|
+
isCronTask,
|
|
68
|
+
memoryContent,
|
|
69
|
+
recentNotes,
|
|
70
|
+
workingDirectory,
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
// ─── Conversation History ─────────────────────────────────────
|
|
74
|
+
async saveTurn(sandboxId, sessionId, userMessage, assistantSummary) {
|
|
75
|
+
await this.post('/save-turn', {
|
|
76
|
+
userId: this.userId,
|
|
77
|
+
sandboxId,
|
|
78
|
+
sessionId,
|
|
79
|
+
userMessage,
|
|
80
|
+
assistantSummary,
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
// ─── Memory Tools (R2 backup) ─────────────────────────────────
|
|
84
|
+
async memoryOp(tool, filePath, content) {
|
|
85
|
+
const result = await this.post('/memory', {
|
|
86
|
+
userId: this.userId,
|
|
87
|
+
tool,
|
|
88
|
+
filePath,
|
|
89
|
+
content,
|
|
90
|
+
});
|
|
91
|
+
return result.output || '';
|
|
92
|
+
}
|
|
93
|
+
// ─── Skill Tools (D1 + R2) ────────────────────────────────────
|
|
94
|
+
async skillOp(tool, input) {
|
|
95
|
+
const result = await this.post('/skill', {
|
|
96
|
+
userId: this.userId,
|
|
97
|
+
tool,
|
|
98
|
+
input,
|
|
99
|
+
});
|
|
100
|
+
return result.output || '';
|
|
101
|
+
}
|
|
102
|
+
// ─── Schedule Tool (D1) ───────────────────────────────────────
|
|
103
|
+
async scheduleOp(sandboxId, input) {
|
|
104
|
+
const result = await this.post('/schedule', {
|
|
105
|
+
userId: this.userId,
|
|
106
|
+
sandboxId,
|
|
107
|
+
input,
|
|
108
|
+
});
|
|
109
|
+
return result.output || '';
|
|
110
|
+
}
|
|
111
|
+
// ─── R2 File Upload ───────────────────────────────────────────
|
|
112
|
+
async uploadToR2(sandboxId, filePath, contentBase64, fileSize) {
|
|
113
|
+
return await this.post('/r2-upload', {
|
|
114
|
+
userId: this.userId,
|
|
115
|
+
sandboxId,
|
|
116
|
+
filePath,
|
|
117
|
+
contentBase64,
|
|
118
|
+
fileSize,
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
// ─── Claude Chat Proxy (API keys stay on Cloudflare) ──────────
|
|
122
|
+
async claudeChat(messages, options) {
|
|
123
|
+
return await this.post('/claude-chat', {
|
|
124
|
+
messages: messages.map(m => ({ role: m.role, content: m.content })),
|
|
125
|
+
model: options.model,
|
|
126
|
+
maxTokens: options.maxTokens,
|
|
127
|
+
temperature: options.temperature,
|
|
128
|
+
systemPrompt: options.systemPrompt,
|
|
129
|
+
tools: options.tools,
|
|
130
|
+
toolChoice: options.toolChoice,
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
exports.WorkerProxy = WorkerProxy;
|
|
135
|
+
//# sourceMappingURL=worker-proxy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worker-proxy.js","sourceRoot":"","sources":["../../src/agent/worker-proxy.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAMH,MAAa,WAAW;IAMtB,YAAY,SAAiB,EAAE,KAAa,EAAE,MAAc,EAAE,MAAc;QAC1E,wBAAwB;QACxB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QAC9C,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAEO,KAAK,CAAC,IAAI,CAAC,IAAY,EAAE,IAAyB;QACxD,MAAM,GAAG,GAAG,GAAG,IAAI,CAAC,SAAS,sBAAsB,IAAI,EAAE,CAAC;QAC1D,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE;YAC3B,MAAM,EAAE,MAAM;YACd,OAAO,EAAE;gBACP,cAAc,EAAE,kBAAkB;gBAClC,eAAe,EAAE,UAAU,IAAI,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ACN,CAAC,CAAC;QACH,OAAO,MAAM,CAAC,MAAM,IAAI,EAAE,CAAC;IAC7B,CAAC;IAED,iEAAiE;IAEjE,KAAK,CAAC,UAAU,CACd,SAAiB,EACjB,QAAgB,EAChB,aAAqB,EACrB,QAAgB;QAEhB,OAAO,MAAM,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE;YACnC,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,SAAS;YACT,QAAQ;YACR,aAAa;YACb,QAAQ;SACT,CAAC,CAAC;IACL,CAAC;IAED,iEAAiE;IAEjE,KAAK,CAAC,UAAU,CACd,QAAmB,EACnB,OAOC;QAED,OAAO,MAAM,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE;YACrC,QAAQ,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;YACnE,KAAK,EAAE,OAAO,CAAC,KAAK;YACpB,SAAS,EAAE,OAAO,CAAC,SAAS;YAC5B,WAAW,EAAE,OAAO,CAAC,WAAW;YAChC,YAAY,EAAE,OAAO,CAAC,YAAY;YAClC,KAAK,EAAE,OAAO,CAAC,KAAK;YACpB,UAAU,EAAE,OAAO,CAAC,UAAU;SAC/B,CAAC,CAAC;IACL,CAAC;CACF;AAnMD,kCAmMC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vortex-tunnel.d.ts","sourceRoot":"","sources":["../src/vortex-tunnel.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"vortex-tunnel.d.ts","sourceRoot":"","sources":["../src/vortex-tunnel.ts"],"names":[],"mappings":"AAwEA;;;GAGG;AACH,wBAAgB,WAAW,CAAC,IAAI,GAAE,MAAa,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAkFlF;AA4pCD,wBAAgB,UAAU,IAAI,IAAI,CAgBjC;AAED,wBAAgB,YAAY,IAAI,MAAM,GAAG,IAAI,CAE5C;AAED,wBAAgB,eAAe,IAAI,OAAO,CAEzC"}
|