@ai-matrx/desktop-protocol 0.21.51 → 0.21.52

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 = 56;
5
+ var PROTOCOL_MINOR = 57;
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_-]+$/);
@@ -3331,7 +3331,12 @@ var CodingSessionRecord = z34.strictObject({
3331
3331
  lastRunStatus: CodingRunStatus.nullable(),
3332
3332
  queued: z34.array(z34.string().max(1048576)).max(100),
3333
3333
  agent: CodingSessionAgent.nullable(),
3334
- agentRemovedDue: z34.boolean()
3334
+ agentRemovedDue: z34.boolean(),
3335
+ /**
3336
+ * (1.57) Claude Code: the account the record belongs to (Accounts' profile id): the one a session
3337
+ * runs as, or whose config directory holds the chat. Absent: the default sign-in.
3338
+ */
3339
+ accountId: z34.string().min(1).max(64).optional()
3335
3340
  });
3336
3341
  var CodingActiveElsewhere = z34.strictObject({
3337
3342
  reason: z34.enum(["process", "recent-write", "open-tool-call", "open"]),
@@ -3353,7 +3358,12 @@ var CodingDiscoveredChat = z34.strictObject({
3353
3358
  unavailable: ShortText.nullable(),
3354
3359
  updatedAt: IsoTime,
3355
3360
  source: z34.string().max(60).nullable(),
3356
- activeElsewhere: CodingActiveElsewhere.nullable()
3361
+ activeElsewhere: CodingActiveElsewhere.nullable(),
3362
+ /**
3363
+ * (1.57) Claude Code: the account the record belongs to (Accounts' profile id): the one a session
3364
+ * runs as, or whose config directory holds the chat. Absent: the default sign-in.
3365
+ */
3366
+ accountId: z34.string().min(1).max(64).optional()
3357
3367
  });
3358
3368
  var CodingTranscriptItem = z34.discriminatedUnion("kind", [
3359
3369
  z34.strictObject({ kind: z34.literal("user"), id: z34.string().max(200), text: z34.string(), at: IsoTime.nullable() }),
@@ -3393,6 +3403,31 @@ var CodingProviderProblem = z34.strictObject({
3393
3403
  until: z34.string().max(120).nullable(),
3394
3404
  at: IsoTime
3395
3405
  });
3406
+ var CodingAccountUsage = z34.strictObject({
3407
+ windows: z34.array(CodingQuotaWindow).max(20),
3408
+ /** The provider's own status word ("allowed", "allowed_warning", "rejected"...), when it gives one. */
3409
+ status: z34.string().max(60).nullable(),
3410
+ /** When a rejected status lifts (ISO), when the provider says. */
3411
+ resetsAt: z34.string().max(80).nullable(),
3412
+ at: IsoTime
3413
+ });
3414
+ var CodingContinueTarget = z34.strictObject({
3415
+ accountId: z34.string().min(1).max(64).nullable(),
3416
+ label: z34.string().max(200)
3417
+ });
3418
+ var CodingProviderAccount = z34.strictObject({
3419
+ id: z34.string().min(1).max(64),
3420
+ label: z34.string().max(200),
3421
+ /** (1.57) No known usage limit or expired sign-in on this account. Absent: not read. */
3422
+ ready: z34.boolean().optional(),
3423
+ lastProblem: CodingProviderProblem.optional(),
3424
+ problem: ShortText.optional(),
3425
+ fix: ShortText.optional(),
3426
+ /** (1.57) Absent: never seen ("No usage data yet"). */
3427
+ usage: CodingAccountUsage.optional(),
3428
+ /** (1.57) This account is limited and that other one is not: "Continue on <label>". */
3429
+ continueOn: CodingContinueTarget.optional()
3430
+ });
3396
3431
  var CodingProviderBinary = z34.strictObject({
3397
3432
  path: LocalPath,
3398
3433
  version: z34.string().max(80).nullable(),
@@ -3429,9 +3464,13 @@ var CodingProviderStatus = z34.strictObject({
3429
3464
  * can use, as the computer's engine lists them; New session offers them beside the default sign-in.
3430
3465
  * Absent: only the default sign-in (or a computer older than 1.53).
3431
3466
  */
3432
- accounts: z34.array(z34.strictObject({ id: z34.string().min(1).max(64), label: z34.string().max(200) })).max(100).optional(),
3467
+ accounts: z34.array(CodingProviderAccount).max(100).optional(),
3433
3468
  /** (1.53) The computer tried to list `accounts` and could not: a short sentence the form shows with a retry. */
3434
- accountsProblem: ShortText.optional()
3469
+ accountsProblem: ShortText.optional(),
3470
+ /** (1.57) The default sign-in's usage as last seen. Absent: never seen ("No usage data yet"). */
3471
+ usage: CodingAccountUsage.optional(),
3472
+ /** (1.57) The default sign-in is limited and this other account is not: "Continue on <label>". */
3473
+ continueOn: CodingContinueTarget.optional()
3435
3474
  });
3436
3475
  var CodingChatPreference = z34.strictObject({
3437
3476
  title: z34.string().max(500).nullable(),
@@ -3458,7 +3497,12 @@ var CodingRecentRow = z34.strictObject({
3458
3497
  state: z34.enum(["running", "needs_attention", "new_output", "elsewhere", "idle"]),
3459
3498
  stateLabel: z34.string().max(120).nullable(),
3460
3499
  pinned: z34.boolean(),
3461
- startedBy: CodingStartedBy.nullable()
3500
+ startedBy: CodingStartedBy.nullable(),
3501
+ /**
3502
+ * (1.57) Claude Code: the account the record belongs to (Accounts' profile id): the one a session
3503
+ * runs as, or whose config directory holds the chat. Absent: the default sign-in.
3504
+ */
3505
+ accountId: z34.string().min(1).max(64).optional()
3462
3506
  });
3463
3507
  var CodingFolderCheck = z34.strictObject({
3464
3508
  path: z34.string().max(4096),
@@ -3591,19 +3635,23 @@ var CodingSearchParams = z34.strictObject({
3591
3635
  cursor: nonNegInt.optional(),
3592
3636
  limit: z34.int().min(1).max(100).optional()
3593
3637
  });
3638
+ var CodingSearchHit = z34.strictObject({
3639
+ provider: CodingProviderName,
3640
+ providerSessionId: SessionKey,
3641
+ title: z34.string().max(500),
3642
+ cwd: LocalPath.nullable(),
3643
+ updatedAt: IsoTime,
3644
+ where: z34.enum(["title", "content"]),
3645
+ snippet: z34.string().max(2e3).nullable(),
3646
+ /**
3647
+ * (1.57) Claude Code: the account the record belongs to (Accounts' profile id): the one a session
3648
+ * runs as, or whose config directory holds the chat. Absent: the default sign-in.
3649
+ */
3650
+ accountId: z34.string().min(1).max(64).optional()
3651
+ });
3594
3652
  var CodingSearchResult = z34.strictObject({
3595
3653
  query: z34.string().max(500),
3596
- hits: z34.array(
3597
- z34.strictObject({
3598
- provider: CodingProviderName,
3599
- providerSessionId: SessionKey,
3600
- title: z34.string().max(500),
3601
- cwd: LocalPath.nullable(),
3602
- updatedAt: IsoTime,
3603
- where: z34.enum(["title", "content"]),
3604
- snippet: z34.string().max(2e3).nullable()
3605
- })
3606
- ),
3654
+ hits: z34.array(CodingSearchHit),
3607
3655
  scanned: nonNegInt,
3608
3656
  total: nonNegInt,
3609
3657
  nextCursor: nonNegInt.nullable()
@@ -4953,6 +5001,9 @@ var NAMED_SCHEMAS = {
4953
5001
  CodingQuotaWindow,
4954
5002
  CodingProviderProblem,
4955
5003
  CodingProviderBinary,
5004
+ CodingAccountUsage,
5005
+ CodingContinueTarget,
5006
+ CodingProviderAccount,
4956
5007
  CodingProviderStatus,
4957
5008
  CodingChatPreference,
4958
5009
  CodingTitleStatus,
@@ -5009,6 +5060,7 @@ var NAMED_SCHEMAS = {
5009
5060
  CodingRecentSeenParams,
5010
5061
  CodingRecentSeenResult,
5011
5062
  CodingSearchParams,
5063
+ CodingSearchHit,
5012
5064
  CodingSearchResult,
5013
5065
  CodingReconcileParams,
5014
5066
  CodingReconcileResult,
@@ -5574,7 +5626,12 @@ var FIELDS_SINCE = {
5574
5626
  WindowInfo: { app: "1.7", pid: "1.7" },
5575
5627
  AppWindowInfo: { remote_control: "1.50" },
5576
5628
  WindowRemoteControl: { problem: "1.52" },
5577
- CodingProviderStatus: { accounts: "1.53", accountsProblem: "1.53" },
5629
+ CodingProviderStatus: { accounts: "1.53", accountsProblem: "1.53", usage: "1.57", continueOn: "1.57" },
5630
+ CodingProviderAccount: { ready: "1.57", lastProblem: "1.57", problem: "1.57", fix: "1.57", usage: "1.57", continueOn: "1.57" },
5631
+ CodingSessionRecord: { accountId: "1.57" },
5632
+ CodingDiscoveredChat: { accountId: "1.57" },
5633
+ CodingRecentRow: { accountId: "1.57" },
5634
+ CodingSearchHit: { accountId: "1.57" },
5578
5635
  AppsInstancesListParams: { fresh: "1.51" },
5579
5636
  AppsInstancesListResult: { as_of_ms: "1.51", refreshing: "1.51" },
5580
5637
  AppsAccountsListParams: { fresh: "1.51" },
@@ -5711,7 +5768,18 @@ var NESTED_RESULTS = /* @__PURE__ */ new Map([
5711
5768
  ["apps.projects.to_window", [["group", "ProjectMoveGroup"]]],
5712
5769
  ["apps.windows.list", [["windows", "AppWindowInfo"]]],
5713
5770
  ["apps.windows.set_remote_control", [["remote_control", "WindowRemoteControl"]]],
5714
- ["coding.providers", [["providers", "CodingProviderStatus"]]]
5771
+ ["coding.providers", [["providers", "CodingProviderStatus"]]],
5772
+ // 1.57: the account a coding record belongs to.
5773
+ ["coding.sessions.list", [["sessions", "CodingSessionRecord"], ["recent", "CodingRecentRow"]]],
5774
+ ["coding.recent.seen", [["recent", "CodingRecentRow"]]],
5775
+ ["coding.discover", [["chats", "CodingDiscoveredChat"]]],
5776
+ ["coding.search", [["hits", "CodingSearchHit"]]],
5777
+ ["coding.start", [["session", "CodingSessionRecord"]]],
5778
+ ["coding.send", [["session", "CodingSessionRecord"]]],
5779
+ ["coding.takeover", [["session", "CodingSessionRecord"]]],
5780
+ ["coding.options.set", [["session", "CodingSessionRecord"]]],
5781
+ ["coding.agent.set", [["session", "CodingSessionRecord"]]],
5782
+ ["coding.account.continue", [["session", "CodingSessionRecord"]]]
5715
5783
  ]);
5716
5784
  function stripNested(value, nested, version) {
5717
5785
  if (value === null || typeof value !== "object" || Array.isArray(value)) return value;
@@ -5747,15 +5815,24 @@ function windowListRemoteControlForPeer(value, version) {
5747
5815
  });
5748
5816
  return next.some((w, i) => w !== windows[i]) ? { ...body, windows: next } : value;
5749
5817
  }
5750
- function providersDefaultSourceForPeer(value, version) {
5751
- if (knows(version, "1.54") || value === null || typeof value !== "object") return value;
5818
+ function providersForPeer(value, version) {
5819
+ if (knows(version, "1.57") || value === null || typeof value !== "object") return value;
5752
5820
  const body = value;
5753
5821
  if (!Array.isArray(body.providers)) return value;
5754
5822
  const providers = body.providers;
5755
5823
  const next = providers.map((p) => {
5756
- const dm = p?.defaultModel;
5757
- if (dm === null || typeof dm !== "object" || dm.source !== "account") return p;
5758
- return { ...p, defaultModel: { ...dm, source: "driver" } };
5824
+ if (p === null || typeof p !== "object") return p;
5825
+ let out = p;
5826
+ const dm = out.defaultModel;
5827
+ if (!knows(version, "1.54") && dm !== null && typeof dm === "object" && dm.source === "account") {
5828
+ out = { ...out, defaultModel: { ...dm, source: "driver" } };
5829
+ }
5830
+ const accounts = out.accounts;
5831
+ if (Array.isArray(accounts)) {
5832
+ const kept = accounts.map((a) => strip(a, FIELDS_SINCE.CodingProviderAccount, version));
5833
+ if (kept.some((a, i) => a !== accounts[i])) out = { ...out, accounts: kept };
5834
+ }
5835
+ return out;
5759
5836
  });
5760
5837
  return next.some((p, i) => p !== providers[i]) ? { ...body, providers: next } : value;
5761
5838
  }
@@ -5786,7 +5863,7 @@ function forPeer(op, part, value, version) {
5786
5863
  const top = path ? strip(known, FIELDS_SINCE[path], version) : known;
5787
5864
  const nested = op ? NESTED_RESULTS.get(op) : void 0;
5788
5865
  const stripped = nested ? stripNested(top, nested, version) : top;
5789
- if (op === "coding.providers") return providersDefaultSourceForPeer(stripped, version);
5866
+ if (op === "coding.providers") return providersForPeer(stripped, version);
5790
5867
  return op === "apps.windows.list" ? windowListRemoteControlForPeer(stripped, version) : stripped;
5791
5868
  }
5792
5869
  if (value === null || typeof value !== "object") return value;
@@ -5804,7 +5881,7 @@ function forPeer(op, part, value, version) {
5804
5881
  var VERSIONED_RESULT_OPS = [.../* @__PURE__ */ new Set([...RESULT_PATH.keys(), ...WINDOW_RESULTS.keys(), ...NESTED_RESULTS.keys()])];
5805
5882
 
5806
5883
  // src/contract.ts
5807
- var CONTRACT_SHA256 = "14b79673133fb1625ab0320921b60ad595de3228bfae1337a73be3ed2d3e5a45";
5884
+ var CONTRACT_SHA256 = "ee1d6d3d83bb18a2ed020dbaf3c611b982699f9a9db8d728c38f2c6b8fbf0815";
5808
5885
 
5809
5886
  // src/close-policy.ts
5810
5887
  var CLOSE_RULES = {
@@ -6406,6 +6483,7 @@ export {
6406
6483
  CloseCodeValue,
6407
6484
  CodingAccountContinueParams,
6408
6485
  CodingAccountContinueResult,
6486
+ CodingAccountUsage,
6409
6487
  CodingActiveElsewhere,
6410
6488
  CodingActivityParams,
6411
6489
  CodingActivityResult,
@@ -6417,6 +6495,7 @@ export {
6417
6495
  CodingChangedEvent,
6418
6496
  CodingChatPreference,
6419
6497
  CodingClientRequestId,
6498
+ CodingContinueTarget,
6420
6499
  CodingDiscoverParams,
6421
6500
  CodingDiscoverResult,
6422
6501
  CodingDiscoveredChat,
@@ -6449,6 +6528,7 @@ export {
6449
6528
  CodingPrefsListResult,
6450
6529
  CodingPrefsSetParams,
6451
6530
  CodingPrefsSetResult,
6531
+ CodingProviderAccount,
6452
6532
  CodingProviderBinary,
6453
6533
  CodingProviderName,
6454
6534
  CodingProviderProblem,
@@ -6467,6 +6547,7 @@ export {
6467
6547
  CodingRunUsage,
6468
6548
  CodingRunsListParams,
6469
6549
  CodingRunsListResult,
6550
+ CodingSearchHit,
6470
6551
  CodingSearchParams,
6471
6552
  CodingSearchResult,
6472
6553
  CodingSendParams,