mindwire 0.1.52 → 0.1.54
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 +97 -2
- package/dist/apps.d.ts +94 -0
- package/dist/bots.d.ts +168 -0
- package/dist/{chunk-4XL565EU.js → chunk-P3JTWITC.js} +190 -7
- package/dist/chunk-P3JTWITC.js.map +1 -0
- package/dist/{chunk-RTMQJIKW.js → chunk-ZNEFE6KD.js} +4 -10
- package/dist/chunk-ZNEFE6KD.js.map +1 -0
- package/dist/cli.js +21 -25
- package/dist/cli.js.map +1 -1
- package/dist/client.d.ts +12 -0
- package/dist/{connection-change-6E7QLJFC.js → connection-change-RVS6XWTC.js} +3 -3
- package/dist/{connection-change-6E7QLJFC.js.map → connection-change-RVS6XWTC.js.map} +1 -1
- package/dist/{controller-566LDBZD.js → controller-2WCEJ3F2.js} +4 -4
- package/dist/{controller-566LDBZD.js.map → controller-2WCEJ3F2.js.map} +1 -1
- package/dist/{controller-handoff-KNEQ5W6J.js → controller-handoff-7EOSPHSD.js} +3 -3
- package/dist/{controller-handoff-KNEQ5W6J.js.map → controller-handoff-7EOSPHSD.js.map} +1 -1
- package/dist/handoffs.d.ts +91 -0
- package/dist/index.cjs +209 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.js +200 -10
- package/dist/index.js.map +1 -1
- package/dist/integrations.d.ts +72 -0
- package/dist/target/docker.d.ts +9 -1
- package/dist/types.d.ts +21 -1
- package/dist/workspace.d.ts +14 -0
- package/package.json +10 -11
- package/dist/chunk-4XL565EU.js.map +0 -1
- package/dist/chunk-RTMQJIKW.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -3,8 +3,13 @@
|
|
|
3
3
|
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __esm = (fn, res) => function __init() {
|
|
7
|
-
|
|
6
|
+
var __esm = (fn, res, err) => function __init() {
|
|
7
|
+
if (err) throw err[0];
|
|
8
|
+
try {
|
|
9
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
10
|
+
} catch (e) {
|
|
11
|
+
throw err = [e], e;
|
|
12
|
+
}
|
|
8
13
|
};
|
|
9
14
|
var __export = (target, all) => {
|
|
10
15
|
for (var name in all)
|
|
@@ -865,6 +870,12 @@ var WorkspaceApi = class {
|
|
|
865
870
|
projectIcon(projectId, path) {
|
|
866
871
|
return this.mw.http.request("GET", `/workspace/projects/${encodeURIComponent(projectId)}/icon`, { query: { path } });
|
|
867
872
|
}
|
|
873
|
+
/** Upload a validated image (base64 content, at most 1 MB). Requires projectIconsVersion >= 2.
|
|
874
|
+
* Stores the image inside the project; set projects.put(..., { iconPath: result.path }) to select it.
|
|
875
|
+
*/
|
|
876
|
+
uploadProjectIcon(projectId, image) {
|
|
877
|
+
return this.mw.http.request("POST", `/workspace/projects/${encodeURIComponent(projectId)}/icon`, { body: image });
|
|
878
|
+
}
|
|
868
879
|
/** Start an operation owned by the daemon. The same ID/payload returns the existing operation. */
|
|
869
880
|
createProject(request) {
|
|
870
881
|
return this.mw.http.request("POST", "/workspace/projects", { body: request });
|
|
@@ -965,6 +976,160 @@ var GitAccessApi = class {
|
|
|
965
976
|
}
|
|
966
977
|
};
|
|
967
978
|
|
|
979
|
+
// src/bots.ts
|
|
980
|
+
var BotsApi = class {
|
|
981
|
+
constructor(mw) {
|
|
982
|
+
this.mw = mw;
|
|
983
|
+
}
|
|
984
|
+
mw;
|
|
985
|
+
list(options = {}) {
|
|
986
|
+
return this.mw.http.request("GET", "/bots", { query: { projectId: options.projectId, archived: options.archived ? "true" : void 0 } });
|
|
987
|
+
}
|
|
988
|
+
get(id) {
|
|
989
|
+
return this.mw.http.request("GET", `/bots/${encodeURIComponent(id)}`);
|
|
990
|
+
}
|
|
991
|
+
ensure(agentId, projectId) {
|
|
992
|
+
return this.mw.http.request("POST", "/bots/ensure", { body: { agentId, projectId } });
|
|
993
|
+
}
|
|
994
|
+
create(input) {
|
|
995
|
+
return this.mw.http.request("POST", "/bots", { body: input });
|
|
996
|
+
}
|
|
997
|
+
update(id, edit) {
|
|
998
|
+
return this.mw.http.request("PATCH", `/bots/${encodeURIComponent(id)}`, { body: edit });
|
|
999
|
+
}
|
|
1000
|
+
chats(id) {
|
|
1001
|
+
return this.mw.http.request("GET", `/bots/${encodeURIComponent(id)}/chats`);
|
|
1002
|
+
}
|
|
1003
|
+
createChat(id, input = {}) {
|
|
1004
|
+
return this.mw.http.request("POST", `/bots/${encodeURIComponent(id)}/chats`, { body: input });
|
|
1005
|
+
}
|
|
1006
|
+
agents() {
|
|
1007
|
+
return this.mw.http.request("GET", "/bots/agents");
|
|
1008
|
+
}
|
|
1009
|
+
tasks(id) {
|
|
1010
|
+
return this.mw.http.request("GET", `/bots/${encodeURIComponent(id)}/tasks`);
|
|
1011
|
+
}
|
|
1012
|
+
/** Keep requestId stable when retrying a task after a lost acknowledgement. */
|
|
1013
|
+
delegate(id, input) {
|
|
1014
|
+
return this.mw.http.request("POST", `/bots/${encodeURIComponent(id)}/tasks`, { body: input });
|
|
1015
|
+
}
|
|
1016
|
+
task(id, runId) {
|
|
1017
|
+
return this.mw.http.request("GET", this.taskPath(id, runId));
|
|
1018
|
+
}
|
|
1019
|
+
input(id, runId, input) {
|
|
1020
|
+
return this.mw.http.request("POST", `${this.taskPath(id, runId)}/input`, { body: input });
|
|
1021
|
+
}
|
|
1022
|
+
cancel(id, runId) {
|
|
1023
|
+
return this.mw.http.request("POST", `${this.taskPath(id, runId)}/cancel`);
|
|
1024
|
+
}
|
|
1025
|
+
peerIdentity() {
|
|
1026
|
+
return this.mw.http.request("GET", "/bots/peers/identity");
|
|
1027
|
+
}
|
|
1028
|
+
startPeerListener(port) {
|
|
1029
|
+
return this.mw.http.request("POST", "/bots/peers/listener", { body: { port } });
|
|
1030
|
+
}
|
|
1031
|
+
peers() {
|
|
1032
|
+
return this.mw.http.request("GET", "/bots/peers");
|
|
1033
|
+
}
|
|
1034
|
+
pair(workspaceId, input) {
|
|
1035
|
+
return this.mw.http.request("PUT", `/bots/peers/${encodeURIComponent(workspaceId)}`, { body: input });
|
|
1036
|
+
}
|
|
1037
|
+
revokePeer(workspaceId) {
|
|
1038
|
+
return this.mw.http.request("DELETE", `/bots/peers/${encodeURIComponent(workspaceId)}`);
|
|
1039
|
+
}
|
|
1040
|
+
/** Bounded peer handshake/discovery; does not start a bot task. */
|
|
1041
|
+
checkPeer(workspaceId) {
|
|
1042
|
+
return this.mw.http.request("POST", `/bots/peers/${encodeURIComponent(workspaceId)}/check`, { body: {} });
|
|
1043
|
+
}
|
|
1044
|
+
taskPath(id, runId) {
|
|
1045
|
+
return `/bots/${encodeURIComponent(id)}/tasks/${encodeURIComponent(runId)}`;
|
|
1046
|
+
}
|
|
1047
|
+
};
|
|
1048
|
+
|
|
1049
|
+
// src/apps.ts
|
|
1050
|
+
var AppsApi = class {
|
|
1051
|
+
constructor(mw) {
|
|
1052
|
+
this.mw = mw;
|
|
1053
|
+
}
|
|
1054
|
+
mw;
|
|
1055
|
+
list() {
|
|
1056
|
+
return this.mw.http.request("GET", "/apps");
|
|
1057
|
+
}
|
|
1058
|
+
get(id) {
|
|
1059
|
+
return this.mw.http.request("GET", `/apps/${encodeURIComponent(id)}`);
|
|
1060
|
+
}
|
|
1061
|
+
register(input) {
|
|
1062
|
+
return this.mw.http.request("POST", "/apps", { body: input });
|
|
1063
|
+
}
|
|
1064
|
+
update(id, input) {
|
|
1065
|
+
return this.mw.http.request("PATCH", `/apps/${encodeURIComponent(id)}`, { body: input });
|
|
1066
|
+
}
|
|
1067
|
+
/** Ensures readiness on the owning computer; the client opens the returned URL. */
|
|
1068
|
+
open(id) {
|
|
1069
|
+
return this.mw.http.request("POST", `/apps/${encodeURIComponent(id)}/open`, { body: {} });
|
|
1070
|
+
}
|
|
1071
|
+
/** Validates a plan for the owner's hosting adapter; does not deploy or charge. */
|
|
1072
|
+
preparePublication(id) {
|
|
1073
|
+
return this.mw.http.request("POST", `/apps/${encodeURIComponent(id)}/publication/prepare`, { body: {} });
|
|
1074
|
+
}
|
|
1075
|
+
channels() {
|
|
1076
|
+
return this.mw.http.request("GET", "/apps/channels");
|
|
1077
|
+
}
|
|
1078
|
+
notifications(id, options = {}) {
|
|
1079
|
+
return this.mw.http.request("POST", `/apps/${encodeURIComponent(id)}/notifications`, { body: options });
|
|
1080
|
+
}
|
|
1081
|
+
revokeNotificationAccess(id) {
|
|
1082
|
+
return this.mw.http.request("DELETE", `/apps/${encodeURIComponent(id)}/notifications/token`);
|
|
1083
|
+
}
|
|
1084
|
+
schedules(id) {
|
|
1085
|
+
return this.mw.http.request("GET", `/apps/${encodeURIComponent(id)}/schedules`);
|
|
1086
|
+
}
|
|
1087
|
+
saveSchedule(id, schedule) {
|
|
1088
|
+
return this.mw.http.request("POST", `/apps/${encodeURIComponent(id)}/schedules`, { body: schedule });
|
|
1089
|
+
}
|
|
1090
|
+
deleteSchedule(id, scheduleId) {
|
|
1091
|
+
return this.mw.http.request("DELETE", `/apps/${encodeURIComponent(id)}/schedules/${encodeURIComponent(scheduleId)}`);
|
|
1092
|
+
}
|
|
1093
|
+
};
|
|
1094
|
+
|
|
1095
|
+
// src/integrations.ts
|
|
1096
|
+
var IntegrationsApi = class {
|
|
1097
|
+
constructor(mw) {
|
|
1098
|
+
this.mw = mw;
|
|
1099
|
+
}
|
|
1100
|
+
mw;
|
|
1101
|
+
list() {
|
|
1102
|
+
return this.mw.http.request("GET", "/integrations");
|
|
1103
|
+
}
|
|
1104
|
+
get(id) {
|
|
1105
|
+
return this.mw.http.request("GET", this.path(id));
|
|
1106
|
+
}
|
|
1107
|
+
create(spec) {
|
|
1108
|
+
return this.mw.http.request("POST", "/integrations", { body: spec });
|
|
1109
|
+
}
|
|
1110
|
+
/** Complete replacement with optimistic concurrency; omit credentials to preserve them. */
|
|
1111
|
+
update(id, spec) {
|
|
1112
|
+
return this.mw.http.request("PUT", this.path(id), { body: spec });
|
|
1113
|
+
}
|
|
1114
|
+
async delete(id) {
|
|
1115
|
+
await this.mw.http.request("DELETE", this.path(id));
|
|
1116
|
+
}
|
|
1117
|
+
/** Sends to the configured destination, also useful as a connection test. */
|
|
1118
|
+
send(id, text) {
|
|
1119
|
+
return this.mw.http.request("POST", `${this.path(id)}/send`, { body: { text } });
|
|
1120
|
+
}
|
|
1121
|
+
/** Latest 100 redacted delivery receipts. */
|
|
1122
|
+
events(id) {
|
|
1123
|
+
return this.mw.http.request("GET", `${this.path(id)}/events`);
|
|
1124
|
+
}
|
|
1125
|
+
retry(id, eventId) {
|
|
1126
|
+
return this.mw.http.request("POST", `${this.path(id)}/events/${encodeURIComponent(eventId)}/retry`);
|
|
1127
|
+
}
|
|
1128
|
+
path(id) {
|
|
1129
|
+
return `/integrations/${encodeURIComponent(id)}`;
|
|
1130
|
+
}
|
|
1131
|
+
};
|
|
1132
|
+
|
|
968
1133
|
// src/surfaces.ts
|
|
969
1134
|
function savedDesktopID(id) {
|
|
970
1135
|
if (!/^(console|ds_[a-f0-9]{16})$/.test(id)) throw new Error("Invalid saved desktop ID.");
|
|
@@ -1402,7 +1567,7 @@ init_errors();
|
|
|
1402
1567
|
init_errors();
|
|
1403
1568
|
|
|
1404
1569
|
// src/version.ts
|
|
1405
|
-
var SDK_VERSION = "0.1.
|
|
1570
|
+
var SDK_VERSION = "0.1.54" ;
|
|
1406
1571
|
function versionAtLeast(actual, desired) {
|
|
1407
1572
|
if (actual === desired) return true;
|
|
1408
1573
|
if (!actual || !/^\d+\.\d+\.\d+$/.test(actual) || !/^\d+\.\d+\.\d+$/.test(desired)) return false;
|
|
@@ -1621,7 +1786,7 @@ function daemonStartError(resolved, cause) {
|
|
|
1621
1786
|
" \u2022 check GitHub Release access so the SDK can download its matching daemon binary; or",
|
|
1622
1787
|
" \u2022 set MINDWIRE_DAEMON to a `mindwired` binary; or",
|
|
1623
1788
|
" \u2022 pass { baseUrl } to connect to a daemon you run yourself.",
|
|
1624
|
-
" \u2022 Working inside the mindwire monorepo? Run `go build -o /tmp/mindwired ./
|
|
1789
|
+
" \u2022 Working inside the mindwire monorepo? Run `go -C packages/daemon build -o /tmp/mindwired ./cmd/daemon` and set MINDWIRE_DAEMON.",
|
|
1625
1790
|
`(underlying error: ${cause.message})`
|
|
1626
1791
|
].join("\n");
|
|
1627
1792
|
}
|
|
@@ -1718,6 +1883,9 @@ var handleByTransport = /* @__PURE__ */ new WeakMap();
|
|
|
1718
1883
|
var Mindwire = class _Mindwire {
|
|
1719
1884
|
/** Workspace registry: saved agent profiles, projects and chat relationships. */
|
|
1720
1885
|
workspace;
|
|
1886
|
+
bots;
|
|
1887
|
+
apps;
|
|
1888
|
+
integrations;
|
|
1721
1889
|
surfaces;
|
|
1722
1890
|
service;
|
|
1723
1891
|
execution;
|
|
@@ -1758,6 +1926,9 @@ var Mindwire = class _Mindwire {
|
|
|
1758
1926
|
});
|
|
1759
1927
|
this.defaultAgent = opts.agent;
|
|
1760
1928
|
this.workspace = new WorkspaceApi(this);
|
|
1929
|
+
this.bots = new BotsApi(this);
|
|
1930
|
+
this.apps = new AppsApi(this);
|
|
1931
|
+
this.integrations = new IntegrationsApi(this);
|
|
1761
1932
|
this.surfaces = new SurfacesApi(this);
|
|
1762
1933
|
this.service = new ServiceApi(this);
|
|
1763
1934
|
this.execution = new ExecutionApi(this);
|
|
@@ -1785,6 +1956,9 @@ var Mindwire = class _Mindwire {
|
|
|
1785
1956
|
clone.http = this.http;
|
|
1786
1957
|
clone.defaultAgent = agent;
|
|
1787
1958
|
clone.workspace = new WorkspaceApi(clone);
|
|
1959
|
+
clone.bots = new BotsApi(clone);
|
|
1960
|
+
clone.apps = new AppsApi(clone);
|
|
1961
|
+
clone.integrations = new IntegrationsApi(clone);
|
|
1788
1962
|
clone.surfaces = new SurfacesApi(clone);
|
|
1789
1963
|
clone.service = new ServiceApi(clone);
|
|
1790
1964
|
clone.execution = new ExecutionApi(clone);
|
|
@@ -1956,6 +2130,20 @@ var Mindwire = class _Mindwire {
|
|
|
1956
2130
|
deleteChat(chatId) {
|
|
1957
2131
|
return this.http.request("DELETE", `/chats/${encodeURIComponent(chatId)}`);
|
|
1958
2132
|
}
|
|
2133
|
+
/** Read-only portable handoff context; requires crossAgentHandoffVersion >= 2. */
|
|
2134
|
+
previewHandoff(chatId) {
|
|
2135
|
+
return this.http.request("GET", `/chats/${encodeURIComponent(chatId)}/handoff`);
|
|
2136
|
+
}
|
|
2137
|
+
/** Start another agent in a linked conversation in the source project.
|
|
2138
|
+
* Reuse the identical payload after a lost response to recover the same run. */
|
|
2139
|
+
async handoff(chatId, request) {
|
|
2140
|
+
const result = await this.http.request(
|
|
2141
|
+
"POST",
|
|
2142
|
+
`/chats/${encodeURIComponent(chatId)}/handoff`,
|
|
2143
|
+
{ body: request }
|
|
2144
|
+
);
|
|
2145
|
+
return { ...result, run: new Run(this.http, result.run) };
|
|
2146
|
+
}
|
|
1959
2147
|
/**
|
|
1960
2148
|
* `POST /chats/{id}/fork` — clone a chat into a new id (generated when `newChatId` is omitted).
|
|
1961
2149
|
* Codex and Claude preserve native context. `beforeMessageId` excludes that prompt and every
|
|
@@ -3148,7 +3336,7 @@ function docker(config = {}) {
|
|
|
3148
3336
|
var DEFAULT_PORT2 = 8790;
|
|
3149
3337
|
var DEFAULT_AGENT2 = "claude-code";
|
|
3150
3338
|
var DEFAULT_AGENT_CWD2 = "/root";
|
|
3151
|
-
var DEFAULT_RUNTIME_IMAGE =
|
|
3339
|
+
var DEFAULT_RUNTIME_IMAGE = "node:24-bookworm";
|
|
3152
3340
|
var DockerHost = class {
|
|
3153
3341
|
constructor(container) {
|
|
3154
3342
|
this.container = container;
|
|
@@ -3207,13 +3395,14 @@ async function provisionDocker(docker2, config = {}, onLog) {
|
|
|
3207
3395
|
await ensureImage(docker2, image, config.pull ?? "missing", onLog);
|
|
3208
3396
|
const portKey = `${port}/tcp`;
|
|
3209
3397
|
container = await docker2.createContainer({
|
|
3210
|
-
//
|
|
3211
|
-
// image
|
|
3398
|
+
// Keep the default base container alive while the shared binary installer bootstraps it.
|
|
3399
|
+
// A custom image retains its own entrypoint and command.
|
|
3212
3400
|
Image: image,
|
|
3401
|
+
...config.image === void 0 ? { Cmd: ["sleep", "infinity"] } : {},
|
|
3213
3402
|
Env: [`ADDR=:${port}`, `AGENT_TYPE=${agent}`, `AGENT_CWD=${agentCwd}`, "MINDWIRE_ISOLATION=container"],
|
|
3214
3403
|
Tty: false,
|
|
3215
3404
|
ExposedPorts: { [portKey]: {} },
|
|
3216
|
-
HostConfig: { PortBindings: { [portKey]: [{ HostPort: "0" }] } },
|
|
3405
|
+
HostConfig: { PortBindings: { [portKey]: [{ HostIp: "127.0.0.1", HostPort: "0" }] } },
|
|
3217
3406
|
...config.createOptions ?? {}
|
|
3218
3407
|
});
|
|
3219
3408
|
}
|
|
@@ -3267,9 +3456,15 @@ async function ensureImage(docker2, image, policy, onLog) {
|
|
|
3267
3456
|
try {
|
|
3268
3457
|
const stream = await docker2.pull(image);
|
|
3269
3458
|
await new Promise((resolve, reject) => {
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
|
|
3459
|
+
docker2.modem.followProgress(stream, (error, output) => {
|
|
3460
|
+
if (error) {
|
|
3461
|
+
reject(error);
|
|
3462
|
+
return;
|
|
3463
|
+
}
|
|
3464
|
+
const failure = output?.find((frame) => frame.error || frame.errorDetail?.message);
|
|
3465
|
+
if (failure) reject(new Error(failure.error ?? failure.errorDetail.message));
|
|
3466
|
+
else resolve();
|
|
3467
|
+
});
|
|
3273
3468
|
});
|
|
3274
3469
|
emit2(`runtime image ready: ${image}`);
|
|
3275
3470
|
} catch (error) {
|
|
@@ -3529,13 +3724,16 @@ function clearCatalogCache() {
|
|
|
3529
3724
|
// src/index.ts
|
|
3530
3725
|
init_errors();
|
|
3531
3726
|
|
|
3727
|
+
exports.AppsApi = AppsApi;
|
|
3532
3728
|
exports.AuthApi = AuthApi;
|
|
3729
|
+
exports.BotsApi = BotsApi;
|
|
3533
3730
|
exports.ComputerApi = ComputerApi;
|
|
3534
3731
|
exports.ContainerHost = ContainerHost;
|
|
3535
3732
|
exports.ConversationsApi = ConversationsApi;
|
|
3536
3733
|
exports.ExecutionApi = ExecutionApi;
|
|
3537
3734
|
exports.GitAccessApi = GitAccessApi;
|
|
3538
3735
|
exports.Http = Http;
|
|
3736
|
+
exports.IntegrationsApi = IntegrationsApi;
|
|
3539
3737
|
exports.MODELS_DEV_URL = MODELS_DEV_URL;
|
|
3540
3738
|
exports.McpApi = McpApi;
|
|
3541
3739
|
exports.Mindwire = Mindwire;
|