@ai-matrx/desktop-protocol 0.17.11 → 0.17.13

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/index.cjs CHANGED
@@ -297,9 +297,23 @@ __export(src_exports, {
297
297
  RequestMsg: () => RequestMsg,
298
298
  ResourceId: () => ResourceId,
299
299
  ResourceInfo: () => ResourceInfo,
300
+ ResourcesActivityParams: () => ResourcesActivityParams,
301
+ ResourcesActivityResult: () => ResourcesActivityResult,
300
302
  ResourcesDisk: () => ResourcesDisk,
303
+ ResourcesIncident: () => ResourcesIncident,
304
+ ResourcesIncidentsParams: () => ResourcesIncidentsParams,
305
+ ResourcesIncidentsResult: () => ResourcesIncidentsResult,
306
+ ResourcesJob: () => ResourcesJob,
307
+ ResourcesJobKind: () => ResourcesJobKind,
308
+ ResourcesPressure: () => ResourcesPressure,
309
+ ResourcesProcess: () => ResourcesProcess,
310
+ ResourcesSample: () => ResourcesSample,
301
311
  ResourcesSnapshotParams: () => ResourcesSnapshotParams,
302
312
  ResourcesSnapshotResult: () => ResourcesSnapshotResult,
313
+ ResourcesStopJobParams: () => ResourcesStopJobParams,
314
+ ResourcesStopJobResult: () => ResourcesStopJobResult,
315
+ ResourcesStrain: () => ResourcesStrain,
316
+ ResourcesVerdict: () => ResourcesVerdict,
303
317
  ResponseMsg: () => ResponseMsg,
304
318
  SERVICES: () => SERVICES,
305
319
  SERVICE_MAX_FRAME_BYTES: () => SERVICE_MAX_FRAME_BYTES,
@@ -342,6 +356,21 @@ __export(src_exports, {
342
356
  SpendScopes: () => SpendScopes,
343
357
  SpendSplit: () => SpendSplit,
344
358
  SpendStart: () => SpendStart,
359
+ StackErrorsParams: () => StackErrorsParams,
360
+ StackErrorsResult: () => StackErrorsResult,
361
+ StackEvent: () => StackEvent,
362
+ StackLogsParams: () => StackLogsParams,
363
+ StackLogsResult: () => StackLogsResult,
364
+ StackRunResult: () => StackRunResult,
365
+ StackServer: () => StackServer,
366
+ StackServerActionParams: () => StackServerActionParams,
367
+ StackServerActionResult: () => StackServerActionResult,
368
+ StackServerName: () => StackServerName,
369
+ StackStartParams: () => StackStartParams,
370
+ StackStateParams: () => StackStateParams,
371
+ StackStateResult: () => StackStateResult,
372
+ StackStopParams: () => StackStopParams,
373
+ StackTone: () => StackTone,
345
374
  StreamMeta: () => StreamMeta,
346
375
  StreamMsg: () => StreamMsg,
347
376
  SysinfoGetParams: () => SysinfoGetParams,
@@ -407,7 +436,7 @@ module.exports = __toCommonJS(src_exports);
407
436
  // src/schema/primitives.ts
408
437
  var import_zod = require("zod");
409
438
  var PROTOCOL_MAJOR = 1;
410
- var PROTOCOL_MINOR = 15;
439
+ var PROTOCOL_MINOR = 17;
411
440
  var PROTOCOL_VERSION = `${PROTOCOL_MAJOR}.${PROTOCOL_MINOR}`;
412
441
  var ProtocolVersion = import_zod.z.string().regex(/^[1-9][0-9]{0,2}\.[0-9]{1,3}$/);
413
442
  var RequestId = import_zod.z.string().min(1).max(64).regex(/^[A-Za-z0-9_-]+$/);
@@ -2046,6 +2075,8 @@ var import_zod23 = require("zod");
2046
2075
  var ResourcesDisk = import_zod23.z.strictObject({
2047
2076
  /** Where it is mounted ("/", "C:"). */
2048
2077
  mount: import_zod23.z.string().max(512),
2078
+ /** The volume's name as the file manager shows it ("Macintosh HD", "Local Disk (C:)"). Since 1.17. */
2079
+ name: import_zod23.z.string().max(256).optional(),
2049
2080
  /** The file system ("apfs", "NTFS", "ext4"). */
2050
2081
  fs: import_zod23.z.string().max(64),
2051
2082
  size_bytes: nonNegInt,
@@ -2066,122 +2097,319 @@ var ResourcesSnapshotResult = import_zod23.z.strictObject({
2066
2097
  disks: import_zod23.z.array(ResourcesDisk).max(64),
2067
2098
  uptime_seconds: nonNegInt
2068
2099
  });
2100
+ var ResourcesJobKind = import_zod23.z.enum(["type-check", "tests", "build", "lint", "dev server", "language server", "search"]);
2101
+ var ResourcesStrain = import_zod23.z.enum(["good", "strain", "overloaded"]);
2102
+ var ResourcesPressure = import_zod23.z.enum(["normal", "warning", "critical"]);
2103
+ var ResourcesJob = import_zod23.z.strictObject({
2104
+ /** The job's root process (Stop takes its whole tree). */
2105
+ pid: import_zod23.z.int().min(0),
2106
+ kind: ResourcesJobKind,
2107
+ /** Its heaviest process's command line, shortened ("…/lib/tsc --noEmit -p tsconfig.json"). */
2108
+ command: import_zod23.z.string().max(256),
2109
+ /** Who started it: "Claude Code", "Codex", "Cursor", "VS Code", "Terminal", "local stack", "detached"; null when unknown. */
2110
+ started_by: import_zod23.z.string().max(64).nullable(),
2111
+ /** Whatever started it is gone and nothing waits for it. */
2112
+ orphan: import_zod23.z.boolean(),
2113
+ /** A type-check queued for its turn (no compiler running yet). */
2114
+ waiting: import_zod23.z.boolean(),
2115
+ /** The project folder it runs in ("matrx-frontend"); null when not in one. */
2116
+ folder: import_zod23.z.string().max(256).nullable(),
2117
+ /** The same command in the same folder, running this many times (1 = no duplicate). */
2118
+ duplicates: import_zod23.z.int().min(1),
2119
+ processes: import_zod23.z.int().min(1),
2120
+ /** Sum over the tree, as `ps` reports it: 100 = one full core. */
2121
+ cpu_percent: import_zod23.z.number().min(0),
2122
+ /** Real memory (macOS: the physical footprint Activity Monitor shows, compressed included). */
2123
+ memory_bytes: nonNegInt,
2124
+ started_at_ms: epochMs.nullable(),
2125
+ /** False for an app, an agent session, a terminal, a system process, the local stack or Matrx 2 itself. */
2126
+ stoppable: import_zod23.z.boolean()
2127
+ });
2128
+ var ResourcesProcess = import_zod23.z.strictObject({
2129
+ pid: import_zod23.z.int().min(0),
2130
+ /** The command line, shortened. */
2131
+ name: import_zod23.z.string().max(256),
2132
+ cpu_percent: import_zod23.z.number().min(0),
2133
+ memory_bytes: nonNegInt,
2134
+ started_by: import_zod23.z.string().max(64).nullable(),
2135
+ /** The job it belongs to ("type-check in aidream"); null when none. */
2136
+ job: import_zod23.z.string().max(256).nullable(),
2137
+ started_at_ms: epochMs.nullable()
2138
+ });
2139
+ var ResourcesVerdict = import_zod23.z.strictObject({
2140
+ level: ResourcesStrain,
2141
+ /** One sentence ("Your Mac is under strain. 3 type-checks are running at once."). */
2142
+ text: import_zod23.z.string().max(256),
2143
+ /** The biggest jobs behind it; null when all is well. */
2144
+ cause: import_zod23.z.string().max(1024).nullable()
2145
+ });
2146
+ var ResourcesSample = import_zod23.z.strictObject({
2147
+ at_ms: epochMs,
2148
+ /** The 1-minute load average. */
2149
+ load: import_zod23.z.number().min(0),
2150
+ memory_used_bytes: nonNegInt,
2151
+ typechecks: nonNegInt
2152
+ });
2153
+ var ResourcesActivityParams = import_zod23.z.strictObject({});
2154
+ var ResourcesActivityResult = import_zod23.z.strictObject({
2155
+ /** False until the first reading (a second or two after start). */
2156
+ ready: import_zod23.z.boolean(),
2157
+ sampled_at_ms: epochMs.nullable(),
2158
+ cores: import_zod23.z.int().min(1),
2159
+ /** 1, 5 and 15 minute load averages. */
2160
+ load: import_zod23.z.array(import_zod23.z.number().min(0)).length(3),
2161
+ memory: import_zod23.z.strictObject({
2162
+ total_bytes: nonNegInt,
2163
+ /** Activity Monitor's Memory Used: app memory + wired + compressed. */
2164
+ used_bytes: nonNegInt,
2165
+ /** Data held compressed, and the memory the compressor takes to hold it. */
2166
+ compressed_bytes: nonNegInt,
2167
+ compressor_bytes: nonNegInt,
2168
+ swap_used_bytes: nonNegInt,
2169
+ pressure: ResourcesPressure.nullable()
2170
+ }),
2171
+ verdict: ResourcesVerdict,
2172
+ typechecks: import_zod23.z.strictObject({ running: nonNegInt, waiting: nonNegInt, comfort: nonNegInt }),
2173
+ /** Heaviest first (1 GB weighs as much as 16 % of a core). */
2174
+ jobs: import_zod23.z.array(ResourcesJob).max(200),
2175
+ /** The 15 heaviest by memory and the 15 busiest by CPU, together. */
2176
+ top: import_zod23.z.array(ResourcesProcess).max(30),
2177
+ /** The last hour, oldest first. */
2178
+ history: import_zod23.z.array(ResourcesSample).max(1200)
2179
+ });
2180
+ var ResourcesStopJobParams = import_zod23.z.strictObject({ pid: import_zod23.z.int().min(1) });
2181
+ var ResourcesStopJobResult = import_zod23.z.strictObject({
2182
+ /** Processes signalled; whatever is still running 5 seconds later is force-stopped. */
2183
+ processes: nonNegInt,
2184
+ /** It had finished before the request arrived. */
2185
+ already_finished: import_zod23.z.boolean()
2186
+ });
2187
+ var ResourcesIncident = import_zod23.z.strictObject({
2188
+ at_ms: epochMs,
2189
+ verdict: ResourcesVerdict,
2190
+ load: import_zod23.z.number().min(0),
2191
+ memory_used_bytes: nonNegInt,
2192
+ compressed_bytes: nonNegInt,
2193
+ pressure: ResourcesPressure.nullable(),
2194
+ jobs: import_zod23.z.array(
2195
+ import_zod23.z.strictObject({
2196
+ kind: ResourcesJobKind,
2197
+ started_by: import_zod23.z.string().max(64).nullable(),
2198
+ folder: import_zod23.z.string().max(256).nullable(),
2199
+ command: import_zod23.z.string().max(256),
2200
+ cpu_percent: import_zod23.z.number().min(0),
2201
+ memory_bytes: nonNegInt,
2202
+ duplicates: import_zod23.z.int().min(1)
2203
+ })
2204
+ ).max(8)
2205
+ });
2206
+ var ResourcesIncidentsParams = import_zod23.z.strictObject({ limit: import_zod23.z.int().min(1).max(200).default(50) });
2207
+ var ResourcesIncidentsResult = import_zod23.z.strictObject({
2208
+ /** Newest first; at most one a minute is written. */
2209
+ incidents: import_zod23.z.array(ResourcesIncident).max(200)
2210
+ });
2069
2211
 
2070
- // src/schema/audio.ts
2212
+ // src/schema/stack.ts
2071
2213
  var import_zod24 = require("zod");
2072
- var AudioDevice = import_zod24.z.strictObject({
2214
+ var StackServerName = import_zod24.z.string().regex(/^[a-z0-9_-]{1,64}$/);
2215
+ var StackTone = import_zod24.z.enum(["good", "wait", "bad", "off"]);
2216
+ var StackServer = import_zod24.z.strictObject({
2217
+ name: StackServerName,
2218
+ /** One word: Healthy, Starting, Unhealthy, Restarting, Stopping, Waiting, Stopped, Crashed, Off. */
2219
+ label: import_zod24.z.string().max(32),
2220
+ tone: StackTone,
2221
+ /** What is going on, in one or two plain sentences. */
2222
+ sentence: import_zod24.z.string().max(2e3),
2223
+ /** The config's own description of the server. */
2224
+ description: import_zod24.z.string().max(512),
2225
+ /** Where the server answers, when its description names an address. */
2226
+ open_url: import_zod24.z.string().max(2048).nullable(),
2227
+ log_file: import_zod24.z.string().max(4096),
2228
+ /** When its log file was last written. */
2229
+ last_output_at_ms: epochMs.nullable(),
2230
+ started_at_ms: epochMs.nullable(),
2231
+ restarts: nonNegInt,
2232
+ exit_code: import_zod24.z.int().nullable(),
2233
+ pid: import_zod24.z.int().nullable()
2234
+ });
2235
+ var StackEvent = import_zod24.z.strictObject({
2236
+ at_ms: epochMs,
2237
+ /** A server name, or "stack" for the stack as a whole. */
2238
+ server: import_zod24.z.string().max(64),
2239
+ /** started · stopped · healthy · unhealthy · crashed · exited · restarting · stopping · action · action-done · action-failed · setup · error */
2240
+ kind: import_zod24.z.string().max(32),
2241
+ text: import_zod24.z.string().max(4e3)
2242
+ });
2243
+ var StackStateParams = import_zod24.z.strictObject({});
2244
+ var StackStateResult = import_zod24.z.strictObject({
2245
+ /** The stack's config file, when found. */
2246
+ config_path: import_zod24.z.string().max(4096).nullable(),
2247
+ /** Why the stack cannot be run from here (no config, no process-compose), else null. */
2248
+ problem: import_zod24.z.string().max(1e3).nullable(),
2249
+ stack_up: import_zod24.z.boolean(),
2250
+ stack_started_at_ms: epochMs.nullable(),
2251
+ servers: import_zod24.z.array(StackServer).max(64),
2252
+ /** One line about the one-shot setup steps ("Docker Desktop: running."), or null. */
2253
+ setup_note: import_zod24.z.string().max(500).nullable(),
2254
+ /** Start everything / Stop everything in flight. */
2255
+ pending: import_zod24.z.strictObject({ verb: import_zod24.z.enum(["start", "stop"]), label: import_zod24.z.string().max(64), since_ms: epochMs }).nullable(),
2256
+ /** The newest entries last. */
2257
+ events: import_zod24.z.array(StackEvent).max(300)
2258
+ });
2259
+ var StackStartParams = import_zod24.z.strictObject({});
2260
+ var StackStopParams = import_zod24.z.strictObject({});
2261
+ var StackRunResult = import_zod24.z.strictObject({ accepted: import_zod24.z.boolean() });
2262
+ var StackServerActionParams = import_zod24.z.strictObject({
2263
+ name: StackServerName,
2264
+ verb: import_zod24.z.enum(["start", "stop", "restart"])
2265
+ });
2266
+ var StackServerActionResult = import_zod24.z.strictObject({ message: import_zod24.z.string().max(1e3) });
2267
+ var StackLogsParams = import_zod24.z.strictObject({
2268
+ name: StackServerName,
2269
+ /** Without `offset`: the last this-many complete lines. With it: new lines after it, at most this many. */
2270
+ lines: import_zod24.z.int().min(1).max(2e5).default(2e3),
2271
+ /** Byte offset the last read ended at: answer only what was written after it (follow). */
2272
+ offset: nonNegInt.optional(),
2273
+ /** A "Clear" point: the lines written after this byte offset (no `offset`). */
2274
+ since: nonNegInt.optional(),
2275
+ /** With `offset`: wait up to this long for a new line when none is waiting (0 answers at once). */
2276
+ wait_ms: import_zod24.z.int().min(0).max(25e3).default(0)
2277
+ });
2278
+ var StackLogsResult = import_zod24.z.strictObject({
2279
+ /** Complete lines, colour codes removed. */
2280
+ lines: import_zod24.z.array(import_zod24.z.string().max(65536)).max(2e5),
2281
+ /** Where these lines end: pass it back as `offset` to follow. */
2282
+ offset: nonNegInt,
2283
+ /** False when `since` no longer exists (the log rotated): the lines are the plain tail instead. */
2284
+ since_valid: import_zod24.z.boolean(),
2285
+ /** The log was rotated or truncated since `offset`: these lines start the file again. */
2286
+ reset: import_zod24.z.boolean(),
2287
+ log_file: import_zod24.z.string().max(4096)
2288
+ });
2289
+ var StackErrorsParams = import_zod24.z.strictObject({
2290
+ window_minutes: import_zod24.z.int().min(1).max(1440).default(60)
2291
+ });
2292
+ var StackErrorsResult = import_zod24.z.strictObject({
2293
+ /** Per server: a heading line ("=== aidream — errors in the last 60 minutes (<file>) ===") and each error with the 10 lines after it. */
2294
+ sections: import_zod24.z.array(import_zod24.z.strictObject({ name: StackServerName, heading: import_zod24.z.string().max(4096), lines: import_zod24.z.array(import_zod24.z.string().max(65536)).max(5e3) })).max(64),
2295
+ window_minutes: import_zod24.z.int().min(1).max(1440)
2296
+ });
2297
+
2298
+ // src/schema/audio.ts
2299
+ var import_zod25 = require("zod");
2300
+ var AudioDevice = import_zod25.z.strictObject({
2073
2301
  /** The OS's name for it, as audio.record takes it. */
2074
- id: import_zod24.z.string().min(1).max(256),
2075
- name: import_zod24.z.string().max(256),
2076
- default: import_zod24.z.boolean()
2302
+ id: import_zod25.z.string().min(1).max(256),
2303
+ name: import_zod25.z.string().max(256),
2304
+ default: import_zod25.z.boolean()
2077
2305
  });
2078
- var AudioDevicesParams = import_zod24.z.strictObject({});
2079
- var AudioDevicesResult = import_zod24.z.strictObject({
2080
- inputs: import_zod24.z.array(AudioDevice).max(64),
2081
- outputs: import_zod24.z.array(AudioDevice).max(64)
2306
+ var AudioDevicesParams = import_zod25.z.strictObject({});
2307
+ var AudioDevicesResult = import_zod25.z.strictObject({
2308
+ inputs: import_zod25.z.array(AudioDevice).max(64),
2309
+ outputs: import_zod25.z.array(AudioDevice).max(64)
2082
2310
  });
2083
- var AudioRecordParams = import_zod24.z.strictObject({
2084
- seconds: import_zod24.z.number().min(0.5).max(600),
2311
+ var AudioRecordParams = import_zod25.z.strictObject({
2312
+ seconds: import_zod25.z.number().min(0.5).max(600),
2085
2313
  /** The microphone (from audio.devices); the default input when absent. */
2086
- device_id: import_zod24.z.string().min(1).max(256).optional(),
2314
+ device_id: import_zod25.z.string().min(1).max(256).optional(),
2087
2315
  /** Where the WAV file goes; a new file in the temp folder when absent. */
2088
2316
  path: AbsPath.optional()
2089
2317
  });
2090
- var AudioRecordResult = import_zod24.z.strictObject({
2318
+ var AudioRecordResult = import_zod25.z.strictObject({
2091
2319
  path: AbsPath,
2092
- seconds: import_zod24.z.number().min(0),
2320
+ seconds: import_zod25.z.number().min(0),
2093
2321
  bytes: nonNegInt,
2094
2322
  /** Loudest sample, 0–1: 0 means the device gave silence. */
2095
- peak: import_zod24.z.number().min(0).max(1)
2323
+ peak: import_zod25.z.number().min(0).max(1)
2096
2324
  });
2097
- var AudioPlayParams = import_zod24.z.strictObject({ path: AbsPath });
2098
- var AudioPlayResult = import_zod24.z.strictObject({ path: AbsPath, seconds: import_zod24.z.number().min(0) });
2325
+ var AudioPlayParams = import_zod25.z.strictObject({ path: AbsPath });
2326
+ var AudioPlayResult = import_zod25.z.strictObject({ path: AbsPath, seconds: import_zod25.z.number().min(0) });
2099
2327
 
2100
2328
  // src/schema/fs-watch.ts
2101
- var import_zod25 = require("zod");
2102
- var FsWatchId = import_zod25.z.string().regex(/^fw_[A-Za-z0-9]{12,40}$/);
2103
- var FsWatchStartParams = import_zod25.z.strictObject({
2329
+ var import_zod26 = require("zod");
2330
+ var FsWatchId = import_zod26.z.string().regex(/^fw_[A-Za-z0-9]{12,40}$/);
2331
+ var FsWatchStartParams = import_zod26.z.strictObject({
2104
2332
  path: AbsPath,
2105
- recursive: import_zod25.z.boolean().default(true),
2333
+ recursive: import_zod26.z.boolean().default(true),
2106
2334
  /** Globs relative to `path` whose changes are not reported (".git/**", "node_modules/**"). */
2107
- ignore: import_zod25.z.array(import_zod25.z.string().max(256)).max(64).default([])
2335
+ ignore: import_zod26.z.array(import_zod26.z.string().max(256)).max(64).default([])
2108
2336
  });
2109
- var FsWatchStartResult = import_zod25.z.strictObject({
2337
+ var FsWatchStartResult = import_zod26.z.strictObject({
2110
2338
  watch_id: FsWatchId,
2111
2339
  path: AbsPath,
2112
2340
  /** The watch ends by itself if nobody reads it for 30 minutes. */
2113
2341
  expires_at_ms: epochMs
2114
2342
  });
2115
- var FsWatchEventsParams = import_zod25.z.strictObject({
2343
+ var FsWatchEventsParams = import_zod26.z.strictObject({
2116
2344
  watch_id: FsWatchId,
2117
2345
  /** Wait up to this long for a first change when none is waiting (0 answers at once). */
2118
- wait_ms: import_zod25.z.int().min(0).max(25e3).default(0)
2346
+ wait_ms: import_zod26.z.int().min(0).max(25e3).default(0)
2119
2347
  });
2120
- var FsWatchEventsResult = import_zod25.z.strictObject({
2348
+ var FsWatchEventsResult = import_zod26.z.strictObject({
2121
2349
  /** What changed since the last read, oldest first; re-checked against the disk when read. */
2122
- changes: import_zod25.z.array(FsChange).max(1e3),
2350
+ changes: import_zod26.z.array(FsChange).max(1e3),
2123
2351
  /** Changes were dropped (more than 1000 waited): list the folder again. */
2124
- overflow: import_zod25.z.boolean(),
2352
+ overflow: import_zod26.z.boolean(),
2125
2353
  expires_at_ms: epochMs
2126
2354
  });
2127
- var FsWatchStopParams = import_zod25.z.strictObject({ watch_id: FsWatchId });
2128
- var FsWatchStopResult = import_zod25.z.strictObject({ watch_id: FsWatchId });
2355
+ var FsWatchStopParams = import_zod26.z.strictObject({ watch_id: FsWatchId });
2356
+ var FsWatchStopResult = import_zod26.z.strictObject({ watch_id: FsWatchId });
2129
2357
 
2130
2358
  // src/schema/exec-job.ts
2131
- var import_zod26 = require("zod");
2132
- var ExecJobId = import_zod26.z.string().regex(/^job_[A-Za-z0-9]{12,40}$/);
2133
- var ExecJobStartParams = import_zod26.z.strictObject({
2134
- command: import_zod26.z.string().min(1).max(131072),
2359
+ var import_zod27 = require("zod");
2360
+ var ExecJobId = import_zod27.z.string().regex(/^job_[A-Za-z0-9]{12,40}$/);
2361
+ var ExecJobStartParams = import_zod27.z.strictObject({
2362
+ command: import_zod27.z.string().min(1).max(131072),
2135
2363
  /** The folder it runs in; the home folder when absent. */
2136
2364
  cwd: AbsPath.optional(),
2137
- env: import_zod26.z.record(import_zod26.z.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/).max(128), import_zod26.z.string().max(32768)).optional()
2365
+ env: import_zod27.z.record(import_zod27.z.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/).max(128), import_zod27.z.string().max(32768)).optional()
2138
2366
  });
2139
- var ExecJobStartResult = import_zod26.z.strictObject({ job_id: ExecJobId, pid: import_zod26.z.int().min(1), cwd: AbsPath });
2140
- var ExecJobOutputParams = import_zod26.z.strictObject({
2367
+ var ExecJobStartResult = import_zod27.z.strictObject({ job_id: ExecJobId, pid: import_zod27.z.int().min(1), cwd: AbsPath });
2368
+ var ExecJobOutputParams = import_zod27.z.strictObject({
2141
2369
  job_id: ExecJobId,
2142
2370
  /** Byte offset into the job's output to read from (next_offset of the last read; 0 = the start). */
2143
2371
  offset: nonNegInt.default(0),
2144
2372
  /** Wait up to this long for new output or the exit when none is waiting (0 answers at once). */
2145
- wait_ms: import_zod26.z.int().min(0).max(25e3).default(0),
2146
- max_bytes: import_zod26.z.int().min(1024).max(1048576).default(65536)
2373
+ wait_ms: import_zod27.z.int().min(0).max(25e3).default(0),
2374
+ max_bytes: import_zod27.z.int().min(1024).max(1048576).default(65536)
2147
2375
  });
2148
- var ExecJobOutputResult = import_zod26.z.strictObject({
2376
+ var ExecJobOutputResult = import_zod27.z.strictObject({
2149
2377
  /** stdout and stderr interleaved as they arrived (UTF-8). */
2150
- output: import_zod26.z.string(),
2378
+ output: import_zod27.z.string(),
2151
2379
  next_offset: nonNegInt,
2152
2380
  /** Bytes before `offset` that are gone (the job keeps its last 4 MiB). */
2153
2381
  dropped_bytes: nonNegInt,
2154
- running: import_zod26.z.boolean(),
2155
- exit_code: import_zod26.z.int().nullable()
2382
+ running: import_zod27.z.boolean(),
2383
+ exit_code: import_zod27.z.int().nullable()
2156
2384
  });
2157
- var ExecJobStopParams = import_zod26.z.strictObject({
2385
+ var ExecJobStopParams = import_zod27.z.strictObject({
2158
2386
  job_id: ExecJobId,
2159
2387
  /** End it at once (SIGKILL; on Windows the whole tree with /F) instead of asking it to quit. */
2160
- force: import_zod26.z.boolean().default(false)
2388
+ force: import_zod27.z.boolean().default(false)
2161
2389
  });
2162
- var ExecJobStopResult = import_zod26.z.strictObject({ job_id: ExecJobId, exited: import_zod26.z.boolean(), exit_code: import_zod26.z.int().nullable() });
2163
- var ExecJobInfo = import_zod26.z.strictObject({
2390
+ var ExecJobStopResult = import_zod27.z.strictObject({ job_id: ExecJobId, exited: import_zod27.z.boolean(), exit_code: import_zod27.z.int().nullable() });
2391
+ var ExecJobInfo = import_zod27.z.strictObject({
2164
2392
  job_id: ExecJobId,
2165
- command: import_zod26.z.string().max(1024),
2166
- pid: import_zod26.z.int().min(1),
2393
+ command: import_zod27.z.string().max(1024),
2394
+ pid: import_zod27.z.int().min(1),
2167
2395
  cwd: AbsPath,
2168
- running: import_zod26.z.boolean(),
2169
- exit_code: import_zod26.z.int().nullable(),
2396
+ running: import_zod27.z.boolean(),
2397
+ exit_code: import_zod27.z.int().nullable(),
2170
2398
  started_at_ms: epochMs,
2171
2399
  output_bytes: nonNegInt
2172
2400
  });
2173
- var ExecJobListParams = import_zod26.z.strictObject({});
2174
- var ExecJobListResult = import_zod26.z.strictObject({ jobs: import_zod26.z.array(ExecJobInfo).max(64) });
2401
+ var ExecJobListParams = import_zod27.z.strictObject({});
2402
+ var ExecJobListResult = import_zod27.z.strictObject({ jobs: import_zod27.z.array(ExecJobInfo).max(64) });
2175
2403
 
2176
2404
  // src/schema/coding.ts
2177
- var import_zod27 = require("zod");
2178
- var CodingServiceCredentials = import_zod27.z.strictObject({
2179
- access_token: import_zod27.z.string().min(16).max(16384),
2180
- user_id: import_zod27.z.string().regex(/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/),
2405
+ var import_zod28 = require("zod");
2406
+ var CodingServiceCredentials = import_zod28.z.strictObject({
2407
+ access_token: import_zod28.z.string().min(16).max(16384),
2408
+ user_id: import_zod28.z.string().regex(/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/),
2181
2409
  /** The AI Matrx server this app talks to (production, or a local server on the nightly copy). */
2182
- server_url: import_zod27.z.string().min(1).max(2048).regex(/^https?:\/\/[^\s/?#]+(\/[^\s?#]*)?$/)
2410
+ server_url: import_zod28.z.string().min(1).max(2048).regex(/^https?:\/\/[^\s/?#]+(\/[^\s?#]*)?$/)
2183
2411
  });
2184
- var CodingHistoryBlocked = import_zod27.z.enum([
2412
+ var CodingHistoryBlocked = import_zod28.z.enum([
2185
2413
  "signed_out",
2186
2414
  "offline",
2187
2415
  "organization_required",
@@ -2189,11 +2417,11 @@ var CodingHistoryBlocked = import_zod27.z.enum([
2189
2417
  "cloud_list_unavailable",
2190
2418
  "history_too_large"
2191
2419
  ]);
2192
- var CodingHistoryFailure = import_zod27.z.strictObject({
2193
- session_id: import_zod27.z.string().max(64),
2194
- reason: import_zod27.z.string().max(300)
2420
+ var CodingHistoryFailure = import_zod28.z.strictObject({
2421
+ session_id: import_zod28.z.string().max(64),
2422
+ reason: import_zod28.z.string().max(300)
2195
2423
  });
2196
- var CodingHistoryRun = import_zod27.z.strictObject({
2424
+ var CodingHistoryRun = import_zod28.z.strictObject({
2197
2425
  /** Claude Code sessions found on this computer. */
2198
2426
  local_sessions: nonNegInt,
2199
2427
  /** Of those, already complete in AI Matrx. */
@@ -2208,39 +2436,39 @@ var CodingHistoryRun = import_zod27.z.strictObject({
2208
2436
  /** Changed while being read; a later run takes them. */
2209
2437
  changed: nonNegInt,
2210
2438
  failed: nonNegInt,
2211
- failures: import_zod27.z.array(CodingHistoryFailure).max(20),
2439
+ failures: import_zod28.z.array(CodingHistoryFailure).max(20),
2212
2440
  /** Candidates not reached yet. */
2213
2441
  remaining: nonNegInt,
2214
2442
  /** The one line a person reads, e.g. "Imported 12 of 14 sessions. 140 already in AI Matrx." */
2215
- summary: import_zod27.z.string().max(400)
2443
+ summary: import_zod28.z.string().max(400)
2216
2444
  });
2217
- var CodingHistoryStep = import_zod27.z.strictObject({
2445
+ var CodingHistoryStep = import_zod28.z.strictObject({
2218
2446
  /** Null when the run could not start (blocked before a plan existed). */
2219
- plan_id: import_zod27.z.string().regex(/^[0-9a-f]{32}$/).nullable(),
2220
- finished: import_zod27.z.boolean(),
2447
+ plan_id: import_zod28.z.string().regex(/^[0-9a-f]{32}$/).nullable(),
2448
+ finished: import_zod28.z.boolean(),
2221
2449
  blocked: CodingHistoryBlocked.nullable(),
2222
2450
  run: CodingHistoryRun
2223
2451
  });
2224
- var CodingPlanMissingParams = import_zod27.z.strictObject({ credentials: CodingServiceCredentials.nullable() });
2225
- var CodingImportNextParams = import_zod27.z.strictObject({
2226
- plan_id: import_zod27.z.string().regex(/^[0-9a-f]{32}$/),
2452
+ var CodingPlanMissingParams = import_zod28.z.strictObject({ credentials: CodingServiceCredentials.nullable() });
2453
+ var CodingImportNextParams = import_zod28.z.strictObject({
2454
+ plan_id: import_zod28.z.string().regex(/^[0-9a-f]{32}$/),
2227
2455
  credentials: CodingServiceCredentials.nullable()
2228
2456
  });
2229
- var CodingServiceProgress = import_zod27.z.strictObject({
2230
- phase: import_zod27.z.enum(["checking", "importing"]),
2457
+ var CodingServiceProgress = import_zod28.z.strictObject({
2458
+ phase: import_zod28.z.enum(["checking", "importing"]),
2231
2459
  done: nonNegInt,
2232
2460
  total: nonNegInt
2233
2461
  });
2234
- var CodingHistoryImportMissingParams = import_zod27.z.strictObject({});
2235
- var CodingHistoryImportMissingResult = import_zod27.z.strictObject({
2236
- state: import_zod27.z.enum(["done", "blocked", "cancelled"]),
2462
+ var CodingHistoryImportMissingParams = import_zod28.z.strictObject({});
2463
+ var CodingHistoryImportMissingResult = import_zod28.z.strictObject({
2464
+ state: import_zod28.z.enum(["done", "blocked", "cancelled"]),
2237
2465
  blocked: CodingHistoryBlocked.nullable(),
2238
2466
  run: CodingHistoryRun,
2239
2467
  elapsed_ms: nonNegInt
2240
2468
  });
2241
- var CodingHistoryProgressEvent = import_zod27.z.strictObject({
2469
+ var CodingHistoryProgressEvent = import_zod28.z.strictObject({
2242
2470
  request_id: RequestId,
2243
- phase: import_zod27.z.enum(["checking", "importing"]),
2471
+ phase: import_zod28.z.enum(["checking", "importing"]),
2244
2472
  /** Sessions settled so far, of `total` candidates (0 of 0 while checking). */
2245
2473
  done: nonNegInt,
2246
2474
  total: nonNegInt,
@@ -2342,9 +2570,19 @@ var OPS = {
2342
2570
  "power.status": { params: PowerStatusParams, result: PowerStatusResult, kind: "unary", since: "1.4", errors: ["INTERNAL"] },
2343
2571
  "power.prevent_sleep": { params: PowerPreventSleepParams, result: PowerPreventSleepResult, kind: "unary", since: "1.4", errors: ["PERMISSION_DENIED_OS", "PLATFORM_UNSUPPORTED", "INTERNAL"] },
2344
2572
  "resources.snapshot": { params: ResourcesSnapshotParams, result: ResourcesSnapshotResult, kind: "unary", since: "1.4", errors: ["INTERNAL"] },
2573
+ "resources.activity": { params: ResourcesActivityParams, result: ResourcesActivityResult, kind: "unary", since: "1.17", errors: ["PLATFORM_UNSUPPORTED", "INTERNAL"] },
2574
+ "resources.stop_job": { params: ResourcesStopJobParams, result: ResourcesStopJobResult, kind: "unary", since: "1.17", errors: ["NOT_FOUND", "CONFLICT", "AUTH_FORBIDDEN", "PLATFORM_UNSUPPORTED", "INTERNAL"] },
2575
+ "resources.incidents": { params: ResourcesIncidentsParams, result: ResourcesIncidentsResult, kind: "unary", since: "1.17", errors: ["INTERNAL"] },
2345
2576
  "audio.devices": { params: AudioDevicesParams, result: AudioDevicesResult, kind: "unary", since: "1.6", errors: ["PLATFORM_UNSUPPORTED", "INTERNAL"] },
2346
2577
  "audio.record": { params: AudioRecordParams, result: AudioRecordResult, kind: "unary", since: "1.6", errors: ["NOT_FOUND", "PERMISSION_DENIED_OS", "PLATFORM_UNSUPPORTED", "RESOURCE_BUSY", "INTERNAL"] },
2347
2578
  "audio.play": { params: AudioPlayParams, result: AudioPlayResult, kind: "unary", since: "1.6", errors: ["NOT_FOUND", "INVALID_PARAMS", "PLATFORM_UNSUPPORTED", "INTERNAL"] },
2579
+ // The local AI Matrx servers (aidream's process-compose stack), supervised from Matrx 2's core.
2580
+ "stack.state": { params: StackStateParams, result: StackStateResult, kind: "unary", since: "1.16", errors: ["INTERNAL"] },
2581
+ "stack.start": { params: StackStartParams, result: StackRunResult, kind: "unary", since: "1.16", errors: ["RESOURCE_BUSY", "PLATFORM_UNSUPPORTED", "INTERNAL"] },
2582
+ "stack.stop": { params: StackStopParams, result: StackRunResult, kind: "unary", since: "1.16", errors: ["RESOURCE_BUSY", "PLATFORM_UNSUPPORTED", "INTERNAL"] },
2583
+ "stack.server.action": { params: StackServerActionParams, result: StackServerActionResult, kind: "unary", since: "1.16", errors: ["NOT_FOUND", "CONFLICT", "INTERNAL"] },
2584
+ "stack.logs": { params: StackLogsParams, result: StackLogsResult, kind: "unary", since: "1.16", errors: ["NOT_FOUND", "INTERNAL"] },
2585
+ "stack.errors": { params: StackErrorsParams, result: StackErrorsResult, kind: "unary", since: "1.16", errors: ["INTERNAL"] },
2348
2586
  // Claude Code history (SPEC §6 coding): served by the `coding` Python service through SERVICES below.
2349
2587
  "coding.history.import_missing": { params: CodingHistoryImportMissingParams, result: CodingHistoryImportMissingResult, kind: "unary", since: "1.5", errors: ["RESOURCE_BUSY", "RESOURCE_GONE", "CANCELLED", "INTERNAL"] }
2350
2588
  };
@@ -2569,6 +2807,20 @@ var NAMED_SCHEMAS = {
2569
2807
  ResourcesDisk,
2570
2808
  ResourcesSnapshotParams,
2571
2809
  ResourcesSnapshotResult,
2810
+ ResourcesJobKind,
2811
+ ResourcesStrain,
2812
+ ResourcesPressure,
2813
+ ResourcesVerdict,
2814
+ ResourcesSample,
2815
+ ResourcesJob,
2816
+ ResourcesProcess,
2817
+ ResourcesActivityParams,
2818
+ ResourcesActivityResult,
2819
+ ResourcesStopJobParams,
2820
+ ResourcesStopJobResult,
2821
+ ResourcesIncident,
2822
+ ResourcesIncidentsParams,
2823
+ ResourcesIncidentsResult,
2572
2824
  AudioDevice,
2573
2825
  AudioDevicesParams,
2574
2826
  AudioDevicesResult,
@@ -2576,6 +2828,21 @@ var NAMED_SCHEMAS = {
2576
2828
  AudioRecordResult,
2577
2829
  AudioPlayParams,
2578
2830
  AudioPlayResult,
2831
+ StackServerName,
2832
+ StackTone,
2833
+ StackServer,
2834
+ StackEvent,
2835
+ StackStateParams,
2836
+ StackStateResult,
2837
+ StackStartParams,
2838
+ StackStopParams,
2839
+ StackRunResult,
2840
+ StackServerActionParams,
2841
+ StackServerActionResult,
2842
+ StackLogsParams,
2843
+ StackLogsResult,
2844
+ StackErrorsParams,
2845
+ StackErrorsResult,
2579
2846
  FsWatchId,
2580
2847
  FsWatchStartParams,
2581
2848
  FsWatchStartResult,
@@ -2705,7 +2972,8 @@ var FIELDS_SINCE = {
2705
2972
  AppsAccountsUsageResult: { problem: "1.12" },
2706
2973
  AppsAccountsResetsResult: { problem: "1.12" },
2707
2974
  ChatRow: { app_project: "1.13", tokens: "1.13", original_title: "1.14", title_source: "1.14", title_override: "1.14", archived: "1.15" },
2708
- AccountUsage: { plan: "1.13", credits: "1.13" }
2975
+ AccountUsage: { plan: "1.13", credits: "1.13" },
2976
+ ResourcesDisk: { name: "1.17" }
2709
2977
  };
2710
2978
  var NULL_SINCE = {
2711
2979
  "RelayDeviceStatusEvent.since_ms": { since: "1.1", olderPeersGet: 0 }
@@ -2772,7 +3040,8 @@ var NESTED_RESULTS = /* @__PURE__ */ new Map([
2772
3040
  ["apps.projects.move", [["chat", "ChatRow"]]],
2773
3041
  ["apps.chats.star", [["chat", "ChatRow"]]],
2774
3042
  ["apps.chats.place", [["chat", "ChatRow"]]],
2775
- ["apps.accounts.usage", [["accounts", "AccountUsage"]]]
3043
+ ["apps.accounts.usage", [["accounts", "AccountUsage"]]],
3044
+ ["resources.snapshot", [["disks", "ResourcesDisk"]]]
2776
3045
  ]);
2777
3046
  function stripNested(value, nested, version) {
2778
3047
  if (value === null || typeof value !== "object" || Array.isArray(value)) return value;
@@ -2833,7 +3102,7 @@ function forPeer(op, part, value, version) {
2833
3102
  var VERSIONED_RESULT_OPS = [.../* @__PURE__ */ new Set([...RESULT_PATH.keys(), ...WINDOW_RESULTS.keys(), ...NESTED_RESULTS.keys()])];
2834
3103
 
2835
3104
  // src/contract.ts
2836
- var CONTRACT_SHA256 = "91060640a08d25f693f4d90384da7225299ab8fd287b665ca7d36f226d641267";
3105
+ var CONTRACT_SHA256 = "cdfad283c689005856b4161f28a37892d1c3356db077f685a4a659fc2c8fc657";
2837
3106
 
2838
3107
  // src/close-policy.ts
2839
3108
  var CLOSE_RULES = {
@@ -2893,7 +3162,7 @@ var TOOL_CATALOG = [
2893
3162
  { name: "desktop_input", group: "os_control", state: "built", path: "device_op", ops: ["input.type_text", "input.hotkey", "input.mouse_click", "input.mouse_move"], platforms: ALL, summary: "Keyboard and mouse" },
2894
3163
  { name: "desktop_audio", group: "os_control", state: "built", path: "device_op", ops: ["audio.devices", "audio.record", "audio.play"], platforms: ALL, summary: "Audio devices, record, play" },
2895
3164
  { name: "desktop_power", group: "os_control", state: "built", path: "device_op", ops: ["power.status", "power.prevent_sleep"], platforms: ALL, summary: "Battery and keep awake" },
2896
- { name: "desktop_resources", group: "os_control", state: "built", path: "device_op", ops: ["resources.snapshot"], platforms: ALL, summary: "CPU, memory and disk use" },
3165
+ { name: "desktop_resources", group: "os_control", state: "built", path: "device_op", ops: ["resources.snapshot", "resources.activity", "resources.stop_job", "resources.incidents"], platforms: ALL, summary: "CPU, memory and disk use; what is using them, grouped into jobs; stop a job; the slowdown log" },
2897
3166
  { name: "fs_watch", group: "os_control", state: "built", path: "device_op", ops: ["fs.watch.start", "fs.watch.events", "fs.watch.stop"], platforms: ALL, summary: "Watch a folder; read what changed" },
2898
3167
  // ── 3. Personal apps and automation ──────────────────────────────────────────────────────────
2899
3168
  { name: "desktop_automation", group: "personal_automation", state: "planned", path: "device_op", ops: ["automation.script"], platforms: ["darwin", "win32"], summary: "AppleScript on a Mac, PowerShell on Windows" },