@ai-matrx/desktop-protocol 0.16.1 → 0.17.0

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
@@ -39,6 +39,13 @@ __export(src_exports, {
39
39
  AppsProfilesRemoveResult: () => AppsProfilesRemoveResult,
40
40
  AppsProfilesSaveParams: () => AppsProfilesSaveParams,
41
41
  AppsProfilesSaveResult: () => AppsProfilesSaveResult,
42
+ AudioDevice: () => AudioDevice,
43
+ AudioDevicesParams: () => AudioDevicesParams,
44
+ AudioDevicesResult: () => AudioDevicesResult,
45
+ AudioPlayParams: () => AudioPlayParams,
46
+ AudioPlayResult: () => AudioPlayResult,
47
+ AudioRecordParams: () => AudioRecordParams,
48
+ AudioRecordResult: () => AudioRecordResult,
42
49
  BEARER_PREFIX: () => BEARER_PREFIX,
43
50
  BROADCAST_CID: () => BROADCAST_CID,
44
51
  CLOSE_RULES: () => CLOSE_RULES,
@@ -325,7 +332,7 @@ module.exports = __toCommonJS(src_exports);
325
332
  // src/schema/primitives.ts
326
333
  var import_zod = require("zod");
327
334
  var PROTOCOL_MAJOR = 1;
328
- var PROTOCOL_MINOR = 5;
335
+ var PROTOCOL_MINOR = 6;
329
336
  var PROTOCOL_VERSION = `${PROTOCOL_MAJOR}.${PROTOCOL_MINOR}`;
330
337
  var ProtocolVersion = import_zod.z.string().regex(/^[1-9][0-9]{0,2}\.[0-9]{1,3}$/);
331
338
  var RequestId = import_zod.z.string().min(1).max(64).regex(/^[A-Za-z0-9_-]+$/);
@@ -1595,91 +1602,121 @@ var ResourcesSnapshotResult = import_zod21.z.strictObject({
1595
1602
  uptime_seconds: nonNegInt
1596
1603
  });
1597
1604
 
1598
- // src/schema/fs-watch.ts
1605
+ // src/schema/audio.ts
1599
1606
  var import_zod22 = require("zod");
1600
- var FsWatchId = import_zod22.z.string().regex(/^fw_[A-Za-z0-9]{12,40}$/);
1601
- var FsWatchStartParams = import_zod22.z.strictObject({
1607
+ var AudioDevice = import_zod22.z.strictObject({
1608
+ /** The OS's name for it, as audio.record takes it. */
1609
+ id: import_zod22.z.string().min(1).max(256),
1610
+ name: import_zod22.z.string().max(256),
1611
+ default: import_zod22.z.boolean()
1612
+ });
1613
+ var AudioDevicesParams = import_zod22.z.strictObject({});
1614
+ var AudioDevicesResult = import_zod22.z.strictObject({
1615
+ inputs: import_zod22.z.array(AudioDevice).max(64),
1616
+ outputs: import_zod22.z.array(AudioDevice).max(64)
1617
+ });
1618
+ var AudioRecordParams = import_zod22.z.strictObject({
1619
+ seconds: import_zod22.z.number().min(0.5).max(600),
1620
+ /** The microphone (from audio.devices); the default input when absent. */
1621
+ device_id: import_zod22.z.string().min(1).max(256).optional(),
1622
+ /** Where the WAV file goes; a new file in the temp folder when absent. */
1623
+ path: AbsPath.optional()
1624
+ });
1625
+ var AudioRecordResult = import_zod22.z.strictObject({
1602
1626
  path: AbsPath,
1603
- recursive: import_zod22.z.boolean().default(true),
1627
+ seconds: import_zod22.z.number().min(0),
1628
+ bytes: nonNegInt,
1629
+ /** Loudest sample, 0–1: 0 means the device gave silence. */
1630
+ peak: import_zod22.z.number().min(0).max(1)
1631
+ });
1632
+ var AudioPlayParams = import_zod22.z.strictObject({ path: AbsPath });
1633
+ var AudioPlayResult = import_zod22.z.strictObject({ path: AbsPath, seconds: import_zod22.z.number().min(0) });
1634
+
1635
+ // src/schema/fs-watch.ts
1636
+ var import_zod23 = require("zod");
1637
+ var FsWatchId = import_zod23.z.string().regex(/^fw_[A-Za-z0-9]{12,40}$/);
1638
+ var FsWatchStartParams = import_zod23.z.strictObject({
1639
+ path: AbsPath,
1640
+ recursive: import_zod23.z.boolean().default(true),
1604
1641
  /** Globs relative to `path` whose changes are not reported (".git/**", "node_modules/**"). */
1605
- ignore: import_zod22.z.array(import_zod22.z.string().max(256)).max(64).default([])
1642
+ ignore: import_zod23.z.array(import_zod23.z.string().max(256)).max(64).default([])
1606
1643
  });
1607
- var FsWatchStartResult = import_zod22.z.strictObject({
1644
+ var FsWatchStartResult = import_zod23.z.strictObject({
1608
1645
  watch_id: FsWatchId,
1609
1646
  path: AbsPath,
1610
1647
  /** The watch ends by itself if nobody reads it for 30 minutes. */
1611
1648
  expires_at_ms: epochMs
1612
1649
  });
1613
- var FsWatchEventsParams = import_zod22.z.strictObject({
1650
+ var FsWatchEventsParams = import_zod23.z.strictObject({
1614
1651
  watch_id: FsWatchId,
1615
1652
  /** Wait up to this long for a first change when none is waiting (0 answers at once). */
1616
- wait_ms: import_zod22.z.int().min(0).max(25e3).default(0)
1653
+ wait_ms: import_zod23.z.int().min(0).max(25e3).default(0)
1617
1654
  });
1618
- var FsWatchEventsResult = import_zod22.z.strictObject({
1655
+ var FsWatchEventsResult = import_zod23.z.strictObject({
1619
1656
  /** What changed since the last read, oldest first; re-checked against the disk when read. */
1620
- changes: import_zod22.z.array(FsChange).max(1e3),
1657
+ changes: import_zod23.z.array(FsChange).max(1e3),
1621
1658
  /** Changes were dropped (more than 1000 waited): list the folder again. */
1622
- overflow: import_zod22.z.boolean(),
1659
+ overflow: import_zod23.z.boolean(),
1623
1660
  expires_at_ms: epochMs
1624
1661
  });
1625
- var FsWatchStopParams = import_zod22.z.strictObject({ watch_id: FsWatchId });
1626
- var FsWatchStopResult = import_zod22.z.strictObject({ watch_id: FsWatchId });
1662
+ var FsWatchStopParams = import_zod23.z.strictObject({ watch_id: FsWatchId });
1663
+ var FsWatchStopResult = import_zod23.z.strictObject({ watch_id: FsWatchId });
1627
1664
 
1628
1665
  // src/schema/exec-job.ts
1629
- var import_zod23 = require("zod");
1630
- var ExecJobId = import_zod23.z.string().regex(/^job_[A-Za-z0-9]{12,40}$/);
1631
- var ExecJobStartParams = import_zod23.z.strictObject({
1632
- command: import_zod23.z.string().min(1).max(131072),
1666
+ var import_zod24 = require("zod");
1667
+ var ExecJobId = import_zod24.z.string().regex(/^job_[A-Za-z0-9]{12,40}$/);
1668
+ var ExecJobStartParams = import_zod24.z.strictObject({
1669
+ command: import_zod24.z.string().min(1).max(131072),
1633
1670
  /** The folder it runs in; the home folder when absent. */
1634
1671
  cwd: AbsPath.optional(),
1635
- env: import_zod23.z.record(import_zod23.z.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/).max(128), import_zod23.z.string().max(32768)).optional()
1672
+ env: import_zod24.z.record(import_zod24.z.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/).max(128), import_zod24.z.string().max(32768)).optional()
1636
1673
  });
1637
- var ExecJobStartResult = import_zod23.z.strictObject({ job_id: ExecJobId, pid: import_zod23.z.int().min(1), cwd: AbsPath });
1638
- var ExecJobOutputParams = import_zod23.z.strictObject({
1674
+ var ExecJobStartResult = import_zod24.z.strictObject({ job_id: ExecJobId, pid: import_zod24.z.int().min(1), cwd: AbsPath });
1675
+ var ExecJobOutputParams = import_zod24.z.strictObject({
1639
1676
  job_id: ExecJobId,
1640
1677
  /** Byte offset into the job's output to read from (next_offset of the last read; 0 = the start). */
1641
1678
  offset: nonNegInt.default(0),
1642
1679
  /** Wait up to this long for new output or the exit when none is waiting (0 answers at once). */
1643
- wait_ms: import_zod23.z.int().min(0).max(25e3).default(0),
1644
- max_bytes: import_zod23.z.int().min(1024).max(1048576).default(65536)
1680
+ wait_ms: import_zod24.z.int().min(0).max(25e3).default(0),
1681
+ max_bytes: import_zod24.z.int().min(1024).max(1048576).default(65536)
1645
1682
  });
1646
- var ExecJobOutputResult = import_zod23.z.strictObject({
1683
+ var ExecJobOutputResult = import_zod24.z.strictObject({
1647
1684
  /** stdout and stderr interleaved as they arrived (UTF-8). */
1648
- output: import_zod23.z.string(),
1685
+ output: import_zod24.z.string(),
1649
1686
  next_offset: nonNegInt,
1650
1687
  /** Bytes before `offset` that are gone (the job keeps its last 4 MiB). */
1651
1688
  dropped_bytes: nonNegInt,
1652
- running: import_zod23.z.boolean(),
1653
- exit_code: import_zod23.z.int().nullable()
1689
+ running: import_zod24.z.boolean(),
1690
+ exit_code: import_zod24.z.int().nullable()
1654
1691
  });
1655
- var ExecJobStopParams = import_zod23.z.strictObject({
1692
+ var ExecJobStopParams = import_zod24.z.strictObject({
1656
1693
  job_id: ExecJobId,
1657
1694
  /** End it at once (SIGKILL; on Windows the whole tree with /F) instead of asking it to quit. */
1658
- force: import_zod23.z.boolean().default(false)
1695
+ force: import_zod24.z.boolean().default(false)
1659
1696
  });
1660
- var ExecJobStopResult = import_zod23.z.strictObject({ job_id: ExecJobId, exited: import_zod23.z.boolean(), exit_code: import_zod23.z.int().nullable() });
1661
- var ExecJobInfo = import_zod23.z.strictObject({
1697
+ var ExecJobStopResult = import_zod24.z.strictObject({ job_id: ExecJobId, exited: import_zod24.z.boolean(), exit_code: import_zod24.z.int().nullable() });
1698
+ var ExecJobInfo = import_zod24.z.strictObject({
1662
1699
  job_id: ExecJobId,
1663
- command: import_zod23.z.string().max(1024),
1664
- pid: import_zod23.z.int().min(1),
1700
+ command: import_zod24.z.string().max(1024),
1701
+ pid: import_zod24.z.int().min(1),
1665
1702
  cwd: AbsPath,
1666
- running: import_zod23.z.boolean(),
1667
- exit_code: import_zod23.z.int().nullable(),
1703
+ running: import_zod24.z.boolean(),
1704
+ exit_code: import_zod24.z.int().nullable(),
1668
1705
  started_at_ms: epochMs,
1669
1706
  output_bytes: nonNegInt
1670
1707
  });
1671
- var ExecJobListParams = import_zod23.z.strictObject({});
1672
- var ExecJobListResult = import_zod23.z.strictObject({ jobs: import_zod23.z.array(ExecJobInfo).max(64) });
1708
+ var ExecJobListParams = import_zod24.z.strictObject({});
1709
+ var ExecJobListResult = import_zod24.z.strictObject({ jobs: import_zod24.z.array(ExecJobInfo).max(64) });
1673
1710
 
1674
1711
  // src/schema/coding.ts
1675
- var import_zod24 = require("zod");
1676
- var CodingServiceCredentials = import_zod24.z.strictObject({
1677
- access_token: import_zod24.z.string().min(16).max(16384),
1678
- user_id: import_zod24.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}$/),
1712
+ var import_zod25 = require("zod");
1713
+ var CodingServiceCredentials = import_zod25.z.strictObject({
1714
+ access_token: import_zod25.z.string().min(16).max(16384),
1715
+ user_id: import_zod25.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}$/),
1679
1716
  /** The AI Matrx server this app talks to (production, or a local server on the nightly copy). */
1680
- server_url: import_zod24.z.string().min(1).max(2048).regex(/^https?:\/\/[^\s/?#]+(\/[^\s?#]*)?$/)
1717
+ server_url: import_zod25.z.string().min(1).max(2048).regex(/^https?:\/\/[^\s/?#]+(\/[^\s?#]*)?$/)
1681
1718
  });
1682
- var CodingHistoryBlocked = import_zod24.z.enum([
1719
+ var CodingHistoryBlocked = import_zod25.z.enum([
1683
1720
  "signed_out",
1684
1721
  "offline",
1685
1722
  "organization_required",
@@ -1687,11 +1724,11 @@ var CodingHistoryBlocked = import_zod24.z.enum([
1687
1724
  "cloud_list_unavailable",
1688
1725
  "history_too_large"
1689
1726
  ]);
1690
- var CodingHistoryFailure = import_zod24.z.strictObject({
1691
- session_id: import_zod24.z.string().max(64),
1692
- reason: import_zod24.z.string().max(300)
1727
+ var CodingHistoryFailure = import_zod25.z.strictObject({
1728
+ session_id: import_zod25.z.string().max(64),
1729
+ reason: import_zod25.z.string().max(300)
1693
1730
  });
1694
- var CodingHistoryRun = import_zod24.z.strictObject({
1731
+ var CodingHistoryRun = import_zod25.z.strictObject({
1695
1732
  /** Claude Code sessions found on this computer. */
1696
1733
  local_sessions: nonNegInt,
1697
1734
  /** Of those, already complete in AI Matrx. */
@@ -1706,39 +1743,39 @@ var CodingHistoryRun = import_zod24.z.strictObject({
1706
1743
  /** Changed while being read; a later run takes them. */
1707
1744
  changed: nonNegInt,
1708
1745
  failed: nonNegInt,
1709
- failures: import_zod24.z.array(CodingHistoryFailure).max(20),
1746
+ failures: import_zod25.z.array(CodingHistoryFailure).max(20),
1710
1747
  /** Candidates not reached yet. */
1711
1748
  remaining: nonNegInt,
1712
1749
  /** The one line a person reads, e.g. "Imported 12 of 14 sessions. 140 already in AI Matrx." */
1713
- summary: import_zod24.z.string().max(400)
1750
+ summary: import_zod25.z.string().max(400)
1714
1751
  });
1715
- var CodingHistoryStep = import_zod24.z.strictObject({
1752
+ var CodingHistoryStep = import_zod25.z.strictObject({
1716
1753
  /** Null when the run could not start (blocked before a plan existed). */
1717
- plan_id: import_zod24.z.string().regex(/^[0-9a-f]{32}$/).nullable(),
1718
- finished: import_zod24.z.boolean(),
1754
+ plan_id: import_zod25.z.string().regex(/^[0-9a-f]{32}$/).nullable(),
1755
+ finished: import_zod25.z.boolean(),
1719
1756
  blocked: CodingHistoryBlocked.nullable(),
1720
1757
  run: CodingHistoryRun
1721
1758
  });
1722
- var CodingPlanMissingParams = import_zod24.z.strictObject({ credentials: CodingServiceCredentials.nullable() });
1723
- var CodingImportNextParams = import_zod24.z.strictObject({
1724
- plan_id: import_zod24.z.string().regex(/^[0-9a-f]{32}$/),
1759
+ var CodingPlanMissingParams = import_zod25.z.strictObject({ credentials: CodingServiceCredentials.nullable() });
1760
+ var CodingImportNextParams = import_zod25.z.strictObject({
1761
+ plan_id: import_zod25.z.string().regex(/^[0-9a-f]{32}$/),
1725
1762
  credentials: CodingServiceCredentials.nullable()
1726
1763
  });
1727
- var CodingServiceProgress = import_zod24.z.strictObject({
1728
- phase: import_zod24.z.enum(["checking", "importing"]),
1764
+ var CodingServiceProgress = import_zod25.z.strictObject({
1765
+ phase: import_zod25.z.enum(["checking", "importing"]),
1729
1766
  done: nonNegInt,
1730
1767
  total: nonNegInt
1731
1768
  });
1732
- var CodingHistoryImportMissingParams = import_zod24.z.strictObject({});
1733
- var CodingHistoryImportMissingResult = import_zod24.z.strictObject({
1734
- state: import_zod24.z.enum(["done", "blocked", "cancelled"]),
1769
+ var CodingHistoryImportMissingParams = import_zod25.z.strictObject({});
1770
+ var CodingHistoryImportMissingResult = import_zod25.z.strictObject({
1771
+ state: import_zod25.z.enum(["done", "blocked", "cancelled"]),
1735
1772
  blocked: CodingHistoryBlocked.nullable(),
1736
1773
  run: CodingHistoryRun,
1737
1774
  elapsed_ms: nonNegInt
1738
1775
  });
1739
- var CodingHistoryProgressEvent = import_zod24.z.strictObject({
1776
+ var CodingHistoryProgressEvent = import_zod25.z.strictObject({
1740
1777
  request_id: RequestId,
1741
- phase: import_zod24.z.enum(["checking", "importing"]),
1778
+ phase: import_zod25.z.enum(["checking", "importing"]),
1742
1779
  /** Sessions settled so far, of `total` candidates (0 of 0 while checking). */
1743
1780
  done: nonNegInt,
1744
1781
  total: nonNegInt,
@@ -1811,6 +1848,9 @@ var OPS = {
1811
1848
  "power.status": { params: PowerStatusParams, result: PowerStatusResult, kind: "unary", since: "1.4", errors: ["INTERNAL"] },
1812
1849
  "power.prevent_sleep": { params: PowerPreventSleepParams, result: PowerPreventSleepResult, kind: "unary", since: "1.4", errors: ["PERMISSION_DENIED_OS", "PLATFORM_UNSUPPORTED", "INTERNAL"] },
1813
1850
  "resources.snapshot": { params: ResourcesSnapshotParams, result: ResourcesSnapshotResult, kind: "unary", since: "1.4", errors: ["INTERNAL"] },
1851
+ "audio.devices": { params: AudioDevicesParams, result: AudioDevicesResult, kind: "unary", since: "1.6", errors: ["PLATFORM_UNSUPPORTED", "INTERNAL"] },
1852
+ "audio.record": { params: AudioRecordParams, result: AudioRecordResult, kind: "unary", since: "1.6", errors: ["NOT_FOUND", "PERMISSION_DENIED_OS", "PLATFORM_UNSUPPORTED", "RESOURCE_BUSY", "INTERNAL"] },
1853
+ "audio.play": { params: AudioPlayParams, result: AudioPlayResult, kind: "unary", since: "1.6", errors: ["NOT_FOUND", "INVALID_PARAMS", "PLATFORM_UNSUPPORTED", "INTERNAL"] },
1814
1854
  // Claude Code history (SPEC §6 coding): served by the `coding` Python service through SERVICES below.
1815
1855
  "coding.history.import_missing": { params: CodingHistoryImportMissingParams, result: CodingHistoryImportMissingResult, kind: "unary", since: "1.5", errors: ["RESOURCE_BUSY", "RESOURCE_GONE", "CANCELLED", "INTERNAL"] }
1816
1856
  };
@@ -2033,6 +2073,13 @@ var NAMED_SCHEMAS = {
2033
2073
  ResourcesDisk,
2034
2074
  ResourcesSnapshotParams,
2035
2075
  ResourcesSnapshotResult,
2076
+ AudioDevice,
2077
+ AudioDevicesParams,
2078
+ AudioDevicesResult,
2079
+ AudioRecordParams,
2080
+ AudioRecordResult,
2081
+ AudioPlayParams,
2082
+ AudioPlayResult,
2036
2083
  FsWatchId,
2037
2084
  FsWatchStartParams,
2038
2085
  FsWatchStartResult,
@@ -2155,7 +2202,7 @@ function forPeer(op, part, value, version) {
2155
2202
  var VERSIONED_RESULT_OPS = [...RESULT_PATH.keys()];
2156
2203
 
2157
2204
  // src/contract.ts
2158
- var CONTRACT_SHA256 = "c49a85cdd157d6f50e0050e86d4ea789e916c05a0bf16c8002d833b57225548d";
2205
+ var CONTRACT_SHA256 = "2cbf3c7589a30141305f6f0f38c4d4a32bf9ef2a890f7572d9c7bd15c398d4b9";
2159
2206
 
2160
2207
  // src/close-policy.ts
2161
2208
  var CLOSE_RULES = {
@@ -2213,7 +2260,7 @@ var TOOL_CATALOG = [
2213
2260
  { name: "desktop_screen", group: "os_control", state: "built", path: "device_op", ops: ["screen.list", "screen.capture"], platforms: ALL, summary: "Displays and screenshots" },
2214
2261
  { name: "desktop_window", group: "os_control", state: "built", path: "device_op", ops: ["window.list", "window.focus", "window.move", "window.minimize"], platforms: ALL, summary: "Find, focus and arrange windows" },
2215
2262
  { 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" },
2216
- { name: "desktop_audio", group: "os_control", state: "planned", path: "device_op", ops: ["audio.devices", "audio.record", "audio.play"], platforms: ALL, summary: "Audio devices, record, play" },
2263
+ { 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" },
2217
2264
  { name: "desktop_power", group: "os_control", state: "built", path: "device_op", ops: ["power.status", "power.prevent_sleep"], platforms: ALL, summary: "Battery and keep awake" },
2218
2265
  { name: "desktop_resources", group: "os_control", state: "built", path: "device_op", ops: ["resources.snapshot"], platforms: ALL, summary: "CPU, memory and disk use" },
2219
2266
  { 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" },