@ai-matrx/desktop-protocol 0.6.0 → 0.10.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/react.d.cts CHANGED
@@ -7,7 +7,7 @@ import { z } from 'zod';
7
7
  * never drift (see the `_assert*` lines there).
8
8
  */
9
9
  type ErrorCodeName = "AUTH_REQUIRED" | "AUTH_INVALID" | "AUTH_EXPIRED" | "AUTH_FORBIDDEN" | "AUTH_DEVICE_REVOKED" | "PERMISSION_DENIED_OS" | "NOT_FOUND" | "CONFLICT" | "INVALID_PARAMS" | "RESOURCE_BUSY" | "RESOURCE_GONE" | "CANCELLED" | "TIMEOUT" | "PLATFORM_UNSUPPORTED" | "RATE_LIMITED" | "INTERNAL" | "PROTOCOL_VERSION_UNSUPPORTED" | "PROTOCOL_ERROR" | "UNKNOWN_OPERATION" | "DEVICE_OFFLINE" | "PAYLOAD_TOO_LARGE";
10
- type ErrorReasonName = "not_a_directory" | "is_a_directory" | "directory_not_empty" | "already_exists" | "stale_write" | "binary_content" | "not_utf8_boundary" | "patch_no_match" | "patch_ambiguous" | "resource_exited" | "resource_expired" | "control_taken" | "window_exhausted";
10
+ type ErrorReasonName = "not_a_directory" | "is_a_directory" | "directory_not_empty" | "already_exists" | "stale_write" | "binary_content" | "not_utf8_boundary" | "patch_no_match" | "patch_ambiguous" | "resource_exited" | "resource_expired" | "control_taken" | "window_exhausted" | "runtime_not_installed" | "model_not_installed" | "unsupported_media" | "download_failed" | "service_starting" | "service_restarted" | "service_failed";
11
11
  interface ErrorData {
12
12
  reason?: ErrorReasonName | undefined;
13
13
  cap?: string | undefined;
@@ -23,6 +23,23 @@ interface ErrorData {
23
23
  } | undefined;
24
24
  }
25
25
 
