engine7 7.1.140 → 7.1.141

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.
@@ -138,8 +138,8 @@ import { randomUUID as randomUUID2, verify } from "node:crypto";
138
138
  import { constants as constants4, closeSync as closeSync4, existsSync as existsSync2, fstatSync as fstatSync3, fsyncSync as fsyncSync4, lstatSync as lstatSync3, mkdirSync as mkdirSync3, openSync as openSync4, readFileSync as readFileSync2, renameSync, writeFileSync as writeFileSync2 } from "node:fs";
139
139
  import { basename, dirname as dirname2, join as join4, resolve as resolve4 } from "node:path";
140
140
  function assertPrivateDirectory2(path2) {
141
- const stat = lstatSync3(path2);
142
- if (!stat.isDirectory() || stat.isSymbolicLink() || process.platform !== "win32" && (stat.uid !== process.getuid() || stat.mode & 63)) throw new Error("TRAVEL_PRIVATE_CONTROL_REQUIRED");
141
+ const stat2 = lstatSync3(path2);
142
+ if (!stat2.isDirectory() || stat2.isSymbolicLink() || process.platform !== "win32" && (stat2.uid !== process.getuid() || stat2.mode & 63)) throw new Error("TRAVEL_PRIVATE_CONTROL_REQUIRED");
143
143
  }
