t3code-cli 0.14.1 → 0.15.0

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.
Files changed (185) hide show
  1. package/README.md +37 -1
  2. package/dist/application.d.ts +2 -2
  3. package/dist/application.js +1 -1
  4. package/dist/auth.d.ts +1 -1
  5. package/dist/auth.js +1 -1
  6. package/dist/bin.js +1305 -424
  7. package/dist/cli.d.ts +1 -1
  8. package/dist/cli.js +1 -1
  9. package/dist/client-runtime/authorization.d.ts +1 -1
  10. package/dist/client-runtime/authorization.js +1 -1
  11. package/dist/client-runtime/connection.d.ts +1 -1
  12. package/dist/client-runtime/connection.js +1 -1
  13. package/dist/client-runtime/environment.d.ts +7 -1
  14. package/dist/client-runtime/environment.js +1 -1
  15. package/dist/client-runtime/errors.js +1 -1
  16. package/dist/client-runtime/operations/projects.d.ts +2 -2
  17. package/dist/client-runtime/operations/projects.js +2 -2
  18. package/dist/client-runtime/operations.d.ts +2 -2
  19. package/dist/client-runtime/operations.js +2 -2
  20. package/dist/client-runtime/platform.d.ts +1 -1
  21. package/dist/client-runtime/platform.js +1 -1
  22. package/dist/client-runtime/relay.d.ts +13 -2
  23. package/dist/client-runtime/relay.js +12 -2
  24. package/dist/client-runtime/rpc.d.ts +2 -2
  25. package/dist/client-runtime/rpc.js +2 -2
  26. package/dist/client-runtime/state/assets.d.ts +17 -11
  27. package/dist/client-runtime/state/assets.js +1 -1
  28. package/dist/client-runtime/state/auth.d.ts +1 -1
  29. package/dist/client-runtime/state/auth.js +1 -1
  30. package/dist/client-runtime/state/connections.js +1 -1
  31. package/dist/client-runtime/state/entities.d.ts +1 -1
  32. package/dist/client-runtime/state/entities.js +1 -1
  33. package/dist/client-runtime/state/filesystem.d.ts +1 -1
  34. package/dist/client-runtime/state/filesystem.js +1 -1
  35. package/dist/client-runtime/state/git.d.ts +6 -5
  36. package/dist/client-runtime/state/git.js +1 -1
  37. package/dist/client-runtime/state/models.d.ts +1 -1
  38. package/dist/client-runtime/state/models.js +1 -1
  39. package/dist/client-runtime/state/orchestration.d.ts +42 -2
  40. package/dist/client-runtime/state/orchestration.js +13 -1
  41. package/dist/client-runtime/state/presentation.d.ts +15 -3
  42. package/dist/client-runtime/state/presentation.js +1 -1
  43. package/dist/client-runtime/state/preview.d.ts +58 -48
  44. package/dist/client-runtime/state/preview.js +3 -2
  45. package/dist/client-runtime/state/project-grouping.d.ts +26 -2
  46. package/dist/client-runtime/state/project-grouping.js +83 -3
  47. package/dist/client-runtime/state/projects.d.ts +24 -18
  48. package/dist/client-runtime/state/projects.js +1 -1
  49. package/dist/client-runtime/state/pull-requests.d.ts +478 -0
  50. package/dist/client-runtime/state/pull-requests.js +172 -0
  51. package/dist/client-runtime/state/relay.d.ts +1 -1
  52. package/dist/client-runtime/state/relay.js +1 -1
  53. package/dist/client-runtime/state/review.d.ts +16 -1
  54. package/dist/client-runtime/state/review.js +27 -6
  55. package/dist/client-runtime/state/runtime.d.ts +2 -2
  56. package/dist/client-runtime/state/runtime.js +2 -2
  57. package/dist/client-runtime/state/server.d.ts +311 -172
  58. package/dist/client-runtime/state/server.js +192 -16
  59. package/dist/client-runtime/state/session.d.ts +77 -7
  60. package/dist/client-runtime/state/session.js +32 -3
  61. package/dist/client-runtime/state/shell.d.ts +47 -7
  62. package/dist/client-runtime/state/shell.js +1 -1
  63. package/dist/client-runtime/state/source-control.d.ts +2 -2
  64. package/dist/client-runtime/state/source-control.js +1 -1
  65. package/dist/client-runtime/state/subagentRuntime.d.ts +145 -0
  66. package/dist/client-runtime/state/subagentRuntime.js +521 -0
  67. package/dist/client-runtime/state/terminal.d.ts +17 -17
  68. package/dist/client-runtime/state/terminal.js +1 -1
  69. package/dist/client-runtime/state/thread-search.d.ts +23 -0
  70. package/dist/client-runtime/state/thread-search.js +38 -0
  71. package/dist/client-runtime/state/thread-settled.d.ts +32 -4
  72. package/dist/client-runtime/state/thread-settled.js +2 -157
  73. package/dist/client-runtime/state/thread-sort.d.ts +59 -2
  74. package/dist/client-runtime/state/thread-sort.js +128 -2
  75. package/dist/client-runtime/state/threads.d.ts +115 -3
  76. package/dist/client-runtime/state/threads.js +309 -28
  77. package/dist/client-runtime/state/vcs.d.ts +14 -14
  78. package/dist/client-runtime/state/vcs.js +1 -1
  79. package/dist/config.d.ts +1 -1
  80. package/dist/config.js +1 -1
  81. package/dist/connection.d.ts +1 -1
  82. package/dist/connection.js +1 -1
  83. package/dist/contracts.d.ts +1 -1
  84. package/dist/contracts.js +1 -1
  85. package/dist/index.d.ts +1 -1
  86. package/dist/index.js +1 -1
  87. package/dist/node.d.ts +1 -1
  88. package/dist/node.js +1 -1
  89. package/dist/orchestration.d.ts +155 -6
  90. package/dist/orchestration.js +2 -2
  91. package/dist/preview.d.ts +1 -1
  92. package/dist/preview.js +1 -1
  93. package/dist/rpc.d.ts +887 -360
  94. package/dist/rpc.js +1 -1
  95. package/dist/runtime.d.ts +1 -1
  96. package/dist/runtime.js +1 -1
  97. package/dist/shared/DrainableWorker.js +1 -1
  98. package/dist/shared/KeyedCoalescingWorker.js +1 -1
  99. package/dist/shared/Net.d.ts +6 -0
  100. package/dist/shared/Net.js +2 -1
  101. package/dist/shared/advertisedEndpoint.d.ts +1 -1
  102. package/dist/shared/advertisedEndpoint.js +1 -1
  103. package/dist/shared/agentAwareness.d.ts +1 -1
  104. package/dist/shared/backgroundActivitySettings.d.ts +1 -1
  105. package/dist/shared/composerInlineTokens.js +1 -1
  106. package/dist/shared/connectAuth.d.ts +23 -4
  107. package/dist/shared/connectAuth.js +40 -7
  108. package/dist/shared/devHome.js +1 -1
  109. package/dist/shared/dpop.js +1 -1
  110. package/dist/shared/git.d.ts +1 -1
  111. package/dist/shared/httpObservability.js +1 -1
  112. package/dist/shared/httpReadiness.js +1 -1
  113. package/dist/shared/keybindings.d.ts +2 -2
  114. package/dist/shared/keybindings.js +15 -1
  115. package/dist/shared/model.d.ts +1 -1
  116. package/dist/shared/oauthScope.js +1 -1
  117. package/dist/shared/observability.d.ts +8 -1
  118. package/dist/shared/observability.js +49 -5
  119. package/dist/shared/path.js +1 -1
  120. package/dist/shared/preview.js +1 -1
  121. package/dist/shared/previewViewport.d.ts +1 -1
  122. package/dist/shared/previewViewport.js +1 -1
  123. package/dist/shared/projectFavicon.d.ts +2 -1
  124. package/dist/shared/projectFavicon.js +13 -1
  125. package/dist/shared/projectScripts.d.ts +1 -1
  126. package/dist/shared/relayAuth.js +1 -1
  127. package/dist/shared/relayClient.d.ts +1 -1
  128. package/dist/shared/relayClient.js +1 -1
  129. package/dist/shared/relayJwt.js +1 -1
  130. package/dist/shared/relayTracing.js +1 -1
  131. package/dist/shared/relayUrl.js +1 -1
  132. package/dist/shared/remote.js +1 -1
  133. package/dist/shared/schemaYaml.js +3 -3
  134. package/dist/shared/semver.js +1 -1
  135. package/dist/shared/serverSettings.d.ts +1 -1
  136. package/dist/shared/serverSettings.js +1 -1
  137. package/dist/shared/shell.d.ts +6 -1
  138. package/dist/shared/shell.js +42 -4
  139. package/dist/shared/sourceControl.d.ts +1 -1
  140. package/dist/shared/t3ProjectFile.d.ts +9 -1
  141. package/dist/shared/t3ProjectFile.js +12 -2
  142. package/dist/shared/terminalLabels.d.ts +1 -1
  143. package/dist/shared/threadEnvMode.d.ts +29 -0
  144. package/dist/shared/threadEnvMode.js +24 -0
  145. package/dist/shared/toolActivity.d.ts +1 -1
  146. package/dist/shared/usageFormat.d.ts +34 -0
  147. package/dist/shared/usageFormat.js +176 -0
  148. package/dist/shared/usageMerge.d.ts +78 -0
  149. package/dist/shared/usageMerge.js +241 -0
  150. package/dist/shared.d.ts +8268 -1372
  151. package/dist/shared.js +22185 -19774
  152. package/dist/t3tools.d.ts +2 -2
  153. package/dist/t3tools.js +2 -2
  154. package/package.json +5 -5
  155. package/src/application/error.ts +2 -2
  156. package/src/application/index.ts +2 -0
  157. package/src/application/service.ts +43 -5
  158. package/src/application/thread-commands.ts +78 -0
  159. package/src/application/threads.ts +156 -17
  160. package/src/cli/app.ts +4 -0
  161. package/src/cli/ask-lifecycle.ts +331 -0
  162. package/src/cli/ask.ts +390 -0
  163. package/src/cli/error.ts +70 -0
  164. package/src/cli/format/thread.ts +49 -7
  165. package/src/cli/search.ts +48 -0
  166. package/src/cli/thread.ts +12 -0
  167. package/src/cli/threads/messages.ts +33 -3
  168. package/src/cli/threads/pin.ts +46 -0
  169. package/src/cli/threads/send.ts +5 -1
  170. package/src/cli/threads/settle.ts +46 -0
  171. package/src/cli/threads/snooze.ts +117 -0
  172. package/src/cli/threads/start.ts +6 -1
  173. package/src/cli/threads/unpin.ts +48 -0
  174. package/src/cli/threads/unsettle.ts +48 -0
  175. package/src/cli/threads/unsnooze.ts +48 -0
  176. package/src/config/persist/schema.ts +1 -1
  177. package/src/connection/prepared.ts +12 -2
  178. package/src/orchestration/error.ts +10 -0
  179. package/src/orchestration/index.ts +1 -0
  180. package/src/orchestration/layer.ts +78 -0
  181. package/src/orchestration/service.ts +16 -3
  182. package/src/rpc/error.ts +2 -0
  183. package/src/rpc/operation.ts +2 -0
  184. package/src/rpc/ws-group.ts +3 -0
  185. package/src/runtime/layer.ts +9 -4
