@relayfile/sdk 0.10.37 → 0.10.39

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/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@ export { RelayFileClient, DEFAULT_RELAYFILE_BASE_URL, type AccessTokenProvider,
2
2
  export type { RelayFileReadCacheOptions } from "./types.js";
3
3
  export { RelayfileSetup, RELAYFILE_SDK_VERSION, WorkspaceHandle } from "./setup.js";
4
4
  export { type RelayfileCloudLoginOptions, type RelayfileCloudTokenSet, type RelayfileCloudTokenSetupOptions } from "./cloud-login.js";
5
- export { CloudAbortError, CloudApiError, CloudTimeoutError, InvalidLocalDirError, InvalidMountModeError, InvalidRemotePathError, IntegrationConnectionTimeoutError, MalformedCloudResponseError, MissingConnectionIdError, MountModeUnavailableError, MountReadyTimeoutError, MountSessionInputError, ProviderNotConnectedError, ProviderNotReadyError, RelayfileSetupError, UnknownProviderError } from "./setup-errors.js";
5
+ export { CloudAbortError, CloudApiError, CloudTimeoutError, InvalidLocalDirError, InvalidMountModeError, InvalidRemotePathError, IntegrationConnectionTimeoutError, MalformedCloudResponseError, MissingConnectionIdError, MountModeUnavailableError, MountMultiPathUnsupportedError, MountReadyTimeoutError, MountSessionInputError, ProviderNotConnectedError, ProviderNotReadyError, RelayfileSetupError, UnknownProviderError } from "./setup-errors.js";
6
6
  export { type EnsureMountedWorkspaceInput, WORKSPACE_INTEGRATION_PROVIDERS, type AgentWorkspaceInvite, type AgentWorkspaceInviteOptions, type AgentWorkspaceScopedInviteOptions, type ConnectIntegrationOptions, type ConnectIntegrationResult, type CreateWorkspaceOptions, type JoinWorkspaceOptions, type MountLauncher, type MountLauncherEvent, type MountLauncherInstance, type MountLauncherStart, type MountLocalLayout, type MountMode, type MountSessionRequest, type MountSessionResponse, type MountSessionResult, type MountSyncMode, type MountSupervisorEvent, type MountedWorkspaceHandle, type MountedWorkspaceStatus, type MountWorkspaceInput, type ReadMountedWorkspaceStatusInput, type RelayfileSetupOptions, type RelayfileSetupRetryOptions, type WaitForConnectionOptions, type WorkspaceInfo, type WorkspaceIntegrationProvider, type WorkspaceMountEnv, type WorkspaceMountEnvOptions, type WorkspacePermissions } from "./setup-types.js";
7
7
  export { RelayFileSync, type RelayFileSyncOptions, type RelayFileSyncPong, type RelayFileSyncReconnectOptions, type RelayFileSyncSocket, type RelayFileSyncStart, type RelayFileSyncState, type RelayFileSyncTokenProvider } from "./sync.js";
8
8
  export { onWrite, pathMatches, type OnWriteClient, type OnWriteHandler, type OnWriteHandlerError, type OnWriteOptions } from "./onWrite.js";
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  export { RelayFileClient, DEFAULT_RELAYFILE_BASE_URL } from "./client.js";
2
2
  export { RelayfileSetup, RELAYFILE_SDK_VERSION, WorkspaceHandle } from "./setup.js";
3
- export { CloudAbortError, CloudApiError, CloudTimeoutError, InvalidLocalDirError, InvalidMountModeError, InvalidRemotePathError, IntegrationConnectionTimeoutError, MalformedCloudResponseError, MissingConnectionIdError, MountModeUnavailableError, MountReadyTimeoutError, MountSessionInputError, ProviderNotConnectedError, ProviderNotReadyError, RelayfileSetupError, UnknownProviderError } from "./setup-errors.js";
3
+ export { CloudAbortError, CloudApiError, CloudTimeoutError, InvalidLocalDirError, InvalidMountModeError, InvalidRemotePathError, IntegrationConnectionTimeoutError, MalformedCloudResponseError, MissingConnectionIdError, MountModeUnavailableError, MountMultiPathUnsupportedError, MountReadyTimeoutError, MountSessionInputError, ProviderNotConnectedError, ProviderNotReadyError, RelayfileSetupError, UnknownProviderError } from "./setup-errors.js";
4
4
  export { WORKSPACE_INTEGRATION_PROVIDERS } from "./setup-types.js";
5
5
  export { RelayFileSync } from "./sync.js";
6
6
  export { onWrite, pathMatches } from "./onWrite.js";
@@ -5,7 +5,8 @@ import path from "node:path";
5
5
  import process from "node:process";
6
6
  import { RelayFileClient } from "./client.js";
7
7
  import { getRelayfileMountBinaryPath } from "./mount-path.js";
8
- import { CloudAbortError, MountModeUnavailableError, MountReadyTimeoutError, RelayfileSetupError } from "./setup-errors.js";
8
+ import { assertExactMountLayout } from "./mount-layout-guard.js";
9
+ import { CloudAbortError, MountModeUnavailableError, MountMultiPathUnsupportedError, MountReadyTimeoutError, RelayfileSetupError } from "./setup-errors.js";
9
10
  const DEFAULT_READY_POLL_INTERVAL_MS = 250;
10
11
  const DEFAULT_STOP_TIMEOUT_MS = 10_000;
11
12
  const LOG_ROTATION_MAX_BYTES = 10 * 1024 * 1024;
@@ -45,8 +46,16 @@ export async function readMountedWorkspaceStatus(input) {
45
46
  };
46
47
  }
