@shuind/dsh-codex-harness 0.1.31 → 0.1.33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,141 +1,141 @@
1
- # @shuind/dsh-codex-harness
2
-
3
- 使用精简版 Codex 提示词和工具,以及改善体验的功能。
4
-
5
- ## 功能
6
-
7
- - **精简 Codex coding-agent 提示词**:使用精简版系统提示词;身份、模型和工作目录由 `dsh-persona` 提供,避免重复的 Harness 身份说明,同时保留必要的工具契约和编码工作流。
8
- - **Codex 工具**:`exec_command`、`write_stdin`、`apply_patch`、`update_plan`;`apply_patch` 匹配失败时会显示文件、hunk、行号、可见空白和附近文件内容,便于修正上下文。
9
- - **后台任务**:`exec_command` 支持 `run_in_background: true`,立即返回 DSH `job_id`;使用 `job_output` 读取输出、`job_kill` 停止任务。任务完成时,忙碌中的 agent 会在下一步收到 inbox 注入;空闲 agent 默认保持安静,等下一次唤醒时再处理完成消息。
10
- - **GPT 能力补全**:为 GPT 系列模型补充图片输入和思考强度选项;不会覆盖用户已有的显式配置。
11
- - **Fast**:仅在 Codex preset 的模型选择菜单中显示,开启后向 Responses 请求发送 `service_tier: "priority"`。
12
- - **旧版 Web 兼容**:在未提供新版模型设置/上下文设置 slot 的 DSH Web 中,Fast 和上下文容量会自动回退到旧版 composer inline slot;上下文容量使用紧凑按钮和弹层,不占用整行;client 注入不依赖纯类型 slot 包。
13
- - **Responses 原生 apply_patch**:在 GPT Responses 请求的插件传输边界,把普通 JSON function tool 改写为 `type: "custom"` + OpenAI `lark` grammar;下一轮历史同步改写为 `custom_tool_call`。如果中转站拒绝 custom tool,则自动回退到普通 function tool,不改变 DSH 工具执行器。
14
- - **远程搜索与压缩**:OpenAI Responses 请求默认优先使用 hosted `web_search` 和 `/responses/compact`;失败时回退到 DSH 的本地实现。
15
- - **远程压缩用量**:`/responses/compact` 返回标准 `usage` 时,插件会把 `input_tokens`、缓存读写和 `output_tokens` 原样拆分为 DSH 的用量字段;不再把远程压缩伪造成 `0`。中转站缺失或返回不一致的 usage 时,插件不会编造数字。
16
- - **上下文容量**:在 Web 中设置 `1K`–`1000K` tokens,设置值作用于下一次请求。
17
- - **自动压缩阈值**:Codex preset 的自动压缩会读取最新请求持久化的有效上下文容量;例如设置 `400K` 时,默认 `80%` pressure threshold 是 `320K`,不会错误地按适配器默认 `262,144` 在约 `210K` 提前触发。
18
- - **活动状态**:Codex 请求模型、接收模型回复或进行上下文压缩时,在 `Deep diving...` 右侧显示对应阶段和耗时,让长时间 Deep Diving 不再像卡住。
19
-
20
- ## 安装
21
-
22
- ```sh
23
- dsh plugin --profile web add @shuind/dsh-codex-harness@0.1.29
24
- ```
25
-
26
- 重启 Web,创建新会话,在模式菜单中选择 **Codex 模式**。
27
-
28
- ## 配置
29
-
30
- 在 DSH 的 Models / `llm-pi-ai` 中配置 Responses provider、endpoint、API key 和模型。例如:
31
-
32
- ```yaml
33
- api: openai-responses
34
- baseURL: https://your-responses-endpoint.example.com
35
- apiKeyEnv: OPENAI_API_KEY
36
- ```
37
-
38
- 模型列表中填写中转站实际支持的 GPT 模型。
39
-
40
- ## 请求设置
41
-
42
- ### Fast
43
-
44
- Fast 与 `reasoning_effort` 独立。开启 Fast 后,GPT Responses 请求会携带:
45
-
46
- ```json
47
- {
48
- "service_tier": "priority"
49
- }
50
- ```
51
-
52
- Fast 设置保存在 `codex` 命名空间,只对 Codex preset 生效。
53
-
54
- ### 上下文容量
55
-
56
- 点击 Web 顶部的上下文使用量指示器,可以设置下一次请求的上下文容量。上方 meter 显示当前请求的实际容量;修改设置后,需要发送下一次请求才会更新。Codex preset 的自动压缩也使用这个已经持久化的有效容量。
57
-
58
- 上下文容量使用整数 K tokens,范围为 `1K` 到 `1000K`。实际可用上限仍取决于模型和中转站支持情况。
59
-
60
- ### 活动状态
61
-
62
- Codex 发起模型请求时,Web 会在 `Deep diving...` 右侧显示 `请求中... · Ns`;收到首个非空模型 token(非流式适配器则收到 `assistant/message`)后切换为 `回复中... · Ns`。模型回复结束、进入工具调用、压缩结束或下一轮开始后自动隐藏。该状态由 Host 的 `sessionProjections` 投影驱动,因此本地压缩和远程 `/responses/compact` 都会显示同一种状态。
63
-
64
- 如果当前 DSH 组合没有加载 projection 服务,插件会跳过注册,客户端也会自动隐藏这行,不影响普通会话。
65
-
66
- ## 随包提供的 Codex preset
67
-
68
- 安装插件后,首次启动对应的 DSH profile 时,插件会安装两套随包提供的 preset:
69
-
70
- - **Codex 模式**:使用精简版 Codex 提示词和工具,以及改善体验的功能。
71
- - **Codex 协作模式**:额外加入协作提示词,预期获得更好的体验。
72
-
73
- 它们分别位于 `${DSH_HOME:-$HOME/.dsh}/.agent-presets/codex/` 和 `${DSH_HOME:-$HOME/.dsh}/.agent-presets/codex-collaboration/`。如果对应目录已经存在,插件会保留你的文件,不会覆盖自定义内容。
74
-
75
- 在 Web 的 **Agent 预设** 中选择 **Codex 模式** 或 **Codex 协作模式**,再新建会话即可使用随包提供的 Codex 工具、网页搜索、远程压缩和 Skills 组合。两套 preset 共用 Fast、思考强度、GPT 图片输入和上下文容量设置;只有系统提示词是否包含协作指导不同。
76
-
77
- ## 自定义 preset
78
-
79
- 只有在想自己组合工具、提示词,或修改插件配置时才需要自定义 preset。自定义 preset 放在 `${DSH_HOME:-$HOME/.dsh}/.agent-presets/<id>/` 目录中。
80
-
81
- ### 示例:创建一个带协作提示词的 Codex preset
82
-
83
- 例如创建目录 `${DSH_HOME:-$HOME/.dsh}/.agent-presets/my-codex/`,并写入 `agent.cordis.yml`:
84
-
85
- ```yaml
86
- - id: persona
87
- name: '@deepseek-ai/dsh-persona'
88
- config:
89
- text: 你是一个使用 DSH 工具工作的 Codex 编程助手。
90
-
91
- - id: codex-tools
92
- name: '@shuind/dsh-codex-harness'
93
- config:
94
- collaborationPrompt: true
95
-
96
- - id: codex-jobs
97
- name: '@deepseek-ai/dsh-tool-jobs'
98
- config:
99
- completionDelivery: quiet
100
- ```
101
-
102
- 再写入 `preset.yml`,让 Web 中显示更清晰的名称:
103
-
104
- ```yaml
105
- name: My Codex
106
- description: 使用 Codex 工具并开启可选协作提示词。
107
- order: 10
108
- ```
109
-
110
- 然后在 Web 的 **Agent 预设** 中选择 `My Codex`,再新建会话。这个 preset 会加载 Codex 工具,并开启协作提示词;网页搜索、远程压缩、后台任务控制和 Skills 等其他功能需要在同一个 `agent.cordis.yml` 中按需添加。若希望自定义 preset 也修正自动压缩阈值,请在 compaction 隔离组中使用 `@shuind/dsh-codex-harness/compaction` 替代 `@deepseek-ai/dsh-compaction-basic`。
111
-
112
- ### 可选协作提示词(私货)
113
-
114
- 这段提示词默认关闭,不会注入系统提示词。需要时,在自定义 `agent.cordis.yml` 中开启:
115
-
116
- ```yaml
117
- - id: codex-tools
118
- name: '@shuind/dsh-codex-harness'
119
- config:
120
- collaborationPrompt: true
121
- ```
122
-
123
- 开启后,Codex preset 会在系统提示词中注入以下协作要求:
124
-
125
- ```text
126
- Gather enough context from the user then achieve the user's goal through the clearest, most effective path.
127
- Keep only the essential logic and core actions. There's no need to explain or test what was removed or why something wasn't done.
128
- Convey enough valuable information with as few words as possible. Stay focused on the end goal.
129
- Solve problems by thinking from first principles and at a higher level.
130
- ```
131
-
132
- ## 注意事项
133
-
134
- - preset 在创建会话时确定;已有会话不会自动切换到 Codex 模式。
135
- - GPT 模型的图片输入和思考强度属于能力补全;用户已明确配置的字段会被保留。
136
- - hosted search、远程压缩以及 reasoning 参数的可用性取决于实际 Responses 中转站和模型。
137
- - `apply_patch` 的 custom grammar 改写只作用于 GPT Responses 请求;中转站必须接受 OpenAI custom tools 和 Lark grammar。拒绝时插件会自动发送原始 JSON function-call 请求。
138
-
139
- ## License
140
-
141
- MIT
1
+ # @shuind/dsh-codex-harness
2
+
3
+ 使用精简版 Codex 提示词和工具,以及改善体验的功能。
4
+
5
+ ## 功能
6
+
7
+ - **精简 Codex coding-agent 提示词**:使用精简版系统提示词;身份、模型和工作目录由 `dsh-persona` 提供,避免重复的 Harness 身份说明,同时保留必要的工具契约和编码工作流。
8
+ - **Codex 工具**:`exec_command`、`write_stdin`、`apply_patch`、`update_plan`;`apply_patch` 匹配失败时会显示文件、hunk、行号、可见空白和附近文件内容,便于修正上下文。
9
+ - **后台任务**:`exec_command` 支持 `run_in_background: true`,立即返回 DSH `job_id`;使用 `job_output` 读取输出、`job_kill` 停止任务。任务完成时,忙碌中的 agent 会在下一步收到 inbox 注入;空闲 agent 默认保持安静,等下一次唤醒时再处理完成消息。
10
+ - **GPT 能力补全**:为 GPT 系列模型补充图片输入和思考强度选项;不会覆盖用户已有的显式配置。
11
+ - **Fast**:仅在 Codex preset 的模型选择菜单中显示,开启后向 Responses 请求发送 `service_tier: "priority"`。
12
+ - **Legacy Web compatibility**: The plugin uses only slots present in the legacy host. The context-size control is appended to the host context-usage popup, and the activity line is appended beside `Deep diving...`; no host upgrade is required.
13
+ - **Responses 原生 apply_patch**:在 GPT Responses 请求的插件传输边界,把普通 JSON function tool 改写为 `type: "custom"` + OpenAI `lark` grammar;下一轮历史同步改写为 `custom_tool_call`。如果中转站拒绝 custom tool,则自动回退到普通 function tool,不改变 DSH 工具执行器。
14
+ - **远程搜索与压缩**:OpenAI Responses 请求默认优先使用 hosted `web_search` 和 `/responses/compact`;失败时回退到 DSH 的本地实现。
15
+ - **远程压缩用量**:`/responses/compact` 返回标准 `usage` 时,插件会把 `input_tokens`、缓存读写和 `output_tokens` 原样拆分为 DSH 的用量字段;不再把远程压缩伪造成 `0`。中转站缺失或返回不一致的 usage 时,插件不会编造数字。
16
+ - **上下文容量**:在 Web 中设置 `1K`–`1000K` tokens,设置值作用于下一次请求。
17
+ - **自动压缩阈值**:Codex preset 的自动压缩会读取最新请求持久化的有效上下文容量;例如设置 `400K` 时,默认 `80%` pressure threshold 是 `320K`,不会错误地按适配器默认 `262,144` 在约 `210K` 提前触发。
18
+ - **活动状态**:Codex 请求模型、接收模型回复或进行上下文压缩时,在 `Deep diving...` 右侧显示对应阶段和耗时,让长时间 Deep Diving 不再像卡住。
19
+
20
+ ## 安装
21
+
22
+ ```sh
23
+ dsh plugin --profile web add @shuind/dsh-codex-harness@0.1.33
24
+ ```
25
+
26
+ 重启 Web,创建新会话,在模式菜单中选择 **Codex 模式**。
27
+
28
+ ## 配置
29
+
30
+ 在 DSH 的 Models / `llm-pi-ai` 中配置 Responses provider、endpoint、API key 和模型。例如:
31
+
32
+ ```yaml
33
+ api: openai-responses
34
+ baseURL: https://your-responses-endpoint.example.com
35
+ apiKeyEnv: OPENAI_API_KEY
36
+ ```
37
+
38
+ 模型列表中填写中转站实际支持的 GPT 模型。
39
+
40
+ ## 请求设置
41
+
42
+ ### Fast
43
+
44
+ Fast 与 `reasoning_effort` 独立。开启 Fast 后,GPT Responses 请求会携带:
45
+
46
+ ```json
47
+ {
48
+ "service_tier": "priority"
49
+ }
50
+ ```
51
+
52
+ Fast 设置保存在 `codex` 命名空间,只对 Codex preset 生效。
53
+
54
+ ### 上下文容量
55
+
56
+ 点击 Web 顶部的上下文使用量指示器,可以设置下一次请求的上下文容量。上方 meter 显示当前请求的实际容量;修改设置后,需要发送下一次请求才会更新。Codex preset 的自动压缩也使用这个已经持久化的有效容量。
57
+
58
+ 上下文容量使用整数 K tokens,范围为 `1K` 到 `1000K`。实际可用上限仍取决于模型和中转站支持情况。
59
+
60
+ ### 活动状态
61
+
62
+ Codex 发起模型请求时,Web 会在 `Deep diving...` 右侧显示 `请求中... · Ns`;收到首个非空模型 token(非流式适配器则收到 `assistant/message`)后切换为 `回复中... · Ns`。模型回复结束、进入工具调用、压缩结束或下一轮开始后自动隐藏。该状态由 Host 的 `sessionProjections` 投影驱动,因此本地压缩和远程 `/responses/compact` 都会显示同一种状态。
63
+
64
+ 如果当前 DSH 组合没有加载 projection 服务,插件会跳过注册,客户端也会自动隐藏这行,不影响普通会话。
65
+
66
+ ## 随包提供的 Codex preset
67
+
68
+ 安装插件后,首次启动对应的 DSH profile 时,插件会安装两套随包提供的 preset:
69
+
70
+ - **Codex 模式**:使用精简版 Codex 提示词和工具,以及改善体验的功能。
71
+ - **Codex 协作模式**:额外加入协作提示词,预期获得更好的体验。
72
+
73
+ 它们分别位于 `${DSH_HOME:-$HOME/.dsh}/.agent-presets/codex/` 和 `${DSH_HOME:-$HOME/.dsh}/.agent-presets/codex-collaboration/`。如果对应目录已经存在,插件会保留你的文件,不会覆盖自定义内容。
74
+
75
+ 在 Web 的 **Agent 预设** 中选择 **Codex 模式** 或 **Codex 协作模式**,再新建会话即可使用随包提供的 Codex 工具、网页搜索、远程压缩和 Skills 组合。两套 preset 共用 Fast、思考强度、GPT 图片输入和上下文容量设置;只有系统提示词是否包含协作指导不同。
76
+
77
+ ## 自定义 preset
78
+
79
+ 只有在想自己组合工具、提示词,或修改插件配置时才需要自定义 preset。自定义 preset 放在 `${DSH_HOME:-$HOME/.dsh}/.agent-presets/<id>/` 目录中。
80
+
81
+ ### 示例:创建一个带协作提示词的 Codex preset
82
+
83
+ 例如创建目录 `${DSH_HOME:-$HOME/.dsh}/.agent-presets/my-codex/`,并写入 `agent.cordis.yml`:
84
+
85
+ ```yaml
86
+ - id: persona
87
+ name: '@deepseek-ai/dsh-persona'
88
+ config:
89
+ text: 你是一个使用 DSH 工具工作的 Codex 编程助手。
90
+
91
+ - id: codex-tools
92
+ name: '@shuind/dsh-codex-harness'
93
+ config:
94
+ collaborationPrompt: true
95
+
96
+ - id: codex-jobs
97
+ name: '@deepseek-ai/dsh-tool-jobs'
98
+ config:
99
+ completionDelivery: quiet
100
+ ```
101
+
102
+ 再写入 `preset.yml`,让 Web 中显示更清晰的名称:
103
+
104
+ ```yaml
105
+ name: My Codex
106
+ description: 使用 Codex 工具并开启可选协作提示词。
107
+ order: 10
108
+ ```
109
+
110
+ 然后在 Web 的 **Agent 预设** 中选择 `My Codex`,再新建会话。这个 preset 会加载 Codex 工具,并开启协作提示词;网页搜索、远程压缩、后台任务控制和 Skills 等其他功能需要在同一个 `agent.cordis.yml` 中按需添加。若希望自定义 preset 也修正自动压缩阈值,请在 compaction 隔离组中使用 `@shuind/dsh-codex-harness/compaction` 替代 `@deepseek-ai/dsh-compaction-basic`。
111
+
112
+ ### 可选协作提示词(私货)
113
+
114
+ 这段提示词默认关闭,不会注入系统提示词。需要时,在自定义 `agent.cordis.yml` 中开启:
115
+
116
+ ```yaml
117
+ - id: codex-tools
118
+ name: '@shuind/dsh-codex-harness'
119
+ config:
120
+ collaborationPrompt: true
121
+ ```
122
+
123
+ 开启后,Codex preset 会在系统提示词中注入以下协作要求:
124
+
125
+ ```text
126
+ Ask, align, and clarify first. Gather enough context from the user then achieve the user's goal through the clearest, most effective path.
127
+ Keep only the essential logic and core actions. There's no need to explain or test what was removed or why something wasn't done.
128
+ Convey enough valuable information with as few words as possible. Stay focused on the end goal.
129
+ Solve problems by thinking from first principles and at a higher level.
130
+ ```
131
+
132
+ ## 注意事项
133
+
134
+ - preset 在创建会话时确定;已有会话不会自动切换到 Codex 模式。
135
+ - GPT 模型的图片输入和思考强度属于能力补全;用户已明确配置的字段会被保留。
136
+ - hosted search、远程压缩以及 reasoning 参数的可用性取决于实际 Responses 中转站和模型。
137
+ - `apply_patch` 的 custom grammar 改写只作用于 GPT Responses 请求;中转站必须接受 OpenAI custom tools 和 Lark grammar。拒绝时插件会自动发送原始 JSON function-call 请求。
138
+
139
+ ## License
140
+
141
+ MIT
package/lib/client.js CHANGED
@@ -9,6 +9,7 @@ window.__ModuleLoader__.load({
9
9
  });
