mindwire 0.1.42 → 0.1.44
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/{chunk-5O6QCNZW.js → chunk-4T66LLES.js} +3 -3
- package/dist/{chunk-5O6QCNZW.js.map → chunk-4T66LLES.js.map} +1 -1
- package/dist/{chunk-YQSLQWPI.js → chunk-CSX2ZLIV.js} +108 -18
- package/dist/chunk-CSX2ZLIV.js.map +1 -0
- package/dist/cli.js +2 -2
- package/dist/client.d.ts +14 -1
- package/dist/{connection-change-LZ6MT6Q6.js → connection-change-KVOVAVF4.js} +3 -3
- package/dist/{connection-change-LZ6MT6Q6.js.map → connection-change-KVOVAVF4.js.map} +1 -1
- package/dist/{controller-UYJ7F2IU.js → controller-3KH6CUOC.js} +4 -4
- package/dist/{controller-UYJ7F2IU.js.map → controller-3KH6CUOC.js.map} +1 -1
- package/dist/{controller-handoff-YNHM2W52.js → controller-handoff-OWJJEC2H.js} +3 -3
- package/dist/{controller-handoff-YNHM2W52.js.map → controller-handoff-OWJJEC2H.js.map} +1 -1
- package/dist/index.cjs +106 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +106 -16
- package/dist/index.js.map +1 -1
- package/dist/run.d.ts +5 -2
- package/dist/surfaces.d.ts +95 -3
- package/dist/types.d.ts +44 -2
- package/dist/workspace.d.ts +30 -0
- package/package.json +1 -1
- package/dist/binary-cache-ZTEYICUF.js +0 -51
- package/dist/binary-cache-ZTEYICUF.js.map +0 -1
- package/dist/chunk-T6TD76UA.js +0 -57
- package/dist/chunk-T6TD76UA.js.map +0 -1
- package/dist/chunk-YQSLQWPI.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -40,7 +40,7 @@ export type { Conversation, ConversationQuery, ConversationPage, ConversationOpe
|
|
|
40
40
|
export { ProjectSyncApi, ProjectSyncError } from "./project-sync.js";
|
|
41
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
|
-
export type { WorkspaceRecord, WorkspaceAgent, WorkspaceProject, WorkspaceChat, WorkspaceKind, WorkspaceInput, WorkspaceImport, WorkspaceSnapshot, ProjectIcon } from "./workspace.js";
|
|
43
|
+
export type { WorkspaceRecord, WorkspaceAgent, WorkspaceProject, WorkspaceChat, WorkspaceKind, WorkspaceInput, WorkspaceImport, WorkspaceSnapshot, ProjectIcon, ProjectFolder, ProjectLibrary, ProjectLibraryEdit } from "./workspace.js";
|
|
44
44
|
export * from "./surfaces.js";
|
|
45
45
|
export * from "./execution.js";
|
|
46
46
|
export * from "./computer.js";
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { MindwireError, TimeoutError, ApiError, RunFailedError } from './chunk-
|
|
2
|
-
export { ApiError, MindwireError, RunFailedError, TimeoutError } from './chunk-
|
|
1
|
+
import { MindwireError, TimeoutError, ApiError, RunFailedError, executableChecksum } from './chunk-PFYKJ6LX.js';
|
|
2
|
+
export { ApiError, MindwireError, RunFailedError, TimeoutError } from './chunk-PFYKJ6LX.js';
|
|
3
3
|
|
|
4
4
|
// src/http.ts
|
|
5
5
|
var DEFAULT_TIMEOUT_MS = 12e4;
|
|
@@ -341,8 +341,8 @@ var Run = class _Run {
|
|
|
341
341
|
* Steer a follow-up message into the running turn without cancelling it. Requires the agent's
|
|
342
342
|
* `input` capability.
|
|
343
343
|
*/
|
|
344
|
-
async sendInput(text) {
|
|
345
|
-
await this.http.request("POST", `/runs/${encodeURIComponent(this.id)}/input`, { body: { text } });
|
|
344
|
+
async sendInput(text, options = {}) {
|
|
345
|
+
await this.http.request("POST", `/runs/${encodeURIComponent(this.id)}/input`, { body: { text, ...options } });
|
|
346
346
|
}
|
|
347
347
|
/**
|
|
348
348
|
* Soft-stop the running turn (ask the agent to halt current work) without the hard process kill
|
|
@@ -720,6 +720,12 @@ var WorkspaceApi = class {
|
|
|
720
720
|
snapshot(options = {}) {
|
|
721
721
|
return this.mw.http.request("GET", "/workspace", { query: options });
|
|
722
722
|
}
|
|
723
|
+
library() {
|
|
724
|
+
return this.mw.http.request("GET", "/workspace/project-library");
|
|
725
|
+
}
|
|
726
|
+
editLibrary(edit) {
|
|
727
|
+
return this.mw.http.request("PATCH", "/workspace/project-library", { body: edit });
|
|
728
|
+
}
|
|
723
729
|
/** Read the saved icon, or preview a candidate relative path within the project. Requires projectIconsVersion >= 1. */
|
|
724
730
|
projectIcon(projectId, path) {
|
|
725
731
|
return this.mw.http.request("GET", `/workspace/projects/${encodeURIComponent(projectId)}/icon`, { query: { path } });
|
|
@@ -825,18 +831,61 @@ var GitAccessApi = class {
|
|
|
825
831
|
};
|
|
826
832
|
|
|
827
833
|
// src/surfaces.ts
|
|
828
|
-
|
|
829
|
-
|
|
834
|
+
function savedDesktopID(id) {
|
|
835
|
+
if (!/^(console|ds_[a-f0-9]{16})$/.test(id)) throw new Error("Invalid saved desktop ID.");
|
|
836
|
+
return id;
|
|
837
|
+
}
|
|
838
|
+
var SurfacesApi = class _SurfacesApi {
|
|
839
|
+
constructor(mw, desktopId) {
|
|
830
840
|
this.mw = mw;
|
|
841
|
+
this.desktopId = desktopId;
|
|
831
842
|
}
|
|
832
843
|
mw;
|
|
844
|
+
desktopId;
|
|
845
|
+
/** Select a saved display for status, events, captures and input receipts. */
|
|
846
|
+
desktop(id) {
|
|
847
|
+
return new _SurfacesApi(this.mw, savedDesktopID(id));
|
|
848
|
+
}
|
|
849
|
+
scoped(path) {
|
|
850
|
+
return this.desktopId ? `${path}?desktopId=${encodeURIComponent(this.desktopId)}` : path;
|
|
851
|
+
}
|
|
852
|
+
bindRuntime(binding) {
|
|
853
|
+
return this.mw.http.request("PUT", "/surfaces/desktop/runtime", { body: binding });
|
|
854
|
+
}
|
|
855
|
+
listDesktops(projectId) {
|
|
856
|
+
return this.mw.http.request("GET", "/surfaces/desktop/catalog", { query: { projectId } });
|
|
857
|
+
}
|
|
858
|
+
createDesktop(request) {
|
|
859
|
+
return this.mw.http.request("POST", "/surfaces/desktop/catalog", { body: request });
|
|
860
|
+
}
|
|
861
|
+
ensureProjectDesktop(projectId) {
|
|
862
|
+
return this.mw.http.request("POST", `/surfaces/desktop/projects/${encodeURIComponent(projectId)}/ensure`);
|
|
863
|
+
}
|
|
864
|
+
getDesktop(id) {
|
|
865
|
+
return this.mw.http.request("GET", `/surfaces/desktop/catalog/${savedDesktopID(id)}`);
|
|
866
|
+
}
|
|
867
|
+
updateDesktop(id, request) {
|
|
868
|
+
return this.mw.http.request("PATCH", `/surfaces/desktop/catalog/${savedDesktopID(id)}`, { body: request });
|
|
869
|
+
}
|
|
870
|
+
startDesktop(id) {
|
|
871
|
+
return this.mw.http.request("POST", `/surfaces/desktop/catalog/${savedDesktopID(id)}/start`);
|
|
872
|
+
}
|
|
873
|
+
/** Stops this desktop's apps; keeps its profile and files. */
|
|
874
|
+
stopDesktop(id) {
|
|
875
|
+
return this.mw.http.request("POST", `/surfaces/desktop/catalog/${savedDesktopID(id)}/stop`);
|
|
876
|
+
}
|
|
877
|
+
/** Deletes the desktop's private profile. Closing a viewer uses close(), never this method. */
|
|
878
|
+
deleteDesktop(id) {
|
|
879
|
+
return this.mw.http.request("DELETE", `/surfaces/desktop/catalog/${savedDesktopID(id)}`);
|
|
880
|
+
}
|
|
833
881
|
list() {
|
|
834
882
|
return this.mw.http.request("GET", "/surfaces");
|
|
835
883
|
}
|
|
836
884
|
status(refresh = false) {
|
|
837
|
-
return this.mw.http.request("GET", "/surfaces/desktop", { query: { refresh } });
|
|
885
|
+
return this.mw.http.request("GET", this.scoped("/surfaces/desktop"), { query: { refresh } });
|
|
838
886
|
}
|
|
839
887
|
bind(binding) {
|
|
888
|
+
if (this.desktopId && binding.desktopId !== this.desktopId) throw new Error("The desktop grant belongs to another saved desktop.");
|
|
840
889
|
return this.mw.http.request("PUT", "/surfaces/desktop/binding", { body: binding });
|
|
841
890
|
}
|
|
842
891
|
localStatus() {
|
|
@@ -851,22 +900,23 @@ var SurfacesApi = class {
|
|
|
851
900
|
});
|
|
852
901
|
}
|
|
853
902
|
open(request) {
|
|
854
|
-
|
|
903
|
+
if (this.desktopId && request.desktopId && request.desktopId !== this.desktopId) throw new Error("Select the matching saved desktop.");
|
|
904
|
+
return this.mw.http.request("POST", this.scoped("/surfaces/desktop/sessions"), { body: request });
|
|
855
905
|
}
|
|
856
906
|
control(id, request) {
|
|
857
|
-
return this.mw.http.request("POST", `/surfaces/desktop/sessions/${encodeURIComponent(id)}/control
|
|
907
|
+
return this.mw.http.request("POST", this.scoped(`/surfaces/desktop/sessions/${encodeURIComponent(id)}/control`), { body: request });
|
|
858
908
|
}
|
|
859
909
|
close(id) {
|
|
860
|
-
return this.mw.http.request("DELETE", `/surfaces/desktop/sessions/${encodeURIComponent(id)}`);
|
|
910
|
+
return this.mw.http.request("DELETE", this.scoped(`/surfaces/desktop/sessions/${encodeURIComponent(id)}`));
|
|
861
911
|
}
|
|
862
912
|
capture(id) {
|
|
863
|
-
return this.mw.http.request("POST", `/surfaces/desktop/sessions/${encodeURIComponent(id)}/captures`);
|
|
913
|
+
return this.mw.http.request("POST", this.scoped(`/surfaces/desktop/sessions/${encodeURIComponent(id)}/captures`));
|
|
864
914
|
}
|
|
865
915
|
action(request) {
|
|
866
|
-
return this.mw.http.request("POST", "/surfaces/desktop/actions", { body: request });
|
|
916
|
+
return this.mw.http.request("POST", this.scoped("/surfaces/desktop/actions"), { body: request });
|
|
867
917
|
}
|
|
868
918
|
receipt(id) {
|
|
869
|
-
return this.mw.http.request("GET", `/surfaces/desktop/actions/${encodeURIComponent(id)}`);
|
|
919
|
+
return this.mw.http.request("GET", this.scoped(`/surfaces/desktop/actions/${encodeURIComponent(id)}`));
|
|
870
920
|
}
|
|
871
921
|
artifact(id) {
|
|
872
922
|
return this.mw.http.request("GET", `/artifacts/${encodeURIComponent(id)}`);
|
|
@@ -878,7 +928,7 @@ var SurfacesApi = class {
|
|
|
878
928
|
opts.signal?.addEventListener("abort", abort, { once: true });
|
|
879
929
|
if (opts.signal?.aborted) controller.abort();
|
|
880
930
|
try {
|
|
881
|
-
const response = await this.mw.http.open("GET", "/surfaces/desktop/events", { signal: controller.signal });
|
|
931
|
+
const response = await this.mw.http.open("GET", this.scoped("/surfaces/desktop/events"), { signal: controller.signal });
|
|
882
932
|
let instance;
|
|
883
933
|
let revision = -1;
|
|
884
934
|
for await (const snapshot of readSSE(response.body, controller.signal)) {
|
|
@@ -1064,7 +1114,7 @@ function computerPairingURI(invitation) {
|
|
|
1064
1114
|
}
|
|
1065
1115
|
|
|
1066
1116
|
// src/version.ts
|
|
1067
|
-
var SDK_VERSION = "0.1.
|
|
1117
|
+
var SDK_VERSION = "0.1.44" ;
|
|
1068
1118
|
function versionAtLeast(actual, desired) {
|
|
1069
1119
|
if (actual === desired) return true;
|
|
1070
1120
|
if (!actual || !/^\d+\.\d+\.\d+$/.test(actual) || !/^\d+\.\d+\.\d+$/.test(desired)) return false;
|
|
@@ -1103,7 +1153,7 @@ async function ensureDaemonBinary(opts = {}) {
|
|
|
1103
1153
|
throw new MindwireError(`mindwire: cannot download daemon for non-release SDK version ${version}`);
|
|
1104
1154
|
}
|
|
1105
1155
|
const path = await import('path');
|
|
1106
|
-
const { binaryCacheDirectory, cachedExecutable, cacheExecutable } = await import('./binary-cache-
|
|
1156
|
+
const { binaryCacheDirectory, cachedExecutable, cacheExecutable } = await import('./binary-cache-CG52TXCZ.js');
|
|
1107
1157
|
const dir = path.join(opts.cacheDir ?? await binaryCacheDirectory(daemonPlatform), version, `${daemonPlatform}-${daemonArch}`);
|
|
1108
1158
|
const asset = assetName(version, daemonPlatform, daemonArch);
|
|
1109
1159
|
const bin = path.join(dir, asset);
|
|
@@ -1493,6 +1543,45 @@ var Mindwire = class _Mindwire {
|
|
|
1493
1543
|
body: { title }
|
|
1494
1544
|
});
|
|
1495
1545
|
}
|
|
1546
|
+
/** Resumable upload over the same connection as chat. Retrying an identical chunk is safe. */
|
|
1547
|
+
uploadAttachmentChunk(chatId, id, chunk, signal) {
|
|
1548
|
+
return this.http.request("PUT", `/chats/${encodeURIComponent(chatId)}/attachments/${encodeURIComponent(id)}`, { body: chunk, signal });
|
|
1549
|
+
}
|
|
1550
|
+
/** Store a file with its conversation, then pass the returned reference in turn options. */
|
|
1551
|
+
async uploadAttachment(chatId, file, options = {}) {
|
|
1552
|
+
if (file.data.byteLength > 16 * 1024 * 1024) throw new RangeError("Attachments must be at most 16 MiB");
|
|
1553
|
+
const data = new Uint8Array(file.data);
|
|
1554
|
+
const hash = async (bytes) => {
|
|
1555
|
+
if (!globalThis.crypto?.subtle) return executableChecksum(bytes);
|
|
1556
|
+
const digest = new Uint8Array(await globalThis.crypto.subtle.digest("SHA-256", bytes));
|
|
1557
|
+
return Array.from(digest, (b) => b.toString(16).padStart(2, "0")).join("");
|
|
1558
|
+
};
|
|
1559
|
+
const sha256 = await hash(data);
|
|
1560
|
+
const id = (await hash(new TextEncoder().encode(`${chatId}\0${file.name}\0${sha256}`))).slice(0, 32);
|
|
1561
|
+
let offset = 0;
|
|
1562
|
+
for (; ; ) {
|
|
1563
|
+
options.signal?.throwIfAborted();
|
|
1564
|
+
const end = Math.min(data.length, offset + 384 * 1024);
|
|
1565
|
+
let binary = "";
|
|
1566
|
+
for (let start = offset; start < end; start += 16384) {
|
|
1567
|
+
binary += String.fromCharCode(...data.subarray(start, Math.min(end, start + 16384)));
|
|
1568
|
+
}
|
|
1569
|
+
const state = await this.uploadAttachmentChunk(chatId, id, {
|
|
1570
|
+
name: file.name,
|
|
1571
|
+
mime: file.mime ?? "application/octet-stream",
|
|
1572
|
+
bytes: data.length,
|
|
1573
|
+
sha256,
|
|
1574
|
+
offset,
|
|
1575
|
+
data: btoa(binary)
|
|
1576
|
+
}, options.signal);
|
|
1577
|
+
if (state.id !== id || state.bytes !== data.length || state.offset < end || state.offset > data.length || state.complete && state.offset !== data.length || !state.complete && state.offset <= offset) {
|
|
1578
|
+
throw new Error("Invalid attachment upload acknowledgement");
|
|
1579
|
+
}
|
|
1580
|
+
options.onProgress?.(data.length === 0 ? 1 : state.offset / data.length);
|
|
1581
|
+
if (state.complete) return { artifactId: id, name: state.name, mime: state.mime, bytes: state.bytes };
|
|
1582
|
+
offset = state.offset;
|
|
1583
|
+
}
|
|
1584
|
+
}
|
|
1496
1585
|
/**
|
|
1497
1586
|
* `DELETE /chats/{id}` — a true, irreversible delete: purges ALL of the chat's mindwire
|
|
1498
1587
|
* bookkeeping and, for every session the chat mapped to, removes that agent's native transcript
|
|
@@ -1574,6 +1663,7 @@ var Mindwire = class _Mindwire {
|
|
|
1574
1663
|
message: input.message
|
|
1575
1664
|
};
|
|
1576
1665
|
if (input.requestId !== void 0) body.requestId = input.requestId;
|
|
1666
|
+
if (input.queueIfRunning !== void 0) body.queueIfRunning = input.queueIfRunning;
|
|
1577
1667
|
if (input.cwd !== void 0) body.cwd = input.cwd;
|
|
1578
1668
|
if (input.options !== void 0) body.options = input.options;
|
|
1579
1669
|
if (input.mode !== void 0) body.mode = input.mode;
|