mindwire 0.1.42 → 0.1.43

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.
@@ -88,7 +88,7 @@ function computerPairingURI(invitation) {
88
88
  }
89
89
 
90
90
  // src/version.ts
91
- var SDK_VERSION = "0.1.42" ;
91
+ var SDK_VERSION = "0.1.43" ;
92
92
  function versionAtLeast(actual, desired) {
93
93
  if (actual === desired) return true;
94
94
  if (!actual || !/^\d+\.\d+\.\d+$/.test(actual) || !/^\d+\.\d+\.\d+$/.test(desired)) return false;
@@ -1376,6 +1376,12 @@ var WorkspaceApi = class {
1376
1376
  snapshot(options = {}) {
1377
1377
  return this.mw.http.request("GET", "/workspace", { query: options });
1378
1378
  }
1379
+ library() {
1380
+ return this.mw.http.request("GET", "/workspace/project-library");
1381
+ }
1382
+ editLibrary(edit) {
1383
+ return this.mw.http.request("PATCH", "/workspace/project-library", { body: edit });
1384
+ }
1379
1385
  /** Read the saved icon, or preview a candidate relative path within the project. Requires projectIconsVersion >= 1. */
1380
1386
  projectIcon(projectId, path5) {
1381
1387
  return this.mw.http.request("GET", `/workspace/projects/${encodeURIComponent(projectId)}/icon`, { query: { path: path5 } });
@@ -1481,18 +1487,61 @@ var GitAccessApi = class {
1481
1487
  };
1482
1488
 
1483
1489
  // src/surfaces.ts
1484
- var SurfacesApi = class {
1485
- constructor(mw) {
1490
+ function savedDesktopID(id) {
1491
+ if (!/^(console|ds_[a-f0-9]{16})$/.test(id)) throw new Error("Invalid saved desktop ID.");
1492
+ return id;
1493
+ }
1494
+ var SurfacesApi = class _SurfacesApi {
1495
+ constructor(mw, desktopId) {
1486
1496
  this.mw = mw;
1497
+ this.desktopId = desktopId;
1487
1498
  }
1488
1499
  mw;
1500
+ desktopId;
1501
+ /** Select a saved display for status, events, captures and input receipts. */
1502
+ desktop(id) {
1503
+ return new _SurfacesApi(this.mw, savedDesktopID(id));
1504
+ }
1505
+ scoped(path5) {
1506
+ return this.desktopId ? `${path5}?desktopId=${encodeURIComponent(this.desktopId)}` : path5;
1507
+ }
1508
+ bindRuntime(binding) {
1509
+ return this.mw.http.request("PUT", "/surfaces/desktop/runtime", { body: binding });
1510
+ }
1511
+ listDesktops(projectId) {
1512
+ return this.mw.http.request("GET", "/surfaces/desktop/catalog", { query: { projectId } });
1513
+ }
1514
+ createDesktop(request) {
1515
+ return this.mw.http.request("POST", "/surfaces/desktop/catalog", { body: request });
1516
+ }
1517
+ ensureProjectDesktop(projectId) {
1518
+ return this.mw.http.request("POST", `/surfaces/desktop/projects/${encodeURIComponent(projectId)}/ensure`);
1519
+ }
1520
+ getDesktop(id) {
1521
+ return this.mw.http.request("GET", `/surfaces/desktop/catalog/${savedDesktopID(id)}`);
1522
+ }
1523
+ updateDesktop(id, request) {
1524
+ return this.mw.http.request("PATCH", `/surfaces/desktop/catalog/${savedDesktopID(id)}`, { body: request });
1525
+ }
1526
+ startDesktop(id) {
1527
+ return this.mw.http.request("POST", `/surfaces/desktop/catalog/${savedDesktopID(id)}/start`);
1528
+ }
1529
+ /** Stops this desktop's apps; keeps its profile and files. */
1530
+ stopDesktop(id) {
1531
+ return this.mw.http.request("POST", `/surfaces/desktop/catalog/${savedDesktopID(id)}/stop`);
1532
+ }
1533
+ /** Deletes the desktop's private profile. Closing a viewer uses close(), never this method. */
1534
+ deleteDesktop(id) {
1535
+ return this.mw.http.request("DELETE", `/surfaces/desktop/catalog/${savedDesktopID(id)}`);
1536
+ }
1489
1537
  list() {
1490
1538
  return this.mw.http.request("GET", "/surfaces");
1491
1539
  }
1492
1540
  status(refresh = false) {
1493
- return this.mw.http.request("GET", "/surfaces/desktop", { query: { refresh } });
1541
+ return this.mw.http.request("GET", this.scoped("/surfaces/desktop"), { query: { refresh } });
1494
1542
  }
1495
1543
  bind(binding) {
1544
+ if (this.desktopId && binding.desktopId !== this.desktopId) throw new Error("The desktop grant belongs to another saved desktop.");
1496
1545
  return this.mw.http.request("PUT", "/surfaces/desktop/binding", { body: binding });
1497
1546
  }
1498
1547
  localStatus() {
@@ -1507,22 +1556,23 @@ var SurfacesApi = class {
1507
1556
  });
1508
1557
  }
1509
1558
  open(request) {
1510
- return this.mw.http.request("POST", "/surfaces/desktop/sessions", { body: request });
1559
+ if (this.desktopId && request.desktopId && request.desktopId !== this.desktopId) throw new Error("Select the matching saved desktop.");
1560
+ return this.mw.http.request("POST", this.scoped("/surfaces/desktop/sessions"), { body: request });
1511
1561
  }
1512
1562
  control(id, request) {
1513
- return this.mw.http.request("POST", `/surfaces/desktop/sessions/${encodeURIComponent(id)}/control`, { body: request });
1563
+ return this.mw.http.request("POST", this.scoped(`/surfaces/desktop/sessions/${encodeURIComponent(id)}/control`), { body: request });
1514
1564
  }
1515
1565
  close(id) {
1516
- return this.mw.http.request("DELETE", `/surfaces/desktop/sessions/${encodeURIComponent(id)}`);
1566
+ return this.mw.http.request("DELETE", this.scoped(`/surfaces/desktop/sessions/${encodeURIComponent(id)}`));
1517
1567
  }
1518
1568
  capture(id) {
1519
- return this.mw.http.request("POST", `/surfaces/desktop/sessions/${encodeURIComponent(id)}/captures`);
1569
+ return this.mw.http.request("POST", this.scoped(`/surfaces/desktop/sessions/${encodeURIComponent(id)}/captures`));
1520
1570
  }
1521
1571
  action(request) {
1522
- return this.mw.http.request("POST", "/surfaces/desktop/actions", { body: request });
1572
+ return this.mw.http.request("POST", this.scoped("/surfaces/desktop/actions"), { body: request });
1523
1573
  }
1524
1574
  receipt(id) {
1525
- return this.mw.http.request("GET", `/surfaces/desktop/actions/${encodeURIComponent(id)}`);
1575
+ return this.mw.http.request("GET", this.scoped(`/surfaces/desktop/actions/${encodeURIComponent(id)}`));
1526
1576
  }
1527
1577
  artifact(id) {
1528
1578
  return this.mw.http.request("GET", `/artifacts/${encodeURIComponent(id)}`);
@@ -1534,7 +1584,7 @@ var SurfacesApi = class {
1534
1584
  opts.signal?.addEventListener("abort", abort, { once: true });
1535
1585
  if (opts.signal?.aborted) controller.abort();
1536
1586
  try {
1537
- const response = await this.mw.http.open("GET", "/surfaces/desktop/events", { signal: controller.signal });
1587
+ const response = await this.mw.http.open("GET", this.scoped("/surfaces/desktop/events"), { signal: controller.signal });
1538
1588
  let instance;
1539
1589
  let revision = -1;
1540
1590
  for await (const snapshot of readSSE(response.body, controller.signal)) {
@@ -2553,7 +2603,7 @@ async function ensureComputer(directory, cliPath, patch = {}, onProgress, option
2553
2603
  if (!compatible(controller2) || !await processStateAlive(controller2)) {
2554
2604
  await ensureComputer(directory, cliPath, {}, onProgress, { ...options, waitForRoutes: false });
2555
2605
  }
2556
- const { changeComputerConnection } = await import('./connection-change-LZ6MT6Q6.js');
2606
+ const { changeComputerConnection } = await import('./connection-change-SF6UKNSO.js');
2557
2607
  await changeComputerConnection(directory, Object.fromEntries(changed.map((key) => [key, patch[key]])), { signal: options.signal, onProgress });
2558
2608
  return computerClient(directory);
2559
2609
  }
@@ -2594,7 +2644,7 @@ async function ensureComputer(directory, cliPath, patch = {}, onProgress, option
2594
2644
  let controller = await readJSON(path4.join(directory, "computer-controller.json"));
2595
2645
  if (existing && controller && !compatible(controller) && await processStateAlive(controller)) {
2596
2646
  onProgress?.("Refreshing the background connection service\u2026");
2597
- const { handoffController } = await import('./controller-handoff-YNHM2W52.js');
2647
+ const { handoffController } = await import('./controller-handoff-WVGU5UNV.js');
2598
2648
  await handoffController(directory, controller, config, await existing.computer.info());
2599
2649
  controller = void 0;
2600
2650
  }
@@ -2628,7 +2678,7 @@ async function ensureComputer(directory, cliPath, patch = {}, onProgress, option
2628
2678
  }
2629
2679
  }
2630
2680
  async function superviseComputer(directory) {
2631
- const controller = await import('./controller-UYJ7F2IU.js');
2681
+ const controller = await import('./controller-FCIIKFUZ.js');
2632
2682
  await controller.superviseComputer(directory);
2633
2683
  }
2634
2684
  async function stopComputer(directory, force = false) {
@@ -2653,5 +2703,5 @@ async function stopComputer(directory, force = false) {
2653
2703
  }
2654
2704
 
2655
2705
  export { CONTROLLER_PROTOCOL, ProviderConnectionError, RelayOutput, SDK_VERSION, acquireProcessLock, adoptProcess, adoptRelay, cloudflareCommand, computerClient, computerPairingQRData, computerPairingURI, currentProcessIdentity, defaultComputerConfig, defaultStateDirectory, directRoutes, ensureComputer, ensureDaemonBinary, hasCertificateError, ownChild, processIdentity, processStateAlive, providerFailure, providerNeedsAction, readJSON, startRelay, stopComputer, superviseComputer, versionAtLeast, websocketURL, writeJSON };
2656
- //# sourceMappingURL=chunk-YQSLQWPI.js.map
2657
- //# sourceMappingURL=chunk-YQSLQWPI.js.map
2706
+ //# sourceMappingURL=chunk-G7CSL6OC.js.map
2707
+ //# sourceMappingURL=chunk-G7CSL6OC.js.map