@shuind/dsh-codex-harness 0.1.31 → 0.1.32
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 +1 -1
- package/lib/client.js +30 -7
- package/lib/index.js +1 -1
- package/lib/types/client/index.d.ts +17 -1
- package/lib/types/client/index.js +31 -8
- package/lib/types/index.js +1 -1
- package/package.json +8 -9
package/README.md
CHANGED
|
@@ -123,7 +123,7 @@ order: 10
|
|
|
123
123
|
开启后,Codex preset 会在系统提示词中注入以下协作要求:
|
|
124
124
|
|
|
125
125
|
```text
|
|
126
|
-
Gather enough context from the user then achieve the user's goal through the clearest, most effective path.
|
|
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
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
128
|
Convey enough valuable information with as few words as possible. Stay focused on the end goal.
|
|
129
129
|
Solve problems by thinking from first principles and at a higher level.
|
package/lib/client.js
CHANGED
|
@@ -72,7 +72,9 @@ window.__ModuleLoader__.load({
|
|
|
72
72
|
/** Browser controls for the Codex request settings mounted by the Host plugin. */
|
|
73
73
|
const NS = "codex";
|
|
74
74
|
const SETTINGS_NAMESPACE = "codex";
|
|
75
|
+
const ACTIVITY_SLOT = "conversation.chat.status";
|
|
75
76
|
const ACTIVITY_FALLBACK_SLOT = "conversation.composer.dock";
|
|
77
|
+
const CONTEXT_SETTINGS_SLOT = "conversation.input.context.settings";
|
|
76
78
|
const FAST_FALLBACK_SLOT = "conversation.input.right";
|
|
77
79
|
const DEFAULT_CONTEXT_WINDOW = 262144;
|
|
78
80
|
const en = {
|
|
@@ -149,9 +151,11 @@ window.__ModuleLoader__.load({
|
|
|
149
151
|
const pressure = useProjection("contextPressure");
|
|
150
152
|
return pressure?.contextWindow !== void 0 && pressure.contextWindow > 0 ? pressure.contextWindow : DEFAULT_CONTEXT_WINDOW;
|
|
151
153
|
}
|
|
152
|
-
/** Settings form
|
|
153
|
-
function ContextSizeControl({ contextWindow, useSettings, setSetting, unsetSetting, t }) {
|
|
154
|
+
/** Settings form rendered inside the context meter's expanded panel. */
|
|
155
|
+
function ContextSizeControl({ contextWindow, sessionId, useSessions, useSettings, setSetting, unsetSetting, t }) {
|
|
156
|
+
const agentPreset = useSessions((state) => state.byId[sessionId]?.agentPreset);
|
|
154
157
|
const snapshot = useSettings((state) => state);
|
|
158
|
+
if (!isCodexPresetId(agentPreset)) return null;
|
|
155
159
|
const configured = snapshot.value?.contextWindow;
|
|
156
160
|
const maxK = CODEX_CONTEXT_MAX / CODEX_CONTEXT_UNIT;
|
|
157
161
|
const valueK = Math.min(maxK, Math.max(1, Math.round((configured ?? contextWindow) / CODEX_CONTEXT_UNIT)));
|
|
@@ -374,6 +378,8 @@ window.__ModuleLoader__.load({
|
|
|
374
378
|
},
|
|
375
379
|
children: (0, react_jsx_runtime.jsx)(ContextSizeControl, {
|
|
376
380
|
contextWindow,
|
|
381
|
+
sessionId,
|
|
382
|
+
useSessions,
|
|
377
383
|
useSettings,
|
|
378
384
|
setSetting,
|
|
379
385
|
unsetSetting,
|
|
@@ -447,7 +453,7 @@ window.__ModuleLoader__.load({
|
|
|
447
453
|
]
|
|
448
454
|
});
|
|
449
455
|
}
|
|
450
|
-
/**
|
|
456
|
+
/** Preserve both legacy controls for hosts without the additive seats. */
|
|
451
457
|
function ActivityDock(props) {
|
|
452
458
|
return (0, react_jsx_runtime.jsxs)("div", {
|
|
453
459
|
style: {
|
|
@@ -484,13 +490,30 @@ window.__ModuleLoader__.load({
|
|
|
484
490
|
locale: NS,
|
|
485
491
|
inject: injected
|
|
486
492
|
}, FastModeFallback));
|
|
487
|
-
ctx.slots.inject(
|
|
488
|
-
name:
|
|
493
|
+
ctx.slots.inject(CONTEXT_SETTINGS_SLOT, () => ctx.slots.register({
|
|
494
|
+
name: CONTEXT_SETTINGS_SLOT,
|
|
495
|
+
id: "codex-context-size",
|
|
496
|
+
order: 0,
|
|
497
|
+
locale: NS,
|
|
498
|
+
inject: injected
|
|
499
|
+
}, ContextSizeControl));
|
|
500
|
+
ctx.slots.inject(ACTIVITY_SLOT, () => ctx.slots.register({
|
|
501
|
+
name: ACTIVITY_SLOT,
|
|
489
502
|
id: "codex-activity",
|
|
490
|
-
order:
|
|
503
|
+
order: 0,
|
|
491
504
|
locale: NS,
|
|
492
505
|
inject: injected
|
|
493
|
-
},
|
|
506
|
+
}, ActivityLine));
|
|
507
|
+
ctx.slots.inject(ACTIVITY_FALLBACK_SLOT, () => {
|
|
508
|
+
if (ctx.slots.spec(ACTIVITY_SLOT) !== void 0) return () => {};
|
|
509
|
+
return ctx.slots.register({
|
|
510
|
+
name: ACTIVITY_FALLBACK_SLOT,
|
|
511
|
+
id: "codex-activity",
|
|
512
|
+
order: 5,
|
|
513
|
+
locale: NS,
|
|
514
|
+
inject: injected
|
|
515
|
+
}, ActivityDock);
|
|
516
|
+
});
|
|
494
517
|
}
|
|
495
518
|
var client_default = {
|
|
496
519
|
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 ACTIVITY_SLOT: "conversation.chat.status";
|
|
5
6
|
interface CodexSettings {
|
|
6
7
|
fast: boolean;
|
|
7
8
|
contextWindow?: number;
|
|
@@ -25,6 +26,20 @@ declare module '@deepseek-ai/dsh-client-ui-slots' {
|
|
|
25
26
|
interface LocaleNamespaceMap {
|
|
26
27
|
codex: CodexKey;
|
|
27
28
|
}
|
|
29
|
+
interface SlotMap {
|
|
30
|
+
'conversation.chat.status': {
|
|
31
|
+
kind: 'list';
|
|
32
|
+
scope: 'session';
|
|
33
|
+
owner: Record<never, never>;
|
|
34
|
+
};
|
|
35
|
+
'conversation.input.context.settings': {
|
|
36
|
+
kind: 'list';
|
|
37
|
+
scope: 'session';
|
|
38
|
+
owner: {
|
|
39
|
+
contextWindow: number;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
}
|
|
28
43
|
}
|
|
29
44
|
interface InputSettingsControlInjected {
|
|
30
45
|
hooks: {
|
|
@@ -35,7 +50,8 @@ interface InputSettingsControlInjected {
|
|
|
35
50
|
}
|
|
36
51
|
type ContextDockProps = PropsRuntime<'conversation.composer.dock'> & InjectFace<InputSettingsControlInjected> & PropsLocale<'codex'>;
|
|
37
52
|
type ActivityDockProps = ContextDockProps & PropsLocale<'codex'>;
|
|
38
|
-
type
|
|
53
|
+
type ActivityStatusProps = PropsRuntime<typeof ACTIVITY_SLOT> & InjectFace<InputSettingsControlInjected> & PropsLocale<'codex'>;
|
|
54
|
+
type ActivityProps = ActivityStatusProps | ActivityDockProps;
|
|
39
55
|
export declare function ActivityLine({ sessionId, useSession, useSessions, useProjection, t }: ActivityProps): import("react").JSX.Element | null;
|
|
40
56
|
export declare const inject: string[];
|
|
41
57
|
/** Mount all controls through the official composer seats shared by every DSH release. */
|
|
@@ -5,7 +5,9 @@ import { CODEX_CONTEXT_MAX, CODEX_CONTEXT_UNIT, isCodexPresetId } from "../conte
|
|
|
5
5
|
import { modelActivity, sameModelActivity } from "./activity.js";
|
|
6
6
|
const NS = 'codex';
|
|
7
7
|
const SETTINGS_NAMESPACE = 'codex';
|
|
8
|
+
const ACTIVITY_SLOT = 'conversation.chat.status';
|
|
8
9
|
const ACTIVITY_FALLBACK_SLOT = 'conversation.composer.dock';
|
|
10
|
+
const CONTEXT_SETTINGS_SLOT = 'conversation.input.context.settings';
|
|
9
11
|
const FAST_FALLBACK_SLOT = 'conversation.input.right';
|
|
10
12
|
const DEFAULT_CONTEXT_WINDOW = 262_144;
|
|
11
13
|
const en = {
|
|
@@ -67,9 +69,12 @@ function contextWindowFromProjection(useProjection) {
|
|
|
67
69
|
? pressure.contextWindow
|
|
68
70
|
: DEFAULT_CONTEXT_WINDOW;
|
|
69
71
|
}
|
|
70
|
-
/** Settings form
|
|
71
|
-
function ContextSizeControl({ contextWindow, useSettings, setSetting, unsetSetting, t, }) {
|
|
72
|
+
/** Settings form rendered inside the context meter's expanded panel. */
|
|
73
|
+
function ContextSizeControl({ contextWindow, sessionId, useSessions, useSettings, setSetting, unsetSetting, t, }) {
|
|
74
|
+
const agentPreset = useSessions(state => state.byId[sessionId]?.agentPreset);
|
|
72
75
|
const snapshot = useSettings(state => state);
|
|
76
|
+
if (!isCodexPresetId(agentPreset))
|
|
77
|
+
return null;
|
|
73
78
|
const configured = snapshot.value?.contextWindow;
|
|
74
79
|
const maxK = CODEX_CONTEXT_MAX / CODEX_CONTEXT_UNIT;
|
|
75
80
|
const valueK = Math.min(maxK, Math.max(1, Math.round((configured ?? contextWindow) / CODEX_CONTEXT_UNIT)));
|
|
@@ -171,7 +176,7 @@ function ContextSizeDock({ sessionId, useSessions, useProjection, useSettings, s
|
|
|
171
176
|
color: 'var(--dsw-alias-label-primary)',
|
|
172
177
|
background: 'var(--dsw-alias-bg-base)',
|
|
173
178
|
boxShadow: 'var(--dsw-shadow-lv2)',
|
|
174
|
-
}, children: _jsx(ContextSizeControl, { contextWindow: contextWindow, useSettings: useSettings, setSetting: setSetting, unsetSetting: unsetSetting, t: t }) }))] }));
|
|
179
|
+
}, children: _jsx(ContextSizeControl, { contextWindow: contextWindow, sessionId: sessionId, useSessions: useSessions, useSettings: useSettings, setSetting: setSetting, unsetSetting: unsetSetting, t: t }) }))] }));
|
|
175
180
|
}
|
|
176
181
|
function elapsedSeconds(startedAt, now) {
|
|
177
182
|
return Math.max(0, Math.floor((now - startedAt) / 1_000));
|
|
@@ -229,7 +234,7 @@ export function ActivityLine({ sessionId, useSession, useSessions, useProjection
|
|
|
229
234
|
opacity: 0.55,
|
|
230
235
|
} }), _jsx("span", { children: label }), _jsxs("span", { style: { color: 'var(--dsw-alias-label-tertiary)' }, children: ["\u00B7 ", elapsedSeconds(activity.startedAt, now), "s"] })] }));
|
|
231
236
|
}
|
|
232
|
-
/**
|
|
237
|
+
/** Preserve both legacy controls for hosts without the additive seats. */
|
|
233
238
|
function ActivityDock(props) {
|
|
234
239
|
return (_jsxs("div", { style: {
|
|
235
240
|
display: 'flex',
|
|
@@ -256,13 +261,31 @@ export function apply(ctx) {
|
|
|
256
261
|
locale: NS,
|
|
257
262
|
inject: injected,
|
|
258
263
|
}, FastModeFallback));
|
|
259
|
-
ctx.slots.inject(
|
|
260
|
-
name:
|
|
264
|
+
ctx.slots.inject(CONTEXT_SETTINGS_SLOT, () => ctx.slots.register({
|
|
265
|
+
name: CONTEXT_SETTINGS_SLOT,
|
|
266
|
+
id: 'codex-context-size',
|
|
267
|
+
order: 0,
|
|
268
|
+
locale: NS,
|
|
269
|
+
inject: injected,
|
|
270
|
+
}, ContextSizeControl));
|
|
271
|
+
ctx.slots.inject(ACTIVITY_SLOT, () => ctx.slots.register({
|
|
272
|
+
name: ACTIVITY_SLOT,
|
|
261
273
|
id: 'codex-activity',
|
|
262
|
-
order:
|
|
274
|
+
order: 0,
|
|
263
275
|
locale: NS,
|
|
264
276
|
inject: injected,
|
|
265
|
-
},
|
|
277
|
+
}, ActivityLine));
|
|
278
|
+
ctx.slots.inject(ACTIVITY_FALLBACK_SLOT, () => {
|
|
279
|
+
if (ctx.slots.spec(ACTIVITY_SLOT) !== undefined)
|
|
280
|
+
return () => { };
|
|
281
|
+
return ctx.slots.register({
|
|
282
|
+
name: ACTIVITY_FALLBACK_SLOT,
|
|
283
|
+
id: 'codex-activity',
|
|
284
|
+
order: 5,
|
|
285
|
+
locale: NS,
|
|
286
|
+
inject: injected,
|
|
287
|
+
}, ActivityDock);
|
|
288
|
+
});
|
|
266
289
|
}
|
|
267
290
|
export default { inject, apply };
|
|
268
291
|
//# sourceMappingURL=index.js.map
|
package/lib/types/index.js
CHANGED
|
@@ -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.
|
|
3
|
+
"version": "0.1.32",
|
|
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"
|
|
@@ -237,5 +230,11 @@
|
|
|
237
230
|
"typescript": "^6.0.3",
|
|
238
231
|
"unrun": "^0.3.1",
|
|
239
232
|
"vitest": "^4.1.8"
|
|
233
|
+
},
|
|
234
|
+
"scripts": {
|
|
235
|
+
"build": "tsc --noCheck -p tsconfig.json && tsdown",
|
|
236
|
+
"check": "tsc -p tsconfig.json --noEmit",
|
|
237
|
+
"test": "vitest run",
|
|
238
|
+
"pack:check": "npm pack --dry-run"
|
|
240
239
|
}
|
|
241
|
-
}
|
|
240
|
+
}
|