@hua-labs/tap 0.5.1 → 0.6.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/AI_GUIDE.md +165 -0
- package/CHANGELOG.md +67 -0
- package/README.md +201 -12
- package/dist/bridges/codex-app-server-auth-gateway.mjs +16 -1
- package/dist/bridges/codex-app-server-auth-gateway.mjs.map +1 -1
- package/dist/bridges/codex-app-server-bridge.d.mts +105 -12
- package/dist/bridges/codex-app-server-bridge.mjs +3149 -251
- package/dist/bridges/codex-app-server-bridge.mjs.map +1 -1
- package/dist/bridges/codex-bridge-runner.d.mts +4 -1
- package/dist/bridges/codex-bridge-runner.mjs +512 -58
- package/dist/bridges/codex-bridge-runner.mjs.map +1 -1
- package/dist/bridges/codex-remote-ipc-relay.d.mts +1 -0
- package/dist/bridges/codex-remote-ipc-relay.mjs +1912 -0
- package/dist/bridges/codex-remote-ipc-relay.mjs.map +1 -0
- package/dist/bridges/gemini-ide-companion-runner.mjs.map +1 -1
- package/dist/cli.mjs +30944 -8415
- package/dist/cli.mjs.map +1 -1
- package/dist/codex-a2a/index.d.mts +2 -0
- package/dist/codex-a2a/index.mjs +416 -0
- package/dist/codex-a2a/index.mjs.map +1 -0
- package/dist/codex-health/index.d.mts +76 -0
- package/dist/codex-health/index.mjs +153 -0
- package/dist/codex-health/index.mjs.map +1 -0
- package/dist/codex-ipc/index.d.mts +2 -0
- package/dist/codex-ipc/index.mjs +1834 -0
- package/dist/codex-ipc/index.mjs.map +1 -0
- package/dist/index-D4Khz2Mh.d.mts +206 -0
- package/dist/index-DMToLyGd.d.mts +256 -0
- package/dist/index.d.mts +763 -8
- package/dist/index.mjs +11600 -3449
- package/dist/index.mjs.map +1 -1
- package/dist/mcp-server.mjs +8838 -811
- package/dist/mcp-server.mjs.map +1 -1
- package/dist/types-FWvKrFUt.d.mts +43 -0
- package/examples/01-logic-battle-known-broken.md +46 -0
- package/examples/02-cross-model-review-root-cause.md +37 -0
- package/examples/03-convergence-pattern.md +42 -0
- package/examples/04-tower-broadcast.md +41 -0
- package/examples/05-self-awareness-paradox.md +49 -0
- package/examples/06-session-resurrection.md +37 -0
- package/examples/07-ghost-agent.md +31 -0
- package/examples/08-naming-creates-identity.md +36 -0
- package/examples/09-ceo-as-middleware.md +52 -0
- package/examples/10-files-as-interface.md +67 -0
- package/examples/README.md +34 -0
- package/examples/tap-profile-pack.example.json +71 -0
- package/package.json +21 -3
package/dist/index.d.mts
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
import { O as ObserveTransport, a as ObserveTransportSnapshot, b as ObserveTransportListener } from './types-FWvKrFUt.mjs';
|
|
2
|
+
export { c as ObserveTransportAgent, d as ObserveTransportConversation, e as ObserveTransportEvent, f as ObserveTransportEventKind, T as TransportAddress } from './types-FWvKrFUt.mjs';
|
|
3
|
+
import { C as CapabilityScope, a as CodexIpcObserveTransportOptions } from './index-DMToLyGd.mjs';
|
|
4
|
+
export { b as CODEX_IPC_DRIVE_METHODS, c as CONSENT_RECEIPTS_DIRNAME, d as CodexIpcBroadcastMessage, e as CodexIpcControlTransportOptions, f as CodexIpcCreateConsentReceiptOptions, g as CodexIpcDraftActionOptions, h as CodexIpcDriveActionOptions, i as CodexIpcDriveActionResult, j as CodexIpcDriveMethod, k as CodexIpcDriveStartTurnOptions, l as CodexIpcMessage, m as CodexIpcRequestMessage, n as CodexIpcResponseMessage, o as CodexIpcSocket, p as CodexIpcStartTurnOptions, q as CodexIpcSuggestionDraft, r as ConsentReceipt, s as ConsentReceiptError, t as ConsumeConsentReceiptOptions, u as CreateConsentReceiptOptions, v as CreatedConsentReceipt, D as DEFAULT_CODEX_IPC_PIPE_PATH, w as DEFAULT_CODEX_IPC_WINDOWS_PIPE_PATH, x as DEFAULT_CONSENT_TTL_SECONDS, E as ExperimentalCodexIpcControlTransport, y as ExperimentalCodexIpcObserveTransport, R as ResolveCodexIpcPathOptions, z as buildFollowerStartTurnParams, A as consumeConsentReceipt, B as createConsentReceipt, F as createExperimentalCodexIpcControlTransport, G as createExperimentalCodexIpcObserveTransport, H as decodeCodexIpcFrames, I as encodeCodexIpcFrame, J as isCodexIpcDefaultSupported, K as resolveCodexIpcPath } from './index-DMToLyGd.mjs';
|
|
5
|
+
export { B as BuildCodexBindingRegistryOptions, C as CodexA2AAdapterKind, a as CodexA2ADeliveryRequest, b as CodexA2ADeliveryResult, c as CodexA2AFailureReason, d as CodexA2AMessageEnvelope, e as CodexA2ATargetTuple, f as CodexBinding, g as CodexBindingAddress, h as CodexBindingBlockReason, i as CodexBindingHeartbeat, j as CodexBindingRegistry, k as CodexBindingSource, l as CodexBindingStatus, m as ConsentDriveReceipt, n as ConsentDriveResponse, o as ConsentDriveTransport, p as ConsentDriveTransportFactory, R as RemoteCodexRelayConfig, q as RemoteCodexRelayExecutor, r as RemoteCodexRelayInput, s as RemoteCodexRelayResult, t as ResolveCodexBindingOptions, u as ResolveCodexBindingResult, v as ResolveCodexBindingTarget, T as TapReceiveTransport, w as buildCodexBindingRegistry, x as canUseConsentDriveForAddress, y as inferReceiveTransports, z as normalizeReceiveTransports, A as prefersConsentDrive, D as resolveCodexBinding } from './index-D4Khz2Mh.mjs';
|
|
6
|
+
|
|
1
7
|
type RuntimeName = "claude" | "codex" | "gemini";
|
|
2
8
|
type BridgeMode = "native-push" | "app-server" | "polling";
|
|
3
9
|
type Platform = "win32" | "darwin" | "linux";
|
|
@@ -118,7 +124,13 @@ interface BridgeLifecycleRecord {
|
|
|
118
124
|
interface BridgeState {
|
|
119
125
|
pid: number;
|
|
120
126
|
statePath: string;
|
|
121
|
-
|
|
127
|
+
/**
|
|
128
|
+
* M321 — Seed heartbeat timestamp, set at bridge start.
|
|
129
|
+
* Covers the pre-first-poll gap before runtime heartbeat.json is written.
|
|
130
|
+
* `resolveHeartbeatTimestamp()` prefers runtime heartbeat.json when available.
|
|
131
|
+
* Not actively updated after startup — runtime heartbeat.json is the SSOT.
|
|
132
|
+
*/
|
|
133
|
+
lastHeartbeat?: string;
|
|
122
134
|
appServer?: AppServerState | null;
|
|
123
135
|
/** Instance-specific daemon state dir (thread/heartbeat/processed markers). */
|
|
124
136
|
runtimeStateDir?: string | null;
|
|
@@ -128,7 +140,13 @@ interface BridgeState {
|
|
|
128
140
|
interface InstanceState {
|
|
129
141
|
instanceId: InstanceId;
|
|
130
142
|
runtime: RuntimeName;
|
|
131
|
-
|
|
143
|
+
/**
|
|
144
|
+
* Bootstrap default name set at install time (`tap add`) — display seed only.
|
|
145
|
+
* NOT the active session name; session names live in heartbeats + claims.
|
|
146
|
+
* M350: `agentName` (deprecated duplicate) removed. Legacy state files are
|
|
147
|
+
* migrated on load by backfilling this field from the old `agentName`.
|
|
148
|
+
*/
|
|
149
|
+
defaultAgentName: string | null;
|
|
132
150
|
port: number | null;
|
|
133
151
|
installed: boolean;
|
|
134
152
|
configPath: string;
|
|
@@ -147,6 +165,10 @@ interface InstanceState {
|
|
|
147
165
|
manageAppServer?: boolean;
|
|
148
166
|
/** Whether bridge runs without auth gateway. Saved for restart mode preservation. */
|
|
149
167
|
noAuth?: boolean;
|
|
168
|
+
/** Whether managed Codex app-server bypasses the Codex sandbox at launch. */
|
|
169
|
+
appServerUnsandboxed?: boolean;
|
|
170
|
+
/** Retained managed app-server metadata when bridge stops with --keep-server. */
|
|
171
|
+
managedAppServer?: AppServerState | null;
|
|
150
172
|
/** Stable hash of resolved config for drift detection (v3+). */
|
|
151
173
|
configHash?: string;
|
|
152
174
|
/** Path to the instance config file (v3+). */
|
|
@@ -186,8 +208,8 @@ interface TapStateV1 {
|
|
|
186
208
|
packageVersion: string;
|
|
187
209
|
runtimes: Partial<Record<RuntimeName, RuntimeState>>;
|
|
188
210
|
}
|
|
189
|
-
type CommandName = "init" | "init-worktree" | "add" | "remove" | "status" | "serve" | "bridge" | "up" | "down" | "comms" | "dashboard" | "doctor" | "watch" | "gui" | "unknown";
|
|
190
|
-
type CommandCode = "TAP_INIT_OK" | "TAP_ADD_OK" | "TAP_REMOVE_OK" | "TAP_STATUS_OK" | "TAP_SERVE_OK" | "TAP_NO_OP" | "TAP_ALREADY_INITIALIZED" | "TAP_INIT_CLONE_FAILED" | "TAP_NOT_INITIALIZED" | "TAP_RUNTIME_UNKNOWN" | "TAP_RUNTIME_NOT_FOUND" | "TAP_CONFIG_INVALID" | "TAP_LOCAL_SERVER_MISSING" | "TAP_INVALID_ARGUMENT" | "TAP_INSTANCE_NOT_FOUND" | "TAP_INSTANCE_AMBIGUOUS" | "TAP_PORT_CONFLICT" | "TAP_PATCH_FAILED" | "TAP_VERIFY_FAILED" | "TAP_ROLLBACK_FAILED" | "TAP_BRIDGE_START_OK" | "TAP_BRIDGE_START_FAILED" | "TAP_BRIDGE_STOP_OK" | "TAP_BRIDGE_STATUS_OK" | "TAP_BRIDGE_NOT_RUNNING" | "TAP_BRIDGE_SCRIPT_MISSING" | "TAP_UP_OK" | "TAP_DOWN_OK" | "TAP_COMMS_PULL_OK" | "TAP_COMMS_PULL_FAILED" | "TAP_COMMS_PUSH_OK" | "TAP_COMMS_PUSH_FAILED" | "TAP_COMMS_NOT_REPO" | "TAP_SERVE_NO_SERVER" | "TAP_SERVE_BUN_REQUIRED" | "TAP_REVIEW_START_OK" | "TAP_REVIEW_TERMINATED" | "TAP_WATCH_OK" | "TAP_WATCH_RESTARTED" | "TAP_WATCH_FAILED" | "TAP_BRIDGE_WATCH_OK" | "TAP_BRIDGE_WATCH_RESTARTED" | "TAP_PORT_IN_USE" | "TAP_GUI_ERROR" | "TAP_INTERNAL_ERROR";
|
|
211
|
+
type CommandName = "init" | "init-worktree" | "add" | "remove" | "status" | "setup" | "serve" | "bridge" | "up" | "down" | "comms" | "ready" | "receiver" | "headless" | "projection" | "uplink" | "dashboard" | "doctor" | "watch" | "gui" | "remote-panel" | "permissions" | "reviews" | "sessions" | "infra" | "windows-route-recover" | "app-route-freshness" | "comms-doctor" | "flow-doctor" | "unknown";
|
|
212
|
+
type CommandCode = "TAP_INIT_OK" | "TAP_ADD_OK" | "TAP_REMOVE_OK" | "TAP_STATUS_OK" | "TAP_STATUS_PROFILE_READY" | "TAP_STATUS_PROFILE_DEGRADED" | "TAP_STATUS_PROFILE_BLOCKED" | "TAP_SETUP_OK" | "TAP_SETUP_APPLY_NOT_IMPLEMENTED" | "TAP_SETUP_APPLY_BLOCKED" | "TAP_DOCTOR_SETUP_OK" | "TAP_DOCTOR_SETUP_APPLY_NOT_IMPLEMENTED" | "TAP_DOCTOR_SETUP_APPLY_BLOCKED" | "TAP_SERVE_OK" | "TAP_PERMISSIONS_RESTORE_OK" | "TAP_REVIEWS_RECOVERY_OK" | "TAP_REVIEWS_REGISTER_OK" | "TAP_SESSIONS_ARCHIVE_OK" | "TAP_INFRA_STATUS_OK" | "TAP_WINDOWS_ROUTE_RECOVER_OK" | "TAP_APP_ROUTE_FRESHNESS_OK" | "TAP_COMMS_DOCTOR_OK" | "TAP_FLOW_DOCTOR_OK" | "TAP_NO_OP" | "TAP_ALREADY_INITIALIZED" | "TAP_INIT_CLONE_FAILED" | "TAP_NOT_INITIALIZED" | "TAP_RUNTIME_UNKNOWN" | "TAP_RUNTIME_NOT_FOUND" | "TAP_CONFIG_INVALID" | "TAP_LOCAL_SERVER_MISSING" | "TAP_INVALID_ARGUMENT" | "TAP_STATUS_PROFILE_REQUIRED" | "TAP_STATUS_UNKNOWN_PROFILE" | "TAP_INSTANCE_NOT_FOUND" | "TAP_INSTANCE_AMBIGUOUS" | "TAP_PORT_CONFLICT" | "TAP_PATCH_FAILED" | "TAP_VERIFY_FAILED" | "TAP_ROLLBACK_FAILED" | "TAP_BRIDGE_START_OK" | "TAP_BRIDGE_START_FAILED" | "TAP_BRIDGE_RESTART_OK" | "TAP_BRIDGE_RESTART_FAILED" | "TAP_BRIDGE_RESTART_EXTERNAL" | "TAP_BRIDGE_RESTART_BLOCKED" | "TAP_BRIDGE_DRAIN_TIMEOUT" | "TAP_BRIDGE_STOP_OK" | "TAP_BRIDGE_STATUS_OK" | "TAP_BRIDGE_NOT_RUNNING" | "TAP_BRIDGE_SCRIPT_MISSING" | "TAP_UP_OK" | "TAP_DOWN_OK" | "TAP_COMMS_PULL_OK" | "TAP_COMMS_PULL_FAILED" | "TAP_COMMS_PUSH_OK" | "TAP_COMMS_PUSH_FAILED" | "TAP_COMMS_NOT_REPO" | "TAP_READY_OK" | "TAP_READY_APPLY_FAILED" | "TAP_RECEIVER_OK" | "TAP_PROJECTION_OK" | "TAP_UPLINK_OK" | "TAP_SERVE_NO_SERVER" | "TAP_SERVE_BUN_REQUIRED" | "TAP_REVIEW_START_OK" | "TAP_REVIEW_TERMINATED" | "TAP_WATCH_OK" | "TAP_WATCH_RESTARTED" | "TAP_WATCH_FAILED" | "TAP_BRIDGE_WATCH_OK" | "TAP_BRIDGE_WATCH_RESTARTED" | "TAP_PORT_IN_USE" | "TAP_GUI_ERROR" | "TAP_WINDOWS_ROUTE_RECOVER_BLOCKED" | "TAP_APP_ROUTE_FRESHNESS_BLOCKED" | "TAP_INTERNAL_ERROR";
|
|
191
213
|
interface CommandResult<T = Record<string, unknown>> {
|
|
192
214
|
ok: boolean;
|
|
193
215
|
command: CommandName;
|
|
@@ -274,6 +296,26 @@ interface TapSharedConfig {
|
|
|
274
296
|
commsRepoUrl?: string;
|
|
275
297
|
/** Control tower agent name. Used for auto-notify on new agent join (M111). */
|
|
276
298
|
towerName?: string;
|
|
299
|
+
/**
|
|
300
|
+
* M310: Known agents on remote machines that share this comms dir via git sync.
|
|
301
|
+
* These agents bypass local heartbeat validation in tap_reply routing,
|
|
302
|
+
* allowing cross-machine DM delivery through comms repo sync.
|
|
303
|
+
*/
|
|
304
|
+
remoteAgents?: string[];
|
|
305
|
+
/**
|
|
306
|
+
* M320: Optional map of instanceId -> preferred app-server port.
|
|
307
|
+
* When present, `tap add codex` consults this table before falling back to
|
|
308
|
+
* auto-assign. A missing entry, a conflicting state record, or a taken TCP
|
|
309
|
+
* port all downgrade the instance to auto-assign; entries never cause an
|
|
310
|
+
* error.
|
|
311
|
+
*
|
|
312
|
+
* Convention (non-enforced, for multi-instance setups):
|
|
313
|
+
* 4510 codex-tower, 4511 codex-wt1, 4512 codex-wt2
|
|
314
|
+
* 4520 codex-reviewer
|
|
315
|
+
* 4530 codex-probe
|
|
316
|
+
* 451x = active workers, 452x = reviewers, 453x = diagnostic/probe
|
|
317
|
+
*/
|
|
318
|
+
portMap?: Record<string, number>;
|
|
277
319
|
}
|
|
278
320
|
/**
|
|
279
321
|
* Local config (tap-config.local.json) — gitignored, machine-specific overrides.
|
|
@@ -290,6 +332,10 @@ interface TapResolvedConfig {
|
|
|
290
332
|
runtimeCommand: string;
|
|
291
333
|
appServerUrl: string;
|
|
292
334
|
towerName: string | null;
|
|
335
|
+
/** M310: Known agents on remote machines. */
|
|
336
|
+
remoteAgents: string[];
|
|
337
|
+
/** M320: Resolved instanceId -> port preferences (empty object when unset). */
|
|
338
|
+
portMap: Record<string, number>;
|
|
293
339
|
}
|
|
294
340
|
/** Config resolution source for diagnostics (legacy API — backward compatible). */
|
|
295
341
|
type ConfigSource = "cli-flag" | "env" | "local-config" | "shared-config" | "legacy-shell-config" | "auto";
|
|
@@ -314,11 +360,25 @@ interface ConfigOverrides {
|
|
|
314
360
|
declare function resolveConfig(overrides?: ConfigOverrides, startDir?: string): ConfigResolution;
|
|
315
361
|
declare function saveSharedConfig(repoRoot: string, config: TapSharedConfig): void;
|
|
316
362
|
declare function saveLocalConfig(repoRoot: string, config: TapLocalConfig): void;
|
|
317
|
-
|
|
363
|
+
|
|
364
|
+
declare function normalizeTapPath(input: string, platform?: NodeJS.Platform): string;
|
|
318
365
|
|
|
319
366
|
/**
|
|
320
367
|
* Bridge observability — heartbeat monitoring, turn stuck detection, log rotation.
|
|
321
368
|
*
|
|
369
|
+
* ## SSOT Hierarchy (M321)
|
|
370
|
+
*
|
|
371
|
+
* - **Process liveness** → `{runtimeStateDir}/heartbeat.json` (SSOT).
|
|
372
|
+
* Written by bridge-dispatch on each poll cycle. Contains detailed
|
|
373
|
+
* runtime state: threadId, turnState, connected, etc.
|
|
374
|
+
*
|
|
375
|
+
* - **`state.json` lastHeartbeat** → Legacy fallback only. No longer
|
|
376
|
+
* actively written. `resolveHeartbeatTimestamp()` prefers runtime
|
|
377
|
+
* heartbeat and falls back to this for pre-M321 state files.
|
|
378
|
+
*
|
|
379
|
+
* - **Agent presence** → `heartbeats.json` (commsDir). Separate concern,
|
|
380
|
+
* managed by MCP layer (`tap-plugin`). Not accessed here.
|
|
381
|
+
*
|
|
322
382
|
* Consolidated from bridge-state.ts (heartbeat/turn functions) and
|
|
323
383
|
* bridge-log-rotate.ts into a single observability module.
|
|
324
384
|
*
|
|
@@ -328,14 +388,48 @@ declare function normalizeTapPath(input: string): string;
|
|
|
328
388
|
/**
|
|
329
389
|
* Update the heartbeat timestamp for a running bridge.
|
|
330
390
|
* Only the owning process (matching PID) can update the heartbeat.
|
|
391
|
+
*
|
|
392
|
+
* @deprecated M321 — Runtime heartbeat (`{runtimeStateDir}/heartbeat.json`)
|
|
393
|
+
* is the SSOT for process liveness. `state.json lastHeartbeat` is no longer
|
|
394
|
+
* actively updated. This function is kept for backward compatibility but
|
|
395
|
+
* is a no-op. Use runtime heartbeat written by bridge-dispatch instead.
|
|
331
396
|
*/
|
|
332
|
-
declare function updateBridgeHeartbeat(
|
|
397
|
+
declare function updateBridgeHeartbeat(_stateDir: string, _instanceId: InstanceId): void;
|
|
333
398
|
/**
|
|
334
399
|
* Get heartbeat age in seconds. Returns null if no state or no heartbeat.
|
|
335
400
|
*/
|
|
336
401
|
declare function getHeartbeatAge(stateDir: string, instanceId: InstanceId): number | null;
|
|
337
402
|
declare function rotateLog(logPath: string): void;
|
|
338
403
|
|
|
404
|
+
/**
|
|
405
|
+
* Bridge state management — persistence, process liveness, runtime state readers.
|
|
406
|
+
*
|
|
407
|
+
* Extracted from engine/bridge.ts (Phase 2) to isolate state CRUD and
|
|
408
|
+
* runtime heartbeat/thread readers.
|
|
409
|
+
* Observability helpers (heartbeat age, turn stuck, log rotation) live in
|
|
410
|
+
* bridge-observability.ts.
|
|
411
|
+
*
|
|
412
|
+
* @module engine/bridge-state
|
|
413
|
+
*/
|
|
414
|
+
|
|
415
|
+
interface RuntimeBridgeHeartbeat {
|
|
416
|
+
updatedAt?: string;
|
|
417
|
+
threadId?: string | null;
|
|
418
|
+
threadCwd?: string | null;
|
|
419
|
+
activeTurnId?: string | null;
|
|
420
|
+
turnStartedAt?: string | null;
|
|
421
|
+
lastTurnStatus?: string | null;
|
|
422
|
+
lastTurnAt?: string | null;
|
|
423
|
+
lastDispatchAt?: string | null;
|
|
424
|
+
idleSince?: string | null;
|
|
425
|
+
turnState?: "active" | "idle" | "waiting-approval" | "disconnected" | null;
|
|
426
|
+
lastNotificationMethod?: string | null;
|
|
427
|
+
lastNotificationAt?: string | null;
|
|
428
|
+
lastError?: string | null;
|
|
429
|
+
connected?: boolean;
|
|
430
|
+
initialized?: boolean;
|
|
431
|
+
}
|
|
432
|
+
|
|
339
433
|
type BridgePresence = "bridge-live" | "bridge-stale" | "stopped";
|
|
340
434
|
type BridgeLifecycleStatus = "ready" | "initializing" | "degraded-no-thread" | "bridge-stale" | "stopped";
|
|
341
435
|
interface BridgeLifecycleSnapshot {
|
|
@@ -394,20 +488,50 @@ interface BridgeStartOptions {
|
|
|
394
488
|
manageAppServer?: boolean;
|
|
395
489
|
/** Skip auth gateway — app-server listens directly on the public port (localhost only). */
|
|
396
490
|
noAuth?: boolean;
|
|
491
|
+
/** Launch managed Codex app-server without the Codex sandbox. */
|
|
492
|
+
appServerUnsandboxed?: boolean;
|
|
493
|
+
/** Reuse previously managed app-server metadata even after bridge state is cleared. */
|
|
494
|
+
existingAppServer?: AppServerState | null;
|
|
397
495
|
/** Persisted lifecycle from the previous session, used to track restarts. */
|
|
398
496
|
previousLifecycle?: BridgeLifecycleRecord | null;
|
|
497
|
+
/**
|
|
498
|
+
* M392: per-session suffix appended to TAP_INSTANCE_ID for the bridge daemon.
|
|
499
|
+
* When set, bridge writes heartbeats under `${instanceId}-${suffix}` while the
|
|
500
|
+
* MCP server keeps the base id. Defense in depth alongside M354 1순위
|
|
501
|
+
* (ownership pruning) — different bucket, complementary defense.
|
|
502
|
+
*/
|
|
503
|
+
instanceIdSuffix?: string;
|
|
504
|
+
/**
|
|
505
|
+
* M392: explicit routing slot to inject as TAP_ROUTING_SLOT. Set when the
|
|
506
|
+
* suffix decouples TAP_INSTANCE_ID from the slot regex in the bridge runner.
|
|
507
|
+
*/
|
|
508
|
+
routingSlot?: string;
|
|
399
509
|
}
|
|
400
510
|
|
|
401
511
|
interface RestartBridgeOptions extends BridgeStartOptions {
|
|
402
512
|
/** Max seconds to wait for active turn to complete before killing. Default: 30 */
|
|
403
513
|
drainTimeoutSeconds?: number;
|
|
514
|
+
/** Continue restart after drain timeout instead of aborting. */
|
|
515
|
+
force?: boolean;
|
|
516
|
+
/** Optional observer for user-facing drain wait logs. */
|
|
517
|
+
onDrainWait?: (state: BridgeDrainWaitState) => void;
|
|
518
|
+
}
|
|
519
|
+
interface BridgeDrainWaitState {
|
|
520
|
+
activeTurnId: string | null;
|
|
521
|
+
turnState: RuntimeBridgeHeartbeat["turnState"] | null;
|
|
522
|
+
waitedMs: number;
|
|
523
|
+
}
|
|
524
|
+
interface RestartBridgeResult {
|
|
525
|
+
bridge: BridgeState;
|
|
526
|
+
drained: boolean;
|
|
527
|
+
forced: boolean;
|
|
404
528
|
}
|
|
405
529
|
/**
|
|
406
530
|
* Graceful bridge restart: wait for active turn -> cleanup -> stop -> start.
|
|
407
531
|
* Prevents message loss during restart by draining active work first
|
|
408
532
|
* and replaying unprocessed messages on the new instance.
|
|
409
533
|
*/
|
|
410
|
-
declare function restartBridge(options: RestartBridgeOptions): Promise<
|
|
534
|
+
declare function restartBridge(options: RestartBridgeOptions): Promise<RestartBridgeResult>;
|
|
411
535
|
|
|
412
536
|
/**
|
|
413
537
|
* Dashboard data collection engine.
|
|
@@ -426,6 +550,15 @@ interface AgentInfo {
|
|
|
426
550
|
lastActivity: string | null;
|
|
427
551
|
joinedAt: string | null;
|
|
428
552
|
idleSeconds: number | null;
|
|
553
|
+
address: {
|
|
554
|
+
hostId: string | null;
|
|
555
|
+
clientId: string | null;
|
|
556
|
+
conversationId: string | null;
|
|
557
|
+
ownerClientId: string | null;
|
|
558
|
+
routingAddress: string;
|
|
559
|
+
slot: "tower" | "reviewer" | `wt-${number}` | null;
|
|
560
|
+
aliases: string[];
|
|
561
|
+
};
|
|
429
562
|
}
|
|
430
563
|
interface BridgeInfo {
|
|
431
564
|
instanceId: string;
|
|
@@ -460,6 +593,628 @@ interface DashboardSnapshot {
|
|
|
460
593
|
}
|
|
461
594
|
declare function collectDashboardSnapshot(repoRoot?: string, commsDirOverride?: string): DashboardSnapshot;
|
|
462
595
|
|
|
596
|
+
declare const TRUSTED_DEVICE_LEASES_DIRNAME = "devices";
|
|
597
|
+
type TrustedDeviceLeaseFailureReason = "registry-unavailable" | "missing" | "invalid" | "not-yet-valid" | "expired" | "revoked" | "scope-not-allowed" | "target-not-allowed";
|
|
598
|
+
interface TrustedDeviceLease {
|
|
599
|
+
deviceId: string;
|
|
600
|
+
hostId: string;
|
|
601
|
+
label: string | null;
|
|
602
|
+
publicKeyHash: string | null;
|
|
603
|
+
tokenHash: string | null;
|
|
604
|
+
operator: string | null;
|
|
605
|
+
allowedScopes: CapabilityScope[];
|
|
606
|
+
allowedTargets: string[];
|
|
607
|
+
issuedAt: string;
|
|
608
|
+
expiresAt: string;
|
|
609
|
+
lastSeenAt: string | null;
|
|
610
|
+
revokedAt: string | null;
|
|
611
|
+
}
|
|
612
|
+
interface TrustedDeviceLeaseCheck {
|
|
613
|
+
ok: boolean;
|
|
614
|
+
reason: TrustedDeviceLeaseFailureReason | null;
|
|
615
|
+
message: string | null;
|
|
616
|
+
lease: TrustedDeviceLease | null;
|
|
617
|
+
filePath: string | null;
|
|
618
|
+
}
|
|
619
|
+
interface TrustedDeviceLeaseGateResult {
|
|
620
|
+
ok: boolean;
|
|
621
|
+
reason: TrustedDeviceLeaseFailureReason | null;
|
|
622
|
+
message: string | null;
|
|
623
|
+
requester: TrustedDeviceLeaseCheck | null;
|
|
624
|
+
target: TrustedDeviceLeaseCheck | null;
|
|
625
|
+
}
|
|
626
|
+
interface CheckTrustedDeviceLeaseOptions {
|
|
627
|
+
commsDir?: string | null;
|
|
628
|
+
devicesDir?: string | null;
|
|
629
|
+
deviceId?: string | null;
|
|
630
|
+
hostId?: string | null;
|
|
631
|
+
scope?: CapabilityScope;
|
|
632
|
+
target?: string | null;
|
|
633
|
+
now?: Date | string | number;
|
|
634
|
+
}
|
|
635
|
+
interface CheckTrustedDeviceLeaseGateOptions {
|
|
636
|
+
commsDir?: string | null;
|
|
637
|
+
devicesDir?: string | null;
|
|
638
|
+
requesterDeviceId?: string | null;
|
|
639
|
+
requesterHostId?: string | null;
|
|
640
|
+
targetDeviceId?: string | null;
|
|
641
|
+
targetHostId?: string | null;
|
|
642
|
+
scope?: CapabilityScope;
|
|
643
|
+
target?: string | null;
|
|
644
|
+
now?: Date | string | number;
|
|
645
|
+
}
|
|
646
|
+
declare function resolveTrustedDeviceLeasesDir(options: {
|
|
647
|
+
commsDir?: string | null;
|
|
648
|
+
devicesDir?: string | null;
|
|
649
|
+
}): string | null;
|
|
650
|
+
declare function parseTrustedDeviceLease(value: unknown): TrustedDeviceLease | null;
|
|
651
|
+
declare function loadTrustedDeviceLease(filePath: string): TrustedDeviceLease | null;
|
|
652
|
+
declare function checkTrustedDeviceLease(options: CheckTrustedDeviceLeaseOptions): TrustedDeviceLeaseCheck;
|
|
653
|
+
declare function checkTrustedDeviceLeaseGate(options: CheckTrustedDeviceLeaseGateOptions): TrustedDeviceLeaseGateResult;
|
|
654
|
+
|
|
655
|
+
interface FileObserveTransportOptions {
|
|
656
|
+
commsDir: string;
|
|
657
|
+
hostId?: string | null;
|
|
658
|
+
watchIntervalMs?: number;
|
|
659
|
+
}
|
|
660
|
+
declare class FileObserveTransport implements ObserveTransport {
|
|
661
|
+
readonly kind = "file-observe";
|
|
662
|
+
private readonly heartbeatsPath;
|
|
663
|
+
private readonly hostId;
|
|
664
|
+
private readonly watchIntervalMs;
|
|
665
|
+
private readonly listeners;
|
|
666
|
+
private watching;
|
|
667
|
+
private snapshot;
|
|
668
|
+
constructor(options: FileObserveTransportOptions);
|
|
669
|
+
connect(): Promise<ObserveTransportSnapshot>;
|
|
670
|
+
disconnect(): Promise<void>;
|
|
671
|
+
getSnapshot(): ObserveTransportSnapshot;
|
|
672
|
+
subscribe(listener: ObserveTransportListener): () => void;
|
|
673
|
+
private readonly handleHeartbeatsChanged;
|
|
674
|
+
private buildSnapshot;
|
|
675
|
+
private startWatching;
|
|
676
|
+
private stopWatching;
|
|
677
|
+
private loadHeartbeats;
|
|
678
|
+
private emit;
|
|
679
|
+
}
|
|
680
|
+
declare function createFileObserveTransport(options: FileObserveTransportOptions): ObserveTransport;
|
|
681
|
+
|
|
682
|
+
interface TapReturnAddress {
|
|
683
|
+
routingAddress?: string | null;
|
|
684
|
+
hostId?: string | null;
|
|
685
|
+
clientId?: string | null;
|
|
686
|
+
conversationId?: string | null;
|
|
687
|
+
ownerClientId?: string | null;
|
|
688
|
+
surfaceInstanceId?: string | null;
|
|
689
|
+
aliases?: string[];
|
|
690
|
+
}
|
|
691
|
+
interface TapMessagePromptOptions {
|
|
692
|
+
agentName: string;
|
|
693
|
+
sender: string;
|
|
694
|
+
recipient: string;
|
|
695
|
+
subject: string;
|
|
696
|
+
fileName: string;
|
|
697
|
+
body: string;
|
|
698
|
+
replyTo: string;
|
|
699
|
+
returnAddress?: TapReturnAddress | null;
|
|
700
|
+
runtimeSurface?: string | null;
|
|
701
|
+
debugEnvelope?: boolean;
|
|
702
|
+
}
|
|
703
|
+
interface TapMessageViewModel {
|
|
704
|
+
agentName: string;
|
|
705
|
+
sender: string;
|
|
706
|
+
recipient: string;
|
|
707
|
+
subject: string;
|
|
708
|
+
body: string;
|
|
709
|
+
replyTarget: string | null;
|
|
710
|
+
returnRoute: string | null;
|
|
711
|
+
missingRoute: boolean;
|
|
712
|
+
debugEnvelope: {
|
|
713
|
+
fileName: string;
|
|
714
|
+
returnAddress: TapReturnAddress | null;
|
|
715
|
+
runtimeSurface: string | null;
|
|
716
|
+
};
|
|
717
|
+
}
|
|
718
|
+
interface RenderTapMessagePromptOptions {
|
|
719
|
+
debugEnvelope?: boolean;
|
|
720
|
+
}
|
|
721
|
+
declare function createTapMessageViewModel(options: TapMessagePromptOptions): TapMessageViewModel;
|
|
722
|
+
declare function renderAgentMessagePrompt(viewModel: TapMessageViewModel, options?: RenderTapMessagePromptOptions): string;
|
|
723
|
+
declare function buildTapMessagePrompt(options: TapMessagePromptOptions): string;
|
|
724
|
+
|
|
725
|
+
type PollingReceiverMode = "check" | "apply" | "watch";
|
|
726
|
+
type PollingReceiverSource = "inbox";
|
|
727
|
+
interface PollingReceiverItem {
|
|
728
|
+
source: PollingReceiverSource;
|
|
729
|
+
filename: string;
|
|
730
|
+
path: string;
|
|
731
|
+
from: string;
|
|
732
|
+
fromName?: string | null;
|
|
733
|
+
fromAddress?: TapReturnAddress | null;
|
|
734
|
+
to: string;
|
|
735
|
+
toName?: string | null;
|
|
736
|
+
toAddress?: TapReturnAddress | null;
|
|
737
|
+
subject: string;
|
|
738
|
+
mtime: string;
|
|
739
|
+
dedupeKey: string;
|
|
740
|
+
messageId: string | null;
|
|
741
|
+
content?: string;
|
|
742
|
+
}
|
|
743
|
+
interface PollingReceiverStateEntry {
|
|
744
|
+
filename: string;
|
|
745
|
+
messageId: string | null;
|
|
746
|
+
mtime: string;
|
|
747
|
+
processedAt: string;
|
|
748
|
+
}
|
|
749
|
+
interface PollingReceiverState {
|
|
750
|
+
schemaVersion: 1;
|
|
751
|
+
agent: string;
|
|
752
|
+
aliases: string[];
|
|
753
|
+
createdAt: string;
|
|
754
|
+
joinedAt: string;
|
|
755
|
+
processed: Record<string, PollingReceiverStateEntry>;
|
|
756
|
+
}
|
|
757
|
+
interface RunPollingReceiverOptions {
|
|
758
|
+
mode: PollingReceiverMode;
|
|
759
|
+
commsDir: string;
|
|
760
|
+
stateDir: string;
|
|
761
|
+
agent: string;
|
|
762
|
+
aliases?: string[];
|
|
763
|
+
includeContent?: boolean;
|
|
764
|
+
includeOwn?: boolean;
|
|
765
|
+
limit?: number;
|
|
766
|
+
since?: string;
|
|
767
|
+
sinceMinutes?: number;
|
|
768
|
+
all?: boolean;
|
|
769
|
+
resetCursor?: boolean;
|
|
770
|
+
stateName?: string;
|
|
771
|
+
intervalMs?: number;
|
|
772
|
+
maxIterations?: number;
|
|
773
|
+
now?: Date;
|
|
774
|
+
excludeDedupeKeys?: Iterable<string>;
|
|
775
|
+
debugEnvelope?: boolean;
|
|
776
|
+
}
|
|
777
|
+
interface RunPollingReceiverResult {
|
|
778
|
+
mode: PollingReceiverMode;
|
|
779
|
+
agent: string;
|
|
780
|
+
aliases: string[];
|
|
781
|
+
commsDir: string;
|
|
782
|
+
statePath: string;
|
|
783
|
+
receiveTransport: "polling";
|
|
784
|
+
adapter: "file-polling";
|
|
785
|
+
status: "idle" | "pending";
|
|
786
|
+
items: PollingReceiverItem[];
|
|
787
|
+
promptBundle: string;
|
|
788
|
+
scanned: number;
|
|
789
|
+
skipped: {
|
|
790
|
+
old: number;
|
|
791
|
+
duplicate: number;
|
|
792
|
+
notForAgent: number;
|
|
793
|
+
own: number;
|
|
794
|
+
staleMeta: number;
|
|
795
|
+
};
|
|
796
|
+
stateWritten: boolean;
|
|
797
|
+
effectiveSince: string | null;
|
|
798
|
+
warnings: string[];
|
|
799
|
+
}
|
|
800
|
+
interface MarkPollingReceiverItemsProcessedOptions {
|
|
801
|
+
stateDir: string;
|
|
802
|
+
agent: string;
|
|
803
|
+
aliases?: string[];
|
|
804
|
+
stateName?: string;
|
|
805
|
+
items: PollingReceiverItem[];
|
|
806
|
+
now?: Date;
|
|
807
|
+
}
|
|
808
|
+
declare function resolvePollingReceiverStatePath(options: {
|
|
809
|
+
stateDir: string;
|
|
810
|
+
agent: string;
|
|
811
|
+
stateName?: string;
|
|
812
|
+
}): string;
|
|
813
|
+
declare function markPollingReceiverItemsProcessed(rawOptions: MarkPollingReceiverItemsProcessedOptions): {
|
|
814
|
+
statePath: string;
|
|
815
|
+
stateWritten: boolean;
|
|
816
|
+
processedAt: string;
|
|
817
|
+
};
|
|
818
|
+
declare function buildPromptBundle(agent: string, items: PollingReceiverItem[], options?: {
|
|
819
|
+
debugEnvelope?: boolean;
|
|
820
|
+
}): string;
|
|
821
|
+
declare function runPollingReceiver(rawOptions: RunPollingReceiverOptions): Promise<RunPollingReceiverResult>;
|
|
822
|
+
|
|
823
|
+
interface ProjectedEnvelopeBackfillInput {
|
|
824
|
+
commsDir: string;
|
|
825
|
+
sender: string;
|
|
826
|
+
recipient: string;
|
|
827
|
+
subject: string;
|
|
828
|
+
body?: string | null;
|
|
829
|
+
sourceSurface: string;
|
|
830
|
+
receivedAt?: Date | string | null;
|
|
831
|
+
messageId?: string | null;
|
|
832
|
+
projectionId?: string | null;
|
|
833
|
+
routeTurnId?: string | null;
|
|
834
|
+
}
|
|
835
|
+
interface ProjectedEnvelopeBackfillResult {
|
|
836
|
+
status: "written" | "exists";
|
|
837
|
+
inboxPath: string;
|
|
838
|
+
filePath: string;
|
|
839
|
+
dedupeKey: string;
|
|
840
|
+
messageId: string;
|
|
841
|
+
}
|
|
842
|
+
declare function writeProjectedEnvelopeBackfill(input: ProjectedEnvelopeBackfillInput): ProjectedEnvelopeBackfillResult;
|
|
843
|
+
|
|
844
|
+
type CodexEndpointProfileRole = "public" | "direct-local" | "upstream" | "remote-tui";
|
|
845
|
+
type CodexEndpointProfileMode = "auth-gateway" | "direct-no-auth-localhost-only" | "upstream-internal" | "ssh-forwarded-client";
|
|
846
|
+
type CodexEndpointProfileStability = "target" | "compatibility" | "custom";
|
|
847
|
+
interface CodexEndpointProfile {
|
|
848
|
+
id: string;
|
|
849
|
+
role: CodexEndpointProfileRole;
|
|
850
|
+
defaultUrl: string;
|
|
851
|
+
mode: CodexEndpointProfileMode;
|
|
852
|
+
operatorVisible: boolean;
|
|
853
|
+
stability: CodexEndpointProfileStability;
|
|
854
|
+
namespace: string;
|
|
855
|
+
description: string;
|
|
856
|
+
}
|
|
857
|
+
interface ParsedCodexEndpointUrl {
|
|
858
|
+
raw: string;
|
|
859
|
+
protocol: "ws:" | "wss:";
|
|
860
|
+
hostname: string;
|
|
861
|
+
port: number;
|
|
862
|
+
loopback: boolean;
|
|
863
|
+
}
|
|
864
|
+
interface CodexEndpointClassification {
|
|
865
|
+
profile: CodexEndpointProfile | null;
|
|
866
|
+
endpoint: ParsedCodexEndpointUrl | null;
|
|
867
|
+
reason: string;
|
|
868
|
+
}
|
|
869
|
+
interface ResolveCodexEndpointProfileOptions {
|
|
870
|
+
profileId?: string;
|
|
871
|
+
requestedUrl?: string | null;
|
|
872
|
+
config?: Record<string, unknown>;
|
|
873
|
+
env?: Record<string, string | undefined>;
|
|
874
|
+
}
|
|
875
|
+
type ResolvedCodexEndpointProfile = CodexEndpointProfile & {
|
|
876
|
+
profileId: string;
|
|
877
|
+
requestedProfileId: string;
|
|
878
|
+
resolvedUrl: string | null;
|
|
879
|
+
source: "explicit" | "env" | "config" | "default" | "missing";
|
|
880
|
+
valid: boolean;
|
|
881
|
+
classification: string;
|
|
882
|
+
classifiedProfileId?: string | null;
|
|
883
|
+
};
|
|
884
|
+
declare const CODEX_ENDPOINT_PROFILE_ALIASES: Record<string, string>;
|
|
885
|
+
declare const CODEX_APP_SERVER_ENDPOINT_PROFILES: CodexEndpointProfile[];
|
|
886
|
+
declare function normalizeCodexEndpointProfileId(profileId: string | null | undefined): string | null;
|
|
887
|
+
declare function listCodexEndpointProfiles(): CodexEndpointProfile[];
|
|
888
|
+
declare function getCodexEndpointProfile(profileId: string | null | undefined): CodexEndpointProfile | null;
|
|
889
|
+
declare function parseCodexEndpointUrl(url: string | null | undefined): ParsedCodexEndpointUrl | null;
|
|
890
|
+
declare function classifyCodexEndpointUrl(url: string | null | undefined): CodexEndpointClassification;
|
|
891
|
+
declare function resolveCodexEndpointProfile(options?: ResolveCodexEndpointProfileOptions): ResolvedCodexEndpointProfile;
|
|
892
|
+
|
|
893
|
+
interface CodexAppServerPromotionRequest {
|
|
894
|
+
appServerUrl: string;
|
|
895
|
+
cwd: string;
|
|
896
|
+
threadId?: string | null;
|
|
897
|
+
text: string;
|
|
898
|
+
}
|
|
899
|
+
interface CodexAppServerPromotionDelivery {
|
|
900
|
+
delivered: boolean;
|
|
901
|
+
turnId: string | null;
|
|
902
|
+
threadId: string | null;
|
|
903
|
+
runtimeHealth: "idle" | "active-turn" | "stuck-turn" | "unhealthy" | "adapter-unavailable";
|
|
904
|
+
blockedReason: string | null;
|
|
905
|
+
}
|
|
906
|
+
interface CodexAppServerPromoter {
|
|
907
|
+
promote(request: CodexAppServerPromotionRequest): Promise<CodexAppServerPromotionDelivery>;
|
|
908
|
+
}
|
|
909
|
+
interface RunCodexCliAppServerPromotionOptions extends Omit<RunPollingReceiverOptions, "mode" | "limit"> {
|
|
910
|
+
limit?: number;
|
|
911
|
+
appServerUrl?: string | null;
|
|
912
|
+
endpointProfile?: string;
|
|
913
|
+
endpointConfig?: Record<string, unknown>;
|
|
914
|
+
cwd?: string;
|
|
915
|
+
threadId?: string | null;
|
|
916
|
+
dryRun?: boolean;
|
|
917
|
+
promoter?: CodexAppServerPromoter;
|
|
918
|
+
}
|
|
919
|
+
interface CodexCliAppServerPromotionResult {
|
|
920
|
+
mode: "promote";
|
|
921
|
+
agent: string;
|
|
922
|
+
aliases: string[];
|
|
923
|
+
commsDir: string;
|
|
924
|
+
statePath: string;
|
|
925
|
+
receiveTransport: "polling";
|
|
926
|
+
adapter: "app-server-promotion";
|
|
927
|
+
runtimeSurface: "codex-cli-app-server";
|
|
928
|
+
endpointProfile: ResolvedCodexEndpointProfile;
|
|
929
|
+
appServerUrl: string | null;
|
|
930
|
+
cwd: string;
|
|
931
|
+
threadId: string | null;
|
|
932
|
+
status: "idle" | "dry-run" | "delivered" | "blocked";
|
|
933
|
+
delivered: boolean;
|
|
934
|
+
queued: boolean;
|
|
935
|
+
queueReason: string | null;
|
|
936
|
+
steerAttempted: boolean;
|
|
937
|
+
turnId: string | null;
|
|
938
|
+
blockedReason: string | null;
|
|
939
|
+
runtimeHealth: CodexAppServerPromotionDelivery["runtimeHealth"] | null;
|
|
940
|
+
item: PollingReceiverItem | null;
|
|
941
|
+
promptText: string | null;
|
|
942
|
+
scanned: number;
|
|
943
|
+
skipped: {
|
|
944
|
+
old: number;
|
|
945
|
+
duplicate: number;
|
|
946
|
+
notForAgent: number;
|
|
947
|
+
own: number;
|
|
948
|
+
};
|
|
949
|
+
stateWritten: boolean;
|
|
950
|
+
effectiveSince: string | null;
|
|
951
|
+
warnings: string[];
|
|
952
|
+
}
|
|
953
|
+
declare class WebSocketCodexAppServerPromoter implements CodexAppServerPromoter {
|
|
954
|
+
private socket;
|
|
955
|
+
private nextId;
|
|
956
|
+
private readonly pending;
|
|
957
|
+
promote(request: CodexAppServerPromotionRequest): Promise<CodexAppServerPromotionDelivery>;
|
|
958
|
+
private connect;
|
|
959
|
+
private disconnect;
|
|
960
|
+
private attachThread;
|
|
961
|
+
private startTurn;
|
|
962
|
+
private request;
|
|
963
|
+
private handleMessage;
|
|
964
|
+
private rejectPending;
|
|
965
|
+
}
|
|
966
|
+
declare function runCodexCliAppServerPromotion(options: RunCodexCliAppServerPromotionOptions): Promise<CodexCliAppServerPromotionResult>;
|
|
967
|
+
|
|
968
|
+
type SupervisedReceiverPromotionMode = "once" | "watch";
|
|
969
|
+
interface RunSupervisedReceiverPromotionOptions extends Omit<RunCodexCliAppServerPromotionOptions, "limit"> {
|
|
970
|
+
mode: SupervisedReceiverPromotionMode;
|
|
971
|
+
maxPromotionsPerIteration?: number;
|
|
972
|
+
intervalMs?: number;
|
|
973
|
+
maxIterations?: number;
|
|
974
|
+
promoter?: CodexAppServerPromoter;
|
|
975
|
+
}
|
|
976
|
+
interface SupervisedReceiverPromotionResult {
|
|
977
|
+
mode: SupervisedReceiverPromotionMode;
|
|
978
|
+
agent: string;
|
|
979
|
+
aliases: string[];
|
|
980
|
+
commsDir: string;
|
|
981
|
+
statePath: string | null;
|
|
982
|
+
receiveTransport: "polling";
|
|
983
|
+
adapter: "supervised-app-server-promotion";
|
|
984
|
+
runtimeSurface: "codex-cli-app-server";
|
|
985
|
+
status: "idle" | "delivered" | "blocked" | "dry-run";
|
|
986
|
+
delivered: number;
|
|
987
|
+
blocked: number;
|
|
988
|
+
queued: number;
|
|
989
|
+
dryRun: boolean;
|
|
990
|
+
iterations: number;
|
|
991
|
+
attempts: CodexCliAppServerPromotionResult[];
|
|
992
|
+
lastBlockedReason: string | null;
|
|
993
|
+
lastQueueReason: string | null;
|
|
994
|
+
warnings: string[];
|
|
995
|
+
}
|
|
996
|
+
declare function runSupervisedReceiverPromotion(options: RunSupervisedReceiverPromotionOptions): Promise<SupervisedReceiverPromotionResult>;
|
|
997
|
+
|
|
998
|
+
type ProjectionMode = "check" | "apply" | "watch";
|
|
999
|
+
type ProjectionDir = "inbox" | "reviews" | "findings" | "receipts" | "decisions";
|
|
1000
|
+
interface ProjectionItem {
|
|
1001
|
+
dir: ProjectionDir;
|
|
1002
|
+
filename: string;
|
|
1003
|
+
sourcePath: string;
|
|
1004
|
+
targetPath: string;
|
|
1005
|
+
relativePath: string;
|
|
1006
|
+
mtime: string;
|
|
1007
|
+
dedupeKey: string;
|
|
1008
|
+
messageId: string | null;
|
|
1009
|
+
from: string | null;
|
|
1010
|
+
to: string | null;
|
|
1011
|
+
subject: string | null;
|
|
1012
|
+
projected: boolean;
|
|
1013
|
+
skipReason: null | "target-exists" | "dry-run";
|
|
1014
|
+
}
|
|
1015
|
+
interface ProjectionStateEntry {
|
|
1016
|
+
relativePath: string;
|
|
1017
|
+
messageId: string | null;
|
|
1018
|
+
mtime: string;
|
|
1019
|
+
projectedAt: string;
|
|
1020
|
+
}
|
|
1021
|
+
interface ProjectionState {
|
|
1022
|
+
schemaVersion: 1;
|
|
1023
|
+
agent: string;
|
|
1024
|
+
aliases: string[];
|
|
1025
|
+
sourceCommsDir: string;
|
|
1026
|
+
targetCommsDir: string;
|
|
1027
|
+
createdAt: string;
|
|
1028
|
+
joinedAt: string;
|
|
1029
|
+
projected: Record<string, ProjectionStateEntry>;
|
|
1030
|
+
}
|
|
1031
|
+
interface RunLocalProjectionOptions {
|
|
1032
|
+
mode: ProjectionMode;
|
|
1033
|
+
sourceCommsDir: string;
|
|
1034
|
+
targetCommsDir: string;
|
|
1035
|
+
targetCommsDirLabel?: string;
|
|
1036
|
+
stateDir: string;
|
|
1037
|
+
agent: string;
|
|
1038
|
+
aliases?: string[];
|
|
1039
|
+
dirs?: ProjectionDir[];
|
|
1040
|
+
since?: string;
|
|
1041
|
+
sinceMinutes?: number;
|
|
1042
|
+
all?: boolean;
|
|
1043
|
+
resetCursor?: boolean;
|
|
1044
|
+
stateName?: string;
|
|
1045
|
+
includeOwn?: boolean;
|
|
1046
|
+
includeAllTargets?: boolean;
|
|
1047
|
+
limit?: number;
|
|
1048
|
+
intervalMs?: number;
|
|
1049
|
+
maxIterations?: number;
|
|
1050
|
+
now?: Date;
|
|
1051
|
+
beforeScan?: () => void | Promise<void>;
|
|
1052
|
+
afterApply?: (items: ProjectionItem[]) => void | Promise<void>;
|
|
1053
|
+
}
|
|
1054
|
+
interface RunLocalProjectionResult {
|
|
1055
|
+
mode: ProjectionMode;
|
|
1056
|
+
agent: string;
|
|
1057
|
+
aliases: string[];
|
|
1058
|
+
sourceCommsDir: string;
|
|
1059
|
+
targetCommsDir: string;
|
|
1060
|
+
statePath: string;
|
|
1061
|
+
adapter: "local-projection";
|
|
1062
|
+
receiveTransport: "polling";
|
|
1063
|
+
status: "idle" | "pending" | "projected";
|
|
1064
|
+
dirs: ProjectionDir[];
|
|
1065
|
+
items: ProjectionItem[];
|
|
1066
|
+
scanned: number;
|
|
1067
|
+
skipped: {
|
|
1068
|
+
old: number;
|
|
1069
|
+
duplicate: number;
|
|
1070
|
+
notForAgent: number;
|
|
1071
|
+
own: number;
|
|
1072
|
+
disallowed: number;
|
|
1073
|
+
};
|
|
1074
|
+
stateWritten: boolean;
|
|
1075
|
+
effectiveSince: string | null;
|
|
1076
|
+
warnings: string[];
|
|
1077
|
+
}
|
|
1078
|
+
declare function resolveLocalProjectionStatePath(options: {
|
|
1079
|
+
stateDir: string;
|
|
1080
|
+
agent: string;
|
|
1081
|
+
stateName?: string;
|
|
1082
|
+
}): string;
|
|
1083
|
+
declare function runLocalProjection(rawOptions: RunLocalProjectionOptions): Promise<RunLocalProjectionResult>;
|
|
1084
|
+
|
|
1085
|
+
type UplinkMode = "check" | "apply" | "watch";
|
|
1086
|
+
type UplinkDir = "inbox" | "reviews" | "findings" | "receipts" | "decisions";
|
|
1087
|
+
interface UplinkItem {
|
|
1088
|
+
dir: UplinkDir;
|
|
1089
|
+
filename: string;
|
|
1090
|
+
sourcePath: string;
|
|
1091
|
+
targetPath: string;
|
|
1092
|
+
relativePath: string;
|
|
1093
|
+
mtime: string;
|
|
1094
|
+
dedupeKey: string;
|
|
1095
|
+
messageId: string | null;
|
|
1096
|
+
from: string | null;
|
|
1097
|
+
fromName: string | null;
|
|
1098
|
+
to: string | null;
|
|
1099
|
+
subject: string | null;
|
|
1100
|
+
uploaded: boolean;
|
|
1101
|
+
skipReason: null | "dry-run" | "target-exists" | "collision";
|
|
1102
|
+
}
|
|
1103
|
+
interface UplinkStateEntry {
|
|
1104
|
+
relativePath: string;
|
|
1105
|
+
messageId: string | null;
|
|
1106
|
+
mtime: string;
|
|
1107
|
+
uploadedAt: string;
|
|
1108
|
+
}
|
|
1109
|
+
interface UplinkState {
|
|
1110
|
+
schemaVersion: 1;
|
|
1111
|
+
agent: string;
|
|
1112
|
+
aliases: string[];
|
|
1113
|
+
sourceCommsDir: string;
|
|
1114
|
+
targetCommsDir: string;
|
|
1115
|
+
createdAt: string;
|
|
1116
|
+
joinedAt: string;
|
|
1117
|
+
uploaded: Record<string, UplinkStateEntry>;
|
|
1118
|
+
}
|
|
1119
|
+
interface RunLocalUplinkOptions {
|
|
1120
|
+
mode: UplinkMode;
|
|
1121
|
+
sourceCommsDir: string;
|
|
1122
|
+
targetCommsDir: string;
|
|
1123
|
+
sourceCommsDirLabel?: string;
|
|
1124
|
+
stateDir: string;
|
|
1125
|
+
agent: string;
|
|
1126
|
+
aliases?: string[];
|
|
1127
|
+
dirs?: UplinkDir[];
|
|
1128
|
+
since?: string;
|
|
1129
|
+
sinceMinutes?: number;
|
|
1130
|
+
all?: boolean;
|
|
1131
|
+
resetCursor?: boolean;
|
|
1132
|
+
stateName?: string;
|
|
1133
|
+
includeAllSources?: boolean;
|
|
1134
|
+
limit?: number;
|
|
1135
|
+
intervalMs?: number;
|
|
1136
|
+
maxIterations?: number;
|
|
1137
|
+
now?: Date;
|
|
1138
|
+
beforeScan?: () => void | Promise<void>;
|
|
1139
|
+
}
|
|
1140
|
+
interface RunLocalUplinkResult {
|
|
1141
|
+
mode: UplinkMode;
|
|
1142
|
+
agent: string;
|
|
1143
|
+
aliases: string[];
|
|
1144
|
+
sourceCommsDir: string;
|
|
1145
|
+
targetCommsDir: string;
|
|
1146
|
+
statePath: string;
|
|
1147
|
+
adapter: "local-uplink";
|
|
1148
|
+
receiveTransport: "polling";
|
|
1149
|
+
status: "idle" | "pending" | "uploaded" | "blocked";
|
|
1150
|
+
dirs: UplinkDir[];
|
|
1151
|
+
items: UplinkItem[];
|
|
1152
|
+
scanned: number;
|
|
1153
|
+
skipped: {
|
|
1154
|
+
old: number;
|
|
1155
|
+
duplicate: number;
|
|
1156
|
+
notFromAgent: number;
|
|
1157
|
+
disallowed: number;
|
|
1158
|
+
};
|
|
1159
|
+
stateWritten: boolean;
|
|
1160
|
+
effectiveSince: string | null;
|
|
1161
|
+
warnings: string[];
|
|
1162
|
+
}
|
|
1163
|
+
declare function resolveLocalUplinkStatePath(options: {
|
|
1164
|
+
stateDir: string;
|
|
1165
|
+
agent: string;
|
|
1166
|
+
stateName?: string;
|
|
1167
|
+
}): string;
|
|
1168
|
+
declare function runLocalUplink(rawOptions: RunLocalUplinkOptions): Promise<RunLocalUplinkResult>;
|
|
1169
|
+
|
|
1170
|
+
interface RemoteUplinkCommandResult {
|
|
1171
|
+
status: number;
|
|
1172
|
+
stdout: string;
|
|
1173
|
+
stderr: string;
|
|
1174
|
+
}
|
|
1175
|
+
type RemoteUplinkCommandRunner = (command: string, args: string[]) => RemoteUplinkCommandResult;
|
|
1176
|
+
interface RemoteUplinkMirrorRecord {
|
|
1177
|
+
dir: UplinkDir;
|
|
1178
|
+
source: string;
|
|
1179
|
+
target: string;
|
|
1180
|
+
status: number;
|
|
1181
|
+
changed: number;
|
|
1182
|
+
stdout: string;
|
|
1183
|
+
stderr: string;
|
|
1184
|
+
}
|
|
1185
|
+
interface MirrorRemoteUplinkSourceOptions {
|
|
1186
|
+
sshTarget: string;
|
|
1187
|
+
remoteCommsDir: string;
|
|
1188
|
+
localMirrorDir: string;
|
|
1189
|
+
dirs: UplinkDir[];
|
|
1190
|
+
runner?: RemoteUplinkCommandRunner;
|
|
1191
|
+
}
|
|
1192
|
+
declare function mirrorRemoteUplinkSource(options: MirrorRemoteUplinkSourceOptions): RemoteUplinkMirrorRecord[];
|
|
1193
|
+
|
|
1194
|
+
type CodexOwnerDiscoveryResult = {
|
|
1195
|
+
status: "found";
|
|
1196
|
+
conversationId: string;
|
|
1197
|
+
ownerClientId: string;
|
|
1198
|
+
hostId: string | null;
|
|
1199
|
+
source: "snapshot" | "event";
|
|
1200
|
+
} | {
|
|
1201
|
+
status: "not-found";
|
|
1202
|
+
conversationId: string;
|
|
1203
|
+
message: string;
|
|
1204
|
+
} | {
|
|
1205
|
+
status: "unavailable";
|
|
1206
|
+
conversationId: string;
|
|
1207
|
+
message: string;
|
|
1208
|
+
};
|
|
1209
|
+
interface DiscoverCodexOwnerClientIdOptions {
|
|
1210
|
+
conversationId: string;
|
|
1211
|
+
hostId?: string | null;
|
|
1212
|
+
timeoutMs?: number;
|
|
1213
|
+
transport?: ObserveTransport;
|
|
1214
|
+
transportFactory?: (options: CodexIpcObserveTransportOptions) => ObserveTransport;
|
|
1215
|
+
}
|
|
1216
|
+
declare function discoverCodexOwnerClientId(options: DiscoverCodexOwnerClientIdOptions): Promise<CodexOwnerDiscoveryResult>;
|
|
1217
|
+
|
|
463
1218
|
/**
|
|
464
1219
|
* State/Control API — programmatic access to tap state.
|
|
465
1220
|
* GUI and autopilot consume these functions instead of shelling out to CLI.
|
|
@@ -609,4 +1364,4 @@ declare function resolveNodeRuntime(configCommand: string, repoRoot: string): Re
|
|
|
609
1364
|
*/
|
|
610
1365
|
declare function buildRuntimeEnv(repoRoot: string, baseEnv?: NodeJS.ProcessEnv): NodeJS.ProcessEnv;
|
|
611
1366
|
|
|
612
|
-
export { type AdapterContext, type AgentControlOptions, type AgentControlResult, type AgentInfo, type AppServerAuthState, type AppServerState, type ApplyResult, type ArtifactKind, type BridgeInfo, type BridgeMode, type BridgeState, type CommandCode, type CommandName, type CommandResult, type ConfigOverrides, type ConfigResolution, type ConfigSource, type DashboardSnapshot, type DashboardWarning, type EventStreamOptions, type GeminiIdeCompanionServer, type GeminiIdeCompanionServerOptions, type GeminiIdeContext, type GeminiIdeCursor, type GeminiIdeFile, type GeminiIdeInfo, type HealthReport, type HttpServerOptions, type InstanceId, type InstanceState, LOCAL_CONFIG_FILE, type OwnedArtifact, type PRInfo, type PatchOp, type PatchOpType, type PatchPlan, type Platform, type ProbeResult, type ResolvedRuntime, type RuntimeAdapter, type RuntimeName, type RuntimeSource, type RuntimeState, SHARED_CONFIG_FILE, type StateApiOptions, type TapLocalConfig, type TapResolvedConfig, type TapSharedConfig, type TapState, type TapStateV1, type VerifyCheck, type VerifyResult, buildRuntimeEnv, collectDashboardSnapshot, createInitialState, getConfig, getDashboardSnapshot, getFnmBinDir, getHealthReport, getHeartbeatAge, loadLocalConfig, loadSharedConfig, loadState, normalizeTapPath, probeFnmNode, readNodeVersion, resolveConfig, resolveNodeRuntime, restartBridge, rotateLog, saveLocalConfig, saveSharedConfig, saveState, startAgents, startGeminiIdeCompanionServer, startHttpServer, stateExists, stopAgents, streamEvents, updateBridgeHeartbeat, version };
|
|
1367
|
+
export { type AdapterContext, type AgentControlOptions, type AgentControlResult, type AgentInfo, type AppServerAuthState, type AppServerState, type ApplyResult, type ArtifactKind, type BridgeInfo, type BridgeMode, type BridgeState, CODEX_APP_SERVER_ENDPOINT_PROFILES, CODEX_ENDPOINT_PROFILE_ALIASES, CapabilityScope, type CheckTrustedDeviceLeaseGateOptions, type CheckTrustedDeviceLeaseOptions, type CodexAppServerPromoter, type CodexAppServerPromotionDelivery, type CodexAppServerPromotionRequest, type CodexCliAppServerPromotionResult, type CodexEndpointClassification, type CodexEndpointProfile, CodexIpcObserveTransportOptions, type CodexOwnerDiscoveryResult, type CommandCode, type CommandName, type CommandResult, type ConfigOverrides, type ConfigResolution, type ConfigSource, type DashboardSnapshot, type DashboardWarning, type DiscoverCodexOwnerClientIdOptions, type EventStreamOptions, FileObserveTransport, type FileObserveTransportOptions, type GeminiIdeCompanionServer, type GeminiIdeCompanionServerOptions, type GeminiIdeContext, type GeminiIdeCursor, type GeminiIdeFile, type GeminiIdeInfo, type HealthReport, type HttpServerOptions, type InstanceId, type InstanceState, LOCAL_CONFIG_FILE, type MarkPollingReceiverItemsProcessedOptions, type MirrorRemoteUplinkSourceOptions, ObserveTransport, ObserveTransportListener, ObserveTransportSnapshot, type OwnedArtifact, type PRInfo, type ParsedCodexEndpointUrl, type PatchOp, type PatchOpType, type PatchPlan, type Platform, type PollingReceiverItem, type PollingReceiverMode, type PollingReceiverState, type ProbeResult, type ProjectedEnvelopeBackfillInput, type ProjectedEnvelopeBackfillResult, type ProjectionDir, type ProjectionItem, type ProjectionMode, type ProjectionState, type ProjectionStateEntry, type RemoteUplinkCommandResult, type RemoteUplinkCommandRunner, type RemoteUplinkMirrorRecord, type RenderTapMessagePromptOptions, type ResolveCodexEndpointProfileOptions, type ResolvedCodexEndpointProfile, type ResolvedRuntime, type RunCodexCliAppServerPromotionOptions, type RunLocalProjectionOptions, type RunLocalProjectionResult, type RunLocalUplinkOptions, type RunLocalUplinkResult, type RunPollingReceiverOptions, type RunPollingReceiverResult, type RunSupervisedReceiverPromotionOptions, type RuntimeAdapter, type RuntimeName, type RuntimeSource, type RuntimeState, SHARED_CONFIG_FILE, type StateApiOptions, type SupervisedReceiverPromotionMode, type SupervisedReceiverPromotionResult, TRUSTED_DEVICE_LEASES_DIRNAME, type TapLocalConfig, type TapMessagePromptOptions, type TapMessageViewModel, type TapResolvedConfig, type TapReturnAddress, type TapSharedConfig, type TapState, type TapStateV1, type TrustedDeviceLease, type TrustedDeviceLeaseCheck, type TrustedDeviceLeaseFailureReason, type TrustedDeviceLeaseGateResult, type UplinkDir, type UplinkItem, type UplinkMode, type UplinkState, type UplinkStateEntry, type VerifyCheck, type VerifyResult, WebSocketCodexAppServerPromoter, buildPromptBundle, buildRuntimeEnv, buildTapMessagePrompt, checkTrustedDeviceLease, checkTrustedDeviceLeaseGate, classifyCodexEndpointUrl, collectDashboardSnapshot, createFileObserveTransport, createInitialState, createTapMessageViewModel, discoverCodexOwnerClientId, getCodexEndpointProfile, getConfig, getDashboardSnapshot, getFnmBinDir, getHealthReport, getHeartbeatAge, listCodexEndpointProfiles, loadLocalConfig, loadSharedConfig, loadState, loadTrustedDeviceLease, markPollingReceiverItemsProcessed, mirrorRemoteUplinkSource, normalizeCodexEndpointProfileId, normalizeTapPath, parseCodexEndpointUrl, parseTrustedDeviceLease, probeFnmNode, readNodeVersion, renderAgentMessagePrompt, resolveCodexEndpointProfile, resolveConfig, resolveLocalProjectionStatePath, resolveLocalUplinkStatePath, resolveNodeRuntime, resolvePollingReceiverStatePath, resolveTrustedDeviceLeasesDir, restartBridge, rotateLog, runCodexCliAppServerPromotion, runLocalProjection, runLocalUplink, runPollingReceiver, runSupervisedReceiverPromotion, saveLocalConfig, saveSharedConfig, saveState, startAgents, startGeminiIdeCompanionServer, startHttpServer, stateExists, stopAgents, streamEvents, updateBridgeHeartbeat, version, writeProjectedEnvelopeBackfill };
|