144
144
  function readPrivateFile2(path2, maximum) {
145
145
  const before = lstatSync3(path2);
@@ -1386,7 +1386,7 @@ var init_timing = __esm({
1386
1386
 
1387
1387
  // src/continuity/runtime-generation-data.ts
1388
1388
  import { createHash as createHash13 } from "node:crypto";
1389
- import { join as join14, resolve as resolve14 } from "node:path";
1389
+ import { join as join15, resolve as resolve14 } from "node:path";
1390
1390
  import { fileURLToPath as fileURLToPath2 } from "node:url";
1391
1391
  import { existsSync as existsSync7 } from "node:fs";
1392
1392
 
@@ -1396,17 +1396,17 @@ import { constants, lstatSync, mkdirSync, openSync, closeSync, readFileSync, wri
1396
1396
  function validateKeyIdentity(value) {
1397
1397
  if (!value || ["tenantId", "companionId", "seatId", "keyId"].some((k) => typeof value[k] !== "string" || !/^[A-Za-z0-9][A-Za-z0-9_.:-]{0,127}$/.test(value[k])) || !Number.isSafeInteger(value.generation) || value.generation < 1) throw new Error("KEY_SERVICE_INVALID_IDENTITY");
1398
1398
  }
1399
- function assertPrivateStat(stat, directory2) {
1400
- if ((directory2 ? !stat.isDirectory() : !stat.isFile()) || process.platform !== "win32" && ((stat.mode & 63) !== 0 || stat.uid !== process.getuid?.()))
1399
+ function assertPrivateStat(stat2, directory2) {
1400
+ if ((directory2 ? !stat2.isDirectory() : !stat2.isFile()) || process.platform !== "win32" && ((stat2.mode & 63) !== 0 || stat2.uid !== process.getuid?.()))
1401
1401
  throw new Error("KEY_SERVICE_PRIVATE_PATH_REQUIRED");
1402
1402
  }
1403
1403
  function readPrivateFile(path2, maximumBytes = 65536) {
1404
1404
  assertPrivateStat(lstatSync(path2), false);
1405
1405
  const fd = openSync(path2, constants.O_RDONLY | (constants.O_NOFOLLOW ?? 0));
1406
1406
  try {
1407
- const stat = fstatSync(fd);
1408
- assertPrivateStat(stat, false);
1409
- if (stat.size > maximumBytes) throw new Error("KEY_SERVICE_INVALID_FILE_SIZE");
1407
+ const stat2 = fstatSync(fd);
1408
+ assertPrivateStat(stat2, false);
1409
+ if (stat2.size > maximumBytes) throw new Error("KEY_SERVICE_INVALID_FILE_SIZE");
1410
1410
  return readFileSync(fd);
1411
1411
  } finally {
1412
1412
  closeSync(fd);
@@ -2578,6 +2578,8 @@ async function runtimeFileEntries(options) {
2578
2578
  excludeStateEntries: { ...options.inventory.excludeStateEntries },
2579
2579
  excludeWorkspaceEntries: { ...options.inventory.excludeWorkspaceEntries }
2580
2580
  };
2581
+ for (const path2 of ["mem7/spool/intake.write.lock", "mem7/spool/intake.write.lock.reap"])
2582
+ inventoryOptions.excludeStateEntries[path2] = "local queue writer ownership; recreated per process";
2581
2583
  for (const directory2 of [...options.vectorDirectories, ...options.sessionDirectories].map(resolvePath)) {
2582
2584
  const info = lstatSync6(directory2);
2583
2585
  if (!info.isDirectory() || info.isSymbolicLink() || realpathSync3(directory2) !== directory2) throw new Error("SYMLINK_REFUSED");
@@ -2611,7 +2613,13 @@ async function runtimeFileEntries(options) {
2611
2613
  };
2612
2614
  return await classify();
2613
2615
  }
2614
- var signatures = (entries) => entries.map((entry) => [entry.root, entry.path, entry.kind, entry.mode, entry.signature]);
2616
+ var signatures = (entries) => entries.map((entry) => [
2617
+ entry.root,
2618
+ entry.path,
2619
+ entry.kind,
2620
+ entry.mode,
2621
+ entry.kind === "directory" ? entry.signature.split(":").slice(0, -3).join(":") : entry.signature
2622
+ ]);
2615
2623
  async function runtimeFileFingerprint(options) {
2616
2624
  return createHash5("sha256").update(JSON.stringify(signatures(await runtimeFileEntries(options)))).digest("hex");
2617
2625
  }
@@ -3701,10 +3709,33 @@ var RuntimePublicationSource = class _RuntimePublicationSource {
3701
3709
  if (this.control().head !== 0) throw new Error("RUNTIME_PUBLICATION_INITIAL_ALREADY_PREPARED");
3702
3710
  return this.prepareCapture(options, () => captureRuntimeH(options), true);
3703
3711
  }
3704
- /** The source business stores stay read-only and writer exclusion remains
3705
- * held until the caller durably seals its backup and archive receipt. */
3712
+ /** The final LOCAL original is archived independently of the transport queue.
3713
+ * Read-only stores and writer exclusion remain held through its durable seal. */
3706
3714
  async withStoppedPreparation(options, operation) {
3707
- return withStoppedRuntimeH(options, async (parts) => operation(await this.prepareCapture(options, async () => parts)));
3715
+ const before = this.control();
3716
+ if (!same2(options.profile, this.profile) || options.objects !== this.objects) throw new Error("RUNTIME_PUBLICATION_PROFILE_MISMATCH");
3717
+ if (options.deletionWatermark < before.watermark) throw new Error("PUBLICATION_DELETION_REGRESSION");
3718
+ return withStoppedRuntimeH(options, async (parts) => {
3719
+ const manifest = normalizePublication({
3720
+ format: "engine7-publication-v1",
3721
+ profile: this.profile,
3722
+ sequence: before.head + 1,
3723
+ parentDigest: before.digest,
3724
+ databases: parts.databases,
3725
+ trees: parts.trees,
3726
+ deletionWatermark: parts.deletionWatermark
3727
+ });
3728
+ const old = before.head ? await this.readManifest(before.head) : null;
3729
+ if (old && manifest.deletionWatermark === old.manifest.deletionWatermark) {
3730
+ const present = new Set(manifest.trees.flatMap((tree) => tree.files.map((file) => tree.id + "/" + file.path)));
3731
+ if (old.manifest.trees.some((tree) => tree.files.some((file) => !present.has(tree.id + "/" + file.path)))) throw new Error("PUBLICATION_REMOVAL_REQUIRES_DELETION");
3732
+ }
3733
+ const current2 = this.control();
3734
+ if (current2.head !== before.head || current2.digest !== before.digest) throw new Error("RUNTIME_PUBLICATION_CONCURRENT_CHANGE");
3735
+ if (manifest.deletionWatermark < current2.watermark) throw new Error("PUBLICATION_DELETION_REGRESSION");
3736
+ if (old && stateHash(old.manifest) === stateHash(manifest)) return operation({ ...old, sequence: before.head, activationAllowed: false });
3737
+ return operation({ sequence: manifest.sequence, digest: publicationDigest(manifest), manifest, activationAllowed: false });
3738
+ });
3708
3739
  }
3709
3740
  async prepareCapture(options, capture2, initial = false) {
3710
3741
  const c = this.control(), pending = this.status();
@@ -4012,20 +4043,85 @@ async function openRuntimeGenerationSource(options) {
4012
4043
  }
4013
4044
  }
4014
4045
 
4015
- // src/continuity/recovery-archive.ts
4046
+ // src/continuity/native-database-snapshot.ts
4016
4047
  import { DatabaseSync as DatabaseSync13, backup } from "node:sqlite";
4048
+ import { lstat as lstat2 } from "node:fs/promises";
4049
+
4050
+ // src/continuity/native-file-copy.ts
4051
+ import { constants as constants7 } from "node:fs";
4052
+ import { copyFile, link as link2, rename, rm, stat } from "node:fs/promises";
4053
+ import { execFile } from "node:child_process";
4054
+ import { promisify as promisify2 } from "node:util";
4055
+ import { dirname as dirname9, join as join13 } from "node:path";
4056
+ import { randomUUID as randomUUID6 } from "node:crypto";
4057
+ var exec = promisify2(execFile);
4058
+ async function copyNativeFile(source, destination, flags = constants7.COPYFILE_EXCL | constants7.COPYFILE_FICLONE, bytes) {
4059
+ if (process.platform !== "darwin") {
4060
+ await copyFile(source, destination, flags);
4061
+ return;
4062
+ }
4063
+ if ((bytes ?? (await stat(source)).size) < 1024 * 1024) {
4064
+ await copyFile(source, destination, flags);
4065
+ return;
4066
+ }
4067
+ const temporary = join13(dirname9(destination), ".e7-native-copy-" + randomUUID6());
4068
+ try {
4069
+ await exec("/bin/cp", ["-c", "-p", source, temporary], { maxBuffer: 8192 });
4070
+ if (flags & constants7.COPYFILE_EXCL) await link2(temporary, destination);
4071
+ else await rename(temporary, destination);
4072
+ } finally {
4073
+ await rm(temporary, { force: true });
4074
+ }
4075
+ }
4076
+
4077
+ // src/continuity/native-database-snapshot.ts
4078
+ async function snapshotNativeDatabase(db, destination) {
4079
+ if (process.platform !== "darwin") {
4080
+ await backup(db, destination);
4081
+ return;
4082
+ }
4083
+ const file = String(db.prepare("PRAGMA database_list").all().find((row) => row.name === "main")?.file ?? "");
4084
+ if (!file) {
4085
+ await backup(db, destination);
4086
+ return;
4087
+ }
4088
+ const reader = new DatabaseSync13(file, { readOnly: true, allowExtension: true });
4089
+ try {
4090
+ reader.exec("BEGIN");
4091
+ reader.prepare("SELECT count(*) FROM sqlite_master").get();
4092
+ await copyNativeFile(file, destination);
4093
+ try {
4094
+ await lstat2(file + "-wal");
4095
+ await copyNativeFile(file + "-wal", destination + "-wal");
4096
+ } catch (error) {
4097
+ if (error.code !== "ENOENT") throw error;
4098
+ }
4099
+ reader.exec("ROLLBACK");
4100
+ } finally {
4101
+ reader.close();
4102
+ }
4103
+ const target = new DatabaseSync13(destination);
4104
+ try {
4105
+ if (Number(target.prepare("PRAGMA wal_checkpoint(TRUNCATE)").get()?.busy) !== 0) throw Error("DATABASE_SNAPSHOT_BUSY");
4106
+ } finally {
4107
+ target.close();
4108
+ }
4109
+ }
4110
+
4111
+ // src/continuity/recovery-archive.ts
4112
+ import { DatabaseSync as DatabaseSync14 } from "node:sqlite";
4017
4113
  import { existsSync as existsSync6, lstatSync as lstatSync12, mkdtempSync, rmSync, writeFileSync as writeFileSync8, chmodSync as chmodSync2 } from "node:fs";
4018
- import { join as join13, resolve as resolve13 } from "node:path";
4114
+ import { join as join14, resolve as resolve13 } from "node:path";
4019
4115
  init_sqlite_replication();
4020
4116
 
4021
4117
  // src/continuity/crypto.ts
4022
- import { constants as constants7, createWriteStream, openSync as openSync10 } from "node:fs";
4023
- import { open as open3, lstat as lstat2, link as link2, unlink as unlink2, writeFile as writeFile2, appendFile } from "node:fs/promises";
4118
+ import { constants as constants8, createWriteStream, openSync as openSync10 } from "node:fs";
4119
+ import { open as open3, lstat as lstat3, link as link3, unlink as unlink2, writeFile as writeFile2, appendFile } from "node:fs/promises";
4024
4120
  var MAGIC2 = Buffer.from("E7OBJ001");
4025
4121
  var HEADER_SIZE = MAGIC2.length + 12;
4026
4122
  async function syncDirectory(directory2) {
4027
4123
  if (process.platform === "win32") return;
4028
- const handle = await open3(directory2, constants7.O_RDONLY);
4124
+ const handle = await open3(directory2, constants8.O_RDONLY);
4029
4125
  try {
4030
4126
  await handle.sync();
4031
4127
  } finally {
@@ -4139,8 +4235,8 @@ var RuntimeRecoveryArchive = class _RuntimeRecoveryArchive {
4139
4235
  constructor(options) {
4140
4236
  this.directory = resolve13(options.directory);
4141
4237
  this.objects = options.objects;
4142
- this.file = join13(this.directory, "archives.sqlite");
4143
- this.marker = join13(this.directory, "archive.json");
4238
+ this.file = join14(this.directory, "archives.sqlite");
4239
+ this.marker = join14(this.directory, "archive.json");
4144
4240
  if (options.initialize) preparePrivateDirectory(this.directory);
4145
4241
  else {
4146
4242
  try {
@@ -4154,7 +4250,7 @@ var RuntimeRecoveryArchive = class _RuntimeRecoveryArchive {
4154
4250
  if (!fresh) this.checkMarker();
4155
4251
  preparePrivateDatabase(this.file);
4156
4252
  try {
4157
- this.db = new DatabaseSync13(this.file);
4253
+ this.db = new DatabaseSync14(this.file);
4158
4254
  this.db.exec("PRAGMA synchronous=FULL; PRAGMA busy_timeout=1000");
4159
4255
  if (fresh) {
4160
4256
  this.db.exec(schema3);
@@ -4248,6 +4344,7 @@ var RuntimeRecoveryArchive = class _RuntimeRecoveryArchive {
4248
4344
  this.active();
4249
4345
  const { id: id2, kind } = options, manifest = normalizePublication(options.manifest), digest3 = publicationDigest(manifest);
4250
4346
  if (typeof id2 !== "string" || !ID2.test(id2) || !["COMMON", "LOCAL", "REMOTE"].includes(kind)) throw new Error("RECOVERY_INVALID_ID");
4347
+ if (options.snapshotDatabase && (kind !== "LOCAL" || id2 !== "first-baseline" || manifest.sequence !== 1 || manifest.parentDigest !== "0".repeat(64))) throw new Error("RECOVERY_INVALID_SNAPSHOT");
4251
4348
  if (!same4(manifest.profile.identity, this.objects.identity)) throw new Error("RECOVERY_IDENTITY_MISMATCH");
4252
4349
  const deletion = async () => {
4253
4350
  const value = await options.deletionWatermark();
@@ -4289,9 +4386,9 @@ var RuntimeRecoveryArchive = class _RuntimeRecoveryArchive {
4289
4386
  validateRecoveryArchiveEntry(retained, this.objects.identity);
4290
4387
  if (!same4(retained.manifest, manifest) || !same4(retained.publication, publication) || retained.databases.some((d) => d.role !== "replica")) throw new Error("RECOVERY_IDEMPOTENCY_CONFLICT");
4291
4388
  }
4292
- const temporary = mkdtempSync(join13(this.directory, ".capture-"));
4389
+ const temporary = mkdtempSync(join14(this.directory, ".capture-"));
4293
4390
  try {
4294
- writeFileSync8(join13(temporary, ".travel-restored.json"), JSON.stringify({ activationAllowed: false }), { mode: 384, flush: true });
4391
+ writeFileSync8(join14(temporary, ".travel-restored.json"), JSON.stringify({ activationAllowed: false }), { mode: 384, flush: true });
4295
4392
  const databases = [];
4296
4393
  if (retained) {
4297
4394
  if (options.verifyRetained !== false) for (const database of retained.databases) await verifyContent(this.objects, database.content);
@@ -4300,10 +4397,11 @@ var RuntimeRecoveryArchive = class _RuntimeRecoveryArchive {
4300
4397
  for (let offset = 0; !retained && offset < manifest.databases.length; offset += 6) {
4301
4398
  const results = await Promise.allSettled(manifest.databases.slice(offset, offset + 6).map(async (d) => {
4302
4399
  floor = Math.max(floor, await verify2());
4303
- const file = join13(temporary, d.databaseId + ".sqlite");
4304
- await backup(options.databases[d.databaseId], file);
4400
+ const file = join14(temporary, d.databaseId + ".sqlite");
4401
+ if (options.snapshotDatabase) await options.snapshotDatabase(options.databases[d.databaseId], file, d.databaseId);
4402
+ else await snapshotNativeDatabase(options.databases[d.databaseId], file);
4305
4403
  chmodSync2(file, 384);
4306
- const copy = new DatabaseSync13(file, { readOnly: true });
4404
+ const copy = new DatabaseSync14(file, { readOnly: true });
4307
4405
  let schemaHash2;
4308
4406
  try {
4309
4407
  schemaHash2 = validateRecoveryDatabase(copy, manifest, d.databaseId, role, void 0, false);
@@ -4357,12 +4455,12 @@ var RuntimeRecoveryArchive = class _RuntimeRecoveryArchive {
4357
4455
  const floor = await checkRecoveryDeletionAsync(value.manifest, deletionWatermark);
4358
4456
  const prior = this.db.prepare("SELECT kind,manifest_digest,content FROM archives WHERE id=?").get(value.id);
4359
4457
  if (prior && (prior.kind !== value.kind || prior.manifest_digest !== receipt.manifestDigest || JSON.parse(String(prior.content)).sha256 !== receipt.digest)) throw new Error("RECOVERY_IDEMPOTENCY_CONFLICT");
4360
- const temporary = verifyDatabases ? mkdtempSync(join13(this.directory, ".import-")) : void 0;
4458
+ const temporary = verifyDatabases ? mkdtempSync(join14(this.directory, ".import-")) : void 0;
4361
4459
  try {
4362
4460
  if (temporary) for (const db of value.databases) {
4363
- const file = join13(temporary, db.databaseId + ".sqlite");
4461
+ const file = join14(temporary, db.databaseId + ".sqlite");
4364
4462
  await this.objects.restoreFile(db.content, file);
4365
- const probe = new DatabaseSync13(file, { readOnly: true });
4463
+ const probe = new DatabaseSync14(file, { readOnly: true });
4366
4464
  try {
4367
4465
  validateRecoveryDatabase(probe, value.manifest, db.databaseId, db.role, db.schemaHash);
4368
4466
  } finally {
@@ -4950,7 +5048,7 @@ var RuntimeSyncScheduler = class {
4950
5048
  };
4951
5049
 
4952
5050
  // src/continuity/runtime-checkpoints.ts
4953
- import { DatabaseSync as DatabaseSync14 } from "node:sqlite";
5051
+ import { DatabaseSync as DatabaseSync15 } from "node:sqlite";
4954
5052
  var zero = "0".repeat(64);
4955
5053
  var natural3 = (value) => typeof value === "number" && Number.isSafeInteger(value) && value >= 0;
4956
5054
  async function readPublishedRuntimeCheckpoints(options) {
@@ -4981,8 +5079,8 @@ async function openGenerationData(options) {
4981
5079
  if (!runtime || !/^[a-f0-9]{64}$/.test(options.keySha256) || typeof options.initialize !== "boolean") throw new Error("TRAVEL_DATA_CONFIG");
4982
5080
  const interval = options.intervalMs ?? 5e3;
4983
5081
  if (!Number.isSafeInteger(interval) || interval < 250 || interval > 6e4) throw new Error("TRAVEL_DATA_CONFIG");
4984
- const sourcePresent = ["source.json", "source.sqlite", "sender.sqlite"].some((file) => existsSync7(join14(options.dataDirectory, "runtime-publications", file)));
4985
- const archivePresent = ["archive.json", "archives.sqlite"].map((file) => existsSync7(join14(options.dataDirectory, "recovery", file)));
5082
+ const sourcePresent = ["source.json", "source.sqlite", "sender.sqlite"].some((file) => existsSync7(join15(options.dataDirectory, "runtime-publications", file)));
5083
+ const archivePresent = ["archive.json", "archives.sqlite"].map((file) => existsSync7(join15(options.dataDirectory, "recovery", file)));
4986
5084
  if (sourcePresent && !archivePresent.every(Boolean) || !sourcePresent && archivePresent.some(Boolean)) throw new Error("RECOVERY_ARCHIVE_REQUIRED");
4987
5085
  let checkedAt = -Infinity, checkedFloor = -1, closed = false, keyCheck;
4988
5086
  let objects, opened, archive;
@@ -5009,6 +5107,7 @@ async function openGenerationData(options) {
5009
5107
  keyCheck = void 0;
5010
5108
  });
5011
5109
  const availableAfterWork = async () => {
5110
+ runtime.assert("CONTROL");
5012
5111
  if (clock() - checkedAt >= 1e4) await refresh();
5013
5112
  assertAvailable();
5014
5113
  };
@@ -5164,7 +5263,7 @@ async function openGenerationData(options) {
5164
5263
  });
5165
5264
  }, 1e4);
5166
5265
  opened = await openRuntimeGenerationSource({ stateDir: options.stateDir, dataDirectory: options.dataDirectory, objects, initialize: options.initialize, mode: "LIVE" });
5167
- archive = await RuntimeRecoveryArchive.open({ directory: join14(options.dataDirectory, "recovery"), objects, initialize: options.initialize });
5266
+ archive = await RuntimeRecoveryArchive.open({ directory: join15(options.dataDirectory, "recovery"), objects, initialize: options.initialize });
5168
5267
  const id2 = "baseline-" + hash2(JSON.stringify(opened.profile));
5169
5268
  try {
5170
5269
  baseline = (await archive.read(id2)).receipt;
@@ -5172,7 +5271,8 @@ async function openGenerationData(options) {
5172
5271
  if (!(error instanceof Error) || error.message !== "RECOVERY_ARCHIVE_NOT_FOUND") throw error;
5173
5272
  }
5174
5273
  if (baseline && (baseline.kind !== "LOCAL" || baseline.manifestDigest !== (await opened.source.read(1)).digest)) throw new Error("TRAVEL_DATA_BASELINE_REQUIRED");
5175
- await capture2();
5274
+ if (baseline) await availableAfterWork();
5275
+ else await capture2();
5176
5276
  if (options.peer) await connectPeer(options.peer);
5177
5277
  return {
5178
5278
  capture: capture2,
@@ -5182,6 +5282,7 @@ async function openGenerationData(options) {
5182
5282
  close,
5183
5283
  isBusy: () => !!active || !!scheduler?.status().inFlight,
5184
5284
  assertAvailable,
5285
+ refreshAvailability: availableAfterWork,
5185
5286
  checkpoints: (afterSequence) => readPublishedRuntimeCheckpoints({ source: opened.source, afterSequence, assertAvailable }),
5186
5287
  status: () => ({ head: opened.source.head(), baseline, sync: scheduler?.status() ?? null })
5187
5288
  };
@@ -5229,15 +5330,21 @@ async function runGenerationDataCli(args) {
5229
5330
  process.off("disconnect", stop);
5230
5331
  void data.close().then(resolveStop, rejectStop);
5231
5332
  };
5333
+ let checking, lastFailure;
5232
5334
  const guard = setInterval(() => {
5233
- try {
5234
- data.assertAvailable();
5235
- } catch (error) {
5236
- const code = error instanceof Error && /^TRAVEL_[A-Z_]+$/.test(error.message) ? error.message : "TRAVEL_DATA_UNAVAILABLE";
5237
- process.stderr.write("[travel-data] " + code + "\n");
5335
+ if (stopping || checking) return;
5336
+ checking = data.refreshAvailability().then(() => {
5337
+ lastFailure = void 0;
5338
+ }).catch((error) => {
5339
+ const code = error instanceof Error && /^(?:TRAVEL|KEY_SERVICE)_[A-Z_]+$/.test(error.message) ? error.message : "TRAVEL_DATA_UNAVAILABLE";
5340
+ if (code !== lastFailure) process.stderr.write("[travel-data] " + code + "\n");
5341
+ lastFailure = code;
5342
+ if (["TRAVEL_NODE_KEY_UNAVAILABLE", "KEY_SERVICE_TIMEOUT", "KEY_SERVICE_CONNECTION_FAILED"].includes(code)) return;
5238
5343
  process.exitCode = 1;
5239
5344
  stop();
5240
- }
5345
+ }).finally(() => {
5346
+ checking = void 0;
5347
+ });
5241
5348
  }, 1e3);
5242
5349
  process.once("SIGTERM", stop);
5243
5350
  process.once("SIGINT", stop);