opencode-gitlab-duo-agentic 0.1.16 → 0.1.18

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 -10
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -298,6 +298,7 @@ async function applyRuntimeConfig(config, directory) {
298
298
  const models = toModelsConfig(available);
299
299
  config.provider[PROVIDER_ID] = {
300
300
  ...current,
301
+ npm: "opencode-gitlab-duo-agentic",
301
302
  whitelist: modelIds,
302
303
  options: {
303
304
  ...options,
@@ -552,7 +553,7 @@ var WorkflowSession = class {
552
553
  #projectPath;
553
554
  #rootNamespaceId;
554
555
  #checkpoint = createCheckpointState();
555
- #running = false;
556
+ #pending = Promise.resolve();
556
557
  constructor(client, modelId) {
557
558
  this.#client = client;
558
559
  this.#tokenService = new WorkflowTokenService(client);
@@ -567,10 +568,11 @@ var WorkflowSession = class {
567
568
  this.#tokenService.clear();
568
569
  }
569
570
  async *runTurn(goal, abortSignal) {
570
- if (this.#running) {
571
- throw new Error("workflow session is already running");
572
- }
573
- this.#running = true;
571
+ await this.#pending;
572
+ let resolve;
573
+ this.#pending = new Promise((r) => {
574
+ resolve = r;
575
+ });
574
576
  const queue = new AsyncQueue();
575
577
  const socket = new WorkflowWebSocketClient({
576
578
  action: (action) => queue.push({ type: "action", action }),
@@ -645,9 +647,9 @@ var WorkflowSession = class {
645
647
  });
646
648
  }
647
649
  } finally {
648
- this.#running = false;
649
650
  abortSignal?.removeEventListener("abort", onAbort);
650
651
  socket.close();
652
+ resolve();
651
653
  }
652
654
  }
653
655
  async #createWorkflow(goal) {
@@ -870,12 +872,13 @@ function readProviderBlock(options) {
870
872
  function createFallbackProvider(input = {}) {
871
873
  const instanceUrl = normalizeInstanceUrl(input.instanceUrl ?? envInstanceUrl());
872
874
  const token = text(input.apiKey) ?? text(input.token) ?? process.env.GITLAB_TOKEN ?? process.env.GITLAB_OAUTH_TOKEN ?? "";
875
+ const client = { instanceUrl, token };
873
876
  return {
874
877
  languageModel(modelId) {
875
- return new DuoWorkflowModel(modelId, {
876
- instanceUrl,
877
- token
878
- });
878
+ return new DuoWorkflowModel(modelId, client);
879
+ },
880
+ agenticChat(modelId, _options) {
881
+ return new DuoWorkflowModel(modelId, client);
879
882
  },
880
883
  textEmbeddingModel(modelId) {
881
884
  throw new NoSuchModelError({ modelId, modelType: "textEmbeddingModel" });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-gitlab-duo-agentic",
3
- "version": "0.1.16",
3
+ "version": "0.1.18",
4
4
  "description": "OpenCode plugin and provider for GitLab Duo Agentic workflows",
5
5
  "license": "MIT",
6
6
  "type": "module",