dsh-codex-subscription 3.2.5 → 3.2.6

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/lib/index.js CHANGED
@@ -3602,10 +3602,14 @@ function authenticatedSubagentChild(child, { Transport, getTokens, thread, signa
3602
3602
  if (method === "thread/start") {
3603
3603
  if (!initialized) throw new Error("Codex initialization incomplete");
3604
3604
  await login();
3605
- return server.request(method, {
3605
+ const result = await server.request(method, {
3606
3606
  ...params,
3607
3607
  ...thread
3608
3608
  }, signal);
3609
+ if (result.model !== thread.model) throw new Error("Codex did not apply the selected subtask model");
3610
+ const effort = thread.config?.model_reasoning_effort;
3611
+ if (effort !== void 0 && result.reasoningEffort !== effort) throw new Error("Codex did not apply the selected subtask reasoning effort");
3612
+ return result;
3609
3613
  }
3610
3614
  return server.request(method, params, signal);
3611
3615
  });
@@ -3623,10 +3627,102 @@ function authenticatedSubagentChild(child, { Transport, getTokens, thread, signa
3623
3627
  } });
3624
3628
  }
3625
3629
  //#endregion
3630
+ //#region src/subagent-cli.js
3631
+ const SUBAGENT_CLI_ALIAS = "dsh-codex-subtask-cli";
3632
+ const SUBAGENT_CODEX_VERSION = "0.166.0";
3633
+ const SUBAGENT_CLI_SPEC = `${SUBAGENT_CLI_ALIAS}@npm:@openai/codex@${SUBAGENT_CODEX_VERSION}`;
3634
+ const spec = `npm:@openai/codex@${SUBAGENT_CODEX_VERSION}`;
3635
+ /** A profile-owned alias, never the host CLI, PATH, or another app's installation. */
3636
+ function createSubagentCli({ profile, loadOperations = async (value) => {
3637
+ return import(pathToFileURL(createRequire(value.installAnchor).resolve("@deepseek-ai/dsh-plugin-manager/operations")).href);
3638
+ } }) {
3639
+ function inspect() {
3640
+ const value = profile();
3641
+ if (!value?.dir || !value.installAnchor) return {
3642
+ available: false,
3643
+ installed: false,
3644
+ owned: false
3645
+ };
3646
+ try {
3647
+ const manifestPath = resolve(value.dir, "package.json");
3648
+ const manifest = JSON.parse(readFileSync(manifestPath, "utf8"));
3649
+ const dependency = manifest.dependencies?.[SUBAGENT_CLI_ALIAS];
3650
+ const owned = typeof dependency === "string" && /^npm:@openai\/codex@\d+\.\d+\.\d+$/u.test(dependency);
3651
+ if (dependency !== void 0 && !owned || [
3652
+ "devDependencies",
3653
+ "optionalDependencies",
3654
+ "peerDependencies"
3655
+ ].some((field) => Object.hasOwn(manifest[field] ?? {}, "dsh-codex-subtask-cli"))) return {
3656
+ available: false,
3657
+ installed: false,
3658
+ owned: false
3659
+ };
3660
+ if (!owned) return {
3661
+ available: true,
3662
+ installed: false,
3663
+ owned: false
3664
+ };
3665
+ try {
3666
+ const path = createRequire(manifestPath).resolve(`${SUBAGENT_CLI_ALIAS}/package.json`);
3667
+ const cli = JSON.parse(readFileSync(path, "utf8"));
3668
+ const installed = dependency === spec && cli.name === "@openai/codex" && cli.version === "0.166.0" && cli.bin?.codex === "bin/codex.js";
3669
+ return {
3670
+ available: true,
3671
+ owned,
3672
+ installed,
3673
+ ...installed ? { wrapper: resolve(dirname(path), cli.bin.codex) } : {}
3674
+ };
3675
+ } catch {
3676
+ return {
3677
+ available: true,
3678
+ owned,
3679
+ installed: false
3680
+ };
3681
+ }
3682
+ } catch {
3683
+ return {
3684
+ available: true,
3685
+ owned: false,
3686
+ installed: false
3687
+ };
3688
+ }
3689
+ }
3690
+ return {
3691
+ inspect,
3692
+ async change(action, signal) {
3693
+ if (!["install", "remove"].includes(action)) throw Error("invalid-action");
3694
+ const state = inspect();
3695
+ if (!state.available) throw Error("unavailable");
3696
+ if (action === "remove" && !state.owned) return;
3697
+ const value = profile(), { runPluginCommand } = await loadOperations(value);
3698
+ if (typeof runPluginCommand !== "function") throw Error("unavailable");
3699
+ signal.throwIfAborted();
3700
+ const result = await runPluginCommand({
3701
+ ...value,
3702
+ profile: value.name
3703
+ }, action === "install" ? [
3704
+ "add",
3705
+ "--save-exact",
3706
+ "--ignore-scripts",
3707
+ SUBAGENT_CLI_SPEC
3708
+ ] : ["remove", SUBAGENT_CLI_ALIAS], {
3709
+ ...value.packageManager,
3710
+ execution: "service",
3711
+ signal,
3712
+ outputBytes: 16384,
3713
+ activateNewBundles: false,
3714
+ lockWaitMs: 1e4,
3715
+ idleTimeoutMs: 12e4
3716
+ });
3717
+ signal.throwIfAborted();
3718
+ if (result.exitCode !== 0 || result.timedOut) throw Error("operation-error");
3719
+ if (action === "install" && !inspect().installed) throw Error("operation-error");
3720
+ }
3721
+ };
3722
+ }
3723
+ //#endregion
3626
3724
  //#region src/subagent-runtime.js
