mindwire 0.1.25 → 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
@@ -508,8 +508,8 @@ var WorkspaceApi = class {
508
508
  agents;
509
509
  projects;
510
510
  chats;
511
- snapshot() {
512
- return this.mw.http.request("GET", "/workspace");
511
+ snapshot(options = {}) {
512
+ return this.mw.http.request("GET", "/workspace", { query: options });
513
513
  }
514
514
  /** Start an operation owned by the daemon. The same ID/payload returns the existing operation. */
515
515
  createProject(request) {
@@ -524,8 +524,8 @@ var WorkspaceApi = class {
524
524
  /** Incremental reconciliation. Pass the previous identity to detect a replaced/restored workspace.
525
525
  * A 409 requires fetching snapshot() again; never apply a delta to a different registry.
526
526
  */
527
- changes(since, workspaceId) {
528
- return this.mw.http.request("GET", "/workspace/changes", { query: { since, workspaceId } });
527
+ changes(since, workspaceId, options = {}) {
528
+ return this.mw.http.request("GET", "/workspace/changes", { query: { since, workspaceId, ...options } });
529
529
  }
530
530
  /** Import legacy metadata before replacing a local cache. Safe to repeat after interruption. */
531
531
  import(records) {
@@ -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 } });
@@ -806,16 +810,20 @@ var ComputerApi = class {
806
810
  return this.client.http.request("DELETE", `/computer/forwards/${encodeURIComponent(id)}`);
807
811
  }
808
812
  };
813
+ function computerPairingQRData(invitation) {
814
+ return JSON.stringify(invitation);
815
+ }
809
816
  function computerPairingURI(invitation) {
810
- const bytes = new TextEncoder().encode(JSON.stringify(invitation));
817
+ const bytes = new TextEncoder().encode(computerPairingQRData(invitation));
811
818
  let binary = "";
812
819
  for (const byte of bytes) binary += String.fromCharCode(byte);
813
820
  const encoded = btoa(binary).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
814
- return `mindwire://pair?v=1#${encoded}`;
821
+ const action = "mode" in invitation && invitation.mode === "reconnect" ? "reconnect" : "pair";
822
+ return `mindwire://${action}?v=1#${encoded}`;
815
823
  }
816
824
 
817
825
  // src/version.ts
818
- var SDK_VERSION = "0.1.25" ;
826
+ var SDK_VERSION = "0.1.27" ;
819
827
 
820
828
  // src/daemon-binary.ts
821
829
  function supported(platform, arch) {
@@ -1218,9 +1226,12 @@ var Mindwire = class _Mindwire {
1218
1226
  });
1219
1227
  }
1220
1228
  // ---- chats & history -----------------------------------------------------
1221
- /** `GET /chats` — recorded chats (newest first), shared across agents. */
1222
- chats() {
1223
- return this.http.request("GET", "/chats");
1229
+ /** Native project conversations and drafts, newest first, shared across agents.
1230
+ * `cwd` matches an exact directory; `projectId` selects saved membership.
1231
+ * `refresh` bypasses the daemon's short native metadata cache.
1232
+ */
1233
+ chats(options = {}) {
1234
+ return this.http.request("GET", "/chats", { query: options });
1224
1235
  }
1225
1236
  /**
1226
1237
  * `PUT /chats/{id}` — rename a chat. The user title wins over the agent's native auto-title in
@@ -1265,6 +1276,30 @@ var Mindwire = class _Mindwire {
1265
1276
  query
1266
1277
  });
1267
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
+ }
1268
1303
  /** `GET /chats/{id}/run` — the latest run for a chat (reattach anchor), or `null` if none yet. */
1269
1304
  async latestRun(chatId) {
1270
1305
  const data = await this.http.request(
@@ -1288,6 +1323,7 @@ var Mindwire = class _Mindwire {
1288
1323
  chatId: input.chatId,
1289
1324
  message: input.message
1290
1325
  };
1326
+ if (input.requestId !== void 0) body.requestId = input.requestId;
1291
1327
  if (input.cwd !== void 0) body.cwd = input.cwd;
1292
1328
  if (input.options !== void 0) body.options = input.options;
1293
1329
  if (input.mode !== void 0) body.mode = input.mode;
@@ -2786,6 +2822,6 @@ function clearCatalogCache() {
2786
2822
  inflight = null;
2787
2823
  }
2788
2824
 
2789
- export { AuthApi, ComputerApi, ContainerHost, ExecutionApi, GitAccessApi, Http, MODELS_DEV_URL, McpApi, Mindwire, NotifyApi, ProjectOperationsApi, PromptsApi, ProvidersApi, Run, SDK_VERSION, ServiceApi, SurfacesApi, TerminalsApi, WorkspaceApi, WorkspaceCollection, catalogModels, catalogProvider, catalogProviders, clearCatalogCache, computerPairingURI, docker, ensureDaemon, ensureDaemonBinary, loadCatalog, local, lookupModel, oblien, provisionContainer, provisionDocker, provisionOblien, provisionSsh, provisionSshContainer, remote, resolveLinuxDaemon, ssh, startEmbedded };
2825
+ export { AuthApi, ComputerApi, ContainerHost, ExecutionApi, GitAccessApi, Http, MODELS_DEV_URL, McpApi, Mindwire, NotifyApi, ProjectOperationsApi, PromptsApi, ProvidersApi, Run, SDK_VERSION, ServiceApi, SurfacesApi, TerminalsApi, WorkspaceApi, WorkspaceCollection, catalogModels, catalogProvider, catalogProviders, clearCatalogCache, computerPairingQRData, computerPairingURI, docker, ensureDaemon, ensureDaemonBinary, loadCatalog, local, lookupModel, oblien, provisionContainer, provisionDocker, provisionOblien, provisionSsh, provisionSshContainer, remote, resolveLinuxDaemon, ssh, startEmbedded };
2790
2826
  //# sourceMappingURL=index.js.map
2791
2827
  //# sourceMappingURL=index.js.map