mindwire 0.1.32 → 0.1.34

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.
@@ -0,0 +1,101 @@
1
+ import type { Mindwire } from "./client.js";
2
+ import { MindwireError } from "./errors.js";
3
+ export interface ProjectSyncEntry {
4
+ kind: "file" | "directory" | "symlink";
5
+ mode: number;
6
+ size: number;
7
+ chunks?: string[];
8
+ link?: string;
9
+ jsonLines?: boolean;
10
+ }
11
+ export interface ProjectSyncCheckpoint {
12
+ id: string;
13
+ projectId: string;
14
+ parents: string[];
15
+ manifest: ProjectSyncEntry;
16
+ objectCount: number;
17
+ bytes: number;
18
+ }
19
+ export interface ProjectSyncRequest {
20
+ /** Durable idempotency key. Keep the same ID after a lost acknowledgement. */
21
+ id: string;
22
+ projectId?: string;
23
+ checkpointId?: string;
24
+ /** Only needed on first import; subsequent imports find the preserved replica. */
25
+ path?: string;
26
+ }
27
+ export interface ProjectSyncConflict {
28
+ path: string;
29
+ kind: "file" | "conversation" | "git" | "recovery";
30
+ message: string;
31
+ }
32
+ export interface ProjectSyncOperation extends ProjectSyncRequest {
33
+ kind: "export" | "import";
34
+ status: "queued" | "exporting" | "preparing" | "applying" | "succeeded" | "conflicts" | "failed" | "recovery_required";
35
+ phase: string;
36
+ progress: number;
37
+ resultProjectId?: string;
38
+ resultCheckpointId?: string;
39
+ recoveryCheckpointId?: string;
40
+ conflicts?: ProjectSyncConflict[];
41
+ error?: string;
42
+ createdAt: string;
43
+ updatedAt: string;
44
+ }
45
+ export interface ProjectSyncProgress {
46
+ phase: "checkpoint" | "transfer" | "apply";
47
+ transferredBytes: number;
48
+ operation?: ProjectSyncOperation;
49
+ }
50
+ export declare class ProjectSyncError extends MindwireError {
51
+ readonly operation: ProjectSyncOperation;
52
+ constructor(operation: ProjectSyncOperation);
53
+ }
54
+ type Options = {
55
+ signal?: AbortSignal;
56
+ };
57
+ /** Shared checkpoint protocol over the existing authenticated workspace transport.
58
+ * No Git hosting service or third-party storage is involved. Native adapters in
59
+ * the daemon own export/import; clients only relay verified immutable chunks.
60
+ */
61
+ export declare class ProjectSyncApi {
62
+ private readonly mw;
63
+ private readonly flights;
64
+ constructor(mw: Mindwire);
65
+ export(request: ProjectSyncRequest, options?: Options): Promise<ProjectSyncOperation>;
66
+ import(request: ProjectSyncRequest, options?: Options): Promise<ProjectSyncOperation>;
67
+ list(options?: Options): Promise<ProjectSyncOperation[]>;
68
+ get(id: string, options?: Options): Promise<ProjectSyncOperation>;
69
+ retry(id: string, options?: Options): Promise<ProjectSyncOperation>;
70
+ cancel(id: string): Promise<ProjectSyncOperation>;
71
+ checkpoint(id: string, options?: Options): Promise<ProjectSyncCheckpoint>;
72
+ acceptCheckpoint(checkpoint: ProjectSyncCheckpoint, options?: Options): Promise<ProjectSyncCheckpoint>;
73
+ objects(id: string, cursor?: number, options?: Options): Promise<{
74
+ objects: string[];
75
+ next?: number;
76
+ }>;
77
+ missing(objects: string[], options?: Options): Promise<string[]>;
78
+ /** Base64 chunk, at most 256 KiB before encoding. */
79
+ getObject(id: string, options?: Options): Promise<string>;
80
+ putObject(id: string, data: string, options?: Options): Promise<void>;
81
+ wait(id: string, options?: Options & {
82
+ onUpdate?: (operation: ProjectSyncOperation) => void;
83
+ }): Promise<ProjectSyncOperation>;
84
+ /** Repeating this relay skips acknowledged checkpoints and verified chunks.
85
+ * Aborting detaches the relay; daemon export/apply operations remain durable.
86
+ */
87
+ relayCheckpoint(target: ProjectSyncApi, id: string, options?: Options & {
88
+ onBytes?: (bytes: number) => void;
89
+ }): Promise<void>;
90
+ /** Safe X → Y and Y → X. Persist request.id until acknowledged. A conflict
91
+ * throws ProjectSyncError carrying the complete conflict/recovery operation.
92
+ */
93
+ switchTo(target: ProjectSyncApi, request: {
94
+ id: string;
95
+ projectId: string;
96
+ path?: string;
97
+ }, options?: Options & {
98
+ onProgress?: (progress: ProjectSyncProgress) => void;
99
+ }): Promise<ProjectSyncOperation>;
100
+ }
101
+ export {};
package/dist/types.d.ts CHANGED
@@ -994,6 +994,8 @@ export interface Health {
994
994
  projectOperationsVersion?: number;
995
995
  /** Project-relative icons and authenticated image previews. */
996
996
  projectIconsVersion?: number;
997
+ /** Preserved workspace replicas, native chat checkpoints and recoverable three-way import. */
998
+ projectSyncVersion?: number;
997
999
  /** Workspace/project GitHub bindings and operation/run credential forwarding. */
998
1000
  gitAccessVersion?: number;
999
1001
  /** Durable Git writes: v2 adds branches; v3 adds repository-scoped commit author setup. */
@@ -1,4 +1,5 @@
1
1
  import type { Mindwire } from "./client.js";
2
+ import { ProjectSyncApi } from "./project-sync.js";
2
3
  /** Write-only credentials. Never persisted in operation snapshots or conversation state. */
3
4
  export type ProjectAuth = ({
4
5
  kind: "token";
@@ -160,6 +161,8 @@ export interface WorkspaceAgent extends WorkspaceRecord {
160
161
  notificationsMuted?: boolean;
161
162
  }
162
163
  export interface WorkspaceProject extends WorkspaceRecord {
164
+ /** Logical project identity shared by preserved workspace copies. */
165
+ syncId?: string;
163
166
  name: string;
164
167
  path: string;
165
168
  repoUrl?: string;
@@ -177,6 +180,8 @@ export interface ProjectIcon {
177
180
  }
178
181
  /** Chat membership; transcript content continues to come from /chats/:id/messages. */
179
182
  export interface WorkspaceChat extends WorkspaceRecord {
183
+ /** Logical conversation identity; the local id remains unique per workspace. */
184
+ syncId?: string;
180
185
  agentId: string;
181
186
  projectId: string;
182
187
  title: string;
@@ -240,6 +245,7 @@ export declare class WorkspaceCollection<T extends WorkspaceRecord> {
240
245
  /** Workspace metadata is shared by all harnesses; withAgent() never scopes these requests. */
241
246
  export declare class WorkspaceApi {
242
247
  private readonly mw;
248
+ readonly sync: ProjectSyncApi;
243
249
  readonly git: GitAccessApi;
244
250
  readonly operations: ProjectOperationsApi;
245
251
  readonly agents: WorkspaceCollection<WorkspaceAgent>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mindwire",
3
- "version": "0.1.32",
3
+ "version": "0.1.34",
4
4
  "main": "./dist/index.cjs",
5
5
  "module": "./dist/index.js",
6
6
  "bin": {