@shuind/dsh-codex-harness 0.1.18 → 0.1.20

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,10 +1,10 @@
1
1
  # @shuind/dsh-codex-harness
2
2
 
3
- 在 DSH 中提供 Codex preset:引入 Codex 风格的系统提示词与工具契约,支持图片输入、可选思考强度、Fast 优先级请求、OpenAI Responses 网页搜索与远程压缩,以及在 Web 设置上下文容量;旨在给来源于Codex的token提供适配harness,并兼容享受DSH生态。
3
+ 在 DSH 中提供 Codex preset:使用精简版 Codex 系统提示词与工具契约,支持图片输入、可选思考强度、Fast 优先级请求、OpenAI Responses 网页搜索与远程压缩,以及在 Web 设置上下文容量;旨在给来源于 Codex token 提供适配 harness,并兼容 DSH 生态。
4
4
 
5
5
  ## 功能
6
6
 
7
- - **Codex coding-agent 提示词**:提供 Codex 风格的系统提示词、工具契约和编码工作流。
7
+ - **精简 Codex coding-agent 提示词**:使用精简版系统提示词;身份、模型和工作目录由 `dsh-persona` 提供,避免重复的 Harness 身份说明,同时保留必要的工具契约和编码工作流。
8
8
  - **Codex 工具**:`exec_command`、`write_stdin`、`apply_patch`、`update_plan`。
9
9
  - **GPT 能力补全**:为 GPT 系列模型补充图片输入和思考强度选项;不会覆盖用户已有的显式配置。
10
10
  - **Fast**:仅在 Codex preset 的模型选择菜单中显示,开启后向 Responses 请求发送 `service_tier: "priority"`。
@@ -15,7 +15,7 @@
15
15
  ## 安装
16
16
 
17
17
  ```sh
18
- dsh plugin --profile web add @shuind/dsh-codex-harness@0.1.18
18
+ dsh plugin --profile web add @shuind/dsh-codex-harness@0.1.20
19
19
  ```
20
20
 
21
21
  重启 Web,创建新会话,在模式菜单中选择 **Codex 模式**。
package/lib/client.js CHANGED
@@ -7,405 +7,9 @@ window.__ModuleLoader__.load({
7
7
  __esModule: { value: true },
8
8
  [Symbol.toStringTag]: { value: "Module" }
9
9
  });
