@get-bb/plugin-sdk 0.6.80 → 0.6.89

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([
@@ -1200,8 +1199,8 @@ function createTaggedKeyedQueryOwner(options) {
1200
1199
  keys.set(key, (keys.get(key) ?? 0) + 1);
1201
1200
  }
1202
1201
  const cached = getTaggedReadData(client, queryKey);
1203
- const missing = requested.filter(
1204
- (key) => !Object.hasOwn(cached?.result ?? {}, key)
1202
+ const pending = requested.filter(
1203
+ (key) => dirtyKeys.has(key) || !Object.hasOwn(cached?.result ?? {}, key)
1205
1204
  );
1206
1205
  if (!stop) missingOnly = cached === void 0;
1207
1206
  listeners.add(listener);
@@ -1210,9 +1209,9 @@ function createTaggedKeyedQueryOwner(options) {
1210
1209
  for (const notify of listeners) notify();
1211
1210
  });
1212
1211
  }
1213
- if (added && missing.length > 0) {
1212
+ if (added && pending.length > 0) {
1214
1213
  if (observer.getCurrentResult().isFetching) {
1215
- if (readingKeys.size > 0 && missing.some((key) => !readingKeys.has(key)))
1214
+ if (readingKeys.size > 0 && pending.some((key) => !readingKeys.has(key)))
1216
1215
  restartTaggedRead(observer.getCurrentQuery());
1217
1216
  } else {
1218
1217
  missingOnly = true;
@@ -1501,110 +1500,11 @@ var projectExecutionDefaultsSchema = z2.object({
1501
1500
  permissionMode: permissionModeSchema
1502
1501
  });
1503
1502
 
1504
- // ../domain/src/git-checkout.ts
1505
- 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
- );
1602
-
1603
1503
  // ../domain/src/change-kinds.ts
1604
- import { z as z18 } from "zod";
1504
+ import { z as z17 } from "zod";
1605
1505
 
1606
1506
  // ../domain/src/thread-event-types.ts
1607
- import { z as z4 } from "zod";
1507
+ import { z as z3 } from "zod";
1608
1508
  var systemEventTypeValues = [
1609
1509
  "client/thread/start",
1610
1510
  "client/turn/requested",
@@ -1663,30 +1563,30 @@ var threadEventTypeValues = [
1663
1563
  ...systemEventTypeValues
1664
1564
  ];
1665
1565
  var threadEventTypeSet = new Set(threadEventTypeValues);
1666
- var threadEventTypeSchema = z4.string().refine(
1566
+ var threadEventTypeSchema = z3.string().refine(
1667
1567
  (value) => threadEventTypeSet.has(value),
1668
1568
  "Invalid thread event type"
1669
1569
  );
1670
1570
 
1671
1571
  // ../domain/src/thread.ts
1672
- import { z as z17 } from "zod";
1572
+ import { z as z16 } from "zod";
1673
1573
 
1674
1574
  // ../domain/src/thread-create-origin.ts
1675
- import { z as z5 } from "zod";
1575
+ import { z as z4 } from "zod";
1676
1576
  var threadCreateOriginValues = ["app", "cli", "sdk", "plugin"];
1677
- var threadCreateOriginSchema = z5.enum(threadCreateOriginValues);
1577
+ var threadCreateOriginSchema = z4.enum(threadCreateOriginValues);
1678
1578
 
1679
1579
  // ../domain/src/environment.ts
1680
- import { z as z6 } from "zod";
1681
- var environmentMachineSelectionSchema = z6.discriminatedUnion("type", [
1682
- z6.object({ type: z6.literal("existing"), hostId: z6.string().min(1) }),
1683
- z6.object({
1684
- type: z6.literal("new"),
1685
- machineProviderId: z6.string().min(1),
1580
+ import { z as z5 } from "zod";
1581
+ var environmentMachineSelectionSchema = z5.discriminatedUnion("type", [
1582
+ z5.object({ type: z5.literal("existing"), hostId: z5.string().min(1) }),
1583
+ z5.object({
1584
+ type: z5.literal("new"),
1585
+ machineProviderId: z5.string().min(1),
1686
1586
  inputs: jsonValueSchema.nullable()
1687
1587
  })
1688
1588
  ]);
1689
- var environmentProviderSelectionSchema = z6.object({
1589
+ var environmentProviderSelectionSchema = z5.object({
1690
1590
  machine: environmentMachineSelectionSchema,
1691
1591
  inputs: jsonValueSchema.nullable()
1692
1592
  });
@@ -1697,14 +1597,14 @@ var environmentStatusValues = [
1697
1597
  "error",
1698
1598
  "destroyed"
1699
1599
  ];
1700
- var environmentStatusSchema = z6.enum(environmentStatusValues);
1600
+ var environmentStatusSchema = z5.enum(environmentStatusValues);
1701
1601
  var environmentHostLifecycleValues = [
1702
1602
  "active",
1703
1603
  "removing",
1704
1604
  "cleanup-failed",
1705
1605
  "removed"
1706
1606
  ];
1707
- var environmentHostLifecycleSchema = z6.enum(
1607
+ var environmentHostLifecycleSchema = z5.enum(
1708
1608
  environmentHostLifecycleValues
1709
1609
  );
1710
1610
  var WORKSPACE_PROVISION_TYPES = [
@@ -1712,68 +1612,68 @@ var WORKSPACE_PROVISION_TYPES = [
1712
1612
  "managed-worktree",
1713
1613
  "personal"
1714
1614
  ];
1715
- var workspaceProvisionTypeSchema = z6.enum(WORKSPACE_PROVISION_TYPES);
1615
+ var workspaceProvisionTypeSchema = z5.enum(WORKSPACE_PROVISION_TYPES);
1716
1616
  var environmentWorkspaceDisplayKindValues = [
1717
1617
  "managed-worktree",
1718
1618
  "unmanaged-worktree",
1719
1619
  "other"
1720
1620
  ];
1721
- var environmentWorkspaceDisplayKindSchema = z6.enum(
1621
+ var environmentWorkspaceDisplayKindSchema = z5.enum(
1722
1622
  environmentWorkspaceDisplayKindValues
1723
1623
  );
1724
- var discoveredWorkspacePropertiesSchema = z6.object({
1725
- path: z6.string().min(1),
1726
- isGitRepo: z6.boolean(),
1727
- isWorktree: z6.boolean(),
1728
- branchName: z6.string().nullable(),
1729
- defaultBranch: z6.string().nullable()
1624
+ var discoveredWorkspacePropertiesSchema = z5.object({
1625
+ path: z5.string().min(1),
1626
+ isGitRepo: z5.boolean(),
1627
+ isWorktree: z5.boolean(),
1628
+ branchName: z5.string().nullable(),
1629
+ defaultBranch: z5.string().nullable()
1730
1630
  });
1731
- var environmentLifecycleSchema = z6.object({
1732
- phase: z6.enum(["active", "retiring", "teardown", "destroyed"]),
1733
- retireAt: z6.number().nullable(),
1734
- teardown: z6.object({
1735
- status: z6.enum(["running", "failed", "removed"]),
1736
- attempt: z6.number().int().nonnegative(),
1737
- message: z6.string().optional()
1631
+ var environmentLifecycleSchema = z5.object({
1632
+ phase: z5.enum(["active", "retiring", "teardown", "destroyed"]),
1633
+ retireAt: z5.number().nullable(),
1634
+ teardown: z5.object({
1635
+ status: z5.enum(["running", "failed", "removed"]),
1636
+ attempt: z5.number().int().nonnegative(),
1637
+ message: z5.string().optional()
1738
1638
  }).nullable()
1739
1639
  });
1740
- var environmentSchema = z6.object({
1741
- id: z6.string(),
1742
- name: z6.string().nullable(),
1743
- projectId: z6.string(),
1744
- hostId: z6.string(),
1745
- path: z6.string().nullable(),
1746
- isGitRepo: z6.boolean(),
1747
- isWorktree: z6.boolean(),
1748
- branchName: z6.string().nullable(),
1749
- baseBranch: z6.string().nullable(),
1750
- defaultBranch: z6.string().nullable(),
1751
- mergeBaseBranch: z6.string().nullable(),
1640
+ var environmentSchema = z5.object({
1641
+ id: z5.string(),
1642
+ name: z5.string().nullable(),
1643
+ projectId: z5.string(),
1644
+ hostId: z5.string(),
1645
+ path: z5.string().nullable(),
1646
+ isGitRepo: z5.boolean(),
1647
+ isWorktree: z5.boolean(),
1648
+ branchName: z5.string().nullable(),
1649
+ baseBranch: z5.string().nullable(),
1650
+ defaultBranch: z5.string().nullable(),
1651
+ mergeBaseBranch: z5.string().nullable(),
1752
1652
  status: environmentStatusSchema,
1753
- environmentProviderId: z6.string().nullable(),
1653
+ environmentProviderId: z5.string().nullable(),
1754
1654
  lifecycle: environmentLifecycleSchema,
1755
1655
  hostLifecycle: environmentHostLifecycleSchema,
1756
1656
  environmentProviderSelection: environmentProviderSelectionSchema.nullable(),
1757
- environmentProviderInstanceKey: z6.string().nullable(),
1758
- managed: z6.boolean(),
1657
+ environmentProviderInstanceKey: z5.string().nullable(),
1658
+ managed: z5.boolean(),
1759
1659
  workspaceProvisionType: workspaceProvisionTypeSchema.nullable(),
1760
- createdAt: z6.number(),
1761
- updatedAt: z6.number()
1660
+ createdAt: z5.number(),
1661
+ updatedAt: z5.number()
1762
1662
  });
1763
1663
 
1764
1664
  // ../domain/src/queued-message.ts
1765
- import { z as z10 } from "zod";
1665
+ import { z as z9 } from "zod";
1766
1666
 
1767
1667
  // ../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);
1668
+ import { z as z6 } from "zod";
1669
+ var pluginIdSchema = z6.string().regex(/^[a-z0-9][a-z0-9-]*$/u);
1770
1670
 
1771
1671
  // ../domain/src/protocol-ids.ts
1772
- import { z as z8 } from "zod";
1773
- var clientTurnRequestIdSchema = z8.string().regex(/^creq_[23456789abcdefghijkmnpqrstuvwxyz]{10}$/u);
1672
+ import { z as z7 } from "zod";
1673
+ var clientTurnRequestIdSchema = z7.string().regex(/^creq_[23456789abcdefghijkmnpqrstuvwxyz]{10}$/u);
1774
1674
 
1775
1675
  // ../domain/src/system-message.ts
1776
- import { z as z9 } from "zod";
1676
+ import { z as z8 } from "zod";
1777
1677
  var systemMessageKindValues = [
1778
1678
  "ownership-assigned",
1779
1679
  "ownership-removed",
@@ -1786,41 +1686,41 @@ var systemMessageKindValues = [
1786
1686
  "environment-directory-updated",
1787
1687
  "unlabeled"
1788
1688
  ];
1789
- var systemMessageKindSchema = z9.enum(systemMessageKindValues);
1790
- var systemThreadInterruptedReasonSchema = z9.enum([
1689
+ var systemMessageKindSchema = z8.enum(systemMessageKindValues);
1690
+ var systemThreadInterruptedReasonSchema = z8.enum([
1791
1691
  "manual-stop",
1792
1692
  "host-daemon-restarted",
1793
1693
  "host-removed",
1794
1694
  "provider-turn-idle"
1795
1695
  ]);
1796
- var childThreadOutcomeSchema = z9.object({
1797
- threadId: z9.string(),
1798
- status: z9.enum(["completed", "failed", "interrupted"]),
1799
- interruption: z9.object({
1696
+ var childThreadOutcomeSchema = z8.object({
1697
+ threadId: z8.string(),
1698
+ status: z8.enum(["completed", "failed", "interrupted"]),
1699
+ interruption: z8.object({
1800
1700
  reason: systemThreadInterruptedReasonSchema,
1801
- cause: z9.literal("host-connection-lost").optional()
1701
+ cause: z8.literal("host-connection-lost").optional()
1802
1702
  }).optional()
1803
1703
  });
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()
1704
+ var systemMessageSubjectSchema = z8.discriminatedUnion("kind", [
1705
+ z8.object({
1706
+ kind: z8.literal("thread"),
1707
+ threadId: z8.string(),
1708
+ threadName: z8.string(),
1709
+ outcomes: z8.array(childThreadOutcomeSchema).optional()
1810
1710
  }),
1811
- z9.object({
1812
- kind: z9.literal("thread-batch"),
1813
- count: z9.number(),
1814
- outcomes: z9.array(childThreadOutcomeSchema).optional()
1711
+ z8.object({
1712
+ kind: z8.literal("thread-batch"),
1713
+ count: z8.number(),
1714
+ outcomes: z8.array(childThreadOutcomeSchema).optional()
1815
1715
  }),
1816
- z9.object({
1817
- kind: z9.literal("tool-call"),
1818
- toolName: z9.string(),
1819
- suppress: z9.boolean()
1716
+ z8.object({
1717
+ kind: z8.literal("tool-call"),
1718
+ toolName: z8.string(),
1719
+ suppress: z8.boolean()
1820
1720
  }),
1821
- z9.object({
1822
- kind: z9.literal("directory"),
1823
- path: z9.string()
1721
+ z8.object({
1722
+ kind: z8.literal("directory"),
1723
+ path: z8.string()
1824
1724
  })
1825
1725
  ]);
1826
1726
 
@@ -1835,44 +1735,44 @@ var queuedMessageWaitingOnKindValues = [
1835
1735
  "interaction",
1836
1736
  "plugin"
1837
1737
  ];
1838
- var queuedMessageWaitingOnKindSchema = z10.enum(
1738
+ var queuedMessageWaitingOnKindSchema = z9.enum(
1839
1739
  queuedMessageWaitingOnKindValues
1840
1740
  );
1841
- var queuedMessageWaitHostNameSchema = z10.string().min(1).max(200);
1741
+ var queuedMessageWaitHostNameSchema = z9.string().min(1).max(200);
1842
1742
  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"),
1743
+ var queuedMessageWaitReasonSchema = z9.string().min(1).max(QUEUED_MESSAGE_WAIT_REASON_MAX_LENGTH);
1744
+ var queuedMessageWaitingOnSchema = z9.discriminatedUnion("kind", [
1745
+ z9.object({ kind: z9.literal("time") }),
1746
+ z9.object({ kind: z9.literal("thread-busy") }),
1747
+ z9.object({ kind: z9.literal("stopping") }),
1748
+ z9.object({ kind: z9.literal("turn-starting") }),
1749
+ z9.object({ kind: z9.literal("provisioning") }),
1750
+ z9.object({
1751
+ kind: z9.literal("host-offline"),
1852
1752
  hostName: queuedMessageWaitHostNameSchema
1853
1753
  }),
1854
- z10.object({ kind: z10.literal("interaction") }),
1855
- z10.object({
1856
- kind: z10.literal("plugin"),
1754
+ z9.object({ kind: z9.literal("interaction") }),
1755
+ z9.object({
1756
+ kind: z9.literal("plugin"),
1857
1757
  pluginId: pluginIdSchema,
1858
1758
  reason: queuedMessageWaitReasonSchema
1859
1759
  })
1860
1760
  ]);
1861
1761
  var QUEUED_MESSAGE_FAILURE_REASON_MAX_LENGTH = 200;
1862
- var queuedMessageFailureReasonSchema = z10.string().min(1).max(QUEUED_MESSAGE_FAILURE_REASON_MAX_LENGTH);
1762
+ var queuedMessageFailureReasonSchema = z9.string().min(1).max(QUEUED_MESSAGE_FAILURE_REASON_MAX_LENGTH);
1863
1763
  var QUEUED_MESSAGE_PLUGIN_WAIT_HOLDER_PREFIX = "plugin:";
1864
- var queuedMessageWaitHolderSchema = z10.templateLiteral([
1764
+ var queuedMessageWaitHolderSchema = z9.templateLiteral([
1865
1765
  QUEUED_MESSAGE_PLUGIN_WAIT_HOLDER_PREFIX,
1866
1766
  pluginIdSchema
1867
1767
  ]);
1868
1768
  var queuedMessagePayloadKindValues = ["inline", "retry"];
1869
- var queuedMessagePayloadKindSchema = z10.enum(
1769
+ var queuedMessagePayloadKindSchema = z9.enum(
1870
1770
  queuedMessagePayloadKindValues
1871
1771
  );
1872
- var queuedMessagePayloadSchema = z10.discriminatedUnion("kind", [
1873
- z10.object({ kind: z10.literal("inline") }),
1874
- z10.object({
1875
- kind: z10.literal("retry"),
1772
+ var queuedMessagePayloadSchema = z9.discriminatedUnion("kind", [
1773
+ z9.object({ kind: z9.literal("inline") }),
1774
+ z9.object({
1775
+ kind: z9.literal("retry"),
1876
1776
  /**
1877
1777
  * The ORIGINAL request, not the attempt that just failed. Retrying a retry
1878
1778
  * re-submits the same original blocks, so this id is carried forward
@@ -1880,7 +1780,7 @@ var queuedMessagePayloadSchema = z10.discriminatedUnion("kind", [
1880
1780
  */
1881
1781
  retryOfTurnRequestId: clientTurnRequestIdSchema,
1882
1782
  /** Which attempt this row will dispatch: 2 is the first retry. */
1883
- attempt: z10.number().int().min(2),
1783
+ attempt: z9.number().int().min(2),
1884
1784
  /**
1885
1785
  * Why this turn is being retried, in the retrier's words ("Rate limited"),
1886
1786
  * as the row's card and `bb thread queue list` render it.
@@ -1893,13 +1793,13 @@ var queuedMessagePayloadSchema = z10.discriminatedUnion("kind", [
1893
1793
  reason: queuedMessageWaitReasonSchema
1894
1794
  })
1895
1795
  ]);
1896
- var queuedMessageSystemNoticeSchema = z10.object({
1796
+ var queuedMessageSystemNoticeSchema = z9.object({
1897
1797
  kind: systemMessageKindSchema,
1898
1798
  subject: systemMessageSubjectSchema.nullable()
1899
1799
  });
1900
1800
 
1901
1801
  // ../domain/src/queued-message-lifecycle.ts
1902
- import { z as z11 } from "zod";
1802
+ import { z as z10 } from "zod";
1903
1803
  var queuedMessageStateValues = [
1904
1804
  "queued",
1905
1805
  "scheduled",
@@ -1908,10 +1808,10 @@ var queuedMessageStateValues = [
1908
1808
  "failed_exhausted",
1909
1809
  "claimed"
1910
1810
  ];
1911
- var queuedMessageStateSchema = z11.enum(queuedMessageStateValues);
1811
+ var queuedMessageStateSchema = z10.enum(queuedMessageStateValues);
1912
1812
 
1913
1813
  // ../domain/src/thread-status.ts
1914
- import { z as z12 } from "zod";
1814
+ import { z as z11 } from "zod";
1915
1815
  var threadStatusValues = [
1916
1816
  "pending",
1917
1817
  "idle",
@@ -1920,136 +1820,75 @@ var threadStatusValues = [
1920
1820
  "stopping",
1921
1821
  "error"
1922
1822
  ];
1923
- var threadStatusSchema = z12.enum(threadStatusValues);
1823
+ var threadStatusSchema = z11.enum(threadStatusValues);
1924
1824
 
1925
1825
  // ../domain/src/thread-origin-kind.ts
1926
- import { z as z13 } from "zod";
1826
+ import { z as z12 } from "zod";
1927
1827
  var threadOriginKindValues = ["fork"];
1928
- var threadOriginKindSchema = z13.enum(threadOriginKindValues);
1828
+ var threadOriginKindSchema = z12.enum(threadOriginKindValues);
1929
1829
 
1930
1830
  // ../domain/src/thread-parent-notifications.ts
1931
- import { z as z14 } from "zod";
1831
+ import { z as z13 } from "zod";
1932
1832
  var threadParentNotificationsValues = [
1933
1833
  "auto",
1934
1834
  "stuck",
1935
1835
  "off"
1936
1836
  ];
1937
- var threadParentNotificationsSchema = z14.enum(
1837
+ var threadParentNotificationsSchema = z13.enum(
1938
1838
  threadParentNotificationsValues
1939
1839
  );
1940
1840
 
1941
1841
  // ../domain/src/thread-visibility.ts
1942
- import { z as z15 } from "zod";
1842
+ import { z as z14 } from "zod";
1943
1843
  var threadVisibilityValues = ["visible", "hidden"];
1944
- var threadVisibilitySchema = z15.enum(threadVisibilityValues);
1844
+ var threadVisibilitySchema = z14.enum(threadVisibilityValues);
1945
1845
 
1946
1846
  // ../domain/src/thread-runtime-state.ts
1947
- import { z as z16 } from "zod";
1847
+ import { z as z15 } from "zod";
1948
1848
  var threadRuntimeDisplayStatusValues = [
1949
1849
  ...threadStatusValues,
1950
1850
  "provisioning",
1951
1851
  "waiting-for-host"
1952
1852
  ];
1953
- var threadRuntimeDisplayStatusSchema = z16.enum(
1853
+ var threadRuntimeDisplayStatusSchema = z15.enum(
1954
1854
  threadRuntimeDisplayStatusValues
1955
1855
  );
1956
- var threadRuntimeStateSchema = z16.object({
1856
+ var threadRuntimeStateSchema = z15.object({
1957
1857
  displayStatus: threadRuntimeDisplayStatusSchema
1958
1858
  });
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()
1859
+ var threadActivityStateSchema = z15.object({
1860
+ activeWorkflowCount: z15.number().int().nonnegative(),
1861
+ activeBackgroundAgentCount: z15.number().int().nonnegative(),
1862
+ activeBackgroundCommandCount: z15.number().int().nonnegative(),
1863
+ activePlanModeCount: z15.number().int().nonnegative(),
1864
+ activeGoalCount: z15.number().int().nonnegative()
1965
1865
  });
1966
1866
 
1967
1867
  // ../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(),
1868
+ var threadQueuedMessageSchema = z16.object({
1869
+ id: z16.string(),
2031
1870
  origin: threadCreateOriginSchema.nullable(),
2032
- originPluginId: z17.string().nullable(),
2033
- initiator: z17.enum(["user", "agent", "system"]),
2034
- senderThreadId: z17.string().nullable(),
1871
+ originPluginId: z16.string().nullable(),
1872
+ initiator: z16.enum(["user", "agent", "system"]),
1873
+ senderThreadId: z16.string().nullable(),
2035
1874
  /**
2036
1875
  * The thread this row is waiting on. Redundant on the thread-scoped list
2037
1876
  * route that first served this DTO, and load-bearing everywhere else it is
2038
1877
  * now served: a `queue.*` plugin event and a cross-thread wait-holder query
2039
1878
  * both hand out rows with no surrounding thread to read it from.
2040
1879
  */
2041
- threadId: z17.string(),
2042
- content: z17.array(promptInputSchema).min(1),
2043
- model: z17.string().min(1),
1880
+ threadId: z16.string(),
1881
+ content: z16.array(promptInputSchema).min(1),
1882
+ model: z16.string().min(1),
2044
1883
  reasoningLevel: reasoningLevelSchema,
2045
1884
  permissionMode: permissionModeSchema,
2046
1885
  serviceTier: serviceTierSchema,
2047
- groupWithNext: z17.boolean(),
1886
+ groupWithNext: z16.boolean(),
2048
1887
  /**
2049
1888
  * Epoch ms this row is scheduled to attempt dispatch, or null when it is
2050
1889
  * eligible as soon as its other waits clear.
2051
1890
  */
2052
- sendAt: z17.number().int().nonnegative().nullable(),
1891
+ sendAt: z16.number().int().nonnegative().nullable(),
2053
1892
  state: queuedMessageStateSchema,
2054
1893
  /**
2055
1894
  * Why this row is queued, or null for a `queued` row that is simply next in
@@ -2077,50 +1916,50 @@ var threadQueuedMessageSchema = z17.object({
2077
1916
  * not something a client should reason about. The server folds both into
2078
1917
  * this one answer.
2079
1918
  */
2080
- editable: z17.boolean(),
2081
- createdAt: z17.number(),
2082
- updatedAt: z17.number()
1919
+ editable: z16.boolean(),
1920
+ createdAt: z16.number(),
1921
+ updatedAt: z16.number()
2083
1922
  });
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(),
1923
+ var threadSchema = z16.object({
1924
+ id: z16.string(),
1925
+ projectId: z16.string(),
1926
+ environmentId: z16.string().nullable(),
1927
+ providerId: z16.string(),
1928
+ title: z16.string().nullable(),
1929
+ titleFallback: z16.string().nullable(),
1930
+ sectionId: z16.string().nullable(),
2092
1931
  status: threadStatusSchema,
2093
- parentThreadId: z17.string().nullable(),
2094
- lifecycleOwnerThreadId: z17.string().nullable(),
2095
- sourceThreadId: z17.string().nullable(),
1932
+ parentThreadId: z16.string().nullable(),
1933
+ lifecycleOwnerThreadId: z16.string().nullable(),
1934
+ sourceThreadId: z16.string().nullable(),
2096
1935
  originKind: threadOriginKindSchema.nullable(),
2097
- originPluginId: z17.string().nullable(),
1936
+ originPluginId: z16.string().nullable(),
2098
1937
  visibility: threadVisibilitySchema,
2099
1938
  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()
1939
+ archivedAt: z16.number().nullable(),
1940
+ pinnedAt: z16.number().nullable(),
1941
+ deletedAt: z16.number().nullable(),
1942
+ lastReadAt: z16.number().nullable(),
1943
+ latestAttentionAt: z16.number(),
1944
+ createdAt: z16.number(),
1945
+ updatedAt: z16.number()
2107
1946
  });
2108
1947
  var threadWithRuntimeSchema = threadSchema.extend({
2109
1948
  runtime: threadRuntimeStateSchema
2110
1949
  });
2111
1950
  var threadQueuedWorkValues = ["none", "waiting", "failed"];
2112
- var threadQueuedWorkSchema = z17.enum(threadQueuedWorkValues);
1951
+ var threadQueuedWorkSchema = z16.enum(threadQueuedWorkValues);
2113
1952
  var threadListEntrySchema = threadWithRuntimeSchema.extend({
2114
1953
  activity: threadActivityStateSchema,
2115
1954
  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(),
1955
+ pinSortKey: z16.string().nullable(),
1956
+ hasPendingInteraction: z16.boolean(),
1957
+ environmentHostId: z16.string().nullable(),
1958
+ environmentName: z16.string().nullable(),
1959
+ environmentBranchName: z16.string().nullable(),
1960
+ environmentPath: z16.string().nullable(),
1961
+ environmentProviderId: z16.string().nullable(),
1962
+ environmentIsWorktree: z16.boolean().nullable(),
2124
1963
  environmentWorkspaceDisplayKind: environmentWorkspaceDisplayKindSchema
2125
1964
  });
2126
1965
 
@@ -2164,7 +2003,8 @@ var ENVIRONMENT_CHANGE_KINDS = [
2164
2003
  var HOST_CHANGE_KINDS = [
2165
2004
  "host-connected",
2166
2005
  "host-disconnected",
2167
- "provider-model-catalog-changed"
2006
+ "provider-model-catalog-changed",
2007
+ "provider-commands-changed"
2168
2008
  ];
2169
2009
  var SYSTEM_CHANGE_KINDS = [
2170
2010
  "config-changed",
@@ -2176,16 +2016,16 @@ var SYSTEM_CHANGE_KINDS = [
2176
2016
  "server-move-changed",
2177
2017
  "app-update-changed"
2178
2018
  ];
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()
2019
+ var threadChangeKindSchema = z17.enum(THREAD_CHANGE_KINDS);
2020
+ var projectChangeKindSchema = z17.enum(PROJECT_CHANGE_KINDS);
2021
+ var environmentChangeKindSchema = z17.enum(ENVIRONMENT_CHANGE_KINDS);
2022
+ var hostChangeKindSchema = z17.enum(HOST_CHANGE_KINDS);
2023
+ var systemChangeKindSchema = z17.enum(SYSTEM_CHANGE_KINDS);
2024
+ var threadTimelineSubscriptionTargetSchema = z17.object({
2025
+ kind: z17.literal("thread-timeline"),
2026
+ threadId: z17.string().min(1),
2027
+ segmentLimit: z17.number().int().positive().nullable(),
2028
+ deferContent: z17.boolean()
2189
2029
  }).strict();
2190
2030
  function canonicalPluginReadInput(value) {
2191
2031
  if (value === null || typeof value !== "object") return JSON.stringify(value);
@@ -2195,62 +2035,62 @@ function canonicalPluginReadInput(value) {
2195
2035
  (key) => `${JSON.stringify(key)}:${canonicalPluginReadInput(value[key])}`
2196
2036
  ).join(",")}}`;
2197
2037
  }
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()
2038
+ var pluginReadSubscriptionTargetSchema = z17.object({
2039
+ kind: z17.literal("plugin-read"),
2040
+ pluginId: z17.string().min(1),
2041
+ method: z17.string().min(1),
2042
+ read: z17.union([
2043
+ z17.object({ input: jsonValueSchema }).strict(),
2044
+ z17.object({ key: z17.string() }).strict()
2205
2045
  ]).refine(
2206
2046
  (read) => new TextEncoder().encode(canonicalPluginReadInput(read)).byteLength <= 16384,
2207
2047
  "Plugin read input exceeds 16 KiB"
2208
2048
  )
2209
2049
  }).strict();
2210
- var realtimeSubscriptionTargetSchema = z18.discriminatedUnion("kind", [
2050
+ var realtimeSubscriptionTargetSchema = z17.discriminatedUnion("kind", [
2211
2051
  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)
2052
+ z17.object({ kind: z17.literal("plugin"), pluginId: z17.string().min(1) }).strict(),
2053
+ z17.object({
2054
+ kind: z17.literal("thread-detail"),
2055
+ threadId: z17.string().min(1)
2216
2056
  }).strict(),
2217
2057
  threadTimelineSubscriptionTargetSchema,
2218
- z18.object({
2219
- kind: z18.literal("thread-list")
2058
+ z17.object({
2059
+ kind: z17.literal("thread-list")
2220
2060
  }).strict(),
2221
- z18.object({
2222
- kind: z18.literal("project-detail"),
2223
- projectId: z18.string().min(1)
2061
+ z17.object({
2062
+ kind: z17.literal("project-detail"),
2063
+ projectId: z17.string().min(1)
2224
2064
  }).strict(),
2225
- z18.object({
2226
- kind: z18.literal("project-list")
2065
+ z17.object({
2066
+ kind: z17.literal("project-list")
2227
2067
  }).strict(),
2228
- z18.object({
2229
- kind: z18.literal("environment-detail"),
2230
- environmentId: z18.string().min(1)
2068
+ z17.object({
2069
+ kind: z17.literal("environment-detail"),
2070
+ environmentId: z17.string().min(1)
2231
2071
  }).strict(),
2232
- z18.object({
2233
- kind: z18.literal("environment-list")
2072
+ z17.object({
2073
+ kind: z17.literal("environment-list")
2234
2074
  }).strict(),
2235
- z18.object({
2236
- kind: z18.literal("host-detail"),
2237
- hostId: z18.string().min(1)
2075
+ z17.object({
2076
+ kind: z17.literal("host-detail"),
2077
+ hostId: z17.string().min(1)
2238
2078
  }).strict(),
2239
- z18.object({
2240
- kind: z18.literal("host-list")
2079
+ z17.object({
2080
+ kind: z17.literal("host-list")
2241
2081
  }).strict(),
2242
- z18.object({
2243
- kind: z18.literal("system")
2082
+ z17.object({
2083
+ kind: z17.literal("system")
2244
2084
  }).strict()
2245
2085
  ]);
2246
2086
  function isValidSubscriptionTarget(value) {
2247
2087
  return realtimeSubscriptionTargetSchema.safeParse(value).success;
2248
2088
  }
2249
- var validSubscriptionTargetsSchema = z18.preprocess(
2089
+ var validSubscriptionTargetsSchema = z17.preprocess(
2250
2090
  (value) => Array.isArray(value) ? value.filter(isValidSubscriptionTarget) : value,
2251
- z18.array(realtimeSubscriptionTargetSchema)
2091
+ z17.array(realtimeSubscriptionTargetSchema)
2252
2092
  );
2253
- var validSubscriptionTargetSchema = z18.preprocess(
2093
+ var validSubscriptionTargetSchema = z17.preprocess(
2254
2094
  (value) => value === void 0 || isValidSubscriptionTarget(value) ? value : null,
2255
2095
  realtimeSubscriptionTargetSchema.nullable().optional()
2256
2096
  );
@@ -2259,84 +2099,88 @@ var subscriptionFields = {
2259
2099
  targets: validSubscriptionTargetsSchema.optional()
2260
2100
  };
2261
2101
  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")
2102
+ var subscribeMessageSchema = z17.object({
2103
+ type: z17.literal("subscribe"),
2104
+ ...subscriptionFields,
2105
+ timelineTags: z17.record(z17.string(), z17.string().min(1).nullable()).optional()
2106
+ }).refine(hasSubscriptionTargets);
2107
+ var unsubscribeMessageSchema = z17.object({ type: z17.literal("unsubscribe"), ...subscriptionFields }).refine(hasSubscriptionTargets);
2108
+ var pingMessageSchema = z17.object({
2109
+ type: z17.literal("ping")
2266
2110
  });
2267
- var visibilityMessageSchema = z18.object({
2268
- type: z18.literal("visibility"),
2269
- visible: z18.boolean()
2111
+ var visibilityMessageSchema = z17.object({
2112
+ type: z17.literal("visibility"),
2113
+ visible: z17.boolean()
2270
2114
  });
2271
- var clientMessageSchema = z18.discriminatedUnion("type", [
2115
+ var clientMessageSchema = z17.discriminatedUnion("type", [
2272
2116
  subscribeMessageSchema,
2273
2117
  unsubscribeMessageSchema,
2274
2118
  pingMessageSchema,
2275
2119
  visibilityMessageSchema
2276
2120
  ]);
2277
- var pongMessageSchema = z18.object({
2278
- type: z18.literal("pong")
2121
+ var pongMessageSchema = z17.object({
2122
+ type: z17.literal("pong")
2279
2123
  }).strict();
2280
- var pongMessageLenientSchema = z18.object({
2281
- type: z18.literal("pong")
2124
+ var pongMessageLenientSchema = z17.object({
2125
+ type: z17.literal("pong")
2282
2126
  });
2283
- var threadStatusChangeMetadataSchema = z18.object({
2127
+ var threadStatusChangeMetadataSchema = z17.object({
2284
2128
  status: threadStatusSchema,
2285
2129
  runtime: threadRuntimeStateSchema,
2286
2130
  activity: threadActivityStateSchema,
2287
- latestAttentionAt: z18.number(),
2288
- updatedAt: z18.number()
2131
+ latestAttentionAt: z17.number(),
2132
+ updatedAt: z17.number()
2289
2133
  }).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(),
2134
+ var threadChangeMetadataSchema = z17.object({
2135
+ backgroundActivityChanged: z17.boolean().optional(),
2136
+ eventTypes: z17.array(threadEventTypeSchema).readonly().optional(),
2137
+ timelineSequence: z17.number().int().nonnegative().optional(),
2138
+ hasPendingInteraction: z17.boolean().optional(),
2139
+ projectId: z17.string().optional(),
2296
2140
  statusChange: threadStatusChangeMetadataSchema.optional()
2297
2141
  }).strict();
2298
- var threadChangedMessageSchema = z18.object({
2299
- type: z18.literal("changed"),
2300
- entity: z18.literal("thread"),
2301
- id: z18.string().optional(),
2142
+ var threadChangedMessageSchema = z17.object({
2143
+ type: z17.literal("changed"),
2144
+ entity: z17.literal("thread"),
2145
+ id: z17.string().optional(),
2302
2146
  metadata: threadChangeMetadataSchema.optional(),
2303
- changes: z18.array(threadChangeKindSchema).readonly()
2147
+ changes: z17.array(threadChangeKindSchema).readonly()
2304
2148
  }).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()
2149
+ var projectChangedMessageSchema = z17.object({
2150
+ type: z17.literal("changed"),
2151
+ entity: z17.literal("project"),
2152
+ id: z17.string().optional(),
2153
+ changes: z17.array(projectChangeKindSchema).readonly()
2310
2154
  }).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()
2155
+ var environmentChangedMessageSchema = z17.object({
2156
+ type: z17.literal("changed"),
2157
+ entity: z17.literal("environment"),
2158
+ id: z17.string().optional(),
2159
+ changes: z17.array(environmentChangeKindSchema).readonly()
2316
2160
  }).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()
2161
+ var hostChangedMessageSchema = z17.object({
2162
+ type: z17.literal("changed"),
2163
+ entity: z17.literal("host"),
2164
+ id: z17.string().optional(),
2165
+ changes: z17.array(hostChangeKindSchema).readonly()
2322
2166
  }).strict();
2323
- var systemChangedMessageSchema = z18.object({
2324
- type: z18.literal("changed"),
2325
- entity: z18.literal("system"),
2326
- changes: z18.array(systemChangeKindSchema).readonly()
2167
+ var systemChangedMessageSchema = z17.object({
2168
+ type: z17.literal("changed"),
2169
+ entity: z17.literal("system"),
2170
+ changes: z17.array(systemChangeKindSchema).readonly()
2327
2171
  }).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)
2172
+ var tagsChangedMessageSchema = z17.object({
2173
+ type: z17.literal("changed"),
2174
+ entity: z17.literal("tags"),
2175
+ tags: z17.array(z17.string().min(1)).min(1)
2332
2176
  }).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()
2177
+ var pluginChangedMessageSchema = z17.object({
2178
+ type: z17.literal("changed"),
2179
+ entity: z17.literal("plugin"),
2180
+ pluginId: z17.string().min(1),
2181
+ tags: z17.array(z17.string().min(1)).min(1).nullable()
2338
2182
  }).strict();
2339
- var changedMessageSchema = z18.discriminatedUnion("entity", [
2183
+ var changedMessageSchema = z17.discriminatedUnion("entity", [
2340
2184
  threadChangedMessageSchema,
2341
2185
  projectChangedMessageSchema,
2342
2186
  environmentChangedMessageSchema,
@@ -2347,56 +2191,56 @@ var changedMessageSchema = z18.discriminatedUnion("entity", [
2347
2191
  ]);
2348
2192
  function lenientKinds(kinds) {
2349
2193
  const known = new Set(kinds);
2350
- return z18.array(z18.string()).transform(
2194
+ return z17.array(z17.string()).transform(
2351
2195
  (values) => values.filter((value) => known.has(value))
2352
2196
  );
2353
2197
  }
2354
2198
  var knownThreadEventTypes = new Set(
2355
2199
  threadEventTypeValues
2356
2200
  );
2357
- var threadChangeMetadataLenientSchema = z18.object({
2358
- timelineSequence: z18.number().int().nonnegative().optional(),
2359
- backgroundActivityChanged: z18.boolean().optional(),
2360
- eventTypes: z18.array(z18.string()).transform(
2201
+ var threadChangeMetadataLenientSchema = z17.object({
2202
+ timelineSequence: z17.number().int().nonnegative().optional(),
2203
+ backgroundActivityChanged: z17.boolean().optional(),
2204
+ eventTypes: z17.array(z17.string()).transform(
2361
2205
  (values) => values.filter(
2362
2206
  (value) => knownThreadEventTypes.has(value)
2363
2207
  )
2364
2208
  ).optional(),
2365
- hasPendingInteraction: z18.boolean().optional(),
2366
- projectId: z18.string().optional(),
2209
+ hasPendingInteraction: z17.boolean().optional(),
2210
+ projectId: z17.string().optional(),
2367
2211
  statusChange: threadStatusChangeMetadataSchema.optional().catch(void 0)
2368
2212
  });
2369
- var threadChangedMessageLenientSchema = z18.object({
2370
- type: z18.literal("changed"),
2371
- entity: z18.literal("thread"),
2372
- id: z18.string().optional(),
2213
+ var threadChangedMessageLenientSchema = z17.object({
2214
+ type: z17.literal("changed"),
2215
+ entity: z17.literal("thread"),
2216
+ id: z17.string().optional(),
2373
2217
  metadata: threadChangeMetadataLenientSchema.optional(),
2374
2218
  changes: lenientKinds(THREAD_CHANGE_KINDS)
2375
2219
  });
2376
- var projectChangedMessageLenientSchema = z18.object({
2377
- type: z18.literal("changed"),
2378
- entity: z18.literal("project"),
2379
- id: z18.string().optional(),
2220
+ var projectChangedMessageLenientSchema = z17.object({
2221
+ type: z17.literal("changed"),
2222
+ entity: z17.literal("project"),
2223
+ id: z17.string().optional(),
2380
2224
  changes: lenientKinds(PROJECT_CHANGE_KINDS)
2381
2225
  });
2382
- var environmentChangedMessageLenientSchema = z18.object({
2383
- type: z18.literal("changed"),
2384
- entity: z18.literal("environment"),
2385
- id: z18.string().optional(),
2226
+ var environmentChangedMessageLenientSchema = z17.object({
2227
+ type: z17.literal("changed"),
2228
+ entity: z17.literal("environment"),
2229
+ id: z17.string().optional(),
2386
2230
  changes: lenientKinds(ENVIRONMENT_CHANGE_KINDS)
2387
2231
  });
2388
- var hostChangedMessageLenientSchema = z18.object({
2389
- type: z18.literal("changed"),
2390
- entity: z18.literal("host"),
2391
- id: z18.string().optional(),
2232
+ var hostChangedMessageLenientSchema = z17.object({
2233
+ type: z17.literal("changed"),
2234
+ entity: z17.literal("host"),
2235
+ id: z17.string().optional(),
2392
2236
  changes: lenientKinds(HOST_CHANGE_KINDS)
2393
2237
  });
2394
- var systemChangedMessageLenientSchema = z18.object({
2395
- type: z18.literal("changed"),
2396
- entity: z18.literal("system"),
2238
+ var systemChangedMessageLenientSchema = z17.object({
2239
+ type: z17.literal("changed"),
2240
+ entity: z17.literal("system"),
2397
2241
  changes: lenientKinds(SYSTEM_CHANGE_KINDS)
2398
2242
  });
2399
- var changedMessageLenientSchema = z18.discriminatedUnion("entity", [
2243
+ var changedMessageLenientSchema = z17.discriminatedUnion("entity", [
2400
2244
  threadChangedMessageLenientSchema,
2401
2245
  projectChangedMessageLenientSchema,
2402
2246
  environmentChangedMessageLenientSchema,
@@ -2407,22 +2251,22 @@ var changedMessageLenientSchema = z18.discriminatedUnion("entity", [
2407
2251
  ]);
2408
2252
 
2409
2253
  // src/internal/rpc-tags.ts
2410
- import { z as z19 } from "zod";
2411
- var rpcInvalidationTags = z19.array(z19.string().min(1)).min(1);
2254
+ import { z as z18 } from "zod";
2255
+ var rpcInvalidationTags = z18.array(z18.string().min(1)).min(1);
2412
2256
  function rpcResponseTags(declarations, input, output) {
2413
- const tags = z19.array(z19.string().min(1)).parse(declarations.tags?.(input, output) ?? []);
2257
+ const tags = z18.array(z18.string().min(1)).parse(declarations.tags?.(input, output) ?? []);
2414
2258
  const keyTags = {};
2415
2259
  if (declarations.keyTags && typeof output === "object" && output !== null && !Array.isArray(output)) {
2416
2260
  for (const [key, value] of Object.entries(output)) {
2417
- keyTags[key] = z19.array(z19.string().min(1)).parse(declarations.keyTags(key, value));
2261
+ keyTags[key] = z18.array(z18.string().min(1)).parse(declarations.keyTags(key, value));
2418
2262
  }
2419
2263
  }
2420
- const invalidated = z19.array(z19.string().min(1)).parse(declarations.invalidates?.(input, output) ?? []);
2264
+ const invalidated = z18.array(z18.string().min(1)).parse(declarations.invalidates?.(input, output) ?? []);
2421
2265
  return { tags, keyTags, invalidated };
2422
2266
  }
2423
2267
 
2424
2268
  // src/internal/rpc-query-host.ts
2425
- import { z as z20 } from "zod";
2269
+ import { z as z19 } from "zod";
2426
2270
  var rpcQueryKey = (pluginId, method, input) => [
2427
2271
  "plugin-rpc",
2428
2272
  pluginId,
@@ -2564,7 +2408,7 @@ function createRpcQueryHooks(useHost) {
2564
2408
  const enabled = options.enabled ?? true;
2565
2409
  const identity = JSON.stringify([...new Set(options.keys)].sort());
2566
2410
  const keys = useMemo2(
2567
- () => z20.array(z20.string()).parse(JSON.parse(identity)),
2411
+ () => z19.array(z19.string()).parse(JSON.parse(identity)),
2568
2412
  [identity]
2569
2413
  );
2570
2414
  let cache = owners.get(host.queryClient);
@@ -2590,7 +2434,7 @@ function createRpcQueryHooks(useHost) {
2590
2434
  );
2591
2435
  return {
2592
2436
  ...response,
2593
- result: z20.record(z20.string(), jsonValueSchema).parse(response.result)
2437
+ result: z19.record(z19.string(), jsonValueSchema).parse(response.result)
2594
2438
  };
2595
2439
  }
2596
2440
  });