opencode-gitlab-duo-agentic 0.1.17 → 0.1.19

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 +16 -7
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -553,7 +553,7 @@ var WorkflowSession = class {
553
553
  #projectPath;
554
554
  #rootNamespaceId;
555
555
  #checkpoint = createCheckpointState();
556
- #running = false;
556
+ #pending = Promise.resolve();
557
557
  constructor(client, modelId) {
558
558
  this.#client = client;
559
559
  this.#tokenService = new WorkflowTokenService(client);
@@ -568,10 +568,11 @@ var WorkflowSession = class {
568
568
  this.#tokenService.clear();
569
569
  }
570
570
  async *runTurn(goal, abortSignal) {
571
- if (this.#running) {
572
- throw new Error("workflow session is already running");
573
- }
574
- this.#running = true;
571
+ await this.#pending;
572
+ let resolve;
573
+ this.#pending = new Promise((r) => {
574
+ resolve = r;
575
+ });
575
576
  const queue = new AsyncQueue();
576
577
  const socket = new WorkflowWebSocketClient({
577
578
  action: (action) => queue.push({ type: "action", action }),
@@ -646,9 +647,9 @@ var WorkflowSession = class {
646
647
  });
647
648
  }
648
649
  } finally {
649
- this.#running = false;
650
650
  abortSignal?.removeEventListener("abort", onAbort);
651
651
  socket.close();
652
+ resolve();
652
653
  }
653
654
  }
654
655
  async #createWorkflow(goal) {
@@ -837,11 +838,19 @@ function extractGoal(prompt) {
837
838
  const message = prompt[i];
838
839
  if (message.role !== "user") continue;
839
840
  const content = Array.isArray(message.content) ? message.content : [];
840
- const text2 = content.filter((part) => part.type === "text").map((part) => part.text).join("\n").trim();
841
+ const text2 = content.filter((part) => part.type === "text").map((part) => stripSystemReminders(part.text)).filter(Boolean).join("\n").trim();
841
842
  if (text2) return text2;
842
843
  }
843
844
  return "";
844
845
  }
846
+ var SYSTEM_REMINDER_RE = /<system-reminder>[\s\S]*?<\/system-reminder>/g;
847
+ var WRAPPED_USER_RE = /^<system-reminder>\s*The user sent the following message:\s*\n([\s\S]*?)\n\s*Please address this message and continue with your tasks\.\s*<\/system-reminder>$/;
848
+ function stripSystemReminders(value) {
849
+ return value.replace(SYSTEM_REMINDER_RE, (block) => {
850
+ const wrapped = WRAPPED_USER_RE.exec(block);
851
+ return wrapped?.[1]?.trim() ?? "";
852
+ }).trim();
853
+ }
845
854
  function readSessionID(options) {
846
855
  const providerBlock = readProviderBlock(options);
847
856
  if (typeof providerBlock?.workflowSessionID === "string" && providerBlock.workflowSessionID.trim()) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-gitlab-duo-agentic",
3
- "version": "0.1.17",
3
+ "version": "0.1.19",
4
4
  "description": "OpenCode plugin and provider for GitLab Duo Agentic workflows",
5
5
  "license": "MIT",
6
6
  "type": "module",