dsh-codex-subscription 3.1.2 → 3.1.4

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.en.md CHANGED
@@ -42,7 +42,7 @@ This plugin supports the latest DeepSeek Harness release recorded in its package
42
42
  2. Paste this package name, with its version, into the **Package name or address** field:
43
43
 
44
44
  ```text
45
- dsh-codex-subscription@3.1.2
45
+ dsh-codex-subscription@3.1.4
46
46
  ```
47
47
 
48
48
  3. Click **Install** and wait for completion. Follow the page instructions; save your work before restarting if requested.
@@ -54,7 +54,7 @@ Why the version is included: DSH's plugin page only installs versions that are a
54
54
  <summary>Terminal installation (with an existing dsh command)</summary>
55
55
 
56
56
  ```sh
57
- dsh plugin --profile web add dsh-codex-subscription@3.1.2
57
+ dsh plugin --profile web add dsh-codex-subscription@3.1.4
58
58
  ```
59
59
 
60
60
  Follow the restart instructions, then sign in under **Settings → Codex**. Both the Plugins page and the terminal use DSH's installation management.
@@ -67,7 +67,7 @@ Follow the restart instructions, then sign in under **Settings → Codex**. Both
67
67
  After signing in and selecting a Codex model in Web, install the same plugin in the Headless profile:
68
68
 
69
69
  ```sh
70
- dsh plugin --profile headless add dsh-codex-subscription@3.1.2
70
+ dsh plugin --profile headless add dsh-codex-subscription@3.1.4
71
71
  dsh --profile headless "Reply with only the word: ok"
72
72
  ```
73
73
 
@@ -294,7 +294,7 @@ Find this plugin on the DSH **Plugins** page and use its update or uninstall act
294
294
  <summary>Terminal commands</summary>
295
295
 
296
296
  ```sh
297
- dsh plugin --profile web update dsh-codex-subscription@3.1.2
297
+ dsh plugin --profile web update dsh-codex-subscription@3.1.4
298
298
  ```
299
299
 
300
300
  Run only when you want to uninstall:
package/README.md CHANGED
@@ -42,7 +42,7 @@
42
42
  2. 在 **包名或地址** 输入框中粘贴下面的包名(已带版本号):
43
43
 
44
44
  ```text
45
- dsh-codex-subscription@3.1.2
45
+ dsh-codex-subscription@3.1.4
46
46
  ```
47
47
 
48
48
  3. 点击 **安装**,等待安装完成;按页面提示操作,需要重启时先保存工作。
@@ -54,7 +54,7 @@
54
54
  <summary>终端安装(已能运行 dsh 命令)</summary>
55
55
 
56
56
  ```sh
57
- dsh plugin --profile web add dsh-codex-subscription@3.1.2
57
+ dsh plugin --profile web add dsh-codex-subscription@3.1.4
58
58
  ```
59
59
 
60
60
  安装完成后按提示重启 DSH,再到 **设置 → Codex 订阅** 登录。插件页面和终端均由 DSH 管理安装。
@@ -67,7 +67,7 @@ dsh plugin --profile web add dsh-codex-subscription@3.1.2
67
67
  先在 Web 中完成登录并选择一次 Codex 模型,再把同一个插件安装到 Headless profile:
68
68
 
69
69
  ```sh
70
- dsh plugin --profile headless add dsh-codex-subscription@3.1.2
70
+ dsh plugin --profile headless add dsh-codex-subscription@3.1.4
71
71
  dsh --profile headless "只回复:ok"
72
72
  ```
73
73
 
@@ -308,7 +308,7 @@ DSH 实机设置截图,随浅色 / 深色主题切换。
308
308
  <summary>终端方式</summary>
309
309
 
310
310
  ```sh
311
- dsh plugin --profile web update dsh-codex-subscription@3.1.2
311
+ dsh plugin --profile web update dsh-codex-subscription@3.1.4
312
312
  ```
313
313
 
314
314
  仅在需要卸载时运行:
