@ai-matrx/desktop-protocol 0.17.8 → 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 = 12;
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,
@@ -2601,6 +2614,7 @@ var NAMED_SCHEMAS = {
2601
2614
  ChatRunning,
2602
2615
  ChatHidden,
2603
2616
  ChatLastUse,
2617
+ ChatAppProject,
2604
2618
  ChatRow,
2605
2619
  AppsChatsListParams,
2606
2620
  AppsChatsListResult,
@@ -2677,7 +2691,9 @@ var FIELDS_SINCE = {
2677
2691
  WindowInfo: { app: "1.7", pid: "1.7" },
2678
2692
  AppsChatsListResult: { updating: "1.9", live: "1.9", families: "1.10" },
2679
2693
  AppsAccountsUsageResult: { problem: "1.12" },
2680
- AppsAccountsResetsResult: { 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" }
2681
2697
  };
2682
2698
  var NULL_SINCE = {
2683
2699
  "RelayDeviceStatusEvent.since_ms": { since: "1.1", olderPeersGet: 0 }
@@ -2736,6 +2752,33 @@ var RESULT_PATH = /* @__PURE__ */ new Map([
2736
2752
  ["apps.accounts.usage", "AppsAccountsUsageResult"],
2737
2753
  ["apps.accounts.resets", "AppsAccountsResetsResult"]
2738
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
+ }
2739
2782
  var WINDOW_RESULTS = /* @__PURE__ */ new Map([
2740
2783
  ["window.list", "windows"],
2741
2784
  ["window.focus", "window"],
@@ -2759,7 +2802,9 @@ function forPeer(op, part, value, version) {
2759
2802
  const windowKey = op ? WINDOW_RESULTS.get(op) : void 0;
2760
2803
  if (windowKey) return stripWindows(value, windowKey, version);
2761
2804
  const path = op ? RESULT_PATH.get(op) : void 0;
2762
- 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;
2763
2808
  }
2764
2809
  if (value === null || typeof value !== "object") return value;
2765
2810
  const body = value;
@@ -2773,10 +2818,10 @@ function forPeer(op, part, value, version) {
2773
2818
  }
2774
2819
  return data === body.data ? value : { ...body, data };
2775
2820
  }
2776
- 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()])];
2777
2822
 
2778
2823
  // src/contract.ts
2779
- var CONTRACT_SHA256 = "179024ee4b3dc7123af1db44f8ce0fb9da7b392eed30a2a2b5bb312da3522bb0";
2824
+ var CONTRACT_SHA256 = "753a2852af693308e321d475e3cab2487f6ab96b2c19bbc2fc5525ad3c26bb55";
2780
2825
 
2781
2826
  // src/close-policy.ts
2782
2827
  var CLOSE_RULES = {