dsh-codex-subscription 3.2.17 → 3.2.18

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/README.de.md CHANGED
@@ -82,7 +82,7 @@ Dieses Plugin unterstützt die neueste DeepSeek-Harness-Version, die in seinen P
82
82
  2. Füge diesen Paketnamen einschließlich Version in das Feld **Paketname oder Adresse** ein:
83
83
 
84
84
  ```text
85
- dsh-codex-subscription@3.2.17
85
+ dsh-codex-subscription@3.2.18
86
86
  ```
87
87
 
88
88
  3. Klicke auf **Installieren** und warte, bis der Vorgang abgeschlossen ist. Folge den Anweisungen auf der Seite; speichere deine Arbeit, bevor du neu startest, falls du dazu aufgefordert wirst.
@@ -99,7 +99,7 @@ Warum die Version angegeben ist: Auf der Plugin-Seite von DSH werden nur Version
99
99
  <summary>Installation über das Terminal (mit einem vorhandenen dsh-Befehl)</summary>
100
100
 
101
101
  ```sh
102
- dsh plugin --profile web add dsh-codex-subscription@3.2.17
102
+ dsh plugin --profile web add dsh-codex-subscription@3.2.18
103
103
  ```
104
104
 
105
105
  Folge den Anweisungen zum Neustart und melde dich anschließend unter **Einstellungen → Codex** an. Sowohl die Plugins-Seite als auch das Terminal verwenden die Installationsverwaltung von DSH.
@@ -112,7 +112,7 @@ Folge den Anweisungen zum Neustart und melde dich anschließend unter **Einstell
112
112
  Melde dich an und wähle in Web ein Codex-Modell aus. Installiere anschließend dasselbe Plugin im Headless-Profil:
113
113
 
114
114
  ```sh
115
- dsh plugin --profile headless add dsh-codex-subscription@3.2.17
115
+ dsh plugin --profile headless add dsh-codex-subscription@3.2.18
116
116
  dsh --profile headless "Reply with only the word: ok"
117
117
  ```
118
118
 
@@ -392,7 +392,7 @@ Suche dieses Plugin auf der DSH-Seite **Plugins** und verwende dort die Aktion z
392
392
  <summary>Terminalbefehle</summary>
393
393
 
394
394
  ```sh
395
- dsh plugin --profile web update dsh-codex-subscription@3.2.17
395
+ dsh plugin --profile web update dsh-codex-subscription@3.2.18
396
396
  ```
397
397
 
398
398
  Nur ausführen, wenn du deinstallieren möchtest:
package/README.en.md CHANGED
@@ -82,7 +82,7 @@ This plugin supports the latest DeepSeek Harness release recorded in its package
82
82
  2. Paste this package name, with its version, into the **Package name or address** field:
83
83
 
84
84
  ```text
85
- dsh-codex-subscription@3.2.17
85
+ dsh-codex-subscription@3.2.18
86
86
  ```
87
87
 
88
88
  3. Click **Install** and wait for completion. Follow the page instructions; save your work before restarting if requested.
@@ -99,7 +99,7 @@ Why the version is included: DSH's plugin page only installs versions that are a
99
99
  <summary>Terminal installation (with an existing dsh command)</summary>
100
100
 
101
101
  ```sh
102
- dsh plugin --profile web add dsh-codex-subscription@3.2.17
102
+ dsh plugin --profile web add dsh-codex-subscription@3.2.18
103
103
  ```
104
104
 
105
105
  Follow the restart instructions, then sign in under **Settings → Codex**. Both the Plugins page and the terminal use DSH's installation management.
@@ -112,7 +112,7 @@ Follow the restart instructions, then sign in under **Settings → Codex**. Both
112
112
  After signing in and selecting a Codex model in Web, install the same plugin in the Headless profile:
113
113
 
114
114
  ```sh
115
- dsh plugin --profile headless add dsh-codex-subscription@3.2.17
115
+ dsh plugin --profile headless add dsh-codex-subscription@3.2.18
116
116
  dsh --profile headless "Reply with only the word: ok"
117
117
  ```
118
118
 
@@ -392,7 +392,7 @@ Find this plugin on the DSH **Plugins** page and use its update or uninstall act
392
392
  <summary>Terminal commands</summary>
393
393
 
394
394
  ```sh
395
- dsh plugin --profile web update dsh-codex-subscription@3.2.17
395
+ dsh plugin --profile web update dsh-codex-subscription@3.2.18
396
396
  ```
397
397
 
398
398
  Run only when you want to uninstall:
package/README.es.md CHANGED
@@ -82,7 +82,7 @@ Este complemento es compatible con la versión más reciente de DeepSeek Harness
82
82
  2. Pega el nombre de este paquete, incluida su versión, en el campo **Nombre o dirección del paquete**:
83
83
 
84
84
  ```text
85
- dsh-codex-subscription@3.2.17
85
+ dsh-codex-subscription@3.2.18
86
86
  ```
87
87
 
88
88
  3. Haz clic en **Instalar** y espera a que termine. Sigue las instrucciones de la página; guarda tu trabajo antes de reiniciar si se te solicita.
