From f337b2bc539e24a1f7390839826c82c95c4e17de Mon Sep 17 00:00:00 2001 From: QQ Date: Tue, 17 Nov 2026 08:42:32 +0800 Subject: [PATCH] Import packages/client-core/src/remote-gateway.ts --- packages/client-core/src/remote-gateway.ts | 36 ++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/packages/client-core/src/remote-gateway.ts b/packages/client-core/src/remote-gateway.ts index 3c397ad..c19169c 100644 --- a/packages/client-core/src/remote-gateway.ts +++ b/packages/client-core/src/remote-gateway.ts @@ -2,6 +2,7 @@ import { HARNESS_API_TRANSFER_CHUNK_BYTES, MAX_HARNESS_API_TRANSFER_BYTES, MAX_REMOTE_CAPABILITY_ENTRIES, + REMOTE_SESSION_EVENTS_CAPABILITY, parseRemoteWorkspaceTypes, type EventPayload, type HarnessRemoteFrameData, @@ -10,6 +11,10 @@ import { type HarnessApiTransferCommitResult, type HarnessApiTransferReadResult, type RemoteWorkspaceTypeDescription, + type RemoteCompactionStatusParams, + type RemoteCompactionStatusResult, + type RemoteCompactionSubmitParams, + type RemoteCompactionSubmitResult, } from '@dsh-remote/protocol' import type { RemoteClientCore, RemoteRpcOptions } from './index.js' @@ -35,6 +40,7 @@ export interface RemoteHostFeatures { remoteGateway: boolean sessionFormat?: 3 remoteTransfer: boolean + sessionEvents: boolean pluginRoute: boolean capabilities: readonly string[] workspaceTypes?: readonly RemoteWorkspaceTypeDescription[] @@ -95,6 +101,7 @@ export function remoteHostFeatures(clientVersion?: string): RemoteHostFeatures { apiTransfer: true, remoteGateway: false, remoteTransfer: false, + sessionEvents: false, pluginRoute: false, capabilities: ['harness.api.v1'], } @@ -139,6 +146,7 @@ export async function probeRemoteHostFeatures( remoteGateway, ...(sessionFormat === undefined ? {} : { sessionFormat }), remoteTransfer: capabilities.has('harness.remote.transfer.v1'), + sessionEvents: capabilities.has(REMOTE_SESSION_EVENTS_CAPABILITY), pluginRoute: capabilities.has('plugin.route.v1'), capabilities: description.capabilities, ...(workspaceTypes === undefined ? {} : { workspaceTypes }), @@ -159,6 +167,34 @@ export class RemoteTypertGateway { throw remoteFailure(result.error) } + /** + * Register an asynchronous Host compaction. Resolves as soon as the Host + * accepts the operation; the compaction itself keeps running on the Host even + * if this client disconnects. + */ + async submitCompaction( + params: RemoteCompactionSubmitParams, + signal?: AbortSignal, + ): Promise { + return await this.client.rpc('harness.remote.compaction.submit', params, signal) + } + + /** Read the settled or in-flight state of one compaction operation. */ + async compactionStatus( + params: RemoteCompactionStatusParams, + signal?: AbortSignal, + ): Promise { + return await this.client.rpc('harness.remote.compaction.status', params, signal) + } + + /** Ask the Host to cancel; the Host answers only after the command settles. */ + async cancelCompaction( + params: RemoteCompactionStatusParams, + signal?: AbortSignal, + ): Promise { + return await this.client.rpc('harness.remote.compaction.cancel', params, signal) + } + async call( endpoint: string, payload: unknown,