@ai-matrx/desktop-protocol 0.17.12 → 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,
@@ -422,7 +436,7 @@ module.exports = __toCommonJS(src_exports);
422
436
  // src/schema/primitives.ts
423
437
  var import_zod = require("zod");
424
438
  var PROTOCOL_MAJOR = 1;
425
- var PROTOCOL_MINOR = 16;
439
+ var PROTOCOL_MINOR = 17;
426
440
  var PROTOCOL_VERSION = `${PROTOCOL_MAJOR}.${PROTOCOL_MINOR}`;
427
441
  var ProtocolVersion = import_zod.z.string().regex(/^[1-9][0-9]{0,2}\.[0-9]{1,3}$/);
428
442
  var RequestId = import_zod.z.string().min(1).max(64).regex(/^[A-Za-z0-9_-]+$/);
@@ -2061,6 +2075,8 @@ var import_zod23 = require("zod");
2061
2075
  var ResourcesDisk = import_zod23.z.strictObject({
2062
2076
  /** Where it is mounted ("/", "C:"). */
2063
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(),
2064
2080
  /** The file system ("apfs", "NTFS", "ext4"). */
2065
2081
  fs: import_zod23.z.string().max(64),
2066
2082
  size_bytes: nonNegInt,
@@ -2081,6 +2097,117 @@ var ResourcesSnapshotResult = import_zod23.z.strictObject({
2081
2097
  disks: import_zod23.z.array(ResourcesDisk).max(64),
2082
2098
  uptime_seconds: nonNegInt
2083
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
+ });
2084
2211
 
2085
2212
  // src/schema/stack.ts
2086
2213
  var import_zod24 = require("zod");
@@ -2443,6 +2570,9 @@ var OPS = {
2443
2570
  "power.status": { params: PowerStatusParams, result: PowerStatusResult, kind: "unary", since: "1.4", errors: ["INTERNAL"] },
2444
2571
  "power.prevent_sleep": { params: PowerPreventSleepParams, result: PowerPreventSleepResult, kind: "unary", since: "1.4", errors: ["PERMISSION_DENIED_OS", "PLATFORM_UNSUPPORTED", "INTERNAL"] },
2445
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"] },
2446
2576
  "audio.devices": { params: AudioDevicesParams, result: AudioDevicesResult, kind: "unary", since: "1.6", errors: ["PLATFORM_UNSUPPORTED", "INTERNAL"] },
2447
2577
  "audio.record": { params: AudioRecordParams, result: AudioRecordResult, kind: "unary", since: "1.6", errors: ["NOT_FOUND", "PERMISSION_DENIED_OS", "PLATFORM_UNSUPPORTED", "RESOURCE_BUSY", "INTERNAL"] },
2448
2578
  "audio.play": { params: AudioPlayParams, result: AudioPlayResult, kind: "unary", since: "1.6", errors: ["NOT_FOUND", "INVALID_PARAMS", "PLATFORM_UNSUPPORTED", "INTERNAL"] },
@@ -2677,6 +2807,20 @@ var NAMED_SCHEMAS = {
2677
2807
  ResourcesDisk,
2678
2808
  ResourcesSnapshotParams,
2679
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,
2680
2824
  AudioDevice,
2681
2825
  AudioDevicesParams,
2682
2826
  AudioDevicesResult,
@@ -2828,7 +2972,8 @@ var FIELDS_SINCE = {
2828
2972
  AppsAccountsUsageResult: { problem: "1.12" },
2829
2973
  AppsAccountsResetsResult: { problem: "1.12" },
2830
2974
  ChatRow: { app_project: "1.13", tokens: "1.13", original_title: "1.14", title_source: "1.14", title_override: "1.14", archived: "1.15" },
2831
- AccountUsage: { plan: "1.13", credits: "1.13" }
2975
+ AccountUsage: { plan: "1.13", credits: "1.13" },
2976
+ ResourcesDisk: { name: "1.17" }
2832
2977
  };
2833
2978
  var NULL_SINCE = {
2834
2979
  "RelayDeviceStatusEvent.since_ms": { since: "1.1", olderPeersGet: 0 }
@@ -2895,7 +3040,8 @@ var NESTED_RESULTS = /* @__PURE__ */ new Map([
2895
3040
  ["apps.projects.move", [["chat", "ChatRow"]]],
2896
3041
  ["apps.chats.star", [["chat", "ChatRow"]]],
2897
3042
  ["apps.chats.place", [["chat", "ChatRow"]]],
2898
- ["apps.accounts.usage", [["accounts", "AccountUsage"]]]
3043
+ ["apps.accounts.usage", [["accounts", "AccountUsage"]]],
3044
+ ["resources.snapshot", [["disks", "ResourcesDisk"]]]
2899
3045
  ]);
2900
3046
  function stripNested(value, nested, version) {
2901
3047
  if (value === null || typeof value !== "object" || Array.isArray(value)) return value;
@@ -2956,7 +3102,7 @@ function forPeer(op, part, value, version) {
2956
3102
  var VERSIONED_RESULT_OPS = [.../* @__PURE__ */ new Set([...RESULT_PATH.keys(), ...WINDOW_RESULTS.keys(), ...NESTED_RESULTS.keys()])];
2957
3103
 
2958
3104
  // src/contract.ts
2959
- var CONTRACT_SHA256 = "ee6873cbbdcba3960248ff0c5c71fe47c663b54c6e657d62d1ed5e04e51f17e2";
3105
+ var CONTRACT_SHA256 = "cdfad283c689005856b4161f28a37892d1c3356db077f685a4a659fc2c8fc657";
2960
3106
 
2961
3107
  // src/close-policy.ts
2962
3108
  var CLOSE_RULES = {
@@ -3016,7 +3162,7 @@ var TOOL_CATALOG = [
3016
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" },
3017
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" },
3018
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" },
3019
- { 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" },
3020
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" },
3021
3167
  // ── 3. Personal apps and automation ──────────────────────────────────────────────────────────
3022
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" },