@@ -99,7 +99,7 @@ Por qué se incluye la versión: la página de complementos de DSH solo instala
99
99
  <summary>Instalación desde la terminal (con un comando dsh existente)</summary>
100
100
 
101
101
  ```sh
102
- dsh plugin --profile web add dsh-codex-subscription@3.2.17
102
+ dsh plugin --profile web add dsh-codex-subscription@3.2.18
103
103
  ```
104
104
 
105
105
  Sigue las instrucciones para reiniciar y luego inicia sesión en **Configuración → Codex**. Tanto la página Complementos como la terminal usan la administración de instalaciones de DSH.
@@ -112,7 +112,7 @@ Sigue las instrucciones para reiniciar y luego inicia sesión en **Configuració
112
112
  Después de iniciar sesión y seleccionar un modelo de Codex en Web, instala el mismo complemento en el perfil Headless:
113
113
 
114
114
  ```sh
115
- dsh plugin --profile headless add dsh-codex-subscription@3.2.17
115
+ dsh plugin --profile headless add dsh-codex-subscription@3.2.18
116
116
  dsh --profile headless "Reply with only the word: ok"
117
117
  ```
118
118
 
@@ -392,7 +392,7 @@ Busca este plugin en la página **Complementos** de DSH y usa la opción de actu
392
392
  <summary>Comandos de terminal</summary>
393
393
 
394
394
  ```sh
395
- dsh plugin --profile web update dsh-codex-subscription@3.2.17
395
+ dsh plugin --profile web update dsh-codex-subscription@3.2.18
396
396
  ```
397
397
 
398
398
  Ejecuta solo si quieres desinstalarlo:
package/README.fr.md CHANGED
@@ -82,7 +82,7 @@ Ce plugin prend en charge la dernière version de DeepSeek Harness indiquée dan
82
82
  2. Collez ce nom de package, avec sa version, dans le champ **Nom ou adresse du package** :
83
83
 
84
84
  ```text
85
- dsh-codex-subscription@3.2.17
85
+ dsh-codex-subscription@3.2.18
86
86
  ```
87
87
 
88
88
  3. Cliquez sur **Installer** et attendez la fin de l’installation. Suivez les instructions de la page ; enregistrez votre travail avant de redémarrer si cela vous est demandé.
@@ -99,7 +99,7 @@ Pourquoi inclure la version : la page des plugins de DSH n’installe que des ve
99
99
  <summary>Installation dans le terminal (avec une commande dsh déjà installée)</summary>
100
100
 
101
101
  ```sh
102
- dsh plugin --profile web add dsh-codex-subscription@3.2.17
102
+ dsh plugin --profile web add dsh-codex-subscription@3.2.18
103
103
  ```
104
104
 
105
105
  Suivez les instructions de redémarrage, puis connectez-vous dans **Paramètres → Codex**. La page Plugins et le terminal utilisent tous deux le système de gestion des installations de DSH.
@@ -112,7 +112,7 @@ Suivez les instructions de redémarrage, puis connectez-vous dans **Paramètres
112
112
  Après vous être connecté et avoir sélectionné un modèle Codex dans Web, installez le même plugin dans le profil Headless :
113
113
 
114
114
  ```sh
115
- dsh plugin --profile headless add dsh-codex-subscription@3.2.17
115
+ dsh plugin --profile headless add dsh-codex-subscription@3.2.18
116
116
  dsh --profile headless "Reply with only the word: ok"
117
117
  ```
118
118
 
@@ -392,7 +392,7 @@ Trouvez ce plugin sur la page **Plugins** de DSH et utilisez l’action de mise
392
392
  <summary>Commandes de terminal</summary>
393
393
 
394
394
  ```sh
395
- dsh plugin --profile web update dsh-codex-subscription@3.2.17
395
+ dsh plugin --profile web update dsh-codex-subscription@3.2.18
396
396
  ```
397
397
 
398
398
  À exécuter uniquement si vous souhaitez désinstaller :
package/README.ja.md CHANGED
@@ -82,7 +82,7 @@ DSH `0.2.2-rc.1` CLI/Web には Node.js **24.9 以降**が必要です。公式
82
82
  2. バージョンを含めた以下のパッケージ名を、**パッケージ名またはアドレス**欄に貼り付けます。
83
83
 
84
84
  ```text
85
- dsh-codex-subscription@3.2.17
85
+ dsh-codex-subscription@3.2.18
86
86
  ```
87
87
 
88
88
  3. **インストール**をクリックし、完了するまで待ちます。ページの指示に従ってください。再起動を求められた場合は、その前に作業内容を保存してください。
@@ -99,7 +99,7 @@ DSH `0.2.2-rc.1` CLI/Web には Node.js **24.9 以降**が必要です。公式
99
99
  <summary>ターミナルからインストール(dsh コマンドがすでにある場合)</summary>
100
100
 
101
101
  ```sh
102
- dsh plugin --profile web add dsh-codex-subscription@3.2.17
102
+ dsh plugin --profile web add dsh-codex-subscription@3.2.18
103
103
  ```
104
104
 
105
105
  再起動の指示に従い、その後 **設定 → Codex** でサインインしてください。プラグインページとターミナルのどちらからインストールしても、DSH のインストール管理機能が使用されます。
