import { Hono } from 'hono'; import { type SpawnDeps } from './pty-spawner.js'; import type { PtyCensusSnapshot } from './pty-census.js'; import type { FsWatcher } from './fs-watcher.js'; import type { SubagentInjectionTail } from './subagent-injection-tail.js'; import type { RateLimiter } from './spawn-rate-limiter.js'; import type { AuditRegistry } from './public-tool-audit.js'; import { AccountTitleStores } from './account-title-stores.js'; import { WaChannelStore } from './wa-channel-store.js'; import { WebchatChannelStore } from './webchat-channel-store.js'; import { TelegramChannelStore } from './telegram-channel-store.js'; export declare const SESSION_ID_PATTERN: RegExp; export declare const RC_SPAWN_URL_WAIT_DEFAULT_MS = 60000; export interface HttpDeps extends Omit { /** Admin operator's userId, sourced from users.json at boot (same as * RcDaemonDeps.userId). Passed to buildRcChildEnv so the scheduling MCP * and other USER_ID consumers work under /rc-spawn sessions. */ userId?: string; watcher: FsWatcher; /** Task 1865 — audits injection-refusal judgments made by in-process * Agent-tool subagents. Optional so pre-1865 test deps factories keep * working unchanged; production index.ts always injects it. */ subagentInjectionTail?: SubagentInjectionTail; killGraceMs: number; jsonlReadMaxBytes: number; publicSpawnLimiter: RateLimiter; publicToolAudit: AuditRegistry; /** Task 253 — operator-stamped title override store. Reads merge into * every displayName resolution site; the /:sessionId/rename route writes. */ titleStores: AccountTitleStores; /** Task 683 — per-session WhatsApp channel binding. Gateway `/rc-spawn` * write-throughs it; every resume path reads it back to re-apply the * channel argv so `reply` is present on every live PTY for the session. */ waChannelStore: WaChannelStore; /** Task 772 — per-session webchat channel binding, the webchat twin of * waChannelStore. Optional so the pre-772 test deps factories (which run * the live /rc-spawn handler) keep working unchanged; production index.ts * always injects it. */ webchatChannelStore?: WebchatChannelStore; /** Per-session telegram channel binding, the telegram twin of * webchatChannelStore. Optional for the same reason: test deps factories * that run the live /rc-spawn handler keep working unchanged; production * index.ts always injects it. */ telegramChannelStore?: TelegramChannelStore; /** Task 648 — override the `/rc-spawn` pid/bind poll bound. Production * omits this and gets RC_SPAWN_URL_WAIT_DEFAULT_MS (60s); tests inject a * short value to exercise the bind-timeout response without a 60s wait. */ rcSpawnUrlWaitMs?: number; /** Task 1749 — accessor for the standing PTY census's most recent snapshot, * wired from `createPtyCensus(...).latest`. Optional so the pre-1749 test * deps factories keep working; production index.ts always injects it. * `GET /census` serves what this returns and never collects inline. */ censusLatest?: () => PtyCensusSnapshot | null; } /** Task 1090 Phase 2 + Task 1184 — the `tool_use` ids in the bounded tail with * no matching `tool_result` after them: the signature of an interrupt or death * that landed mid-tool-call, which would corrupt a later `--resume` (the API * rejects a tool_use with no following tool_result). Bounded (last 64KB) so a * large transcript never blocks the check; the window only needs the last * turn's tool pairing. Returns [] on any read error (no file yet, gone) — * absence of evidence is not a dangling use. Order-preserving. */ export declare function danglingToolUseIds(jsonlPath: string): string[]; /** Task 1184 — append one synthetic user record supplying an is_error * tool_result for each dangling tool_use, so a `--resume` of a session whose * child died mid-tool-call has no unmatched tool_use. Envelope fields * (cwd/version/gitBranch/parentUuid) are copied forward from the last on-disk * record so the synthetic record matches claude's own shape; uuid and * timestamp are minted. Idempotent: returns false when nothing dangles or on * any error. */ export declare function appendTurnAbortTerminator(jsonlPath: string, sessionId: string): boolean; /** Task 1184 — the open-turn signature of a dead-child phantom. Reads the * bounded tail (last 64KB) and reports whether the last assistant record * carries no terminal `stop_reason` — the turn was streaming when the child * died (no end_turn was ever written). A terminal stop (end_turn / * stop_sequence / max_tokens) is a completed turn → false. No assistant * record in the window, or any read error → false (absence of evidence is * not an open turn). */ export declare function tailIsOpenTurn(jsonlPath: string): boolean; export declare function forkArgvSegment(fromSessionId: string, newSessionId: string, model: string): string[]; export declare function reseatIdentityPrompt(model: string): string; export declare function authenticatedIdentityPrompt(name: string | null): string; export declare function formatReseatLine(fromModel: string | null, toModel: string, oldSessionId: string, newSessionId: string, observed: string | null): string; export declare function firstPostArmAssistantModel(lines: string[], armTimeMs: number): string | null; export declare function attachPassiveEndTurnAutoClose(deps: HttpDeps, sessionId: string, passive: boolean): void; export declare function attachPassiveSpawnToolsCensus(deps: HttpDeps, spawnCwd: string, sessionId: string, passive: boolean, assignedAdminEnv: boolean): void; /** Task 189 — Hono instance with the test-only fan-out trigger attached. * The vitest fixture for the `/events` url-capture re-emit drives this * directly (no real PTY spawn in the suite); production callers route * through the SpawnDeps `onUrlCaptured` callback wired below. */ export type HttpApp = Hono & { __notifyUrlCapturedForTests(sessionId: string): void; /** Task 253 — drive a synthetic rename re-emit without going through * the POST route. Production callers route through `notifyRename` in * the rename handler; this seam lets vitest exercise the /events * fan-out without a real HTTP request. */ __notifyRenameForTests(sessionId: string): void; }; export declare function buildHttpApp(deps: HttpDeps): HttpApp; //# sourceMappingURL=http-server.d.ts.map