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