@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.
- package/dist/cli/auth.d.ts +2 -9
- package/dist/cli/bridge.d.ts +1 -290
- package/dist/cli/bridge.js +18 -0
- package/dist/cli/create.d.ts +2 -15
- package/dist/cli/project.d.ts +2 -42
- package/dist/cli/runtime-client.d.ts +15 -0
- package/dist/cli/runtime-client.js +13 -0
- package/dist/core/interfaces/agent-runtime.d.ts +308 -0
- package/dist/core/interfaces/agent-runtime.js +8 -0
- package/dist/core/interfaces/backend.d.ts +274 -0
- package/dist/core/interfaces/backend.js +38 -0
- package/dist/core/interfaces/data.d.ts +398 -0
- package/dist/core/interfaces/data.js +2 -0
- package/dist/core/interfaces/review.d.ts +12 -0
- package/dist/core/interfaces/review.js +2 -0
- package/dist/core/interfaces/session-runner.d.ts +27 -0
- package/dist/core/interfaces/session-runner.js +2 -0
- package/dist/core/interfaces/tool-protocol.d.ts +40 -0
- package/dist/core/interfaces/tool-protocol.js +13 -0
- package/dist/core/interfaces/types.d.ts +1 -0
- package/dist/core/interfaces/types.js +2 -0
- package/dist/core/interfaces/verification.d.ts +24 -0
- package/dist/core/interfaces/verification.js +2 -0
- package/dist/core/interfaces/workspace.d.ts +23 -0
- package/dist/core/interfaces/workspace.js +2 -0
- package/dist/overlay.js +2 -1
- package/dist/runtime/action-executor.d.ts +2 -11
- package/dist/runtime/action-executor.js +7 -0
- package/dist/runtime/agent-runtime.d.ts +2 -308
- package/dist/runtime/agent-runtime.js +16 -6
- package/dist/runtime/backend-interface.d.ts +2 -274
- package/dist/runtime/backend-interface.js +16 -36
- package/dist/runtime/local-session-runner.d.ts +3 -36
- package/dist/runtime/review.d.ts +2 -15
- package/dist/runtime/tool-protocol.d.ts +2 -40
- package/dist/runtime/tool-protocol.js +16 -11
- package/dist/runtime/verification-engine.d.ts +2 -27
- package/dist/runtime/verification-engine.js +6 -0
- package/dist/runtime/workspace-guard.d.ts +2 -23
- package/package.json +1 -1
|
@@ -1,308 +1,2 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* This file defines all the core contracts for the Lasso-owned agentic runtime.
|
|
5
|
-
* The model is an interchangeable intelligence provider; Lasso owns the loop.
|
|
6
|
-
*/
|
|
7
|
-
export type AgentPhase = "understand" | "inspect" | "plan" | "execute" | "verify" | "recover" | "complete";
|
|
8
|
-
export type AgentStatus = "running" | "waiting" | "completed" | "failed" | "cancelled";
|
|
9
|
-
export interface LassoAgentSession {
|
|
10
|
-
id: string;
|
|
11
|
-
phase: AgentPhase;
|
|
12
|
-
status: AgentStatus;
|
|
13
|
-
iteration: number;
|
|
14
|
-
userPrompt: string;
|
|
15
|
-
conversation: AgentMessage[];
|
|
16
|
-
observations: Observation[];
|
|
17
|
-
actions: AgentAction[];
|
|
18
|
-
completedActions: AgentAction[];
|
|
19
|
-
errors: AgentError[];
|
|
20
|
-
plan?: AgentPlan;
|
|
21
|
-
selection?: SelectionContext;
|
|
22
|
-
project: ProjectContext;
|
|
23
|
-
model: ModelMetadata;
|
|
24
|
-
createdAt: Date;
|
|
25
|
-
updatedAt: Date;
|
|
26
|
-
conversationUid?: string;
|
|
27
|
-
metadata?: Record<string, unknown>;
|
|
28
|
-
}
|
|
29
|
-
export interface AgentMessage {
|
|
30
|
-
id: string;
|
|
31
|
-
role: "user" | "assistant" | "system" | "tool";
|
|
32
|
-
content: string;
|
|
33
|
-
timestamp: number;
|
|
34
|
-
metadata?: Record<string, unknown>;
|
|
35
|
-
}
|
|
36
|
-
export interface SelectionContext {
|
|
37
|
-
element?: {
|
|
38
|
-
tag: string;
|
|
39
|
-
text?: string;
|
|
40
|
-
source?: string;
|
|
41
|
-
attributes?: Record<string, string>;
|
|
42
|
-
};
|
|
43
|
-
viewport?: {
|
|
44
|
-
width: number;
|
|
45
|
-
height: number;
|
|
46
|
-
scrollY?: number;
|
|
47
|
-
scrollHeight?: number;
|
|
48
|
-
};
|
|
49
|
-
route?: string;
|
|
50
|
-
screenshot?: string;
|
|
51
|
-
}
|
|
52
|
-
export interface ProjectContext {
|
|
53
|
-
projectId: string;
|
|
54
|
-
framework?: string;
|
|
55
|
-
hasTypeScript: boolean;
|
|
56
|
-
hasTailwind: boolean;
|
|
57
|
-
hasReact: boolean;
|
|
58
|
-
hasNext: boolean;
|
|
59
|
-
hasVite: boolean;
|
|
60
|
-
files: string[];
|
|
61
|
-
dependencies?: string[];
|
|
62
|
-
devDependencies?: string[];
|
|
63
|
-
currentRoute?: string;
|
|
64
|
-
sourceHints?: Record<string, string>;
|
|
65
|
-
pageContext?: {
|
|
66
|
-
route?: string;
|
|
67
|
-
title?: string;
|
|
68
|
-
viewport?: {
|
|
69
|
-
width: number;
|
|
70
|
-
height: number;
|
|
71
|
-
scrollY?: number;
|
|
72
|
-
scrollHeight?: number;
|
|
73
|
-
};
|
|
74
|
-
domSummary?: {
|
|
75
|
-
headings?: Array<{
|
|
76
|
-
level: number;
|
|
77
|
-
text: string;
|
|
78
|
-
}>;
|
|
79
|
-
sections?: Array<{
|
|
80
|
-
name: string;
|
|
81
|
-
textPreview: string;
|
|
82
|
-
}>;
|
|
83
|
-
buttons?: string[];
|
|
84
|
-
links?: string[];
|
|
85
|
-
visibleTextSnippet?: string;
|
|
86
|
-
};
|
|
87
|
-
runtimeErrors?: string[];
|
|
88
|
-
selectedElement?: SelectionContext["element"];
|
|
89
|
-
screenshot?: string;
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
export interface AgentPlan {
|
|
93
|
-
id: string;
|
|
94
|
-
goal: string;
|
|
95
|
-
steps: PlanStep[];
|
|
96
|
-
estimatedActions?: number;
|
|
97
|
-
createdAt: Date;
|
|
98
|
-
}
|
|
99
|
-
export interface PlanStep {
|
|
100
|
-
id: string;
|
|
101
|
-
description: string;
|
|
102
|
-
status: "pending" | "in_progress" | "completed" | "failed";
|
|
103
|
-
actionCount?: number;
|
|
104
|
-
}
|
|
105
|
-
export type ObservationType = "file" | "search" | "command" | "browser" | "build" | "runtime" | "error" | "verification" | "tool";
|
|
106
|
-
export interface Observation {
|
|
107
|
-
id: string;
|
|
108
|
-
type: ObservationType;
|
|
109
|
-
summary: string;
|
|
110
|
-
data?: unknown;
|
|
111
|
-
timestamp: number;
|
|
112
|
-
phase?: AgentPhase;
|
|
113
|
-
actionId?: string;
|
|
114
|
-
}
|
|
115
|
-
export type AgentAction = ReadFileAction | SearchCodeAction | InspectProjectAction | EditFileAction | CreateFileAction | DeleteFileAction | RunCommandAction | BrowserCheckAction;
|
|
116
|
-
export interface BaseAction {
|
|
117
|
-
id: string;
|
|
118
|
-
data: Record<string, unknown>;
|
|
119
|
-
}
|
|
120
|
-
export interface ReadFileAction extends BaseAction {
|
|
121
|
-
type: "read_file";
|
|
122
|
-
}
|
|
123
|
-
export interface SearchCodeAction extends BaseAction {
|
|
124
|
-
type: "search_code";
|
|
125
|
-
}
|
|
126
|
-
export interface InspectProjectAction extends BaseAction {
|
|
127
|
-
type: "inspect_project";
|
|
128
|
-
}
|
|
129
|
-
export interface EditFileAction extends BaseAction {
|
|
130
|
-
type: "edit_file";
|
|
131
|
-
}
|
|
132
|
-
export interface CreateFileAction extends BaseAction {
|
|
133
|
-
type: "create_file";
|
|
134
|
-
}
|
|
135
|
-
export interface DeleteFileAction extends BaseAction {
|
|
136
|
-
type: "delete_file";
|
|
137
|
-
}
|
|
138
|
-
export interface RunCommandAction extends BaseAction {
|
|
139
|
-
type: "run_command";
|
|
140
|
-
}
|
|
141
|
-
export interface BrowserCheckAction extends BaseAction {
|
|
142
|
-
type: "browser_check";
|
|
143
|
-
}
|
|
144
|
-
export interface AgentError {
|
|
145
|
-
id: string;
|
|
146
|
-
type: "validation" | "execution" | "verification" | "timeout" | "permission" | "unknown";
|
|
147
|
-
message: string;
|
|
148
|
-
phase: AgentPhase;
|
|
149
|
-
actionId?: string;
|
|
150
|
-
timestamp: number;
|
|
151
|
-
details?: Record<string, unknown>;
|
|
152
|
-
recoverable: boolean;
|
|
153
|
-
}
|
|
154
|
-
export interface ModelMetadata {
|
|
155
|
-
provider: "anthropic" | "openai" | "google" | "nvidia" | "ollama" | "claude_code" | "opencode" | "codex_cli" | "cursor";
|
|
156
|
-
id: string;
|
|
157
|
-
name?: string;
|
|
158
|
-
}
|
|
159
|
-
export interface LassoAgentContext {
|
|
160
|
-
session: {
|
|
161
|
-
id: string;
|
|
162
|
-
phase: AgentPhase;
|
|
163
|
-
iteration: number;
|
|
164
|
-
};
|
|
165
|
-
userPrompt: string;
|
|
166
|
-
conversation: AgentMessage[];
|
|
167
|
-
selection?: SelectionContext;
|
|
168
|
-
project: ProjectContext;
|
|
169
|
-
observations: Observation[];
|
|
170
|
-
previousActions: AgentAction[];
|
|
171
|
-
errors: AgentError[];
|
|
172
|
-
currentPlan?: AgentPlan;
|
|
173
|
-
availableTools: ToolDefinition[];
|
|
174
|
-
constraints: AgentConstraints;
|
|
175
|
-
}
|
|
176
|
-
export interface ToolDefinition {
|
|
177
|
-
name: string;
|
|
178
|
-
description: string;
|
|
179
|
-
allowedPhases: AgentPhase[];
|
|
180
|
-
parameters?: Record<string, unknown>;
|
|
181
|
-
}
|
|
182
|
-
export interface AgentConstraints {
|
|
183
|
-
maxActionsPerTurn: number;
|
|
184
|
-
allowedPhases: AgentPhase[];
|
|
185
|
-
maxFileSize?: number;
|
|
186
|
-
allowedCommands?: string[];
|
|
187
|
-
forbiddenPaths?: string[];
|
|
188
|
-
safetyLevel?: "strict" | "standard" | "permissive";
|
|
189
|
-
}
|
|
190
|
-
export interface LassoModelResponse {
|
|
191
|
-
status: "continue" | "waiting" | "complete" | "failed";
|
|
192
|
-
reasoning: {
|
|
193
|
-
summary: string;
|
|
194
|
-
/** Raw model thoughts / extended reasoning, when the provider exposes it. */
|
|
195
|
-
raw?: string;
|
|
196
|
-
};
|
|
197
|
-
decision: {
|
|
198
|
-
type: "respond" | "inspect" | "plan" | "execute" | "verify" | "recover" | "ask_user";
|
|
199
|
-
goal: string;
|
|
200
|
-
};
|
|
201
|
-
actions: AgentAction[];
|
|
202
|
-
/** Direct conversational answer when no project work is requested. */
|
|
203
|
-
reply?: string;
|
|
204
|
-
expectedOutcome?: string;
|
|
205
|
-
}
|
|
206
|
-
export type AgentEventType = "agent_started" | "agent_reasoning" | "agent_completed" | "agent_failed" | "agent_cancelled" | "phase_changed" | "tool_started" | "tool_completed" | "tool_call" | "observation" | "plan_created" | "file_changed" | "verification_started" | "verification_completed" | "error" | "model_changed" | "waiting_for_user";
|
|
207
|
-
export interface AgentEvent {
|
|
208
|
-
type: AgentEventType;
|
|
209
|
-
sessionId: string;
|
|
210
|
-
timestamp: number;
|
|
211
|
-
data?: Record<string, unknown>;
|
|
212
|
-
}
|
|
213
|
-
export interface AgentReasoningEvent extends AgentEvent {
|
|
214
|
-
type: "agent_reasoning";
|
|
215
|
-
data: {
|
|
216
|
-
summary: string;
|
|
217
|
-
decision?: string;
|
|
218
|
-
/** Raw model thoughts for UI detail display. */
|
|
219
|
-
raw?: string;
|
|
220
|
-
};
|
|
221
|
-
}
|
|
222
|
-
export interface PhaseChangedEvent extends AgentEvent {
|
|
223
|
-
type: "phase_changed";
|
|
224
|
-
data: {
|
|
225
|
-
from: AgentPhase;
|
|
226
|
-
to: AgentPhase;
|
|
227
|
-
reason?: string;
|
|
228
|
-
};
|
|
229
|
-
}
|
|
230
|
-
export interface ToolStartedEvent extends AgentEvent {
|
|
231
|
-
type: "tool_started";
|
|
232
|
-
data: {
|
|
233
|
-
actionType: string;
|
|
234
|
-
target?: string;
|
|
235
|
-
};
|
|
236
|
-
}
|
|
237
|
-
export interface ToolCompletedEvent extends AgentEvent {
|
|
238
|
-
type: "tool_completed";
|
|
239
|
-
data: {
|
|
240
|
-
actionType: string;
|
|
241
|
-
target?: string;
|
|
242
|
-
success: boolean;
|
|
243
|
-
duration?: number;
|
|
244
|
-
};
|
|
245
|
-
}
|
|
246
|
-
/**
|
|
247
|
-
* Emitted by the server when the hosted model requests a workspace tool.
|
|
248
|
-
* The local CLI executes the tool and posts the result back to
|
|
249
|
-
* `POST /sessions/:sessionId/tool-results` (see tool-protocol.ts).
|
|
250
|
-
*/
|
|
251
|
-
export interface ToolCallEvent extends AgentEvent {
|
|
252
|
-
type: "tool_call";
|
|
253
|
-
data: {
|
|
254
|
-
callId: string;
|
|
255
|
-
kind: "action" | "verify";
|
|
256
|
-
action?: AgentAction;
|
|
257
|
-
verify?: {
|
|
258
|
-
phase?: string;
|
|
259
|
-
};
|
|
260
|
-
};
|
|
261
|
-
}
|
|
262
|
-
export interface ObservationEvent extends AgentEvent {
|
|
263
|
-
type: "observation";
|
|
264
|
-
data: {
|
|
265
|
-
observationType: ObservationType;
|
|
266
|
-
summary: string;
|
|
267
|
-
details?: unknown;
|
|
268
|
-
};
|
|
269
|
-
}
|
|
270
|
-
export interface VerificationStartedEvent extends AgentEvent {
|
|
271
|
-
type: "verification_started";
|
|
272
|
-
data: {
|
|
273
|
-
verificationType: "typecheck" | "build" | "runtime" | "browser";
|
|
274
|
-
};
|
|
275
|
-
}
|
|
276
|
-
export interface VerificationCompletedEvent extends AgentEvent {
|
|
277
|
-
type: "verification_completed";
|
|
278
|
-
data: {
|
|
279
|
-
verificationType: "typecheck" | "build" | "runtime" | "browser";
|
|
280
|
-
success: boolean;
|
|
281
|
-
duration?: number;
|
|
282
|
-
errors?: string[];
|
|
283
|
-
};
|
|
284
|
-
}
|
|
285
|
-
export interface ErrorEvent extends AgentEvent {
|
|
286
|
-
type: "error";
|
|
287
|
-
data: {
|
|
288
|
-
errorType: string;
|
|
289
|
-
message: string;
|
|
290
|
-
phase: AgentPhase;
|
|
291
|
-
recoverable: boolean;
|
|
292
|
-
};
|
|
293
|
-
}
|
|
294
|
-
export interface ModelChangedEvent extends AgentEvent {
|
|
295
|
-
type: "model_changed";
|
|
296
|
-
data: {
|
|
297
|
-
from: ModelMetadata;
|
|
298
|
-
to: ModelMetadata;
|
|
299
|
-
};
|
|
300
|
-
}
|
|
301
|
-
export interface WaitingForUserEvent extends AgentEvent {
|
|
302
|
-
type: "waiting_for_user";
|
|
303
|
-
data: {
|
|
304
|
-
question?: string;
|
|
305
|
-
options?: string[];
|
|
306
|
-
kind?: "input" | "single_select" | "multiselect";
|
|
307
|
-
};
|
|
308
|
-
}
|
|
1
|
+
/** @deprecated Runtime contracts now live in `core/interfaces/agent-runtime`. */
|
|
2
|
+
export * from "../core/interfaces/agent-runtime";
|
|
@@ -1,8 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
8
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
/** @deprecated Runtime contracts now live in `core/interfaces/agent-runtime`. */
|
|
18
|
+
__exportStar(require("../core/interfaces/agent-runtime"), exports);
|
|
@@ -1,274 +1,2 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* This file defines the common interface for all agent backends:
|
|
5
|
-
* - Hosted model providers (Anthropic, OpenAI, Google, NVIDIA, Ollama)
|
|
6
|
-
* - Local coding agents (Claude Code, OpenCode, Codex CLI, Cursor)
|
|
7
|
-
*
|
|
8
|
-
* The Lasso Runtime uses this interface to delegate task execution while maintaining
|
|
9
|
-
* control over the overall workflow: Understand → Inspect → Plan → Execute → Verify → Recover → Complete
|
|
10
|
-
*/
|
|
11
|
-
import { AgentAction, Observation, AgentError, AgentPhase, ProjectContext, SelectionContext } from "./agent-runtime";
|
|
12
|
-
export type { AgentAction, Observation, AgentError, AgentPhase, ProjectContext, SelectionContext } from "./agent-runtime";
|
|
13
|
-
export type BackendType = "hosted_model" | "local_agent";
|
|
14
|
-
export type BackendProvider = "anthropic" | "openai" | "google" | "nvidia" | "ollama" | "claude_code" | "opencode" | "codex_cli" | "cursor";
|
|
15
|
-
export interface BackendCapabilities {
|
|
16
|
-
/**
|
|
17
|
-
* Whether the backend can stream progress events in real-time
|
|
18
|
-
*/
|
|
19
|
-
canStreamEvents: boolean;
|
|
20
|
-
/**
|
|
21
|
-
* Whether the backend can operate in an isolated workspace
|
|
22
|
-
* (required for safe pre-review execution)
|
|
23
|
-
*/
|
|
24
|
-
canIsolateWorkspace: boolean;
|
|
25
|
-
/**
|
|
26
|
-
* Whether the backend provides structured diff output
|
|
27
|
-
* (vs. requiring post-execution diff generation)
|
|
28
|
-
*/
|
|
29
|
-
providesStructuredDiffs: boolean;
|
|
30
|
-
/**
|
|
31
|
-
* Whether the backend supports session continuation across calls
|
|
32
|
-
*/
|
|
33
|
-
supportsSessionContinuation: boolean;
|
|
34
|
-
/**
|
|
35
|
-
* Whether the backend can cancel running tasks
|
|
36
|
-
*/
|
|
37
|
-
supportsCancellation: boolean;
|
|
38
|
-
/**
|
|
39
|
-
* Whether the backend has its own internal agentic loop
|
|
40
|
-
* (if true, Lasso should not run a competing loop around it)
|
|
41
|
-
*/
|
|
42
|
-
hasInternalLoop: boolean;
|
|
43
|
-
/**
|
|
44
|
-
* File operations the backend can perform directly
|
|
45
|
-
*/
|
|
46
|
-
supportedFileOperations: "read" | "write" | "both" | "none";
|
|
47
|
-
/**
|
|
48
|
-
* Whether the backend can run shell commands
|
|
49
|
-
*/
|
|
50
|
-
canRunCommands: boolean;
|
|
51
|
-
/**
|
|
52
|
-
* Authentication method
|
|
53
|
-
*/
|
|
54
|
-
authMethod: "api_key" | "cli_session" | "none" | "oauth";
|
|
55
|
-
/**
|
|
56
|
-
* Maximum file size for operations (in bytes), if any
|
|
57
|
-
*/
|
|
58
|
-
maxFileSize?: number;
|
|
59
|
-
/**
|
|
60
|
-
* Commands that are forbidden (if any)
|
|
61
|
-
*/
|
|
62
|
-
forbiddenCommands?: string[];
|
|
63
|
-
}
|
|
64
|
-
export interface BackendConfig {
|
|
65
|
-
/**
|
|
66
|
-
* Backend type
|
|
67
|
-
*/
|
|
68
|
-
type: BackendType;
|
|
69
|
-
/**
|
|
70
|
-
* Provider identifier
|
|
71
|
-
*/
|
|
72
|
-
provider: BackendProvider;
|
|
73
|
-
/**
|
|
74
|
-
* Model ID (for hosted models) or agent version (for local agents)
|
|
75
|
-
*/
|
|
76
|
-
modelId?: string;
|
|
77
|
-
/**
|
|
78
|
-
* API key (for hosted models)
|
|
79
|
-
*/
|
|
80
|
-
apiKey?: string;
|
|
81
|
-
/**
|
|
82
|
-
* Base URL (for hosted models like Ollama)
|
|
83
|
-
*/
|
|
84
|
-
baseURL?: string;
|
|
85
|
-
/**
|
|
86
|
-
* Project path (for local agents)
|
|
87
|
-
*/
|
|
88
|
-
projectPath?: string;
|
|
89
|
-
/**
|
|
90
|
-
* Additional provider-specific configuration
|
|
91
|
-
*/
|
|
92
|
-
providerConfig?: Record<string, unknown>;
|
|
93
|
-
}
|
|
94
|
-
export interface TaskContext {
|
|
95
|
-
/**
|
|
96
|
-
* Unique task identifier
|
|
97
|
-
*/
|
|
98
|
-
taskId: string;
|
|
99
|
-
/**
|
|
100
|
-
* User's prompt or instruction
|
|
101
|
-
*/
|
|
102
|
-
userPrompt: string;
|
|
103
|
-
/** Whether the backend should answer conversationally without project work. */
|
|
104
|
-
mode?: "conversation" | "task";
|
|
105
|
-
/**
|
|
106
|
-
* Project context
|
|
107
|
-
*/
|
|
108
|
-
project: ProjectContext;
|
|
109
|
-
/**
|
|
110
|
-
* Selection context (if user selected a UI element)
|
|
111
|
-
*/
|
|
112
|
-
selection?: SelectionContext;
|
|
113
|
-
/**
|
|
114
|
-
* Conversation history
|
|
115
|
-
*/
|
|
116
|
-
conversation: Array<{
|
|
117
|
-
role: "user" | "assistant" | "system";
|
|
118
|
-
content: string;
|
|
119
|
-
timestamp: number;
|
|
120
|
-
}>;
|
|
121
|
-
/**
|
|
122
|
-
* Previous observations (for context)
|
|
123
|
-
*/
|
|
124
|
-
previousObservations: Observation[];
|
|
125
|
-
/**
|
|
126
|
-
* Previous errors (for recovery)
|
|
127
|
-
*/
|
|
128
|
-
previousErrors: AgentError[];
|
|
129
|
-
/**
|
|
130
|
-
* Current phase in Lasso's workflow
|
|
131
|
-
*/
|
|
132
|
-
currentPhase: AgentPhase;
|
|
133
|
-
/**
|
|
134
|
-
* Constraints (max actions, safety level, etc.)
|
|
135
|
-
*/
|
|
136
|
-
constraints: {
|
|
137
|
-
maxActions?: number;
|
|
138
|
-
safetyLevel?: "strict" | "standard" | "permissive";
|
|
139
|
-
allowedCommands?: string[];
|
|
140
|
-
forbiddenPaths?: string[];
|
|
141
|
-
};
|
|
142
|
-
/**
|
|
143
|
-
* Reference to the backend's own external session (e.g. Claude Code session id,
|
|
144
|
-
* Codex thread id, OpenCode ses_ id) for continuation when supported.
|
|
145
|
-
*/
|
|
146
|
-
sessionRef?: {
|
|
147
|
-
id?: string;
|
|
148
|
-
};
|
|
149
|
-
}
|
|
150
|
-
export type BackendEventType = "task_started" | "task_progress" | "tool_started" | "tool_completed" | "file_read" | "file_modified" | "file_created" | "file_deleted" | "diff_available" | "verification_started" | "verification_completed" | "error" | "waiting_for_user" | "task_completed" | "task_cancelled" | "task_failed";
|
|
151
|
-
export interface BackendEvent {
|
|
152
|
-
type: BackendEventType;
|
|
153
|
-
taskId: string;
|
|
154
|
-
timestamp: number;
|
|
155
|
-
data?: Record<string, unknown>;
|
|
156
|
-
}
|
|
157
|
-
export interface BackendResult {
|
|
158
|
-
/**
|
|
159
|
-
* Whether the task completed successfully
|
|
160
|
-
*/
|
|
161
|
-
success: boolean;
|
|
162
|
-
/**
|
|
163
|
-
* Final status
|
|
164
|
-
*/
|
|
165
|
-
status: "completed" | "failed" | "cancelled" | "waiting";
|
|
166
|
-
/**
|
|
167
|
-
* Summary of what was done
|
|
168
|
-
*/
|
|
169
|
-
summary: string;
|
|
170
|
-
/**
|
|
171
|
-
* File changes detected (normalized format)
|
|
172
|
-
*/
|
|
173
|
-
fileChanges: Array<{
|
|
174
|
-
filePath: string;
|
|
175
|
-
operation: "created" | "modified" | "deleted";
|
|
176
|
-
oldContent?: string;
|
|
177
|
-
newContent?: string;
|
|
178
|
-
}>;
|
|
179
|
-
/**
|
|
180
|
-
* Actions taken (normalized to Lasso's AgentAction format where possible)
|
|
181
|
-
*/
|
|
182
|
-
actions: AgentAction[];
|
|
183
|
-
/**
|
|
184
|
-
* Observations collected
|
|
185
|
-
*/
|
|
186
|
-
observations: Observation[];
|
|
187
|
-
/**
|
|
188
|
-
* Errors encountered
|
|
189
|
-
*/
|
|
190
|
-
errors: AgentError[];
|
|
191
|
-
/**
|
|
192
|
-
* Final conversation state (for continuation)
|
|
193
|
-
*/
|
|
194
|
-
conversation?: Array<{
|
|
195
|
-
role: "user" | "assistant" | "system";
|
|
196
|
-
content: string;
|
|
197
|
-
timestamp: number;
|
|
198
|
-
}>;
|
|
199
|
-
/**
|
|
200
|
-
* Provider-specific metadata
|
|
201
|
-
*/
|
|
202
|
-
metadata?: Record<string, unknown>;
|
|
203
|
-
}
|
|
204
|
-
export interface IBackend {
|
|
205
|
-
/**
|
|
206
|
-
* Unique backend identifier
|
|
207
|
-
*/
|
|
208
|
-
id: string;
|
|
209
|
-
/**
|
|
210
|
-
* Backend type
|
|
211
|
-
*/
|
|
212
|
-
type: BackendType;
|
|
213
|
-
/**
|
|
214
|
-
* Provider name
|
|
215
|
-
*/
|
|
216
|
-
provider: BackendProvider;
|
|
217
|
-
/**
|
|
218
|
-
* Model/agent ID
|
|
219
|
-
*/
|
|
220
|
-
modelId: string;
|
|
221
|
-
/**
|
|
222
|
-
* Get backend capabilities
|
|
223
|
-
*/
|
|
224
|
-
getCapabilities(): BackendCapabilities;
|
|
225
|
-
/**
|
|
226
|
-
* Check if backend is available and properly configured
|
|
227
|
-
*
|
|
228
|
-
* Returns detailed availability info including any authentication issues
|
|
229
|
-
*/
|
|
230
|
-
checkAvailability(): Promise<{
|
|
231
|
-
available: boolean;
|
|
232
|
-
installed: boolean;
|
|
233
|
-
authenticated: boolean;
|
|
234
|
-
version?: string;
|
|
235
|
-
error?: string;
|
|
236
|
-
fixInstructions?: string;
|
|
237
|
-
}>;
|
|
238
|
-
/**
|
|
239
|
-
* Execute a task
|
|
240
|
-
*
|
|
241
|
-
* This is the main entry point for task execution.
|
|
242
|
-
* The backend should:
|
|
243
|
-
* 1. Start the task
|
|
244
|
-
* 2. Stream progress events via the callback
|
|
245
|
-
* 3. Return the final result
|
|
246
|
-
*
|
|
247
|
-
* For backends with internal loops (like Claude Code), this method
|
|
248
|
-
* should delegate to the agent and monitor its execution.
|
|
249
|
-
*
|
|
250
|
-
* For hosted models, this method should integrate with the existing
|
|
251
|
-
* ModelGateway and return structured responses.
|
|
252
|
-
*/
|
|
253
|
-
executeTask(context: TaskContext, onEvent: (event: BackendEvent) => void, signal?: AbortSignal): Promise<BackendResult>;
|
|
254
|
-
/**
|
|
255
|
-
* Cancel a running task
|
|
256
|
-
*
|
|
257
|
-
* Only called if supportsCancellation is true
|
|
258
|
-
*/
|
|
259
|
-
cancelTask(taskId: string): Promise<void>;
|
|
260
|
-
/**
|
|
261
|
-
* Switch to a different backend/model
|
|
262
|
-
*
|
|
263
|
-
* This is called when the user switches providers mid-session.
|
|
264
|
-
* The backend should:
|
|
265
|
-
* 1. Return any context that can be transferred
|
|
266
|
-
* 2. Report what cannot be transferred (e.g., internal state)
|
|
267
|
-
*/
|
|
268
|
-
switchBackend(newBackend: IBackend, context: TaskContext): Promise<{
|
|
269
|
-
transferableContext: Record<string, unknown>;
|
|
270
|
-
lostContext: string[];
|
|
271
|
-
}>;
|
|
272
|
-
}
|
|
273
|
-
export declare const DEFAULT_LOCAL_CAPABILITIES: BackendCapabilities;
|
|
274
|
-
export declare const DEFAULT_HOSTED_CAPABILITIES: BackendCapabilities;
|
|
1
|
+
/** @deprecated Backend contracts now live in `core/interfaces/backend`. */
|
|
2
|
+
export * from "../core/interfaces/backend";
|
|
@@ -1,38 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
// Capability Defaults
|
|
16
|
-
// ============================================================================
|
|
17
|
-
exports.DEFAULT_LOCAL_CAPABILITIES = {
|
|
18
|
-
canStreamEvents: true,
|
|
19
|
-
canIsolateWorkspace: false,
|
|
20
|
-
providesStructuredDiffs: false,
|
|
21
|
-
supportsSessionContinuation: true,
|
|
22
|
-
supportsCancellation: true,
|
|
23
|
-
hasInternalLoop: true,
|
|
24
|
-
supportedFileOperations: "both",
|
|
25
|
-
canRunCommands: true,
|
|
26
|
-
authMethod: "cli_session",
|
|
27
|
-
};
|
|
28
|
-
exports.DEFAULT_HOSTED_CAPABILITIES = {
|
|
29
|
-
canStreamEvents: true,
|
|
30
|
-
canIsolateWorkspace: false,
|
|
31
|
-
providesStructuredDiffs: false,
|
|
32
|
-
supportsSessionContinuation: true,
|
|
33
|
-
supportsCancellation: true,
|
|
34
|
-
hasInternalLoop: false,
|
|
35
|
-
supportedFileOperations: "both",
|
|
36
|
-
canRunCommands: true,
|
|
37
|
-
authMethod: "api_key",
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
38
15
|
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
/** @deprecated Backend contracts now live in `core/interfaces/backend`. */
|
|
18
|
+
__exportStar(require("../core/interfaces/backend"), exports);
|