psyclaw 0.34.0-preview.3 → 0.34.0-preview.4
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/dist/src/adapters/pi/extension.js +9 -2
- package/dist/src/adapters/pi/extension.js.map +1 -1
- package/dist/src/router/decision-model.d.ts +19 -1
- package/dist/src/router/decision-model.js +28 -3
- package/dist/src/router/decision-model.js.map +1 -1
- package/dist/src/updates/registry.js +8 -2
- package/dist/src/updates/registry.js.map +1 -1
- package/package.json +1 -1
|
@@ -1216,15 +1216,19 @@ export default function psyclawExtension(pi) {
|
|
|
1216
1216
|
const judge = async (ctx, purpose, state, a, b) => {
|
|
1217
1217
|
const started = Date.now();
|
|
1218
1218
|
const cwd = ctx.cwd;
|
|
1219
|
+
let startlux;
|
|
1219
1220
|
const note = (by, value, usage) => {
|
|
1220
1221
|
if (!cwd || !existsSync(join(cwd, ".psyclaw")))
|
|
1221
1222
|
return;
|
|
1222
1223
|
try {
|
|
1223
|
-
|
|
1224
|
+
// startlux: what the small model said to each wording (or why it did not answer), whoever decided.
|
|
1225
|
+
const small = startlux ? { status: startlux.status, ms: startlux.ms, ...(startlux.error ? { error: startlux.error } : {}), ...(startlux.a !== undefined ? { a: startlux.a, b: startlux.b } : {}) } : undefined;
|
|
1226
|
+
appendFileSync(join(cwd, ".psyclaw", "judge.jsonl"), `${JSON.stringify({ at: new Date().toISOString(), purpose, by, value: value ?? null, ms: Date.now() - started, ...(small ? { startlux: small } : {}), ...(usage ? { usage } : {}) })}\n`);
|
|
1224
1227
|
}
|
|
1225
1228
|
catch { /* the log is best effort */ }
|
|
1226
1229
|
};
|
|
1227
|
-
|
|
1230
|
+
startlux = await decider.check(purpose, state, a, b);
|
|
1231
|
+
const quick = startlux.value;
|
|
1228
1232
|
if (quick !== undefined) {
|
|
1229
1233
|
note("startlux", quick);
|
|
1230
1234
|
return quick;
|
|
@@ -1605,6 +1609,9 @@ export default function psyclawExtension(pi) {
|
|
|
1605
1609
|
if (!legacyTestApi && typeof pi.on === "function")
|
|
1606
1610
|
pi.on("session_start", async (_event, ctx) => {
|
|
1607
1611
|
arsUiContext = ctx;
|
|
1612
|
+
// Warm the decision model now (not awaited), so the first real judgment does not pay its cold start.
|
|
1613
|
+
if (decider.enabled)
|
|
1614
|
+
void decider.warm().catch(() => undefined);
|
|
1608
1615
|
if (typeof ctx.cwd === "string") {
|
|
1609
1616
|
const hasWorkspace = await hasCanonicalWorkspace(ctx.cwd).catch(() => false) || Boolean(await readActiveProject(ctx.cwd).catch(() => undefined));
|
|
1610
1617
|
startingMode = startingSessionMode(hasWorkspace);
|