@ai-matrx/desktop-protocol 0.21.48 → 0.21.50

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 = 53;
5
+ var PROTOCOL_MINOR = 55;
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_-]+$/);
@@ -1818,6 +1818,50 @@ var AppsWindowsUpdateAndReopenResult = z14.strictObject({
1818
1818
  /** The version installed, null when the install did not happen (or dry_run). */
1819
1819
  installed_version: z14.string().max(64).nullable()
1820
1820
  });
1821
+ var AppsChatsCopyToAccountParams = z14.strictObject({
1822
+ app_key: AppKey,
1823
+ origin: ChatPlace,
1824
+ target: ChatPlace,
1825
+ chat_ids: z14.array(ChatId).min(1).max(500),
1826
+ mode: z14.enum(["copy", "move"]).default("copy"),
1827
+ restart: z14.enum(["queued", "restart_verify"]).default("queued"),
1828
+ /** Put each chat in the target group named as its origin group (default true). */
1829
+ mirror_groups: z14.boolean().default(true),
1830
+ /** Pin in the target the chats pinned in the origin (default true). */
1831
+ pins_follow: z14.boolean().default(true),
1832
+ /** A copy: group them in the origin under this name ("Copied to <target>"). */
1833
+ source_group: z14.string().trim().min(1).max(200).optional()
1834
+ });
1835
+ var CopiedChat = z14.strictObject({
1836
+ chat_id: ChatId,
1837
+ title: z14.string().max(500),
1838
+ outcome: z14.enum(["copied", "moved", "already", "skipped"]),
1839
+ /** The target group it was put in (its origin group's name), or null. */
1840
+ group: z14.string().max(200).nullable(),
1841
+ group_state: z14.enum(["now", "next_close", "failed"]).nullable(),
1842
+ pinned: z14.boolean(),
1843
+ pin_state: z14.enum(["now", "next_close", "failed"]).nullable(),
1844
+ /** The read-back: verified, waiting for a window to close (queued), or failed. */
1845
+ state: z14.enum(["verified", "queued", "failed"]),
1846
+ reason: z14.string().max(400).nullable()
1847
+ });
1848
+ var AppsChatsCopyToAccountResult = z14.strictObject({
1849
+ message: z14.string().max(400),
1850
+ origin: ChatPlace,
1851
+ target: ChatPlace,
1852
+ mode: z14.enum(["copy", "move"]),
1853
+ /** The marker the chats are filed under ("From <origin>"), for Bring back. */
1854
+ project: z14.strictObject({ id: ChatProjectId, name: z14.string().max(200) }),
1855
+ /** The target groups used, by name: made or reused, now or at the next close. */
1856
+ groups: z14.array(z14.strictObject({ name: z14.string().max(200), chats: z14.number().int().nonnegative(), ok: z14.boolean(), when: z14.enum(["now", "next_close"]).nullable(), reason: z14.string().max(400).nullable() })).max(500),
1857
+ source_group: z14.strictObject({ name: z14.string().max(200), ok: z14.boolean(), when: z14.enum(["now", "next_close"]).nullable(), reason: z14.string().max(400).nullable() }).nullable(),
1858
+ chats: z14.array(CopiedChat).max(500),
1859
+ verified: z14.number().int().nonnegative(),
1860
+ queued: z14.number().int().nonnegative(),
1861
+ failed: z14.number().int().nonnegative(),
1862
+ /** What the restart choice did: "restart_verify" closed and reopened `windows`; a fall back to "queued" says why. */
1863
+ restart: z14.strictObject({ asked: z14.enum(["queued", "restart_verify"]), done: z14.enum(["queued", "restart_verify"]), windows: z14.array(ChatPlace).max(2), reason: z14.string().max(400).nullable() })
1864
+ });
1821
1865
 
1822
1866
  // src/schema/apps-instances.ts
1823
1867
  import { z as z15 } from "zod";
