mindwire 0.1.26 → 0.1.27

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.
@@ -23,8 +23,10 @@ var ComputerApi = class {
23
23
  updateStatus() {
24
24
  return this.client.http.request("GET", "/computer/update");
25
25
  }
26
- requestUpdate(version) {
27
- return this.client.http.request("POST", "/computer/update", { body: { version } });
26
+ /** Automatic requests wait for idle. With serviceUpdateVersion >= 2, force
27
+ * promotes the same active request to an explicit restart without re-downloading. */
28
+ requestUpdate(version, options = {}) {
29
+ return this.client.http.request("POST", "/computer/update", { body: { version, ...options } });
28
30
  }
29
31
  invite(routes) {
30
32
  return this.client.http.request("POST", "/computer/pairings", { body: { routes } });
@@ -64,11 +66,12 @@ function computerPairingURI(invitation) {
64
66
  let binary = "";
65
67
  for (const byte of bytes) binary += String.fromCharCode(byte);
66
68
  const encoded = btoa(binary).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
67
- return `mindwire://pair?v=1#${encoded}`;
69
+ const action = "mode" in invitation && invitation.mode === "reconnect" ? "reconnect" : "pair";
70
+ return `mindwire://${action}?v=1#${encoded}`;
68
71
  }
69
72
 
70
73
  // src/version.ts
71
- var SDK_VERSION = "0.1.26" ;
74
+ var SDK_VERSION = "0.1.27" ;
72
75
 
73
76
  // src/daemon-binary.ts
74
77
  function supported(platform, arch) {
@@ -901,9 +904,11 @@ var ServiceApi = class {
901
904
  return this.client.http.request("GET", "/service/update");
902
905
  }
903
906
  /** Download first. Acquire immediately before replacement; busy work returns 409.
907
+ * With serviceUpdateVersion >= 2, force authorizes interrupting active work.
908
+ * It never overrides another installer's lease.
904
909
  * Admission stays closed until release, process exit, or the one-minute expiry. */
905
- acquireUpdate() {
906
- return this.client.http.request("POST", "/service/update");
910
+ acquireUpdate(options) {
911
+ return this.client.http.request("POST", "/service/update", options ? { body: options } : void 0);
907
912
  }
908
913
  releaseUpdate(id) {
909
914
  return this.client.http.request("DELETE", `/service/update/${encodeURIComponent(id)}`);
@@ -1371,6 +1376,30 @@ var Mindwire = class _Mindwire {
1371
1376
  query
1372
1377
  });
1373
1378
  }
1379
+ /**
1380
+ * Byte-budgeted history (default 1 MiB). Whole messages are retained, including
1381
+ * up to two newest messages even when oversized. Older services return their
1382
+ * bounded array, normalized here without a probe or duplicate request.
1383
+ */
1384
+ async messagePage(chatId, opts = {}) {
1385
+ const limit = opts.limit ?? 12;
1386
+ const result = await this.http.request(
1387
+ "GET",
1388
+ `/chats/${encodeURIComponent(chatId)}/messages`,
1389
+ {
1390
+ query: {
1391
+ ...this.agentParam(opts),
1392
+ limit,
1393
+ before: opts.before,
1394
+ paged: "true",
1395
+ maxBytes: opts.maxBytes ?? 1048576
1396
+ }
1397
+ }
1398
+ );
1399
+ if (result === null) return { messages: [], hasMore: false };
1400
+ if (!Array.isArray(result)) return result;
1401
+ return { messages: result, hasMore: result.length === limit, before: result[0]?.id };
1402
+ }
1374
1403
  /** `GET /chats/{id}/run` — the latest run for a chat (reattach anchor), or `null` if none yet. */
1375
1404
  async latestRun(chatId) {
1376
1405
  const data = await this.http.request(
@@ -1992,7 +2021,7 @@ async function ensureComputer(directory, cliPath, patch = {}, onProgress, option
1992
2021
  }
1993
2022
  }
1994
2023
  async function superviseComputer(directory) {
1995
- const controller = await import('./controller-CGSJZZZD.js');
2024
+ const controller = await import('./controller-7YV6O7GT.js');
1996
2025
  await controller.superviseComputer(directory);
1997
2026
  }
1998
2027
  async function stopComputer(directory, force = false) {
@@ -2017,5 +2046,5 @@ async function stopComputer(directory, force = false) {
2017
2046
  }
2018
2047
 
2019
2048
  export { SDK_VERSION, acquireProcessLock, adoptProcess, computerClient, computerPairingQRData, computerPairingURI, currentProcessIdentity, defaultStateDirectory, directRoutes, ensureComputer, ensureDaemonBinary, ownChild, processIdentity, processStateAlive, readJSON, stopComputer, superviseComputer, writeJSON };
2020
- //# sourceMappingURL=chunk-L3USUTZZ.js.map
2021
- //# sourceMappingURL=chunk-L3USUTZZ.js.map
2049
+ //# sourceMappingURL=chunk-QXHI4TMC.js.map
2050
+ //# sourceMappingURL=chunk-QXHI4TMC.js.map