@@ -1,17 +1,16 @@
1
- import { $D as flatMap, $t as projectRefCollectionKey, Aa as EnvironmentSupervisor, BD as andThen, BE as filter$1, Bk as isSome, Cn as startThreadTurn, Cv as get$1, Dn as unsnoozeThread, EO as succeed, En as unsettleThread, Ev as update, Fk as getOrElse, Fr as buildEnvironmentAuthHeaders, GC as set, GD as catchCause, Gr as family, HD as as, Hk as match, IC as HttpClient, IE as debounce, Ik as getOrNull, Io as environmentEndpointUrl, Ir as withEnvironmentCredentials, JD as catchTags, JS as EnvironmentId, Ja as ManagedRelayDpopSigner, Jr as setIdleTTL, Jt as arrayElementsEqual, KE as map$3, Kk as Number$1, La as EnvironmentCacheStore, Lk as getOrThrow, Mo as executeEnvironmentHttpRequest, No as makeEnvironmentHttpApiClient, QO as effect, Qk as mapInput, RD as addFinalizer, RO as void_, Sn as snoozeThread, Sv as changes, Tn as unarchiveThread, Tv as set$1, UC as get, Uk as none, VD as annotateLogs, Vk as map$2, WC as make$2, WE as fromQueue, Wk as some, Wr as subscribeDynamic, XE as never, XO as pretty, Xk as combineAll, Xr as withLabel, Xt as parseProjectRefCollectionKey, YD as catch_, Yk as combine, ZO as squash, Zt as parseThreadKey, _O as orElseSucceed, _k as map$1, _n as respondToThreadUserInput, aO as gen, bO as provideService, bn as setThreadRuntimeMode, cA as pipe, cO as logDebug, eO as fn, fn as createThread, gk as filter, gn as respondToThreadApproval, hk as append, hn as interruptThreadTurn, iO as forkScoped, ja as ConnectionWakeups, kk as Service, kn as updateThreadMetadata, ky as ORCHESTRATION_WS_METHODS, lD as unwrap, lO as logWarning, lr as createAtomCommandScheduler, mn as deleteThread, nD as runHead, nn as threadRefsEqual, or as scopeThread, qk as String, qr as make, sr as scopeThreadShell, tD as runForEach, ti as value, tn as threadKey, uO as map, un as archiveThread, ur as createEnvironmentCommand, vD as offer, vk as sort, vn as revertThreadCheckpoint, wO as serviceOption, wn as stopThreadSession, wv as make$1, xD as sliding, xn as settleThread, xr as followStreamInEnvironment, xs as connectionProjectionPhase, yn as setThreadInteractionMode, zD as all, zk as isNone } from "../../shared.js";
1
+ import { $A as runHead, AN as Service, Aj as andThen, An as unsettleThread, Ba as shouldResubscribeAfterWakeup, By as changes, CM as sync, Cn as setThreadRuntimeMode, DD as set, Dn as stopThreadSession, Dr as followStreamInEnvironment, ED as make$2, En as startThreadTurn, Fj as catchCause, GN as none, Gj as flatMap$1, HN as isSome, Ho as makeEnvironmentHttpApiClient, Hr as buildEnvironmentAuthHeaders, Hy as make$1, JM as squash, JN as Number$1, KN as some, Ka as EnvironmentCacheStore, Kj as fn, Ko as environmentEndpointUrl, Kr as make, LA as filter$1, LN as getOrElse, ME as EnvironmentId, Mj as as, NA as debounce, NM as void_, NN as flatMap, Nn as updateThreadMetadata, OD as update$1, Oj as addFinalizer, On as unarchiveThread, QA as runForEach, QN as combineAll, Qj as gen, Qt as parseThreadKey, RN as getOrNull, Ra as EnvironmentSupervisor, Rj as catchTags, Sn as setThreadInteractionMode, TD as get, Tn as snoozeThread, UA as map$3, UN as map$2, Ur as withEnvironmentCredentials, Uy as set$1, VA as fromQueue, VN as isNone, Vo as executeEnvironmentHttpRequest, Vy as get$1, WN as match, Wr as family, Wy as update, XS as ORCHESTRATION_WS_METHODS, YM as effect, YN as String, Yr as withLabel, Yt as arrayElementsEqual, ZN as combine, Zj as forkScoped, Zt as parseProjectRefCollectionKey, _j as offerUnsafe, _n as pinThread, bj as sliding, bn as respondToThreadUserInput, dn as archiveThread, dr as scopeThread, eP as mapInput, ei as value, en as projectRefCollectionKey, fM as orElseSucceed, fj as make$3, fr as scopeThreadShell, gN as sort, gj as offer, gn as interruptThreadTurn, hM as provideService, hN as map$1, hn as deleteThread, hr as createEnvironmentCommand, jj as annotateLogs, jn as unsnoozeThread, js as connectionProjectionPhase, kN as Reference, kj as all, kn as unpinThread, li as subscribeDynamic, mN as filter, mr as createAtomCommandScheduler, nM as logWarning, nn as threadKey, pN as append, pn as createThread, qA as never, qM as pretty, qr as setIdleTTL, rM as map, rn as threadRefsEqual, ro as ManagedRelayDpopSigner, sj as unwrap, tM as logDebug, uP as pipe, vD as HttpClient, vn as reorderPinnedThread, wn as settleThread, xM as succeed, xn as revertThreadCheckpoint, yM as serviceOption, yn as respondToThreadApproval, zN as getOrThrow, za as ConnectionWakeups, zj as catch_ } from "../../shared.js";
2
2
  //#region upstream-t3code/packages/client-runtime/src/state/threadSnapshotHttp.ts
