@dsh-enhanced/coding-subscription-provider 0.1.3 → 0.1.5

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/providers.js CHANGED
@@ -1,32 +1,135 @@
1
+ /**
2
+ * Codex 0.147 feature keys that can expose a provider-owned executor, lifecycle
3
+ * hook, skill/plugin instruction, or capability-discovery path. Keep this list
4
+ * mirrored by scripts/capture-cli-fixtures.mjs and covered by the exact argv
5
+ * tests below. The protocol decoder remains the final fail-closed boundary.
6
+ */
7
+ export const CODEX_DISABLED_NATIVE_FEATURES = [
8
+ 'shell_tool',
9
+ 'shell_zsh_fork',
10
+ 'unified_exec_zsh_fork',
11
+ 'shell_snapshot',
12
+ 'deferred_executor',
13
+ 'js_repl',
14
+ 'js_repl_tools_only',
15
+ 'view_image',
16
+ 'hooks',
17
+ 'code_mode',
18
+ 'code_mode_buffered_exec',
19
+ 'code_mode_host',
20
+ 'code_mode_only',
21
+ 'web_search_request',
22
+ 'web_search_cached',
23
+ 'search_tool',
24
+ 'memories',
25
+ 'external_agent_memory_import',
26
+ 'apply_patch_freeform',
27
+ 'apply_patch_streaming_events',
28
+ 'exec_permission_approvals',
29
+ 'request_rule',
30
+ 'multi_agent',
31
+ 'multi_agent_v2',
32
+ 'multi_agent_mode',
33
+ 'collaboration_modes',
34
+ 'apps',
35
+ 'enable_mcp_apps',
36
+ 'mcp_2026_07_28',
37
+ 'apps_mcp_path_override',
38
+ 'tool_search',
39
+ 'deferred_tool_world_state',
40
+ 'non_prefixed_mcp_tool_names',
41
+ 'unavailable_dummy_tools',
42
+ 'tool_suggest',
43
+ 'recommended_plugins',
44
+ 'plugins',
45
+ 'executor_capability_discovery',
46
+ 'plugin_hooks',
47
+ 'in_app_browser',
48
+ 'browser_use',
49
+ 'browser_use_full_cdp_access',
50
+ 'browser_use_external',
51
+ 'computer_use',
52
+ 'remote_plugin',
53
+ 'plugin_sharing',
54
+ 'image_generation',
55
+ 'skill_mcp_dependency_install',
56
+ 'skill_search',
57
+ 'skill_env_var_dependency_prompt',
58
+ 'standalone_web_search',
59
+ 'default_mode_request_user_input',
60
+ 'request_permissions_tool',
61
+ 'token_budget',
62
+ 'current_time_reminder',
63
+ 'terminal_visualization_instructions',
64
+ 'guardian_approval',
65
+ 'guardianv2',
66
+ 'goals',
67
+ 'tool_call_mcp_elicitation',
68
+ 'auth_elicitation',
69
+ 'artifact',
70
+ 'workspace_dependencies',
71
+ ];
72
+ const codexDisabledNativeFeatureArgs = CODEX_DISABLED_NATIVE_FEATURES
73
+ .flatMap(feature => ['--disable', feature]);
74
+ /** Codex config paths that suppress repository-, skill-, and host-owned prompt/tool injection. */
75
+ export const CODEX_NATIVE_BOUNDARY_CONFIG_OVERRIDES = [
76
+ 'project_doc_max_bytes=0',
77
+ 'skills.include_instructions=false',
78
+ 'skills.bundled.enabled=false',
79
+ 'orchestrator.skills.enabled=false',
80
+ 'orchestrator.mcp.enabled=false',
81
+ 'include_apps_instructions=false',
82
+ 'include_permissions_instructions=false',
83
+ 'include_environment_context=false',
84
+ 'include_collaboration_mode_instructions=false',
85
+ 'tools.update_plan.enabled=false',
86
+ 'tools.experimental_request_user_input.enabled=false',
87
+ 'web_search="disabled"',
88
+ 'agents.enabled=false',
89
+ ];
90
+ const codexNativeBoundaryConfigArgs = CODEX_NATIVE_BOUNDARY_CONFIG_OVERRIDES
91
+ .flatMap(value => ['--config', value]);
1
92
  export const providerPresets = {
2
93
  codex: {
3
94
  id: 'codex',
4
95
  command: 'codex',
5
- // Codex owns its own authenticated subscription session. The sandbox blocks writes.
6
- args: ['exec', '--json', '--ephemeral', '--ignore-user-config', '--sandbox', 'read-only'],
96
+ // Codex owns its own authenticated subscription session. Ignore local config/rules,
97
+ // remove known model-visible native capabilities, and keep residual built-ins read-only.
98
+ // The stdout decoder still rejects any native tool lifecycle event that escapes
99
+ // these best-effort launch boundaries.
100
+ args: [
101
+ 'exec', '--json', '--ephemeral', '--ignore-user-config', '--ignore-rules',
102
+ // The cwd has already been reconstructed from the live Host session and
103
+ // compared by canonical realpath. The standard assistant workspace is
104
+ // intentionally not required to be a Git repository.
105
+ '--skip-git-repo-check',
106
+ ...codexDisabledNativeFeatureArgs,
107
+ ...codexNativeBoundaryConfigArgs,
108
+ '--sandbox', 'read-only',
109
+ ],
7
110
  output: 'ndjson',
8
111
  },
9
112
  claude: {
10
113
  id: 'claude',
11
114
  command: 'claude',
12
- // No tools means DSH receives a text-only delegation by default.
115
+ // Disable Claude-native tools; DSH calls return through the outer JSON bridge.
13
116
  args: ['-p', '--output-format', 'stream-json', '--verbose', '--include-partial-messages', '--no-session-persistence', '--safe-mode', '--permission-mode', 'dontAsk', '--tools', ''],
14
117
  output: 'ndjson',
15
118
  },
16
119
  cursor: {
17
120
  id: 'cursor',
18
121
  command: 'cursor-agent',
19
- // Intentionally no --force or equivalent approval-bypass flag.
20
- args: ['--print', '--output-format', 'stream-json'],
122
+ // Ask mode is the strongest current headless boundary. Intentionally never
123
+ // pass --force or another approval bypass; read-only search may still occur.
124
+ args: ['--print', '--output-format', 'stream-json', '--mode=ask'],
21
125
  output: 'ndjson',
22
126
  },
23
127
  grok: {
24
128
  id: 'grok',
25
129
  command: 'grok',
26
- // `-p` consumes the following argv item, so buildInvocation inserts the task
27
- // immediately after it before appending these fixed headless flags. Grok treats
28
- // an empty --tools value as no filter, so allow then deny its always-on MCP
29
- // meta-tools to produce an actually empty tool set for this text-only route.
130
+ // Grok treats an empty --tools value as no filter, so allow then deny its
131
+ // always-on MCP meta-tools to produce an actually empty native tool set. DSH
132
+ // calls use the outer JSON bridge instead of Grok's internal executor.
30
133
  args: [
31
134
  '--output-format', 'streaming-json', '--permission-mode', 'dontAsk',
32
135
  '--no-auto-update', '--no-memory', '--no-subagents', '--disable-web-search', '--verbatim',
@@ -35,11 +138,15 @@ export const providerPresets = {
35
138
  output: 'ndjson',
36
139
  },
37
140
  };
38
- export function buildInvocation(provider, options) {
141
+ export function buildInvocation(provider, options, _platform = process.platform) {
39
142
  const preset = providerPresets[provider];
40
- const args = provider === 'grok'
41
- ? ['-p', options.prompt, ...preset.args]
42
- : [...preset.args];
143
+ // Grok 1.0.5 reopens its --prompt-file path instead of consuming the inherited
144
+ // stdin stream. `/dev/stdin` can therefore fail with ENXIO under child_process,
145
+ // so use the same private-file transport on every supported platform.
146
+ const promptTransport = provider === 'grok'
147
+ ? 'secure-temporary-file'
148
+ : 'stdin';
149
+ const args = [...preset.args];
43
150
  if (options.model && options.model !== 'default')
44
151
  args.push('--model', options.model);
45
152
  if (provider === 'codex' && options.reasoningEffort) {
@@ -54,8 +161,19 @@ export function buildInvocation(provider, options) {
54
161
  if (options.maxTurns !== undefined && (provider === 'claude' || provider === 'grok')) {
55
162
  args.push('--max-turns', String(options.maxTurns));
56
163
  }
57
- if (provider !== 'grok')
58
- args.push(options.prompt);
59
- return { provider, command: options.command ?? preset.command, args, cwd: options.cwd, shell: false };
164
+ // Use the documented positional sentinel even though some Codex releases
165
+ // also infer stdin when PROMPT is omitted. Keeping it last prevents a future
166
+ // parser change from treating a following option as prompt content.
167
+ if (provider === 'codex')
168
+ args.push('-');
169
+ return {
170
+ provider,
171
+ command: options.command ?? preset.command,
172
+ args,
173
+ prompt: options.prompt,
174
+ promptTransport,
175
+ cwd: options.cwd,
176
+ shell: false,
177
+ };
60
178
  }
61
179
  //# sourceMappingURL=providers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"providers.js","sourceRoot":"","sources":["../src/providers.ts"],"names":[],"mappings":"AA+BA,MAAM,CAAC,MAAM,eAAe,GAAiD;IAC3E,KAAK,EAAE;QACL,EAAE,EAAE,OAAO;QACX,OAAO,EAAE,OAAO;QAChB,oFAAoF;QACpF,IAAI,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,aAAa,EAAE,sBAAsB,EAAE,WAAW,EAAE,WAAW,CAAC;QACzF,MAAM,EAAE,QAAQ;KACjB;IACD,MAAM,EAAE;QACN,EAAE,EAAE,QAAQ;QACZ,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A8E;IAC9E,oEAAoE;IACpE,IAAI,QAAQ,KAAK,OAAO;QAAE,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IAExC,OAAO;QACL,QAAQ;QACR,OAAO,EAAE,OAAO,CAAC,OAAO,IAAI,MAAM,CAAC,OAAO;QAC1C,IAAI;QACJ,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,eAAe;QACf,GAAG,EAAE,OAAO,CAAC,GAAG;QAChB,KAAK,EAAE,KAAK;KACb,CAAA;AACH,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import { type GenerateOptions } from '@deepseek-ai/dsh-llm';
2
+ import type { AgentLoopRequestAttestor } from '@dsh-enhanced/llm-route-capabilities';
2
3
  export interface LiveSessionCwd {
3
4
  readonly id: NonNullable<GenerateOptions['sessionId']>;
4
5
  readonly header: {
@@ -13,12 +14,13 @@ export declare class TrustedSessionCwdError extends Error {
13
14
  }
14
15
  /**
15
16
  * Resolves the only cwd a local coding process may receive for this request.
16
- * The marker is process-local and the session lookup is live, so copied request
17
- * fields or a persisted/stale session id cannot select an arbitrary directory.
17
+ * A same-module marker or the Host-owned exact live-agent proof is mandatory;
18
+ * copied request fields or a persisted/stale session id cannot select a path.
18
19
  */
19
20
  export declare function resolveTrustedSessionCwd(input: {
20
21
  request: GenerateOptions;
21
22
  configuredCwd: string;
22
23
  sessions: LiveSessionLookup | undefined;
24
+ attestor?: AgentLoopRequestAttestor;
23
25
  }): string;
24
26
  //# sourceMappingURL=session-cwd.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"session-cwd.d.ts","sourceRoot":"","sources":["../src/session-cwd.ts"],"names":[],"mappings":"AAEA,OAAO,EAAsB,KAAK,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAE/E,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,EAAE,EAAE,WAAW,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC,CAAA;IACtD,QAAQ,CAAC,MAAM,EAAE;QAAE,QAAQ,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16,20 +16,38 @@ function canonicalDirectory(path) {
16
16
  throw new TrustedSessionCwdError();
17
17
  }
18
18
  }
19
+ function ownEnumerableDataField(value, key) {
20
+ const descriptor = Object.getOwnPropertyDescriptor(value, key);
21
+ if (descriptor === undefined)
22
+ return undefined;
23
+ if (!descriptor.enumerable || !Object.hasOwn(descriptor, 'value'))
24
+ throw new TrustedSessionCwdError();
25
+ return descriptor;
26
+ }
19
27
  /**
20
28
  * Resolves the only cwd a local coding process may receive for this request.
21
- * The marker is process-local and the session lookup is live, so copied request
22
- * fields or a persisted/stale session id cannot select an arbitrary directory.
29
+ * A same-module marker or the Host-owned exact live-agent proof is mandatory;
30
+ * copied request fields or a persisted/stale session id cannot select a path.
23
31
  */
24
32
  export function resolveTrustedSessionCwd(input) {
25
- const sessionId = input.request.sessionId;
26
- if (sessionId === undefined || !Object.isFrozen(input.request) || !isAgentLoopRequest(input.request)) {
33
+ const sessionId = ownEnumerableDataField(input.request, 'sessionId')?.value;
34
+ if (typeof sessionId !== 'string' || sessionId.length === 0 || sessionId.length > 512) {
27
35
  throw new TrustedSessionCwdError();
28
36
  }
29
37
  const session = input.sessions?.get(sessionId);
30
38
  if (session === undefined || session.id !== sessionId || typeof session.header.cwd !== 'string') {
31
39
  throw new TrustedSessionCwdError();
32
40
  }
41
+ const purpose = ownEnumerableDataField(input.request, 'purpose');
42
+ const hasPurpose = purpose !== undefined;
43
+ const loopOwned = hasPurpose
44
+ ? purpose.value === 'compaction'
45
+ && input.attestor?.claimCompaction?.(input.request, session) === true
46
+ && Object.isFrozen(input.request)
47
+ : Object.isFrozen(input.request)
48
+ && (isAgentLoopRequest(input.request) || input.attestor?.claim(input.request, session) === true);
49
+ if (!loopOwned)
50
+ throw new TrustedSessionCwdError();
33
51
  const configuredCwd = canonicalDirectory(input.configuredCwd);
34
52
  const sessionCwd = canonicalDirectory(session.header.cwd);
35
53
  if (configuredCwd !== sessionCwd)
@@ -1 +1 @@
1
- {"version":3,"file":"session-cwd.js","sourceR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C,MAAM,CAAC,GAAG,CAAC,CAAA;IACzD,IAAI,aAAa,KAAK,UAAU;QAAE,MAAM,IAAI,sBAAsB,EAAE,CAAA;IACpE,OAAO,UAAU,CAAA;AACnB,CAAC"}
package/lib/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const version = "0.1.3";
1
+ export declare const version = "0.1.5";
2
2
  //# sourceMappingURL=version.d.ts.map
package/lib/version.js CHANGED
@@ -1,2 +1,2 @@
1
- export const version = '0.1.3';
1
+ export const version = '0.1.5';
2
2
  //# sourceMappingURL=version.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dsh-enhanced/coding-subscription-provider",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "description": "Use locally authenticated coding subscriptions as DeepSeek Harness model providers.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -48,21 +48,35 @@
48
48
  },
49
49
  "dependencies": {
50
50
  "@deepseek-ai/schemastery": "3.18.1",
51
- "@dsh-enhanced/llm-route-capabilities": "0.1.3"
51
+ "@dsh-enhanced/llm-route-capabilities": "0.1.5"
52
52
  },
53
53
  "peerDependencies": {
54
54
  "@deepseek-ai/cordis": "^4.0.1",
55
+ "@deepseek-ai/dsh-agent": ">=0.1.0-rc.8 <0.2.0",
55
56
  "@deepseek-ai/dsh-attachment": ">=0.1.0-rc.8 <0.2.0",
56
57
  "@deepseek-ai/dsh-llm": ">=0.1.0-rc.8 <0.2.0",
57
58
  "@deepseek-ai/dsh-session": ">=0.1.0-rc.8 <0.2.0"
58
59
  },
59
60
  "peerDependenciesMeta": {
61
+ "@deepseek-ai/cordis": {
62
+ "optional": true
63
+ },
64
+ "@deepseek-ai/dsh-agent": {
65
+ "optional": true
66
+ },
60
67
  "@deepseek-ai/dsh-attachment": {
61
68
  "optional": true
69
+ },
70
+ "@deepseek-ai/dsh-llm": {
71
+ "optional": true
72
+ },
73
+ "@deepseek-ai/dsh-session": {
74
+ "optional": true
62
75
  }
63
76
  },
64
77
  "devDependencies": {
65
78
  "@deepseek-ai/cordis": "4.0.1",
79
+ "@deepseek-ai/dsh-agent": "0.1.0-rc.8",
66
80
  "@deepseek-ai/dsh-attachment": "0.1.0-rc.8",
67
81
  "@deepseek-ai/dsh-llm": "0.1.0-rc.8",
68
82
  "@deepseek-ai/dsh-session": "0.1.0-rc.8",