@ai-matrx/desktop-protocol 0.14.0 → 0.16.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/CHANGELOG.md +29 -0
- package/dist/client.cjs +474 -38
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.cts +2 -2
- package/dist/client.d.ts +2 -2
- package/dist/client.js +474 -38
- package/dist/client.js.map +1 -1
- package/dist/index.cjs +587 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +839 -6
- package/dist/index.d.ts +839 -6
- package/dist/index.js +587 -14
- package/dist/index.js.map +1 -1
- package/dist/{models-DqFPqtNS.d.cts → models-k4pDkXUe.d.cts} +1372 -1
- package/dist/{models-DqFPqtNS.d.ts → models-k4pDkXUe.d.ts} +1372 -1
- package/dist/react.d.cts +599 -1
- package/dist/react.d.ts +599 -1
- package/generated/desktop-protocol.schema.json +1918 -19
- package/package.json +1 -1
package/dist/client.d.cts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { BackoffOptions } from '@ai-matrx/realtime';
|
|
2
2
|
export { RECONNECT_ALARM_ATTEMPTS } from '@ai-matrx/realtime';
|
|
3
3
|
import { z } from 'zod';
|
|
4
|
-
import { W as Welcome, D as DesktopProtocolError, C as CloseOutcome, O as OpName, a as OpParams, b as OpResult, c as OPS, S as StreamMeta, E as EndReason, d as EVENTS, e as ClientType, M as ModelsTranscribeResult, T as TranscriptionModelId, f as MlProgress } from './models-
|
|
5
|
-
export { i as isDesktopProtocolError } from './models-
|
|
4
|
+
import { W as Welcome, D as DesktopProtocolError, C as CloseOutcome, O as OpName, a as OpParams, b as OpResult, c as OPS, S as StreamMeta, E as EndReason, d as EVENTS, e as ClientType, M as ModelsTranscribeResult, T as TranscriptionModelId, f as MlProgress } from './models-k4pDkXUe.cjs';
|
|
5
|
+
export { i as isDesktopProtocolError } from './models-k4pDkXUe.cjs';
|
|
6
6
|
import { FrameHeader } from './frame.cjs';
|
|
7
7
|
|
|
8
8
|
/** The subset of the WHATWG WebSocket the client uses — browser, React Native, `ws` and Workers all fit. */
|
package/dist/client.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { BackoffOptions } from '@ai-matrx/realtime';
|
|
2
2
|
export { RECONNECT_ALARM_ATTEMPTS } from '@ai-matrx/realtime';
|
|
3
3
|
import { z } from 'zod';
|
|
4
|
-
import { W as Welcome, D as DesktopProtocolError, C as CloseOutcome, O as OpName, a as OpParams, b as OpResult, c as OPS, S as StreamMeta, E as EndReason, d as EVENTS, e as ClientType, M as ModelsTranscribeResult, T as TranscriptionModelId, f as MlProgress } from './models-
|
|
5
|
-
export { i as isDesktopProtocolError } from './models-
|
|
4
|
+
import { W as Welcome, D as DesktopProtocolError, C as CloseOutcome, O as OpName, a as OpParams, b as OpResult, c as OPS, S as StreamMeta, E as EndReason, d as EVENTS, e as ClientType, M as ModelsTranscribeResult, T as TranscriptionModelId, f as MlProgress } from './models-k4pDkXUe.js';
|
|
5
|
+
export { i as isDesktopProtocolError } from './models-k4pDkXUe.js';
|
|
6
6
|
import { FrameHeader } from './frame.js';
|
|
7
7
|
|
|
8
8
|
/** The subset of the WHATWG WebSocket the client uses — browser, React Native, `ws` and Workers all fit. */
|
package/dist/client.js
CHANGED
|
@@ -94,7 +94,7 @@ import { z as z2 } from "zod";
|
|
|
94
94
|
// src/schema/primitives.ts
|
|
95
95
|
import { z } from "zod";
|
|
96
96
|
var PROTOCOL_MAJOR = 1;
|
|
97
|
-
var PROTOCOL_MINOR =
|
|
97
|
+
var PROTOCOL_MINOR = 5;
|
|
98
98
|
var PROTOCOL_VERSION = `${PROTOCOL_MAJOR}.${PROTOCOL_MINOR}`;
|
|
99
99
|
var ProtocolVersion = z.string().regex(/^[1-9][0-9]{0,2}\.[0-9]{1,3}$/);
|
|
100
100
|
var RequestId = z.string().min(1).max(64).regex(/^[A-Za-z0-9_-]+$/);
|
|
@@ -844,23 +844,433 @@ var ProcKillResult = z12.strictObject({
|
|
|
844
844
|
exited: z12.boolean()
|
|
845
845
|
});
|
|
846
846
|
|
|
847
|
-
// src/schema/
|
|
847
|
+
// src/schema/system.ts
|
|
848
848
|
import { z as z13 } from "zod";
|
|
849
|
-
var
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
var
|
|
849
|
+
var SystemOpenUrlParams = z13.strictObject({
|
|
850
|
+
/** http, https or mailto; opened in the person's default app for it. */
|
|
851
|
+
url: z13.string().min(1).max(4096)
|
|
852
|
+
});
|
|
853
|
+
var SystemOpenUrlResult = z13.strictObject({ url: z13.string().max(4096) });
|
|
854
|
+
var SystemOpenPathParams = z13.strictObject({
|
|
855
|
+
path: AbsPath,
|
|
856
|
+
/** Show it in the file manager (Finder, Explorer) instead of opening it. */
|
|
857
|
+
reveal: z13.boolean().default(false)
|
|
858
|
+
});
|
|
859
|
+
var SystemOpenPathResult = z13.strictObject({ path: AbsPath, revealed: z13.boolean() });
|
|
860
|
+
var SystemNotifyParams = z13.strictObject({
|
|
861
|
+
title: z13.string().min(1).max(128),
|
|
862
|
+
body: z13.string().max(1024).default("")
|
|
863
|
+
});
|
|
864
|
+
var SystemNotifyResult = z13.strictObject({
|
|
865
|
+
/** False when this computer has no notification service to show it (a bare Linux box). */
|
|
866
|
+
shown: z13.boolean()
|
|
867
|
+
});
|
|
868
|
+
|
|
869
|
+
// src/schema/screen.ts
|
|
870
|
+
import { z as z14 } from "zod";
|
|
871
|
+
var ScreenDisplay = z14.strictObject({
|
|
872
|
+
/** The OS's display id; pass it to screen.capture. */
|
|
873
|
+
id: nonNegInt,
|
|
874
|
+
name: z14.string().max(128),
|
|
875
|
+
/** Position and size in the OS's logical points (x and y may be negative left of or above the main display). */
|
|
876
|
+
x: z14.int(),
|
|
877
|
+
y: z14.int(),
|
|
878
|
+
width: z14.int().min(1),
|
|
879
|
+
height: z14.int().min(1),
|
|
880
|
+
/** Pixels per point (2 on a Retina display). */
|
|
881
|
+
scale: z14.number().min(0.1).max(8),
|
|
882
|
+
primary: z14.boolean()
|
|
883
|
+
});
|
|
884
|
+
var ScreenListParams = z14.strictObject({});
|
|
885
|
+
var ScreenListResult = z14.strictObject({ displays: z14.array(ScreenDisplay).max(32) });
|
|
886
|
+
var ScreenCaptureParams = z14.strictObject({
|
|
887
|
+
/** The display (from screen.list); the primary display when absent. */
|
|
888
|
+
display_id: nonNegInt.optional(),
|
|
889
|
+
format: z14.enum(["jpeg", "png"]).default("jpeg"),
|
|
890
|
+
/** Scale the picture down to at most this width in pixels (kept when already smaller). */
|
|
891
|
+
max_width: z14.int().min(160).max(7680).default(1600)
|
|
892
|
+
});
|
|
893
|
+
var ScreenCaptureResult = z14.strictObject({
|
|
894
|
+
display_id: nonNegInt,
|
|
895
|
+
mime_type: z14.enum(["image/jpeg", "image/png"]),
|
|
896
|
+
width: z14.int().min(1),
|
|
897
|
+
height: z14.int().min(1),
|
|
898
|
+
/** The display's full resolution in pixels, before scaling. */
|
|
899
|
+
source_width: z14.int().min(1),
|
|
900
|
+
source_height: z14.int().min(1),
|
|
901
|
+
/** The image, base64 (at most 6 MiB of text). */
|
|
902
|
+
data_base64: z14.string().max(6291456)
|
|
903
|
+
});
|
|
904
|
+
|
|
905
|
+
// src/schema/window.ts
|
|
906
|
+
import { z as z15 } from "zod";
|
|
907
|
+
var WindowInfo = z15.strictObject({
|
|
908
|
+
/** The OS's window handle (macOS window number, Windows HWND, X11 window id). */
|
|
909
|
+
id: nonNegInt,
|
|
910
|
+
title: z15.string().max(512),
|
|
911
|
+
/** Position and size in logical points. */
|
|
912
|
+
x: z15.int(),
|
|
913
|
+
y: z15.int(),
|
|
914
|
+
width: z15.int().min(0),
|
|
915
|
+
height: z15.int().min(0)
|
|
916
|
+
});
|
|
917
|
+
var WindowListParams = z15.strictObject({
|
|
918
|
+
/** Case-insensitive substring of the window title. */
|
|
919
|
+
title: z15.string().min(1).max(256).optional(),
|
|
920
|
+
limit: z15.int().min(1).max(500).default(100)
|
|
921
|
+
});
|
|
922
|
+
var WindowListResult = z15.strictObject({
|
|
923
|
+
windows: z15.array(WindowInfo).max(500),
|
|
924
|
+
total: nonNegInt,
|
|
925
|
+
truncated: z15.boolean()
|
|
926
|
+
});
|
|
927
|
+
var WindowFocusParams = z15.strictObject({ id: nonNegInt });
|
|
928
|
+
var WindowFocusResult = z15.strictObject({ window: WindowInfo });
|
|
929
|
+
var WindowMoveParams = z15.strictObject({
|
|
930
|
+
id: nonNegInt,
|
|
931
|
+
/** New top-left corner; unchanged when absent. */
|
|
932
|
+
x: z15.int().optional(),
|
|
933
|
+
y: z15.int().optional(),
|
|
934
|
+
/** New size; unchanged when absent. */
|
|
935
|
+
width: z15.int().min(50).max(16384).optional(),
|
|
936
|
+
height: z15.int().min(50).max(16384).optional()
|
|
937
|
+
});
|
|
938
|
+
var WindowMoveResult = z15.strictObject({ window: WindowInfo });
|
|
939
|
+
var WindowMinimizeParams = z15.strictObject({ id: nonNegInt });
|
|
940
|
+
var WindowMinimizeResult = z15.strictObject({ id: nonNegInt });
|
|
941
|
+
|
|
942
|
+
// src/schema/input.ts
|
|
943
|
+
import { z as z16 } from "zod";
|
|
944
|
+
var InputKey = z16.enum([
|
|
945
|
+
"cmd",
|
|
946
|
+
"ctrl",
|
|
947
|
+
"alt",
|
|
948
|
+
"shift",
|
|
949
|
+
"meta",
|
|
950
|
+
"a",
|
|
951
|
+
"b",
|
|
952
|
+
"c",
|
|
953
|
+
"d",
|
|
954
|
+
"e",
|
|
955
|
+
"f",
|
|
956
|
+
"g",
|
|
957
|
+
"h",
|
|
958
|
+
"i",
|
|
959
|
+
"j",
|
|
960
|
+
"k",
|
|
961
|
+
"l",
|
|
962
|
+
"m",
|
|
963
|
+
"n",
|
|
964
|
+
"o",
|
|
965
|
+
"p",
|
|
966
|
+
"q",
|
|
967
|
+
"r",
|
|
968
|
+
"s",
|
|
969
|
+
"t",
|
|
970
|
+
"u",
|
|
971
|
+
"v",
|
|
972
|
+
"w",
|
|
973
|
+
"x",
|
|
974
|
+
"y",
|
|
975
|
+
"z",
|
|
976
|
+
"0",
|
|
977
|
+
"1",
|
|
978
|
+
"2",
|
|
979
|
+
"3",
|
|
980
|
+
"4",
|
|
981
|
+
"5",
|
|
982
|
+
"6",
|
|
983
|
+
"7",
|
|
984
|
+
"8",
|
|
985
|
+
"9",
|
|
986
|
+
"f1",
|
|
987
|
+
"f2",
|
|
988
|
+
"f3",
|
|
989
|
+
"f4",
|
|
990
|
+
"f5",
|
|
991
|
+
"f6",
|
|
992
|
+
"f7",
|
|
993
|
+
"f8",
|
|
994
|
+
"f9",
|
|
995
|
+
"f10",
|
|
996
|
+
"f11",
|
|
997
|
+
"f12",
|
|
998
|
+
"enter",
|
|
999
|
+
"tab",
|
|
1000
|
+
"escape",
|
|
1001
|
+
"space",
|
|
1002
|
+
"backspace",
|
|
1003
|
+
"delete",
|
|
1004
|
+
"up",
|
|
1005
|
+
"down",
|
|
1006
|
+
"left",
|
|
1007
|
+
"right",
|
|
1008
|
+
"home",
|
|
1009
|
+
"end",
|
|
1010
|
+
"pageup",
|
|
1011
|
+
"pagedown",
|
|
1012
|
+
"minus",
|
|
1013
|
+
"equal",
|
|
1014
|
+
"comma",
|
|
1015
|
+
"period",
|
|
1016
|
+
"slash",
|
|
1017
|
+
"semicolon",
|
|
1018
|
+
"quote",
|
|
1019
|
+
"bracketleft",
|
|
1020
|
+
"bracketright",
|
|
1021
|
+
"backslash",
|
|
1022
|
+
"grave"
|
|
1023
|
+
]);
|
|
1024
|
+
var InputTypeTextParams = z16.strictObject({ text: z16.string().min(1).max(1e4) });
|
|
1025
|
+
var InputTypeTextResult = z16.strictObject({ characters: z16.int().min(1) });
|
|
1026
|
+
var InputHotkeyParams = z16.strictObject({
|
|
1027
|
+
/** Pressed together in order and released in reverse: ["cmd", "shift", "t"]. */
|
|
1028
|
+
keys: z16.array(InputKey).min(1).max(6)
|
|
1029
|
+
});
|
|
1030
|
+
var InputHotkeyResult = z16.strictObject({ keys: z16.array(InputKey) });
|
|
1031
|
+
var InputPoint = z16.strictObject({ x: z16.int(), y: z16.int() });
|
|
1032
|
+
var InputMouseMoveParams = z16.strictObject({
|
|
1033
|
+
/** Screen position in logical points (the coordinates screen.list and window.list report). */
|
|
1034
|
+
x: z16.int(),
|
|
1035
|
+
y: z16.int()
|
|
1036
|
+
});
|
|
1037
|
+
var InputMouseMoveResult = z16.strictObject({
|
|
1038
|
+
/** Where the pointer is now, read back from the OS. */
|
|
1039
|
+
position: InputPoint
|
|
1040
|
+
});
|
|
1041
|
+
var InputMouseClickParams = z16.strictObject({
|
|
1042
|
+
/** Move here first; clicks where the pointer is when absent. */
|
|
1043
|
+
x: z16.int().optional(),
|
|
1044
|
+
y: z16.int().optional(),
|
|
1045
|
+
button: z16.enum(["left", "right", "middle"]).default("left"),
|
|
1046
|
+
double: z16.boolean().default(false)
|
|
1047
|
+
});
|
|
1048
|
+
var InputMouseClickResult = z16.strictObject({
|
|
1049
|
+
position: InputPoint,
|
|
1050
|
+
button: z16.enum(["left", "right", "middle"]),
|
|
1051
|
+
double: z16.boolean()
|
|
1052
|
+
});
|
|
1053
|
+
|
|
1054
|
+
// src/schema/power.ts
|
|
1055
|
+
import { z as z17 } from "zod";
|
|
1056
|
+
var PowerStatusParams = z17.strictObject({});
|
|
1057
|
+
var PowerStatusResult = z17.strictObject({
|
|
1058
|
+
has_battery: z17.boolean(),
|
|
1059
|
+
/** 0–100; null without a battery. */
|
|
1060
|
+
percent: z17.number().min(0).max(100).nullable(),
|
|
1061
|
+
charging: z17.boolean().nullable(),
|
|
1062
|
+
/** On wall power; null where the OS does not say. */
|
|
1063
|
+
plugged_in: z17.boolean().nullable(),
|
|
1064
|
+
/** Minutes of battery left; null when charging, unknown or without a battery. */
|
|
1065
|
+
minutes_left: nonNegInt.nullable(),
|
|
1066
|
+
/** Matrx 2 is keeping the computer awake (power.prevent_sleep) until this time; null when it is not. */
|
|
1067
|
+
awake_until_ms: epochMs.nullable()
|
|
1068
|
+
});
|
|
1069
|
+
var PowerPreventSleepParams = z17.strictObject({
|
|
1070
|
+
/** Keep the computer awake this long; 0 lets it sleep again now. */
|
|
1071
|
+
seconds: z17.int().min(0).max(86400),
|
|
1072
|
+
/** Shown where the OS lists what keeps it awake. */
|
|
1073
|
+
reason: z17.string().min(1).max(128).default("Matrx 2 is working")
|
|
1074
|
+
});
|
|
1075
|
+
var PowerPreventSleepResult = z17.strictObject({
|
|
1076
|
+
/** When it may sleep again; null after seconds 0. */
|
|
1077
|
+
awake_until_ms: epochMs.nullable()
|
|
1078
|
+
});
|
|
1079
|
+
|
|
1080
|
+
// src/schema/resources.ts
|
|
1081
|
+
import { z as z18 } from "zod";
|
|
1082
|
+
var ResourcesDisk = z18.strictObject({
|
|
1083
|
+
/** Where it is mounted ("/", "C:"). */
|
|
1084
|
+
mount: z18.string().max(512),
|
|
1085
|
+
/** The file system ("apfs", "NTFS", "ext4"). */
|
|
1086
|
+
fs: z18.string().max(64),
|
|
1087
|
+
size_bytes: nonNegInt,
|
|
1088
|
+
used_bytes: nonNegInt,
|
|
1089
|
+
available_bytes: nonNegInt
|
|
1090
|
+
});
|
|
1091
|
+
var ResourcesSnapshotParams = z18.strictObject({});
|
|
1092
|
+
var ResourcesSnapshotResult = z18.strictObject({
|
|
1093
|
+
cpu: z18.strictObject({
|
|
1094
|
+
/** Busy share of all cores, 0–100, measured now. */
|
|
1095
|
+
percent: z18.number().min(0).max(100),
|
|
1096
|
+
cores: z18.int().min(1),
|
|
1097
|
+
/** 1, 5 and 15 minute load averages; null on Windows. */
|
|
1098
|
+
load: z18.array(z18.number().min(0)).length(3).nullable()
|
|
1099
|
+
}),
|
|
1100
|
+
memory: z18.strictObject({ total_bytes: nonNegInt, used_bytes: nonNegInt, available_bytes: nonNegInt }),
|
|
1101
|
+
swap: z18.strictObject({ total_bytes: nonNegInt, used_bytes: nonNegInt }),
|
|
1102
|
+
disks: z18.array(ResourcesDisk).max(64),
|
|
1103
|
+
uptime_seconds: nonNegInt
|
|
1104
|
+
});
|
|
1105
|
+
|
|
1106
|
+
// src/schema/fs-watch.ts
|
|
1107
|
+
import { z as z19 } from "zod";
|
|
1108
|
+
var FsWatchId = z19.string().regex(/^fw_[A-Za-z0-9]{12,40}$/);
|
|
1109
|
+
var FsWatchStartParams = z19.strictObject({
|
|
1110
|
+
path: AbsPath,
|
|
1111
|
+
recursive: z19.boolean().default(true),
|
|
1112
|
+
/** Globs relative to `path` whose changes are not reported (".git/**", "node_modules/**"). */
|
|
1113
|
+
ignore: z19.array(z19.string().max(256)).max(64).default([])
|
|
1114
|
+
});
|
|
1115
|
+
var FsWatchStartResult = z19.strictObject({
|
|
1116
|
+
watch_id: FsWatchId,
|
|
1117
|
+
path: AbsPath,
|
|
1118
|
+
/** The watch ends by itself if nobody reads it for 30 minutes. */
|
|
1119
|
+
expires_at_ms: epochMs
|
|
1120
|
+
});
|
|
1121
|
+
var FsWatchEventsParams = z19.strictObject({
|
|
1122
|
+
watch_id: FsWatchId,
|
|
1123
|
+
/** Wait up to this long for a first change when none is waiting (0 answers at once). */
|
|
1124
|
+
wait_ms: z19.int().min(0).max(25e3).default(0)
|
|
1125
|
+
});
|
|
1126
|
+
var FsWatchEventsResult = z19.strictObject({
|
|
1127
|
+
/** What changed since the last read, oldest first; re-checked against the disk when read. */
|
|
1128
|
+
changes: z19.array(FsChange).max(1e3),
|
|
1129
|
+
/** Changes were dropped (more than 1000 waited): list the folder again. */
|
|
1130
|
+
overflow: z19.boolean(),
|
|
1131
|
+
expires_at_ms: epochMs
|
|
1132
|
+
});
|
|
1133
|
+
var FsWatchStopParams = z19.strictObject({ watch_id: FsWatchId });
|
|
1134
|
+
var FsWatchStopResult = z19.strictObject({ watch_id: FsWatchId });
|
|
1135
|
+
|
|
1136
|
+
// src/schema/exec-job.ts
|
|
1137
|
+
import { z as z20 } from "zod";
|
|
1138
|
+
var ExecJobId = z20.string().regex(/^job_[A-Za-z0-9]{12,40}$/);
|
|
1139
|
+
var ExecJobStartParams = z20.strictObject({
|
|
1140
|
+
command: z20.string().min(1).max(131072),
|
|
1141
|
+
/** The folder it runs in; the home folder when absent. */
|
|
1142
|
+
cwd: AbsPath.optional(),
|
|
1143
|
+
env: z20.record(z20.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/).max(128), z20.string().max(32768)).optional()
|
|
1144
|
+
});
|
|
1145
|
+
var ExecJobStartResult = z20.strictObject({ job_id: ExecJobId, pid: z20.int().min(1), cwd: AbsPath });
|
|
1146
|
+
var ExecJobOutputParams = z20.strictObject({
|
|
1147
|
+
job_id: ExecJobId,
|
|
1148
|
+
/** Byte offset into the job's output to read from (next_offset of the last read; 0 = the start). */
|
|
1149
|
+
offset: nonNegInt.default(0),
|
|
1150
|
+
/** Wait up to this long for new output or the exit when none is waiting (0 answers at once). */
|
|
1151
|
+
wait_ms: z20.int().min(0).max(25e3).default(0),
|
|
1152
|
+
max_bytes: z20.int().min(1024).max(1048576).default(65536)
|
|
1153
|
+
});
|
|
1154
|
+
var ExecJobOutputResult = z20.strictObject({
|
|
1155
|
+
/** stdout and stderr interleaved as they arrived (UTF-8). */
|
|
1156
|
+
output: z20.string(),
|
|
1157
|
+
next_offset: nonNegInt,
|
|
1158
|
+
/** Bytes before `offset` that are gone (the job keeps its last 4 MiB). */
|
|
1159
|
+
dropped_bytes: nonNegInt,
|
|
1160
|
+
running: z20.boolean(),
|
|
1161
|
+
exit_code: z20.int().nullable()
|
|
1162
|
+
});
|
|
1163
|
+
var ExecJobStopParams = z20.strictObject({
|
|
1164
|
+
job_id: ExecJobId,
|
|
1165
|
+
/** End it at once (SIGKILL; on Windows the whole tree with /F) instead of asking it to quit. */
|
|
1166
|
+
force: z20.boolean().default(false)
|
|
1167
|
+
});
|
|
1168
|
+
var ExecJobStopResult = z20.strictObject({ job_id: ExecJobId, exited: z20.boolean(), exit_code: z20.int().nullable() });
|
|
1169
|
+
var ExecJobInfo = z20.strictObject({
|
|
1170
|
+
job_id: ExecJobId,
|
|
1171
|
+
command: z20.string().max(1024),
|
|
1172
|
+
pid: z20.int().min(1),
|
|
1173
|
+
cwd: AbsPath,
|
|
1174
|
+
running: z20.boolean(),
|
|
1175
|
+
exit_code: z20.int().nullable(),
|
|
1176
|
+
started_at_ms: epochMs,
|
|
1177
|
+
output_bytes: nonNegInt
|
|
1178
|
+
});
|
|
1179
|
+
var ExecJobListParams = z20.strictObject({});
|
|
1180
|
+
var ExecJobListResult = z20.strictObject({ jobs: z20.array(ExecJobInfo).max(64) });
|
|
1181
|
+
|
|
1182
|
+
// src/schema/coding.ts
|
|
1183
|
+
import { z as z21 } from "zod";
|
|
1184
|
+
var CodingServiceCredentials = z21.strictObject({
|
|
1185
|
+
access_token: z21.string().min(16).max(16384),
|
|
1186
|
+
user_id: z21.string().regex(/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/),
|
|
1187
|
+
/** The AI Matrx server this app talks to (production, or a local server on the nightly copy). */
|
|
1188
|
+
server_url: z21.string().min(1).max(2048).regex(/^https?:\/\/[^\s/?#]+(\/[^\s?#]*)?$/)
|
|
1189
|
+
});
|
|
1190
|
+
var CodingHistoryBlocked = z21.enum([
|
|
1191
|
+
"signed_out",
|
|
1192
|
+
"offline",
|
|
1193
|
+
"organization_required",
|
|
1194
|
+
"claude_unavailable",
|
|
1195
|
+
"cloud_list_unavailable",
|
|
1196
|
+
"history_too_large"
|
|
1197
|
+
]);
|
|
1198
|
+
var CodingHistoryFailure = z21.strictObject({
|
|
1199
|
+
session_id: z21.string().max(64),
|
|
1200
|
+
reason: z21.string().max(300)
|
|
1201
|
+
});
|
|
1202
|
+
var CodingHistoryRun = z21.strictObject({
|
|
1203
|
+
/** Claude Code sessions found on this computer. */
|
|
1204
|
+
local_sessions: nonNegInt,
|
|
1205
|
+
/** Of those, already complete in AI Matrx. */
|
|
1206
|
+
in_cloud: nonNegInt,
|
|
1207
|
+
/** In AI Matrx under neither of its identities. */
|
|
1208
|
+
missing: nonNegInt,
|
|
1209
|
+
/** In AI Matrx, but changed here after the last turn AI Matrx received (turns the hook lost). */
|
|
1210
|
+
behind: nonNegInt,
|
|
1211
|
+
/** Over the importer's size cap; never imported. */
|
|
1212
|
+
too_large: nonNegInt,
|
|
1213
|
+
imported: nonNegInt,
|
|
1214
|
+
/** Changed while being read; a later run takes them. */
|
|
1215
|
+
changed: nonNegInt,
|
|
1216
|
+
failed: nonNegInt,
|
|
1217
|
+
failures: z21.array(CodingHistoryFailure).max(20),
|
|
1218
|
+
/** Candidates not reached yet. */
|
|
1219
|
+
remaining: nonNegInt,
|
|
1220
|
+
/** The one line a person reads, e.g. "Imported 12 of 14 sessions. 140 already in AI Matrx." */
|
|
1221
|
+
summary: z21.string().max(400)
|
|
1222
|
+
});
|
|
1223
|
+
var CodingHistoryStep = z21.strictObject({
|
|
1224
|
+
/** Null when the run could not start (blocked before a plan existed). */
|
|
1225
|
+
plan_id: z21.string().regex(/^[0-9a-f]{32}$/).nullable(),
|
|
1226
|
+
finished: z21.boolean(),
|
|
1227
|
+
blocked: CodingHistoryBlocked.nullable(),
|
|
1228
|
+
run: CodingHistoryRun
|
|
1229
|
+
});
|
|
1230
|
+
var CodingPlanMissingParams = z21.strictObject({ credentials: CodingServiceCredentials });
|
|
1231
|
+
var CodingImportNextParams = z21.strictObject({
|
|
1232
|
+
plan_id: z21.string().regex(/^[0-9a-f]{32}$/),
|
|
1233
|
+
credentials: CodingServiceCredentials
|
|
1234
|
+
});
|
|
1235
|
+
var CodingServiceProgress = z21.strictObject({
|
|
1236
|
+
phase: z21.enum(["checking", "importing"]),
|
|
1237
|
+
done: nonNegInt,
|
|
1238
|
+
total: nonNegInt
|
|
1239
|
+
});
|
|
1240
|
+
var CodingHistoryImportMissingParams = z21.strictObject({});
|
|
1241
|
+
var CodingHistoryImportMissingResult = z21.strictObject({
|
|
1242
|
+
state: z21.enum(["done", "blocked", "cancelled"]),
|
|
1243
|
+
blocked: CodingHistoryBlocked.nullable(),
|
|
1244
|
+
run: CodingHistoryRun,
|
|
1245
|
+
elapsed_ms: nonNegInt
|
|
1246
|
+
});
|
|
1247
|
+
var CodingHistoryProgressEvent = z21.strictObject({
|
|
1248
|
+
request_id: RequestId,
|
|
1249
|
+
phase: z21.enum(["checking", "importing"]),
|
|
1250
|
+
/** Sessions settled so far, of `total` candidates (0 of 0 while checking). */
|
|
1251
|
+
done: nonNegInt,
|
|
1252
|
+
total: nonNegInt,
|
|
1253
|
+
imported: nonNegInt,
|
|
1254
|
+
failed: nonNegInt
|
|
1255
|
+
});
|
|
1256
|
+
|
|
1257
|
+
// src/schema/apps.ts
|
|
1258
|
+
import { z as z22 } from "zod";
|
|
1259
|
+
var AppKey = z22.string().regex(/^[a-z][a-z0-9_-]{0,39}$/);
|
|
1260
|
+
var AppProfileId = z22.string().regex(/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/);
|
|
1261
|
+
var AppProfileLocator = z22.string().min(1).max(512).regex(/^[A-Za-z0-9 _()+@,-][A-Za-z0-9 ._()+@,-]{0,127}(\/[A-Za-z0-9 _()+@,-][A-Za-z0-9 ._()+@,-]{0,127}){0,7}$/);
|
|
1262
|
+
var AppSupport = z22.enum(["supported", "partial", "unsupported"]);
|
|
1263
|
+
var AppFeatureStatus = z22.strictObject({
|
|
854
1264
|
status: AppSupport,
|
|
855
1265
|
/** One line, set whenever status is not "supported". */
|
|
856
|
-
reason:
|
|
1266
|
+
reason: z22.string().max(140).nullable()
|
|
857
1267
|
});
|
|
858
|
-
var AppInfo =
|
|
1268
|
+
var AppInfo = z22.strictObject({
|
|
859
1269
|
app_key: AppKey,
|
|
860
|
-
name:
|
|
861
|
-
installed:
|
|
1270
|
+
name: z22.string().max(64),
|
|
1271
|
+
installed: z22.boolean(),
|
|
862
1272
|
/** The app's own version string, or null when it is not installed or does not say. */
|
|
863
|
-
version:
|
|
1273
|
+
version: z22.string().max(64).nullable(),
|
|
864
1274
|
/** The install found (an .app bundle, an .exe, a binary), or null. */
|
|
865
1275
|
location: AbsPath.nullable(),
|
|
866
1276
|
/** Open the app at all on this OS. */
|
|
@@ -870,69 +1280,69 @@ var AppInfo = z13.strictObject({
|
|
|
870
1280
|
/** Plan usage read from the app's own files on this OS. */
|
|
871
1281
|
usage: AppFeatureStatus
|
|
872
1282
|
});
|
|
873
|
-
var AppUsageReading =
|
|
874
|
-
window:
|
|
1283
|
+
var AppUsageReading = z22.strictObject({
|
|
1284
|
+
window: z22.enum(["five_hour", "weekly", "extra"]),
|
|
875
1285
|
/** 0–100 for five_hour and weekly; extra-usage spend as a percent of its cap (may pass 100). */
|
|
876
|
-
percent:
|
|
1286
|
+
percent: z22.number().min(0).max(1e4),
|
|
877
1287
|
/** When the app recorded it. */
|
|
878
1288
|
sampled_at_ms: epochMs,
|
|
879
1289
|
/** True when the window has rolled over since the sample, so the figure has reset. */
|
|
880
|
-
reset_since:
|
|
1290
|
+
reset_since: z22.boolean()
|
|
881
1291
|
});
|
|
882
|
-
var AppProfile =
|
|
1292
|
+
var AppProfile = z22.strictObject({
|
|
883
1293
|
/** The row's id; null for a folder found on disk that no row names yet. */
|
|
884
1294
|
id: AppProfileId.nullable(),
|
|
885
1295
|
app_key: AppKey,
|
|
886
|
-
display_name:
|
|
1296
|
+
display_name: z22.string().min(1).max(120),
|
|
887
1297
|
/** The account the person means to be signed in here; null when not stated (never guessed). */
|
|
888
|
-
account_identity:
|
|
1298
|
+
account_identity: z22.string().min(3).max(320).nullable(),
|
|
889
1299
|
profile_locator: AppProfileLocator.nullable(),
|
|
890
1300
|
/** The device the row is tied to; null when the row names none. */
|
|
891
1301
|
device_id: DeviceId.nullable(),
|
|
892
1302
|
/** The folder this profile resolves to on this device; null for a row tied to another device. */
|
|
893
1303
|
folder: AbsPath.nullable(),
|
|
894
1304
|
/** The folder exists on this device. */
|
|
895
|
-
on_disk:
|
|
1305
|
+
on_disk: z22.boolean(),
|
|
896
1306
|
/** An instance with this profile is running; null when it could not be determined. */
|
|
897
|
-
running:
|
|
1307
|
+
running: z22.boolean().nullable(),
|
|
898
1308
|
/** Usage the app recorded for this profile; null when the app exposes none here. */
|
|
899
|
-
usage:
|
|
1309
|
+
usage: z22.array(AppUsageReading).nullable(),
|
|
900
1310
|
last_opened_ms: epochMs.nullable()
|
|
901
1311
|
});
|
|
902
|
-
var AppsListParams =
|
|
903
|
-
var AppsListResult =
|
|
904
|
-
var AppsProfilesListParams =
|
|
1312
|
+
var AppsListParams = z22.strictObject({});
|
|
1313
|
+
var AppsListResult = z22.strictObject({ apps: z22.array(AppInfo) });
|
|
1314
|
+
var AppsProfilesListParams = z22.strictObject({
|
|
905
1315
|
/** Only this app's profiles; every app's when absent. */
|
|
906
1316
|
app_key: AppKey.optional()
|
|
907
1317
|
});
|
|
908
|
-
var AppsProfilesListResult =
|
|
909
|
-
profiles:
|
|
1318
|
+
var AppsProfilesListResult = z22.strictObject({
|
|
1319
|
+
profiles: z22.array(AppProfile),
|
|
910
1320
|
/**
|
|
911
1321
|
* Whether the saved rows could be read: false while signed out or offline, when only folders
|
|
912
1322
|
* found on disk are listed.
|
|
913
1323
|
*/
|
|
914
|
-
registry:
|
|
1324
|
+
registry: z22.enum(["ok", "signed_out", "unavailable"])
|
|
915
1325
|
});
|
|
916
|
-
var AppsProfilesSaveParams =
|
|
1326
|
+
var AppsProfilesSaveParams = z22.strictObject({
|
|
917
1327
|
id: AppProfileId.optional(),
|
|
918
1328
|
app_key: AppKey,
|
|
919
|
-
display_name:
|
|
920
|
-
account_identity:
|
|
1329
|
+
display_name: z22.string().min(1).max(120),
|
|
1330
|
+
account_identity: z22.string().min(3).max(320).nullable(),
|
|
921
1331
|
/** On create: the folder to use (one found on disk), or null for the app's default profile. Ignored on update. */
|
|
922
1332
|
profile_locator: AppProfileLocator.nullable(),
|
|
923
1333
|
/** On create with profile_locator null: make a new folder named after display_name instead. */
|
|
924
|
-
new_folder:
|
|
1334
|
+
new_folder: z22.boolean().default(false)
|
|
925
1335
|
});
|
|
926
1336
|
var AppsProfilesSaveResult = AppProfile;
|
|
927
|
-
var AppsProfilesRemoveParams =
|
|
928
|
-
var AppsProfilesRemoveResult =
|
|
929
|
-
var AppsOpenParams =
|
|
1337
|
+
var AppsProfilesRemoveParams = z22.strictObject({ id: AppProfileId });
|
|
1338
|
+
var AppsProfilesRemoveResult = z22.strictObject({ removed: z22.boolean() });
|
|
1339
|
+
var AppsOpenParams = z22.strictObject({
|
|
930
1340
|
app_key: AppKey,
|
|
931
1341
|
profile_id: AppProfileId.optional()
|
|
932
1342
|
});
|
|
933
|
-
var AppsOpenResult =
|
|
1343
|
+
var AppsOpenResult = z22.strictObject({
|
|
934
1344
|
/** True when an instance with this profile was already running; it is brought forward. */
|
|
935
|
-
already_running:
|
|
1345
|
+
already_running: z22.boolean(),
|
|
936
1346
|
folder: AbsPath.nullable()
|
|
937
1347
|
});
|
|
938
1348
|
|
|
@@ -977,7 +1387,32 @@ var OPS = {
|
|
|
977
1387
|
"proc.ports": { params: ProcPortsParams, result: ProcPortsResult, kind: "unary", since: "1.3", errors: ["INVALID_PARAMS", "PERMISSION_DENIED_OS", "PLATFORM_UNSUPPORTED", "INTERNAL"] },
|
|
978
1388
|
"proc.kill": { params: ProcKillParams, result: ProcKillResult, kind: "unary", since: "1.3", errors: ["NOT_FOUND", "AUTH_FORBIDDEN", "PERMISSION_DENIED_OS", "INVALID_PARAMS", "INTERNAL"] },
|
|
979
1389
|
"clipboard.read": { params: ClipboardReadParams, result: ClipboardReadResult, kind: "unary", since: "1.3", errors: ["PLATFORM_UNSUPPORTED", "INTERNAL"] },
|
|
980
|
-
"clipboard.write": { params: ClipboardWriteParams, result: ClipboardWriteResult, kind: "unary", since: "1.3", errors: ["PLATFORM_UNSUPPORTED", "PAYLOAD_TOO_LARGE", "INTERNAL"] }
|
|
1390
|
+
"clipboard.write": { params: ClipboardWriteParams, result: ClipboardWriteResult, kind: "unary", since: "1.3", errors: ["PLATFORM_UNSUPPORTED", "PAYLOAD_TOO_LARGE", "INTERNAL"] },
|
|
1391
|
+
"fs.watch.start": { params: FsWatchStartParams, result: FsWatchStartResult, kind: "unary", since: "1.4", errors: [...FS_ERR, "RATE_LIMITED"] },
|
|
1392
|
+
"fs.watch.events": { params: FsWatchEventsParams, result: FsWatchEventsResult, kind: "unary", since: "1.4", errors: ["RESOURCE_GONE", "INVALID_PARAMS", "INTERNAL"] },
|
|
1393
|
+
"fs.watch.stop": { params: FsWatchStopParams, result: FsWatchStopResult, kind: "unary", since: "1.4", errors: ["RESOURCE_GONE", "INVALID_PARAMS"] },
|
|
1394
|
+
"exec.job.start": { params: ExecJobStartParams, result: ExecJobStartResult, kind: "unary", since: "1.4", errors: ["INVALID_PARAMS", "NOT_FOUND", "RATE_LIMITED", "INTERNAL"] },
|
|
1395
|
+
"exec.job.output": { params: ExecJobOutputParams, result: ExecJobOutputResult, kind: "unary", since: "1.4", errors: ["RESOURCE_GONE", "INVALID_PARAMS"] },
|
|
1396
|
+
"exec.job.stop": { params: ExecJobStopParams, result: ExecJobStopResult, kind: "unary", since: "1.4", errors: ["RESOURCE_GONE", "INVALID_PARAMS", "INTERNAL"] },
|
|
1397
|
+
"exec.job.list": { params: ExecJobListParams, result: ExecJobListResult, kind: "unary", since: "1.4", errors: ["INTERNAL"] },
|
|
1398
|
+
"system.open_url": { params: SystemOpenUrlParams, result: SystemOpenUrlResult, kind: "unary", since: "1.4", errors: ["INVALID_PARAMS", "PLATFORM_UNSUPPORTED", "INTERNAL"] },
|
|
1399
|
+
"system.open_path": { params: SystemOpenPathParams, result: SystemOpenPathResult, kind: "unary", since: "1.4", errors: ["NOT_FOUND", "INVALID_PARAMS", "PLATFORM_UNSUPPORTED", "INTERNAL"] },
|
|
1400
|
+
"system.notify": { params: SystemNotifyParams, result: SystemNotifyResult, kind: "unary", since: "1.4", errors: ["PERMISSION_DENIED_OS", "INTERNAL"] },
|
|
1401
|
+
"screen.list": { params: ScreenListParams, result: ScreenListResult, kind: "unary", since: "1.4", errors: ["PERMISSION_DENIED_OS", "PLATFORM_UNSUPPORTED", "INTERNAL"] },
|
|
1402
|
+
"screen.capture": { params: ScreenCaptureParams, result: ScreenCaptureResult, kind: "unary", since: "1.4", errors: ["NOT_FOUND", "PERMISSION_DENIED_OS", "PLATFORM_UNSUPPORTED", "PAYLOAD_TOO_LARGE", "INTERNAL"] },
|
|
1403
|
+
"window.list": { params: WindowListParams, result: WindowListResult, kind: "unary", since: "1.4", errors: ["PERMISSION_DENIED_OS", "PLATFORM_UNSUPPORTED", "INTERNAL"] },
|
|
1404
|
+
"window.focus": { params: WindowFocusParams, result: WindowFocusResult, kind: "unary", since: "1.4", errors: ["NOT_FOUND", "PERMISSION_DENIED_OS", "PLATFORM_UNSUPPORTED", "INTERNAL"] },
|
|
1405
|
+
"window.move": { params: WindowMoveParams, result: WindowMoveResult, kind: "unary", since: "1.4", errors: ["NOT_FOUND", "INVALID_PARAMS", "PERMISSION_DENIED_OS", "PLATFORM_UNSUPPORTED", "INTERNAL"] },
|
|
1406
|
+
"window.minimize": { params: WindowMinimizeParams, result: WindowMinimizeResult, kind: "unary", since: "1.4", errors: ["NOT_FOUND", "PERMISSION_DENIED_OS", "PLATFORM_UNSUPPORTED", "INTERNAL"] },
|
|
1407
|
+
"input.type_text": { params: InputTypeTextParams, result: InputTypeTextResult, kind: "unary", since: "1.4", errors: ["PERMISSION_DENIED_OS", "PLATFORM_UNSUPPORTED", "INTERNAL"] },
|
|
1408
|
+
"input.hotkey": { params: InputHotkeyParams, result: InputHotkeyResult, kind: "unary", since: "1.4", errors: ["INVALID_PARAMS", "PERMISSION_DENIED_OS", "PLATFORM_UNSUPPORTED", "INTERNAL"] },
|
|
1409
|
+
"input.mouse_move": { params: InputMouseMoveParams, result: InputMouseMoveResult, kind: "unary", since: "1.4", errors: ["PERMISSION_DENIED_OS", "PLATFORM_UNSUPPORTED", "INTERNAL"] },
|
|
1410
|
+
"input.mouse_click": { params: InputMouseClickParams, result: InputMouseClickResult, kind: "unary", since: "1.4", errors: ["INVALID_PARAMS", "PERMISSION_DENIED_OS", "PLATFORM_UNSUPPORTED", "INTERNAL"] },
|
|
1411
|
+
"power.status": { params: PowerStatusParams, result: PowerStatusResult, kind: "unary", since: "1.4", errors: ["INTERNAL"] },
|
|
1412
|
+
"power.prevent_sleep": { params: PowerPreventSleepParams, result: PowerPreventSleepResult, kind: "unary", since: "1.4", errors: ["PERMISSION_DENIED_OS", "PLATFORM_UNSUPPORTED", "INTERNAL"] },
|
|
1413
|
+
"resources.snapshot": { params: ResourcesSnapshotParams, result: ResourcesSnapshotResult, kind: "unary", since: "1.4", errors: ["INTERNAL"] },
|
|
1414
|
+
// Claude Code history (SPEC §6 coding): served by the `coding` Python service through SERVICES below.
|
|
1415
|
+
"coding.history.import_missing": { params: CodingHistoryImportMissingParams, result: CodingHistoryImportMissingResult, kind: "unary", since: "1.5", errors: ["RESOURCE_BUSY", "RESOURCE_GONE", "CANCELLED", "INTERNAL"] }
|
|
981
1416
|
};
|
|
982
1417
|
var EVENTS = {
|
|
983
1418
|
"fs.changed": FsChangedEvent,
|
|
@@ -986,6 +1421,7 @@ var EVENTS = {
|
|
|
986
1421
|
"exec.cwd": ExecCwdEvent,
|
|
987
1422
|
"session.control_changed": SessionControlChangedEvent,
|
|
988
1423
|
"models.progress": ModelsProgressEvent,
|
|
1424
|
+
"coding.history.progress": CodingHistoryProgressEvent,
|
|
989
1425
|
"relay.device_status": RelayDeviceStatusEvent,
|
|
990
1426
|
"relay.auth_expiring": RelayAuthExpiringEvent
|
|
991
1427
|
};
|