10
- //#region \0rolldown/runtime.js
11
- var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
12
- //#endregion
13
- //#region node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react.production.min.js
14
- /**
15
- * @license React
16
- * react.production.min.js
17
- *
18
- * Copyright (c) Facebook, Inc. and its affiliates.
19
- *
20
- * This source code is licensed under the MIT license found in the
21
- * LICENSE file in the root directory of this source tree.
22
- */
23
- var require_react_production_min = /* @__PURE__ */ __commonJSMin(((exports) => {
24
- var l = Symbol.for("react.element");
25
- var n = Symbol.for("react.portal");
26
- var p = Symbol.for("react.fragment");
27
- var q = Symbol.for("react.strict_mode");
28
- var r = Symbol.for("react.profiler");
29
- var t = Symbol.for("react.provider");
30
- var u = Symbol.for("react.context");
31
- var v = Symbol.for("react.forward_ref");
32
- var w = Symbol.for("react.suspense");
33
- var x = Symbol.for("react.memo");
34
- var y = Symbol.for("react.lazy");
35
- var z = Symbol.iterator;
36
- function A(a) {
37
- if (null === a || "object" !== typeof a) return null;
38
- a = z && a[z] || a["@@iterator"];
39
- return "function" === typeof a ? a : null;
40
- }
41
- var B = {
42
- isMounted: function() {
43
- return !1;
44
- },
45
- enqueueForceUpdate: function() {},
46
- enqueueReplaceState: function() {},
47
- enqueueSetState: function() {}
48
- };
49
- var C = Object.assign;
50
- var D = {};
51
- function E(a, b, e) {
52
- this.props = a;
53
- this.context = b;
54
- this.refs = D;
55
- this.updater = e || B;
56
- }
57
- E.prototype.isReactComponent = {};
58
- E.prototype.setState = function(a, b) {
59
- if ("object" !== typeof a && "function" !== typeof a && null != a) throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");
60
- this.updater.enqueueSetState(this, a, b, "setState");
61
- };
62
- E.prototype.forceUpdate = function(a) {
63
- this.updater.enqueueForceUpdate(this, a, "forceUpdate");
64
- };
65
- function F() {}
66
- F.prototype = E.prototype;
67
- function G(a, b, e) {
68
- this.props = a;
69
- this.context = b;
70
- this.refs = D;
71
- this.updater = e || B;
72
- }
73
- var H = G.prototype = new F();
74
- H.constructor = G;
75
- C(H, E.prototype);
76
- H.isPureReactComponent = !0;
77
- var I = Array.isArray;
78
- var J = Object.prototype.hasOwnProperty;
79
- var K = { current: null };
80
- var L = {
81
- key: !0,
82
- ref: !0,
83
- __self: !0,
84
- __source: !0
85
- };
86
- function M(a, b, e) {
87
- var d, c = {}, k = null, h = null;
88
- if (null != b) for (d in void 0 !== b.ref && (h = b.ref), void 0 !== b.key && (k = "" + b.key), b) J.call(b, d) && !L.hasOwnProperty(d) && (c[d] = b[d]);
89
- var g = arguments.length - 2;
90
- if (1 === g) c.children = e;
91
- else if (1 < g) {
92
- for (var f = Array(g), m = 0; m < g; m++) f[m] = arguments[m + 2];
93
- c.children = f;
94
- }
95
- if (a && a.defaultProps) for (d in g = a.defaultProps, g) void 0 === c[d] && (c[d] = g[d]);
96
- return {
97
- $$typeof: l,
98
- type: a,
99
- key: k,
100
- ref: h,
101
- props: c,
102
- _owner: K.current
103
- };
104
- }
105
- function N(a, b) {
106
- return {
107
- $$typeof: l,
108
- type: a.type,
109
- key: b,
110
- ref: a.ref,
111
- props: a.props,
112
- _owner: a._owner
113
- };
114
- }
115
- function O(a) {
116
- return "object" === typeof a && null !== a && a.$$typeof === l;
117
- }
118
- function escape(a) {
119
- var b = {
120
- "=": "=0",
121
- ":": "=2"
122
- };
123
- return "$" + a.replace(/[=:]/g, function(a) {
124
- return b[a];
125
- });
126
- }
127
- var P = /\/+/g;
128
- function Q(a, b) {
129
- return "object" === typeof a && null !== a && null != a.key ? escape("" + a.key) : b.toString(36);
130
- }
131
- function R(a, b, e, d, c) {
132
- var k = typeof a;
133
- if ("undefined" === k || "boolean" === k) a = null;
134
- var h = !1;
135
- if (null === a) h = !0;
136
- else switch (k) {
137
- case "string":
138
- case "number":
139
- h = !0;
140
- break;
141
- case "object": switch (a.$$typeof) {
142
- case l:
143
- case n: h = !0;
144
- }
145
- }
146
- if (h) return h = a, c = c(h), a = "" === d ? "." + Q(h, 0) : d, I(c) ? (e = "", null != a && (e = a.replace(P, "$&/") + "/"), R(c, b, e, "", function(a) {
147
- return a;
148
- })) : null != c && (O(c) && (c = N(c, e + (!c.key || h && h.key === c.key ? "" : ("" + c.key).replace(P, "$&/") + "/") + a)), b.push(c)), 1;
149
- h = 0;
150
- d = "" === d ? "." : d + ":";
151
- if (I(a)) for (var g = 0; g < a.length; g++) {
152
- k = a[g];
153
- var f = d + Q(k, g);
154
- h += R(k, b, e, f, c);
155
- }
156
- else if (f = A(a), "function" === typeof f) for (a = f.call(a), g = 0; !(k = a.next()).done;) k = k.value, f = d + Q(k, g++), h += R(k, b, e, f, c);
157
- else if ("object" === k) throw b = String(a), Error("Objects are not valid as a React child (found: " + ("[object Object]" === b ? "object with keys {" + Object.keys(a).join(", ") + "}" : b) + "). If you meant to render a collection of children, use an array instead.");
158
- return h;
159
- }
160
- function S(a, b, e) {
161
- if (null == a) return a;
162
- var d = [], c = 0;
163
- R(a, d, "", "", function(a) {
164
- return b.call(e, a, c++);
165
- });
166
- return d;
167
- }
168
- function T(a) {
169
- if (-1 === a._status) {
170
- var b = a._result;
171
- b = b();
172
- b.then(function(b) {
173
- if (0 === a._status || -1 === a._status) a._status = 1, a._result = b;
174
- }, function(b) {
175
- if (0 === a._status || -1 === a._status) a._status = 2, a._result = b;
176
- });
177
- -1 === a._status && (a._status = 0, a._result = b);
178
- }
179
- if (1 === a._status) return a._result.default;
180
- throw a._result;
181
- }
182
- var U = { current: null };
183
- var V = { transition: null };
184
- var W = {
185
- ReactCurrentDispatcher: U,
186
- ReactCurrentBatchConfig: V,
187
- ReactCurrentOwner: K
188
- };
189
- function X() {
190
- throw Error("act(...) is not supported in production builds of React.");
191
- }
192
- exports.Children = {
193
- map: S,
194
- forEach: function(a, b, e) {
195
- S(a, function() {
196
- b.apply(this, arguments);
197
- }, e);
198
- },
199
- count: function(a) {
200
- var b = 0;
201
- S(a, function() {
202
- b++;
203
- });
204
- return b;
205
- },
206
- toArray: function(a) {
207
- return S(a, function(a) {
208
- return a;
209
- }) || [];
210
- },
211
- only: function(a) {
212
- if (!O(a)) throw Error("React.Children.only expected to receive a single React element child.");
213
- return a;
214
- }
215
- };
216
- exports.Component = E;
217
- exports.Fragment = p;
218
- exports.Profiler = r;
219
- exports.PureComponent = G;
220
- exports.StrictMode = q;
221
- exports.Suspense = w;
222
- exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = W;
223
- exports.act = X;
224
- exports.cloneElement = function(a, b, e) {
225
- if (null === a || void 0 === a) throw Error("React.cloneElement(...): The argument must be a React element, but you passed " + a + ".");
226
- var d = C({}, a.props), c = a.key, k = a.ref, h = a._owner;
227
- if (null != b) {
228
- void 0 !== b.ref && (k = b.ref, h = K.current);
229
- void 0 !== b.key && (c = "" + b.key);
230
- if (a.type && a.type.defaultProps) var g = a.type.defaultProps;
231
- for (f in b) J.call(b, f) && !L.hasOwnProperty(f) && (d[f] = void 0 === b[f] && void 0 !== g ? g[f] : b[f]);
232
- }
233
- var f = arguments.length - 2;
234
- if (1 === f) d.children = e;
235
- else if (1 < f) {
236
- g = Array(f);
237
- for (var m = 0; m < f; m++) g[m] = arguments[m + 2];
238
- d.children = g;
239
- }
240
- return {
241
- $$typeof: l,
242
- type: a.type,
243
- key: c,
244
- ref: k,
245
- props: d,
246
- _owner: h
247
- };
248
- };
249
- exports.createContext = function(a) {
250
- a = {
251
- $$typeof: u,
252
- _currentValue: a,
253
- _currentValue2: a,
254
- _threadCount: 0,
255
- Provider: null,
256
- Consumer: null,
257
- _defaultValue: null,
258
- _globalName: null
259
- };
260
- a.Provider = {
261
- $$typeof: t,
262
- _context: a
263
- };
264
- return a.Consumer = a;
265
- };
266
- exports.createElement = M;
267
- exports.createFactory = function(a) {
268
- var b = M.bind(null, a);
269
- b.type = a;
270
- return b;
271
- };
272
- exports.createRef = function() {
273
- return { current: null };
274
- };
275
- exports.forwardRef = function(a) {
276
- return {
277
- $$typeof: v,
278
- render: a
279
- };
280
- };
281
- exports.isValidElement = O;
282
- exports.lazy = function(a) {
283
- return {
284
- $$typeof: y,
285
- _payload: {
286
- _status: -1,
287
- _result: a
288
- },
289
- _init: T
290
- };
291
- };
292
- exports.memo = function(a, b) {
293
- return {
294
- $$typeof: x,
295
- type: a,
296
- compare: void 0 === b ? null : b
297
- };
298
- };
299
- exports.startTransition = function(a) {
300
- var b = V.transition;
301
- V.transition = {};
302
- try {
303
- a();
304
- } finally {
305
- V.transition = b;
306
- }
307
- };
308
- exports.unstable_act = X;
309
- exports.useCallback = function(a, b) {
310
- return U.current.useCallback(a, b);
311
- };
312
- exports.useContext = function(a) {
313
- return U.current.useContext(a);
314
- };
315
- exports.useDebugValue = function() {};
316
- exports.useDeferredValue = function(a) {
317
- return U.current.useDeferredValue(a);
318
- };
319
- exports.useEffect = function(a, b) {
320
- return U.current.useEffect(a, b);
321
- };
322
- exports.useId = function() {
323
- return U.current.useId();
324
- };
325
- exports.useImperativeHandle = function(a, b, e) {
326
- return U.current.useImperativeHandle(a, b, e);
327
- };
328
- exports.useInsertionEffect = function(a, b) {
329
- return U.current.useInsertionEffect(a, b);
330
- };
331
- exports.useLayoutEffect = function(a, b) {
332
- return U.current.useLayoutEffect(a, b);
333
- };
334
- exports.useMemo = function(a, b) {
335
- return U.current.useMemo(a, b);
336
- };
337
- exports.useReducer = function(a, b, e) {
338
- return U.current.useReducer(a, b, e);
339
- };
340
- exports.useRef = function(a) {
341
- return U.current.useRef(a);
342
- };
343
- exports.useState = function(a) {
344
- return U.current.useState(a);
345
- };
346
- exports.useSyncExternalStore = function(a, b, e) {
347
- return U.current.useSyncExternalStore(a, b, e);
348
- };
349
- exports.useTransition = function() {
350
- return U.current.useTransition();
351
- };
352
- exports.version = "18.3.1";
353
- }));
354
- //#endregion
355
- //#region node_modules/.pnpm/react@18.3.1/node_modules/react/index.js
356
- var require_react = /* @__PURE__ */ __commonJSMin(((exports, module) => {
357
- module.exports = require_react_production_min();
358
- }));
359
- //#endregion
360
- //#region node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react-jsx-runtime.production.min.js
361
- /**
362
- * @license React
363
- * react-jsx-runtime.production.min.js
364
- *
365
- * Copyright (c) Facebook, Inc. and its affiliates.
366
- *
367
- * This source code is licensed under the MIT license found in the
368
- * LICENSE file in the root directory of this source tree.
369
- */
370
- var require_react_jsx_runtime_production_min = /* @__PURE__ */ __commonJSMin(((exports) => {
371
- var f = require_react();
372
- var k = Symbol.for("react.element");
373
- var m = Object.prototype.hasOwnProperty;
374
- var n = f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner;
375
- var p = {
376
- key: !0,
377
- ref: !0,
378
- __self: !0,
379
- __source: !0
380
- };
381
- function q(c, a, g) {
382
- var b, d = {}, e = null, h = null;
383
- void 0 !== g && (e = "" + g);
384
- void 0 !== a.key && (e = "" + a.key);
385
- void 0 !== a.ref && (h = a.ref);
386
- for (b in a) m.call(a, b) && !p.hasOwnProperty(b) && (d[b] = a[b]);
387
- if (c && c.defaultProps) for (b in a = c.defaultProps, a) void 0 === d[b] && (d[b] = a[b]);
388
- return {
389
- $$typeof: k,
390
- type: c,
391
- key: e,
392
- ref: h,
393
- props: d,
394
- _owner: n.current
395
- };
396
- }
397
- exports.jsx = q;
398
- exports.jsxs = q;
399
- }));
400
- //#endregion
401
- //#region node_modules/.pnpm/react@18.3.1/node_modules/react/jsx-runtime.js
402
- var require_jsx_runtime = /* @__PURE__ */ __commonJSMin(((exports, module) => {
403
- module.exports = require_react_jsx_runtime_production_min();
404
- }));
405
- //#endregion
10
+ let react_jsx_runtime = require("react/jsx-runtime");
11
+ let react = require("react");
406
12
  //#region lib/types/context.js
