@ai-matrx/desktop-protocol 0.21.51 → 0.21.53

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 = 58;
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_-]+$/);
@@ -905,8 +905,17 @@ var ModelsLlmStatusResult = z10.strictObject({
905
905
  /** Why the last start or download failed, one human line; null otherwise. */
906
906
  error: z10.string().max(300).nullable()
907
907
  });
908
- var ModelsLlmInstallParams = z10.strictObject({ model: TextModelId });
909
- var ModelsLlmInstallResult = z10.strictObject({ model: TextModelId, elapsed_ms: nonNegInt });
908
+ var ModelsLlmInstallParams = z10.strictObject({
909
+ model: TextModelId,
910
+ /** (1.58) The person's own Hugging Face token for this download (gated/private files): sent only to Hugging Face hosts, never stored or logged. */
911
+ hf_token: z10.string().min(8).max(512).optional()
912
+ });
913
+ var ModelsLlmInstallResult = z10.strictObject({
914
+ model: TextModelId,
915
+ elapsed_ms: nonNegInt,
916
+ /** (1.58) path -> SHA-256 of every file whose catalog sha256 was null, hashed on this first download. */
917
+ hashed: z10.record(z10.string().max(512), z10.string().regex(/^[0-9a-f]{64}$/)).optional()
918
+ });
910
919
  var ModelsLlmStartParams = z10.strictObject({
911
920
  model: TextModelId,
912
921
  /** Tokens of context, from the knob desktop.models/context_length. Omitted today means the service's fixed 4096 (optional until callers send it). */
@@ -928,7 +937,11 @@ var CatalogFile = z10.strictObject({
928
937
  /** The pinned https URL it is downloaded from. */
929
938
  url: z10.string().url().max(2048),
930
939
  size_bytes: nonNegInt,
931
- sha256: Sha256Hex,
940
+ /**
941
+ * The file's SHA-256; (1.58) null when its source publishes none (a small non-LFS file on Hugging
942
+ * Face): the first download hashes it and reports it in `models.llm.install`'s `hashed`.
943
+ */
944
+ sha256: Sha256Hex.nullable(),
932
945
  /** weights, weights_shard, mmproj, config, tokenizer, … (ai.model_artifact.role). */
933
946
  role: z10.string().max(32)
934
947
  });
@@ -3331,7 +3344,12 @@ var CodingSessionRecord = z34.strictObject({
3331
3344
  lastRunStatus: CodingRunStatus.nullable(),
3332
3345
  queued: z34.array(z34.string().max(1048576)).max(100),
3333
3346
  agent: CodingSessionAgent.nullable(),
3334
- agentRemovedDue: z34.boolean()
3347
+ agentRemovedDue: z34.boolean(),
3348
+ /**
3349
+ * (1.57) Claude Code: the account the record belongs to (Accounts' profile id): the one a session
3350
+ * runs as, or whose config directory holds the chat. Absent: the default sign-in.
3351
+ */
3352
+ accountId: z34.string().min(1).max(64).optional()
3335
3353
  });
3336
3354
  var CodingActiveElsewhere = z34.strictObject({
3337
3355
  reason: z34.enum(["process", "recent-write", "open-tool-call", "open"]),
@@ -3353,7 +3371,12 @@ var CodingDiscoveredChat = z34.strictObject({
3353
3371
  unavailable: ShortText.nullable(),
3354
3372
  updatedAt: IsoTime,
3355
3373
  source: z34.string().max(60).nullable(),
3356
- activeElsewhere: CodingActiveElsewhere.nullable()
3374
+ activeElsewhere: CodingActiveElsewhere.nullable(),
3375
+ /**
3376
+ * (1.57) Claude Code: the account the record belongs to (Accounts' profile id): the one a session
3377
+ * runs as, or whose config directory holds the chat. Absent: the default sign-in.
3378
+ */
3379
+ accountId: z34.string().min(1).max(64).optional()
3357
3380
  });
3358
3381
  var CodingTranscriptItem = z34.discriminatedUnion("kind", [
3359
3382
  z34.strictObject({ kind: z34.literal("user"), id: z34.string().max(200), text: z34.string(), at: IsoTime.nullable() }),
@@ -3393,6 +3416,31 @@ var CodingProviderProblem = z34.strictObject({
3393
3416
  until: z34.string().max(120).nullable(),
3394
3417
  at: IsoTime
3395
3418
  });
3419
+ var CodingAccountUsage = z34.strictObject({
3420
+ windows: z34.array(CodingQuotaWindow).max(20),
3421
+ /** The provider's own status word ("allowed", "allowed_warning", "rejected"...), when it gives one. */
3422
+ status: z34.string().max(60).nullable(),
3423
+ /** When a rejected status lifts (ISO), when the provider says. */
3424
+ resetsAt: z34.string().max(80).nullable(),
3425
+ at: IsoTime
3426
+ });
3427
+ var CodingContinueTarget = z34.strictObject({
3428
+ accountId: z34.string().min(1).max(64).nullable(),
3429
+ label: z34.string().max(200)
3430
+ });
3431
+ var CodingProviderAccount = z34.strictObject({
3432
+ id: z34.string().min(1).max(64),
3433
+ label: z34.string().max(200),
3434
+ /** (1.57) No known usage limit or expired sign-in on this account. Absent: not read. */
3435
+ ready: z34.boolean().optional(),
3436
+ lastProblem: CodingProviderProblem.optional(),
3437
+ problem: ShortText.optional(),
3438
+ fix: ShortText.optional(),
3439
+ /** (1.57) Absent: never seen ("No usage data yet"). */
3440
+ usage: CodingAccountUsage.optional(),
3441
+ /** (1.57) This account is limited and that other one is not: "Continue on <label>". */
3442
+ continueOn: CodingContinueTarget.optional()
3443
+ });
3396
3444
  var CodingProviderBinary = z34.strictObject({
3397
3445
  path: LocalPath,
3398
3446
  version: z34.string().max(80).nullable(),
@@ -3429,9 +3477,13 @@ var CodingProviderStatus = z34.strictObject({
3429
3477
  * can use, as the computer's engine lists them; New session offers them beside the default sign-in.
3430
3478
  * Absent: only the default sign-in (or a computer older than 1.53).
3431
3479
  */
3432
- accounts: z34.array(z34.strictObject({ id: z34.string().min(1).max(64), label: z34.string().max(200) })).max(100).optional(),
3480
+ accounts: z34.array(CodingProviderAccount).max(100).optional(),
3433
3481
  /** (1.53) The computer tried to list `accounts` and could not: a short sentence the form shows with a retry. */
3434
- accountsProblem: ShortText.optional()
3482
+ accountsProblem: ShortText.optional(),
3483
+ /** (1.57) The default sign-in's usage as last seen. Absent: never seen ("No usage data yet"). */
3484
+ usage: CodingAccountUsage.optional(),
3485
+ /** (1.57) The default sign-in is limited and this other account is not: "Continue on <label>". */
3486
+ continueOn: CodingContinueTarget.optional()
3435
3487
  });
3436
3488
  var CodingChatPreference = z34.strictObject({
3437
3489
  title: z34.string().max(500).nullable(),
@@ -3458,7 +3510,12 @@ var CodingRecentRow = z34.strictObject({
3458
3510
  state: z34.enum(["running", "needs_attention", "new_output", "elsewhere", "idle"]),
3459
3511
  stateLabel: z34.string().max(120).nullable(),
3460
3512
  pinned: z34.boolean(),
3461
- startedBy: CodingStartedBy.nullable()
3513
+ startedBy: CodingStartedBy.nullable(),
3514
+ /**
3515
+ * (1.57) Claude Code: the account the record belongs to (Accounts' profile id): the one a session
3516
+ * runs as, or whose config directory holds the chat. Absent: the default sign-in.
3517
+ */
3518
+ accountId: z34.string().min(1).max(64).optional()
3462
3519
  });
3463
3520
  var CodingFolderCheck = z34.strictObject({
3464
3521
  path: z34.string().max(4096),
@@ -3591,19 +3648,23 @@ var CodingSearchParams = z34.strictObject({
3591
3648
  cursor: nonNegInt.optional(),
3592
3649
  limit: z34.int().min(1).max(100).optional()
3593
3650
  });
3651
+ var CodingSearchHit = z34.strictObject({
3652
+ provider: CodingProviderName,
3653
+ providerSessionId: SessionKey,
3654
+ title: z34.string().max(500),
3655
+ cwd: LocalPath.nullable(),
3656
+ updatedAt: IsoTime,
3657
+ where: z34.enum(["title", "content"]),
3658
+ snippet: z34.string().max(2e3).nullable(),
3659
+ /**
3660
+ * (1.57) Claude Code: the account the record belongs to (Accounts' profile id): the one a session
3661
+ * runs as, or whose config directory holds the chat. Absent: the default sign-in.
3662
+ */
3663
+ accountId: z34.string().min(1).max(64).optional()
3664
+ });
3594
3665
  var CodingSearchResult = z34.strictObject({
3595
3666
  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
- ),
3667
+ hits: z34.array(CodingSearchHit),
3607
3668
  scanned: nonNegInt,
3608
3669
  total: nonNegInt,
3609
3670
  nextCursor: nonNegInt.nullable()
@@ -4953,6 +5014,9 @@ var NAMED_SCHEMAS = {
4953
5014
  CodingQuotaWindow,
4954
5015
  CodingProviderProblem,
4955
5016
  CodingProviderBinary,
5017
+ CodingAccountUsage,
5018
+ CodingContinueTarget,
5019
+ CodingProviderAccount,
4956
5020
  CodingProviderStatus,
4957
5021
  CodingChatPreference,
4958
5022
  CodingTitleStatus,
@@ -5009,6 +5073,7 @@ var NAMED_SCHEMAS = {
5009
5073
  CodingRecentSeenParams,
5010
5074
  CodingRecentSeenResult,
5011
5075
  CodingSearchParams,
5076
+ CodingSearchHit,
5012
5077
  CodingSearchResult,
5013
5078
  CodingReconcileParams,
5014
5079
  CodingReconcileResult,
@@ -5574,7 +5639,12 @@ var FIELDS_SINCE = {
5574
5639
  WindowInfo: { app: "1.7", pid: "1.7" },
5575
5640
  AppWindowInfo: { remote_control: "1.50" },
5576
5641
  WindowRemoteControl: { problem: "1.52" },
5577
- CodingProviderStatus: { accounts: "1.53", accountsProblem: "1.53" },
5642
+ CodingProviderStatus: { accounts: "1.53", accountsProblem: "1.53", usage: "1.57", continueOn: "1.57" },
5643
+ CodingProviderAccount: { ready: "1.57", lastProblem: "1.57", problem: "1.57", fix: "1.57", usage: "1.57", continueOn: "1.57" },
5644
+ CodingSessionRecord: { accountId: "1.57" },
5645
+ CodingDiscoveredChat: { accountId: "1.57" },
5646
+ CodingRecentRow: { accountId: "1.57" },
5647
+ CodingSearchHit: { accountId: "1.57" },
5578
5648
  AppsInstancesListParams: { fresh: "1.51" },
5579
5649
  AppsInstancesListResult: { as_of_ms: "1.51", refreshing: "1.51" },
5580
5650
  AppsAccountsListParams: { fresh: "1.51" },
@@ -5711,7 +5781,18 @@ var NESTED_RESULTS = /* @__PURE__ */ new Map([
5711
5781
  ["apps.projects.to_window", [["group", "ProjectMoveGroup"]]],
5712
5782
  ["apps.windows.list", [["windows", "AppWindowInfo"]]],
5713
5783
  ["apps.windows.set_remote_control", [["remote_control", "WindowRemoteControl"]]],
5714
- ["coding.providers", [["providers", "CodingProviderStatus"]]]
5784
+ ["coding.providers", [["providers", "CodingProviderStatus"]]],
5785
+ // 1.57: the account a coding record belongs to.
5786
+ ["coding.sessions.list", [["sessions", "CodingSessionRecord"], ["recent", "CodingRecentRow"]]],
5787
+ ["coding.recent.seen", [["recent", "CodingRecentRow"]]],
5788
+ ["coding.discover", [["chats", "CodingDiscoveredChat"]]],
5789
+ ["coding.search", [["hits", "CodingSearchHit"]]],
5790
+ ["coding.start", [["session", "CodingSessionRecord"]]],
5791
+ ["coding.send", [["session", "CodingSessionRecord"]]],
5792
+ ["coding.takeover", [["session", "CodingSessionRecord"]]],
5793
+ ["coding.options.set", [["session", "CodingSessionRecord"]]],
5794
+ ["coding.agent.set", [["session", "CodingSessionRecord"]]],
5795
+ ["coding.account.continue", [["session", "CodingSessionRecord"]]]
5715
5796
  ]);
5716
5797
  function stripNested(value, nested, version) {
5717
5798
  if (value === null || typeof value !== "object" || Array.isArray(value)) return value;
@@ -5747,15 +5828,24 @@ function windowListRemoteControlForPeer(value, version) {
5747
5828
  });
5748
5829
  return next.some((w, i) => w !== windows[i]) ? { ...body, windows: next } : value;
5749
5830
  }
5750
- function providersDefaultSourceForPeer(value, version) {
5751
- if (knows(version, "1.54") || value === null || typeof value !== "object") return value;
5831
+ function providersForPeer(value, version) {
5832
+ if (knows(version, "1.57") || value === null || typeof value !== "object") return value;
5752
5833
  const body = value;
5753
5834
  if (!Array.isArray(body.providers)) return value;
5754
5835
  const providers = body.providers;
5755
5836
  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" } };
5837
+ if (p === null || typeof p !== "object") return p;
5838
+ let out = p;
5839
+ const dm = out.defaultModel;
5840
+ if (!knows(version, "1.54") && dm !== null && typeof dm === "object" && dm.source === "account") {
5841
+ out = { ...out, defaultModel: { ...dm, source: "driver" } };
5842
+ }
5843
+ const accounts = out.accounts;
5844
+ if (Array.isArray(accounts)) {
5845
+ const kept = accounts.map((a) => strip(a, FIELDS_SINCE.CodingProviderAccount, version));
5846
+ if (kept.some((a, i) => a !== accounts[i])) out = { ...out, accounts: kept };
5847
+ }
5848
+ return out;
5759
5849
  });
5760
5850
  return next.some((p, i) => p !== providers[i]) ? { ...body, providers: next } : value;
5761
5851
  }
@@ -5786,7 +5876,7 @@ function forPeer(op, part, value, version) {
5786
5876
  const top = path ? strip(known, FIELDS_SINCE[path], version) : known;
5787
5877
  const nested = op ? NESTED_RESULTS.get(op) : void 0;
5788
5878
  const stripped = nested ? stripNested(top, nested, version) : top;
5789
- if (op === "coding.providers") return providersDefaultSourceForPeer(stripped, version);
5879
+ if (op === "coding.providers") return providersForPeer(stripped, version);
5790
5880
  return op === "apps.windows.list" ? windowListRemoteControlForPeer(stripped, version) : stripped;
5791
5881
  }
5792
5882
  if (value === null || typeof value !== "object") return value;
@@ -5804,7 +5894,7 @@ function forPeer(op, part, value, version) {
5804
5894
  var VERSIONED_RESULT_OPS = [.../* @__PURE__ */ new Set([...RESULT_PATH.keys(), ...WINDOW_RESULTS.keys(), ...NESTED_RESULTS.keys()])];
5805
5895
 
5806
5896
  // src/contract.ts
5807
- var CONTRACT_SHA256 = "14b79673133fb1625ab0320921b60ad595de3228bfae1337a73be3ed2d3e5a45";
5897
+ var CONTRACT_SHA256 = "ee1d6d3d83bb18a2ed020dbaf3c611b982699f9a9db8d728c38f2c6b8fbf0815";
5808
5898
 
5809
5899
  // src/close-policy.ts
5810
5900
  var CLOSE_RULES = {
@@ -6406,6 +6496,7 @@ export {
6406
6496
  CloseCodeValue,
6407
6497
  CodingAccountContinueParams,
6408
6498
  CodingAccountContinueResult,
6499
+ CodingAccountUsage,
6409
6500
  CodingActiveElsewhere,
6410
6501
  CodingActivityParams,
6411
6502
  CodingActivityResult,
@@ -6417,6 +6508,7 @@ export {
6417
6508
  CodingChangedEvent,
6418
6509
  CodingChatPreference,
6419
6510
  CodingClientRequestId,
6511
+ CodingContinueTarget,
6420
6512
  CodingDiscoverParams,
6421
6513
  CodingDiscoverResult,
6422
6514
  CodingDiscoveredChat,
@@ -6449,6 +6541,7 @@ export {
6449
6541
  CodingPrefsListResult,
6450
6542
  CodingPrefsSetParams,
6451
6543
  CodingPrefsSetResult,
6544
+ CodingProviderAccount,
6452
6545
  CodingProviderBinary,
6453
6546
  CodingProviderName,
6454
6547
  CodingProviderProblem,
@@ -6467,6 +6560,7 @@ export {
6467
6560
  CodingRunUsage,
6468
6561
  CodingRunsListParams,
6469
6562
  CodingRunsListResult,
6563
+ CodingSearchHit,
6470
6564
  CodingSearchParams,
6471
6565
  CodingSearchResult,
6472
6566
  CodingSendParams,