@lasso-ai/cli 2.1.22 → 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
@@ -1,12 +1,5 @@
1
- export interface CliCredentials {
2
- apiKey: string;
3
- keyId: string;
4
- workspaceId: string;
5
- workspaceName: string;
6
- userName: string;
7
- userEmail: string;
8
- createdAt: string;
9
- }
1
+ import type { CliCredentials } from "../core/interfaces/data";
2
+ export type { CliCredentials } from "../core/interfaces/data";
10
3
  /**
11
4
  * Base URL of the Lasso API (the main server, not the realtime server). The
12
5
  * `lasso auth` flow lives here because the browser confirm needs the web session.
@@ -1,294 +1,6 @@
1
1
  import type { CollabConfig } from "./project";
2
- import { type TimelineSnapshot } from "./snapshot";
3
2
  export declare const DEFAULT_BRIDGE_PORT = 3056;
4
- type GitState = {
5
- isRepo: boolean;
6
- branch?: string;
7
- status?: string[];
8
- hasChanges?: boolean;
9
- hasRemote?: boolean;
10
- remote?: string;
11
- };
12
- type Provider = "anthropic" | "openai" | "google" | "nvidia" | "ollama" | "claude_code" | "opencode" | "codex_cli" | "cursor";
13
- export type BridgeMessage = {
14
- type: "hello";
15
- from: "overlay" | "cli";
16
- } | {
17
- type: "edit";
18
- taskId: string;
19
- instruction: string;
20
- model: string;
21
- provider?: "anthropic" | "openai" | "google" | "nvidia" | "ollama" | "claude_code" | "opencode" | "codex_cli" | "cursor";
22
- messages?: Array<{
23
- role: string;
24
- content: string;
25
- createdAt?: string;
26
- }>;
27
- conversation?: Array<{
28
- role: "user" | "assistant" | "system";
29
- content: string;
30
- createdAt?: string;
31
- }>;
32
- changesHistory?: Array<{
33
- summary: string;
34
- changes: any[];
35
- createdAt?: string;
36
- }>;
37
- context?: {
38
- selectionId?: string;
39
- position?: Record<string, number>;
40
- viewport?: Record<string, unknown>;
41
- styles?: Record<string, string>;
42
- attributes?: Record<string, string>;
43
- runtimeErrors?: string[];
44
- screenshots?: {
45
- full?: string;
46
- element?: string;
47
- };
48
- };
49
- element: {
50
- tag: string;
51
- group: string;
52
- label: string;
53
- html?: string;
54
- sourceHint?: string;
55
- };
56
- } | {
57
- type: "ask";
58
- taskId: string;
59
- question: string;
60
- model: string;
61
- provider?: "anthropic" | "openai" | "google" | "nvidia" | "ollama" | "claude_code" | "opencode" | "codex_cli" | "cursor";
62
- messages?: Array<{
63
- role: string;
64
- content: string;
65
- createdAt?: string;
66
- }>;
67
- conversation?: Array<{
68
- role: "user" | "assistant" | "system";
69
- content: string;
70
- createdAt?: string;
71
- }>;
72
- context?: {
73
- selectionId?: string;
74
- position?: Record<string, number>;
75
- viewport?: Record<string, unknown>;
76
- styles?: Record<string, string>;
77
- attributes?: Record<string, string>;
78
- runtimeErrors?: string[];
79
- screenshots?: {
80
- full?: string;
81
- element?: string;
82
- };
83
- };
84
- element: {
85
- tag: string;
86
- group: string;
87
- label: string;
88
- html?: string;
89
- sourceHint?: string;
90
- };
91
- } | {
92
- type: "runtime_error";
93
- selectionId?: string;
94
- details: string;
95
- } | {
96
- type: "apply";
97
- taskId: string;
98
- changes: any[];
99
- } | {
100
- type: "undo";
101
- taskId?: string;
102
- } | {
103
- type: "stop";
104
- taskId?: string;
105
- } | {
106
- type: "agent_prompt_response";
107
- taskId: string;
108
- response: string;
109
- } | {
110
- type: "steer";
111
- taskId: string;
112
- queueId: string;
113
- prompt: string;
114
- } | {
115
- type: "list_page_folders";
116
- path?: string;
117
- } | {
118
- type: "create_page";
119
- folder: string;
120
- fileName: string;
121
- content: string;
122
- } | {
123
- type: "create_page_folder";
124
- parent: string;
125
- name: string;
126
- } | {
127
- type: "git_status";
128
- } | {
129
- type: "git_generate_message";
130
- model: string;
131
- provider?: "anthropic" | "openai" | "google" | "nvidia" | "ollama" | "claude_code" | "opencode" | "codex_cli" | "cursor";
132
- taskId?: string;
133
- pageContext?: any;
134
- } | {
135
- type: "git_init";
136
- } | {
137
- type: "git_commit";
138
- message: string;
139
- } | {
140
- type: "git_push";
141
- } | {
142
- type: "agent_status";
143
- taskId?: string;
144
- status: "thinking" | "working" | "review" | "error" | "stopped";
145
- message: string;
146
- } | {
147
- type: "transcribe";
148
- requestId: string;
149
- audio: string;
150
- mimeType?: string;
151
- language?: string;
152
- } | {
153
- type: "oneshot";
154
- prompt?: string;
155
- scope?: "project" | "component";
156
- model?: string;
157
- provider?: "anthropic" | "openai" | "google" | "nvidia" | "ollama" | "claude_code" | "opencode" | "codex_cli" | "cursor";
158
- messages?: Array<{
159
- role: "user" | "assistant";
160
- content: string;
161
- }>;
162
- conversation?: Array<{
163
- role: "user" | "assistant" | "system";
164
- content: string;
165
- timestamp?: number;
166
- }>;
167
- taskId?: string;
168
- } | {
169
- type: "page_context_response";
170
- requestId: string;
171
- pageContext?: any;
172
- error?: string;
173
- } | {
174
- type: "restore_snapshot";
175
- snapshotId: string;
176
- } | {
177
- type: "get_timeline";
178
- } | {
179
- type: "delete_snapshot";
180
- snapshotId: string;
181
- } | {
182
- type: "switch_model";
183
- taskId: string;
184
- provider: string;
185
- modelId: string;
186
- };
187
- type ModelOption = {
188
- id: string;
189
- label: string;
190
- provider: Provider;
191
- locked?: boolean;
192
- lockedReason?: string;
193
- };
194
- type PageEntry = {
195
- name: string;
196
- path: string;
197
- type: "directory" | "file";
198
- };
199
- export type ServerBridgeMessage = {
200
- type: "config";
201
- apiKeyConfigured: boolean;
202
- agentConfigured: boolean;
203
- models: ModelOption[];
204
- collab?: CollabConfig | null;
205
- user?: {
206
- name?: string;
207
- email?: string;
208
- } | null;
209
- } | {
210
- type: "git_state";
211
- git: GitState;
212
- } | {
213
- type: "git_result";
214
- message?: string;
215
- error?: string;
216
- } | {
217
- type: "git_progress";
218
- message: string;
219
- } | {
220
- type: "git_commit_message";
221
- message?: string;
222
- error?: string;
223
- } | {
224
- type: "agent_status";
225
- taskId?: string;
226
- status: "thinking" | "working" | "review" | "error" | "stopped";
227
- message: string;
228
- detail?: string;
229
- changes?: any[];
230
- thinking?: Array<{
231
- title: string;
232
- detail?: string;
233
- durationMs?: number;
234
- }>;
235
- totalThinkingTimeMs?: number;
236
- } | {
237
- type: "agent_prompt";
238
- taskId: string;
239
- prompt: {
240
- message: string;
241
- kind: "permission" | "input" | "multiselect";
242
- options?: string[];
243
- };
244
- } | {
245
- type: "steer_result";
246
- taskId: string;
247
- queueId: string;
248
- success: boolean;
249
- error?: string;
250
- } | {
251
- type: "page_folders";
252
- path: string;
253
- entries: PageEntry[];
254
- project?: string;
255
- error?: string;
256
- } | {
257
- type: "page_created";
258
- path: string;
259
- error?: string;
260
- } | {
261
- type: "page_folder_created";
262
- path: string;
263
- error?: string;
264
- } | {
265
- type: "assistant_message";
266
- taskId?: string;
267
- message: string;
268
- } | {
269
- type: "applied";
270
- taskId?: string;
271
- message: string;
272
- validation?: {
273
- passed: boolean;
274
- errors: string[];
275
- command: string;
276
- };
277
- } | {
278
- type: "undone";
279
- taskId?: string;
280
- message: string;
281
- } | {
282
- type: "transcribe_result";
283
- requestId: string;
284
- success: boolean;
285
- text?: string;
286
- provider?: string;
287
- error?: string;
288
- } | {
289
- type: "timeline";
290
- snapshots: TimelineSnapshot[];
291
- };
3
+ export type { BridgeMessage, ServerBridgeMessage } from "../core/interfaces/data";
292
4
  export declare function restartBridge(port?: number): Promise<{
293
5
  ok: boolean;
294
6
  error?: string;
@@ -296,4 +8,3 @@ export declare function restartBridge(port?: number): Promise<{
296
8
  export declare function startBridge(cwd?: string, collabConfig?: CollabConfig | null, bridgePort?: number): Promise<{
297
9
  ok: boolean;
298
10
  }>;
299
- export {};
@@ -1010,6 +1010,24 @@ async function startBridge(cwd = process.cwd(), collabConfig = null, bridgePort
1010
1010
  // decides whether the request needs project work or a conversational reply.
1011
1011
  try {
1012
1012
  const isLocalAgent = ["claude_code", "opencode", "codex_cli", "cursor"].includes(provider || "");
1013
+ if (!isLocalAgent) {
1014
+ try {
1015
+ const route = await runtimeClient.routeRequest({
1016
+ prompt: instruction,
1017
+ provider,
1018
+ conversation: runtimeConversation?.map(({ role, content }) => ({ role, content })),
1019
+ });
1020
+ if (route.path === "conversation") {
1021
+ await handleHostedConversation(taskId, instruction, model, provider || "anthropic", runtimeConversation, socket, controller.signal, message.conversationId);
1022
+ return;
1023
+ }
1024
+ }
1025
+ catch (error) {
1026
+ // Preserve the previous coding path if an older AI server has not
1027
+ // deployed the routing endpoint yet.
1028
+ console.warn("[lasso] request routing unavailable; using coding runtime", error instanceof Error ? error.message : error);
1029
+ }
1030
+ }
1013
1031
  const backendModelId = (0, backends_1.modelIdForBackend)(model || "", provider || "");
1014
1032
  const sessionInput = {
1015
1033
  userPrompt: instruction,
@@ -1,16 +1,3 @@
1
- export type Framework = "next" | "react" | "vue" | "svelte" | "solid";
2
- export type PackageManager = "pnpm" | "npm" | "yarn";
3
- interface CreateOptions {
4
- name?: string;
5
- framework?: Framework;
6
- typescript?: boolean;
7
- packageManager?: PackageManager;
8
- prompt?: string;
9
- }
10
- interface CreateResult {
11
- ok: boolean;
12
- error?: string;
13
- projectPath?: string;
14
- }
1
+ import type { CreateOptions, CreateResult } from "../core/interfaces/data";
2
+ export type { Framework, PackageManager } from "../core/interfaces/data";
15
3
  export declare function createProject(options: CreateOptions): Promise<CreateResult>;
16
- export {};
@@ -1,46 +1,6 @@
1
+ import type { CollabConfig, InitResult, ModelsResponse, WorkspaceConfig } from "../core/interfaces/data";
2
+ export type { CollabConfig, InitResult, ModelInfo, ModelsResponse, ProjectMetadata, WorkspaceConfig } from "../core/interfaces/data";
1
3
  export declare const LASSO_CONFIG_FILE = "lasso.config.json";
2
- export interface CollabConfig {
3
- projectId: string;
4
- name: string;
5
- version?: string;
6
- realtimeUrl: string;
7
- apiUrl: string;
8
- serverUrl: string;
9
- registered: boolean;
10
- registeredAt?: string;
11
- claimed: boolean;
12
- workspaceId?: string;
13
- token?: string;
14
- apiKey?: string;
15
- plan?: string;
16
- configuredProviders?: string[];
17
- }
18
- export interface WorkspaceConfig {
19
- workspaceId?: string;
20
- workspaceName?: string;
21
- plan?: string;
22
- configuredProviders?: string[];
23
- }
24
- export interface ModelInfo {
25
- id: string;
26
- name: string;
27
- provider: string;
28
- capabilities?: string[];
29
- }
30
- export interface ModelsResponse {
31
- anthropic: ModelInfo[];
32
- openai: ModelInfo[];
33
- google: ModelInfo[];
34
- nvidia: ModelInfo[];
35
- }
36
- export interface InitResult {
37
- ok: boolean;
38
- error?: string;
39
- projectId?: string;
40
- workspaceId?: string;
41
- name?: string;
42
- domain?: string;
43
- }
44
4
  export declare function readEnvFile(filename: string, cwd: string): Record<string, string>;
45
5
  /** Reads .env / .env.local / .env.production from the project and common sub-roots. */
