usebeeline 0.1.109 → 0.1.110

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.
@@ -1171,6 +1171,7 @@ var init_managed_update = __esm({
1171
1171
  #handingOff;
1172
1172
  #notice;
1173
1173
  #completed = false;
1174
+ #draining = false;
1174
1175
  constructor(options) {
1175
1176
  this.options = options;
1176
1177
  }
@@ -1210,10 +1211,11 @@ var init_managed_update = __esm({
1210
1211
  throw new Error(`published helper ${identity?.version ?? "unknown"} is below required ${this.#minimum}`);
1211
1212
  }
1212
1213
  }
1213
- if (releaseId === this.options.loadedRelease) {
1214
+ if (releaseId === this.options.loadedRelease && !this.#draining) {
1214
1215
  this.#prepared = void 0;
1215
1216
  this.#deadlineAt = void 0;
1216
1217
  this.#handoffAt = void 0;
1218
+ this.#draining = false;
1217
1219
  clearTimeout(this.#timer);
1218
1220
  this.#timer = void 0;
1219
1221
  this.options.changed(void 0);
@@ -1233,15 +1235,25 @@ var init_managed_update = __esm({
1233
1235
  async idleChanged() {
1234
1236
  if (this.#completed || !this.#prepared || this.#preparing || this.#pendingCheck || this.#handingOff)
1235
1237
  return;
1236
- const interrupted = this.now() >= this.#handoffAt;
1237
- if (!interrupted && !this.options.idle())
1238
+ const interrupted = Boolean(this.#minimum);
1239
+ if (!interrupted && !this.options.idle()) {
1240
+ if (!this.#draining && this.now() >= this.#handoffAt) {
1241
+ try {
1242
+ this.options.drain();
1243
+ this.#draining = true;
1244
+ } catch (error) {
1245
+ this.options.failed(error, this.#minimum);
1246
+ }
1247
+ }
1238
1248
  return;
1249
+ }
1239
1250
  clearTimeout(this.#timer);
1240
1251
  const target = this.#prepared;
1241
1252
  this.#handingOff = this.options.handoff(target, interrupted).then(() => {
1242
1253
  this.#completed = true;
1243
1254
  }).catch((error) => {
1244
1255
  this.options.failed(error, this.#minimum);
1256
+ this.#draining = false;
1245
1257
  }).finally(() => {
1246
1258
  this.#handingOff = void 0;
1247
1259
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "usebeeline",
3
- "version": "0.1.109",
3
+ "version": "0.1.110",
4
4
  "description": "Connect an AI coding agent to Beeline with one command.",
5
5
  "homepage": "https://usebeeline.app",
6
6
  "bugs": {