26
+ /**
27
+ * What a connecting side does after each WebSocket close — the ONE table every client reads (the
28
+ * package client, the desktop's relay transport, any other dialer). Never keep a local list of
29
+ * "terminal" codes: a code added to CloseCode without a rule here fails to compile.
30
+ *
31
+ * reconnect_now the far side went away on purpose or the socket died; dial again at once if the
32
+ * connection had opened, with backoff otherwise (a dead network never spins).
33
+ * reconnect transient refusal; dial again with backoff.
34
+ * reauth the token was refused; get a FRESH token and dial once more. A second refusal in
35
+ * a row (no successful open between) is terminal with outcome "signed_out".
36
+ * stop retrying cannot help: stop dialing until something changes (a new sign-in, a
37
+ * new device, an update) and show the outcome.
38
+ */
39
+
40
+ /** The one state a person is shown when dialing stops. */
41
+ type CloseOutcome = "signed_out" | "not_owned" | "removed" | "revoked" | "replaced" | "upgrade_required";
42
+
26
43
  /**
27
44
  * The one error type every package entry throws. It carries the wire ErrorCode (SPEC §5), so a
28
45
  * caller branches on `code`/`retryable`/`data.reason` and never parses a message. Zod-free on
@@ -755,6 +772,261 @@ declare const OPS: {
755
772
  readonly since: "1.0";
756
773
  readonly errors: readonly ["INTERNAL"];
757
774
  };
775
+ readonly "models.status": {
776
+ readonly params: z.ZodObject<{}, z.core.$strict>;
777
+ readonly result: z.ZodObject<{
778
+ service: z.ZodObject<{
779
+ state: z.ZodEnum<{
780
+ starting: "starting";
781
+ ready: "ready";
782
+ restarting: "restarting";
783
+ failed: "failed";
784
+ stopped: "stopped";
785
+ }>;
786
+ pid: z.ZodNullable<z.ZodInt>;
787
+ restarts: z.ZodInt;
788
+ python: z.ZodNullable<z.ZodString>;
789
+ error: z.ZodNullable<z.ZodString>;
790
+ }, z.core.$strict>;
791
+ transcription: z.ZodNullable<z.ZodObject<{
792
+ runtime: z.ZodEnum<{
793
+ failed: "failed";
794
+ not_installed: "not_installed";
795
+ installing: "installing";
796
+ installed: "installed";
797
+ }>;
798
+ install: z.ZodNullable<z.ZodObject<{
799
+ phase: z.ZodEnum<{
800
+ model: "model";
801
+ packages: "packages";
802
+ verifying: "verifying";
803
+ }>;
804
+ item: z.ZodString;
805
+ bytes_done: z.ZodInt;
806
+ bytes_total: z.ZodNullable<z.ZodInt>;
807
+ }, z.core.$strict>>;
808
+ error: z.ZodNullable<z.ZodString>;
809
+ accelerator: z.ZodEnum<{
810
+ cpu: "cpu";
811
+ cuda: "cuda";
812
+ }>;
813
+ models: z.ZodArray<z.ZodObject<{
814
+ id: z.ZodEnum<{
815
+ base: "base";
816
+ small: "small";
817
+ tiny: "tiny";
818
+ "large-v3-turbo": "large-v3-turbo";
819
+ }>;
820
+ size_bytes: z.ZodInt;
821
+ multilingual: z.ZodBoolean;
822
+ installed: z.ZodBoolean;
823
+ }, z.core.$strict>>;
824
+ default_model: z.ZodEnum<{
825
+ base: "base";
826
+ small: "small";
827
+ tiny: "tiny";
828
+ "large-v3-turbo": "large-v3-turbo";
829
+ }>;
830
+ }, z.core.$strict>>;
831
+ }, z.core.$strict>;
832
+ readonly kind: "unary";
833
+ readonly since: "1.2";
834
+ readonly errors: readonly ["INTERNAL"];
835
+ };
836
+ readonly "models.install": {
837
+ readonly params: z.ZodObject<{
838
+ model: z.ZodOptional<z.ZodEnum<{
839
+ base: "base";
840
+ small: "small";
841
+ tiny: "tiny";
842
+ "large-v3-turbo": "large-v3-turbo";
843
+ }>>;
844
+ }, z.core.$strict>;
845
+ readonly result: z.ZodObject<{
846
+ model: z.ZodEnum<{
847
+ base: "base";
848
+ small: "small";
849
+ tiny: "tiny";
850
+ "large-v3-turbo": "large-v3-turbo";
851
+ }>;
852
+ elapsed_ms: z.ZodInt;
853
+ }, z.core.$strict>;
854
+ readonly kind: "unary";
855
+ readonly since: "1.2";
856
+ readonly errors: readonly ["RESOURCE_BUSY", "RESOURCE_GONE", "TIMEOUT", "CANCELLED", "INTERNAL"];
857
+ };
858
+ readonly "models.transcribe": {
859
+ readonly params: z.ZodObject<{
860
+ path: z.ZodString;
861
+ model: z.ZodOptional<z.ZodEnum<{
862
+ base: "base";
863
+ small: "small";
864
+ tiny: "tiny";
865
+ "large-v3-turbo": "large-v3-turbo";
866
+ }>>;
867
+ language: z.ZodOptional<z.ZodString>;
868
+ task: z.ZodDefault<z.ZodEnum<{
869
+ transcribe: "transcribe";
870
+ translate: "translate";
871
+ }>>;
872
+ }, z.core.$strict>;
873
+ readonly result: z.ZodObject<{
874
+ text: z.ZodString;
875
+ language: z.ZodString;
876
+ language_probability: z.ZodNumber;
877
+ duration_s: z.ZodNumber;
878
+ model: z.ZodEnum<{
879
+ base: "base";
880
+ small: "small";
881
+ tiny: "tiny";
882
+ "large-v3-turbo": "large-v3-turbo";
883
+ }>;
884
+ segments: z.ZodArray<z.ZodObject<{
885
+ start_s: z.ZodNumber;
886
+ end_s: z.ZodNumber;
887
+ text: z.ZodString;
888
+ }, z.core.$strict>>;
889
+ elapsed_ms: z.ZodInt;
890
+ }, z.core.$strict>;
891
+ readonly kind: "unary";
892
+ readonly since: "1.2";
893
+ readonly errors: readonly ["NOT_FOUND", "INVALID_PARAMS", "PERMISSION_DENIED_OS", "RESOURCE_BUSY", "RESOURCE_GONE", "CANCELLED", "PAYLOAD_TOO_LARGE", "INTERNAL"];
894
+ };
895
+ readonly "apps.list": {
896
+ readonly params: z.ZodObject<{}, z.core.$strict>;
897
+ readonly result: z.ZodObject<{
898
+ apps: z.ZodArray<z.ZodObject<{
899
+ app_key: z.ZodString;
900
+ name: z.ZodString;
901
+ installed: z.ZodBoolean;
902
+ version: z.ZodNullable<z.ZodString>;
903
+ location: z.ZodNullable<z.ZodString>;
904
+ open: z.ZodObject<{
905
+ status: z.ZodEnum<{
906
+ supported: "supported";
907
+ partial: "partial";
908
+ unsupported: "unsupported";
909
+ }>;
910
+ reason: z.ZodNullable<z.ZodString>;
911
+ }, z.core.$strict>;
912
+ profiles: z.ZodObject<{
913
+ status: z.ZodEnum<{
914
+ supported: "supported";
915
+ partial: "partial";
916
+ unsupported: "unsupported";
917
+ }>;
918
+ reason: z.ZodNullable<z.ZodString>;
919
+ }, z.core.$strict>;
920
+ usage: z.ZodObject<{
921
+ status: z.ZodEnum<{
922
+ supported: "supported";
923
+ partial: "partial";
924
+ unsupported: "unsupported";
925
+ }>;
926
+ reason: z.ZodNullable<z.ZodString>;
927
+ }, z.core.$strict>;
928
+ }, z.core.$strict>>;
929
+ }, z.core.$strict>;
930
+ readonly kind: "unary";
931
+ readonly since: "1.2";
932
+ readonly errors: readonly ["INTERNAL"];
933
+ };
934
+ readonly "apps.profiles.list": {
935
+ readonly params: z.ZodObject<{
936
+ app_key: z.ZodOptional<z.ZodString>;
937
+ }, z.core.$strict>;
938
+ readonly result: z.ZodObject<{
939
+ profiles: z.ZodArray<z.ZodObject<{
940
+ id: z.ZodNullable<z.ZodString>;
941
+ app_key: z.ZodString;
942
+ display_name: z.ZodString;
943
+ account_identity: z.ZodNullable<z.ZodString>;
944
+ profile_locator: z.ZodNullable<z.ZodString>;
945
+ device_id: z.ZodNullable<z.ZodString>;
946
+ folder: z.ZodNullable<z.ZodString>;
947
+ on_disk: z.ZodBoolean;
948
+ running: z.ZodNullable<z.ZodBoolean>;
949
+ usage: z.ZodNullable<z.ZodArray<z.ZodObject<{
950
+ window: z.ZodEnum<{
951
+ five_hour: "five_hour";
952
+ weekly: "weekly";
953
+ extra: "extra";
954
+ }>;
955
+ percent: z.ZodNumber;
956
+ sampled_at_ms: z.ZodInt;
957
+ reset_since: z.ZodBoolean;
958
+ }, z.core.$strict>>>;
959
+ last_opened_ms: z.ZodNullable<z.ZodInt>;
960
+ }, z.core.$strict>>;
961
+ registry: z.ZodEnum<{
962
+ ok: "ok";
963
+ signed_out: "signed_out";
964
+ unavailable: "unavailable";
965
+ }>;
966
+ }, z.core.$strict>;
967
+ readonly kind: "unary";
968
+ readonly since: "1.2";
969
+ readonly errors: readonly ["NOT_FOUND", "INVALID_PARAMS", "INTERNAL"];
970
+ };
971
+ readonly "apps.profiles.save": {
972
+ readonly params: z.ZodObject<{
973
+ id: z.ZodOptional<z.ZodString>;
974
+ app_key: z.ZodString;
975
+ display_name: z.ZodString;
976
+ account_identity: z.ZodNullable<z.ZodString>;
977
+ profile_locator: z.ZodNullable<z.ZodString>;
978
+ new_folder: z.ZodDefault<z.ZodBoolean>;
979
+ }, z.core.$strict>;
980
+ readonly result: z.ZodObject<{
981
+ id: z.ZodNullable<z.ZodString>;
982
+ app_key: z.ZodString;
983
+ display_name: z.ZodString;
984
+ account_identity: z.ZodNullable<z.ZodString>;
985
+ profile_locator: z.ZodNullable<z.ZodString>;
986
+ device_id: z.ZodNullable<z.ZodString>;
987
+ folder: z.ZodNullable<z.ZodString>;
988
+ on_disk: z.ZodBoolean;
989
+ running: z.ZodNullable<z.ZodBoolean>;
990
+ usage: z.ZodNullable<z.ZodArray<z.ZodObject<{
991
+ window: z.ZodEnum<{
992
+ five_hour: "five_hour";
993
+ weekly: "weekly";
994
+ extra: "extra";
995
+ }>;
996
+ percent: z.ZodNumber;
997
+ sampled_at_ms: z.ZodInt;
998
+ reset_since: z.ZodBoolean;
999
+ }, z.core.$strict>>>;
1000
+ last_opened_ms: z.ZodNullable<z.ZodInt>;
1001
+ }, z.core.$strict>;
1002
+ readonly kind: "unary";
1003
+ readonly since: "1.2";
1004
+ readonly errors: readonly ["AUTH_REQUIRED", "AUTH_FORBIDDEN", "NOT_FOUND", "INVALID_PARAMS", "CONFLICT", "PLATFORM_UNSUPPORTED", "DEVICE_OFFLINE", "INTERNAL"];
1005
+ };
1006
+ readonly "apps.profiles.remove": {
1007
+ readonly params: z.ZodObject<{
1008
+ id: z.ZodString;
1009
+ }, z.core.$strict>;
1010
+ readonly result: z.ZodObject<{
1011
+ removed: z.ZodBoolean;
1012
+ }, z.core.$strict>;
1013
+ readonly kind: "unary";
1014
+ readonly since: "1.2";
1015
+ readonly errors: readonly ["AUTH_REQUIRED", "AUTH_FORBIDDEN", "NOT_FOUND", "DEVICE_OFFLINE", "INTERNAL"];
1016
+ };
1017
+ readonly "apps.open": {
1018
+ readonly params: z.ZodObject<{
1019
+ app_key: z.ZodString;
1020
+ profile_id: z.ZodOptional<z.ZodString>;
1021
+ }, z.core.$strict>;
1022
+ readonly result: z.ZodObject<{
1023
+ already_running: z.ZodBoolean;
1024
+ folder: z.ZodNullable<z.ZodString>;
1025
+ }, z.core.$strict>;
1026
+ readonly kind: "unary";
1027
+ readonly since: "1.2";
1028
+ readonly errors: readonly ["NOT_FOUND", "PLATFORM_UNSUPPORTED", "AUTH_REQUIRED", "DEVICE_OFFLINE", "INTERNAL"];
1029
+ };
758
1030
  };
759
1031
  type OpName = keyof typeof OPS;
760
1032
  type OpParams<N extends OpName> = z.input<(typeof OPS)[N]["params"]>;
@@ -806,6 +1078,31 @@ declare const EVENTS: {
806
1078
  read_only: "read_only";
807
1079
  }>;
808
1080
  }, z.core.$strict>;
1081
+ readonly "models.progress": z.ZodObject<{
1082
+ request_id: z.ZodString;
1083
+ progress: z.ZodObject<{
1084
+ kind: z.ZodEnum<{
1085
+ install: "install";
1086
+ transcribe: "transcribe";
1087
+ }>;
1088
+ fraction: z.ZodNullable<z.ZodNumber>;
1089
+ install: z.ZodNullable<z.ZodObject<{
1090
+ phase: z.ZodEnum<{
1091
+ model: "model";
1092
+ packages: "packages";
1093
+ verifying: "verifying";
1094
+ }>;
1095
+ item: z.ZodString;
1096
+ bytes_done: z.ZodInt;
1097
+ bytes_total: z.ZodNullable<z.ZodInt>;
1098
+ }, z.core.$strict>>;
1099
+ segment: z.ZodNullable<z.ZodObject<{
1100
+ start_s: z.ZodNumber;
1101
+ end_s: z.ZodNumber;
1102
+ text: z.ZodString;
1103
+ }, z.core.$strict>>;
1104
+ }, z.core.$strict>;
1105
+ }, z.core.$strict>;
809
1106
  readonly "relay.device_status": z.ZodObject<{
810
1107
  online: z.ZodBoolean;
811
1108
  since_ms: z.ZodNullable<z.ZodInt>;
@@ -839,10 +1136,17 @@ interface DesktopClientState {
839
1136
  retryInMs: number | null;
840
1137
  lastError: DesktopProtocolError | null;
841
1138
  lastCloseCode: number | null;
1139
+ /** Why dialing stopped, when the far side refused us for good (CLOSE_RULES); null otherwise. */
1140
+ outcome: CloseOutcome | null;
842
1141
  }
