@shuind/dsh-codex-harness 0.2.13 → 0.2.15

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
@@ -14,11 +14,25 @@
14
14
  ## 安装
15
15
 
16
16
  ```sh
17
- dsh plugin --profile web add @shuind/dsh-codex-harness@0.2.1
17
+ dsh plugin --profile web add @shuind/dsh-codex-harness@latest
18
18
  ```
19
19
 
20
20
  重启 Web,在 **Agent 预设** 中选择 **Codex 模式**,再创建会话。
21
21
 
22
+ ### 宿主版本
23
+
24
+ Codex 模式使用 `@deepseek-ai/dsh-persona` 的 `prefix` 配置。宿主必须提供
25
+ `@deepseek-ai/dsh-persona >=0.1.3-alpha.2`;当前的 DSH `0.1.5-rc.2` 满足此要求。
26
+ 更早的 persona 版本只接受 `text`,会在加载预设时报告缺少 `prefix`。
27
+
28
+ ### 已有自定义预设
29
+
30
+ 插件会自动更新未修改过且带有本插件管理标记的旧预设。包含用户修改的预设会保留,
31
+ 需要手动迁移:先备份 `$DSH_HOME/.agent-presets/codex-collaboration`,再打开其中的
32
+ `agent.cordis.yml`,将 `@deepseek-ai/dsh-persona` 配置下的 `text:` 改为 `prefix:`,
33
+ 保留后面的提示词内容,然后重启 DSH 并重新选择 Codex 模式。若预设没有该管理标记,
34
+ 也应按同样步骤迁移;不要覆盖已有的自定义提示词。
35
+
22
36
  ## 配置
23
37
 
24
38
  ### 模型
