@leverageaiapps/locus-dev 2.0.1-dev → 2.0.1

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/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@leverageaiapps/locus-dev",
3
- "version": "2.0.1-dev",
3
+ "version": "2.0.1",
4
4
  "description": "Locus - Forward your terminal to your mobile device. Code anywhere from your pocket.",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
7
- "locus": "./dist/index.js"
7
+ "locus-dev": "./dist/index.js"
8
8
  },
9
9
  "scripts": {
10
10
  "build": "tsc",
@@ -1,67 +0,0 @@
1
- /**
2
- * AI Agent for Locus
3
- *
4
- * Handles Claude API calls and tool use loop for autonomous task execution.
5
- * This allows Locus to execute multi-step AI tasks independently of the iOS app.
6
- */
7
- export interface AIAgentConfig {
8
- apiKey: string;
9
- model?: string;
10
- maxTokens?: number;
11
- maxIterations?: number;
12
- }
13
- export interface AIAgentPayload {
14
- message: string;
15
- conversationHistory?: ConversationMessage[];
16
- systemPrompt?: string;
17
- customApiKey?: string;
18
- context?: any;
19
- }
20
- export interface ConversationMessage {
21
- role: 'user' | 'assistant';
22
- content: string | ContentBlock[];
23
- }
24
- export interface ContentBlock {
25
- type: 'text' | 'tool_use' | 'tool_result';
26
- text?: string;
27
- id?: string;
28
- name?: string;
29
- input?: any;
30
- tool_use_id?: string;
31
- content?: string;
32
- is_error?: boolean;
33
- }
34
- export interface AIAgentCallbacks {
35
- onTextDelta: (text: string) => void;
36
- onToolCall: (name: string, input: any) => void;
37
- onToolResult: (name: string, result: string, isError: boolean) => void;
38
- onComplete: (finalResponse: string) => void;
39
- onError: (error: string) => void;
40
- executeCommand: (command: string) => Promise<{
41
- output: string;
42
- exitCode: number;
43
- }>;
44
- readFile?: (path: string) => Promise<string>;
45
- writeFile?: (path: string, content: string) => Promise<void>;
46
- }
47
- export declare class AIAgent {
48
- private client;
49
- private model;
50
- private maxTokens;
51
- private maxIterations;
52
- private cancelled;
53
- constructor(config: AIAgentConfig);
54
- /**
55
- * Cancel the current execution
56
- */
57
- cancel(): void;
58
- /**
59
- * Execute an AI chat task with tool use loop
60
- */
61
- execute(payload: AIAgentPayload, callbacks: AIAgentCallbacks): Promise<string>;
62
- }
63
- /**
64
- * Get API key from various sources (priority order)
65
- */
66
- export declare function getApiKey(payloadKey?: string): string | null;
67
- //# sourceMappingURL=ai-agent.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ai-agent.d.ts","sourceRoot":"","sources":["../src/ai-agent.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAQH,MAAM,WAAW,aAAa;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,cAAc;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,mBAAmB,CAAC,EAAE,mBAAmB,EAAE,CAAC;IAC5C,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,GAAG,CAAC;CACjB;AAED,MAAM,WAAW,mBAAmB;IAChC,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC;IAC3B,OAAO,EAAE,MAAM,GAAG,YAAY,EAAE,CAAC;CACpC;AAED,MAAM,WAAW,YAAY;IACzB,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,aAAa,CAAC;IAC1C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;CAC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
1
- "use strict";
2
- /**
3
- * AI Agent for Locus
4
- *
5
- * Handles Claude API calls and tool use loop for autonomous task execution.
6
- * This allows Locus to execute multi-step AI tasks independently of the iOS app.
7
- */
8
- var __importDefault = (this && this.__importDefault) || function (mod) {
9
- return (mod && mod.__esModule) ? mod : { "default": mod };
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.AIAgent = void 0;
13
- exports.getApiKey = getApiKey;
14
- const sdk_1 = __importDefault(require("@anthropic-ai/sdk"));
15
- // ============================================================================
16
- // Tool Definitions
17
- // ============================================================================
18
- const TOOLS = [
19
- {
20
- name: 'bash',
21
- description: 'Execute a bash command on the user\'s computer. Use this to run shell commands, scripts, or interact with the file system. The command will be executed in the user\'s terminal.',
22
- input_schema: {
23
- type: 'object',
24
- properties: {
25
- command: {
26
- type: 'string',
27
- description: 'The bash command to execute'
28
- }
29
- },
30
- required: ['command']
31
- }
32
- },
33
- {
34
- name: 'read_file',
35
- description: 'Read the contents of a file at the specified path.',
36
- input_schema: {
37
- type: 'object',
38
- properties: {
39
- path: {
40
- type: 'string',
41
- description: 'The absolute path to the file to read'
42
- }
43
- },
44
- required: ['path']
45
- }
46
- },
47
- {
48
- name: 'write_file',
49
- description: 'Write content to a file at the specified path. Creates the file if it doesn\'t exist, overwrites if it does.',
50
- input_schema: {
51
- type: 'object',
52
- properties: {
53
- path: {
54
- type: 'string',
55
- description: 'The absolute path to the file to write'
56
- },
57
- content: {
58
- type: 'string',
59
- description: 'The content to write to the file'
60
- }
61
- },
62
- required: ['path', 'content']
63
- }
64
- }
65
- ];
66
- // ============================================================================
67
- // System Prompt
68
- // ============================================================================
69
- const DEFAULT_SYSTEM_PROMPT = `You are an AI assistant with access to the user's computer through a terminal connection. You can execute bash commands and interact with the file system to help the user accomplish tasks.
70
-
71
- ## Capabilities
72
- - Execute bash commands using the 'bash' tool
73
- - Read files using the 'read_file' tool
74
- - Write files using the 'write_file' tool
75
-
76
- ## Guidelines
77
- 1. Always explain what you're about to do before executing commands
78
- 2. For complex tasks, break them down into steps
79
- 3. Handle errors gracefully and explain what went wrong
80
- 4. Be careful with destructive operations (rm, overwriting files, etc.)
81
- 5. When working with files, prefer using absolute paths
82
- 6. For long-running commands, consider running them in the background
83
-
84
- ## Output Format
85
- - Provide clear, concise responses
86
- - Show relevant command output to the user
87
- - Summarize results after completing tasks
88
-
89
- Remember: You're running directly on the user's computer, so be careful and responsible with system operations.`;
90
- // ============================================================================
91
- // AI Agent Class
92
- // ============================================================================
93
- class AIAgent {
94
- constructor(config) {
95
- this.cancelled = false;
96
- this.client = new sdk_1.default({
97
- apiKey: config.apiKey
98
- });
99
- this.model = config.model || 'claude-sonnet-4-20250514';
100
- this.maxTokens = config.maxTokens || 8192;
101
- this.maxIterations = config.maxIterations || 50;
102
- }
103
- /**
104
- * Cancel the current execution
105
- */
106
- cancel() {
107
- this.cancelled = true;
108
- }
109
- /**
110
- * Execute an AI chat task with tool use loop
111
- */
112
- async execute(payload, callbacks) {
113
- this.cancelled = false;
114
- const systemPrompt = payload.systemPrompt || DEFAULT_SYSTEM_PROMPT;
115
- // Build initial messages
116
- const messages = [];
117
- // Add conversation history if provided
118
- if (payload.conversationHistory) {
119
- for (const msg of payload.conversationHistory) {
120
- messages.push({
121
- role: msg.role,
122
- content: msg.content
123
- });
124
- }
125
- }
126
- // Add the new user message
127
- messages.push({
128
- role: 'user',
129
- content: payload.message
130
- });
131
- let fullResponse = '';
132
- let iterations = 0;
133
- // Tool use loop
134
- while (iterations < this.maxIterations && !this.cancelled) {
135
- iterations++;
136
- console.log(` [AIAgent] Iteration ${iterations}/${this.maxIterations}`);
137
- try {
138
- // Call Claude API with streaming
139
- const response = await this.client.messages.create({
140
- model: this.model,
141
- max_tokens: this.maxTokens,
142
- system: systemPrompt,
143
- tools: TOOLS,
144
- messages: messages,
145
- stream: true
146
- });
147
- let currentTextContent = '';
148
- let toolUseBlocks = [];
149
- let currentToolUse = null;
150
- let stopReason = null;
151
- // Process streaming response
152
- for await (const event of response) {
153
- if (this.cancelled) {
154
- console.log(' [AIAgent] Cancelled');
155
- return fullResponse;
156
- }
157
- switch (event.type) {
158
- case 'content_block_start':
159
- if (event.content_block.type === 'tool_use') {
160
- currentToolUse = {
161
- id: event.content_block.id,
162
- name: event.content_block.name,
163
- inputJson: ''
164
- };
165
- }
166
- break;
167
- case 'content_block_delta':
168
- if (event.delta.type === 'text_delta') {
169
- currentTextContent += event.delta.text;
170
- fullResponse += event.delta.text;
171
- callbacks.onTextDelta(event.delta.text);
172
- }
173
- else if (event.delta.type === 'input_json_delta' && currentToolUse) {
174
- currentToolUse.inputJson += event.delta.partial_json;
175
- }
176
- break;
177
- case 'content_block_stop':
178
- if (currentToolUse) {
179
- try {
180
- const input = JSON.parse(currentToolUse.inputJson);
181
- toolUseBlocks.push({
182
- id: currentToolUse.id,
183
- name: currentToolUse.name,
184
- input
185
- });
186
- }
187
- catch (e) {
188
- console.error(' [AIAgent] Failed to parse tool input:', e);
189
- }
190
- currentToolUse = null;
191
- }
192
- break;
193
- case 'message_delta':
194
- stopReason = event.delta.stop_reason;
195
- break;
196
- }
197
- }
198
- // Build assistant message content for history
199
- const assistantContent = [];
200
- if (currentTextContent) {
201
- assistantContent.push({ type: 'text', text: currentTextContent });
202
- }
203
- for (const tool of toolUseBlocks) {
204
- assistantContent.push({
205
- type: 'tool_use',
206
- id: tool.id,
207
- name: tool.name,
208
- input: tool.input
209
- });
210
- }
211
- // Add assistant message to history
212
- messages.push({
213
- role: 'assistant',
214
- content: assistantContent
215
- });
216
- // Check if we need to execute tools
217
- if (stopReason === 'tool_use' && toolUseBlocks.length > 0) {
218
- const toolResults = [];
219
- for (const tool of toolUseBlocks) {
220
- callbacks.onToolCall(tool.name, tool.input);
221
- let result;
222
- let isError = false;
223
- try {
224
- switch (tool.name) {
225
- case 'bash':
226
- const cmdResult = await callbacks.executeCommand(tool.input.command);
227
- result = cmdResult.output;
228
- isError = cmdResult.exitCode !== 0;
229
- break;
230
- case 'read_file':
231
- if (callbacks.readFile) {
232
- result = await callbacks.readFile(tool.input.path);
233
- }
234
- else {
235
- // Fallback to bash cat
236
- const readResult = await callbacks.executeCommand(`cat "${tool.input.path}"`);
237
- result = readResult.output;
238
- isError = readResult.exitCode !== 0;
239
- }
240
- break;
241
- case 'write_file':
242
- if (callbacks.writeFile) {
243
- await callbacks.writeFile(tool.input.path, tool.input.content);
244
- result = `File written successfully: ${tool.input.path}`;
245
- }
246
- else {
247
- // Fallback to bash
248
- const escapedContent = tool.input.content.replace(/'/g, "'\\''");
249
- const writeResult = await callbacks.executeCommand(`cat > "${tool.input.path}" << 'LOCUS_EOF'\n${tool.input.content}\nLOCUS_EOF`);
250
- result = writeResult.exitCode === 0
251
- ? `File written successfully: ${tool.input.path}`
252
- : writeResult.output;
253
- isError = writeResult.exitCode !== 0;
254
- }
255
- break;
256
- default:
257
- result = `Unknown tool: ${tool.name}`;
258
- isError = true;
259
- }
260
- }
261
- catch (error) {
262
- result = `Error executing ${tool.name}: ${error.message}`;
263
- isError = true;
264
- }
265
- callbacks.onToolResult(tool.name, result, isError);
266
- toolResults.push({
267
- type: 'tool_result',
268
- tool_use_id: tool.id,
269
- content: result,
270
- is_error: isError
271
- });
272
- }
273
- // Add tool results to messages
274
- messages.push({
275
- role: 'user',
276
- content: toolResults
277
- });
278
- // Continue the loop to get Claude's response to tool results
279
- continue;
280
- }
281
- // No more tool calls, we're done
282
- callbacks.onComplete(fullResponse);
283
- return fullResponse;
284
- }
285
- catch (error) {
286
- console.error(' [AIAgent] Error:', error.message);
287
- callbacks.onError(error.message);
288
- throw error;
289
- }
290
- }
291
- if (this.cancelled) {
292
- return fullResponse;
293
- }
294
- // Max iterations reached
295
- const maxIterError = `Max iterations (${this.maxIterations}) reached`;
296
- callbacks.onError(maxIterError);
297
- throw new Error(maxIterError);
298
- }
299
- }
300
- exports.AIAgent = AIAgent;
301
- // ============================================================================
302
- // Helper: Get API Key
303
- // ============================================================================
304
- /**
305
- * Get API key from various sources (priority order)
306
- */
307
- function getApiKey(payloadKey) {
308
- // 1. Environment variable
309
- if (process.env.ANTHROPIC_API_KEY) {
310
- return process.env.ANTHROPIC_API_KEY;
311
- }
312
- // 2. Payload (from iOS app)
313
- if (payloadKey) {
314
- return payloadKey;
315
- }
316
- // 3. Local config file (TODO: implement)
317
- // const localKey = loadLocalConfig()?.apiKey;
318
- // if (localKey) return localKey;
319
- return null;
320
- }
321
- //# sourceMappingURL=ai-agent.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ai-agent.js","sourceRoot":"","sources":["../src/ai-agent.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;AAgYH,8BAgBC;AA9YD,4DAA0C;AAgD1C,+EAA+E;AAC/E,mBAAmB;AACnB,+EAA+E;AAE/E,MAAM,KAAK,GAAqB;IAC5B;QACI,IAAI,EAAE,MAAM;QACZ,WAAW,EAAE,kLAAkL;QAC/L,YAAY,EAAE;YACV,IAAI,EAAE,QAAiB;YACvB,UAAU,EAAE;gBACR,OAAO,EAAE;oBACL,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,6BAA6B;iBAC7C;aACJ;YACD,QAAQ,EAAE,CAAC,SAAS,CAAC;SACxB;KACJ;IACD;QACI,IAAI,EAAE,WAAW;QACjB,WAAW,EAAE,oDAAoD;QACjE,YAAY,EAAE;YACV,IAAI,EAAE,QAAiB;YACvB,UAAU,EAAE;gBACR,IAAI,EAAE;oBACF,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,uCAAuC;iBACvD;aACJ;YACD,QAAQ,EAAE,CAAC,MAAM,CAAC;SACrB;KACJ;IACD;QACI,IAAI,EAAE,YAAY;QAClB,WAAW,EAAE,8GAA8G;QAC3H,YAAY,EAAE;YACV,IAAI,EAAE,QAAiB;YACvB,UAAU,EAAE;gBACR,IAAI,EAAE;oBACF,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,wCAAwC;iBACxD;gBACD,OAAO,EAAE;oBACL,IAAI,EAAE,QAAQ;o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