@caplets/core 0.28.0 → 0.29.0

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.
package/dist/index.js CHANGED
@@ -1,9 +1,10 @@
1
- import { $ as redactCodeModeLogText, $n as getParseErrorMessage, $t as readTokenBundle, A as resolveRemoteMode, An as GetPromptRequestSchema, At as loadProjectConfig, Bn as LoggingLevelSchema, Bt as discoverCapletFiles, C as CapletsCloudClient, Cn as CreateMessageResultSchema, Ct as ServerRegistry, D as normalizeRemoteProfileHostUrl, Dn as ElicitResultSchema, Dt as loadConfigWithSources, E as isCapletsCloudUrl, Et as loadConfig, F as resolveCapletsServer, Fn as ListPromptsRequestSchema, Ft as FileVaultStore, G as runCodeMode, Gn as assertCompleteRequestPrompt, Gt as markdownStructuredContent, H as codeModeRunInputSchema, Hn as ReadResourceRequestSchema, Ht as loadCapletFilesFromMap, I as nativeCapletPromptGuidance, In as ListResourceTemplatesRequestSchema, It as VAULT_MAX_VALUE_BYTES, J as diagnoseCodeModeTypeScript, Jn as isJSONRPCErrorResponse, Jt as runOAuthFlow, K as CodeModeSessionManager, Kn as assertCompleteRequestResourceTemplate, Kt as refreshOAuthTokenBundle, L as nativeCapletToolDescription, Ln as ListResourcesRequestSchema, Lt as validateVaultKeyName, M as controlUrlForBase, Mn as InitializedNotificationSchema, Mt as vaultBootstrapResolver, N as isLoopbackHost, Nn as JSONRPCMessageSchema, Nt as vaultResolverForAuthDir, O as resolveCapletsRemote, On as EmptyResultSchema, Ot as loadGlobalConfig, P as parseServerBaseUrl, Pn as LATEST_PROTOCOL_VERSION, Pt as vaultStoreForAuthDir, Q as CodeModeLogStore, Qn as getObjectShape, Qt as isTokenBundleExpired, R as nativeCapletToolName, Rn as ListRootsResultSchema, Rt as decryptVaultValue, S as buildProjectSyncManifest, Sn as CompleteRequestSchema, St as handleServerTool, T as hostedCloudWorkspaceFromRemoteUrl, Tn as CreateTaskResultSchema, Tt as GoogleDiscoveryManager, U as codeModeRunParamsSchema, Un as SUPPORTED_PROTOCOL_VERSIONS, Ut as hasRenderableStructuredContent, Vn as McpError, Vt as validateCapletFile, W as emptyCodeModeRunMeta, Wn as SetLevelRequestSchema, Wt as markdownCallToolResultContent, X as listCodeModeCallableCaplets, Xn as isJSONRPCResultResponse, Xt as startOAuthFlow, Y as createCodeModeCapletsApi, Yn as isJSONRPCRequest, Yt as startGenericOAuthFlow, Z as CodeModeJournalStore, Zn as getLiteralValue, Zt as deleteTokenBundle, _ as attachErrorResponse, _n as Protocol, _t as rotateTelemetryIdentity, a as CloudAuthStore, an as defaultConfigPath, ar as safeParse, at as version, b as invokeAttachExport, bn as CallToolRequestSchema, bt as findProjectRoot, c as redactedCloudAuthStatus, cn as resolveCapletsRoot, ct as buildProductTelemetryEvent, d as projectBindingError, dn as resolveProjectConfigPath, dt as maybePrintTelemetryNotice, en as DEFAULT_AUTH_DIR, er as getSchemaDescription, et as codeModeDeclarationHash, f as projectBindingRecovery, fn as ReadBuffer, ft as resolveTelemetryState, g as CAPLETS_ATTACH_SESSION_HEADER, gn as AjvJsonSchemaValidator, gt as readTelemetryNotice, hn as assertToolsCallTaskCapability, ht as readTelemetryIdentity, i as createRemoteProfileStore, in as defaultConfigBaseDir, ir as objectFromShape, it as CapletsEngine, j as appendBasePath, jn as InitializeRequestSchema, jt as parseConfig, k as resolveHostedCloudRemote, kn as ErrorCode, kt as loadLocalOverlayConfigWithSources, l as PROJECT_BINDING_ERROR_CODES, ln as resolveConfigPath, lt as buildReliabilityTelemetryEvent, mn as assertClientRequestTaskCapability, mt as readTelemetryDeliveryHealth, n as resolveRemoteSelection, nn as DEFAULT_OBSERVED_OUTPUT_SHAPE_CACHE_DIR, nr as isZ4Schema, nt as generateCodeModeRunToolDescription, o as cloudAuthPath, on as defaultStateBaseDir, or as safeParseAsync, ot as createTelemetryDispatcher, p as CloudAuthClient, pn as serializeMessage, pt as deleteTelemetryIdentity, q as QuickJsCodeModeSandbox, qn as isInitializeRequest, qt as runGenericOAuthFlow, r as cloudCredentialsFromRemoteProfile, rn as defaultCacheBaseDir, rr as normalizeObjectSchema, rt as minifyCodeModeDeclarationText, s as migrateCredentials, sn as defaultTelemetryStateDir, st as TelemetryDebugSink, t as createNativeCapletsService, tr as isSchemaOptional, tt as generateCodeModeDeclarations, u as ProjectBindingError, un as resolveProjectCapletsRoot, ut as durationBucket, v as buildAttachProjection, vn as mergeCapabilities, vt as resolveExposure, wn as CreateMessageResultWithToolsSchema, wt as capabilityDescription, x as invokeNativeAttachExport, xn as CallToolResultSchema, xt as fingerprintProjectRoot, y as buildNativeAttachProjection, yn as toJsonSchemaCompat, yt as decodeDirectResourceUri, zn as ListToolsRequestSchema, zt as encryptVaultValue } from "./service-BfPCRxQ9.js";
1
+ import { t as __commonJSMin } from "./rolldown-runtime-CE-6LUnI.js";
2
+ import { $ as redactCodeModeLogText, $n as isJSONRPCRequest, $t as readTokenBundle, A as resolveRemoteMode, At as loadProjectConfig, Bn as ListResourceTemplatesRequestSchema, Bt as discoverCapletFiles, C as CapletsCloudClient, Cn as toJsonSchemaCompat, Ct as ServerRegistry, D as normalizeRemoteProfileHostUrl, Dn as CreateMessageResultSchema, Dt as loadConfigWithSources, E as isCapletsCloudUrl, En as CompleteRequestSchema, Et as loadConfig, F as resolveCapletsServer, Fn as InitializeRequestSchema, Ft as FileVaultStore, G as runCodeMode, Gn as McpError, Gt as markdownStructuredContent, H as codeModeRunInputSchema, Hn as ListRootsResultSchema, Ht as loadCapletFilesFromMap, I as nativeCapletPromptGuidance, In as InitializedNotificationSchema, It as VAULT_MAX_VALUE_BYTES, J as diagnoseCodeModeTypeScript, Jn as SetLevelRequestSchema, Jt as runOAuthFlow, K as CodeModeSessionManager, Kn as ReadResourceRequestSchema, Kt as refreshOAuthTokenBundle, L as nativeCapletToolDescription, Ln as JSONRPCMessageSchema, Lt as validateVaultKeyName, M as controlUrlForBase, Mn as EmptyResultSchema, Mt as vaultBootstrapResolver, N as isLoopbackHost, Nn as ErrorCode, Nt as vaultResolverForAuthDir, O as resolveCapletsRemote, On as CreateMessageResultWithToolsSchema, Ot as loadGlobalConfig, P as parseServerBaseUrl, Pn as GetPromptRequestSchema, Pt as vaultStoreForAuthDir, Q as CodeModeLogStore, Qn as isJSONRPCErrorResponse, Qt as isTokenBundleExpired, R as nativeCapletToolName, Rn as LATEST_PROTOCOL_VERSION, Rt as decryptVaultValue, S as buildProjectSyncManifest, Sn as mergeCapabilities, St as handleServerTool, T as hostedCloudWorkspaceFromRemoteUrl, Tn as CallToolResultSchema, Tt as GoogleDiscoveryManager, U as codeModeRunParamsSchema, Un as ListToolsRequestSchema, Ut as hasRenderableStructuredContent, Vn as ListResourcesRequestSchema, Vt as validateCapletFile, W as emptyCodeModeRunMeta, Wn as LoggingLevelSchema, Wt as markdownCallToolResultContent, X as listCodeModeCallableCaplets, Xn as assertCompleteRequestResourceTemplate, Xt as startOAuthFlow, Y as createCodeModeCapletsApi, Yn as assertCompleteRequestPrompt, Yt as startGenericOAuthFlow, Z as CodeModeJournalStore, Zn as isInitializeRequest, Zt as deleteTokenBundle, _ as attachErrorResponse, _n as serializeMessage, _t as rotateTelemetryIdentity, a as CloudAuthStore, an as defaultCacheBaseDir, ar as isSchemaOptional, at as version, b as invokeAttachExport, bn as AjvJsonSchemaValidator, bt as findProjectRoot, c as redactedCloudAuthStatus, cn as defaultStateBaseDir, cr as objectFromShape, ct as buildProductTelemetryEvent, d as projectBindingError, dn as defaultUpdateCheckStateDir, dt as maybePrintTelemetryNotice, en as DEFAULT_AUTH_DIR, er as isJSONRPCResultResponse, et as codeModeDeclarationHash, f as projectBindingRecovery, fn as resolveCapletsRoot, ft as resolveTelemetryState, g as CAPLETS_ATTACH_SESSION_HEADER, gn as ReadBuffer, gt as readTelemetryNotice, hn as resolveProjectConfigPath, ht as readTelemetryIdentity, i as createRemoteProfileStore, in as DEFAULT_UPDATE_CHECK_STATE_DIR, ir as getSchemaDescription, it as CapletsEngine, j as appendBasePath, jn as ElicitResultSchema, jt as parseConfig, k as resolveHostedCloudRemote, kn as CreateTaskResultSchema, kt as loadLocalOverlayConfigWithSources, l as PROJECT_BINDING_ERROR_CODES, ln as defaultTelemetryStateDir, lr as safeParse, lt as buildReliabilityTelemetryEvent, mn as resolveProjectCapletsRoot, mt as readTelemetryDeliveryHealth, n as resolveRemoteSelection, nn as DEFAULT_OBSERVED_OUTPUT_SHAPE_CACHE_DIR, nr as getObjectShape, nt as generateCodeModeRunToolDescription, o as cloudAuthPath, on as defaultConfigBaseDir, or as isZ4Schema, ot as createTelemetryDispatcher, p as CloudAuthClient, pn as resolveConfigPath, pt as deleteTelemetryIdentity, q as QuickJsCodeModeSandbox, qn as SUPPORTED_PROTOCOL_VERSIONS, qt as runGenericOAuthFlow, r as cloudCredentialsFromRemoteProfile, rn as DEFAULT_UPDATE_CHECK_CACHE_DIR, rr as getParseErrorMessage, rt as minifyCodeModeDeclarationText, s as migrateCredentials, sn as defaultConfigPath, sr as normalizeObjectSchema, st as TelemetryDebugSink, t as createNativeCapletsService, tr as getLiteralValue, tt as generateCodeModeDeclarations, u as ProjectBindingError, un as defaultUpdateCheckCacheDir, ur as safeParseAsync, ut as durationBucket, v as buildAttachProjection, vn as assertClientRequestTaskCapability, vt as resolveExposure, wn as CallToolRequestSchema, wt as capabilityDescription, x as invokeNativeAttachExport, xn as Protocol, xt as fingerprintProjectRoot, y as buildNativeAttachProjection, yn as assertToolsCallTaskCapability, yt as decodeDirectResourceUri, zn as ListPromptsRequestSchema, zt as encryptVaultValue } from "./service-CnVGCjpT.js";
2
3
  import { _ as record, b as unknown, d as literal, m as object, n as ZodOptional, o as array, p as number, r as _enum, s as boolean, v as string, x as url } from "./schemas-BoqMu4MG.js";
3
4
  import { a as SERVER_ID_PATTERN, d as CapletsError, m as toSafeError, p as redactSecrets$1, u as CAPLETS_ERROR_CODES } from "./validation-CWzd2gtn.js";
4
5
  import { generatedToolInputSchema, generatedToolInputSchemaForCaplet } from "./generated-tool-input-schema.js";
5
6
  import { f as observedOutputShapeKey, i as observeOutputShape, u as FileObservedOutputShapeStore } from "./observed-output-shapes-DuP7mJQf.js";
6
- import { a as formatCapletList, c as resolveCliConfigPaths, l as cliCommands$1, n as completionScript, o as formatConfigPaths, s as listCaplets, t as completeCliWords, u as completionShells } from "./completion-CjE0EnbF.js";
7
+ import { a as formatCapletList, c as resolveCliConfigPaths, l as cliCommands$1, n as completionScript, o as formatConfigPaths, s as listCaplets, t as completeCliWords, u as completionShells } from "./completion-YRQc_o-I.js";
7
8
  import { n as normalizeCapletSourcePath, t as FilesystemCapletSource } from "./filesystem-Kkg32TOJ.js";
8
9
  import { parseConfig as parseConfig$1 } from "./config-runtime.js";
9
10
  import fs, { accessSync, chmodSync, closeSync, constants, copyFileSync, cpSync, existsSync, fstatSync, lstatSync, mkdirSync, mkdtempSync, openSync, readFileSync, readSync, readdirSync, readlinkSync, realpathSync, renameSync, rmSync, statSync, watch, writeFileSync, writeSync } from "node:fs";
