@ai-matrx/desktop-protocol 0.21.45 → 0.21.47

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.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import { z } from "zod";
3
3
  import { UUID_SHAPE_PATTERN } from "@ai-matrx/kit/uuid";
4
4
  var PROTOCOL_MAJOR = 1;
5
- var PROTOCOL_MINOR = 49;
5
+ var PROTOCOL_MINOR = 52;
6
6
  var PROTOCOL_VERSION = `${PROTOCOL_MAJOR}.${PROTOCOL_MINOR}`;
7
7
  var ProtocolVersion = z.string().regex(/^[1-9][0-9]{0,2}\.[0-9]{1,3}$/);
8
8
  var RequestId = z.string().min(1).max(64).regex(/^[A-Za-z0-9_-]+$/);
@@ -1421,6 +1421,23 @@ var AppsChatsStarResult = z13.strictObject({ chat: ChatRow });
1421
1421
 
1422
1422
  // src/schema/apps-accounts.ts
1423
1423
  import { z as z14 } from "zod";
1424
+ var WindowRemoteControl = z14.strictObject({
1425
+ /**
1426
+ * As the window's settings file holds it: on, off, or never set (the app's default). 1.52:
1427
+ * "unreadable" = the file is there but damaged, so the setting is not known (`problem` says why).
1428
+ */
1429
+ setting: z14.enum(["on", "off", "default", "unreadable"]),
1430
+ /** The window serves Remote Control now (its live state says "on"); null: not known (closed, or no state file). */
1431
+ serving: z14.boolean().nullable(),
1432
+ /** A change queued until the window next closes (or restarts); null: none. */
1433
+ pending: z14.enum(["on", "off"]).nullable(),
1434
+ /**
1435
+ * 1.52: why the setting cannot be trusted, as a plain sentence for the person: the settings file is
1436
+ * damaged ("unreadable"), or a queued change failed to land (it stays queued; asking again retries).
1437
+ * Absent: nothing wrong. An older core omits it.
1438
+ */
1439
+ problem: z14.string().max(300).optional()
1440
+ });
1424
1441
  var AppWindowInfo = z14.strictObject({
1425
1442
  key: ChatPlace,
1426
1443
  /** The app's default profile (Claude: main, which may sign into any account). */
@@ -1437,7 +1454,9 @@ var AppWindowInfo = z14.strictObject({
1437
1454
  /** Open now. */
1438
1455
  running: z14.boolean(),
1439
1456
  /** Chats open in it now (a process resuming each one). */
1440
- open_chats: nonNegInt
1457
+ open_chats: nonNegInt,
1458
+ /** 1.50: its Remote Control (phone) setting; absent from an older core, or an app without one. */
1459
+ remote_control: WindowRemoteControl.optional()
1441
1460
  });
1442
1461
  var AccountUsage = z14.strictObject({
1443
1462
  /** The account's email, or "org <8 chars>" when no window has ever sampled that org. */
@@ -1517,6 +1536,13 @@ var AppsWindowsShownResult = z14.strictObject({
1517
1536
  sections: z14.array(ShownSection).max(200),
1518
1537
  problem: z14.string().max(400).nullable()
1519
1538
  });
1539
+ var AppsWindowsSetRemoteControlParams = z14.strictObject({ app_key: AppKey, window: ChatPlace, enabled: z14.boolean() });
1540
+ var AppsWindowsSetRemoteControlResult = z14.strictObject({
1541
+ message: z14.string().max(400),
1542
+ /** "now" = written into the closed window; "next_close" = queued until it closes. */
1543
+ when: z14.enum(["now", "next_close"]),
1544
+ remote_control: WindowRemoteControl
1545
+ });
1520
1546
  var AppsWindowsRestartParams = z14.strictObject({ app_key: AppKey, window: ChatPlace, force: z14.boolean().default(false) });
1521
1547
  var AppsWindowsRefreshUsageParams = z14.strictObject({ app_key: AppKey, window: ChatPlace });
1522
1548
  var AppsProjectsMoveParams = z14.strictObject({
@@ -1860,19 +1886,23 @@ var AppAccount = z15.strictObject({
1860
1886
  last_seen_ms: epochMs.nullable(),
1861
1887
  missing: z15.array(AccountGap).max(3)
1862
1888
  });
1863
- var AppsInstancesListParams = z15.strictObject({ app_key: AppKey });
1889
+ var AppsInstancesListParams = z15.strictObject({ app_key: AppKey, fresh: z15.boolean().optional() });
1864
1890
  var AppsInstancesListResult = z15.strictObject({
1865
1891
  app_key: AppKey,
1866
1892
  install: AppInstall.nullable(),
1867
1893
  instances: z15.array(AppInstance).max(200),
1868
1894
  /** The rows are right but something around them failed; shown, never hidden. */
1869
- problem: z15.string().max(400).optional()
1895
+ problem: z15.string().max(400).optional(),
1896
+ as_of_ms: epochMs.optional(),
1897
+ refreshing: z15.boolean().optional()
1870
1898
  });
1871
- var AppsAccountsListParams = z15.strictObject({ app_key: AppKey });
1899
+ var AppsAccountsListParams = z15.strictObject({ app_key: AppKey, fresh: z15.boolean().optional() });
1872
1900
  var AppsAccountsListResult = z15.strictObject({
1873
1901
  app_key: AppKey,
1874
1902
  accounts: z15.array(AppAccount).max(500),
1875
- problem: z15.string().max(400).optional()
1903
+ problem: z15.string().max(400).optional(),
1904
+ as_of_ms: epochMs.optional(),
1905
+ refreshing: z15.boolean().optional()
1876
1906
  });
1877
1907
 
1878
1908
  // src/schema/service.ts
@@ -4389,6 +4419,8 @@ var OPS = {
4389
4419
  "apps.windows.open": { params: AppsWindowsOpenParams, result: AppsWindowActionResult, kind: "unary", since: "1.10", errors: ["NOT_FOUND", "PLATFORM_UNSUPPORTED", "INTERNAL"] },
4390
4420
  "apps.windows.reload": { params: AppsWindowsReloadParams, result: AppsWindowActionResult, kind: "unary", since: "1.10", errors: ["NOT_FOUND", "CONFLICT", "PERMISSION_DENIED_OS", "PLATFORM_UNSUPPORTED", "INTERNAL"] },
4391
4421
  "apps.windows.restart": { params: AppsWindowsRestartParams, result: AppsWindowActionResult, kind: "unary", since: "1.10", errors: ["NOT_FOUND", "CONFLICT", "TIMEOUT", "PLATFORM_UNSUPPORTED", "INTERNAL"] },
4422
+ // 1.50: a window's Remote Control (phone) setting, written while closed or queued for its next close.
4423
+ "apps.windows.set_remote_control": { params: AppsWindowsSetRemoteControlParams, result: AppsWindowsSetRemoteControlResult, kind: "unary", since: "1.50", errors: ["NOT_FOUND", "CONFLICT", "PLATFORM_UNSUPPORTED", "INTERNAL"] },
4392
4424
  "apps.windows.refresh_usage": { params: AppsWindowsRefreshUsageParams, result: AppsWindowActionResult, kind: "unary", since: "1.10", errors: ["NOT_FOUND", "TIMEOUT", "PLATFORM_UNSUPPORTED", "INTERNAL"] },
4393
4425
  "apps.accounts.usage": { params: AppsAccountsUsageParams, result: AppsAccountsUsageResult, kind: "unary", since: "1.10", errors: ["NOT_FOUND", "PLATFORM_UNSUPPORTED", "INTERNAL"] },
4394
4426
  "apps.accounts.resets": { params: AppsAccountsResetsParams, result: AppsAccountsResetsResult, kind: "unary", since: "1.10", errors: ["NOT_FOUND", "PLATFORM_UNSUPPORTED", "INTERNAL"] },
@@ -5109,6 +5141,9 @@ var NAMED_SCHEMAS = {
5109
5141
  AppsProjectsCopyResult,
5110
5142
  ChatFamily,
5111
5143
  AppWindowInfo,
5144
+ WindowRemoteControl,
5145
+ AppsWindowsSetRemoteControlParams,
5146
+ AppsWindowsSetRemoteControlResult,
5112
5147
  AccountUsage,
5113
5148
  AccountReset,
5114
5149
  AppsWindowsListParams,
@@ -5445,6 +5480,12 @@ var FIELDS_SINCE = {
5445
5480
  "RelayCallResponse|0": { protocol_version: "1.1" },
5446
5481
  "RelayCallResponse|1": { protocol_version: "1.1" },
5447
5482
  WindowInfo: { app: "1.7", pid: "1.7" },
5483
+ AppWindowInfo: { remote_control: "1.50" },
5484
+ WindowRemoteControl: { problem: "1.52" },
5485
+ AppsInstancesListParams: { fresh: "1.51" },
5486
+ AppsInstancesListResult: { as_of_ms: "1.51", refreshing: "1.51" },
5487
+ AppsAccountsListParams: { fresh: "1.51" },
5488
+ AppsAccountsListResult: { as_of_ms: "1.51", refreshing: "1.51" },
5448
5489
  AppsChatsListResult: { updating: "1.9", live: "1.9", families: "1.10" },
5449
5490
  AppsAccountsUsageResult: { problem: "1.12" },
5450
5491
  AppsAccountsResetsResult: { problem: "1.12" },
@@ -5574,7 +5615,9 @@ var NESTED_RESULTS = /* @__PURE__ */ new Map([
5574
5615
  ["web.scrape", [["pages", "WebScrapePage"]]],
5575
5616
  ["sysinfo.get", [["permissions", "SysinfoGetResult.permissions[]"]]],
5576
5617
  ["models.downloads.list", [["downloads", "DownloadRow"]]],
5577
- ["apps.projects.to_window", [["group", "ProjectMoveGroup"]]]
5618
+ ["apps.projects.to_window", [["group", "ProjectMoveGroup"]]],
5619
+ ["apps.windows.list", [["windows", "AppWindowInfo"]]],
5620
+ ["apps.windows.set_remote_control", [["remote_control", "WindowRemoteControl"]]]
5578
5621
  ]);
5579
5622
  function stripNested(value, nested, version) {
5580
5623
  if (value === null || typeof value !== "object" || Array.isArray(value)) return value;
@@ -5593,6 +5636,23 @@ function stripNested(value, nested, version) {
5593
5636
  }
5594
5637
  return body;
5595
5638
  }
5639
+ function windowListRemoteControlForPeer(value, version) {
5640
+ if (knows(version, "1.52") || value === null || typeof value !== "object") return value;
5641
+ const body = value;
5642
+ if (!Array.isArray(body.windows)) return value;
5643
+ const windows = body.windows;
5644
+ const next = windows.map((w) => {
5645
+ const rc = w?.remote_control;
5646
+ if (rc === null || typeof rc !== "object") return w;
5647
+ if (rc.setting === "unreadable") {
5648
+ const { remote_control: _dropped, ...rest } = w;
5649
+ return rest;
5650
+ }
5651
+ const kept = strip(rc, FIELDS_SINCE.WindowRemoteControl, version);
5652
+ return kept === rc ? w : { ...w, remote_control: kept };
5653
+ });
5654
+ return next.some((w, i) => w !== windows[i]) ? { ...body, windows: next } : value;
5655
+ }
5596
5656
  var WINDOW_RESULTS = /* @__PURE__ */ new Map([
5597
5657
  ["window.list", "windows"],
5598
5658
  ["window.focus", "window"],
@@ -5619,7 +5679,8 @@ function forPeer(op, part, value, version) {
5619
5679
  const known = op === "sysinfo.get" ? permissionsForPeer(value, version) : value;
5620
5680
  const top = path ? strip(known, FIELDS_SINCE[path], version) : known;
5621
5681
  const nested = op ? NESTED_RESULTS.get(op) : void 0;
5622
- return nested ? stripNested(top, nested, version) : top;
5682
+ const stripped = nested ? stripNested(top, nested, version) : top;
5683
+ return op === "apps.windows.list" ? windowListRemoteControlForPeer(stripped, version) : stripped;
5623
5684
  }
5624
5685
  if (value === null || typeof value !== "object") return value;
5625
5686
  const body = value;
@@ -5636,7 +5697,7 @@ function forPeer(op, part, value, version) {
5636
5697
  var VERSIONED_RESULT_OPS = [.../* @__PURE__ */ new Set([...RESULT_PATH.keys(), ...WINDOW_RESULTS.keys(), ...NESTED_RESULTS.keys()])];
5637
5698
 
5638
5699
  // src/contract.ts
5639
- var CONTRACT_SHA256 = "ac576512b0292490d7aa8b1561ccbf2dde677d94150c52d473f58b0d381ba150";
5700
+ var CONTRACT_SHA256 = "e9eba8289b9f07b90d920f5a44b038473fae8597e5b43c1f37a2bbda391edcbd";
5640
5701
 
5641
5702
  // src/close-policy.ts
5642
5703
  var CLOSE_RULES = {
@@ -6142,6 +6203,8 @@ export {
6142
6203
  AppsWindowsReopenResult,
6143
6204
  AppsWindowsRestartParams,
6144
6205
  AppsWindowsSaveNamesParams,
6206
+ AppsWindowsSetRemoteControlParams,
6207
+ AppsWindowsSetRemoteControlResult,
6145
6208
  AppsWindowsShownParams,
6146
6209
  AppsWindowsShownResult,
6147
6210
  AppsWindowsUpdateAndReopenParams,
@@ -6845,6 +6908,7 @@ export {
6845
6908
  WindowMinimizeResult,
6846
6909
  WindowMoveParams,
6847
6910
  WindowMoveResult,
6911
+ WindowRemoteControl,
6848
6912
  WindowsEvent,
6849
6913
  WindowsEventLogParams,
6850
6914
  WindowsEventLogResult,