@lasso-ai/cli 2.1.16 → 2.1.17
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 -0
- package/dist/cli/bridge.js +19 -5
- package/dist/overlay.js +2 -4
- 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>;
|
|
@@ -149,6 +159,12 @@ 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
|
+
}>;
|
|
167
|
+
conversationId?: string;
|
|
152
168
|
taskId?: string;
|
|
153
169
|
} | {
|
|
154
170
|
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,7 +989,7 @@ 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;
|
|
992
|
+
const { taskId, prompt, model, provider, messages, conversation, conversationId } = message;
|
|
983
993
|
const instruction = prompt;
|
|
984
994
|
taskControllers.get(taskId)?.abort();
|
|
985
995
|
const controller = new AbortController();
|
|
@@ -991,6 +1001,10 @@ async function startBridge(cwd = process.cwd(), collabConfig = null, bridgePort
|
|
|
991
1001
|
const backendModelId = (0, backends_1.modelIdForBackend)(model || "", provider || "");
|
|
992
1002
|
const sessionInput = {
|
|
993
1003
|
userPrompt: prompt,
|
|
1004
|
+
// The sidebar is the source of truth for history. `conversation` is
|
|
1005
|
+
// preferred; `messages` remains a compatibility alias for older overlays.
|
|
1006
|
+
conversation: toRuntimeConversation(conversation || messages),
|
|
1007
|
+
conversationUid: conversationId || undefined,
|
|
994
1008
|
project: {
|
|
995
1009
|
projectId,
|
|
996
1010
|
framework,
|
package/dist/overlay.js
CHANGED
|
@@ -20591,9 +20591,7 @@ Please proceed directly with the implementation and code changes from this point
|
|
|
20591
20591
|
}
|
|
20592
20592
|
}, 1e3);
|
|
20593
20593
|
if (!activeConversationId) {
|
|
20594
|
-
createServerConversation()
|
|
20595
|
-
if (id) activeConversationId = id;
|
|
20596
|
-
});
|
|
20594
|
+
activeConversationId = await createServerConversation();
|
|
20597
20595
|
}
|
|
20598
20596
|
collabEmit("collab:action", {
|
|
20599
20597
|
sessionId: state.collabProjectId,
|
|
@@ -20613,7 +20611,7 @@ Please proceed directly with the implementation and code changes from this point
|
|
|
20613
20611
|
// The current prompt is sent in its dedicated `prompt` field. Keep it
|
|
20614
20612
|
// out of history so the model sees it once, not once as history and
|
|
20615
20613
|
// once as the active request.
|
|
20616
|
-
|
|
20614
|
+
conversation: 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 }) => ({ role: message.role, content: message.content, timestamp: message.timestamp }))
|
|
20617
20615
|
})
|
|
20618
20616
|
);
|
|
20619
20617
|
} else {
|
package/package.json
CHANGED