@engineeros/connector 0.8.4 → 0.8.6
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/bin/engineeros-connector.mjs +33 -0
- package/package.json +1 -1
- package/src/runner.mjs +38 -0
|
@@ -16,6 +16,8 @@ import {
|
|
|
16
16
|
executeConnectedPrompt,
|
|
17
17
|
executeWorkspaceAssessment,
|
|
18
18
|
inspectCodingAgent,
|
|
19
|
+
promptProgressMessage,
|
|
20
|
+
promptQueueMessage,
|
|
19
21
|
stopProcess,
|
|
20
22
|
workspaceSnapshot,
|
|
21
23
|
} from "../src/runner.mjs";
|
|
@@ -198,11 +200,16 @@ async function connect() {
|
|
|
198
200
|
return;
|
|
199
201
|
}
|
|
200
202
|
if (message.type === "prompt.execute") {
|
|
203
|
+
let added = false;
|
|
201
204
|
if (
|
|
202
205
|
active?.runId !== message.prompt_id &&
|
|
203
206
|
!prompts.some((candidate) => candidate.prompt_id === message.prompt_id)
|
|
204
207
|
) {
|
|
205
208
|
prompts.push(message);
|
|
209
|
+
added = true;
|
|
210
|
+
}
|
|
211
|
+
if (added && active) {
|
|
212
|
+
sendPromptProgress(message.prompt_id, promptQueueMessage(active.kind));
|
|
206
213
|
}
|
|
207
214
|
pump();
|
|
208
215
|
return;
|
|
@@ -344,6 +351,17 @@ function startPings() {
|
|
|
344
351
|
}, 10_000);
|
|
345
352
|
}
|
|
346
353
|
|
|
354
|
+
function sendPromptProgress(promptId, message) {
|
|
355
|
+
if (!message || socket.readyState !== WebSocket.OPEN) return;
|
|
356
|
+
socket.send(
|
|
357
|
+
JSON.stringify({
|
|
358
|
+
type: "prompt.progress",
|
|
359
|
+
prompt_id: promptId,
|
|
360
|
+
message: String(message).slice(0, 500),
|
|
361
|
+
}),
|
|
362
|
+
);
|
|
363
|
+
}
|
|
364
|
+
|
|
347
365
|
function pump() {
|
|
348
366
|
if (active || socket.readyState !== WebSocket.OPEN) return;
|
|
349
367
|
const prompt = prompts.shift();
|
|
@@ -385,6 +403,20 @@ function pump() {
|
|
|
385
403
|
|
|
386
404
|
async function executePrompt(assignment) {
|
|
387
405
|
const promptId = assignment.prompt_id;
|
|
406
|
+
let lastProgressMessage;
|
|
407
|
+
const reportProgress = (message) => {
|
|
408
|
+
if (
|
|
409
|
+
!message ||
|
|
410
|
+
message === lastProgressMessage ||
|
|
411
|
+
socket.readyState !== WebSocket.OPEN ||
|
|
412
|
+
active?.runId !== promptId
|
|
413
|
+
) {
|
|
414
|
+
return;
|
|
415
|
+
}
|
|
416
|
+
lastProgressMessage = message;
|
|
417
|
+
sendPromptProgress(promptId, message);
|
|
418
|
+
};
|
|
419
|
+
sendPromptProgress(promptId, "Coding agent started this request");
|
|
388
420
|
console.log(
|
|
389
421
|
`Answering ${assignment.purpose || "project"} prompt with ${codingAgent.name}.`,
|
|
390
422
|
);
|
|
@@ -393,6 +425,7 @@ async function executePrompt(assignment) {
|
|
|
393
425
|
onProcess: (child) => {
|
|
394
426
|
if (active?.runId === promptId) active.child = child;
|
|
395
427
|
},
|
|
428
|
+
onEvent: (event) => reportProgress(promptProgressMessage(event)),
|
|
396
429
|
});
|
|
397
430
|
config = {
|
|
398
431
|
...config,
|
package/package.json
CHANGED
package/src/runner.mjs
CHANGED
|
@@ -570,6 +570,44 @@ export function assessmentProgressMessage(event) {
|
|
|
570
570
|
return null;
|
|
571
571
|
}
|
|
572
572
|
|
|
573
|
+
export function promptProgressMessage(event) {
|
|
574
|
+
if (!event || typeof event !== "object") return null;
|
|
575
|
+
if (event.type === "turn.started")
|
|
576
|
+
return "Reviewing the request and workspace context";
|
|
577
|
+
if (event.type === "item.started") {
|
|
578
|
+
if (event.item?.type === "command_execution") {
|
|
579
|
+
return assessmentCommandMilestone(event.item.command);
|
|
580
|
+
}
|
|
581
|
+
if (event.item?.type === "mcp_tool_call")
|
|
582
|
+
return "Checking connected project evidence";
|
|
583
|
+
if (event.item?.type === "web_search")
|
|
584
|
+
return "Checking an external technical reference";
|
|
585
|
+
return null;
|
|
586
|
+
}
|
|
587
|
+
if (event.type === "item.completed" && event.item?.type === "agent_message") {
|
|
588
|
+
return "Preparing the response";
|
|
589
|
+
}
|
|
590
|
+
if (event.type === "agent.connected") return "Connected to the coding agent";
|
|
591
|
+
if (event.type === "acp.tool_call" || event.type === "acp.tool_call_update") {
|
|
592
|
+
return "Inspecting the workspace with the coding agent";
|
|
593
|
+
}
|
|
594
|
+
if (event.type === "acp.agent_message_chunk") return "Preparing the response";
|
|
595
|
+
return null;
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
export function promptQueueMessage(activeKind) {
|
|
599
|
+
if (activeKind === "assessment") {
|
|
600
|
+
return "Queued: coding agent is finishing the workspace assessment";
|
|
601
|
+
}
|
|
602
|
+
if (activeKind === "goal") {
|
|
603
|
+
return "Queued: coding agent is finishing an active Goal";
|
|
604
|
+
}
|
|
605
|
+
if (activeKind === "prompt") {
|
|
606
|
+
return "Queued: coding agent is finishing another request";
|
|
607
|
+
}
|
|
608
|
+
return "Coding agent accepted the request";
|
|
609
|
+
}
|
|
610
|
+
|
|
573
611
|
function assessmentCommandMilestone(command) {
|
|
574
612
|
const value = Array.isArray(command)
|
|
575
613
|
? command.join(" ")
|