@route_33/opencode 0.4.7-rc.8 → 0.4.7-rc.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.
@@ -228,7 +228,6 @@ var createAuthSession = (options) => {
228
228
  };
229
229
 
230
230
  // src/auth/open-browser-and-capture/open-browser-and-capture.ts
231
- import { spawn } from "node:child_process";
232
231
  import { timingSafeEqual } from "node:crypto";
233
232
 
234
233
  // src/auth/loopback-callback/loopback-callback.ts
@@ -343,29 +342,38 @@ var createAuthLoopbackCallback = async () => {
343
342
  };
344
343
  };
345
344
 
345
+ // src/auth/open-system-browser/open-system-browser.ts
346
+ import { spawn } from "node:child_process";
347
+ var openSystemBrowser = async (url, options = {}) => new Promise((resolve, reject) => {
348
+ let command = "xdg-open";
349
+ let args = [url.href];
350
+ if (process.platform === "darwin") {
351
+ command = "open";
352
+ } else if (process.platform === "win32") {
353
+ command = "cmd";
354
+ args = ["/c", "start", "", url.href];
355
+ }
356
+ if (options.spawnUrl !== void 0) {
357
+ options.spawnUrl(command, args, { detached: true, stdio: "ignore" });
358
+ resolve();
359
+ return;
360
+ }
361
+ const child = spawn(command, args, {
362
+ detached: true,
363
+ stdio: "ignore"
364
+ });
365
+ child.once("error", reject);
366
+ child.once("spawn", () => {
367
+ child.unref();
368
+ resolve();
369
+ });
370
+ });
371
+
346
372
  // src/auth/open-browser-and-capture/open-browser-and-capture.ts
