@get-bb/plugin-sdk 0.6.80 → 0.6.90

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.
@@ -173,14 +173,27 @@ function writeBase(store, collection, id, update) {
173
173
  collection.base.set(id, next);
174
174
  changed(store, collection, [id]);
175
175
  }
176
+ function dropAccepted(collection, id, acceptedBefore) {
177
+ let dropped = false;
178
+ collection.layers = collection.layers.filter((layer) => {
179
+ if (layer.acceptedAt === null || layer.acceptedAt >= acceptedBefore || !layer.ids.has(id))
180
+ return true;
181
+ dropped = true;
182
+ layer.ids.delete(id);
183
+ return layer.ids.size > 0;
184
+ });
185
+ return dropped;
186
+ }
176
187
  function ingest(store, skeleton, id, item, readStart) {
177
- const fresh = readStart > (skeleton.collection.acknowledgedAt.get(id) ?? -1);
188
+ const { collection } = skeleton;
189
+ const fresh = readStart > (collection.acknowledgedAt.get(id) ?? -1);
178
190
  writeBase(
179
191
  store,
180
- skeleton.collection,
192
+ collection,
181
193
  id,
182
194
  (current) => skeleton.view.read(item, current, fresh)
183
195
  );
196
+ if (dropAccepted(collection, id, readStart)) changed(store, collection, [id]);
184
197
  }
185
198
  function materializeItem(store, view, item, entity) {
186
199
  if (!isObject(item) || !isObject(entity)) return view.render(item, entity);
@@ -285,6 +298,7 @@ function setSkeleton(store, query, skeleton) {
285
298
  collection.views.delete(id);
286
299
  collection.base.delete(id);
287
300
  collection.visible.delete(id);
301
+ dropAccepted(collection, id, Number.POSITIVE_INFINITY);
288
302
  }
289
303
  }
290
304
  }
@@ -480,44 +494,24 @@ function recordKeyedRead(client, queryKey, startedAt) {
480
494
  const query = client.getQueryCache().get(client.defaultQueryOptions({ queryKey }).queryHash);
481
495
  if (query !== void 0) storeOf(client).receipts.set(query, startedAt);
482
496
  }
483
- function bakeSettledLayers(collection) {
484
- const baked = /* @__PURE__ */ new Set();
485
- const pending = /* @__PURE__ */ new Set();
486
- collection.layers = collection.layers.filter((layer) => {
487
- const blocked = [...layer.ids].some((id) => pending.has(id));
488
- if (!layer.settled || blocked) {
489
- for (const id of layer.ids) pending.add(id);
490
- return true;
491
- }
492
- for (const id of layer.ids) {
493
- const current = collection.base.get(id);
494
- if (current !== void 0)
495
- collection.base.set(id, layer.apply(current, id));
496
- baked.add(id);
497
- }
498
- return false;
499
- });
500
- return baked;
501
- }
502
497
  function predictKeyed(client, token, ids, apply) {
503
498
  const store = storeOf(client);
504
499
  const collection = collectionOf(store, token);
505
- const layer = { ids, apply, settled: false };
500
+ const layer = { ids: new Set(ids), apply, acceptedAt: null };
506
501
  collection.layers.push(layer);
507
502
  changed(store, collection, ids);
508
- const live = () => !layer.settled && collection.layers.includes(layer);
503
+ const live = () => layer.acceptedAt === null && collection.layers.includes(layer);
509
504
  return {
510
505
  accept() {
511
506
  if (!live()) return;
512
507
  const at = tick();
513
508
  for (const id of ids) collection.acknowledgedAt.set(id, at);
514
- layer.settled = true;
515
- changed(store, collection, [...ids, ...bakeSettledLayers(collection)]);
509
+ layer.acceptedAt = at;
516
510
  },
517
511
  remove() {
518
512
  if (!live()) return;
519
513
  collection.layers = collection.layers.filter((other) => other !== layer);
520
- changed(store, collection, [...ids, ...bakeSettledLayers(collection)]);
514
+ changed(store, collection, ids);
521
515
  }
522
516
  };
523
517
  }