3
3
  const DEFAULT_THREAD_SNAPSHOT_TIMEOUT_MS = 6e3;
4
- /**
5
- * Load a thread's detail snapshot over HTTP instead of embedding it in the
6
- * WebSocket subscription's first frame. The response is gzip-compressible by
7
- * the transport and keeps the (potentially multi-KB) snapshot off the socket.
8
- */
9
4
  const fetchEnvironmentThreadSnapshot = fn("clientRuntime.state.fetchEnvironmentThreadSnapshot")(function* (input) {
10
5
  const requestUrl = environmentEndpointUrl(input.prepared.httpBaseUrl, `/api/orchestration/threads/${input.threadId}`);
11
6
  const client = yield* makeEnvironmentHttpApiClient(input.prepared.httpBaseUrl);
12
7
  const headers = yield* buildEnvironmentAuthHeaders(input.prepared.httpAuthorization, "GET", requestUrl, input.signer);
13
8
  return yield* executeEnvironmentHttpRequest(requestUrl, input.timeoutMs ?? DEFAULT_THREAD_SNAPSHOT_TIMEOUT_MS, withEnvironmentCredentials(input.prepared.httpAuthorization, client.orchestration.threadSnapshot({
14
9
  params: { threadId: input.threadId },
10
+ payload: {
11
+ ...input.window !== void 0 ? { turnLimit: input.window.turnLimit } : {},
12
+ ...input.window?.beforeCursor !== void 0 ? { beforeCursor: input.window.beforeCursor } : {}
13
+ },
15
14
  headers
16
15
  })));
17
16
  });
