@route_33/opencode 0.4.7-rc.6 → 0.4.7-rc.7

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.
@@ -7169,21 +7169,43 @@ var showR33Menu = async (context) => {
7169
7169
  init_attribution();
7170
7170
  init_cli();
7171
7171
 
7172
+ // src/tui-entry/is-method-not-registered/is-method-not-registered.ts
7173
+ var isMethodNotRegistered = (error) => error instanceof Error && error.message.includes("OAuth method not found");
7174
+
7175
+ // src/tui-entry/v2-connect-surface/v2-connect-surface.ts
7176
+ var v2ConnectSurface = (context) => {
7177
+ const oauth = context.client?.integration?.oauth ?? context.client?.api?.integration?.oauth;
7178
+ return oauth?.connect;
7179
+ };
7180
+
7172
7181
  // src/tui-entry/v2-connect-runner/v2-connect-runner.ts
7173
7182
  var createV2ConnectRunner = ({
7174
7183
  context,
7184
+ maxAttempts = 20,
7185
+ retryDelayMs = 500,
7175
7186
  unattributed
7176
7187
  }) => {
7177
- const oauth = context.client?.api?.integration?.oauth;
7188
+ const connect = v2ConnectSurface(context);
7189
+ const sleep = (ms) => new Promise((resolve2) => {
7190
+ setTimeout(resolve2, ms);
7191
+ });
7178
7192
  return async (message) => {
7179
- const connect = oauth?.connect;
7180
7193
  if (connect === void 0) return;
7181
7194
  if (!unattributed()) return;
7182
7195
  context.ui.toast.show({ message, variant: "info" });
7183
- await connect({
7184
- integrationID: "route33",
7185
- methodID: "browser"
7186
- }).catch(() => void 0);
7196
+ for (let attempt = 1; ; attempt += 1) {
7197
+ if (!unattributed()) return;
7198
+ try {
7199
+ await connect({
7200
+ integrationID: "route33",
7201
+ methodID: "browser"
7202
+ });
7203
+ return;
7204
+ } catch (error) {
7205
+ if (attempt >= maxAttempts || !isMethodNotRegistered(error)) return;
7206
+ await sleep(retryDelayMs);
7207
+ }
7208
+ }
7187
7209
  };
7188
7210
  };
7189
7211
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@route_33/opencode",
3
- "version": "0.4.7-rc.6",
3
+ "version": "0.4.7-rc.7",
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/typescript-config": "0.1.2",
46
- "@cronos-ai-lab/eslint-config": "0.1.2"
45
+ "@cronos-ai-lab/eslint-config": "0.1.2",
46
+ "@cronos-ai-lab/typescript-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:-}\\\"",