3627
3725
  const SUBAGENT_RUNTIME_PACKAGE = "@deepseek-ai/dsh-subagent-codex";
3628
- const SUBAGENT_RUNTIME_VERSION = "0.2.2-rc.1";
3629
- const SUBAGENT_CODEX_VERSION = "0.153.4";
3630
3726
  const SUPPORTED_RUNTIME_VERSIONS = Object.freeze([
3631
3727
  "0.1.7-rc.2",
3632
3728
  "0.2.0-rc.1",
@@ -3643,7 +3739,7 @@ const SUPPORTED_RUNTIME_VERSIONS = Object.freeze([
3643
3739
  "0.2.1-rc.5",
3644
3740
  "0.2.2-alpha.2",
3645
3741
  "0.2.2-alpha.3",
3646
- SUBAGENT_RUNTIME_VERSION
3742
+ "0.2.2-rc.1"
3647
3743
  ]);
3648
3744
  const require = createRequire(import.meta.url);
3649
3745
  const execute = promisify(execFile);
@@ -3661,7 +3757,7 @@ function matchingSubagentRuntimeVersion(resolve = require.resolve) {
3661
3757
  const version = hostDshVersion(resolve, resolve === require.resolve ? process.argv[1] : "");
3662
3758
  return SUPPORTED_RUNTIME_VERSIONS.includes(version) ? version : void 0;
3663
3759
  }
3664
- function inspectSubagentRuntime(resolve = require.resolve) {
3760
+ function inspectSubagentRuntime(resolve = require.resolve, cli) {
3665
3761
  try {
3666
3762
  const manifestPath = resolve(`${SUBAGENT_RUNTIME_PACKAGE}/package.json`);
3667
3763
  const manifest = JSON.parse(readFileSync(manifestPath, "utf8"));
@@ -3669,33 +3765,46 @@ function inspectSubagentRuntime(resolve = require.resolve) {
3669
3765
  installed: false,
3670
3766
  present: true
3671
3767
  };
3672
- return { installed: true };
3768
+ return {
3769
+ installed: cli?.inspect().installed === true,
3770
+ present: true,
3771
+ adapterInstalled: true
3772
+ };
3673
3773
  } catch {
3674
3774
  return { installed: false };
3675
3775
  }
3676
3776
  }
3677
- async function loadSubagentRuntime({ resolve: resolve$1 = require.resolve, run = execute, importModule = (url) => import(url) } = {}) {
3678
- if (!inspectSubagentRuntime(resolve$1).installed) throw new Error("Codex subtask runtime is not prepared");
3679
- const entry = resolve$1(SUBAGENT_RUNTIME_PACKAGE);
3777
+ async function loadSubagentRuntime({ resolve = require.resolve, cli, run = execute, importModule = (url) => import(url), platform = process.platform } = {}) {
3778
+ if (!inspectSubagentRuntime(resolve, cli).installed) throw new Error("Codex subtask runtime is not prepared");
3779
+ const entry = resolve(SUBAGENT_RUNTIME_PACKAGE);
3680
3780
  const providerRequire = createRequire(entry);
3681
- const codexManifestPath = providerRequire.resolve("@openai/codex/package.json");
3682
- const codex = JSON.parse(readFileSync(codexManifestPath, "utf8"));
3683
- if (codex.version !== "0.153.4" || typeof codex.bin?.codex !== "string") throw new Error("Codex subtask runtime version is unsupported");
3684
- const wrapper = resolve(dirname(codexManifestPath), codex.bin.codex);
3781
+ const { wrapper } = cli.inspect();
3685
3782
  try {
3686
3783
  const { stdout } = await run(process.execPath, [wrapper, "--version"], {
3687
3784
  timeout: 1e4,
3688
3785
  maxBuffer: 4096,
3689
3786
  windowsHide: true
3690
3787
  });
3691
- if (stdout.trim() !== `codex-cli 0.153.4`) throw new Error("Unexpected CLI version");
3788
+ if (stdout.trim() !== `codex-cli 0.166.0`) throw new Error("Unexpected CLI version");
3692
3789
  } catch {
3693
3790
  throw new Error("Codex subtask runtime is incomplete; prepare it for this platform");
3694
3791
  }
3695
3792
  const [official, { JsonRpcLineTransport: Transport }] = await Promise.all([importModule(pathToFileURL(entry).href), importModule(pathToFileURL(providerRequire.resolve("@deepseek-ai/dsh-sdk-protocol")).href)]);
3696
3793
  return {
3697
3794
  official,
3698
- Transport
3795
+ Transport,
3796
+ argv: [
3797
+ process.execPath,
3798
+ wrapper,
3799
+ "app-server",
3800
+ "--listen",
3801
+ "stdio://",
3802
+ "-c",
3803
+ "features.apps=false",
3804
+ "-c",
3805
+ "features.plugins=false",
3806
+ ...platform === "win32" ? ["-c", "features.prefer_mxc=true"] : []
3807
+ ]
3699
3808
  };
3700
3809
  }
3701
3810
  //#endregion
@@ -3706,7 +3815,7 @@ const MODES = /* @__PURE__ */ new Set([
3706
3815
  "workspace-write",
3707
3816
  "danger-full-access"
3708
3817
  ]);
3709
- function subagentThreadPolicy(parent, policy, requested = {}) {
3818
+ function subagentThreadPolicy(parent, policy, requested = {}, platform = process.platform) {
3710
3819
  if (!MODES.has(policy?.mode)) throw new Error("DSH subagent sandbox policy is unavailable");
3711
3820
  const selected = parent.session.requestHeader?.()?.config ?? parent.options ?? {};
3712
3821
  for (const key of Object.keys(requested)) if (![
@@ -3734,7 +3843,10 @@ function subagentThreadPolicy(parent, policy, requested = {}) {
3734
3843
  approvalPolicy: "never",
3735
3844
  sandbox: policy.mode,
3736
3845
  config: {
3737
- ...CHILD_FEATURES_OFF,
3846
+ features: {
3847
+ ...CHILD_FEATURES_OFF.features,
3848
+ ...platform === "win32" ? { prefer_mxc: true } : {}
3849
+ },
3738
3850
  ...effort === void 0 ? {} : { model_reasoning_effort: effort }
3739
3851
  }
3740
3852
  };
@@ -3758,11 +3870,7 @@ const CHILD_FEATURES_OFF = Object.freeze({ features: Object.freeze(Object.fromEn
3758
3870
  ].map((name) => [name, false]))) });
3759
3871
  /** Reuse the official DSH process/turn provider; keep only subscription auth here. */
3760
3872
  function createSubscriptionSubagent({ ctx, nativeHome, resolveAuth, store, refresh, loadRuntime, maintenance = () => false, defaults }) {
3761
- let runtime;
3762
- const load = () => runtime ??= loadRuntime().catch((error) => {
3763
- runtime = void 0;
3764
- throw error;
3765
- });
3873
+ const load = () => loadRuntime();
3766
3874
  const active = /* @__PURE__ */ new Set();
3767
3875
  let disposed = false;
3768
3876
  return {
@@ -3794,7 +3902,7 @@ function createSubscriptionSubagent({ ctx, nativeHome, resolveAuth, store, refre
3794
3902
  refresh,
3795
3903
  signal
3796
3904
  });
3797
- const { official, Transport } = await load();
3905
+ const { official, Transport, argv } = await load();
3798
3906
  const proxy = await resolveCodexOAuthProxy({ target: new URL("https://chatgpt.com/") });
3799
3907
  signal.throwIfAborted();
3800
3908
  await mkdir(nativeHome, { recursive: true });
@@ -3813,6 +3921,7 @@ function createSubscriptionSubagent({ ctx, nativeHome, resolveAuth, store, refre
3813
3921
  } },
3814
3922
  subprocess: { spawn: (spec) => authenticatedSubagentChild(ctx.subprocess.spawn({
3815
3923
  ...spec,
3924
+ argv,
3816
3925
  env: {
3817
3926
  ...spec.env,
3818
3927
  ...env
@@ -3917,7 +4026,7 @@ function createSubagentBackendSwitcher({ entries, prepare, persist }) {
3917
4026
  if (!originals.has(fiber)) originals.set(fiber, { ...config });
3918
4027
  return selected === "codex" ? convert(config) : config;
3919
4028
  };
3920
- const select = (mode) => {
4029
+ const select = (mode, { validate = true } = {}) => {
3921
4030
  if (!["dsh", "codex"].includes(mode)) return Promise.reject(/* @__PURE__ */ new Error("Invalid subagent backend"));
3922
4031
  const next = tail.catch(() => {}).then(async () => {
3923
4032
  if (disposed) throw new Error("Subagent backend is unavailable");
@@ -3925,7 +4034,7 @@ function createSubagentBackendSwitcher({ entries, prepare, persist }) {
3925
4034
  for (const entry of all) if (entry.fiber && standard(entry, entry.fiber.config) && !originals.has(entry.fiber)) originals.set(entry.fiber, { ...entry.fiber.config });
3926
4035
  if (mode === "codex") {
3927
4036
  if (!originals.size && !all.some((entry) => standard(entry, entry.options?.config))) throw new Error("No standard DSH independent subagent tool is available");
3928
- await prepare();
4037
+ if (validate) await prepare();
3929
4038
  }
3930
4039
  const changed = [];
3931
4040
  const previous = selected;
@@ -3968,7 +4077,7 @@ function createSubagentBackendSwitcher({ entries, prepare, persist }) {
3968
4077
  }
3969
4078
  //#endregion
3970
4079
  //#region src/runtime-management.js
3971
- function createRuntimeManagement({ manager, inspect, active, selectDsh, componentVersion = matchingSubagentRuntimeVersion }) {
4080
+ function createRuntimeManagement({ manager, inspect, active, selectDsh, cli, componentVersion = matchingSubagentRuntimeVersion }) {
3972
4081
  let operation;
3973
4082
  let state = {
3974
4083
  phase: "idle",
@@ -3990,15 +4099,20 @@ function createRuntimeManagement({ manager, inspect, active, selectDsh, componen
3990
4099
  available = false;
3991
4100
  }
3992
4101
  const runtime = inspect();
4102
+ const cliState = cli?.inspect();
3993
4103
  const version = componentVersion();
3994
4104
  return {
3995
4105
  ...state,
3996
4106
  available,
3997
- installable: available && version !== void 0,
4107
+ installable: available && version !== void 0 && (!cli || cliState?.available === true),
3998
4108
  componentVersion: version,
4109
+ ...cli ? {
4110
+ codexVersion: SUBAGENT_CODEX_VERSION,
4111
+ cliUpdateRequired: runtime.adapterInstalled === true && !runtime.installed
4112
+ } : {},
3999
4113
  installed: runtime.installed,
4000
- present: runtime.installed || runtime.present === true || bundle?.installed === true,
4001
- removable: available && bundle?.installed === true && !bundle.readOnlyReason,
4114
+ present: runtime.installed || runtime.present === true || bundle?.installed === true || cliState?.owned === true,
4115
+ removable: available && (bundle?.installed === true && !bundle.readOnlyReason || cliState?.owned === true),
4002
4116
  active: active()
4003
4117
  };
4004
4118
  };
@@ -4010,12 +4124,14 @@ function createRuntimeManagement({ manager, inspect, active, selectDsh, componen
4010
4124
  const host = manager();
4011
4125
  if (!supported(host)) throw Error("unavailable");
4012
4126
  const version = componentVersion();
4013
- if (action === "install" && version === void 0) throw Error("unavailable");
4127
+ if (action === "install" && (version === void 0 || cli && !cli.inspect().available)) throw Error("unavailable");
4014
4128
  const requestId = randomUUID();
4015
4129
  const current = {
4016
4130
  action,
4017
4131
  requestId,
4018
- host
4132
+ host,
4133
+ controller: new AbortController(),
4134
+ changed: false
4019
4135
  };
4020
4136
  operation = current;
4021
4137
  state = {
@@ -4024,33 +4140,50 @@ function createRuntimeManagement({ manager, inspect, active, selectDsh, componen
4024
4140
  };
4025
4141
  current.done = (async () => {
4026
4142
  try {
4143
+ let bundle;
4027
4144
  if (action === "remove") {
4028
- const bundle = (await host.listBundles()).find((value) => value.name === SUBAGENT_RUNTIME_PACKAGE);
4029
- if (!bundle?.installed || bundle.readOnlyReason) throw Error("not-removable");
4145
+ bundle = (await host.listBundles()).find((value) => value.name === SUBAGENT_RUNTIME_PACKAGE);
4146
+ if ((!bundle?.installed || bundle.readOnlyReason) && !cli?.inspect().owned) throw Error("not-removable");
4030
4147
  await selectDsh();
4031
4148
  }
4032
- const result = action === "install" ? await host.installBundle(`${SUBAGENT_RUNTIME_PACKAGE}@${version}`, {
4033
- enabled: false,
4034
- requestId
4035
- }) : await host.removeBundle(SUBAGENT_RUNTIME_PACKAGE);
4036
- if (result.application === "cancelled") state = {
4037
- phase: "cancelled",
4038
- restartRequired: false
4039
- };
4040
- else if (["applied", "restart-required"].includes(result.application)) state = {
4149
+ if (action === "install" && !inspect().adapterInstalled || action === "remove" && bundle?.installed && !bundle.readOnlyReason) {
4150
+ const result = action === "install" ? await host.installBundle(`${SUBAGENT_RUNTIME_PACKAGE}@${version}`, {
4151
+ enabled: false,
4152
+ requestId
4153
+ }) : await host.removeBundle(SUBAGENT_RUNTIME_PACKAGE);
4154
+ if (result.application === "cancelled") {
4155
+ state = {
4156
+ phase: "cancelled",
4157
+ restartRequired: false
4158
+ };
4159
+ return;
4160
+ }
4161
+ if (!["applied", "restart-required"].includes(result.application)) throw Error(result.packageResult?.kind ?? result.error?.code ?? "operation-error");
4162
+ current.changed = true;
4163
+ }
4164
+ current.controller.signal.throwIfAborted();
4165
+ if (cli) {
4166
+ current.cli = true;
4167
+ state.phase = action === "install" ? "installing" : "removing";
4168
+ await cli.change(action, current.controller.signal);
4169
+ current.changed = true;
4170
+ }
4171
+ state = {
4041
4172
  phase: "done",
4042
4173
  restartRequired: true
4043
4174
  };
4044
- else state = {
4045
- phase: "failed",
4046
- restartRequired: false,
4047
- error: result.packageResult?.kind ?? result.error?.code ?? "operation-error"
4048
- };
4049
4175
  } catch (error) {
4050
- state = {
4176
+ state = current.controller.signal.aborted ? {
4177
+ phase: "cancelled",
4178
+ restartRequired: current.changed
4179
+ } : {
4051
4180
  phase: "failed",
4052
- restartRequired: false,
4053
- error: error.message === "not-removable" ? "not-removable" : "operation-error"
4181
+ restartRequired: current.changed,
4182
+ error: [
4183
+ "not-removable",
4184
+ "build-blocked",
4185
+ "network"
4186
+ ].includes(error.message) ? error.message : "operation-error"
4054
4187
  };
4055
4188
  } finally {
4056
4189
  operation = void 0;
@@ -4068,6 +4201,11 @@ function createRuntimeManagement({ manager, inspect, active, selectDsh, componen
4068
4201
  async cancel() {
4069
4202
  const current = operation;
4070
4203
  if (current?.action !== "install") return status();
4204
+ if (current.cli) {
4205
+ current.controller.abort();
4206
+ await current.done;
4207
+ return status();
4208
+ }
4071
4209
  if ((await current.host.cancelInstall(current.requestId)).status === "cancelled") await current.done;
4072
4210
  return status();
4073
4211
  }
@@ -4472,7 +4610,7 @@ function inheritedOriginalImageRef(session, assetId) {
4472
4610
  }
4473
4611
  //#endregion
4474
4612
  //#region src/version.js
4475
- const PACKAGE_VERSION = "3.2.5";
4613
+ const PACKAGE_VERSION = "3.2.6";
4476
4614
  const USER_AGENT = `dsh-codex-subscription/${PACKAGE_VERSION}`;
4477
4615
  //#endregion
4478
4616
  //#region src/codex-images.js
@@ -11897,7 +12035,8 @@ const LEVELS = [
11897
12035
  "xhigh",
11898
12036
  "max"
11899
12037
  ];
11900
- const DEFAULT_REFRESH_TIMEOUT_MS = 1e4;
12038
+ const DEFAULT_REFRESH_TIMEOUT_MS = 6e4;
12039
+ const DEFAULT_LOCAL_TIMEOUT_MS = 1e4;
11901
12040
  const record$6 = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
11902
12041
  const nonEmpty$1 = (value) => typeof value === "string" && value.trim().length > 0 ? value.trim() : void 0;
11903
12042
  const positiveInteger = (value) => Number.isSafeInteger(value) && value > 0 ? value : void 0;
@@ -12100,7 +12239,7 @@ function createOfficialModelCatalog(options = {}) {
12100
12239
  const getNow = options.now ?? Date.now;
12101
12240
  const schedule = options.setTimeout ?? setTimeout;
12102
12241
  const cancelTimer = options.clearTimeout ?? clearTimeout;
12103
- const timeoutMs = Number.isFinite(options.timeoutMs) && options.timeoutMs > 0 ? options.timeoutMs : DEFAULT_REFRESH_TIMEOUT_MS;
12242
+ const timeoutMs = Number.isFinite(options.timeoutMs) && options.timeoutMs > 0 ? options.timeoutMs : void 0;
12104
12243
  const loadCache = options.loadCache ?? loadModelCatalogCache;
12105
12244
  const saveCache = options.saveCache ?? saveModelCatalogCache;
12106
12245
  const retryDelays = (options.retryDelaysMs ?? []).filter((delay) => Number.isFinite(delay) && delay > 0);
@@ -12143,7 +12282,7 @@ function createOfficialModelCatalog(options = {}) {
12143
12282
  generation,
12144
12283
  controller
12145
12284
  };
12146
- const timer = schedule(() => controller.abort(/* @__PURE__ */ new Error(`Codex model catalog ${label} timed out`)), timeoutMs);
12285
+ const timer = schedule(() => controller.abort(Object.assign(/* @__PURE__ */ new Error(`Codex model catalog ${label} timed out`), { name: "TimeoutError" })), timeoutMs ?? (label === "refresh" ? DEFAULT_REFRESH_TIMEOUT_MS : DEFAULT_LOCAL_TIMEOUT_MS));
12147
12286
  timer.unref?.();
12148
12287
  const task = Promise.resolve().then(() => {
12149
12288
  controller.signal.throwIfAborted();
@@ -12281,7 +12420,7 @@ function createOfficialModelCatalog(options = {}) {
12281
12420
  const raw = response.status === 304 ? rawCatalog : await response.json();
12282
12421
  if (!current(flight) || accountId !== id) return false;
12283
12422
  if (raw === void 0) throw new Error("Codex returned HTTP 304 without a cached model catalog");
12284
- const remote = parseOfficialModelCatalog(nativeVersion !== void 0 && Array.isArray(raw?.models) ? {
12423
+ const remote = parseOfficialModelCatalog((options.subagent === true || nativeVersion !== void 0) && Array.isArray(raw?.models) ? {
12285
12424
  ...raw,
12286
12425
  models: raw.models.filter((model) => model?.visibility === "list" && model.supported_in_api !== false)
12287
12426
  } : raw, getNow());
@@ -15767,6 +15906,7 @@ function createSubscriptionRpcHandler({ authHandler, usageReader, accountUsageRe
15767
15906
  };
15768
15907
  } catch (error) {
15769
15908
  if (signal.aborted) throw error;
15909
+ if (error?.name === "TimeoutError") return publicError("internal", "Codex model catalog refresh timed out");
15770
15910
  return publicError("internal", "Could not refresh Codex model catalog");
15771
15911
  }
15772
15912
  if (endpoint === "preferences/status" || endpoint === "preferences/update") try {
@@ -15939,7 +16079,7 @@ function createSubscriptionRpcHandler({ authHandler, usageReader, accountUsageRe
15939
16079
  onCleanupFailure?.();
15940
16080
  } catch {}
15941
16081
  if (endpoint !== "logout") Promise.resolve().then(() => modelCatalog?.refresh({ signal: void 0 })).catch(() => {});
15942
- } else if (result.ok === true && (endpoint === "status" || result.value?.authenticated === true)) modelCatalog?.refresh({ signal: void 0 }).catch(() => {});
16082
+ } else if (result.ok === true && result.value?.authenticated === true && modelCatalog?.status?.().source === "unavailable" && modelCatalog.status().refresh === "idle") modelCatalog?.refresh({ signal: void 0 }).catch(() => {});
15943
16083
  return result;
15944
16084
  };
15945
16085
  }
@@ -17100,9 +17240,11 @@ function apply(ctx, config = {}) {
17100
17240
  const baseProvider = createOpenAICodexProvider();
17101
17241
  let resolveAuth = async () => void 0;
17102
17242
  let subagentBackend;
17243
+ const subagentCli = createSubagentCli({ profile: () => ctx.get?.("profileContext") });
17103
17244
  const runtimeManagement = createRuntimeManagement({
17104
17245
  manager: () => ctx.get?.("pluginManager"),
17105
- inspect: inspectSubagentRuntime,
17246
+ inspect: () => inspectSubagentRuntime(void 0, subagentCli),
17247
+ cli: subagentCli,
17106
17248
  active: () => subagentBackend?.activeCount() ?? 0,
17107
17249
  selectDsh: async () => {
17108
17250
  if (subagentBackend) await subagentBackend.select("dsh");
@@ -17129,7 +17271,7 @@ function apply(ctx, config = {}) {
17129
17271
  });
17130
17272
  const appendUltraPolicy = loadHostSessionSdk()?.appendPluginRecord;
17131
17273
  const subagentCatalog = createOfficialModelCatalog({
17132
- nativeVersion: SUBAGENT_CODEX_VERSION,
17274
+ subagent: true,
17133
17275
  getAuth: (options) => resolveAuth(options),
17134
17276
  readCredential: (options) => store.read(PROVIDER, options),
17135
17277
  baseModels: () => baseProvider.getModels(),
@@ -17219,7 +17361,7 @@ function apply(ctx, config = {}) {
17219
17361
  subagentDefaultEffort: normalizeSubagentEffort(settings.get().subagentDefaultEffort),
17220
17362
  subagentModels: subagentDefaults.list(),
17221
17363
  subagentBackendAvailable: subagentBackend !== void 0,
17222
- subagentRuntimeInstalled: inspectSubagentRuntime().installed,
17364
+ subagentRuntimeInstalled: inspectSubagentRuntime(void 0, subagentCli).installed,
17223
17365
  ...readCapabilitySettings(settings.get()),
17224
17366
  [QUICK_QUOTA_MODE_FIELD]: normalizeQuickQuotaMode(settings.get()[QUICK_QUOTA_MODE_FIELD], settings.get()[LEGACY_QUICK_QUOTA_FIELD]),
17225
17367
  [SEARCH_PROVIDER_FIELD]: settings.get()[SEARCH_PROVIDER_FIELD],
@@ -17318,7 +17460,7 @@ function apply(ctx, config = {}) {
17318
17460
  resolveAuth,
17319
17461
  store,
17320
17462
  refresh: (credential) => network.run("oauth", () => baseProvider.auth.oauth.refresh(credential)),
17321
- loadRuntime: loadSubagentRuntime,
17463
+ loadRuntime: () => loadSubagentRuntime({ cli: subagentCli }),
17322
17464
  maintenance: runtimeManagement.blocked,
17323
17465
  defaults: subagentDefaults
17324
17466
  });
@@ -17330,10 +17472,10 @@ function apply(ctx, config = {}) {
17330
17472
  });
17331
17473
  const unconfigure = scoped.on("internal/config", subagentConfigListener(switcher), { global: true });
17332
17474
  let requested = "dsh";
17333
- const select = async (mode) => {
17475
+ const select = async (mode, options) => {
17334
17476
  requested = mode;
17335
17477
  try {
17336
- await switcher.select(mode);
17478
+ await switcher.select(mode, options);
17337
17479
  } catch (error) {
17338
17480
  requested = settings.get().subagentBackend ?? "dsh";
17339
17481
  throw error;
@@ -17345,7 +17487,7 @@ function apply(ctx, config = {}) {
17345
17487
  };
17346
17488
  const sync = (value) => {
17347
17489
  const mode = value.subagentBackend ?? "dsh";
17348
- if (mode !== requested) select(mode).catch(() => scoped.logger.warn("Could not switch the subscription subagent backend"));
17490
+ if (mode !== requested) select(mode, { validate: false }).catch(() => scoped.logger.warn("Could not switch the subscription subagent backend"));
17349
17491
  };
17350
17492
  scoped.loader.await().then(() => sync(settings.get())).catch(() => scoped.logger.warn("Could not initialize the subscription subagent backend"));
17351
17493
  const unwatch = settings.watch(sync);
package/locale/de.json ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "meta": {
3
+ "title": "Codex-Abonnement",
4
+ "description": "Nutze dein ChatGPT-/Codex-Abonnement für Modelle, Nutzungsübersicht, Websuche und Bilder in DSH. Kein API-Schlüssel nötig. Mit Sprachanrufen und Fernsteuerung per Smartphone (Beta).",
5
+ "detail": "docs/plugin/DETAIL.de.md"
6
+ }
7
+ }
package/locale/es.json ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "meta": {
3
+ "title": "Suscripción de Codex",
4
+ "description": "Usa tu suscripción de ChatGPT / Codex para modelos, uso, búsqueda web e imágenes en DSH. No requiere clave API. Incluye llamadas de voz y control remoto desde el móvil (Beta).",
5
+ "detail": "docs/plugin/DETAIL.es.md"
6
+ }
7
+ }
package/locale/fr.json ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "meta": {
3
+ "title": "Abonnement Codex",
4
+ "description": "Utilisez votre abonnement ChatGPT / Codex pour les modèles, le suivi d’utilisation, la recherche web et les images dans DSH. Aucune clé API requise. Appels vocaux et contrôle à distance depuis un téléphone inclus (Beta).",
5
+ "detail": "docs/plugin/DETAIL.fr.md"
6
+ }
7
+ }
package/locale/ja.json ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "meta": {
3
+ "title": "Codex サブスクリプション",
4
+ "description": "ChatGPT / Codex のサブスクリプションで DSH のモデル、使用量、Web 検索、画像生成を利用できます。API キーは不要です。音声通話とスマートフォンからの遠隔操作(Beta)にも対応。",
5
+ "detail": "docs/plugin/DETAIL.ja.md"
6
+ }
7
+ }
package/locale/pt.json ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "meta": {
3
+ "title": "Assinatura Codex",
4
+ "description": "Use sua assinatura do ChatGPT / Codex para modelos, acompanhamento de uso, busca na web e imagens no DSH. Não precisa de chave de API. Inclui chamadas de voz e controle remoto pelo celular (Beta).",
5
+ "detail": "docs/plugin/DETAIL.pt.md"
6
+ }
7
+ }
package/locale/ru.json ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "meta": {
3
+ "title": "Подписка Codex",
4
+ "description": "Используйте подписку ChatGPT / Codex для моделей, просмотра расхода лимитов, веб-поиска и изображений в DSH. Ключ API не нужен. Доступны голосовые звонки и управление со смартфона (Beta).",
5
+ "detail": "docs/plugin/DETAIL.ru.md"
6
+ }
7
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-codex-subscription",
3
- "version": "3.2.5",
3
+ "version": "3.2.6",
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",
@@ -17,8 +17,7 @@
17
17
  "locale/*.json",
18
18
  "docs/plugin/*.md",
19
19
  "cordis.patch.yml",
20
- "README.md",
21
- "README.en.md",
20
+ "README*.md",
22
21
  "DIRECTORY.md",
23
22
  "compatibility.json",
24
23
  "LICENSE",