@@ -1121,7 +1115,7 @@ function createTaggedKeyedQueryOwner(options) {
1121
1115
  queryFn: () => {
1122
1116
  let previous = getTaggedReadData(client, queryKey);
1123
1117
  const startedAt = /* @__PURE__ */ new Map();
1124
- let refresh = !missingOnly && dirtyKeys.size === 0;
1118
+ let refresh = !missingOnly && ![...keys.keys()].some((key) => dirtyKeys.has(key));
1125
1119
  missingOnly = false;
1126
1120
  const refreshedKeys = /* @__PURE__ */ new Set();
1127
1121
  let refreshedAll = false;
@@ -1130,13 +1124,18 @@ function createTaggedKeyedQueryOwner(options) {
1130
1124
  const all = refreshAll || refresh;
1131
1125
  refresh = false;
1132
1126
  const dirty = new Set(dirtyKeys);
1133
- for (const key of dirty) refreshedKeys.add(key);
1134
1127
  refreshedAll ||= all;
1135
- dirtyKeys.clear();
1128
+ if (all)
1129
+ for (const key of Object.keys(previous?.result ?? {}))
1130
+ dirtyKeys.add(key);
1136
1131
  refreshAll = false;
1137
1132
  const requested = subscribed.filter(
1138
1133
  (key) => all || dirty.has(key) || !Object.hasOwn(previous?.result ?? {}, key)
1139
1134
  );
1135
+ for (const key of requested) {
1136
+ refreshedKeys.add(key);
1137
+ dirtyKeys.delete(key);
1138
+ }
1140
1139
  readingKeys = new Set(requested);
1141
1140
  const started = tick();
1142
1141
  try {
@@ -1153,7 +1152,7 @@ function createTaggedKeyedQueryOwner(options) {
1153
1152
  }
1154
1153
  )
1155
1154
  );
1156
- const retained = (key) => !all && !dirty.has(key) && !readingKeys.has(key);
1155
+ const retained = (key) => !readingKeys.has(key);
1157
1156
  for (const key of requested) startedAt.set(key, started);
1158
1157
  previous = {
1159
1158
  result: Object.fromEntries([
@@ -1193,6 +1192,15 @@ function createTaggedKeyedQueryOwner(options) {
1193
1192
  let stop;
1194
1193
  return {
1195
1194
  observer,
1195
+ async refetchKeys(requested) {
1196
+ const subscribed = requested.filter((key) => keys.has(key));
1197
+ if (subscribed.length === 0) return;
1198
+ for (const key of subscribed) dirtyKeys.add(key);
1199
+ if (observer.getCurrentResult().isFetching) {
1200
+ restartTaggedRead(observer.getCurrentQuery());
1201
+ }
1202
+ await observer.refetch({ cancelRefetch: false });
1203
+ },
1196
1204
  subscribe(requested, listener) {
1197
1205
  let added = false;
1198
1206
  for (const key of requested) {
@@ -1200,8 +1208,8 @@ function createTaggedKeyedQueryOwner(options) {
1200
1208
  keys.set(key, (keys.get(key) ?? 0) + 1);
1201
1209
  }
1202
1210
  const cached = getTaggedReadData(client, queryKey);
1203
- const missing = requested.filter(
1204
- (key) => !Object.hasOwn(cached?.result ?? {}, key)
1211
+ const pending = requested.filter(
1212
+ (key) => dirtyKeys.has(key) || !Object.hasOwn(cached?.result ?? {}, key)
1205
1213
  );
1206
1214
  if (!stop) missingOnly = cached === void 0;
1207
1215
  listeners.add(listener);
@@ -1210,9 +1218,9 @@ function createTaggedKeyedQueryOwner(options) {
1210
1218
  for (const notify of listeners) notify();
1211
1219
  });
1212
1220
  }
1213
- if (added && missing.length > 0) {
1221
+ if (added && pending.length > 0) {
1214
1222
  if (observer.getCurrentResult().isFetching) {
1215
- if (readingKeys.size > 0 && missing.some((key) => !readingKeys.has(key)))
1223
+ if (readingKeys.size > 0 && pending.some((key) => !readingKeys.has(key)))
1216
1224
  restartTaggedRead(observer.getCurrentQuery());
1217
1225
  } else {
1218
1226
  missingOnly = true;
@@ -1501,107 +1509,12 @@ var projectExecutionDefaultsSchema = z2.object({
1501
1509
  permissionMode: permissionModeSchema
1502
1510
  });
1503
1511
 
1504
- // ../domain/src/git-checkout.ts
1512
+ // ../domain/src/plugin-id.ts
1505
1513
  import { z as z3 } from "zod";
1506
- var gitBranchForbiddenCharacterPattern = /[\u0000-\u001f\u007f\\:~^?*\[]/u;
1507
- var gitBranchWhitespacePattern = /[ \t]/u;
1508
- var gitReservedBranchNames = /* @__PURE__ */ new Set([
1509
- "AUTO_MERGE",
1510
- "BISECT_HEAD",
1511
- "CHERRY_PICK_HEAD",
1512
- "FETCH_HEAD",
1513
- "HEAD",
1514
- "MERGE_HEAD",
1515
- "ORIG_HEAD",
1516
- "REVERT_HEAD"
1517
- ]);
1518
- function isValidGitBranchName(name) {
1519
- const components = name.split("/");
1520
- return name.length > 0 && name.trim().length > 0 && !name.startsWith("-") && !name.startsWith("/") && name !== "@" && !gitReservedBranchNames.has(name) && !gitBranchForbiddenCharacterPattern.test(name) && !gitBranchWhitespacePattern.test(name) && !name.includes("..") && !name.includes("@{") && !name.includes("//") && !name.endsWith("/") && !name.endsWith(".") && components.every(
1521
- (component) => component.length > 0 && !component.startsWith(".") && !component.endsWith(".lock")
1522
- );
1523
- }
1524
- var gitBranchNameSchema = z3.string().refine(isValidGitBranchName, { message: "Invalid git branch name" });
1525
- var gitBranchSelectionSchema = z3.discriminatedUnion("kind", [
1526
- z3.object({ kind: z3.literal("named"), name: gitBranchNameSchema }),
1527
- z3.object({ kind: z3.literal("default") })
1528
- ]);
1529
- var gitCheckoutRefSchema = z3.discriminatedUnion("kind", [
1530
- z3.object({
1531
- kind: z3.literal("branch"),
1532
- branchName: z3.string().min(1),
1533
- headSha: z3.string().min(1).nullable()
1534
- }),
1535
- z3.object({
1536
- kind: z3.literal("detached"),
1537
- headSha: z3.string().min(1).nullable()
1538
- }),
1539
- z3.object({
1540
- kind: z3.literal("unborn"),
1541
- branchName: z3.string().min(1).nullable()
1542
- }),
1543
- z3.object({
1544
- kind: z3.literal("unknown"),
1545
- reason: z3.string().min(1)
1546
- })
1547
- ]);
1548
- var workspaceGitOperationSchema = z3.discriminatedUnion("kind", [
1549
- z3.object({ kind: z3.literal("none") }),
1550
- z3.object({
1551
- kind: z3.literal("merge"),
1552
- hasConflicts: z3.boolean()
1553
- }),
1554
- z3.object({
1555
- kind: z3.literal("rebase"),
1556
- hasConflicts: z3.boolean()
1557
- }),
1558
- z3.object({
1559
- kind: z3.literal("cherry-pick"),
1560
- hasConflicts: z3.boolean()
1561
- }),
1562
- z3.object({
1563
- kind: z3.literal("revert"),
1564
- hasConflicts: z3.boolean()
1565
- }),
1566
- z3.object({
1567
- kind: z3.literal("unknown"),
1568
- reason: z3.string().min(1),
1569
- hasConflicts: z3.boolean()
1570
- })
1571
- ]);
1572
- var gitBranchRefClassificationSchema = z3.object({
1573
- name: z3.string().min(1),
1574
- kind: z3.enum(["local", "remote", "missing"])
1575
- });
1576
- var defaultBranchRelationSchema = z3.enum([
1577
- "equal",
1578
- "local-behind",
1579
- "local-ahead",
1580
- "diverged",
1581
- "unknown"
1582
- ]);
1583
- var gitSourceInspectionSchema = z3.object({
1584
- checkout: gitCheckoutRefSchema,
1585
- defaultBranch: z3.string().min(1).nullable(),
1586
- isWorktree: z3.boolean(),
1587
- defaultBranchRelation: defaultBranchRelationSchema.nullable(),
1588
- hasUncommittedChanges: z3.boolean(),
1589
- operation: workspaceGitOperationSchema,
1590
- originDefaultBranch: z3.string().min(1).nullable()
1591
- });
1592
- var gitBranchOptionsSchema = z3.object({
1593
- branches: z3.array(z3.string()),
1594
- branchesTruncated: z3.boolean(),
1595
- remoteBranches: z3.array(z3.string()),
1596
- remoteBranchesTruncated: z3.boolean(),
1597
- selectedBranch: gitBranchRefClassificationSchema.nullable()
1598
- });
1599
- var projectSourceCheckoutSchema = gitSourceInspectionSchema.extend(
1600
- gitBranchOptionsSchema.shape
1601
- );
1514
+ var pluginIdSchema = z3.string().regex(/^[a-z0-9][a-z0-9-]*$/u);
1602
1515
 
1603
1516
  // ../domain/src/change-kinds.ts
1604
- import { z as z18 } from "zod";
1517
+ import { z as z17 } from "zod";
1605
1518
 
1606
1519
  // ../domain/src/thread-event-types.ts
1607
1520
  import { z as z4 } from "zod";
@@ -1669,7 +1582,7 @@ var threadEventTypeSchema = z4.string().refine(
1669
1582
  );
1670
1583
 
1671
1584
  // ../domain/src/thread.ts
1672
- import { z as z17 } from "zod";
1585
+ import { z as z16 } from "zod";
1673
1586
 
1674
1587
  // ../domain/src/thread-create-origin.ts
1675
1588
  import { z as z5 } from "zod";
@@ -1762,18 +1675,14 @@ var environmentSchema = z6.object({
1762
1675
  });
1763
1676
 
1764
1677
  // ../domain/src/queued-message.ts
1765
- import { z as z10 } from "zod";
1766
-
1767
- // ../domain/src/plugin-id.ts
1768
- import { z as z7 } from "zod";
1769
- var pluginIdSchema = z7.string().regex(/^[a-z0-9][a-z0-9-]*$/u);
1678
+ import { z as z9 } from "zod";
1770
1679
 
1771
1680
  // ../domain/src/protocol-ids.ts
1772
- import { z as z8 } from "zod";
1773
- var clientTurnRequestIdSchema = z8.string().regex(/^creq_[23456789abcdefghijkmnpqrstuvwxyz]{10}$/u);
1681
+ import { z as z7 } from "zod";
1682
+ var clientTurnRequestIdSchema = z7.string().regex(/^creq_[23456789abcdefghijkmnpqrstuvwxyz]{10}$/u);
1774
1683
 
1775
1684
  // ../domain/src/system-message.ts
1776
- import { z as z9 } from "zod";
1685
+ import { z as z8 } from "zod";
1777
1686
  var systemMessageKindValues = [
1778
1687
  "ownership-assigned",
1779
1688
  "ownership-removed",
@@ -1786,41 +1695,41 @@ var systemMessageKindValues = [
1786
1695
  "environment-directory-updated",
1787
1696
  "unlabeled"
1788
1697
  ];
1789
- var systemMessageKindSchema = z9.enum(systemMessageKindValues);
1790
- var systemThreadInterruptedReasonSchema = z9.enum([
1698
+ var systemMessageKindSchema = z8.enum(systemMessageKindValues);
1699
+ var systemThreadInterruptedReasonSchema = z8.enum([
1791
1700
  "manual-stop",
1792
1701
  "host-daemon-restarted",
1793
1702
  "host-removed",
1794
1703
  "provider-turn-idle"
1795
1704
  ]);
1796
- var childThreadOutcomeSchema = z9.object({
1797
- threadId: z9.string(),
1798
- status: z9.enum(["completed", "failed", "interrupted"]),
1799
- interruption: z9.object({
1705
+ var childThreadOutcomeSchema = z8.object({
1706
+ threadId: z8.string(),
1707
+ status: z8.enum(["completed", "failed", "interrupted"]),
1708
+ interruption: z8.object({
1800
1709
  reason: systemThreadInterruptedReasonSchema,
1801
- cause: z9.literal("host-connection-lost").optional()
1710
+ cause: z8.literal("host-connection-lost").optional()
1802
1711
  }).optional()
1803
1712
  });
1804
- var systemMessageSubjectSchema = z9.discriminatedUnion("kind", [
1805
- z9.object({
1806
- kind: z9.literal("thread"),
1807
- threadId: z9.string(),
1808
- threadName: z9.string(),
1809
- outcomes: z9.array(childThreadOutcomeSchema).optional()
1713
+ var systemMessageSubjectSchema = z8.discriminatedUnion("kind", [
1714
+ z8.object({
1715
+ kind: z8.literal("thread"),
1716
+ threadId: z8.string(),
1717
+ threadName: z8.string(),
1718
+ outcomes: z8.array(childThreadOutcomeSchema).optional()
1810
1719
  }),
1811
- z9.object({
1812
- kind: z9.literal("thread-batch"),
1813
- count: z9.number(),
1814
- outcomes: z9.array(childThreadOutcomeSchema).optional()
1720
+ z8.object({
1721
+ kind: z8.literal("thread-batch"),
1722
+ count: z8.number(),
1723
+ outcomes: z8.array(childThreadOutcomeSchema).optional()
1815
1724
  }),
1816
- z9.object({
1817
- kind: z9.literal("tool-call"),
1818
- toolName: z9.string(),
1819
- suppress: z9.boolean()
1725
+ z8.object({
1726
+ kind: z8.literal("tool-call"),
1727
+ toolName: z8.string(),
1728
+ suppress: z8.boolean()
1820
1729
  }),
1821
- z9.object({
1822
- kind: z9.literal("directory"),
1823
- path: z9.string()
1730
+ z8.object({
1731
+ kind: z8.literal("directory"),
1732
+ path: z8.string()
1824
1733
  })
1825
1734
  ]);
1826
1735
 
@@ -1835,44 +1744,44 @@ var queuedMessageWaitingOnKindValues = [
1835
1744
  "interaction",
1836
1745
  "plugin"
1837
1746
  ];
1838
- var queuedMessageWaitingOnKindSchema = z10.enum(
1747
+ var queuedMessageWaitingOnKindSchema = z9.enum(
1839
1748
  queuedMessageWaitingOnKindValues
1840
1749
  );
1841
- var queuedMessageWaitHostNameSchema = z10.string().min(1).max(200);
1750
+ var queuedMessageWaitHostNameSchema = z9.string().min(1).max(200);
1842
1751
  var QUEUED_MESSAGE_WAIT_REASON_MAX_LENGTH = 200;
1843
- var queuedMessageWaitReasonSchema = z10.string().min(1).max(QUEUED_MESSAGE_WAIT_REASON_MAX_LENGTH);
1844
- var queuedMessageWaitingOnSchema = z10.discriminatedUnion("kind", [
1845
- z10.object({ kind: z10.literal("time") }),
1846
- z10.object({ kind: z10.literal("thread-busy") }),
1847
- z10.object({ kind: z10.literal("stopping") }),
1848
- z10.object({ kind: z10.literal("turn-starting") }),
1849
- z10.object({ kind: z10.literal("provisioning") }),
1850
- z10.object({
1851
- kind: z10.literal("host-offline"),
1752
+ var queuedMessageWaitReasonSchema = z9.string().min(1).max(QUEUED_MESSAGE_WAIT_REASON_MAX_LENGTH);
1753
+ var queuedMessageWaitingOnSchema = z9.discriminatedUnion("kind", [
1754
+ z9.object({ kind: z9.literal("time") }),
1755
+ z9.object({ kind: z9.literal("thread-busy") }),
1756
+ z9.object({ kind: z9.literal("stopping") }),
1757
+ z9.object({ kind: z9.literal("turn-starting") }),
1758
+ z9.object({ kind: z9.literal("provisioning") }),
1759
+ z9.object({
1760
+ kind: z9.literal("host-offline"),
1852
1761
  hostName: queuedMessageWaitHostNameSchema
1853
1762
  }),
1854
- z10.object({ kind: z10.literal("interaction") }),
1855
- z10.object({
1856
- kind: z10.literal("plugin"),
1763
+ z9.object({ kind: z9.literal("interaction") }),
1764
+ z9.object({
1765
+ kind: z9.literal("plugin"),
1857
1766
  pluginId: pluginIdSchema,
1858
1767
  reason: queuedMessageWaitReasonSchema
1859
1768
  })
1860
1769
  ]);
1861
1770
  var QUEUED_MESSAGE_FAILURE_REASON_MAX_LENGTH = 200;
1862
- var queuedMessageFailureReasonSchema = z10.string().min(1).max(QUEUED_MESSAGE_FAILURE_REASON_MAX_LENGTH);
1771
+ var queuedMessageFailureReasonSchema = z9.string().min(1).max(QUEUED_MESSAGE_FAILURE_REASON_MAX_LENGTH);
1863
1772
  var QUEUED_MESSAGE_PLUGIN_WAIT_HOLDER_PREFIX = "plugin:";
1864
- var queuedMessageWaitHolderSchema = z10.templateLiteral([
1773
+ var queuedMessageWaitHolderSchema = z9.templateLiteral([
1865
1774
  QUEUED_MESSAGE_PLUGIN_WAIT_HOLDER_PREFIX,
1866
1775
  pluginIdSchema
1867
1776
  ]);
1868
1777
  var queuedMessagePayloadKindValues = ["inline", "retry"];
1869
- var queuedMessagePayloadKindSchema = z10.enum(
1778
+ var queuedMessagePayloadKindSchema = z9.enum(
1870
1779
  queuedMessagePayloadKindValues
1871
1780
  );
1872
- var queuedMessagePayloadSchema = z10.discriminatedUnion("kind", [
1873
- z10.object({ kind: z10.literal("inline") }),
1874
- z10.object({
1875
- kind: z10.literal("retry"),
1781
+ var queuedMessagePayloadSchema = z9.discriminatedUnion("kind", [
1782
+ z9.object({ kind: z9.literal("inline") }),
1783
+ z9.object({
1784
+ kind: z9.literal("retry"),
1876
1785
  /**
1877
1786
  * The ORIGINAL request, not the attempt that just failed. Retrying a retry
1878
1787
  * re-submits the same original blocks, so this id is carried forward
@@ -1880,7 +1789,7 @@ var queuedMessagePayloadSchema = z10.discriminatedUnion("kind", [
1880
1789
  */
1881
1790
  retryOfTurnRequestId: clientTurnRequestIdSchema,
1882
1791
  /** Which attempt this row will dispatch: 2 is the first retry. */
1883
- attempt: z10.number().int().min(2),
1792
+ attempt: z9.number().int().min(2),
1884
1793
  /**
1885
1794
  * Why this turn is being retried, in the retrier's words ("Rate limited"),
1886
1795
  * as the row's card and `bb thread queue list` render it.
@@ -1893,13 +1802,13 @@ var queuedMessagePayloadSchema = z10.discriminatedUnion("kind", [
1893
1802
  reason: queuedMessageWaitReasonSchema
1894
1803
  })
1895
1804
  ]);
1896
- var queuedMessageSystemNoticeSchema = z10.object({
1805
+ var queuedMessageSystemNoticeSchema = z9.object({
1897
1806
  kind: systemMessageKindSchema,
1898
1807
  subject: systemMessageSubjectSchema.nullable()
1899
1808
  });
1900
1809
 
1901
1810
  // ../domain/src/queued-message-lifecycle.ts
1902
- import { z as z11 } from "zod";
1811
+ import { z as z10 } from "zod";
1903
1812
  var queuedMessageStateValues = [
1904
1813
  "queued",
1905
1814
  "scheduled",
@@ -1908,10 +1817,10 @@ var queuedMessageStateValues = [
1908
1817
  "failed_exhausted",
1909
1818
  "claimed"
1910
1819
  ];
1911
- var queuedMessageStateSchema = z11.enum(queuedMessageStateValues);
1820
+ var queuedMessageStateSchema = z10.enum(queuedMessageStateValues);
1912
1821
 
1913
1822
  // ../domain/src/thread-status.ts
1914
- import { z as z12 } from "zod";
1823
+ import { z as z11 } from "zod";
1915
1824
  var threadStatusValues = [
1916
1825
  "pending",
1917
1826
  "idle",
@@ -1920,136 +1829,75 @@ var threadStatusValues = [
1920
1829
  "stopping",
1921
1830
  "error"
1922
1831
  ];
1923
- var threadStatusSchema = z12.enum(threadStatusValues);
1832
+ var threadStatusSchema = z11.enum(threadStatusValues);
1924
1833
 
1925
1834
  // ../domain/src/thread-origin-kind.ts
1926
- import { z as z13 } from "zod";
1835
+ import { z as z12 } from "zod";
1927
1836
  var threadOriginKindValues = ["fork"];
1928
- var threadOriginKindSchema = z13.enum(threadOriginKindValues);
1837
+ var threadOriginKindSchema = z12.enum(threadOriginKindValues);
1929
1838
 
1930
1839
  // ../domain/src/thread-parent-notifications.ts
1931
- import { z as z14 } from "zod";
1840
+ import { z as z13 } from "zod";
1932
1841
  var threadParentNotificationsValues = [
1933
1842
  "auto",
1934
1843
  "stuck",
1935
1844
  "off"
1936
1845
  ];
1937
- var threadParentNotificationsSchema = z14.enum(
1846
+ var threadParentNotificationsSchema = z13.enum(
1938
1847
  threadParentNotificationsValues
1939
1848
  );
1940
1849
 
1941
1850
  // ../domain/src/thread-visibility.ts
1942
- import { z as z15 } from "zod";
1851
+ import { z as z14 } from "zod";
1943
1852
  var threadVisibilityValues = ["visible", "hidden"];
1944
- var threadVisibilitySchema = z15.enum(threadVisibilityValues);
1853
+ var threadVisibilitySchema = z14.enum(threadVisibilityValues);
1945
1854
 
1946
1855
  // ../domain/src/thread-runtime-state.ts
1947
- import { z as z16 } from "zod";
1856
+ import { z as z15 } from "zod";
1948
1857
  var threadRuntimeDisplayStatusValues = [
1949
1858
  ...threadStatusValues,
1950
1859
  "provisioning",
1951
1860
  "waiting-for-host"
1952
1861
  ];
1953
- var threadRuntimeDisplayStatusSchema = z16.enum(
1862
+ var threadRuntimeDisplayStatusSchema = z15.enum(
1954
1863
  threadRuntimeDisplayStatusValues
1955
1864
  );
1956
- var threadRuntimeStateSchema = z16.object({
1865
+ var threadRuntimeStateSchema = z15.object({
1957
1866
  displayStatus: threadRuntimeDisplayStatusSchema
1958
1867
  });
1959
- var threadActivityStateSchema = z16.object({
1960
- activeWorkflowCount: z16.number().int().nonnegative(),
1961
- activeBackgroundAgentCount: z16.number().int().nonnegative(),
1962
- activeBackgroundCommandCount: z16.number().int().nonnegative(),
1963
- activePlanModeCount: z16.number().int().nonnegative(),
1964
- activeGoalCount: z16.number().int().nonnegative()
1868
+ var threadActivityStateSchema = z15.object({
1869
+ activeWorkflowCount: z15.number().int().nonnegative(),
1870
+ activeBackgroundAgentCount: z15.number().int().nonnegative(),
1871
+ activeBackgroundCommandCount: z15.number().int().nonnegative(),
1872
+ activePlanModeCount: z15.number().int().nonnegative(),
1873
+ activeGoalCount: z15.number().int().nonnegative()
1965
1874
  });
1966
1875
 
1967
1876
  // ../domain/src/thread.ts
1968
- var workspaceStateValues = [
1969
- "clean",
1970
- "untracked",
1971
- "dirty_uncommitted",
1972
- "committed_unmerged",
1973
- "dirty_and_committed_unmerged"
1974
- ];
1975
- var workspaceStateSchema = z17.enum(workspaceStateValues);
1976
- var workspaceFileStatusKindSchema = z17.enum([
1977
- "M",
1978
- "A",
1979
- "D",
1980
- "R",
1981
- "C",
1982
- "U",
1983
- "??",
1984
- "?"
1985
- ]);
1986
- var workspaceFileStatusSchema = z17.object({
1987
- path: z17.string(),
1988
- status: workspaceFileStatusKindSchema,
1989
- insertions: z17.number().nullable(),
1990
- deletions: z17.number().nullable()
1991
- });
1992
- var workspaceCommitSummarySchema = z17.object({
1993
- sha: z17.string(),
1994
- shortSha: z17.string(),
1995
- subject: z17.string(),
1996
- authorName: z17.string(),
1997
- authoredAt: z17.number()
1998
- });
1999
- var workspaceChangeStatsSchema = z17.object({
2000
- insertions: z17.number(),
2001
- deletions: z17.number(),
2002
- lineStatsComplete: z17.boolean(),
2003
- fileCount: z17.number().int().nonnegative(),
2004
- files: z17.array(workspaceFileStatusSchema)
2005
- });
2006
- var workspaceWorkingTreeSchema = workspaceChangeStatsSchema.extend({
2007
- hasUncommittedChanges: z17.boolean(),
2008
- state: workspaceStateSchema
2009
- });
2010
- var workspaceBranchSchema = z17.object({
2011
- currentBranch: z17.string().nullable(),
2012
- defaultBranch: z17.string()
2013
- });
2014
- var workspaceMergeBaseSchema = workspaceChangeStatsSchema.extend({
2015
- mergeBaseBranch: z17.string(),
2016
- baseRef: z17.string().nullable(),
2017
- aheadCount: z17.number(),
2018
- behindCount: z17.number(),
2019
- squashMergeCheckComplete: z17.boolean(),
2020
- hasCommittedUnmergedChanges: z17.boolean(),
2021
- commits: z17.array(workspaceCommitSummarySchema)
2022
- });
2023
- var workspaceStatusSchema = z17.object({
2024
- workingTree: workspaceWorkingTreeSchema,
2025
- checkout: gitCheckoutRefSchema,
2026
- branch: workspaceBranchSchema,
2027
- mergeBase: workspaceMergeBaseSchema.nullable()
2028
- });
2029
- var threadQueuedMessageSchema = z17.object({
2030
- id: z17.string(),
1877
+ var threadQueuedMessageSchema = z16.object({
1878
+ id: z16.string(),
2031
1879
  origin: threadCreateOriginSchema.nullable(),
2032
- originPluginId: z17.string().nullable(),
2033
- initiator: z17.enum(["user", "agent", "system"]),
2034
- senderThreadId: z17.string().nullable(),
1880
+ originPluginId: z16.string().nullable(),
1881
+ initiator: z16.enum(["user", "agent", "system"]),
1882
+ senderThreadId: z16.string().nullable(),
2035
1883
  /**
2036
1884
  * The thread this row is waiting on. Redundant on the thread-scoped list
2037
1885
  * route that first served this DTO, and load-bearing everywhere else it is
2038
1886
  * now served: a `queue.*` plugin event and a cross-thread wait-holder query
2039
1887
  * both hand out rows with no surrounding thread to read it from.
2040
1888
  */
2041
- threadId: z17.string(),
2042
- content: z17.array(promptInputSchema).min(1),
2043
- model: z17.string().min(1),
1889
+ threadId: z16.string(),
1890
+ content: z16.array(promptInputSchema).min(1),
1891
+ model: z16.string().min(1),
2044
1892
  reasoningLevel: reasoningLevelSchema,
2045
1893
  permissionMode: permissionModeSchema,
2046
1894
  serviceTier: serviceTierSchema,
2047
- groupWithNext: z17.boolean(),
1895
+ groupWithNext: z16.boolean(),
2048
1896
  /**
2049
1897
  * Epoch ms this row is scheduled to attempt dispatch, or null when it is
2050
1898
  * eligible as soon as its other waits clear.
2051
1899
  */
2052
- sendAt: z17.number().int().nonnegative().nullable(),
1900
+ sendAt: z16.number().int().nonnegative().nullable(),
2053
1901
  state: queuedMessageStateSchema,
2054
1902
  /**
2055
1903
  * Why this row is queued, or null for a `queued` row that is simply next in
@@ -2077,50 +1925,50 @@ var threadQueuedMessageSchema = z17.object({
2077
1925
  * not something a client should reason about. The server folds both into
2078
1926
  * this one answer.
2079
1927
  */
2080
- editable: z17.boolean(),
2081
- createdAt: z17.number(),
2082
- updatedAt: z17.number()
1928
+ editable: z16.boolean(),
1929
+ createdAt: z16.number(),
1930
+ updatedAt: z16.number()
2083
1931
  });
2084
- var threadSchema = z17.object({
2085
- id: z17.string(),
2086
- projectId: z17.string(),
2087
- environmentId: z17.string().nullable(),
2088
- providerId: z17.string(),
2089
- title: z17.string().nullable(),
2090
- titleFallback: z17.string().nullable(),
2091
- sectionId: z17.string().nullable(),
1932
+ var threadSchema = z16.object({
1933
+ id: z16.string(),
1934
+ projectId: z16.string(),
1935
+ environmentId: z16.string().nullable(),
1936
+ providerId: z16.string(),
1937
+ title: z16.string().nullable(),
1938
+ titleFallback: z16.string().nullable(),
1939
+ sectionId: z16.string().nullable(),
2092
1940
  status: threadStatusSchema,
2093
- parentThreadId: z17.string().nullable(),
2094
- lifecycleOwnerThreadId: z17.string().nullable(),
2095
- sourceThreadId: z17.string().nullable(),
1941
+ parentThreadId: z16.string().nullable(),
1942
+ lifecycleOwnerThreadId: z16.string().nullable(),
1943
+ sourceThreadId: z16.string().nullable(),
2096
1944
  originKind: threadOriginKindSchema.nullable(),
2097
- originPluginId: z17.string().nullable(),
1945
+ originPluginId: z16.string().nullable(),
2098
1946
  visibility: threadVisibilitySchema,
2099
1947
  parentNotifications: threadParentNotificationsSchema,
2100
- archivedAt: z17.number().nullable(),
2101
- pinnedAt: z17.number().nullable(),
2102
- deletedAt: z17.number().nullable(),
2103
- lastReadAt: z17.number().nullable(),
2104
- latestAttentionAt: z17.number(),
2105
- createdAt: z17.number(),
2106
- updatedAt: z17.number()
1948
+ archivedAt: z16.number().nullable(),
1949
+ pinnedAt: z16.number().nullable(),
1950
+ deletedAt: z16.number().nullable(),
1951
+ lastReadAt: z16.number().nullable(),
1952
+ latestAttentionAt: z16.number(),
1953
+ createdAt: z16.number(),
1954
+ updatedAt: z16.number()
2107
1955
  });
2108
1956
  var threadWithRuntimeSchema = threadSchema.extend({
2109
1957
  runtime: threadRuntimeStateSchema
2110
1958
  });
2111
1959
  var threadQueuedWorkValues = ["none", "waiting", "failed"];
2112
- var threadQueuedWorkSchema = z17.enum(threadQueuedWorkValues);
1960
+ var threadQueuedWorkSchema = z16.enum(threadQueuedWorkValues);
2113
1961
  var threadListEntrySchema = threadWithRuntimeSchema.extend({
2114
1962
  activity: threadActivityStateSchema,
2115
1963
  queuedWork: threadQueuedWorkSchema,
2116
- pinSortKey: z17.string().nullable(),
2117
- hasPendingInteraction: z17.boolean(),
2118
- environmentHostId: z17.string().nullable(),
2119
- environmentName: z17.string().nullable(),
2120
- environmentBranchName: z17.string().nullable(),
2121
- environmentPath: z17.string().nullable(),
2122
- environmentProviderId: z17.string().nullable(),
2123
- environmentIsWorktree: z17.boolean().nullable(),
1964
+ pinSortKey: z16.string().nullable(),
1965
+ hasPendingInteraction: z16.boolean(),
1966
+ environmentHostId: z16.string().nullable(),
1967
+ environmentName: z16.string().nullable(),
1968
+ environmentBranchName: z16.string().nullable(),
1969
+ environmentPath: z16.string().nullable(),
1970
+ environmentProviderId: z16.string().nullable(),
1971
+ environmentIsWorktree: z16.boolean().nullable(),
2124
1972
  environmentWorkspaceDisplayKind: environmentWorkspaceDisplayKindSchema
2125
1973
  });
2126
1974
 
@@ -2164,7 +2012,8 @@ var ENVIRONMENT_CHANGE_KINDS = [
2164
2012
  var HOST_CHANGE_KINDS = [
2165
2013
  "host-connected",
2166
2014
  "host-disconnected",
2167
- "provider-model-catalog-changed"
2015
+ "provider-model-catalog-changed",
2016
+ "provider-commands-changed"
2168
2017
  ];
2169
2018
  var SYSTEM_CHANGE_KINDS = [
2170
2019
  "config-changed",
@@ -2176,16 +2025,16 @@ var SYSTEM_CHANGE_KINDS = [
2176
2025
  "server-move-changed",
2177
2026
  "app-update-changed"
2178
2027
  ];
2179
- var threadChangeKindSchema = z18.enum(THREAD_CHANGE_KINDS);
2180
- var projectChangeKindSchema = z18.enum(PROJECT_CHANGE_KINDS);
2181
- var environmentChangeKindSchema = z18.enum(ENVIRONMENT_CHANGE_KINDS);
2182
- var hostChangeKindSchema = z18.enum(HOST_CHANGE_KINDS);
2183
- var systemChangeKindSchema = z18.enum(SYSTEM_CHANGE_KINDS);
2184
- var threadTimelineSubscriptionTargetSchema = z18.object({
2185
- kind: z18.literal("thread-timeline"),
2186
- threadId: z18.string().min(1),
2187
- segmentLimit: z18.number().int().positive().nullable(),
2188
- deferContent: z18.boolean()
2028
+ var threadChangeKindSchema = z17.enum(THREAD_CHANGE_KINDS);
2029
+ var projectChangeKindSchema = z17.enum(PROJECT_CHANGE_KINDS);
2030
+ var environmentChangeKindSchema = z17.enum(ENVIRONMENT_CHANGE_KINDS);
2031
+ var hostChangeKindSchema = z17.enum(HOST_CHANGE_KINDS);
2032
+ var systemChangeKindSchema = z17.enum(SYSTEM_CHANGE_KINDS);
2033
+ var threadTimelineSubscriptionTargetSchema = z17.object({
2034
+ kind: z17.literal("thread-timeline"),
2035
+ threadId: z17.string().min(1),
2036
+ segmentLimit: z17.number().int().positive().nullable(),
2037
+ deferContent: z17.boolean()
2189
2038
  }).strict();
2190
2039
  function canonicalPluginReadInput(value) {
2191
2040
  if (value === null || typeof value !== "object") return JSON.stringify(value);
@@ -2195,62 +2044,62 @@ function canonicalPluginReadInput(value) {
2195
2044
  (key) => `${JSON.stringify(key)}:${canonicalPluginReadInput(value[key])}`
2196
2045
  ).join(",")}}`;
2197
2046
  }
2198
- var pluginReadSubscriptionTargetSchema = z18.object({
2199
- kind: z18.literal("plugin-read"),
2200
- pluginId: z18.string().min(1),
2201
- method: z18.string().min(1),
2202
- read: z18.union([
2203
- z18.object({ input: jsonValueSchema }).strict(),
2204
- z18.object({ key: z18.string() }).strict()
2047
+ var pluginReadSubscriptionTargetSchema = z17.object({
2048
+ kind: z17.literal("plugin-read"),
2049
+ pluginId: z17.string().min(1),
2050
+ method: z17.string().min(1),
2051
+ read: z17.union([
2052
+ z17.object({ input: jsonValueSchema }).strict(),
2053
+ z17.object({ key: z17.string() }).strict()
2205
2054
  ]).refine(
2206
2055
  (read) => new TextEncoder().encode(canonicalPluginReadInput(read)).byteLength <= 16384,
2207
2056
  "Plugin read input exceeds 16 KiB"
2208
2057
  )
2209
2058
  }).strict();
2210
- var realtimeSubscriptionTargetSchema = z18.discriminatedUnion("kind", [
2059
+ var realtimeSubscriptionTargetSchema = z17.discriminatedUnion("kind", [
2211
2060
  pluginReadSubscriptionTargetSchema,
2212
- z18.object({ kind: z18.literal("plugin"), pluginId: z18.string().min(1) }).strict(),
2213
- z18.object({
2214
- kind: z18.literal("thread-detail"),
2215
- threadId: z18.string().min(1)
2061
+ z17.object({ kind: z17.literal("plugin"), pluginId: z17.string().min(1) }).strict(),
2062
+ z17.object({
2063
+ kind: z17.literal("thread-detail"),
2064
+ threadId: z17.string().min(1)
2216
2065
  }).strict(),
2217
2066
  threadTimelineSubscriptionTargetSchema,
2218
- z18.object({
2219
- kind: z18.literal("thread-list")
2067
+ z17.object({
2068
+ kind: z17.literal("thread-list")
2220
2069
  }).strict(),
2221
- z18.object({
2222
- kind: z18.literal("project-detail"),
2223
- projectId: z18.string().min(1)
2070
+ z17.object({
2071
+ kind: z17.literal("project-detail"),
2072
+ projectId: z17.string().min(1)
2224
2073
  }).strict(),
2225
- z18.object({
2226
- kind: z18.literal("project-list")
2074
+ z17.object({
2075
+ kind: z17.literal("project-list")
2227
2076
  }).strict(),
2228
- z18.object({
2229
- kind: z18.literal("environment-detail"),
2230
- environmentId: z18.string().min(1)
2077
+ z17.object({
2078
+ kind: z17.literal("environment-detail"),
2079
+ environmentId: z17.string().min(1)
2231
2080
  }).strict(),
2232
- z18.object({
2233
- kind: z18.literal("environment-list")
2081
+ z17.object({
2082
+ kind: z17.literal("environment-list")
2234
2083
  }).strict(),
2235
- z18.object({
2236
- kind: z18.literal("host-detail"),
2237
- hostId: z18.string().min(1)
2084
+ z17.object({
2085
+ kind: z17.literal("host-detail"),
2086
+ hostId: z17.string().min(1)
2238
2087
  }).strict(),
2239
- z18.object({
2240
- kind: z18.literal("host-list")
2088
+ z17.object({
2089
+ kind: z17.literal("host-list")
2241
2090
  }).strict(),
2242
- z18.object({
2243
- kind: z18.literal("system")
2091
+ z17.object({
2092
+ kind: z17.literal("system")
2244
2093
  }).strict()
2245
2094
  ]);
2246
2095
  function isValidSubscriptionTarget(value) {
2247
2096
  return realtimeSubscriptionTargetSchema.safeParse(value).success;
2248
2097
  }
2249
- var validSubscriptionTargetsSchema = z18.preprocess(
2098
+ var validSubscriptionTargetsSchema = z17.preprocess(
2250
2099
  (value) => Array.isArray(value) ? value.filter(isValidSubscriptionTarget) : value,
2251
- z18.array(realtimeSubscriptionTargetSchema)
2100
+ z17.array(realtimeSubscriptionTargetSchema)
2252
2101
  );
2253
- var validSubscriptionTargetSchema = z18.preprocess(
2102
+ var validSubscriptionTargetSchema = z17.preprocess(
2254
2103
  (value) => value === void 0 || isValidSubscriptionTarget(value) ? value : null,
2255
2104
  realtimeSubscriptionTargetSchema.nullable().optional()
2256
2105
  );
@@ -2259,84 +2108,88 @@ var subscriptionFields = {
2259
2108
  targets: validSubscriptionTargetsSchema.optional()
2260
2109
  };
2261
2110
  var hasSubscriptionTargets = (value) => value.target !== void 0 !== (value.targets !== void 0);
2262
- var subscribeMessageSchema = z18.object({ type: z18.literal("subscribe"), ...subscriptionFields }).refine(hasSubscriptionTargets);
2263
- var unsubscribeMessageSchema = z18.object({ type: z18.literal("unsubscribe"), ...subscriptionFields }).refine(hasSubscriptionTargets);
2264
- var pingMessageSchema = z18.object({
2265
- type: z18.literal("ping")
2111
+ var subscribeMessageSchema = z17.object({
2112
+ type: z17.literal("subscribe"),
2113
+ ...subscriptionFields,
2114
+ timelineTags: z17.record(z17.string(), z17.string().min(1).nullable()).optional()
2115
+ }).refine(hasSubscriptionTargets);
2116
+ var unsubscribeMessageSchema = z17.object({ type: z17.literal("unsubscribe"), ...subscriptionFields }).refine(hasSubscriptionTargets);
2117
+ var pingMessageSchema = z17.object({
2118
+ type: z17.literal("ping")
2266
2119
  });
2267
- var visibilityMessageSchema = z18.object({
2268
- type: z18.literal("visibility"),
2269
- visible: z18.boolean()
2120
+ var visibilityMessageSchema = z17.object({
2121
+ type: z17.literal("visibility"),
2122
+ visible: z17.boolean()
2270
2123
  });
2271
- var clientMessageSchema = z18.discriminatedUnion("type", [
2124
+ var clientMessageSchema = z17.discriminatedUnion("type", [
2272
2125
  subscribeMessageSchema,
2273
2126
  unsubscribeMessageSchema,
2274
2127
  pingMessageSchema,
2275
2128
  visibilityMessageSchema
2276
2129
  ]);
2277
- var pongMessageSchema = z18.object({
2278
- type: z18.literal("pong")
2130
+ var pongMessageSchema = z17.object({
2131
+ type: z17.literal("pong")
2279
2132
  }).strict();
2280
- var pongMessageLenientSchema = z18.object({
2281
- type: z18.literal("pong")
2133
+ var pongMessageLenientSchema = z17.object({
2134
+ type: z17.literal("pong")
2282
2135
  });
2283
- var threadStatusChangeMetadataSchema = z18.object({
2136
+ var threadStatusChangeMetadataSchema = z17.object({
2284
2137
  status: threadStatusSchema,
2285
2138
  runtime: threadRuntimeStateSchema,
2286
2139
  activity: threadActivityStateSchema,
2287
- latestAttentionAt: z18.number(),
2288
- updatedAt: z18.number()
2140
+ latestAttentionAt: z17.number(),
2141
+ updatedAt: z17.number()
2289
2142
  }).strict();
2290
- var threadChangeMetadataSchema = z18.object({
2291
- backgroundActivityChanged: z18.boolean().optional(),
2292
- eventTypes: z18.array(threadEventTypeSchema).readonly().optional(),
2293
- timelineSequence: z18.number().int().nonnegative().optional(),
2294
- hasPendingInteraction: z18.boolean().optional(),
2295
- projectId: z18.string().optional(),
2143
+ var threadChangeMetadataSchema = z17.object({
2144
+ backgroundActivityChanged: z17.boolean().optional(),
2145
+ eventTypes: z17.array(threadEventTypeSchema).readonly().optional(),
2146
+ timelineSequence: z17.number().int().nonnegative().optional(),
2147
+ hasPendingInteraction: z17.boolean().optional(),
2148
+ projectId: z17.string().optional(),
2296
2149
  statusChange: threadStatusChangeMetadataSchema.optional()
2297
2150
  }).strict();
2298
- var threadChangedMessageSchema = z18.object({
2299
- type: z18.literal("changed"),
2300
- entity: z18.literal("thread"),
2301
- id: z18.string().optional(),
2151
+ var threadChangedMessageSchema = z17.object({
2152
+ type: z17.literal("changed"),
2153
+ entity: z17.literal("thread"),
2154
+ id: z17.string().optional(),
2302
2155
  metadata: threadChangeMetadataSchema.optional(),
2303
- changes: z18.array(threadChangeKindSchema).readonly()
2156
+ changes: z17.array(threadChangeKindSchema).readonly()
2304
2157
  }).strict();
2305
- var projectChangedMessageSchema = z18.object({
2306
- type: z18.literal("changed"),
2307
- entity: z18.literal("project"),
2308
- id: z18.string().optional(),
2309
- changes: z18.array(projectChangeKindSchema).readonly()
2158
+ var projectChangedMessageSchema = z17.object({
2159
+ type: z17.literal("changed"),
2160
+ entity: z17.literal("project"),
2161
+ id: z17.string().optional(),
2162
+ changes: z17.array(projectChangeKindSchema).readonly()
2310
2163
  }).strict();
2311
- var environmentChangedMessageSchema = z18.object({
2312
- type: z18.literal("changed"),
2313
- entity: z18.literal("environment"),
2314
- id: z18.string().optional(),
2315
- changes: z18.array(environmentChangeKindSchema).readonly()
2164
+ var environmentChangedMessageSchema = z17.object({
2165
+ type: z17.literal("changed"),
2166
+ entity: z17.literal("environment"),
2167
+ id: z17.string().optional(),
2168
+ changes: z17.array(environmentChangeKindSchema).readonly()
2316
2169
  }).strict();
2317
- var hostChangedMessageSchema = z18.object({
2318
- type: z18.literal("changed"),
2319
- entity: z18.literal("host"),
2320
- id: z18.string().optional(),
2321
- changes: z18.array(hostChangeKindSchema).readonly()
2170
+ var hostChangedMessageSchema = z17.object({
2171
+ type: z17.literal("changed"),
2172
+ entity: z17.literal("host"),
2173
+ id: z17.string().optional(),
2174
+ changes: z17.array(hostChangeKindSchema).readonly()
2322
2175
  }).strict();
2323
- var systemChangedMessageSchema = z18.object({
2324
- type: z18.literal("changed"),
2325
- entity: z18.literal("system"),
2326
- changes: z18.array(systemChangeKindSchema).readonly()
2176
+ var systemChangedMessageSchema = z17.object({
2177
+ type: z17.literal("changed"),
2178
+ entity: z17.literal("system"),
2179
+ changes: z17.array(systemChangeKindSchema).readonly()
2327
2180
  }).strict();
2328
- var tagsChangedMessageSchema = z18.object({
2329
- type: z18.literal("changed"),
2330
- entity: z18.literal("tags"),
2331
- tags: z18.array(z18.string().min(1)).min(1)
2181
+ var tagsChangedMessageSchema = z17.object({
2182
+ type: z17.literal("changed"),
2183
+ entity: z17.literal("tags"),
2184
+ tags: z17.array(z17.string().min(1)).min(1)
2332
2185
  }).strict();
2333
- var pluginChangedMessageSchema = z18.object({
2334
- type: z18.literal("changed"),
2335
- entity: z18.literal("plugin"),
2336
- pluginId: z18.string().min(1),
2337
- tags: z18.array(z18.string().min(1)).min(1).nullable()
2186
+ var pluginChangedMessageSchema = z17.object({
2187
+ type: z17.literal("changed"),
2188
+ entity: z17.literal("plugin"),
2189
+ pluginId: z17.string().min(1),
2190
+ tags: z17.array(z17.string().min(1)).min(1).nullable()
2338
2191
  }).strict();
2339
- var changedMessageSchema = z18.discriminatedUnion("entity", [
2192
+ var changedMessageSchema = z17.discriminatedUnion("entity", [
2340
2193
  threadChangedMessageSchema,
2341
2194
  projectChangedMessageSchema,
2342
2195
  environmentChangedMessageSchema,
@@ -2347,56 +2200,56 @@ var changedMessageSchema = z18.discriminatedUnion("entity", [
2347
2200
  ]);
2348
2201
  function lenientKinds(kinds) {
2349
2202
  const known = new Set(kinds);
2350
- return z18.array(z18.string()).transform(
2203
+ return z17.array(z17.string()).transform(
2351
2204
  (values) => values.filter((value) => known.has(value))
2352
2205
  );
2353
2206
  }
2354
2207
  var knownThreadEventTypes = new Set(
2355
2208
  threadEventTypeValues
2356
2209
  );
2357
- var threadChangeMetadataLenientSchema = z18.object({
2358
- timelineSequence: z18.number().int().nonnegative().optional(),
2359
- backgroundActivityChanged: z18.boolean().optional(),
2360
- eventTypes: z18.array(z18.string()).transform(
2210
+ var threadChangeMetadataLenientSchema = z17.object({
2211
+ timelineSequence: z17.number().int().nonnegative().optional(),
2212
+ backgroundActivityChanged: z17.boolean().optional(),
2213
+ eventTypes: z17.array(z17.string()).transform(
2361
2214
  (values) => values.filter(
2362
2215
  (value) => knownThreadEventTypes.has(value)
2363
2216
  )
2364
2217
  ).optional(),
2365
- hasPendingInteraction: z18.boolean().optional(),
2366
- projectId: z18.string().optional(),
2218
+ hasPendingInteraction: z17.boolean().optional(),
2219
+ projectId: z17.string().optional(),
2367
2220
  statusChange: threadStatusChangeMetadataSchema.optional().catch(void 0)
2368
2221
  });
2369
- var threadChangedMessageLenientSchema = z18.object({
2370
- type: z18.literal("changed"),
2371
- entity: z18.literal("thread"),
2372
- id: z18.string().optional(),
2222
+ var threadChangedMessageLenientSchema = z17.object({
2223
+ type: z17.literal("changed"),
2224
+ entity: z17.literal("thread"),
2225
+ id: z17.string().optional(),
2373
2226
  metadata: threadChangeMetadataLenientSchema.optional(),
2374
2227
  changes: lenientKinds(THREAD_CHANGE_KINDS)
2375
2228
  });
2376
- var projectChangedMessageLenientSchema = z18.object({
2377
- type: z18.literal("changed"),
2378
- entity: z18.literal("project"),
2379
- id: z18.string().optional(),
2229
+ var projectChangedMessageLenientSchema = z17.object({
2230
+ type: z17.literal("changed"),
2231
+ entity: z17.literal("project"),
2232
+ id: z17.string().optional(),
2380
2233
  changes: lenientKinds(PROJECT_CHANGE_KINDS)
2381
2234
  });
2382
- var environmentChangedMessageLenientSchema = z18.object({
2383
- type: z18.literal("changed"),
2384
- entity: z18.literal("environment"),
2385
- id: z18.string().optional(),
2235
+ var environmentChangedMessageLenientSchema = z17.object({
2236
+ type: z17.literal("changed"),
2237
+ entity: z17.literal("environment"),
2238
+ id: z17.string().optional(),
2386
2239
  changes: lenientKinds(ENVIRONMENT_CHANGE_KINDS)
2387
2240
  });
2388
- var hostChangedMessageLenientSchema = z18.object({
2389
- type: z18.literal("changed"),
2390
- entity: z18.literal("host"),
2391
- id: z18.string().optional(),
2241
+ var hostChangedMessageLenientSchema = z17.object({
2242
+ type: z17.literal("changed"),
2243
+ entity: z17.literal("host"),
2244
+ id: z17.string().optional(),
2392
2245
  changes: lenientKinds(HOST_CHANGE_KINDS)
2393
2246
  });
2394
- var systemChangedMessageLenientSchema = z18.object({
2395
- type: z18.literal("changed"),
2396
- entity: z18.literal("system"),
2247
+ var systemChangedMessageLenientSchema = z17.object({
2248
+ type: z17.literal("changed"),
2249
+ entity: z17.literal("system"),
2397
2250
  changes: lenientKinds(SYSTEM_CHANGE_KINDS)
2398
2251
  });
2399
- var changedMessageLenientSchema = z18.discriminatedUnion("entity", [
2252
+ var changedMessageLenientSchema = z17.discriminatedUnion("entity", [
2400
2253
  threadChangedMessageLenientSchema,
2401
2254
  projectChangedMessageLenientSchema,
2402
2255
  environmentChangedMessageLenientSchema,
@@ -2407,22 +2260,22 @@ var changedMessageLenientSchema = z18.discriminatedUnion("entity", [
2407
2260
  ]);
2408
2261
 
2409
2262
  // src/internal/rpc-tags.ts
2410
- import { z as z19 } from "zod";
2411
- var rpcInvalidationTags = z19.array(z19.string().min(1)).min(1);
2263
+ import { z as z18 } from "zod";
2264
+ var rpcInvalidationTags = z18.array(z18.string().min(1)).min(1);
2412
2265
  function rpcResponseTags(declarations, input, output) {
2413
- const tags = z19.array(z19.string().min(1)).parse(declarations.tags?.(input, output) ?? []);
2266
+ const tags = z18.array(z18.string().min(1)).parse(declarations.tags?.(input, output) ?? []);
2414
2267
  const keyTags = {};
2415
2268
  if (declarations.keyTags && typeof output === "object" && output !== null && !Array.isArray(output)) {
2416
2269
  for (const [key, value] of Object.entries(output)) {
2417
- keyTags[key] = z19.array(z19.string().min(1)).parse(declarations.keyTags(key, value));
2270
+ keyTags[key] = z18.array(z18.string().min(1)).parse(declarations.keyTags(key, value));
2418
2271
  }
2419
2272
  }
2420
- const invalidated = z19.array(z19.string().min(1)).parse(declarations.invalidates?.(input, output) ?? []);
2273
+ const invalidated = z18.array(z18.string().min(1)).parse(declarations.invalidates?.(input, output) ?? []);
2421
2274
  return { tags, keyTags, invalidated };
2422
2275
  }
2423
2276
 
2424
2277
  // src/internal/rpc-query-host.ts
2425
- import { z as z20 } from "zod";
2278
+ import { z as z19 } from "zod";
2426
2279
  var rpcQueryKey = (pluginId, method, input) => [
2427
2280
  "plugin-rpc",
2428
2281
  pluginId,
@@ -2564,7 +2417,7 @@ function createRpcQueryHooks(useHost) {
2564
2417
  const enabled = options.enabled ?? true;
2565
2418
  const identity = JSON.stringify([...new Set(options.keys)].sort());
2566
2419
  const keys = useMemo2(
2567
- () => z20.array(z20.string()).parse(JSON.parse(identity)),
2420
+ () => z19.array(z19.string()).parse(JSON.parse(identity)),
2568
2421
  [identity]
2569
2422
  );
2570
2423
  let cache = owners.get(host.queryClient);
@@ -2590,7 +2443,7 @@ function createRpcQueryHooks(useHost) {
2590
2443
  );
2591
2444
  return {
2592
2445
  ...response,
2593
- result: z20.record(z20.string(), jsonValueSchema).parse(response.result)
2446
+ result: z19.record(z19.string(), jsonValueSchema).parse(response.result)
2594
2447
  };
2595
2448
  }
2596
2449
  });
@@ -2639,9 +2492,18 @@ function createRpcQueryHooks(useHost) {
2639
2492
  const refetch = useCallback2(async () => {
2640
2493
  await current.observer.refetch();
2641
2494
  }, [current]);
2495
+ const refetchKeys = useCallback2(
2496
+ async (requested) => {
2497
+ await current.refetchKeys(
2498
+ requested.filter((key) => keys.includes(key))
2499
+ );
2500
+ },
2501
+ [current, keys]
2502
+ );
2642
2503
  return {
2643
2504
  ...query,
2644
- refetch
2505
+ refetch,
2506
+ refetchKeys
2645
2507
  };
2646
2508
  }
2647
2509
  function experimental_useRpcMutation(options) {