deepline 0.3.49 → 0.3.51

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 (31) hide show
  1. package/dist/bundling-sources/sdk/src/index.ts +1 -0
  2. package/dist/bundling-sources/sdk/src/play.ts +1 -0
  3. package/dist/bundling-sources/sdk/src/release.ts +1 -1
  4. package/dist/bundling-sources/sdk/src/types.ts +2 -0
  5. package/dist/bundling-sources/shared_libs/play-runtime/app-runtime-api.ts +1 -0
  6. package/dist/bundling-sources/shared_libs/play-runtime/context.ts +106 -89
  7. package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +0 -2
  8. package/dist/bundling-sources/shared_libs/play-runtime/durable-receipt-execution.ts +52 -21
  9. package/dist/bundling-sources/shared_libs/play-runtime/governor/governor.ts +45 -5
  10. package/dist/bundling-sources/shared_libs/play-runtime/governor/policy.ts +11 -3
  11. package/dist/bundling-sources/shared_libs/play-runtime/protocol.ts +0 -2
  12. package/dist/bundling-sources/shared_libs/play-runtime/resource-governor.ts +11 -0
  13. package/dist/bundling-sources/shared_libs/play-runtime/secret-capability.ts +5 -1
  14. package/dist/bundling-sources/shared_libs/play-runtime/test-runtime-seams.ts +1 -14
  15. package/dist/bundling-sources/shared_libs/play-runtime/tool-call/contract.ts +17 -7
  16. package/dist/bundling-sources/shared_libs/play-runtime/tool-call/index.ts +0 -1
  17. package/dist/bundling-sources/shared_libs/plays/authoring-contract.ts +112 -5
  18. package/dist/bundling-sources/shared_libs/security/safe-fetch.ts +6 -1
  19. package/dist/cli/index.js +837 -3147
  20. package/dist/cli/index.mjs +704 -3010
  21. package/dist/{compiler-manifest-CbzdZrJj.d.mts → compiler-manifest-B47AA7As.d.mts} +46 -4
  22. package/dist/{compiler-manifest-CbzdZrJj.d.ts → compiler-manifest-B47AA7As.d.ts} +46 -4
  23. package/dist/index.d.mts +151 -149
  24. package/dist/index.d.ts +151 -149
  25. package/dist/index.js +1515 -117
  26. package/dist/index.mjs +1514 -117
  27. package/dist/install-integrity.json +2 -2
  28. package/dist/plays/bundle-play-file.d.mts +2 -2
  29. package/dist/plays/bundle-play-file.d.ts +2 -2
  30. package/dist/plays/bundle-play-file.mjs +5 -2614
  31. package/package.json +2 -1
@@ -1,9 +1,4 @@
1
1
  #!/usr/bin/env node
2
- var __defProp = Object.defineProperty;
3
- var __export = (target, all) => {
4
- for (var name in all)
5
- __defProp(target, name, { get: all[name], enumerable: true });
6
- };
7
2
 
8
3
  // src/cli/proxy-env.ts
9
4
  import { Agent, Dispatcher, ProxyAgent, setGlobalDispatcher } from "undici";
@@ -164,7 +159,7 @@ configureProxyFromEnv();
164
159
 
165
160
  // src/cli/index.ts
166
161
  import { mkdtemp as mkdtemp2, rm as rm2, writeFile as writeFile6 } from "fs/promises";
167
- import { join as join22 } from "path";
162
+ import { join as join23 } from "path";
168
163
  import { tmpdir as tmpdir6 } from "os";
169
164
  import { Command as Command4 } from "commander";
170
165
 
