@zeph-to/cli 2.17.0 → 2.18.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.
package/README.md CHANGED
@@ -154,7 +154,10 @@ other way in: a `zeph_ask` answer that is not a Done-like button. Their rule
154
154
  files therefore keep the after-real-work `zeph_ask` — the "Entering REMOTE
155
155
  without a prompt hook" preamble in `src/templates.ts` — so the phone always
156
156
  has a button to tap that starts the loop. Agents with the hook drop that
157
- obligation while at the terminal.
157
+ obligation while at the terminal — and their rule file carries only the
158
+ NORMAL branch of the core (about a quarter of it), since it is read on every
159
+ turn; the hook injects the REMOTE sections in full on the turn a phone
160
+ message enters REMOTE, the way the Claude Code plugin's hooks do.
158
161
 
159
162
  `zeph cursor` has no remote-origin hook, so it never enters sticky REMOTE
160
163
  mode by itself. **Just ask for it** — one line, once per session:
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Slice one `### ` section out of a generated rule core (zeph-core.generated.ts).
3
+ *
4
+ * The core is one string per audience, assembled upstream from
5
+ * plugin/docs/CORE_RULES.md. Two consumers need single sections of it:
6
+ * templates.ts, which builds the NORMAL-only rule file for agents whose
7
+ * prompt-submit hook can announce REMOTE, and remote-hook.ts, which injects
8
+ * the REMOTE sections on the turn that enters it — the twin of the plugin's
9
+ * zeph-remote.sh reading CORE_RULES.md on entry.
10
+ *
11
+ * Headings are matched by title prefix (`Sticky REMOTE mode`), not by the
12
+ * `(Rule N)` suffix: the extractor renumbers per audience, so the number is
13
+ * not stable across cores. A heading the core does not carry throws — every
14
+ * caller passes a literal, so the throw surfaces at import time in the tests
15
+ * rather than as a silently empty rule file.
16
+ */
17
+ export declare const coreSection: (core: string, heading: string) => string;
18
+ //# sourceMappingURL=core-sections.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"core-sections.d.ts","sourceRoot":"","sources":["../src/core-sections.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,WAAW,GAAI,MAAM,MAAM,EAAE,SAAS,MAAM,KAAG,MAO3D,CAAC"}
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.coreSection = void 0;
4
+ /**
5
+ * Slice one `### ` section out of a generated rule core (zeph-core.generated.ts).
6
+ *
7
+ * The core is one string per audience, assembled upstream from
8
+ * plugin/docs/CORE_RULES.md. Two consumers need single sections of it:
9
+ * templates.ts, which builds the NORMAL-only rule file for agents whose
10
+ * prompt-submit hook can announce REMOTE, and remote-hook.ts, which injects
11
+ * the REMOTE sections on the turn that enters it — the twin of the plugin's
12
+ * zeph-remote.sh reading CORE_RULES.md on entry.
13
+ *
14
+ * Headings are matched by title prefix (`Sticky REMOTE mode`), not by the
15
+ * `(Rule N)` suffix: the extractor renumbers per audience, so the number is
16
+ * not stable across cores. A heading the core does not carry throws — every
17
+ * caller passes a literal, so the throw surfaces at import time in the tests
18
+ * rather than as a silently empty rule file.
19
+ */
20
+ const coreSection = (core, heading) => {
21
+ const sections = core.split(/^(?=### )/m).map((s) => s.trim());
22
+ const found = sections.filter((s) => s.startsWith(`### ${heading}`));
23
+ if (found.length !== 1) {
24
+ throw new Error(`core section "${heading}" ${found.length ? 'is ambiguous' : 'not found'} in the generated core`);
25
+ }
26
+ return found[0];
27
+ };
28
+ exports.coreSection = coreSection;
@@ -105,7 +105,15 @@ export declare const sessionsFingerprint: (sessions: AgentSession[]) => string;
105
105
  export declare const sessionsReportDue: (fingerprint: string, lastSentFingerprint: string | null, lastSentAtMs: number, nowMs: number) => boolean;
106
106
  export declare const AUTH_FAILURE_CODES: ReadonlySet<number>;
107
107
  export declare const checkRateLimit: (session: string, now?: number, cost?: number) => boolean;
108
- /** Read the foreground command in the named tmux session's active pane. */
108
+ /**
109
+ * Read the foreground command on the named session's PINNED pane, verifying
110
+ * the pane still belongs to that session. A pane id is stable across restarts
111
+ * only within one tmux server: after a restart the same `%N` can name a pane
112
+ * in a different session, and typing into that pane would be RCE into someone
113
+ * else's shell. The owning session rides along in the same display-message —
114
+ * one spawn, no second probe — and a mismatch answers null ("no such
115
+ * session"), which refuses the inject until the next sweep re-pins.
116
+ */
109
117
  export declare const paneCurrentCommand: (session: string) => string | null;
110
118
  /**
111
119
  * Translate a phone-supplied key list to tmux tokens. Returns null if ANY
@@ -140,6 +148,14 @@ interface PaneInfo {
140
148
  currentPath: string | null;
141
149
  panePid: number | null;
142
150
  }
151
+ /** Store the latest sweep's name → pane-id map (see `CollectResult.targets`). */
152
+ export declare const recordTargets: (targets: Record<string, string> | null | undefined) => void;
153
+ /**
154
+ * The tmux target for a wire session name: its pinned pane id when the last
155
+ * sweep saw the session, else the name itself (a session younger than one
156
+ * sweep, or tmux unreachable at startup — today's resolution, active pane).
157
+ */
158
+ export declare const tmuxTargetFor: (name: string) => string;
143
159
  /**
144
160
  * Identify the agent from the tmux pane. Prefer `pane_start_command`
145
161
  * because the foreground process is usually `node`/`python3` (the
@@ -690,6 +706,10 @@ export interface CollectResult {
690
706
  name: string;
691
707
  reason: string;
692
708
  }>;
709
+ /** Local knowledge, NOT on the wire: every live session/subagent name →
710
+ * the pane id every `-t` call for it must use (`tmuxTargetFor`). The main
711
+ * thread stores it beside the snapshot (`recordTargets`). */
712
+ targets: Record<string, string>;
693
713
  }
694
714
  /**
695
715
  * Inventory pass that also records *why* each `zeph-*` session was
@@ -1 +1 @@
1
- {"version":3,"file":"listener.d.ts","sourceRoot":"","sources":["../src/listener.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AA6BH,OAAO,EAA0C,KAAK,SAAS,EAAE,KAAK,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAUxH,OAAO,EAAiD,KAAK,UAAU,EAA4C,MAAM,kBAAkB,CAAC;AAG5I,OAAO,EAA4E,KAAK,yBAAyB,EAAE,MAAM,aAAa,CAAC;AAGvI,OAAO,EAA6C,KAAK,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAoCt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AAM,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,KAAG,OAAO,CAAC,MAAM,CAoK3F,CAAC"}
package/dist/listener.js CHANGED
@@ -25,8 +25,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
25
25
  return (mod && mod.__esModule) ? mod : { "default": mod };
26
26
  };
27
27
  Object.defineProperty(exports, "__esModule", { value: true });
28
- exports.MAX_INPUT_BODY_CHARS = exports.MAX_INPUT_KEYS = exports.handleStreamControl = exports.buildStreamFrame = exports.isStreamCapReached = exports.stopAllStreams = exports.stopStream = exports.MAX_CONCURRENT_STREAMS = exports.STREAM_RENEW_FRESH_MS = exports.STREAM_LEASE_MS = exports.claimFrameSend = exports.hasFrameBudget = exports.streamCadence = exports.MAX_FRAMES_PER_SEC = exports.BURST_WINDOW_MS = exports.BURST_INTERVAL_MS = exports.STREAM_INTERVAL_MS = exports.STREAM_CAPTURE_LINES = exports.scheduleInjectSnapshots = exports.historyLinesIn = exports.cursorLineFor = exports.parsePaneGeometry = exports.handleScreenHistoryRequest = exports.SCREEN_HISTORY_MAX_LINES = exports.handleSessionForgetRequest = exports.handleSessionExitRequest = exports.SESSION_EXIT_STEP_MS = exports.handleSessionResumeRequest = exports.handleDiffFileRequest = exports.handleDiffFilesRequest = exports.DIFF_PAGE_MAX_BYTES = exports.handleScreenRequest = exports.collectWatchHits = exports.resetPatternWatches = exports.setPatternWatches = exports.deriveSessionState = exports.resetSessionStates = exports.detectRemoteAgent = exports.parseSessionName = exports.invalidateTmuxSocketCache = exports.resolveKeys = exports.paneCurrentCommand = exports.checkRateLimit = exports.AUTH_FAILURE_CODES = exports.sessionsReportDue = exports.sessionsFingerprint = exports.knownSessionsFingerprint = exports.knownSessionsToReport = exports.KNOWN_SESSIONS_REPORTED = exports.SESSION_REPORT_HEARTBEAT_MS = void 0;
29
- exports.handleListener = exports.resolveWsUrl = exports.computeListenerDeviceId = exports.computeBackoff = exports.handlePush = exports.gcAttachments = exports.setAttachmentContext = exports.writeRemoteMarker = exports.isInventoried = exports.syncTmuxAgentNames = exports.recordInventory = exports.collectSessionsVerbose = exports.handleCommandInput = exports.pendingInputDecrypts = exports.MAX_PENDING_DECRYPTS = exports.MAX_INPUT_LANES = exports.validateInputMessage = void 0;
28
+ exports.handleStreamControl = exports.buildStreamFrame = exports.isStreamCapReached = exports.stopAllStreams = exports.stopStream = exports.MAX_CONCURRENT_STREAMS = exports.STREAM_RENEW_FRESH_MS = exports.STREAM_LEASE_MS = exports.claimFrameSend = exports.hasFrameBudget = exports.streamCadence = exports.MAX_FRAMES_PER_SEC = exports.BURST_WINDOW_MS = exports.BURST_INTERVAL_MS = exports.STREAM_INTERVAL_MS = exports.STREAM_CAPTURE_LINES = exports.scheduleInjectSnapshots = exports.historyLinesIn = exports.cursorLineFor = exports.parsePaneGeometry = exports.handleScreenHistoryRequest = exports.SCREEN_HISTORY_MAX_LINES = exports.handleSessionForgetRequest = exports.handleSessionExitRequest = exports.SESSION_EXIT_STEP_MS = exports.handleSessionResumeRequest = exports.handleDiffFileRequest = exports.handleDiffFilesRequest = exports.DIFF_PAGE_MAX_BYTES = exports.handleScreenRequest = exports.collectWatchHits = exports.resetPatternWatches = exports.setPatternWatches = exports.deriveSessionState = exports.resetSessionStates = exports.detectRemoteAgent = exports.tmuxTargetFor = exports.recordTargets = exports.parseSessionName = exports.invalidateTmuxSocketCache = exports.resolveKeys = exports.paneCurrentCommand = exports.checkRateLimit = exports.AUTH_FAILURE_CODES = exports.sessionsReportDue = exports.sessionsFingerprint = exports.knownSessionsFingerprint = exports.knownSessionsToReport = exports.KNOWN_SESSIONS_REPORTED = exports.SESSION_REPORT_HEARTBEAT_MS = void 0;
29
+ exports.handleListener = exports.resolveWsUrl = exports.computeListenerDeviceId = exports.computeBackoff = exports.handlePush = exports.gcAttachments = exports.setAttachmentContext = exports.writeRemoteMarker = exports.isInventoried = exports.syncTmuxAgentNames = exports.recordInventory = exports.collectSessionsVerbose = exports.handleCommandInput = exports.pendingInputDecrypts = exports.MAX_PENDING_DECRYPTS = exports.MAX_INPUT_LANES = exports.validateInputMessage = exports.MAX_INPUT_BODY_CHARS = exports.MAX_INPUT_KEYS = void 0;
30
30
  const child_process_1 = require("child_process");
31
31
  const crypto_1 = require("crypto");
32
32
  const fs_1 = require("fs");
@@ -185,15 +185,27 @@ const checkRateLimit = (session, now = Date.now(), cost = 1) => {
185
185
  return true;
186
186
  };
187
187
  exports.checkRateLimit = checkRateLimit;
188
- /** Read the foreground command in the named tmux session's active pane. */
188
+ /**
189
+ * Read the foreground command on the named session's PINNED pane, verifying
190
+ * the pane still belongs to that session. A pane id is stable across restarts
191
+ * only within one tmux server: after a restart the same `%N` can name a pane
192
+ * in a different session, and typing into that pane would be RCE into someone
193
+ * else's shell. The owning session rides along in the same display-message —
194
+ * one spawn, no second probe — and a mismatch answers null ("no such
195
+ * session"), which refuses the inject until the next sweep re-pins.
196
+ */
189
197
  const paneCurrentCommand = (session) => {
190
- const result = (0, child_process_1.spawnSync)('tmux', tmuxArgs(['display-message', '-p', '-t', session, '#{pane_current_command}']), {
198
+ const result = (0, child_process_1.spawnSync)('tmux', tmuxArgs(['display-message', '-p', '-t', (0, exports.tmuxTargetFor)(session),
199
+ `#{pane_current_command}${FIELD_SEP}#{session_name}`]), {
191
200
  encoding: 'utf-8',
192
201
  stdio: ['ignore', 'pipe', 'ignore'],
193
202
  });
194
203
  if (result.status !== 0)
195
204
  return null;
196
- return (result.stdout ?? '').trim() || null;
205
+ const parts = (result.stdout ?? '').trim().split(FIELD_SEP);
206
+ if (parts.length !== 2 || parts[1] !== session)
207
+ return null;
208
+ return parts[0] || null;
197
209
  };
198
210
  exports.paneCurrentCommand = paneCurrentCommand;
199
211
  const isShellPane = (command) => {
@@ -205,7 +217,7 @@ const isShellPane = (command) => {
205
217
  * so the user's own paste stack is never pushed onto, and `-d` drops it
206
218
  * again the moment it has been delivered. */
207
219
  const INJECT_BUFFER = 'zeph-inject';
208
- const sendLiteral = (session, text) => (0, child_process_1.spawnSync)('tmux', tmuxArgs(['send-keys', '-l', '-t', session, text]), { stdio: ['ignore', 'ignore', 'pipe'] })
220
+ const sendLiteral = (session, text) => (0, child_process_1.spawnSync)('tmux', tmuxArgs(['send-keys', '-l', '-t', (0, exports.tmuxTargetFor)(session), text]), { stdio: ['ignore', 'ignore', 'pipe'] })
209
221
  .status === 0;
210
222
  /**
211
223
  * Put the message in the pane as a PASTE rather than as typing.
@@ -233,7 +245,7 @@ const pasteText = (session, text) => {
233
245
  const set = (0, child_process_1.spawnSync)('tmux', tmuxArgs(['set-buffer', '-b', INJECT_BUFFER, '--', text]), { stdio: ['ignore', 'ignore', 'pipe'] });
234
246
  if (set.status !== 0)
235
247
  return sendLiteral(session, text);
236
- const paste = (0, child_process_1.spawnSync)('tmux', tmuxArgs(['paste-buffer', '-d', '-p', '-b', INJECT_BUFFER, '-t', session]), { stdio: ['ignore', 'ignore', 'pipe'] });
248
+ const paste = (0, child_process_1.spawnSync)('tmux', tmuxArgs(['paste-buffer', '-d', '-p', '-b', INJECT_BUFFER, '-t', (0, exports.tmuxTargetFor)(session)]), { stdio: ['ignore', 'ignore', 'pipe'] });
237
249
  if (paste.status === 0)
238
250
  return true;
239
251
  // `-d` never ran, so the buffer is still there holding the message.
@@ -252,7 +264,7 @@ const pasteText = (session, text) => {
252
264
  const injectKeys = (session, text) => {
253
265
  if (!pasteText(session, text))
254
266
  return false;
255
- const b = (0, child_process_1.spawnSync)('tmux', tmuxArgs(['send-keys', '-t', session, 'Enter']), { stdio: ['ignore', 'ignore', 'pipe'] });
267
+ const b = (0, child_process_1.spawnSync)('tmux', tmuxArgs(['send-keys', '-t', (0, exports.tmuxTargetFor)(session), 'Enter']), { stdio: ['ignore', 'ignore', 'pipe'] });
256
268
  return b.status === 0;
257
269
  };
258
270
  // Named keys the phone may inject to drive a full-screen Claude Code pane
@@ -310,7 +322,7 @@ exports.resolveKeys = resolveKeys;
310
322
  * whole sequence in order.
311
323
  */
312
324
  const injectNamedKeys = (session, tokens) => {
313
- const r = (0, child_process_1.spawnSync)('tmux', tmuxArgs(['send-keys', '-t', session, ...tokens]), { stdio: ['ignore', 'ignore', 'pipe'] });
325
+ const r = (0, child_process_1.spawnSync)('tmux', tmuxArgs(['send-keys', '-t', (0, exports.tmuxTargetFor)(session), ...tokens]), { stdio: ['ignore', 'ignore', 'pipe'] });
314
326
  return r.status === 0;
315
327
  };
316
328
  const stamp = () => new Date().toISOString().slice(11, 19);
@@ -603,8 +615,29 @@ exports.parseSessionName = parseSessionName;
603
615
  // arrived at the consumer end. A printable Unicode char passes through
604
616
  // verbatim and won't appear in any real session name or filesystem path.
605
617
  const FIELD_SEP = '␟';
618
+ // ─── Pane targets ───────────────────────────────────────────────────
619
+ // A bare `-t <session>` resolves to whichever pane has FOCUS, so the moment a
620
+ // second pane exists in a `zeph-*` session (pi-interactive-subagents splits
621
+ // one off for every subagent), capture and input silently follow the user's
622
+ // focus instead of the agent. The inventory sweep pins each session to its
623
+ // main pane id, and every `-t` call site goes through `tmuxTargetFor` so the
624
+ // pinning cannot be bypassed by one call site forgetting it.
625
+ /** Session name → pinned pane id, replaced wholesale by each inventory sweep. */
626
+ let targetsBySession = new Map();
627
+ /** Store the latest sweep's name → pane-id map (see `CollectResult.targets`). */
628
+ const recordTargets = (targets) => {
629
+ targetsBySession = new Map(Object.entries(targets ?? {}));
630
+ };
631
+ exports.recordTargets = recordTargets;
632
+ /**
633
+ * The tmux target for a wire session name: its pinned pane id when the last
634
+ * sweep saw the session, else the name itself (a session younger than one
635
+ * sweep, or tmux unreachable at startup — today's resolution, active pane).
636
+ */
637
+ const tmuxTargetFor = (name) => targetsBySession.get(name) ?? name;
638
+ exports.tmuxTargetFor = tmuxTargetFor;
606
639
  const readPaneInfo = (session) => {
607
- const r = (0, child_process_1.spawnSync)('tmux', tmuxArgs(['display-message', '-p', '-t', session,
640
+ const r = (0, child_process_1.spawnSync)('tmux', tmuxArgs(['display-message', '-p', '-t', (0, exports.tmuxTargetFor)(session),
608
641
  `#{pane_current_command}${FIELD_SEP}#{pane_start_command}${FIELD_SEP}#{pane_current_path}${FIELD_SEP}#{pane_pid}`]), {
609
642
  encoding: 'utf-8',
610
643
  stdio: ['ignore', 'pipe', 'ignore'],
@@ -675,7 +708,7 @@ const resetSessionStates = () => {
675
708
  };
676
709
  exports.resetSessionStates = resetSessionStates;
677
710
  const capturePaneText = (session) => {
678
- const r = (0, child_process_1.spawnSync)('tmux', tmuxArgs(['capture-pane', '-p', '-t', session, '-S', `-${STATE_CAPTURE_LINES}`]), {
711
+ const r = (0, child_process_1.spawnSync)('tmux', tmuxArgs(['capture-pane', '-p', '-t', (0, exports.tmuxTargetFor)(session), '-S', `-${STATE_CAPTURE_LINES}`]), {
679
712
  encoding: 'utf-8',
680
713
  stdio: ['ignore', 'pipe', 'pipe'],
681
714
  });
@@ -1270,7 +1303,7 @@ const isPageOffset = (v) => typeof v === 'number' && Number.isInteger(v) && v >=
1270
1303
  /** How many lines of scrollback the pane is holding, or null when tmux won't
1271
1304
  * say — which is also how a dead pane answers. */
1272
1305
  const paneHistorySize = (sessionName) => {
1273
- const r = (0, child_process_1.spawnSync)('tmux', tmuxArgs(['display-message', '-p', '-t', sessionName, '#{history_size}']), { encoding: 'utf-8', stdio: ['ignore', 'pipe', 'pipe'] });
1306
+ const r = (0, child_process_1.spawnSync)('tmux', tmuxArgs(['display-message', '-p', '-t', (0, exports.tmuxTargetFor)(sessionName), '#{history_size}']), { encoding: 'utf-8', stdio: ['ignore', 'pipe', 'pipe'] });
1274
1307
  if (r.status !== 0)
1275
1308
  return null;
1276
1309
  const size = Number((r.stdout ?? '').trim());
@@ -1280,7 +1313,7 @@ const paneHistorySize = (sessionName) => {
1280
1313
  * negative numbers reach into the history, so both bounds are negative here. */
1281
1314
  const capturePaneRange = (sessionName, start, end) => {
1282
1315
  const r = (0, child_process_1.spawnSync)('tmux', tmuxArgs([
1283
- 'capture-pane', '-p', '-e', '-t', sessionName,
1316
+ 'capture-pane', '-p', '-e', '-t', (0, exports.tmuxTargetFor)(sessionName),
1284
1317
  '-S', String(start), '-E', String(end),
1285
1318
  ]), { encoding: 'utf-8', stdio: ['ignore', 'pipe', 'pipe'] });
1286
1319
  if (r.status !== 0)
@@ -1393,8 +1426,8 @@ const capturePane = (sessionName, escapes = false, lines = SCREEN_PEEK_LINES) =>
1393
1426
  // more history so the mirror has room to scroll; SCREEN_PEEK_MAX_BYTES
1394
1427
  // still caps the payload below.
1395
1428
  const captureArgs = escapes
1396
- ? ['capture-pane', '-p', '-e', '-t', sessionName, '-S', `-${lines}`]
1397
- : ['capture-pane', '-p', '-t', sessionName, '-S', `-${lines}`];
1429
+ ? ['capture-pane', '-p', '-e', '-t', (0, exports.tmuxTargetFor)(sessionName), '-S', `-${lines}`]
1430
+ : ['capture-pane', '-p', '-t', (0, exports.tmuxTargetFor)(sessionName), '-S', `-${lines}`];
1398
1431
  const r = (0, child_process_1.spawnSync)('tmux', tmuxArgs(captureArgs), {
1399
1432
  encoding: 'utf-8',
1400
1433
  stdio: ['ignore', 'pipe', 'pipe'],
@@ -1420,7 +1453,7 @@ const capturePane = (sessionName, escapes = false, lines = SCREEN_PEEK_LINES) =>
1420
1453
  */
1421
1454
  const capturePaneCursor = (sessionName) => {
1422
1455
  const r = (0, child_process_1.spawnSync)('tmux', tmuxArgs([
1423
- 'display-message', '-p', '-t', sessionName,
1456
+ 'display-message', '-p', '-t', (0, exports.tmuxTargetFor)(sessionName),
1424
1457
  '#{cursor_x},#{cursor_y},#{pane_height},#{history_size}',
1425
1458
  ]), { encoding: 'utf-8', stdio: ['ignore', 'pipe', 'ignore'] });
1426
1459
  if (r.status !== 0)
@@ -2430,20 +2463,25 @@ exports.handleCommandInput = handleCommandInput;
2430
2463
  * re-attach, and the current command is `node` rather than `claude`).
2431
2464
  */
2432
2465
  const collectSessionsVerbose = () => {
2433
- const list = (0, child_process_1.spawnSync)('tmux', tmuxArgs(['list-sessions', '-F',
2434
- `#{session_name}${FIELD_SEP}#{session_attached}${FIELD_SEP}#{session_created}${FIELD_SEP}#{session_activity}`]), {
2466
+ // One sweep for the whole server: every pane of every session, so a
2467
+ // session's main pane is known regardless of which pane has focus, and
2468
+ // extra panes are visible to later slices. Per-pane spawns (the old
2469
+ // per-session display-message) would multiply with split panes; the worker
2470
+ // thread keeps the one blocking sweep off the event loop.
2471
+ const list = (0, child_process_1.spawnSync)('tmux', tmuxArgs(['list-panes', '-a', '-F',
2472
+ `#{session_name}${FIELD_SEP}#{session_attached}${FIELD_SEP}#{session_created}${FIELD_SEP}#{session_activity}${FIELD_SEP}#{window_index}${FIELD_SEP}#{pane_index}${FIELD_SEP}#{pane_id}${FIELD_SEP}#{pane_current_command}${FIELD_SEP}#{pane_start_command}${FIELD_SEP}#{pane_current_path}${FIELD_SEP}#{pane_pid}`]), {
2435
2473
  encoding: 'utf-8',
2436
2474
  stdio: ['ignore', 'pipe', 'pipe'],
2437
2475
  });
2438
2476
  if (list.status !== 0) {
2439
2477
  const stderr = (list.stderr ?? '').toString().trim();
2440
- log(` tmux list-sessions failed: status=${list.status}${stderr ? ', stderr=' + stderr : ''}`);
2478
+ log(` tmux list-panes failed: status=${list.status}${stderr ? ', stderr=' + stderr : ''}`);
2441
2479
  // Tmux call failed against the cached socket — the server it
2442
2480
  // pointed at is gone (died, restarted at a different path, etc).
2443
2481
  // Invalidate so the next cycle re-runs full discovery instead of
2444
2482
  // wedging the listener at "reported 0 session(s)" forever.
2445
2483
  (0, exports.invalidateTmuxSocketCache)();
2446
- return { sessions: [], rejected: [] };
2484
+ return { sessions: [], rejected: [], targets: {} };
2447
2485
  }
2448
2486
  const rawLines = (list.stdout ?? '').split('\n').filter(Boolean);
2449
2487
  // Sanity-check that the format separator actually survived. tmux is
@@ -2453,51 +2491,102 @@ const collectSessionsVerbose = () => {
2453
2491
  // it as "not zeph-*". Detect that explicitly so the user isn't left
2454
2492
  // guessing.
2455
2493
  if (rawLines.length > 0 && !rawLines[0].includes(FIELD_SEP)) {
2456
- log(` tmux output missing FIELD_SEP — likely encoding issue. Raw line: ${JSON.stringify(rawLines[0])}`);
2494
+ log(` tmux list-panes output missing FIELD_SEP — likely encoding issue. Raw line: ${JSON.stringify(rawLines[0])}`);
2457
2495
  }
2458
2496
  const sessions = [];
2459
2497
  const rejected = [];
2460
- // Pane cwd per session, read in the same sweep. Kept beside the wire shape
2461
- // rather than in it: AgentSession is a server/phone contract and the
2462
- // directory is local knowledge the registry needs, nothing the phone gets.
2463
- const paneCwdOf = new Map();
2498
+ /** 11 fields per row; a mismatch is the mangled-separator failure the
2499
+ * sanity log above exists for skip the row loudly, never misparse it. */
2500
+ const PANE_FIELDS = 11;
2501
+ const groups = new Map();
2502
+ let malformed = 0;
2464
2503
  for (const line of rawLines) {
2465
- const [name, attached, created, activity] = line.split(FIELD_SEP);
2466
- const parsed = (0, exports.parseSessionName)(name);
2467
- if (!parsed) {
2504
+ const f = line.split(FIELD_SEP);
2505
+ if (f.length !== PANE_FIELDS) {
2506
+ malformed += 1;
2507
+ continue;
2508
+ }
2509
+ const [name, attached, created, activity, win, idx, paneId, current, start, path, pid] = f;
2510
+ if (!(0, exports.parseSessionName)(name)) {
2468
2511
  // Not noisy enough to log every plain tmux session here —
2469
2512
  // would clutter the verbose output on machines with many
2470
2513
  // non-zeph sessions.
2471
2514
  continue;
2472
2515
  }
2473
- const info = readPaneInfo(name);
2474
- const agent = (0, exports.detectRemoteAgent)(info);
2475
- if (!agent) {
2516
+ const numeric = (v) => {
2517
+ const n = Number(v);
2518
+ return Number.isInteger(n) && n >= 0 ? n : Number.MAX_SAFE_INTEGER;
2519
+ };
2520
+ const row = {
2521
+ paneId,
2522
+ win: numeric(win),
2523
+ idx: numeric(idx),
2524
+ info: {
2525
+ currentCommand: current || null,
2526
+ startCommand: start || null,
2527
+ currentPath: path || null,
2528
+ panePid: numeric(pid) === Number.MAX_SAFE_INTEGER ? null : numeric(pid),
2529
+ },
2530
+ };
2531
+ const group = groups.get(name) ?? { attached: attached === '1', created, activity, panes: [] };
2532
+ group.panes.push(row);
2533
+ groups.set(name, group);
2534
+ }
2535
+ if (malformed > 0) {
2536
+ log(` tmux list-panes: skipped ${malformed} malformed row(s) — format separator may be mangled`);
2537
+ }
2538
+ // Pane cwd per session, read in the same sweep. Kept beside the wire shape
2539
+ // rather than in it: AgentSession is a server/phone contract and the
2540
+ // directory is local knowledge the registry needs, nothing the phone gets.
2541
+ const paneCwdOf = new Map();
2542
+ const targets = {};
2543
+ for (const [name, group] of groups) {
2544
+ const parsed = (0, exports.parseSessionName)(name);
2545
+ if (!parsed)
2546
+ continue; // unreachable — groups only holds parsed names
2547
+ // Main pane = the lowest (window, pane) index that runs an agent.
2548
+ // pi-interactive-subagents splits `-d` to the RIGHT of the parent, so
2549
+ // the parent keeps the lower index; a manual left split would take the
2550
+ // main role — accepted. Focus decides nothing here, which is the point:
2551
+ // focusing a subagent pane must not move the phone's view of the main.
2552
+ group.panes.sort((a, b) => (a.win - b.win) || (a.idx - b.idx));
2553
+ let main = null;
2554
+ for (const row of group.panes) {
2555
+ const agent = (0, exports.detectRemoteAgent)(row.info);
2556
+ if (agent) {
2557
+ main = { row, agent };
2558
+ break;
2559
+ }
2560
+ }
2561
+ if (!main) {
2562
+ const first = group.panes[0]?.info;
2476
2563
  rejected.push({
2477
2564
  name,
2478
- reason: `no agent in pane (start=${info.startCommand ?? 'null'}, current=${info.currentCommand ?? 'null'})`,
2565
+ reason: `no agent in pane (start=${first?.startCommand ?? 'null'}, current=${first?.currentCommand ?? 'null'})`,
2479
2566
  });
2480
2567
  continue;
2481
2568
  }
2569
+ const info = main.row.info;
2482
2570
  const agentSessionId = info.currentPath
2483
- ? (agent.resolveSessionId?.(info.currentPath, info.panePid ?? undefined) ?? null)
2571
+ ? (main.agent.resolveSessionId?.(info.currentPath, info.panePid ?? undefined) ?? null)
2484
2572
  : null;
2485
2573
  const providerSessionName = info.currentPath
2486
- ? (agent.resolveSessionName?.(info.currentPath, info.panePid ?? undefined) ?? null)
2574
+ ? (main.agent.resolveSessionName?.(info.currentPath, info.panePid ?? undefined) ?? null)
2487
2575
  : null;
2488
2576
  if (info.currentPath)
2489
2577
  paneCwdOf.set(name, info.currentPath);
2578
+ targets[name] = main.row.paneId;
2490
2579
  sessions.push({
2491
2580
  name,
2492
- attached: attached === '1',
2493
- agentKind: agent.kind,
2581
+ attached: group.attached,
2582
+ agentKind: main.agent.kind,
2494
2583
  agentSessionId,
2495
2584
  project: parsed.project,
2496
2585
  label: parsed.label,
2497
2586
  providerSessionName,
2498
- createdAt: epochToIso(created),
2499
- lastActivityAt: epochToIso(activity),
2500
- ...(0, exports.deriveSessionState)(name, agent.kind, capturePaneText(name)),
2587
+ createdAt: epochToIso(group.created),
2588
+ lastActivityAt: epochToIso(group.activity),
2589
+ ...(0, exports.deriveSessionState)(name, main.agent.kind, capturePaneText(main.row.paneId)),
2501
2590
  });
2502
2591
  }
2503
2592
  pruneSessionStates(new Set(sessions.map((s) => s.name)));
@@ -2512,7 +2601,7 @@ const collectSessionsVerbose = () => {
2512
2601
  project: s.project,
2513
2602
  label: s.label,
2514
2603
  })));
2515
- return { sessions, rejected };
2604
+ return { sessions, rejected, targets };
2516
2605
  };
2517
2606
  exports.collectSessionsVerbose = collectSessionsVerbose;
2518
2607
  /**
@@ -2524,7 +2613,14 @@ exports.collectSessionsVerbose = collectSessionsVerbose;
2524
2613
  * something not registered in remote-agents.ts are filtered out — the
2525
2614
  * phone can't usefully address them.
2526
2615
  */
2527
- const collectSessions = () => (0, exports.collectSessionsVerbose)().sessions;
2616
+ const collectSessions = () => {
2617
+ const result = (0, exports.collectSessionsVerbose)();
2618
+ // The membership path also refreshes the pane targets: a session younger
2619
+ // than one report cycle gets its pane id pinned here rather than falling
2620
+ // back to the (focus-following) bare session name.
2621
+ (0, exports.recordTargets)(result.targets);
2622
+ return result.sessions;
2623
+ };
2528
2624
  /** Names from the most recent inventory sweep; null until the first one lands —
2529
2625
  * a membership check in that window (the connect burst) still sweeps in-thread. */
2530
2626
  let inventorySnapshot = null;
@@ -3084,8 +3180,9 @@ const streamSession = (wsUrl, apiKey) => {
3084
3180
  sweepInFlight = false;
3085
3181
  }
3086
3182
  };
3087
- const publishSessions = ({ sessions, rejected }) => {
3183
+ const publishSessions = ({ sessions, rejected, targets }) => {
3088
3184
  (0, exports.recordInventory)(sessions);
3185
+ (0, exports.recordTargets)(targets);
3089
3186
  // Let the user's own status bar say what the phone says. Change-gated
3090
3187
  // internally, so an unchanged sweep spawns nothing.
3091
3188
  (0, exports.syncTmuxAgentNames)(sessions);
@@ -2,6 +2,7 @@
2
2
  * NOT here — its hook ships with the plugin (hooks/zeph-remote.sh). */
3
3
  export declare const REMOTE_HOOK_AGENTS: readonly ["gemini", "codex", "pi"];
4
4
  export type RemoteHookAgent = (typeof REMOTE_HOOK_AGENTS)[number];
5
+ export declare const remoteEntrySections: () => string;
5
6
  export declare const isRemoteHookAgent: (raw: string) => raw is RemoteHookAgent;
6
7
  /**
7
8
  * Core of the hook: match the stdin payload against the marker and return
@@ -1 +1 @@
1
- {"version":3,"file":"remote-hook.d.ts","sourceRoot":"","sources":["../src/remote-hook.ts"],"names":[],"mappings":"AA0CA;wEACwE;AACxE,eAAO,MAAM,kBAAkB,oCAAqC,CAAC;AACrE,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC;AAqClE,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,IA0CX,CAAC"}
1
+ {"version":3,"file":"remote-hook.d.ts","sourceRoot":"","sources":["../src/remote-hook.ts"],"names":[],"mappings":"AA4CA;wEACwE;AACxE,eAAO,MAAM,kBAAkB,oCAAqC,CAAC;AACrE,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC;AAkClE,eAAO,MAAM,mBAAmB,QAAO,MAGtB,CAAC;AAgBlB,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,IA2CX,CAAC"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.runRemoteHook = exports.isRemoteHookAgent = exports.REMOTE_HOOK_AGENTS = void 0;
3
+ exports.runRemoteHook = exports.isRemoteHookAgent = exports.remoteEntrySections = exports.REMOTE_HOOK_AGENTS = void 0;
4
4
  /**
5
5
  * `zeph remote-hook <agent>` — prompt-submit hook handler for agents whose
6
6
  * hooks the cli installs directly: Gemini CLI (BeforeAgent), Codex CLI
@@ -33,6 +33,8 @@ exports.runRemoteHook = exports.isRemoteHookAgent = exports.REMOTE_HOOK_AGENTS =
33
33
  */
34
34
  const fs_1 = require("fs");
35
35
  const config_js_1 = require("./config.js");
36
+ const core_sections_js_1 = require("./core-sections.js");
37
+ const zeph_core_generated_js_1 = require("./zeph-core.generated.js");
36
38
  const gate_js_1 = require("./gate.js");
37
39
  /** Agents whose prompt-submit hooks this command serves. Claude Code is
38
40
  * NOT here — its hook ships with the plugin (hooks/zeph-remote.sh). */
@@ -55,6 +57,21 @@ const FRESH_WINDOW_SEC = 900;
55
57
  const TWO_WAY_CONTEXT = `# System note (Zeph remote-origin detect)
56
58
 
57
59
  This user message arrived from the user's phone via Zeph agent chat (verified by the listener — exact text match). The user is driving this session remotely and is NOT at the terminal. Enter sticky REMOTE mode now (the "Sticky REMOTE mode" rule in your Zeph rules): end EVERY response with \`zeph_ask\` (buttons + free-text) until the user exits — an exit signal (done/stop/exit), or a prompt they type at the terminal, which this hook will tell you about. Plain-text questions are invisible to them.`;
60
+ // The static rule file of these agents carries the NORMAL branch only
61
+ // (templates.ts PROMPT_HOOK_CORE), so the turn that enters REMOTE is where the
62
+ // contract has to arrive in full — the twin of plugin/hooks/zeph-remote.sh
63
+ // reading CORE_RULES.md on entry. Read from the generated core rather than
64
+ // restated here: a copy would be one more place for the rule to drift. The
65
+ // four sections together cite only rules they carry (1–4, 7–9), so no
66
+ // cross-reference dangles; remote-hook.test.ts checks that. Sent once per
67
+ // entry: a later phone prompt on a session already in REMOTE gets the note
68
+ // alone, since the contract is already in its context. Sliced on that turn
69
+ // only — this command runs on every prompt submit, and the common path is a
70
+ // silent no-op. Exported for the tests.
71
+ const remoteEntrySections = () => ['When zeph_ask is MANDATORY', 'When zeph_ask is the DEFAULT', 'Sticky REMOTE mode', 'When to use AskUserQuestion vs zeph_ask']
72
+ .map((heading) => (0, core_sections_js_1.coreSection)(zeph_core_generated_js_1.ZEPH_CORE_HOOK_DRIVEN, heading))
73
+ .join('\n\n');
74
+ exports.remoteEntrySections = remoteEntrySections;
58
75
  const ONE_WAY_CONTEXT = `# System note (Zeph remote-origin detect)
59
76
 
60
77
  This user message arrived from the user's phone via Zeph agent chat (verified by the listener — exact text match), but no hook id is configured (neither \`ZEPH_HOOK_ID\` nor \`hookId\` in ~/.zeph/config.json), 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).`;
@@ -105,8 +122,9 @@ const runRemoteHook = (agent, stdin, env = process.env, now = Date.now) => {
105
122
  return emit(ONE_WAY_CONTEXT);
106
123
  // Only a two-way session has a mode to stay in — without zeph_ask there is
107
124
  // nothing for a later turn to be reminded of, so no state is recorded.
125
+ const entering = !(0, gate_js_1.isRemoteActive)(cwd, now);
108
126
  (0, gate_js_1.touchRemoteActive)(cwd, now);
109
- return emit(TWO_WAY_CONTEXT);
127
+ return emit(entering ? `${TWO_WAY_CONTEXT}\n\n${(0, exports.remoteEntrySections)()}` : TWO_WAY_CONTEXT);
110
128
  }
111
129
  if (origin === 'keyboard' && (0, gate_js_1.isRemoteActive)(cwd, now) && (0, config_js_1.resolveHookId)(env)) {
112
130
  (0, gate_js_1.clearRemoteActive)(cwd);
@@ -4,9 +4,9 @@ export declare const PI_PROMPT_GRACE_MS = 10000;
4
4
  export declare const CURSOR_RULE: string;
5
5
  /** Windsurf — appended into ~/.codeium/windsurf/memories/global_rules.md. No prompt hook. */
6
6
  export declare const WINDSURF_RULE: string;
7
- /** Gemini CLI — appended into ~/.gemini/GEMINI.md. Has the prompt hook (GEMINI_HOOKS). */
7
+ /** Gemini CLI — appended into ~/.gemini/GEMINI.md. Has the prompt hook (GEMINI_HOOKS), so NORMAL-only core. */
8
8
  export declare const GEMINI_RULE: string;
9
- /** Codex CLI — appended into ~/.codex/AGENTS.md. Has the prompt hook (CODEX_HOOKS). */
9
+ /** Codex CLI — appended into ~/.codex/AGENTS.md. Has the prompt hook (CODEX_HOOKS), so NORMAL-only core. */
10
10
  export declare const CODEX_RULE: string;
11
11
  /** GitHub Copilot CLI — written to ~/.copilot/instructions/zeph.instructions.md. No prompt hook. */
12
12
  export declare const COPILOT_RULE: string;
@@ -14,7 +14,7 @@ export declare const COPILOT_RULE: string;
14
14
  export declare const CLINE_RULE: string;
15
15
  /** Aider — standalone conventions file via .aider.conf.yml `read:` (no Stop hook, no prompt hook). */
16
16
  export declare const AIDER_RULE: string;
17
- /** Pi — managed block in ~/.pi/agent/AGENTS.md. Extension = Stop-equivalent + prompt hook + waiting-on-you push (PI_EXTENSION). */
17
+ /** Pi — managed block in ~/.pi/agent/AGENTS.md. Extension = Stop-equivalent + prompt hook + waiting-on-you push (PI_EXTENSION), so NORMAL-only core. */
18
18
  export declare const PI_RULE: string;
19
19
  /** OpenCode — managed block in ~/.config/opencode/AGENTS.md. Stop hook via plugin, no prompt hook (v1). */
20
20
  export declare const OPENCODE_RULE: string;
@@ -1 +1 @@
1
- {"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../src/templates.ts"],"names":[],"mappings":"AA+FA,oGAAoG;AACpG,eAAO,MAAM,kBAAkB,QAAS,CAAC;AAoHzC,6FAA6F;AAC7F,eAAO,MAAM,WAAW,QAKtB,CAAC;AAEH,6FAA6F;AAC7F,eAAO,MAAM,aAAa,QAIxB,CAAC;AAEH,0FAA0F;AAC1F,eAAO,MAAM,WAAW,QAAyE,CAAC;AAElG,uFAAuF;AACvF,eAAO,MAAM,UAAU,QAAyE,CAAC;AAEjG,oGAAoG;AACpG,eAAO,MAAM,YAAY,QAIvB,CAAC;AAEH,gFAAgF;AAChF,eAAO,MAAM,UAAU,QAIrB,CAAC;AAEH,sGAAsG;AACtG,eAAO,MAAM,UAAU,QAIrB,CAAC;AAEH,mIAAmI;AACnI,eAAO,MAAM,OAAO,QAKlB,CAAC;AAEH,2GAA2G;AAC3G,eAAO,MAAM,aAAa,QAIxB,CAAC;AAIH,eAAO,MAAM,YAAY,QAKd,CAAC;AAEZ,eAAO,MAAM,cAAc,QAOhB,CAAC;AAEZ,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;CAuBxB,CAAC;AAYF,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;CASvB,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,GAAI,OAAO,OAAO,KAAG,OAUhD,CAAC;AAEF,eAAO,MAAM,aAAa,QASf,CAAC;AAQZ,2FAA2F;AAC3F,eAAO,MAAM,YAAY,QAgJxB,CAAC;AAEF,kGAAkG;AAClG,eAAO,MAAM,eAAe,QAwG3B,CAAC;AASF,eAAO,MAAM,eAAe,oFAA+E,CAAC;AAC5G,eAAO,MAAM,aAAa,sBAAsB,CAAC;AAQjD;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,GAAI,UAAU,MAAM,EAA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AAO,MAAM,kBAAkB,GAAI,UAAU,MAAM,EAAE,MAAM,MAAM,KAAG,MAWnE,CAAC;AAEF,uEAAuE;AACvE,eAAO,MAAM,kBAAkB,GAAI,UAAU,MAAM,KAAG,MAOrD,CAAC"}
package/dist/templates.js CHANGED
@@ -23,11 +23,20 @@
23
23
  // ask itself — so for them the NORMAL branch must still send one after real
24
24
  // work, or the phone loop can never begin. That is REMOTE_ENTRY_NO_HOOK.
25
25
  //
26
+ // The same axis decides how much of the core the static rule file carries.
27
+ // That file is read on every turn, and a session is NORMAL nearly all of the
28
+ // time, so for the three hook agents it carries the NORMAL branch only
29
+ // (PROMPT_HOOK_CORE) — the REMOTE sections arrive from the hook on the turn
30
+ // that enters REMOTE (remote-hook.ts remoteEntrySections), the way the
31
+ // plugin's SessionStart / UserPromptSubmit pair does it for Claude Code. The
32
+ // hook-less agents have no such turn, so their file keeps the whole core.
33
+ //
26
34
  // Keeping this in one place means a rule change lands everywhere at once
27
35
  // and the agents can't drift apart.
28
36
  Object.defineProperty(exports, "__esModule", { value: true });
29
37
  exports.removeManagedBlock = exports.upsertManagedBlock = exports.ZEPH_MARK_END = exports.ZEPH_MARK_START = exports.OPENCODE_PLUGIN = exports.PI_EXTENSION = exports.COPILOT_HOOKS = exports.isZephHookGroup = exports.CODEX_HOOKS = exports.GEMINI_HOOKS = exports.WINDSURF_HOOKS = exports.CURSOR_HOOKS = exports.OPENCODE_RULE = exports.PI_RULE = exports.AIDER_RULE = exports.CLINE_RULE = exports.COPILOT_RULE = exports.CODEX_RULE = exports.GEMINI_RULE = exports.WINDSURF_RULE = exports.CURSOR_RULE = exports.PI_PROMPT_GRACE_MS = void 0;
30
38
  const gate_js_1 = require("./gate.js");
39
+ const core_sections_js_1 = require("./core-sections.js");
31
40
  const zeph_core_generated_js_1 = require("./zeph-core.generated.js");
32
41
  // Graceful resolution: prefer the installed `zeph` CLI, but fall back to
33
42
  // `npx -y @zeph-to/cli` so the hook still fires when the user
@@ -170,6 +179,30 @@ shown or kept:
170
179
 
171
180
  No marker → the heuristic: fewer than 2 tool calls, or only read-only ones,
172
181
  stays silent. Markers are lowercase and exact.`;
182
+ // NORMAL-only core — agents WITH a prompt-submit hook (Gemini, Codex, Pi).
183
+ // Mirrors plugin/hooks/zeph-setup.js `normal()`: the NORMAL branch owes no
184
+ // `zeph_ask`, so it carries none of the REMOTE-scoped sections (MANDATORY /
185
+ // DEFAULT / Sticky REMOTE / AskUserQuestion-vs) — about three quarters of the
186
+ // core, paid on every turn of a session that is almost always NORMAL. What it
187
+ // needs is the trigger: what flips the session, and what that turns on, stated
188
+ // here rather than pointed at because a `zeph_ask` answer reporting
189
+ // `zephState: "REMOTE"` flips it mid-turn with no hook to say so. The turn a
190
+ // phone message arrives, remote-hook.ts injects the REMOTE sections in full.
191
+ // Sections keep the numbers the core gave them (a render concern the extractor
192
+ // settled per audience; the plugin's NORMAL branch has the same gaps).
193
+ const REMOTE_STUB = `### What starts REMOTE
194
+
195
+ The user sending a message from their phone starts sticky REMOTE — the prompt-submit hook says so on that turn and injects the contract in full. A \`zeph_ask\` result reporting \`zephState: "REMOTE"\` starts it mid-turn.
196
+
197
+ From that response on: end EVERY response with \`zeph_ask\` (2–4 \`actions\` plus a Done-like \`fallback\`, \`timeout\` 300–600s), route button-friendly questions through it instead of \`AskUserQuestion\`, and never end on a plain-text question — until the user exits with a Done-like button, a free-text wrap-up you read as one (emit \`<!-- zeph: exit -->\` once), or a prompt they type at the terminal.`;
198
+ const PROMPT_HOOK_CORE = [
199
+ `## NORMAL — the user is at the terminal
200
+
201
+ Zeph can hand this session to the user's phone, but nobody has done that yet. **You owe no \`zeph_ask\`**: ask questions at the terminal or in prose, and let the end-of-turn push be the completion signal. A \`zeph_ask\` here blocks the turn until someone answers on a device or it times out.`,
202
+ (0, core_sections_js_1.coreSection)(zeph_core_generated_js_1.ZEPH_CORE_HOOK_DRIVEN, 'Handling the response'),
203
+ REMOTE_STUB,
204
+ (0, core_sections_js_1.coreSection)(zeph_core_generated_js_1.ZEPH_CORE_HOOK_DRIVEN, 'Persistence'),
205
+ ].join('\n\n');
173
206
  /** Assemble a full rule document from optional frontmatter + preambles + core. */
174
207
  const buildRule = (opts) => {
175
208
  const fm = opts.frontmatter ? `${opts.frontmatter}\n\n` : '';
@@ -205,10 +238,10 @@ exports.WINDSURF_RULE = buildRule({
205
238
  remoteEntry: REMOTE_ENTRY_NO_HOOK,
206
239
  core: zeph_core_generated_js_1.ZEPH_CORE_HOOK_DRIVEN,
207
240
  });
208
- /** Gemini CLI — appended into ~/.gemini/GEMINI.md. Has the prompt hook (GEMINI_HOOKS). */
209
- exports.GEMINI_RULE = buildRule({ notify: HOOK_DRIVEN_NOTIFY, core: zeph_core_generated_js_1.ZEPH_CORE_HOOK_DRIVEN });
210
- /** Codex CLI — appended into ~/.codex/AGENTS.md. Has the prompt hook (CODEX_HOOKS). */
211
- exports.CODEX_RULE = buildRule({ notify: HOOK_DRIVEN_NOTIFY, core: zeph_core_generated_js_1.ZEPH_CORE_HOOK_DRIVEN });
241
+ /** Gemini CLI — appended into ~/.gemini/GEMINI.md. Has the prompt hook (GEMINI_HOOKS), so NORMAL-only core. */
242
+ exports.GEMINI_RULE = buildRule({ notify: HOOK_DRIVEN_NOTIFY, core: PROMPT_HOOK_CORE });
243
+ /** Codex CLI — appended into ~/.codex/AGENTS.md. Has the prompt hook (CODEX_HOOKS), so NORMAL-only core. */
244
+ exports.CODEX_RULE = buildRule({ notify: HOOK_DRIVEN_NOTIFY, core: PROMPT_HOOK_CORE });
212
245
  /** GitHub Copilot CLI — written to ~/.copilot/instructions/zeph.instructions.md. No prompt hook. */
213
246
  exports.COPILOT_RULE = buildRule({
214
247
  notify: HOOK_DRIVEN_NOTIFY,
@@ -227,12 +260,12 @@ exports.AIDER_RULE = buildRule({
227
260
  remoteEntry: REMOTE_ENTRY_NO_HOOK,
228
261
  core: zeph_core_generated_js_1.ZEPH_CORE_RULE_ONLY,
229
262
  });
230
- /** Pi — managed block in ~/.pi/agent/AGENTS.md. Extension = Stop-equivalent + prompt hook + waiting-on-you push (PI_EXTENSION). */
263
+ /** Pi — managed block in ~/.pi/agent/AGENTS.md. Extension = Stop-equivalent + prompt hook + waiting-on-you push (PI_EXTENSION), so NORMAL-only core. */
231
264
  exports.PI_RULE = buildRule({
232
265
  notify: HOOK_DRIVEN_NOTIFY,
233
266
  toolAccess: PI_TOOL_ACCESS,
234
267
  pushSignal: PI_PUSH_SIGNAL,
235
- core: zeph_core_generated_js_1.ZEPH_CORE_HOOK_DRIVEN,
268
+ core: PROMPT_HOOK_CORE,
236
269
  });
237
270
  /** OpenCode — managed block in ~/.config/opencode/AGENTS.md. Stop hook via plugin, no prompt hook (v1). */
238
271
  exports.OPENCODE_RULE = buildRule({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeph-to/cli",
3
- "version": "2.17.0",
3
+ "version": "2.18.0",
4
4
  "description": "Zeph CLI + push notification SDK for AI agents",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",