fix(harness): gate kickoff/lock entry works in RPC mode (not only interactive)

- Removed event.source === "interactive" guard from entry detection so
  /nuova-domanda and /riprendi-sessione activate lockActive+pendingKickoff
  regardless of source (TUI or RPC prompt).
- Removed event.source !== "interactive" from free-input filter; lock now
  blocks/steers all user input when active, not only interactive keystrokes.
- Added typebox@1.1.38 devDep + fake_pi_runtime.registerCommand (gap from Task 2).
- New test: gate_entry.test.js (2 tests: lock activates on RPC; !-steer passes).
- Full suite: 19/19 pass, zero regressions.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-27 19:57:38 +02:00
co-authored by Claude Sonnet 4.6
parent b72183ef2a
commit c55df2ad0f
5 changed files with 59 additions and 6 deletions
+4 -5
View File
@@ -217,10 +217,8 @@ export default function (pi) {
// 2) INPUT hook: workflow entry detection + free-input block + `!` steer channel.
pi.on("input", async (event, ctx) => {
const raw = (event.text ?? "").trimStart();
if (
event.source === "interactive" &&
/^\/(nuova-domanda|riprendi-sessione)\b/.test(raw)
) {
// entry detection: workflow-start funziona sia da TUI sia da comando RPC `prompt`.
if (/^\/(nuova-domanda|riprendi-sessione)\b/.test(raw)) {
// NOTE: the source runs an ollama preflight here; ThothII defers embeddings
// readiness to the session's first vector op. Entry detection only:
lockActive = true;
@@ -229,7 +227,8 @@ export default function (pi) {
? NUOVA_DOMANDA_KICKOFF
: RIPRENDI_KICKOFF;
}
if (!lockActive || event.source !== "interactive") return { action: "continue" };
// free-input block: attivo quando il lock è su, per qualsiasi input utente (non solo interattivo).
if (!lockActive) return { action: "continue" };
const trimmed = (event.text ?? "").trimStart();
if (trimmed.length === 0) return { action: "continue" };
if (trimmed.startsWith("/")) return { action: "continue" };