@superblocksteam/vite-plugin-file-sync 2.0.155 → 2.0.156-next.1

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 (177) hide show
  1. package/dist/ai-service/agent/prompts/build-base-system-prompt.d.ts +9 -2
  2. package/dist/ai-service/agent/prompts/build-base-system-prompt.d.ts.map +1 -1
  3. package/dist/ai-service/agent/prompts/build-base-system-prompt.js +34 -6
  4. package/dist/ai-service/agent/prompts/build-base-system-prompt.js.map +1 -1
  5. package/dist/ai-service/agent/prompts/build-security-scan-prompt.d.ts +2 -1
  6. package/dist/ai-service/agent/prompts/build-security-scan-prompt.d.ts.map +1 -1
  7. package/dist/ai-service/agent/prompts/build-security-scan-prompt.js +52 -9
  8. package/dist/ai-service/agent/prompts/build-security-scan-prompt.js.map +1 -1
  9. package/dist/ai-service/agent/tool-permission-delivery-metrics.d.ts +3 -0
  10. package/dist/ai-service/agent/tool-permission-delivery-metrics.d.ts.map +1 -0
  11. package/dist/ai-service/agent/tool-permission-delivery-metrics.js +23 -0
  12. package/dist/ai-service/agent/tool-permission-delivery-metrics.js.map +1 -0
  13. package/dist/ai-service/agent/tool-permission-delivery.d.ts +25 -16
  14. package/dist/ai-service/agent/tool-permission-delivery.d.ts.map +1 -1
  15. package/dist/ai-service/agent/tool-permission-delivery.js +384 -38
  16. package/dist/ai-service/agent/tool-permission-delivery.js.map +1 -1
  17. package/dist/ai-service/agent/tools/apis/get-sdk-api-docs.d.ts +9 -35
  18. package/dist/ai-service/agent/tools/apis/get-sdk-api-docs.d.ts.map +1 -1
  19. package/dist/ai-service/agent/tools/apis/get-sdk-api-docs.js +71 -98
  20. package/dist/ai-service/agent/tools/apis/get-sdk-api-docs.js.map +1 -1
  21. package/dist/ai-service/agent/tools/apis/test-api.d.ts.map +1 -1
  22. package/dist/ai-service/agent/tools/apis/test-api.js +3 -2
  23. package/dist/ai-service/agent/tools/apis/test-api.js.map +1 -1
  24. package/dist/ai-service/agent/tools/app-environment/update-app-environment.d.ts +1 -1
  25. package/dist/ai-service/agent/tools/app-environment/update-app-environment.d.ts.map +1 -1
  26. package/dist/ai-service/agent/tools/app-environment/update-app-environment.js +13 -1
  27. package/dist/ai-service/agent/tools/app-environment/update-app-environment.js.map +1 -1
  28. package/dist/ai-service/agent/tools/build-capture-screenshot.d.ts.map +1 -1
  29. package/dist/ai-service/agent/tools/build-capture-screenshot.js +8 -3
  30. package/dist/ai-service/agent/tools/build-capture-screenshot.js.map +1 -1
  31. package/dist/ai-service/agent/tools/build-navigate-preview.d.ts.map +1 -1
  32. package/dist/ai-service/agent/tools/build-navigate-preview.js +4 -2
  33. package/dist/ai-service/agent/tools/build-navigate-preview.js.map +1 -1
  34. package/dist/ai-service/agent/tools/build-reload-file.d.ts.map +1 -1
  35. package/dist/ai-service/agent/tools/build-reload-file.js +4 -2
  36. package/dist/ai-service/agent/tools/build-reload-file.js.map +1 -1
  37. package/dist/ai-service/agent/tools/get-logs.d.ts +2 -2
  38. package/dist/ai-service/agent/tools/integrations/delete-integration.d.ts.map +1 -1
  39. package/dist/ai-service/agent/tools/integrations/delete-integration.js +6 -3
  40. package/dist/ai-service/agent/tools/integrations/delete-integration.js.map +1 -1
  41. package/dist/ai-service/agent/tools/integrations/execute-request.d.ts +13 -13
  42. package/dist/ai-service/agent/tools/integrations/integration-setup.d.ts +18 -6
  43. package/dist/ai-service/agent/tools/integrations/integration-setup.d.ts.map +1 -1
  44. package/dist/ai-service/agent/tools/integrations/integration-setup.js +41 -15
  45. package/dist/ai-service/agent/tools/integrations/integration-setup.js.map +1 -1
  46. package/dist/ai-service/agent/tools/integrations/internal.d.ts.map +1 -1
  47. package/dist/ai-service/agent/tools/integrations/internal.js +4 -2
  48. package/dist/ai-service/agent/tools/integrations/internal.js.map +1 -1
  49. package/dist/ai-service/agent/tools/report-security-findings.d.ts +23 -23
  50. package/dist/ai-service/agent/tools.d.ts +4 -2
  51. package/dist/ai-service/agent/tools.d.ts.map +1 -1
  52. package/dist/ai-service/agent/tools.js +21 -14
  53. package/dist/ai-service/agent/tools.js.map +1 -1
  54. package/dist/ai-service/agent/tools2/tools/git.d.ts +2 -2
  55. package/dist/ai-service/index.d.ts +26 -25
  56. package/dist/ai-service/index.d.ts.map +1 -1
  57. package/dist/ai-service/index.js +340 -121
  58. package/dist/ai-service/index.js.map +1 -1
  59. package/dist/ai-service/integrations/store.d.ts +2 -1
  60. package/dist/ai-service/integrations/store.d.ts.map +1 -1
  61. package/dist/ai-service/integrations/store.js +3 -2
  62. package/dist/ai-service/integrations/store.js.map +1 -1
  63. package/dist/ai-service/judge/tools/playwright-action.d.ts +1 -1
  64. package/dist/ai-service/judge/tools/submit-feedback.d.ts +1 -1
  65. package/dist/ai-service/llm/client.d.ts +9 -3
  66. package/dist/ai-service/llm/client.d.ts.map +1 -1
  67. package/dist/ai-service/llm/client.js +10 -3
  68. package/dist/ai-service/llm/client.js.map +1 -1
  69. package/dist/ai-service/llm/context-v2/context-metrics.d.ts.map +1 -1
  70. package/dist/ai-service/llm/context-v2/context-metrics.js +3 -0
  71. package/dist/ai-service/llm/context-v2/context-metrics.js.map +1 -1
  72. package/dist/ai-service/llm/stream/observers/llmobs.d.ts +6 -6
  73. package/dist/ai-service/llm/stream/observers/llmobs.d.ts.map +1 -1
  74. package/dist/ai-service/llm/stream/observers/llmobs.js +10 -9
  75. package/dist/ai-service/llm/stream/observers/llmobs.js.map +1 -1
  76. package/dist/ai-service/llm/stream/observers/step-token-usage.d.ts +15 -0
  77. package/dist/ai-service/llm/stream/observers/step-token-usage.d.ts.map +1 -0
  78. package/dist/ai-service/llm/stream/observers/step-token-usage.js +88 -0
  79. package/dist/ai-service/llm/stream/observers/step-token-usage.js.map +1 -0
  80. package/dist/ai-service/llm/stream/orchestrator.d.ts +4 -0
  81. package/dist/ai-service/llm/stream/orchestrator.d.ts.map +1 -1
  82. package/dist/ai-service/llm/stream/orchestrator.js +19 -41
  83. package/dist/ai-service/llm/stream/orchestrator.js.map +1 -1
  84. package/dist/ai-service/llm/stream/retry-engine.d.ts +1 -1
  85. package/dist/ai-service/llm/stream/retry-engine.d.ts.map +1 -1
  86. package/dist/ai-service/llm/stream/retry-engine.js +26 -1
  87. package/dist/ai-service/llm/stream/retry-engine.js.map +1 -1
  88. package/dist/ai-service/llm/stream/terminal-reason.d.ts +6 -0
  89. package/dist/ai-service/llm/stream/terminal-reason.d.ts.map +1 -0
  90. package/dist/ai-service/llm/stream/terminal-reason.js +73 -0
  91. package/dist/ai-service/llm/stream/terminal-reason.js.map +1 -0
  92. package/dist/ai-service/policy-agent-metrics.d.ts +10 -0
  93. package/dist/ai-service/policy-agent-metrics.d.ts.map +1 -1
  94. package/dist/ai-service/policy-agent-metrics.js +33 -0
  95. package/dist/ai-service/policy-agent-metrics.js.map +1 -1
  96. package/dist/ai-service/state-machine/clark-fsm.d.ts +29 -1
  97. package/dist/ai-service/state-machine/clark-fsm.d.ts.map +1 -1
  98. package/dist/ai-service/state-machine/clark-fsm.js +3 -1
  99. package/dist/ai-service/state-machine/clark-fsm.js.map +1 -1
  100. package/dist/ai-service/state-machine/handlers/agent-planning.d.ts.map +1 -1
  101. package/dist/ai-service/state-machine/handlers/agent-planning.js +7 -6
  102. package/dist/ai-service/state-machine/handlers/agent-planning.js.map +1 -1
  103. package/dist/ai-service/state-machine/handlers/llm-generating.d.ts.map +1 -1
  104. package/dist/ai-service/state-machine/handlers/llm-generating.js +18 -5
  105. package/dist/ai-service/state-machine/handlers/llm-generating.js.map +1 -1
  106. package/dist/ai-service/state-machine/helpers/fetch-with-reconnect-retry.d.ts.map +1 -1
  107. package/dist/ai-service/state-machine/helpers/fetch-with-reconnect-retry.js +8 -6
  108. package/dist/ai-service/state-machine/helpers/fetch-with-reconnect-retry.js.map +1 -1
  109. package/dist/ai-service/state-machine/helpers/policy-gate-usage-metrics.d.ts +0 -14
  110. package/dist/ai-service/state-machine/helpers/policy-gate-usage-metrics.d.ts.map +1 -1
  111. package/dist/ai-service/state-machine/helpers/policy-gate-usage-metrics.js +0 -36
  112. package/dist/ai-service/state-machine/helpers/policy-gate-usage-metrics.js.map +1 -1
  113. package/dist/ai-service/state-machine/helpers/pre-session-metrics.d.ts +2 -0
  114. package/dist/ai-service/state-machine/helpers/pre-session-metrics.d.ts.map +1 -1
  115. package/dist/ai-service/state-machine/helpers/pre-session-metrics.js +3 -0
  116. package/dist/ai-service/state-machine/helpers/pre-session-metrics.js.map +1 -1
  117. package/dist/ai-service/state-machine/helpers/prompt-degradation-metrics.d.ts +28 -0
  118. package/dist/ai-service/state-machine/helpers/prompt-degradation-metrics.d.ts.map +1 -0
  119. package/dist/ai-service/state-machine/helpers/prompt-degradation-metrics.js +254 -0
  120. package/dist/ai-service/state-machine/helpers/prompt-degradation-metrics.js.map +1 -0
  121. package/dist/ai-service/state-machine/helpers/prompt-request-metrics.d.ts +1 -0
  122. package/dist/ai-service/state-machine/helpers/prompt-request-metrics.d.ts.map +1 -1
  123. package/dist/ai-service/state-machine/helpers/prompt-request-metrics.js +60 -27
  124. package/dist/ai-service/state-machine/helpers/prompt-request-metrics.js.map +1 -1
  125. package/dist/ai-service/state-machine/helpers/stable-peer.d.ts +12 -1
  126. package/dist/ai-service/state-machine/helpers/stable-peer.d.ts.map +1 -1
  127. package/dist/ai-service/state-machine/helpers/stable-peer.js +42 -9
  128. package/dist/ai-service/state-machine/helpers/stable-peer.js.map +1 -1
  129. package/dist/ai-service/state-machine/mocks.d.ts.map +1 -1
  130. package/dist/ai-service/state-machine/mocks.js +6 -0
  131. package/dist/ai-service/state-machine/mocks.js.map +1 -1
  132. package/dist/ai-service/util/call-peer.d.ts +11 -0
  133. package/dist/ai-service/util/call-peer.d.ts.map +1 -0
  134. package/dist/ai-service/util/call-peer.js +47 -0
  135. package/dist/ai-service/util/call-peer.js.map +1 -0
  136. package/dist/ai-service/util/peer-liveness.d.ts +23 -0
  137. package/dist/ai-service/util/peer-liveness.d.ts.map +1 -0
  138. package/dist/ai-service/util/peer-liveness.js +42 -0
  139. package/dist/ai-service/util/peer-liveness.js.map +1 -0
  140. package/dist/ai-service/util/rpc-timeout.d.ts +12 -5
  141. package/dist/ai-service/util/rpc-timeout.d.ts.map +1 -1
  142. package/dist/ai-service/util/rpc-timeout.js +12 -5
  143. package/dist/ai-service/util/rpc-timeout.js.map +1 -1
  144. package/dist/file-sync-vite-plugin.d.ts.map +1 -1
  145. package/dist/file-sync-vite-plugin.js +8 -21
  146. package/dist/file-sync-vite-plugin.js.map +1 -1
  147. package/dist/lock-service/activity-tracker.d.ts +0 -5
  148. package/dist/lock-service/activity-tracker.d.ts.map +1 -1
  149. package/dist/lock-service/activity-tracker.js +0 -13
  150. package/dist/lock-service/activity-tracker.js.map +1 -1
  151. package/dist/lock-service/index.d.ts +308 -27
  152. package/dist/lock-service/index.d.ts.map +1 -1
  153. package/dist/lock-service/index.js +680 -156
  154. package/dist/lock-service/index.js.map +1 -1
  155. package/dist/policy-gate-callback-mapper.d.ts +3 -2
  156. package/dist/policy-gate-callback-mapper.d.ts.map +1 -1
  157. package/dist/policy-gate-callback-mapper.js.map +1 -1
  158. package/dist/policy-gate-runner.d.ts +4 -2
  159. package/dist/policy-gate-runner.d.ts.map +1 -1
  160. package/dist/policy-gate-runner.js +31 -8
  161. package/dist/policy-gate-runner.js.map +1 -1
  162. package/dist/scan-scope-merge.d.ts +16 -0
  163. package/dist/scan-scope-merge.d.ts.map +1 -0
  164. package/dist/scan-scope-merge.js +90 -0
  165. package/dist/scan-scope-merge.js.map +1 -0
  166. package/dist/socket-manager.d.ts +47 -6
  167. package/dist/socket-manager.d.ts.map +1 -1
  168. package/dist/socket-manager.js +283 -66
  169. package/dist/socket-manager.js.map +1 -1
  170. package/dist/sync-service/index.d.ts.map +1 -1
  171. package/dist/sync-service/index.js +3 -3
  172. package/dist/sync-service/index.js.map +1 -1
  173. package/dist/test-setup.d.ts +2 -0
  174. package/dist/test-setup.d.ts.map +1 -0
  175. package/dist/test-setup.js +21 -0
  176. package/dist/test-setup.js.map +1 -0
  177. package/package.json +8 -8
