@lasso-ai/cli 2.1.23 → 2.1.25

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.
Files changed (40) hide show
  1. package/dist/cli/auth.d.ts +2 -9
  2. package/dist/cli/bridge.d.ts +1 -290
  3. package/dist/cli/bridge.js +18 -0
  4. package/dist/cli/create.d.ts +2 -15
  5. package/dist/cli/project.d.ts +2 -42
  6. package/dist/cli/runtime-client.d.ts +15 -0
  7. package/dist/cli/runtime-client.js +13 -0
  8. package/dist/core/interfaces/agent-runtime.d.ts +308 -0
  9. package/dist/core/interfaces/agent-runtime.js +8 -0
  10. package/dist/core/interfaces/backend.d.ts +274 -0
  11. package/dist/core/interfaces/backend.js +38 -0
  12. package/dist/core/interfaces/data.d.ts +398 -0
  13. package/dist/core/interfaces/data.js +2 -0
  14. package/dist/core/interfaces/review.d.ts +12 -0
  15. package/dist/core/interfaces/review.js +2 -0
  16. package/dist/core/interfaces/session-runner.d.ts +27 -0
  17. package/dist/core/interfaces/session-runner.js +2 -0
  18. package/dist/core/interfaces/tool-protocol.d.ts +40 -0
  19. package/dist/core/interfaces/tool-protocol.js +13 -0
  20. package/dist/core/interfaces/types.d.ts +1 -0
  21. package/dist/core/interfaces/types.js +2 -0
  22. package/dist/core/interfaces/verification.d.ts +24 -0
  23. package/dist/core/interfaces/verification.js +2 -0
  24. package/dist/core/interfaces/workspace.d.ts +23 -0
  25. package/dist/core/interfaces/workspace.js +2 -0
  26. package/dist/overlay.js +2 -1
  27. package/dist/runtime/action-executor.d.ts +2 -11
  28. package/dist/runtime/action-executor.js +7 -0
  29. package/dist/runtime/agent-runtime.d.ts +2 -308
  30. package/dist/runtime/agent-runtime.js +16 -6
  31. package/dist/runtime/backend-interface.d.ts +2 -274
  32. package/dist/runtime/backend-interface.js +16 -36
  33. package/dist/runtime/local-session-runner.d.ts +3 -36
  34. package/dist/runtime/review.d.ts +2 -15
  35. package/dist/runtime/tool-protocol.d.ts +2 -40
  36. package/dist/runtime/tool-protocol.js +16 -11
  37. package/dist/runtime/verification-engine.d.ts +2 -27
  38. package/dist/runtime/verification-engine.js +6 -0
  39. package/dist/runtime/workspace-guard.d.ts +2 -23
  40. package/package.json +1 -1