407
- var import_react = require_react();
408
- var import_jsx_runtime = require_jsx_runtime();
409
13
  /** User-selectable Codex context controls use whole K-token units. */
410
14
  const CODEX_CONTEXT_UNIT = 1e3;
411
15
  const CODEX_CONTEXT_MAX = 1e6;
@@ -453,7 +57,7 @@ window.__ModuleLoader__.load({
453
57
  const snapshot = useSettings((state) => state);
454
58
  const fast = snapshot.value?.fast ?? false;
455
59
  if (agentPreset !== "codex") return null;
456
- return (0, import_jsx_runtime.jsxs)("button", {
60
+ return (0, react_jsx_runtime.jsxs)("button", {
457
61
  type: "button",
458
62
  role: "menuitemcheckbox",
459
63
  disabled: snapshot.writable === false,
@@ -482,7 +86,7 @@ window.__ModuleLoader__.load({
482
86
  fontWeight: fast ? 600 : 400,
483
87
  textAlign: "left"
484
88
  },
485
- children: [(0, import_jsx_runtime.jsx)("span", { children: t("fast") }), (0, import_jsx_runtime.jsx)("span", {
89
+ children: [(0, react_jsx_runtime.jsx)("span", { children: t("fast") }), (0, react_jsx_runtime.jsx)("span", {
486
90
  style: {
487
91
  color: "var(--dsw-alias-label-tertiary)",
488
92
  fontSize: 12
@@ -502,27 +106,27 @@ window.__ModuleLoader__.load({
502
106
  if (normalized === contextWindow) unsetSetting("contextWindow");
503
107
  else setSetting("contextWindow", normalized);
504
108
  };
505
- return (0, import_jsx_runtime.jsxs)("div", {
109
+ return (0, react_jsx_runtime.jsxs)("div", {
506
110
  style: {
507
111
  marginTop: 10,
508
112
  display: "grid",
509
113
  gap: 5
510
114
  },
511
115
  children: [
512
- (0, import_jsx_runtime.jsxs)("div", {
116
+ (0, react_jsx_runtime.jsxs)("div", {
513
117
  style: {
514
118
  display: "flex",
515
119
  alignItems: "baseline",
516
120
  justifyContent: "space-between",
517
121
  gap: 12
518
122
  },
519
- children: [(0, import_jsx_runtime.jsx)("strong", {
123
+ children: [(0, react_jsx_runtime.jsx)("strong", {
520
124
  style: {
521
125
  color: "var(--dsw-alias-label-primary)",
522
126
  fontSize: 12
523
127
  },
524
128
  children: t("contextSize")
525
- }), (0, import_jsx_runtime.jsxs)("span", {
129
+ }), (0, react_jsx_runtime.jsxs)("span", {
526
130
  style: {
527
131
  color: "var(--dsw-alias-label-secondary)",
528
132
  fontSize: 11
@@ -530,7 +134,7 @@ window.__ModuleLoader__.load({
530
134
  children: [valueK, "K"]
531
135
  })]
532
136
  }),
533
- (0, import_jsx_runtime.jsx)("input", {
137
+ (0, react_jsx_runtime.jsx)("input", {
534
138
  type: "range",
535
139
  min: 1,
536
140
  max: maxK,
@@ -542,14 +146,14 @@ window.__ModuleLoader__.load({
542
146
  setValueK(Number(event.target.value));
543
147
  }
544
148
  }),
545
- (0, import_jsx_runtime.jsxs)("div", {
149
+ (0, react_jsx_runtime.jsxs)("div", {
546
150
  style: {
547
151
  display: "flex",
548
152
  alignItems: "center",
549
153
  gap: 7
550
154
  },
551
155
  children: [
552
- (0, import_jsx_runtime.jsx)("input", {
156
+ (0, react_jsx_runtime.jsx)("input", {
553
157
  type: "number",
554
158
  min: 1,
555
159
  max: maxK,
@@ -571,14 +175,14 @@ window.__ModuleLoader__.load({
571
175
  fontSize: 11
572
176
  }
573
177
  }),
574
- (0, import_jsx_runtime.jsx)("span", {
178
+ (0, react_jsx_runtime.jsx)("span", {
575
179
  style: {
576
180
  color: "var(--dsw-alias-label-secondary)",
577
181
  fontSize: 11
578
182
  },
579
183
  children: "K"
580
184
  }),
581
- (0, import_jsx_runtime.jsx)("span", {
185
+ (0, react_jsx_runtime.jsx)("span", {
582
186
  style: {
583
187
  color: "var(--dsw-alias-label-secondary)",
584
188
  fontSize: 11
@@ -587,7 +191,7 @@ window.__ModuleLoader__.load({
587
191
  })
588
192
  ]
589
193
  }),
590
- configured !== void 0 && (0, import_jsx_runtime.jsx)("button", {
194
+ configured !== void 0 && (0, react_jsx_runtime.jsx)("button", {
591
195
  type: "button",
592
196
  onClick: () => {
593
197
  unsetSetting("contextWindow");
@@ -618,8 +222,8 @@ window.__ModuleLoader__.load({
618
222
  activity: "awaiting-model",
619
223
  startedAt: fallbackStartedAt
620
224
  } : null;
621
- const [now, setNow] = (0, import_react.useState)(() => Date.now());
622
- (0, import_react.useEffect)(() => {
225
+ const [now, setNow] = (0, react.useState)(() => Date.now());
226
+ (0, react.useEffect)(() => {
623
227
  if (agentPreset !== "codex" || activity === void 0 || activity === null) return void 0;
624
228
  setNow(Date.now());
625
229
  const timer = setInterval(() => {
@@ -629,7 +233,7 @@ window.__ModuleLoader__.load({
629
233
  }, [agentPreset, activity?.startedAt]);
630
234
  if (agentPreset !== "codex" || activity === void 0 || activity === null) return null;
631
235
  const label = activity.activity === "awaiting-model" ? t("activityAwaitingModel") : t("activityCompacting");
632
- return (0, import_jsx_runtime.jsxs)("div", {
236
+ return (0, react_jsx_runtime.jsxs)("div", {
633
237
  id: "codex-activity",
634
238
  role: "status",
635
239
  "aria-live": "polite",
@@ -644,7 +248,7 @@ window.__ModuleLoader__.load({
644
248
  lineHeight: "20px"
645
249
  },
646
250
  children: [
647
- (0, import_jsx_runtime.jsx)("span", {
251
+ (0, react_jsx_runtime.jsx)("span", {
648
252
  "aria-hidden": "true",
649
253
  style: {
650
254
  width: 7,
@@ -654,8 +258,8 @@ window.__ModuleLoader__.load({
654
258
  background: "var(--dsw-static-blue-500)"
655
259
  }
656
260
  }),
657
- (0, import_jsx_runtime.jsx)("span", { children: label }),
658
- (0, import_jsx_runtime.jsxs)("span", {
261
+ (0, react_jsx_runtime.jsx)("span", { children: label }),
262
+ (0, react_jsx_runtime.jsxs)("span", {
659
263
  style: { color: "var(--dsw-alias-label-tertiary)" },
660
264
  children: [
661
265
  "· ",
package/lib/index.js CHANGED
@@ -949,9 +949,7 @@ function applyCodexRequestSettings(request, settings) {
949
949
  ...settings.fast ? { serviceTier: "priority" } : {}
950
950
  };
951
951
  }
952
- const CODEX_BASE_PROMPT = String.raw`You are Codex, based on {{model}}. You are running as a coding agent in dsh Web on a user's computer.
953
-
954
- ## General
952
+ const CODEX_BASE_PROMPT = String.raw`## General
955
953
 
956
954
  - When searching for text or files, prefer using rg or rg --files respectively because rg is much faster than alternatives like grep. If rg is not available, use the next best alternative.
957
955
 
@@ -959,7 +957,6 @@ const CODEX_BASE_PROMPT = String.raw`You are Codex, based on {{model}}. You are
959
957
 
960
958
  - Default to ASCII when editing or creating files. Only introduce non-ASCII or other Unicode characters when there is a clear justification and the file already uses them.
961
959
  - Add succinct code comments that explain non-obvious code. Do not add comments that merely narrate assignments or control flow.
962
- - Use apply_patch for single-file edits when practical. The apply_patch tool accepts its freeform patch language; do not wrap that patch in JSON.
963
960
  - You may be in a dirty git worktree. Never revert existing changes you did not make unless the user explicitly requests it. If unrelated files are changed, leave them alone.
964
961
 
965
962
  ## Planning
@@ -970,16 +967,10 @@ const CODEX_BASE_PROMPT = String.raw`You are Codex, based on {{model}}. You are
970
967
  ## dsh session
971
968
 
972
969
  - The user and you share one workspace. Inspect the repository and every applicable AGENTS.md before editing.
973
- - This session's preset was selected when the session was created and stays fixed for its lifetime. Do not attempt to switch the preset or replace its tool catalog while the session is running.
974
- - dsh provides the execution, filesystem, session, policy, and Skills capabilities behind these tools. Use those extension points as supplied; do not invent a second harness or bypass the filesystem service for file edits.
975
- - The core Codex tool names, arguments, and result formats are fixed: use exec_command for terminal work, write_stdin for an existing interactive command, apply_patch for file changes, and update_plan for multi-step tasks.
976
970
 
977
971
  ## Task execution
978
972
 
979
973
  - Keep the user informed with concise progress updates and lead with the result.
980
- - Prefer existing functions and extension points over new machinery.
981
- - Do not claim that a command, edit, or test succeeded unless it actually succeeded.
982
- - Use the exact tool names and argument formats supplied by this session; do not invent replacement editing tools.
983
974
 
984
975
  ## Presenting your work
985
976
 
@@ -996,13 +987,26 @@ const CODEX_COLLABORATION_PROMPT = String.raw`## Collaboration
996
987
  - Solve problems by thinking from first principles and at a higher level.
997
988
  - Make things as effortless as possible for the user.
998
989
  `;
999
- /** Build the Codex system prompt with optional, user-enabled collaboration guidance. */
990
+ /** Put the agent persona first and omit the generic Harness identity opener. */
991
+ function normalizeCodexPromptAssembly(assembly) {
992
+ const sections = assembly.sections.filter((section) => section.name !== "harness:identity");
993
+ const persona = sections.find((section) => section.name === "deployment:persona");
994
+ if (persona === void 0) return {
995
+ ...assembly,
996
+ sections
997
+ };
998
+ return {
999
+ ...assembly,
1000
+ sections: [persona, ...sections.filter((section) => section.name !== "deployment:persona")]
1001
+ };
1002
+ }
1003
+ /** Build the Codex operating prompt with optional, user-enabled collaboration guidance. */
1000
1004
  function buildCodexSystemPrompt(config = {}) {
1001
1005
  return config.collaborationPrompt === true ? `${CODEX_BASE_PROMPT}\n\n${CODEX_COLLABORATION_PROMPT}` : CODEX_BASE_PROMPT;
1002
1006
  }
1003
1007
  const EXEC_COMMAND_DESCRIPTION = "Runs a command in a PTY, returning output or a session ID for ongoing interaction.";
1004
1008
  const WRITE_STDIN_DESCRIPTION = "Writes characters to an existing unified exec session and returns recent output.";
1005
- const APPLY_PATCH_DESCRIPTION = "The `apply_patch` tool can be used to edit files. This is a FREEFORM tool, so do not wrap the patch in JSON.";
1009
+ const APPLY_PATCH_DESCRIPTION = "Edits files using a patch.";
1006
1010
  const UPDATE_PLAN_DESCRIPTION = "Updates the task plan.\nProvide an optional explanation and a list of plan items, each with a step and status.\nAt most one step can be in_progress at a time.";
1007
1011
  const PLAN_STATUSES = [
1008
1012
  "pending",
@@ -1388,6 +1392,7 @@ function apply(ctx, config = {}) {
1388
1392
  if ((resolved.hostedWebSearch || resolved.remoteCompact) && options.purpose === void 0 && isGptModel(options.model)) return hostedWebSearchStream(next);
1389
1393
  return next();
1390
1394
  }));
1395
+ ctx.on("system-prompt/assemble", async (_assembly, _context, next) => normalizeCodexPromptAssembly(await next()));
1391
1396
  ctx.systemPrompt.section({
1392
1397
  name: "codex:base",
1393
1398
  order: 10,
@@ -1404,4 +1409,4 @@ var types_default = {
1404
1409
  apply
1405
1410
  };
1406
1411
  //#endregion
1407
- export { CODEX_SETTINGS_NAMESPACE, CODEX_SETTINGS_SCHEMA, Config, apply, applyCodexRequestSettings, buildCodexSystemPrompt, types_default as default, enrichCodexModel, inject, name };
1412
+ export { CODEX_SETTINGS_NAMESPACE, CODEX_SETTINGS_SCHEMA, Config, apply, applyCodexRequestSettings, buildCodexSystemPrompt, types_default as default, enrichCodexModel, inject, name, normalizeCodexPromptAssembly };
@@ -2,6 +2,7 @@
2
2
  import type { Context } from '@deepseek-ai/cordis';
3
3
  import z from '@deepseek-ai/schemastery';
4
4
  import type { LlmCallConfig } from '@deepseek-ai/dsh-llm';
5
+ import type { PromptAssembly } from '@deepseek-ai/dsh-system-prompt';
5
6
  declare module '@deepseek-ai/dsh-llm' {
6
7
  interface LlmCallConfig {
7
8
  /** Codex request context capacity override, in tokens. */
@@ -50,7 +51,9 @@ export interface CodexModelProfile {
50
51
  export declare function enrichCodexModel(model: CodexModelProfile): CodexModelProfile;
51
52
  /** Apply the live Codex controls to one agent request without leaking them to other routes. */
52
53
  export declare function applyCodexRequestSettings(request: LlmCallConfig, settings: CodexSettings): LlmCallConfig;
53
- /** Build the Codex system prompt with optional, user-enabled collaboration guidance. */
54
+ /** Put the agent persona first and omit the generic Harness identity opener. */
55
+ export declare function normalizeCodexPromptAssembly(assembly: PromptAssembly): PromptAssembly;
56
+ /** Build the Codex operating prompt with optional, user-enabled collaboration guidance. */
54
57
  export declare function buildCodexSystemPrompt(config?: Pick<Config, 'collaborationPrompt'>): string;
55
58
  /** Mount the Codex prompt/tool layer inside one fixed agent preset. */
56
59
  export declare function apply(ctx: Context, config?: Config): void;
@@ -138,9 +138,8 @@ export function applyCodexRequestSettings(request, settings) {
138
138
  ...settings.fast ? { serviceTier: 'priority' } : {},
139
139
  };
140
140
  }
141
- const CODEX_BASE_PROMPT = String.raw `You are Codex, based on {{model}}. You are running as a coding agent in dsh Web on a user's computer.
142
-
143
- ## General
141
+ // The shipped persona owns the single Codex identity line, model, and working directory.
142
+ const CODEX_BASE_PROMPT = String.raw `## General
144
143
 
145
144
  - When searching for text or files, prefer using rg or rg --files respectively because rg is much faster than alternatives like grep. If rg is not available, use the next best alternative.
146
145
 
@@ -148,7 +147,6 @@ const CODEX_BASE_PROMPT = String.raw `You are Codex, based on {{model}}. You are
148
147
 
149
148
  - Default to ASCII when editing or creating files. Only introduce non-ASCII or other Unicode characters when there is a clear justification and the file already uses them.
150
149
  - Add succinct code comments that explain non-obvious code. Do not add comments that merely narrate assignments or control flow.
151
- - Use apply_patch for single-file edits when practical. The apply_patch tool accepts its freeform patch language; do not wrap that patch in JSON.
152
150
  - You may be in a dirty git worktree. Never revert existing changes you did not make unless the user explicitly requests it. If unrelated files are changed, leave them alone.
153
151
 
154
152
  ## Planning
@@ -159,16 +157,10 @@ const CODEX_BASE_PROMPT = String.raw `You are Codex, based on {{model}}. You are
159
157
  ## dsh session
160
158
 
161
159
  - The user and you share one workspace. Inspect the repository and every applicable AGENTS.md before editing.
162
- - This session's preset was selected when the session was created and stays fixed for its lifetime. Do not attempt to switch the preset or replace its tool catalog while the session is running.
163
- - dsh provides the execution, filesystem, session, policy, and Skills capabilities behind these tools. Use those extension points as supplied; do not invent a second harness or bypass the filesystem service for file edits.
164
- - The core Codex tool names, arguments, and result formats are fixed: use exec_command for terminal work, write_stdin for an existing interactive command, apply_patch for file changes, and update_plan for multi-step tasks.
165
160
 
166
161
  ## Task execution
167
162
 
168
163
  - Keep the user informed with concise progress updates and lead with the result.
169
- - Prefer existing functions and extension points over new machinery.
170
- - Do not claim that a command, edit, or test succeeded unless it actually succeeded.
171
- - Use the exact tool names and argument formats supplied by this session; do not invent replacement editing tools.
172
164
 
173
165
  ## Presenting your work
174
166
 
@@ -185,7 +177,18 @@ const CODEX_COLLABORATION_PROMPT = String.raw `## Collaboration
185
177
  - Solve problems by thinking from first principles and at a higher level.
186
178
  - Make things as effortless as possible for the user.
187
179
  `;
188
- /** Build the Codex system prompt with optional, user-enabled collaboration guidance. */
180
+ /** Put the agent persona first and omit the generic Harness identity opener. */
181
+ export function normalizeCodexPromptAssembly(assembly) {
182
+ const sections = assembly.sections.filter(section => section.name !== 'harness:identity');
183
+ const persona = sections.find(section => section.name === 'deployment:persona');
184
+ if (persona === undefined)
185
+ return { ...assembly, sections };
186
+ return {
187
+ ...assembly,
188
+ sections: [persona, ...sections.filter(section => section.name !== 'deployment:persona')],
189
+ };
190
+ }
191
+ /** Build the Codex operating prompt with optional, user-enabled collaboration guidance. */
189
192
  export function buildCodexSystemPrompt(config = {}) {
190
193
  return config.collaborationPrompt === true
191
194
  ? `${CODEX_BASE_PROMPT}\n\n${CODEX_COLLABORATION_PROMPT}`
@@ -193,7 +196,7 @@ export function buildCodexSystemPrompt(config = {}) {
193
196
  }
194
197
  const EXEC_COMMAND_DESCRIPTION = 'Runs a command in a PTY, returning output or a session ID for ongoing interaction.';
195
198
  const WRITE_STDIN_DESCRIPTION = 'Writes characters to an existing unified exec session and returns recent output.';
196
- const APPLY_PATCH_DESCRIPTION = 'The `apply_patch` tool can be used to edit files. This is a FREEFORM tool, so do not wrap the patch in JSON.';
199
+ const APPLY_PATCH_DESCRIPTION = 'Edits files using a patch.';
197
200
  const UPDATE_PLAN_DESCRIPTION = 'Updates the task plan.\nProvide an optional explanation and a list of plan items, each with a step and status.\nAt most one step can be in_progress at a time.';
198
201
  const PLAN_STATUSES = ['pending', 'in_progress', 'completed'];
199
202
  function sessionCwd(exec) {
@@ -485,6 +488,7 @@ export function apply(ctx, config = {}) {
485
488
  return next();
486
489
  }));
487
490
  }
491
+ ctx.on('system-prompt/assemble', async (_assembly, _context, next) => normalizeCodexPromptAssembly(await next()));
488
492
  ctx.systemPrompt.section({ name: 'codex:base', order: 10, text: buildCodexSystemPrompt(resolved) });
489
493
  registerExecTools(ctx, resolved);
490
494
  registerPatchTool(ctx);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@shuind/dsh-codex-harness",
3
- "version": "0.1.18",
4
- "description": "A minimal Codex harness for GPT models that do not fit DSH's native interface, while remaining compatible with the DSH plugin ecosystem.",
3
+ "version": "0.1.20",
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",
7
7
  "types": "lib/types/index.d.ts",
@@ -4,6 +4,7 @@
4
4
  - id: persona
5
5
  name: '@deepseek-ai/dsh-persona'
6
6
  config:
7
+ # Keep identity, model, cwd, and runtime context in one persona section.
7
8
  text: >-
8
9
  You are Codex, a coding agent based on the {{model}} model. Your working directory is {{cwd}}.
9
10
  includeRuntimeContext: true
@@ -1,3 +1,3 @@
1
- name: Codex 模式
2
- description: 使用 Codex 的基础提示词、exec_command、write_stdin、apply_patch 和 update_plan,并保留 dsh 的 Skills 与可插拔运行时。
3
- order: 5
1
+ name: Codex 模式
2
+ description: 使用精简版 Codex 提示词、exec_command、write_stdin、apply_patch 和 update_plan,并保留 dsh 的 Skills 与可插拔运行时。
3
+ order: 5