mindwire 0.1.38 → 0.1.41
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/README.md +19 -0
- package/dist/chunk-4XNTGVCI.js +306 -0
- package/dist/chunk-4XNTGVCI.js.map +1 -0
- package/dist/{chunk-CKTVMUS4.js → chunk-T2ZIA4TK.js} +50 -16
- package/dist/chunk-T2ZIA4TK.js.map +1 -0
- package/dist/cli.js +525 -251
- package/dist/cli.js.map +1 -1
- package/dist/computer/dashboard.d.ts +1 -0
- package/dist/computer/desktop.d.ts +17 -0
- package/dist/computer/directory-http.d.ts +1 -1
- package/dist/computer/discovery.d.ts +22 -0
- package/dist/computer/inspection.d.ts +30 -0
- package/dist/computer/lifecycle.d.ts +4 -2
- package/dist/computer/runtime-version.d.ts +6 -0
- package/dist/computer/service-update.d.ts +26 -0
- package/dist/computer/setup-prompt.d.ts +2 -0
- package/dist/computer/startup.d.ts +7 -0
- package/dist/computer/terminal-ui.d.ts +9 -0
- package/dist/computer.d.ts +2 -0
- package/dist/{connection-change-5F4WNCYV.js → connection-change-RHY2OKFJ.js} +3 -3
- package/dist/{connection-change-5F4WNCYV.js.map → connection-change-RHY2OKFJ.js.map} +1 -1
- package/dist/{controller-3SZI7TBW.js → controller-G2T76QDM.js} +67 -9
- package/dist/controller-G2T76QDM.js.map +1 -0
- package/dist/{controller-handoff-KV7WRDAI.js → controller-handoff-CDPPQ2YH.js} +3 -3
- package/dist/{controller-handoff-KV7WRDAI.js.map → controller-handoff-CDPPQ2YH.js.map} +1 -1
- package/dist/daemon-binary.d.ts +2 -0
- package/dist/index.cjs +41 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +41 -7
- package/dist/index.js.map +1 -1
- package/dist/project-sync.d.ts +29 -0
- package/dist/surfaces.d.ts +20 -1
- package/dist/types.d.ts +2 -0
- package/package.json +1 -1
- package/dist/chunk-CKTVMUS4.js.map +0 -1
- package/dist/chunk-QODJKRFK.js +0 -20
- package/dist/chunk-QODJKRFK.js.map +0 -1
- package/dist/controller-3SZI7TBW.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -38,7 +38,7 @@ export { WorkspaceApi, WorkspaceCollection, ProjectOperationsApi, GitAccessApi }
|
|
|
38
38
|
export { ConversationsApi } from "./conversations.js";
|
|
39
39
|
export type { Conversation, ConversationQuery, ConversationPage, ConversationOpenRequest, ConversationOpenResult } from "./conversations.js";
|
|
40
40
|
export { ProjectSyncApi, ProjectSyncError } from "./project-sync.js";
|
|
41
|
-
export type { ProjectSyncEntry, ProjectSyncCheckpoint, ProjectSyncRequest, ProjectSyncOperation, ProjectSyncConflict, ProjectSyncProgress } from "./project-sync.js";
|
|
41
|
+
export type { ProjectSyncEntry, ProjectSyncCheckpoint, ProjectSyncRequest, ProjectSyncOperation, ProjectSyncConflict, ProjectSyncProgress, ProjectSyncPreview, ProjectSyncPreviewRequest, ProjectSyncIgnoredPath } from "./project-sync.js";
|
|
42
42
|
export type { ProjectRequest, ProjectAuth, ProjectOperation, ProjectRemoveRequest, GitConnection, GitAccessState, ProjectGitState, GitAction, GitIdentity, GitIdentityScope, GitIdentitySettings, GitIdentityUpdate, GitOperationRequest, GitOperation } from "./workspace.js";
|
|
43
43
|
export type { WorkspaceRecord, WorkspaceAgent, WorkspaceProject, WorkspaceChat, WorkspaceKind, WorkspaceInput, WorkspaceImport, WorkspaceSnapshot, ProjectIcon } from "./workspace.js";
|
|
44
44
|
export * from "./surfaces.js";
|
package/dist/index.js
CHANGED
|
@@ -436,6 +436,18 @@ var ProjectSyncError = class extends MindwireError {
|
|
|
436
436
|
};
|
|
437
437
|
var active = (o) => ["queued", "exporting", "preparing", "applying"].includes(o.status);
|
|
438
438
|
var prefix = "/workspace/sync";
|
|
439
|
+
var selectionPaths = (paths = []) => {
|
|
440
|
+
const sorted = [...new Set(paths.map((path) => path.replace(/\/$/, "")))].sort();
|
|
441
|
+
const selected = new Set(sorted);
|
|
442
|
+
return sorted.filter((path) => {
|
|
443
|
+
let parent = path;
|
|
444
|
+
while (parent.includes("/")) {
|
|
445
|
+
parent = parent.slice(0, parent.lastIndexOf("/"));
|
|
446
|
+
if (selected.has(parent)) return false;
|
|
447
|
+
}
|
|
448
|
+
return true;
|
|
449
|
+
});
|
|
450
|
+
};
|
|
439
451
|
function delay(ms, signal) {
|
|
440
452
|
signal?.throwIfAborted();
|
|
441
453
|
return new Promise((resolve, reject) => {
|
|
@@ -458,7 +470,16 @@ var ProjectSyncApi = class {
|
|
|
458
470
|
}
|
|
459
471
|
mw;
|
|
460
472
|
flights = /* @__PURE__ */ new Map();
|
|
461
|
-
|
|
473
|
+
async requireSelectionSupport() {
|
|
474
|
+
if (((await this.mw.health()).projectSyncVersion ?? 0) < 2)
|
|
475
|
+
throw new MindwireError("Update Mindwire on both workspaces to review and switch selected project files.");
|
|
476
|
+
}
|
|
477
|
+
async preview(request, options = {}) {
|
|
478
|
+
await this.requireSelectionSupport();
|
|
479
|
+
return this.mw.http.request("POST", `${prefix}/preview`, { body: request, ...options });
|
|
480
|
+
}
|
|
481
|
+
async export(request, options = {}) {
|
|
482
|
+
await this.requireSelectionSupport();
|
|
462
483
|
return this.mw.http.request("POST", `${prefix}/exports`, { body: request, ...options });
|
|
463
484
|
}
|
|
464
485
|
import(request, options = {}) {
|
|
@@ -543,6 +564,7 @@ var ProjectSyncApi = class {
|
|
|
543
564
|
* throws ProjectSyncError carrying the complete conflict/recovery operation.
|
|
544
565
|
*/
|
|
545
566
|
switchTo(target, request, options = {}) {
|
|
567
|
+
request = { ...request, includeIgnored: selectionPaths(request.includeIgnored) };
|
|
546
568
|
const intent = JSON.stringify(request);
|
|
547
569
|
const old = this.flights.get(request.id);
|
|
548
570
|
if (old) {
|
|
@@ -558,7 +580,8 @@ var ProjectSyncApi = class {
|
|
|
558
580
|
if (!(error instanceof ApiError) || error.status !== 404) throw error;
|
|
559
581
|
}
|
|
560
582
|
if (accepted) {
|
|
561
|
-
if ((accepted.path ?? "") !== (request.path ?? "")
|
|
583
|
+
if ((accepted.path ?? "") !== (request.path ?? "") || (accepted.selectionToken ?? "") !== (request.selectionToken ?? "") || JSON.stringify(selectionPaths(accepted.includeIgnored)) !== JSON.stringify(request.includeIgnored))
|
|
584
|
+
throw new MindwireError("This sync ID belongs to a different destination folder or file selection.");
|
|
562
585
|
const operation = await target.wait(accepted.id, {
|
|
563
586
|
signal: options.signal,
|
|
564
587
|
onUpdate: (operation2) => options.onProgress?.({ phase: "apply", transferredBytes: 0, operation: operation2 })
|
|
@@ -567,11 +590,11 @@ var ProjectSyncApi = class {
|
|
|
567
590
|
return operation;
|
|
568
591
|
}
|
|
569
592
|
const health = await Promise.all([this.mw.health(), target.mw.health()]);
|
|
570
|
-
if (health.some((h) => (h.projectSyncVersion ?? 0) <
|
|
593
|
+
if (health.some((h) => (h.projectSyncVersion ?? 0) < 2)) throw new MindwireError("Update Mindwire on both workspaces to review and switch selected project files.");
|
|
571
594
|
let bytes = 0;
|
|
572
595
|
const emit2 = (phase, operation) => options.onProgress?.({ phase, transferredBytes: bytes, operation });
|
|
573
596
|
emit2("checkpoint");
|
|
574
|
-
let o = await this.export({ id: `${request.id}-export`, projectId: request.projectId }, options);
|
|
597
|
+
let o = await this.export({ id: `${request.id}-export`, projectId: request.projectId, includeIgnored: request.includeIgnored, selectionToken: request.selectionToken }, options);
|
|
575
598
|
o = await this.wait(o.id, { signal: options.signal, onUpdate: (value) => emit2("checkpoint", value) });
|
|
576
599
|
if (o.status !== "succeeded" || !o.resultCheckpointId) throw new ProjectSyncError(o);
|
|
577
600
|
emit2("transfer");
|
|
@@ -579,7 +602,7 @@ var ProjectSyncApi = class {
|
|
|
579
602
|
bytes += n;
|
|
580
603
|
emit2("transfer");
|
|
581
604
|
} });
|
|
582
|
-
o = await target.import({ id: `${request.id}-import`, checkpointId: o.resultCheckpointId, path: request.path }, options);
|
|
605
|
+
o = await target.import({ id: `${request.id}-import`, checkpointId: o.resultCheckpointId, path: request.path, includeIgnored: request.includeIgnored, selectionToken: request.selectionToken }, options);
|
|
583
606
|
o = await target.wait(o.id, { signal: options.signal, onUpdate: (value) => emit2("apply", value) });
|
|
584
607
|
if (o.status !== "succeeded") throw new ProjectSyncError(o);
|
|
585
608
|
return o;
|
|
@@ -816,6 +839,17 @@ var SurfacesApi = class {
|
|
|
816
839
|
bind(binding) {
|
|
817
840
|
return this.mw.http.request("PUT", "/surfaces/desktop/binding", { body: binding });
|
|
818
841
|
}
|
|
842
|
+
localStatus() {
|
|
843
|
+
return this.mw.http.request("GET", "/surfaces/desktop/local");
|
|
844
|
+
}
|
|
845
|
+
/** Local CLI only. The separate 0600 control credential is not part of phone pairing. */
|
|
846
|
+
configureLocal(settings, localControlToken) {
|
|
847
|
+
if (!localControlToken) throw new Error("Run mindwire desktop on your Mac to manage desktop access.");
|
|
848
|
+
return this.mw.http.request("PUT", "/surfaces/desktop/local", {
|
|
849
|
+
body: settings,
|
|
850
|
+
headers: { "X-Mindwire-Local-Control": localControlToken }
|
|
851
|
+
});
|
|
852
|
+
}
|
|
819
853
|
open(request) {
|
|
820
854
|
return this.mw.http.request("POST", "/surfaces/desktop/sessions", { body: request });
|
|
821
855
|
}
|
|
@@ -1030,7 +1064,7 @@ function computerPairingURI(invitation) {
|
|
|
1030
1064
|
}
|
|
1031
1065
|
|
|
1032
1066
|
// src/version.ts
|
|
1033
|
-
var SDK_VERSION = "0.1.
|
|
1067
|
+
var SDK_VERSION = "0.1.41" ;
|
|
1034
1068
|
function versionAtLeast(actual, desired) {
|
|
1035
1069
|
if (actual === desired) return true;
|
|
1036
1070
|
if (!actual || !/^\d+\.\d+\.\d+$/.test(actual) || !/^\d+\.\d+\.\d+$/.test(desired)) return false;
|
|
@@ -1081,7 +1115,7 @@ async function ensureDaemonBinary(opts = {}) {
|
|
|
1081
1115
|
if (!request) throw new MindwireError("mindwire: fetch is unavailable; set daemonBin or MINDWIRE_DAEMON");
|
|
1082
1116
|
const [checksums, binary] = await Promise.all([request(`${release}/checksums.txt`), request(`${release}/${asset}`)]);
|
|
1083
1117
|
if (!checksums.ok || !binary.ok) {
|
|
1084
|
-
if (!opts.releaseBaseUrl && !proc.process?.env?.MINDWIRE_RELEASE_BASE_URL) {
|
|
1118
|
+
if (!opts.exactVersion && !opts.releaseBaseUrl && !proc.process?.env?.MINDWIRE_RELEASE_BASE_URL) {
|
|
1085
1119
|
const latest = await request("https://api.github.com/repos/oblien/mindwire/releases/latest");
|
|
1086
1120
|
if (latest.ok) {
|
|
1087
1121
|
const tag = (await latest.json()).tag_name;
|