@ai-matrx/desktop-protocol 0.21.15 → 0.21.16
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 +6 -0
- package/dist/client.cjs +675 -599
- 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 +675 -599
- package/dist/client.js.map +1 -1
- package/dist/index.cjs +844 -744
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +162 -6
- package/dist/index.d.ts +162 -6
- package/dist/index.js +844 -744
- package/dist/index.js.map +1 -1
- package/dist/{models-BFxuhPGw.d.cts → models-BpZriuN2.d.cts} +206 -1
- package/dist/{models-BFxuhPGw.d.ts → models-BpZriuN2.d.ts} +206 -1
- package/dist/react.d.cts +80 -0
- package/dist/react.d.ts +80 -0
- package/generated/desktop-protocol.schema.json +352 -1
- package/package.json +4 -4
package/dist/client.js
CHANGED
|
@@ -112,7 +112,7 @@ import { z as z2 } from "zod";
|
|
|
112
112
|
import { z } from "zod";
|
|
113
113
|
import { UUID_SHAPE_PATTERN } from "@ai-matrx/kit/uuid";
|
|
114
114
|
var PROTOCOL_MAJOR = 1;
|
|
115
|
-
var PROTOCOL_MINOR =
|
|
115
|
+
var PROTOCOL_MINOR = 23;
|
|
116
116
|
var PROTOCOL_VERSION = `${PROTOCOL_MAJOR}.${PROTOCOL_MINOR}`;
|
|
117
117
|
var ProtocolVersion = z.string().regex(/^[1-9][0-9]{0,2}\.[0-9]{1,3}$/);
|
|
118
118
|
var RequestId = z.string().min(1).max(64).regex(/^[A-Za-z0-9_-]+$/);
|
|
@@ -948,164 +948,236 @@ var WebBrowserFetchResult = z13.strictObject({
|
|
|
948
948
|
});
|
|
949
949
|
var ToolsServiceProgress = z13.strictObject({ phase: z13.enum(["fetching", "installing"]), done: nonNegInt, total: nonNegInt });
|
|
950
950
|
|
|
951
|
-
// src/schema/
|
|
951
|
+
// src/schema/account.ts
|
|
952
952
|
import { z as z14 } from "zod";
|
|
953
|
-
|
|
954
|
-
var
|
|
953
|
+
import { UUID_SHAPE_PATTERN as UUID_SHAPE_PATTERN2 } from "@ai-matrx/kit/uuid";
|
|
954
|
+
var AccountRowId = z14.string().regex(UUID_SHAPE_PATTERN2);
|
|
955
|
+
var AccountReadState = z14.enum(["ok", "signed_out", "unavailable"]);
|
|
956
|
+
var AccountAgent = z14.strictObject({
|
|
957
|
+
id: AccountRowId,
|
|
958
|
+
name: z14.string().min(1).max(200),
|
|
959
|
+
description: z14.string().max(2e3),
|
|
960
|
+
/** The agent's category ("" when it has none): the library's folders. */
|
|
961
|
+
category: z14.string().max(120),
|
|
962
|
+
/** The agent's kind as the platform names it (user, builtin, orchestra…). */
|
|
963
|
+
agent_type: z14.string().max(40),
|
|
964
|
+
is_favorite: z14.boolean(),
|
|
965
|
+
/** The person owns it (false: shared with them). */
|
|
966
|
+
is_owner: z14.boolean(),
|
|
967
|
+
/** Who shared it, when it is shared with the person. */
|
|
968
|
+
shared_by: z14.string().max(320).nullable(),
|
|
969
|
+
/** The organization it belongs to. */
|
|
970
|
+
organization: z14.string().max(200).nullable(),
|
|
971
|
+
updated_at_ms: epochMs
|
|
972
|
+
});
|
|
973
|
+
var AccountAgentsListParams = z14.strictObject({});
|
|
974
|
+
var AccountAgentsListResult = z14.strictObject({
|
|
975
|
+
state: AccountReadState,
|
|
976
|
+
/** One line when state is not "ok" (what went wrong, in plain words); null otherwise. */
|
|
977
|
+
problem: z14.string().max(300).nullable(),
|
|
978
|
+
agents: z14.array(AccountAgent).max(2e3)
|
|
979
|
+
});
|
|
980
|
+
var VaultItemKind = z14.enum(["login", "passkey", "key", "other"]);
|
|
981
|
+
var VaultFieldSummary = z14.strictObject({
|
|
982
|
+
key: z14.string().min(1).max(120),
|
|
983
|
+
/** visible: shown as written; revealable: copyable on request; sealed: never leaves the server. */
|
|
984
|
+
handling: z14.enum(["visible", "revealable", "sealed"]),
|
|
985
|
+
/** The masked hint the server keeps ("••••ab12"), or "" when it keeps none. */
|
|
986
|
+
hint: z14.string().max(200)
|
|
987
|
+
});
|
|
988
|
+
var VaultItemSummary = z14.strictObject({
|
|
989
|
+
id: AccountRowId,
|
|
990
|
+
name: z14.string().min(1).max(200),
|
|
991
|
+
kind: VaultItemKind,
|
|
992
|
+
/** The platform's definition ("website_login", "native_passkey", "custom"…). */
|
|
993
|
+
definition: z14.string().max(80),
|
|
994
|
+
/** The sign-in's user name hint (its "username" field's hint); null when it has none. */
|
|
995
|
+
username: z14.string().max(200).nullable(),
|
|
996
|
+
/** The sites a sign-in is for. */
|
|
997
|
+
urls: z14.array(z14.string().max(2048)).max(20),
|
|
998
|
+
notes: z14.string().max(4e3).nullable(),
|
|
999
|
+
fields: z14.array(VaultFieldSummary).max(50),
|
|
1000
|
+
/** Shared with the person by someone else (Passwords' shared groups). */
|
|
1001
|
+
shared: z14.boolean(),
|
|
1002
|
+
/** active, or the server's other states (a deleted item waits in "deleted"). */
|
|
1003
|
+
status: z14.string().max(40),
|
|
1004
|
+
created_at_ms: epochMs,
|
|
1005
|
+
updated_at_ms: epochMs
|
|
1006
|
+
});
|
|
1007
|
+
var AccountVaultListParams = z14.strictObject({});
|
|
1008
|
+
var AccountVaultListResult = z14.strictObject({
|
|
1009
|
+
state: AccountReadState,
|
|
1010
|
+
problem: z14.string().max(300).nullable(),
|
|
1011
|
+
items: z14.array(VaultItemSummary).max(5e3)
|
|
1012
|
+
});
|
|
1013
|
+
var AccountVaultCopyParams = z14.strictObject({
|
|
1014
|
+
item_id: AccountRowId,
|
|
1015
|
+
field_key: z14.string().min(1).max(120)
|
|
1016
|
+
});
|
|
1017
|
+
var AccountVaultCopyResult = z14.strictObject({
|
|
1018
|
+
copied: z14.boolean(),
|
|
1019
|
+
/** When the clipboard is cleared again if it still holds the value (Passwords clears a copied password). */
|
|
1020
|
+
clears_at_ms: epochMs
|
|
1021
|
+
});
|
|
1022
|
+
|
|
1023
|
+
// src/schema/proc.ts
|
|
1024
|
+
import { z as z15 } from "zod";
|
|
1025
|
+
var ProcSort = z15.enum(["cpu", "memory", "pid", "name"]);
|
|
1026
|
+
var ProcListParams = z15.strictObject({
|
|
955
1027
|
/** Case-insensitive substring of the process name or its command line. */
|
|
956
|
-
name:
|
|
1028
|
+
name: z15.string().min(1).max(128).optional(),
|
|
957
1029
|
sort: ProcSort.default("cpu"),
|
|
958
|
-
limit:
|
|
1030
|
+
limit: z15.int().min(1).max(500).default(50)
|
|
959
1031
|
});
|
|
960
|
-
var ProcInfo =
|
|
961
|
-
pid:
|
|
1032
|
+
var ProcInfo = z15.strictObject({
|
|
1033
|
+
pid: z15.int().min(0),
|
|
962
1034
|
/** Parent process id; null where the OS does not report it. */
|
|
963
|
-
ppid:
|
|
964
|
-
name:
|
|
1035
|
+
ppid: z15.int().min(0).nullable(),
|
|
1036
|
+
name: z15.string().max(256),
|
|
965
1037
|
/** The command line, cut to 1024 characters. */
|
|
966
|
-
command:
|
|
1038
|
+
command: z15.string().max(1024),
|
|
967
1039
|
/** Share of one core, as `ps` and Task Manager report it; null where the OS does not say. */
|
|
968
|
-
cpu_percent:
|
|
1040
|
+
cpu_percent: z15.number().min(0).nullable(),
|
|
969
1041
|
memory_bytes: nonNegInt.nullable(),
|
|
970
|
-
user:
|
|
1042
|
+
user: z15.string().max(128).nullable()
|
|
971
1043
|
});
|
|
972
|
-
var ProcListResult =
|
|
973
|
-
processes:
|
|
1044
|
+
var ProcListResult = z15.strictObject({
|
|
1045
|
+
processes: z15.array(ProcInfo).max(500),
|
|
974
1046
|
/** Processes that matched before `limit`. */
|
|
975
1047
|
total: nonNegInt,
|
|
976
|
-
truncated:
|
|
1048
|
+
truncated: z15.boolean()
|
|
977
1049
|
});
|
|
978
|
-
var ProcPortsParams =
|
|
1050
|
+
var ProcPortsParams = z15.strictObject({
|
|
979
1051
|
/** Only this port. */
|
|
980
|
-
port:
|
|
1052
|
+
port: z15.int().min(1).max(65535).optional()
|
|
981
1053
|
});
|
|
982
|
-
var ProcPort =
|
|
983
|
-
port:
|
|
984
|
-
protocol:
|
|
1054
|
+
var ProcPort = z15.strictObject({
|
|
1055
|
+
port: z15.int().min(1).max(65535),
|
|
1056
|
+
protocol: z15.enum(["tcp", "udp"]),
|
|
985
1057
|
/** The local address it listens on ("127.0.0.1", "*", "::"). */
|
|
986
|
-
address:
|
|
987
|
-
pid:
|
|
988
|
-
process:
|
|
1058
|
+
address: z15.string().max(64),
|
|
1059
|
+
pid: z15.int().min(0).nullable(),
|
|
1060
|
+
process: z15.string().max(256).nullable()
|
|
989
1061
|
});
|
|
990
|
-
var ProcPortsResult =
|
|
991
|
-
var ProcKillParams =
|
|
992
|
-
pid:
|
|
1062
|
+
var ProcPortsResult = z15.strictObject({ ports: z15.array(ProcPort).max(4e3) });
|
|
1063
|
+
var ProcKillParams = z15.strictObject({
|
|
1064
|
+
pid: z15.int().min(1),
|
|
993
1065
|
/** Kill outright (SIGKILL; on Windows the same /F) instead of asking it to quit. */
|
|
994
|
-
force:
|
|
1066
|
+
force: z15.boolean().default(false)
|
|
995
1067
|
});
|
|
996
|
-
var ProcKillResult =
|
|
997
|
-
pid:
|
|
998
|
-
signal:
|
|
1068
|
+
var ProcKillResult = z15.strictObject({
|
|
1069
|
+
pid: z15.int().min(1),
|
|
1070
|
+
signal: z15.enum(["SIGTERM", "SIGKILL"]),
|
|
999
1071
|
/** True when the process was gone within 3 s. */
|
|
1000
|
-
exited:
|
|
1072
|
+
exited: z15.boolean()
|
|
1001
1073
|
});
|
|
1002
1074
|
|
|
1003
1075
|
// src/schema/system.ts
|
|
1004
|
-
import { z as
|
|
1005
|
-
var SystemOpenUrlParams =
|
|
1076
|
+
import { z as z16 } from "zod";
|
|
1077
|
+
var SystemOpenUrlParams = z16.strictObject({
|
|
1006
1078
|
/** http, https or mailto; opened in the person's default app for it. */
|
|
1007
|
-
url:
|
|
1079
|
+
url: z16.string().min(1).max(4096)
|
|
1008
1080
|
});
|
|
1009
|
-
var SystemOpenUrlResult =
|
|
1010
|
-
var SystemOpenPathParams =
|
|
1081
|
+
var SystemOpenUrlResult = z16.strictObject({ url: z16.string().max(4096) });
|
|
1082
|
+
var SystemOpenPathParams = z16.strictObject({
|
|
1011
1083
|
path: AbsPath,
|
|
1012
1084
|
/** Show it in the file manager (Finder, Explorer) instead of opening it. */
|
|
1013
|
-
reveal:
|
|
1085
|
+
reveal: z16.boolean().default(false)
|
|
1014
1086
|
});
|
|
1015
|
-
var SystemOpenPathResult =
|
|
1016
|
-
var SystemNotifyParams =
|
|
1017
|
-
title:
|
|
1018
|
-
body:
|
|
1087
|
+
var SystemOpenPathResult = z16.strictObject({ path: AbsPath, revealed: z16.boolean() });
|
|
1088
|
+
var SystemNotifyParams = z16.strictObject({
|
|
1089
|
+
title: z16.string().min(1).max(128),
|
|
1090
|
+
body: z16.string().max(1024).default("")
|
|
1019
1091
|
});
|
|
1020
|
-
var SystemNotifyResult =
|
|
1092
|
+
var SystemNotifyResult = z16.strictObject({
|
|
1021
1093
|
/** False when this computer has no notification service to show it (a bare Linux box). */
|
|
1022
|
-
shown:
|
|
1094
|
+
shown: z16.boolean()
|
|
1023
1095
|
});
|
|
1024
1096
|
|
|
1025
1097
|
// src/schema/screen.ts
|
|
1026
|
-
import { z as
|
|
1027
|
-
var ScreenDisplay =
|
|
1098
|
+
import { z as z17 } from "zod";
|
|
1099
|
+
var ScreenDisplay = z17.strictObject({
|
|
1028
1100
|
/** The OS's display id; pass it to screen.capture. */
|
|
1029
1101
|
id: nonNegInt,
|
|
1030
|
-
name:
|
|
1102
|
+
name: z17.string().max(128),
|
|
1031
1103
|
/** Position and size in the OS's logical points (x and y may be negative left of or above the main display). */
|
|
1032
|
-
x:
|
|
1033
|
-
y:
|
|
1034
|
-
width:
|
|
1035
|
-
height:
|
|
1104
|
+
x: z17.int(),
|
|
1105
|
+
y: z17.int(),
|
|
1106
|
+
width: z17.int().min(1),
|
|
1107
|
+
height: z17.int().min(1),
|
|
1036
1108
|
/** Pixels per point (2 on a Retina display). */
|
|
1037
|
-
scale:
|
|
1038
|
-
primary:
|
|
1109
|
+
scale: z17.number().min(0.1).max(8),
|
|
1110
|
+
primary: z17.boolean()
|
|
1039
1111
|
});
|
|
1040
|
-
var ScreenListParams =
|
|
1041
|
-
var ScreenListResult =
|
|
1042
|
-
var ScreenCaptureParams =
|
|
1112
|
+
var ScreenListParams = z17.strictObject({});
|
|
1113
|
+
var ScreenListResult = z17.strictObject({ displays: z17.array(ScreenDisplay).max(32) });
|
|
1114
|
+
var ScreenCaptureParams = z17.strictObject({
|
|
1043
1115
|
/** The display (from screen.list); the primary display when absent. */
|
|
1044
1116
|
display_id: nonNegInt.optional(),
|
|
1045
|
-
format:
|
|
1117
|
+
format: z17.enum(["jpeg", "png"]).default("jpeg"),
|
|
1046
1118
|
/** Scale the picture down to at most this width in pixels (kept when already smaller). */
|
|
1047
|
-
max_width:
|
|
1119
|
+
max_width: z17.int().min(160).max(7680).default(1600)
|
|
1048
1120
|
});
|
|
1049
|
-
var ScreenCaptureResult =
|
|
1121
|
+
var ScreenCaptureResult = z17.strictObject({
|
|
1050
1122
|
display_id: nonNegInt,
|
|
1051
|
-
mime_type:
|
|
1052
|
-
width:
|
|
1053
|
-
height:
|
|
1123
|
+
mime_type: z17.enum(["image/jpeg", "image/png"]),
|
|
1124
|
+
width: z17.int().min(1),
|
|
1125
|
+
height: z17.int().min(1),
|
|
1054
1126
|
/** The display's full resolution in pixels, before scaling. */
|
|
1055
|
-
source_width:
|
|
1056
|
-
source_height:
|
|
1127
|
+
source_width: z17.int().min(1),
|
|
1128
|
+
source_height: z17.int().min(1),
|
|
1057
1129
|
/** The image, base64 (at most 6 MiB of text). */
|
|
1058
|
-
data_base64:
|
|
1130
|
+
data_base64: z17.string().max(6291456)
|
|
1059
1131
|
});
|
|
1060
1132
|
|
|
1061
1133
|
// src/schema/window.ts
|
|
1062
|
-
import { z as
|
|
1063
|
-
var WindowInfo =
|
|
1134
|
+
import { z as z18 } from "zod";
|
|
1135
|
+
var WindowInfo = z18.strictObject({
|
|
1064
1136
|
/** The OS's window handle (macOS window number, Windows HWND, X11 window id). */
|
|
1065
1137
|
id: nonNegInt,
|
|
1066
|
-
title:
|
|
1138
|
+
title: z18.string().max(512),
|
|
1067
1139
|
/** Position and size in logical points. */
|
|
1068
|
-
x:
|
|
1069
|
-
y:
|
|
1070
|
-
width:
|
|
1071
|
-
height:
|
|
1140
|
+
x: z18.int(),
|
|
1141
|
+
y: z18.int(),
|
|
1142
|
+
width: z18.int().min(0),
|
|
1143
|
+
height: z18.int().min(0),
|
|
1072
1144
|
/**
|
|
1073
1145
|
* The application that owns the window, by the name the OS shows people; absent when the OS does
|
|
1074
1146
|
* not say. Optional (never null, the schema rule) because it was added in protocol 1.7: an older
|
|
1075
1147
|
* app's answer has no such field (FIELDS_SINCE).
|
|
1076
1148
|
*/
|
|
1077
|
-
app:
|
|
1149
|
+
app: z18.string().max(256).optional(),
|
|
1078
1150
|
/** The owning process id; absent when the OS does not say. Added in protocol 1.7. */
|
|
1079
|
-
pid:
|
|
1151
|
+
pid: z18.int().min(0).optional()
|
|
1080
1152
|
});
|
|
1081
|
-
var WindowListParams =
|
|
1153
|
+
var WindowListParams = z18.strictObject({
|
|
1082
1154
|
/** Case-insensitive substring of the window title. */
|
|
1083
|
-
title:
|
|
1084
|
-
limit:
|
|
1155
|
+
title: z18.string().min(1).max(256).optional(),
|
|
1156
|
+
limit: z18.int().min(1).max(500).default(100)
|
|
1085
1157
|
});
|
|
1086
|
-
var WindowListResult =
|
|
1087
|
-
windows:
|
|
1158
|
+
var WindowListResult = z18.strictObject({
|
|
1159
|
+
windows: z18.array(WindowInfo).max(500),
|
|
1088
1160
|
total: nonNegInt,
|
|
1089
|
-
truncated:
|
|
1161
|
+
truncated: z18.boolean()
|
|
1090
1162
|
});
|
|
1091
|
-
var WindowFocusParams =
|
|
1092
|
-
var WindowFocusResult =
|
|
1093
|
-
var WindowMoveParams =
|
|
1163
|
+
var WindowFocusParams = z18.strictObject({ id: nonNegInt });
|
|
1164
|
+
var WindowFocusResult = z18.strictObject({ window: WindowInfo });
|
|
1165
|
+
var WindowMoveParams = z18.strictObject({
|
|
1094
1166
|
id: nonNegInt,
|
|
1095
1167
|
/** New top-left corner; unchanged when absent. */
|
|
1096
|
-
x:
|
|
1097
|
-
y:
|
|
1168
|
+
x: z18.int().optional(),
|
|
1169
|
+
y: z18.int().optional(),
|
|
1098
1170
|
/** New size; unchanged when absent. */
|
|
1099
|
-
width:
|
|
1100
|
-
height:
|
|
1171
|
+
width: z18.int().min(50).max(16384).optional(),
|
|
1172
|
+
height: z18.int().min(50).max(16384).optional()
|
|
1101
1173
|
});
|
|
1102
|
-
var WindowMoveResult =
|
|
1103
|
-
var WindowMinimizeParams =
|
|
1104
|
-
var WindowMinimizeResult =
|
|
1174
|
+
var WindowMoveResult = z18.strictObject({ window: WindowInfo });
|
|
1175
|
+
var WindowMinimizeParams = z18.strictObject({ id: nonNegInt });
|
|
1176
|
+
var WindowMinimizeResult = z18.strictObject({ id: nonNegInt });
|
|
1105
1177
|
|
|
1106
1178
|
// src/schema/input.ts
|
|
1107
|
-
import { z as
|
|
1108
|
-
var InputKey =
|
|
1179
|
+
import { z as z19 } from "zod";
|
|
1180
|
+
var InputKey = z19.enum([
|
|
1109
1181
|
"cmd",
|
|
1110
1182
|
"ctrl",
|
|
1111
1183
|
"alt",
|
|
@@ -1185,181 +1257,181 @@ var InputKey = z18.enum([
|
|
|
1185
1257
|
"backslash",
|
|
1186
1258
|
"grave"
|
|
1187
1259
|
]);
|
|
1188
|
-
var InputTypeTextParams =
|
|
1189
|
-
var InputTypeTextResult =
|
|
1190
|
-
var InputHotkeyParams =
|
|
1260
|
+
var InputTypeTextParams = z19.strictObject({ text: z19.string().min(1).max(1e4) });
|
|
1261
|
+
var InputTypeTextResult = z19.strictObject({ characters: z19.int().min(1) });
|
|
1262
|
+
var InputHotkeyParams = z19.strictObject({
|
|
1191
1263
|
/** Pressed together in order and released in reverse: ["cmd", "shift", "t"]. */
|
|
1192
|
-
keys:
|
|
1264
|
+
keys: z19.array(InputKey).min(1).max(6)
|
|
1193
1265
|
});
|
|
1194
|
-
var InputHotkeyResult =
|
|
1195
|
-
var InputPoint =
|
|
1196
|
-
var InputMouseMoveParams =
|
|
1266
|
+
var InputHotkeyResult = z19.strictObject({ keys: z19.array(InputKey) });
|
|
1267
|
+
var InputPoint = z19.strictObject({ x: z19.int(), y: z19.int() });
|
|
1268
|
+
var InputMouseMoveParams = z19.strictObject({
|
|
1197
1269
|
/** Screen position in logical points (the coordinates screen.list and window.list report). */
|
|
1198
|
-
x:
|
|
1199
|
-
y:
|
|
1270
|
+
x: z19.int(),
|
|
1271
|
+
y: z19.int()
|
|
1200
1272
|
});
|
|
1201
|
-
var InputMouseMoveResult =
|
|
1273
|
+
var InputMouseMoveResult = z19.strictObject({
|
|
1202
1274
|
/** Where the pointer is now, read back from the OS. */
|
|
1203
1275
|
position: InputPoint
|
|
1204
1276
|
});
|
|
1205
|
-
var InputMouseClickParams =
|
|
1277
|
+
var InputMouseClickParams = z19.strictObject({
|
|
1206
1278
|
/** Move here first; clicks where the pointer is when absent. */
|
|
1207
|
-
x:
|
|
1208
|
-
y:
|
|
1209
|
-
button:
|
|
1210
|
-
double:
|
|
1279
|
+
x: z19.int().optional(),
|
|
1280
|
+
y: z19.int().optional(),
|
|
1281
|
+
button: z19.enum(["left", "right", "middle"]).default("left"),
|
|
1282
|
+
double: z19.boolean().default(false)
|
|
1211
1283
|
});
|
|
1212
|
-
var InputMouseClickResult =
|
|
1284
|
+
var InputMouseClickResult = z19.strictObject({
|
|
1213
1285
|
position: InputPoint,
|
|
1214
|
-
button:
|
|
1215
|
-
double:
|
|
1286
|
+
button: z19.enum(["left", "right", "middle"]),
|
|
1287
|
+
double: z19.boolean()
|
|
1216
1288
|
});
|
|
1217
1289
|
|
|
1218
1290
|
// src/schema/power.ts
|
|
1219
|
-
import { z as
|
|
1220
|
-
var PowerStatusParams =
|
|
1221
|
-
var PowerStatusResult =
|
|
1222
|
-
has_battery:
|
|
1291
|
+
import { z as z20 } from "zod";
|
|
1292
|
+
var PowerStatusParams = z20.strictObject({});
|
|
1293
|
+
var PowerStatusResult = z20.strictObject({
|
|
1294
|
+
has_battery: z20.boolean(),
|
|
1223
1295
|
/** 0–100; null without a battery. */
|
|
1224
|
-
percent:
|
|
1225
|
-
charging:
|
|
1296
|
+
percent: z20.number().min(0).max(100).nullable(),
|
|
1297
|
+
charging: z20.boolean().nullable(),
|
|
1226
1298
|
/** On wall power; null where the OS does not say. */
|
|
1227
|
-
plugged_in:
|
|
1299
|
+
plugged_in: z20.boolean().nullable(),
|
|
1228
1300
|
/** Minutes of battery left; null when charging, unknown or without a battery. */
|
|
1229
1301
|
minutes_left: nonNegInt.nullable(),
|
|
1230
1302
|
/** Matrx 2 is keeping the computer awake (power.prevent_sleep) until this time; null when it is not. */
|
|
1231
1303
|
awake_until_ms: epochMs.nullable()
|
|
1232
1304
|
});
|
|
1233
|
-
var PowerPreventSleepParams =
|
|
1305
|
+
var PowerPreventSleepParams = z20.strictObject({
|
|
1234
1306
|
/** Keep the computer awake this long; 0 lets it sleep again now. */
|
|
1235
|
-
seconds:
|
|
1307
|
+
seconds: z20.int().min(0).max(86400),
|
|
1236
1308
|
/** Shown where the OS lists what keeps it awake. */
|
|
1237
|
-
reason:
|
|
1309
|
+
reason: z20.string().min(1).max(128).default("Matrx 2 is working")
|
|
1238
1310
|
});
|
|
1239
|
-
var PowerPreventSleepResult =
|
|
1311
|
+
var PowerPreventSleepResult = z20.strictObject({
|
|
1240
1312
|
/** When it may sleep again; null after seconds 0. */
|
|
1241
1313
|
awake_until_ms: epochMs.nullable()
|
|
1242
1314
|
});
|
|
1243
1315
|
|
|
1244
1316
|
// src/schema/audio.ts
|
|
1245
|
-
import { z as
|
|
1246
|
-
var AudioDevice =
|
|
1317
|
+
import { z as z21 } from "zod";
|
|
1318
|
+
var AudioDevice = z21.strictObject({
|
|
1247
1319
|
/** The OS's name for it, as audio.record takes it. */
|
|
1248
|
-
id:
|
|
1249
|
-
name:
|
|
1250
|
-
default:
|
|
1320
|
+
id: z21.string().min(1).max(256),
|
|
1321
|
+
name: z21.string().max(256),
|
|
1322
|
+
default: z21.boolean()
|
|
1251
1323
|
});
|
|
1252
|
-
var AudioDevicesParams =
|
|
1253
|
-
var AudioDevicesResult =
|
|
1254
|
-
inputs:
|
|
1255
|
-
outputs:
|
|
1324
|
+
var AudioDevicesParams = z21.strictObject({});
|
|
1325
|
+
var AudioDevicesResult = z21.strictObject({
|
|
1326
|
+
inputs: z21.array(AudioDevice).max(64),
|
|
1327
|
+
outputs: z21.array(AudioDevice).max(64)
|
|
1256
1328
|
});
|
|
1257
|
-
var AudioRecordParams =
|
|
1258
|
-
seconds:
|
|
1329
|
+
var AudioRecordParams = z21.strictObject({
|
|
1330
|
+
seconds: z21.number().min(0.5).max(600),
|
|
1259
1331
|
/** The microphone (from audio.devices); the default input when absent. */
|
|
1260
|
-
device_id:
|
|
1332
|
+
device_id: z21.string().min(1).max(256).optional(),
|
|
1261
1333
|
/** Where the WAV file goes; a new file in the temp folder when absent. */
|
|
1262
1334
|
path: AbsPath.optional()
|
|
1263
1335
|
});
|
|
1264
|
-
var AudioRecordResult =
|
|
1336
|
+
var AudioRecordResult = z21.strictObject({
|
|
1265
1337
|
path: AbsPath,
|
|
1266
|
-
seconds:
|
|
1338
|
+
seconds: z21.number().min(0),
|
|
1267
1339
|
bytes: nonNegInt,
|
|
1268
1340
|
/** Loudest sample, 0–1: 0 means the device gave silence. */
|
|
1269
|
-
peak:
|
|
1341
|
+
peak: z21.number().min(0).max(1)
|
|
1270
1342
|
});
|
|
1271
|
-
var AudioPlayParams =
|
|
1272
|
-
var AudioPlayResult =
|
|
1343
|
+
var AudioPlayParams = z21.strictObject({ path: AbsPath });
|
|
1344
|
+
var AudioPlayResult = z21.strictObject({ path: AbsPath, seconds: z21.number().min(0) });
|
|
1273
1345
|
|
|
1274
1346
|
// src/schema/resources.ts
|
|
1275
|
-
import { z as
|
|
1276
|
-
var ResourcesDisk =
|
|
1347
|
+
import { z as z22 } from "zod";
|
|
1348
|
+
var ResourcesDisk = z22.strictObject({
|
|
1277
1349
|
/** Where it is mounted ("/", "C:"). */
|
|
1278
|
-
mount:
|
|
1350
|
+
mount: z22.string().max(512),
|
|
1279
1351
|
/** The volume's name as the file manager shows it ("Macintosh HD", "Local Disk (C:)"). Since 1.17. */
|
|
1280
|
-
name:
|
|
1352
|
+
name: z22.string().max(256).optional(),
|
|
1281
1353
|
/** The file system ("apfs", "NTFS", "ext4"). */
|
|
1282
|
-
fs:
|
|
1354
|
+
fs: z22.string().max(64),
|
|
1283
1355
|
size_bytes: nonNegInt,
|
|
1284
1356
|
used_bytes: nonNegInt,
|
|
1285
1357
|
available_bytes: nonNegInt
|
|
1286
1358
|
});
|
|
1287
|
-
var ResourcesSnapshotParams =
|
|
1288
|
-
var ResourcesSnapshotResult =
|
|
1289
|
-
cpu:
|
|
1359
|
+
var ResourcesSnapshotParams = z22.strictObject({});
|
|
1360
|
+
var ResourcesSnapshotResult = z22.strictObject({
|
|
1361
|
+
cpu: z22.strictObject({
|
|
1290
1362
|
/** Busy share of all cores, 0–100, measured now. */
|
|
1291
|
-
percent:
|
|
1292
|
-
cores:
|
|
1363
|
+
percent: z22.number().min(0).max(100),
|
|
1364
|
+
cores: z22.int().min(1),
|
|
1293
1365
|
/** 1, 5 and 15 minute load averages; null on Windows. */
|
|
1294
|
-
load:
|
|
1366
|
+
load: z22.array(z22.number().min(0)).length(3).nullable()
|
|
1295
1367
|
}),
|
|
1296
|
-
memory:
|
|
1297
|
-
swap:
|
|
1298
|
-
disks:
|
|
1368
|
+
memory: z22.strictObject({ total_bytes: nonNegInt, used_bytes: nonNegInt, available_bytes: nonNegInt }),
|
|
1369
|
+
swap: z22.strictObject({ total_bytes: nonNegInt, used_bytes: nonNegInt }),
|
|
1370
|
+
disks: z22.array(ResourcesDisk).max(64),
|
|
1299
1371
|
uptime_seconds: nonNegInt
|
|
1300
1372
|
});
|
|
1301
|
-
var ResourcesJobKind =
|
|
1302
|
-
var ResourcesStrain =
|
|
1303
|
-
var ResourcesPressure =
|
|
1304
|
-
var ResourcesJob =
|
|
1373
|
+
var ResourcesJobKind = z22.enum(["type-check", "tests", "build", "lint", "dev server", "language server", "search"]);
|
|
1374
|
+
var ResourcesStrain = z22.enum(["good", "strain", "overloaded"]);
|
|
1375
|
+
var ResourcesPressure = z22.enum(["normal", "warning", "critical"]);
|
|
1376
|
+
var ResourcesJob = z22.strictObject({
|
|
1305
1377
|
/** The job's root process (Stop takes its whole tree). */
|
|
1306
|
-
pid:
|
|
1378
|
+
pid: z22.int().min(0),
|
|
1307
1379
|
kind: ResourcesJobKind,
|
|
1308
1380
|
/** Its heaviest process's command line, shortened ("…/lib/tsc --noEmit -p tsconfig.json"). */
|
|
1309
|
-
command:
|
|
1381
|
+
command: z22.string().max(256),
|
|
1310
1382
|
/** Who started it: "Claude Code", "Codex", "Cursor", "VS Code", "Terminal", "local stack", "detached"; null when unknown. */
|
|
1311
|
-
started_by:
|
|
1383
|
+
started_by: z22.string().max(64).nullable(),
|
|
1312
1384
|
/** Whatever started it is gone and nothing waits for it. */
|
|
1313
|
-
orphan:
|
|
1385
|
+
orphan: z22.boolean(),
|
|
1314
1386
|
/** A type-check queued for its turn (no compiler running yet). */
|
|
1315
|
-
waiting:
|
|
1387
|
+
waiting: z22.boolean(),
|
|
1316
1388
|
/** The project folder it runs in ("matrx-frontend"); null when not in one. */
|
|
1317
|
-
folder:
|
|
1389
|
+
folder: z22.string().max(256).nullable(),
|
|
1318
1390
|
/** The same command in the same folder, running this many times (1 = no duplicate). */
|
|
1319
|
-
duplicates:
|
|
1320
|
-
processes:
|
|
1391
|
+
duplicates: z22.int().min(1),
|
|
1392
|
+
processes: z22.int().min(1),
|
|
1321
1393
|
/** Sum over the tree, as `ps` reports it: 100 = one full core. */
|
|
1322
|
-
cpu_percent:
|
|
1394
|
+
cpu_percent: z22.number().min(0),
|
|
1323
1395
|
/** Real memory (macOS: the physical footprint Activity Monitor shows, compressed included). */
|
|
1324
1396
|
memory_bytes: nonNegInt,
|
|
1325
1397
|
started_at_ms: epochMs.nullable(),
|
|
1326
1398
|
/** False for an app, an agent session, a terminal, a system process, the local stack or Matrx 2 itself. */
|
|
1327
|
-
stoppable:
|
|
1399
|
+
stoppable: z22.boolean()
|
|
1328
1400
|
});
|
|
1329
|
-
var ResourcesProcess =
|
|
1330
|
-
pid:
|
|
1401
|
+
var ResourcesProcess = z22.strictObject({
|
|
1402
|
+
pid: z22.int().min(0),
|
|
1331
1403
|
/** The command line, shortened. */
|
|
1332
|
-
name:
|
|
1333
|
-
cpu_percent:
|
|
1404
|
+
name: z22.string().max(256),
|
|
1405
|
+
cpu_percent: z22.number().min(0),
|
|
1334
1406
|
memory_bytes: nonNegInt,
|
|
1335
|
-
started_by:
|
|
1407
|
+
started_by: z22.string().max(64).nullable(),
|
|
1336
1408
|
/** The job it belongs to ("type-check in aidream"); null when none. */
|
|
1337
|
-
job:
|
|
1409
|
+
job: z22.string().max(256).nullable(),
|
|
1338
1410
|
started_at_ms: epochMs.nullable()
|
|
1339
1411
|
});
|
|
1340
|
-
var ResourcesVerdict =
|
|
1412
|
+
var ResourcesVerdict = z22.strictObject({
|
|
1341
1413
|
level: ResourcesStrain,
|
|
1342
1414
|
/** One sentence ("Your Mac is under strain. 3 type-checks are running at once."). */
|
|
1343
|
-
text:
|
|
1415
|
+
text: z22.string().max(256),
|
|
1344
1416
|
/** The biggest jobs behind it; null when all is well. */
|
|
1345
|
-
cause:
|
|
1417
|
+
cause: z22.string().max(1024).nullable()
|
|
1346
1418
|
});
|
|
1347
|
-
var ResourcesSample =
|
|
1419
|
+
var ResourcesSample = z22.strictObject({
|
|
1348
1420
|
at_ms: epochMs,
|
|
1349
1421
|
/** The 1-minute load average. */
|
|
1350
|
-
load:
|
|
1422
|
+
load: z22.number().min(0),
|
|
1351
1423
|
memory_used_bytes: nonNegInt,
|
|
1352
1424
|
typechecks: nonNegInt
|
|
1353
1425
|
});
|
|
1354
|
-
var ResourcesActivityParams =
|
|
1355
|
-
var ResourcesActivityResult =
|
|
1426
|
+
var ResourcesActivityParams = z22.strictObject({});
|
|
1427
|
+
var ResourcesActivityResult = z22.strictObject({
|
|
1356
1428
|
/** False until the first reading (a second or two after start). */
|
|
1357
|
-
ready:
|
|
1429
|
+
ready: z22.boolean(),
|
|
1358
1430
|
sampled_at_ms: epochMs.nullable(),
|
|
1359
|
-
cores:
|
|
1431
|
+
cores: z22.int().min(1),
|
|
1360
1432
|
/** 1, 5 and 15 minute load averages. */
|
|
1361
|
-
load:
|
|
1362
|
-
memory:
|
|
1433
|
+
load: z22.array(z22.number().min(0)).length(3),
|
|
1434
|
+
memory: z22.strictObject({
|
|
1363
1435
|
total_bytes: nonNegInt,
|
|
1364
1436
|
/** Activity Monitor's Memory Used: app memory + wired + compressed. */
|
|
1365
1437
|
used_bytes: nonNegInt,
|
|
@@ -1370,49 +1442,49 @@ var ResourcesActivityResult = z21.strictObject({
|
|
|
1370
1442
|
pressure: ResourcesPressure.nullable()
|
|
1371
1443
|
}),
|
|
1372
1444
|
verdict: ResourcesVerdict,
|
|
1373
|
-
typechecks:
|
|
1445
|
+
typechecks: z22.strictObject({ running: nonNegInt, waiting: nonNegInt, comfort: nonNegInt }),
|
|
1374
1446
|
/** Heaviest first (1 GB weighs as much as 16 % of a core). */
|
|
1375
|
-
jobs:
|
|
1447
|
+
jobs: z22.array(ResourcesJob).max(200),
|
|
1376
1448
|
/** The 15 heaviest by memory and the 15 busiest by CPU, together. */
|
|
1377
|
-
top:
|
|
1449
|
+
top: z22.array(ResourcesProcess).max(30),
|
|
1378
1450
|
/** The last hour, oldest first. */
|
|
1379
|
-
history:
|
|
1451
|
+
history: z22.array(ResourcesSample).max(1200)
|
|
1380
1452
|
});
|
|
1381
|
-
var ResourcesStopJobParams =
|
|
1382
|
-
var ResourcesStopJobResult =
|
|
1453
|
+
var ResourcesStopJobParams = z22.strictObject({ pid: z22.int().min(1) });
|
|
1454
|
+
var ResourcesStopJobResult = z22.strictObject({
|
|
1383
1455
|
/** Processes signalled; whatever is still running 5 seconds later is force-stopped. */
|
|
1384
1456
|
processes: nonNegInt,
|
|
1385
1457
|
/** It had finished before the request arrived. */
|
|
1386
|
-
already_finished:
|
|
1458
|
+
already_finished: z22.boolean()
|
|
1387
1459
|
});
|
|
1388
|
-
var ResourcesIncident =
|
|
1460
|
+
var ResourcesIncident = z22.strictObject({
|
|
1389
1461
|
at_ms: epochMs,
|
|
1390
1462
|
verdict: ResourcesVerdict,
|
|
1391
|
-
load:
|
|
1463
|
+
load: z22.number().min(0),
|
|
1392
1464
|
memory_used_bytes: nonNegInt,
|
|
1393
1465
|
compressed_bytes: nonNegInt,
|
|
1394
1466
|
pressure: ResourcesPressure.nullable(),
|
|
1395
|
-
jobs:
|
|
1396
|
-
|
|
1467
|
+
jobs: z22.array(
|
|
1468
|
+
z22.strictObject({
|
|
1397
1469
|
kind: ResourcesJobKind,
|
|
1398
|
-
started_by:
|
|
1399
|
-
folder:
|
|
1400
|
-
command:
|
|
1401
|
-
cpu_percent:
|
|
1470
|
+
started_by: z22.string().max(64).nullable(),
|
|
1471
|
+
folder: z22.string().max(256).nullable(),
|
|
1472
|
+
command: z22.string().max(256),
|
|
1473
|
+
cpu_percent: z22.number().min(0),
|
|
1402
1474
|
memory_bytes: nonNegInt,
|
|
1403
|
-
duplicates:
|
|
1475
|
+
duplicates: z22.int().min(1)
|
|
1404
1476
|
})
|
|
1405
1477
|
).max(8)
|
|
1406
1478
|
});
|
|
1407
|
-
var ResourcesIncidentsParams =
|
|
1408
|
-
var ResourcesIncidentsResult =
|
|
1479
|
+
var ResourcesIncidentsParams = z22.strictObject({ limit: z22.int().min(1).max(200).default(50) });
|
|
1480
|
+
var ResourcesIncidentsResult = z22.strictObject({
|
|
1409
1481
|
/** Newest first; at most one a minute is written. */
|
|
1410
|
-
incidents:
|
|
1482
|
+
incidents: z22.array(ResourcesIncident).max(200)
|
|
1411
1483
|
});
|
|
1412
1484
|
|
|
1413
1485
|
// src/schema/diag.ts
|
|
1414
|
-
import { z as
|
|
1415
|
-
var DiagProcess =
|
|
1486
|
+
import { z as z23 } from "zod";
|
|
1487
|
+
var DiagProcess = z23.enum([
|
|
1416
1488
|
"main",
|
|
1417
1489
|
"renderer",
|
|
1418
1490
|
"hosted_page",
|
|
@@ -1425,7 +1497,7 @@ var DiagProcess = z22.enum([
|
|
|
1425
1497
|
"coding_sessions",
|
|
1426
1498
|
"claude_accounts"
|
|
1427
1499
|
]);
|
|
1428
|
-
var DiagErrorKind =
|
|
1500
|
+
var DiagErrorKind = z23.enum([
|
|
1429
1501
|
"uncaught_exception",
|
|
1430
1502
|
"unhandled_rejection",
|
|
1431
1503
|
"renderer_crash",
|
|
@@ -1437,235 +1509,235 @@ var DiagErrorKind = z22.enum([
|
|
|
1437
1509
|
"banner",
|
|
1438
1510
|
"logged_error"
|
|
1439
1511
|
]);
|
|
1440
|
-
var DiagErrorStatus =
|
|
1441
|
-
var DiagErrorEntry =
|
|
1512
|
+
var DiagErrorStatus = z23.enum(["waiting", "sent", "resolved"]);
|
|
1513
|
+
var DiagErrorEntry = z23.strictObject({
|
|
1442
1514
|
/** sha256 prefix over process, kind, source, code and the normalized message. */
|
|
1443
|
-
signature:
|
|
1515
|
+
signature: z23.string().regex(/^[0-9a-f]{32}$/),
|
|
1444
1516
|
process: DiagProcess,
|
|
1445
1517
|
kind: DiagErrorKind,
|
|
1446
1518
|
/** Where: a cap.op, a log event, a screen or page name. */
|
|
1447
|
-
source:
|
|
1519
|
+
source: z23.string().min(1).max(128),
|
|
1448
1520
|
/** An ErrorCode, an exit code or signal, an error class; null when there is none. */
|
|
1449
|
-
code:
|
|
1521
|
+
code: z23.string().max(64).nullable(),
|
|
1450
1522
|
/** The first occurrence's message, personal data removed. */
|
|
1451
|
-
message:
|
|
1523
|
+
message: z23.string().max(500),
|
|
1452
1524
|
count: nonNegInt,
|
|
1453
1525
|
first_seen_ms: epochMs,
|
|
1454
1526
|
last_seen_ms: epochMs,
|
|
1455
1527
|
status: DiagErrorStatus,
|
|
1456
1528
|
/** What the agent who resolved it wrote; null until resolved. */
|
|
1457
|
-
resolution_note:
|
|
1458
|
-
app_version:
|
|
1529
|
+
resolution_note: z23.string().max(500).nullable(),
|
|
1530
|
+
app_version: z23.string().max(64)
|
|
1459
1531
|
});
|
|
1460
|
-
var DiagErrorsListParams =
|
|
1532
|
+
var DiagErrorsListParams = z23.strictObject({
|
|
1461
1533
|
/** open = waiting or sent; all includes resolved. */
|
|
1462
|
-
status:
|
|
1463
|
-
limit:
|
|
1534
|
+
status: z23.enum(["open", "all"]).default("open"),
|
|
1535
|
+
limit: z23.int().min(1).max(500).default(200)
|
|
1464
1536
|
});
|
|
1465
|
-
var DiagErrorsListResult =
|
|
1537
|
+
var DiagErrorsListResult = z23.strictObject({
|
|
1466
1538
|
/** Newest last_seen first. */
|
|
1467
|
-
entries:
|
|
1539
|
+
entries: z23.array(DiagErrorEntry).max(500),
|
|
1468
1540
|
total_signatures: nonNegInt,
|
|
1469
1541
|
total_occurrences: nonNegInt,
|
|
1470
1542
|
/** Signatures with occurrences not yet delivered. */
|
|
1471
1543
|
waiting: nonNegInt,
|
|
1472
1544
|
/** signed_out = kept until sign-in; ok = the last delivery worked; failing = the last delivery failed (kept, retried). */
|
|
1473
|
-
delivery:
|
|
1545
|
+
delivery: z23.enum(["signed_out", "ok", "failing"]),
|
|
1474
1546
|
last_delivery_ms: epochMs.nullable()
|
|
1475
1547
|
});
|
|
1476
|
-
var DiagErrorsReportParams =
|
|
1477
|
-
process:
|
|
1478
|
-
kind:
|
|
1548
|
+
var DiagErrorsReportParams = z23.strictObject({
|
|
1549
|
+
process: z23.enum(["renderer", "hosted_page"]),
|
|
1550
|
+
kind: z23.enum(["uncaught_exception", "unhandled_rejection", "console_error", "banner"]),
|
|
1479
1551
|
/** The screen or page, e.g. "code.chats". */
|
|
1480
|
-
source:
|
|
1481
|
-
message:
|
|
1482
|
-
code:
|
|
1483
|
-
stack:
|
|
1552
|
+
source: z23.string().min(1).max(128),
|
|
1553
|
+
message: z23.string().min(1).max(2e3),
|
|
1554
|
+
code: z23.string().max(64).optional(),
|
|
1555
|
+
stack: z23.string().max(8e3).optional()
|
|
1484
1556
|
});
|
|
1485
|
-
var DiagErrorsReportResult =
|
|
1486
|
-
signature:
|
|
1557
|
+
var DiagErrorsReportResult = z23.strictObject({
|
|
1558
|
+
signature: z23.string().regex(/^[0-9a-f]{32}$/)
|
|
1487
1559
|
});
|
|
1488
|
-
var DiagErrorsChangedEvent =
|
|
1560
|
+
var DiagErrorsChangedEvent = z23.strictObject({
|
|
1489
1561
|
total_signatures: nonNegInt,
|
|
1490
1562
|
waiting: nonNegInt
|
|
1491
1563
|
});
|
|
1492
1564
|
|
|
1493
1565
|
// src/schema/stack.ts
|
|
1494
|
-
import { z as
|
|
1495
|
-
var StackServerName =
|
|
1496
|
-
var StackTone =
|
|
1497
|
-
var StackServer =
|
|
1566
|
+
import { z as z24 } from "zod";
|
|
1567
|
+
var StackServerName = z24.string().regex(/^[a-z0-9_-]{1,64}$/);
|
|
1568
|
+
var StackTone = z24.enum(["good", "wait", "bad", "off"]);
|
|
1569
|
+
var StackServer = z24.strictObject({
|
|
1498
1570
|
name: StackServerName,
|
|
1499
1571
|
/** One word: Healthy, Starting, Unhealthy, Restarting, Stopping, Waiting, Stopped, Crashed, Off. */
|
|
1500
|
-
label:
|
|
1572
|
+
label: z24.string().max(32),
|
|
1501
1573
|
tone: StackTone,
|
|
1502
1574
|
/** What is going on, in one or two plain sentences. */
|
|
1503
|
-
sentence:
|
|
1575
|
+
sentence: z24.string().max(2e3),
|
|
1504
1576
|
/** The config's own description of the server. */
|
|
1505
|
-
description:
|
|
1577
|
+
description: z24.string().max(512),
|
|
1506
1578
|
/** Where the server answers, when its description names an address. */
|
|
1507
|
-
open_url:
|
|
1508
|
-
log_file:
|
|
1579
|
+
open_url: z24.string().max(2048).nullable(),
|
|
1580
|
+
log_file: z24.string().max(4096),
|
|
1509
1581
|
/** When its log file was last written. */
|
|
1510
1582
|
last_output_at_ms: epochMs.nullable(),
|
|
1511
1583
|
started_at_ms: epochMs.nullable(),
|
|
1512
1584
|
restarts: nonNegInt,
|
|
1513
|
-
exit_code:
|
|
1514
|
-
pid:
|
|
1585
|
+
exit_code: z24.int().nullable(),
|
|
1586
|
+
pid: z24.int().nullable(),
|
|
1515
1587
|
/** (1.18) CPU of the server's process and everything under it, in percent of one core; absent when it is not running. */
|
|
1516
|
-
cpu_percent:
|
|
1588
|
+
cpu_percent: z24.number().min(0).optional(),
|
|
1517
1589
|
/** (1.18) Memory of the same processes: the physical footprint (Activity Monitor's Memory) summed; absent when it is not running. */
|
|
1518
1590
|
memory_bytes: nonNegInt.optional()
|
|
1519
1591
|
});
|
|
1520
|
-
var StackEvent =
|
|
1592
|
+
var StackEvent = z24.strictObject({
|
|
1521
1593
|
at_ms: epochMs,
|
|
1522
1594
|
/** A server name, or "stack" for the stack as a whole. */
|
|
1523
|
-
server:
|
|
1595
|
+
server: z24.string().max(64),
|
|
1524
1596
|
/** started · stopped · healthy · unhealthy · crashed · exited · restarting · stopping · action · action-done · action-failed · setup · error */
|
|
1525
|
-
kind:
|
|
1526
|
-
text:
|
|
1597
|
+
kind: z24.string().max(32),
|
|
1598
|
+
text: z24.string().max(4e3)
|
|
1527
1599
|
});
|
|
1528
|
-
var StackStateParams =
|
|
1529
|
-
var StackStateResult =
|
|
1600
|
+
var StackStateParams = z24.strictObject({});
|
|
1601
|
+
var StackStateResult = z24.strictObject({
|
|
1530
1602
|
/** The stack's config file, when found. */
|
|
1531
|
-
config_path:
|
|
1603
|
+
config_path: z24.string().max(4096).nullable(),
|
|
1532
1604
|
/** Why the stack cannot be run from here (no config, no process-compose), else null. */
|
|
1533
|
-
problem:
|
|
1534
|
-
stack_up:
|
|
1605
|
+
problem: z24.string().max(1e3).nullable(),
|
|
1606
|
+
stack_up: z24.boolean(),
|
|
1535
1607
|
stack_started_at_ms: epochMs.nullable(),
|
|
1536
|
-
servers:
|
|
1608
|
+
servers: z24.array(StackServer).max(64),
|
|
1537
1609
|
/** One line about the one-shot setup steps ("Docker Desktop: running."), or null. */
|
|
1538
|
-
setup_note:
|
|
1610
|
+
setup_note: z24.string().max(500).nullable(),
|
|
1539
1611
|
/** Start everything / Stop everything in flight. */
|
|
1540
|
-
pending:
|
|
1612
|
+
pending: z24.strictObject({ verb: z24.enum(["start", "stop"]), label: z24.string().max(64), since_ms: epochMs }).nullable(),
|
|
1541
1613
|
/** The newest entries last. */
|
|
1542
|
-
events:
|
|
1614
|
+
events: z24.array(StackEvent).max(300)
|
|
1543
1615
|
});
|
|
1544
|
-
var StackStartParams =
|
|
1545
|
-
var StackStopParams =
|
|
1546
|
-
var StackRunResult =
|
|
1547
|
-
var StackServerActionParams =
|
|
1616
|
+
var StackStartParams = z24.strictObject({});
|
|
1617
|
+
var StackStopParams = z24.strictObject({});
|
|
1618
|
+
var StackRunResult = z24.strictObject({ accepted: z24.boolean() });
|
|
1619
|
+
var StackServerActionParams = z24.strictObject({
|
|
1548
1620
|
name: StackServerName,
|
|
1549
|
-
verb:
|
|
1621
|
+
verb: z24.enum(["start", "stop", "restart"])
|
|
1550
1622
|
});
|
|
1551
|
-
var StackServerActionResult =
|
|
1552
|
-
var StackLogsParams =
|
|
1623
|
+
var StackServerActionResult = z24.strictObject({ message: z24.string().max(1e3) });
|
|
1624
|
+
var StackLogsParams = z24.strictObject({
|
|
1553
1625
|
name: StackServerName,
|
|
1554
1626
|
/** Without `offset`: the last this-many complete lines. With it: new lines after it, at most this many. */
|
|
1555
|
-
lines:
|
|
1627
|
+
lines: z24.int().min(1).max(2e5).default(2e3),
|
|
1556
1628
|
/** Byte offset the last read ended at: answer only what was written after it (follow). */
|
|
1557
1629
|
offset: nonNegInt.optional(),
|
|
1558
1630
|
/** A "Clear" point: the lines written after this byte offset (no `offset`). */
|
|
1559
1631
|
since: nonNegInt.optional(),
|
|
1560
1632
|
/** With `offset`: wait up to this long for a new line when none is waiting (0 answers at once). */
|
|
1561
|
-
wait_ms:
|
|
1633
|
+
wait_ms: z24.int().min(0).max(25e3).default(0)
|
|
1562
1634
|
});
|
|
1563
|
-
var StackLogsResult =
|
|
1635
|
+
var StackLogsResult = z24.strictObject({
|
|
1564
1636
|
/** Complete lines, colour codes removed. */
|
|
1565
|
-
lines:
|
|
1637
|
+
lines: z24.array(z24.string().max(65536)).max(2e5),
|
|
1566
1638
|
/** Where these lines end: pass it back as `offset` to follow. */
|
|
1567
1639
|
offset: nonNegInt,
|
|
1568
1640
|
/** False when `since` no longer exists (the log rotated): the lines are the plain tail instead. */
|
|
1569
|
-
since_valid:
|
|
1641
|
+
since_valid: z24.boolean(),
|
|
1570
1642
|
/** The log was rotated or truncated since `offset`: these lines start the file again. */
|
|
1571
|
-
reset:
|
|
1572
|
-
log_file:
|
|
1643
|
+
reset: z24.boolean(),
|
|
1644
|
+
log_file: z24.string().max(4096)
|
|
1573
1645
|
});
|
|
1574
|
-
var StackErrorsParams =
|
|
1575
|
-
window_minutes:
|
|
1646
|
+
var StackErrorsParams = z24.strictObject({
|
|
1647
|
+
window_minutes: z24.int().min(1).max(1440).default(60)
|
|
1576
1648
|
});
|
|
1577
|
-
var StackErrorsResult =
|
|
1649
|
+
var StackErrorsResult = z24.strictObject({
|
|
1578
1650
|
/** Per server: a heading line ("=== aidream — errors in the last 60 minutes (<file>) ===") and each error with the 10 lines after it. */
|
|
1579
|
-
sections:
|
|
1580
|
-
window_minutes:
|
|
1651
|
+
sections: z24.array(z24.strictObject({ name: StackServerName, heading: z24.string().max(4096), lines: z24.array(z24.string().max(65536)).max(5e3) })).max(64),
|
|
1652
|
+
window_minutes: z24.int().min(1).max(1440)
|
|
1581
1653
|
});
|
|
1582
1654
|
|
|
1583
1655
|
// src/schema/fs-watch.ts
|
|
1584
|
-
import { z as
|
|
1585
|
-
var FsWatchId =
|
|
1586
|
-
var FsWatchStartParams =
|
|
1656
|
+
import { z as z25 } from "zod";
|
|
1657
|
+
var FsWatchId = z25.string().regex(/^fw_[A-Za-z0-9]{12,40}$/);
|
|
1658
|
+
var FsWatchStartParams = z25.strictObject({
|
|
1587
1659
|
path: AbsPath,
|
|
1588
|
-
recursive:
|
|
1660
|
+
recursive: z25.boolean().default(true),
|
|
1589
1661
|
/** Globs relative to `path` whose changes are not reported (".git/**", "node_modules/**"). */
|
|
1590
|
-
ignore:
|
|
1662
|
+
ignore: z25.array(z25.string().max(256)).max(64).default([])
|
|
1591
1663
|
});
|
|
1592
|
-
var FsWatchStartResult =
|
|
1664
|
+
var FsWatchStartResult = z25.strictObject({
|
|
1593
1665
|
watch_id: FsWatchId,
|
|
1594
1666
|
path: AbsPath,
|
|
1595
1667
|
/** The watch ends by itself if nobody reads it for 30 minutes. */
|
|
1596
1668
|
expires_at_ms: epochMs
|
|
1597
1669
|
});
|
|
1598
|
-
var FsWatchEventsParams =
|
|
1670
|
+
var FsWatchEventsParams = z25.strictObject({
|
|
1599
1671
|
watch_id: FsWatchId,
|
|
1600
1672
|
/** Wait up to this long for a first change when none is waiting (0 answers at once). */
|
|
1601
|
-
wait_ms:
|
|
1673
|
+
wait_ms: z25.int().min(0).max(25e3).default(0)
|
|
1602
1674
|
});
|
|
1603
|
-
var FsWatchEventsResult =
|
|
1675
|
+
var FsWatchEventsResult = z25.strictObject({
|
|
1604
1676
|
/** What changed since the last read, oldest first; re-checked against the disk when read. */
|
|
1605
|
-
changes:
|
|
1677
|
+
changes: z25.array(FsChange).max(1e3),
|
|
1606
1678
|
/** Changes were dropped (more than 1000 waited): list the folder again. */
|
|
1607
|
-
overflow:
|
|
1679
|
+
overflow: z25.boolean(),
|
|
1608
1680
|
expires_at_ms: epochMs
|
|
1609
1681
|
});
|
|
1610
|
-
var FsWatchStopParams =
|
|
1611
|
-
var FsWatchStopResult =
|
|
1682
|
+
var FsWatchStopParams = z25.strictObject({ watch_id: FsWatchId });
|
|
1683
|
+
var FsWatchStopResult = z25.strictObject({ watch_id: FsWatchId });
|
|
1612
1684
|
|
|
1613
1685
|
// src/schema/exec-job.ts
|
|
1614
|
-
import { z as
|
|
1615
|
-
var ExecJobId =
|
|
1616
|
-
var ExecJobStartParams =
|
|
1617
|
-
command:
|
|
1686
|
+
import { z as z26 } from "zod";
|
|
1687
|
+
var ExecJobId = z26.string().regex(/^job_[A-Za-z0-9]{12,40}$/);
|
|
1688
|
+
var ExecJobStartParams = z26.strictObject({
|
|
1689
|
+
command: z26.string().min(1).max(131072),
|
|
1618
1690
|
/** The folder it runs in; the home folder when absent. */
|
|
1619
1691
|
cwd: AbsPath.optional(),
|
|
1620
|
-
env:
|
|
1692
|
+
env: z26.record(z26.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/).max(128), z26.string().max(32768)).optional()
|
|
1621
1693
|
});
|
|
1622
|
-
var ExecJobStartResult =
|
|
1623
|
-
var ExecJobOutputParams =
|
|
1694
|
+
var ExecJobStartResult = z26.strictObject({ job_id: ExecJobId, pid: z26.int().min(1), cwd: AbsPath });
|
|
1695
|
+
var ExecJobOutputParams = z26.strictObject({
|
|
1624
1696
|
job_id: ExecJobId,
|
|
1625
1697
|
/** Byte offset into the job's output to read from (next_offset of the last read; 0 = the start). */
|
|
1626
1698
|
offset: nonNegInt.default(0),
|
|
1627
1699
|
/** Wait up to this long for new output or the exit when none is waiting (0 answers at once). */
|
|
1628
|
-
wait_ms:
|
|
1629
|
-
max_bytes:
|
|
1700
|
+
wait_ms: z26.int().min(0).max(25e3).default(0),
|
|
1701
|
+
max_bytes: z26.int().min(1024).max(1048576).default(65536)
|
|
1630
1702
|
});
|
|
1631
|
-
var ExecJobOutputResult =
|
|
1703
|
+
var ExecJobOutputResult = z26.strictObject({
|
|
1632
1704
|
/** stdout and stderr interleaved as they arrived (UTF-8). */
|
|
1633
|
-
output:
|
|
1705
|
+
output: z26.string(),
|
|
1634
1706
|
next_offset: nonNegInt,
|
|
1635
1707
|
/** Bytes before `offset` that are gone (the job keeps its last 4 MiB). */
|
|
1636
1708
|
dropped_bytes: nonNegInt,
|
|
1637
|
-
running:
|
|
1638
|
-
exit_code:
|
|
1709
|
+
running: z26.boolean(),
|
|
1710
|
+
exit_code: z26.int().nullable()
|
|
1639
1711
|
});
|
|
1640
|
-
var ExecJobStopParams =
|
|
1712
|
+
var ExecJobStopParams = z26.strictObject({
|
|
1641
1713
|
job_id: ExecJobId,
|
|
1642
1714
|
/** End it at once (SIGKILL; on Windows the whole tree with /F) instead of asking it to quit. */
|
|
1643
|
-
force:
|
|
1715
|
+
force: z26.boolean().default(false)
|
|
1644
1716
|
});
|
|
1645
|
-
var ExecJobStopResult =
|
|
1646
|
-
var ExecJobInfo =
|
|
1717
|
+
var ExecJobStopResult = z26.strictObject({ job_id: ExecJobId, exited: z26.boolean(), exit_code: z26.int().nullable() });
|
|
1718
|
+
var ExecJobInfo = z26.strictObject({
|
|
1647
1719
|
job_id: ExecJobId,
|
|
1648
|
-
command:
|
|
1649
|
-
pid:
|
|
1720
|
+
command: z26.string().max(1024),
|
|
1721
|
+
pid: z26.int().min(1),
|
|
1650
1722
|
cwd: AbsPath,
|
|
1651
|
-
running:
|
|
1652
|
-
exit_code:
|
|
1723
|
+
running: z26.boolean(),
|
|
1724
|
+
exit_code: z26.int().nullable(),
|
|
1653
1725
|
started_at_ms: epochMs,
|
|
1654
1726
|
output_bytes: nonNegInt
|
|
1655
1727
|
});
|
|
1656
|
-
var ExecJobListParams =
|
|
1657
|
-
var ExecJobListResult =
|
|
1728
|
+
var ExecJobListParams = z26.strictObject({});
|
|
1729
|
+
var ExecJobListResult = z26.strictObject({ jobs: z26.array(ExecJobInfo).max(64) });
|
|
1658
1730
|
|
|
1659
1731
|
// src/schema/coding.ts
|
|
1660
|
-
import { z as
|
|
1661
|
-
import { UUID_SHAPE_PATTERN as
|
|
1662
|
-
var CodingServiceCredentials =
|
|
1663
|
-
access_token:
|
|
1664
|
-
user_id:
|
|
1732
|
+
import { z as z27 } from "zod";
|
|
1733
|
+
import { UUID_SHAPE_PATTERN as UUID_SHAPE_PATTERN3 } from "@ai-matrx/kit/uuid";
|
|
1734
|
+
var CodingServiceCredentials = z27.strictObject({
|
|
1735
|
+
access_token: z27.string().min(16).max(16384),
|
|
1736
|
+
user_id: z27.string().regex(UUID_SHAPE_PATTERN3),
|
|
1665
1737
|
/** The AI Matrx server this app talks to (production, or a local server on the nightly copy). */
|
|
1666
|
-
server_url:
|
|
1738
|
+
server_url: z27.string().min(1).max(2048).regex(/^https?:\/\/[^\s/?#]+(\/[^\s?#]*)?$/)
|
|
1667
1739
|
});
|
|
1668
|
-
var CodingHistoryBlocked =
|
|
1740
|
+
var CodingHistoryBlocked = z27.enum([
|
|
1669
1741
|
"signed_out",
|
|
1670
1742
|
"offline",
|
|
1671
1743
|
"organization_required",
|
|
@@ -1673,11 +1745,11 @@ var CodingHistoryBlocked = z26.enum([
|
|
|
1673
1745
|
"cloud_list_unavailable",
|
|
1674
1746
|
"history_too_large"
|
|
1675
1747
|
]);
|
|
1676
|
-
var CodingHistoryFailure =
|
|
1677
|
-
session_id:
|
|
1678
|
-
reason:
|
|
1748
|
+
var CodingHistoryFailure = z27.strictObject({
|
|
1749
|
+
session_id: z27.string().max(64),
|
|
1750
|
+
reason: z27.string().max(300)
|
|
1679
1751
|
});
|
|
1680
|
-
var CodingHistoryRun =
|
|
1752
|
+
var CodingHistoryRun = z27.strictObject({
|
|
1681
1753
|
/** Claude Code sessions found on this computer. */
|
|
1682
1754
|
local_sessions: nonNegInt,
|
|
1683
1755
|
/** Of those, already complete in AI Matrx. */
|
|
@@ -1692,39 +1764,39 @@ var CodingHistoryRun = z26.strictObject({
|
|
|
1692
1764
|
/** Changed while being read; a later run takes them. */
|
|
1693
1765
|
changed: nonNegInt,
|
|
1694
1766
|
failed: nonNegInt,
|
|
1695
|
-
failures:
|
|
1767
|
+
failures: z27.array(CodingHistoryFailure).max(20),
|
|
1696
1768
|
/** Candidates not reached yet. */
|
|
1697
1769
|
remaining: nonNegInt,
|
|
1698
1770
|
/** The one line a person reads, e.g. "Imported 12 of 14 sessions. 140 already in AI Matrx." */
|
|
1699
|
-
summary:
|
|
1771
|
+
summary: z27.string().max(400)
|
|
1700
1772
|
});
|
|
1701
|
-
var CodingHistoryStep =
|
|
1773
|
+
var CodingHistoryStep = z27.strictObject({
|
|
1702
1774
|
/** Null when the run could not start (blocked before a plan existed). */
|
|
1703
|
-
plan_id:
|
|
1704
|
-
finished:
|
|
1775
|
+
plan_id: z27.string().regex(/^[0-9a-f]{32}$/).nullable(),
|
|
1776
|
+
finished: z27.boolean(),
|
|
1705
1777
|
blocked: CodingHistoryBlocked.nullable(),
|
|
1706
1778
|
run: CodingHistoryRun
|
|
1707
1779
|
});
|
|
1708
|
-
var CodingPlanMissingParams =
|
|
1709
|
-
var CodingImportNextParams =
|
|
1710
|
-
plan_id:
|
|
1780
|
+
var CodingPlanMissingParams = z27.strictObject({ credentials: CodingServiceCredentials.nullable() });
|
|
1781
|
+
var CodingImportNextParams = z27.strictObject({
|
|
1782
|
+
plan_id: z27.string().regex(/^[0-9a-f]{32}$/),
|
|
1711
1783
|
credentials: CodingServiceCredentials.nullable()
|
|
1712
1784
|
});
|
|
1713
|
-
var CodingServiceProgress =
|
|
1714
|
-
phase:
|
|
1785
|
+
var CodingServiceProgress = z27.strictObject({
|
|
1786
|
+
phase: z27.enum(["checking", "importing"]),
|
|
1715
1787
|
done: nonNegInt,
|
|
1716
1788
|
total: nonNegInt
|
|
1717
1789
|
});
|
|
1718
|
-
var CodingHistoryImportMissingParams =
|
|
1719
|
-
var CodingHistoryImportMissingResult =
|
|
1720
|
-
state:
|
|
1790
|
+
var CodingHistoryImportMissingParams = z27.strictObject({});
|
|
1791
|
+
var CodingHistoryImportMissingResult = z27.strictObject({
|
|
1792
|
+
state: z27.enum(["done", "blocked", "cancelled"]),
|
|
1721
1793
|
blocked: CodingHistoryBlocked.nullable(),
|
|
1722
1794
|
run: CodingHistoryRun,
|
|
1723
1795
|
elapsed_ms: nonNegInt
|
|
1724
1796
|
});
|
|
1725
|
-
var CodingHistoryProgressEvent =
|
|
1797
|
+
var CodingHistoryProgressEvent = z27.strictObject({
|
|
1726
1798
|
request_id: RequestId,
|
|
1727
|
-
phase:
|
|
1799
|
+
phase: z27.enum(["checking", "importing"]),
|
|
1728
1800
|
/** Sessions settled so far, of `total` candidates (0 of 0 while checking). */
|
|
1729
1801
|
done: nonNegInt,
|
|
1730
1802
|
total: nonNegInt,
|
|
@@ -1733,23 +1805,23 @@ var CodingHistoryProgressEvent = z26.strictObject({
|
|
|
1733
1805
|
});
|
|
1734
1806
|
|
|
1735
1807
|
// src/schema/apps.ts
|
|
1736
|
-
import { z as
|
|
1737
|
-
import { UUID_SHAPE_PATTERN as
|
|
1738
|
-
var AppKey =
|
|
1739
|
-
var AppProfileId =
|
|
1740
|
-
var AppProfileLocator =
|
|
1741
|
-
var AppSupport =
|
|
1742
|
-
var AppFeatureStatus =
|
|
1808
|
+
import { z as z28 } from "zod";
|
|
1809
|
+
import { UUID_SHAPE_PATTERN as UUID_SHAPE_PATTERN4 } from "@ai-matrx/kit/uuid";
|
|
1810
|
+
var AppKey = z28.string().regex(/^[a-z][a-z0-9_-]{0,39}$/);
|
|
1811
|
+
var AppProfileId = z28.string().regex(UUID_SHAPE_PATTERN4);
|
|
1812
|
+
var AppProfileLocator = z28.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}$/);
|
|
1813
|
+
var AppSupport = z28.enum(["supported", "partial", "unsupported"]);
|
|
1814
|
+
var AppFeatureStatus = z28.strictObject({
|
|
1743
1815
|
status: AppSupport,
|
|
1744
1816
|
/** One line, set whenever status is not "supported". */
|
|
1745
|
-
reason:
|
|
1817
|
+
reason: z28.string().max(140).nullable()
|
|
1746
1818
|
});
|
|
1747
|
-
var AppInfo =
|
|
1819
|
+
var AppInfo = z28.strictObject({
|
|
1748
1820
|
app_key: AppKey,
|
|
1749
|
-
name:
|
|
1750
|
-
installed:
|
|
1821
|
+
name: z28.string().max(64),
|
|
1822
|
+
installed: z28.boolean(),
|
|
1751
1823
|
/** The app's own version string, or null when it is not installed or does not say. */
|
|
1752
|
-
version:
|
|
1824
|
+
version: z28.string().max(64).nullable(),
|
|
1753
1825
|
/** The install found (an .app bundle, an .exe, a binary), or null. */
|
|
1754
1826
|
location: AbsPath.nullable(),
|
|
1755
1827
|
/** Open the app at all on this OS. */
|
|
@@ -1759,148 +1831,148 @@ var AppInfo = z27.strictObject({
|
|
|
1759
1831
|
/** Plan usage read from the app's own files on this OS. */
|
|
1760
1832
|
usage: AppFeatureStatus
|
|
1761
1833
|
});
|
|
1762
|
-
var AppUsageReading =
|
|
1763
|
-
window:
|
|
1834
|
+
var AppUsageReading = z28.strictObject({
|
|
1835
|
+
window: z28.enum(["five_hour", "weekly", "extra"]),
|
|
1764
1836
|
/** 0–100 for five_hour and weekly; extra-usage spend as a percent of its cap (may pass 100). */
|
|
1765
|
-
percent:
|
|
1837
|
+
percent: z28.number().min(0).max(1e4),
|
|
1766
1838
|
/** When the app recorded it. */
|
|
1767
1839
|
sampled_at_ms: epochMs,
|
|
1768
1840
|
/** True when the window has rolled over since the sample, so the figure has reset. */
|
|
1769
|
-
reset_since:
|
|
1841
|
+
reset_since: z28.boolean()
|
|
1770
1842
|
});
|
|
1771
|
-
var AppProfile =
|
|
1843
|
+
var AppProfile = z28.strictObject({
|
|
1772
1844
|
/** The row's id; null for a folder found on disk that no row names yet. */
|
|
1773
1845
|
id: AppProfileId.nullable(),
|
|
1774
1846
|
app_key: AppKey,
|
|
1775
|
-
display_name:
|
|
1847
|
+
display_name: z28.string().min(1).max(120),
|
|
1776
1848
|
/** The account the person means to be signed in here; null when not stated (never guessed). */
|
|
1777
|
-
account_identity:
|
|
1849
|
+
account_identity: z28.string().min(3).max(320).nullable(),
|
|
1778
1850
|
profile_locator: AppProfileLocator.nullable(),
|
|
1779
1851
|
/** The device the row is tied to; null when the row names none. */
|
|
1780
1852
|
device_id: DeviceId.nullable(),
|
|
1781
1853
|
/** The folder this profile resolves to on this device; null for a row tied to another device. */
|
|
1782
1854
|
folder: AbsPath.nullable(),
|
|
1783
1855
|
/** The folder exists on this device. */
|
|
1784
|
-
on_disk:
|
|
1856
|
+
on_disk: z28.boolean(),
|
|
1785
1857
|
/** An instance with this profile is running; null when it could not be determined. */
|
|
1786
|
-
running:
|
|
1858
|
+
running: z28.boolean().nullable(),
|
|
1787
1859
|
/** Usage the app recorded for this profile; null when the app exposes none here. */
|
|
1788
|
-
usage:
|
|
1860
|
+
usage: z28.array(AppUsageReading).nullable(),
|
|
1789
1861
|
last_opened_ms: epochMs.nullable()
|
|
1790
1862
|
});
|
|
1791
|
-
var AppsListParams =
|
|
1792
|
-
var AppsListResult =
|
|
1793
|
-
var AppsProfilesListParams =
|
|
1863
|
+
var AppsListParams = z28.strictObject({});
|
|
1864
|
+
var AppsListResult = z28.strictObject({ apps: z28.array(AppInfo) });
|
|
1865
|
+
var AppsProfilesListParams = z28.strictObject({
|
|
1794
1866
|
/** Only this app's profiles; every app's when absent. */
|
|
1795
1867
|
app_key: AppKey.optional()
|
|
1796
1868
|
});
|
|
1797
|
-
var AppsProfilesListResult =
|
|
1798
|
-
profiles:
|
|
1869
|
+
var AppsProfilesListResult = z28.strictObject({
|
|
1870
|
+
profiles: z28.array(AppProfile),
|
|
1799
1871
|
/**
|
|
1800
1872
|
* Whether the saved rows could be read: false while signed out or offline, when only folders
|
|
1801
1873
|
* found on disk are listed.
|
|
1802
1874
|
*/
|
|
1803
|
-
registry:
|
|
1875
|
+
registry: z28.enum(["ok", "signed_out", "unavailable"])
|
|
1804
1876
|
});
|
|
1805
|
-
var AppsProfilesSaveParams =
|
|
1877
|
+
var AppsProfilesSaveParams = z28.strictObject({
|
|
1806
1878
|
id: AppProfileId.optional(),
|
|
1807
1879
|
app_key: AppKey,
|
|
1808
|
-
display_name:
|
|
1809
|
-
account_identity:
|
|
1880
|
+
display_name: z28.string().min(1).max(120),
|
|
1881
|
+
account_identity: z28.string().min(3).max(320).nullable(),
|
|
1810
1882
|
/** On create: the folder to use (one found on disk), or null for the app's default profile. Ignored on update. */
|
|
1811
1883
|
profile_locator: AppProfileLocator.nullable(),
|
|
1812
1884
|
/** On create with profile_locator null: make a new folder named after display_name instead. */
|
|
1813
|
-
new_folder:
|
|
1885
|
+
new_folder: z28.boolean().default(false)
|
|
1814
1886
|
});
|
|
1815
1887
|
var AppsProfilesSaveResult = AppProfile;
|
|
1816
|
-
var AppsProfilesRemoveParams =
|
|
1817
|
-
var AppsProfilesRemoveResult =
|
|
1818
|
-
var AppsOpenParams =
|
|
1888
|
+
var AppsProfilesRemoveParams = z28.strictObject({ id: AppProfileId });
|
|
1889
|
+
var AppsProfilesRemoveResult = z28.strictObject({ removed: z28.boolean() });
|
|
1890
|
+
var AppsOpenParams = z28.strictObject({
|
|
1819
1891
|
app_key: AppKey,
|
|
1820
1892
|
profile_id: AppProfileId.optional()
|
|
1821
1893
|
});
|
|
1822
|
-
var AppsOpenResult =
|
|
1894
|
+
var AppsOpenResult = z28.strictObject({
|
|
1823
1895
|
/** True when an instance with this profile was already running; it is brought forward. */
|
|
1824
|
-
already_running:
|
|
1896
|
+
already_running: z28.boolean(),
|
|
1825
1897
|
folder: AbsPath.nullable()
|
|
1826
1898
|
});
|
|
1827
1899
|
|
|
1828
1900
|
// src/schema/apps-chats.ts
|
|
1829
|
-
import { z as
|
|
1830
|
-
var ChatId =
|
|
1831
|
-
var ChatPlace =
|
|
1832
|
-
var ChatProjectId =
|
|
1833
|
-
var ChatWindow =
|
|
1901
|
+
import { z as z29 } from "zod";
|
|
1902
|
+
var ChatId = z29.string().regex(/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/);
|
|
1903
|
+
var ChatPlace = z29.string().regex(/^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/);
|
|
1904
|
+
var ChatProjectId = z29.string().regex(/^[a-z0-9][a-z0-9-]{0,63}$/);
|
|
1905
|
+
var ChatWindow = z29.strictObject({
|
|
1834
1906
|
key: ChatPlace,
|
|
1835
1907
|
/** The app's default profile (Claude: the main window, which lists every account's chats). */
|
|
1836
|
-
main:
|
|
1908
|
+
main: z29.boolean(),
|
|
1837
1909
|
/** The account the window is signed into, when known. */
|
|
1838
|
-
account:
|
|
1910
|
+
account: z29.string().max(320).nullable()
|
|
1839
1911
|
});
|
|
1840
|
-
var ChatProject =
|
|
1912
|
+
var ChatProject = z29.strictObject({
|
|
1841
1913
|
id: ChatProjectId,
|
|
1842
|
-
name:
|
|
1843
|
-
archived:
|
|
1914
|
+
name: z29.string().min(1).max(200),
|
|
1915
|
+
archived: z29.boolean(),
|
|
1844
1916
|
/** Chats in it. */
|
|
1845
1917
|
count: nonNegInt
|
|
1846
1918
|
});
|
|
1847
|
-
var ChatPin =
|
|
1919
|
+
var ChatPin = z29.strictObject({
|
|
1848
1920
|
/** The window whose account pins it; an account with no window of its own is named by its email. */
|
|
1849
|
-
window:
|
|
1921
|
+
window: z29.string().min(1).max(320),
|
|
1850
1922
|
/** When that account's pin list was last read; null when the reading has no time. */
|
|
1851
1923
|
observed_at_ms: epochMs.nullable()
|
|
1852
1924
|
});
|
|
1853
|
-
var ChatRunning =
|
|
1925
|
+
var ChatRunning = z29.strictObject({
|
|
1854
1926
|
window: ChatPlace,
|
|
1855
1927
|
/** process: a live process resumed this chat there (exact); activity: that window's own record moved in the last 3 minutes. */
|
|
1856
|
-
how:
|
|
1928
|
+
how: z29.enum(["process", "activity"])
|
|
1857
1929
|
});
|
|
1858
|
-
var ChatHidden =
|
|
1930
|
+
var ChatHidden = z29.strictObject({
|
|
1859
1931
|
window: ChatPlace,
|
|
1860
|
-
reason:
|
|
1932
|
+
reason: z29.string().max(200)
|
|
1861
1933
|
});
|
|
1862
|
-
var ChatLastUse =
|
|
1934
|
+
var ChatLastUse = z29.strictObject({
|
|
1863
1935
|
/** The conversation's last reply. */
|
|
1864
1936
|
at_ms: epochMs,
|
|
1865
1937
|
window: ChatPlace.nullable(),
|
|
1866
|
-
account:
|
|
1938
|
+
account: z29.string().max(320).nullable(),
|
|
1867
1939
|
/** How the window was decided (one short line). */
|
|
1868
|
-
how:
|
|
1940
|
+
how: z29.string().max(120).nullable(),
|
|
1869
1941
|
/** The account's 1-hour prompt cache is still warm. */
|
|
1870
|
-
cache_warm:
|
|
1942
|
+
cache_warm: z29.boolean(),
|
|
1871
1943
|
cache_minutes_left: nonNegInt
|
|
1872
1944
|
});
|
|
1873
|
-
var ChatAppProject =
|
|
1874
|
-
id:
|
|
1875
|
-
name:
|
|
1945
|
+
var ChatAppProject = z29.strictObject({
|
|
1946
|
+
id: z29.string().min(1).max(200),
|
|
1947
|
+
name: z29.string().max(200)
|
|
1876
1948
|
});
|
|
1877
|
-
var ChatTitleSource =
|
|
1878
|
-
var ChatRow =
|
|
1949
|
+
var ChatTitleSource = z29.enum(["app", "app-remembered", "custom-title", "ai-title", "agent-name", "summary", "first-prompt", "last-prompt"]);
|
|
1950
|
+
var ChatRow = z29.strictObject({
|
|
1879
1951
|
id: ChatId,
|
|
1880
1952
|
/** The short id people see (the listing's first 8 characters). */
|
|
1881
|
-
short_id:
|
|
1953
|
+
short_id: z29.string().max(16),
|
|
1882
1954
|
/** The listing's own name (Claude: local_<id>), null for a chat only in the holder. */
|
|
1883
|
-
record:
|
|
1884
|
-
title:
|
|
1955
|
+
record: z29.string().max(160).nullable(),
|
|
1956
|
+
title: z29.string().max(1e3),
|
|
1885
1957
|
last_active_ms: epochMs.nullable(),
|
|
1886
1958
|
created_ms: epochMs.nullable(),
|
|
1887
|
-
projects:
|
|
1888
|
-
starred:
|
|
1889
|
-
pinned_in:
|
|
1959
|
+
projects: z29.array(ChatProjectId).max(500),
|
|
1960
|
+
starred: z29.boolean(),
|
|
1961
|
+
pinned_in: z29.array(ChatPin).max(200),
|
|
1890
1962
|
/** Every place it is listed now: window keys, plus "holder". */
|
|
1891
|
-
places:
|
|
1892
|
-
held:
|
|
1893
|
-
running:
|
|
1894
|
-
hidden_in:
|
|
1963
|
+
places: z29.array(ChatPlace).max(200),
|
|
1964
|
+
held: z29.boolean(),
|
|
1965
|
+
running: z29.array(ChatRunning).max(200),
|
|
1966
|
+
hidden_in: z29.array(ChatHidden).max(200),
|
|
1895
1967
|
/** Kept out of the main window on purpose. */
|
|
1896
|
-
hidden_from_main:
|
|
1968
|
+
hidden_from_main: z29.boolean(),
|
|
1897
1969
|
/** Listed in a side window and not yet copied into main. */
|
|
1898
|
-
main_pending:
|
|
1970
|
+
main_pending: z29.boolean(),
|
|
1899
1971
|
/** A scheduled routine's run (its task id). */
|
|
1900
|
-
scheduled:
|
|
1972
|
+
scheduled: z29.string().max(200).nullable(),
|
|
1901
1973
|
/** Created recently and in no project: offered for filing. */
|
|
1902
|
-
new_unfiled:
|
|
1903
|
-
warnings:
|
|
1974
|
+
new_unfiled: z29.boolean(),
|
|
1975
|
+
warnings: z29.array(z29.string().max(400)).max(20),
|
|
1904
1976
|
last_use: ChatLastUse.nullable(),
|
|
1905
1977
|
/** 1.13: the app's own project the chat is grouped under in the app (Codex), read only; absent = none or not an app that groups. */
|
|
1906
1978
|
app_project: ChatAppProject.optional(),
|
|
@@ -1910,335 +1982,335 @@ var ChatRow = z28.strictObject({
|
|
|
1910
1982
|
* 1.14: the chat's own title before the person's rename (the one title rule, `@ai-matrx/coding-sessions/sessions`);
|
|
1911
1983
|
* `title` is what to show (`title_override` when set, else this).
|
|
1912
1984
|
*/
|
|
1913
|
-
original_title:
|
|
1985
|
+
original_title: z29.string().max(1e3).optional(),
|
|
1914
1986
|
/** 1.14: where `original_title` came from (the one rule's sources, strongest first; 1.15: a closed set). */
|
|
1915
1987
|
title_source: ChatTitleSource.optional(),
|
|
1916
1988
|
/** 1.14: the person's rename inside Matrx (Coding Sessions), applied once by the row builder; absent = none. */
|
|
1917
|
-
title_override:
|
|
1989
|
+
title_override: z29.string().min(1).max(300).optional(),
|
|
1918
1990
|
/** 1.15: the app itself archived it (hidden_in says where and why, in words for people; this is the typed fact). */
|
|
1919
|
-
archived:
|
|
1991
|
+
archived: z29.boolean().optional()
|
|
1920
1992
|
});
|
|
1921
|
-
var ChatFamily =
|
|
1993
|
+
var ChatFamily = z29.strictObject({
|
|
1922
1994
|
id: ChatId,
|
|
1923
1995
|
fork_of: ChatId.nullable(),
|
|
1924
1996
|
copy_of: ChatId.nullable()
|
|
1925
1997
|
});
|
|
1926
|
-
var AppsChatsListParams =
|
|
1998
|
+
var AppsChatsListParams = z29.strictObject({
|
|
1927
1999
|
app_key: AppKey,
|
|
1928
2000
|
/** Only these chats (a live update re-reads just what changed). */
|
|
1929
|
-
ids:
|
|
2001
|
+
ids: z29.array(ChatId).max(500).optional()
|
|
1930
2002
|
});
|
|
1931
|
-
var AppsChatsListResult =
|
|
2003
|
+
var AppsChatsListResult = z29.strictObject({
|
|
1932
2004
|
app_key: AppKey,
|
|
1933
2005
|
/** Bumps on every change the index sees; `apps.chats.changed` carries the same number. */
|
|
1934
2006
|
version: nonNegInt,
|
|
1935
|
-
windows:
|
|
1936
|
-
projects:
|
|
1937
|
-
chats:
|
|
2007
|
+
windows: z29.array(ChatWindow).max(200),
|
|
2008
|
+
projects: z29.array(ChatProject).max(5e3),
|
|
2009
|
+
chats: z29.array(ChatRow).max(2e4),
|
|
1938
2010
|
/** How long a chat in no project counts as new. */
|
|
1939
2011
|
new_window_ms: nonNegInt,
|
|
1940
2012
|
/** 1.9: this is the copy saved at the last read, shown while everything is read again. */
|
|
1941
|
-
updating:
|
|
2013
|
+
updating: z29.boolean().optional(),
|
|
1942
2014
|
/** 1.9: false while the folder watches are down (changes are not arriving); `apps.chats.watch_state` says when it changes. */
|
|
1943
|
-
live:
|
|
2015
|
+
live: z29.boolean().optional(),
|
|
1944
2016
|
/** 1.10: every listed chat that is a fork or a copy of another (read from the conversations' first lines). */
|
|
1945
|
-
families:
|
|
2017
|
+
families: z29.array(ChatFamily).max(2e4).optional()
|
|
1946
2018
|
});
|
|
1947
|
-
var AppsChatsWatchParams =
|
|
1948
|
-
var AppsChatsWatchResult =
|
|
1949
|
-
var AppsChatsChangedEvent =
|
|
2019
|
+
var AppsChatsWatchParams = z29.strictObject({ app_key: AppKey });
|
|
2020
|
+
var AppsChatsWatchResult = z29.strictObject({ resource_id: ResourceId, version: nonNegInt });
|
|
2021
|
+
var AppsChatsChangedEvent = z29.strictObject({
|
|
1950
2022
|
app_key: AppKey,
|
|
1951
2023
|
version: nonNegInt,
|
|
1952
|
-
ids:
|
|
1953
|
-
all:
|
|
2024
|
+
ids: z29.array(ChatId).max(1e3),
|
|
2025
|
+
all: z29.boolean()
|
|
1954
2026
|
});
|
|
1955
|
-
var AppsChatsWatchStateEvent =
|
|
2027
|
+
var AppsChatsWatchStateEvent = z29.strictObject({
|
|
1956
2028
|
app_key: AppKey,
|
|
1957
|
-
live:
|
|
1958
|
-
updating:
|
|
1959
|
-
reason:
|
|
2029
|
+
live: z29.boolean(),
|
|
2030
|
+
updating: z29.boolean(),
|
|
2031
|
+
reason: z29.string().max(300).nullable()
|
|
1960
2032
|
});
|
|
1961
|
-
var AppsChatsPlaceParams =
|
|
2033
|
+
var AppsChatsPlaceParams = z29.strictObject({
|
|
1962
2034
|
app_key: AppKey,
|
|
1963
2035
|
chat_id: ChatId,
|
|
1964
|
-
action:
|
|
2036
|
+
action: z29.enum(["place", "take_off", "hold"]),
|
|
1965
2037
|
/** The window (for place and take_off). */
|
|
1966
2038
|
window: ChatPlace.optional(),
|
|
1967
2039
|
/** take_off where it is open: stop it there first (the person confirmed). */
|
|
1968
|
-
stop_if_open:
|
|
2040
|
+
stop_if_open: z29.boolean().default(false)
|
|
1969
2041
|
});
|
|
1970
|
-
var AppsChatsPlaceResult =
|
|
1971
|
-
var AppsProjectsFileManyParams =
|
|
2042
|
+
var AppsChatsPlaceResult = z29.strictObject({ chat: ChatRow, message: z29.string().max(400) });
|
|
2043
|
+
var AppsProjectsFileManyParams = z29.strictObject({
|
|
1972
2044
|
app_key: AppKey,
|
|
1973
|
-
chat_ids:
|
|
2045
|
+
chat_ids: z29.array(ChatId).min(1).max(500),
|
|
1974
2046
|
project_id: ChatProjectId.optional(),
|
|
1975
|
-
new_project_name:
|
|
2047
|
+
new_project_name: z29.string().min(1).max(200).optional()
|
|
1976
2048
|
});
|
|
1977
|
-
var AppsProjectsFileManyResult =
|
|
1978
|
-
var AppsProjectsUpdateParams =
|
|
2049
|
+
var AppsProjectsFileManyResult = z29.strictObject({ chats: z29.array(ChatRow).max(500), project: ChatProject });
|
|
2050
|
+
var AppsProjectsUpdateParams = z29.strictObject({
|
|
1979
2051
|
app_key: AppKey,
|
|
1980
2052
|
project_id: ChatProjectId,
|
|
1981
|
-
name:
|
|
1982
|
-
archived:
|
|
2053
|
+
name: z29.string().min(1).max(200).optional(),
|
|
2054
|
+
archived: z29.boolean().optional()
|
|
1983
2055
|
});
|
|
1984
|
-
var AppsProjectsUpdateResult =
|
|
1985
|
-
var AppsProjectsCopyParams =
|
|
1986
|
-
var AppsProjectsCopyResult =
|
|
1987
|
-
var AppsProjectsFileParams =
|
|
2056
|
+
var AppsProjectsUpdateResult = z29.strictObject({ project: ChatProject });
|
|
2057
|
+
var AppsProjectsCopyParams = z29.strictObject({ app_key: AppKey, project_id: ChatProjectId, new_project_name: z29.string().min(1).max(200) });
|
|
2058
|
+
var AppsProjectsCopyResult = z29.strictObject({ project: ChatProject });
|
|
2059
|
+
var AppsProjectsFileParams = z29.strictObject({
|
|
1988
2060
|
app_key: AppKey,
|
|
1989
2061
|
chat_id: ChatId,
|
|
1990
2062
|
project_id: ChatProjectId.optional(),
|
|
1991
|
-
new_project_name:
|
|
2063
|
+
new_project_name: z29.string().min(1).max(200).optional()
|
|
1992
2064
|
});
|
|
1993
|
-
var AppsProjectsFileResult =
|
|
1994
|
-
var AppsProjectsUnfileParams =
|
|
1995
|
-
var AppsProjectsUnfileResult =
|
|
1996
|
-
var AppsChatsStarParams =
|
|
1997
|
-
var AppsChatsStarResult =
|
|
2065
|
+
var AppsProjectsFileResult = z29.strictObject({ chat: ChatRow, project: ChatProject });
|
|
2066
|
+
var AppsProjectsUnfileParams = z29.strictObject({ app_key: AppKey, chat_id: ChatId, project_id: ChatProjectId });
|
|
2067
|
+
var AppsProjectsUnfileResult = z29.strictObject({ chat: ChatRow });
|
|
2068
|
+
var AppsChatsStarParams = z29.strictObject({ app_key: AppKey, chat_id: ChatId, starred: z29.boolean() });
|
|
2069
|
+
var AppsChatsStarResult = z29.strictObject({ chat: ChatRow });
|
|
1998
2070
|
|
|
1999
2071
|
// src/schema/apps-accounts.ts
|
|
2000
|
-
import { z as
|
|
2001
|
-
var AppWindowInfo =
|
|
2072
|
+
import { z as z30 } from "zod";
|
|
2073
|
+
var AppWindowInfo = z30.strictObject({
|
|
2002
2074
|
key: ChatPlace,
|
|
2003
2075
|
/** The app's default profile (Claude: main, which may sign into any account). */
|
|
2004
|
-
main:
|
|
2076
|
+
main: z30.boolean(),
|
|
2005
2077
|
/** The account the window is meant for (null for main). */
|
|
2006
|
-
account:
|
|
2078
|
+
account: z30.string().max(320).nullable(),
|
|
2007
2079
|
/** The account signed in there now: an email, or the account id while it has no saved name. */
|
|
2008
|
-
signed_in:
|
|
2009
|
-
signed_in_is_email:
|
|
2080
|
+
signed_in: z30.string().max(320).nullable(),
|
|
2081
|
+
signed_in_is_email: z30.boolean(),
|
|
2010
2082
|
/** Signed into another account than the one it is meant for. */
|
|
2011
|
-
mismatch:
|
|
2083
|
+
mismatch: z30.boolean(),
|
|
2012
2084
|
/** Its folder exists. */
|
|
2013
|
-
created:
|
|
2085
|
+
created: z30.boolean(),
|
|
2014
2086
|
/** Open now. */
|
|
2015
|
-
running:
|
|
2087
|
+
running: z30.boolean(),
|
|
2016
2088
|
/** Chats open in it now (a process resuming each one). */
|
|
2017
2089
|
open_chats: nonNegInt
|
|
2018
2090
|
});
|
|
2019
|
-
var AccountUsage =
|
|
2091
|
+
var AccountUsage = z30.strictObject({
|
|
2020
2092
|
/** The account's email, or "org <8 chars>" when no window has ever sampled that org. */
|
|
2021
|
-
account:
|
|
2022
|
-
org:
|
|
2093
|
+
account: z30.string().max(320),
|
|
2094
|
+
org: z30.string().max(80).nullable(),
|
|
2023
2095
|
/** False when the org was sampled in several accounts' windows and the vote is not clear (≥ 75 %). */
|
|
2024
|
-
account_certain:
|
|
2096
|
+
account_certain: z30.boolean(),
|
|
2025
2097
|
/** 5-hour use in percent (0 once the reading is over 5 hours old). */
|
|
2026
|
-
five_hour:
|
|
2027
|
-
five_hour_reset_since:
|
|
2098
|
+
five_hour: z30.number().nullable(),
|
|
2099
|
+
five_hour_reset_since: z30.boolean(),
|
|
2028
2100
|
/** Weekly use in percent (0 once the week reset after the reading). */
|
|
2029
|
-
weekly:
|
|
2030
|
-
weekly_reset_since:
|
|
2101
|
+
weekly: z30.number().nullable(),
|
|
2102
|
+
weekly_reset_since: z30.boolean(),
|
|
2031
2103
|
/** Extra-usage spend in percent of its cap, when on. */
|
|
2032
|
-
extra_usage:
|
|
2104
|
+
extra_usage: z30.number().nullable(),
|
|
2033
2105
|
extra_usage_as_of_ms: epochMs.nullable(),
|
|
2034
2106
|
as_of_ms: epochMs,
|
|
2035
2107
|
/** The windows meant for this account (and main when main took the reading). */
|
|
2036
|
-
windows:
|
|
2108
|
+
windows: z30.array(ChatPlace).max(200),
|
|
2037
2109
|
/** The window that took the reading is open now and the reading is under 30 minutes old. */
|
|
2038
|
-
live:
|
|
2110
|
+
live: z30.boolean(),
|
|
2039
2111
|
/** The next weekly reset, when known. */
|
|
2040
2112
|
weekly_resets_at_ms: epochMs.nullable(),
|
|
2041
2113
|
/** That reset time is Claude's own (its reading, or a reset seen in its usage history). */
|
|
2042
|
-
weekly_reset_official:
|
|
2114
|
+
weekly_reset_official: z30.boolean().nullable(),
|
|
2043
2115
|
/** 1.13: the account's plan as the app names it (Codex: "pro", "prolite"), when recorded. */
|
|
2044
|
-
plan:
|
|
2116
|
+
plan: z30.string().max(80).optional(),
|
|
2045
2117
|
/** 1.13: the account's credit balance as the app records it (Codex), when recorded. */
|
|
2046
|
-
credits:
|
|
2118
|
+
credits: z30.string().max(40).optional()
|
|
2047
2119
|
});
|
|
2048
|
-
var AccountReset =
|
|
2120
|
+
var AccountReset = z30.strictObject({
|
|
2049
2121
|
window: ChatPlace,
|
|
2050
|
-
account:
|
|
2122
|
+
account: z30.string().max(320).nullable(),
|
|
2051
2123
|
next_reset_ms: epochMs.nullable(),
|
|
2052
2124
|
/** claude: the app's own reading; usage_history: a weekly drop seen in its usage record; your_list: the person's own entry. */
|
|
2053
|
-
source:
|
|
2125
|
+
source: z30.enum(["claude", "usage_history", "your_list"]).nullable(),
|
|
2054
2126
|
/** claude or usage_history. */
|
|
2055
|
-
official:
|
|
2127
|
+
official: z30.boolean(),
|
|
2056
2128
|
/** Set when the person's list disagrees with the official time. */
|
|
2057
|
-
note:
|
|
2129
|
+
note: z30.string().max(200).nullable()
|
|
2058
2130
|
});
|
|
2059
|
-
var AppsWindowsListParams =
|
|
2060
|
-
var AppsWindowsListResult =
|
|
2061
|
-
var AppsAccountsUsageParams =
|
|
2062
|
-
var AppsAccountsUsageResult =
|
|
2131
|
+
var AppsWindowsListParams = z30.strictObject({ app_key: AppKey });
|
|
2132
|
+
var AppsWindowsListResult = z30.strictObject({ app_key: AppKey, windows: z30.array(AppWindowInfo).max(200) });
|
|
2133
|
+
var AppsAccountsUsageParams = z30.strictObject({ app_key: AppKey });
|
|
2134
|
+
var AppsAccountsUsageResult = z30.strictObject({
|
|
2063
2135
|
app_key: AppKey,
|
|
2064
|
-
accounts:
|
|
2136
|
+
accounts: z30.array(AccountUsage).max(500),
|
|
2065
2137
|
/** 1.12: the rows are right but something around them failed (a newly read reset time could not be saved); shown, never hidden. */
|
|
2066
|
-
problem:
|
|
2138
|
+
problem: z30.string().max(400).optional()
|
|
2067
2139
|
});
|
|
2068
|
-
var AppsAccountsResetsParams =
|
|
2069
|
-
var AppsAccountsResetsResult =
|
|
2140
|
+
var AppsAccountsResetsParams = z30.strictObject({ app_key: AppKey });
|
|
2141
|
+
var AppsAccountsResetsResult = z30.strictObject({
|
|
2070
2142
|
app_key: AppKey,
|
|
2071
|
-
resets:
|
|
2143
|
+
resets: z30.array(AccountReset).max(200),
|
|
2072
2144
|
/** 1.12: as on `apps.accounts.usage`. */
|
|
2073
|
-
problem:
|
|
2145
|
+
problem: z30.string().max(400).optional()
|
|
2074
2146
|
});
|
|
2075
|
-
var AppsWindowActionResult =
|
|
2076
|
-
var AppsWindowsOpenParams =
|
|
2077
|
-
var AppsWindowsReloadParams =
|
|
2078
|
-
var ShownSection =
|
|
2079
|
-
title:
|
|
2147
|
+
var AppsWindowActionResult = z30.strictObject({ message: z30.string().max(400) });
|
|
2148
|
+
var AppsWindowsOpenParams = z30.strictObject({ app_key: AppKey, window: ChatPlace });
|
|
2149
|
+
var AppsWindowsReloadParams = z30.strictObject({ app_key: AppKey, window: ChatPlace });
|
|
2150
|
+
var ShownSection = z30.strictObject({
|
|
2151
|
+
title: z30.string().max(300),
|
|
2080
2152
|
/** Rows drawn under it (a collapsed section draws none). */
|
|
2081
|
-
rows:
|
|
2082
|
-
expanded:
|
|
2153
|
+
rows: z30.number().int().nonnegative(),
|
|
2154
|
+
expanded: z30.boolean()
|
|
2083
2155
|
});
|
|
2084
|
-
var AppsWindowsShownParams =
|
|
2085
|
-
var AppsWindowsShownResult =
|
|
2156
|
+
var AppsWindowsShownParams = z30.strictObject({ app_key: AppKey, window: ChatPlace });
|
|
2157
|
+
var AppsWindowsShownResult = z30.strictObject({
|
|
2086
2158
|
window: ChatPlace,
|
|
2087
|
-
open:
|
|
2088
|
-
sections:
|
|
2089
|
-
problem:
|
|
2159
|
+
open: z30.boolean(),
|
|
2160
|
+
sections: z30.array(ShownSection).max(200),
|
|
2161
|
+
problem: z30.string().max(400).nullable()
|
|
2090
2162
|
});
|
|
2091
|
-
var AppsWindowsRestartParams =
|
|
2092
|
-
var AppsWindowsRefreshUsageParams =
|
|
2093
|
-
var AppsProjectsMoveParams =
|
|
2163
|
+
var AppsWindowsRestartParams = z30.strictObject({ app_key: AppKey, window: ChatPlace, force: z30.boolean().default(false) });
|
|
2164
|
+
var AppsWindowsRefreshUsageParams = z30.strictObject({ app_key: AppKey, window: ChatPlace });
|
|
2165
|
+
var AppsProjectsMoveParams = z30.strictObject({
|
|
2094
2166
|
app_key: AppKey,
|
|
2095
2167
|
chat_id: ChatId,
|
|
2096
2168
|
from_project_id: ChatProjectId,
|
|
2097
2169
|
to_project_id: ChatProjectId.optional(),
|
|
2098
|
-
new_project_name:
|
|
2099
|
-
});
|
|
2100
|
-
var AppsProjectsMoveResult =
|
|
2101
|
-
var AppsProjectsCreateParams =
|
|
2102
|
-
var AppsProjectsCreateResult =
|
|
2103
|
-
var AppsProjectsImportPinsParams =
|
|
2104
|
-
var AppsProjectsImportPinsResult =
|
|
2105
|
-
var ProjectMoveChat =
|
|
2106
|
-
var ProjectMoveSkip =
|
|
2107
|
-
var ProjectMoveGroup =
|
|
2108
|
-
ok:
|
|
2109
|
-
name:
|
|
2170
|
+
new_project_name: z30.string().min(1).max(200).optional()
|
|
2171
|
+
});
|
|
2172
|
+
var AppsProjectsMoveResult = z30.strictObject({ chat: ChatRow, project: ChatProject });
|
|
2173
|
+
var AppsProjectsCreateParams = z30.strictObject({ app_key: AppKey, name: z30.string().min(1).max(200) });
|
|
2174
|
+
var AppsProjectsCreateResult = z30.strictObject({ project: ChatProject });
|
|
2175
|
+
var AppsProjectsImportPinsParams = z30.strictObject({ app_key: AppKey });
|
|
2176
|
+
var AppsProjectsImportPinsResult = z30.strictObject({ message: z30.string().max(400) });
|
|
2177
|
+
var ProjectMoveChat = z30.strictObject({ chat_id: ChatId, title: z30.string().max(300) });
|
|
2178
|
+
var ProjectMoveSkip = z30.strictObject({ chat_id: ChatId, title: z30.string().max(300), window: ChatPlace.nullable(), reason: z30.string().max(400) });
|
|
2179
|
+
var ProjectMoveGroup = z30.strictObject({
|
|
2180
|
+
ok: z30.boolean(),
|
|
2181
|
+
name: z30.string().max(200),
|
|
2110
2182
|
/** Why it is not (or was not) grouped — e.g. the window is open. */
|
|
2111
|
-
reason:
|
|
2183
|
+
reason: z30.string().max(400).optional(),
|
|
2112
2184
|
/** Chats that get (or got) the group; already in it; taken from another group of the window. */
|
|
2113
2185
|
assign: nonNegInt.optional(),
|
|
2114
2186
|
already: nonNegInt.optional(),
|
|
2115
2187
|
from_other_groups: nonNegInt.optional(),
|
|
2116
2188
|
/** A group of that name was already there (reused, never doubled). */
|
|
2117
|
-
group_exists:
|
|
2189
|
+
group_exists: z30.boolean().optional()
|
|
2118
2190
|
});
|
|
2119
|
-
var AppsProjectsToWindowParams =
|
|
2191
|
+
var AppsProjectsToWindowParams = z30.strictObject({
|
|
2120
2192
|
app_key: AppKey,
|
|
2121
2193
|
project_id: ChatProjectId,
|
|
2122
2194
|
window: ChatPlace,
|
|
2123
2195
|
/** Also take each chat off its other side windows where safe (never main, the holder, an open window). */
|
|
2124
|
-
take_off:
|
|
2196
|
+
take_off: z30.boolean().default(false),
|
|
2125
2197
|
/** Also group them under the project's name in that window's sidebar (closed windows only). */
|
|
2126
|
-
group:
|
|
2127
|
-
dry_run:
|
|
2198
|
+
group: z30.boolean().default(false),
|
|
2199
|
+
dry_run: z30.boolean().default(false)
|
|
2128
2200
|
});
|
|
2129
|
-
var AppsProjectsToWindowResult =
|
|
2201
|
+
var AppsProjectsToWindowResult = z30.strictObject({
|
|
2130
2202
|
project_id: ChatProjectId,
|
|
2131
2203
|
window: ChatPlace,
|
|
2132
|
-
dry_run:
|
|
2133
|
-
place:
|
|
2134
|
-
already:
|
|
2135
|
-
take_off:
|
|
2136
|
-
skipped:
|
|
2204
|
+
dry_run: z30.boolean(),
|
|
2205
|
+
place: z30.array(ProjectMoveChat).max(5e3),
|
|
2206
|
+
already: z30.array(ProjectMoveChat).max(5e3),
|
|
2207
|
+
take_off: z30.array(ProjectMoveChat.extend({ window: ChatPlace })).max(2e4),
|
|
2208
|
+
skipped: z30.array(ProjectMoveSkip).max(2e4),
|
|
2137
2209
|
/** Chats of the project from other apps (no windows to place into), left as they are. */
|
|
2138
2210
|
other_apps: nonNegInt,
|
|
2139
2211
|
group: ProjectMoveGroup.nullable(),
|
|
2140
|
-
message:
|
|
2212
|
+
message: z30.string().max(400)
|
|
2141
2213
|
});
|
|
2142
|
-
var ColdChat =
|
|
2214
|
+
var ColdChat = z30.strictObject({
|
|
2143
2215
|
id: ChatId,
|
|
2144
|
-
title:
|
|
2145
|
-
repo:
|
|
2146
|
-
window:
|
|
2147
|
-
account:
|
|
2148
|
-
model_name:
|
|
2216
|
+
title: z30.string().max(1e3),
|
|
2217
|
+
repo: z30.string().max(200).nullable(),
|
|
2218
|
+
window: z30.string().max(64).nullable(),
|
|
2219
|
+
account: z30.string().max(320).nullable(),
|
|
2220
|
+
model_name: z30.string().max(120).nullable(),
|
|
2149
2221
|
context_tokens: nonNegInt,
|
|
2150
2222
|
cold_at_ms: epochMs,
|
|
2151
2223
|
/** Waking it once the cache is cold. */
|
|
2152
|
-
cold_cost:
|
|
2224
|
+
cold_cost: z30.number().nullable(),
|
|
2153
2225
|
/** Waking it while the cache is warm. */
|
|
2154
|
-
warm_cost:
|
|
2226
|
+
warm_cost: z30.number().nullable(),
|
|
2155
2227
|
/** Its account is on extra usage (a 5-minute cache, and real money). */
|
|
2156
|
-
extra_usage:
|
|
2228
|
+
extra_usage: z30.boolean(),
|
|
2157
2229
|
/** A scheduled routine's run. */
|
|
2158
|
-
scheduled:
|
|
2230
|
+
scheduled: z30.boolean(),
|
|
2159
2231
|
/** It can be shown in its window (started in the desktop app). */
|
|
2160
|
-
openable:
|
|
2232
|
+
openable: z30.boolean(),
|
|
2161
2233
|
/** How its window was decided, or why it can't be opened. */
|
|
2162
|
-
how:
|
|
2234
|
+
how: z30.string().max(200).nullable()
|
|
2163
2235
|
});
|
|
2164
|
-
var AppsChatsColdParams =
|
|
2165
|
-
var AppsChatsColdResult =
|
|
2236
|
+
var AppsChatsColdParams = z30.strictObject({ app_key: AppKey });
|
|
2237
|
+
var AppsChatsColdResult = z30.strictObject({
|
|
2166
2238
|
app_key: AppKey,
|
|
2167
2239
|
/** Waiting for the person with a warm cache, most urgent first. */
|
|
2168
|
-
waiting:
|
|
2240
|
+
waiting: z30.array(ColdChat).max(2e3),
|
|
2169
2241
|
/** Went cold in the last while. */
|
|
2170
|
-
recently_cold:
|
|
2242
|
+
recently_cold: z30.array(ColdChat).max(2e3),
|
|
2171
2243
|
/** Chats working right now (not waiting). */
|
|
2172
2244
|
working: nonNegInt
|
|
2173
2245
|
});
|
|
2174
|
-
var AppsChatsOpenParams =
|
|
2175
|
-
var SpendSplit =
|
|
2176
|
-
var SpendScopes =
|
|
2177
|
-
var SpendAccount =
|
|
2178
|
-
account:
|
|
2246
|
+
var AppsChatsOpenParams = z30.strictObject({ app_key: AppKey, chat_id: ChatId, window: ChatPlace.optional() });
|
|
2247
|
+
var SpendSplit = z30.strictObject({ main: z30.number(), helpers: z30.number() });
|
|
2248
|
+
var SpendScopes = z30.strictObject({ today: SpendSplit, week: SpendSplit });
|
|
2249
|
+
var SpendAccount = z30.strictObject({
|
|
2250
|
+
account: z30.string().max(320),
|
|
2179
2251
|
spend: SpendScopes,
|
|
2180
|
-
last_hour:
|
|
2181
|
-
last_5h:
|
|
2182
|
-
five_hour:
|
|
2183
|
-
weekly:
|
|
2252
|
+
last_hour: z30.number().nullable(),
|
|
2253
|
+
last_5h: z30.number().nullable(),
|
|
2254
|
+
five_hour: z30.number().nullable(),
|
|
2255
|
+
weekly: z30.number().nullable(),
|
|
2184
2256
|
as_of_ms: epochMs.nullable(),
|
|
2185
2257
|
weekly_resets_at_ms: epochMs.nullable(),
|
|
2186
2258
|
/** When the 5-hour or weekly limit is projected to be reached at the current burn. */
|
|
2187
2259
|
five_hour_full_at_ms: epochMs.nullable(),
|
|
2188
2260
|
weekly_full_at_ms: epochMs.nullable(),
|
|
2189
2261
|
/** The reading is too old to project. */
|
|
2190
|
-
stale:
|
|
2262
|
+
stale: z30.boolean()
|
|
2191
2263
|
});
|
|
2192
|
-
var SpendModel =
|
|
2193
|
-
var SpendChat =
|
|
2264
|
+
var SpendModel = z30.strictObject({ model: z30.string().max(120), name: z30.string().max(120), spend: SpendScopes });
|
|
2265
|
+
var SpendChat = z30.strictObject({
|
|
2194
2266
|
id: ChatId,
|
|
2195
|
-
title:
|
|
2196
|
-
repo:
|
|
2197
|
-
window:
|
|
2267
|
+
title: z30.string().max(1e3),
|
|
2268
|
+
repo: z30.string().max(200).nullable(),
|
|
2269
|
+
window: z30.string().max(64).nullable(),
|
|
2198
2270
|
spend: SpendScopes,
|
|
2199
2271
|
helpers: nonNegInt
|
|
2200
2272
|
});
|
|
2201
|
-
var SpendHelper =
|
|
2202
|
-
var SpendLive =
|
|
2203
|
-
var SpendIdleScope =
|
|
2204
|
-
var SpendIdle =
|
|
2205
|
-
var SpendStart =
|
|
2206
|
-
var AppsSpendParams =
|
|
2207
|
-
var AppsSpendResult =
|
|
2273
|
+
var SpendHelper = z30.strictObject({ model: z30.string().max(120), steps: nonNegInt, over_steps: z30.boolean(), description: z30.string().max(400) });
|
|
2274
|
+
var SpendLive = z30.strictObject({ id: ChatId, title: z30.string().max(1e3), window: z30.string().max(64).nullable(), helpers: z30.array(SpendHelper).max(200) });
|
|
2275
|
+
var SpendIdleScope = z30.strictObject({ count: nonNegInt, tokens: nonNegInt, cost: z30.number(), avoidable: z30.number() });
|
|
2276
|
+
var SpendIdle = z30.strictObject({ id: ChatId, chat: z30.string().max(1e3), who: z30.string().max(400), today: SpendIdleScope, week: SpendIdleScope, last_ms: epochMs });
|
|
2277
|
+
var SpendStart = z30.strictObject({ repo: z30.string().max(200), count: nonNegInt, median: nonNegInt, latest: z30.array(nonNegInt).max(20), alarm: z30.string().max(400).nullable() });
|
|
2278
|
+
var AppsSpendParams = z30.strictObject({ app_key: AppKey });
|
|
2279
|
+
var AppsSpendResult = z30.strictObject({
|
|
2208
2280
|
app_key: AppKey,
|
|
2209
2281
|
/** False while older chats are still being read. */
|
|
2210
|
-
complete:
|
|
2211
|
-
today_total:
|
|
2212
|
-
week_total:
|
|
2213
|
-
idle_today:
|
|
2214
|
-
idle_week:
|
|
2282
|
+
complete: z30.boolean(),
|
|
2283
|
+
today_total: z30.number(),
|
|
2284
|
+
week_total: z30.number(),
|
|
2285
|
+
idle_today: z30.number(),
|
|
2286
|
+
idle_week: z30.number(),
|
|
2215
2287
|
/** Models with no known list price. */
|
|
2216
|
-
unpriced:
|
|
2288
|
+
unpriced: z30.array(z30.string().max(120)).max(100),
|
|
2217
2289
|
/** Helpers past their step budget, unusual starting sizes. */
|
|
2218
|
-
alarms:
|
|
2219
|
-
live:
|
|
2220
|
-
accounts:
|
|
2221
|
-
models:
|
|
2222
|
-
chats:
|
|
2223
|
-
idle:
|
|
2224
|
-
starts:
|
|
2225
|
-
});
|
|
2226
|
-
var AppsSyncStatusParams =
|
|
2227
|
-
var AppsSyncStatusResult =
|
|
2228
|
-
healthy:
|
|
2229
|
-
summary:
|
|
2230
|
-
problems:
|
|
2231
|
-
warnings:
|
|
2290
|
+
alarms: z30.array(z30.string().max(400)).max(200),
|
|
2291
|
+
live: z30.array(SpendLive).max(200),
|
|
2292
|
+
accounts: z30.array(SpendAccount).max(200),
|
|
2293
|
+
models: z30.array(SpendModel).max(100),
|
|
2294
|
+
chats: z30.array(SpendChat).max(500),
|
|
2295
|
+
idle: z30.array(SpendIdle).max(500),
|
|
2296
|
+
starts: z30.array(SpendStart).max(200)
|
|
2297
|
+
});
|
|
2298
|
+
var AppsSyncStatusParams = z30.strictObject({ app_key: AppKey });
|
|
2299
|
+
var AppsSyncStatusResult = z30.strictObject({
|
|
2300
|
+
healthy: z30.boolean(),
|
|
2301
|
+
summary: z30.string().max(400),
|
|
2302
|
+
problems: z30.array(z30.string().max(400)).max(200),
|
|
2303
|
+
warnings: z30.array(z30.string().max(400)).max(200),
|
|
2232
2304
|
/** Accounts seen with no saved name yet (Save account names fixes them). */
|
|
2233
|
-
unnamed_accounts:
|
|
2305
|
+
unnamed_accounts: z30.array(z30.string().max(80)).max(200),
|
|
2234
2306
|
/** The full report. */
|
|
2235
|
-
output:
|
|
2307
|
+
output: z30.string().max(2e5)
|
|
2236
2308
|
});
|
|
2237
|
-
var AppsSyncRunParams =
|
|
2238
|
-
var AppsWindowsProcessesParams =
|
|
2239
|
-
var AppsWindowsProcessesResult =
|
|
2240
|
-
var AppsWindowsAddParams =
|
|
2241
|
-
var AppsWindowsSaveNamesParams =
|
|
2309
|
+
var AppsSyncRunParams = z30.strictObject({ app_key: AppKey });
|
|
2310
|
+
var AppsWindowsProcessesParams = z30.strictObject({ app_key: AppKey });
|
|
2311
|
+
var AppsWindowsProcessesResult = z30.strictObject({ processes: z30.array(z30.string().max(2e3)).max(2e3) });
|
|
2312
|
+
var AppsWindowsAddParams = z30.strictObject({ app_key: AppKey, window: ChatPlace, email: z30.string().min(3).max(320) });
|
|
2313
|
+
var AppsWindowsSaveNamesParams = z30.strictObject({ app_key: AppKey });
|
|
2242
2314
|
|
|
2243
2315
|
// src/schema/registry.ts
|
|
2244
2316
|
var FS_ERR = ["NOT_FOUND", "PERMISSION_DENIED_OS", "INVALID_PARAMS", "RESOURCE_BUSY", "INTERNAL"];
|
|
@@ -2370,7 +2442,11 @@ var OPS = {
|
|
|
2370
2442
|
"web.fetch": { params: WebFetchParams, result: WebFetchResult, kind: "unary", since: "1.22", errors: ["INVALID_PARAMS", "TIMEOUT", "RESOURCE_BUSY", "AUTH_REQUIRED", "INTERNAL"] },
|
|
2371
2443
|
"web.scrape": { params: WebScrapeParams, result: WebScrapeResult, kind: "unary", since: "1.22", errors: ["INVALID_PARAMS", "TIMEOUT", "RESOURCE_BUSY", "AUTH_REQUIRED", "INTERNAL"] },
|
|
2372
2444
|
"web.search": { params: WebSearchParams, result: WebSearchResult, kind: "unary", since: "1.22", errors: ["INVALID_PARAMS", "TIMEOUT", "RESOURCE_BUSY", "AUTH_REQUIRED", "INTERNAL"] },
|
|
2373
|
-
"web.fetch_with_browser": { params: WebBrowserFetchParams, result: WebBrowserFetchResult, kind: "unary", since: "1.22", errors: ["INVALID_PARAMS", "TIMEOUT", "RESOURCE_BUSY", "AUTH_REQUIRED", "INTERNAL"] }
|
|
2445
|
+
"web.fetch_with_browser": { params: WebBrowserFetchParams, result: WebBrowserFetchResult, kind: "unary", since: "1.22", errors: ["INVALID_PARAMS", "TIMEOUT", "RESOURCE_BUSY", "AUTH_REQUIRED", "INTERNAL"] },
|
|
2446
|
+
// 1.23: the signed-in person's own agents and Vault, read as them (the desktop's Agents library and Vault).
|
|
2447
|
+
"account.agents.list": { params: AccountAgentsListParams, result: AccountAgentsListResult, kind: "unary", since: "1.23", errors: ["INTERNAL"] },
|
|
2448
|
+
"account.vault.list": { params: AccountVaultListParams, result: AccountVaultListResult, kind: "unary", since: "1.23", errors: ["INTERNAL"] },
|
|
2449
|
+
"account.vault.copy": { params: AccountVaultCopyParams, result: AccountVaultCopyResult, kind: "unary", since: "1.23", errors: ["AUTH_REQUIRED", "AUTH_FORBIDDEN", "NOT_FOUND", "INVALID_PARAMS", "DEVICE_OFFLINE", "INTERNAL"] }
|
|
2374
2450
|
};
|
|
2375
2451
|
var EVENTS = {
|
|
2376
2452
|
"fs.changed": FsChangedEvent,
|