@zeph-to/cli 2.2.0 → 2.3.0

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.
@@ -51,6 +51,40 @@ interface AgentSession {
51
51
  * client-side skip can never suppress a report the server would have
52
52
  * treated as a change. Keep the field list in sync with the server.
53
53
  */
54
+ /**
55
+ * Sessions this machine has run and is not running now, as the phone's "past
56
+ * sessions" list.
57
+ *
58
+ * The list used to be derived on the phone from a page of recent pushes, which
59
+ * answered a different question than the one being asked: not "which sessions
60
+ * existed on this machine" but "what is in the newest fifty pushes". A busy day
61
+ * pushed real sessions out of that window while sessions the daemon had never
62
+ * recorded stayed in it — so the list and the resume button disagreed in both
63
+ * directions, offering rows that could not start and hiding rows that could.
64
+ *
65
+ * The registry is the machine's own answer to that question, and the same
66
+ * record resume reads, so a row that appears here is a row that can start.
67
+ *
68
+ * `cwd` is deliberately left behind. The registry keeps it because resume needs
69
+ * somewhere to start the agent; nothing off this machine needs a filesystem
70
+ * path, and sending one would hand the relay a map of the user's disk for no
71
+ * behaviour in return.
72
+ *
73
+ * Live sessions are excluded, which the phone would do anyway — but doing it
74
+ * here also keeps the payload still. Their `lastSeenAt` moves every sweep, and
75
+ * a field that changes every five seconds would defeat the report's
76
+ * unchanged-inventory gate and write to the device record all day.
77
+ */
78
+ export declare const KNOWN_SESSIONS_REPORTED = 30;
79
+ export interface ReportedKnownSession {
80
+ name: string;
81
+ agentKind: string;
82
+ project?: string;
83
+ label?: string;
84
+ lastSeenAt: string;
85
+ }
86
+ export declare const knownSessionsToReport: (live: readonly AgentSession[], now?: number) => ReportedKnownSession[];
87
+ export declare const knownSessionsFingerprint: (known: ReportedKnownSession[]) => string;
54
88
  export declare const sessionsFingerprint: (sessions: AgentSession[]) => string;
55
89
  /** True when this cycle's inventory must be sent: it changed, or the
56
90
  * idle heartbeat is due. */
@@ -159,6 +193,161 @@ export interface ScreenSnapshot {
159
193
  * token bucket as command injection.
160
194
  */
161
195
  export declare const handleScreenRequest: (req: ScreenRequest) => ScreenSnapshot | null;
196
+ /** Ceiling on one page of patch text. Shares the frame budget the pane
197
+ * snapshots use: a diff is routinely megabytes, so paging is in the contract
198
+ * from the start rather than bolted on later. */
199
+ export declare const DIFF_PAGE_MAX_BYTES: number;
200
+ export interface DiffFilesRequest {
201
+ subtype?: string;
202
+ targetDeviceId?: string;
203
+ sessionName?: string;
204
+ requestId?: string;
205
+ /** Seals the answer for this key when present, exactly as a stream frame is
206
+ * sealed for its subscriber. Absent = the caller has no device key. */
207
+ subscriberPublicKey?: string;
208
+ }
209
+ export interface DiffFileRequest extends DiffFilesRequest {
210
+ /** Repo-relative path of the file to read. The only caller-supplied value
211
+ * that reaches git, and only after the checks in resolveInRepo. */
212
+ path?: string;
213
+ /** Byte offset into this file's patch — paging, since one patch can dwarf
214
+ * the frame limit on its own. */
215
+ offset?: number;
216
+ }
217
+ export interface DiffFileEntry {
218
+ path: string;
219
+ /** Porcelain status letter: M, A, D, R, ? for untracked. */
220
+ status: string;
221
+ added: number;
222
+ removed: number;
223
+ }
224
+ /**
225
+ * Answer "what changed in this session's repo".
226
+ *
227
+ * Every argument is constant: the request contributes a session name, which
228
+ * selects a directory from the registry, and nothing else reaches git.
229
+ */
230
+ export declare const handleDiffFilesRequest: (req: DiffFilesRequest, send: (data: Record<string, unknown>) => void) => boolean;
231
+ /**
232
+ * Answer one file's patch, one page at a time.
233
+ *
234
+ * The path is the only caller-supplied value that reaches git, and it reaches
235
+ * it as its own argv entry after `--`, having been resolved against the repo
236
+ * root and checked through symlinks first.
237
+ */
238
+ export declare const handleDiffFileRequest: (req: DiffFileRequest, send: (data: Record<string, unknown>) => void) => boolean;
239
+ export interface SessionResumeRequest {
240
+ subtype?: string;
241
+ targetDeviceId?: string;
242
+ sessionName?: string;
243
+ requestId?: string;
244
+ }
245
+ export interface SessionResumeResult {
246
+ subtype: 'agent.session.resume.result';
247
+ requestId: string;
248
+ sessionName: string;
249
+ resumed?: true;
250
+ error?: string;
251
+ at: string;
252
+ }
253
+ /**
254
+ * Start a remembered session again, detached, and tell the phone what happened.
255
+ * Returns true when the message was ours to answer.
256
+ *
257
+ * The refusals are the design. Unknown name: not in the registry, so there is
258
+ * nothing to start and nothing to guess from. Missing directory: the project
259
+ * moved or was deleted, and starting an agent in the wrong place is worse than
260
+ * not starting one. Unknown agent kind: the record names an agent this build
261
+ * has no binary for — a wire enum outlives installs, and a guess here would be
262
+ * a command nobody chose. Already running: the session is live and the phone
263
+ * should be watching it, not replacing it.
264
+ */
265
+ export declare const handleSessionResumeRequest: (req: SessionResumeRequest, send: (data: Record<string, unknown>) => void) => boolean;
266
+ export interface SessionExitRequest {
267
+ subtype?: string;
268
+ targetDeviceId?: string;
269
+ sessionName?: string;
270
+ requestId?: string;
271
+ }
272
+ export interface SessionExitResult {
273
+ subtype: 'agent.session.exit.result';
274
+ requestId: string;
275
+ sessionName: string;
276
+ exited?: true;
277
+ error?: string;
278
+ at: string;
279
+ }
280
+ /** Time given to each signal before the next one is tried. */
281
+ export declare const SESSION_EXIT_STEP_MS = 1500;
282
+ /**
283
+ * Ask a session to end, and report whether it did.
284
+ *
285
+ * Answers late on purpose: the whole point is to let the agent wind itself
286
+ * down, so the reply has to wait long enough to know whether it did. A session
287
+ * that is still there when the signals run out is reported as still there
288
+ * rather than forced — "I asked and it refused" is a true answer, and a phone
289
+ * that can silently destroy a working agent is a worse thing to have built.
290
+ */
291
+ export declare const handleSessionExitRequest: (req: SessionExitRequest, send: (data: Record<string, unknown>) => void) => boolean;
292
+ /** Ceiling on one page. A page past the frame limit arrives truncated anyway,
293
+ * so let the caller ask for less rather than pay for a capture we discard. */
294
+ export declare const SCREEN_HISTORY_MAX_LINES = 200;
295
+ export interface ScreenHistoryRequest {
296
+ subtype?: string;
297
+ targetDeviceId?: string;
298
+ sessionName?: string;
299
+ requestId?: string;
300
+ /**
301
+ * How many lines of scrollback the caller already holds above the visible
302
+ * pane — the `historyLines` of its newest frame plus every history line it
303
+ * has pulled since. 0 asks for the page directly above the visible pane.
304
+ *
305
+ * The caller says this rather than the daemon assuming STREAM_CAPTURE_LINES,
306
+ * because the byte cap trims frames from the top and a caller holding fewer
307
+ * lines than the capture asked for would otherwise be handed a page that
308
+ * starts above its own content, with the gap unreachable forever after.
309
+ * Absent falls back to the constant — the untruncated case.
310
+ */
311
+ before?: number;
312
+ /** Page size. Clamped to SCREEN_HISTORY_MAX_LINES. */
313
+ lines?: number;
314
+ }
315
+ export interface ScreenHistorySnapshot {
316
+ subtype: 'agent.screen.history.snapshot';
317
+ requestId: string;
318
+ sessionName: string;
319
+ content?: string;
320
+ /** Echo of the request's offset, so a caller with several pages in flight
321
+ * can tell which one this is. */
322
+ before?: number;
323
+ /** Lines actually returned — what the caller adds to `before` for the next
324
+ * page. Smaller than asked when the payload cap trimmed the page. */
325
+ lines?: number;
326
+ /** Whether older lines still exist above this page. */
327
+ hasMore?: boolean;
328
+ truncated?: boolean;
329
+ /** The page sealed for the stream's subscriber — present INSTEAD of
330
+ * `content` whenever the stream it belongs to is encrypted. */
331
+ encrypted?: EncryptedEphemeralPayload;
332
+ error?: string;
333
+ capturedAt: string;
334
+ }
335
+ /**
336
+ * Answer a phone's request for one page of scrollback above the live window.
337
+ * Returns true when the message was ours to answer, so the caller stops routing
338
+ * it; the reply goes out through `send`, after the seal when there is one.
339
+ *
340
+ * Same security posture as the one-shot peek it sits beside — addressed to this
341
+ * machine, only for sessions the inventory already exposes, charged to the same
342
+ * per-session token bucket, and reading the pane through tmux and nothing else —
343
+ * plus one the peek does not have: it answers ONLY under a live stream lease.
344
+ * That is what makes E2EE possible here. History is the same pane text the
345
+ * frames carry, so on an encrypted stream it is sealed for the same subscriber
346
+ * key and never falls back to plaintext; without a lease there is no key to
347
+ * seal for, and a pull that answered anyway would be the downgrade the stream
348
+ * half refuses.
349
+ */
350
+ export declare const handleScreenHistoryRequest: (req: ScreenHistoryRequest, send: (data: Record<string, unknown>) => void) => boolean;
162
351
  /**
163
352
  * Translate the cursor into an index into the lines the frame carries.
164
353
  *
@@ -175,6 +364,17 @@ export declare const cursorLineFor: (content: string, cursor: {
175
364
  line: number;
176
365
  col: number;
177
366
  } | null;
367
+ /**
368
+ * How many of a frame's lines are scrollback rather than the visible pane.
369
+ *
370
+ * This is the number the viewer hands back as `before` when it asks for
371
+ * history. STREAM_CAPTURE_LINES is only what the capture ASKED for: the byte
372
+ * cap trims from the top, and a coloured TUI pane hits that cap routinely, so
373
+ * assuming the viewer holds the full window would start the first history page
374
+ * above what it actually has — leaving a gap no later page can reach, since
375
+ * every later page walks further up.
376
+ */
377
+ export declare const historyLinesIn: (content: string, paneHeight: number) => number;
178
378
  /**
179
379
  * After the phone injects keys, push fresh frames instead of waiting for its
180
380
  * next screen request — the phone's post-tap re-pull raced the key landing
@@ -198,6 +398,7 @@ export interface StreamControl {
198
398
  */
199
399
  renew?: boolean;
200
400
  }
401
+ export declare const STREAM_CAPTURE_LINES = 200;
201
402
  export declare const STREAM_INTERVAL_MS = 400;
202
403
  export declare const BURST_INTERVAL_MS = 120;
203
404
  export declare const BURST_WINDOW_MS = 2500;
@@ -249,6 +450,14 @@ export type StreamFramePayload = {
249
450
  * can place the cursor before the pane content finishes decrypting. */
250
451
  cursorLine?: number;
251
452
  cursorCol?: number;
453
+ /** How many of this frame's lines are scrollback rather than the visible
454
+ * pane — what the viewer sends back as `before` when it pulls history.
455
+ * Fewer than STREAM_CAPTURE_LINES whenever the byte cap trimmed the frame,
456
+ * which is exactly the case a constant would get wrong. Absent when the
457
+ * pane geometry could not be read; the viewer then falls back to the
458
+ * constant. Plaintext for the same reason the cursor is: a line count
459
+ * without the lines says nothing. */
460
+ historyLines?: number;
252
461
  /** Plaintext pane content — only on unencrypted streams. */
253
462
  content?: string;
254
463
  /** E2EE envelope — replaces `content` on encrypted streams. */
@@ -286,10 +495,13 @@ export declare const isStreamCapReached: (activeCount: number) => boolean;
286
495
  export declare const buildStreamFrame: (captured: {
287
496
  content: string;
288
497
  truncated: boolean;
289
- }, sessionName: string, subscriberPublicKey?: string, cursor?: {
290
- line: number;
291
- col: number;
292
- } | null) => Promise<StreamFramePayload | null>;
498
+ }, sessionName: string, subscriberPublicKey?: string, meta?: {
499
+ cursor?: {
500
+ line: number;
501
+ col: number;
502
+ } | null;
503
+ historyLines?: number;
504
+ }) => Promise<StreamFramePayload | null>;
293
505
  /**
294
506
  * Handle agent.stream.start / agent.stream.stop. Returns true when the message
295
507
  * was a stream-control message (so the caller skips the one-shot screen-peek
@@ -310,10 +522,20 @@ export interface AgentCommandInput {
310
522
  * Treat it as an ordering namespace, never as authentication — the worst
311
523
  * a forged id buys is a different reorder lane for its own keystrokes. */
