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.cjs
CHANGED
|
@@ -471,8 +471,8 @@ var Run = class _Run {
|
|
|
471
471
|
* Steer a follow-up message into the running turn without cancelling it. Requires the agent's
|
|
472
472
|
* `input` capability.
|
|
473
473
|
*/
|
|
474
|
-
async sendInput(text) {
|
|
475
|
-
await this.http.request("POST", `/runs/${encodeURIComponent(this.id)}/input`, { body: { text } });
|
|
474
|
+
async sendInput(text, options = {}) {
|
|
475
|
+
await this.http.request("POST", `/runs/${encodeURIComponent(this.id)}/input`, { body: { text, ...options } });
|
|
476
476
|
}
|
|
477
477
|
/**
|
|
478
478
|
* Soft-stop the running turn (ask the agent to halt current work) without the hard process kill
|
|
@@ -851,6 +851,12 @@ var WorkspaceApi = class {
|
|
|
851
851
|
snapshot(options = {}) {
|
|
852
852
|
return this.mw.http.request("GET", "/workspace", { query: options });
|
|
853
853
|
}
|
|
854
|
+
library() {
|
|
855
|
+
return this.mw.http.request("GET", "/workspace/project-library");
|
|
856
|
+
}
|
|
857
|
+
editLibrary(edit) {
|
|
858
|
+
return this.mw.http.request("PATCH", "/workspace/project-library", { body: edit });
|
|
859
|
+
}
|
|
854
860
|
/** Read the saved icon, or preview a candidate relative path within the project. Requires projectIconsVersion >= 1. */
|
|
855
861
|
projectIcon(projectId, path) {
|
|
856
862
|
return this.mw.http.request("GET", `/workspace/projects/${encodeURIComponent(projectId)}/icon`, { query: { path } });
|
|
@@ -956,18 +962,61 @@ var GitAccessApi = class {
|
|
|
956
962
|
};
|
|
957
963
|
|
|
958
964
|
// src/surfaces.ts
|
|
959
|
-
|
|
960
|
-
|
|
965
|
+
function savedDesktopID(id) {
|
|
966
|
+
if (!/^(console|ds_[a-f0-9]{16})$/.test(id)) throw new Error("Invalid saved desktop ID.");
|
|
967
|
+
return id;
|
|
968
|
+
}
|
|
969
|
+
var SurfacesApi = class _SurfacesApi {
|
|
970
|
+
constructor(mw, desktopId) {
|
|
961
971
|
this.mw = mw;
|
|
972
|
+
this.desktopId = desktopId;
|
|
962
973
|
}
|
|
963
974
|
mw;
|
|
975
|
+
desktopId;
|
|
976
|
+
/** Select a saved display for status, events, captures and input receipts. */
|
|
977
|
+
desktop(id) {
|
|
978
|
+
return new _SurfacesApi(this.mw, savedDesktopID(id));
|
|
979
|
+
}
|
|
980
|
+
scoped(path) {
|
|
981
|
+
return this.desktopId ? `${path}?desktopId=${encodeURIComponent(this.desktopId)}` : path;
|
|
982
|
+
}
|
|
983
|
+
bindRuntime(binding) {
|
|
984
|
+
return this.mw.http.request("PUT", "/surfaces/desktop/runtime", { body: binding });
|
|
985
|
+
}
|
|
986
|
+
listDesktops(projectId) {
|
|
987
|
+
return this.mw.http.request("GET", "/surfaces/desktop/catalog", { query: { projectId } });
|
|
988
|
+
}
|
|
989
|
+
createDesktop(request) {
|
|
990
|
+
return this.mw.http.request("POST", "/surfaces/desktop/catalog", { body: request });
|
|
991
|
+
}
|
|
992
|
+
ensureProjectDesktop(projectId) {
|
|
993
|
+
return this.mw.http.request("POST", `/surfaces/desktop/projects/${encodeURIComponent(projectId)}/ensure`);
|
|
994
|
+
}
|
|
995
|
+
getDesktop(id) {
|
|
996
|
+
return this.mw.http.request("GET", `/surfaces/desktop/catalog/${savedDesktopID(id)}`);
|
|
997
|
+
}
|
|
998
|
+
updateDesktop(id, request) {
|
|
999
|
+
return this.mw.http.request("PATCH", `/surfaces/desktop/catalog/${savedDesktopID(id)}`, { body: request });
|
|
1000
|
+
}
|
|
1001
|
+
startDesktop(id) {
|
|
1002
|
+
return this.mw.http.request("POST", `/surfaces/desktop/catalog/${savedDesktopID(id)}/start`);
|
|
1003
|
+
}
|
|
1004
|
+
/** Stops this desktop's apps; keeps its profile and files. */
|
|
1005
|
+
stopDesktop(id) {
|
|
1006
|
+
return this.mw.http.request("POST", `/surfaces/desktop/catalog/${savedDesktopID(id)}/stop`);
|
|
1007
|
+
}
|
|
1008
|
+
/** Deletes the desktop's private profile. Closing a viewer uses close(), never this method. */
|
|
1009
|
+
deleteDesktop(id) {
|
|
1010
|
+
return this.mw.http.request("DELETE", `/surfaces/desktop/catalog/${savedDesktopID(id)}`);
|
|
1011
|
+
}
|
|
964
1012
|
list() {
|
|
965
1013
|
return this.mw.http.request("GET", "/surfaces");
|
|
966
1014
|
}
|
|
967
1015
|
status(refresh = false) {
|
|
968
|
-
return this.mw.http.request("GET", "/surfaces/desktop", { query: { refresh } });
|
|
1016
|
+
return this.mw.http.request("GET", this.scoped("/surfaces/desktop"), { query: { refresh } });
|
|
969
1017
|
}
|
|
970
1018
|
bind(binding) {
|
|
1019
|
+
if (this.desktopId && binding.desktopId !== this.desktopId) throw new Error("The desktop grant belongs to another saved desktop.");
|
|
971
1020
|
return this.mw.http.request("PUT", "/surfaces/desktop/binding", { body: binding });
|
|
972
1021
|
}
|
|
973
1022
|
localStatus() {
|
|
@@ -982,22 +1031,23 @@ var SurfacesApi = class {
|
|
|
982
1031
|
});
|
|
983
1032
|
}
|
|
984
1033
|
open(request) {
|
|
985
|
-
|
|
1034
|
+
if (this.desktopId && request.desktopId && request.desktopId !== this.desktopId) throw new Error("Select the matching saved desktop.");
|
|
1035
|
+
return this.mw.http.request("POST", this.scoped("/surfaces/desktop/sessions"), { body: request });
|
|
986
1036
|
}
|
|
987
1037
|
control(id, request) {
|
|
988
|
-
return this.mw.http.request("POST", `/surfaces/desktop/sessions/${encodeURIComponent(id)}/control
|
|
1038
|
+
return this.mw.http.request("POST", this.scoped(`/surfaces/desktop/sessions/${encodeURIComponent(id)}/control`), { body: request });
|
|
989
1039
|
}
|
|
990
1040
|
close(id) {
|
|
991
|
-
return this.mw.http.request("DELETE", `/surfaces/desktop/sessions/${encodeURIComponent(id)}`);
|
|
1041
|
+
return this.mw.http.request("DELETE", this.scoped(`/surfaces/desktop/sessions/${encodeURIComponent(id)}`));
|
|
992
1042
|
}
|
|
993
1043
|
capture(id) {
|
|
994
|
-
return this.mw.http.request("POST", `/surfaces/desktop/sessions/${encodeURIComponent(id)}/captures`);
|
|
1044
|
+
return this.mw.http.request("POST", this.scoped(`/surfaces/desktop/sessions/${encodeURIComponent(id)}/captures`));
|
|
995
1045
|
}
|
|
996
1046
|
action(request) {
|
|
997
|
-
return this.mw.http.request("POST", "/surfaces/desktop/actions", { body: request });
|
|
1047
|
+
return this.mw.http.request("POST", this.scoped("/surfaces/desktop/actions"), { body: request });
|
|
998
1048
|
}
|
|
999
1049
|
receipt(id) {
|
|
1000
|
-
return this.mw.http.request("GET", `/surfaces/desktop/actions/${encodeURIComponent(id)}`);
|
|
1050
|
+
return this.mw.http.request("GET", this.scoped(`/surfaces/desktop/actions/${encodeURIComponent(id)}`));
|
|
1001
1051
|
}
|
|
1002
1052
|
artifact(id) {
|
|
1003
1053
|
return this.mw.http.request("GET", `/artifacts/${encodeURIComponent(id)}`);
|
|
@@ -1009,7 +1059,7 @@ var SurfacesApi = class {
|
|
|
1009
1059
|
opts.signal?.addEventListener("abort", abort, { once: true });
|
|
1010
1060
|
if (opts.signal?.aborted) controller.abort();
|
|
1011
1061
|
try {
|
|
1012
|
-
const response = await this.mw.http.open("GET", "/surfaces/desktop/events", { signal: controller.signal });
|
|
1062
|
+
const response = await this.mw.http.open("GET", this.scoped("/surfaces/desktop/events"), { signal: controller.signal });
|
|
1013
1063
|
let instance;
|
|
1014
1064
|
let revision = -1;
|
|
1015
1065
|
for await (const snapshot of readSSE(response.body, controller.signal)) {
|
|
@@ -1194,6 +1244,9 @@ function computerPairingURI(invitation) {
|
|
|
1194
1244
|
return `mindwire://${action}?v=1#${encoded}`;
|
|
1195
1245
|
}
|
|
1196
1246
|
|
|
1247
|
+
// src/client.ts
|
|
1248
|
+
init_binary_cache();
|
|
1249
|
+
|
|
1197
1250
|
// src/embedded.ts
|
|
1198
1251
|
init_errors();
|
|
1199
1252
|
|
|
@@ -1201,7 +1254,7 @@ init_errors();
|
|
|
1201
1254
|
init_errors();
|
|
1202
1255
|
|
|
1203
1256
|
// src/version.ts
|
|
1204
|
-
var SDK_VERSION = "0.1.
|
|
1257
|
+
var SDK_VERSION = "0.1.44" ;
|
|
1205
1258
|
function versionAtLeast(actual, desired) {
|
|
1206
1259
|
if (actual === desired) return true;
|
|
1207
1260
|
if (!actual || !/^\d+\.\d+\.\d+$/.test(actual) || !/^\d+\.\d+\.\d+$/.test(desired)) return false;
|
|
@@ -1630,6 +1683,45 @@ var Mindwire = class _Mindwire {
|
|
|
1630
1683
|
body: { title }
|
|
1631
1684
|
});
|
|
1632
1685
|
}
|
|
1686
|
+
/** Resumable upload over the same connection as chat. Retrying an identical chunk is safe. */
|
|
1687
|
+
uploadAttachmentChunk(chatId, id, chunk, signal) {
|
|
1688
|
+
return this.http.request("PUT", `/chats/${encodeURIComponent(chatId)}/attachments/${encodeURIComponent(id)}`, { body: chunk, signal });
|
|
1689
|
+
}
|
|
1690
|
+
/** Store a file with its conversation, then pass the returned reference in turn options. */
|
|
1691
|
+
async uploadAttachment(chatId, file, options = {}) {
|
|
1692
|
+
if (file.data.byteLength > 16 * 1024 * 1024) throw new RangeError("Attachments must be at most 16 MiB");
|
|
1693
|
+
const data = new Uint8Array(file.data);
|
|
1694
|
+
const hash = async (bytes) => {
|
|
1695
|
+
if (!globalThis.crypto?.subtle) return executableChecksum(bytes);
|
|
1696
|
+
const digest = new Uint8Array(await globalThis.crypto.subtle.digest("SHA-256", bytes));
|
|
1697
|
+
return Array.from(digest, (b) => b.toString(16).padStart(2, "0")).join("");
|
|
1698
|
+
};
|
|
1699
|
+
const sha256 = await hash(data);
|
|
1700
|
+
const id = (await hash(new TextEncoder().encode(`${chatId}\0${file.name}\0${sha256}`))).slice(0, 32);
|
|
1701
|
+
let offset = 0;
|
|
1702
|
+
for (; ; ) {
|
|
1703
|
+
options.signal?.throwIfAborted();
|
|
1704
|
+
const end = Math.min(data.length, offset + 384 * 1024);
|
|
1705
|
+
let binary = "";
|
|
1706
|
+
for (let start = offset; start < end; start += 16384) {
|
|
1707
|
+
binary += String.fromCharCode(...data.subarray(start, Math.min(end, start + 16384)));
|
|
1708
|
+
}
|
|
1709
|
+
const state = await this.uploadAttachmentChunk(chatId, id, {
|
|
1710
|
+
name: file.name,
|
|
1711
|
+
mime: file.mime ?? "application/octet-stream",
|
|
1712
|
+
bytes: data.length,
|
|
1713
|
+
sha256,
|
|
1714
|
+
offset,
|
|
1715
|
+
data: btoa(binary)
|
|
1716
|
+
}, options.signal);
|
|
1717
|
+
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) {
|
|
1718
|
+
throw new Error("Invalid attachment upload acknowledgement");
|
|
1719
|
+
}
|
|
1720
|
+
options.onProgress?.(data.length === 0 ? 1 : state.offset / data.length);
|
|
1721
|
+
if (state.complete) return { artifactId: id, name: state.name, mime: state.mime, bytes: state.bytes };
|
|
1722
|
+
offset = state.offset;
|
|
1723
|
+
}
|
|
1724
|
+
}
|
|
1633
1725
|
/**
|
|
1634
1726
|
* `DELETE /chats/{id}` — a true, irreversible delete: purges ALL of the chat's mindwire
|
|
1635
1727
|
* bookkeeping and, for every session the chat mapped to, removes that agent's native transcript
|
|
@@ -1711,6 +1803,7 @@ var Mindwire = class _Mindwire {
|
|
|
1711
1803
|
message: input.message
|
|
1712
1804
|
};
|
|
1713
1805
|
if (input.requestId !== void 0) body.requestId = input.requestId;
|
|
1806
|
+
if (input.queueIfRunning !== void 0) body.queueIfRunning = input.queueIfRunning;
|
|
1714
1807
|
if (input.cwd !== void 0) body.cwd = input.cwd;
|
|
1715
1808
|
if (input.options !== void 0) body.options = input.options;
|
|
1716
1809
|
if (input.mode !== void 0) body.mode = input.mode;
|