@shuind/dsh-codex-harness 0.3.2 → 0.3.3

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 (82) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/README.md +21 -41
  3. package/docs/preset-library.md +2 -2
  4. package/docs/tool-policy.md +1 -1
  5. package/lib/client.js +1826 -545
  6. package/lib/compact-command.js +7 -1
  7. package/lib/compaction.js +7 -1
  8. package/lib/hybrid-executor.js +23 -12
  9. package/lib/index.js +1229 -17
  10. package/lib/preferences.js +21 -2
  11. package/lib/tool-policy.js +11 -2
  12. package/lib/typert.js +42 -1
  13. package/lib/types/client/desktop.d.ts +20 -42
  14. package/lib/types/client/desktop.js +184 -127
  15. package/lib/types/client/index.d.ts +104 -39
  16. package/lib/types/client/index.js +97 -15
  17. package/lib/types/client/policy-drafts.d.ts +18 -0
  18. package/lib/types/client/policy-drafts.js +27 -0
  19. package/lib/types/client/policy-locale.d.ts +81 -32
  20. package/lib/types/client/policy-locale.js +197 -107
  21. package/lib/types/client/preset-manager.d.ts +25 -2
  22. package/lib/types/client/preset-manager.js +89 -5
  23. package/lib/types/client/preset-requests.d.ts +44 -1
  24. package/lib/types/client/preset-requests.js +150 -0
  25. package/lib/types/client/tool-policy.d.ts +6 -15
  26. package/lib/types/client/tool-policy.js +24 -39
  27. package/lib/types/contracts/preset-editor-schema.d.ts +35 -0
  28. package/lib/types/contracts/preset-editor-schema.js +39 -0
  29. package/lib/types/contracts/settings.d.ts +12 -0
  30. package/lib/types/contracts/settings.js +10 -1
  31. package/lib/types/contracts/ui-contracts.d.ts +48 -0
  32. package/lib/types/contracts/ui-contracts.js +58 -0
  33. package/lib/types/contracts/update.d.ts +73 -0
  34. package/lib/types/contracts/update.js +291 -0
  35. package/lib/types/entries/index.js +20 -2
  36. package/lib/types/entries/preferences.d.ts +2 -0
  37. package/lib/types/entries/preferences.js +9 -0
  38. package/lib/types/hybrid/hybrid-sdk.d.ts +1 -1
  39. package/lib/types/hybrid/hybrid-sdk.js +27 -13
  40. package/lib/types/presets/preset-editor.d.ts +13 -1
  41. package/lib/types/presets/preset-editor.js +24 -1
  42. package/lib/types/presets/pro-mode-store.d.ts +13 -0
  43. package/lib/types/presets/pro-mode-store.js +69 -0
  44. package/lib/types/responses/background-sse-codec.d.ts +23 -0
  45. package/lib/types/responses/background-sse-codec.js +230 -0
  46. package/lib/types/responses/background-stream.d.ts +28 -0
  47. package/lib/types/responses/background-stream.js +351 -0
  48. package/lib/types/responses/fetch-transport.js +24 -9
  49. package/lib/types/responses/wire-rewrite.d.ts +4 -0
  50. package/lib/types/responses/wire-rewrite.js +30 -4
  51. package/lib/types/tools/codex-subagent.d.ts +14 -0
  52. package/lib/types/tools/codex-subagent.js +269 -0
  53. package/lib/types/update/checker.d.ts +14 -0
  54. package/lib/types/update/checker.js +166 -0
  55. package/locale/en.json +1 -1
  56. package/locale/hybrid-executor/en.json +1 -1
  57. package/locale/hybrid-executor/zh.json +1 -1
  58. package/locale/zh.json +1 -1
  59. package/package.json +6 -2
  60. package/src/client/desktop.tsx +359 -160
  61. package/src/client/index.tsx +122 -22
  62. package/src/client/policy-drafts.ts +45 -0
  63. package/src/client/policy-locale.ts +198 -106
  64. package/src/client/preset-manager.tsx +125 -4
  65. package/src/client/preset-requests.ts +185 -1
  66. package/src/client/tool-policy.tsx +29 -63
  67. package/src/contracts/preset-editor-schema.ts +44 -0
  68. package/src/contracts/settings.ts +20 -1
  69. package/src/contracts/ui-contracts.ts +87 -0
  70. package/src/contracts/update.ts +307 -0
  71. package/src/entries/index.ts +25 -2
  72. package/src/entries/preferences.ts +9 -0
  73. package/src/hybrid/hybrid-sdk.ts +28 -12
  74. package/src/presets/preset-editor.ts +31 -3
  75. package/src/presets/pro-mode-store.ts +80 -0
  76. package/src/responses/background-sse-codec.ts +237 -0
  77. package/src/responses/background-stream.ts +371 -0
  78. package/src/responses/fetch-transport.ts +28 -9
  79. package/src/responses/wire-rewrite.ts +34 -3
  80. package/src/tools/codex-subagent.ts +290 -0
  81. package/src/update/checker.ts +193 -0
  82. package/tsdown.config.ts +4 -0
