@ai-matrx/desktop-protocol 0.21.26 → 0.21.28

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 = 32;
5
+ var PROTOCOL_MINOR = 33;
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_-]+$/);
@@ -1454,6 +1454,12 @@ var TitleMismatch = z14.strictObject({
1454
1454
  windows: z14.array(ChatPlace).max(200),
1455
1455
  differs_in: z14.array(TitleCopies).max(200)
1456
1456
  });
1457
+ var StaleTitleWindow = z14.strictObject({
1458
+ window: ChatPlace,
1459
+ /** First and latest time (ms) it was seen writing an old name back. */
1460
+ since_ms: nonNegInt,
1461
+ last_ms: nonNegInt
1462
+ });
1457
1463
  var AppsChatsTitlesCheckParams = z14.strictObject({ app_key: AppKey });
1458
1464
  var AppsChatsTitlesCheckResult = z14.strictObject({
1459
1465
  app_key: AppKey,
@@ -1462,7 +1468,9 @@ var AppsChatsTitlesCheckResult = z14.strictObject({
1462
1468
  /** Chats with a different name in some window (or in Matrx). */
1463
1469
  chats_with_a_different_name: nonNegInt,
1464
1470
  copies_to_write: nonNegInt,
1465
- chats: z14.array(TitleMismatch).max(5e3)
1471
+ chats: z14.array(TitleMismatch).max(5e3),
1472
+ /** Windows that keep writing old names back (each is fixed every pass; reloading it, Cmd+R, stops it). Since 1.33. */
1473
+ stale_windows: z14.array(StaleTitleWindow).max(200).optional()
1466
1474
  });
1467
1475
  var AppsChatsTitlesPushParams = z14.strictObject({ app_key: AppKey, chat_id: ChatId.optional(), dry_run: z14.boolean().optional() });
1468
1476
  var AppsChatsTitlesPushResult = z14.strictObject({
@@ -3361,6 +3369,7 @@ var NAMED_SCHEMAS = {
3361
3369
  AppsChatsOpenParams,
3362
3370
  TitleCopies,
3363
3371
  TitleMismatch,
3372
+ StaleTitleWindow,
3364
3373
  AppsChatsTitlesCheckParams,
3365
3374
  AppsChatsTitlesCheckResult,
3366
3375
  AppsChatsTitlesPushParams,
@@ -3486,7 +3495,8 @@ var FIELDS_SINCE = {
3486
3495
  AppsSpendResult: { days: "1.24" },
3487
3496
  AppsWindowsUpdateStateResult: { closed_by_update: "1.27" },
3488
3497
  AppsProjectsToWindowParams: { pin: "1.32" },
3489
- AppsProjectsToWindowResult: { pin: "1.32" }
3498
+ AppsProjectsToWindowResult: { pin: "1.32" },
3499
+ AppsChatsTitlesCheckResult: { stale_windows: "1.33" }
3490
3500
  };
3491
3501
  var NULL_SINCE = {
3492
3502
  "RelayDeviceStatusEvent.since_ms": { since: "1.1", olderPeersGet: 0 }
@@ -3622,7 +3632,7 @@ function forPeer(op, part, value, version) {
3622
3632
  var VERSIONED_RESULT_OPS = [.../* @__PURE__ */ new Set([...RESULT_PATH.keys(), ...WINDOW_RESULTS.keys(), ...NESTED_RESULTS.keys()])];
3623
3633
 
3624
3634
  // src/contract.ts
3625
- var CONTRACT_SHA256 = "ee8e6c98c76f3557f832157e3b2b21bb23ebb74b67b79151f3b9ff788f5273ee";
3635
+ var CONTRACT_SHA256 = "04a029fc56c9405f376906fc981659997f4617c98bd0b88bb052d1f6d587a7a2";
3626
3636
 
3627
3637
  // src/close-policy.ts
3628
3638
  var CLOSE_RULES = {
@@ -3679,6 +3689,7 @@ var TOOL_CATALOG = [
3679
3689
  { name: "desktop_system", group: "os_control", state: "built", path: "device_op", ops: ["sysinfo.get", "sysinfo.hardware", "system.open_url", "system.open_path", "system.open_settings", "system.notify"], platforms: ALL, summary: "System facts, open, notify" },
3680
3690
  { name: "desktop_clipboard", group: "os_control", state: "built", path: "device_op", ops: ["clipboard.read", "clipboard.write"], platforms: ALL, summary: "Read and write the clipboard's text" },
3681
3691
  { name: "desktop_screen", group: "os_control", state: "built", path: "device_op", ops: ["screen.list", "screen.capture"], platforms: ALL, summary: "Displays and screenshots" },
3692
+ { name: "desktop_browser", group: "os_control", state: "built", path: "device_op", ops: ["browser.sessions", "browser.call"], platforms: ALL, summary: "The person's own browser through the AI Matrx extension: tabs, read, screenshot, navigate, click, type" },
3682
3693
  { 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" },
3683
3694
  { name: "desktop_input", group: "os_control", state: "built", path: "device_op", ops: ["input.type_text", "input.hotkey", "input.mouse_click", "input.mouse_move", "input.keyboard_settings", "input.set_keyboard_settings"], platforms: ALL, summary: "Keyboard and mouse" },
3684
3695
  { name: "desktop_audio", group: "os_control", state: "built", path: "device_op", ops: ["audio.devices", "audio.levels", "audio.set_levels", "audio.record", "audio.play"], platforms: ALL, summary: "Audio devices, record, play" },
@@ -3761,14 +3772,15 @@ var LEGACY_ACTIONS = {
3761
3772
  "local_system.open_url": tool("desktop_system"),
3762
3773
  "local_system.open_path": tool("desktop_system"),
3763
3774
  "local_system.notify": tool("desktop_system"),
3764
- "local_browser.navigate": dropped("The browser agent is the extension (matrx-extend) and the cloud browser; a second Playwright on the device duplicates it"),
3765
- "local_browser.click": dropped("The browser agent is the extension (matrx-extend) and the cloud browser"),
3766
- "local_browser.type_text": dropped("The browser agent is the extension (matrx-extend) and the cloud browser"),
3767
- "local_browser.extract": dropped("The browser agent is the extension (matrx-extend) and the cloud browser"),
3768
- "local_browser.screenshot": dropped("The browser agent is the extension (matrx-extend) and the cloud browser"),
3769
- "local_browser.eval": dropped("The browser agent is the extension (matrx-extend) and the cloud browser"),
3770
- "local_browser.tabs": dropped("The browser agent is the extension (matrx-extend) and the cloud browser"),
3771
- "local_browser.close": dropped("The browser agent is the extension (matrx-extend) and the cloud browser"),
3775
+ // The person's own browser is the AI Matrx extension paired with Matrx 2 (cap browser).
3776
+ "local_browser.navigate": tool("desktop_browser"),
3777
+ "local_browser.click": tool("desktop_browser"),
3778
+ "local_browser.type_text": tool("desktop_browser"),
3779
+ "local_browser.extract": tool("desktop_browser"),
3780
+ "local_browser.screenshot": tool("desktop_browser"),
3781
+ "local_browser.eval": dropped("The extension runs no page script for Matrx 2: its script and cdp tools are privileged and refused over the desktop path; read, click and type cover what eval was used for"),
3782
+ "local_browser.tabs": tool("desktop_browser"),
3783
+ "local_browser.close": tool("desktop_browser"),
3772
3784
  "local_web.fetch": tool("desktop_web"),
3773
3785
  "local_web.fetch_with_browser": tool("desktop_web"),
3774
3786
  "local_web.scrape": tool("desktop_web"),
@@ -3964,6 +3976,29 @@ function renderToolStatusMarkdown(status) {
3964
3976
  }
3965
3977
  return lines.join("\n");
3966
3978
  }
3979
+
3980
+ // src/tools/policy.ts
3981
+ function refusedOps(disabledTools) {
3982
+ const off = new Set(disabledTools);
3983
+ const senders = /* @__PURE__ */ new Map();
3984
+ for (const tool2 of TOOL_CATALOG) for (const op of tool2.ops) senders.set(op, [...senders.get(op) ?? [], tool2.name]);
3985
+ const refused = /* @__PURE__ */ new Set();
3986
+ for (const [op, tools] of senders) if (tools.every((t) => off.has(t))) refused.add(op);
3987
+ return refused;
3988
+ }
3989
+ function toolsSending(op) {
3990
+ return TOOL_CATALOG.filter((t) => t.ops.includes(op)).map((t) => t.name);
3991
+ }
3992
+ function sharedOpsBlocking(tool2, disabledTools) {
3993
+ const entry = TOOL_CATALOG.find((t) => t.name === tool2);
3994
+ if (!entry || entry.ops.length === 0) return [];
3995
+ const off = /* @__PURE__ */ new Set([...disabledTools, tool2]);
3996
+ const refused = refusedOps([...off]);
3997
+ if (entry.ops.some((op) => refused.has(op))) return [];
3998
+ const keepers = /* @__PURE__ */ new Set();
3999
+ for (const op of entry.ops) for (const other of TOOL_CATALOG) if (other.name !== tool2 && !off.has(other.name) && other.ops.includes(op)) keepers.add(other.name);
4000
+ return [...keepers].sort();
4001
+ }
3967
4002
  export {
3968
4003
  AbsPath,
3969
4004
  AccountAgent,
@@ -4430,6 +4465,7 @@ export {
4430
4465
  StackStateResult,
4431
4466
  StackStopParams,
4432
4467
  StackTone,
4468
+ StaleTitleWindow,
4433
4469
  StreamMeta,
4434
4470
  StreamMsg,
4435
4471
  SysinfoGetParams,
@@ -4511,9 +4547,12 @@ export {
4511
4547
  negotiate,
4512
4548
  nonNegInt,
4513
4549
  readCid,
4550
+ refusedOps,
4514
4551
  renderToolStatusMarkdown,
4552
+ sharedOpsBlocking,
4515
4553
  stampCid,
4516
4554
  statusForPeer,
4555
+ toolsSending,
4517
4556
  u32,
4518
4557
  versionSubprotocol
4519
4558
  };