opencode-gitlab-duo-agentic 0.2.11 → 0.2.12

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 +28 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -784,6 +784,17 @@ function mapActionToToolRequest(action) {
784
784
  return null;
785
785
  }
786
786
 
787
+ // src/utils/debug-log.ts
788
+ import { appendFileSync } from "fs";
789
+ var LOG = "/tmp/duo-workflow-debug.log";
790
+ function dlog(msg) {
791
+ try {
792
+ appendFileSync(LOG, `[${(/* @__PURE__ */ new Date()).toISOString()}] ${msg}
793
+ `);
794
+ } catch {
795
+ }
796
+ }
797
+
787
798
  // src/workflow/session.ts
788
799
  var WorkflowSession = class {
789
800
  #client;
@@ -880,6 +891,7 @@ var WorkflowSession = class {
880
891
  * Send a tool result back to DWS on the existing connection.
881
892
  */
882
893
  sendToolResult(requestId, output, error) {
894
+ dlog(`sendToolResult: reqId=${requestId} output=${output.length}b socket=${!!this.#socket}`);
883
895
  if (!this.#socket) throw new Error("Not connected");
884
896
  this.#socket.send({
885
897
  actionResponse: {
@@ -925,15 +937,20 @@ var WorkflowSession = class {
925
937
  args: req.args
926
938
  });
927
939
  }
928
- if (isTurnComplete(action.newCheckpoint.status) && !isAwaitingResponse(action.newCheckpoint.status)) {
940
+ const status = action.newCheckpoint.status;
941
+ if (isTurnComplete(status) && !isAwaitingResponse(status)) {
942
+ dlog(`action: checkpoint status=${status} CLOSE`);
929
943
  queue.close();
930
944
  this.#closeConnection();
945
+ } else {
946
+ dlog(`action: checkpoint status=${status} KEEP-ALIVE`);
931
947
  }
932
948
  return;
933
949
  }
934
950
  const toolAction = action;
935
951
  const mapped = mapActionToToolRequest(toolAction);
936
952
  if (mapped) {
953
+ dlog(`action: standalone ${mapped.toolName} reqId=${mapped.requestId}`);
937
954
  queue.push({
938
955
  type: "tool-request",
939
956
  requestId: mapped.requestId,
@@ -1403,6 +1420,7 @@ var DuoWorkflowModel = class {
1403
1420
  const toolResults = extractToolResults(options.prompt);
1404
1421
  const session = this.#resolveSession(sessionID);
1405
1422
  const textId = randomUUID3();
1423
+ dlog(`doStream: goal=${goal?.length ?? 0}ch toolResults=${toolResults.length} hasStarted=${session.hasStarted} pending=${this.#pendingToolRequests.size} sent=${this.#sentToolCallIds.size}`);
1406
1424
  if (sessionID !== this.#stateSessionId) {
1407
1425
  this.#pendingToolRequests.clear();
1408
1426
  this.#multiCallGroups.clear();
@@ -1433,6 +1451,10 @@ var DuoWorkflowModel = class {
1433
1451
  const freshResults = toolResults.filter(
1434
1452
  (r) => !model.#sentToolCallIds.has(r.toolCallId)
1435
1453
  );
1454
+ dlog(`phase1: ${toolResults.length} total, ${freshResults.length} fresh, sentIds=${[...model.#sentToolCallIds].join(",")}`);
1455
+ for (const r of toolResults) {
1456
+ dlog(` tr: id=${r.toolCallId} inSent=${model.#sentToolCallIds.has(r.toolCallId)} inPending=${model.#pendingToolRequests.has(r.toolCallId)} out=${r.output.length}b`);
1457
+ }
1436
1458
  let sentToolResults = false;
1437
1459
  for (const result of freshResults) {
1438
1460
  const hashIdx = result.toolCallId.indexOf("#");
@@ -1457,9 +1479,11 @@ var DuoWorkflowModel = class {
1457
1479
  }
1458
1480
  const pending = model.#pendingToolRequests.get(result.toolCallId);
1459
1481
  if (!pending) {
1482
+ dlog(`phase1: SKIP ${result.toolCallId} (not pending)`);
1460
1483
  model.#sentToolCallIds.add(result.toolCallId);
1461
1484
  continue;
1462
1485
  }
1486
+ dlog(`phase1: SEND ${result.toolCallId} output=${result.output.length}b`);
1463
1487
  session.sendToolResult(result.toolCallId, result.output, result.error);
1464
1488
  sentToolResults = true;
1465
1489
  model.#sentToolCallIds.add(result.toolCallId);
@@ -1525,8 +1549,11 @@ var DuoWorkflowModel = class {
1525
1549
  try {
1526
1550
  mapped = mapDuoToolRequest(event.toolName, event.args);
1527
1551
  } catch {
1552
+ dlog(`phase3: MAPPING FAILED ${event.toolName}`);
1528
1553
  continue;
1529
1554
  }
1555
+ const mName = Array.isArray(mapped) ? mapped.map((m) => m.toolName).join(",") : mapped.toolName;
1556
+ dlog(`phase3: tool-request ${event.toolName} \u2192 ${mName} reqId=${event.requestId}`);
1530
1557
  if (hasText) {
1531
1558
  controller.enqueue({ type: "text-end", id: textId });
1532
1559
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-gitlab-duo-agentic",
3
- "version": "0.2.11",
3
+ "version": "0.2.12",
4
4
  "description": "OpenCode plugin and provider for GitLab Duo Agentic workflows",
5
5
  "license": "MIT",
6
6
  "type": "module",