312
524
  deviceId?: string;
313
- /** Named keys, ALLOWED_KEYS-validated. Mutually exclusive with `body`. */
525
+ /** Named keys, ALLOWED_KEYS-validated. Mutually exclusive with `body`/`insert`. */
314
526
  keys?: string[];
315
527
  /** Literal text; the injector appends the Enter, as on the REST path. */
316
528
  body?: string;
529
+ /**
530
+ * Literal text delivered WITHOUT the submitting Enter — the phone
531
+ * answering a y/n prompt, or typing half a command so a TUI menu opens.
532
+ *
533
+ * A separate field rather than a `submit: false` flag on `body`, and that
534
+ * is the whole point: a daemon too old to know this field sees no `body`
535
+ * either, so it injects nothing. The flag spelling would have had the old
536
+ * daemon submit text the user never meant to send.
537
+ */
538
+ insert?: string;
317
539
  /** Sender's monotonic counter, and the incarnation it counts within. */
318
540
  seq?: number;
319
541
  epoch?: number;
@@ -344,6 +566,9 @@ type ValidatedInput = SequencedInput & {
344
566
  /** Exactly one of these is set. */
345
567
  tokens: string[] | null;
346
568
  text: string | null;
569
+ /** Whether `text` carries its own submit. False for `insert` (and, vacuously,
570
+ * for a key batch — the keys say for themselves what they are). */
571
+ submit: boolean;
347
572
  };