@@ -1,5 +1,5 @@
1
1
  import type { Tracer } from "@opentelemetry/api";
2
- import { TracedEventEmitter } from "@superblocksteam/shared";
2
+ import { ConflictError, TracedEventEmitter } from "@superblocksteam/shared";
3
3
  import type { LockInfo } from "@superblocksteam/shared";
4
4
  import { type ErrorEventMap } from "../errors/error-handler.js";
5
5
  import type { AutoConnectingRpcClient } from "../server-rpc/index.js";
@@ -59,6 +59,15 @@ interface EventMap extends ErrorEventMap {
59
59
  }
60
60
  ];
61
61
  }
62
+ /**
63
+ * The methods {@link LockService} reports as spans.
64
+ *
65
+ * `addTracingToMethods` matches by string, so an entry naming a method that no
66
+ * longer exists is dropped at runtime rather than failing to compile — tracing
67
+ * disappears and nothing says so. Exported so a test can assert every name here
68
+ * still resolves to a method.
69
+ */
70
+ export declare const TRACED_LOCK_SERVICE_METHODS: readonly ["acquireLock", "releaseLock", "relinquishLock", "notifyClosedByServer", "checkAndUpdateLockIfPossible", "ensureLockForWrite", "shutdownAndExit", "restartInactivityTimer", "switchBranch"];
62
71
  export declare class LockService extends TracedEventEmitter<EventMap> {
63
72
  private readonly applicationId;
64
73
  private branchName;
@@ -67,11 +76,22 @@ export declare class LockService extends TracedEventEmitter<EventMap> {
67
76
  private syncCallback;
68
77
  private waitForGenerationCompleteCallback;
69
78
  private onGatewayLivenessLapsed;
79
+ private onLockConflict;
70
80
  private _status;
71
81
  private _lockId;
72
82
  private _heartbeatTimeout;
73
83
  private _heartbeatGeneration;
74
84
  private _heartbeatStoppedForIdle;
85
+ private _lockGivenUp;
86
+ private _closedByServer;
87
+ /**
88
+ * True only while the last-chance sync of a session that is ending is in
89
+ * flight. That write is not gated on still holding the lock — see
90
+ * {@link ensureLockForWrite}.
91
+ */
92
+ private _flushingFinalWork;
93
+ /** The evaluation overlapping callers join rather than starting their own. */
94
+ private _inFlightLockEvaluation;
75
95
  private _inactivityTimeout;
76
96
  private _bufferPeriodTimeout;
77
97
  private _isRestarting;
@@ -80,9 +100,9 @@ export declare class LockService extends TracedEventEmitter<EventMap> {
80
100
  private _rpcClient;
81
101
  private _inactivityThresholdMs;
82
102
  private _lockBufferMs;
83
- private _startupConnectionTimeout;
84
- private _startupConnectionTimeoutStartedAt;
85
- private _startupConnectionTimeoutExpired;
103
+ /** In-flight acquisition kicked off by a client attaching, if any. */
104
+ private _clientLockAcquisition;
105
+ private readonly _lockOperationQueue;
86
106
  private _activityTracker;
87
107
  /** Gateway peer id -> when its liveness was last refreshed. */
88
108
  private readonly _gatewayLivenessByPeerId;
@@ -101,6 +121,15 @@ export declare class LockService extends TracedEventEmitter<EventMap> {
101
121
  * same peer so Clark stops targeting a dead gateway.
102
122
  */
103
123
  setOnGatewayLivenessLapsed(callback: (peerId: string) => void): void;
124
+ /**
125
+ * Called when a client attached and somebody else already holds the lock.
126
+ *
127
+ * What a conflict means is the host's to decide, not this service's: a CLI
128
+ * with a person at it can describe the holder and offer a takeover, a
129
+ * sandbox can only write it down. This is the hook that used to be the
130
+ * `ConflictError` catch around the boot-time acquire.
131
+ */
132
+ setOnLockConflict(callback: (error: ConflictError) => Promise<void> | void): void;
104
133
  get status(): LockServiceStatus;
105
134
  private set status(value);
106
135
  get isLocked(): boolean;
@@ -110,19 +139,154 @@ export declare class LockService extends TracedEventEmitter<EventMap> {
110
139
  get isRestarting(): boolean;
111
140
  get wasRecentlyActive(): boolean;
112
141
  get timeSinceLastActivity(): number | null;
142
+ /** Whether any client — a browser editor or a headless gateway peer — is here. */
143
+ private get hasAttachedClient();
144
+ /**
145
+ * A client attached and this pod has never held the lock: take it for them.
146
+ *
147
+ * The lock is a mutual-exclusion marker between clients, not a capability the
148
+ * pod needs in order to serve — no write path on either side gates on holding
149
+ * it. So it belongs to whoever is attached, and a pod that grabs it at boot
150
+ * only invents a state nobody wants: a lock held on behalf of nobody, which
151
+ * then needs a watchdog to clean up. Claiming it on attach makes that state
152
+ * unreachable instead.
153
+ *
154
+ * Deliberately narrower than {@link reclaimLockForActiveClient}: neither a
155
+ * lock this pod handed back nor one it was refused is taken here. A tab left
156
+ * open reconnects its socket on its own, so an attach is no evidence its user
157
+ * came back, and treating it as evidence would hand the app to somebody who
158
+ * walked away (APPS-4840).
159
+ */
160
+ private claimLockForFirstClient;
161
+ /**
162
+ * The client proved it is still there: take the lock if we do not have it.
163
+ *
164
+ * Driven by editor activity pings and by a gateway peer starting a turn —
165
+ * both are a client doing something, which is the evidence a lock we are not
166
+ * holding needs before it is worth asking for again.
167
+ *
168
+ * That includes a lock we were refused. A refusal is what happened to one
169
+ * attempt, not a mode this pod is stuck in: the other session ends, and the
170
+ * user sitting here still wants to edit. Without this a pod that lost one
171
+ * race could never take the lock again for the rest of its life — and since
172
+ * SABS hands running pods to the next caller, it would go on failing for
173
+ * people who had nothing to do with the race.
174
+ */
175
+ private reclaimLockForActiveClient;
176
+ /**
177
+ * Fire-and-forget by design: the sockets, pings and branch switches that ask
178
+ * for this have nothing to do with the answer.
179
+ *
180
+ * What keeps a retry from becoming a stream of 409s is the trigger, not the
181
+ * status: the only thing that asks repeatedly is the editor's activity ping,
182
+ * which the pod acts on solely while the user is genuinely active. A blocked
183
+ * session asks about as often as a held lock heartbeats; one nobody is
184
+ * sitting at goes quiet on its own.
185
+ */
186
+ private acquireLockForAttachedClient;
187
+ /**
188
+ * Record an acquisition so anything that settles can see it.
189
+ *
190
+ * Every source goes through here — a client attaching, an activity ping, a
191
+ * force takeover, the reacquire after a heartbeat grab misses, a branch
192
+ * switch. Tracking only the attach path left the others invisible:
193
+ * `isLockedWhenSettled` would answer "no lock" for one that was an rpc away
194
+ * from landing, and `relinquishLock` would find nothing to release and let
195
+ * the lock land on a pod that had already gone.
196
+ *
197
+ * What is stored is a swallowed copy. Callers of
198
+ * {@link settleClientLockAcquisition} only want the state to have stopped
199
+ * moving; a rejection surfacing as theirs would turn a refused lock into a
200
+ * failed disconnect. The promise handed back keeps its rejection for whoever
201
+ * asked for the lock.
202
+ */
203
+ private trackAcquisition;
204
+ /**
205
+ * Wait for an acquisition a client attach kicked off, if one is in flight.
206
+ *
207
+ * Anything that decides what to do about the lock has to do this first, or it
208
+ * decides on a half-known state. While the RPC is out `isLocked` is false and
209
+ * `_lockId` is unset, so a disconnect would "release" nothing and the lock
210
+ * would land moments later with nobody left to hold it for — and a branch
211
+ * switch would move on and leave it attached to the branch it came from.
212
+ *
213
+ * Never rejects: the acquisition's own catch has already handled failure.
214
+ */
215
+ private settleClientLockAcquisition;
216
+ /**
217
+ * Whether this pod holds the lock after attach and queued turn operations
218
+ * already in flight have settled. The synchronous getter remains the current
219
+ * state for status reporting.
220
+ */
221
+ isLockedWhenSettled(): Promise<boolean>;
113
222
  /**
114
- * Check if the lock service is in a state where it can reacquire a lock.
115
- * This happens when the lock was released, the dev server is still alive,
116
- * and an editor is attached to reacquire it for.
223
+ * Nothing is awaiting the acquisition a client triggers, so this is where a
224
+ * failure stops: swallowing it here is what keeps a conflict from surfacing
225
+ * as an unhandled rejection. `acquireLock` has already logged it and moved
226
+ * the status to `FAILED_TO_ACQUIRE_LOCK`; the host is told separately because
227
+ * only it knows whether there is anyone to tell.
228
+ */
229
+ private reportLockConflict;
230
+ /**
231
+ * Serializes branch changes with lock acquisition and handback. Omitting
232
+ * `reacquireLock` preserves the lock state observed inside that operation.
117
233
  */
118
- get canReacquireLock(): boolean;
119
234
  switchBranch(nextBranchName: string, options?: {
120
235
  reacquireLock?: boolean;
121
236
  }): Promise<void>;
237
+ private switchBranchNow;
122
238
  /**
123
- * Acquire a lock on the specified application and branch
239
+ * Acquire a lock on the specified application and branch.
240
+ *
241
+ * Not `async`: the body has to start and be registered in the same tick, so
242
+ * a caller that immediately settles sees this acquisition rather than
243
+ * missing it by a microtask.
124
244
  */
125
245
  acquireLock(): Promise<void>;
246
+ private acquireLockImpl;
247
+ /**
248
+ * Take write access for a turn that is about to start.
249
+ *
250
+ * The lock is permission to write for one turn, not a lease on the session: a
251
+ * headless turn takes it on the way in and hands it back when it ends, so the
252
+ * app sits unlocked between prompts and a person can open it in the editor.
253
+ *
254
+ * Deliberately not routed through {@link claimLockForFirstClient} or
255
+ * {@link reclaimLockForActiveClient}. Those weigh up whether a signal is
256
+ * evidence of a client that wants the lock; a turn starting is not evidence
257
+ * of that, it *is* that, so it asks directly and a lock we handed back
258
+ * earlier is taken again without ceremony.
259
+ *
260
+ * Unlike an attach, this is awaited and its failure is the caller's: a turn
261
+ * that cannot write must fail before routing is bound, carrying the server's
262
+ * own reason. Failing does not take the pod down — the lock is per app+branch
263
+ * while a pod is per live edit, so somebody editing in the browser says
264
+ * nothing about whether this pod can serve the turn after them.
265
+ */
266
+ acquireLockForTurn(): Promise<void>;
267
+ /**
268
+ * Hand back the write access a turn took, once that turn has finished.
269
+ *
270
+ * The wait belongs here rather than in the callers. A turn ends in more than
271
+ * one way — the gateway releases it, its socket drops, its liveness lapses —
272
+ * and only the first of those arrives with the generation already complete.
273
+ * The other two reach this while Clark may still be writing, and handing the
274
+ * lock back there gives write access away mid-generation.
275
+ *
276
+ * Before the queue, never inside it, for the reason spelled out on
277
+ * {@link handBackTurnLockWhenGenerationSettles}: that queue serialises the
278
+ * handback, branch switches and the next turn's acquisition, so a wait
279
+ * inside it lets one hung turn stall all of them.
280
+ *
281
+ * `isStillNeeded` is re-read after that wait, because waiting is exactly
282
+ * what makes the caller's decision stale: a replacement gateway can attach
283
+ * and take a turn while the old one's generation is finishing, and releasing
284
+ * then would pull write access out from under it. The caller owns the
285
+ * question — this cannot ask "is a gateway attached?" itself, since the
286
+ * explicit `editor.releaseTurnLock` path runs with one attached by
287
+ * definition.
288
+ */
289
+ relinquishLockForTurn(isStillNeeded?: () => boolean): Promise<void>;
126
290
  /**
127
291
  * Release the currently held lock
128
292
  */
@@ -136,25 +300,116 @@ export declare class LockService extends TracedEventEmitter<EventMap> {
136
300
  * Force takeover of the lock from another user (only allowed when user is inactive)
137
301
  */
138
302
  forceTakeover(): Promise<void>;
303
+ private forceTakeoverImpl;
139
304
  checkAndUpdateLockIfPossible(): Promise<boolean>;
140
305
  /**
141
- * Cleanup method to be called when the class is destroyed
142
- * This ensures the lock is released
306
+ * Make sure this pod holds the lock a write is about to need.
307
+ *
308
+ * The write is itself the demand for the lock, which is what separates this
309
+ * from the heartbeat's check above. That one asks whether a lock we already
310
+ * hold is still there, and answers for a lock id; this one is asked before a
311
+ * sync, when there may be no lock at all.
312
+ *
313
+ * The distinction is load-bearing at boot. Nothing acquires the lock at
314
+ * startup any more — a client attaching is what claims it — but the dev
315
+ * server still uploads the user's local files before any editor connects.
316
+ * With no lock id {@link checkAndUpdateLockIfPossible} skips the grab
317
+ * entirely and reports false without ever asking the server, so routing that
318
+ * upload through it failed the sync and took the dev server down with it.
319
+ *
320
+ * A lock this session handed back is still not taken back here: a write
321
+ * queued before the handback belongs to the session that ended.
322
+ */
323
+ ensureLockForWrite(): Promise<boolean>;
324
+ /**
325
+ * Flush what this client left behind and hand the lock back.
326
+ *
327
+ * The only way to give the lock up, and the whole of what this service does
328
+ * about a session ending. Whether the process then stops is the caller's
329
+ * business and this cannot tell: the same call serves a tab closing on a
330
+ * sandbox that keeps serving, a `superblocks dev` the user is quitting, and
331
+ * every exit path in `dev()`. So it says nothing about the server's fate —
332
+ * that used to be `shutdown()`'s job, and a lock service asserting a process
333
+ * was exiting is precisely the tangle that made a lock release look like a
334
+ * teardown.
335
+ *
336
+ * Releasing the lock and stopping the dev server used to be one action, so a
337
+ * client going away took the sandbox with it. On the cloud path it did not
338
+ * even stop — it closed the rpc client and returned, leaving a pod still
339
+ * bound to its port with no lock, no heartbeat and nothing behind it: healthy
340
+ * to every probe and unable to do anything. SABS hands such a pod straight
341
+ * back to the next caller, whose requests then go nowhere.
342
+ *
343
+ * Where the pod does stay up, reopening is cheap for the same reason keeping
344
+ * it was worth it: Vite is still running, packages are installed, files are
345
+ * downloaded. A returning editor reacquires through
346
+ * {@link restartInactivityTimer}.
347
+ */
348
+ relinquishLock(): Promise<void>;
349
+ private relinquishLockNow;
350
+ /**
351
+ * The server closed this session: tell the editor, flush, and stop
352
+ * heartbeating — but do not release.
353
+ *
354
+ * The lock is already gone. `/_sb_disconnect` is the server saying it has
355
+ * taken it, typically to hand the app to a session moving the other way
356
+ * across local↔cloud, so releasing from here would give back something that
357
+ * is not ours; on a switch it belongs to whoever is taking over. What is
358
+ * still ours is the heartbeat, which would otherwise keep refreshing a lock
359
+ * the server reassigned.
360
+ *
361
+ * The editor needs both halves of {@link EventMap.closedByServer}: it has to
362
+ * distinguish "the server closed you" from a socket dropping, and a switch
363
+ * from an ending.
143
364
  */
144
- shutdown({ serverInitiated, switchingTo, initiatedByEmail, }: {
145
- serverInitiated?: boolean;
365
+ notifyClosedByServer({ switchingTo, initiatedByEmail, }: {
146
366
  switchingTo?: "local" | "cloud" | "none";
147
367
  initiatedByEmail?: string;
148
368
  }): Promise<void>;
149
369
  /**
150
- * Shutdown the lock service and exit the dev server
370
+ * Push whatever the editor has not synced yet.
371
+ *
372
+ * Both ways of giving a session up run this first, and neither can be held up
373
+ * by it: the caller is either handing the lock to the next client or on its
374
+ * way out of the process, and a sync that fails is strictly better than one
375
+ * that blocks the handover. An unheld lock means nothing to flush — the files
376
+ * belong to whoever holds it now.
377
+ */
378
+ private flushPendingWork;
379
+ /**
380
+ * Hand the lock back and end the process.
381
+ *
382
+ * The only method here that ends anything, and it exists for the four callers
383
+ * inside this service that have already decided the pod cannot continue: a
384
+ * heartbeat that failed, a reacquire lost to another user, and the two
385
+ * {@link LockType.LOCAL} disconnect branches, where the dev server is the
386
+ * user's foreground process and they expect their terminal back.
387
+ *
388
+ * Callers outside this service drive {@link relinquishLock} and own their own
389
+ * exit. That is not a style preference: `process.exit` is synchronous, so
390
+ * folding it in here makes everything a caller sequences after it dead code —
391
+ * which is exactly how the fatal-exit paths in `dev()` came to skip their
392
+ * telemetry flush on every pod that had a lock service.
393
+ *
394
+ * The release is best effort and the exit is not. A lock left held TTL-expires
395
+ * in two minutes, the same as any pod that dies; a process that fails to exit
396
+ * is a zombie until something reaps it.
151
397
  */
152
398
  shutdownAndExit(): Promise<void>;
153
399
  /**
154
400
  * Add a connected user to the activity tracker.
155
401
  */
156
402
  addConnectedPeerIdToUser(userId: string, peerId: string): void;
157
- private armIdleEvaluationAfterReconnectIfNeeded;
403
+ /**
404
+ * Make sure something is still due to ask whether this lock is idle.
405
+ *
406
+ * The inactivity timer is one-shot, and the evaluation it fires returns
407
+ * early on a service that has never held a lock without arming another. So
408
+ * any path that ends up holding one for something other than an attached
409
+ * client has to put the question back on the clock, or the lock is refreshed
410
+ * by the heartbeat for a client that never arrives.
411
+ */
412
+ private ensureIdleEvaluationArmed;
158
413
  /**
159
414
  * Remove a connected user from the activity tracker.
160
415
  */
@@ -165,13 +420,11 @@ export declare class LockService extends TracedEventEmitter<EventMap> {
165
420
  * Stop the heartbeat
166
421
  */
167
422
  private stopHeartbeat;
168
- private clearStartupConnectionTimeout;
169
- private startStartupConnectionTimeoutIfNeeded;
170
- private evaluateStartupConnectionTimeoutIfNeeded;
171
423
  /**
172
424
  * Evaluate if the lock should be released (user disconnected) or marked as ready for takeover (user inactive but connected)
173
425
  */
174
426
  evaluateLockState(): Promise<void>;
427
+ private evaluateLockStateOnce;
175
428
  /**
176
429
  * Restart the inactivity timer when user activity is detected.
177
430
  * This timer tracks if the user goes inactive (no pings for N minutes).
@@ -187,11 +440,10 @@ export declare class LockService extends TracedEventEmitter<EventMap> {
187
440
  *
188
441
  * Gateway peers are deliberately not connected-user presence — they are not
189
442
  * a browser editor and must not keep an editor's lock alive — so they need
190
- * their own liveness signal. Without it the startup watchdog and the
191
- * inactivity reaper would take the sandbox out from under a headless build
192
- * that nobody is watching. Tracked per peer id so a reattach that closes the
193
- * socket it replaced does not hand the sandbox back while its successor is
194
- * still working.
443
+ * their own liveness signal. Without it the inactivity reaper would take the
444
+ * sandbox out from under a headless build that nobody is watching. Tracked
445
+ * per peer id so a reattach that closes the socket it replaced does not hand
446
+ * the sandbox back while its successor is still working.
195
447
  */
196
448
  markGatewayAttached(peerId: string): void;
197
449
  /**
@@ -199,13 +451,42 @@ export declare class LockService extends TracedEventEmitter<EventMap> {
199
451
  * gateway peer is still attached.
200
452
  */
201
453
  markGatewayDetached(peerId: string): void;
454
+ /**
455
+ * The last gateway peer is gone, so no turn is running.
456
+ *
457
+ * Write access was taken for the turn, so it goes back now rather than being
458
+ * left to TTL out — that would leave the app unopenable for up to the lock's
459
+ * two-minute lifetime after a headless build had already finished. This is
460
+ * also the backstop for a gateway that dies mid-turn.
461
+ *
462
+ * Deliberately not a shutdown: the gateway drops its socket after every turn
463
+ * and opens a new one for the next prompt, and in between the pod keeps
464
+ * serving. The next turn takes the lock again through
465
+ * {@link acquireLockForTurn}. What bounds the pod's life is SABS's live-edit
466
+ * expiry, not this.
467
+ *
468
+ * Only when no editor is attached. An editor disconnect releases on its own
469
+ * buffer in {@link evaluateLockState}, and a second releaser over the top of
470
+ * that would race it.
471
+ */
472
+ private handleLastGatewayPeerGone;
473
+ /**
474
+ * Wait for the turn to finish, then hand its lock back.
475
+ *
476
+ * The wait sits outside the lock queue, the way {@link evaluateLockState}
477
+ * does it. That queue serialises the handback itself, branch switches,
478
+ * `isLockedWhenSettled` and the next turn's acquisition, so waiting inside
479
+ * it lets a single hung generation stall all of them — including a graceful
480
+ * shutdown, which awaits the handback with no timeout of its own.
481
+ */
482
+ private handBackTurnLockWhenGenerationSettles;
202
483
  /**
203
484
  * Watches for the last gateway signal lapsing.
204
485
  *
205
- * The windows a gateway defers (startup watchdog, inactivity reaper) fire
206
- * once and are then only re-examined when something happens. A silent gateway
207
- * is the absence of anything happening, so this is what notices it and puts
208
- * the lock back up for evaluation.
486
+ * The inactivity reaper a gateway defers fires once and is then only
487
+ * re-examined when something happens. A silent gateway is the absence of
488
+ * anything happening, so this is what notices it and puts the lock back up
489
+ * for evaluation.
209
490
  */
210
491
  private armGatewayLivenessSweep;
211
492
  private clearGatewayLivenessSweep;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lock-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