mindwire 0.1.41 → 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.
package/dist/index.d.ts CHANGED
@@ -40,7 +40,7 @@ export type { Conversation, ConversationQuery, ConversationPage, ConversationOpe
40
40
  export { ProjectSyncApi, ProjectSyncError } from "./project-sync.js";
41
41
  export type { ProjectSyncEntry, ProjectSyncCheckpoint, ProjectSyncRequest, ProjectSyncOperation, ProjectSyncConflict, ProjectSyncProgress, ProjectSyncPreview, ProjectSyncPreviewRequest, ProjectSyncIgnoredPath } from "./project-sync.js";
42
42
  export type { ProjectRequest, ProjectAuth, ProjectOperation, ProjectRemoveRequest, GitConnection, GitAccessState, ProjectGitState, GitAction, GitIdentity, GitIdentityScope, GitIdentitySettings, GitIdentityUpdate, GitOperationRequest, GitOperation } from "./workspace.js";
43
- export type { WorkspaceRecord, WorkspaceAgent, WorkspaceProject, WorkspaceChat, WorkspaceKind, WorkspaceInput, WorkspaceImport, WorkspaceSnapshot, ProjectIcon } from "./workspace.js";
43
+ export type { WorkspaceRecord, WorkspaceAgent, WorkspaceProject, WorkspaceChat, WorkspaceKind, WorkspaceInput, WorkspaceImport, WorkspaceSnapshot, ProjectIcon, ProjectFolder, ProjectLibrary, ProjectLibraryEdit } from "./workspace.js";
44
44
  export * from "./surfaces.js";
45
45
  export * from "./execution.js";
46
46
  export * from "./computer.js";
package/dist/index.js CHANGED
@@ -720,6 +720,12 @@ var WorkspaceApi = class {
720
720
  snapshot(options = {}) {
721
721
  return this.mw.http.request("GET", "/workspace", { query: options });
722
722
  }
723
+ library() {
724
+ return this.mw.http.request("GET", "/workspace/project-library");
725
+ }
726
+ editLibrary(edit) {
727
+ return this.mw.http.request("PATCH", "/workspace/project-library", { body: edit });
728
+ }
723
729
  /** Read the saved icon, or preview a candidate relative path within the project. Requires projectIconsVersion >= 1. */
724
730
  projectIcon(projectId, path) {
725
731
  return this.mw.http.request("GET", `/workspace/projects/${encodeURIComponent(projectId)}/icon`, { query: { path } });
@@ -825,18 +831,61 @@ var GitAccessApi = class {
825
831
  };
826
832
 
827
833
  // src/surfaces.ts
828
- var SurfacesApi = class {
829
- constructor(mw) {
834
+ function savedDesktopID(id) {
835
+ if (!/^(console|ds_[a-f0-9]{16})$/.test(id)) throw new Error("Invalid saved desktop ID.");
836
+ return id;
837
+ }
838
+ var SurfacesApi = class _SurfacesApi {
839
+ constructor(mw, desktopId) {
830
840
  this.mw = mw;
841
+ this.desktopId = desktopId;
831
842
  }
832
843
  mw;
844
+ desktopId;
845
+ /** Select a saved display for status, events, captures and input receipts. */
846
+ desktop(id) {
847
+ return new _SurfacesApi(this.mw, savedDesktopID(id));
848
+ }
849
+ scoped(path) {
850
+ return this.desktopId ? `${path}?desktopId=${encodeURIComponent(this.desktopId)}` : path;
851
+ }
852
+ bindRuntime(binding) {
853
+ return this.mw.http.request("PUT", "/surfaces/desktop/runtime", { body: binding });
854
+ }
855
+ listDesktops(projectId) {
856
+ return this.mw.http.request("GET", "/surfaces/desktop/catalog", { query: { projectId } });
857
+ }
858
+ createDesktop(request) {
859
+ return this.mw.http.request("POST", "/surfaces/desktop/catalog", { body: request });
860
+ }
861
+ ensureProjectDesktop(projectId) {
862
+ return this.mw.http.request("POST", `/surfaces/desktop/projects/${encodeURIComponent(projectId)}/ensure`);
863
+ }
864
+ getDesktop(id) {
865
+ return this.mw.http.request("GET", `/surfaces/desktop/catalog/${savedDesktopID(id)}`);
866
+ }
867
+ updateDesktop(id, request) {
868
+ return this.mw.http.request("PATCH", `/surfaces/desktop/catalog/${savedDesktopID(id)}`, { body: request });
869
+ }
870
+ startDesktop(id) {
871
+ return this.mw.http.request("POST", `/surfaces/desktop/catalog/${savedDesktopID(id)}/start`);
872
+ }
873
+ /** Stops this desktop's apps; keeps its profile and files. */
874
+ stopDesktop(id) {
875
+ return this.mw.http.request("POST", `/surfaces/desktop/catalog/${savedDesktopID(id)}/stop`);
876
+ }
877
+ /** Deletes the desktop's private profile. Closing a viewer uses close(), never this method. */
878
+ deleteDesktop(id) {
879
+ return this.mw.http.request("DELETE", `/surfaces/desktop/catalog/${savedDesktopID(id)}`);
880
+ }
833
881
  list() {
834
882
  return this.mw.http.request("GET", "/surfaces");
835
883
  }
836
884
  status(refresh = false) {
837
- return this.mw.http.request("GET", "/surfaces/desktop", { query: { refresh } });
885
+ return this.mw.http.request("GET", this.scoped("/surfaces/desktop"), { query: { refresh } });
838
886
  }
839
887
  bind(binding) {
888
+ if (this.desktopId && binding.desktopId !== this.desktopId) throw new Error("The desktop grant belongs to another saved desktop.");
840
889
  return this.mw.http.request("PUT", "/surfaces/desktop/binding", { body: binding });
841
890
  }
842
891
  localStatus() {
@@ -851,22 +900,23 @@ var SurfacesApi = class {
851
900
  });
852
901
  }
853
902
  open(request) {
854
- return this.mw.http.request("POST", "/surfaces/desktop/sessions", { body: request });
903
+ if (this.desktopId && request.desktopId && request.desktopId !== this.desktopId) throw new Error("Select the matching saved desktop.");
904
+ return this.mw.http.request("POST", this.scoped("/surfaces/desktop/sessions"), { body: request });
855
905
  }
856
906
  control(id, request) {
857
- return this.mw.http.request("POST", `/surfaces/desktop/sessions/${encodeURIComponent(id)}/control`, { body: request });
907
+ return this.mw.http.request("POST", this.scoped(`/surfaces/desktop/sessions/${encodeURIComponent(id)}/control`), { body: request });
858
908
  }
859
909
  close(id) {
860
- return this.mw.http.request("DELETE", `/surfaces/desktop/sessions/${encodeURIComponent(id)}`);
910
+ return this.mw.http.request("DELETE", this.scoped(`/surfaces/desktop/sessions/${encodeURIComponent(id)}`));
861
911
  }
862
912
  capture(id) {
863
- return this.mw.http.request("POST", `/surfaces/desktop/sessions/${encodeURIComponent(id)}/captures`);
913
+ return this.mw.http.request("POST", this.scoped(`/surfaces/desktop/sessions/${encodeURIComponent(id)}/captures`));
864
914
  }
865
915
  action(request) {
866
- return this.mw.http.request("POST", "/surfaces/desktop/actions", { body: request });
916
+ return this.mw.http.request("POST", this.scoped("/surfaces/desktop/actions"), { body: request });
867
917
  }
868
918
  receipt(id) {
869
- return this.mw.http.request("GET", `/surfaces/desktop/actions/${encodeURIComponent(id)}`);
919
+ return this.mw.http.request("GET", this.scoped(`/surfaces/desktop/actions/${encodeURIComponent(id)}`));
870
920
  }
871
921
  artifact(id) {
872
922
  return this.mw.http.request("GET", `/artifacts/${encodeURIComponent(id)}`);
@@ -878,7 +928,7 @@ var SurfacesApi = class {
878
928
  opts.signal?.addEventListener("abort", abort, { once: true });
879
929
  if (opts.signal?.aborted) controller.abort();
880
930
  try {
881
- const response = await this.mw.http.open("GET", "/surfaces/desktop/events", { signal: controller.signal });
931
+ const response = await this.mw.http.open("GET", this.scoped("/surfaces/desktop/events"), { signal: controller.signal });
882
932
  let instance;
883
933
  let revision = -1;
884
934
  for await (const snapshot of readSSE(response.body, controller.signal)) {
@@ -1064,7 +1114,7 @@ function computerPairingURI(invitation) {
1064
1114
  }
1065
1115
 
1066
1116
  // src/version.ts
1067
- var SDK_VERSION = "0.1.41" ;
1117
+ var SDK_VERSION = "0.1.43" ;
1068
1118
  function versionAtLeast(actual, desired) {
1069
1119
  if (actual === desired) return true;
1070
1120
  if (!actual || !/^\d+\.\d+\.\d+$/.test(actual) || !/^\d+\.\d+\.\d+$/.test(desired)) return false;