@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.cjs CHANGED
@@ -226,6 +226,7 @@ __export(src_exports, {
226
226
  CloseCodeValue: () => CloseCodeValue,
227
227
  CodingAccountContinueParams: () => CodingAccountContinueParams,
228
228
  CodingAccountContinueResult: () => CodingAccountContinueResult,
229
+ CodingAccountUsage: () => CodingAccountUsage,
229
230
  CodingActiveElsewhere: () => CodingActiveElsewhere,
230
231
  CodingActivityParams: () => CodingActivityParams,
231
232
  CodingActivityResult: () => CodingActivityResult,
@@ -237,6 +238,7 @@ __export(src_exports, {
237
238
  CodingChangedEvent: () => CodingChangedEvent,
238
239
  CodingChatPreference: () => CodingChatPreference,
239
240
  CodingClientRequestId: () => CodingClientRequestId,
241
+ CodingContinueTarget: () => CodingContinueTarget,
240
242
  CodingDiscoverParams: () => CodingDiscoverParams,
241
243
  CodingDiscoverResult: () => CodingDiscoverResult,
242
244
  CodingDiscoveredChat: () => CodingDiscoveredChat,
@@ -269,6 +271,7 @@ __export(src_exports, {
269
271
  CodingPrefsListResult: () => CodingPrefsListResult,
270
272
  CodingPrefsSetParams: () => CodingPrefsSetParams,
271
273
  CodingPrefsSetResult: () => CodingPrefsSetResult,
274
+ CodingProviderAccount: () => CodingProviderAccount,
272
275
  CodingProviderBinary: () => CodingProviderBinary,
273
276
  CodingProviderName: () => CodingProviderName,
274
277
  CodingProviderProblem: () => CodingProviderProblem,
@@ -287,6 +290,7 @@ __export(src_exports, {
287
290
  CodingRunUsage: () => CodingRunUsage,
288
291
  CodingRunsListParams: () => CodingRunsListParams,
289
292
  CodingRunsListResult: () => CodingRunsListResult,
293
+ CodingSearchHit: () => CodingSearchHit,
290
294
  CodingSearchParams: () => CodingSearchParams,
291
295
  CodingSearchResult: () => CodingSearchResult,
292
296
  CodingSendParams: () => CodingSendParams,
@@ -897,7 +901,7 @@ module.exports = __toCommonJS(src_exports);
897
901
  var import_zod = require("zod");
898
902
  var import_uuid = require("@ai-matrx/kit/uuid");
899
903
  var PROTOCOL_MAJOR = 1;
900
- var PROTOCOL_MINOR = 56;
904
+ var PROTOCOL_MINOR = 58;
901
905
  var PROTOCOL_VERSION = `${PROTOCOL_MAJOR}.${PROTOCOL_MINOR}`;
902
906
  var ProtocolVersion = import_zod.z.string().regex(/^[1-9][0-9]{0,2}\.[0-9]{1,3}$/);
903
907
  var RequestId = import_zod.z.string().min(1).max(64).regex(/^[A-Za-z0-9_-]+$/);
@@ -1800,8 +1804,17 @@ var ModelsLlmStatusResult = import_zod10.z.strictObject({
1800
1804
  /** Why the last start or download failed, one human line; null otherwise. */
1801
1805
  error: import_zod10.z.string().max(300).nullable()
1802
1806
  });
1803
- var ModelsLlmInstallParams = import_zod10.z.strictObject({ model: TextModelId });
1804
- var ModelsLlmInstallResult = import_zod10.z.strictObject({ model: TextModelId, elapsed_ms: nonNegInt });
1807
+ var ModelsLlmInstallParams = import_zod10.z.strictObject({
1808
+ model: TextModelId,
1809
+ /** (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. */
1810
+ hf_token: import_zod10.z.string().min(8).max(512).optional()
1811
+ });
1812
+ var ModelsLlmInstallResult = import_zod10.z.strictObject({
1813
+ model: TextModelId,
1814
+ elapsed_ms: nonNegInt,
1815
+ /** (1.58) path -> SHA-256 of every file whose catalog sha256 was null, hashed on this first download. */
1816
+ hashed: import_zod10.z.record(import_zod10.z.string().max(512), import_zod10.z.string().regex(/^[0-9a-f]{64}$/)).optional()
1817
+ });
1805
1818
  var ModelsLlmStartParams = import_zod10.z.strictObject({
1806
1819
  model: TextModelId,
1807
1820
  /** Tokens of context, from the knob desktop.models/context_length. Omitted today means the service's fixed 4096 (optional until callers send it). */
@@ -1823,7 +1836,11 @@ var CatalogFile = import_zod10.z.strictObject({
1823
1836
  /** The pinned https URL it is downloaded from. */
1824
1837
  url: import_zod10.z.string().url().max(2048),
1825
1838
  size_bytes: nonNegInt,
1826
- sha256: Sha256Hex,
1839
+ /**
1840
+ * The file's SHA-256; (1.58) null when its source publishes none (a small non-LFS file on Hugging
1841
+ * Face): the first download hashes it and reports it in `models.llm.install`'s `hashed`.
1842
+ */
1843
+ sha256: Sha256Hex.nullable(),
1827
1844
  /** weights, weights_shard, mmproj, config, tokenizer, … (ai.model_artifact.role). */
1828
1845
  role: import_zod10.z.string().max(32)
1829
1846
  });
@@ -4226,7 +4243,12 @@ var CodingSessionRecord = import_zod34.z.strictObject({
4226
4243
  lastRunStatus: CodingRunStatus.nullable(),
4227
4244
  queued: import_zod34.z.array(import_zod34.z.string().max(1048576)).max(100),
4228
4245
  agent: CodingSessionAgent.nullable(),
4229
- agentRemovedDue: import_zod34.z.boolean()
4246
+ agentRemovedDue: import_zod34.z.boolean(),
4247
+ /**
4248
+ * (1.57) Claude Code: the account the record belongs to (Accounts' profile id): the one a session
4249
+ * runs as, or whose config directory holds the chat. Absent: the default sign-in.
4250
+ */
4251
+ accountId: import_zod34.z.string().min(1).max(64).optional()
4230
4252
  });
4231
4253
  var CodingActiveElsewhere = import_zod34.z.strictObject({
4232
4254
  reason: import_zod34.z.enum(["process", "recent-write", "open-tool-call", "open"]),
@@ -4248,7 +4270,12 @@ var CodingDiscoveredChat = import_zod34.z.strictObject({
4248
4270
  unavailable: ShortText.nullable(),
4249
4271
  updatedAt: IsoTime,
4250
4272
  source: import_zod34.z.string().max(60).nullable(),
4251
- activeElsewhere: CodingActiveElsewhere.nullable()
4273
+ activeElsewhere: CodingActiveElsewhere.nullable(),
4274
+ /**
4275
+ * (1.57) Claude Code: the account the record belongs to (Accounts' profile id): the one a session
4276
+ * runs as, or whose config directory holds the chat. Absent: the default sign-in.
4277
+ */
4278
+ accountId: import_zod34.z.string().min(1).max(64).optional()
4252
4279
  });
4253
4280
  var CodingTranscriptItem = import_zod34.z.discriminatedUnion("kind", [
4254
4281
  import_zod34.z.strictObject({ kind: import_zod34.z.literal("user"), id: import_zod34.z.string().max(200), text: import_zod34.z.string(), at: IsoTime.nullable() }),
@@ -4288,6 +4315,31 @@ var CodingProviderProblem = import_zod34.z.strictObject({
4288
4315
  until: import_zod34.z.string().max(120).nullable(),
4289
4316
  at: IsoTime
4290
4317
  });
4318
+ var CodingAccountUsage = import_zod34.z.strictObject({
4319
+ windows: import_zod34.z.array(CodingQuotaWindow).max(20),
4320
+ /** The provider's own status word ("allowed", "allowed_warning", "rejected"...), when it gives one. */
4321
+ status: import_zod34.z.string().max(60).nullable(),
4322
+ /** When a rejected status lifts (ISO), when the provider says. */
4323
+ resetsAt: import_zod34.z.string().max(80).nullable(),
4324
+ at: IsoTime
4325
+ });
4326
+ var CodingContinueTarget = import_zod34.z.strictObject({
4327
+ accountId: import_zod34.z.string().min(1).max(64).nullable(),
4328
+ label: import_zod34.z.string().max(200)
4329
+ });
4330
+ var CodingProviderAccount = import_zod34.z.strictObject({
4331
+ id: import_zod34.z.string().min(1).max(64),
4332
+ label: import_zod34.z.string().max(200),
4333
+ /** (1.57) No known usage limit or expired sign-in on this account. Absent: not read. */
4334
+ ready: import_zod34.z.boolean().optional(),
4335
+ lastProblem: CodingProviderProblem.optional(),
4336
+ problem: ShortText.optional(),
4337
+ fix: ShortText.optional(),
4338
+ /** (1.57) Absent: never seen ("No usage data yet"). */
4339
+ usage: CodingAccountUsage.optional(),
4340
+ /** (1.57) This account is limited and that other one is not: "Continue on <label>". */
4341
+ continueOn: CodingContinueTarget.optional()
4342
+ });
4291
4343
  var CodingProviderBinary = import_zod34.z.strictObject({
4292
4344
  path: LocalPath,
4293
4345
  version: import_zod34.z.string().max(80).nullable(),
@@ -4324,9 +4376,13 @@ var CodingProviderStatus = import_zod34.z.strictObject({
4324
4376
  * can use, as the computer's engine lists them; New session offers them beside the default sign-in.
4325
4377
  * Absent: only the default sign-in (or a computer older than 1.53).
4326
4378
  */
4327
- accounts: import_zod34.z.array(import_zod34.z.strictObject({ id: import_zod34.z.string().min(1).max(64), label: import_zod34.z.string().max(200) })).max(100).optional(),
4379
+ accounts: import_zod34.z.array(CodingProviderAccount).max(100).optional(),
4328
4380
  /** (1.53) The computer tried to list `accounts` and could not: a short sentence the form shows with a retry. */
4329
- accountsProblem: ShortText.optional()
4381
+ accountsProblem: ShortText.optional(),
4382
+ /** (1.57) The default sign-in's usage as last seen. Absent: never seen ("No usage data yet"). */
4383
+ usage: CodingAccountUsage.optional(),
4384
+ /** (1.57) The default sign-in is limited and this other account is not: "Continue on <label>". */
4385
+ continueOn: CodingContinueTarget.optional()
4330
4386
  });
4331
4387
  var CodingChatPreference = import_zod34.z.strictObject({
4332
4388
  title: import_zod34.z.string().max(500).nullable(),
@@ -4353,7 +4409,12 @@ var CodingRecentRow = import_zod34.z.strictObject({
4353
4409
  state: import_zod34.z.enum(["running", "needs_attention", "new_output", "elsewhere", "idle"]),
4354
4410
  stateLabel: import_zod34.z.string().max(120).nullable(),
4355
4411
  pinned: import_zod34.z.boolean(),
4356
- startedBy: CodingStartedBy.nullable()
4412
+ startedBy: CodingStartedBy.nullable(),
4413
+ /**
4414
+ * (1.57) Claude Code: the account the record belongs to (Accounts' profile id): the one a session
4415
+ * runs as, or whose config directory holds the chat. Absent: the default sign-in.
4416
+ */
4417
+ accountId: import_zod34.z.string().min(1).max(64).optional()
4357
4418
  });
4358
4419
  var CodingFolderCheck = import_zod34.z.strictObject({
4359
4420
  path: import_zod34.z.string().max(4096),
@@ -4486,19 +4547,23 @@ var CodingSearchParams = import_zod34.z.strictObject({
4486
4547
  cursor: nonNegInt.optional(),
4487
4548
  limit: import_zod34.z.int().min(1).max(100).optional()
4488
4549
  });
4550
+ var CodingSearchHit = import_zod34.z.strictObject({
4551
+ provider: CodingProviderName,
4552
+ providerSessionId: SessionKey,
4553
+ title: import_zod34.z.string().max(500),
4554
+ cwd: LocalPath.nullable(),
4555
+ updatedAt: IsoTime,
4556
+ where: import_zod34.z.enum(["title", "content"]),
4557
+ snippet: import_zod34.z.string().max(2e3).nullable(),
4558
+ /**
4559
+ * (1.57) Claude Code: the account the record belongs to (Accounts' profile id): the one a session
4560
+ * runs as, or whose config directory holds the chat. Absent: the default sign-in.
4561
+ */
4562
+ accountId: import_zod34.z.string().min(1).max(64).optional()
4563
+ });
4489
4564
  var CodingSearchResult = import_zod34.z.strictObject({
4490
4565
  query: import_zod34.z.string().max(500),
4491
- hits: import_zod34.z.array(
4492
- import_zod34.z.strictObject({
4493
- provider: CodingProviderName,
4494
- providerSessionId: SessionKey,
4495
- title: import_zod34.z.string().max(500),
4496
- cwd: LocalPath.nullable(),
4497
- updatedAt: IsoTime,
4498
- where: import_zod34.z.enum(["title", "content"]),
4499
- snippet: import_zod34.z.string().max(2e3).nullable()
4500
- })
4501
- ),
4566
+ hits: import_zod34.z.array(CodingSearchHit),
4502
4567
  scanned: nonNegInt,
4503
4568
  total: nonNegInt,
4504
4569
  nextCursor: nonNegInt.nullable()
@@ -5848,6 +5913,9 @@ var NAMED_SCHEMAS = {
5848
5913
  CodingQuotaWindow,
5849
5914
  CodingProviderProblem,
5850
5915
  CodingProviderBinary,
5916
+ CodingAccountUsage,
5917
+ CodingContinueTarget,
5918
+ CodingProviderAccount,
5851
5919
  CodingProviderStatus,
5852
5920
  CodingChatPreference,
5853
5921
  CodingTitleStatus,
@@ -5904,6 +5972,7 @@ var NAMED_SCHEMAS = {
5904
5972
  CodingRecentSeenParams,
5905
5973
  CodingRecentSeenResult,
5906
5974
  CodingSearchParams,
5975
+ CodingSearchHit,
5907
5976
  CodingSearchResult,
5908
5977
  CodingReconcileParams,
5909
5978
  CodingReconcileResult,
@@ -6469,7 +6538,12 @@ var FIELDS_SINCE = {
6469
6538
  WindowInfo: { app: "1.7", pid: "1.7" },
6470
6539
  AppWindowInfo: { remote_control: "1.50" },
6471
6540
  WindowRemoteControl: { problem: "1.52" },
6472
- CodingProviderStatus: { accounts: "1.53", accountsProblem: "1.53" },
6541
+ CodingProviderStatus: { accounts: "1.53", accountsProblem: "1.53", usage: "1.57", continueOn: "1.57" },
6542
+ CodingProviderAccount: { ready: "1.57", lastProblem: "1.57", problem: "1.57", fix: "1.57", usage: "1.57", continueOn: "1.57" },
6543
+ CodingSessionRecord: { accountId: "1.57" },
6544
+ CodingDiscoveredChat: { accountId: "1.57" },
6545
+ CodingRecentRow: { accountId: "1.57" },
6546
+ CodingSearchHit: { accountId: "1.57" },
6473
6547
  AppsInstancesListParams: { fresh: "1.51" },
6474
6548
  AppsInstancesListResult: { as_of_ms: "1.51", refreshing: "1.51" },
6475
6549
  AppsAccountsListParams: { fresh: "1.51" },
@@ -6606,7 +6680,18 @@ var NESTED_RESULTS = /* @__PURE__ */ new Map([
6606
6680
  ["apps.projects.to_window", [["group", "ProjectMoveGroup"]]],
6607
6681
  ["apps.windows.list", [["windows", "AppWindowInfo"]]],
6608
6682
  ["apps.windows.set_remote_control", [["remote_control", "WindowRemoteControl"]]],
6609
- ["coding.providers", [["providers", "CodingProviderStatus"]]]
6683
+ ["coding.providers", [["providers", "CodingProviderStatus"]]],
6684
+ // 1.57: the account a coding record belongs to.
6685
+ ["coding.sessions.list", [["sessions", "CodingSessionRecord"], ["recent", "CodingRecentRow"]]],
6686
+ ["coding.recent.seen", [["recent", "CodingRecentRow"]]],
6687
+ ["coding.discover", [["chats", "CodingDiscoveredChat"]]],
6688
+ ["coding.search", [["hits", "CodingSearchHit"]]],
6689
+ ["coding.start", [["session", "CodingSessionRecord"]]],
6690
+ ["coding.send", [["session", "CodingSessionRecord"]]],
6691
+ ["coding.takeover", [["session", "CodingSessionRecord"]]],
6692
+ ["coding.options.set", [["session", "CodingSessionRecord"]]],
6693
+ ["coding.agent.set", [["session", "CodingSessionRecord"]]],
6694
+ ["coding.account.continue", [["session", "CodingSessionRecord"]]]
6610
6695
  ]);
6611
6696
  function stripNested(value, nested, version) {
6612
6697
  if (value === null || typeof value !== "object" || Array.isArray(value)) return value;
@@ -6642,15 +6727,24 @@ function windowListRemoteControlForPeer(value, version) {
6642
6727
  });
6643
6728
  return next.some((w, i) => w !== windows[i]) ? { ...body, windows: next } : value;
6644
6729
  }
6645
- function providersDefaultSourceForPeer(value, version) {
6646
- if (knows(version, "1.54") || value === null || typeof value !== "object") return value;
6730
+ function providersForPeer(value, version) {
6731
+ if (knows(version, "1.57") || value === null || typeof value !== "object") return value;
6647
6732
  const body = value;
6648
6733
  if (!Array.isArray(body.providers)) return value;
6649
6734
  const providers = body.providers;
6650
6735
  const next = providers.map((p) => {
6651
- const dm = p?.defaultModel;
6652
- if (dm === null || typeof dm !== "object" || dm.source !== "account") return p;
6653
- return { ...p, defaultModel: { ...dm, source: "driver" } };
6736
+ if (p === null || typeof p !== "object") return p;
6737
+ let out = p;
6738
+ const dm = out.defaultModel;
6739
+ if (!knows(version, "1.54") && dm !== null && typeof dm === "object" && dm.source === "account") {
6740
+ out = { ...out, defaultModel: { ...dm, source: "driver" } };
6741
+ }
6742
+ const accounts = out.accounts;
6743
+ if (Array.isArray(accounts)) {
6744
+ const kept = accounts.map((a) => strip(a, FIELDS_SINCE.CodingProviderAccount, version));
6745
+ if (kept.some((a, i) => a !== accounts[i])) out = { ...out, accounts: kept };
6746
+ }
6747
+ return out;
6654
6748
  });
6655
6749
  return next.some((p, i) => p !== providers[i]) ? { ...body, providers: next } : value;
6656
6750
  }
@@ -6681,7 +6775,7 @@ function forPeer(op, part, value, version) {
6681
6775
  const top = path ? strip(known, FIELDS_SINCE[path], version) : known;
6682
6776
  const nested = op ? NESTED_RESULTS.get(op) : void 0;
6683
6777
  const stripped = nested ? stripNested(top, nested, version) : top;
6684
- if (op === "coding.providers") return providersDefaultSourceForPeer(stripped, version);
6778
+ if (op === "coding.providers") return providersForPeer(stripped, version);
6685
6779
  return op === "apps.windows.list" ? windowListRemoteControlForPeer(stripped, version) : stripped;
6686
6780
  }
6687
6781
  if (value === null || typeof value !== "object") return value;
@@ -6699,7 +6793,7 @@ function forPeer(op, part, value, version) {
6699
6793
  var VERSIONED_RESULT_OPS = [.../* @__PURE__ */ new Set([...RESULT_PATH.keys(), ...WINDOW_RESULTS.keys(), ...NESTED_RESULTS.keys()])];
6700
6794
 
6701
6795
  // src/contract.ts
6702
- var CONTRACT_SHA256 = "14b79673133fb1625ab0320921b60ad595de3228bfae1337a73be3ed2d3e5a45";
6796
+ var CONTRACT_SHA256 = "ee1d6d3d83bb18a2ed020dbaf3c611b982699f9a9db8d728c38f2c6b8fbf0815";
6703
6797
 
6704
6798
  // src/close-policy.ts
6705
6799
  var CLOSE_RULES = {