@ai-matrx/desktop-protocol 0.17.2 → 0.17.4
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 +23 -0
- package/dist/client.cjs +124 -2
- 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 +124 -2
- package/dist/client.js.map +1 -1
- package/dist/index.cjs +447 -262
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +361 -9
- package/dist/index.d.ts +361 -9
- package/dist/index.js +447 -262
- package/dist/index.js.map +1 -1
- package/dist/{models-QWCUcQuU.d.cts → models-9j0ncAJj.d.cts} +562 -4
- package/dist/{models-QWCUcQuU.d.ts → models-9j0ncAJj.d.ts} +562 -4
- package/dist/react.d.cts +252 -0
- package/dist/react.d.ts +252 -0
- package/generated/desktop-protocol.schema.json +648 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// src/schema/primitives.ts
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
var PROTOCOL_MAJOR = 1;
|
|
4
|
-
var PROTOCOL_MINOR =
|
|
4
|
+
var PROTOCOL_MINOR = 8;
|
|
5
5
|
var PROTOCOL_VERSION = `${PROTOCOL_MAJOR}.${PROTOCOL_MINOR}`;
|
|
6
6
|
var ProtocolVersion = z.string().regex(/^[1-9][0-9]{0,2}\.[0-9]{1,3}$/);
|
|
7
7
|
var RequestId = z.string().min(1).max(64).regex(/^[A-Za-z0-9_-]+$/);
|
|
@@ -891,242 +891,358 @@ var AppsOpenResult = z11.strictObject({
|
|
|
891
891
|
folder: AbsPath.nullable()
|
|
892
892
|
});
|
|
893
893
|
|
|
894
|
-
// src/schema/
|
|
894
|
+
// src/schema/apps-chats.ts
|
|
895
895
|
import { z as z12 } from "zod";
|
|
896
|
+
var ChatId = z12.string().regex(/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/);
|
|
897
|
+
var ChatPlace = z12.string().regex(/^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/);
|
|
898
|
+
var ChatProjectId = z12.string().regex(/^[a-z0-9][a-z0-9-]{0,63}$/);
|
|
899
|
+
var ChatWindow = z12.strictObject({
|
|
900
|
+
key: ChatPlace,
|
|
901
|
+
/** The app's default profile (Claude: the main window, which lists every account's chats). */
|
|
902
|
+
main: z12.boolean(),
|
|
903
|
+
/** The account the window is signed into, when known. */
|
|
904
|
+
account: z12.string().max(320).nullable()
|
|
905
|
+
});
|
|
906
|
+
var ChatProject = z12.strictObject({
|
|
907
|
+
id: ChatProjectId,
|
|
908
|
+
name: z12.string().min(1).max(200),
|
|
909
|
+
archived: z12.boolean(),
|
|
910
|
+
/** Chats in it. */
|
|
911
|
+
count: nonNegInt
|
|
912
|
+
});
|
|
913
|
+
var ChatPin = z12.strictObject({
|
|
914
|
+
/** The window whose account pins it; an account with no window of its own is named by its email. */
|
|
915
|
+
window: z12.string().min(1).max(320),
|
|
916
|
+
/** When that account's pin list was last read; null when the reading has no time. */
|
|
917
|
+
observed_at_ms: epochMs.nullable()
|
|
918
|
+
});
|
|
919
|
+
var ChatRunning = z12.strictObject({
|
|
920
|
+
window: ChatPlace,
|
|
921
|
+
/** process: a live process resumed this chat there (exact); activity: that window's own record moved in the last 3 minutes. */
|
|
922
|
+
how: z12.enum(["process", "activity"])
|
|
923
|
+
});
|
|
924
|
+
var ChatHidden = z12.strictObject({
|
|
925
|
+
window: ChatPlace,
|
|
926
|
+
reason: z12.string().max(200)
|
|
927
|
+
});
|
|
928
|
+
var ChatLastUse = z12.strictObject({
|
|
929
|
+
/** The conversation's last reply. */
|
|
930
|
+
at_ms: epochMs,
|
|
931
|
+
window: ChatPlace.nullable(),
|
|
932
|
+
account: z12.string().max(320).nullable(),
|
|
933
|
+
/** How the window was decided (one short line). */
|
|
934
|
+
how: z12.string().max(120).nullable(),
|
|
935
|
+
/** The account's 1-hour prompt cache is still warm. */
|
|
936
|
+
cache_warm: z12.boolean(),
|
|
937
|
+
cache_minutes_left: nonNegInt
|
|
938
|
+
});
|
|
939
|
+
var ChatRow = z12.strictObject({
|
|
940
|
+
id: ChatId,
|
|
941
|
+
/** The short id people see (the listing's first 8 characters). */
|
|
942
|
+
short_id: z12.string().max(16),
|
|
943
|
+
/** The listing's own name (Claude: local_<id>), null for a chat only in the holder. */
|
|
944
|
+
record: z12.string().max(160).nullable(),
|
|
945
|
+
title: z12.string().max(1e3),
|
|
946
|
+
last_active_ms: epochMs.nullable(),
|
|
947
|
+
created_ms: epochMs.nullable(),
|
|
948
|
+
projects: z12.array(ChatProjectId).max(500),
|
|
949
|
+
starred: z12.boolean(),
|
|
950
|
+
pinned_in: z12.array(ChatPin).max(200),
|
|
951
|
+
/** Every place it is listed now: window keys, plus "holder". */
|
|
952
|
+
places: z12.array(ChatPlace).max(200),
|
|
953
|
+
held: z12.boolean(),
|
|
954
|
+
running: z12.array(ChatRunning).max(200),
|
|
955
|
+
hidden_in: z12.array(ChatHidden).max(200),
|
|
956
|
+
/** Kept out of the main window on purpose. */
|
|
957
|
+
hidden_from_main: z12.boolean(),
|
|
958
|
+
/** Listed in a side window and not yet copied into main. */
|
|
959
|
+
main_pending: z12.boolean(),
|
|
960
|
+
/** A scheduled routine's run (its task id). */
|
|
961
|
+
scheduled: z12.string().max(200).nullable(),
|
|
962
|
+
/** Created recently and in no project: offered for filing. */
|
|
963
|
+
new_unfiled: z12.boolean(),
|
|
964
|
+
warnings: z12.array(z12.string().max(400)).max(20),
|
|
965
|
+
last_use: ChatLastUse.nullable()
|
|
966
|
+
});
|
|
967
|
+
var AppsChatsListParams = z12.strictObject({
|
|
968
|
+
app_key: AppKey,
|
|
969
|
+
/** Only these chats (a live update re-reads just what changed). */
|
|
970
|
+
ids: z12.array(ChatId).max(500).optional()
|
|
971
|
+
});
|
|
972
|
+
var AppsChatsListResult = z12.strictObject({
|
|
973
|
+
app_key: AppKey,
|
|
974
|
+
/** Bumps on every change the index sees; `apps.chats.changed` carries the same number. */
|
|
975
|
+
version: nonNegInt,
|
|
976
|
+
windows: z12.array(ChatWindow).max(200),
|
|
977
|
+
projects: z12.array(ChatProject).max(5e3),
|
|
978
|
+
chats: z12.array(ChatRow).max(2e4),
|
|
979
|
+
/** How long a chat in no project counts as new. */
|
|
980
|
+
new_window_ms: nonNegInt
|
|
981
|
+
});
|
|
982
|
+
var AppsChatsWatchParams = z12.strictObject({ app_key: AppKey });
|
|
983
|
+
var AppsChatsWatchResult = z12.strictObject({ resource_id: ResourceId, version: nonNegInt });
|
|
984
|
+
var AppsChatsChangedEvent = z12.strictObject({
|
|
985
|
+
app_key: AppKey,
|
|
986
|
+
version: nonNegInt,
|
|
987
|
+
ids: z12.array(ChatId).max(1e3),
|
|
988
|
+
all: z12.boolean()
|
|
989
|
+
});
|
|
990
|
+
var AppsProjectsFileParams = z12.strictObject({
|
|
991
|
+
app_key: AppKey,
|
|
992
|
+
chat_id: ChatId,
|
|
993
|
+
project_id: ChatProjectId.optional(),
|
|
994
|
+
new_project_name: z12.string().min(1).max(200).optional()
|
|
995
|
+
});
|
|
996
|
+
var AppsProjectsFileResult = z12.strictObject({ chat: ChatRow, project: ChatProject });
|
|
997
|
+
var AppsProjectsUnfileParams = z12.strictObject({ app_key: AppKey, chat_id: ChatId, project_id: ChatProjectId });
|
|
998
|
+
var AppsProjectsUnfileResult = z12.strictObject({ chat: ChatRow });
|
|
999
|
+
var AppsChatsStarParams = z12.strictObject({ app_key: AppKey, chat_id: ChatId, starred: z12.boolean() });
|
|
1000
|
+
var AppsChatsStarResult = z12.strictObject({ chat: ChatRow });
|
|
1001
|
+
|
|
1002
|
+
// src/schema/service.ts
|
|
1003
|
+
import { z as z13 } from "zod";
|
|
896
1004
|
var SERVICE_MAX_FRAME_BYTES = 16777216;
|
|
897
|
-
var ServiceName =
|
|
898
|
-
var ContractHash =
|
|
899
|
-
var ServiceToken =
|
|
1005
|
+
var ServiceName = z13.enum(["ml", "coding"]);
|
|
1006
|
+
var ContractHash = z13.string().regex(/^[0-9a-f]{64}$/);
|
|
1007
|
+
var ServiceToken = z13.string().regex(/^[A-Za-z0-9_-]{43}$/);
|
|
900
1008
|
var ServiceRequestId = u32;
|
|
901
|
-
var ServiceHello =
|
|
902
|
-
var ServiceWelcome =
|
|
903
|
-
type:
|
|
1009
|
+
var ServiceHello = z13.strictObject({ type: z13.literal("hello"), token: ServiceToken, contract: ContractHash });
|
|
1010
|
+
var ServiceWelcome = z13.strictObject({
|
|
1011
|
+
type: z13.literal("welcome"),
|
|
904
1012
|
service: ServiceName,
|
|
905
1013
|
contract: ContractHash,
|
|
906
1014
|
pid: nonNegInt,
|
|
907
1015
|
/** The interpreter's version, e.g. "3.13.15". */
|
|
908
|
-
python:
|
|
1016
|
+
python: z13.string().max(32),
|
|
909
1017
|
/** Every op this service serves; must equal SERVICES[service] exactly. */
|
|
910
|
-
ops:
|
|
1018
|
+
ops: z13.array(z13.string().min(1).max(64)).max(64)
|
|
911
1019
|
});
|
|
912
|
-
var ServiceRequest =
|
|
913
|
-
type:
|
|
1020
|
+
var ServiceRequest = z13.strictObject({
|
|
1021
|
+
type: z13.literal("request"),
|
|
914
1022
|
id: ServiceRequestId,
|
|
915
|
-
op:
|
|
916
|
-
params:
|
|
1023
|
+
op: z13.string().min(1).max(64),
|
|
1024
|
+
params: z13.unknown()
|
|
917
1025
|
// validated by the service against SERVICES[service][op].params
|
|
918
1026
|
});
|
|
919
|
-
var ServiceResponse =
|
|
920
|
-
type:
|
|
1027
|
+
var ServiceResponse = z13.strictObject({
|
|
1028
|
+
type: z13.literal("response"),
|
|
921
1029
|
id: ServiceRequestId,
|
|
922
|
-
result:
|
|
1030
|
+
result: z13.unknown()
|
|
923
1031
|
// validated by the core against SERVICES[service][op].result
|
|
924
1032
|
});
|
|
925
|
-
var ServiceErrorMsg =
|
|
926
|
-
var ServiceProgressMsg =
|
|
927
|
-
var ServiceCancel =
|
|
928
|
-
var ServicePing =
|
|
929
|
-
var ServicePong =
|
|
930
|
-
type:
|
|
1033
|
+
var ServiceErrorMsg = z13.strictObject({ type: z13.literal("error"), id: ServiceRequestId, error: ProtocolErrorBody });
|
|
1034
|
+
var ServiceProgressMsg = z13.strictObject({ type: z13.literal("progress"), id: ServiceRequestId, progress: z13.unknown() });
|
|
1035
|
+
var ServiceCancel = z13.strictObject({ type: z13.literal("cancel"), id: ServiceRequestId });
|
|
1036
|
+
var ServicePing = z13.strictObject({ type: z13.literal("ping"), id: ServiceRequestId });
|
|
1037
|
+
var ServicePong = z13.strictObject({
|
|
1038
|
+
type: z13.literal("pong"),
|
|
931
1039
|
id: ServiceRequestId,
|
|
932
1040
|
/** Requests running now. */
|
|
933
1041
|
busy: nonNegInt
|
|
934
1042
|
});
|
|
935
|
-
var ServiceShutdown =
|
|
936
|
-
var CoreToServiceMsg =
|
|
937
|
-
var ServiceToCoreMsg =
|
|
1043
|
+
var ServiceShutdown = z13.strictObject({ type: z13.literal("shutdown") });
|
|
1044
|
+
var CoreToServiceMsg = z13.discriminatedUnion("type", [ServiceHello, ServiceRequest, ServiceCancel, ServicePing, ServiceShutdown]);
|
|
1045
|
+
var ServiceToCoreMsg = z13.discriminatedUnion("type", [ServiceWelcome, ServiceResponse, ServiceErrorMsg, ServiceProgressMsg, ServicePong]);
|
|
938
1046
|
|
|
939
1047
|
// src/schema/tools.ts
|
|
940
|
-
import { z as
|
|
941
|
-
var ToolLevel =
|
|
942
|
-
var ToolOutcome =
|
|
943
|
-
var ToolPlatform =
|
|
944
|
-
var ToolTransport =
|
|
945
|
-
var ToolName =
|
|
946
|
-
var ToolLevelResult =
|
|
1048
|
+
import { z as z14 } from "zod";
|
|
1049
|
+
var ToolLevel = z14.enum(["programmatic", "protocol", "chat"]);
|
|
1050
|
+
var ToolOutcome = z14.enum(["pass", "fail", "skip"]);
|
|
1051
|
+
var ToolPlatform = z14.enum(["darwin", "win32", "linux"]);
|
|
1052
|
+
var ToolTransport = z14.enum(["in_process", "localhost", "relay", "agent"]);
|
|
1053
|
+
var ToolName = z14.string().min(1).max(64).regex(/^[a-z][a-z0-9_]*$/);
|
|
1054
|
+
var ToolLevelResult = z14.strictObject({
|
|
947
1055
|
tool: ToolName,
|
|
948
1056
|
level: ToolLevel,
|
|
949
1057
|
platform: ToolPlatform,
|
|
950
1058
|
transport: ToolTransport,
|
|
951
1059
|
outcome: ToolOutcome,
|
|
952
1060
|
/** True when the caller sat on a different network from the device (a phone on cellular, CI). */
|
|
953
|
-
remote_network:
|
|
1061
|
+
remote_network: z14.boolean(),
|
|
954
1062
|
/** One line: what was asserted, or why it failed. Never a token, a file's contents or a path under a real home. */
|
|
955
|
-
detail:
|
|
1063
|
+
detail: z14.string().max(500),
|
|
956
1064
|
/** The harness that produced it, e.g. `matrx-desktop test/tools/programmatic.test.ts`. */
|
|
957
|
-
suite:
|
|
1065
|
+
suite: z14.string().min(1).max(200),
|
|
958
1066
|
/** The test case inside the suite. */
|
|
959
|
-
test:
|
|
960
|
-
run_at_ms:
|
|
1067
|
+
test: z14.string().min(1).max(300),
|
|
1068
|
+
run_at_ms: z14.int().min(0)
|
|
961
1069
|
});
|
|
962
|
-
var ToolResultsFile =
|
|
963
|
-
schema:
|
|
1070
|
+
var ToolResultsFile = z14.strictObject({
|
|
1071
|
+
schema: z14.literal("matrx.tool-results.v1"),
|
|
964
1072
|
/** The producing repo's commit (short or full SHA). */
|
|
965
|
-
commit:
|
|
966
|
-
results:
|
|
1073
|
+
commit: z14.string().min(4).max(64),
|
|
1074
|
+
results: z14.array(ToolLevelResult).max(1e4)
|
|
967
1075
|
});
|
|
968
1076
|
|
|
969
1077
|
// src/schema/proc.ts
|
|
970
|
-
import { z as
|
|
971
|
-
var ProcSort =
|
|
972
|
-
var ProcListParams =
|
|
1078
|
+
import { z as z15 } from "zod";
|
|
1079
|
+
var ProcSort = z15.enum(["cpu", "memory", "pid", "name"]);
|
|
1080
|
+
var ProcListParams = z15.strictObject({
|
|
973
1081
|
/** Case-insensitive substring of the process name or its command line. */
|
|
974
|
-
name:
|
|
1082
|
+
name: z15.string().min(1).max(128).optional(),
|
|
975
1083
|
sort: ProcSort.default("cpu"),
|
|
976
|
-
limit:
|
|
1084
|
+
limit: z15.int().min(1).max(500).default(50)
|
|
977
1085
|
});
|
|
978
|
-
var ProcInfo =
|
|
979
|
-
pid:
|
|
1086
|
+
var ProcInfo = z15.strictObject({
|
|
1087
|
+
pid: z15.int().min(0),
|
|
980
1088
|
/** Parent process id; null where the OS does not report it. */
|
|
981
|
-
ppid:
|
|
982
|
-
name:
|
|
1089
|
+
ppid: z15.int().min(0).nullable(),
|
|
1090
|
+
name: z15.string().max(256),
|
|
983
1091
|
/** The command line, cut to 1024 characters. */
|
|
984
|
-
command:
|
|
1092
|
+
command: z15.string().max(1024),
|
|
985
1093
|
/** Share of one core, as `ps` and Task Manager report it; null where the OS does not say. */
|
|
986
|
-
cpu_percent:
|
|
1094
|
+
cpu_percent: z15.number().min(0).nullable(),
|
|
987
1095
|
memory_bytes: nonNegInt.nullable(),
|
|
988
|
-
user:
|
|
1096
|
+
user: z15.string().max(128).nullable()
|
|
989
1097
|
});
|
|
990
|
-
var ProcListResult =
|
|
991
|
-
processes:
|
|
1098
|
+
var ProcListResult = z15.strictObject({
|
|
1099
|
+
processes: z15.array(ProcInfo).max(500),
|
|
992
1100
|
/** Processes that matched before `limit`. */
|
|
993
1101
|
total: nonNegInt,
|
|
994
|
-
truncated:
|
|
1102
|
+
truncated: z15.boolean()
|
|
995
1103
|
});
|
|
996
|
-
var ProcPortsParams =
|
|
1104
|
+
var ProcPortsParams = z15.strictObject({
|
|
997
1105
|
/** Only this port. */
|
|
998
|
-
port:
|
|
1106
|
+
port: z15.int().min(1).max(65535).optional()
|
|
999
1107
|
});
|
|
1000
|
-
var ProcPort =
|
|
1001
|
-
port:
|
|
1002
|
-
protocol:
|
|
1108
|
+
var ProcPort = z15.strictObject({
|
|
1109
|
+
port: z15.int().min(1).max(65535),
|
|
1110
|
+
protocol: z15.enum(["tcp", "udp"]),
|
|
1003
1111
|
/** The local address it listens on ("127.0.0.1", "*", "::"). */
|
|
1004
|
-
address:
|
|
1005
|
-
pid:
|
|
1006
|
-
process:
|
|
1112
|
+
address: z15.string().max(64),
|
|
1113
|
+
pid: z15.int().min(0).nullable(),
|
|
1114
|
+
process: z15.string().max(256).nullable()
|
|
1007
1115
|
});
|
|
1008
|
-
var ProcPortsResult =
|
|
1009
|
-
var ProcKillParams =
|
|
1010
|
-
pid:
|
|
1116
|
+
var ProcPortsResult = z15.strictObject({ ports: z15.array(ProcPort).max(4e3) });
|
|
1117
|
+
var ProcKillParams = z15.strictObject({
|
|
1118
|
+
pid: z15.int().min(1),
|
|
1011
1119
|
/** Kill outright (SIGKILL; on Windows the same /F) instead of asking it to quit. */
|
|
1012
|
-
force:
|
|
1120
|
+
force: z15.boolean().default(false)
|
|
1013
1121
|
});
|
|
1014
|
-
var ProcKillResult =
|
|
1015
|
-
pid:
|
|
1016
|
-
signal:
|
|
1122
|
+
var ProcKillResult = z15.strictObject({
|
|
1123
|
+
pid: z15.int().min(1),
|
|
1124
|
+
signal: z15.enum(["SIGTERM", "SIGKILL"]),
|
|
1017
1125
|
/** True when the process was gone within 3 s. */
|
|
1018
|
-
exited:
|
|
1126
|
+
exited: z15.boolean()
|
|
1019
1127
|
});
|
|
1020
1128
|
|
|
1021
1129
|
// src/schema/clipboard.ts
|
|
1022
|
-
import { z as
|
|
1023
|
-
var ClipboardReadParams =
|
|
1024
|
-
var ClipboardReadResult =
|
|
1130
|
+
import { z as z16 } from "zod";
|
|
1131
|
+
var ClipboardReadParams = z16.strictObject({});
|
|
1132
|
+
var ClipboardReadResult = z16.strictObject({
|
|
1025
1133
|
/** The clipboard's text ("" when it holds none), cut to 1 MiB. */
|
|
1026
|
-
text:
|
|
1027
|
-
truncated:
|
|
1134
|
+
text: z16.string().max(1048576),
|
|
1135
|
+
truncated: z16.boolean()
|
|
1028
1136
|
});
|
|
1029
|
-
var ClipboardWriteParams =
|
|
1030
|
-
var ClipboardWriteResult =
|
|
1137
|
+
var ClipboardWriteParams = z16.strictObject({ text: z16.string().max(1048576) });
|
|
1138
|
+
var ClipboardWriteResult = z16.strictObject({ bytes: nonNegInt });
|
|
1031
1139
|
|
|
1032
1140
|
// src/schema/system.ts
|
|
1033
|
-
import { z as
|
|
1034
|
-
var SystemOpenUrlParams =
|
|
1141
|
+
import { z as z17 } from "zod";
|
|
1142
|
+
var SystemOpenUrlParams = z17.strictObject({
|
|
1035
1143
|
/** http, https or mailto; opened in the person's default app for it. */
|
|
1036
|
-
url:
|
|
1144
|
+
url: z17.string().min(1).max(4096)
|
|
1037
1145
|
});
|
|
1038
|
-
var SystemOpenUrlResult =
|
|
1039
|
-
var SystemOpenPathParams =
|
|
1146
|
+
var SystemOpenUrlResult = z17.strictObject({ url: z17.string().max(4096) });
|
|
1147
|
+
var SystemOpenPathParams = z17.strictObject({
|
|
1040
1148
|
path: AbsPath,
|
|
1041
1149
|
/** Show it in the file manager (Finder, Explorer) instead of opening it. */
|
|
1042
|
-
reveal:
|
|
1150
|
+
reveal: z17.boolean().default(false)
|
|
1043
1151
|
});
|
|
1044
|
-
var SystemOpenPathResult =
|
|
1045
|
-
var SystemNotifyParams =
|
|
1046
|
-
title:
|
|
1047
|
-
body:
|
|
1152
|
+
var SystemOpenPathResult = z17.strictObject({ path: AbsPath, revealed: z17.boolean() });
|
|
1153
|
+
var SystemNotifyParams = z17.strictObject({
|
|
1154
|
+
title: z17.string().min(1).max(128),
|
|
1155
|
+
body: z17.string().max(1024).default("")
|
|
1048
1156
|
});
|
|
1049
|
-
var SystemNotifyResult =
|
|
1157
|
+
var SystemNotifyResult = z17.strictObject({
|
|
1050
1158
|
/** False when this computer has no notification service to show it (a bare Linux box). */
|
|
1051
|
-
shown:
|
|
1159
|
+
shown: z17.boolean()
|
|
1052
1160
|
});
|
|
1053
1161
|
|
|
1054
1162
|
// src/schema/screen.ts
|
|
1055
|
-
import { z as
|
|
1056
|
-
var ScreenDisplay =
|
|
1163
|
+
import { z as z18 } from "zod";
|
|
1164
|
+
var ScreenDisplay = z18.strictObject({
|
|
1057
1165
|
/** The OS's display id; pass it to screen.capture. */
|
|
1058
1166
|
id: nonNegInt,
|
|
1059
|
-
name:
|
|
1167
|
+
name: z18.string().max(128),
|
|
1060
1168
|
/** Position and size in the OS's logical points (x and y may be negative left of or above the main display). */
|
|
1061
|
-
x:
|
|
1062
|
-
y:
|
|
1063
|
-
width:
|
|
1064
|
-
height:
|
|
1169
|
+
x: z18.int(),
|
|
1170
|
+
y: z18.int(),
|
|
1171
|
+
width: z18.int().min(1),
|
|
1172
|
+
height: z18.int().min(1),
|
|
1065
1173
|
/** Pixels per point (2 on a Retina display). */
|
|
1066
|
-
scale:
|
|
1067
|
-
primary:
|
|
1174
|
+
scale: z18.number().min(0.1).max(8),
|
|
1175
|
+
primary: z18.boolean()
|
|
1068
1176
|
});
|
|
1069
|
-
var ScreenListParams =
|
|
1070
|
-
var ScreenListResult =
|
|
1071
|
-
var ScreenCaptureParams =
|
|
1177
|
+
var ScreenListParams = z18.strictObject({});
|
|
1178
|
+
var ScreenListResult = z18.strictObject({ displays: z18.array(ScreenDisplay).max(32) });
|
|
1179
|
+
var ScreenCaptureParams = z18.strictObject({
|
|
1072
1180
|
/** The display (from screen.list); the primary display when absent. */
|
|
1073
1181
|
display_id: nonNegInt.optional(),
|
|
1074
|
-
format:
|
|
1182
|
+
format: z18.enum(["jpeg", "png"]).default("jpeg"),
|
|
1075
1183
|
/** Scale the picture down to at most this width in pixels (kept when already smaller). */
|
|
1076
|
-
max_width:
|
|
1184
|
+
max_width: z18.int().min(160).max(7680).default(1600)
|
|
1077
1185
|
});
|
|
1078
|
-
var ScreenCaptureResult =
|
|
1186
|
+
var ScreenCaptureResult = z18.strictObject({
|
|
1079
1187
|
display_id: nonNegInt,
|
|
1080
|
-
mime_type:
|
|
1081
|
-
width:
|
|
1082
|
-
height:
|
|
1188
|
+
mime_type: z18.enum(["image/jpeg", "image/png"]),
|
|
1189
|
+
width: z18.int().min(1),
|
|
1190
|
+
height: z18.int().min(1),
|
|
1083
1191
|
/** The display's full resolution in pixels, before scaling. */
|
|
1084
|
-
source_width:
|
|
1085
|
-
source_height:
|
|
1192
|
+
source_width: z18.int().min(1),
|
|
1193
|
+
source_height: z18.int().min(1),
|
|
1086
1194
|
/** The image, base64 (at most 6 MiB of text). */
|
|
1087
|
-
data_base64:
|
|
1195
|
+
data_base64: z18.string().max(6291456)
|
|
1088
1196
|
});
|
|
1089
1197
|
|
|
1090
1198
|
// src/schema/window.ts
|
|
1091
|
-
import { z as
|
|
1092
|
-
var WindowInfo =
|
|
1199
|
+
import { z as z19 } from "zod";
|
|
1200
|
+
var WindowInfo = z19.strictObject({
|
|
1093
1201
|
/** The OS's window handle (macOS window number, Windows HWND, X11 window id). */
|
|
1094
1202
|
id: nonNegInt,
|
|
1095
|
-
title:
|
|
1203
|
+
title: z19.string().max(512),
|
|
1096
1204
|
/** Position and size in logical points. */
|
|
1097
|
-
x:
|
|
1098
|
-
y:
|
|
1099
|
-
width:
|
|
1100
|
-
height:
|
|
1205
|
+
x: z19.int(),
|
|
1206
|
+
y: z19.int(),
|
|
1207
|
+
width: z19.int().min(0),
|
|
1208
|
+
height: z19.int().min(0),
|
|
1209
|
+
/**
|
|
1210
|
+
* The application that owns the window, by the name the OS shows people; absent when the OS does
|
|
1211
|
+
* not say. Optional (never null, the schema rule) because it was added in protocol 1.7: an older
|
|
1212
|
+
* app's answer has no such field (FIELDS_SINCE).
|
|
1213
|
+
*/
|
|
1214
|
+
app: z19.string().max(256).optional(),
|
|
1215
|
+
/** The owning process id; absent when the OS does not say. Added in protocol 1.7. */
|
|
1216
|
+
pid: z19.int().min(0).optional()
|
|
1101
1217
|
});
|
|
1102
|
-
var WindowListParams =
|
|
1218
|
+
var WindowListParams = z19.strictObject({
|
|
1103
1219
|
/** Case-insensitive substring of the window title. */
|
|
1104
|
-
title:
|
|
1105
|
-
limit:
|
|
1220
|
+
title: z19.string().min(1).max(256).optional(),
|
|
1221
|
+
limit: z19.int().min(1).max(500).default(100)
|
|
1106
1222
|
});
|
|
1107
|
-
var WindowListResult =
|
|
1108
|
-
windows:
|
|
1223
|
+
var WindowListResult = z19.strictObject({
|
|
1224
|
+
windows: z19.array(WindowInfo).max(500),
|
|
1109
1225
|
total: nonNegInt,
|
|
1110
|
-
truncated:
|
|
1226
|
+
truncated: z19.boolean()
|
|
1111
1227
|
});
|
|
1112
|
-
var WindowFocusParams =
|
|
1113
|
-
var WindowFocusResult =
|
|
1114
|
-
var WindowMoveParams =
|
|
1228
|
+
var WindowFocusParams = z19.strictObject({ id: nonNegInt });
|
|
1229
|
+
var WindowFocusResult = z19.strictObject({ window: WindowInfo });
|
|
1230
|
+
var WindowMoveParams = z19.strictObject({
|
|
1115
1231
|
id: nonNegInt,
|
|
1116
1232
|
/** New top-left corner; unchanged when absent. */
|
|
1117
|
-
x:
|
|
1118
|
-
y:
|
|
1233
|
+
x: z19.int().optional(),
|
|
1234
|
+
y: z19.int().optional(),
|
|
1119
1235
|
/** New size; unchanged when absent. */
|
|
1120
|
-
width:
|
|
1121
|
-
height:
|
|
1236
|
+
width: z19.int().min(50).max(16384).optional(),
|
|
1237
|
+
height: z19.int().min(50).max(16384).optional()
|
|
1122
1238
|
});
|
|
1123
|
-
var WindowMoveResult =
|
|
1124
|
-
var WindowMinimizeParams =
|
|
1125
|
-
var WindowMinimizeResult =
|
|
1239
|
+
var WindowMoveResult = z19.strictObject({ window: WindowInfo });
|
|
1240
|
+
var WindowMinimizeParams = z19.strictObject({ id: nonNegInt });
|
|
1241
|
+
var WindowMinimizeResult = z19.strictObject({ id: nonNegInt });
|
|
1126
1242
|
|
|
1127
1243
|
// src/schema/input.ts
|
|
1128
|
-
import { z as
|
|
1129
|
-
var InputKey =
|
|
1244
|
+
import { z as z20 } from "zod";
|
|
1245
|
+
var InputKey = z20.enum([
|
|
1130
1246
|
"cmd",
|
|
1131
1247
|
"ctrl",
|
|
1132
1248
|
"alt",
|
|
@@ -1206,203 +1322,203 @@ var InputKey = z19.enum([
|
|
|
1206
1322
|
"backslash",
|
|
1207
1323
|
"grave"
|
|
1208
1324
|
]);
|
|
1209
|
-
var InputTypeTextParams =
|
|
1210
|
-
var InputTypeTextResult =
|
|
1211
|
-
var InputHotkeyParams =
|
|
1325
|
+
var InputTypeTextParams = z20.strictObject({ text: z20.string().min(1).max(1e4) });
|
|
1326
|
+
var InputTypeTextResult = z20.strictObject({ characters: z20.int().min(1) });
|
|
1327
|
+
var InputHotkeyParams = z20.strictObject({
|
|
1212
1328
|
/** Pressed together in order and released in reverse: ["cmd", "shift", "t"]. */
|
|
1213
|
-
keys:
|
|
1329
|
+
keys: z20.array(InputKey).min(1).max(6)
|
|
1214
1330
|
});
|
|
1215
|
-
var InputHotkeyResult =
|
|
1216
|
-
var InputPoint =
|
|
1217
|
-
var InputMouseMoveParams =
|
|
1331
|
+
var InputHotkeyResult = z20.strictObject({ keys: z20.array(InputKey) });
|
|
1332
|
+
var InputPoint = z20.strictObject({ x: z20.int(), y: z20.int() });
|
|
1333
|
+
var InputMouseMoveParams = z20.strictObject({
|
|
1218
1334
|
/** Screen position in logical points (the coordinates screen.list and window.list report). */
|
|
1219
|
-
x:
|
|
1220
|
-
y:
|
|
1335
|
+
x: z20.int(),
|
|
1336
|
+
y: z20.int()
|
|
1221
1337
|
});
|
|
1222
|
-
var InputMouseMoveResult =
|
|
1338
|
+
var InputMouseMoveResult = z20.strictObject({
|
|
1223
1339
|
/** Where the pointer is now, read back from the OS. */
|
|
1224
1340
|
position: InputPoint
|
|
1225
1341
|
});
|
|
1226
|
-
var InputMouseClickParams =
|
|
1342
|
+
var InputMouseClickParams = z20.strictObject({
|
|
1227
1343
|
/** Move here first; clicks where the pointer is when absent. */
|
|
1228
|
-
x:
|
|
1229
|
-
y:
|
|
1230
|
-
button:
|
|
1231
|
-
double:
|
|
1344
|
+
x: z20.int().optional(),
|
|
1345
|
+
y: z20.int().optional(),
|
|
1346
|
+
button: z20.enum(["left", "right", "middle"]).default("left"),
|
|
1347
|
+
double: z20.boolean().default(false)
|
|
1232
1348
|
});
|
|
1233
|
-
var InputMouseClickResult =
|
|
1349
|
+
var InputMouseClickResult = z20.strictObject({
|
|
1234
1350
|
position: InputPoint,
|
|
1235
|
-
button:
|
|
1236
|
-
double:
|
|
1351
|
+
button: z20.enum(["left", "right", "middle"]),
|
|
1352
|
+
double: z20.boolean()
|
|
1237
1353
|
});
|
|
1238
1354
|
|
|
1239
1355
|
// src/schema/power.ts
|
|
1240
|
-
import { z as
|
|
1241
|
-
var PowerStatusParams =
|
|
1242
|
-
var PowerStatusResult =
|
|
1243
|
-
has_battery:
|
|
1356
|
+
import { z as z21 } from "zod";
|
|
1357
|
+
var PowerStatusParams = z21.strictObject({});
|
|
1358
|
+
var PowerStatusResult = z21.strictObject({
|
|
1359
|
+
has_battery: z21.boolean(),
|
|
1244
1360
|
/** 0–100; null without a battery. */
|
|
1245
|
-
percent:
|
|
1246
|
-
charging:
|
|
1361
|
+
percent: z21.number().min(0).max(100).nullable(),
|
|
1362
|
+
charging: z21.boolean().nullable(),
|
|
1247
1363
|
/** On wall power; null where the OS does not say. */
|
|
1248
|
-
plugged_in:
|
|
1364
|
+
plugged_in: z21.boolean().nullable(),
|
|
1249
1365
|
/** Minutes of battery left; null when charging, unknown or without a battery. */
|
|
1250
1366
|
minutes_left: nonNegInt.nullable(),
|
|
1251
1367
|
/** Matrx 2 is keeping the computer awake (power.prevent_sleep) until this time; null when it is not. */
|
|
1252
1368
|
awake_until_ms: epochMs.nullable()
|
|
1253
1369
|
});
|
|
1254
|
-
var PowerPreventSleepParams =
|
|
1370
|
+
var PowerPreventSleepParams = z21.strictObject({
|
|
1255
1371
|
/** Keep the computer awake this long; 0 lets it sleep again now. */
|
|
1256
|
-
seconds:
|
|
1372
|
+
seconds: z21.int().min(0).max(86400),
|
|
1257
1373
|
/** Shown where the OS lists what keeps it awake. */
|
|
1258
|
-
reason:
|
|
1374
|
+
reason: z21.string().min(1).max(128).default("Matrx 2 is working")
|
|
1259
1375
|
});
|
|
1260
|
-
var PowerPreventSleepResult =
|
|
1376
|
+
var PowerPreventSleepResult = z21.strictObject({
|
|
1261
1377
|
/** When it may sleep again; null after seconds 0. */
|
|
1262
1378
|
awake_until_ms: epochMs.nullable()
|
|
1263
1379
|
});
|
|
1264
1380
|
|
|
1265
1381
|
// src/schema/resources.ts
|
|
1266
|
-
import { z as
|
|
1267
|
-
var ResourcesDisk =
|
|
1382
|
+
import { z as z22 } from "zod";
|
|
1383
|
+
var ResourcesDisk = z22.strictObject({
|
|
1268
1384
|
/** Where it is mounted ("/", "C:"). */
|
|
1269
|
-
mount:
|
|
1385
|
+
mount: z22.string().max(512),
|
|
1270
1386
|
/** The file system ("apfs", "NTFS", "ext4"). */
|
|
1271
|
-
fs:
|
|
1387
|
+
fs: z22.string().max(64),
|
|
1272
1388
|
size_bytes: nonNegInt,
|
|
1273
1389
|
used_bytes: nonNegInt,
|
|
1274
1390
|
available_bytes: nonNegInt
|
|
1275
1391
|
});
|
|
1276
|
-
var ResourcesSnapshotParams =
|
|
1277
|
-
var ResourcesSnapshotResult =
|
|
1278
|
-
cpu:
|
|
1392
|
+
var ResourcesSnapshotParams = z22.strictObject({});
|
|
1393
|
+
var ResourcesSnapshotResult = z22.strictObject({
|
|
1394
|
+
cpu: z22.strictObject({
|
|
1279
1395
|
/** Busy share of all cores, 0–100, measured now. */
|
|
1280
|
-
percent:
|
|
1281
|
-
cores:
|
|
1396
|
+
percent: z22.number().min(0).max(100),
|
|
1397
|
+
cores: z22.int().min(1),
|
|
1282
1398
|
/** 1, 5 and 15 minute load averages; null on Windows. */
|
|
1283
|
-
load:
|
|
1399
|
+
load: z22.array(z22.number().min(0)).length(3).nullable()
|
|
1284
1400
|
}),
|
|
1285
|
-
memory:
|
|
1286
|
-
swap:
|
|
1287
|
-
disks:
|
|
1401
|
+
memory: z22.strictObject({ total_bytes: nonNegInt, used_bytes: nonNegInt, available_bytes: nonNegInt }),
|
|
1402
|
+
swap: z22.strictObject({ total_bytes: nonNegInt, used_bytes: nonNegInt }),
|
|
1403
|
+
disks: z22.array(ResourcesDisk).max(64),
|
|
1288
1404
|
uptime_seconds: nonNegInt
|
|
1289
1405
|
});
|
|
1290
1406
|
|
|
1291
1407
|
// src/schema/audio.ts
|
|
1292
|
-
import { z as
|
|
1293
|
-
var AudioDevice =
|
|
1408
|
+
import { z as z23 } from "zod";
|
|
1409
|
+
var AudioDevice = z23.strictObject({
|
|
1294
1410
|
/** The OS's name for it, as audio.record takes it. */
|
|
1295
|
-
id:
|
|
1296
|
-
name:
|
|
1297
|
-
default:
|
|
1411
|
+
id: z23.string().min(1).max(256),
|
|
1412
|
+
name: z23.string().max(256),
|
|
1413
|
+
default: z23.boolean()
|
|
1298
1414
|
});
|
|
1299
|
-
var AudioDevicesParams =
|
|
1300
|
-
var AudioDevicesResult =
|
|
1301
|
-
inputs:
|
|
1302
|
-
outputs:
|
|
1415
|
+
var AudioDevicesParams = z23.strictObject({});
|
|
1416
|
+
var AudioDevicesResult = z23.strictObject({
|
|
1417
|
+
inputs: z23.array(AudioDevice).max(64),
|
|
1418
|
+
outputs: z23.array(AudioDevice).max(64)
|
|
1303
1419
|
});
|
|
1304
|
-
var AudioRecordParams =
|
|
1305
|
-
seconds:
|
|
1420
|
+
var AudioRecordParams = z23.strictObject({
|
|
1421
|
+
seconds: z23.number().min(0.5).max(600),
|
|
1306
1422
|
/** The microphone (from audio.devices); the default input when absent. */
|
|
1307
|
-
device_id:
|
|
1423
|
+
device_id: z23.string().min(1).max(256).optional(),
|
|
1308
1424
|
/** Where the WAV file goes; a new file in the temp folder when absent. */
|
|
1309
1425
|
path: AbsPath.optional()
|
|
1310
1426
|
});
|
|
1311
|
-
var AudioRecordResult =
|
|
1427
|
+
var AudioRecordResult = z23.strictObject({
|
|
1312
1428
|
path: AbsPath,
|
|
1313
|
-
seconds:
|
|
1429
|
+
seconds: z23.number().min(0),
|
|
1314
1430
|
bytes: nonNegInt,
|
|
1315
1431
|
/** Loudest sample, 0–1: 0 means the device gave silence. */
|
|
1316
|
-
peak:
|
|
1432
|
+
peak: z23.number().min(0).max(1)
|
|
1317
1433
|
});
|
|
1318
|
-
var AudioPlayParams =
|
|
1319
|
-
var AudioPlayResult =
|
|
1434
|
+
var AudioPlayParams = z23.strictObject({ path: AbsPath });
|
|
1435
|
+
var AudioPlayResult = z23.strictObject({ path: AbsPath, seconds: z23.number().min(0) });
|
|
1320
1436
|
|
|
1321
1437
|
// src/schema/fs-watch.ts
|
|
1322
|
-
import { z as
|
|
1323
|
-
var FsWatchId =
|
|
1324
|
-
var FsWatchStartParams =
|
|
1438
|
+
import { z as z24 } from "zod";
|
|
1439
|
+
var FsWatchId = z24.string().regex(/^fw_[A-Za-z0-9]{12,40}$/);
|
|
1440
|
+
var FsWatchStartParams = z24.strictObject({
|
|
1325
1441
|
path: AbsPath,
|
|
1326
|
-
recursive:
|
|
1442
|
+
recursive: z24.boolean().default(true),
|
|
1327
1443
|
/** Globs relative to `path` whose changes are not reported (".git/**", "node_modules/**"). */
|
|
1328
|
-
ignore:
|
|
1444
|
+
ignore: z24.array(z24.string().max(256)).max(64).default([])
|
|
1329
1445
|
});
|
|
1330
|
-
var FsWatchStartResult =
|
|
1446
|
+
var FsWatchStartResult = z24.strictObject({
|
|
1331
1447
|
watch_id: FsWatchId,
|
|
1332
1448
|
path: AbsPath,
|
|
1333
1449
|
/** The watch ends by itself if nobody reads it for 30 minutes. */
|
|
1334
1450
|
expires_at_ms: epochMs
|
|
1335
1451
|
});
|
|
1336
|
-
var FsWatchEventsParams =
|
|
1452
|
+
var FsWatchEventsParams = z24.strictObject({
|
|
1337
1453
|
watch_id: FsWatchId,
|
|
1338
1454
|
/** Wait up to this long for a first change when none is waiting (0 answers at once). */
|
|
1339
|
-
wait_ms:
|
|
1455
|
+
wait_ms: z24.int().min(0).max(25e3).default(0)
|
|
1340
1456
|
});
|
|
1341
|
-
var FsWatchEventsResult =
|
|
1457
|
+
var FsWatchEventsResult = z24.strictObject({
|
|
1342
1458
|
/** What changed since the last read, oldest first; re-checked against the disk when read. */
|
|
1343
|
-
changes:
|
|
1459
|
+
changes: z24.array(FsChange).max(1e3),
|
|
1344
1460
|
/** Changes were dropped (more than 1000 waited): list the folder again. */
|
|
1345
|
-
overflow:
|
|
1461
|
+
overflow: z24.boolean(),
|
|
1346
1462
|
expires_at_ms: epochMs
|
|
1347
1463
|
});
|
|
1348
|
-
var FsWatchStopParams =
|
|
1349
|
-
var FsWatchStopResult =
|
|
1464
|
+
var FsWatchStopParams = z24.strictObject({ watch_id: FsWatchId });
|
|
1465
|
+
var FsWatchStopResult = z24.strictObject({ watch_id: FsWatchId });
|
|
1350
1466
|
|
|
1351
1467
|
// src/schema/exec-job.ts
|
|
1352
|
-
import { z as
|
|
1353
|
-
var ExecJobId =
|
|
1354
|
-
var ExecJobStartParams =
|
|
1355
|
-
command:
|
|
1468
|
+
import { z as z25 } from "zod";
|
|
1469
|
+
var ExecJobId = z25.string().regex(/^job_[A-Za-z0-9]{12,40}$/);
|
|
1470
|
+
var ExecJobStartParams = z25.strictObject({
|
|
1471
|
+
command: z25.string().min(1).max(131072),
|
|
1356
1472
|
/** The folder it runs in; the home folder when absent. */
|
|
1357
1473
|
cwd: AbsPath.optional(),
|
|
1358
|
-
env:
|
|
1474
|
+
env: z25.record(z25.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/).max(128), z25.string().max(32768)).optional()
|
|
1359
1475
|
});
|
|
1360
|
-
var ExecJobStartResult =
|
|
1361
|
-
var ExecJobOutputParams =
|
|
1476
|
+
var ExecJobStartResult = z25.strictObject({ job_id: ExecJobId, pid: z25.int().min(1), cwd: AbsPath });
|
|
1477
|
+
var ExecJobOutputParams = z25.strictObject({
|
|
1362
1478
|
job_id: ExecJobId,
|
|
1363
1479
|
/** Byte offset into the job's output to read from (next_offset of the last read; 0 = the start). */
|
|
1364
1480
|
offset: nonNegInt.default(0),
|
|
1365
1481
|
/** Wait up to this long for new output or the exit when none is waiting (0 answers at once). */
|
|
1366
|
-
wait_ms:
|
|
1367
|
-
max_bytes:
|
|
1482
|
+
wait_ms: z25.int().min(0).max(25e3).default(0),
|
|
1483
|
+
max_bytes: z25.int().min(1024).max(1048576).default(65536)
|
|
1368
1484
|
});
|
|
1369
|
-
var ExecJobOutputResult =
|
|
1485
|
+
var ExecJobOutputResult = z25.strictObject({
|
|
1370
1486
|
/** stdout and stderr interleaved as they arrived (UTF-8). */
|
|
1371
|
-
output:
|
|
1487
|
+
output: z25.string(),
|
|
1372
1488
|
next_offset: nonNegInt,
|
|
1373
1489
|
/** Bytes before `offset` that are gone (the job keeps its last 4 MiB). */
|
|
1374
1490
|
dropped_bytes: nonNegInt,
|
|
1375
|
-
running:
|
|
1376
|
-
exit_code:
|
|
1491
|
+
running: z25.boolean(),
|
|
1492
|
+
exit_code: z25.int().nullable()
|
|
1377
1493
|
});
|
|
1378
|
-
var ExecJobStopParams =
|
|
1494
|
+
var ExecJobStopParams = z25.strictObject({
|
|
1379
1495
|
job_id: ExecJobId,
|
|
1380
1496
|
/** End it at once (SIGKILL; on Windows the whole tree with /F) instead of asking it to quit. */
|
|
1381
|
-
force:
|
|
1497
|
+
force: z25.boolean().default(false)
|
|
1382
1498
|
});
|
|
1383
|
-
var ExecJobStopResult =
|
|
1384
|
-
var ExecJobInfo =
|
|
1499
|
+
var ExecJobStopResult = z25.strictObject({ job_id: ExecJobId, exited: z25.boolean(), exit_code: z25.int().nullable() });
|
|
1500
|
+
var ExecJobInfo = z25.strictObject({
|
|
1385
1501
|
job_id: ExecJobId,
|
|
1386
|
-
command:
|
|
1387
|
-
pid:
|
|
1502
|
+
command: z25.string().max(1024),
|
|
1503
|
+
pid: z25.int().min(1),
|
|
1388
1504
|
cwd: AbsPath,
|
|
1389
|
-
running:
|
|
1390
|
-
exit_code:
|
|
1505
|
+
running: z25.boolean(),
|
|
1506
|
+
exit_code: z25.int().nullable(),
|
|
1391
1507
|
started_at_ms: epochMs,
|
|
1392
1508
|
output_bytes: nonNegInt
|
|
1393
1509
|
});
|
|
1394
|
-
var ExecJobListParams =
|
|
1395
|
-
var ExecJobListResult =
|
|
1510
|
+
var ExecJobListParams = z25.strictObject({});
|
|
1511
|
+
var ExecJobListResult = z25.strictObject({ jobs: z25.array(ExecJobInfo).max(64) });
|
|
1396
1512
|
|
|
1397
1513
|
// src/schema/coding.ts
|
|
1398
|
-
import { z as
|
|
1399
|
-
var CodingServiceCredentials =
|
|
1400
|
-
access_token:
|
|
1401
|
-
user_id:
|
|
1514
|
+
import { z as z26 } from "zod";
|
|
1515
|
+
var CodingServiceCredentials = z26.strictObject({
|
|
1516
|
+
access_token: z26.string().min(16).max(16384),
|
|
1517
|
+
user_id: z26.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}$/),
|
|
1402
1518
|
/** The AI Matrx server this app talks to (production, or a local server on the nightly copy). */
|
|
1403
|
-
server_url:
|
|
1519
|
+
server_url: z26.string().min(1).max(2048).regex(/^https?:\/\/[^\s/?#]+(\/[^\s?#]*)?$/)
|
|
1404
1520
|
});
|
|
1405
|
-
var CodingHistoryBlocked =
|
|
1521
|
+
var CodingHistoryBlocked = z26.enum([
|
|
1406
1522
|
"signed_out",
|
|
1407
1523
|
"offline",
|
|
1408
1524
|
"organization_required",
|
|
@@ -1410,11 +1526,11 @@ var CodingHistoryBlocked = z25.enum([
|
|
|
1410
1526
|
"cloud_list_unavailable",
|
|
1411
1527
|
"history_too_large"
|
|
1412
1528
|
]);
|
|
1413
|
-
var CodingHistoryFailure =
|
|
1414
|
-
session_id:
|
|
1415
|
-
reason:
|
|
1529
|
+
var CodingHistoryFailure = z26.strictObject({
|
|
1530
|
+
session_id: z26.string().max(64),
|
|
1531
|
+
reason: z26.string().max(300)
|
|
1416
1532
|
});
|
|
1417
|
-
var CodingHistoryRun =
|
|
1533
|
+
var CodingHistoryRun = z26.strictObject({
|
|
1418
1534
|
/** Claude Code sessions found on this computer. */
|
|
1419
1535
|
local_sessions: nonNegInt,
|
|
1420
1536
|
/** Of those, already complete in AI Matrx. */
|
|
@@ -1429,39 +1545,39 @@ var CodingHistoryRun = z25.strictObject({
|
|
|
1429
1545
|
/** Changed while being read; a later run takes them. */
|
|
1430
1546
|
changed: nonNegInt,
|
|
1431
1547
|
failed: nonNegInt,
|
|
1432
|
-
failures:
|
|
1548
|
+
failures: z26.array(CodingHistoryFailure).max(20),
|
|
1433
1549
|
/** Candidates not reached yet. */
|
|
1434
1550
|
remaining: nonNegInt,
|
|
1435
1551
|
/** The one line a person reads, e.g. "Imported 12 of 14 sessions. 140 already in AI Matrx." */
|
|
1436
|
-
summary:
|
|
1552
|
+
summary: z26.string().max(400)
|
|
1437
1553
|
});
|
|
1438
|
-
var CodingHistoryStep =
|
|
1554
|
+
var CodingHistoryStep = z26.strictObject({
|
|
1439
1555
|
/** Null when the run could not start (blocked before a plan existed). */
|
|
1440
|
-
plan_id:
|
|
1441
|
-
finished:
|
|
1556
|
+
plan_id: z26.string().regex(/^[0-9a-f]{32}$/).nullable(),
|
|
1557
|
+
finished: z26.boolean(),
|
|
1442
1558
|
blocked: CodingHistoryBlocked.nullable(),
|
|
1443
1559
|
run: CodingHistoryRun
|
|
1444
1560
|
});
|
|
1445
|
-
var CodingPlanMissingParams =
|
|
1446
|
-
var CodingImportNextParams =
|
|
1447
|
-
plan_id:
|
|
1561
|
+
var CodingPlanMissingParams = z26.strictObject({ credentials: CodingServiceCredentials.nullable() });
|
|
1562
|
+
var CodingImportNextParams = z26.strictObject({
|
|
1563
|
+
plan_id: z26.string().regex(/^[0-9a-f]{32}$/),
|
|
1448
1564
|
credentials: CodingServiceCredentials.nullable()
|
|
1449
1565
|
});
|
|
1450
|
-
var CodingServiceProgress =
|
|
1451
|
-
phase:
|
|
1566
|
+
var CodingServiceProgress = z26.strictObject({
|
|
1567
|
+
phase: z26.enum(["checking", "importing"]),
|
|
1452
1568
|
done: nonNegInt,
|
|
1453
1569
|
total: nonNegInt
|
|
1454
1570
|
});
|
|
1455
|
-
var CodingHistoryImportMissingParams =
|
|
1456
|
-
var CodingHistoryImportMissingResult =
|
|
1457
|
-
state:
|
|
1571
|
+
var CodingHistoryImportMissingParams = z26.strictObject({});
|
|
1572
|
+
var CodingHistoryImportMissingResult = z26.strictObject({
|
|
1573
|
+
state: z26.enum(["done", "blocked", "cancelled"]),
|
|
1458
1574
|
blocked: CodingHistoryBlocked.nullable(),
|
|
1459
1575
|
run: CodingHistoryRun,
|
|
1460
1576
|
elapsed_ms: nonNegInt
|
|
1461
1577
|
});
|
|
1462
|
-
var CodingHistoryProgressEvent =
|
|
1578
|
+
var CodingHistoryProgressEvent = z26.strictObject({
|
|
1463
1579
|
request_id: RequestId,
|
|
1464
|
-
phase:
|
|
1580
|
+
phase: z26.enum(["checking", "importing"]),
|
|
1465
1581
|
/** Sessions settled so far, of `total` candidates (0 of 0 while checking). */
|
|
1466
1582
|
done: nonNegInt,
|
|
1467
1583
|
total: nonNegInt,
|
|
@@ -1506,6 +1622,11 @@ var OPS = {
|
|
|
1506
1622
|
"apps.profiles.save": { params: AppsProfilesSaveParams, result: AppsProfilesSaveResult, kind: "unary", since: "1.2", errors: ["AUTH_REQUIRED", "AUTH_FORBIDDEN", "NOT_FOUND", "INVALID_PARAMS", "CONFLICT", "PLATFORM_UNSUPPORTED", "DEVICE_OFFLINE", "INTERNAL"] },
|
|
1507
1623
|
"apps.profiles.remove": { params: AppsProfilesRemoveParams, result: AppsProfilesRemoveResult, kind: "unary", since: "1.2", errors: ["AUTH_REQUIRED", "AUTH_FORBIDDEN", "NOT_FOUND", "DEVICE_OFFLINE", "INTERNAL"] },
|
|
1508
1624
|
"apps.open": { params: AppsOpenParams, result: AppsOpenResult, kind: "unary", since: "1.2", errors: ["NOT_FOUND", "PLATFORM_UNSUPPORTED", "AUTH_REQUIRED", "DEVICE_OFFLINE", "INTERNAL"] },
|
|
1625
|
+
"apps.chats.list": { params: AppsChatsListParams, result: AppsChatsListResult, kind: "unary", since: "1.8", errors: ["NOT_FOUND", "PLATFORM_UNSUPPORTED", "INTERNAL"] },
|
|
1626
|
+
"apps.chats.watch": { params: AppsChatsWatchParams, result: AppsChatsWatchResult, kind: "resource", since: "1.8", errors: ["NOT_FOUND", "PLATFORM_UNSUPPORTED", "RESOURCE_BUSY", "INTERNAL"] },
|
|
1627
|
+
"apps.chats.star": { params: AppsChatsStarParams, result: AppsChatsStarResult, kind: "unary", since: "1.8", errors: ["NOT_FOUND", "PLATFORM_UNSUPPORTED", "INTERNAL"] },
|
|
1628
|
+
"apps.projects.file": { params: AppsProjectsFileParams, result: AppsProjectsFileResult, kind: "unary", since: "1.8", errors: ["NOT_FOUND", "INVALID_PARAMS", "CONFLICT", "PLATFORM_UNSUPPORTED", "INTERNAL"] },
|
|
1629
|
+
"apps.projects.unfile": { params: AppsProjectsUnfileParams, result: AppsProjectsUnfileResult, kind: "unary", since: "1.8", errors: ["NOT_FOUND", "CONFLICT", "PLATFORM_UNSUPPORTED", "INTERNAL"] },
|
|
1509
1630
|
"proc.list": { params: ProcListParams, result: ProcListResult, kind: "unary", since: "1.3", errors: ["INVALID_PARAMS", "PLATFORM_UNSUPPORTED", "INTERNAL"] },
|
|
1510
1631
|
"proc.ports": { params: ProcPortsParams, result: ProcPortsResult, kind: "unary", since: "1.3", errors: ["INVALID_PARAMS", "PERMISSION_DENIED_OS", "PLATFORM_UNSUPPORTED", "INTERNAL"] },
|
|
1511
1632
|
"proc.kill": { params: ProcKillParams, result: ProcKillResult, kind: "unary", since: "1.3", errors: ["NOT_FOUND", "AUTH_FORBIDDEN", "PERMISSION_DENIED_OS", "INVALID_PARAMS", "INTERNAL"] },
|
|
@@ -1542,6 +1663,7 @@ var OPS = {
|
|
|
1542
1663
|
};
|
|
1543
1664
|
var EVENTS = {
|
|
1544
1665
|
"fs.changed": FsChangedEvent,
|
|
1666
|
+
"apps.chats.changed": AppsChatsChangedEvent,
|
|
1545
1667
|
"exec.exited": ExecExitedEvent,
|
|
1546
1668
|
"exec.title": ExecTitleEvent,
|
|
1547
1669
|
"exec.cwd": ExecCwdEvent,
|
|
@@ -1806,7 +1928,28 @@ var NAMED_SCHEMAS = {
|
|
|
1806
1928
|
AppsProfilesRemoveParams,
|
|
1807
1929
|
AppsProfilesRemoveResult,
|
|
1808
1930
|
AppsOpenParams,
|
|
1809
|
-
AppsOpenResult
|
|
1931
|
+
AppsOpenResult,
|
|
1932
|
+
ChatId,
|
|
1933
|
+
ChatPlace,
|
|
1934
|
+
ChatProjectId,
|
|
1935
|
+
ChatWindow,
|
|
1936
|
+
ChatProject,
|
|
1937
|
+
ChatPin,
|
|
1938
|
+
ChatRunning,
|
|
1939
|
+
ChatHidden,
|
|
1940
|
+
ChatLastUse,
|
|
1941
|
+
ChatRow,
|
|
1942
|
+
AppsChatsListParams,
|
|
1943
|
+
AppsChatsListResult,
|
|
1944
|
+
AppsChatsWatchParams,
|
|
1945
|
+
AppsChatsWatchResult,
|
|
1946
|
+
AppsChatsChangedEvent,
|
|
1947
|
+
AppsChatsStarParams,
|
|
1948
|
+
AppsChatsStarResult,
|
|
1949
|
+
AppsProjectsFileParams,
|
|
1950
|
+
AppsProjectsFileResult,
|
|
1951
|
+
AppsProjectsUnfileParams,
|
|
1952
|
+
AppsProjectsUnfileResult
|
|
1810
1953
|
};
|
|
1811
1954
|
|
|
1812
1955
|
// src/versioning.ts
|
|
@@ -1814,7 +1957,8 @@ var FIELDS_SINCE = {
|
|
|
1814
1957
|
FsPatchResult: { edits_applied: "1.1", edits_failed: "1.1" },
|
|
1815
1958
|
"ProtocolErrorBody.data": { edits_failed: "1.1" },
|
|
1816
1959
|
"RelayCallResponse|0": { protocol_version: "1.1" },
|
|
1817
|
-
"RelayCallResponse|1": { protocol_version: "1.1" }
|
|
1960
|
+
"RelayCallResponse|1": { protocol_version: "1.1" },
|
|
1961
|
+
WindowInfo: { app: "1.7", pid: "1.7" }
|
|
1818
1962
|
};
|
|
1819
1963
|
var NULL_SINCE = {
|
|
1820
1964
|
"RelayDeviceStatusEvent.since_ms": { since: "1.1", olderPeersGet: 0 }
|
|
@@ -1868,8 +2012,28 @@ function strip(value, fields, version) {
|
|
|
1868
2012
|
return out ?? value;
|
|
1869
2013
|
}
|
|
1870
2014
|
var RESULT_PATH = /* @__PURE__ */ new Map([["fs.patch", "FsPatchResult"]]);
|
|
2015
|
+
var WINDOW_RESULTS = /* @__PURE__ */ new Map([
|
|
2016
|
+
["window.list", "windows"],
|
|
2017
|
+
["window.focus", "window"],
|
|
2018
|
+
["window.move", "window"]
|
|
2019
|
+
]);
|
|
2020
|
+
function stripWindows(value, key, version) {
|
|
2021
|
+
if (value === null || typeof value !== "object") return value;
|
|
2022
|
+
const body = value;
|
|
2023
|
+
const inner = body[key];
|
|
2024
|
+
if (inner === void 0) return value;
|
|
2025
|
+
const fields = FIELDS_SINCE.WindowInfo;
|
|
2026
|
+
if (Array.isArray(inner)) {
|
|
2027
|
+
const next2 = inner.map((w) => strip(w, fields, version));
|
|
2028
|
+
return next2.some((w, i) => w !== inner[i]) ? { ...body, [key]: next2 } : value;
|
|
2029
|
+
}
|
|
2030
|
+
const next = strip(inner, fields, version);
|
|
2031
|
+
return next === inner ? value : { ...body, [key]: next };
|
|
2032
|
+
}
|
|
1871
2033
|
function forPeer(op, part, value, version) {
|
|
1872
2034
|
if (part === "result") {
|
|
2035
|
+
const windowKey = op ? WINDOW_RESULTS.get(op) : void 0;
|
|
2036
|
+
if (windowKey) return stripWindows(value, windowKey, version);
|
|
1873
2037
|
const path = op ? RESULT_PATH.get(op) : void 0;
|
|
1874
2038
|
return path ? strip(value, FIELDS_SINCE[path], version) : value;
|
|
1875
2039
|
}
|
|
@@ -1885,10 +2049,10 @@ function forPeer(op, part, value, version) {
|
|
|
1885
2049
|
}
|
|
1886
2050
|
return data === body.data ? value : { ...body, data };
|
|
1887
2051
|
}
|
|
1888
|
-
var VERSIONED_RESULT_OPS = [...RESULT_PATH.keys()];
|
|
2052
|
+
var VERSIONED_RESULT_OPS = [...RESULT_PATH.keys(), ...WINDOW_RESULTS.keys()];
|
|
1889
2053
|
|
|
1890
2054
|
// src/contract.ts
|
|
1891
|
-
var CONTRACT_SHA256 = "
|
|
2055
|
+
var CONTRACT_SHA256 = "7a5b3712fe3200b8f1051edb1cc9702e696a8d24b2033f9ea73e1a422f52dd33";
|
|
1892
2056
|
|
|
1893
2057
|
// src/close-policy.ts
|
|
1894
2058
|
var CLOSE_RULES = {
|
|
@@ -2238,6 +2402,13 @@ export {
|
|
|
2238
2402
|
AppProfileLocator,
|
|
2239
2403
|
AppSupport,
|
|
2240
2404
|
AppUsageReading,
|
|
2405
|
+
AppsChatsChangedEvent,
|
|
2406
|
+
AppsChatsListParams,
|
|
2407
|
+
AppsChatsListResult,
|
|
2408
|
+
AppsChatsStarParams,
|
|
2409
|
+
AppsChatsStarResult,
|
|
2410
|
+
AppsChatsWatchParams,
|
|
2411
|
+
AppsChatsWatchResult,
|
|
2241
2412
|
AppsListParams,
|
|
2242
2413
|
AppsListResult,
|
|
2243
2414
|
AppsOpenParams,
|
|
@@ -2248,6 +2419,10 @@ export {
|
|
|
2248
2419
|
AppsProfilesRemoveResult,
|
|
2249
2420
|
AppsProfilesSaveParams,
|
|
2250
2421
|
AppsProfilesSaveResult,
|
|
2422
|
+
AppsProjectsFileParams,
|
|
2423
|
+
AppsProjectsFileResult,
|
|
2424
|
+
AppsProjectsUnfileParams,
|
|
2425
|
+
AppsProjectsUnfileResult,
|
|
2251
2426
|
AudioDevice,
|
|
2252
2427
|
AudioDevicesParams,
|
|
2253
2428
|
AudioDevicesResult,
|
|
@@ -2260,6 +2435,16 @@ export {
|
|
|
2260
2435
|
CLOSE_RULES,
|
|
2261
2436
|
CONTRACT_SHA256,
|
|
2262
2437
|
CancelMsg,
|
|
2438
|
+
ChatHidden,
|
|
2439
|
+
ChatId,
|
|
2440
|
+
ChatLastUse,
|
|
2441
|
+
ChatPin,
|
|
2442
|
+
ChatPlace,
|
|
2443
|
+
ChatProject,
|
|
2444
|
+
ChatProjectId,
|
|
2445
|
+
ChatRow,
|
|
2446
|
+
ChatRunning,
|
|
2447
|
+
ChatWindow,
|
|
2263
2448
|
ClientToCoreMsg,
|
|
2264
2449
|
ClientType,
|
|
2265
2450
|
ClipboardReadParams,
|