@@ -0,0 +1,398 @@
1
+ export type CollabConfig = {
2
+ projectId: string;
3
+ name: string;
4
+ version?: string;
5
+ realtimeUrl: string;
6
+ apiUrl: string;
7
+ serverUrl: string;
8
+ registered: boolean;
9
+ registeredAt?: string;
10
+ claimed: boolean;
11
+ workspaceId?: string;
12
+ token?: string;
13
+ apiKey?: string;
14
+ plan?: string;
15
+ configuredProviders?: string[];
16
+ };
17
+ export type TimelineSnapshot = {
18
+ id: string;
19
+ taskId: string;
20
+ sessionId?: string;
21
+ summary: string;
22
+ files: Array<{
23
+ filePath: string;
24
+ content: string | null;
25
+ hash: string;
26
+ timestamp: string;
27
+ }>;
28
+ createdAt: string;
29
+ parentSnapshotId?: string;
30
+ };
31
+ export type Provider = "anthropic" | "openai" | "google" | "nvidia" | "ollama" | "claude_code" | "opencode" | "codex_cli" | "cursor";
32
+ export type GitState = {
33
+ isRepo: boolean;
34
+ branch?: string;
35
+ status?: string[];
36
+ hasChanges?: boolean;
37
+ hasRemote?: boolean;
38
+ remote?: string;
39
+ };
40
+ export type ModelOption = {
41
+ id: string;
42
+ label: string;
43
+ provider: Provider;
44
+ locked?: boolean;
45
+ lockedReason?: string;
46
+ };
47
+ export type PageEntry = {
48
+ name: string;
49
+ path: string;
50
+ type: "directory" | "file";
51
+ };
52
+ export type BridgeMessage = {
53
+ type: "hello";
54
+ from: "overlay" | "cli";
55
+ } | {
56
+ type: "edit";
57
+ taskId: string;
58
+ instruction: string;
59
+ model: string;
60
+ provider?: Provider;
61
+ messages?: Array<{
62
+ role: string;
63
+ content: string;
64
+ createdAt?: string;
65
+ }>;
66
+ conversation?: Array<{
67
+ role: "user" | "assistant" | "system";
68
+ content: string;
69
+ createdAt?: string;
70
+ }>;
71
+ changesHistory?: Array<{
72
+ summary: string;
73
+ changes: any[];
74
+ createdAt?: string;
75
+ }>;
76
+ context?: {
77
+ selectionId?: string;
78
+ position?: Record<string, number>;
79
+ viewport?: Record<string, unknown>;
80
+ styles?: Record<string, string>;
81
+ attributes?: Record<string, string>;
82
+ runtimeErrors?: string[];
83
+ screenshots?: {
84
+ full?: string;
85
+ element?: string;
86
+ };
87
+ };
88
+ element: {
89
+ tag: string;
90
+ group: string;
91
+ label: string;
92
+ html?: string;
93
+ sourceHint?: string;
94
+ };
95
+ } | {
96
+ type: "ask";
97
+ taskId: string;
98
+ question: string;
99
+ model: string;
100
+ provider?: Provider;
101
+ messages?: Array<{
102
+ role: string;
103
+ content: string;
104
+ createdAt?: string;
105
+ }>;
106
+ conversation?: Array<{
107
+ role: "user" | "assistant" | "system";
108
+ content: string;
109
+ createdAt?: string;
110
+ }>;
111
+ context?: {
112
+ selectionId?: string;
113
+ position?: Record<string, number>;
114
+ viewport?: Record<string, unknown>;
115
+ styles?: Record<string, string>;
116
+ attributes?: Record<string, string>;
117
+ runtimeErrors?: string[];
118
+ screenshots?: {
119
+ full?: string;
120
+ element?: string;
121
+ };
122
+ };
123
+ element: {
124
+ tag: string;
125
+ group: string;
126
+ label: string;
127
+ html?: string;
128
+ sourceHint?: string;
129
+ };
130
+ } | {
131
+ type: "runtime_error";
132
+ selectionId?: string;
133
+ details: string;
134
+ } | {
135
+ type: "apply";
136
+ taskId: string;
137
+ changes: any[];
138
+ } | {
139
+ type: "undo";
140
+ taskId?: string;
141
+ } | {
142
+ type: "stop";
143
+ taskId?: string;
144
+ } | {
145
+ type: "agent_prompt_response";
146
+ taskId: string;
147
+ response: string;
148
+ } | {
149
+ type: "steer";
150
+ taskId: string;
151
+ queueId: string;
152
+ prompt: string;
153
+ } | {
154
+ type: "list_page_folders";
155
+ path?: string;
156
+ } | {
157
+ type: "create_page";
158
+ folder: string;
159
+ fileName: string;
160
+ content: string;
161
+ } | {
162
+ type: "create_page_folder";
163
+ parent: string;
164
+ name: string;
165
+ } | {
166
+ type: "git_status";
167
+ } | {
168
+ type: "git_generate_message";
169
+ model: string;
170
+ provider?: Provider;
171
+ taskId?: string;
172
+ pageContext?: any;
173
+ } | {
174
+ type: "git_init";
175
+ } | {
176
+ type: "git_commit";
177
+ message: string;
178
+ } | {
179
+ type: "git_push";
180
+ } | {
181
+ type: "agent_status";
182
+ taskId?: string;
183
+ status: "thinking" | "working" | "review" | "error" | "stopped";
184
+ message: string;
185
+ } | {
186
+ type: "transcribe";
187
+ requestId: string;
188
+ audio: string;
189
+ mimeType?: string;
190
+ language?: string;
191
+ } | {
192
+ type: "oneshot";
193
+ prompt?: string;
194
+ scope?: "project" | "component";
195
+ model?: string;
196
+ provider?: Provider;
197
+ messages?: Array<{
198
+ role: "user" | "assistant";
199
+ content: string;
200
+ }>;
201
+ conversation?: Array<{
202
+ role: "user" | "assistant" | "system";
203
+ content: string;
204
+ timestamp?: number;
205
+ }>;
206
+ conversationId?: string;
207
+ taskId?: string;
208
+ } | {
209
+ type: "page_context_response";
210
+ requestId: string;
211
+ pageContext?: any;
212
+ error?: string;
213
+ } | {
214
+ type: "restore_snapshot";
215
+ snapshotId: string;
216
+ } | {
217
+ type: "get_timeline";
218
+ } | {
219
+ type: "delete_snapshot";
220
+ snapshotId: string;
221
+ } | {
222
+ type: "switch_model";
223
+ taskId: string;
224
+ provider: string;
225
+ modelId: string;
226
+ };
227
+ export type ServerBridgeMessage = {
228
+ type: "config";
229
+ apiKeyConfigured: boolean;
230
+ agentConfigured: boolean;
231
+ models: ModelOption[];
232
+ collab?: CollabConfig | null;
233
+ user?: {
234
+ name?: string;
235
+ email?: string;
236
+ } | null;
237
+ } | {
238
+ type: "git_state";
239
+ git: GitState;
240
+ } | {
241
+ type: "git_result";
242
+ message?: string;
243
+ error?: string;
244
+ } | {
245
+ type: "git_progress";
246
+ message: string;
247
+ } | {
248
+ type: "git_commit_message";
249
+ message?: string;
250
+ error?: string;
251
+ } | {
252
+ type: "agent_status";
253
+ taskId?: string;
254
+ status: "thinking" | "working" | "review" | "error" | "stopped";
255
+ message: string;
256
+ detail?: string;
257
+ changes?: any[];
258
+ thinking?: Array<{
259
+ title: string;
260
+ detail?: string;
261
+ durationMs?: number;
262
+ }>;
263
+ totalThinkingTimeMs?: number;
264
+ } | {
265
+ type: "agent_prompt";
266
+ taskId: string;
267
+ prompt: {
268
+ message: string;
269
+ kind: "permission" | "input" | "multiselect";
270
+ options?: string[];
271
+ };
272
+ } | {
273
+ type: "steer_result";
274
+ taskId: string;
275
+ queueId: string;
276
+ success: boolean;
277
+ error?: string;
278
+ } | {
279
+ type: "page_folders";
280
+ path: string;
281
+ entries: PageEntry[];
282
+ project?: string;
283
+ error?: string;
284
+ } | {
285
+ type: "page_created";
286
+ path: string;
287
+ error?: string;
288
+ } | {
289
+ type: "page_folder_created";
290
+ path: string;
291
+ error?: string;
292
+ } | {
293
+ type: "assistant_message";
294
+ taskId?: string;
295
+ message: string;
296
+ } | {
297
+ type: "applied";
298
+ taskId?: string;
299
+ message: string;
300
+ validation?: {
301
+ passed: boolean;
302
+ errors: string[];
303
+ command: string;
304
+ };
305
+ } | {
306
+ type: "undone";
307
+ taskId?: string;
308
+ message: string;
309
+ } | {
310
+ type: "transcribe_result";
311
+ requestId: string;
312
+ success: boolean;
313
+ text?: string;
314
+ provider?: string;
315
+ error?: string;
316
+ } | {
317
+ type: "timeline";
318
+ snapshots: TimelineSnapshot[];
319
+ };
320
+ export interface CliCredentials {
321
+ apiKey: string;
322
+ keyId: string;
323
+ workspaceId: string;
324
+ workspaceName: string;
325
+ userName: string;
326
+ userEmail: string;
327
+ createdAt: string;
328
+ }
329
+ export interface AuthStatusResponse {
330
+ status?: string;
331
+ message?: string;
332
+ apiKey?: string;
333
+ keyId?: string;
334
+ workspaceId?: string;
335
+ workspaceName?: string;
336
+ user?: {
337
+ name?: string;
338
+ email?: string;
339
+ };
340
+ }
341
+ export type ProjectFramework = "next" | "react" | "vue" | "svelte" | "solid";
342
+ export type Framework = ProjectFramework;
343
+ export type PackageManager = "pnpm" | "npm" | "yarn";
344
+ export interface CreateOptions {
345
+ name?: string;
346
+ framework?: ProjectFramework;
347
+ typescript?: boolean;
348
+ packageManager?: PackageManager;
349
+ prompt?: string;
350
+ }
351
+ export interface CreateResult {
352
+ ok: boolean;
353
+ error?: string;
354
+ projectPath?: string;
355
+ }
356
+ export interface WorkspaceConfig {
357
+ workspaceId?: string;
358
+ workspaceName?: string;
359
+ plan?: string;
360
+ configuredProviders?: string[];
361
+ }
362
+ export interface ModelInfo {
363
+ id: string;
364
+ name: string;
365
+ provider: string;
366
+ capabilities?: string[];
367
+ }
368
+ export interface ModelsResponse {
369
+ anthropic: ModelInfo[];
370
+ openai: ModelInfo[];
371
+ google: ModelInfo[];
372
+ nvidia: ModelInfo[];
373
+ }
374
+ export interface InitResult {
375
+ ok: boolean;
376
+ error?: string;
377
+ projectId?: string;
378
+ workspaceId?: string;
379
+ name?: string;
380
+ domain?: string;
381
+ }
382
+ export interface ProjectMetadata {
383
+ name: string;
384
+ version: string;
385
+ gitRemote: string;
386
+ payload: Record<string, unknown>;
387
+ }
388
+ export interface ActionExecutionResult {
389
+ success: boolean;
390
+ actionId: string;
391
+ output?: any;
392
+ error?: string;
393
+ observation?: {
394
+ type: string;
395
+ summary: string;
396
+ data?: any;
397
+ };
398
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,12 @@
1
+ import type { AgentAction } from "./agent-runtime";
2
+ export interface PendingChange {
3
+ filePath: string;
4
+ oldString: string;
5
+ newString: string;
6
+ operation: "created" | "modified" | "deleted";
7
+ }
8
+ export interface WorkspaceReview {
9
+ changes: PendingChange[];
10
+ binaryPaths: string[];
11
+ actions: AgentAction[];
12
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,27 @@
1
+ import type { AgentAction, AgentError, AgentEvent, AgentPhase, Observation } from "./agent-runtime";
2
+ import type { IBackend } from "./backend";
3
+ import type { PendingChange } from "./review";
4
+ export interface LocalSessionOutcome {
5
+ success: boolean;
6
+ status: "waiting" | "completed" | "failed";
7
+ summary?: string;
8
+ changes: PendingChange[];
9
+ binaryPaths: string[];
10
+ actions: AgentAction[];
11
+ observations: Observation[];
12
+ errors: AgentError[];
13
+ conversation: Array<{
14
+ role: "user" | "assistant" | "system";
15
+ content: string;
16
+ timestamp: number;
17
+ }>;
18
+ externalSessionId?: string;
19
+ metadata: Record<string, unknown>;
20
+ }
21
+ export interface LocalSessionRunnerOptions {
22
+ sessionId: string;
23
+ backend: IBackend;
24
+ guard: any;
25
+ emit: (event: AgentEvent) => void;
26
+ phase?: AgentPhase;
27
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Tool-call protocol for hosted-model agent runs.
3
+ *
4
+ * The server orchestrates the agent loop and calls the hosted model, but it
5
+ * never touches the user's filesystem. When the model requests a workspace
6
+ * action (read/edit/run/verify/...), the server emits a `tool_call` event over
7
+ * the runtime event channel (SSE). The local CLI executes the tool against
8
+ * the real project directory and posts the result back to
9
+ * `POST /sessions/:sessionId/tool-results`, where the orchestrator feeds it
10
+ * back into the model loop.
11
+ */
12
+ import type { AgentAction, AgentError, Observation } from "./agent-runtime";
13
+ /** A tool execution request from the server to the local CLI. */
14
+ export interface ToolCallRequest {
15
+ /** Unique id correlating the request with its result. */
16
+ callId: string;
17
+ sessionId: string;
18
+ /** `action` = workspace tool; `verify` = run the verification engine. */
19
+ kind: "action" | "verify";
20
+ /** Present when kind === "action". */
21
+ action?: AgentAction;
22
+ /** Present when kind === "verify". */
23
+ verify?: {
24
+ phase?: string;
25
+ };
26
+ }
27
+ /** The CLI's response to a tool_call, posted back to the server. */
28
+ export interface ToolCallResultPayload {
29
+ callId: string;
30
+ success: boolean;
31
+ output?: unknown;
32
+ error?: string;
33
+ /** Observations to feed back into the model's context. */
34
+ observations?: Observation[];
35
+ /** Errors to record on the session (e.g. verification failures). */
36
+ errors?: AgentError[];
37
+ }
38
+ /** Default per-tool timeouts (ms). run_command is long-running by nature. */
39
+ export declare const TOOL_CALL_TIMEOUT_MS: Record<string, number>;
40
+ export declare function toolCallTimeoutMs(tool: string): number;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TOOL_CALL_TIMEOUT_MS = void 0;
4
+ exports.toolCallTimeoutMs = toolCallTimeoutMs;
5
+ /** Default per-tool timeouts (ms). run_command is long-running by nature. */
6
+ exports.TOOL_CALL_TIMEOUT_MS = {
7
+ run_command: 180_000,
8
+ verify: 300_000,
9
+ default: 120_000,
10
+ };
11
+ function toolCallTimeoutMs(tool) {
12
+ return exports.TOOL_CALL_TIMEOUT_MS[tool] ?? exports.TOOL_CALL_TIMEOUT_MS.default;
13
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,24 @@
1
+ import type { AgentError, Observation } from "./agent-runtime";
2
+ export interface VerificationConfig {
3
+ typecheckTimeout: number;
4
+ buildTimeout: number;
5
+ devServerTimeout: number;
6
+ browserTimeout: number;
7
+ devServerUrl?: string;
8
+ browserContextProvider?: (action: {
9
+ id: string;
10
+ type: "browser_check";
11
+ data?: Record<string, unknown>;
12
+ }) => Promise<unknown>;
13
+ }
14
+ export interface VerificationResult {
15
+ type: "typecheck" | "build" | "dev_server" | "browser";
16
+ success: boolean;
17
+ skipped?: boolean;
18
+ command?: string;
19
+ output?: string;
20
+ error?: string;
21
+ observations: Observation[];
22
+ errors: AgentError[];
23
+ duration: number;
24
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,23 @@
1
+ export interface FileChange {
2
+ filePath: string;
3
+ operation: "created" | "modified" | "deleted";
4
+ oldContent?: string;
5
+ newContent?: string;
6
+ binary?: boolean;
7
+ }
8
+ export interface WorkspaceGuardOptions {
9
+ ignoreDirs?: string[];
10
+ ignore?: (relPath: string, isDirectory: boolean) => boolean;
11
+ maxMemoryFileSize?: number;
12
+ maxTotalBytes?: number;
13
+ maxDepth?: number;
14
+ }
15
+ export type CapturedEntry = {
16
+ absPath: string;
17
+ content: any;
18
+ tempPath?: string;
19
+ hash: string;
20
+ size: number;
21
+ mode: number;
22
+ binary: boolean;
23
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/dist/overlay.js CHANGED
@@ -20552,7 +20552,7 @@ Please proceed directly with the implementation and code changes from this point
20552
20552
  const taskId2 = `oneshot-${Date.now()}`;
20553
20553
  activeTaskId = taskId2;
20554
20554
  activeStartTime = Date.now();
20555
- const initialStepTitle = "Preparing task\u2026";
20555
+ const initialStepTitle = "Thinking\u2026";
20556
20556
  commandMessages.push({
20557
20557
  id: taskId2,
20558
20558
  role: "assistant",
@@ -20591,6 +20591,7 @@ Please proceed directly with the implementation and code changes from this point
20591
20591
  scope: "project",
20592
20592
  model: state.selectedModel.id,
20593
20593
  provider: state.selectedModel.provider,
20594
+ conversationId: activeConversationId || void 0,
20594
20595
  // The conversation already includes the current user message. It is
20595
20596
  // the only prompt context sent to the runtime.
20596
20597
  conversation: commandMessages.filter((message) => Boolean(message.content) && !message.error).map((message) => ({ role: message.role, content: message.content, timestamp: message.timestamp }))
@@ -1,4 +1,6 @@
1
1
  import type { AgentAction } from "./agent-runtime";
2
+ import type { ActionExecutionResult } from "../core/interfaces/data";
3
+ export type { ActionExecutionResult } from "../core/interfaces/data";
2
4
  /**
3
5
  * Action Executor - Executes validated model actions on the LOCAL machine.
4
6
  *
@@ -6,17 +8,6 @@ import type { AgentAction } from "./agent-runtime";
6
8
  * orchestrator. Every path is validated to stay inside the project directory
7
9
  * (workspace boundary enforcement happens client-side, never on the server).
8
10
  */
9
- export interface ActionExecutionResult {
10
- success: boolean;
11
- actionId: string;
12
- output?: any;
13
- error?: string;
14
- observation?: {
15
- type: string;
16
- summary: string;
17
- data?: any;
18
- };
19
- }
20
11
  export declare class ActionExecutor {
21
12
  private projectPath;
22
13
  private browserContextProvider?;
@@ -9,6 +9,13 @@ const node_path_1 = __importDefault(require("node:path"));
9
9
  const node_child_process_1 = require("node:child_process");
10
10
  const node_util_1 = require("node:util");
11
11
  const exec = (0, node_util_1.promisify)(node_child_process_1.exec);
12
+ /**
13
+ * Action Executor - Executes validated model actions on the LOCAL machine.
14
+ *
15
+ * Used by the CLI to fulfil `tool_call` requests from the hosted-model
16
+ * orchestrator. Every path is validated to stay inside the project directory
17
+ * (workspace boundary enforcement happens client-side, never on the server).
18
+ */
12
19
  class ActionExecutor {
13
20
  projectPath;
14
21
  browserContextProvider;