opencode-gitlab-duo-agentic 0.2.9 → 0.2.10

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 +13 -34
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -776,17 +776,6 @@ 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
-
790
779
  // src/workflow/session.ts
791
780
  var WorkflowSession = class {
792
781
  #client;
@@ -883,11 +872,7 @@ var WorkflowSession = class {
883
872
  * Send a tool result back to DWS on the existing connection.
884
873
  */
885
874
  sendToolResult(requestId, output, error) {
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"}`);
875
+ if (!this.#socket) throw new Error("Not connected");
891
876
  this.#socket.send({
892
877
  actionResponse: {
893
878
  requestID: requestId,
@@ -903,10 +888,7 @@ var WorkflowSession = class {
903
888
  * Returns null when the stream is closed (turn complete or connection lost).
904
889
  */
905
890
  async waitForEvent() {
906
- if (!this.#queue) {
907
- dlog("waitForEvent: queue=null");
908
- return null;
909
- }
891
+ if (!this.#queue) return null;
910
892
  return this.#queue.shift();
911
893
  }
912
894
  /**
@@ -928,7 +910,6 @@ var WorkflowSession = class {
928
910
  }
929
911
  const toolRequests = extractToolRequests(ckpt, this.#checkpoint);
930
912
  for (const req of toolRequests) {
931
- console.error(`[duo-workflow] checkpoint tool request: ${req.toolName} requestId=${req.requestId}`);
932
913
  queue.push({
933
914
  type: "tool-request",
934
915
  requestId: req.requestId,
@@ -945,7 +926,6 @@ var WorkflowSession = class {
945
926
  const toolAction = action;
946
927
  const mapped = mapActionToToolRequest(toolAction);
947
928
  if (mapped) {
948
- dlog(`action: standalone ${mapped.toolName} reqId=${mapped.requestId}`);
949
929
  queue.push({
950
930
  type: "tool-request",
951
931
  requestId: mapped.requestId,
@@ -1415,7 +1395,6 @@ var DuoWorkflowModel = class {
1415
1395
  const toolResults = extractToolResults(options.prompt);
1416
1396
  const session = this.#resolveSession(sessionID);
1417
1397
  const textId = randomUUID3();
1418
- dlog(`doStream: goal=${goal?.length ?? 0}chars, toolResults=${toolResults.length}, hasStarted=${session.hasStarted}`);
1419
1398
  if (sessionID !== this.#stateSessionId) {
1420
1399
  this.#pendingToolRequests.clear();
1421
1400
  this.#multiCallGroups.clear();
@@ -1469,11 +1448,9 @@ var DuoWorkflowModel = class {
1469
1448
  }
1470
1449
  const pending = model.#pendingToolRequests.get(result.toolCallId);
1471
1450
  if (!pending) {
1472
- dlog(`phase1: toolCallId=${result.toolCallId} pending=false SKIP`);
1473
1451
  model.#sentToolCallIds.add(result.toolCallId);
1474
1452
  continue;
1475
1453
  }
1476
- dlog(`phase1: toolCallId=${result.toolCallId} pending=true SEND output=${result.output.length}b`);
1477
1454
  session.sendToolResult(result.toolCallId, result.output, result.error);
1478
1455
  sentToolResults = true;
1479
1456
  model.#sentToolCallIds.add(result.toolCallId);
@@ -1524,10 +1501,7 @@ var DuoWorkflowModel = class {
1524
1501
  let hasText = false;
1525
1502
  while (true) {
1526
1503
  const event = await session.waitForEvent();
1527
- if (!event) {
1528
- dlog("phase3: event=null (queue closed)");
1529
- break;
1530
- }
1504
+ if (!event) break;
1531
1505
  if (event.type === "text-delta") {
1532
1506
  if (!event.value) continue;
1533
1507
  if (!hasText) {
@@ -1541,10 +1515,7 @@ var DuoWorkflowModel = class {
1541
1515
  let mapped;
1542
1516
  try {
1543
1517
  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}`);
1546
1518
  } catch {
1547
- dlog(`phase3: tool-request ${event.toolName} MAPPING FAILED`);
1548
1519
  continue;
1549
1520
  }
1550
1521
  if (hasText) {
@@ -1561,20 +1532,28 @@ var DuoWorkflowModel = class {
1561
1532
  model.#pendingToolRequests.set(subId, {});
1562
1533
  }
1563
1534
  for (let i = 0; i < mapped.length; i++) {
1535
+ const inputJson = JSON.stringify(mapped[i].args);
1536
+ controller.enqueue({ type: "tool-input-start", id: subIds[i], toolName: mapped[i].toolName });
1537
+ controller.enqueue({ type: "tool-input-delta", id: subIds[i], delta: inputJson });
1538
+ controller.enqueue({ type: "tool-input-end", id: subIds[i] });
1564
1539
  controller.enqueue({
1565
1540
  type: "tool-call",
1566
1541
  toolCallId: subIds[i],
1567
1542
  toolName: mapped[i].toolName,
1568
- input: JSON.stringify(mapped[i].args)
1543
+ input: inputJson
1569
1544
  });
1570
1545
  }
1571
1546
  } else {
1572
1547
  model.#pendingToolRequests.set(event.requestId, {});
1548
+ const inputJson = JSON.stringify(mapped.args);
1549
+ controller.enqueue({ type: "tool-input-start", id: event.requestId, toolName: mapped.toolName });
1550
+ controller.enqueue({ type: "tool-input-delta", id: event.requestId, delta: inputJson });
1551
+ controller.enqueue({ type: "tool-input-end", id: event.requestId });
1573
1552
  controller.enqueue({
1574
1553
  type: "tool-call",
1575
1554
  toolCallId: event.requestId,
1576
1555
  toolName: mapped.toolName,
1577
- input: JSON.stringify(mapped.args)
1556
+ input: inputJson
1578
1557
  });
1579
1558
  }
1580
1559
  controller.enqueue({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-gitlab-duo-agentic",
3
- "version": "0.2.9",
3
+ "version": "0.2.10",
4
4
  "description": "OpenCode plugin and provider for GitLab Duo Agentic workflows",
5
5
  "license": "MIT",
6
6
  "type": "module",