@relayfile/sdk 0.10.36 → 0.10.38

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/client.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { type AdminIngressStatusResponse, type AdminSyncStatusResponse, type BulkWriteInput, type BulkWriteResponse, type BackendStatusResponse, type AckResponse, type CommitForkInput, type CommitForkResponse, type AcceptDurableSubscriptionDeliveryInput, type CancelDurableResourceSubscriptionOptions, type ClaimDurableSubscriptionDeliveriesInput, type CreateOrRenewDurableResourceSubscriptionInput, type CreateForkInput, type DeleteFileInput, type DeadLetterItem, type DeadLetterFeedResponse, type DeleteWebhookOptions, type DiscardForkInput, type DurableResourceSubscription, type DurableResourceSubscriptionListResponse, type DurableSubscriptionDeliveryListResponse, type DurableSubscriptionDeliveryResponse, type EventFeedResponse, type ExportJsonResponse, type ExportOptions, type FileQueryResponse, type FileReadResponse, type FilesystemEvent, type GetEventsOptions, type GetAdminIngressStatusOptions, type GetAdminSyncStatusOptions, type GetOperationsOptions, type GetSyncDeadLettersOptions, type GetSyncIngressStatusOptions, type GetSyncStatusOptions, type GetWebhookDeadLettersOptions, type ListWebhooksOptions, type ListDurableResourceSubscriptionsOptions, type ListTreeOptions, type OperationFeedResponse, type OperationStatusResponse, type QueuedResponse, type ResourceAtEventResult, type ReadFileInput, type QueryFilesOptions, type RegisterWebhookInput, type RegisterWebhookResponse, type RelayFileReadCacheOptions, type Subscription, type SyncIngressStatusResponse, type SyncProviderStatus, type SyncStatusResponse, type TreeResponse, type WriteFileInput, type WriteQueuedResponse, type IngestWebhookInput, type WritebackItem, type WebhookDeliveryDeadLetterFeedResponse, type WebhookSubscription, type AckWritebackInput, type AckWritebackResponse, type SweepWritebackDraftsInput, type SweepWritebackDraftsResponse, type ChangeEvent, type ChangeLogQueryResult, type ChangeStreamConnection, type ChangeStreamConnectionOptions, type SubscribeOptions, type WaitForDataOptions } from "./types.js";
1
+ import { type AdminIngressStatusResponse, type AdminSyncStatusResponse, type BulkWriteInput, type BulkWriteResponse, type BackendStatusResponse, type AckResponse, type CommitForkInput, type CommitForkResponse, type AcceptDurableSubscriptionDeliveryInput, type CancelDurableResourceSubscriptionOptions, type ClaimDurableSubscriptionDeliveriesInput, type CreateOrRenewDurableResourceSubscriptionInput, type CreateForkInput, type DeleteFileInput, type DeadLetterItem, type DeadLetterFeedResponse, type DeleteWebhookOptions, type DiscardForkInput, type DurableResourceSubscription, type DurableResourceSubscriptionListResponse, type DurableSubscriptionDeliveryListResponse, type DurableSubscriptionDeliveryResponse, type EventFeedResponse, type ExportJsonResponse, type ExportOptions, type FileQueryResponse, type FileReadResponse, type FilesystemEvent, type GetEventsOptions, type GetAdminIngressStatusOptions, type GetAdminSyncStatusOptions, type GetOperationsOptions, type GetSyncDeadLettersOptions, type GetSyncIngressStatusOptions, type GetSyncStatusOptions, type GetWebhookDeadLettersOptions, type ListWebhooksOptions, type ListDurableResourceSubscriptionsOptions, type ListTreeOptions, type MergeFileInput, type MergeFileResponse, type OperationFeedResponse, type OperationStatusResponse, type QueuedResponse, type ResourceAtEventResult, type ReadFileInput, type QueryFilesOptions, type RebaseForkInput, type RebaseForkResponse, type RegisterWebhookInput, type RegisterWebhookResponse, type RelayFileReadCacheOptions, type Subscription, type SyncIngressStatusResponse, type SyncProviderStatus, type SyncStatusResponse, type TreeResponse, type WriteFileInput, type WriteQueuedResponse, type IngestWebhookInput, type WritebackItem, type WebhookDeliveryDeadLetterFeedResponse, type WebhookSubscription, type AckWritebackInput, type AckWritebackResponse, type SweepWritebackDraftsInput, type SweepWritebackDraftsResponse, type ChangeEvent, type ChangeLogQueryResult, type ChangeStreamConnection, type ChangeStreamConnectionOptions, type SubscribeOptions, type WaitForDataOptions } from "./types.js";
2
2
  import type { ForkHandle } from "@relayfile/core";