@@ -0,0 +1,269 @@
1
+ /** Opt-in global `codex_subagent` tool backed by Codex Connect (`openai-codex`) + DSH `spawn`. */
2
+ import { ReasoningEffortId } from '@deepseek-ai/dsh-llm';
3
+ import { defineTool } from '@deepseek-ai/dsh-tools';
4
+ import { CODEX_SETTINGS_NAMESPACE } from "../contracts/settings.js";
5
+ import { CODEX_SUBAGENT_DEFAULT_PRESET, CODEX_SUBAGENT_PRESET_INHERIT, CODEX_SUBAGENT_TOOL_NAME, OPENAI_CODEX_PROVIDER, } from "../contracts/ui-contracts.js";
6
+ export { CODEX_SUBAGENT_DEFAULT_PRESET, CODEX_SUBAGENT_PRESET_INHERIT, CODEX_SUBAGENT_TOOL_NAME, };
7
+ const SPAWN_PROVIDER = 'spawn';
8
+ function delegationDepthOf(agent) {
9
+ const runtime = agent.options?.subagentDepth ?? 0;
10
+ const persisted = agent.session?.header?.delegationDepth ?? 0;
11
+ return Math.max(persisted, runtime);
12
+ }
13
+ function hasOpenAICodexProvider(ctx) {
14
+ const llm = ctx.get('llm');
15
+ if (llm === undefined || typeof llm.listProviders !== 'function')
16
+ return false;
17
+ try {
18
+ return llm.listProviders().some(provider => provider.id === OPENAI_CODEX_PROVIDER);
19
+ }
20
+ catch {
21
+ return false;
22
+ }
23
+ }
24
+ /** Query live `openai-codex` models and advertised reasoning efforts from the Host LLM registry. */
25
+ export async function readCodexSubagentModels(ctx) {
26
+ const llm = ctx.get('llm');
27
+ if (llm === undefined || !hasOpenAICodexProvider(ctx) || typeof llm.listModels !== 'function') {
28
+ return { available: false, models: [] };
29
+ }
30
+ try {
31
+ const listed = await llm.listModels(OPENAI_CODEX_PROVIDER);
32
+ const models = await Promise.all(listed.map(async (model) => {
33
+ let efforts = [];
34
+ let defaultEffort;
35
+ if (typeof llm.resolveModelInfo === 'function') {
36
+ try {
37
+ const resolved = await llm.resolveModelInfo(OPENAI_CODEX_PROVIDER, model.id);
38
+ efforts = (resolved.reasoning?.efforts ?? []).map(effort => effort.id);
39
+ defaultEffort = resolved.reasoning?.defaultEffort;
40
+ }
41
+ catch { }
42
+ }
43
+ return {
44
+ id: model.id,
45
+ name: model.name || model.id,
46
+ efforts,
47
+ ...(defaultEffort !== undefined ? { defaultEffort } : {}),
48
+ };
49
+ }));
50
+ return { available: true, models };
51
+ }
52
+ catch {
53
+ return { available: true, models: [] };
54
+ }
55
+ }
56
+ async function resolveChildPreset(ctx, spawnProvider, configured) {
57
+ const trimmed = configured?.trim();
58
+ if (trimmed === CODEX_SUBAGENT_PRESET_INHERIT)
59
+ return undefined;
60
+ const target = trimmed && trimmed.length > 0 ? trimmed : CODEX_SUBAGENT_DEFAULT_PRESET;
61
+ if (!spawnProvider.capabilities.agentPreset || spawnProvider.inheritsParentContext)
62
+ return undefined;
63
+ const presets = ctx.get('agentPresets');
64
+ if (presets === undefined || typeof presets.resolve !== 'function')
65
+ return undefined;
66
+ try {
67
+ const resolved = await presets.resolve(target);
68
+ return resolved.broken === undefined ? resolved.id : undefined;
69
+ }
70
+ catch {
71
+ return undefined;
72
+ }
73
+ }
74
+ function buildCodexSubagentTool(ctx, currentSettings) {
75
+ return defineTool({
76
+ name: CODEX_SUBAGENT_TOOL_NAME,
77
+ description: 'Delegate a self-contained task to an isolated subagent powered by the configured Codex subscription model (openai-codex), running in its own context without consuming this conversation\'s context or main-model API quota. Starts the subagent immediately and returns its name; when it finishes, the runtime delivers its completion notice automatically. Use `send_message` to steer it while running or continue it afterward.',
78
+ parameters: {
79
+ cwd: {
80
+ type: 'string',
81
+ description: 'Initial child working directory. Relative paths use your current directory; omitted inherits it.',
82
+ },
83
+ description: {
84
+ type: 'string',
85
+ required: true,
86
+ description: 'A short (3-5 word) description of the delegated task, for display. Use the language of the user\'s current request.',
87
+ },
88
+ name: {
89
+ type: 'string',
90
+ description: 'Optional short name for the subagent, unique among the subagents you create: lower-case letters, digits, and hyphens, starting with a letter, at most 32 characters; lead is reserved for the root agent.',
91
+ },
92
+ prompt: {
93
+ type: 'string',
94
+ required: true,
95
+ description: 'The complete, self-contained task for the subagent. It does not share this conversation\'s context, so include everything it needs.',
96
+ },
97
+ },
98
+ output: {
99
+ schema: {
100
+ type: 'object',
101
+ additionalProperties: false,
102
+ properties: {
103
+ kind: { type: 'string', required: true, const: 'activation' },
104
+ name: { type: 'string', required: true },
105
+ },
106
+ },
107
+ render: (_args, value) => [{
108
+ type: 'text',
109
+ text: `started subagent ${value.name}`,
110
+ }],
111
+ presentationMeta: (_args, value) => ({
112
+ kind: value.kind,
113
+ name: value.name,
114
+ }),
115
+ },
116
+ isConcurrencySafe: () => true,
117
+ async execute(args, exec) {
118
+ const parent = exec.agent;
119
+ if (parent === undefined) {
120
+ throw new Error('codex_subagent requires a calling agent (exec.agent was undefined)');
121
+ }
122
+ const subagents = ctx.get('subagents');
123
+ const spawnProvider = subagents?.getProvider(SPAWN_PROVIDER);
124
+ if (subagents === undefined || spawnProvider === undefined) {
125
+ throw new Error('codex_subagent requires the native `spawn` subagent provider');
126
+ }
127
+ const llm = ctx.get('llm');
128
+ if (llm === undefined || !hasOpenAICodexProvider(ctx)) {
129
+ throw new Error('codex_subagent requires Codex Connect (openai-codex) to be enabled');
130
+ }
131
+ const settings = currentSettings();
132
+ let model = settings.codexSubagentModel?.trim() || '';
133
+ if (model.length === 0) {
134
+ const available = await llm.listModels(OPENAI_CODEX_PROVIDER);
135
+ exec.signal.throwIfAborted();
136
+ model = available[0]?.id ?? '';
137
+ if (model.length === 0) {
138
+ throw new Error('codex_subagent has no enabled openai-codex models available');
139
+ }
140
+ }
141
+ const effortText = settings.codexSubagentEffort?.trim() || '';
142
+ const reasoningEffort = effortText.length > 0 ? ReasoningEffortId(effortText) : undefined;
143
+ await llm.resolveCallConfig({
144
+ provider: OPENAI_CODEX_PROVIDER,
145
+ model,
146
+ ...(reasoningEffort === undefined ? {} : { reasoningEffort }),
147
+ }, exec.signal);
148
+ exec.signal.throwIfAborted();
149
+ if (subagents.getProvider(SPAWN_PROVIDER) !== spawnProvider) {
150
+ throw new Error('subagent provider "spawn" changed while resolving codex_subagent; retry the delegation');
151
+ }
152
+ const agentPreset = await resolveChildPreset(ctx, spawnProvider, settings.codexSubagentPreset);
153
+ exec.signal.throwIfAborted();
154
+ const maxDepth = subagents.resolveMaxDepth(undefined);
155
+ const activation = await subagents.startActivation({
156
+ provider: SPAWN_PROVIDER,
157
+ label: args.description,
158
+ ...(args.name === undefined ? {} : { name: args.name }),
159
+ ...(args.cwd === undefined ? {} : { cwd: args.cwd }),
160
+ prompt: [{ type: 'text', text: args.prompt }],
161
+ parent,
162
+ ...(agentPreset === undefined ? {} : { agentPreset }),
163
+ agentOptions: {
164
+ provider: OPENAI_CODEX_PROVIDER,
165
+ model,
166
+ ...(reasoningEffort === undefined ? {} : { reasoningEffort }),
167
+ },
168
+ ...(maxDepth === undefined ? {} : { maxDepth }),
169
+ signal: exec.signal,
170
+ delivery: 'parent',
171
+ });
172
+ return { kind: 'activation', name: activation.name };
173
+ },
174
+ });
175
+ }
176
+ /**
177
+ * Mount a reactive global registration controller for `codex_subagent`.
178
+ * Registers immediately when enabled + `spawn` + `openai-codex` are ready, and unregisters on disable.
179
+ */
180
+ export function installCodexSubagent(ctx, currentSettings) {
181
+ if (typeof ctx.inject !== 'function')
182
+ return;
183
+ ctx.inject(['subagents', 'tools'], subagentCtx => {
184
+ let mounted;
185
+ let stopped = false;
186
+ const unmount = () => {
187
+ if (mounted === undefined)
188
+ return;
189
+ const current = mounted;
190
+ mounted = undefined;
191
+ try {
192
+ current.dispose();
193
+ }
194
+ catch { }
195
+ };
196
+ const reconcile = () => {
197
+ if (stopped)
198
+ return;
199
+ const settings = currentSettings();
200
+ const ready = settings.codexSubagentEnabled === true
201
+ && subagentCtx.subagents.getProvider(SPAWN_PROVIDER) !== undefined
202
+ && hasOpenAICodexProvider(subagentCtx);
203
+ if (!ready) {
204
+ unmount();
205
+ return;
206
+ }
207
+ if (mounted !== undefined)
208
+ return;
209
+ try {
210
+ const definition = buildCodexSubagentTool(subagentCtx, currentSettings);
211
+ const dispose = subagentCtx.tools.register(definition);
212
+ mounted = { definition, dispose };
213
+ }
214
+ catch (error) {
215
+ subagentCtx.logger.warn(`codex: could not register global ${CODEX_SUBAGENT_TOOL_NAME} tool`);
216
+ subagentCtx.logger.warn(error);
217
+ }
218
+ };
219
+ subagentCtx.on('subagent/provider-added', provider => {
220
+ if (provider.name === SPAWN_PROVIDER)
221
+ reconcile();
222
+ });
223
+ subagentCtx.on('subagent/provider-removed', providerName => {
224
+ if (providerName === SPAWN_PROVIDER)
225
+ reconcile();
226
+ });
227
+ subagentCtx.on?.('llm/adapters-updated', () => {
228
+ reconcile();
229
+ });
230
+ subagentCtx.on('settings/document-updated', ns => {
231
+ if (ns === CODEX_SETTINGS_NAMESPACE)
232
+ reconcile();
233
+ });
234
+ subagentCtx.inject(['codexPreferences'], prefCtx => {
235
+ const preferences = prefCtx.get('codexPreferences');
236
+ if (typeof preferences?.subscribe !== 'function')
237
+ return;
238
+ const unsubscribe = preferences.subscribe(() => reconcile());
239
+ prefCtx.effect(() => unsubscribe, 'codex: codex_subagent preferences listener');
240
+ reconcile();
241
+ });
242
+ const systemPrompt = subagentCtx.get('systemPrompt');
243
+ if (systemPrompt !== undefined) {
244
+ systemPrompt.context({
245
+ name: `tool:${CODEX_SUBAGENT_TOOL_NAME}:depth`,
246
+ order: systemPrompt.getContextOrder('SUBAGENT_DELEGATION'),
247
+ text: context => {
248
+ if (context.agent === undefined || mounted === undefined)
249
+ return '';
250
+ if (subagentCtx.tools.get(CODEX_SUBAGENT_TOOL_NAME, context.scope) !== mounted.definition)
251
+ return '';
252
+ const maxDepth = subagentCtx.subagents.resolveMaxDepth(undefined);
253
+ if (maxDepth === undefined)
254
+ return '';
255
+ const depth = delegationDepthOf(context.agent);
256
+ if (depth < maxDepth)
257
+ return '';
258
+ return `Delegation depth for \`${CODEX_SUBAGENT_TOOL_NAME}\`: current ${depth}, maximum ${maxDepth}, remaining levels 0. Do not call \`${CODEX_SUBAGENT_TOOL_NAME}\` at this depth; carry out the work directly.`;
259
+ },
260
+ });
261
+ }
262
+ subagentCtx.effect(() => () => {
263
+ stopped = true;
264
+ unmount();
265
+ }, 'codex: global codex_subagent lifecycle');
266
+ reconcile();
267
+ });
268
+ }
269
+ //# sourceMappingURL=codex-subagent.js.map
@@ -0,0 +1,14 @@
1
+ /** Host-side update checker: npm dist-tags first, GitHub Releases fallback. */
2
+ import type { HarnessUpdateResult } from '../contracts/update.ts';
3
+ export declare const CODEX_HARNESS_UPDATE_TIMEOUT_MS = 8000;
4
+ export declare const CODEX_HARNESS_UPDATE_MAX_BYTES: number;
5
+ type FetchImpl = (input: string, init?: RequestInit) => Promise<Response>;
6
+ export interface HarnessUpdateCheckOptions {
7
+ currentVersion?: string;
8
+ fetchImpl?: FetchImpl;
9
+ timeoutMs?: number;
10
+ }
11
+ export declare function readCurrentHarnessVersion(startDir?: string): Promise<string | undefined>;
12
+ export declare function checkForHarnessUpdate(options?: HarnessUpdateCheckOptions): Promise<HarnessUpdateResult>;
13
+ export {};
14
+ //# sourceMappingURL=checker.d.ts.map
@@ -0,0 +1,166 @@
1
+ /** Host-side update checker: npm dist-tags first, GitHub Releases fallback. */
2
+ import { readFile } from 'node:fs/promises';
3
+ import { dirname, join } from 'node:path';
4
+ import { fileURLToPath } from 'node:url';
5
+ import { CODEX_HARNESS_GITHUB_LATEST_RELEASE_URL, CODEX_HARNESS_NPM_METADATA_URL, CODEX_HARNESS_PACKAGE_NAME, compareHarnessVersions, harnessReleaseUrl, normalizeHarnessVersion, parseHarnessVersion, } from "../contracts/update.js";
6
+ export const CODEX_HARNESS_UPDATE_TIMEOUT_MS = 8_000;
7
+ export const CODEX_HARNESS_UPDATE_MAX_BYTES = 64 * 1024;
8
+ const MODULE_DIR = dirname(fileURLToPath(import.meta.url));
9
+ const MAX_ROOT_WALK_DEPTH = 6;
10
+ let cachedPackageVersion;
11
+ export async function readCurrentHarnessVersion(startDir = MODULE_DIR) {
12
+ if (startDir === MODULE_DIR && cachedPackageVersion !== undefined)
13
+ return cachedPackageVersion;
14
+ let current = startDir;
15
+ for (let depth = 0; depth <= MAX_ROOT_WALK_DEPTH; depth += 1) {
16
+ try {
17
+ const raw = await readFile(join(current, 'package.json'), 'utf8');
18
+ const parsed = JSON.parse(raw);
19
+ if (typeof parsed === 'object' && parsed !== null && !Array.isArray(parsed)) {
20
+ const record = parsed;
21
+ if (record['name'] === CODEX_HARNESS_PACKAGE_NAME && typeof record['version'] === 'string' && parseHarnessVersion(record['version']) !== undefined) {
22
+ const normalized = normalizeHarnessVersion(record['version']);
23
+ if (startDir === MODULE_DIR)
24
+ cachedPackageVersion = normalized;
25
+ return normalized;
26
+ }
27
+ }
28
+ }
29
+ catch {
30
+ // Keep walking upward.
31
+ }
32
+ const parent = dirname(current);
33
+ if (parent === current)
34
+ break;
35
+ current = parent;
36
+ }
37
+ return undefined;
38
+ }
39
+ async function readBoundedText(response, maxBytes) {
40
+ if (response.body === null) {
41
+ const text = await response.text();
42
+ if (new TextEncoder().encode(text).byteLength > maxBytes)
43
+ throw new RangeError('update response too large');
44
+ return text;
45
+ }
46
+ const reader = response.body.getReader();
47
+ const decoder = new TextDecoder();
48
+ const chunks = [];
49
+ let total = 0;
50
+ try {
51
+ while (true) {
52
+ const next = await reader.read();
53
+ if (next.done)
54
+ break;
55
+ total += next.value.byteLength;
56
+ if (total > maxBytes) {
57
+ await reader.cancel();
58
+ throw new RangeError('update response too large');
59
+ }
60
+ chunks.push(decoder.decode(next.value, { stream: true }));
61
+ }
62
+ chunks.push(decoder.decode());
63
+ return chunks.join('');
64
+ }
65
+ finally {
66
+ reader.releaseLock();
67
+ }
68
+ }
69
+ async function fetchBounded(fetchImpl, url, timeoutMs, headers) {
70
+ const controller = new AbortController();
71
+ const timer = setTimeout(() => { controller.abort(new Error('update request timed out')); }, timeoutMs);
72
+ try {
73
+ const response = await fetchImpl(url, { headers, signal: controller.signal });
74
+ const text = await readBoundedText(response, CODEX_HARNESS_UPDATE_MAX_BYTES);
75
+ return { response, text };
76
+ }
77
+ finally {
78
+ clearTimeout(timer);
79
+ }
80
+ }
81
+ function registryCandidates(value) {
82
+ if (typeof value !== 'object' || value === null || Array.isArray(value))
83
+ return [];
84
+ const record = value;
85
+ const tags = record['dist-tags'] ?? record;
86
+ if (typeof tags !== 'object' || tags === null || Array.isArray(tags))
87
+ return [];
88
+ return ['latest', 'alpha']
89
+ .map(tag => tags[tag])
90
+ .filter((candidate) => typeof candidate === 'string' && parseHarnessVersion(candidate) !== undefined)
91
+ .map(normalizeHarnessVersion);
92
+ }
93
+ async function lookupNpmLatest(fetchImpl, timeoutMs) {
94
+ try {
95
+ const { response, text } = await fetchBounded(fetchImpl, CODEX_HARNESS_NPM_METADATA_URL, timeoutMs, { accept: 'application/json' });
96
+ if (!response.ok)
97
+ return { ok: false, reason: 'registry-unavailable' };
98
+ const candidates = registryCandidates(JSON.parse(text));
99
+ if (candidates.length === 0)
100
+ return { ok: false, reason: 'invalid-registry-response' };
101
+ const latestVersion = candidates.reduce((best, item) => compareHarnessVersions(item, best) > 0 ? item : best);
102
+ return { ok: true, latestVersion };
103
+ }
104
+ catch (error) {
105
+ return {
106
+ ok: false,
107
+ reason: error instanceof SyntaxError || error instanceof RangeError ? 'invalid-registry-response' : 'registry-unavailable',
108
+ };
109
+ }
110
+ }
111
+ async function lookupGitHubLatest(fetchImpl, timeoutMs) {
112
+ try {
113
+ const { response, text } = await fetchBounded(fetchImpl, CODEX_HARNESS_GITHUB_LATEST_RELEASE_URL, timeoutMs, { accept: 'application/vnd.github+json' });
114
+ if (!response.ok)
115
+ return { ok: false, reason: 'registry-unavailable' };
116
+ const value = JSON.parse(text);
117
+ if (typeof value !== 'object' || value === null || Array.isArray(value)) {
118
+ return { ok: false, reason: 'invalid-registry-response' };
119
+ }
120
+ const tag = value['tag_name'];
121
+ if (typeof tag !== 'string' || parseHarnessVersion(tag) === undefined) {
122
+ return { ok: false, reason: 'invalid-registry-response' };
123
+ }
124
+ return { ok: true, latestVersion: normalizeHarnessVersion(tag) };
125
+ }
126
+ catch (error) {
127
+ return {
128
+ ok: false,
129
+ reason: error instanceof SyntaxError || error instanceof RangeError ? 'invalid-registry-response' : 'registry-unavailable',
130
+ };
131
+ }
132
+ }
133
+ export async function checkForHarnessUpdate(options = {}) {
134
+ const rawCurrent = options.currentVersion ?? await readCurrentHarnessVersion();
135
+ if (rawCurrent === undefined || parseHarnessVersion(rawCurrent) === undefined) {
136
+ return { status: 'unavailable', currentVersion: rawCurrent ?? '0.0.0', reason: 'invalid-current-version' };
137
+ }
138
+ const currentVersion = normalizeHarnessVersion(rawCurrent);
139
+ const fetchImpl = options.fetchImpl ?? fetch;
140
+ const timeoutMs = options.timeoutMs ?? CODEX_HARNESS_UPDATE_TIMEOUT_MS;
141
+ const npmResult = await lookupNpmLatest(fetchImpl, timeoutMs);
142
+ let latestVersion;
143
+ if (npmResult.ok) {
144
+ latestVersion = npmResult.latestVersion;
145
+ }
146
+ else {
147
+ const githubResult = await lookupGitHubLatest(fetchImpl, timeoutMs);
148
+ if (!githubResult.ok) {
149
+ const reason = githubResult.reason === 'invalid-registry-response' || npmResult.reason === 'invalid-registry-response'
150
+ ? 'invalid-registry-response'
151
+ : 'registry-unavailable';
152
+ return { status: 'unavailable', currentVersion, reason };
153
+ }
154
+ latestVersion = githubResult.latestVersion;
155
+ }
156
+ if (compareHarnessVersions(latestVersion, currentVersion) <= 0) {
157
+ return { status: 'up-to-date', currentVersion, latestVersion: currentVersion };
158
+ }
159
+ return {
160
+ status: 'update-available',
161
+ currentVersion,
162
+ latestVersion,
163
+ releaseUrl: harnessReleaseUrl(latestVersion),
164
+ };
165
+ }
166
+ //# sourceMappingURL=checker.js.map
package/locale/en.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "meta": {
3
3
  "title": "Codex harness",
4
- "description": "Customizable Codex coding preset, terminal and patch tools, and Responses enhancements for DeepSeek Harness."
4
+ "description": "Save tokens via deferred tools and hybrid batching, customize tools and prompts per preset (Codex hybrid preset included), and use quick context/Fast/compact controls; pair with Codex Connect to share subscription search, image generation, and subagents across all models; supports API Pro mode with official OpenAI keys."
5
5
  }