@@ -112,7 +112,7 @@ dsh plugin --profile web add dsh-codex-subscription@3.2.17
112
112
  Web でサインインし、Codex モデルを選択した後、Headless プロファイルにも同じプラグインをインストールします。
113
113
 
114
114
  ```sh
115
- dsh plugin --profile headless add dsh-codex-subscription@3.2.17
115
+ dsh plugin --profile headless add dsh-codex-subscription@3.2.18
116
116
  dsh --profile headless "Reply with only the word: ok"
117
117
  ```
118
118
 
@@ -392,7 +392,7 @@ DSH の **プラグイン** ページでこのプラグインを見つけ、更
392
392
  <summary>ターミナルコマンド</summary>
393
393
 
394
394
  ```sh
395
- dsh plugin --profile web update dsh-codex-subscription@3.2.17
395
+ dsh plugin --profile web update dsh-codex-subscription@3.2.18
396
396
  ```
397
397
 
398
398
  アンインストールする場合にのみ実行してください:
package/README.md CHANGED
@@ -74,7 +74,7 @@ DSH `0.2.2-rc.1` 的 CLI/Web 模式需要 Node.js **24.9 或更高版本**;官
74
74
  2. 在 **包名或地址** 输入框中粘贴下面的包名(已带版本号):
75
75
 
76
76
  ```text
77
- dsh-codex-subscription@3.2.17
77
+ dsh-codex-subscription@3.2.18
78
78
  ```
79
79
 
80
80
  3. 点击 **安装**,等待安装完成;按页面提示操作,需要重启时先保存工作。
@@ -91,7 +91,7 @@ DSH `0.2.2-rc.1` 的 CLI/Web 模式需要 Node.js **24.9 或更高版本**;官
91
91
  <summary>终端安装(已能运行 dsh 命令)</summary>
92
92
 
93
93
  ```sh
94
- dsh plugin --profile web add dsh-codex-subscription@3.2.17
94
+ dsh plugin --profile web add dsh-codex-subscription@3.2.18
95
95
  ```
96
96
 
97
97
  安装完成后按提示重启 DSH,再到 **设置 → Codex 订阅** 登录。插件页面和终端均由 DSH 管理安装。
@@ -104,7 +104,7 @@ dsh plugin --profile web add dsh-codex-subscription@3.2.17
104
104
  先在 Web 中完成登录并选择一次 Codex 模型,再把同一个插件安装到 Headless profile:
105
105
 
106
106
  ```sh
107
- dsh plugin --profile headless add dsh-codex-subscription@3.2.17
107
+ dsh plugin --profile headless add dsh-codex-subscription@3.2.18
108
108
  dsh --profile headless "只回复:ok"
109
109
  ```
110
110
 
@@ -368,7 +368,7 @@ Agent 先在画板绘制可编辑草图,再以该草图为参考调用订阅
368
368
  <summary>终端方式</summary>
369
369
 
370
370
  ```sh
371
- dsh plugin --profile web update dsh-codex-subscription@3.2.17
371
+ dsh plugin --profile web update dsh-codex-subscription@3.2.18
372
372
  ```
373
373
 
374
374
  仅在需要卸载时运行:
package/README.pt.md CHANGED
@@ -82,7 +82,7 @@ Este plugin é compatível com a versão mais recente do DeepSeek Harness regist
82
82
  2. Cole o nome deste pacote, com a versão, no campo **Nome ou endereço do pacote**:
83
83
 
84
84
  ```text
85
- dsh-codex-subscription@3.2.17
85
+ dsh-codex-subscription@3.2.18
86
86
  ```
87
87
 
88
88
  3. Clique em **Instalar** e aguarde a conclusão. Siga as instruções da página; salve seu trabalho antes de reiniciar, se solicitado.
@@ -99,7 +99,7 @@ Por que a versão está incluída: a página de plugins do DSH só instala vers
99
99
  <summary>Instalação pelo terminal (com um comando dsh existente)</summary>
100
100
 
101
101
  ```sh
102
- dsh plugin --profile web add dsh-codex-subscription@3.2.17
102
+ dsh plugin --profile web add dsh-codex-subscription@3.2.18
103
103
  ```
104
104
 
105
105
  Siga as instruções para reiniciar e entre em **Configurações → Codex**. Tanto a página Plugins quanto o terminal usam o gerenciamento de instalações do DSH.
@@ -112,7 +112,7 @@ Siga as instruções para reiniciar e entre em **Configurações → Codex**. Ta
112
112
  Depois de entrar e selecionar um modelo Codex na versão Web, instale o mesmo plugin no perfil Headless:
113
113
 
114
114
  ```sh
115
- dsh plugin --profile headless add dsh-codex-subscription@3.2.17
115
+ dsh plugin --profile headless add dsh-codex-subscription@3.2.18
116
116
  dsh --profile headless "Reply with only the word: ok"
117
117
  ```
118
118
 
@@ -392,7 +392,7 @@ Encontre este plugin na página **Plugins** do DSH e use a opção de atualizaç
392
392
  <summary>Comandos do terminal</summary>
393
393
 