10
10
  let react_jsx_runtime = require("react/jsx-runtime");
11
11
  let react = require("react");
12
+ let react_dom = require("react-dom");
12
13
  //#region lib/types/context.js
13
14
  /** User-selectable Codex context controls use whole K-token units. */
14
15
  const CODEX_CONTEXT_UNIT = 1e3;
@@ -72,8 +73,8 @@ window.__ModuleLoader__.load({
72
73
  /** Browser controls for the Codex request settings mounted by the Host plugin. */
73
74
  const NS = "codex";
74
75
  const SETTINGS_NAMESPACE = "codex";
75
- const ACTIVITY_FALLBACK_SLOT = "conversation.composer.dock";
76
76
  const FAST_FALLBACK_SLOT = "conversation.input.right";
77
+ const LEGACY_OVERLAY_SLOT = "conversation.input.overlay";
77
78
  const DEFAULT_CONTEXT_WINDOW = 262144;
78
79
  const en = {
79
80
  fast: "Fast mode",
@@ -149,9 +150,11 @@ window.__ModuleLoader__.load({
149
150
  const pressure = useProjection("contextPressure");
150
151
  return pressure?.contextWindow !== void 0 && pressure.contextWindow > 0 ? pressure.contextWindow : DEFAULT_CONTEXT_WINDOW;
151
152
  }
152
- /** Settings form kept inside the official composer slot's popover. */
153
- function ContextSizeControl({ contextWindow, useSettings, setSetting, unsetSetting, t }) {
153
+ /** Settings form appended to the old host's context meter panel. */
154
+ function ContextSizeControl({ contextWindow, sessionId, useSessions, useSettings, setSetting, unsetSetting, t }) {
155
+ const agentPreset = useSessions((state) => state.byId[sessionId]?.agentPreset);
154
156
  const snapshot = useSettings((state) => state);
157
+ if (!isCodexPresetId(agentPreset)) return null;
155
158
  const configured = snapshot.value?.contextWindow;
156
159
  const maxK = CODEX_CONTEXT_MAX / CODEX_CONTEXT_UNIT;
157
160
  const valueK = Math.min(maxK, Math.max(1, Math.round((configured ?? contextWindow) / CODEX_CONTEXT_UNIT)));
@@ -163,9 +166,11 @@ window.__ModuleLoader__.load({
163
166
  };
164
167
  return (0, react_jsx_runtime.jsxs)("div", {
165
168
  style: {
166
- marginTop: 0,
167
169
  display: "grid",
168
- gap: 8
170
+ gap: 8,
171
+ marginTop: 10,
172
+ paddingTop: 10,
173
+ borderTop: "1px solid var(--dsw-alias-border-l2)"
169
174
  },
170
175
  children: [
171
176
  (0, react_jsx_runtime.jsxs)("div", {
@@ -276,112 +281,6 @@ window.__ModuleLoader__.load({
276
281
  ]
277
282
  });
278
283
  }
279
- /** Compact context-capacity trigger shown beside the bottom activity line. */
280
- function ContextSizeDock({ sessionId, useSessions, useProjection, useSettings, setSetting, unsetSetting, t }) {
281
- const agentPreset = useSessions((state) => state.byId[sessionId]?.agentPreset);
282
- const contextWindow = contextWindowFromProjection(useProjection);
283
- const snapshot = useSettings((state) => state);
284
- const configured = snapshot.value?.contextWindow;
285
- const valueK = Math.min(CODEX_CONTEXT_MAX / CODEX_CONTEXT_UNIT, Math.max(1, Math.round((configured ?? contextWindow) / CODEX_CONTEXT_UNIT)));
286
- const [open, setOpen] = (0, react.useState)(false);
287
- const rootRef = (0, react.useRef)(null);
288
- (0, react.useEffect)(() => {
289
- if (!open) return void 0;
290
- const onPointerDown = (event) => {
291
- if (event.target instanceof Node && rootRef.current?.contains(event.target) === true) return;
292
- setOpen(false);
293
- };
294
- const onKeyDown = (event) => {
295
- if (event.key === "Escape") setOpen(false);
296
- };
297
- document.addEventListener("pointerdown", onPointerDown);
298
- document.addEventListener("keydown", onKeyDown);
299
- return () => {
300
- document.removeEventListener("pointerdown", onPointerDown);
301
- document.removeEventListener("keydown", onKeyDown);
302
- };
303
- }, [open]);
304
- if (!isCodexPresetId(agentPreset)) return null;
305
- return (0, react_jsx_runtime.jsxs)("span", {
306
- ref: rootRef,
307
- style: {
308
- position: "relative",
309
- display: "inline-flex",
310
- alignItems: "center"
311
- },
312
- children: [(0, react_jsx_runtime.jsxs)("button", {
313
- type: "button",
314
- "aria-label": `${t("contextSize")}: ${valueK}K`,
315
- "aria-haspopup": "dialog",
316
- "aria-expanded": open,
317
- disabled: snapshot.writable === false,
318
- title: t("contextSize"),
319
- onMouseDown: (event) => {
320
- event.preventDefault();
321
- },
322
- onClick: () => {
323
- setOpen((value) => !value);
324
- },
325
- style: {
326
- boxSizing: "border-box",
327
- display: "inline-flex",
328
- alignItems: "center",
329
- gap: 3,
330
- height: 28,
331
- border: 0,
332
- borderRadius: 7,
333
- padding: "0 6px",
334
- color: configured === void 0 ? "var(--dsw-alias-label-secondary)" : "var(--dsw-static-blue-500)",
335
- background: open ? "var(--dsw-alias-interactive-bg-hover)" : "transparent",
336
- cursor: snapshot.writable === false ? "default" : "pointer",
337
- font: "inherit",
338
- fontSize: 12,
339
- lineHeight: "20px",
340
- fontWeight: configured === void 0 ? 400 : 600,
341
- whiteSpace: "nowrap"
342
- },
343
- children: [(0, react_jsx_runtime.jsxs)("span", { children: [valueK, "K"] }), (0, react_jsx_runtime.jsx)("svg", {
344
- viewBox: "0 0 12 12",
345
- width: "12",
346
- height: "12",
347
- "aria-hidden": true,
348
- children: (0, react_jsx_runtime.jsx)("path", {
349
- d: "M3 4.5 6 7.5 9 4.5",
350
- fill: "none",
351
- stroke: "currentColor",
352
- strokeWidth: "1.25",
353
- strokeLinecap: "round",
354
- strokeLinejoin: "round"
355
- })
356
- })]
357
- }), open && (0, react_jsx_runtime.jsx)("div", {
358
- role: "dialog",
359
- "aria-label": t("contextSize"),
360
- style: {
361
- position: "absolute",
362
- right: 0,
363
- bottom: "calc(100% + 8px)",
364
- zIndex: 20,
365
- boxSizing: "border-box",
366
- width: 300,
367
- maxWidth: "calc(100vw - 24px)",
368
- padding: "10px 12px 12px",
369
- border: "1px solid var(--dsw-alias-border-l2)",
370
- borderRadius: 10,
371
- color: "var(--dsw-alias-label-primary)",
372
- background: "var(--dsw-alias-bg-base)",
373
- boxShadow: "var(--dsw-shadow-lv2)"
374
- },
375
- children: (0, react_jsx_runtime.jsx)(ContextSizeControl, {
376
- contextWindow,
377
- useSettings,
378
- setSetting,
379
- unsetSetting,
380
- t
381
- })
382
- })]
383
- });
384
- }
385
284
  function elapsedSeconds(startedAt, now) {
386
285
  return Math.max(0, Math.floor((now - startedAt) / 1e3));
387
286
  }
@@ -410,18 +309,19 @@ window.__ModuleLoader__.load({
410
309
  if (!isCodexPresetId(agentPreset) || activity === void 0 || activity === null) return null;
411
310
  const label = activity.activity === "compaction" ? t("activityCompacting") : activity.activity === "model-reply" ? t("activityModelReply") : t("activityRequestingModel");
412
311
  return (0, react_jsx_runtime.jsxs)("span", {
413
- id: "codex-activity",
414
- role: "status",
312
+ "data-codex-activity": true,
415
313
  "aria-live": "polite",
416
314
  style: {
417
315
  display: "inline-flex",
418
316
  alignItems: "center",
419
317
  gap: 7,
420
318
  minHeight: 26,
319
+ marginLeft: 10,
421
320
  color: "var(--dsw-alias-label-secondary)",
422
321
  fontSize: 12,
423
322
  lineHeight: "20px",
424
- whiteSpace: "nowrap"
323
+ whiteSpace: "nowrap",
324
+ WebkitTextFillColor: "currentColor"
425
325
  },
426
326
  children: [
427
327
  (0, react_jsx_runtime.jsx)("span", {
@@ -439,7 +339,8 @@ window.__ModuleLoader__.load({
439
339
  (0, react_jsx_runtime.jsxs)("span", {
440
340
  style: { color: "var(--dsw-alias-label-tertiary)" },
441
341
  children: [
442
- "· ",
342
+ "·",
343
+ " ",
443
344
  elapsedSeconds(activity.startedAt, now),
444
345
  "s"
445
346
  ]
@@ -447,18 +348,69 @@ window.__ModuleLoader__.load({
447
348
  ]
448
349
  });
449
350
  }
450
- /** Keep the activity status and context control in one compact composer row. */
451
- function ActivityDock(props) {
452
- return (0, react_jsx_runtime.jsxs)("div", {
453
- style: {
454
- display: "flex",
455
- alignItems: "center",
456
- gap: 8,
457
- minHeight: 28,
458
- padding: "4px 10px"
459
- },
460
- children: [(0, react_jsx_runtime.jsx)(ContextSizeDock, { ...props }), (0, react_jsx_runtime.jsx)(ActivityLine, { ...props })]
351
+ function findContextMeterDialog() {
352
+ const buttons = document.querySelectorAll("button[aria-haspopup=\"dialog\"][aria-expanded=\"true\"]");
353
+ for (const button of buttons) {
354
+ if (button.querySelectorAll("circle").length < 2) continue;
355
+ let ancestor = button;
356
+ for (let depth = 0; ancestor !== null && depth < 5; depth += 1, ancestor = ancestor.parentElement) {
357
+ const dialog = ancestor.querySelector("[role=\"dialog\"]");
358
+ if (dialog !== null) return dialog;
359
+ }
360
+ }
361
+ return null;
362
+ }
363
+ function findTurnStatus() {
364
+ for (const status of document.querySelectorAll("[role=\"status\"]")) if (status.textContent?.includes("Deep diving...") === true && status.closest("[data-chat-flow]") !== null) return status;
365
+ return null;
366
+ }
367
+ function useLegacyHostTargets() {
368
+ const [targets, setTargets] = (0, react.useState)({
369
+ contextDialog: null,
370
+ turnStatus: null
461
371
  });
372
+ (0, react.useEffect)(() => {
373
+ if (typeof document === "undefined" || document.body === null) return void 0;
374
+ const refresh = () => {
375
+ const next = {
376
+ contextDialog: findContextMeterDialog(),
377
+ turnStatus: findTurnStatus()
378
+ };
379
+ setTargets((current) => current.contextDialog === next.contextDialog && current.turnStatus === next.turnStatus ? current : next);
380
+ };
381
+ refresh();
382
+ const observer = new MutationObserver(refresh);
383
+ observer.observe(document.body, {
384
+ subtree: true,
385
+ childList: true,
386
+ attributes: true,
387
+ attributeFilter: ["aria-expanded"]
388
+ });
389
+ return () => observer.disconnect();
390
+ }, []);
391
+ return targets;
392
+ }
393
+ /** Bridges plugin UI into DOM sites rendered by the legacy conversation host. */
394
+ function LegacyOverlay(props) {
395
+ const { sessionId, useSession, useSessions, useProjection, useSettings, setSetting, unsetSetting, t } = props;
396
+ const { contextDialog, turnStatus } = useLegacyHostTargets();
397
+ const contextWindow = contextWindowFromProjection(useProjection);
398
+ if (!isCodexPresetId(useSessions((state) => state.byId[sessionId]?.agentPreset))) return null;
399
+ return (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [contextDialog !== null && (0, react_dom.createPortal)((0, react_jsx_runtime.jsx)(ContextSizeControl, {
400
+ contextWindow,
401
+ sessionId,
402
+ useSessions,
403
+ useSettings,
404
+ setSetting,
405
+ unsetSetting,
406
+ t
407
+ }), contextDialog, "codex-context-size"), turnStatus !== null && (0, react_dom.createPortal)((0, react_jsx_runtime.jsx)(ActivityLine, {
408
+ sessionId,
409
+ useSession,
410
+ useSessions,
411
+ useProjection,
412
+ t
413
+ }), turnStatus, "codex-activity")] });
462
414
  }
463
415
  const inject = [
464
416
  "slots",
@@ -484,13 +436,13 @@ window.__ModuleLoader__.load({
484
436
  locale: NS,
485
437
  inject: injected
486
438
  }, FastModeFallback));
487
- ctx.slots.inject(ACTIVITY_FALLBACK_SLOT, () => ctx.slots.register({
488
- name: ACTIVITY_FALLBACK_SLOT,
489
- id: "codex-activity",
490
- order: 5,
439
+ ctx.slots.inject(LEGACY_OVERLAY_SLOT, () => ctx.slots.register({
440
+ name: LEGACY_OVERLAY_SLOT,
441
+ id: "codex-legacy-overlay",
442
+ order: 0,
491
443
  locale: NS,
492
444
  inject: injected
493
- }, ActivityDock));
445
+ }, LegacyOverlay));
494
446
  }
495
447
  var client_default = {
496
448
  inject,
package/lib/index.js CHANGED
@@ -1284,7 +1284,7 @@ const CODEX_BASE_PROMPT = String.raw`## General
1284
1284
  `;
1285
1285
  const CODEX_COLLABORATION_PROMPT = String.raw`## Collaboration
1286
1286
 
1287
- - Gather enough context from the user then achieve the user's goal through the clearest, most effective path.
1287
+ - Ask, align, and clarify first. Gather enough context from the user then achieve the user's goal through the clearest, most effective path.
1288
1288
  - Keep only the essential logic and core actions. There's no need to explain or test what was removed or why something wasn't done.
1289
1289
  - Convey enough valuable information with as few words as possible. Stay focused on the end goal.
1290
1290
  - Solve problems by thinking from first principles and at a higher level.
@@ -2,6 +2,7 @@
2
2
  import type { HostObservable, InjectFace, PropsLocale, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots';
3
3
  import type { Context } from '@deepseek-ai/cordis';
4
4
  import type { SettingsScope } from '@deepseek-ai/dsh-client-runtime/client';
5
+ declare const LEGACY_OVERLAY_SLOT: "conversation.input.overlay";
5
6
  interface CodexSettings {
6
7
  fast: boolean;
7
8
  contextWindow?: number;
@@ -25,6 +26,13 @@ declare module '@deepseek-ai/dsh-client-ui-slots' {
25
26
  interface LocaleNamespaceMap {
26
27
  codex: CodexKey;
27
28
  }
29
+ interface SlotMap {
30
+ 'conversation.input.overlay': {
31
+ kind: 'list';
32
+ scope: 'session';
33
+ owner: Record<never, never>;
34
+ };
35
+ }
28
36
  }
29
37
  interface InputSettingsControlInjected {
30
38
  hooks: {
@@ -33,9 +41,8 @@ interface InputSettingsControlInjected {
33
41
  setSetting: (field: string, value: unknown) => Promise<void>;
34
42
  unsetSetting: (field: string) => Promise<void>;
35
43
  }
36
- type ContextDockProps = PropsRuntime<'conversation.composer.dock'> & InjectFace<InputSettingsControlInjected> & PropsLocale<'codex'>;
37
- type ActivityDockProps = ContextDockProps & PropsLocale<'codex'>;
38
- type ActivityProps = ActivityDockProps;
44
+ type LegacyOverlayProps = PropsRuntime<typeof LEGACY_OVERLAY_SLOT> & InjectFace<InputSettingsControlInjected> & PropsLocale<'codex'>;
45
+ type ActivityProps = Pick<LegacyOverlayProps, 'sessionId' | 'useSession' | 'useSessions' | 'useProjection' | 't'>;
39
46
  export declare function ActivityLine({ sessionId, useSession, useSessions, useProjection, t }: ActivityProps): import("react").JSX.Element | null;
40
47
  export declare const inject: string[];
41
48
  /** Mount all controls through the official composer seats shared by every DSH release. */
@@ -1,12 +1,13 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  /** Browser controls for the Codex request settings mounted by the Host plugin. */
3
- import { useEffect, useRef, useState } from 'react';
3
+ import { useEffect, useState } from 'react';
4
+ import { createPortal } from 'react-dom';
4
5
  import { CODEX_CONTEXT_MAX, CODEX_CONTEXT_UNIT, isCodexPresetId } from "../context.js";
5
6
  import { modelActivity, sameModelActivity } from "./activity.js";
6
7
  const NS = 'codex';
7
8
  const SETTINGS_NAMESPACE = 'codex';
8
- const ACTIVITY_FALLBACK_SLOT = 'conversation.composer.dock';
9
9
  const FAST_FALLBACK_SLOT = 'conversation.input.right';
10
+ const LEGACY_OVERLAY_SLOT = 'conversation.input.overlay';
10
11
  const DEFAULT_CONTEXT_WINDOW = 262_144;
11
12
  const en = {
12
13
  fast: 'Fast mode',
@@ -25,14 +26,14 @@ const zh = {
25
26
  fast: 'Fast',
26
27
  fastOn: 'Fast mode on (priority tier)',
27
28
  fastOff: 'Fast mode off',
28
- fastStateOn: '开',
29
- fastStateOff: '关',
30
- contextSize: '上下文大小',
31
- contextSizeDescription: '设置下次请求的上下文容量,单位为 K tokens。',
32
- contextRestore: '恢复模型默认值',
33
- activityCompacting: '正在压缩上下文...',
34
- activityRequestingModel: '请求中...',
35
- activityModelReply: '回复中...',
29
+ fastStateOn: '\u5f00',
30
+ fastStateOff: '\u5173',
31
+ contextSize: '\u4e0a\u4e0b\u6587\u5927\u5c0f',
32
+ contextSizeDescription: '\u8bbe\u7f6e\u4e0b\u6b21\u8bf7\u6c42\u7684\u4e0a\u4e0b\u6587\u5bb9\u91cf\uff0c\u5355\u4f4d\u4e3a K tokens\u3002',
33
+ contextRestore: '\u6062\u590d\u6a21\u578b\u9ed8\u8ba4\u503c',
34
+ activityCompacting: '\u6b63\u5728\u538b\u7f29\u4e0a\u4e0b\u6587...',
35
+ activityRequestingModel: '\u8bf7\u6c42\u4e2d...',
36
+ activityModelReply: '\u56de\u590d\u4e2d...',
36
37
  };
37
38
  /** The legacy composer seat is a compact inline row, not a menu panel. */
38
39
  function FastModeFallback(props) {
@@ -67,9 +68,12 @@ function contextWindowFromProjection(useProjection) {
67
68
  ? pressure.contextWindow
68
69
  : DEFAULT_CONTEXT_WINDOW;
69
70
  }
70
- /** Settings form kept inside the official composer slot's popover. */
71
- function ContextSizeControl({ contextWindow, useSettings, setSetting, unsetSetting, t, }) {
71
+ /** Settings form appended to the old host's context meter panel. */
72
+ function ContextSizeControl({ contextWindow, sessionId, useSessions, useSettings, setSetting, unsetSetting, t, }) {
73
+ const agentPreset = useSessions(state => state.byId[sessionId]?.agentPreset);
72
74
  const snapshot = useSettings(state => state);
75
+ if (!isCodexPresetId(agentPreset))
76
+ return null;
73
77
  const configured = snapshot.value?.contextWindow;
74
78
  const maxK = CODEX_CONTEXT_MAX / CODEX_CONTEXT_UNIT;
75
79
  const valueK = Math.min(maxK, Math.max(1, Math.round((configured ?? contextWindow) / CODEX_CONTEXT_UNIT)));
@@ -83,7 +87,13 @@ function ContextSizeControl({ contextWindow, useSettings, setSetting, unsetSetti
83
87
  else
84
88
  void setSetting('contextWindow', normalized);
85
89
  };
86
- return (_jsxs("div", { style: { marginTop: 0, display: 'grid', gap: 8 }, children: [_jsxs("div", { style: { display: 'flex', alignItems: 'baseline', justifyContent: 'space-between', gap: 12 }, children: [_jsx("strong", { style: { color: 'var(--dsw-alias-label-primary)', fontSize: 13 }, children: t('contextSize') }), _jsxs("span", { style: { color: 'var(--dsw-alias-label-secondary)', fontSize: 12, fontVariantNumeric: 'tabular-nums' }, children: [valueK, "K"] })] }), _jsx("input", { type: "range", min: 1, max: maxK, step: 1, value: valueK, disabled: snapshot.writable === false, "aria-label": t('contextSize'), onChange: event => { setValueK(Number(event.target.value)); }, style: {
90
+ return (_jsxs("div", { style: {
91
+ display: 'grid',
92
+ gap: 8,
93
+ marginTop: 10,
94
+ paddingTop: 10,
95
+ borderTop: '1px solid var(--dsw-alias-border-l2)',
96
+ }, children: [_jsxs("div", { style: { display: 'flex', alignItems: 'baseline', justifyContent: 'space-between', gap: 12 }, children: [_jsx("strong", { style: { color: 'var(--dsw-alias-label-primary)', fontSize: 13 }, children: t('contextSize') }), _jsxs("span", { style: { color: 'var(--dsw-alias-label-secondary)', fontSize: 12, fontVariantNumeric: 'tabular-nums' }, children: [valueK, "K"] })] }), _jsx("input", { type: "range", min: 1, max: maxK, step: 1, value: valueK, disabled: snapshot.writable === false, "aria-label": t('contextSize'), onChange: event => { setValueK(Number(event.target.value)); }, style: {
87
97
  display: 'block',
88
98
  width: '100%',
89
99
  accentColor: 'var(--dsw-static-blue-500)',
@@ -108,71 +118,6 @@ function ContextSizeControl({ contextWindow, useSettings, setSetting, unsetSetti
108
118
  fontSize: 11,
109
119
  }, children: t('contextRestore') }))] }));
110
120
  }
111
- /** Compact context-capacity trigger shown beside the bottom activity line. */
112
- function ContextSizeDock({ sessionId, useSessions, useProjection, useSettings, setSetting, unsetSetting, t }) {
113
- const agentPreset = useSessions(state => state.byId[sessionId]?.agentPreset);
114
- const contextWindow = contextWindowFromProjection(useProjection);
115
- const snapshot = useSettings(state => state);
116
- const configured = snapshot.value?.contextWindow;
117
- const valueK = Math.min(CODEX_CONTEXT_MAX / CODEX_CONTEXT_UNIT, Math.max(1, Math.round((configured ?? contextWindow) / CODEX_CONTEXT_UNIT)));
118
- const [open, setOpen] = useState(false);
119
- const rootRef = useRef(null);
120
- useEffect(() => {
121
- if (!open)
122
- return undefined;
123
- const onPointerDown = (event) => {
124
- if (event.target instanceof Node && rootRef.current?.contains(event.target) === true)
125
- return;
126
- setOpen(false);
127
- };
128
- const onKeyDown = (event) => {
129
- if (event.key === 'Escape')
130
- setOpen(false);
131
- };
132
- document.addEventListener('pointerdown', onPointerDown);
133
- document.addEventListener('keydown', onKeyDown);
134
- return () => {
135
- document.removeEventListener('pointerdown', onPointerDown);
136
- document.removeEventListener('keydown', onKeyDown);
137
- };
138
- }, [open]);
139
- if (!isCodexPresetId(agentPreset))
140
- return null;
141
- return (_jsxs("span", { ref: rootRef, style: { position: 'relative', display: 'inline-flex', alignItems: 'center' }, children: [_jsxs("button", { type: "button", "aria-label": `${t('contextSize')}: ${valueK}K`, "aria-haspopup": "dialog", "aria-expanded": open, disabled: snapshot.writable === false, title: t('contextSize'), onMouseDown: event => { event.preventDefault(); }, onClick: () => { setOpen(value => !value); }, style: {
142
- boxSizing: 'border-box',
143
- display: 'inline-flex',
144
- alignItems: 'center',
145
- gap: 3,
146
- height: 28,
147
- border: 0,
148
- borderRadius: 7,
149
- padding: '0 6px',
150
- color: configured === undefined
151
- ? 'var(--dsw-alias-label-secondary)'
152
- : 'var(--dsw-static-blue-500)',
153
- background: open ? 'var(--dsw-alias-interactive-bg-hover)' : 'transparent',
154
- cursor: snapshot.writable === false ? 'default' : 'pointer',
155
- font: 'inherit',
156
- fontSize: 12,
157
- lineHeight: '20px',
158
- fontWeight: configured === undefined ? 400 : 600,
159
- whiteSpace: 'nowrap',
160
- }, children: [_jsxs("span", { children: [valueK, "K"] }), _jsx("svg", { viewBox: "0 0 12 12", width: "12", height: "12", "aria-hidden": true, children: _jsx("path", { d: "M3 4.5 6 7.5 9 4.5", fill: "none", stroke: "currentColor", strokeWidth: "1.25", strokeLinecap: "round", strokeLinejoin: "round" }) })] }), open && (_jsx("div", { role: "dialog", "aria-label": t('contextSize'), style: {
161
- position: 'absolute',
162
- right: 0,
163
- bottom: 'calc(100% + 8px)',
164
- zIndex: 20,
165
- boxSizing: 'border-box',
166
- width: 300,
167
- maxWidth: 'calc(100vw - 24px)',
168
- padding: '10px 12px 12px',
169
- border: '1px solid var(--dsw-alias-border-l2)',
170
- borderRadius: 10,
171
- color: 'var(--dsw-alias-label-primary)',
172
- background: 'var(--dsw-alias-bg-base)',
173
- boxShadow: 'var(--dsw-shadow-lv2)',
174
- }, children: _jsx(ContextSizeControl, { contextWindow: contextWindow, useSettings: useSettings, setSetting: setSetting, unsetSetting: unsetSetting, t: t }) }))] }));
175
- }
176
121
  function elapsedSeconds(startedAt, now) {
177
122
  return Math.max(0, Math.floor((now - startedAt) / 1_000));
178
123
  }
@@ -211,15 +156,17 @@ export function ActivityLine({ sessionId, useSession, useSessions, useProjection
211
156
  : activity.activity === 'model-reply'
212
157
  ? t('activityModelReply')
213
158
  : t('activityRequestingModel');
214
- return (_jsxs("span", { id: "codex-activity", role: "status", "aria-live": "polite", style: {
159
+ return (_jsxs("span", { "data-codex-activity": true, "aria-live": "polite", style: {
215
160
  display: 'inline-flex',
216
161
  alignItems: 'center',
217
162
  gap: 7,
218
163
  minHeight: 26,
164
+ marginLeft: 10,
219
165
  color: 'var(--dsw-alias-label-secondary)',
220
166
  fontSize: 12,
221
167
  lineHeight: '20px',
222
168
  whiteSpace: 'nowrap',
169
+ WebkitTextFillColor: 'currentColor',
223
170
  }, children: [_jsx("span", { "aria-hidden": "true", style: {
224
171
  width: 5,
225
172
  height: 5,
@@ -227,17 +174,64 @@ export function ActivityLine({ sessionId, useSession, useSessions, useProjection
227
174
  borderRadius: '50%',
228
175
  background: 'var(--dsw-static-blue-500)',
229
176
  opacity: 0.55,
230
- } }), _jsx("span", { children: label }), _jsxs("span", { style: { color: 'var(--dsw-alias-label-tertiary)' }, children: ["\u00B7 ", elapsedSeconds(activity.startedAt, now), "s"] })] }));
177
+ } }), _jsx("span", { children: label }), _jsxs("span", { style: { color: 'var(--dsw-alias-label-tertiary)' }, children: ['\u00b7', " ", elapsedSeconds(activity.startedAt, now), "s"] })] }));
231
178
  }
232
- /** Keep the activity status and context control in one compact composer row. */
233
- function ActivityDock(props) {
234
- return (_jsxs("div", { style: {
235
- display: 'flex',
236
- alignItems: 'center',
237
- gap: 8,
238
- minHeight: 28,
239
- padding: '4px 10px',
240
- }, children: [_jsx(ContextSizeDock, { ...props }), _jsx(ActivityLine, { ...props })] }));
179
+ function findContextMeterDialog() {
180
+ const buttons = document.querySelectorAll('button[aria-haspopup="dialog"][aria-expanded="true"]');
181
+ for (const button of buttons) {
182
+ if (button.querySelectorAll('circle').length < 2)
183
+ continue;
184
+ let ancestor = button;
185
+ for (let depth = 0; ancestor !== null && depth < 5; depth += 1, ancestor = ancestor.parentElement) {
186
+ const dialog = ancestor.querySelector('[role="dialog"]');
187
+ if (dialog !== null)
188
+ return dialog;
189
+ }
190
+ }
191
+ return null;
192
+ }
193
+ function findTurnStatus() {
194
+ for (const status of document.querySelectorAll('[role="status"]')) {
195
+ if (status.textContent?.includes('Deep diving...') === true
196
+ && status.closest('[data-chat-flow]') !== null)
197
+ return status;
198
+ }
199
+ return null;
200
+ }
201
+ function useLegacyHostTargets() {
202
+ const [targets, setTargets] = useState({ contextDialog: null, turnStatus: null });
203
+ useEffect(() => {
204
+ if (typeof document === 'undefined' || document.body === null)
205
+ return undefined;
206
+ const refresh = () => {
207
+ const next = {
208
+ contextDialog: findContextMeterDialog(),
209
+ turnStatus: findTurnStatus(),
210
+ };
211
+ setTargets(current => current.contextDialog === next.contextDialog
212
+ && current.turnStatus === next.turnStatus ? current : next);
213
+ };
214
+ refresh();
215
+ const observer = new MutationObserver(refresh);
216
+ observer.observe(document.body, {
217
+ subtree: true,
218
+ childList: true,
219
+ attributes: true,
220
+ attributeFilter: ['aria-expanded'],
221
+ });
222
+ return () => observer.disconnect();
223
+ }, []);
224
+ return targets;
225
+ }
226
+ /** Bridges plugin UI into DOM sites rendered by the legacy conversation host. */
227
+ function LegacyOverlay(props) {
228
+ const { sessionId, useSession, useSessions, useProjection, useSettings, setSetting, unsetSetting, t, } = props;
229
+ const { contextDialog, turnStatus } = useLegacyHostTargets();
230
+ const contextWindow = contextWindowFromProjection(useProjection);
231
+ const agentPreset = useSessions(state => state.byId[sessionId]?.agentPreset);
232
+ if (!isCodexPresetId(agentPreset))
233
+ return null;
234
+ return (_jsxs(_Fragment, { children: [contextDialog !== null && createPortal(_jsx(ContextSizeControl, { contextWindow: contextWindow, sessionId: sessionId, useSessions: useSessions, useSettings: useSettings, setSetting: setSetting, unsetSetting: unsetSetting, t: t }), contextDialog, 'codex-context-size'), turnStatus !== null && createPortal(_jsx(ActivityLine, { sessionId: sessionId, useSession: useSession, useSessions: useSessions, useProjection: useProjection, t: t }), turnStatus, 'codex-activity')] }));
241
235
  }
242
236
  export const inject = ['slots', 'locale', 'settingsScope'];
243
237
  /** Mount all controls through the official composer seats shared by every DSH release. */
@@ -256,13 +250,13 @@ export function apply(ctx) {
256
250
  locale: NS,
257
251
  inject: injected,
258
252
  }, FastModeFallback));
259
- ctx.slots.inject(ACTIVITY_FALLBACK_SLOT, () => ctx.slots.register({
260
- name: ACTIVITY_FALLBACK_SLOT,
261
- id: 'codex-activity',
262
- order: 5,
253
+ ctx.slots.inject(LEGACY_OVERLAY_SLOT, () => ctx.slots.register({
254
+ name: LEGACY_OVERLAY_SLOT,
255
+ id: 'codex-legacy-overlay',
256
+ order: 0,
263
257
  locale: NS,
264
258
  inject: injected,
265
- }, ActivityDock));
259
+ }, LegacyOverlay));
266
260
  }
267
261
  export default { inject, apply };
268
262
  //# sourceMappingURL=index.js.map
@@ -26,7 +26,7 @@ export interface Config {
26
26
  /** Runtime configuration schema for the Codex tool bridge. */
27
27
  export declare const Config: z<Config>;
28
28
  /** Live Codex-only request controls shared by the Web controls and agent layer. */
29
- export declare const CODEX_SETTINGS_NAMESPACE: import("@deepseek-ai/dsh-settings").SettingsNamespace;
29
+ export declare const CODEX_SETTINGS_NAMESPACE: Branded<"SettingsNamespace">;
30
30
  export interface CodexSettings {
31
31
  /** Use the Responses priority service tier for GPT requests. */
32
32
  fast: boolean;
@@ -227,7 +227,7 @@ const CODEX_BASE_PROMPT = String.raw `## General
227
227
  `;
228
228
  const CODEX_COLLABORATION_PROMPT = String.raw `## Collaboration
229
229
 
230
- - Gather enough context from the user then achieve the user's goal through the clearest, most effective path.
230
+ - Ask, align, and clarify first. Gather enough context from the user then achieve the user's goal through the clearest, most effective path.
231
231
  - Keep only the essential logic and core actions. There's no need to explain or test what was removed or why something wasn't done.
232
232
  - Convey enough valuable information with as few words as possible. Stay focused on the end goal.
233
233
  - Solve problems by thinking from first principles and at a higher level.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shuind/dsh-codex-harness",
3
- "version": "0.1.31",
3
+ "version": "0.1.33",
4
4
  "description": "A Codex harness with a streamlined system prompt for GPT models that do not fit DSH's native interface, while remaining compatible with the DSH plugin ecosystem.",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
@@ -45,13 +45,6 @@
45
45
  "README.zh.md",
46
46
  "LICENSE"
47
47
  ],
48
- "scripts": {
49
- "build": "tsc --noCheck -p tsconfig.json && tsdown",
50
- "check": "tsc -p tsconfig.json --noEmit",
51
- "test": "vitest run",
52
- "pack:check": "npm pack --dry-run",
53
- "prepare": "npm run build"
54
- },
55
48
  "repository": {
56
49
  "type": "git",
57
50
  "url": "git+https://github.com/shuind/dsh-codex-harness.git"
@@ -232,10 +225,18 @@
232
225
  "@deepseek-ai/dsh-tools": "0.1.0-rc.6",
233
226
  "@types/node": "^22.20.0",
234
227
  "@types/react": "~18.3.1",
228
+ "@types/react-dom": "~18.3.0",
235
229
  "react": "^18.3.1",
230
+ "react-dom": "^18.3.1",
236
231
  "tsdown": "^0.22.2",
237
232
  "typescript": "^6.0.3",
238
233
  "unrun": "^0.3.1",
239
234
  "vitest": "^4.1.8"
235
+ },
236
+ "scripts": {
237
+ "build": "tsc --noCheck -p tsconfig.json && tsdown",
238
+ "check": "tsc -p tsconfig.json --noEmit",
239
+ "test": "vitest run",
240
+ "pack:check": "npm pack --dry-run"
240
241
  }
241
- }
242
+ }