6
6
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "meta": {
3
3
  "title": "Codex Hybrid Executor",
4
- "description": "Asymmetric tool executor keeping direct Codex tools natively on the wire while routing read/search tools through run_code SDK batching and progressive deferLoading activation."
4
+ "description": "Hybrid tool executor: interactive tools stay direct, read/search tools batch through run_code, with on-demand deferred activation."
5
5
  }
6
6
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "meta": {
3
3
  "title": "Codex 混合模式执行器",
4
- "description": "非对称混合工具执行器:高频交互工具直连调用,检索与读取工具经 run_code SDK 批量编排,并支持按需延迟加载。"
4
+ "description": "混合工具执行器:交互工具直连调用,读写检索经 run_code 批量执行,并支持按需延迟加载。"
5
5
  }
6
6
  }
package/locale/zh.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "meta": {
3
3
  "title": "Codex 编码模式",
4
- "description": "为 DeepSeek Harness 提供可自定义提示词的 Codex 预设、终端与补丁工具和 Responses 请求增强。"
4
+ "description": "省 token(工具延迟加载 + 混合批量读写),含 Codex 混合预设,任意预设可改工具和提示词;支持快捷调上下文 / Fast / 压缩;搭配 Codex Connect 可把订阅搜索、生图和子代理分享给所有模型用;支持官 key 开 Pro mode。"
5
5
  }
