@lasso-ai/cli 2.1.16 → 2.1.18
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/bridge.d.ts +16 -1
- package/dist/cli/bridge.js +28 -7
- package/dist/overlay.js +4 -24
- package/package.json +1 -1
package/dist/cli/bridge.d.ts
CHANGED
|
@@ -24,6 +24,11 @@ export type BridgeMessage = {
|
|
|
24
24
|
content: string;
|
|
25
25
|
createdAt?: string;
|
|
26
26
|
}>;
|
|
27
|
+
conversation?: Array<{
|
|
28
|
+
role: "user" | "assistant" | "system";
|
|
29
|
+
content: string;
|
|
30
|
+
createdAt?: string;
|
|
31
|
+
}>;
|
|
27
32
|
changesHistory?: Array<{
|
|
28
33
|
summary: string;
|
|
29
34
|
changes: any[];
|
|
@@ -59,6 +64,11 @@ export type BridgeMessage = {
|
|
|
59
64
|
content: string;
|
|
60
65
|
createdAt?: string;
|
|
61
66
|
}>;
|
|
67
|
+
conversation?: Array<{
|
|
68
|
+
role: "user" | "assistant" | "system";
|
|
69
|
+
content: string;
|
|
70
|
+
createdAt?: string;
|
|
71
|
+
}>;
|
|
62
72
|
context?: {
|
|
63
73
|
selectionId?: string;
|
|
64
74
|
position?: Record<string, number>;
|
|
@@ -141,7 +151,7 @@ export type BridgeMessage = {
|
|
|
141
151
|
language?: string;
|
|
142
152
|
} | {
|
|
143
153
|
type: "oneshot";
|
|
144
|
-
prompt
|
|
154
|
+
prompt?: string;
|
|
145
155
|
scope?: "project" | "component";
|
|
146
156
|
model?: string;
|
|
147
157
|
provider?: "anthropic" | "openai" | "google" | "nvidia" | "ollama" | "claude_code" | "opencode" | "codex_cli" | "cursor";
|
|
@@ -149,6 +159,11 @@ export type BridgeMessage = {
|
|
|
149
159
|
role: "user" | "assistant";
|
|
150
160
|
content: string;
|
|
151
161
|
}>;
|
|
162
|
+
conversation?: Array<{
|
|
163
|
+
role: "user" | "assistant" | "system";
|
|
164
|
+
content: string;
|
|
165
|
+
timestamp?: number;
|
|
166
|
+
}>;
|
|
152
167
|
taskId?: string;
|
|
153
168
|
} | {
|
|
154
169
|
type: "page_context_response";
|
package/dist/cli/bridge.js
CHANGED
|
@@ -31,7 +31,7 @@ function toRuntimeConversation(messages) {
|
|
|
31
31
|
.map((m) => ({
|
|
32
32
|
role: (m.role === "user" ? "user" : m.role === "assistant" ? "assistant" : "system"),
|
|
33
33
|
content: m.content,
|
|
34
|
-
timestamp: m.createdAt ? Date.parse(m.createdAt) || Date.now() : Date.now(),
|
|
34
|
+
timestamp: typeof m.timestamp === "number" ? m.timestamp : m.createdAt ? Date.parse(m.createdAt) || Date.now() : Date.now(),
|
|
35
35
|
}));
|
|
36
36
|
return turns.length > 0 ? turns : undefined;
|
|
37
37
|
}
|
|
@@ -392,11 +392,21 @@ async function startBridge(cwd = process.cwd(), collabConfig = null, bridgePort
|
|
|
392
392
|
}));
|
|
393
393
|
break;
|
|
394
394
|
}
|
|
395
|
-
case "agent_completed":
|
|
396
|
-
|
|
395
|
+
case "agent_completed": {
|
|
396
|
+
const data = event.data || {};
|
|
397
|
+
const reply = typeof data.reply === "string" ? data.reply.trim() : "";
|
|
398
|
+
if (reply && data.conversational === true) {
|
|
399
|
+
socket.send(JSON.stringify({
|
|
400
|
+
type: "assistant_message",
|
|
401
|
+
taskId,
|
|
402
|
+
message: reply,
|
|
403
|
+
}));
|
|
397
404
|
break;
|
|
398
|
-
|
|
405
|
+
}
|
|
406
|
+
if (review)
|
|
407
|
+
void handleReviewReady(session, socket, taskId, instruction);
|
|
399
408
|
break;
|
|
409
|
+
}
|
|
400
410
|
case "error":
|
|
401
411
|
socket.send(JSON.stringify({
|
|
402
412
|
type: "agent_status",
|
|
@@ -979,8 +989,16 @@ async function startBridge(cwd = process.cwd(), collabConfig = null, bridgePort
|
|
|
979
989
|
}
|
|
980
990
|
// Handler for oneshot
|
|
981
991
|
async function handleOneshot(message, socket, cwd) {
|
|
982
|
-
const { taskId, prompt, model, provider } = message;
|
|
983
|
-
const
|
|
992
|
+
const { taskId, prompt, model, provider, messages, conversation } = message;
|
|
993
|
+
const runtimeConversation = toRuntimeConversation(conversation || messages);
|
|
994
|
+
const instruction = [...(runtimeConversation || [])]
|
|
995
|
+
.reverse()
|
|
996
|
+
.find((entry) => entry.role === "user")
|
|
997
|
+
?.content?.trim() || (typeof prompt === "string" ? prompt.trim() : "");
|
|
998
|
+
if (!instruction) {
|
|
999
|
+
socket.send(JSON.stringify({ type: "agent_status", taskId, status: "error", message: "A user message is required." }));
|
|
1000
|
+
return;
|
|
1001
|
+
}
|
|
984
1002
|
taskControllers.get(taskId)?.abort();
|
|
985
1003
|
const controller = new AbortController();
|
|
986
1004
|
taskControllers.set(taskId, controller);
|
|
@@ -990,7 +1008,10 @@ async function startBridge(cwd = process.cwd(), collabConfig = null, bridgePort
|
|
|
990
1008
|
const isLocalAgent = ["claude_code", "opencode", "codex_cli", "cursor"].includes(provider || "");
|
|
991
1009
|
const backendModelId = (0, backends_1.modelIdForBackend)(model || "", provider || "");
|
|
992
1010
|
const sessionInput = {
|
|
993
|
-
userPrompt:
|
|
1011
|
+
userPrompt: instruction,
|
|
1012
|
+
// The sidebar is the source of truth for history. The runtime prompt
|
|
1013
|
+
// is derived from its final user message rather than sent separately.
|
|
1014
|
+
conversation: runtimeConversation,
|
|
994
1015
|
project: {
|
|
995
1016
|
projectId,
|
|
996
1017
|
framework,
|
package/dist/overlay.js
CHANGED
|
@@ -19680,15 +19680,6 @@
|
|
|
19680
19680
|
} catch {
|
|
19681
19681
|
}
|
|
19682
19682
|
}
|
|
19683
|
-
async function createServerConversation(scope2 = "private") {
|
|
19684
|
-
const projectId = state.collab?.projectId || state.collabProjectId;
|
|
19685
|
-
if (!projectId) return null;
|
|
19686
|
-
const data6 = await apiFetch("/agent/conversations", {
|
|
19687
|
-
method: "POST",
|
|
19688
|
-
body: JSON.stringify({ projectId, scope: scope2, title: "New Session" })
|
|
19689
|
-
});
|
|
19690
|
-
return data6?.conversation?.id || null;
|
|
19691
|
-
}
|
|
19692
19683
|
async function loadConversationList() {
|
|
19693
19684
|
const projectId = state.collab?.projectId || state.collabProjectId;
|
|
19694
19685
|
try {
|
|
@@ -20437,10 +20428,7 @@
|
|
|
20437
20428
|
updateSubmitButton(false);
|
|
20438
20429
|
renderSuggestions();
|
|
20439
20430
|
renderMessages();
|
|
20440
|
-
|
|
20441
|
-
if (id) activeConversationId = id;
|
|
20442
|
-
loadConversationList();
|
|
20443
|
-
});
|
|
20431
|
+
void loadConversationList();
|
|
20444
20432
|
}
|
|
20445
20433
|
function updateSubmitButton(isWorking) {
|
|
20446
20434
|
if (!commandSubmit) return;
|
|
@@ -20590,11 +20578,6 @@ Please proceed directly with the implementation and code changes from this point
|
|
|
20590
20578
|
updateActiveTimerDisplay(activeMsg.thinking.durationSeconds);
|
|
20591
20579
|
}
|
|
20592
20580
|
}, 1e3);
|
|
20593
|
-
if (!activeConversationId) {
|
|
20594
|
-
createServerConversation().then((id) => {
|
|
20595
|
-
if (id) activeConversationId = id;
|
|
20596
|
-
});
|
|
20597
|
-
}
|
|
20598
20581
|
collabEmit("collab:action", {
|
|
20599
20582
|
sessionId: state.collabProjectId,
|
|
20600
20583
|
status: "building",
|
|
@@ -20604,16 +20587,13 @@ Please proceed directly with the implementation and code changes from this point
|
|
|
20604
20587
|
state.bridgeSocket.send(
|
|
20605
20588
|
JSON.stringify({
|
|
20606
20589
|
type: "oneshot",
|
|
20607
|
-
prompt,
|
|
20608
20590
|
taskId: taskId2,
|
|
20609
|
-
conversationId: activeConversationId || void 0,
|
|
20610
20591
|
scope: "project",
|
|
20611
20592
|
model: state.selectedModel.id,
|
|
20612
20593
|
provider: state.selectedModel.provider,
|
|
20613
|
-
// The
|
|
20614
|
-
//
|
|
20615
|
-
|
|
20616
|
-
messages: commandMessages.map((message, index) => ({ message, index })).filter(({ message, index }) => Boolean(message.content) && !message.error && index !== commandMessages.reduce((last, item, itemIndex) => item.role === "user" && item.content === prompt ? itemIndex : last, -1)).map(({ message }) => message).map((m) => ({ role: m.role, content: m.content }))
|
|
20594
|
+
// The conversation already includes the current user message. It is
|
|
20595
|
+
// the only prompt context sent to the runtime.
|
|
20596
|
+
conversation: commandMessages.filter((message) => Boolean(message.content) && !message.error).map((message) => ({ role: message.role, content: message.content, timestamp: message.timestamp }))
|
|
20617
20597
|
})
|
|
20618
20598
|
);
|
|
20619
20599
|
} else {
|
package/package.json
CHANGED