opencode-gitlab-duo-agentic 0.2.7 → 0.2.8

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 (2) hide show
  1. package/dist/index.js +31 -5
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -776,6 +776,17 @@ function mapActionToToolRequest(action) {
776
776
  return null;
777
777
  }
778
778
 
779
+ // src/utils/debug-log.ts
780
+ import { appendFileSync } from "fs";
781
+ var LOG = "/tmp/duo-workflow-debug.log";
782
+ function dlog(msg) {
783
+ try {
784
+ appendFileSync(LOG, `[${(/* @__PURE__ */ new Date()).toISOString()}] ${msg}
785
+ `);
786
+ } catch {
787
+ }
788
+ }
789
+
779
790
  // src/workflow/session.ts
780
791
  var WorkflowSession = class {
781
792
  #client;
@@ -872,8 +883,11 @@ var WorkflowSession = class {
872
883
  * Send a tool result back to DWS on the existing connection.
873
884
  */
874
885
  sendToolResult(requestId, output, error) {
875
- if (!this.#socket) throw new Error("Not connected");
876
- console.error(`[duo-workflow] sendToolResult: requestId=${requestId} output=${output.length} bytes, error=${error ?? "none"}`);
886
+ if (!this.#socket) {
887
+ dlog(`sendToolResult: NOT CONNECTED reqId=${requestId}`);
888
+ throw new Error("Not connected");
889
+ }
890
+ dlog(`sendToolResult: reqId=${requestId} output=${output.length}b err=${error ?? "none"}`);
877
891
  this.#socket.send({
878
892
  actionResponse: {
879
893
  requestID: requestId,
@@ -889,7 +903,10 @@ var WorkflowSession = class {
889
903
  * Returns null when the stream is closed (turn complete or connection lost).
890
904
  */
891
905
  async waitForEvent() {
892
- if (!this.#queue) return null;
906
+ if (!this.#queue) {
907
+ dlog("waitForEvent: queue=null");
908
+ return null;
909
+ }
893
910
  return this.#queue.shift();
894
911
  }
895
912
  /**
@@ -928,7 +945,7 @@ var WorkflowSession = class {
928
945
  const toolAction = action;
929
946
  const mapped = mapActionToToolRequest(toolAction);
930
947
  if (mapped) {
931
- console.error(`[duo-workflow] ws tool request: ${mapped.toolName} requestId=${mapped.requestId}`);
948
+ dlog(`action: standalone ${mapped.toolName} reqId=${mapped.requestId}`);
932
949
  queue.push({
933
950
  type: "tool-request",
934
951
  requestId: mapped.requestId,
@@ -1398,6 +1415,7 @@ var DuoWorkflowModel = class {
1398
1415
  const toolResults = extractToolResults(options.prompt);
1399
1416
  const session = this.#resolveSession(sessionID);
1400
1417
  const textId = randomUUID3();
1418
+ dlog(`doStream: goal=${goal?.length ?? 0}chars, toolResults=${toolResults.length}, hasStarted=${session.hasStarted}`);
1401
1419
  if (sessionID !== this.#stateSessionId) {
1402
1420
  this.#pendingToolRequests.clear();
1403
1421
  this.#multiCallGroups.clear();
@@ -1451,9 +1469,11 @@ var DuoWorkflowModel = class {
1451
1469
  }
1452
1470
  const pending = model.#pendingToolRequests.get(result.toolCallId);
1453
1471
  if (!pending) {
1472
+ dlog(`phase1: toolCallId=${result.toolCallId} pending=false SKIP`);
1454
1473
  model.#sentToolCallIds.add(result.toolCallId);
1455
1474
  continue;
1456
1475
  }
1476
+ dlog(`phase1: toolCallId=${result.toolCallId} pending=true SEND output=${result.output.length}b`);
1457
1477
  session.sendToolResult(result.toolCallId, result.output, result.error);
1458
1478
  sentToolResults = true;
1459
1479
  model.#sentToolCallIds.add(result.toolCallId);
@@ -1504,7 +1524,10 @@ var DuoWorkflowModel = class {
1504
1524
  let hasText = false;
1505
1525
  while (true) {
1506
1526
  const event = await session.waitForEvent();
1507
- if (!event) break;
1527
+ if (!event) {
1528
+ dlog("phase3: event=null (queue closed)");
1529
+ break;
1530
+ }
1508
1531
  if (event.type === "text-delta") {
1509
1532
  if (!event.value) continue;
1510
1533
  if (!hasText) {
@@ -1518,7 +1541,10 @@ var DuoWorkflowModel = class {
1518
1541
  let mapped;
1519
1542
  try {
1520
1543
  mapped = mapDuoToolRequest(event.toolName, event.args);
1544
+ const name = Array.isArray(mapped) ? mapped.map((m) => m.toolName).join(",") : mapped.toolName;
1545
+ dlog(`phase3: tool-request ${event.toolName} \u2192 ${name} reqId=${event.requestId}`);
1521
1546
  } catch {
1547
+ dlog(`phase3: tool-request ${event.toolName} MAPPING FAILED`);
1522
1548
  continue;
1523
1549
  }
1524
1550
  if (hasText) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-gitlab-duo-agentic",
3
- "version": "0.2.7",
3
+ "version": "0.2.8",
4
4
  "description": "OpenCode plugin and provider for GitLab Duo Agentic workflows",
5
5
  "license": "MIT",
6
6
  "type": "module",