394
394
  ```sh
395
- dsh plugin --profile web update dsh-codex-subscription@3.2.17
395
+ dsh plugin --profile web update dsh-codex-subscription@3.2.18
396
396
  ```
397
397
 
398
398
  Execute somente quando quiser desinstalar:
package/README.ru.md CHANGED
@@ -82,7 +82,7 @@
82
82
  2. Вставьте имя этого пакета вместе с его версией в поле **Package name or address**:
83
83
 
84
84
  ```text
85
- dsh-codex-subscription@3.2.17
85
+ dsh-codex-subscription@3.2.18
86
86
  ```
87
87
 
88
88
  3. Нажмите **Install** и дождитесь завершения. Следуйте инструкциям на странице; если будет предложено перезапустить приложение, перед этим сохраните свою работу.
@@ -99,7 +99,7 @@
99
99
  <summary>Установка через терминал (если команда dsh уже установлена)</summary>
100
100
 
101
101
  ```sh
102
- dsh plugin --profile web add dsh-codex-subscription@3.2.17
102
+ dsh plugin --profile web add dsh-codex-subscription@3.2.18
103
103
  ```
104
104
 
105
105
  Следуйте инструкциям по перезапуску, затем войдите в систему в разделе **Настройки → Codex**. И страница «Плагины», и терминал используют систему управления установками DSH.
@@ -112,7 +112,7 @@ dsh plugin --profile web add dsh-codex-subscription@3.2.17
112
112
  Войдите в систему и выберите модель Codex в Web, затем установите тот же плагин в профиле Headless:
113
113
 
114
114
  ```sh
115
- dsh plugin --profile headless add dsh-codex-subscription@3.2.17
115
+ dsh plugin --profile headless add dsh-codex-subscription@3.2.18
116
116
  dsh --profile headless "Reply with only the word: ok"
117
117
  ```
118
118
 
@@ -392,7 +392,7 @@ DSH управляет диалогами, подтверждениями инс
392
392
  <summary>Команды терминала</summary>
393
393
 
394
394
  ```sh
395
- dsh plugin --profile web update dsh-codex-subscription@3.2.17
395
+ dsh plugin --profile web update dsh-codex-subscription@3.2.18
396
396
  ```
397
397
 
398
398
  Запускайте только в том случае, если хотите удалить плагин:
package/README.zh-CN.md CHANGED
@@ -74,7 +74,7 @@ DSH `0.2.2-rc.1` 的 CLI/Web 模式需要 Node.js **24.9 或更高版本**;官
74
74
  2. 在 **包名或地址** 输入框中粘贴下面的包名(已带版本号):
75
75
 
76
76
  ```text
77
- dsh-codex-subscription@3.2.17
77
+ dsh-codex-subscription@3.2.18
78
78
  ```
79
79
 
80
80
  3. 点击 **安装**,等待安装完成;按页面提示操作,需要重启时先保存工作。
@@ -91,7 +91,7 @@ DSH `0.2.2-rc.1` 的 CLI/Web 模式需要 Node.js **24.9 或更高版本**;官
91
91
  <summary>终端安装(已能运行 dsh 命令)</summary>
92
92
 
93
93
  ```sh
94
- dsh plugin --profile web add dsh-codex-subscription@3.2.17
94
+ dsh plugin --profile web add dsh-codex-subscription@3.2.18
95
95
  ```
96
96
 
97
97
  安装完成后按提示重启 DSH,再到 **设置 → Codex 订阅** 登录。插件页面和终端均由 DSH 管理安装。
@@ -104,7 +104,7 @@ dsh plugin --profile web add dsh-codex-subscription@3.2.17
104
104
  先在 Web 中完成登录并选择一次 Codex 模型,再把同一个插件安装到 Headless profile:
105
105
 
106
106
  ```sh
107
- dsh plugin --profile headless add dsh-codex-subscription@3.2.17
107
+ dsh plugin --profile headless add dsh-codex-subscription@3.2.18
108
108
  dsh --profile headless "只回复:ok"
109
109
  ```
110
110
 
@@ -368,7 +368,7 @@ Agent 先在画板绘制可编辑草图,再以该草图为参考调用订阅
368
368
  <summary>终端方式</summary>
369
369
 
370
370
  ```sh
371
- dsh plugin --profile web update dsh-codex-subscription@3.2.17
371
+ dsh plugin --profile web update dsh-codex-subscription@3.2.18
372
372
  ```
373
373
 
374
374
  仅在需要卸载时运行:
package/lib/client.js CHANGED
@@ -11779,7 +11779,7 @@ a.codexVoiceCall{display:flex;align-items:center;justify-content:center;box-sizi
11779
11779
  }
11780
11780
  //#endregion
11781
11781
  //#region src/version.js
11782
- const PACKAGE_VERSION = "3.2.17";
11782
+ const PACKAGE_VERSION = "3.2.18";
11783
11783
  //#endregion
11784
11784
  //#region src/client-recovery.js
