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.
package/dist/index.js CHANGED
@@ -681,9 +681,11 @@ var ServiceApi = class {
681
681
  return this.client.http.request("GET", "/service/update");
682
682
  }
683
683
  /** Download first. Acquire immediately before replacement; busy work returns 409.
684
+ * With serviceUpdateVersion >= 2, force authorizes interrupting active work.
685
+ * It never overrides another installer's lease.
684
686
  * Admission stays closed until release, process exit, or the one-minute expiry. */
685
- acquireUpdate() {
686
- return this.client.http.request("POST", "/service/update");
687
+ acquireUpdate(options) {
688
+ return this.client.http.request("POST", "/service/update", options ? { body: options } : void 0);
687
689
  }
688
690
  releaseUpdate(id) {
689
691
  return this.client.http.request("DELETE", `/service/update/${encodeURIComponent(id)}`);
@@ -773,8 +775,10 @@ var ComputerApi = class {
773
775
  updateStatus() {
774
776
  return this.client.http.request("GET", "/computer/update");
775
777
  }
776
- requestUpdate(version) {
777
- return this.client.http.request("POST", "/computer/update", { body: { version } });
778
+ /** Automatic requests wait for idle. With serviceUpdateVersion >= 2, force
779
+ * promotes the same active request to an explicit restart without re-downloading. */
780
+ requestUpdate(version, options = {}) {
781
+ return this.client.http.request("POST", "/computer/update", { body: { version, ...options } });
778
782
  }
779
783
  invite(routes) {
780
784
  return this.client.http.request("POST", "/computer/pairings", { body: { routes } });
@@ -814,11 +818,12 @@ function computerPairingURI(invitation) {
814
818
  let binary = "";
815
819
  for (const byte of bytes) binary += String.fromCharCode(byte);
816
820
  const encoded = btoa(binary).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
817
- return `mindwire://pair?v=1#${encoded}`;
821
+ const action = "mode" in invitation && invitation.mode === "reconnect" ? "reconnect" : "pair";
822
+ return `mindwire://${action}?v=1#${encoded}`;
818
823
  }
819
824
 
820
825
  // src/version.ts
821
- var SDK_VERSION = "0.1.26" ;
826
+ var SDK_VERSION = "0.1.27" ;
822
827
 
823
828
  // src/daemon-binary.ts
824
829
  function supported(platform, arch) {
@@ -1271,6 +1276,30 @@ var Mindwire = class _Mindwire {
1271
1276
  query
1272
1277
  });
1273
1278
  }
1279
+ /**
1280
+ * Byte-budgeted history (default 1 MiB). Whole messages are retained, including
1281
+ * up to two newest messages even when oversized. Older services return their
1282
+ * bounded array, normalized here without a probe or duplicate request.
1283
+ */
1284
+ async messagePage(chatId, opts = {}) {
1285
+ const limit = opts.limit ?? 12;
1286
+ const result = await this.http.request(
1287
+ "GET",
1288
+ `/chats/${encodeURIComponent(chatId)}/messages`,
1289
+ {
1290
+ query: {
1291
+ ...this.agentParam(opts),
1292
+ limit,
1293
+ before: opts.before,
1294
+ paged: "true",
1295
+ maxBytes: opts.maxBytes ?? 1048576
1296
+ }
1297
+ }
1298
+ );
1299
+ if (result === null) return { messages: [], hasMore: false };
1300
+ if (!Array.isArray(result)) return result;
1301
+ return { messages: result, hasMore: result.length === limit, before: result[0]?.id };
1302
+ }
1274
1303
  /** `GET /chats/{id}/run` — the latest run for a chat (reattach anchor), or `null` if none yet. */
1275
1304
  async latestRun(chatId) {
1276
1305
  const data = await this.http.request(