@evident-ai/runner-synchroniser 3.1.1-dev.997b038 → 3.1.1-dev.fbc0f17

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 (3) hide show
  1. package/README.md +73 -2
  2. package/dist/cli.js +567 -209
  3. package/package.json +2 -2
package/dist/cli.js CHANGED
@@ -10,8 +10,6 @@ var __export = (target, all) => {
10
10
  };
11
11
 
12
12
  // ../../node_modules/.pnpm/tsup@8.5.1_@swc+core@1.15.10_jiti@2.7.0_postcss@8.5.6_tsx@4.21.0_typescript@5.9.3_yaml@2.9.0/node_modules/tsup/assets/esm_shims.js
13
- import path from "path";
14
- import { fileURLToPath } from "url";
15
13
  var init_esm_shims = __esm({
16
14
  "../../node_modules/.pnpm/tsup@8.5.1_@swc+core@1.15.10_jiti@2.7.0_postcss@8.5.6_tsx@4.21.0_typescript@5.9.3_yaml@2.9.0/node_modules/tsup/assets/esm_shims.js"() {
17
15
  "use strict";
@@ -19,7 +17,7 @@ var init_esm_shims = __esm({
19
17
  });
20
18
 
21
19
  // ../../node_modules/.pnpm/@smithy+core@3.30.0/node_modules/@smithy/core/dist-es/submodules/retry/middleware-retry/isStreamingPayload/isStreamingPayload.js
22
- import { Readable } from "stream";
20
+ import { Readable } from "node:stream";
23
21
  var isStreamingPayload;
24
22
  var init_isStreamingPayload = __esm({
25
23
  "../../node_modules/.pnpm/@smithy+core@3.30.0/node_modules/@smithy/core/dist-es/submodules/retry/middleware-retry/isStreamingPayload/isStreamingPayload.js"() {
@@ -2567,7 +2565,7 @@ var init_hex_encoding = __esm({
2567
2565
  });
2568
2566
 
2569
2567
  // ../../node_modules/.pnpm/@smithy+core@3.30.0/node_modules/@smithy/core/dist-es/submodules/serde/util-body-length/calculateBodyLength.js
2570
- import { ReadStream, fstatSync, lstatSync } from "fs";
2568
+ import { ReadStream, fstatSync, lstatSync } from "node:fs";
2571
2569
  var calculateBodyLength;
2572
2570
  var init_calculateBodyLength = __esm({
2573
2571
  "../../node_modules/.pnpm/@smithy+core@3.30.0/node_modules/@smithy/core/dist-es/submodules/serde/util-body-length/calculateBodyLength.js"() {
@@ -2831,8 +2829,8 @@ var init_types = __esm({
2831
2829
  });
2832
2830
 
2833
2831
  // ../../node_modules/.pnpm/@smithy+core@3.30.0/node_modules/@smithy/core/dist-es/submodules/config/shared-ini-file-loader/getHomeDir.js
2834
- import { homedir } from "os";
2835
- import { sep } from "path";
2832
+ import { homedir } from "node:os";
2833
+ import { sep } from "node:path";
2836
2834
  var homeDirCache, getHomeDirCacheKey, getHomeDir;
2837
2835
  var init_getHomeDir = __esm({
2838
2836
  "../../node_modules/.pnpm/@smithy+core@3.30.0/node_modules/@smithy/core/dist-es/submodules/config/shared-ini-file-loader/getHomeDir.js"() {
@@ -2874,8 +2872,8 @@ var init_getProfileName = __esm({
2874
2872
  });
2875
2873
 
2876
2874
  // ../../node_modules/.pnpm/@smithy+core@3.30.0/node_modules/@smithy/core/dist-es/submodules/config/shared-ini-file-loader/getSSOTokenFilepath.js
2877
- import { createHash } from "crypto";
2878
- import { join } from "path";
2875
+ import { createHash } from "node:crypto";
2876
+ import { join } from "node:path";
2879
2877
  var getSSOTokenFilepath;
2880
2878
  var init_getSSOTokenFilepath = __esm({
2881
2879
  "../../node_modules/.pnpm/@smithy+core@3.30.0/node_modules/@smithy/core/dist-es/submodules/config/shared-ini-file-loader/getSSOTokenFilepath.js"() {
@@ -2891,7 +2889,7 @@ var init_getSSOTokenFilepath = __esm({
2891
2889
  });
2892
2890
 
2893
2891
  // ../../node_modules/.pnpm/@smithy+core@3.30.0/node_modules/@smithy/core/dist-es/submodules/config/shared-ini-file-loader/getSSOTokenFromFile.js
2894
- import { readFile } from "fs/promises";
2892
+ import { readFile } from "node:fs/promises";
2895
2893
  var tokenIntercept, getSSOTokenFromFile;
2896
2894
  var init_getSSOTokenFromFile = __esm({
2897
2895
  "../../node_modules/.pnpm/@smithy+core@3.30.0/node_modules/@smithy/core/dist-es/submodules/config/shared-ini-file-loader/getSSOTokenFromFile.js"() {
@@ -2946,7 +2944,7 @@ var init_getConfigData = __esm({
2946
2944
  });
2947
2945
 
2948
2946
  // ../../node_modules/.pnpm/@smithy+core@3.30.0/node_modules/@smithy/core/dist-es/submodules/config/shared-ini-file-loader/getConfigFilepath.js
2949
- import { join as join2 } from "path";
2947
+ import { join as join2 } from "node:path";
2950
2948
  var ENV_CONFIG_PATH, getConfigFilepath;
2951
2949
  var init_getConfigFilepath = __esm({
2952
2950
  "../../node_modules/.pnpm/@smithy+core@3.30.0/node_modules/@smithy/core/dist-es/submodules/config/shared-ini-file-loader/getConfigFilepath.js"() {
@@ -2959,7 +2957,7 @@ var init_getConfigFilepath = __esm({
2959
2957
  });
2960
2958
 
2961
2959
  // ../../node_modules/.pnpm/@smithy+core@3.30.0/node_modules/@smithy/core/dist-es/submodules/config/shared-ini-file-loader/getCredentialsFilepath.js
2962
- import { join as join3 } from "path";
2960
+ import { join as join3 } from "node:path";
2963
2961
  var ENV_CREDENTIALS_PATH, getCredentialsFilepath;
2964
2962
  var init_getCredentialsFilepath = __esm({
2965
2963
  "../../node_modules/.pnpm/@smithy+core@3.30.0/node_modules/@smithy/core/dist-es/submodules/config/shared-ini-file-loader/getCredentialsFilepath.js"() {
@@ -3030,7 +3028,7 @@ var init_parseIni = __esm({
3030
3028
  });
3031
3029
 
3032
3030
  // ../../node_modules/.pnpm/@smithy+core@3.30.0/node_modules/@smithy/core/dist-es/submodules/config/shared-ini-file-loader/readFile.js
3033
- import { readFile as fsReadFile } from "fs/promises";
3031
+ import { readFile as fsReadFile } from "node:fs/promises";
3034
3032
  var filePromises, fileIntercept, readFile2;
3035
3033
  var init_readFile = __esm({
3036
3034
  "../../node_modules/.pnpm/@smithy+core@3.30.0/node_modules/@smithy/core/dist-es/submodules/config/shared-ini-file-loader/readFile.js"() {
@@ -3038,20 +3036,20 @@ var init_readFile = __esm({
3038
3036
  init_esm_shims();
3039
3037
  filePromises = {};
3040
3038
  fileIntercept = {};
3041
- readFile2 = (path2, options) => {
3042
- if (fileIntercept[path2] !== void 0) {
3043
- return fileIntercept[path2];
3039
+ readFile2 = (path, options) => {
3040
+ if (fileIntercept[path] !== void 0) {
3041
+ return fileIntercept[path];
3044
3042
  }
3045
- if (!filePromises[path2] || options?.ignoreCache) {
3046
- filePromises[path2] = fsReadFile(path2, "utf8");
3043
+ if (!filePromises[path] || options?.ignoreCache) {
3044
+ filePromises[path] = fsReadFile(path, "utf8");
3047
3045
  }
3048
- return filePromises[path2];
3046
+ return filePromises[path];
3049
3047
  };
3050
3048
  }
3051
3049
  });
3052
3050
 
3053
3051
  // ../../node_modules/.pnpm/@smithy+core@3.30.0/node_modules/@smithy/core/dist-es/submodules/config/shared-ini-file-loader/loadSharedConfigFiles.js
3054
- import { join as join4 } from "path";
3052
+ import { join as join4 } from "node:path";
3055
3053
  var swallowError, loadSharedConfigFiles;
3056
3054
  var init_loadSharedConfigFiles = __esm({
3057
3055
  "../../node_modules/.pnpm/@smithy+core@3.30.0/node_modules/@smithy/core/dist-es/submodules/config/shared-ini-file-loader/loadSharedConfigFiles.js"() {
@@ -3169,8 +3167,8 @@ var init_externalDataInterceptor = __esm({
3169
3167
  getFileRecord() {
3170
3168
  return fileIntercept;
3171
3169
  },
3172
- interceptFile(path2, contents) {
3173
- fileIntercept[path2] = Promise.resolve(contents);
3170
+ interceptFile(path, contents) {
3171
+ fileIntercept[path] = Promise.resolve(contents);
3174
3172
  },
3175
3173
  getTokenRecord() {
3176
3174
  return tokenIntercept;
@@ -3397,7 +3395,7 @@ var init_getInstanceMetadataRegion = __esm({
3397
3395
  return { hostname: "169.254.169.254" };
3398
3396
  };
3399
3397
  imdsRequest = async (options) => {
3400
- const { request } = await import("http");
3398
+ const { request } = await import("node:http");
3401
3399
  return new Promise((resolve, reject) => {
3402
3400
  const req = request({
3403
3401
  hostname: options.hostname,
@@ -3812,8 +3810,8 @@ var init_createConfigValueProvider = __esm({
3812
3810
  return endpoint.url.href;
3813
3811
  }
3814
3812
  if ("hostname" in endpoint) {
3815
- const { protocol, hostname, port, path: path2 } = endpoint;
3816
- return `${protocol}//${hostname}${port ? ":" + port : ""}${path2}`;
3813
+ const { protocol, hostname, port, path } = endpoint;
3814
+ return `${protocol}//${hostname}${port ? ":" + port : ""}${path}`;
3817
3815
  }
3818
3816
  }
3819
3817
  return endpoint;
@@ -4220,18 +4218,18 @@ var init_getAttrPathList = __esm({
4220
4218
  "use strict";
4221
4219
  init_esm_shims();
4222
4220
  init_types2();
4223
- getAttrPathList = (path2) => {
4224
- const parts = path2.split(".");
4221
+ getAttrPathList = (path) => {
4222
+ const parts = path.split(".");
4225
4223
  const pathList = [];
4226
4224
  for (const part of parts) {
4227
4225
  const squareBracketIndex = part.indexOf("[");
4228
4226
  if (squareBracketIndex !== -1) {
4229
4227
  if (part.indexOf("]") !== part.length - 1) {
4230
- throw new EndpointError(`Path: '${path2}' does not end with ']'`);
4228
+ throw new EndpointError(`Path: '${path}' does not end with ']'`);
4231
4229
  }
4232
4230
  const arrayIndex = part.slice(squareBracketIndex + 1, -1);
4233
4231
  if (Number.isNaN(parseInt(arrayIndex))) {
4234
- throw new EndpointError(`Invalid array index: '${arrayIndex}' in path: '${path2}'`);
4232
+ throw new EndpointError(`Invalid array index: '${arrayIndex}' in path: '${path}'`);
4235
4233
  }
4236
4234
  if (squareBracketIndex !== 0) {
4237
4235
  pathList.push(part.slice(0, squareBracketIndex));
@@ -4254,9 +4252,9 @@ var init_getAttr = __esm({
4254
4252
  init_esm_shims();
4255
4253
  init_types2();
4256
4254
  init_getAttrPathList();
4257
- getAttr = (value, path2) => getAttrPathList(path2).reduce((acc, index) => {
4255
+ getAttr = (value, path) => getAttrPathList(path).reduce((acc, index) => {
4258
4256
  if (typeof acc !== "object") {
4259
- throw new EndpointError(`Index '${index}' in '${path2}' not found in '${JSON.stringify(value)}'`);
4257
+ throw new EndpointError(`Index '${index}' in '${path}' not found in '${JSON.stringify(value)}'`);
4260
4258
  } else if (Array.isArray(acc)) {
4261
4259
  const i12 = parseInt(index);
4262
4260
  return acc[i12 < 0 ? acc.length + i12 : i12];
@@ -4327,8 +4325,8 @@ var init_parseURL = __esm({
4327
4325
  return value;
4328
4326
  }
4329
4327
  if (typeof value === "object" && "hostname" in value) {
4330
- const { hostname: hostname2, port, protocol: protocol2 = "", path: path2 = "", query = {} } = value;
4331
- const url = new URL(`${protocol2}//${hostname2}${port ? `:${port}` : ""}${path2}`);
4328
+ const { hostname: hostname2, port, protocol: protocol2 = "", path = "", query = {} } = value;
4329
+ const url = new URL(`${protocol2}//${hostname2}${port ? `:${port}` : ""}${path}`);
4332
4330
  url.search = Object.entries(query).map(([k12, v2]) => `${k12}=${v2}`).join("&");
4333
4331
  return url;
4334
4332
  }
@@ -4764,7 +4762,7 @@ var init_endpoints = __esm({
4764
4762
  });
4765
4763
 
4766
4764
  // ../../node_modules/.pnpm/@smithy+core@3.30.0/node_modules/@smithy/core/dist-es/submodules/serde/util-stream/checksum/ChecksumStream.js
4767
- import { Readable as Readable2 } from "stream";
4765
+ import { Readable as Readable2 } from "node:stream";
4768
4766
  var ChecksumStream;
4769
4767
  var init_ChecksumStream = __esm({
4770
4768
  "../../node_modules/.pnpm/@smithy+core@3.30.0/node_modules/@smithy/core/dist-es/submodules/serde/util-stream/checksum/ChecksumStream.js"() {
@@ -5142,7 +5140,7 @@ var init_createBufferedReadable_browser = __esm({
5142
5140
  });
5143
5141
 
5144
5142
  // ../../node_modules/.pnpm/@smithy+core@3.30.0/node_modules/@smithy/core/dist-es/submodules/serde/util-stream/createBufferedReadable.js
5145
- import { Readable as Readable3 } from "stream";
5143
+ import { Readable as Readable3 } from "node:stream";
5146
5144
  function createBufferedReadable(upstream, size, logger3) {
5147
5145
  if (isReadableStream(upstream)) {
5148
5146
  return createBufferedReadableStream(upstream, size, logger3);
@@ -5243,7 +5241,7 @@ ${value}\r
5243
5241
  });
5244
5242
 
5245
5243
  // ../../node_modules/.pnpm/@smithy+core@3.30.0/node_modules/@smithy/core/dist-es/submodules/serde/util-stream/getAwsChunkedEncodingStream.js
5246
- import { Readable as Readable4 } from "stream";
5244
+ import { Readable as Readable4 } from "node:stream";
5247
5245
  function getAwsChunkedEncodingStream2(stream, options) {
5248
5246
  const readable = stream;
5249
5247
  const readableStream = stream;
@@ -5411,7 +5409,7 @@ var init_sdk_stream_mixin_browser = __esm({
5411
5409
  });
5412
5410
 
5413
5411
  // ../../node_modules/.pnpm/@smithy+core@3.30.0/node_modules/@smithy/core/dist-es/submodules/serde/util-stream/stream-collector.js
5414
- import { Writable } from "stream";
5412
+ import { Writable } from "node:stream";
5415
5413
  var streamCollector2, Collector;
5416
5414
  var init_stream_collector = __esm({
5417
5415
  "../../node_modules/.pnpm/@smithy+core@3.30.0/node_modules/@smithy/core/dist-es/submodules/serde/util-stream/stream-collector.js"() {
@@ -5453,7 +5451,7 @@ var init_stream_collector = __esm({
5453
5451
  });
5454
5452
 
5455
5453
  // ../../node_modules/.pnpm/@smithy+core@3.30.0/node_modules/@smithy/core/dist-es/submodules/serde/util-stream/sdk-stream-mixin.js
5456
- import { Readable as Readable5 } from "stream";
5454
+ import { Readable as Readable5 } from "node:stream";
5457
5455
  var ERR_MSG_STREAM_HAS_BEEN_TRANSFORMED2, sdkStreamMixin2;
5458
5456
  var init_sdk_stream_mixin = __esm({
5459
5457
  "../../node_modules/.pnpm/@smithy+core@3.30.0/node_modules/@smithy/core/dist-es/submodules/serde/util-stream/sdk-stream-mixin.js"() {
@@ -5510,7 +5508,7 @@ var init_sdk_stream_mixin = __esm({
5510
5508
  });
5511
5509
 
5512
5510
  // ../../node_modules/.pnpm/@smithy+core@3.30.0/node_modules/@smithy/core/dist-es/submodules/serde/index.js
5513
- import { getRandomValues } from "crypto";
5511
+ import { getRandomValues } from "node:crypto";
5514
5512
  var Uint8ArrayBlobAdapter, _getRandomValues, v4, generateIdempotencyToken;
5515
5513
  var init_serde = __esm({
5516
5514
  "../../node_modules/.pnpm/@smithy+core@3.30.0/node_modules/@smithy/core/dist-es/submodules/serde/index.js"() {
@@ -5595,7 +5593,7 @@ var init_SerdeContext = __esm({
5595
5593
  });
5596
5594
 
5597
5595
  // ../../node_modules/.pnpm/@smithy+core@3.30.0/node_modules/@smithy/core/dist-es/submodules/checksum/hash-stream-node/HashCalculator.js
5598
- import { Writable as Writable2 } from "stream";
5596
+ import { Writable as Writable2 } from "node:stream";
5599
5597
  var HashCalculator;
5600
5598
  var init_HashCalculator = __esm({
5601
5599
  "../../node_modules/.pnpm/@smithy+core@3.30.0/node_modules/@smithy/core/dist-es/submodules/checksum/hash-stream-node/HashCalculator.js"() {
@@ -5747,7 +5745,7 @@ var init_Md5Js = __esm({
5747
5745
  });
5748
5746
 
5749
5747
  // ../../node_modules/.pnpm/@smithy+core@3.30.0/node_modules/@smithy/core/dist-es/submodules/checksum/md5/Md5Node.js
5750
- import { createHash as createHash2 } from "crypto";
5748
+ import { createHash as createHash2 } from "node:crypto";
5751
5749
  function buildNativeClass() {
5752
5750
  return class Md5Node {
5753
5751
  digestLength = 16;
@@ -5823,7 +5821,7 @@ var init_Crc32Js = __esm({
5823
5821
  });
5824
5822
 
5825
5823
  // ../../node_modules/.pnpm/@smithy+core@3.30.0/node_modules/@smithy/core/dist-es/submodules/checksum/crc32/Crc32Node.js
5826
- import * as zlib from "zlib";
5824
+ import * as zlib from "node:zlib";
5827
5825
  function buildNativeClass2(nativeCrc32) {
5828
5826
  return class Crc32Node {
5829
5827
  digestLength = 4;
@@ -6096,7 +6094,7 @@ var init_Sha256Js = __esm({
6096
6094
  });
6097
6095
 
6098
6096
  // ../../node_modules/.pnpm/@smithy+core@3.30.0/node_modules/@smithy/core/dist-es/submodules/checksum/sha256/Sha256Node.js
6099
- import { createHash as createHash3, createHmac } from "crypto";
6097
+ import { createHash as createHash3, createHmac } from "node:crypto";
6100
6098
  function buildNativeClass3() {
6101
6099
  return class Sha256Node {
6102
6100
  digestLength = 32;
@@ -6799,7 +6797,7 @@ var init_EventStreamMarshaller = __esm({
6799
6797
  });
6800
6798
 
6801
6799
  // ../../node_modules/.pnpm/@smithy+core@3.30.0/node_modules/@smithy/core/dist-es/submodules/event-streams/eventstream-serde/EventStreamMarshaller.js
6802
- import { Readable as Readable6 } from "stream";
6800
+ import { Readable as Readable6 } from "node:stream";
6803
6801
  async function* readableToIterable(readStream) {
6804
6802
  let streamEnded = false;
6805
6803
  let generationEnded = false;
@@ -7416,11 +7414,11 @@ var init_HttpBindingProtocol = __esm({
7416
7414
  const opTraits = translateTraits(operationSchema.traits);
7417
7415
  if (opTraits.http) {
7418
7416
  request.method = opTraits.http[0];
7419
- const [path2, search] = opTraits.http[1].split("?");
7417
+ const [path, search] = opTraits.http[1].split("?");
7420
7418
  if (request.path == "/") {
7421
- request.path = path2;
7419
+ request.path = path;
7422
7420
  } else {
7423
- request.path += path2;
7421
+ request.path += path;
7424
7422
  }
7425
7423
  const traitSearchParams = new URLSearchParams(search ?? "");
7426
7424
  for (const [key, value] of traitSearchParams) {
@@ -8953,7 +8951,7 @@ var init_invoke_store = __esm({
8953
8951
  als;
8954
8952
  static async create() {
8955
8953
  const instance = new _InvokeStoreMulti();
8956
- const asyncHooks = await import("async_hooks");
8954
+ const asyncHooks = await import("node:async_hooks");
8957
8955
  instance.als = new asyncHooks.AsyncLocalStorage();
8958
8956
  return instance;
8959
8957
  }
@@ -9945,7 +9943,7 @@ var init_date_utils2 = __esm({
9945
9943
  });
9946
9944
 
9947
9945
  // ../../node_modules/.pnpm/@smithy+core@3.29.5/node_modules/@smithy/core/dist-es/submodules/serde/util-body-length/calculateBodyLength.js
9948
- import { ReadStream as ReadStream2, fstatSync as fstatSync2, lstatSync as lstatSync2 } from "fs";
9946
+ import { ReadStream as ReadStream2, fstatSync as fstatSync2, lstatSync as lstatSync2 } from "node:fs";
9949
9947
  var calculateBodyLength2;
9950
9948
  var init_calculateBodyLength2 = __esm({
9951
9949
  "../../node_modules/.pnpm/@smithy+core@3.29.5/node_modules/@smithy/core/dist-es/submodules/serde/util-body-length/calculateBodyLength.js"() {
@@ -10169,8 +10167,8 @@ var init_types3 = __esm({
10169
10167
  });
10170
10168
 
10171
10169
  // ../../node_modules/.pnpm/@smithy+core@3.29.5/node_modules/@smithy/core/dist-es/submodules/config/shared-ini-file-loader/getHomeDir.js
10172
- import { homedir as homedir2 } from "os";
10173
- import { sep as sep2 } from "path";
10170
+ import { homedir as homedir2 } from "node:os";
10171
+ import { sep as sep2 } from "node:path";
10174
10172
  var homeDirCache2, getHomeDirCacheKey2, getHomeDir2;
10175
10173
  var init_getHomeDir2 = __esm({
10176
10174
  "../../node_modules/.pnpm/@smithy+core@3.29.5/node_modules/@smithy/core/dist-es/submodules/config/shared-ini-file-loader/getHomeDir.js"() {
@@ -10247,7 +10245,7 @@ var init_getConfigData2 = __esm({
10247
10245
  });
10248
10246
 
10249
10247
  // ../../node_modules/.pnpm/@smithy+core@3.29.5/node_modules/@smithy/core/dist-es/submodules/config/shared-ini-file-loader/getConfigFilepath.js
10250
- import { join as join5 } from "path";
10248
+ import { join as join5 } from "node:path";
10251
10249
  var ENV_CONFIG_PATH2, getConfigFilepath2;
10252
10250
  var init_getConfigFilepath2 = __esm({
10253
10251
  "../../node_modules/.pnpm/@smithy+core@3.29.5/node_modules/@smithy/core/dist-es/submodules/config/shared-ini-file-loader/getConfigFilepath.js"() {
@@ -10260,7 +10258,7 @@ var init_getConfigFilepath2 = __esm({
10260
10258
  });
10261
10259
 
10262
10260
  // ../../node_modules/.pnpm/@smithy+core@3.29.5/node_modules/@smithy/core/dist-es/submodules/config/shared-ini-file-loader/getCredentialsFilepath.js
10263
- import { join as join6 } from "path";
10261
+ import { join as join6 } from "node:path";
10264
10262
  var ENV_CREDENTIALS_PATH2, getCredentialsFilepath2;
10265
10263
  var init_getCredentialsFilepath2 = __esm({
10266
10264
  "../../node_modules/.pnpm/@smithy+core@3.29.5/node_modules/@smithy/core/dist-es/submodules/config/shared-ini-file-loader/getCredentialsFilepath.js"() {
@@ -10331,7 +10329,7 @@ var init_parseIni2 = __esm({
10331
10329
  });
10332
10330
 
10333
10331
  // ../../node_modules/.pnpm/@smithy+core@3.29.5/node_modules/@smithy/core/dist-es/submodules/config/shared-ini-file-loader/readFile.js
10334
- import { readFile as fsReadFile2 } from "fs/promises";
10332
+ import { readFile as fsReadFile2 } from "node:fs/promises";
10335
10333
  var filePromises2, fileIntercept2, readFile3;
10336
10334
  var init_readFile2 = __esm({
10337
10335
  "../../node_modules/.pnpm/@smithy+core@3.29.5/node_modules/@smithy/core/dist-es/submodules/config/shared-ini-file-loader/readFile.js"() {
@@ -10339,20 +10337,20 @@ var init_readFile2 = __esm({
10339
10337
  init_esm_shims();
10340
10338
  filePromises2 = {};
10341
10339
  fileIntercept2 = {};
10342
- readFile3 = (path2, options) => {
10343
- if (fileIntercept2[path2] !== void 0) {
10344
- return fileIntercept2[path2];
10340
+ readFile3 = (path, options) => {
10341
+ if (fileIntercept2[path] !== void 0) {
10342
+ return fileIntercept2[path];
10345
10343
  }
10346
- if (!filePromises2[path2] || options?.ignoreCache) {
10347
- filePromises2[path2] = fsReadFile2(path2, "utf8");
10344
+ if (!filePromises2[path] || options?.ignoreCache) {
10345
+ filePromises2[path] = fsReadFile2(path, "utf8");
10348
10346
  }
10349
- return filePromises2[path2];
10347
+ return filePromises2[path];
10350
10348
  };
10351
10349
  }
10352
10350
  });
10353
10351
 
10354
10352
  // ../../node_modules/.pnpm/@smithy+core@3.29.5/node_modules/@smithy/core/dist-es/submodules/config/shared-ini-file-loader/loadSharedConfigFiles.js
10355
- import { join as join7 } from "path";
10353
+ import { join as join7 } from "node:path";
10356
10354
  var swallowError3, loadSharedConfigFiles2;
10357
10355
  var init_loadSharedConfigFiles2 = __esm({
10358
10356
  "../../node_modules/.pnpm/@smithy+core@3.29.5/node_modules/@smithy/core/dist-es/submodules/config/shared-ini-file-loader/loadSharedConfigFiles.js"() {
@@ -11969,7 +11967,7 @@ var init_getInstanceMetadataRegion2 = __esm({
11969
11967
  return { hostname: "169.254.169.254" };
11970
11968
  };
11971
11969
  imdsRequest2 = async (options) => {
11972
- const { request } = await import("http");
11970
+ const { request } = await import("node:http");
11973
11971
  return new Promise((resolve, reject) => {
11974
11972
  const req = request({
11975
11973
  hostname: options.hostname,
@@ -12345,8 +12343,8 @@ var init_createConfigValueProvider2 = __esm({
12345
12343
  return endpoint.url.href;
12346
12344
  }
12347
12345
  if ("hostname" in endpoint) {
12348
- const { protocol, hostname, port, path: path2 } = endpoint;
12349
- return `${protocol}//${hostname}${port ? ":" + port : ""}${path2}`;
12346
+ const { protocol, hostname, port, path } = endpoint;
12347
+ return `${protocol}//${hostname}${port ? ":" + port : ""}${path}`;
12350
12348
  }
12351
12349
  }
12352
12350
  return endpoint;
@@ -12751,18 +12749,18 @@ var init_getAttrPathList2 = __esm({
12751
12749
  "use strict";
12752
12750
  init_esm_shims();
12753
12751
  init_types4();
12754
- getAttrPathList2 = (path2) => {
12755
- const parts = path2.split(".");
12752
+ getAttrPathList2 = (path) => {
12753
+ const parts = path.split(".");
12756
12754
  const pathList = [];
12757
12755
  for (const part of parts) {
12758
12756
  const squareBracketIndex = part.indexOf("[");
12759
12757
  if (squareBracketIndex !== -1) {
12760
12758
  if (part.indexOf("]") !== part.length - 1) {
12761
- throw new EndpointError2(`Path: '${path2}' does not end with ']'`);
12759
+ throw new EndpointError2(`Path: '${path}' does not end with ']'`);
12762
12760
  }
12763
12761
  const arrayIndex = part.slice(squareBracketIndex + 1, -1);
12764
12762
  if (Number.isNaN(parseInt(arrayIndex))) {
12765
- throw new EndpointError2(`Invalid array index: '${arrayIndex}' in path: '${path2}'`);
12763
+ throw new EndpointError2(`Invalid array index: '${arrayIndex}' in path: '${path}'`);
12766
12764
  }
12767
12765
  if (squareBracketIndex !== 0) {
12768
12766
  pathList.push(part.slice(0, squareBracketIndex));
@@ -12785,9 +12783,9 @@ var init_getAttr2 = __esm({
12785
12783
  init_esm_shims();
12786
12784
  init_types4();
12787
12785
  init_getAttrPathList2();
12788
- getAttr2 = (value, path2) => getAttrPathList2(path2).reduce((acc, index) => {
12786
+ getAttr2 = (value, path) => getAttrPathList2(path).reduce((acc, index) => {
12789
12787
  if (typeof acc !== "object") {
12790
- throw new EndpointError2(`Index '${index}' in '${path2}' not found in '${JSON.stringify(value)}'`);
12788
+ throw new EndpointError2(`Index '${index}' in '${path}' not found in '${JSON.stringify(value)}'`);
12791
12789
  } else if (Array.isArray(acc)) {
12792
12790
  const i12 = parseInt(index);
12793
12791
  return acc[i12 < 0 ? acc.length + i12 : i12];
@@ -12858,8 +12856,8 @@ var init_parseURL2 = __esm({
12858
12856
  return value;
12859
12857
  }
12860
12858
  if (typeof value === "object" && "hostname" in value) {
12861
- const { hostname: hostname2, port, protocol: protocol2 = "", path: path2 = "", query = {} } = value;
12862
- const url = new URL(`${protocol2}//${hostname2}${port ? `:${port}` : ""}${path2}`);
12859
+ const { hostname: hostname2, port, protocol: protocol2 = "", path = "", query = {} } = value;
12860
+ const url = new URL(`${protocol2}//${hostname2}${port ? `:${port}` : ""}${path}`);
12863
12861
  url.search = Object.entries(query).map(([k12, v2]) => `${k12}=${v2}`).join("&");
12864
12862
  return url;
12865
12863
  }
@@ -13292,7 +13290,7 @@ var init_endpoints2 = __esm({
13292
13290
  });
13293
13291
 
13294
13292
  // ../../node_modules/.pnpm/@smithy+core@3.29.5/node_modules/@smithy/core/dist-es/submodules/serde/index.js
13295
- import { getRandomValues as getRandomValues2 } from "crypto";
13293
+ import { getRandomValues as getRandomValues2 } from "node:crypto";
13296
13294
  var Uint8ArrayBlobAdapter2, _getRandomValues2, v42;
13297
13295
  var init_serde2 = __esm({
13298
13296
  "../../node_modules/.pnpm/@smithy+core@3.29.5/node_modules/@smithy/core/dist-es/submodules/serde/index.js"() {
@@ -14116,7 +14114,7 @@ var init_user_agent_middleware = __esm({
14116
14114
  });
14117
14115
 
14118
14116
  // ../../node_modules/.pnpm/@aws-sdk+core@3.977.1/node_modules/@aws-sdk/core/dist-es/submodules/client/util-user-agent-node/getRuntimeUserAgentPair.js
14119
- import { versions as versions2 } from "process";
14117
+ import { versions as versions2 } from "node:process";
14120
14118
  var getRuntimeUserAgentPair2;
14121
14119
  var init_getRuntimeUserAgentPair = __esm({
14122
14120
  "../../node_modules/.pnpm/@aws-sdk+core@3.977.1/node_modules/@aws-sdk/core/dist-es/submodules/client/util-user-agent-node/getRuntimeUserAgentPair.js"() {
@@ -14163,8 +14161,8 @@ var init_is_crt_available = __esm({
14163
14161
  });
14164
14162
 
14165
14163
  // ../../node_modules/.pnpm/@aws-sdk+core@3.977.1/node_modules/@aws-sdk/core/dist-es/submodules/client/util-user-agent-node/defaultUserAgent.js
14166
- import { platform as platform2, release as release2 } from "os";
14167
- import { env as env2 } from "process";
14164
+ import { platform as platform2, release as release2 } from "node:os";
14165
+ import { env as env2 } from "node:process";
14168
14166
  var createDefaultUserAgentProvider2;
14169
14167
  var init_defaultUserAgent = __esm({
14170
14168
  "../../node_modules/.pnpm/@aws-sdk+core@3.977.1/node_modules/@aws-sdk/core/dist-es/submodules/client/util-user-agent-node/defaultUserAgent.js"() {
@@ -14464,7 +14462,7 @@ var init_RemoteProviderInit = __esm({
14464
14462
  });
14465
14463
 
14466
14464
  // ../../node_modules/.pnpm/@smithy+credential-provider-imds@4.4.10/node_modules/@smithy/credential-provider-imds/dist-es/remoteProvider/node-http.js
14467
- import node_http from "http";
14465
+ import node_http from "node:http";
14468
14466
  var init_node_http = __esm({
14469
14467
  "../../node_modules/.pnpm/@smithy+credential-provider-imds@4.4.10/node_modules/@smithy/credential-provider-imds/dist-es/remoteProvider/node-http.js"() {
14470
14468
  "use strict";
@@ -14995,7 +14993,7 @@ var init_get_transformed_headers = __esm({
14995
14993
  });
14996
14994
 
14997
14995
  // ../../node_modules/.pnpm/@smithy+node-http-handler@4.9.11/node_modules/@smithy/node-http-handler/dist-es/node-https.js
14998
- import node_https from "https";
14996
+ import node_https from "node:https";
14999
14997
  var init_node_https = __esm({
15000
14998
  "../../node_modules/.pnpm/@smithy+node-http-handler@4.9.11/node_modules/@smithy/node-http-handler/dist-es/node-https.js"() {
15001
14999
  "use strict";
@@ -15150,7 +15148,7 @@ var init_set_socket_timeout = __esm({
15150
15148
  });
15151
15149
 
15152
15150
  // ../../node_modules/.pnpm/@smithy+node-http-handler@4.9.11/node_modules/@smithy/node-http-handler/dist-es/write-request-body.js
15153
- import { Readable as Readable8 } from "stream";
15151
+ import { Readable as Readable8 } from "node:stream";
15154
15152
  async function writeRequestBody(httpRequest3, request, maxContinueTimeoutMs = MIN_WAIT_TIME, externalAgent = false) {
15155
15153
  const headers = request.headers;
15156
15154
  const expect = headers ? headers.Expect || headers.expect : void 0;
@@ -15343,12 +15341,12 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
15343
15341
  const password = request.password ?? "";
15344
15342
  auth = `${username}:${password}`;
15345
15343
  }
15346
- let path2 = request.path;
15344
+ let path = request.path;
15347
15345
  if (queryString) {
15348
- path2 += `?${queryString}`;
15346
+ path += `?${queryString}`;
15349
15347
  }
15350
15348
  if (request.fragment) {
15351
- path2 += `#${request.fragment}`;
15349
+ path += `#${request.fragment}`;
15352
15350
  }
15353
15351
  let hostname = request.hostname ?? "";
15354
15352
  if (hostname[0] === "[" && hostname.endsWith("]")) {
@@ -15360,7 +15358,7 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
15360
15358
  headers: request.headers,
15361
15359
  host: hostname,
15362
15360
  method: request.method,
15363
- path: path2,
15361
+ path,
15364
15362
  port: request.port,
15365
15363
  agent,
15366
15364
  auth
@@ -15436,7 +15434,7 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
15436
15434
  socketAcquisitionWarningTimeout,
15437
15435
  throwOnRequestTimeout,
15438
15436
  httpAgentProvider: async () => {
15439
- const node_http3 = await import("http");
15437
+ const node_http3 = await import("node:http");
15440
15438
  const { Agent, request } = node_http3.default ?? node_http3;
15441
15439
  hRequest = request;
15442
15440
  hAgent = Agent;
@@ -15587,7 +15585,7 @@ var init_retry_wrapper = __esm({
15587
15585
  });
15588
15586
 
15589
15587
  // ../../node_modules/.pnpm/@aws-sdk+credential-provider-http@3.972.61/node_modules/@aws-sdk/credential-provider-http/dist-es/fromHttp/fromHttp.js
15590
- import fs from "fs/promises";
15588
+ import fs from "node:fs/promises";
15591
15589
  var AWS_CONTAINER_CREDENTIALS_RELATIVE_URI, DEFAULT_LINK_LOCAL_HOST, AWS_CONTAINER_CREDENTIALS_FULL_URI, AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE, AWS_CONTAINER_AUTHORIZATION_TOKEN, fromHttp, validateToken;
15592
15590
  var init_fromHttp = __esm({
15593
15591
  "../../node_modules/.pnpm/@aws-sdk+credential-provider-http@3.972.61/node_modules/@aws-sdk/credential-provider-http/dist-es/fromHttp/fromHttp.js"() {
@@ -16235,10 +16233,10 @@ ${longDate}
16235
16233
  ${credentialScope}
16236
16234
  ${toHex(hashedRequest)}`;
16237
16235
  }
16238
- getCanonicalPath({ path: path2 }) {
16236
+ getCanonicalPath({ path }) {
16239
16237
  if (this.uriEscapePath) {
16240
16238
  const normalizedPathSegments = [];
16241
- for (const pathSegment of path2.split("/")) {
16239
+ for (const pathSegment of path.split("/")) {
16242
16240
  if (pathSegment?.length === 0)
16243
16241
  continue;
16244
16242
  if (pathSegment === ".")
@@ -16249,11 +16247,11 @@ ${toHex(hashedRequest)}`;
16249
16247
  normalizedPathSegments.push(pathSegment);
16250
16248
  }
16251
16249
  }
16252
- const normalizedPath = `${path2?.startsWith("/") ? "/" : ""}${normalizedPathSegments.join("/")}${normalizedPathSegments.length > 0 && path2?.endsWith("/") ? "/" : ""}`;
16250
+ const normalizedPath = `${path?.startsWith("/") ? "/" : ""}${normalizedPathSegments.join("/")}${normalizedPathSegments.length > 0 && path?.endsWith("/") ? "/" : ""}`;
16253
16251
  const doubleEncoded = escapeUri(normalizedPath);
16254
16252
  return doubleEncoded.replace(/%2F/g, "/");
16255
16253
  }
16256
- return path2;
16254
+ return path;
16257
16255
  }
16258
16256
  validateResolvedCredentials(credentials) {
16259
16257
  if (typeof credentials !== "object" || typeof credentials.accessKeyId !== "string" || typeof credentials.secretAccessKey !== "string") {
@@ -20245,7 +20243,7 @@ var init_validateTokenKey = __esm({
20245
20243
  });
20246
20244
 
20247
20245
  // ../../node_modules/.pnpm/@aws-sdk+token-providers@3.1088.0/node_modules/@aws-sdk/token-providers/dist-es/writeSSOTokenToFile.js
20248
- import { promises as fsPromises } from "fs";
20246
+ import { promises as fsPromises } from "node:fs";
20249
20247
  var writeFile, writeSSOTokenToFile;
20250
20248
  var init_writeSSOTokenToFile = __esm({
20251
20249
  "../../node_modules/.pnpm/@aws-sdk+token-providers@3.1088.0/node_modules/@aws-sdk/token-providers/dist-es/writeSSOTokenToFile.js"() {
@@ -23767,10 +23765,10 @@ var init_signin = __esm({
23767
23765
  });
23768
23766
 
23769
23767
  // ../../node_modules/.pnpm/@aws-sdk+credential-provider-login@3.972.66/node_modules/@aws-sdk/credential-provider-login/dist-es/LoginCredentialsFetcher.js
23770
- import { createHash as createHash4, createPrivateKey, createPublicKey, sign } from "crypto";
23771
- import { promises as fs2 } from "fs";
23772
- import { homedir as homedir3 } from "os";
23773
- import { dirname, join as join8 } from "path";
23768
+ import { createHash as createHash4, createPrivateKey, createPublicKey, sign } from "node:crypto";
23769
+ import { promises as fs2 } from "node:fs";
23770
+ import { homedir as homedir3 } from "node:os";
23771
+ import { dirname, join as join8 } from "node:path";
23774
23772
  var LoginCredentialsFetcher;
23775
23773
  var init_LoginCredentialsFetcher = __esm({
23776
23774
  "../../node_modules/.pnpm/@aws-sdk+credential-provider-login@3.972.66/node_modules/@aws-sdk/credential-provider-login/dist-es/LoginCredentialsFetcher.js"() {
@@ -24130,8 +24128,8 @@ var init_getValidatedProcessCredentials = __esm({
24130
24128
  });
24131
24129
 
24132
24130
  // ../../node_modules/.pnpm/@aws-sdk+credential-provider-process@3.972.59/node_modules/@aws-sdk/credential-provider-process/dist-es/resolveProcessCredentials.js
24133
- import { exec } from "child_process";
24134
- import { promisify } from "util";
24131
+ import { exec } from "node:child_process";
24132
+ import { promisify } from "node:util";
24135
24133
  var resolveProcessCredentials;
24136
24134
  var init_resolveProcessCredentials = __esm({
24137
24135
  "../../node_modules/.pnpm/@aws-sdk+credential-provider-process@3.972.59/node_modules/@aws-sdk/credential-provider-process/dist-es/resolveProcessCredentials.js"() {
@@ -24304,7 +24302,7 @@ var init_fromWebToken = __esm({
24304
24302
  });
24305
24303
 
24306
24304
  // ../../node_modules/.pnpm/@aws-sdk+credential-provider-web-identity@3.972.65/node_modules/@aws-sdk/credential-provider-web-identity/dist-es/fromTokenFile.js
24307
- import { readFileSync } from "fs";
24305
+ import { readFileSync } from "node:fs";
24308
24306
  var ENV_TOKEN_FILE, ENV_ROLE_ARN, ENV_ROLE_SESSION_NAME, fromTokenFile;
24309
24307
  var init_fromTokenFile = __esm({
24310
24308
  "../../node_modules/.pnpm/@aws-sdk+credential-provider-web-identity@3.972.65/node_modules/@aws-sdk/credential-provider-web-identity/dist-es/fromTokenFile.js"() {
@@ -24693,7 +24691,7 @@ var init_Sha256Js2 = __esm({
24693
24691
  });
24694
24692
 
24695
24693
  // ../../node_modules/.pnpm/@smithy+core@3.29.5/node_modules/@smithy/core/dist-es/submodules/checksum/sha256/Sha256Node.js
24696
- import { createHash as createHash5, createHmac as createHmac2 } from "crypto";
24694
+ import { createHash as createHash5, createHmac as createHmac2 } from "node:crypto";
24697
24695
  function buildNativeClass4() {
24698
24696
  return class Sha256Node {
24699
24697
  digestLength = 32;
@@ -24855,7 +24853,7 @@ var init_RemoteProviderInit2 = __esm({
24855
24853
  });
24856
24854
 
24857
24855
  // ../../node_modules/.pnpm/@smithy+credential-provider-imds@4.4.14/node_modules/@smithy/credential-provider-imds/dist-es/remoteProvider/node-http.js
24858
- import node_http2 from "http";
24856
+ import node_http2 from "node:http";
24859
24857
  var init_node_http2 = __esm({
24860
24858
  "../../node_modules/.pnpm/@smithy+credential-provider-imds@4.4.14/node_modules/@smithy/credential-provider-imds/dist-es/remoteProvider/node-http.js"() {
24861
24859
  "use strict";
@@ -25450,7 +25448,7 @@ var init_retry_wrapper2 = __esm({
25450
25448
  });
25451
25449
 
25452
25450
  // ../../node_modules/.pnpm/@aws-sdk+credential-provider-http@3.972.63/node_modules/@aws-sdk/credential-provider-http/dist-es/fromHttp/fromHttp.js
25453
- import fs3 from "fs/promises";
25451
+ import fs3 from "node:fs/promises";
25454
25452
  var AWS_CONTAINER_CREDENTIALS_RELATIVE_URI2, DEFAULT_LINK_LOCAL_HOST2, AWS_CONTAINER_CREDENTIALS_FULL_URI2, AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE2, AWS_CONTAINER_AUTHORIZATION_TOKEN2, fromHttp2, validateToken2;
25455
25453
  var init_fromHttp2 = __esm({
25456
25454
  "../../node_modules/.pnpm/@aws-sdk+credential-provider-http@3.972.63/node_modules/@aws-sdk/credential-provider-http/dist-es/fromHttp/fromHttp.js"() {
@@ -26716,7 +26714,7 @@ var init_validateTokenKey2 = __esm({
26716
26714
  });
26717
26715
 
26718
26716
  // ../../node_modules/.pnpm/@aws-sdk+token-providers@3.1095.0/node_modules/@aws-sdk/token-providers/dist-es/writeSSOTokenToFile.js
26719
- import { promises as fsPromises2 } from "fs";
26717
+ import { promises as fsPromises2 } from "node:fs";
26720
26718
  var writeFile2, writeSSOTokenToFile2;
26721
26719
  var init_writeSSOTokenToFile2 = __esm({
26722
26720
  "../../node_modules/.pnpm/@aws-sdk+token-providers@3.1095.0/node_modules/@aws-sdk/token-providers/dist-es/writeSSOTokenToFile.js"() {
@@ -30076,10 +30074,10 @@ var init_signin2 = __esm({
30076
30074
  });
30077
30075
 
30078
30076
  // ../../node_modules/.pnpm/@aws-sdk+credential-provider-login@3.972.68/node_modules/@aws-sdk/credential-provider-login/dist-es/LoginCredentialsFetcher.js
30079
- import { createHash as createHash6, createPrivateKey as createPrivateKey2, createPublicKey as createPublicKey2, sign as sign2 } from "crypto";
30080
- import { promises as fs4 } from "fs";
30081
- import { homedir as homedir4 } from "os";
30082
- import { dirname as dirname2, join as join9 } from "path";
30077
+ import { createHash as createHash6, createPrivateKey as createPrivateKey2, createPublicKey as createPublicKey2, sign as sign2 } from "node:crypto";
30078
+ import { promises as fs4 } from "node:fs";
30079
+ import { homedir as homedir4 } from "node:os";
30080
+ import { dirname as dirname2, join as join9 } from "node:path";
30083
30081
  var LoginCredentialsFetcher2;
30084
30082
  var init_LoginCredentialsFetcher2 = __esm({
30085
30083
  "../../node_modules/.pnpm/@aws-sdk+credential-provider-login@3.972.68/node_modules/@aws-sdk/credential-provider-login/dist-es/LoginCredentialsFetcher.js"() {
@@ -30439,8 +30437,8 @@ var init_getValidatedProcessCredentials2 = __esm({
30439
30437
  });
30440
30438
 
30441
30439
  // ../../node_modules/.pnpm/@aws-sdk+credential-provider-process@3.972.61/node_modules/@aws-sdk/credential-provider-process/dist-es/resolveProcessCredentials.js
30442
- import { exec as exec2 } from "child_process";
30443
- import { promisify as promisify2 } from "util";
30440
+ import { exec as exec2 } from "node:child_process";
30441
+ import { promisify as promisify2 } from "node:util";
30444
30442
  var resolveProcessCredentials3;
30445
30443
  var init_resolveProcessCredentials3 = __esm({
30446
30444
  "../../node_modules/.pnpm/@aws-sdk+credential-provider-process@3.972.61/node_modules/@aws-sdk/credential-provider-process/dist-es/resolveProcessCredentials.js"() {
@@ -30613,7 +30611,7 @@ var init_fromWebToken2 = __esm({
30613
30611
  });
30614
30612
 
30615
30613
  // ../../node_modules/.pnpm/@aws-sdk+credential-provider-web-identity@3.972.67/node_modules/@aws-sdk/credential-provider-web-identity/dist-es/fromTokenFile.js
30616
- import { readFileSync as readFileSync2 } from "fs";
30614
+ import { readFileSync as readFileSync2 } from "node:fs";
30617
30615
  var ENV_TOKEN_FILE2, ENV_ROLE_ARN2, ENV_ROLE_SESSION_NAME2, fromTokenFile2;
30618
30616
  var init_fromTokenFile2 = __esm({
30619
30617
  "../../node_modules/.pnpm/@aws-sdk+credential-provider-web-identity@3.972.67/node_modules/@aws-sdk/credential-provider-web-identity/dist-es/fromTokenFile.js"() {
@@ -30763,8 +30761,8 @@ var init_dist_es24 = __esm({
30763
30761
 
30764
30762
  // src/cli.ts
30765
30763
  init_esm_shims();
30766
- import { realpathSync } from "fs";
30767
- import { fileURLToPath as fileURLToPath2 } from "url";
30764
+ import { realpathSync } from "node:fs";
30765
+ import { fileURLToPath } from "node:url";
30768
30766
 
30769
30767
  // src/aws-self-stop.ts
30770
30768
  init_esm_shims();
@@ -31488,12 +31486,12 @@ var getUserAgentPlugin = (config) => ({
31488
31486
 
31489
31487
  // ../../node_modules/.pnpm/@aws-sdk+core@3.975.3/node_modules/@aws-sdk/core/dist-es/submodules/client/util-user-agent-node/defaultUserAgent.js
31490
31488
  init_esm_shims();
31491
- import { platform, release } from "os";
31492
- import { env } from "process";
31489
+ import { platform, release } from "node:os";
31490
+ import { env } from "node:process";
31493
31491
 
31494
31492
  // ../../node_modules/.pnpm/@aws-sdk+core@3.975.3/node_modules/@aws-sdk/core/dist-es/submodules/client/util-user-agent-node/getRuntimeUserAgentPair.js
31495
31493
  init_esm_shims();
31496
- import { versions } from "process";
31494
+ import { versions } from "node:process";
31497
31495
  var getRuntimeUserAgentPair = () => {
31498
31496
  const runtimesToCheck = ["deno", "bun", "llrt"];
31499
31497
  for (const runtime of runtimesToCheck) {
@@ -31885,7 +31883,7 @@ init_esm_shims();
31885
31883
 
31886
31884
  // ../../node_modules/.pnpm/@smithy+core@3.29.5/node_modules/@smithy/core/dist-es/submodules/retry/middleware-retry/isStreamingPayload/isStreamingPayload.js
31887
31885
  init_esm_shims();
31888
- import { Readable as Readable7 } from "stream";
31886
+ import { Readable as Readable7 } from "node:stream";
31889
31887
  var isStreamingPayload2 = (request) => request?.body instanceof Readable7 || typeof ReadableStream !== "undefined" && request?.body instanceof ReadableStream;
31890
31888
 
31891
31889
  // ../../node_modules/.pnpm/@smithy+core@3.29.5/node_modules/@smithy/core/dist-es/submodules/retry/middleware-retry/retryMiddleware.js
@@ -32911,10 +32909,10 @@ ${longDate}
32911
32909
  ${credentialScope}
32912
32910
  ${toHex(hashedRequest)}`;
32913
32911
  }
32914
- getCanonicalPath({ path: path2 }) {
32912
+ getCanonicalPath({ path }) {
32915
32913
  if (this.uriEscapePath) {
32916
32914
  const normalizedPathSegments = [];
32917
- for (const pathSegment of path2.split("/")) {
32915
+ for (const pathSegment of path.split("/")) {
32918
32916
  if (pathSegment?.length === 0)
32919
32917
  continue;
32920
32918
  if (pathSegment === ".")
@@ -32925,11 +32923,11 @@ ${toHex(hashedRequest)}`;
32925
32923
  normalizedPathSegments.push(pathSegment);
32926
32924
  }
32927
32925
  }
32928
- const normalizedPath = `${path2?.startsWith("/") ? "/" : ""}${normalizedPathSegments.join("/")}${normalizedPathSegments.length > 0 && path2?.endsWith("/") ? "/" : ""}`;
32926
+ const normalizedPath = `${path?.startsWith("/") ? "/" : ""}${normalizedPathSegments.join("/")}${normalizedPathSegments.length > 0 && path?.endsWith("/") ? "/" : ""}`;
32929
32927
  const doubleEncoded = escapeUri(normalizedPath);
32930
32928
  return doubleEncoded.replace(/%2F/g, "/");
32931
32929
  }
32932
- return path2;
32930
+ return path;
32933
32931
  }
32934
32932
  validateResolvedCredentials(credentials) {
32935
32933
  if (typeof credentials !== "object" || typeof credentials.accessKeyId !== "string" || typeof credentials.secretAccessKey !== "string") {
@@ -33654,7 +33652,7 @@ var getTransformedHeaders2 = (headers) => {
33654
33652
 
33655
33653
  // ../../node_modules/.pnpm/@smithy+node-http-handler@4.9.7/node_modules/@smithy/node-http-handler/dist-es/node-https.js
33656
33654
  init_esm_shims();
33657
- import node_https2 from "https";
33655
+ import node_https2 from "node:https";
33658
33656
 
33659
33657
  // ../../node_modules/.pnpm/@smithy+node-http-handler@4.9.7/node_modules/@smithy/node-http-handler/dist-es/set-connection-timeout.js
33660
33658
  init_esm_shims();
@@ -33772,7 +33770,7 @@ var setSocketTimeout2 = (request, reject, timeoutInMs = 0) => {
33772
33770
 
33773
33771
  // ../../node_modules/.pnpm/@smithy+node-http-handler@4.9.7/node_modules/@smithy/node-http-handler/dist-es/write-request-body.js
33774
33772
  init_esm_shims();
33775
- import { Readable as Readable9 } from "stream";
33773
+ import { Readable as Readable9 } from "node:stream";
33776
33774
  var MIN_WAIT_TIME2 = 6e3;
33777
33775
  async function writeRequestBody2(httpRequest3, request, maxContinueTimeoutMs = MIN_WAIT_TIME2, externalAgent = false) {
33778
33776
  const headers = request.headers;
@@ -33941,12 +33939,12 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
33941
33939
  const password = request.password ?? "";
33942
33940
  auth = `${username}:${password}`;
33943
33941
  }
33944
- let path2 = request.path;
33942
+ let path = request.path;
33945
33943
  if (queryString) {
33946
- path2 += `?${queryString}`;
33944
+ path += `?${queryString}`;
33947
33945
  }
33948
33946
  if (request.fragment) {
33949
- path2 += `#${request.fragment}`;
33947
+ path += `#${request.fragment}`;
33950
33948
  }
33951
33949
  let hostname = request.hostname ?? "";
33952
33950
  if (hostname[0] === "[" && hostname.endsWith("]")) {
@@ -33958,7 +33956,7 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
33958
33956
  headers: request.headers,
33959
33957
  host: hostname,
33960
33958
  method: request.method,
33961
- path: path2,
33959
+ path,
33962
33960
  port: request.port,
33963
33961
  agent,
33964
33962
  auth
@@ -34034,7 +34032,7 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
34034
34032
  socketAcquisitionWarningTimeout,
34035
34033
  throwOnRequestTimeout,
34036
34034
  httpAgentProvider: async () => {
34037
- const node_http3 = await import("http");
34035
+ const node_http3 = await import("node:http");
34038
34036
  const { Agent, request } = node_http3.default ?? node_http3;
34039
34037
  hRequest2 = request;
34040
34038
  hAgent2 = Agent;
@@ -39545,6 +39543,12 @@ var AwsSelfStopAccess = class {
39545
39543
  // src/config.ts
39546
39544
  init_esm_shims();
39547
39545
  var DEFAULT_SYNC_INTERVAL_SECONDS = 60;
39546
+ var DEFAULT_WALKBACK_MAX_POINTS = 10;
39547
+ var DEFAULT_WALKBACK_BUDGET_SECONDS = 180;
39548
+ function positiveIntOr(value, defaultValue) {
39549
+ const parsed = Number.parseInt(value ?? "", 10);
39550
+ return Number.isFinite(parsed) && parsed > 0 ? parsed : defaultValue;
39551
+ }
39548
39552
  function nonEmpty(value) {
39549
39553
  return value !== void 0 && value !== "" ? value : null;
39550
39554
  }
@@ -39556,7 +39560,6 @@ function resolveConfig(env3) {
39556
39560
  const bucket = nonEmpty(env3.LITESTREAM_BUCKET);
39557
39561
  const prefix = nonEmpty(env3.LITESTREAM_PREFIX);
39558
39562
  const persistenceEnabled = bucket !== null && prefix !== null;
39559
- const interval = Number.parseInt(env3.CREDS_SYNC_INTERVAL ?? "", 10);
39560
39563
  return {
39561
39564
  homeDir,
39562
39565
  claude: {
@@ -39573,7 +39576,15 @@ function resolveConfig(env3) {
39573
39576
  bucket: persistenceEnabled ? bucket : null,
39574
39577
  prefix: persistenceEnabled ? prefix : null,
39575
39578
  region: nonEmpty(env3.AWS_REGION),
39576
- syncIntervalSeconds: Number.isFinite(interval) && interval > 0 ? interval : DEFAULT_SYNC_INTERVAL_SECONDS,
39579
+ syncIntervalSeconds: positiveIntOr(env3.CREDS_SYNC_INTERVAL, DEFAULT_SYNC_INTERVAL_SECONDS),
39580
+ walkbackMaxPoints: positiveIntOr(
39581
+ env3.EVIDENT_SESSION_DB_WALKBACK_MAX_POINTS,
39582
+ DEFAULT_WALKBACK_MAX_POINTS
39583
+ ),
39584
+ walkbackBudgetSeconds: positiveIntOr(
39585
+ env3.EVIDENT_SESSION_DB_WALKBACK_BUDGET_SECONDS,
39586
+ DEFAULT_WALKBACK_BUDGET_SECONDS
39587
+ ),
39577
39588
  hasModelApiKey: nonEmpty(env3.ANTHROPIC_API_KEY) !== null || nonEmpty(env3.OPENAI_API_KEY) !== null
39578
39589
  };
39579
39590
  }
@@ -39586,22 +39597,22 @@ init_esm_shims();
39586
39597
  function assertNever(value) {
39587
39598
  throw new Error(`Unhandled restore outcome: ${JSON.stringify(value)}`);
39588
39599
  }
39589
- function describeRestoreOutcome(label, path2, outcome) {
39600
+ function describeRestoreOutcome(label, path, outcome) {
39590
39601
  switch (outcome.kind) {
39591
39602
  case "local":
39592
- return `Found valid ${label} credentials at ${path2}.`;
39603
+ return `Found valid ${label} credentials at ${path}.`;
39593
39604
  case "restored":
39594
- return `Found valid ${label} credentials at ${path2} (restored from the object store).`;
39605
+ return `Found valid ${label} credentials at ${path} (restored from the object store).`;
39595
39606
  case "failed":
39596
39607
  return `WARNING: ${label} credentials could not be restored from S3 (${outcome.reason}). Check the earlier S3 error for IAM/network details before bootstrapping again; the existing persisted credentials may still be recoverable.`;
39597
39608
  case "invalid":
39598
39609
  return `WARNING: a persisted ${label} credentials object was found in S3 but was invalid/corrupt and was discarded (see the warning above) \u2014 nothing usable was restored. Re-bootstrap auth, or check what wrote that S3 object.`;
39599
39610
  case "localInvalid":
39600
- return `WARNING: local ${label} credentials at ${path2} are invalid/unreadable and were kept in place (see the warning above), which blocks restoring a good S3 object over them. Fix or remove the local file so a valid persisted copy (if any) can restore. If they were written by root during an SSM-Exec bootstrap they are simply unreadable by the runner user: 'chown -R 10001:10001' them from the exec shell.`;
39611
+ return `WARNING: local ${label} credentials at ${path} are invalid/unreadable and were kept in place (see the warning above), which blocks restoring a good S3 object over them. Fix or remove the local file so a valid persisted copy (if any) can restore. If they were written by root during an SSM-Exec bootstrap they are simply unreadable by the runner user: 'chown -R 10001:10001' them from the exec shell.`;
39601
39612
  case "missing":
39602
- return `No ${label} credentials at ${path2} (and none persisted in S3).`;
39613
+ return `No ${label} credentials at ${path} (and none persisted in S3).`;
39603
39614
  case "disabled":
39604
- return `No ${label} credentials at ${path2}; credential persistence is disabled (LITESTREAM_BUCKET/LITESTREAM_PREFIX unset), so nothing could be restored.`;
39615
+ return `No ${label} credentials at ${path}; credential persistence is disabled (LITESTREAM_BUCKET/LITESTREAM_PREFIX unset), so nothing could be restored.`;
39605
39616
  default:
39606
39617
  return assertNever(outcome);
39607
39618
  }
@@ -39705,40 +39716,173 @@ function describeSessionDbClassification(outcome, config) {
39705
39716
  return assertNeverSessionDb(outcome);
39706
39717
  }
39707
39718
  }
39719
+ function assertNeverSessionDbVerify(value) {
39720
+ throw new Error(`Unhandled session-DB verify outcome: ${JSON.stringify(value)}`);
39721
+ }
39722
+ function assertNeverSessionDbVerifySkippedLocalDb(value) {
39723
+ throw new Error(`Unhandled session-DB verify skipped local-DB state: ${JSON.stringify(value)}`);
39724
+ }
39725
+ function assertNeverSessionDbVerifyExhaustedReason(value) {
39726
+ throw new Error(`Unhandled session-DB verify exhausted reason: ${JSON.stringify(value)}`);
39727
+ }
39728
+ function sessionDbVerifyExitCode(outcome) {
39729
+ switch (outcome.kind) {
39730
+ case "skipped":
39731
+ case "healthy":
39732
+ case "walkedBack":
39733
+ return 0;
39734
+ case "exhausted":
39735
+ return 33;
39736
+ // booted with a fresh DB; the shell still starts a fresh backup chain
39737
+ default:
39738
+ return assertNeverSessionDbVerify(outcome);
39739
+ }
39740
+ }
39741
+ function describeSessionDbVerifySkipped(localDb) {
39742
+ switch (localDb) {
39743
+ case "absent":
39744
+ return "No opencode.db found; nothing to verify at boot.";
39745
+ case "empty":
39746
+ return "opencode.db is zero bytes; nothing to verify at boot.";
39747
+ default:
39748
+ return assertNeverSessionDbVerifySkippedLocalDb(localDb);
39749
+ }
39750
+ }
39751
+ function describeSessionDbVerifyExhausted(outcome) {
39752
+ const tried = `tried ${outcome.candidatesTried} restore point${outcome.candidatesTried === 1 ? "" : "s"}`;
39753
+ switch (outcome.reason) {
39754
+ case "enumerationFailed":
39755
+ return `SESSION-DB-INTEGRITY-EXHAUSTED: opencode.db failed its integrity check and litestream's restore-point listing could not be read (${tried}); booting with a FRESH opencode.db.`;
39756
+ case "noCandidates":
39757
+ return `SESSION-DB-INTEGRITY-EXHAUSTED: opencode.db failed its integrity check and no older restore point is retained (${tried}); booting with a FRESH opencode.db.`;
39758
+ case "allFailed":
39759
+ return `SESSION-DB-INTEGRITY-EXHAUSTED: opencode.db failed its integrity check and every retained restore point also failed (${tried}); booting with a FRESH opencode.db.`;
39760
+ case "budgetExhausted":
39761
+ return `SESSION-DB-INTEGRITY-EXHAUSTED: opencode.db failed its integrity check; the walkback search budget ran out before every retained restore point was tried (${tried}) \u2014 widen it with EVIDENT_SESSION_DB_WALKBACK_MAX_POINTS/EVIDENT_SESSION_DB_WALKBACK_BUDGET_SECONDS if there was more to try; booting with a FRESH opencode.db.`;
39762
+ default:
39763
+ return assertNeverSessionDbVerifyExhaustedReason(outcome.reason);
39764
+ }
39765
+ }
39766
+ function describeSessionDbVerification(outcome) {
39767
+ switch (outcome.kind) {
39768
+ case "skipped":
39769
+ return describeSessionDbVerifySkipped(outcome.localDb);
39770
+ case "healthy":
39771
+ return `SESSION-DB-INTEGRITY: ok bytes=${outcome.bytes}`;
39772
+ case "walkedBack":
39773
+ return `SESSION-DB-INTEGRITY-WALKBACK: opencode.db failed its integrity check; adopted an older litestream restore point after trying ${outcome.candidatesTried} candidate${outcome.candidatesTried === 1 ? "" : "s"}. Everything after this transaction is lost. txid=${outcome.txid} candidates=${outcome.candidatesTried} bytes=${outcome.bytes}`;
39774
+ case "exhausted":
39775
+ return describeSessionDbVerifyExhausted(outcome);
39776
+ default:
39777
+ return assertNeverSessionDbVerify(outcome);
39778
+ }
39779
+ }
39708
39780
 
39709
39781
  // src/file-ops.ts
39710
39782
  init_esm_shims();
39711
- import { createHash as createHash7 } from "crypto";
39712
- import { chmod, mkdir, open, readFile as readFile4, rename, rm, stat, writeFile as writeFile3 } from "fs/promises";
39783
+ import { createHash as createHash7 } from "node:crypto";
39784
+ import { chmod, mkdir, open, readFile as readFile4, rename, rm, stat, writeFile as writeFile3 } from "node:fs/promises";
39713
39785
  var nodeFileOps = {
39714
39786
  async mkdirp(dir) {
39715
39787
  await mkdir(dir, { recursive: true });
39716
39788
  },
39717
- async chmod(path2, mode) {
39718
- await chmod(path2, mode);
39789
+ async chmod(path, mode) {
39790
+ await chmod(path, mode);
39719
39791
  },
39720
- async stat(path2) {
39792
+ async stat(path) {
39721
39793
  try {
39722
- const stats = await stat(path2);
39794
+ const stats = await stat(path);
39723
39795
  return { size: stats.size };
39724
39796
  } catch {
39725
39797
  return null;
39726
39798
  }
39727
39799
  },
39728
39800
  readFile: readFile4,
39729
- async writeFile(path2, data) {
39730
- await writeFile3(path2, data);
39801
+ async writeFile(path, data) {
39802
+ await writeFile3(path, data);
39731
39803
  },
39732
- async createExclusive(path2) {
39733
- const handle = await open(path2, "wx", 384);
39804
+ async createExclusive(path) {
39805
+ const handle = await open(path, "wx", 384);
39734
39806
  await handle.close();
39735
39807
  },
39736
39808
  rename,
39737
- async remove(path2) {
39738
- await rm(path2, { force: true });
39809
+ async remove(path) {
39810
+ await rm(path, { force: true });
39739
39811
  },
39740
- async hashFile(path2) {
39741
- return createHash7("sha256").update(await readFile4(path2)).digest("hex");
39812
+ async hashFile(path) {
39813
+ return createHash7("sha256").update(await readFile4(path)).digest("hex");
39814
+ }
39815
+ };
39816
+
39817
+ // src/litestream-cli.ts
39818
+ init_esm_shims();
39819
+ import { execFile } from "node:child_process";
39820
+ import { promisify as promisify3 } from "node:util";
39821
+
39822
+ // src/logger.ts
39823
+ init_esm_shims();
39824
+ var LOG_PREFIX = "[auth-persistence]";
39825
+ var consoleLogger = (message) => {
39826
+ process.stderr.write(`${LOG_PREFIX} ${message}
39827
+ `);
39828
+ };
39829
+ function describeError(error) {
39830
+ return error instanceof Error ? error.message : String(error);
39831
+ }
39832
+
39833
+ // src/litestream-cli.ts
39834
+ var execFileAsync = promisify3(execFile);
39835
+ function stderrOf(error) {
39836
+ if (typeof error === "object" && error !== null && "stderr" in error) {
39837
+ const stderr = error.stderr;
39838
+ if (typeof stderr === "string" && stderr.length > 0) return stderr;
39839
+ }
39840
+ return describeError(error);
39841
+ }
39842
+ var LitestreamCli = class {
39843
+ constructor(configPath, dbPath) {
39844
+ this.configPath = configPath;
39845
+ this.dbPath = dbPath;
39846
+ }
39847
+ async listRestorePoints() {
39848
+ try {
39849
+ const { stdout, stderr } = await execFileAsync("litestream", [
39850
+ "ltx",
39851
+ "-config",
39852
+ this.configPath,
39853
+ // MEASURED: `-level` defaults to 0, which only shows L0 — `all` is
39854
+ // required to see the L1/L2/L9 compaction levels too (plan §2.3).
39855
+ "-level",
39856
+ "all",
39857
+ "-json",
39858
+ this.dbPath
39859
+ ]);
39860
+ return { stdout, detail: stderr };
39861
+ } catch (error) {
39862
+ return { stdout: null, detail: stderrOf(error) };
39863
+ }
39864
+ }
39865
+ async restoreAt(txid, outputPath) {
39866
+ try {
39867
+ const { stderr } = await execFileAsync("litestream", [
39868
+ "restore",
39869
+ "-config",
39870
+ this.configPath,
39871
+ "-txid",
39872
+ txid,
39873
+ // MEASURED: without `-force`, restoring into a path that already
39874
+ // exists exits 1 with "output path already exists and is not
39875
+ // empty" (plan §2.4) — the caller always restores into a scratch
39876
+ // path it just cleared, so overwriting it is always intended.
39877
+ "-force",
39878
+ "-o",
39879
+ outputPath,
39880
+ this.dbPath
39881
+ ]);
39882
+ return { ok: true, detail: stderr };
39883
+ } catch (error) {
39884
+ return { ok: false, detail: stderrOf(error) };
39885
+ }
39742
39886
  }
39743
39887
  };
39744
39888
 
@@ -39768,26 +39912,15 @@ dbs:
39768
39912
  `;
39769
39913
  }
39770
39914
 
39771
- // src/logger.ts
39772
- init_esm_shims();
39773
- var LOG_PREFIX = "[auth-persistence]";
39774
- var consoleLogger = (message) => {
39775
- process.stderr.write(`${LOG_PREFIX} ${message}
39776
- `);
39777
- };
39778
- function describeError(error) {
39779
- return error instanceof Error ? error.message : String(error);
39780
- }
39781
-
39782
39915
  // src/model-auth.ts
39783
39916
  init_esm_shims();
39784
39917
 
39785
39918
  // src/valid-json.ts
39786
39919
  init_esm_shims();
39787
- async function isValidJson(fileOps, path2) {
39920
+ async function isValidJson(fileOps, path) {
39788
39921
  let contents;
39789
39922
  try {
39790
- contents = await fileOps.readFile(path2);
39923
+ contents = await fileOps.readFile(path);
39791
39924
  } catch {
39792
39925
  return false;
39793
39926
  }
@@ -39854,36 +39987,38 @@ function isDeletableReplicaKey(prefix, key) {
39854
39987
 
39855
39988
  // src/restore.ts
39856
39989
  init_esm_shims();
39857
- import { dirname as dirname3 } from "path";
39990
+ import { dirname as dirname3 } from "node:path";
39858
39991
  async function restore(params) {
39859
- const { label, path: path2, bucket, key, store, fileOps, log } = params;
39860
- const dir = dirname3(path2);
39992
+ const { label, path, bucket, key, store, fileOps, log } = params;
39993
+ const dir = dirname3(path);
39861
39994
  try {
39862
39995
  await fileOps.mkdirp(dir);
39863
- } catch {
39864
- log(`WARNING: could not create ${label} credential directory ${dir}.`);
39865
- return { kind: "failed", reason: `could not create ${dir}` };
39996
+ } catch (error) {
39997
+ log(`WARNING: could not create ${label} credential directory ${dir}: ${describeError(error)}`);
39998
+ return { kind: "failed", reason: `could not create ${dir}: ${describeError(error)}` };
39866
39999
  }
39867
40000
  try {
39868
40001
  await fileOps.chmod(dir, 448);
39869
- } catch {
39870
- log(`WARNING: could not restrict ${label} credential directory ${dir}.`);
40002
+ } catch (error) {
40003
+ log(
40004
+ `WARNING: could not restrict ${label} credential directory ${dir}: ${describeError(error)}`
40005
+ );
39871
40006
  }
39872
- const local = await fileOps.stat(path2);
39873
- if (local !== null && local.size > 0 && !await isValidJson(fileOps, path2)) {
40007
+ const local = await fileOps.stat(path);
40008
+ if (local !== null && local.size > 0 && !await isValidJson(fileOps, path)) {
39874
40009
  log(
39875
- `WARNING: local ${label} credentials at ${path2} are invalid or unreadable; keeping them and skipping restore.`
40010
+ `WARNING: local ${label} credentials at ${path} are invalid or unreadable; keeping them and skipping restore.`
39876
40011
  );
39877
40012
  return { kind: "localInvalid" };
39878
40013
  }
39879
40014
  if (local !== null && local.size === 0) {
39880
40015
  log(
39881
- `Local ${label} credentials at ${path2} are empty; will attempt to restore from S3 instead of protecting them.`
40016
+ `Local ${label} credentials at ${path} are empty; will attempt to restore from S3 instead of protecting them.`
39882
40017
  );
39883
40018
  }
39884
- if (await isValidJson(fileOps, path2)) {
39885
- await chmodOrWarn(fileOps, log, path2, `local ${label} credentials at ${path2}`);
39886
- log(`Keeping valid local ${label} credentials at ${path2}; no restore.`);
40019
+ if (await isValidJson(fileOps, path)) {
40020
+ await chmodOrWarn(fileOps, log, path, `local ${label} credentials at ${path}`);
40021
+ log(`Keeping valid local ${label} credentials at ${path}; no restore.`);
39887
40022
  return { kind: "local" };
39888
40023
  }
39889
40024
  if (store === null || bucket === null || key === null) {
@@ -39904,16 +40039,26 @@ async function restore(params) {
39904
40039
  const temp = `${dir}/.credentials.${Math.random().toString(36).slice(2, 8)}`;
39905
40040
  try {
39906
40041
  await fileOps.createExclusive(temp);
39907
- } catch {
39908
- log(`WARNING: could not create temporary ${label} credentials in ${dir}.`);
39909
- return { kind: "failed", reason: `could not create a temporary file in ${dir}` };
40042
+ } catch (error) {
40043
+ log(
40044
+ `WARNING: could not create temporary ${label} credentials in ${dir}: ${describeError(error)}`
40045
+ );
40046
+ return {
40047
+ kind: "failed",
40048
+ reason: `could not create a temporary file in ${dir}: ${describeError(error)}`
40049
+ };
39910
40050
  }
39911
40051
  try {
39912
40052
  await fileOps.chmod(temp, 384);
39913
- } catch {
40053
+ } catch (error) {
39914
40054
  await fileOps.remove(temp);
39915
- log(`WARNING: could not restrict temporary ${label} credentials in ${dir}.`);
39916
- return { kind: "failed", reason: `could not restrict a temporary file in ${dir}` };
40055
+ log(
40056
+ `WARNING: could not restrict temporary ${label} credentials in ${dir}: ${describeError(error)}`
40057
+ );
40058
+ return {
40059
+ kind: "failed",
40060
+ reason: `could not restrict a temporary file in ${dir}: ${describeError(error)}`
40061
+ };
39917
40062
  }
39918
40063
  try {
39919
40064
  await fileOps.writeFile(temp, body);
@@ -39928,21 +40073,23 @@ async function restore(params) {
39928
40073
  return { kind: "invalid" };
39929
40074
  }
39930
40075
  try {
39931
- await fileOps.rename(temp, path2);
39932
- } catch {
40076
+ await fileOps.rename(temp, path);
40077
+ } catch (error) {
39933
40078
  await fileOps.remove(temp);
39934
- log(`WARNING: could not install restored ${label} credentials at ${path2}.`);
39935
- return { kind: "failed", reason: `could not install ${path2}` };
40079
+ log(
40080
+ `WARNING: could not install restored ${label} credentials at ${path}: ${describeError(error)}`
40081
+ );
40082
+ return { kind: "failed", reason: `could not install ${path}: ${describeError(error)}` };
39936
40083
  }
39937
- await chmodOrWarn(fileOps, log, path2, `restored ${label} credentials at ${path2}`);
39938
- log(`Restored ${label} credentials from ${location} to ${path2}.`);
40084
+ await chmodOrWarn(fileOps, log, path, `restored ${label} credentials at ${path}`);
40085
+ log(`Restored ${label} credentials from ${location} to ${path}.`);
39939
40086
  return { kind: "restored" };
39940
40087
  }
39941
- async function chmodOrWarn(fileOps, log, path2, subject) {
40088
+ async function chmodOrWarn(fileOps, log, path, subject) {
39942
40089
  try {
39943
- await fileOps.chmod(path2, 384);
39944
- } catch {
39945
- log(`WARNING: could not restrict ${subject}.`);
40090
+ await fileOps.chmod(path, 384);
40091
+ } catch (error) {
40092
+ log(`WARNING: could not restrict ${subject}: ${describeError(error)}`);
39946
40093
  }
39947
40094
  }
39948
40095
 
@@ -40991,7 +41138,7 @@ init_protocols();
40991
41138
 
40992
41139
  // ../../node_modules/.pnpm/@aws-sdk+middleware-sdk-s3@3.972.66/node_modules/@aws-sdk/middleware-sdk-s3/dist-es/submodules/s3/to-stream/toStream.js
40993
41140
  init_esm_shims();
40994
- import { Readable as Readable10 } from "stream";
41141
+ import { Readable as Readable10 } from "node:stream";
40995
41142
  function toStream(bytes) {
40996
41143
  return Readable10.from(Buffer.from(bytes));
40997
41144
  }
@@ -49459,7 +49606,7 @@ var Sha1Js = class _Sha1Js {
49459
49606
 
49460
49607
  // ../../node_modules/.pnpm/@aws-sdk+checksums@3.1000.20/node_modules/@aws-sdk/checksums/dist-es/submodules/sha/sha1/Sha1Node.js
49461
49608
  init_esm_shims();
49462
- import { createHash as createHash8, createHmac as createHmac3 } from "crypto";
49609
+ import { createHash as createHash8, createHmac as createHmac3 } from "node:crypto";
49463
49610
  var hasNativeCrypto4 = (() => {
49464
49611
  try {
49465
49612
  createHash8("sha1");
@@ -50036,13 +50183,148 @@ function shouldEscalateToQuarantine(reason, prefix, keys) {
50036
50183
  return hasParsableLtxKey(prefix, keys);
50037
50184
  }
50038
50185
  async function discardLocalDebris(fileOps, dbPath, log) {
50039
- for (const path2 of [dbPath, `${dbPath}-wal`, `${dbPath}-shm`]) {
50186
+ for (const path of [dbPath, `${dbPath}-wal`, `${dbPath}-shm`]) {
50040
50187
  try {
50041
- await fileOps.remove(path2);
50188
+ await fileOps.remove(path);
50042
50189
  } catch (error) {
50043
- log(`WARNING: could not remove local session-DB debris at ${path2}: ${describeError(error)}`);
50190
+ log(`WARNING: could not remove local session-DB debris at ${path}: ${describeError(error)}`);
50191
+ }
50192
+ }
50193
+ }
50194
+
50195
+ // src/session-db-verify.ts
50196
+ init_esm_shims();
50197
+
50198
+ // src/restore-points.ts
50199
+ init_esm_shims();
50200
+ function isRestorePointShaped(value) {
50201
+ if (typeof value !== "object" || value === null) return false;
50202
+ const candidate = value;
50203
+ return typeof candidate.level === "number" && typeof candidate.max_txid === "string";
50204
+ }
50205
+ function parseLtxListing(stdout) {
50206
+ let parsed;
50207
+ try {
50208
+ parsed = JSON.parse(stdout);
50209
+ } catch {
50210
+ return null;
50211
+ }
50212
+ if (!Array.isArray(parsed)) return null;
50213
+ const points = [];
50214
+ for (const element of parsed) {
50215
+ if (!isRestorePointShaped(element)) return null;
50216
+ points.push({
50217
+ level: element.level,
50218
+ minTxid: typeof element.min_txid === "string" ? element.min_txid : "",
50219
+ maxTxid: element.max_txid,
50220
+ size: typeof element.size === "number" ? element.size : 0,
50221
+ timestamp: typeof element.timestamp === "string" ? element.timestamp : null
50222
+ });
50223
+ }
50224
+ return points;
50225
+ }
50226
+ function walkbackCandidates(points) {
50227
+ const distinct = /* @__PURE__ */ new Map();
50228
+ for (const point of points) {
50229
+ if (!distinct.has(point.maxTxid)) {
50230
+ distinct.set(point.maxTxid, BigInt(`0x${point.maxTxid}`));
50044
50231
  }
50045
50232
  }
50233
+ return [...distinct.entries()].sort((a12, b12) => a12[1] > b12[1] ? -1 : a12[1] < b12[1] ? 1 : 0).slice(1).map(([maxTxid]) => maxTxid);
50234
+ }
50235
+
50236
+ // src/session-db-verify.ts
50237
+ async function verifySessionDb(params) {
50238
+ const { config, fileOps, sqlite, log } = params;
50239
+ const dbPath = config.opencodeDbPath;
50240
+ const stat2 = await fileOps.stat(dbPath);
50241
+ if (stat2 === null) return { kind: "skipped", localDb: "absent" };
50242
+ if (stat2.size === 0) return { kind: "skipped", localDb: "empty" };
50243
+ const result = await sqlite.check(dbPath);
50244
+ if (result.ok) return { kind: "healthy", bytes: stat2.size };
50245
+ log(
50246
+ `WARNING: SESSION-DB-INTEGRITY-FAILED: opencode.db at ${dbPath} failed its integrity check: ${result.detail}`
50247
+ );
50248
+ return walkBack(params);
50249
+ }
50250
+ async function clearScratch(fileOps, scratch) {
50251
+ await fileOps.remove(scratch);
50252
+ await fileOps.remove(`${scratch}-wal`);
50253
+ await fileOps.remove(`${scratch}-shm`);
50254
+ }
50255
+ async function discardCorruptDb(fileOps, dbPath, log) {
50256
+ for (const path of [dbPath, `${dbPath}-wal`, `${dbPath}-shm`]) {
50257
+ try {
50258
+ await fileOps.remove(path);
50259
+ } catch (error) {
50260
+ log(
50261
+ `WARNING: could not remove corrupt local session-DB debris at ${path}: ${describeError(error)}`
50262
+ );
50263
+ }
50264
+ }
50265
+ }
50266
+ async function adopt(fileOps, scratch, dbPath, log, txid, candidatesTried, bytes) {
50267
+ await fileOps.remove(`${dbPath}-wal`);
50268
+ await fileOps.remove(`${dbPath}-shm`);
50269
+ await fileOps.remove(dbPath);
50270
+ await fileOps.rename(scratch, dbPath);
50271
+ log(
50272
+ `INFO: SESSION-DB-WALKBACK-ADOPTED: adopted an older litestream restore point txid=${txid} candidates=${candidatesTried} bytes=${bytes}`
50273
+ );
50274
+ }
50275
+ async function walkBack(params) {
50276
+ const { config, fileOps, sqlite, litestream, log, maxPoints, budgetSeconds } = params;
50277
+ const dbPath = config.opencodeDbPath;
50278
+ const now = params.now ?? Date.now;
50279
+ const scratch = `${dbPath}.walkback`;
50280
+ const listing = await litestream.listRestorePoints();
50281
+ const points = listing.stdout === null ? null : parseLtxListing(listing.stdout);
50282
+ if (points === null) {
50283
+ log(
50284
+ `WARNING: SESSION-DB-WALKBACK-ENUMERATION-FAILED: ${listing.stdout === null ? `litestream ltx exited non-zero: ${listing.detail}` : "litestream ltx succeeded but its listing could not be parsed"}`
50285
+ );
50286
+ await discardCorruptDb(fileOps, dbPath, log);
50287
+ return { kind: "exhausted", reason: "enumerationFailed", candidatesTried: 0 };
50288
+ }
50289
+ const candidates = walkbackCandidates(points);
50290
+ if (candidates.length === 0) {
50291
+ await discardCorruptDb(fileOps, dbPath, log);
50292
+ return { kind: "exhausted", reason: "noCandidates", candidatesTried: 0 };
50293
+ }
50294
+ const deadline = now() + budgetSeconds * 1e3;
50295
+ let candidatesTried = 0;
50296
+ let index = 0;
50297
+ for (; index < candidates.length; index++) {
50298
+ if (candidatesTried >= maxPoints || now() >= deadline) break;
50299
+ const txid = candidates[index];
50300
+ candidatesTried++;
50301
+ await clearScratch(fileOps, scratch);
50302
+ const restoreResult = await litestream.restoreAt(txid, scratch);
50303
+ if (!restoreResult.ok) {
50304
+ log(
50305
+ `WARNING: SESSION-DB-WALKBACK-CANDIDATE-FAILED: restoring txid=${txid} failed: ${restoreResult.detail}`
50306
+ );
50307
+ continue;
50308
+ }
50309
+ const check = await sqlite.check(scratch);
50310
+ if (!check.ok) {
50311
+ log(
50312
+ `WARNING: SESSION-DB-WALKBACK-CANDIDATE-FAILED: txid=${txid} restored but failed its integrity check: ${check.detail}`
50313
+ );
50314
+ continue;
50315
+ }
50316
+ const scratchStat = await fileOps.stat(scratch);
50317
+ const bytes = scratchStat?.size ?? 0;
50318
+ await adopt(fileOps, scratch, dbPath, log, txid, candidatesTried, bytes);
50319
+ return { kind: "walkedBack", txid, bytes, candidatesTried };
50320
+ }
50321
+ await clearScratch(fileOps, scratch);
50322
+ await discardCorruptDb(fileOps, dbPath, log);
50323
+ return {
50324
+ kind: "exhausted",
50325
+ reason: index < candidates.length ? "budgetExhausted" : "allFailed",
50326
+ candidatesTried
50327
+ };
50046
50328
  }
50047
50329
 
50048
50330
  // src/self-stop.ts
@@ -50128,22 +50410,55 @@ var shell_contract_default = {
50128
50410
  "sync-once",
50129
50411
  "model-auth-ready",
50130
50412
  "self-stop",
50131
- "session-db-classify"
50413
+ "session-db-classify",
50414
+ "session-db-verify"
50132
50415
  ]
50133
50416
  };
50134
50417
 
50418
+ // src/sqlite-integrity.ts
50419
+ init_esm_shims();
50420
+ import { DatabaseSync } from "node:sqlite";
50421
+ import { rm as rm2 } from "node:fs/promises";
50422
+ var MAX_DETAIL_LENGTH = 500;
50423
+ function truncate(text) {
50424
+ return text.length > MAX_DETAIL_LENGTH ? `${text.slice(0, MAX_DETAIL_LENGTH)}\u2026` : text;
50425
+ }
50426
+ var nodeSqliteIntegrity = {
50427
+ async check(path) {
50428
+ let db;
50429
+ try {
50430
+ db = new DatabaseSync(path, { readOnly: true });
50431
+ const row = db.prepare("PRAGMA integrity_check").get();
50432
+ const value = row?.integrity_check;
50433
+ if (value === "ok") {
50434
+ return { ok: true };
50435
+ }
50436
+ return { ok: false, detail: truncate(String(value ?? "no result row")) };
50437
+ } catch (err) {
50438
+ return {
50439
+ ok: false,
50440
+ detail: truncate(err instanceof Error ? err.message : String(err))
50441
+ };
50442
+ } finally {
50443
+ db?.close();
50444
+ await rm2(`${path}-shm`, { force: true });
50445
+ await rm2(`${path}-wal`, { force: true });
50446
+ }
50447
+ }
50448
+ };
50449
+
50135
50450
  // src/sync.ts
50136
50451
  init_esm_shims();
50137
50452
  async function sync(params) {
50138
- const { label, path: path2, bucket, key, store, lastHash, fileOps, log } = params;
50453
+ const { label, path, bucket, key, store, lastHash, fileOps, log } = params;
50139
50454
  if (store === null || bucket === null || key === null) {
50140
50455
  return { outcome: { kind: "disabled" }, hash: lastHash };
50141
50456
  }
50142
- const exists = await fileOps.stat(path2) !== null;
50143
- const valid = await isValidJson(fileOps, path2);
50457
+ const exists = await fileOps.stat(path) !== null;
50458
+ const valid = await isValidJson(fileOps, path);
50144
50459
  if (exists && !valid) {
50145
50460
  log(
50146
- `WARNING: local ${label} credentials at ${path2} are invalid or unreadable; keeping them and skipping sync.`
50461
+ `WARNING: local ${label} credentials at ${path} are invalid or unreadable; keeping them and skipping sync.`
50147
50462
  );
50148
50463
  return { outcome: { kind: "localInvalid" }, hash: lastHash };
50149
50464
  }
@@ -50151,15 +50466,19 @@ async function sync(params) {
50151
50466
  return { outcome: { kind: "absent" }, hash: lastHash };
50152
50467
  }
50153
50468
  try {
50154
- await fileOps.chmod(path2, 384);
50155
- } catch {
50156
- log(`WARNING: could not restrict local ${label} credentials at ${path2}.`);
50469
+ await fileOps.chmod(path, 384);
50470
+ } catch (error) {
50471
+ log(
50472
+ `WARNING: could not restrict local ${label} credentials at ${path}: ${describeError(error)}`
50473
+ );
50157
50474
  }
50158
50475
  let hash;
50159
50476
  try {
50160
- hash = await fileOps.hashFile(path2);
50161
- } catch {
50162
- log(`WARNING: could not hash local ${label} credentials at ${path2}; skipping this sync tick.`);
50477
+ hash = await fileOps.hashFile(path);
50478
+ } catch (error) {
50479
+ log(
50480
+ `WARNING: could not hash local ${label} credentials at ${path} (${describeError(error)}); skipping this sync tick.`
50481
+ );
50163
50482
  return { outcome: { kind: "hashFailed" }, hash: lastHash };
50164
50483
  }
50165
50484
  if (hash === lastHash) {
@@ -50167,12 +50486,12 @@ async function sync(params) {
50167
50486
  }
50168
50487
  const location = `s3://${bucket}/${key}`;
50169
50488
  try {
50170
- await store.put(key, await fileOps.readFile(path2));
50489
+ await store.put(key, await fileOps.readFile(path));
50171
50490
  } catch (error) {
50172
50491
  log(`WARNING: ${label} credentials upload failed to ${location}: ${describeError(error)}`);
50173
50492
  return { outcome: { kind: "failed", reason: describeError(error) }, hash: lastHash };
50174
50493
  }
50175
- log(`Uploaded ${label} credentials from ${path2} to ${location}.`);
50494
+ log(`Uploaded ${label} credentials from ${path} to ${location}.`);
50176
50495
  return { outcome: { kind: "uploaded" }, hash };
50177
50496
  }
50178
50497
 
@@ -50184,6 +50503,7 @@ var EXIT_BROKEN = 1;
50184
50503
  var EXIT_SESSION_DB_FATAL = 30;
50185
50504
  var EXIT_SESSION_DB_UNUSABLE = 31;
50186
50505
  var EXIT_SESSION_DB_RETRY = 32;
50506
+ var EXIT_SESSION_DB_UNVERIFIABLE = 33;
50187
50507
  var STATE_SUFFIX = ".synchash";
50188
50508
  var COMMANDS = shell_contract_default.commands;
50189
50509
  var USAGE = `Usage: runner-synchroniser <command> [args]
@@ -50201,6 +50521,11 @@ var USAGE = `Usage: runner-synchroniser <command> [args]
50201
50521
  exit 0 restored/no-replica/disabled, ${EXIT_SESSION_DB_RETRY} re-run
50202
50522
  and ask again, ${EXIT_SESSION_DB_UNUSABLE} unusable (booted fresh,
50203
50523
  fresh backup chain), ${EXIT_SESSION_DB_FATAL} fatal
50524
+ session-db-verify <litestream-config-path>
50525
+ verify opencode.db's integrity at boot, walking back through
50526
+ litestream's retained restore points if it's corrupt; exit 0
50527
+ healthy/skipped/walked-back, ${EXIT_SESSION_DB_UNVERIFIABLE} every
50528
+ candidate was exhausted (booted fresh)
50204
50529
  `;
50205
50530
  function shellQuote(value) {
50206
50531
  return `'${value.replaceAll("'", `'\\''`)}'`;
@@ -50211,6 +50536,12 @@ function s3ObjectStoreFor(config) {
50211
50536
  function awsSelfStopAccessFor(config) {
50212
50537
  return new AwsSelfStopAccess(config.region);
50213
50538
  }
50539
+ function nodeSqliteIntegrityFor() {
50540
+ return nodeSqliteIntegrity;
50541
+ }
50542
+ function litestreamCliFor(configPath, dbPath) {
50543
+ return new LitestreamCli(configPath, dbPath);
50544
+ }
50214
50545
  function parseStoreName(value) {
50215
50546
  return value === "claude" || value === "opencode" ? value : null;
50216
50547
  }
@@ -50326,6 +50657,24 @@ async function commandSessionDbClassify(args, config, deps) {
50326
50657
  log(describeSessionDbClassification(outcome, { bucket: config.bucket, region: config.region }));
50327
50658
  return sessionDbExitCode(outcome);
50328
50659
  }
50660
+ async function commandSessionDbVerify(litestreamConfigPath, config, deps) {
50661
+ const { fileOps, log } = deps;
50662
+ const litestream = (deps.litestreamFor ?? litestreamCliFor)(
50663
+ litestreamConfigPath,
50664
+ config.opencodeDbPath
50665
+ );
50666
+ const outcome = await verifySessionDb({
50667
+ config: { opencodeDbPath: config.opencodeDbPath },
50668
+ fileOps,
50669
+ sqlite: (deps.sqliteIntegrityFor ?? nodeSqliteIntegrityFor)(),
50670
+ litestream,
50671
+ log,
50672
+ maxPoints: config.walkbackMaxPoints,
50673
+ budgetSeconds: config.walkbackBudgetSeconds
50674
+ });
50675
+ log(describeSessionDbVerification(outcome));
50676
+ return sessionDbVerifyExitCode(outcome);
50677
+ }
50329
50678
  async function main(argv, deps) {
50330
50679
  const { env: env3, fileOps, log, out } = deps;
50331
50680
  const [command12, ...rest] = argv;
@@ -50372,6 +50721,14 @@ ${USAGE}`
50372
50721
  }
50373
50722
  return commandSessionDbClassify(args, config, deps);
50374
50723
  }
50724
+ if (command12 === "session-db-verify") {
50725
+ if (rest.length !== 1) {
50726
+ log(`'session-db-verify' needs exactly one argument: the litestream config path.
50727
+ ${USAGE}`);
50728
+ return EXIT_USAGE;
50729
+ }
50730
+ return commandSessionDbVerify(rest[0], config, deps);
50731
+ }
50375
50732
  const name = parseStoreName(rest[0]);
50376
50733
  if (name === null) {
50377
50734
  log(`'${command12}' needs a store name: claude or opencode.
@@ -50389,7 +50746,7 @@ function isEntryPoint() {
50389
50746
  const entry = process.argv[1];
50390
50747
  if (entry === void 0) return false;
50391
50748
  try {
50392
- return realpathSync(entry) === realpathSync(fileURLToPath2(import.meta.url));
50749
+ return realpathSync(entry) === realpathSync(fileURLToPath(import.meta.url));
50393
50750
  } catch {
50394
50751
  return false;
50395
50752
  }
@@ -50414,6 +50771,7 @@ export {
50414
50771
  EXIT_SESSION_DB_FATAL,
50415
50772
  EXIT_SESSION_DB_RETRY,
50416
50773
  EXIT_SESSION_DB_UNUSABLE,
50774
+ EXIT_SESSION_DB_UNVERIFIABLE,
50417
50775
  EXIT_USAGE,
50418
50776
  main
50419
50777
  };