opencode-copilot-account-switcher 0.14.15 → 0.14.17

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.
@@ -25,5 +25,11 @@ type LaunchOptions = {
25
25
  pingImpl?: (endpoint: string) => Promise<boolean>;
26
26
  onLockAcquired?: (lock: LaunchLockContent) => void;
27
27
  };
28
+ type ResolveBrokerSpawnCommandOptions = {
29
+ execPath?: string;
30
+ };
31
+ type ResolveBrokerSpawnEnv = NodeJS.ProcessEnv;
32
+ export declare function resolveBrokerSpawnEnv(env?: ResolveBrokerSpawnEnv): NodeJS.ProcessEnv;
28
33
  export { createDefaultBrokerEndpoint };
34
+ export declare function resolveBrokerSpawnCommand(options?: ResolveBrokerSpawnCommandOptions): string;
29
35
  export declare function connectOrSpawnBroker(options?: LaunchOptions): Promise<BrokerMetadata>;
@@ -8,6 +8,12 @@ import { wechatStateRoot } from "./state-paths.js";
8
8
  import { parseEnvelopeLine, serializeEnvelope } from "./protocol.js";
9
9
  const DEFAULT_BACKOFF_MS = 250;
10
10
  const DEFAULT_MAX_ATTEMPTS = 20;
11
+ export function resolveBrokerSpawnEnv(env = process.env) {
12
+ return {
13
+ ...env,
14
+ BUN_BE_BUN: "1",
15
+ };
16
+ }
11
17
  function isNonEmptyString(value) {
12
18
  return typeof value === "string" && value.trim().length > 0;
13
19
  }
@@ -18,6 +24,10 @@ function delay(ms) {
18
24
  return new Promise((resolve) => setTimeout(resolve, ms));
19
25
  }
20
26
  export { createDefaultBrokerEndpoint };
27
+ export function resolveBrokerSpawnCommand(options = {}) {
28
+ const execPath = options.execPath ?? process.execPath;
29
+ return execPath;
30
+ }
21
31
  async function readCurrentPackageVersion() {
22
32
  try {
23
33
  const packageJsonPath = new URL("../../package.json", import.meta.url);
@@ -146,9 +156,10 @@ async function isBrokerAlive(brokerFilePath, pingImpl, expectedVersion) {
146
156
  }
147
157
  function defaultSpawnImpl(endpoint, stateRoot) {
148
158
  const entry = fileURLToPath(new URL("./broker-entry.js", import.meta.url));
149
- const child = spawn(process.execPath, [entry, `--endpoint=${endpoint}`, `--state-root=${stateRoot}`], {
159
+ const child = spawn(resolveBrokerSpawnCommand(), [entry, `--endpoint=${endpoint}`, `--state-root=${stateRoot}`], {
150
160
  cwd: path.resolve(fileURLToPath(new URL("../..", import.meta.url))),
151
161
  detached: true,
162
+ env: resolveBrokerSpawnEnv(process.env),
152
163
  stdio: "ignore",
153
164
  });
154
165
  child.unref();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-copilot-account-switcher",
3
- "version": "0.14.15",
3
+ "version": "0.14.17",
4
4
  "description": "GitHub Copilot account switcher plugin for OpenCode",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",