46
6
  export declare function readProjectEnv(cwd: string): Record<string, string>;
@@ -62,6 +62,20 @@ export interface RuntimeSessionInput {
62
62
  projectPath?: string;
63
63
  };
64
64
  }
65
+ export interface RequestRouteInput {
66
+ prompt: string;
67
+ requestKind?: "conversation" | "ask" | "edit" | "code";
68
+ provider?: string;
69
+ hasSelection?: boolean;
70
+ conversation?: Array<{
71
+ role: string;
72
+ content: string;
73
+ }>;
74
+ }
75
+ export interface RequestRouteResult {
76
+ path: "conversation" | "coding";
77
+ reason: "explicit" | "selection" | "backend" | "history" | "intent";
78
+ }
65
79
  export type BrowserContextProvider = (action: {
66
80
  id: string;
67
81
  type: "browser_check";
@@ -301,6 +315,7 @@ export declare class RuntimeClient {
301
315
  * Create a new runtime session
302
316
  */
303
317
  createSession(input: RuntimeSessionInput): Promise<RuntimeSession>;
318
+ routeRequest(input: RequestRouteInput): Promise<RequestRouteResult>;
304
319
  /**
305
320
  * Get a session by ID. Locally computed review changes (WorkspaceGuard
306
321
  * diff from the last run) are merged into metadata.pendingChanges.
@@ -62,6 +62,19 @@ class RuntimeClient {
62
62
  const data = await response.json();
63
63
  return data;
64
64
  }
65
+ async routeRequest(input) {
66
+ const response = await fetch(`${this.serverUrl}/api/v1/agent/route`, {
67
+ method: "POST",
68
+ headers: {
69
+ "Content-Type": "application/json",
70
+ ...(this.apiKey && { Authorization: `Bearer ${this.apiKey}` }),
71
+ },
72
+ body: JSON.stringify(input),
73
+ });
74
+ if (!response.ok)
75
+ throw await RuntimeClient.responseError(response, "Failed to route request");
76
+ return (await response.json());
77
+ }
65
78
  /**
66
79
  * Get a session by ID. Locally computed review changes (WorkspaceGuard
67
80
  * diff from the last run) are merged into metadata.pendingChanges.