@@ -1065,7 +1060,7 @@ var SDK_RELEASE = {
1065
1060
  // available at toolResponse.rawV2 while toolResponse.raw and all declared
1066
1061
  // getters keep their established compatibility behavior.
1067
1062
  // 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
1068
- version: "0.3.49",
1063
+ version: "0.3.51",
1069
1064
  updateSummary: "Automatic CLI updates are now enabled by default. To opt out, run `deepline settings autoupdate off`; use `deepline settings autoupdate on` to re-enable updates or `deepline settings autoupdate pin <version>` to hold an exact release. This release also adds raw-v2 tool responses at toolResponse.rawV2 while preserving existing toolResponse.raw and declared getters.",
1070
1065
  packageCapabilities: {
1071
1066
  updatePreferences: 1
@@ -2202,7 +2197,7 @@ function decodeSseFrame(frame) {
2202
2197
  return parsed;
2203
2198
  }
2204
2199
  function sleep(ms) {
2205
- return new Promise((resolve19) => setTimeout(resolve19, ms));
2200
+ return new Promise((resolve20) => setTimeout(resolve20, ms));
2206
2201
  }
2207
2202
  function withCoworkNetworkHint(message) {
2208
2203
  if (!isCoworkLikeSandbox2() || message.includes(COWORK_NETWORK_HINT)) {
@@ -3967,14 +3962,14 @@ async function* observeRunEvents(options) {
3967
3962
  try {
3968
3963
  for (; ; ) {
3969
3964
  if (queue.length === 0) {
3970
- const waitForItem = new Promise((resolve19) => {
3971
- wake = resolve19;
3965
+ const waitForItem = new Promise((resolve20) => {
3966
+ wake = resolve20;
3972
3967
  });
3973
3968
  if (!sawFirstSnapshot) {
3974
3969
  const timedOut = await Promise.race([
3975
3970
  waitForItem.then(() => false),
3976
3971
  new Promise(
3977
- (resolve19) => setTimeout(() => resolve19(true), OBSERVE_BOOTSTRAP_TIMEOUT_MS)
3972
+ (resolve20) => setTimeout(() => resolve20(true), OBSERVE_BOOTSTRAP_TIMEOUT_MS)
3978
3973
  )
3979
3974
  ]);
3980
3975
  if (timedOut && queue.length === 0) {
@@ -4333,7 +4328,7 @@ function parseEnvTestPolicyOverrides() {
4333
4328
  return normalizeTestPolicyOverrides(parsed, "DEEPLINE_TEST_POLICY_OVERRIDES");
4334
4329
  }
4335
4330
  function sleep2(ms) {
4336
- return new Promise((resolve19) => setTimeout(resolve19, ms));
4331
+ return new Promise((resolve20) => setTimeout(resolve20, ms));
4337
4332
  }
4338
4333
  function isTransientCompileManifestError(error) {
4339
4334
  if (error instanceof DeeplineError && typeof error.statusCode === "number") {
@@ -7752,6 +7747,10 @@ function flattenObjectColumns(row, options = {}) {
7752
7747
  }
7753
7748
  if (value && typeof value === "object" && !Array.isArray(value)) {
7754
7749
  const record = value;
7750
+ if (options.objectColumns === "json") {
7751
+ flattened[key] = csvSafeJsonString(record);
7752
+ continue;
7753
+ }
7755
7754
  const hasMatchedEnvelope = Object.prototype.hasOwnProperty.call(record, "matched_result") || Object.prototype.hasOwnProperty.call(record, "matchedResult");
7756
7755
  if (hasMatchedEnvelope) {
7757
7756
  flattened[key] = csvSafeJsonString(record);
@@ -8076,6 +8075,8 @@ async function httpJson(method, url, apiKey, body) {
8076
8075
  "X-Deepline-API-Contract": SDK_API_CONTRACT
8077
8076
  };
8078
8077
  if (apiKey) headers["Authorization"] = `Bearer ${apiKey}`;
8078
+ const bypassToken = process.env.VERCEL_PROTECTION_BYPASS_TOKEN?.trim();
8079
+ if (bypassToken) headers["x-vercel-protection-bypass"] = bypassToken;
8079
8080
  let response = null;
8080
8081
  let lastError = null;
8081
8082
  for (const candidateUrl of buildCandidateUrls2(url)) {
@@ -8142,7 +8143,7 @@ function buildCandidateUrls2(url) {
8142
8143
  }
8143
8144
  }
8144
8145
  function sleep4(ms) {
8145
- return new Promise((resolve19) => setTimeout(resolve19, ms));
8146
+ return new Promise((resolve20) => setTimeout(resolve20, ms));
8146
8147
  }
8147
8148
  function printDeeplineLogo() {
8148
8149
  if (process.stdout.isTTY && (process.stdout.columns ?? 80) >= 70) {
@@ -10113,10 +10114,6 @@ import {
10113
10114
  import { homedir as homedir5 } from "os";
10114
10115
  import { join as join6, resolve as resolve5 } from "path";
10115
10116
 
10116
- // src/cli/dataset-stats.ts
10117
- import { writeFileSync as writeFileSync6 } from "fs";
10118
- import { resolve as resolve4 } from "path";
10119
-
10120
10117
  // ../plays/dataset-summary.ts
10121
10118
  function formatDatasetRowCountsLine(counts) {
10122
10119
  const { persisted, succeeded, failed } = counts;
@@ -10170,6 +10167,103 @@ function formatDatasetExecutionStats(raw, _persistedRowTotal) {
10170
10167
  return stats;
10171
10168
  }
10172
10169
 
10170
+ // src/cli/run-dataset-csv.ts
10171
+ import { writeFileSync as writeFileSync6 } from "fs";
10172
+ import { resolve as resolve4 } from "path";
10173
+ var RunDatasetCsv = class _RunDatasetCsv {
10174
+ #projection;
10175
+ constructor(input2) {
10176
+ const rows = input2.rows.map(projectRunDatasetRow);
10177
+ this.#projection = {
10178
+ rows,
10179
+ columns: runDatasetCsvColumns(rows, input2.columns)
10180
+ };
10181
+ }
10182
+ static from(input2) {
10183
+ return new _RunDatasetCsv(input2);
10184
+ }
10185
+ projection() {
10186
+ return this.#projection;
10187
+ }
10188
+ write(outPath) {
10189
+ const absolutePath = resolve4(outPath);
10190
+ writeFileSync6(
10191
+ absolutePath,
10192
+ csvStringFromRows(this.#projection.rows, this.#projection.columns),
10193
+ "utf-8"
10194
+ );
10195
+ return absolutePath;
10196
+ }
10197
+ };
10198
+ function writeRunDatasetCsv(input2) {
10199
+ return RunDatasetCsv.from(input2).write(input2.outPath);
10200
+ }
10201
+ function projectRunDatasetRow(row) {
10202
+ return Object.fromEntries(
10203
+ Object.entries(row).map(([column, value]) => [
10204
+ column,
10205
+ projectRunDatasetCell(value)
10206
+ ])
10207
+ );
10208
+ }
10209
+ function projectRunDatasetCell(value) {
10210
+ const logicalValue = parseSerializedDatasetValue(value);
10211
+ if (logicalValue === null || logicalValue === void 0) return logicalValue;
10212
+ if (typeof logicalValue === "object") {
10213
+ return csvSafeJsonString(canonicalDatasetJson(logicalValue));
10214
+ }
10215
+ return logicalValue;
10216
+ }
10217
+ function canonicalDatasetJson(value) {
10218
+ return canonicalDatasetJsonValue(value, /* @__PURE__ */ new WeakSet());
10219
+ }
10220
+ function canonicalDatasetJsonValue(value, ancestors) {
10221
+ if (Array.isArray(value)) {
10222
+ if (ancestors.has(value)) return value;
10223
+ ancestors.add(value);
10224
+ const normalized2 = value.map(
10225
+ (item) => canonicalDatasetJsonValue(item, ancestors)
10226
+ );
10227
+ ancestors.delete(value);
10228
+ return normalized2;
10229
+ }
10230
+ if (!value || typeof value !== "object" || value instanceof Date) {
10231
+ return value;
10232
+ }
10233
+ if (ancestors.has(value)) return value;
10234
+ ancestors.add(value);
10235
+ const record = value;
10236
+ const normalized = Object.fromEntries(
10237
+ Object.keys(record).sort((left, right) => left.localeCompare(right)).map((key) => [key, canonicalDatasetJsonValue(record[key], ancestors)])
10238
+ );
10239
+ ancestors.delete(value);
10240
+ return normalized;
10241
+ }
10242
+ function parseSerializedDatasetValue(value) {
10243
+ if (typeof value !== "string") return value;
10244
+ const text = value.trim();
10245
+ if (!text || !["{", "["].includes(text[0] ?? "")) return value;
10246
+ try {
10247
+ return JSON.parse(text);
10248
+ } catch {
10249
+ return value;
10250
+ }
10251
+ }
10252
+ function runDatasetCsvColumns(rows, declaredColumns) {
10253
+ const columns = [];
10254
+ const seen = /* @__PURE__ */ new Set();
10255
+ const add = (column) => {
10256
+ if (!column || seen.has(column)) return;
10257
+ seen.add(column);
10258
+ columns.push(column);
10259
+ };
10260
+ for (const column of declaredColumns) add(column);
10261
+ for (const row of rows) {
10262
+ for (const column of Object.keys(row)) add(column);
10263
+ }
10264
+ return columns;
10265
+ }
10266
+
10173
10267
  // src/cli/dataset-stats.ts
10174
10268
  function mergeCanonicalRowsInfo(left, right) {
10175
10269
  const preferred = right.rows.length > left.rows.length || right.complete && !left.complete && right.rows.length === left.rows.length ? right : left;
@@ -10587,6 +10681,11 @@ function collectSerializedDatasetRowsInfos(statusOrResult) {
10587
10681
  }
10588
10682
  return infos;
10589
10683
  }
10684
+ var LegacyRunDatasetCatalogAdapter = class {
10685
+ static datasets(statusOrResult) {
10686
+ return collectSerializedDatasetRowsInfos(statusOrResult);
10687
+ }
10688
+ };
10590
10689
  function extractCanonicalRowsInfo(statusOrResult) {
10591
10690
  return collectCanonicalRowsInfos(statusOrResult)[0] ?? null;
10592
10691
  }
@@ -10756,22 +10855,6 @@ function buildDatasetStats(rows, totalRows = rows.length, columns = inferColumns
10756
10855
  columnStats
10757
10856
  };
10758
10857
  }
10759
- function writeCanonicalRowsCsv(rowsInfo, outPath) {
10760
- if (!rowsInfo.complete) {
10761
- throw new Error(
10762
- `Run output only includes ${rowsInfo.rows.length} preview row(s) of ${rowsInfo.totalRows}; cannot export a complete CSV from this status payload yet.`
10763
- );
10764
- }
10765
- const sanitized = sanitizeCsvProjectionInfo({
10766
- rows: rowsInfo.rows,
10767
- columns: rowsInfo.columns
10768
- });
10769
- const rows = dataExportRows(sanitized.rows);
10770
- const columns = dataExportColumns(rows, sanitized.columns);
10771
- const resolved = resolve4(outPath);
10772
- writeFileSync6(resolved, csvStringFromRows(rows, columns), "utf-8");
10773
- return resolved;
10774
- }
10775
10858
 
10776
10859
  // src/cli/commands/csv.ts
10777
10860
  function parseRowRange(raw) {
@@ -13441,2613 +13524,9 @@ import {
13441
13524
  transformSync
13442
13525
  } from "esbuild";
13443
13526
 
13444
- // ../../node_modules/@sinclair/typebox/build/esm/type/guard/value.mjs
13445
- var value_exports = {};
13446
- __export(value_exports, {
13447
- HasPropertyKey: () => HasPropertyKey,
13448
- IsArray: () => IsArray,
13449
- IsAsyncIterator: () => IsAsyncIterator,
13450
- IsBigInt: () => IsBigInt,
13451
- IsBoolean: () => IsBoolean,
13452
- IsDate: () => IsDate,
13453
- IsFunction: () => IsFunction,
13454
- IsIterator: () => IsIterator,
13455
- IsNull: () => IsNull,
13456
- IsNumber: () => IsNumber,
13457
- IsObject: () => IsObject,
13458
- IsRegExp: () => IsRegExp,
13459
- IsString: () => IsString,
13460
- IsSymbol: () => IsSymbol,
13461
- IsUint8Array: () => IsUint8Array,
13462
- IsUndefined: () => IsUndefined
13463
- });
13464
- function HasPropertyKey(value, key) {
13465
- return key in value;
13466
- }
13467
- function IsAsyncIterator(value) {
13468
- return IsObject(value) && !IsArray(value) && !IsUint8Array(value) && Symbol.asyncIterator in value;
13469
- }
13470
- function IsArray(value) {
13471
- return Array.isArray(value);
13472
- }
13473
- function IsBigInt(value) {
13474
- return typeof value === "bigint";
13475
- }
13476
- function IsBoolean(value) {
13477
- return typeof value === "boolean";
13478
- }
13479
- function IsDate(value) {
13480
- return value instanceof globalThis.Date;
13481
- }
13482
- function IsFunction(value) {
13483
- return typeof value === "function";
13484
- }
13485
- function IsIterator(value) {
13486
- return IsObject(value) && !IsArray(value) && !IsUint8Array(value) && Symbol.iterator in value;
13487
- }
13488
- function IsNull(value) {
13489
- return value === null;
13490
- }
13491
- function IsNumber(value) {
13492
- return typeof value === "number";
13493
- }
13494
- function IsObject(value) {
13495
- return typeof value === "object" && value !== null;
13496
- }
13497
- function IsRegExp(value) {
13498
- return value instanceof globalThis.RegExp;
13499
- }
13500
- function IsString(value) {
13501
- return typeof value === "string";
13502
- }
13503
- function IsSymbol(value) {
13504
- return typeof value === "symbol";
13505
- }
13506
- function IsUint8Array(value) {
13507
- return value instanceof globalThis.Uint8Array;
13508
- }
13509
- function IsUndefined(value) {
13510
- return value === void 0;
13511
- }
13512
-
13513
- // ../../node_modules/@sinclair/typebox/build/esm/type/clone/value.mjs
13514
- function ArrayType(value) {
13515
- return value.map((value2) => Visit(value2));
13516
- }
13517
- function DateType(value) {
13518
- return new Date(value.getTime());
13519
- }
13520
- function Uint8ArrayType(value) {
13521
- return new Uint8Array(value);
13522
- }
13523
- function RegExpType(value) {
13524
- return new RegExp(value.source, value.flags);
13525
- }
13526
- function ObjectType(value) {
13527
- const result = {};
13528
- for (const key of Object.getOwnPropertyNames(value)) {
13529
- result[key] = Visit(value[key]);
13530
- }
13531
- for (const key of Object.getOwnPropertySymbols(value)) {
13532
- result[key] = Visit(value[key]);
13533
- }
13534
- return result;
13535
- }
13536
- function Visit(value) {
13537
- return IsArray(value) ? ArrayType(value) : IsDate(value) ? DateType(value) : IsUint8Array(value) ? Uint8ArrayType(value) : IsRegExp(value) ? RegExpType(value) : IsObject(value) ? ObjectType(value) : value;
13538
- }
13539
- function Clone(value) {
13540
- return Visit(value);
13541
- }
13542
-
13543
- // ../../node_modules/@sinclair/typebox/build/esm/type/clone/type.mjs
13544
- function CloneType(schema, options) {
13545
- return options === void 0 ? Clone(schema) : Clone({ ...options, ...schema });
13546
- }
13547
-
13548
- // ../../node_modules/@sinclair/typebox/build/esm/value/guard/guard.mjs
13549
- function IsObject2(value) {
13550
- return value !== null && typeof value === "object";
13551
- }
13552
- function IsArray2(value) {
13553
- return globalThis.Array.isArray(value) && !globalThis.ArrayBuffer.isView(value);
13554
- }
13555
- function IsUndefined2(value) {
13556
- return value === void 0;
13557
- }
13558
- function IsNumber2(value) {
13559
- return typeof value === "number";
13560
- }
13561
-
13562
- // ../../node_modules/@sinclair/typebox/build/esm/system/policy.mjs
13563
- var TypeSystemPolicy;
13564
- (function(TypeSystemPolicy2) {
13565
- TypeSystemPolicy2.InstanceMode = "default";
13566
- TypeSystemPolicy2.ExactOptionalPropertyTypes = false;
13567
- TypeSystemPolicy2.AllowArrayObject = false;
13568
- TypeSystemPolicy2.AllowNaN = false;
13569
- TypeSystemPolicy2.AllowNullVoid = false;
13570
- function IsExactOptionalProperty(value, key) {
13571
- return TypeSystemPolicy2.ExactOptionalPropertyTypes ? key in value : value[key] !== void 0;
13572
- }
13573
- TypeSystemPolicy2.IsExactOptionalProperty = IsExactOptionalProperty;
13574
- function IsObjectLike(value) {
13575
- const isObject = IsObject2(value);
13576
- return TypeSystemPolicy2.AllowArrayObject ? isObject : isObject && !IsArray2(value);
13577
- }
13578
- TypeSystemPolicy2.IsObjectLike = IsObjectLike;
13579
- function IsRecordLike(value) {
13580
- return IsObjectLike(value) && !(value instanceof Date) && !(value instanceof Uint8Array);
13581
- }
13582
- TypeSystemPolicy2.IsRecordLike = IsRecordLike;
13583
- function IsNumberLike(value) {
13584
- return TypeSystemPolicy2.AllowNaN ? IsNumber2(value) : Number.isFinite(value);
13585
- }
13586
- TypeSystemPolicy2.IsNumberLike = IsNumberLike;
13587
- function IsVoidLike(value) {
13588
- const isUndefined = IsUndefined2(value);
13589
- return TypeSystemPolicy2.AllowNullVoid ? isUndefined || value === null : isUndefined;
13590
- }
13591
- TypeSystemPolicy2.IsVoidLike = IsVoidLike;
13592
- })(TypeSystemPolicy || (TypeSystemPolicy = {}));
13593
-
13594
- // ../../node_modules/@sinclair/typebox/build/esm/type/create/immutable.mjs
13595
- function ImmutableArray(value) {
13596
- return globalThis.Object.freeze(value).map((value2) => Immutable(value2));
13597
- }
13598
- function ImmutableDate(value) {
13599
- return value;
13600
- }
13601
- function ImmutableUint8Array(value) {
13602
- return value;
13603
- }
13604
- function ImmutableRegExp(value) {
13605
- return value;
13606
- }
13607
- function ImmutableObject(value) {
13608
- const result = {};
13609
- for (const key of Object.getOwnPropertyNames(value)) {
13610
- result[key] = Immutable(value[key]);
13611
- }
13612
- for (const key of Object.getOwnPropertySymbols(value)) {
13613
- result[key] = Immutable(value[key]);
13614
- }
13615
- return globalThis.Object.freeze(result);
13616
- }
13617
- function Immutable(value) {
13618
- return IsArray(value) ? ImmutableArray(value) : IsDate(value) ? ImmutableDate(value) : IsUint8Array(value) ? ImmutableUint8Array(value) : IsRegExp(value) ? ImmutableRegExp(value) : IsObject(value) ? ImmutableObject(value) : value;
13619
- }
13620
-
13621
- // ../../node_modules/@sinclair/typebox/build/esm/type/create/type.mjs
13622
- function CreateType(schema, options) {
13623
- const result = options !== void 0 ? { ...options, ...schema } : schema;
13624
- switch (TypeSystemPolicy.InstanceMode) {
13625
- case "freeze":
13626
- return Immutable(result);
13627
- case "clone":
13628
- return Clone(result);
13629
- default:
13630
- return result;
13631
- }
13632
- }
13633
-
13634
- // ../../node_modules/@sinclair/typebox/build/esm/type/error/error.mjs
13635
- var TypeBoxError = class extends Error {
13636
- constructor(message) {
13637
- super(message);
13638
- }
13639
- };
13640
-
13641
- // ../../node_modules/@sinclair/typebox/build/esm/type/symbols/symbols.mjs
13642
- var TransformKind = Symbol.for("TypeBox.Transform");
13643
- var ReadonlyKind = Symbol.for("TypeBox.Readonly");
13644
- var OptionalKind = Symbol.for("TypeBox.Optional");
13645
- var Hint = Symbol.for("TypeBox.Hint");
13646
- var Kind = Symbol.for("TypeBox.Kind");
13647
-
13648
- // ../../node_modules/@sinclair/typebox/build/esm/type/guard/kind.mjs
13649
- function IsReadonly(value) {
13650
- return IsObject(value) && value[ReadonlyKind] === "Readonly";
13651
- }
13652
- function IsOptional(value) {
13653
- return IsObject(value) && value[OptionalKind] === "Optional";
13654
- }
13655
- function IsAny(value) {
13656
- return IsKindOf(value, "Any");
13657
- }
13658
- function IsArgument(value) {
13659
- return IsKindOf(value, "Argument");
13660
- }
13661
- function IsArray3(value) {
13662
- return IsKindOf(value, "Array");
13663
- }
13664
- function IsAsyncIterator2(value) {
13665
- return IsKindOf(value, "AsyncIterator");
13666
- }
13667
- function IsBigInt2(value) {
13668
- return IsKindOf(value, "BigInt");
13669
- }
13670
- function IsBoolean2(value) {
13671
- return IsKindOf(value, "Boolean");
13672
- }
13673
- function IsComputed(value) {
13674
- return IsKindOf(value, "Computed");
13675
- }
13676
- function IsConstructor(value) {
13677
- return IsKindOf(value, "Constructor");
13678
- }
13679
- function IsDate2(value) {
13680
- return IsKindOf(value, "Date");
13681
- }
13682
- function IsFunction2(value) {
13683
- return IsKindOf(value, "Function");
13684
- }
13685
- function IsInteger(value) {
13686
- return IsKindOf(value, "Integer");
13687
- }
13688
- function IsIntersect(value) {
13689
- return IsKindOf(value, "Intersect");
13690
- }
13691
- function IsIterator2(value) {
13692
- return IsKindOf(value, "Iterator");
13693
- }
13694
- function IsKindOf(value, kind) {
13695
- return IsObject(value) && Kind in value && value[Kind] === kind;
13696
- }
13697
- function IsLiteralValue(value) {
13698
- return IsBoolean(value) || IsNumber(value) || IsString(value);
13699
- }
13700
- function IsLiteral(value) {
13701
- return IsKindOf(value, "Literal");
13702
- }
13703
- function IsMappedKey(value) {
13704
- return IsKindOf(value, "MappedKey");
13705
- }
13706
- function IsMappedResult(value) {
13707
- return IsKindOf(value, "MappedResult");
13708
- }
13709
- function IsNever(value) {
13710
- return IsKindOf(value, "Never");
13711
- }
13712
- function IsNot(value) {
13713
- return IsKindOf(value, "Not");
13714
- }
13715
- function IsNull2(value) {
13716
- return IsKindOf(value, "Null");
13717
- }
13718
- function IsNumber3(value) {
13719
- return IsKindOf(value, "Number");
13720
- }
13721
- function IsObject3(value) {
13722
- return IsKindOf(value, "Object");
13723
- }
13724
- function IsPromise(value) {
13725
- return IsKindOf(value, "Promise");
13726
- }
13727
- function IsRecord(value) {
13728
- return IsKindOf(value, "Record");
13729
- }
13730
- function IsRef(value) {
13731
- return IsKindOf(value, "Ref");
13732
- }
13733
- function IsRegExp2(value) {
13734
- return IsKindOf(value, "RegExp");
13735
- }
13736
- function IsString2(value) {
13737
- return IsKindOf(value, "String");
13738
- }
13739
- function IsSymbol2(value) {
13740
- return IsKindOf(value, "Symbol");
13741
- }
13742
- function IsTemplateLiteral(value) {
13743
- return IsKindOf(value, "TemplateLiteral");
13744
- }
13745
- function IsThis(value) {
13746
- return IsKindOf(value, "This");
13747
- }
13748
- function IsTransform(value) {
13749
- return IsObject(value) && TransformKind in value;
13750
- }
13751
- function IsTuple(value) {
13752
- return IsKindOf(value, "Tuple");
13753
- }
13754
- function IsUndefined3(value) {
13755
- return IsKindOf(value, "Undefined");
13756
- }
13757
- function IsUnion(value) {
13758
- return IsKindOf(value, "Union");
13759
- }
13760
- function IsUint8Array2(value) {
13761
- return IsKindOf(value, "Uint8Array");
13762
- }
13763
- function IsUnknown(value) {
13764
- return IsKindOf(value, "Unknown");
13765
- }
13766
- function IsUnsafe(value) {
13767
- return IsKindOf(value, "Unsafe");
13768
- }
13769
- function IsVoid(value) {
13770
- return IsKindOf(value, "Void");
13771
- }
13772
- function IsKind(value) {
13773
- return IsObject(value) && Kind in value && IsString(value[Kind]);
13774
- }
13775
- function IsSchema(value) {
13776
- return IsAny(value) || IsArgument(value) || IsArray3(value) || IsBoolean2(value) || IsBigInt2(value) || IsAsyncIterator2(value) || IsComputed(value) || IsConstructor(value) || IsDate2(value) || IsFunction2(value) || IsInteger(value) || IsIntersect(value) || IsIterator2(value) || IsLiteral(value) || IsMappedKey(value) || IsMappedResult(value) || IsNever(value) || IsNot(value) || IsNull2(value) || IsNumber3(value) || IsObject3(value) || IsPromise(value) || IsRecord(value) || IsRef(value) || IsRegExp2(value) || IsString2(value) || IsSymbol2(value) || IsTemplateLiteral(value) || IsThis(value) || IsTuple(value) || IsUndefined3(value) || IsUnion(value) || IsUint8Array2(value) || IsUnknown(value) || IsUnsafe(value) || IsVoid(value) || IsKind(value);
13777
- }
13778
-
13779
- // ../../node_modules/@sinclair/typebox/build/esm/type/guard/type.mjs
13780
- var type_exports = {};
13781
- __export(type_exports, {
13782
- IsAny: () => IsAny2,
13783
- IsArgument: () => IsArgument2,
13784
- IsArray: () => IsArray4,
13785
- IsAsyncIterator: () => IsAsyncIterator3,
13786
- IsBigInt: () => IsBigInt3,
13787
- IsBoolean: () => IsBoolean3,
13788
- IsComputed: () => IsComputed2,
13789
- IsConstructor: () => IsConstructor2,
13790
- IsDate: () => IsDate3,
13791
- IsFunction: () => IsFunction3,
13792
- IsImport: () => IsImport,
13793
- IsInteger: () => IsInteger2,
13794
- IsIntersect: () => IsIntersect2,
13795
- IsIterator: () => IsIterator3,
13796
- IsKind: () => IsKind2,
13797
- IsKindOf: () => IsKindOf2,
13798
- IsLiteral: () => IsLiteral2,
13799
- IsLiteralBoolean: () => IsLiteralBoolean,
13800
- IsLiteralNumber: () => IsLiteralNumber,
13801
- IsLiteralString: () => IsLiteralString,
13802
- IsLiteralValue: () => IsLiteralValue2,
13803
- IsMappedKey: () => IsMappedKey2,
13804
- IsMappedResult: () => IsMappedResult2,
13805
- IsNever: () => IsNever2,
13806
- IsNot: () => IsNot2,
13807
- IsNull: () => IsNull3,
13808
- IsNumber: () => IsNumber4,
13809
- IsObject: () => IsObject4,
13810
- IsOptional: () => IsOptional2,
13811
- IsPromise: () => IsPromise2,
13812
- IsProperties: () => IsProperties,
13813
- IsReadonly: () => IsReadonly2,
13814
- IsRecord: () => IsRecord2,
13815
- IsRecursive: () => IsRecursive,
13816
- IsRef: () => IsRef2,
13817
- IsRegExp: () => IsRegExp3,
13818
- IsSchema: () => IsSchema2,
13819
- IsString: () => IsString3,
13820
- IsSymbol: () => IsSymbol3,
13821
- IsTemplateLiteral: () => IsTemplateLiteral2,
13822
- IsThis: () => IsThis2,
13823
- IsTransform: () => IsTransform2,
13824
- IsTuple: () => IsTuple2,
13825
- IsUint8Array: () => IsUint8Array3,
13826
- IsUndefined: () => IsUndefined4,
13827
- IsUnion: () => IsUnion2,
13828
- IsUnionLiteral: () => IsUnionLiteral,
13829
- IsUnknown: () => IsUnknown2,
13830
- IsUnsafe: () => IsUnsafe2,
13831
- IsVoid: () => IsVoid2,
13832
- TypeGuardUnknownTypeError: () => TypeGuardUnknownTypeError
13833
- });
13834
- var TypeGuardUnknownTypeError = class extends TypeBoxError {
13835
- };
13836
- var KnownTypes = [
13837
- "Argument",
13838
- "Any",
13839
- "Array",
13840
- "AsyncIterator",
13841
- "BigInt",
13842
- "Boolean",
13843
- "Computed",
13844
- "Constructor",
13845
- "Date",
13846
- "Enum",
13847
- "Function",
13848
- "Integer",
13849
- "Intersect",
13850
- "Iterator",
13851
- "Literal",
13852
- "MappedKey",
13853
- "MappedResult",
13854
- "Not",
13855
- "Null",
13856
- "Number",
13857
- "Object",
13858
- "Promise",
13859
- "Record",
13860
- "Ref",
13861
- "RegExp",
13862
- "String",
13863
- "Symbol",
13864
- "TemplateLiteral",
13865
- "This",
13866
- "Tuple",
13867
- "Undefined",
13868
- "Union",
13869
- "Uint8Array",
13870
- "Unknown",
13871
- "Void"
13872
- ];
13873
- function IsPattern(value) {
13874
- try {
13875
- new RegExp(value);
13876
- return true;
13877
- } catch {
13878
- return false;
13879
- }
13880
- }
13881
- function IsControlCharacterFree(value) {
13882
- if (!IsString(value))
13883
- return false;
13884
- for (let i = 0; i < value.length; i++) {
13885
- const code = value.charCodeAt(i);
13886
- if (code >= 7 && code <= 13 || code === 27 || code === 127) {
13887
- return false;
13888
- }
13889
- }
13890
- return true;
13891
- }
13892
- function IsAdditionalProperties(value) {
13893
- return IsOptionalBoolean(value) || IsSchema2(value);
13894
- }
13895
- function IsOptionalBigInt(value) {
13896
- return IsUndefined(value) || IsBigInt(value);
13897
- }
13898
- function IsOptionalNumber(value) {
13899
- return IsUndefined(value) || IsNumber(value);
13900
- }
13901
- function IsOptionalBoolean(value) {
13902
- return IsUndefined(value) || IsBoolean(value);
13903
- }
13904
- function IsOptionalString(value) {
13905
- return IsUndefined(value) || IsString(value);
13906
- }
13907
- function IsOptionalPattern(value) {
13908
- return IsUndefined(value) || IsString(value) && IsControlCharacterFree(value) && IsPattern(value);
13909
- }
13910
- function IsOptionalFormat(value) {
13911
- return IsUndefined(value) || IsString(value) && IsControlCharacterFree(value);
13912
- }
13913
- function IsOptionalSchema(value) {
13914
- return IsUndefined(value) || IsSchema2(value);
13915
- }
13916
- function IsReadonly2(value) {
13917
- return IsObject(value) && value[ReadonlyKind] === "Readonly";
13918
- }
13919
- function IsOptional2(value) {
13920
- return IsObject(value) && value[OptionalKind] === "Optional";
13921
- }
13922
- function IsAny2(value) {
13923
- return IsKindOf2(value, "Any") && IsOptionalString(value.$id);
13924
- }
13925
- function IsArgument2(value) {
13926
- return IsKindOf2(value, "Argument") && IsNumber(value.index);
13927
- }
13928
- function IsArray4(value) {
13929
- return IsKindOf2(value, "Array") && value.type === "array" && IsOptionalString(value.$id) && IsSchema2(value.items) && IsOptionalNumber(value.minItems) && IsOptionalNumber(value.maxItems) && IsOptionalBoolean(value.uniqueItems) && IsOptionalSchema(value.contains) && IsOptionalNumber(value.minContains) && IsOptionalNumber(value.maxContains);
13930
- }
13931
- function IsAsyncIterator3(value) {
13932
- return IsKindOf2(value, "AsyncIterator") && value.type === "AsyncIterator" && IsOptionalString(value.$id) && IsSchema2(value.items);
13933
- }
13934
- function IsBigInt3(value) {
13935
- return IsKindOf2(value, "BigInt") && value.type === "bigint" && IsOptionalString(value.$id) && IsOptionalBigInt(value.exclusiveMaximum) && IsOptionalBigInt(value.exclusiveMinimum) && IsOptionalBigInt(value.maximum) && IsOptionalBigInt(value.minimum) && IsOptionalBigInt(value.multipleOf);
13936
- }
13937
- function IsBoolean3(value) {
13938
- return IsKindOf2(value, "Boolean") && value.type === "boolean" && IsOptionalString(value.$id);
13939
- }
13940
- function IsComputed2(value) {
13941
- return IsKindOf2(value, "Computed") && IsString(value.target) && IsArray(value.parameters) && value.parameters.every((schema) => IsSchema2(schema));
13942
- }
13943
- function IsConstructor2(value) {
13944
- return IsKindOf2(value, "Constructor") && value.type === "Constructor" && IsOptionalString(value.$id) && IsArray(value.parameters) && value.parameters.every((schema) => IsSchema2(schema)) && IsSchema2(value.returns);
13945
- }
13946
- function IsDate3(value) {
13947
- return IsKindOf2(value, "Date") && value.type === "Date" && IsOptionalString(value.$id) && IsOptionalNumber(value.exclusiveMaximumTimestamp) && IsOptionalNumber(value.exclusiveMinimumTimestamp) && IsOptionalNumber(value.maximumTimestamp) && IsOptionalNumber(value.minimumTimestamp) && IsOptionalNumber(value.multipleOfTimestamp);
13948
- }
13949
- function IsFunction3(value) {
13950
- return IsKindOf2(value, "Function") && value.type === "Function" && IsOptionalString(value.$id) && IsArray(value.parameters) && value.parameters.every((schema) => IsSchema2(schema)) && IsSchema2(value.returns);
13951
- }
13952
- function IsImport(value) {
13953
- return IsKindOf2(value, "Import") && HasPropertyKey(value, "$defs") && IsObject(value.$defs) && IsProperties(value.$defs) && HasPropertyKey(value, "$ref") && IsString(value.$ref) && value.$ref in value.$defs;
13954
- }
13955
- function IsInteger2(value) {
13956
- return IsKindOf2(value, "Integer") && value.type === "integer" && IsOptionalString(value.$id) && IsOptionalNumber(value.exclusiveMaximum) && IsOptionalNumber(value.exclusiveMinimum) && IsOptionalNumber(value.maximum) && IsOptionalNumber(value.minimum) && IsOptionalNumber(value.multipleOf);
13957
- }
13958
- function IsProperties(value) {
13959
- return IsObject(value) && Object.entries(value).every(([key, schema]) => IsControlCharacterFree(key) && IsSchema2(schema));
13960
- }
13961
- function IsIntersect2(value) {
13962
- return IsKindOf2(value, "Intersect") && (IsString(value.type) && value.type !== "object" ? false : true) && IsArray(value.allOf) && value.allOf.every((schema) => IsSchema2(schema) && !IsTransform2(schema)) && IsOptionalString(value.type) && (IsOptionalBoolean(value.unevaluatedProperties) || IsOptionalSchema(value.unevaluatedProperties)) && IsOptionalString(value.$id);
13963
- }
13964
- function IsIterator3(value) {
13965
- return IsKindOf2(value, "Iterator") && value.type === "Iterator" && IsOptionalString(value.$id) && IsSchema2(value.items);
13966
- }
13967
- function IsKindOf2(value, kind) {
13968
- return IsObject(value) && Kind in value && value[Kind] === kind;
13969
- }
13970
- function IsLiteralString(value) {
13971
- return IsLiteral2(value) && IsString(value.const);
13972
- }
13973
- function IsLiteralNumber(value) {
13974
- return IsLiteral2(value) && IsNumber(value.const);
13975
- }
13976
- function IsLiteralBoolean(value) {
13977
- return IsLiteral2(value) && IsBoolean(value.const);
13978
- }
13979
- function IsLiteral2(value) {
13980
- return IsKindOf2(value, "Literal") && IsOptionalString(value.$id) && IsLiteralValue2(value.const);
13981
- }
13982
- function IsLiteralValue2(value) {
13983
- return IsBoolean(value) || IsNumber(value) || IsString(value);
13984
- }
13985
- function IsMappedKey2(value) {
13986
- return IsKindOf2(value, "MappedKey") && IsArray(value.keys) && value.keys.every((key) => IsNumber(key) || IsString(key));
13987
- }
13988
- function IsMappedResult2(value) {
13989
- return IsKindOf2(value, "MappedResult") && IsProperties(value.properties);
13990
- }
13991
- function IsNever2(value) {
13992
- return IsKindOf2(value, "Never") && IsObject(value.not) && Object.getOwnPropertyNames(value.not).length === 0;
13993
- }
13994
- function IsNot2(value) {
13995
- return IsKindOf2(value, "Not") && IsSchema2(value.not);
13996
- }
13997
- function IsNull3(value) {
13998
- return IsKindOf2(value, "Null") && value.type === "null" && IsOptionalString(value.$id);
13999
- }
14000
- function IsNumber4(value) {
14001
- return IsKindOf2(value, "Number") && value.type === "number" && IsOptionalString(value.$id) && IsOptionalNumber(value.exclusiveMaximum) && IsOptionalNumber(value.exclusiveMinimum) && IsOptionalNumber(value.maximum) && IsOptionalNumber(value.minimum) && IsOptionalNumber(value.multipleOf);
14002
- }
14003
- function IsObject4(value) {
14004
- return IsKindOf2(value, "Object") && value.type === "object" && IsOptionalString(value.$id) && IsProperties(value.properties) && IsAdditionalProperties(value.additionalProperties) && IsOptionalNumber(value.minProperties) && IsOptionalNumber(value.maxProperties);
14005
- }
14006
- function IsPromise2(value) {
14007
- return IsKindOf2(value, "Promise") && value.type === "Promise" && IsOptionalString(value.$id) && IsSchema2(value.item);
14008
- }
14009
- function IsRecord2(value) {
14010
- return IsKindOf2(value, "Record") && value.type === "object" && IsOptionalString(value.$id) && IsAdditionalProperties(value.additionalProperties) && IsObject(value.patternProperties) && ((schema) => {
14011
- const keys = Object.getOwnPropertyNames(schema.patternProperties);
14012
- return keys.length === 1 && IsPattern(keys[0]) && IsObject(schema.patternProperties) && IsSchema2(schema.patternProperties[keys[0]]);
14013
- })(value);
14014
- }
14015
- function IsRecursive(value) {
14016
- return IsObject(value) && Hint in value && value[Hint] === "Recursive";
14017
- }
14018
- function IsRef2(value) {
14019
- return IsKindOf2(value, "Ref") && IsOptionalString(value.$id) && IsString(value.$ref);
14020
- }
14021
- function IsRegExp3(value) {
14022
- return IsKindOf2(value, "RegExp") && IsOptionalString(value.$id) && IsString(value.source) && IsString(value.flags) && IsOptionalNumber(value.maxLength) && IsOptionalNumber(value.minLength);
14023
- }
14024
- function IsString3(value) {
14025
- return IsKindOf2(value, "String") && value.type === "string" && IsOptionalString(value.$id) && IsOptionalNumber(value.minLength) && IsOptionalNumber(value.maxLength) && IsOptionalPattern(value.pattern) && IsOptionalFormat(value.format);
14026
- }
14027
- function IsSymbol3(value) {
14028
- return IsKindOf2(value, "Symbol") && value.type === "symbol" && IsOptionalString(value.$id);
14029
- }
14030
- function IsTemplateLiteral2(value) {
14031
- return IsKindOf2(value, "TemplateLiteral") && value.type === "string" && IsString(value.pattern) && value.pattern[0] === "^" && value.pattern[value.pattern.length - 1] === "$";
14032
- }
14033
- function IsThis2(value) {
14034
- return IsKindOf2(value, "This") && IsOptionalString(value.$id) && IsString(value.$ref);
14035
- }
14036
- function IsTransform2(value) {
14037
- return IsObject(value) && TransformKind in value;
14038
- }
14039
- function IsTuple2(value) {
14040
- return IsKindOf2(value, "Tuple") && value.type === "array" && IsOptionalString(value.$id) && IsNumber(value.minItems) && IsNumber(value.maxItems) && value.minItems === value.maxItems && // empty
14041
- (IsUndefined(value.items) && IsUndefined(value.additionalItems) && value.minItems === 0 || IsArray(value.items) && value.items.every((schema) => IsSchema2(schema)));
14042
- }
14043
- function IsUndefined4(value) {
14044
- return IsKindOf2(value, "Undefined") && value.type === "undefined" && IsOptionalString(value.$id);
14045
- }
14046
- function IsUnionLiteral(value) {
14047
- return IsUnion2(value) && value.anyOf.every((schema) => IsLiteralString(schema) || IsLiteralNumber(schema));
14048
- }
14049
- function IsUnion2(value) {
14050
- return IsKindOf2(value, "Union") && IsOptionalString(value.$id) && IsObject(value) && IsArray(value.anyOf) && value.anyOf.every((schema) => IsSchema2(schema));
14051
- }
14052
- function IsUint8Array3(value) {
14053
- return IsKindOf2(value, "Uint8Array") && value.type === "Uint8Array" && IsOptionalString(value.$id) && IsOptionalNumber(value.minByteLength) && IsOptionalNumber(value.maxByteLength);
14054
- }
14055
- function IsUnknown2(value) {
14056
- return IsKindOf2(value, "Unknown") && IsOptionalString(value.$id);
14057
- }
14058
- function IsUnsafe2(value) {
14059
- return IsKindOf2(value, "Unsafe");
14060
- }
14061
- function IsVoid2(value) {
14062
- return IsKindOf2(value, "Void") && value.type === "void" && IsOptionalString(value.$id);
14063
- }
14064
- function IsKind2(value) {
14065
- return IsObject(value) && Kind in value && IsString(value[Kind]) && !KnownTypes.includes(value[Kind]);
14066
- }
14067
- function IsSchema2(value) {
14068
- return IsObject(value) && (IsAny2(value) || IsArgument2(value) || IsArray4(value) || IsBoolean3(value) || IsBigInt3(value) || IsAsyncIterator3(value) || IsComputed2(value) || IsConstructor2(value) || IsDate3(value) || IsFunction3(value) || IsInteger2(value) || IsIntersect2(value) || IsIterator3(value) || IsLiteral2(value) || IsMappedKey2(value) || IsMappedResult2(value) || IsNever2(value) || IsNot2(value) || IsNull3(value) || IsNumber4(value) || IsObject4(value) || IsPromise2(value) || IsRecord2(value) || IsRef2(value) || IsRegExp3(value) || IsString3(value) || IsSymbol3(value) || IsTemplateLiteral2(value) || IsThis2(value) || IsTuple2(value) || IsUndefined4(value) || IsUnion2(value) || IsUint8Array3(value) || IsUnknown2(value) || IsUnsafe2(value) || IsVoid2(value) || IsKind2(value));
14069
- }
14070
-
14071
- // ../../node_modules/@sinclair/typebox/build/esm/type/patterns/patterns.mjs
14072
- var PatternBoolean = "(true|false)";
14073
- var PatternNumber = "(0|[1-9][0-9]*)";
14074
- var PatternString = "(.*)";
14075
- var PatternNever = "(?!.*)";
14076
- var PatternBooleanExact = `^${PatternBoolean}$`;
14077
- var PatternNumberExact = `^${PatternNumber}$`;
14078
- var PatternStringExact = `^${PatternString}$`;
14079
- var PatternNeverExact = `^${PatternNever}$`;
14080
-
14081
- // ../../node_modules/@sinclair/typebox/build/esm/type/sets/set.mjs
14082
- function SetIncludes(T, S) {
14083
- return T.includes(S);
14084
- }
14085
- function SetDistinct(T) {
14086
- return [...new Set(T)];
14087
- }
14088
- function SetIntersect(T, S) {
14089
- return T.filter((L) => S.includes(L));
14090
- }
14091
- function SetIntersectManyResolve(T, Init) {
14092
- return T.reduce((Acc, L) => {
14093
- return SetIntersect(Acc, L);
14094
- }, Init);
14095
- }
14096
- function SetIntersectMany(T) {
14097
- return T.length === 1 ? T[0] : T.length > 1 ? SetIntersectManyResolve(T.slice(1), T[0]) : [];
14098
- }
14099
- function SetUnionMany(T) {
14100
- const Acc = [];
14101
- for (const L of T)
14102
- Acc.push(...L);
14103
- return Acc;
14104
- }
14105
-
14106
- // ../../node_modules/@sinclair/typebox/build/esm/type/any/any.mjs
14107
- function Any(options) {
14108
- return CreateType({ [Kind]: "Any" }, options);
14109
- }
14110
-
14111
- // ../../node_modules/@sinclair/typebox/build/esm/type/array/array.mjs
14112
- function Array2(items, options) {
14113
- return CreateType({ [Kind]: "Array", type: "array", items }, options);
14114
- }
14115
-
14116
- // ../../node_modules/@sinclair/typebox/build/esm/type/argument/argument.mjs
14117
- function Argument(index) {
14118
- return CreateType({ [Kind]: "Argument", index });
14119
- }
14120
-
14121
- // ../../node_modules/@sinclair/typebox/build/esm/type/async-iterator/async-iterator.mjs
14122
- function AsyncIterator(items, options) {
14123
- return CreateType({ [Kind]: "AsyncIterator", type: "AsyncIterator", items }, options);
14124
- }
14125
-
14126
- // ../../node_modules/@sinclair/typebox/build/esm/type/computed/computed.mjs
14127
- function Computed(target, parameters, options) {
14128
- return CreateType({ [Kind]: "Computed", target, parameters }, options);
14129
- }
14130
-
14131
- // ../../node_modules/@sinclair/typebox/build/esm/type/discard/discard.mjs
14132
- function DiscardKey(value, key) {
14133
- const { [key]: _, ...rest } = value;
14134
- return rest;
14135
- }
14136
- function Discard(value, keys) {
14137
- return keys.reduce((acc, key) => DiscardKey(acc, key), value);
14138
- }
14139
-
14140
- // ../../node_modules/@sinclair/typebox/build/esm/type/never/never.mjs
14141
- function Never(options) {
14142
- return CreateType({ [Kind]: "Never", not: {} }, options);
14143
- }
14144
-
14145
- // ../../node_modules/@sinclair/typebox/build/esm/type/mapped/mapped-result.mjs
14146
- function MappedResult(properties) {
14147
- return CreateType({
14148
- [Kind]: "MappedResult",
14149
- properties
14150
- });
14151
- }
14152
-
14153
- // ../../node_modules/@sinclair/typebox/build/esm/type/constructor/constructor.mjs
14154
- function Constructor(parameters, returns, options) {
14155
- return CreateType({ [Kind]: "Constructor", type: "Constructor", parameters, returns }, options);
14156
- }
14157
-
14158
- // ../../node_modules/@sinclair/typebox/build/esm/type/function/function.mjs
14159
- function Function2(parameters, returns, options) {
14160
- return CreateType({ [Kind]: "Function", type: "Function", parameters, returns }, options);
14161
- }
14162
-
14163
- // ../../node_modules/@sinclair/typebox/build/esm/type/union/union-create.mjs
14164
- function UnionCreate(T, options) {
14165
- return CreateType({ [Kind]: "Union", anyOf: T }, options);
14166
- }
14167
-
14168
- // ../../node_modules/@sinclair/typebox/build/esm/type/union/union-evaluated.mjs
14169
- function IsUnionOptional(types) {
14170
- return types.some((type) => IsOptional(type));
14171
- }
14172
- function RemoveOptionalFromRest(types) {
14173
- return types.map((left) => IsOptional(left) ? RemoveOptionalFromType(left) : left);
14174
- }
14175
- function RemoveOptionalFromType(T) {
14176
- return Discard(T, [OptionalKind]);
14177
- }
14178
- function ResolveUnion(types, options) {
14179
- const isOptional = IsUnionOptional(types);
14180
- return isOptional ? Optional(UnionCreate(RemoveOptionalFromRest(types), options)) : UnionCreate(RemoveOptionalFromRest(types), options);
14181
- }
14182
- function UnionEvaluated(T, options) {
14183
- return T.length === 1 ? CreateType(T[0], options) : T.length === 0 ? Never(options) : ResolveUnion(T, options);
14184
- }
14185
-
14186
- // ../../node_modules/@sinclair/typebox/build/esm/type/union/union.mjs
14187
- function Union(types, options) {
14188
- return types.length === 0 ? Never(options) : types.length === 1 ? CreateType(types[0], options) : UnionCreate(types, options);
14189
- }
14190
-
14191
- // ../../node_modules/@sinclair/typebox/build/esm/type/template-literal/parse.mjs
14192
- var TemplateLiteralParserError = class extends TypeBoxError {
14193
- };
14194
- function Unescape(pattern) {
14195
- return pattern.replace(/\\\$/g, "$").replace(/\\\*/g, "*").replace(/\\\^/g, "^").replace(/\\\|/g, "|").replace(/\\\(/g, "(").replace(/\\\)/g, ")");
14196
- }
14197
- function IsNonEscaped(pattern, index, char) {
14198
- return pattern[index] === char && pattern.charCodeAt(index - 1) !== 92;
14199
- }
14200
- function IsOpenParen(pattern, index) {
14201
- return IsNonEscaped(pattern, index, "(");
14202
- }
14203
- function IsCloseParen(pattern, index) {
14204
- return IsNonEscaped(pattern, index, ")");
14205
- }
14206
- function IsSeparator(pattern, index) {
14207
- return IsNonEscaped(pattern, index, "|");
14208
- }
14209
- function IsGroup(pattern) {
14210
- if (!(IsOpenParen(pattern, 0) && IsCloseParen(pattern, pattern.length - 1)))
14211
- return false;
14212
- let count = 0;
14213
- for (let index = 0; index < pattern.length; index++) {
14214
- if (IsOpenParen(pattern, index))
14215
- count += 1;
14216
- if (IsCloseParen(pattern, index))
14217
- count -= 1;
14218
- if (count === 0 && index !== pattern.length - 1)
14219
- return false;
14220
- }
14221
- return true;
14222
- }
14223
- function InGroup(pattern) {
14224
- return pattern.slice(1, pattern.length - 1);
14225
- }
14226
- function IsPrecedenceOr(pattern) {
14227
- let count = 0;
14228
- for (let index = 0; index < pattern.length; index++) {
14229
- if (IsOpenParen(pattern, index))
14230
- count += 1;
14231
- if (IsCloseParen(pattern, index))
14232
- count -= 1;
14233
- if (IsSeparator(pattern, index) && count === 0)
14234
- return true;
14235
- }
14236
- return false;
14237
- }
14238
- function IsPrecedenceAnd(pattern) {
14239
- for (let index = 0; index < pattern.length; index++) {
14240
- if (IsOpenParen(pattern, index))
14241
- return true;
14242
- }
14243
- return false;
14244
- }
14245
- function Or(pattern) {
14246
- let [count, start] = [0, 0];
14247
- const expressions = [];
14248
- for (let index = 0; index < pattern.length; index++) {
14249
- if (IsOpenParen(pattern, index))
14250
- count += 1;
14251
- if (IsCloseParen(pattern, index))
14252
- count -= 1;
14253
- if (IsSeparator(pattern, index) && count === 0) {
14254
- const range2 = pattern.slice(start, index);
14255
- if (range2.length > 0)
14256
- expressions.push(TemplateLiteralParse(range2));
14257
- start = index + 1;
14258
- }
14259
- }
14260
- const range = pattern.slice(start);
14261
- if (range.length > 0)
14262
- expressions.push(TemplateLiteralParse(range));
14263
- if (expressions.length === 0)
14264
- return { type: "const", const: "" };
14265
- if (expressions.length === 1)
14266
- return expressions[0];
14267
- return { type: "or", expr: expressions };
14268
- }
14269
- function And(pattern) {
14270
- function Group(value, index) {
14271
- if (!IsOpenParen(value, index))
14272
- throw new TemplateLiteralParserError(`TemplateLiteralParser: Index must point to open parens`);
14273
- let count = 0;
14274
- for (let scan = index; scan < value.length; scan++) {
14275
- if (IsOpenParen(value, scan))
14276
- count += 1;
14277
- if (IsCloseParen(value, scan))
14278
- count -= 1;
14279
- if (count === 0)
14280
- return [index, scan];
14281
- }
14282
- throw new TemplateLiteralParserError(`TemplateLiteralParser: Unclosed group parens in expression`);
14283
- }
14284
- function Range(pattern2, index) {
14285
- for (let scan = index; scan < pattern2.length; scan++) {
14286
- if (IsOpenParen(pattern2, scan))
14287
- return [index, scan];
14288
- }
14289
- return [index, pattern2.length];
14290
- }
14291
- const expressions = [];
14292
- for (let index = 0; index < pattern.length; index++) {
14293
- if (IsOpenParen(pattern, index)) {
14294
- const [start, end] = Group(pattern, index);
14295
- const range = pattern.slice(start, end + 1);
14296
- expressions.push(TemplateLiteralParse(range));
14297
- index = end;
14298
- } else {
14299
- const [start, end] = Range(pattern, index);
14300
- const range = pattern.slice(start, end);
14301
- if (range.length > 0)
14302
- expressions.push(TemplateLiteralParse(range));
14303
- index = end - 1;
14304
- }
14305
- }
14306
- return expressions.length === 0 ? { type: "const", const: "" } : expressions.length === 1 ? expressions[0] : { type: "and", expr: expressions };
14307
- }
14308
- function TemplateLiteralParse(pattern) {
14309
- return IsGroup(pattern) ? TemplateLiteralParse(InGroup(pattern)) : IsPrecedenceOr(pattern) ? Or(pattern) : IsPrecedenceAnd(pattern) ? And(pattern) : { type: "const", const: Unescape(pattern) };
14310
- }
14311
- function TemplateLiteralParseExact(pattern) {
14312
- return TemplateLiteralParse(pattern.slice(1, pattern.length - 1));
14313
- }
14314
-
14315
- // ../../node_modules/@sinclair/typebox/build/esm/type/template-literal/finite.mjs
14316
- var TemplateLiteralFiniteError = class extends TypeBoxError {
14317
- };
14318
- function IsNumberExpression(expression) {
14319
- return expression.type === "or" && expression.expr.length === 2 && expression.expr[0].type === "const" && expression.expr[0].const === "0" && expression.expr[1].type === "const" && expression.expr[1].const === "[1-9][0-9]*";
14320
- }
14321
- function IsBooleanExpression(expression) {
14322
- return expression.type === "or" && expression.expr.length === 2 && expression.expr[0].type === "const" && expression.expr[0].const === "true" && expression.expr[1].type === "const" && expression.expr[1].const === "false";
14323
- }
14324
- function IsStringExpression(expression) {
14325
- return expression.type === "const" && expression.const === ".*";
14326
- }
14327
- function IsTemplateLiteralExpressionFinite(expression) {
14328
- return IsNumberExpression(expression) || IsStringExpression(expression) ? false : IsBooleanExpression(expression) ? true : expression.type === "and" ? expression.expr.every((expr) => IsTemplateLiteralExpressionFinite(expr)) : expression.type === "or" ? expression.expr.every((expr) => IsTemplateLiteralExpressionFinite(expr)) : expression.type === "const" ? true : (() => {
14329
- throw new TemplateLiteralFiniteError(`Unknown expression type`);
14330
- })();
14331
- }
14332
- function IsTemplateLiteralFinite(schema) {
14333
- const expression = TemplateLiteralParseExact(schema.pattern);
14334
- return IsTemplateLiteralExpressionFinite(expression);
14335
- }
14336
-
14337
- // ../../node_modules/@sinclair/typebox/build/esm/type/template-literal/generate.mjs
14338
- var TemplateLiteralGenerateError = class extends TypeBoxError {
14339
- };
14340
- function* GenerateReduce(buffer) {
14341
- if (buffer.length === 1)
14342
- return yield* buffer[0];
14343
- for (const left of buffer[0]) {
14344
- for (const right of GenerateReduce(buffer.slice(1))) {
14345
- yield `${left}${right}`;
14346
- }
14347
- }
14348
- }
14349
- function* GenerateAnd(expression) {
14350
- return yield* GenerateReduce(expression.expr.map((expr) => [...TemplateLiteralExpressionGenerate(expr)]));
14351
- }
14352
- function* GenerateOr(expression) {
14353
- for (const expr of expression.expr)
14354
- yield* TemplateLiteralExpressionGenerate(expr);
14355
- }
14356
- function* GenerateConst(expression) {
14357
- return yield expression.const;
14358
- }
14359
- function* TemplateLiteralExpressionGenerate(expression) {
14360
- return expression.type === "and" ? yield* GenerateAnd(expression) : expression.type === "or" ? yield* GenerateOr(expression) : expression.type === "const" ? yield* GenerateConst(expression) : (() => {
14361
- throw new TemplateLiteralGenerateError("Unknown expression");
14362
- })();
14363
- }
14364
- function TemplateLiteralGenerate(schema) {
14365
- const expression = TemplateLiteralParseExact(schema.pattern);
14366
- return IsTemplateLiteralExpressionFinite(expression) ? [...TemplateLiteralExpressionGenerate(expression)] : [];
14367
- }
14368
-
14369
- // ../../node_modules/@sinclair/typebox/build/esm/type/literal/literal.mjs
14370
- function Literal(value, options) {
14371
- return CreateType({
14372
- [Kind]: "Literal",
14373
- const: value,
14374
- type: typeof value
14375
- }, options);
14376
- }
14377
-
14378
- // ../../node_modules/@sinclair/typebox/build/esm/type/boolean/boolean.mjs
14379
- function Boolean2(options) {
14380
- return CreateType({ [Kind]: "Boolean", type: "boolean" }, options);
14381
- }
14382
-
14383
- // ../../node_modules/@sinclair/typebox/build/esm/type/bigint/bigint.mjs
14384
- function BigInt(options) {
14385
- return CreateType({ [Kind]: "BigInt", type: "bigint" }, options);
14386
- }
14387
-
14388
- // ../../node_modules/@sinclair/typebox/build/esm/type/number/number.mjs
14389
- function Number2(options) {
14390
- return CreateType({ [Kind]: "Number", type: "number" }, options);
14391
- }
14392
-
14393
- // ../../node_modules/@sinclair/typebox/build/esm/type/string/string.mjs
14394
- function String2(options) {
14395
- return CreateType({ [Kind]: "String", type: "string" }, options);
14396
- }
14397
-
14398
- // ../../node_modules/@sinclair/typebox/build/esm/type/template-literal/syntax.mjs
14399
- function* FromUnion(syntax) {
14400
- const trim = syntax.trim().replace(/"|'/g, "");
14401
- return trim === "boolean" ? yield Boolean2() : trim === "number" ? yield Number2() : trim === "bigint" ? yield BigInt() : trim === "string" ? yield String2() : yield (() => {
14402
- const literals = trim.split("|").map((literal) => Literal(literal.trim()));
14403
- return literals.length === 0 ? Never() : literals.length === 1 ? literals[0] : UnionEvaluated(literals);
14404
- })();
14405
- }
14406
- function* FromTerminal(syntax) {
14407
- if (syntax[1] !== "{") {
14408
- const L = Literal("$");
14409
- const R = FromSyntax(syntax.slice(1));
14410
- return yield* [L, ...R];
14411
- }
14412
- for (let i = 2; i < syntax.length; i++) {
14413
- if (syntax[i] === "}") {
14414
- const L = FromUnion(syntax.slice(2, i));
14415
- const R = FromSyntax(syntax.slice(i + 1));
14416
- return yield* [...L, ...R];
14417
- }
14418
- }
14419
- yield Literal(syntax);
14420
- }
14421
- function* FromSyntax(syntax) {
14422
- for (let i = 0; i < syntax.length; i++) {
14423
- if (syntax[i] === "$") {
14424
- const L = Literal(syntax.slice(0, i));
14425
- const R = FromTerminal(syntax.slice(i));
14426
- return yield* [L, ...R];
14427
- }
14428
- }
14429
- yield Literal(syntax);
14430
- }
14431
- function TemplateLiteralSyntax(syntax) {
14432
- return [...FromSyntax(syntax)];
14433
- }
14434
-
14435
- // ../../node_modules/@sinclair/typebox/build/esm/type/template-literal/pattern.mjs
14436
- var TemplateLiteralPatternError = class extends TypeBoxError {
14437
- };
14438
- function Escape(value) {
14439
- return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
14440
- }
14441
- function Visit2(schema, acc) {
14442
- return IsTemplateLiteral(schema) ? schema.pattern.slice(1, schema.pattern.length - 1) : IsUnion(schema) ? `(${schema.anyOf.map((schema2) => Visit2(schema2, acc)).join("|")})` : IsNumber3(schema) ? `${acc}${PatternNumber}` : IsInteger(schema) ? `${acc}${PatternNumber}` : IsBigInt2(schema) ? `${acc}${PatternNumber}` : IsString2(schema) ? `${acc}${PatternString}` : IsLiteral(schema) ? `${acc}${Escape(schema.const.toString())}` : IsBoolean2(schema) ? `${acc}${PatternBoolean}` : (() => {
14443
- throw new TemplateLiteralPatternError(`Unexpected Kind '${schema[Kind]}'`);
14444
- })();
14445
- }
14446
- function TemplateLiteralPattern(kinds) {
14447
- return `^${kinds.map((schema) => Visit2(schema, "")).join("")}$`;
14448
- }
14449
-
14450
- // ../../node_modules/@sinclair/typebox/build/esm/type/template-literal/union.mjs
14451
- function TemplateLiteralToUnion(schema) {
14452
- const R = TemplateLiteralGenerate(schema);
14453
- const L = R.map((S) => Literal(S));
14454
- return UnionEvaluated(L);
14455
- }
14456
-
14457
- // ../../node_modules/@sinclair/typebox/build/esm/type/template-literal/template-literal.mjs
14458
- function TemplateLiteral(unresolved, options) {
14459
- const pattern = IsString(unresolved) ? TemplateLiteralPattern(TemplateLiteralSyntax(unresolved)) : TemplateLiteralPattern(unresolved);
14460
- return CreateType({ [Kind]: "TemplateLiteral", type: "string", pattern }, options);
14461
- }
14462
-
14463
- // ../../node_modules/@sinclair/typebox/build/esm/type/indexed/indexed-property-keys.mjs
14464
- function FromTemplateLiteral(templateLiteral) {
14465
- const keys = TemplateLiteralGenerate(templateLiteral);
14466
- return keys.map((key) => key.toString());
14467
- }
14468
- function FromUnion2(types) {
14469
- const result = [];
14470
- for (const type of types)
14471
- result.push(...IndexPropertyKeys(type));
14472
- return result;
14473
- }
14474
- function FromLiteral(literalValue) {
14475
- return [literalValue.toString()];
14476
- }
14477
- function IndexPropertyKeys(type) {
14478
- return [...new Set(IsTemplateLiteral(type) ? FromTemplateLiteral(type) : IsUnion(type) ? FromUnion2(type.anyOf) : IsLiteral(type) ? FromLiteral(type.const) : IsNumber3(type) ? ["[number]"] : IsInteger(type) ? ["[number]"] : [])];
14479
- }
14480
-
14481
- // ../../node_modules/@sinclair/typebox/build/esm/type/indexed/indexed-from-mapped-result.mjs
14482
- function FromProperties(type, properties, options) {
14483
- const result = {};
14484
- for (const K2 of Object.getOwnPropertyNames(properties)) {
14485
- result[K2] = Index(type, IndexPropertyKeys(properties[K2]), options);
14486
- }
14487
- return result;
14488
- }
14489
- function FromMappedResult(type, mappedResult, options) {
14490
- return FromProperties(type, mappedResult.properties, options);
14491
- }
14492
- function IndexFromMappedResult(type, mappedResult, options) {
14493
- const properties = FromMappedResult(type, mappedResult, options);
14494
- return MappedResult(properties);
14495
- }
14496
-
14497
- // ../../node_modules/@sinclair/typebox/build/esm/type/indexed/indexed.mjs
14498
- function FromRest(types, key) {
14499
- return types.map((type) => IndexFromPropertyKey(type, key));
14500
- }
14501
- function FromIntersectRest(types) {
14502
- return types.filter((type) => !IsNever(type));
14503
- }
14504
- function FromIntersect(types, key) {
14505
- return IntersectEvaluated(FromIntersectRest(FromRest(types, key)));
14506
- }
14507
- function FromUnionRest(types) {
14508
- return types.some((L) => IsNever(L)) ? [] : types;
14509
- }
14510
- function FromUnion3(types, key) {
14511
- return UnionEvaluated(FromUnionRest(FromRest(types, key)));
14512
- }
14513
- function FromTuple(types, key) {
14514
- return key in types ? types[key] : key === "[number]" ? UnionEvaluated(types) : Never();
14515
- }
14516
- function FromArray(type, key) {
14517
- return key === "[number]" ? type : Never();
14518
- }
14519
- function FromProperty(properties, propertyKey) {
14520
- return propertyKey in properties ? properties[propertyKey] : Never();
14521
- }
14522
- function IndexFromPropertyKey(type, propertyKey) {
14523
- return IsIntersect(type) ? FromIntersect(type.allOf, propertyKey) : IsUnion(type) ? FromUnion3(type.anyOf, propertyKey) : IsTuple(type) ? FromTuple(type.items ?? [], propertyKey) : IsArray3(type) ? FromArray(type.items, propertyKey) : IsObject3(type) ? FromProperty(type.properties, propertyKey) : Never();
14524
- }
14525
- function IndexFromPropertyKeys(type, propertyKeys) {
14526
- return propertyKeys.map((propertyKey) => IndexFromPropertyKey(type, propertyKey));
14527
- }
14528
- function FromSchema(type, propertyKeys) {
14529
- return UnionEvaluated(IndexFromPropertyKeys(type, propertyKeys));
14530
- }
14531
- function Index(type, key, options) {
14532
- if (IsRef(type) || IsRef(key)) {
14533
- const error = `Index types using Ref parameters require both Type and Key to be of TSchema`;
14534
- if (!IsSchema(type) || !IsSchema(key))
14535
- throw new TypeBoxError(error);
14536
- return Computed("Index", [type, key]);
14537
- }
14538
- if (IsMappedResult(key))
14539
- return IndexFromMappedResult(type, key, options);
14540
- if (IsMappedKey(key))
14541
- return IndexFromMappedKey(type, key, options);
14542
- return CreateType(IsSchema(key) ? FromSchema(type, IndexPropertyKeys(key)) : FromSchema(type, key), options);
14543
- }
14544
-
14545
- // ../../node_modules/@sinclair/typebox/build/esm/type/indexed/indexed-from-mapped-key.mjs
14546
- function MappedIndexPropertyKey(type, key, options) {
14547
- return { [key]: Index(type, [key], Clone(options)) };
14548
- }
14549
- function MappedIndexPropertyKeys(type, propertyKeys, options) {
14550
- return propertyKeys.reduce((result, left) => {
14551
- return { ...result, ...MappedIndexPropertyKey(type, left, options) };
14552
- }, {});
14553
- }
14554
- function MappedIndexProperties(type, mappedKey, options) {
14555
- return MappedIndexPropertyKeys(type, mappedKey.keys, options);
14556
- }
14557
- function IndexFromMappedKey(type, mappedKey, options) {
14558
- const properties = MappedIndexProperties(type, mappedKey, options);
14559
- return MappedResult(properties);
14560
- }
14561
-
14562
- // ../../node_modules/@sinclair/typebox/build/esm/type/iterator/iterator.mjs
14563
- function Iterator(items, options) {
14564
- return CreateType({ [Kind]: "Iterator", type: "Iterator", items }, options);
14565
- }
14566
-
14567
- // ../../node_modules/@sinclair/typebox/build/esm/type/object/object.mjs
14568
- function RequiredArray(properties) {
14569
- return globalThis.Object.keys(properties).filter((key) => !IsOptional(properties[key]));
14570
- }
14571
- function _Object(properties, options) {
14572
- const required = RequiredArray(properties);
14573
- const schema = required.length > 0 ? { [Kind]: "Object", type: "object", required, properties } : { [Kind]: "Object", type: "object", properties };
14574
- return CreateType(schema, options);
14575
- }
14576
- var Object2 = _Object;
14577
-
14578
- // ../../node_modules/@sinclair/typebox/build/esm/type/promise/promise.mjs
14579
- function Promise2(item, options) {
14580
- return CreateType({ [Kind]: "Promise", type: "Promise", item }, options);
14581
- }
14582
-
14583
- // ../../node_modules/@sinclair/typebox/build/esm/type/readonly/readonly.mjs
14584
- function RemoveReadonly(schema) {
14585
- return CreateType(Discard(schema, [ReadonlyKind]));
14586
- }
14587
- function AddReadonly(schema) {
14588
- return CreateType({ ...schema, [ReadonlyKind]: "Readonly" });
14589
- }
14590
- function ReadonlyWithFlag(schema, F) {
14591
- return F === false ? RemoveReadonly(schema) : AddReadonly(schema);
14592
- }
14593
- function Readonly(schema, enable) {
14594
- const F = enable ?? true;
14595
- return IsMappedResult(schema) ? ReadonlyFromMappedResult(schema, F) : ReadonlyWithFlag(schema, F);
14596
- }
14597
-
14598
- // ../../node_modules/@sinclair/typebox/build/esm/type/readonly/readonly-from-mapped-result.mjs
14599
- function FromProperties2(K, F) {
14600
- const Acc = {};
14601
- for (const K2 of globalThis.Object.getOwnPropertyNames(K))
14602
- Acc[K2] = Readonly(K[K2], F);
14603
- return Acc;
14604
- }
14605
- function FromMappedResult2(R, F) {
14606
- return FromProperties2(R.properties, F);
14607
- }
14608
- function ReadonlyFromMappedResult(R, F) {
14609
- const P = FromMappedResult2(R, F);
14610
- return MappedResult(P);
14611
- }
14612
-
14613
- // ../../node_modules/@sinclair/typebox/build/esm/type/tuple/tuple.mjs
14614
- function Tuple(types, options) {
14615
- return CreateType(types.length > 0 ? { [Kind]: "Tuple", type: "array", items: types, additionalItems: false, minItems: types.length, maxItems: types.length } : { [Kind]: "Tuple", type: "array", minItems: types.length, maxItems: types.length }, options);
14616
- }
14617
-
14618
- // ../../node_modules/@sinclair/typebox/build/esm/type/mapped/mapped.mjs
14619
- function FromMappedResult3(K, P) {
14620
- return K in P ? FromSchemaType(K, P[K]) : MappedResult(P);
14621
- }
14622
- function MappedKeyToKnownMappedResultProperties(K) {
14623
- return { [K]: Literal(K) };
14624
- }
14625
- function MappedKeyToUnknownMappedResultProperties(P) {
14626
- const Acc = {};
14627
- for (const L of P)
14628
- Acc[L] = Literal(L);
14629
- return Acc;
14630
- }
14631
- function MappedKeyToMappedResultProperties(K, P) {
14632
- return SetIncludes(P, K) ? MappedKeyToKnownMappedResultProperties(K) : MappedKeyToUnknownMappedResultProperties(P);
14633
- }
14634
- function FromMappedKey(K, P) {
14635
- const R = MappedKeyToMappedResultProperties(K, P);
14636
- return FromMappedResult3(K, R);
14637
- }
14638
- function FromRest2(K, T) {
14639
- return T.map((L) => FromSchemaType(K, L));
14640
- }
14641
- function FromProperties3(K, T) {
14642
- const Acc = {};
14643
- for (const K2 of globalThis.Object.getOwnPropertyNames(T))
14644
- Acc[K2] = FromSchemaType(K, T[K2]);
14645
- return Acc;
14646
- }
14647
- function FromSchemaType(K, T) {
14648
- const options = { ...T };
14649
- return (
14650
- // unevaluated modifier types
14651
- IsOptional(T) ? Optional(FromSchemaType(K, Discard(T, [OptionalKind]))) : IsReadonly(T) ? Readonly(FromSchemaType(K, Discard(T, [ReadonlyKind]))) : (
14652
- // unevaluated mapped types
14653
- IsMappedResult(T) ? FromMappedResult3(K, T.properties) : IsMappedKey(T) ? FromMappedKey(K, T.keys) : (
14654
- // unevaluated types
14655
- IsConstructor(T) ? Constructor(FromRest2(K, T.parameters), FromSchemaType(K, T.returns), options) : IsFunction2(T) ? Function2(FromRest2(K, T.parameters), FromSchemaType(K, T.returns), options) : IsAsyncIterator2(T) ? AsyncIterator(FromSchemaType(K, T.items), options) : IsIterator2(T) ? Iterator(FromSchemaType(K, T.items), options) : IsIntersect(T) ? Intersect(FromRest2(K, T.allOf), options) : IsUnion(T) ? Union(FromRest2(K, T.anyOf), options) : IsTuple(T) ? Tuple(FromRest2(K, T.items ?? []), options) : IsObject3(T) ? Object2(FromProperties3(K, T.properties), options) : IsArray3(T) ? Array2(FromSchemaType(K, T.items), options) : IsPromise(T) ? Promise2(FromSchemaType(K, T.item), options) : T
14656
- )
14657
- )
14658
- );
14659
- }
14660
- function MappedFunctionReturnType(K, T) {
14661
- const Acc = {};
14662
- for (const L of K)
14663
- Acc[L] = FromSchemaType(L, T);
14664
- return Acc;
14665
- }
14666
- function Mapped(key, map, options) {
14667
- const K = IsSchema(key) ? IndexPropertyKeys(key) : key;
14668
- const RT = map({ [Kind]: "MappedKey", keys: K });
14669
- const R = MappedFunctionReturnType(K, RT);
14670
- return Object2(R, options);
14671
- }
14672
-
14673
- // ../../node_modules/@sinclair/typebox/build/esm/type/optional/optional.mjs
14674
- function RemoveOptional(schema) {
14675
- return CreateType(Discard(schema, [OptionalKind]));
14676
- }
14677
- function AddOptional(schema) {
14678
- return CreateType({ ...schema, [OptionalKind]: "Optional" });
14679
- }
14680
- function OptionalWithFlag(schema, F) {
14681
- return F === false ? RemoveOptional(schema) : AddOptional(schema);
14682
- }
14683
- function Optional(schema, enable) {
14684
- const F = enable ?? true;
14685
- return IsMappedResult(schema) ? OptionalFromMappedResult(schema, F) : OptionalWithFlag(schema, F);
14686
- }
14687
-
14688
- // ../../node_modules/@sinclair/typebox/build/esm/type/optional/optional-from-mapped-result.mjs
14689
- function FromProperties4(P, F) {
14690
- const Acc = {};
14691
- for (const K2 of globalThis.Object.getOwnPropertyNames(P))
14692
- Acc[K2] = Optional(P[K2], F);
14693
- return Acc;
14694
- }
14695
- function FromMappedResult4(R, F) {
14696
- return FromProperties4(R.properties, F);
14697
- }
14698
- function OptionalFromMappedResult(R, F) {
14699
- const P = FromMappedResult4(R, F);
14700
- return MappedResult(P);
14701
- }
14702
-
14703
- // ../../node_modules/@sinclair/typebox/build/esm/type/intersect/intersect-create.mjs
14704
- function IntersectCreate(T, options = {}) {
14705
- const allObjects = T.every((schema) => IsObject3(schema));
14706
- const clonedUnevaluatedProperties = IsSchema(options.unevaluatedProperties) ? { unevaluatedProperties: options.unevaluatedProperties } : {};
14707
- return CreateType(options.unevaluatedProperties === false || IsSchema(options.unevaluatedProperties) || allObjects ? { ...clonedUnevaluatedProperties, [Kind]: "Intersect", type: "object", allOf: T } : { ...clonedUnevaluatedProperties, [Kind]: "Intersect", allOf: T }, options);
14708
- }
14709
-
14710
- // ../../node_modules/@sinclair/typebox/build/esm/type/intersect/intersect-evaluated.mjs
14711
- function IsIntersectOptional(types) {
14712
- return types.every((left) => IsOptional(left));
14713
- }
14714
- function RemoveOptionalFromType2(type) {
14715
- return Discard(type, [OptionalKind]);
14716
- }
14717
- function RemoveOptionalFromRest2(types) {
14718
- return types.map((left) => IsOptional(left) ? RemoveOptionalFromType2(left) : left);
14719
- }
14720
- function ResolveIntersect(types, options) {
14721
- return IsIntersectOptional(types) ? Optional(IntersectCreate(RemoveOptionalFromRest2(types), options)) : IntersectCreate(RemoveOptionalFromRest2(types), options);
14722
- }
14723
- function IntersectEvaluated(types, options = {}) {
14724
- if (types.length === 1)
14725
- return CreateType(types[0], options);
14726
- if (types.length === 0)
14727
- return Never(options);
14728
- if (types.some((schema) => IsTransform(schema)))
14729
- throw new Error("Cannot intersect transform types");
14730
- return ResolveIntersect(types, options);
14731
- }
14732
-
14733
- // ../../node_modules/@sinclair/typebox/build/esm/type/intersect/intersect.mjs
14734
- function Intersect(types, options) {
14735
- if (types.length === 1)
14736
- return CreateType(types[0], options);
14737
- if (types.length === 0)
14738
- return Never(options);
14739
- if (types.some((schema) => IsTransform(schema)))
14740
- throw new Error("Cannot intersect transform types");
14741
- return IntersectCreate(types, options);
14742
- }
14743
-
14744
- // ../../node_modules/@sinclair/typebox/build/esm/type/ref/ref.mjs
14745
- function Ref(...args) {
14746
- const [$ref, options] = typeof args[0] === "string" ? [args[0], args[1]] : [args[0].$id, args[1]];
14747
- if (typeof $ref !== "string")
14748
- throw new TypeBoxError("Ref: $ref must be a string");
14749
- return CreateType({ [Kind]: "Ref", $ref }, options);
14750
- }
14751
-
14752
- // ../../node_modules/@sinclair/typebox/build/esm/type/awaited/awaited.mjs
14753
- function FromComputed(target, parameters) {
14754
- return Computed("Awaited", [Computed(target, parameters)]);
14755
- }
14756
- function FromRef($ref) {
14757
- return Computed("Awaited", [Ref($ref)]);
14758
- }
14759
- function FromIntersect2(types) {
14760
- return Intersect(FromRest3(types));
14761
- }
14762
- function FromUnion4(types) {
14763
- return Union(FromRest3(types));
14764
- }
14765
- function FromPromise(type) {
14766
- return Awaited(type);
14767
- }
14768
- function FromRest3(types) {
14769
- return types.map((type) => Awaited(type));
14770
- }
14771
- function Awaited(type, options) {
14772
- return CreateType(IsComputed(type) ? FromComputed(type.target, type.parameters) : IsIntersect(type) ? FromIntersect2(type.allOf) : IsUnion(type) ? FromUnion4(type.anyOf) : IsPromise(type) ? FromPromise(type.item) : IsRef(type) ? FromRef(type.$ref) : type, options);
14773
- }
14774
-
14775
- // ../../node_modules/@sinclair/typebox/build/esm/type/keyof/keyof-property-keys.mjs
14776
- function FromRest4(types) {
14777
- const result = [];
14778
- for (const L of types)
14779
- result.push(KeyOfPropertyKeys(L));
14780
- return result;
14781
- }
14782
- function FromIntersect3(types) {
14783
- const propertyKeysArray = FromRest4(types);
14784
- const propertyKeys = SetUnionMany(propertyKeysArray);
14785
- return propertyKeys;
14786
- }
14787
- function FromUnion5(types) {
14788
- const propertyKeysArray = FromRest4(types);
14789
- const propertyKeys = SetIntersectMany(propertyKeysArray);
14790
- return propertyKeys;
14791
- }
14792
- function FromTuple2(types) {
14793
- return types.map((_, indexer) => indexer.toString());
14794
- }
14795
- function FromArray2(_) {
14796
- return ["[number]"];
14797
- }
14798
- function FromProperties5(T) {
14799
- return globalThis.Object.getOwnPropertyNames(T);
14800
- }
14801
- function FromPatternProperties(patternProperties) {
14802
- if (!includePatternProperties)
14803
- return [];
14804
- const patternPropertyKeys = globalThis.Object.getOwnPropertyNames(patternProperties);
14805
- return patternPropertyKeys.map((key) => {
14806
- return key[0] === "^" && key[key.length - 1] === "$" ? key.slice(1, key.length - 1) : key;
14807
- });
14808
- }
14809
- function KeyOfPropertyKeys(type) {
14810
- return IsIntersect(type) ? FromIntersect3(type.allOf) : IsUnion(type) ? FromUnion5(type.anyOf) : IsTuple(type) ? FromTuple2(type.items ?? []) : IsArray3(type) ? FromArray2(type.items) : IsObject3(type) ? FromProperties5(type.properties) : IsRecord(type) ? FromPatternProperties(type.patternProperties) : [];
14811
- }
14812
- var includePatternProperties = false;
14813
-
14814
- // ../../node_modules/@sinclair/typebox/build/esm/type/keyof/keyof.mjs
14815
- function FromComputed2(target, parameters) {
14816
- return Computed("KeyOf", [Computed(target, parameters)]);
14817
- }
14818
- function FromRef2($ref) {
14819
- return Computed("KeyOf", [Ref($ref)]);
14820
- }
14821
- function KeyOfFromType(type, options) {
14822
- const propertyKeys = KeyOfPropertyKeys(type);
14823
- const propertyKeyTypes = KeyOfPropertyKeysToRest(propertyKeys);
14824
- const result = UnionEvaluated(propertyKeyTypes);
14825
- return CreateType(result, options);
14826
- }
14827
- function KeyOfPropertyKeysToRest(propertyKeys) {
14828
- return propertyKeys.map((L) => L === "[number]" ? Number2() : Literal(L));
14829
- }
14830
- function KeyOf(type, options) {
14831
- return IsComputed(type) ? FromComputed2(type.target, type.parameters) : IsRef(type) ? FromRef2(type.$ref) : IsMappedResult(type) ? KeyOfFromMappedResult(type, options) : KeyOfFromType(type, options);
14832
- }
14833
-
14834
- // ../../node_modules/@sinclair/typebox/build/esm/type/keyof/keyof-from-mapped-result.mjs
14835
- function FromProperties6(properties, options) {
14836
- const result = {};
14837
- for (const K2 of globalThis.Object.getOwnPropertyNames(properties))
14838
- result[K2] = KeyOf(properties[K2], Clone(options));
14839
- return result;
14840
- }
14841
- function FromMappedResult5(mappedResult, options) {
14842
- return FromProperties6(mappedResult.properties, options);
14843
- }
14844
- function KeyOfFromMappedResult(mappedResult, options) {
14845
- const properties = FromMappedResult5(mappedResult, options);
14846
- return MappedResult(properties);
14847
- }
14848
-
14849
- // ../../node_modules/@sinclair/typebox/build/esm/type/composite/composite.mjs
14850
- function CompositeKeys(T) {
14851
- const Acc = [];
14852
- for (const L of T)
14853
- Acc.push(...KeyOfPropertyKeys(L));
14854
- return SetDistinct(Acc);
14855
- }
14856
- function FilterNever(T) {
14857
- return T.filter((L) => !IsNever(L));
14858
- }
14859
- function CompositeProperty(T, K) {
14860
- const Acc = [];
14861
- for (const L of T)
14862
- Acc.push(...IndexFromPropertyKeys(L, [K]));
14863
- return FilterNever(Acc);
14864
- }
14865
- function CompositeProperties(T, K) {
14866
- const Acc = {};
14867
- for (const L of K) {
14868
- Acc[L] = IntersectEvaluated(CompositeProperty(T, L));
14869
- }
14870
- return Acc;
14871
- }
14872
- function Composite(T, options) {
14873
- const K = CompositeKeys(T);
14874
- const P = CompositeProperties(T, K);
14875
- const R = Object2(P, options);
14876
- return R;
14877
- }
14878
-
14879
- // ../../node_modules/@sinclair/typebox/build/esm/type/date/date.mjs
14880
- function Date2(options) {
14881
- return CreateType({ [Kind]: "Date", type: "Date" }, options);
14882
- }
14883
-
14884
- // ../../node_modules/@sinclair/typebox/build/esm/type/null/null.mjs
14885
- function Null(options) {
14886
- return CreateType({ [Kind]: "Null", type: "null" }, options);
14887
- }
14888
-
14889
- // ../../node_modules/@sinclair/typebox/build/esm/type/symbol/symbol.mjs
14890
- function Symbol2(options) {
14891
- return CreateType({ [Kind]: "Symbol", type: "symbol" }, options);
14892
- }
14893
-
14894
- // ../../node_modules/@sinclair/typebox/build/esm/type/undefined/undefined.mjs
14895
- function Undefined(options) {
14896
- return CreateType({ [Kind]: "Undefined", type: "undefined" }, options);
14897
- }
14898
-
14899
- // ../../node_modules/@sinclair/typebox/build/esm/type/uint8array/uint8array.mjs
14900
- function Uint8Array2(options) {
14901
- return CreateType({ [Kind]: "Uint8Array", type: "Uint8Array" }, options);
14902
- }
14903
-
14904
- // ../../node_modules/@sinclair/typebox/build/esm/type/unknown/unknown.mjs
14905
- function Unknown(options) {
14906
- return CreateType({ [Kind]: "Unknown" }, options);
14907
- }
14908
-
14909
- // ../../node_modules/@sinclair/typebox/build/esm/type/const/const.mjs
14910
- function FromArray3(T) {
14911
- return T.map((L) => FromValue(L, false));
14912
- }
14913
- function FromProperties7(value) {
14914
- const Acc = {};
14915
- for (const K of globalThis.Object.getOwnPropertyNames(value))
14916
- Acc[K] = Readonly(FromValue(value[K], false));
14917
- return Acc;
14918
- }
14919
- function ConditionalReadonly(T, root) {
14920
- return root === true ? T : Readonly(T);
14921
- }
14922
- function FromValue(value, root) {
14923
- return IsAsyncIterator(value) ? ConditionalReadonly(Any(), root) : IsIterator(value) ? ConditionalReadonly(Any(), root) : IsArray(value) ? Readonly(Tuple(FromArray3(value))) : IsUint8Array(value) ? Uint8Array2() : IsDate(value) ? Date2() : IsObject(value) ? ConditionalReadonly(Object2(FromProperties7(value)), root) : IsFunction(value) ? ConditionalReadonly(Function2([], Unknown()), root) : IsUndefined(value) ? Undefined() : IsNull(value) ? Null() : IsSymbol(value) ? Symbol2() : IsBigInt(value) ? BigInt() : IsNumber(value) ? Literal(value) : IsBoolean(value) ? Literal(value) : IsString(value) ? Literal(value) : Object2({});
14924
- }
14925
- function Const(T, options) {
14926
- return CreateType(FromValue(T, true), options);
14927
- }
14928
-
14929
- // ../../node_modules/@sinclair/typebox/build/esm/type/constructor-parameters/constructor-parameters.mjs
14930
- function ConstructorParameters(schema, options) {
14931
- return IsConstructor(schema) ? Tuple(schema.parameters, options) : Never(options);
14932
- }
14933
-
14934
- // ../../node_modules/@sinclair/typebox/build/esm/type/enum/enum.mjs
14935
- function Enum(item, options) {
14936
- if (IsUndefined(item))
14937
- throw new Error("Enum undefined or empty");
14938
- const values1 = globalThis.Object.getOwnPropertyNames(item).filter((key) => isNaN(key)).map((key) => item[key]);
14939
- const values2 = [...new Set(values1)];
14940
- const anyOf = values2.map((value) => Literal(value));
14941
- return Union(anyOf, { ...options, [Hint]: "Enum" });
14942
- }
14943
-
14944
- // ../../node_modules/@sinclair/typebox/build/esm/type/extends/extends-check.mjs
14945
- var ExtendsResolverError = class extends TypeBoxError {
14946
- };
14947
- var ExtendsResult;
14948
- (function(ExtendsResult2) {
14949
- ExtendsResult2[ExtendsResult2["Union"] = 0] = "Union";
14950
- ExtendsResult2[ExtendsResult2["True"] = 1] = "True";
14951
- ExtendsResult2[ExtendsResult2["False"] = 2] = "False";
14952
- })(ExtendsResult || (ExtendsResult = {}));
14953
- function IntoBooleanResult(result) {
14954
- return result === ExtendsResult.False ? result : ExtendsResult.True;
14955
- }
14956
- function Throw(message) {
14957
- throw new ExtendsResolverError(message);
14958
- }
14959
- function IsStructuralRight(right) {
14960
- return type_exports.IsNever(right) || type_exports.IsIntersect(right) || type_exports.IsUnion(right) || type_exports.IsUnknown(right) || type_exports.IsAny(right);
14961
- }
14962
- function StructuralRight(left, right) {
14963
- return type_exports.IsNever(right) ? FromNeverRight(left, right) : type_exports.IsIntersect(right) ? FromIntersectRight(left, right) : type_exports.IsUnion(right) ? FromUnionRight(left, right) : type_exports.IsUnknown(right) ? FromUnknownRight(left, right) : type_exports.IsAny(right) ? FromAnyRight(left, right) : Throw("StructuralRight");
14964
- }
14965
- function FromAnyRight(left, right) {
14966
- return ExtendsResult.True;
14967
- }
14968
- function FromAny(left, right) {
14969
- return type_exports.IsIntersect(right) ? FromIntersectRight(left, right) : type_exports.IsUnion(right) && right.anyOf.some((schema) => type_exports.IsAny(schema) || type_exports.IsUnknown(schema)) ? ExtendsResult.True : type_exports.IsUnion(right) ? ExtendsResult.Union : type_exports.IsUnknown(right) ? ExtendsResult.True : type_exports.IsAny(right) ? ExtendsResult.True : ExtendsResult.Union;
14970
- }
14971
- function FromArrayRight(left, right) {
14972
- return type_exports.IsUnknown(left) ? ExtendsResult.False : type_exports.IsAny(left) ? ExtendsResult.Union : type_exports.IsNever(left) ? ExtendsResult.True : ExtendsResult.False;
14973
- }
14974
- function FromArray4(left, right) {
14975
- return type_exports.IsObject(right) && IsObjectArrayLike(right) ? ExtendsResult.True : IsStructuralRight(right) ? StructuralRight(left, right) : !type_exports.IsArray(right) ? ExtendsResult.False : IntoBooleanResult(Visit3(left.items, right.items));
14976
- }
14977
- function FromAsyncIterator(left, right) {
14978
- return IsStructuralRight(right) ? StructuralRight(left, right) : !type_exports.IsAsyncIterator(right) ? ExtendsResult.False : IntoBooleanResult(Visit3(left.items, right.items));
14979
- }
14980
- function FromBigInt(left, right) {
14981
- return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : type_exports.IsRecord(right) ? FromRecordRight(left, right) : type_exports.IsBigInt(right) ? ExtendsResult.True : ExtendsResult.False;
14982
- }
14983
- function FromBooleanRight(left, right) {
14984
- return type_exports.IsLiteralBoolean(left) ? ExtendsResult.True : type_exports.IsBoolean(left) ? ExtendsResult.True : ExtendsResult.False;
14985
- }
14986
- function FromBoolean(left, right) {
14987
- return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : type_exports.IsRecord(right) ? FromRecordRight(left, right) : type_exports.IsBoolean(right) ? ExtendsResult.True : ExtendsResult.False;
14988
- }
14989
- function FromConstructor(left, right) {
14990
- return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : !type_exports.IsConstructor(right) ? ExtendsResult.False : left.parameters.length > right.parameters.length ? ExtendsResult.False : !left.parameters.every((schema, index) => IntoBooleanResult(Visit3(right.parameters[index], schema)) === ExtendsResult.True) ? ExtendsResult.False : IntoBooleanResult(Visit3(left.returns, right.returns));
14991
- }
14992
- function FromDate(left, right) {
14993
- return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : type_exports.IsRecord(right) ? FromRecordRight(left, right) : type_exports.IsDate(right) ? ExtendsResult.True : ExtendsResult.False;
14994
- }
14995
- function FromFunction(left, right) {
14996
- return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : !type_exports.IsFunction(right) ? ExtendsResult.False : left.parameters.length > right.parameters.length ? ExtendsResult.False : !left.parameters.every((schema, index) => IntoBooleanResult(Visit3(right.parameters[index], schema)) === ExtendsResult.True) ? ExtendsResult.False : IntoBooleanResult(Visit3(left.returns, right.returns));
14997
- }
14998
- function FromIntegerRight(left, right) {
14999
- return type_exports.IsLiteral(left) && value_exports.IsNumber(left.const) ? ExtendsResult.True : type_exports.IsNumber(left) || type_exports.IsInteger(left) ? ExtendsResult.True : ExtendsResult.False;
15000
- }
15001
- function FromInteger(left, right) {
15002
- return type_exports.IsInteger(right) || type_exports.IsNumber(right) ? ExtendsResult.True : IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : type_exports.IsRecord(right) ? FromRecordRight(left, right) : ExtendsResult.False;
15003
- }
15004
- function FromIntersectRight(left, right) {
15005
- return right.allOf.every((schema) => Visit3(left, schema) === ExtendsResult.True) ? ExtendsResult.True : ExtendsResult.False;
15006
- }
15007
- function FromIntersect4(left, right) {
15008
- return left.allOf.some((schema) => Visit3(schema, right) === ExtendsResult.True) ? ExtendsResult.True : ExtendsResult.False;
15009
- }
15010
- function FromIterator(left, right) {
15011
- return IsStructuralRight(right) ? StructuralRight(left, right) : !type_exports.IsIterator(right) ? ExtendsResult.False : IntoBooleanResult(Visit3(left.items, right.items));
15012
- }
15013
- function FromLiteral2(left, right) {
15014
- return type_exports.IsLiteral(right) && right.const === left.const ? ExtendsResult.True : IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : type_exports.IsRecord(right) ? FromRecordRight(left, right) : type_exports.IsString(right) ? FromStringRight(left, right) : type_exports.IsNumber(right) ? FromNumberRight(left, right) : type_exports.IsInteger(right) ? FromIntegerRight(left, right) : type_exports.IsBoolean(right) ? FromBooleanRight(left, right) : ExtendsResult.False;
15015
- }
15016
- function FromNeverRight(left, right) {
15017
- return ExtendsResult.False;
15018
- }
15019
- function FromNever(left, right) {
15020
- return ExtendsResult.True;
15021
- }
15022
- function UnwrapTNot(schema) {
15023
- let [current, depth] = [schema, 0];
15024
- while (true) {
15025
- if (!type_exports.IsNot(current))
15026
- break;
15027
- current = current.not;
15028
- depth += 1;
15029
- }
15030
- return depth % 2 === 0 ? current : Unknown();
15031
- }
15032
- function FromNot(left, right) {
15033
- return type_exports.IsNot(left) ? Visit3(UnwrapTNot(left), right) : type_exports.IsNot(right) ? Visit3(left, UnwrapTNot(right)) : Throw("Invalid fallthrough for Not");
15034
- }
15035
- function FromNull(left, right) {
15036
- return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : type_exports.IsRecord(right) ? FromRecordRight(left, right) : type_exports.IsNull(right) ? ExtendsResult.True : ExtendsResult.False;
15037
- }
15038
- function FromNumberRight(left, right) {
15039
- return type_exports.IsLiteralNumber(left) ? ExtendsResult.True : type_exports.IsNumber(left) || type_exports.IsInteger(left) ? ExtendsResult.True : ExtendsResult.False;
15040
- }
15041
- function FromNumber(left, right) {
15042
- return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : type_exports.IsRecord(right) ? FromRecordRight(left, right) : type_exports.IsInteger(right) || type_exports.IsNumber(right) ? ExtendsResult.True : ExtendsResult.False;
15043
- }
15044
- function IsObjectPropertyCount(schema, count) {
15045
- return Object.getOwnPropertyNames(schema.properties).length === count;
15046
- }
15047
- function IsObjectStringLike(schema) {
15048
- return IsObjectArrayLike(schema);
15049
- }
15050
- function IsObjectSymbolLike(schema) {
15051
- return IsObjectPropertyCount(schema, 0) || IsObjectPropertyCount(schema, 1) && "description" in schema.properties && type_exports.IsUnion(schema.properties.description) && schema.properties.description.anyOf.length === 2 && (type_exports.IsString(schema.properties.description.anyOf[0]) && type_exports.IsUndefined(schema.properties.description.anyOf[1]) || type_exports.IsString(schema.properties.description.anyOf[1]) && type_exports.IsUndefined(schema.properties.description.anyOf[0]));
15052
- }
15053
- function IsObjectNumberLike(schema) {
15054
- return IsObjectPropertyCount(schema, 0);
15055
- }
15056
- function IsObjectBooleanLike(schema) {
15057
- return IsObjectPropertyCount(schema, 0);
15058
- }
15059
- function IsObjectBigIntLike(schema) {
15060
- return IsObjectPropertyCount(schema, 0);
15061
- }
15062
- function IsObjectDateLike(schema) {
15063
- return IsObjectPropertyCount(schema, 0);
15064
- }
15065
- function IsObjectUint8ArrayLike(schema) {
15066
- return IsObjectArrayLike(schema);
15067
- }
15068
- function IsObjectFunctionLike(schema) {
15069
- const length = Number2();
15070
- return IsObjectPropertyCount(schema, 0) || IsObjectPropertyCount(schema, 1) && "length" in schema.properties && IntoBooleanResult(Visit3(schema.properties["length"], length)) === ExtendsResult.True;
15071
- }
15072
- function IsObjectConstructorLike(schema) {
15073
- return IsObjectPropertyCount(schema, 0);
15074
- }
15075
- function IsObjectArrayLike(schema) {
15076
- const length = Number2();
15077
- return IsObjectPropertyCount(schema, 0) || IsObjectPropertyCount(schema, 1) && "length" in schema.properties && IntoBooleanResult(Visit3(schema.properties["length"], length)) === ExtendsResult.True;
15078
- }
15079
- function IsObjectPromiseLike(schema) {
15080
- const then = Function2([Any()], Any());
15081
- return IsObjectPropertyCount(schema, 0) || IsObjectPropertyCount(schema, 1) && "then" in schema.properties && IntoBooleanResult(Visit3(schema.properties["then"], then)) === ExtendsResult.True;
15082
- }
15083
- function Property(left, right) {
15084
- return Visit3(left, right) === ExtendsResult.False ? ExtendsResult.False : type_exports.IsOptional(left) && !type_exports.IsOptional(right) ? ExtendsResult.False : ExtendsResult.True;
15085
- }
15086
- function FromObjectRight(left, right) {
15087
- return type_exports.IsUnknown(left) ? ExtendsResult.False : type_exports.IsAny(left) ? ExtendsResult.Union : type_exports.IsNever(left) || type_exports.IsLiteralString(left) && IsObjectStringLike(right) || type_exports.IsLiteralNumber(left) && IsObjectNumberLike(right) || type_exports.IsLiteralBoolean(left) && IsObjectBooleanLike(right) || type_exports.IsSymbol(left) && IsObjectSymbolLike(right) || type_exports.IsBigInt(left) && IsObjectBigIntLike(right) || type_exports.IsString(left) && IsObjectStringLike(right) || type_exports.IsSymbol(left) && IsObjectSymbolLike(right) || type_exports.IsNumber(left) && IsObjectNumberLike(right) || type_exports.IsInteger(left) && IsObjectNumberLike(right) || type_exports.IsBoolean(left) && IsObjectBooleanLike(right) || type_exports.IsUint8Array(left) && IsObjectUint8ArrayLike(right) || type_exports.IsDate(left) && IsObjectDateLike(right) || type_exports.IsConstructor(left) && IsObjectConstructorLike(right) || type_exports.IsFunction(left) && IsObjectFunctionLike(right) ? ExtendsResult.True : type_exports.IsRecord(left) && type_exports.IsString(RecordKey(left)) ? (() => {
15088
- return right[Hint] === "Record" ? ExtendsResult.True : ExtendsResult.False;
15089
- })() : type_exports.IsRecord(left) && type_exports.IsNumber(RecordKey(left)) ? (() => {
15090
- return IsObjectPropertyCount(right, 0) ? ExtendsResult.True : ExtendsResult.False;
15091
- })() : ExtendsResult.False;
15092
- }
15093
- function FromObject(left, right) {
15094
- return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsRecord(right) ? FromRecordRight(left, right) : !type_exports.IsObject(right) ? ExtendsResult.False : (() => {
15095
- for (const key of Object.getOwnPropertyNames(right.properties)) {
15096
- if (!(key in left.properties) && !type_exports.IsOptional(right.properties[key])) {
15097
- return ExtendsResult.False;
15098
- }
15099
- if (type_exports.IsOptional(right.properties[key])) {
15100
- return ExtendsResult.True;
15101
- }
15102
- if (Property(left.properties[key], right.properties[key]) === ExtendsResult.False) {
15103
- return ExtendsResult.False;
15104
- }
15105
- }
15106
- return ExtendsResult.True;
15107
- })();
15108
- }
15109
- function FromPromise2(left, right) {
15110
- return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) && IsObjectPromiseLike(right) ? ExtendsResult.True : !type_exports.IsPromise(right) ? ExtendsResult.False : IntoBooleanResult(Visit3(left.item, right.item));
15111
- }
15112
- function RecordKey(schema) {
15113
- return PatternNumberExact in schema.patternProperties ? Number2() : PatternStringExact in schema.patternProperties ? String2() : Throw("Unknown record key pattern");
15114
- }
15115
- function RecordValue(schema) {
15116
- return PatternNumberExact in schema.patternProperties ? schema.patternProperties[PatternNumberExact] : PatternStringExact in schema.patternProperties ? schema.patternProperties[PatternStringExact] : Throw("Unable to get record value schema");
15117
- }
15118
- function FromRecordRight(left, right) {
15119
- const [Key, Value] = [RecordKey(right), RecordValue(right)];
15120
- return type_exports.IsLiteralString(left) && type_exports.IsNumber(Key) && IntoBooleanResult(Visit3(left, Value)) === ExtendsResult.True ? ExtendsResult.True : type_exports.IsUint8Array(left) && type_exports.IsNumber(Key) ? Visit3(left, Value) : type_exports.IsString(left) && type_exports.IsNumber(Key) ? Visit3(left, Value) : type_exports.IsArray(left) && type_exports.IsNumber(Key) ? Visit3(left, Value) : type_exports.IsObject(left) ? (() => {
15121
- for (const key of Object.getOwnPropertyNames(left.properties)) {
15122
- if (Property(Value, left.properties[key]) === ExtendsResult.False) {
15123
- return ExtendsResult.False;
15124
- }
15125
- }
15126
- return ExtendsResult.True;
15127
- })() : ExtendsResult.False;
15128
- }
15129
- function FromRecord(left, right) {
15130
- return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : !type_exports.IsRecord(right) ? ExtendsResult.False : Visit3(RecordValue(left), RecordValue(right));
15131
- }
15132
- function FromRegExp(left, right) {
15133
- const L = type_exports.IsRegExp(left) ? String2() : left;
15134
- const R = type_exports.IsRegExp(right) ? String2() : right;
15135
- return Visit3(L, R);
15136
- }
15137
- function FromStringRight(left, right) {
15138
- return type_exports.IsLiteral(left) && value_exports.IsString(left.const) ? ExtendsResult.True : type_exports.IsString(left) ? ExtendsResult.True : ExtendsResult.False;
15139
- }
15140
- function FromString(left, right) {
15141
- return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : type_exports.IsRecord(right) ? FromRecordRight(left, right) : type_exports.IsString(right) ? ExtendsResult.True : ExtendsResult.False;
15142
- }
15143
- function FromSymbol(left, right) {
15144
- return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : type_exports.IsRecord(right) ? FromRecordRight(left, right) : type_exports.IsSymbol(right) ? ExtendsResult.True : ExtendsResult.False;
15145
- }
15146
- function FromTemplateLiteral2(left, right) {
15147
- return type_exports.IsTemplateLiteral(left) ? Visit3(TemplateLiteralToUnion(left), right) : type_exports.IsTemplateLiteral(right) ? Visit3(left, TemplateLiteralToUnion(right)) : Throw("Invalid fallthrough for TemplateLiteral");
15148
- }
15149
- function IsArrayOfTuple(left, right) {
15150
- return type_exports.IsArray(right) && left.items !== void 0 && left.items.every((schema) => Visit3(schema, right.items) === ExtendsResult.True);
15151
- }
15152
- function FromTupleRight(left, right) {
15153
- return type_exports.IsNever(left) ? ExtendsResult.True : type_exports.IsUnknown(left) ? ExtendsResult.False : type_exports.IsAny(left) ? ExtendsResult.Union : ExtendsResult.False;
15154
- }
15155
- function FromTuple3(left, right) {
15156
- return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) && IsObjectArrayLike(right) ? ExtendsResult.True : type_exports.IsArray(right) && IsArrayOfTuple(left, right) ? ExtendsResult.True : !type_exports.IsTuple(right) ? ExtendsResult.False : value_exports.IsUndefined(left.items) && !value_exports.IsUndefined(right.items) || !value_exports.IsUndefined(left.items) && value_exports.IsUndefined(right.items) ? ExtendsResult.False : value_exports.IsUndefined(left.items) && !value_exports.IsUndefined(right.items) ? ExtendsResult.True : left.items.every((schema, index) => Visit3(schema, right.items[index]) === ExtendsResult.True) ? ExtendsResult.True : ExtendsResult.False;
15157
- }
15158
- function FromUint8Array(left, right) {
15159
- return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : type_exports.IsRecord(right) ? FromRecordRight(left, right) : type_exports.IsUint8Array(right) ? ExtendsResult.True : ExtendsResult.False;
15160
- }
15161
- function FromUndefined(left, right) {
15162
- return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : type_exports.IsRecord(right) ? FromRecordRight(left, right) : type_exports.IsVoid(right) ? FromVoidRight(left, right) : type_exports.IsUndefined(right) ? ExtendsResult.True : ExtendsResult.False;
15163
- }
15164
- function FromUnionRight(left, right) {
15165
- return right.anyOf.some((schema) => Visit3(left, schema) === ExtendsResult.True) ? ExtendsResult.True : ExtendsResult.False;
15166
- }
15167
- function FromUnion6(left, right) {
15168
- return left.anyOf.every((schema) => Visit3(schema, right) === ExtendsResult.True) ? ExtendsResult.True : ExtendsResult.False;
15169
- }
15170
- function FromUnknownRight(left, right) {
15171
- return ExtendsResult.True;
15172
- }
15173
- function FromUnknown(left, right) {
15174
- return type_exports.IsNever(right) ? FromNeverRight(left, right) : type_exports.IsIntersect(right) ? FromIntersectRight(left, right) : type_exports.IsUnion(right) ? FromUnionRight(left, right) : type_exports.IsAny(right) ? FromAnyRight(left, right) : type_exports.IsString(right) ? FromStringRight(left, right) : type_exports.IsNumber(right) ? FromNumberRight(left, right) : type_exports.IsInteger(right) ? FromIntegerRight(left, right) : type_exports.IsBoolean(right) ? FromBooleanRight(left, right) : type_exports.IsArray(right) ? FromArrayRight(left, right) : type_exports.IsTuple(right) ? FromTupleRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : type_exports.IsUnknown(right) ? ExtendsResult.True : ExtendsResult.False;
15175
- }
15176
- function FromVoidRight(left, right) {
15177
- return type_exports.IsUndefined(left) ? ExtendsResult.True : type_exports.IsUndefined(left) ? ExtendsResult.True : ExtendsResult.False;
15178
- }
15179
- function FromVoid(left, right) {
15180
- return type_exports.IsIntersect(right) ? FromIntersectRight(left, right) : type_exports.IsUnion(right) ? FromUnionRight(left, right) : type_exports.IsUnknown(right) ? FromUnknownRight(left, right) : type_exports.IsAny(right) ? FromAnyRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : type_exports.IsVoid(right) ? ExtendsResult.True : ExtendsResult.False;
15181
- }
15182
- function Visit3(left, right) {
15183
- return (
15184
- // resolvable
15185
- type_exports.IsTemplateLiteral(left) || type_exports.IsTemplateLiteral(right) ? FromTemplateLiteral2(left, right) : type_exports.IsRegExp(left) || type_exports.IsRegExp(right) ? FromRegExp(left, right) : type_exports.IsNot(left) || type_exports.IsNot(right) ? FromNot(left, right) : (
15186
- // standard
15187
- type_exports.IsAny(left) ? FromAny(left, right) : type_exports.IsArray(left) ? FromArray4(left, right) : type_exports.IsBigInt(left) ? FromBigInt(left, right) : type_exports.IsBoolean(left) ? FromBoolean(left, right) : type_exports.IsAsyncIterator(left) ? FromAsyncIterator(left, right) : type_exports.IsConstructor(left) ? FromConstructor(left, right) : type_exports.IsDate(left) ? FromDate(left, right) : type_exports.IsFunction(left) ? FromFunction(left, right) : type_exports.IsInteger(left) ? FromInteger(left, right) : type_exports.IsIntersect(left) ? FromIntersect4(left, right) : type_exports.IsIterator(left) ? FromIterator(left, right) : type_exports.IsLiteral(left) ? FromLiteral2(left, right) : type_exports.IsNever(left) ? FromNever(left, right) : type_exports.IsNull(left) ? FromNull(left, right) : type_exports.IsNumber(left) ? FromNumber(left, right) : type_exports.IsObject(left) ? FromObject(left, right) : type_exports.IsRecord(left) ? FromRecord(left, right) : type_exports.IsString(left) ? FromString(left, right) : type_exports.IsSymbol(left) ? FromSymbol(left, right) : type_exports.IsTuple(left) ? FromTuple3(left, right) : type_exports.IsPromise(left) ? FromPromise2(left, right) : type_exports.IsUint8Array(left) ? FromUint8Array(left, right) : type_exports.IsUndefined(left) ? FromUndefined(left, right) : type_exports.IsUnion(left) ? FromUnion6(left, right) : type_exports.IsUnknown(left) ? FromUnknown(left, right) : type_exports.IsVoid(left) ? FromVoid(left, right) : Throw(`Unknown left type operand '${left[Kind]}'`)
15188
- )
15189
- );
15190
- }
15191
- function ExtendsCheck(left, right) {
15192
- return Visit3(left, right);
15193
- }
15194
-
15195
- // ../../node_modules/@sinclair/typebox/build/esm/type/extends/extends-from-mapped-result.mjs
15196
- function FromProperties8(P, Right, True, False, options) {
15197
- const Acc = {};
15198
- for (const K2 of globalThis.Object.getOwnPropertyNames(P))
15199
- Acc[K2] = Extends(P[K2], Right, True, False, Clone(options));
15200
- return Acc;
15201
- }
15202
- function FromMappedResult6(Left, Right, True, False, options) {
15203
- return FromProperties8(Left.properties, Right, True, False, options);
15204
- }
15205
- function ExtendsFromMappedResult(Left, Right, True, False, options) {
15206
- const P = FromMappedResult6(Left, Right, True, False, options);
15207
- return MappedResult(P);
15208
- }
15209
-
15210
- // ../../node_modules/@sinclair/typebox/build/esm/type/extends/extends.mjs
15211
- function ExtendsResolve(left, right, trueType, falseType) {
15212
- const R = ExtendsCheck(left, right);
15213
- return R === ExtendsResult.Union ? Union([trueType, falseType]) : R === ExtendsResult.True ? trueType : falseType;
15214
- }
15215
- function Extends(L, R, T, F, options) {
15216
- return IsMappedResult(L) ? ExtendsFromMappedResult(L, R, T, F, options) : IsMappedKey(L) ? CreateType(ExtendsFromMappedKey(L, R, T, F, options)) : CreateType(ExtendsResolve(L, R, T, F), options);
15217
- }
15218
-
15219
- // ../../node_modules/@sinclair/typebox/build/esm/type/extends/extends-from-mapped-key.mjs
15220
- function FromPropertyKey(K, U, L, R, options) {
15221
- return {
15222
- [K]: Extends(Literal(K), U, L, R, Clone(options))
15223
- };
15224
- }
15225
- function FromPropertyKeys(K, U, L, R, options) {
15226
- return K.reduce((Acc, LK) => {
15227
- return { ...Acc, ...FromPropertyKey(LK, U, L, R, options) };
15228
- }, {});
15229
- }
15230
- function FromMappedKey2(K, U, L, R, options) {
15231
- return FromPropertyKeys(K.keys, U, L, R, options);
15232
- }
15233
- function ExtendsFromMappedKey(T, U, L, R, options) {
15234
- const P = FromMappedKey2(T, U, L, R, options);
15235
- return MappedResult(P);
15236
- }
15237
-
15238
- // ../../node_modules/@sinclair/typebox/build/esm/type/exclude/exclude-from-template-literal.mjs
15239
- function ExcludeFromTemplateLiteral(L, R) {
15240
- return Exclude(TemplateLiteralToUnion(L), R);
15241
- }
15242
-
15243
- // ../../node_modules/@sinclair/typebox/build/esm/type/exclude/exclude.mjs
15244
- function ExcludeRest(L, R) {
15245
- const excluded = L.filter((inner) => ExtendsCheck(inner, R) === ExtendsResult.False);
15246
- return excluded.length === 1 ? excluded[0] : Union(excluded);
15247
- }
15248
- function Exclude(L, R, options = {}) {
15249
- if (IsTemplateLiteral(L))
15250
- return CreateType(ExcludeFromTemplateLiteral(L, R), options);
15251
- if (IsMappedResult(L))
15252
- return CreateType(ExcludeFromMappedResult(L, R), options);
15253
- return CreateType(IsUnion(L) ? ExcludeRest(L.anyOf, R) : ExtendsCheck(L, R) !== ExtendsResult.False ? Never() : L, options);
15254
- }
15255
-
15256
- // ../../node_modules/@sinclair/typebox/build/esm/type/exclude/exclude-from-mapped-result.mjs
15257
- function FromProperties9(P, U) {
15258
- const Acc = {};
15259
- for (const K2 of globalThis.Object.getOwnPropertyNames(P))
15260
- Acc[K2] = Exclude(P[K2], U);
15261
- return Acc;
15262
- }
15263
- function FromMappedResult7(R, T) {
15264
- return FromProperties9(R.properties, T);
15265
- }
15266
- function ExcludeFromMappedResult(R, T) {
15267
- const P = FromMappedResult7(R, T);
15268
- return MappedResult(P);
15269
- }
15270
-
15271
- // ../../node_modules/@sinclair/typebox/build/esm/type/extract/extract-from-template-literal.mjs
15272
- function ExtractFromTemplateLiteral(L, R) {
15273
- return Extract(TemplateLiteralToUnion(L), R);
15274
- }
15275
-
15276
- // ../../node_modules/@sinclair/typebox/build/esm/type/extract/extract.mjs
15277
- function ExtractRest(L, R) {
15278
- const extracted = L.filter((inner) => ExtendsCheck(inner, R) !== ExtendsResult.False);
15279
- return extracted.length === 1 ? extracted[0] : Union(extracted);
15280
- }
15281
- function Extract(L, R, options) {
15282
- if (IsTemplateLiteral(L))
15283
- return CreateType(ExtractFromTemplateLiteral(L, R), options);
15284
- if (IsMappedResult(L))
15285
- return CreateType(ExtractFromMappedResult(L, R), options);
15286
- return CreateType(IsUnion(L) ? ExtractRest(L.anyOf, R) : ExtendsCheck(L, R) !== ExtendsResult.False ? L : Never(), options);
15287
- }
15288
-
15289
- // ../../node_modules/@sinclair/typebox/build/esm/type/extract/extract-from-mapped-result.mjs
15290
- function FromProperties10(P, T) {
15291
- const Acc = {};
15292
- for (const K2 of globalThis.Object.getOwnPropertyNames(P))
15293
- Acc[K2] = Extract(P[K2], T);
15294
- return Acc;
15295
- }
15296
- function FromMappedResult8(R, T) {
15297
- return FromProperties10(R.properties, T);
15298
- }
15299
- function ExtractFromMappedResult(R, T) {
15300
- const P = FromMappedResult8(R, T);
15301
- return MappedResult(P);
15302
- }
15303
-
15304
- // ../../node_modules/@sinclair/typebox/build/esm/type/instance-type/instance-type.mjs
15305
- function InstanceType(schema, options) {
15306
- return IsConstructor(schema) ? CreateType(schema.returns, options) : Never(options);
15307
- }
15308
-
15309
- // ../../node_modules/@sinclair/typebox/build/esm/type/readonly-optional/readonly-optional.mjs
15310
- function ReadonlyOptional(schema) {
15311
- return Readonly(Optional(schema));
15312
- }
15313
-
15314
- // ../../node_modules/@sinclair/typebox/build/esm/type/record/record.mjs
15315
- function RecordCreateFromPattern(pattern, T, options) {
15316
- return CreateType({ [Kind]: "Record", type: "object", patternProperties: { [pattern]: T } }, options);
15317
- }
15318
- function RecordCreateFromKeys(K, T, options) {
15319
- const result = {};
15320
- for (const K2 of K)
15321
- result[K2] = T;
15322
- return Object2(result, { ...options, [Hint]: "Record" });
15323
- }
15324
- function FromTemplateLiteralKey(K, T, options) {
15325
- return IsTemplateLiteralFinite(K) ? RecordCreateFromKeys(IndexPropertyKeys(K), T, options) : RecordCreateFromPattern(K.pattern, T, options);
15326
- }
15327
- function FromUnionKey(key, type, options) {
15328
- return RecordCreateFromKeys(IndexPropertyKeys(Union(key)), type, options);
15329
- }
15330
- function FromLiteralKey(key, type, options) {
15331
- return RecordCreateFromKeys([key.toString()], type, options);
15332
- }
15333
- function FromRegExpKey(key, type, options) {
15334
- return RecordCreateFromPattern(key.source, type, options);
15335
- }
15336
- function FromStringKey(key, type, options) {
15337
- const pattern = IsUndefined(key.pattern) ? PatternStringExact : key.pattern;
15338
- return RecordCreateFromPattern(pattern, type, options);
15339
- }
15340
- function FromAnyKey(_, type, options) {
15341
- return RecordCreateFromPattern(PatternStringExact, type, options);
15342
- }
15343
- function FromNeverKey(_key, type, options) {
15344
- return RecordCreateFromPattern(PatternNeverExact, type, options);
15345
- }
15346
- function FromBooleanKey(_key, type, options) {
15347
- return Object2({ true: type, false: type }, options);
15348
- }
15349
- function FromIntegerKey(_key, type, options) {
15350
- return RecordCreateFromPattern(PatternNumberExact, type, options);
15351
- }
15352
- function FromNumberKey(_, type, options) {
15353
- return RecordCreateFromPattern(PatternNumberExact, type, options);
15354
- }
15355
- function Record(key, type, options = {}) {
15356
- return IsUnion(key) ? FromUnionKey(key.anyOf, type, options) : IsTemplateLiteral(key) ? FromTemplateLiteralKey(key, type, options) : IsLiteral(key) ? FromLiteralKey(key.const, type, options) : IsBoolean2(key) ? FromBooleanKey(key, type, options) : IsInteger(key) ? FromIntegerKey(key, type, options) : IsNumber3(key) ? FromNumberKey(key, type, options) : IsRegExp2(key) ? FromRegExpKey(key, type, options) : IsString2(key) ? FromStringKey(key, type, options) : IsAny(key) ? FromAnyKey(key, type, options) : IsNever(key) ? FromNeverKey(key, type, options) : Never(options);
15357
- }
15358
- function RecordPattern(record) {
15359
- return globalThis.Object.getOwnPropertyNames(record.patternProperties)[0];
15360
- }
15361
- function RecordKey2(type) {
15362
- const pattern = RecordPattern(type);
15363
- return pattern === PatternStringExact ? String2() : pattern === PatternNumberExact ? Number2() : String2({ pattern });
15364
- }
15365
- function RecordValue2(type) {
15366
- return type.patternProperties[RecordPattern(type)];
15367
- }
15368
-
15369
- // ../../node_modules/@sinclair/typebox/build/esm/type/instantiate/instantiate.mjs
15370
- function FromConstructor2(args, type) {
15371
- type.parameters = FromTypes(args, type.parameters);
15372
- type.returns = FromType(args, type.returns);
15373
- return type;
15374
- }
15375
- function FromFunction2(args, type) {
15376
- type.parameters = FromTypes(args, type.parameters);
15377
- type.returns = FromType(args, type.returns);
15378
- return type;
15379
- }
15380
- function FromIntersect5(args, type) {
15381
- type.allOf = FromTypes(args, type.allOf);
15382
- return type;
15383
- }
15384
- function FromUnion7(args, type) {
15385
- type.anyOf = FromTypes(args, type.anyOf);
15386
- return type;
15387
- }
15388
- function FromTuple4(args, type) {
15389
- if (IsUndefined(type.items))
15390
- return type;
15391
- type.items = FromTypes(args, type.items);
15392
- return type;
15393
- }
15394
- function FromArray5(args, type) {
15395
- type.items = FromType(args, type.items);
15396
- return type;
15397
- }
15398
- function FromAsyncIterator2(args, type) {
15399
- type.items = FromType(args, type.items);
15400
- return type;
15401
- }
15402
- function FromIterator2(args, type) {
15403
- type.items = FromType(args, type.items);
15404
- return type;
15405
- }
15406
- function FromPromise3(args, type) {
15407
- type.item = FromType(args, type.item);
15408
- return type;
15409
- }
15410
- function FromObject2(args, type) {
15411
- const mappedProperties = FromProperties11(args, type.properties);
15412
- return { ...type, ...Object2(mappedProperties) };
15413
- }
15414
- function FromRecord2(args, type) {
15415
- const mappedKey = FromType(args, RecordKey2(type));
15416
- const mappedValue = FromType(args, RecordValue2(type));
15417
- const result = Record(mappedKey, mappedValue);
15418
- return { ...type, ...result };
15419
- }
15420
- function FromArgument(args, argument) {
15421
- return argument.index in args ? args[argument.index] : Unknown();
15422
- }
15423
- function FromProperty2(args, type) {
15424
- const isReadonly = IsReadonly(type);
15425
- const isOptional = IsOptional(type);
15426
- const mapped = FromType(args, type);
15427
- return isReadonly && isOptional ? ReadonlyOptional(mapped) : isReadonly && !isOptional ? Readonly(mapped) : !isReadonly && isOptional ? Optional(mapped) : mapped;
15428
- }
15429
- function FromProperties11(args, properties) {
15430
- return globalThis.Object.getOwnPropertyNames(properties).reduce((result, key) => {
15431
- return { ...result, [key]: FromProperty2(args, properties[key]) };
15432
- }, {});
15433
- }
15434
- function FromTypes(args, types) {
15435
- return types.map((type) => FromType(args, type));
15436
- }
15437
- function FromType(args, type) {
15438
- return IsConstructor(type) ? FromConstructor2(args, type) : IsFunction2(type) ? FromFunction2(args, type) : IsIntersect(type) ? FromIntersect5(args, type) : IsUnion(type) ? FromUnion7(args, type) : IsTuple(type) ? FromTuple4(args, type) : IsArray3(type) ? FromArray5(args, type) : IsAsyncIterator2(type) ? FromAsyncIterator2(args, type) : IsIterator2(type) ? FromIterator2(args, type) : IsPromise(type) ? FromPromise3(args, type) : IsObject3(type) ? FromObject2(args, type) : IsRecord(type) ? FromRecord2(args, type) : IsArgument(type) ? FromArgument(args, type) : type;
15439
- }
15440
- function Instantiate(type, args) {
15441
- return FromType(args, CloneType(type));
15442
- }
15443
-
15444
- // ../../node_modules/@sinclair/typebox/build/esm/type/integer/integer.mjs
15445
- function Integer(options) {
15446
- return CreateType({ [Kind]: "Integer", type: "integer" }, options);
15447
- }
15448
-
15449
- // ../../node_modules/@sinclair/typebox/build/esm/type/intrinsic/intrinsic-from-mapped-key.mjs
15450
- function MappedIntrinsicPropertyKey(K, M, options) {
15451
- return {
15452
- [K]: Intrinsic(Literal(K), M, Clone(options))
15453
- };
15454
- }
15455
- function MappedIntrinsicPropertyKeys(K, M, options) {
15456
- const result = K.reduce((Acc, L) => {
15457
- return { ...Acc, ...MappedIntrinsicPropertyKey(L, M, options) };
15458
- }, {});
15459
- return result;
15460
- }
15461
- function MappedIntrinsicProperties(T, M, options) {
15462
- return MappedIntrinsicPropertyKeys(T["keys"], M, options);
15463
- }
15464
- function IntrinsicFromMappedKey(T, M, options) {
15465
- const P = MappedIntrinsicProperties(T, M, options);
15466
- return MappedResult(P);
15467
- }
15468
-
15469
- // ../../node_modules/@sinclair/typebox/build/esm/type/intrinsic/intrinsic.mjs
15470
- function ApplyUncapitalize(value) {
15471
- const [first, rest] = [value.slice(0, 1), value.slice(1)];
15472
- return [first.toLowerCase(), rest].join("");
15473
- }
15474
- function ApplyCapitalize(value) {
15475
- const [first, rest] = [value.slice(0, 1), value.slice(1)];
15476
- return [first.toUpperCase(), rest].join("");
15477
- }
15478
- function ApplyUppercase(value) {
15479
- return value.toUpperCase();
15480
- }
15481
- function ApplyLowercase(value) {
15482
- return value.toLowerCase();
15483
- }
15484
- function FromTemplateLiteral3(schema, mode, options) {
15485
- const expression = TemplateLiteralParseExact(schema.pattern);
15486
- const finite = IsTemplateLiteralExpressionFinite(expression);
15487
- if (!finite)
15488
- return { ...schema, pattern: FromLiteralValue(schema.pattern, mode) };
15489
- const strings = [...TemplateLiteralExpressionGenerate(expression)];
15490
- const literals = strings.map((value) => Literal(value));
15491
- const mapped = FromRest5(literals, mode);
15492
- const union = Union(mapped);
15493
- return TemplateLiteral([union], options);
15494
- }
15495
- function FromLiteralValue(value, mode) {
15496
- return typeof value === "string" ? mode === "Uncapitalize" ? ApplyUncapitalize(value) : mode === "Capitalize" ? ApplyCapitalize(value) : mode === "Uppercase" ? ApplyUppercase(value) : mode === "Lowercase" ? ApplyLowercase(value) : value : value.toString();
15497
- }
15498
- function FromRest5(T, M) {
15499
- return T.map((L) => Intrinsic(L, M));
15500
- }
15501
- function Intrinsic(schema, mode, options = {}) {
15502
- return (
15503
- // Intrinsic-Mapped-Inference
15504
- IsMappedKey(schema) ? IntrinsicFromMappedKey(schema, mode, options) : (
15505
- // Standard-Inference
15506
- IsTemplateLiteral(schema) ? FromTemplateLiteral3(schema, mode, options) : IsUnion(schema) ? Union(FromRest5(schema.anyOf, mode), options) : IsLiteral(schema) ? Literal(FromLiteralValue(schema.const, mode), options) : (
15507
- // Default Type
15508
- CreateType(schema, options)
15509
- )
15510
- )
15511
- );
15512
- }
15513
-
15514
- // ../../node_modules/@sinclair/typebox/build/esm/type/intrinsic/capitalize.mjs
15515
- function Capitalize(T, options = {}) {
15516
- return Intrinsic(T, "Capitalize", options);
15517
- }
15518
-
15519
- // ../../node_modules/@sinclair/typebox/build/esm/type/intrinsic/lowercase.mjs
15520
- function Lowercase(T, options = {}) {
15521
- return Intrinsic(T, "Lowercase", options);
15522
- }
15523
-
15524
- // ../../node_modules/@sinclair/typebox/build/esm/type/intrinsic/uncapitalize.mjs
15525
- function Uncapitalize(T, options = {}) {
15526
- return Intrinsic(T, "Uncapitalize", options);
15527
- }
15528
-
15529
- // ../../node_modules/@sinclair/typebox/build/esm/type/intrinsic/uppercase.mjs
15530
- function Uppercase(T, options = {}) {
15531
- return Intrinsic(T, "Uppercase", options);
15532
- }
15533
-
15534
- // ../../node_modules/@sinclair/typebox/build/esm/type/omit/omit-from-mapped-result.mjs
15535
- function FromProperties12(properties, propertyKeys, options) {
15536
- const result = {};
15537
- for (const K2 of globalThis.Object.getOwnPropertyNames(properties))
15538
- result[K2] = Omit(properties[K2], propertyKeys, Clone(options));
15539
- return result;
15540
- }
15541
- function FromMappedResult9(mappedResult, propertyKeys, options) {
15542
- return FromProperties12(mappedResult.properties, propertyKeys, options);
15543
- }
15544
- function OmitFromMappedResult(mappedResult, propertyKeys, options) {
15545
- const properties = FromMappedResult9(mappedResult, propertyKeys, options);
15546
- return MappedResult(properties);
15547
- }
15548
-
15549
- // ../../node_modules/@sinclair/typebox/build/esm/type/omit/omit.mjs
15550
- function FromIntersect6(types, propertyKeys) {
15551
- return types.map((type) => OmitResolve(type, propertyKeys));
15552
- }
15553
- function FromUnion8(types, propertyKeys) {
15554
- return types.map((type) => OmitResolve(type, propertyKeys));
15555
- }
15556
- function FromProperty3(properties, key) {
15557
- const { [key]: _, ...R } = properties;
15558
- return R;
15559
- }
15560
- function FromProperties13(properties, propertyKeys) {
15561
- return propertyKeys.reduce((T, K2) => FromProperty3(T, K2), properties);
15562
- }
15563
- function FromObject3(type, propertyKeys, properties) {
15564
- const options = Discard(type, [TransformKind, "$id", "required", "properties"]);
15565
- const mappedProperties = FromProperties13(properties, propertyKeys);
15566
- return Object2(mappedProperties, options);
15567
- }
15568
- function UnionFromPropertyKeys(propertyKeys) {
15569
- const result = propertyKeys.reduce((result2, key) => IsLiteralValue(key) ? [...result2, Literal(key)] : result2, []);
15570
- return Union(result);
15571
- }
15572
- function OmitResolve(type, propertyKeys) {
15573
- return IsIntersect(type) ? Intersect(FromIntersect6(type.allOf, propertyKeys)) : IsUnion(type) ? Union(FromUnion8(type.anyOf, propertyKeys)) : IsObject3(type) ? FromObject3(type, propertyKeys, type.properties) : Object2({});
15574
- }
15575
- function Omit(type, key, options) {
15576
- const typeKey = IsArray(key) ? UnionFromPropertyKeys(key) : key;
15577
- const propertyKeys = IsSchema(key) ? IndexPropertyKeys(key) : key;
15578
- const isTypeRef = IsRef(type);
15579
- const isKeyRef = IsRef(key);
15580
- return IsMappedResult(type) ? OmitFromMappedResult(type, propertyKeys, options) : IsMappedKey(key) ? OmitFromMappedKey(type, key, options) : isTypeRef && isKeyRef ? Computed("Omit", [type, typeKey], options) : !isTypeRef && isKeyRef ? Computed("Omit", [type, typeKey], options) : isTypeRef && !isKeyRef ? Computed("Omit", [type, typeKey], options) : CreateType({ ...OmitResolve(type, propertyKeys), ...options });
15581
- }
15582
-
15583
- // ../../node_modules/@sinclair/typebox/build/esm/type/omit/omit-from-mapped-key.mjs
15584
- function FromPropertyKey2(type, key, options) {
15585
- return { [key]: Omit(type, [key], Clone(options)) };
15586
- }
15587
- function FromPropertyKeys2(type, propertyKeys, options) {
15588
- return propertyKeys.reduce((Acc, LK) => {
15589
- return { ...Acc, ...FromPropertyKey2(type, LK, options) };
15590
- }, {});
15591
- }
15592
- function FromMappedKey3(type, mappedKey, options) {
15593
- return FromPropertyKeys2(type, mappedKey.keys, options);
15594
- }
15595
- function OmitFromMappedKey(type, mappedKey, options) {
15596
- const properties = FromMappedKey3(type, mappedKey, options);
15597
- return MappedResult(properties);
15598
- }
15599
-
15600
- // ../../node_modules/@sinclair/typebox/build/esm/type/pick/pick-from-mapped-result.mjs
15601
- function FromProperties14(properties, propertyKeys, options) {
15602
- const result = {};
15603
- for (const K2 of globalThis.Object.getOwnPropertyNames(properties))
15604
- result[K2] = Pick(properties[K2], propertyKeys, Clone(options));
15605
- return result;
15606
- }
15607
- function FromMappedResult10(mappedResult, propertyKeys, options) {
15608
- return FromProperties14(mappedResult.properties, propertyKeys, options);
15609
- }
15610
- function PickFromMappedResult(mappedResult, propertyKeys, options) {
15611
- const properties = FromMappedResult10(mappedResult, propertyKeys, options);
15612
- return MappedResult(properties);
15613
- }
15614
-
15615
- // ../../node_modules/@sinclair/typebox/build/esm/type/pick/pick.mjs
15616
- function FromIntersect7(types, propertyKeys) {
15617
- return types.map((type) => PickResolve(type, propertyKeys));
15618
- }
15619
- function FromUnion9(types, propertyKeys) {
15620
- return types.map((type) => PickResolve(type, propertyKeys));
15621
- }
15622
- function FromProperties15(properties, propertyKeys) {
15623
- const result = {};
15624
- for (const K2 of propertyKeys)
15625
- if (K2 in properties)
15626
- result[K2] = properties[K2];
15627
- return result;
15628
- }
15629
- function FromObject4(Type2, keys, properties) {
15630
- const options = Discard(Type2, [TransformKind, "$id", "required", "properties"]);
15631
- const mappedProperties = FromProperties15(properties, keys);
15632
- return Object2(mappedProperties, options);
15633
- }
15634
- function UnionFromPropertyKeys2(propertyKeys) {
15635
- const result = propertyKeys.reduce((result2, key) => IsLiteralValue(key) ? [...result2, Literal(key)] : result2, []);
15636
- return Union(result);
15637
- }
15638
- function PickResolve(type, propertyKeys) {
15639
- return IsIntersect(type) ? Intersect(FromIntersect7(type.allOf, propertyKeys)) : IsUnion(type) ? Union(FromUnion9(type.anyOf, propertyKeys)) : IsObject3(type) ? FromObject4(type, propertyKeys, type.properties) : Object2({});
15640
- }
15641
- function Pick(type, key, options) {
15642
- const typeKey = IsArray(key) ? UnionFromPropertyKeys2(key) : key;
15643
- const propertyKeys = IsSchema(key) ? IndexPropertyKeys(key) : key;
15644
- const isTypeRef = IsRef(type);
15645
- const isKeyRef = IsRef(key);
15646
- return IsMappedResult(type) ? PickFromMappedResult(type, propertyKeys, options) : IsMappedKey(key) ? PickFromMappedKey(type, key, options) : isTypeRef && isKeyRef ? Computed("Pick", [type, typeKey], options) : !isTypeRef && isKeyRef ? Computed("Pick", [type, typeKey], options) : isTypeRef && !isKeyRef ? Computed("Pick", [type, typeKey], options) : CreateType({ ...PickResolve(type, propertyKeys), ...options });
15647
- }
15648
-
15649
- // ../../node_modules/@sinclair/typebox/build/esm/type/pick/pick-from-mapped-key.mjs
15650
- function FromPropertyKey3(type, key, options) {
15651
- return {
15652
- [key]: Pick(type, [key], Clone(options))
15653
- };
15654
- }
15655
- function FromPropertyKeys3(type, propertyKeys, options) {
15656
- return propertyKeys.reduce((result, leftKey) => {
15657
- return { ...result, ...FromPropertyKey3(type, leftKey, options) };
15658
- }, {});
15659
- }
15660
- function FromMappedKey4(type, mappedKey, options) {
15661
- return FromPropertyKeys3(type, mappedKey.keys, options);
15662
- }
15663
- function PickFromMappedKey(type, mappedKey, options) {
15664
- const properties = FromMappedKey4(type, mappedKey, options);
15665
- return MappedResult(properties);
15666
- }
15667
-
15668
- // ../../node_modules/@sinclair/typebox/build/esm/type/partial/partial.mjs
15669
- function FromComputed3(target, parameters) {
15670
- return Computed("Partial", [Computed(target, parameters)]);
15671
- }
15672
- function FromRef3($ref) {
15673
- return Computed("Partial", [Ref($ref)]);
15674
- }
15675
- function FromProperties16(properties) {
15676
- const partialProperties = {};
15677
- for (const K of globalThis.Object.getOwnPropertyNames(properties))
15678
- partialProperties[K] = Optional(properties[K]);
15679
- return partialProperties;
15680
- }
15681
- function FromObject5(type, properties) {
15682
- const options = Discard(type, [TransformKind, "$id", "required", "properties"]);
15683
- const mappedProperties = FromProperties16(properties);
15684
- return Object2(mappedProperties, options);
15685
- }
15686
- function FromRest6(types) {
15687
- return types.map((type) => PartialResolve(type));
15688
- }
15689
- function PartialResolve(type) {
15690
- return (
15691
- // Mappable
15692
- IsComputed(type) ? FromComputed3(type.target, type.parameters) : IsRef(type) ? FromRef3(type.$ref) : IsIntersect(type) ? Intersect(FromRest6(type.allOf)) : IsUnion(type) ? Union(FromRest6(type.anyOf)) : IsObject3(type) ? FromObject5(type, type.properties) : (
15693
- // Intrinsic
15694
- IsBigInt2(type) ? type : IsBoolean2(type) ? type : IsInteger(type) ? type : IsLiteral(type) ? type : IsNull2(type) ? type : IsNumber3(type) ? type : IsString2(type) ? type : IsSymbol2(type) ? type : IsUndefined3(type) ? type : (
15695
- // Passthrough
15696
- Object2({})
15697
- )
15698
- )
15699
- );
15700
- }
15701
- function Partial(type, options) {
15702
- if (IsMappedResult(type)) {
15703
- return PartialFromMappedResult(type, options);
15704
- } else {
15705
- return CreateType({ ...PartialResolve(type), ...options });
15706
- }
15707
- }
15708
-
15709
- // ../../node_modules/@sinclair/typebox/build/esm/type/partial/partial-from-mapped-result.mjs
15710
- function FromProperties17(K, options) {
15711
- const Acc = {};
15712
- for (const K2 of globalThis.Object.getOwnPropertyNames(K))
15713
- Acc[K2] = Partial(K[K2], Clone(options));
15714
- return Acc;
15715
- }
15716
- function FromMappedResult11(R, options) {
15717
- return FromProperties17(R.properties, options);
15718
- }
15719
- function PartialFromMappedResult(R, options) {
15720
- const P = FromMappedResult11(R, options);
15721
- return MappedResult(P);
15722
- }
15723
-
15724
- // ../../node_modules/@sinclair/typebox/build/esm/type/required/required.mjs
15725
- function FromComputed4(target, parameters) {
15726
- return Computed("Required", [Computed(target, parameters)]);
15727
- }
15728
- function FromRef4($ref) {
15729
- return Computed("Required", [Ref($ref)]);
15730
- }
15731
- function FromProperties18(properties) {
15732
- const requiredProperties = {};
15733
- for (const K of globalThis.Object.getOwnPropertyNames(properties))
15734
- requiredProperties[K] = Discard(properties[K], [OptionalKind]);
15735
- return requiredProperties;
15736
- }
15737
- function FromObject6(type, properties) {
15738
- const options = Discard(type, [TransformKind, "$id", "required", "properties"]);
15739
- const mappedProperties = FromProperties18(properties);
15740
- return Object2(mappedProperties, options);
15741
- }
15742
- function FromRest7(types) {
15743
- return types.map((type) => RequiredResolve(type));
15744
- }
15745
- function RequiredResolve(type) {
15746
- return (
15747
- // Mappable
15748
- IsComputed(type) ? FromComputed4(type.target, type.parameters) : IsRef(type) ? FromRef4(type.$ref) : IsIntersect(type) ? Intersect(FromRest7(type.allOf)) : IsUnion(type) ? Union(FromRest7(type.anyOf)) : IsObject3(type) ? FromObject6(type, type.properties) : (
15749
- // Intrinsic
15750
- IsBigInt2(type) ? type : IsBoolean2(type) ? type : IsInteger(type) ? type : IsLiteral(type) ? type : IsNull2(type) ? type : IsNumber3(type) ? type : IsString2(type) ? type : IsSymbol2(type) ? type : IsUndefined3(type) ? type : (
15751
- // Passthrough
15752
- Object2({})
15753
- )
15754
- )
15755
- );
15756
- }
15757
- function Required(type, options) {
15758
- if (IsMappedResult(type)) {
15759
- return RequiredFromMappedResult(type, options);
15760
- } else {
15761
- return CreateType({ ...RequiredResolve(type), ...options });
15762
- }
15763
- }
15764
-
15765
- // ../../node_modules/@sinclair/typebox/build/esm/type/required/required-from-mapped-result.mjs
15766
- function FromProperties19(P, options) {
15767
- const Acc = {};
15768
- for (const K2 of globalThis.Object.getOwnPropertyNames(P))
15769
- Acc[K2] = Required(P[K2], options);
15770
- return Acc;
15771
- }
15772
- function FromMappedResult12(R, options) {
15773
- return FromProperties19(R.properties, options);
15774
- }
15775
- function RequiredFromMappedResult(R, options) {
15776
- const P = FromMappedResult12(R, options);
15777
- return MappedResult(P);
15778
- }
15779
-
15780
- // ../../node_modules/@sinclair/typebox/build/esm/type/module/compute.mjs
15781
- function DereferenceParameters(moduleProperties, types) {
15782
- return types.map((type) => {
15783
- return IsRef(type) ? Dereference(moduleProperties, type.$ref) : FromType2(moduleProperties, type);
15784
- });
15785
- }
15786
- function Dereference(moduleProperties, ref) {
15787
- return ref in moduleProperties ? IsRef(moduleProperties[ref]) ? Dereference(moduleProperties, moduleProperties[ref].$ref) : FromType2(moduleProperties, moduleProperties[ref]) : Never();
15788
- }
15789
- function FromAwaited(parameters) {
15790
- return Awaited(parameters[0]);
15791
- }
15792
- function FromIndex(parameters) {
15793
- return Index(parameters[0], parameters[1]);
15794
- }
15795
- function FromKeyOf(parameters) {
15796
- return KeyOf(parameters[0]);
15797
- }
15798
- function FromPartial(parameters) {
15799
- return Partial(parameters[0]);
15800
- }
15801
- function FromOmit(parameters) {
15802
- return Omit(parameters[0], parameters[1]);
15803
- }
15804
- function FromPick(parameters) {
15805
- return Pick(parameters[0], parameters[1]);
15806
- }
15807
- function FromRequired(parameters) {
15808
- return Required(parameters[0]);
15809
- }
15810
- function FromComputed5(moduleProperties, target, parameters) {
15811
- const dereferenced = DereferenceParameters(moduleProperties, parameters);
15812
- return target === "Awaited" ? FromAwaited(dereferenced) : target === "Index" ? FromIndex(dereferenced) : target === "KeyOf" ? FromKeyOf(dereferenced) : target === "Partial" ? FromPartial(dereferenced) : target === "Omit" ? FromOmit(dereferenced) : target === "Pick" ? FromPick(dereferenced) : target === "Required" ? FromRequired(dereferenced) : Never();
15813
- }
15814
- function FromArray6(moduleProperties, type) {
15815
- return Array2(FromType2(moduleProperties, type));
15816
- }
15817
- function FromAsyncIterator3(moduleProperties, type) {
15818
- return AsyncIterator(FromType2(moduleProperties, type));
15819
- }
15820
- function FromConstructor3(moduleProperties, parameters, instanceType) {
15821
- return Constructor(FromTypes2(moduleProperties, parameters), FromType2(moduleProperties, instanceType));
15822
- }
15823
- function FromFunction3(moduleProperties, parameters, returnType) {
15824
- return Function2(FromTypes2(moduleProperties, parameters), FromType2(moduleProperties, returnType));
15825
- }
15826
- function FromIntersect8(moduleProperties, types) {
15827
- return Intersect(FromTypes2(moduleProperties, types));
15828
- }
15829
- function FromIterator3(moduleProperties, type) {
15830
- return Iterator(FromType2(moduleProperties, type));
15831
- }
15832
- function FromObject7(moduleProperties, properties) {
15833
- return Object2(globalThis.Object.keys(properties).reduce((result, key) => {
15834
- return { ...result, [key]: FromType2(moduleProperties, properties[key]) };
15835
- }, {}));
15836
- }
15837
- function FromRecord3(moduleProperties, type) {
15838
- const [value, pattern] = [FromType2(moduleProperties, RecordValue2(type)), RecordPattern(type)];
15839
- const result = CloneType(type);
15840
- result.patternProperties[pattern] = value;
15841
- return result;
15842
- }
15843
- function FromTransform(moduleProperties, transform) {
15844
- return IsRef(transform) ? { ...Dereference(moduleProperties, transform.$ref), [TransformKind]: transform[TransformKind] } : transform;
15845
- }
15846
- function FromTuple5(moduleProperties, types) {
15847
- return Tuple(FromTypes2(moduleProperties, types));
15848
- }
15849
- function FromUnion10(moduleProperties, types) {
15850
- return Union(FromTypes2(moduleProperties, types));
15851
- }
15852
- function FromTypes2(moduleProperties, types) {
15853
- return types.map((type) => FromType2(moduleProperties, type));
15854
- }
15855
- function FromType2(moduleProperties, type) {
15856
- return (
15857
- // Modifiers
15858
- IsOptional(type) ? CreateType(FromType2(moduleProperties, Discard(type, [OptionalKind])), type) : IsReadonly(type) ? CreateType(FromType2(moduleProperties, Discard(type, [ReadonlyKind])), type) : (
15859
- // Transform
15860
- IsTransform(type) ? CreateType(FromTransform(moduleProperties, type), type) : (
15861
- // Types
15862
- IsArray3(type) ? CreateType(FromArray6(moduleProperties, type.items), type) : IsAsyncIterator2(type) ? CreateType(FromAsyncIterator3(moduleProperties, type.items), type) : IsComputed(type) ? CreateType(FromComputed5(moduleProperties, type.target, type.parameters)) : IsConstructor(type) ? CreateType(FromConstructor3(moduleProperties, type.parameters, type.returns), type) : IsFunction2(type) ? CreateType(FromFunction3(moduleProperties, type.parameters, type.returns), type) : IsIntersect(type) ? CreateType(FromIntersect8(moduleProperties, type.allOf), type) : IsIterator2(type) ? CreateType(FromIterator3(moduleProperties, type.items), type) : IsObject3(type) ? CreateType(FromObject7(moduleProperties, type.properties), type) : IsRecord(type) ? CreateType(FromRecord3(moduleProperties, type)) : IsTuple(type) ? CreateType(FromTuple5(moduleProperties, type.items || []), type) : IsUnion(type) ? CreateType(FromUnion10(moduleProperties, type.anyOf), type) : type
15863
- )
15864
- )
15865
- );
15866
- }
15867
- function ComputeType(moduleProperties, key) {
15868
- return key in moduleProperties ? FromType2(moduleProperties, moduleProperties[key]) : Never();
15869
- }
15870
- function ComputeModuleProperties(moduleProperties) {
15871
- return globalThis.Object.getOwnPropertyNames(moduleProperties).reduce((result, key) => {
15872
- return { ...result, [key]: ComputeType(moduleProperties, key) };
15873
- }, {});
15874
- }
15875
-
15876
- // ../../node_modules/@sinclair/typebox/build/esm/type/module/module.mjs
15877
- var TModule = class {
15878
- constructor($defs) {
15879
- const computed = ComputeModuleProperties($defs);
15880
- const identified = this.WithIdentifiers(computed);
15881
- this.$defs = identified;
15882
- }
15883
- /** `[Json]` Imports a Type by Key. */
15884
- Import(key, options) {
15885
- const $defs = { ...this.$defs, [key]: CreateType(this.$defs[key], options) };
15886
- return CreateType({ [Kind]: "Import", $defs, $ref: key });
15887
- }
15888
- // prettier-ignore
15889
- WithIdentifiers($defs) {
15890
- return globalThis.Object.getOwnPropertyNames($defs).reduce((result, key) => {
15891
- return { ...result, [key]: { ...$defs[key], $id: key } };
15892
- }, {});
15893
- }
15894
- };
15895
- function Module(properties) {
15896
- return new TModule(properties);
15897
- }
15898
-
15899
- // ../../node_modules/@sinclair/typebox/build/esm/type/not/not.mjs
15900
- function Not(type, options) {
15901
- return CreateType({ [Kind]: "Not", not: type }, options);
15902
- }
15903
-
15904
- // ../../node_modules/@sinclair/typebox/build/esm/type/parameters/parameters.mjs
15905
- function Parameters(schema, options) {
15906
- return IsFunction2(schema) ? Tuple(schema.parameters, options) : Never();
15907
- }
15908
-
15909
- // ../../node_modules/@sinclair/typebox/build/esm/type/recursive/recursive.mjs
15910
- var Ordinal = 0;
15911
- function Recursive(callback, options = {}) {
15912
- if (IsUndefined(options.$id))
15913
- options.$id = `T${Ordinal++}`;
15914
- const thisType = CloneType(callback({ [Kind]: "This", $ref: `${options.$id}` }));
15915
- thisType.$id = options.$id;
15916
- return CreateType({ [Hint]: "Recursive", ...thisType }, options);
15917
- }
15918
-
15919
- // ../../node_modules/@sinclair/typebox/build/esm/type/regexp/regexp.mjs
15920
- function RegExp2(unresolved, options) {
15921
- const expr = IsString(unresolved) ? new globalThis.RegExp(unresolved) : unresolved;
15922
- return CreateType({ [Kind]: "RegExp", type: "RegExp", source: expr.source, flags: expr.flags }, options);
15923
- }
15924
-
15925
- // ../../node_modules/@sinclair/typebox/build/esm/type/rest/rest.mjs
15926
- function RestResolve(T) {
15927
- return IsIntersect(T) ? T.allOf : IsUnion(T) ? T.anyOf : IsTuple(T) ? T.items ?? [] : [];
15928
- }
15929
- function Rest(T) {
15930
- return RestResolve(T);
15931
- }
15932
-
15933
- // ../../node_modules/@sinclair/typebox/build/esm/type/return-type/return-type.mjs
15934
- function ReturnType(schema, options) {
15935
- return IsFunction2(schema) ? CreateType(schema.returns, options) : Never(options);
15936
- }
15937
-
15938
- // ../../node_modules/@sinclair/typebox/build/esm/type/transform/transform.mjs
15939
- var TransformDecodeBuilder = class {
15940
- constructor(schema) {
15941
- this.schema = schema;
15942
- }
15943
- Decode(decode) {
15944
- return new TransformEncodeBuilder(this.schema, decode);
15945
- }
15946
- };
15947
- var TransformEncodeBuilder = class {
15948
- constructor(schema, decode) {
15949
- this.schema = schema;
15950
- this.decode = decode;
15951
- }
15952
- EncodeTransform(encode, schema) {
15953
- const Encode = (value) => schema[TransformKind].Encode(encode(value));
15954
- const Decode = (value) => this.decode(schema[TransformKind].Decode(value));
15955
- const Codec = { Encode, Decode };
15956
- return { ...schema, [TransformKind]: Codec };
15957
- }
15958
- EncodeSchema(encode, schema) {
15959
- const Codec = { Decode: this.decode, Encode: encode };
15960
- return { ...schema, [TransformKind]: Codec };
15961
- }
15962
- Encode(encode) {
15963
- return IsTransform(this.schema) ? this.EncodeTransform(encode, this.schema) : this.EncodeSchema(encode, this.schema);
15964
- }
15965
- };
15966
- function Transform(schema) {
15967
- return new TransformDecodeBuilder(schema);
15968
- }
15969
-
15970
- // ../../node_modules/@sinclair/typebox/build/esm/type/unsafe/unsafe.mjs
15971
- function Unsafe(options = {}) {
15972
- return CreateType({ [Kind]: options[Kind] ?? "Unsafe" }, options);
15973
- }
15974
-
15975
- // ../../node_modules/@sinclair/typebox/build/esm/type/void/void.mjs
15976
- function Void(options) {
15977
- return CreateType({ [Kind]: "Void", type: "void" }, options);
15978
- }
15979
-
15980
- // ../../node_modules/@sinclair/typebox/build/esm/type/type/type.mjs
15981
- var type_exports2 = {};
15982
- __export(type_exports2, {
15983
- Any: () => Any,
15984
- Argument: () => Argument,
15985
- Array: () => Array2,
15986
- AsyncIterator: () => AsyncIterator,
15987
- Awaited: () => Awaited,
15988
- BigInt: () => BigInt,
15989
- Boolean: () => Boolean2,
15990
- Capitalize: () => Capitalize,
15991
- Composite: () => Composite,
15992
- Const: () => Const,
15993
- Constructor: () => Constructor,
15994
- ConstructorParameters: () => ConstructorParameters,
15995
- Date: () => Date2,
15996
- Enum: () => Enum,
15997
- Exclude: () => Exclude,
15998
- Extends: () => Extends,
15999
- Extract: () => Extract,
16000
- Function: () => Function2,
16001
- Index: () => Index,
16002
- InstanceType: () => InstanceType,
16003
- Instantiate: () => Instantiate,
16004
- Integer: () => Integer,
16005
- Intersect: () => Intersect,
16006
- Iterator: () => Iterator,
16007
- KeyOf: () => KeyOf,
16008
- Literal: () => Literal,
16009
- Lowercase: () => Lowercase,
16010
- Mapped: () => Mapped,
16011
- Module: () => Module,
16012
- Never: () => Never,
16013
- Not: () => Not,
16014
- Null: () => Null,
16015
- Number: () => Number2,
16016
- Object: () => Object2,
16017
- Omit: () => Omit,
16018
- Optional: () => Optional,
16019
- Parameters: () => Parameters,
16020
- Partial: () => Partial,
16021
- Pick: () => Pick,
16022
- Promise: () => Promise2,
16023
- Readonly: () => Readonly,
16024
- ReadonlyOptional: () => ReadonlyOptional,
16025
- Record: () => Record,
16026
- Recursive: () => Recursive,
16027
- Ref: () => Ref,
16028
- RegExp: () => RegExp2,
16029
- Required: () => Required,
16030
- Rest: () => Rest,
16031
- ReturnType: () => ReturnType,
16032
- String: () => String2,
16033
- Symbol: () => Symbol2,
16034
- TemplateLiteral: () => TemplateLiteral,
16035
- Transform: () => Transform,
16036
- Tuple: () => Tuple,
16037
- Uint8Array: () => Uint8Array2,
16038
- Uncapitalize: () => Uncapitalize,
16039
- Undefined: () => Undefined,
16040
- Union: () => Union,
16041
- Unknown: () => Unknown,
16042
- Unsafe: () => Unsafe,
16043
- Uppercase: () => Uppercase,
16044
- Void: () => Void
16045
- });
16046
-
16047
- // ../../node_modules/@sinclair/typebox/build/esm/type/type/index.mjs
16048
- var Type = type_exports2;
16049
-
16050
13527
  // ../plays/authoring-contract.ts
13528
+ import { Type } from "@sinclair/typebox";
13529
+ import { Value } from "@sinclair/typebox/value";
16051
13530
  var PLAY_SQL_LISTENER_WHERE_OPERATORS = [
16052
13531
  "eq",
16053
13532
  "neq",
@@ -17354,8 +14833,9 @@ var PLAY_AUTHORING_CLOUD_TYPE_DECLARATIONS = [
17354
14833
  "export type PlayCallExecution = 'inline';",
17355
14834
  `export type PlayCallOptions = { description: ${cloudReferenceType("ctx.runPlay.options.description")}; execution?: ${cloudReferenceType("ctx.runPlay.options.execution")}; timeoutMs?: ${cloudReferenceType("ctx.runPlay.options.timeoutMs")} };`,
17356
14835
  `export type RuntimeStepOptions = { semanticKey?: ${cloudReferenceType("ctx.step.semanticKey")}; staleAfterSeconds?: ${cloudReferenceType("ctx.step.staleAfterSeconds")} };`,
17357
- `export type FetchOptions = { staleAfterSeconds?: ${cloudReferenceType("ctx.fetch.staleAfterSeconds")} };`,
14836
+ `export type FetchOptions = { staleAfterSeconds?: ${cloudReferenceType("ctx.fetch.staleAfterSeconds")}; transient?: boolean };`,
17358
14837
  "export type PlayFetchResponse = { ok: boolean; status: number; statusText: string; url: string; headers: Record<string, string>; bodyText: string; json: unknown | null };",
14838
+ "export declare class CtxFetchHttpError extends Error { readonly code: 'CTX_FETCH_HTTP_ERROR'; readonly response: PlayFetchResponse; readonly status: number; readonly statusText: string; readonly url: string; readonly headers: Record<string, string>; readonly bodyText: string; readonly json: unknown | null; }",
17359
14839
  "export type StepResolver<Row, Value> = (row: Row, ctx: DeeplinePlayRuntimeContext, index: number, previousCell?: PreviousCell<Value>) => Value | Promise<Value>;",
17360
14840
  "export type DatasetColumnRunInput<Row, Value> = { readonly row: Row; readonly ctx: DeeplinePlayRuntimeContext; readonly index: number; readonly previousCell?: PreviousCell<Value> };",
17361
14841
  "export type DatasetColumnDefinition<Row, Value> = { readonly run: (input: DatasetColumnRunInput<Row, Value>) => Value | Promise<Value>; readonly runIf?: (row: Row, index: number) => boolean | Promise<boolean> };",
@@ -18309,6 +15789,207 @@ var SDK_PACKAGE_JSON = resolve10(SDK_PACKAGE_ROOT, "package.json");
18309
15789
  var SDK_ENTRY_FILE = resolve10(SDK_SOURCE_ROOT, "index.ts");
18310
15790
  var SDK_TYPES_ENTRY_FILE = HAS_SOURCE_BUNDLING_SOURCES ? SDK_ENTRY_FILE : resolve10(SDK_PACKAGE_ROOT, "dist", "index.d.ts");
18311
15791
 
15792
+ // src/cli/run-dataset-selection.ts
15793
+ var Run = class _Run {
15794
+ #datasets;
15795
+ constructor(input2) {
15796
+ this.#datasets = RunDatasetCatalog.from({
15797
+ runPackage: input2.runPackage,
15798
+ datasets: input2.datasets
15799
+ });
15800
+ }
15801
+ static open(input2) {
15802
+ return new _Run(input2);
15803
+ }
15804
+ datasets() {
15805
+ return this.#datasets;
15806
+ }
15807
+ /** Select the Dataset a caller wants to export; enumerate with datasets(). */
15808
+ dataset(path) {
15809
+ return this.#datasets.choose(path);
15810
+ }
15811
+ };
15812
+ var RunDatasetCatalog = class _RunDatasetCatalog {
15813
+ #available;
15814
+ #returned;
15815
+ #recovered;
15816
+ constructor(input2) {
15817
+ this.#available = input2.available.map((info) => RunDataset.from(info));
15818
+ this.#returned = input2.returned.map((info) => RunDataset.from(info));
15819
+ this.#recovered = input2.available.filter((info) => info.recovered).map((info) => RunDataset.from(info));
15820
+ }
15821
+ static from(input2) {
15822
+ const available = withReturnedDatasetAliases(
15823
+ input2.runPackage,
15824
+ distinctRunDatasets(input2.datasets)
15825
+ );
15826
+ return new _RunDatasetCatalog({
15827
+ available,
15828
+ returned: returnedRunDatasets(input2.runPackage, available)
15829
+ });
15830
+ }
15831
+ available() {
15832
+ return this.#available;
15833
+ }
15834
+ returned() {
15835
+ return this.#returned;
15836
+ }
15837
+ recovered() {
15838
+ return this.#recovered;
15839
+ }
15840
+ /**
15841
+ * Select an exact public Dataset path/id/namespace. With no requested path,
15842
+ * a Run returns its sole returned Dataset, or its sole recovered Dataset.
15843
+ */
15844
+ choose(path) {
15845
+ const requested = path?.trim();
15846
+ if (requested) {
15847
+ return this.#available.find((dataset) => dataset.matches(requested)) ?? null;
15848
+ }
15849
+ if (this.#returned.length === 1) return this.#returned[0];
15850
+ return this.#returned.length === 0 && this.#recovered.length === 1 ? this.#recovered[0] : null;
15851
+ }
15852
+ };
15853
+ var RunDataset = class _RunDataset {
15854
+ #info;
15855
+ constructor(info) {
15856
+ this.#info = info;
15857
+ }
15858
+ static from(info) {
15859
+ return new _RunDataset(info);
15860
+ }
15861
+ get source() {
15862
+ return this.#info.source;
15863
+ }
15864
+ get datasetId() {
15865
+ return this.#info.datasetId;
15866
+ }
15867
+ get tableNamespace() {
15868
+ return this.#info.tableNamespace;
15869
+ }
15870
+ get rows() {
15871
+ return this.#info.rows;
15872
+ }
15873
+ get totalRows() {
15874
+ return this.#info.totalRows;
15875
+ }
15876
+ get complete() {
15877
+ return this.#info.complete;
15878
+ }
15879
+ get recovered() {
15880
+ return this.#info.recovered;
15881
+ }
15882
+ get exportUnavailableReason() {
15883
+ return this.#info.exportUnavailableReason;
15884
+ }
15885
+ get exportUnavailableMessage() {
15886
+ return this.#info.exportUnavailableMessage;
15887
+ }
15888
+ matches(path) {
15889
+ return this.source === path || this.datasetId === path || this.tableNamespace === path;
15890
+ }
15891
+ /** Return a new Handle when its preview has been replaced by fetched rows. */
15892
+ withRows(info) {
15893
+ return _RunDataset.from(info);
15894
+ }
15895
+ /** Write this Dataset's stable, non-flattening CSV Projection. */
15896
+ exportCsv(outPath) {
15897
+ if (!this.complete) {
15898
+ throw new Error(
15899
+ `Run Dataset '${this.source ?? this.tableNamespace ?? "dataset"}' only includes ${this.rows.length} preview row(s) of ${this.totalRows}; cannot export a complete CSV yet.`
15900
+ );
15901
+ }
15902
+ return writeRunDatasetCsv({
15903
+ rows: this.rows,
15904
+ columns: this.#info.columns,
15905
+ outPath
15906
+ });
15907
+ }
15908
+ /** Compatibility seam for callers which still return CanonicalRowsInfo. */
15909
+ info() {
15910
+ return this.#info;
15911
+ }
15912
+ };
15913
+ function distinctRunDatasets(infos) {
15914
+ const byIdentity = /* @__PURE__ */ new Map();
15915
+ for (const info of infos) {
15916
+ const identity = info.datasetId?.trim() ? `id:${info.datasetId.trim()}` : `path:${info.source ?? info.tableNamespace ?? "dataset"}`;
15917
+ const existing = byIdentity.get(identity);
15918
+ byIdentity.set(
15919
+ identity,
15920
+ existing ? mergeCanonicalRowsInfo(existing, info) : info
15921
+ );
15922
+ }
15923
+ return [...byIdentity.values()];
15924
+ }
15925
+ function packageForDatasetSelection(runPackage) {
15926
+ const root = recordValue(runPackage);
15927
+ const nested = recordValue(root.package);
15928
+ if (nested?.kind === "play_run") return nested;
15929
+ return root.kind === "play_run" ? root : null;
15930
+ }
15931
+ function withReturnedDatasetAliases(runPackage, available) {
15932
+ const outputs = recordValue(packageForDatasetSelection(runPackage)?.outputs);
15933
+ if (Object.keys(outputs).length === 0) return available;
15934
+ const expanded = [...available];
15935
+ for (const outputValue of Object.values(outputs)) {
15936
+ const output2 = recordValue(outputValue);
15937
+ if (output2.kind !== "dataset") continue;
15938
+ const alias = stringValue2(output2.path);
15939
+ if (!alias) continue;
15940
+ const datasetId = stringValue2(output2.datasetId);
15941
+ const canonicalPath2 = stringValue2(output2.dataset);
15942
+ const canonical = available.find(
15943
+ (info) => datasetId && info.datasetId === datasetId || canonicalPath2 && info.source === canonicalPath2
15944
+ );
15945
+ if (!canonical) continue;
15946
+ const aliasIndex = expanded.findIndex((info) => info.source === alias);
15947
+ if (aliasIndex >= 0) {
15948
+ expanded[aliasIndex] = {
15949
+ ...mergeCanonicalRowsInfo(expanded[aliasIndex], canonical),
15950
+ source: alias
15951
+ };
15952
+ } else {
15953
+ expanded.push({ ...canonical, source: alias });
15954
+ }
15955
+ }
15956
+ return expanded;
15957
+ }
15958
+ function returnedRunDatasets(runPackage, available) {
15959
+ const outputs = recordValue(packageForDatasetSelection(runPackage)?.outputs);
15960
+ if (Object.keys(outputs).length > 0) {
15961
+ const selected = /* @__PURE__ */ new Map();
15962
+ for (const outputValue of Object.values(outputs)) {
15963
+ const output2 = recordValue(outputValue);
15964
+ if (output2.kind !== "dataset") continue;
15965
+ const datasetId = stringValue2(output2.datasetId);
15966
+ const alias = stringValue2(output2.path);
15967
+ const canonicalPath2 = stringValue2(output2.dataset);
15968
+ const info = (alias ? available.find((candidate) => candidate.source === alias) : null) ?? (datasetId ? available.find((candidate) => candidate.datasetId === datasetId) : null) ?? (canonicalPath2 ? available.find((candidate) => candidate.source === canonicalPath2) : null);
15969
+ if (!info) continue;
15970
+ const identity = datasetId ? `id:${datasetId}` : `path:${canonicalPath2 ?? alias ?? info.source ?? "dataset"}`;
15971
+ const aliased = { ...info, source: alias ?? info.source };
15972
+ const existing = selected.get(identity);
15973
+ selected.set(
15974
+ identity,
15975
+ existing ? mergeCanonicalRowsInfo(existing, aliased) : aliased
15976
+ );
15977
+ }
15978
+ if (selected.size > 0) return [...selected.values()];
15979
+ }
15980
+ return distinctRunDatasets(
15981
+ available.filter(
15982
+ (info) => Boolean(info.source?.startsWith("result.")) && !info.recovered
15983
+ )
15984
+ );
15985
+ }
15986
+ function recordValue(value) {
15987
+ return value && typeof value === "object" && !Array.isArray(value) ? value : {};
15988
+ }
15989
+ function stringValue2(value) {
15990
+ return typeof value === "string" && value.trim() ? value.trim() : null;
15991
+ }
15992
+
18312
15993
  // src/cli/progress.ts
18313
15994
  import { Worker } from "worker_threads";
18314
15995
  var CliProgress = class {
@@ -18578,7 +16259,7 @@ ${hint}`;
18578
16259
 
18579
16260
  // ../play-runtime/governor/policy.ts
18580
16261
  var DEFAULT_MAX_CONCURRENT_EXTERNAL_CALLS = 64;
18581
- var MAX_CONFIGURABLE_CONCURRENT_EXTERNAL_CALLS = 256;
16262
+ var MAX_CONFIGURABLE_CONCURRENT_EXTERNAL_CALLS = 1e3;
18582
16263
  var MAX_CONFIGURABLE_CONCURRENT_ROWS = 1e3;
18583
16264
  function resolveMaxConcurrentExternalCalls(requested) {
18584
16265
  if (requested === void 0 || requested === null) {
@@ -19120,8 +16801,7 @@ var PLAY_RUN_RESERVED_BOOLEAN_FLAGS = /* @__PURE__ */ new Set([
19120
16801
  "--force",
19121
16802
  "--force-tool-refresh",
19122
16803
  "--open",
19123
- "--debug-map-latency",
19124
- "--debug-fixture-provider-pacing"
16804
+ "--debug-map-latency"
19125
16805
  ]);
19126
16806
  async function pathExistsIncludingSymlink(path) {
19127
16807
  try {
@@ -19256,7 +16936,7 @@ function traceCliSync(phase, fields, run) {
19256
16936
  }
19257
16937
  }
19258
16938
  function sleep5(ms) {
19259
- return new Promise((resolve19) => setTimeout(resolve19, ms));
16939
+ return new Promise((resolve20) => setTimeout(resolve20, ms));
19260
16940
  }
19261
16941
  function parseReferencedPlayTarget2(target) {
19262
16942
  const trimmed = target.trim();
@@ -22569,103 +20249,6 @@ async function fetchBackingDatasetRows(input2) {
22569
20249
  source: `${input2.rowsInfo.source ?? "result.rows"} -> /api/v2/plays/${playName}/sheet?tableNamespace=${tableNamespace}`
22570
20250
  };
22571
20251
  }
22572
- function resolveDatasetByName(available, datasetPath) {
22573
- const target = datasetPath.trim();
22574
- const exact = available.find((info) => info.source === target);
22575
- if (exact) {
22576
- return exact;
22577
- }
22578
- const byDatasetId = available.find((info) => info.datasetId === target);
22579
- if (byDatasetId) {
22580
- return byDatasetId;
22581
- }
22582
- const byNamespace = available.find(
22583
- (info) => info.tableNamespace && info.tableNamespace === target
22584
- );
22585
- if (byNamespace) {
22586
- return byNamespace;
22587
- }
22588
- return null;
22589
- }
22590
- function canonicalRowsIdentity(info) {
22591
- return info.datasetId?.trim() ? `id:${info.datasetId.trim()}` : `path:${info.source ?? info.tableNamespace ?? "dataset"}`;
22592
- }
22593
- function distinctCanonicalRowsInfos(infos) {
22594
- const byIdentity = /* @__PURE__ */ new Map();
22595
- for (const info of infos) {
22596
- const identity = canonicalRowsIdentity(info);
22597
- const existing = byIdentity.get(identity);
22598
- byIdentity.set(
22599
- identity,
22600
- existing ? mergeCanonicalRowsInfo(existing, info) : info
22601
- );
22602
- }
22603
- return [...byIdentity.values()];
22604
- }
22605
- function packageForExportSelection(status) {
22606
- const root = status;
22607
- const nested = readRecord(root.package);
22608
- if (nested?.kind === "play_run") return nested;
22609
- return root.kind === "play_run" ? root : null;
22610
- }
22611
- function withReturnedDatasetAliases(status, available) {
22612
- const packaged = packageForExportSelection(status);
22613
- const outputs = readRecord(packaged?.outputs);
22614
- if (!outputs) return available;
22615
- const expanded = [...available];
22616
- for (const outputValue of Object.values(outputs)) {
22617
- const output2 = readRecord(outputValue);
22618
- if (output2?.kind !== "dataset") continue;
22619
- const alias = typeof output2.path === "string" && output2.path.trim() ? output2.path.trim() : null;
22620
- if (!alias) continue;
22621
- const datasetId = typeof output2.datasetId === "string" && output2.datasetId.trim() ? output2.datasetId.trim() : null;
22622
- const canonicalPath2 = typeof output2.dataset === "string" && output2.dataset.trim() ? output2.dataset.trim() : null;
22623
- const canonical = available.find(
22624
- (info) => datasetId && info.datasetId === datasetId || canonicalPath2 && info.source === canonicalPath2
22625
- );
22626
- if (canonical) {
22627
- const aliasIndex = expanded.findIndex((info) => info.source === alias);
22628
- if (aliasIndex >= 0) {
22629
- expanded[aliasIndex] = {
22630
- ...mergeCanonicalRowsInfo(expanded[aliasIndex], canonical),
22631
- source: alias
22632
- };
22633
- } else {
22634
- expanded.push({ ...canonical, source: alias });
22635
- }
22636
- }
22637
- }
22638
- return expanded;
22639
- }
22640
- function returnedRowsInfos(status, available) {
22641
- const packaged = packageForExportSelection(status);
22642
- const outputs = readRecord(packaged?.outputs);
22643
- if (outputs) {
22644
- const selected = /* @__PURE__ */ new Map();
22645
- for (const outputValue of Object.values(outputs)) {
22646
- const output2 = readRecord(outputValue);
22647
- if (output2?.kind !== "dataset") continue;
22648
- const datasetId = typeof output2.datasetId === "string" && output2.datasetId.trim() ? output2.datasetId.trim() : null;
22649
- const alias = typeof output2.path === "string" && output2.path.trim() ? output2.path.trim() : null;
22650
- const canonicalPath2 = typeof output2.dataset === "string" && output2.dataset.trim() ? output2.dataset.trim() : null;
22651
- const info = (alias ? available.find((candidate) => candidate.source === alias) : null) ?? (datasetId ? available.find((candidate) => candidate.datasetId === datasetId) : null) ?? (canonicalPath2 ? available.find((candidate) => candidate.source === canonicalPath2) : null);
22652
- if (!info) continue;
22653
- const identity = datasetId ? `id:${datasetId}` : `path:${canonicalPath2 ?? alias ?? info.source ?? "dataset"}`;
22654
- const aliased = { ...info, source: alias ?? info.source };
22655
- const existing = selected.get(identity);
22656
- selected.set(
22657
- identity,
22658
- existing ? mergeCanonicalRowsInfo(existing, aliased) : aliased
22659
- );
22660
- }
22661
- if (selected.size > 0) return [...selected.values()];
22662
- }
22663
- return distinctCanonicalRowsInfos(
22664
- available.filter(
22665
- (info) => Boolean(info.source?.startsWith("result.")) && !info.recovered
22666
- )
22667
- );
22668
- }
22669
20252
  function exportDatasetCommand(input2) {
22670
20253
  return `deepline runs export ${input2.runId} --dataset ${shellSingleQuote(
22671
20254
  input2.datasetPath
@@ -22724,16 +20307,17 @@ async function exportPlayStatusRows(client2, status, outPath, options = {}) {
22724
20307
  if (!outPath) {
22725
20308
  return null;
22726
20309
  }
22727
- const availableRows = withReturnedDatasetAliases(
22728
- status,
22729
- distinctCanonicalRowsInfos(collectSerializedDatasetRowsInfos(status))
22730
- );
22731
- const returnedRows = returnedRowsInfos(status, availableRows);
22732
- const recoveredRows = distinctCanonicalRowsInfos(
22733
- availableRows.filter((info) => info.recovered)
22734
- );
22735
- const rowsInfo = options.datasetPath ? resolveDatasetByName(availableRows, options.datasetPath) ?? null : returnedRows.length === 1 ? returnedRows[0] : returnedRows.length === 0 && recoveredRows.length === 1 ? recoveredRows[0] : null;
22736
- if (!rowsInfo && options.datasetPath) {
20310
+ const run = Run.open({
20311
+ runPackage: status,
20312
+ datasets: LegacyRunDatasetCatalogAdapter.datasets(status)
20313
+ });
20314
+ const datasets = run.datasets();
20315
+ const availableRows = datasets.available().map((dataset) => dataset.info());
20316
+ const returnedRows = datasets.returned().map((dataset) => dataset.info());
20317
+ const recoveredRows = datasets.recovered().map((dataset) => dataset.info());
20318
+ const selectedDataset = run.dataset(options.datasetPath);
20319
+ const rowsInfo = selectedDataset?.info() ?? null;
20320
+ if (!selectedDataset && options.datasetPath) {
22737
20321
  const available = availableRows.map((info) => info.source).filter((source) => typeof source === "string");
22738
20322
  const commands = datasetChoiceLines({
22739
20323
  runId: status.runId,
@@ -22824,7 +20408,7 @@ ${commands.join("\n")}`,
22824
20408
  datasetPath: options.datasetPath
22825
20409
  });
22826
20410
  return {
22827
- path: writeCanonicalRowsCsv(guarded2, outPath),
20411
+ path: RunDataset.from(guarded2).exportCsv(outPath),
22828
20412
  rowsInfo: guarded2
22829
20413
  };
22830
20414
  }
@@ -22836,7 +20420,7 @@ ${commands.join("\n")}`,
22836
20420
  datasetPath: options.datasetPath
22837
20421
  });
22838
20422
  return {
22839
- path: writeCanonicalRowsCsv(guarded2, outPath),
20423
+ path: RunDataset.from(guarded2).exportCsv(outPath),
22840
20424
  rowsInfo: guarded2
22841
20425
  };
22842
20426
  }
@@ -22870,7 +20454,10 @@ ${commands.join("\n")}`,
22870
20454
  availableRows,
22871
20455
  datasetPath: options.datasetPath
22872
20456
  });
22873
- return { path: writeCanonicalRowsCsv(guarded, outPath), rowsInfo: guarded };
20457
+ return {
20458
+ path: RunDataset.from(guarded).exportCsv(outPath),
20459
+ rowsInfo: guarded
20460
+ };
22874
20461
  }
22875
20462
  function extractActiveRunsFromError(error) {
22876
20463
  if (!(error instanceof DeeplineError)) {
@@ -23164,9 +20751,6 @@ function parsePlayRunOptions(args) {
23164
20751
  const forceToolRefresh = args.includes("--force-tool-refresh");
23165
20752
  const open2 = args.includes("--open");
23166
20753
  const debugMapLatency = args.includes("--debug-map-latency");
23167
- const debugFixtureProviderPacing = args.includes(
23168
- "--debug-fixture-provider-pacing"
23169
- );
23170
20754
  const verboseLogs = args.includes("--logs") || debugMapLatency;
23171
20755
  let waitTimeoutMs = null;
23172
20756
  let maxConcurrentExternalCalls = null;
@@ -23370,7 +20954,6 @@ function parsePlayRunOptions(args) {
23370
20954
  open: open2,
23371
20955
  profile,
23372
20956
  debugMapLatency,
23373
- debugFixtureProviderPacing,
23374
20957
  fixtureBehavior,
23375
20958
  runIdFile
23376
20959
  };
@@ -23536,7 +21119,7 @@ function formatPlayRuntimeLimit(runtimeLimit) {
23536
21119
  function isRecord10(value) {
23537
21120
  return Boolean(value && typeof value === "object" && !Array.isArray(value));
23538
21121
  }
23539
- function stringValue2(value) {
21122
+ function stringValue3(value) {
23540
21123
  return typeof value === "string" ? value.trim() : "";
23541
21124
  }
23542
21125
  function asArray(value) {
@@ -23556,11 +21139,11 @@ function firstRawPath(entry) {
23556
21139
  ...asArray(details.raw_tool_output_paths),
23557
21140
  ...asArray(details.candidatePaths),
23558
21141
  ...asArray(details.candidate_paths)
23559
- ].map(stringValue2).filter(Boolean);
21142
+ ].map(stringValue3).filter(Boolean);
23560
21143
  return paths[0];
23561
21144
  }
23562
21145
  function checkHintExpression(value) {
23563
- return stringValue2(value).replace(/^toolExecutionResult\./, "result.");
21146
+ return stringValue3(value).replace(/^toolExecutionResult\./, "result.");
23564
21147
  }
23565
21148
  function checkHintRawPath(value) {
23566
21149
  return value?.replace(/^toolResponse\./, "result.toolResponse.");
@@ -23575,7 +21158,7 @@ function collectStaticPipelineToolIds(staticPipeline) {
23575
21158
  ]) {
23576
21159
  if (!isRecord10(step)) continue;
23577
21160
  if (step.type === "tool") {
23578
- const toolId = stringValue2(step.toolId) || stringValue2(step.tool);
21161
+ const toolId = stringValue3(step.toolId) || stringValue3(step.tool);
23579
21162
  if (toolId) seen.add(toolId);
23580
21163
  }
23581
21164
  if (step.type === "play_call") {
@@ -23593,14 +21176,14 @@ function toolGetterHintFromMetadata(toolId, tool) {
23593
21176
  const lists = extractionEntries2(
23594
21177
  resultGuidance.extractedLists ?? resultGuidance.extracted_lists
23595
21178
  ).map((entry) => ({
23596
- name: stringValue2(entry.name),
21179
+ name: stringValue3(entry.name),
23597
21180
  expression: checkHintExpression(entry.expression),
23598
21181
  raw: checkHintRawPath(firstRawPath(entry))
23599
21182
  })).filter((entry) => entry.name && entry.expression);
23600
21183
  const values = extractionEntries2(
23601
21184
  resultGuidance.extractedValues ?? resultGuidance.extracted_values
23602
21185
  ).map((entry) => ({
23603
- name: stringValue2(entry.name),
21186
+ name: stringValue3(entry.name),
23604
21187
  expression: checkHintExpression(entry.expression),
23605
21188
  raw: checkHintRawPath(firstRawPath(entry))
23606
21189
  })).filter((entry) => entry.name && entry.expression);
@@ -24161,14 +21744,8 @@ async function handleFileBackedRun(options, hooks) {
24161
21744
  "--fixture-behavior requires DEEPLINE_EVAL_INTEGRATION_MODE=fixture."
24162
21745
  );
24163
21746
  }
24164
- if (options.debugFixtureProviderPacing && integrationMode !== "fixture") {
24165
- throw new Error(
24166
- "--debug-fixture-provider-pacing requires DEEPLINE_EVAL_INTEGRATION_MODE=fixture."
24167
- );
24168
- }
24169
21747
  const testPolicyOverrides = {
24170
- ...options.debugMapLatency ? { mapLatencyProfile: true } : {},
24171
- ...options.debugFixtureProviderPacing ? { enforceFixtureProviderPacing: true } : {}
21748
+ ...options.debugMapLatency ? { mapLatencyProfile: true } : {}
24172
21749
  };
24173
21750
  const startRequest = {
24174
21751
  name: playName,
@@ -24350,14 +21927,8 @@ async function handleNamedRun(options, hooks) {
24350
21927
  "--fixture-behavior requires DEEPLINE_EVAL_INTEGRATION_MODE=fixture."
24351
21928
  );
24352
21929
  }
24353
- if (options.debugFixtureProviderPacing && integrationMode !== "fixture") {
24354
- throw new Error(
24355
- "--debug-fixture-provider-pacing requires DEEPLINE_EVAL_INTEGRATION_MODE=fixture."
24356
- );
24357
- }
24358
21930
  const testPolicyOverrides = {
24359
- ...options.debugMapLatency ? { mapLatencyProfile: true } : {},
24360
- ...options.debugFixtureProviderPacing ? { enforceFixtureProviderPacing: true } : {}
21931
+ ...options.debugMapLatency ? { mapLatencyProfile: true } : {}
24361
21932
  };
24362
21933
  const startRequest = {
24363
21934
  name: playName,
@@ -26242,9 +23813,6 @@ Examples:
26242
23813
  ).option("--open", "Open the play page in a browser after the run starts").option(
26243
23814
  "--debug-map-latency",
26244
23815
  "Internal diagnostics: emit one aggregate latency profile per dataset map"
26245
- ).option(
26246
- "--debug-fixture-provider-pacing",
26247
- "Internal diagnostics: retain provider pacing while fixture mode is active"
26248
23816
  ).option("--json", "Emit JSON output").option("--full", "Debug only: with --json, emit the raw status payload").addHelpText(
26249
23817
  "afterAll",
26250
23818
  `
@@ -26291,7 +23859,6 @@ Pass-through input flags:
26291
23859
  ...options.maxConcurrentRows ? ["--max-concurrent-rows", options.maxConcurrentRows] : [],
26292
23860
  ...options.open ? ["--open"] : [],
26293
23861
  ...options.debugMapLatency ? ["--debug-map-latency"] : [],
26294
- ...options.debugFixtureProviderPacing ? ["--debug-fixture-provider-pacing"] : [],
26295
23862
  ...options.json ? ["--json"] : [],
26296
23863
  ...options.full ? ["--full"] : [],
26297
23864
  ...passthroughArgs
@@ -28713,7 +26280,7 @@ function emitEnrichDebug(message) {
28713
26280
  );
28714
26281
  }
28715
26282
  function sleep6(ms) {
28716
- return new Promise((resolve19) => setTimeout(resolve19, ms));
26283
+ return new Promise((resolve20) => setTimeout(resolve20, ms));
28717
26284
  }
28718
26285
  function enrichExportBackingRowsWaitMs() {
28719
26286
  const raw = process.env.DEEPLINE_ENRICH_EXPORT_BACKING_ROWS_WAIT_MS?.trim();
@@ -35153,7 +32720,7 @@ async function readHiddenLine(prompt, streams = {}) {
35153
32720
  }
35154
32721
  let value = "";
35155
32722
  inputStream.resume();
35156
- return await new Promise((resolve19, reject) => {
32723
+ return await new Promise((resolve20, reject) => {
35157
32724
  let settled = false;
35158
32725
  const cleanup = () => {
35159
32726
  inputStream.off("data", onData);
@@ -35171,7 +32738,7 @@ async function readHiddenLine(prompt, streams = {}) {
35171
32738
  settled = true;
35172
32739
  outputStream.write("\n");
35173
32740
  cleanup();
35174
- resolve19(line);
32741
+ resolve20(line);
35175
32742
  };
35176
32743
  const fail = (error) => {
35177
32744
  if (settled) return;
@@ -35344,22 +32911,149 @@ Examples:
35344
32911
  // src/cli/commands/setup.ts
35345
32912
  import { spawnSync as spawnSync2 } from "child_process";
35346
32913
  import {
35347
- existsSync as existsSync13,
35348
- lstatSync,
32914
+ existsSync as existsSync14,
32915
+ lstatSync as lstatSync2,
35349
32916
  mkdirSync as mkdirSync11,
35350
- readFileSync as readFileSync13,
35351
- realpathSync as realpathSync3,
35352
- rmSync as rmSync4,
32917
+ readFileSync as readFileSync14,
32918
+ realpathSync as realpathSync4,
35353
32919
  writeFileSync as writeFileSync14
35354
32920
  } from "fs";
35355
32921
  import { homedir as homedir9 } from "os";
35356
- import { basename as basename6, dirname as dirname15, join as join15, relative as relative5, resolve as resolve14 } from "path";
32922
+ import { dirname as dirname16, join as join16, resolve as resolve15 } from "path";
32923
+
32924
+ // src/cli/installation-lifecycle.ts
32925
+ import {
32926
+ existsSync as existsSync11,
32927
+ lstatSync,
32928
+ readFileSync as readFileSync11,
32929
+ realpathSync as realpathSync3,
32930
+ rmSync as rmSync4
32931
+ } from "fs";
32932
+ import { basename as basename6, dirname as dirname13, join as join13, relative as relative5, resolve as resolve14 } from "path";
32933
+ var nodeFileSystem = {
32934
+ exists: existsSync11,
32935
+ isSymbolicLink(path) {
32936
+ try {
32937
+ return lstatSync(path).isSymbolicLink();
32938
+ } catch {
32939
+ return false;
32940
+ }
32941
+ },
32942
+ read(path) {
32943
+ try {
32944
+ return readFileSync11(path, "utf8");
32945
+ } catch {
32946
+ return "";
32947
+ }
32948
+ },
32949
+ realpath(path) {
32950
+ try {
32951
+ return realpathSync3(path);
32952
+ } catch {
32953
+ return null;
32954
+ }
32955
+ },
32956
+ remove(path) {
32957
+ rmSync4(path, { force: true });
32958
+ }
32959
+ };
32960
+ function inspectLauncher(path, fileSystem = nodeFileSystem) {
32961
+ if (!fileSystem.exists(path)) {
32962
+ return { ownership: "missing", resolvedPath: null };
32963
+ }
32964
+ const resolvedPath = fileSystem.realpath(path);
32965
+ if (CliInstallation.isNpmPackagePath(resolvedPath)) {
32966
+ return { ownership: "npm", resolvedPath };
32967
+ }
32968
+ if (fileSystem.isSymbolicLink(path)) {
32969
+ return { ownership: "symlink", resolvedPath };
32970
+ }
32971
+ const content = fileSystem.read(path);
32972
+ if (content.includes("DEEPLINE_REAL_BINARY") && content.includes("DEEPLINE_ACTIVE_FILE")) {
32973
+ return { ownership: "installer_legacy", resolvedPath };
32974
+ }
32975
+ return { ownership: "user", resolvedPath };
32976
+ }
32977
+ var CliInstallation = class _CliInstallation {
32978
+ constructor(input2) {
32979
+ this.input = input2;
32980
+ }
32981
+ static forUser(input2) {
32982
+ return new _CliInstallation({
32983
+ ...input2,
32984
+ fileSystem: input2.fileSystem ?? nodeFileSystem
32985
+ });
32986
+ }
32987
+ static isNpmPackagePath(path) {
32988
+ return path?.includes(`${join13("node_modules", "deepline")}`) ?? false;
32989
+ }
32990
+ launcher(path) {
32991
+ return inspectLauncher(path, this.input.fileSystem);
32992
+ }
32993
+ retiredArtifacts() {
32994
+ const hostDir = join13(
32995
+ this.input.home,
32996
+ ".local",
32997
+ "deepline",
32998
+ this.input.baseUrlSlug
32999
+ );
33000
+ const legacyLauncherPath = join13(
33001
+ this.input.home,
33002
+ ".local",
33003
+ "bin",
33004
+ "deepline"
33005
+ );
33006
+ const installerCommandPath = this.input.fileSystem.read(join13(hostDir, "sdk", ".command-path")).trim();
33007
+ const ownedInstallerCommand = isOwnedInstallerCommandPath({
33008
+ hostDir,
33009
+ commandPath: installerCommandPath
33010
+ });
33011
+ const legacyLauncher = this.launcher(legacyLauncherPath);
33012
+ const candidates = [
33013
+ ...legacyLauncher.ownership === "installer_legacy" ? [legacyLauncherPath] : [],
33014
+ join13(this.input.home, ".local", "bin", "deepline-real"),
33015
+ join13(hostDir, "bin", "deepline"),
33016
+ join13(hostDir, "bin", "deepline-real"),
33017
+ join13(hostDir, "cli", ".install-method"),
33018
+ join13(hostDir, "cli", ".version"),
33019
+ join13(hostDir, "sdk", ".install-method"),
33020
+ join13(hostDir, "sdk", ".command-path"),
33021
+ ...ownedInstallerCommand ? [
33022
+ installerCommandPath,
33023
+ join13(dirname13(installerCommandPath), "deepline-sdk")
33024
+ ] : []
33025
+ ];
33026
+ return {
33027
+ paths: candidates.filter((path) => {
33028
+ if (!this.input.fileSystem.exists(path)) return false;
33029
+ return this.launcher(path).ownership !== "npm";
33030
+ })
33031
+ };
33032
+ }
33033
+ removeRetiredArtifacts() {
33034
+ return removeArtifacts(this.retiredArtifacts(), this.input.fileSystem);
33035
+ }
33036
+ };
33037
+ function removeArtifacts(plan, fileSystem) {
33038
+ for (const path of plan.paths) {
33039
+ fileSystem.remove(path);
33040
+ }
33041
+ return plan.paths;
33042
+ }
33043
+ function isOwnedInstallerCommandPath(input2) {
33044
+ if (!input2.commandPath || basename6(input2.commandPath) !== "deepline") {
33045
+ return false;
33046
+ }
33047
+ const commandPath = resolve14(input2.commandPath);
33048
+ const fromHost = relative5(resolve14(input2.hostDir), commandPath);
33049
+ return fromHost !== "" && fromHost !== ".." && !fromHost.startsWith(`..${process.platform === "win32" ? "\\" : "/"}`);
33050
+ }
35357
33051
 
35358
33052
  // src/cli/commands/skills.ts
35359
33053
  import { spawn as spawn3 } from "child_process";
35360
- import { existsSync as existsSync12, mkdirSync as mkdirSync10, readFileSync as readFileSync12, writeFileSync as writeFileSync13 } from "fs";
33054
+ import { existsSync as existsSync13, mkdirSync as mkdirSync10, readFileSync as readFileSync13, writeFileSync as writeFileSync13 } from "fs";
35361
33055
  import { homedir as homedir8 } from "os";
35362
- import { dirname as dirname14, join as join14 } from "path";
33056
+ import { dirname as dirname15, join as join15 } from "path";
35363
33057
 
35364
33058
  // ../../shared_libs/cli/install-commands.json
35365
33059
  var install_commands_default = {
@@ -35464,13 +33158,13 @@ function buildSkillsAddArgs(baseUrl, skillName, options = {}) {
35464
33158
  // src/cli/skills-sync.ts
35465
33159
  import { spawn as spawn2, spawnSync } from "child_process";
35466
33160
  import {
35467
- existsSync as existsSync11,
33161
+ existsSync as existsSync12,
35468
33162
  mkdirSync as mkdirSync9,
35469
- readFileSync as readFileSync11,
33163
+ readFileSync as readFileSync12,
35470
33164
  unlinkSync,
35471
33165
  writeFileSync as writeFileSync12
35472
33166
  } from "fs";
35473
- import { dirname as dirname13, join as join13 } from "path";
33167
+ import { dirname as dirname14, join as join14 } from "path";
35474
33168
 
35475
33169
  // src/cli/windows-arg-escape.ts
35476
33170
  var CMD_META_CHARS = /([()\][%!^"`<>&|;, *?])/g;
@@ -35505,10 +33199,10 @@ function shouldSkipSkillsSync() {
35505
33199
  return value === "1" || value === "true" || value === "yes" || value === "on";
35506
33200
  }
35507
33201
  function unavailableSkillsNoticePath(baseUrl) {
35508
- return join13(sdkCliStateDirPath(baseUrl), "skills-sync-unavailable-version");
33202
+ return join14(sdkCliStateDirPath(baseUrl), "skills-sync-unavailable-version");
35509
33203
  }
35510
33204
  function failedSkillsSyncPath(baseUrl, agents) {
35511
- return join13(
33205
+ return join14(
35512
33206
  sdkCliStateDirPath(baseUrl),
35513
33207
  `skills-sync-failed-${agents.join("-")}-version`
35514
33208
  );
@@ -35518,14 +33212,14 @@ function hasMarkedSkillsSyncVersion(path, version) {
35518
33212
  }
35519
33213
  function readMarkedSkillsSyncVersion(path) {
35520
33214
  try {
35521
- return existsSync11(path) ? readFileSync11(path, "utf-8").trim() : "";
33215
+ return existsSync12(path) ? readFileSync12(path, "utf-8").trim() : "";
35522
33216
  } catch {
35523
33217
  return "";
35524
33218
  }
35525
33219
  }
35526
33220
  function writeMarkedSkillsSyncVersion(path, version) {
35527
33221
  try {
35528
- mkdirSync9(dirname13(path), { recursive: true });
33222
+ mkdirSync9(dirname14(path), { recursive: true });
35529
33223
  writeFileSync12(path, `${version}
35530
33224
  `, "utf-8");
35531
33225
  } catch {
@@ -35554,7 +33248,7 @@ function hasFailedSkillsSync(baseUrl, remoteVersion, agents) {
35554
33248
  );
35555
33249
  }
35556
33250
  function hasFailedAutomaticSkillsSync(baseUrl, agents) {
35557
- return existsSync11(failedSkillsSyncPath(baseUrl, agents));
33251
+ return existsSync12(failedSkillsSyncPath(baseUrl, agents));
35558
33252
  }
35559
33253
  function markFailedSkillsSync(baseUrl, remoteVersion, agents) {
35560
33254
  writeMarkedSkillsSyncVersion(
@@ -35679,7 +33373,7 @@ function resolveSkillsInstallCommands(baseUrl, skillNames = DEFAULT_SDK_SKILL_NA
35679
33373
  return commands;
35680
33374
  }
35681
33375
  function runOneSkillsInstall(install) {
35682
- return new Promise((resolve19) => {
33376
+ return new Promise((resolve20) => {
35683
33377
  const plan = resolveSkillsInstallSpawn(install);
35684
33378
  const child = spawn2(plan.command, plan.args, {
35685
33379
  stdio: ["ignore", "ignore", "pipe"],
@@ -35691,7 +33385,7 @@ function runOneSkillsInstall(install) {
35691
33385
  stderr += chunk.toString("utf-8");
35692
33386
  });
35693
33387
  child.on("error", (error) => {
35694
- resolve19({
33388
+ resolve20({
35695
33389
  ok: false,
35696
33390
  detail: `failed to start ${install.command}: ${error.message}`,
35697
33391
  manualCommand: install.manualCommand
@@ -35699,11 +33393,11 @@ function runOneSkillsInstall(install) {
35699
33393
  });
35700
33394
  child.on("close", (code) => {
35701
33395
  if (code === 0) {
35702
- resolve19({ ok: true, detail: "", manualCommand: install.manualCommand });
33396
+ resolve20({ ok: true, detail: "", manualCommand: install.manualCommand });
35703
33397
  return;
35704
33398
  }
35705
33399
  const detail = stderr.trim();
35706
- resolve19({
33400
+ resolve20({
35707
33401
  ok: false,
35708
33402
  detail: detail ? `${install.command}: ${detail}` : `${install.command} exited ${code}`,
35709
33403
  manualCommand: install.manualCommand
@@ -35905,13 +33599,13 @@ function detectSkillsAgents(input2) {
35905
33599
  ];
35906
33600
  const detected = AGENT_MARKERS.filter(
35907
33601
  (marker) => roots.some(
35908
- (root) => marker.paths.some((path) => existsSync12(join14(root, path)))
33602
+ (root) => marker.paths.some((path) => existsSync13(join15(root, path)))
35909
33603
  )
35910
33604
  ).map((marker) => marker.agent);
35911
33605
  return detected.length > 0 ? detected : ["*"];
35912
33606
  }
35913
33607
  function skillsStatePathForScope(baseUrl, scope, root) {
35914
- return scope === "local" && root ? join14(root, ".deepline", "setup", "skills.json") : join14(sdkCliStateDirPath(baseUrl), "skills-install.json");
33608
+ return scope === "local" && root ? join15(root, ".deepline", "setup", "skills.json") : join15(sdkCliStateDirPath(baseUrl), "skills-install.json");
35915
33609
  }
35916
33610
  function buildSkillsPlan(input2) {
35917
33611
  const scopeArgs = input2.scope === "global" ? ["--global"] : [];
@@ -35978,14 +33672,14 @@ function isSkillsPlanCurrent(plan, state) {
35978
33672
  }
35979
33673
  function readSkillsInstallState(path) {
35980
33674
  try {
35981
- const parsed = JSON.parse(readFileSync12(path, "utf8"));
33675
+ const parsed = JSON.parse(readFileSync13(path, "utf8"));
35982
33676
  return parsed !== null && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : null;
35983
33677
  } catch {
35984
33678
  return null;
35985
33679
  }
35986
33680
  }
35987
33681
  function runProcess(command, args, cwd) {
35988
- return new Promise((resolve19, reject) => {
33682
+ return new Promise((resolve20, reject) => {
35989
33683
  const plan = resolveShellSpawn(command, args);
35990
33684
  const child = spawn3(plan.command, plan.args, {
35991
33685
  cwd,
@@ -36004,7 +33698,7 @@ function runProcess(command, args, cwd) {
36004
33698
  process.stderr.write(`${SKILLS_NPX_PACKAGE} exited ${code}.
36005
33699
  `);
36006
33700
  }
36007
- resolve19(code ?? 1);
33701
+ resolve20(code ?? 1);
36008
33702
  });
36009
33703
  });
36010
33704
  }
@@ -36122,7 +33816,7 @@ async function runSkillsCommand(options, dependencies = {}) {
36122
33816
  );
36123
33817
  return 5;
36124
33818
  }
36125
- mkdirSync10(dirname14(plan.statePath), { recursive: true });
33819
+ mkdirSync10(dirname15(plan.statePath), { recursive: true });
36126
33820
  writeFileSync13(
36127
33821
  plan.statePath,
36128
33822
  `${JSON.stringify(
@@ -36260,7 +33954,7 @@ function phasesFromLegacyStatus(status) {
36260
33954
  function readSetupState(input2) {
36261
33955
  try {
36262
33956
  const parsed = JSON.parse(
36263
- readFileSync13(
33957
+ readFileSync14(
36264
33958
  setupStatePath(input2.baseUrl, input2.scope, input2.root),
36265
33959
  "utf8"
36266
33960
  )
@@ -36336,7 +34030,7 @@ function buildPendingAuthorizationOutput(input2) {
36336
34030
  };
36337
34031
  }
36338
34032
  function setupStatePath(baseUrl, scope, root) {
36339
- return scope === "local" && root ? join15(root, ".deepline", "setup", "state.json") : join15(sdkCliStateDirPath(baseUrl), "setup.json");
34033
+ return scope === "local" && root ? join16(root, ".deepline", "setup", "state.json") : join16(sdkCliStateDirPath(baseUrl), "setup.json");
36340
34034
  }
36341
34035
  async function captureStdout2(run) {
36342
34036
  let stdout = "";
@@ -36365,57 +34059,16 @@ function asRecord3(value) {
36365
34059
  }
36366
34060
  function safeRead(path) {
36367
34061
  try {
36368
- return readFileSync13(path, "utf8");
34062
+ return readFileSync14(path, "utf8");
36369
34063
  } catch {
36370
34064
  return "";
36371
34065
  }
36372
34066
  }
36373
- function isNpmManagedDeeplinePath(path) {
36374
- try {
36375
- return realpathSync3(path).includes(`${join15("node_modules", "deepline")}`);
36376
- } catch {
36377
- return false;
36378
- }
36379
- }
36380
- function isInstallerManagedLegacyLauncher(path) {
36381
- const content = safeRead(path);
36382
- return content.includes("DEEPLINE_REAL_BINARY") && content.includes("DEEPLINE_ACTIVE_FILE");
36383
- }
36384
34067
  function removeKnownLegacyPaths(baseUrl) {
36385
- const home = homedir9();
36386
- const hostDir = join15(home, ".local", "deepline", baseUrlSlug(baseUrl));
36387
- const legacyLauncherPath = join15(home, ".local", "bin", "deepline");
36388
- const installerCommandPath = safeRead(
36389
- join15(hostDir, "sdk", ".command-path")
36390
- ).trim();
36391
- const relativeInstallerCommandPath = installerCommandPath ? relative5(resolve14(hostDir), resolve14(installerCommandPath)) : "";
36392
- const isOwnedInstallerCommand = Boolean(installerCommandPath) && relativeInstallerCommandPath !== "" && !relativeInstallerCommandPath.startsWith(
36393
- `..${process.platform === "win32" ? "\\" : "/"}`
36394
- ) && relativeInstallerCommandPath !== ".." && basename6(installerCommandPath) === "deepline";
36395
- const candidates = [
36396
- ...isInstallerManagedLegacyLauncher(legacyLauncherPath) ? [legacyLauncherPath] : [],
36397
- join15(home, ".local", "bin", "deepline-real"),
36398
- join15(hostDir, "bin", "deepline"),
36399
- join15(hostDir, "bin", "deepline-real"),
36400
- join15(hostDir, "cli", ".install-method"),
36401
- join15(hostDir, "cli", ".version"),
36402
- join15(hostDir, "sdk", ".install-method"),
36403
- join15(hostDir, "sdk", ".command-path"),
36404
- ...isOwnedInstallerCommand ? [
36405
- installerCommandPath,
36406
- join15(dirname15(installerCommandPath), "deepline-sdk")
36407
- ] : []
36408
- ];
36409
- const removed = [];
36410
- for (const path of candidates) {
36411
- if (!existsSync13(path)) continue;
36412
- if (path === installerCommandPath && isNpmManagedDeeplinePath(path)) {
36413
- continue;
36414
- }
36415
- rmSync4(path, { force: true });
36416
- removed.push(path);
36417
- }
36418
- return removed;
34068
+ return CliInstallation.forUser({
34069
+ baseUrlSlug: baseUrlSlug(baseUrl),
34070
+ home: homedir9()
34071
+ }).removeRetiredArtifacts();
36419
34072
  }
36420
34073
  function resolvePathCommands(command) {
36421
34074
  const lookup = spawnSync2(
@@ -36425,7 +34078,7 @@ function resolvePathCommands(command) {
36425
34078
  );
36426
34079
  return [
36427
34080
  ...new Set(
36428
- String(lookup.stdout ?? "").split(/\r?\n/).map((line) => line.trim()).filter(Boolean).map((path) => resolve14(path))
34081
+ String(lookup.stdout ?? "").split(/\r?\n/).map((line) => line.trim()).filter(Boolean).map((path) => resolve15(path))
36429
34082
  )
36430
34083
  ];
36431
34084
  }
@@ -36435,7 +34088,7 @@ function resolvePathCommand(command) {
36435
34088
  function isHomebrewFormulaCommand(path) {
36436
34089
  let resolvedPath = path;
36437
34090
  try {
36438
- resolvedPath = realpathSync3(path);
34091
+ resolvedPath = realpathSync4(path);
36439
34092
  } catch {
36440
34093
  return false;
36441
34094
  }
@@ -36446,7 +34099,7 @@ function isHomebrewFormulaCommand(path) {
36446
34099
  function resolvePersistentGlobalCommand(dependencies = {}) {
36447
34100
  const platform3 = dependencies.platform ?? process.platform;
36448
34101
  const run = dependencies.spawn ?? spawnSync2;
36449
- const pathExists = dependencies.exists ?? existsSync13;
34102
+ const pathExists = dependencies.exists ?? existsSync14;
36450
34103
  const pathClis = dependencies.pathClis ?? resolvePathCommands("deepline");
36451
34104
  const homebrewCommand = pathClis.find(isHomebrewFormulaCommand);
36452
34105
  if (homebrewCommand) return homebrewCommand;
@@ -36458,7 +34111,7 @@ function resolvePersistentGlobalCommand(dependencies = {}) {
36458
34111
  if (prefix.status !== 0) return null;
36459
34112
  const root = String(prefix.stdout ?? "").trim();
36460
34113
  if (!root) return null;
36461
- const candidates = platform3 === "win32" ? [join15(root, "deepline.cmd"), join15(root, "deepline")] : [join15(root, "bin", "deepline")];
34114
+ const candidates = platform3 === "win32" ? [join16(root, "deepline.cmd"), join16(root, "deepline")] : [join16(root, "bin", "deepline")];
36462
34115
  return candidates.find((candidate) => pathExists(candidate)) ?? null;
36463
34116
  }
36464
34117
  function inspectGlobalCliAvailability(input2) {
@@ -36471,20 +34124,20 @@ function inspectGlobalCliAvailability(input2) {
36471
34124
  }
36472
34125
  function pathsResolveToSameFile(left, right) {
36473
34126
  try {
36474
- return realpathSync3(left) === realpathSync3(right);
34127
+ return realpathSync4(left) === realpathSync4(right);
36475
34128
  } catch {
36476
- return resolve14(left) === resolve14(right);
34129
+ return resolve15(left) === resolve15(right);
36477
34130
  }
36478
34131
  }
36479
34132
  function isKnownDeeplineCommand(path) {
36480
- const entrypoint = process.argv[1] ? resolve14(process.argv[1]) : "";
34133
+ const entrypoint = process.argv[1] ? resolve15(process.argv[1]) : "";
36481
34134
  let resolvedPath = path;
36482
34135
  try {
36483
- resolvedPath = realpathSync3(path);
34136
+ resolvedPath = realpathSync4(path);
36484
34137
  } catch {
36485
34138
  }
36486
34139
  if (entrypoint && resolvedPath === entrypoint) return true;
36487
- if (resolvedPath.includes(`${join15("node_modules", "deepline")}`)) return true;
34140
+ if (resolvedPath.includes(`${join16("node_modules", "deepline")}`)) return true;
36488
34141
  const content = safeRead(path);
36489
34142
  return content.includes("node_modules/deepline") || content.includes("node_modules\\deepline") || content.includes("DEEPLINE_CONFIG_SCOPE") || content.includes("deepline-real");
36490
34143
  }
@@ -36492,9 +34145,9 @@ function inspectPathConflict() {
36492
34145
  const commandPath = resolvePathCommand("deepline");
36493
34146
  if (!commandPath || isKnownDeeplineCommand(commandPath)) return null;
36494
34147
  try {
36495
- if (lstatSync(commandPath).isSymbolicLink()) {
36496
- const target = realpathSync3(commandPath);
36497
- if (target.includes(`${join15("node_modules", "deepline")}`)) return null;
34148
+ if (lstatSync2(commandPath).isSymbolicLink()) {
34149
+ const target = realpathSync4(commandPath);
34150
+ if (target.includes(`${join16("node_modules", "deepline")}`)) return null;
36498
34151
  }
36499
34152
  } catch {
36500
34153
  }
@@ -36502,7 +34155,7 @@ function inspectPathConflict() {
36502
34155
  }
36503
34156
  function writeSetupState(input2) {
36504
34157
  const path = setupStatePath(input2.baseUrl, input2.scope, input2.root);
36505
- mkdirSync11(dirname15(path), { recursive: true });
34158
+ mkdirSync11(dirname16(path), { recursive: true });
36506
34159
  writeFileSync14(
36507
34160
  path,
36508
34161
  `${JSON.stringify(
@@ -36543,7 +34196,7 @@ function failSetupPhase(phases, phase, code) {
36543
34196
  phases[phase] = { status: "failed", code };
36544
34197
  }
36545
34198
  function rollbackCommand(scope, root) {
36546
- const prefix = scope === "local" && root ? ` --prefix ${JSON.stringify(join15(root, ".deepline", "runtime"))}` : "";
34199
+ const prefix = scope === "local" && root ? ` --prefix ${JSON.stringify(join16(root, ".deepline", "runtime"))}` : "";
36547
34200
  return `npm install -g${prefix} --no-audit --no-fund --include=optional --allow-scripts=esbuild deepline@${SDK_VERSION}`;
36548
34201
  }
36549
34202
  function setupResumeCommand(baseUrl, scope) {
@@ -36630,12 +34283,12 @@ function buildDoctorAssessment(input2) {
36630
34283
  const connected = input2.authStatus.payload?.connected === true;
36631
34284
  const authScopeOk = input2.scope === "local" ? Boolean(projectAuth) : Boolean(apiKey && !projectAuth);
36632
34285
  const skillsOk = skillsState?.scope === input2.scope && typeof skillsState.skillsVersion === "string" && Array.isArray(skillsState.agents) && skillsState.agents.length > 0;
36633
- const runningCliPath = process.argv[1] ? resolve14(process.argv[1]) : null;
34286
+ const runningCliPath = process.argv[1] ? resolve15(process.argv[1]) : null;
36634
34287
  const globalCli = input2.scope === "global" ? inspectGlobalCliAvailability() : null;
36635
34288
  const pathGlobalCli = globalCli?.path ?? null;
36636
34289
  const cliPath = input2.scope === "global" ? pathGlobalCli : runningCliPath;
36637
34290
  const cliScopeOk = input2.scope === "global" ? Boolean(pathGlobalCli) : Boolean(
36638
- input2.root && runningCliPath?.includes(join15(input2.root, ".deepline", "runtime"))
34291
+ input2.root && runningCliPath?.includes(join16(input2.root, ".deepline", "runtime"))
36639
34292
  );
36640
34293
  const checks = {
36641
34294
  cli: {
@@ -37163,15 +34816,15 @@ Examples:
37163
34816
 
37164
34817
  // src/cli/update-preferences.ts
37165
34818
  import {
37166
- existsSync as existsSync14,
34819
+ existsSync as existsSync15,
37167
34820
  mkdirSync as mkdirSync12,
37168
- readFileSync as readFileSync14,
34821
+ readFileSync as readFileSync15,
37169
34822
  renameSync,
37170
34823
  rmSync as rmSync5,
37171
34824
  writeFileSync as writeFileSync15
37172
34825
  } from "fs";
37173
34826
  import { homedir as homedir10 } from "os";
37174
- import { dirname as dirname16, join as join16 } from "path";
34827
+ import { dirname as dirname17, join as join17 } from "path";
37175
34828
  var UPDATE_PREFERENCES_SCHEMA_VERSION = 1;
37176
34829
  var CLI_UPDATE_MESSAGES = [
37177
34830
  {
@@ -37200,7 +34853,7 @@ function unreadablePreferences(path, error) {
37200
34853
  };
37201
34854
  }
37202
34855
  function cliUpdatePreferencesPath(homeDir2 = homedir10()) {
37203
- return join16(
34856
+ return join17(
37204
34857
  homeDir2,
37205
34858
  ".local",
37206
34859
  "deepline",
@@ -37210,9 +34863,9 @@ function cliUpdatePreferencesPath(homeDir2 = homedir10()) {
37210
34863
  }
37211
34864
  function readCliUpdatePreferences(homeDir2 = homedir10()) {
37212
34865
  const path = cliUpdatePreferencesPath(homeDir2);
37213
- if (!existsSync14(path)) return defaultPreferences();
34866
+ if (!existsSync15(path)) return defaultPreferences();
37214
34867
  try {
37215
- const parsed = JSON.parse(readFileSync14(path, "utf8"));
34868
+ const parsed = JSON.parse(readFileSync15(path, "utf8"));
37216
34869
  return {
37217
34870
  schemaVersion: UPDATE_PREFERENCES_SCHEMA_VERSION,
37218
34871
  autoUpdateEnabled: typeof parsed.autoUpdateEnabled === "boolean" ? parsed.autoUpdateEnabled : true,
@@ -37228,7 +34881,7 @@ function readCliUpdatePreferences(homeDir2 = homedir10()) {
37228
34881
  function writeCliUpdatePreferences(preferences, homeDir2 = homedir10()) {
37229
34882
  const path = cliUpdatePreferencesPath(homeDir2);
37230
34883
  const tempPath = `${path}.${process.pid}.tmp`;
37231
- mkdirSync12(dirname16(path), { recursive: true });
34884
+ mkdirSync12(dirname17(path), { recursive: true });
37232
34885
  try {
37233
34886
  writeFileSync15(tempPath, `${JSON.stringify(preferences, null, 2)}
37234
34887
  `, {
@@ -37288,10 +34941,10 @@ function consumePendingCliUpdateMessages(homeDir2 = homedir10()) {
37288
34941
  // src/cli/commands/update.ts
37289
34942
  import { spawn as spawn4, spawnSync as spawnSync3 } from "child_process";
37290
34943
  import {
37291
- existsSync as existsSync16,
34944
+ existsSync as existsSync17,
37292
34945
  mkdirSync as mkdirSync13,
37293
- realpathSync as realpathSync4,
37294
- readFileSync as readFileSync16,
34946
+ realpathSync as realpathSync5,
34947
+ readFileSync as readFileSync17,
37295
34948
  renameSync as renameSync2,
37296
34949
  rmSync as rmSync6,
37297
34950
  unlinkSync as unlinkSync2,
@@ -37300,17 +34953,17 @@ import {
37300
34953
  import { homedir as homedir11 } from "os";
37301
34954
  import {
37302
34955
  basename as basename7,
37303
- dirname as dirname17,
34956
+ dirname as dirname18,
37304
34957
  isAbsolute as isAbsolute7,
37305
- join as join18,
34958
+ join as join19,
37306
34959
  relative as relative7,
37307
- resolve as resolve16
34960
+ resolve as resolve17
37308
34961
  } from "path";
37309
34962
 
37310
34963
  // src/cli/install-integrity.ts
37311
34964
  import { createRequire } from "module";
37312
- import { existsSync as existsSync15, readFileSync as readFileSync15, statSync as statSync5 } from "fs";
37313
- import { isAbsolute as isAbsolute6, join as join17, relative as relative6, resolve as resolve15 } from "path";
34965
+ import { existsSync as existsSync16, readFileSync as readFileSync16, statSync as statSync5 } from "fs";
34966
+ import { isAbsolute as isAbsolute6, join as join18, relative as relative6, resolve as resolve16 } from "path";
37314
34967
  var SDK_SIDECAR_CRITICAL_PACKAGE_FILES = [
37315
34968
  "dist/cli/index.mjs",
37316
34969
  "dist/index.mjs",
@@ -37335,15 +34988,15 @@ function safeRelativePath(value) {
37335
34988
  }
37336
34989
  function resolveContainedPath(root, value) {
37337
34990
  if (!safeRelativePath(value)) return null;
37338
- const target = resolve15(root, value);
37339
- const relativeTarget = relative6(resolve15(root), target);
34991
+ const target = resolve16(root, value);
34992
+ const relativeTarget = relative6(resolve16(root), target);
37340
34993
  if (!relativeTarget || relativeTarget.startsWith("..") || isAbsolute6(relativeTarget)) {
37341
34994
  return null;
37342
34995
  }
37343
34996
  return target;
37344
34997
  }
37345
34998
  function parseJson(path) {
37346
- return JSON.parse(readFileSync15(path, "utf8"));
34999
+ return JSON.parse(readFileSync16(path, "utf8"));
37347
35000
  }
37348
35001
  function isFile(path) {
37349
35002
  try {
@@ -37353,7 +35006,7 @@ function isFile(path) {
37353
35006
  }
37354
35007
  }
37355
35008
  function readManifest(packageRoot) {
37356
- const packageJsonPath = join17(packageRoot, "package.json");
35009
+ const packageJsonPath = join18(packageRoot, "package.json");
37357
35010
  let packageJson;
37358
35011
  try {
37359
35012
  packageJson = parseJson(packageJsonPath);
@@ -37361,7 +35014,7 @@ function readManifest(packageRoot) {
37361
35014
  return {
37362
35015
  mode: "manifest",
37363
35016
  invalidReason: `invalid Deepline package metadata: ${error.message}`,
37364
- missing: existsSync15(packageJsonPath) ? [] : ["deepline/package.json"]
35017
+ missing: existsSync16(packageJsonPath) ? [] : ["deepline/package.json"]
37365
35018
  };
37366
35019
  }
37367
35020
  if (!packageJson || typeof packageJson !== "object" || Array.isArray(packageJson)) {
@@ -37427,8 +35080,8 @@ function readManifest(packageRoot) {
37427
35080
  return { mode: "manifest", manifest };
37428
35081
  }
37429
35082
  function inspectSdkSidecarInstall(versionDir) {
37430
- const nodeModulesRoot = join17(versionDir, "node_modules");
37431
- const packageRoot = join17(nodeModulesRoot, "deepline");
35083
+ const nodeModulesRoot = join18(versionDir, "node_modules");
35084
+ const packageRoot = join18(nodeModulesRoot, "deepline");
37432
35085
  const manifestResult = readManifest(packageRoot);
37433
35086
  if ("invalidReason" in manifestResult) {
37434
35087
  return {
@@ -37439,8 +35092,8 @@ function inspectSdkSidecarInstall(versionDir) {
37439
35092
  };
37440
35093
  }
37441
35094
  const missing = [
37442
- ...manifestResult.manifest.packageFiles.filter((path) => !isFile(join17(packageRoot, path))).map((path) => `deepline/${path}`),
37443
- ...manifestResult.manifest.dependencyFiles.filter((path) => !isFile(join17(nodeModulesRoot, path))).map((path) => `node_modules/${path}`)
35095
+ ...manifestResult.manifest.packageFiles.filter((path) => !isFile(join18(packageRoot, path))).map((path) => `deepline/${path}`),
35096
+ ...manifestResult.manifest.dependencyFiles.filter((path) => !isFile(join18(nodeModulesRoot, path))).map((path) => `node_modules/${path}`)
37444
35097
  ];
37445
35098
  return {
37446
35099
  ok: missing.length === 0,
@@ -37451,7 +35104,7 @@ function inspectSdkSidecarInstall(versionDir) {
37451
35104
  }
37452
35105
  function probeSdkSidecarEsbuild(versionDir) {
37453
35106
  try {
37454
- const requireFromInstall = createRequire(join17(versionDir, "package.json"));
35107
+ const requireFromInstall = createRequire(join18(versionDir, "package.json"));
37455
35108
  const esbuild = requireFromInstall("esbuild");
37456
35109
  if (typeof esbuild.transformSync !== "function") {
37457
35110
  return "esbuild does not export transformSync";
@@ -37526,7 +35179,7 @@ function sidecarStateDir(input2) {
37526
35179
  if (!scope || scope.includes("/") || scope.includes("\\")) {
37527
35180
  return null;
37528
35181
  }
37529
- return join18(input2.homeDir, ".local", "deepline", scope, "sdk-cli");
35182
+ return join19(input2.homeDir, ".local", "deepline", scope, "sdk-cli");
37530
35183
  }
37531
35184
  function sidecarRegistryUrl(hostUrl) {
37532
35185
  let url;
@@ -37553,7 +35206,7 @@ function publicNpmFallbackRegistryUrl(hostUrl) {
37553
35206
  }
37554
35207
  function readOptionalText(path) {
37555
35208
  try {
37556
- return readFileSync16(path, "utf8").trim();
35209
+ return readFileSync17(path, "utf8").trim();
37557
35210
  } catch {
37558
35211
  return "";
37559
35212
  }
@@ -37562,18 +35215,18 @@ function resolvePythonSidecarUpdatePlan(options) {
37562
35215
  const stateDir = sidecarStateDir(options);
37563
35216
  if (!stateDir) return null;
37564
35217
  const relativeEntrypoint = relative7(
37565
- resolve16(stateDir),
37566
- resolve16(options.entrypoint)
35218
+ resolve17(stateDir),
35219
+ resolve17(options.entrypoint)
37567
35220
  );
37568
35221
  if (!relativeEntrypoint || relativeEntrypoint.startsWith("..") || isAbsolute7(relativeEntrypoint)) {
37569
35222
  return null;
37570
35223
  }
37571
- const installMethod = readOptionalText(join18(stateDir, ".install-method"));
35224
+ const installMethod = readOptionalText(join19(stateDir, ".install-method"));
37572
35225
  if (installMethod !== "python-sidecar") return null;
37573
35226
  const scope = options.env.DEEPLINE_CONFIG_SCOPE?.trim() || "";
37574
35227
  const hostUrl = options.env.DEEPLINE_HOST_URL?.trim() || "";
37575
- const nodeBin = readOptionalText(join18(stateDir, ".node-bin")) || process.execPath;
37576
- const sidecarPath = readOptionalText(join18(stateDir, ".command-path")) || join18(
35228
+ const nodeBin = readOptionalText(join19(stateDir, ".node-bin")) || process.execPath;
35229
+ const sidecarPath = readOptionalText(join19(stateDir, ".command-path")) || join19(
37577
35230
  stateDir,
37578
35231
  "bin",
37579
35232
  process.platform === "win32" ? "deepline-sdk.cmd" : "deepline-sdk"
@@ -37581,7 +35234,7 @@ function resolvePythonSidecarUpdatePlan(options) {
37581
35234
  const packageSpec = options.packageSpec || "deepline@latest";
37582
35235
  const npmCommand = "npm";
37583
35236
  const registryUrl = sidecarRegistryUrl(hostUrl);
37584
- const versionDir = join18(stateDir, "versions", "<version>");
35237
+ const versionDir = join19(stateDir, "versions", "<version>");
37585
35238
  const manualCommand = `${buildSidecarProjectConfigCommand(versionDir, nodeBin)} && ${npmCommand} install --prefix ${shellQuote4(versionDir)} --registry ${shellQuote4(registryUrl)} ${NPM_SDK_INSTALL_COMMON_FLAGS.map(shellQuote4).join(" ")} ${shellQuote4(packageSpec)}`;
37586
35239
  return {
37587
35240
  kind: "python-sidecar",
@@ -37597,16 +35250,16 @@ function resolvePythonSidecarUpdatePlan(options) {
37597
35250
  };
37598
35251
  }
37599
35252
  function findRepoBackedSdkRoot(startPath) {
37600
- let current = resolve16(startPath);
35253
+ let current = resolve17(startPath);
37601
35254
  while (true) {
37602
- if (existsSync16(join18(current, "package.json")) && existsSync16(join18(current, "bin", "deepline-dev.ts"))) {
37603
- const parent2 = dirname17(current);
37604
- return basename7(parent2) === "packages" && basename7(current) === "sdk" ? dirname17(parent2) : parent2;
35255
+ if (existsSync17(join19(current, "package.json")) && existsSync17(join19(current, "bin", "deepline-dev.ts"))) {
35256
+ const parent2 = dirname18(current);
35257
+ return basename7(parent2) === "packages" && basename7(current) === "sdk" ? dirname18(parent2) : parent2;
37605
35258
  }
37606
- if (existsSync16(join18(current, "sdk", "package.json")) && existsSync16(join18(current, "sdk", "bin", "deepline-dev.ts"))) {
35259
+ if (existsSync17(join19(current, "sdk", "package.json")) && existsSync17(join19(current, "sdk", "bin", "deepline-dev.ts"))) {
37607
35260
  return current;
37608
35261
  }
37609
- const parent = dirname17(current);
35262
+ const parent = dirname18(current);
37610
35263
  if (parent === current) return null;
37611
35264
  current = parent;
37612
35265
  }
@@ -37614,9 +35267,9 @@ function findRepoBackedSdkRoot(startPath) {
37614
35267
  function inferNpmGlobalPrefixFromEntrypoint(entrypoint, env) {
37615
35268
  const normalized = (() => {
37616
35269
  try {
37617
- return realpathSync4(entrypoint);
35270
+ return realpathSync5(entrypoint);
37618
35271
  } catch {
37619
- return resolve16(entrypoint);
35272
+ return resolve17(entrypoint);
37620
35273
  }
37621
35274
  })();
37622
35275
  const parts = normalized.split(/[\\/]+/);
@@ -37631,10 +35284,10 @@ function inferNpmGlobalPrefixFromEntrypoint(entrypoint, env) {
37631
35284
  const directPrefix = prefixParts.join("/").toLowerCase();
37632
35285
  const knownWindowsPrefixes = [
37633
35286
  env.npm_config_prefix,
37634
- env.APPDATA ? join18(env.APPDATA, "npm") : void 0
37635
- ].filter((value) => Boolean(value)).map((value) => resolve16(value).replace(/\\/g, "/").toLowerCase());
35287
+ env.APPDATA ? join19(env.APPDATA, "npm") : void 0
35288
+ ].filter((value) => Boolean(value)).map((value) => resolve17(value).replace(/\\/g, "/").toLowerCase());
37636
35289
  if (!knownWindowsPrefixes.includes(
37637
- resolve16(directPrefix).replace(/\\/g, "/").toLowerCase()
35290
+ resolve17(directPrefix).replace(/\\/g, "/").toLowerCase()
37638
35291
  )) {
37639
35292
  return null;
37640
35293
  }
@@ -37647,9 +35300,9 @@ function normalizedNpmPrefix(value) {
37647
35300
  if (!trimmed) return null;
37648
35301
  const normalized = (() => {
37649
35302
  try {
37650
- return realpathSync4(resolve16(trimmed));
35303
+ return realpathSync5(resolve17(trimmed));
37651
35304
  } catch {
37652
- return resolve16(trimmed);
35305
+ return resolve17(trimmed);
37653
35306
  }
37654
35307
  })().replace(/\\/g, "/");
37655
35308
  return process.platform === "win32" ? normalized.toLowerCase() : normalized;
@@ -37672,9 +35325,9 @@ function resolveNpmGlobalPrefix(env) {
37672
35325
  function isHomebrewFormulaEntrypoint(entrypoint) {
37673
35326
  const normalized = (() => {
37674
35327
  try {
37675
- return realpathSync4(entrypoint);
35328
+ return realpathSync5(entrypoint);
37676
35329
  } catch {
37677
- return resolve16(entrypoint);
35330
+ return resolve17(entrypoint);
37678
35331
  }
37679
35332
  })();
37680
35333
  const parts = normalized.split(/[\\/]+/);
@@ -37684,8 +35337,8 @@ function isHomebrewFormulaEntrypoint(entrypoint) {
37684
35337
  function resolveUpdatePlan(options = {}) {
37685
35338
  const env = options.env ?? process.env;
37686
35339
  const homeDir2 = options.homeDir ?? homedir11();
37687
- const entrypoint = options.entrypoint ?? (process.argv[1] ? resolve16(process.argv[1]) : "");
37688
- const sourceRoot = entrypoint ? findRepoBackedSdkRoot(dirname17(entrypoint)) : null;
35340
+ const entrypoint = options.entrypoint ?? (process.argv[1] ? resolve17(process.argv[1]) : "");
35341
+ const sourceRoot = entrypoint ? findRepoBackedSdkRoot(dirname18(entrypoint)) : null;
37689
35342
  if (sourceRoot) {
37690
35343
  return {
37691
35344
  kind: "source",
@@ -37736,9 +35389,9 @@ var AUTO_UPDATE_FAILURE_FILE = ".auto-update-failure.json";
37736
35389
  function autoUpdateFailurePath(plan) {
37737
35390
  if (plan.kind === "source" || plan.kind === "homebrew") return null;
37738
35391
  if (plan.kind === "python-sidecar") {
37739
- return join18(plan.stateDir, AUTO_UPDATE_FAILURE_FILE);
35392
+ return join19(plan.stateDir, AUTO_UPDATE_FAILURE_FILE);
37740
35393
  }
37741
- return join18(
35394
+ return join19(
37742
35395
  homedir11(),
37743
35396
  ".local",
37744
35397
  "deepline",
@@ -37756,7 +35409,7 @@ function readAutoUpdateFailure(plan) {
37756
35409
  if (!path) return null;
37757
35410
  try {
37758
35411
  const parsed = JSON.parse(
37759
- readFileSync16(path, "utf8")
35412
+ readFileSync17(path, "utf8")
37760
35413
  );
37761
35414
  if ((parsed.kind === "npm-global" || parsed.kind === "python-sidecar") && typeof parsed.packageSpec === "string" && typeof parsed.failedAt === "string" && typeof parsed.exitCode === "number" && typeof parsed.manualCommand === "string") {
37762
35415
  return parsed;
@@ -37777,7 +35430,7 @@ function writeAutoUpdateFailure(plan, exitCode) {
37777
35430
  manualCommand: plan.manualCommand
37778
35431
  };
37779
35432
  try {
37780
- mkdirSync13(dirname17(path), { recursive: true });
35433
+ mkdirSync13(dirname18(path), { recursive: true });
37781
35434
  writeFileSync16(path, `${JSON.stringify(marker, null, 2)}
37782
35435
  `, "utf8");
37783
35436
  } catch {
@@ -37825,7 +35478,7 @@ function safeVersionSegment(value) {
37825
35478
  return /^[0-9A-Za-z._-]+$/.test(normalized) ? normalized : "";
37826
35479
  }
37827
35480
  function entryPathInVersionDir(versionDir) {
37828
- return join18(
35481
+ return join19(
37829
35482
  versionDir,
37830
35483
  "node_modules",
37831
35484
  "deepline",
@@ -37835,14 +35488,14 @@ function entryPathInVersionDir(versionDir) {
37835
35488
  );
37836
35489
  }
37837
35490
  function installedPackageVersion(versionDir) {
37838
- const packageJsonPath = join18(
35491
+ const packageJsonPath = join19(
37839
35492
  versionDir,
37840
35493
  "node_modules",
37841
35494
  "deepline",
37842
35495
  "package.json"
37843
35496
  );
37844
35497
  try {
37845
- const parsed = JSON.parse(readFileSync16(packageJsonPath, "utf8"));
35498
+ const parsed = JSON.parse(readFileSync17(packageJsonPath, "utf8"));
37846
35499
  return typeof parsed.version === "string" ? safeVersionSegment(parsed.version) : "";
37847
35500
  } catch {
37848
35501
  return "";
@@ -37957,16 +35610,16 @@ async function runNpmInstallWithRegistryFallback(input2) {
37957
35610
  return first.exitCode;
37958
35611
  }
37959
35612
  function writeSidecarLauncher(input2) {
37960
- mkdirSync13(dirname17(input2.path), { recursive: true });
37961
- const packageRoot = dirname17(dirname17(dirname17(input2.entryPath)));
37962
- const versionDir = dirname17(dirname17(packageRoot));
35613
+ mkdirSync13(dirname18(input2.path), { recursive: true });
35614
+ const packageRoot = dirname18(dirname18(dirname18(input2.entryPath)));
35615
+ const versionDir = dirname18(dirname18(packageRoot));
37963
35616
  const esbuildProbe = "const {createRequire}=require('node:module');const path=require('node:path');const req=createRequire(path.join(process.argv[1],'package.json'));const result=req('esbuild').transformSync('const value: number = 1;',{loader:'ts'});if(!result||typeof result.code!=='string')process.exit(3);";
37964
35617
  const criticalPaths = [
37965
35618
  ...SDK_SIDECAR_CRITICAL_PACKAGE_FILES.map(
37966
- (path) => join18(packageRoot, path)
35619
+ (path) => join19(packageRoot, path)
37967
35620
  ),
37968
35621
  ...SDK_SIDECAR_CRITICAL_DEPENDENCY_FILES.map(
37969
- (path) => join18(versionDir, "node_modules", path)
35622
+ (path) => join19(versionDir, "node_modules", path)
37970
35623
  )
37971
35624
  ];
37972
35625
  if (process.platform === "win32") {
@@ -38020,17 +35673,17 @@ function writeSidecarLauncher(input2) {
38020
35673
  );
38021
35674
  }
38022
35675
  async function runPythonSidecarUpdatePlan(plan) {
38023
- const versionsDir = join18(plan.stateDir, "versions");
38024
- const tempDir = join18(
35676
+ const versionsDir = join19(plan.stateDir, "versions");
35677
+ const tempDir = join19(
38025
35678
  versionsDir,
38026
35679
  `.tmp-sdk-update-${process.pid}-${Date.now()}`
38027
35680
  );
38028
35681
  rmSync6(tempDir, { recursive: true, force: true });
38029
35682
  mkdirSync13(tempDir, { recursive: true });
38030
- writeFileSync16(join18(tempDir, "package.json"), NPM_SDK_SIDECAR_PACKAGE_JSON);
35683
+ writeFileSync16(join19(tempDir, "package.json"), NPM_SDK_SIDECAR_PACKAGE_JSON);
38031
35684
  const env = {
38032
35685
  ...process.env,
38033
- PATH: `${dirname17(plan.nodeBin)}${process.platform === "win32" ? ";" : ":"}${process.env.PATH ?? ""}`
35686
+ PATH: `${dirname18(plan.nodeBin)}${process.platform === "win32" ? ";" : ":"}${process.env.PATH ?? ""}`
38034
35687
  };
38035
35688
  const installResult = await runCommand(
38036
35689
  plan.npmCommand,
@@ -38067,7 +35720,7 @@ async function runPythonSidecarUpdatePlan(plan) {
38067
35720
  rmSync6(tempDir, { recursive: true, force: true });
38068
35721
  return 1;
38069
35722
  }
38070
- const finalDir = join18(versionsDir, installedVersion);
35723
+ const finalDir = join19(versionsDir, installedVersion);
38071
35724
  const finalEntryPath = entryPathInVersionDir(finalDir);
38072
35725
  const finalFailure = sidecarInstallFailure(finalDir);
38073
35726
  let backupDir = null;
@@ -38075,8 +35728,8 @@ async function runPythonSidecarUpdatePlan(plan) {
38075
35728
  rmSync6(tempDir, { recursive: true, force: true });
38076
35729
  } else {
38077
35730
  let shouldPublishTemp = true;
38078
- if (existsSync16(finalDir)) {
38079
- backupDir = join18(
35731
+ if (existsSync17(finalDir)) {
35732
+ backupDir = join19(
38080
35733
  versionsDir,
38081
35734
  `.backup-${installedVersion}-${process.pid}-${Date.now()}`
38082
35735
  );
@@ -38109,7 +35762,7 @@ async function runPythonSidecarUpdatePlan(plan) {
38109
35762
  backupDir = null;
38110
35763
  } else {
38111
35764
  let restoreFailure = "";
38112
- if (backupDir && existsSync16(backupDir) && !existsSync16(finalDir)) {
35765
+ if (backupDir && existsSync17(backupDir) && !existsSync17(finalDir)) {
38113
35766
  try {
38114
35767
  renameSync2(backupDir, finalDir);
38115
35768
  backupDir = null;
@@ -38128,7 +35781,7 @@ async function runPythonSidecarUpdatePlan(plan) {
38128
35781
  }
38129
35782
  const publishedFailure = sidecarStructureFailure(finalDir);
38130
35783
  if (publishedFailure) {
38131
- if (backupDir && existsSync16(backupDir)) {
35784
+ if (backupDir && existsSync17(backupDir)) {
38132
35785
  rmSync6(finalDir, { recursive: true, force: true });
38133
35786
  try {
38134
35787
  renameSync2(backupDir, finalDir);
@@ -38151,27 +35804,27 @@ async function runPythonSidecarUpdatePlan(plan) {
38151
35804
  entryPath: finalEntryPath
38152
35805
  });
38153
35806
  writeFileSync16(
38154
- join18(plan.stateDir, ".version"),
35807
+ join19(plan.stateDir, ".version"),
38155
35808
  `${installedVersion}
38156
35809
  `,
38157
35810
  "utf8"
38158
35811
  );
38159
35812
  writeFileSync16(
38160
- join18(plan.stateDir, ".install-method"),
35813
+ join19(plan.stateDir, ".install-method"),
38161
35814
  "python-sidecar\n",
38162
35815
  "utf8"
38163
35816
  );
38164
35817
  writeFileSync16(
38165
- join18(plan.stateDir, ".command-path"),
35818
+ join19(plan.stateDir, ".command-path"),
38166
35819
  `${plan.sidecarPath}
38167
35820
  `,
38168
35821
  "utf8"
38169
35822
  );
38170
- writeFileSync16(join18(plan.stateDir, ".runner"), "node\n", "utf8");
38171
- writeFileSync16(join18(plan.stateDir, ".node-bin"), `${plan.nodeBin}
35823
+ writeFileSync16(join19(plan.stateDir, ".runner"), "node\n", "utf8");
35824
+ writeFileSync16(join19(plan.stateDir, ".node-bin"), `${plan.nodeBin}
38172
35825
  `, "utf8");
38173
35826
  writeFileSync16(
38174
- join18(plan.stateDir, ".entry-path"),
35827
+ join19(plan.stateDir, ".entry-path"),
38175
35828
  `${finalEntryPath}
38176
35829
  `,
38177
35830
  "utf8"
@@ -39100,13 +36753,13 @@ chooses the connected Slack channel or member and the events it receives.
39100
36753
  import { Option as Option2 } from "commander";
39101
36754
  import {
39102
36755
  chmodSync,
39103
- existsSync as existsSync17,
36756
+ existsSync as existsSync18,
39104
36757
  mkdtempSync,
39105
- readFileSync as readFileSync17,
36758
+ readFileSync as readFileSync18,
39106
36759
  writeFileSync as writeFileSync18
39107
36760
  } from "fs";
39108
36761
  import { tmpdir as tmpdir5 } from "os";
39109
- import { join as join20, resolve as resolve17 } from "path";
36762
+ import { join as join21, resolve as resolve18 } from "path";
39110
36763
 
39111
36764
  // src/tool-output.ts
39112
36765
  import {
@@ -39117,7 +36770,7 @@ import {
39117
36770
  writeSync
39118
36771
  } from "fs";
39119
36772
  import { homedir as homedir12 } from "os";
39120
- import { dirname as dirname18, join as join19 } from "path";
36773
+ import { dirname as dirname19, join as join20 } from "path";
39121
36774
  function isPlainObject(value) {
39122
36775
  return Boolean(value) && typeof value === "object" && !Array.isArray(value);
39123
36776
  }
@@ -39244,19 +36897,19 @@ function projectRowOutput(conversion) {
39244
36897
  };
39245
36898
  }
39246
36899
  function ensureOutputDir() {
39247
- const outputDir = join19(homedir12(), ".local", "share", "deepline", "data");
36900
+ const outputDir = join20(homedir12(), ".local", "share", "deepline", "data");
39248
36901
  mkdirSync14(outputDir, { recursive: true });
39249
36902
  return outputDir;
39250
36903
  }
39251
36904
  function writeJsonOutputFile(payload, stem) {
39252
36905
  const outputDir = ensureOutputDir();
39253
- const outputPath = join19(outputDir, `${stem}_${Date.now()}.json`);
36906
+ const outputPath = join20(outputDir, `${stem}_${Date.now()}.json`);
39254
36907
  writeFileSync17(outputPath, JSON.stringify(payload, null, 2), "utf-8");
39255
36908
  return outputPath;
39256
36909
  }
39257
36910
  function writeCsvOutputFile(rows, stem, options) {
39258
- const outputPath = options?.outPath ? options.outPath : join19(ensureOutputDir(), `${stem}_${Date.now()}.csv`);
39259
- mkdirSync14(dirname18(outputPath), { recursive: true });
36911
+ const outputPath = options?.outPath ? options.outPath : join20(ensureOutputDir(), `${stem}_${Date.now()}.csv`);
36912
+ mkdirSync14(dirname19(outputPath), { recursive: true });
39260
36913
  const columns = columnsForRows(rows);
39261
36914
  const escapeCell = (value) => {
39262
36915
  const normalized = value == null ? "" : typeof value === "string" || typeof value === "number" || typeof value === "boolean" ? String(value) : JSON.stringify(value);
@@ -39399,6 +37052,78 @@ function arrayField(value, key) {
39399
37052
  return Array.isArray(candidate) ? candidate : [];
39400
37053
  }
39401
37054
 
37055
+ // src/cli/tool-description.ts
37056
+ var Capability = class _Capability {
37057
+ #catalogEntry;
37058
+ constructor(catalogEntry) {
37059
+ this.#catalogEntry = catalogEntry;
37060
+ }
37061
+ static fromCatalogEntry(catalogEntry) {
37062
+ return new _Capability(catalogEntry);
37063
+ }
37064
+ describe() {
37065
+ return CapabilityDescription.fromCatalogEntry(this.#catalogEntry);
37066
+ }
37067
+ };
37068
+ var CapabilityDescription = class _CapabilityDescription {
37069
+ #catalogEntry;
37070
+ constructor(catalogEntry) {
37071
+ this.#catalogEntry = catalogEntry;
37072
+ }
37073
+ static fromCatalogEntry(catalogEntry) {
37074
+ return new _CapabilityDescription(catalogEntry);
37075
+ }
37076
+ /**
37077
+ * The customer price already resolved by the catalog. This intentionally
37078
+ * omits provider-price fields, even when a catalog Adapter carried them.
37079
+ */
37080
+ customerCost() {
37081
+ const legacyCost = recordValue2(this.#catalogEntry.cost);
37082
+ const pricing = recordValue2(this.#catalogEntry.pricing);
37083
+ const unit = stringValue4(pricing.unit);
37084
+ const legacyPricingModel = stringValue4(
37085
+ legacyCost.pricingModel ?? legacyCost.pricing_model
37086
+ );
37087
+ const pricingModel = unit === "call" ? "fixed" : unit === "result" || unit === "page" ? `per_${unit}` : unit === "usage" ? "provider_usage" : legacyPricingModel;
37088
+ const canonicalCredits = numberValue(
37089
+ pricing.creditsPerUnit ?? pricing.credits_per_unit
37090
+ );
37091
+ const canonicalUsd = numberValue(
37092
+ pricing.usdPerUnit ?? pricing.usd_per_unit
37093
+ );
37094
+ return {
37095
+ pricingModel: pricingModel || null,
37096
+ unit: unit || null,
37097
+ displayText: stringValue4(pricing.displayText ?? pricing.display_text),
37098
+ summary: stringValue4(pricing.summary),
37099
+ billingMode: stringValue4(
37100
+ legacyCost.billingMode ?? legacyCost.billing_mode
37101
+ ),
37102
+ billingSource: stringValue4(
37103
+ this.#catalogEntry.billingSource ?? this.#catalogEntry.billing_source
37104
+ ),
37105
+ billingSourceLabel: stringValue4(
37106
+ this.#catalogEntry.billingSourceLabel ?? this.#catalogEntry.billing_source_label
37107
+ ),
37108
+ deeplineCreditsPerPricingUnit: canonicalCredits ?? numberValue(
37109
+ this.#catalogEntry.deeplineCreditsPerPricingUnit ?? this.#catalogEntry.deepline_credits_per_pricing_unit
37110
+ ),
37111
+ deeplineUsdPerPricingUnit: canonicalUsd ?? numberValue(
37112
+ this.#catalogEntry.deeplineUsdPerPricingUnit ?? this.#catalogEntry.deepline_usd_per_pricing_unit
37113
+ )
37114
+ };
37115
+ }
37116
+ };
37117
+ function recordValue2(value) {
37118
+ return value && typeof value === "object" && !Array.isArray(value) ? value : {};
37119
+ }
37120
+ function stringValue4(value) {
37121
+ return typeof value === "string" && value.trim() ? value : null;
37122
+ }
37123
+ function numberValue(value) {
37124
+ return typeof value === "number" && Number.isFinite(value) ? value : null;
37125
+ }
37126
+
39402
37127
  // src/cli/commands/tools.ts
39403
37128
  var TOOL_COMMAND_TEMPLATES = {
39404
37129
  describe: "deepline tools describe <toolId>",
@@ -40319,7 +38044,7 @@ function toolContractJsonForDescribe(tool, requestedToolId) {
40319
38044
  const extractedValues = extractionContractEntries(
40320
38045
  arrayField2(toolExecutionResult, "extractedValues", "extracted_values")
40321
38046
  );
40322
- const pricing = toolPricingContractForDescribe(tool);
38047
+ const pricing = Capability.fromCatalogEntry(tool).describe().customerCost();
40323
38048
  const deprecation = recordField2(tool, "deprecation");
40324
38049
  const replacementToolId = stringField2(
40325
38050
  deprecation,
@@ -40370,38 +38095,6 @@ function toolContractJsonForDescribe(tool, requestedToolId) {
40370
38095
  ...starterScript ? { starterScript } : {}
40371
38096
  };
40372
38097
  }
40373
- function toolPricingContractForDescribe(tool) {
40374
- const legacyCost = recordField2(tool, "cost");
40375
- const pricingValue = tool.pricing;
40376
- const hasCanonicalPricing = isRecord12(pricingValue);
40377
- const canonicalPricing = hasCanonicalPricing ? pricingValue : {};
40378
- const unit = stringField2(canonicalPricing, "unit");
40379
- const legacyPricingModel = stringField2(
40380
- legacyCost,
40381
- "pricingModel",
40382
- "pricing_model"
40383
- );
40384
- const pricingModel = unit === "call" ? "fixed" : unit === "result" || unit === "page" ? `per_${unit}` : unit === "usage" ? "provider_usage" : legacyPricingModel;
40385
- return {
40386
- pricingModel: pricingModel || null,
40387
- unit: unit || null,
40388
- displayText: stringField2(canonicalPricing, "displayText", "display_text") || null,
40389
- summary: stringField2(canonicalPricing, "summary") || null,
40390
- billingMode: stringField2(legacyCost, "billingMode", "billing_mode") || null,
40391
- billingSource: stringField2(tool, "billingSource", "billing_source") || null,
40392
- billingSourceLabel: stringField2(tool, "billingSourceLabel", "billing_source_label") || null,
40393
- deeplineCreditsPerPricingUnit: hasCanonicalPricing ? numberField2(canonicalPricing, "creditsPerUnit", "credits_per_unit") : numberField2(
40394
- tool,
40395
- "deeplineCreditsPerPricingUnit",
40396
- "deepline_credits_per_pricing_unit"
40397
- ),
40398
- deeplineUsdPerPricingUnit: hasCanonicalPricing ? numberField2(canonicalPricing, "usdPerUnit", "usd_per_unit") : numberField2(
40399
- tool,
40400
- "deeplineUsdPerPricingUnit",
40401
- "deepline_usd_per_pricing_unit"
40402
- )
40403
- };
40404
- }
40405
38098
  function extractionContractEntries(entries) {
40406
38099
  return entries.flatMap((entry) => {
40407
38100
  if (!isRecord12(entry)) return [];
@@ -40854,6 +38547,7 @@ function toolMetadataJsonForDescribe(tool, requestedToolId) {
40854
38547
  toolId,
40855
38548
  provider: tool.provider,
40856
38549
  displayName: tool.displayName,
38550
+ cost: Capability.fromCatalogEntry(tool).describe().customerCost(),
40857
38551
  usageGuidance,
40858
38552
  runtimeOutputHelp: {
40859
38553
  contract: "tools describe shows declared schema and Deepline getters; it is not an observed provider response.",
@@ -41184,11 +38878,11 @@ function normalizeOutputFormat(raw) {
41184
38878
  }
41185
38879
  function resolveAtFilePath(rawPath) {
41186
38880
  const trimmed = rawPath.trim();
41187
- const resolved = resolve17(trimmed);
41188
- if (existsSync17(resolved)) return resolved;
38881
+ const resolved = resolve18(trimmed);
38882
+ if (existsSync18(resolved)) return resolved;
41189
38883
  if (process.platform !== "win32" && trimmed.includes("\\")) {
41190
- const normalized = resolve17(trimmed.replace(/\\/g, "/"));
41191
- if (existsSync17(normalized)) return normalized;
38884
+ const normalized = resolve18(trimmed.replace(/\\/g, "/"));
38885
+ if (existsSync18(normalized)) return normalized;
41192
38886
  }
41193
38887
  return resolved;
41194
38888
  }
@@ -41199,7 +38893,7 @@ function readJsonArgument(raw, flagName) {
41199
38893
  throw new Error(`Invalid ${flagName} value: empty @file path.`);
41200
38894
  }
41201
38895
  try {
41202
- return readFileSync17(resolveAtFilePath(filePath), "utf8").replace(
38896
+ return readFileSync18(resolveAtFilePath(filePath), "utf8").replace(
41203
38897
  /^\uFEFF/,
41204
38898
  ""
41205
38899
  );
@@ -41276,7 +38970,7 @@ function parseExecuteOptions(args) {
41276
38970
  continue;
41277
38971
  }
41278
38972
  if ((arg === "--out" || arg === "-o") && args[index + 1]) {
41279
- outPath = resolve17(args[++index]);
38973
+ outPath = resolve18(args[++index]);
41280
38974
  continue;
41281
38975
  }
41282
38976
  throw new Error(`Unknown option: ${arg}`);
@@ -41306,9 +39000,9 @@ function starterScriptJson(script) {
41306
39000
  function seedToolListScript(input2) {
41307
39001
  const stem = safeFileStem(input2.toolId);
41308
39002
  const fileName = `${stem}-workflow-seed-${Date.now()}.play.ts`;
41309
- const scriptDir = mkdtempSync(join20(tmpdir5(), "deepline-workflow-seed-"));
39003
+ const scriptDir = mkdtempSync(join21(tmpdir5(), "deepline-workflow-seed-"));
41310
39004
  chmodSync(scriptDir, 448);
41311
- const scriptPath = join20(scriptDir, fileName);
39005
+ const scriptPath = join21(scriptDir, fileName);
41312
39006
  const projectDir = `deepline/projects/${stem}-workflow`;
41313
39007
  const playName = `${stem}-workflow`;
41314
39008
  const sampleRows = input2.rows.length > 0 ? `${JSON.stringify(input2.rows.slice(0, 2)).replace(/\]$/, "")}, ...]` : "[]";
@@ -41777,7 +39471,7 @@ Examples:
41777
39471
 
41778
39472
  // src/cli/commands/workflow.ts
41779
39473
  import { mkdir as mkdir5, readFile as readFile4, writeFile as writeFile5 } from "fs/promises";
41780
- import { dirname as dirname19, join as join21, resolve as resolve18 } from "path";
39474
+ import { dirname as dirname20, join as join22, resolve as resolve19 } from "path";
41781
39475
 
41782
39476
  // src/cli/workflow-to-play.ts
41783
39477
  import { createHash as createHash5 } from "crypto";
@@ -41994,7 +39688,7 @@ function readStatus(payload) {
41994
39688
  }
41995
39689
  async function readJsonOption(payload, file) {
41996
39690
  if (file) {
41997
- const raw = await readFile4(resolve18(file), "utf8");
39691
+ const raw = await readFile4(resolve19(file), "utf8");
41998
39692
  return JSON.parse(raw);
41999
39693
  }
42000
39694
  if (payload) {
@@ -42028,8 +39722,8 @@ async function transformOne(api, workflowId, outDir, publish) {
42028
39722
  revision.config,
42029
39723
  { workflowName: workflow.name, version: revision.version }
42030
39724
  );
42031
- const file = join21(resolve18(outDir), `${compiled.playName}.play.ts`);
42032
- await mkdir5(dirname19(file), { recursive: true });
39725
+ const file = join22(resolve19(outDir), `${compiled.playName}.play.ts`);
39726
+ await mkdir5(dirname20(file), { recursive: true });
42033
39727
  await writeFile5(file, compiled.sourceCode, "utf8");
42034
39728
  let published = false;
42035
39729
  if (publish) {
@@ -42404,7 +40098,7 @@ function isDowngradeAutoUpdateResponse(response) {
42404
40098
  return compareSemver(target, current) < 0;
42405
40099
  }
42406
40100
  function relaunchCurrentCommand(plan) {
42407
- return new Promise((resolve19) => {
40101
+ return new Promise((resolve20) => {
42408
40102
  const command = plan.kind === "python-sidecar" ? plan.sidecarPath : process.execPath;
42409
40103
  const args = plan.kind === "python-sidecar" ? process.argv.slice(2) : process.argv.slice(1);
42410
40104
  const child = spawn5(command, args, {
@@ -42420,9 +40114,9 @@ function relaunchCurrentCommand(plan) {
42420
40114
  `Deepline SDK/CLI updated, but relaunch failed: ${error.message}
42421
40115
  `
42422
40116
  );
42423
- resolve19(1);
40117
+ resolve20(1);
42424
40118
  });
42425
- child.on("close", (code) => resolve19(code ?? 1));
40119
+ child.on("close", (code) => resolve20(code ?? 1));
42426
40120
  });
42427
40121
  }
42428
40122
  async function maybeAutoUpdateAndRelaunch(response, baseUrl) {
@@ -42813,8 +40507,8 @@ function topLevelCommandKnown(program, commandName) {
42813
40507
  );
42814
40508
  }
42815
40509
  async function runPlayRunnerHealthCheck() {
42816
- const dir = await mkdtemp2(join22(tmpdir6(), "deepline-health-play-"));
42817
- const file = join22(dir, "health-check.play.ts");
40510
+ const dir = await mkdtemp2(join23(tmpdir6(), "deepline-health-play-"));
40511
+ const file = join23(dir, "health-check.play.ts");
42818
40512
  try {
42819
40513
  await writeFile6(
42820
40514
  file,