package/lib/client.js CHANGED
@@ -1220,13 +1220,57 @@ window.__ModuleLoader__.load({
1220
1220
  const preferred = statuses.filter(isTurnStatus);
1221
1221
  return preferred.findLast(hasLayout) ?? preferred.at(-1) ?? statuses.filter((status) => status.closest("[data-chat-flow]") !== null).findLast(hasLayout) ?? statuses.filter((status) => status.closest("[data-chat-flow]") !== null).at(-1) ?? null;
1222
1222
  }
1223
+ function findTurnStatus() {
1224
+ return selectTurnStatus([...document.querySelectorAll("[role=\"status\"]")]);
1225
+ }
1226
+ function useTurnStatusPosition(target) {
1227
+ const [position, setPosition] = (0, react.useState)(null);
1228
+ (0, react.useLayoutEffect)(() => {
1229
+ if (target === null) {
1230
+ setPosition(null);
1231
+ return;
1232
+ }
1233
+ const update = () => {
1234
+ if (!target.isConnected) {
1235
+ setPosition(null);
1236
+ return;
1237
+ }
1238
+ const rect = target.getBoundingClientRect();
1239
+ if (rect.width === 0 && rect.height === 0) {
1240
+ setPosition(null);
1241
+ return;
1242
+ }
1243
+ setPosition({
1244
+ left: Math.round(rect.right + 10),
1245
+ top: Math.round(rect.top + (rect.height - 26) / 2)
1246
+ });
1247
+ };
1248
+ update();
1249
+ window.addEventListener("resize", update);
1250
+ window.addEventListener("scroll", update, true);
1251
+ const observer = typeof ResizeObserver === "undefined" ? void 0 : new ResizeObserver(update);
1252
+ observer?.observe(target);
1253
+ return () => {
1254
+ window.removeEventListener("resize", update);
1255
+ window.removeEventListener("scroll", update, true);
1256
+ observer?.disconnect();
1257
+ };
1258
+ }, [target]);
1259
+ return position;
1260
+ }
1223
1261
  function useLegacyHostTargets() {
1224
- const [targets, setTargets] = (0, react.useState)({ contextDialog: null });
1262
+ const [targets, setTargets] = (0, react.useState)({
1263
+ contextDialog: null,
1264
+ turnStatus: null
1265
+ });
1225
1266
  (0, react.useEffect)(() => {
1226
1267
  if (typeof document === "undefined" || document.body === null) return void 0;
1227
1268
  const refresh = () => {
1228
- const next = { contextDialog: findContextMeterDialog() };
1229
- setTargets((current) => current.contextDialog === next.contextDialog ? current : next);
1269
+ const next = {
1270
+ contextDialog: findContextMeterDialog(),
1271
+ turnStatus: findTurnStatus()
1272
+ };
1273
+ setTargets((current) => current.contextDialog === next.contextDialog && current.turnStatus === next.turnStatus ? current : next);
1230
1274
  };
1231
1275
  refresh();
1232
1276
  const observer = new MutationObserver(refresh);
@@ -1242,10 +1286,11 @@ window.__ModuleLoader__.load({
1242
1286
  }
1243
1287
  /** Bridges plugin UI into DOM sites rendered by the legacy conversation host. */
1244
1288
  function LegacyOverlay(props) {
1245
- const { sessionId, useSessions, useProjection, useSettings, setSetting, unsetSetting, t } = props;
1246
- const { contextDialog } = useLegacyHostTargets();
1289
+ const { sessionId, useSession, useSessions, useProjection, useSettings, setSetting, unsetSetting, t } = props;
1290
+ const { contextDialog, turnStatus } = useLegacyHostTargets();
1291
+ const turnStatusPosition = useTurnStatusPosition(turnStatus);
1247
1292
  const contextWindow = contextWindowFromProjection(useProjection);
1248
- return (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: contextDialog !== null && (0, react_dom.createPortal)((0, react_jsx_runtime.jsx)(ContextSizeControl, {
1293
+ return (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [contextDialog !== null && (0, react_dom.createPortal)((0, react_jsx_runtime.jsx)(ContextSizeControl, {
1249
1294
  contextWindow,
1250
1295
  sessionId,
1251
1296
  useSessions,
@@ -1253,19 +1298,15 @@ window.__ModuleLoader__.load({
1253
1298
  setSetting,
1254
1299
  unsetSetting,
1255
1300
  t
1256
- }), contextDialog, "codex-context-size") });
1257
- }
1258
- /** Stable composer fallback for hosts whose transient turn-status node is absent. */
1259
- function ActivityDock(props) {
1260
- return (0, react_jsx_runtime.jsx)("div", {
1261
- style: {
1262
- display: "flex",
1263
- alignItems: "center",
1264
- minHeight: 28,
1265
- padding: "4px 10px"
1266
- },
1267
- children: (0, react_jsx_runtime.jsx)(ActivityLine, { ...props })
1268
- });
1301
+ }), contextDialog, "codex-context-size"), turnStatusPosition !== null && typeof document !== "undefined" && document.body !== null && (0, react_dom.createPortal)((0, react_jsx_runtime.jsx)(ActivityLine, {
1302
+ sessionId,
1303
+ useSession,
1304
+ useSessions,
1305
+ useProjection,
1306
+ useSettings,
1307
+ t,
1308
+ position: turnStatusPosition
1309
+ }), document.body, "codex-activity")] });
1269
1310
  }
1270
1311
  const inject = [
1271
1312
  "commandUi",
@@ -1327,13 +1368,6 @@ window.__ModuleLoader__.load({
1327
1368
  locale: NS,
1328
1369
  inject: injected
1329
1370
  }, ContextSizeFallback));
1330
- ctx.slots.inject("conversation.composer.dock", () => ctx.slots.register({
1331
- name: "conversation.composer.dock",
1332
- id: "codex-activity-fallback",
1333
- order: 5,
1334
- locale: NS,
1335
- inject: injected
1336
- }, ActivityDock));
1337
1371
  ctx.slots.inject(LEGACY_OVERLAY_SLOT, () => ctx.slots.register({
1338
1372
  name: LEGACY_OVERLAY_SLOT,
1339
1373
  id: "codex-legacy-overlay",
@@ -86,7 +86,6 @@ declare module '@deepseek-ai/dsh-client-ui-slots' {
86
86
  'conversation.input.overlay': {
87
87
  kind: 'list';
88
88
  scope: 'session';
89
- owner: Record<never, never>;
90
89
  };
91
90
  'settings.plugin.item': {
92
91
  kind: 'keyed';
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  /** Browser controls for Codex requests and the editable operating prompt. */
3
- import { useEffect, useRef, useState } from 'react';
3
+ import { useEffect, useLayoutEffect, useRef, useState } from 'react';
4
4
  import { createPortal } from 'react-dom';
5
5
  import { CODEX_CONTEXT_MAX, CODEX_CONTEXT_UNIT, isCodexPresetId } from "../context.js";
6
6
  import { DEFAULT_CODEX_PERSONA, DEFAULT_CODEX_SYSTEM_PROMPT, DEFAULT_DSH_CORE_SOURCE_PROMPT, DEFAULT_DSH_CORE_WEB_PROMPT, } from "../prompt.js";
@@ -602,14 +602,56 @@ export function selectTurnStatus(statuses) {
602
602
  ?? statuses.filter(status => status.closest('[data-chat-flow]') !== null).at(-1)
603
603
  ?? null;
604
604
  }
605
+ function findTurnStatus() {
606
+ return selectTurnStatus([...document.querySelectorAll('[role="status"]')]);
607
+ }
608
+ function useTurnStatusPosition(target) {
609
+ const [position, setPosition] = useState(null);
610
+ useLayoutEffect(() => {
611
+ if (target === null) {
612
+ setPosition(null);
613
+ return undefined;
614
+ }
615
+ const update = () => {
616
+ if (!target.isConnected) {
617
+ setPosition(null);
618
+ return;
619
+ }
620
+ const rect = target.getBoundingClientRect();
621
+ if (rect.width === 0 && rect.height === 0) {
622
+ setPosition(null);
623
+ return;
624
+ }
625
+ setPosition({
626
+ left: Math.round(rect.right + 10),
627
+ top: Math.round(rect.top + (rect.height - 26) / 2),
628
+ });
629
+ };
630
+ update();
631
+ window.addEventListener('resize', update);
632
+ window.addEventListener('scroll', update, true);
633
+ const observer = typeof ResizeObserver === 'undefined' ? undefined : new ResizeObserver(update);
634
+ observer?.observe(target);
635
+ return () => {
636
+ window.removeEventListener('resize', update);
637
+ window.removeEventListener('scroll', update, true);
638
+ observer?.disconnect();
639
+ };
640
+ }, [target]);
641
+ return position;
642
+ }
605
643
  function useLegacyHostTargets() {
606
- const [targets, setTargets] = useState({ contextDialog: null });
644
+ const [targets, setTargets] = useState({ contextDialog: null, turnStatus: null });
607
645
  useEffect(() => {
608
646
  if (typeof document === 'undefined' || document.body === null)
609
647
  return undefined;
610
648
  const refresh = () => {
611
- const next = { contextDialog: findContextMeterDialog() };
612
- setTargets(current => current.contextDialog === next.contextDialog ? current : next);
649
+ const next = {
650
+ contextDialog: findContextMeterDialog(),
651
+ turnStatus: findTurnStatus(),
652
+ };
653
+ setTargets(current => current.contextDialog === next.contextDialog
654
+ && current.turnStatus === next.turnStatus ? current : next);
613
655
  };
614
656
  refresh();
615
657
  const observer = new MutationObserver(refresh);
@@ -625,14 +667,11 @@ function useLegacyHostTargets() {
625
667
  }
626
668
  /** Bridges plugin UI into DOM sites rendered by the legacy conversation host. */
627
669
  function LegacyOverlay(props) {
628
- const { sessionId, useSessions, useProjection, useSettings, setSetting, unsetSetting, t, } = props;
629
- const { contextDialog } = useLegacyHostTargets();
670
+ const { sessionId, useSession, useSessions, useProjection, useSettings, setSetting, unsetSetting, t, } = props;
671
+ const { contextDialog, turnStatus } = useLegacyHostTargets();
672
+ const turnStatusPosition = useTurnStatusPosition(turnStatus);
630
673
  const contextWindow = contextWindowFromProjection(useProjection);
631
- return (_jsx(_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') }));
632
- }
633
- /** Stable composer fallback for hosts whose transient turn-status node is absent. */
634
- function ActivityDock(props) {
635
- return (_jsx("div", { style: { display: 'flex', alignItems: 'center', minHeight: 28, padding: '4px 10px' }, children: _jsx(ActivityLine, { ...props }) }));
674
+ 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'), turnStatusPosition !== null && typeof document !== 'undefined' && document.body !== null && createPortal(_jsx(ActivityLine, { sessionId: sessionId, useSession: useSession, useSessions: useSessions, useProjection: useProjection, useSettings: useSettings, t: t, position: turnStatusPosition }), document.body, 'codex-activity')] }));
636
675
  }
637
676
  export const inject = ['commandUi', 'sessions', 'slots', 'locale', 'settingsScope'];
638
677
  /** Mount request controls and the plugin settings card through shared slots. */
@@ -683,13 +722,6 @@ export function apply(ctx) {
683
722
  locale: NS,
684
723
  inject: injected,
685
724
  }, ContextSizeFallback));
686
- ctx.slots.inject('conversation.composer.dock', () => ctx.slots.register({
687
- name: 'conversation.composer.dock',
688
- id: 'codex-activity-fallback',
689
- order: 5,
690
- locale: NS,
691
- inject: injected,
692
- }, ActivityDock));
693
725
  ctx.slots.inject(LEGACY_OVERLAY_SLOT, () => ctx.slots.register({
694
726
  name: LEGACY_OVERLAY_SLOT,
695
727
  id: 'codex-legacy-overlay',
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@shuind/dsh-codex-harness",
3
- "version": "0.2.13",
3
+ "version": "0.2.15",
4
+ "packageManager": "pnpm@9.15.9",
4
5
  "description": "Codex coding preset with customizable prompts and tools for DSH.",
5
6
  "type": "module",
6
7
  "main": "lib/index.js",
@@ -108,6 +109,7 @@
108
109
  "@deepseek-ai/dsh-invariants": ">=0.0.1-rc.1",
109
110
  "@deepseek-ai/dsh-jobs": ">=0.1.0-rc.8",
110
111
  "@deepseek-ai/dsh-llm": ">=0.1.0-rc.8",
112
+ "@deepseek-ai/dsh-persona": ">=0.1.3-alpha.2",
111
113
  "@deepseek-ai/dsh-settings": ">=0.1.0-rc.8",
112
114
  "@deepseek-ai/dsh-sandbox": ">=0.0.1-rc.1",
113
115
  "@deepseek-ai/dsh-sandbox-policy": ">=0.0.1-rc.1",
@@ -177,6 +179,9 @@
177
179
  "@deepseek-ai/dsh-llm": {
178
180
  "optional": true
179
181
  },
182
+ "@deepseek-ai/dsh-persona": {
183
+ "optional": true
184
+ },
180
185
  "@deepseek-ai/dsh-settings": {
181
186
  "optional": true
182
187
  },
@@ -229,6 +234,7 @@
229
234
  "@deepseek-ai/dsh-client-ui-slots": "0.1.0-rc.8",
230
235
  "@deepseek-ai/dsh-compaction": "0.1.1-rc.2",
231
236
  "@deepseek-ai/dsh-compaction-basic": "0.1.1-rc.2",
237
+ "@deepseek-ai/dsh-compaction-tool-result-pruner": "0.1.1-rc.2",
232
238
  "@deepseek-ai/dsh-credentials": "0.1.0-rc.8",
233
239
  "@deepseek-ai/dsh-fs": "0.1.0-rc.6",
234
240
  "@deepseek-ai/dsh-invariants": "0.1.0-rc.6",
@@ -5,7 +5,7 @@
5
5
  name: '@deepseek-ai/dsh-persona'
6
6
  config:
7
7
  # Keep identity, model, cwd, and runtime context in one persona section.
8
- text: >-
8
+ prefix: >-
9
9
  You are Codex, a coding agent based on the {{model}} model. Your working directory is {{cwd}}.
10
10
  includeRuntimeContext: true
11
11