3
3
  /**
4
4
  * Bearer token or token factory used for Relayfile API requests.
@@ -102,11 +102,13 @@ export declare class RelayFileClient {
102
102
  readFile(input: ReadFileInput): Promise<FileReadResponse>;
103
103
  queryFiles(workspaceId: string, options?: QueryFilesOptions): Promise<FileQueryResponse>;
104
104
  writeFile(input: WriteFileInput): Promise<WriteQueuedResponse>;
105
+ mergeFile(input: MergeFileInput): Promise<MergeFileResponse>;
105
106
  bulkWrite(input: BulkWriteInput): Promise<BulkWriteResponse>;
106
107
  deleteFile(input: DeleteFileInput): Promise<WriteQueuedResponse>;
107
108
  createFork(input: CreateForkInput): Promise<ForkHandle>;
108
109
  discardFork(input: DiscardForkInput): Promise<void>;
109
110
  commitFork(input: CommitForkInput): Promise<CommitForkResponse>;
111
+ rebaseFork(input: RebaseForkInput): Promise<RebaseForkResponse>;
110
112
  getEvents(workspaceId: string, options?: GetEventsOptions): Promise<EventFeedResponse>;
111
113
  createOrRenewDurableResourceSubscription(input: CreateOrRenewDurableResourceSubscriptionInput): Promise<DurableResourceSubscription>;
112
114
  listDurableResourceSubscriptions(workspaceId: string, options?: ListDurableResourceSubscriptionsOptions): Promise<DurableResourceSubscriptionListResponse>;
package/dist/client.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { RelayFileSync, normalizeFilesystemEvent } from "./sync.js";
2
- import { InvalidStateError, PayloadTooLargeError, QueueFullError, RelayFileApiError, RevisionConflictError } from "./errors.js";
2
+ import { InvalidStateError, MergeConflictError, ParentMovedError, PayloadTooLargeError, QueueFullError, RelayFileApiError, RevisionConflictError } from "./errors.js";
3
3
  /** Default base URL for the hosted Relayfile API */
4
4
  export const DEFAULT_RELAYFILE_BASE_URL = "https://api.relayfile.dev";