347
373
  var openBrowserAndCapture = async (options) => {
348
374
  const callback = await createAuthLoopbackCallback();
349
375
  const authorizationUrl = options.authorizationUrl(callback.redirectUri);
350
- const browserRunner = options.browserRunner ?? ((url) => new Promise((resolve, reject) => {
351
- let command = "xdg-open";
352
- let args = [url.href];
353
- if (process.platform === "darwin") {
354
- command = "open";
355
- } else if (process.platform === "win32") {
356
- command = "cmd";
357
- args = ["/c", "start", "", url.href];
358
- }
359
- const child = spawn(command, args, {
360
- detached: true,
361
- stdio: "ignore"
362
- });
363
- child.once("error", reject);
364
- child.once("spawn", () => {
365
- child.unref();
366
- resolve();
367
- });
368
- }));
376
+ const browserRunner = options.browserRunner ?? ((url) => openSystemBrowser(url));
369
377
  let timer;
370
378
  const timeout = new Promise((_resolve, reject) => {
371
379
  timer = setTimeout(() => {
package/dist/index.js CHANGED
@@ -262,7 +262,6 @@ var resolveCacheDir = (env) => {
262
262
  };
263
263
 
264
264
  // src/auth/open-browser-and-capture/open-browser-and-capture.ts
265
- import { spawn } from "node:child_process";
266
265
  import { timingSafeEqual } from "node:crypto";
267
266
 
268
267
  // src/auth/loopback-callback/loopback-callback.ts
@@ -377,29 +376,38 @@ var createAuthLoopbackCallback = async () => {
377
376
  };
378
377
  };
379
378
 
379
+ // src/auth/open-system-browser/open-system-browser.ts
380
+ import { spawn } from "node:child_process";
381
+ var openSystemBrowser = async (url, options = {}) => new Promise((resolve2, reject) => {
382
+ let command = "xdg-open";
383
+ let args = [url.href];
384
+ if (process.platform === "darwin") {
385
+ command = "open";
386
+ } else if (process.platform === "win32") {
387
+ command = "cmd";
388
+ args = ["/c", "start", "", url.href];
389
+ }
390
+ if (options.spawnUrl !== void 0) {
391
+ options.spawnUrl(command, args, { detached: true, stdio: "ignore" });
392
+ resolve2();
393
+ return;
394
+ }
395
+ const child = spawn(command, args, {
396
+ detached: true,
397
+ stdio: "ignore"
398
+ });
399
+ child.once("error", reject);
400
+ child.once("spawn", () => {
401
+ child.unref();
402
+ resolve2();
403
+ });
404
+ });
405
+
380
406
  // src/auth/open-browser-and-capture/open-browser-and-capture.ts
381
407
  var openBrowserAndCapture = async (options) => {
382
408
  const callback = await createAuthLoopbackCallback();
383
409
  const authorizationUrl = options.authorizationUrl(callback.redirectUri);
384
- const browserRunner = options.browserRunner ?? ((url) => new Promise((resolve2, reject) => {
385
- let command = "xdg-open";
386
- let args = [url.href];
387
- if (process.platform === "darwin") {
388
- command = "open";
389
- } else if (process.platform === "win32") {
390
- command = "cmd";
391
- args = ["/c", "start", "", url.href];
392
- }
393
- const child = spawn(command, args, {
394
- detached: true,
395
- stdio: "ignore"
396
- });
397
- child.once("error", reject);
398
- child.once("spawn", () => {
399
- child.unref();
400
- resolve2();
401
- });
402
- }));
410
+ const browserRunner = options.browserRunner ?? ((url) => openSystemBrowser(url));
403
411
  let timer;
404
412
  const timeout = new Promise((_resolve, reject) => {
405
413
  timer = setTimeout(() => {
@@ -3161,7 +3169,7 @@ var Route33Runtime = class {
3161
3169
  if (typeof client !== "function") {
3162
3170
  return client;
3163
3171
  }
3164
- this.#managementClient ??= client(() => this.#session.credential());
3172
+ this.#managementClient ??= client();
3165
3173
  return this.#managementClient;
3166
3174
  }
3167
3175
  #subject(credential) {
@@ -3751,20 +3759,20 @@ var HttpManagementKeys = class {
3751
3759
 
3752
3760
  // src/lazy-management-keys/lazy-management-keys.ts
3753
3761
  var lazyManagementKeys = (options) => {
3754
- const client = async () => new HttpManagementKeys({
3762
+ const client = (accessToken) => new HttpManagementKeys({
3755
3763
  baseUrl: options.apiBaseUrl,
3756
- credential: await options.obtainCredential(),
3764
+ credential: accessToken,
3757
3765
  ...options.fetchImpl === void 0 ? {} : { fetchImpl: options.fetchImpl }
3758
3766
  });
3759
3767
  return {
3760
- create: async (accessToken, input) => (await client()).create(accessToken, input),
3761
- delete: async (accessToken, id) => (await client()).delete(accessToken, id),
3762
- get: async (accessToken, id) => (await client()).get(accessToken, id),
3763
- list: async (accessToken) => (await client()).list(accessToken),
3764
- listOrganizations: async (accessToken) => (await client()).listOrganizations(accessToken),
3765
- listProjects: async (accessToken, organisationId) => (await client()).listProjects(accessToken, organisationId),
3766
- regenerate: async (accessToken, id, expiresAt) => (await client()).regenerate(accessToken, id, expiresAt),
3767
- update: async (accessToken, id, input) => (await client()).update(accessToken, id, input)
3768
+ create: async (accessToken, input) => client(accessToken).create(accessToken, input),
3769
+ delete: async (accessToken, id) => client(accessToken).delete(accessToken, id),
3770
+ get: async (accessToken, id) => client(accessToken).get(accessToken, id),
3771
+ list: async (accessToken) => client(accessToken).list(accessToken),
3772
+ listOrganizations: async (accessToken) => client(accessToken).listOrganizations(accessToken),
3773
+ listProjects: async (accessToken, organisationId) => client(accessToken).listProjects(accessToken, organisationId),
3774
+ regenerate: async (accessToken, id, expiresAt) => client(accessToken).regenerate(accessToken, id, expiresAt),
3775
+ update: async (accessToken, id, input) => client(accessToken).update(accessToken, id, input)
3768
3776
  };
3769
3777
  };
3770
3778
 
@@ -3780,10 +3788,7 @@ var buildProductionRuntimeOptions = (input) => ({
3780
3788
  timeoutMs: LOGIN_BUDGET_MS
3781
3789
  },
3782
3790
  management: {
3783
- client: (obtainCredential) => lazyManagementKeys({
3784
- apiBaseUrl: input.apiBaseUrl,
3785
- obtainCredential
3786
- })
3791
+ client: () => lazyManagementKeys({ apiBaseUrl: input.apiBaseUrl })
3787
3792
  },
3788
3793
  ...input.tokenStore === void 0 ? {} : { tokenStore: input.tokenStore }
3789
3794
  });
@@ -3812,14 +3817,16 @@ var FALLBACK_URL = "https://route33.ai";
3812
3817
  var SIGN_IN_INSTRUCTIONS = "Open the Route 33 sign-in link \u2014 your browser will finish at a confirmation page.";
3813
3818
  var FINISHING_INSTRUCTIONS = "Finishing Route 33 setup\u2026";
3814
3819
  var URL_WAIT_BUDGET_MS = 3e4;
3815
- var createAuthorizationUrlStash = () => {
3820
+ var createAuthorizationUrlStash = (options = {}) => {
3821
+ const open = options.open ?? ((url) => openSystemBrowser(url));
3822
+ const waitBudgetMs = options.waitBudgetMs ?? URL_WAIT_BUDGET_MS;
3816
3823
  let resolveUrl;
3817
3824
  const nextUrl = new Promise((resolve2) => {
3818
3825
  resolveUrl = resolve2;
3819
3826
  });
3820
3827
  const browserRunner = (url) => {
3821
3828
  resolveUrl?.(url);
3822
- return Promise.resolve();
3829
+ return open(url);
3823
3830
  };
3824
3831
  const urlForConnect = async (callback) => {
3825
3832
  let decide;
@@ -3828,7 +3835,7 @@ var createAuthorizationUrlStash = () => {
3828
3835
  });
3829
3836
  const timer = setTimeout(() => {
3830
3837
  decide({ instructions: SIGN_IN_INSTRUCTIONS, url: FALLBACK_URL });
3831
- }, URL_WAIT_BUDGET_MS);
3838
+ }, waitBudgetMs);
3832
3839
  void nextUrl.then((url) => {
3833
3840
  clearTimeout(timer);
3834
3841
  decide({ instructions: SIGN_IN_INSTRUCTIONS, url: url.toString() });
@@ -1149,8 +1149,48 @@ var init_loopback_callback2 = __esm({
1149
1149
  }
1150
1150
  });
1151
1151
 
1152
- // src/auth/open-browser-and-capture/open-browser-and-capture.ts
1152
+ // src/auth/open-system-browser/open-system-browser.ts
1153
1153
  import { spawn } from "node:child_process";
1154
+ var openSystemBrowser;
1155
+ var init_open_system_browser = __esm({
1156
+ "src/auth/open-system-browser/open-system-browser.ts"() {
1157
+ "use strict";
1158
+ openSystemBrowser = async (url, options = {}) => new Promise((resolve2, reject) => {
1159
+ let command = "xdg-open";
1160
+ let args = [url.href];
1161
+ if (process.platform === "darwin") {
1162
+ command = "open";
1163
+ } else if (process.platform === "win32") {
1164
+ command = "cmd";
1165
+ args = ["/c", "start", "", url.href];
1166
+ }
1167
+ if (options.spawnUrl !== void 0) {
1168
+ options.spawnUrl(command, args, { detached: true, stdio: "ignore" });
1169
+ resolve2();
1170
+ return;
1171
+ }
1172
+ const child = spawn(command, args, {
1173
+ detached: true,
1174
+ stdio: "ignore"
1175
+ });
1176
+ child.once("error", reject);
1177
+ child.once("spawn", () => {
1178
+ child.unref();
1179
+ resolve2();
1180
+ });
1181
+ });
1182
+ }
1183
+ });
1184
+
1185
+ // src/auth/open-system-browser/index.ts
1186
+ var init_open_system_browser2 = __esm({
1187
+ "src/auth/open-system-browser/index.ts"() {
1188
+ "use strict";
1189
+ init_open_system_browser();
1190
+ }
1191
+ });
1192
+
1193
+ // src/auth/open-browser-and-capture/open-browser-and-capture.ts
1154
1194
  import { timingSafeEqual } from "node:crypto";
1155
1195
  var openBrowserAndCapture;
1156
1196
  var init_open_browser_and_capture = __esm({
@@ -1158,28 +1198,11 @@ var init_open_browser_and_capture = __esm({
1158
1198
  "use strict";
1159
1199
  init_auth_error2();
1160
1200
  init_loopback_callback2();
1201
+ init_open_system_browser2();
1161
1202
  openBrowserAndCapture = async (options) => {
1162
1203
  const callback = await createAuthLoopbackCallback();
1163
1204
  const authorizationUrl = options.authorizationUrl(callback.redirectUri);
1164
- const browserRunner = options.browserRunner ?? ((url) => new Promise((resolve2, reject) => {
1165
- let command = "xdg-open";
1166
- let args = [url.href];
1167
- if (process.platform === "darwin") {
1168
- command = "open";
1169
- } else if (process.platform === "win32") {
1170
- command = "cmd";
1171
- args = ["/c", "start", "", url.href];
1172
- }
1173
- const child = spawn(command, args, {
1174
- detached: true,
1175
- stdio: "ignore"
1176
- });
1177
- child.once("error", reject);
1178
- child.once("spawn", () => {
1179
- child.unref();
1180
- resolve2();
1181
- });
1182
- }));
1205
+ const browserRunner = options.browserRunner ?? ((url) => openSystemBrowser(url));
1183
1206
  let timer;
1184
1207
  const timeout = new Promise((_resolve, reject) => {
1185
1208
  timer = setTimeout(() => {
@@ -6132,7 +6155,7 @@ var init_route33_runtime = __esm({
6132
6155
  if (typeof client !== "function") {
6133
6156
  return client;
6134
6157
  }
6135
- this.#managementClient ??= client(() => this.#session.credential());
6158
+ this.#managementClient ??= client();
6136
6159
  return this.#managementClient;
6137
6160
  }
6138
6161
  #subject(credential) {
@@ -6816,20 +6839,20 @@ var HttpManagementKeys = class {
6816
6839
 
6817
6840
  // src/lazy-management-keys/lazy-management-keys.ts
6818
6841
  var lazyManagementKeys = (options) => {
6819
- const client = async () => new HttpManagementKeys({
6842
+ const client = (accessToken) => new HttpManagementKeys({
6820
6843
  baseUrl: options.apiBaseUrl,
6821
- credential: await options.obtainCredential(),
6844
+ credential: accessToken,
6822
6845
  ...options.fetchImpl === void 0 ? {} : { fetchImpl: options.fetchImpl }
6823
6846
  });
6824
6847
  return {
6825
- create: async (accessToken, input) => (await client()).create(accessToken, input),
6826
- delete: async (accessToken, id) => (await client()).delete(accessToken, id),
6827
- get: async (accessToken, id) => (await client()).get(accessToken, id),
6828
- list: async (accessToken) => (await client()).list(accessToken),
6829
- listOrganizations: async (accessToken) => (await client()).listOrganizations(accessToken),
6830
- listProjects: async (accessToken, organisationId) => (await client()).listProjects(accessToken, organisationId),
6831
- regenerate: async (accessToken, id, expiresAt) => (await client()).regenerate(accessToken, id, expiresAt),
6832
- update: async (accessToken, id, input) => (await client()).update(accessToken, id, input)
6848
+ create: async (accessToken, input) => client(accessToken).create(accessToken, input),
6849
+ delete: async (accessToken, id) => client(accessToken).delete(accessToken, id),
6850
+ get: async (accessToken, id) => client(accessToken).get(accessToken, id),
6851
+ list: async (accessToken) => client(accessToken).list(accessToken),
6852
+ listOrganizations: async (accessToken) => client(accessToken).listOrganizations(accessToken),
6853
+ listProjects: async (accessToken, organisationId) => client(accessToken).listProjects(accessToken, organisationId),
6854
+ regenerate: async (accessToken, id, expiresAt) => client(accessToken).regenerate(accessToken, id, expiresAt),
6855
+ update: async (accessToken, id, input) => client(accessToken).update(accessToken, id, input)
6833
6856
  };
6834
6857
  };
6835
6858
 
@@ -6845,10 +6868,7 @@ var buildProductionRuntimeOptions = (input) => ({
6845
6868
  timeoutMs: LOGIN_BUDGET_MS
6846
6869
  },
6847
6870
  management: {
6848
- client: (obtainCredential) => lazyManagementKeys({
6849
- apiBaseUrl: input.apiBaseUrl,
6850
- obtainCredential
6851
- })
6871
+ client: () => lazyManagementKeys({ apiBaseUrl: input.apiBaseUrl })
6852
6872
  },
6853
6873
  ...input.tokenStore === void 0 ? {} : { tokenStore: input.tokenStore }
6854
6874
  });
@@ -7184,46 +7204,7 @@ var createV1ConnectWizard = (composeOptions = productionOptions) => (api) => {
7184
7204
  };
7185
7205
 
7186
7206
  // src/tui-entry/show-r33-menu/show-r33-menu.ts
7187
- var menuOptions2 = [
7188
- {
7189
- title: "Connect \u2014 sign in and assign a budget",
7190
- value: "connect"
7191
- },
7192
- {
7193
- title: "Inspect session \u2014 attribution and key metadata",
7194
- value: "inspect"
7195
- },
7196
- {
7197
- title: "Rotate key now",
7198
- value: "rotate"
7199
- },
7200
- {
7201
- title: "Change budget \u2014 reassign this folder",
7202
- value: "change"
7203
- },
7204
- {
7205
- title: "Reset attribution \u2014 clear the assigned budget",
7206
- value: "reset"
7207
- }
7208
- ];
7209
- var showR33Menu = async (context) => {
7210
- const selection = await context.ui.dialog.select({
7211
- title: "Route 33 \u2014 choose an action",
7212
- options: menuOptions2
7213
- });
7214
- if (selection === void 0) return;
7215
- if (selection === "connect") {
7216
- context.ui.toast.show({
7217
- message: "Route 33 connect \u2014 finish the browser sign-in, then run /connect in OpenCode and choose Route 33 to assign a budget.",
7218
- variant: "info"
7219
- });
7220
- return;
7221
- }
7222
- context.ui.toast.show({
7223
- message: `Route 33 ${selection} runs through /r33 ${selection} \u2014 type it in the prompt and send.`,
7224
- variant: "info"
7225
- });
7226
- };
7207
+ init_attribution();
7227
7208
 
7228
7209
  // src/tui-entry/v2-autoconnect/v2-autoconnect.ts
7229
7210
  init_attribution();
@@ -7583,6 +7564,52 @@ var v2Autoconnect = async (context) => {
7583
7564
  await v2GuidedConnect({ context, unattributed });
7584
7565
  };
7585
7566
 
7567
+ // src/tui-entry/show-r33-menu/show-r33-menu.ts
7568
+ var menuOptions2 = [
7569
+ {
7570
+ title: "Connect \u2014 sign in and assign a budget",
7571
+ value: "connect"
7572
+ },
7573
+ {
7574
+ title: "Inspect session \u2014 attribution and key metadata",
7575
+ value: "inspect"
7576
+ },
7577
+ {
7578
+ title: "Rotate key now",
7579
+ value: "rotate"
7580
+ },
7581
+ {
7582
+ title: "Change budget \u2014 reassign this folder",
7583
+ value: "change"
7584
+ },
7585
+ {
7586
+ title: "Reset attribution \u2014 clear the assigned budget",
7587
+ value: "reset"
7588
+ }
7589
+ ];
7590
+ var showR33Menu = async (context) => {
7591
+ const selection = await context.ui.dialog.select({
7592
+ title: "Route 33 \u2014 choose an action",
7593
+ options: menuOptions2
7594
+ });
7595
+ if (selection === void 0) return;
7596
+ if (selection === "connect" || selection === "change") {
7597
+ const location = context.location ?? context.data?.location.default();
7598
+ if (selection === "change" && location !== void 0) {
7599
+ clearAttribution({
7600
+ directory: location.directory,
7601
+ outsideWorktree: "return-undefined"
7602
+ });
7603
+ }
7604
+ await v2Autoconnect({ ...context, location });
7605
+ return;
7606
+ }
7607
+ context.ui.toast.show({
7608
+ message: `Route 33 ${selection} runs through /r33 ${selection} \u2014 type it in the prompt and send.`,
7609
+ variant: "info"
7610
+ });
7611
+ };
7612
+
7586
7613
  // src/tui-entry/v2-setup-lock/v2-setup-lock.ts
7587
7614
  var SETUP_MODE2 = "route33-setup";
7588
7615
  var RESUME_BIND2 = "enter";
@@ -7643,7 +7670,8 @@ var createV2Tui = () => ({
7643
7670
  ],
7644
7671
  bindings: ["route33.menu"]
7645
7672
  }));
7646
- void v2SetupLock(context).start().catch(() => void 0);
7673
+ const location = context.location ?? context.data?.location.default();
7674
+ void v2SetupLock({ ...context, location }).start().catch(() => void 0);
7647
7675
  }
7648
7676
  });
7649
7677
 
@@ -1,19 +1,48 @@
1
1
  // src/v2-entry/create-route33-v2-plugin/create-route33-v2-plugin.ts
2
2
  import { Integration as Integration2, Plugin } from "@opencode/plugin";
3
3
 
4
+ // src/auth/open-system-browser/open-system-browser.ts
5
+ import { spawn } from "node:child_process";
6
+ var openSystemBrowser = async (url, options = {}) => new Promise((resolve2, reject) => {
7
+ let command = "xdg-open";
8
+ let args = [url.href];
9
+ if (process.platform === "darwin") {
10
+ command = "open";
11
+ } else if (process.platform === "win32") {
12
+ command = "cmd";
13
+ args = ["/c", "start", "", url.href];
14
+ }
15
+ if (options.spawnUrl !== void 0) {
16
+ options.spawnUrl(command, args, { detached: true, stdio: "ignore" });
17
+ resolve2();
18
+ return;
19
+ }
20
+ const child = spawn(command, args, {
21
+ detached: true,
22
+ stdio: "ignore"
23
+ });
24
+ child.once("error", reject);
25
+ child.once("spawn", () => {
26
+ child.unref();
27
+ resolve2();
28
+ });
29
+ });
30
+
4
31
  // src/auth/authorization-url-stash/authorization-url-stash.ts
5
32
  var FALLBACK_URL = "https://route33.ai";
6
33
  var SIGN_IN_INSTRUCTIONS = "Open the Route 33 sign-in link \u2014 your browser will finish at a confirmation page.";
7
34
  var FINISHING_INSTRUCTIONS = "Finishing Route 33 setup\u2026";
8
35
  var URL_WAIT_BUDGET_MS = 3e4;
9
- var createAuthorizationUrlStash = () => {
36
+ var createAuthorizationUrlStash = (options = {}) => {
37
+ const open = options.open ?? ((url) => openSystemBrowser(url));
38
+ const waitBudgetMs = options.waitBudgetMs ?? URL_WAIT_BUDGET_MS;
10
39
  let resolveUrl;
11
40
  const nextUrl = new Promise((resolve2) => {
12
41
  resolveUrl = resolve2;
13
42
  });
14
43
  const browserRunner = (url) => {
15
44
  resolveUrl?.(url);
16
- return Promise.resolve();
45
+ return open(url);
17
46
  };
18
47
  const urlForConnect = async (callback) => {
19
48
  let decide;
@@ -22,7 +51,7 @@ var createAuthorizationUrlStash = () => {
22
51
  });
23
52
  const timer = setTimeout(() => {
24
53
  decide({ instructions: SIGN_IN_INSTRUCTIONS, url: FALLBACK_URL });
25
- }, URL_WAIT_BUDGET_MS);
54
+ }, waitBudgetMs);
26
55
  void nextUrl.then((url) => {
27
56
  clearTimeout(timer);
28
57
  decide({ instructions: SIGN_IN_INSTRUCTIONS, url: url.toString() });
@@ -2768,7 +2797,6 @@ var createAuthSession = (options) => {
2768
2797
  };
2769
2798
 
2770
2799
  // src/auth/open-browser-and-capture/open-browser-and-capture.ts
2771
- import { spawn } from "node:child_process";
2772
2800
  import { timingSafeEqual } from "node:crypto";
2773
2801
 
2774
2802
  // src/auth/loopback-callback/loopback-callback.ts
@@ -2887,25 +2915,7 @@ var createAuthLoopbackCallback = async () => {
2887
2915
  var openBrowserAndCapture = async (options) => {
2888
2916
  const callback = await createAuthLoopbackCallback();
2889
2917
  const authorizationUrl = options.authorizationUrl(callback.redirectUri);
2890
- const browserRunner = options.browserRunner ?? ((url) => new Promise((resolve2, reject) => {
2891
- let command = "xdg-open";
2892
- let args = [url.href];
2893
- if (process.platform === "darwin") {
2894
- command = "open";
2895
- } else if (process.platform === "win32") {
2896
- command = "cmd";
2897
- args = ["/c", "start", "", url.href];
2898
- }
2899
- const child = spawn(command, args, {
2900
- detached: true,
2901
- stdio: "ignore"
2902
- });
2903
- child.once("error", reject);
2904
- child.once("spawn", () => {
2905
- child.unref();
2906
- resolve2();
2907
- });
2908
- }));
2918
+ const browserRunner = options.browserRunner ?? ((url) => openSystemBrowser(url));
2909
2919
  let timer;
2910
2920
  const timeout = new Promise((_resolve, reject) => {
2911
2921
  timer = setTimeout(() => {
@@ -3199,7 +3209,7 @@ var Route33Runtime = class {
3199
3209
  if (typeof client !== "function") {
3200
3210
  return client;
3201
3211
  }
3202
- this.#managementClient ??= client(() => this.#session.credential());
3212
+ this.#managementClient ??= client();
3203
3213
  return this.#managementClient;
3204
3214
  }
3205
3215
  #subject(credential) {
@@ -3789,20 +3799,20 @@ var HttpManagementKeys = class {
3789
3799
 
3790
3800
  // src/lazy-management-keys/lazy-management-keys.ts
3791
3801
  var lazyManagementKeys = (options) => {
3792
- const client = async () => new HttpManagementKeys({
3802
+ const client = (accessToken) => new HttpManagementKeys({
3793
3803
  baseUrl: options.apiBaseUrl,
3794
- credential: await options.obtainCredential(),
3804
+ credential: accessToken,
3795
3805
  ...options.fetchImpl === void 0 ? {} : { fetchImpl: options.fetchImpl }
3796
3806
  });
3797
3807
  return {
3798
- create: async (accessToken, input) => (await client()).create(accessToken, input),
3799
- delete: async (accessToken, id) => (await client()).delete(accessToken, id),
3800
- get: async (accessToken, id) => (await client()).get(accessToken, id),
3801
- list: async (accessToken) => (await client()).list(accessToken),
3802
- listOrganizations: async (accessToken) => (await client()).listOrganizations(accessToken),
3803
- listProjects: async (accessToken, organisationId) => (await client()).listProjects(accessToken, organisationId),
3804
- regenerate: async (accessToken, id, expiresAt) => (await client()).regenerate(accessToken, id, expiresAt),
3805
- update: async (accessToken, id, input) => (await client()).update(accessToken, id, input)
3808
+ create: async (accessToken, input) => client(accessToken).create(accessToken, input),
3809
+ delete: async (accessToken, id) => client(accessToken).delete(accessToken, id),
3810
+ get: async (accessToken, id) => client(accessToken).get(accessToken, id),
3811
+ list: async (accessToken) => client(accessToken).list(accessToken),
3812
+ listOrganizations: async (accessToken) => client(accessToken).listOrganizations(accessToken),
3813
+ listProjects: async (accessToken, organisationId) => client(accessToken).listProjects(accessToken, organisationId),
3814
+ regenerate: async (accessToken, id, expiresAt) => client(accessToken).regenerate(accessToken, id, expiresAt),
3815
+ update: async (accessToken, id, input) => client(accessToken).update(accessToken, id, input)
3806
3816
  };
3807
3817
  };
3808
3818
 
@@ -3818,10 +3828,7 @@ var buildProductionRuntimeOptions = (input) => ({
3818
3828
  timeoutMs: LOGIN_BUDGET_MS
3819
3829
  },
3820
3830
  management: {
3821
- client: (obtainCredential) => lazyManagementKeys({
3822
- apiBaseUrl: input.apiBaseUrl,
3823
- obtainCredential
3824
- })
3831
+ client: () => lazyManagementKeys({ apiBaseUrl: input.apiBaseUrl })
3825
3832
  },
3826
3833
  ...input.tokenStore === void 0 ? {} : { tokenStore: input.tokenStore }
3827
3834
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@route_33/opencode",
3
- "version": "0.4.7-rc.8",
3
+ "version": "0.4.7-rc.9",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",
@@ -42,8 +42,8 @@
42
42
  "eslint": "10.13.0",
43
43
  "typescript": "6.0.3",
44
44
  "vitest": "5.0.5",
45
- "@cronos-ai-lab/eslint-config": "0.1.2",
46
- "@cronos-ai-lab/typescript-config": "0.1.2"
45
+ "@cronos-ai-lab/typescript-config": "0.1.2",
46
+ "@cronos-ai-lab/eslint-config": "0.1.2"
47
47
  },
48
48
  "scripts": {
49
49
  "build": "esbuild src/index.ts src/v2-entry/index.ts src/tui-entry/index.ts src/cli/production-smoke/production-smoke.ts --bundle --format=esm --platform=node --packages=external --outbase=src --outdir=dist --alias:@opencode-ai/plugin-v2=@opencode/plugin --define:__ROUTE33_DEFAULT_CLIENT_ID__=\\\"${ROUTE33_DEFAULT_CLIENT_ID:-}\\\"",