/** * Remote Substrate, Public API * * Barrel export and `createRemoteSubstrate()` factory. * * The remote substrate layer covers identity, handshake, sync, and transport: * - Durable identity stable across reconnects * - Handshake tokens with epoch tracking * - Typed transport messages (control / data / ack / failure) * - Reconnect engine with exponential backoff and replay * - State sync into runtime store domains * - Observability panel data provider */ import { RemoteObservabilityProvider } from './observability.js'; import type { RemoteSubstrateConfig, RemoteSession, RemoteTask, RemoteHealth, DurableIdentity } from './types.js'; import type { SyncStoreCallbacks } from './sync.js'; import type { TransportAdapter } from './reconnect.js'; export type { DurableIdentity, HandshakeToken, ReplayConfig, RemoteSession, RemoteTask, RemoteHealth, RemoteSubstrateConfig, RemoteConnectionHealth, RemoteRunnerContract, RemoteRunnerCapabilityCeiling, RemoteExecutionArtifact, RemoteRunnerEvidenceSummary, TransportMessage, ControlMessage, DataMessage, AckMessage, FailureMessage, TransportMessageBase, TransportMessageClass, TransportErrorCategory, RetryPolicy, AuthProvider, } from './types.js'; export type { IdentitySnapshot, } from './identity.js'; export type { ConnectOutcome, TransportAdapter, ReconnectEngineCallbacks, } from './reconnect.js'; export type { SyncStoreCallbacks, } from './sync.js'; export type { RemoteConnectionSnapshot, RemoteTaskSnapshot, RemoteObservabilitySnapshot, } from './observability.js'; export { CONTROL_RETRY_POLICY, DATA_RETRY_POLICY, ACK_RETRY_POLICY, FAILURE_RETRY_POLICY, createControlMessage, createDataMessage, createAckMessage, createFailureMessage, computeRetryDelay, shouldRetry, } from './transport-contract.js'; export type { ControlMessageType, DataMessageType, ControlPayloads, DataPayloads, } from './transport-contract.js'; export { CURRENT_PROTOCOL_VERSION, TRANSPORT_PROTOCOL_SUPPORT_MATRIX, VersionMismatchError, negotiateProtocolVersion, } from './transport-contract.js'; export type { ProtocolVersion, ProtocolSupportMatrix, ProtocolSupportEntry, VersionNegotiationResult, NegotiatedProtocol, DowngradeReason, } from './types.js'; export { DurableIdentityManager } from './identity.js'; export { ReconnectEngine, generateIdempotencyKey } from './reconnect.js'; export { RemoteStateSyncer, createNoOpSyncCallbacks, buildAcpConnectionEntry, countActiveRemoteConnections, extractRemoteTaskIds } from './sync.js'; export { RemoteObservabilityProvider } from './observability.js'; export { deriveRemoteCapabilities, } from './capabilities.js'; export type { RemoteCapabilityId, RemoteCapabilitySnapshot, } from './capabilities.js'; export { deriveRemoteHeartbeat, } from './heartbeat.js'; export type { RemoteHeartbeatSnapshot, } from './heartbeat.js'; export { deriveRemoteNegotiation, } from './negotiation.js'; export type { RemoteNegotiationSnapshot, } from './negotiation.js'; export { deriveRemoteRecoveryActions, } from './recovery.js'; export type { RemoteRecoveryAction, } from './recovery.js'; export { buildRemoteSessionStateSnapshot, } from './session-state.js'; export type { RemoteSessionStateSnapshot, } from './session-state.js'; export { RemoteSupervisor, } from './supervisor.js'; export type { RemoteSupervisorSnapshot, } from './supervisor.js'; export { RemoteRunnerRegistry, exportRemoteArtifactForAgent, importRemoteArtifact, } from './runner-registry.js'; export type { DistributedPeerKind, DistributedPairRequestStatus, DistributedPeerStatus, DistributedWorkPriority, DistributedWorkStatus, DistributedWorkType, DistributedSessionBridge, DistributedApprovalBridge, DistributedAutomationBridge, DistributedRuntimePairRequest, DistributedPeerTokenRecord, DistributedPeerRecord, DistributedPendingWork, DistributedRuntimeAuditRecord, DistributedRuntimeSnapshotStore, DistributedPeerAuth, DistributedNodeHostContract, } from './distributed-runtime.js'; export { DistributedRuntimeManager, getDistributedNodeHostContract, } from './distributed-runtime.js'; /** * RemoteSubstrate, high-level facade wiring together all remote substrate components. * * This class composes DurableIdentityManager, ReconnectEngine, RemoteStateSyncer, * and RemoteObservabilityProvider into a single, lifecycle-managed unit. * * Callers supply a TransportAdapter (the actual I/O layer) and optional * SyncStoreCallbacks (to apply state changes to local store domains). * * @example * ```ts * const substrate = createRemoteSubstrate({ * endpoint: 'wss://remote.example.com/agent', * identity: identityManager.current, * authProvider: { getToken: async () => 'bearer-token' }, * }); * * substrate.attach(wsAdapter, storeCallbacks); * await substrate.connect(); * * // Panel rendering: * const obs = substrate.observability; * obs.subscribe(() => renderRemotePanel(obs.getSnapshot())); * ``` */ export declare class RemoteSubstrate { private readonly config; private adapter; private readonly _identity; private readonly _observability; private _syncer; private _engine; private _session; private _epoch; private _disposed; constructor(config: RemoteSubstrateConfig, adapter?: TransportAdapter | null); /** The observability panel data provider for this substrate. */ get observability(): RemoteObservabilityProvider; /** Current remote session snapshot. */ get session(): RemoteSession; /** Current durable identity. */ get identity(): DurableIdentity; /** * Attach a transport adapter and store callbacks. * * Must be called before `connect()`. Can be called again after reconnection * with a new adapter (e.g. replacing a failed WebSocket with a fresh one). * * @param adapter - The transport I/O adapter. * @param storeCallbacks - Optional store mutation callbacks for state sync. */ attach(adapter: TransportAdapter, storeCallbacks?: SyncStoreCallbacks): void; /** * Establish the initial connection to the remote substrate. * * @returns True if connected successfully, false on terminal failure. */ connect(): Promise; /** * Drive the reconnect loop after a connection failure. * * @returns True if eventually reconnected, false on terminal failure. */ reconnect(): Promise; /** * Acknowledge a received message offset. * * @param offset - The message offset to acknowledge. */ ackOffset(offset: number): void; /** * Apply an incoming remote task update. * * @param task - Remote task snapshot from the transport. */ receiveTaskUpdate(task: RemoteTask): void; /** * Apply an incoming remote health update. * * @param health - Remote health snapshot from the transport. */ receiveHealthUpdate(health: RemoteHealth): void; /** Dispose the substrate, cancelling any pending reconnects. */ dispose(): void; private _buildInitialSession; private _rebuildEngine; private _getAuthToken; } /** * Create a new RemoteSubstrate instance. * * @param config - Remote substrate configuration. * @param adapter - Optional transport adapter (can be attached later via `attach()`). * @returns A new RemoteSubstrate instance. * * @example * ```ts * const substrate = createRemoteSubstrate({ * endpoint: 'wss://remote.example.com/agent', * identity: { * sessionId: crypto.randomUUID(), * taskId: crypto.randomUUID(), * agentId: crypto.randomUUID(), * createdAt: Date.now(), * generation: 1, * }, * }); * * substrate.attach(myTransportAdapter, storeCallbacks); * const connected = await substrate.connect(); * ``` */ export declare function createRemoteSubstrate(config: RemoteSubstrateConfig, adapter?: TransportAdapter): RemoteSubstrate; //# sourceMappingURL=index.d.ts.map