5
5
  const DEFAULT_RETRY_OPTIONS = {
@@ -1270,6 +1270,33 @@ export class RelayFileClient {
1270
1270
  cache.evict(workspaceId, path);
1271
1271
  return result;
1272
1272
  }
1273
+ async mergeFile(input) {
1274
+ const query = buildQuery({ path: input.path });
1275
+ const result = await this.request({
1276
+ method: "POST",
1277
+ path: `/v1/workspaces/${encodeURIComponent(input.workspaceId)}/fs/merge${query}`,
1278
+ correlationId: input.correlationId,
1279
+ body: {
1280
+ strategy: input.strategy,
1281
+ content: input.content,
1282
+ baseRevision: input.baseRevision,
1283
+ baseContent: input.baseContent,
1284
+ // Default per-strategy: go-top-level-functions-v1 is Go-only, so
1285
+ // existing callers that omit contentType must keep getting
1286
+ // "text/x-go" (changing this would silently rewrite their file's
1287
+ // stored content type and provider-writeback metadata on every
1288
+ // merge). three-way-lines-v1 has no language restriction, so
1289
+ // "text/plain" is the right neutral default there.
1290
+ contentType: input.contentType ?? (input.strategy === "go-top-level-functions-v1" ? "text/x-go" : "text/plain"),
1291
+ contentIdentity: input.contentIdentity
1292
+ },
1293
+ signal: input.signal
1294
+ });
1295
+ const cache = getFileReadCache(this);
1296
+ if (cache !== false)
1297
+ cache.evict(input.workspaceId, input.path);
1298
+ return result;
1299
+ }
1273
1300
  async bulkWrite(input) {
1274
1301
  const query = buildQuery({ forkId: input.forkId });
1275
1302
  const response = await this.performRequest({
@@ -1337,6 +1364,14 @@ export class RelayFileClient {
1337
1364
  signal: input.signal
1338
1365
  });
1339
1366
  }
1367
+ async rebaseFork(input) {
1368
+ return this.request({
1369
+ method: "POST",
1370
+ path: `/v1/workspaces/${encodeURIComponent(input.workspaceId)}/forks/${encodeURIComponent(input.forkId)}/rebase`,
1371
+ correlationId: input.correlationId,
1372
+ signal: input.signal
1373
+ });
1374
+ }
1340
1375
  async getEvents(workspaceId, options = {}) {
1341
1376
  const query = buildQuery({
1342
1377
  provider: options.provider,
@@ -2101,6 +2136,26 @@ export class RelayFileClient {
2101
2136
  const rawData = (payload ?? {});
2102
2137
  const data = rawData;
2103
2138
  const details = normalizeErrorDetails(rawData, data.details);
2139
+ if (status === 409 && data.code === "merge_conflict") {
2140
+ const currentRevision = typeof data.currentRevision === "string"
2141
+ ? data.currentRevision
2142
+ : typeof details?.currentRevision === "string"
2143
+ ? details.currentRevision
2144
+ : "";
2145
+ const conflicts = Array.isArray(data.conflicts)
2146
+ ? data.conflicts
2147
+ : Array.isArray(details?.conflicts)
2148
+ ? details.conflicts
2149
+ : [];
2150
+ throw new MergeConflictError(status, {
2151
+ code: data.code,
2152
+ message: data.message ?? "Merge conflict",
2153
+ correlationId: data.correlationId,
2154
+ details,
2155
+ currentRevision,
2156
+ conflicts
2157
+ });
2158
+ }
2104
2159
  if (status === 409 &&
2105
2160
  typeof data.expectedRevision === "string" &&
2106
2161
  typeof data.currentRevision === "string") {
@@ -2122,6 +2177,20 @@ export class RelayFileClient {
2122
2177
  details
2123
2178
  });
2124
2179
  }
2180
+ if (status === 409 && data.code === "parent_moved") {
2181
+ const currentRevision = typeof data.currentRevision === "string"
2182
+ ? data.currentRevision
2183
+ : typeof details?.currentRevision === "string"
2184
+ ? details.currentRevision
2185
+ : "";
2186
+ throw new ParentMovedError(status, {
2187
+ code: data.code,
2188
+ message: data.message ?? "Parent moved",
2189
+ correlationId: data.correlationId,
2190
+ details,
2191
+ currentRevision
2192
+ });
2193
+ }
2125
2194
  if (status === 429 && data.code === "queue_full") {
2126
2195
  const retryAfterRaw = headers.get("retry-after");
2127
2196
  let retryAfterSeconds;
@@ -2146,6 +2215,14 @@ export class RelayFileClient {
2146
2215
  details
2147
2216
  });
2148
2217
  }
2218
+ if (data.code === "merge_base_unavailable" || data.code === "merge_ineligible") {
2219
+ throw new RelayFileApiError(status, {
2220
+ code: data.code,
2221
+ message: data.message ?? (data.code === "merge_base_unavailable" ? "Merge base unavailable" : "Merge ineligible"),
2222
+ correlationId: data.correlationId,
2223
+ details
2224
+ });
2225
+ }
2149
2226
  throw new RelayFileApiError(status, {
2150
2227
  code: data.code ?? "api_error",
2151
2228
  message: data.message ?? `HTTP ${status}`,
package/dist/errors.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { ConflictErrorResponse, ErrorResponse } from "./types.js";
1
+ import type { ConflictErrorResponse, ErrorResponse, MergeConflictDetail } from "./types.js";
2
2
  export declare class RelayFileApiError extends Error {
3
3
  readonly status: number;
4
4
  readonly code: string;
@@ -12,6 +12,20 @@ export declare class RevisionConflictError extends RelayFileApiError {
12
12
  readonly currentContentPreview?: string;
13
13
  constructor(status: number, payload: ConflictErrorResponse);
14
14
  }
15
+ export declare class ParentMovedError extends RelayFileApiError {
16
+ readonly currentRevision: string;
17
+ constructor(status: number, payload: Partial<ErrorResponse> & {
18
+ currentRevision: string;
19
+ });
20
+ }
21
+ export declare class MergeConflictError extends RelayFileApiError {
22
+ readonly currentRevision: string;
23
+ readonly conflicts: MergeConflictDetail[];
24
+ constructor(status: number, payload: Partial<ErrorResponse> & {
25
+ currentRevision: string;
26
+ conflicts: MergeConflictDetail[];
27
+ });
28
+ }
15
29
  export declare class QueueFullError extends RelayFileApiError {
16
30
  readonly retryAfterSeconds?: number;
17
31
  constructor(status: number, payload?: Partial<ErrorResponse>, retryAfterSeconds?: number);
package/dist/errors.js CHANGED
@@ -24,6 +24,24 @@ export class RevisionConflictError extends RelayFileApiError {
24
24
  this.currentContentPreview = payload.currentContentPreview;
25
25
  }
26
26
  }
27
+ export class ParentMovedError extends RelayFileApiError {
28
+ currentRevision;
29
+ constructor(status, payload) {
30
+ super(status, payload);
31
+ this.name = "ParentMovedError";
32
+ this.currentRevision = payload.currentRevision;
33
+ }
34
+ }
35
+ export class MergeConflictError extends RelayFileApiError {
36
+ currentRevision;
37
+ conflicts;
38
+ constructor(status, payload) {
39
+ super(status, payload);
40
+ this.name = "MergeConflictError";
41
+ this.currentRevision = payload.currentRevision;
42
+ this.conflicts = payload.conflicts;
43
+ }
44
+ }
27
45
  export class QueueFullError extends RelayFileApiError {
28
46
  retryAfterSeconds;
29
47
  constructor(status, payload = {}, retryAfterSeconds) {
package/dist/index.d.ts CHANGED
@@ -6,14 +6,14 @@ export { CloudAbortError, CloudApiError, CloudTimeoutError, InvalidLocalDirError
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";
9
- export { InvalidStateError, PayloadTooLargeError, QueueFullError, RelayFileApiError, RevisionConflictError } from "./errors.js";
9
+ export { InvalidStateError, MergeConflictError, ParentMovedError, PayloadTooLargeError, QueueFullError, RelayFileApiError, RevisionConflictError } from "./errors.js";
10
10
  export { IntegrationProvider, computeCanonicalPath } from "./provider.js";
11
11
  export type { WebhookInput, ListProviderFilesOptions, WatchProviderEventsOptions } from "./provider.js";
12
12
  export type { ConnectCapableProvider, ConnectConnectionStatus, ConnectSession, ConnectionProvider, CreateConnectSessionInput, GetConnectConnectionStatusInput, NormalizedWebhook, ProviderConfigKeyMap, ProxyHeaders, ProxyMethod, ProxyQuery, ProxyRequest, ProxyResponse, } from "./connection.js";
13
13
  export { supportsConnect } from "./connection.js";
14
14
  export { SelfHostConnect } from "./self-host-connect.js";
15
15
  export type { SelfHostConnectOptions, SelfHostConnectResult, StartSelfHostConnectOptions, WaitForSelfHostConnectionOptions } from "./self-host-connect.js";
16
- export type { AckResponse, AcceptDurableSubscriptionDeliveryInput, AckWritebackInput, AckWritebackDraftDisposition, AckWritebackResponse, AdminIngressAlert, AdminIngressAlertProfile, AdminIngressEffectiveAlertProfile, AdminIngressAlertSeverity, AdminIngressAlertThresholds, AdminIngressAlertTotals, AdminIngressAlertType, AdminIngressStatusResponse, AdminSyncAlert, AdminSyncAlertSeverity, AdminSyncAlertThresholds, AdminSyncAlertTotals, AdminSyncAlertType, AdminSyncStatusResponse, BackendStatusResponse, BulkWriteFile, BulkWriteInput, BulkWriteResponse, CancelDurableResourceSubscriptionOptions, ChangeLogQueryResult, ChangeEvent, ChangeEventActor, ChangeEventResource, ChangeEventSummary, ChangeStreamConnection, ChangeStreamConnectionOptions, ClaimDurableSubscriptionDeliveriesInput, CommitForkInput, CommitForkResponse, ConflictErrorResponse, CreateOrRenewDurableResourceSubscriptionInput, CreateForkInput, ContentIdentity, DeleteFileInput, DeleteWebhookOptions, DeadLetterFeedResponse, DeadLetterItem, DigestBullet, DigestContext, DigestHandler, DigestSection, DigestWindow, DiscardForkInput, DurableResourceSubscription, DurableResourceSubscriptionListResponse, DurableResourceSubscriptionStatus, DurableSubscriptionDelivery, DurableSubscriptionDeliveryListResponse, DurableSubscriptionDeliveryResponse, DurableSubscriptionDeliveryStatus, DurableSubscriptionEvent, ErrorResponse, EventSummary, EventFeedResponse, ExportFormat, ExportJsonResponse, ExportOptions, FileQueryItem, FileQueryResponse, FileReadResponse, FileSemantics, FileWriteRequest, FilesystemEvent, FilesystemEventType, EventOrigin, Expansion, ExpansionLevel, GetEventsOptions, GetAdminSyncStatusOptions, GetAdminIngressStatusOptions, GetOperationsOptions, GetSyncDeadLettersOptions, GetSyncIngressStatusOptions, GetSyncStatusOptions, WaitForDataOptions, GetWebhookDeadLettersOptions, IngestWebhookInput, LayoutManifest, LayoutManifestAlias, LayoutManifestResource, ListWebhooksOptions, ListDurableResourceSubscriptionsOptions, ListTreeOptions, OperationFeedResponse, OperationStatus, OperationStatusResponse, QueuedResponse, QueryFilesOptions, ReadFileInput, RegisterWebhookInput, RegisterWebhookResponse, ReplayOptions, ResourceAtEventResult, SummaryExpansion, FullExpansion, DiffExpansion, ThreadExpansion, RelayFileJwtClaims, SubscribeOptions, Subscription, SyncIngressStatusResponse, SyncProviderStatus, SyncProviderStatusState, SyncRefreshRequest, SyncStatusResponse, SweepWritebackDraftsInput, SweepWritebackDraftsResponse, TreeEntry, TreeResponse, WebhookDeliveryDeadLetterFeedResponse, WebhookDeliveryDeadLetterItem, WebhookSubscription, WebhookSubscriptionHealth, WritebackActionType, WritebackDeadLetterError, WritebackDeadLetterErrorCode, WritebackListState, WritebackState, WritebackItem, WritebackItemDetail, WritebackSchemaRef, WriteFileInput, WriteQueuedResponse } from "./types.js";
16
+ export type { AckResponse, AcceptDurableSubscriptionDeliveryInput, AckWritebackInput, AckWritebackDraftDisposition, AckWritebackResponse, AdminIngressAlert, AdminIngressAlertProfile, AdminIngressEffectiveAlertProfile, AdminIngressAlertSeverity, AdminIngressAlertThresholds, AdminIngressAlertTotals, AdminIngressAlertType, AdminIngressStatusResponse, AdminSyncAlert, AdminSyncAlertSeverity, AdminSyncAlertThresholds, AdminSyncAlertTotals, AdminSyncAlertType, AdminSyncStatusResponse, BackendStatusResponse, BulkWriteFile, BulkWriteInput, BulkWriteResponse, CancelDurableResourceSubscriptionOptions, ChangeLogQueryResult, ChangeEvent, ChangeEventActor, ChangeEventResource, ChangeEventSummary, ChangeStreamConnection, ChangeStreamConnectionOptions, ClaimDurableSubscriptionDeliveriesInput, CommitForkInput, CommitForkResponse, ConflictErrorResponse, CreateOrRenewDurableResourceSubscriptionInput, CreateForkInput, ContentIdentity, DeleteFileInput, DeleteWebhookOptions, DeadLetterFeedResponse, DeadLetterItem, DigestBullet, DigestContext, DigestHandler, DigestSection, DigestWindow, DiscardForkInput, DurableResourceSubscription, DurableResourceSubscriptionListResponse, DurableResourceSubscriptionStatus, DurableSubscriptionDelivery, DurableSubscriptionDeliveryListResponse, DurableSubscriptionDeliveryResponse, DurableSubscriptionDeliveryStatus, DurableSubscriptionEvent, ErrorResponse, EventSummary, EventFeedResponse, ExportFormat, ExportJsonResponse, ExportOptions, FileQueryItem, FileQueryResponse, FileReadResponse, FileSemantics, FileWriteRequest, FilesystemEvent, FilesystemEventType, EventOrigin, Expansion, ExpansionLevel, GetEventsOptions, GetAdminSyncStatusOptions, GetAdminIngressStatusOptions, GetOperationsOptions, GetSyncDeadLettersOptions, GetSyncIngressStatusOptions, GetSyncStatusOptions, WaitForDataOptions, GetWebhookDeadLettersOptions, IngestWebhookInput, LayoutManifest, LayoutManifestAlias, LayoutManifestResource, ListWebhooksOptions, ListDurableResourceSubscriptionsOptions, ListTreeOptions, MergeConflictDetail, MergeFileInput, MergeFileResponse, OperationFeedResponse, OperationStatus, OperationStatusResponse, QueuedResponse, QueryFilesOptions, RebaseConflict, RebaseForkInput, RebaseForkResponse, ReadFileInput, RegisterWebhookInput, RegisterWebhookResponse, ReplayOptions, ResourceAtEventResult, SummaryExpansion, FullExpansion, DiffExpansion, ThreadExpansion, RelayFileJwtClaims, SubscribeOptions, Subscription, SyncIngressStatusResponse, SyncProviderStatus, SyncProviderStatusState, SyncRefreshRequest, SyncStatusResponse, SweepWritebackDraftsInput, SweepWritebackDraftsResponse, TreeEntry, TreeResponse, WebhookDeliveryDeadLetterFeedResponse, WebhookDeliveryDeadLetterItem, WebhookSubscription, WebhookSubscriptionHealth, WritebackActionType, WritebackDeadLetterError, WritebackDeadLetterErrorCode, WritebackListState, WritebackState, WritebackItem, WritebackItemDetail, WritebackSchemaRef, WriteFileInput, WriteQueuedResponse } from "./types.js";
17
17
  export type { ForkHandle, ForkOptions } from "@relayfile/core";
18
18
  export type { WriteEvent, WriteEventActor, WriteEventOperation, WriteEventSource } from "@relayfile/core";
19
19
  export { WritebackConsumer } from "./writeback-consumer.js";
package/dist/index.js CHANGED
@@ -4,7 +4,7 @@ export { CloudAbortError, CloudApiError, CloudTimeoutError, InvalidLocalDirError
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";
7
- export { InvalidStateError, PayloadTooLargeError, QueueFullError, RelayFileApiError, RevisionConflictError } from "./errors.js";
7
+ export { InvalidStateError, MergeConflictError, ParentMovedError, PayloadTooLargeError, QueueFullError, RelayFileApiError, RevisionConflictError } from "./errors.js";
8
8
  // Integration providers
9
9
  export { IntegrationProvider, computeCanonicalPath } from "./provider.js";
10
10
  export { supportsConnect } from "./connection.js";
package/dist/types.d.ts CHANGED
@@ -86,6 +86,13 @@ export interface BulkWriteFile {
86
86
  content: string;
87
87
  encoding?: "utf-8" | "base64";
88
88
  contentIdentity?: ContentIdentity;
89
+ /**
90
+ * Optional per-file optimistic-concurrency precondition, same semantics
91
+ * as the single-file write's If-Match header: "0" or "*" to create only
92
+ * if the path is absent, an exact revision to require an unchanged base,
93
+ * "*" to force. Omitted means no check (unconditional overwrite).
94
+ */
95
+ ifMatch?: string;
89
96
  }
90
97
  export interface BulkWriteInput {
91
98
  workspaceId: string;
@@ -101,6 +108,10 @@ export interface BulkWriteResponse {
101
108
  path: string;
102
109
  code: string;
103
110
  message: string;
111
+ /** Present when code is "conflict" — the ifMatch value that was sent. */
112
+ expectedRevision?: string;
113
+ /** Present when code is "conflict" and the path exists — the file's actual current revision. */
114
+ currentRevision?: string;
104
115
  }>;
105
116
  results?: Array<{
106
117
  path: string;
@@ -792,6 +803,31 @@ export interface WriteFileInput {
792
803
  correlationId?: string;
793
804
  signal?: AbortSignal;
794
805
  }
806
+ export interface MergeFileInput {
807
+ workspaceId: string;
808
+ path: string;
809
+ strategy: "go-top-level-functions-v1" | "three-way-lines-v1";
810
+ content: string;
811
+ baseRevision: string;
812
+ baseContent: string;
813
+ contentType?: string;
814
+ contentIdentity?: ContentIdentity;
815
+ correlationId?: string;
816
+ signal?: AbortSignal;
817
+ }
818
+ export interface MergeFileResponse {
819
+ targetRevision: string;
820
+ strategy: "go-top-level-functions-v1" | "three-way-lines-v1";
821
+ baseRevision: string;
822
+ mergedAgainstRevision: string;
823
+ }
824
+ export interface MergeConflictDetail {
825
+ unit: string;
826
+ reason: string;
827
+ base?: string;
828
+ mine?: string;
829
+ theirs?: string;
830
+ }
795
831
  export interface DeleteFileInput {
796
832
  workspaceId: string;
797
833
  path: string;
@@ -824,6 +860,24 @@ export interface CommitForkResponse {
824
860
  writtenCount: number;
825
861
  deletedCount: number;
826
862
  }
863
+ export interface RebaseForkInput {
864
+ workspaceId: string;
865
+ forkId: string;
866
+ correlationId?: string;
867
+ signal?: AbortSignal;
868
+ }
869
+ export interface RebaseConflict {
870
+ path: string;
871
+ forkType: "write" | "delete";
872
+ liveExists: boolean;
873
+ liveRevision: string;
874
+ liveContentPreview?: string;
875
+ }
876
+ export interface RebaseForkResponse {
877
+ parentRevision: string;
878
+ cleanCount: number;
879
+ conflicts: RebaseConflict[];
880
+ }
827
881
  export interface IngestWebhookInput {
828
882
  workspaceId: string;
829
883
  provider: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@relayfile/sdk",
3
- "version": "0.10.36",
3
+ "version": "0.10.38",
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.36",
62
+ "@relayfile/core": "0.10.38",
63
63
  "ignore": "^7.0.5",
64
64
  "tar": "^7.5.10"
65
65
  },
66
66
  "optionalDependencies": {
67
- "@relayfile/mount-darwin-arm64": "0.10.36",
68
- "@relayfile/mount-darwin-x64": "0.10.36",
69
- "@relayfile/mount-linux-arm64": "0.10.36",
70
- "@relayfile/mount-linux-x64": "0.10.36"
67
+ "@relayfile/mount-darwin-arm64": "0.10.38",
68
+ "@relayfile/mount-darwin-x64": "0.10.38",
69
+ "@relayfile/mount-linux-arm64": "0.10.38",
70
+ "@relayfile/mount-linux-x64": "0.10.38"
71
71
  },
72
72
  "devDependencies": {
73
73
  "typescript": "^5.7.3",