348
573
  type InputCheck = {
349
574
  ok: true;
@@ -428,12 +653,17 @@ interface PushItem {
428
653
  /** Named keys (Esc/arrows/Enter) to inject instead of body text —
429
654
  * drives full-screen modals the phone can't escape with text. */
430
655
  keys?: string[];
656
+ /** Literal text delivered WITHOUT the submitting Enter (see the same field
657
+ * on AgentCommandInput for why it is a field and not a flag). */
658
+ insert?: string;
431
659
  /** Optional image/file attachments (agent.command only, plaintext). */
432
660
  files?: PushFileAttachment[];
433
661
  }
434
662
  interface HandlePushDeps {
435
663
  paneCommand?: (session: string) => string | null;
436
664
  inject?: (session: string, text: string) => boolean;
665
+ /** Paste-only sibling of `inject` — text without the submitting Enter. */
666
+ insertText?: (session: string, text: string) => boolean;
437
667
  sendKeys?: (session: string, tokens: string[]) => boolean;
438
668
  rateLimit?: (session: string, now?: number, cost?: number) => boolean;
439
669
  now?: () => number;
@@ -1 +1 @@
1
- {"version":3,"file":"listener.d.ts","sourceRoot":"","sources":["../src/listener.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAoBH,OAAO,EAA2B,KAAK,SAAS,EAAE,KAAK,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AACzG,OAAO,EAAiD,KAAK,UAAU,EAA4C,MAAM,kBAAkB,CAAC;AAE5I,OAAO,EAA4E,KAAK,yBAAyB,EAAE,MAAM,aAAa,CAAC;AACvI,OAAO,EAA6C,KAAK,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAmCtG,eAAO,MAAM,2BAA2B,QAAS,CAAC;AAElD,UAAU,YAAY;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,EAAE,SAAS,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;;;OAKG;IACH,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,WAAW,CAAC,EAAE,M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eAAO,MAAM,uBAAuB,GAAI,OAAO,MAAM,KAAG,MA2BvD,CAAC;AA2QF;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY,GACrB,MAAM,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,EACtC,QAAQ;IAAE,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,EAC1B,SAAS,MAAM,KAChB,MAAM,GAAG,IAIX,CAAC;AA0DF,eAAO,MAAM,cAAc,GAAU,MAAM,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,KAAG,OAAO,CAAC,MAAM,CAsI3F,CAAC"}
package/dist/listener.js CHANGED
Binary file
@@ -7,6 +7,17 @@ export interface RemoteAgent {
7
7
  binary: string;
8
8
  /** `zeph <subcommand>` aliases that launch this agent. */
9
9
  subcommands: readonly string[];
10
+ /**
11
+ * What this agent is typed to make it quit, if it has such a command.
12
+ *
13
+ * Signals are not enough on their own: Claude Code holds its prompt
14
+ * through both `C-c` and `C-d`, so a remote "end this session" built only
15
+ * out of key presses reports failure against the agent people actually
16
+ * run. Omitted where the command has not been verified against the real
17
+ * binary — sending a guess into a live pane types it at whatever prompt
18
+ * is there.
19
+ */
20
+ quitCommand?: string;
10
21
  /** Extra pane_command basenames accepted as this agent (beyond binary). */
11
22
  paneMatchAliases?: readonly string[];
12
23
  /**
@@ -48,6 +59,7 @@ declare const REMOTE_AGENT_TABLE: readonly [{
48
59
  readonly displayName: "Claude Code";
49
60
  readonly binary: "claude";
50
61
  readonly subcommands: readonly ["cc", "claude"];
62
+ readonly quitCommand: "/exit";
51
63
  readonly resolveSessionId: (paneCwd: string, panePid: number | undefined) => string | null;
52
64
  }, {
53
65
  readonly kind: "codex";
@@ -1 +1 @@
1
- {"version":3,"file":"remote-agents.d.ts","sourceRoot":"","sources":["../src/remote-agents.ts"],"names":[],"mappings":"AAoBA,MAAM,WAAW,WAAW;IACxB,qEAAqE;IACrE,IAAI,EAAE,MAAM,CAAC;IACb,kCAA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AAClG,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC;AAEpE,8FAA8F;AAC9F,MAAM,MAAM,qBAAqB,GAAG,WAAW,GAAG;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE,CAAC;AAEtE,eAAO,MAAM,aAAa,EAAE,SAAS,qBAAqB,EAAuB,CAAC;AAElF,eAAO,MAAM,qBAAqB,GAAI,KAAK,MAAM,KAAG,qBAAqB,GAAG,SAClB,CAAC;AAE3D,eAAO,MAAM,uBAAuB,GAAI,MAAM,MAAM,KAAG,qBAAqB,GAAG,SAG9E,CAAC"}
@@ -189,6 +189,7 @@ const REMOTE_AGENT_TABLE = [
189
189
  displayName: 'Claude Code',
190
190
  binary: 'claude',
191
191
  subcommands: ['cc', 'claude'],
192
+ quitCommand: '/exit',
192
193
  // Exact pid-tree match first; mtime heuristic only as fallback
193
194
  // (older CC without ~/.claude/sessions, or ps failure).
194
195
  resolveSessionId: (paneCwd, panePid) => (panePid !== undefined ? (0, exports.detectClaudeSessionIdByPid)(panePid, paneCwd) : null)
@@ -1 +1 @@
1
- {"version":3,"file":"remote-hook.d.ts","sourceRoot":"","sources":["../src/remote-hook.ts"],"names":[],"mappings":"AAuBA;wEACwE;AACxE,eAAO,MAAM,kBAAkB,8BAA+B,CAAC;AAC/D,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC;AA0BlE,eAAO,MAAM,iBAAiB,GAAI,KAAK,MAAM,KAAG,GAAG,IAAI,eACE,CAAC;AAE1D;;;GAGG;AACH,eAAO,MAAM,aAAa,GACxB,OAAO,eAAe,EACtB,OAAO,MAAM,EACb,MAAK,MAAM,CAAC,UAAwB,EACpC,MAAK,MAAM,MAAiB,KAC3B,MAAM,GAAG,IA0DX,CAAC"}
1
+ {"version":3,"file":"remote-hook.d.ts","sourceRoot":"","sources":["../src/remote-hook.ts"],"names":[],"mappings":"AAqCA;wEACwE;AACxE,eAAO,MAAM,kBAAkB,8BAA+B,CAAC;AAC/D,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC;AAoClE,eAAO,MAAM,iBAAiB,GAAI,KAAK,MAAM,KAAG,GAAG,IAAI,eACE,CAAC;AAE1D;;;GAGG;AACH,eAAO,MAAM,aAAa,GACxB,OAAO,eAAe,EACtB,OAAO,MAAM,EACb,MAAK,MAAM,CAAC,UAAwB,EACpC,MAAK,MAAM,MAAiB,KAC3B,MAAM,GAAG,IAoCX,CAAC"}
@@ -16,10 +16,17 @@ exports.runRemoteHook = exports.isRemoteHookAgent = exports.REMOTE_HOOK_AGENTS =
16
16
  * sticky REMOTE mode (Rule 9).
17
17
  *
18
18
  * Detection is exact: a terminal keystroke racing a phone message can
19
- * never false-match. No match null (silent no-op); this hook only ever
20
- * adds context and must never block a prompt. Parity with the writer
21
- * (listener.ts writeRemoteMarker) is by construction — both sides share
22
- * gate.ts remoteDigest/remoteMarkerPath.
19
+ * never false-match. Parity with the writer (listener.ts writeRemoteMarker)
20
+ * is by construction both sides share gate.ts remoteDigest/remoteMarkerPath.
21
+ *
22
+ * The marker is one-shot, but REMOTE is not. A user who answers from the
23
+ * phone and then types at the terminal produces turns with no marker and no
24
+ * zeph_ask result, and that is exactly where the mode used to run out of
25
+ * evidence. So entry also records the mode (gate.ts touchRemoteActive) and
26
+ * every later prompt re-reads it and re-states it in one sentence.
27
+ *
28
+ * No marker and no live state → null (silent no-op); this hook only ever adds
29
+ * context and must never block a prompt.
23
30
  */
24
31
  const fs_1 = require("fs");
25
32
  const gate_js_1 = require("./gate.js");
@@ -46,6 +53,15 @@ This user message arrived from the user's phone via Zeph agent chat (verified by
46
53
  const ONE_WAY_CONTEXT = `# System note (Zeph remote-origin detect)
47
54
 
48
55
  This user message arrived from the user's phone via Zeph agent chat (verified by the listener — exact text match), but ZEPH_HOOK_ID is not set, so two-way tools (zeph_ask/zeph_prompt/zeph_input) are unavailable. Make your final message self-contained — the completion push is the user's only feedback channel. If you have not already mentioned it this session, tell the user once that running \`npx @zeph-to/cli setup\` upgrades this into a two-way remote session (buttons + text replies from the phone).`;
56
+ /**
57
+ * Every later turn of a session already in REMOTE. Deliberately one sentence:
58
+ * this goes out on EVERY prompt of a remote session, so anything longer would
59
+ * spend per-turn what the rule text spends once. Kept in step with the wording
60
+ * in plugin/hooks/zeph-remote.sh.
61
+ */
62
+ const STICKY_CONTEXT = `# System note (Zeph)
63
+
64
+ This session is still in sticky REMOTE mode — the user has been driving it from their phone and may not be at the terminal to read this. End this response with \`zeph_ask\` (CORE_RULES Rule 9).`;
49
65
  const isRemoteHookAgent = (raw) => exports.REMOTE_HOOK_AGENTS.includes(raw);
50
66
  exports.isRemoteHookAgent = isRemoteHookAgent;
51
67
  /**
@@ -63,27 +79,57 @@ const runRemoteHook = (agent, stdin, env = process.env, now = Date.now) => {
63
79
  catch {
64
80
  return null;
65
81
  }
66
- if (!prompt || !cwd)
82
+ // `prompt` is only needed to match a marker; a session already in REMOTE
83
+ // gets its reminder either way. `cwd` keys every state file, so without it
84
+ // there is nothing to look up.
85
+ if (!cwd)
67
86
  return null;
68
- // Mute outranks everything (Rule 12) — stay silent and leave the marker
69
- // unconsumed (the next inject overwrites it anyway).
87
+ // Mute outranks everything (Rule 12) — stay silent and leave both the marker
88
+ // and the state untouched (the next inject overwrites the marker anyway).
70
89
  if ((0, gate_js_1.isMuted)(cwd))
71
90
  return null;
91
+ const emit = (additionalContext) => JSON.stringify({
92
+ hookSpecificOutput: { hookEventName: HOOK_EVENT_NAME[agent], additionalContext },
93
+ });
94
+ // Exactly one additionalContext per invocation: entry wins over the
95
+ // reminder, because on the entry turn the reminder would say strictly less.
96
+ if (matchesRemoteMarker(prompt, cwd, now)) {
97
+ if (!env.ZEPH_HOOK_ID)
98
+ return emit(ONE_WAY_CONTEXT);
99
+ // Only a two-way session has a mode to stay in — without zeph_ask there is
100
+ // nothing for a later turn to be reminded of, so no state is recorded.
101
+ (0, gate_js_1.touchRemoteActive)(cwd, now);
102
+ return emit(TWO_WAY_CONTEXT);
103
+ }
104
+ if (env.ZEPH_HOOK_ID && (0, gate_js_1.isRemoteActive)(cwd, now))
105
+ return emit(STICKY_CONTEXT);
106
+ return null;
107
+ };
108
+ exports.runRemoteHook = runRemoteHook;
109
+ /**
110
+ * True when this prompt is the phone injection the listener recorded.
111
+ * Consumes the marker on a match, deletes it once stale, and otherwise leaves
112
+ * it in place so a prompt that simply isn't the injected one can still match
113
+ * on a later turn.
114
+ */
115
+ const matchesRemoteMarker = (prompt, cwd, now) => {
116
+ if (!prompt)
117
+ return false;
72
118
  const hash = (0, gate_js_1.projectHash)(cwd);
73
119
  if (!hash)
74
- return null;
120
+ return false;
75
121
  const marker = (0, gate_js_1.remoteMarkerPath)(hash);
76
122
  let content;
77
123
  try {
78
124
  content = (0, fs_1.readFileSync)(marker, 'utf-8');
79
125
  }
80
126
  catch {
81
- return null;
127
+ return false;
82
128
  }
83
129
  // Marker format: "<epochSec> <sha256hex>\n" (listener.ts writeRemoteMarker).
84
130
  const record = content.match(/^(\d+) ([0-9a-f]{64})\n?$/);
85
131
  if (!record)
86
- return null;
132
+ return false;
87
133
  if (Math.floor(now() / 1000) - Number(record[1]) > FRESH_WINDOW_SEC) {
88
134
  // Stale markers are dead weight (can never flag) — delete on sight.
89
135
  try {
@@ -92,24 +138,18 @@ const runRemoteHook = (agent, stdin, env = process.env, now = Date.now) => {
92
138
  catch {
93
139
  /* best-effort housekeeping */
94
140
  }
95
- return null;
141
+ return false;
96
142
  }
97
143
  if ((0, gate_js_1.remoteDigest)(prompt) !== record[2])
98
- return null;
144
+ return false;
99
145
  // Matched — consume the marker so an identical later prompt (e.g. typed
100
- // at the terminal) can't re-flag.
146
+ // at the terminal) can't re-flag. Housekeeping is not the verdict: the
147
+ // match is valid whether or not the delete lands.
101
148
  try {
102
149
  (0, fs_1.unlinkSync)(marker);
103
150
  }
104
151
  catch {
105
152
  /* emit anyway — the match itself is valid */
106
153
  }
107
- const ctx = env.ZEPH_HOOK_ID ? TWO_WAY_CONTEXT : ONE_WAY_CONTEXT;
108
- return JSON.stringify({
109
- hookSpecificOutput: {
110
- hookEventName: HOOK_EVENT_NAME[agent],
111
- additionalContext: ctx,
112
- },
113
- });
154
+ return true;
114
155
  };
115
- exports.runRemoteHook = runRemoteHook;
@@ -0,0 +1,63 @@
1
+ /**
2
+ * What a session WAS, kept so it can be started again.
3
+ *
4
+ * tmux is the only record of a live session, and it forgets one the moment it
5
+ * ends — which is exactly when the phone wants it back. So the listener writes
6
+ * down what it saw while the session was alive: where it ran and which agent it
7
+ * ran, keyed by the tmux name the phone already addresses it by.
8
+ *
9
+ * This file is the whitelist that makes remote resume safe. A resume request
10
+ * carries a session NAME and nothing else; the directory and the binary come
11
+ * from here, from what this machine observed itself. Nothing a phone (or a
12
+ * relay posing as one) sends can point the daemon at another directory or
13
+ * another program.
14
+ */
15
+ export interface KnownSession {
16
+ /** tmux session name — the key the phone addresses. */
17
+ name: string;
18
+ /** Pane cwd while it was alive. Where a resume starts the agent again. */
19
+ cwd: string;
20
+ /** RemoteAgent `kind` (claude/codex/…), resolved to a binary at resume time. */
21
+ agentKind: string;
22
+ project?: string;
23
+ label?: string;
24
+ /** Last time this machine saw the session running. */
25
+ lastSeenAt: string;
26
+ }
27
+ /**
28
+ * Ceiling on remembered sessions. tmux names come from a small reused pool
29
+ * (`zeph-<project>`, `-2`, …), so this holds far more distinct projects than it
30
+ * looks; the cap only stops the file from growing without bound on a machine
31
+ * that has run agents for years.
32
+ */
33
+ export declare const MAX_KNOWN_SESSIONS = 100;
34
+ /** Forgotten after this long unseen — a directory from months ago is more
35
+ * likely to have moved than to be what the user meant. */
36
+ export declare const KNOWN_SESSION_TTL_MS: number;
37
+ /** Sessions this machine has seen, newest first, expired ones dropped. */
38
+ export declare const knownSessions: (now?: number) => KnownSession[];
39
+ /** One remembered session, or null when this machine never saw that name. */
40
+ export declare const recallSession: (name: string, now?: number) => KnownSession | null;
41
+ /**
42
+ * Write down the sessions running right now, replacing what was known about
43
+ * each. Called from the inventory sweep, so the record follows a session that
44
+ * moves directory or changes agent rather than pinning its first sighting.
45
+ *
46
+ * A session with no readable cwd is skipped rather than remembered without
47
+ * one: an entry that cannot say where to start the agent is not a resume
48
+ * target, only a row that would fail when tapped.
49
+ */
50
+ export declare const rememberSessions: (live: Array<{
51
+ name: string;
52
+ cwd: string | null;
53
+ agentKind: string;
54
+ project?: string | null;
55
+ label?: string | null;
56
+ }>, now?: number) => void;
57
+ /** Whether the registry knows this name — the resume whitelist check. */
58
+ export declare const isKnownSession: (name: string, now?: number) => boolean;
59
+ /** Test seam: the file this module reads and writes. */
60
+ export declare const knownSessionsPath: () => string;
61
+ /** True when the recorded directory still exists to start an agent in. */
62
+ export declare const sessionDirectoryExists: (entry: KnownSession) => boolean;
63
+ //# sourceMappingURL=session-registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session-registry.d.ts","sourceRoot":"","sources":["../src/session-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAMH,MAAM,WAAW,YAAY;IACzB,uDAAuD;IACvD,IAAI,EAAE,MAAM,CAAC;IACb,0EAA0E;IAC1E,GAAG,EAAE,MAAM,CAAC;IACZ,gFAAgF;IAChF,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,sDAAsD;IACtD,UAAU,EAAE,MAAM,CAAC;CACtB;AAED;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,MAAM,CAAC;AACtC;2DAC2D;AAC3D,eAAO,MAAM,oBAAoB,QAA2B,CAAC;AAsC7D,0EAA0E;AAC1E,eAAO,MAAM,aAAa,GAAI,MAAK,MAAmB,KAAG,YAAY,EAGJ,CAAC;AAElE,6EAA6E;AAC7E,eAAO,MAAM,aAAa,GAAI,MA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