@shuind/dsh-codex-harness 0.2.21 → 0.2.32-dsh-v0.2.2-rc.1

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 (128) hide show
  1. package/CHANGELOG.md +121 -0
  2. package/README.md +48 -38
  3. package/RELEASE.md +61 -0
  4. package/assets/codex.svg +5 -0
  5. package/cordis.patch.yml +150 -6
  6. package/docs/preset-library.md +39 -23
  7. package/docs/tool-policy-benchmark.json +310 -0
  8. package/docs/tool-policy.md +144 -0
  9. package/lib/client.js +1639 -111
  10. package/lib/compaction.js +17 -2
  11. package/lib/index.js +799 -188
  12. package/lib/installer.js +50 -6
  13. package/lib/preferences.js +111 -0
  14. package/lib/tool-policy.js +2235 -0
  15. package/lib/typert.js +57 -10
  16. package/lib/types/activity.d.ts +1 -1
  17. package/lib/types/activity.js +50 -14
  18. package/lib/types/client/activity.d.ts +33 -9
  19. package/lib/types/client/desktop.d.ts +43 -0
  20. package/lib/types/client/desktop.js +121 -0
  21. package/lib/types/client/entry.d.ts +10 -0
  22. package/lib/types/client/entry.js +12 -0
  23. package/lib/types/client/index.d.ts +109 -19
  24. package/lib/types/client/index.js +21 -40
  25. package/lib/types/client/policy-drafts.d.ts +25 -0
  26. package/lib/types/client/policy-drafts.js +47 -0
  27. package/lib/types/client/preset-copy.d.ts +1 -0
  28. package/lib/types/client/preset-copy.js +2 -0
  29. package/lib/types/client/preset-manager.d.ts +12 -2
  30. package/lib/types/client/preset-manager.js +70 -25
  31. package/lib/types/client/preset-requests.d.ts +12 -0
  32. package/lib/types/client/preset-requests.js +101 -0
  33. package/lib/types/client/session.d.ts +6 -0
  34. package/lib/types/client/session.js +9 -0
  35. package/lib/types/client/tool-policy.d.ts +120 -0
  36. package/lib/types/client/tool-policy.js +394 -0
  37. package/lib/types/compaction.d.ts +3 -3
  38. package/lib/types/compaction.js +6 -2
  39. package/lib/types/desktop-preset.d.ts +20 -0
  40. package/lib/types/desktop-preset.js +39 -0
  41. package/lib/types/exec.d.ts +4 -0
  42. package/lib/types/exec.js +192 -66
  43. package/lib/types/host-settings.d.ts +4 -0
  44. package/lib/types/host-settings.js +13 -0
  45. package/lib/types/index.d.ts +20 -2
  46. package/lib/types/index.js +181 -68
  47. package/lib/types/installer.js +11 -2
  48. package/lib/types/preferences.d.ts +11 -0
  49. package/lib/types/preferences.js +16 -0
  50. package/lib/types/preset-editor-remote.d.ts +2 -0
  51. package/lib/types/preset-editor-remote.js +6 -2
  52. package/lib/types/preset-editor.d.ts +12 -7
  53. package/lib/types/preset-editor.js +43 -13
  54. package/lib/types/preset-prompt-catalog-schema.d.ts +16 -0
  55. package/lib/types/preset-prompt-catalog-schema.js +11 -0
  56. package/lib/types/preset-prompt-catalog.d.ts +21 -0
  57. package/lib/types/preset-prompt-catalog.js +192 -0
  58. package/lib/types/preset-prompt-contract.d.ts +22 -0
  59. package/lib/types/preset-prompt-contract.js +3 -0
  60. package/lib/types/preset-tool-catalog-schema.d.ts +38 -0
  61. package/lib/types/preset-tool-catalog-schema.js +28 -0
  62. package/lib/types/preset-tool-catalog.d.ts +5 -0
  63. package/lib/types/preset-tool-catalog.js +51 -0
  64. package/lib/types/prompt-sections.d.ts +1 -1
  65. package/lib/types/prompt-sections.js +9 -3
  66. package/lib/types/prompt.js +4 -2
  67. package/lib/types/remote.js +23 -8
  68. package/lib/types/settings.d.ts +3 -3
  69. package/lib/types/settings.js +3 -3
  70. package/lib/types/tool-capabilities.d.ts +32 -0
  71. package/lib/types/tool-capabilities.js +42 -0
  72. package/lib/types/tool-policy-contract.d.ts +60 -0
  73. package/lib/types/tool-policy-contract.js +26 -0
  74. package/lib/types/tool-policy.d.ts +171 -0
  75. package/lib/types/tool-policy.js +367 -0
  76. package/lib/types/typert.host.d.ts +2 -2
  77. package/lib/types/typert.host.js +12 -2
  78. package/locale/en.json +6 -0
  79. package/locale/tool-policy/en.json +6 -0
  80. package/locale/tool-policy/zh.json +6 -0
  81. package/locale/zh.json +6 -0
  82. package/package.json +375 -299
  83. package/scripts/benchmark-tool-policy.mjs +186 -0
  84. package/scripts/build-preset.mjs +19 -0
  85. package/scripts/clean-build.mjs +11 -0
  86. package/src/activity-types.ts +7 -0
  87. package/src/activity.ts +158 -0
  88. package/src/client/activity.ts +82 -0
  89. package/src/client/desktop.tsx +162 -0
  90. package/src/client/entry.tsx +16 -0
  91. package/src/client/index.tsx +972 -0
  92. package/src/client/policy-drafts.ts +56 -0
  93. package/src/client/preset-copy.ts +83 -0
  94. package/src/client/preset-manager.tsx +281 -0
  95. package/src/client/preset-requests.ts +113 -0
  96. package/src/client/session.ts +11 -0
  97. package/src/client/tool-policy.tsx +380 -0
  98. package/src/compact-command.ts +112 -0
  99. package/src/compaction.ts +190 -0
  100. package/src/context.ts +15 -0
  101. package/src/desktop-preset.ts +55 -0
  102. package/src/exec.ts +570 -0
  103. package/src/host-settings.ts +17 -0
  104. package/src/index.ts +1097 -0
  105. package/src/installer.ts +172 -0
  106. package/src/invariant.ts +34 -0
  107. package/src/patch.ts +258 -0
  108. package/src/preferences.ts +17 -0
  109. package/src/preset-contract.ts +85 -0
  110. package/src/preset-editor-remote.ts +41 -0
  111. package/src/preset-editor.ts +502 -0
  112. package/src/preset-prompt-catalog-schema.ts +10 -0
  113. package/src/preset-prompt-catalog.ts +191 -0
  114. package/src/preset-prompt-contract.ts +21 -0
  115. package/src/preset-tool-catalog-schema.ts +28 -0
  116. package/src/preset-tool-catalog.ts +51 -0
  117. package/src/prompt-sections.ts +33 -0
  118. package/src/prompt.ts +62 -0
  119. package/src/remote.ts +748 -0
  120. package/src/settings.ts +79 -0
  121. package/src/tool-capabilities.ts +76 -0
  122. package/src/tool-policy-contract.ts +76 -0
  123. package/src/tool-policy.ts +388 -0
  124. package/src/typert.host.ts +119 -0
  125. package/tsconfig.json +29 -0
  126. package/tsdown.config.ts +110 -0
  127. package/lib/types/preset-templates.d.ts +0 -36
  128. package/lib/types/preset-templates.js +0 -12
