mindwire 0.1.30 → 0.1.33

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
@@ -992,6 +992,10 @@ export interface Health {
992
992
  workspaceMetadataVersion?: number;
993
993
  /** Durable project creation/clone operations; absent on older daemons. */
994
994
  projectOperationsVersion?: number;
995
+ /** Project-relative icons and authenticated image previews. */
996
+ projectIconsVersion?: number;
997
+ /** Preserved workspace replicas, native chat checkpoints and recoverable three-way import. */
998
+ projectSyncVersion?: number;
995
999
  /** Workspace/project GitHub bindings and operation/run credential forwarding. */
996
1000
  gitAccessVersion?: number;
997
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";
@@ -32,7 +33,7 @@ export interface ProjectGitState {
32
33
  stored: boolean;
33
34
  repoUrl?: string;
34
35
  }
35
- export type GitAction = "stage" | "unstage" | "discard" | "commit" | "fetch" | "pull" | "push" | "switch_branch" | "create_branch" | "restore_commit";
36
+ export type GitAction = "stage" | "unstage" | "discard" | "commit" | "fetch" | "pull" | "push" | "switch_branch" | "create_branch" | "restore_commit" | "rename_branch" | "delete_branch";
36
37
  export interface GitIdentity {
37
38
  name: string;
38
39
  email: string;
@@ -61,10 +62,16 @@ export interface GitOperationRequest {
61
62
  paths?: string[];
62
63
  /** Required for commit. Uses the existing author unless identity is explicitly supplied. */
63
64
  message?: string;
64
- /** Literal branch name for switch_branch/create_branch; requires gitOperationsVersion >= 2. */
65
+ /** Literal branch name: switch/create require v2; local rename/delete require v5 and expectedTip. */
65
66
  branch?: string;
66
67
  /** switch_branch only: branch is a remote tracking name, e.g. origin/feature. */
67
68
  remote?: boolean;
69
+ /** rename_branch only: a new local name. Never overwrites another branch. Requires v5. */
70
+ newName?: string;
71
+ /** rename_branch/delete_branch: full selected branch tip, guarding stale confirmation. Requires v5. */
72
+ expectedTip?: string;
73
+ /** delete_branch only: explicit confirmation to delete unmerged commits. Checked-out branches stay protected. */
74
+ force?: boolean;
68
75
  /** Commit only; requires gitOperationsVersion >= 3. Saves attribution in this repository,
69
76
  * then commits under the same durable lock. Never changes global Git configuration. */
70
77
  identity?: GitIdentity;
@@ -85,7 +92,7 @@ export interface GitOperation extends Omit<GitOperationRequest, "auth"> {
85
92
  output?: string;
86
93
  error?: string;
87
94
  /** git_identity_required asks the client to collect a name/email before a new commit intent. */
88
- errorCode?: "git_identity_required" | "git_restore_dirty" | "git_restore_changed" | "git_restore_in_progress" | "git_restore_commit_unavailable" | "git_restore_local_files" | (string & {});
95
+ errorCode?: "git_identity_required" | "git_restore_dirty" | "git_restore_changed" | "git_branch_changed" | "git_branch_in_use" | "git_branch_unmerged" | "git_restore_in_progress" | "git_restore_commit_unavailable" | "git_restore_local_files" | (string & {});
89
96
  createdAt: string;
90
97
  updatedAt: string;
91
98
  sequence: number;
@@ -154,14 +161,27 @@ export interface WorkspaceAgent extends WorkspaceRecord {
154
161
  notificationsMuted?: boolean;
155
162
  }
156
163
  export interface WorkspaceProject extends WorkspaceRecord {
164
+ /** Logical project identity shared by preserved workspace copies. */
165
+ syncId?: string;
157
166
  name: string;
158
167
  path: string;
159
168
  repoUrl?: string;
160
169
  /** Omit on edits to preserve; explicitly null restores the workspace default. */
161
170
  gitConnection?: GitConnection | null;
171
+ /** Project-relative SVG/PNG/JPEG/GIF file. Omit to preserve, null to reset. Requires projectIconsVersion >= 1. */
172
+ iconPath?: string | null;
173
+ }
174
+ export interface ProjectIcon {
175
+ path: string;
176
+ mediaType: string;
177
+ /** Base64-encoded bytes, capped at 1 MiB; served only through the authenticated workspace connection. */
178
+ content: string;
179
+ etag: string;
162
180
  }
163
181
  /** Chat membership; transcript content continues to come from /chats/:id/messages. */
164
182
  export interface WorkspaceChat extends WorkspaceRecord {
183
+ /** Logical conversation identity; the local id remains unique per workspace. */
184
+ syncId?: string;
165
185
  agentId: string;
166
186
  projectId: string;
167
187
  title: string;
@@ -225,6 +245,7 @@ export declare class WorkspaceCollection<T extends WorkspaceRecord> {
225
245
  /** Workspace metadata is shared by all harnesses; withAgent() never scopes these requests. */
226
246
  export declare class WorkspaceApi {
227
247
  private readonly mw;
248
+ readonly sync: ProjectSyncApi;
228
249
  readonly git: GitAccessApi;
229
250
  readonly operations: ProjectOperationsApi;
230
251
  readonly agents: WorkspaceCollection<WorkspaceAgent>;
@@ -234,6 +255,8 @@ export declare class WorkspaceApi {
234
255
  snapshot(options?: {
235
256
  refresh?: boolean;
236
257
  }): Promise<WorkspaceSnapshot>;
258
+ /** Read the saved icon, or preview a candidate relative path within the project. Requires projectIconsVersion >= 1. */
259
+ projectIcon(projectId: string, path?: string): Promise<ProjectIcon>;
237
260
  /** Start an operation owned by the daemon. The same ID/payload returns the existing operation. */
238
261
  createProject(request: ProjectRequest): Promise<ProjectOperation>;
239
262
  /** Permanently remove the confirmed project's directory and membership.
@@ -273,7 +296,7 @@ export declare class GitAccessApi {
273
296
  run(projectId: string, operation: "fetch" | "pull" | "push", auth?: ProjectAuth): Promise<{
274
297
  output: string;
275
298
  }>;
276
- /** Requires health.gitOperationsVersion >= 1 (>= 2 for branches, >= 4 for restore_commit). Acceptance persists before Git runs;
299
+ /** Requires health.gitOperationsVersion >= 1 (>= 2 for switch/create, >= 4 for restore_commit, >= 5 for rename/delete). Acceptance persists before Git runs;
277
300
  * disconnecting only detaches the client. The same ID/intent never runs twice.
278
301
  */
279
302
  start(projectId: string, request: GitOperationRequest): Promise<GitOperation>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mindwire",
3
- "version": "0.1.30",
3
+ "version": "0.1.33",
4
4
  "main": "./dist/index.cjs",
5
5
  "module": "./dist/index.js",
6
6
  "bin": {