opencommand-plugin 0.0.7 → 0.0.9

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/README.md CHANGED
@@ -47,7 +47,10 @@ npm run build
47
47
  npm test -- --runInBand
48
48
  ```
49
49
 
50
- ## v0.0.6 non-blocking OpenCode startup
50
+ ## v0.0.8 non-blocking OpenCode startup
51
51
 
52
- `opencommand-plugin@0.0.6` keeps OpenCode startup non-blocking: provider registration uses cached/static models immediately, while proxy startup and CommandCode plan/model refresh run in the background. Pin `opencode.jsonc` to `opencommand-plugin@0.0.6` (or newer) instead of `@latest` to avoid stale plugin cache entries.
52
+ `opencommand-plugin@0.0.8` keeps OpenCode startup non-blocking: provider registration uses cached/static models immediately, while proxy startup and CommandCode plan/model refresh run in the background. Pin `opencode.jsonc` to `opencommand-plugin@0.0.8` (or newer) instead of `@latest` to avoid stale plugin cache entries.
53
53
 
54
+ ## v0.0.9 CommandCode protocol update
55
+
56
+ `opencommand-plugin@0.0.9` updates the bundled proxy to the current CommandCode CLI protocol headers (`x-command-code-version: 0.26.3`, production CLI environment, and OpenCommand project slug). Older `OPENCOMMAND_COMMAND_CODE_CLIENT_VERSION` overrides can no longer downgrade the bundled protocol version.
package/dist/index.d.ts CHANGED
@@ -77,7 +77,6 @@ export declare class BrowserCookieExtractor {
77
77
  export declare class OpenCommandPlugin {
78
78
  private proxyManager;
79
79
  private secretStorage;
80
- private cookieExtractor;
81
80
  private startPromise;
82
81
  private preloadPromise;
83
82
  private readonly commandCodeTokenKey;
@@ -92,7 +91,7 @@ export declare class OpenCommandPlugin {
92
91
  deactivate(): Promise<void>;
93
92
  getCurrentProxyConfig(): ProxyConfig | undefined;
94
93
  private loadCommandCodeToken;
95
- private loadSessionCookie;
94
+ private loadConfiguredSessionCookie;
96
95
  private saveOpenCodeConfig;
97
96
  private persistProxyConfig;
98
97
  setCommandCodeToken(token: string): Promise<void>;
@@ -126,7 +125,7 @@ export declare const OpenCommandOpenCodePlugin: () => Promise<{
126
125
  loader: () => Promise<{
127
126
  apiKey: string;
128
127
  baseURL: string;
129
- }>;
128
+ } | null>;
130
129
  methods: never[];
131
130
  };
132
131
  config: (config: OpenCodeConfig) => Promise<void>;
package/dist/index.js CHANGED
@@ -566,7 +566,6 @@ export class OpenCommandPlugin {
566
566
  this.proxyManager = new ProxyManager(proxyBinaryPath);
567
567
  const dir = storageDir || `${process.env.HOME || "/tmp"}/.opencommand`;
568
568
  this.secretStorage = new SecretStorage(dir);
569
- this.cookieExtractor = new BrowserCookieExtractor();
570
569
  }
571
570
  async activate() {
572
571
  debugLog("OpenCommand Plugin activating...");
@@ -621,10 +620,7 @@ export class OpenCommandPlugin {
621
620
  debugWarn("No COMMAND_CODE_TOKEN found. Please configure your CommandCode API key.");
622
621
  return undefined;
623
622
  }
624
- const sessionCookie = await this.loadSessionCookie();
625
- if (!sessionCookie) {
626
- debugWarn("No CommandCode Studio cookie found. Inference works, but usage scraping may be unavailable.");
627
- }
623
+ const sessionCookie = await this.loadConfiguredSessionCookie();
628
624
  const config = await this.proxyManager.start({
629
625
  commandCodeToken,
630
626
  sessionCookie,
@@ -647,16 +643,8 @@ export class OpenCommandPlugin {
647
643
  }
648
644
  return token;
649
645
  }
650
- async loadSessionCookie() {
651
- const configured = firstDefined(process.env.CC_SESSION_COOKIE, await this.secretStorage.get(this.sessionCookieKey));
652
- if (configured)
653
- return configured;
654
- const extracted = await this.cookieExtractor.extractCommandCodeCookie();
655
- if (extracted) {
656
- await this.secretStorage.set(this.sessionCookieKey, extracted);
657
- debugLog("✓ CommandCode Studio cookie discovered from local browser profile");
658
- }
659
- return extracted;
646
+ async loadConfiguredSessionCookie() {
647
+ return firstDefined(process.env.CC_SESSION_COOKIE, await this.secretStorage.get(this.sessionCookieKey));
660
648
  }
661
649
  saveOpenCodeConfig(config) {
662
650
  const proxyUrl = `http://localhost:${config.port}`;
@@ -697,7 +685,7 @@ export class OpenCommandPlugin {
697
685
  await this.proxyManager.stop();
698
686
  const config = await this.proxyManager.start({
699
687
  commandCodeToken,
700
- sessionCookie: await this.loadSessionCookie(),
688
+ sessionCookie: await this.loadConfiguredSessionCookie(),
701
689
  });
702
690
  this.saveOpenCodeConfig(config);
703
691
  }
@@ -907,21 +895,18 @@ export const OpenCommandOpenCodePlugin = async () => ({
907
895
  auth: {
908
896
  provider: PROVIDER_ID,
909
897
  loader: async () => {
910
- const runtime = getRuntimePlugin();
911
- const proxyConfig = runtime.getCurrentProxyConfig();
912
- runtime.preloadForOpenCode();
898
+ const proxyConfig = await getRuntimePlugin().ensureStarted();
899
+ if (!proxyConfig)
900
+ return null;
913
901
  return {
914
902
  apiKey: PROVIDER_API_KEY_PLACEHOLDER,
915
- baseURL: proxyConfig
916
- ? `http://localhost:${proxyConfig.port}/v1`
917
- : DEFAULT_PROXY_BASE_URL,
903
+ baseURL: `http://localhost:${proxyConfig.port}/v1`,
918
904
  };
919
905
  },
920
906
  methods: [],
921
907
  },
922
908
  config: async (config) => {
923
909
  registerOpenCommandProvider(config, DEFAULT_PROXY_BASE_URL, readCachedOpenCommandModels() ?? COMMAND_CODE_GO_PLAN_MODELS);
924
- getRuntimePlugin().preloadForOpenCode();
925
910
  },
926
911
  });
927
912
  export default OpenCommandOpenCodePlugin;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencommand-plugin",
3
- "version": "0.0.7",
3
+ "version": "0.0.9",
4
4
  "description": "OpenCommand - CommandCode API Plugin for OpenCode",
5
5
  "main": "./bin/opencode-plugin.js",
6
6
  "module": "./bin/opencode-plugin.js",