@pure01fx/dsh-openai-codex-auth 0.6.0 → 0.7.0

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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,22 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 0.7.0
6
+
7
+ ### DSH 0.1.1 compatibility
8
+
9
+ - Targets DeepSeek Harness `0.1.1-rc.2` across Host peers, runtime helpers, development contracts, and generated artifacts.
10
+ - Emits successful native continuation metadata through the rc.2 `ReplayEnvelope.response` contract while continuing to read legacy raw replay state from existing sessions.
11
+ - Removes the duplicate runtime dependency on `@deepseek-ai/dsh-credentials`, keeping the Host credentials service as a peer-owned singleton.
12
+
13
+ ## 0.6.1
14
+
15
+ ### WebSocket reliability
16
+
17
+ - Cancels image and attachment request preparation when the transport is disposed, preserving the `DISPOSED` lifecycle result before a WebSocket session becomes active.
18
+ - Stops same-stream reconnect and replay after any output has been emitted; retryable interruptions now cross the durable failed-step recovery boundary without duplicating visible chunks.
19
+ - Keeps credential-backed connection failures on the bounded reconnect and HTTP fallback path instead of treating every low-level network error as an indefinite pre-credential outage.
20
+
5
21
  ## 0.6.0
6
22
 
7
23
  ### Native Codex transport
package/README.md CHANGED
@@ -17,6 +17,8 @@
17
17
 
18
18
  ## 快速开始
19
19
 
20
+ 当前 `0.7.x` 版本要求 DeepSeek Harness `0.1.1-rc.2`;仍运行 DSH `0.1.0-rc.6` 的 profile 应继续使用插件 `0.6.1`。
21
+
20
22
  将插件安装到 DSH 的 `web` profile:
21
23
 
