@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.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 = 57;
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_-]+$/);
@@ -4226,7 +4230,12 @@ var CodingSessionRecord = import_zod34.z.strictObject({
4226
4230
  lastRunStatus: CodingRunStatus.nullable(),
4227
4231
  queued: import_zod34.z.array(import_zod34.z.string().max(1048576)).max(100),
4228
4232
  agent: CodingSessionAgent.nullable(),
4229
- agentRemovedDue: import_zod34.z.boolean()
4233
+ agentRemovedDue: import_zod34.z.boolean(),
4234
+ /**
4235
+ * (1.57) Claude Code: the account the record belongs to (Accounts' profile id): the one a session
4236
+ * runs as, or whose config directory holds the chat. Absent: the default sign-in.
4237
+ */
4238
+ accountId: import_zod34.z.string().min(1).max(64).optional()
4230
4239
  });
4231
4240
  var CodingActiveElsewhere = import_zod34.z.strictObject({
4232
4241
  reason: import_zod34.z.enum(["process", "recent-write", "open-tool-call", "open"]),
@@ -4248,7 +4257,12 @@ var CodingDiscoveredChat = import_zod34.z.strictObject({
4248
4257
  unavailable: ShortText.nullable(),
4249
4258
  updatedAt: IsoTime,
4250
4259
  source: import_zod34.z.string().max(60).nullable(),
4251
- activeElsewhere: CodingActiveElsewhere.nullable()
4260
+ activeElsewhere: CodingActiveElsewhere.nullable(),
4261
+ /**
4262
+ * (1.57) Claude Code: the account the record belongs to (Accounts' profile id): the one a session
4263
+ * runs as, or whose config directory holds the chat. Absent: the default sign-in.
4264
+ */
4265
+ accountId: import_zod34.z.string().min(1).max(64).optional()
4252
4266
  });
4253
4267
  var CodingTranscriptItem = import_zod34.z.discriminatedUnion("kind", [
4254
4268
  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 +4302,31 @@ var CodingProviderProblem = import_zod34.z.strictObject({
4288
4302
  until: import_zod34.z.string().max(120).nullable(),
4289
4303
  at: IsoTime
4290
4304
  });
4305
+ var CodingAccountUsage = import_zod34.z.strictObject({
4306
+ windows: import_zod34.z.array(CodingQuotaWindow).max(20),
4307
+ /** The provider's own status word ("allowed", "allowed_warning", "rejected"...), when it gives one. */
4308
+ status: import_zod34.z.string().max(60).nullable(),
4309
+ /** When a rejected status lifts (ISO), when the provider says. */
4310
+ resetsAt: import_zod34.z.string().max(80).nullable(),
4311
+ at: IsoTime
4312
+ });
4313
+ var CodingContinueTarget = import_zod34.z.strictObject({
4314
+ accountId: import_zod34.z.string().min(1).max(64).nullable(),
4315
+ label: import_zod34.z.string().max(200)
4316
+ });
4317
+ var CodingProviderAccount = import_zod34.z.strictObject({
4318
+ id: import_zod34.z.string().min(1).max(64),
4319
+ label: import_zod34.z.string().max(200),
4320
+ /** (1.57) No known usage limit or expired sign-in on this account. Absent: not read. */
4321
+ ready: import_zod34.z.boolean().optional(),
4322
+ lastProblem: CodingProviderProblem.optional(),
4323
+ problem: ShortText.optional(),
4324
+ fix: ShortText.optional(),
4325
+ /** (1.57) Absent: never seen ("No usage data yet"). */
4326
+ usage: CodingAccountUsage.optional(),
4327
+ /** (1.57) This account is limited and that other one is not: "Continue on <label>". */
4328
+ continueOn: CodingContinueTarget.optional()
4329
+ });
4291
4330
  var CodingProviderBinary = import_zod34.z.strictObject({
4292
4331
  path: LocalPath,
4293
4332
  version: import_zod34.z.string().max(80).nullable(),
@@ -4324,9 +4363,13 @@ var CodingProviderStatus = import_zod34.z.strictObject({
4324
4363
  * can use, as the computer's engine lists them; New session offers them beside the default sign-in.
4325
4364
  * Absent: only the default sign-in (or a computer older than 1.53).
4326
4365
  */
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(),
4366
+ accounts: import_zod34.z.array(CodingProviderAccount).max(100).optional(),
4328
4367
  /** (1.53) The computer tried to list `accounts` and could not: a short sentence the form shows with a retry. */
4329
- accountsProblem: ShortText.optional()
4368
+ accountsProblem: ShortText.optional(),
4369
+ /** (1.57) The default sign-in's usage as last seen. Absent: never seen ("No usage data yet"). */
4370
+ usage: CodingAccountUsage.optional(),
4371
+ /** (1.57) The default sign-in is limited and this other account is not: "Continue on <label>". */
4372
+ continueOn: CodingContinueTarget.optional()
4330
4373
  });
4331
4374
  var CodingChatPreference = import_zod34.z.strictObject({
4332
4375
  title: import_zod34.z.string().max(500).nullable(),
@@ -4353,7 +4396,12 @@ var CodingRecentRow = import_zod34.z.strictObject({
4353
4396
  state: import_zod34.z.enum(["running", "needs_attention", "new_output", "elsewhere", "idle"]),
4354
4397
  stateLabel: import_zod34.z.string().max(120).nullable(),
4355
4398
  pinned: import_zod34.z.boolean(),
4356
- startedBy: CodingStartedBy.nullable()
4399
+ startedBy: CodingStartedBy.nullable(),
4400
+ /**
4401
+ * (1.57) Claude Code: the account the record belongs to (Accounts' profile id): the one a session
4402
+ * runs as, or whose config directory holds the chat. Absent: the default sign-in.
4403
+ */
4404
+ accountId: import_zod34.z.string().min(1).max(64).optional()
4357
4405
  });
4358
4406
  var CodingFolderCheck = import_zod34.z.strictObject({
4359
4407
  path: import_zod34.z.string().max(4096),
@@ -4486,19 +4534,23 @@ var CodingSearchParams = import_zod34.z.strictObject({
4486
4534
  cursor: nonNegInt.optional(),
4487
4535
  limit: import_zod34.z.int().min(1).max(100).optional()
4488
4536
  });
4537
+ var CodingSearchHit = import_zod34.z.strictObject({
4538
+ provider: CodingProviderName,
4539
+ providerSessionId: SessionKey,
4540
+ title: import_zod34.z.string().max(500),
4541
+ cwd: LocalPath.nullable(),
4542
+ updatedAt: IsoTime,
4543
+ where: import_zod34.z.enum(["title", "content"]),
4544
+ snippet: import_zod34.z.string().max(2e3).nullable(),
4545
+ /**
4546
+ * (1.57) Claude Code: the account the record belongs to (Accounts' profile id): the one a session
4547
+ * runs as, or whose config directory holds the chat. Absent: the default sign-in.
4548
+ */
4549
+ accountId: import_zod34.z.string().min(1).max(64).optional()
4550
+ });
4489
4551
  var CodingSearchResult = import_zod34.z.strictObject({
4490
4552
  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
- ),
4553
+ hits: import_zod34.z.array(CodingSearchHit),
4502
4554
  scanned: nonNegInt,
4503
4555
  total: nonNegInt,
4504
4556
  nextCursor: nonNegInt.nullable()
@@ -5848,6 +5900,9 @@ var NAMED_SCHEMAS = {
5848
5900
  CodingQuotaWindow,
5849
5901
  CodingProviderProblem,
5850
5902
  CodingProviderBinary,
5903
+ CodingAccountUsage,
5904
+ CodingContinueTarget,
5905
+ CodingProviderAccount,
5851
5906
  CodingProviderStatus,
5852
5907
  CodingChatPreference,
5853
5908
  CodingTitleStatus,
@@ -5904,6 +5959,7 @@ var NAMED_SCHEMAS = {
5904
5959
  CodingRecentSeenParams,
5905
5960
  CodingRecentSeenResult,
5906
5961
  CodingSearchParams,
5962
+ CodingSearchHit,
5907
5963
  CodingSearchResult,
5908
5964
  CodingReconcileParams,
5909
5965
  CodingReconcileResult,
@@ -6469,7 +6525,12 @@ var FIELDS_SINCE = {
6469
6525
  WindowInfo: { app: "1.7", pid: "1.7" },
6470
6526
  AppWindowInfo: { remote_control: "1.50" },
6471
6527
  WindowRemoteControl: { problem: "1.52" },
6472
- CodingProviderStatus: { accounts: "1.53", accountsProblem: "1.53" },
6528
+ CodingProviderStatus: { accounts: "1.53", accountsProblem: "1.53", usage: "1.57", continueOn: "1.57" },
6529
+ CodingProviderAccount: { ready: "1.57", lastProblem: "1.57", problem: "1.57", fix: "1.57", usage: "1.57", continueOn: "1.57" },
6530
+ CodingSessionRecord: { accountId: "1.57" },
6531
+ CodingDiscoveredChat: { accountId: "1.57" },
6532
+ CodingRecentRow: { accountId: "1.57" },
6533
+ CodingSearchHit: { accountId: "1.57" },
6473
6534
  AppsInstancesListParams: { fresh: "1.51" },
6474
6535
  AppsInstancesListResult: { as_of_ms: "1.51", refreshing: "1.51" },
6475
6536
  AppsAccountsListParams: { fresh: "1.51" },
@@ -6606,7 +6667,18 @@ var NESTED_RESULTS = /* @__PURE__ */ new Map([
6606
6667
  ["apps.projects.to_window", [["group", "ProjectMoveGroup"]]],
6607
6668
  ["apps.windows.list", [["windows", "AppWindowInfo"]]],
6608
6669
  ["apps.windows.set_remote_control", [["remote_control", "WindowRemoteControl"]]],
6609
- ["coding.providers", [["providers", "CodingProviderStatus"]]]
6670
+ ["coding.providers", [["providers", "CodingProviderStatus"]]],
6671
+ // 1.57: the account a coding record belongs to.
6672
+ ["coding.sessions.list", [["sessions", "CodingSessionRecord"], ["recent", "CodingRecentRow"]]],
6673
+ ["coding.recent.seen", [["recent", "CodingRecentRow"]]],
6674
+ ["coding.discover", [["chats", "CodingDiscoveredChat"]]],
6675
+ ["coding.search", [["hits", "CodingSearchHit"]]],
6676
+ ["coding.start", [["session", "CodingSessionRecord"]]],
6677
+ ["coding.send", [["session", "CodingSessionRecord"]]],
6678
+ ["coding.takeover", [["session", "CodingSessionRecord"]]],
6679
+ ["coding.options.set", [["session", "CodingSessionRecord"]]],
6680
+ ["coding.agent.set", [["session", "CodingSessionRecord"]]],
6681
+ ["coding.account.continue", [["session", "CodingSessionRecord"]]]
6610
6682
  ]);
6611
6683
  function stripNested(value, nested, version) {
6612
6684
  if (value === null || typeof value !== "object" || Array.isArray(value)) return value;
@@ -6642,15 +6714,24 @@ function windowListRemoteControlForPeer(value, version) {
6642
6714
  });
6643
6715
  return next.some((w, i) => w !== windows[i]) ? { ...body, windows: next } : value;
6644
6716
  }
6645
- function providersDefaultSourceForPeer(value, version) {
6646
- if (knows(version, "1.54") || value === null || typeof value !== "object") return value;
6717
+ function providersForPeer(value, version) {
6718
+ if (knows(version, "1.57") || value === null || typeof value !== "object") return value;
6647
6719
  const body = value;
6648
6720
  if (!Array.isArray(body.providers)) return value;
6649
6721
  const providers = body.providers;
6650
6722
  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" } };
6723
+ if (p === null || typeof p !== "object") return p;
6724
+ let out = p;
6725
+ const dm = out.defaultModel;
6726
+ if (!knows(version, "1.54") && dm !== null && typeof dm === "object" && dm.source === "account") {
6727
+ out = { ...out, defaultModel: { ...dm, source: "driver" } };
6728
+ }
6729
+ const accounts = out.accounts;
6730
+ if (Array.isArray(accounts)) {
6731
+ const kept = accounts.map((a) => strip(a, FIELDS_SINCE.CodingProviderAccount, version));
6732
+ if (kept.some((a, i) => a !== accounts[i])) out = { ...out, accounts: kept };
6733
+ }
6734
+ return out;
6654
6735
  });
6655
6736
  return next.some((p, i) => p !== providers[i]) ? { ...body, providers: next } : value;
6656
6737
  }
@@ -6681,7 +6762,7 @@ function forPeer(op, part, value, version) {
6681
6762
  const top = path ? strip(known, FIELDS_SINCE[path], version) : known;
6682
6763
  const nested = op ? NESTED_RESULTS.get(op) : void 0;
6683
6764
  const stripped = nested ? stripNested(top, nested, version) : top;
6684
- if (op === "coding.providers") return providersDefaultSourceForPeer(stripped, version);
6765
+ if (op === "coding.providers") return providersForPeer(stripped, version);
6685
6766
  return op === "apps.windows.list" ? windowListRemoteControlForPeer(stripped, version) : stripped;
6686
6767
  }
6687
6768
  if (value === null || typeof value !== "object") return value;
@@ -6699,7 +6780,7 @@ function forPeer(op, part, value, version) {
6699
6780
  var VERSIONED_RESULT_OPS = [.../* @__PURE__ */ new Set([...RESULT_PATH.keys(), ...WINDOW_RESULTS.keys(), ...NESTED_RESULTS.keys()])];
6700
6781
 
6701
6782
  // src/contract.ts
6702
- var CONTRACT_SHA256 = "14b79673133fb1625ab0320921b60ad595de3228bfae1337a73be3ed2d3e5a45";
6783
+ var CONTRACT_SHA256 = "ee1d6d3d83bb18a2ed020dbaf3c611b982699f9a9db8d728c38f2c6b8fbf0815";
6703
6784
 
6704
6785
  // src/close-policy.ts
6705
6786
  var CLOSE_RULES = {