neurastream 0.3.12 → 0.3.13
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/package.json +1 -1
- package/src/adapters/omp/index.ts +5 -1
- package/src/core/guards.ts +21 -3
package/package.json
CHANGED
|
@@ -32,7 +32,7 @@ import { remoteStoreFor } from "../../core/team-client.ts";
|
|
|
32
32
|
import { appendOwnerAnswer, readOwnerAnswers, readOwnerMessages } from "../../core/incidents.ts";
|
|
33
33
|
import { appendedSinceSpawn, markTopicsSpawned, ownerLogDir, recordOwnerLog } from "../../core/owner-log.ts";
|
|
34
34
|
import { topicsDue, topicsLogFile } from "../../core/owner-topics.ts";
|
|
35
|
-
import { checkInject, checkPlanEdit, checkStop, checkTool, findingsValue, MAIN_PLAN_FILE, mainId, mainStateDir, newProgressEntries, planReadNote, plannerSpawnPlan, recordMainResult, resetMainCalls, revertMainEdit, rekeySpawnFile, reviewSpawnEnd, STOP_PLAN_OFFER_REFUSAL } from "../../core/guards.ts";
|
|
35
|
+
import { checkInject, checkPlanEdit, checkStop, checkTool, findingsValue, MAIN_PLAN_FILE, mainId, mainStateDir, newProgressEntries, planReadNote, plannerSpawnPlan, recordMainResult, resetMainCalls, revertMainEdit, rekeySpawnFile, reviewSpawnEnd, STOP_PLAN_OFFER_REFUSAL, unlockMidTurnNote } from "../../core/guards.ts";
|
|
36
36
|
import { rateLimited } from "../../core/rate-limit.ts";
|
|
37
37
|
import { backPost, clearLimitState, limitMetric, limitedPost, onLimited, readLimitState, timingOf, writeLimitState } from "../../core/limit-probe.ts";
|
|
38
38
|
import { appendMetric } from "../../core/metrics.ts";
|
|
@@ -1302,6 +1302,10 @@ export function createOmpAdapter(pi: ExtensionHost, initial: Config, freshConfig
|
|
|
1302
1302
|
bash: { command: asString(asRecord(e.input).command), output: content.map(p => asString(asRecord(p).text)).join("\n") },
|
|
1303
1303
|
});
|
|
1304
1304
|
}
|
|
1305
|
+
if (!c.hasAgent || c.kind === "main") {
|
|
1306
|
+
const unlockNote = unlockMidTurnNote(cfg);
|
|
1307
|
+
if (unlockNote) notes.push(unlockNote);
|
|
1308
|
+
}
|
|
1305
1309
|
if (notes.length) return { content: [...content, ...notes.map(text => ({ type: "text", text }))] };
|
|
1306
1310
|
return undefined;
|
|
1307
1311
|
});
|
package/src/core/guards.ts
CHANGED
|
@@ -678,6 +678,14 @@ function unlockUntilMs(cfg: Config): number | null {
|
|
|
678
678
|
}
|
|
679
679
|
}
|
|
680
680
|
|
|
681
|
+
/** The unlock window end Main was last told about (prompt line or mid-turn note). */
|
|
682
|
+
let announcedUnlockUntil: number | null = null;
|
|
683
|
+
|
|
684
|
+
function unlockText(until: number): string {
|
|
685
|
+
const hhmm = new Date(until).toLocaleTimeString("en-GB", { hour: "2-digit", minute: "2-digit" });
|
|
686
|
+
return `guards: UNLOCKED until ${hhmm} — guard files are open; do the step that waited on the unlock now.`;
|
|
687
|
+
}
|
|
688
|
+
|
|
681
689
|
/**
|
|
682
690
|
* One line for Main's prompt while the owner's unlock is open. A chat "unlock" is swallowed by the
|
|
683
691
|
* input handler (the model never sees the message), so without this line Main only learns of it
|
|
@@ -685,9 +693,19 @@ function unlockUntilMs(cfg: Config): number | null {
|
|
|
685
693
|
*/
|
|
686
694
|
function unlockLine(cfg: Config): string {
|
|
687
695
|
const until = unlockUntilMs(cfg);
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
696
|
+
announcedUnlockUntil = until;
|
|
697
|
+
return until === null ? "" : `\n${unlockText(until)}`;
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
/**
|
|
701
|
+
* The same line for an unlock typed while Main's turn is running: the prompt line was built before
|
|
702
|
+
* it, so the adapter appends this to a tool result. Once per unlock; null when nothing new.
|
|
703
|
+
*/
|
|
704
|
+
export function unlockMidTurnNote(cfg: Config): string | null {
|
|
705
|
+
const until = unlockUntilMs(cfg);
|
|
706
|
+
if (until === null || until === announcedUnlockUntil) return null;
|
|
707
|
+
announcedUnlockUntil = until;
|
|
708
|
+
return unlockText(until);
|
|
691
709
|
}
|
|
692
710
|
|
|
693
711
|
function protectedHit(paths: string[], cfg: Config): string | null {
|