@@ -25,10 +24,11 @@ var ThreadSnapshotLoader = class extends Service()("@t3tools/client-runtime/stat
25
24
  const threadSnapshotLoaderLayer = effect(ThreadSnapshotLoader, gen(function* () {
26
25
  const httpClient = yield* HttpClient;
27
26
  const signer = yield* serviceOption(ManagedRelayDpopSigner);
28
- return ThreadSnapshotLoader.of({ load: (prepared, threadId) => fetchEnvironmentThreadSnapshot({
27
+ return ThreadSnapshotLoader.of({ load: (prepared, threadId, window) => fetchEnvironmentThreadSnapshot({
29
28
  prepared,
30
29
  threadId,
31
- signer
30
+ signer,
31
+ ...window !== void 0 ? { window } : {}
32
32
  }).pipe(map(some), provideService(HttpClient, httpClient), catchTags({ EnvironmentResourceNotFoundError: () => logDebug("Thread snapshot not found over HTTP; deferring to the socket subscription.").pipe(annotateLogs({ threadId }), as(none())) }), catchCause((cause) => logWarning("Could not load the thread snapshot over HTTP; using the socket snapshot instead.").pipe(annotateLogs({
33
33
  threadId,
34
34
  cause: pretty(cause)
@@ -44,6 +44,17 @@ const activityOrder = combineAll([
44
44
  mapInput(String, (a) => a.id)
45
45
  ]);
46
46
  /**
47
+ * Matches the validity rule in `deriveLatestContextWindowSnapshot` (and the
48
+ * server's snapshot-side `dropStaleContextWindowActivities`): rows without a
49
+ * finite, non-negative `usedTokens` are skipped during the consumer's backward
50
+ * walk, so they must not replace an earlier resolvable row here.
51
+ */
52
+ function isResolvableContextWindowActivity(activity) {
53
+ if (activity.kind !== "context-window.updated") return false;
54
+ const usedTokens = (activity.payload && typeof activity.payload === "object" ? activity.payload : null)?.usedTokens;
55
+ return typeof usedTokens === "number" && Number.isFinite(usedTokens) && usedTokens >= 0;
56
+ }
57
+ /**
47
58
  * Apply a single orchestration event to an `OrchestrationThread`, returning
48
59
  * the updated thread, a deletion signal, or an "unchanged" marker when the
49
60
  * event doesn't affect this thread.
@@ -90,6 +101,7 @@ function applyThreadDetailEvent(thread, event) {
90
101
  thread: {
91
102
  ...thread,
92
103
  archivedAt: event.payload.archivedAt,
104
+ titleRegeneration: null,
93
105
  updatedAt: event.payload.updatedAt
94
106
  }
95
107
  };
@@ -137,11 +149,38 @@ function applyThreadDetailEvent(thread, event) {
137
149
  updatedAt: event.payload.updatedAt
138
150
  }
139
151
  };
152
+ case "thread.pinned": return {
153
+ kind: "updated",
154
+ thread: {
155
+ ...thread,
156
+ pinnedAt: event.payload.pinnedAt,
157
+ ...event.payload.pinOrderKey !== void 0 ? { pinOrderKey: event.payload.pinOrderKey } : {},
158
+ updatedAt: event.payload.updatedAt
159
+ }
160
+ };
161
+ case "thread.unpinned": return {
162
+ kind: "updated",
163
+ thread: {
164
+ ...thread,
165
+ pinnedAt: null,
166
+ pinOrderKey: null,
167
+ updatedAt: event.payload.updatedAt
168
+ }
169
+ };
170
+ case "thread.pin-reordered": return {
171
+ kind: "updated",
172
+ thread: {
173
+ ...thread,
174
+ pinOrderKey: event.payload.orderKey,
175
+ updatedAt: event.payload.updatedAt
176
+ }
177
+ };
140
178
  case "thread.meta-updated": return {
141
179
  kind: "updated",
142
180
  thread: {
143
181
  ...thread,
144
182
  ...event.payload.title !== void 0 ? { title: event.payload.title } : {},
183
+ ...event.payload.titleRegeneration !== void 0 ? { titleRegeneration: event.payload.titleRegeneration } : {},
145
184
  ...event.payload.modelSelection !== void 0 ? { modelSelection: event.payload.modelSelection } : {},
146
185
  ...event.payload.branch !== void 0 ? { branch: event.payload.branch } : {},
147
186
  ...event.payload.worktreePath !== void 0 ? { worktreePath: event.payload.worktreePath } : {},
@@ -341,7 +380,9 @@ function applyThreadDetailEvent(thread, event) {
341
380
  };
342
381
  }
343
382
  case "thread.activity-appended": {
344
- const activities = pipe(thread.activities, filter((activity) => activity.id !== event.payload.activity.id), append(event.payload.activity), sort(activityOrder));
383
+ const activity = event.payload.activity;
384
+ const supersedesContextWindow = isResolvableContextWindowActivity(activity);
385
+ const activities = pipe(thread.activities, filter((entry) => entry.id !== activity.id && !(supersedesContextWindow && entry.turnId === activity.turnId && isResolvableContextWindowActivity(entry))), append(activity), sort(activityOrder));
345
386
  return {
346
387
  kind: "updated",
347
388
  thread: {
@@ -401,8 +442,16 @@ const THREAD_STATE_IDLE_TTL_MS = 5 * 6e4;
401
442
  const EMPTY_ENVIRONMENT_THREAD_STATE = {
402
443
  data: none(),
403
444
  status: "empty",
404
- error: none()
445
+ error: none(),
446
+ page: none()
405
447
  };
448
+ /** Whether the thread has older turns that can be loaded with more pages. */
449
+ function threadHasOlderTurns(state) {
450
+ return match(state.page, {
451
+ onNone: () => false,
452
+ onSome: (page) => page.hasMore
453
+ });
454
+ }
406
455
  //#endregion
407
456
  //#region upstream-t3code/packages/client-runtime/src/state/archivedThreads.ts
408
457
  const ARCHIVED_THREADS_ENVIRONMENT_KEY_SEPARATOR = "";
@@ -493,6 +542,24 @@ function createThreadEnvironmentAtoms(runtime) {
493
542
  scheduler,
494
543
  concurrency
495
544
  }),
545
+ pin: createEnvironmentCommand(runtime, {
546
+ label: "environment-data:commands:thread:pin",
547
+ execute: (input) => pinThread(input),
548
+ scheduler,
549
+ concurrency
550
+ }),
551
+ unpin: createEnvironmentCommand(runtime, {
552
+ label: "environment-data:commands:thread:unpin",
553
+ execute: (input) => unpinThread(input),
554
+ scheduler,
555
+ concurrency
556
+ }),
557
+ reorderPin: createEnvironmentCommand(runtime, {
558
+ label: "environment-data:commands:thread:reorder-pin",
559
+ execute: (input) => reorderPinnedThread(input),
560
+ scheduler,
561
+ concurrency
562
+ }),
496
563
  updateMetadata: createEnvironmentCommand(runtime, {
497
564
  label: "environment-data:commands:thread:update-metadata",
498
565
  execute: (input) => updateThreadMetadata(input),
@@ -586,6 +653,8 @@ function mergeEnvironmentThread(detail, shell) {
586
653
  settledAt: shell.settledAt,
587
654
  snoozedUntil: shell.snoozedUntil,
588
655
  snoozedAt: shell.snoozedAt,
656
+ pinnedAt: shell.pinnedAt,
657
+ pinOrderKey: shell.pinOrderKey,
589
658
  session: shell.session
590
659
  };
591
660
  }
@@ -744,6 +813,58 @@ function createEnvironmentThreadShellAtoms(input) {
744
813
  function statusWithoutLiveData(data) {
745
814
  return isSome(data) ? "cached" : "empty";
746
815
  }
816
+ /**
817
+ * Turn window sizes for paginated thread loads: the initial page covers the
818
+ * last 10 user-anchored turns (subagent/fan-out turns ride along), each
819
+ * "load earlier" tap fetches 20 more. Sized so first paint on the heaviest
820
+ * observed threads stays around 100K gzipped while median threads load fully.
821
+ */
822
+ const INITIAL_THREAD_USER_TURN_LIMIT = 10;
823
+ const OLDER_THREAD_PAGE_USER_TURN_LIMIT = 20;
824
+ function pageStateFromSnapshot(page) {
825
+ return page === void 0 ? none() : some({
826
+ beforeCursor: page.beforeCursor,
827
+ hasMore: page.hasMore,
828
+ loadingOlder: false
829
+ });
830
+ }
831
+ function makeThreadOlderTurnRequestRegistry() {
832
+ const handlers = /* @__PURE__ */ new Map();
833
+ return {
834
+ register: (key, handler) => {
835
+ handlers.set(key, handler);
836
+ return () => {
837
+ if (handlers.get(key) === handler) handlers.delete(key);
838
+ };
839
+ },
840
+ request: (key) => {
841
+ const handler = handlers.get(key);
842
+ if (handler === void 0) return false;
843
+ handler();
844
+ return true;
845
+ }
846
+ };
847
+ }
848
+ const defaultOlderTurnRequestRegistry = makeThreadOlderTurnRequestRegistry();
849
+ /**
850
+ * Channel from UI actions to the live per-thread state machines. The machines
851
+ * resolve it from the Effect environment (overridable in tests); the default
852
+ * instance is shared with the sync `requestOlderThreadTurns` entry point so
853
+ * the apps get working wiring without providing anything.
854
+ */
855
+ var ThreadOlderTurnRequests = class extends Reference("@t3tools/client-runtime/state/threads/ThreadOlderTurnRequests", { defaultValue: () => defaultOlderTurnRequestRegistry }) {};
856
+ /**
857
+ * Asks the live state machine for `threadId` to fetch the next older page.
858
+ * Returns false when no machine is live or no fetch was started (no cursor,
859
+ * already loading); callers render from `EnvironmentThreadState.page` and can
860
+ * treat false as "nothing to do".
861
+ */
862
+ function requestOlderThreadTurns(environmentId, threadId) {
863
+ return defaultOlderTurnRequestRegistry.request(threadKey({
864
+ environmentId,
865
+ threadId
866
+ }));
867
+ }
747
868
  function formatThreadError(cause) {
748
869
  const error = squash(cause);
749
870
  return error instanceof Error && error.message.trim().length > 0 ? error.message : "Could not synchronize the thread.";
@@ -767,13 +888,18 @@ const makeEnvironmentThreadState = fn("EnvironmentThreadState.make")(function* (
767
888
  const state = yield* make$1({
768
889
  data: cachedThread,
769
890
  status: statusWithoutLiveData(cachedThread),
770
- error: none()
891
+ error: none(),
892
+ page: flatMap(cached, (snapshot) => pageStateFromSnapshot(snapshot.page))
771
893
  });
772
894
  const lastSequence = yield* make$1(match(cached, {
773
895
  onNone: () => 0,
774
896
  onSome: (snapshot) => snapshot.snapshotSequence
775
897
  }));
776
898
  const awaitingCompletion = yield* make$2(false);
899
+ const historyEpoch = yield* make$2(0);
900
+ const applyLock = yield* make$3(1);
901
+ const paginationSupported = yield* make$2(false);
902
+ const pendingOlderPage = yield* make$2(null);
777
903
  const persistence = yield* sliding(1);
778
904
  const persist = fn("EnvironmentThreadState.persist")(function* (snapshot) {
779
905
  yield* cache.saveThread(environmentId, snapshot).pipe(catch_((error) => logWarning("Could not persist the thread cache.").pipe(annotateLogs({
@@ -795,6 +921,7 @@ const makeEnvironmentThreadState = fn("EnvironmentThreadState.make")(function* (
795
921
  });
796
922
  const setDisconnected = gen(function* () {
797
923
  yield* set(awaitingCompletion, false);
924
+ yield* set(paginationSupported, false);
798
925
  yield* update(state, (current) => ({
799
926
  ...current,
800
927
  status: current.status === "deleted" ? current.status : statusWithoutLiveData(current.data)
@@ -805,27 +932,39 @@ const makeEnvironmentThreadState = fn("EnvironmentThreadState.make")(function* (
805
932
  status: current.status === "deleted" ? current.status : statusWithoutLiveData(current.data),
806
933
  error: some(formatThreadError(cause))
807
934
  }))));
808
- const setThread = fn("EnvironmentThreadState.setThread")(function* (thread) {
935
+ const setThread = fn("EnvironmentThreadState.setThread")(function* (thread, page) {
809
936
  const waiting = yield* get(awaitingCompletion);
810
- yield* set$1(state, {
937
+ yield* update(state, (current) => ({
811
938
  data: some(thread),
812
939
  status: waiting ? "synchronizing" : "live",
813
- error: none()
814
- });
940
+ error: none(),
941
+ page: page === "keep" ? current.page : page
942
+ }));
815
943
  if (shouldPersistThread(thread)) {
816
944
  const snapshotSequence = yield* get$1(lastSequence);
945
+ const currentPage = yield* get$1(state).pipe(map((value) => value.page));
817
946
  yield* offer(persistence, {
818
947
  snapshotSequence,
819
- thread
948
+ thread,
949
+ ...match(currentPage, {
950
+ onNone: () => ({}),
951
+ onSome: (value) => ({ page: {
952
+ beforeCursor: value.beforeCursor,
953
+ hasMore: value.hasMore,
954
+ snapshotSequence
955
+ } })
956
+ })
820
957
  });
821
958
  }
822
959
  });
823
960
  const setDeleted = fn("EnvironmentThreadState.setDeleted")(function* () {
824
961
  yield* set(awaitingCompletion, false);
962
+ yield* update$1(historyEpoch, (epoch) => epoch + 1);
825
963
  yield* set$1(state, {
826
964
  data: none(),
827
965
  status: "deleted",
828
- error: none()
966
+ error: none(),
967
+ page: none()
829
968
  });
830
969
  yield* cache.removeThread(environmentId, threadId).pipe(catch_((error) => logWarning("Could not remove the cached thread.").pipe(annotateLogs({
831
970
  environmentId,
@@ -833,7 +972,7 @@ const makeEnvironmentThreadState = fn("EnvironmentThreadState.make")(function* (
833
972
  error: error.message
834
973
  }))));
835
974
  });
836
- const applyItem = fn("EnvironmentThreadState.applyItem")(function* (item) {
975
+ const applyItemLocked = fn("EnvironmentThreadState.applyItemLocked")(function* (item) {
837
976
  if (item.kind === "synchronized") {
838
977
  yield* set(awaitingCompletion, false);
839
978
  yield* update(state, (current) => isSome(current.data) && current.status !== "deleted" ? {
@@ -844,8 +983,9 @@ const makeEnvironmentThreadState = fn("EnvironmentThreadState.make")(function* (
844
983
  return;
845
984
  }
846
985
  if (item.kind === "snapshot") {
986
+ yield* update$1(historyEpoch, (epoch) => epoch + 1);
847
987
  yield* set$1(lastSequence, item.snapshot.snapshotSequence);
848
- yield* setThread(item.snapshot.thread);
988
+ yield* setThread(item.snapshot.thread, pageStateFromSnapshot(item.snapshot.page));
849
989
  return;
850
990
  }
851
991
  const sequence = yield* get$1(lastSequence);
@@ -856,9 +996,117 @@ const makeEnvironmentThreadState = fn("EnvironmentThreadState.make")(function* (
856
996
  if (item.event.type === "thread.deleted") yield* setDeleted();
857
997
  return;
858
998
  }
999
+ if (item.event.type === "thread.reverted") yield* update$1(historyEpoch, (epoch) => epoch + 1);
859
1000
  const result = applyThreadDetailEvent(current.data.value, item.event);
860
- if (result.kind === "updated") yield* setThread(result.thread);
1001
+ if (result.kind === "updated") yield* setThread(result.thread, "keep");
861
1002
  else if (result.kind === "deleted") yield* setDeleted();
1003
+ yield* tryMergePendingOlderPage();
1004
+ });
1005
+ const tryMergePendingOlderPage = fn("EnvironmentThreadState.tryMergePendingOlderPage")(function* () {
1006
+ const pending = yield* get(pendingOlderPage);
1007
+ if (pending === null) return;
1008
+ if ((yield* get(historyEpoch)) !== pending.epoch) {
1009
+ yield* set(pendingOlderPage, null);
1010
+ yield* update(state, (value) => ({
1011
+ ...value,
1012
+ page: map$2(value.page, (existing) => ({
1013
+ ...existing,
1014
+ loadingOlder: false
1015
+ }))
1016
+ }));
1017
+ return;
1018
+ }
1019
+ const watermark = pending.snapshot.page?.threadSequence;
1020
+ const loadedSequence = yield* get$1(lastSequence);
1021
+ if (watermark !== void 0 && watermark > loadedSequence) return;
1022
+ yield* set(pendingOlderPage, null);
1023
+ yield* mergeOlderPage(pending.snapshot);
1024
+ });
1025
+ const applyItem = fn("EnvironmentThreadState.applyItem")(function* (item) {
1026
+ yield* applyLock.withPermits(1)(applyItemLocked(item));
1027
+ });
1028
+ const mergeOlderPage = fn("EnvironmentThreadState.mergeOlderPage")(function* (snapshot) {
1029
+ let merged = null;
1030
+ yield* update(state, (value) => {
1031
+ if (isNone(value.data)) return value;
1032
+ const loaded = value.data.value;
1033
+ const older = snapshot.thread;
1034
+ const mergeById = (olderRows, loadedRows) => {
1035
+ const seen = new Set(loadedRows.map((row) => row.id));
1036
+ return [...olderRows.filter((row) => !seen.has(row.id)), ...loadedRows];
1037
+ };
1038
+ const seenCheckpoints = new Set(loaded.checkpoints.map((row) => row.turnId));
1039
+ merged = {
1040
+ ...loaded,
1041
+ messages: mergeById(older.messages, loaded.messages),
1042
+ activities: mergeById(older.activities, loaded.activities),
1043
+ proposedPlans: mergeById(older.proposedPlans, loaded.proposedPlans),
1044
+ checkpoints: [...older.checkpoints.filter((row) => !seenCheckpoints.has(row.turnId)), ...loaded.checkpoints]
1045
+ };
1046
+ return {
1047
+ ...value,
1048
+ data: some(merged),
1049
+ page: pageStateFromSnapshot(snapshot.page)
1050
+ };
1051
+ });
1052
+ if (merged !== null && shouldPersistThread(merged)) {
1053
+ const snapshotSequence = yield* get$1(lastSequence);
1054
+ yield* offer(persistence, {
1055
+ snapshotSequence,
1056
+ thread: merged,
1057
+ ...snapshot.page === void 0 ? {} : { page: {
1058
+ ...snapshot.page,
1059
+ snapshotSequence
1060
+ } }
1061
+ });
1062
+ }
1063
+ });
1064
+ const loadOlderTurns = fn("EnvironmentThreadState.loadOlderTurns")(function* () {
1065
+ if (!(yield* get(paginationSupported))) return;
1066
+ const page = getOrNull((yield* get$1(state)).page);
1067
+ if (page === null || page.loadingOlder || !page.hasMore || page.beforeCursor === null) return;
1068
+ const prepared = getOrNull(yield* get$1(supervisor.prepared));
1069
+ if (prepared === null) return;
1070
+ const epochAtStart = yield* get(historyEpoch);
1071
+ yield* update(state, (value) => ({
1072
+ ...value,
1073
+ page: map$2(value.page, (existing) => ({
1074
+ ...existing,
1075
+ loadingOlder: true
1076
+ }))
1077
+ }));
1078
+ const window = {
1079
+ turnLimit: 20,
1080
+ beforeCursor: page.beforeCursor
1081
+ };
1082
+ const response = yield* snapshotLoader.load(prepared, threadId, window);
1083
+ yield* applyLock.withPermits(1)(gen(function* () {
1084
+ const epochNow = yield* get(historyEpoch);
1085
+ const loadedSequence = yield* get$1(lastSequence);
1086
+ const stale = epochNow !== epochAtStart || match(response, {
1087
+ onNone: () => false,
1088
+ onSome: (snapshot) => snapshot.snapshotSequence < loadedSequence
1089
+ });
1090
+ if (isNone(response) || stale) {
1091
+ yield* update(state, (value) => ({
1092
+ ...value,
1093
+ page: map$2(value.page, (existing) => ({
1094
+ ...existing,
1095
+ loadingOlder: false
1096
+ }))
1097
+ }));
1098
+ return;
1099
+ }
1100
+ const watermark = response.value.page?.threadSequence;
1101
+ if (watermark !== void 0 && watermark > loadedSequence) {
1102
+ yield* set(pendingOlderPage, {
1103
+ snapshot: response.value,
1104
+ epoch: epochNow
1105
+ });
1106
+ return;
1107
+ }
1108
+ yield* mergeOlderPage(response.value);
1109
+ }));
862
1110
  });
863
1111
  yield* changes(supervisor.state).pipe(runForEach((connectionState) => {
864
1112
  switch (connectionProjectionPhase(connectionState)) {
@@ -869,20 +1117,34 @@ const makeEnvironmentThreadState = fn("EnvironmentThreadState.make")(function* (
869
1117
  }), forkScoped);
870
1118
  const foregroundResubscriptions = match(wakeups, {
871
1119
  onNone: () => never,
872
- onSome: (service) => service.changes.pipe(filter$1((reason) => reason === "application-active"))
1120
+ onSome: (service) => service.changes.pipe(filter$1(shouldResubscribeAfterWakeup))
873
1121
  });
874
1122
  yield* setSynchronizing;
875
1123
  yield* forkScoped(subscribeDynamic(ORCHESTRATION_WS_METHODS.subscribeThread, fn("EnvironmentThreadState.makeSubscribeInput")(function* (session) {
876
- const supportsCompletionMarker = yield* session.initialConfig.pipe(map((config) => config.threadResumeCompletionMarker === true), orElseSucceed(() => false));
1124
+ const config = yield* session.initialConfig.pipe(orElseSucceed(() => ({})));
1125
+ const supportsCompletionMarker = config.threadResumeCompletionMarker === true;
1126
+ const supportsPagination = config.threadSnapshotPagination === true;
1127
+ yield* set(paginationSupported, supportsPagination);
877
1128
  yield* set(awaitingCompletion, supportsCompletionMarker);
878
1129
  yield* setSynchronizing;
879
1130
  let current = yield* get$1(state);
1131
+ if (!supportsPagination && isSome(current.page)) {
1132
+ yield* update$1(historyEpoch, (epoch) => epoch + 1);
1133
+ yield* update(state, (value) => ({
1134
+ ...value,
1135
+ data: none(),
1136
+ status: value.status === "deleted" ? value.status : "empty",
1137
+ page: none()
1138
+ }));
1139
+ yield* set$1(lastSequence, 0);
1140
+ current = yield* get$1(state);
1141
+ }
880
1142
  if (isNone(current.data) && current.status !== "deleted") {
881
- const prepared = yield* get$1(supervisor.prepared).pipe(flatMap(match({
1143
+ const prepared = yield* get$1(supervisor.prepared).pipe(flatMap$1(match({
882
1144
  onSome: succeed,
883
1145
  onNone: () => changes(supervisor.prepared).pipe(filter$1(isSome), map$3((value) => value.value), runHead, map(getOrThrow))
884
1146
  })));
885
- const httpSnapshot = yield* snapshotLoader.load(prepared, threadId);
1147
+ const httpSnapshot = yield* snapshotLoader.load(prepared, threadId, supportsPagination ? { turnLimit: 10 } : void 0);
886
1148
  if (isSome(httpSnapshot)) {
887
1149
  yield* applyItem({
888
1150
  kind: "snapshot",
@@ -901,18 +1163,37 @@ const makeEnvironmentThreadState = fn("EnvironmentThreadState.make")(function* (
901
1163
  return {
902
1164
  threadId,
903
1165
  ...canResume ? { afterSequence: sequence } : {},
904
- ...supportsCompletionMarker ? { requestCompletionMarker: true } : {}
1166
+ ...supportsCompletionMarker ? { requestCompletionMarker: true } : {},
1167
+ ...supportsPagination ? { turnLimit: 10 } : {}
905
1168
  };
906
1169
  }), {
907
1170
  onExpectedFailure: setStreamError,
908
1171
  retryExpectedFailureAfter: "250 millis",
909
1172
  resubscribe: foregroundResubscriptions
910
1173
  }).pipe(runForEach(applyItem)));
911
- yield* addFinalizer(() => all([get$1(state), get$1(lastSequence)]).pipe(flatMap(([current, snapshotSequence]) => match(current.data, {
1174
+ const olderTurnRequestRegistry = yield* ThreadOlderTurnRequests;
1175
+ const olderTurnRequests = yield* sliding(1);
1176
+ yield* fromQueue(olderTurnRequests).pipe(runForEach(() => loadOlderTurns()), forkScoped);
1177
+ const deregister = olderTurnRequestRegistry.register(threadKey({
1178
+ environmentId,
1179
+ threadId
1180
+ }), () => {
1181
+ offerUnsafe(olderTurnRequests, void 0);
1182
+ });
1183
+ yield* addFinalizer(() => sync(deregister));
1184
+ yield* addFinalizer(() => all([get$1(state), get$1(lastSequence)]).pipe(flatMap$1(([current, snapshotSequence]) => match(current.data, {
912
1185
  onNone: () => void_,
913
1186
  onSome: (thread) => shouldPersistThread(thread) ? persist({
914
1187
  snapshotSequence,
915
- thread
1188
+ thread,
1189
+ ...match(current.page, {
1190
+ onNone: () => ({}),
1191
+ onSome: (page) => ({ page: {
1192
+ beforeCursor: page.beforeCursor,
1193
+ hasMore: page.hasMore,
1194
+ snapshotSequence
1195
+ } })
1196
+ })
916
1197
  }) : void_
917
1198
  }))));
918
1199
  return state;
@@ -931,4 +1212,4 @@ function createEnvironmentThreadStateAtoms(runtime) {
931
1212
  })) };
932
1213
  }
933
1214
  //#endregion
934
- export { EMPTY_ENVIRONMENT_THREAD_STATE, ThreadSnapshotLoader, applyThreadDetailEvent, createArchivedThreadSnapshotsAtomFamily, createEnvironmentThreadDetailAtoms, createEnvironmentThreadShellAtoms, createEnvironmentThreadStateAtoms, createThreadEnvironmentAtoms, fetchEnvironmentThreadSnapshot, makeArchivedThreadsEnvironmentKey, makeEnvironmentThreadState, mergeEnvironmentThread, parseArchivedThreadsEnvironmentKey, threadSnapshotLoaderLayer, threadStateChanges };
1215
+ export { EMPTY_ENVIRONMENT_THREAD_STATE, INITIAL_THREAD_USER_TURN_LIMIT, OLDER_THREAD_PAGE_USER_TURN_LIMIT, ThreadOlderTurnRequests, ThreadSnapshotLoader, applyThreadDetailEvent, createArchivedThreadSnapshotsAtomFamily, createEnvironmentThreadDetailAtoms, createEnvironmentThreadShellAtoms, createEnvironmentThreadStateAtoms, createThreadEnvironmentAtoms, fetchEnvironmentThreadSnapshot, makeArchivedThreadsEnvironmentKey, makeEnvironmentThreadState, mergeEnvironmentThread, parseArchivedThreadsEnvironmentKey, requestOlderThreadTurns, threadHasOlderTurns, threadSnapshotLoaderLayer, threadStateChanges };
@@ -1,4 +1,4 @@
1
- import { $T as ThreadId, AS as GitPullRequestMaterializationError, BS as TextGenerationError, Ca as EnvironmentCacheStore, ES as GitManagerError, FS as GitRunStackedActionResult, Fl as ServerConfig, KS as VcsListRefsInput, PS as GitRunStackedActionInput, TS as GitCommandError, XS as VcsRef$1, _ as AtomCommandResult, _a as EnvironmentSupervisor, bS as VcsUnsupportedOperationError, bT as EnvironmentAuthorizationError, ba as ConnectionPersistenceError, cv as OrchestrationShellSnapshot, dS as VcsProcessOutputReadError, f as AtomCommand, fS as VcsProcessSpawnError, gv as OrchestrationThreadDetailSnapshot, hC as SourceControlProviderError, hS as VcsProcessTimeoutError, ha as EnvironmentRegistry, lS as VcsProcessMissingExitCodeError, mS as VcsProcessStdinWriteError, ma as EnvironmentNotRegisteredError, oS as VcsProcessExitError, on as EnvironmentRpcUnavailableError, qS as VcsListRefsResult, tC as VcsStatusResult, uS as VcsProcessOutputLimitError, vS as VcsRepositoryDetectionError, xS as GitActionProgressEvent, zS as GitStackedAction, zT as EnvironmentId } from "../../shared.js";
1
+ import { $O as EnvironmentAuthorizationError, Aa as EnvironmentSupervisor, Cw as VcsProcessExitError, Da as EnvironmentNotRegisteredError, Dw as VcsProcessOutputLimitError, Ew as VcsProcessMissingExitCodeError, Fw as VcsRepositoryDetectionError, Hw as GitCommandError, Ia as EnvironmentCacheStore, Lw as VcsUnsupportedOperationError, Mw as VcsProcessTimeoutError, Na as ConnectionPersistenceError, Nk as ThreadId, Oa as EnvironmentRegistry, Ow as VcsProcessOutputReadError, Qw as GitRunStackedActionResult, Rw as GitActionProgressEvent, Su as ServerConfig, UD as SourceControlProviderError, Uw as GitManagerError, Zw as GitRunStackedActionInput, _ as AtomCommandResult, ab as OrchestrationShellSnapshot, f as AtomCommand, hn as EnvironmentRpcUnavailableError, jw as VcsProcessStdinWriteError, kw as VcsProcessSpawnError, lT as VcsListRefsInput, mb as OrchestrationThreadDetailSnapshot, nT as GitStackedAction, pT as VcsRef$1, qw as GitPullRequestMaterializationError, rT as TextGenerationError, uT as VcsListRefsResult, vT as VcsStatusResult, vk as EnvironmentId } from "../../shared.js";
2
2
  import * as Effect from "effect/Effect";
3
3
  import * as Stream from "effect/Stream";
4
4
  import * as Schema from "effect/Schema";
@@ -304,9 +304,9 @@ declare function createVcsEnvironmentAtoms<R, E>(runtime: Atom.AtomRuntime<Envir
304
304
  }, E | EnvironmentAuthorizationError | EnvironmentRpcUnavailableError | GitCommandError | import("effect/Cause").NoSuchElementError | import("effect/unstable/rpc/RpcClientError").RpcClientError>>;
305
305
  status: (target: {
306
306
  readonly environmentId: EnvironmentId;
307
- readonly input: import("effect/Schema").Struct.ReadonlyMakeIn<{
308
- readonly cwd: import("effect/Schema").decodeTo<import("effect/Schema").String, import("effect/Schema").String, never, never>;
309
- }>;
307
+ readonly input: {
308
+ readonly cwd: string;
309
+ };
310
310
  }) => Atom.Atom<import("effect/unstable/reactivity/AsyncResult").AsyncResult<{
311
311
  readonly isRepo: boolean;
312
312
  readonly sourceControlProvider?: {
@@ -342,9 +342,9 @@ declare function createVcsEnvironmentAtoms<R, E>(runtime: Atom.AtomRuntime<Envir
342
342
  }, E | EnvironmentAuthorizationError | GitCommandError | GitManagerError | GitPullRequestMaterializationError | import("effect/Cause").NoSuchElementError | import("effect/unstable/rpc/RpcClientError").RpcClientError | SourceControlProviderError | TextGenerationError>>;
343
343
  pull: AtomCommand<{
344
344
  readonly environmentId: EnvironmentId;
345
- readonly input: import("effect/Schema").Struct.ReadonlyMakeIn<{
346
- readonly cwd: import("effect/Schema").decodeTo<import("effect/Schema").String, import("effect/Schema").String, never, never>;
347
- }>;
345
+ readonly input: {
346
+ readonly cwd: string;
347
+ };
348
348
  }, {
349
349
  readonly status: "pulled" | "skipped_up_to_date";
350
350
  readonly refName: string;
@@ -352,9 +352,9 @@ declare function createVcsEnvironmentAtoms<R, E>(runtime: Atom.AtomRuntime<Envir
352
352
  }, E | EnvironmentAuthorizationError | EnvironmentNotRegisteredError | EnvironmentRpcUnavailableError | GitCommandError | import("effect/unstable/rpc/RpcClientError").RpcClientError>;
353
353
  refreshStatus: AtomCommand<{
354
354
  readonly environmentId: EnvironmentId;
355
- readonly input: import("effect/Schema").Struct.ReadonlyMakeIn<{
356
- readonly cwd: import("effect/Schema").decodeTo<import("effect/Schema").String, import("effect/Schema").String, never, never>;
357
- }>;
355
+ readonly input: {
356
+ readonly cwd: string;
357
+ };
358
358
  }, {
359
359
  readonly isRepo: boolean;
360
360
  readonly sourceControlProvider?: {
@@ -423,10 +423,10 @@ declare function createVcsEnvironmentAtoms<R, E>(runtime: Atom.AtomRuntime<Envir
423
423
  }, E | EnvironmentAuthorizationError | EnvironmentNotRegisteredError | EnvironmentRpcUnavailableError | GitCommandError | import("effect/unstable/rpc/RpcClientError").RpcClientError>;
424
424
  switchRef: AtomCommand<{
425
425
  readonly environmentId: EnvironmentId;
426
- readonly input: import("effect/Schema").Struct.ReadonlyMakeIn<{
427
- readonly cwd: import("effect/Schema").decodeTo<import("effect/Schema").String, import("effect/Schema").String, never, never>;
428
- readonly refName: import("effect/Schema").decodeTo<import("effect/Schema").String, import("effect/Schema").String, never, never>;
429
- }>;
426
+ readonly input: {
427
+ readonly cwd: string;
428
+ readonly refName: string;
429
+ };
430
430
  }, {
431
431
  readonly refName: string | null;
432
432
  }, E | EnvironmentAuthorizationError | EnvironmentNotRegisteredError | EnvironmentRpcUnavailableError | GitCommandError | import("effect/unstable/rpc/RpcClientError").RpcClientError>;
@@ -1,4 +1,4 @@
1
- import { $D as flatMap, $r as failure, AO as tapError, Aa as EnvironmentSupervisor, Cv as get, DO as suspend, Dk as seconds, Dr as runStreamInEnvironment, EO as succeed, Ek as min, FE as concat, Fs as WS_METHODS, GT as Defect, Gr as family, HD as as, HE as fromEffect, HO as modifyDelay, Hk as match, Hr as runStream, Hu as GitActionProgressPhase, JS as EnvironmentId, JT as Literals, Jr as setIdleTTL, KE as map, Kr as keepAlive, La as EnvironmentCacheStore, MD as nowUnsafe, ND as toEpochMillis, Na as safeErrorLogAttributes, OO as sync, PE as changes$1, Q as applyGitStatusStreamEvent, QD as fail, QT as String, RO as void_, St as vcsCommandScheduler, Sv as changes, Uk as none, Ur as subscribe, VD as annotateLogs, VE as filterMap, VO as exponential, Vr as request, Wk as some, XT as NullOr, Xr as withLabel, YD as catch_, YO as hasInterruptsOnly, ZD as ensuring, ZE as retry, ZO as squash, ZT as Number, Zr as AtomRegistry, aO as gen, bO as provideService, bk as failVoid, bt as withVcsRefsPersistenceLock, dr as createEnvironmentRpcCommand, eE as TaggedErrorClass, eO as fn, ei as isSuccess, gr as createRuntimeCommand, hr as createEnvironmentSubscriptionAtomFamily, lD as unwrap, lO as logWarning, nE as Union, oD as switchMap, oE as decodeUnknownSync, qE as mapAccum, qO as fail$1, qr as make, rt as isTemporaryWorktreeBranch, tD as runForEach, tE as Tuple, td as GitStackedAction, vt as invalidateCachedVcsRefs, wk as succeed$1, xr as followStreamInEnvironment, xt as vcsCommandConcurrency, yt as vcsRefsCacheStateAtom, zE as empty } from "../../shared.js";
1
+ import { $r as isSuccess, Bk as Tuple, By as changes, CM as sync, DN as seconds, Dr as followStreamInEnvironment, Fk as NullOr, GM as hasInterruptsOnly, GN as none, Gj as flatMap, Gr as keepAlive, Ha as safeErrorLogAttributes, IA as empty, IM as exponential, Ik as Number, JA as retry, JM as squash, KN as some, Ka as EnvironmentCacheStore, Kj as fn, Kk as decodeUnknownSync, Kr as make, LM as modifyDelay, Lk as String, MA as concat, ME as EnvironmentId, Mj as as, NM as void_, Nk as Literals, Nr as runStreamInEnvironment, Q as applyGitStatusStreamEvent, QA as runForEach, Qj as gen, Qr as failure, RA as filterMap, Ra as EnvironmentSupervisor, SM as suspend, SN as succeed$1, Sr as createRuntimeCommand, St as vcsCommandScheduler, TM as tapError, TN as min, UA as map, UM as fail$1, Uj as fail, Vj as ensuring, Vk as Union, Vy as get, WA as mapAccum, WN as match, Wr as family, Xr as AtomRegistry, Yr as withLabel, _r as createEnvironmentRpcCommand, bA as nowUnsafe, bf as GitStackedAction, bt as withVcsRefsPersistenceLock, ci as subscribe, hM as provideService, jA as changes$1, jj as annotateLogs, kk as Defect, lc as WS_METHODS, nM as logWarning, oi as request, qr as setIdleTTL, rj as switchMap, rt as isTemporaryWorktreeBranch, sf as GitActionProgressPhase, si as runStream, sj as unwrap, vN as failVoid, vt as invalidateCachedVcsRefs, xA as toEpochMillis, xM as succeed, xr as createEnvironmentSubscriptionAtomFamily, xt as vcsCommandConcurrency, yt as vcsRefsCacheStateAtom, zA as fromEffect, zj as catch_, zk as TaggedErrorClass } from "../../shared.js";
2
2
  //#region upstream-t3code/packages/client-runtime/src/state/gitActions.ts
3
3
  function buildGitActionProgressStages(input) {
4
4
  const branchStages = input.featureBranch ? ["Preparing feature branch..."] : [];
package/dist/config.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Gn as loadT3CliEnv, Hi as ConfigError, Hn as T3CliEnvConfig, Sr as CredentialCipherError, Ui as ConfigServiceError, Un as T3CliEnvScope, Vi as UrlError, Wn as T3CliEnvShape, _r as service_d_exports$1, br as T3CredentialCipher, cr as EncryptedConfig, dr as UpsertEnvironmentInput, gr as T3MasterKeyKeystoreFactory, hr as MasterKeyReadResult, lr as EnvironmentSummary, mr as service_d_exports, pr as service_d_exports$2, sr as config_d_exports, ur as ResolvedConfig, vr as KeystoreUnavailableError, xr as cipher_d_exports, yr as EncryptedToken } from "./shared.js";
1
+ import { $n as T3CliEnvConfig, Ar as EncryptedToken, Dr as T3MasterKeyKeystoreFactory, Er as MasterKeyReadResult, Mr as cipher_d_exports, Nr as CredentialCipherError, Or as service_d_exports$1, Sr as UpsertEnvironmentInput, Tr as service_d_exports, br as EnvironmentSummary, ea as UrlError, er as T3CliEnvScope, jr as T3CredentialCipher, kr as KeystoreUnavailableError, na as ConfigServiceError, nr as loadT3CliEnv, ta as ConfigError, tr as T3CliEnvShape, vr as config_d_exports, wr as service_d_exports$2, xr as ResolvedConfig, yr as EncryptedConfig } from "./shared.js";
2
2
  import * as Effect from "effect/Effect";
3
3
  import * as Option from "effect/Option";
4
4
  import * as Layer from "effect/Layer";
package/dist/config.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { n as __exportAll } from "./rolldown-runtime.js";
2
- import { $C as ConfigError, AC as validateEnvironmentName, As as CredentialCipherError, Cw as T3CliEnvConfig, DC as defaultEnvironmentNameFromUrl, Ds as KeystoreUnavailableError, EC as defaultEnvironmentNameForLocal, FC as UrlError, JC as file_exports, MC as toHttpEndpointUrl, NC as toWebSocketBaseUrl, NO as tryPromise, OC as migrateV1EnvironmentName, Os as cipher_node_exports, PC as toWebSocketEndpointUrl, QC as service_exports$1, QD as fail, TC as service_exports$2, Ts as keyring_node_exports, XC as resolveKeyFilePath, YC as resolveConfigFilePath, ZC as resolveT3cliConfigDir, aO as gen, ew as T3CredentialCipher, jC as normalizeHttpBaseUrl, kC as slugifyEnvironmentName, ki as resolveT3BaseDir, nk as succeed, nw as credentialTokenFromEnv, qC as service_exports, tw as cipher_exports, wC as config_exports, ww as loadT3CliEnv } from "./shared.js";
2
+ import { $M as succeed, AD as file_exports, Bs as CredentialCipherError, FD as ConfigError, Fs as keyring_node_exports, ID as T3CredentialCipher, LD as cipher_exports, Li as resolveT3BaseDir, Ls as KeystoreUnavailableError, MD as resolveKeyFilePath, ND as resolveT3cliConfigDir, OM as tryPromise, PD as service_exports$1, Qj as gen, RD as credentialTokenFromEnv, Rs as cipher_node_exports, Uj as fail, _D as UrlError, aO as T3CliEnvConfig, cD as defaultEnvironmentNameForLocal, dD as slugifyEnvironmentName, fD as validateEnvironmentName, gD as toWebSocketEndpointUrl, hD as toWebSocketBaseUrl, jD as resolveConfigFilePath, kD as service_exports, lD as defaultEnvironmentNameFromUrl, mD as toHttpEndpointUrl, oD as config_exports, oO as loadT3CliEnv, pD as normalizeHttpBaseUrl, sD as service_exports$2, uD as migrateV1EnvironmentName } from "./shared.js";
3
3
  //#region src/config/credential/cipher-web.ts
4
4
  var cipher_web_exports = /* @__PURE__ */ __exportAll({ layerWeb: () => layerWeb });
5
5
  const aesGcmAlgorithm = "AES-GCM";
@@ -1,4 +1,4 @@
1
- import { Bi as T3CodeConnectionError, Bn as T3CodeConnection, In as T3CodeConnectionProvider, Ln as T3CodeConnectionProviderLive, Rn as makeT3CodeConnectionProvider, Vn as T3CodeOrigin, li as T3Rpc, zn as T3CodeAuth } from "./shared.js";
1
+ import { $i as T3CodeConnectionError, Jn as T3CodeConnectionProviderLive, Qn as T3CodeOrigin, Xn as T3CodeAuth, Yn as makeT3CodeConnectionProvider, Zn as T3CodeConnection, bi as T3Rpc, qn as T3CodeConnectionProvider } from "./shared.js";
2
2
  import * as Layer from "effect/Layer";
3
3
  //#region src/connection/layer.d.ts
4
4
  declare function makeT3CodeRpcLayer(): Layer.Layer<T3Rpc, never, import("effect/unstable/http/HttpClient").HttpClient | T3CodeConnectionProvider | import("effect/unstable/socket/Socket").WebSocketConstructor>;
@@ -1,2 +1,2 @@
1
- import { Mn as makeT3CodeRpcLayer, Xi as T3CodeConnectionError, ii as makeT3CodeConnectionProvider, jn as T3CodeRpcLayer, ni as T3CodeConnectionProvider, ri as T3CodeConnectionProviderLive } from "./shared.js";
1
+ import { Fn as T3CodeRpcLayer, In as makeT3CodeRpcLayer, di as T3CodeConnectionProviderLive, fi as makeT3CodeConnectionProvider, ia as T3CodeConnectionError, ui as T3CodeConnectionProvider } from "./shared.js";
2
2
  export { T3CodeConnectionError, T3CodeConnectionProvider, T3CodeConnectionProviderLive, T3CodeRpcLayer, makeT3CodeConnectionProvider, makeT3CodeRpcLayer };