dsh-openai-subscription 0.1.8 → 0.1.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.
Files changed (2) hide show
  1. package/dist/driver.js +17 -3
  2. package/package.json +6 -6
package/dist/driver.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { setTimeout as delay } from 'node:timers/promises';
2
- import { SubscriptionError, oauthFailureCode } from './errors.js';
2
+ import { SubscriptionError, failureCode, oauthFailureCode } from './errors.js';
3
3
  import { normalizeOAuthCredential } from './oauth.js';
4
4
  import { buildNodeCommand } from './platform.js';
5
5
  export const VERIFICATION_URL = 'https://auth.openai.com/codex/device';
@@ -56,11 +56,25 @@ export async function runDeviceDriver(shell, modulePath, signal, notify, options
56
56
  return null;
57
57
  const timeout = AbortSignal.timeout(options.timeoutMs ?? DEVICE_TIMEOUT);
58
58
  const combined = AbortSignal.any([signal, timeout]);
59
- const proc = shell.start(shell.resolve({
59
+ const spec = shell.resolve({
60
60
  command: buildNodeCommand(DRIVER_DEVICE, modulePath),
61
61
  signal: combined,
62
62
  stdoutMaxBytes: MAX_OUTPUT,
63
- }));
63
+ });
64
+ let proc;
65
+ try {
66
+ // DSH 0.1.6+ resolves background handles asynchronously after launch
67
+ // preparation; awaiting also accepts executors that still return the
68
+ // handle synchronously, so both ShellExecutor contracts keep working.
69
+ proc = await shell.start(spec);
70
+ }
71
+ catch (error) {
72
+ // Launch preparation failed before a handle existed; there is nothing to
73
+ // reap and no output was produced, so report a category without details.
74
+ if (signal.aborted)
75
+ return null;
76
+ throw new SubscriptionError(failureCode(error, 'process-exited'));
77
+ }
64
78
  let buffer = '';
65
79
  let total = 0;
66
80
  let codeReceived = false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-openai-subscription",
3
- "version": "0.1.8",
3
+ "version": "0.1.9",
4
4
  "description": "ChatGPT subscription sign-in for DeepSeek Harness via OpenAI device authorization.",
5
5
  "type": "module",
6
6
  "packageManager": "pnpm@10.6.3",
@@ -82,11 +82,11 @@
82
82
  "@babel/parser": "^8.0.4",
83
83
  "@deepseek-ai/cordis": "^4.0.2",
84
84
  "@deepseek-ai/cordis-plugin-timer": "^1.1.4",
85
- "@deepseek-ai/dsh-authorization": "^0.1.2-rc.1",
86
- "@deepseek-ai/dsh-credentials": "^0.1.2-rc.1",
87
- "@deepseek-ai/dsh-settings": "^0.1.2-rc.1",
88
- "@deepseek-ai/dsh-shell": "^0.1.2-rc.1",
89
- "@deepseek-ai/dsh-typert-protocol": "^0.1.2-rc.1",
85
+ "@deepseek-ai/dsh-authorization": "^0.1.6-alpha.2",
86
+ "@deepseek-ai/dsh-credentials": "^0.1.6-alpha.2",
87
+ "@deepseek-ai/dsh-settings": "^0.1.6-alpha.2",
88
+ "@deepseek-ai/dsh-shell": "^0.1.6-alpha.2",
89
+ "@deepseek-ai/dsh-typert-protocol": "^0.1.6-alpha.2",
90
90
  "@types/node": "^25.6.1",
91
91
  "esbuild": "^0.28.2",
92
92
  "typescript": "^7.0.2"