@ai-matrx/desktop-protocol 0.17.7 → 0.17.9

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
@@ -103,6 +103,7 @@ __export(src_exports, {
103
103
  CLOSE_RULES: () => CLOSE_RULES,
104
104
  CONTRACT_SHA256: () => CONTRACT_SHA256,
105
105
  CancelMsg: () => CancelMsg,
106
+ ChatAppProject: () => ChatAppProject,
106
107
  ChatFamily: () => ChatFamily,
107
108
  ChatHidden: () => ChatHidden,
108
109
  ChatId: () => ChatId,
@@ -406,7 +407,7 @@ module.exports = __toCommonJS(src_exports);
406
407
  // src/schema/primitives.ts
407
408
  var import_zod = require("zod");
408
409
  var PROTOCOL_MAJOR = 1;
409
- var PROTOCOL_MINOR = 11;
410
+ var PROTOCOL_MINOR = 13;
410
411
  var PROTOCOL_VERSION = `${PROTOCOL_MAJOR}.${PROTOCOL_MINOR}`;
411
412
  var ProtocolVersion = import_zod.z.string().regex(/^[1-9][0-9]{0,2}\.[0-9]{1,3}$/);
412
413
  var RequestId = import_zod.z.string().min(1).max(64).regex(/^[A-Za-z0-9_-]+$/);
@@ -1341,6 +1342,10 @@ var ChatLastUse = import_zod12.z.strictObject({
1341
1342
  cache_warm: import_zod12.z.boolean(),
1342
1343
  cache_minutes_left: nonNegInt
1343
1344
  });
1345
+ var ChatAppProject = import_zod12.z.strictObject({
1346
+ id: import_zod12.z.string().min(1).max(200),
1347
+ name: import_zod12.z.string().max(200)
1348
+ });
1344
1349
  var ChatRow = import_zod12.z.strictObject({
1345
1350
  id: ChatId,
1346
1351
  /** The short id people see (the listing's first 8 characters). */
@@ -1367,7 +1372,11 @@ var ChatRow = import_zod12.z.strictObject({
1367
1372
  /** Created recently and in no project: offered for filing. */
1368
1373
  new_unfiled: import_zod12.z.boolean(),
1369
1374
  warnings: import_zod12.z.array(import_zod12.z.string().max(400)).max(20),
1370
- last_use: ChatLastUse.nullable()
1375
+ last_use: ChatLastUse.nullable(),
1376
+ /** 1.13: the app's own project the chat is grouped under in the app (Codex), read only; absent = none or not an app that groups. */
1377
+ app_project: ChatAppProject.optional(),
1378
+ /** 1.13: tokens the conversation has used, when the app records it (Codex); absent when not recorded; prices are not on disk. */
1379
+ tokens: nonNegInt.optional()
1371
1380
  });
1372
1381
  var ChatFamily = import_zod12.z.strictObject({
1373
1382
  id: ChatId,
@@ -1490,7 +1499,11 @@ var AccountUsage = import_zod13.z.strictObject({
1490
1499
  /** The next weekly reset, when known. */
1491
1500
  weekly_resets_at_ms: epochMs.nullable(),
1492
1501
  /** That reset time is Claude's own (its reading, or a reset seen in its usage history). */
1493
- weekly_reset_official: import_zod13.z.boolean().nullable()
1502
+ weekly_reset_official: import_zod13.z.boolean().nullable(),
1503
+ /** 1.13: the account's plan as the app names it (Codex: "pro", "prolite"), when recorded. */
1504
+ plan: import_zod13.z.string().max(80).optional(),
1505
+ /** 1.13: the account's credit balance as the app records it (Codex), when recorded. */
1506
+ credits: import_zod13.z.string().max(40).optional()
1494
1507
  });
1495
1508
  var AccountReset = import_zod13.z.strictObject({
1496
1509
  window: ChatPlace,
@@ -1506,9 +1519,19 @@ var AccountReset = import_zod13.z.strictObject({
1506
1519
  var AppsWindowsListParams = import_zod13.z.strictObject({ app_key: AppKey });
1507
1520
  var AppsWindowsListResult = import_zod13.z.strictObject({ app_key: AppKey, windows: import_zod13.z.array(AppWindowInfo).max(200) });
1508
1521
  var AppsAccountsUsageParams = import_zod13.z.strictObject({ app_key: AppKey });
1509
- var AppsAccountsUsageResult = import_zod13.z.strictObject({ app_key: AppKey, accounts: import_zod13.z.array(AccountUsage).max(500) });
1522
+ var AppsAccountsUsageResult = import_zod13.z.strictObject({
1523
+ app_key: AppKey,
1524
+ accounts: import_zod13.z.array(AccountUsage).max(500),
1525
+ /** 1.12: the rows are right but something around them failed (a newly read reset time could not be saved); shown, never hidden. */
1526
+ problem: import_zod13.z.string().max(400).optional()
1527
+ });
1510
1528
  var AppsAccountsResetsParams = import_zod13.z.strictObject({ app_key: AppKey });
1511
- var AppsAccountsResetsResult = import_zod13.z.strictObject({ app_key: AppKey, resets: import_zod13.z.array(AccountReset).max(200) });
1529
+ var AppsAccountsResetsResult = import_zod13.z.strictObject({
1530
+ app_key: AppKey,
1531
+ resets: import_zod13.z.array(AccountReset).max(200),
1532
+ /** 1.12: as on `apps.accounts.usage`. */
1533
+ problem: import_zod13.z.string().max(400).optional()
1534
+ });
1512
1535
  var AppsWindowActionResult = import_zod13.z.strictObject({ message: import_zod13.z.string().max(400) });
1513
1536
  var AppsWindowsOpenParams = import_zod13.z.strictObject({ app_key: AppKey, window: ChatPlace });
1514
1537
  var AppsWindowsReloadParams = import_zod13.z.strictObject({ app_key: AppKey, window: ChatPlace });
@@ -2591,6 +2614,7 @@ var NAMED_SCHEMAS = {
2591
2614
  ChatRunning,
2592
2615
  ChatHidden,
2593
2616
  ChatLastUse,
2617
+ ChatAppProject,
2594
2618
  ChatRow,
2595
2619
  AppsChatsListParams,
2596
2620
  AppsChatsListResult,
@@ -2665,7 +2689,11 @@ var FIELDS_SINCE = {
2665
2689
  "RelayCallResponse|0": { protocol_version: "1.1" },
2666
2690
  "RelayCallResponse|1": { protocol_version: "1.1" },
2667
2691
  WindowInfo: { app: "1.7", pid: "1.7" },
2668
- AppsChatsListResult: { updating: "1.9", live: "1.9", families: "1.10" }
2692
+ AppsChatsListResult: { updating: "1.9", live: "1.9", families: "1.10" },
2693
+ AppsAccountsUsageResult: { problem: "1.12" },
2694
+ AppsAccountsResetsResult: { problem: "1.12" },
2695
+ ChatRow: { app_project: "1.13", tokens: "1.13" },
2696
+ AccountUsage: { plan: "1.13", credits: "1.13" }
2669
2697
  };
2670
2698
  var NULL_SINCE = {
2671
2699
  "RelayDeviceStatusEvent.since_ms": { since: "1.1", olderPeersGet: 0 }
@@ -2720,8 +2748,37 @@ function strip(value, fields, version) {
2720
2748
  }
2721
2749
  var RESULT_PATH = /* @__PURE__ */ new Map([
2722
2750
  ["fs.patch", "FsPatchResult"],
2723
- ["apps.chats.list", "AppsChatsListResult"]
2751
+ ["apps.chats.list", "AppsChatsListResult"],
2752
+ ["apps.accounts.usage", "AppsAccountsUsageResult"],
2753
+ ["apps.accounts.resets", "AppsAccountsResetsResult"]
2724
2754
  ]);
2755
+ var NESTED_RESULTS = /* @__PURE__ */ new Map([
2756
+ ["apps.chats.list", [["chats", "ChatRow"]]],
2757
+ ["apps.projects.file", [["chat", "ChatRow"]]],
2758
+ ["apps.projects.file_many", [["chats", "ChatRow"]]],
2759
+ ["apps.projects.unfile", [["chat", "ChatRow"]]],
2760
+ ["apps.projects.move", [["chat", "ChatRow"]]],
2761
+ ["apps.chats.star", [["chat", "ChatRow"]]],
2762
+ ["apps.chats.place", [["chat", "ChatRow"]]],
2763
+ ["apps.accounts.usage", [["accounts", "AccountUsage"]]]
2764
+ ]);
2765
+ function stripNested(value, nested, version) {
2766
+ if (value === null || typeof value !== "object" || Array.isArray(value)) return value;
2767
+ let body = value;
2768
+ for (const [key, path] of nested) {
2769
+ const inner = body[key];
2770
+ if (inner === void 0 || inner === null) continue;
2771
+ const fields = FIELDS_SINCE[path];
2772
+ if (Array.isArray(inner)) {
2773
+ const next = inner.map((x) => strip(x, fields, version));
2774
+ if (next.some((x, i) => x !== inner[i])) body = { ...body, [key]: next };
2775
+ } else {
2776
+ const next = strip(inner, fields, version);
2777
+ if (next !== inner) body = { ...body, [key]: next };
2778
+ }
2779
+ }
2780
+ return body;
2781
+ }
2725
2782
  var WINDOW_RESULTS = /* @__PURE__ */ new Map([
2726
2783
  ["window.list", "windows"],
2727
2784
  ["window.focus", "window"],
@@ -2745,7 +2802,9 @@ function forPeer(op, part, value, version) {
2745
2802
  const windowKey = op ? WINDOW_RESULTS.get(op) : void 0;
2746
2803
  if (windowKey) return stripWindows(value, windowKey, version);
2747
2804
  const path = op ? RESULT_PATH.get(op) : void 0;
2748
- return path ? strip(value, FIELDS_SINCE[path], version) : value;
2805
+ const top = path ? strip(value, FIELDS_SINCE[path], version) : value;
2806
+ const nested = op ? NESTED_RESULTS.get(op) : void 0;
2807
+ return nested ? stripNested(top, nested, version) : top;
2749
2808
  }
2750
2809
  if (value === null || typeof value !== "object") return value;
2751
2810
  const body = value;
@@ -2759,10 +2818,10 @@ function forPeer(op, part, value, version) {
2759
2818
  }
2760
2819
  return data === body.data ? value : { ...body, data };
2761
2820
  }
2762
- var VERSIONED_RESULT_OPS = [...RESULT_PATH.keys(), ...WINDOW_RESULTS.keys()];
2821
+ var VERSIONED_RESULT_OPS = [.../* @__PURE__ */ new Set([...RESULT_PATH.keys(), ...WINDOW_RESULTS.keys(), ...NESTED_RESULTS.keys()])];
2763
2822
 
2764
2823
  // src/contract.ts
2765
- var CONTRACT_SHA256 = "de809e319141925b0d86c5acbfe2493f3a85cad7c668c3e20b082e9319f5199b";
2824
+ var CONTRACT_SHA256 = "753a2852af693308e321d475e3cab2487f6ab96b2c19bbc2fc5525ad3c26bb55";
2766
2825
 
2767
2826
  // src/close-policy.ts
2768
2827
  var CLOSE_RULES = {