@@ -0,0 +1,186 @@
1
+ // Offline registry/native-dispatch benchmark. No model requests, file mutations, or OS commands.
2
+ import assert from 'node:assert/strict'
3
+ import { performance } from 'node:perf_hooks'
4
+ import { writeFileSync } from 'node:fs'
5
+ import { cpus, platform, arch } from 'node:os'
6
+ import { fileURLToPath } from 'node:url'
7
+ import { Context } from '@deepseek-ai/cordis'
8
+ import { createScope, scopeTarget } from '@deepseek-ai/dsh-scope'
9
+ import SessionStore, { SessionId } from '@deepseek-ai/dsh-session'
10
+ import SessionProjections from '@deepseek-ai/dsh-session-projection'
11
+ import SystemPrompt from '@deepseek-ai/dsh-system-prompt'
12
+ import Tools from '@deepseek-ai/dsh-tools'
13
+ import * as NativeExecutor from '@deepseek-ai/dsh-tool-executor-native'
14
+ import * as FsTools from '@deepseek-ai/dsh-tool-fs'
15
+ import * as SearchTools from '@deepseek-ai/dsh-tool-fs-search'
16
+ import * as PwshTool from '@deepseek-ai/dsh-tool-pwsh'
17
+ import * as TodoTool from '@deepseek-ai/dsh-tool-todo'
18
+ import { getEncoding } from 'js-tiktoken'
19
+ import ToolPolicy from '../lib/types/tool-policy.js'
20
+ import { registerCodexExecAndPlan } from '../lib/types/index.js'
21
+ import { rewriteCodexResponsesBody } from '../lib/types/remote.js'
22
+
23
+ const samples = Number(process.env.BENCH_SAMPLES ?? 1200)
24
+ assert(Number.isSafeInteger(samples) && samples >= 100 && samples <= 10000)
25
+ const root = new Context()
26
+ const cwd = fileURLToPath(new URL('../', import.meta.url))
27
+ const presetIdentities = new WeakMap()
28
+ const agents = new Map()
29
+ let serial = 0
30
+ const probeName = '__tool_policy_benchmark_probe'
31
+ const identities = ['native', 'stacked', 'balanced', 'minimal', 'shadow']
32
+ const labels = {
33
+ native: '原生工具', stacked: '原生与 Codex 直接叠加',
34
+ balanced: '保留文件工具,替换执行与计划', minimal: '极简对照(非推荐)', shadow: '同名实现替换对照',
35
+ }
36
+
37
+ function summary(values) {
38
+ const sorted = [...values].sort((a, b) => a - b)
39
+ return { samples: values.length, medianUs: sorted[Math.floor(sorted.length / 2)], p95Us: sorted[Math.floor(sorted.length * .95)], meanUs: values.reduce((a, b) => a + b, 0) / values.length }
40
+ }
41
+ async function measure(profiles, key, task, count = samples) {
42
+ for (let i = 0; i < 80; i++) for (const profile of profiles) await task(profile, i)
43
+ const values = new Map(profiles.map(profile => [profile.id, []]))
44
+ for (let i = 0; i < count; i++) for (const profile of profiles) {
45
+ const start = performance.now()
46
+ await task(profile, i)
47
+ values.get(profile.id).push((performance.now() - start) * 1000)
48
+ }
49
+ for (const profile of profiles) profile.timings[key] = summary(values.get(profile.id))
50
+ }
51
+ const probe = {
52
+ name: probeName, description: 'Internal constant-time benchmark probe; excluded from schema token totals.',
53
+ parameters: { type: 'object', properties: {}, additionalProperties: false },
54
+ output: { schema: { type: 'object', properties: { ok: { type: 'boolean' } }, required: ['ok'], additionalProperties: false }, render: value => JSON.stringify(value) },
55
+ isConcurrencySafe: () => true,
56
+ execute: async () => ({ ok: true }),
57
+ }
58
+
59
+ try {
60
+ // Capability facts match a confining Windows composition. No provider body is executed.
61
+ root.provide('fs', { sandboxMode: 'workspace-write' })
62
+ root.provide('shell', { sandboxMode: 'workspace-write', resolve: value => value, execute: async () => { throw new Error('OS execution is outside this benchmark') } })
63
+ root.provide('sandboxPolicy', { resolve: () => ({ mode: 'workspace-write', workspaceRoots: [cwd] }) })
64
+ root.provide('subprocess', {})
65
+ root.provide('shellEnv', { collect: () => ({}) })
66
+ root.provide('workingDirectory', { get: () => cwd, defaultDirectory: cwd })
67
+ root.provide('agents', { list: () => [...agents.values()], get: id => agents.get(id) })
68
+ root.provide('agentPresets', {
69
+ composedPreset: ctx => presetIdentities.get(ctx),
70
+ presetForSession: session => [...agents.values()].find(agent => agent.session === session)?.preset,
71
+ })
72
+ await root.plugin(SessionStore)
73
+ await root.plugin(SessionProjections)
74
+ await root.plugin(SystemPrompt, {})
75
+ await root.plugin(Tools)
76
+ await root.plugin(NativeExecutor)
77
+
78
+ const tools = root.get('tools')
79
+ const systemPrompt = root.get('systemPrompt')
80
+ const sessions = root.get('sessions')
81
+ const presetKey = {}
82
+ const preset = createScope(root, presetKey)
83
+ await preset.ctx.plugin(FsTools, { readImage: false, applyPatch: true })
84
+ await preset.ctx.plugin(SearchTools, { sampleOverCapGlobResults: false })
85
+ await preset.ctx.plugin(PwshTool, {})
86
+ await preset.ctx.plugin(TodoTool, { allowParallelInProgress: true })
87
+ preset.ctx.get('tools').register(probe)
88
+ const originalFiles = ['read', 'write', 'edit', 'apply_patch', 'glob', 'grep'].map(name => [name, tools.get(name, presetKey)])
89
+ for (const [name, definition] of originalFiles) assert(definition, `missing native tool ${name}`)
90
+ assert(tools.get('pwsh', presetKey))
91
+ assert(tools.get('todo_write', presetKey))
92
+
93
+ await root.plugin(ToolPolicy, { rules: [
94
+ { preset: 'balanced', replaceShell: true, replacePlan: true },
95
+ { preset: 'minimal', allow: ['pwsh', 'todo_write', 'apply_patch', probeName], replaceShell: true, replacePlan: true },
96
+ ] })
97
+
98
+ async function newAgent(id) {
99
+ const session = sessions.create(SessionId(`bench-${id}-${++serial}`), { meta: { cwd } })
100
+ const agent = { id: session.id, session, preset: id, status: 'idle', options: { provider: 'benchmark', model: 'gpt-5.4' } }
101
+ const scope = createScope(root, agent, { parent: presetKey })
102
+ agent.ctx = scope.ctx
103
+ presetIdentities.set(agent.ctx, id)
104
+ agents.set(agent.id, agent)
105
+ const started = performance.now()
106
+ await root.serial(scopeTarget(agent, agent), 'agent/created', { agent, source: 'startup' })
107
+ const attachUs = (performance.now() - started) * 1000
108
+ return { agent, scope, attachUs, async dispose() { await scope.dispose(); agents.delete(agent.id) } }
109
+ }
110
+ const profiles = []
111
+ for (const id of identities) {
112
+ const handle = await newAgent(id)
113
+ const { agent } = handle
114
+ if (id === 'stacked') registerCodexExecAndPlan(agent.ctx)
115
+ if (id === 'shadow') agent.ctx.get('tools').register({ ...probe, execute: async () => ({ ok: true }) })
116
+ const signal = new AbortController().signal
117
+ const admission = await tools.resolve({ agent, modelSelection: agent.options, signal })
118
+ const schemas = tools.schemas(agent, admission).filter(tool => tool.name !== probeName)
119
+ const assembled = await systemPrompt.assemble({ scope: agent, toolSet: admission })
120
+ const profile = { id, label: labels[id], handle, agent, signal, admission, schemas, assembled, timings: {} }
121
+ if (id === 'balanced') {
122
+ for (const [name, definition] of originalFiles) assert.equal(tools.get(name, agent), definition, `file tool changed: ${name}`)
123
+ assert.equal(tools.executable('pwsh', agent, admission), undefined)
124
+ assert.equal(tools.executable('todo_write', agent, admission), undefined)
125
+ assert(schemas.some(tool => tool.name === 'exec_command'))
126
+ assert(schemas.some(tool => tool.name === 'update_plan'))
127
+ }
128
+ profiles.push(profile)
129
+ }
130
+
131
+ await measure(profiles, 'resolveAndSchemas', async profile => {
132
+ const set = await tools.resolve({ agent: profile.agent, modelSelection: profile.agent.options, signal: profile.signal })
133
+ tools.schemas(profile.agent, set)
134
+ set.dispose()
135
+ })
136
+ await measure(profiles, 'assemble', profile => systemPrompt.assemble({ scope: profile.agent, toolSet: profile.admission }), Math.min(samples, 600))
137
+ await measure(profiles, 'nativeNoIoDispatch', async (profile, i) => {
138
+ const batch = await tools.execute({ agent: profile.agent, signal: profile.signal, toolSet: profile.admission,
139
+ calls: [{ type: 'tool-call', id: `benchmark-${i}`, name: probeName, arguments: '{}' }] })
140
+ assert.equal(batch.results[0].result.isError, false)
141
+ })
142
+ const history = Array.from({ length: 16 }, (_, i) => [
143
+ { type: 'function_call', call_id: `patch-${i}`, name: 'apply_patch', arguments: JSON.stringify({ input: '*** Begin Patch\n*** Add File: sample.txt\n+sample\n*** End Patch' }) },
144
+ { type: 'function_call_output', call_id: `patch-${i}`, output: 'Success.' },
145
+ ]).flat()
146
+ for (const profile of profiles) profile.wireInput = { model: 'gpt-5.4', input: history, tools: profile.schemas.map(tool => ({ type: 'function', ...tool })) }
147
+ await measure(profiles, 'rewrite16PatchHistoryCalls', profile => { rewriteCodexResponsesBody(profile.wireInput) })
148
+
149
+ const attach = new Map(identities.map(id => [id, []]))
150
+ for (let i = 0; i < 60; i++) for (const id of identities) {
151
+ const handle = await newAgent(id)
152
+ if (i >= 10) attach.get(id).push(handle.attachUs)
153
+ await handle.dispose()
154
+ }
155
+ // Token counting is outside timing loops. This is a reference encoding, not provider billing.
156
+ const tokenizer = getEncoding('o200k_base')
157
+ const stats = value => {
158
+ const text = typeof value === 'string' ? value : JSON.stringify(value)
159
+ return { utf8Bytes: Buffer.byteLength(text), o200kBaseTokens: tokenizer.encode(text).length }
160
+ }
161
+ const result = {
162
+ generatedAt: new Date().toISOString(), runtimeVersion: '0.2.2-rc.1', node: process.version,
163
+ platform: platform(), arch: arch(), cpu: cpus()[0]?.model, samples,
164
+ methodology: {
165
+ setup: 'Real Cordis scopes, ToolsService, native executor, official FS/search/pwsh/todo tool registrations and the actual tool-policy plugin; lightweight Agent owners and preset identity table, no AgentLoop/model/OS or file I/O.',
166
+ baseline: 'Eight native capabilities: read/write/edit/apply_patch/glob/grep/pwsh/todo_write. read_image excluded because no attachment store is mounted. All other Harness tools are held outside this subset.',
167
+ probe: 'Every timing case also carries the same constant-time probe, excluded from reported model schema totals. Dispatch is unlogged outside a model step; not a full AgentLoop/logging benchmark.',
168
+ timing: '80 warm-ups; cases interleaved per sample; performance.now microseconds. Attach: 10 warm-ups + 50 samples. Assembly capped at 600 samples.',
169
+ tokens: 'JSON schema/body and assembled section text counted with js-tiktoken o200k_base. Not a claim about gpt-6.1-sol billing, TTFT, cache hits, or task success rate.',
170
+ wire: 'Illustrative Responses function-tool mapping plus actual plugin rewrite with 16 correlated apply_patch call/results; no HTTP request.',
171
+ limits: 'No React rendering, model latency, filesystem/OS process timing, permission interaction latency or process-memory savings measured.',
172
+ },
173
+ profiles: profiles.map(profile => ({
174
+ id: profile.id, label: profile.label, tools: profile.schemas.map(tool => tool.name).sort(),
175
+ schema: stats(profile.schemas), promptSections: stats(profile.assembled.sections.map(section => section.text).join('\n\n')),
176
+ illustrativeWire: stats(rewriteCodexResponsesBody(profile.wireInput)),
177
+ timings: { ...profile.timings, agentCreatedListener: summary(attach.get(profile.id)) },
178
+ })),
179
+ }
180
+ const output = new URL('../docs/tool-policy-benchmark.json', import.meta.url)
181
+ writeFileSync(output, JSON.stringify(result, null, 2) + '\n')
182
+ console.log(JSON.stringify(result, null, 2))
183
+ for (const profile of profiles) { profile.admission.dispose(); await profile.handle.dispose() }
184
+ } finally {
185
+ await root.fiber.dispose()
186
+ }
@@ -0,0 +1,19 @@
1
+ // Generate the public declaration from the same composition used by the legacy installer.
2
+ import { writeFileSync } from 'node:fs'
3
+ import { fileURLToPath } from 'node:url'
4
+ import { stringify } from 'yaml'
5
+ import { desktopCodexPreset } from '../lib/types/desktop-preset.js'
6
+
7
+ const preset = desktopCodexPreset(fileURLToPath(new URL('../presets/codex-collaboration/', import.meta.url)))
8
+ const patch = [{ insert: [
9
+ { id: 'codex', name: '@shuind/dsh-codex-harness/preferences' },
10
+ { id: 'codex-tool-policy', name: '@shuind/dsh-codex-harness/tool-policy', config: { rules: [] } },
11
+ { id: 'preset-codex-collaboration', name: '@deepseek-ai/dsh-agent-preset', config: preset },
12
+ {
13
+ id: 'codex-client', name: '@shuind/dsh-codex-harness',
14
+ config: { globalEnhancements: true, codexCore: false },
15
+ },
16
+ ] }]
17
+ writeFileSync(new URL('../cordis.patch.yml', import.meta.url),
18
+ '# Generated by scripts/build-preset.mjs; edit presets/codex-collaboration or src/desktop-preset.ts.\n'
19
+ + stringify(patch, { lineWidth: 0 }), 'utf8')
@@ -0,0 +1,11 @@
1
+ // Remove only this package's generated output before emitting a fresh bundle.
2
+ import { rmSync } from 'node:fs'
3
+ import { basename, dirname, resolve } from 'node:path'
4
+ import { fileURLToPath } from 'node:url'
5
+
6
+ const root = resolve(fileURLToPath(new URL('../', import.meta.url)))
7
+ const output = resolve(root, 'lib')
8
+ if (dirname(output) !== root || basename(output) !== 'lib') {
9
+ throw new Error(`Refusing to clean an unexpected output directory: ${output}`)
10
+ }
11
+ rmSync(output, { recursive: true, force: true })
@@ -0,0 +1,7 @@
1
+ /** Pure client/host-shared type for the Codex activity projection value. */
2
+
3
+ export type CodexActivity = {
4
+ activity: 'compaction' | 'requesting-model' | 'model-reply' | 'awaiting-model'
5
+ startedAt: number
6
+ }
7
+
@@ -0,0 +1,158 @@
1
+ /** Host-side activity projection for the Codex status line. */
2
+
3
+ import type { Context } from '@deepseek-ai/cordis'
4
+ import type { StreamChunk } from '@deepseek-ai/dsh-llm/types'
5
+ import { z, type ZodType } from 'zod'
6
+ import type { CodexActivity } from './activity-types.ts'
7
+
8
+ export type { CodexActivity } from './activity-types.ts'
9
+
10
+ /** Long-running Codex activities currently surfaced to the client. */
11
+ export type CodexActivityState = CodexActivity | null
12
+
13
+ /** Minimal event shape needed by this projection; no compaction package import is required. */
14
+ export interface CodexActivityEvent {
15
+ type: string
16
+ time: number
17
+ data?: unknown
18
+ }
19
+
20
+ /**
21
+ * Whether a stream chunk carries visible model output.
22
+ *
23
+ * DSH 0.1.2 removed the runtime `isTokenDelta` helper from `dsh-llm/message`
24
+ * while keeping the StreamChunk vocabulary unchanged. Keep this small
25
+ * predicate local so the harness works with both the old and new DSH bundles.
26
+ */
27
+ function isTokenDelta(chunk: StreamChunk): boolean {
28
+ switch (chunk.type) {
29
+ case 'text-delta':
30
+ case 'reasoning-delta':
31
+ return chunk.text !== ''
32
+ case 'tool-call-delta':
33
+ return chunk.argumentsDelta !== '' || chunk.name !== undefined
34
+ default:
35
+ return false
36
+ }
37
+ }
38
+
39
+ /** Read packed v2 streams without importing a helper absent from older DSH packages. */
40
+ function streamReplyTime(stream: readonly unknown[]): number | undefined {
41
+ for (const value of stream) {
42
+ if (typeof value !== 'object' || value === null) continue
43
+ const record = value as {
44
+ type?: string; time?: number; chunk?: StreamChunk
45
+ time0?: number; dt?: number[]; texts?: string[]; args?: string[]; name?: string
46
+ }
47
+ if (record.type === 'chunk') {
48
+ if (record.chunk !== undefined && isTokenDelta(record.chunk)) return record.time
49
+ continue
50
+ }
51
+ if (record.type !== 'text-chunks' && record.type !== 'reasoning-chunks' && record.type !== 'tool-call-chunks') continue
52
+ const fragments = record.type === 'tool-call-chunks' ? record.args : record.texts
53
+ if (fragments === undefined || record.time0 === undefined) continue
54
+ let time = record.time0
55
+ for (const [index, text] of fragments.entries()) {
56
+ if (index > 0) time += record.dt?.[index - 1] ?? 0
57
+ if (text !== '' || (record.type === 'tool-call-chunks' && record.name !== undefined)) return time
58
+ }
59
+ }
60
+ return undefined
61
+ }
62
+
63
+ /** Only a non-empty delta starts the reply phase; preserve its original stream time. */
64
+ function modelReplyTime(event: CodexActivityEvent): number | undefined {
65
+ const data = typeof event.data === 'object' && event.data !== null
66
+ ? event.data as { chunk?: StreamChunk; stream?: unknown[] }
67
+ : undefined
68
+ if (event.type === 'assistant/chunk') {
69
+ return data?.chunk !== undefined && isTokenDelta(data.chunk) ? event.time : undefined
70
+ }
71
+ if (event.type === 'assistant/message' || event.type === 'assistant/attempt') {
72
+ if (data?.stream !== undefined) return streamReplyTime(data.stream)
73
+ // Legacy/non-streaming adapters did not carry a packed stream on settlement.
74
+ if (event.type === 'assistant/message') return event.time
75
+ }
76
+ return undefined
77
+ }
78
+
79
+ /** Persisted and wire shape of the Codex activity value. */
80
+ export const codexActivitySchema: ZodType<CodexActivityState> = z.union([
81
+ z.object({
82
+ activity: z.literal('compaction'),
83
+ startedAt: z.number().int().nonnegative(),
84
+ }),
85
+ z.object({
86
+ activity: z.literal('requesting-model'),
87
+ startedAt: z.number().int().nonnegative(),
88
+ }),
89
+ z.object({
90
+ activity: z.literal('model-reply'),
91
+ startedAt: z.number().int().nonnegative(),
92
+ }),
93
+ // Accepted for rolling upgrades: an older Codex host may still send this
94
+ // ambiguous state until its projection definition is refreshed.
95
+ z.object({
96
+ activity: z.literal('awaiting-model'),
97
+ startedAt: z.number().int().nonnegative(),
98
+ }),
99
+ z.null(),
100
+ ])
101
+
102
+ /** Pure event fold, exported so its reset and reference-stability rules can be tested directly. */
103
+ export function applyCodexActivity(
104
+ state: CodexActivityState,
105
+ event: CodexActivityEvent,
106
+ ): CodexActivityState {
107
+ if (event.type === 'compaction/start') return { activity: 'compaction', startedAt: event.time }
108
+ if (event.type === 'step/start' || event.type === 'llm/retry-started') {
109
+ return { activity: 'requesting-model', startedAt: event.time }
110
+ }
111
+ if (state?.activity === 'requesting-model' || state?.activity === 'awaiting-model') {
112
+ const startedAt = modelReplyTime(event)
113
+ if (startedAt !== undefined) return { activity: 'model-reply', startedAt }
114
+ }
115
+ if (event.type === 'turn/start' || event.type === 'turn/end' || event.type === 'compaction/end') return null
116
+ // Keep the line through reasoning and streamed output. It is the only
117
+ // visible indication that the model is still progressing; tool cards have
118
+ // their own status, so a tool dispatch retires this ambient line.
119
+ if ((state?.activity === 'requesting-model'
120
+ || state?.activity === 'model-reply'
121
+ || state?.activity === 'awaiting-model')
122
+ && (event.type === 'llm/retry'
123
+ || event.type === 'tool/call'
124
+ || event.type === 'step/end')) return null
125
+ return state
126
+ }
127
+
128
+ export const codexActivityProjection = {
129
+ key: 'codexActivity',
130
+ stateSchema: codexActivitySchema,
131
+ init: (): CodexActivityState => null,
132
+ apply: applyCodexActivity,
133
+ wire: {
134
+ viewSchema: codexActivitySchema,
135
+ view: (state: CodexActivityState): CodexActivityState => state,
136
+ },
137
+ // Keep the old projection contract working for DSH bundles that predate
138
+ // the `stateSchema`/`wire` split.
139
+ schema: codexActivitySchema,
140
+ view: (state: CodexActivityState): CodexActivityState => state,
141
+ stateVersion: 3,
142
+ } as const
143
+
144
+ type CodexActivityRegistry = {
145
+ register(definition: typeof codexActivityProjection): unknown
146
+ }
147
+
148
+ type ProjectionContext = Context & {
149
+ sessionProjections: CodexActivityRegistry
150
+ }
151
+
152
+ /** Register the optional activity unit without requiring the projection seam in every assembly. */
153
+ export function registerCodexActivityProjection(ctx: Context): void {
154
+ ctx.inject(['sessionProjections'], async (projectionCtx) => {
155
+ // Await readiness, but do not return the new ProjectionHandle as a Cordis effect.
156
+ await (projectionCtx as ProjectionContext).sessionProjections.register(codexActivityProjection)
157
+ })
158
+ }
@@ -0,0 +1,82 @@
1
+ /** Client-only inference used while the host activity projection frame is in flight. */
2
+
3
+ /**
4
+ * The legacy conversation slice is no longer part of the current Session
5
+ * snapshot. Keep this fallback structural so both generations can load without
6
+ * depending on the removed dsh-client-runtime package.
7
+ */
8
+ export interface ActivitySessionSnapshot {
9
+ readonly running: boolean
10
+ readonly partial?: { readonly turn: number; readonly replyStartedAt?: number | undefined } | null | undefined
11
+ readonly runningCalls?: readonly unknown[] | undefined
12
+ readonly turnTimings?: ReadonlyMap<number, { readonly startTime: number; readonly endTime?: number | undefined }> | undefined
13
+ readonly chat?: {
14
+ readonly timeline: { readonly turns: ReadonlyMap<number, { readonly steps: readonly { readonly step: number; readonly end?: unknown }[] }> }
15
+ readonly nodes: { values(): Iterable<{ readonly kind: string; readonly data: unknown }> }
16
+ } | undefined
17
+ }
18
+
19
+ export type CodexModelActivity = {
20
+ activity: 'requesting-model' | 'model-reply'
21
+ startedAt: number
22
+ }
23
+
24
+ /** Equality for selector hooks, whose default is reference identity. */
25
+ export function sameModelActivity(
26
+ left: CodexModelActivity | undefined,
27
+ right: CodexModelActivity | undefined,
28
+ ): boolean {
29
+ return left?.activity === right?.activity && left?.startedAt === right?.startedAt
30
+ }
31
+
32
+ /** Infer the request-phase clock from the existing conversation snapshot. */
33
+ export function awaitingModelStartedAt(snapshot: ActivitySessionSnapshot): number | undefined {
34
+ if (!snapshot.running || (snapshot.runningCalls?.length ?? 0) > 0) return undefined
35
+ if (snapshot.turnTimings === undefined) return undefined
36
+ let latest: number | undefined
37
+ for (const timing of snapshot.turnTimings.values()) {
38
+ if (timing.endTime === undefined) latest = timing.startTime
39
+ }
40
+ return latest
41
+ }
42
+
43
+ /** Infer the first non-empty model token timestamp from the current snapshot. */
44
+ export function modelReplyStartedAt(snapshot: ActivitySessionSnapshot): number | undefined {
45
+ if (!snapshot.running || (snapshot.runningCalls?.length ?? 0) > 0) return undefined
46
+ if (snapshot.turnTimings === undefined) return undefined
47
+ let openTurn: { turn: number; startTime: number } | undefined
48
+ for (const [turn, timing] of snapshot.turnTimings) {
49
+ if (timing.endTime === undefined) openTurn = { turn, startTime: timing.startTime }
50
+ }
51
+ if (openTurn === undefined) return undefined
52
+ if (snapshot.partial !== undefined && snapshot.partial !== null && snapshot.partial.turn === openTurn.turn) {
53
+ const partialReplyStartedAt = snapshot.partial.replyStartedAt
54
+ if (partialReplyStartedAt !== undefined) return partialReplyStartedAt
55
+ }
56
+
57
+ // A non-streaming adapter has no partial row. The assembled Chat view still
58
+ // carries the reply boundary, but only accept it for the currently open step
59
+ // so an earlier tool step in the same turn cannot mask a new request.
60
+ const chat = snapshot.chat
61
+ const turn = chat?.timeline.turns.get(openTurn.turn)
62
+ const step = turn?.steps.findLast(candidate => candidate.end === undefined)
63
+ if (step === undefined) return undefined
64
+ for (const node of [...(chat?.nodes.values() ?? [])].reverse()) {
65
+ if (node.kind !== 'assistant-step') continue
66
+ const data = node.data as { turn?: unknown; step?: unknown; replyStartedAt?: unknown }
67
+ if (data.turn === openTurn.turn && data.step === step.step && typeof data.replyStartedAt === 'number') {
68
+ return data.replyStartedAt
69
+ }
70
+ }
71
+ return undefined
72
+ }
73
+
74
+ /** Infer the two-phase model activity from the current client snapshot. */
75
+ export function modelActivity(snapshot: ActivitySessionSnapshot): CodexModelActivity | undefined {
76
+ const startedAt = awaitingModelStartedAt(snapshot)
77
+ if (startedAt === undefined) return undefined
78
+ const replyStartedAt = modelReplyStartedAt(snapshot)
79
+ return replyStartedAt === undefined
80
+ ? { activity: 'requesting-model', startedAt }
81
+ : { activity: 'model-reply', startedAt: replyStartedAt }
82
+ }
@@ -0,0 +1,162 @@
1
+ /** A single Settings workspace; the bundle page is only a signpost. */
2
+ import { useState } from 'react'
3
+ import type { Context } from '@deepseek-ai/cordis'
4
+ import type { InjectFace, PropsLocale } from '@deepseek-ai/dsh-client-ui-slots'
5
+ import type {} from '@deepseek-ai/dsh-client-ui-plugin-manager/client'
6
+ import { applyWithSettingsApi } from './index.tsx'
7
+ import type { CodexScope, CodexSettings, InputSettingsControlInjected } from './index.tsx'
8
+ import { CODEX_CONTEXT_MAX } from '../context.ts'
9
+ import type { PresetClientRemote } from './preset-manager.tsx'
10
+ import { bindToolPolicy, ToolPolicySection } from './tool-policy.tsx'
11
+ import type { ToolPolicyBinding, ToolPolicyMode } from './tool-policy.tsx'
12
+
13
+ export interface DesktopConfigForm extends Pick<CodexScope, 'getSnapshot' | 'subscribe'> {
14
+ set(field: string, value: unknown): Promise<boolean>
15
+ unset(field: string): Promise<boolean>
16
+ mutate(ops: Array<{ op: 'set'; path: string[]; value: unknown } | { op: 'unset'; path: string[] }>, expectedRevision?: number | string): Promise<boolean>
17
+ }
18
+ interface DesktopSettingsActions extends InputSettingsControlInjected {
19
+ saveSettings(edits: Record<string, unknown>, expectedRevision?: number | string): Promise<void>
20
+ toolPolicy?: ToolPolicyBinding
21
+ }
22
+ interface DesktopSettingsContext {
23
+ configForms: { get(entryId: string): DesktopConfigForm; whileServed(namespaces: string[], register: () => () => void): () => void }
24
+ }
25
+ export function adaptConfigForm(form: Pick<DesktopConfigForm, 'getSnapshot' | 'subscribe' | 'set' | 'unset'>): CodexScope {
26
+ const accepted = async (result: Promise<boolean>) => { if (!await result) throw new Error('The host did not accept the settings change.') }
27
+ return { getSnapshot: () => form.getSnapshot(), subscribe: listener => form.subscribe(listener),
28
+ set: (field, value) => accepted(form.set(field, value)), unset: field => accepted(form.unset(field)) }
29
+ }
30
+ export async function saveDesktopSettings(form: Pick<DesktopConfigForm, 'mutate'>, edits: Record<string, unknown>, expectedRevision?: number | string): Promise<void> {
31
+ const ops = Object.entries(edits).map(([field, value]) => value === undefined ? { op: 'unset' as const, path: [field] } : { op: 'set' as const, path: [field], value })
32
+ if (!ops.length) return
33
+ const accepted = expectedRevision === undefined ? await form.mutate(ops) : await form.mutate(ops, expectedRevision)
34
+ if (!accepted) throw new Error('The host did not accept the settings change.')
35
+ }
36
+
37
+ type DesktopSettingsProps = InjectFace<DesktopSettingsActions> & PropsLocale<'codex'>
38
+ type SettingsPage = 'tools' | 'runtime' | 'advanced'
39
+ type AdvancedPage = 'details' | 'prompts' | 'definition'
40
+ const desktopStyles = `
41
+ .codex-harness-settings { min-width:0; font-size:14px; color:var(--dsw-alias-label-primary); }
42
+ .codex-harness-settings h3 { font-size:14px; margin:0 0 12px; }
43
+ .codex-harness-settings .codex-harness-nav { display:flex; align-items:center; gap:8px; flex-wrap:wrap; margin-bottom:16px; border-bottom:1px solid var(--dsw-alias-border-l1); padding-bottom:8px; }
44
+ .codex-harness-settings button, .codex-harness-settings input[type=number], .codex-harness-settings textarea { box-sizing:border-box; min-width:0; max-width:100%; font:inherit; color:inherit; background:var(--dsw-alias-bg-layer-2); border:1px solid var(--dsw-alias-border-l2); border-radius:8px; padding:7px 12px; }
45
+ .codex-harness-settings button { cursor:pointer; }
46
+ .codex-harness-settings button:disabled { opacity:.5; cursor:default; }
47
+ .codex-harness-settings .codex-harness-nav button { border:0; background:none; }
48
+ .codex-harness-settings .codex-harness-nav button[aria-pressed=true] { background:var(--dsw-alias-label-primary); color:var(--dsw-alias-bg-base); }
49
+ .codex-harness-settings .codex-harness-quiet { color:var(--dsw-alias-label-secondary); background:none; border:0; }
50
+ .codex-harness-settings .codex-harness-advanced-link { margin-left:auto; }
51
+ .codex-harness-settings :is(input,textarea,button,summary):focus-visible { outline:2px solid var(--dsw-alias-brand-primary); outline-offset:2px; }
52
+ .codex-harness-settings fieldset { min-width:0; border:0; padding:0; margin:0; }
53
+ .codex-harness-settings .codex-harness-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,220px),1fr)); gap:16px; }
54
+ .codex-harness-settings .codex-harness-group h4 { margin:0 0 8px; font-size:12px; font-weight:500; color:var(--dsw-alias-label-secondary); }
55
+ .codex-harness-settings .codex-harness-setting-row { min-width:0; display:flex; gap:12px; justify-content:space-between; align-items:center; padding:8px 0; }
56
+ .codex-harness-settings input[type=number] { width:140px; }
57
+ .codex-harness-settings textarea { display:block; width:100%; margin-top:8px; resize:vertical; }
58
+ .codex-harness-settings .codex-harness-note { margin:0 0 16px; color:var(--dsw-alias-label-secondary); font-size:12px; line-height:1.5; }
59
+ .codex-harness-settings .codex-harness-actions { display:flex; gap:8px; flex-wrap:wrap; margin-top:16px; }
60
+ .codex-harness-settings .codex-harness-primary { background:var(--dsw-alias-label-primary); color:var(--dsw-alias-bg-base); }
61
+ .codex-harness-settings input[role=switch] { appearance:none; width:32px; height:20px; border:1px solid var(--dsw-alias-border-l2); border-radius:16px; background:var(--dsw-alias-bg-layer-2); position:relative; cursor:pointer; flex-shrink:0; margin:0; }
62
+ .codex-harness-settings input[role=switch]:before { content:''; position:absolute; width:12px; height:12px; top:3px; left:3px; border-radius:50%; background:var(--dsw-alias-label-secondary); }
63
+ .codex-harness-settings input[role=switch]:checked { background:var(--dsw-alias-label-primary); }
64
+ .codex-harness-settings input[role=switch]:checked:before { left:15px; background:var(--dsw-alias-bg-base); }
65
+ `
66
+
67
+ /** There is intentionally no second editable form on a bundle detail page. */
68
+ export function DesktopSettingsCard({ t }: DesktopSettingsProps & { view: 'summary' | 'page' }) {
69
+ return <section><p>{t('settingsBundleSummary')}</p><p>{t('settingsBundlePath')}</p></section>
70
+ }
71
+
72
+ /** Kept mounted while inactive, so switching pages preserves runtime drafts. */
73
+ export function RuntimeSettingsEditor({ active, ...props }: DesktopSettingsProps & { active: boolean }) {
74
+ const { useSettings, saveSettings, t } = props
75
+ const snapshot = useSettings(state => state)
76
+ const [draft, setDraft] = useState<{ edits: Record<string, unknown>; revision: number | string | undefined }>()
77
+ const [saving, setSaving] = useState(false)
78
+ const [error, setError] = useState('')
79
+ const edits = draft?.edits ?? {}
80
+ const value = (field: keyof CodexSettings) => Object.hasOwn(edits, field) ? edits[field] === undefined ? snapshot.base?.[field] : edits[field] : snapshot.value?.[field]
81
+ const edit = (field: string, next: unknown) => {
82
+ setError(''); setDraft(current => ({ edits: { ...current?.edits, [field]: next }, revision: current === undefined ? snapshot.revision : current.revision }))
83
+ }
84
+ const groups = [
85
+ { label: 'globalGroupRequest', fields: [['fast', 'fast'], ['hostedWebSearchEnabled', 'settingsPreferHostedSearch'], ['remoteCompactionEnabled', 'settingsPreferRemoteCompaction']] },
86
+ { label: 'globalGroupDisplay', fields: [['fastModeControlEnabled', 'fastModeControl'], ['activityIndicatorEnabled', 'capabilityActivity']] },
87
+ ] as const
88
+ if (!active) return null
89
+ return <section aria-label={t('settingsRuntimePage')}>
90
+ <h3>{t('settingsRuntimePage')}<span className="codex-harness-note"> · {t('settingsRuntimeScope')}</span></h3>
91
+ <form onSubmit={event => {
92
+ event.preventDefault(); if (saving || draft === undefined || !snapshot.writable || snapshot.status !== 'ready') return
93
+ setSaving(true); setError(''); const submitted = draft
94
+ void saveSettings(submitted.edits, submitted.revision).then(() => setDraft(current => current === submitted ? undefined : current))
95
+ .catch(() => setError(t('settingsSharedFailed'))).finally(() => setSaving(false))
96
+ }}>
97
+ <fieldset disabled={!snapshot.writable || snapshot.status !== 'ready' || saving}>
98
+ <div className="codex-harness-grid">{groups.map(group => <div key={group.label} className="codex-harness-group">
99
+ <h4>{t(group.label)}</h4>{group.fields.map(([field, label]) => <label key={field} className="codex-harness-setting-row">
100
+ <span>{t(label)}</span><input type="checkbox" role="switch" aria-label={t(label)} aria-checked={Boolean(value(field) ?? (field !== 'fast'))}
101
+ checked={Boolean(value(field) ?? (field !== 'fast'))} onChange={event => edit(field, event.target.checked)} />
102
+ </label>)}
103
+ </div>)}</div>
104
+ <label className="codex-harness-setting-row">{t('contextSize')} (tokens)<input type="number" min={1} max={CODEX_CONTEXT_MAX} step={1}
105
+ value={String(value('contextWindow') ?? '')} onChange={event => edit('contextWindow', event.target.value === '' ? undefined : Number(event.target.value))} /></label>
106
+ <div className="codex-harness-actions"><button className="codex-harness-primary" type="submit" disabled={!Object.keys(edits).length}>{t(saving ? 'promptSaving' : 'settingsSaveRuntime')}</button>
107
+ <button type="button" disabled={draft === undefined} onClick={() => { setDraft(undefined); setError('') }}>{t('promptDiscard')}</button></div>
108
+ </fieldset>
109
+ </form>
110
+ {!snapshot.writable && <p className="codex-harness-note">{t('promptReadOnly')}</p>}{error && <p role="alert">{error}</p>}
111
+ </section>
112
+ }
113
+
114
+ export function CodexSettingsTab(props: DesktopSettingsProps & { initialPage?: SettingsPage }) {
115
+ const { toolPolicy, presetManager, t } = props
116
+ const [page, setPage] = useState<SettingsPage>(props.initialPage ?? 'tools')
117
+ const [advanced, setAdvanced] = useState<AdvancedPage>('details')
118
+ const mode: ToolPolicyMode = page === 'tools' ? 'tools' : page === 'advanced' ? advanced : 'inactive'
119
+ return <section className="codex-harness-settings">
120
+ <style>{desktopStyles}</style>
121
+ <nav className="codex-harness-nav" aria-label={t('settingsTabLabel')}>
122
+ <div>
123
+ <button type="button" aria-pressed={page === 'tools'} onClick={() => setPage('tools')}>{t('settingsToolsPage')}</button>
124
+ <button type="button" aria-pressed={page === 'runtime'} onClick={() => setPage('runtime')}>{t('settingsRuntimePage')}</button>
125
+ </div>
126
+ <button className="codex-harness-quiet codex-harness-advanced-link" type="button" onClick={() => setPage('advanced')}>{t('settingsAdvanced')}</button>
127
+ </nav>
128
+ {page === 'advanced' && <nav className="codex-harness-nav" aria-label={t('settingsAdvanced')}>
129
+ {(['details', 'prompts', 'definition'] as const).map(section => <button type="button" key={section} aria-pressed={advanced === section}
130
+ onClick={() => setAdvanced(section)}>{t(section === 'details' ? 'settingsAdvancedTools' : section === 'prompts' ? 'settingsPresetPrompts' : 'settingsDefinition')}</button>)}
131
+ </nav>}
132
+ {toolPolicy !== undefined && <ToolPolicySection binding={toolPolicy} presetManager={presetManager} mode={mode} t={t} />}
133
+ <RuntimeSettingsEditor {...props} active={page === 'runtime'} />
134
+ </section>
135
+ }
136
+
137
+ export const inject = ['commandUi', 'sessions', 'slots', 'locale', 'configForms', 'remote']
138
+ export function apply(ctx: Context): void {
139
+ let form: DesktopConfigForm
140
+ applyWithSettingsApi(ctx, {
141
+ bind: host => { form = (host as unknown as DesktopSettingsContext).configForms.get('codex'); return adaptConfigForm(form) },
142
+ register: (host, settings, manager) => {
143
+ const desktop = host as unknown as DesktopSettingsContext
144
+ const presetManager = { ...manager, remote: (host as unknown as { remote: PresetClientRemote }).remote }
145
+ const t = host.locale.bind('codex'); const toolPolicy = bindToolPolicy(host, host.configForms)
146
+ const injected = (): DesktopSettingsActions => ({ hooks: { settings }, setSetting: (field, value) => settings.set(field, value), unsetSetting: field => settings.unset(field),
147
+ presetManager, toolPolicy, saveSettings: (edits, revision) => saveDesktopSettings(form, edits, revision) })
148
+ return desktop.configForms.whileServed(['codex'], () => {
149
+ const disposers: Array<() => void> = []; const dispose = () => { for (const off of disposers.splice(0).reverse()) off() }
150
+ try {
151
+ disposers.push(host.slots.inject('settings.plugins.tab', () => host.slots.register({ name: 'settings.plugins.tab', id: 'codex-harness', order: 30,
152
+ label: () => t('settingsTabLabel'), locale: 'codex', inject: injected }, CodexSettingsTab)))
153
+ disposers.push(host.slots.inject('plugins.item', () => host.slots.spec?.('plugins.bundle.config') !== undefined
154
+ ? host.slots.register({ name: 'plugins.bundle.config', key: '@shuind/dsh-codex-harness', locale: 'codex', inject: injected }, DesktopSettingsCard)
155
+ : host.slots.register({ name: 'plugins.item', id: 'codex', order: 30, label: () => t('promptCardTitle'), locale: 'codex', inject: injected }, DesktopSettingsCard)))
156
+ return dispose
157
+ } catch (error) { dispose(); throw error }
158
+ })
159
+ },
160
+ })
161
+ }
162
+ export default { inject, apply }
@@ -0,0 +1,16 @@
1
+ /** One bundle for legacy settingsScope and current Web/desktop ConfigForms. */
2
+ import type { Context } from '@deepseek-ai/cordis'
3
+ import { apply as applyWeb } from './index.tsx'
4
+ import { apply as applyDesktop } from './desktop.tsx'
5
+
6
+ export const inject = [
7
+ 'commandUi', 'sessions', 'slots', 'locale',
8
+ 'remote',
9
+ ]
10
+
11
+ export function apply(ctx: Context): void {
12
+ ctx.inject(['configForms'], host => applyDesktop(host))
13
+ ctx.inject(['settingsScope'], host => applyWeb(host))
14
+ }
15
+
16
+ export default { inject, apply }