47
48
  async function startRelayfileMount(input, options) {
48
- const localDir = path.resolve(input.env.RELAYFILE_LOCAL_DIR ?? process.cwd());
49
- const mountLocalDir = resolveMountLocalDir(localDir, input.env.RELAYFILE_REMOTE_PATH, input.env.RELAYFILE_MOUNT_LOCAL_LAYOUT);
49
+ const effectiveEnv = {
50
+ ...process.env,
51
+ ...input.env
52
+ };
53
+ assertExactMountLayout(effectiveEnv);
54
+ if ((effectiveEnv.RELAYFILE_MOUNT_PATHS_FILE ?? "").trim() !== "") {
55
+ throw new MountMultiPathUnsupportedError();
56
+ }
57
+ const localDir = path.resolve(effectiveEnv.RELAYFILE_LOCAL_DIR ?? process.cwd());
58
+ const mountLocalDir = resolveMountLocalDir(localDir, effectiveEnv.RELAYFILE_REMOTE_PATH, effectiveEnv.RELAYFILE_MOUNT_LOCAL_LAYOUT);
50
59
  const relayDir = path.join(mountLocalDir, ".relay");
51
60
  const logPath = path.join(relayDir, "mount.log");
52
61
  const pidPath = path.join(relayDir, "mount.pid");
@@ -56,10 +65,7 @@ async function startRelayfileMount(input, options) {
56
65
  const args = input.background === false ? ["--once"] : [];
57
66
  const child = (options.spawnImpl ?? spawn)(command, args, {
58
67
  cwd: input.cwd ?? mountLocalDir,
59
- env: {
60
- ...process.env,
61
- ...input.env
62
- },
68
+ env: effectiveEnv,
63
69
  stdio: ["ignore", "pipe", "pipe"]
64
70
  });
65
71
  const outputBuffer = [];
@@ -0,0 +1,2 @@
1
+ /** Refuse scoped runtime state until all operator surfaces can enumerate it. */
2
+ export declare function assertExactMountLayout(env: Record<string, string | undefined>): void;
@@ -0,0 +1,8 @@
1
+ import { MountSessionInputError } from "./setup-errors.js";
2
+ /** Refuse scoped runtime state until all operator surfaces can enumerate it. */
3
+ export function assertExactMountLayout(env) {
4
+ if ((env.RELAYFILE_MOUNT_LOCAL_LAYOUT ?? "").trim().toLowerCase() !== "scoped") {
5
+ return;
6
+ }
7
+ throw new MountSessionInputError("The TypeScript mount launcher does not support RELAYFILE_MOUNT_LOCAL_LAYOUT=scoped until scoped operator surfaces are ready; use RELAYFILE_MOUNT_LOCAL_LAYOUT=exact.");
8
+ }
@@ -45,6 +45,9 @@ export declare class MissingConnectionIdError extends RelayfileSetupError {
45
45
  export declare class MountSessionInputError extends RelayfileSetupError {
46
46
  constructor(message: string);
47
47
  }
48
+ export declare class MountMultiPathUnsupportedError extends RelayfileSetupError {
49
+ constructor();
50
+ }
48
51
  export declare class InvalidMountModeError extends RelayfileSetupError {
49
52
  readonly mode: string;
50
53
  constructor(mode: string);
@@ -74,6 +74,11 @@ export class MountSessionInputError extends RelayfileSetupError {
74
74
  super(message, "mount_session_input_error");
75
75
  }
76
76
  }
77
+ export class MountMultiPathUnsupportedError extends RelayfileSetupError {
78
+ constructor() {
79
+ super("The TypeScript mount launcher detected RELAYFILE_MOUNT_PATHS_FILE but supports only one remotePath; use the relayfile CLI for multi-path mounts until the TypeScript session and status types support multiple roots.", "mount_multi_path_unsupported");
80
+ }
81
+ }
77
82
  export class InvalidMountModeError extends RelayfileSetupError {
78
83
  mode;
79
84
  constructor(mode) {
@@ -6,6 +6,7 @@ import https from 'node:https';
6
6
  import { createRequire } from 'node:module';
7
7
  import os from 'node:os';
8
8
  import path from 'node:path';
9
+ import { assertExactMountLayout } from './mount-layout-guard.js';
9
10
  const require = createRequire(import.meta.url);
10
11
  const RELAYFILE_VERSION = String(require('../package.json').version);
11
12
  const RELEASE_BASE_URL = 'https://github.com/AgentWorkforce/relayfile/releases/download';
@@ -279,6 +280,7 @@ async function stopMountProcess(processRef) {
279
280
  });
280
281
  }
281
282
  export async function ensureRelayfileMount(config) {
283
+ assertExactMountLayout(process.env);
282
284
  const binaryPath = await ensureRelayfileMountBinary(config.binaryPath);
283
285
  if (!existsSync(binaryPath)) {
284
286
  throw new Error(`missing relayfile mount binary: ${binaryPath}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@relayfile/sdk",
3
- "version": "0.10.37",
3
+ "version": "0.10.39",
4
4
  "description": "TypeScript SDK for relayfile — real-time filesystem for humans and agents",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -59,15 +59,15 @@
59
59
  "prepublishOnly": "npm run build"
60
60
  },
61
61
  "dependencies": {
62
- "@relayfile/core": "0.10.37",
62
+ "@relayfile/core": "0.10.39",
63
63
  "ignore": "^7.0.5",
64
64
  "tar": "^7.5.10"
65
65
  },
66
66
  "optionalDependencies": {
67
- "@relayfile/mount-darwin-arm64": "0.10.37",
68
- "@relayfile/mount-darwin-x64": "0.10.37",
69
- "@relayfile/mount-linux-arm64": "0.10.37",
70
- "@relayfile/mount-linux-x64": "0.10.37"
67
+ "@relayfile/mount-darwin-arm64": "0.10.39",
68
+ "@relayfile/mount-darwin-x64": "0.10.39",
69
+ "@relayfile/mount-linux-arm64": "0.10.39",
70
+ "@relayfile/mount-linux-x64": "0.10.39"
71
71
  },
72
72
  "devDependencies": {
73
73
  "typescript": "^5.7.3",