@haex-space/vault-sdk 4.9.0 → 5.0.0

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/svelte.mjs CHANGED
@@ -803,7 +803,11 @@ var MODEL_COMMANDS = {
803
803
  /** Starts a job; the result follows as an event */
804
804
  start: "extension_model_job_start",
805
805
  /** Cancels a running job of this frame */
806
- cancel: "extension_model_job_cancel"
806
+ cancel: "extension_model_job_cancel",
807
+ /** Asks for a grant before the first job; nothing goes to a model */
808
+ requestAccess: "extension_model_access_request",
809
+ /** Opens the host's page of this extension's models */
810
+ openSettings: "extension_model_settings_open"
807
811
  };
808
812
 
809
813
  // src/commands/peers.ts
@@ -2050,6 +2054,24 @@ var ModelsAPI = class {
2050
2054
  );
2051
2055
  return answer.models;
2052
2056
  }
2057
+ /**
2058
+ * Asks for a grant before the first job (holzi spec 055 US9) and resolves with the allowed
2059
+ * models that fit `needs`. Without one, the host asks the user as it would for a job, and the
2060
+ * SDK waits for the answer. Rejects with `no_capable_model` (8001) when no model of the host
2061
+ * fits and with a denial (1002) when the user refused. Nothing is sent to a model, and consent
2062
+ * for a destination outside this device is asked with the first job that sends data.
2063
+ */
2064
+ async requestAccessAsync(request) {
2065
+ const answer = await this.client.request(
2066
+ MODEL_COMMANDS.requestAccess,
2067
+ { ...request }
2068
+ );
2069
+ return answer.models;
2070
+ }
2071
+ /** Opens the host's page of this extension's models, where the user chooses models and effort. */
2072
+ async openSettingsAsync() {
2073
+ await this.client.request(MODEL_COMMANDS.openSettings, {});
2074
+ }
2053
2075
  /** Starts a job; its end comes as {@link onCompleted}. Use {@link runAsync} to await it. */
2054
2076
  async startAsync(job) {
2055
2077
  const answer = await this.client.request(MODEL_COMMANDS.start, {