6
6
  }
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@shuind/dsh-codex-harness",
3
- "version": "0.3.2",
3
+ "version": "0.3.3",
4
4
  "packageManager": "pnpm@9.15.9",
5
- "description": "Customizable Codex coding preset, tools and Responses enhancements for DeepSeek Harness.",
5
+ "description": "Save tokens via deferred tools and hybrid batching, customize tools and prompts per preset (Codex hybrid preset included), and use quick context/Fast/compact controls; pair with Codex Connect to share subscription search, image generation, and subagents across all models; supports API Pro mode with official OpenAI keys.",
6
6
  "type": "module",
7
7
  "main": "lib/index.js",
8
8
  "types": "lib/types/entries/index.d.ts",
@@ -158,6 +158,7 @@
158
158
  "@deepseek-ai/dsh-settings": ">=0.2.2-rc.1 <0.2.3",
159
159
  "@deepseek-ai/dsh-shell": ">=0.2.2-rc.1 <0.2.3",
160
160
  "@deepseek-ai/dsh-shell-env": ">=0.2.2-rc.1 <0.2.3",
161
+ "@deepseek-ai/dsh-subagent": ">=0.2.2-rc.1 <0.2.3",
161
162
  "@deepseek-ai/dsh-system-prompt": ">=0.2.2-rc.1 <0.2.3",
162
163
  "@deepseek-ai/dsh-terminal": ">=0.2.2-rc.1 <0.2.3",
163
164
  "@deepseek-ai/dsh-token-meter": ">=0.2.2-rc.1 <0.2.3",
@@ -253,6 +254,9 @@
253
254
  "@deepseek-ai/dsh-shell-env": {
254
255
  "optional": true
255
256
  },
257
+ "@deepseek-ai/dsh-subagent": {
258
+ "optional": true
259
+ },
256
260
  "@deepseek-ai/dsh-system-prompt": {
257
261
  "optional": true
258
262
  },