22
24
  ```sh
@@ -25,6 +25,7 @@ export declare class NativeCodexWebSocketTransport implements NativeCodexTranspo
25
25
  private readonly maxReconnects;
26
26
  private readonly initialRetryDelayMs;
27
27
  private readonly maxRetryDelayMs;
28
+ private readonly preparing;
28
29
  private readonly active;
29
30
  private disposed;
30
31
  constructor(options: NativeCodexWebSocketTransportOptions);
@@ -212,6 +212,7 @@ export class NativeCodexWebSocketTransport {
212
212
  maxReconnects;
213
213
  initialRetryDelayMs;
214
214
  maxRetryDelayMs;
215
+ preparing = new Set();
215
216
  active = new Map();
216
217
  disposed = false;
217
218
  constructor(options) {
@@ -469,7 +470,18 @@ export class NativeCodexWebSocketTransport {
469
470
  async *stream(generation, mode = {}) {
470
471
  if (this.disposed)
471
472
  throw failure('native Codex WebSocket transport was disposed', 'DISPOSED');
472
- const prepared = await this.http.prepare(generation, mode);
473
+ const lifecycle = new AbortController();
474
+ const signal = generation.signal === undefined
475
+ ? lifecycle.signal : AbortSignal.any([generation.signal, lifecycle.signal]);
476
+ const activeGeneration = { ...generation, signal };
477
+ this.preparing.add(lifecycle);
478
+ let prepared;
479
+ try {
480
+ prepared = await this.http.prepare(activeGeneration, mode);
481
+ }
482
+ finally {
483
+ this.preparing.delete(lifecycle);
484
+ }
473
485
  if (this.disposed)
474
486
  throw failure('native Codex WebSocket transport was disposed', 'DISPOSED');
475
487
  const key = sessionKey(generation, prepared.routingId);
@@ -480,11 +492,7 @@ export class NativeCodexWebSocketTransport {
480
492
  throw failure('native Codex WebSocket active session limit was reached', 'WS_SESSION_LIMIT');
481
493
  }
482
494
  entry.busy = true;
483
- const lifecycle = new AbortController();
484
495
  this.active.set(entry, lifecycle);
485
- const signal = generation.signal === undefined
486
- ? lifecycle.signal : AbortSignal.any([generation.signal, lifecycle.signal]);
487
- const activeGeneration = { ...generation, signal };
488
496
  const currentTurn = turnKey(generation);
489
497
  if (entry.turnKey !== currentTurn) {
490
498
  entry.turnKey = currentTurn;
@@ -531,17 +539,18 @@ export class NativeCodexWebSocketTransport {
531
539
  throw failure('native Codex WebSocket transport was disposed', 'DISPOSED');
532
540
  if (generation.signal?.aborted || failureValue.code === 'ABORTED')
533
541
  throw failureValue;
534
- if (failureValue.code === NATIVE_CODEX_CONNECTION_FAILED_CODE
535
- || isNativeCodexConnectionFailure(failureValue)) {
536
- await this.waitForConnection(connectionRetryDelayMs, signal);
537
- connectionRetryDelayMs = Math.min(connectionRetryDelayMs * 2, MAX_CONNECTION_RETRY_DELAY_MS);
538
- continue;
539
- }
540
542
  if (emitted) {
541
543
  if (failedStepRetryable(failureValue.code))
542
544
  throw failedStepRetry(failureValue);
543
545
  throw failureValue;
544
546
  }
547
+ if (failureValue.code === NATIVE_CODEX_CONNECTION_FAILED_CODE
548
+ || (attemptedCredential === undefined
549
+ && isNativeCodexConnectionFailure(failureValue))) {
550
+ await this.waitForConnection(connectionRetryDelayMs, signal);
551
+ connectionRetryDelayMs = Math.min(connectionRetryDelayMs * 2, MAX_CONNECTION_RETRY_DELAY_MS);
552
+ continue;
553
+ }
545
554
  if (failureValue.code === 'WS_AUTH' && !recovered
546
555
  && attemptedCredential !== undefined
547
556
  && this.options.recoverCredential !== undefined) {
@@ -603,6 +612,10 @@ export class NativeCodexWebSocketTransport {
603
612
  if (this.disposed)
604
613
  return;
605
614
  this.disposed = true;
615
+ for (const controller of this.preparing) {
616
+ controller.abort(failure('native Codex WebSocket transport was disposed', 'DISPOSED'));
617
+ }
618
+ this.preparing.clear();
606
619
  for (const [entry, controller] of this.active) {
607
620
  controller.abort(failure('native Codex WebSocket transport was disposed', 'DISPOSED'));
608
621
  this.closeEntry(entry);
package/lib/replay.d.ts CHANGED
@@ -30,7 +30,7 @@ export interface NativeCodexReplaySource {
30
30
  }
31
31
  /** Preserve only server item IDs that Codex itself would replay. */
32
32
  export declare function replayableItemId(value: string | undefined): string | undefined;
33
- /** True only for state emitted by this package; foreign adapters degrade to visible history. */
33
+ /** True only for legacy raw state or an rc.2 envelope emitted by this package. */
34
34
  export declare function hasNativeCodexReplayKind(value: unknown): boolean;
35
35
  /** Attempt-local bounded accumulator; no ciphertext can grow unchecked before completion. */
36
36
  export declare class NativeCodexReplayCapture {
package/lib/replay.js CHANGED
@@ -96,13 +96,17 @@ function parseDescriptor(value) {
96
96
  }
97
97
  throw failure('native Codex replay descriptor type is unsupported');
98
98
  }
99
- /** True only for state emitted by this package; foreign adapters degrade to visible history. */
99
+ function replayPayload(value) {
100
+ const response = object(value)?.response;
101
+ return object(response)?.kind === NATIVE_CODEX_REPLAY_KIND ? response : value;
102
+ }
103
+ /** True only for legacy raw state or an rc.2 envelope emitted by this package. */
100
104
  export function hasNativeCodexReplayKind(value) {
101
- return object(value)?.kind === NATIVE_CODEX_REPLAY_KIND;
105
+ return object(replayPayload(value))?.kind === NATIVE_CODEX_REPLAY_KIND;
102
106
  }
103
107
  function parseState(value) {
104
108
  safeStateSize(value, 'INVALID_REPLAY_STATE');
105
- const row = object(value);
109
+ const row = object(replayPayload(value));
106
110
  if (row === undefined || row.kind !== NATIVE_CODEX_REPLAY_KIND
107
111
  || row.version !== NATIVE_CODEX_REPLAY_VERSION
108
112
  || !onlyKeys(row, ['kind', 'version', 'provider', 'model', 'items'])) {
package/lib/responses.js CHANGED
@@ -466,7 +466,7 @@ export class ResponsesStreamTranslator {
466
466
  } } }
467
467
  : {
468
468
  type: 'finish', reason: { kind: this.sawToolCall ? 'tool-calls' : 'stop' },
469
- ...(replayState === undefined ? {} : { replayState }),
469
+ ...(replayState === undefined ? {} : { replayState: { response: replayState } }),
470
470
  });
471
471
  return chunks;
472
472
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pure01fx/dsh-openai-codex-auth",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "description": "Native ChatGPT Codex provider, device-code-first login, and same-origin Web integration for DeepSeek Harness",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
@@ -69,12 +69,10 @@
69
69
  "CHANGELOG.md",
70
70
  "LICENSE"
71
71
  ],
72
- "scripts": {
73
- "build": "tsc",
74
- "test": "vitest run",
75
- "prepack": "pnpm build"
76
- },
77
72
  "dsh": {
73
+ "engines": {
74
+ "dsh": "0.1.1-rc.2"
75
+ },
78
76
  "bundle": {
79
77
  "patch": "./cordis.patch.yml"
80
78
  },
@@ -89,26 +87,29 @@
89
87
  },
90
88
  "peerDependencies": {
91
89
  "@deepseek-ai/cordis": "^4.0.1",
92
- "@deepseek-ai/dsh-credentials": "0.1.0-rc.6",
93
- "@deepseek-ai/dsh-host-webserver": "0.1.0-rc.6",
94
- "@deepseek-ai/dsh-llm": "0.1.0-rc.6"
90
+ "@deepseek-ai/dsh-credentials": "0.1.1-rc.2",
91
+ "@deepseek-ai/dsh-host-webserver": "0.1.1-rc.2",
92
+ "@deepseek-ai/dsh-llm": "0.1.1-rc.2"
95
93
  },
96
94
  "dependencies": {
97
- "@deepseek-ai/dsh-atomic-write": "0.1.0-rc.6",
98
- "@deepseek-ai/dsh-credentials": "0.1.0-rc.6",
99
- "@deepseek-ai/dsh-home-paths": "0.1.0-rc.6",
95
+ "@deepseek-ai/dsh-atomic-write": "0.1.1-rc.2",
96
+ "@deepseek-ai/dsh-home-paths": "0.1.1-rc.2",
100
97
  "@deepseek-ai/schemastery": "^3.18.1",
101
98
  "ws": "8.21.3"
102
99
  },
103
100
  "devDependencies": {
104
101
  "@deepseek-ai/cordis": "^4.0.1",
105
- "@deepseek-ai/dsh-agent": "0.1.0-rc.6",
106
- "@deepseek-ai/dsh-credentials": "0.1.0-rc.6",
107
- "@deepseek-ai/dsh-host-webserver": "0.1.0-rc.6",
108
- "@deepseek-ai/dsh-llm": "0.1.0-rc.6",
109
- "@deepseek-ai/dsh-session": "0.1.0-rc.6",
102
+ "@deepseek-ai/dsh-agent": "0.1.1-rc.2",
103
+ "@deepseek-ai/dsh-credentials": "0.1.1-rc.2",
104
+ "@deepseek-ai/dsh-host-webserver": "0.1.1-rc.2",
105
+ "@deepseek-ai/dsh-llm": "0.1.1-rc.2",
106
+ "@deepseek-ai/dsh-session": "0.1.1-rc.2",
110
107
  "@types/node": "^22.20.0",
111
108
  "typescript": "^6.0.3",
112
109
  "vitest": "^4.1.8"
110
+ },
111
+ "scripts": {
112
+ "build": "tsc",
113
+ "test": "vitest run"
113
114
  }
114
- }
115
+ }