Skip to content

Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.

feat(hooks): the managed script stamps its own revision, so a stale one is visible

enes25093fd7016b
diff --git a/src/core/agent-status-mirror.ts b/src/core/agent-status-mirror.ts
index d4d275b6c..cd5130c83 100644
--- a/src/core/agent-status-mirror.ts
+++ b/src/core/agent-status-mirror.ts
@@ -69,6 +69,17 @@ export interface MirrorEntry {
* about a state that has since changed.
*/
stateVerified?: boolean
+ /**
+ * The revision of the managed hook script that posted the event behind the current `state`
+ * (`ev.clientRevision`). `undefined` = no stamp, which is what a script predating per-node
+ * identity sends — and the ONLY thing that separates "this session cannot read a token" from
+ * "there is no token for it to read". Those need opposite advice, and before the stamp existed
+ * they were byte-identical on the wire (Finding F2).
+ *
+ * Written on the same edge as `stateVerified` and, like it, moves DOWN as readily as up: an SSH
+ * project reconnected against an older desktop really is running an older script now.
+ */
+ clientRevision?: number
/** When proof was last seen at all. Never cleared by a later legacy event — "we once saw this
* node prove itself" stays true, and it is what separates a node that CAN verify (retryable)
* from one that never has (not retryable). See the plan's Correction C1 mitigation. */
@@ -382,6 +393,10 @@ export function reduceEntry(
// not change the state whose proof this describes.
next.stateVerified = ev.verified === true
if (ev.verified === true) next.verifiedAt = now
+ // Same edge, and ASSIGNED rather than merged: an event with no stamp is a report that this
+ // node is running a script that cannot send one, which is exactly the state a stale entry
+ // would hide.
+ next.clientRevision = ev.clientRevision
}
} else if (ev.kind === 'session') {
// SessionStart / SessionEnd both reset the node to idle (renderer: setState(id, undefined)).
diff --git a/src/core/agents/hook-curl-config-sh.ts b/src/core/agents/hook-curl-config-sh.ts
index 48b5728dc..cda847079 100644
--- a/src/core/agents/hook-curl-config-sh.ts
+++ b/src/core/agents/hook-curl-config-sh.ts
@@ -13,7 +13,8 @@
* since the 1990s, and a silent downgrade to argv would be the leak wearing a compatibility hat.
*
* ONE COPY OF THE ESCAPING RULE, FOUR CLIENTS: the managed hook script, the canvas-control shim
- * and the context-link shim all send the same two hook headers (`HOOK_CURL_HEADERS_SH` below);
+ * and the context-link shim all send the same hook headers (`HOOK_CURL_HEADERS_SH` below — two
+ * credentials plus the client stamp, which only the managed script fills in);
* the SSH askpass helper in `main/remote-ssh/ssh-askpass.ts` sends a different, single header and
* builds its own emitter from `curlHeaderConfigSh`. They all go through `headerLine`, because four
* copies of a quoting rule is how one of them stays wrong.
@@ -95,9 +96,16 @@ export const HOOK_CURL_HEADERS_SH = curlHeaderConfigSh(
// The caller's variable (each client reads it from the token dir the endpoint file advertises,
// keyed by its own node id) — read here, not passed, because the failover in the managed
// script RE-READS it between POSTs and the emitter must see the current value.
- { name: 'X-Nodeterm-Node-Token', valueRef: '$nt_node_token' }
+ { name: 'X-Nodeterm-Node-Token', valueRef: '$nt_node_token' },
+ // WHICH CLIENT is speaking. Set by the managed hook script (`nt_client_rev`, its own revision
+ // constant); EMPTY — and therefore dropped by curl, exactly like an absent node token — for the
+ // canvas-control and context-link shims, which are different clients with their own lifecycles
+ // and which the server does not read this header from. It is here rather than in a fourth
+ // emitter for the reason the docblock above gives: one copy of the escaping rule, and one place
+ // that guarantees a header rides stdin.
+ { name: 'X-Nodeterm-Hook-Client', valueRef: '$nt_client_rev' }
],
- `# Both credentials go to curl on STDIN as a config file, never in argv: a command line is
+ `# Every header goes to curl on STDIN as a config file, never in argv: a command line is
# world-readable through \`ps\` / /proc/<pid>/cmdline for the life of the process, locally and on
# every SSH host, so an argv header hands the app-wide bearer — and this node's own capability —
# to any co-tenant who looks at the process table. Reading another node's token out of \`ps\` is
diff --git a/src/core/agents/hook-server.ts b/src/core/agents/hook-server.ts
index cc7ac7725..ee0a442be 100644
--- a/src/core/agents/hook-server.ts
+++ b/src/core/agents/hook-server.ts
@@ -123,6 +123,21 @@ export function parseControlBody(
}
}
+/**
+ * `X-Nodeterm-Hook-Client` → the posting script's revision, or `undefined`.
+ *
+ * Strict on purpose: only an unsigned decimal integer counts. Anything else — a version string
+ * someone thought would be friendlier, a duplicated header (node hands those over as an array,
+ * which is not a string and so lands here as undefined), an empty value — is "no stamp", which is
+ * the same answer a pre-#195 script gives. Guessing a number out of "v3-beta" would be inventing
+ * evidence for a gate.
+ */
+function parseClientRevision(raw: string | string[] | undefined): number | undefined {
+ if (typeof raw !== 'string' || !/^\d+$/.test(raw.trim())) return undefined
+ const n = Number(raw.trim())
+ return Number.isSafeInteger(n) ? n : undefined
+}
+
/**
* What the hook server knows about the POST an event arrived on, beyond the event itself.
*
@@ -545,6 +560,13 @@ class HookServer {
}
const verified = verdict === 'verified'
if (verified) this.provenNodes.add(nodeId)
+ // WHICH CLIENT posted. A LABEL like `verified`, and for the same reason a second one was
+ // needed: an old managed script and a current one whose token file is missing send exactly
+ // the same bytes otherwise (the `version` form field is sourced from the endpoint file, so
+ // it reports OUR protocol version, not the client's). Absent or unparseable stays
+ // `undefined` — never 0 — because "no stamp" and "revision zero" are different claims and
+ // only the first one is true of a pre-#195 script.
+ const clientRevision = parseClientRevision(req.headers['x-nodeterm-hook-client'])
if (agentId && nodeId && form.payload) {
let payload: Record<string, unknown> = {}
try {
@@ -566,7 +588,7 @@ class HookServer {
// transcript_path). Inside the try so a throwing raw listener still ends 204.
this.rawListener?.(agentId, nodeId, payload, { verified })
const normalized = normalizeFor(agentId, { nodeId, agentId, payload })
- if (normalized && this.listener) this.listener({ ...normalized, verified })
+ if (normalized && this.listener) this.listener({ ...normalized, verified, clientRevision })
}
res.writeHead(204)
res.end()
diff --git a/src/core/agents/hooks/managed-script.test.ts b/src/core/agents/hooks/managed-script.test.ts
index 35f4ccf43..075515c07 100644
--- a/src/core/agents/hooks/managed-script.test.ts
+++ b/src/core/agents/hooks/managed-script.test.ts
@@ -3,7 +3,7 @@ import { mkdirSync, mkdtempSync, readFileSync, writeFileSync, rmSync, utimesSync
import { tmpdir } from 'node:os'
import { join } from 'node:path'
import { afterAll, beforeAll, beforeEach, describe, expect, it } from 'vitest'
-import { buildManagedScript } from './managed-script'
+import { buildManagedScript, MANAGED_SCRIPT_REVISION } from './managed-script'
import { hookServer } from '../hook-server'
import { nodeAuthToken } from '../node-auth-token'
import { initPlatform, resetPlatformForTests } from '../../platform'
@@ -43,6 +43,18 @@ describe('buildManagedScript', () => {
expect((s.match(/--config -/g) ?? []).length).toBe(4)
})
+ it('stamps its own revision on every POST, through the same stdin emitter', () => {
+ // Finding F2: the `version` field below is sourced from the ENDPOINT FILE, so it reports the
+ // SERVER's protocol version and can never answer "which client is this?". Without the stamp an
+ // old script and a current one with a missing token file are byte-identical on the wire.
+ expect(s).toContain(`nt_client_rev=${MANAGED_SCRIPT_REVISION}`)
+ expect(s).toContain('printf \'header = "X-Nodeterm-Hook-Client: %s"')
+ expect(s).not.toContain('-H "X-Nodeterm-Hook-Client')
+ // Set once, at the top — not inside any function, and in particular not where the failover
+ // clears the vars that belong to the endpoint rather than to this file.
+ expect((s.match(/nt_client_rev=/g) ?? []).length).toBe(1)
+ })
+
describe('deterministic hook-reply approvals (PermissionRequest wait branch)', () => {
it('gates the wait branch on NODETERM_PERM_WAIT_SECS > 0', () => {
expect(s).toContain('[ -n "$NODETERM_PERM_WAIT_SECS" ] && [ "$NODETERM_PERM_WAIT_SECS" -gt 0 ]')
@@ -333,6 +345,11 @@ describe('buildManagedScript endpoint failover, executed under /bin/sh', () => {
expect(calls[0].cfg).toContain('header = "X-Nodeterm-Node-Token: PRIMARY-NODE-TOKEN"')
expect(calls[1].cfg).toContain('header = "X-Nodeterm-Node-Token: FALLBACK-NODE-TOKEN"')
expect(calls[1].cfg).not.toContain('PRIMARY-NODE-TOKEN')
+ // The client stamp is a property of THIS SCRIPT, so it survives the endpoint switch that
+ // clears sock/port/token-dir — on both legs, with the same value.
+ for (const c of calls) {
+ expect(c.cfg).toContain(`header = "X-Nodeterm-Hook-Client: ${MANAGED_SCRIPT_REVISION}"`)
+ }
}
)
diff --git a/src/core/agents/hooks/managed-script.ts b/src/core/agents/hooks/managed-script.ts
index dd3594366..4abccc45d 100644
--- a/src/core/agents/hooks/managed-script.ts
+++ b/src/core/agents/hooks/managed-script.ts
@@ -60,6 +60,29 @@ import { codexThreadIdentityResolverSh } from '../../codex-thread-identity-sh'
import { codexThreadIdentityRoot } from '../../codex-identity-proxy'
import { HOOK_CURL_HEADERS_SH } from '../hook-curl-config-sh'
+/**
+ * Bumped by hand whenever this script's CONTRACT with the server changes. Not a git sha and not a
+ * date: the server COMPARES it (`>= MIN_TOKEN_AWARE_REVISION`), and a sha does not order.
+ *
+ * WHY THIS EXISTS AT ALL. Before it, an old script and a current script whose token file happened to
+ * be missing were byte-identical on the wire: both POST `version=2` (that field is sourced from the
+ * ENDPOINT FILE, so it reports the server's protocol version, never the client's) and neither sends
+ * an X-Nodeterm-Node-Token header. The server therefore could not distinguish "this session cannot
+ * read a token" from "there is no token to read" — and those need OPPOSITE advice. Messaging's gate
+ * 2 would have told an SSH-only host's session to retry after its next turn, forever.
+ *
+ * Two stale windows this makes visible, and they are ONE mechanism:
+ * - LOCAL: none in practice. install-helper.ts rewrites the script unconditionally at every boot
+ * of both shells, so a host running nodeterm is current as of its last start.
+ * - REMOTE: real. remote-hooks.ts writes it only inside RemoteHooks.setup(), which runs on
+ * CONNECT. An already-connected project keeps the script it was given, so its remote nodes —
+ * and any session the PHONE spawns on that host, which runs the host's installed script — stay
+ * `legacy` until the project reconnects.
+ */
+export const MANAGED_SCRIPT_REVISION = 3
+/** The first revision that reads NODETERM_NODE_TOKEN_DIR and sends the node token (PR #195). */
+export const MIN_TOKEN_AWARE_REVISION = 3
+
function safeIdentityRoot(): string | null {
try {
return codexThreadIdentityRoot()
@@ -78,6 +101,13 @@ export function buildManagedScript(
'if [ -n "$NODETERM_HOOK_ENDPOINT" ] && [ -r "$NODETERM_HOOK_ENDPOINT" ]; then',
' . "$NODETERM_HOOK_ENDPOINT" 2>/dev/null || :',
'fi',
+ '# THIS SCRIPT\'s revision, stamped on every POST (X-Nodeterm-Hook-Client) so the server can tell',
+ '# a session running a pre-identity script from one whose token file is merely missing — they',
+ '# used to be byte-identical on the wire, because the `version` field below comes from the',
+ '# ENDPOINT FILE and therefore reports the SERVER\'s protocol version, never the client\'s.',
+ '# Deliberately set HERE, outside nt_pick_fallback\'s clearing block: sock/port/token-dir belong',
+ '# to whichever endpoint we adopt, but the revision is a property of this file on this disk.',
+ `nt_client_rev=${MANAGED_SCRIPT_REVISION}`,
'# The PER-NODE capability. The endpoint file (v2) advertises the directory; the token itself is',
'# one file in it named for THIS node id — a lookup by name, never a scan, so a session can only',
'# ever present its own. Absent (pre-v2 endpoint, pre-upgrade session, remote write that failed)',
diff --git a/src/core/agents/managed-script-revision.test.ts b/src/core/agents/managed-script-revision.test.ts
new file mode 100644
index 000000000..d9b210a44
--- /dev/null
+++ b/src/core/agents/managed-script-revision.test.ts
@@ -0,0 +1,130 @@
+// Finding F2: an old managed script and a current one whose token file is merely missing were
+// BYTE-IDENTICAL on the wire. The POST's `version` field is sourced from the ENDPOINT FILE
+// (hook-server writes NODETERM_HOOK_VERSION into it), so it reports the SERVER's protocol version
+// and says nothing about the client; and neither case sends a node-token header. The two need
+// OPPOSITE advice — "reconnect the project / restart the app" vs "retry after its next turn" — so
+// until the client stamped itself, one of those answers was permanently wrong.
+import { describe, it, expect, beforeAll, afterAll, beforeEach } from 'vitest'
+import { mkdtempSync, rmSync } from 'node:fs'
+import { tmpdir } from 'node:os'
+import { join } from 'node:path'
+import {
+ buildManagedScript,
+ MANAGED_SCRIPT_REVISION,
+ MIN_TOKEN_AWARE_REVISION
+} from './hooks/managed-script'
+import { hookServer } from './hook-server'
+import { initPlatform, resetPlatformForTests } from '../platform'
+import { fakePlatform } from '../platform-fake'
+import { reduceEntry } from '../agent-status-mirror'
+import type { NormalizedAgentEvent } from '../../shared/agents/normalize'
+
+describe('the managed script stamps its own revision', () => {
+ it('emits the client header, on STDIN via the shared config emitter — never argv', () => {
+ const s = buildManagedScript('claude', null)
+ expect(s).toContain(`X-Nodeterm-Hook-Client: %s`)
+ expect(s).toContain(`nt_client_rev=${MANAGED_SCRIPT_REVISION}`)
+ // Global Constraint 6: no new -H anywhere. A revision is not a credential, but the rule is
+ // "every hook header goes through the one emitter", and an argv exception is how the next one
+ // gets added beside it.
+ expect(s).not.toMatch(/-H\s+["']X-Nodeterm/)
+ })
+
+ it('the revision is comparable, and the token-aware floor is at or below it', () => {
+ expect(Number.isInteger(MANAGED_SCRIPT_REVISION)).toBe(true)
+ expect(MIN_TOKEN_AWARE_REVISION).toBeLessThanOrEqual(MANAGED_SCRIPT_REVISION)
+ })
+
+ it('the script survives the failover with its stamp intact', () => {
+ // nt_pick_fallback clears SOCK/PORT/NODE_TOKEN_DIR because those belong to the adopted
+ // instance. The client revision is a property of THIS SCRIPT and must NOT be cleared.
+ const s = buildManagedScript('claude', null)
+ const fb = s.slice(s.indexOf('nt_pick_fallback()'), s.indexOf('nt_request_post()'))
+ expect(fb).not.toContain('nt_client_rev=')
+ // And it is assigned before the emitter that reads it is ever called.
+ expect(s.indexOf('nt_client_rev=')).toBeLessThan(s.indexOf('nt_hook_headers() {'))
+ })
+})
+
+describe('the hook server can now tell a stale script from a missing token', () => {
+ const SECRET = Buffer.alloc(32, 7)
+ let dir = ''
+ let events: NormalizedAgentEvent[] = []
+
+ function post(headers: Record<string, string>): Promise<Response> {
+ const payload = JSON.stringify({ hook_event_name: 'Stop', session_id: 's1' })
+ return fetch(`http://127.0.0.1:${hookServer.getPort()}/hook/claude`, {
+ method: 'POST',
+ headers: {
+ 'X-Nodeterm-Hook-Token': hookServer.getToken(),
+ 'content-type': 'application/x-www-form-urlencoded',
+ ...headers
+ },
+ body: `nodeId=n1&payload=${encodeURIComponent(payload)}`
+ })
+ }
+
+ beforeAll(async () => {
+ dir = mkdtempSync(join(tmpdir(), 'hook-client-rev-'))
+ resetPlatformForTests()
+ initPlatform(fakePlatform({ userDataDir: dir }))
+ await hookServer.start()
+ hookServer.setNodeAuthSecret(SECRET)
+ hookServer.setListener((e) => events.push(e))
+ })
+
+ afterAll(() => {
+ hookServer.clearNodeAuthSecretForTests()
+ hookServer.setListener(() => {})
+ hookServer.stop()
+ rmSync(dir, { recursive: true, force: true })
+ })
+
+ beforeEach(() => {
+ events = []
+ })
+
+ it('records the client revision on the mirror entry', async () => {
+ const res = await post({ 'X-Nodeterm-Hook-Client': String(MANAGED_SCRIPT_REVISION) })
+ expect(res.status).toBe(204)
+ expect(events).toHaveLength(1)
+ expect(events[0].clientRevision).toBe(MANAGED_SCRIPT_REVISION)
+ expect(reduceEntry(undefined, events[0], 1000).clientRevision).toBe(MANAGED_SCRIPT_REVISION)
+ })
+
+ it('leaves it UNDEFINED — never 0 — when the header is absent', async () => {
+ // A pre-#195 script sends nothing. `undefined` and `0` would be read the same way by the gate
+ // (both below MIN_TOKEN_AWARE_REVISION), but the trace must not claim we saw a revision zero.
+ expect((await post({})).status).toBe(204)
+ expect(events[0].clientRevision).toBeUndefined()
+ expect(reduceEntry(undefined, events[0], 1000).clientRevision).toBeUndefined()
+ })
+
+ it('leaves it undefined for a header that is not an integer', async () => {
+ expect((await post({ 'X-Nodeterm-Hook-Client': 'v3-beta' })).status).toBe(204)
+ expect(events[0].clientRevision).toBeUndefined()
+ })
+
+ it('never lets the stamp itself become a gate — a stale client still posts, 204, listeners fired', async () => {
+ // The fail-open contract is the whole route's contract, and it is not weakened by making the
+ // client visible: an ANCIENT revision is data for the refusal message, never a refusal here.
+ expect((await post({ 'X-Nodeterm-Hook-Client': '1' })).status).toBe(204)
+ expect(events).toHaveLength(1)
+ expect(events[0].clientRevision).toBe(1)
+ expect(events[0].nodeId).toBe('n1')
+ })
+
+ it('the mirror keeps the stamp on the same edge it keeps the proof, and forgets neither', () => {
+ const ev = (o: Partial<NormalizedAgentEvent>): NormalizedAgentEvent =>
+ ({ kind: 'state', agentId: 'claude', nodeId: 'n1', ...o }) as NormalizedAgentEvent
+ const a = reduceEntry(undefined, ev({ state: 'done', verified: true, clientRevision: 3 }), 1000)
+ expect(a.clientRevision).toBe(3)
+ // A later event from a DOWNGRADED client (the SSH project reconnected against an older
+ // desktop) must move the recorded revision down, not keep the flattering one.
+ const b = reduceEntry(a, ev({ state: 'working', newTurn: true, clientRevision: 1 }), 2000)
+ expect(b.clientRevision).toBe(1)
+ // And an event with no stamp at all clears it: that IS the pre-#195 client, reporting.
+ const c = reduceEntry(b, ev({ state: 'done' }), 3000)
+ expect(c.clientRevision).toBeUndefined()
+ })
+})
diff --git a/src/core/agents/phone-spawned-identity.test.ts b/src/core/agents/phone-spawned-identity.test.ts
index 7d2b4ea2d..20aca9749 100644
--- a/src/core/agents/phone-spawned-identity.test.ts
+++ b/src/core/agents/phone-spawned-identity.test.ts
@@ -28,7 +28,11 @@ import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs'
import { tmpdir } from 'node:os'
import { join } from 'node:path'
import { afterAll, beforeAll, beforeEach, describe, expect, it } from 'vitest'
-import { buildManagedScript } from './hooks/managed-script'
+import {
+ buildManagedScript,
+ MANAGED_SCRIPT_REVISION,
+ MIN_TOKEN_AWARE_REVISION
+} from './hooks/managed-script'
import { nodeAuthToken, verifyNodeToken } from './node-auth-token'
const SECRET = Buffer.alloc(32, 7)
@@ -208,4 +212,54 @@ describe('a phone-spawned session presents its per-node token', () => {
expect(post.headers['x-nodeterm-node-token'] ?? '').toBe('')
})
+ // ---- Finding F2: the client stamp, on the same wire, from the same phone-shaped env ----------
+
+ it.skipIf(!available)('stamps its own revision beside the node token', async () => {
+ const tokens = tokenDirWith('tokens-4', { 'phone-1': nodeAuthToken(SECRET, 'phone-1') })
+ const ep = endpointFile('hook-endpoint-4.env', tokens)
+ const script = writeScript('hook-4.sh', buildManagedScript('claude', null))
+
+ expect(await runPhoneHook(script, newHome('home-4'), 'phone-1', ep)).toBe(0)
+ const post = await nextPost()
+
+ expect(post.headers['x-nodeterm-hook-client']).toBe(String(MANAGED_SCRIPT_REVISION))
+ expect(Number(post.headers['x-nodeterm-hook-client'])).toBeGreaterThanOrEqual(
+ MIN_TOKEN_AWARE_REVISION
+ )
+ expect(post.headers['x-nodeterm-node-token']).toBeTruthy()
+ // The `version` field is the SERVER's protocol version, sourced from the endpoint file — which
+ // is exactly why it could never answer "what is the client?" and the stamp had to exist.
+ expect(post.body).toContain('version=2')
+ })
+
+ it.skipIf(!available)(
+ 'an OLDER script sends neither header — so a stale script and a missing token are now distinguishable',
+ async () => {
+ // A pre-#195 build, constructed from the current one by removing the two things it did not
+ // have: the token read and the revision stamp. Both header values are then empty, curl drops
+ // both, and the POST is byte-identical to what such a build really sent.
+ const tokens = tokenDirWith('tokens-5', { 'phone-1': nodeAuthToken(SECRET, 'phone-1') })
+ const ep = endpointFile('hook-endpoint-5.env', tokens)
+ const current = buildManagedScript('claude', null)
+ const old = current
+ // Blanked rather than deleted: an empty header value is dropped by curl, so the wire is
+ // byte-identical to a script that never had the line — while the generated sh stays valid
+ // (deleting the assignment would leave an empty `if … then fi`, and a script that fails to
+ // parse proves nothing about what a real old script sent).
+ .replace(/nt_node_token=\$\(head -n 1[^\n]*/, 'nt_node_token=""')
+ .replace(/nt_client_rev=\d+\n/, '')
+ expect(old).not.toContain('nt_client_rev=')
+ expect(old).not.toContain('$NODETERM_NODE_TOKEN_DIR/$NODETERM_NODE_ID')
+ const script = writeScript('hook-5.sh', old)
+
+ expect(await runPhoneHook(script, newHome('home-5'), 'phone-1', ep)).toBe(0)
+ const post = await nextPost()
+
+ expect(post.body).toContain('nodeId=phone-1')
+ // The defect, stated as an assertion: the token header is absent HERE for a different reason
+ // than in the "no token file" case above — and only the client stamp tells them apart.
+ expect(post.headers['x-nodeterm-node-token'] ?? '').toBe('')
+ expect(post.headers['x-nodeterm-hook-client'] ?? '').toBe('')
+ }
+ )
})
diff --git a/src/shared/agents/normalize.ts b/src/shared/agents/normalize.ts
index 579edf379..5d1d7ea8e 100644
--- a/src/shared/agents/normalize.ts
+++ b/src/shared/agents/normalize.ts
@@ -61,6 +61,19 @@ export interface NormalizedAgentEvent {
* phone, and the documented cross-instance failover, so no consumer may treat it as "reject".
*/
verified?: boolean
+ /**
+ * The revision of the managed hook script that posted this event (`MANAGED_SCRIPT_REVISION`,
+ * sent as `X-Nodeterm-Hook-Client`). Set by the hook server, never by a normalizer.
+ *
+ * `undefined` means the client sent no stamp — a script that predates the header, i.e. one that
+ * also predates per-node identity. That is a DISTINCT state from `verified: false`, and telling
+ * them apart is the entire point: a session with no token file needs "retry after its next turn",
+ * a session running an old script needs "reconnect the project / restart the app", and before
+ * this field the two were indistinguishable on the wire.
+ *
+ * Like `verified` it is a LABEL: nothing may refuse a POST because of it.
+ */
+ clientRevision?: number
// recurring
recurringKind?: 'loop' | 'schedule' | 'cron'
/** The recurring job was REMOVED (e.g. CronDelete) — take the card down. */