package/lib/client.js CHANGED
@@ -995,7 +995,7 @@ window.__ModuleLoader__.load({
995
995
  const hasImage = (block) => block?.content?.some((part) => part.type === "image" && part.attachment);
996
996
  const isImage = (part) => part?.type === "image" && part.attachment;
997
997
  const resultsOf = (event) => {
998
- if (event?.type !== "tool/result" || event.data.meta?.kind !== "codex-subscription-image") return [];
998
+ if (event?.type !== "tool/result" || !["codex-subscription-image", "codex-subscription-sketch-finish"].includes(event.data.meta?.kind) || event.data.message?.isError) return [];
999
999
  const content = event.data.message?.content ?? [];
1000
1000
  const wrapped = content.filter((block) => block.type === "tool-result" && !block.isError && hasImage(block));
1001
1001
  if (wrapped.length > 0) return wrapped;
@@ -1258,6 +1258,7 @@ window.__ModuleLoader__.load({
1258
1258
  "voice/start",
1259
1259
  "voice/stop",
1260
1260
  "voice/status",
1261
+ "voice/interrupt",
1261
1262
  "voice/preview",
1262
1263
  "voice/catalog",
1263
1264
  "remote/status",
@@ -4001,7 +4002,7 @@ window.__ModuleLoader__.load({
4001
4002
  }
4002
4003
  if (request.revision === void 0) throw stale("revision is required: copy it from the last result");
4003
4004
  if (request.revision !== current.revision || adapter.busy()) throw stale("Sketch changed or is being edited; inspect again");
4004
- let changedObjects, progress, previousError;
4005
+ let changedObjects, progress, previousError, png, delivery;
4005
4006
  const report = {};
4006
4007
  const measureNow = async () => {
4007
4008
  try {
@@ -4051,7 +4052,13 @@ window.__ModuleLoader__.load({
4051
4052
  if (request.name !== void 0 && (typeof request.name !== "string" || request.name.length > 60)) throw Error("Invalid draft name");
4052
4053
  pending = true;
4053
4054
  try {
4055
+ if (request.finalPreview) png = await adapter.preview({ drawingOnly: true });
4054
4056
  await adapter.save(request.name);
4057
+ if (request.finalPreview) delivery = {
4058
+ status: "saved",
4059
+ documentId: current.documentId,
4060
+ revision: current.revision
4061
+ };
4055
4062
  } finally {
4056
4063
  pending = false;
4057
4064
  }
@@ -4071,7 +4078,11 @@ window.__ModuleLoader__.load({
4071
4078
  } : {},
4072
4079
  ...report?.warnings?.length ? { warnings: report.warnings } : {},
4073
4080
  ...report?.clampedPoints ? { clampedPoints: report.clampedPoints } : {},
4074
- ...progress ? { progress } : {}
4081
+ ...progress ? { progress } : {},
4082
+ ...png ? {
4083
+ png,
4084
+ delivery
4085
+ } : {}
4075
4086
  };
4076
4087
  completed.set(key, {
4077
4088
  fingerprint,
@@ -4082,10 +4093,10 @@ window.__ModuleLoader__.load({
4082
4093
  revision: result.revision
4083
4094
  }
4084
4095
  });
4085
- cachedCharacters += fingerprint.length;
4096
+ cachedCharacters += fingerprint.length + (png?.length ?? 0);
4086
4097
  while (completed.size > 1 && (completed.size > 128 || cachedCharacters > 4e6)) {
4087
4098
  const oldest = completed.keys().next().value;
4088
- cachedCharacters -= completed.get(oldest).fingerprint.length;
4099
+ cachedCharacters -= completed.get(oldest).fingerprint.length + (completed.get(oldest).result.png?.length ?? 0);
4089
4100
  completed.delete(oldest);
4090
4101
  }
4091
4102
  if (request.action === "apply" && request.look === true && typeof adapter.preview === "function") {
@@ -4691,7 +4702,7 @@ window.__ModuleLoader__.load({
4691
4702
  grid(context, surface.width, surface.height);
4692
4703
  return surface.toDataURL("image/png");
4693
4704
  }
4694
- const surface = render(doc);
4705
+ const surface = render(options.drawingOnly ? drawingOf(doc) : doc);
4695
4706
  grid(surface.getContext("2d"), surface.width, surface.height);
4696
4707
  return surface.toDataURL("image/png");
4697
4708
  }
@@ -5482,7 +5493,8 @@ window.__ModuleLoader__.load({
5482
5493
  }
5483
5494
  const value = await execute(request.action === "finish" ? {
5484
5495
  ...request,
5485
- action: "save"
5496
+ action: "save",
5497
+ finalPreview: true
5486
5498
  } : request);
5487
5499
  if (version !== generation) throw Error("Drawing interrupted");
5488
5500
  if (request.action !== "finish") return {
@@ -7322,6 +7334,7 @@ window.__ModuleLoader__.load({
7322
7334
  voiceLang_de: "Deutsch",
7323
7335
  voiceLang_pt: "Português",
7324
7336
  voiceLang_ru: "Русский",
7337
+ voicePreviewHint: "切换回答语言会播放该语言的试听;选择自动跟随时,试听使用英语。",
7325
7338
  remoteHint: "开启后,这台电脑上的 DSH 会出现在 ChatGPT 手机 App 的 Codex 主机列表里,可用手机查看对话、发消息、切换模型和审批。需要订阅账号登录;电脑要保持开机和联网。",
7326
7339
  remoteConnected: "电脑已连上 ChatGPT,还没有手机连接",
7327
7340
  remoteConnecting: "正在连接",
@@ -8165,6 +8178,7 @@ window.__ModuleLoader__.load({
8165
8178
  voiceLang_de: "Deutsch",
8166
8179
  voiceLang_pt: "Português",
8167
8180
  voiceLang_ru: "Русский",
8181
+ voicePreviewHint: "Changing the answer language plays a sample in that language. Auto uses an English sample.",
8168
8182
  remoteHint: "When on, this computer's DSH appears as a host in the ChatGPT mobile app's Codex list, so you can follow conversations, send messages, switch models and approve actions from your phone. Needs a signed-in subscription account; the computer must stay on and online.",
8169
8183
  remoteConnected: "This computer is online with ChatGPT; no phone connected yet",
8170
8184
  remoteConnecting: "Connecting",
@@ -11478,7 +11492,7 @@ window.__ModuleLoader__.load({
11478
11492
  }
11479
11493
  //#endregion
11480
11494
  //#region src/version.js
11481
- const PACKAGE_VERSION = "3.1.2";
11495
+ const PACKAGE_VERSION = "3.1.4";
11482
11496
  //#endregion
11483
11497
  //#region src/client-recovery.js
11484
11498
  async function recoveryCall(rpc, endpoint, payload = {}, timeoutMs = 1e4) {
@@ -12216,6 +12230,35 @@ window.__ModuleLoader__.load({
12216
12230
  });
12217
12231
  }
12218
12232
  //#endregion
12233
+ //#region src/voice-barge-in.js
12234
+ /** Mute playback promptly, and restore it only after interrupted audio has drained. */
12235
+ function createBargeInGate({ interrupt, changed, speechMs = 120, silenceMs = 400 }) {
12236
+ let speakingAt, quietAt, outputQuietAt, suppressed = false, drained = false;
12237
+ return { sample({ mic, output, now }) {
12238
+ if (mic > .12) {
12239
+ speakingAt ??= now;
12240
+ quietAt = void 0;
12241
+ } else {
12242
+ speakingAt = void 0;
12243
+ quietAt ??= now;
12244
+ }
12245
+ if (output < .025) outputQuietAt ??= now;
12246
+ else outputQuietAt = void 0;
12247
+ if (!suppressed && speakingAt !== void 0 && now - speakingAt >= speechMs && output > .025) {
12248
+ suppressed = true;
12249
+ drained = false;
12250
+ changed(true);
12251
+ interrupt();
12252
+ }
12253
+ if (suppressed && outputQuietAt !== void 0 && now - outputQuietAt >= 250) drained = true;
12254
+ if (suppressed && drained && quietAt !== void 0 && now - quietAt >= silenceMs) {
12255
+ suppressed = false;
12256
+ speakingAt = void 0;
12257
+ changed(false);
12258
+ }
12259
+ } };
12260
+ }
12261
+ //#endregion
12219
12262
  //#region src/voice-call.js
12220
12263
  const ICE_WAIT_MS = 3e3;
12221
12264
  const waitForCandidates = (connection) => new Promise((resolve) => {
@@ -12302,9 +12345,11 @@ window.__ModuleLoader__.load({
12302
12345
  for (const track of stream.getTracks()) connection.addTrack(track, stream);
12303
12346
  connection.createDataChannel("oai-events");
12304
12347
  let ended = false;
12348
+ let monitor;
12305
12349
  const end = async () => {
12306
12350
  if (ended) return;
12307
12351
  ended = true;
12352
+ clearInterval(monitor);
12308
12353
  if (context) chime(context, [740, 520]);
12309
12354
  for (const track of stream.getTracks()) track.stop();
12310
12355
  sound.srcObject = null;
@@ -12354,6 +12399,22 @@ window.__ModuleLoader__.load({
12354
12399
  assistant: /* @__PURE__ */ new Uint8Array(512)
12355
12400
  };
12356
12401
  let muted = false;
12402
+ let outputMuted = false;
12403
+ let interrupted = false;
12404
+ const gate = createBargeInGate({
12405
+ changed: (value) => {
12406
+ interrupted = value;
12407
+ sound.muted = outputMuted || interrupted;
12408
+ },
12409
+ interrupt: () => {
12410
+ rpc.call(CHANNEL, "voice/interrupt", { sessionId }).catch(() => {});
12411
+ }
12412
+ });
12413
+ if (context) monitor = setInterval(() => gate.sample({
12414
+ mic: muted ? 0 : loudness(analysers.mic, buffers.mic),
12415
+ output: loudness(analysers.assistant, buffers.assistant),
12416
+ now: performance.now()
12417
+ }), 30);
12357
12418
  return {
12358
12419
  stop: end,
12359
12420
  isMuted: () => muted,
@@ -12361,9 +12422,10 @@ window.__ModuleLoader__.load({
12361
12422
  muted = value;
12362
12423
  for (const track of stream.getAudioTracks()) track.enabled = !value;
12363
12424
  },
12364
- isOutputMuted: () => sound.muted,
12425
+ isOutputMuted: () => outputMuted,
12365
12426
  setOutputMuted: (value) => {
12366
- sound.muted = value;
12427
+ outputMuted = value;
12428
+ sound.muted = outputMuted || interrupted;
12367
12429
  },
12368
12430
  /** How loud the person (mic) and the model (voice) are right now, 0..1 each. */
12369
12431
  levels: () => ({
@@ -13253,6 +13315,7 @@ void main(){
13253
13315
  /** Settings for the composer's voice button: on or off, the voice (with a short sample to listen to) and the answer language. */
13254
13316
  function VoiceCallCard({ rpc, preference, snapshot, t }) {
13255
13317
  const audio = (0, react.useRef)();
13318
+ const previewSequence = (0, react.useRef)(0);
13256
13319
  const alive = (0, react.useRef)(false);
13257
13320
  const [offered, setOffered] = (0, react.useState)();
13258
13321
  const [sample, setSample] = (0, react.useState)({
@@ -13277,15 +13340,19 @@ void main(){
13277
13340
  })();
13278
13341
  }, [on]);
13279
13342
  /** Play a short clip of a voice; picking a voice plays it too, so it can be heard before it is used. */
13280
- const playVoice = async (voice) => {
13343
+ const playVoice = async (voice, language = snapshot.voiceLanguage) => {
13344
+ const sequence = ++previewSequence.current;
13281
13345
  audio.current?.pause();
13282
13346
  setSample({
13283
13347
  state: "loading",
13284
13348
  note: ""
13285
13349
  });
13286
13350
  try {
13287
- const result = await rpc.call(CHANNEL, "voice/preview", { voice });
13288
- if (!alive.current) return;
13351
+ const result = await rpc.call(CHANNEL, "voice/preview", {
13352
+ voice,
13353
+ language
13354
+ });
13355
+ if (!alive.current || sequence !== previewSequence.current) return;
13289
13356
  if (!result.ok) {
13290
13357
  setSample({
13291
13358
  state: "missing",
@@ -13296,7 +13363,7 @@ void main(){
13296
13363
  const clip = new Audio(result.value.audio);
13297
13364
  audio.current = clip;
13298
13365
  clip.onended = () => {
13299
- if (alive.current) setSample((current) => ({
13366
+ if (alive.current && sequence === previewSequence.current) setSample((current) => ({
13300
13367
  ...current,
13301
13368
  state: "idle"
13302
13369
  }));
@@ -13307,7 +13374,7 @@ void main(){
13307
13374
  });
13308
13375
  await clip.play();
13309
13376
  } catch {
13310
- if (alive.current) setSample({
13377
+ if (alive.current && sequence === previewSequence.current) setSample({
13311
13378
  state: "missing",
13312
13379
  note: ""
13313
13380
  });
@@ -13398,7 +13465,12 @@ void main(){
13398
13465
  items: languages,
13399
13466
  onSelect: (value) => {
13400
13467
  preference.set({ [VOICE_LANGUAGE_FIELD]: value });
13468
+ playVoice(snapshot.voiceVoice, value);
13401
13469
  }
13470
+ }),
13471
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
13472
+ className: "codexSubscriptionHelp",
13473
+ children: t("voicePreviewHint")
13402
13474
  })
13403
13475
  ] }) : null]
13404
13476
  });