@@ -5895,7 +5896,7 @@ function daemonHostPath(path) {
5895
5896
  //#endregion
5896
5897
  //#region src/daemon/config.ts
5897
5898
  function readDaemonConfig(paths) {
5898
- return readJson(paths.configFile);
5899
+ return readJson$1(paths.configFile);
5899
5900
  }
5900
5901
  function writeDaemonConfig(paths, config) {
5901
5902
  writeJson(paths.configFile, config);
@@ -5932,7 +5933,7 @@ function mergeDaemonEnv(existing, install) {
5932
5933
  function validateEnvName(value) {
5933
5934
  if (!/^[A-Za-z_][A-Za-z0-9_]*$/u.test(value)) throw new CapletsError("REQUEST_INVALID", `Invalid environment variable name: ${value}`);
5934
5935
  }
5935
- function readJson(path) {
5936
+ function readJson$1(path) {
5936
5937
  const hostPath = daemonHostPath(path);
5937
5938
  try {
5938
5939
  return JSON.parse(readFileSync(hostPath, "utf8"));
@@ -6103,11 +6104,7 @@ function shellQuote(value) {
6103
6104
  return `'${value.replaceAll("'", "'\\''")}'`;
6104
6105
  }
6105
6106
  function serviceCommand(config) {
6106
- const direct = [
6107
- process.execPath,
6108
- config.command.executable,
6109
- ...config.command.args
6110
- ];
6107
+ const direct = [config.command.executable, ...config.command.args];
6111
6108
  if (!config.command.shell) return {
6112
6109
  executable: direct[0],
6113
6110
  args: direct.slice(1),
@@ -7050,6 +7047,15 @@ function nonEmpty$2(value, label) {
7050
7047
  return trimmed;
7051
7048
  }
7052
7049
  //#endregion
7050
+ //#region src/update-check/control.ts
7051
+ const DISABLE_UPDATE_CHECK_ENV = "CAPLETS_DISABLE_UPDATE_CHECK";
7052
+ function isUpdateCheckDisabled(env = process.env) {
7053
+ return env["CAPLETS_DISABLE_UPDATE_CHECK"] === "1" || env["CAPLETS_DISABLE_UPDATE_CHECK"] === "true";
7054
+ }
7055
+ function isUpdateNoticeStderrOptIn(env = process.env) {
7056
+ return env["CAPLETS_UPDATE_NOTICE_STDERR"] === "1" || env["CAPLETS_UPDATE_NOTICE_STDERR"] === "true";
7057
+ }
7058
+ //#endregion
7053
7059
  //#region src/daemon/env.ts
7054
7060
  function resolveDaemonShell(options) {
7055
7061
  const platform = options.platform ?? process.platform;
@@ -7132,26 +7138,33 @@ function daemonServeArgs(options) {
7132
7138
  options.path
7133
7139
  ];
7134
7140
  if (options.auth.type === "remote_credentials" && options.remoteCredentialStateDir) args.push("--remote-state-path", options.remoteCredentialStateDir);
7141
+ if (options.upstreamUrl) args.push("--upstream-url", options.upstreamUrl);
7135
7142
  if (options.allowUnauthenticatedHttp) args.push("--allow-unauthenticated-http");
7136
7143
  if (options.trustProxy) args.push("--trust-proxy");
7137
7144
  return args;
7138
7145
  }
7139
7146
  function buildDaemonCommandPlan(options) {
7140
7147
  const platform = options.operation.platform ?? process.platform;
7141
- const executable = resolveDaemonExecutable(process.argv[1]);
7142
- const args = daemonServeArgs(options.serve);
7148
+ const command = resolveDaemonCommand({
7149
+ env: options.operation.env ?? process.env,
7150
+ platform,
7151
+ scriptPath: process.argv[1],
7152
+ serveArgs: daemonServeArgs(options.serve)
7153
+ });
7143
7154
  const workingDirectory = options.operation.home ?? homedir();
7155
+ const serviceEnv = daemonServiceEnv({
7156
+ explicitEnv: options.explicitEnv ?? {},
7157
+ operation: options.operation,
7158
+ platform,
7159
+ serve: options.serve,
7160
+ workingDirectory
7161
+ });
7162
+ if (command.pathEnv && serviceEnv.PATH === void 0 && serviceEnv.Path === void 0 && serviceEnv.path === void 0) serviceEnv.PATH = command.pathEnv;
7144
7163
  const base = {
7145
- executable,
7146
- args,
7164
+ executable: command.executable,
7165
+ args: command.args,
7147
7166
  workingDirectory,
7148
- env: daemonServiceEnv({
7149
- explicitEnv: options.explicitEnv ?? {},
7150
- operation: options.operation,
7151
- platform,
7152
- serve: options.serve,
7153
- workingDirectory
7154
- }),
7167
+ env: serviceEnv,
7155
7168
  inheritEnv: options.inheritEnv ?? false,
7156
7169
  stdoutLog: options.paths.stdoutLog,
7157
7170
  stderrLog: options.paths.stderrLog
@@ -7172,6 +7185,7 @@ function daemonServiceEnv(options) {
7172
7185
  ...options.explicitEnv
7173
7186
  };
7174
7187
  if (options.serve.publicOrigin && serviceEnv.CAPLETS_SERVER_URL === void 0) serviceEnv.CAPLETS_SERVER_URL = options.serve.publicOrigin;
7188
+ serviceEnv[DISABLE_UPDATE_CHECK_ENV] = "1";
7175
7189
  return serviceEnv;
7176
7190
  }
7177
7191
  function configSelectionEnv(env, home, platform) {
@@ -7194,7 +7208,20 @@ function configSelectionEnvKeys(platform) {
7194
7208
  "XDG_CACHE_HOME"
7195
7209
  ];
7196
7210
  }
7197
- function resolveDaemonExecutable(scriptPath) {
7211
+ function resolveDaemonCommand(options) {
7212
+ const stableCommand = resolvePathCommand("caplets", options.env, options.platform);
7213
+ if (stableCommand) return {
7214
+ executable: stableCommand,
7215
+ args: options.serveArgs,
7216
+ pathEnv: pathEnvValue(options.env)
7217
+ };
7218
+ const script = resolveDaemonCliScript(options.scriptPath);
7219
+ return {
7220
+ executable: process.execPath,
7221
+ args: [script, ...options.serveArgs]
7222
+ };
7223
+ }
7224
+ function resolveDaemonCliScript(scriptPath) {
7198
7225
  if (!scriptPath) throw new CapletsError("REQUEST_INVALID", "Cannot install the daemon because the Caplets CLI path could not be resolved.");
7199
7226
  const executable = isAbsolute(scriptPath) ? scriptPath : resolve(scriptPath);
7200
7227
  if (!existsSync(executable)) throw new CapletsError("REQUEST_INVALID", `Cannot install the daemon because the Caplets CLI path does not exist: ${executable}`);
@@ -7202,6 +7229,48 @@ function resolveDaemonExecutable(scriptPath) {
7202
7229
  if (isTransientRunnerPath(executable) || isTransientRunnerPath(realExecutable)) throw new CapletsError("REQUEST_INVALID", "Cannot install the daemon from a temporary runner such as npx or pnpm dlx. Install caplets first, then rerun caplets daemon install.");
7203
7230
  return executable;
7204
7231
  }
7232
+ function resolvePathCommand(command, env, platform) {
7233
+ const path = pathEnvValue(env);
7234
+ if (!path) return void 0;
7235
+ const delimiter = platform === "win32" ? ";" : ":";
7236
+ for (const entry of path.split(delimiter)) {
7237
+ const directory = entry.trim();
7238
+ if (!directory) continue;
7239
+ for (const candidate of pathCommandCandidates(directory, command, env, platform)) {
7240
+ if (!isRunnableCommand(candidate, platform)) continue;
7241
+ const realCandidate = safeRealpath(candidate);
7242
+ if (isTransientRunnerPath(candidate) || isTransientRunnerPath(realCandidate)) throw new CapletsError("REQUEST_INVALID", "Cannot install the daemon from a temporary runner such as npx or pnpm dlx. Install caplets first, then rerun caplets daemon install.");
7243
+ return candidate;
7244
+ }
7245
+ }
7246
+ }
7247
+ function pathCommandCandidates(directory, command, env, platform) {
7248
+ const resolved = isAbsolute(directory) ? directory : resolve(directory);
7249
+ if (platform !== "win32") return [resolve(resolved, command)];
7250
+ const lower = command.toLocaleLowerCase();
7251
+ if (/\.[^.\\/]+$/u.test(lower)) return [resolve(resolved, command)];
7252
+ return (env.PATHEXT ?? ".COM;.EXE;.BAT;.CMD").split(";").map((value) => value.trim()).filter(Boolean).map((extension) => resolve(resolved, `${command}${extension}`));
7253
+ }
7254
+ function pathEnvValue(env) {
7255
+ return env.PATH ?? env.Path ?? env.path;
7256
+ }
7257
+ function isRunnableCommand(path, platform) {
7258
+ try {
7259
+ if (!statSync(path).isFile()) return false;
7260
+ if (platform === "win32") return true;
7261
+ accessSync(path, constants.X_OK);
7262
+ return true;
7263
+ } catch {
7264
+ return false;
7265
+ }
7266
+ }
7267
+ function safeRealpath(path) {
7268
+ try {
7269
+ return realpathSync(path);
7270
+ } catch {
7271
+ return path;
7272
+ }
7273
+ }
7205
7274
  function isTransientRunnerPath(path) {
7206
7275
  const normalized = path.replaceAll("\\", "/");
7207
7276
  return /(?:^|\/)_npx(?:\/|$)/u.test(normalized) || /(?:^|\/)dlx-[^/]+(?:\/|$)/u.test(normalized);
@@ -12836,11 +12905,28 @@ function healthUrl(config, port = config.serve.port) {
12836
12905
  }
12837
12906
  function validationSpawnCommand(config) {
12838
12907
  const planned = serviceCommand(config);
12908
+ if (isWindowsCommandShim(planned.executable)) {
12909
+ const shell = {
12910
+ executable: "cmd.exe",
12911
+ args: [
12912
+ "/d",
12913
+ "/s",
12914
+ "/c"
12915
+ ]
12916
+ };
12917
+ return {
12918
+ command: shell.executable,
12919
+ args: [...shell.args, shellCommandLine(shell, [planned.executable, ...planned.args])]
12920
+ };
12921
+ }
12839
12922
  return {
12840
12923
  command: planned.executable,
12841
12924
  args: planned.args
12842
12925
  };
12843
12926
  }
12927
+ function isWindowsCommandShim(path) {
12928
+ return /\.(?:bat|cmd)$/iu.test(path);
12929
+ }
12844
12930
  async function sleep$2(ms) {
12845
12931
  await new Promise((resolve) => setTimeout(resolve, ms));
12846
12932
  }
@@ -13294,6 +13380,7 @@ function mergeServeOptions(existing, install) {
13294
13380
  ...install.port !== void 0 ? { port: install.port } : existing?.serve.port ? { port: existing.serve.port } : {},
13295
13381
  ...install.path !== void 0 ? { path: install.path } : existing?.serve.path ? { path: existing.serve.path } : {},
13296
13382
  ...install.remoteStatePath !== void 0 ? { remoteStatePath: install.remoteStatePath } : existing?.serve.remoteCredentialStateDir ? { remoteStatePath: existing.serve.remoteCredentialStateDir } : {},
13383
+ ...install.upstreamUrl !== void 0 ? { upstreamUrl: install.upstreamUrl } : existing?.serve.upstreamUrl ? { upstreamUrl: existing.serve.upstreamUrl } : {},
13297
13384
  ...install.allowUnauthenticatedHttp !== void 0 ? { allowUnauthenticatedHttp: install.allowUnauthenticatedHttp } : existing ? { allowUnauthenticatedHttp: existing.serve.allowUnauthenticatedHttp } : {},
13298
13385
  ...install.trustProxy !== void 0 ? { trustProxy: install.trustProxy } : existing ? { trustProxy: existing.serve.trustProxy } : {},
13299
13386
  ...existing && existing.serve.auth.type === "development_unauthenticated" && install.allowUnauthenticatedHttp === void 0 ? { preserveUnauthenticatedAuth: true } : {}
@@ -15404,9 +15491,1813 @@ function nativeAttachSession(service) {
15404
15491
  };
15405
15492
  }
15406
15493
  //#endregion
15494
+ //#region src/update-check/eligibility.ts
15495
+ function classifyUpdateNoticeEligibility(input) {
15496
+ const env = input.env ?? process.env;
15497
+ const args = input.args;
15498
+ const command = args[0] ?? "";
15499
+ const optedIn = isUpdateNoticeStderrOptIn(env);
15500
+ if (isUpdateCheckDisabled(env)) return {
15501
+ eligible: false,
15502
+ reason: "disabled"
15503
+ };
15504
+ if (args.length === 0) return {
15505
+ eligible: false,
15506
+ reason: "no_args"
15507
+ };
15508
+ if (isHelpOrVersion(args)) return {
15509
+ eligible: false,
15510
+ reason: "help_or_version"
15511
+ };
15512
+ if (command === "completion" || command === "__complete") return {
15513
+ eligible: false,
15514
+ reason: "completion"
15515
+ };
15516
+ if (isOutputProduct(args)) return {
15517
+ eligible: false,
15518
+ reason: "output_product"
15519
+ };
15520
+ if (command === "daemon") return {
15521
+ eligible: false,
15522
+ reason: "daemon"
15523
+ };
15524
+ if (command === "code-mode") return {
15525
+ eligible: false,
15526
+ reason: "code_mode"
15527
+ };
15528
+ if (isCi(env) && !optedIn) return {
15529
+ eligible: false,
15530
+ reason: "ci"
15531
+ };
15532
+ if (!input.stderrIsTTY && !optedIn) return {
15533
+ eligible: false,
15534
+ reason: "noninteractive"
15535
+ };
15536
+ if (command === "attach") return optedIn ? {
15537
+ eligible: true,
15538
+ command
15539
+ } : {
15540
+ eligible: false,
15541
+ reason: "stdio"
15542
+ };
15543
+ if (command === "serve") {
15544
+ const transport = optionValue(args, "--transport");
15545
+ const daemonSubcommand = args[1] && !args[1].startsWith("-") ? args[1] : void 0;
15546
+ if (daemonSubcommand === "start" || daemonSubcommand === "enable") return {
15547
+ eligible: false,
15548
+ reason: "daemon"
15549
+ };
15550
+ if (transport === "http" || transport === "sse") return {
15551
+ eligible: true,
15552
+ command
15553
+ };
15554
+ return optedIn ? {
15555
+ eligible: true,
15556
+ command
15557
+ } : {
15558
+ eligible: false,
15559
+ reason: "stdio"
15560
+ };
15561
+ }
15562
+ return {
15563
+ eligible: true,
15564
+ command
15565
+ };
15566
+ }
15567
+ function isHelpOrVersion(args) {
15568
+ return args.some((arg) => arg === "--help" || arg === "-h" || arg === "--version" || arg === "-V");
15569
+ }
15570
+ function isOutputProduct(args) {
15571
+ if (args.some((arg) => arg === "--json" || arg.toLowerCase() === "--format=json")) return true;
15572
+ if (optionValue(args, "--format")?.toLowerCase() === "json") return true;
15573
+ if (args[0] === "config" && (args[1] === "path" || args[1] === "paths")) return true;
15574
+ if (args[0] === "telemetry" && args[1] === "debug") return true;
15575
+ return false;
15576
+ }
15577
+ function isCi(env) {
15578
+ return isTruthyEnv(env.CI) || isTruthyEnv(env.GITHUB_ACTIONS) || isTruthyEnv(env.BUILDKITE);
15579
+ }
15580
+ function isTruthyEnv(value) {
15581
+ return value === "1" || value === "true";
15582
+ }
15583
+ function optionValue(args, name) {
15584
+ for (let index = 0; index < args.length; index += 1) {
15585
+ const arg = args[index];
15586
+ if (arg === name) return args[index + 1];
15587
+ if (arg?.startsWith(`${name}=`)) return arg.slice(name.length + 1);
15588
+ }
15589
+ }
15590
+ //#endregion
15591
+ //#region src/update-check/state.ts
15592
+ const UPDATE_CHECK_PACKAGE_NAME = "caplets";
15593
+ const UPDATE_CHECK_REGISTRY_URL = "https://registry.npmjs.org/caplets";
15594
+ const UPDATE_CHECK_ACCEPT_HEADER = "application/vnd.npm.install-v1+json";
15595
+ const UPDATE_CHECK_CACHE_TTL_MS = 1440 * 60 * 1e3;
15596
+ const UPDATE_CHECK_MAX_STALE_MS = 10080 * 60 * 1e3;
15597
+ const UPDATE_CHECK_NEGATIVE_TTL_MS = 3600 * 1e3;
15598
+ const UPDATE_CHECK_MAX_RESPONSE_BYTES = 1024 * 1024;
15599
+ function updateCheckCacheDir(options = {}) {
15600
+ return options.cacheDir ?? DEFAULT_UPDATE_CHECK_CACHE_DIR;
15601
+ }
15602
+ function updateCheckStateDir(options = {}) {
15603
+ return options.stateDir ?? DEFAULT_UPDATE_CHECK_STATE_DIR;
15604
+ }
15605
+ function updateMetadataCachePath(options = {}) {
15606
+ return join(updateCheckCacheDir(options), "metadata.json");
15607
+ }
15608
+ function updateRefreshLockPath(options = {}) {
15609
+ return join(updateCheckCacheDir(options), "refresh.lock");
15610
+ }
15611
+ function updateNoticeStatePath(options = {}) {
15612
+ return join(updateCheckStateDir(options), "notice.json");
15613
+ }
15614
+ function readUpdateMetadataCache(options = {}) {
15615
+ const now = options.now ?? Date.now();
15616
+ const parsed = readJson(updateMetadataCachePath(options));
15617
+ if (!parsed) return void 0;
15618
+ if (parsed.status === "positive" && isPackageMetadata(parsed.metadata)) return {
15619
+ ...parsed,
15620
+ fresh: now <= parsed.expiresAt,
15621
+ usable: now <= parsed.staleUntil
15622
+ };
15623
+ if (parsed.status === "negative" && typeof parsed.reason === "string") return {
15624
+ ...parsed,
15625
+ fresh: now <= parsed.expiresAt,
15626
+ usable: now <= parsed.expiresAt
15627
+ };
15628
+ }
15629
+ function writeUpdateMetadataCache(entry, options = {}) {
15630
+ return writePrivateJson(updateMetadataCachePath(options), entry);
15631
+ }
15632
+ function readUpdateNoticeState(options = {}) {
15633
+ const parsed = readJson(updateNoticeStatePath(options));
15634
+ if (!parsed?.shown || typeof parsed.shown !== "object" || Array.isArray(parsed.shown)) return { shown: {} };
15635
+ const shown = {};
15636
+ for (const [version, value] of Object.entries(parsed.shown)) if (typeof version === "string" && value && typeof value === "object" && !Array.isArray(value) && typeof value.shownAt === "number") shown[version] = { shownAt: value.shownAt };
15637
+ return { shown };
15638
+ }
15639
+ function shouldShowUpdateNotice(version, options = {}) {
15640
+ const now = options.now ?? Date.now();
15641
+ const shownAt = readUpdateNoticeState(options).shown[version]?.shownAt;
15642
+ return shownAt === void 0 || now - shownAt >= 6048e5;
15643
+ }
15644
+ function recordUpdateNoticeShown(version, options = {}) {
15645
+ const now = options.now ?? Date.now();
15646
+ const state = readUpdateNoticeState(options);
15647
+ state.shown[version] = { shownAt: now };
15648
+ return writePrivateJson(updateNoticeStatePath(options), state);
15649
+ }
15650
+ function acquireUpdateRefreshLock(options = {}) {
15651
+ const now = options.now ?? Date.now();
15652
+ const path = updateRefreshLockPath(options);
15653
+ if (createUpdateRefreshLock(path, now)) return true;
15654
+ const existing = readJson(path);
15655
+ if (typeof existing?.lockedAt === "number" && now - existing.lockedAt < 6e4) return false;
15656
+ if (!existing && !existsSync(path)) return false;
15657
+ try {
15658
+ rmSync(path, { force: true });
15659
+ } catch {
15660
+ return false;
15661
+ }
15662
+ return createUpdateRefreshLock(path, now);
15663
+ }
15664
+ function releaseUpdateRefreshLock(options = {}) {
15665
+ try {
15666
+ rmSync(updateRefreshLockPath(options), { force: true });
15667
+ } catch {}
15668
+ }
15669
+ function writePrivateJson(path, value) {
15670
+ try {
15671
+ mkdirSync(dirname(path), {
15672
+ recursive: true,
15673
+ mode: 448
15674
+ });
15675
+ const tmp = `${path}.${process.pid}.${randomUUID()}.tmp`;
15676
+ writeFileSync(tmp, `${JSON.stringify(value, null, 2)}\n`, { mode: 384 });
15677
+ renameSync(tmp, path);
15678
+ return true;
15679
+ } catch {
15680
+ return false;
15681
+ }
15682
+ }
15683
+ function createUpdateRefreshLock(path, now) {
15684
+ let fd;
15685
+ try {
15686
+ mkdirSync(dirname(path), {
15687
+ recursive: true,
15688
+ mode: 448
15689
+ });
15690
+ fd = openSync(path, "wx", 384);
15691
+ writeFileSync(fd, `${JSON.stringify({ lockedAt: now }, null, 2)}\n`);
15692
+ return true;
15693
+ } catch {
15694
+ return false;
15695
+ } finally {
15696
+ if (fd !== void 0) try {
15697
+ closeSync(fd);
15698
+ } catch {}
15699
+ }
15700
+ }
15701
+ function readJson(path) {
15702
+ if (!existsSync(path)) return void 0;
15703
+ try {
15704
+ return JSON.parse(readFileSync(path, "utf8"));
15705
+ } catch {
15706
+ return;
15707
+ }
15708
+ }
15709
+ function isPackageMetadata(value) {
15710
+ return Boolean(value) && typeof value === "object" && !Array.isArray(value) && value.packageName === "caplets" && typeof value.distTags === "object" && !Array.isArray(value.distTags) && Array.isArray(value.versions);
15711
+ }
15712
+ //#endregion
15713
+ //#region src/update-check/registry.ts
15714
+ var UpdateRegistryError = class extends Error {
15715
+ reason;
15716
+ constructor(message, reason) {
15717
+ super(message);
15718
+ this.reason = reason;
15719
+ this.name = "UpdateRegistryError";
15720
+ }
15721
+ };
15722
+ async function fetchPublicCapletsMetadata(options) {
15723
+ const fetcher = options.fetcher ?? fetch;
15724
+ const controller = new AbortController();
15725
+ const timeout = setTimeout(() => controller.abort(), options.timeoutMs);
15726
+ const abort = () => controller.abort();
15727
+ if (options.signal?.aborted) abort();
15728
+ options.signal?.addEventListener("abort", abort, { once: true });
15729
+ try {
15730
+ const response = await fetcher(UPDATE_CHECK_REGISTRY_URL, {
15731
+ headers: { accept: UPDATE_CHECK_ACCEPT_HEADER },
15732
+ signal: controller.signal,
15733
+ redirect: "error"
15734
+ });
15735
+ if (!response.ok) throw new UpdateRegistryError(`registry responded with ${response.status}`, "http");
15736
+ const text = await readBoundedText(response, options.maxResponseBytes);
15737
+ return parsePackageMetadata(JSON.parse(text));
15738
+ } catch (error) {
15739
+ if (error instanceof UpdateRegistryError) throw error;
15740
+ if (error instanceof DOMException && error.name === "AbortError") throw new UpdateRegistryError("registry refresh timed out", "timeout");
15741
+ if (error instanceof SyntaxError) throw new UpdateRegistryError("registry response was not valid JSON", "invalid");
15742
+ throw new UpdateRegistryError("registry refresh failed", "network");
15743
+ } finally {
15744
+ clearTimeout(timeout);
15745
+ options.signal?.removeEventListener("abort", abort);
15746
+ }
15747
+ }
15748
+ function parsePackageMetadata(value) {
15749
+ if (!value || typeof value !== "object" || Array.isArray(value)) throw new UpdateRegistryError("registry metadata was not an object", "invalid");
15750
+ const record = value;
15751
+ if (record.name !== "caplets") throw new UpdateRegistryError("registry metadata package did not match caplets", "invalid");
15752
+ if (!record["dist-tags"] || typeof record["dist-tags"] !== "object") throw new UpdateRegistryError("registry metadata did not include dist-tags", "invalid");
15753
+ const distTags = Object.fromEntries(Object.entries(record["dist-tags"]).filter((entry) => typeof entry[1] === "string"));
15754
+ if (typeof distTags.latest !== "string") throw new UpdateRegistryError("registry metadata did not include dist-tags.latest", "invalid");
15755
+ if (!record.versions || typeof record.versions !== "object" || Array.isArray(record.versions)) throw new UpdateRegistryError("registry metadata did not include versions", "invalid");
15756
+ const versions = Object.keys(record.versions);
15757
+ if (versions.length === 0) throw new UpdateRegistryError("registry metadata included no versions", "invalid");
15758
+ return {
15759
+ packageName: UPDATE_CHECK_PACKAGE_NAME,
15760
+ distTags,
15761
+ versions
15762
+ };
15763
+ }
15764
+ async function readBoundedText(response, maxBytes = UPDATE_CHECK_MAX_RESPONSE_BYTES) {
15765
+ const contentLength = response.headers.get("content-length");
15766
+ const contentLengthNum = Number(contentLength);
15767
+ if (contentLength && Number.isFinite(contentLengthNum) && contentLengthNum > maxBytes) throw new UpdateRegistryError("registry response was too large", "too_large");
15768
+ if (!response.body) {
15769
+ const text = await response.text();
15770
+ if (new TextEncoder().encode(text).byteLength > maxBytes) throw new UpdateRegistryError("registry response was too large", "too_large");
15771
+ return text;
15772
+ }
15773
+ const reader = response.body.getReader();
15774
+ const chunks = [];
15775
+ let total = 0;
15776
+ while (true) {
15777
+ const { value, done } = await reader.read();
15778
+ if (done) break;
15779
+ if (value) {
15780
+ total += value.byteLength;
15781
+ if (total > maxBytes) {
15782
+ await reader.cancel().catch(() => void 0);
15783
+ throw new UpdateRegistryError("registry response was too large", "too_large");
15784
+ }
15785
+ chunks.push(value);
15786
+ }
15787
+ }
15788
+ const bytes = new Uint8Array(total);
15789
+ let offset = 0;
15790
+ for (const chunk of chunks) {
15791
+ bytes.set(chunk, offset);
15792
+ offset += chunk.byteLength;
15793
+ }
15794
+ return new TextDecoder().decode(bytes);
15795
+ }
15796
+ //#endregion
15797
+ //#region src/update-check/refresh.ts
15798
+ async function refreshUpdateMetadata(options = {}) {
15799
+ const now = options.now ?? Date.now();
15800
+ if (!acquireUpdateRefreshLock({
15801
+ ...options,
15802
+ now
15803
+ })) return "skipped";
15804
+ try {
15805
+ const metadata = await fetchPublicCapletsMetadata({
15806
+ fetcher: options.fetcher,
15807
+ signal: options.signal,
15808
+ timeoutMs: options.timeoutMs ?? 250,
15809
+ maxResponseBytes: options.maxResponseBytes ?? 1048576
15810
+ });
15811
+ writeUpdateMetadataCache({
15812
+ status: "positive",
15813
+ fetchedAt: now,
15814
+ expiresAt: now + UPDATE_CHECK_CACHE_TTL_MS,
15815
+ staleUntil: now + UPDATE_CHECK_CACHE_TTL_MS + UPDATE_CHECK_MAX_STALE_MS,
15816
+ source: UPDATE_CHECK_REGISTRY_URL,
15817
+ metadata
15818
+ }, options);
15819
+ return "refreshed";
15820
+ } catch (error) {
15821
+ const existing = readUpdateMetadataCache({
15822
+ ...options,
15823
+ now
15824
+ });
15825
+ if (existing?.status === "positive" && existing.usable) return "failed";
15826
+ writeUpdateMetadataCache({
15827
+ status: "negative",
15828
+ fetchedAt: now,
15829
+ expiresAt: now + UPDATE_CHECK_NEGATIVE_TTL_MS,
15830
+ reason: error instanceof UpdateRegistryError ? error.reason : "error"
15831
+ }, options);
15832
+ return "failed";
15833
+ } finally {
15834
+ releaseUpdateRefreshLock(options);
15835
+ }
15836
+ }
15837
+ //#endregion
15838
+ //#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/internal/constants.js
15839
+ var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
15840
+ const SEMVER_SPEC_VERSION = "2.0.0";
15841
+ const MAX_LENGTH = 256;
15842
+ const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || 9007199254740991;
15843
+ module.exports = {
15844
+ MAX_LENGTH,
15845
+ MAX_SAFE_COMPONENT_LENGTH: 16,
15846
+ MAX_SAFE_BUILD_LENGTH: MAX_LENGTH - 6,
15847
+ MAX_SAFE_INTEGER,
15848
+ RELEASE_TYPES: [
15849
+ "major",
15850
+ "premajor",
15851
+ "minor",
15852
+ "preminor",
15853
+ "patch",
15854
+ "prepatch",
15855
+ "prerelease"
15856
+ ],
15857
+ SEMVER_SPEC_VERSION,
15858
+ FLAG_INCLUDE_PRERELEASE: 1,
15859
+ FLAG_LOOSE: 2
15860
+ };
15861
+ }));
15862
+ //#endregion
15863
+ //#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/internal/debug.js
15864
+ var require_debug = /* @__PURE__ */ __commonJSMin(((exports, module) => {
15865
+ module.exports = typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => {};
15866
+ }));
15867
+ //#endregion
15868
+ //#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/internal/re.js
15869
+ var require_re = /* @__PURE__ */ __commonJSMin(((exports, module) => {
15870
+ const { MAX_SAFE_COMPONENT_LENGTH, MAX_SAFE_BUILD_LENGTH, MAX_LENGTH } = require_constants();
15871
+ const debug = require_debug();
15872
+ exports = module.exports = {};
15873
+ const re = exports.re = [];
15874
+ const safeRe = exports.safeRe = [];
15875
+ const src = exports.src = [];
15876
+ const safeSrc = exports.safeSrc = [];
15877
+ const t = exports.t = {};
15878
+ let R = 0;
15879
+ const LETTERDASHNUMBER = "[a-zA-Z0-9-]";
15880
+ const safeRegexReplacements = [
15881
+ ["\\s", 1],
15882
+ ["\\d", MAX_LENGTH],
15883
+ [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH]
15884
+ ];
15885
+ const makeSafeRegex = (value) => {
15886
+ for (const [token, max] of safeRegexReplacements) value = value.split(`${token}*`).join(`${token}{0,${max}}`).split(`${token}+`).join(`${token}{1,${max}}`);
15887
+ return value;
15888
+ };
15889
+ const createToken = (name, value, isGlobal) => {
15890
+ const safe = makeSafeRegex(value);
15891
+ const index = R++;
15892
+ debug(name, index, value);
15893
+ t[name] = index;
15894
+ src[index] = value;
15895
+ safeSrc[index] = safe;
15896
+ re[index] = new RegExp(value, isGlobal ? "g" : void 0);
15897
+ safeRe[index] = new RegExp(safe, isGlobal ? "g" : void 0);
15898
+ };
15899
+ createToken("NUMERICIDENTIFIER", "0|[1-9]\\d*");
15900
+ createToken("NUMERICIDENTIFIERLOOSE", "\\d+");
15901
+ createToken("NONNUMERICIDENTIFIER", `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`);
15902
+ createToken("MAINVERSION", `(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})`);
15903
+ createToken("MAINVERSIONLOOSE", `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})`);
15904
+ createToken("PRERELEASEIDENTIFIER", `(?:${src[t.NONNUMERICIDENTIFIER]}|${src[t.NUMERICIDENTIFIER]})`);
15905
+ createToken("PRERELEASEIDENTIFIERLOOSE", `(?:${src[t.NONNUMERICIDENTIFIER]}|${src[t.NUMERICIDENTIFIERLOOSE]})`);
15906
+ createToken("PRERELEASE", `(?:-(${src[t.PRERELEASEIDENTIFIER]}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`);
15907
+ createToken("PRERELEASELOOSE", `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`);
15908
+ createToken("BUILDIDENTIFIER", `${LETTERDASHNUMBER}+`);
15909
+ createToken("BUILD", `(?:\\+(${src[t.BUILDIDENTIFIER]}(?:\\.${src[t.BUILDIDENTIFIER]})*))`);
15910
+ createToken("FULLPLAIN", `v?${src[t.MAINVERSION]}${src[t.PRERELEASE]}?${src[t.BUILD]}?`);
15911
+ createToken("FULL", `^${src[t.FULLPLAIN]}$`);
15912
+ createToken("LOOSEPLAIN", `[v=\\s]*${src[t.MAINVERSIONLOOSE]}${src[t.PRERELEASELOOSE]}?${src[t.BUILD]}?`);
15913
+ createToken("LOOSE", `^${src[t.LOOSEPLAIN]}$`);
15914
+ createToken("GTLT", "((?:<|>)?=?)");
15915
+ createToken("XRANGEIDENTIFIERLOOSE", `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);
15916
+ createToken("XRANGEIDENTIFIER", `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`);
15917
+ createToken("XRANGEPLAIN", `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:${src[t.PRERELEASE]})?${src[t.BUILD]}?)?)?`);
15918
+ createToken("XRANGEPLAINLOOSE", `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:${src[t.PRERELEASELOOSE]})?${src[t.BUILD]}?)?)?`);
15919
+ createToken("XRANGE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`);
15920
+ createToken("XRANGELOOSE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`);
15921
+ createToken("COERCEPLAIN", `(^|[^\\d])(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}})(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`);
15922
+ createToken("COERCE", `${src[t.COERCEPLAIN]}(?:$|[^\\d])`);
15923
+ createToken("COERCEFULL", src[t.COERCEPLAIN] + `(?:${src[t.PRERELEASE]})?(?:${src[t.BUILD]})?(?:$|[^\\d])`);
15924
+ createToken("COERCERTL", src[t.COERCE], true);
15925
+ createToken("COERCERTLFULL", src[t.COERCEFULL], true);
15926
+ createToken("LONETILDE", "(?:~>?)");
15927
+ createToken("TILDETRIM", `(\\s*)${src[t.LONETILDE]}\\s+`, true);
15928
+ exports.tildeTrimReplace = "$1~";
15929
+ createToken("TILDE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`);
15930
+ createToken("TILDELOOSE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`);
15931
+ createToken("LONECARET", "(?:\\^)");
15932
+ createToken("CARETTRIM", `(\\s*)${src[t.LONECARET]}\\s+`, true);
15933
+ exports.caretTrimReplace = "$1^";
15934
+ createToken("CARET", `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`);
15935
+ createToken("CARETLOOSE", `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`);
15936
+ createToken("COMPARATORLOOSE", `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`);
15937
+ createToken("COMPARATOR", `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`);
15938
+ createToken("COMPARATORTRIM", `(\\s*)${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true);
15939
+ exports.comparatorTrimReplace = "$1$2$3";
15940
+ createToken("HYPHENRANGE", `^\\s*(${src[t.XRANGEPLAIN]})\\s+-\\s+(${src[t.XRANGEPLAIN]})\\s*$`);
15941
+ createToken("HYPHENRANGELOOSE", `^\\s*(${src[t.XRANGEPLAINLOOSE]})\\s+-\\s+(${src[t.XRANGEPLAINLOOSE]})\\s*$`);
15942
+ createToken("STAR", "(<|>)?=?\\s*\\*");
15943
+ createToken("GTE0", "^\\s*>=\\s*0\\.0\\.0\\s*$");
15944
+ createToken("GTE0PRE", "^\\s*>=\\s*0\\.0\\.0-0\\s*$");
15945
+ }));
15946
+ //#endregion
15947
+ //#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/internal/parse-options.js
15948
+ var require_parse_options = /* @__PURE__ */ __commonJSMin(((exports, module) => {
15949
+ const looseOption = Object.freeze({ loose: true });
15950
+ const emptyOpts = Object.freeze({});
15951
+ const parseOptions = (options) => {
15952
+ if (!options) return emptyOpts;
15953
+ if (typeof options !== "object") return looseOption;
15954
+ return options;
15955
+ };
15956
+ module.exports = parseOptions;
15957
+ }));
15958
+ //#endregion
15959
+ //#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/internal/identifiers.js
15960
+ var require_identifiers = /* @__PURE__ */ __commonJSMin(((exports, module) => {
15961
+ const numeric = /^[0-9]+$/;
15962
+ const compareIdentifiers = (a, b) => {
15963
+ if (typeof a === "number" && typeof b === "number") return a === b ? 0 : a < b ? -1 : 1;
15964
+ const anum = numeric.test(a);
15965
+ const bnum = numeric.test(b);
15966
+ if (anum && bnum) {
15967
+ a = +a;
15968
+ b = +b;
15969
+ }
15970
+ return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1;
15971
+ };
15972
+ const rcompareIdentifiers = (a, b) => compareIdentifiers(b, a);
15973
+ module.exports = {
15974
+ compareIdentifiers,
15975
+ rcompareIdentifiers
15976
+ };
15977
+ }));
15978
+ //#endregion
15979
+ //#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/classes/semver.js
15980
+ var require_semver$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
15981
+ const debug = require_debug();
15982
+ const { MAX_LENGTH, MAX_SAFE_INTEGER } = require_constants();
15983
+ const { safeRe: re, t } = require_re();
15984
+ const parseOptions = require_parse_options();
15985
+ const { compareIdentifiers } = require_identifiers();
15986
+ const isPrereleaseIdentifier = (prerelease, identifier) => {
15987
+ const identifiers = identifier.split(".");
15988
+ if (identifiers.length > prerelease.length) return false;
15989
+ for (let i = 0; i < identifiers.length; i++) if (compareIdentifiers(prerelease[i], identifiers[i]) !== 0) return false;
15990
+ return true;
15991
+ };
15992
+ module.exports = class SemVer {
15993
+ constructor(version, options) {
15994
+ options = parseOptions(options);
15995
+ if (version instanceof SemVer) if (version.loose === !!options.loose && version.includePrerelease === !!options.includePrerelease) return version;
15996
+ else version = version.version;
15997
+ else if (typeof version !== "string") throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version}".`);
15998
+ if (version.length > MAX_LENGTH) throw new TypeError(`version is longer than ${MAX_LENGTH} characters`);
15999
+ debug("SemVer", version, options);
16000
+ this.options = options;
16001
+ this.loose = !!options.loose;
16002
+ this.includePrerelease = !!options.includePrerelease;
16003
+ const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]);
16004
+ if (!m) throw new TypeError(`Invalid Version: ${version}`);
16005
+ this.raw = version;
16006
+ this.major = +m[1];
16007
+ this.minor = +m[2];
16008
+ this.patch = +m[3];
16009
+ if (this.major > MAX_SAFE_INTEGER || this.major < 0) throw new TypeError("Invalid major version");
16010
+ if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) throw new TypeError("Invalid minor version");
16011
+ if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) throw new TypeError("Invalid patch version");
16012
+ if (!m[4]) this.prerelease = [];
16013
+ else this.prerelease = m[4].split(".").map((id) => {
16014
+ if (/^[0-9]+$/.test(id)) {
16015
+ const num = +id;
16016
+ if (num >= 0 && num < MAX_SAFE_INTEGER) return num;
16017
+ }
16018
+ return id;
16019
+ });
16020
+ this.build = m[5] ? m[5].split(".") : [];
16021
+ this.format();
16022
+ }
16023
+ format() {
16024
+ this.version = `${this.major}.${this.minor}.${this.patch}`;
16025
+ if (this.prerelease.length) this.version += `-${this.prerelease.join(".")}`;
16026
+ return this.version;
16027
+ }
16028
+ toString() {
16029
+ return this.version;
16030
+ }
16031
+ compare(other) {
16032
+ debug("SemVer.compare", this.version, this.options, other);
16033
+ if (!(other instanceof SemVer)) {
16034
+ if (typeof other === "string" && other === this.version) return 0;
16035
+ other = new SemVer(other, this.options);
16036
+ }
16037
+ if (other.version === this.version) return 0;
16038
+ return this.compareMain(other) || this.comparePre(other);
16039
+ }
16040
+ compareMain(other) {
16041
+ if (!(other instanceof SemVer)) other = new SemVer(other, this.options);
16042
+ if (this.major < other.major) return -1;
16043
+ if (this.major > other.major) return 1;
16044
+ if (this.minor < other.minor) return -1;
16045
+ if (this.minor > other.minor) return 1;
16046
+ if (this.patch < other.patch) return -1;
16047
+ if (this.patch > other.patch) return 1;
16048
+ return 0;
16049
+ }
16050
+ comparePre(other) {
16051
+ if (!(other instanceof SemVer)) other = new SemVer(other, this.options);
16052
+ if (this.prerelease.length && !other.prerelease.length) return -1;
16053
+ else if (!this.prerelease.length && other.prerelease.length) return 1;
16054
+ else if (!this.prerelease.length && !other.prerelease.length) return 0;
16055
+ let i = 0;
16056
+ do {
16057
+ const a = this.prerelease[i];
16058
+ const b = other.prerelease[i];
16059
+ debug("prerelease compare", i, a, b);
16060
+ if (a === void 0 && b === void 0) return 0;
16061
+ else if (b === void 0) return 1;
16062
+ else if (a === void 0) return -1;
16063
+ else if (a === b) continue;
16064
+ else return compareIdentifiers(a, b);
16065
+ } while (++i);
16066
+ }
16067
+ compareBuild(other) {
16068
+ if (!(other instanceof SemVer)) other = new SemVer(other, this.options);
16069
+ let i = 0;
16070
+ do {
16071
+ const a = this.build[i];
16072
+ const b = other.build[i];
16073
+ debug("build compare", i, a, b);
16074
+ if (a === void 0 && b === void 0) return 0;
16075
+ else if (b === void 0) return 1;
16076
+ else if (a === void 0) return -1;
16077
+ else if (a === b) continue;
16078
+ else return compareIdentifiers(a, b);
16079
+ } while (++i);
16080
+ }
16081
+ inc(release, identifier, identifierBase) {
16082
+ if (release.startsWith("pre")) {
16083
+ if (!identifier && identifierBase === false) throw new Error("invalid increment argument: identifier is empty");
16084
+ if (identifier) {
16085
+ const match = `-${identifier}`.match(this.options.loose ? re[t.PRERELEASELOOSE] : re[t.PRERELEASE]);
16086
+ if (!match || match[1] !== identifier) throw new Error(`invalid identifier: ${identifier}`);
16087
+ }
16088
+ }
16089
+ switch (release) {
16090
+ case "premajor":
16091
+ this.prerelease.length = 0;
16092
+ this.patch = 0;
16093
+ this.minor = 0;
16094
+ this.major++;
16095
+ this.inc("pre", identifier, identifierBase);
16096
+ break;
16097
+ case "preminor":
16098
+ this.prerelease.length = 0;
16099
+ this.patch = 0;
16100
+ this.minor++;
16101
+ this.inc("pre", identifier, identifierBase);
16102
+ break;
16103
+ case "prepatch":
16104
+ this.prerelease.length = 0;
16105
+ this.inc("patch", identifier, identifierBase);
16106
+ this.inc("pre", identifier, identifierBase);
16107
+ break;
16108
+ case "prerelease":
16109
+ if (this.prerelease.length === 0) this.inc("patch", identifier, identifierBase);
16110
+ this.inc("pre", identifier, identifierBase);
16111
+ break;
16112
+ case "release":
16113
+ if (this.prerelease.length === 0) throw new Error(`version ${this.raw} is not a prerelease`);
16114
+ this.prerelease.length = 0;
16115
+ break;
16116
+ case "major":
16117
+ if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) this.major++;
16118
+ this.minor = 0;
16119
+ this.patch = 0;
16120
+ this.prerelease = [];
16121
+ break;
16122
+ case "minor":
16123
+ if (this.patch !== 0 || this.prerelease.length === 0) this.minor++;
16124
+ this.patch = 0;
16125
+ this.prerelease = [];
16126
+ break;
16127
+ case "patch":
16128
+ if (this.prerelease.length === 0) this.patch++;
16129
+ this.prerelease = [];
16130
+ break;
16131
+ case "pre": {
16132
+ const base = Number(identifierBase) ? 1 : 0;
16133
+ if (this.prerelease.length === 0) this.prerelease = [base];
16134
+ else {
16135
+ let i = this.prerelease.length;
16136
+ while (--i >= 0) if (typeof this.prerelease[i] === "number") {
16137
+ this.prerelease[i]++;
16138
+ i = -2;
16139
+ }
16140
+ if (i === -1) {
16141
+ if (identifier === this.prerelease.join(".") && identifierBase === false) throw new Error("invalid increment argument: identifier already exists");
16142
+ this.prerelease.push(base);
16143
+ }
16144
+ }
16145
+ if (identifier) {
16146
+ let prerelease = [identifier, base];
16147
+ if (identifierBase === false) prerelease = [identifier];
16148
+ if (isPrereleaseIdentifier(this.prerelease, identifier)) {
16149
+ const prereleaseBase = this.prerelease[identifier.split(".").length];
16150
+ if (isNaN(prereleaseBase)) this.prerelease = prerelease;
16151
+ } else this.prerelease = prerelease;
16152
+ }
16153
+ break;
16154
+ }
16155
+ default: throw new Error(`invalid increment argument: ${release}`);
16156
+ }
16157
+ this.raw = this.format();
16158
+ if (this.build.length) this.raw += `+${this.build.join(".")}`;
16159
+ return this;
16160
+ }
16161
+ };
16162
+ }));
16163
+ //#endregion
16164
+ //#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/parse.js
16165
+ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
16166
+ const SemVer = require_semver$1();
16167
+ const parse = (version, options, throwErrors = false) => {
16168
+ if (version instanceof SemVer) return version;
16169
+ try {
16170
+ return new SemVer(version, options);
16171
+ } catch (er) {
16172
+ if (!throwErrors) return null;
16173
+ throw er;
16174
+ }
16175
+ };
16176
+ module.exports = parse;
16177
+ }));
16178
+ //#endregion
16179
+ //#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/valid.js
16180
+ var require_valid$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
16181
+ const parse = require_parse();
16182
+ const valid = (version, options) => {
16183
+ const v = parse(version, options);
16184
+ return v ? v.version : null;
16185
+ };
16186
+ module.exports = valid;
16187
+ }));
16188
+ //#endregion
16189
+ //#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/clean.js
16190
+ var require_clean = /* @__PURE__ */ __commonJSMin(((exports, module) => {
16191
+ const parse = require_parse();
16192
+ const clean = (version, options) => {
16193
+ const s = parse(version.trim().replace(/^[=v]+/, ""), options);
16194
+ return s ? s.version : null;
16195
+ };
16196
+ module.exports = clean;
16197
+ }));
16198
+ //#endregion
16199
+ //#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/inc.js
16200
+ var require_inc = /* @__PURE__ */ __commonJSMin(((exports, module) => {
16201
+ const SemVer = require_semver$1();
16202
+ const inc = (version, release, options, identifier, identifierBase) => {
16203
+ if (typeof options === "string") {
16204
+ identifierBase = identifier;
16205
+ identifier = options;
16206
+ options = void 0;
16207
+ }
16208
+ try {
16209
+ return new SemVer(version instanceof SemVer ? version.version : version, options).inc(release, identifier, identifierBase).version;
16210
+ } catch (er) {
16211
+ return null;
16212
+ }
16213
+ };
16214
+ module.exports = inc;
16215
+ }));
16216
+ //#endregion
16217
+ //#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/diff.js
16218
+ var require_diff = /* @__PURE__ */ __commonJSMin(((exports, module) => {
16219
+ const parse = require_parse();
16220
+ const diff = (version1, version2) => {
16221
+ const v1 = parse(version1, null, true);
16222
+ const v2 = parse(version2, null, true);
16223
+ const comparison = v1.compare(v2);
16224
+ if (comparison === 0) return null;
16225
+ const v1Higher = comparison > 0;
16226
+ const highVersion = v1Higher ? v1 : v2;
16227
+ const lowVersion = v1Higher ? v2 : v1;
16228
+ const highHasPre = !!highVersion.prerelease.length;
16229
+ if (!!lowVersion.prerelease.length && !highHasPre) {
16230
+ if (!lowVersion.patch && !lowVersion.minor) return "major";
16231
+ if (lowVersion.compareMain(highVersion) === 0) {
16232
+ if (lowVersion.minor && !lowVersion.patch) return "minor";
16233
+ return "patch";
16234
+ }
16235
+ }
16236
+ const prefix = highHasPre ? "pre" : "";
16237
+ if (v1.major !== v2.major) return prefix + "major";
16238
+ if (v1.minor !== v2.minor) return prefix + "minor";
16239
+ if (v1.patch !== v2.patch) return prefix + "patch";
16240
+ return "prerelease";
16241
+ };
16242
+ module.exports = diff;
16243
+ }));
16244
+ //#endregion
16245
+ //#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/major.js
16246
+ var require_major = /* @__PURE__ */ __commonJSMin(((exports, module) => {
16247
+ const SemVer = require_semver$1();
16248
+ const major = (a, loose) => new SemVer(a, loose).major;
16249
+ module.exports = major;
16250
+ }));
16251
+ //#endregion
16252
+ //#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/minor.js
16253
+ var require_minor = /* @__PURE__ */ __commonJSMin(((exports, module) => {
16254
+ const SemVer = require_semver$1();
16255
+ const minor = (a, loose) => new SemVer(a, loose).minor;
16256
+ module.exports = minor;
16257
+ }));
16258
+ //#endregion
16259
+ //#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/patch.js
16260
+ var require_patch = /* @__PURE__ */ __commonJSMin(((exports, module) => {
16261
+ const SemVer = require_semver$1();
16262
+ const patch = (a, loose) => new SemVer(a, loose).patch;
16263
+ module.exports = patch;
16264
+ }));
16265
+ //#endregion
16266
+ //#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/prerelease.js
16267
+ var require_prerelease = /* @__PURE__ */ __commonJSMin(((exports, module) => {
16268
+ const parse = require_parse();
16269
+ const prerelease = (version, options) => {
16270
+ const parsed = parse(version, options);
16271
+ return parsed && parsed.prerelease.length ? parsed.prerelease : null;
16272
+ };
16273
+ module.exports = prerelease;
16274
+ }));
16275
+ //#endregion
16276
+ //#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/compare.js
16277
+ var require_compare = /* @__PURE__ */ __commonJSMin(((exports, module) => {
16278
+ const SemVer = require_semver$1();
16279
+ const compare = (a, b, loose) => new SemVer(a, loose).compare(new SemVer(b, loose));
16280
+ module.exports = compare;
16281
+ }));
16282
+ //#endregion
16283
+ //#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/rcompare.js
16284
+ var require_rcompare = /* @__PURE__ */ __commonJSMin(((exports, module) => {
16285
+ const compare = require_compare();
16286
+ const rcompare = (a, b, loose) => compare(b, a, loose);
16287
+ module.exports = rcompare;
16288
+ }));
16289
+ //#endregion
16290
+ //#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/compare-loose.js
16291
+ var require_compare_loose = /* @__PURE__ */ __commonJSMin(((exports, module) => {
16292
+ const compare = require_compare();
16293
+ const compareLoose = (a, b) => compare(a, b, true);
16294
+ module.exports = compareLoose;
16295
+ }));
16296
+ //#endregion
16297
+ //#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/compare-build.js
16298
+ var require_compare_build = /* @__PURE__ */ __commonJSMin(((exports, module) => {
16299
+ const SemVer = require_semver$1();
16300
+ const compareBuild = (a, b, loose) => {
16301
+ const versionA = new SemVer(a, loose);
16302
+ const versionB = new SemVer(b, loose);
16303
+ return versionA.compare(versionB) || versionA.compareBuild(versionB);
16304
+ };
16305
+ module.exports = compareBuild;
16306
+ }));
16307
+ //#endregion
16308
+ //#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/sort.js
16309
+ var require_sort = /* @__PURE__ */ __commonJSMin(((exports, module) => {
16310
+ const compareBuild = require_compare_build();
16311
+ const sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose));
16312
+ module.exports = sort;
16313
+ }));
16314
+ //#endregion
16315
+ //#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/rsort.js
16316
+ var require_rsort = /* @__PURE__ */ __commonJSMin(((exports, module) => {
16317
+ const compareBuild = require_compare_build();
16318
+ const rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose));
16319
+ module.exports = rsort;
16320
+ }));
16321
+ //#endregion
16322
+ //#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/gt.js
16323
+ var require_gt = /* @__PURE__ */ __commonJSMin(((exports, module) => {
16324
+ const compare = require_compare();
16325
+ const gt = (a, b, loose) => compare(a, b, loose) > 0;
16326
+ module.exports = gt;
16327
+ }));
16328
+ //#endregion
16329
+ //#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/lt.js
16330
+ var require_lt = /* @__PURE__ */ __commonJSMin(((exports, module) => {
16331
+ const compare = require_compare();
16332
+ const lt = (a, b, loose) => compare(a, b, loose) < 0;
16333
+ module.exports = lt;
16334
+ }));
16335
+ //#endregion
16336
+ //#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/eq.js
16337
+ var require_eq = /* @__PURE__ */ __commonJSMin(((exports, module) => {
16338
+ const compare = require_compare();
16339
+ const eq = (a, b, loose) => compare(a, b, loose) === 0;
16340
+ module.exports = eq;
16341
+ }));
16342
+ //#endregion
16343
+ //#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/neq.js
16344
+ var require_neq = /* @__PURE__ */ __commonJSMin(((exports, module) => {
16345
+ const compare = require_compare();
16346
+ const neq = (a, b, loose) => compare(a, b, loose) !== 0;
16347
+ module.exports = neq;
16348
+ }));
16349
+ //#endregion
16350
+ //#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/gte.js
16351
+ var require_gte = /* @__PURE__ */ __commonJSMin(((exports, module) => {
16352
+ const compare = require_compare();
16353
+ const gte = (a, b, loose) => compare(a, b, loose) >= 0;
16354
+ module.exports = gte;
16355
+ }));
16356
+ //#endregion
16357
+ //#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/lte.js
16358
+ var require_lte = /* @__PURE__ */ __commonJSMin(((exports, module) => {
16359
+ const compare = require_compare();
16360
+ const lte = (a, b, loose) => compare(a, b, loose) <= 0;
16361
+ module.exports = lte;
16362
+ }));
16363
+ //#endregion
16364
+ //#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/cmp.js
16365
+ var require_cmp = /* @__PURE__ */ __commonJSMin(((exports, module) => {
16366
+ const eq = require_eq();
16367
+ const neq = require_neq();
16368
+ const gt = require_gt();
16369
+ const gte = require_gte();
16370
+ const lt = require_lt();
16371
+ const lte = require_lte();
16372
+ const cmp = (a, op, b, loose) => {
16373
+ switch (op) {
16374
+ case "===":
16375
+ if (typeof a === "object") a = a.version;
16376
+ if (typeof b === "object") b = b.version;
16377
+ return a === b;
16378
+ case "!==":
16379
+ if (typeof a === "object") a = a.version;
16380
+ if (typeof b === "object") b = b.version;
16381
+ return a !== b;
16382
+ case "":
16383
+ case "=":
16384
+ case "==": return eq(a, b, loose);
16385
+ case "!=": return neq(a, b, loose);
16386
+ case ">": return gt(a, b, loose);
16387
+ case ">=": return gte(a, b, loose);
16388
+ case "<": return lt(a, b, loose);
16389
+ case "<=": return lte(a, b, loose);
16390
+ default: throw new TypeError(`Invalid operator: ${op}`);
16391
+ }
16392
+ };
16393
+ module.exports = cmp;
16394
+ }));
16395
+ //#endregion
16396
+ //#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/coerce.js
16397
+ var require_coerce = /* @__PURE__ */ __commonJSMin(((exports, module) => {
16398
+ const SemVer = require_semver$1();
16399
+ const parse = require_parse();
16400
+ const { safeRe: re, t } = require_re();
16401
+ const coerce = (version, options) => {
16402
+ if (version instanceof SemVer) return version;
16403
+ if (typeof version === "number") version = String(version);
16404
+ if (typeof version !== "string") return null;
16405
+ options = options || {};
16406
+ let match = null;
16407
+ if (!options.rtl) match = version.match(options.includePrerelease ? re[t.COERCEFULL] : re[t.COERCE]);
16408
+ else {
16409
+ const coerceRtlRegex = options.includePrerelease ? re[t.COERCERTLFULL] : re[t.COERCERTL];
16410
+ let next;
16411
+ while ((next = coerceRtlRegex.exec(version)) && (!match || match.index + match[0].length !== version.length)) {
16412
+ if (!match || next.index + next[0].length !== match.index + match[0].length) match = next;
16413
+ coerceRtlRegex.lastIndex = next.index + next[1].length + next[2].length;
16414
+ }
16415
+ coerceRtlRegex.lastIndex = -1;
16416
+ }
16417
+ if (match === null) return null;
16418
+ const major = match[2];
16419
+ return parse(`${major}.${match[3] || "0"}.${match[4] || "0"}${options.includePrerelease && match[5] ? `-${match[5]}` : ""}${options.includePrerelease && match[6] ? `+${match[6]}` : ""}`, options);
16420
+ };
16421
+ module.exports = coerce;
16422
+ }));
16423
+ //#endregion
16424
+ //#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/truncate.js
16425
+ var require_truncate = /* @__PURE__ */ __commonJSMin(((exports, module) => {
16426
+ const parse = require_parse();
16427
+ const constants = require_constants();
16428
+ const SemVer = require_semver$1();
16429
+ const truncate = (version, truncation, options) => {
16430
+ if (!constants.RELEASE_TYPES.includes(truncation)) return null;
16431
+ const clonedVersion = cloneInputVersion(version, options);
16432
+ return clonedVersion && doTruncation(clonedVersion, truncation);
16433
+ };
16434
+ const cloneInputVersion = (version, options) => {
16435
+ return parse(version instanceof SemVer ? version.version : version, options);
16436
+ };
16437
+ const doTruncation = (version, truncation) => {
16438
+ if (isPrerelease(truncation)) return version.version;
16439
+ version.prerelease = [];
16440
+ switch (truncation) {
16441
+ case "major":
16442
+ version.minor = 0;
16443
+ version.patch = 0;
16444
+ break;
16445
+ case "minor":
16446
+ version.patch = 0;
16447
+ break;
16448
+ }
16449
+ return version.format();
16450
+ };
16451
+ const isPrerelease = (type) => {
16452
+ return type.startsWith("pre");
16453
+ };
16454
+ module.exports = truncate;
16455
+ }));
16456
+ //#endregion
16457
+ //#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/internal/lrucache.js
16458
+ var require_lrucache = /* @__PURE__ */ __commonJSMin(((exports, module) => {
16459
+ var LRUCache = class {
16460
+ constructor() {
16461
+ this.max = 1e3;
16462
+ this.map = /* @__PURE__ */ new Map();
16463
+ }
16464
+ get(key) {
16465
+ const value = this.map.get(key);
16466
+ if (value === void 0) return;
16467
+ else {
16468
+ this.map.delete(key);
16469
+ this.map.set(key, value);
16470
+ return value;
16471
+ }
16472
+ }
16473
+ delete(key) {
16474
+ return this.map.delete(key);
16475
+ }
16476
+ set(key, value) {
16477
+ if (!this.delete(key) && value !== void 0) {
16478
+ if (this.map.size >= this.max) {
16479
+ const firstKey = this.map.keys().next().value;
16480
+ this.delete(firstKey);
16481
+ }
16482
+ this.map.set(key, value);
16483
+ }
16484
+ return this;
16485
+ }
16486
+ };
16487
+ module.exports = LRUCache;
16488
+ }));
16489
+ //#endregion
16490
+ //#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/classes/range.js
16491
+ var require_range = /* @__PURE__ */ __commonJSMin(((exports, module) => {
16492
+ const SPACE_CHARACTERS = /\s+/g;
16493
+ module.exports = class Range {
16494
+ constructor(range, options) {
16495
+ options = parseOptions(options);
16496
+ if (range instanceof Range) if (range.loose === !!options.loose && range.includePrerelease === !!options.includePrerelease) return range;
16497
+ else return new Range(range.raw, options);
16498
+ if (range instanceof Comparator) {
16499
+ this.raw = range.value;
16500
+ this.set = [[range]];
16501
+ this.formatted = void 0;
16502
+ return this;
16503
+ }
16504
+ this.options = options;
16505
+ this.loose = !!options.loose;
16506
+ this.includePrerelease = !!options.includePrerelease;
16507
+ this.raw = range.trim().replace(SPACE_CHARACTERS, " ");
16508
+ this.set = this.raw.split("||").map((r) => this.parseRange(r.trim())).filter((c) => c.length);
16509
+ if (!this.set.length) throw new TypeError(`Invalid SemVer Range: ${this.raw}`);
16510
+ if (this.set.length > 1) {
16511
+ const first = this.set[0];
16512
+ this.set = this.set.filter((c) => !isNullSet(c[0]));
16513
+ if (this.set.length === 0) this.set = [first];
16514
+ else if (this.set.length > 1) {
16515
+ for (const c of this.set) if (c.length === 1 && isAny(c[0])) {
16516
+ this.set = [c];
16517
+ break;
16518
+ }
16519
+ }
16520
+ }
16521
+ this.formatted = void 0;
16522
+ }
16523
+ get range() {
16524
+ if (this.formatted === void 0) {
16525
+ this.formatted = "";
16526
+ for (let i = 0; i < this.set.length; i++) {
16527
+ if (i > 0) this.formatted += "||";
16528
+ const comps = this.set[i];
16529
+ for (let k = 0; k < comps.length; k++) {
16530
+ if (k > 0) this.formatted += " ";
16531
+ this.formatted += comps[k].toString().trim();
16532
+ }
16533
+ }
16534
+ }
16535
+ return this.formatted;
16536
+ }
16537
+ format() {
16538
+ return this.range;
16539
+ }
16540
+ toString() {
16541
+ return this.range;
16542
+ }
16543
+ parseRange(range) {
16544
+ range = range.replace(BUILDSTRIPRE, "");
16545
+ const memoKey = ((this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) | (this.options.loose && FLAG_LOOSE)) + ":" + range;
16546
+ const cached = cache.get(memoKey);
16547
+ if (cached) return cached;
16548
+ const loose = this.options.loose;
16549
+ const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE];
16550
+ range = range.replace(hr, hyphenReplace(this.options.includePrerelease));
16551
+ debug("hyphen replace", range);
16552
+ range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace);
16553
+ debug("comparator trim", range);
16554
+ range = range.replace(re[t.TILDETRIM], tildeTrimReplace);
16555
+ debug("tilde trim", range);
16556
+ range = range.replace(re[t.CARETTRIM], caretTrimReplace);
16557
+ debug("caret trim", range);
16558
+ let rangeList = range.split(" ").map((comp) => parseComparator(comp, this.options)).join(" ").split(/\s+/).map((comp) => replaceGTE0(comp, this.options));
16559
+ if (loose) rangeList = rangeList.filter((comp) => {
16560
+ debug("loose invalid filter", comp, this.options);
16561
+ return !!comp.match(re[t.COMPARATORLOOSE]);
16562
+ });
16563
+ debug("range list", rangeList);
16564
+ const rangeMap = /* @__PURE__ */ new Map();
16565
+ const comparators = rangeList.map((comp) => new Comparator(comp, this.options));
16566
+ for (const comp of comparators) {
16567
+ if (isNullSet(comp)) return [comp];
16568
+ rangeMap.set(comp.value, comp);
16569
+ }
16570
+ if (rangeMap.size > 1 && rangeMap.has("")) rangeMap.delete("");
16571
+ const result = [...rangeMap.values()];
16572
+ cache.set(memoKey, result);
16573
+ return result;
16574
+ }
16575
+ intersects(range, options) {
16576
+ if (!(range instanceof Range)) throw new TypeError("a Range is required");
16577
+ return this.set.some((thisComparators) => {
16578
+ return isSatisfiable(thisComparators, options) && range.set.some((rangeComparators) => {
16579
+ return isSatisfiable(rangeComparators, options) && thisComparators.every((thisComparator) => {
16580
+ return rangeComparators.every((rangeComparator) => {
16581
+ return thisComparator.intersects(rangeComparator, options);
16582
+ });
16583
+ });
16584
+ });
16585
+ });
16586
+ }
16587
+ test(version) {
16588
+ if (!version) return false;
16589
+ if (typeof version === "string") try {
16590
+ version = new SemVer(version, this.options);
16591
+ } catch (er) {
16592
+ return false;
16593
+ }
16594
+ for (let i = 0; i < this.set.length; i++) if (testSet(this.set[i], version, this.options)) return true;
16595
+ return false;
16596
+ }
16597
+ };
16598
+ const cache = new (require_lrucache())();
16599
+ const parseOptions = require_parse_options();
16600
+ const Comparator = require_comparator();
16601
+ const debug = require_debug();
16602
+ const SemVer = require_semver$1();
16603
+ const { safeRe: re, src, t, comparatorTrimReplace, tildeTrimReplace, caretTrimReplace } = require_re();
16604
+ const { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = require_constants();
16605
+ const BUILDSTRIPRE = new RegExp(src[t.BUILD], "g");
16606
+ const isNullSet = (c) => c.value === "<0.0.0-0";
16607
+ const isAny = (c) => c.value === "";
16608
+ const isSatisfiable = (comparators, options) => {
16609
+ let result = true;
16610
+ const remainingComparators = comparators.slice();
16611
+ let testComparator = remainingComparators.pop();
16612
+ while (result && remainingComparators.length) {
16613
+ result = remainingComparators.every((otherComparator) => {
16614
+ return testComparator.intersects(otherComparator, options);
16615
+ });
16616
+ testComparator = remainingComparators.pop();
16617
+ }
16618
+ return result;
16619
+ };
16620
+ const parseComparator = (comp, options) => {
16621
+ comp = comp.replace(re[t.BUILD], "");
16622
+ debug("comp", comp, options);
16623
+ comp = replaceCarets(comp, options);
16624
+ debug("caret", comp);
16625
+ comp = replaceTildes(comp, options);
16626
+ debug("tildes", comp);
16627
+ comp = replaceXRanges(comp, options);
16628
+ debug("xrange", comp);
16629
+ comp = replaceStars(comp, options);
16630
+ debug("stars", comp);
16631
+ return comp;
16632
+ };
16633
+ const isX = (id) => !id || id.toLowerCase() === "x" || id === "*";
16634
+ const invalidXRangeOrder = (M, m, p) => isX(M) && !isX(m) || isX(m) && p && !isX(p);
16635
+ const replaceTildes = (comp, options) => {
16636
+ return comp.trim().split(/\s+/).map((c) => replaceTilde(c, options)).join(" ");
16637
+ };
16638
+ const replaceTilde = (comp, options) => {
16639
+ const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];
16640
+ const z = options.includePrerelease ? "-0" : "";
16641
+ return comp.replace(r, (_, M, m, p, pr) => {
16642
+ debug("tilde", comp, _, M, m, p, pr);
16643
+ let ret;
16644
+ if (isX(M)) ret = "";
16645
+ else if (isX(m)) ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`;
16646
+ else if (isX(p)) ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`;
16647
+ else if (pr) {
16648
+ debug("replaceTilde pr", pr);
16649
+ ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
16650
+ } else ret = `>=${M}.${m}.${p} <${M}.${+m + 1}.0-0`;
16651
+ debug("tilde return", ret);
16652
+ return ret;
16653
+ });
16654
+ };
16655
+ const replaceCarets = (comp, options) => {
16656
+ return comp.trim().split(/\s+/).map((c) => replaceCaret(c, options)).join(" ");
16657
+ };
16658
+ const replaceCaret = (comp, options) => {
16659
+ debug("caret", comp, options);
16660
+ const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET];
16661
+ const z = options.includePrerelease ? "-0" : "";
16662
+ return comp.replace(r, (_, M, m, p, pr) => {
16663
+ debug("caret", comp, _, M, m, p, pr);
16664
+ let ret;
16665
+ if (isX(M)) ret = "";
16666
+ else if (isX(m)) ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`;
16667
+ else if (isX(p)) if (M === "0") ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`;
16668
+ else ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`;
16669
+ else if (pr) {
16670
+ debug("replaceCaret pr", pr);
16671
+ if (M === "0") if (m === "0") ret = `>=${M}.${m}.${p}-${pr} <${M}.${m}.${+p + 1}-0`;
16672
+ else ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
16673
+ else ret = `>=${M}.${m}.${p}-${pr} <${+M + 1}.0.0-0`;
16674
+ } else {
16675
+ debug("no pr");
16676
+ if (M === "0") if (m === "0") ret = `>=${M}.${m}.${p} <${M}.${m}.${+p + 1}-0`;
16677
+ else ret = `>=${M}.${m}.${p} <${M}.${+m + 1}.0-0`;
16678
+ else ret = `>=${M}.${m}.${p} <${+M + 1}.0.0-0`;
16679
+ }
16680
+ debug("caret return", ret);
16681
+ return ret;
16682
+ });
16683
+ };
16684
+ const replaceXRanges = (comp, options) => {
16685
+ debug("replaceXRanges", comp, options);
16686
+ return comp.split(/\s+/).map((c) => replaceXRange(c, options)).join(" ");
16687
+ };
16688
+ const replaceXRange = (comp, options) => {
16689
+ comp = comp.trim();
16690
+ const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE];
16691
+ return comp.replace(r, (ret, gtlt, M, m, p, pr) => {
16692
+ debug("xRange", comp, ret, gtlt, M, m, p, pr);
16693
+ if (invalidXRangeOrder(M, m, p)) return comp;
16694
+ const xM = isX(M);
16695
+ const xm = xM || isX(m);
16696
+ const xp = xm || isX(p);
16697
+ const anyX = xp;
16698
+ if (gtlt === "=" && anyX) gtlt = "";
16699
+ pr = options.includePrerelease ? "-0" : "";
16700
+ if (xM) if (gtlt === ">" || gtlt === "<") ret = "<0.0.0-0";
16701
+ else ret = "*";
16702
+ else if (gtlt && anyX) {
16703
+ if (xm) m = 0;
16704
+ p = 0;
16705
+ if (gtlt === ">") {
16706
+ gtlt = ">=";
16707
+ if (xm) {
16708
+ M = +M + 1;
16709
+ m = 0;
16710
+ p = 0;
16711
+ } else {
16712
+ m = +m + 1;
16713
+ p = 0;
16714
+ }
16715
+ } else if (gtlt === "<=") {
16716
+ gtlt = "<";
16717
+ if (xm) M = +M + 1;
16718
+ else m = +m + 1;
16719
+ }
16720
+ if (gtlt === "<") pr = "-0";
16721
+ ret = `${gtlt + M}.${m}.${p}${pr}`;
16722
+ } else if (xm) ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`;
16723
+ else if (xp) ret = `>=${M}.${m}.0${pr} <${M}.${+m + 1}.0-0`;
16724
+ debug("xRange return", ret);
16725
+ return ret;
16726
+ });
16727
+ };
16728
+ const replaceStars = (comp, options) => {
16729
+ debug("replaceStars", comp, options);
16730
+ return comp.trim().replace(re[t.STAR], "");
16731
+ };
16732
+ const replaceGTE0 = (comp, options) => {
16733
+ debug("replaceGTE0", comp, options);
16734
+ return comp.trim().replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], "");
16735
+ };
16736
+ const hyphenReplace = (incPr) => ($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr) => {
16737
+ if (isX(fM)) from = "";
16738
+ else if (isX(fm)) from = `>=${fM}.0.0${incPr ? "-0" : ""}`;
16739
+ else if (isX(fp)) from = `>=${fM}.${fm}.0${incPr ? "-0" : ""}`;
16740
+ else if (fpr) from = `>=${from}`;
16741
+ else from = `>=${from}${incPr ? "-0" : ""}`;
16742
+ if (isX(tM)) to = "";
16743
+ else if (isX(tm)) to = `<${+tM + 1}.0.0-0`;
16744
+ else if (isX(tp)) to = `<${tM}.${+tm + 1}.0-0`;
16745
+ else if (tpr) to = `<=${tM}.${tm}.${tp}-${tpr}`;
16746
+ else if (incPr) to = `<${tM}.${tm}.${+tp + 1}-0`;
16747
+ else to = `<=${to}`;
16748
+ return `${from} ${to}`.trim();
16749
+ };
16750
+ const testSet = (set, version, options) => {
16751
+ for (let i = 0; i < set.length; i++) if (!set[i].test(version)) return false;
16752
+ if (version.prerelease.length && !options.includePrerelease) {
16753
+ for (let i = 0; i < set.length; i++) {
16754
+ debug(set[i].semver);
16755
+ if (set[i].semver === Comparator.ANY) continue;
16756
+ if (set[i].semver.prerelease.length > 0) {
16757
+ const allowed = set[i].semver;
16758
+ if (allowed.major === version.major && allowed.minor === version.minor && allowed.patch === version.patch) return true;
16759
+ }
16760
+ }
16761
+ return false;
16762
+ }
16763
+ return true;
16764
+ };
16765
+ }));
16766
+ //#endregion
16767
+ //#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/classes/comparator.js
16768
+ var require_comparator = /* @__PURE__ */ __commonJSMin(((exports, module) => {
16769
+ const ANY = Symbol("SemVer ANY");
16770
+ module.exports = class Comparator {
16771
+ static get ANY() {
16772
+ return ANY;
16773
+ }
16774
+ constructor(comp, options) {
16775
+ options = parseOptions(options);
16776
+ if (comp instanceof Comparator) if (comp.loose === !!options.loose) return comp;
16777
+ else comp = comp.value;
16778
+ comp = comp.trim().split(/\s+/).join(" ");
16779
+ debug("comparator", comp, options);
16780
+ this.options = options;
16781
+ this.loose = !!options.loose;
16782
+ this.parse(comp);
16783
+ if (this.semver === ANY) this.value = "";
16784
+ else this.value = this.operator + this.semver.version;
16785
+ debug("comp", this);
16786
+ }
16787
+ parse(comp) {
16788
+ const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR];
16789
+ const m = comp.match(r);
16790
+ if (!m) throw new TypeError(`Invalid comparator: ${comp}`);
16791
+ this.operator = m[1] !== void 0 ? m[1] : "";
16792
+ if (this.operator === "=") this.operator = "";
16793
+ if (!m[2]) this.semver = ANY;
16794
+ else this.semver = new SemVer(m[2], this.options.loose);
16795
+ }
16796
+ toString() {
16797
+ return this.value;
16798
+ }
16799
+ test(version) {
16800
+ debug("Comparator.test", version, this.options.loose);
16801
+ if (this.semver === ANY || version === ANY) return true;
16802
+ if (typeof version === "string") try {
16803
+ version = new SemVer(version, this.options);
16804
+ } catch (er) {
16805
+ return false;
16806
+ }
16807
+ return cmp(version, this.operator, this.semver, this.options);
16808
+ }
16809
+ intersects(comp, options) {
16810
+ if (!(comp instanceof Comparator)) throw new TypeError("a Comparator is required");
16811
+ if (this.operator === "") {
16812
+ if (this.value === "") return true;
16813
+ return new Range(comp.value, options).test(this.value);
16814
+ } else if (comp.operator === "") {
16815
+ if (comp.value === "") return true;
16816
+ return new Range(this.value, options).test(comp.semver);
16817
+ }
16818
+ options = parseOptions(options);
16819
+ if (options.includePrerelease && (this.value === "<0.0.0-0" || comp.value === "<0.0.0-0")) return false;
16820
+ if (!options.includePrerelease && (this.value.startsWith("<0.0.0") || comp.value.startsWith("<0.0.0"))) return false;
16821
+ if (this.operator.startsWith(">") && comp.operator.startsWith(">")) return true;
16822
+ if (this.operator.startsWith("<") && comp.operator.startsWith("<")) return true;
16823
+ if (this.semver.version === comp.semver.version && this.operator.includes("=") && comp.operator.includes("=")) return true;
16824
+ if (cmp(this.semver, "<", comp.semver, options) && this.operator.startsWith(">") && comp.operator.startsWith("<")) return true;
16825
+ if (cmp(this.semver, ">", comp.semver, options) && this.operator.startsWith("<") && comp.operator.startsWith(">")) return true;
16826
+ return false;
16827
+ }
16828
+ };
16829
+ const parseOptions = require_parse_options();
16830
+ const { safeRe: re, t } = require_re();
16831
+ const cmp = require_cmp();
16832
+ const debug = require_debug();
16833
+ const SemVer = require_semver$1();
16834
+ const Range = require_range();
16835
+ }));
16836
+ //#endregion
16837
+ //#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/satisfies.js
16838
+ var require_satisfies = /* @__PURE__ */ __commonJSMin(((exports, module) => {
16839
+ const Range = require_range();
16840
+ const satisfies = (version, range, options) => {
16841
+ try {
16842
+ range = new Range(range, options);
16843
+ } catch (er) {
16844
+ return false;
16845
+ }
16846
+ return range.test(version);
16847
+ };
16848
+ module.exports = satisfies;
16849
+ }));
16850
+ //#endregion
16851
+ //#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/to-comparators.js
16852
+ var require_to_comparators = /* @__PURE__ */ __commonJSMin(((exports, module) => {
16853
+ const Range = require_range();
16854
+ const toComparators = (range, options) => new Range(range, options).set.map((comp) => comp.map((c) => c.value).join(" ").trim().split(" "));
16855
+ module.exports = toComparators;
16856
+ }));
16857
+ //#endregion
16858
+ //#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/max-satisfying.js
16859
+ var require_max_satisfying = /* @__PURE__ */ __commonJSMin(((exports, module) => {
16860
+ const SemVer = require_semver$1();
16861
+ const Range = require_range();
16862
+ const maxSatisfying = (versions, range, options) => {
16863
+ let max = null;
16864
+ let maxSV = null;
16865
+ let rangeObj = null;
16866
+ try {
16867
+ rangeObj = new Range(range, options);
16868
+ } catch (er) {
16869
+ return null;
16870
+ }
16871
+ versions.forEach((v) => {
16872
+ if (rangeObj.test(v)) {
16873
+ if (!max || maxSV.compare(v) === -1) {
16874
+ max = v;
16875
+ maxSV = new SemVer(max, options);
16876
+ }
16877
+ }
16878
+ });
16879
+ return max;
16880
+ };
16881
+ module.exports = maxSatisfying;
16882
+ }));
16883
+ //#endregion
16884
+ //#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/min-satisfying.js
16885
+ var require_min_satisfying = /* @__PURE__ */ __commonJSMin(((exports, module) => {
16886
+ const SemVer = require_semver$1();
16887
+ const Range = require_range();
16888
+ const minSatisfying = (versions, range, options) => {
16889
+ let min = null;
16890
+ let minSV = null;
16891
+ let rangeObj = null;
16892
+ try {
16893
+ rangeObj = new Range(range, options);
16894
+ } catch (er) {
16895
+ return null;
16896
+ }
16897
+ versions.forEach((v) => {
16898
+ if (rangeObj.test(v)) {
16899
+ if (!min || minSV.compare(v) === 1) {
16900
+ min = v;
16901
+ minSV = new SemVer(min, options);
16902
+ }
16903
+ }
16904
+ });
16905
+ return min;
16906
+ };
16907
+ module.exports = minSatisfying;
16908
+ }));
16909
+ //#endregion
16910
+ //#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/min-version.js
16911
+ var require_min_version = /* @__PURE__ */ __commonJSMin(((exports, module) => {
16912
+ const SemVer = require_semver$1();
16913
+ const Range = require_range();
16914
+ const gt = require_gt();
16915
+ const minVersion = (range, loose) => {
16916
+ range = new Range(range, loose);
16917
+ let minver = new SemVer("0.0.0");
16918
+ if (range.test(minver)) return minver;
16919
+ minver = new SemVer("0.0.0-0");
16920
+ if (range.test(minver)) return minver;
16921
+ minver = null;
16922
+ for (let i = 0; i < range.set.length; ++i) {
16923
+ const comparators = range.set[i];
16924
+ let setMin = null;
16925
+ comparators.forEach((comparator) => {
16926
+ const compver = new SemVer(comparator.semver.version);
16927
+ switch (comparator.operator) {
16928
+ case ">":
16929
+ if (compver.prerelease.length === 0) compver.patch++;
16930
+ else compver.prerelease.push(0);
16931
+ compver.raw = compver.format();
16932
+ case "":
16933
+ case ">=":
16934
+ if (!setMin || gt(compver, setMin)) setMin = compver;
16935
+ break;
16936
+ case "<":
16937
+ case "<=": break;
16938
+ /* istanbul ignore next */
16939
+ default: throw new Error(`Unexpected operation: ${comparator.operator}`);
16940
+ }
16941
+ });
16942
+ if (setMin && (!minver || gt(minver, setMin))) minver = setMin;
16943
+ }
16944
+ if (minver && range.test(minver)) return minver;
16945
+ return null;
16946
+ };
16947
+ module.exports = minVersion;
16948
+ }));
16949
+ //#endregion
16950
+ //#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/valid.js
16951
+ var require_valid = /* @__PURE__ */ __commonJSMin(((exports, module) => {
16952
+ const Range = require_range();
16953
+ const validRange = (range, options) => {
16954
+ try {
16955
+ return new Range(range, options).range || "*";
16956
+ } catch (er) {
16957
+ return null;
16958
+ }
16959
+ };
16960
+ module.exports = validRange;
16961
+ }));
16962
+ //#endregion
16963
+ //#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/outside.js
16964
+ var require_outside = /* @__PURE__ */ __commonJSMin(((exports, module) => {
16965
+ const SemVer = require_semver$1();
16966
+ const Comparator = require_comparator();
16967
+ const { ANY } = Comparator;
16968
+ const Range = require_range();
16969
+ const satisfies = require_satisfies();
16970
+ const gt = require_gt();
16971
+ const lt = require_lt();
16972
+ const lte = require_lte();
16973
+ const gte = require_gte();
16974
+ const outside = (version, range, hilo, options) => {
16975
+ version = new SemVer(version, options);
16976
+ range = new Range(range, options);
16977
+ let gtfn, ltefn, ltfn, comp, ecomp;
16978
+ switch (hilo) {
16979
+ case ">":
16980
+ gtfn = gt;
16981
+ ltefn = lte;
16982
+ ltfn = lt;
16983
+ comp = ">";
16984
+ ecomp = ">=";
16985
+ break;
16986
+ case "<":
16987
+ gtfn = lt;
16988
+ ltefn = gte;
16989
+ ltfn = gt;
16990
+ comp = "<";
16991
+ ecomp = "<=";
16992
+ break;
16993
+ default: throw new TypeError("Must provide a hilo val of \"<\" or \">\"");
16994
+ }
16995
+ if (satisfies(version, range, options)) return false;
16996
+ for (let i = 0; i < range.set.length; ++i) {
16997
+ const comparators = range.set[i];
16998
+ let high = null;
16999
+ let low = null;
17000
+ comparators.forEach((comparator) => {
17001
+ if (comparator.semver === ANY) comparator = new Comparator(">=0.0.0");
17002
+ high = high || comparator;
17003
+ low = low || comparator;
17004
+ if (gtfn(comparator.semver, high.semver, options)) high = comparator;
17005
+ else if (ltfn(comparator.semver, low.semver, options)) low = comparator;
17006
+ });
17007
+ if (high.operator === comp || high.operator === ecomp) return false;
17008
+ if ((!low.operator || low.operator === comp) && ltefn(version, low.semver)) return false;
17009
+ else if (low.operator === ecomp && ltfn(version, low.semver)) return false;
17010
+ }
17011
+ return true;
17012
+ };
17013
+ module.exports = outside;
17014
+ }));
17015
+ //#endregion
17016
+ //#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/gtr.js
17017
+ var require_gtr = /* @__PURE__ */ __commonJSMin(((exports, module) => {
17018
+ const outside = require_outside();
17019
+ const gtr = (version, range, options) => outside(version, range, ">", options);
17020
+ module.exports = gtr;
17021
+ }));
17022
+ //#endregion
17023
+ //#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/ltr.js
17024
+ var require_ltr = /* @__PURE__ */ __commonJSMin(((exports, module) => {
17025
+ const outside = require_outside();
17026
+ const ltr = (version, range, options) => outside(version, range, "<", options);
17027
+ module.exports = ltr;
17028
+ }));
17029
+ //#endregion
17030
+ //#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/intersects.js
17031
+ var require_intersects = /* @__PURE__ */ __commonJSMin(((exports, module) => {
17032
+ const Range = require_range();
17033
+ const intersects = (r1, r2, options) => {
17034
+ r1 = new Range(r1, options);
17035
+ r2 = new Range(r2, options);
17036
+ return r1.intersects(r2, options);
17037
+ };
17038
+ module.exports = intersects;
17039
+ }));
17040
+ //#endregion
17041
+ //#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/simplify.js
17042
+ var require_simplify = /* @__PURE__ */ __commonJSMin(((exports, module) => {
17043
+ const satisfies = require_satisfies();
17044
+ const compare = require_compare();
17045
+ module.exports = (versions, range, options) => {
17046
+ const set = [];
17047
+ let first = null;
17048
+ let prev = null;
17049
+ const v = versions.sort((a, b) => compare(a, b, options));
17050
+ for (const version of v) if (satisfies(version, range, options)) {
17051
+ prev = version;
17052
+ if (!first) first = version;
17053
+ } else {
17054
+ if (prev) set.push([first, prev]);
17055
+ prev = null;
17056
+ first = null;
17057
+ }
17058
+ if (first) set.push([first, null]);
17059
+ const ranges = [];
17060
+ for (const [min, max] of set) if (min === max) ranges.push(min);
17061
+ else if (!max && min === v[0]) ranges.push("*");
17062
+ else if (!max) ranges.push(`>=${min}`);
17063
+ else if (min === v[0]) ranges.push(`<=${max}`);
17064
+ else ranges.push(`${min} - ${max}`);
17065
+ const simplified = ranges.join(" || ");
17066
+ const original = typeof range.raw === "string" ? range.raw : String(range);
17067
+ return simplified.length < original.length ? simplified : range;
17068
+ };
17069
+ }));
17070
+ //#endregion
17071
+ //#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/subset.js
17072
+ var require_subset = /* @__PURE__ */ __commonJSMin(((exports, module) => {
17073
+ const Range = require_range();
17074
+ const Comparator = require_comparator();
17075
+ const { ANY } = Comparator;
17076
+ const satisfies = require_satisfies();
17077
+ const compare = require_compare();
17078
+ const subset = (sub, dom, options = {}) => {
17079
+ if (sub === dom) return true;
17080
+ sub = new Range(sub, options);
17081
+ dom = new Range(dom, options);
17082
+ let sawNonNull = false;
17083
+ OUTER: for (const simpleSub of sub.set) {
17084
+ for (const simpleDom of dom.set) {
17085
+ const isSub = simpleSubset(simpleSub, simpleDom, options);
17086
+ sawNonNull = sawNonNull || isSub !== null;
17087
+ if (isSub) continue OUTER;
17088
+ }
17089
+ if (sawNonNull) return false;
17090
+ }
17091
+ return true;
17092
+ };
17093
+ const minimumVersionWithPreRelease = [new Comparator(">=0.0.0-0")];
17094
+ const minimumVersion = [new Comparator(">=0.0.0")];
17095
+ const simpleSubset = (sub, dom, options) => {
17096
+ if (sub === dom) return true;
17097
+ if (sub.length === 1 && sub[0].semver === ANY) if (dom.length === 1 && dom[0].semver === ANY) return true;
17098
+ else if (options.includePrerelease) sub = minimumVersionWithPreRelease;
17099
+ else sub = minimumVersion;
17100
+ if (dom.length === 1 && dom[0].semver === ANY) if (options.includePrerelease) return true;
17101
+ else dom = minimumVersion;
17102
+ const eqSet = /* @__PURE__ */ new Set();
17103
+ let gt, lt;
17104
+ for (const c of sub) if (c.operator === ">" || c.operator === ">=") gt = higherGT(gt, c, options);
17105
+ else if (c.operator === "<" || c.operator === "<=") lt = lowerLT(lt, c, options);
17106
+ else eqSet.add(c.semver);
17107
+ if (eqSet.size > 1) return null;
17108
+ let gtltComp;
17109
+ if (gt && lt) {
17110
+ gtltComp = compare(gt.semver, lt.semver, options);
17111
+ if (gtltComp > 0) return null;
17112
+ else if (gtltComp === 0 && (gt.operator !== ">=" || lt.operator !== "<=")) return null;
17113
+ }
17114
+ for (const eq of eqSet) {
17115
+ if (gt && !satisfies(eq, String(gt), options)) return null;
17116
+ if (lt && !satisfies(eq, String(lt), options)) return null;
17117
+ for (const c of dom) if (!satisfies(eq, String(c), options)) return false;
17118
+ return true;
17119
+ }
17120
+ let higher, lower;
17121
+ let hasDomLT, hasDomGT;
17122
+ let needDomLTPre = lt && !options.includePrerelease && lt.semver.prerelease.length ? lt.semver : false;
17123
+ let needDomGTPre = gt && !options.includePrerelease && gt.semver.prerelease.length ? gt.semver : false;
17124
+ if (needDomLTPre && needDomLTPre.prerelease.length === 1 && lt.operator === "<" && needDomLTPre.prerelease[0] === 0) needDomLTPre = false;
17125
+ for (const c of dom) {
17126
+ hasDomGT = hasDomGT || c.operator === ">" || c.operator === ">=";
17127
+ hasDomLT = hasDomLT || c.operator === "<" || c.operator === "<=";
17128
+ if (gt) {
17129
+ if (needDomGTPre) {
17130
+ if (c.semver.prerelease && c.semver.prerelease.length && c.semver.major === needDomGTPre.major && c.semver.minor === needDomGTPre.minor && c.semver.patch === needDomGTPre.patch) needDomGTPre = false;
17131
+ }
17132
+ if (c.operator === ">" || c.operator === ">=") {
17133
+ higher = higherGT(gt, c, options);
17134
+ if (higher === c && higher !== gt) return false;
17135
+ } else if (gt.operator === ">=" && !c.test(gt.semver)) return false;
17136
+ }
17137
+ if (lt) {
17138
+ if (needDomLTPre) {
17139
+ if (c.semver.prerelease && c.semver.prerelease.length && c.semver.major === needDomLTPre.major && c.semver.minor === needDomLTPre.minor && c.semver.patch === needDomLTPre.patch) needDomLTPre = false;
17140
+ }
17141
+ if (c.operator === "<" || c.operator === "<=") {
17142
+ lower = lowerLT(lt, c, options);
17143
+ if (lower === c && lower !== lt) return false;
17144
+ } else if (lt.operator === "<=" && !c.test(lt.semver)) return false;
17145
+ }
17146
+ if (!c.operator && (lt || gt) && gtltComp !== 0) return false;
17147
+ }
17148
+ if (gt && hasDomLT && !lt && gtltComp !== 0) return false;
17149
+ if (lt && hasDomGT && !gt && gtltComp !== 0) return false;
17150
+ if (needDomGTPre || needDomLTPre) return false;
17151
+ return true;
17152
+ };
17153
+ const higherGT = (a, b, options) => {
17154
+ if (!a) return b;
17155
+ const comp = compare(a.semver, b.semver, options);
17156
+ return comp > 0 ? a : comp < 0 ? b : b.operator === ">" && a.operator === ">=" ? b : a;
17157
+ };
17158
+ const lowerLT = (a, b, options) => {
17159
+ if (!a) return b;
17160
+ const comp = compare(a.semver, b.semver, options);
17161
+ return comp < 0 ? a : comp > 0 ? b : b.operator === "<" && a.operator === "<=" ? b : a;
17162
+ };
17163
+ module.exports = subset;
17164
+ }));
17165
+ //#endregion
17166
+ //#region src/update-check/version.ts
17167
+ var import_semver = (/* @__PURE__ */ __commonJSMin(((exports, module) => {
17168
+ const internalRe = require_re();
17169
+ const constants = require_constants();
17170
+ const SemVer = require_semver$1();
17171
+ const identifiers = require_identifiers();
17172
+ module.exports = {
17173
+ parse: require_parse(),
17174
+ valid: require_valid$1(),
17175
+ clean: require_clean(),
17176
+ inc: require_inc(),
17177
+ diff: require_diff(),
17178
+ major: require_major(),
17179
+ minor: require_minor(),
17180
+ patch: require_patch(),
17181
+ prerelease: require_prerelease(),
17182
+ compare: require_compare(),
17183
+ rcompare: require_rcompare(),
17184
+ compareLoose: require_compare_loose(),
17185
+ compareBuild: require_compare_build(),
17186
+ sort: require_sort(),
17187
+ rsort: require_rsort(),
17188
+ gt: require_gt(),
17189
+ lt: require_lt(),
17190
+ eq: require_eq(),
17191
+ neq: require_neq(),
17192
+ gte: require_gte(),
17193
+ lte: require_lte(),
17194
+ cmp: require_cmp(),
17195
+ coerce: require_coerce(),
17196
+ truncate: require_truncate(),
17197
+ Comparator: require_comparator(),
17198
+ Range: require_range(),
17199
+ satisfies: require_satisfies(),
17200
+ toComparators: require_to_comparators(),
17201
+ maxSatisfying: require_max_satisfying(),
17202
+ minSatisfying: require_min_satisfying(),
17203
+ minVersion: require_min_version(),
17204
+ validRange: require_valid(),
17205
+ outside: require_outside(),
17206
+ gtr: require_gtr(),
17207
+ ltr: require_ltr(),
17208
+ intersects: require_intersects(),
17209
+ simplifyRange: require_simplify(),
17210
+ subset: require_subset(),
17211
+ SemVer,
17212
+ re: internalRe.re,
17213
+ src: internalRe.src,
17214
+ tokens: internalRe.t,
17215
+ SEMVER_SPEC_VERSION: constants.SEMVER_SPEC_VERSION,
17216
+ RELEASE_TYPES: constants.RELEASE_TYPES,
17217
+ compareIdentifiers: identifiers.compareIdentifiers,
17218
+ rcompareIdentifiers: identifiers.rcompareIdentifiers
17219
+ };
17220
+ })))();
17221
+ function findAvailableUpdate(runningVersion, metadata) {
17222
+ const normalizedRunning = runningVersion ? (0, import_semver.valid)(runningVersion) : null;
17223
+ if (!normalizedRunning) return {
17224
+ available: false,
17225
+ reason: "invalid-running-version"
17226
+ };
17227
+ const runningPrerelease = (0, import_semver.prerelease)(normalizedRunning);
17228
+ const latestVersion = (runningPrerelease && runningPrerelease.length > 0 ? prereleaseCandidates(normalizedRunning, metadata.versions) : stableCandidates(metadata)).find((candidate) => (0, import_semver.gt)(candidate, normalizedRunning));
17229
+ if (!latestVersion) return {
17230
+ available: false,
17231
+ reason: "no-eligible-version"
17232
+ };
17233
+ return {
17234
+ available: true,
17235
+ runningVersion: normalizedRunning,
17236
+ latestVersion
17237
+ };
17238
+ }
17239
+ function stableCandidates(metadata) {
17240
+ const versions = /* @__PURE__ */ new Set();
17241
+ const latest = (0, import_semver.valid)(metadata.distTags.latest);
17242
+ if (latest && !(0, import_semver.prerelease)(latest)) versions.add(latest);
17243
+ for (const version of metadata.versions) {
17244
+ const normalized = (0, import_semver.valid)(version);
17245
+ if (normalized && !(0, import_semver.prerelease)(normalized)) versions.add(normalized);
17246
+ }
17247
+ return [...versions].sort(import_semver.rcompare);
17248
+ }
17249
+ function prereleaseCandidates(runningVersion, versions) {
17250
+ const running = (0, import_semver.parse)(runningVersion);
17251
+ const runningPrerelease = (0, import_semver.prerelease)(runningVersion);
17252
+ if (!running || !runningPrerelease?.length) return [];
17253
+ const runningIdentifier = String(runningPrerelease[0]);
17254
+ return versions.map((version) => (0, import_semver.valid)(version)).filter((version) => Boolean(version)).filter((version) => {
17255
+ const candidate = (0, import_semver.parse)(version);
17256
+ const candidatePrerelease = (0, import_semver.prerelease)(version);
17257
+ return Boolean(candidate) && candidate.major === running.major && candidate.minor === running.minor && candidate.patch === running.patch && candidatePrerelease?.length !== void 0 && candidatePrerelease.length > 0 && String(candidatePrerelease[0]) === runningIdentifier;
17258
+ }).sort(import_semver.rcompare);
17259
+ }
17260
+ //#endregion
17261
+ //#region src/update-check/notice.ts
17262
+ async function maybePrintUpdateNotice(options) {
17263
+ const now = options.now ?? Date.now();
17264
+ const eligibility = classifyUpdateNoticeEligibility({
17265
+ args: options.args,
17266
+ env: options.env,
17267
+ stderrIsTTY: options.stderrIsTTY
17268
+ });
17269
+ if (!options.version) return;
17270
+ const cache = readUpdateMetadataCache({
17271
+ ...options,
17272
+ now
17273
+ });
17274
+ if (eligibility.eligible && cache?.status === "positive" && cache.usable) {
17275
+ const update = findAvailableUpdate(options.version, cache.metadata);
17276
+ if (update.available && shouldShowUpdateNotice(update.latestVersion, {
17277
+ ...options,
17278
+ now
17279
+ })) try {
17280
+ const line = `Update available: caplets ${update.runningVersion} -> ${update.latestVersion}. Update with your package manager.\n`;
17281
+ if (options.writeErr) options.writeErr(line);
17282
+ else process.stderr.write(line);
17283
+ recordUpdateNoticeShown(update.latestVersion, {
17284
+ ...options,
17285
+ now
17286
+ });
17287
+ } catch {}
17288
+ }
17289
+ if ((eligibility.eligible || eligibility.reason === "stdio") && options.refreshForLater && (!cache || cache.status === "positive" && !cache.fresh || cache.status === "negative" && !cache.fresh)) refreshUpdateMetadata({
17290
+ ...options,
17291
+ now,
17292
+ fetcher: options.fetcher,
17293
+ signal: options.signal
17294
+ }).catch(() => void 0);
17295
+ }
17296
+ //#endregion
15407
17297
  //#region src/cli.ts
