opencode-gitlab-dap 1.1.0 → 1.1.2

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.
package/dist/index.js CHANGED
@@ -2714,23 +2714,9 @@ function resolveModelId(entry) {
2714
2714
  }
2715
2715
 
2716
2716
  // src/index.ts
2717
- import { readFileSync, appendFileSync } from "fs";
2717
+ import { readFileSync } from "fs";
2718
2718
  import { join } from "path";
2719
2719
  import os from "os";
2720
- var logFile = join(
2721
- process.env.XDG_DATA_HOME ?? join(os.homedir(), ".local", "share"),
2722
- "opencode",
2723
- "log",
2724
- "gitlab-dap.log"
2725
- );
2726
- function log(...args) {
2727
- const line = `${(/* @__PURE__ */ new Date()).toISOString()} ${args.map(String).join(" ")}
2728
- `;
2729
- try {
2730
- appendFileSync(logFile, line);
2731
- } catch {
2732
- }
2733
- }
2734
2720
  function readAuth() {
2735
2721
  try {
2736
2722
  const authPath = join(os.homedir(), ".local", "share", "opencode", "auth.json");
@@ -2747,32 +2733,23 @@ function readAuth() {
2747
2733
  }
2748
2734
  var memo = /* @__PURE__ */ new Map();
2749
2735
  var plugin = async (input) => {
2750
- log("plugin init, directory:", input.directory);
2751
2736
  async function load2() {
2752
2737
  const auth = readAuth();
2753
- log("readAuth result:", auth ? `instanceUrl=${auth.instanceUrl}` : "null");
2754
2738
  if (!auth) return null;
2755
2739
  const { token, instanceUrl } = auth;
2756
- log("instanceUrl:", instanceUrl);
2757
2740
  const cache = new GitLabModelCache(input.directory, instanceUrl);
2758
2741
  const entry = cache.load();
2759
- log(
2760
- "cache entry:",
2761
- entry ? `discovery=${!!entry.discovery} projectId=${entry.project?.id}` : "null"
2762
- );
2763
2742
  if (!entry?.discovery) return null;
2764
2743
  const projectId = entry.project?.id;
2765
2744
  if (!projectId) return null;
2766
2745
  const key = `${input.directory}\0${instanceUrl}`;
2767
2746
  const cached = memo.get(key);
2768
2747
  const agents = cached ?? await fetchCatalogAgents(instanceUrl, token, `gid://gitlab/Project/${projectId}`);
2769
- log("agents fetched:", agents.length);
2770
2748
  if (!cached) memo.set(key, agents);
2771
2749
  return { agents, entry };
2772
2750
  }
2773
2751
  return {
2774
2752
  async config(cfg) {
2775
- log("config hook called");
2776
2753
  const result = await load2();
2777
2754
  if (!result?.agents.length) return;
2778
2755
  const baseModelId = resolveModelId(result.entry);
@@ -2787,14 +2764,11 @@ var plugin = async (input) => {
2787
2764
  workflowDefinition: agent.workflowDefinition,
2788
2765
  flowConfig: agent.flowConfig,
2789
2766
  flowConfigSchemaVersion: agent.flowConfigSchemaVersion,
2790
- // numeric version ID passed as ai_catalog_item_version_id in createWorkflow
2791
- // so GitLab UI links the session to the correct custom agent page
2792
2767
  aiCatalogItemVersionId: agent.catalogItemVersionId
2793
2768
  },
2794
2769
  permission: { "*": "allow" }
2795
2770
  };
2796
2771
  }
2797
- log("config hook injected:", result.agents.map((a) => a.name).join(", "));
2798
2772
  }
2799
2773
  };
2800
2774
  };