@shuind/dsh-codex-harness 0.1.30 → 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 +45 -2
- package/lib/types/client/index.d.ts +17 -1
- package/lib/types/client/index.js +31 -8
- package/lib/types/index.d.ts +10 -0
- package/lib/types/index.js +57 -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
|
@@ -1200,6 +1200,48 @@ function installCodexSettings(ctx) {
|
|
|
1200
1200
|
});
|
|
1201
1201
|
return { current: () => source() };
|
|
1202
1202
|
}
|
|
1203
|
+
function hasOpenTurn(session) {
|
|
1204
|
+
const start = session.events.findLast((event) => event.type === "turn/start");
|
|
1205
|
+
const end = session.events.findLast((event) => event.type === "turn/end");
|
|
1206
|
+
return start !== void 0 && (end === void 0 || start.seq > end.seq);
|
|
1207
|
+
}
|
|
1208
|
+
/**
|
|
1209
|
+
* Pair the live Codex capacity with the token-meter context projection.
|
|
1210
|
+
*
|
|
1211
|
+
* The core loop records adapter metadata in `request/context`, while Codex's
|
|
1212
|
+
* setting is a plugin-owned request extension. Appending the override after
|
|
1213
|
+
* the loop's metadata event keeps the official ContextMeter and compaction
|
|
1214
|
+
* engine on the same effective capacity.
|
|
1215
|
+
*/
|
|
1216
|
+
function syncCodexContextWindow(session, contextWindow) {
|
|
1217
|
+
if (contextWindow === void 0 || !Number.isSafeInteger(contextWindow) || contextWindow <= 0 || !hasOpenTurn(session)) return;
|
|
1218
|
+
const config = session.requestHeader()?.config;
|
|
1219
|
+
if (typeof config?.provider !== "string" || typeof config.model !== "string" || !isGptModel(config.model)) return;
|
|
1220
|
+
const current = session.requestContext();
|
|
1221
|
+
if (current?.provider === config.provider && current.model === config.model && current.contextWindow === contextWindow) return;
|
|
1222
|
+
session.append("request/context", {
|
|
1223
|
+
provider: config.provider,
|
|
1224
|
+
model: config.model,
|
|
1225
|
+
contextWindow
|
|
1226
|
+
});
|
|
1227
|
+
}
|
|
1228
|
+
/** Keep the official context meter synchronized with a live Codex override. */
|
|
1229
|
+
function installCodexContextProjection(ctx, current) {
|
|
1230
|
+
const sync = (session) => {
|
|
1231
|
+
syncCodexContextWindow(session, current().contextWindow);
|
|
1232
|
+
};
|
|
1233
|
+
const syncAll = () => {
|
|
1234
|
+
const sessions = ctx.get("sessions");
|
|
1235
|
+
for (const session of sessions?.list?.() ?? []) sync(session);
|
|
1236
|
+
};
|
|
1237
|
+
ctx.on("session/event", (session, event) => {
|
|
1238
|
+
if (event.type === "request/header" || event.type === "request/context") sync(session);
|
|
1239
|
+
});
|
|
1240
|
+
ctx.on("settings/document-updated", (ns) => {
|
|
1241
|
+
if (ns === CODEX_SETTINGS_NAMESPACE) syncAll();
|
|
1242
|
+
});
|
|
1243
|
+
syncAll();
|
|
1244
|
+
}
|
|
1203
1245
|
/** Apply the live Codex controls to one agent request without leaking them to other routes. */
|
|
1204
1246
|
function applyCodexRequestSettings(request, settings) {
|
|
1205
1247
|
const { contextWindow: _inheritedContextWindow, serviceTier: _inheritedServiceTier, ...withoutCodexControls } = request;
|
|
@@ -1242,7 +1284,7 @@ const CODEX_BASE_PROMPT = String.raw`## General
|
|
|
1242
1284
|
`;
|
|
1243
1285
|
const CODEX_COLLABORATION_PROMPT = String.raw`## Collaboration
|
|
1244
1286
|
|
|
1245
|
-
- 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.
|
|
1246
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.
|
|
1247
1289
|
- Convey enough valuable information with as few words as possible. Stay focused on the end goal.
|
|
1248
1290
|
- Solve problems by thinking from first principles and at a higher level.
|
|
@@ -1644,6 +1686,7 @@ function apply(ctx, config = {}) {
|
|
|
1644
1686
|
watchConfiguredGptModels(ctx);
|
|
1645
1687
|
registerCodexActivityProjection(ctx);
|
|
1646
1688
|
const codexSettings = installCodexSettings(ctx);
|
|
1689
|
+
installCodexContextProjection(ctx, codexSettings.current);
|
|
1647
1690
|
ctx.on("agent/request", async (_payload, next) => {
|
|
1648
1691
|
return applyCodexRequestSettings(await next(), codexSettings.current());
|
|
1649
1692
|
});
|
|
@@ -1673,4 +1716,4 @@ var types_default = {
|
|
|
1673
1716
|
apply
|
|
1674
1717
|
};
|
|
1675
1718
|
//#endregion
|
|
1676
|
-
export { CODEX_SETTINGS_NAMESPACE, CODEX_SETTINGS_SCHEMA, Config, apply, applyCodexRequestSettings, buildCodexSystemPrompt, types_default as default, enrichCodexModel, inject, name, normalizeCodexPromptAssembly };
|
|
1719
|
+
export { CODEX_SETTINGS_NAMESPACE, CODEX_SETTINGS_SCHEMA, Config, apply, applyCodexRequestSettings, buildCodexSystemPrompt, types_default as default, enrichCodexModel, inject, name, normalizeCodexPromptAssembly, syncCodexContextWindow };
|
|
@@ -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.d.ts
CHANGED
|
@@ -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 { Session } from '@deepseek-ai/dsh-session';
|
|
5
6
|
import type { PromptAssembly } from '@deepseek-ai/dsh-system-prompt';
|
|
6
7
|
export declare const name = "codex";
|
|
7
8
|
export declare const inject: string[];
|
|
@@ -48,6 +49,15 @@ export interface CodexModelProfile {
|
|
|
48
49
|
}
|
|
49
50
|
/** Add Codex defaults without overwriting explicit user capabilities. */
|
|
50
51
|
export declare function enrichCodexModel(model: CodexModelProfile): CodexModelProfile;
|
|
52
|
+
/**
|
|
53
|
+
* Pair the live Codex capacity with the token-meter context projection.
|
|
54
|
+
*
|
|
55
|
+
* The core loop records adapter metadata in `request/context`, while Codex's
|
|
56
|
+
* setting is a plugin-owned request extension. Appending the override after
|
|
57
|
+
* the loop's metadata event keeps the official ContextMeter and compaction
|
|
58
|
+
* engine on the same effective capacity.
|
|
59
|
+
*/
|
|
60
|
+
export declare function syncCodexContextWindow(session: Session, contextWindow: number | undefined): void;
|
|
51
61
|
/** Apply the live Codex controls to one agent request without leaking them to other routes. */
|
|
52
62
|
export declare function applyCodexRequestSettings(request: CodexRequestConfig, settings: CodexSettings): CodexRequestConfig;
|
|
53
63
|
/** Put the agent persona first and omit the generic Harness identity opener. */
|
package/lib/types/index.js
CHANGED
|
@@ -128,6 +128,61 @@ function installCodexSettings(ctx) {
|
|
|
128
128
|
});
|
|
129
129
|
return { current: () => source() };
|
|
130
130
|
}
|
|
131
|
+
function hasOpenTurn(session) {
|
|
132
|
+
const start = session.events.findLast(event => event.type === 'turn/start');
|
|
133
|
+
const end = session.events.findLast(event => event.type === 'turn/end');
|
|
134
|
+
return start !== undefined && (end === undefined || start.seq > end.seq);
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Pair the live Codex capacity with the token-meter context projection.
|
|
138
|
+
*
|
|
139
|
+
* The core loop records adapter metadata in `request/context`, while Codex's
|
|
140
|
+
* setting is a plugin-owned request extension. Appending the override after
|
|
141
|
+
* the loop's metadata event keeps the official ContextMeter and compaction
|
|
142
|
+
* engine on the same effective capacity.
|
|
143
|
+
*/
|
|
144
|
+
export function syncCodexContextWindow(session, contextWindow) {
|
|
145
|
+
if (contextWindow === undefined
|
|
146
|
+
|| !Number.isSafeInteger(contextWindow)
|
|
147
|
+
|| contextWindow <= 0
|
|
148
|
+
|| !hasOpenTurn(session))
|
|
149
|
+
return;
|
|
150
|
+
const config = session.requestHeader()?.config;
|
|
151
|
+
if (typeof config?.provider !== 'string'
|
|
152
|
+
|| typeof config.model !== 'string'
|
|
153
|
+
|| !isGptModel(config.model))
|
|
154
|
+
return;
|
|
155
|
+
const current = session.requestContext();
|
|
156
|
+
if (current?.provider === config.provider
|
|
157
|
+
&& current.model === config.model
|
|
158
|
+
&& current.contextWindow === contextWindow)
|
|
159
|
+
return;
|
|
160
|
+
session.append('request/context', {
|
|
161
|
+
provider: config.provider,
|
|
162
|
+
model: config.model,
|
|
163
|
+
contextWindow,
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
/** Keep the official context meter synchronized with a live Codex override. */
|
|
167
|
+
function installCodexContextProjection(ctx, current) {
|
|
168
|
+
const sync = (session) => {
|
|
169
|
+
syncCodexContextWindow(session, current().contextWindow);
|
|
170
|
+
};
|
|
171
|
+
const syncAll = () => {
|
|
172
|
+
const sessions = ctx.get('sessions');
|
|
173
|
+
for (const session of sessions?.list?.() ?? [])
|
|
174
|
+
sync(session);
|
|
175
|
+
};
|
|
176
|
+
ctx.on('session/event', (session, event) => {
|
|
177
|
+
if (event.type === 'request/header' || event.type === 'request/context')
|
|
178
|
+
sync(session);
|
|
179
|
+
});
|
|
180
|
+
ctx.on('settings/document-updated', ns => {
|
|
181
|
+
if (ns === CODEX_SETTINGS_NAMESPACE)
|
|
182
|
+
syncAll();
|
|
183
|
+
});
|
|
184
|
+
syncAll();
|
|
185
|
+
}
|
|
131
186
|
/** Apply the live Codex controls to one agent request without leaking them to other routes. */
|
|
132
187
|
export function applyCodexRequestSettings(request, settings) {
|
|
133
188
|
const { contextWindow: _inheritedContextWindow, serviceTier: _inheritedServiceTier, ...withoutCodexControls } = request;
|
|
@@ -172,7 +227,7 @@ const CODEX_BASE_PROMPT = String.raw `## General
|
|
|
172
227
|
`;
|
|
173
228
|
const CODEX_COLLABORATION_PROMPT = String.raw `## Collaboration
|
|
174
229
|
|
|
175
|
-
- 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.
|
|
176
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.
|
|
177
232
|
- Convey enough valuable information with as few words as possible. Stay focused on the end goal.
|
|
178
233
|
- Solve problems by thinking from first principles and at a higher level.
|
|
@@ -465,6 +520,7 @@ export function apply(ctx, config = {}) {
|
|
|
465
520
|
watchConfiguredGptModels(ctx);
|
|
466
521
|
registerCodexActivityProjection(ctx);
|
|
467
522
|
const codexSettings = installCodexSettings(ctx);
|
|
523
|
+
installCodexContextProjection(ctx, codexSettings.current);
|
|
468
524
|
// Keep these controls in the request config rather than mutating provider
|
|
469
525
|
// settings. That makes a change apply to the next step without rebuilding
|
|
470
526
|
// the user's model catalog, while the LLM service still freezes it per call.
|
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
|
+
}
|