15408
17298
  async function runCli(args, io = {}) {
15409
17299
  let observedExitCode = 0;
17300
+ let updateNoticeHandled = false;
15410
17301
  const wrappedIo = {
15411
17302
  ...io,
15412
17303
  setExitCode: (code) => {
@@ -15415,6 +17306,22 @@ async function runCli(args, io = {}) {
15415
17306
  else process.exitCode = code;
15416
17307
  }
15417
17308
  };
17309
+ wrappedIo.maybePrintUpdateNotice = async () => {
17310
+ if (updateNoticeHandled) return;
17311
+ updateNoticeHandled = true;
17312
+ await maybePrintUpdateNotice({
17313
+ args,
17314
+ env: wrappedIo.env,
17315
+ version: wrappedIo.version,
17316
+ fetcher: wrappedIo.fetch,
17317
+ signal: wrappedIo.signal,
17318
+ stderrIsTTY: wrappedIo.stderrIsTTY ?? process.stderr.isTTY === true,
17319
+ writeErr: wrappedIo.writeErr,
17320
+ cacheDir: wrappedIo.updateCheckCacheDir ?? defaultUpdateCheckCacheDir(wrappedIo.env),
17321
+ stateDir: wrappedIo.updateCheckStateDir ?? defaultUpdateCheckStateDir(wrappedIo.env),
17322
+ refreshForLater: shouldRefreshUpdateMetadataForLater(args)
17323
+ }).catch(() => void 0);
17324
+ };
15418
17325
  const program = createProgram(wrappedIo);
15419
17326
  const trackedCommand = telemetryCommandFamilyFromArgs(args);
15420
17327
  const startedAt = Date.now();
@@ -15430,6 +17337,7 @@ async function runCli(args, io = {}) {
15430
17337
  "caplets",
15431
17338
  ...args
15432
17339
  ]);
17340
+ await wrappedIo.maybePrintUpdateNotice();
15433
17341
  if (trackedCommand) await captureCliTelemetry(telemetryContext, {
15434
17342
  debugSink: wrappedIo.telemetryDebugSink,
15435
17343
  dispatcher,
@@ -15461,6 +17369,12 @@ async function runCli(args, io = {}) {
15461
17369
  await dispatcher.shutdown();
15462
17370
  }
15463
17371
  }
17372
+ function shouldRefreshUpdateMetadataForLater(args) {
17373
+ const command = args[0];
17374
+ if (command === cliCommands$1.serve) return true;
17375
+ if (command !== cliCommands$1.attach) return false;
17376
+ return !args.some((arg) => arg === "--once");
17377
+ }
15464
17378
  function normalizeCompletionWords(words) {
15465
17379
  return words.map((word) => word === "__CAPLETS_TRAILING_SPACE__" ? "" : word);
15466
17380
  }
@@ -15468,7 +17382,7 @@ function addJsonOption(command) {
15468
17382
  return command.option("--json", "print JSON output");
15469
17383
  }
15470
17384
  function addDaemonInstallOptions(command) {
15471
- return addJsonOption(command).option("--host <host>", "HTTP bind host").option("--port <port>", "HTTP bind port").option("--path <path>", "HTTP service base path").option("--remote-state-path <path>", "server-owned remote credential state directory").option("--allow-unauthenticated-http", "allow unauthenticated HTTP serving on non-loopback hosts").option("--trust-proxy", "trust X-Forwarded-* headers from a reverse proxy").option("--reset", "rebuild daemon configuration from defaults").option("--env <KEY=VALUE>", "set an environment variable for the service", collectValues, []).option("--unset-env <KEY>", "remove an environment variable from the service", collectValues, []).option("--inherit-env", "run the service through the user's shell environment").option("--no-inherit-env", "disable shell environment inheritance").option("--dry-run", "preview actions without writing files or registering a service").option("--no-validate", "skip temporary service command validation").option("--start", "start the service after install").option("--restart", "restart the service after install").option("--no-restart", "do not restart a running service after updating config");
17385
+ return addJsonOption(command).option("--host <host>", "HTTP bind host").option("--port <port>", "HTTP bind port").option("--path <path>", "HTTP service base path").option("--remote-state-path <path>", "server-owned remote credential state directory").option("--upstream-url <url>", "upstream Caplets runtime URL to compose with this HTTP service").option("--allow-unauthenticated-http", "allow unauthenticated HTTP serving on non-loopback hosts").option("--trust-proxy", "trust X-Forwarded-* headers from a reverse proxy").option("--reset", "rebuild daemon configuration from defaults").option("--env <KEY=VALUE>", "set an environment variable for the service", collectValues, []).option("--unset-env <KEY>", "remove an environment variable from the service", collectValues, []).option("--inherit-env", "run the service through the user's shell environment").option("--no-inherit-env", "disable shell environment inheritance").option("--dry-run", "preview actions without writing files or registering a service").option("--no-validate", "skip temporary service command validation").option("--start", "start the service after install").option("--restart", "restart the service after install").option("--no-restart", "do not restart a running service after updating config");
15472
17386
  }
15473
17387
  function addServeMigrationCommand(parent, name, replacement) {
15474
17388
  parent.command(name, { hidden: true }).allowUnknownOption(true).action(() => {
@@ -15772,6 +17686,7 @@ function daemonInstallOptions(options) {
15772
17686
  ...options.port !== void 0 ? { port: options.port } : {},
15773
17687
  ...options.path !== void 0 ? { path: options.path } : {},
15774
17688
  ...options.remoteStatePath !== void 0 ? { remoteStatePath: options.remoteStatePath } : {},
17689
+ ...options.upstreamUrl !== void 0 ? { upstreamUrl: options.upstreamUrl } : {},
15775
17690
  ...options.allowUnauthenticatedHttp !== void 0 ? { allowUnauthenticatedHttp: options.allowUnauthenticatedHttp } : {},
15776
17691
  ...options.trustProxy !== void 0 ? { trustProxy: options.trustProxy } : {},
15777
17692
  ...options.reset !== void 0 ? { reset: options.reset } : {},
@@ -16269,6 +18184,7 @@ function createProgram(io = {}) {
16269
18184
  ...io,
16270
18185
  env: {
16271
18186
  ...env,
18187
+ CAPLETS_DISABLE_UPDATE_CHECK: "1",
16272
18188
  CAPLETS_TELEMETRY_DEBUG: "1"
16273
18189
  },
16274
18190
  telemetryDebugSink: sink,
@@ -16342,7 +18258,7 @@ function createProgram(io = {}) {
16342
18258
  printTelemetryNotice("serve");
16343
18259
  const resolved = resolveServeOptions(options);
16344
18260
  const configPath = currentConfigPath();
16345
- await (io.serve ?? ((serveOptions) => serveResolvedCaplets(serveOptions, {
18261
+ const runner = io.serve ?? ((serveOptions) => serveResolvedCaplets(serveOptions, {
16346
18262
  ...configPath ? { configPath } : {},
16347
18263
  ...io.authDir ? { authDir: io.authDir } : {},
16348
18264
  telemetryEnv: env,
@@ -16350,7 +18266,9 @@ function createProgram(io = {}) {
16350
18266
  telemetrySurface: "serve",
16351
18267
  telemetryVisibility: "visible",
16352
18268
  telemetryRuntimeMode: runtimeModeForEnv(env)
16353
- }, writeErr)))(resolved);
18269
+ }, writeErr));
18270
+ await io.maybePrintUpdateNotice?.();
18271
+ await runner(resolved);
16354
18272
  });
16355
18273
  const daemonOptions = () => ({
16356
18274
  env,
@@ -16486,6 +18404,7 @@ function createProgram(io = {}) {
16486
18404
  };
16487
18405
  if (!options.once) {
16488
18406
  const resolved = await resolveAttachServeOptions(attachOptions, env);
18407
+ await io.maybePrintUpdateNotice?.();
16489
18408
  await (io.attachServe ?? ((serveOptions) => attachResolvedCaplets(serveOptions, { writeErr })))(resolved);
16490
18409
  return;
16491
18410
  }