@shuind/dsh-codex-harness 0.1.36 → 0.1.37
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/index.js +10 -4
- package/lib/types/index.js +16 -4
- package/package.json +1 -1
package/README.md
CHANGED
package/lib/index.js
CHANGED
|
@@ -1227,16 +1227,22 @@ function syncCodexContextWindow(session, contextWindow) {
|
|
|
1227
1227
|
}
|
|
1228
1228
|
/** Keep the official context meter synchronized with a live Codex override. */
|
|
1229
1229
|
function installCodexContextProjection(ctx, current) {
|
|
1230
|
-
const sync = (session) => {
|
|
1231
|
-
syncCodexContextWindow(session,
|
|
1230
|
+
const sync = (session, contextWindow = current().contextWindow) => {
|
|
1231
|
+
syncCodexContextWindow(session, contextWindow);
|
|
1232
1232
|
};
|
|
1233
|
-
const syncAll = () => {
|
|
1233
|
+
const syncAll = (contextWindow = current().contextWindow) => {
|
|
1234
1234
|
const sessions = ctx.get("sessions");
|
|
1235
|
-
for (const session of sessions?.list?.() ?? []) sync(session);
|
|
1235
|
+
for (const session of sessions?.list?.() ?? []) sync(session, contextWindow);
|
|
1236
1236
|
};
|
|
1237
1237
|
ctx.on("session/event", (session, event) => {
|
|
1238
1238
|
if (event.type === "request/header" || event.type === "request/context") sync(session);
|
|
1239
1239
|
});
|
|
1240
|
+
ctx.on("session/created", (session) => {
|
|
1241
|
+
sync(session);
|
|
1242
|
+
});
|
|
1243
|
+
ctx.on("settings/updated", (ns, next) => {
|
|
1244
|
+
if (ns === CODEX_SETTINGS_NAMESPACE) syncAll(next.contextWindow);
|
|
1245
|
+
});
|
|
1240
1246
|
ctx.on("settings/document-updated", (ns) => {
|
|
1241
1247
|
if (ns === CODEX_SETTINGS_NAMESPACE) syncAll();
|
|
1242
1248
|
});
|
package/lib/types/index.js
CHANGED
|
@@ -165,18 +165,30 @@ export function syncCodexContextWindow(session, contextWindow) {
|
|
|
165
165
|
}
|
|
166
166
|
/** Keep the official context meter synchronized with a live Codex override. */
|
|
167
167
|
function installCodexContextProjection(ctx, current) {
|
|
168
|
-
const sync = (session) => {
|
|
169
|
-
syncCodexContextWindow(session,
|
|
168
|
+
const sync = (session, contextWindow = current().contextWindow) => {
|
|
169
|
+
syncCodexContextWindow(session, contextWindow);
|
|
170
170
|
};
|
|
171
|
-
const syncAll = () => {
|
|
171
|
+
const syncAll = (contextWindow = current().contextWindow) => {
|
|
172
172
|
const sessions = ctx.get('sessions');
|
|
173
173
|
for (const session of sessions?.list?.() ?? [])
|
|
174
|
-
sync(session);
|
|
174
|
+
sync(session, contextWindow);
|
|
175
175
|
};
|
|
176
176
|
ctx.on('session/event', (session, event) => {
|
|
177
177
|
if (event.type === 'request/header' || event.type === 'request/context')
|
|
178
178
|
sync(session);
|
|
179
179
|
});
|
|
180
|
+
// Restored sessions may already contain their request/header seed, so no
|
|
181
|
+
// session/event is emitted for the initial capacity. Catch them at the
|
|
182
|
+
// store publication boundary as well.
|
|
183
|
+
ctx.on('session/created', (session) => { sync(session); });
|
|
184
|
+
// Use the resolved value carried by the consumer-facing event. This avoids
|
|
185
|
+
// waiting for the settings source closure to refresh before synchronizing
|
|
186
|
+
// already-open sessions.
|
|
187
|
+
ctx.on('settings/updated', (ns, next) => {
|
|
188
|
+
if (ns === CODEX_SETTINGS_NAMESPACE) {
|
|
189
|
+
syncAll(next.contextWindow);
|
|
190
|
+
}
|
|
191
|
+
});
|
|
180
192
|
ctx.on('settings/document-updated', ns => {
|
|
181
193
|
if (ns === CODEX_SETTINGS_NAMESPACE)
|
|
182
194
|
syncAll();
|
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.37",
|
|
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",
|