@@ -3366,7 +3410,12 @@ var CodingProviderStatus = z34.strictObject({
3366
3410
  quota: z34.array(CodingQuotaWindow).max(20),
3367
3411
  models: z34.array(z34.strictObject({ id: z34.string().max(200), label: z34.string().max(200) })).max(200),
3368
3412
  efforts: z34.array(z34.string().max(40)).max(20),
3369
- defaultModel: z34.strictObject({ id: z34.string().max(200), source: z34.enum(["settings", "driver"]) }).nullable(),
3413
+ /**
3414
+ * Where the default model came from: the app's own settings file, the account (1.54: the signed-in
3415
+ * account's default, e.g. Codex's), or the driver's built-in pick. A peer older than 1.54 is sent
3416
+ * "driver" for "account" (its enum does not know the value).
3417
+ */
3418
+ defaultModel: z34.strictObject({ id: z34.string().max(200), source: z34.enum(["settings", "driver", "account"]) }).nullable(),
3370
3419
  defaultEffort: z34.string().max(40).nullable(),
3371
3420
  binary: CodingProviderBinary.nullable(),
3372
3421
  /**
@@ -4438,6 +4487,8 @@ var OPS = {
4438
4487
  "apps.projects.move": { params: AppsProjectsMoveParams, result: AppsProjectsMoveResult, kind: "unary", since: "1.10", errors: ["NOT_FOUND", "INVALID_PARAMS", "CONFLICT", "PLATFORM_UNSUPPORTED", "INTERNAL"] },
4439
4488
  "apps.projects.create": { params: AppsProjectsCreateParams, result: AppsProjectsCreateResult, kind: "unary", since: "1.10", errors: ["INVALID_PARAMS", "CONFLICT", "PLATFORM_UNSUPPORTED", "INTERNAL"] },
4440
4489
  "apps.projects.import_pins": { params: AppsProjectsImportPinsParams, result: AppsProjectsImportPinsResult, kind: "unary", since: "1.10", errors: ["CONFLICT", "PLATFORM_UNSUPPORTED", "INTERNAL"] },
4490
+ // 1.55: copy (or move) chats to another account with their groups and pins, in one engine pass, read back.
4491
+ "apps.chats.copy_to_account": { params: AppsChatsCopyToAccountParams, result: AppsChatsCopyToAccountResult, kind: "unary", since: "1.55", errors: ["NOT_FOUND", "INVALID_PARAMS", "CONFLICT", "PLATFORM_UNSUPPORTED", "INTERNAL"] },
4441
4492
  "apps.projects.to_window": { params: AppsProjectsToWindowParams, result: AppsProjectsToWindowResult, kind: "unary", since: "1.19", errors: ["NOT_FOUND", "INVALID_PARAMS", "CONFLICT", "PLATFORM_UNSUPPORTED", "INTERNAL"] },
4442
4493
  // 1.11: Going cold, Spend, sync health, windows upkeep.
4443
4494
  "apps.chats.cold": { params: AppsChatsColdParams, result: AppsChatsColdResult, kind: "unary", since: "1.11", errors: ["NOT_FOUND", "PLATFORM_UNSUPPORTED", "INTERNAL"] },
@@ -5152,6 +5203,9 @@ var NAMED_SCHEMAS = {
5152
5203
  WindowRemoteControl,
5153
5204
  AppsWindowsSetRemoteControlParams,
5154
5205
  AppsWindowsSetRemoteControlResult,
5206
+ AppsChatsCopyToAccountParams,
5207
+ CopiedChat,
5208
+ AppsChatsCopyToAccountResult,
5155
5209
  AccountUsage,
5156
5210
  AccountReset,
5157
5211
  AppsWindowsListParams,
@@ -5663,6 +5717,18 @@ function windowListRemoteControlForPeer(value, version) {
5663
5717
  });
5664
5718
  return next.some((w, i) => w !== windows[i]) ? { ...body, windows: next } : value;
5665
5719
  }
5720
+ function providersDefaultSourceForPeer(value, version) {
5721
+ if (knows(version, "1.54") || value === null || typeof value !== "object") return value;
5722
+ const body = value;
5723
+ if (!Array.isArray(body.providers)) return value;
5724
+ const providers = body.providers;
5725
+ const next = providers.map((p) => {
5726
+ const dm = p?.defaultModel;
5727
+ if (dm === null || typeof dm !== "object" || dm.source !== "account") return p;
5728
+ return { ...p, defaultModel: { ...dm, source: "driver" } };
5729
+ });
5730
+ return next.some((p, i) => p !== providers[i]) ? { ...body, providers: next } : value;
5731
+ }
5666
5732
  var WINDOW_RESULTS = /* @__PURE__ */ new Map([
5667
5733
  ["window.list", "windows"],
5668
5734
  ["window.focus", "window"],
@@ -5690,6 +5756,7 @@ function forPeer(op, part, value, version) {
5690
5756
  const top = path ? strip(known, FIELDS_SINCE[path], version) : known;
5691
5757
  const nested = op ? NESTED_RESULTS.get(op) : void 0;
5692
5758
  const stripped = nested ? stripNested(top, nested, version) : top;
5759
+ if (op === "coding.providers") return providersDefaultSourceForPeer(stripped, version);
5693
5760
  return op === "apps.windows.list" ? windowListRemoteControlForPeer(stripped, version) : stripped;
5694
5761
  }
5695
5762
  if (value === null || typeof value !== "object") return value;
@@ -5707,7 +5774,7 @@ function forPeer(op, part, value, version) {
5707
5774
  var VERSIONED_RESULT_OPS = [.../* @__PURE__ */ new Set([...RESULT_PATH.keys(), ...WINDOW_RESULTS.keys(), ...NESTED_RESULTS.keys()])];
5708
5775
 
5709
5776
  // src/contract.ts
5710
- var CONTRACT_SHA256 = "3a1cc0cf335111a353238b9673b5764e7f3657f2c216f05f0895886f5c0d1db8";
5777
+ var CONTRACT_SHA256 = "aeb1f5dd5ec4290d9ff8871fa39dd9be9605d25a40fec3c681f888c7f2a1954f";
5711
5778
 
5712
5779
  // src/close-policy.ts
5713
5780
  var CLOSE_RULES = {
@@ -6149,6 +6216,8 @@ export {
6149
6216
  AppsChatsChangedEvent,
6150
6217
  AppsChatsColdParams,
6151
6218
  AppsChatsColdResult,
6219
+ AppsChatsCopyToAccountParams,
6220
+ AppsChatsCopyToAccountResult,
6152
6221
  AppsChatsListParams,
6153
6222
  AppsChatsListResult,
6154
6223
  AppsChatsOpenParams,
@@ -6404,6 +6473,7 @@ export {
6404
6473
  ContactsSearchParams,
6405
6474
  ContactsSearchResult,
6406
6475
  ContractHash,
6476
+ CopiedChat,
6407
6477
  CoreToClientMsg,
6408
6478
  CoreToServiceMsg,
6409
6479
  CreditMsg,