@ai-matrx/desktop-protocol 0.21.28 → 0.21.30

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/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 = 33;
115
+ var PROTOCOL_MINOR = 39;
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_-]+$/);
@@ -195,8 +195,11 @@ var ErrorReason = z2.enum([
195
195
  // AUTH_FORBIDDEN: the named browser is signed in to another account
196
196
  "browser_connection_off",
197
197
  // AUTH_FORBIDDEN: the person turned Browser connection off
198
- "awaiting_confirmation"
198
+ "awaiting_confirmation",
199
199
  // TIMEOUT: the person did not answer the browser's confirmation in time
200
+ // 1.34 (REASONS_SINCE): the per-device tool policy (src/tools/policy.ts)
201
+ "tool_disabled_on_device"
202
+ // AUTH_FORBIDDEN: the person turned this tool off for agents on this computer (Agents › Tools)
200
203
  ]);
201
204
  var FsPatchEditFailure = z2.strictObject({ edit_index: nonNegInt, reason: z2.string().max(300) });
202
205
  var ProtocolErrorBody = z2.strictObject({
@@ -1071,7 +1074,22 @@ var AccountAgent = z14.strictObject({
1071
1074
  shared_by: z14.string().max(320).nullable(),
1072
1075
  /** The organization it belongs to. */
1073
1076
  organization: z14.string().max(200).nullable(),
1074
- updated_at_ms: epochMs
1077
+ updated_at_ms: epochMs,
1078
+ // 1.39: the catalogue's own row (agx_get_list_full, read whole through @ai-matrx/agents/catalog).
1079
+ /** The agent's tags (the library's search and its inspector). */
1080
+ tags: z14.array(z14.string().max(120)).max(50).optional(),
1081
+ /** The model it runs (a model catalogue id); absent when it names none. */
1082
+ model_id: AccountRowId.optional(),
1083
+ /** The person's access: owner, admin, editor, viewer or system (the database's own words); absent when unknown. */
1084
+ access_level: z14.string().min(1).max(40).optional(),
1085
+ /** The organization's id (the label is `organization`); absent when it has none. */
1086
+ organization_id: AccountRowId.optional(),
1087
+ /** Whose it is: the person's own, shared with them, or one AI Matrx ships (Gallery). */
1088
+ origin: z14.enum(["mine", "shared", "system"]).optional(),
1089
+ /** Archived (the catalogue's archive filter decides whether the library lists it). */
1090
+ is_archived: z14.boolean().optional(),
1091
+ /** An orchestra: it conducts other agents. */
1092
+ orchestra: z14.boolean().optional()
1075
1093
  });
1076
1094
  var AccountAgentsListParams = z14.strictObject({});
1077
1095
  var AccountAgentsListResult = z14.strictObject({
@@ -1080,6 +1098,70 @@ var AccountAgentsListResult = z14.strictObject({
1080
1098
  problem: z14.string().max(300).nullable(),
1081
1099
  agents: z14.array(AccountAgent).max(2e3)
1082
1100
  });
1101
+ var AccountAgentVariable = z14.strictObject({
1102
+ name: z14.string().min(1).max(200),
1103
+ /** The default value as text ("" when it has none). */
1104
+ default_value: z14.string().max(4e3),
1105
+ required: z14.boolean(),
1106
+ help: z14.string().max(1e3)
1107
+ });
1108
+ var AccountAgentDetail = z14.strictObject({
1109
+ agent: AccountAgent,
1110
+ /** The inputs a run asks for (the agent's variables). */
1111
+ variables: z14.array(AccountAgentVariable).max(100),
1112
+ /** How many tools, custom tools, skills and connections it may use. */
1113
+ tool_count: z14.int().min(0),
1114
+ custom_tool_count: z14.int().min(0),
1115
+ skill_count: z14.int().min(0),
1116
+ connection_count: z14.int().min(0),
1117
+ /** The model's display name when the catalogue knows it. */
1118
+ model_name: z14.string().max(200).nullable()
1119
+ });
1120
+ var AccountAgentsGetParams = z14.strictObject({ agent_id: AccountRowId });
1121
+ var AccountAgentsGetResult = z14.strictObject({
1122
+ state: AccountReadState,
1123
+ problem: z14.string().max(300).nullable(),
1124
+ /** Null when the person cannot open it (not theirs, not shared with them, or gone). */
1125
+ detail: AccountAgentDetail.nullable()
1126
+ });
1127
+ var AccountAgentRunStatus = z14.enum(["succeeded", "warned", "failed", "stopped", "waiting", "running"]);
1128
+ var AccountAgentRun = z14.strictObject({
1129
+ run_id: AccountRowId,
1130
+ status: AccountAgentRunStatus,
1131
+ started_at_ms: epochMs,
1132
+ completed_at_ms: epochMs.nullable(),
1133
+ duration_ms: z14.int().min(0).nullable(),
1134
+ cost: z14.number().min(0).nullable(),
1135
+ tokens: z14.int().min(0).nullable(),
1136
+ /** One line of the answer (at most 240 characters), when the run kept one. */
1137
+ output_preview: z14.string().max(240).nullable(),
1138
+ /** The run's error, one line. */
1139
+ error: z14.string().max(300).nullable(),
1140
+ /** The mandate it served, when one named it. */
1141
+ mandate_key: z14.string().max(200).nullable(),
1142
+ organization: z14.string().max(200).nullable(),
1143
+ /** The conversation that holds its transcript, when it kept one. */
1144
+ conversation_id: AccountRowId.nullable(),
1145
+ has_transcript: z14.boolean()
1146
+ });
1147
+ var AccountAgentRunSort = z14.enum(["started_at", "duration", "cost", "status"]);
1148
+ var AccountAgentsRunsParams = z14.strictObject({
1149
+ agent_id: AccountRowId,
1150
+ status: AccountAgentRunStatus.optional(),
1151
+ sort: AccountAgentRunSort.optional(),
1152
+ descending: z14.boolean().optional(),
1153
+ offset: z14.int().min(0).max(1e5).optional(),
1154
+ limit: z14.int().min(1).max(100).optional()
1155
+ });
1156
+ var AccountAgentsRunsResult = z14.strictObject({
1157
+ state: AccountReadState,
1158
+ problem: z14.string().max(300).nullable(),
1159
+ /** Every run of this agent the person may see (rows is one page of it). */
1160
+ total: z14.int().min(0),
1161
+ rows: z14.array(AccountAgentRun).max(100)
1162
+ });
1163
+ var AccountAgentsFavoriteParams = z14.strictObject({ agent_id: AccountRowId, favorite: z14.boolean() });
1164
+ var AccountAgentsFavoriteResult = z14.strictObject({ favorite: z14.boolean() });
1083
1165
  var VaultItemKind = z14.enum(["login", "passkey", "key", "other"]);
1084
1166
  var VaultFieldSummary = z14.strictObject({
1085
1167
  key: z14.string().min(1).max(120),
@@ -1207,7 +1289,9 @@ var SystemSettingsPane = z16.enum([
1207
1289
  "energy",
1208
1290
  "about",
1209
1291
  "storage",
1210
- "system_report"
1292
+ "system_report",
1293
+ /** (1.35) Privacy & Security › Microphone: where the person allows Matrx 2 the microphone. */
1294
+ "microphone"
1211
1295
  ]);
1212
1296
  var SystemOpenSettingsParams = z16.strictObject({ pane: SystemSettingsPane });
1213
1297
  var SystemOpenSettingsResult = z16.strictObject({ pane: SystemSettingsPane });
@@ -1987,24 +2071,389 @@ var CodingHistoryProgressEvent = z27.strictObject({
1987
2071
  failed: nonNegInt
1988
2072
  });
1989
2073
 
1990
- // src/schema/apps.ts
2074
+ // src/schema/coding-sessions.ts
1991
2075
  import { z as z28 } from "zod";
2076
+ var CodingProviderName = z28.enum(["claude", "codex"]);
2077
+ var CodingRunStatus = z28.enum(["starting", "running", "completed", "stopped", "failed"]);
2078
+ var SessionKey = z28.string().regex(/^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/);
2079
+ var IsoTime = z28.string().min(10).max(40);
2080
+ var LocalPath = z28.string().min(1).max(4096);
2081
+ var CodingClientRequestId = z28.string().regex(/^[A-Za-z0-9_-]{8,64}$/);
2082
+ var ShortText = z28.string().max(500);
2083
+ var CodingRunUsage = z28.strictObject({
2084
+ inputTokens: nonNegInt,
2085
+ outputTokens: nonNegInt,
2086
+ cachedInputTokens: nonNegInt
2087
+ });
2088
+ var CodingStartedBy = z28.strictObject({
2089
+ kind: z28.enum(["this_computer", "web", "phone", "agent", "other"]),
2090
+ label: z28.string().min(1).max(80)
2091
+ });
2092
+ var CodingRunRecord = z28.strictObject({
2093
+ runId: z28.string().min(1).max(64),
2094
+ sessionId: SessionKey,
2095
+ provider: CodingProviderName,
2096
+ cwd: LocalPath,
2097
+ prompt: z28.string().max(1048576),
2098
+ model: z28.string().max(200).nullable(),
2099
+ status: CodingRunStatus,
2100
+ startedAt: IsoTime,
2101
+ endedAt: IsoTime.nullable(),
2102
+ error: z28.string().max(65536).nullable(),
2103
+ usage: CodingRunUsage.nullable(),
2104
+ costUsd: z28.number().nullable(),
2105
+ billing: z28.enum(["subscription", "api", "unknown"]).nullable(),
2106
+ startedBy: CodingStartedBy.nullable()
2107
+ });
2108
+ var CodingSessionAgentPart = z28.strictObject({
2109
+ part: z28.enum(["instructions", "skills", "tools"]),
2110
+ loaded: nonNegInt,
2111
+ total: nonNegInt
2112
+ });
2113
+ var CodingSessionAgent = z28.strictObject({
2114
+ agentId: z28.string().min(1).max(64),
2115
+ versionId: z28.string().max(64).nullable(),
2116
+ versionNumber: nonNegInt.nullable(),
2117
+ name: z28.string().max(300),
2118
+ definitionHash: z28.string().max(200),
2119
+ loaded: z28.array(CodingSessionAgentPart).max(3),
2120
+ unavailable: z28.array(z28.strictObject({ kind: z28.string().max(60), name: z28.string().max(300), reason: ShortText })).max(500),
2121
+ skills: z28.array(z28.string().max(300)).max(500),
2122
+ tools: z28.array(z28.string().max(300)).max(500),
2123
+ variables: z28.record(z28.string().max(200), z28.unknown()),
2124
+ blockDue: z28.boolean(),
2125
+ deliveredAt: IsoTime.nullable(),
2126
+ replaces: z28.string().max(300).nullable()
2127
+ });
2128
+ var CodingSessionRecord = z28.strictObject({
2129
+ id: SessionKey,
2130
+ provider: CodingProviderName,
2131
+ providerSessionId: SessionKey.nullable(),
2132
+ cwd: LocalPath,
2133
+ title: z28.string().max(500),
2134
+ model: z28.string().max(200).nullable(),
2135
+ effort: z28.string().max(40).nullable(),
2136
+ origin: z28.enum(["started", "takeover"]),
2137
+ createdAt: IsoTime,
2138
+ updatedAt: IsoTime,
2139
+ lastRunId: z28.string().max(64).nullable(),
2140
+ lastRunStatus: CodingRunStatus.nullable(),
2141
+ queued: z28.array(z28.string().max(1048576)).max(100),
2142
+ agent: CodingSessionAgent.nullable(),
2143
+ agentRemovedDue: z28.boolean()
2144
+ });
2145
+ var CodingActiveElsewhere = z28.strictObject({
2146
+ reason: z28.enum(["process", "recent-write", "open-tool-call", "open"]),
2147
+ message: ShortText,
2148
+ /** The process driving it, when the evidence is a process (re-checked before any stop). */
2149
+ pid: z28.int().min(1).nullable()
2150
+ });
2151
+ var CodingTitleSource = z28.enum(["app", "app-remembered", "custom-title", "ai-title", "agent-name", "summary", "first-prompt", "last-prompt", "unknown"]);
2152
+ var CodingDiscoveredChat = z28.strictObject({
2153
+ provider: CodingProviderName,
2154
+ providerSessionId: SessionKey,
2155
+ cwd: LocalPath.nullable(),
2156
+ title: z28.string().max(500),
2157
+ titleSource: CodingTitleSource.optional(),
2158
+ titlePending: z28.boolean().optional(),
2159
+ archived: z28.boolean().optional(),
2160
+ scheduled: z28.boolean().optional(),
2161
+ unlisted: z28.boolean().optional(),
2162
+ unavailable: ShortText.nullable(),
2163
+ updatedAt: IsoTime,
2164
+ source: z28.string().max(60).nullable(),
2165
+ activeElsewhere: CodingActiveElsewhere.nullable()
2166
+ });
2167
+ var CodingTranscriptItem = z28.discriminatedUnion("kind", [
2168
+ z28.strictObject({ kind: z28.literal("user"), id: z28.string().max(200), text: z28.string(), at: IsoTime.nullable() }),
2169
+ z28.strictObject({ kind: z28.literal("text"), id: z28.string().max(200), text: z28.string() }),
2170
+ z28.strictObject({ kind: z28.literal("text-delta"), id: z28.string().max(200), text: z28.string() }),
2171
+ z28.strictObject({ kind: z28.literal("reasoning"), id: z28.string().max(200), text: z28.string() }),
2172
+ z28.strictObject({ kind: z28.literal("tool-call"), id: z28.string().max(200), name: z28.string().max(300), input: z28.unknown() }),
2173
+ z28.strictObject({
2174
+ kind: z28.literal("tool-result"),
2175
+ id: z28.string().max(200),
2176
+ output: z28.string(),
2177
+ isError: z28.boolean(),
2178
+ /** The output's full size when only its start is here; `coding.item.full` reads the rest. */
2179
+ fullBytes: nonNegInt.optional()
2180
+ }),
2181
+ z28.strictObject({ kind: z28.literal("usage"), usage: CodingRunUsage, costUsd: z28.number().nullable() }),
2182
+ z28.strictObject({ kind: z28.literal("notice"), id: z28.string().max(200), level: z28.enum(["info", "warning"]), text: z28.string() }),
2183
+ z28.strictObject({ kind: z28.literal("error"), id: z28.string().max(200), text: z28.string() })
2184
+ ]);
2185
+ var CodingHistoryRecord = z28.strictObject({
2186
+ items: z28.array(CodingTranscriptItem),
2187
+ /** Only the end of the chat is here; "Show earlier" reads more (a bigger `max_bytes`). */
2188
+ truncated: z28.boolean(),
2189
+ unavailable: ShortText.nullable(),
2190
+ /** The last live item `seq` this read already contains; a watch applies only newer ones. */
2191
+ seq: nonNegInt
2192
+ });
2193
+ var CodingQuotaWindow = z28.strictObject({
2194
+ label: z28.string().max(120),
2195
+ usedPercent: z28.number().nullable(),
2196
+ resetsAt: z28.string().max(80).nullable(),
2197
+ valueLabel: z28.string().max(120).nullable()
2198
+ });
2199
+ var CodingProviderProblem = z28.strictObject({
2200
+ kind: z28.enum(["usage-limit", "signed-out"]),
2201
+ message: z28.string().max(2e3),
2202
+ until: z28.string().max(120).nullable(),
2203
+ at: IsoTime
2204
+ });
2205
+ var CodingProviderBinary = z28.strictObject({
2206
+ path: LocalPath,
2207
+ version: z28.string().max(80).nullable(),
2208
+ source: z28.enum(["desktop-app", "path", "npm-global", "configured"]),
2209
+ sourceLabel: z28.string().max(120),
2210
+ newer: z28.strictObject({ path: LocalPath, version: z28.string().max(80), sourceLabel: z28.string().max(120) }).nullable()
2211
+ });
2212
+ var CodingProviderStatus = z28.strictObject({
2213
+ provider: CodingProviderName,
2214
+ label: z28.string().max(60),
2215
+ installed: z28.boolean(),
2216
+ version: z28.string().max(80).nullable(),
2217
+ loggedIn: z28.boolean(),
2218
+ billing: z28.enum(["subscription", "api", "unknown"]),
2219
+ plan: z28.string().max(80).nullable(),
2220
+ account: z28.string().max(320).nullable(),
2221
+ problem: ShortText.nullable(),
2222
+ fix: ShortText.nullable(),
2223
+ ready: z28.boolean(),
2224
+ lastProblem: CodingProviderProblem.nullable(),
2225
+ quota: z28.array(CodingQuotaWindow).max(20),
2226
+ models: z28.array(z28.strictObject({ id: z28.string().max(200), label: z28.string().max(200) })).max(200),
2227
+ efforts: z28.array(z28.string().max(40)).max(20),
2228
+ defaultModel: z28.strictObject({ id: z28.string().max(200), source: z28.enum(["settings", "driver"]) }).nullable(),
2229
+ defaultEffort: z28.string().max(40).nullable(),
2230
+ binary: CodingProviderBinary.nullable()
2231
+ });
2232
+ var CodingChatPreference = z28.strictObject({
2233
+ title: z28.string().max(500).nullable(),
2234
+ pinned: z28.boolean(),
2235
+ hidden: z28.boolean(),
2236
+ /** When the person last had this chat open on any screen of this computer (the "New output" dot). */
2237
+ lastSeenAt: IsoTime.nullable(),
2238
+ updatedAt: IsoTime.nullable()
2239
+ });
2240
+ var CodingTitleStatus = z28.strictObject({
2241
+ owner: z28.boolean(),
2242
+ pending: z28.boolean(),
2243
+ problem: ShortText.nullable(),
2244
+ renames: ShortText.nullable()
2245
+ });
2246
+ var CodingRecentRow = z28.strictObject({
2247
+ target: z28.string().min(3).max(200),
2248
+ title: z28.string().max(500),
2249
+ provider: CodingProviderName,
2250
+ sessionId: SessionKey.nullable(),
2251
+ providerSessionId: SessionKey.nullable(),
2252
+ cwd: LocalPath.nullable(),
2253
+ updatedAt: IsoTime,
2254
+ state: z28.enum(["running", "needs_attention", "new_output", "elsewhere", "idle"]),
2255
+ stateLabel: z28.string().max(120).nullable(),
2256
+ pinned: z28.boolean(),
2257
+ startedBy: CodingStartedBy.nullable()
2258
+ });
2259
+ var CodingFolderCheck = z28.strictObject({
2260
+ path: z28.string().max(4096),
2261
+ exists: z28.boolean(),
2262
+ isDirectory: z28.boolean()
2263
+ });
2264
+ var CodingRecentFolder = z28.strictObject({ path: LocalPath, lastUsedAt: IsoTime, exists: z28.boolean() });
2265
+ var CodingAgentSelectionParams = z28.strictObject({
2266
+ agent_id: z28.string().min(1).max(64),
2267
+ version_id: z28.string().min(1).max(64).optional(),
2268
+ variables: z28.record(z28.string().max(200), z28.unknown()).optional()
2269
+ });
2270
+ var CodingSendResult = z28.strictObject({
2271
+ session: CodingSessionRecord,
2272
+ run: CodingRunRecord.nullable(),
2273
+ /** The prompt waits behind a live run (it shows as a queued bubble). */
2274
+ queued: z28.boolean()
2275
+ });
2276
+ var CodingProvidersParams = z28.strictObject({});
2277
+ var CodingProvidersResult = z28.strictObject({ providers: z28.array(CodingProviderStatus).max(4) });
2278
+ var CodingSessionsListParams = z28.strictObject({});
2279
+ var CodingSessionsListResult = z28.strictObject({
2280
+ sessions: z28.array(CodingSessionRecord),
2281
+ /** The latest run of each session, by session id. */
2282
+ runs: z28.record(z28.string().max(128), CodingRunRecord),
2283
+ recent: z28.array(CodingRecentRow),
2284
+ title_status: CodingTitleStatus
2285
+ });
2286
+ var CodingDiscoverParams = z28.strictObject({ limit: z28.int().min(1).max(1e3).optional() });
2287
+ var CodingDiscoverResult = z28.strictObject({ chats: z28.array(CodingDiscoveredChat) });
2288
+ var CodingRunsListParams = z28.strictObject({ session_id: SessionKey });
2289
+ var CodingRunsListResult = z28.strictObject({ runs: z28.array(CodingRunRecord) });
2290
+ var CodingHistoryParams = z28.strictObject({ session_id: SessionKey, max_bytes: z28.int().min(1024).max(209715200).optional() });
2291
+ var CodingHistoryResult = CodingHistoryRecord;
2292
+ var CodingTranscriptReadParams = z28.strictObject({
2293
+ provider: CodingProviderName,
2294
+ provider_session_id: SessionKey,
2295
+ max_bytes: z28.int().min(1024).max(209715200).optional()
2296
+ });
2297
+ var CodingTranscriptReadResult = CodingHistoryRecord;
2298
+ var CodingItemFullParams = z28.strictObject({
2299
+ provider: CodingProviderName,
2300
+ provider_session_id: SessionKey,
2301
+ item_id: z28.string().min(1).max(200)
2302
+ });
2303
+ var CodingItemFullResult = z28.strictObject({ output: z28.string(), bytes: nonNegInt });
2304
+ var CodingActivityParams = z28.strictObject({ provider: CodingProviderName, provider_session_id: SessionKey });
2305
+ var CodingActivityResult = z28.strictObject({ active: CodingActiveElsewhere.nullable() });
2306
+ var CodingFoldersRecentParams = z28.strictObject({});
2307
+ var CodingFoldersRecentResult = z28.strictObject({ folders: z28.array(CodingRecentFolder).max(100) });
2308
+ var CodingFoldersCheckParams = z28.strictObject({ path: z28.string().min(1).max(4096) });
2309
+ var CodingFoldersCheckResult = CodingFolderCheck;
2310
+ var CodingFoldersCreateParams = z28.strictObject({ path: z28.string().min(1).max(4096) });
2311
+ var CodingFoldersCreateResult = CodingFolderCheck;
2312
+ var CodingStartParams = z28.strictObject({
2313
+ provider: CodingProviderName,
2314
+ cwd: z28.string().min(1).max(4096),
2315
+ prompt: z28.string().min(1).max(1048576),
2316
+ model: z28.string().min(1).max(200).optional(),
2317
+ effort: z28.string().min(1).max(40).optional(),
2318
+ agent: CodingAgentSelectionParams.optional(),
2319
+ /** One of the person's coding accounts on this computer (Accounts); absent = the default login. */
2320
+ account_profile_id: z28.string().min(1).max(64).optional(),
2321
+ client_request_id: CodingClientRequestId
2322
+ });
2323
+ var CodingStartResult = CodingSendResult;
2324
+ var CodingTakeoverParams = z28.strictObject({
2325
+ provider: CodingProviderName,
2326
+ provider_session_id: SessionKey,
2327
+ cwd: z28.string().min(1).max(4096),
2328
+ title: z28.string().max(500).optional(),
2329
+ agent: CodingAgentSelectionParams.optional(),
2330
+ confirm_elsewhere: z28.boolean().optional()
2331
+ });
2332
+ var CodingTakeoverResult = z28.strictObject({ session: CodingSessionRecord });
2333
+ var CodingSendParams = z28.strictObject({
2334
+ session_id: SessionKey,
2335
+ prompt: z28.string().min(1).max(1048576),
2336
+ client_request_id: CodingClientRequestId
2337
+ });
2338
+ var CodingStopParams = z28.strictObject({ run_id: z28.string().min(1).max(64) });
2339
+ var CodingStopResult = z28.strictObject({ run: CodingRunRecord.nullable() });
2340
+ var CodingStopElsewhereParams = z28.strictObject({
2341
+ provider: CodingProviderName,
2342
+ provider_session_id: SessionKey,
2343
+ pid: z28.int().min(1)
2344
+ });
2345
+ var CodingStopElsewhereResult = z28.strictObject({ stopped: z28.boolean(), message: ShortText });
2346
+ var CodingOptionsSetParams = z28.strictObject({
2347
+ session_id: SessionKey,
2348
+ model: z28.string().max(200).optional(),
2349
+ effort: z28.string().max(40).optional()
2350
+ });
2351
+ var CodingOptionsSetResult = z28.strictObject({ session: CodingSessionRecord });
2352
+ var CodingAgentSetParams = z28.strictObject({ session_id: SessionKey, agent: CodingAgentSelectionParams.optional() });
2353
+ var CodingAgentSetResult = z28.strictObject({ session: CodingSessionRecord });
2354
+ var CodingAgentsAccessParams = z28.strictObject({});
2355
+ var CodingAgentsAccessResult = z28.strictObject({
2356
+ signedIn: z28.boolean(),
2357
+ userId: z28.string().max(64).nullable(),
2358
+ organizationId: z28.string().max(64).nullable(),
2359
+ configured: z28.boolean()
2360
+ });
2361
+ var CodingTitlesStatusParams = z28.strictObject({});
2362
+ var CodingTitlesStatusResult = CodingTitleStatus;
2363
+ var CodingPrefsListParams = z28.strictObject({});
2364
+ var CodingPrefsListResult = z28.strictObject({ preferences: z28.record(z28.string().max(200), CodingChatPreference) });
2365
+ var CodingPrefsSetParams = z28.strictObject({
2366
+ key: z28.string().min(1).max(200),
2367
+ title: z28.string().min(1).max(500).optional(),
2368
+ clear_title: z28.boolean().optional(),
2369
+ pinned: z28.boolean().optional(),
2370
+ hidden: z28.boolean().optional()
2371
+ });
2372
+ var CodingPrefsSetResult = CodingPrefsListResult;
2373
+ var CodingRecentSeenParams = z28.strictObject({ target: z28.string().min(3).max(200) });
2374
+ var CodingRecentSeenResult = z28.strictObject({ recent: z28.array(CodingRecentRow) });
2375
+ var CodingSearchParams = z28.strictObject({
2376
+ query: z28.string().min(1).max(500),
2377
+ cursor: nonNegInt.optional(),
2378
+ limit: z28.int().min(1).max(100).optional()
2379
+ });
2380
+ var CodingSearchResult = z28.strictObject({
2381
+ query: z28.string().max(500),
2382
+ hits: z28.array(
2383
+ z28.strictObject({
2384
+ provider: CodingProviderName,
2385
+ providerSessionId: SessionKey,
2386
+ title: z28.string().max(500),
2387
+ cwd: LocalPath.nullable(),
2388
+ updatedAt: IsoTime,
2389
+ where: z28.enum(["title", "content"]),
2390
+ snippet: z28.string().max(2e3).nullable()
2391
+ })
2392
+ ),
2393
+ scanned: nonNegInt,
2394
+ total: nonNegInt,
2395
+ nextCursor: nonNegInt.nullable()
2396
+ });
2397
+ var CodingReconcileParams = z28.strictObject({ provider: CodingProviderName, provider_session_id: SessionKey });
2398
+ var CodingReconcileResult = z28.strictObject({
2399
+ state: z28.enum(["done", "blocked", "nothing_to_do"]),
2400
+ summary: z28.string().max(400)
2401
+ });
2402
+ var CodingTranscriptRawParams = z28.strictObject({ provider: CodingProviderName, provider_session_id: SessionKey });
2403
+ var CodingTranscriptRawResult = z28.strictObject({
2404
+ available: z28.boolean(),
2405
+ reason: ShortText.nullable(),
2406
+ file_name: z28.string().max(300).nullable(),
2407
+ bytes: nonNegInt,
2408
+ /** The opt-in cloud backup was refreshed (false: off, unchanged, or signed out). */
2409
+ backup_refreshed: z28.boolean(),
2410
+ /** Subagent transcripts beside the chat (Claude Code), downloaded separately. */
2411
+ subagents: nonNegInt
2412
+ });
2413
+ var CodingWatchParams = z28.strictObject({});
2414
+ var CodingWatchResult = z28.strictObject({ resource_id: ResourceId });
2415
+ var CodingSessionWatchParams = z28.strictObject({ session_id: SessionKey, since_seq: nonNegInt.optional() });
2416
+ var CodingSessionWatchResult = z28.strictObject({
2417
+ resource_id: ResourceId,
2418
+ /** The newest item seq the device has for this session right now. */
2419
+ seq: nonNegInt
2420
+ });
2421
+ var CodingChangedEvent = z28.discriminatedUnion("kind", [
2422
+ z28.strictObject({ kind: z28.literal("session"), session: CodingSessionRecord }),
2423
+ z28.strictObject({ kind: z28.literal("run"), run: CodingRunRecord }),
2424
+ z28.strictObject({ kind: z28.literal("preferences"), preferences: z28.record(z28.string().max(200), CodingChatPreference) }),
2425
+ z28.strictObject({ kind: z28.literal("titles") }),
2426
+ z28.strictObject({ kind: z28.literal("recent"), recent: z28.array(CodingRecentRow) })
2427
+ ]);
2428
+ var CodingWatchStateEvent = z28.strictObject({ live: z28.boolean(), reason: ShortText.nullable(), beat_ms: z28.int().min(1e3) });
2429
+ var CodingItemEvent = z28.strictObject({
2430
+ session_id: SessionKey,
2431
+ run_id: z28.string().min(1).max(64),
2432
+ seq: nonNegInt,
2433
+ item: CodingTranscriptItem
2434
+ });
2435
+ var CodingGapEvent = z28.strictObject({ session_id: SessionKey, since_seq: nonNegInt, seq: nonNegInt });
2436
+ var SessionIdentifyParams = z28.strictObject({ label: z28.string().min(1).max(60) });
2437
+ var SessionIdentifyResult = z28.strictObject({ label: z28.string().max(60) });
2438
+
2439
+ // src/schema/apps.ts
2440
+ import { z as z29 } from "zod";
1992
2441
  import { UUID_SHAPE_PATTERN as UUID_SHAPE_PATTERN4 } from "@ai-matrx/kit/uuid";
1993
- var AppKey = z28.string().regex(/^[a-z][a-z0-9_-]{0,39}$/);
1994
- var AppProfileId = z28.string().regex(UUID_SHAPE_PATTERN4);
1995
- var AppProfileLocator = z28.string().min(1).max(512).regex(/^[A-Za-z0-9 _()+@,-][A-Za-z0-9 ._()+@,-]{0,127}(\/[A-Za-z0-9 _()+@,-][A-Za-z0-9 ._()+@,-]{0,127}){0,7}$/);
1996
- var AppSupport = z28.enum(["supported", "partial", "unsupported"]);
1997
- var AppFeatureStatus = z28.strictObject({
2442
+ var AppKey = z29.string().regex(/^[a-z][a-z0-9_-]{0,39}$/);
2443
+ var AppProfileId = z29.string().regex(UUID_SHAPE_PATTERN4);
2444
+ 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}$/);
2445
+ var AppSupport = z29.enum(["supported", "partial", "unsupported"]);
2446
+ var AppFeatureStatus = z29.strictObject({
1998
2447
  status: AppSupport,
1999
2448
  /** One line, set whenever status is not "supported". */
2000
- reason: z28.string().max(140).nullable()
2449
+ reason: z29.string().max(140).nullable()
2001
2450
  });
2002
- var AppInfo = z28.strictObject({
2451
+ var AppInfo = z29.strictObject({
2003
2452
  app_key: AppKey,
2004
- name: z28.string().max(64),
2005
- installed: z28.boolean(),
2453
+ name: z29.string().max(64),
2454
+ installed: z29.boolean(),
2006
2455
  /** The app's own version string, or null when it is not installed or does not say. */
2007
- version: z28.string().max(64).nullable(),
2456
+ version: z29.string().max(64).nullable(),
2008
2457
  /** The install found (an .app bundle, an .exe, a binary), or null. */
2009
2458
  location: AbsPath.nullable(),
2010
2459
  /** Open the app at all on this OS. */
@@ -2014,148 +2463,148 @@ var AppInfo = z28.strictObject({
2014
2463
  /** Plan usage read from the app's own files on this OS. */
2015
2464
  usage: AppFeatureStatus
2016
2465
  });
2017
- var AppUsageReading = z28.strictObject({
2018
- window: z28.enum(["five_hour", "weekly", "extra"]),
2466
+ var AppUsageReading = z29.strictObject({
2467
+ window: z29.enum(["five_hour", "weekly", "extra"]),
2019
2468
  /** 0–100 for five_hour and weekly; extra-usage spend as a percent of its cap (may pass 100). */
2020
- percent: z28.number().min(0).max(1e4),
2469
+ percent: z29.number().min(0).max(1e4),
2021
2470
  /** When the app recorded it. */
2022
2471
  sampled_at_ms: epochMs,
2023
2472
  /** True when the window has rolled over since the sample, so the figure has reset. */
2024
- reset_since: z28.boolean()
2473
+ reset_since: z29.boolean()
2025
2474
  });
2026
- var AppProfile = z28.strictObject({
2475
+ var AppProfile = z29.strictObject({
2027
2476
  /** The row's id; null for a folder found on disk that no row names yet. */
2028
2477
  id: AppProfileId.nullable(),
2029
2478
  app_key: AppKey,
2030
- display_name: z28.string().min(1).max(120),
2479
+ display_name: z29.string().min(1).max(120),
2031
2480
  /** The account the person means to be signed in here; null when not stated (never guessed). */
2032
- account_identity: z28.string().min(3).max(320).nullable(),
2481
+ account_identity: z29.string().min(3).max(320).nullable(),
2033
2482
  profile_locator: AppProfileLocator.nullable(),
2034
2483
  /** The device the row is tied to; null when the row names none. */
2035
2484
  device_id: DeviceId.nullable(),
2036
2485
  /** The folder this profile resolves to on this device; null for a row tied to another device. */
2037
2486
  folder: AbsPath.nullable(),
2038
2487
  /** The folder exists on this device. */
2039
- on_disk: z28.boolean(),
2488
+ on_disk: z29.boolean(),
2040
2489
  /** An instance with this profile is running; null when it could not be determined. */
2041
- running: z28.boolean().nullable(),
2490
+ running: z29.boolean().nullable(),
2042
2491
  /** Usage the app recorded for this profile; null when the app exposes none here. */
2043
- usage: z28.array(AppUsageReading).nullable(),
2492
+ usage: z29.array(AppUsageReading).nullable(),
2044
2493
  last_opened_ms: epochMs.nullable()
2045
2494
  });
2046
- var AppsListParams = z28.strictObject({});
2047
- var AppsListResult = z28.strictObject({ apps: z28.array(AppInfo) });
2048
- var AppsProfilesListParams = z28.strictObject({
2495
+ var AppsListParams = z29.strictObject({});
2496
+ var AppsListResult = z29.strictObject({ apps: z29.array(AppInfo) });
2497
+ var AppsProfilesListParams = z29.strictObject({
2049
2498
  /** Only this app's profiles; every app's when absent. */
2050
2499
  app_key: AppKey.optional()
2051
2500
  });
2052
- var AppsProfilesListResult = z28.strictObject({
2053
- profiles: z28.array(AppProfile),
2501
+ var AppsProfilesListResult = z29.strictObject({
2502
+ profiles: z29.array(AppProfile),
2054
2503
  /**
2055
2504
  * Whether the saved rows could be read: false while signed out or offline, when only folders
2056
2505
  * found on disk are listed.
2057
2506
  */
2058
- registry: z28.enum(["ok", "signed_out", "unavailable"])
2507
+ registry: z29.enum(["ok", "signed_out", "unavailable"])
2059
2508
  });
2060
- var AppsProfilesSaveParams = z28.strictObject({
2509
+ var AppsProfilesSaveParams = z29.strictObject({
2061
2510
  id: AppProfileId.optional(),
2062
2511
  app_key: AppKey,
2063
- display_name: z28.string().min(1).max(120),
2064
- account_identity: z28.string().min(3).max(320).nullable(),
2512
+ display_name: z29.string().min(1).max(120),
2513
+ account_identity: z29.string().min(3).max(320).nullable(),
2065
2514
  /** On create: the folder to use (one found on disk), or null for the app's default profile. Ignored on update. */
2066
2515
  profile_locator: AppProfileLocator.nullable(),
2067
2516
  /** On create with profile_locator null: make a new folder named after display_name instead. */
2068
- new_folder: z28.boolean().default(false)
2517
+ new_folder: z29.boolean().default(false)
2069
2518
  });
2070
2519
  var AppsProfilesSaveResult = AppProfile;
2071
- var AppsProfilesRemoveParams = z28.strictObject({ id: AppProfileId });
2072
- var AppsProfilesRemoveResult = z28.strictObject({ removed: z28.boolean() });
2073
- var AppsOpenParams = z28.strictObject({
2520
+ var AppsProfilesRemoveParams = z29.strictObject({ id: AppProfileId });
2521
+ var AppsProfilesRemoveResult = z29.strictObject({ removed: z29.boolean() });
2522
+ var AppsOpenParams = z29.strictObject({
2074
2523
  app_key: AppKey,
2075
2524
  profile_id: AppProfileId.optional()
2076
2525
  });
2077
- var AppsOpenResult = z28.strictObject({
2526
+ var AppsOpenResult = z29.strictObject({
2078
2527
  /** True when an instance with this profile was already running; it is brought forward. */
2079
- already_running: z28.boolean(),
2528
+ already_running: z29.boolean(),
2080
2529
  folder: AbsPath.nullable()
2081
2530
  });
2082
2531
 
2083
2532
  // src/schema/apps-chats.ts
2084
- import { z as z29 } from "zod";
2085
- var ChatId = z29.string().regex(/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/);
2086
- var ChatPlace = z29.string().regex(/^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/);
2087
- var ChatProjectId = z29.string().regex(/^[a-z0-9][a-z0-9-]{0,63}$/);
2088
- var ChatWindow = z29.strictObject({
2533
+ import { z as z30 } from "zod";
2534
+ var ChatId = z30.string().regex(/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/);
2535
+ var ChatPlace = z30.string().regex(/^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/);
2536
+ var ChatProjectId = z30.string().regex(/^[a-z0-9][a-z0-9-]{0,63}$/);
2537
+ var ChatWindow = z30.strictObject({
2089
2538
  key: ChatPlace,
2090
2539
  /** The app's default profile (Claude: the main window, which lists every account's chats). */
2091
- main: z29.boolean(),
2540
+ main: z30.boolean(),
2092
2541
  /** The account the window is signed into, when known. */
2093
- account: z29.string().max(320).nullable()
2542
+ account: z30.string().max(320).nullable()
2094
2543
  });
2095
- var ChatProject = z29.strictObject({
2544
+ var ChatProject = z30.strictObject({
2096
2545
  id: ChatProjectId,
2097
- name: z29.string().min(1).max(200),
2098
- archived: z29.boolean(),
2546
+ name: z30.string().min(1).max(200),
2547
+ archived: z30.boolean(),
2099
2548
  /** Chats in it. */
2100
2549
  count: nonNegInt
2101
2550
  });
2102
- var ChatPin = z29.strictObject({
2551
+ var ChatPin = z30.strictObject({
2103
2552
  /** The window whose account pins it; an account with no window of its own is named by its email. */
2104
- window: z29.string().min(1).max(320),
2553
+ window: z30.string().min(1).max(320),
2105
2554
  /** When that account's pin list was last read; null when the reading has no time. */
2106
2555
  observed_at_ms: epochMs.nullable()
2107
2556
  });
2108
- var ChatRunning = z29.strictObject({
2557
+ var ChatRunning = z30.strictObject({
2109
2558
  window: ChatPlace,
2110
2559
  /** process: a live process resumed this chat there (exact); activity: that window's own record moved in the last 3 minutes. */
2111
- how: z29.enum(["process", "activity"])
2560
+ how: z30.enum(["process", "activity"])
2112
2561
  });
2113
- var ChatHidden = z29.strictObject({
2562
+ var ChatHidden = z30.strictObject({
2114
2563
  window: ChatPlace,
2115
- reason: z29.string().max(200)
2564
+ reason: z30.string().max(200)
2116
2565
  });
2117
- var ChatLastUse = z29.strictObject({
2566
+ var ChatLastUse = z30.strictObject({
2118
2567
  /** The conversation's last reply. */
2119
2568
  at_ms: epochMs,
2120
2569
  window: ChatPlace.nullable(),
2121
- account: z29.string().max(320).nullable(),
2570
+ account: z30.string().max(320).nullable(),
2122
2571
  /** How the window was decided (one short line). */
2123
- how: z29.string().max(120).nullable(),
2572
+ how: z30.string().max(120).nullable(),
2124
2573
  /** The account's 1-hour prompt cache is still warm. */
2125
- cache_warm: z29.boolean(),
2574
+ cache_warm: z30.boolean(),
2126
2575
  cache_minutes_left: nonNegInt
2127
2576
  });
2128
- var ChatAppProject = z29.strictObject({
2129
- id: z29.string().min(1).max(200),
2130
- name: z29.string().max(200)
2577
+ var ChatAppProject = z30.strictObject({
2578
+ id: z30.string().min(1).max(200),
2579
+ name: z30.string().max(200)
2131
2580
  });
2132
- var ChatTitleSource = z29.enum(["app", "app-remembered", "custom-title", "ai-title", "agent-name", "summary", "first-prompt", "last-prompt"]);
2133
- var ChatRow = z29.strictObject({
2581
+ var ChatTitleSource = z30.enum(["app", "app-remembered", "custom-title", "ai-title", "agent-name", "summary", "first-prompt", "last-prompt"]);
2582
+ var ChatRow = z30.strictObject({
2134
2583
  id: ChatId,
2135
2584
  /** The short id people see (the listing's first 8 characters). */
2136
- short_id: z29.string().max(16),
2585
+ short_id: z30.string().max(16),
2137
2586
  /** The listing's own name (Claude: local_<id>), null for a chat only in the holder. */
2138
- record: z29.string().max(160).nullable(),
2139
- title: z29.string().max(1e3),
2587
+ record: z30.string().max(160).nullable(),
2588
+ title: z30.string().max(1e3),
2140
2589
  last_active_ms: epochMs.nullable(),
2141
2590
  created_ms: epochMs.nullable(),
2142
- projects: z29.array(ChatProjectId).max(500),
2143
- starred: z29.boolean(),
2144
- pinned_in: z29.array(ChatPin).max(200),
2591
+ projects: z30.array(ChatProjectId).max(500),
2592
+ starred: z30.boolean(),
2593
+ pinned_in: z30.array(ChatPin).max(200),
2145
2594
  /** Every place it is listed now: window keys, plus "holder". */
2146
- places: z29.array(ChatPlace).max(200),
2147
- held: z29.boolean(),
2148
- running: z29.array(ChatRunning).max(200),
2149
- hidden_in: z29.array(ChatHidden).max(200),
2595
+ places: z30.array(ChatPlace).max(200),
2596
+ held: z30.boolean(),
2597
+ running: z30.array(ChatRunning).max(200),
2598
+ hidden_in: z30.array(ChatHidden).max(200),
2150
2599
  /** Kept out of the main window on purpose. */
2151
- hidden_from_main: z29.boolean(),
2600
+ hidden_from_main: z30.boolean(),
2152
2601
  /** Listed in a side window and not yet copied into main. */
2153
- main_pending: z29.boolean(),
2602
+ main_pending: z30.boolean(),
2154
2603
  /** A scheduled routine's run (its task id). */
2155
- scheduled: z29.string().max(200).nullable(),
2604
+ scheduled: z30.string().max(200).nullable(),
2156
2605
  /** Created recently and in no project: offered for filing. */
2157
- new_unfiled: z29.boolean(),
2158
- warnings: z29.array(z29.string().max(400)).max(20),
2606
+ new_unfiled: z30.boolean(),
2607
+ warnings: z30.array(z30.string().max(400)).max(20),
2159
2608
  last_use: ChatLastUse.nullable(),
2160
2609
  /** 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. */
2161
2610
  app_project: ChatAppProject.optional(),
@@ -2165,140 +2614,140 @@ var ChatRow = z29.strictObject({
2165
2614
  * 1.14: the chat's own title before the person's rename (the one title rule, `@ai-matrx/coding-sessions/sessions`);
2166
2615
  * `title` is what to show (`title_override` when set, else this).
2167
2616
  */
2168
- original_title: z29.string().max(1e3).optional(),
2617
+ original_title: z30.string().max(1e3).optional(),
2169
2618
  /** 1.14: where `original_title` came from (the one rule's sources, strongest first; 1.15: a closed set). */
2170
2619
  title_source: ChatTitleSource.optional(),
2171
2620
  /** 1.14: the person's rename inside Matrx (Coding Sessions), applied once by the row builder; absent = none. */
2172
- title_override: z29.string().min(1).max(300).optional(),
2621
+ title_override: z30.string().min(1).max(300).optional(),
2173
2622
  /** 1.15: the app itself archived it (hidden_in says where and why, in words for people; this is the typed fact). */
2174
- archived: z29.boolean().optional()
2623
+ archived: z30.boolean().optional()
2175
2624
  });
2176
- var ChatFamily = z29.strictObject({
2625
+ var ChatFamily = z30.strictObject({
2177
2626
  id: ChatId,
2178
2627
  fork_of: ChatId.nullable(),
2179
2628
  copy_of: ChatId.nullable()
2180
2629
  });
2181
- var AppsChatsListParams = z29.strictObject({
2630
+ var AppsChatsListParams = z30.strictObject({
2182
2631
  app_key: AppKey,
2183
2632
  /** Only these chats (a live update re-reads just what changed). */
2184
- ids: z29.array(ChatId).max(500).optional()
2633
+ ids: z30.array(ChatId).max(500).optional()
2185
2634
  });
2186
- var AppsChatsListResult = z29.strictObject({
2635
+ var AppsChatsListResult = z30.strictObject({
2187
2636
  app_key: AppKey,
2188
2637
  /** Bumps on every change the index sees; `apps.chats.changed` carries the same number. */
2189
2638
  version: nonNegInt,
2190
- windows: z29.array(ChatWindow).max(200),
2191
- projects: z29.array(ChatProject).max(5e3),
2192
- chats: z29.array(ChatRow).max(2e4),
2639
+ windows: z30.array(ChatWindow).max(200),
2640
+ projects: z30.array(ChatProject).max(5e3),
2641
+ chats: z30.array(ChatRow).max(2e4),
2193
2642
  /** How long a chat in no project counts as new. */
2194
2643
  new_window_ms: nonNegInt,
2195
2644
  /** 1.9: this is the copy saved at the last read, shown while everything is read again. */
2196
- updating: z29.boolean().optional(),
2645
+ updating: z30.boolean().optional(),
2197
2646
  /** 1.9: false while the folder watches are down (changes are not arriving); `apps.chats.watch_state` says when it changes. */
2198
- live: z29.boolean().optional(),
2647
+ live: z30.boolean().optional(),
2199
2648
  /** 1.10: every listed chat that is a fork or a copy of another (read from the conversations' first lines). */
2200
- families: z29.array(ChatFamily).max(2e4).optional()
2649
+ families: z30.array(ChatFamily).max(2e4).optional()
2201
2650
  });
2202
- var AppsChatsWatchParams = z29.strictObject({ app_key: AppKey });
2203
- var AppsChatsWatchResult = z29.strictObject({ resource_id: ResourceId, version: nonNegInt });
2204
- var AppsChatsChangedEvent = z29.strictObject({
2651
+ var AppsChatsWatchParams = z30.strictObject({ app_key: AppKey });
2652
+ var AppsChatsWatchResult = z30.strictObject({ resource_id: ResourceId, version: nonNegInt });
2653
+ var AppsChatsChangedEvent = z30.strictObject({
2205
2654
  app_key: AppKey,
2206
2655
  version: nonNegInt,
2207
- ids: z29.array(ChatId).max(1e3),
2208
- all: z29.boolean()
2656
+ ids: z30.array(ChatId).max(1e3),
2657
+ all: z30.boolean()
2209
2658
  });
2210
- var AppsChatsWatchStateEvent = z29.strictObject({
2659
+ var AppsChatsWatchStateEvent = z30.strictObject({
2211
2660
  app_key: AppKey,
2212
- live: z29.boolean(),
2213
- updating: z29.boolean(),
2214
- reason: z29.string().max(300).nullable()
2661
+ live: z30.boolean(),
2662
+ updating: z30.boolean(),
2663
+ reason: z30.string().max(300).nullable()
2215
2664
  });
2216
- var AppsChatsPlaceParams = z29.strictObject({
2665
+ var AppsChatsPlaceParams = z30.strictObject({
2217
2666
  app_key: AppKey,
2218
2667
  chat_id: ChatId,
2219
- action: z29.enum(["place", "take_off", "hold"]),
2668
+ action: z30.enum(["place", "take_off", "hold"]),
2220
2669
  /** The window (for place and take_off). */
2221
2670
  window: ChatPlace.optional(),
2222
2671
  /** take_off where it is open: stop it there first (the person confirmed). */
2223
- stop_if_open: z29.boolean().default(false)
2672
+ stop_if_open: z30.boolean().default(false)
2224
2673
  });
2225
- var AppsChatsPlaceResult = z29.strictObject({ chat: ChatRow, message: z29.string().max(400) });
2226
- var AppsProjectsFileManyParams = z29.strictObject({
2674
+ var AppsChatsPlaceResult = z30.strictObject({ chat: ChatRow, message: z30.string().max(400) });
2675
+ var AppsProjectsFileManyParams = z30.strictObject({
2227
2676
  app_key: AppKey,
2228
- chat_ids: z29.array(ChatId).min(1).max(500),
2677
+ chat_ids: z30.array(ChatId).min(1).max(500),
2229
2678
  project_id: ChatProjectId.optional(),
2230
- new_project_name: z29.string().min(1).max(200).optional()
2679
+ new_project_name: z30.string().min(1).max(200).optional()
2231
2680
  });
2232
- var AppsProjectsFileManyResult = z29.strictObject({ chats: z29.array(ChatRow).max(500), project: ChatProject });
2233
- var AppsProjectsUpdateParams = z29.strictObject({
2681
+ var AppsProjectsFileManyResult = z30.strictObject({ chats: z30.array(ChatRow).max(500), project: ChatProject });
2682
+ var AppsProjectsUpdateParams = z30.strictObject({
2234
2683
  app_key: AppKey,
2235
2684
  project_id: ChatProjectId,
2236
- name: z29.string().min(1).max(200).optional(),
2237
- archived: z29.boolean().optional()
2685
+ name: z30.string().min(1).max(200).optional(),
2686
+ archived: z30.boolean().optional()
2238
2687
  });
2239
- var AppsProjectsUpdateResult = z29.strictObject({ project: ChatProject });
2240
- var AppsProjectsCopyParams = z29.strictObject({ app_key: AppKey, project_id: ChatProjectId, new_project_name: z29.string().min(1).max(200) });
2241
- var AppsProjectsCopyResult = z29.strictObject({ project: ChatProject });
2242
- var AppsProjectsFileParams = z29.strictObject({
2688
+ var AppsProjectsUpdateResult = z30.strictObject({ project: ChatProject });
2689
+ var AppsProjectsCopyParams = z30.strictObject({ app_key: AppKey, project_id: ChatProjectId, new_project_name: z30.string().min(1).max(200) });
2690
+ var AppsProjectsCopyResult = z30.strictObject({ project: ChatProject });
2691
+ var AppsProjectsFileParams = z30.strictObject({
2243
2692
  app_key: AppKey,
2244
2693
  chat_id: ChatId,
2245
2694
  project_id: ChatProjectId.optional(),
2246
- new_project_name: z29.string().min(1).max(200).optional()
2695
+ new_project_name: z30.string().min(1).max(200).optional()
2247
2696
  });
2248
- var AppsProjectsFileResult = z29.strictObject({ chat: ChatRow, project: ChatProject });
2249
- var AppsProjectsUnfileParams = z29.strictObject({ app_key: AppKey, chat_id: ChatId, project_id: ChatProjectId });
2250
- var AppsProjectsUnfileResult = z29.strictObject({ chat: ChatRow });
2251
- var AppsChatsStarParams = z29.strictObject({ app_key: AppKey, chat_id: ChatId, starred: z29.boolean() });
2252
- var AppsChatsStarResult = z29.strictObject({ chat: ChatRow });
2697
+ var AppsProjectsFileResult = z30.strictObject({ chat: ChatRow, project: ChatProject });
2698
+ var AppsProjectsUnfileParams = z30.strictObject({ app_key: AppKey, chat_id: ChatId, project_id: ChatProjectId });
2699
+ var AppsProjectsUnfileResult = z30.strictObject({ chat: ChatRow });
2700
+ var AppsChatsStarParams = z30.strictObject({ app_key: AppKey, chat_id: ChatId, starred: z30.boolean() });
2701
+ var AppsChatsStarResult = z30.strictObject({ chat: ChatRow });
2253
2702
 
2254
2703
  // src/schema/apps-accounts.ts
2255
- import { z as z30 } from "zod";
2256
- var AppWindowInfo = z30.strictObject({
2704
+ import { z as z31 } from "zod";
2705
+ var AppWindowInfo = z31.strictObject({
2257
2706
  key: ChatPlace,
2258
2707
  /** The app's default profile (Claude: main, which may sign into any account). */
2259
- main: z30.boolean(),
2708
+ main: z31.boolean(),
2260
2709
  /** The account the window is meant for (null for main). */
2261
- account: z30.string().max(320).nullable(),
2710
+ account: z31.string().max(320).nullable(),
2262
2711
  /** The account signed in there now: an email, or the account id while it has no saved name. */
2263
- signed_in: z30.string().max(320).nullable(),
2264
- signed_in_is_email: z30.boolean(),
2712
+ signed_in: z31.string().max(320).nullable(),
2713
+ signed_in_is_email: z31.boolean(),
2265
2714
  /** Signed into another account than the one it is meant for. */
2266
- mismatch: z30.boolean(),
2715
+ mismatch: z31.boolean(),
2267
2716
  /** Its folder exists. */
2268
- created: z30.boolean(),
2717
+ created: z31.boolean(),
2269
2718
  /** Open now. */
2270
- running: z30.boolean(),
2719
+ running: z31.boolean(),
2271
2720
  /** Chats open in it now (a process resuming each one). */
2272
2721
  open_chats: nonNegInt
2273
2722
  });
2274
- var AccountUsage = z30.strictObject({
2723
+ var AccountUsage = z31.strictObject({
2275
2724
  /** The account's email, or "org <8 chars>" when no window has ever sampled that org. */
2276
- account: z30.string().max(320),
2277
- org: z30.string().max(80).nullable(),
2725
+ account: z31.string().max(320),
2726
+ org: z31.string().max(80).nullable(),
2278
2727
  /** False when the org was sampled in several accounts' windows and the vote is not clear (≥ 75 %). */
2279
- account_certain: z30.boolean(),
2728
+ account_certain: z31.boolean(),
2280
2729
  /** 5-hour use in percent (0 once the reading is over 5 hours old). */
2281
- five_hour: z30.number().nullable(),
2282
- five_hour_reset_since: z30.boolean(),
2730
+ five_hour: z31.number().nullable(),
2731
+ five_hour_reset_since: z31.boolean(),
2283
2732
  /** Weekly use in percent (0 once the week reset after the reading). */
2284
- weekly: z30.number().nullable(),
2285
- weekly_reset_since: z30.boolean(),
2733
+ weekly: z31.number().nullable(),
2734
+ weekly_reset_since: z31.boolean(),
2286
2735
  /** Extra-usage spend in percent of its cap, when on. */
2287
- extra_usage: z30.number().nullable(),
2736
+ extra_usage: z31.number().nullable(),
2288
2737
  extra_usage_as_of_ms: epochMs.nullable(),
2289
2738
  as_of_ms: epochMs,
2290
2739
  /** The windows meant for this account (and main when main took the reading). */
2291
- windows: z30.array(ChatPlace).max(200),
2740
+ windows: z31.array(ChatPlace).max(200),
2292
2741
  /** The window that took the reading is open now and the reading is under 30 minutes old. */
2293
- live: z30.boolean(),
2742
+ live: z31.boolean(),
2294
2743
  /** The next weekly reset, when known. */
2295
2744
  weekly_resets_at_ms: epochMs.nullable(),
2296
2745
  /** That reset time is Claude's own (its reading, or a reset seen in its usage history). */
2297
- weekly_reset_official: z30.boolean().nullable(),
2746
+ weekly_reset_official: z31.boolean().nullable(),
2298
2747
  /** 1.13: the account's plan as the app names it (Codex: "pro", "prolite"), when recorded. */
2299
- plan: z30.string().max(80).optional(),
2748
+ plan: z31.string().max(80).optional(),
2300
2749
  /** 1.13: the account's credit balance as the app records it (Codex), when recorded. */
2301
- credits: z30.string().max(40).optional(),
2750
+ credits: z31.string().max(40).optional(),
2302
2751
  /**
2303
2752
  * 1.25: the latest the account's 5-hour window can reset: 5 hours after the first reading of this
2304
2753
  * window's use (its usage history), so the real reset is at or before it. Absent when no 5-hour
@@ -2306,81 +2755,81 @@ var AccountUsage = z30.strictObject({
2306
2755
  */
2307
2756
  five_hour_resets_by_ms: epochMs.optional()
2308
2757
  });
2309
- var AccountReset = z30.strictObject({
2758
+ var AccountReset = z31.strictObject({
2310
2759
  window: ChatPlace,
2311
- account: z30.string().max(320).nullable(),
2760
+ account: z31.string().max(320).nullable(),
2312
2761
  next_reset_ms: epochMs.nullable(),
2313
2762
  /** claude: the app's own reading; usage_history: a weekly drop seen in its usage record; your_list: the person's own entry. */
2314
- source: z30.enum(["claude", "usage_history", "your_list"]).nullable(),
2763
+ source: z31.enum(["claude", "usage_history", "your_list"]).nullable(),
2315
2764
  /** claude or usage_history. */
2316
- official: z30.boolean(),
2765
+ official: z31.boolean(),
2317
2766
  /** Set when the person's list disagrees with the official time. */
2318
- note: z30.string().max(200).nullable()
2767
+ note: z31.string().max(200).nullable()
2319
2768
  });
2320
- var AppsWindowsListParams = z30.strictObject({ app_key: AppKey });
2321
- var AppsWindowsListResult = z30.strictObject({ app_key: AppKey, windows: z30.array(AppWindowInfo).max(200) });
2322
- var AppsAccountsUsageParams = z30.strictObject({ app_key: AppKey });
2323
- var AppsAccountsUsageResult = z30.strictObject({
2769
+ var AppsWindowsListParams = z31.strictObject({ app_key: AppKey });
2770
+ var AppsWindowsListResult = z31.strictObject({ app_key: AppKey, windows: z31.array(AppWindowInfo).max(200) });
2771
+ var AppsAccountsUsageParams = z31.strictObject({ app_key: AppKey });
2772
+ var AppsAccountsUsageResult = z31.strictObject({
2324
2773
  app_key: AppKey,
2325
- accounts: z30.array(AccountUsage).max(500),
2774
+ accounts: z31.array(AccountUsage).max(500),
2326
2775
  /** 1.12: the rows are right but something around them failed (a newly read reset time could not be saved); shown, never hidden. */
2327
- problem: z30.string().max(400).optional()
2776
+ problem: z31.string().max(400).optional()
2328
2777
  });
2329
- var AppsAccountsResetsParams = z30.strictObject({ app_key: AppKey });
2330
- var AppsAccountsResetsResult = z30.strictObject({
2778
+ var AppsAccountsResetsParams = z31.strictObject({ app_key: AppKey });
2779
+ var AppsAccountsResetsResult = z31.strictObject({
2331
2780
  app_key: AppKey,
2332
- resets: z30.array(AccountReset).max(200),
2781
+ resets: z31.array(AccountReset).max(200),
2333
2782
  /** 1.12: as on `apps.accounts.usage`. */
2334
- problem: z30.string().max(400).optional()
2783
+ problem: z31.string().max(400).optional()
2335
2784
  });
2336
- var AppsWindowActionResult = z30.strictObject({ message: z30.string().max(400) });
2337
- var AppsWindowsOpenParams = z30.strictObject({ app_key: AppKey, window: ChatPlace });
2338
- var AppsWindowsReloadParams = z30.strictObject({ app_key: AppKey, window: ChatPlace });
2339
- var ShownSection = z30.strictObject({
2340
- title: z30.string().max(300),
2785
+ var AppsWindowActionResult = z31.strictObject({ message: z31.string().max(400) });
2786
+ var AppsWindowsOpenParams = z31.strictObject({ app_key: AppKey, window: ChatPlace });
2787
+ var AppsWindowsReloadParams = z31.strictObject({ app_key: AppKey, window: ChatPlace });
2788
+ var ShownSection = z31.strictObject({
2789
+ title: z31.string().max(300),
2341
2790
  /** Rows drawn under it (a collapsed section draws none). */
2342
- rows: z30.number().int().nonnegative(),
2343
- expanded: z30.boolean()
2791
+ rows: z31.number().int().nonnegative(),
2792
+ expanded: z31.boolean()
2344
2793
  });
2345
- var AppsWindowsShownParams = z30.strictObject({ app_key: AppKey, window: ChatPlace });
2346
- var AppsWindowsShownResult = z30.strictObject({
2794
+ var AppsWindowsShownParams = z31.strictObject({ app_key: AppKey, window: ChatPlace });
2795
+ var AppsWindowsShownResult = z31.strictObject({
2347
2796
  window: ChatPlace,
2348
- open: z30.boolean(),
2349
- sections: z30.array(ShownSection).max(200),
2350
- problem: z30.string().max(400).nullable()
2797
+ open: z31.boolean(),
2798
+ sections: z31.array(ShownSection).max(200),
2799
+ problem: z31.string().max(400).nullable()
2351
2800
  });
2352
- var AppsWindowsRestartParams = z30.strictObject({ app_key: AppKey, window: ChatPlace, force: z30.boolean().default(false) });
2353
- var AppsWindowsRefreshUsageParams = z30.strictObject({ app_key: AppKey, window: ChatPlace });
2354
- var AppsProjectsMoveParams = z30.strictObject({
2801
+ var AppsWindowsRestartParams = z31.strictObject({ app_key: AppKey, window: ChatPlace, force: z31.boolean().default(false) });
2802
+ var AppsWindowsRefreshUsageParams = z31.strictObject({ app_key: AppKey, window: ChatPlace });
2803
+ var AppsProjectsMoveParams = z31.strictObject({
2355
2804
  app_key: AppKey,
2356
2805
  chat_id: ChatId,
2357
2806
  from_project_id: ChatProjectId,
2358
2807
  to_project_id: ChatProjectId.optional(),
2359
- new_project_name: z30.string().min(1).max(200).optional()
2360
- });
2361
- var AppsProjectsMoveResult = z30.strictObject({ chat: ChatRow, project: ChatProject });
2362
- var AppsProjectsCreateParams = z30.strictObject({ app_key: AppKey, name: z30.string().min(1).max(200) });
2363
- var AppsProjectsCreateResult = z30.strictObject({ project: ChatProject });
2364
- var AppsProjectsImportPinsParams = z30.strictObject({ app_key: AppKey });
2365
- var AppsProjectsImportPinsResult = z30.strictObject({ message: z30.string().max(400) });
2366
- var ProjectMoveChat = z30.strictObject({ chat_id: ChatId, title: z30.string().max(300) });
2367
- var ProjectMoveSkip = z30.strictObject({ chat_id: ChatId, title: z30.string().max(300), window: ChatPlace.nullable(), reason: z30.string().max(400) });
2368
- var ProjectMoveGroup = z30.strictObject({
2369
- ok: z30.boolean(),
2370
- name: z30.string().max(200),
2808
+ new_project_name: z31.string().min(1).max(200).optional()
2809
+ });
2810
+ var AppsProjectsMoveResult = z31.strictObject({ chat: ChatRow, project: ChatProject });
2811
+ var AppsProjectsCreateParams = z31.strictObject({ app_key: AppKey, name: z31.string().min(1).max(200) });
2812
+ var AppsProjectsCreateResult = z31.strictObject({ project: ChatProject });
2813
+ var AppsProjectsImportPinsParams = z31.strictObject({ app_key: AppKey });
2814
+ var AppsProjectsImportPinsResult = z31.strictObject({ message: z31.string().max(400) });
2815
+ var ProjectMoveChat = z31.strictObject({ chat_id: ChatId, title: z31.string().max(300) });
2816
+ var ProjectMoveSkip = z31.strictObject({ chat_id: ChatId, title: z31.string().max(300), window: ChatPlace.nullable(), reason: z31.string().max(400) });
2817
+ var ProjectMoveGroup = z31.strictObject({
2818
+ ok: z31.boolean(),
2819
+ name: z31.string().max(200),
2371
2820
  /** Why it is not (or was not) grouped — e.g. the window is open. */
2372
- reason: z30.string().max(400).optional(),
2821
+ reason: z31.string().max(400).optional(),
2373
2822
  /** Chats that get (or got) the group; already in it; taken from another group of the window. */
2374
2823
  assign: nonNegInt.optional(),
2375
2824
  already: nonNegInt.optional(),
2376
2825
  from_other_groups: nonNegInt.optional(),
2377
2826
  /** A group of that name was already there (reused, never doubled). */
2378
- group_exists: z30.boolean().optional()
2827
+ group_exists: z31.boolean().optional()
2379
2828
  });
2380
- var ProjectMovePin = z30.strictObject({
2381
- ok: z30.boolean(),
2829
+ var ProjectMovePin = z31.strictObject({
2830
+ ok: z31.boolean(),
2382
2831
  /** "now" = written into the closed window; "next_close" = queued until that window closes. */
2383
- when: z30.enum(["now", "next_close"]),
2832
+ when: z31.enum(["now", "next_close"]),
2384
2833
  /** Pinned by this call (dry run: would be). */
2385
2834
  pinned: nonNegInt,
2386
2835
  /** Already pinned there. */
@@ -2388,104 +2837,108 @@ var ProjectMovePin = z30.strictObject({
2388
2837
  /** Waiting for the window to close (dry run: would wait). */
2389
2838
  queued: nonNegInt,
2390
2839
  /** Why not pinned (ok false), or why queued. */
2391
- reason: z30.string().max(400).optional()
2840
+ reason: z31.string().max(400).optional()
2392
2841
  });
2393
- var AppsProjectsToWindowParams = z30.strictObject({
2842
+ var AppsProjectsToWindowParams = z31.strictObject({
2394
2843
  app_key: AppKey,
2395
2844
  project_id: ChatProjectId,
2396
2845
  window: ChatPlace,
2397
2846
  /** Also take each chat off its other side windows where safe (never main, the holder, an open window). */
2398
- take_off: z30.boolean().default(false),
2847
+ take_off: z31.boolean().default(false),
2399
2848
  /** Also group them under the project's name in that window's sidebar (closed windows only). */
2400
- group: z30.boolean().default(false),
2849
+ group: z31.boolean().default(false),
2401
2850
  /** 1.32: also pin them in that window (now if closed, else when it next closes). */
2402
- pin: z30.boolean().optional(),
2403
- dry_run: z30.boolean().default(false)
2404
- });
2405
- var AppsProjectsToWindowResult = z30.strictObject({
2851
+ pin: z31.boolean().optional(),
2852
+ /** 1.36: a batch: exactly these chats of the project and no other (a reused marker is a label, never a sweep). */
2853
+ chat_ids: z31.array(ChatId).min(1).max(5e3).optional(),
2854
+ /** 1.36: take them off this one side window only (a Move's origin), never main or another window that lists them. */
2855
+ take_off_from: ChatPlace.optional(),
2856
+ dry_run: z31.boolean().default(false)
2857
+ });
2858
+ var AppsProjectsToWindowResult = z31.strictObject({
2406
2859
  project_id: ChatProjectId,
2407
2860
  window: ChatPlace,
2408
- dry_run: z30.boolean(),
2409
- place: z30.array(ProjectMoveChat).max(5e3),
2410
- already: z30.array(ProjectMoveChat).max(5e3),
2411
- take_off: z30.array(ProjectMoveChat.extend({ window: ChatPlace })).max(2e4),
2412
- skipped: z30.array(ProjectMoveSkip).max(2e4),
2861
+ dry_run: z31.boolean(),
2862
+ place: z31.array(ProjectMoveChat).max(5e3),
2863
+ already: z31.array(ProjectMoveChat).max(5e3),
2864
+ take_off: z31.array(ProjectMoveChat.extend({ window: ChatPlace })).max(2e4),
2865
+ skipped: z31.array(ProjectMoveSkip).max(2e4),
2413
2866
  /** Chats of the project from other apps (no windows to place into), left as they are. */
2414
2867
  other_apps: nonNegInt,
2415
2868
  group: ProjectMoveGroup.nullable(),
2416
2869
  /** 1.32: the pin in the target window (absent: not asked). */
2417
2870
  pin: ProjectMovePin.optional(),
2418
- message: z30.string().max(400)
2871
+ message: z31.string().max(400)
2419
2872
  });
2420
- var ColdChat = z30.strictObject({
2873
+ var ColdChat = z31.strictObject({
2421
2874
  id: ChatId,
2422
- title: z30.string().max(1e3),
2423
- repo: z30.string().max(200).nullable(),
2424
- window: z30.string().max(64).nullable(),
2425
- account: z30.string().max(320).nullable(),
2426
- model_name: z30.string().max(120).nullable(),
2875
+ title: z31.string().max(1e3),
2876
+ repo: z31.string().max(200).nullable(),
2877
+ window: z31.string().max(64).nullable(),
2878
+ account: z31.string().max(320).nullable(),
2879
+ model_name: z31.string().max(120).nullable(),
2427
2880
  context_tokens: nonNegInt,
2428
2881
  cold_at_ms: epochMs,
2429
2882
  /** Waking it once the cache is cold. */
2430
- cold_cost: z30.number().nullable(),
2883
+ cold_cost: z31.number().nullable(),
2431
2884
  /** Waking it while the cache is warm. */
2432
- warm_cost: z30.number().nullable(),
2885
+ warm_cost: z31.number().nullable(),
2433
2886
  /** Its account is on extra usage (a 5-minute cache, and real money). */
2434
- extra_usage: z30.boolean(),
2887
+ extra_usage: z31.boolean(),
2435
2888
  /** A scheduled routine's run. */
2436
- scheduled: z30.boolean(),
2889
+ scheduled: z31.boolean(),
2437
2890
  /** It can be shown in its window (started in the desktop app). */
2438
- openable: z30.boolean(),
2891
+ openable: z31.boolean(),
2439
2892
  /** How its window was decided, or why it can't be opened. */
2440
- how: z30.string().max(200).nullable()
2893
+ how: z31.string().max(200).nullable()
2441
2894
  });
2442
- var AppsChatsColdParams = z30.strictObject({ app_key: AppKey });
2443
- var AppsChatsColdResult = z30.strictObject({
2895
+ var AppsChatsColdParams = z31.strictObject({ app_key: AppKey });
2896
+ var AppsChatsColdResult = z31.strictObject({
2444
2897
  app_key: AppKey,
2445
2898
  /** Waiting for the person with a warm cache, most urgent first. */
2446
- waiting: z30.array(ColdChat).max(2e3),
2899
+ waiting: z31.array(ColdChat).max(2e3),
2447
2900
  /** Went cold in the last while. */
2448
- recently_cold: z30.array(ColdChat).max(2e3),
2901
+ recently_cold: z31.array(ColdChat).max(2e3),
2449
2902
  /** Chats working right now (not waiting). */
2450
2903
  working: nonNegInt
2451
2904
  });
2452
- var TitleCopies = z30.strictObject({
2905
+ var TitleCopies = z31.strictObject({
2453
2906
  window: ChatPlace,
2454
2907
  /** Record copies in that window holding a different name (main keeps one per account folder). */
2455
2908
  copies: nonNegInt,
2456
- titles: z30.array(z30.strictObject({ title: z30.string().max(2e3), source: z30.string().max(32) })).max(50)
2909
+ titles: z31.array(z31.strictObject({ title: z31.string().max(2e3), source: z31.string().max(32) })).max(50)
2457
2910
  });
2458
- var TitleMismatch = z30.strictObject({
2911
+ var TitleMismatch = z31.strictObject({
2459
2912
  chat_id: ChatId,
2460
2913
  /** The right name: the latest one a person gave it (in any window, or in Matrx), else the newest automatic title. */
2461
- title: z30.string().max(2e3),
2462
- title_source: z30.enum(["user", "auto"]),
2914
+ title: z31.string().max(2e3),
2915
+ title_source: z31.enum(["user", "auto"]),
2463
2916
  /** Where the right name came from: a window, "matrx", or "ledger" (decided earlier). */
2464
- decided_from: z30.string().max(64),
2465
- kind: z30.enum(["user_vs_auto", "user_vs_user", "auto_vs_auto", "source_only"]),
2466
- windows: z30.array(ChatPlace).max(200),
2467
- differs_in: z30.array(TitleCopies).max(200)
2917
+ decided_from: z31.string().max(64),
2918
+ kind: z31.enum(["user_vs_auto", "user_vs_user", "auto_vs_auto", "source_only"]),
2919
+ windows: z31.array(ChatPlace).max(200),
2920
+ differs_in: z31.array(TitleCopies).max(200)
2468
2921
  });
2469
- var StaleTitleWindow = z30.strictObject({
2922
+ var StaleTitleWindow = z31.strictObject({
2470
2923
  window: ChatPlace,
2471
2924
  /** First and latest time (ms) it was seen writing an old name back. */
2472
2925
  since_ms: nonNegInt,
2473
2926
  last_ms: nonNegInt
2474
2927
  });
2475
- var AppsChatsTitlesCheckParams = z30.strictObject({ app_key: AppKey });
2476
- var AppsChatsTitlesCheckResult = z30.strictObject({
2928
+ var AppsChatsTitlesCheckParams = z31.strictObject({ app_key: AppKey });
2929
+ var AppsChatsTitlesCheckResult = z31.strictObject({
2477
2930
  app_key: AppKey,
2478
2931
  chats_total: nonNegInt,
2479
2932
  chats_in_several_windows: nonNegInt,
2480
2933
  /** Chats with a different name in some window (or in Matrx). */
2481
2934
  chats_with_a_different_name: nonNegInt,
2482
2935
  copies_to_write: nonNegInt,
2483
- chats: z30.array(TitleMismatch).max(5e3),
2936
+ chats: z31.array(TitleMismatch).max(5e3),
2484
2937
  /** Windows that keep writing old names back (each is fixed every pass; reloading it, Cmd+R, stops it). Since 1.33. */
2485
- stale_windows: z30.array(StaleTitleWindow).max(200).optional()
2938
+ stale_windows: z31.array(StaleTitleWindow).max(200).optional()
2486
2939
  });
2487
- var AppsChatsTitlesPushParams = z30.strictObject({ app_key: AppKey, chat_id: ChatId.optional(), dry_run: z30.boolean().optional() });
2488
- var AppsChatsTitlesPushResult = z30.strictObject({
2940
+ var AppsChatsTitlesPushParams = z31.strictObject({ app_key: AppKey, chat_id: ChatId.optional(), dry_run: z31.boolean().optional() });
2941
+ var AppsChatsTitlesPushResult = z31.strictObject({
2489
2942
  app_key: AppKey,
2490
2943
  /** Record files rewritten (title and titleSource only, each backed up first). */
2491
2944
  written: nonNegInt,
@@ -2495,122 +2948,122 @@ var AppsChatsTitlesPushResult = z30.strictObject({
2495
2948
  /** Still different after the push (dry_run: would be written). */
2496
2949
  chats_with_a_different_name: nonNegInt
2497
2950
  });
2498
- var AppsChatsOpenParams = z30.strictObject({ app_key: AppKey, chat_id: ChatId, window: ChatPlace.optional() });
2499
- var SpendSplit = z30.strictObject({ main: z30.number(), helpers: z30.number() });
2500
- var SpendScopes = z30.strictObject({ today: SpendSplit, week: SpendSplit });
2501
- var SpendAccount = z30.strictObject({
2502
- account: z30.string().max(320),
2951
+ var AppsChatsOpenParams = z31.strictObject({ app_key: AppKey, chat_id: ChatId, window: ChatPlace.optional() });
2952
+ var SpendSplit = z31.strictObject({ main: z31.number(), helpers: z31.number() });
2953
+ var SpendScopes = z31.strictObject({ today: SpendSplit, week: SpendSplit });
2954
+ var SpendAccount = z31.strictObject({
2955
+ account: z31.string().max(320),
2503
2956
  spend: SpendScopes,
2504
- last_hour: z30.number().nullable(),
2505
- last_5h: z30.number().nullable(),
2506
- five_hour: z30.number().nullable(),
2507
- weekly: z30.number().nullable(),
2957
+ last_hour: z31.number().nullable(),
2958
+ last_5h: z31.number().nullable(),
2959
+ five_hour: z31.number().nullable(),
2960
+ weekly: z31.number().nullable(),
2508
2961
  as_of_ms: epochMs.nullable(),
2509
2962
  weekly_resets_at_ms: epochMs.nullable(),
2510
2963
  /** When the 5-hour or weekly limit is projected to be reached at the current burn. */
2511
2964
  five_hour_full_at_ms: epochMs.nullable(),
2512
2965
  weekly_full_at_ms: epochMs.nullable(),
2513
2966
  /** The reading is too old to project. */
2514
- stale: z30.boolean()
2967
+ stale: z31.boolean()
2515
2968
  });
2516
- var SpendModel = z30.strictObject({ model: z30.string().max(120), name: z30.string().max(120), spend: SpendScopes });
2517
- var SpendChat = z30.strictObject({
2969
+ var SpendModel = z31.strictObject({ model: z31.string().max(120), name: z31.string().max(120), spend: SpendScopes });
2970
+ var SpendChat = z31.strictObject({
2518
2971
  id: ChatId,
2519
- title: z30.string().max(1e3),
2520
- repo: z30.string().max(200).nullable(),
2521
- window: z30.string().max(64).nullable(),
2972
+ title: z31.string().max(1e3),
2973
+ repo: z31.string().max(200).nullable(),
2974
+ window: z31.string().max(64).nullable(),
2522
2975
  spend: SpendScopes,
2523
2976
  helpers: nonNegInt
2524
2977
  });
2525
- var SpendHelper = z30.strictObject({ model: z30.string().max(120), steps: nonNegInt, over_steps: z30.boolean(), description: z30.string().max(400) });
2526
- var SpendLive = z30.strictObject({ id: ChatId, title: z30.string().max(1e3), window: z30.string().max(64).nullable(), helpers: z30.array(SpendHelper).max(200) });
2527
- var SpendIdleScope = z30.strictObject({ count: nonNegInt, tokens: nonNegInt, cost: z30.number(), avoidable: z30.number() });
2528
- var SpendIdle = z30.strictObject({ id: ChatId, chat: z30.string().max(1e3), who: z30.string().max(400), today: SpendIdleScope, week: SpendIdleScope, last_ms: epochMs });
2529
- var SpendStart = z30.strictObject({ repo: z30.string().max(200), count: nonNegInt, median: nonNegInt, latest: z30.array(nonNegInt).max(20), alarm: z30.string().max(400).nullable() });
2530
- var SpendDay = z30.strictObject({ date: z30.string().regex(/^\d{4}-\d{2}-\d{2}$/), main: z30.number(), helpers: z30.number() });
2531
- var AppsSpendParams = z30.strictObject({ app_key: AppKey });
2532
- var AppsSpendResult = z30.strictObject({
2978
+ var SpendHelper = z31.strictObject({ model: z31.string().max(120), steps: nonNegInt, over_steps: z31.boolean(), description: z31.string().max(400) });
2979
+ var SpendLive = z31.strictObject({ id: ChatId, title: z31.string().max(1e3), window: z31.string().max(64).nullable(), helpers: z31.array(SpendHelper).max(200) });
2980
+ var SpendIdleScope = z31.strictObject({ count: nonNegInt, tokens: nonNegInt, cost: z31.number(), avoidable: z31.number() });
2981
+ var SpendIdle = z31.strictObject({ id: ChatId, chat: z31.string().max(1e3), who: z31.string().max(400), today: SpendIdleScope, week: SpendIdleScope, last_ms: epochMs });
2982
+ 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() });
2983
+ var SpendDay = z31.strictObject({ date: z31.string().regex(/^\d{4}-\d{2}-\d{2}$/), main: z31.number(), helpers: z31.number() });
2984
+ var AppsSpendParams = z31.strictObject({ app_key: AppKey });
2985
+ var AppsSpendResult = z31.strictObject({
2533
2986
  app_key: AppKey,
2534
2987
  /** False while older chats are still being read. */
2535
- complete: z30.boolean(),
2536
- today_total: z30.number(),
2537
- week_total: z30.number(),
2538
- idle_today: z30.number(),
2539
- idle_week: z30.number(),
2988
+ complete: z31.boolean(),
2989
+ today_total: z31.number(),
2990
+ week_total: z31.number(),
2991
+ idle_today: z31.number(),
2992
+ idle_week: z31.number(),
2540
2993
  /** Models with no known list price. */
2541
- unpriced: z30.array(z30.string().max(120)).max(100),
2994
+ unpriced: z31.array(z31.string().max(120)).max(100),
2542
2995
  /** Helpers past their step budget, unusual starting sizes. */
2543
- alarms: z30.array(z30.string().max(400)).max(200),
2544
- live: z30.array(SpendLive).max(200),
2545
- accounts: z30.array(SpendAccount).max(200),
2546
- models: z30.array(SpendModel).max(100),
2996
+ alarms: z31.array(z31.string().max(400)).max(200),
2997
+ live: z31.array(SpendLive).max(200),
2998
+ accounts: z31.array(SpendAccount).max(200),
2999
+ models: z31.array(SpendModel).max(100),
2547
3000
  /** (1.24) The last 7 days, oldest first (today last). */
2548
- days: z30.array(SpendDay).max(14).optional(),
2549
- chats: z30.array(SpendChat).max(500),
2550
- idle: z30.array(SpendIdle).max(500),
2551
- starts: z30.array(SpendStart).max(200)
2552
- });
2553
- var AppsSyncStatusParams = z30.strictObject({ app_key: AppKey });
2554
- var AppsSyncStatusResult = z30.strictObject({
2555
- healthy: z30.boolean(),
2556
- summary: z30.string().max(400),
2557
- problems: z30.array(z30.string().max(400)).max(200),
2558
- warnings: z30.array(z30.string().max(400)).max(200),
3001
+ days: z31.array(SpendDay).max(14).optional(),
3002
+ chats: z31.array(SpendChat).max(500),
3003
+ idle: z31.array(SpendIdle).max(500),
3004
+ starts: z31.array(SpendStart).max(200)
3005
+ });
3006
+ var AppsSyncStatusParams = z31.strictObject({ app_key: AppKey });
3007
+ var AppsSyncStatusResult = z31.strictObject({
3008
+ healthy: z31.boolean(),
3009
+ summary: z31.string().max(400),
3010
+ problems: z31.array(z31.string().max(400)).max(200),
3011
+ warnings: z31.array(z31.string().max(400)).max(200),
2559
3012
  /** Accounts seen with no saved name yet (Save account names fixes them). */
2560
- unnamed_accounts: z30.array(z30.string().max(80)).max(200),
3013
+ unnamed_accounts: z31.array(z31.string().max(80)).max(200),
2561
3014
  /** The full report. */
2562
- output: z30.string().max(2e5)
2563
- });
2564
- var AppsSyncRunParams = z30.strictObject({ app_key: AppKey });
2565
- var AppsWindowsProcessesParams = z30.strictObject({ app_key: AppKey });
2566
- var AppsWindowsProcessesResult = z30.strictObject({ processes: z30.array(z30.string().max(2e3)).max(2e3) });
2567
- var AppsWindowsAddParams = z30.strictObject({ app_key: AppKey, window: ChatPlace, email: z30.string().min(3).max(320) });
2568
- var AppsWindowsSaveNamesParams = z30.strictObject({ app_key: AppKey });
2569
- var AppsWindowsUpdateStateParams = z30.strictObject({ app_key: AppKey });
2570
- var AppsWindowsUpdateStateResult = z30.strictObject({
3015
+ output: z31.string().max(2e5)
3016
+ });
3017
+ var AppsSyncRunParams = z31.strictObject({ app_key: AppKey });
3018
+ var AppsWindowsProcessesParams = z31.strictObject({ app_key: AppKey });
3019
+ var AppsWindowsProcessesResult = z31.strictObject({ processes: z31.array(z31.string().max(2e3)).max(2e3) });
3020
+ var AppsWindowsAddParams = z31.strictObject({ app_key: AppKey, window: ChatPlace, email: z31.string().min(3).max(320) });
3021
+ var AppsWindowsSaveNamesParams = z31.strictObject({ app_key: AppKey });
3022
+ var AppsWindowsUpdateStateParams = z31.strictObject({ app_key: AppKey });
3023
+ var AppsWindowsUpdateStateResult = z31.strictObject({
2571
3024
  app_key: AppKey,
2572
- pending: z30.boolean(),
3025
+ pending: z31.boolean(),
2573
3026
  /** The downloaded release's name (Claude: "Claude 2.31226.1"), when the app's log names it. */
2574
- version: z30.string().max(120).nullable(),
3027
+ version: z31.string().max(120).nullable(),
2575
3028
  /** When the update became pending (the download's time), when known. */
2576
3029
  since_ms: epochMs.nullable(),
2577
3030
  /** Windows open when the update became pending (or last seen open) that are closed now. */
2578
- closed: z30.array(ChatPlace).max(200),
3031
+ closed: z31.array(ChatPlace).max(200),
2579
3032
  /**
2580
3033
  * Since 1.27: the windows in `closed` that the update itself quit (the app's log records a quit for
2581
3034
  * the update within a minute of when each was last seen running). Absent: not known.
2582
3035
  */
2583
- closed_by_update: z30.array(ChatPlace).max(200).optional()
3036
+ closed_by_update: z31.array(ChatPlace).max(200).optional()
2584
3037
  });
2585
- var AppsWindowsReopenParams = z30.strictObject({ app_key: AppKey, windows: z30.array(ChatPlace).min(1).max(200) });
2586
- var AppsWindowsReopenResult = z30.strictObject({ message: z30.string().max(400), opened: z30.array(ChatPlace).max(200) });
2587
- var AppsWindowsUpdateAndReopenParams = z30.strictObject({ app_key: AppKey, force: z30.boolean().default(false), dry_run: z30.boolean().default(false) });
2588
- var AppsWindowsUpdateAndReopenResult = z30.strictObject({
2589
- message: z30.string().max(400),
3038
+ var AppsWindowsReopenParams = z31.strictObject({ app_key: AppKey, windows: z31.array(ChatPlace).min(1).max(200) });
3039
+ var AppsWindowsReopenResult = z31.strictObject({ message: z31.string().max(400), opened: z31.array(ChatPlace).max(200) });
3040
+ var AppsWindowsUpdateAndReopenParams = z31.strictObject({ app_key: AppKey, force: z31.boolean().default(false), dry_run: z31.boolean().default(false) });
3041
+ var AppsWindowsUpdateAndReopenResult = z31.strictObject({
3042
+ message: z31.string().max(400),
2590
3043
  /** Windows quit (with dry_run: to be quit). */
2591
- quit: z30.array(ChatPlace).max(200),
3044
+ quit: z31.array(ChatPlace).max(200),
2592
3045
  /** Windows reopened (with dry_run: to be reopened), main first. */
2593
- reopened: z30.array(ChatPlace).max(200),
3046
+ reopened: z31.array(ChatPlace).max(200),
2594
3047
  /** The version installed, null when the install did not happen (or dry_run). */
2595
- installed_version: z30.string().max(64).nullable()
3048
+ installed_version: z31.string().max(64).nullable()
2596
3049
  });
2597
3050
 
2598
3051
  // src/schema/browser.ts
2599
- import { z as z31 } from "zod";
2600
- var BrowserClientInstance = z31.string().min(1).max(64).regex(/^[A-Za-z0-9_.:-]+$/);
2601
- var BrowserKind = z31.enum(["chrome", "edge", "brave", "arc", "opera", "vivaldi", "chromium", "firefox", "other"]);
2602
- var BrowserSessionState = z31.enum(["connected", "different_account", "extension_signed_out", "device_signed_out", "unverified"]);
2603
- var BrowserSession = z31.strictObject({
3052
+ import { z as z32 } from "zod";
3053
+ var BrowserClientInstance = z32.string().min(1).max(64).regex(/^[A-Za-z0-9_.:-]+$/);
3054
+ var BrowserKind = z32.enum(["chrome", "edge", "brave", "arc", "opera", "vivaldi", "chromium", "firefox", "other"]);
3055
+ var BrowserSessionState = z32.enum(["connected", "different_account", "extension_signed_out", "device_signed_out", "unverified"]);
3056
+ var BrowserSession = z32.strictObject({
2604
3057
  client_instance: BrowserClientInstance,
2605
3058
  /** What the person sees ("Chrome — Work"), set by the extension. */
2606
- client_label: z31.string().min(1).max(128),
3059
+ client_label: z32.string().min(1).max(128),
2607
3060
  browser: BrowserKind,
2608
- extension_version: z31.string().min(1).max(32),
3061
+ extension_version: z32.string().min(1).max(32),
2609
3062
  state: BrowserSessionState,
2610
3063
  /** True only for `connected`: an agent's call can reach this session. */
2611
- routable: z31.boolean(),
3064
+ routable: z32.boolean(),
2612
3065
  /** The extension's account email from its token (null when signed out or unknown). */
2613
- account_email: z31.string().max(320).nullable(),
3066
+ account_email: z32.string().max(320).nullable(),
2614
3067
  connected_at_ms: epochMs,
2615
3068
  last_call_at_ms: epochMs.nullable(),
2616
3069
  calls: nonNegInt,
@@ -2619,84 +3072,688 @@ var BrowserSession = z31.strictObject({
2619
3072
  p50_ms: nonNegInt.nullable(),
2620
3073
  p95_ms: nonNegInt.nullable(),
2621
3074
  /** A call is waiting for the person to confirm it in the browser. */
2622
- awaiting_confirmation: z31.boolean()
3075
+ awaiting_confirmation: z32.boolean()
2623
3076
  });
2624
- var BrowserRegisterParams = z31.strictObject({
3077
+ var BrowserRegisterParams = z32.strictObject({
2625
3078
  client_instance: BrowserClientInstance,
2626
- client_label: z31.string().min(1).max(128),
3079
+ client_label: z32.string().min(1).max(128),
2627
3080
  browser: BrowserKind,
2628
- extension_version: z31.string().min(1).max(32),
3081
+ extension_version: z32.string().min(1).max(32),
2629
3082
  /** The extension's current AI Matrx access token, checked against the device owner; null when signed out. */
2630
- account_token: z31.string().min(16).max(8192).nullable()
3083
+ account_token: z32.string().min(16).max(8192).nullable()
2631
3084
  });
2632
- var BrowserRegisterResult = z31.strictObject({ session: BrowserSession });
2633
- var BrowserCallError = z31.strictObject({
2634
- message: z31.string().max(1e3),
3085
+ var BrowserRegisterResult = z32.strictObject({ session: BrowserSession });
3086
+ var BrowserCallError = z32.strictObject({
3087
+ message: z32.string().max(1e3),
2635
3088
  /** The extension's own error code, when it has one ("tool_not_found", "denied"). */
2636
- code: z31.string().max(64).nullable()
3089
+ code: z32.string().max(64).nullable()
2637
3090
  });
2638
- var BrowserResultParams = z31.strictObject({
2639
- call_id: z31.string().min(1).max(64),
2640
- ok: z31.boolean(),
3091
+ var BrowserResultParams = z32.strictObject({
3092
+ call_id: z32.string().min(1).max(64),
3093
+ ok: z32.boolean(),
2641
3094
  /** The tool's result when ok (any JSON). */
2642
- result: z31.unknown(),
3095
+ result: z32.unknown(),
2643
3096
  error: BrowserCallError.nullable()
2644
3097
  });
2645
- var BrowserResultResult = z31.strictObject({ accepted: z31.boolean() });
2646
- var BrowserCallPhase = z31.enum(["awaiting_confirmation", "running"]);
2647
- var BrowserProgressParams = z31.strictObject({ call_id: z31.string().min(1).max(64), phase: BrowserCallPhase });
2648
- var BrowserProgressResult = z31.strictObject({ accepted: z31.boolean() });
2649
- var BrowserSessionsParams = z31.strictObject({});
2650
- var BrowserSessionsResult = z31.strictObject({
3098
+ var BrowserResultResult = z32.strictObject({ accepted: z32.boolean() });
3099
+ var BrowserCallPhase = z32.enum(["awaiting_confirmation", "running"]);
3100
+ var BrowserProgressParams = z32.strictObject({ call_id: z32.string().min(1).max(64), phase: BrowserCallPhase });
3101
+ var BrowserProgressResult = z32.strictObject({ accepted: z32.boolean() });
3102
+ var BrowserSessionsParams = z32.strictObject({});
3103
+ var BrowserSessionsResult = z32.strictObject({
2651
3104
  /** The person's Browser connection switch. Off: no pairing, no extension sessions. */
2652
- enabled: z31.boolean(),
3105
+ enabled: z32.boolean(),
2653
3106
  /** Whether Matrx 2 is signed in (without an owner no session is routable). */
2654
- owner_signed_in: z31.boolean(),
2655
- sessions: z31.array(BrowserSession).max(64)
2656
- });
2657
- var BrowserDisconnectParams = z31.strictObject({ client_instance: BrowserClientInstance });
2658
- var BrowserDisconnectResult = z31.strictObject({ disconnected: z31.boolean() });
2659
- var BrowserSetEnabledParams = z31.strictObject({ enabled: z31.boolean() });
2660
- var BrowserSetEnabledResult = z31.strictObject({ enabled: z31.boolean() });
2661
- var BrowserPairCodeParams = z31.strictObject({});
2662
- var BrowserPairCodeResult = z31.strictObject({ code: z31.string().min(16).max(128) });
2663
- var BrowserPairResetParams = z31.strictObject({});
2664
- var BrowserCallParams = z31.strictObject({
2665
- tool: z31.string().min(1).max(96).regex(/^[a-z][a-z0-9_]*$/),
2666
- args: z31.record(z31.string(), z31.unknown()),
3107
+ owner_signed_in: z32.boolean(),
3108
+ sessions: z32.array(BrowserSession).max(64)
3109
+ });
3110
+ var BrowserDisconnectParams = z32.strictObject({ client_instance: BrowserClientInstance });
3111
+ var BrowserDisconnectResult = z32.strictObject({ disconnected: z32.boolean() });
3112
+ var BrowserSetEnabledParams = z32.strictObject({ enabled: z32.boolean() });
3113
+ var BrowserSetEnabledResult = z32.strictObject({ enabled: z32.boolean() });
3114
+ var BrowserPairCodeParams = z32.strictObject({});
3115
+ var BrowserPairCodeResult = z32.strictObject({ code: z32.string().min(16).max(128) });
3116
+ var BrowserPairResetParams = z32.strictObject({});
3117
+ var BrowserCallParams = z32.strictObject({
3118
+ tool: z32.string().min(1).max(96).regex(/^[a-z][a-z0-9_]*$/),
3119
+ args: z32.record(z32.string(), z32.unknown()),
2667
3120
  /** Which session; default: the most recently active routable one (BROWSER ambiguity → CONFLICT). */
2668
3121
  client_instance: BrowserClientInstance.optional(),
2669
3122
  /** How long to wait, including a person's confirmation; default 120 s. */
2670
- timeout_ms: z31.int().min(1e3).max(6e5).optional()
3123
+ timeout_ms: z32.int().min(1e3).max(6e5).optional()
2671
3124
  });
2672
- var BrowserCallResult = z31.strictObject({
3125
+ var BrowserCallResult = z32.strictObject({
2673
3126
  client_instance: BrowserClientInstance,
2674
- result: z31.unknown(),
3127
+ result: z32.unknown(),
2675
3128
  duration_ms: nonNegInt
2676
3129
  });
2677
- var BrowserInvokeEvent = z31.strictObject({
2678
- call_id: z31.string().min(1).max(64),
2679
- tool: z31.string().min(1).max(96),
2680
- args: z31.record(z31.string(), z31.unknown()),
3130
+ var BrowserToolMetricsParams = z32.strictObject({ client_instance: BrowserClientInstance });
3131
+ var BrowserToolMetric = z32.strictObject({
3132
+ tool: z32.string().max(256),
3133
+ calls: nonNegInt,
3134
+ errors: nonNegInt,
3135
+ /** Over the last 200 answered calls; null before the first answer. */
3136
+ p50_ms: nonNegInt.nullable(),
3137
+ p95_ms: nonNegInt.nullable(),
3138
+ last_call_at_ms: epochMs.nullable(),
3139
+ last_error: z32.string().max(2048).nullable()
3140
+ });
3141
+ var BrowserToolMetricsResult = z32.strictObject({ client_instance: z32.string(), tools: z32.array(BrowserToolMetric) });
3142
+ var BrowserResetCountersParams = z32.strictObject({ client_instance: BrowserClientInstance });
3143
+ var BrowserResetCountersResult = z32.strictObject({ reset: z32.boolean() });
3144
+ var BrowserLogParams = z32.strictObject({
3145
+ /** Only messages after this seq (0: from the oldest kept; the core keeps the last 500). */
3146
+ after_seq: nonNegInt.default(0),
3147
+ limit: z32.int().min(1).max(500).default(500)
3148
+ });
3149
+ var BrowserLogMessage = z32.strictObject({
3150
+ seq: nonNegInt,
3151
+ at_ms: epochMs,
3152
+ direction: z32.enum(["to_browser", "from_browser", "core"]),
3153
+ client_instance: z32.string(),
3154
+ kind: z32.enum(["register", "invoke", "result", "progress", "timeout", "closed"]),
3155
+ tool: z32.string().nullable(),
3156
+ call_id: z32.string().nullable(),
3157
+ ok: z32.boolean().nullable(),
3158
+ detail: z32.string().max(1024)
3159
+ });
3160
+ var BrowserLogResult = z32.strictObject({
3161
+ messages: z32.array(BrowserLogMessage),
3162
+ /** The newest seq the core has written (pass it back as after_seq to follow the log). */
3163
+ last_seq: nonNegInt
3164
+ });
3165
+ var BrowserInvokeEvent = z32.strictObject({
3166
+ call_id: z32.string().min(1).max(64),
3167
+ tool: z32.string().min(1).max(96),
3168
+ args: z32.record(z32.string(), z32.unknown()),
2681
3169
  deadline_ms: epochMs
2682
3170
  });
2683
- var BrowserSessionsChangedEvent = z31.strictObject({ count: nonNegInt, enabled: z31.boolean() });
2684
- var BrowserProgressEvent = z31.strictObject({
2685
- call_id: z31.string().min(1).max(64),
3171
+ var BrowserSessionsChangedEvent = z32.strictObject({ count: nonNegInt, enabled: z32.boolean() });
3172
+ var BrowserProgressEvent = z32.strictObject({
3173
+ call_id: z32.string().min(1).max(64),
2686
3174
  client_instance: BrowserClientInstance,
2687
3175
  phase: BrowserCallPhase
2688
3176
  });
2689
- var DesktopHealth = z31.strictObject({
2690
- status: z31.literal("ok"),
2691
- service: z31.literal("matrx-desktop"),
2692
- version: z31.string().max(32),
2693
- protocol_version: z31.string().max(16),
2694
- ws_path: z31.literal("/v1/connect"),
2695
- device_id: z31.string().max(64),
2696
- browser_connection: z31.enum(["on", "off"])
2697
- });
2698
- var BrowserPairRequest = z31.strictObject({ client_instance: BrowserClientInstance });
2699
- var BrowserPairResult = z31.strictObject({ pair_token: z31.string().min(16).max(128), ws_path: z31.literal("/v1/connect") });
3177
+ var DesktopHealth = z32.strictObject({
3178
+ status: z32.literal("ok"),
3179
+ service: z32.literal("matrx-desktop"),
3180
+ version: z32.string().max(32),
3181
+ protocol_version: z32.string().max(16),
3182
+ ws_path: z32.literal("/v1/connect"),
3183
+ device_id: z32.string().max(64),
3184
+ browser_connection: z32.enum(["on", "off"])
3185
+ });
3186
+ var BrowserPairRequest = z32.strictObject({ client_instance: BrowserClientInstance });
3187
+ var BrowserPairResult = z32.strictObject({ pair_token: z32.string().min(16).max(128), ws_path: z32.literal("/v1/connect") });
3188
+
3189
+ // src/schema/net.ts
3190
+ import { z as z33 } from "zod";
3191
+ var NetInfoParams = z33.strictObject({});
3192
+ var NetAddress = z33.strictObject({
3193
+ address: z33.string(),
3194
+ family: z33.enum(["ipv4", "ipv6"]),
3195
+ netmask: z33.string().nullable(),
3196
+ /** CIDR form ("192.168.1.20/24"); null where the OS gives no prefix. */
3197
+ cidr: z33.string().nullable()
3198
+ });
3199
+ var NetInterface = z33.strictObject({
3200
+ name: z33.string(),
3201
+ mac: z33.string().nullable(),
3202
+ /** Loopback and other internal interfaces. */
3203
+ internal: z33.boolean(),
3204
+ addresses: z33.array(NetAddress)
3205
+ });
3206
+ var NetInfoResult = z33.strictObject({
3207
+ hostname: z33.string(),
3208
+ interfaces: z33.array(NetInterface),
3209
+ /** The default route's gateway; null when the OS does not say (or there is none). */
3210
+ gateway: z33.string().nullable(),
3211
+ /** The DNS servers the OS uses; empty when it does not say. */
3212
+ dns: z33.array(z33.string())
3213
+ });
3214
+ var NetWifiParams = z33.strictObject({});
3215
+ var NetWifiNetwork = z33.strictObject({
3216
+ /** null: the OS hides the name (macOS without Location Services for this app). */
3217
+ ssid: z33.string().nullable(),
3218
+ /** dBm; null where the OS does not say. */
3219
+ rssi: z33.int().nullable(),
3220
+ channel: z33.string().nullable(),
3221
+ security: z33.string().nullable()
3222
+ });
3223
+ var NetWifiResult = z33.strictObject({
3224
+ /** Whether the computer has a Wi-Fi interface at all. */
3225
+ available: z33.boolean(),
3226
+ /** The network the computer is on; null when it is on none. */
3227
+ current: NetWifiNetwork.nullable(),
3228
+ /** Networks in range (may be empty where the OS lists none to apps). */
3229
+ networks: z33.array(NetWifiNetwork)
3230
+ });
3231
+ var NetBluetoothParams = z33.strictObject({});
3232
+ var NetBluetoothDevice = z33.strictObject({
3233
+ name: z33.string(),
3234
+ address: z33.string().nullable(),
3235
+ connected: z33.boolean(),
3236
+ /** What it is, in the OS's words ("Headphones", "Keyboard"); null where it does not say. */
3237
+ kind: z33.string().nullable(),
3238
+ /** Battery percent, where the OS reports it. */
3239
+ battery: z33.int().min(0).max(100).nullable()
3240
+ });
3241
+ var NetBluetoothResult = z33.strictObject({
3242
+ /** Bluetooth is on; null where the OS does not say. */
3243
+ powered: z33.boolean().nullable(),
3244
+ devices: z33.array(NetBluetoothDevice)
3245
+ });
3246
+ var NetDevicesParams = z33.strictObject({});
3247
+ var NetDevice = z33.strictObject({
3248
+ ip: z33.string(),
3249
+ mac: z33.string().nullable(),
3250
+ interface: z33.string().nullable(),
3251
+ /** The name the local network gives it (reverse DNS / mDNS), when the table carries one. */
3252
+ hostname: z33.string().nullable()
3253
+ });
3254
+ var NetDevicesResult = z33.strictObject({ devices: z33.array(NetDevice) });
3255
+ var NetMdnsParams = z33.strictObject({
3256
+ /** A service type ("_http._tcp"); absent lists the service types found. */
3257
+ service_type: z33.string().min(1).max(64).regex(/^_[A-Za-z0-9-]+\._(tcp|udp)$/).optional(),
3258
+ /** How long to listen. */
3259
+ timeout_s: z33.int().min(1).max(30).default(3)
3260
+ });
3261
+ var NetMdnsService = z33.strictObject({
3262
+ name: z33.string(),
3263
+ type: z33.string(),
3264
+ domain: z33.string(),
3265
+ interface: z33.string().nullable()
3266
+ });
3267
+ var NetMdnsResult = z33.strictObject({ services: z33.array(NetMdnsService) });
3268
+ var NetScanParams = z33.strictObject({
3269
+ /** A host name or address; a private or loopback address unless `allow_public`. */
3270
+ host: z33.string().min(1).max(253),
3271
+ ports: z33.array(z33.int().min(1).max(65535)).min(1).max(1024),
3272
+ timeout_ms: z33.int().min(50).max(1e4).default(800),
3273
+ /** Scanning a host on the public internet needs saying so. */
3274
+ allow_public: z33.boolean().default(false)
3275
+ });
3276
+ var NetScanResult = z33.strictObject({
3277
+ host: z33.string(),
3278
+ /** The address the host resolved to. */
3279
+ address: z33.string(),
3280
+ open: z33.array(z33.int().min(1).max(65535)),
3281
+ closed: nonNegInt,
3282
+ elapsed_ms: nonNegInt
3283
+ });
3284
+ var NetDownloadParams = z33.strictObject({
3285
+ url: z33.string().min(1).max(8192).regex(/^https?:\/\//),
3286
+ /** Where to save it: an absolute path (a folder keeps the URL's file name). */
3287
+ path: AbsPath,
3288
+ overwrite: z33.boolean().default(false),
3289
+ timeout_s: z33.int().min(1).max(3600).default(300),
3290
+ /** Refuse anything larger. */
3291
+ max_bytes: z33.int().min(1).max(10737418240).default(2147483648)
3292
+ });
3293
+ var NetDownloadResult = z33.strictObject({
3294
+ path: z33.string(),
3295
+ bytes: nonNegInt,
3296
+ content_type: z33.string().nullable(),
3297
+ /** The final URL after redirects. */
3298
+ url: z33.string(),
3299
+ elapsed_ms: nonNegInt
3300
+ });
3301
+
3302
+ // src/schema/personal.ts
3303
+ import { z as z34 } from "zod";
3304
+ var Text = z34.string().max(65536);
3305
+ var AutomationScriptParams = z34.strictObject({
3306
+ /** applescript and jxa: macOS (osascript); powershell: Windows (and pwsh where installed). */
3307
+ language: z34.enum(["applescript", "jxa", "powershell"]),
3308
+ script: z34.string().min(1).max(262144),
3309
+ timeout_s: z34.int().min(1).max(600).default(60)
3310
+ });
3311
+ var AutomationScriptResult = z34.strictObject({
3312
+ stdout: z34.string(),
3313
+ stderr: z34.string(),
3314
+ exit_code: z34.int(),
3315
+ timed_out: z34.boolean(),
3316
+ /** stdout or stderr was cut at 1 MiB. */
3317
+ truncated: z34.boolean(),
3318
+ elapsed_ms: nonNegInt
3319
+ });
3320
+ var MailAccountsParams = z34.strictObject({});
3321
+ var MailAccount = z34.strictObject({ name: z34.string(), emails: z34.array(z34.string()), enabled: z34.boolean() });
3322
+ var MailAccountsResult = z34.strictObject({ accounts: z34.array(MailAccount) });
3323
+ var MailListParams = z34.strictObject({
3324
+ /** The account's name in Mail; absent: every account. */
3325
+ account: z34.string().min(1).max(256).optional(),
3326
+ /** The mailbox's name ("INBOX", "Sent Messages"). */
3327
+ mailbox: z34.string().min(1).max(256).default("INBOX"),
3328
+ unread_only: z34.boolean().default(false),
3329
+ limit: z34.int().min(1).max(200).default(25)
3330
+ });
3331
+ var MailMessage = z34.strictObject({
3332
+ id: z34.string(),
3333
+ subject: z34.string(),
3334
+ sender: z34.string(),
3335
+ received_at_ms: epochMs.nullable(),
3336
+ read: z34.boolean(),
3337
+ account: z34.string(),
3338
+ mailbox: z34.string(),
3339
+ /** The first lines of the message's text. */
3340
+ preview: z34.string()
3341
+ });
3342
+ var MailListResult = z34.strictObject({ messages: z34.array(MailMessage) });
3343
+ var MailSendParams = z34.strictObject({
3344
+ to: z34.array(z34.string().min(3).max(320)).min(1).max(50),
3345
+ cc: z34.array(z34.string().min(3).max(320)).max(50).default([]),
3346
+ subject: z34.string().max(998),
3347
+ body: Text,
3348
+ /** The sending account's address; absent: Mail's default. */
3349
+ from: z34.string().min(3).max(320).optional(),
3350
+ /** false leaves it open in Mail as a draft for the person to send. */
3351
+ send: z34.boolean().default(true)
3352
+ });
3353
+ var MailSendResult = z34.strictObject({ sent: z34.boolean() });
3354
+ var MessagesChatsParams = z34.strictObject({ limit: z34.int().min(1).max(200).default(25) });
3355
+ var MessagesChat = z34.strictObject({
3356
+ chat_id: z34.string(),
3357
+ name: z34.string().nullable(),
3358
+ participants: z34.array(z34.string()),
3359
+ last_message_at_ms: epochMs.nullable(),
3360
+ service: z34.string().nullable()
3361
+ });
3362
+ var MessagesChatsResult = z34.strictObject({ chats: z34.array(MessagesChat) });
3363
+ var MessagesListParams = z34.strictObject({
3364
+ /** One chat (messages.chats' chat_id); absent: the newest across all. */
3365
+ chat_id: z34.string().min(1).max(512).optional(),
3366
+ limit: z34.int().min(1).max(500).default(50)
3367
+ });
3368
+ var MessagesMessage = z34.strictObject({
3369
+ id: z34.string(),
3370
+ chat_id: z34.string().nullable(),
3371
+ text: z34.string(),
3372
+ from_me: z34.boolean(),
3373
+ /** The other person's handle (phone or email); null for the person's own messages. */
3374
+ sender: z34.string().nullable(),
3375
+ sent_at_ms: epochMs.nullable()
3376
+ });
3377
+ var MessagesListResult = z34.strictObject({ messages: z34.array(MessagesMessage) });
3378
+ var MessagesSendParams = z34.strictObject({
3379
+ /** A phone number or email the person can message. */
3380
+ to: z34.string().min(3).max(320),
3381
+ text: z34.string().min(1).max(2e4)
3382
+ });
3383
+ var MessagesSendResult = z34.strictObject({ sent: z34.boolean() });
3384
+ var ContactsSearchParams = z34.strictObject({
3385
+ /** Matched against names, organizations, emails and phone numbers. */
3386
+ query: z34.string().min(1).max(256),
3387
+ limit: z34.int().min(1).max(200).default(25)
3388
+ });
3389
+ var ContactLabeled = z34.strictObject({ label: z34.string().nullable(), value: z34.string() });
3390
+ var ContactSummary = z34.strictObject({
3391
+ id: z34.string(),
3392
+ name: z34.string(),
3393
+ organization: z34.string().nullable(),
3394
+ emails: z34.array(ContactLabeled),
3395
+ phones: z34.array(ContactLabeled)
3396
+ });
3397
+ var ContactsSearchResult = z34.strictObject({ contacts: z34.array(ContactSummary) });
3398
+ var ContactsGetParams = z34.strictObject({ id: z34.string().min(1).max(256) });
3399
+ var ContactDetail = z34.strictObject({
3400
+ id: z34.string(),
3401
+ name: z34.string(),
3402
+ organization: z34.string().nullable(),
3403
+ job_title: z34.string().nullable(),
3404
+ emails: z34.array(ContactLabeled),
3405
+ phones: z34.array(ContactLabeled),
3406
+ addresses: z34.array(ContactLabeled),
3407
+ birthday: z34.string().nullable(),
3408
+ note: z34.string().nullable()
3409
+ });
3410
+ var ContactsGetResult = z34.strictObject({ contact: ContactDetail });
3411
+ var CalendarListParams = z34.strictObject({
3412
+ from_ms: epochMs,
3413
+ to_ms: epochMs,
3414
+ /** One calendar's name; absent: every calendar. */
3415
+ calendar: z34.string().min(1).max(256).optional(),
3416
+ limit: z34.int().min(1).max(500).default(100)
3417
+ });
3418
+ var CalendarEvent = z34.strictObject({
3419
+ id: z34.string(),
3420
+ title: z34.string(),
3421
+ start_ms: epochMs,
3422
+ end_ms: epochMs,
3423
+ all_day: z34.boolean(),
3424
+ calendar: z34.string(),
3425
+ location: z34.string().nullable(),
3426
+ notes: z34.string().nullable()
3427
+ });
3428
+ var CalendarListResult = z34.strictObject({ events: z34.array(CalendarEvent) });
3429
+ var CalendarCreateParams = z34.strictObject({
3430
+ title: z34.string().min(1).max(1024),
3431
+ start_ms: epochMs,
3432
+ end_ms: epochMs,
3433
+ all_day: z34.boolean().default(false),
3434
+ /** The calendar's name; absent: the first writable calendar. */
3435
+ calendar: z34.string().min(1).max(256).optional(),
3436
+ location: z34.string().max(1024).optional(),
3437
+ notes: Text.optional()
3438
+ });
3439
+ var CalendarCreateResult = z34.strictObject({ id: z34.string(), calendar: z34.string() });
3440
+ var RemindersListParams = z34.strictObject({
3441
+ /** One list's name; absent: every list. */
3442
+ list: z34.string().min(1).max(256).optional(),
3443
+ include_completed: z34.boolean().default(false),
3444
+ limit: z34.int().min(1).max(500).default(100)
3445
+ });
3446
+ var Reminder = z34.strictObject({
3447
+ id: z34.string(),
3448
+ title: z34.string(),
3449
+ list: z34.string(),
3450
+ due_ms: epochMs.nullable(),
3451
+ completed: z34.boolean(),
3452
+ notes: z34.string().nullable()
3453
+ });
3454
+ var RemindersListResult = z34.strictObject({ reminders: z34.array(Reminder) });
3455
+ var RemindersCreateParams = z34.strictObject({
3456
+ title: z34.string().min(1).max(1024),
3457
+ due_ms: epochMs.optional(),
3458
+ list: z34.string().min(1).max(256).optional(),
3459
+ notes: Text.optional()
3460
+ });
3461
+ var RemindersCreateResult = z34.strictObject({ id: z34.string(), list: z34.string() });
3462
+ var PhotosSearchParams = z34.strictObject({
3463
+ /** Matched against file names, titles, descriptions and keywords; absent: the newest. */
3464
+ query: z34.string().min(1).max(256).optional(),
3465
+ from_ms: epochMs.optional(),
3466
+ to_ms: epochMs.optional(),
3467
+ favorites_only: z34.boolean().default(false),
3468
+ limit: z34.int().min(1).max(200).default(25)
3469
+ });
3470
+ var Photo = z34.strictObject({
3471
+ id: z34.string(),
3472
+ filename: z34.string(),
3473
+ taken_at_ms: epochMs.nullable(),
3474
+ width: nonNegInt.nullable(),
3475
+ height: nonNegInt.nullable(),
3476
+ favorite: z34.boolean(),
3477
+ title: z34.string().nullable()
3478
+ });
3479
+ var PhotosSearchResult = z34.strictObject({ photos: z34.array(Photo) });
3480
+ var PhotosGetParams = z34.strictObject({
3481
+ id: z34.string().min(1).max(256),
3482
+ /** Copy the original into a folder Matrx 2 owns and answer its path (then fs_read or desktop_documents reads it). */
3483
+ export: z34.boolean().default(false)
3484
+ });
3485
+ var PhotosGetResult = z34.strictObject({ photo: Photo, path: z34.string().nullable() });
3486
+ var LocationGetParams = z34.strictObject({ timeout_s: z34.int().min(1).max(60).default(15) });
3487
+ var LocationGetResult = z34.strictObject({
3488
+ latitude: z34.number().min(-90).max(90),
3489
+ longitude: z34.number().min(-180).max(180),
3490
+ /** Metres; null where the OS does not say. */
3491
+ accuracy_m: z34.number().min(0).nullable(),
3492
+ at_ms: epochMs,
3493
+ /** Who answered: the OS's own location service. */
3494
+ source: z34.enum(["corelocation", "windows", "geoclue"])
3495
+ });
3496
+
3497
+ // src/schema/windows.ts
3498
+ import { z as z35 } from "zod";
3499
+ 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)(\\.*)?$/);
3500
+ var RegistryValueType = z35.enum(["REG_SZ", "REG_EXPAND_SZ", "REG_MULTI_SZ", "REG_DWORD", "REG_QWORD", "REG_BINARY", "REG_NONE"]);
3501
+ var WindowsRegistryReadParams = z35.strictObject({
3502
+ key: RegistryKey,
3503
+ /** One value's name ("" is the key's default value); absent: every value and the subkeys. */
3504
+ name: z35.string().max(16383).optional()
3505
+ });
3506
+ var RegistryValue = z35.strictObject({ name: z35.string(), type: RegistryValueType, data: z35.string() });
3507
+ var WindowsRegistryReadResult = z35.strictObject({
3508
+ key: z35.string(),
3509
+ exists: z35.boolean(),
3510
+ values: z35.array(RegistryValue),
3511
+ subkeys: z35.array(z35.string())
3512
+ });
3513
+ var WindowsRegistryWriteParams = z35.strictObject({
3514
+ key: RegistryKey,
3515
+ name: z35.string().max(16383),
3516
+ type: RegistryValueType.default("REG_SZ"),
3517
+ /** As reg.exe takes it: text, a number, hex for binary, \\0 between the strings of a multi-string. */
3518
+ data: z35.string().max(1048576),
3519
+ /** Remove the value instead of writing it. */
3520
+ delete: z35.boolean().default(false)
3521
+ });
3522
+ var WindowsRegistryWriteResult = z35.strictObject({ key: z35.string(), name: z35.string(), deleted: z35.boolean() });
3523
+ var WindowsServicesParams = z35.strictObject({
3524
+ /** Matched against the service's name and display name. */
3525
+ filter: z35.string().min(1).max(256).optional(),
3526
+ limit: z35.int().min(1).max(1e3).default(200)
3527
+ });
3528
+ var WindowsService = z35.strictObject({
3529
+ name: z35.string(),
3530
+ display_name: z35.string(),
3531
+ /** Running, Stopped, Paused… as Windows says it. */
3532
+ status: z35.string(),
3533
+ /** Automatic, Manual, Disabled…; null where Windows does not say. */
3534
+ start_type: z35.string().nullable()
3535
+ });
3536
+ var WindowsServicesResult = z35.strictObject({ services: z35.array(WindowsService) });
3537
+ var WindowsServiceControlParams = z35.strictObject({
3538
+ name: z35.string().min(1).max(256),
3539
+ action: z35.enum(["start", "stop", "restart"])
3540
+ });
3541
+ var WindowsServiceControlResult = z35.strictObject({ name: z35.string(), status: z35.string() });
3542
+ var WindowsEventLogParams = z35.strictObject({
3543
+ log: z35.string().min(1).max(256).default("System"),
3544
+ /** Only these levels; absent: all. */
3545
+ levels: z35.array(z35.enum(["critical", "error", "warning", "information", "verbose"])).max(5).optional(),
3546
+ since_ms: epochMs.optional(),
3547
+ limit: z35.int().min(1).max(500).default(50)
3548
+ });
3549
+ var WindowsEvent = z35.strictObject({
3550
+ id: z35.int(),
3551
+ level: z35.string(),
3552
+ source: z35.string(),
3553
+ at_ms: epochMs,
3554
+ message: z35.string()
3555
+ });
3556
+ var WindowsEventLogResult = z35.strictObject({ log: z35.string(), events: z35.array(WindowsEvent) });
3557
+ var WindowsFeaturesParams = z35.strictObject({ filter: z35.string().min(1).max(256).optional() });
3558
+ var WindowsFeature = z35.strictObject({ name: z35.string(), state: z35.string() });
3559
+ var WindowsFeaturesResult = z35.strictObject({ features: z35.array(WindowsFeature) });
3560
+
3561
+ // src/schema/schedule.ts
3562
+ import { z as z36 } from "zod";
3563
+ var OpRef = z36.string().min(3).max(128).regex(/^[a-z_]+(\.[a-z_]+)+$/);
3564
+ var ScheduleCreateParams = z36.strictObject({
3565
+ name: z36.string().min(1).max(200),
3566
+ op: OpRef,
3567
+ /** The op's params, exactly as the op takes them; checked when the task is created. */
3568
+ params: z36.record(z36.string(), z36.unknown()).default({}),
3569
+ interval_s: z36.int().min(10).max(2592e3),
3570
+ /** Stop after this many runs; absent: until cancelled. */
3571
+ max_runs: z36.int().min(1).max(1e5).optional(),
3572
+ /** Run once now, before the first interval. */
3573
+ run_now: z36.boolean().default(false)
3574
+ });
3575
+ var ScheduleRun = z36.strictObject({
3576
+ at_ms: epochMs,
3577
+ ok: z36.boolean(),
3578
+ elapsed_ms: nonNegInt,
3579
+ /** The error's code and message when the run failed. */
3580
+ error: z36.string().nullable(),
3581
+ /** The start of the answer, as JSON (cut at 4 KiB). */
3582
+ result_preview: z36.string().nullable()
3583
+ });
3584
+ var ScheduledTask = z36.strictObject({
3585
+ id: z36.string(),
3586
+ name: z36.string(),
3587
+ op: z36.string(),
3588
+ params: z36.record(z36.string(), z36.unknown()),
3589
+ interval_s: nonNegInt,
3590
+ max_runs: nonNegInt.nullable(),
3591
+ runs: nonNegInt,
3592
+ created_at_ms: epochMs,
3593
+ next_run_at_ms: epochMs.nullable(),
3594
+ /** active, done (ran max_runs), cancelled. */
3595
+ state: z36.enum(["active", "done", "cancelled"]),
3596
+ /** The newest runs, newest first (at most 10). */
3597
+ recent: z36.array(ScheduleRun)
3598
+ });
3599
+ var ScheduleCreateResult = z36.strictObject({ task: ScheduledTask });
3600
+ var ScheduleListParams = z36.strictObject({ include_finished: z36.boolean().default(false) });
3601
+ var ScheduleListResult = z36.strictObject({ tasks: z36.array(ScheduledTask) });
3602
+ var ScheduleCancelParams = z36.strictObject({ id: z36.string().min(1).max(64) });
3603
+ var ScheduleCancelResult = z36.strictObject({ task: ScheduledTask });
3604
+
3605
+ // src/schema/notes.ts
3606
+ import { z as z37 } from "zod";
3607
+ var NoteFolder = z37.string().min(1).max(512).regex(/^[^/\\:*?"<>|][^\\:*?"<>|]*$/);
3608
+ var NotePath = z37.string().min(4).max(1024).regex(/^[^/\\:*?"<>|][^\\:*?"<>|]*\.md$/);
3609
+ var NotesFoldersParams = z37.strictObject({});
3610
+ var NotesFolder = z37.strictObject({ folder: z37.string(), notes: nonNegInt });
3611
+ var NotesFoldersResult = z37.strictObject({
3612
+ /** The notes root on this computer. */
3613
+ root: z37.string(),
3614
+ folders: z37.array(NotesFolder)
3615
+ });
3616
+ var NotesListParams = z37.strictObject({
3617
+ folder: NoteFolder.optional(),
3618
+ limit: z37.int().min(1).max(2e3).default(500)
3619
+ });
3620
+ var NoteEntry = z37.strictObject({
3621
+ path: z37.string(),
3622
+ label: z37.string(),
3623
+ folder: z37.string(),
3624
+ bytes: nonNegInt,
3625
+ modified_at_ms: epochMs
3626
+ });
3627
+ var NotesListResult = z37.strictObject({ root: z37.string(), notes: z37.array(NoteEntry), total: nonNegInt });
3628
+ var NotesReadParams = z37.strictObject({ path: NotePath });
3629
+ var NotesReadResult = z37.strictObject({
3630
+ path: z37.string(),
3631
+ content: z37.string(),
3632
+ bytes: nonNegInt,
3633
+ modified_at_ms: epochMs,
3634
+ /** SHA-256 of the content: pass it back as `if_hash` to write only over this version. */
3635
+ hash: z37.string()
3636
+ });
3637
+ var NotesWriteParams = z37.strictObject({
3638
+ folder: NoteFolder.default("General"),
3639
+ /** The note's name, without ".md". */
3640
+ label: z37.string().min(1).max(200).regex(/^[^/\\:*?"<>|]+$/),
3641
+ content: z37.string().max(10485760),
3642
+ /** Write only when the note is still this version (notes.read's hash); a change since answers CONFLICT. */
3643
+ if_hash: z37.string().length(64).optional()
3644
+ });
3645
+ var NotesWriteResult = z37.strictObject({ path: z37.string(), bytes: nonNegInt, created: z37.boolean(), hash: z37.string() });
3646
+ var NotesSearchParams = z37.strictObject({
3647
+ query: z37.string().min(1).max(512),
3648
+ limit: z37.int().min(1).max(200).default(50)
3649
+ });
3650
+ var NotesMatch = z37.strictObject({
3651
+ path: z37.string(),
3652
+ label: z37.string(),
3653
+ folder: z37.string(),
3654
+ /** The matching lines (at most five), trimmed. */
3655
+ lines: z37.array(z37.string())
3656
+ });
3657
+ var NotesSearchResult = z37.strictObject({ matches: z37.array(NotesMatch), total: nonNegInt });
3658
+
3659
+ // src/schema/documents.ts
3660
+ import { z as z38 } from "zod";
3661
+ var DOCUMENTS_MAX_TEXT_CHARS = 1048576;
3662
+ var DocumentsPdfTextParams = z38.strictObject({
3663
+ path: AbsPath,
3664
+ /** 1-based, inclusive. */
3665
+ first_page: z38.int().min(1).optional(),
3666
+ last_page: z38.int().min(1).optional(),
3667
+ max_chars: z38.int().min(1).max(DOCUMENTS_MAX_TEXT_CHARS).default(2e5)
3668
+ });
3669
+ var DocumentsPdfPage = z38.strictObject({ page: z38.int().min(1), text: z38.string() });
3670
+ var DocumentsPdfTextResult = z38.strictObject({
3671
+ pages: nonNegInt,
3672
+ /** Each page read, in order (an image-only page has empty text: OCR it). */
3673
+ read: z38.array(DocumentsPdfPage),
3674
+ truncated: z38.boolean(),
3675
+ title: z38.string().nullable(),
3676
+ author: z38.string().nullable()
3677
+ });
3678
+ var DocumentsOcrParams = z38.strictObject({
3679
+ path: AbsPath,
3680
+ /** BCP-47 language hints ("en-US", "fr-FR"); absent: the OS's own choice. */
3681
+ languages: z38.array(z38.string().min(2).max(16)).max(8).optional(),
3682
+ /** Faster, less accurate. */
3683
+ fast: z38.boolean().default(false)
3684
+ });
3685
+ var DocumentsOcrLine = z38.strictObject({
3686
+ text: z38.string(),
3687
+ /** 0–1; null where the engine does not say. */
3688
+ confidence: z38.number().min(0).max(1).nullable()
3689
+ });
3690
+ var DocumentsOcrResult = z38.strictObject({
3691
+ text: z38.string(),
3692
+ lines: z38.array(DocumentsOcrLine),
3693
+ truncated: z38.boolean(),
3694
+ /** Which engine read it ("vision" on macOS, "windows-ocr", "tesseract"). */
3695
+ engine: z38.string()
3696
+ });
3697
+ var DocumentsImageResizeParams = z38.strictObject({
3698
+ path: AbsPath,
3699
+ /** Where to write it; absent: next to the original, "<name>-resized.<ext>". */
3700
+ out_path: AbsPath.optional(),
3701
+ /** The longest side, kept in proportion; absent: the size stays (a format change only). */
3702
+ max_size: z38.int().min(1).max(32768).optional(),
3703
+ format: z38.enum(["png", "jpeg", "tiff", "heic", "bmp", "gif"]).optional(),
3704
+ overwrite: z38.boolean().default(false)
3705
+ });
3706
+ var DocumentsImageResizeResult = z38.strictObject({
3707
+ path: z38.string(),
3708
+ width: nonNegInt,
3709
+ height: nonNegInt,
3710
+ bytes: nonNegInt
3711
+ });
3712
+ var DocumentsParagraph = z38.strictObject({
3713
+ style: z38.enum(["title", "heading1", "heading2", "heading3", "body", "bullet", "numbered", "quote", "code"]).default("body"),
3714
+ text: z38.string().max(1e5)
3715
+ });
3716
+ var DocumentsSheet = z38.strictObject({
3717
+ name: z38.string().min(1).max(31),
3718
+ /** Rows of cells; the first row is the header when `header` is true. */
3719
+ rows: z38.array(z38.array(z38.union([z38.string().max(32767), z38.number(), z38.boolean(), z38.null()])).max(16384)).max(1e5),
3720
+ header: z38.boolean().default(true)
3721
+ });
3722
+ var DocumentsOfficeGenerateParams = z38.strictObject({
3723
+ kind: z38.enum(["docx", "xlsx"]),
3724
+ path: AbsPath,
3725
+ title: z38.string().max(1024).optional(),
3726
+ /** docx: the document's paragraphs, in order. */
3727
+ paragraphs: z38.array(DocumentsParagraph).max(5e4).optional(),
3728
+ /** xlsx: the workbook's sheets, in order. */
3729
+ sheets: z38.array(DocumentsSheet).min(1).max(64).optional(),
3730
+ overwrite: z38.boolean().default(false)
3731
+ });
3732
+ var DocumentsOfficeGenerateResult = z38.strictObject({ path: z38.string(), bytes: nonNegInt });
3733
+ var EntitiesNerParams = z38.strictObject({
3734
+ text: z38.string().min(1).max(DOCUMENTS_MAX_TEXT_CHARS),
3735
+ /** Which kinds to keep; absent: all three. */
3736
+ labels: z38.array(z38.enum(["person", "place", "organization"])).min(1).max(3).optional()
3737
+ });
3738
+ var EntitySpan = z38.strictObject({
3739
+ text: z38.string(),
3740
+ label: z38.string(),
3741
+ /** Character offsets into the text (UTF-16, as JavaScript counts). */
3742
+ start: nonNegInt,
3743
+ end: nonNegInt
3744
+ });
3745
+ var EntitiesNerResult = z38.strictObject({ entities: z38.array(EntitySpan), engine: z38.string() });
3746
+ var PiiKind = z38.enum(["email", "phone", "credit_card", "us_ssn", "iban", "ip_address", "url", "api_key"]);
3747
+ var EntitiesPiiParams = z38.strictObject({
3748
+ text: z38.string().min(1).max(DOCUMENTS_MAX_TEXT_CHARS),
3749
+ kinds: z38.array(PiiKind).min(1).max(8).optional(),
3750
+ /** Also answer the text with each finding replaced by its kind ("[email]"). */
3751
+ redact: z38.boolean().default(false)
3752
+ });
3753
+ var EntitiesPiiResult = z38.strictObject({
3754
+ findings: z38.array(z38.strictObject({ kind: PiiKind, text: z38.string(), start: nonNegInt, end: nonNegInt })),
3755
+ redacted: z38.string().nullable()
3756
+ });
2700
3757
 
2701
3758
  // src/schema/registry.ts
2702
3759
  var FS_ERR = ["NOT_FOUND", "PERMISSION_DENIED_OS", "INVALID_PARAMS", "RESOURCE_BUSY", "INTERNAL"];
@@ -2829,6 +3886,36 @@ var OPS = {
2829
3886
  "apps.windows.shown": { params: AppsWindowsShownParams, result: AppsWindowsShownResult, kind: "unary", since: "1.21", errors: ["NOT_FOUND", "PERMISSION_DENIED_OS", "PLATFORM_UNSUPPORTED", "INTERNAL"] },
2830
3887
  // Claude Code history (SPEC §6 coding): served by the `coding` Python service through SERVICES below.
2831
3888
  "coding.history.import_missing": { params: CodingHistoryImportMissingParams, result: CodingHistoryImportMissingResult, kind: "unary", since: "1.5", errors: ["RESOURCE_BUSY", "RESOURCE_GONE", "CANCELLED", "INTERNAL"] },
3889
+ // Code from anywhere (1.38): the coding engine's sessions, read and driven over any transport.
3890
+ "coding.providers": { params: CodingProvidersParams, result: CodingProvidersResult, kind: "unary", since: "1.38", errors: ["INTERNAL"] },
3891
+ "coding.sessions.list": { params: CodingSessionsListParams, result: CodingSessionsListResult, kind: "unary", since: "1.38", errors: ["PLATFORM_UNSUPPORTED", "INTERNAL"] },
3892
+ "coding.discover": { params: CodingDiscoverParams, result: CodingDiscoverResult, kind: "unary", since: "1.38", errors: ["INVALID_PARAMS", "PLATFORM_UNSUPPORTED", "INTERNAL"] },
3893
+ "coding.runs.list": { params: CodingRunsListParams, result: CodingRunsListResult, kind: "unary", since: "1.38", errors: ["INVALID_PARAMS", "INTERNAL"] },
3894
+ "coding.history": { params: CodingHistoryParams, result: CodingHistoryResult, kind: "unary", since: "1.38", errors: ["INVALID_PARAMS", "NOT_FOUND", "INTERNAL"] },
3895
+ "coding.transcript.read": { params: CodingTranscriptReadParams, result: CodingTranscriptReadResult, kind: "unary", since: "1.38", errors: ["INVALID_PARAMS", "NOT_FOUND", "INTERNAL"] },
3896
+ "coding.item.full": { params: CodingItemFullParams, result: CodingItemFullResult, kind: "unary", since: "1.38", errors: ["INVALID_PARAMS", "NOT_FOUND", "PAYLOAD_TOO_LARGE", "INTERNAL"] },
3897
+ "coding.activity": { params: CodingActivityParams, result: CodingActivityResult, kind: "unary", since: "1.38", errors: ["INVALID_PARAMS", "INTERNAL"] },
3898
+ "coding.folders.recent": { params: CodingFoldersRecentParams, result: CodingFoldersRecentResult, kind: "unary", since: "1.38", errors: ["INTERNAL"] },
3899
+ "coding.folders.check": { params: CodingFoldersCheckParams, result: CodingFoldersCheckResult, kind: "unary", since: "1.38", errors: ["INVALID_PARAMS", "AUTH_FORBIDDEN", "INTERNAL"] },
3900
+ "coding.folders.create": { params: CodingFoldersCreateParams, result: CodingFoldersCreateResult, kind: "unary", since: "1.38", errors: ["INVALID_PARAMS", "AUTH_FORBIDDEN", "PERMISSION_DENIED_OS", "INTERNAL"] },
3901
+ "coding.start": { params: CodingStartParams, result: CodingStartResult, kind: "unary", since: "1.38", errors: ["INVALID_PARAMS", "NOT_FOUND", "AUTH_FORBIDDEN", "RATE_LIMITED", "INTERNAL"] },
3902
+ "coding.takeover": { params: CodingTakeoverParams, result: CodingTakeoverResult, kind: "unary", since: "1.38", errors: ["INVALID_PARAMS", "NOT_FOUND", "RESOURCE_BUSY", "AUTH_FORBIDDEN", "INTERNAL"] },
3903
+ "coding.send": { params: CodingSendParams, result: CodingSendResult, kind: "unary", since: "1.38", errors: ["INVALID_PARAMS", "NOT_FOUND", "RATE_LIMITED", "INTERNAL"] },
3904
+ "coding.stop": { params: CodingStopParams, result: CodingStopResult, kind: "unary", since: "1.38", errors: ["INVALID_PARAMS", "INTERNAL"] },
3905
+ "coding.stop_elsewhere": { params: CodingStopElsewhereParams, result: CodingStopElsewhereResult, kind: "unary", since: "1.38", errors: ["INVALID_PARAMS", "NOT_FOUND", "CONFLICT", "PERMISSION_DENIED_OS", "INTERNAL"] },
3906
+ "coding.options.set": { params: CodingOptionsSetParams, result: CodingOptionsSetResult, kind: "unary", since: "1.38", errors: ["INVALID_PARAMS", "NOT_FOUND", "INTERNAL"] },
3907
+ "coding.agent.set": { params: CodingAgentSetParams, result: CodingAgentSetResult, kind: "unary", since: "1.38", errors: ["INVALID_PARAMS", "NOT_FOUND", "AUTH_FORBIDDEN", "INTERNAL"] },
3908
+ "coding.agents.access": { params: CodingAgentsAccessParams, result: CodingAgentsAccessResult, kind: "unary", since: "1.38", errors: ["INTERNAL"] },
3909
+ "coding.titles.status": { params: CodingTitlesStatusParams, result: CodingTitlesStatusResult, kind: "unary", since: "1.38", errors: ["INTERNAL"] },
3910
+ "coding.prefs.list": { params: CodingPrefsListParams, result: CodingPrefsListResult, kind: "unary", since: "1.38", errors: ["INTERNAL"] },
3911
+ "coding.prefs.set": { params: CodingPrefsSetParams, result: CodingPrefsSetResult, kind: "unary", since: "1.38", errors: ["INVALID_PARAMS", "INTERNAL"] },
3912
+ "coding.recent.seen": { params: CodingRecentSeenParams, result: CodingRecentSeenResult, kind: "unary", since: "1.38", errors: ["INVALID_PARAMS", "INTERNAL"] },
3913
+ "coding.search": { params: CodingSearchParams, result: CodingSearchResult, kind: "unary", since: "1.38", errors: ["INVALID_PARAMS", "TIMEOUT", "INTERNAL"] },
3914
+ "coding.reconcile": { params: CodingReconcileParams, result: CodingReconcileResult, kind: "unary", since: "1.38", errors: ["INVALID_PARAMS", "NOT_FOUND", "RESOURCE_BUSY", "CANCELLED", "INTERNAL"] },
3915
+ "coding.transcript.raw": { params: CodingTranscriptRawParams, result: CodingTranscriptRawResult, kind: "stream", since: "1.38", errors: ["INVALID_PARAMS", "NOT_FOUND", "CANCELLED", "INTERNAL"] },
3916
+ "coding.watch": { params: CodingWatchParams, result: CodingWatchResult, kind: "resource", since: "1.38", errors: ["PLATFORM_UNSUPPORTED", "RATE_LIMITED", "INTERNAL"] },
3917
+ "coding.session.watch": { params: CodingSessionWatchParams, result: CodingSessionWatchResult, kind: "resource", since: "1.38", errors: ["INVALID_PARAMS", "NOT_FOUND", "RATE_LIMITED", "INTERNAL"] },
3918
+ "session.identify": { params: SessionIdentifyParams, result: SessionIdentifyResult, kind: "unary", since: "1.38", errors: ["INVALID_PARAMS"] },
2832
3919
  // 1.22: git for agents (core `git`, the system git; the cloud sandbox's /git/* set, SPEC 6.1).
2833
3920
  "git.status": { params: GitStatusParams, result: GitStatusResult, kind: "unary", since: "1.22", errors: ["NOT_FOUND", "INVALID_PARAMS", "CONFLICT", "PLATFORM_UNSUPPORTED", "TIMEOUT", "INTERNAL"] },
2834
3921
  "git.diff": { params: GitDiffParams, result: GitDiffResult, kind: "unary", since: "1.22", errors: ["NOT_FOUND", "INVALID_PARAMS", "CONFLICT", "PLATFORM_UNSUPPORTED", "TIMEOUT", "INTERNAL"] },
@@ -2849,6 +3936,10 @@ var OPS = {
2849
3936
  "account.agents.list": { params: AccountAgentsListParams, result: AccountAgentsListResult, kind: "unary", since: "1.23", errors: ["INTERNAL"] },
2850
3937
  "account.vault.list": { params: AccountVaultListParams, result: AccountVaultListResult, kind: "unary", since: "1.23", errors: ["INTERNAL"] },
2851
3938
  "account.vault.copy": { params: AccountVaultCopyParams, result: AccountVaultCopyResult, kind: "unary", since: "1.23", errors: ["AUTH_REQUIRED", "AUTH_FORBIDDEN", "NOT_FOUND", "INVALID_PARAMS", "DEVICE_OFFLINE", "INTERNAL"] },
3939
+ // 1.39: one agent opened (its inputs and what it uses), its runs (mandate.run_history, one agent at a time) and its star.
3940
+ "account.agents.get": { params: AccountAgentsGetParams, result: AccountAgentsGetResult, kind: "unary", since: "1.39", errors: ["INVALID_PARAMS", "INTERNAL"] },
3941
+ "account.agents.runs": { params: AccountAgentsRunsParams, result: AccountAgentsRunsResult, kind: "unary", since: "1.39", errors: ["INVALID_PARAMS", "INTERNAL"] },
3942
+ "account.agents.favorite": { params: AccountAgentsFavoriteParams, result: AccountAgentsFavoriteResult, kind: "unary", since: "1.39", errors: ["AUTH_REQUIRED", "NOT_FOUND", "INVALID_PARAMS", "DEVICE_OFFLINE", "INTERNAL"] },
2852
3943
  // 1.26: the app's own update (it installs only once every window quit) and bringing the windows back.
2853
3944
  "apps.windows.update_state": { params: AppsWindowsUpdateStateParams, result: AppsWindowsUpdateStateResult, kind: "unary", since: "1.26", errors: ["NOT_FOUND", "PLATFORM_UNSUPPORTED", "INTERNAL"] },
2854
3945
  "apps.windows.reopen": { params: AppsWindowsReopenParams, result: AppsWindowsReopenResult, kind: "unary", since: "1.26", errors: ["NOT_FOUND", "PLATFORM_UNSUPPORTED", "INTERNAL"] },
@@ -2862,7 +3953,55 @@ var OPS = {
2862
3953
  "browser.set_enabled": { params: BrowserSetEnabledParams, result: BrowserSetEnabledResult, kind: "unary", since: "1.28", errors: ["AUTH_FORBIDDEN", "INTERNAL"] },
2863
3954
  "browser.pair_code": { params: BrowserPairCodeParams, result: BrowserPairCodeResult, kind: "unary", since: "1.28", errors: ["AUTH_FORBIDDEN", "INTERNAL"] },
2864
3955
  "browser.pair_reset": { params: BrowserPairResetParams, result: BrowserPairCodeResult, kind: "unary", since: "1.28", errors: ["AUTH_FORBIDDEN", "INTERNAL"] },
2865
- "browser.call": { params: BrowserCallParams, result: BrowserCallResult, kind: "unary", since: "1.28", errors: ["NOT_FOUND", "CONFLICT", "AUTH_FORBIDDEN", "INVALID_PARAMS", "TIMEOUT", "CANCELLED", "RESOURCE_GONE", "PAYLOAD_TOO_LARGE", "INTERNAL"] }
3956
+ "browser.tool_metrics": { params: BrowserToolMetricsParams, result: BrowserToolMetricsResult, kind: "unary", since: "1.37", errors: ["INVALID_PARAMS"] },
3957
+ "browser.reset_counters": { params: BrowserResetCountersParams, result: BrowserResetCountersResult, kind: "unary", since: "1.37", errors: ["INVALID_PARAMS"] },
3958
+ "browser.log": { params: BrowserLogParams, result: BrowserLogResult, kind: "unary", since: "1.37", errors: ["INVALID_PARAMS"] },
3959
+ "browser.call": { params: BrowserCallParams, result: BrowserCallResult, kind: "unary", since: "1.28", errors: ["NOT_FOUND", "CONFLICT", "AUTH_FORBIDDEN", "INVALID_PARAMS", "TIMEOUT", "CANCELLED", "RESOURCE_GONE", "PAYLOAD_TOO_LARGE", "INTERNAL"] },
3960
+ // 1.37: Matrx Local's remaining sidecar tools in the core (net, automation, the person's apps,
3961
+ // Windows administration, schedules, local notes, documents and entities).
3962
+ "net.info": { params: NetInfoParams, result: NetInfoResult, kind: "unary", since: "1.37", errors: ["PLATFORM_UNSUPPORTED", "INTERNAL"] },
3963
+ "net.wifi": { params: NetWifiParams, result: NetWifiResult, kind: "unary", since: "1.37", errors: ["PERMISSION_DENIED_OS", "PLATFORM_UNSUPPORTED", "TIMEOUT", "INTERNAL"] },
3964
+ "net.bluetooth": { params: NetBluetoothParams, result: NetBluetoothResult, kind: "unary", since: "1.37", errors: ["PERMISSION_DENIED_OS", "PLATFORM_UNSUPPORTED", "TIMEOUT", "INTERNAL"] },
3965
+ "net.devices": { params: NetDevicesParams, result: NetDevicesResult, kind: "unary", since: "1.37", errors: ["PLATFORM_UNSUPPORTED", "TIMEOUT", "INTERNAL"] },
3966
+ "net.mdns": { params: NetMdnsParams, result: NetMdnsResult, kind: "unary", since: "1.37", errors: ["PLATFORM_UNSUPPORTED", "TIMEOUT", "INTERNAL"] },
3967
+ "net.scan": { params: NetScanParams, result: NetScanResult, kind: "unary", since: "1.37", errors: ["INVALID_PARAMS", "NOT_FOUND", "AUTH_FORBIDDEN", "TIMEOUT", "INTERNAL"] },
3968
+ "net.download": { params: NetDownloadParams, result: NetDownloadResult, kind: "unary", since: "1.37", errors: ["INVALID_PARAMS", "NOT_FOUND", "CONFLICT", "PERMISSION_DENIED_OS", "PAYLOAD_TOO_LARGE", "TIMEOUT", "INTERNAL"] },
3969
+ "automation.script": { params: AutomationScriptParams, result: AutomationScriptResult, kind: "unary", since: "1.37", errors: ["INVALID_PARAMS", "PERMISSION_DENIED_OS", "PLATFORM_UNSUPPORTED", "TIMEOUT", "INTERNAL"] },
3970
+ "mail.accounts": { params: MailAccountsParams, result: MailAccountsResult, kind: "unary", since: "1.37", errors: ["INVALID_PARAMS", "NOT_FOUND", "PERMISSION_DENIED_OS", "PLATFORM_UNSUPPORTED", "TIMEOUT", "INTERNAL"] },
3971
+ "mail.list": { params: MailListParams, result: MailListResult, kind: "unary", since: "1.37", errors: ["INVALID_PARAMS", "NOT_FOUND", "PERMISSION_DENIED_OS", "PLATFORM_UNSUPPORTED", "TIMEOUT", "INTERNAL"] },
3972
+ "mail.send": { params: MailSendParams, result: MailSendResult, kind: "unary", since: "1.37", errors: ["INVALID_PARAMS", "NOT_FOUND", "PERMISSION_DENIED_OS", "PLATFORM_UNSUPPORTED", "TIMEOUT", "INTERNAL"] },
3973
+ "messages.chats": { params: MessagesChatsParams, result: MessagesChatsResult, kind: "unary", since: "1.37", errors: ["INVALID_PARAMS", "NOT_FOUND", "PERMISSION_DENIED_OS", "PLATFORM_UNSUPPORTED", "TIMEOUT", "INTERNAL"] },
3974
+ "messages.list": { params: MessagesListParams, result: MessagesListResult, kind: "unary", since: "1.37", errors: ["INVALID_PARAMS", "NOT_FOUND", "PERMISSION_DENIED_OS", "PLATFORM_UNSUPPORTED", "TIMEOUT", "INTERNAL"] },
3975
+ "messages.send": { params: MessagesSendParams, result: MessagesSendResult, kind: "unary", since: "1.37", errors: ["INVALID_PARAMS", "NOT_FOUND", "PERMISSION_DENIED_OS", "PLATFORM_UNSUPPORTED", "TIMEOUT", "INTERNAL"] },
3976
+ "contacts.search": { params: ContactsSearchParams, result: ContactsSearchResult, kind: "unary", since: "1.37", errors: ["INVALID_PARAMS", "NOT_FOUND", "PERMISSION_DENIED_OS", "PLATFORM_UNSUPPORTED", "TIMEOUT", "INTERNAL"] },
3977
+ "contacts.get": { params: ContactsGetParams, result: ContactsGetResult, kind: "unary", since: "1.37", errors: ["INVALID_PARAMS", "NOT_FOUND", "PERMISSION_DENIED_OS", "PLATFORM_UNSUPPORTED", "TIMEOUT", "INTERNAL"] },
3978
+ "calendar.list": { params: CalendarListParams, result: CalendarListResult, kind: "unary", since: "1.37", errors: ["INVALID_PARAMS", "NOT_FOUND", "PERMISSION_DENIED_OS", "PLATFORM_UNSUPPORTED", "TIMEOUT", "INTERNAL"] },
3979
+ "calendar.create": { params: CalendarCreateParams, result: CalendarCreateResult, kind: "unary", since: "1.37", errors: ["INVALID_PARAMS", "NOT_FOUND", "PERMISSION_DENIED_OS", "PLATFORM_UNSUPPORTED", "TIMEOUT", "INTERNAL"] },
3980
+ "reminders.list": { params: RemindersListParams, result: RemindersListResult, kind: "unary", since: "1.37", errors: ["INVALID_PARAMS", "NOT_FOUND", "PERMISSION_DENIED_OS", "PLATFORM_UNSUPPORTED", "TIMEOUT", "INTERNAL"] },
3981
+ "reminders.create": { params: RemindersCreateParams, result: RemindersCreateResult, kind: "unary", since: "1.37", errors: ["INVALID_PARAMS", "NOT_FOUND", "PERMISSION_DENIED_OS", "PLATFORM_UNSUPPORTED", "TIMEOUT", "INTERNAL"] },
3982
+ "photos.search": { params: PhotosSearchParams, result: PhotosSearchResult, kind: "unary", since: "1.37", errors: ["INVALID_PARAMS", "NOT_FOUND", "PERMISSION_DENIED_OS", "PLATFORM_UNSUPPORTED", "TIMEOUT", "INTERNAL"] },
3983
+ "photos.get": { params: PhotosGetParams, result: PhotosGetResult, kind: "unary", since: "1.37", errors: ["INVALID_PARAMS", "NOT_FOUND", "PERMISSION_DENIED_OS", "PLATFORM_UNSUPPORTED", "TIMEOUT", "INTERNAL"] },
3984
+ "location.get": { params: LocationGetParams, result: LocationGetResult, kind: "unary", since: "1.37", errors: ["INVALID_PARAMS", "NOT_FOUND", "PERMISSION_DENIED_OS", "PLATFORM_UNSUPPORTED", "TIMEOUT", "INTERNAL"] },
3985
+ "windows.registry_read": { params: WindowsRegistryReadParams, result: WindowsRegistryReadResult, kind: "unary", since: "1.37", errors: ["INVALID_PARAMS", "NOT_FOUND", "PERMISSION_DENIED_OS", "PLATFORM_UNSUPPORTED", "TIMEOUT", "INTERNAL"] },
3986
+ "windows.registry_write": { params: WindowsRegistryWriteParams, result: WindowsRegistryWriteResult, kind: "unary", since: "1.37", errors: ["INVALID_PARAMS", "NOT_FOUND", "PERMISSION_DENIED_OS", "PLATFORM_UNSUPPORTED", "TIMEOUT", "INTERNAL"] },
3987
+ "windows.services": { params: WindowsServicesParams, result: WindowsServicesResult, kind: "unary", since: "1.37", errors: ["INVALID_PARAMS", "NOT_FOUND", "PERMISSION_DENIED_OS", "PLATFORM_UNSUPPORTED", "TIMEOUT", "INTERNAL"] },
3988
+ "windows.service_control": { params: WindowsServiceControlParams, result: WindowsServiceControlResult, kind: "unary", since: "1.37", errors: ["INVALID_PARAMS", "NOT_FOUND", "PERMISSION_DENIED_OS", "PLATFORM_UNSUPPORTED", "TIMEOUT", "INTERNAL"] },
3989
+ "windows.event_log": { params: WindowsEventLogParams, result: WindowsEventLogResult, kind: "unary", since: "1.37", errors: ["INVALID_PARAMS", "NOT_FOUND", "PERMISSION_DENIED_OS", "PLATFORM_UNSUPPORTED", "TIMEOUT", "INTERNAL"] },
3990
+ "windows.features": { params: WindowsFeaturesParams, result: WindowsFeaturesResult, kind: "unary", since: "1.37", errors: ["INVALID_PARAMS", "NOT_FOUND", "PERMISSION_DENIED_OS", "PLATFORM_UNSUPPORTED", "TIMEOUT", "INTERNAL"] },
3991
+ "schedule.create": { params: ScheduleCreateParams, result: ScheduleCreateResult, kind: "unary", since: "1.37", errors: ["INVALID_PARAMS", "NOT_FOUND", "INTERNAL"] },
3992
+ "schedule.list": { params: ScheduleListParams, result: ScheduleListResult, kind: "unary", since: "1.37", errors: ["INTERNAL"] },
3993
+ "schedule.cancel": { params: ScheduleCancelParams, result: ScheduleCancelResult, kind: "unary", since: "1.37", errors: ["NOT_FOUND", "INTERNAL"] },
3994
+ "notes.folders": { params: NotesFoldersParams, result: NotesFoldersResult, kind: "unary", since: "1.37", errors: ["INTERNAL"] },
3995
+ "notes.list": { params: NotesListParams, result: NotesListResult, kind: "unary", since: "1.37", errors: ["INVALID_PARAMS", "NOT_FOUND", "INTERNAL"] },
3996
+ "notes.read": { params: NotesReadParams, result: NotesReadResult, kind: "unary", since: "1.37", errors: ["INVALID_PARAMS", "NOT_FOUND", "INTERNAL"] },
3997
+ "notes.write": { params: NotesWriteParams, result: NotesWriteResult, kind: "unary", since: "1.37", errors: ["INVALID_PARAMS", "CONFLICT", "PERMISSION_DENIED_OS", "INTERNAL"] },
3998
+ "notes.search": { params: NotesSearchParams, result: NotesSearchResult, kind: "unary", since: "1.37", errors: ["INVALID_PARAMS", "INTERNAL"] },
3999
+ "documents.pdf_text": { params: DocumentsPdfTextParams, result: DocumentsPdfTextResult, kind: "unary", since: "1.37", errors: ["INVALID_PARAMS", "NOT_FOUND", "PLATFORM_UNSUPPORTED", "TIMEOUT", "INTERNAL"] },
4000
+ "documents.ocr": { params: DocumentsOcrParams, result: DocumentsOcrResult, kind: "unary", since: "1.37", errors: ["INVALID_PARAMS", "NOT_FOUND", "PLATFORM_UNSUPPORTED", "TIMEOUT", "INTERNAL"] },
4001
+ "documents.image_resize": { params: DocumentsImageResizeParams, result: DocumentsImageResizeResult, kind: "unary", since: "1.37", errors: ["INVALID_PARAMS", "NOT_FOUND", "CONFLICT", "PLATFORM_UNSUPPORTED", "TIMEOUT", "INTERNAL"] },
4002
+ "documents.office_generate": { params: DocumentsOfficeGenerateParams, result: DocumentsOfficeGenerateResult, kind: "unary", since: "1.37", errors: ["INVALID_PARAMS", "NOT_FOUND", "CONFLICT", "PERMISSION_DENIED_OS", "INTERNAL"] },
4003
+ "entities.ner": { params: EntitiesNerParams, result: EntitiesNerResult, kind: "unary", since: "1.37", errors: ["INVALID_PARAMS", "PLATFORM_UNSUPPORTED", "TIMEOUT", "INTERNAL"] },
4004
+ "entities.pii": { params: EntitiesPiiParams, result: EntitiesPiiResult, kind: "unary", since: "1.37", errors: ["INVALID_PARAMS", "INTERNAL"] }
2866
4005
  };
2867
4006
  var EVENTS = {
2868
4007
  "fs.changed": FsChangedEvent,
@@ -2874,6 +4013,10 @@ var EVENTS = {
2874
4013
  "session.control_changed": SessionControlChangedEvent,
2875
4014
  "models.progress": ModelsProgressEvent,
2876
4015
  "coding.history.progress": CodingHistoryProgressEvent,
4016
+ "coding.changed": CodingChangedEvent,
4017
+ "coding.watch_state": CodingWatchStateEvent,
4018
+ "coding.item": CodingItemEvent,
4019
+ "coding.gap": CodingGapEvent,
2877
4020
  "relay.device_status": RelayDeviceStatusEvent,
2878
4021
  "relay.auth_expiring": RelayAuthExpiringEvent,
2879
4022
  "diag.errors.changed": DiagErrorsChangedEvent,
@@ -2882,6 +4025,42 @@ var EVENTS = {
2882
4025
  "browser.progress": BrowserProgressEvent
2883
4026
  };
2884
4027
 
4028
+ // src/versioning.ts
4029
+ function compareVersions(a, b) {
4030
+ const [am = 0, an = 0] = a.split(".").map(Number);
4031
+ const [bm = 0, bn = 0] = b.split(".").map(Number);
4032
+ return am - bm || an - bn;
4033
+ }
4034
+ function knows(version, since) {
4035
+ return compareVersions(version, since) >= 0;
4036
+ }
4037
+ var RESULT_PATH = /* @__PURE__ */ new Map([
4038
+ ["fs.patch", "FsPatchResult"],
4039
+ ["apps.chats.list", "AppsChatsListResult"],
4040
+ ["apps.accounts.usage", "AppsAccountsUsageResult"],
4041
+ ["apps.accounts.resets", "AppsAccountsResetsResult"],
4042
+ ["apps.windows.update_state", "AppsWindowsUpdateStateResult"]
4043
+ ]);
4044
+ var NESTED_RESULTS = /* @__PURE__ */ new Map([
4045
+ ["apps.chats.list", [["chats", "ChatRow"]]],
4046
+ ["apps.projects.file", [["chat", "ChatRow"]]],
4047
+ ["apps.projects.file_many", [["chats", "ChatRow"]]],
4048
+ ["apps.projects.unfile", [["chat", "ChatRow"]]],
4049
+ ["apps.projects.move", [["chat", "ChatRow"]]],
4050
+ ["apps.chats.star", [["chat", "ChatRow"]]],
4051
+ ["apps.chats.place", [["chat", "ChatRow"]]],
4052
+ ["apps.accounts.usage", [["accounts", "AccountUsage"]]],
4053
+ ["resources.snapshot", [["disks", "ResourcesDisk"]]],
4054
+ ["stack.state", [["servers", "StackServer"]]],
4055
+ ["account.agents.list", [["agents", "AccountAgent"]]]
4056
+ ]);
4057
+ var WINDOW_RESULTS = /* @__PURE__ */ new Map([
4058
+ ["window.list", "windows"],
4059
+ ["window.focus", "window"],
4060
+ ["window.move", "window"]
4061
+ ]);
4062
+ var VERSIONED_RESULT_OPS = [.../* @__PURE__ */ new Set([...RESULT_PATH.keys(), ...WINDOW_RESULTS.keys(), ...NESTED_RESULTS.keys()])];
4063
+
2885
4064
  // src/client/client.ts
2886
4065
  var WS_OPEN = 1;
2887
4066
  var defaultTimers = {
@@ -3230,6 +4409,11 @@ function createDesktopClient(options) {
3230
4409
  backoff.markConnected();
3231
4410
  authRefusals = 0;
3232
4411
  setState({ status: "open", welcome: welcome.data, attempts: 0, retryInMs: null, lastError: null, outcome: null });
4412
+ if (options.clientLabel && knows(welcome.data.protocol_version, "1.38")) {
4413
+ void request("session.identify", { label: options.clientLabel.slice(0, 60) }).catch(
4414
+ (error) => diagnose({ kind: "handler_threw", where: "session.identify", error })
4415
+ );
4416
+ }
3233
4417
  for (const w of [...readyWaiters]) {
3234
4418
  readyWaiters.delete(w);
3235
4419
  w.resolve(welcome.data);