@ai-matrx/desktop-protocol 0.17.8 → 0.17.10

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 = 14;
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,20 @@ 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(),
1380
+ /**
1381
+ * 1.14: the chat's own title before the person's rename (the one title rule, `@ai-matrx/coding-sessions/sessions`);
1382
+ * `title` is what to show (`title_override` when set, else this).
1383
+ */
1384
+ original_title: import_zod12.z.string().max(1e3).optional(),
1385
+ /** 1.14: where `original_title` came from (app record, remembered, custom-title, ai-title, agent-name, summary, first-prompt, last-prompt). */
1386
+ title_source: import_zod12.z.string().min(1).max(40).optional(),
1387
+ /** 1.14: the person's rename inside Matrx (Coding Sessions), applied once by the row builder; absent = none. */
1388
+ title_override: import_zod12.z.string().min(1).max(300).optional()
1371
1389
  });
1372
1390
  var ChatFamily = import_zod12.z.strictObject({
1373
1391
  id: ChatId,
@@ -1490,7 +1508,11 @@ var AccountUsage = import_zod13.z.strictObject({
1490
1508
  /** The next weekly reset, when known. */
1491
1509
  weekly_resets_at_ms: epochMs.nullable(),
1492
1510
  /** 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()
1511
+ weekly_reset_official: import_zod13.z.boolean().nullable(),
1512
+ /** 1.13: the account's plan as the app names it (Codex: "pro", "prolite"), when recorded. */
1513
+ plan: import_zod13.z.string().max(80).optional(),
1514
+ /** 1.13: the account's credit balance as the app records it (Codex), when recorded. */
1515
+ credits: import_zod13.z.string().max(40).optional()
1494
1516
  });
1495
1517
  var AccountReset = import_zod13.z.strictObject({
1496
1518
  window: ChatPlace,
@@ -2601,6 +2623,7 @@ var NAMED_SCHEMAS = {
2601
2623
  ChatRunning,
2602
2624
  ChatHidden,
2603
2625
  ChatLastUse,
2626
+ ChatAppProject,
2604
2627
  ChatRow,
2605
2628
  AppsChatsListParams,
2606
2629
  AppsChatsListResult,
@@ -2677,7 +2700,9 @@ var FIELDS_SINCE = {
2677
2700
  WindowInfo: { app: "1.7", pid: "1.7" },
2678
2701
  AppsChatsListResult: { updating: "1.9", live: "1.9", families: "1.10" },
2679
2702
  AppsAccountsUsageResult: { problem: "1.12" },
2680
- AppsAccountsResetsResult: { problem: "1.12" }
2703
+ AppsAccountsResetsResult: { problem: "1.12" },
2704
+ ChatRow: { app_project: "1.13", tokens: "1.13", original_title: "1.14", title_source: "1.14", title_override: "1.14" },
2705
+ AccountUsage: { plan: "1.13", credits: "1.13" }
2681
2706
  };
2682
2707
  var NULL_SINCE = {
2683
2708
  "RelayDeviceStatusEvent.since_ms": { since: "1.1", olderPeersGet: 0 }
@@ -2736,6 +2761,33 @@ var RESULT_PATH = /* @__PURE__ */ new Map([
2736
2761
  ["apps.accounts.usage", "AppsAccountsUsageResult"],
2737
2762
  ["apps.accounts.resets", "AppsAccountsResetsResult"]
2738
2763
  ]);
2764
+ var NESTED_RESULTS = /* @__PURE__ */ new Map([
2765
+ ["apps.chats.list", [["chats", "ChatRow"]]],
2766
+ ["apps.projects.file", [["chat", "ChatRow"]]],
2767
+ ["apps.projects.file_many", [["chats", "ChatRow"]]],
2768
+ ["apps.projects.unfile", [["chat", "ChatRow"]]],
2769
+ ["apps.projects.move", [["chat", "ChatRow"]]],
2770
+ ["apps.chats.star", [["chat", "ChatRow"]]],
2771
+ ["apps.chats.place", [["chat", "ChatRow"]]],
2772
+ ["apps.accounts.usage", [["accounts", "AccountUsage"]]]
2773
+ ]);
2774
+ function stripNested(value, nested, version) {
2775
+ if (value === null || typeof value !== "object" || Array.isArray(value)) return value;
2776
+ let body = value;
2777
+ for (const [key, path] of nested) {
2778
+ const inner = body[key];
2779
+ if (inner === void 0 || inner === null) continue;
2780
+ const fields = FIELDS_SINCE[path];
2781
+ if (Array.isArray(inner)) {
2782
+ const next = inner.map((x) => strip(x, fields, version));
2783
+ if (next.some((x, i) => x !== inner[i])) body = { ...body, [key]: next };
2784
+ } else {
2785
+ const next = strip(inner, fields, version);
2786
+ if (next !== inner) body = { ...body, [key]: next };
2787
+ }
2788
+ }
2789
+ return body;
2790
+ }
2739
2791
  var WINDOW_RESULTS = /* @__PURE__ */ new Map([
2740
2792
  ["window.list", "windows"],
2741
2793
  ["window.focus", "window"],
@@ -2759,7 +2811,9 @@ function forPeer(op, part, value, version) {
2759
2811
  const windowKey = op ? WINDOW_RESULTS.get(op) : void 0;
2760
2812
  if (windowKey) return stripWindows(value, windowKey, version);
2761
2813
  const path = op ? RESULT_PATH.get(op) : void 0;
2762
- return path ? strip(value, FIELDS_SINCE[path], version) : value;
2814
+ const top = path ? strip(value, FIELDS_SINCE[path], version) : value;
2815
+ const nested = op ? NESTED_RESULTS.get(op) : void 0;
2816
+ return nested ? stripNested(top, nested, version) : top;
2763
2817
  }
2764
2818
  if (value === null || typeof value !== "object") return value;
2765
2819
  const body = value;
@@ -2773,10 +2827,10 @@ function forPeer(op, part, value, version) {
2773
2827
  }
2774
2828
  return data === body.data ? value : { ...body, data };
2775
2829
  }
2776
- var VERSIONED_RESULT_OPS = [...RESULT_PATH.keys(), ...WINDOW_RESULTS.keys()];
2830
+ var VERSIONED_RESULT_OPS = [.../* @__PURE__ */ new Set([...RESULT_PATH.keys(), ...WINDOW_RESULTS.keys(), ...NESTED_RESULTS.keys()])];
2777
2831
 
2778
2832
  // src/contract.ts
2779
- var CONTRACT_SHA256 = "179024ee4b3dc7123af1db44f8ce0fb9da7b392eed30a2a2b5bb312da3522bb0";
2833
+ var CONTRACT_SHA256 = "274e5bac7ae2a9b7a8027a6c356f54654cd1ed91cf2363711a21ff821a33a676";
2780
2834
 
2781
2835
  // src/close-policy.ts
2782
2836
  var CLOSE_RULES = {