opencode-gitlab-duo-agentic 0.1.6 → 0.1.7

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 +11 -4
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1209,7 +1209,6 @@ var GitLabDuoAgenticLanguageModel = class {
1209
1209
  #agentMode;
1210
1210
  #agentModeReminder;
1211
1211
  #usageEstimator = new TokenUsageEstimator();
1212
- #streaming = false;
1213
1212
  constructor(modelId, options, runtime) {
1214
1213
  this.modelId = modelId;
1215
1214
  this.#options = options;
@@ -1239,11 +1238,10 @@ var GitLabDuoAgenticLanguageModel = class {
1239
1238
  }
1240
1239
  async doStream(options) {
1241
1240
  const promptText = extractLastUserText(options.prompt);
1242
- if (this.#streaming) {
1241
+ if (!this.#runtime.tryAcquireStreamLock()) {
1243
1242
  duoLog("--- doStream BUSY (rejected)", "prompt=" + (promptText?.slice(0, 40) ?? "null"));
1244
1243
  return { stream: emptyFinishStream() };
1245
1244
  }
1246
- this.#streaming = true;
1247
1245
  const workflowType = "chat";
1248
1246
  const toolResults = extractToolResults(options.prompt);
1249
1247
  duoLog("--- doStream", "hasStarted=" + this.#runtime.hasStarted, "prompt=" + (promptText?.slice(0, 60) ?? "null"));
@@ -1451,7 +1449,7 @@ var GitLabDuoAgenticLanguageModel = class {
1451
1449
  yield { type: "error", error: streamErr instanceof Error ? streamErr : new Error(String(streamErr)) };
1452
1450
  return;
1453
1451
  } finally {
1454
- this.#streaming = false;
1452
+ this.#runtime.releaseStreamLock();
1455
1453
  }
1456
1454
  duoLog("finish", "events=" + eventCount);
1457
1455
  yield { type: "finish", finishReason: "stop", usage: this.#currentUsage };
@@ -1886,6 +1884,7 @@ var GitLabAgenticRuntime = class {
1886
1884
  #mapper = new WorkflowEventMapper();
1887
1885
  #containerParams;
1888
1886
  #startRequestSent = false;
1887
+ #streamingLock = false;
1889
1888
  constructor(options, dependencies) {
1890
1889
  this.#options = options;
1891
1890
  this.#dependencies = dependencies;
@@ -1901,6 +1900,14 @@ var GitLabAgenticRuntime = class {
1901
1900
  this.#selectedModelIdentifier = ref;
1902
1901
  this.#resetStreamState();
1903
1902
  }
1903
+ tryAcquireStreamLock() {
1904
+ if (this.#streamingLock) return false;
1905
+ this.#streamingLock = true;
1906
+ return true;
1907
+ }
1908
+ releaseStreamLock() {
1909
+ this.#streamingLock = false;
1910
+ }
1904
1911
  resetMapperState() {
1905
1912
  this.#mapper.resetStreamState();
1906
1913
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-gitlab-duo-agentic",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "OpenCode plugin and provider for GitLab Duo Agentic workflows",
5
5
  "license": "MIT",
6
6
  "type": "module",