@hasna/skills 0.9.11 → 0.9.13

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/sdk/index.js CHANGED
@@ -8209,7 +8209,7 @@ var require_client = __commonJS((exports) => {
8209
8209
  };
8210
8210
  };
8211
8211
  var sleep = (seconds) => {
8212
- return new Promise((resolve17) => setTimeout(resolve17, seconds * 1000));
8212
+ return new Promise((resolve18) => setTimeout(resolve18, seconds * 1000));
8213
8213
  };
8214
8214
  var waiterServiceDefaults = {
8215
8215
  minDelay: 2,
@@ -8338,8 +8338,8 @@ var require_client = __commonJS((exports) => {
8338
8338
  };
8339
8339
  var abortTimeout = (abortSignal) => {
8340
8340
  let onAbort;
8341
- const promise = new Promise((resolve17) => {
8342
- onAbort = () => resolve17({ state: WaiterState.ABORTED });
8341
+ const promise = new Promise((resolve18) => {
8342
+ onAbort = () => resolve18({ state: WaiterState.ABORTED });
8343
8343
  if (typeof abortSignal.addEventListener === "function") {
8344
8344
  abortSignal.addEventListener("abort", onAbort);
8345
8345
  } else {
@@ -9002,8 +9002,8 @@ var require_client = __commonJS((exports) => {
9002
9002
 
9003
9003
  // node_modules/@smithy/core/dist-cjs/submodules/config/index.js
9004
9004
  var require_config = __commonJS((exports) => {
9005
- var { homedir: homedir6 } = __require("os");
9006
- var { sep: sep7, join: join4 } = __require("path");
9005
+ var { homedir: homedir7 } = __require("os");
9006
+ var { sep: sep8, join: join4 } = __require("path");
9007
9007
  var { createHash: createHash19 } = __require("crypto");
9008
9008
  var { readFile: readFile$1 } = __require("fs/promises");
9009
9009
  var { IniSectionType } = require_dist_cjs();
@@ -9143,7 +9143,7 @@ var require_config = __commonJS((exports) => {
9143
9143
  return "DEFAULT";
9144
9144
  };
9145
9145
  var getHomeDir = () => {
9146
- const { HOME, USERPROFILE, HOMEPATH, HOMEDRIVE = `C:${sep7}` } = process.env;
9146
+ const { HOME, USERPROFILE, HOMEPATH, HOMEDRIVE = `C:${sep8}` } = process.env;
9147
9147
  if (HOME)
9148
9148
  return HOME;
9149
9149
  if (USERPROFILE)
@@ -9152,7 +9152,7 @@ var require_config = __commonJS((exports) => {
9152
9152
  return `${HOMEDRIVE}${HOMEPATH}`;
9153
9153
  const homeDirCacheKey = getHomeDirCacheKey();
9154
9154
  if (!homeDirCache[homeDirCacheKey])
9155
- homeDirCache[homeDirCacheKey] = homedir6();
9155
+ homeDirCache[homeDirCacheKey] = homedir7();
9156
9156
  return homeDirCache[homeDirCacheKey];
9157
9157
  };
9158
9158
  var ENV_PROFILE = "AWS_PROFILE";
@@ -9477,7 +9477,7 @@ var require_config = __commonJS((exports) => {
9477
9477
  };
9478
9478
  var imdsRequest = async (options) => {
9479
9479
  const { request: request2 } = __require("http");
9480
- return new Promise((resolve17, reject) => {
9480
+ return new Promise((resolve18, reject) => {
9481
9481
  const req = request2({
9482
9482
  hostname: options.hostname,
9483
9483
  port: options.port,
@@ -9505,7 +9505,7 @@ var require_config = __commonJS((exports) => {
9505
9505
  const chunks = [];
9506
9506
  res.on("data", (chunk) => chunks.push(chunk));
9507
9507
  res.on("end", () => {
9508
- resolve17(Buffer.concat(chunks));
9508
+ resolve18(Buffer.concat(chunks));
9509
9509
  req.destroy();
9510
9510
  });
9511
9511
  });
@@ -10514,7 +10514,7 @@ var require_serde = __commonJS((exports) => {
10514
10514
  var { createHmac: createHmac2, createHash: createHash19, getRandomValues } = __require("crypto");
10515
10515
  var { hasOwn: hasOwn2, HttpResponse } = require_transport();
10516
10516
  exports.hasOwn = hasOwn2;
10517
- var { ReadStream, lstatSync: lstatSync21, fstatSync: fstatSync4 } = __require("fs");
10517
+ var { ReadStream, lstatSync: lstatSync22, fstatSync: fstatSync4 } = __require("fs");
10518
10518
  var { toEndpointV1 } = require_endpoints();
10519
10519
  var { Readable, Writable, PassThrough } = __require("stream");
10520
10520
  var isArrayBuffer = (arg) => typeof ArrayBuffer === "function" && arg instanceof ArrayBuffer || Object.prototype.toString.call(arg) === "[object ArrayBuffer]";
@@ -11280,7 +11280,7 @@ var require_serde = __commonJS((exports) => {
11280
11280
  return body.end + 1 - body.start;
11281
11281
  } else if (body instanceof ReadStream) {
11282
11282
  if (body.path != null) {
11283
- return lstatSync21(body.path).size;
11283
+ return lstatSync22(body.path).size;
11284
11284
  } else if (typeof body.fd === "number") {
11285
11285
  return fstatSync4(body.fd).size;
11286
11286
  }
@@ -11861,7 +11861,7 @@ ${value}\r
11861
11861
  if (isReadableStream(stream)) {
11862
11862
  return headStream$1(stream, bytes);
11863
11863
  }
11864
- return new Promise((resolve17, reject) => {
11864
+ return new Promise((resolve18, reject) => {
11865
11865
  const collector = new Collector$1;
11866
11866
  collector.limit = bytes;
11867
11867
  stream.pipe(collector);
@@ -11872,7 +11872,7 @@ ${value}\r
11872
11872
  collector.on("error", reject);
11873
11873
  collector.on("finish", function() {
11874
11874
  const bytes2 = concatBytes(this.buffers);
11875
- resolve17(bytes2);
11875
+ resolve18(bytes2);
11876
11876
  });
11877
11877
  });
11878
11878
  };
@@ -11986,7 +11986,7 @@ ${value}\r
11986
11986
  if (isReadableStream(stream)) {
11987
11987
  return collectReadableStream(stream);
11988
11988
  }
11989
- return new Promise((resolve17, reject) => {
11989
+ return new Promise((resolve18, reject) => {
11990
11990
  const collector = new Collector;
11991
11991
  const nodeStream = stream;
11992
11992
  nodeStream.pipe(collector);
@@ -11997,7 +11997,7 @@ ${value}\r
11997
11997
  collector.on("error", reject);
11998
11998
  collector.on("finish", function() {
11999
11999
  const bytes = concatBytes(this.bufferedBytes);
12000
- resolve17(bytes);
12000
+ resolve18(bytes);
12001
12001
  });
12002
12002
  });
12003
12003
  };
@@ -12189,7 +12189,7 @@ var require_checksum = __commonJS((exports) => {
12189
12189
  callback();
12190
12190
  }
12191
12191
  }
12192
- var fileStreamHasher = (hashCtor, fileStream) => new Promise((resolve17, reject) => {
12192
+ var fileStreamHasher = (hashCtor, fileStream) => new Promise((resolve18, reject) => {
12193
12193
  if (!isReadStream(fileStream)) {
12194
12194
  reject(new Error("Unable to calculate hash for non-file streams."));
12195
12195
  return;
@@ -12207,7 +12207,7 @@ var require_checksum = __commonJS((exports) => {
12207
12207
  });
12208
12208
  hashCalculator.on("error", reject);
12209
12209
  hashCalculator.on("finish", function() {
12210
- hash2.digest().then(resolve17).catch(reject);
12210
+ hash2.digest().then(resolve18).catch(reject);
12211
12211
  });
12212
12212
  });
12213
12213
  var isReadStream = (stream) => typeof stream.path === "string";
@@ -12218,14 +12218,14 @@ var require_checksum = __commonJS((exports) => {
12218
12218
  const hash2 = new hashCtor;
12219
12219
  const hashCalculator = new HashCalculator(hash2);
12220
12220
  readableStream.pipe(hashCalculator);
12221
- return new Promise((resolve17, reject) => {
12221
+ return new Promise((resolve18, reject) => {
12222
12222
  readableStream.on("error", (err) => {
12223
12223
  hashCalculator.end();
12224
12224
  reject(err);
12225
12225
  });
12226
12226
  hashCalculator.on("error", reject);
12227
12227
  hashCalculator.on("finish", () => {
12228
- hash2.digest().then(resolve17).catch(reject);
12228
+ hash2.digest().then(resolve18).catch(reject);
12229
12229
  });
12230
12230
  });
12231
12231
  };
@@ -13334,7 +13334,7 @@ var require_event_streams = __commonJS((exports) => {
13334
13334
  streamEnded = true;
13335
13335
  });
13336
13336
  while (!generationEnded) {
13337
- const value = await new Promise((resolve17) => setTimeout(() => resolve17(records.shift()), 0));
13337
+ const value = await new Promise((resolve18) => setTimeout(() => resolve18(records.shift()), 0));
13338
13338
  if (value) {
13339
13339
  yield value;
13340
13340
  }
@@ -14852,7 +14852,7 @@ var require_retry = __commonJS((exports) => {
14852
14852
  }
14853
14853
  };
14854
14854
  }
14855
- var cooldown = (ms) => new Promise((resolve17) => setTimeout(resolve17, ms));
14855
+ var cooldown = (ms) => new Promise((resolve18) => setTimeout(resolve18, ms));
14856
14856
  var isRetryStrategyV2 = (retryStrategy) => typeof retryStrategy.acquireInitialRetryToken !== "undefined" && typeof retryStrategy.refreshRetryTokenForRetry !== "undefined" && typeof retryStrategy.recordSuccess !== "undefined";
14857
14857
  var getRetryErrorInfo = (error, logger) => {
14858
14858
  const errorInfo = {
@@ -14951,7 +14951,7 @@ var require_retry = __commonJS((exports) => {
14951
14951
  this.refillTokenBucket();
14952
14952
  while (amount > this.availableTokens) {
14953
14953
  const delay = (amount - this.availableTokens) / this.fillRate * 1000;
14954
- await new Promise((resolve17) => DefaultRateLimiter.setTimeoutFn(resolve17, delay));
14954
+ await new Promise((resolve18) => DefaultRateLimiter.setTimeoutFn(resolve18, delay));
14955
14955
  this.refillTokenBucket();
14956
14956
  }
14957
14957
  this.availableTokens = this.availableTokens - amount;
@@ -15293,7 +15293,7 @@ var require_retry = __commonJS((exports) => {
15293
15293
  const delayFromResponse = getDelayFromRetryAfterHeader(err.$response);
15294
15294
  const delay = Math.max(delayFromResponse || 0, delayFromDecider);
15295
15295
  totalDelay += delay;
15296
- await new Promise((resolve17) => setTimeout(resolve17, delay));
15296
+ await new Promise((resolve18) => setTimeout(resolve18, delay));
15297
15297
  continue;
15298
15298
  }
15299
15299
  if (!err.$metadata) {
@@ -24586,7 +24586,7 @@ var require_httpAuthSchemes = __commonJS((exports) => {
24586
24586
  });
24587
24587
 
24588
24588
  // node_modules/@aws-sdk/credential-provider-env/dist-es/fromEnv.js
24589
- var import_client8, import_config8, ENV_KEY = "AWS_ACCESS_KEY_ID", ENV_SECRET = "AWS_SECRET_ACCESS_KEY", ENV_SESSION = "AWS_SESSION_TOKEN", ENV_EXPIRATION = "AWS_CREDENTIAL_EXPIRATION", ENV_CREDENTIAL_SCOPE = "AWS_CREDENTIAL_SCOPE", ENV_ACCOUNT_ID = "AWS_ACCOUNT_ID", fromEnv = (init) => async () => {
24589
+ var import_client8, import_config9, ENV_KEY = "AWS_ACCESS_KEY_ID", ENV_SECRET = "AWS_SECRET_ACCESS_KEY", ENV_SESSION = "AWS_SESSION_TOKEN", ENV_EXPIRATION = "AWS_CREDENTIAL_EXPIRATION", ENV_CREDENTIAL_SCOPE = "AWS_CREDENTIAL_SCOPE", ENV_ACCOUNT_ID = "AWS_ACCOUNT_ID", fromEnv = (init) => async () => {
24590
24590
  init?.logger?.debug("@aws-sdk/credential-provider-env - fromEnv");
24591
24591
  const accessKeyId = process.env[ENV_KEY];
24592
24592
  const secretAccessKey = process.env[ENV_SECRET];
@@ -24606,11 +24606,11 @@ var import_client8, import_config8, ENV_KEY = "AWS_ACCESS_KEY_ID", ENV_SECRET =
24606
24606
  import_client8.setCredentialFeature(credentials, "CREDENTIALS_ENV_VARS", "g");
24607
24607
  return credentials;
24608
24608
  }
24609
- throw new import_config8.CredentialsProviderError("Unable to find environment variable credentials.", { logger: init?.logger });
24609
+ throw new import_config9.CredentialsProviderError("Unable to find environment variable credentials.", { logger: init?.logger });
24610
24610
  };
24611
24611
  var init_fromEnv = __esm(() => {
24612
24612
  import_client8 = __toESM(require_client2(), 1);
24613
- import_config8 = __toESM(require_config(), 1);
24613
+ import_config9 = __toESM(require_config(), 1);
24614
24614
  });
24615
24615
 
24616
24616
  // node_modules/@aws-sdk/credential-provider-env/dist-es/index.js
@@ -24646,24 +24646,24 @@ var init_node_http = () => {};
24646
24646
 
24647
24647
  // node_modules/@smithy/credential-provider-imds/dist-es/remoteProvider/httpRequest.js
24648
24648
  function httpRequest(options) {
24649
- return new Promise((resolve17, reject) => {
24649
+ return new Promise((resolve18, reject) => {
24650
24650
  const req = node_http.request({
24651
24651
  method: "GET",
24652
24652
  ...options,
24653
24653
  hostname: options.hostname?.replace(/^\[(.+)\]$/, "$1")
24654
24654
  });
24655
24655
  req.on("error", (err) => {
24656
- reject(Object.assign(new import_config9.ProviderError("Unable to connect to instance metadata service"), err));
24656
+ reject(Object.assign(new import_config10.ProviderError("Unable to connect to instance metadata service"), err));
24657
24657
  req.destroy();
24658
24658
  });
24659
24659
  req.on("timeout", () => {
24660
- reject(new import_config9.ProviderError("TimeoutError from instance metadata service"));
24660
+ reject(new import_config10.ProviderError("TimeoutError from instance metadata service"));
24661
24661
  req.destroy();
24662
24662
  });
24663
24663
  req.on("response", (res) => {
24664
24664
  const { statusCode = 400 } = res;
24665
24665
  if (statusCode < 200 || 300 <= statusCode) {
24666
- reject(Object.assign(new import_config9.ProviderError("Error response received from instance metadata service"), { statusCode }));
24666
+ reject(Object.assign(new import_config10.ProviderError("Error response received from instance metadata service"), { statusCode }));
24667
24667
  req.destroy();
24668
24668
  }
24669
24669
  const chunks = [];
@@ -24671,17 +24671,17 @@ function httpRequest(options) {
24671
24671
  chunks.push(chunk);
24672
24672
  });
24673
24673
  res.on("end", () => {
24674
- resolve17(Buffer.concat(chunks));
24674
+ resolve18(Buffer.concat(chunks));
24675
24675
  req.destroy();
24676
24676
  });
24677
24677
  });
24678
24678
  req.end();
24679
24679
  });
24680
24680
  }
24681
- var import_config9;
24681
+ var import_config10;
24682
24682
  var init_httpRequest = __esm(() => {
24683
24683
  init_node_http();
24684
- import_config9 = __toESM(require_config(), 1);
24684
+ import_config10 = __toESM(require_config(), 1);
24685
24685
  });
24686
24686
 
24687
24687
  // node_modules/@smithy/credential-provider-imds/dist-es/remoteProvider/retry.js
@@ -24694,13 +24694,13 @@ var retry = (toRetry, maxRetries) => {
24694
24694
  };
24695
24695
 
24696
24696
  // node_modules/@smithy/credential-provider-imds/dist-es/fromContainerMetadata.js
24697
- var import_config10, ENV_CMDS_FULL_URI = "AWS_CONTAINER_CREDENTIALS_FULL_URI", ENV_CMDS_RELATIVE_URI = "AWS_CONTAINER_CREDENTIALS_RELATIVE_URI", ENV_CMDS_AUTH_TOKEN = "AWS_CONTAINER_AUTHORIZATION_TOKEN", fromContainerMetadata = (init = {}) => {
24697
+ var import_config11, ENV_CMDS_FULL_URI = "AWS_CONTAINER_CREDENTIALS_FULL_URI", ENV_CMDS_RELATIVE_URI = "AWS_CONTAINER_CREDENTIALS_RELATIVE_URI", ENV_CMDS_AUTH_TOKEN = "AWS_CONTAINER_AUTHORIZATION_TOKEN", fromContainerMetadata = (init = {}) => {
24698
24698
  const { timeout, maxRetries } = providerConfigFromInit(init);
24699
24699
  return () => retry(async () => {
24700
24700
  const requestOptions = await getCmdsUri({ logger: init.logger });
24701
24701
  const credsResponse = JSON.parse(await requestFromEcsImds(timeout, requestOptions));
24702
24702
  if (!isImdsCredentials(credsResponse)) {
24703
- throw new import_config10.CredentialsProviderError("Invalid response received from instance metadata service.", {
24703
+ throw new import_config11.CredentialsProviderError("Invalid response received from instance metadata service.", {
24704
24704
  logger: init.logger
24705
24705
  });
24706
24706
  }
@@ -24730,16 +24730,16 @@ var import_config10, ENV_CMDS_FULL_URI = "AWS_CONTAINER_CREDENTIALS_FULL_URI", E
24730
24730
  try {
24731
24731
  parsed = new URL(process.env[ENV_CMDS_FULL_URI]);
24732
24732
  } catch {
24733
- throw new import_config10.CredentialsProviderError(`${process.env[ENV_CMDS_FULL_URI]} is not a valid container metadata service URL`, { tryNextLink: false, logger });
24733
+ throw new import_config11.CredentialsProviderError(`${process.env[ENV_CMDS_FULL_URI]} is not a valid container metadata service URL`, { tryNextLink: false, logger });
24734
24734
  }
24735
24735
  if (!parsed.hostname || !GREENGRASS_HOSTS.has(parsed.hostname)) {
24736
- throw new import_config10.CredentialsProviderError(`${parsed.hostname} is not a valid container metadata service hostname`, {
24736
+ throw new import_config11.CredentialsProviderError(`${parsed.hostname} is not a valid container metadata service hostname`, {
24737
24737
  tryNextLink: false,
24738
24738
  logger
24739
24739
  });
24740
24740
  }
24741
24741
  if (!parsed.protocol || !GREENGRASS_PROTOCOLS.has(parsed.protocol)) {
24742
- throw new import_config10.CredentialsProviderError(`${parsed.protocol} is not a valid container metadata service protocol`, {
24742
+ throw new import_config11.CredentialsProviderError(`${parsed.protocol} is not a valid container metadata service protocol`, {
24743
24743
  tryNextLink: false,
24744
24744
  logger
24745
24745
  });
@@ -24751,23 +24751,23 @@ var import_config10, ENV_CMDS_FULL_URI = "AWS_CONTAINER_CREDENTIALS_FULL_URI", E
24751
24751
  port: parsed.port ? parseInt(parsed.port, 10) : undefined
24752
24752
  };
24753
24753
  }
24754
- throw new import_config10.CredentialsProviderError("The container metadata credential provider cannot be used unless" + ` the ${ENV_CMDS_RELATIVE_URI} or ${ENV_CMDS_FULL_URI} environment` + " variable is set", {
24754
+ throw new import_config11.CredentialsProviderError("The container metadata credential provider cannot be used unless" + ` the ${ENV_CMDS_RELATIVE_URI} or ${ENV_CMDS_FULL_URI} environment` + " variable is set", {
24755
24755
  tryNextLink: false,
24756
24756
  logger
24757
24757
  });
24758
24758
  };
24759
24759
  var init_fromContainerMetadata = __esm(() => {
24760
24760
  init_httpRequest();
24761
- import_config10 = __toESM(require_config(), 1);
24761
+ import_config11 = __toESM(require_config(), 1);
24762
24762
  GREENGRASS_HOSTS = new Set(["localhost", "127.0.0.1"]);
24763
24763
  GREENGRASS_PROTOCOLS = new Set(["http:", "https:"]);
24764
24764
  });
24765
24765
 
24766
24766
  // node_modules/@smithy/credential-provider-imds/dist-es/error/InstanceMetadataV1FallbackError.js
24767
- var import_config11, InstanceMetadataV1FallbackError;
24767
+ var import_config12, InstanceMetadataV1FallbackError;
24768
24768
  var init_InstanceMetadataV1FallbackError = __esm(() => {
24769
- import_config11 = __toESM(require_config(), 1);
24770
- InstanceMetadataV1FallbackError = class InstanceMetadataV1FallbackError extends import_config11.CredentialsProviderError {
24769
+ import_config12 = __toESM(require_config(), 1);
24770
+ InstanceMetadataV1FallbackError = class InstanceMetadataV1FallbackError extends import_config12.CredentialsProviderError {
24771
24771
  tryNextLink;
24772
24772
  name = "InstanceMetadataV1FallbackError";
24773
24773
  constructor(message, tryNextLink = true) {
@@ -24818,8 +24818,8 @@ var init_EndpointModeConfigOptions = __esm(() => {
24818
24818
  });
24819
24819
 
24820
24820
  // node_modules/@smithy/credential-provider-imds/dist-es/utils/getInstanceMetadataEndpoint.js
24821
- var import_config12, import_protocols, getInstanceMetadataEndpoint = async () => import_protocols.parseUrl(await getFromEndpointConfig() || await getFromEndpointModeConfig()), getFromEndpointConfig = async () => import_config12.loadConfig(ENDPOINT_CONFIG_OPTIONS)(), getFromEndpointModeConfig = async () => {
24822
- const endpointMode = await import_config12.loadConfig(ENDPOINT_MODE_CONFIG_OPTIONS)();
24821
+ var import_config13, import_protocols, getInstanceMetadataEndpoint = async () => import_protocols.parseUrl(await getFromEndpointConfig() || await getFromEndpointModeConfig()), getFromEndpointConfig = async () => import_config13.loadConfig(ENDPOINT_CONFIG_OPTIONS)(), getFromEndpointModeConfig = async () => {
24822
+ const endpointMode = await import_config13.loadConfig(ENDPOINT_MODE_CONFIG_OPTIONS)();
24823
24823
  switch (endpointMode) {
24824
24824
  case EndpointMode.IPv4:
24825
24825
  return Endpoint.IPv4;
@@ -24834,7 +24834,7 @@ var init_getInstanceMetadataEndpoint = __esm(() => {
24834
24834
  init_EndpointConfigOptions();
24835
24835
  init_EndpointMode();
24836
24836
  init_EndpointModeConfigOptions();
24837
- import_config12 = __toESM(require_config(), 1);
24837
+ import_config13 = __toESM(require_config(), 1);
24838
24838
  import_protocols = __toESM(require_protocols(), 1);
24839
24839
  });
24840
24840
 
@@ -24884,7 +24884,7 @@ var init_staticStabilityProvider = __esm(() => {
24884
24884
  });
24885
24885
 
24886
24886
  // node_modules/@smithy/credential-provider-imds/dist-es/fromInstanceMetadata.js
24887
- var import_config13, IMDS_PATH = "/latest/meta-data/iam/security-credentials/", IMDS_TOKEN_PATH = "/latest/api/token", AWS_EC2_METADATA_V1_DISABLED = "AWS_EC2_METADATA_V1_DISABLED", PROFILE_AWS_EC2_METADATA_V1_DISABLED = "ec2_metadata_v1_disabled", X_AWS_EC2_METADATA_TOKEN = "x-aws-ec2-metadata-token", fromInstanceMetadata = (init = {}) => staticStabilityProvider(getInstanceMetadataProvider(init), { logger: init.logger }), getInstanceMetadataProvider = (init = {}) => {
24887
+ var import_config14, IMDS_PATH = "/latest/meta-data/iam/security-credentials/", IMDS_TOKEN_PATH = "/latest/api/token", AWS_EC2_METADATA_V1_DISABLED = "AWS_EC2_METADATA_V1_DISABLED", PROFILE_AWS_EC2_METADATA_V1_DISABLED = "ec2_metadata_v1_disabled", X_AWS_EC2_METADATA_TOKEN = "x-aws-ec2-metadata-token", fromInstanceMetadata = (init = {}) => staticStabilityProvider(getInstanceMetadataProvider(init), { logger: init.logger }), getInstanceMetadataProvider = (init = {}) => {
24888
24888
  let disableFetchToken = false;
24889
24889
  const { logger, profile } = init;
24890
24890
  const { timeout, maxRetries } = providerConfigFromInit(init);
@@ -24893,12 +24893,12 @@ var import_config13, IMDS_PATH = "/latest/meta-data/iam/security-credentials/",
24893
24893
  if (isImdsV1Fallback) {
24894
24894
  let fallbackBlockedFromProfile = false;
24895
24895
  let fallbackBlockedFromProcessEnv = false;
24896
- const configValue = await import_config13.loadConfig({
24896
+ const configValue = await import_config14.loadConfig({
24897
24897
  environmentVariableSelector: (env) => {
24898
24898
  const envValue = env[AWS_EC2_METADATA_V1_DISABLED];
24899
24899
  fallbackBlockedFromProcessEnv = !!envValue && envValue !== "false";
24900
24900
  if (envValue === undefined) {
24901
- throw new import_config13.CredentialsProviderError(`${AWS_EC2_METADATA_V1_DISABLED} not set in env, checking config file next.`, { logger: init.logger });
24901
+ throw new import_config14.CredentialsProviderError(`${AWS_EC2_METADATA_V1_DISABLED} not set in env, checking config file next.`, { logger: init.logger });
24902
24902
  }
24903
24903
  return fallbackBlockedFromProcessEnv;
24904
24904
  },
@@ -24989,7 +24989,7 @@ var import_config13, IMDS_PATH = "/latest/meta-data/iam/security-credentials/",
24989
24989
  path: IMDS_PATH + profile
24990
24990
  })).toString());
24991
24991
  if (!isImdsCredentials(credentialsResponse)) {
24992
- throw new import_config13.CredentialsProviderError("Invalid response received from instance metadata service.", {
24992
+ throw new import_config14.CredentialsProviderError("Invalid response received from instance metadata service.", {
24993
24993
  logger: init.logger
24994
24994
  });
24995
24995
  }
@@ -25000,7 +25000,7 @@ var init_fromInstanceMetadata = __esm(() => {
25000
25000
  init_httpRequest();
25001
25001
  init_getInstanceMetadataEndpoint();
25002
25002
  init_staticStabilityProvider();
25003
- import_config13 = __toESM(require_config(), 1);
25003
+ import_config14 = __toESM(require_config(), 1);
25004
25004
  });
25005
25005
 
25006
25006
  // node_modules/@smithy/credential-provider-imds/dist-es/index.js
@@ -25168,21 +25168,21 @@ var require_dist_cjs6 = __commonJS((exports) => {
25168
25168
  let sendBody = true;
25169
25169
  if (!externalAgent && expect === "100-continue") {
25170
25170
  sendBody = await Promise.race([
25171
- new Promise((resolve17) => {
25172
- timeoutId = Number(timing.setTimeout(() => resolve17(true), Math.max(MIN_WAIT_TIME, maxContinueTimeoutMs)));
25171
+ new Promise((resolve18) => {
25172
+ timeoutId = Number(timing.setTimeout(() => resolve18(true), Math.max(MIN_WAIT_TIME, maxContinueTimeoutMs)));
25173
25173
  }),
25174
- new Promise((resolve17) => {
25174
+ new Promise((resolve18) => {
25175
25175
  httpRequest2.on("continue", () => {
25176
25176
  timing.clearTimeout(timeoutId);
25177
- resolve17(true);
25177
+ resolve18(true);
25178
25178
  });
25179
25179
  httpRequest2.on("response", () => {
25180
25180
  timing.clearTimeout(timeoutId);
25181
- resolve17(false);
25181
+ resolve18(false);
25182
25182
  });
25183
25183
  httpRequest2.on("error", () => {
25184
25184
  timing.clearTimeout(timeoutId);
25185
- resolve17(false);
25185
+ resolve18(false);
25186
25186
  });
25187
25187
  })
25188
25188
  ]);
@@ -25259,13 +25259,13 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
25259
25259
  return socketWarningTimestamp;
25260
25260
  }
25261
25261
  constructor(options) {
25262
- this.configProvider = new Promise((resolve17, reject) => {
25262
+ this.configProvider = new Promise((resolve18, reject) => {
25263
25263
  if (typeof options === "function") {
25264
25264
  options().then((_options) => {
25265
- resolve17(this.resolveDefaultConfig(_options));
25265
+ resolve18(this.resolveDefaultConfig(_options));
25266
25266
  }).catch(reject);
25267
25267
  } else {
25268
- resolve17(this.resolveDefaultConfig(options));
25268
+ resolve18(this.resolveDefaultConfig(options));
25269
25269
  }
25270
25270
  });
25271
25271
  }
@@ -25297,7 +25297,7 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
25297
25297
  timing.clearTimeout(socketTimeoutId);
25298
25298
  timing.clearTimeout(keepAliveTimeoutId);
25299
25299
  };
25300
- const resolve17 = async (arg) => {
25300
+ const resolve18 = async (arg) => {
25301
25301
  await writeRequestBodyPromise;
25302
25302
  clearTimeouts();
25303
25303
  _resolve(arg);
@@ -25361,7 +25361,7 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
25361
25361
  headers: getTransformedHeaders(res.headers),
25362
25362
  body: res
25363
25363
  });
25364
- resolve17({ response: httpResponse });
25364
+ resolve18({ response: httpResponse });
25365
25365
  });
25366
25366
  req.on("error", (err) => {
25367
25367
  if (NODEJS_TIMEOUT_ERROR_CODES.includes(err.code)) {
@@ -25693,13 +25693,13 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
25693
25693
  return new NodeHttp2Handler(instanceOrOptions);
25694
25694
  }
25695
25695
  constructor(options) {
25696
- this.configProvider = new Promise((resolve17, reject) => {
25696
+ this.configProvider = new Promise((resolve18, reject) => {
25697
25697
  if (typeof options === "function") {
25698
25698
  options().then((opts) => {
25699
- resolve17(opts || {});
25699
+ resolve18(opts || {});
25700
25700
  }).catch(reject);
25701
25701
  } else {
25702
- resolve17(options || {});
25702
+ resolve18(options || {});
25703
25703
  }
25704
25704
  });
25705
25705
  }
@@ -25724,7 +25724,7 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
25724
25724
  return new Promise((_resolve, _reject) => {
25725
25725
  let fulfilled = false;
25726
25726
  let writeRequestBodyPromise = undefined;
25727
- const resolve17 = async (arg) => {
25727
+ const resolve18 = async (arg) => {
25728
25728
  await writeRequestBodyPromise;
25729
25729
  _resolve(arg);
25730
25730
  };
@@ -25809,7 +25809,7 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
25809
25809
  body: clientHttp2Stream
25810
25810
  });
25811
25811
  fulfilled = true;
25812
- resolve17({ response: httpResponse });
25812
+ resolve18({ response: httpResponse });
25813
25813
  if (useIsolatedSession) {
25814
25814
  session.close();
25815
25815
  clientHttp2Stream.on("end", () => {
@@ -25853,7 +25853,7 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
25853
25853
  });
25854
25854
 
25855
25855
  // node_modules/@aws-sdk/credential-provider-http/dist-es/fromHttp/checkUrl.js
25856
- var import_config14, ECS_CONTAINER_HOST = "169.254.170.2", EKS_CONTAINER_HOST_IPv4 = "169.254.170.23", EKS_CONTAINER_HOST_IPv6 = "[fd00:ec2::23]", checkUrl = (url, logger) => {
25856
+ var import_config15, ECS_CONTAINER_HOST = "169.254.170.2", EKS_CONTAINER_HOST_IPv4 = "169.254.170.23", EKS_CONTAINER_HOST_IPv6 = "[fd00:ec2::23]", checkUrl = (url, logger) => {
25857
25857
  if (url.protocol === "https:") {
25858
25858
  return;
25859
25859
  }
@@ -25877,13 +25877,13 @@ var import_config14, ECS_CONTAINER_HOST = "169.254.170.2", EKS_CONTAINER_HOST_IP
25877
25877
  return;
25878
25878
  }
25879
25879
  }
25880
- throw new import_config14.CredentialsProviderError(`URL not accepted. It must either be HTTPS or match one of the following:
25880
+ throw new import_config15.CredentialsProviderError(`URL not accepted. It must either be HTTPS or match one of the following:
25881
25881
  - loopback CIDR 127.0.0.0/8 or [::1/128]
25882
25882
  - ECS container host 169.254.170.2
25883
25883
  - EKS container host 169.254.170.23 or [fd00:ec2::23]`, { logger });
25884
25884
  };
25885
25885
  var init_checkUrl = __esm(() => {
25886
- import_config14 = __toESM(require_config(), 1);
25886
+ import_config15 = __toESM(require_config(), 1);
25887
25887
  });
25888
25888
 
25889
25889
  // node_modules/@aws-sdk/credential-provider-http/dist-es/fromHttp/requestHelpers.js
@@ -25906,7 +25906,7 @@ async function getCredentials(response, logger) {
25906
25906
  if (response.statusCode === 200) {
25907
25907
  const parsed = JSON.parse(str);
25908
25908
  if (typeof parsed.AccessKeyId !== "string" || typeof parsed.SecretAccessKey !== "string" || typeof parsed.Token !== "string" || typeof parsed.Expiration !== "string") {
25909
- throw new import_config15.CredentialsProviderError("HTTP credential provider response not of the required format, an object matching: " + "{ AccessKeyId: string, SecretAccessKey: string, Token: string, Expiration: string(rfc3339) }", { logger });
25909
+ throw new import_config16.CredentialsProviderError("HTTP credential provider response not of the required format, an object matching: " + "{ AccessKeyId: string, SecretAccessKey: string, Token: string, Expiration: string(rfc3339) }", { logger });
25910
25910
  }
25911
25911
  return {
25912
25912
  accessKeyId: parsed.AccessKeyId,
@@ -25920,16 +25920,16 @@ async function getCredentials(response, logger) {
25920
25920
  try {
25921
25921
  parsedBody = JSON.parse(str);
25922
25922
  } catch (e3) {}
25923
- throw Object.assign(new import_config15.CredentialsProviderError(`Server responded with status: ${response.statusCode}`, { logger }), {
25923
+ throw Object.assign(new import_config16.CredentialsProviderError(`Server responded with status: ${response.statusCode}`, { logger }), {
25924
25924
  Code: parsedBody.Code,
25925
25925
  Message: parsedBody.Message
25926
25926
  });
25927
25927
  }
25928
- throw new import_config15.CredentialsProviderError(`Server responded with status: ${response.statusCode}`, { logger });
25928
+ throw new import_config16.CredentialsProviderError(`Server responded with status: ${response.statusCode}`, { logger });
25929
25929
  }
25930
- var import_config15, import_protocols2, import_serde, import_serde2;
25930
+ var import_config16, import_protocols2, import_serde, import_serde2;
25931
25931
  var init_requestHelpers = __esm(() => {
25932
- import_config15 = __toESM(require_config(), 1);
25932
+ import_config16 = __toESM(require_config(), 1);
25933
25933
  import_protocols2 = __toESM(require_protocols(), 1);
25934
25934
  import_serde = __toESM(require_serde(), 1);
25935
25935
  import_serde2 = __toESM(require_serde(), 1);
@@ -25942,7 +25942,7 @@ var retryWrapper = (toRetry, maxRetries, delayMs) => {
25942
25942
  try {
25943
25943
  return await toRetry();
25944
25944
  } catch (e3) {
25945
- await new Promise((resolve17) => setTimeout(resolve17, delayMs));
25945
+ await new Promise((resolve18) => setTimeout(resolve18, delayMs));
25946
25946
  }
25947
25947
  }
25948
25948
  return await toRetry();
@@ -25951,7 +25951,7 @@ var retryWrapper = (toRetry, maxRetries, delayMs) => {
25951
25951
 
25952
25952
  // node_modules/@aws-sdk/credential-provider-http/dist-es/fromHttp/fromHttp.js
25953
25953
  import fs from "fs/promises";
25954
- var import_client9, import_config16, import_node_http_handler, AWS_CONTAINER_CREDENTIALS_RELATIVE_URI = "AWS_CONTAINER_CREDENTIALS_RELATIVE_URI", DEFAULT_LINK_LOCAL_HOST = "http://169.254.170.2", AWS_CONTAINER_CREDENTIALS_FULL_URI = "AWS_CONTAINER_CREDENTIALS_FULL_URI", AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE = "AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE", AWS_CONTAINER_AUTHORIZATION_TOKEN = "AWS_CONTAINER_AUTHORIZATION_TOKEN", fromHttp = (options = {}) => {
25954
+ var import_client9, import_config17, import_node_http_handler, AWS_CONTAINER_CREDENTIALS_RELATIVE_URI = "AWS_CONTAINER_CREDENTIALS_RELATIVE_URI", DEFAULT_LINK_LOCAL_HOST = "http://169.254.170.2", AWS_CONTAINER_CREDENTIALS_FULL_URI = "AWS_CONTAINER_CREDENTIALS_FULL_URI", AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE = "AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE", AWS_CONTAINER_AUTHORIZATION_TOKEN = "AWS_CONTAINER_AUTHORIZATION_TOKEN", fromHttp = (options = {}) => {
25955
25955
  options.logger?.debug("@aws-sdk/credential-provider-http - fromHttp");
25956
25956
  let host;
25957
25957
  const relative6 = options.awsContainerCredentialsRelativeUri ?? process.env[AWS_CONTAINER_CREDENTIALS_RELATIVE_URI];
@@ -25972,7 +25972,7 @@ var import_client9, import_config16, import_node_http_handler, AWS_CONTAINER_CRE
25972
25972
  } else if (full) {
25973
25973
  host = full;
25974
25974
  } else {
25975
- throw new import_config16.CredentialsProviderError(`No HTTP credential provider host provided.
25975
+ throw new import_config17.CredentialsProviderError(`No HTTP credential provider host provided.
25976
25976
  Set AWS_CONTAINER_CREDENTIALS_FULL_URI or AWS_CONTAINER_CREDENTIALS_RELATIVE_URI.`, { logger: options.logger });
25977
25977
  }
25978
25978
  const url = new URL(host);
@@ -25990,7 +25990,7 @@ Set AWS_CONTAINER_CREDENTIALS_FULL_URI or AWS_CONTAINER_CREDENTIALS_RELATIVE_URI
25990
25990
  const result = await requestHandler.handle(request2, { requestTimeout });
25991
25991
  return getCredentials(result.response).then((creds) => import_client9.setCredentialFeature(creds, "CREDENTIALS_HTTP", "z"));
25992
25992
  } catch (e3) {
25993
- throw new import_config16.CredentialsProviderError(String(e3), { logger: options.logger });
25993
+ throw new import_config17.CredentialsProviderError(String(e3), { logger: options.logger });
25994
25994
  }
25995
25995
  }, options.maxRetries ?? 3, options.timeout ?? 1000);
25996
25996
  return async () => {
@@ -26003,7 +26003,7 @@ Set AWS_CONTAINER_CREDENTIALS_FULL_URI or AWS_CONTAINER_CREDENTIALS_RELATIVE_URI
26003
26003
  }, validateToken = (token) => {
26004
26004
  if (token.includes(`\r
26005
26005
  `)) {
26006
- throw new import_config16.CredentialsProviderError("Authorization token contains invalid \\r\\n sequence.");
26006
+ throw new import_config17.CredentialsProviderError("Authorization token contains invalid \\r\\n sequence.");
26007
26007
  }
26008
26008
  return token;
26009
26009
  };
@@ -26011,7 +26011,7 @@ var init_fromHttp = __esm(() => {
26011
26011
  init_checkUrl();
26012
26012
  init_requestHelpers();
26013
26013
  import_client9 = __toESM(require_client2(), 1);
26014
- import_config16 = __toESM(require_config(), 1);
26014
+ import_config17 = __toESM(require_config(), 1);
26015
26015
  import_node_http_handler = __toESM(require_dist_cjs6(), 1);
26016
26016
  });
26017
26017
 
@@ -26814,70 +26814,70 @@ var getNewSsoOidcToken = async (ssoToken, ssoRegion, init = {}, callerClientConf
26814
26814
  var init_getNewSsoOidcToken = () => {};
26815
26815
 
26816
26816
  // node_modules/@aws-sdk/token-providers/dist-es/validateTokenExpiry.js
26817
- var import_config18, validateTokenExpiry = (token) => {
26817
+ var import_config19, validateTokenExpiry = (token) => {
26818
26818
  if (token.expiration && token.expiration.getTime() < Date.now()) {
26819
- throw new import_config18.TokenProviderError(`Token is expired. ${REFRESH_MESSAGE}`, false);
26819
+ throw new import_config19.TokenProviderError(`Token is expired. ${REFRESH_MESSAGE}`, false);
26820
26820
  }
26821
26821
  };
26822
26822
  var init_validateTokenExpiry = __esm(() => {
26823
26823
  init_constants();
26824
- import_config18 = __toESM(require_config(), 1);
26824
+ import_config19 = __toESM(require_config(), 1);
26825
26825
  });
26826
26826
 
26827
26827
  // node_modules/@aws-sdk/token-providers/dist-es/validateTokenKey.js
26828
- var import_config19, validateTokenKey = (key, value, forRefresh = false) => {
26828
+ var import_config20, validateTokenKey = (key, value, forRefresh = false) => {
26829
26829
  if (typeof value === "undefined") {
26830
- throw new import_config19.TokenProviderError(`Value not present for '${key}' in SSO Token${forRefresh ? ". Cannot refresh" : ""}. ${REFRESH_MESSAGE}`, false);
26830
+ throw new import_config20.TokenProviderError(`Value not present for '${key}' in SSO Token${forRefresh ? ". Cannot refresh" : ""}. ${REFRESH_MESSAGE}`, false);
26831
26831
  }
26832
26832
  };
26833
26833
  var init_validateTokenKey = __esm(() => {
26834
26834
  init_constants();
26835
- import_config19 = __toESM(require_config(), 1);
26835
+ import_config20 = __toESM(require_config(), 1);
26836
26836
  });
26837
26837
 
26838
26838
  // node_modules/@aws-sdk/token-providers/dist-es/writeSSOTokenToFile.js
26839
26839
  import { promises as fsPromises } from "fs";
26840
- var import_config20, writeFile, writeSSOTokenToFile = (id2, ssoToken) => {
26841
- const tokenFilepath = import_config20.getSSOTokenFilepath(id2);
26840
+ var import_config21, writeFile, writeSSOTokenToFile = (id2, ssoToken) => {
26841
+ const tokenFilepath = import_config21.getSSOTokenFilepath(id2);
26842
26842
  const tokenString = JSON.stringify(ssoToken, null, 2);
26843
26843
  return writeFile(tokenFilepath, tokenString);
26844
26844
  };
26845
26845
  var init_writeSSOTokenToFile = __esm(() => {
26846
- import_config20 = __toESM(require_config(), 1);
26846
+ import_config21 = __toESM(require_config(), 1);
26847
26847
  ({ writeFile } = fsPromises);
26848
26848
  });
26849
26849
 
26850
26850
  // node_modules/@aws-sdk/token-providers/dist-es/fromSso.js
26851
- var import_config21, lastRefreshAttemptTimes, fromSso = (init = {}) => async ({ callerClientConfig } = {}) => {
26851
+ var import_config22, lastRefreshAttemptTimes, fromSso = (init = {}) => async ({ callerClientConfig } = {}) => {
26852
26852
  init.logger?.debug("@aws-sdk/token-providers - fromSso");
26853
- const profiles = await import_config21.parseKnownFiles(init);
26854
- const profileName = import_config21.getProfileName({
26853
+ const profiles = await import_config22.parseKnownFiles(init);
26854
+ const profileName = import_config22.getProfileName({
26855
26855
  profile: init.profile ?? callerClientConfig?.profile
26856
26856
  });
26857
26857
  const profile = profiles[profileName];
26858
26858
  if (!profile) {
26859
- throw new import_config21.TokenProviderError(`Profile '${profileName}' could not be found in shared credentials file.`, false);
26859
+ throw new import_config22.TokenProviderError(`Profile '${profileName}' could not be found in shared credentials file.`, false);
26860
26860
  } else if (!profile["sso_session"]) {
26861
- throw new import_config21.TokenProviderError(`Profile '${profileName}' is missing required property 'sso_session'.`);
26861
+ throw new import_config22.TokenProviderError(`Profile '${profileName}' is missing required property 'sso_session'.`);
26862
26862
  }
26863
26863
  const ssoSessionName = profile["sso_session"];
26864
- const ssoSessions = await import_config21.loadSsoSessionData(init);
26864
+ const ssoSessions = await import_config22.loadSsoSessionData(init);
26865
26865
  const ssoSession = ssoSessions[ssoSessionName];
26866
26866
  if (!ssoSession) {
26867
- throw new import_config21.TokenProviderError(`Sso session '${ssoSessionName}' could not be found in shared credentials file.`, false);
26867
+ throw new import_config22.TokenProviderError(`Sso session '${ssoSessionName}' could not be found in shared credentials file.`, false);
26868
26868
  }
26869
26869
  for (const ssoSessionRequiredKey of ["sso_start_url", "sso_region"]) {
26870
26870
  if (!ssoSession[ssoSessionRequiredKey]) {
26871
- throw new import_config21.TokenProviderError(`Sso session '${ssoSessionName}' is missing required property '${ssoSessionRequiredKey}'.`, false);
26871
+ throw new import_config22.TokenProviderError(`Sso session '${ssoSessionName}' is missing required property '${ssoSessionRequiredKey}'.`, false);
26872
26872
  }
26873
26873
  }
26874
26874
  const ssoStartUrl = ssoSession["sso_start_url"];
26875
26875
  const ssoRegion = ssoSession["sso_region"];
26876
26876
  let ssoToken;
26877
26877
  try {
26878
- ssoToken = await import_config21.getSSOTokenFromFile(ssoSessionName);
26878
+ ssoToken = await import_config22.getSSOTokenFromFile(ssoSessionName);
26879
26879
  } catch (e3) {
26880
- throw new import_config21.TokenProviderError(`The SSO session token associated with profile=${profileName} was not found or is invalid. ${REFRESH_MESSAGE}`, false);
26880
+ throw new import_config22.TokenProviderError(`The SSO session token associated with profile=${profileName} was not found or is invalid. ${REFRESH_MESSAGE}`, false);
26881
26881
  }
26882
26882
  validateTokenKey("accessToken", ssoToken.accessToken);
26883
26883
  validateTokenKey("expiresAt", ssoToken.expiresAt);
@@ -26926,7 +26926,7 @@ var init_fromSso = __esm(() => {
26926
26926
  init_validateTokenExpiry();
26927
26927
  init_validateTokenKey();
26928
26928
  init_writeSSOTokenToFile();
26929
- import_config21 = __toESM(require_config(), 1);
26929
+ import_config22 = __toESM(require_config(), 1);
26930
26930
  lastRefreshAttemptTimes = new Map;
26931
26931
  });
26932
26932
 
@@ -27394,7 +27394,7 @@ var init_loadSso = __esm(() => {
27394
27394
  });
27395
27395
 
27396
27396
  // node_modules/@aws-sdk/credential-provider-sso/dist-es/resolveSSOCredentials.js
27397
- var import_client10, import_config22, SHOULD_FAIL_CREDENTIAL_CHAIN = false, resolveSSOCredentials = async ({ ssoStartUrl, ssoSession, ssoAccountId, ssoRegion, ssoRoleName, ssoClient, clientConfig, parentClientConfig, callerClientConfig, profile, filepath, configFilepath, ignoreCache, logger }) => {
27397
+ var import_client10, import_config23, SHOULD_FAIL_CREDENTIAL_CHAIN = false, resolveSSOCredentials = async ({ ssoStartUrl, ssoSession, ssoAccountId, ssoRegion, ssoRoleName, ssoClient, clientConfig, parentClientConfig, callerClientConfig, profile, filepath, configFilepath, ignoreCache, logger }) => {
27398
27398
  let token;
27399
27399
  const refreshMessage = `To refresh this SSO session run aws sso login with the corresponding profile.`;
27400
27400
  if (ssoSession) {
@@ -27413,23 +27413,23 @@ var import_client10, import_config22, SHOULD_FAIL_CREDENTIAL_CHAIN = false, reso
27413
27413
  expiresAt: new Date(_token.expiration).toISOString()
27414
27414
  };
27415
27415
  } catch (e4) {
27416
- throw new import_config22.CredentialsProviderError(e4.message, {
27416
+ throw new import_config23.CredentialsProviderError(e4.message, {
27417
27417
  tryNextLink: SHOULD_FAIL_CREDENTIAL_CHAIN,
27418
27418
  logger
27419
27419
  });
27420
27420
  }
27421
27421
  } else {
27422
27422
  try {
27423
- token = await import_config22.getSSOTokenFromFile(ssoStartUrl);
27423
+ token = await import_config23.getSSOTokenFromFile(ssoStartUrl);
27424
27424
  } catch (e4) {
27425
- throw new import_config22.CredentialsProviderError(`The SSO session associated with this profile is invalid. ${refreshMessage}`, {
27425
+ throw new import_config23.CredentialsProviderError(`The SSO session associated with this profile is invalid. ${refreshMessage}`, {
27426
27426
  tryNextLink: SHOULD_FAIL_CREDENTIAL_CHAIN,
27427
27427
  logger
27428
27428
  });
27429
27429
  }
27430
27430
  }
27431
27431
  if (new Date(token.expiresAt).getTime() - Date.now() <= 0) {
27432
- throw new import_config22.CredentialsProviderError(`The SSO session associated with this profile has expired. ${refreshMessage}`, {
27432
+ throw new import_config23.CredentialsProviderError(`The SSO session associated with this profile has expired. ${refreshMessage}`, {
27433
27433
  tryNextLink: SHOULD_FAIL_CREDENTIAL_CHAIN,
27434
27434
  logger
27435
27435
  });
@@ -27449,14 +27449,14 @@ var import_client10, import_config22, SHOULD_FAIL_CREDENTIAL_CHAIN = false, reso
27449
27449
  accessToken
27450
27450
  }));
27451
27451
  } catch (e4) {
27452
- throw new import_config22.CredentialsProviderError(e4, {
27452
+ throw new import_config23.CredentialsProviderError(e4, {
27453
27453
  tryNextLink: SHOULD_FAIL_CREDENTIAL_CHAIN,
27454
27454
  logger
27455
27455
  });
27456
27456
  }
27457
27457
  const { roleCredentials: { accessKeyId, secretAccessKey, sessionToken, expiration, credentialScope, accountId } = {} } = ssoResp;
27458
27458
  if (!accessKeyId || !secretAccessKey || !sessionToken || !expiration) {
27459
- throw new import_config22.CredentialsProviderError("SSO returns an invalid temporary credential.", {
27459
+ throw new import_config23.CredentialsProviderError("SSO returns an invalid temporary credential.", {
27460
27460
  tryNextLink: SHOULD_FAIL_CREDENTIAL_CHAIN,
27461
27461
  logger
27462
27462
  });
@@ -27479,53 +27479,53 @@ var import_client10, import_config22, SHOULD_FAIL_CREDENTIAL_CHAIN = false, reso
27479
27479
  var init_resolveSSOCredentials = __esm(() => {
27480
27480
  init_dist_es4();
27481
27481
  import_client10 = __toESM(require_client2(), 1);
27482
- import_config22 = __toESM(require_config(), 1);
27482
+ import_config23 = __toESM(require_config(), 1);
27483
27483
  });
27484
27484
 
27485
27485
  // node_modules/@aws-sdk/credential-provider-sso/dist-es/validateSsoProfile.js
27486
- var import_config23, validateSsoProfile = (profile, logger) => {
27486
+ var import_config24, validateSsoProfile = (profile, logger) => {
27487
27487
  const { sso_start_url, sso_account_id, sso_region, sso_role_name } = profile;
27488
27488
  if (!sso_start_url || !sso_account_id || !sso_region || !sso_role_name) {
27489
- throw new import_config23.CredentialsProviderError(`Profile is configured with invalid SSO credentials. Required parameters "sso_account_id", ` + `"sso_region", "sso_role_name", "sso_start_url". Got ${Object.keys(profile).join(", ")}
27489
+ throw new import_config24.CredentialsProviderError(`Profile is configured with invalid SSO credentials. Required parameters "sso_account_id", ` + `"sso_region", "sso_role_name", "sso_start_url". Got ${Object.keys(profile).join(", ")}
27490
27490
  Reference: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-sso.html`, { tryNextLink: false, logger });
27491
27491
  }
27492
27492
  return profile;
27493
27493
  };
27494
27494
  var init_validateSsoProfile = __esm(() => {
27495
- import_config23 = __toESM(require_config(), 1);
27495
+ import_config24 = __toESM(require_config(), 1);
27496
27496
  });
27497
27497
 
27498
27498
  // node_modules/@aws-sdk/credential-provider-sso/dist-es/fromSSO.js
27499
- var import_config24, fromSSO = (init = {}) => async ({ callerClientConfig } = {}) => {
27499
+ var import_config25, fromSSO = (init = {}) => async ({ callerClientConfig } = {}) => {
27500
27500
  init.logger?.debug("@aws-sdk/credential-provider-sso - fromSSO");
27501
27501
  const { ssoStartUrl, ssoAccountId, ssoRegion, ssoRoleName, ssoSession } = init;
27502
27502
  const { ssoClient } = init;
27503
- const profileName = import_config24.getProfileName({
27503
+ const profileName = import_config25.getProfileName({
27504
27504
  profile: init.profile ?? callerClientConfig?.profile
27505
27505
  });
27506
27506
  if (!ssoStartUrl && !ssoAccountId && !ssoRegion && !ssoRoleName && !ssoSession) {
27507
- const profiles = await import_config24.parseKnownFiles(init);
27507
+ const profiles = await import_config25.parseKnownFiles(init);
27508
27508
  const profile = profiles[profileName];
27509
27509
  if (!profile) {
27510
- throw new import_config24.CredentialsProviderError(`Profile ${profileName} was not found.`, { logger: init.logger });
27510
+ throw new import_config25.CredentialsProviderError(`Profile ${profileName} was not found.`, { logger: init.logger });
27511
27511
  }
27512
27512
  if (!isSsoProfile(profile)) {
27513
- throw new import_config24.CredentialsProviderError(`Profile ${profileName} is not configured with SSO credentials.`, {
27513
+ throw new import_config25.CredentialsProviderError(`Profile ${profileName} is not configured with SSO credentials.`, {
27514
27514
  logger: init.logger
27515
27515
  });
27516
27516
  }
27517
27517
  if (profile?.sso_session) {
27518
- const ssoSessions = await import_config24.loadSsoSessionData(init);
27518
+ const ssoSessions = await import_config25.loadSsoSessionData(init);
27519
27519
  const session = ssoSessions[profile.sso_session];
27520
27520
  const conflictMsg = ` configurations in profile ${profileName} and sso-session ${profile.sso_session}`;
27521
27521
  if (ssoRegion && ssoRegion !== session.sso_region) {
27522
- throw new import_config24.CredentialsProviderError(`Conflicting SSO region` + conflictMsg, {
27522
+ throw new import_config25.CredentialsProviderError(`Conflicting SSO region` + conflictMsg, {
27523
27523
  tryNextLink: false,
27524
27524
  logger: init.logger
27525
27525
  });
27526
27526
  }
27527
27527
  if (ssoStartUrl && ssoStartUrl !== session.sso_start_url) {
27528
- throw new import_config24.CredentialsProviderError(`Conflicting SSO start_url` + conflictMsg, {
27528
+ throw new import_config25.CredentialsProviderError(`Conflicting SSO start_url` + conflictMsg, {
27529
27529
  tryNextLink: false,
27530
27530
  logger: init.logger
27531
27531
  });
@@ -27551,7 +27551,7 @@ var import_config24, fromSSO = (init = {}) => async ({ callerClientConfig } = {}
27551
27551
  logger: init.logger
27552
27552
  });
27553
27553
  } else if (!ssoStartUrl || !ssoAccountId || !ssoRegion || !ssoRoleName) {
27554
- throw new import_config24.CredentialsProviderError("Incomplete configuration. The fromSSO() argument hash must include " + '"ssoStartUrl", "ssoAccountId", "ssoRegion", "ssoRoleName"', { tryNextLink: false, logger: init.logger });
27554
+ throw new import_config25.CredentialsProviderError("Incomplete configuration. The fromSSO() argument hash must include " + '"ssoStartUrl", "ssoAccountId", "ssoRegion", "ssoRoleName"', { tryNextLink: false, logger: init.logger });
27555
27555
  } else {
27556
27556
  return resolveSSOCredentials({
27557
27557
  ssoStartUrl,
@@ -27574,7 +27574,7 @@ var import_config24, fromSSO = (init = {}) => async ({ callerClientConfig } = {}
27574
27574
  var init_fromSSO = __esm(() => {
27575
27575
  init_resolveSSOCredentials();
27576
27576
  init_validateSsoProfile();
27577
- import_config24 = __toESM(require_config(), 1);
27577
+ import_config25 = __toESM(require_config(), 1);
27578
27578
  });
27579
27579
 
27580
27580
  // node_modules/@aws-sdk/credential-provider-sso/dist-es/index.js
@@ -27590,13 +27590,13 @@ var init_dist_es5 = __esm(() => {
27590
27590
  });
27591
27591
 
27592
27592
  // node_modules/@aws-sdk/credential-provider-ini/dist-es/resolveCredentialSource.js
27593
- var import_client11, import_config25, resolveCredentialSource = (credentialSource, profileName, logger) => {
27593
+ var import_client11, import_config26, resolveCredentialSource = (credentialSource, profileName, logger) => {
27594
27594
  const sourceProvidersMap = {
27595
27595
  EcsContainer: async (options) => {
27596
27596
  const { fromHttp: fromHttp2 } = await Promise.resolve().then(() => (init_dist_es3(), exports_dist_es3));
27597
27597
  const { fromContainerMetadata: fromContainerMetadata2 } = await Promise.resolve().then(() => (init_dist_es2(), exports_dist_es2));
27598
27598
  logger?.debug("@aws-sdk/credential-provider-ini - credential_source is EcsContainer");
27599
- return async () => import_config25.chain(fromHttp2(options ?? {}), fromContainerMetadata2(options))().then(setNamedProvider);
27599
+ return async () => import_config26.chain(fromHttp2(options ?? {}), fromContainerMetadata2(options))().then(setNamedProvider);
27600
27600
  },
27601
27601
  Ec2InstanceMetadata: async (options) => {
27602
27602
  logger?.debug("@aws-sdk/credential-provider-ini - credential_source is Ec2InstanceMetadata");
@@ -27612,12 +27612,12 @@ var import_client11, import_config25, resolveCredentialSource = (credentialSourc
27612
27612
  if (credentialSource in sourceProvidersMap) {
27613
27613
  return sourceProvidersMap[credentialSource];
27614
27614
  } else {
27615
- throw new import_config25.CredentialsProviderError(`Unsupported credential source in profile ${profileName}. Got ${credentialSource}, expected EcsContainer or Ec2InstanceMetadata or Environment.`, { logger });
27615
+ throw new import_config26.CredentialsProviderError(`Unsupported credential source in profile ${profileName}. Got ${credentialSource}, expected EcsContainer or Ec2InstanceMetadata or Environment.`, { logger });
27616
27616
  }
27617
27617
  }, setNamedProvider = (creds) => import_client11.setCredentialFeature(creds, "CREDENTIALS_PROFILE_NAMED_PROVIDER", "p");
27618
27618
  var init_resolveCredentialSource = __esm(() => {
27619
27619
  import_client11 = __toESM(require_client2(), 1);
27620
- import_config25 = __toESM(require_config(), 1);
27620
+ import_config26 = __toESM(require_config(), 1);
27621
27621
  });
27622
27622
 
27623
27623
  // node_modules/@aws-sdk/credential-provider-ini/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sts/index.js
@@ -28643,7 +28643,7 @@ var require_sts = __commonJS((exports) => {
28643
28643
  });
28644
28644
 
28645
28645
  // node_modules/@aws-sdk/credential-provider-ini/dist-es/resolveAssumeRoleCredentials.js
28646
- var import_client12, import_config26, isAssumeRoleProfile = (arg, { profile = "default", logger } = {}) => {
28646
+ var import_client12, import_config27, isAssumeRoleProfile = (arg, { profile = "default", logger } = {}) => {
28647
28647
  return Boolean(arg) && typeof arg === "object" && typeof arg.role_arn === "string" && ["undefined", "string"].indexOf(typeof arg.role_session_name) > -1 && ["undefined", "string"].indexOf(typeof arg.external_id) > -1 && ["undefined", "string"].indexOf(typeof arg.mfa_serial) > -1 && (isAssumeRoleWithSourceProfile(arg, { profile, logger }) || isCredentialSourceProfile(arg, { profile, logger }));
28648
28648
  }, isAssumeRoleWithSourceProfile = (arg, { profile, logger }) => {
28649
28649
  const withSourceProfile = typeof arg.source_profile === "string" && typeof arg.credential_source === "undefined";
@@ -28674,7 +28674,7 @@ var import_client12, import_config26, isAssumeRoleProfile = (arg, { profile = "d
28674
28674
  }, options.clientPlugins);
28675
28675
  }
28676
28676
  if (source_profile && source_profile in visitedProfiles) {
28677
- throw new import_config26.CredentialsProviderError(`Detected a cycle attempting to resolve credentials for profile ${import_config26.getProfileName(options)}. Profiles visited: ` + Object.keys(visitedProfiles).join(", "), { logger: options.logger });
28677
+ throw new import_config27.CredentialsProviderError(`Detected a cycle attempting to resolve credentials for profile ${import_config27.getProfileName(options)}. Profiles visited: ` + Object.keys(visitedProfiles).join(", "), { logger: options.logger });
28678
28678
  }
28679
28679
  options.logger?.debug(`@aws-sdk/credential-provider-ini - finding credential resolver using ${source_profile ? `source_profile=[${source_profile}]` : `profile=[${profileName}]`}`);
28680
28680
  const sourceCredsProvider = source_profile ? resolveProfileData(source_profile, profiles, options, callerClientConfig, {
@@ -28693,7 +28693,7 @@ var import_client12, import_config26, isAssumeRoleProfile = (arg, { profile = "d
28693
28693
  const { mfa_serial } = profileData;
28694
28694
  if (mfa_serial) {
28695
28695
  if (!options.mfaCodeProvider) {
28696
- throw new import_config26.CredentialsProviderError(`Profile ${profileName} requires multi-factor authentication, but no MFA code callback was provided.`, { logger: options.logger, tryNextLink: false });
28696
+ throw new import_config27.CredentialsProviderError(`Profile ${profileName} requires multi-factor authentication, but no MFA code callback was provided.`, { logger: options.logger, tryNextLink: false });
28697
28697
  }
28698
28698
  params.SerialNumber = mfa_serial;
28699
28699
  params.TokenCode = await options.mfaCodeProvider(mfa_serial);
@@ -28707,7 +28707,7 @@ var import_client12, import_config26, isAssumeRoleProfile = (arg, { profile = "d
28707
28707
  var init_resolveAssumeRoleCredentials = __esm(() => {
28708
28708
  init_resolveCredentialSource();
28709
28709
  import_client12 = __toESM(require_client2(), 1);
28710
- import_config26 = __toESM(require_config(), 1);
28710
+ import_config27 = __toESM(require_config(), 1);
28711
28711
  });
28712
28712
 
28713
28713
  // node_modules/@aws-sdk/credential-provider-ini/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/signin/index.js
@@ -29445,11 +29445,11 @@ var require_signin = __commonJS((exports) => {
29445
29445
  // node_modules/@aws-sdk/credential-provider-ini/node_modules/@aws-sdk/credential-provider-login/dist-es/LoginCredentialsFetcher.js
29446
29446
  import { createHash as createHash19, createPrivateKey, createPublicKey, sign } from "crypto";
29447
29447
  import { promises as fs2 } from "fs";
29448
- import { homedir as homedir6 } from "os";
29449
- import { dirname as dirname19, join as join31 } from "path";
29450
- var import_config27, import_protocols3, LoginCredentialsFetcher;
29448
+ import { homedir as homedir7 } from "os";
29449
+ import { dirname as dirname20, join as join32 } from "path";
29450
+ var import_config28, import_protocols3, LoginCredentialsFetcher;
29451
29451
  var init_LoginCredentialsFetcher = __esm(() => {
29452
- import_config27 = __toESM(require_config(), 1);
29452
+ import_config28 = __toESM(require_config(), 1);
29453
29453
  import_protocols3 = __toESM(require_protocols(), 1);
29454
29454
  LoginCredentialsFetcher = class LoginCredentialsFetcher {
29455
29455
  profileData;
@@ -29464,7 +29464,7 @@ var init_LoginCredentialsFetcher = __esm(() => {
29464
29464
  async loadCredentials() {
29465
29465
  const token = await this.loadToken();
29466
29466
  if (!token) {
29467
- throw new import_config27.CredentialsProviderError(`Failed to load a token for session ${this.loginSession}, please re-authenticate using aws login`, { tryNextLink: false, logger: this.logger });
29467
+ throw new import_config28.CredentialsProviderError(`Failed to load a token for session ${this.loginSession}, please re-authenticate using aws login`, { tryNextLink: false, logger: this.logger });
29468
29468
  }
29469
29469
  const accessToken = token.accessToken;
29470
29470
  const now = Date.now();
@@ -29531,7 +29531,7 @@ var init_LoginCredentialsFetcher = __esm(() => {
29531
29531
  const { accessKeyId, secretAccessKey, sessionToken } = response.tokenOutput?.accessToken ?? {};
29532
29532
  const { refreshToken, expiresIn } = response.tokenOutput ?? {};
29533
29533
  if (!accessKeyId || !secretAccessKey || !sessionToken || !refreshToken) {
29534
- throw new import_config27.CredentialsProviderError("Token refresh response missing required fields", {
29534
+ throw new import_config28.CredentialsProviderError("Token refresh response missing required fields", {
29535
29535
  logger: this.logger,
29536
29536
  tryNextLink: false
29537
29537
  });
@@ -29568,7 +29568,7 @@ var init_LoginCredentialsFetcher = __esm(() => {
29568
29568
  default:
29569
29569
  message = `Failed to refresh token: ${String(error)}. Please re-authenticate using \`aws login\``;
29570
29570
  }
29571
- throw new import_config27.CredentialsProviderError(message, {
29571
+ throw new import_config28.CredentialsProviderError(message, {
29572
29572
  logger: this.logger,
29573
29573
  tryNextLink: false
29574
29574
  });
@@ -29578,7 +29578,7 @@ var init_LoginCredentialsFetcher = __esm(() => {
29578
29578
  this.logger?.warn?.(`Failed to refresh token: ${String(error)}. Using existing token until expiry.`);
29579
29579
  return this.toCredentials(freshToken.accessToken);
29580
29580
  }
29581
- throw new import_config27.CredentialsProviderError(`Failed to refresh token: ${String(error)}. Please re-authenticate using aws login`, { logger: this.logger });
29581
+ throw new import_config28.CredentialsProviderError(`Failed to refresh token: ${String(error)}. Please re-authenticate using aws login`, { logger: this.logger });
29582
29582
  }
29583
29583
  }
29584
29584
  async loadToken() {
@@ -29591,14 +29591,14 @@ var init_LoginCredentialsFetcher = __esm(() => {
29591
29591
  missingFields.push("accountId");
29592
29592
  }
29593
29593
  if (missingFields.length > 0) {
29594
- throw new import_config27.CredentialsProviderError(`Token validation failed, missing fields: ${missingFields.join(", ")}`, {
29594
+ throw new import_config28.CredentialsProviderError(`Token validation failed, missing fields: ${missingFields.join(", ")}`, {
29595
29595
  logger: this.logger,
29596
29596
  tryNextLink: false
29597
29597
  });
29598
29598
  }
29599
29599
  return token;
29600
29600
  } catch (error) {
29601
- throw new import_config27.CredentialsProviderError(`Failed to load token from ${tokenFilePath}: ${String(error)}`, {
29601
+ throw new import_config28.CredentialsProviderError(`Failed to load token from ${tokenFilePath}: ${String(error)}`, {
29602
29602
  logger: this.logger,
29603
29603
  tryNextLink: false
29604
29604
  });
@@ -29606,17 +29606,17 @@ var init_LoginCredentialsFetcher = __esm(() => {
29606
29606
  }
29607
29607
  async saveToken(token) {
29608
29608
  const tokenFilePath = this.getTokenFilePath();
29609
- const directory = dirname19(tokenFilePath);
29609
+ const directory = dirname20(tokenFilePath);
29610
29610
  try {
29611
29611
  await fs2.mkdir(directory, { recursive: true });
29612
29612
  } catch (error) {}
29613
29613
  await fs2.writeFile(tokenFilePath, JSON.stringify(token, null, 2), "utf8");
29614
29614
  }
29615
29615
  getTokenFilePath() {
29616
- const directory = process.env.AWS_LOGIN_CACHE_DIRECTORY ?? join31(homedir6(), ".aws", "login", "cache");
29616
+ const directory = process.env.AWS_LOGIN_CACHE_DIRECTORY ?? join32(homedir7(), ".aws", "login", "cache");
29617
29617
  const loginSessionBytes = Buffer.from(this.loginSession, "utf8");
29618
29618
  const loginSessionSha256 = createHash19("sha256").update(loginSessionBytes).digest("hex");
29619
- return join31(directory, `${loginSessionSha256}.json`);
29619
+ return join32(directory, `${loginSessionSha256}.json`);
29620
29620
  }
29621
29621
  derToRawSignature(derSignature) {
29622
29622
  let offset = 2;
@@ -29700,22 +29700,22 @@ var init_LoginCredentialsFetcher = __esm(() => {
29700
29700
  const signatureB64 = rawSignature.toString("base64url");
29701
29701
  return `${message}.${signatureB64}`;
29702
29702
  } catch (error) {
29703
- throw new import_config27.CredentialsProviderError(`Failed to generate Dpop proof: ${error instanceof Error ? error.message : String(error)}`, { logger: this.logger, tryNextLink: false });
29703
+ throw new import_config28.CredentialsProviderError(`Failed to generate Dpop proof: ${error instanceof Error ? error.message : String(error)}`, { logger: this.logger, tryNextLink: false });
29704
29704
  }
29705
29705
  }
29706
29706
  };
29707
29707
  });
29708
29708
 
29709
29709
  // node_modules/@aws-sdk/credential-provider-ini/node_modules/@aws-sdk/credential-provider-login/dist-es/fromLoginCredentials.js
29710
- var import_client13, import_config28, fromLoginCredentials = (init) => async ({ callerClientConfig } = {}) => {
29710
+ var import_client13, import_config29, fromLoginCredentials = (init) => async ({ callerClientConfig } = {}) => {
29711
29711
  init?.logger?.debug?.("@aws-sdk/credential-providers - fromLoginCredentials");
29712
- const profiles = await import_config28.parseKnownFiles(init || {});
29713
- const profileName = import_config28.getProfileName({
29712
+ const profiles = await import_config29.parseKnownFiles(init || {});
29713
+ const profileName = import_config29.getProfileName({
29714
29714
  profile: init?.profile ?? callerClientConfig?.profile
29715
29715
  });
29716
29716
  const profile = profiles[profileName];
29717
29717
  if (!profile?.login_session) {
29718
- throw new import_config28.CredentialsProviderError(`Profile ${profileName} does not contain login_session.`, {
29718
+ throw new import_config29.CredentialsProviderError(`Profile ${profileName} does not contain login_session.`, {
29719
29719
  tryNextLink: true,
29720
29720
  logger: init?.logger
29721
29721
  });
@@ -29727,7 +29727,7 @@ var import_client13, import_config28, fromLoginCredentials = (init) => async ({
29727
29727
  var init_fromLoginCredentials = __esm(() => {
29728
29728
  init_LoginCredentialsFetcher();
29729
29729
  import_client13 = __toESM(require_client2(), 1);
29730
- import_config28 = __toESM(require_config(), 1);
29730
+ import_config29 = __toESM(require_config(), 1);
29731
29731
  });
29732
29732
 
29733
29733
  // node_modules/@aws-sdk/credential-provider-ini/node_modules/@aws-sdk/credential-provider-login/dist-es/index.js
@@ -29791,12 +29791,12 @@ var init_getValidatedProcessCredentials = __esm(() => {
29791
29791
  // node_modules/@aws-sdk/credential-provider-process/dist-es/resolveProcessCredentials.js
29792
29792
  import { exec } from "child_process";
29793
29793
  import { promisify } from "util";
29794
- var import_config29, resolveProcessCredentials = async (profileName, profiles, logger) => {
29794
+ var import_config30, resolveProcessCredentials = async (profileName, profiles, logger) => {
29795
29795
  const profile = profiles[profileName];
29796
29796
  if (profiles[profileName]) {
29797
29797
  const credentialProcess = profile["credential_process"];
29798
29798
  if (credentialProcess !== undefined) {
29799
- const execPromise = promisify(import_config29.externalDataInterceptor?.getTokenRecord?.().exec ?? exec);
29799
+ const execPromise = promisify(import_config30.externalDataInterceptor?.getTokenRecord?.().exec ?? exec);
29800
29800
  try {
29801
29801
  const { stdout } = await execPromise(credentialProcess);
29802
29802
  let data;
@@ -29807,33 +29807,33 @@ var import_config29, resolveProcessCredentials = async (profileName, profiles, l
29807
29807
  }
29808
29808
  return getValidatedProcessCredentials(profileName, data, profiles);
29809
29809
  } catch (error) {
29810
- throw new import_config29.CredentialsProviderError(error.message, { logger });
29810
+ throw new import_config30.CredentialsProviderError(error.message, { logger });
29811
29811
  }
29812
29812
  } else {
29813
- throw new import_config29.CredentialsProviderError(`Profile ${profileName} did not contain credential_process.`, { logger });
29813
+ throw new import_config30.CredentialsProviderError(`Profile ${profileName} did not contain credential_process.`, { logger });
29814
29814
  }
29815
29815
  } else {
29816
- throw new import_config29.CredentialsProviderError(`Profile ${profileName} could not be found in shared credentials file.`, {
29816
+ throw new import_config30.CredentialsProviderError(`Profile ${profileName} could not be found in shared credentials file.`, {
29817
29817
  logger
29818
29818
  });
29819
29819
  }
29820
29820
  };
29821
29821
  var init_resolveProcessCredentials = __esm(() => {
29822
29822
  init_getValidatedProcessCredentials();
29823
- import_config29 = __toESM(require_config(), 1);
29823
+ import_config30 = __toESM(require_config(), 1);
29824
29824
  });
29825
29825
 
29826
29826
  // node_modules/@aws-sdk/credential-provider-process/dist-es/fromProcess.js
29827
- var import_config30, fromProcess = (init = {}) => async ({ callerClientConfig } = {}) => {
29827
+ var import_config31, fromProcess = (init = {}) => async ({ callerClientConfig } = {}) => {
29828
29828
  init.logger?.debug("@aws-sdk/credential-provider-process - fromProcess");
29829
- const profiles = await import_config30.parseKnownFiles(init);
29830
- return resolveProcessCredentials(import_config30.getProfileName({
29829
+ const profiles = await import_config31.parseKnownFiles(init);
29830
+ return resolveProcessCredentials(import_config31.getProfileName({
29831
29831
  profile: init.profile ?? callerClientConfig?.profile
29832
29832
  }), profiles, init.logger);
29833
29833
  };
29834
29834
  var init_fromProcess = __esm(() => {
29835
29835
  init_resolveProcessCredentials();
29836
- import_config30 = __toESM(require_config(), 1);
29836
+ import_config31 = __toESM(require_config(), 1);
29837
29837
  });
29838
29838
 
29839
29839
  // node_modules/@aws-sdk/credential-provider-process/dist-es/index.js
@@ -30947,19 +30947,19 @@ var fromWebToken = (init) => async (awsIdentityProperties) => {
30947
30947
 
30948
30948
  // node_modules/@aws-sdk/credential-provider-web-identity/dist-es/fromTokenFile.js
30949
30949
  import { readFileSync as readFileSync21 } from "fs";
30950
- var import_client19, import_config31, ENV_TOKEN_FILE = "AWS_WEB_IDENTITY_TOKEN_FILE", ENV_ROLE_ARN = "AWS_ROLE_ARN", ENV_ROLE_SESSION_NAME = "AWS_ROLE_SESSION_NAME", fromTokenFile = (init = {}) => async (awsIdentityProperties) => {
30950
+ var import_client19, import_config32, ENV_TOKEN_FILE = "AWS_WEB_IDENTITY_TOKEN_FILE", ENV_ROLE_ARN = "AWS_ROLE_ARN", ENV_ROLE_SESSION_NAME = "AWS_ROLE_SESSION_NAME", fromTokenFile = (init = {}) => async (awsIdentityProperties) => {
30951
30951
  init.logger?.debug("@aws-sdk/credential-provider-web-identity - fromTokenFile");
30952
30952
  const webIdentityTokenFile = init?.webIdentityTokenFile ?? process.env[ENV_TOKEN_FILE];
30953
30953
  const roleArn = init?.roleArn ?? process.env[ENV_ROLE_ARN];
30954
30954
  const roleSessionName = init?.roleSessionName ?? process.env[ENV_ROLE_SESSION_NAME];
30955
30955
  if (!webIdentityTokenFile || !roleArn) {
30956
- throw new import_config31.CredentialsProviderError("Web identity configuration not specified", {
30956
+ throw new import_config32.CredentialsProviderError("Web identity configuration not specified", {
30957
30957
  logger: init.logger
30958
30958
  });
30959
30959
  }
30960
30960
  const credentials = await fromWebToken({
30961
30961
  ...init,
30962
- webIdentityToken: import_config31.externalDataInterceptor?.getTokenRecord?.()[webIdentityTokenFile] ?? readFileSync21(webIdentityTokenFile, { encoding: "ascii" }),
30962
+ webIdentityToken: import_config32.externalDataInterceptor?.getTokenRecord?.()[webIdentityTokenFile] ?? readFileSync21(webIdentityTokenFile, { encoding: "ascii" }),
30963
30963
  roleArn,
30964
30964
  roleSessionName
30965
30965
  })(awsIdentityProperties);
@@ -30970,7 +30970,7 @@ var import_client19, import_config31, ENV_TOKEN_FILE = "AWS_WEB_IDENTITY_TOKEN_F
30970
30970
  };
30971
30971
  var init_fromTokenFile = __esm(() => {
30972
30972
  import_client19 = __toESM(require_client2(), 1);
30973
- import_config31 = __toESM(require_config(), 1);
30973
+ import_config32 = __toESM(require_config(), 1);
30974
30974
  });
30975
30975
 
30976
30976
  // node_modules/@aws-sdk/credential-provider-web-identity/dist-es/index.js
@@ -31003,7 +31003,7 @@ var init_resolveWebIdentityCredentials = __esm(() => {
31003
31003
  });
31004
31004
 
31005
31005
  // node_modules/@aws-sdk/credential-provider-ini/dist-es/resolveProfileData.js
31006
- var import_config32, resolveProfileData = async (profileName, profiles, options, callerClientConfig, visitedProfiles = {}, isAssumeRoleRecursiveCall = false) => {
31006
+ var import_config33, resolveProfileData = async (profileName, profiles, options, callerClientConfig, visitedProfiles = {}, isAssumeRoleRecursiveCall = false) => {
31007
31007
  const data = profiles[profileName];
31008
31008
  if (Object.keys(visitedProfiles).length > 0 && isStaticCredsProfile(data)) {
31009
31009
  return resolveStaticCredentials(data, options);
@@ -31026,7 +31026,7 @@ var import_config32, resolveProfileData = async (profileName, profiles, options,
31026
31026
  if (isLoginProfile(data)) {
31027
31027
  return resolveLoginCredentials(profileName, options, callerClientConfig);
31028
31028
  }
31029
- throw new import_config32.CredentialsProviderError(`Could not resolve credentials using profile: [${profileName}] in configuration/credentials file(s).`, { logger: options.logger });
31029
+ throw new import_config33.CredentialsProviderError(`Could not resolve credentials using profile: [${profileName}] in configuration/credentials file(s).`, { logger: options.logger });
31030
31030
  };
31031
31031
  var init_resolveProfileData = __esm(() => {
31032
31032
  init_resolveAssumeRoleCredentials();
@@ -31035,20 +31035,20 @@ var init_resolveProfileData = __esm(() => {
31035
31035
  init_resolveSsoCredentials();
31036
31036
  init_resolveStaticCredentials();
31037
31037
  init_resolveWebIdentityCredentials();
31038
- import_config32 = __toESM(require_config(), 1);
31038
+ import_config33 = __toESM(require_config(), 1);
31039
31039
  });
31040
31040
 
31041
31041
  // node_modules/@aws-sdk/credential-provider-ini/dist-es/fromIni.js
31042
- var import_config33, fromIni = (init = {}) => async ({ callerClientConfig } = {}) => {
31042
+ var import_config34, fromIni = (init = {}) => async ({ callerClientConfig } = {}) => {
31043
31043
  init.logger?.debug("@aws-sdk/credential-provider-ini - fromIni");
31044
- const profiles = await import_config33.parseKnownFiles(init);
31045
- return resolveProfileData(import_config33.getProfileName({
31044
+ const profiles = await import_config34.parseKnownFiles(init);
31045
+ return resolveProfileData(import_config34.getProfileName({
31046
31046
  profile: init.profile ?? callerClientConfig?.profile
31047
31047
  }), profiles, init, callerClientConfig);
31048
31048
  };
31049
31049
  var init_fromIni = __esm(() => {
31050
31050
  init_resolveProfileData();
31051
- import_config33 = __toESM(require_config(), 1);
31051
+ import_config34 = __toESM(require_config(), 1);
31052
31052
  });
31053
31053
 
31054
31054
  // node_modules/@aws-sdk/credential-provider-ini/dist-es/index.js
@@ -31066,8 +31066,8 @@ import { Buffer as Buffer2 } from "buffer";
31066
31066
  import { existsSync as existsSync22 } from "fs";
31067
31067
  import { join as join210 } from "path";
31068
31068
  import { existsSync as existsSync16 } from "fs";
31069
- import { homedir as homedir7 } from "os";
31070
- import { join as join35, resolve as resolve17 } from "path";
31069
+ import { homedir as homedir8 } from "os";
31070
+ import { join as join36, resolve as resolve18 } from "path";
31071
31071
  import { homedir as pathsResolverHomedir2 } from "os";
31072
31072
  import { join as pathsResolverJoin2 } from "path";
31073
31073
  import { createHmac as createHmac4, timingSafeEqual as timingSafeEqual3 } from "crypto";
@@ -31225,10 +31225,10 @@ function dataDir2(options) {
31225
31225
  return pathsResolverResolve("data", options);
31226
31226
  }
31227
31227
  function effectiveHome2() {
31228
- return process.env["HOME"] || process.env["USERPROFILE"] || homedir7();
31228
+ return process.env["HOME"] || process.env["USERPROFILE"] || homedir8();
31229
31229
  }
31230
31230
  function legacyHomeDir() {
31231
- return join35(effectiveHome2(), ".hasna", "events");
31231
+ return join36(effectiveHome2(), ".hasna", "events");
31232
31232
  }
31233
31233
  function resolverHome() {
31234
31234
  return dataDir2({ app: "events", home: effectiveHome2() || undefined });
@@ -31237,7 +31237,7 @@ function adoptResolverHome(resolved, env = process.env) {
31237
31237
  const dataOverride = env.HASNA_DATA_HOME;
31238
31238
  if (typeof dataOverride === "string" && dataOverride.trim().length > 0)
31239
31239
  return true;
31240
- return existsSync16(join35(resolved, EVENTS_STORE_SENTINEL_FILE));
31240
+ return existsSync16(join36(resolved, EVENTS_STORE_SENTINEL_FILE));
31241
31241
  }
31242
31242
  function exactEventsHome() {
31243
31243
  const dir = process.env[HASNA_EVENTS_DIR_ENV];
@@ -31251,9 +31251,9 @@ function exactEventsHome() {
31251
31251
  function getEventsHome() {
31252
31252
  const exact = exactEventsHome();
31253
31253
  if (exact)
31254
- return resolve17(exact);
31254
+ return resolve18(exact);
31255
31255
  const resolved = resolverHome();
31256
- return adoptResolverHome(resolved) ? resolve17(resolved) : resolve17(legacyHomeDir());
31256
+ return adoptResolverHome(resolved) ? resolve18(resolved) : resolve18(legacyHomeDir());
31257
31257
  }
31258
31258
  function getEventsDataDir(override) {
31259
31259
  return override || getEventsHome();
@@ -32373,7 +32373,7 @@ var init_event_sink = __esm(() => {
32373
32373
  // package.json
32374
32374
  var package_default = {
32375
32375
  name: "@hasna/skills",
32376
- version: "0.9.11",
32376
+ version: "0.9.13",
32377
32377
  description: "Skills library for AI coding agents",
32378
32378
  type: "module",
32379
32379
  bin: {
@@ -37212,8 +37212,8 @@ async function reconcileSkillSession(input, options = {}) {
37212
37212
  // src/lib/selected-run.ts
37213
37213
  import { createHash as createHash18 } from "crypto";
37214
37214
  import { spawn } from "child_process";
37215
- import { mkdirSync as mkdirSync10, mkdtempSync as mkdtempSync3, writeFileSync as writeFileSync9, realpathSync as realpathSync7 } from "fs";
37216
- import { dirname as dirname18, join as join30, resolve as resolve16 } from "path";
37215
+ import { mkdirSync as mkdirSync10, mkdtempSync as mkdtempSync3, writeFileSync as writeFileSync9, realpathSync as realpathSync8 } from "fs";
37216
+ import { dirname as dirname19, join as join31, resolve as resolve17 } from "path";
37217
37217
  import { tmpdir, hostname as stationHostname2 } from "os";
37218
37218
 
37219
37219
  // src/lib/dependency-preparation.ts
@@ -37425,18 +37425,18 @@ async function prepareSkillDependencies(skillPath, env, timeoutMs = DEFAULT_PREP
37425
37425
 
37426
37426
  // src/lib/skillinfo.ts
37427
37427
  import { existsSync as existsSync14, readFileSync as readFileSync20 } from "fs";
37428
- import { join as join29 } from "path";
37428
+ import { join as join30 } from "path";
37429
37429
 
37430
37430
  // src/lib/installer.ts
37431
37431
  import { existsSync as existsSync13, readFileSync as readFileSync19, rmSync as rmSync4 } from "fs";
37432
- import { join as join28 } from "path";
37433
- import { homedir as homedir5 } from "os";
37432
+ import { join as join29 } from "path";
37433
+ import { homedir as homedir6 } from "os";
37434
37434
 
37435
37435
  // src/lib/agent-sync.ts
37436
37436
  import {
37437
37437
  cpSync as cpSync2,
37438
37438
  existsSync as existsSync10,
37439
- lstatSync as lstatSync20,
37439
+ lstatSync as lstatSync21,
37440
37440
  mkdirSync as mkdirSync8,
37441
37441
  mkdtempSync as mkdtempSync2,
37442
37442
  readFileSync as readFileSync16,
@@ -37446,8 +37446,27 @@ import {
37446
37446
  statSync as statSync9,
37447
37447
  writeFileSync as writeFileSync7
37448
37448
  } from "fs";
37449
- import { homedir as homedir4 } from "os";
37450
- import { basename as basename9, dirname as dirname17, join as join25 } from "path";
37449
+ import { homedir as homedir5 } from "os";
37450
+ import { basename as basename10, dirname as dirname18, join as join26 } from "path";
37451
+
37452
+ // src/lib/native-discovery-roots.ts
37453
+ var NATIVE_SKILL_ROOTS = [
37454
+ ["claude", ".claude/skills"],
37455
+ ["codex", ".codex/skills"],
37456
+ ["codex", ".agents/skills"],
37457
+ ["gemini", ".gemini/skills"],
37458
+ ["codewith", ".codewith/skills"],
37459
+ ["opencode", ".config/opencode/skills"],
37460
+ ["opencode", ".opencode/skills"],
37461
+ ["cursor", ".cursor/skills"],
37462
+ ["hermes", ".hermes/skills"],
37463
+ ["windsurf", ".windsurf/skills"],
37464
+ ["pi", ".pi/agent/skills"],
37465
+ ["amp", ".amp/skills"],
37466
+ ["cline", ".cline/skills"],
37467
+ ["roo", ".roo/skills"],
37468
+ ["copilot", ".github/skills"]
37469
+ ];
37451
37470
 
37452
37471
  // src/lib/agent-integration.ts
37453
37472
  import { createHash as createHash16, randomUUID as randomUUID3 } from "crypto";
@@ -37526,10 +37545,10 @@ function assertAgentPolicyCollections(policy) {
37526
37545
  text(source.path);
37527
37546
  requireBound(source.sha256 === null || typeof source.sha256 === "string" && /^[a-f0-9]{64}$/.test(source.sha256));
37528
37547
  if (source.hashMode !== undefined)
37529
- requireBound(["bytes", "path-bytes", "claude-plugin-registry", "claude-marketplace-registry", "claude-settings-v1"].includes(source.hashMode) && source.format === undefined && source.fields === undefined && (source.hashMode === "bytes" || source.sha256 !== null));
37530
- if (source.hashMode === "claude-settings-v1")
37548
+ requireBound(["bytes", "path-bytes", "claude-plugin-registry", "claude-marketplace-registry", "claude-settings-v1", "claude-settings-v2", "claude-marketplace-registry-v2"].includes(source.hashMode) && source.format === undefined && source.fields === undefined && (source.hashMode === "bytes" || source.sha256 !== null));
37549
+ if (source.hashMode === "claude-settings-v1" || source.hashMode === "claude-settings-v2")
37531
37550
  requireBound(agent === "claude" && value.agent === "claude" && value.method === "reviewed" && !/[\x00-\x1f\x7f]/.test(source.path) && isAbsolute3(source.path) && resolve3(source.path) === source.path && basename2(source.path) === "settings.json");
37532
- if (source.hashMode === "claude-marketplace-registry")
37551
+ if (source.hashMode === "claude-marketplace-registry" || source.hashMode === "claude-marketplace-registry-v2")
37533
37552
  requireBound(agent === "claude" && value.agent === "claude" && value.method === "reviewed" && !/[\x00-\x1f\x7f]/.test(source.path) && isAbsolute3(source.path) && resolve3(source.path) === source.path && basename2(source.path) === "known_marketplaces.json");
37534
37553
  if (source.hashMode === "claude-plugin-registry") {
37535
37554
  requireBound(agent === "claude");
@@ -37812,6 +37831,48 @@ function assertHermesEnvironment(home) {
37812
37831
  if (process.env.HERMES_ENABLE_PROJECT_PLUGINS?.trim() && !["0", "false", "no", "off"].includes(process.env.HERMES_ENABLE_PROJECT_PLUGINS.trim().toLowerCase()))
37813
37832
  throw new Error("NATIVE_SKILL_DRIFT: Hermes project plugins require a dedicated discovery review");
37814
37833
  }
37834
+ function read(path) {
37835
+ for (let current = path;; current = dirname4(current)) {
37836
+ if (lstatSync7(current, { throwIfNoEntry: false })?.isSymbolicLink())
37837
+ throw new Error("NATIVE_SKILL_DRIFT: symlink Hermes protection input");
37838
+ if (dirname4(current) === current)
37839
+ break;
37840
+ }
37841
+ const stat = lstatSync7(path, { throwIfNoEntry: false });
37842
+ if (!stat)
37843
+ return null;
37844
+ if (!stat.isFile() || stat.size > 1024 * 1024)
37845
+ throw new Error("NATIVE_SKILL_DRIFT: invalid Hermes protection input");
37846
+ return readFileSync9(path, "utf8");
37847
+ }
37848
+ function assertHermesProtection(home, config, command, profile, supervisor) {
37849
+ assertHermesEnvironment(home);
37850
+ if (read(join12(home, ".hermes", HERMES_OPT_OUT)) === null)
37851
+ throw new Error("NATIVE_SKILL_DRIFT: Hermes bundled skill reseeding is not disabled; run skills hook install");
37852
+ if (!supervisor || !isAbsolute4(supervisor.path) || supervisor.runtime !== process.execPath || read(supervisor.path) !== renderHermesSupervisor(command, profile))
37853
+ throw new Error("NATIVE_SKILL_DRIFT: Hermes owned supervisor changed; run skills hook install");
37854
+ const raw = read(join12(home, ".hermes/shell-hooks-allowlist.json"));
37855
+ let trust;
37856
+ try {
37857
+ trust = raw === null ? undefined : JSON.parse(raw);
37858
+ } catch {
37859
+ throw new Error("NATIVE_SKILL_DRIFT: invalid Hermes native hook trust");
37860
+ }
37861
+ for (const [event, entry] of Object.entries(hermesHookDefinitions(supervisor))) {
37862
+ if (!Array.isArray(config.hooks?.[event]) || config.hooks[event].filter((actual) => sameEntry(actual, entry)).length !== 1)
37863
+ throw new Error("NATIVE_SKILL_DRIFT: Hermes required native hooks changed; run skills hook install");
37864
+ if (!Array.isArray(trust?.approvals) || !trust.approvals.some((approval) => object3(approval) && approval.event === event && approval.command === entry.command))
37865
+ throw new Error("NATIVE_SKILL_DRIFT: approve the exact managed commands through Hermes normal native hook trust before starting a session");
37866
+ }
37867
+ if (config.skills?.platform_disabled !== undefined && !object3(config.skills.platform_disabled))
37868
+ throw new Error("NATIVE_SKILL_DRIFT: malformed Hermes platform skill settings");
37869
+ const disabled = config.skills?.disabled;
37870
+ if (disabled !== undefined && (!Array.isArray(disabled) || disabled.some((value) => typeof value !== "string") || disabled.includes("skills-cli")))
37871
+ throw new Error("NATIVE_SKILL_DRIFT: Hermes Skills CLI bridge is disabled or its names are malformed");
37872
+ for (const names of Object.values(config.skills?.platform_disabled ?? {}))
37873
+ if (!Array.isArray(names) || names.some((value) => typeof value !== "string") || names.includes("skills-cli"))
37874
+ throw new Error("NATIVE_SKILL_DRIFT: a Hermes platform disables the Skills CLI bridge");
37875
+ }
37815
37876
  function assertNoHermesLegacyShadow(root) {
37816
37877
  let entries = 0;
37817
37878
  for (let cursor = resolve4(root);; cursor = dirname4(cursor)) {
@@ -39834,9 +39895,13 @@ function textField(value) {
39834
39895
  need2(value?.kind === "string" && value.value.length > 0 && !/[\x00-\x1f\x7f]/.test(value.value), "contains an invalid recognized field");
39835
39896
  return value.value;
39836
39897
  }
39837
- function normalizeRow(row) {
39838
- if (!exactKeys2(row, ["source", "installLocation", "lastUpdated"]))
39839
- return;
39898
+ function normalizeRow(row, version = 1) {
39899
+ if (!exactKeys2(row, ["source", "installLocation", "lastUpdated"])) {
39900
+ if (version !== 2 || !exactKeys2(row, ["source", "installLocation", "lastUpdated", "autoUpdate"]))
39901
+ return;
39902
+ const autoUpdate = field(row, "autoUpdate");
39903
+ need2(autoUpdate?.kind === "literal" && (autoUpdate.value === "true" || autoUpdate.value === "false"), "contains an invalid automatic-update preference");
39904
+ }
39840
39905
  const source = field(row, "source");
39841
39906
  if (source?.kind !== "object")
39842
39907
  return;
@@ -39863,6 +39928,13 @@ function captureClaudeMarketplaceRegistry(path, budget = { remaining: 256 * 1024
39863
39928
  const sha2562 = createHash11("sha256").update("hasna.skills.claude-marketplace-registry.v1\x00").update(JSON.stringify(value)).digest("hex");
39864
39929
  return { path, hashMode: "claude-marketplace-registry", sha256: sha2562 };
39865
39930
  }
39931
+ function captureClaudeMarketplaceRegistryV2(path, budget = { remaining: 256 * 1024 * 1024 }) {
39932
+ const value = parse5(readRegistry2(path, budget));
39933
+ for (const [, row] of value.entries)
39934
+ normalizeRow(row, 2);
39935
+ const sha2562 = createHash11("sha256").update("hasna.skills.claude-marketplace-registry.v2\x00").update(JSON.stringify(value)).digest("hex");
39936
+ return { path, hashMode: "claude-marketplace-registry-v2", sha256: sha2562 };
39937
+ }
39866
39938
 
39867
39939
  // src/lib/claude-settings-witness.ts
39868
39940
  import { createHash as createHash12 } from "crypto";
@@ -40054,9 +40126,54 @@ function canonical3(value) {
40054
40126
  return { kind: "array", items: value.items.map(canonical3) };
40055
40127
  return value;
40056
40128
  }
40057
- function settingsDigest(text2) {
40129
+ function assertClaudeStopHookReplacement(before, replacement) {
40130
+ function bounded(text2) {
40131
+ need3(typeof text2 === "string" && Buffer.byteLength(text2) <= CLAUDE_SETTINGS_WITNESS_LIMITS.bytes, "Stop update exceeds its byte limit");
40132
+ return parse6(text2);
40133
+ }
40134
+ const original = bounded(before ?? "{}"), next = bounded(replacement);
40135
+ const hadHooks = original.entries.some(([key]) => key === "hooks");
40136
+ function withoutStop(value) {
40137
+ const hooks = value.entries.find(([key]) => key === "hooks")?.[1];
40138
+ if (hooks !== undefined) {
40139
+ need3(hooks.kind === "object", "Stop update requires an object of hooks");
40140
+ const stop = hooks.entries.find(([key]) => key === "Stop")?.[1];
40141
+ need3(stop === undefined || stop.kind === "array", "Stop update requires a Stop array");
40142
+ hooks.entries = hooks.entries.filter(([key]) => key !== "Stop");
40143
+ if (!hadHooks && hooks.entries.length === 0)
40144
+ value.entries = value.entries.filter(([key]) => key !== "hooks");
40145
+ }
40146
+ return canonical3(value);
40147
+ }
40148
+ need3(JSON.stringify(withoutStop(original)) === JSON.stringify(withoutStop(next)), "Stop update changed settings outside hooks.Stop");
40149
+ }
40150
+ var PERSISTED_EFFORT_LEVELS = new Set(["low", "medium", "high", "xhigh"]);
40151
+ function inferencePreference(key, child) {
40152
+ if (key === "skipDangerousModePermissionPrompt") {
40153
+ need3(child.kind === "literal" && (child.value === "true" || child.value === "false"), "contains an invalid dialog acknowledgment");
40154
+ return true;
40155
+ }
40156
+ if (key === "effortLevel") {
40157
+ need3(child.kind === "string" && PERSISTED_EFFORT_LEVELS.has(child.value), "contains an invalid persisted effort level");
40158
+ return true;
40159
+ }
40160
+ if (key !== "modelSettings")
40161
+ return false;
40162
+ need3(child.kind === "object", "requires an object of model preferences");
40163
+ child.entries = child.entries.filter(([model, preferences]) => {
40164
+ if (!BUILTIN_MODEL_SELECTIONS.has(model) || preferences.kind !== "object" || preferences.entries.length !== 1 || preferences.entries[0][0] !== "effortLevel")
40165
+ return true;
40166
+ const effort = preferences.entries[0][1];
40167
+ need3(effort.kind === "string" && PERSISTED_EFFORT_LEVELS.has(effort.value), "contains an invalid persisted model effort level");
40168
+ return false;
40169
+ });
40170
+ return child.entries.length === 0;
40171
+ }
40172
+ function settingsDigest(text2, version = 1) {
40058
40173
  const value = parse6(text2);
40059
40174
  value.entries = value.entries.filter(([key, child]) => {
40175
+ if (version === 2 && inferencePreference(key, child))
40176
+ return false;
40060
40177
  if (key === "model") {
40061
40178
  need3(child.kind === "string", "contains an invalid model selection");
40062
40179
  return !BUILTIN_MODEL_SELECTIONS.has(child.value);
@@ -40071,7 +40188,7 @@ function settingsDigest(text2) {
40071
40188
  }
40072
40189
  return true;
40073
40190
  });
40074
- return createHash12("sha256").update("hasna.skills.claude-settings.v1\x00").update(JSON.stringify(canonical3(value))).digest("hex");
40191
+ return createHash12("sha256").update(`hasna.skills.claude-settings.v${version}\x00`).update(JSON.stringify(canonical3(value))).digest("hex");
40075
40192
  }
40076
40193
  function hashClaudeSettingsReplacement(text2, budget) {
40077
40194
  need3(typeof text2 === "string", "requires settings text");
@@ -40083,6 +40200,16 @@ function hashClaudeSettingsReplacement(text2, budget) {
40083
40200
  function captureClaudeSettings(path, budget = { remaining: 256 * 1024 * 1024 }) {
40084
40201
  return { path, hashMode: "claude-settings-v1", sha256: settingsDigest(readSettings(path, budget)) };
40085
40202
  }
40203
+ function captureClaudeSettingsV2(path, budget = { remaining: 256 * 1024 * 1024 }) {
40204
+ return { path, hashMode: "claude-settings-v2", sha256: settingsDigest(readSettings(path, budget), 2) };
40205
+ }
40206
+ function hashClaudeSettingsReplacementV2(text2, budget) {
40207
+ need3(typeof text2 === "string", "requires settings text");
40208
+ const bytes = Buffer.byteLength(text2);
40209
+ need3(bytes <= CLAUDE_SETTINGS_WITNESS_LIMITS.bytes && Number.isSafeInteger(budget.remaining) && budget.remaining >= bytes, "exceeds its byte limit");
40210
+ budget.remaining -= bytes;
40211
+ return settingsDigest(text2, 2);
40212
+ }
40086
40213
 
40087
40214
  // src/lib/codex-hook-discovery-recovery.ts
40088
40215
  import { createHash as createHash14 } from "crypto";
@@ -40174,7 +40301,7 @@ function safe4(path) {
40174
40301
  break;
40175
40302
  }
40176
40303
  }
40177
- function read(path, changes) {
40304
+ function read2(path, changes) {
40178
40305
  safe4(path);
40179
40306
  if (changes?.has(path))
40180
40307
  return changes.get(path);
@@ -40186,18 +40313,18 @@ function read(path, changes) {
40186
40313
  return readFileSync12(path, "utf8");
40187
40314
  }
40188
40315
  function projected(source, changes, budget = discoveryByteBudget()) {
40189
- if (source.hashMode === "claude-settings-v1") {
40316
+ if (source.hashMode === "claude-settings-v1" || source.hashMode === "claude-settings-v2") {
40190
40317
  if (source.format !== undefined || source.fields !== undefined || source.managedPlugins !== undefined || typeof source.sha256 !== "string" || !/^[a-f0-9]{64}$/.test(source.sha256))
40191
40318
  throw new Error("Claude settings witnesses require exact typed metadata");
40192
- const current = captureClaudeSettings(source.path, budget).sha256;
40319
+ const current = (source.hashMode === "claude-settings-v2" ? captureClaudeSettingsV2 : captureClaudeSettings)(source.path, budget).sha256;
40193
40320
  if (current !== source.sha256)
40194
40321
  throw new Error(`Native discovery input changed; run skills hook install with a fresh discovery review: ${source.path}`);
40195
- return changes?.has(source.path) ? hashClaudeSettingsReplacement(changes.get(source.path), budget) : current;
40322
+ return changes?.has(source.path) ? (source.hashMode === "claude-settings-v2" ? hashClaudeSettingsReplacementV2 : hashClaudeSettingsReplacement)(changes.get(source.path), budget) : current;
40196
40323
  }
40197
- if (source.hashMode === "claude-marketplace-registry") {
40324
+ if (source.hashMode === "claude-marketplace-registry" || source.hashMode === "claude-marketplace-registry-v2") {
40198
40325
  if (source.format !== undefined || source.fields !== undefined || source.managedPlugins !== undefined || typeof source.sha256 !== "string" || !/^[a-f0-9]{64}$/.test(source.sha256) || changes?.has(source.path))
40199
40326
  throw new Error("Claude marketplace witnesses require an exact reviewed registry without synthetic changes");
40200
- const sha2562 = captureClaudeMarketplaceRegistry(source.path, budget).sha256;
40327
+ const sha2562 = (source.hashMode === "claude-marketplace-registry-v2" ? captureClaudeMarketplaceRegistryV2 : captureClaudeMarketplaceRegistry)(source.path, budget).sha256;
40201
40328
  if (sha2562 !== source.sha256)
40202
40329
  throw new Error(`Native discovery input changed; run skills hook install with a fresh discovery review: ${source.path}`);
40203
40330
  return sha2562;
@@ -40218,7 +40345,7 @@ function projected(source, changes, budget = discoveryByteBudget()) {
40218
40345
  return hashDiscoveryPathFile(source.path, budget, changes);
40219
40346
  return hashRawDiscoveryFile(source.path, budget, changes);
40220
40347
  }
40221
- const text2 = read(source.path, changes);
40348
+ const text2 = read2(source.path, changes);
40222
40349
  if (text2 === null)
40223
40350
  return null;
40224
40351
  if (!source.format)
@@ -40254,9 +40381,9 @@ function verifyAgentDiscovery(binding, codexRecovery) {
40254
40381
  safe4(root2);
40255
40382
  }
40256
40383
  function assertMarketplaceBinding(binding, source) {
40257
- if (source.hashMode === "claude-settings-v1" && (binding.agent !== "claude" || binding.method !== "reviewed" || basename6(source.path) !== "settings.json"))
40384
+ if ((source.hashMode === "claude-settings-v1" || source.hashMode === "claude-settings-v2") && (binding.agent !== "claude" || binding.method !== "reviewed" || basename6(source.path) !== "settings.json"))
40258
40385
  throw new Error("Claude settings witnesses require explicit reviewed Claude configuration");
40259
- if (source.hashMode === "claude-marketplace-registry" && (binding.agent !== "claude" || binding.method !== "reviewed"))
40386
+ if ((source.hashMode === "claude-marketplace-registry" || source.hashMode === "claude-marketplace-registry-v2") && (binding.agent !== "claude" || binding.method !== "reviewed"))
40260
40387
  throw new Error("Claude marketplace witnesses require explicit reviewed Claude discovery");
40261
40388
  }
40262
40389
  function rebindAgentDiscovery(binding, changes) {
@@ -40278,6 +40405,49 @@ function captureDiscoveryPathSources(paths) {
40278
40405
  const budget = discoveryByteBudget();
40279
40406
  return paths.map((path) => ({ path, hashMode: "path-bytes", sha256: hashDiscoveryPathFile(path, budget) }));
40280
40407
  }
40408
+ function assertProjectDiscovery(agent, directories, home, canonical4 = resolve13, reviewed) {
40409
+ for (const directory of directories) {
40410
+ const isHome = resolve13(directory) === resolve13(home);
40411
+ if (agent === "hermes") {
40412
+ assertHermesEnvironment(home);
40413
+ continue;
40414
+ }
40415
+ if (isHome && agent !== "claude")
40416
+ continue;
40417
+ const paths = agent === "claude" ? [...isHome ? [] : [".claude/settings.json"], ".claude/settings.local.json"] : agent === "codex" ? [".codex/config.toml"] : agent === "gemini" ? [".gemini/settings.json"] : agent === "opencode" ? ["opencode.json", "opencode.jsonc", ".opencode/opencode.json", ".opencode/opencode.jsonc"] : [".cursor/hooks.json"];
40418
+ for (const suffix of paths) {
40419
+ const path = canonical4(join20(directory, suffix)), raw = read2(path);
40420
+ if (raw === null)
40421
+ continue;
40422
+ if (agent === "claude" && suffix === ".claude/settings.json" && path === canonical4(join20(home, suffix)))
40423
+ continue;
40424
+ if (suffix.endsWith(".jsonc"))
40425
+ throw new Error(`NATIVE_SKILL_DRIFT: project JSONC discovery configuration requires review: ${path}`);
40426
+ const config = parseConfig(raw, path, suffix.endsWith(".toml"));
40427
+ const keys2 = agent === "claude" ? ["enabledPlugins", "extraKnownMarketplaces", "skillOverrides"] : agent === "codex" ? ["plugins", "marketplaces", "skills"] : agent === "gemini" ? ["skills", "extensions"] : agent === "opencode" ? ["plugin", "skills"] : ["hooks"];
40428
+ let admittedPlugins = false;
40429
+ if (agent === "claude" && reviewed?.agent === agent && reviewed.method === "reviewed" && config.enabledPlugins && typeof config.enabledPlugins === "object" && !Array.isArray(config.enabledPlugins)) {
40430
+ const exact = reviewed.sources.find((source) => source.path === path && source.format === undefined && source.fields === undefined && (source.hashMode === undefined || source.hashMode === "bytes"));
40431
+ const managed = reviewed.sources.flatMap((source) => source.hashMode === "claude-plugin-registry" ? source.managedPlugins ?? [] : []);
40432
+ if (exact && projected(exact) === exact.sha256 && managed.length) {
40433
+ const bindings = managed.map((item) => readPluginBinding(item.storeRoot, item.bindingId));
40434
+ admittedPlugins = Object.entries(config.enabledPlugins).every(([id2, enabled]) => typeof enabled === "boolean" && bindings.some((binding) => binding.target.pluginId === id2 && binding.target.registrations.some((scope) => scope.scope === "project" && scope.projectPath === canonical4(directory))));
40435
+ }
40436
+ }
40437
+ if (keys2.some((key) => config[key] !== undefined && !(key === "enabledPlugins" && admittedPlugins)) || config.disableAllHooks === true || config.disableBundledSkills === false || config.hooksConfig?.enabled === false || config.permission?.skill !== undefined || config.permissions?.deny?.some((rule) => typeof rule === "string" && /^Skill(?:\(|$)/.test(rule)))
40438
+ throw new Error(`NATIVE_SKILL_DRIFT: higher-precedence project skill or hook configuration requires review: ${path}`);
40439
+ }
40440
+ if (agent === "claude") {
40441
+ const commands = canonical4(join20(directory, ".claude/commands"));
40442
+ safe4(commands);
40443
+ if (lstatSync17(commands, { throwIfNoEntry: false })?.isDirectory() && readdirSync6(commands).length)
40444
+ throw new Error("NATIVE_SKILL_DRIFT: legacy project command discovery requires a dedicated format adapter");
40445
+ }
40446
+ }
40447
+ }
40448
+ function agentDiscoveryConfigPath(home, agent) {
40449
+ return join20(home, agent === "hermes" ? ".hermes/config.yaml" : agent === "opencode" ? ".config/opencode/opencode.json" : `.${agent}/${agent === "codex" ? "config.toml" : agent === "cursor" ? "hooks.json" : "settings.json"}`);
40450
+ }
40281
40451
  function resolveAgentDiscovery(options) {
40282
40452
  const canonical4 = options.canonical ?? resolve13, home = resolve13(options.home), agent = options.agent;
40283
40453
  const sources = [], roots = new Set, builtinNames = [];
@@ -40285,11 +40455,11 @@ function resolveAgentDiscovery(options) {
40285
40455
  const source = { path: canonical4(path), sha256: null, ...format ? { format, fields } : {} };
40286
40456
  source.sha256 = projected(source);
40287
40457
  sources.push(source);
40288
- return read(source.path);
40458
+ return read2(source.path);
40289
40459
  };
40290
40460
  if (agent === "hermes")
40291
40461
  assertHermesEnvironment(home);
40292
- const configPath = join20(home, agent === "hermes" ? ".hermes/config.yaml" : agent === "opencode" ? ".config/opencode/opencode.json" : `.${agent}/${agent === "codex" ? "config.toml" : agent === "cursor" ? "hooks.json" : "settings.json"}`);
40462
+ const configPath = agentDiscoveryConfigPath(home, agent);
40293
40463
  const configText = witness(configPath, agent === "hermes" ? "yaml" : agent === "codex" ? "toml" : "json", agent === "hermes" ? ["skills", "plugins", "hooks"] : agent === "claude" ? ["enabledPlugins", "extraKnownMarketplaces"] : agent === "codex" ? ["plugins", "marketplaces", "skills"] : agent === "gemini" ? ["skills", "extensions", "security"] : agent === "opencode" ? ["plugin", "skills"] : ["version"]);
40294
40464
  const config = configText === null ? {} : agent === "hermes" ? parseHermesConfig(configText) : parseConfig(configText, configPath, agent === "codex");
40295
40465
  const unresolved = (detail) => {
@@ -40320,7 +40490,7 @@ function resolveAgentDiscovery(options) {
40320
40490
  if (executable) {
40321
40491
  let packageRoot;
40322
40492
  for (let directory = dirname13(realpathSync3(executable)), depth = 0;depth < 8; directory = dirname13(directory), depth++) {
40323
- const path = join20(directory, "package.json"), raw = read(path);
40493
+ const path = join20(directory, "package.json"), raw = read2(path);
40324
40494
  if (raw !== null && parseConfig(raw, path).name === "@google/gemini-cli") {
40325
40495
  packageRoot = directory;
40326
40496
  witness(path);
@@ -40354,7 +40524,7 @@ function resolveAgentDiscovery(options) {
40354
40524
  if (review.sources.some((source) => source.format !== undefined || source.fields !== undefined))
40355
40525
  throw new Error("Explicit discovery reviews require full source-file hashes");
40356
40526
  verifyAgentDiscovery(supplied);
40357
- if (review.sources.some((source) => source.hashMode === "claude-settings-v1" && source.path !== canonical4(configPath)))
40527
+ if (review.sources.some((source) => (source.hashMode === "claude-settings-v1" || source.hashMode === "claude-settings-v2") && source.path !== canonical4(configPath)))
40358
40528
  throw new Error("Semantic settings witnesses must name the configured Claude configuration source");
40359
40529
  if (!review.sources.some((source) => source.path === canonical4(configPath)))
40360
40530
  throw new Error("Discovery review must include the agent configuration source");
@@ -40612,23 +40782,7 @@ function disableCodexBundledSkills(text2) {
40612
40782
 
40613
40783
  // src/lib/agent-integration.ts
40614
40784
  var sha2 = (data) => createHash16("sha256").update(data).digest("hex");
40615
- var ROOTS = [
40616
- ["claude", ".claude/skills"],
40617
- ["codex", ".codex/skills"],
40618
- ["codex", ".agents/skills"],
40619
- ["gemini", ".gemini/skills"],
40620
- ["codewith", ".codewith/skills"],
40621
- ["opencode", ".config/opencode/skills"],
40622
- ["opencode", ".opencode/skills"],
40623
- ["cursor", ".cursor/skills"],
40624
- ["hermes", ".hermes/skills"],
40625
- ["windsurf", ".windsurf/skills"],
40626
- ["pi", ".pi/agent/skills"],
40627
- ["amp", ".amp/skills"],
40628
- ["cline", ".cline/skills"],
40629
- ["roo", ".roo/skills"],
40630
- ["copilot", ".github/skills"]
40631
- ];
40785
+ var ROOTS = NATIVE_SKILL_ROOTS;
40632
40786
  function assertSafePath(path) {
40633
40787
  let cursor = resolve14(path);
40634
40788
  while (true) {
@@ -40925,6 +41079,22 @@ function configureHooks(config, agent, command, profileId, nativeReady) {
40925
41079
  if (!Array.isArray(existing))
40926
41080
  throw new Error(`Expected ${event} hooks array`);
40927
41081
  const hookCommand = renderAgentHookCommand(command, agent, profileId, event);
41082
+ if (agent === "codex") {
41083
+ let ownedIndex = -1;
41084
+ for (const [index, entry] of existing.entries()) {
41085
+ if (!entry || !Array.isArray(entry.hooks))
41086
+ throw new Error(`Malformed ${event} hook entry`);
41087
+ const owned = entry.hooks.filter((hook) => hook?.type === "command" && typeof hook.command === "string" && /(?:^|\s)hook user-prompt --agent codex(?: --selection-profile [A-Za-z0-9._-]+)?(?: --event [A-Za-z]+)?$/.test(hook.command));
41088
+ if (!owned.length)
41089
+ continue;
41090
+ if (ownedIndex !== -1 || entry.hooks.length !== 1 || Object.keys(entry).length !== 1)
41091
+ throw new Error(`Review ambiguous ${event} Codex Skills hook groups before installation; unrelated native hook positions must be preserved`);
41092
+ ownedIndex = index;
41093
+ }
41094
+ const replacement = { hooks: [{ type: "command", command: hookCommand, timeout: 15 }] };
41095
+ config.hooks[event] = ownedIndex === -1 ? [...existing, replacement] : existing.map((entry, index) => index === ownedIndex ? replacement : entry);
41096
+ continue;
41097
+ }
40928
41098
  const retained = existing.flatMap((entry) => {
40929
41099
  if (agent === "cursor") {
40930
41100
  if (!entry || typeof entry.command !== "string")
@@ -41130,6 +41300,62 @@ function planAgentIntegration(options) {
41130
41300
  recheckRootAliases(aliases);
41131
41301
  return { dataDir: dataDir2, profileId, changes, nativeSkills, observedPolicy: { path: policyPath, before: previousPolicy }, discoveryBefore: discoveries, discoveryAfter, ...aliases.length ? { rootAliases: aliases } : {} };
41132
41302
  }
41303
+ function planClaudeStopHookUpdate(options) {
41304
+ const home = resolve14(options.home ?? homedir3()), dataDir2 = options.dataDir ?? getDataDirReadOnly();
41305
+ const policyPath = join21(dataDir2, "agent-policy.json");
41306
+ assertSafePath(policyPath);
41307
+ const snapshot2 = readManagedSkillPolicySnapshot(dataDir2);
41308
+ if (!snapshot2)
41309
+ return null;
41310
+ const policy = snapshot2.value, bridge = policy.bridge;
41311
+ if (!bridge || bridge.home !== home || bridge.version !== CLI_BRIDGE_VERSION || bridge.digest !== CLI_BRIDGE_DIGEST || !Array.isArray(bridge.agents) || !bridge.agents.length || bridge.agents.some((agent) => !INTEGRATION_AGENTS.includes(agent)) || new Set(bridge.agents).size !== bridge.agents.length || !bridge.discovery || typeof bridge.discovery !== "object" || Array.isArray(bridge.discovery)) {
41312
+ throw new Error("Invalid managed bridge for Claude settings update");
41313
+ }
41314
+ const aliases = bridge.rootAliases ?? [];
41315
+ recheckRootAliases(aliases);
41316
+ const path = canonicalAgentPath(join21(home, ".claude", "settings.json"), aliases);
41317
+ assertSafePath(path);
41318
+ const before = lstatSync18(path, { throwIfNoEntry: false }) ? new TextDecoder("utf-8", { fatal: true, ignoreBOM: true }).decode(readNativeBytes(path, 1024 * 1024)) : null;
41319
+ if ((before === null ? "absent" : sha2(before)) !== options.expectedSettingsSha256)
41320
+ throw new Error("Claude settings preimage changed");
41321
+ assertClaudeStopHookReplacement(before, options.replacement);
41322
+ const agents = bridge.agents;
41323
+ const discoveries = Object.entries(bridge.discovery).map(([agent, binding]) => {
41324
+ if (!agents.includes(agent) || binding?.agent !== agent)
41325
+ throw new Error("Invalid managed discovery owner");
41326
+ return binding;
41327
+ });
41328
+ if (discoveries.length !== agents.length)
41329
+ throw new Error("Missing managed discovery coverage");
41330
+ for (const agent of agents)
41331
+ assertManagedAgentBridge(agent, { home, dataDir: dataDir2, projectDir: home });
41332
+ const replacements = new Map(before === options.replacement ? [] : [[path, options.replacement]]);
41333
+ const discoveryAfter = discoveries.map((binding) => rebindAgentDiscovery(binding, replacements));
41334
+ const nextPolicy = { ...policy, bridge: { ...bridge, discovery: Object.fromEntries(discoveryAfter.map((binding) => [binding.agent, binding])) } };
41335
+ const changes = before === options.replacement ? [] : [{ path, before, after: options.replacement }];
41336
+ if (JSON.stringify(nextPolicy) !== JSON.stringify(policy))
41337
+ changes.push({ path: policyPath, before: snapshot2.text, after: serializeManagedSkillPolicy(nextPolicy) });
41338
+ recheckRootAliases(aliases);
41339
+ const nativeSkills = inventoryNativeSkills(home, {
41340
+ agents,
41341
+ projectDir: home,
41342
+ includeVendor: true,
41343
+ guardHermes: agents.includes("hermes"),
41344
+ allowRootAliases: aliases.length > 0,
41345
+ agentRoots: discoveries.flatMap((binding) => binding.roots.map((path2) => ({ agent: binding.agent, path: path2 })))
41346
+ });
41347
+ return {
41348
+ dataDir: dataDir2,
41349
+ profileId: policy.profileId ?? "default",
41350
+ changes,
41351
+ nativeSkills,
41352
+ observedPolicy: { path: policyPath, before: snapshot2.text },
41353
+ discoveryBefore: discoveries,
41354
+ discoveryAfter,
41355
+ rootAliases: aliases,
41356
+ managedAgentChecks: { home, agents: [...agents] }
41357
+ };
41358
+ }
41133
41359
  function atomicWrite2(path, content) {
41134
41360
  assertSafePath(path);
41135
41361
  mkdirSync5(dirname14(path), { recursive: true, mode: 448 });
@@ -41152,6 +41378,8 @@ function applyAgentIntegration(plan) {
41152
41378
  parseManagedSkillPolicy(change.after);
41153
41379
  const aliases = plan.rootAliases ?? [];
41154
41380
  recheckRootAliases(aliases);
41381
+ for (const agent of plan.managedAgentChecks?.agents ?? [])
41382
+ assertManagedAgentBridge(agent, { home: plan.managedAgentChecks.home, dataDir: plan.dataDir, projectDir: plan.managedAgentChecks.home });
41155
41383
  for (const binding of plan.discoveryBefore ?? [])
41156
41384
  verifyAgentDiscovery(binding);
41157
41385
  if (plan.observedPolicy && currentText(plan.observedPolicy.path) !== plan.observedPolicy.before)
@@ -41187,6 +41415,8 @@ function applyAgentIntegration(plan) {
41187
41415
  recheckRootAliases(aliases);
41188
41416
  for (const binding of plan.discoveryAfter ?? [])
41189
41417
  verifyAgentDiscovery(binding);
41418
+ for (const agent of plan.managedAgentChecks?.agents ?? [])
41419
+ assertManagedAgentBridge(agent, { home: plan.managedAgentChecks.home, dataDir: plan.dataDir, projectDir: plan.managedAgentChecks.home });
41190
41420
  atomicWrite2(join21(backupRoot, "receipt.json"), JSON.stringify({ version: 1, changes: written.map((change) => ({ path: change.path, beforeHash: change.before === null ? null : sha2(change.before), afterHash: sha2(change.after) })), backups, ...aliases.length ? { rootAliases: aliases } : {} }) + `
41191
41421
  `);
41192
41422
  } catch (error) {
@@ -41367,6 +41597,97 @@ function archiveNativeSkills(inventory, options) {
41367
41597
  }
41368
41598
  return { entries: entries.map(({ status, conflict, ...entry }) => entry), receiptPath, ...targetManifest ? { targetManifest } : {}, ...aliases.length ? { rootAliases: aliases } : {} };
41369
41599
  }
41600
+ function assertManagedAgentBridge(agent, options = {}) {
41601
+ const home = resolve14(options.home ?? homedir3()), dataDir2 = options.dataDir ?? getDataDirReadOnly();
41602
+ assertSafePath(join21(dataDir2, "agent-policy.json"));
41603
+ const snapshot2 = readManagedSkillPolicySnapshot(dataDir2);
41604
+ if (!snapshot2)
41605
+ throw new Error("NATIVE_SKILL_DRIFT: install the Skills bridge with skills hook install");
41606
+ const binding = snapshot2.value.bridge;
41607
+ if (!binding || binding.version !== CLI_BRIDGE_VERSION || binding.digest !== CLI_BRIDGE_DIGEST || binding.home !== home || !Array.isArray(binding.agents) || !binding.agents.includes(agent))
41608
+ throw new Error("NATIVE_SKILL_DRIFT: the managed Skills bridge binding is missing or incompatible; run skills hook install");
41609
+ const aliases = binding.rootAliases ?? [];
41610
+ if (!Array.isArray(aliases))
41611
+ throw new Error("NATIVE_SKILL_DRIFT: invalid root alias binding");
41612
+ recheckRootAliases(aliases);
41613
+ const expected = canonicalAgentPath(join21(home, AGENT_ADAPTERS[agent].root, CLI_BRIDGE_NAME), aliases);
41614
+ if (!isOwnedCliBridge(expected, [expected]))
41615
+ throw new Error("NATIVE_SKILL_DRIFT: the native Skills bridge is missing or modified; repair it before continuing");
41616
+ const roots = projectAncestorDirectories([options.projectDir ?? process.cwd(), ...options.projectDirs ?? [], ...agent === "hermes" && process.env.TERMINAL_CWD ? [process.cwd()] : []]);
41617
+ const visible = (entry) => entry.agent === agent || ["codex", "gemini", "opencode", "hermes"].includes(agent) && entry.path.includes(`${sep4}.agents${sep4}skills${sep4}`) || agent === "opencode" && entry.agent === "claude";
41618
+ const discovery = binding.discovery?.[agent];
41619
+ assertProjectDiscovery(agent, [...roots], home, (path) => canonicalAgentPath(path, aliases), discovery);
41620
+ const configPath = canonicalAgentPath(join21(home, AGENT_ADAPTERS[agent].config), aliases), config = agent === "hermes" ? parseHermesConfig(readOptional(configPath)) : jsonObject(readOptional(configPath), configPath);
41621
+ const command = binding.commands?.[agent], profile = binding.profiles?.[agent];
41622
+ if (typeof command !== "string" || typeof profile !== "string")
41623
+ throw new Error("NATIVE_SKILL_DRIFT: the native hook command/profile binding is missing");
41624
+ if (options.profileId !== undefined && options.profileId !== profile)
41625
+ throw new Error("NATIVE_SKILL_DRIFT: the hook selection profile differs from its managed binding; restart the native client after reviewing skills hook install");
41626
+ if (agent === "hermes") {
41627
+ const supervisor = binding.supervisors?.hermes;
41628
+ if (supervisor?.path !== join21(dataDir2, "agent-hooks", "hermes.js") || supervisor?.sha256 !== sha2(renderHermesSupervisor(command, profile)))
41629
+ throw new Error("NATIVE_SKILL_DRIFT: Hermes supervisor binding changed; run skills hook install");
41630
+ assertHermesProtection(home, config, command, profile, supervisor);
41631
+ } else if (agent === "opencode") {
41632
+ if (JSON.stringify(config.permission?.skill) !== JSON.stringify({ "*": "deny", [CLI_BRIDGE_NAME]: "allow" }) || readOptional(join21(home, ".config", "opencode", "plugins", "skills-cli.js")) !== renderOpenCodePlugin(command, profile))
41633
+ throw new Error("NATIVE_SKILL_DRIFT: OpenCode bridge protection changed; run skills hook install");
41634
+ } else {
41635
+ const required = {};
41636
+ configureHooks(required, agent, command, profile, true);
41637
+ for (const [event, entries] of Object.entries(required.hooks))
41638
+ for (const entry of entries) {
41639
+ if (!Array.isArray(config.hooks?.[event]) || config.hooks[event].filter((actual) => JSON.stringify(actual) === JSON.stringify(entry)).length !== 1)
41640
+ throw new Error("NATIVE_SKILL_DRIFT: required native prompt/skill hooks changed; run skills hook install");
41641
+ }
41642
+ if (agent === "claude" && (config.disableBundledSkills !== true || config.disableAllHooks === true || !config.permissions?.allow?.includes(`Skill(${CLI_BRIDGE_NAME})`) || config.permissions?.deny?.includes("Skill")))
41643
+ throw new Error("NATIVE_SKILL_DRIFT: Claude bridge or bundled-skill protection changed; retire copies and run skills hook install");
41644
+ if (agent === "claude" && config.syncClaudeAiSkills !== false)
41645
+ throw new Error("NATIVE_SKILL_DRIFT: Claude account skill synchronization is not disabled (syncClaudeAiSkills); run skills hook install to prevent native copies from returning");
41646
+ if (agent === "gemini" && (config.hooksConfig?.enabled === false || config.skills?.enabled !== true || !["antigravity-support", "skill-creator"].every((name) => config.skills?.disabled?.includes(name)) || config.skills?.disabled?.includes(CLI_BRIDGE_NAME)))
41647
+ throw new Error("NATIVE_SKILL_DRIFT: Gemini bridge or bundled-skill protection changed; run skills hook install");
41648
+ }
41649
+ const codexPath = canonicalAgentPath(join21(home, ".codex", "config.toml"), aliases);
41650
+ if (options.codexDiscoveryRecovery && (agent !== "codex" || options.codexDiscoveryRecovery.configPath !== codexPath))
41651
+ throw new Error("NATIVE_SKILL_DRIFT: Codex trust recovery names a different configuration root");
41652
+ const codexConfig = agent === "codex" ? Bun.TOML.parse(readOptional(codexPath) ?? "") : {};
41653
+ if (agent === "codex" && codexConfig.skills?.bundled?.enabled !== false)
41654
+ throw new Error("NATIVE_SKILL_DRIFT: Codex bundled skill reseeding is not disabled (skills.bundled.enabled); run skills hook install");
41655
+ const setting = (path) => (codexConfig.skills?.config ?? []).filter((entry) => typeof entry.path === "string" && [path, join21(path, "SKILL.md")].includes(canonicalAgentPath(entry.path, aliases)));
41656
+ if (agent === "codex" && [...setting(expected), ...(codexConfig.skills?.config ?? []).filter((entry) => typeof entry.name === "string" && entry.name.trim() === CLI_BRIDGE_NAME)].some((entry) => entry.enabled === false))
41657
+ throw new Error("NATIVE_SKILL_DRIFT: the Codex CLI bridge is disabled; run skills hook install");
41658
+ const disabledBuiltin = (entry) => {
41659
+ if (agent !== "codex" || !entry.vendor || !entry.path.startsWith(canonicalAgentPath(join21(home, ".codex", "skills", ".system"), aliases) + sep4))
41660
+ return false;
41661
+ const matched = Array.isArray(binding.disabledBuiltins) && binding.disabledBuiltins.some((item) => item.path === entry.path && item.hash === entry.hash);
41662
+ const settings = setting(entry.path);
41663
+ return matched && settings.length === 1 && settings[0]?.enabled === false;
41664
+ };
41665
+ if (!discovery || discovery.agent !== agent)
41666
+ throw new Error("NATIVE_SKILL_DRIFT: native discovery coverage is missing; run skills hook install");
41667
+ if (agent === "gemini" && !discovery.builtinNames?.every((name) => config.skills.disabled.includes(name)))
41668
+ throw new Error("NATIVE_SKILL_DRIFT: an installed Gemini builtin is not disabled");
41669
+ try {
41670
+ verifyAgentDiscovery(discovery, options.codexDiscoveryRecovery);
41671
+ if (discovery.method === "automatic") {
41672
+ const current = resolveAgentDiscovery({ home, agent, canonical: (path) => canonicalAgentPath(path, aliases) });
41673
+ if (JSON.stringify(current) !== JSON.stringify(discovery))
41674
+ throw new Error("Configured native discovery roots changed");
41675
+ }
41676
+ } catch (error) {
41677
+ throw new Error(`NATIVE_SKILL_DRIFT: ${error.message}`);
41678
+ }
41679
+ const inventory = inventoryNativeSkills(home, { includeVendor: true, guardHermes: agent === "hermes", agents: [agent], projectDirs: [...roots], agentRoots: discovery.roots.map((path) => ({ agent, path })), allowRootAliases: aliases.length > 0 });
41680
+ const unexpected = inventory.filter((entry) => visible(entry) && !entry.bridge && !disabledBuiltin(entry));
41681
+ if (unexpected.length) {
41682
+ const paths = unexpected.slice(0, 3).map((entry) => {
41683
+ const escaped = JSON.stringify(entry.path).replace(/[\u007f-\u009f\u061c\u200e\u200f\u2028-\u202e\u2066-\u2069]/g, (character) => `\\u${character.charCodeAt(0).toString(16).padStart(4, "0")}`);
41684
+ return escaped.length > 768 ? `${escaped.slice(0, 384)}...${escaped.slice(-381)}` : escaped;
41685
+ });
41686
+ const remaining = unexpected.length - paths.length;
41687
+ throw new Error(`NATIVE_SKILL_DRIFT: ${unexpected.length} unexpected native skill copies were found: ${paths.join(", ")}${remaining ? `; ${remaining} more` : ""}. Review skills migrate native --project <working-directory> --include-unmanaged --include-vendor --json before continuing; it inventories that directory and its ancestors. Use --apply after reviewing the archive plan.`);
41688
+ }
41689
+ recheckRootAliases(aliases);
41690
+ }
41370
41691
  function assertNativeExportAllowed(dataDir2 = getDataDirReadOnly()) {
41371
41692
  if (requiresCliSkillLoading(dataDir2))
41372
41693
  throw new Error("NATIVE_SKILL_EXPORT_DISABLED: this station loads skills through the Skills CLI; use skills sync --selection-profile <id>");
@@ -41378,13 +41699,13 @@ import {
41378
41699
  mkdirSync as mkdirSync7,
41379
41700
  mkdtempSync,
41380
41701
  readdirSync as readdirSync9,
41381
- realpathSync as realpathSync6,
41702
+ realpathSync as realpathSync7,
41382
41703
  renameSync as renameSync4,
41383
41704
  rmSync as rmSync2,
41384
41705
  statSync as statSync8,
41385
41706
  writeFileSync as writeFileSync6
41386
41707
  } from "fs";
41387
- import { basename as basename8, dirname as dirname16, isAbsolute as isAbsolute16, join as join24, normalize as normalize2, relative as relative5, resolve as resolve15, sep as sep6 } from "path";
41708
+ import { basename as basename9, dirname as dirname17, isAbsolute as isAbsolute16, join as join25, normalize as normalize2, relative as relative5, resolve as resolve16, sep as sep7 } from "path";
41388
41709
 
41389
41710
  // src/lib/registry-data/index.ts
41390
41711
  var SKILLS = [];
@@ -41834,7 +42155,7 @@ function validatePortableManifestContract(manifest, options = {}) {
41834
42155
  function validateRuntimeContract(manifest, issues, strict) {
41835
42156
  const runtime = manifest.runtime;
41836
42157
  if (runtime === undefined) {
41837
- if (strict) {
42158
+ if (strict && manifest.kind !== "instruction") {
41838
42159
  add2(issues, "contract.runtime_missing", "runtime contract is required: { runtime, entrypoint?, timeout?, needs_network?, env?, sandbox?, system_deps?, artifacts? }");
41839
42160
  }
41840
42161
  return;
@@ -42021,7 +42342,6 @@ function createInstructionManifest(name, options) {
42021
42342
  kind: "instruction",
42022
42343
  inputs: [],
42023
42344
  commands: [],
42024
- runtime: defaultRuntimeContract(),
42025
42345
  provenance: defaultProvenance()
42026
42346
  };
42027
42347
  }
@@ -42090,7 +42410,7 @@ function fillContractDefaults(manifest, entrypoint) {
42090
42410
  return {
42091
42411
  ...manifest,
42092
42412
  standard: PORTABLE_SKILL_STANDARD,
42093
- runtime: manifest.runtime ?? defaultRuntimeContract(resolvedEntrypoint),
42413
+ ...manifest.kind === "instruction" ? {} : { runtime: manifest.runtime ?? defaultRuntimeContract(resolvedEntrypoint) },
42094
42414
  provenance: {
42095
42415
  ...defaultProvenance(),
42096
42416
  ...manifest.provenance ?? {}
@@ -42552,6 +42872,103 @@ function displayName(name) {
42552
42872
  function escapeJsString(value) {
42553
42873
  return value.replace(/\\/g, "\\\\").replace(/"/g, "\\\"").replace(/\r?\n/g, " ");
42554
42874
  }
42875
+
42876
+ // src/lib/authoring-path.ts
42877
+ import { lstatSync as lstatSync20, realpathSync as realpathSync6 } from "fs";
42878
+ import { homedir as homedir4 } from "os";
42879
+ import { basename as basename8, dirname as dirname16, join as join24, resolve as resolve15, sep as sep6 } from "path";
42880
+ var NATIVE_DISCOVERY_ROOTS = NATIVE_SKILL_ROOTS.map(([, path]) => path.split("/"));
42881
+ function pathParts(path) {
42882
+ return resolve15(path).split(sep6).filter(Boolean);
42883
+ }
42884
+ function nativeRootMatch(path) {
42885
+ const parts = pathParts(path);
42886
+ for (let start = 0;start < parts.length; start += 1) {
42887
+ for (const root2 of NATIVE_DISCOVERY_ROOTS) {
42888
+ if (root2.every((part, offset) => parts[start + offset] === part)) {
42889
+ return root2.join("/");
42890
+ }
42891
+ }
42892
+ }
42893
+ return;
42894
+ }
42895
+ function physicalPath(path) {
42896
+ let cursor = resolve15(path);
42897
+ const suffix = [];
42898
+ while (!lstatSync20(cursor, { throwIfNoEntry: false })) {
42899
+ suffix.unshift(basename8(cursor));
42900
+ const parent = dirname16(cursor);
42901
+ if (parent === cursor)
42902
+ return resolve15(path);
42903
+ cursor = parent;
42904
+ }
42905
+ return resolve15(realpathSync6(cursor), ...suffix);
42906
+ }
42907
+ function contains(root2, path) {
42908
+ return path === root2 || path.startsWith(root2 + sep6);
42909
+ }
42910
+ function configuredRoots(home, explicitHome) {
42911
+ const homeData = join24(home, ".hasna", "skills");
42912
+ const homePolicy = readManagedSkillPolicySnapshot(homeData);
42913
+ const configuredPolicy = !explicitHome && resolve15(getDataDirReadOnly()) !== resolve15(homeData) ? readManagedSkillPolicySnapshot(getDataDirReadOnly()) : null;
42914
+ const policy = homePolicy ?? configuredPolicy;
42915
+ const bridge = policy?.value.bridge;
42916
+ if (bridge && (typeof bridge.home !== "string" || physicalPath(bridge.home) !== physicalPath(home))) {
42917
+ throw new Error("Native discovery policy belongs to a different home; refusing portable authoring");
42918
+ }
42919
+ const roots = [];
42920
+ const admitBinding = (binding) => {
42921
+ if (!INTEGRATION_AGENTS.includes(binding.agent) || !binding.sources.some((source) => source.path === physicalPath(agentDiscoveryConfigPath(home, binding.agent)))) {
42922
+ throw new Error("Native discovery policy does not bind the current account configuration");
42923
+ }
42924
+ verifyAgentDiscovery(binding);
42925
+ roots.push(...binding.roots);
42926
+ };
42927
+ if (homePolicy && configuredPolicy?.value.bridge) {
42928
+ if (physicalPath(configuredPolicy.value.bridge.home) !== physicalPath(home))
42929
+ throw new Error("Native discovery policy belongs to a different home; refusing portable authoring");
42930
+ for (const binding of Object.values(configuredPolicy.value.bridge.discovery ?? {})) {
42931
+ admitBinding(binding);
42932
+ }
42933
+ }
42934
+ for (const agent of INTEGRATION_AGENTS) {
42935
+ const binding = bridge?.discovery?.[agent];
42936
+ if (binding !== undefined) {
42937
+ if (binding.agent !== agent)
42938
+ throw new Error("Invalid native discovery policy binding");
42939
+ admitBinding(binding);
42940
+ continue;
42941
+ }
42942
+ const nativeHome = join24(home, agent === "opencode" ? ".config/opencode" : `.${agent}`);
42943
+ if (!lstatSync20(nativeHome, { throwIfNoEntry: false }))
42944
+ continue;
42945
+ roots.push(...resolveAgentDiscovery({ home, agent, canonical: physicalPath }).roots);
42946
+ }
42947
+ return roots;
42948
+ }
42949
+ function assertPortableAuthoringPath(path, options = {}) {
42950
+ if (typeof path !== "string" || !path || path.includes("\x00"))
42951
+ throw new Error("Invalid portable authoring path");
42952
+ const lexical = resolve15(path);
42953
+ const physical = physicalPath(lexical);
42954
+ const candidates = [lexical, physical];
42955
+ let native = candidates.map(nativeRootMatch).find(Boolean);
42956
+ const home = resolve15(options.homeDir ?? homedir4());
42957
+ const defaults = NATIVE_DISCOVERY_ROOTS.map((parts) => join24(home, ...parts));
42958
+ defaults.push(join24(home, ".codex/plugins/cache"), join24(home, ".claude/plugins/cache"), join24(home, ".claude/plugins/synced"), join24(home, ".gemini/extensions"));
42959
+ for (const root2 of defaults) {
42960
+ if (candidates.some((candidate2) => contains(resolve15(root2), candidate2) || contains(physicalPath(root2), candidate2)))
42961
+ native ??= root2;
42962
+ }
42963
+ if (native) {
42964
+ throw new Error(`Refusing portable Skills authoring below native discovery root '${native}': ${lexical}. Set HASNA_SKILLS_DIR to a private authoring corpus outside native roots.`);
42965
+ }
42966
+ for (const root2 of configuredRoots(home, options.homeDir !== undefined)) {
42967
+ if (candidates.some((candidate2) => contains(resolve15(root2), candidate2) || contains(physicalPath(root2), candidate2))) {
42968
+ throw new Error(`Refusing portable Skills authoring below configured native discovery root: ${lexical}`);
42969
+ }
42970
+ }
42971
+ }
42555
42972
  // src/lib/portable-skills.ts
42556
42973
  function getPortableSkillsRoot(options = {}) {
42557
42974
  return resolvePortableSkillsRoot(options, true);
@@ -42559,15 +42976,15 @@ function getPortableSkillsRoot(options = {}) {
42559
42976
  function resolvePortableSkillsRoot(options, migrate) {
42560
42977
  if (options.rootDir)
42561
42978
  return options.rootDir;
42562
- const appDir = options.homeDir ? join24(options.homeDir, ".hasna", "skills") : migrate ? getDataDir() : getDataDirReadOnly();
42563
- const cache = join24(appDir, SKILLS_CACHE_DIRNAME);
42979
+ const appDir = options.homeDir ? join25(options.homeDir, ".hasna", "skills") : migrate ? getDataDir() : getDataDirReadOnly();
42980
+ const cache = join25(appDir, SKILLS_CACHE_DIRNAME);
42564
42981
  if (isOwnerLayoutMigrated(appDir) && safeIsDirectory(cache))
42565
42982
  return cache;
42566
- const installed = join24(appDir, INSTALLED_SKILLS_DIRNAME);
42983
+ const installed = join25(appDir, INSTALLED_SKILLS_DIRNAME);
42567
42984
  return installed;
42568
42985
  }
42569
42986
  function getPortableSkillPath(name, options = {}) {
42570
- return join24(getPortableSkillsRoot(options), normalizePortableSkillName(name));
42987
+ return join25(getPortableSkillsRoot(options), normalizePortableSkillName(name));
42571
42988
  }
42572
42989
  function findPortableSkill(name, options = {}) {
42573
42990
  let normalized;
@@ -42593,7 +43010,7 @@ function listPortableSkills(options = {}) {
42593
43010
  for (const entry of readdirSync9(root2).sort()) {
42594
43011
  if (entry.startsWith("."))
42595
43012
  continue;
42596
- const path = join24(root2, entry);
43013
+ const path = join25(root2, entry);
42597
43014
  if (!safeIsDirectory(path))
42598
43015
  continue;
42599
43016
  try {
@@ -42626,8 +43043,11 @@ function isOfficialSkillName(name) {
42626
43043
  }
42627
43044
  function scaffoldPortableSkill(name, options = {}) {
42628
43045
  const skillName = normalizeNewPortableSkillName(name);
43046
+ const readOnlyRoot = resolvePortableSkillsRoot(options, false);
43047
+ assertPortableAuthoringPath(join25(readOnlyRoot, skillName), options);
42629
43048
  const root2 = getPortableSkillsRoot(options);
42630
- const skillPath = join24(root2, skillName);
43049
+ const skillPath = join25(root2, skillName);
43050
+ assertPortableAuthoringPath(skillPath, options);
42631
43051
  if (existsSync9(skillPath)) {
42632
43052
  if (!options.overwrite)
42633
43053
  throw new Error(`Skill '${skillName}' already exists at ${skillPath}`);
@@ -42660,7 +43080,7 @@ function portPortableSkillDirectory(sourceDir, options = {}) {
42660
43080
  const skipped = [];
42661
43081
  const entries = readdirSync9(absoluteSource, { withFileTypes: true }).map((entry) => entry.name).filter((entryName) => !entryName.startsWith(".")).sort();
42662
43082
  for (const entryName of entries) {
42663
- const childPath = join24(absoluteSource, entryName);
43083
+ const childPath = join25(absoluteSource, entryName);
42664
43084
  if (!safeIsDirectory(childPath))
42665
43085
  continue;
42666
43086
  if (!isSkillCandidate(childPath)) {
@@ -42689,25 +43109,25 @@ function portPortableSkillDirectory(sourceDir, options = {}) {
42689
43109
  };
42690
43110
  }
42691
43111
  function isSkillCandidate(dir) {
42692
- return existsSync9(join24(dir, "SKILL.md")) || existsSync9(join24(dir, "skill.json")) || existsSync9(join24(dir, "package.json"));
43112
+ return existsSync9(join25(dir, "SKILL.md")) || existsSync9(join25(dir, "skill.json")) || existsSync9(join25(dir, "package.json"));
42693
43113
  }
42694
43114
  function physicalImportPath(path) {
42695
- let ancestor = resolve15(path);
43115
+ let ancestor = resolve16(path);
42696
43116
  const suffix = [];
42697
43117
  while (!existsSync9(ancestor)) {
42698
- suffix.unshift(basename8(ancestor));
42699
- ancestor = dirname16(ancestor);
43118
+ suffix.unshift(basename9(ancestor));
43119
+ ancestor = dirname17(ancestor);
42700
43120
  }
42701
- return join24(realpathSync6(ancestor), ...suffix);
43121
+ return join25(realpathSync7(ancestor), ...suffix);
42702
43122
  }
42703
43123
  function assertDisjointImportPaths(source, destination) {
42704
- const sourcePath = realpathSync6(source);
43124
+ const sourcePath = realpathSync7(source);
42705
43125
  const destinationPath = physicalImportPath(destination);
42706
- const contains = (parent, child) => {
43126
+ const contains2 = (parent, child) => {
42707
43127
  const path = relative5(parent, child);
42708
- return path === "" || !isAbsolute16(path) && path !== ".." && !path.startsWith(`..${sep6}`);
43128
+ return path === "" || !isAbsolute16(path) && path !== ".." && !path.startsWith(`..${sep7}`);
42709
43129
  };
42710
- if (contains(sourcePath, destinationPath) || contains(destinationPath, sourcePath)) {
43130
+ if (contains2(sourcePath, destinationPath) || contains2(destinationPath, sourcePath)) {
42711
43131
  throw new Error("Source and destination skill directories must not overlap");
42712
43132
  }
42713
43133
  }
@@ -42720,20 +43140,23 @@ function portPortableSkill(sourcePath, options = {}) {
42720
43140
  const explicitName = options.name != null;
42721
43141
  const skillName = normalizeNewPortableSkillName(options.name ?? inferred.name);
42722
43142
  if (isOfficialSkillName(skillName) && !options.allowShadow) {
42723
- const sourceSlug = safeNormalizeName(basename8(absoluteSource));
42724
- const via = explicitName ? `Name '${skillName}' matches a bundled official skill.` : `Inferred name '${skillName}'${sourceSlug && sourceSlug !== skillName ? ` (from source folder '${basename8(absoluteSource)}')` : ""} matches a bundled official skill.`;
43143
+ const sourceSlug = safeNormalizeName(basename9(absoluteSource));
43144
+ const via = explicitName ? `Name '${skillName}' matches a bundled official skill.` : `Inferred name '${skillName}'${sourceSlug && sourceSlug !== skillName ? ` (from source folder '${basename9(absoluteSource)}')` : ""} matches a bundled official skill.`;
42725
43145
  throw new Error(`${via} Importing it would shadow the official '${skillName}'. ` + `Pass --name to choose a different name, or --allow-shadow to override deliberately.`);
42726
43146
  }
42727
- assertDisjointImportPaths(absoluteSource, join24(resolvePortableSkillsRoot(options, false), skillName));
43147
+ const readOnlyDestination = join25(resolvePortableSkillsRoot(options, false), skillName);
43148
+ assertPortableAuthoringPath(readOnlyDestination, options);
43149
+ assertDisjointImportPaths(absoluteSource, readOnlyDestination);
42728
43150
  const root2 = getPortableSkillsRoot(options);
42729
- const destination = join24(root2, skillName);
43151
+ const destination = join25(root2, skillName);
43152
+ assertPortableAuthoringPath(destination, options);
42730
43153
  assertDisjointImportPaths(absoluteSource, destination);
42731
43154
  if (existsSync9(destination)) {
42732
43155
  if (!options.overwrite)
42733
43156
  throw new Error(`Skill '${skillName}' already exists at ${destination}`);
42734
43157
  rmSync2(destination, { recursive: true, force: true });
42735
43158
  }
42736
- mkdirSync7(dirname16(destination), { recursive: true });
43159
+ mkdirSync7(dirname17(destination), { recursive: true });
42737
43160
  copySkillDirectory(absoluteSource, destination);
42738
43161
  const base = {
42739
43162
  ...inferred,
@@ -42769,31 +43192,37 @@ function buildCorpusManifest(input, name) {
42769
43192
  }
42770
43193
  function writeCorpusSkill(input, options = {}) {
42771
43194
  const name = normalizePortableSkillName(input.name);
43195
+ const readOnlyRoot = resolvePortableSkillsRoot(options, false);
43196
+ assertPortableAuthoringPath(join25(readOnlyRoot, name), options);
42772
43197
  const root2 = getPortableSkillsRoot(options);
42773
- const skillPath = join24(root2, name);
43198
+ const skillPath = join25(root2, name);
43199
+ assertPortableAuthoringPath(skillPath, options);
42774
43200
  const created = !existsSync9(skillPath);
42775
43201
  mkdirSync7(skillPath, { recursive: true });
42776
- writeFileSync6(join24(skillPath, "SKILL.md"), input.skillMd);
43202
+ writeFileSync6(join25(skillPath, "SKILL.md"), input.skillMd);
42777
43203
  const manifest = buildCorpusManifest(input, name);
42778
43204
  writeSkillJsonWithHash(skillPath, manifest);
42779
43205
  return { name, path: skillPath, manifest, created };
42780
43206
  }
42781
43207
  function installCorpusSkillAtomically(input, options = {}) {
42782
43208
  const name = normalizePortableSkillName(input.name);
43209
+ const readOnlyRoot = resolvePortableSkillsRoot(options, false);
43210
+ assertPortableAuthoringPath(join25(readOnlyRoot, name), options);
42783
43211
  const root2 = getPortableSkillsRoot(options);
42784
- const target = join24(root2, name);
43212
+ const target = join25(root2, name);
43213
+ assertPortableAuthoringPath(target, options);
42785
43214
  const created = !existsSync9(target);
42786
43215
  mkdirSync7(root2, { recursive: true });
42787
- const staging = mkdtempSync(join24(root2, `.pull-${name}-`));
43216
+ const staging = mkdtempSync(join25(root2, `.pull-${name}-`));
42788
43217
  let moved = false;
42789
43218
  let backup = null;
42790
43219
  try {
42791
- writeFileSync6(join24(staging, "SKILL.md"), input.skillMd);
43220
+ writeFileSync6(join25(staging, "SKILL.md"), input.skillMd);
42792
43221
  const manifest = buildCorpusManifest(input, name);
42793
43222
  writeSkillJsonWithHash(staging, manifest);
42794
43223
  if (existsSync9(target)) {
42795
- backup = mkdtempSync(join24(root2, `.pull-backup-${name}-`));
42796
- renameSync4(target, join24(backup, name));
43224
+ backup = mkdtempSync(join25(root2, `.pull-backup-${name}-`));
43225
+ renameSync4(target, join25(backup, name));
42797
43226
  moved = true;
42798
43227
  }
42799
43228
  renameSync4(staging, target);
@@ -42802,9 +43231,9 @@ function installCorpusSkillAtomically(input, options = {}) {
42802
43231
  return { name, path: target, manifest, created };
42803
43232
  } catch (error) {
42804
43233
  rmSync2(staging, { recursive: true, force: true });
42805
- if (moved && backup && existsSync9(join24(backup, name))) {
43234
+ if (moved && backup && existsSync9(join25(backup, name))) {
42806
43235
  try {
42807
- renameSync4(join24(backup, name), target);
43236
+ renameSync4(join25(backup, name), target);
42808
43237
  } catch {}
42809
43238
  }
42810
43239
  throw error;
@@ -42817,8 +43246,8 @@ function validatePortableSkillDirectory(name, skillPath) {
42817
43246
  const warnings = [...base.warnings];
42818
43247
  let manifest;
42819
43248
  if (existsSync9(skillPath)) {
42820
- const skillJsonPath = join24(skillPath, "skill.json");
42821
- const skillMdPath = join24(skillPath, "SKILL.md");
43249
+ const skillJsonPath = join25(skillPath, "skill.json");
43250
+ const skillMdPath = join25(skillPath, "SKILL.md");
42822
43251
  if (!existsSync9(skillJsonPath) && !existsSync9(skillMdPath)) {
42823
43252
  add3(issues, "portable.manifest_missing", "Missing portable manifest: expected SKILL.md frontmatter and/or skill.json");
42824
43253
  }
@@ -42838,7 +43267,7 @@ function validatePortableSkillDirectory(name, skillPath) {
42838
43267
  add3(issues, "portable.version_missing", "Portable manifest missing version");
42839
43268
  }
42840
43269
  const contractIssues = validatePortableManifestContract(manifest, {
42841
- strict: existsSync9(join24(skillPath, "skill.json")),
43270
+ strict: existsSync9(join25(skillPath, "skill.json")),
42842
43271
  skillPath
42843
43272
  });
42844
43273
  for (const issue of contractIssues)
@@ -42878,7 +43307,7 @@ function validatePortableSkillDirectory(name, skillPath) {
42878
43307
  add3(issues, "portable.command_entry_unsafe", `Command '${command.name}' entry '${command.entry}' must stay inside the skill directory`);
42879
43308
  continue;
42880
43309
  }
42881
- const entryPath = join24(skillPath, command.entry);
43310
+ const entryPath = join25(skillPath, command.entry);
42882
43311
  if (!existsSync9(entryPath))
42883
43312
  add3(issues, "portable.command_entry_missing", `Command '${command.name}' entry '${command.entry}' is missing`);
42884
43313
  else if (statSync8(entryPath).isDirectory())
@@ -42889,7 +43318,7 @@ function validatePortableSkillDirectory(name, skillPath) {
42889
43318
  } catch (error) {
42890
43319
  add3(issues, "portable.manifest_invalid", error.message);
42891
43320
  }
42892
- if (manifest?.kind !== "instruction" && !existsSync9(join24(skillPath, "AGENTS.md"))) {
43321
+ if (manifest?.kind !== "instruction" && !existsSync9(join25(skillPath, "AGENTS.md"))) {
42893
43322
  add3(issues, "portable.agents_missing", "Missing AGENTS.md with build-out instructions for coding agents");
42894
43323
  }
42895
43324
  }
@@ -42925,12 +43354,12 @@ async function runPortableSkill(name, args, options = {}) {
42925
43354
  if (!isSafeRelativePath2(command.entry)) {
42926
43355
  return { exitCode: 1, error: `Portable skill '${name}' command entry is unsafe` };
42927
43356
  }
42928
- const entryPath = join24(skill.path, command.entry);
43357
+ const entryPath = join25(skill.path, command.entry);
42929
43358
  if (!existsSync9(entryPath)) {
42930
43359
  return { exitCode: 1, error: `Entry point '${command.entry}' not found in portable skill '${name}'` };
42931
43360
  }
42932
- const pkgPath = join24(skill.path, "package.json");
42933
- const nodeModules = join24(skill.path, "node_modules");
43361
+ const pkgPath = join25(skill.path, "package.json");
43362
+ const nodeModules = join25(skill.path, "node_modules");
42934
43363
  if (existsSync9(pkgPath) && !existsSync9(nodeModules) && hasPackageDependencies(pkgPath)) {
42935
43364
  const install = Bun.spawn(["bun", "install", "--no-save"], {
42936
43365
  cwd: skill.path,
@@ -43002,9 +43431,9 @@ function isSkillsOwnershipMarker(marker) {
43002
43431
  return typeof marker === "object" && marker !== null && Object.hasOwn(marker, "managedBy") && marker.managedBy === SYNC_MARKER_MANAGED_BY;
43003
43432
  }
43004
43433
  function hasSkillsOwnershipMarker(dir) {
43005
- const path = join25(dir, SYNC_MARKER_FILE);
43434
+ const path = join26(dir, SYNC_MARKER_FILE);
43006
43435
  try {
43007
- if (!lstatSync20(path).isFile())
43436
+ if (!lstatSync21(path).isFile())
43008
43437
  return false;
43009
43438
  const marker = JSON.parse(readFileSync16(path, "utf8"));
43010
43439
  return isSkillsOwnershipMarker(marker);
@@ -43023,12 +43452,12 @@ function resolveSyncAgents(arg) {
43023
43452
  }
43024
43453
  return [arg];
43025
43454
  }
43026
- function agentGlobalSkillsDir(agent, homeDir3 = homedir4()) {
43455
+ function agentGlobalSkillsDir(agent, homeDir3 = homedir5()) {
43027
43456
  switch (agent) {
43028
43457
  case "opencode":
43029
- return join25(homeDir3, ".config", "opencode", "skills");
43458
+ return join26(homeDir3, ".config", "opencode", "skills");
43030
43459
  default:
43031
- return join25(homeDir3, `.${agent}`, "skills");
43460
+ return join26(homeDir3, `.${agent}`, "skills");
43032
43461
  }
43033
43462
  }
43034
43463
  function adaptSkillMdForAgent(skillMd, agent) {
@@ -43087,7 +43516,7 @@ function resolveSyncCorpus(options = {}) {
43087
43516
  function packageSourceRoots(source) {
43088
43517
  const roots = [];
43089
43518
  for (const sub of ["skills"]) {
43090
- const candidate2 = join25(source, sub);
43519
+ const candidate2 = join26(source, sub);
43091
43520
  if (existsSync10(candidate2) && isDirectory(candidate2))
43092
43521
  roots.push(candidate2);
43093
43522
  }
@@ -43103,10 +43532,10 @@ function containsSkillDirectories(path) {
43103
43532
  return false;
43104
43533
  }
43105
43534
  return entries.some((entry) => {
43106
- const candidate2 = join25(path, entry);
43535
+ const candidate2 = join26(path, entry);
43107
43536
  if (!isDirectory(candidate2))
43108
43537
  return false;
43109
- return existsSync10(join25(candidate2, "SKILL.md")) || existsSync10(join25(candidate2, "skill.json")) || existsSync10(join25(candidate2, "package.json"));
43538
+ return existsSync10(join26(candidate2, "SKILL.md")) || existsSync10(join26(candidate2, "skill.json")) || existsSync10(join26(candidate2, "package.json"));
43110
43539
  });
43111
43540
  }
43112
43541
  function isDirectory(path) {
@@ -43120,7 +43549,7 @@ function syncSkillsToAgents(options = {}) {
43120
43549
  assertNativeExportAllowed();
43121
43550
  const requested = normalizeRequested(options.names);
43122
43551
  const agents = options.agents?.length ? options.agents : [...SYNC_AGENTS];
43123
- const homeDir3 = options.homeDir ?? homedir4();
43552
+ const homeDir3 = options.homeDir ?? homedir5();
43124
43553
  const { roots, source } = resolveSyncCorpus(options);
43125
43554
  const corpus = listPortableSkillsAcrossRoots(roots);
43126
43555
  const byName = new Map(corpus.map((skill) => [skill.name, skill]));
@@ -43146,7 +43575,7 @@ function syncSkillsToAgents(options = {}) {
43146
43575
  actions.push({
43147
43576
  skill: name,
43148
43577
  agent,
43149
- path: join25(agentGlobalSkillsDir(agent, homeDir3), name, "SKILL.md"),
43578
+ path: join26(agentGlobalSkillsDir(agent, homeDir3), name, "SKILL.md"),
43150
43579
  action: "skip",
43151
43580
  reason: "not found in this machine's corpus"
43152
43581
  });
@@ -43175,8 +43604,8 @@ function syncSkillsToAgents(options = {}) {
43175
43604
  return { actions };
43176
43605
  }
43177
43606
  function writeManagedAgentSkill(params) {
43178
- const homeDir3 = params.homeDir ?? homedir4();
43179
- const dir = join25(agentGlobalSkillsDir(params.agent, homeDir3), params.skill);
43607
+ const homeDir3 = params.homeDir ?? homedir5();
43608
+ const dir = join26(agentGlobalSkillsDir(params.agent, homeDir3), params.skill);
43180
43609
  const result = writeManagedSkillDir(dir, params.skillMd, {
43181
43610
  skill: params.skill,
43182
43611
  source: params.source,
@@ -43193,8 +43622,8 @@ function writeManagedAgentSkill(params) {
43193
43622
  };
43194
43623
  }
43195
43624
  function writeManagedSkillDir(dir, skillMd, options) {
43196
- const skillMdPath = join25(dir, "SKILL.md");
43197
- const markerPath = join25(dir, SYNC_MARKER_FILE);
43625
+ const skillMdPath = join26(dir, "SKILL.md");
43626
+ const markerPath = join26(dir, SYNC_MARKER_FILE);
43198
43627
  const dirExists = existsSync10(dir);
43199
43628
  const managed = hasSkillsOwnershipMarker(dir);
43200
43629
  const hasSkillMd = existsSync10(skillMdPath);
@@ -43230,13 +43659,13 @@ function writeManagedSkillDir(dir, skillMd, options) {
43230
43659
  const action = dirExists ? "update" : "create";
43231
43660
  if (options.dryRun)
43232
43661
  return { action, path: skillMdPath };
43233
- const parentDir = dirname17(dir);
43662
+ const parentDir = dirname18(dir);
43234
43663
  mkdirSync8(parentDir, { recursive: true });
43235
- const transactionDir = mkdtempSync2(join25(parentDir, `.hasna-skills-write-${basename9(dir)}-`));
43236
- const candidateDir = join25(transactionDir, "candidate");
43237
- const backupDir = join25(transactionDir, "backup");
43238
- const candidateSkillMdPath = join25(candidateDir, "SKILL.md");
43239
- const candidateMarkerPath = join25(candidateDir, SYNC_MARKER_FILE);
43664
+ const transactionDir = mkdtempSync2(join26(parentDir, `.hasna-skills-write-${basename10(dir)}-`));
43665
+ const candidateDir = join26(transactionDir, "candidate");
43666
+ const backupDir = join26(transactionDir, "backup");
43667
+ const candidateSkillMdPath = join26(candidateDir, "SKILL.md");
43668
+ const candidateMarkerPath = join26(candidateDir, SYNC_MARKER_FILE);
43240
43669
  const marker = {
43241
43670
  managedBy: SYNC_MARKER_MANAGED_BY,
43242
43671
  skill: options.skill,
@@ -43284,8 +43713,8 @@ function writeManagedSkillDir(dir, skillMd, options) {
43284
43713
  }
43285
43714
  return { action, path: skillMdPath };
43286
43715
  }
43287
- function removeManagedAgentSkill(skill, agent, homeDir3 = homedir4()) {
43288
- const dir = join25(agentGlobalSkillsDir(agent, homeDir3), skill);
43716
+ function removeManagedAgentSkill(skill, agent, homeDir3 = homedir5()) {
43717
+ const dir = join26(agentGlobalSkillsDir(agent, homeDir3), skill);
43289
43718
  if (!hasSkillsOwnershipMarker(dir))
43290
43719
  return false;
43291
43720
  rmSync3(dir, { recursive: true, force: true });
@@ -43293,7 +43722,7 @@ function removeManagedAgentSkill(skill, agent, homeDir3 = homedir4()) {
43293
43722
  }
43294
43723
  function sourceSkillMd(skillPath, name, description, kind, preferBundledDocs = false) {
43295
43724
  if (kind === undefined || kind === "instruction" || preferBundledDocs) {
43296
- const skillMdPath = join25(skillPath, "SKILL.md");
43725
+ const skillMdPath = join26(skillPath, "SKILL.md");
43297
43726
  if (existsSync10(skillMdPath))
43298
43727
  return readFileSync16(skillMdPath, "utf-8");
43299
43728
  }
@@ -43326,7 +43755,7 @@ function normalizeSkillName(name) {
43326
43755
 
43327
43756
  // src/lib/registry.ts
43328
43757
  import { existsSync as existsSync11, readFileSync as readFileSync17, readdirSync as readdirSync11 } from "fs";
43329
- import { join as join26 } from "path";
43758
+ import { join as join27 } from "path";
43330
43759
 
43331
43760
  // src/lib/registry-merge.ts
43332
43761
  var SKILL_SOURCE_PRECEDENCE = {
@@ -43536,7 +43965,7 @@ function discoverSkillsInDir(dir, source = "custom") {
43536
43965
  for (const entry of entries) {
43537
43966
  if (!entry.isDirectory())
43538
43967
  continue;
43539
- const skillMdPath = join26(dir, entry.name, "SKILL.md");
43968
+ const skillMdPath = join27(dir, entry.name, "SKILL.md");
43540
43969
  if (!existsSync11(skillMdPath))
43541
43970
  continue;
43542
43971
  let content;
@@ -43556,7 +43985,7 @@ function discoverSkillsInDir(dir, source = "custom") {
43556
43985
  category: fm.category || "Development Tools",
43557
43986
  tags: fm.tags || [],
43558
43987
  ...fm.kind ? { kind: fm.kind } : {},
43559
- ...isHostedMetadataSkillDir(join26(dir, entry.name)) ? { serverOwned: true } : {},
43988
+ ...isHostedMetadataSkillDir(join27(dir, entry.name)) ? { serverOwned: true } : {},
43560
43989
  source
43561
43990
  });
43562
43991
  }
@@ -43572,8 +44001,8 @@ function findExtensionSkillPath(name) {
43572
44001
  for (const entry of entries) {
43573
44002
  if (!entry.isDirectory())
43574
44003
  continue;
43575
- const skillDir = join26(config.extensionsDir, entry.name);
43576
- const skillMdPath = join26(skillDir, "SKILL.md");
44004
+ const skillDir = join27(config.extensionsDir, entry.name);
44005
+ const skillMdPath = join27(skillDir, "SKILL.md");
43577
44006
  if (!existsSync11(skillMdPath))
43578
44007
  continue;
43579
44008
  let content;
@@ -43644,7 +44073,7 @@ function getAllTags() {
43644
44073
 
43645
44074
  // src/lib/project-state.ts
43646
44075
  import { existsSync as existsSync12, mkdirSync as mkdirSync9, readFileSync as readFileSync18, writeFileSync as writeFileSync8 } from "fs";
43647
- import { join as join27 } from "path";
44076
+ import { join as join28 } from "path";
43648
44077
  var VALID_PIN_SOURCES = [
43649
44078
  "official",
43650
44079
  "custom",
@@ -43659,10 +44088,10 @@ var SKILLS_PROJECT_DIR = ".skills";
43659
44088
  var PROJECT_CONFIG_FILE = "project.json";
43660
44089
  var DEFAULT_EXPORT_DIR = ".skills/exports";
43661
44090
  function getProjectStateDir(targetDir = process.cwd()) {
43662
- return join27(targetDir, SKILLS_PROJECT_DIR);
44091
+ return join28(targetDir, SKILLS_PROJECT_DIR);
43663
44092
  }
43664
44093
  function getProjectConfigPath(targetDir = process.cwd()) {
43665
- return join27(getProjectStateDir(targetDir), PROJECT_CONFIG_FILE);
44094
+ return join28(getProjectStateDir(targetDir), PROJECT_CONFIG_FILE);
43666
44095
  }
43667
44096
  function loadProjectConfig(targetDir = process.cwd()) {
43668
44097
  const path = getProjectConfigPath(targetDir);
@@ -43791,7 +44220,7 @@ function getSkillPath(name) {
43791
44220
  const extensionPath = findExtensionSkillPath(skillName);
43792
44221
  if (extensionPath)
43793
44222
  return extensionPath;
43794
- return join28(getPortableSkillsRoot(), skillName);
44223
+ return join29(getPortableSkillsRoot(), skillName);
43795
44224
  }
43796
44225
  function getCanonicalSkillName(name) {
43797
44226
  return getSkill(name)?.name ?? resolveSkillAlias(normalizeSkillSlug(name));
@@ -43854,7 +44283,7 @@ function createLocalSkillManifest(name, generateSkillMd) {
43854
44283
  if (!existsSync13(sourcePath))
43855
44284
  return null;
43856
44285
  let skillMd = "";
43857
- const skillMdPath = join28(sourcePath, "SKILL.md");
44286
+ const skillMdPath = join29(sourcePath, "SKILL.md");
43858
44287
  if (existsSync13(skillMdPath)) {
43859
44288
  skillMd = readFileSync19(skillMdPath, "utf-8");
43860
44289
  } else if (generateSkillMd) {
@@ -43928,16 +44357,16 @@ function getAgentSkillsDir(agent, scope = "global", projectDir) {
43928
44357
  const base = projectDir || process.cwd();
43929
44358
  switch (agent) {
43930
44359
  case "pi":
43931
- return scope === "project" ? join28(base, ".pi", "skills") : join28(homedir5(), ".pi", "agent", "skills");
44360
+ return scope === "project" ? join29(base, ".pi", "skills") : join29(homedir6(), ".pi", "agent", "skills");
43932
44361
  case "opencode":
43933
- return scope === "project" ? join28(base, ".opencode", "skills") : join28(homedir5(), ".config", "opencode", "skills");
44362
+ return scope === "project" ? join29(base, ".opencode", "skills") : join29(homedir6(), ".config", "opencode", "skills");
43934
44363
  default:
43935
- return scope === "project" ? join28(base, `.${agent}`, "skills") : join28(homedir5(), `.${agent}`, "skills");
44364
+ return scope === "project" ? join29(base, `.${agent}`, "skills") : join29(homedir6(), `.${agent}`, "skills");
43936
44365
  }
43937
44366
  }
43938
44367
  function getAgentSkillPath(name, agent, scope = "global", projectDir) {
43939
44368
  const skillName = normalizeSkillName(getCanonicalSkillName(name));
43940
- return join28(getAgentSkillsDir(agent, scope, projectDir), skillName);
44369
+ return join29(getAgentSkillsDir(agent, scope, projectDir), skillName);
43941
44370
  }
43942
44371
  function installSkillForAgent(name, options, generateSkillMd) {
43943
44372
  assertNativeExportAllowed();
@@ -43973,7 +44402,7 @@ function removeSkillForAgent(name, options) {
43973
44402
  }
43974
44403
  function resolveAgentSkillMd(name, generateSkillMd) {
43975
44404
  const sourcePath = getSkillPath(name);
43976
- const skillMdPath = join28(sourcePath, "SKILL.md");
44405
+ const skillMdPath = join29(sourcePath, "SKILL.md");
43977
44406
  if (existsSync13(skillMdPath))
43978
44407
  return readFileSync19(skillMdPath, "utf-8");
43979
44408
  if (generateSkillMd)
@@ -44008,7 +44437,7 @@ function generateMinimalSkillMd(name) {
44008
44437
  "---",
44009
44438
  ""
44010
44439
  ].filter(Boolean);
44011
- const fallbackDoc = readFileIfExists(join28(sourcePath, "README.md")) || readFileIfExists(join28(sourcePath, "CLAUDE.md"));
44440
+ const fallbackDoc = readFileIfExists(join29(sourcePath, "README.md")) || readFileIfExists(join29(sourcePath, "CLAUDE.md"));
44012
44441
  if (fallbackDoc)
44013
44442
  return `${frontmatter.join(`
44014
44443
  `)}${fallbackDoc.trim()}
@@ -44027,7 +44456,7 @@ skills run ${canonicalName}
44027
44456
  `;
44028
44457
  }
44029
44458
  function readBundledSkillVersion(name) {
44030
- const pkgPath = join28(getSkillPath(name), "package.json");
44459
+ const pkgPath = join29(getSkillPath(name), "package.json");
44031
44460
  if (!existsSync13(pkgPath))
44032
44461
  return "unknown";
44033
44462
  try {
@@ -44082,7 +44511,7 @@ function selectSkillDoc(docs, file) {
44082
44511
  function isInstructionSkillDir(skillPath, meta) {
44083
44512
  if (meta?.kind === "instruction")
44084
44513
  return true;
44085
- const skillMdPath = join29(skillPath, "SKILL.md");
44514
+ const skillMdPath = join30(skillPath, "SKILL.md");
44086
44515
  if (!existsSync14(skillMdPath))
44087
44516
  return false;
44088
44517
  try {
@@ -44112,9 +44541,9 @@ function getSkillDocs(name) {
44112
44541
  if (!existsSync14(skillPath))
44113
44542
  return null;
44114
44543
  return {
44115
- skillMd: readIfExists(join29(skillPath, "SKILL.md")),
44116
- readme: readIfExists(join29(skillPath, "README.md")),
44117
- claudeMd: readIfExists(join29(skillPath, "CLAUDE.md"))
44544
+ skillMd: readIfExists(join30(skillPath, "SKILL.md")),
44545
+ readme: readIfExists(join30(skillPath, "README.md")),
44546
+ claudeMd: readIfExists(join30(skillPath, "CLAUDE.md"))
44118
44547
  };
44119
44548
  }
44120
44549
  function getSkillBestDoc(name, file) {
@@ -44130,14 +44559,14 @@ function getSkillRequirements(name) {
44130
44559
  return null;
44131
44560
  const texts = [];
44132
44561
  for (const file of ["SKILL.md", "README.md", "CLAUDE.md", ".env.example", ".env.local.example"]) {
44133
- const content = readIfExists(join29(skillPath, file));
44562
+ const content = readIfExists(join30(skillPath, file));
44134
44563
  if (content)
44135
44564
  texts.push(content);
44136
44565
  }
44137
44566
  const meta = getSkill(name);
44138
44567
  let dependencies = {};
44139
44568
  try {
44140
- dependencies = JSON.parse(readFileSync20(join29(skillPath, "package.json"), "utf8")).dependencies || {};
44569
+ dependencies = JSON.parse(readFileSync20(join30(skillPath, "package.json"), "utf8")).dependencies || {};
44141
44570
  } catch {}
44142
44571
  return getSkillRequirementsFromContent(name, texts, dependencies, meta);
44143
44572
  }
@@ -44199,7 +44628,7 @@ async function runSkill(name, args, options = {}) {
44199
44628
  error: `Skill '${name}' is an instruction skill (kind: instruction) and is not runnable. Instruction skills are consumed by coding agents via SKILL.md, not executed with 'skills run'.`
44200
44629
  };
44201
44630
  }
44202
- const pkgPath = join29(skillPath, "package.json");
44631
+ const pkgPath = join30(skillPath, "package.json");
44203
44632
  if (!existsSync14(pkgPath)) {
44204
44633
  return { exitCode: 1, error: `No package.json in skill '${name}'` };
44205
44634
  }
@@ -44219,12 +44648,12 @@ async function runSkill(name, args, options = {}) {
44219
44648
  } catch {
44220
44649
  return { exitCode: 1, error: `Failed to parse package.json for skill '${name}'` };
44221
44650
  }
44222
- const entryPath = join29(skillPath, entryPoint2);
44651
+ const entryPath = join30(skillPath, entryPoint2);
44223
44652
  if (!existsSync14(entryPath)) {
44224
44653
  return { exitCode: 1, error: `Entry point '${entryPoint2}' not found in skill '${name}'` };
44225
44654
  }
44226
44655
  const env = { ...process.env, ...options.env };
44227
- if (!existsSync14(join29(skillPath, "node_modules")) || hasDependencyPreparationMarker(skillPath)) {
44656
+ if (!existsSync14(join30(skillPath, "node_modules")) || hasDependencyPreparationMarker(skillPath)) {
44228
44657
  const failure = await prepareSkillDependencies(skillPath, env, options.preparationTimeoutMs);
44229
44658
  if (failure)
44230
44659
  return failure;
@@ -44302,10 +44731,10 @@ function generateSkillMd(name) {
44302
44731
  "---"
44303
44732
  ].join(`
44304
44733
  `);
44305
- const readme = readIfExists(join29(skillPath, "README.md"));
44306
- const claudeMd = readIfExists(join29(skillPath, "CLAUDE.md"));
44734
+ const readme = readIfExists(join30(skillPath, "README.md"));
44735
+ const claudeMd = readIfExists(join30(skillPath, "CLAUDE.md"));
44307
44736
  let cliCommand = null;
44308
- const pkgPath = join29(skillPath, "package.json");
44737
+ const pkgPath = join30(skillPath, "package.json");
44309
44738
  if (existsSync14(pkgPath)) {
44310
44739
  try {
44311
44740
  const pkg = JSON.parse(readFileSync20(pkgPath, "utf-8"));
@@ -44587,7 +45016,7 @@ async function executeSelectedLocal(selected, options = {}) {
44587
45016
  throw new SkillSelectionError("INVALID_SECRET_BINDINGS", "Explicit environment values must be bounded strings without NUL bytes.");
44588
45017
  secretEnv[name] = value;
44589
45018
  }
44590
- const runDirectory = mkdtempSync3(join30(tmpdir(), "skills-execution-"));
45019
+ const runDirectory = mkdtempSync3(join31(tmpdir(), "skills-execution-"));
44591
45020
  const paths = new SkillEntryPaths;
44592
45021
  for (const entry of entries) {
44593
45022
  paths.add(entry.path, 100, () => {
@@ -44595,12 +45024,12 @@ async function executeSelectedLocal(selected, options = {}) {
44595
45024
  }, () => {
44596
45025
  throw new SkillSelectionError("INVALID_BUNDLE_PATH", "The execution bundle path exceeds its limit.");
44597
45026
  });
44598
- const destination = join30(runDirectory, entry.path);
44599
- mkdirSync10(dirname18(destination), { recursive: true, mode: 448 });
45027
+ const destination = join31(runDirectory, entry.path);
45028
+ mkdirSync10(dirname19(destination), { recursive: true, mode: 448 });
44600
45029
  writeFileSync9(destination, entry.bytes, { flag: "wx", mode: entry.mode & 511 });
44601
45030
  }
44602
45031
  env.SKILLS_INPUT_JSON = input;
44603
- env.SKILLS_WORKSPACE_DIR = resolve16(options.cwd ?? process.cwd());
45032
+ env.SKILLS_WORKSPACE_DIR = resolve17(options.cwd ?? process.cwd());
44604
45033
  env.SKILLS_RUN_DIR = runDirectory;
44605
45034
  if (runtime.version) {
44606
45035
  const version = await subprocess([executable, ...runtimeName === "bun" ? ["--no-env-file"] : [], "--version"], runDirectory, env, "", Math.min(timeoutMs, 5000));
@@ -44613,7 +45042,7 @@ async function executeSelectedLocal(selected, options = {}) {
44613
45042
  const { authority: authority2, workspaceId, profileRevision, slug, version, bundleDigest } = selection2;
44614
45043
  const request2 = {
44615
45044
  selection: { authority: authority2, workspaceId, profileId, profileRevision, slug, version, bundleDigest },
44616
- consumer: { stationId: process.env.HASNA_STATION || stationHostname2(), workspaceDirectory: realpathSync7(options.cwd ?? process.cwd()) }
45045
+ consumer: { stationId: process.env.HASNA_STATION || stationHostname2(), workspaceDirectory: realpathSync8(options.cwd ?? process.cwd()) }
44617
45046
  };
44618
45047
  const grant = await (options.resolveExecutionGrant ?? resolveExecutionGrant)(request2);
44619
45048
  if (!grant || !grantIdentifier(grant.policyRevision) || !grantIdentifier(grant.grantId))
@@ -44623,7 +45052,7 @@ async function executeSelectedLocal(selected, options = {}) {
44623
45052
  }
44624
45053
  if (bindings)
44625
45054
  secretEnv = await resolveSelectedSecrets(bindings, options.createSecretsClient);
44626
- const result = await subprocess([executable, ...runtimeName === "bun" ? ["--no-env-file"] : [], join30(runDirectory, declaredEntry), ...args], runDirectory, { ...env, ...secretEnv }, input, timeoutMs);
45055
+ const result = await subprocess([executable, ...runtimeName === "bun" ? ["--no-env-file"] : [], join31(runDirectory, declaredEntry), ...args], runDirectory, { ...env, ...secretEnv }, input, timeoutMs);
44627
45056
  result.stdout = redactExecutionSecrets(result.stdout, secretEnv);
44628
45057
  result.stderr = redactExecutionSecrets(result.stderr, secretEnv);
44629
45058
  const receipt = {
@@ -44636,7 +45065,7 @@ async function executeSelectedLocal(selected, options = {}) {
44636
45065
  ...bindings ? { secretBinding: { schema: bindings.schema, selection: bindings.selection, consumer: bindings.consumer, secretsAuthority: bindings.secretsAuthority, bindings: bindings.bindings } } : {},
44637
45066
  ...result
44638
45067
  };
44639
- writeFileSync9(join30(runDirectory, ".execution-receipt.json"), JSON.stringify({ ...receipt, stdout: undefined, stderr: undefined }), { mode: 384 });
45068
+ writeFileSync9(join31(runDirectory, ".execution-receipt.json"), JSON.stringify({ ...receipt, stdout: undefined, stderr: undefined }), { mode: 384 });
44640
45069
  return receipt;
44641
45070
  }
44642
45071
  async function subprocess(command, cwd, env, input, timeoutMs) {
@@ -45755,7 +46184,7 @@ var $resolveS3Config = resolveS3Config;
45755
46184
  // node_modules/@aws-sdk/client-s3/dist-es/S3Client.js
45756
46185
  var import_core = __toESM(require_dist_cjs2(), 1);
45757
46186
  var import_client27 = __toESM(require_client(), 1);
45758
- var import_config36 = __toESM(require_config(), 1);
46187
+ var import_config37 = __toESM(require_config(), 1);
45759
46188
  var import_endpoints5 = __toESM(require_endpoints(), 1);
45760
46189
  var import_event_streams2 = __toESM(require_event_streams(), 1);
45761
46190
  var import_protocols6 = __toESM(require_protocols(), 1);
@@ -53758,21 +54187,21 @@ var import_httpAuthSchemes3 = __toESM(require_httpAuthSchemes(), 1);
53758
54187
 
53759
54188
  // node_modules/@aws-sdk/credential-provider-node/dist-es/defaultProvider.js
53760
54189
  init_dist_es();
53761
- var import_config34 = __toESM(require_config(), 1);
54190
+ var import_config35 = __toESM(require_config(), 1);
53762
54191
 
53763
54192
  // node_modules/@aws-sdk/credential-provider-node/dist-es/remoteProvider.js
53764
- var import_config17 = __toESM(require_config(), 1);
54193
+ var import_config18 = __toESM(require_config(), 1);
53765
54194
  var ENV_IMDS_DISABLED = "AWS_EC2_METADATA_DISABLED";
53766
54195
  var remoteProvider = async (init) => {
53767
54196
  const { ENV_CMDS_FULL_URI: ENV_CMDS_FULL_URI2, ENV_CMDS_RELATIVE_URI: ENV_CMDS_RELATIVE_URI2, fromContainerMetadata: fromContainerMetadata2, fromInstanceMetadata: fromInstanceMetadata2 } = await Promise.resolve().then(() => (init_dist_es2(), exports_dist_es2));
53768
54197
  if (process.env[ENV_CMDS_RELATIVE_URI2] || process.env[ENV_CMDS_FULL_URI2]) {
53769
54198
  init.logger?.debug("@aws-sdk/credential-provider-node - remoteProvider::fromHttp/fromContainerMetadata");
53770
54199
  const { fromHttp: fromHttp2 } = await Promise.resolve().then(() => (init_dist_es3(), exports_dist_es3));
53771
- return import_config17.chain(fromHttp2(init), fromContainerMetadata2(init));
54200
+ return import_config18.chain(fromHttp2(init), fromContainerMetadata2(init));
53772
54201
  }
53773
54202
  if (process.env[ENV_IMDS_DISABLED] && process.env[ENV_IMDS_DISABLED] !== "false") {
53774
54203
  return async () => {
53775
- throw new import_config17.CredentialsProviderError("EC2 Instance Metadata Service access disabled", { logger: init.logger });
54204
+ throw new import_config18.CredentialsProviderError("EC2 Instance Metadata Service access disabled", { logger: init.logger });
53776
54205
  };
53777
54206
  }
53778
54207
  init.logger?.debug("@aws-sdk/credential-provider-node - remoteProvider::fromInstanceMetadata");
@@ -53847,7 +54276,7 @@ var internalCreateChain = (providers) => async (awsIdentityProperties) => {
53847
54276
  var multipleCredentialSourceWarningEmitted = false;
53848
54277
  var defaultProvider = (init = {}) => memoizeChain([
53849
54278
  async () => {
53850
- const profile = init.profile ?? process.env[import_config34.ENV_PROFILE];
54279
+ const profile = init.profile ?? process.env[import_config35.ENV_PROFILE];
53851
54280
  if (profile) {
53852
54281
  const envStaticCredentialsAreSet = process.env[ENV_KEY] && process.env[ENV_SECRET];
53853
54282
  if (envStaticCredentialsAreSet) {
@@ -53865,7 +54294,7 @@ var defaultProvider = (init = {}) => memoizeChain([
53865
54294
  multipleCredentialSourceWarningEmitted = true;
53866
54295
  }
53867
54296
  }
53868
- throw new import_config34.CredentialsProviderError("AWS_PROFILE is set, skipping fromEnv provider.", {
54297
+ throw new import_config35.CredentialsProviderError("AWS_PROFILE is set, skipping fromEnv provider.", {
53869
54298
  logger: init.logger,
53870
54299
  tryNextLink: true
53871
54300
  });
@@ -53877,7 +54306,7 @@ var defaultProvider = (init = {}) => memoizeChain([
53877
54306
  init.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::fromSSO");
53878
54307
  const { ssoStartUrl, ssoAccountId, ssoRegion, ssoRoleName, ssoSession } = init;
53879
54308
  if (!ssoStartUrl && !ssoAccountId && !ssoRegion && !ssoRoleName && !ssoSession) {
53880
- throw new import_config34.CredentialsProviderError("Skipping SSO provider in default chain (inputs do not include SSO fields).", { logger: init.logger });
54309
+ throw new import_config35.CredentialsProviderError("Skipping SSO provider in default chain (inputs do not include SSO fields).", { logger: init.logger });
53881
54310
  }
53882
54311
  const { fromSSO: fromSSO2 } = await Promise.resolve().then(() => (init_dist_es5(), exports_dist_es4));
53883
54312
  return fromSSO2(init)(awsIdentityProperties);
@@ -53902,7 +54331,7 @@ var defaultProvider = (init = {}) => memoizeChain([
53902
54331
  return (await remoteProvider(init))();
53903
54332
  },
53904
54333
  async () => {
53905
- throw new import_config34.CredentialsProviderError("Could not load credentials from any providers", {
54334
+ throw new import_config35.CredentialsProviderError("Could not load credentials from any providers", {
53906
54335
  tryNextLink: false,
53907
54336
  logger: init.logger
53908
54337
  });
@@ -53912,7 +54341,7 @@ var credentialsTreatedAsExpired = (credentials) => credentials?.expiration !== u
53912
54341
  // node_modules/@aws-sdk/client-s3/dist-es/runtimeConfig.js
53913
54342
  var import_checksum2 = __toESM(require_checksum(), 1);
53914
54343
  var import_client23 = __toESM(require_client(), 1);
53915
- var import_config35 = __toESM(require_config(), 1);
54344
+ var import_config36 = __toESM(require_config(), 1);
53916
54345
  var import_event_streams = __toESM(require_event_streams(), 1);
53917
54346
  var import_retry3 = __toESM(require_retry(), 1);
53918
54347
  var import_serde4 = __toESM(require_serde(), 1);
@@ -54202,7 +54631,7 @@ var getRuntimeConfig2 = (config) => {
54202
54631
  // node_modules/@aws-sdk/client-s3/dist-es/runtimeConfig.js
54203
54632
  var getRuntimeConfig3 = (config) => {
54204
54633
  import_client23.emitWarningIfUnsupportedVersion(process.version);
54205
- const defaultsMode = import_config35.resolveDefaultsModeConfig(config);
54634
+ const defaultsMode = import_config36.resolveDefaultsModeConfig(config);
54206
54635
  const defaultConfigProvider = () => defaultsMode().then(import_client23.loadConfigsForDefaultMode);
54207
54636
  const clientSharedValues = getRuntimeConfig2(config);
54208
54637
  import_client22.emitWarningIfUnsupportedVersion(process.version);
@@ -54215,28 +54644,28 @@ var getRuntimeConfig3 = (config) => {
54215
54644
  ...config,
54216
54645
  runtime: "node",
54217
54646
  defaultsMode,
54218
- authSchemePreference: config?.authSchemePreference ?? import_config35.loadConfig(import_httpAuthSchemes3.NODE_AUTH_SCHEME_PREFERENCE_OPTIONS, loaderConfig),
54647
+ authSchemePreference: config?.authSchemePreference ?? import_config36.loadConfig(import_httpAuthSchemes3.NODE_AUTH_SCHEME_PREFERENCE_OPTIONS, loaderConfig),
54219
54648
  bodyLengthChecker: config?.bodyLengthChecker ?? import_serde4.calculateBodyLength,
54220
54649
  credentialDefaultProvider: config?.credentialDefaultProvider ?? defaultProvider,
54221
54650
  defaultUserAgentProvider: config?.defaultUserAgentProvider ?? import_client22.createDefaultUserAgentProvider({ serviceId: clientSharedValues.serviceId, clientVersion: package_default2.version }),
54222
- disableS3ExpressSessionAuth: config?.disableS3ExpressSessionAuth ?? import_config35.loadConfig($NODE_DISABLE_S3_EXPRESS_SESSION_AUTH_OPTIONS, loaderConfig),
54651
+ disableS3ExpressSessionAuth: config?.disableS3ExpressSessionAuth ?? import_config36.loadConfig($NODE_DISABLE_S3_EXPRESS_SESSION_AUTH_OPTIONS, loaderConfig),
54223
54652
  eventStreamSerdeProvider: config?.eventStreamSerdeProvider ?? import_event_streams.eventStreamSerdeProvider,
54224
- maxAttempts: config?.maxAttempts ?? import_config35.loadConfig(import_retry3.NODE_MAX_ATTEMPT_CONFIG_OPTIONS, config),
54225
- region: config?.region ?? import_config35.loadConfig(import_config35.NODE_REGION_CONFIG_OPTIONS, { ...import_config35.NODE_REGION_CONFIG_FILE_OPTIONS, ...loaderConfig }),
54226
- requestChecksumCalculation: config?.requestChecksumCalculation ?? import_config35.loadConfig($NODE_REQUEST_CHECKSUM_CALCULATION_CONFIG_OPTIONS, loaderConfig),
54653
+ maxAttempts: config?.maxAttempts ?? import_config36.loadConfig(import_retry3.NODE_MAX_ATTEMPT_CONFIG_OPTIONS, config),
54654
+ region: config?.region ?? import_config36.loadConfig(import_config36.NODE_REGION_CONFIG_OPTIONS, { ...import_config36.NODE_REGION_CONFIG_FILE_OPTIONS, ...loaderConfig }),
54655
+ requestChecksumCalculation: config?.requestChecksumCalculation ?? import_config36.loadConfig($NODE_REQUEST_CHECKSUM_CALCULATION_CONFIG_OPTIONS, loaderConfig),
54227
54656
  requestHandler: import_node_http_handler2.NodeHttpHandler.create(config?.requestHandler ?? defaultConfigProvider),
54228
- responseChecksumValidation: config?.responseChecksumValidation ?? import_config35.loadConfig($NODE_RESPONSE_CHECKSUM_VALIDATION_CONFIG_OPTIONS, loaderConfig),
54229
- retryMode: config?.retryMode ?? import_config35.loadConfig({
54657
+ responseChecksumValidation: config?.responseChecksumValidation ?? import_config36.loadConfig($NODE_RESPONSE_CHECKSUM_VALIDATION_CONFIG_OPTIONS, loaderConfig),
54658
+ retryMode: config?.retryMode ?? import_config36.loadConfig({
54230
54659
  ...import_retry3.NODE_RETRY_MODE_CONFIG_OPTIONS,
54231
54660
  default: async () => (await defaultConfigProvider()).retryMode || import_retry3.DEFAULT_RETRY_MODE
54232
54661
  }, config),
54233
- sigv4aSigningRegionSet: config?.sigv4aSigningRegionSet ?? import_config35.loadConfig(import_httpAuthSchemes3.NODE_SIGV4A_CONFIG_OPTIONS, loaderConfig),
54662
+ sigv4aSigningRegionSet: config?.sigv4aSigningRegionSet ?? import_config36.loadConfig(import_httpAuthSchemes3.NODE_SIGV4A_CONFIG_OPTIONS, loaderConfig),
54234
54663
  streamCollector: config?.streamCollector ?? import_node_http_handler2.streamCollector,
54235
54664
  streamHasher: config?.streamHasher ?? import_checksum2.readableStreamHasher,
54236
- useArnRegion: config?.useArnRegion ?? import_config35.loadConfig($NODE_USE_ARN_REGION_CONFIG_OPTIONS, loaderConfig),
54237
- useDualstackEndpoint: config?.useDualstackEndpoint ?? import_config35.loadConfig(import_config35.NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS, loaderConfig),
54238
- useFipsEndpoint: config?.useFipsEndpoint ?? import_config35.loadConfig(import_config35.NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS, loaderConfig),
54239
- userAgentAppId: config?.userAgentAppId ?? import_config35.loadConfig(import_client22.NODE_APP_ID_CONFIG_OPTIONS, loaderConfig)
54665
+ useArnRegion: config?.useArnRegion ?? import_config36.loadConfig($NODE_USE_ARN_REGION_CONFIG_OPTIONS, loaderConfig),
54666
+ useDualstackEndpoint: config?.useDualstackEndpoint ?? import_config36.loadConfig(import_config36.NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS, loaderConfig),
54667
+ useFipsEndpoint: config?.useFipsEndpoint ?? import_config36.loadConfig(import_config36.NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS, loaderConfig),
54668
+ userAgentAppId: config?.userAgentAppId ?? import_config36.loadConfig(import_client22.NODE_APP_ID_CONFIG_OPTIONS, loaderConfig)
54240
54669
  };
54241
54670
  };
54242
54671
 
@@ -54302,7 +54731,7 @@ class S3Client extends import_client27.Client {
54302
54731
  const _config_2 = import_client26.resolveUserAgentConfig(_config_1);
54303
54732
  const _config_3 = $resolveFlexibleChecksumsConfig(_config_2);
54304
54733
  const _config_4 = import_retry4.resolveRetryConfig(_config_3);
54305
- const _config_5 = import_config36.resolveRegionConfig(_config_4);
54734
+ const _config_5 = import_config37.resolveRegionConfig(_config_4);
54306
54735
  const _config_6 = import_client26.resolveHostHeaderConfig(_config_5);
54307
54736
  const _config_7 = import_endpoints5.resolveEndpointConfig(_config_6);
54308
54737
  const _config_8 = import_event_streams2.resolveEventStreamSerdeConfig(_config_7);
@@ -54698,10 +55127,10 @@ function assertReservationCents(value, field2) {
54698
55127
  import { Database as Database2 } from "bun:sqlite";
54699
55128
  import { randomUUID as randomUUID8 } from "crypto";
54700
55129
  import { mkdirSync as mkdirSync12 } from "fs";
54701
- import { dirname as dirname22 } from "path";
55130
+ import { dirname as dirname23 } from "path";
54702
55131
 
54703
55132
  // src/server/database-url.ts
54704
- import { isAbsolute as isAbsolute17, join as join32 } from "path";
55133
+ import { isAbsolute as isAbsolute17, join as join33 } from "path";
54705
55134
  import { fileURLToPath as fileURLToPath3 } from "url";
54706
55135
  var DEFAULT_SQLITE_FILENAME2 = "server.db";
54707
55136
  var SQLITE_MEMORY_PATH = ":memory:";
@@ -54710,7 +55139,7 @@ var SQLITE_SCHEMES = new Set(["sqlite", "sqlite3", "file"]);
54710
55139
  var MEMORY_SCHEMES = new Set(["memory"]);
54711
55140
  var SQLITE_EXTENSIONS = [".db", ".sqlite", ".sqlite3", ".db3"];
54712
55141
  function defaultSqlitePath() {
54713
- return join32(getDataDir(), DEFAULT_SQLITE_FILENAME2);
55142
+ return join33(getDataDir(), DEFAULT_SQLITE_FILENAME2);
54714
55143
  }
54715
55144
  function resolveDatabaseTarget(raw) {
54716
55145
  const value = raw?.trim();
@@ -54737,7 +55166,7 @@ function resolveDatabaseTarget(raw) {
54737
55166
  throw new Error(`unsupported database scheme "${scheme}:". Supported: postgres://, postgresql://, sqlite:, file:, ` + `an absolute or relative path to a .db/.sqlite file, ":memory:", or "memory:" (non-durable, tests only). ` + `Leave the setting empty to use the default SQLite database at ${defaultSqlitePath()}.`);
54738
55167
  }
54739
55168
  if (looksLikeSqlitePath(value)) {
54740
- const path = isAbsolute17(value) ? value : join32(process.cwd(), value);
55169
+ const path = isAbsolute17(value) ? value : join33(process.cwd(), value);
54741
55170
  return { kind: "sqlite", path, durable: true, label: `sqlite (${path})` };
54742
55171
  }
54743
55172
  throw new Error(`could not resolve a database backend from "${value}". Use postgres://\u2026, sqlite:\u2026, an absolute or ` + `relative path ending in ${SQLITE_EXTENSIONS.join("/")}, ":memory:", or leave it empty for the ` + `default SQLite database at ${defaultSqlitePath()}.`);
@@ -54761,7 +55190,7 @@ function sqlitePathFromUrl(value, scheme) {
54761
55190
  }
54762
55191
  return rest.slice(2).replace(/^\/\/+/, "/");
54763
55192
  }
54764
- return isAbsolute17(rest) ? rest : join32(process.cwd(), rest);
55193
+ return isAbsolute17(rest) ? rest : join33(process.cwd(), rest);
54765
55194
  }
54766
55195
  function looksLikeSqlitePath(value) {
54767
55196
  if (value.includes("/"))
@@ -54994,7 +55423,7 @@ class PostgresSkillSelectionStore {
54994
55423
  // src/server/sqlite-store.ts
54995
55424
  import { randomUUID as randomUUID7 } from "crypto";
54996
55425
  import { mkdirSync as mkdirSync11, readFileSync as readFileSync22, readdirSync as readdirSync12 } from "fs";
54997
- import { dirname as dirname21, join as join34 } from "path";
55426
+ import { dirname as dirname22, join as join35 } from "path";
54998
55427
 
54999
55428
  // src/server/auth.ts
55000
55429
  import { createHash as createHash21 } from "crypto";
@@ -55028,24 +55457,24 @@ function publicPrincipal(partial = {}) {
55028
55457
  function permitsSkillsRoute(principal, method, resource) {
55029
55458
  const scopes = new Set(principal.scopes);
55030
55459
  if (resource === "execution-grants") {
55031
- const read3 = method === "GET" || method === "HEAD";
55032
- if (!read3 && method !== "POST" && !["owner", "admin"].includes(principal.role))
55460
+ const read4 = method === "GET" || method === "HEAD";
55461
+ if (!read4 && method !== "POST" && !["owner", "admin"].includes(principal.role))
55033
55462
  return false;
55034
- const allowed2 = read3 ? ["*", "execution-grants:*", "execution-grants:read"] : method === "POST" ? ["*", "execution-grants:*", "execution-grants:resolve", "skills:read", "skills:*"] : ["*", "execution-grants:*", "execution-grants:write"];
55463
+ const allowed2 = read4 ? ["*", "execution-grants:*", "execution-grants:read"] : method === "POST" ? ["*", "execution-grants:*", "execution-grants:resolve", "skills:read", "skills:*"] : ["*", "execution-grants:*", "execution-grants:write"];
55035
55464
  return allowed2.some((scope) => scopes.has(scope));
55036
55465
  }
55037
55466
  if (scopes.has("*"))
55038
55467
  return true;
55039
- const read2 = method === "GET" || method === "HEAD";
55040
- if (resource === "capabilities" && read2)
55468
+ const read3 = method === "GET" || method === "HEAD";
55469
+ if (resource === "capabilities" && read3)
55041
55470
  return true;
55042
55471
  let allowed;
55043
55472
  if (resource === "runs" || resource === "executions") {
55044
- allowed = read2 ? ["runs:read", "runs:*", "skills:read", "skills:*"] : ["runs:write", "runs:*"];
55473
+ allowed = read3 ? ["runs:read", "runs:*", "skills:read", "skills:*"] : ["runs:write", "runs:*"];
55045
55474
  } else if (resource === "stations") {
55046
- allowed = read2 ? ["stations:read", "stations:*", "skills:read", "skills:*"] : ["stations:write", "stations:*", "skills:*"];
55475
+ allowed = read3 ? ["stations:read", "stations:*", "skills:read", "skills:*"] : ["stations:write", "stations:*", "skills:*"];
55047
55476
  } else if (["skills", "pins", "tags", "profiles", "capabilities"].includes(resource)) {
55048
- allowed = read2 ? ["skills:read", "skills:*"] : ["skills:write", "skills:publish", "skills:*"];
55477
+ allowed = read3 ? ["skills:read", "skills:*"] : ["skills:write", "skills:publish", "skills:*"];
55049
55478
  } else
55050
55479
  return true;
55051
55480
  return allowed.some((scope) => scopes.has(scope));
@@ -55053,17 +55482,17 @@ function permitsSkillsRoute(principal, method, resource) {
55053
55482
 
55054
55483
  // src/server/migrations-dir.ts
55055
55484
  import { existsSync as existsSync15 } from "fs";
55056
- import { dirname as dirname20, join as join33 } from "path";
55485
+ import { dirname as dirname21, join as join34 } from "path";
55057
55486
  var MIGRATION_DIALECTS = ["postgres", "sqlite"];
55058
55487
  var MAX_WALK_UP = 6;
55059
55488
  function findMigrationsRoot(startDirs = defaultStartDirs()) {
55060
55489
  for (const start of startDirs) {
55061
55490
  let dir = start;
55062
55491
  for (let level = 0;level < MAX_WALK_UP; level += 1) {
55063
- const candidate2 = join33(dir, "migrations");
55064
- if (MIGRATION_DIALECTS.some((dialect) => existsSync15(join33(candidate2, dialect))))
55492
+ const candidate2 = join34(dir, "migrations");
55493
+ if (MIGRATION_DIALECTS.some((dialect) => existsSync15(join34(candidate2, dialect))))
55065
55494
  return candidate2;
55066
- const parent = dirname20(dir);
55495
+ const parent = dirname21(dir);
55067
55496
  if (parent === dir)
55068
55497
  break;
55069
55498
  dir = parent;
@@ -55075,7 +55504,7 @@ function resolveMigrationsDir(dialect, root4 = findMigrationsRoot()) {
55075
55504
  if (!root4) {
55076
55505
  throw new Error(`could not locate the migrations directory for dialect "${dialect}". ` + `Expected a migrations/${dialect}/ folder alongside the package root.`);
55077
55506
  }
55078
- const dir = join33(root4, dialect);
55507
+ const dir = join34(root4, dialect);
55079
55508
  if (!existsSync15(dir)) {
55080
55509
  throw new Error(`migrations directory not found: ${dir}`);
55081
55510
  }
@@ -55177,6 +55606,18 @@ function rowToSkill(row) {
55177
55606
  ...row.replacement_slug ? { replacementSlug: String(row.replacement_slug) } : {}
55178
55607
  };
55179
55608
  }
55609
+ function rowToPublishedSelectionState(row) {
55610
+ return {
55611
+ slug: String(row.slug),
55612
+ version: String(row.version),
55613
+ current: row.skill_exists ? {
55614
+ lifecycle: row.lifecycle === "archived" ? "archived" : "active",
55615
+ ...row.tombstoned_at ? { tombstonedAt: dateString(row.tombstoned_at) } : {}
55616
+ } : null,
55617
+ versionBundleSha256: typeof row.bundle_sha256 === "string" ? row.bundle_sha256 : null,
55618
+ bundleAvailable: Boolean(row.bundle_available)
55619
+ };
55620
+ }
55180
55621
  function rowToPin(row) {
55181
55622
  return {
55182
55623
  orgId: String(row.org_id),
@@ -55356,7 +55797,7 @@ class SqliteSkillsStore {
55356
55797
  constructor(path = SQLITE_MEMORY_PATH, options = {}) {
55357
55798
  const inMemory = path === SQLITE_MEMORY_PATH;
55358
55799
  if (!inMemory)
55359
- mkdirSync11(dirname21(path), { recursive: true });
55800
+ mkdirSync11(dirname22(path), { recursive: true });
55360
55801
  this.db = openDatabase(path);
55361
55802
  this.db.exec(`PRAGMA busy_timeout = ${Math.max(0, options.busyTimeoutMs ?? 5000)}`);
55362
55803
  if (!inMemory)
@@ -55951,6 +56392,22 @@ class SqliteSkillsStore {
55951
56392
  const row = this.get("SELECT * FROM skills_versions WHERE org_id = ? AND slug = ? AND version = ? LIMIT 1", [principal.orgId, slug, version2]);
55952
56393
  return row ? rowToSkillVersion(row) : null;
55953
56394
  }
56395
+ async getPublishedSelectionStates(principal, selections2) {
56396
+ if (selections2.length > MAX_PROFILE_SELECTIONS)
56397
+ throw new RangeError("Published selection lookup exceeds the profile selection limit");
56398
+ if (!selections2.length)
56399
+ return [];
56400
+ const requested = JSON.stringify(selections2.map(({ slug, version: version2 }) => ({ slug, version: version2 })));
56401
+ return this.all(`SELECT json_extract(q.value, '$.slug') AS slug, json_extract(q.value, '$.version') AS version,
56402
+ r.slug IS NOT NULL AS skill_exists, r.lifecycle, r.tombstoned_at,
56403
+ v.bundle_sha256, b.sha256 IS NOT NULL AS bundle_available
56404
+ FROM json_each(?) q
56405
+ LEFT JOIN skills_registry r ON r.org_id = ? AND r.slug = json_extract(q.value, '$.slug')
56406
+ LEFT JOIN skills_versions v ON v.org_id = ?
56407
+ AND v.slug = json_extract(q.value, '$.slug') AND v.version = json_extract(q.value, '$.version')
56408
+ LEFT JOIN skills_bundles b ON b.org_id = ? AND b.sha256 = v.bundle_sha256
56409
+ ORDER BY CAST(q.key AS INTEGER)`, [requested, principal.orgId, principal.orgId, principal.orgId]).map(rowToPublishedSelectionState);
56410
+ }
55954
56411
  async pinSkill(principal, slug, metadata = {}) {
55955
56412
  const row = this.get(`INSERT INTO skills_pins (org_id, principal, slug, pinned_at, metadata_json)
55956
56413
  VALUES (?, ?, ?, ?, ?)
@@ -56019,7 +56476,7 @@ function applySqliteMigrations(db, migrationsDir = resolveMigrationsDir("sqlite"
56019
56476
  const appliedNow = [];
56020
56477
  for (const file of files) {
56021
56478
  const version2 = file.replace(/\.sql$/, "");
56022
- const text2 = readFileSync22(join34(migrationsDir, file), "utf8");
56479
+ const text2 = readFileSync22(join35(migrationsDir, file), "utf8");
56023
56480
  const apply = db.transaction(() => {
56024
56481
  const already = db.query("SELECT 1 AS present FROM schema_migrations WHERE version = ? LIMIT 1").get(version2);
56025
56482
  if (already)
@@ -56166,7 +56623,7 @@ class SqliteGovernanceStore {
56166
56623
  closed = false;
56167
56624
  constructor(path = SQLITE_MEMORY_PATH, options = {}) {
56168
56625
  if (path !== SQLITE_MEMORY_PATH)
56169
- mkdirSync12(dirname22(path), { recursive: true });
56626
+ mkdirSync12(dirname23(path), { recursive: true });
56170
56627
  this.db = new Database2(path, { create: true, readwrite: true });
56171
56628
  this.db.exec("PRAGMA busy_timeout = 5000");
56172
56629
  this.db.exec("PRAGMA foreign_keys = ON");
@@ -57079,16 +57536,21 @@ function selected(value) {
57079
57536
  return selections2;
57080
57537
  }
57081
57538
  async function validatePublished(store, principal, selections2) {
57082
- for (const selection2 of selections2) {
57083
- const current = await store.getSkill(principal, selection2.slug);
57539
+ const states = await store.getPublishedSelectionStates(principal, selections2);
57540
+ if (states.length !== selections2.length)
57541
+ throw new SkillRequestError(503, "SELECTION_UNAVAILABLE", "Selected publication state is unavailable");
57542
+ for (const [index, selection2] of selections2.entries()) {
57543
+ const state2 = states[index];
57544
+ if (!state2 || state2.slug !== selection2.slug || state2.version !== selection2.version)
57545
+ throw new SkillRequestError(503, "SELECTION_UNAVAILABLE", "Selected publication state is unavailable");
57546
+ const current = state2.current;
57084
57547
  if (!current || current.tombstonedAt)
57085
57548
  throw new SkillRequestError(current?.tombstonedAt ? 410 : 404, "SELECTION_UNAVAILABLE", `Selected skill '${selection2.slug}' is unavailable`);
57086
57549
  if (current.lifecycle === "archived")
57087
57550
  throw new SkillRequestError(409, "SELECTION_ARCHIVED", `Selected skill '${selection2.slug}' is archived`);
57088
- const version2 = await store.getSkillVersion(principal, selection2.slug, selection2.version);
57089
- if (!version2 || `sha256:${version2.bundleSha256}` !== selection2.bundleDigest)
57551
+ if (!state2.versionBundleSha256 || `sha256:${state2.versionBundleSha256}` !== selection2.bundleDigest)
57090
57552
  throw new SkillRequestError(409, "SELECTION_VERSION_MISMATCH", `Selected version of '${selection2.slug}' does not match its published digest`);
57091
- if (!await store.getSkillBundle(principal, version2.bundleSha256))
57553
+ if (!state2.bundleAvailable)
57092
57554
  throw new SkillRequestError(503, "SELECTION_BUNDLE_UNAVAILABLE", "Selected bundle is unavailable");
57093
57555
  }
57094
57556
  }
@@ -57254,7 +57716,7 @@ async function handleProfileApi(store, principal, request2, parts, config) {
57254
57716
  // src/server/runtime-store.ts
57255
57717
  import { Database as Database3 } from "bun:sqlite";
57256
57718
  import { mkdirSync as mkdirSync13 } from "fs";
57257
- import { dirname as dirname23 } from "path";
57719
+ import { dirname as dirname24 } from "path";
57258
57720
 
57259
57721
  // src/sdk/execution/types.ts
57260
57722
  var EXECUTION_PROTOCOL_VERSION = REMOTE_SKILL_RUN_CONTRACT_VERSION;
@@ -57310,7 +57772,7 @@ class RuntimeExecutionStore {
57310
57772
  }
57311
57773
  const path = target.kind === "sqlite" ? target.path : ":memory:";
57312
57774
  if (path !== ":memory:")
57313
- mkdirSync13(dirname23(path), { recursive: true });
57775
+ mkdirSync13(dirname24(path), { recursive: true });
57314
57776
  const db = new Database3(path);
57315
57777
  db.run("PRAGMA busy_timeout=5000");
57316
57778
  db.run("PRAGMA journal_mode=WAL");
@@ -58334,7 +58796,7 @@ function createReceiptService(store) {
58334
58796
  var import_client36 = __toESM(require_client2(), 1);
58335
58797
  var import_core2 = __toESM(require_dist_cjs2(), 1);
58336
58798
  var import_client37 = __toESM(require_client(), 1);
58337
- var import_config39 = __toESM(require_config(), 1);
58799
+ var import_config40 = __toESM(require_config(), 1);
58338
58800
  var import_endpoints8 = __toESM(require_endpoints(), 1);
58339
58801
  var import_protocols10 = __toESM(require_protocols(), 1);
58340
58802
  var import_retry6 = __toESM(require_retry(), 1);
@@ -58473,7 +58935,7 @@ var package_default3 = {
58473
58935
  var import_client32 = __toESM(require_client2(), 1);
58474
58936
  var import_httpAuthSchemes6 = __toESM(require_httpAuthSchemes(), 1);
58475
58937
  var import_client33 = __toESM(require_client(), 1);
58476
- var import_config38 = __toESM(require_config(), 1);
58938
+ var import_config39 = __toESM(require_config(), 1);
58477
58939
  var import_retry5 = __toESM(require_retry(), 1);
58478
58940
  var import_serde6 = __toESM(require_serde(), 1);
58479
58941
  var import_node_http_handler3 = __toESM(require_dist_cjs6(), 1);
@@ -61415,7 +61877,7 @@ var getRuntimeConfig4 = (config) => {
61415
61877
  // node_modules/@aws-sdk/client-ecs/dist-es/runtimeConfig.js
61416
61878
  var getRuntimeConfig5 = (config) => {
61417
61879
  import_client33.emitWarningIfUnsupportedVersion(process.version);
61418
- const defaultsMode = import_config38.resolveDefaultsModeConfig(config);
61880
+ const defaultsMode = import_config39.resolveDefaultsModeConfig(config);
61419
61881
  const defaultConfigProvider = () => defaultsMode().then(import_client33.loadConfigsForDefaultMode);
61420
61882
  const clientSharedValues = getRuntimeConfig4(config);
61421
61883
  import_client32.emitWarningIfUnsupportedVersion(process.version);
@@ -61428,21 +61890,21 @@ var getRuntimeConfig5 = (config) => {
61428
61890
  ...config,
61429
61891
  runtime: "node",
61430
61892
  defaultsMode,
61431
- authSchemePreference: config?.authSchemePreference ?? import_config38.loadConfig(import_httpAuthSchemes6.NODE_AUTH_SCHEME_PREFERENCE_OPTIONS, loaderConfig),
61893
+ authSchemePreference: config?.authSchemePreference ?? import_config39.loadConfig(import_httpAuthSchemes6.NODE_AUTH_SCHEME_PREFERENCE_OPTIONS, loaderConfig),
61432
61894
  bodyLengthChecker: config?.bodyLengthChecker ?? import_serde6.calculateBodyLength,
61433
61895
  credentialDefaultProvider: config?.credentialDefaultProvider ?? defaultProvider,
61434
61896
  defaultUserAgentProvider: config?.defaultUserAgentProvider ?? import_client32.createDefaultUserAgentProvider({ serviceId: clientSharedValues.serviceId, clientVersion: package_default3.version }),
61435
- maxAttempts: config?.maxAttempts ?? import_config38.loadConfig(import_retry5.NODE_MAX_ATTEMPT_CONFIG_OPTIONS, config),
61436
- region: config?.region ?? import_config38.loadConfig(import_config38.NODE_REGION_CONFIG_OPTIONS, { ...import_config38.NODE_REGION_CONFIG_FILE_OPTIONS, ...loaderConfig }),
61897
+ maxAttempts: config?.maxAttempts ?? import_config39.loadConfig(import_retry5.NODE_MAX_ATTEMPT_CONFIG_OPTIONS, config),
61898
+ region: config?.region ?? import_config39.loadConfig(import_config39.NODE_REGION_CONFIG_OPTIONS, { ...import_config39.NODE_REGION_CONFIG_FILE_OPTIONS, ...loaderConfig }),
61437
61899
  requestHandler: import_node_http_handler3.NodeHttpHandler.create(config?.requestHandler ?? defaultConfigProvider),
61438
- retryMode: config?.retryMode ?? import_config38.loadConfig({
61900
+ retryMode: config?.retryMode ?? import_config39.loadConfig({
61439
61901
  ...import_retry5.NODE_RETRY_MODE_CONFIG_OPTIONS,
61440
61902
  default: async () => (await defaultConfigProvider()).retryMode || import_retry5.DEFAULT_RETRY_MODE
61441
61903
  }, config),
61442
61904
  streamCollector: config?.streamCollector ?? import_node_http_handler3.streamCollector,
61443
- useDualstackEndpoint: config?.useDualstackEndpoint ?? import_config38.loadConfig(import_config38.NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS, loaderConfig),
61444
- useFipsEndpoint: config?.useFipsEndpoint ?? import_config38.loadConfig(import_config38.NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS, loaderConfig),
61445
- userAgentAppId: config?.userAgentAppId ?? import_config38.loadConfig(import_client32.NODE_APP_ID_CONFIG_OPTIONS, loaderConfig)
61905
+ useDualstackEndpoint: config?.useDualstackEndpoint ?? import_config39.loadConfig(import_config39.NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS, loaderConfig),
61906
+ useFipsEndpoint: config?.useFipsEndpoint ?? import_config39.loadConfig(import_config39.NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS, loaderConfig),
61907
+ userAgentAppId: config?.userAgentAppId ?? import_config39.loadConfig(import_client32.NODE_APP_ID_CONFIG_OPTIONS, loaderConfig)
61446
61908
  };
61447
61909
  };
61448
61910
 
@@ -61507,7 +61969,7 @@ class ECSClient extends import_client37.Client {
61507
61969
  const _config_1 = resolveClientEndpointParameters3(_config_0);
61508
61970
  const _config_2 = import_client36.resolveUserAgentConfig(_config_1);
61509
61971
  const _config_3 = import_retry6.resolveRetryConfig(_config_2);
61510
- const _config_4 = import_config39.resolveRegionConfig(_config_3);
61972
+ const _config_4 = import_config40.resolveRegionConfig(_config_3);
61511
61973
  const _config_5 = import_client36.resolveHostHeaderConfig(_config_4);
61512
61974
  const _config_6 = import_endpoints8.resolveEndpointConfig(_config_5);
61513
61975
  const _config_7 = resolveHttpAuthSchemeConfig3(_config_6);
@@ -62006,13 +62468,13 @@ async function inspectPureBundle(bytes, contract) {
62006
62468
  throw Error("Pure entrypoint integrity failed");
62007
62469
  if (entries.some((e5) => e5.path.split("/").includes("node_modules")))
62008
62470
  throw Error("Pure bundle cannot supply dependencies");
62009
- const read2 = (name) => {
62471
+ const read3 = (name) => {
62010
62472
  const entry2 = entries.find((e5) => e5.path === name);
62011
62473
  if (!entry2)
62012
62474
  throw Error("Pure bundle manifest missing");
62013
62475
  return object5(uniqueJson(Buffer.from(entry2.bytes).toString("utf8")));
62014
62476
  };
62015
- const manifest = read2("skill.json"), runtime = object5(manifest.runtime), pkg = read2("package.json");
62477
+ const manifest = read3("skill.json"), runtime = object5(manifest.runtime), pkg = read3("package.json");
62016
62478
  if (manifest.kind !== "executable" || runtime.runtime !== "bun" || runtime.entrypoint !== contract.entrypoint || !Array.isArray(runtime.env) || runtime.env.length !== 0 || runtime.system_deps !== undefined && (!Array.isArray(runtime.system_deps) || runtime.system_deps.length !== 0) || runtime.needs_network === true || manifest.needs_network === true)
62017
62479
  throw Error("Pure bundle requires a credential-free self-contained Bun entrypoint");
62018
62480
  for (const key of ["dependencies", "optionalDependencies", "peerDependencies", "devDependencies", "scripts"])
@@ -62977,6 +63439,25 @@ class MemorySkillsStore {
62977
63439
  const found = this.versions.get(versionKey(principal.orgId, slug, version2));
62978
63440
  return found && found.orgId === principal.orgId ? found : null;
62979
63441
  }
63442
+ async getPublishedSelectionStates(principal, selections2) {
63443
+ if (selections2.length > MAX_PROFILE_SELECTIONS)
63444
+ throw new RangeError("Published selection lookup exceeds the profile selection limit");
63445
+ return selections2.map(({ slug, version: version2 }) => {
63446
+ const current = this.skills.get(skillKey(principal.orgId, slug));
63447
+ const selectedVersion = this.versions.get(versionKey(principal.orgId, slug, version2));
63448
+ const bundle2 = selectedVersion && this.bundles.get(skillKey(principal.orgId, selectedVersion.bundleSha256));
63449
+ return {
63450
+ slug,
63451
+ version: version2,
63452
+ current: current?.orgId === principal.orgId ? {
63453
+ lifecycle: current.lifecycle,
63454
+ ...current.tombstonedAt ? { tombstonedAt: current.tombstonedAt } : {}
63455
+ } : null,
63456
+ versionBundleSha256: selectedVersion?.orgId === principal.orgId ? selectedVersion.bundleSha256 : null,
63457
+ bundleAvailable: bundle2?.orgId === principal.orgId
63458
+ };
63459
+ });
63460
+ }
62980
63461
  async listSkills(principal) {
62981
63462
  return Array.from(this.skills.values()).filter((skill) => skill.orgId === principal.orgId && !skill.tombstonedAt).sort((a4, b4) => a4.slug.localeCompare(b4.slug));
62982
63463
  }
@@ -63785,6 +64266,25 @@ class PostgresSkillsStore {
63785
64266
  `;
63786
64267
  return rows[0] ? rowToSkillVersion(rows[0]) : null;
63787
64268
  }
64269
+ async getPublishedSelectionStates(principal, selections2) {
64270
+ if (selections2.length > MAX_PROFILE_SELECTIONS)
64271
+ throw new RangeError("Published selection lookup exceeds the profile selection limit");
64272
+ if (!selections2.length)
64273
+ return [];
64274
+ const requested = JSON.stringify(selections2.map(({ slug, version: version2 }) => ({ slug, version: version2 })));
64275
+ const rows = await this.sql`
64276
+ SELECT q.value->>'slug' AS slug, q.value->>'version' AS version,
64277
+ r.slug IS NOT NULL AS skill_exists, r.lifecycle, r.tombstoned_at,
64278
+ v.bundle_sha256, b.sha256 IS NOT NULL AS bundle_available
64279
+ FROM jsonb_array_elements(${requested}::text::jsonb) WITH ORDINALITY AS q(value, ordinal)
64280
+ LEFT JOIN skills_registry r ON r.org_id = ${principal.orgId} AND r.slug = q.value->>'slug'
64281
+ LEFT JOIN skills_versions v ON v.org_id = ${principal.orgId}
64282
+ AND v.slug = q.value->>'slug' AND v.version = q.value->>'version'
64283
+ LEFT JOIN skills_bundles b ON b.org_id = ${principal.orgId} AND b.sha256 = v.bundle_sha256
64284
+ ORDER BY q.ordinal
64285
+ `;
64286
+ return rows.map(rowToPublishedSelectionState);
64287
+ }
63788
64288
  async pinSkill(principal, slug, metadata = {}) {
63789
64289
  const rows = await this.sql`
63790
64290
  INSERT INTO skills_pins (org_id, principal, slug, pinned_at, metadata_json)
@@ -87489,7 +87989,7 @@ function assertRecurringCapability(value, action) {
87489
87989
  }
87490
87990
  function recurringRequest(action, input2) {
87491
87991
  const row = input2, base = "/api/v1/recurring-consents";
87492
- const read2 = ["draft", "list", "get", "occurrences"].includes(action);
87992
+ const read3 = ["draft", "list", "get", "occurrences"].includes(action);
87493
87993
  let path2 = action === "preview" ? `${base}/preview` : action === "draft" ? `/api/v1/recurring-consent-drafts/${row.draftId}` : action === "activate" ? `${base}/${row.draftId}/activate` : action === "list" ? base : `${base}/${row.consentId}${action === "get" ? "" : `/${action}`}`;
87494
87994
  if (action === "list" || action === "occurrences") {
87495
87995
  const query = new URLSearchParams;
@@ -87500,7 +88000,7 @@ function recurringRequest(action, input2) {
87500
88000
  if (query.size)
87501
88001
  path2 += `?${query}`;
87502
88002
  }
87503
- return { path: path2, read: read2, method: read2 ? "GET" : "POST", body: read2 ? undefined : JSON.stringify(action === "preview" ? input2 : action === "activate" ? row.approval : { contractVersion: 1 }) };
88003
+ return { path: path2, read: read3, method: read3 ? "GET" : "POST", body: read3 ? undefined : JSON.stringify(action === "preview" ? input2 : action === "activate" ? row.approval : { contractVersion: 1 }) };
87504
88004
  }
87505
88005
  var budget = exports_external2.object({ reservedCredits: integer2, settledCredits: integer2, admittedOccurrences: integer2 });
87506
88006
  var period = exports_external2.object({ startsAt: instant2, endsAt: instant2 });
@@ -88232,10 +88732,10 @@ async function readQuoteUnavailableCode(response) {
88232
88732
  let timer;
88233
88733
  let deadlineExceeded = false;
88234
88734
  const expired = Symbol("quote body deadline");
88235
- const deadline = new Promise((resolve18) => {
88735
+ const deadline = new Promise((resolve19) => {
88236
88736
  timer = setTimeout(() => {
88237
88737
  deadlineExceeded = true;
88238
- resolve18(expired);
88738
+ resolve19(expired);
88239
88739
  reader.cancel().catch(() => {});
88240
88740
  }, 1500);
88241
88741
  });
@@ -88761,24 +89261,24 @@ class RemoteSkillsClient {
88761
89261
  const identity3 = parseWorkspaceIdentity(identityValue, target.userId);
88762
89262
  if (identity3.user.membershipId !== target.membershipId)
88763
89263
  throw new WorkspaceIdentityMismatchError;
88764
- const request2 = invitationRequest(action, captured), read2 = action === "list" || action === "get";
89264
+ const request2 = invitationRequest(action, captured), read3 = action === "list" || action === "get";
88765
89265
  let response, value;
88766
89266
  try {
88767
89267
  response = await connection.request(request2.path, { method: request2.method, ...request2.body ? { body: request2.body } : {}, credentials: "omit" });
88768
89268
  value = JSON.parse(new TextDecoder().decode(await readBoundedResponse(response, response.ok ? 64 * 1024 : 4096)));
88769
89269
  } catch {
88770
- throw read2 ? new RemoteWorkspaceInvitationReadError : new RemoteWorkspaceInvitationUnconfirmedError;
89270
+ throw read3 ? new RemoteWorkspaceInvitationReadError : new RemoteWorkspaceInvitationUnconfirmedError;
88771
89271
  }
88772
89272
  if (!response.ok) {
88773
89273
  const code = invitationFailure(value, response.status);
88774
89274
  if (code)
88775
89275
  throw new RemoteWorkspaceInvitationError(code);
88776
- throw read2 ? new RemoteWorkspaceInvitationReadError : new RemoteWorkspaceInvitationUnconfirmedError;
89276
+ throw read3 ? new RemoteWorkspaceInvitationReadError : new RemoteWorkspaceInvitationUnconfirmedError;
88777
89277
  }
88778
89278
  try {
88779
89279
  return parseInvitationResult(action, value, captured, identity3.organization.id);
88780
89280
  } catch {
88781
- throw read2 ? new RemoteWorkspaceInvitationReadError : new RemoteWorkspaceInvitationUnconfirmedError;
89281
+ throw read3 ? new RemoteWorkspaceInvitationReadError : new RemoteWorkspaceInvitationUnconfirmedError;
88782
89282
  }
88783
89283
  }
88784
89284
  previewRecurringConsent(request2, context) {
@@ -89708,12 +90208,12 @@ class RemotePrivatePublicationsClient {
89708
90208
  previous = view;
89709
90209
  if (!["queued", "verifying"].includes(view.state) || Date.now() >= until)
89710
90210
  return view;
89711
- await new Promise((resolve18) => {
90211
+ await new Promise((resolve19) => {
89712
90212
  const timer = setTimeout(done, Math.min(1000, until - Date.now()));
89713
90213
  function done() {
89714
90214
  clearTimeout(timer);
89715
90215
  options.signal?.removeEventListener("abort", done);
89716
- resolve18();
90216
+ resolve19();
89717
90217
  }
89718
90218
  options.signal?.addEventListener("abort", done, { once: true });
89719
90219
  });
@@ -89945,23 +90445,23 @@ class RemoteSkillsAuthClient {
89945
90445
  }
89946
90446
  }
89947
90447
  // src/lib/private-publication-recovery.ts
89948
- import { constants as constants13, closeSync as closeSync17, fsyncSync as fsyncSync5, fstatSync as fstatSync17, lstatSync as lstatSync21, mkdirSync as mkdirSync14, openSync as openSync17, readSync as readSync12, realpathSync as realpathSync8, renameSync as renameSync6, unlinkSync as unlinkSync5, writeFileSync as writeFileSync10 } from "fs";
89949
- import { dirname as dirname24, isAbsolute as isAbsolute18, join as join36, resolve as resolve18 } from "path";
90448
+ import { constants as constants13, closeSync as closeSync17, fsyncSync as fsyncSync5, fstatSync as fstatSync17, lstatSync as lstatSync22, mkdirSync as mkdirSync14, openSync as openSync17, readSync as readSync12, realpathSync as realpathSync9, renameSync as renameSync6, unlinkSync as unlinkSync5, writeFileSync as writeFileSync10 } from "fs";
90449
+ import { dirname as dirname25, isAbsolute as isAbsolute18, join as join37, resolve as resolve19 } from "path";
89950
90450
  import { randomUUID as randomUUID11 } from "crypto";
89951
90451
  var fail = () => {
89952
90452
  throw new PrivatePublicationError("PUBLICATION_RECOVERY_INVALID", "The recovery directory is invalid or changed. Preserve it and inspect the existing intent; do not start a replacement automatically.");
89953
90453
  };
89954
90454
  function safeDirectory(directory) {
89955
- if (!isAbsolute18(directory) || directory !== resolve18(directory) || realpathSync8(directory) !== directory)
90455
+ if (!isAbsolute18(directory) || directory !== resolve19(directory) || realpathSync9(directory) !== directory)
89956
90456
  return fail();
89957
- for (let path2 = directory;; path2 = dirname24(path2)) {
89958
- const stat2 = lstatSync21(path2);
90457
+ for (let path2 = directory;; path2 = dirname25(path2)) {
90458
+ const stat2 = lstatSync22(path2);
89959
90459
  if (!stat2.isDirectory() || stat2.isSymbolicLink())
89960
90460
  return fail();
89961
- if (path2 === dirname24(path2))
90461
+ if (path2 === dirname25(path2))
89962
90462
  break;
89963
90463
  }
89964
- const own2 = lstatSync21(directory);
90464
+ const own2 = lstatSync22(directory);
89965
90465
  if ((own2.mode & 63) !== 0 || process.getuid && own2.uid !== process.getuid())
89966
90466
  return fail();
89967
90467
  return { dev: own2.dev, ino: own2.ino };
@@ -89972,7 +90472,7 @@ function unchangedDirectory(directory, identity3) {
89972
90472
  return fail();
89973
90473
  }
89974
90474
  function readOwned(directory, name, max) {
89975
- const identity3 = safeDirectory(directory), file2 = join36(directory, name);
90475
+ const identity3 = safeDirectory(directory), file2 = join37(directory, name);
89976
90476
  const fd = openSync17(file2, constants13.O_RDONLY | constants13.O_NOFOLLOW);
89977
90477
  try {
89978
90478
  const stat2 = fstatSync17(fd);
@@ -89996,7 +90496,7 @@ function readOwned(directory, name, max) {
89996
90496
  }
89997
90497
  }
89998
90498
  function writeOwned(directory, name, bytes) {
89999
- const fd = openSync17(join36(directory, name), constants13.O_WRONLY | constants13.O_CREAT | constants13.O_EXCL | constants13.O_NOFOLLOW, 384);
90499
+ const fd = openSync17(join37(directory, name), constants13.O_WRONLY | constants13.O_CREAT | constants13.O_EXCL | constants13.O_NOFOLLOW, 384);
90000
90500
  try {
90001
90501
  writeFileSync10(fd, bytes);
90002
90502
  fsyncSync5(fd);
@@ -90009,7 +90509,7 @@ function save(directory, value) {
90009
90509
  writeOwned(directory, temporary, JSON.stringify(value) + `
90010
90510
  `);
90011
90511
  unchangedDirectory(directory, identity3);
90012
- renameSync6(join36(directory, temporary), join36(directory, "receipt.json"));
90512
+ renameSync6(join37(directory, temporary), join37(directory, "receipt.json"));
90013
90513
  const fd = openSync17(directory, constants13.O_RDONLY | constants13.O_NOFOLLOW);
90014
90514
  try {
90015
90515
  fsyncSync5(fd);
@@ -90022,7 +90522,7 @@ function bind(client2, receipt) {
90022
90522
  throw new PrivatePublicationError("PUBLICATION_IDENTITY_CHANGED", "The fresh session does not match the recovery directory's server, account and membership.");
90023
90523
  }
90024
90524
  async function locked(directory, action) {
90025
- const identity3 = safeDirectory(directory), file2 = join36(directory, "operation.lock");
90525
+ const identity3 = safeDirectory(directory), file2 = join37(directory, "operation.lock");
90026
90526
  let fd;
90027
90527
  try {
90028
90528
  fd = openSync17(file2, constants13.O_WRONLY | constants13.O_CREAT | constants13.O_EXCL | constants13.O_NOFOLLOW, 384);
@@ -90038,7 +90538,7 @@ async function locked(directory, action) {
90038
90538
  } finally {
90039
90539
  closeSync17(fd);
90040
90540
  unchangedDirectory(directory, identity3);
90041
- const now2 = lstatSync21(file2);
90541
+ const now2 = lstatSync22(file2);
90042
90542
  if (now2.dev !== lock.dev || now2.ino !== lock.ino || !now2.isFile() || now2.isSymbolicLink())
90043
90543
  fail();
90044
90544
  unlinkSync5(file2);
@@ -90090,11 +90590,11 @@ async function preparePrivatePublication(client2, sourceDirectory, recoveryDirec
90090
90590
  phase: "prepared",
90091
90591
  intent: null
90092
90592
  };
90093
- if (!isAbsolute18(recoveryDirectory) || resolve18(recoveryDirectory) !== recoveryDirectory || realpathSync8(dirname24(recoveryDirectory)) !== dirname24(recoveryDirectory))
90593
+ if (!isAbsolute18(recoveryDirectory) || resolve19(recoveryDirectory) !== recoveryDirectory || realpathSync9(dirname25(recoveryDirectory)) !== dirname25(recoveryDirectory))
90094
90594
  return fail();
90095
90595
  mkdirSync14(recoveryDirectory, { mode: 448 });
90096
90596
  safeDirectory(recoveryDirectory);
90097
- const parent = openSync17(dirname24(recoveryDirectory), constants13.O_RDONLY | constants13.O_NOFOLLOW);
90597
+ const parent = openSync17(dirname25(recoveryDirectory), constants13.O_RDONLY | constants13.O_NOFOLLOW);
90098
90598
  try {
90099
90599
  fsyncSync5(parent);
90100
90600
  } finally {