mindwire 0.1.52 → 0.1.53

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/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
- return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
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.52" ;
1570
+ var SDK_VERSION = "0.1.53" ;
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 ./daemon/cmd/daemon` and set MINDWIRE_DAEMON.",
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);
@@ -3148,7 +3322,7 @@ function docker(config = {}) {
3148
3322
  var DEFAULT_PORT2 = 8790;
3149
3323
  var DEFAULT_AGENT2 = "claude-code";
3150
3324
  var DEFAULT_AGENT_CWD2 = "/root";
3151
- var DEFAULT_RUNTIME_IMAGE = `ghcr.io/oblien/mindwire-runtime:${SDK_VERSION}`;
3325
+ var DEFAULT_RUNTIME_IMAGE = "node:24-bookworm";
3152
3326
  var DockerHost = class {
3153
3327
  constructor(container) {
3154
3328
  this.container = container;
@@ -3207,13 +3381,14 @@ async function provisionDocker(docker2, config = {}, onLog) {
3207
3381
  await ensureImage(docker2, image, config.pull ?? "missing", onLog);
3208
3382
  const portKey = `${port}/tcp`;
3209
3383
  container = await docker2.createContainer({
3210
- // The runtime image starts mindwired itself. Do not replace its command: doing so turns the
3211
- // image ENTRYPOINT into `mindwired sleep infinity` and prevents the runtime from starting.
3384
+ // Keep the default base container alive while the shared binary installer bootstraps it.
3385
+ // A custom image retains its own entrypoint and command.
3212
3386
  Image: image,
3387
+ ...config.image === void 0 ? { Cmd: ["sleep", "infinity"] } : {},
3213
3388
  Env: [`ADDR=:${port}`, `AGENT_TYPE=${agent}`, `AGENT_CWD=${agentCwd}`, "MINDWIRE_ISOLATION=container"],
3214
3389
  Tty: false,
3215
3390
  ExposedPorts: { [portKey]: {} },
3216
- HostConfig: { PortBindings: { [portKey]: [{ HostPort: "0" }] } },
3391
+ HostConfig: { PortBindings: { [portKey]: [{ HostIp: "127.0.0.1", HostPort: "0" }] } },
3217
3392
  ...config.createOptions ?? {}
3218
3393
  });
3219
3394
  }
@@ -3267,9 +3442,15 @@ async function ensureImage(docker2, image, policy, onLog) {
3267
3442
  try {
3268
3443
  const stream = await docker2.pull(image);
3269
3444
  await new Promise((resolve, reject) => {
3270
- stream.on("end", () => resolve());
3271
- stream.on("close", () => resolve());
3272
- stream.on("error", (error) => reject(error));
3445
+ docker2.modem.followProgress(stream, (error, output) => {
3446
+ if (error) {
3447
+ reject(error);
3448
+ return;
3449
+ }
3450
+ const failure = output?.find((frame) => frame.error || frame.errorDetail?.message);
3451
+ if (failure) reject(new Error(failure.error ?? failure.errorDetail.message));
3452
+ else resolve();
3453
+ });
3273
3454
  });
3274
3455
  emit2(`runtime image ready: ${image}`);
3275
3456
  } catch (error) {
@@ -3529,13 +3710,16 @@ function clearCatalogCache() {
3529
3710
  // src/index.ts
3530
3711
  init_errors();
3531
3712
 
3713
+ exports.AppsApi = AppsApi;
3532
3714
  exports.AuthApi = AuthApi;
3715
+ exports.BotsApi = BotsApi;
3533
3716
  exports.ComputerApi = ComputerApi;
3534
3717
  exports.ContainerHost = ContainerHost;
3535
3718
  exports.ConversationsApi = ConversationsApi;
3536
3719
  exports.ExecutionApi = ExecutionApi;
3537
3720
  exports.GitAccessApi = GitAccessApi;
3538
3721
  exports.Http = Http;
3722
+ exports.IntegrationsApi = IntegrationsApi;
3539
3723
  exports.MODELS_DEV_URL = MODELS_DEV_URL;
3540
3724
  exports.McpApi = McpApi;
3541
3725
  exports.Mindwire = Mindwire;