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.
@@ -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
- appendFileSync(join(cwd, ".psyclaw", "judge.jsonl"), `${JSON.stringify({ at: new Date().toISOString(), purpose, by, value: value ?? null, ms: Date.now() - started, ...(usage ? { usage } : {}) })}\n`);
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
- const quick = decider.enabled ? await decider.decide(purpose, state, a, b) : undefined;
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);