@ai-matrx/desktop-protocol 0.21.29 → 0.21.31
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 +12 -0
- package/dist/client.cjs +1538 -768
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.cts +7 -2
- package/dist/client.d.ts +7 -2
- package/dist/client.js +1538 -768
- package/dist/client.js.map +1 -1
- package/dist/index.cjs +1504 -471
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3144 -263
- package/dist/index.d.ts +3144 -263
- package/dist/index.js +1504 -471
- package/dist/index.js.map +1 -1
- package/dist/{models-BpzT2hqF.d.cts → models-C4JytZ8c.d.cts} +8152 -3380
- package/dist/{models-BpzT2hqF.d.ts → models-C4JytZ8c.d.ts} +8152 -3380
- package/dist/react.d.cts +2102 -120
- package/dist/react.d.ts +2102 -120
- package/generated/desktop-protocol.schema.json +11118 -6179
- package/package.json +2 -2
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 = 41;
|
|
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_-]+$/);
|
|
@@ -395,8 +395,17 @@ var OsPermissionName = z5.enum([
|
|
|
395
395
|
"location",
|
|
396
396
|
"local_network",
|
|
397
397
|
"bluetooth",
|
|
398
|
-
"notifications"
|
|
398
|
+
"notifications",
|
|
399
|
+
// (1.41) Matrx Local's remaining kinds, checked on every OS (its permissions checker): a peer
|
|
400
|
+
// older than 1.41 is never sent these rows (versioning.ts PERMISSIONS_SINCE).
|
|
401
|
+
"reminders",
|
|
402
|
+
"speech_recognition",
|
|
403
|
+
"messages",
|
|
404
|
+
"mail",
|
|
405
|
+
"wifi"
|
|
399
406
|
]);
|
|
407
|
+
var OsGrantState = z5.enum(["granted", "denied", "not_determined", "not_applicable"]);
|
|
408
|
+
var OsRequirementName = z5.enum(["secret_storage", "tray", "display_server", "helper_programs", "smart_app_control", "path_length"]);
|
|
400
409
|
var SysinfoGetParams = z5.strictObject({});
|
|
401
410
|
var SysinfoGetResult = z5.strictObject({
|
|
402
411
|
device_id: DeviceId,
|
|
@@ -426,9 +435,20 @@ var SysinfoGetResult = z5.strictObject({
|
|
|
426
435
|
z5.strictObject({
|
|
427
436
|
name: OsPermissionName,
|
|
428
437
|
state: z5.enum(["granted", "denied", "not_determined", "not_applicable"]),
|
|
429
|
-
settings_url: z5.string().max(512).nullable()
|
|
438
|
+
settings_url: z5.string().max(512).nullable(),
|
|
439
|
+
/** (1.41) One short fact when the state alone does not say it ("No camera", "Bluetooth is off"); absent when there is none. */
|
|
440
|
+
detail: z5.string().max(256).optional()
|
|
430
441
|
})
|
|
431
|
-
)
|
|
442
|
+
),
|
|
443
|
+
/** (1.41) The requirements beyond the grants (OsRequirementName), each read when asked. */
|
|
444
|
+
requirements: z5.array(
|
|
445
|
+
z5.strictObject({
|
|
446
|
+
name: OsRequirementName,
|
|
447
|
+
state: OsGrantState,
|
|
448
|
+
settings_url: z5.string().max(512).nullable(),
|
|
449
|
+
detail: z5.string().max(256).nullable()
|
|
450
|
+
})
|
|
451
|
+
).optional()
|
|
432
452
|
});
|
|
433
453
|
var SysinfoHardwareParams = z5.strictObject({});
|
|
434
454
|
var SysinfoHardwareResult = z5.strictObject({
|
|
@@ -975,10 +995,12 @@ var GitCloneParams = z12.strictObject({
|
|
|
975
995
|
});
|
|
976
996
|
|
|
977
997
|
// src/schema/web.ts
|
|
998
|
+
import { UUID_SHAPE_PATTERN as UUID_SHAPE_PATTERN2 } from "@ai-matrx/kit/uuid";
|
|
978
999
|
import { z as z13 } from "zod";
|
|
979
1000
|
var WEB_MAX_TEXT_CHARS = 524288;
|
|
980
1001
|
var WebUrl = z13.string().min(1).max(8192).regex(/^https?:\/\//);
|
|
981
1002
|
var WebText = z13.string().max(WEB_MAX_TEXT_CHARS);
|
|
1003
|
+
var OrgId = z13.string().regex(UUID_SHAPE_PATTERN2);
|
|
982
1004
|
var WebHeader = z13.strictObject({ name: z13.string().min(1).max(256), value: z13.string().max(8192) });
|
|
983
1005
|
var WebFetchParams = z13.strictObject({
|
|
984
1006
|
url: WebUrl,
|
|
@@ -1000,10 +1022,65 @@ var WebFetchResult = z13.strictObject({
|
|
|
1000
1022
|
bytes: nonNegInt,
|
|
1001
1023
|
elapsed_ms: nonNegInt
|
|
1002
1024
|
});
|
|
1025
|
+
var WebAttachTarget = z13.strictObject({
|
|
1026
|
+
entity_type: z13.string().min(1).max(64),
|
|
1027
|
+
entity_id: z13.string().min(1).max(128),
|
|
1028
|
+
label: z13.string().max(200).optional()
|
|
1029
|
+
});
|
|
1030
|
+
var WebLand = z13.strictObject({
|
|
1031
|
+
/** The organization the page is saved in; absent: this computer's active organization. */
|
|
1032
|
+
organization_id: OrgId.optional(),
|
|
1033
|
+
/** Keep it: AI processing starts (chunks, search). Unkept pages are saved and wait. */
|
|
1034
|
+
keep: z13.boolean().default(false),
|
|
1035
|
+
attach_to: z13.array(WebAttachTarget).max(8).default([])
|
|
1036
|
+
});
|
|
1037
|
+
var WebNotSavedReason = z13.enum([
|
|
1038
|
+
/** Nobody is signed in on this computer. Saved on sign-in. */
|
|
1039
|
+
"signed_out",
|
|
1040
|
+
/** AI Matrx could not be reached. Retried on its own. */
|
|
1041
|
+
"offline",
|
|
1042
|
+
/** AI Matrx refused it (the message says why). Kept until the person retries or discards it. */
|
|
1043
|
+
"rejected",
|
|
1044
|
+
/** Waiting its turn behind other pages (retried on its own). */
|
|
1045
|
+
"queued"
|
|
1046
|
+
]);
|
|
1047
|
+
var WebSourceNotice = z13.strictObject({ code: z13.string().max(120), message: z13.string().max(2e3), remedy: z13.string().max(120) });
|
|
1048
|
+
var WebSourceState = z13.discriminatedUnion("state", [
|
|
1049
|
+
z13.strictObject({
|
|
1050
|
+
state: z13.literal("saved"),
|
|
1051
|
+
processed_document_id: z13.string().min(1).max(64),
|
|
1052
|
+
source_id: z13.string().min(1).max(128),
|
|
1053
|
+
/** The page was already saved and nothing changed ("Already saved, no change"). */
|
|
1054
|
+
reused_existing: z13.boolean(),
|
|
1055
|
+
/** The page changed: this is a new version of that Source. */
|
|
1056
|
+
new_version_of: z13.string().max(64).nullable(),
|
|
1057
|
+
kept: z13.boolean(),
|
|
1058
|
+
intelligence: z13.enum(["queued", "deferred", "never"]),
|
|
1059
|
+
/** The original page as captured, kept by AI Matrx (null: the organization keeps none). */
|
|
1060
|
+
original_file_id: z13.string().max(128).nullable(),
|
|
1061
|
+
/** The organization it was saved in. */
|
|
1062
|
+
organization_id: OrgId,
|
|
1063
|
+
notices: z13.array(WebSourceNotice).max(20)
|
|
1064
|
+
}),
|
|
1065
|
+
z13.strictObject({
|
|
1066
|
+
state: z13.literal("not_saved"),
|
|
1067
|
+
outbox_id: z13.string().min(1).max(64),
|
|
1068
|
+
reason: WebNotSavedReason,
|
|
1069
|
+
message: z13.string().max(2e3)
|
|
1070
|
+
})
|
|
1071
|
+
]);
|
|
1003
1072
|
var WebScrapeParams = z13.strictObject({
|
|
1004
1073
|
urls: z13.array(WebUrl).min(1).max(20),
|
|
1005
1074
|
use_cache: z13.boolean().default(true),
|
|
1006
|
-
get_links: z13.boolean().default(false)
|
|
1075
|
+
get_links: z13.boolean().default(false),
|
|
1076
|
+
/**
|
|
1077
|
+
* Since 1.38. `auto` (absent): this computer's scraper (HTTP, its browser only when a page needs
|
|
1078
|
+
* it). `browser`: this computer's own browser renders every page. `server`: AI Matrx's servers
|
|
1079
|
+
* read it (their connection, not this computer's; saved there as a web capture).
|
|
1080
|
+
*/
|
|
1081
|
+
engine: z13.enum(["auto", "browser", "server"]).optional(),
|
|
1082
|
+
/** Since 1.38: where the pages are saved (see WebLand). */
|
|
1083
|
+
land: WebLand.optional()
|
|
1007
1084
|
});
|
|
1008
1085
|
var WebScrapePage = z13.strictObject({
|
|
1009
1086
|
url: z13.string(),
|
|
@@ -1018,7 +1095,9 @@ var WebScrapePage = z13.strictObject({
|
|
|
1018
1095
|
/** Why the page failed (blocked, timeout, not found…), in the scraper's words; null when ok. */
|
|
1019
1096
|
error: z13.string().nullable(),
|
|
1020
1097
|
/** How the page was fetched (http, browser, cache). */
|
|
1021
|
-
via: z13.string().nullable()
|
|
1098
|
+
via: z13.string().nullable(),
|
|
1099
|
+
/** Since 1.38: the page's Source (absent from a 1.37 core, and for a page that failed). */
|
|
1100
|
+
source: WebSourceState.optional()
|
|
1022
1101
|
});
|
|
1023
1102
|
var WebScrapeResult = z13.strictObject({ pages: z13.array(WebScrapePage), elapsed_ms: nonNegInt });
|
|
1024
1103
|
var WebSearchParams = z13.strictObject({
|
|
@@ -1042,7 +1121,9 @@ var WebBrowserFetchParams = z13.strictObject({
|
|
|
1042
1121
|
wait_for: z13.string().max(1024).optional(),
|
|
1043
1122
|
wait_timeout_ms: z13.int().min(100).max(12e4).default(3e4),
|
|
1044
1123
|
/** true: readable text; false: the rendered HTML. */
|
|
1045
|
-
extract_text: z13.boolean().default(true)
|
|
1124
|
+
extract_text: z13.boolean().default(true),
|
|
1125
|
+
/** Since 1.38: where the rendered page is saved (see WebLand). */
|
|
1126
|
+
land: WebLand.optional()
|
|
1046
1127
|
});
|
|
1047
1128
|
var WebBrowserFetchResult = z13.strictObject({
|
|
1048
1129
|
url: z13.string(),
|
|
@@ -1050,14 +1131,144 @@ var WebBrowserFetchResult = z13.strictObject({
|
|
|
1050
1131
|
title: z13.string().nullable(),
|
|
1051
1132
|
content: WebText,
|
|
1052
1133
|
truncated: z13.boolean(),
|
|
1053
|
-
elapsed_ms: nonNegInt
|
|
1134
|
+
elapsed_ms: nonNegInt,
|
|
1135
|
+
/** Since 1.38: the rendered page's Source (absent from a 1.37 core). */
|
|
1136
|
+
source: WebSourceState.optional()
|
|
1137
|
+
});
|
|
1138
|
+
var ToolsParseFile = z13.strictObject({
|
|
1139
|
+
/** Absolute path of the gzipped JSON the core reads, saves and then removes. */
|
|
1140
|
+
path: z13.string().min(1).max(4096),
|
|
1141
|
+
bytes: nonNegInt
|
|
1142
|
+
});
|
|
1143
|
+
var ToolsWebScrapeParams = z13.strictObject({
|
|
1144
|
+
urls: z13.array(WebUrl).min(1).max(20),
|
|
1145
|
+
use_cache: z13.boolean().default(true),
|
|
1146
|
+
get_links: z13.boolean().default(false),
|
|
1147
|
+
/** `browser`: render every page in this computer's browser, then parse it. */
|
|
1148
|
+
engine: z13.enum(["auto", "browser"]).default("auto"),
|
|
1149
|
+
/** Pages read at once (desktop.web/scrape_concurrency). */
|
|
1150
|
+
concurrency: z13.int().min(1).max(20).default(5),
|
|
1151
|
+
/** The wait between pages from the same site (desktop.web/request_delay_ms). */
|
|
1152
|
+
delay_ms: z13.int().min(0).max(3e4).default(0),
|
|
1153
|
+
/** Where the parse files go (the core's spool folder). */
|
|
1154
|
+
spool_dir: z13.string().min(1).max(4096)
|
|
1155
|
+
});
|
|
1156
|
+
var ToolsWebScrapePage = z13.strictObject({
|
|
1157
|
+
page: WebScrapePage,
|
|
1158
|
+
/** The page's whole parse, for the door; null when the page failed or had no words. */
|
|
1159
|
+
parse: ToolsParseFile.nullable(),
|
|
1160
|
+
/** The page as fetched, for research (rendered HTML or the HTTP body); null when not kept. */
|
|
1161
|
+
html: ToolsParseFile.nullable()
|
|
1162
|
+
});
|
|
1163
|
+
var ToolsWebScrapeResult = z13.strictObject({ pages: z13.array(ToolsWebScrapePage), elapsed_ms: nonNegInt });
|
|
1164
|
+
var ToolsWebBrowserFetchParams = z13.strictObject({
|
|
1165
|
+
url: WebUrl,
|
|
1166
|
+
wait_for: z13.string().max(1024).optional(),
|
|
1167
|
+
wait_timeout_ms: z13.int().min(100).max(12e4).default(3e4),
|
|
1168
|
+
extract_text: z13.boolean().default(true),
|
|
1169
|
+
spool_dir: z13.string().min(1).max(4096)
|
|
1170
|
+
});
|
|
1171
|
+
var ToolsWebBrowserFetchResult = z13.strictObject({ result: WebBrowserFetchResult, parse: ToolsParseFile.nullable() });
|
|
1172
|
+
var WebRuntimeStateName = z13.enum(["not_installed", "installing", "installed", "failed"]);
|
|
1173
|
+
var WebRuntimeParams = z13.strictObject({});
|
|
1174
|
+
var WebRuntimeState = z13.strictObject({
|
|
1175
|
+
state: WebRuntimeStateName,
|
|
1176
|
+
/** Why it failed, in the installer's words; null otherwise. */
|
|
1177
|
+
error: z13.string().max(2e3).nullable(),
|
|
1178
|
+
/** Bytes the browser takes on this computer (its packages and Chromium); null when unknown. */
|
|
1179
|
+
size_bytes: nonNegInt.nullable(),
|
|
1180
|
+
/** Whether it can show a window while it works (false: only the headless shell is installed). */
|
|
1181
|
+
can_show_window: z13.boolean()
|
|
1182
|
+
});
|
|
1183
|
+
var WebOutboxItem = z13.strictObject({
|
|
1184
|
+
outbox_id: z13.string().min(1).max(64),
|
|
1185
|
+
url: z13.string().max(8192),
|
|
1186
|
+
title: z13.string().max(500).nullable(),
|
|
1187
|
+
organization_id: OrgId.nullable(),
|
|
1188
|
+
reason: WebNotSavedReason,
|
|
1189
|
+
message: z13.string().max(2e3),
|
|
1190
|
+
attempts: nonNegInt,
|
|
1191
|
+
created_at_ms: nonNegInt,
|
|
1192
|
+
last_attempt_at_ms: nonNegInt.nullable(),
|
|
1193
|
+
bytes: nonNegInt
|
|
1194
|
+
});
|
|
1195
|
+
var WebOutboxListParams = z13.strictObject({});
|
|
1196
|
+
var WebOutboxListResult = z13.strictObject({
|
|
1197
|
+
items: z13.array(WebOutboxItem),
|
|
1198
|
+
bytes: nonNegInt,
|
|
1199
|
+
/** The most the outbox holds; past it the oldest pages are dropped (and the log says so). */
|
|
1200
|
+
cap_bytes: nonNegInt
|
|
1201
|
+
});
|
|
1202
|
+
var WebOutboxRetryParams = z13.strictObject({ outbox_id: z13.string().min(1).max(64).optional() });
|
|
1203
|
+
var WebOutboxRetryResult = z13.strictObject({ saved: nonNegInt, waiting: nonNegInt });
|
|
1204
|
+
var WebOutboxDiscardParams = z13.strictObject({ outbox_id: z13.string().min(1).max(64) });
|
|
1205
|
+
var WebOutboxDiscardResult = z13.strictObject({ discarded: z13.boolean() });
|
|
1206
|
+
var WebLogVia = z13.enum(["this_computer", "browser", "server"]);
|
|
1207
|
+
var WebLogCaller = z13.enum(["person", "agent", "research", "phone", "other"]);
|
|
1208
|
+
var WebLogResult = z13.enum(["saved", "not_saved", "failed", "blocked", "read"]);
|
|
1209
|
+
var WebLogEntry = z13.strictObject({
|
|
1210
|
+
id: z13.string().min(1).max(64),
|
|
1211
|
+
at_ms: nonNegInt,
|
|
1212
|
+
caller: WebLogCaller,
|
|
1213
|
+
url: z13.string().max(8192),
|
|
1214
|
+
title: z13.string().max(500).nullable(),
|
|
1215
|
+
result: WebLogResult,
|
|
1216
|
+
/** One sentence: why it failed or was blocked, or the save's notice. Never page text. */
|
|
1217
|
+
detail: z13.string().max(1e3).nullable(),
|
|
1218
|
+
via: WebLogVia,
|
|
1219
|
+
duration_ms: nonNegInt,
|
|
1220
|
+
processed_document_id: z13.string().max(64).nullable()
|
|
1221
|
+
});
|
|
1222
|
+
var WebLogListParams = z13.strictObject({ since_ms: nonNegInt.optional(), limit: z13.int().min(1).max(1e3).default(200) });
|
|
1223
|
+
var WebLogListResult = z13.strictObject({ entries: z13.array(WebLogEntry) });
|
|
1224
|
+
var WebLogClearParams = z13.strictObject({});
|
|
1225
|
+
var WebLogClearResult = z13.strictObject({ cleared: nonNegInt });
|
|
1226
|
+
var WebProgressEvent = z13.strictObject({
|
|
1227
|
+
request_id: RequestId,
|
|
1228
|
+
phase: z13.enum(["installing", "fetching", "saving"]),
|
|
1229
|
+
done: nonNegInt,
|
|
1230
|
+
total: nonNegInt
|
|
1231
|
+
});
|
|
1232
|
+
var WebResearchItemState = z13.enum(["waiting", "fetching", "saved", "thin", "failed", "cannot_edit", "blocked"]);
|
|
1233
|
+
var WebResearchItem = z13.strictObject({
|
|
1234
|
+
topic_id: z13.string().min(1).max(64),
|
|
1235
|
+
topic_name: z13.string().max(500),
|
|
1236
|
+
source_id: z13.string().min(1).max(64),
|
|
1237
|
+
url: z13.string().max(8192),
|
|
1238
|
+
title: z13.string().max(500).nullable(),
|
|
1239
|
+
/** The capture level this computer would try (1 quick, 2 scroll); 3+ is the extension's. */
|
|
1240
|
+
level: z13.int().min(1).max(4),
|
|
1241
|
+
last_failure: z13.string().max(1e3).nullable(),
|
|
1242
|
+
state: WebResearchItemState,
|
|
1243
|
+
/** One sentence after a fetch: what happened. */
|
|
1244
|
+
message: z13.string().max(1e3).nullable()
|
|
1245
|
+
});
|
|
1246
|
+
var WebResearchQueueParams = z13.strictObject({ topic_id: z13.string().min(1).max(64).optional() });
|
|
1247
|
+
var WebResearchQueueResult = z13.strictObject({
|
|
1248
|
+
state: z13.enum(["ready", "signed_out", "unavailable"]),
|
|
1249
|
+
problem: z13.string().max(1e3).nullable(),
|
|
1250
|
+
/** L1/L2 items on topics this person can edit: what this computer can fetch. */
|
|
1251
|
+
items: z13.array(WebResearchItem),
|
|
1252
|
+
/** Items on topics the person can view but not add to (shown, never fetched). */
|
|
1253
|
+
view_only: nonNegInt
|
|
1254
|
+
});
|
|
1255
|
+
var WebResearchFetchParams = z13.strictObject({
|
|
1256
|
+
topic_id: z13.string().min(1).max(64).optional(),
|
|
1257
|
+
source_ids: z13.array(z13.string().min(1).max(64)).max(200).optional()
|
|
1258
|
+
});
|
|
1259
|
+
var WebResearchFetchResult = z13.strictObject({
|
|
1260
|
+
items: z13.array(WebResearchItem),
|
|
1261
|
+
saved: nonNegInt,
|
|
1262
|
+
thin: nonNegInt,
|
|
1263
|
+
failed: nonNegInt,
|
|
1264
|
+
cannot_edit: nonNegInt
|
|
1054
1265
|
});
|
|
1055
1266
|
var ToolsServiceProgress = z13.strictObject({ phase: z13.enum(["fetching", "installing"]), done: nonNegInt, total: nonNegInt });
|
|
1056
1267
|
|
|
1057
1268
|
// src/schema/account.ts
|
|
1058
1269
|
import { z as z14 } from "zod";
|
|
1059
|
-
import { UUID_SHAPE_PATTERN as
|
|
1060
|
-
var AccountRowId = z14.string().regex(
|
|
1270
|
+
import { UUID_SHAPE_PATTERN as UUID_SHAPE_PATTERN3 } from "@ai-matrx/kit/uuid";
|
|
1271
|
+
var AccountRowId = z14.string().regex(UUID_SHAPE_PATTERN3);
|
|
1061
1272
|
var AccountReadState = z14.enum(["ok", "signed_out", "unavailable"]);
|
|
1062
1273
|
var AccountAgent = z14.strictObject({
|
|
1063
1274
|
id: AccountRowId,
|
|
@@ -1074,7 +1285,22 @@ var AccountAgent = z14.strictObject({
|
|
|
1074
1285
|
shared_by: z14.string().max(320).nullable(),
|
|
1075
1286
|
/** The organization it belongs to. */
|
|
1076
1287
|
organization: z14.string().max(200).nullable(),
|
|
1077
|
-
updated_at_ms: epochMs
|
|
1288
|
+
updated_at_ms: epochMs,
|
|
1289
|
+
// 1.39: the catalogue's own row (agx_get_list_full, read whole through @ai-matrx/agents/catalog).
|
|
1290
|
+
/** The agent's tags (the library's search and its inspector). */
|
|
1291
|
+
tags: z14.array(z14.string().max(120)).max(50).optional(),
|
|
1292
|
+
/** The model it runs (a model catalogue id); absent when it names none. */
|
|
1293
|
+
model_id: AccountRowId.optional(),
|
|
1294
|
+
/** The person's access: owner, admin, editor, viewer or system (the database's own words); absent when unknown. */
|
|
1295
|
+
access_level: z14.string().min(1).max(40).optional(),
|
|
1296
|
+
/** The organization's id (the label is `organization`); absent when it has none. */
|
|
1297
|
+
organization_id: AccountRowId.optional(),
|
|
1298
|
+
/** Whose it is: the person's own, shared with them, or one AI Matrx ships (Gallery). */
|
|
1299
|
+
origin: z14.enum(["mine", "shared", "system"]).optional(),
|
|
1300
|
+
/** Archived (the catalogue's archive filter decides whether the library lists it). */
|
|
1301
|
+
is_archived: z14.boolean().optional(),
|
|
1302
|
+
/** An orchestra: it conducts other agents. */
|
|
1303
|
+
orchestra: z14.boolean().optional()
|
|
1078
1304
|
});
|
|
1079
1305
|
var AccountAgentsListParams = z14.strictObject({});
|
|
1080
1306
|
var AccountAgentsListResult = z14.strictObject({
|
|
@@ -1083,6 +1309,70 @@ var AccountAgentsListResult = z14.strictObject({
|
|
|
1083
1309
|
problem: z14.string().max(300).nullable(),
|
|
1084
1310
|
agents: z14.array(AccountAgent).max(2e3)
|
|
1085
1311
|
});
|
|
1312
|
+
var AccountAgentVariable = z14.strictObject({
|
|
1313
|
+
name: z14.string().min(1).max(200),
|
|
1314
|
+
/** The default value as text ("" when it has none). */
|
|
1315
|
+
default_value: z14.string().max(4e3),
|
|
1316
|
+
required: z14.boolean(),
|
|
1317
|
+
help: z14.string().max(1e3)
|
|
1318
|
+
});
|
|
1319
|
+
var AccountAgentDetail = z14.strictObject({
|
|
1320
|
+
agent: AccountAgent,
|
|
1321
|
+
/** The inputs a run asks for (the agent's variables). */
|
|
1322
|
+
variables: z14.array(AccountAgentVariable).max(100),
|
|
1323
|
+
/** How many tools, custom tools, skills and connections it may use. */
|
|
1324
|
+
tool_count: z14.int().min(0),
|
|
1325
|
+
custom_tool_count: z14.int().min(0),
|
|
1326
|
+
skill_count: z14.int().min(0),
|
|
1327
|
+
connection_count: z14.int().min(0),
|
|
1328
|
+
/** The model's display name when the catalogue knows it. */
|
|
1329
|
+
model_name: z14.string().max(200).nullable()
|
|
1330
|
+
});
|
|
1331
|
+
var AccountAgentsGetParams = z14.strictObject({ agent_id: AccountRowId });
|
|
1332
|
+
var AccountAgentsGetResult = z14.strictObject({
|
|
1333
|
+
state: AccountReadState,
|
|
1334
|
+
problem: z14.string().max(300).nullable(),
|
|
1335
|
+
/** Null when the person cannot open it (not theirs, not shared with them, or gone). */
|
|
1336
|
+
detail: AccountAgentDetail.nullable()
|
|
1337
|
+
});
|
|
1338
|
+
var AccountAgentRunStatus = z14.enum(["succeeded", "warned", "failed", "stopped", "waiting", "running"]);
|
|
1339
|
+
var AccountAgentRun = z14.strictObject({
|
|
1340
|
+
run_id: AccountRowId,
|
|
1341
|
+
status: AccountAgentRunStatus,
|
|
1342
|
+
started_at_ms: epochMs,
|
|
1343
|
+
completed_at_ms: epochMs.nullable(),
|
|
1344
|
+
duration_ms: z14.int().min(0).nullable(),
|
|
1345
|
+
cost: z14.number().min(0).nullable(),
|
|
1346
|
+
tokens: z14.int().min(0).nullable(),
|
|
1347
|
+
/** One line of the answer (at most 240 characters), when the run kept one. */
|
|
1348
|
+
output_preview: z14.string().max(240).nullable(),
|
|
1349
|
+
/** The run's error, one line. */
|
|
1350
|
+
error: z14.string().max(300).nullable(),
|
|
1351
|
+
/** The mandate it served, when one named it. */
|
|
1352
|
+
mandate_key: z14.string().max(200).nullable(),
|
|
1353
|
+
organization: z14.string().max(200).nullable(),
|
|
1354
|
+
/** The conversation that holds its transcript, when it kept one. */
|
|
1355
|
+
conversation_id: AccountRowId.nullable(),
|
|
1356
|
+
has_transcript: z14.boolean()
|
|
1357
|
+
});
|
|
1358
|
+
var AccountAgentRunSort = z14.enum(["started_at", "duration", "cost", "status"]);
|
|
1359
|
+
var AccountAgentsRunsParams = z14.strictObject({
|
|
1360
|
+
agent_id: AccountRowId,
|
|
1361
|
+
status: AccountAgentRunStatus.optional(),
|
|
1362
|
+
sort: AccountAgentRunSort.optional(),
|
|
1363
|
+
descending: z14.boolean().optional(),
|
|
1364
|
+
offset: z14.int().min(0).max(1e5).optional(),
|
|
1365
|
+
limit: z14.int().min(1).max(100).optional()
|
|
1366
|
+
});
|
|
1367
|
+
var AccountAgentsRunsResult = z14.strictObject({
|
|
1368
|
+
state: AccountReadState,
|
|
1369
|
+
problem: z14.string().max(300).nullable(),
|
|
1370
|
+
/** Every run of this agent the person may see (rows is one page of it). */
|
|
1371
|
+
total: z14.int().min(0),
|
|
1372
|
+
rows: z14.array(AccountAgentRun).max(100)
|
|
1373
|
+
});
|
|
1374
|
+
var AccountAgentsFavoriteParams = z14.strictObject({ agent_id: AccountRowId, favorite: z14.boolean() });
|
|
1375
|
+
var AccountAgentsFavoriteResult = z14.strictObject({ favorite: z14.boolean() });
|
|
1086
1376
|
var VaultItemKind = z14.enum(["login", "passkey", "key", "other"]);
|
|
1087
1377
|
var VaultFieldSummary = z14.strictObject({
|
|
1088
1378
|
key: z14.string().min(1).max(120),
|
|
@@ -1212,7 +1502,27 @@ var SystemSettingsPane = z16.enum([
|
|
|
1212
1502
|
"storage",
|
|
1213
1503
|
"system_report",
|
|
1214
1504
|
/** (1.35) Privacy & Security › Microphone: where the person allows Matrx 2 the microphone. */
|
|
1215
|
-
"microphone"
|
|
1505
|
+
"microphone",
|
|
1506
|
+
// (1.41) Each other privacy grant's own page (Settings › Permissions and privacy's buttons), named
|
|
1507
|
+
// as sysinfo's OsPermissionName so a row opens its pane by its own name. A 1.40 core refuses these
|
|
1508
|
+
// as INVALID_PARAMS, so a client asks only a 1.41 core for them.
|
|
1509
|
+
"full_disk_access",
|
|
1510
|
+
"accessibility",
|
|
1511
|
+
"screen_recording",
|
|
1512
|
+
"camera",
|
|
1513
|
+
"automation",
|
|
1514
|
+
"contacts",
|
|
1515
|
+
"calendars",
|
|
1516
|
+
"reminders",
|
|
1517
|
+
"photos",
|
|
1518
|
+
"location",
|
|
1519
|
+
"local_network",
|
|
1520
|
+
"bluetooth",
|
|
1521
|
+
"wifi",
|
|
1522
|
+
"notifications",
|
|
1523
|
+
"speech_recognition",
|
|
1524
|
+
"messages",
|
|
1525
|
+
"mail"
|
|
1216
1526
|
]);
|
|
1217
1527
|
var SystemOpenSettingsParams = z16.strictObject({ pane: SystemSettingsPane });
|
|
1218
1528
|
var SystemOpenSettingsResult = z16.strictObject({ pane: SystemSettingsPane });
|
|
@@ -1918,10 +2228,10 @@ var ExecJobListResult = z26.strictObject({ jobs: z26.array(ExecJobInfo).max(64)
|
|
|
1918
2228
|
|
|
1919
2229
|
// src/schema/coding.ts
|
|
1920
2230
|
import { z as z27 } from "zod";
|
|
1921
|
-
import { UUID_SHAPE_PATTERN as
|
|
2231
|
+
import { UUID_SHAPE_PATTERN as UUID_SHAPE_PATTERN4 } from "@ai-matrx/kit/uuid";
|
|
1922
2232
|
var CodingServiceCredentials = z27.strictObject({
|
|
1923
2233
|
access_token: z27.string().min(16).max(16384),
|
|
1924
|
-
user_id: z27.string().regex(
|
|
2234
|
+
user_id: z27.string().regex(UUID_SHAPE_PATTERN4),
|
|
1925
2235
|
/** The AI Matrx server this app talks to (production, or a local server on the nightly copy). */
|
|
1926
2236
|
server_url: z27.string().min(1).max(2048).regex(/^https?:\/\/[^\s/?#]+(\/[^\s?#]*)?$/)
|
|
1927
2237
|
});
|
|
@@ -1992,24 +2302,389 @@ var CodingHistoryProgressEvent = z27.strictObject({
|
|
|
1992
2302
|
failed: nonNegInt
|
|
1993
2303
|
});
|
|
1994
2304
|
|
|
1995
|
-
// src/schema/
|
|
2305
|
+
// src/schema/coding-sessions.ts
|
|
1996
2306
|
import { z as z28 } from "zod";
|
|
1997
|
-
|
|
1998
|
-
var
|
|
1999
|
-
var
|
|
2000
|
-
var
|
|
2001
|
-
var
|
|
2002
|
-
var
|
|
2307
|
+
var CodingProviderName = z28.enum(["claude", "codex"]);
|
|
2308
|
+
var CodingRunStatus = z28.enum(["starting", "running", "completed", "stopped", "failed"]);
|
|
2309
|
+
var SessionKey = z28.string().regex(/^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/);
|
|
2310
|
+
var IsoTime = z28.string().min(10).max(40);
|
|
2311
|
+
var LocalPath = z28.string().min(1).max(4096);
|
|
2312
|
+
var CodingClientRequestId = z28.string().regex(/^[A-Za-z0-9_-]{8,64}$/);
|
|
2313
|
+
var ShortText = z28.string().max(500);
|
|
2314
|
+
var CodingRunUsage = z28.strictObject({
|
|
2315
|
+
inputTokens: nonNegInt,
|
|
2316
|
+
outputTokens: nonNegInt,
|
|
2317
|
+
cachedInputTokens: nonNegInt
|
|
2318
|
+
});
|
|
2319
|
+
var CodingStartedBy = z28.strictObject({
|
|
2320
|
+
kind: z28.enum(["this_computer", "web", "phone", "agent", "other"]),
|
|
2321
|
+
label: z28.string().min(1).max(80)
|
|
2322
|
+
});
|
|
2323
|
+
var CodingRunRecord = z28.strictObject({
|
|
2324
|
+
runId: z28.string().min(1).max(64),
|
|
2325
|
+
sessionId: SessionKey,
|
|
2326
|
+
provider: CodingProviderName,
|
|
2327
|
+
cwd: LocalPath,
|
|
2328
|
+
prompt: z28.string().max(1048576),
|
|
2329
|
+
model: z28.string().max(200).nullable(),
|
|
2330
|
+
status: CodingRunStatus,
|
|
2331
|
+
startedAt: IsoTime,
|
|
2332
|
+
endedAt: IsoTime.nullable(),
|
|
2333
|
+
error: z28.string().max(65536).nullable(),
|
|
2334
|
+
usage: CodingRunUsage.nullable(),
|
|
2335
|
+
costUsd: z28.number().nullable(),
|
|
2336
|
+
billing: z28.enum(["subscription", "api", "unknown"]).nullable(),
|
|
2337
|
+
startedBy: CodingStartedBy.nullable()
|
|
2338
|
+
});
|
|
2339
|
+
var CodingSessionAgentPart = z28.strictObject({
|
|
2340
|
+
part: z28.enum(["instructions", "skills", "tools"]),
|
|
2341
|
+
loaded: nonNegInt,
|
|
2342
|
+
total: nonNegInt
|
|
2343
|
+
});
|
|
2344
|
+
var CodingSessionAgent = z28.strictObject({
|
|
2345
|
+
agentId: z28.string().min(1).max(64),
|
|
2346
|
+
versionId: z28.string().max(64).nullable(),
|
|
2347
|
+
versionNumber: nonNegInt.nullable(),
|
|
2348
|
+
name: z28.string().max(300),
|
|
2349
|
+
definitionHash: z28.string().max(200),
|
|
2350
|
+
loaded: z28.array(CodingSessionAgentPart).max(3),
|
|
2351
|
+
unavailable: z28.array(z28.strictObject({ kind: z28.string().max(60), name: z28.string().max(300), reason: ShortText })).max(500),
|
|
2352
|
+
skills: z28.array(z28.string().max(300)).max(500),
|
|
2353
|
+
tools: z28.array(z28.string().max(300)).max(500),
|
|
2354
|
+
variables: z28.record(z28.string().max(200), z28.unknown()),
|
|
2355
|
+
blockDue: z28.boolean(),
|
|
2356
|
+
deliveredAt: IsoTime.nullable(),
|
|
2357
|
+
replaces: z28.string().max(300).nullable()
|
|
2358
|
+
});
|
|
2359
|
+
var CodingSessionRecord = z28.strictObject({
|
|
2360
|
+
id: SessionKey,
|
|
2361
|
+
provider: CodingProviderName,
|
|
2362
|
+
providerSessionId: SessionKey.nullable(),
|
|
2363
|
+
cwd: LocalPath,
|
|
2364
|
+
title: z28.string().max(500),
|
|
2365
|
+
model: z28.string().max(200).nullable(),
|
|
2366
|
+
effort: z28.string().max(40).nullable(),
|
|
2367
|
+
origin: z28.enum(["started", "takeover"]),
|
|
2368
|
+
createdAt: IsoTime,
|
|
2369
|
+
updatedAt: IsoTime,
|
|
2370
|
+
lastRunId: z28.string().max(64).nullable(),
|
|
2371
|
+
lastRunStatus: CodingRunStatus.nullable(),
|
|
2372
|
+
queued: z28.array(z28.string().max(1048576)).max(100),
|
|
2373
|
+
agent: CodingSessionAgent.nullable(),
|
|
2374
|
+
agentRemovedDue: z28.boolean()
|
|
2375
|
+
});
|
|
2376
|
+
var CodingActiveElsewhere = z28.strictObject({
|
|
2377
|
+
reason: z28.enum(["process", "recent-write", "open-tool-call", "open"]),
|
|
2378
|
+
message: ShortText,
|
|
2379
|
+
/** The process driving it, when the evidence is a process (re-checked before any stop). */
|
|
2380
|
+
pid: z28.int().min(1).nullable()
|
|
2381
|
+
});
|
|
2382
|
+
var CodingTitleSource = z28.enum(["app", "app-remembered", "custom-title", "ai-title", "agent-name", "summary", "first-prompt", "last-prompt", "unknown"]);
|
|
2383
|
+
var CodingDiscoveredChat = z28.strictObject({
|
|
2384
|
+
provider: CodingProviderName,
|
|
2385
|
+
providerSessionId: SessionKey,
|
|
2386
|
+
cwd: LocalPath.nullable(),
|
|
2387
|
+
title: z28.string().max(500),
|
|
2388
|
+
titleSource: CodingTitleSource.optional(),
|
|
2389
|
+
titlePending: z28.boolean().optional(),
|
|
2390
|
+
archived: z28.boolean().optional(),
|
|
2391
|
+
scheduled: z28.boolean().optional(),
|
|
2392
|
+
unlisted: z28.boolean().optional(),
|
|
2393
|
+
unavailable: ShortText.nullable(),
|
|
2394
|
+
updatedAt: IsoTime,
|
|
2395
|
+
source: z28.string().max(60).nullable(),
|
|
2396
|
+
activeElsewhere: CodingActiveElsewhere.nullable()
|
|
2397
|
+
});
|
|
2398
|
+
var CodingTranscriptItem = z28.discriminatedUnion("kind", [
|
|
2399
|
+
z28.strictObject({ kind: z28.literal("user"), id: z28.string().max(200), text: z28.string(), at: IsoTime.nullable() }),
|
|
2400
|
+
z28.strictObject({ kind: z28.literal("text"), id: z28.string().max(200), text: z28.string() }),
|
|
2401
|
+
z28.strictObject({ kind: z28.literal("text-delta"), id: z28.string().max(200), text: z28.string() }),
|
|
2402
|
+
z28.strictObject({ kind: z28.literal("reasoning"), id: z28.string().max(200), text: z28.string() }),
|
|
2403
|
+
z28.strictObject({ kind: z28.literal("tool-call"), id: z28.string().max(200), name: z28.string().max(300), input: z28.unknown() }),
|
|
2404
|
+
z28.strictObject({
|
|
2405
|
+
kind: z28.literal("tool-result"),
|
|
2406
|
+
id: z28.string().max(200),
|
|
2407
|
+
output: z28.string(),
|
|
2408
|
+
isError: z28.boolean(),
|
|
2409
|
+
/** The output's full size when only its start is here; `coding.item.full` reads the rest. */
|
|
2410
|
+
fullBytes: nonNegInt.optional()
|
|
2411
|
+
}),
|
|
2412
|
+
z28.strictObject({ kind: z28.literal("usage"), usage: CodingRunUsage, costUsd: z28.number().nullable() }),
|
|
2413
|
+
z28.strictObject({ kind: z28.literal("notice"), id: z28.string().max(200), level: z28.enum(["info", "warning"]), text: z28.string() }),
|
|
2414
|
+
z28.strictObject({ kind: z28.literal("error"), id: z28.string().max(200), text: z28.string() })
|
|
2415
|
+
]);
|
|
2416
|
+
var CodingHistoryRecord = z28.strictObject({
|
|
2417
|
+
items: z28.array(CodingTranscriptItem),
|
|
2418
|
+
/** Only the end of the chat is here; "Show earlier" reads more (a bigger `max_bytes`). */
|
|
2419
|
+
truncated: z28.boolean(),
|
|
2420
|
+
unavailable: ShortText.nullable(),
|
|
2421
|
+
/** The last live item `seq` this read already contains; a watch applies only newer ones. */
|
|
2422
|
+
seq: nonNegInt
|
|
2423
|
+
});
|
|
2424
|
+
var CodingQuotaWindow = z28.strictObject({
|
|
2425
|
+
label: z28.string().max(120),
|
|
2426
|
+
usedPercent: z28.number().nullable(),
|
|
2427
|
+
resetsAt: z28.string().max(80).nullable(),
|
|
2428
|
+
valueLabel: z28.string().max(120).nullable()
|
|
2429
|
+
});
|
|
2430
|
+
var CodingProviderProblem = z28.strictObject({
|
|
2431
|
+
kind: z28.enum(["usage-limit", "signed-out"]),
|
|
2432
|
+
message: z28.string().max(2e3),
|
|
2433
|
+
until: z28.string().max(120).nullable(),
|
|
2434
|
+
at: IsoTime
|
|
2435
|
+
});
|
|
2436
|
+
var CodingProviderBinary = z28.strictObject({
|
|
2437
|
+
path: LocalPath,
|
|
2438
|
+
version: z28.string().max(80).nullable(),
|
|
2439
|
+
source: z28.enum(["desktop-app", "path", "npm-global", "configured"]),
|
|
2440
|
+
sourceLabel: z28.string().max(120),
|
|
2441
|
+
newer: z28.strictObject({ path: LocalPath, version: z28.string().max(80), sourceLabel: z28.string().max(120) }).nullable()
|
|
2442
|
+
});
|
|
2443
|
+
var CodingProviderStatus = z28.strictObject({
|
|
2444
|
+
provider: CodingProviderName,
|
|
2445
|
+
label: z28.string().max(60),
|
|
2446
|
+
installed: z28.boolean(),
|
|
2447
|
+
version: z28.string().max(80).nullable(),
|
|
2448
|
+
loggedIn: z28.boolean(),
|
|
2449
|
+
billing: z28.enum(["subscription", "api", "unknown"]),
|
|
2450
|
+
plan: z28.string().max(80).nullable(),
|
|
2451
|
+
account: z28.string().max(320).nullable(),
|
|
2452
|
+
problem: ShortText.nullable(),
|
|
2453
|
+
fix: ShortText.nullable(),
|
|
2454
|
+
ready: z28.boolean(),
|
|
2455
|
+
lastProblem: CodingProviderProblem.nullable(),
|
|
2456
|
+
quota: z28.array(CodingQuotaWindow).max(20),
|
|
2457
|
+
models: z28.array(z28.strictObject({ id: z28.string().max(200), label: z28.string().max(200) })).max(200),
|
|
2458
|
+
efforts: z28.array(z28.string().max(40)).max(20),
|
|
2459
|
+
defaultModel: z28.strictObject({ id: z28.string().max(200), source: z28.enum(["settings", "driver"]) }).nullable(),
|
|
2460
|
+
defaultEffort: z28.string().max(40).nullable(),
|
|
2461
|
+
binary: CodingProviderBinary.nullable()
|
|
2462
|
+
});
|
|
2463
|
+
var CodingChatPreference = z28.strictObject({
|
|
2464
|
+
title: z28.string().max(500).nullable(),
|
|
2465
|
+
pinned: z28.boolean(),
|
|
2466
|
+
hidden: z28.boolean(),
|
|
2467
|
+
/** When the person last had this chat open on any screen of this computer (the "New output" dot). */
|
|
2468
|
+
lastSeenAt: IsoTime.nullable(),
|
|
2469
|
+
updatedAt: IsoTime.nullable()
|
|
2470
|
+
});
|
|
2471
|
+
var CodingTitleStatus = z28.strictObject({
|
|
2472
|
+
owner: z28.boolean(),
|
|
2473
|
+
pending: z28.boolean(),
|
|
2474
|
+
problem: ShortText.nullable(),
|
|
2475
|
+
renames: ShortText.nullable()
|
|
2476
|
+
});
|
|
2477
|
+
var CodingRecentRow = z28.strictObject({
|
|
2478
|
+
target: z28.string().min(3).max(200),
|
|
2479
|
+
title: z28.string().max(500),
|
|
2480
|
+
provider: CodingProviderName,
|
|
2481
|
+
sessionId: SessionKey.nullable(),
|
|
2482
|
+
providerSessionId: SessionKey.nullable(),
|
|
2483
|
+
cwd: LocalPath.nullable(),
|
|
2484
|
+
updatedAt: IsoTime,
|
|
2485
|
+
state: z28.enum(["running", "needs_attention", "new_output", "elsewhere", "idle"]),
|
|
2486
|
+
stateLabel: z28.string().max(120).nullable(),
|
|
2487
|
+
pinned: z28.boolean(),
|
|
2488
|
+
startedBy: CodingStartedBy.nullable()
|
|
2489
|
+
});
|
|
2490
|
+
var CodingFolderCheck = z28.strictObject({
|
|
2491
|
+
path: z28.string().max(4096),
|
|
2492
|
+
exists: z28.boolean(),
|
|
2493
|
+
isDirectory: z28.boolean()
|
|
2494
|
+
});
|
|
2495
|
+
var CodingRecentFolder = z28.strictObject({ path: LocalPath, lastUsedAt: IsoTime, exists: z28.boolean() });
|
|
2496
|
+
var CodingAgentSelectionParams = z28.strictObject({
|
|
2497
|
+
agent_id: z28.string().min(1).max(64),
|
|
2498
|
+
version_id: z28.string().min(1).max(64).optional(),
|
|
2499
|
+
variables: z28.record(z28.string().max(200), z28.unknown()).optional()
|
|
2500
|
+
});
|
|
2501
|
+
var CodingSendResult = z28.strictObject({
|
|
2502
|
+
session: CodingSessionRecord,
|
|
2503
|
+
run: CodingRunRecord.nullable(),
|
|
2504
|
+
/** The prompt waits behind a live run (it shows as a queued bubble). */
|
|
2505
|
+
queued: z28.boolean()
|
|
2506
|
+
});
|
|
2507
|
+
var CodingProvidersParams = z28.strictObject({});
|
|
2508
|
+
var CodingProvidersResult = z28.strictObject({ providers: z28.array(CodingProviderStatus).max(4) });
|
|
2509
|
+
var CodingSessionsListParams = z28.strictObject({});
|
|
2510
|
+
var CodingSessionsListResult = z28.strictObject({
|
|
2511
|
+
sessions: z28.array(CodingSessionRecord),
|
|
2512
|
+
/** The latest run of each session, by session id. */
|
|
2513
|
+
runs: z28.record(z28.string().max(128), CodingRunRecord),
|
|
2514
|
+
recent: z28.array(CodingRecentRow),
|
|
2515
|
+
title_status: CodingTitleStatus
|
|
2516
|
+
});
|
|
2517
|
+
var CodingDiscoverParams = z28.strictObject({ limit: z28.int().min(1).max(1e3).optional() });
|
|
2518
|
+
var CodingDiscoverResult = z28.strictObject({ chats: z28.array(CodingDiscoveredChat) });
|
|
2519
|
+
var CodingRunsListParams = z28.strictObject({ session_id: SessionKey });
|
|
2520
|
+
var CodingRunsListResult = z28.strictObject({ runs: z28.array(CodingRunRecord) });
|
|
2521
|
+
var CodingHistoryParams = z28.strictObject({ session_id: SessionKey, max_bytes: z28.int().min(1024).max(209715200).optional() });
|
|
2522
|
+
var CodingHistoryResult = CodingHistoryRecord;
|
|
2523
|
+
var CodingTranscriptReadParams = z28.strictObject({
|
|
2524
|
+
provider: CodingProviderName,
|
|
2525
|
+
provider_session_id: SessionKey,
|
|
2526
|
+
max_bytes: z28.int().min(1024).max(209715200).optional()
|
|
2527
|
+
});
|
|
2528
|
+
var CodingTranscriptReadResult = CodingHistoryRecord;
|
|
2529
|
+
var CodingItemFullParams = z28.strictObject({
|
|
2530
|
+
provider: CodingProviderName,
|
|
2531
|
+
provider_session_id: SessionKey,
|
|
2532
|
+
item_id: z28.string().min(1).max(200)
|
|
2533
|
+
});
|
|
2534
|
+
var CodingItemFullResult = z28.strictObject({ output: z28.string(), bytes: nonNegInt });
|
|
2535
|
+
var CodingActivityParams = z28.strictObject({ provider: CodingProviderName, provider_session_id: SessionKey });
|
|
2536
|
+
var CodingActivityResult = z28.strictObject({ active: CodingActiveElsewhere.nullable() });
|
|
2537
|
+
var CodingFoldersRecentParams = z28.strictObject({});
|
|
2538
|
+
var CodingFoldersRecentResult = z28.strictObject({ folders: z28.array(CodingRecentFolder).max(100) });
|
|
2539
|
+
var CodingFoldersCheckParams = z28.strictObject({ path: z28.string().min(1).max(4096) });
|
|
2540
|
+
var CodingFoldersCheckResult = CodingFolderCheck;
|
|
2541
|
+
var CodingFoldersCreateParams = z28.strictObject({ path: z28.string().min(1).max(4096) });
|
|
2542
|
+
var CodingFoldersCreateResult = CodingFolderCheck;
|
|
2543
|
+
var CodingStartParams = z28.strictObject({
|
|
2544
|
+
provider: CodingProviderName,
|
|
2545
|
+
cwd: z28.string().min(1).max(4096),
|
|
2546
|
+
prompt: z28.string().min(1).max(1048576),
|
|
2547
|
+
model: z28.string().min(1).max(200).optional(),
|
|
2548
|
+
effort: z28.string().min(1).max(40).optional(),
|
|
2549
|
+
agent: CodingAgentSelectionParams.optional(),
|
|
2550
|
+
/** One of the person's coding accounts on this computer (Accounts); absent = the default login. */
|
|
2551
|
+
account_profile_id: z28.string().min(1).max(64).optional(),
|
|
2552
|
+
client_request_id: CodingClientRequestId
|
|
2553
|
+
});
|
|
2554
|
+
var CodingStartResult = CodingSendResult;
|
|
2555
|
+
var CodingTakeoverParams = z28.strictObject({
|
|
2556
|
+
provider: CodingProviderName,
|
|
2557
|
+
provider_session_id: SessionKey,
|
|
2558
|
+
cwd: z28.string().min(1).max(4096),
|
|
2559
|
+
title: z28.string().max(500).optional(),
|
|
2560
|
+
agent: CodingAgentSelectionParams.optional(),
|
|
2561
|
+
confirm_elsewhere: z28.boolean().optional()
|
|
2562
|
+
});
|
|
2563
|
+
var CodingTakeoverResult = z28.strictObject({ session: CodingSessionRecord });
|
|
2564
|
+
var CodingSendParams = z28.strictObject({
|
|
2565
|
+
session_id: SessionKey,
|
|
2566
|
+
prompt: z28.string().min(1).max(1048576),
|
|
2567
|
+
client_request_id: CodingClientRequestId
|
|
2568
|
+
});
|
|
2569
|
+
var CodingStopParams = z28.strictObject({ run_id: z28.string().min(1).max(64) });
|
|
2570
|
+
var CodingStopResult = z28.strictObject({ run: CodingRunRecord.nullable() });
|
|
2571
|
+
var CodingStopElsewhereParams = z28.strictObject({
|
|
2572
|
+
provider: CodingProviderName,
|
|
2573
|
+
provider_session_id: SessionKey,
|
|
2574
|
+
pid: z28.int().min(1)
|
|
2575
|
+
});
|
|
2576
|
+
var CodingStopElsewhereResult = z28.strictObject({ stopped: z28.boolean(), message: ShortText });
|
|
2577
|
+
var CodingOptionsSetParams = z28.strictObject({
|
|
2578
|
+
session_id: SessionKey,
|
|
2579
|
+
model: z28.string().max(200).optional(),
|
|
2580
|
+
effort: z28.string().max(40).optional()
|
|
2581
|
+
});
|
|
2582
|
+
var CodingOptionsSetResult = z28.strictObject({ session: CodingSessionRecord });
|
|
2583
|
+
var CodingAgentSetParams = z28.strictObject({ session_id: SessionKey, agent: CodingAgentSelectionParams.optional() });
|
|
2584
|
+
var CodingAgentSetResult = z28.strictObject({ session: CodingSessionRecord });
|
|
2585
|
+
var CodingAgentsAccessParams = z28.strictObject({});
|
|
2586
|
+
var CodingAgentsAccessResult = z28.strictObject({
|
|
2587
|
+
signedIn: z28.boolean(),
|
|
2588
|
+
userId: z28.string().max(64).nullable(),
|
|
2589
|
+
organizationId: z28.string().max(64).nullable(),
|
|
2590
|
+
configured: z28.boolean()
|
|
2591
|
+
});
|
|
2592
|
+
var CodingTitlesStatusParams = z28.strictObject({});
|
|
2593
|
+
var CodingTitlesStatusResult = CodingTitleStatus;
|
|
2594
|
+
var CodingPrefsListParams = z28.strictObject({});
|
|
2595
|
+
var CodingPrefsListResult = z28.strictObject({ preferences: z28.record(z28.string().max(200), CodingChatPreference) });
|
|
2596
|
+
var CodingPrefsSetParams = z28.strictObject({
|
|
2597
|
+
key: z28.string().min(1).max(200),
|
|
2598
|
+
title: z28.string().min(1).max(500).optional(),
|
|
2599
|
+
clear_title: z28.boolean().optional(),
|
|
2600
|
+
pinned: z28.boolean().optional(),
|
|
2601
|
+
hidden: z28.boolean().optional()
|
|
2602
|
+
});
|
|
2603
|
+
var CodingPrefsSetResult = CodingPrefsListResult;
|
|
2604
|
+
var CodingRecentSeenParams = z28.strictObject({ target: z28.string().min(3).max(200) });
|
|
2605
|
+
var CodingRecentSeenResult = z28.strictObject({ recent: z28.array(CodingRecentRow) });
|
|
2606
|
+
var CodingSearchParams = z28.strictObject({
|
|
2607
|
+
query: z28.string().min(1).max(500),
|
|
2608
|
+
cursor: nonNegInt.optional(),
|
|
2609
|
+
limit: z28.int().min(1).max(100).optional()
|
|
2610
|
+
});
|
|
2611
|
+
var CodingSearchResult = z28.strictObject({
|
|
2612
|
+
query: z28.string().max(500),
|
|
2613
|
+
hits: z28.array(
|
|
2614
|
+
z28.strictObject({
|
|
2615
|
+
provider: CodingProviderName,
|
|
2616
|
+
providerSessionId: SessionKey,
|
|
2617
|
+
title: z28.string().max(500),
|
|
2618
|
+
cwd: LocalPath.nullable(),
|
|
2619
|
+
updatedAt: IsoTime,
|
|
2620
|
+
where: z28.enum(["title", "content"]),
|
|
2621
|
+
snippet: z28.string().max(2e3).nullable()
|
|
2622
|
+
})
|
|
2623
|
+
),
|
|
2624
|
+
scanned: nonNegInt,
|
|
2625
|
+
total: nonNegInt,
|
|
2626
|
+
nextCursor: nonNegInt.nullable()
|
|
2627
|
+
});
|
|
2628
|
+
var CodingReconcileParams = z28.strictObject({ provider: CodingProviderName, provider_session_id: SessionKey });
|
|
2629
|
+
var CodingReconcileResult = z28.strictObject({
|
|
2630
|
+
state: z28.enum(["done", "blocked", "nothing_to_do"]),
|
|
2631
|
+
summary: z28.string().max(400)
|
|
2632
|
+
});
|
|
2633
|
+
var CodingTranscriptRawParams = z28.strictObject({ provider: CodingProviderName, provider_session_id: SessionKey });
|
|
2634
|
+
var CodingTranscriptRawResult = z28.strictObject({
|
|
2635
|
+
available: z28.boolean(),
|
|
2636
|
+
reason: ShortText.nullable(),
|
|
2637
|
+
file_name: z28.string().max(300).nullable(),
|
|
2638
|
+
bytes: nonNegInt,
|
|
2639
|
+
/** The opt-in cloud backup was refreshed (false: off, unchanged, or signed out). */
|
|
2640
|
+
backup_refreshed: z28.boolean(),
|
|
2641
|
+
/** Subagent transcripts beside the chat (Claude Code), downloaded separately. */
|
|
2642
|
+
subagents: nonNegInt
|
|
2643
|
+
});
|
|
2644
|
+
var CodingWatchParams = z28.strictObject({});
|
|
2645
|
+
var CodingWatchResult = z28.strictObject({ resource_id: ResourceId });
|
|
2646
|
+
var CodingSessionWatchParams = z28.strictObject({ session_id: SessionKey, since_seq: nonNegInt.optional() });
|
|
2647
|
+
var CodingSessionWatchResult = z28.strictObject({
|
|
2648
|
+
resource_id: ResourceId,
|
|
2649
|
+
/** The newest item seq the device has for this session right now. */
|
|
2650
|
+
seq: nonNegInt
|
|
2651
|
+
});
|
|
2652
|
+
var CodingChangedEvent = z28.discriminatedUnion("kind", [
|
|
2653
|
+
z28.strictObject({ kind: z28.literal("session"), session: CodingSessionRecord }),
|
|
2654
|
+
z28.strictObject({ kind: z28.literal("run"), run: CodingRunRecord }),
|
|
2655
|
+
z28.strictObject({ kind: z28.literal("preferences"), preferences: z28.record(z28.string().max(200), CodingChatPreference) }),
|
|
2656
|
+
z28.strictObject({ kind: z28.literal("titles") }),
|
|
2657
|
+
z28.strictObject({ kind: z28.literal("recent"), recent: z28.array(CodingRecentRow) })
|
|
2658
|
+
]);
|
|
2659
|
+
var CodingWatchStateEvent = z28.strictObject({ live: z28.boolean(), reason: ShortText.nullable(), beat_ms: z28.int().min(1e3) });
|
|
2660
|
+
var CodingItemEvent = z28.strictObject({
|
|
2661
|
+
session_id: SessionKey,
|
|
2662
|
+
run_id: z28.string().min(1).max(64),
|
|
2663
|
+
seq: nonNegInt,
|
|
2664
|
+
item: CodingTranscriptItem
|
|
2665
|
+
});
|
|
2666
|
+
var CodingGapEvent = z28.strictObject({ session_id: SessionKey, since_seq: nonNegInt, seq: nonNegInt });
|
|
2667
|
+
var SessionIdentifyParams = z28.strictObject({ label: z28.string().min(1).max(60) });
|
|
2668
|
+
var SessionIdentifyResult = z28.strictObject({ label: z28.string().max(60) });
|
|
2669
|
+
|
|
2670
|
+
// src/schema/apps.ts
|
|
2671
|
+
import { z as z29 } from "zod";
|
|
2672
|
+
import { UUID_SHAPE_PATTERN as UUID_SHAPE_PATTERN5 } from "@ai-matrx/kit/uuid";
|
|
2673
|
+
var AppKey = z29.string().regex(/^[a-z][a-z0-9_-]{0,39}$/);
|
|
2674
|
+
var AppProfileId = z29.string().regex(UUID_SHAPE_PATTERN5);
|
|
2675
|
+
var AppProfileLocator = z29.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}$/);
|
|
2676
|
+
var AppSupport = z29.enum(["supported", "partial", "unsupported"]);
|
|
2677
|
+
var AppFeatureStatus = z29.strictObject({
|
|
2003
2678
|
status: AppSupport,
|
|
2004
2679
|
/** One line, set whenever status is not "supported". */
|
|
2005
|
-
reason:
|
|
2680
|
+
reason: z29.string().max(140).nullable()
|
|
2006
2681
|
});
|
|
2007
|
-
var AppInfo =
|
|
2682
|
+
var AppInfo = z29.strictObject({
|
|
2008
2683
|
app_key: AppKey,
|
|
2009
|
-
name:
|
|
2010
|
-
installed:
|
|
2684
|
+
name: z29.string().max(64),
|
|
2685
|
+
installed: z29.boolean(),
|
|
2011
2686
|
/** The app's own version string, or null when it is not installed or does not say. */
|
|
2012
|
-
version:
|
|
2687
|
+
version: z29.string().max(64).nullable(),
|
|
2013
2688
|
/** The install found (an .app bundle, an .exe, a binary), or null. */
|
|
2014
2689
|
location: AbsPath.nullable(),
|
|
2015
2690
|
/** Open the app at all on this OS. */
|
|
@@ -2019,148 +2694,148 @@ var AppInfo = z28.strictObject({
|
|
|
2019
2694
|
/** Plan usage read from the app's own files on this OS. */
|
|
2020
2695
|
usage: AppFeatureStatus
|
|
2021
2696
|
});
|
|
2022
|
-
var AppUsageReading =
|
|
2023
|
-
window:
|
|
2697
|
+
var AppUsageReading = z29.strictObject({
|
|
2698
|
+
window: z29.enum(["five_hour", "weekly", "extra"]),
|
|
2024
2699
|
/** 0–100 for five_hour and weekly; extra-usage spend as a percent of its cap (may pass 100). */
|
|
2025
|
-
percent:
|
|
2700
|
+
percent: z29.number().min(0).max(1e4),
|
|
2026
2701
|
/** When the app recorded it. */
|
|
2027
2702
|
sampled_at_ms: epochMs,
|
|
2028
2703
|
/** True when the window has rolled over since the sample, so the figure has reset. */
|
|
2029
|
-
reset_since:
|
|
2704
|
+
reset_since: z29.boolean()
|
|
2030
2705
|
});
|
|
2031
|
-
var AppProfile =
|
|
2706
|
+
var AppProfile = z29.strictObject({
|
|
2032
2707
|
/** The row's id; null for a folder found on disk that no row names yet. */
|
|
2033
2708
|
id: AppProfileId.nullable(),
|
|
2034
2709
|
app_key: AppKey,
|
|
2035
|
-
display_name:
|
|
2710
|
+
display_name: z29.string().min(1).max(120),
|
|
2036
2711
|
/** The account the person means to be signed in here; null when not stated (never guessed). */
|
|
2037
|
-
account_identity:
|
|
2712
|
+
account_identity: z29.string().min(3).max(320).nullable(),
|
|
2038
2713
|
profile_locator: AppProfileLocator.nullable(),
|
|
2039
2714
|
/** The device the row is tied to; null when the row names none. */
|
|
2040
2715
|
device_id: DeviceId.nullable(),
|
|
2041
2716
|
/** The folder this profile resolves to on this device; null for a row tied to another device. */
|
|
2042
2717
|
folder: AbsPath.nullable(),
|
|
2043
2718
|
/** The folder exists on this device. */
|
|
2044
|
-
on_disk:
|
|
2719
|
+
on_disk: z29.boolean(),
|
|
2045
2720
|
/** An instance with this profile is running; null when it could not be determined. */
|
|
2046
|
-
running:
|
|
2721
|
+
running: z29.boolean().nullable(),
|
|
2047
2722
|
/** Usage the app recorded for this profile; null when the app exposes none here. */
|
|
2048
|
-
usage:
|
|
2723
|
+
usage: z29.array(AppUsageReading).nullable(),
|
|
2049
2724
|
last_opened_ms: epochMs.nullable()
|
|
2050
2725
|
});
|
|
2051
|
-
var AppsListParams =
|
|
2052
|
-
var AppsListResult =
|
|
2053
|
-
var AppsProfilesListParams =
|
|
2726
|
+
var AppsListParams = z29.strictObject({});
|
|
2727
|
+
var AppsListResult = z29.strictObject({ apps: z29.array(AppInfo) });
|
|
2728
|
+
var AppsProfilesListParams = z29.strictObject({
|
|
2054
2729
|
/** Only this app's profiles; every app's when absent. */
|
|
2055
2730
|
app_key: AppKey.optional()
|
|
2056
2731
|
});
|
|
2057
|
-
var AppsProfilesListResult =
|
|
2058
|
-
profiles:
|
|
2732
|
+
var AppsProfilesListResult = z29.strictObject({
|
|
2733
|
+
profiles: z29.array(AppProfile),
|
|
2059
2734
|
/**
|
|
2060
2735
|
* Whether the saved rows could be read: false while signed out or offline, when only folders
|
|
2061
2736
|
* found on disk are listed.
|
|
2062
2737
|
*/
|
|
2063
|
-
registry:
|
|
2738
|
+
registry: z29.enum(["ok", "signed_out", "unavailable"])
|
|
2064
2739
|
});
|
|
2065
|
-
var AppsProfilesSaveParams =
|
|
2740
|
+
var AppsProfilesSaveParams = z29.strictObject({
|
|
2066
2741
|
id: AppProfileId.optional(),
|
|
2067
2742
|
app_key: AppKey,
|
|
2068
|
-
display_name:
|
|
2069
|
-
account_identity:
|
|
2743
|
+
display_name: z29.string().min(1).max(120),
|
|
2744
|
+
account_identity: z29.string().min(3).max(320).nullable(),
|
|
2070
2745
|
/** On create: the folder to use (one found on disk), or null for the app's default profile. Ignored on update. */
|
|
2071
2746
|
profile_locator: AppProfileLocator.nullable(),
|
|
2072
2747
|
/** On create with profile_locator null: make a new folder named after display_name instead. */
|
|
2073
|
-
new_folder:
|
|
2748
|
+
new_folder: z29.boolean().default(false)
|
|
2074
2749
|
});
|
|
2075
2750
|
var AppsProfilesSaveResult = AppProfile;
|
|
2076
|
-
var AppsProfilesRemoveParams =
|
|
2077
|
-
var AppsProfilesRemoveResult =
|
|
2078
|
-
var AppsOpenParams =
|
|
2751
|
+
var AppsProfilesRemoveParams = z29.strictObject({ id: AppProfileId });
|
|
2752
|
+
var AppsProfilesRemoveResult = z29.strictObject({ removed: z29.boolean() });
|
|
2753
|
+
var AppsOpenParams = z29.strictObject({
|
|
2079
2754
|
app_key: AppKey,
|
|
2080
2755
|
profile_id: AppProfileId.optional()
|
|
2081
2756
|
});
|
|
2082
|
-
var AppsOpenResult =
|
|
2757
|
+
var AppsOpenResult = z29.strictObject({
|
|
2083
2758
|
/** True when an instance with this profile was already running; it is brought forward. */
|
|
2084
|
-
already_running:
|
|
2759
|
+
already_running: z29.boolean(),
|
|
2085
2760
|
folder: AbsPath.nullable()
|
|
2086
2761
|
});
|
|
2087
2762
|
|
|
2088
2763
|
// src/schema/apps-chats.ts
|
|
2089
|
-
import { z as
|
|
2090
|
-
var ChatId =
|
|
2091
|
-
var ChatPlace =
|
|
2092
|
-
var ChatProjectId =
|
|
2093
|
-
var ChatWindow =
|
|
2764
|
+
import { z as z30 } from "zod";
|
|
2765
|
+
var ChatId = z30.string().regex(/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/);
|
|
2766
|
+
var ChatPlace = z30.string().regex(/^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/);
|
|
2767
|
+
var ChatProjectId = z30.string().regex(/^[a-z0-9][a-z0-9-]{0,63}$/);
|
|
2768
|
+
var ChatWindow = z30.strictObject({
|
|
2094
2769
|
key: ChatPlace,
|
|
2095
2770
|
/** The app's default profile (Claude: the main window, which lists every account's chats). */
|
|
2096
|
-
main:
|
|
2771
|
+
main: z30.boolean(),
|
|
2097
2772
|
/** The account the window is signed into, when known. */
|
|
2098
|
-
account:
|
|
2773
|
+
account: z30.string().max(320).nullable()
|
|
2099
2774
|
});
|
|
2100
|
-
var ChatProject =
|
|
2775
|
+
var ChatProject = z30.strictObject({
|
|
2101
2776
|
id: ChatProjectId,
|
|
2102
|
-
name:
|
|
2103
|
-
archived:
|
|
2777
|
+
name: z30.string().min(1).max(200),
|
|
2778
|
+
archived: z30.boolean(),
|
|
2104
2779
|
/** Chats in it. */
|
|
2105
2780
|
count: nonNegInt
|
|
2106
2781
|
});
|
|
2107
|
-
var ChatPin =
|
|
2782
|
+
var ChatPin = z30.strictObject({
|
|
2108
2783
|
/** The window whose account pins it; an account with no window of its own is named by its email. */
|
|
2109
|
-
window:
|
|
2784
|
+
window: z30.string().min(1).max(320),
|
|
2110
2785
|
/** When that account's pin list was last read; null when the reading has no time. */
|
|
2111
2786
|
observed_at_ms: epochMs.nullable()
|
|
2112
2787
|
});
|
|
2113
|
-
var ChatRunning =
|
|
2788
|
+
var ChatRunning = z30.strictObject({
|
|
2114
2789
|
window: ChatPlace,
|
|
2115
2790
|
/** process: a live process resumed this chat there (exact); activity: that window's own record moved in the last 3 minutes. */
|
|
2116
|
-
how:
|
|
2791
|
+
how: z30.enum(["process", "activity"])
|
|
2117
2792
|
});
|
|
2118
|
-
var ChatHidden =
|
|
2793
|
+
var ChatHidden = z30.strictObject({
|
|
2119
2794
|
window: ChatPlace,
|
|
2120
|
-
reason:
|
|
2795
|
+
reason: z30.string().max(200)
|
|
2121
2796
|
});
|
|
2122
|
-
var ChatLastUse =
|
|
2797
|
+
var ChatLastUse = z30.strictObject({
|
|
2123
2798
|
/** The conversation's last reply. */
|
|
2124
2799
|
at_ms: epochMs,
|
|
2125
2800
|
window: ChatPlace.nullable(),
|
|
2126
|
-
account:
|
|
2801
|
+
account: z30.string().max(320).nullable(),
|
|
2127
2802
|
/** How the window was decided (one short line). */
|
|
2128
|
-
how:
|
|
2803
|
+
how: z30.string().max(120).nullable(),
|
|
2129
2804
|
/** The account's 1-hour prompt cache is still warm. */
|
|
2130
|
-
cache_warm:
|
|
2805
|
+
cache_warm: z30.boolean(),
|
|
2131
2806
|
cache_minutes_left: nonNegInt
|
|
2132
2807
|
});
|
|
2133
|
-
var ChatAppProject =
|
|
2134
|
-
id:
|
|
2135
|
-
name:
|
|
2808
|
+
var ChatAppProject = z30.strictObject({
|
|
2809
|
+
id: z30.string().min(1).max(200),
|
|
2810
|
+
name: z30.string().max(200)
|
|
2136
2811
|
});
|
|
2137
|
-
var ChatTitleSource =
|
|
2138
|
-
var ChatRow =
|
|
2812
|
+
var ChatTitleSource = z30.enum(["app", "app-remembered", "custom-title", "ai-title", "agent-name", "summary", "first-prompt", "last-prompt"]);
|
|
2813
|
+
var ChatRow = z30.strictObject({
|
|
2139
2814
|
id: ChatId,
|
|
2140
2815
|
/** The short id people see (the listing's first 8 characters). */
|
|
2141
|
-
short_id:
|
|
2816
|
+
short_id: z30.string().max(16),
|
|
2142
2817
|
/** The listing's own name (Claude: local_<id>), null for a chat only in the holder. */
|
|
2143
|
-
record:
|
|
2144
|
-
title:
|
|
2818
|
+
record: z30.string().max(160).nullable(),
|
|
2819
|
+
title: z30.string().max(1e3),
|
|
2145
2820
|
last_active_ms: epochMs.nullable(),
|
|
2146
2821
|
created_ms: epochMs.nullable(),
|
|
2147
|
-
projects:
|
|
2148
|
-
starred:
|
|
2149
|
-
pinned_in:
|
|
2822
|
+
projects: z30.array(ChatProjectId).max(500),
|
|
2823
|
+
starred: z30.boolean(),
|
|
2824
|
+
pinned_in: z30.array(ChatPin).max(200),
|
|
2150
2825
|
/** Every place it is listed now: window keys, plus "holder". */
|
|
2151
|
-
places:
|
|
2152
|
-
held:
|
|
2153
|
-
running:
|
|
2154
|
-
hidden_in:
|
|
2826
|
+
places: z30.array(ChatPlace).max(200),
|
|
2827
|
+
held: z30.boolean(),
|
|
2828
|
+
running: z30.array(ChatRunning).max(200),
|
|
2829
|
+
hidden_in: z30.array(ChatHidden).max(200),
|
|
2155
2830
|
/** Kept out of the main window on purpose. */
|
|
2156
|
-
hidden_from_main:
|
|
2831
|
+
hidden_from_main: z30.boolean(),
|
|
2157
2832
|
/** Listed in a side window and not yet copied into main. */
|
|
2158
|
-
main_pending:
|
|
2833
|
+
main_pending: z30.boolean(),
|
|
2159
2834
|
/** A scheduled routine's run (its task id). */
|
|
2160
|
-
scheduled:
|
|
2835
|
+
scheduled: z30.string().max(200).nullable(),
|
|
2161
2836
|
/** Created recently and in no project: offered for filing. */
|
|
2162
|
-
new_unfiled:
|
|
2163
|
-
warnings:
|
|
2837
|
+
new_unfiled: z30.boolean(),
|
|
2838
|
+
warnings: z30.array(z30.string().max(400)).max(20),
|
|
2164
2839
|
last_use: ChatLastUse.nullable(),
|
|
2165
2840
|
/** 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. */
|
|
2166
2841
|
app_project: ChatAppProject.optional(),
|
|
@@ -2170,140 +2845,140 @@ var ChatRow = z29.strictObject({
|
|
|
2170
2845
|
* 1.14: the chat's own title before the person's rename (the one title rule, `@ai-matrx/coding-sessions/sessions`);
|
|
2171
2846
|
* `title` is what to show (`title_override` when set, else this).
|
|
2172
2847
|
*/
|
|
2173
|
-
original_title:
|
|
2848
|
+
original_title: z30.string().max(1e3).optional(),
|
|
2174
2849
|
/** 1.14: where `original_title` came from (the one rule's sources, strongest first; 1.15: a closed set). */
|
|
2175
2850
|
title_source: ChatTitleSource.optional(),
|
|
2176
2851
|
/** 1.14: the person's rename inside Matrx (Coding Sessions), applied once by the row builder; absent = none. */
|
|
2177
|
-
title_override:
|
|
2852
|
+
title_override: z30.string().min(1).max(300).optional(),
|
|
2178
2853
|
/** 1.15: the app itself archived it (hidden_in says where and why, in words for people; this is the typed fact). */
|
|
2179
|
-
archived:
|
|
2854
|
+
archived: z30.boolean().optional()
|
|
2180
2855
|
});
|
|
2181
|
-
var ChatFamily =
|
|
2856
|
+
var ChatFamily = z30.strictObject({
|
|
2182
2857
|
id: ChatId,
|
|
2183
2858
|
fork_of: ChatId.nullable(),
|
|
2184
2859
|
copy_of: ChatId.nullable()
|
|
2185
2860
|
});
|
|
2186
|
-
var AppsChatsListParams =
|
|
2861
|
+
var AppsChatsListParams = z30.strictObject({
|
|
2187
2862
|
app_key: AppKey,
|
|
2188
2863
|
/** Only these chats (a live update re-reads just what changed). */
|
|
2189
|
-
ids:
|
|
2864
|
+
ids: z30.array(ChatId).max(500).optional()
|
|
2190
2865
|
});
|
|
2191
|
-
var AppsChatsListResult =
|
|
2866
|
+
var AppsChatsListResult = z30.strictObject({
|
|
2192
2867
|
app_key: AppKey,
|
|
2193
2868
|
/** Bumps on every change the index sees; `apps.chats.changed` carries the same number. */
|
|
2194
2869
|
version: nonNegInt,
|
|
2195
|
-
windows:
|
|
2196
|
-
projects:
|
|
2197
|
-
chats:
|
|
2870
|
+
windows: z30.array(ChatWindow).max(200),
|
|
2871
|
+
projects: z30.array(ChatProject).max(5e3),
|
|
2872
|
+
chats: z30.array(ChatRow).max(2e4),
|
|
2198
2873
|
/** How long a chat in no project counts as new. */
|
|
2199
2874
|
new_window_ms: nonNegInt,
|
|
2200
2875
|
/** 1.9: this is the copy saved at the last read, shown while everything is read again. */
|
|
2201
|
-
updating:
|
|
2876
|
+
updating: z30.boolean().optional(),
|
|
2202
2877
|
/** 1.9: false while the folder watches are down (changes are not arriving); `apps.chats.watch_state` says when it changes. */
|
|
2203
|
-
live:
|
|
2878
|
+
live: z30.boolean().optional(),
|
|
2204
2879
|
/** 1.10: every listed chat that is a fork or a copy of another (read from the conversations' first lines). */
|
|
2205
|
-
families:
|
|
2880
|
+
families: z30.array(ChatFamily).max(2e4).optional()
|
|
2206
2881
|
});
|
|
2207
|
-
var AppsChatsWatchParams =
|
|
2208
|
-
var AppsChatsWatchResult =
|
|
2209
|
-
var AppsChatsChangedEvent =
|
|
2882
|
+
var AppsChatsWatchParams = z30.strictObject({ app_key: AppKey });
|
|
2883
|
+
var AppsChatsWatchResult = z30.strictObject({ resource_id: ResourceId, version: nonNegInt });
|
|
2884
|
+
var AppsChatsChangedEvent = z30.strictObject({
|
|
2210
2885
|
app_key: AppKey,
|
|
2211
2886
|
version: nonNegInt,
|
|
2212
|
-
ids:
|
|
2213
|
-
all:
|
|
2887
|
+
ids: z30.array(ChatId).max(1e3),
|
|
2888
|
+
all: z30.boolean()
|
|
2214
2889
|
});
|
|
2215
|
-
var AppsChatsWatchStateEvent =
|
|
2890
|
+
var AppsChatsWatchStateEvent = z30.strictObject({
|
|
2216
2891
|
app_key: AppKey,
|
|
2217
|
-
live:
|
|
2218
|
-
updating:
|
|
2219
|
-
reason:
|
|
2892
|
+
live: z30.boolean(),
|
|
2893
|
+
updating: z30.boolean(),
|
|
2894
|
+
reason: z30.string().max(300).nullable()
|
|
2220
2895
|
});
|
|
2221
|
-
var AppsChatsPlaceParams =
|
|
2896
|
+
var AppsChatsPlaceParams = z30.strictObject({
|
|
2222
2897
|
app_key: AppKey,
|
|
2223
2898
|
chat_id: ChatId,
|
|
2224
|
-
action:
|
|
2899
|
+
action: z30.enum(["place", "take_off", "hold"]),
|
|
2225
2900
|
/** The window (for place and take_off). */
|
|
2226
2901
|
window: ChatPlace.optional(),
|
|
2227
2902
|
/** take_off where it is open: stop it there first (the person confirmed). */
|
|
2228
|
-
stop_if_open:
|
|
2903
|
+
stop_if_open: z30.boolean().default(false)
|
|
2229
2904
|
});
|
|
2230
|
-
var AppsChatsPlaceResult =
|
|
2231
|
-
var AppsProjectsFileManyParams =
|
|
2905
|
+
var AppsChatsPlaceResult = z30.strictObject({ chat: ChatRow, message: z30.string().max(400) });
|
|
2906
|
+
var AppsProjectsFileManyParams = z30.strictObject({
|
|
2232
2907
|
app_key: AppKey,
|
|
2233
|
-
chat_ids:
|
|
2908
|
+
chat_ids: z30.array(ChatId).min(1).max(500),
|
|
2234
2909
|
project_id: ChatProjectId.optional(),
|
|
2235
|
-
new_project_name:
|
|
2910
|
+
new_project_name: z30.string().min(1).max(200).optional()
|
|
2236
2911
|
});
|
|
2237
|
-
var AppsProjectsFileManyResult =
|
|
2238
|
-
var AppsProjectsUpdateParams =
|
|
2912
|
+
var AppsProjectsFileManyResult = z30.strictObject({ chats: z30.array(ChatRow).max(500), project: ChatProject });
|
|
2913
|
+
var AppsProjectsUpdateParams = z30.strictObject({
|
|
2239
2914
|
app_key: AppKey,
|
|
2240
2915
|
project_id: ChatProjectId,
|
|
2241
|
-
name:
|
|
2242
|
-
archived:
|
|
2916
|
+
name: z30.string().min(1).max(200).optional(),
|
|
2917
|
+
archived: z30.boolean().optional()
|
|
2243
2918
|
});
|
|
2244
|
-
var AppsProjectsUpdateResult =
|
|
2245
|
-
var AppsProjectsCopyParams =
|
|
2246
|
-
var AppsProjectsCopyResult =
|
|
2247
|
-
var AppsProjectsFileParams =
|
|
2919
|
+
var AppsProjectsUpdateResult = z30.strictObject({ project: ChatProject });
|
|
2920
|
+
var AppsProjectsCopyParams = z30.strictObject({ app_key: AppKey, project_id: ChatProjectId, new_project_name: z30.string().min(1).max(200) });
|
|
2921
|
+
var AppsProjectsCopyResult = z30.strictObject({ project: ChatProject });
|
|
2922
|
+
var AppsProjectsFileParams = z30.strictObject({
|
|
2248
2923
|
app_key: AppKey,
|
|
2249
2924
|
chat_id: ChatId,
|
|
2250
2925
|
project_id: ChatProjectId.optional(),
|
|
2251
|
-
new_project_name:
|
|
2926
|
+
new_project_name: z30.string().min(1).max(200).optional()
|
|
2252
2927
|
});
|
|
2253
|
-
var AppsProjectsFileResult =
|
|
2254
|
-
var AppsProjectsUnfileParams =
|
|
2255
|
-
var AppsProjectsUnfileResult =
|
|
2256
|
-
var AppsChatsStarParams =
|
|
2257
|
-
var AppsChatsStarResult =
|
|
2928
|
+
var AppsProjectsFileResult = z30.strictObject({ chat: ChatRow, project: ChatProject });
|
|
2929
|
+
var AppsProjectsUnfileParams = z30.strictObject({ app_key: AppKey, chat_id: ChatId, project_id: ChatProjectId });
|
|
2930
|
+
var AppsProjectsUnfileResult = z30.strictObject({ chat: ChatRow });
|
|
2931
|
+
var AppsChatsStarParams = z30.strictObject({ app_key: AppKey, chat_id: ChatId, starred: z30.boolean() });
|
|
2932
|
+
var AppsChatsStarResult = z30.strictObject({ chat: ChatRow });
|
|
2258
2933
|
|
|
2259
2934
|
// src/schema/apps-accounts.ts
|
|
2260
|
-
import { z as
|
|
2261
|
-
var AppWindowInfo =
|
|
2935
|
+
import { z as z31 } from "zod";
|
|
2936
|
+
var AppWindowInfo = z31.strictObject({
|
|
2262
2937
|
key: ChatPlace,
|
|
2263
2938
|
/** The app's default profile (Claude: main, which may sign into any account). */
|
|
2264
|
-
main:
|
|
2939
|
+
main: z31.boolean(),
|
|
2265
2940
|
/** The account the window is meant for (null for main). */
|
|
2266
|
-
account:
|
|
2941
|
+
account: z31.string().max(320).nullable(),
|
|
2267
2942
|
/** The account signed in there now: an email, or the account id while it has no saved name. */
|
|
2268
|
-
signed_in:
|
|
2269
|
-
signed_in_is_email:
|
|
2943
|
+
signed_in: z31.string().max(320).nullable(),
|
|
2944
|
+
signed_in_is_email: z31.boolean(),
|
|
2270
2945
|
/** Signed into another account than the one it is meant for. */
|
|
2271
|
-
mismatch:
|
|
2946
|
+
mismatch: z31.boolean(),
|
|
2272
2947
|
/** Its folder exists. */
|
|
2273
|
-
created:
|
|
2948
|
+
created: z31.boolean(),
|
|
2274
2949
|
/** Open now. */
|
|
2275
|
-
running:
|
|
2950
|
+
running: z31.boolean(),
|
|
2276
2951
|
/** Chats open in it now (a process resuming each one). */
|
|
2277
2952
|
open_chats: nonNegInt
|
|
2278
2953
|
});
|
|
2279
|
-
var AccountUsage =
|
|
2954
|
+
var AccountUsage = z31.strictObject({
|
|
2280
2955
|
/** The account's email, or "org <8 chars>" when no window has ever sampled that org. */
|
|
2281
|
-
account:
|
|
2282
|
-
org:
|
|
2956
|
+
account: z31.string().max(320),
|
|
2957
|
+
org: z31.string().max(80).nullable(),
|
|
2283
2958
|
/** False when the org was sampled in several accounts' windows and the vote is not clear (≥ 75 %). */
|
|
2284
|
-
account_certain:
|
|
2959
|
+
account_certain: z31.boolean(),
|
|
2285
2960
|
/** 5-hour use in percent (0 once the reading is over 5 hours old). */
|
|
2286
|
-
five_hour:
|
|
2287
|
-
five_hour_reset_since:
|
|
2961
|
+
five_hour: z31.number().nullable(),
|
|
2962
|
+
five_hour_reset_since: z31.boolean(),
|
|
2288
2963
|
/** Weekly use in percent (0 once the week reset after the reading). */
|
|
2289
|
-
weekly:
|
|
2290
|
-
weekly_reset_since:
|
|
2964
|
+
weekly: z31.number().nullable(),
|
|
2965
|
+
weekly_reset_since: z31.boolean(),
|
|
2291
2966
|
/** Extra-usage spend in percent of its cap, when on. */
|
|
2292
|
-
extra_usage:
|
|
2967
|
+
extra_usage: z31.number().nullable(),
|
|
2293
2968
|
extra_usage_as_of_ms: epochMs.nullable(),
|
|
2294
2969
|
as_of_ms: epochMs,
|
|
2295
2970
|
/** The windows meant for this account (and main when main took the reading). */
|
|
2296
|
-
windows:
|
|
2971
|
+
windows: z31.array(ChatPlace).max(200),
|
|
2297
2972
|
/** The window that took the reading is open now and the reading is under 30 minutes old. */
|
|
2298
|
-
live:
|
|
2973
|
+
live: z31.boolean(),
|
|
2299
2974
|
/** The next weekly reset, when known. */
|
|
2300
2975
|
weekly_resets_at_ms: epochMs.nullable(),
|
|
2301
2976
|
/** That reset time is Claude's own (its reading, or a reset seen in its usage history). */
|
|
2302
|
-
weekly_reset_official:
|
|
2977
|
+
weekly_reset_official: z31.boolean().nullable(),
|
|
2303
2978
|
/** 1.13: the account's plan as the app names it (Codex: "pro", "prolite"), when recorded. */
|
|
2304
|
-
plan:
|
|
2979
|
+
plan: z31.string().max(80).optional(),
|
|
2305
2980
|
/** 1.13: the account's credit balance as the app records it (Codex), when recorded. */
|
|
2306
|
-
credits:
|
|
2981
|
+
credits: z31.string().max(40).optional(),
|
|
2307
2982
|
/**
|
|
2308
2983
|
* 1.25: the latest the account's 5-hour window can reset: 5 hours after the first reading of this
|
|
2309
2984
|
* window's use (its usage history), so the real reset is at or before it. Absent when no 5-hour
|
|
@@ -2311,81 +2986,81 @@ var AccountUsage = z30.strictObject({
|
|
|
2311
2986
|
*/
|
|
2312
2987
|
five_hour_resets_by_ms: epochMs.optional()
|
|
2313
2988
|
});
|
|
2314
|
-
var AccountReset =
|
|
2989
|
+
var AccountReset = z31.strictObject({
|
|
2315
2990
|
window: ChatPlace,
|
|
2316
|
-
account:
|
|
2991
|
+
account: z31.string().max(320).nullable(),
|
|
2317
2992
|
next_reset_ms: epochMs.nullable(),
|
|
2318
2993
|
/** claude: the app's own reading; usage_history: a weekly drop seen in its usage record; your_list: the person's own entry. */
|
|
2319
|
-
source:
|
|
2994
|
+
source: z31.enum(["claude", "usage_history", "your_list"]).nullable(),
|
|
2320
2995
|
/** claude or usage_history. */
|
|
2321
|
-
official:
|
|
2996
|
+
official: z31.boolean(),
|
|
2322
2997
|
/** Set when the person's list disagrees with the official time. */
|
|
2323
|
-
note:
|
|
2998
|
+
note: z31.string().max(200).nullable()
|
|
2324
2999
|
});
|
|
2325
|
-
var AppsWindowsListParams =
|
|
2326
|
-
var AppsWindowsListResult =
|
|
2327
|
-
var AppsAccountsUsageParams =
|
|
2328
|
-
var AppsAccountsUsageResult =
|
|
3000
|
+
var AppsWindowsListParams = z31.strictObject({ app_key: AppKey });
|
|
3001
|
+
var AppsWindowsListResult = z31.strictObject({ app_key: AppKey, windows: z31.array(AppWindowInfo).max(200) });
|
|
3002
|
+
var AppsAccountsUsageParams = z31.strictObject({ app_key: AppKey });
|
|
3003
|
+
var AppsAccountsUsageResult = z31.strictObject({
|
|
2329
3004
|
app_key: AppKey,
|
|
2330
|
-
accounts:
|
|
3005
|
+
accounts: z31.array(AccountUsage).max(500),
|
|
2331
3006
|
/** 1.12: the rows are right but something around them failed (a newly read reset time could not be saved); shown, never hidden. */
|
|
2332
|
-
problem:
|
|
3007
|
+
problem: z31.string().max(400).optional()
|
|
2333
3008
|
});
|
|
2334
|
-
var AppsAccountsResetsParams =
|
|
2335
|
-
var AppsAccountsResetsResult =
|
|
3009
|
+
var AppsAccountsResetsParams = z31.strictObject({ app_key: AppKey });
|
|
3010
|
+
var AppsAccountsResetsResult = z31.strictObject({
|
|
2336
3011
|
app_key: AppKey,
|
|
2337
|
-
resets:
|
|
3012
|
+
resets: z31.array(AccountReset).max(200),
|
|
2338
3013
|
/** 1.12: as on `apps.accounts.usage`. */
|
|
2339
|
-
problem:
|
|
3014
|
+
problem: z31.string().max(400).optional()
|
|
2340
3015
|
});
|
|
2341
|
-
var AppsWindowActionResult =
|
|
2342
|
-
var AppsWindowsOpenParams =
|
|
2343
|
-
var AppsWindowsReloadParams =
|
|
2344
|
-
var ShownSection =
|
|
2345
|
-
title:
|
|
3016
|
+
var AppsWindowActionResult = z31.strictObject({ message: z31.string().max(400) });
|
|
3017
|
+
var AppsWindowsOpenParams = z31.strictObject({ app_key: AppKey, window: ChatPlace });
|
|
3018
|
+
var AppsWindowsReloadParams = z31.strictObject({ app_key: AppKey, window: ChatPlace });
|
|
3019
|
+
var ShownSection = z31.strictObject({
|
|
3020
|
+
title: z31.string().max(300),
|
|
2346
3021
|
/** Rows drawn under it (a collapsed section draws none). */
|
|
2347
|
-
rows:
|
|
2348
|
-
expanded:
|
|
3022
|
+
rows: z31.number().int().nonnegative(),
|
|
3023
|
+
expanded: z31.boolean()
|
|
2349
3024
|
});
|
|
2350
|
-
var AppsWindowsShownParams =
|
|
2351
|
-
var AppsWindowsShownResult =
|
|
3025
|
+
var AppsWindowsShownParams = z31.strictObject({ app_key: AppKey, window: ChatPlace });
|
|
3026
|
+
var AppsWindowsShownResult = z31.strictObject({
|
|
2352
3027
|
window: ChatPlace,
|
|
2353
|
-
open:
|
|
2354
|
-
sections:
|
|
2355
|
-
problem:
|
|
3028
|
+
open: z31.boolean(),
|
|
3029
|
+
sections: z31.array(ShownSection).max(200),
|
|
3030
|
+
problem: z31.string().max(400).nullable()
|
|
2356
3031
|
});
|
|
2357
|
-
var AppsWindowsRestartParams =
|
|
2358
|
-
var AppsWindowsRefreshUsageParams =
|
|
2359
|
-
var AppsProjectsMoveParams =
|
|
3032
|
+
var AppsWindowsRestartParams = z31.strictObject({ app_key: AppKey, window: ChatPlace, force: z31.boolean().default(false) });
|
|
3033
|
+
var AppsWindowsRefreshUsageParams = z31.strictObject({ app_key: AppKey, window: ChatPlace });
|
|
3034
|
+
var AppsProjectsMoveParams = z31.strictObject({
|
|
2360
3035
|
app_key: AppKey,
|
|
2361
3036
|
chat_id: ChatId,
|
|
2362
3037
|
from_project_id: ChatProjectId,
|
|
2363
3038
|
to_project_id: ChatProjectId.optional(),
|
|
2364
|
-
new_project_name:
|
|
2365
|
-
});
|
|
2366
|
-
var AppsProjectsMoveResult =
|
|
2367
|
-
var AppsProjectsCreateParams =
|
|
2368
|
-
var AppsProjectsCreateResult =
|
|
2369
|
-
var AppsProjectsImportPinsParams =
|
|
2370
|
-
var AppsProjectsImportPinsResult =
|
|
2371
|
-
var ProjectMoveChat =
|
|
2372
|
-
var ProjectMoveSkip =
|
|
2373
|
-
var ProjectMoveGroup =
|
|
2374
|
-
ok:
|
|
2375
|
-
name:
|
|
3039
|
+
new_project_name: z31.string().min(1).max(200).optional()
|
|
3040
|
+
});
|
|
3041
|
+
var AppsProjectsMoveResult = z31.strictObject({ chat: ChatRow, project: ChatProject });
|
|
3042
|
+
var AppsProjectsCreateParams = z31.strictObject({ app_key: AppKey, name: z31.string().min(1).max(200) });
|
|
3043
|
+
var AppsProjectsCreateResult = z31.strictObject({ project: ChatProject });
|
|
3044
|
+
var AppsProjectsImportPinsParams = z31.strictObject({ app_key: AppKey });
|
|
3045
|
+
var AppsProjectsImportPinsResult = z31.strictObject({ message: z31.string().max(400) });
|
|
3046
|
+
var ProjectMoveChat = z31.strictObject({ chat_id: ChatId, title: z31.string().max(300) });
|
|
3047
|
+
var ProjectMoveSkip = z31.strictObject({ chat_id: ChatId, title: z31.string().max(300), window: ChatPlace.nullable(), reason: z31.string().max(400) });
|
|
3048
|
+
var ProjectMoveGroup = z31.strictObject({
|
|
3049
|
+
ok: z31.boolean(),
|
|
3050
|
+
name: z31.string().max(200),
|
|
2376
3051
|
/** Why it is not (or was not) grouped — e.g. the window is open. */
|
|
2377
|
-
reason:
|
|
3052
|
+
reason: z31.string().max(400).optional(),
|
|
2378
3053
|
/** Chats that get (or got) the group; already in it; taken from another group of the window. */
|
|
2379
3054
|
assign: nonNegInt.optional(),
|
|
2380
3055
|
already: nonNegInt.optional(),
|
|
2381
3056
|
from_other_groups: nonNegInt.optional(),
|
|
2382
3057
|
/** A group of that name was already there (reused, never doubled). */
|
|
2383
|
-
group_exists:
|
|
3058
|
+
group_exists: z31.boolean().optional()
|
|
2384
3059
|
});
|
|
2385
|
-
var ProjectMovePin =
|
|
2386
|
-
ok:
|
|
3060
|
+
var ProjectMovePin = z31.strictObject({
|
|
3061
|
+
ok: z31.boolean(),
|
|
2387
3062
|
/** "now" = written into the closed window; "next_close" = queued until that window closes. */
|
|
2388
|
-
when:
|
|
3063
|
+
when: z31.enum(["now", "next_close"]),
|
|
2389
3064
|
/** Pinned by this call (dry run: would be). */
|
|
2390
3065
|
pinned: nonNegInt,
|
|
2391
3066
|
/** Already pinned there. */
|
|
@@ -2393,108 +3068,108 @@ var ProjectMovePin = z30.strictObject({
|
|
|
2393
3068
|
/** Waiting for the window to close (dry run: would wait). */
|
|
2394
3069
|
queued: nonNegInt,
|
|
2395
3070
|
/** Why not pinned (ok false), or why queued. */
|
|
2396
|
-
reason:
|
|
3071
|
+
reason: z31.string().max(400).optional()
|
|
2397
3072
|
});
|
|
2398
|
-
var AppsProjectsToWindowParams =
|
|
3073
|
+
var AppsProjectsToWindowParams = z31.strictObject({
|
|
2399
3074
|
app_key: AppKey,
|
|
2400
3075
|
project_id: ChatProjectId,
|
|
2401
3076
|
window: ChatPlace,
|
|
2402
3077
|
/** Also take each chat off its other side windows where safe (never main, the holder, an open window). */
|
|
2403
|
-
take_off:
|
|
3078
|
+
take_off: z31.boolean().default(false),
|
|
2404
3079
|
/** Also group them under the project's name in that window's sidebar (closed windows only). */
|
|
2405
|
-
group:
|
|
3080
|
+
group: z31.boolean().default(false),
|
|
2406
3081
|
/** 1.32: also pin them in that window (now if closed, else when it next closes). */
|
|
2407
|
-
pin:
|
|
3082
|
+
pin: z31.boolean().optional(),
|
|
2408
3083
|
/** 1.36: a batch: exactly these chats of the project and no other (a reused marker is a label, never a sweep). */
|
|
2409
|
-
chat_ids:
|
|
3084
|
+
chat_ids: z31.array(ChatId).min(1).max(5e3).optional(),
|
|
2410
3085
|
/** 1.36: take them off this one side window only (a Move's origin), never main or another window that lists them. */
|
|
2411
3086
|
take_off_from: ChatPlace.optional(),
|
|
2412
|
-
dry_run:
|
|
3087
|
+
dry_run: z31.boolean().default(false)
|
|
2413
3088
|
});
|
|
2414
|
-
var AppsProjectsToWindowResult =
|
|
3089
|
+
var AppsProjectsToWindowResult = z31.strictObject({
|
|
2415
3090
|
project_id: ChatProjectId,
|
|
2416
3091
|
window: ChatPlace,
|
|
2417
|
-
dry_run:
|
|
2418
|
-
place:
|
|
2419
|
-
already:
|
|
2420
|
-
take_off:
|
|
2421
|
-
skipped:
|
|
3092
|
+
dry_run: z31.boolean(),
|
|
3093
|
+
place: z31.array(ProjectMoveChat).max(5e3),
|
|
3094
|
+
already: z31.array(ProjectMoveChat).max(5e3),
|
|
3095
|
+
take_off: z31.array(ProjectMoveChat.extend({ window: ChatPlace })).max(2e4),
|
|
3096
|
+
skipped: z31.array(ProjectMoveSkip).max(2e4),
|
|
2422
3097
|
/** Chats of the project from other apps (no windows to place into), left as they are. */
|
|
2423
3098
|
other_apps: nonNegInt,
|
|
2424
3099
|
group: ProjectMoveGroup.nullable(),
|
|
2425
3100
|
/** 1.32: the pin in the target window (absent: not asked). */
|
|
2426
3101
|
pin: ProjectMovePin.optional(),
|
|
2427
|
-
message:
|
|
3102
|
+
message: z31.string().max(400)
|
|
2428
3103
|
});
|
|
2429
|
-
var ColdChat =
|
|
3104
|
+
var ColdChat = z31.strictObject({
|
|
2430
3105
|
id: ChatId,
|
|
2431
|
-
title:
|
|
2432
|
-
repo:
|
|
2433
|
-
window:
|
|
2434
|
-
account:
|
|
2435
|
-
model_name:
|
|
3106
|
+
title: z31.string().max(1e3),
|
|
3107
|
+
repo: z31.string().max(200).nullable(),
|
|
3108
|
+
window: z31.string().max(64).nullable(),
|
|
3109
|
+
account: z31.string().max(320).nullable(),
|
|
3110
|
+
model_name: z31.string().max(120).nullable(),
|
|
2436
3111
|
context_tokens: nonNegInt,
|
|
2437
3112
|
cold_at_ms: epochMs,
|
|
2438
3113
|
/** Waking it once the cache is cold. */
|
|
2439
|
-
cold_cost:
|
|
3114
|
+
cold_cost: z31.number().nullable(),
|
|
2440
3115
|
/** Waking it while the cache is warm. */
|
|
2441
|
-
warm_cost:
|
|
3116
|
+
warm_cost: z31.number().nullable(),
|
|
2442
3117
|
/** Its account is on extra usage (a 5-minute cache, and real money). */
|
|
2443
|
-
extra_usage:
|
|
3118
|
+
extra_usage: z31.boolean(),
|
|
2444
3119
|
/** A scheduled routine's run. */
|
|
2445
|
-
scheduled:
|
|
3120
|
+
scheduled: z31.boolean(),
|
|
2446
3121
|
/** It can be shown in its window (started in the desktop app). */
|
|
2447
|
-
openable:
|
|
3122
|
+
openable: z31.boolean(),
|
|
2448
3123
|
/** How its window was decided, or why it can't be opened. */
|
|
2449
|
-
how:
|
|
3124
|
+
how: z31.string().max(200).nullable()
|
|
2450
3125
|
});
|
|
2451
|
-
var AppsChatsColdParams =
|
|
2452
|
-
var AppsChatsColdResult =
|
|
3126
|
+
var AppsChatsColdParams = z31.strictObject({ app_key: AppKey });
|
|
3127
|
+
var AppsChatsColdResult = z31.strictObject({
|
|
2453
3128
|
app_key: AppKey,
|
|
2454
3129
|
/** Waiting for the person with a warm cache, most urgent first. */
|
|
2455
|
-
waiting:
|
|
3130
|
+
waiting: z31.array(ColdChat).max(2e3),
|
|
2456
3131
|
/** Went cold in the last while. */
|
|
2457
|
-
recently_cold:
|
|
3132
|
+
recently_cold: z31.array(ColdChat).max(2e3),
|
|
2458
3133
|
/** Chats working right now (not waiting). */
|
|
2459
3134
|
working: nonNegInt
|
|
2460
3135
|
});
|
|
2461
|
-
var TitleCopies =
|
|
3136
|
+
var TitleCopies = z31.strictObject({
|
|
2462
3137
|
window: ChatPlace,
|
|
2463
3138
|
/** Record copies in that window holding a different name (main keeps one per account folder). */
|
|
2464
3139
|
copies: nonNegInt,
|
|
2465
|
-
titles:
|
|
3140
|
+
titles: z31.array(z31.strictObject({ title: z31.string().max(2e3), source: z31.string().max(32) })).max(50)
|
|
2466
3141
|
});
|
|
2467
|
-
var TitleMismatch =
|
|
3142
|
+
var TitleMismatch = z31.strictObject({
|
|
2468
3143
|
chat_id: ChatId,
|
|
2469
3144
|
/** The right name: the latest one a person gave it (in any window, or in Matrx), else the newest automatic title. */
|
|
2470
|
-
title:
|
|
2471
|
-
title_source:
|
|
3145
|
+
title: z31.string().max(2e3),
|
|
3146
|
+
title_source: z31.enum(["user", "auto"]),
|
|
2472
3147
|
/** Where the right name came from: a window, "matrx", or "ledger" (decided earlier). */
|
|
2473
|
-
decided_from:
|
|
2474
|
-
kind:
|
|
2475
|
-
windows:
|
|
2476
|
-
differs_in:
|
|
3148
|
+
decided_from: z31.string().max(64),
|
|
3149
|
+
kind: z31.enum(["user_vs_auto", "user_vs_user", "auto_vs_auto", "source_only"]),
|
|
3150
|
+
windows: z31.array(ChatPlace).max(200),
|
|
3151
|
+
differs_in: z31.array(TitleCopies).max(200)
|
|
2477
3152
|
});
|
|
2478
|
-
var StaleTitleWindow =
|
|
3153
|
+
var StaleTitleWindow = z31.strictObject({
|
|
2479
3154
|
window: ChatPlace,
|
|
2480
3155
|
/** First and latest time (ms) it was seen writing an old name back. */
|
|
2481
3156
|
since_ms: nonNegInt,
|
|
2482
3157
|
last_ms: nonNegInt
|
|
2483
3158
|
});
|
|
2484
|
-
var AppsChatsTitlesCheckParams =
|
|
2485
|
-
var AppsChatsTitlesCheckResult =
|
|
3159
|
+
var AppsChatsTitlesCheckParams = z31.strictObject({ app_key: AppKey });
|
|
3160
|
+
var AppsChatsTitlesCheckResult = z31.strictObject({
|
|
2486
3161
|
app_key: AppKey,
|
|
2487
3162
|
chats_total: nonNegInt,
|
|
2488
3163
|
chats_in_several_windows: nonNegInt,
|
|
2489
3164
|
/** Chats with a different name in some window (or in Matrx). */
|
|
2490
3165
|
chats_with_a_different_name: nonNegInt,
|
|
2491
3166
|
copies_to_write: nonNegInt,
|
|
2492
|
-
chats:
|
|
3167
|
+
chats: z31.array(TitleMismatch).max(5e3),
|
|
2493
3168
|
/** Windows that keep writing old names back (each is fixed every pass; reloading it, Cmd+R, stops it). Since 1.33. */
|
|
2494
|
-
stale_windows:
|
|
3169
|
+
stale_windows: z31.array(StaleTitleWindow).max(200).optional()
|
|
2495
3170
|
});
|
|
2496
|
-
var AppsChatsTitlesPushParams =
|
|
2497
|
-
var AppsChatsTitlesPushResult =
|
|
3171
|
+
var AppsChatsTitlesPushParams = z31.strictObject({ app_key: AppKey, chat_id: ChatId.optional(), dry_run: z31.boolean().optional() });
|
|
3172
|
+
var AppsChatsTitlesPushResult = z31.strictObject({
|
|
2498
3173
|
app_key: AppKey,
|
|
2499
3174
|
/** Record files rewritten (title and titleSource only, each backed up first). */
|
|
2500
3175
|
written: nonNegInt,
|
|
@@ -2504,122 +3179,122 @@ var AppsChatsTitlesPushResult = z30.strictObject({
|
|
|
2504
3179
|
/** Still different after the push (dry_run: would be written). */
|
|
2505
3180
|
chats_with_a_different_name: nonNegInt
|
|
2506
3181
|
});
|
|
2507
|
-
var AppsChatsOpenParams =
|
|
2508
|
-
var SpendSplit =
|
|
2509
|
-
var SpendScopes =
|
|
2510
|
-
var SpendAccount =
|
|
2511
|
-
account:
|
|
3182
|
+
var AppsChatsOpenParams = z31.strictObject({ app_key: AppKey, chat_id: ChatId, window: ChatPlace.optional() });
|
|
3183
|
+
var SpendSplit = z31.strictObject({ main: z31.number(), helpers: z31.number() });
|
|
3184
|
+
var SpendScopes = z31.strictObject({ today: SpendSplit, week: SpendSplit });
|
|
3185
|
+
var SpendAccount = z31.strictObject({
|
|
3186
|
+
account: z31.string().max(320),
|
|
2512
3187
|
spend: SpendScopes,
|
|
2513
|
-
last_hour:
|
|
2514
|
-
last_5h:
|
|
2515
|
-
five_hour:
|
|
2516
|
-
weekly:
|
|
3188
|
+
last_hour: z31.number().nullable(),
|
|
3189
|
+
last_5h: z31.number().nullable(),
|
|
3190
|
+
five_hour: z31.number().nullable(),
|
|
3191
|
+
weekly: z31.number().nullable(),
|
|
2517
3192
|
as_of_ms: epochMs.nullable(),
|
|
2518
3193
|
weekly_resets_at_ms: epochMs.nullable(),
|
|
2519
3194
|
/** When the 5-hour or weekly limit is projected to be reached at the current burn. */
|
|
2520
3195
|
five_hour_full_at_ms: epochMs.nullable(),
|
|
2521
3196
|
weekly_full_at_ms: epochMs.nullable(),
|
|
2522
3197
|
/** The reading is too old to project. */
|
|
2523
|
-
stale:
|
|
3198
|
+
stale: z31.boolean()
|
|
2524
3199
|
});
|
|
2525
|
-
var SpendModel =
|
|
2526
|
-
var SpendChat =
|
|
3200
|
+
var SpendModel = z31.strictObject({ model: z31.string().max(120), name: z31.string().max(120), spend: SpendScopes });
|
|
3201
|
+
var SpendChat = z31.strictObject({
|
|
2527
3202
|
id: ChatId,
|
|
2528
|
-
title:
|
|
2529
|
-
repo:
|
|
2530
|
-
window:
|
|
3203
|
+
title: z31.string().max(1e3),
|
|
3204
|
+
repo: z31.string().max(200).nullable(),
|
|
3205
|
+
window: z31.string().max(64).nullable(),
|
|
2531
3206
|
spend: SpendScopes,
|
|
2532
3207
|
helpers: nonNegInt
|
|
2533
3208
|
});
|
|
2534
|
-
var SpendHelper =
|
|
2535
|
-
var SpendLive =
|
|
2536
|
-
var SpendIdleScope =
|
|
2537
|
-
var SpendIdle =
|
|
2538
|
-
var SpendStart =
|
|
2539
|
-
var SpendDay =
|
|
2540
|
-
var AppsSpendParams =
|
|
2541
|
-
var AppsSpendResult =
|
|
3209
|
+
var SpendHelper = z31.strictObject({ model: z31.string().max(120), steps: nonNegInt, over_steps: z31.boolean(), description: z31.string().max(400) });
|
|
3210
|
+
var SpendLive = z31.strictObject({ id: ChatId, title: z31.string().max(1e3), window: z31.string().max(64).nullable(), helpers: z31.array(SpendHelper).max(200) });
|
|
3211
|
+
var SpendIdleScope = z31.strictObject({ count: nonNegInt, tokens: nonNegInt, cost: z31.number(), avoidable: z31.number() });
|
|
3212
|
+
var SpendIdle = z31.strictObject({ id: ChatId, chat: z31.string().max(1e3), who: z31.string().max(400), today: SpendIdleScope, week: SpendIdleScope, last_ms: epochMs });
|
|
3213
|
+
var SpendStart = z31.strictObject({ repo: z31.string().max(200), count: nonNegInt, median: nonNegInt, latest: z31.array(nonNegInt).max(20), alarm: z31.string().max(400).nullable() });
|
|
3214
|
+
var SpendDay = z31.strictObject({ date: z31.string().regex(/^\d{4}-\d{2}-\d{2}$/), main: z31.number(), helpers: z31.number() });
|
|
3215
|
+
var AppsSpendParams = z31.strictObject({ app_key: AppKey });
|
|
3216
|
+
var AppsSpendResult = z31.strictObject({
|
|
2542
3217
|
app_key: AppKey,
|
|
2543
3218
|
/** False while older chats are still being read. */
|
|
2544
|
-
complete:
|
|
2545
|
-
today_total:
|
|
2546
|
-
week_total:
|
|
2547
|
-
idle_today:
|
|
2548
|
-
idle_week:
|
|
3219
|
+
complete: z31.boolean(),
|
|
3220
|
+
today_total: z31.number(),
|
|
3221
|
+
week_total: z31.number(),
|
|
3222
|
+
idle_today: z31.number(),
|
|
3223
|
+
idle_week: z31.number(),
|
|
2549
3224
|
/** Models with no known list price. */
|
|
2550
|
-
unpriced:
|
|
3225
|
+
unpriced: z31.array(z31.string().max(120)).max(100),
|
|
2551
3226
|
/** Helpers past their step budget, unusual starting sizes. */
|
|
2552
|
-
alarms:
|
|
2553
|
-
live:
|
|
2554
|
-
accounts:
|
|
2555
|
-
models:
|
|
3227
|
+
alarms: z31.array(z31.string().max(400)).max(200),
|
|
3228
|
+
live: z31.array(SpendLive).max(200),
|
|
3229
|
+
accounts: z31.array(SpendAccount).max(200),
|
|
3230
|
+
models: z31.array(SpendModel).max(100),
|
|
2556
3231
|
/** (1.24) The last 7 days, oldest first (today last). */
|
|
2557
|
-
days:
|
|
2558
|
-
chats:
|
|
2559
|
-
idle:
|
|
2560
|
-
starts:
|
|
2561
|
-
});
|
|
2562
|
-
var AppsSyncStatusParams =
|
|
2563
|
-
var AppsSyncStatusResult =
|
|
2564
|
-
healthy:
|
|
2565
|
-
summary:
|
|
2566
|
-
problems:
|
|
2567
|
-
warnings:
|
|
3232
|
+
days: z31.array(SpendDay).max(14).optional(),
|
|
3233
|
+
chats: z31.array(SpendChat).max(500),
|
|
3234
|
+
idle: z31.array(SpendIdle).max(500),
|
|
3235
|
+
starts: z31.array(SpendStart).max(200)
|
|
3236
|
+
});
|
|
3237
|
+
var AppsSyncStatusParams = z31.strictObject({ app_key: AppKey });
|
|
3238
|
+
var AppsSyncStatusResult = z31.strictObject({
|
|
3239
|
+
healthy: z31.boolean(),
|
|
3240
|
+
summary: z31.string().max(400),
|
|
3241
|
+
problems: z31.array(z31.string().max(400)).max(200),
|
|
3242
|
+
warnings: z31.array(z31.string().max(400)).max(200),
|
|
2568
3243
|
/** Accounts seen with no saved name yet (Save account names fixes them). */
|
|
2569
|
-
unnamed_accounts:
|
|
3244
|
+
unnamed_accounts: z31.array(z31.string().max(80)).max(200),
|
|
2570
3245
|
/** The full report. */
|
|
2571
|
-
output:
|
|
2572
|
-
});
|
|
2573
|
-
var AppsSyncRunParams =
|
|
2574
|
-
var AppsWindowsProcessesParams =
|
|
2575
|
-
var AppsWindowsProcessesResult =
|
|
2576
|
-
var AppsWindowsAddParams =
|
|
2577
|
-
var AppsWindowsSaveNamesParams =
|
|
2578
|
-
var AppsWindowsUpdateStateParams =
|
|
2579
|
-
var AppsWindowsUpdateStateResult =
|
|
3246
|
+
output: z31.string().max(2e5)
|
|
3247
|
+
});
|
|
3248
|
+
var AppsSyncRunParams = z31.strictObject({ app_key: AppKey });
|
|
3249
|
+
var AppsWindowsProcessesParams = z31.strictObject({ app_key: AppKey });
|
|
3250
|
+
var AppsWindowsProcessesResult = z31.strictObject({ processes: z31.array(z31.string().max(2e3)).max(2e3) });
|
|
3251
|
+
var AppsWindowsAddParams = z31.strictObject({ app_key: AppKey, window: ChatPlace, email: z31.string().min(3).max(320) });
|
|
3252
|
+
var AppsWindowsSaveNamesParams = z31.strictObject({ app_key: AppKey });
|
|
3253
|
+
var AppsWindowsUpdateStateParams = z31.strictObject({ app_key: AppKey });
|
|
3254
|
+
var AppsWindowsUpdateStateResult = z31.strictObject({
|
|
2580
3255
|
app_key: AppKey,
|
|
2581
|
-
pending:
|
|
3256
|
+
pending: z31.boolean(),
|
|
2582
3257
|
/** The downloaded release's name (Claude: "Claude 2.31226.1"), when the app's log names it. */
|
|
2583
|
-
version:
|
|
3258
|
+
version: z31.string().max(120).nullable(),
|
|
2584
3259
|
/** When the update became pending (the download's time), when known. */
|
|
2585
3260
|
since_ms: epochMs.nullable(),
|
|
2586
3261
|
/** Windows open when the update became pending (or last seen open) that are closed now. */
|
|
2587
|
-
closed:
|
|
3262
|
+
closed: z31.array(ChatPlace).max(200),
|
|
2588
3263
|
/**
|
|
2589
3264
|
* Since 1.27: the windows in `closed` that the update itself quit (the app's log records a quit for
|
|
2590
3265
|
* the update within a minute of when each was last seen running). Absent: not known.
|
|
2591
3266
|
*/
|
|
2592
|
-
closed_by_update:
|
|
3267
|
+
closed_by_update: z31.array(ChatPlace).max(200).optional()
|
|
2593
3268
|
});
|
|
2594
|
-
var AppsWindowsReopenParams =
|
|
2595
|
-
var AppsWindowsReopenResult =
|
|
2596
|
-
var AppsWindowsUpdateAndReopenParams =
|
|
2597
|
-
var AppsWindowsUpdateAndReopenResult =
|
|
2598
|
-
message:
|
|
3269
|
+
var AppsWindowsReopenParams = z31.strictObject({ app_key: AppKey, windows: z31.array(ChatPlace).min(1).max(200) });
|
|
3270
|
+
var AppsWindowsReopenResult = z31.strictObject({ message: z31.string().max(400), opened: z31.array(ChatPlace).max(200) });
|
|
3271
|
+
var AppsWindowsUpdateAndReopenParams = z31.strictObject({ app_key: AppKey, force: z31.boolean().default(false), dry_run: z31.boolean().default(false) });
|
|
3272
|
+
var AppsWindowsUpdateAndReopenResult = z31.strictObject({
|
|
3273
|
+
message: z31.string().max(400),
|
|
2599
3274
|
/** Windows quit (with dry_run: to be quit). */
|
|
2600
|
-
quit:
|
|
3275
|
+
quit: z31.array(ChatPlace).max(200),
|
|
2601
3276
|
/** Windows reopened (with dry_run: to be reopened), main first. */
|
|
2602
|
-
reopened:
|
|
3277
|
+
reopened: z31.array(ChatPlace).max(200),
|
|
2603
3278
|
/** The version installed, null when the install did not happen (or dry_run). */
|
|
2604
|
-
installed_version:
|
|
3279
|
+
installed_version: z31.string().max(64).nullable()
|
|
2605
3280
|
});
|
|
2606
3281
|
|
|
2607
3282
|
// src/schema/browser.ts
|
|
2608
|
-
import { z as
|
|
2609
|
-
var BrowserClientInstance =
|
|
2610
|
-
var BrowserKind =
|
|
2611
|
-
var BrowserSessionState =
|
|
2612
|
-
var BrowserSession =
|
|
3283
|
+
import { z as z32 } from "zod";
|
|
3284
|
+
var BrowserClientInstance = z32.string().min(1).max(64).regex(/^[A-Za-z0-9_.:-]+$/);
|
|
3285
|
+
var BrowserKind = z32.enum(["chrome", "edge", "brave", "arc", "opera", "vivaldi", "chromium", "firefox", "other"]);
|
|
3286
|
+
var BrowserSessionState = z32.enum(["connected", "different_account", "extension_signed_out", "device_signed_out", "unverified"]);
|
|
3287
|
+
var BrowserSession = z32.strictObject({
|
|
2613
3288
|
client_instance: BrowserClientInstance,
|
|
2614
3289
|
/** What the person sees ("Chrome — Work"), set by the extension. */
|
|
2615
|
-
client_label:
|
|
3290
|
+
client_label: z32.string().min(1).max(128),
|
|
2616
3291
|
browser: BrowserKind,
|
|
2617
|
-
extension_version:
|
|
3292
|
+
extension_version: z32.string().min(1).max(32),
|
|
2618
3293
|
state: BrowserSessionState,
|
|
2619
3294
|
/** True only for `connected`: an agent's call can reach this session. */
|
|
2620
|
-
routable:
|
|
3295
|
+
routable: z32.boolean(),
|
|
2621
3296
|
/** The extension's account email from its token (null when signed out or unknown). */
|
|
2622
|
-
account_email:
|
|
3297
|
+
account_email: z32.string().max(320).nullable(),
|
|
2623
3298
|
connected_at_ms: epochMs,
|
|
2624
3299
|
last_call_at_ms: epochMs.nullable(),
|
|
2625
3300
|
calls: nonNegInt,
|
|
@@ -2628,687 +3303,687 @@ var BrowserSession = z31.strictObject({
|
|
|
2628
3303
|
p50_ms: nonNegInt.nullable(),
|
|
2629
3304
|
p95_ms: nonNegInt.nullable(),
|
|
2630
3305
|
/** A call is waiting for the person to confirm it in the browser. */
|
|
2631
|
-
awaiting_confirmation:
|
|
3306
|
+
awaiting_confirmation: z32.boolean()
|
|
2632
3307
|
});
|
|
2633
|
-
var BrowserRegisterParams =
|
|
3308
|
+
var BrowserRegisterParams = z32.strictObject({
|
|
2634
3309
|
client_instance: BrowserClientInstance,
|
|
2635
|
-
client_label:
|
|
3310
|
+
client_label: z32.string().min(1).max(128),
|
|
2636
3311
|
browser: BrowserKind,
|
|
2637
|
-
extension_version:
|
|
3312
|
+
extension_version: z32.string().min(1).max(32),
|
|
2638
3313
|
/** The extension's current AI Matrx access token, checked against the device owner; null when signed out. */
|
|
2639
|
-
account_token:
|
|
3314
|
+
account_token: z32.string().min(16).max(8192).nullable()
|
|
2640
3315
|
});
|
|
2641
|
-
var BrowserRegisterResult =
|
|
2642
|
-
var BrowserCallError =
|
|
2643
|
-
message:
|
|
3316
|
+
var BrowserRegisterResult = z32.strictObject({ session: BrowserSession });
|
|
3317
|
+
var BrowserCallError = z32.strictObject({
|
|
3318
|
+
message: z32.string().max(1e3),
|
|
2644
3319
|
/** The extension's own error code, when it has one ("tool_not_found", "denied"). */
|
|
2645
|
-
code:
|
|
3320
|
+
code: z32.string().max(64).nullable()
|
|
2646
3321
|
});
|
|
2647
|
-
var BrowserResultParams =
|
|
2648
|
-
call_id:
|
|
2649
|
-
ok:
|
|
3322
|
+
var BrowserResultParams = z32.strictObject({
|
|
3323
|
+
call_id: z32.string().min(1).max(64),
|
|
3324
|
+
ok: z32.boolean(),
|
|
2650
3325
|
/** The tool's result when ok (any JSON). */
|
|
2651
|
-
result:
|
|
3326
|
+
result: z32.unknown(),
|
|
2652
3327
|
error: BrowserCallError.nullable()
|
|
2653
3328
|
});
|
|
2654
|
-
var BrowserResultResult =
|
|
2655
|
-
var BrowserCallPhase =
|
|
2656
|
-
var BrowserProgressParams =
|
|
2657
|
-
var BrowserProgressResult =
|
|
2658
|
-
var BrowserSessionsParams =
|
|
2659
|
-
var BrowserSessionsResult =
|
|
3329
|
+
var BrowserResultResult = z32.strictObject({ accepted: z32.boolean() });
|
|
3330
|
+
var BrowserCallPhase = z32.enum(["awaiting_confirmation", "running"]);
|
|
3331
|
+
var BrowserProgressParams = z32.strictObject({ call_id: z32.string().min(1).max(64), phase: BrowserCallPhase });
|
|
3332
|
+
var BrowserProgressResult = z32.strictObject({ accepted: z32.boolean() });
|
|
3333
|
+
var BrowserSessionsParams = z32.strictObject({});
|
|
3334
|
+
var BrowserSessionsResult = z32.strictObject({
|
|
2660
3335
|
/** The person's Browser connection switch. Off: no pairing, no extension sessions. */
|
|
2661
|
-
enabled:
|
|
3336
|
+
enabled: z32.boolean(),
|
|
2662
3337
|
/** Whether Matrx 2 is signed in (without an owner no session is routable). */
|
|
2663
|
-
owner_signed_in:
|
|
2664
|
-
sessions:
|
|
2665
|
-
});
|
|
2666
|
-
var BrowserDisconnectParams =
|
|
2667
|
-
var BrowserDisconnectResult =
|
|
2668
|
-
var BrowserSetEnabledParams =
|
|
2669
|
-
var BrowserSetEnabledResult =
|
|
2670
|
-
var BrowserPairCodeParams =
|
|
2671
|
-
var BrowserPairCodeResult =
|
|
2672
|
-
var BrowserPairResetParams =
|
|
2673
|
-
var BrowserCallParams =
|
|
2674
|
-
tool:
|
|
2675
|
-
args:
|
|
3338
|
+
owner_signed_in: z32.boolean(),
|
|
3339
|
+
sessions: z32.array(BrowserSession).max(64)
|
|
3340
|
+
});
|
|
3341
|
+
var BrowserDisconnectParams = z32.strictObject({ client_instance: BrowserClientInstance });
|
|
3342
|
+
var BrowserDisconnectResult = z32.strictObject({ disconnected: z32.boolean() });
|
|
3343
|
+
var BrowserSetEnabledParams = z32.strictObject({ enabled: z32.boolean() });
|
|
3344
|
+
var BrowserSetEnabledResult = z32.strictObject({ enabled: z32.boolean() });
|
|
3345
|
+
var BrowserPairCodeParams = z32.strictObject({});
|
|
3346
|
+
var BrowserPairCodeResult = z32.strictObject({ code: z32.string().min(16).max(128) });
|
|
3347
|
+
var BrowserPairResetParams = z32.strictObject({});
|
|
3348
|
+
var BrowserCallParams = z32.strictObject({
|
|
3349
|
+
tool: z32.string().min(1).max(96).regex(/^[a-z][a-z0-9_]*$/),
|
|
3350
|
+
args: z32.record(z32.string(), z32.unknown()),
|
|
2676
3351
|
/** Which session; default: the most recently active routable one (BROWSER ambiguity → CONFLICT). */
|
|
2677
3352
|
client_instance: BrowserClientInstance.optional(),
|
|
2678
3353
|
/** How long to wait, including a person's confirmation; default 120 s. */
|
|
2679
|
-
timeout_ms:
|
|
3354
|
+
timeout_ms: z32.int().min(1e3).max(6e5).optional()
|
|
2680
3355
|
});
|
|
2681
|
-
var BrowserCallResult =
|
|
3356
|
+
var BrowserCallResult = z32.strictObject({
|
|
2682
3357
|
client_instance: BrowserClientInstance,
|
|
2683
|
-
result:
|
|
3358
|
+
result: z32.unknown(),
|
|
2684
3359
|
duration_ms: nonNegInt
|
|
2685
3360
|
});
|
|
2686
|
-
var BrowserToolMetricsParams =
|
|
2687
|
-
var BrowserToolMetric =
|
|
2688
|
-
tool:
|
|
3361
|
+
var BrowserToolMetricsParams = z32.strictObject({ client_instance: BrowserClientInstance });
|
|
3362
|
+
var BrowserToolMetric = z32.strictObject({
|
|
3363
|
+
tool: z32.string().max(256),
|
|
2689
3364
|
calls: nonNegInt,
|
|
2690
3365
|
errors: nonNegInt,
|
|
2691
3366
|
/** Over the last 200 answered calls; null before the first answer. */
|
|
2692
3367
|
p50_ms: nonNegInt.nullable(),
|
|
2693
3368
|
p95_ms: nonNegInt.nullable(),
|
|
2694
3369
|
last_call_at_ms: epochMs.nullable(),
|
|
2695
|
-
last_error:
|
|
3370
|
+
last_error: z32.string().max(2048).nullable()
|
|
2696
3371
|
});
|
|
2697
|
-
var BrowserToolMetricsResult =
|
|
2698
|
-
var BrowserResetCountersParams =
|
|
2699
|
-
var BrowserResetCountersResult =
|
|
2700
|
-
var BrowserLogParams =
|
|
3372
|
+
var BrowserToolMetricsResult = z32.strictObject({ client_instance: z32.string(), tools: z32.array(BrowserToolMetric) });
|
|
3373
|
+
var BrowserResetCountersParams = z32.strictObject({ client_instance: BrowserClientInstance });
|
|
3374
|
+
var BrowserResetCountersResult = z32.strictObject({ reset: z32.boolean() });
|
|
3375
|
+
var BrowserLogParams = z32.strictObject({
|
|
2701
3376
|
/** Only messages after this seq (0: from the oldest kept; the core keeps the last 500). */
|
|
2702
3377
|
after_seq: nonNegInt.default(0),
|
|
2703
|
-
limit:
|
|
3378
|
+
limit: z32.int().min(1).max(500).default(500)
|
|
2704
3379
|
});
|
|
2705
|
-
var BrowserLogMessage =
|
|
3380
|
+
var BrowserLogMessage = z32.strictObject({
|
|
2706
3381
|
seq: nonNegInt,
|
|
2707
3382
|
at_ms: epochMs,
|
|
2708
|
-
direction:
|
|
2709
|
-
client_instance:
|
|
2710
|
-
kind:
|
|
2711
|
-
tool:
|
|
2712
|
-
call_id:
|
|
2713
|
-
ok:
|
|
2714
|
-
detail:
|
|
2715
|
-
});
|
|
2716
|
-
var BrowserLogResult =
|
|
2717
|
-
messages:
|
|
3383
|
+
direction: z32.enum(["to_browser", "from_browser", "core"]),
|
|
3384
|
+
client_instance: z32.string(),
|
|
3385
|
+
kind: z32.enum(["register", "invoke", "result", "progress", "timeout", "closed"]),
|
|
3386
|
+
tool: z32.string().nullable(),
|
|
3387
|
+
call_id: z32.string().nullable(),
|
|
3388
|
+
ok: z32.boolean().nullable(),
|
|
3389
|
+
detail: z32.string().max(1024)
|
|
3390
|
+
});
|
|
3391
|
+
var BrowserLogResult = z32.strictObject({
|
|
3392
|
+
messages: z32.array(BrowserLogMessage),
|
|
2718
3393
|
/** The newest seq the core has written (pass it back as after_seq to follow the log). */
|
|
2719
3394
|
last_seq: nonNegInt
|
|
2720
3395
|
});
|
|
2721
|
-
var BrowserInvokeEvent =
|
|
2722
|
-
call_id:
|
|
2723
|
-
tool:
|
|
2724
|
-
args:
|
|
3396
|
+
var BrowserInvokeEvent = z32.strictObject({
|
|
3397
|
+
call_id: z32.string().min(1).max(64),
|
|
3398
|
+
tool: z32.string().min(1).max(96),
|
|
3399
|
+
args: z32.record(z32.string(), z32.unknown()),
|
|
2725
3400
|
deadline_ms: epochMs
|
|
2726
3401
|
});
|
|
2727
|
-
var BrowserSessionsChangedEvent =
|
|
2728
|
-
var BrowserProgressEvent =
|
|
2729
|
-
call_id:
|
|
3402
|
+
var BrowserSessionsChangedEvent = z32.strictObject({ count: nonNegInt, enabled: z32.boolean() });
|
|
3403
|
+
var BrowserProgressEvent = z32.strictObject({
|
|
3404
|
+
call_id: z32.string().min(1).max(64),
|
|
2730
3405
|
client_instance: BrowserClientInstance,
|
|
2731
3406
|
phase: BrowserCallPhase
|
|
2732
3407
|
});
|
|
2733
|
-
var DesktopHealth =
|
|
2734
|
-
status:
|
|
2735
|
-
service:
|
|
2736
|
-
version:
|
|
2737
|
-
protocol_version:
|
|
2738
|
-
ws_path:
|
|
2739
|
-
device_id:
|
|
2740
|
-
browser_connection:
|
|
2741
|
-
});
|
|
2742
|
-
var BrowserPairRequest =
|
|
2743
|
-
var BrowserPairResult =
|
|
3408
|
+
var DesktopHealth = z32.strictObject({
|
|
3409
|
+
status: z32.literal("ok"),
|
|
3410
|
+
service: z32.literal("matrx-desktop"),
|
|
3411
|
+
version: z32.string().max(32),
|
|
3412
|
+
protocol_version: z32.string().max(16),
|
|
3413
|
+
ws_path: z32.literal("/v1/connect"),
|
|
3414
|
+
device_id: z32.string().max(64),
|
|
3415
|
+
browser_connection: z32.enum(["on", "off"])
|
|
3416
|
+
});
|
|
3417
|
+
var BrowserPairRequest = z32.strictObject({ client_instance: BrowserClientInstance });
|
|
3418
|
+
var BrowserPairResult = z32.strictObject({ pair_token: z32.string().min(16).max(128), ws_path: z32.literal("/v1/connect") });
|
|
2744
3419
|
|
|
2745
3420
|
// src/schema/net.ts
|
|
2746
|
-
import { z as
|
|
2747
|
-
var NetInfoParams =
|
|
2748
|
-
var NetAddress =
|
|
2749
|
-
address:
|
|
2750
|
-
family:
|
|
2751
|
-
netmask:
|
|
3421
|
+
import { z as z33 } from "zod";
|
|
3422
|
+
var NetInfoParams = z33.strictObject({});
|
|
3423
|
+
var NetAddress = z33.strictObject({
|
|
3424
|
+
address: z33.string(),
|
|
3425
|
+
family: z33.enum(["ipv4", "ipv6"]),
|
|
3426
|
+
netmask: z33.string().nullable(),
|
|
2752
3427
|
/** CIDR form ("192.168.1.20/24"); null where the OS gives no prefix. */
|
|
2753
|
-
cidr:
|
|
3428
|
+
cidr: z33.string().nullable()
|
|
2754
3429
|
});
|
|
2755
|
-
var NetInterface =
|
|
2756
|
-
name:
|
|
2757
|
-
mac:
|
|
3430
|
+
var NetInterface = z33.strictObject({
|
|
3431
|
+
name: z33.string(),
|
|
3432
|
+
mac: z33.string().nullable(),
|
|
2758
3433
|
/** Loopback and other internal interfaces. */
|
|
2759
|
-
internal:
|
|
2760
|
-
addresses:
|
|
3434
|
+
internal: z33.boolean(),
|
|
3435
|
+
addresses: z33.array(NetAddress)
|
|
2761
3436
|
});
|
|
2762
|
-
var NetInfoResult =
|
|
2763
|
-
hostname:
|
|
2764
|
-
interfaces:
|
|
3437
|
+
var NetInfoResult = z33.strictObject({
|
|
3438
|
+
hostname: z33.string(),
|
|
3439
|
+
interfaces: z33.array(NetInterface),
|
|
2765
3440
|
/** The default route's gateway; null when the OS does not say (or there is none). */
|
|
2766
|
-
gateway:
|
|
3441
|
+
gateway: z33.string().nullable(),
|
|
2767
3442
|
/** The DNS servers the OS uses; empty when it does not say. */
|
|
2768
|
-
dns:
|
|
3443
|
+
dns: z33.array(z33.string())
|
|
2769
3444
|
});
|
|
2770
|
-
var NetWifiParams =
|
|
2771
|
-
var NetWifiNetwork =
|
|
3445
|
+
var NetWifiParams = z33.strictObject({});
|
|
3446
|
+
var NetWifiNetwork = z33.strictObject({
|
|
2772
3447
|
/** null: the OS hides the name (macOS without Location Services for this app). */
|
|
2773
|
-
ssid:
|
|
3448
|
+
ssid: z33.string().nullable(),
|
|
2774
3449
|
/** dBm; null where the OS does not say. */
|
|
2775
|
-
rssi:
|
|
2776
|
-
channel:
|
|
2777
|
-
security:
|
|
3450
|
+
rssi: z33.int().nullable(),
|
|
3451
|
+
channel: z33.string().nullable(),
|
|
3452
|
+
security: z33.string().nullable()
|
|
2778
3453
|
});
|
|
2779
|
-
var NetWifiResult =
|
|
3454
|
+
var NetWifiResult = z33.strictObject({
|
|
2780
3455
|
/** Whether the computer has a Wi-Fi interface at all. */
|
|
2781
|
-
available:
|
|
3456
|
+
available: z33.boolean(),
|
|
2782
3457
|
/** The network the computer is on; null when it is on none. */
|
|
2783
3458
|
current: NetWifiNetwork.nullable(),
|
|
2784
3459
|
/** Networks in range (may be empty where the OS lists none to apps). */
|
|
2785
|
-
networks:
|
|
3460
|
+
networks: z33.array(NetWifiNetwork)
|
|
2786
3461
|
});
|
|
2787
|
-
var NetBluetoothParams =
|
|
2788
|
-
var NetBluetoothDevice =
|
|
2789
|
-
name:
|
|
2790
|
-
address:
|
|
2791
|
-
connected:
|
|
3462
|
+
var NetBluetoothParams = z33.strictObject({});
|
|
3463
|
+
var NetBluetoothDevice = z33.strictObject({
|
|
3464
|
+
name: z33.string(),
|
|
3465
|
+
address: z33.string().nullable(),
|
|
3466
|
+
connected: z33.boolean(),
|
|
2792
3467
|
/** What it is, in the OS's words ("Headphones", "Keyboard"); null where it does not say. */
|
|
2793
|
-
kind:
|
|
3468
|
+
kind: z33.string().nullable(),
|
|
2794
3469
|
/** Battery percent, where the OS reports it. */
|
|
2795
|
-
battery:
|
|
3470
|
+
battery: z33.int().min(0).max(100).nullable()
|
|
2796
3471
|
});
|
|
2797
|
-
var NetBluetoothResult =
|
|
3472
|
+
var NetBluetoothResult = z33.strictObject({
|
|
2798
3473
|
/** Bluetooth is on; null where the OS does not say. */
|
|
2799
|
-
powered:
|
|
2800
|
-
devices:
|
|
2801
|
-
});
|
|
2802
|
-
var NetDevicesParams =
|
|
2803
|
-
var NetDevice =
|
|
2804
|
-
ip:
|
|
2805
|
-
mac:
|
|
2806
|
-
interface:
|
|
3474
|
+
powered: z33.boolean().nullable(),
|
|
3475
|
+
devices: z33.array(NetBluetoothDevice)
|
|
3476
|
+
});
|
|
3477
|
+
var NetDevicesParams = z33.strictObject({});
|
|
3478
|
+
var NetDevice = z33.strictObject({
|
|
3479
|
+
ip: z33.string(),
|
|
3480
|
+
mac: z33.string().nullable(),
|
|
3481
|
+
interface: z33.string().nullable(),
|
|
2807
3482
|
/** The name the local network gives it (reverse DNS / mDNS), when the table carries one. */
|
|
2808
|
-
hostname:
|
|
3483
|
+
hostname: z33.string().nullable()
|
|
2809
3484
|
});
|
|
2810
|
-
var NetDevicesResult =
|
|
2811
|
-
var NetMdnsParams =
|
|
3485
|
+
var NetDevicesResult = z33.strictObject({ devices: z33.array(NetDevice) });
|
|
3486
|
+
var NetMdnsParams = z33.strictObject({
|
|
2812
3487
|
/** A service type ("_http._tcp"); absent lists the service types found. */
|
|
2813
|
-
service_type:
|
|
3488
|
+
service_type: z33.string().min(1).max(64).regex(/^_[A-Za-z0-9-]+\._(tcp|udp)$/).optional(),
|
|
2814
3489
|
/** How long to listen. */
|
|
2815
|
-
timeout_s:
|
|
3490
|
+
timeout_s: z33.int().min(1).max(30).default(3)
|
|
2816
3491
|
});
|
|
2817
|
-
var NetMdnsService =
|
|
2818
|
-
name:
|
|
2819
|
-
type:
|
|
2820
|
-
domain:
|
|
2821
|
-
interface:
|
|
3492
|
+
var NetMdnsService = z33.strictObject({
|
|
3493
|
+
name: z33.string(),
|
|
3494
|
+
type: z33.string(),
|
|
3495
|
+
domain: z33.string(),
|
|
3496
|
+
interface: z33.string().nullable()
|
|
2822
3497
|
});
|
|
2823
|
-
var NetMdnsResult =
|
|
2824
|
-
var NetScanParams =
|
|
3498
|
+
var NetMdnsResult = z33.strictObject({ services: z33.array(NetMdnsService) });
|
|
3499
|
+
var NetScanParams = z33.strictObject({
|
|
2825
3500
|
/** A host name or address; a private or loopback address unless `allow_public`. */
|
|
2826
|
-
host:
|
|
2827
|
-
ports:
|
|
2828
|
-
timeout_ms:
|
|
3501
|
+
host: z33.string().min(1).max(253),
|
|
3502
|
+
ports: z33.array(z33.int().min(1).max(65535)).min(1).max(1024),
|
|
3503
|
+
timeout_ms: z33.int().min(50).max(1e4).default(800),
|
|
2829
3504
|
/** Scanning a host on the public internet needs saying so. */
|
|
2830
|
-
allow_public:
|
|
3505
|
+
allow_public: z33.boolean().default(false)
|
|
2831
3506
|
});
|
|
2832
|
-
var NetScanResult =
|
|
2833
|
-
host:
|
|
3507
|
+
var NetScanResult = z33.strictObject({
|
|
3508
|
+
host: z33.string(),
|
|
2834
3509
|
/** The address the host resolved to. */
|
|
2835
|
-
address:
|
|
2836
|
-
open:
|
|
3510
|
+
address: z33.string(),
|
|
3511
|
+
open: z33.array(z33.int().min(1).max(65535)),
|
|
2837
3512
|
closed: nonNegInt,
|
|
2838
3513
|
elapsed_ms: nonNegInt
|
|
2839
3514
|
});
|
|
2840
|
-
var NetDownloadParams =
|
|
2841
|
-
url:
|
|
3515
|
+
var NetDownloadParams = z33.strictObject({
|
|
3516
|
+
url: z33.string().min(1).max(8192).regex(/^https?:\/\//),
|
|
2842
3517
|
/** Where to save it: an absolute path (a folder keeps the URL's file name). */
|
|
2843
3518
|
path: AbsPath,
|
|
2844
|
-
overwrite:
|
|
2845
|
-
timeout_s:
|
|
3519
|
+
overwrite: z33.boolean().default(false),
|
|
3520
|
+
timeout_s: z33.int().min(1).max(3600).default(300),
|
|
2846
3521
|
/** Refuse anything larger. */
|
|
2847
|
-
max_bytes:
|
|
3522
|
+
max_bytes: z33.int().min(1).max(10737418240).default(2147483648)
|
|
2848
3523
|
});
|
|
2849
|
-
var NetDownloadResult =
|
|
2850
|
-
path:
|
|
3524
|
+
var NetDownloadResult = z33.strictObject({
|
|
3525
|
+
path: z33.string(),
|
|
2851
3526
|
bytes: nonNegInt,
|
|
2852
|
-
content_type:
|
|
3527
|
+
content_type: z33.string().nullable(),
|
|
2853
3528
|
/** The final URL after redirects. */
|
|
2854
|
-
url:
|
|
3529
|
+
url: z33.string(),
|
|
2855
3530
|
elapsed_ms: nonNegInt
|
|
2856
3531
|
});
|
|
2857
3532
|
|
|
2858
3533
|
// src/schema/personal.ts
|
|
2859
|
-
import { z as
|
|
2860
|
-
var Text =
|
|
2861
|
-
var AutomationScriptParams =
|
|
3534
|
+
import { z as z34 } from "zod";
|
|
3535
|
+
var Text = z34.string().max(65536);
|
|
3536
|
+
var AutomationScriptParams = z34.strictObject({
|
|
2862
3537
|
/** applescript and jxa: macOS (osascript); powershell: Windows (and pwsh where installed). */
|
|
2863
|
-
language:
|
|
2864
|
-
script:
|
|
2865
|
-
timeout_s:
|
|
2866
|
-
});
|
|
2867
|
-
var AutomationScriptResult =
|
|
2868
|
-
stdout:
|
|
2869
|
-
stderr:
|
|
2870
|
-
exit_code:
|
|
2871
|
-
timed_out:
|
|
3538
|
+
language: z34.enum(["applescript", "jxa", "powershell"]),
|
|
3539
|
+
script: z34.string().min(1).max(262144),
|
|
3540
|
+
timeout_s: z34.int().min(1).max(600).default(60)
|
|
3541
|
+
});
|
|
3542
|
+
var AutomationScriptResult = z34.strictObject({
|
|
3543
|
+
stdout: z34.string(),
|
|
3544
|
+
stderr: z34.string(),
|
|
3545
|
+
exit_code: z34.int(),
|
|
3546
|
+
timed_out: z34.boolean(),
|
|
2872
3547
|
/** stdout or stderr was cut at 1 MiB. */
|
|
2873
|
-
truncated:
|
|
3548
|
+
truncated: z34.boolean(),
|
|
2874
3549
|
elapsed_ms: nonNegInt
|
|
2875
3550
|
});
|
|
2876
|
-
var MailAccountsParams =
|
|
2877
|
-
var MailAccount =
|
|
2878
|
-
var MailAccountsResult =
|
|
2879
|
-
var MailListParams =
|
|
3551
|
+
var MailAccountsParams = z34.strictObject({});
|
|
3552
|
+
var MailAccount = z34.strictObject({ name: z34.string(), emails: z34.array(z34.string()), enabled: z34.boolean() });
|
|
3553
|
+
var MailAccountsResult = z34.strictObject({ accounts: z34.array(MailAccount) });
|
|
3554
|
+
var MailListParams = z34.strictObject({
|
|
2880
3555
|
/** The account's name in Mail; absent: every account. */
|
|
2881
|
-
account:
|
|
3556
|
+
account: z34.string().min(1).max(256).optional(),
|
|
2882
3557
|
/** The mailbox's name ("INBOX", "Sent Messages"). */
|
|
2883
|
-
mailbox:
|
|
2884
|
-
unread_only:
|
|
2885
|
-
limit:
|
|
2886
|
-
});
|
|
2887
|
-
var MailMessage =
|
|
2888
|
-
id:
|
|
2889
|
-
subject:
|
|
2890
|
-
sender:
|
|
3558
|
+
mailbox: z34.string().min(1).max(256).default("INBOX"),
|
|
3559
|
+
unread_only: z34.boolean().default(false),
|
|
3560
|
+
limit: z34.int().min(1).max(200).default(25)
|
|
3561
|
+
});
|
|
3562
|
+
var MailMessage = z34.strictObject({
|
|
3563
|
+
id: z34.string(),
|
|
3564
|
+
subject: z34.string(),
|
|
3565
|
+
sender: z34.string(),
|
|
2891
3566
|
received_at_ms: epochMs.nullable(),
|
|
2892
|
-
read:
|
|
2893
|
-
account:
|
|
2894
|
-
mailbox:
|
|
3567
|
+
read: z34.boolean(),
|
|
3568
|
+
account: z34.string(),
|
|
3569
|
+
mailbox: z34.string(),
|
|
2895
3570
|
/** The first lines of the message's text. */
|
|
2896
|
-
preview:
|
|
3571
|
+
preview: z34.string()
|
|
2897
3572
|
});
|
|
2898
|
-
var MailListResult =
|
|
2899
|
-
var MailSendParams =
|
|
2900
|
-
to:
|
|
2901
|
-
cc:
|
|
2902
|
-
subject:
|
|
3573
|
+
var MailListResult = z34.strictObject({ messages: z34.array(MailMessage) });
|
|
3574
|
+
var MailSendParams = z34.strictObject({
|
|
3575
|
+
to: z34.array(z34.string().min(3).max(320)).min(1).max(50),
|
|
3576
|
+
cc: z34.array(z34.string().min(3).max(320)).max(50).default([]),
|
|
3577
|
+
subject: z34.string().max(998),
|
|
2903
3578
|
body: Text,
|
|
2904
3579
|
/** The sending account's address; absent: Mail's default. */
|
|
2905
|
-
from:
|
|
3580
|
+
from: z34.string().min(3).max(320).optional(),
|
|
2906
3581
|
/** false leaves it open in Mail as a draft for the person to send. */
|
|
2907
|
-
send:
|
|
2908
|
-
});
|
|
2909
|
-
var MailSendResult =
|
|
2910
|
-
var MessagesChatsParams =
|
|
2911
|
-
var MessagesChat =
|
|
2912
|
-
chat_id:
|
|
2913
|
-
name:
|
|
2914
|
-
participants:
|
|
3582
|
+
send: z34.boolean().default(true)
|
|
3583
|
+
});
|
|
3584
|
+
var MailSendResult = z34.strictObject({ sent: z34.boolean() });
|
|
3585
|
+
var MessagesChatsParams = z34.strictObject({ limit: z34.int().min(1).max(200).default(25) });
|
|
3586
|
+
var MessagesChat = z34.strictObject({
|
|
3587
|
+
chat_id: z34.string(),
|
|
3588
|
+
name: z34.string().nullable(),
|
|
3589
|
+
participants: z34.array(z34.string()),
|
|
2915
3590
|
last_message_at_ms: epochMs.nullable(),
|
|
2916
|
-
service:
|
|
3591
|
+
service: z34.string().nullable()
|
|
2917
3592
|
});
|
|
2918
|
-
var MessagesChatsResult =
|
|
2919
|
-
var MessagesListParams =
|
|
3593
|
+
var MessagesChatsResult = z34.strictObject({ chats: z34.array(MessagesChat) });
|
|
3594
|
+
var MessagesListParams = z34.strictObject({
|
|
2920
3595
|
/** One chat (messages.chats' chat_id); absent: the newest across all. */
|
|
2921
|
-
chat_id:
|
|
2922
|
-
limit:
|
|
2923
|
-
});
|
|
2924
|
-
var MessagesMessage =
|
|
2925
|
-
id:
|
|
2926
|
-
chat_id:
|
|
2927
|
-
text:
|
|
2928
|
-
from_me:
|
|
3596
|
+
chat_id: z34.string().min(1).max(512).optional(),
|
|
3597
|
+
limit: z34.int().min(1).max(500).default(50)
|
|
3598
|
+
});
|
|
3599
|
+
var MessagesMessage = z34.strictObject({
|
|
3600
|
+
id: z34.string(),
|
|
3601
|
+
chat_id: z34.string().nullable(),
|
|
3602
|
+
text: z34.string(),
|
|
3603
|
+
from_me: z34.boolean(),
|
|
2929
3604
|
/** The other person's handle (phone or email); null for the person's own messages. */
|
|
2930
|
-
sender:
|
|
3605
|
+
sender: z34.string().nullable(),
|
|
2931
3606
|
sent_at_ms: epochMs.nullable()
|
|
2932
3607
|
});
|
|
2933
|
-
var MessagesListResult =
|
|
2934
|
-
var MessagesSendParams =
|
|
3608
|
+
var MessagesListResult = z34.strictObject({ messages: z34.array(MessagesMessage) });
|
|
3609
|
+
var MessagesSendParams = z34.strictObject({
|
|
2935
3610
|
/** A phone number or email the person can message. */
|
|
2936
|
-
to:
|
|
2937
|
-
text:
|
|
3611
|
+
to: z34.string().min(3).max(320),
|
|
3612
|
+
text: z34.string().min(1).max(2e4)
|
|
2938
3613
|
});
|
|
2939
|
-
var MessagesSendResult =
|
|
2940
|
-
var ContactsSearchParams =
|
|
3614
|
+
var MessagesSendResult = z34.strictObject({ sent: z34.boolean() });
|
|
3615
|
+
var ContactsSearchParams = z34.strictObject({
|
|
2941
3616
|
/** Matched against names, organizations, emails and phone numbers. */
|
|
2942
|
-
query:
|
|
2943
|
-
limit:
|
|
3617
|
+
query: z34.string().min(1).max(256),
|
|
3618
|
+
limit: z34.int().min(1).max(200).default(25)
|
|
2944
3619
|
});
|
|
2945
|
-
var ContactLabeled =
|
|
2946
|
-
var ContactSummary =
|
|
2947
|
-
id:
|
|
2948
|
-
name:
|
|
2949
|
-
organization:
|
|
2950
|
-
emails:
|
|
2951
|
-
phones:
|
|
2952
|
-
});
|
|
2953
|
-
var ContactsSearchResult =
|
|
2954
|
-
var ContactsGetParams =
|
|
2955
|
-
var ContactDetail =
|
|
2956
|
-
id:
|
|
2957
|
-
name:
|
|
2958
|
-
organization:
|
|
2959
|
-
job_title:
|
|
2960
|
-
emails:
|
|
2961
|
-
phones:
|
|
2962
|
-
addresses:
|
|
2963
|
-
birthday:
|
|
2964
|
-
note:
|
|
2965
|
-
});
|
|
2966
|
-
var ContactsGetResult =
|
|
2967
|
-
var CalendarListParams =
|
|
3620
|
+
var ContactLabeled = z34.strictObject({ label: z34.string().nullable(), value: z34.string() });
|
|
3621
|
+
var ContactSummary = z34.strictObject({
|
|
3622
|
+
id: z34.string(),
|
|
3623
|
+
name: z34.string(),
|
|
3624
|
+
organization: z34.string().nullable(),
|
|
3625
|
+
emails: z34.array(ContactLabeled),
|
|
3626
|
+
phones: z34.array(ContactLabeled)
|
|
3627
|
+
});
|
|
3628
|
+
var ContactsSearchResult = z34.strictObject({ contacts: z34.array(ContactSummary) });
|
|
3629
|
+
var ContactsGetParams = z34.strictObject({ id: z34.string().min(1).max(256) });
|
|
3630
|
+
var ContactDetail = z34.strictObject({
|
|
3631
|
+
id: z34.string(),
|
|
3632
|
+
name: z34.string(),
|
|
3633
|
+
organization: z34.string().nullable(),
|
|
3634
|
+
job_title: z34.string().nullable(),
|
|
3635
|
+
emails: z34.array(ContactLabeled),
|
|
3636
|
+
phones: z34.array(ContactLabeled),
|
|
3637
|
+
addresses: z34.array(ContactLabeled),
|
|
3638
|
+
birthday: z34.string().nullable(),
|
|
3639
|
+
note: z34.string().nullable()
|
|
3640
|
+
});
|
|
3641
|
+
var ContactsGetResult = z34.strictObject({ contact: ContactDetail });
|
|
3642
|
+
var CalendarListParams = z34.strictObject({
|
|
2968
3643
|
from_ms: epochMs,
|
|
2969
3644
|
to_ms: epochMs,
|
|
2970
3645
|
/** One calendar's name; absent: every calendar. */
|
|
2971
|
-
calendar:
|
|
2972
|
-
limit:
|
|
3646
|
+
calendar: z34.string().min(1).max(256).optional(),
|
|
3647
|
+
limit: z34.int().min(1).max(500).default(100)
|
|
2973
3648
|
});
|
|
2974
|
-
var CalendarEvent =
|
|
2975
|
-
id:
|
|
2976
|
-
title:
|
|
3649
|
+
var CalendarEvent = z34.strictObject({
|
|
3650
|
+
id: z34.string(),
|
|
3651
|
+
title: z34.string(),
|
|
2977
3652
|
start_ms: epochMs,
|
|
2978
3653
|
end_ms: epochMs,
|
|
2979
|
-
all_day:
|
|
2980
|
-
calendar:
|
|
2981
|
-
location:
|
|
2982
|
-
notes:
|
|
2983
|
-
});
|
|
2984
|
-
var CalendarListResult =
|
|
2985
|
-
var CalendarCreateParams =
|
|
2986
|
-
title:
|
|
3654
|
+
all_day: z34.boolean(),
|
|
3655
|
+
calendar: z34.string(),
|
|
3656
|
+
location: z34.string().nullable(),
|
|
3657
|
+
notes: z34.string().nullable()
|
|
3658
|
+
});
|
|
3659
|
+
var CalendarListResult = z34.strictObject({ events: z34.array(CalendarEvent) });
|
|
3660
|
+
var CalendarCreateParams = z34.strictObject({
|
|
3661
|
+
title: z34.string().min(1).max(1024),
|
|
2987
3662
|
start_ms: epochMs,
|
|
2988
3663
|
end_ms: epochMs,
|
|
2989
|
-
all_day:
|
|
3664
|
+
all_day: z34.boolean().default(false),
|
|
2990
3665
|
/** The calendar's name; absent: the first writable calendar. */
|
|
2991
|
-
calendar:
|
|
2992
|
-
location:
|
|
3666
|
+
calendar: z34.string().min(1).max(256).optional(),
|
|
3667
|
+
location: z34.string().max(1024).optional(),
|
|
2993
3668
|
notes: Text.optional()
|
|
2994
3669
|
});
|
|
2995
|
-
var CalendarCreateResult =
|
|
2996
|
-
var RemindersListParams =
|
|
3670
|
+
var CalendarCreateResult = z34.strictObject({ id: z34.string(), calendar: z34.string() });
|
|
3671
|
+
var RemindersListParams = z34.strictObject({
|
|
2997
3672
|
/** One list's name; absent: every list. */
|
|
2998
|
-
list:
|
|
2999
|
-
include_completed:
|
|
3000
|
-
limit:
|
|
3001
|
-
});
|
|
3002
|
-
var Reminder =
|
|
3003
|
-
id:
|
|
3004
|
-
title:
|
|
3005
|
-
list:
|
|
3673
|
+
list: z34.string().min(1).max(256).optional(),
|
|
3674
|
+
include_completed: z34.boolean().default(false),
|
|
3675
|
+
limit: z34.int().min(1).max(500).default(100)
|
|
3676
|
+
});
|
|
3677
|
+
var Reminder = z34.strictObject({
|
|
3678
|
+
id: z34.string(),
|
|
3679
|
+
title: z34.string(),
|
|
3680
|
+
list: z34.string(),
|
|
3006
3681
|
due_ms: epochMs.nullable(),
|
|
3007
|
-
completed:
|
|
3008
|
-
notes:
|
|
3682
|
+
completed: z34.boolean(),
|
|
3683
|
+
notes: z34.string().nullable()
|
|
3009
3684
|
});
|
|
3010
|
-
var RemindersListResult =
|
|
3011
|
-
var RemindersCreateParams =
|
|
3012
|
-
title:
|
|
3685
|
+
var RemindersListResult = z34.strictObject({ reminders: z34.array(Reminder) });
|
|
3686
|
+
var RemindersCreateParams = z34.strictObject({
|
|
3687
|
+
title: z34.string().min(1).max(1024),
|
|
3013
3688
|
due_ms: epochMs.optional(),
|
|
3014
|
-
list:
|
|
3689
|
+
list: z34.string().min(1).max(256).optional(),
|
|
3015
3690
|
notes: Text.optional()
|
|
3016
3691
|
});
|
|
3017
|
-
var RemindersCreateResult =
|
|
3018
|
-
var PhotosSearchParams =
|
|
3692
|
+
var RemindersCreateResult = z34.strictObject({ id: z34.string(), list: z34.string() });
|
|
3693
|
+
var PhotosSearchParams = z34.strictObject({
|
|
3019
3694
|
/** Matched against file names, titles, descriptions and keywords; absent: the newest. */
|
|
3020
|
-
query:
|
|
3695
|
+
query: z34.string().min(1).max(256).optional(),
|
|
3021
3696
|
from_ms: epochMs.optional(),
|
|
3022
3697
|
to_ms: epochMs.optional(),
|
|
3023
|
-
favorites_only:
|
|
3024
|
-
limit:
|
|
3698
|
+
favorites_only: z34.boolean().default(false),
|
|
3699
|
+
limit: z34.int().min(1).max(200).default(25)
|
|
3025
3700
|
});
|
|
3026
|
-
var Photo =
|
|
3027
|
-
id:
|
|
3028
|
-
filename:
|
|
3701
|
+
var Photo = z34.strictObject({
|
|
3702
|
+
id: z34.string(),
|
|
3703
|
+
filename: z34.string(),
|
|
3029
3704
|
taken_at_ms: epochMs.nullable(),
|
|
3030
3705
|
width: nonNegInt.nullable(),
|
|
3031
3706
|
height: nonNegInt.nullable(),
|
|
3032
|
-
favorite:
|
|
3033
|
-
title:
|
|
3707
|
+
favorite: z34.boolean(),
|
|
3708
|
+
title: z34.string().nullable()
|
|
3034
3709
|
});
|
|
3035
|
-
var PhotosSearchResult =
|
|
3036
|
-
var PhotosGetParams =
|
|
3037
|
-
id:
|
|
3710
|
+
var PhotosSearchResult = z34.strictObject({ photos: z34.array(Photo) });
|
|
3711
|
+
var PhotosGetParams = z34.strictObject({
|
|
3712
|
+
id: z34.string().min(1).max(256),
|
|
3038
3713
|
/** Copy the original into a folder Matrx 2 owns and answer its path (then fs_read or desktop_documents reads it). */
|
|
3039
|
-
export:
|
|
3714
|
+
export: z34.boolean().default(false)
|
|
3040
3715
|
});
|
|
3041
|
-
var PhotosGetResult =
|
|
3042
|
-
var LocationGetParams =
|
|
3043
|
-
var LocationGetResult =
|
|
3044
|
-
latitude:
|
|
3045
|
-
longitude:
|
|
3716
|
+
var PhotosGetResult = z34.strictObject({ photo: Photo, path: z34.string().nullable() });
|
|
3717
|
+
var LocationGetParams = z34.strictObject({ timeout_s: z34.int().min(1).max(60).default(15) });
|
|
3718
|
+
var LocationGetResult = z34.strictObject({
|
|
3719
|
+
latitude: z34.number().min(-90).max(90),
|
|
3720
|
+
longitude: z34.number().min(-180).max(180),
|
|
3046
3721
|
/** Metres; null where the OS does not say. */
|
|
3047
|
-
accuracy_m:
|
|
3722
|
+
accuracy_m: z34.number().min(0).nullable(),
|
|
3048
3723
|
at_ms: epochMs,
|
|
3049
3724
|
/** Who answered: the OS's own location service. */
|
|
3050
|
-
source:
|
|
3725
|
+
source: z34.enum(["corelocation", "windows", "geoclue"])
|
|
3051
3726
|
});
|
|
3052
3727
|
|
|
3053
3728
|
// src/schema/windows.ts
|
|
3054
|
-
import { z as
|
|
3055
|
-
var RegistryKey =
|
|
3056
|
-
var RegistryValueType =
|
|
3057
|
-
var WindowsRegistryReadParams =
|
|
3729
|
+
import { z as z35 } from "zod";
|
|
3730
|
+
var RegistryKey = z35.string().min(6).max(1024).regex(/^(HKLM|HKCU|HKCR|HKU|HKCC|HKEY_LOCAL_MACHINE|HKEY_CURRENT_USER|HKEY_CLASSES_ROOT|HKEY_USERS|HKEY_CURRENT_CONFIG)(\\.*)?$/);
|
|
3731
|
+
var RegistryValueType = z35.enum(["REG_SZ", "REG_EXPAND_SZ", "REG_MULTI_SZ", "REG_DWORD", "REG_QWORD", "REG_BINARY", "REG_NONE"]);
|
|
3732
|
+
var WindowsRegistryReadParams = z35.strictObject({
|
|
3058
3733
|
key: RegistryKey,
|
|
3059
3734
|
/** One value's name ("" is the key's default value); absent: every value and the subkeys. */
|
|
3060
|
-
name:
|
|
3735
|
+
name: z35.string().max(16383).optional()
|
|
3061
3736
|
});
|
|
3062
|
-
var RegistryValue =
|
|
3063
|
-
var WindowsRegistryReadResult =
|
|
3064
|
-
key:
|
|
3065
|
-
exists:
|
|
3066
|
-
values:
|
|
3067
|
-
subkeys:
|
|
3737
|
+
var RegistryValue = z35.strictObject({ name: z35.string(), type: RegistryValueType, data: z35.string() });
|
|
3738
|
+
var WindowsRegistryReadResult = z35.strictObject({
|
|
3739
|
+
key: z35.string(),
|
|
3740
|
+
exists: z35.boolean(),
|
|
3741
|
+
values: z35.array(RegistryValue),
|
|
3742
|
+
subkeys: z35.array(z35.string())
|
|
3068
3743
|
});
|
|
3069
|
-
var WindowsRegistryWriteParams =
|
|
3744
|
+
var WindowsRegistryWriteParams = z35.strictObject({
|
|
3070
3745
|
key: RegistryKey,
|
|
3071
|
-
name:
|
|
3746
|
+
name: z35.string().max(16383),
|
|
3072
3747
|
type: RegistryValueType.default("REG_SZ"),
|
|
3073
3748
|
/** As reg.exe takes it: text, a number, hex for binary, \\0 between the strings of a multi-string. */
|
|
3074
|
-
data:
|
|
3749
|
+
data: z35.string().max(1048576),
|
|
3075
3750
|
/** Remove the value instead of writing it. */
|
|
3076
|
-
delete:
|
|
3751
|
+
delete: z35.boolean().default(false)
|
|
3077
3752
|
});
|
|
3078
|
-
var WindowsRegistryWriteResult =
|
|
3079
|
-
var WindowsServicesParams =
|
|
3753
|
+
var WindowsRegistryWriteResult = z35.strictObject({ key: z35.string(), name: z35.string(), deleted: z35.boolean() });
|
|
3754
|
+
var WindowsServicesParams = z35.strictObject({
|
|
3080
3755
|
/** Matched against the service's name and display name. */
|
|
3081
|
-
filter:
|
|
3082
|
-
limit:
|
|
3756
|
+
filter: z35.string().min(1).max(256).optional(),
|
|
3757
|
+
limit: z35.int().min(1).max(1e3).default(200)
|
|
3083
3758
|
});
|
|
3084
|
-
var WindowsService =
|
|
3085
|
-
name:
|
|
3086
|
-
display_name:
|
|
3759
|
+
var WindowsService = z35.strictObject({
|
|
3760
|
+
name: z35.string(),
|
|
3761
|
+
display_name: z35.string(),
|
|
3087
3762
|
/** Running, Stopped, Paused… as Windows says it. */
|
|
3088
|
-
status:
|
|
3763
|
+
status: z35.string(),
|
|
3089
3764
|
/** Automatic, Manual, Disabled…; null where Windows does not say. */
|
|
3090
|
-
start_type:
|
|
3765
|
+
start_type: z35.string().nullable()
|
|
3091
3766
|
});
|
|
3092
|
-
var WindowsServicesResult =
|
|
3093
|
-
var WindowsServiceControlParams =
|
|
3094
|
-
name:
|
|
3095
|
-
action:
|
|
3767
|
+
var WindowsServicesResult = z35.strictObject({ services: z35.array(WindowsService) });
|
|
3768
|
+
var WindowsServiceControlParams = z35.strictObject({
|
|
3769
|
+
name: z35.string().min(1).max(256),
|
|
3770
|
+
action: z35.enum(["start", "stop", "restart"])
|
|
3096
3771
|
});
|
|
3097
|
-
var WindowsServiceControlResult =
|
|
3098
|
-
var WindowsEventLogParams =
|
|
3099
|
-
log:
|
|
3772
|
+
var WindowsServiceControlResult = z35.strictObject({ name: z35.string(), status: z35.string() });
|
|
3773
|
+
var WindowsEventLogParams = z35.strictObject({
|
|
3774
|
+
log: z35.string().min(1).max(256).default("System"),
|
|
3100
3775
|
/** Only these levels; absent: all. */
|
|
3101
|
-
levels:
|
|
3776
|
+
levels: z35.array(z35.enum(["critical", "error", "warning", "information", "verbose"])).max(5).optional(),
|
|
3102
3777
|
since_ms: epochMs.optional(),
|
|
3103
|
-
limit:
|
|
3778
|
+
limit: z35.int().min(1).max(500).default(50)
|
|
3104
3779
|
});
|
|
3105
|
-
var WindowsEvent =
|
|
3106
|
-
id:
|
|
3107
|
-
level:
|
|
3108
|
-
source:
|
|
3780
|
+
var WindowsEvent = z35.strictObject({
|
|
3781
|
+
id: z35.int(),
|
|
3782
|
+
level: z35.string(),
|
|
3783
|
+
source: z35.string(),
|
|
3109
3784
|
at_ms: epochMs,
|
|
3110
|
-
message:
|
|
3785
|
+
message: z35.string()
|
|
3111
3786
|
});
|
|
3112
|
-
var WindowsEventLogResult =
|
|
3113
|
-
var WindowsFeaturesParams =
|
|
3114
|
-
var WindowsFeature =
|
|
3115
|
-
var WindowsFeaturesResult =
|
|
3787
|
+
var WindowsEventLogResult = z35.strictObject({ log: z35.string(), events: z35.array(WindowsEvent) });
|
|
3788
|
+
var WindowsFeaturesParams = z35.strictObject({ filter: z35.string().min(1).max(256).optional() });
|
|
3789
|
+
var WindowsFeature = z35.strictObject({ name: z35.string(), state: z35.string() });
|
|
3790
|
+
var WindowsFeaturesResult = z35.strictObject({ features: z35.array(WindowsFeature) });
|
|
3116
3791
|
|
|
3117
3792
|
// src/schema/schedule.ts
|
|
3118
|
-
import { z as
|
|
3119
|
-
var OpRef =
|
|
3120
|
-
var ScheduleCreateParams =
|
|
3121
|
-
name:
|
|
3793
|
+
import { z as z36 } from "zod";
|
|
3794
|
+
var OpRef = z36.string().min(3).max(128).regex(/^[a-z_]+(\.[a-z_]+)+$/);
|
|
3795
|
+
var ScheduleCreateParams = z36.strictObject({
|
|
3796
|
+
name: z36.string().min(1).max(200),
|
|
3122
3797
|
op: OpRef,
|
|
3123
3798
|
/** The op's params, exactly as the op takes them; checked when the task is created. */
|
|
3124
|
-
params:
|
|
3125
|
-
interval_s:
|
|
3799
|
+
params: z36.record(z36.string(), z36.unknown()).default({}),
|
|
3800
|
+
interval_s: z36.int().min(10).max(2592e3),
|
|
3126
3801
|
/** Stop after this many runs; absent: until cancelled. */
|
|
3127
|
-
max_runs:
|
|
3802
|
+
max_runs: z36.int().min(1).max(1e5).optional(),
|
|
3128
3803
|
/** Run once now, before the first interval. */
|
|
3129
|
-
run_now:
|
|
3804
|
+
run_now: z36.boolean().default(false)
|
|
3130
3805
|
});
|
|
3131
|
-
var ScheduleRun =
|
|
3806
|
+
var ScheduleRun = z36.strictObject({
|
|
3132
3807
|
at_ms: epochMs,
|
|
3133
|
-
ok:
|
|
3808
|
+
ok: z36.boolean(),
|
|
3134
3809
|
elapsed_ms: nonNegInt,
|
|
3135
3810
|
/** The error's code and message when the run failed. */
|
|
3136
|
-
error:
|
|
3811
|
+
error: z36.string().nullable(),
|
|
3137
3812
|
/** The start of the answer, as JSON (cut at 4 KiB). */
|
|
3138
|
-
result_preview:
|
|
3813
|
+
result_preview: z36.string().nullable()
|
|
3139
3814
|
});
|
|
3140
|
-
var ScheduledTask =
|
|
3141
|
-
id:
|
|
3142
|
-
name:
|
|
3143
|
-
op:
|
|
3144
|
-
params:
|
|
3815
|
+
var ScheduledTask = z36.strictObject({
|
|
3816
|
+
id: z36.string(),
|
|
3817
|
+
name: z36.string(),
|
|
3818
|
+
op: z36.string(),
|
|
3819
|
+
params: z36.record(z36.string(), z36.unknown()),
|
|
3145
3820
|
interval_s: nonNegInt,
|
|
3146
3821
|
max_runs: nonNegInt.nullable(),
|
|
3147
3822
|
runs: nonNegInt,
|
|
3148
3823
|
created_at_ms: epochMs,
|
|
3149
3824
|
next_run_at_ms: epochMs.nullable(),
|
|
3150
3825
|
/** active, done (ran max_runs), cancelled. */
|
|
3151
|
-
state:
|
|
3826
|
+
state: z36.enum(["active", "done", "cancelled"]),
|
|
3152
3827
|
/** The newest runs, newest first (at most 10). */
|
|
3153
|
-
recent:
|
|
3828
|
+
recent: z36.array(ScheduleRun)
|
|
3154
3829
|
});
|
|
3155
|
-
var ScheduleCreateResult =
|
|
3156
|
-
var ScheduleListParams =
|
|
3157
|
-
var ScheduleListResult =
|
|
3158
|
-
var ScheduleCancelParams =
|
|
3159
|
-
var ScheduleCancelResult =
|
|
3830
|
+
var ScheduleCreateResult = z36.strictObject({ task: ScheduledTask });
|
|
3831
|
+
var ScheduleListParams = z36.strictObject({ include_finished: z36.boolean().default(false) });
|
|
3832
|
+
var ScheduleListResult = z36.strictObject({ tasks: z36.array(ScheduledTask) });
|
|
3833
|
+
var ScheduleCancelParams = z36.strictObject({ id: z36.string().min(1).max(64) });
|
|
3834
|
+
var ScheduleCancelResult = z36.strictObject({ task: ScheduledTask });
|
|
3160
3835
|
|
|
3161
3836
|
// src/schema/notes.ts
|
|
3162
|
-
import { z as
|
|
3163
|
-
var NoteFolder =
|
|
3164
|
-
var NotePath =
|
|
3165
|
-
var NotesFoldersParams =
|
|
3166
|
-
var NotesFolder =
|
|
3167
|
-
var NotesFoldersResult =
|
|
3837
|
+
import { z as z37 } from "zod";
|
|
3838
|
+
var NoteFolder = z37.string().min(1).max(512).regex(/^[^/\\:*?"<>|][^\\:*?"<>|]*$/);
|
|
3839
|
+
var NotePath = z37.string().min(4).max(1024).regex(/^[^/\\:*?"<>|][^\\:*?"<>|]*\.md$/);
|
|
3840
|
+
var NotesFoldersParams = z37.strictObject({});
|
|
3841
|
+
var NotesFolder = z37.strictObject({ folder: z37.string(), notes: nonNegInt });
|
|
3842
|
+
var NotesFoldersResult = z37.strictObject({
|
|
3168
3843
|
/** The notes root on this computer. */
|
|
3169
|
-
root:
|
|
3170
|
-
folders:
|
|
3844
|
+
root: z37.string(),
|
|
3845
|
+
folders: z37.array(NotesFolder)
|
|
3171
3846
|
});
|
|
3172
|
-
var NotesListParams =
|
|
3847
|
+
var NotesListParams = z37.strictObject({
|
|
3173
3848
|
folder: NoteFolder.optional(),
|
|
3174
|
-
limit:
|
|
3849
|
+
limit: z37.int().min(1).max(2e3).default(500)
|
|
3175
3850
|
});
|
|
3176
|
-
var NoteEntry =
|
|
3177
|
-
path:
|
|
3178
|
-
label:
|
|
3179
|
-
folder:
|
|
3851
|
+
var NoteEntry = z37.strictObject({
|
|
3852
|
+
path: z37.string(),
|
|
3853
|
+
label: z37.string(),
|
|
3854
|
+
folder: z37.string(),
|
|
3180
3855
|
bytes: nonNegInt,
|
|
3181
3856
|
modified_at_ms: epochMs
|
|
3182
3857
|
});
|
|
3183
|
-
var NotesListResult =
|
|
3184
|
-
var NotesReadParams =
|
|
3185
|
-
var NotesReadResult =
|
|
3186
|
-
path:
|
|
3187
|
-
content:
|
|
3858
|
+
var NotesListResult = z37.strictObject({ root: z37.string(), notes: z37.array(NoteEntry), total: nonNegInt });
|
|
3859
|
+
var NotesReadParams = z37.strictObject({ path: NotePath });
|
|
3860
|
+
var NotesReadResult = z37.strictObject({
|
|
3861
|
+
path: z37.string(),
|
|
3862
|
+
content: z37.string(),
|
|
3188
3863
|
bytes: nonNegInt,
|
|
3189
3864
|
modified_at_ms: epochMs,
|
|
3190
3865
|
/** SHA-256 of the content: pass it back as `if_hash` to write only over this version. */
|
|
3191
|
-
hash:
|
|
3866
|
+
hash: z37.string()
|
|
3192
3867
|
});
|
|
3193
|
-
var NotesWriteParams =
|
|
3868
|
+
var NotesWriteParams = z37.strictObject({
|
|
3194
3869
|
folder: NoteFolder.default("General"),
|
|
3195
3870
|
/** The note's name, without ".md". */
|
|
3196
|
-
label:
|
|
3197
|
-
content:
|
|
3871
|
+
label: z37.string().min(1).max(200).regex(/^[^/\\:*?"<>|]+$/),
|
|
3872
|
+
content: z37.string().max(10485760),
|
|
3198
3873
|
/** Write only when the note is still this version (notes.read's hash); a change since answers CONFLICT. */
|
|
3199
|
-
if_hash:
|
|
3874
|
+
if_hash: z37.string().length(64).optional()
|
|
3200
3875
|
});
|
|
3201
|
-
var NotesWriteResult =
|
|
3202
|
-
var NotesSearchParams =
|
|
3203
|
-
query:
|
|
3204
|
-
limit:
|
|
3876
|
+
var NotesWriteResult = z37.strictObject({ path: z37.string(), bytes: nonNegInt, created: z37.boolean(), hash: z37.string() });
|
|
3877
|
+
var NotesSearchParams = z37.strictObject({
|
|
3878
|
+
query: z37.string().min(1).max(512),
|
|
3879
|
+
limit: z37.int().min(1).max(200).default(50)
|
|
3205
3880
|
});
|
|
3206
|
-
var NotesMatch =
|
|
3207
|
-
path:
|
|
3208
|
-
label:
|
|
3209
|
-
folder:
|
|
3881
|
+
var NotesMatch = z37.strictObject({
|
|
3882
|
+
path: z37.string(),
|
|
3883
|
+
label: z37.string(),
|
|
3884
|
+
folder: z37.string(),
|
|
3210
3885
|
/** The matching lines (at most five), trimmed. */
|
|
3211
|
-
lines:
|
|
3886
|
+
lines: z37.array(z37.string())
|
|
3212
3887
|
});
|
|
3213
|
-
var NotesSearchResult =
|
|
3888
|
+
var NotesSearchResult = z37.strictObject({ matches: z37.array(NotesMatch), total: nonNegInt });
|
|
3214
3889
|
|
|
3215
3890
|
// src/schema/documents.ts
|
|
3216
|
-
import { z as
|
|
3891
|
+
import { z as z38 } from "zod";
|
|
3217
3892
|
var DOCUMENTS_MAX_TEXT_CHARS = 1048576;
|
|
3218
|
-
var DocumentsPdfTextParams =
|
|
3893
|
+
var DocumentsPdfTextParams = z38.strictObject({
|
|
3219
3894
|
path: AbsPath,
|
|
3220
3895
|
/** 1-based, inclusive. */
|
|
3221
|
-
first_page:
|
|
3222
|
-
last_page:
|
|
3223
|
-
max_chars:
|
|
3896
|
+
first_page: z38.int().min(1).optional(),
|
|
3897
|
+
last_page: z38.int().min(1).optional(),
|
|
3898
|
+
max_chars: z38.int().min(1).max(DOCUMENTS_MAX_TEXT_CHARS).default(2e5)
|
|
3224
3899
|
});
|
|
3225
|
-
var DocumentsPdfPage =
|
|
3226
|
-
var DocumentsPdfTextResult =
|
|
3900
|
+
var DocumentsPdfPage = z38.strictObject({ page: z38.int().min(1), text: z38.string() });
|
|
3901
|
+
var DocumentsPdfTextResult = z38.strictObject({
|
|
3227
3902
|
pages: nonNegInt,
|
|
3228
3903
|
/** Each page read, in order (an image-only page has empty text: OCR it). */
|
|
3229
|
-
read:
|
|
3230
|
-
truncated:
|
|
3231
|
-
title:
|
|
3232
|
-
author:
|
|
3904
|
+
read: z38.array(DocumentsPdfPage),
|
|
3905
|
+
truncated: z38.boolean(),
|
|
3906
|
+
title: z38.string().nullable(),
|
|
3907
|
+
author: z38.string().nullable()
|
|
3233
3908
|
});
|
|
3234
|
-
var DocumentsOcrParams =
|
|
3909
|
+
var DocumentsOcrParams = z38.strictObject({
|
|
3235
3910
|
path: AbsPath,
|
|
3236
3911
|
/** BCP-47 language hints ("en-US", "fr-FR"); absent: the OS's own choice. */
|
|
3237
|
-
languages:
|
|
3912
|
+
languages: z38.array(z38.string().min(2).max(16)).max(8).optional(),
|
|
3238
3913
|
/** Faster, less accurate. */
|
|
3239
|
-
fast:
|
|
3914
|
+
fast: z38.boolean().default(false)
|
|
3240
3915
|
});
|
|
3241
|
-
var DocumentsOcrLine =
|
|
3242
|
-
text:
|
|
3916
|
+
var DocumentsOcrLine = z38.strictObject({
|
|
3917
|
+
text: z38.string(),
|
|
3243
3918
|
/** 0–1; null where the engine does not say. */
|
|
3244
|
-
confidence:
|
|
3919
|
+
confidence: z38.number().min(0).max(1).nullable()
|
|
3245
3920
|
});
|
|
3246
|
-
var DocumentsOcrResult =
|
|
3247
|
-
text:
|
|
3248
|
-
lines:
|
|
3249
|
-
truncated:
|
|
3921
|
+
var DocumentsOcrResult = z38.strictObject({
|
|
3922
|
+
text: z38.string(),
|
|
3923
|
+
lines: z38.array(DocumentsOcrLine),
|
|
3924
|
+
truncated: z38.boolean(),
|
|
3250
3925
|
/** Which engine read it ("vision" on macOS, "windows-ocr", "tesseract"). */
|
|
3251
|
-
engine:
|
|
3926
|
+
engine: z38.string()
|
|
3252
3927
|
});
|
|
3253
|
-
var DocumentsImageResizeParams =
|
|
3928
|
+
var DocumentsImageResizeParams = z38.strictObject({
|
|
3254
3929
|
path: AbsPath,
|
|
3255
3930
|
/** Where to write it; absent: next to the original, "<name>-resized.<ext>". */
|
|
3256
3931
|
out_path: AbsPath.optional(),
|
|
3257
3932
|
/** The longest side, kept in proportion; absent: the size stays (a format change only). */
|
|
3258
|
-
max_size:
|
|
3259
|
-
format:
|
|
3260
|
-
overwrite:
|
|
3933
|
+
max_size: z38.int().min(1).max(32768).optional(),
|
|
3934
|
+
format: z38.enum(["png", "jpeg", "tiff", "heic", "bmp", "gif"]).optional(),
|
|
3935
|
+
overwrite: z38.boolean().default(false)
|
|
3261
3936
|
});
|
|
3262
|
-
var DocumentsImageResizeResult =
|
|
3263
|
-
path:
|
|
3937
|
+
var DocumentsImageResizeResult = z38.strictObject({
|
|
3938
|
+
path: z38.string(),
|
|
3264
3939
|
width: nonNegInt,
|
|
3265
3940
|
height: nonNegInt,
|
|
3266
3941
|
bytes: nonNegInt
|
|
3267
3942
|
});
|
|
3268
|
-
var DocumentsParagraph =
|
|
3269
|
-
style:
|
|
3270
|
-
text:
|
|
3943
|
+
var DocumentsParagraph = z38.strictObject({
|
|
3944
|
+
style: z38.enum(["title", "heading1", "heading2", "heading3", "body", "bullet", "numbered", "quote", "code"]).default("body"),
|
|
3945
|
+
text: z38.string().max(1e5)
|
|
3271
3946
|
});
|
|
3272
|
-
var DocumentsSheet =
|
|
3273
|
-
name:
|
|
3947
|
+
var DocumentsSheet = z38.strictObject({
|
|
3948
|
+
name: z38.string().min(1).max(31),
|
|
3274
3949
|
/** Rows of cells; the first row is the header when `header` is true. */
|
|
3275
|
-
rows:
|
|
3276
|
-
header:
|
|
3950
|
+
rows: z38.array(z38.array(z38.union([z38.string().max(32767), z38.number(), z38.boolean(), z38.null()])).max(16384)).max(1e5),
|
|
3951
|
+
header: z38.boolean().default(true)
|
|
3277
3952
|
});
|
|
3278
|
-
var DocumentsOfficeGenerateParams =
|
|
3279
|
-
kind:
|
|
3953
|
+
var DocumentsOfficeGenerateParams = z38.strictObject({
|
|
3954
|
+
kind: z38.enum(["docx", "xlsx"]),
|
|
3280
3955
|
path: AbsPath,
|
|
3281
|
-
title:
|
|
3956
|
+
title: z38.string().max(1024).optional(),
|
|
3282
3957
|
/** docx: the document's paragraphs, in order. */
|
|
3283
|
-
paragraphs:
|
|
3958
|
+
paragraphs: z38.array(DocumentsParagraph).max(5e4).optional(),
|
|
3284
3959
|
/** xlsx: the workbook's sheets, in order. */
|
|
3285
|
-
sheets:
|
|
3286
|
-
overwrite:
|
|
3960
|
+
sheets: z38.array(DocumentsSheet).min(1).max(64).optional(),
|
|
3961
|
+
overwrite: z38.boolean().default(false)
|
|
3287
3962
|
});
|
|
3288
|
-
var DocumentsOfficeGenerateResult =
|
|
3289
|
-
var EntitiesNerParams =
|
|
3290
|
-
text:
|
|
3963
|
+
var DocumentsOfficeGenerateResult = z38.strictObject({ path: z38.string(), bytes: nonNegInt });
|
|
3964
|
+
var EntitiesNerParams = z38.strictObject({
|
|
3965
|
+
text: z38.string().min(1).max(DOCUMENTS_MAX_TEXT_CHARS),
|
|
3291
3966
|
/** Which kinds to keep; absent: all three. */
|
|
3292
|
-
labels:
|
|
3967
|
+
labels: z38.array(z38.enum(["person", "place", "organization"])).min(1).max(3).optional()
|
|
3293
3968
|
});
|
|
3294
|
-
var EntitySpan =
|
|
3295
|
-
text:
|
|
3296
|
-
label:
|
|
3969
|
+
var EntitySpan = z38.strictObject({
|
|
3970
|
+
text: z38.string(),
|
|
3971
|
+
label: z38.string(),
|
|
3297
3972
|
/** Character offsets into the text (UTF-16, as JavaScript counts). */
|
|
3298
3973
|
start: nonNegInt,
|
|
3299
3974
|
end: nonNegInt
|
|
3300
3975
|
});
|
|
3301
|
-
var EntitiesNerResult =
|
|
3302
|
-
var PiiKind =
|
|
3303
|
-
var EntitiesPiiParams =
|
|
3304
|
-
text:
|
|
3305
|
-
kinds:
|
|
3976
|
+
var EntitiesNerResult = z38.strictObject({ entities: z38.array(EntitySpan), engine: z38.string() });
|
|
3977
|
+
var PiiKind = z38.enum(["email", "phone", "credit_card", "us_ssn", "iban", "ip_address", "url", "api_key"]);
|
|
3978
|
+
var EntitiesPiiParams = z38.strictObject({
|
|
3979
|
+
text: z38.string().min(1).max(DOCUMENTS_MAX_TEXT_CHARS),
|
|
3980
|
+
kinds: z38.array(PiiKind).min(1).max(8).optional(),
|
|
3306
3981
|
/** Also answer the text with each finding replaced by its kind ("[email]"). */
|
|
3307
|
-
redact:
|
|
3982
|
+
redact: z38.boolean().default(false)
|
|
3308
3983
|
});
|
|
3309
|
-
var EntitiesPiiResult =
|
|
3310
|
-
findings:
|
|
3311
|
-
redacted:
|
|
3984
|
+
var EntitiesPiiResult = z38.strictObject({
|
|
3985
|
+
findings: z38.array(z38.strictObject({ kind: PiiKind, text: z38.string(), start: nonNegInt, end: nonNegInt })),
|
|
3986
|
+
redacted: z38.string().nullable()
|
|
3312
3987
|
});
|
|
3313
3988
|
|
|
3314
3989
|
// src/schema/registry.ts
|
|
@@ -3442,6 +4117,36 @@ var OPS = {
|
|
|
3442
4117
|
"apps.windows.shown": { params: AppsWindowsShownParams, result: AppsWindowsShownResult, kind: "unary", since: "1.21", errors: ["NOT_FOUND", "PERMISSION_DENIED_OS", "PLATFORM_UNSUPPORTED", "INTERNAL"] },
|
|
3443
4118
|
// Claude Code history (SPEC §6 coding): served by the `coding` Python service through SERVICES below.
|
|
3444
4119
|
"coding.history.import_missing": { params: CodingHistoryImportMissingParams, result: CodingHistoryImportMissingResult, kind: "unary", since: "1.5", errors: ["RESOURCE_BUSY", "RESOURCE_GONE", "CANCELLED", "INTERNAL"] },
|
|
4120
|
+
// Code from anywhere (1.38): the coding engine's sessions, read and driven over any transport.
|
|
4121
|
+
"coding.providers": { params: CodingProvidersParams, result: CodingProvidersResult, kind: "unary", since: "1.38", errors: ["INTERNAL"] },
|
|
4122
|
+
"coding.sessions.list": { params: CodingSessionsListParams, result: CodingSessionsListResult, kind: "unary", since: "1.38", errors: ["PLATFORM_UNSUPPORTED", "INTERNAL"] },
|
|
4123
|
+
"coding.discover": { params: CodingDiscoverParams, result: CodingDiscoverResult, kind: "unary", since: "1.38", errors: ["INVALID_PARAMS", "PLATFORM_UNSUPPORTED", "INTERNAL"] },
|
|
4124
|
+
"coding.runs.list": { params: CodingRunsListParams, result: CodingRunsListResult, kind: "unary", since: "1.38", errors: ["INVALID_PARAMS", "INTERNAL"] },
|
|
4125
|
+
"coding.history": { params: CodingHistoryParams, result: CodingHistoryResult, kind: "unary", since: "1.38", errors: ["INVALID_PARAMS", "NOT_FOUND", "INTERNAL"] },
|
|
4126
|
+
"coding.transcript.read": { params: CodingTranscriptReadParams, result: CodingTranscriptReadResult, kind: "unary", since: "1.38", errors: ["INVALID_PARAMS", "NOT_FOUND", "INTERNAL"] },
|
|
4127
|
+
"coding.item.full": { params: CodingItemFullParams, result: CodingItemFullResult, kind: "unary", since: "1.38", errors: ["INVALID_PARAMS", "NOT_FOUND", "PAYLOAD_TOO_LARGE", "INTERNAL"] },
|
|
4128
|
+
"coding.activity": { params: CodingActivityParams, result: CodingActivityResult, kind: "unary", since: "1.38", errors: ["INVALID_PARAMS", "INTERNAL"] },
|
|
4129
|
+
"coding.folders.recent": { params: CodingFoldersRecentParams, result: CodingFoldersRecentResult, kind: "unary", since: "1.38", errors: ["INTERNAL"] },
|
|
4130
|
+
"coding.folders.check": { params: CodingFoldersCheckParams, result: CodingFoldersCheckResult, kind: "unary", since: "1.38", errors: ["INVALID_PARAMS", "AUTH_FORBIDDEN", "INTERNAL"] },
|
|
4131
|
+
"coding.folders.create": { params: CodingFoldersCreateParams, result: CodingFoldersCreateResult, kind: "unary", since: "1.38", errors: ["INVALID_PARAMS", "AUTH_FORBIDDEN", "PERMISSION_DENIED_OS", "INTERNAL"] },
|
|
4132
|
+
"coding.start": { params: CodingStartParams, result: CodingStartResult, kind: "unary", since: "1.38", errors: ["INVALID_PARAMS", "NOT_FOUND", "AUTH_FORBIDDEN", "RATE_LIMITED", "INTERNAL"] },
|
|
4133
|
+
"coding.takeover": { params: CodingTakeoverParams, result: CodingTakeoverResult, kind: "unary", since: "1.38", errors: ["INVALID_PARAMS", "NOT_FOUND", "RESOURCE_BUSY", "AUTH_FORBIDDEN", "INTERNAL"] },
|
|
4134
|
+
"coding.send": { params: CodingSendParams, result: CodingSendResult, kind: "unary", since: "1.38", errors: ["INVALID_PARAMS", "NOT_FOUND", "RATE_LIMITED", "INTERNAL"] },
|
|
4135
|
+
"coding.stop": { params: CodingStopParams, result: CodingStopResult, kind: "unary", since: "1.38", errors: ["INVALID_PARAMS", "INTERNAL"] },
|
|
4136
|
+
"coding.stop_elsewhere": { params: CodingStopElsewhereParams, result: CodingStopElsewhereResult, kind: "unary", since: "1.38", errors: ["INVALID_PARAMS", "NOT_FOUND", "CONFLICT", "PERMISSION_DENIED_OS", "INTERNAL"] },
|
|
4137
|
+
"coding.options.set": { params: CodingOptionsSetParams, result: CodingOptionsSetResult, kind: "unary", since: "1.38", errors: ["INVALID_PARAMS", "NOT_FOUND", "INTERNAL"] },
|
|
4138
|
+
"coding.agent.set": { params: CodingAgentSetParams, result: CodingAgentSetResult, kind: "unary", since: "1.38", errors: ["INVALID_PARAMS", "NOT_FOUND", "AUTH_FORBIDDEN", "INTERNAL"] },
|
|
4139
|
+
"coding.agents.access": { params: CodingAgentsAccessParams, result: CodingAgentsAccessResult, kind: "unary", since: "1.38", errors: ["INTERNAL"] },
|
|
4140
|
+
"coding.titles.status": { params: CodingTitlesStatusParams, result: CodingTitlesStatusResult, kind: "unary", since: "1.38", errors: ["INTERNAL"] },
|
|
4141
|
+
"coding.prefs.list": { params: CodingPrefsListParams, result: CodingPrefsListResult, kind: "unary", since: "1.38", errors: ["INTERNAL"] },
|
|
4142
|
+
"coding.prefs.set": { params: CodingPrefsSetParams, result: CodingPrefsSetResult, kind: "unary", since: "1.38", errors: ["INVALID_PARAMS", "INTERNAL"] },
|
|
4143
|
+
"coding.recent.seen": { params: CodingRecentSeenParams, result: CodingRecentSeenResult, kind: "unary", since: "1.38", errors: ["INVALID_PARAMS", "INTERNAL"] },
|
|
4144
|
+
"coding.search": { params: CodingSearchParams, result: CodingSearchResult, kind: "unary", since: "1.38", errors: ["INVALID_PARAMS", "TIMEOUT", "INTERNAL"] },
|
|
4145
|
+
"coding.reconcile": { params: CodingReconcileParams, result: CodingReconcileResult, kind: "unary", since: "1.38", errors: ["INVALID_PARAMS", "NOT_FOUND", "RESOURCE_BUSY", "CANCELLED", "INTERNAL"] },
|
|
4146
|
+
"coding.transcript.raw": { params: CodingTranscriptRawParams, result: CodingTranscriptRawResult, kind: "stream", since: "1.38", errors: ["INVALID_PARAMS", "NOT_FOUND", "CANCELLED", "INTERNAL"] },
|
|
4147
|
+
"coding.watch": { params: CodingWatchParams, result: CodingWatchResult, kind: "resource", since: "1.38", errors: ["PLATFORM_UNSUPPORTED", "RATE_LIMITED", "INTERNAL"] },
|
|
4148
|
+
"coding.session.watch": { params: CodingSessionWatchParams, result: CodingSessionWatchResult, kind: "resource", since: "1.38", errors: ["INVALID_PARAMS", "NOT_FOUND", "RATE_LIMITED", "INTERNAL"] },
|
|
4149
|
+
"session.identify": { params: SessionIdentifyParams, result: SessionIdentifyResult, kind: "unary", since: "1.38", errors: ["INVALID_PARAMS"] },
|
|
3445
4150
|
// 1.22: git for agents (core `git`, the system git; the cloud sandbox's /git/* set, SPEC 6.1).
|
|
3446
4151
|
"git.status": { params: GitStatusParams, result: GitStatusResult, kind: "unary", since: "1.22", errors: ["NOT_FOUND", "INVALID_PARAMS", "CONFLICT", "PLATFORM_UNSUPPORTED", "TIMEOUT", "INTERNAL"] },
|
|
3447
4152
|
"git.diff": { params: GitDiffParams, result: GitDiffResult, kind: "unary", since: "1.22", errors: ["NOT_FOUND", "INVALID_PARAMS", "CONFLICT", "PLATFORM_UNSUPPORTED", "TIMEOUT", "INTERNAL"] },
|
|
@@ -3458,10 +4163,24 @@ var OPS = {
|
|
|
3458
4163
|
"web.scrape": { params: WebScrapeParams, result: WebScrapeResult, kind: "unary", since: "1.22", errors: ["INVALID_PARAMS", "TIMEOUT", "RESOURCE_BUSY", "AUTH_REQUIRED", "INTERNAL"] },
|
|
3459
4164
|
"web.search": { params: WebSearchParams, result: WebSearchResult, kind: "unary", since: "1.22", errors: ["INVALID_PARAMS", "TIMEOUT", "RESOURCE_BUSY", "AUTH_REQUIRED", "INTERNAL"] },
|
|
3460
4165
|
"web.fetch_with_browser": { params: WebBrowserFetchParams, result: WebBrowserFetchResult, kind: "unary", since: "1.22", errors: ["INVALID_PARAMS", "TIMEOUT", "RESOURCE_BUSY", "AUTH_REQUIRED", "INTERNAL"] },
|
|
4166
|
+
"web.runtime.state": { params: WebRuntimeParams, result: WebRuntimeState, kind: "unary", since: "1.40", errors: ["INTERNAL"] },
|
|
4167
|
+
"web.runtime.install": { params: WebRuntimeParams, result: WebRuntimeState, kind: "unary", since: "1.40", errors: ["TIMEOUT", "RESOURCE_BUSY", "CANCELLED", "INTERNAL"] },
|
|
4168
|
+
"web.runtime.remove": { params: WebRuntimeParams, result: WebRuntimeState, kind: "unary", since: "1.40", errors: ["RESOURCE_BUSY", "INTERNAL"] },
|
|
4169
|
+
"web.outbox.list": { params: WebOutboxListParams, result: WebOutboxListResult, kind: "unary", since: "1.40", errors: ["INTERNAL"] },
|
|
4170
|
+
"web.outbox.retry": { params: WebOutboxRetryParams, result: WebOutboxRetryResult, kind: "unary", since: "1.40", errors: ["NOT_FOUND", "AUTH_REQUIRED", "INTERNAL"] },
|
|
4171
|
+
"web.outbox.discard": { params: WebOutboxDiscardParams, result: WebOutboxDiscardResult, kind: "unary", since: "1.40", errors: ["NOT_FOUND", "INTERNAL"] },
|
|
4172
|
+
"web.log.list": { params: WebLogListParams, result: WebLogListResult, kind: "unary", since: "1.40", errors: ["INVALID_PARAMS"] },
|
|
4173
|
+
"web.log.clear": { params: WebLogClearParams, result: WebLogClearResult, kind: "unary", since: "1.40", errors: ["INTERNAL"] },
|
|
4174
|
+
"web.research.queue": { params: WebResearchQueueParams, result: WebResearchQueueResult, kind: "unary", since: "1.40", errors: ["INVALID_PARAMS", "INTERNAL"] },
|
|
4175
|
+
"web.research.fetch": { params: WebResearchFetchParams, result: WebResearchFetchResult, kind: "unary", since: "1.40", errors: ["INVALID_PARAMS", "AUTH_REQUIRED", "RESOURCE_BUSY", "CANCELLED", "INTERNAL"] },
|
|
3461
4176
|
// 1.23: the signed-in person's own agents and Vault, read as them (the desktop's Agents library and Vault).
|
|
3462
4177
|
"account.agents.list": { params: AccountAgentsListParams, result: AccountAgentsListResult, kind: "unary", since: "1.23", errors: ["INTERNAL"] },
|
|
3463
4178
|
"account.vault.list": { params: AccountVaultListParams, result: AccountVaultListResult, kind: "unary", since: "1.23", errors: ["INTERNAL"] },
|
|
3464
4179
|
"account.vault.copy": { params: AccountVaultCopyParams, result: AccountVaultCopyResult, kind: "unary", since: "1.23", errors: ["AUTH_REQUIRED", "AUTH_FORBIDDEN", "NOT_FOUND", "INVALID_PARAMS", "DEVICE_OFFLINE", "INTERNAL"] },
|
|
4180
|
+
// 1.39: one agent opened (its inputs and what it uses), its runs (mandate.run_history, one agent at a time) and its star.
|
|
4181
|
+
"account.agents.get": { params: AccountAgentsGetParams, result: AccountAgentsGetResult, kind: "unary", since: "1.39", errors: ["INVALID_PARAMS", "INTERNAL"] },
|
|
4182
|
+
"account.agents.runs": { params: AccountAgentsRunsParams, result: AccountAgentsRunsResult, kind: "unary", since: "1.39", errors: ["INVALID_PARAMS", "INTERNAL"] },
|
|
4183
|
+
"account.agents.favorite": { params: AccountAgentsFavoriteParams, result: AccountAgentsFavoriteResult, kind: "unary", since: "1.39", errors: ["AUTH_REQUIRED", "NOT_FOUND", "INVALID_PARAMS", "DEVICE_OFFLINE", "INTERNAL"] },
|
|
3465
4184
|
// 1.26: the app's own update (it installs only once every window quit) and bringing the windows back.
|
|
3466
4185
|
"apps.windows.update_state": { params: AppsWindowsUpdateStateParams, result: AppsWindowsUpdateStateResult, kind: "unary", since: "1.26", errors: ["NOT_FOUND", "PLATFORM_UNSUPPORTED", "INTERNAL"] },
|
|
3467
4186
|
"apps.windows.reopen": { params: AppsWindowsReopenParams, result: AppsWindowsReopenResult, kind: "unary", since: "1.26", errors: ["NOT_FOUND", "PLATFORM_UNSUPPORTED", "INTERNAL"] },
|
|
@@ -3535,14 +4254,60 @@ var EVENTS = {
|
|
|
3535
4254
|
"session.control_changed": SessionControlChangedEvent,
|
|
3536
4255
|
"models.progress": ModelsProgressEvent,
|
|
3537
4256
|
"coding.history.progress": CodingHistoryProgressEvent,
|
|
4257
|
+
"coding.changed": CodingChangedEvent,
|
|
4258
|
+
"coding.watch_state": CodingWatchStateEvent,
|
|
4259
|
+
"coding.item": CodingItemEvent,
|
|
4260
|
+
"coding.gap": CodingGapEvent,
|
|
3538
4261
|
"relay.device_status": RelayDeviceStatusEvent,
|
|
3539
4262
|
"relay.auth_expiring": RelayAuthExpiringEvent,
|
|
3540
4263
|
"diag.errors.changed": DiagErrorsChangedEvent,
|
|
3541
4264
|
"browser.invoke": BrowserInvokeEvent,
|
|
3542
4265
|
"browser.sessions_changed": BrowserSessionsChangedEvent,
|
|
3543
|
-
"browser.progress": BrowserProgressEvent
|
|
4266
|
+
"browser.progress": BrowserProgressEvent,
|
|
4267
|
+
"web.log.entry": WebLogEntry,
|
|
4268
|
+
"web.progress": WebProgressEvent
|
|
3544
4269
|
};
|
|
3545
4270
|
|
|
4271
|
+
// src/versioning.ts
|
|
4272
|
+
function compareVersions(a, b) {
|
|
4273
|
+
const [am = 0, an = 0] = a.split(".").map(Number);
|
|
4274
|
+
const [bm = 0, bn = 0] = b.split(".").map(Number);
|
|
4275
|
+
return am - bm || an - bn;
|
|
4276
|
+
}
|
|
4277
|
+
function knows(version, since) {
|
|
4278
|
+
return compareVersions(version, since) >= 0;
|
|
4279
|
+
}
|
|
4280
|
+
var RESULT_PATH = /* @__PURE__ */ new Map([
|
|
4281
|
+
["fs.patch", "FsPatchResult"],
|
|
4282
|
+
["apps.chats.list", "AppsChatsListResult"],
|
|
4283
|
+
["apps.accounts.usage", "AppsAccountsUsageResult"],
|
|
4284
|
+
["apps.accounts.resets", "AppsAccountsResetsResult"],
|
|
4285
|
+
["apps.windows.update_state", "AppsWindowsUpdateStateResult"],
|
|
4286
|
+
["web.fetch_with_browser", "WebBrowserFetchResult"],
|
|
4287
|
+
["sysinfo.get", "SysinfoGetResult"]
|
|
4288
|
+
]);
|
|
4289
|
+
var NESTED_RESULTS = /* @__PURE__ */ new Map([
|
|
4290
|
+
["apps.chats.list", [["chats", "ChatRow"]]],
|
|
4291
|
+
["apps.projects.file", [["chat", "ChatRow"]]],
|
|
4292
|
+
["apps.projects.file_many", [["chats", "ChatRow"]]],
|
|
4293
|
+
["apps.projects.unfile", [["chat", "ChatRow"]]],
|
|
4294
|
+
["apps.projects.move", [["chat", "ChatRow"]]],
|
|
4295
|
+
["apps.chats.star", [["chat", "ChatRow"]]],
|
|
4296
|
+
["apps.chats.place", [["chat", "ChatRow"]]],
|
|
4297
|
+
["apps.accounts.usage", [["accounts", "AccountUsage"]]],
|
|
4298
|
+
["resources.snapshot", [["disks", "ResourcesDisk"]]],
|
|
4299
|
+
["stack.state", [["servers", "StackServer"]]],
|
|
4300
|
+
["account.agents.list", [["agents", "AccountAgent"]]],
|
|
4301
|
+
["web.scrape", [["pages", "WebScrapePage"]]],
|
|
4302
|
+
["sysinfo.get", [["permissions", "SysinfoGetResult.permissions[]"]]]
|
|
4303
|
+
]);
|
|
4304
|
+
var WINDOW_RESULTS = /* @__PURE__ */ new Map([
|
|
4305
|
+
["window.list", "windows"],
|
|
4306
|
+
["window.focus", "window"],
|
|
4307
|
+
["window.move", "window"]
|
|
4308
|
+
]);
|
|
4309
|
+
var VERSIONED_RESULT_OPS = [.../* @__PURE__ */ new Set([...RESULT_PATH.keys(), ...WINDOW_RESULTS.keys(), ...NESTED_RESULTS.keys()])];
|
|
4310
|
+
|
|
3546
4311
|
// src/client/client.ts
|
|
3547
4312
|
var WS_OPEN = 1;
|
|
3548
4313
|
var defaultTimers = {
|
|
@@ -3891,6 +4656,11 @@ function createDesktopClient(options) {
|
|
|
3891
4656
|
backoff.markConnected();
|
|
3892
4657
|
authRefusals = 0;
|
|
3893
4658
|
setState({ status: "open", welcome: welcome.data, attempts: 0, retryInMs: null, lastError: null, outcome: null });
|
|
4659
|
+
if (options.clientLabel && knows(welcome.data.protocol_version, "1.38")) {
|
|
4660
|
+
void request("session.identify", { label: options.clientLabel.slice(0, 60) }).catch(
|
|
4661
|
+
(error) => diagnose({ kind: "handler_threw", where: "session.identify", error })
|
|
4662
|
+
);
|
|
4663
|
+
}
|
|
3894
4664
|
for (const w of [...readyWaiters]) {
|
|
3895
4665
|
readyWaiters.delete(w);
|
|
3896
4666
|
w.resolve(welcome.data);
|