11785
11785
  async function recoveryCall(rpc, endpoint, payload = {}, timeoutMs = endpoint === "usage" || endpoint.startsWith("usage/") ? 3e4 : 1e4) {
@@ -17609,23 +17609,28 @@ void main(){
17609
17609
  const [saving, setSaving] = (0, react.useState)(false);
17610
17610
  (0, react.useEffect)(() => {
17611
17611
  if (!form) return;
17612
- return ctx.inject(["remote.web"], (scope) => scope.effect(() => {
17613
- const remote = scope.get("remote");
17614
- let generation = 0;
17615
- const load = async () => {
17616
- const current = ++generation;
17617
- const result = await remote.web.listProviders().catch(() => void 0);
17618
- if (current === generation) setProviders(result?.ok ? result.value : void 0);
17619
- };
17620
- const off = remote.$on("web/providers-changed", load);
17621
- const offReset = scope.on("connection/reset", load);
17622
- load();
17623
- return () => {
17624
- generation++;
17625
- off();
17626
- offReset();
17627
- };
17628
- }));
17612
+ const fiber = ctx.inject(["remote.web"], (scope) => {
17613
+ scope.effect(() => {
17614
+ const remote = scope.get("remote");
17615
+ let generation = 0;
17616
+ const load = async () => {
17617
+ const current = ++generation;
17618
+ const result = await remote.web.listProviders().catch(() => void 0);
17619
+ if (current === generation) setProviders(result?.ok ? result.value : void 0);
17620
+ };
17621
+ const off = remote.$on("web/providers-changed", load);
17622
+ const offReset = scope.on("connection/reset", load);
17623
+ load();
17624
+ return () => {
17625
+ generation++;
17626
+ off();
17627
+ offReset();
17628
+ };
17629
+ }, "codex-subscription: web provider discovery");
17630
+ });
17631
+ return () => {
17632
+ fiber.dispose();
17633
+ };
17629
17634
  }, [ctx, form]);
17630
17635
  const change = async (field, value) => {
17631
17636
  setSaving(true);
package/lib/index.js CHANGED
@@ -4889,7 +4889,7 @@ function inheritedOriginalImageRef(session, assetId) {
4889
4889
  }
4890
4890
  //#endregion
4891
4891
  //#region src/version.js
4892
- const PACKAGE_VERSION = "3.2.17";
4892
+ const PACKAGE_VERSION = "3.2.18";
4893
4893
  const USER_AGENT = `dsh-codex-subscription/${PACKAGE_VERSION}`;
4894
4894
  //#endregion
4895
4895
  //#region src/image-original-store.js
@@ -7616,6 +7616,69 @@ function createVoiceQuestions({ speak, now = Date.now, deliveryMs = 15e3 }) {
7616
7616
  };
7617
7617
  return questions;
7618
7618
  }
7619
+ const validId = (value) => typeof value === "string" && /^[a-f0-9-]{36}$/u.test(value);
7620
+ const valid = (value) => validId(value?.id) && Array.isArray(value.entries) && value.entries.length <= 200 && value.entries.every((entry) => validId(entry?.callId) && ["user", "assistant"].includes(entry.role) && typeof entry.text === "string" && entry.text.length <= 4096);
7621
+ /** Temporary recovery data, removed once the native session has durably recorded it. */
7622
+ function createVoiceTranscriptRecovery(directory) {
7623
+ const pending = /* @__PURE__ */ new Map();
7624
+ const filename = (id) => join(directory, createHash("sha256").update(id).digest("hex") + ".json");
7625
+ const read = async (threadId) => {
7626
+ try {
7627
+ const value = JSON.parse(await readFile(filename(threadId), "utf8"));
7628
+ return valid(value) ? value : void 0;
7629
+ } catch (error) {
7630
+ if (error.code !== "ENOENT" && !(error instanceof SyntaxError)) throw error;
7631
+ }
7632
+ };
7633
+ const enqueue = (threadId, operation) => {
7634
+ const next = (pending.get(threadId) ?? Promise.resolve()).catch(() => {}).then(operation);
7635
+ pending.set(threadId, next);
7636
+ const forget = () => {
7637
+ if (pending.get(threadId) === next) pending.delete(threadId);
7638
+ };
7639
+ next.then(forget, forget);
7640
+ return next;
7641
+ };
7642
+ return {
7643
+ async load(threadId) {
7644
+ await pending.get(threadId)?.catch(() => {});
7645
+ return read(threadId);
7646
+ },
7647
+ save(threadId, checkpoint) {
7648
+ return enqueue(threadId, async () => {
7649
+ await mkdir(directory, {
7650
+ recursive: true,
7651
+ mode: 448
7652
+ });
7653
+ const file = filename(threadId);
7654
+ const temporary = `${file}.${randomUUID()}.tmp`;
7655
+ try {
7656
+ await writeFile(temporary, JSON.stringify(checkpoint), {
7657
+ flag: "wx",
7658
+ mode: 384,
7659
+ flush: true
7660
+ });
7661
+ await rename(temporary, file);
7662
+ if (process.platform !== "win32") {
7663
+ const handle = await open(directory, "r");
7664
+ try {
7665
+ await handle.sync();
7666
+ } finally {
7667
+ await handle.close();
7668
+ }
7669
+ }
7670
+ } finally {
7671
+ await rm(temporary, { force: true });
7672
+ }
7673
+ });
7674
+ },
7675
+ remove(threadId, checkpointId) {
7676
+ return enqueue(threadId, async () => {
7677
+ if ((await read(threadId))?.id === checkpointId) await rm(filename(threadId), { force: true });
7678
+ });
7679
+ }
7680
+ };
7681
+ }
7619
7682
  //#endregion
7620
7683
  //#region src/remote-control-realtime.js
7621
7684
  const SIDEBAND_BASES = ["wss://api.openai.com/v1/live", "wss://realtime.chatgpt.com/v1/live"];
@@ -7645,6 +7708,8 @@ function callNote(transcript) {
7645
7708
  return VOICE_NOTE_PREFIX + dialogue(transcript);
7646
7709
  }
7647
7710
  const VOICE_NOTE_PREFIX = "Part of the voice call that was not handed over as a request:\n";
7711
+ const VOICE_NOTE_SOURCE = "codex-subscription-voice";
7712
+ const recentCallNote = (entries) => callNote(entries.slice(-6));
7648
7713
  /** Which side channel an agent message belongs on: progress is commentary, an answer is spoken. */
7649
7714
  function channelOf(text, prefixes = CHANNEL_PREFIXES) {
7650
7715
  for (const [name, list] of Object.entries(prefixes)) if (Array.isArray(list) && list.some((prefix) => prefix !== "" && text.startsWith(prefix))) return name === "final" ? "speakable" : name === "analysis" ? void 0 : "commentary";
@@ -7893,27 +7958,44 @@ function createRealtimeVoice(options) {
7893
7958
  }
7894
7959
  throw last ?? /* @__PURE__ */ new Error("no voice endpoint answered");
7895
7960
  }
7961
+ const pendingTranscript = async (threadId, checkpoint) => {
7962
+ const ids = new Set(checkpoint.entries.map((entry) => entry.callId));
7963
+ const recorded = await options.recordedIds?.(threadId, ids);
7964
+ return checkpoint.entries.filter((entry) => !recorded?.has(entry.callId));
7965
+ };
7896
7966
  const flushTail = (threadId, session) => {
7897
- if (!session.flushTail || session.tail.length === 0) return;
7967
+ if (!session.flushTail || session.tail.length === 0 && !session.recovered) return;
7898
7968
  const transcript = session.tail.splice(0);
7969
+ const restored = session.recovered;
7970
+ const combined = [...restored?.entries ?? [], ...transcript].slice(-200);
7899
7971
  const note = session.silent && options.record ? callNote(transcript) : void 0;
7900
7972
  const notes = note ? savingNotes.get(threadId) ?? /* @__PURE__ */ new Set() : void 0;
7901
- const latest = note ? { text: callNote(transcript.slice(-6).map((entry) => ({
7902
- ...entry,
7903
- text: entry.text.slice(-350)
7904
- }))) } : void 0;
7973
+ const latest = note ? { text: recentCallNote(combined) } : void 0;
7905
7974
  if (notes) {
7906
7975
  notes.add(latest);
7907
7976
  if (notes.size > 2) notes.delete(notes.values().next().value);
7908
7977
  savingNotes.set(threadId, notes);
7909
7978
  }
7910
- const save = note ? () => options.record(threadId, note) : () => options.delegate(threadId, callRecord(transcript), () => {});
7911
- session.chain = (note ? session.admission : session.chain).then(save).catch((error) => log.warn("voice", "could not save the voice transcript to the conversation", String(error?.message ?? error))).finally(() => {
7979
+ const save = session.checkpointId ? async () => {
7980
+ const prior = restored ? await pendingTranscript(threadId, restored) : [];
7981
+ const calls = Map.groupBy([...prior, ...transcript].slice(-200), (entry) => entry.callId);
7982
+ for (const [recordId, entries] of calls) if (!await options.record(threadId, callNote(entries), recordId)) return;
7983
+ await options.recovery.remove(threadId, session.checkpointId);
7984
+ if (restored) await options.recovery.remove(threadId, restored.id);
7985
+ } : note ? () => options.record(threadId, note) : () => options.delegate(threadId, callRecord(transcript), () => {});
7986
+ session.chain = Promise.all([note ? session.admission : session.chain, session.transcriptWrite]).then(save).catch(() => log.warn("voice", "could not save the voice transcript to the conversation")).finally(() => {
7912
7987
  if (!notes) return;
7913
7988
  notes.delete(latest);
7914
7989
  if (notes.size === 0 && savingNotes.get(threadId) === notes) savingNotes.delete(threadId);
7915
7990
  });
7916
7991
  };
7992
+ const announceClosed = (threadId, session, reason) => {
7993
+ const announce = () => session.notify("thread/realtime/closed", {
7994
+ threadId,
7995
+ reason
7996
+ });
7997
+ (session.transcriptWrite ? session.transcriptWrite.then(announce) : announce()).catch(() => {});
7998
+ };
7917
7999
  const stop = (threadId, reason = "requested") => {
7918
8000
  const pending = starts.get(threadId);
7919
8001
  starts.delete(threadId);
@@ -7935,10 +8017,7 @@ function createRealtimeVoice(options) {
7935
8017
  try {
7936
8018
  session.ws.close();
7937
8019
  } catch {}
7938
- session.notify("thread/realtime/closed", {
7939
- threadId,
7940
- reason
7941
- }).catch(() => {});
8020
+ announceClosed(threadId, session, reason);
7942
8021
  return true;
7943
8022
  };
7944
8023
  /** Give the client time to finish speaking before it stops the call. */
@@ -7958,9 +8037,23 @@ function createRealtimeVoice(options) {
7958
8037
  const pending = new AbortController();
7959
8038
  starts.set(threadId, pending);
7960
8039
  const lifetime = signal ? AbortSignal.any([signal, pending.signal]) : pending.signal;
7961
- let credential, ws;
8040
+ let credential, ws, recovered;
8041
+ const recoverable = desktop && params.silentTailRecord === true && params.flushTranscriptTailOnSessionEnd !== false && options.recovery && options.record;
7962
8042
  try {
7963
8043
  lifetime.throwIfAborted();
8044
+ if (recoverable) try {
8045
+ const checkpoint = await options.recovery.load(threadId);
8046
+ if (checkpoint) {
8047
+ const entries = await pendingTranscript(threadId, checkpoint);
8048
+ if (entries.length > 0) recovered = {
8049
+ ...checkpoint,
8050
+ entries
8051
+ };
8052
+ else await options.recovery.remove(threadId, checkpoint.id);
8053
+ }
8054
+ } catch {
8055
+ log.warn("voice", "could not read the voice recovery checkpoint");
8056
+ }
7964
8057
  credential = await options.credentials(lifetime);
7965
8058
  lifetime.throwIfAborted();
7966
8059
  } catch (error) {
@@ -8008,6 +8101,10 @@ function createRealtimeVoice(options) {
8008
8101
  silent: params.silentTailRecord === true,
8009
8102
  hangUp: params.hangUpOnGoodbye === true
8010
8103
  };
8104
+ if (recoverable) {
8105
+ session.checkpointId = crypto.randomUUID();
8106
+ session.recovered = recovered;
8107
+ }
8011
8108
  session.flowId = crypto.randomUUID().slice(0, 8);
8012
8109
  session.openedAt = performance.now();
8013
8110
  session.desktop = desktop;
@@ -8245,7 +8342,11 @@ function createRealtimeVoice(options) {
8245
8342
  if (event.text.trim()) session.awaitingVoiceReply = true;
8246
8343
  }
8247
8344
  if (event.text.trim() !== "") {
8248
- session.tail.push({
8345
+ session.tail.push(session.checkpointId ? {
8346
+ callId: session.checkpointId,
8347
+ role: event.role,
8348
+ text: bounded(event.text)
8349
+ } : {
8249
8350
  role: event.role,
8250
8351
  text: event.text
8251
8352
  });
@@ -8256,11 +8357,25 @@ function createRealtimeVoice(options) {
8256
8357
  });
8257
8358
  if (session.lines.length > 12) session.lines.shift();
8258
8359
  }
8259
- notify("thread/realtime/transcript/done", {
8360
+ const complete = () => notify("thread/realtime/transcript/done", {
8260
8361
  threadId,
8261
8362
  role: event.role,
8262
8363
  text: event.text
8263
- }).catch(() => {});
8364
+ });
8365
+ if (session.checkpointId && event.text.trim() !== "") {
8366
+ const entries = [...session.recovered?.entries ?? [], ...session.tail].slice(-200);
8367
+ const save = options.recovery.save(threadId, {
8368
+ id: session.checkpointId,
8369
+ entries
8370
+ });
8371
+ session.transcriptWrite = save.catch(() => {
8372
+ log.warn("voice", "could not save the voice recovery checkpoint");
8373
+ });
8374
+ save.then(complete, () => notify("thread/realtime/error", {
8375
+ threadId,
8376
+ message: "The voice transcript could not be saved."
8377
+ })).catch(() => {});
8378
+ } else complete().catch(() => {});
8264
8379
  const spoken = event.text.trim();
8265
8380
  const said = Date.now();
8266
8381
  const endsCall = event.role === "user" && classifySpokenHangup ? checkFinalSpeech(spoken, said) : void 0;
@@ -8327,14 +8442,13 @@ function createRealtimeVoice(options) {
8327
8442
  session.questions.close();
8328
8443
  flushTail(threadId, session);
8329
8444
  log.warn("voice", "the voice call closed");
8330
- notify("thread/realtime/closed", {
8331
- threadId,
8332
- reason: "transportClosed"
8333
- }).catch(() => {});
8445
+ announceClosed(threadId, session, "transportClosed");
8334
8446
  });
8335
8447
  ws.on("error", (error) => log.warn("voice", "the voice connection failed", String(error?.message ?? error)));
8336
8448
  if (startupContext) try {
8337
- const context = startupContext([...savingNotes.get(threadId) ?? []].map((note) => note.text));
8449
+ const notes = [...savingNotes.get(threadId) ?? []].map((note) => note.text);
8450
+ if (recovered?.entries.length) notes.push(recentCallNote(recovered.entries));
8451
+ const context = startupContext(notes);
8338
8452
  if (context) {
8339
8453
  for (const piece of appendChunks(context)) if (!send(outbound.sessionAppend(piece, "commentary"))) break;
8340
8454
  }
@@ -8966,7 +9080,7 @@ function voiceStartupContext(agent, saving) {
8966
9080
  const entries = [];
8967
9081
  const notes = /* @__PURE__ */ new Set();
8968
9082
  const addNote = (text) => {
8969
- const excerpt = appendChunks(text.trim(), 1050)[0];
9083
+ const excerpt = appendChunks(VOICE_NOTE_PREFIX + text.slice(62).trim().split("\n").slice(-6).reverse().map((line) => line.replace(/^(You: |Voice: )(.*)$/u, (_, role, speech) => role + speech.slice(-350))).join("\n"), 1050)[0];
8970
9084
  if (excerpt && !notes.has(excerpt)) {
8971
9085
  notes.add(excerpt);
8972
9086
  entries.push(excerpt);
@@ -8981,7 +9095,7 @@ function voiceStartupContext(agent, saving) {
8981
9095
  }
8982
9096
  for (let i = messages.length - 1; i >= 0 && entries.length < 8; i--) {
8983
9097
  const message = messages[i];
8984
- const text = message.role === "assistant" ? visibleText(message.content) : typedText(message);
9098
+ const text = message.role === "assistant" || message.source?.kind === "codex-subscription-voice" ? visibleText(message.content) : typedText(message);
8985
9099
  if (text.startsWith("Part of the voice call that was not handed over as a request:\n")) addNote(text);
8986
9100
  else if (text) entries.push(`${message.role === "user" ? "User" : "Assistant"}: ${appendChunks(text, 420)[0]}`);
8987
9101
  }
@@ -10333,8 +10447,29 @@ function createDshRemoteControl({ controller, agents, permissions = () => void 0
10333
10447
  }, AbortSignal.timeout(3e4)))?.accepted === false) throw new Error("DSH rejected the message");
10334
10448
  };
10335
10449
  /** Leave text in the conversation's context for its next message, without starting a turn. */
10336
- const recordToAgent = async (threadId, text) => {
10450
+ const recordedIds = async (threadId, ids) => {
10451
+ if (typeof voice?.flushSession !== "function") return;
10452
+ const { session } = await agentFor(threadId);
10453
+ const found = session.deriveMessages().filter((message) => ids.has(message.id) && message.source?.kind === "codex-subscription-voice");
10454
+ if (!found.length || !await voice.flushSession(session)) return;
10455
+ return new Set(found.map((message) => message.id));
10456
+ };
10457
+ const recordToAgent = async (threadId, text, checkpointId) => {
10337
10458
  const agent = await agentFor(threadId);
10459
+ if (checkpointId && typeof voice?.flushSession === "function" && typeof agent.session.append === "function") {
10460
+ while (agent.status === "running" && typeof agent.whenIdle === "function") await agent.whenIdle();
10461
+ if (agent.status === "running") return false;
10462
+ if (!agent.session.deriveMessages().some((message) => message.id === checkpointId && message.source?.kind === "codex-subscription-voice")) agent.session.append("user/message", {
10463
+ id: checkpointId,
10464
+ role: "user",
10465
+ content: [{
10466
+ type: "text",
10467
+ text
10468
+ }],
10469
+ source: { kind: VOICE_NOTE_SOURCE }
10470
+ }, { surfaceOp: "append" });
10471
+ return await voice.flushSession(agent.session) === true;
10472
+ }
10338
10473
  if (typeof agent.inject !== "function") return;
10339
10474
  if (agent.status === "running") await agent.whenIdle?.();
10340
10475
  agent.inject({
@@ -10353,7 +10488,8 @@ function createDshRemoteControl({ controller, agents, permissions = () => void 0
10353
10488
  log: diagnosticLog,
10354
10489
  delegate: delegateToAgent,
10355
10490
  queue: queueVoiceWork,
10356
- record: recordToAgent
10491
+ record: recordToAgent,
10492
+ recordedIds
10357
10493
  }) : void 0;
10358
10494
  const phoneConfig = createPhoneConfig(configFile);
10359
10495
  const methods = {
@@ -18876,6 +19012,8 @@ function apply(ctx, config = {}) {
18876
19012
  configFile: dshHomePath("state", "codex-subscription", "remote-config.json"),
18877
19013
  voice: {
18878
19014
  WebSocket,
19015
+ recovery: createVoiceTranscriptRecovery(dshHomePath("state", "codex-subscription", "voice-transcript-recovery")),
19016
+ flushSession: (session) => ctx.get?.("sessions")?.flush?.(session),
18879
19017
  resolveProxy: resolveCodexOAuthProxy,
18880
19018
  fetch: (input, init) => network.fetch("voice", input, init),
18881
19019
  credentials: (signal) => readSubscriptionCredentials(resolveAuth, (options) => store.read(PROVIDER, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-codex-subscription",
3
- "version": "3.2.17",
3
+ "version": "3.2.18",
4
4
  "description": "Use ChatGPT and Codex subscriptions in DeepSeek Harness with OAuth, quota, safe resets, web search, images and Fast mode, and control DSH from the ChatGPT mobile app (Beta)",
5
5
  "type": "module",
6
6
  "main": "./lib/index.js",