843
1142
  interface RequestOptions {
844
1143
  signal?: AbortSignal;
845
1144
  timeoutMs?: number;
1145
+ /**
1146
+ * Called with the request's id before it is sent, so progress events for it (e.g.
1147
+ * `models.progress`, whose payload carries `request_id`) can be matched to this call.
1148
+ */
1149
+ onRequestId?: (id: string) => void;
846
1150
  }
847
1151
  type StreamOpName = {
848
1152
  [N in OpName]: (typeof OPS)[N]["kind"] extends "unary" ? never : N;
package/dist/react.d.ts CHANGED
@@ -7,7 +7,7 @@ import { z } from 'zod';
7
7
  * never drift (see the `_assert*` lines there).
8
8
  */
9
9
  type ErrorCodeName = "AUTH_REQUIRED" | "AUTH_INVALID" | "AUTH_EXPIRED" | "AUTH_FORBIDDEN" | "AUTH_DEVICE_REVOKED" | "PERMISSION_DENIED_OS" | "NOT_FOUND" | "CONFLICT" | "INVALID_PARAMS" | "RESOURCE_BUSY" | "RESOURCE_GONE" | "CANCELLED" | "TIMEOUT" | "PLATFORM_UNSUPPORTED" | "RATE_LIMITED" | "INTERNAL" | "PROTOCOL_VERSION_UNSUPPORTED" | "PROTOCOL_ERROR" | "UNKNOWN_OPERATION" | "DEVICE_OFFLINE" | "PAYLOAD_TOO_LARGE";
10
- type ErrorReasonName = "not_a_directory" | "is_a_directory" | "directory_not_empty" | "already_exists" | "stale_write" | "binary_content" | "not_utf8_boundary" | "patch_no_match" | "patch_ambiguous" | "resource_exited" | "resource_expired" | "control_taken" | "window_exhausted";
10
+ type ErrorReasonName = "not_a_directory" | "is_a_directory" | "directory_not_empty" | "already_exists" | "stale_write" | "binary_content" | "not_utf8_boundary" | "patch_no_match" | "patch_ambiguous" | "resource_exited" | "resource_expired" | "control_taken" | "window_exhausted" | "runtime_not_installed" | "model_not_installed" | "unsupported_media" | "download_failed" | "service_starting" | "service_restarted" | "service_failed";
11
11
  interface ErrorData {
12
12
  reason?: ErrorReasonName | undefined;
13
13
  cap?: string | undefined;
@@ -23,6 +23,23 @@ interface ErrorData {
23
23
  } | undefined;
24
24
  }
25
25
 
26
+ /**
27
+ * What a connecting side does after each WebSocket close — the ONE table every client reads (the
28
+ * package client, the desktop's relay transport, any other dialer). Never keep a local list of
29
+ * "terminal" codes: a code added to CloseCode without a rule here fails to compile.
30
+ *
31
+ * reconnect_now the far side went away on purpose or the socket died; dial again at once if the
32
+ * connection had opened, with backoff otherwise (a dead network never spins).
33
+ * reconnect transient refusal; dial again with backoff.
34
+ * reauth the token was refused; get a FRESH token and dial once more. A second refusal in
35
+ * a row (no successful open between) is terminal with outcome "signed_out".
36
+ * stop retrying cannot help: stop dialing until something changes (a new sign-in, a
37
+ * new device, an update) and show the outcome.
38
+ */
39
+
40
+ /** The one state a person is shown when dialing stops. */
41
+ type CloseOutcome = "signed_out" | "not_owned" | "removed" | "revoked" | "replaced" | "upgrade_required";
42
+
26
43
  /**
27
44
  * The one error type every package entry throws. It carries the wire ErrorCode (SPEC §5), so a
28
45
  * caller branches on `code`/`retryable`/`data.reason` and never parses a message. Zod-free on
@@ -755,6 +772,261 @@ declare const OPS: {
755
772
  readonly since: "1.0";
756
773
  readonly errors: readonly ["INTERNAL"];
757
774
  };
775
+ readonly "models.status": {
776
+ readonly params: z.ZodObject<{}, z.core.$strict>;
777
+ readonly result: z.ZodObject<{
778
+ service: z.ZodObject<{
779
+ state: z.ZodEnum<{
780
+ starting: "starting";
781
+ ready: "ready";
782
+ restarting: "restarting";
783
+ failed: "failed";
784
+ stopped: "stopped";
785
+ }>;
786
+ pid: z.ZodNullable<z.ZodInt>;
787
+ restarts: z.ZodInt;
788
+ python: z.ZodNullable<z.ZodString>;
789
+ error: z.ZodNullable<z.ZodString>;
790
+ }, z.core.$strict>;
791
+ transcription: z.ZodNullable<z.ZodObject<{
792
+ runtime: z.ZodEnum<{
793
+ failed: "failed";
794
+ not_installed: "not_installed";
795
+ installing: "installing";
796
+ installed: "installed";
797
+ }>;
798
+ install: z.ZodNullable<z.ZodObject<{
799
+ phase: z.ZodEnum<{
800
+ model: "model";
801
+ packages: "packages";
802
+ verifying: "verifying";
803
+ }>;
804
+ item: z.ZodString;
805
+ bytes_done: z.ZodInt;
806
+ bytes_total: z.ZodNullable<z.ZodInt>;
807
+ }, z.core.$strict>>;
808
+ error: z.ZodNullable<z.ZodString>;
809
+ accelerator: z.ZodEnum<{
810
+ cpu: "cpu";
811
+ cuda: "cuda";
812
+ }>;
813
+ models: z.ZodArray<z.ZodObject<{
814
+ id: z.ZodEnum<{
815
+ base: "base";
816
+ small: "small";
817
+ tiny: "tiny";
818
+ "large-v3-turbo": "large-v3-turbo";
819
+ }>;
820
+ size_bytes: z.ZodInt;
821
+ multilingual: z.ZodBoolean;
822
+ installed: z.ZodBoolean;
823
+ }, z.core.$strict>>;
824
+ default_model: z.ZodEnum<{
825
+ base: "base";
826
+ small: "small";
827
+ tiny: "tiny";
828
+ "large-v3-turbo": "large-v3-turbo";
829
+ }>;
830
+ }, z.core.$strict>>;
831
+ }, z.core.$strict>;
832
+ readonly kind: "unary";
833
+ readonly since: "1.2";
834
+ readonly errors: readonly ["INTERNAL"];
835
+ };
836
+ readonly "models.install": {
837
+ readonly params: z.ZodObject<{
838
+ model: z.ZodOptional<z.ZodEnum<{
839
+ base: "base";
840
+ small: "small";
841
+ tiny: "tiny";
842
+ "large-v3-turbo": "large-v3-turbo";
843
+ }>>;
844
+ }, z.core.$strict>;
845
+ readonly result: z.ZodObject<{
846
+ model: z.ZodEnum<{
847
+ base: "base";
848
+ small: "small";
849
+ tiny: "tiny";
850
+ "large-v3-turbo": "large-v3-turbo";
851
+ }>;
852
+ elapsed_ms: z.ZodInt;
853
+ }, z.core.$strict>;
854
+ readonly kind: "unary";
855
+ readonly since: "1.2";
856
+ readonly errors: readonly ["RESOURCE_BUSY", "RESOURCE_GONE", "TIMEOUT", "CANCELLED", "INTERNAL"];
857
+ };
858
+ readonly "models.transcribe": {
859
+ readonly params: z.ZodObject<{
860
+ path: z.ZodString;
861
+ model: z.ZodOptional<z.ZodEnum<{
862
+ base: "base";
863
+ small: "small";
864
+ tiny: "tiny";
865
+ "large-v3-turbo": "large-v3-turbo";
866
+ }>>;
867
+ language: z.ZodOptional<z.ZodString>;
868
+ task: z.ZodDefault<z.ZodEnum<{
869
+ transcribe: "transcribe";
870
+ translate: "translate";
871
+ }>>;
872
+ }, z.core.$strict>;
873
+ readonly result: z.ZodObject<{
874
+ text: z.ZodString;
875
+ language: z.ZodString;
876
+ language_probability: z.ZodNumber;
877
+ duration_s: z.ZodNumber;
878
+ model: z.ZodEnum<{
879
+ base: "base";
880
+ small: "small";
881
+ tiny: "tiny";
882
+ "large-v3-turbo": "large-v3-turbo";
883
+ }>;
884
+ segments: z.ZodArray<z.ZodObject<{
885
+ start_s: z.ZodNumber;
886
+ end_s: z.ZodNumber;
887
+ text: z.ZodString;
888
+ }, z.core.$strict>>;
889
+ elapsed_ms: z.ZodInt;
890
+ }, z.core.$strict>;
891
+ readonly kind: "unary";
892
+ readonly since: "1.2";
893
+ readonly errors: readonly ["NOT_FOUND", "INVALID_PARAMS", "PERMISSION_DENIED_OS", "RESOURCE_BUSY", "RESOURCE_GONE", "CANCELLED", "PAYLOAD_TOO_LARGE", "INTERNAL"];
894
+ };
895
+ readonly "apps.list": {
896
+ readonly params: z.ZodObject<{}, z.core.$strict>;
897
+ readonly result: z.ZodObject<{
898
+ apps: z.ZodArray<z.ZodObject<{
899
+ app_key: z.ZodString;
900
+ name: z.ZodString;
901
+ installed: z.ZodBoolean;
902
+ version: z.ZodNullable<z.ZodString>;
903
+ location: z.ZodNullable<z.ZodString>;
904
+ open: z.ZodObject<{
905
+ status: z.ZodEnum<{
906
+ supported: "supported";
907
+ partial: "partial";
908
+ unsupported: "unsupported";
909
+ }>;
910
+ reason: z.ZodNullable<z.ZodString>;
911
+ }, z.core.$strict>;
912
+ profiles: z.ZodObject<{
913
+ status: z.ZodEnum<{
914
+ supported: "supported";
915
+ partial: "partial";
916
+ unsupported: "unsupported";
917
+ }>;
918
+ reason: z.ZodNullable<z.ZodString>;
919
+ }, z.core.$strict>;
920
+ usage: z.ZodObject<{
921
+ status: z.ZodEnum<{
922
+ supported: "supported";
923
+ partial: "partial";
924
+ unsupported: "unsupported";
925
+ }>;
926
+ reason: z.ZodNullable<z.ZodString>;
927
+ }, z.core.$strict>;
928
+ }, z.core.$strict>>;
929
+ }, z.core.$strict>;
930
+ readonly kind: "unary";
931
+ readonly since: "1.2";
932
+ readonly errors: readonly ["INTERNAL"];
933
+ };
934
+ readonly "apps.profiles.list": {
935
+ readonly params: z.ZodObject<{
936
+ app_key: z.ZodOptional<z.ZodString>;
937
+ }, z.core.$strict>;
938
+ readonly result: z.ZodObject<{
939
+ profiles: z.ZodArray<z.ZodObject<{
940
+ id: z.ZodNullable<z.ZodString>;
941
+ app_key: z.ZodString;
942
+ display_name: z.ZodString;
943
+ account_identity: z.ZodNullable<z.ZodString>;
944
+ profile_locator: z.ZodNullable<z.ZodString>;
945
+ device_id: z.ZodNullable<z.ZodString>;
946
+ folder: z.ZodNullable<z.ZodString>;
947
+ on_disk: z.ZodBoolean;
948
+ running: z.ZodNullable<z.ZodBoolean>;
949
+ usage: z.ZodNullable<z.ZodArray<z.ZodObject<{
950
+ window: z.ZodEnum<{
951
+ five_hour: "five_hour";
952
+ weekly: "weekly";
953
+ extra: "extra";
954
+ }>;
955
+ percent: z.ZodNumber;
956
+ sampled_at_ms: z.ZodInt;
957
+ reset_since: z.ZodBoolean;
958
+ }, z.core.$strict>>>;
959
+ last_opened_ms: z.ZodNullable<z.ZodInt>;
960
+ }, z.core.$strict>>;
961
+ registry: z.ZodEnum<{
962
+ ok: "ok";
963
+ signed_out: "signed_out";
964
+ unavailable: "unavailable";
965
+ }>;
966
+ }, z.core.$strict>;
967
+ readonly kind: "unary";
968
+ readonly since: "1.2";
969
+ readonly errors: readonly ["NOT_FOUND", "INVALID_PARAMS", "INTERNAL"];
970
+ };
971
+ readonly "apps.profiles.save": {
972
+ readonly params: z.ZodObject<{
973
+ id: z.ZodOptional<z.ZodString>;
974
+ app_key: z.ZodString;
975
+ display_name: z.ZodString;
976
+ account_identity: z.ZodNullable<z.ZodString>;
977
+ profile_locator: z.ZodNullable<z.ZodString>;
978
+ new_folder: z.ZodDefault<z.ZodBoolean>;
979
+ }, z.core.$strict>;
980
+ readonly result: z.ZodObject<{
981
+ id: z.ZodNullable<z.ZodString>;
982
+ app_key: z.ZodString;
983
+ display_name: z.ZodString;
984
+ account_identity: z.ZodNullable<z.ZodString>;
985
+ profile_locator: z.ZodNullable<z.ZodString>;
986
+ device_id: z.ZodNullable<z.ZodString>;
987
+ folder: z.ZodNullable<z.ZodString>;
988
+ on_disk: z.ZodBoolean;
989
+ running: z.ZodNullable<z.ZodBoolean>;
990
+ usage: z.ZodNullable<z.ZodArray<z.ZodObject<{
991
+ window: z.ZodEnum<{
992
+ five_hour: "five_hour";
993
+ weekly: "weekly";
994
+ extra: "extra";
995
+ }>;
996
+ percent: z.ZodNumber;
997
+ sampled_at_ms: z.ZodInt;
998
+ reset_since: z.ZodBoolean;
999
+ }, z.core.$strict>>>;
1000
+ last_opened_ms: z.ZodNullable<z.ZodInt>;
1001
+ }, z.core.$strict>;
1002
+ readonly kind: "unary";
1003
+ readonly since: "1.2";
1004
+ readonly errors: readonly ["AUTH_REQUIRED", "AUTH_FORBIDDEN", "NOT_FOUND", "INVALID_PARAMS", "CONFLICT", "PLATFORM_UNSUPPORTED", "DEVICE_OFFLINE", "INTERNAL"];
1005
+ };
1006
+ readonly "apps.profiles.remove": {
1007
+ readonly params: z.ZodObject<{
1008
+ id: z.ZodString;
1009
+ }, z.core.$strict>;
1010
+ readonly result: z.ZodObject<{
1011
+ removed: z.ZodBoolean;
1012
+ }, z.core.$strict>;
1013
+ readonly kind: "unary";
1014
+ readonly since: "1.2";
1015
+ readonly errors: readonly ["AUTH_REQUIRED", "AUTH_FORBIDDEN", "NOT_FOUND", "DEVICE_OFFLINE", "INTERNAL"];
1016
+ };
1017
+ readonly "apps.open": {
1018
+ readonly params: z.ZodObject<{
1019
+ app_key: z.ZodString;
1020
+ profile_id: z.ZodOptional<z.ZodString>;
1021
+ }, z.core.$strict>;
1022
+ readonly result: z.ZodObject<{
1023
+ already_running: z.ZodBoolean;
1024
+ folder: z.ZodNullable<z.ZodString>;
1025
+ }, z.core.$strict>;
1026
+ readonly kind: "unary";
1027
+ readonly since: "1.2";
1028
+ readonly errors: readonly ["NOT_FOUND", "PLATFORM_UNSUPPORTED", "AUTH_REQUIRED", "DEVICE_OFFLINE", "INTERNAL"];
1029
+ };
758
1030
  };
759
1031
  type OpName = keyof typeof OPS;
760
1032
  type OpParams<N extends OpName> = z.input<(typeof OPS)[N]["params"]>;
@@ -806,6 +1078,31 @@ declare const EVENTS: {
806
1078
  read_only: "read_only";
807
1079
  }>;
808
1080
  }, z.core.$strict>;
1081
+ readonly "models.progress": z.ZodObject<{
1082
+ request_id: z.ZodString;
1083
+ progress: z.ZodObject<{
1084
+ kind: z.ZodEnum<{
1085
+ install: "install";
1086
+ transcribe: "transcribe";
1087
+ }>;
1088
+ fraction: z.ZodNullable<z.ZodNumber>;
1089
+ install: z.ZodNullable<z.ZodObject<{
1090
+ phase: z.ZodEnum<{
1091
+ model: "model";
1092
+ packages: "packages";
1093
+ verifying: "verifying";
1094
+ }>;
1095
+ item: z.ZodString;
1096
+ bytes_done: z.ZodInt;
1097
+ bytes_total: z.ZodNullable<z.ZodInt>;
1098
+ }, z.core.$strict>>;
1099
+ segment: z.ZodNullable<z.ZodObject<{
1100
+ start_s: z.ZodNumber;
1101
+ end_s: z.ZodNumber;
1102
+ text: z.ZodString;
1103
+ }, z.core.$strict>>;
1104
+ }, z.core.$strict>;
1105
+ }, z.core.$strict>;
809
1106
  readonly "relay.device_status": z.ZodObject<{
810
1107
  online: z.ZodBoolean;
811
1108
  since_ms: z.ZodNullable<z.ZodInt>;
@@ -839,10 +1136,17 @@ interface DesktopClientState {
839
1136
  retryInMs: number | null;
840
1137
  lastError: DesktopProtocolError | null;
841
1138
  lastCloseCode: number | null;
1139
+ /** Why dialing stopped, when the far side refused us for good (CLOSE_RULES); null otherwise. */
1140
+ outcome: CloseOutcome | null;
842
1141
  }
843
1142
  interface RequestOptions {
844
1143
  signal?: AbortSignal;
845
1144
  timeoutMs?: number;
1145
+ /**
1146
+ * Called with the request's id before it is sent, so progress events for it (e.g.
1147
+ * `models.progress`, whose payload carries `request_id`) can be matched to this call.
1148
+ */
1149
+ onRequestId?: (id: string) => void;
846
1150
  }
847
1151
  type StreamOpName = {
848
1152
  [N in OpName]: (typeof OPS)[N]["kind"] extends "unary" ? never : N;