@opencode/plugin 0.0.0-dev-1179 → 0.0.0-dev-1189

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.
@@ -44,6 +44,11 @@ export type IntegrationOAuthAuthorization = {
44
44
  } & ({
45
45
  readonly mode: "auto";
46
46
  readonly callback: Effect.Effect<Credential.OAuth, unknown>;
47
+ /**
48
+ * Accepts the redirect URL a user pasted when the browser could not reach this machine, and settles `callback`
49
+ * with it. Check the URL's `state` as the browser path does; a failure rejects only this paste.
50
+ */
51
+ readonly submit?: (redirect: string) => Effect.Effect<void, unknown>;
47
52
  } | {
48
53
  readonly mode: "code";
49
54
  readonly callback: (code: string) => Effect.Effect<Credential.OAuth, unknown>;
@@ -304,15 +304,22 @@ export function fromPromise(plugin) {
304
304
  const refresh = input.refresh;
305
305
  editor.method.update({
306
306
  ...input,
307
- authorize: (answer) => Effect.promise(() => input.authorize(answer)).pipe(Effect.map((authorization) => authorization.mode === "auto"
308
- ? {
307
+ authorize: (answer) => Effect.promise(() => input.authorize(answer)).pipe(Effect.map((authorization) => {
308
+ if (authorization.mode === "code")
309
+ return {
310
+ ...authorization,
311
+ callback: (code) => Effect.promise(() => authorization.callback(code)),
312
+ };
313
+ const submit = authorization.submit;
314
+ return {
309
315
  ...authorization,
310
316
  callback: Effect.promise(() => authorization.callback),
311
- }
312
- : {
313
- ...authorization,
314
- callback: (code) => Effect.promise(() => authorization.callback(code)),
315
- })),
317
+ // A rejected paste keeps its own error, which the dialog shows as is.
318
+ submit: submit
319
+ ? (redirect) => Effect.tryPromise({ try: () => submit(redirect), catch: (error) => error })
320
+ : undefined,
321
+ };
322
+ })),
316
323
  refresh: refresh === undefined
317
324
  ? undefined
318
325
  : (credential) => Effect.promise(() => refresh(credential)),
@@ -43,6 +43,11 @@ export type IntegrationOAuthAuthorization = {
43
43
  } & ({
44
44
  readonly mode: "auto";
45
45
  readonly callback: Promise<Credential.OAuth>;
46
+ /**
47
+ * Accepts the redirect URL a user pasted when the browser could not reach this machine, and settles `callback`
48
+ * with it. Check the URL's `state` as the browser path does; a rejection rejects only this paste.
49
+ */
50
+ readonly submit?: (redirect: string) => Promise<void>;
46
51
  } | {
47
52
  readonly mode: "code";
48
53
  readonly callback: (code: string) => Promise<Credential.OAuth>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@opencode/plugin",
4
- "version": "0.0.0-dev-1179",
4
+ "version": "0.0.0-dev-1189",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "scripts": {
@@ -78,15 +78,15 @@
78
78
  ],
79
79
  "dependencies": {
80
80
  "@ai-sdk/provider": "3.0.8",
81
- "@opencode/ai": "0.0.0-dev-1179",
82
- "@opencode/client": "0.0.0-dev-1179",
83
- "@opencode/protocol": "0.0.0-dev-1179",
84
- "@opencode/schema": "0.0.0-dev-1179",
85
- "@opencode/util": "0.0.0-dev-1179",
81
+ "@opencode/ai": "0.0.0-dev-1189",
82
+ "@opencode/client": "0.0.0-dev-1189",
83
+ "@opencode/protocol": "0.0.0-dev-1189",
84
+ "@opencode/schema": "0.0.0-dev-1189",
85
+ "@opencode/util": "0.0.0-dev-1189",
86
86
  "effect": "4.1.0"
87
87
  },
88
88
  "peerDependencies": {
89
- "@opencode/theme": "0.0.0-dev-1179",
89
+ "@opencode/theme": "0.0.0-dev-1189",
90
90
  "@opentui/core": ">=0.8.4",
91
91
  "@opentui/solid": ">=0.8.4",
92
92
  "electron": "*",
@@ -118,7 +118,7 @@
118
118
  }
119
119
  },
120
120
  "devDependencies": {
121
- "@opencode/theme": "0.0.0-dev-1179",
121
+ "@opencode/theme": "0.0.0-dev-1189",
122
122
  "@opentui/core": "0.8.4",
123
123
  "@opentui/solid": "0.8.4",
124
124
  "@tsconfig/bun": "1.0.9",