@hasna/skills 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/README.md +176 -5
  2. package/bin/index.js +6518 -4950
  3. package/bin/mcp.js +1173 -410
  4. package/bin/migrate.js +148 -40
  5. package/bin/server.js +53 -83
  6. package/bin/worker.js +41 -73
  7. package/dist/admin-contract.d.ts +37 -19
  8. package/dist/admin-contract.js +1 -1
  9. package/dist/cli/cli.test-utils.d.ts +10 -8
  10. package/dist/cli/commands/customer-profile.d.ts +2 -0
  11. package/dist/cli/commands/customer-verification.d.ts +5 -0
  12. package/dist/cli/commands/tool-primitives.d.ts +1 -1
  13. package/dist/cli/commands/workspace-member-mutations.d.ts +2 -0
  14. package/dist/cli/commands/workspace-members.d.ts +2 -0
  15. package/dist/cli/env-assignment.d.ts +9 -0
  16. package/dist/index.d.ts +5 -2
  17. package/dist/index.js +613 -153
  18. package/dist/lib/agent-sync.d.ts +13 -8
  19. package/dist/lib/api-url.d.ts +4 -3
  20. package/dist/lib/app-home.d.ts +0 -1
  21. package/dist/lib/client-types.d.ts +75 -0
  22. package/dist/lib/credential-state.d.ts +12 -0
  23. package/dist/lib/fleet-credentials.d.ts +41 -15
  24. package/dist/lib/home-adoption.d.ts +2 -0
  25. package/dist/lib/home-census.d.ts +3 -1
  26. package/dist/lib/local-opt-in.d.ts +24 -0
  27. package/dist/lib/portable-skills-files.d.ts +6 -2
  28. package/dist/lib/read-access.d.ts +83 -0
  29. package/dist/lib/remote-auth.d.ts +14 -0
  30. package/dist/lib/remote-client.d.ts +34 -5
  31. package/dist/lib/remote-profile.d.ts +26 -0
  32. package/dist/lib/remote-registry.d.ts +7 -3
  33. package/dist/lib/remote-workspace.d.ts +76 -0
  34. package/dist/lib/skillinfo.d.ts +1 -1
  35. package/dist/mcp/helpers.d.ts +22 -0
  36. package/dist/mcp/index.d.ts +16 -0
  37. package/dist/sdk/governance-store.d.ts +1 -0
  38. package/dist/sdk/index.d.ts +5 -2
  39. package/dist/sdk/index.js +1084 -283
  40. package/dist/sdk/outputs.d.ts +0 -11
  41. package/dist/sdk/runs.d.ts +1 -1
  42. package/dist/storage.js +6 -40
  43. package/docs/skill-standard.md +30 -2
  44. package/package.json +6 -4
  45. package/dist/lib/instance-credentials-race.fixture.d.ts +0 -1
package/dist/sdk/index.js CHANGED
@@ -17645,7 +17645,7 @@ var require_httpAuthSchemes = __commonJS((exports) => {
17645
17645
  });
17646
17646
 
17647
17647
  // ../../node_modules/.bun/@aws-sdk+credential-provider-env@3.972.70/node_modules/@aws-sdk/credential-provider-env/dist-es/fromEnv.js
17648
- var import_client7, import_config, 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 () => {
17648
+ var import_client8, import_config, 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 () => {
17649
17649
  init?.logger?.debug("@aws-sdk/credential-provider-env - fromEnv");
17650
17650
  const accessKeyId = process.env[ENV_KEY];
17651
17651
  const secretAccessKey = process.env[ENV_SECRET];
@@ -17662,13 +17662,13 @@ var import_client7, import_config, ENV_KEY = "AWS_ACCESS_KEY_ID", ENV_SECRET = "
17662
17662
  ...credentialScope && { credentialScope },
17663
17663
  ...accountId && { accountId }
17664
17664
  };
17665
- import_client7.setCredentialFeature(credentials, "CREDENTIALS_ENV_VARS", "g");
17665
+ import_client8.setCredentialFeature(credentials, "CREDENTIALS_ENV_VARS", "g");
17666
17666
  return credentials;
17667
17667
  }
17668
17668
  throw new import_config.CredentialsProviderError("Unable to find environment variable credentials.", { logger: init?.logger });
17669
17669
  };
17670
17670
  var init_fromEnv = __esm(() => {
17671
- import_client7 = __toESM(require_client2(), 1);
17671
+ import_client8 = __toESM(require_client2(), 1);
17672
17672
  import_config = __toESM(require_config(), 1);
17673
17673
  });
17674
17674
 
@@ -19010,7 +19010,7 @@ var retryWrapper = (toRetry, maxRetries, delayMs) => {
19010
19010
 
19011
19011
  // ../../node_modules/.bun/@aws-sdk+credential-provider-http@3.972.72/node_modules/@aws-sdk/credential-provider-http/dist-es/fromHttp/fromHttp.js
19012
19012
  import fs from "fs/promises";
19013
- var import_client8, import_config9, 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 = {}) => {
19013
+ var import_client9, import_config9, 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 = {}) => {
19014
19014
  options.logger?.debug("@aws-sdk/credential-provider-http - fromHttp");
19015
19015
  let host;
19016
19016
  const relative2 = options.awsContainerCredentialsRelativeUri ?? process.env[AWS_CONTAINER_CREDENTIALS_RELATIVE_URI];
@@ -19047,7 +19047,7 @@ Set AWS_CONTAINER_CREDENTIALS_FULL_URI or AWS_CONTAINER_CREDENTIALS_RELATIVE_URI
19047
19047
  }
19048
19048
  try {
19049
19049
  const result = await requestHandler.handle(request, { requestTimeout });
19050
- return getCredentials(result.response).then((creds) => import_client8.setCredentialFeature(creds, "CREDENTIALS_HTTP", "z"));
19050
+ return getCredentials(result.response).then((creds) => import_client9.setCredentialFeature(creds, "CREDENTIALS_HTTP", "z"));
19051
19051
  } catch (e2) {
19052
19052
  throw new import_config9.CredentialsProviderError(String(e2), { logger: options.logger });
19053
19053
  }
@@ -19069,7 +19069,7 @@ Set AWS_CONTAINER_CREDENTIALS_FULL_URI or AWS_CONTAINER_CREDENTIALS_RELATIVE_URI
19069
19069
  var init_fromHttp = __esm(() => {
19070
19070
  init_checkUrl();
19071
19071
  init_requestHelpers();
19072
- import_client8 = __toESM(require_client2(), 1);
19072
+ import_client9 = __toESM(require_client2(), 1);
19073
19073
  import_config9 = __toESM(require_config(), 1);
19074
19074
  import_node_http_handler = __toESM(require_dist_cjs6(), 1);
19075
19075
  });
@@ -20453,7 +20453,7 @@ var init_loadSso = __esm(() => {
20453
20453
  });
20454
20454
 
20455
20455
  // ../../node_modules/.bun/@aws-sdk+credential-provider-sso@3.973.14/node_modules/@aws-sdk/credential-provider-sso/dist-es/resolveSSOCredentials.js
20456
- var import_client9, import_config15, SHOULD_FAIL_CREDENTIAL_CHAIN = false, resolveSSOCredentials = async ({ ssoStartUrl, ssoSession, ssoAccountId, ssoRegion, ssoRoleName, ssoClient, clientConfig, parentClientConfig, callerClientConfig, profile, filepath, configFilepath, ignoreCache, logger }) => {
20456
+ var import_client10, import_config15, SHOULD_FAIL_CREDENTIAL_CHAIN = false, resolveSSOCredentials = async ({ ssoStartUrl, ssoSession, ssoAccountId, ssoRegion, ssoRoleName, ssoClient, clientConfig, parentClientConfig, callerClientConfig, profile, filepath, configFilepath, ignoreCache, logger }) => {
20457
20457
  let token;
20458
20458
  const refreshMessage = `To refresh this SSO session run aws sso login with the corresponding profile.`;
20459
20459
  if (ssoSession) {
@@ -20529,15 +20529,15 @@ var import_client9, import_config15, SHOULD_FAIL_CREDENTIAL_CHAIN = false, resol
20529
20529
  ...accountId && { accountId }
20530
20530
  };
20531
20531
  if (ssoSession) {
20532
- import_client9.setCredentialFeature(credentials, "CREDENTIALS_SSO", "s");
20532
+ import_client10.setCredentialFeature(credentials, "CREDENTIALS_SSO", "s");
20533
20533
  } else {
20534
- import_client9.setCredentialFeature(credentials, "CREDENTIALS_SSO_LEGACY", "u");
20534
+ import_client10.setCredentialFeature(credentials, "CREDENTIALS_SSO_LEGACY", "u");
20535
20535
  }
20536
20536
  return credentials;
20537
20537
  };
20538
20538
  var init_resolveSSOCredentials = __esm(() => {
20539
20539
  init_dist_es4();
20540
- import_client9 = __toESM(require_client2(), 1);
20540
+ import_client10 = __toESM(require_client2(), 1);
20541
20541
  import_config15 = __toESM(require_config(), 1);
20542
20542
  });
20543
20543
 
@@ -20649,7 +20649,7 @@ var init_dist_es5 = __esm(() => {
20649
20649
  });
20650
20650
 
20651
20651
  // ../../node_modules/.bun/@aws-sdk+credential-provider-ini@3.973.15/node_modules/@aws-sdk/credential-provider-ini/dist-es/resolveCredentialSource.js
20652
- var import_client10, import_config18, resolveCredentialSource = (credentialSource, profileName, logger) => {
20652
+ var import_client11, import_config18, resolveCredentialSource = (credentialSource, profileName, logger) => {
20653
20653
  const sourceProvidersMap = {
20654
20654
  EcsContainer: async (options) => {
20655
20655
  const { fromHttp: fromHttp2 } = await Promise.resolve().then(() => (init_dist_es3(), exports_dist_es3));
@@ -20673,9 +20673,9 @@ var import_client10, import_config18, resolveCredentialSource = (credentialSourc
20673
20673
  } else {
20674
20674
  throw new import_config18.CredentialsProviderError(`Unsupported credential source in profile ${profileName}. Got ${credentialSource}, expected EcsContainer or Ec2InstanceMetadata or Environment.`, { logger });
20675
20675
  }
20676
- }, setNamedProvider = (creds) => import_client10.setCredentialFeature(creds, "CREDENTIALS_PROFILE_NAMED_PROVIDER", "p");
20676
+ }, setNamedProvider = (creds) => import_client11.setCredentialFeature(creds, "CREDENTIALS_PROFILE_NAMED_PROVIDER", "p");
20677
20677
  var init_resolveCredentialSource = __esm(() => {
20678
- import_client10 = __toESM(require_client2(), 1);
20678
+ import_client11 = __toESM(require_client2(), 1);
20679
20679
  import_config18 = __toESM(require_config(), 1);
20680
20680
  });
20681
20681
 
@@ -21702,7 +21702,7 @@ var require_sts = __commonJS((exports) => {
21702
21702
  });
21703
21703
 
21704
21704
  // ../../node_modules/.bun/@aws-sdk+credential-provider-ini@3.973.15/node_modules/@aws-sdk/credential-provider-ini/dist-es/resolveAssumeRoleCredentials.js
21705
- var import_client11, import_config19, isAssumeRoleProfile = (arg, { profile = "default", logger } = {}) => {
21705
+ var import_client12, import_config19, isAssumeRoleProfile = (arg, { profile = "default", logger } = {}) => {
21706
21706
  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 }));
21707
21707
  }, isAssumeRoleWithSourceProfile = (arg, { profile, logger }) => {
21708
21708
  const withSourceProfile = typeof arg.source_profile === "string" && typeof arg.credential_source === "undefined";
@@ -21741,7 +21741,7 @@ var import_client11, import_config19, isAssumeRoleProfile = (arg, { profile = "d
21741
21741
  [source_profile]: true
21742
21742
  }, isCredentialSourceWithoutRoleArn(profiles[source_profile] ?? {})) : (await resolveCredentialSource(profileData.credential_source, profileName, options.logger)(options))();
21743
21743
  if (isCredentialSourceWithoutRoleArn(profileData)) {
21744
- return sourceCredsProvider.then((creds) => import_client11.setCredentialFeature(creds, "CREDENTIALS_PROFILE_SOURCE_PROFILE", "o"));
21744
+ return sourceCredsProvider.then((creds) => import_client12.setCredentialFeature(creds, "CREDENTIALS_PROFILE_SOURCE_PROFILE", "o"));
21745
21745
  } else {
21746
21746
  const params = {
21747
21747
  RoleArn: profileData.role_arn,
@@ -21758,14 +21758,14 @@ var import_client11, import_config19, isAssumeRoleProfile = (arg, { profile = "d
21758
21758
  params.TokenCode = await options.mfaCodeProvider(mfa_serial);
21759
21759
  }
21760
21760
  const sourceCreds = await sourceCredsProvider;
21761
- return options.roleAssumer(sourceCreds, params).then((creds) => import_client11.setCredentialFeature(creds, "CREDENTIALS_PROFILE_SOURCE_PROFILE", "o"));
21761
+ return options.roleAssumer(sourceCreds, params).then((creds) => import_client12.setCredentialFeature(creds, "CREDENTIALS_PROFILE_SOURCE_PROFILE", "o"));
21762
21762
  }
21763
21763
  }, isCredentialSourceWithoutRoleArn = (section) => {
21764
21764
  return !section.role_arn && !!section.credential_source;
21765
21765
  };
21766
21766
  var init_resolveAssumeRoleCredentials = __esm(() => {
21767
21767
  init_resolveCredentialSource();
21768
- import_client11 = __toESM(require_client2(), 1);
21768
+ import_client12 = __toESM(require_client2(), 1);
21769
21769
  import_config19 = __toESM(require_config(), 1);
21770
21770
  });
21771
21771
 
@@ -22766,7 +22766,7 @@ var init_LoginCredentialsFetcher = __esm(() => {
22766
22766
  });
22767
22767
 
22768
22768
  // ../../node_modules/.bun/@aws-sdk+credential-provider-login@3.972.77/node_modules/@aws-sdk/credential-provider-login/dist-es/fromLoginCredentials.js
22769
- var import_client12, import_config21, fromLoginCredentials = (init) => async ({ callerClientConfig } = {}) => {
22769
+ var import_client13, import_config21, fromLoginCredentials = (init) => async ({ callerClientConfig } = {}) => {
22770
22770
  init?.logger?.debug?.("@aws-sdk/credential-providers - fromLoginCredentials");
22771
22771
  const profiles = await import_config21.parseKnownFiles(init || {});
22772
22772
  const profileName = import_config21.getProfileName({
@@ -22781,11 +22781,11 @@ var import_client12, import_config21, fromLoginCredentials = (init) => async ({
22781
22781
  }
22782
22782
  const fetcher = new LoginCredentialsFetcher(profile, init, callerClientConfig);
22783
22783
  const credentials = await fetcher.loadCredentials();
22784
- return import_client12.setCredentialFeature(credentials, "CREDENTIALS_LOGIN", "AD");
22784
+ return import_client13.setCredentialFeature(credentials, "CREDENTIALS_LOGIN", "AD");
22785
22785
  };
22786
22786
  var init_fromLoginCredentials = __esm(() => {
22787
22787
  init_LoginCredentialsFetcher();
22788
- import_client12 = __toESM(require_client2(), 1);
22788
+ import_client13 = __toESM(require_client2(), 1);
22789
22789
  import_config21 = __toESM(require_config(), 1);
22790
22790
  });
22791
22791
 
@@ -22799,7 +22799,7 @@ var init_dist_es6 = __esm(() => {
22799
22799
  });
22800
22800
 
22801
22801
  // ../../node_modules/.bun/@aws-sdk+credential-provider-ini@3.973.15/node_modules/@aws-sdk/credential-provider-ini/dist-es/resolveLoginCredentials.js
22802
- var import_client13, isLoginProfile = (data) => {
22802
+ var import_client14, isLoginProfile = (data) => {
22803
22803
  return Boolean(data && data.login_session);
22804
22804
  }, resolveLoginCredentials = async (profileName, options, callerClientConfig) => {
22805
22805
  const { fromLoginCredentials: fromLoginCredentials2 } = await Promise.resolve().then(() => (init_dist_es6(), exports_dist_es5));
@@ -22807,14 +22807,14 @@ var import_client13, isLoginProfile = (data) => {
22807
22807
  ...options,
22808
22808
  profile: profileName
22809
22809
  })({ callerClientConfig });
22810
- return import_client13.setCredentialFeature(credentials, "CREDENTIALS_PROFILE_LOGIN", "AC");
22810
+ return import_client14.setCredentialFeature(credentials, "CREDENTIALS_PROFILE_LOGIN", "AC");
22811
22811
  };
22812
22812
  var init_resolveLoginCredentials = __esm(() => {
22813
- import_client13 = __toESM(require_client2(), 1);
22813
+ import_client14 = __toESM(require_client2(), 1);
22814
22814
  });
22815
22815
 
22816
22816
  // ../../node_modules/.bun/@aws-sdk+credential-provider-process@3.972.70/node_modules/@aws-sdk/credential-provider-process/dist-es/getValidatedProcessCredentials.js
22817
- var import_client14, getValidatedProcessCredentials = (profileName, data, profiles) => {
22817
+ var import_client15, getValidatedProcessCredentials = (profileName, data, profiles) => {
22818
22818
  if (data.Version !== 1) {
22819
22819
  throw Error(`Profile ${profileName} credential_process did not return Version 1.`);
22820
22820
  }
@@ -22840,11 +22840,11 @@ var import_client14, getValidatedProcessCredentials = (profileName, data, profil
22840
22840
  ...data.CredentialScope && { credentialScope: data.CredentialScope },
22841
22841
  ...accountId && { accountId }
22842
22842
  };
22843
- import_client14.setCredentialFeature(credentials, "CREDENTIALS_PROCESS", "w");
22843
+ import_client15.setCredentialFeature(credentials, "CREDENTIALS_PROCESS", "w");
22844
22844
  return credentials;
22845
22845
  };
22846
22846
  var init_getValidatedProcessCredentials = __esm(() => {
22847
- import_client14 = __toESM(require_client2(), 1);
22847
+ import_client15 = __toESM(require_client2(), 1);
22848
22848
  });
22849
22849
 
22850
22850
  // ../../node_modules/.bun/@aws-sdk+credential-provider-process@3.972.70/node_modules/@aws-sdk/credential-provider-process/dist-es/resolveProcessCredentials.js
@@ -22905,20 +22905,20 @@ var init_dist_es7 = __esm(() => {
22905
22905
  });
22906
22906
 
22907
22907
  // ../../node_modules/.bun/@aws-sdk+credential-provider-ini@3.973.15/node_modules/@aws-sdk/credential-provider-ini/dist-es/resolveProcessCredentials.js
22908
- var import_client15, isProcessProfile = (arg) => Boolean(arg) && typeof arg === "object" && typeof arg.credential_process === "string", resolveProcessCredentials2 = async (options, profile) => {
22908
+ var import_client16, isProcessProfile = (arg) => Boolean(arg) && typeof arg === "object" && typeof arg.credential_process === "string", resolveProcessCredentials2 = async (options, profile) => {
22909
22909
  const { fromProcess: fromProcess2 } = await Promise.resolve().then(() => (init_dist_es7(), exports_dist_es6));
22910
22910
  const credentials = await fromProcess2({
22911
22911
  ...options,
22912
22912
  profile
22913
22913
  })();
22914
- return import_client15.setCredentialFeature(credentials, "CREDENTIALS_PROFILE_PROCESS", "v");
22914
+ return import_client16.setCredentialFeature(credentials, "CREDENTIALS_PROFILE_PROCESS", "v");
22915
22915
  };
22916
22916
  var init_resolveProcessCredentials2 = __esm(() => {
22917
- import_client15 = __toESM(require_client2(), 1);
22917
+ import_client16 = __toESM(require_client2(), 1);
22918
22918
  });
22919
22919
 
22920
22920
  // ../../node_modules/.bun/@aws-sdk+credential-provider-ini@3.973.15/node_modules/@aws-sdk/credential-provider-ini/dist-es/resolveSsoCredentials.js
22921
- var import_client16, resolveSsoCredentials = async (profile, profileData, options = {}, callerClientConfig) => {
22921
+ var import_client17, resolveSsoCredentials = async (profile, profileData, options = {}, callerClientConfig) => {
22922
22922
  const { fromSSO: fromSSO2 } = await Promise.resolve().then(() => (init_dist_es5(), exports_dist_es4));
22923
22923
  return fromSSO2({
22924
22924
  profile,
@@ -22929,18 +22929,18 @@ var import_client16, resolveSsoCredentials = async (profile, profileData, option
22929
22929
  callerClientConfig
22930
22930
  }).then((creds) => {
22931
22931
  if (profileData.sso_session) {
22932
- return import_client16.setCredentialFeature(creds, "CREDENTIALS_PROFILE_SSO", "r");
22932
+ return import_client17.setCredentialFeature(creds, "CREDENTIALS_PROFILE_SSO", "r");
22933
22933
  } else {
22934
- return import_client16.setCredentialFeature(creds, "CREDENTIALS_PROFILE_SSO_LEGACY", "t");
22934
+ return import_client17.setCredentialFeature(creds, "CREDENTIALS_PROFILE_SSO_LEGACY", "t");
22935
22935
  }
22936
22936
  });
22937
22937
  }, isSsoProfile2 = (arg) => arg && (typeof arg.sso_start_url === "string" || typeof arg.sso_account_id === "string" || typeof arg.sso_session === "string" || typeof arg.sso_region === "string" || typeof arg.sso_role_name === "string");
22938
22938
  var init_resolveSsoCredentials = __esm(() => {
22939
- import_client16 = __toESM(require_client2(), 1);
22939
+ import_client17 = __toESM(require_client2(), 1);
22940
22940
  });
22941
22941
 
22942
22942
  // ../../node_modules/.bun/@aws-sdk+credential-provider-ini@3.973.15/node_modules/@aws-sdk/credential-provider-ini/dist-es/resolveStaticCredentials.js
22943
- var import_client17, isStaticCredsProfile = (arg) => Boolean(arg) && typeof arg === "object" && typeof arg.aws_access_key_id === "string" && typeof arg.aws_secret_access_key === "string" && ["undefined", "string"].indexOf(typeof arg.aws_session_token) > -1 && ["undefined", "string"].indexOf(typeof arg.aws_account_id) > -1, resolveStaticCredentials = async (profile, options) => {
22943
+ var import_client18, isStaticCredsProfile = (arg) => Boolean(arg) && typeof arg === "object" && typeof arg.aws_access_key_id === "string" && typeof arg.aws_secret_access_key === "string" && ["undefined", "string"].indexOf(typeof arg.aws_session_token) > -1 && ["undefined", "string"].indexOf(typeof arg.aws_account_id) > -1, resolveStaticCredentials = async (profile, options) => {
22944
22944
  options?.logger?.debug("@aws-sdk/credential-provider-ini - resolveStaticCredentials");
22945
22945
  const credentials = {
22946
22946
  accessKeyId: profile.aws_access_key_id,
@@ -22949,10 +22949,10 @@ var import_client17, isStaticCredsProfile = (arg) => Boolean(arg) && typeof arg
22949
22949
  ...profile.aws_credential_scope && { credentialScope: profile.aws_credential_scope },
22950
22950
  ...profile.aws_account_id && { accountId: profile.aws_account_id }
22951
22951
  };
22952
- return import_client17.setCredentialFeature(credentials, "CREDENTIALS_PROFILE", "n");
22952
+ return import_client18.setCredentialFeature(credentials, "CREDENTIALS_PROFILE", "n");
22953
22953
  };
22954
22954
  var init_resolveStaticCredentials = __esm(() => {
22955
- import_client17 = __toESM(require_client2(), 1);
22955
+ import_client18 = __toESM(require_client2(), 1);
22956
22956
  });
22957
22957
 
22958
22958
  // ../../node_modules/.bun/@aws-sdk+credential-provider-web-identity@3.972.76/node_modules/@aws-sdk/credential-provider-web-identity/dist-es/fromWebToken.js
@@ -22984,7 +22984,7 @@ var fromWebToken = (init) => async (awsIdentityProperties) => {
22984
22984
 
22985
22985
  // ../../node_modules/.bun/@aws-sdk+credential-provider-web-identity@3.972.76/node_modules/@aws-sdk/credential-provider-web-identity/dist-es/fromTokenFile.js
22986
22986
  import { readFileSync as readFileSync3 } from "fs";
22987
- var import_client18, import_config24, 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) => {
22987
+ var import_client19, import_config24, 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) => {
22988
22988
  init.logger?.debug("@aws-sdk/credential-provider-web-identity - fromTokenFile");
22989
22989
  const webIdentityTokenFile = init?.webIdentityTokenFile ?? process.env[ENV_TOKEN_FILE];
22990
22990
  const roleArn = init?.roleArn ?? process.env[ENV_ROLE_ARN];
@@ -23001,12 +23001,12 @@ var import_client18, import_config24, ENV_TOKEN_FILE = "AWS_WEB_IDENTITY_TOKEN_F
23001
23001
  roleSessionName
23002
23002
  })(awsIdentityProperties);
23003
23003
  if (webIdentityTokenFile === process.env[ENV_TOKEN_FILE]) {
23004
- import_client18.setCredentialFeature(credentials, "CREDENTIALS_ENV_VARS_STS_WEB_ID_TOKEN", "h");
23004
+ import_client19.setCredentialFeature(credentials, "CREDENTIALS_ENV_VARS_STS_WEB_ID_TOKEN", "h");
23005
23005
  }
23006
23006
  return credentials;
23007
23007
  };
23008
23008
  var init_fromTokenFile = __esm(() => {
23009
- import_client18 = __toESM(require_client2(), 1);
23009
+ import_client19 = __toESM(require_client2(), 1);
23010
23010
  import_config24 = __toESM(require_config(), 1);
23011
23011
  });
23012
23012
 
@@ -23021,7 +23021,7 @@ var init_dist_es8 = __esm(() => {
23021
23021
  });
23022
23022
 
23023
23023
  // ../../node_modules/.bun/@aws-sdk+credential-provider-ini@3.973.15/node_modules/@aws-sdk/credential-provider-ini/dist-es/resolveWebIdentityCredentials.js
23024
- var import_client19, isWebIdentityProfile = (arg) => Boolean(arg) && typeof arg === "object" && typeof arg.web_identity_token_file === "string" && typeof arg.role_arn === "string" && ["undefined", "string"].indexOf(typeof arg.role_session_name) > -1, resolveWebIdentityCredentials = async (profile, options, callerClientConfig) => {
23024
+ var import_client20, isWebIdentityProfile = (arg) => Boolean(arg) && typeof arg === "object" && typeof arg.web_identity_token_file === "string" && typeof arg.role_arn === "string" && ["undefined", "string"].indexOf(typeof arg.role_session_name) > -1, resolveWebIdentityCredentials = async (profile, options, callerClientConfig) => {
23025
23025
  const { fromTokenFile: fromTokenFile2 } = await Promise.resolve().then(() => (init_dist_es8(), exports_dist_es7));
23026
23026
  const credentials = await fromTokenFile2({
23027
23027
  webIdentityTokenFile: profile.web_identity_token_file,
@@ -23033,10 +23033,10 @@ var import_client19, isWebIdentityProfile = (arg) => Boolean(arg) && typeof arg
23033
23033
  })({
23034
23034
  callerClientConfig
23035
23035
  });
23036
- return import_client19.setCredentialFeature(credentials, "CREDENTIALS_PROFILE_STS_WEB_ID_TOKEN", "q");
23036
+ return import_client20.setCredentialFeature(credentials, "CREDENTIALS_PROFILE_STS_WEB_ID_TOKEN", "q");
23037
23037
  };
23038
23038
  var init_resolveWebIdentityCredentials = __esm(() => {
23039
- import_client19 = __toESM(require_client2(), 1);
23039
+ import_client20 = __toESM(require_client2(), 1);
23040
23040
  });
23041
23041
 
23042
23042
  // ../../node_modules/.bun/@aws-sdk+credential-provider-ini@3.973.15/node_modules/@aws-sdk/credential-provider-ini/dist-es/resolveProfileData.js
@@ -23097,15 +23097,23 @@ var init_dist_es9 = __esm(() => {
23097
23097
  init_fromIni();
23098
23098
  });
23099
23099
 
23100
- // ../../node_modules/.bun/@hasna+events@0.1.16/node_modules/@hasna/events/dist/index.js
23100
+ // ../events/dist/index.js
23101
23101
  import { chmod, mkdir, readFile, rename, writeFile as writeFile2 } from "fs/promises";
23102
23102
  import { Buffer as Buffer2 } from "buffer";
23103
+ import { existsSync as existsSync22 } from "fs";
23104
+ import { join as join22 } from "path";
23103
23105
  import { existsSync as existsSync16 } from "fs";
23104
23106
  import { homedir as homedir5 } from "os";
23105
- import { join as join20 } from "path";
23107
+ import { join as join20, resolve as resolve3 } from "path";
23108
+ import { homedir as pathsResolverHomedir2 } from "os";
23109
+ import { join as pathsResolverJoin2 } from "path";
23106
23110
  import { createHmac as createHmac3, timingSafeEqual as timingSafeEqual2 } from "crypto";
23111
+ import { lookup as dnsLookup } from "dns/promises";
23112
+ import { isIP as isIP2 } from "net";
23107
23113
  import { randomUUID as randomUUID5 } from "crypto";
23108
23114
  import { spawn } from "child_process";
23115
+ import { request as nodeHttpRequest } from "http";
23116
+ import { request as nodeHttpsRequest } from "https";
23109
23117
  import { randomUUID as randomUUID22 } from "crypto";
23110
23118
  function getPathValue(input, path) {
23111
23119
  return path.split(".").reduce((value, part) => {
@@ -23202,8 +23210,90 @@ function channelMatchesEvent(channel, event) {
23202
23210
  return true;
23203
23211
  return channel.filters.some((filter) => eventMatchesFilter(event, filter));
23204
23212
  }
23213
+ function pathsResolverAssertApp2(app) {
23214
+ if (typeof app !== "string" || app.length === 0) {
23215
+ throw new TypeError("paths: app must be a non-empty string");
23216
+ }
23217
+ if (!PATHS_RESOLVER_APP_SLUG_RE2.test(app)) {
23218
+ throw new TypeError(`paths: invalid app slug "${app}" \u2014 expected lowercase kebab-case ([a-z0-9]+(-[a-z0-9]+)*)`);
23219
+ }
23220
+ }
23221
+ function pathsResolverAssertKind(kind) {
23222
+ if (!Object.keys(PATHS_RESOLVER_KIND_ENV).includes(kind)) {
23223
+ throw new TypeError(`paths: invalid path kind "${kind}" \u2014 expected one of ${Object.keys(PATHS_RESOLVER_KIND_ENV).join(", ")}`);
23224
+ }
23225
+ }
23226
+ function pathsResolverBaseDir(kind, options) {
23227
+ pathsResolverAssertKind(kind);
23228
+ const env = options.env ?? process.env;
23229
+ const override = env[PATHS_RESOLVER_KIND_ENV[kind]];
23230
+ if (typeof override === "string" && override.length > 0)
23231
+ return override;
23232
+ const home = options.home ?? pathsResolverHomedir2();
23233
+ const platform = options.platform ?? process.platform;
23234
+ if (platform === "darwin") {
23235
+ switch (kind) {
23236
+ case "config":
23237
+ case "data":
23238
+ return pathsResolverJoin2(home, "Library", "Application Support", "Hasna");
23239
+ case "cache":
23240
+ return pathsResolverJoin2(home, "Library", "Caches", "Hasna");
23241
+ case "state":
23242
+ return pathsResolverJoin2(home, "Library", "Logs", "Hasna");
23243
+ }
23244
+ }
23245
+ switch (kind) {
23246
+ case "config":
23247
+ return pathsResolverJoin2(home, ".config", "hasna");
23248
+ case "data":
23249
+ return pathsResolverJoin2(home, ".local", "share", "hasna");
23250
+ case "state":
23251
+ return pathsResolverJoin2(home, ".local", "state", "hasna");
23252
+ case "cache":
23253
+ return pathsResolverJoin2(home, ".cache", "hasna");
23254
+ }
23255
+ }
23256
+ function pathsResolverResolve(kind, options) {
23257
+ pathsResolverAssertApp2(options.app);
23258
+ const appSegment = options.internal === true ? pathsResolverJoin2("internal", options.app) : options.app;
23259
+ return pathsResolverJoin2(pathsResolverBaseDir(kind, options), appSegment);
23260
+ }
23261
+ function dataDir2(options) {
23262
+ return pathsResolverResolve("data", options);
23263
+ }
23264
+ function effectiveHome2() {
23265
+ return process.env["HOME"] || process.env["USERPROFILE"] || homedir5();
23266
+ }
23267
+ function legacyHomeDir() {
23268
+ return join20(effectiveHome2(), ".hasna", "events");
23269
+ }
23270
+ function resolverHome() {
23271
+ return dataDir2({ app: "events", home: effectiveHome2() || undefined });
23272
+ }
23273
+ function adoptResolverHome(resolved, env = process.env) {
23274
+ const dataOverride = env.HASNA_DATA_HOME;
23275
+ if (typeof dataOverride === "string" && dataOverride.trim().length > 0)
23276
+ return true;
23277
+ return existsSync16(join20(resolved, EVENTS_STORE_SENTINEL_FILE));
23278
+ }
23279
+ function exactEventsHome() {
23280
+ const dir = process.env[HASNA_EVENTS_DIR_ENV];
23281
+ if (dir && dir.trim())
23282
+ return dir.trim();
23283
+ const home = process.env[HASNA_EVENTS_HOME_ENV];
23284
+ if (home && home.trim())
23285
+ return home.trim();
23286
+ return;
23287
+ }
23288
+ function getEventsHome() {
23289
+ const exact = exactEventsHome();
23290
+ if (exact)
23291
+ return resolve3(exact);
23292
+ const resolved = resolverHome();
23293
+ return adoptResolverHome(resolved) ? resolve3(resolved) : resolve3(legacyHomeDir());
23294
+ }
23205
23295
  function getEventsDataDir(override) {
23206
- return override || process.env[HASNA_EVENTS_DIR_ENV] || process.env[HASNA_EVENTS_HOME_ENV] || join20(homedir5(), ".hasna", "events");
23296
+ return override || getEventsHome();
23207
23297
  }
23208
23298
 
23209
23299
  class JsonEventsStore {
@@ -23212,12 +23302,12 @@ class JsonEventsStore {
23212
23302
  channelsPath;
23213
23303
  eventsPath;
23214
23304
  deliveriesPath;
23215
- constructor(dataDir2 = getEventsDataDir()) {
23216
- this.dataDir = dataDir2;
23217
- this.runtime = localJsonRuntime(dataDir2);
23218
- this.channelsPath = join20(dataDir2, "channels.json");
23219
- this.eventsPath = join20(dataDir2, "events.json");
23220
- this.deliveriesPath = join20(dataDir2, "deliveries.json");
23305
+ constructor(dataDir22 = getEventsDataDir()) {
23306
+ this.dataDir = dataDir22;
23307
+ this.runtime = localJsonRuntime(dataDir22);
23308
+ this.channelsPath = join22(dataDir22, "channels.json");
23309
+ this.eventsPath = join22(dataDir22, "events.json");
23310
+ this.deliveriesPath = join22(dataDir22, "deliveries.json");
23221
23311
  }
23222
23312
  async init() {
23223
23313
  await mkdir(this.dataDir, { recursive: true, mode: 448 });
@@ -23334,7 +23424,7 @@ class JsonEventsStore {
23334
23424
  };
23335
23425
  }
23336
23426
  async ensureArrayFile(path) {
23337
- if (!existsSync16(path)) {
23427
+ if (!existsSync22(path)) {
23338
23428
  await writeFile2(path, `[]
23339
23429
  `, { encoding: "utf-8", mode: 384 });
23340
23430
  }
@@ -23364,7 +23454,7 @@ class JsonEventsStore {
23364
23454
  });
23365
23455
  }
23366
23456
  }
23367
- function localJsonRuntime(dataDir2 = getEventsDataDir()) {
23457
+ function localJsonRuntime(dataDir22 = getEventsDataDir()) {
23368
23458
  return {
23369
23459
  mode: "local-files",
23370
23460
  name: "json-events-store",
@@ -23377,7 +23467,7 @@ function localJsonRuntime(dataDir2 = getEventsDataDir()) {
23377
23467
  durable: true,
23378
23468
  idempotency: "best-effort-local",
23379
23469
  replayCursors: true,
23380
- description: `Local JSON files in ${dataDir2}; no SQLite, Postgres, S3, or AWS runtime is configured by this store.`
23470
+ description: `Local JSON files in ${dataDir22}; no SQLite, Postgres, S3, or AWS runtime is configured by this store.`
23381
23471
  };
23382
23472
  }
23383
23473
  function encodeLocalJsonEventCursor(offset, options = {}) {
@@ -23448,6 +23538,177 @@ function signPayload(secret, timestamp, body) {
23448
23538
  const digest2 = createHmac3("sha256", secret).update(buildSignatureBase(timestamp, body)).digest("hex");
23449
23539
  return `sha256=${digest2}`;
23450
23540
  }
23541
+ function isPrivateAddress(address) {
23542
+ const normalized = stripZoneId(address);
23543
+ const version2 = isIP2(normalized);
23544
+ if (version2 === 4) {
23545
+ const integer = ipv4ToInt(normalized);
23546
+ if (integer === undefined)
23547
+ return true;
23548
+ return IPV4_PRIVATE_RANGES.some(([low, high]) => integer >= low && integer <= high);
23549
+ }
23550
+ if (version2 === 6) {
23551
+ const groups = ipv6Groups(normalized);
23552
+ if (!groups)
23553
+ return true;
23554
+ for (const prefix of IPV6_SPECIAL_PREFIXES) {
23555
+ if (!ipv6MatchesPrefix(groups, prefix.groups, prefix.bits))
23556
+ continue;
23557
+ if (prefix.bits === 96 && groups[5] === 65535) {
23558
+ return isPrivateAddress(ipv4IntToString(groups[6] << 16 | groups[7]));
23559
+ }
23560
+ if (prefix.bits === 16 && groups[0] === 8194) {
23561
+ return isPrivateAddress(ipv4IntToString(groups[1] << 16 | groups[2]));
23562
+ }
23563
+ return true;
23564
+ }
23565
+ return false;
23566
+ }
23567
+ return true;
23568
+ }
23569
+ async function resolveWebhookTarget(url, policy = {}) {
23570
+ const hostname = normalizeHostname(url.hostname);
23571
+ const allowlist = (policy.allowPrivateHosts ?? []).map((entry) => normalizeHostname(entry.toLowerCase()));
23572
+ if (allowlist.includes(hostname)) {
23573
+ const version22 = isIP2(hostname);
23574
+ if (version22 === 4 || version22 === 6) {
23575
+ return { hostname, addresses: [hostname] };
23576
+ }
23577
+ const lookup2 = policy.lookup ?? defaultTargetLookup;
23578
+ let resolved2;
23579
+ try {
23580
+ resolved2 = await lookup2(hostname);
23581
+ } catch {
23582
+ throw new Error(`Webhook target ${hostname} could not be resolved`);
23583
+ }
23584
+ if (!Array.isArray(resolved2) || resolved2.length === 0) {
23585
+ throw new Error(`Webhook target ${hostname} resolved to no addresses`);
23586
+ }
23587
+ const addresses = resolved2.map((entry) => normalizeHostname(entry.address));
23588
+ return { hostname, addresses };
23589
+ }
23590
+ const version2 = isIP2(hostname);
23591
+ if (version2 === 4 || version2 === 6) {
23592
+ if (isPrivateAddress(hostname)) {
23593
+ throw new Error(`Webhook target ${hostname} is a private or special-use address`);
23594
+ }
23595
+ return { hostname, addresses: [hostname] };
23596
+ }
23597
+ const lookup = policy.lookup ?? defaultTargetLookup;
23598
+ let resolved;
23599
+ try {
23600
+ resolved = await lookup(hostname);
23601
+ } catch {
23602
+ throw new Error(`Webhook target ${hostname} could not be resolved`);
23603
+ }
23604
+ if (!Array.isArray(resolved) || resolved.length === 0) {
23605
+ throw new Error(`Webhook target ${hostname} resolved to no addresses`);
23606
+ }
23607
+ const allowed = [];
23608
+ for (const entry of resolved) {
23609
+ const address = normalizeHostname(entry.address);
23610
+ if (isPrivateAddress(address)) {
23611
+ if (allowlist.includes(address)) {
23612
+ allowed.push(address);
23613
+ continue;
23614
+ }
23615
+ throw new Error(`Webhook target ${hostname} resolves to private or special-use address ${address}`);
23616
+ }
23617
+ allowed.push(address);
23618
+ }
23619
+ if (allowed.length === 0) {
23620
+ throw new Error(`Webhook target ${hostname} resolved to no public addresses`);
23621
+ }
23622
+ return { hostname, addresses: allowed };
23623
+ }
23624
+ function normalizeMaxRedirects(value) {
23625
+ if (value === undefined)
23626
+ return DEFAULT_MAX_REDIRECTS;
23627
+ if (!Number.isInteger(value) || value < 0)
23628
+ throw new Error("webhookTargetPolicy.maxRedirects must be a non-negative integer");
23629
+ return value;
23630
+ }
23631
+ function normalizeHostname(hostname) {
23632
+ const lower = hostname.toLowerCase();
23633
+ if (lower.startsWith("[") && lower.endsWith("]"))
23634
+ return lower.slice(1, -1);
23635
+ return lower;
23636
+ }
23637
+ function stripZoneId(address) {
23638
+ const percent = address.indexOf("%");
23639
+ return percent === -1 ? address : address.slice(0, percent);
23640
+ }
23641
+ function ipv4ToInt(address) {
23642
+ const parts = address.split(".");
23643
+ if (parts.length !== 4)
23644
+ return;
23645
+ let value = 0;
23646
+ for (const part of parts) {
23647
+ if (!/^\d{1,3}$/.test(part))
23648
+ return;
23649
+ const octet = Number(part);
23650
+ if (octet > 255)
23651
+ return;
23652
+ value = value << 8 | octet;
23653
+ }
23654
+ return value >>> 0;
23655
+ }
23656
+ function ipv4IntToString(integer) {
23657
+ return [
23658
+ integer >>> 24 & 255,
23659
+ integer >>> 16 & 255,
23660
+ integer >>> 8 & 255,
23661
+ integer & 255
23662
+ ].join(".");
23663
+ }
23664
+ function ipv6Groups(address) {
23665
+ const raw = stripZoneId(address);
23666
+ const doubleColon = raw.indexOf("::");
23667
+ const headText = doubleColon === -1 ? raw : raw.slice(0, doubleColon);
23668
+ const tailText = doubleColon === -1 ? "" : raw.slice(doubleColon + 2);
23669
+ const parseGroups = (text) => {
23670
+ if (text === "")
23671
+ return [];
23672
+ const out = [];
23673
+ for (const part of text.split(":")) {
23674
+ if (part.includes(".")) {
23675
+ const v4 = ipv4ToInt(part);
23676
+ if (v4 === undefined)
23677
+ return;
23678
+ out.push(v4 >>> 16 & 65535, v4 & 65535);
23679
+ } else {
23680
+ if (!/^[0-9a-fA-F]{1,4}$/.test(part))
23681
+ return;
23682
+ out.push(parseInt(part, 16));
23683
+ }
23684
+ }
23685
+ return out;
23686
+ };
23687
+ const head = parseGroups(headText);
23688
+ if (!head)
23689
+ return;
23690
+ const tail = parseGroups(tailText);
23691
+ if (!tail)
23692
+ return;
23693
+ const total = head.length + tail.length;
23694
+ if (doubleColon === -1) {
23695
+ return total === 8 ? head : undefined;
23696
+ }
23697
+ if (total >= 8)
23698
+ return;
23699
+ return [...head, ...new Array(8 - total).fill(0), ...tail];
23700
+ }
23701
+ function ipv6MatchesPrefix(groups, prefixGroups, prefixBits) {
23702
+ let remaining = prefixBits;
23703
+ for (let index = 0;index < prefixGroups.length && remaining > 0; index += 1) {
23704
+ const take = Math.min(16, remaining);
23705
+ const mask = 65535 << 16 - take & 65535;
23706
+ if ((groups[index] & mask) !== (prefixGroups[index] & mask))
23707
+ return false;
23708
+ remaining -= take;
23709
+ }
23710
+ return true;
23711
+ }
23451
23712
  function now() {
23452
23713
  return new Date().toISOString();
23453
23714
  }
@@ -23478,9 +23739,18 @@ function buildWebhookRequest(event, channel, options = {}) {
23478
23739
  }
23479
23740
  return { body, headers };
23480
23741
  }
23742
+ function normalizeWebhookUrl(raw) {
23743
+ const url = new URL(raw);
23744
+ if (url.username !== "" || url.password !== "") {
23745
+ url.username = "";
23746
+ url.password = "";
23747
+ }
23748
+ return url.toString();
23749
+ }
23481
23750
  async function dispatchWebhook(event, channel, options = {}) {
23482
23751
  if (!channel.webhook)
23483
23752
  throw new Error(`Channel ${channel.id} has no webhook config`);
23753
+ const webhookUrl = normalizeWebhookUrl(channel.webhook.url);
23484
23754
  const startedAt = now();
23485
23755
  let secret = channel.webhook.secret;
23486
23756
  if (channel.webhook.secretRef) {
@@ -23497,10 +23767,14 @@ async function dispatchWebhook(event, channel, options = {}) {
23497
23767
  }
23498
23768
  const timestamp = (options.now?.() ?? new Date).toISOString();
23499
23769
  const { body, headers } = buildWebhookRequest(event, channel, { secret, timestamp });
23770
+ const validateTargets = options.webhookTargetPolicy !== undefined || options.fetchImpl === undefined;
23771
+ if (validateTargets) {
23772
+ return dispatchValidatedWebhook(event, channel, { body, headers, startedAt, options });
23773
+ }
23500
23774
  const controller = new AbortController;
23501
23775
  const timeout = setTimeout(() => controller.abort(), channel.webhook.timeoutMs ?? 15000);
23502
23776
  try {
23503
- const response = await (options.fetchImpl ?? fetch)(channel.webhook.url, {
23777
+ const response = await (options.fetchImpl ?? fetch)(webhookUrl, {
23504
23778
  method: "POST",
23505
23779
  headers,
23506
23780
  body,
@@ -23528,6 +23802,130 @@ async function dispatchWebhook(event, channel, options = {}) {
23528
23802
  clearTimeout(timeout);
23529
23803
  }
23530
23804
  }
23805
+ function isRedirectStatus(status) {
23806
+ return status === 301 || status === 302 || status === 303 || status === 307 || status === 308;
23807
+ }
23808
+ function redirectKeepsBody(status) {
23809
+ return status === 307 || status === 308;
23810
+ }
23811
+ async function pinnedNativeRequest(target, addresses, method, headers, body, signal, tls) {
23812
+ const isHttps = target.protocol === "https:";
23813
+ if (!isHttps && target.protocol !== "http:") {
23814
+ throw new Error(`Webhook target uses unsupported protocol ${target.protocol}`);
23815
+ }
23816
+ const defaultPort = isHttps ? 443 : 80;
23817
+ const port = target.port ? Number(target.port) : defaultPort;
23818
+ const requestOptions = {
23819
+ hostname: target.hostname,
23820
+ port,
23821
+ path: `${target.pathname}${target.search}`,
23822
+ method,
23823
+ headers,
23824
+ ...tls?.ca ? { ca: tls.ca } : {},
23825
+ lookup: (hostname, _options, callback) => {
23826
+ const entries = addresses.map((address) => ({
23827
+ address,
23828
+ family: address.includes(":") ? 6 : 4
23829
+ }));
23830
+ callback(null, entries);
23831
+ }
23832
+ };
23833
+ return new Promise((resolve22, reject) => {
23834
+ const request = isHttps ? nodeHttpsRequest(requestOptions, onResponse) : nodeHttpRequest(requestOptions, onResponse);
23835
+ const onAbort = () => {
23836
+ const error = new Error("The operation was aborted.");
23837
+ error.name = "AbortError";
23838
+ request.destroy(error);
23839
+ };
23840
+ if (signal.aborted)
23841
+ onAbort();
23842
+ else
23843
+ signal.addEventListener("abort", onAbort, { once: true });
23844
+ request.on("error", reject);
23845
+ if (body !== undefined)
23846
+ request.write(body);
23847
+ request.end();
23848
+ function onResponse(response) {
23849
+ const chunks = [];
23850
+ response.on("data", (chunk) => chunks.push(Buffer.from(chunk)));
23851
+ response.on("error", reject);
23852
+ response.on("end", () => {
23853
+ const headersRecord = {};
23854
+ for (const [name, value] of Object.entries(response.headers)) {
23855
+ if (typeof value === "string")
23856
+ headersRecord[name] = value;
23857
+ else if (Array.isArray(value))
23858
+ headersRecord[name] = value.join(", ");
23859
+ }
23860
+ resolve22(new Response(Buffer.concat(chunks), { status: response.statusCode ?? 200, headers: headersRecord }));
23861
+ });
23862
+ }
23863
+ });
23864
+ }
23865
+ async function dispatchValidatedWebhook(event, channel, input) {
23866
+ const { body, headers, startedAt, options } = input;
23867
+ const webhook = channel.webhook;
23868
+ if (!webhook)
23869
+ throw new Error(`Channel ${channel.id} has no webhook config`);
23870
+ const policy = options.webhookTargetPolicy ?? {};
23871
+ const maxRedirects = normalizeMaxRedirects(policy.maxRedirects);
23872
+ const controller = new AbortController;
23873
+ const timeout = setTimeout(() => controller.abort(), webhook.timeoutMs ?? 15000);
23874
+ try {
23875
+ let target = new URL(normalizeWebhookUrl(webhook.url));
23876
+ let requestHeaders = headers;
23877
+ let method = "POST";
23878
+ let requestBody = body;
23879
+ let redirectsFollowed = 0;
23880
+ for (;; ) {
23881
+ const resolved = await resolveWebhookTarget(target, policy).catch((error) => {
23882
+ throw new Error(`Webhook target rejected by SSRF guard: ${error.message}`);
23883
+ });
23884
+ const response = options.fetchImpl ? await options.fetchImpl(target, {
23885
+ method,
23886
+ headers: requestHeaders,
23887
+ body: requestBody,
23888
+ signal: controller.signal,
23889
+ redirect: "manual"
23890
+ }) : await pinnedNativeRequest(target, resolved.addresses, method, requestHeaders, requestBody, controller.signal, options.tls);
23891
+ const location = response.headers.get("location");
23892
+ if (isRedirectStatus(response.status) && location) {
23893
+ if (redirectsFollowed >= maxRedirects) {
23894
+ return failedAttempt(startedAt, `Webhook target exceeded ${maxRedirects} redirects`);
23895
+ }
23896
+ redirectsFollowed += 1;
23897
+ const next = new URL(location, target);
23898
+ target = next;
23899
+ if (!redirectKeepsBody(response.status)) {
23900
+ method = "GET";
23901
+ requestBody = undefined;
23902
+ requestHeaders = Object.fromEntries(Object.entries(requestHeaders).filter(([name]) => name.toLowerCase() !== "content-type" && name.toLowerCase() !== "content-length"));
23903
+ }
23904
+ continue;
23905
+ }
23906
+ const responseBody = truncate(await response.text());
23907
+ return {
23908
+ attempt: 1,
23909
+ status: response.ok ? "success" : "failed",
23910
+ startedAt,
23911
+ completedAt: now(),
23912
+ responseStatus: response.status,
23913
+ responseBody,
23914
+ error: response.ok ? undefined : `Webhook returned HTTP ${response.status}`
23915
+ };
23916
+ }
23917
+ } catch (error) {
23918
+ return {
23919
+ attempt: 1,
23920
+ status: "failed",
23921
+ startedAt,
23922
+ completedAt: now(),
23923
+ error: error instanceof Error ? error.message : String(error)
23924
+ };
23925
+ } finally {
23926
+ clearTimeout(timeout);
23927
+ }
23928
+ }
23531
23929
  function failedAttempt(startedAt, error) {
23532
23930
  return {
23533
23931
  attempt: 1,
@@ -23556,7 +23954,7 @@ async function dispatchCommand(event, channel) {
23556
23954
  HASNA_EVENT_SCHEMA_VERSION: event.schemaVersion,
23557
23955
  HASNA_EVENT_JSON: eventJson
23558
23956
  };
23559
- return new Promise((resolve3) => {
23957
+ return new Promise((resolve22) => {
23560
23958
  const child = spawn(channel.command.command, channel.command.args ?? [], {
23561
23959
  cwd: channel.command.cwd,
23562
23960
  env,
@@ -23574,7 +23972,7 @@ async function dispatchCommand(event, channel) {
23574
23972
  });
23575
23973
  child.on("error", (error) => {
23576
23974
  clearTimeout(timeout);
23577
- resolve3({
23975
+ resolve22({
23578
23976
  attempt: 1,
23579
23977
  status: "failed",
23580
23978
  startedAt,
@@ -23587,7 +23985,7 @@ async function dispatchCommand(event, channel) {
23587
23985
  child.on("close", (code, signal) => {
23588
23986
  clearTimeout(timeout);
23589
23987
  const success = code === 0;
23590
- resolve3({
23988
+ resolve22({
23591
23989
  attempt: 1,
23592
23990
  status: success ? "success" : "failed",
23593
23991
  startedAt,
@@ -23723,7 +24121,9 @@ class EventsClient {
23723
24121
  this.transportOptions = {
23724
24122
  fetchImpl: options.fetchImpl,
23725
24123
  secretResolver: options.secretResolver,
23726
- now: options.now
24124
+ now: options.now,
24125
+ tls: options.tls,
24126
+ webhookTargetPolicy: options.webhookTargetPolicy
23727
24127
  };
23728
24128
  this.catalog = options.catalog ?? defaultEventTypeCatalog;
23729
24129
  this.validateCatalogTypes = options.validateCatalogTypes ?? false;
@@ -23928,9 +24328,51 @@ function normalizeRetryPolicy(policy) {
23928
24328
  multiplier: Math.max(1, policy?.multiplier ?? 2)
23929
24329
  };
23930
24330
  }
23931
- var HASNA_EVENTS_DIR_ENV = "HASNA_EVENTS_DIR", HASNA_EVENTS_HOME_ENV = "HASNA_EVENTS_HOME", LOCAL_JSON_EVENT_CURSOR_PREFIX = "local-json-v1:", DEFAULT_EVENT_PAGE_LIMIT = 100, MAX_EVENT_PAGE_LIMIT = 1000, DEFAULT_SIGNATURE_TOLERANCE_MS, EventValidationError, defaultEventTypeCatalog, APP_EVENT_V1_MAX_DATA_BYTES;
24331
+ var PATHS_RESOLVER_KIND_ENV, PATHS_RESOLVER_APP_SLUG_RE2, HASNA_EVENTS_DIR_ENV = "HASNA_EVENTS_DIR", HASNA_EVENTS_HOME_ENV = "HASNA_EVENTS_HOME", EVENTS_STORE_SENTINEL_FILE = "events.json", LOCAL_JSON_EVENT_CURSOR_PREFIX = "local-json-v1:", DEFAULT_EVENT_PAGE_LIMIT = 100, MAX_EVENT_PAGE_LIMIT = 1000, DEFAULT_SIGNATURE_TOLERANCE_MS, DEFAULT_MAX_REDIRECTS = 5, IPV4_PRIVATE_RANGES, IPV6_SPECIAL_PREFIXES, defaultTargetLookup = async (hostname) => {
24332
+ return dnsLookup(hostname, { all: true, verbatim: false });
24333
+ }, EventValidationError, defaultEventTypeCatalog, APP_EVENT_V1_MAX_DATA_BYTES;
23932
24334
  var init_dist = __esm(() => {
24335
+ PATHS_RESOLVER_KIND_ENV = {
24336
+ config: "HASNA_CONFIG_HOME",
24337
+ data: "HASNA_DATA_HOME",
24338
+ state: "HASNA_STATE_HOME",
24339
+ cache: "HASNA_CACHE_HOME"
24340
+ };
24341
+ PATHS_RESOLVER_APP_SLUG_RE2 = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
23933
24342
  DEFAULT_SIGNATURE_TOLERANCE_MS = 5 * 60 * 1000;
24343
+ IPV4_PRIVATE_RANGES = [
24344
+ [0, 16777215],
24345
+ [167772160, 184549375],
24346
+ [1681915904, 1686110207],
24347
+ [2130706432, 2147483647],
24348
+ [2851995648, 2852061183],
24349
+ [2886729728, 2887778303],
24350
+ [3221225472, 3221225727],
24351
+ [3221225984, 3221226239],
24352
+ [3227017984, 3227018239],
24353
+ [3232235520, 3232301055],
24354
+ [3323068416, 3323199487],
24355
+ [3325256704, 3325256959],
24356
+ [3405803776, 3405804031],
24357
+ [3758096384, 4294967295]
24358
+ ];
24359
+ IPV6_SPECIAL_PREFIXES = [
24360
+ { groups: [0, 0, 0, 0, 0, 0, 0, 0], bits: 128 },
24361
+ { groups: [0, 0, 0, 0, 0, 0, 0, 1], bits: 128 },
24362
+ { groups: [0, 0, 0, 0, 0, 65535, 0, 0], bits: 96 },
24363
+ { groups: [100, 65435, 0, 0, 0, 0, 0, 0], bits: 96 },
24364
+ { groups: [256, 0, 0, 0, 0, 0, 0, 0], bits: 64 },
24365
+ { groups: [8193, 0, 0, 0, 0, 0, 0, 0], bits: 32 },
24366
+ { groups: [8193, 2, 0, 0, 0, 0, 0, 0], bits: 48 },
24367
+ { groups: [8193, 16, 0, 0, 0, 0, 0, 0], bits: 28 },
24368
+ { groups: [8193, 3512, 0, 0, 0, 0, 0, 0], bits: 32 },
24369
+ { groups: [8194, 0, 0, 0, 0, 0, 0, 0], bits: 16 },
24370
+ { groups: [16383, 0, 0, 0, 0, 0, 0, 0], bits: 20 },
24371
+ { groups: [64512, 0, 0, 0, 0, 0, 0, 0], bits: 7 },
24372
+ { groups: [65152, 0, 0, 0, 0, 0, 0, 0], bits: 10 },
24373
+ { groups: [65216, 0, 0, 0, 0, 0, 0, 0], bits: 10 },
24374
+ { groups: [65280, 0, 0, 0, 0, 0, 0, 0], bits: 8 }
24375
+ ];
23934
24376
  EventValidationError = class EventValidationError extends Error {
23935
24377
  eventType;
23936
24378
  issues;
@@ -24740,6 +25182,28 @@ function readSkillsInstanceMetadata(file) {
24740
25182
  return { apiUrl: urls[0], binding: values.get(SKILLS_BOUND_API_URL) };
24741
25183
  }
24742
25184
 
25185
+ // src/lib/local-opt-in.ts
25186
+ var SKILLS_LOCAL_OPT_IN_ENV_KEYS = ["HASNA_SKILLS_LOCAL", "SKILLS_LOCAL"];
25187
+ function isSkillsLocalOptIn(env = process.env) {
25188
+ return SKILLS_LOCAL_OPT_IN_ENV_KEYS.some((key) => (env[key] ?? "").trim() !== "");
25189
+ }
25190
+ function skillsAuthorityEnvKeys() {
25191
+ const keys = clientTransportEnvKeys("skills");
25192
+ return [
25193
+ ...keys.apiUrlKeys,
25194
+ ...keys.apiKeyKeys,
25195
+ credentialOverrideEnvKey("skills"),
25196
+ credentialPointerEnvKey("skills"),
25197
+ CREDENTIAL_PROFILE_ENV_KEY
25198
+ ];
25199
+ }
25200
+ function hasSkillsEnvAuthorityIntent(env = process.env) {
25201
+ return skillsAuthorityEnvKeys().some((key) => (env[key] ?? "").trim() !== "");
25202
+ }
25203
+ function selectsSkillsLocalMode(env = process.env) {
25204
+ return !hasSkillsEnvAuthorityIntent(env) && isSkillsLocalOptIn(env);
25205
+ }
25206
+
24743
25207
  // src/lib/fleet-credentials.ts
24744
25208
  var SKILLS_APP = "skills";
24745
25209
  var ENV_KEYS = clientTransportEnvKeys(SKILLS_APP);
@@ -24759,6 +25223,9 @@ class SkillsFleetCredentialError extends Error {
24759
25223
  function isCredentialResolutionError(error) {
24760
25224
  return error instanceof CredentialResolutionError || typeof error === "object" && error !== null && error.name === "CredentialResolutionError";
24761
25225
  }
25226
+ function isSkillsFleetCredentialError(error) {
25227
+ return error instanceof SkillsFleetCredentialError || typeof error === "object" && error !== null && error.name === "SkillsFleetCredentialError";
25228
+ }
24762
25229
  function asSkillsFleetCredentialError(error) {
24763
25230
  if (!isCredentialResolutionError(error))
24764
25231
  return null;
@@ -24825,7 +25292,7 @@ function noticeLocalSkillsMode(write = (line) => console.error(line)) {
24825
25292
  if (localNoticePrinted)
24826
25293
  return;
24827
25294
  localNoticePrinted = true;
24828
- write(`skills: local mode \u2014 no ${SKILLS_API_KEY_ENV} and no ${SKILLS_API_URL_ENV} resolved, ` + `so this runs on this machine against the bundled corpus. ` + `Sign in with: skills auth login`);
25295
+ write(`skills: local mode (${SKILLS_LOCAL_OPT_IN_ENV_KEYS[0]}=1) \u2014 running on this machine against the bundled corpus.`);
24829
25296
  }
24830
25297
  function resolveSkillsFleet(env = process.env, options = {}) {
24831
25298
  try {
@@ -24862,13 +25329,16 @@ function snapshotSkillsOptions(env, options) {
24862
25329
  } } };
24863
25330
  }
24864
25331
  function resolveSkillsFleetOrThrow(env, options) {
25332
+ if (selectsSkillsLocalMode(env))
25333
+ return { mode: "local", apiOrigin: null, apiKey: null };
24865
25334
  const assertFilesUnchanged = captureSkillsCredentialFiles(skillsProfileCredentialFiles(env, options.credentials?.profile));
24866
25335
  const configured = configuredSkillsApiUrl(env, options.credentials?.keychain, options.credentials?.profile);
24867
25336
  const credential = resolveCredential(SKILLS_APP, env, options.credentials);
24868
25337
  if (!credential) {
24869
- if (!configured)
24870
- return { mode: "local", apiOrigin: null, apiKey: null };
24871
- throw new SkillsFleetCredentialError(`${configured.source} points this CLI at a Skills service but no API key resolved \u2014 refusing to run locally instead. ` + `Looked in hasna.credentials.skills.api-key, ${skillsCredentialFiles(env).join(" or ") || "no credentials file"}, and ${SKILLS_API_KEY_ENV}. Sign in with: skills auth login`);
25338
+ if (!configured) {
25339
+ throw new SkillsFleetCredentialError(`No API key resolved and no Skills API URL is configured \u2014 failing closed ` + `(local mode is opt-in only: set ${SKILLS_LOCAL_OPT_IN_ENV_KEYS[0]}=1 to run on this machine). ` + `Looked in ${credentialLocations(env)}. Sign in with: skills auth login`);
25340
+ }
25341
+ throw new SkillsFleetCredentialError(`${configured.source} points this CLI at a Skills service but no API key resolved \u2014 refusing to run locally instead. ` + `Looked in ${credentialLocations(env)}. Sign in with: skills auth login`);
24872
25342
  }
24873
25343
  const apiOrigin = normalizeSkillsApiOrigin(configured?.value ?? defaultFleetGatewayBaseUrl(SKILLS_APP));
24874
25344
  toV1BaseUrl(apiOrigin);
@@ -24890,6 +25360,10 @@ function resolveSkillsFleetOrThrow(env, options) {
24890
25360
  }
24891
25361
  return { ...base, apiKey: credential.apiKey, apiKeyPointer: null };
24892
25362
  }
25363
+ function credentialLocations(env) {
25364
+ const files = skillsCredentialFiles(env).join(" or ") || "no credentials file (HOME is unset)";
25365
+ return `hasna.credentials.${SKILLS_APP}.api-key (macOS Keychain, account HASNA_STATION or the host name), ${files}, and ${SKILLS_API_KEY_ENV}`;
25366
+ }
24893
25367
  function assertCredentialInstance(credential, apiOrigin, env, options) {
24894
25368
  let bound;
24895
25369
  if (credential.tier === "disk" || credential.tier === "profile") {
@@ -24943,7 +25417,7 @@ async function skillsCredentialOrReason(env = process.env, options = {}) {
24943
25417
  const connection = await resolveSkillsConnection(env, options);
24944
25418
  return connection ? { apiKey: connection.apiKey, apiOrigin: connection.apiOrigin, reason: null } : { apiKey: null, apiOrigin: null, reason: null };
24945
25419
  } catch (error) {
24946
- if (error instanceof SkillsFleetCredentialError || error?.name === "SkillsFleetCredentialError") {
25420
+ if (isSkillsFleetCredentialError(error)) {
24947
25421
  return { apiKey: null, apiOrigin: null, reason: error.message };
24948
25422
  }
24949
25423
  throw error;
@@ -24955,7 +25429,14 @@ function resolveSkillsApiOrigin(env = process.env, options = {}) {
24955
25429
  toV1BaseUrl(configured.value);
24956
25430
  return { origin: normalizeSkillsApiOrigin(configured.value), source: configured.source };
24957
25431
  }
24958
- const fleet = resolveSkillsFleet(env, options);
25432
+ let fleet;
25433
+ try {
25434
+ fleet = resolveSkillsFleet(env, options);
25435
+ } catch (error) {
25436
+ if (isSkillsFleetCredentialError(error))
25437
+ return null;
25438
+ throw error;
25439
+ }
24959
25440
  return fleet.mode === "hosted" ? { origin: fleet.apiOrigin, source: fleet.apiUrlSource } : null;
24960
25441
  }
24961
25442
  function requireSkillsApiOrigin(action = "This command", env = process.env, options = {}) {
@@ -24981,7 +25462,7 @@ class MissingSkillsFleetError extends Error {
24981
25462
  // package.json
24982
25463
  var package_default = {
24983
25464
  name: "@hasna/skills",
24984
- version: "0.4.0",
25465
+ version: "0.5.0",
24985
25466
  description: "Skills library for AI coding agents",
24986
25467
  type: "module",
24987
25468
  bin: {
@@ -25013,6 +25494,7 @@ var package_default = {
25013
25494
  files: [
25014
25495
  "dist/",
25015
25496
  "!dist/**/*.test.d.ts",
25497
+ "!dist/**/*.fixture.d.ts",
25016
25498
  "!dist/test-preload.d.ts",
25017
25499
  "!dist/platform",
25018
25500
  "bin/",
@@ -25038,8 +25520,9 @@ var package_default = {
25038
25520
  migrate: "bun run ./src/server/migrate.ts",
25039
25521
  typecheck: "tsc --noEmit",
25040
25522
  "verify:release": "bun run scripts/release-guard.ts",
25523
+ "verify:consumer-types": "bun run scripts/consumer-types.ts",
25041
25524
  prepare: "bun run build:js",
25042
- prepack: "bun run build && bun run verify:release",
25525
+ prepack: "bun run build && bun run verify:release && bun run verify:consumer-types",
25043
25526
  prepublishOnly: "bun run typecheck && bun run test"
25044
25527
  },
25045
25528
  keywords: [
@@ -25061,6 +25544,7 @@ var package_default = {
25061
25544
  author: "Hasna",
25062
25545
  license: "Apache-2.0",
25063
25546
  devDependencies: {
25547
+ "@hasna/contracts": "1.0.2",
25064
25548
  "@types/bun": "1.3.14",
25065
25549
  "@types/node": "25.2.3",
25066
25550
  "@types/react": "^18.2.0",
@@ -25072,8 +25556,7 @@ var package_default = {
25072
25556
  dependencies: {
25073
25557
  "@aws-sdk/client-ecs": "^3.1079.0",
25074
25558
  "@aws-sdk/client-s3": "^3.1079.0",
25075
- "@hasna/contracts": "1.0.1",
25076
- "@hasna/events": "0.1.16",
25559
+ "@hasna/events": "0.1.18",
25077
25560
  "@modelcontextprotocol/sdk": "^1.26.0",
25078
25561
  chalk: "^5.3.0",
25079
25562
  commander: "^12.1.0",
@@ -25889,8 +26372,8 @@ var $NODE_RESPONSE_CHECKSUM_VALIDATION_CONFIG_OPTIONS = NODE_RESPONSE_CHECKSUM_V
25889
26372
  var $getFlexibleChecksumsPlugin = getFlexibleChecksumsPlugin;
25890
26373
  var $resolveFlexibleChecksumsConfig = resolveFlexibleChecksumsConfig;
25891
26374
 
25892
- // ../../node_modules/.bun/@aws-sdk+client-s3@3.1126.0/node_modules/@aws-sdk/client-s3/dist-es/S3Client.js
25893
- var import_client25 = __toESM(require_client2(), 1);
26375
+ // ../../node_modules/.bun/@aws-sdk+client-s3@3.1127.0/node_modules/@aws-sdk/client-s3/dist-es/S3Client.js
26376
+ var import_client26 = __toESM(require_client2(), 1);
25894
26377
 
25895
26378
  // ../../node_modules/.bun/@aws-sdk+middleware-sdk-s3@3.972.75/node_modules/@aws-sdk/middleware-sdk-s3/dist-cjs/submodules/s3/index.js
25896
26379
  var { NoOpLogger, getSmithyContext } = require_client();
@@ -26497,9 +26980,9 @@ var $getThrow200ExceptionsPlugin = getThrow200ExceptionsPlugin;
26497
26980
  var $getValidateBucketNamePlugin = getValidateBucketNamePlugin;
26498
26981
  var $resolveS3Config = resolveS3Config;
26499
26982
 
26500
- // ../../node_modules/.bun/@aws-sdk+client-s3@3.1126.0/node_modules/@aws-sdk/client-s3/dist-es/S3Client.js
26983
+ // ../../node_modules/.bun/@aws-sdk+client-s3@3.1127.0/node_modules/@aws-sdk/client-s3/dist-es/S3Client.js
26501
26984
  var import_core = __toESM(require_dist_cjs2(), 1);
26502
- var import_client26 = __toESM(require_client(), 1);
26985
+ var import_client27 = __toESM(require_client(), 1);
26503
26986
  var import_config29 = __toESM(require_config(), 1);
26504
26987
  var import_endpoints5 = __toESM(require_endpoints(), 1);
26505
26988
  var import_event_streams2 = __toESM(require_event_streams(), 1);
@@ -26507,17 +26990,17 @@ var import_protocols6 = __toESM(require_protocols(), 1);
26507
26990
  var import_retry4 = __toESM(require_retry(), 1);
26508
26991
  var import_schema2 = __toESM(require_schema(), 1);
26509
26992
 
26510
- // ../../node_modules/.bun/@aws-sdk+client-s3@3.1126.0/node_modules/@aws-sdk/client-s3/dist-es/auth/httpAuthSchemeProvider.js
26993
+ // ../../node_modules/.bun/@aws-sdk+client-s3@3.1127.0/node_modules/@aws-sdk/client-s3/dist-es/auth/httpAuthSchemeProvider.js
26511
26994
  var import_httpAuthSchemes = __toESM(require_httpAuthSchemes(), 1);
26512
26995
  var import_signature_v4_multi_region = __toESM(require_dist_cjs4(), 1);
26513
- var import_client4 = __toESM(require_client(), 1);
26996
+ var import_client5 = __toESM(require_client(), 1);
26514
26997
  var import_endpoints3 = __toESM(require_endpoints(), 1);
26515
26998
 
26516
- // ../../node_modules/.bun/@aws-sdk+client-s3@3.1126.0/node_modules/@aws-sdk/client-s3/dist-es/endpoint/endpointResolver.js
26517
- var import_client3 = __toESM(require_client2(), 1);
26999
+ // ../../node_modules/.bun/@aws-sdk+client-s3@3.1127.0/node_modules/@aws-sdk/client-s3/dist-es/endpoint/endpointResolver.js
27000
+ var import_client4 = __toESM(require_client2(), 1);
26518
27001
  var import_endpoints2 = __toESM(require_endpoints(), 1);
26519
27002
 
26520
- // ../../node_modules/.bun/@aws-sdk+client-s3@3.1126.0/node_modules/@aws-sdk/client-s3/dist-es/endpoint/bdd.js
27003
+ // ../../node_modules/.bun/@aws-sdk+client-s3@3.1127.0/node_modules/@aws-sdk/client-s3/dist-es/endpoint/bdd.js
26521
27004
  var import_endpoints = __toESM(require_endpoints(), 1);
26522
27005
  var aw = "ref";
26523
27006
  var ax = "argv";
@@ -28461,7 +28944,7 @@ var nodes = new Int32Array([
28461
28944
  ]);
28462
28945
  var bdd = import_endpoints.BinaryDecisionDiagram.from(nodes, root, _data.conditions, _data.results);
28463
28946
 
28464
- // ../../node_modules/.bun/@aws-sdk+client-s3@3.1126.0/node_modules/@aws-sdk/client-s3/dist-es/endpoint/endpointResolver.js
28947
+ // ../../node_modules/.bun/@aws-sdk+client-s3@3.1127.0/node_modules/@aws-sdk/client-s3/dist-es/endpoint/endpointResolver.js
28465
28948
  var cache = new import_endpoints2.EndpointCache({
28466
28949
  size: 50,
28467
28950
  params: [
@@ -28487,15 +28970,15 @@ var defaultEndpointResolver = (endpointParams, context = {}) => {
28487
28970
  logger: context.logger
28488
28971
  }));
28489
28972
  };
28490
- import_endpoints2.customEndpointFunctions.aws = import_client3.awsEndpointFunctions;
28973
+ import_endpoints2.customEndpointFunctions.aws = import_client4.awsEndpointFunctions;
28491
28974
 
28492
- // ../../node_modules/.bun/@aws-sdk+client-s3@3.1126.0/node_modules/@aws-sdk/client-s3/dist-es/auth/httpAuthSchemeProvider.js
28975
+ // ../../node_modules/.bun/@aws-sdk+client-s3@3.1127.0/node_modules/@aws-sdk/client-s3/dist-es/auth/httpAuthSchemeProvider.js
28493
28976
  var createEndpointRuleSetHttpAuthSchemeParametersProvider = (defaultHttpAuthSchemeParametersProvider) => async (config, context, input) => {
28494
28977
  if (!input) {
28495
28978
  throw new Error("Could not find `input` for `defaultEndpointRuleSetHttpAuthSchemeParametersProvider`");
28496
28979
  }
28497
28980
  const defaultParameters = await defaultHttpAuthSchemeParametersProvider(config, context, input);
28498
- const instructionsFn = import_client4.getSmithyContext(context)?.commandInstance?.constructor?.getEndpointParameterInstructions;
28981
+ const instructionsFn = import_client5.getSmithyContext(context)?.commandInstance?.constructor?.getEndpointParameterInstructions;
28499
28982
  if (!instructionsFn) {
28500
28983
  throw new Error(`getEndpointParameterInstructions() is not defined on '${context.commandName}'`);
28501
28984
  }
@@ -28504,8 +28987,8 @@ var createEndpointRuleSetHttpAuthSchemeParametersProvider = (defaultHttpAuthSche
28504
28987
  };
28505
28988
  var _defaultS3HttpAuthSchemeParametersProvider = async (config, context, input) => {
28506
28989
  return {
28507
- operation: import_client4.getSmithyContext(context).operation,
28508
- region: await import_client4.normalizeProvider(config.region)() || (() => {
28990
+ operation: import_client5.getSmithyContext(context).operation,
28991
+ region: await import_client5.normalizeProvider(config.region)() || (() => {
28509
28992
  throw new Error("expected `region` to be configured for `aws.auth#sigv4`");
28510
28993
  })()
28511
28994
  };
@@ -28601,15 +29084,15 @@ var resolveHttpAuthSchemeConfig = (config) => {
28601
29084
  const config_0 = import_httpAuthSchemes.resolveAwsSdkSigV4Config(config);
28602
29085
  const config_1 = import_httpAuthSchemes.resolveAwsSdkSigV4AConfig(config_0);
28603
29086
  return Object.assign(config_1, {
28604
- authSchemePreference: import_client4.normalizeProvider(config.authSchemePreference ?? [])
29087
+ authSchemePreference: import_client5.normalizeProvider(config.authSchemePreference ?? [])
28605
29088
  });
28606
29089
  };
28607
29090
 
28608
- // ../../node_modules/.bun/@aws-sdk+client-s3@3.1126.0/node_modules/@aws-sdk/client-s3/dist-es/commandBuilder.js
28609
- var import_client5 = __toESM(require_client(), 1);
29091
+ // ../../node_modules/.bun/@aws-sdk+client-s3@3.1127.0/node_modules/@aws-sdk/client-s3/dist-es/commandBuilder.js
29092
+ var import_client6 = __toESM(require_client(), 1);
28610
29093
  var import_endpoints4 = __toESM(require_endpoints(), 1);
28611
29094
 
28612
- // ../../node_modules/.bun/@aws-sdk+client-s3@3.1126.0/node_modules/@aws-sdk/client-s3/dist-es/endpoint/EndpointParameters.js
29095
+ // ../../node_modules/.bun/@aws-sdk+client-s3@3.1127.0/node_modules/@aws-sdk/client-s3/dist-es/endpoint/EndpointParameters.js
28613
29096
  var resolveClientEndpointParameters = (options) => {
28614
29097
  return Object.assign(options, {
28615
29098
  useFipsEndpoint: options.useFipsEndpoint ?? false,
@@ -28635,8 +29118,8 @@ var commonParams = {
28635
29118
  UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" }
28636
29119
  };
28637
29120
 
28638
- // ../../node_modules/.bun/@aws-sdk+client-s3@3.1126.0/node_modules/@aws-sdk/client-s3/dist-es/commandBuilder.js
28639
- var command = import_client5.makeBuilder(commonParams, "AmazonS3", "S3Client", import_endpoints4.getEndpointPlugin);
29121
+ // ../../node_modules/.bun/@aws-sdk+client-s3@3.1127.0/node_modules/@aws-sdk/client-s3/dist-es/commandBuilder.js
29122
+ var command = import_client6.makeBuilder(commonParams, "AmazonS3", "S3Client", import_endpoints4.getEndpointPlugin);
28640
29123
  var _ep0 = {
28641
29124
  Bucket: { type: "contextParams", name: "Bucket" },
28642
29125
  Key: { type: "contextParams", name: "Key" }
@@ -28667,19 +29150,19 @@ var _mw11 = (Command, cs, config, o2) => [
28667
29150
  $getSsecPlugin(config)
28668
29151
  ];
28669
29152
 
28670
- // ../../node_modules/.bun/@aws-sdk+client-s3@3.1126.0/node_modules/@aws-sdk/client-s3/dist-es/schemas/schemas_0.js
29153
+ // ../../node_modules/.bun/@aws-sdk+client-s3@3.1127.0/node_modules/@aws-sdk/client-s3/dist-es/schemas/schemas_0.js
28671
29154
  var import_schema = __toESM(require_schema(), 1);
28672
29155
 
28673
- // ../../node_modules/.bun/@aws-sdk+client-s3@3.1126.0/node_modules/@aws-sdk/client-s3/dist-es/models/S3ServiceException.js
28674
- var import_client6 = __toESM(require_client(), 1);
28675
- class S3ServiceException extends import_client6.ServiceException {
29156
+ // ../../node_modules/.bun/@aws-sdk+client-s3@3.1127.0/node_modules/@aws-sdk/client-s3/dist-es/models/S3ServiceException.js
29157
+ var import_client7 = __toESM(require_client(), 1);
29158
+ class S3ServiceException extends import_client7.ServiceException {
28676
29159
  constructor(options) {
28677
29160
  super(options);
28678
29161
  Object.setPrototypeOf(this, S3ServiceException.prototype);
28679
29162
  }
28680
29163
  }
28681
29164
 
28682
- // ../../node_modules/.bun/@aws-sdk+client-s3@3.1126.0/node_modules/@aws-sdk/client-s3/dist-es/models/errors.js
29165
+ // ../../node_modules/.bun/@aws-sdk+client-s3@3.1127.0/node_modules/@aws-sdk/client-s3/dist-es/models/errors.js
28683
29166
  class NoSuchUpload extends S3ServiceException {
28684
29167
  name = "NoSuchUpload";
28685
29168
  $fault = "client";
@@ -28957,7 +29440,7 @@ class ObjectAlreadyInActiveTierError extends S3ServiceException {
28957
29440
  }
28958
29441
  }
28959
29442
 
28960
- // ../../node_modules/.bun/@aws-sdk+client-s3@3.1126.0/node_modules/@aws-sdk/client-s3/dist-es/schemas/schemas_0.js
29443
+ // ../../node_modules/.bun/@aws-sdk+client-s3@3.1127.0/node_modules/@aws-sdk/client-s3/dist-es/schemas/schemas_0.js
28961
29444
  var _A = "Account";
28962
29445
  var _AAO = "AnalyticsAndOperator";
28963
29446
  var _AC = "AccelerateConfiguration";
@@ -34409,13 +34892,13 @@ var WriteGetObjectResponse$ = [
34409
34892
  () => __Unit
34410
34893
  ];
34411
34894
 
34412
- // ../../node_modules/.bun/@aws-sdk+client-s3@3.1126.0/node_modules/@aws-sdk/client-s3/dist-es/commands/CreateSessionCommand.js
34895
+ // ../../node_modules/.bun/@aws-sdk+client-s3@3.1127.0/node_modules/@aws-sdk/client-s3/dist-es/commands/CreateSessionCommand.js
34413
34896
  class CreateSessionCommand extends command(_ep4, _mw0, "CreateSession", CreateSession$) {
34414
34897
  }
34415
- // ../../node_modules/.bun/@aws-sdk+client-s3@3.1126.0/node_modules/@aws-sdk/client-s3/package.json
34898
+ // ../../node_modules/.bun/@aws-sdk+client-s3@3.1127.0/node_modules/@aws-sdk/client-s3/package.json
34416
34899
  var package_default2 = {
34417
34900
  name: "@aws-sdk/client-s3",
34418
- version: "3.1126.0",
34901
+ version: "3.1127.0",
34419
34902
  description: "AWS SDK for JavaScript S3 Client for Node.js, Browser and React Native",
34420
34903
  homepage: "https://github.com/aws/aws-sdk-js-v3/tree/main/clients/client-s3",
34421
34904
  license: "Apache-2.0",
@@ -34482,7 +34965,7 @@ var package_default2 = {
34482
34965
  tslib: "^2.6.2"
34483
34966
  },
34484
34967
  devDependencies: {
34485
- "@aws-sdk/signature-v4-crt": "3.1126.0",
34968
+ "@aws-sdk/signature-v4-crt": "3.1127.0",
34486
34969
  "@smithy/snapshot-testing": "^2.3.2",
34487
34970
  "@tsconfig/node20": "20.1.8",
34488
34971
  "@types/node": "^20.14.8",
@@ -34497,8 +34980,8 @@ var package_default2 = {
34497
34980
  }
34498
34981
  };
34499
34982
 
34500
- // ../../node_modules/.bun/@aws-sdk+client-s3@3.1126.0/node_modules/@aws-sdk/client-s3/dist-es/runtimeConfig.js
34501
- var import_client21 = __toESM(require_client2(), 1);
34983
+ // ../../node_modules/.bun/@aws-sdk+client-s3@3.1127.0/node_modules/@aws-sdk/client-s3/dist-es/runtimeConfig.js
34984
+ var import_client22 = __toESM(require_client2(), 1);
34502
34985
  var import_httpAuthSchemes3 = __toESM(require_httpAuthSchemes(), 1);
34503
34986
 
34504
34987
  // ../../node_modules/.bun/@aws-sdk+credential-provider-node@3.972.82/node_modules/@aws-sdk/credential-provider-node/dist-es/defaultProvider.js
@@ -34654,9 +35137,9 @@ var defaultProvider = (init = {}) => memoizeChain([
34654
35137
  }
34655
35138
  ], credentialsTreatedAsExpired);
34656
35139
  var credentialsTreatedAsExpired = (credentials) => credentials?.expiration !== undefined && credentials.expiration.getTime() - Date.now() < 300000;
34657
- // ../../node_modules/.bun/@aws-sdk+client-s3@3.1126.0/node_modules/@aws-sdk/client-s3/dist-es/runtimeConfig.js
35140
+ // ../../node_modules/.bun/@aws-sdk+client-s3@3.1127.0/node_modules/@aws-sdk/client-s3/dist-es/runtimeConfig.js
34658
35141
  var import_checksum2 = __toESM(require_checksum(), 1);
34659
- var import_client22 = __toESM(require_client(), 1);
35142
+ var import_client23 = __toESM(require_client(), 1);
34660
35143
  var import_config28 = __toESM(require_config(), 1);
34661
35144
  var import_event_streams = __toESM(require_event_streams(), 1);
34662
35145
  var import_retry3 = __toESM(require_retry(), 1);
@@ -34892,11 +35375,11 @@ var subtle = typeof digest === "function" && typeof sign2 === "function" && type
34892
35375
  var MAX_PENDING_BYTES = 8 * 1024 * 1024;
34893
35376
  var $Sha1 = Sha1Node;
34894
35377
 
34895
- // ../../node_modules/.bun/@aws-sdk+client-s3@3.1126.0/node_modules/@aws-sdk/client-s3/dist-es/runtimeConfig.shared.js
35378
+ // ../../node_modules/.bun/@aws-sdk+client-s3@3.1127.0/node_modules/@aws-sdk/client-s3/dist-es/runtimeConfig.shared.js
34896
35379
  var import_httpAuthSchemes2 = __toESM(require_httpAuthSchemes(), 1);
34897
35380
  var import_signature_v4_multi_region2 = __toESM(require_dist_cjs4(), 1);
34898
35381
  var import_checksum = __toESM(require_checksum(), 1);
34899
- var import_client20 = __toESM(require_client(), 1);
35382
+ var import_client21 = __toESM(require_client(), 1);
34900
35383
  var import_protocols4 = __toESM(require_protocols(), 1);
34901
35384
  var import_serde3 = __toESM(require_serde(), 1);
34902
35385
  var getRuntimeConfig2 = (config) => {
@@ -34921,7 +35404,7 @@ var getRuntimeConfig2 = (config) => {
34921
35404
  signer: new import_httpAuthSchemes2.AwsSdkSigV4ASigner
34922
35405
  }
34923
35406
  ],
34924
- logger: config?.logger ?? new import_client20.NoOpLogger,
35407
+ logger: config?.logger ?? new import_client21.NoOpLogger,
34925
35408
  md5: config?.md5 ?? import_checksum.Md5,
34926
35409
  protocol: config?.protocol ?? $S3RestXmlProtocol,
34927
35410
  protocolSettings: config?.protocolSettings ?? {
@@ -34944,13 +35427,13 @@ var getRuntimeConfig2 = (config) => {
34944
35427
  };
34945
35428
  };
34946
35429
 
34947
- // ../../node_modules/.bun/@aws-sdk+client-s3@3.1126.0/node_modules/@aws-sdk/client-s3/dist-es/runtimeConfig.js
35430
+ // ../../node_modules/.bun/@aws-sdk+client-s3@3.1127.0/node_modules/@aws-sdk/client-s3/dist-es/runtimeConfig.js
34948
35431
  var getRuntimeConfig3 = (config) => {
34949
- import_client22.emitWarningIfUnsupportedVersion(process.version);
35432
+ import_client23.emitWarningIfUnsupportedVersion(process.version);
34950
35433
  const defaultsMode = import_config28.resolveDefaultsModeConfig(config);
34951
- const defaultConfigProvider = () => defaultsMode().then(import_client22.loadConfigsForDefaultMode);
35434
+ const defaultConfigProvider = () => defaultsMode().then(import_client23.loadConfigsForDefaultMode);
34952
35435
  const clientSharedValues = getRuntimeConfig2(config);
34953
- import_client21.emitWarningIfUnsupportedVersion(process.version);
35436
+ import_client22.emitWarningIfUnsupportedVersion(process.version);
34954
35437
  const loaderConfig = {
34955
35438
  profile: config?.profile,
34956
35439
  logger: clientSharedValues.logger
@@ -34963,7 +35446,7 @@ var getRuntimeConfig3 = (config) => {
34963
35446
  authSchemePreference: config?.authSchemePreference ?? import_config28.loadConfig(import_httpAuthSchemes3.NODE_AUTH_SCHEME_PREFERENCE_OPTIONS, loaderConfig),
34964
35447
  bodyLengthChecker: config?.bodyLengthChecker ?? import_serde4.calculateBodyLength,
34965
35448
  credentialDefaultProvider: config?.credentialDefaultProvider ?? defaultProvider,
34966
- defaultUserAgentProvider: config?.defaultUserAgentProvider ?? import_client21.createDefaultUserAgentProvider({ serviceId: clientSharedValues.serviceId, clientVersion: package_default2.version }),
35449
+ defaultUserAgentProvider: config?.defaultUserAgentProvider ?? import_client22.createDefaultUserAgentProvider({ serviceId: clientSharedValues.serviceId, clientVersion: package_default2.version }),
34967
35450
  disableS3ExpressSessionAuth: config?.disableS3ExpressSessionAuth ?? import_config28.loadConfig($NODE_DISABLE_S3_EXPRESS_SESSION_AUTH_OPTIONS, loaderConfig),
34968
35451
  eventStreamSerdeProvider: config?.eventStreamSerdeProvider ?? import_event_streams.eventStreamSerdeProvider,
34969
35452
  maxAttempts: config?.maxAttempts ?? import_config28.loadConfig(import_retry3.NODE_MAX_ATTEMPT_CONFIG_OPTIONS, config),
@@ -34981,16 +35464,16 @@ var getRuntimeConfig3 = (config) => {
34981
35464
  useArnRegion: config?.useArnRegion ?? import_config28.loadConfig($NODE_USE_ARN_REGION_CONFIG_OPTIONS, loaderConfig),
34982
35465
  useDualstackEndpoint: config?.useDualstackEndpoint ?? import_config28.loadConfig(import_config28.NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS, loaderConfig),
34983
35466
  useFipsEndpoint: config?.useFipsEndpoint ?? import_config28.loadConfig(import_config28.NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS, loaderConfig),
34984
- userAgentAppId: config?.userAgentAppId ?? import_config28.loadConfig(import_client21.NODE_APP_ID_CONFIG_OPTIONS, loaderConfig)
35467
+ userAgentAppId: config?.userAgentAppId ?? import_config28.loadConfig(import_client22.NODE_APP_ID_CONFIG_OPTIONS, loaderConfig)
34985
35468
  };
34986
35469
  };
34987
35470
 
34988
- // ../../node_modules/.bun/@aws-sdk+client-s3@3.1126.0/node_modules/@aws-sdk/client-s3/dist-es/runtimeExtensions.js
34989
- var import_client23 = __toESM(require_client2(), 1);
34990
- var import_client24 = __toESM(require_client(), 1);
35471
+ // ../../node_modules/.bun/@aws-sdk+client-s3@3.1127.0/node_modules/@aws-sdk/client-s3/dist-es/runtimeExtensions.js
35472
+ var import_client24 = __toESM(require_client2(), 1);
35473
+ var import_client25 = __toESM(require_client(), 1);
34991
35474
  var import_protocols5 = __toESM(require_protocols(), 1);
34992
35475
 
34993
- // ../../node_modules/.bun/@aws-sdk+client-s3@3.1126.0/node_modules/@aws-sdk/client-s3/dist-es/auth/httpAuthExtensionConfiguration.js
35476
+ // ../../node_modules/.bun/@aws-sdk+client-s3@3.1127.0/node_modules/@aws-sdk/client-s3/dist-es/auth/httpAuthExtensionConfiguration.js
34994
35477
  var getHttpAuthExtensionConfiguration2 = (runtimeConfig) => {
34995
35478
  const _httpAuthSchemes = runtimeConfig.httpAuthSchemes;
34996
35479
  let _httpAuthSchemeProvider = runtimeConfig.httpAuthSchemeProvider;
@@ -35029,26 +35512,26 @@ var resolveHttpAuthRuntimeConfig2 = (config) => {
35029
35512
  };
35030
35513
  };
35031
35514
 
35032
- // ../../node_modules/.bun/@aws-sdk+client-s3@3.1126.0/node_modules/@aws-sdk/client-s3/dist-es/runtimeExtensions.js
35515
+ // ../../node_modules/.bun/@aws-sdk+client-s3@3.1127.0/node_modules/@aws-sdk/client-s3/dist-es/runtimeExtensions.js
35033
35516
  var resolveRuntimeExtensions2 = (runtimeConfig, extensions) => {
35034
- const extensionConfiguration = Object.assign(import_client23.getAwsRegionExtensionConfiguration(runtimeConfig), import_client24.getDefaultExtensionConfiguration(runtimeConfig), import_protocols5.getHttpHandlerExtensionConfiguration(runtimeConfig), getHttpAuthExtensionConfiguration2(runtimeConfig));
35517
+ const extensionConfiguration = Object.assign(import_client24.getAwsRegionExtensionConfiguration(runtimeConfig), import_client25.getDefaultExtensionConfiguration(runtimeConfig), import_protocols5.getHttpHandlerExtensionConfiguration(runtimeConfig), getHttpAuthExtensionConfiguration2(runtimeConfig));
35035
35518
  extensions.forEach((extension) => extension.configure(extensionConfiguration));
35036
- return Object.assign(runtimeConfig, import_client23.resolveAwsRegionExtensionConfiguration(extensionConfiguration), import_client24.resolveDefaultRuntimeConfig(extensionConfiguration), import_protocols5.resolveHttpHandlerRuntimeConfig(extensionConfiguration), resolveHttpAuthRuntimeConfig2(extensionConfiguration));
35519
+ return Object.assign(runtimeConfig, import_client24.resolveAwsRegionExtensionConfiguration(extensionConfiguration), import_client25.resolveDefaultRuntimeConfig(extensionConfiguration), import_protocols5.resolveHttpHandlerRuntimeConfig(extensionConfiguration), resolveHttpAuthRuntimeConfig2(extensionConfiguration));
35037
35520
  };
35038
35521
 
35039
- // ../../node_modules/.bun/@aws-sdk+client-s3@3.1126.0/node_modules/@aws-sdk/client-s3/dist-es/S3Client.js
35040
- class S3Client extends import_client26.Client {
35522
+ // ../../node_modules/.bun/@aws-sdk+client-s3@3.1127.0/node_modules/@aws-sdk/client-s3/dist-es/S3Client.js
35523
+ class S3Client extends import_client27.Client {
35041
35524
  config;
35042
35525
  constructor(...[configuration]) {
35043
35526
  const _config_0 = getRuntimeConfig3(configuration || {});
35044
35527
  super(_config_0);
35045
35528
  this.initConfig = _config_0;
35046
35529
  const _config_1 = resolveClientEndpointParameters(_config_0);
35047
- const _config_2 = import_client25.resolveUserAgentConfig(_config_1);
35530
+ const _config_2 = import_client26.resolveUserAgentConfig(_config_1);
35048
35531
  const _config_3 = $resolveFlexibleChecksumsConfig(_config_2);
35049
35532
  const _config_4 = import_retry4.resolveRetryConfig(_config_3);
35050
35533
  const _config_5 = import_config29.resolveRegionConfig(_config_4);
35051
- const _config_6 = import_client25.resolveHostHeaderConfig(_config_5);
35534
+ const _config_6 = import_client26.resolveHostHeaderConfig(_config_5);
35052
35535
  const _config_7 = import_endpoints5.resolveEndpointConfig(_config_6);
35053
35536
  const _config_8 = import_event_streams2.resolveEventStreamSerdeConfig(_config_7);
35054
35537
  const _config_9 = resolveHttpAuthSchemeConfig(_config_8);
@@ -35056,12 +35539,12 @@ class S3Client extends import_client26.Client {
35056
35539
  const _config_11 = resolveRuntimeExtensions2(_config_10, configuration?.extensions || []);
35057
35540
  this.config = _config_11;
35058
35541
  this.middlewareStack.use(import_schema2.getSchemaSerdePlugin(this.config));
35059
- this.middlewareStack.use(import_client25.getUserAgentPlugin(this.config));
35542
+ this.middlewareStack.use(import_client26.getUserAgentPlugin(this.config));
35060
35543
  this.middlewareStack.use(import_retry4.getRetryPlugin(this.config));
35061
35544
  this.middlewareStack.use(import_protocols6.getContentLengthPlugin(this.config));
35062
- this.middlewareStack.use(import_client25.getHostHeaderPlugin(this.config));
35063
- this.middlewareStack.use(import_client25.getLoggerPlugin(this.config));
35064
- this.middlewareStack.use(import_client25.getRecursionDetectionPlugin(this.config));
35545
+ this.middlewareStack.use(import_client26.getHostHeaderPlugin(this.config));
35546
+ this.middlewareStack.use(import_client26.getLoggerPlugin(this.config));
35547
+ this.middlewareStack.use(import_client26.getRecursionDetectionPlugin(this.config));
35065
35548
  this.middlewareStack.use(import_core.getHttpAuthSchemeEndpointRuleSetPlugin(this.config, {
35066
35549
  httpAuthSchemeParametersProvider: defaultS3HttpAuthSchemeParametersProvider,
35067
35550
  identityProviderConfigProvider: async (config) => new import_core.DefaultIdentityProviderConfig({
@@ -35081,15 +35564,15 @@ class S3Client extends import_client26.Client {
35081
35564
  }
35082
35565
  }
35083
35566
 
35084
- // ../../node_modules/.bun/@aws-sdk+client-s3@3.1126.0/node_modules/@aws-sdk/client-s3/dist-es/commands/DeleteObjectCommand.js
35567
+ // ../../node_modules/.bun/@aws-sdk+client-s3@3.1127.0/node_modules/@aws-sdk/client-s3/dist-es/commands/DeleteObjectCommand.js
35085
35568
  class DeleteObjectCommand extends command(_ep0, _mw0, "DeleteObject", DeleteObject$) {
35086
35569
  }
35087
35570
 
35088
- // ../../node_modules/.bun/@aws-sdk+client-s3@3.1126.0/node_modules/@aws-sdk/client-s3/dist-es/commands/GetObjectCommand.js
35571
+ // ../../node_modules/.bun/@aws-sdk+client-s3@3.1127.0/node_modules/@aws-sdk/client-s3/dist-es/commands/GetObjectCommand.js
35089
35572
  class GetObjectCommand extends command(_ep0, _mw7, "GetObject", GetObject$) {
35090
35573
  }
35091
35574
 
35092
- // ../../node_modules/.bun/@aws-sdk+client-s3@3.1126.0/node_modules/@aws-sdk/client-s3/dist-es/commands/PutObjectCommand.js
35575
+ // ../../node_modules/.bun/@aws-sdk+client-s3@3.1127.0/node_modules/@aws-sdk/client-s3/dist-es/commands/PutObjectCommand.js
35093
35576
  class PutObjectCommand extends command(_ep0, _mw11, "PutObject", PutObject$) {
35094
35577
  }
35095
35578
 
@@ -35495,12 +35978,7 @@ import { homedir as homedir2 } from "os";
35495
35978
  import { join as join4, resolve } from "path";
35496
35979
  import { homedir as pathsResolverHomedir } from "os";
35497
35980
  import { join as pathsResolverJoin } from "path";
35498
- var PATHS_RESOLVER_KIND_ENV = {
35499
- config: "HASNA_CONFIG_HOME",
35500
- data: "HASNA_DATA_HOME",
35501
- state: "HASNA_STATE_HOME",
35502
- cache: "HASNA_CACHE_HOME"
35503
- };
35981
+ var PATHS_RESOLVER_DATA_ENV = "HASNA_DATA_HOME";
35504
35982
  var PATHS_RESOLVER_APP_SLUG_RE = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
35505
35983
  function pathsResolverAssertApp(app) {
35506
35984
  if (typeof app !== "string" || app.length === 0) {
@@ -35510,48 +35988,19 @@ function pathsResolverAssertApp(app) {
35510
35988
  throw new TypeError(`paths: invalid app slug "${app}" \u2014 expected lowercase kebab-case ([a-z0-9]+(-[a-z0-9]+)*)`);
35511
35989
  }
35512
35990
  }
35513
- function pathsResolverAssertKind(kind) {
35514
- if (!Object.keys(PATHS_RESOLVER_KIND_ENV).includes(kind)) {
35515
- throw new TypeError(`paths: invalid path kind "${kind}" \u2014 expected one of ${Object.keys(PATHS_RESOLVER_KIND_ENV).join(", ")}`);
35516
- }
35517
- }
35518
- function pathsResolverBaseDir(kind, options) {
35519
- pathsResolverAssertKind(kind);
35991
+ function pathsResolverDataBaseDir(options) {
35520
35992
  const env = options.env ?? process.env;
35521
- const override = env[PATHS_RESOLVER_KIND_ENV[kind]];
35993
+ const override = env[PATHS_RESOLVER_DATA_ENV];
35522
35994
  if (typeof override === "string" && override.length > 0)
35523
35995
  return override;
35524
35996
  const home = options.home ?? pathsResolverHomedir();
35525
35997
  const platform = options.platform ?? process.platform;
35526
- if (platform === "darwin") {
35527
- switch (kind) {
35528
- case "config":
35529
- case "data":
35530
- return pathsResolverJoin(home, "Library", "Application Support", "Hasna");
35531
- case "cache":
35532
- return pathsResolverJoin(home, "Library", "Caches", "Hasna");
35533
- case "state":
35534
- return pathsResolverJoin(home, "Library", "Logs", "Hasna");
35535
- }
35536
- }
35537
- switch (kind) {
35538
- case "config":
35539
- return pathsResolverJoin(home, ".config", "hasna");
35540
- case "data":
35541
- return pathsResolverJoin(home, ".local", "share", "hasna");
35542
- case "state":
35543
- return pathsResolverJoin(home, ".local", "state", "hasna");
35544
- case "cache":
35545
- return pathsResolverJoin(home, ".cache", "hasna");
35546
- }
35998
+ return platform === "darwin" ? pathsResolverJoin(home, "Library", "Application Support", "Hasna") : pathsResolverJoin(home, ".local", "share", "hasna");
35547
35999
  }
35548
- function pathsResolverResolve(kind, options) {
36000
+ function dataDir(options) {
35549
36001
  pathsResolverAssertApp(options.app);
35550
36002
  const appSegment = options.internal === true ? pathsResolverJoin("internal", options.app) : options.app;
35551
- return pathsResolverJoin(pathsResolverBaseDir(kind, options), appSegment);
35552
- }
35553
- function dataDir(options) {
35554
- return pathsResolverResolve("data", options);
36003
+ return pathsResolverJoin(pathsResolverDataBaseDir(options), appSegment);
35555
36004
  }
35556
36005
  var DATA_DIR_ENV = "HASNA_SKILLS_DIR";
35557
36006
  var HASNA_SKILLS_HOME_ENV = "HASNA_SKILLS_HOME";
@@ -36882,13 +37331,12 @@ class SqliteGovernanceStore {
36882
37331
  return rows.map((row) => this.reservationFrom(row));
36883
37332
  }
36884
37333
  async reconcileReservation(reservationId2, actualCents, status) {
36885
- const row = this.db.query("SELECT * FROM skills_credit_reservations WHERE id = ? LIMIT 1").get(reservationId2);
36886
- if (!row || String(row.status) !== "reserved")
36887
- return row ? this.reservationFrom(row) : null;
36888
- const reconciledAt = nowIso();
36889
- this.db.run("UPDATE skills_credit_reservations SET actual_cents = ?, status = ?, reconciled_at = ? WHERE id = ?", [actualCents, status, reconciledAt, reservationId2]);
36890
- const updated = this.db.query("SELECT * FROM skills_credit_reservations WHERE id = ? LIMIT 1").get(reservationId2);
36891
- return this.reservationFrom(updated);
37334
+ const updated = this.db.query(`UPDATE skills_credit_reservations SET actual_cents = ?, status = ?, reconciled_at = ?
37335
+ WHERE id = ? AND status = 'reserved' RETURNING *`).get(actualCents, status, nowIso(), reservationId2);
37336
+ if (updated)
37337
+ return this.reservationFrom(updated);
37338
+ const existing = this.db.query("SELECT * FROM skills_credit_reservations WHERE id = ? LIMIT 1").get(reservationId2);
37339
+ return existing ? this.reservationFrom(existing) : null;
36892
37340
  }
36893
37341
  async monthlySpendCents(orgId, monthPrefix) {
36894
37342
  const from = `${monthPrefix}-01T00:00:00.000Z`;
@@ -37076,6 +37524,7 @@ import { fileURLToPath as fileURLToPath2 } from "url";
37076
37524
  import {
37077
37525
  cpSync as cpSync3,
37078
37526
  existsSync as existsSync9,
37527
+ lstatSync as lstatSync4,
37079
37528
  mkdirSync as mkdirSync6,
37080
37529
  mkdtempSync as mkdtempSync2,
37081
37530
  readFileSync as readFileSync10,
@@ -38549,14 +38998,27 @@ function normalizePortableSkillName(name) {
38549
38998
  }
38550
38999
  return normalized;
38551
39000
  }
39001
+ function normalizeNewPortableSkillName(name) {
39002
+ normalizePortableSkillName(name);
39003
+ const normalized = name.trim().replace(/([A-Z]+)([A-Z][a-z])/g, "$1-$2").replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
39004
+ if (!normalized)
39005
+ throw new Error(`Invalid skill name '${name}'. Include letters or numbers.`);
39006
+ return normalized;
39007
+ }
38552
39008
  function readPortableSkillManifest(skillPath, fallbackName = basename(skillPath)) {
39009
+ return readManifest(skillPath, fallbackName, normalizePortableSkillName);
39010
+ }
39011
+ function readPortableSkillManifestForImport(skillPath) {
39012
+ return readManifest(skillPath, basename(skillPath), normalizeNewPortableSkillName);
39013
+ }
39014
+ function readManifest(skillPath, fallbackName, normalizeName) {
38553
39015
  const skillJsonPath = join12(skillPath, "skill.json");
38554
39016
  const skillMdPath = join12(skillPath, "SKILL.md");
38555
39017
  const pkgPath = join12(skillPath, "package.json");
38556
39018
  const jsonManifest = existsSync7(skillJsonPath) ? readJsonObject(skillJsonPath) : undefined;
38557
39019
  const frontmatter = existsSync7(skillMdPath) ? parseSkillFrontmatter(readFileSync9(skillMdPath, "utf-8")) ?? undefined : undefined;
38558
39020
  const pkg = existsSync7(pkgPath) ? readJsonObject(pkgPath) : undefined;
38559
- const name = normalizePortableSkillName(stringField(jsonManifest, "name") ?? frontmatter?.name ?? stringValue(pkg?.name) ?? fallbackName);
39021
+ const name = normalizeName(stringField(jsonManifest, "name") ?? frontmatter?.name ?? stringValue(pkg?.name) ?? fallbackName);
38560
39022
  const description = stringField(jsonManifest, "description") ?? frontmatter?.description ?? stringValue(pkg?.description) ?? `${name} skill`;
38561
39023
  const version2 = readDeclaredSkillVersion(skillPath) ?? PORTABLE_SKILL_DEFAULT_VERSION;
38562
39024
  const kind = parseSkillKind(stringField(jsonManifest, "kind") ?? frontmatter?.kind);
@@ -38804,10 +39266,45 @@ function ensureInstructionSkillFiles(skillPath, manifest) {
38804
39266
  };
38805
39267
  if (!existsSync7(join12(skillPath, "SKILL.md"))) {
38806
39268
  writeFileSync2(join12(skillPath, "SKILL.md"), renderSkillMd(next));
39269
+ } else {
39270
+ const path = join12(skillPath, "SKILL.md");
39271
+ const content = readFileSync9(path, "utf8");
39272
+ const declaredName = parseSkillFrontmatter(content)?.name;
39273
+ if (declaredName && declaredName !== next.name) {
39274
+ writeFileSync2(path, renameInstructionFrontmatter(content, next.name));
39275
+ }
39276
+ }
39277
+ const packagePath = join12(skillPath, "package.json");
39278
+ if (existsSync7(packagePath)) {
39279
+ const pkg = readJsonObject(packagePath);
39280
+ if (typeof pkg.name === "string" && pkg.name !== next.name) {
39281
+ writeFileSync2(packagePath, `${JSON.stringify({ ...pkg, name: next.name }, null, 2)}
39282
+ `);
39283
+ }
38807
39284
  }
38808
39285
  writeSkillJsonWithHash(skillPath, next);
38809
39286
  return readPortableSkillManifest(skillPath, next.name);
38810
39287
  }
39288
+ function renameInstructionFrontmatter(content, name) {
39289
+ const frontmatter = content.match(/^---\r?\n([\s\S]*?)\r?\n---(?=\r?\n|$)/);
39290
+ const names = frontmatter?.[1]?.match(/^[ \t]*name[ \t]*:[^\r\n]*/gm) ?? [];
39291
+ const declaration = names.length === 1 ? names[0].match(/^(name[ \t]*:[ \t]*)(.*?)([ \t]*)$/) : null;
39292
+ const scalar = declaration?.[2] ?? "";
39293
+ let simple = /^[a-zA-Z0-9_.@/ -]+$/.test(scalar);
39294
+ if (scalar.startsWith('"')) {
39295
+ try {
39296
+ simple = typeof JSON.parse(scalar) === "string";
39297
+ } catch {
39298
+ simple = false;
39299
+ }
39300
+ } else if (scalar.startsWith("'"))
39301
+ simple = /^'[^'\r\n]*'$/.test(scalar);
39302
+ if (!frontmatter || !declaration || !simple) {
39303
+ throw new Error("Cannot rename instruction SKILL.md: use one unambiguous top-level name scalar in frontmatter.");
39304
+ }
39305
+ const renamed = frontmatter[0].replace(/^name[ \t]*:[^\r\n]*/m, () => `${declaration[1]}${name}${declaration[3]}`);
39306
+ return renamed + content.slice(frontmatter[0].length);
39307
+ }
38811
39308
  function copySkillDirectory(source, destination) {
38812
39309
  const resolvedSource = lstatSync3(source).isSymbolicLink() ? realpathSync(source) : source;
38813
39310
  mkdirSync4(destination, { recursive: true });
@@ -39215,7 +39712,7 @@ function isOfficialSkillName(name) {
39215
39712
  return OFFICIAL_SKILL_NAMES.has(name);
39216
39713
  }
39217
39714
  function scaffoldPortableSkill(name, options = {}) {
39218
- const skillName = normalizePortableSkillName(name);
39715
+ const skillName = normalizeNewPortableSkillName(name);
39219
39716
  const root3 = getPortableSkillsRoot(options);
39220
39717
  const skillPath = join13(root3, skillName);
39221
39718
  if (existsSync8(skillPath)) {
@@ -39285,9 +39782,9 @@ function portPortableSkill(sourcePath, options = {}) {
39285
39782
  if (!existsSync8(absoluteSource) || !statSync7(absoluteSource).isDirectory()) {
39286
39783
  throw new Error(`Skill source directory not found: ${sourcePath}`);
39287
39784
  }
39288
- const inferred = readPortableSkillManifest(absoluteSource, basename2(absoluteSource));
39785
+ const inferred = readPortableSkillManifestForImport(absoluteSource);
39289
39786
  const explicitName = options.name != null;
39290
- const skillName = normalizePortableSkillName(options.name ?? inferred.name);
39787
+ const skillName = normalizeNewPortableSkillName(options.name ?? inferred.name);
39291
39788
  if (isOfficialSkillName(skillName) && !options.allowShadow) {
39292
39789
  const sourceSlug = safeNormalizeName(basename2(absoluteSource));
39293
39790
  const via = explicitName ? `Name '${skillName}' matches a bundled official skill.` : `Inferred name '${skillName}'${sourceSlug && sourceSlug !== skillName ? ` (from source folder '${basename2(absoluteSource)}')` : ""} matches a bundled official skill.`;
@@ -39561,6 +40058,20 @@ var SYNC_AGENTS = ["claude", "codewith", "codex", "opencode", "cursor"];
39561
40058
  var SKILLS_SOURCE_ENV = "SKILLS_SOURCE";
39562
40059
  var SYNC_MARKER_FILE = ".hasna-skills.json";
39563
40060
  var SYNC_MARKER_MANAGED_BY = "@hasna/skills";
40061
+ function isSkillsOwnershipMarker(marker) {
40062
+ return typeof marker === "object" && marker !== null && Object.hasOwn(marker, "managedBy") && marker.managedBy === SYNC_MARKER_MANAGED_BY;
40063
+ }
40064
+ function hasSkillsOwnershipMarker(dir) {
40065
+ const path = join14(dir, SYNC_MARKER_FILE);
40066
+ try {
40067
+ if (!lstatSync4(path).isFile())
40068
+ return false;
40069
+ const marker = JSON.parse(readFileSync10(path, "utf8"));
40070
+ return isSkillsOwnershipMarker(marker);
40071
+ } catch {
40072
+ return false;
40073
+ }
40074
+ }
39564
40075
  function isSyncAgent(value) {
39565
40076
  return SYNC_AGENTS.includes(value);
39566
40077
  }
@@ -39744,7 +40255,7 @@ function writeManagedSkillDir(dir, skillMd, options) {
39744
40255
  const skillMdPath = join14(dir, "SKILL.md");
39745
40256
  const markerPath = join14(dir, SYNC_MARKER_FILE);
39746
40257
  const dirExists = existsSync9(dir);
39747
- const managed = existsSync9(markerPath);
40258
+ const managed = hasSkillsOwnershipMarker(dir);
39748
40259
  const hasSkillMd = existsSync9(skillMdPath);
39749
40260
  if (dirExists && !managed && !hasSkillMd) {
39750
40261
  return {
@@ -39757,7 +40268,7 @@ function writeManagedSkillDir(dir, skillMd, options) {
39757
40268
  return {
39758
40269
  action: "skip",
39759
40270
  path: skillMdPath,
39760
- reason: "an unmanaged SKILL.md already exists here (hand-authored); pass --force to overwrite"
40271
+ reason: existsSync9(markerPath) ? "an unmanaged SKILL.md already exists here (invalid or foreign ownership marker); pass --force to overwrite" : "an unmanaged SKILL.md already exists here (hand-authored); pass --force to overwrite"
39761
40272
  };
39762
40273
  }
39763
40274
  if (dirExists && managed && hasSkillMd && !options.force && isPointerSkillMd(skillMd)) {
@@ -39834,7 +40345,7 @@ function writeManagedSkillDir(dir, skillMd, options) {
39834
40345
  }
39835
40346
  function removeManagedAgentSkill(skill, agent, homeDir2 = homedir3()) {
39836
40347
  const dir = join14(agentGlobalSkillsDir(agent, homeDir2), skill);
39837
- if (!existsSync9(join14(dir, SYNC_MARKER_FILE)))
40348
+ if (!hasSkillsOwnershipMarker(dir))
39838
40349
  return false;
39839
40350
  rmSync2(dir, { recursive: true, force: true });
39840
40351
  return true;
@@ -40555,7 +41066,7 @@ function removeSkillForAgent(name, options) {
40555
41066
  const canonicalName = getCanonicalSkillName(name);
40556
41067
  const scope = options.scope ?? "global";
40557
41068
  const dir = getAgentSkillPath(canonicalName, options.agent, scope, options.projectDir);
40558
- if (!existsSync12(join17(dir, SYNC_MARKER_FILE)))
41069
+ if (!hasSkillsOwnershipMarker(dir))
40559
41070
  return false;
40560
41071
  rmSync3(dir, { recursive: true, force: true });
40561
41072
  return true;
@@ -40799,7 +41310,7 @@ async function runSkill(name, args, options = {}) {
40799
41310
  }
40800
41311
  const proc = Bun.spawn(["bun", "run", entryPath, ...args], {
40801
41312
  cwd: skillPath,
40802
- stdout: options.stdio === "pipe" ? "pipe" : "inherit",
41313
+ stdout: options.stdio === "pipe" ? "pipe" : options.stdio === "stderr" ? 2 : "inherit",
40803
41314
  stderr: options.stdio === "pipe" ? "pipe" : "inherit",
40804
41315
  stdin: "inherit",
40805
41316
  env: { ...process.env, ...options.env }
@@ -41169,7 +41680,7 @@ async function getMergedSkill(store, artifactStorage, principal, slug) {
41169
41680
  if (resolved.kind === "published")
41170
41681
  return publishedPayload(resolved.record);
41171
41682
  const bundled = getServerSkill(slug);
41172
- return bundled ? bundled : null;
41683
+ return bundled ? { ...bundled, publicationState: "catalogue-only", revisionId: null } : null;
41173
41684
  }
41174
41685
  async function getMergedSkillMd(store, artifactStorage, principal, slug) {
41175
41686
  const resolved = await resolvePublishedSkill(store, artifactStorage, principal, slug);
@@ -47133,7 +47644,7 @@ function sortKeys(value) {
47133
47644
  return value.map(sortKeys);
47134
47645
  if (value !== null && typeof value === "object") {
47135
47646
  const record = value;
47136
- const sorted = {};
47647
+ const sorted = Object.create(null);
47137
47648
  for (const key of Object.keys(record).sort()) {
47138
47649
  sorted[key] = sortKeys(record[key]);
47139
47650
  }
@@ -47886,23 +48397,23 @@ function createReceiptService(store) {
47886
48397
  // src/sdk/execution/dispatchers/ecs.ts
47887
48398
  import { createHash as createHash11 } from "crypto";
47888
48399
 
47889
- // ../../node_modules/.bun/@aws-sdk+client-ecs@3.1126.0/node_modules/@aws-sdk/client-ecs/dist-es/ECSClient.js
47890
- var import_client35 = __toESM(require_client2(), 1);
48400
+ // ../../node_modules/.bun/@aws-sdk+client-ecs@3.1127.0/node_modules/@aws-sdk/client-ecs/dist-es/ECSClient.js
48401
+ var import_client36 = __toESM(require_client2(), 1);
47891
48402
  var import_core2 = __toESM(require_dist_cjs2(), 1);
47892
- var import_client36 = __toESM(require_client(), 1);
48403
+ var import_client37 = __toESM(require_client(), 1);
47893
48404
  var import_config39 = __toESM(require_config(), 1);
47894
48405
  var import_endpoints8 = __toESM(require_endpoints(), 1);
47895
48406
  var import_protocols10 = __toESM(require_protocols(), 1);
47896
48407
  var import_retry6 = __toESM(require_retry(), 1);
47897
48408
  var import_schema4 = __toESM(require_schema(), 1);
47898
48409
 
47899
- // ../../node_modules/.bun/@aws-sdk+client-ecs@3.1126.0/node_modules/@aws-sdk/client-ecs/dist-es/auth/httpAuthSchemeProvider.js
48410
+ // ../../node_modules/.bun/@aws-sdk+client-ecs@3.1127.0/node_modules/@aws-sdk/client-ecs/dist-es/auth/httpAuthSchemeProvider.js
47900
48411
  var import_httpAuthSchemes4 = __toESM(require_httpAuthSchemes(), 1);
47901
- var import_client27 = __toESM(require_client(), 1);
48412
+ var import_client28 = __toESM(require_client(), 1);
47902
48413
  var defaultECSHttpAuthSchemeParametersProvider = async (config, context, input) => {
47903
48414
  return {
47904
- operation: import_client27.getSmithyContext(context).operation,
47905
- region: await import_client27.normalizeProvider(config.region)() || (() => {
48415
+ operation: import_client28.getSmithyContext(context).operation,
48416
+ region: await import_client28.normalizeProvider(config.region)() || (() => {
47906
48417
  throw new Error("expected `region` to be configured for `aws.auth#sigv4`");
47907
48418
  })()
47908
48419
  };
@@ -47934,11 +48445,11 @@ var defaultECSHttpAuthSchemeProvider = (authParameters) => {
47934
48445
  var resolveHttpAuthSchemeConfig3 = (config) => {
47935
48446
  const config_0 = import_httpAuthSchemes4.resolveAwsSdkSigV4Config(config);
47936
48447
  return Object.assign(config_0, {
47937
- authSchemePreference: import_client27.normalizeProvider(config.authSchemePreference ?? [])
48448
+ authSchemePreference: import_client28.normalizeProvider(config.authSchemePreference ?? [])
47938
48449
  });
47939
48450
  };
47940
48451
 
47941
- // ../../node_modules/.bun/@aws-sdk+client-ecs@3.1126.0/node_modules/@aws-sdk/client-ecs/dist-es/endpoint/EndpointParameters.js
48452
+ // ../../node_modules/.bun/@aws-sdk+client-ecs@3.1127.0/node_modules/@aws-sdk/client-ecs/dist-es/endpoint/EndpointParameters.js
47942
48453
  var resolveClientEndpointParameters3 = (options) => {
47943
48454
  return Object.assign(options, {
47944
48455
  useDualstackEndpoint: options.useDualstackEndpoint ?? false,
@@ -47952,10 +48463,10 @@ var commonParams3 = {
47952
48463
  Region: { type: "builtInParams", name: "region" },
47953
48464
  UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" }
47954
48465
  };
47955
- // ../../node_modules/.bun/@aws-sdk+client-ecs@3.1126.0/node_modules/@aws-sdk/client-ecs/package.json
48466
+ // ../../node_modules/.bun/@aws-sdk+client-ecs@3.1127.0/node_modules/@aws-sdk/client-ecs/package.json
47956
48467
  var package_default3 = {
47957
48468
  name: "@aws-sdk/client-ecs",
47958
- version: "3.1126.0",
48469
+ version: "3.1127.0",
47959
48470
  description: "AWS SDK for JavaScript Ecs Client for Node.js, Browser and React Native",
47960
48471
  homepage: "https://github.com/aws/aws-sdk-js-v3/tree/main/clients/client-ecs",
47961
48472
  license: "Apache-2.0",
@@ -48025,28 +48536,28 @@ var package_default3 = {
48025
48536
  }
48026
48537
  };
48027
48538
 
48028
- // ../../node_modules/.bun/@aws-sdk+client-ecs@3.1126.0/node_modules/@aws-sdk/client-ecs/dist-es/runtimeConfig.js
48029
- var import_client31 = __toESM(require_client2(), 1);
48539
+ // ../../node_modules/.bun/@aws-sdk+client-ecs@3.1127.0/node_modules/@aws-sdk/client-ecs/dist-es/runtimeConfig.js
48540
+ var import_client32 = __toESM(require_client2(), 1);
48030
48541
  var import_httpAuthSchemes6 = __toESM(require_httpAuthSchemes(), 1);
48031
- var import_client32 = __toESM(require_client(), 1);
48542
+ var import_client33 = __toESM(require_client(), 1);
48032
48543
  var import_config38 = __toESM(require_config(), 1);
48033
48544
  var import_retry5 = __toESM(require_retry(), 1);
48034
48545
  var import_serde6 = __toESM(require_serde(), 1);
48035
48546
  var import_node_http_handler3 = __toESM(require_dist_cjs6(), 1);
48036
48547
 
48037
- // ../../node_modules/.bun/@aws-sdk+client-ecs@3.1126.0/node_modules/@aws-sdk/client-ecs/dist-es/runtimeConfig.shared.js
48548
+ // ../../node_modules/.bun/@aws-sdk+client-ecs@3.1127.0/node_modules/@aws-sdk/client-ecs/dist-es/runtimeConfig.shared.js
48038
48549
  var import_httpAuthSchemes5 = __toESM(require_httpAuthSchemes(), 1);
48039
48550
  var import_protocols7 = __toESM(require_protocols2(), 1);
48040
48551
  var import_checksum3 = __toESM(require_checksum(), 1);
48041
- var import_client30 = __toESM(require_client(), 1);
48552
+ var import_client31 = __toESM(require_client(), 1);
48042
48553
  var import_protocols8 = __toESM(require_protocols(), 1);
48043
48554
  var import_serde5 = __toESM(require_serde(), 1);
48044
48555
 
48045
- // ../../node_modules/.bun/@aws-sdk+client-ecs@3.1126.0/node_modules/@aws-sdk/client-ecs/dist-es/endpoint/endpointResolver.js
48046
- var import_client28 = __toESM(require_client2(), 1);
48556
+ // ../../node_modules/.bun/@aws-sdk+client-ecs@3.1127.0/node_modules/@aws-sdk/client-ecs/dist-es/endpoint/endpointResolver.js
48557
+ var import_client29 = __toESM(require_client2(), 1);
48047
48558
  var import_endpoints7 = __toESM(require_endpoints(), 1);
48048
48559
 
48049
- // ../../node_modules/.bun/@aws-sdk+client-ecs@3.1126.0/node_modules/@aws-sdk/client-ecs/dist-es/endpoint/bdd.js
48560
+ // ../../node_modules/.bun/@aws-sdk+client-ecs@3.1127.0/node_modules/@aws-sdk/client-ecs/dist-es/endpoint/bdd.js
48050
48561
  var import_endpoints6 = __toESM(require_endpoints(), 1);
48051
48562
  var k3 = "ref";
48052
48563
  var a3 = -1;
@@ -48129,7 +48640,7 @@ var nodes3 = new Int32Array([
48129
48640
  ]);
48130
48641
  var bdd3 = import_endpoints6.BinaryDecisionDiagram.from(nodes3, root3, _data3.conditions, _data3.results);
48131
48642
 
48132
- // ../../node_modules/.bun/@aws-sdk+client-ecs@3.1126.0/node_modules/@aws-sdk/client-ecs/dist-es/endpoint/endpointResolver.js
48643
+ // ../../node_modules/.bun/@aws-sdk+client-ecs@3.1127.0/node_modules/@aws-sdk/client-ecs/dist-es/endpoint/endpointResolver.js
48133
48644
  var cache3 = new import_endpoints7.EndpointCache({
48134
48645
  size: 50,
48135
48646
  params: ["Endpoint", "Region", "UseDualStack", "UseFIPS"]
@@ -48140,21 +48651,21 @@ var defaultEndpointResolver3 = (endpointParams, context = {}) => {
48140
48651
  logger: context.logger
48141
48652
  }));
48142
48653
  };
48143
- import_endpoints7.customEndpointFunctions.aws = import_client28.awsEndpointFunctions;
48654
+ import_endpoints7.customEndpointFunctions.aws = import_client29.awsEndpointFunctions;
48144
48655
 
48145
- // ../../node_modules/.bun/@aws-sdk+client-ecs@3.1126.0/node_modules/@aws-sdk/client-ecs/dist-es/schemas/schemas_0.js
48656
+ // ../../node_modules/.bun/@aws-sdk+client-ecs@3.1127.0/node_modules/@aws-sdk/client-ecs/dist-es/schemas/schemas_0.js
48146
48657
  var import_schema3 = __toESM(require_schema(), 1);
48147
48658
 
48148
- // ../../node_modules/.bun/@aws-sdk+client-ecs@3.1126.0/node_modules/@aws-sdk/client-ecs/dist-es/models/ECSServiceException.js
48149
- var import_client29 = __toESM(require_client(), 1);
48150
- class ECSServiceException extends import_client29.ServiceException {
48659
+ // ../../node_modules/.bun/@aws-sdk+client-ecs@3.1127.0/node_modules/@aws-sdk/client-ecs/dist-es/models/ECSServiceException.js
48660
+ var import_client30 = __toESM(require_client(), 1);
48661
+ class ECSServiceException extends import_client30.ServiceException {
48151
48662
  constructor(options) {
48152
48663
  super(options);
48153
48664
  Object.setPrototypeOf(this, ECSServiceException.prototype);
48154
48665
  }
48155
48666
  }
48156
48667
 
48157
- // ../../node_modules/.bun/@aws-sdk+client-ecs@3.1126.0/node_modules/@aws-sdk/client-ecs/dist-es/models/errors.js
48668
+ // ../../node_modules/.bun/@aws-sdk+client-ecs@3.1127.0/node_modules/@aws-sdk/client-ecs/dist-es/models/errors.js
48158
48669
  class AccessDeniedException extends ECSServiceException {
48159
48670
  name = "AccessDeniedException";
48160
48671
  $fault = "client";
@@ -48547,7 +49058,7 @@ class BlockedException extends ECSServiceException {
48547
49058
  }
48548
49059
  }
48549
49060
 
48550
- // ../../node_modules/.bun/@aws-sdk+client-ecs@3.1126.0/node_modules/@aws-sdk/client-ecs/dist-es/schemas/schemas_0.js
49061
+ // ../../node_modules/.bun/@aws-sdk+client-ecs@3.1127.0/node_modules/@aws-sdk/client-ecs/dist-es/schemas/schemas_0.js
48551
49062
  var _A2 = "Attachment";
48552
49063
  var _ACR = "AcceleratorCountRequest";
48553
49064
  var _AD2 = "AttachmentDetails";
@@ -50934,7 +51445,7 @@ var StopTask$ = [
50934
51445
  () => StopTaskResponse$
50935
51446
  ];
50936
51447
 
50937
- // ../../node_modules/.bun/@aws-sdk+client-ecs@3.1126.0/node_modules/@aws-sdk/client-ecs/dist-es/runtimeConfig.shared.js
51448
+ // ../../node_modules/.bun/@aws-sdk+client-ecs@3.1127.0/node_modules/@aws-sdk/client-ecs/dist-es/runtimeConfig.shared.js
50938
51449
  var getRuntimeConfig4 = (config) => {
50939
51450
  return {
50940
51451
  apiVersion: "2014-11-13",
@@ -50951,7 +51462,7 @@ var getRuntimeConfig4 = (config) => {
50951
51462
  signer: new import_httpAuthSchemes5.AwsSdkSigV4Signer
50952
51463
  }
50953
51464
  ],
50954
- logger: config?.logger ?? new import_client30.NoOpLogger,
51465
+ logger: config?.logger ?? new import_client31.NoOpLogger,
50955
51466
  protocol: config?.protocol ?? import_protocols7.AwsJson1_1Protocol,
50956
51467
  protocolSettings: config?.protocolSettings ?? {
50957
51468
  defaultNamespace: "com.amazonaws.ecs",
@@ -50968,13 +51479,13 @@ var getRuntimeConfig4 = (config) => {
50968
51479
  };
50969
51480
  };
50970
51481
 
50971
- // ../../node_modules/.bun/@aws-sdk+client-ecs@3.1126.0/node_modules/@aws-sdk/client-ecs/dist-es/runtimeConfig.js
51482
+ // ../../node_modules/.bun/@aws-sdk+client-ecs@3.1127.0/node_modules/@aws-sdk/client-ecs/dist-es/runtimeConfig.js
50972
51483
  var getRuntimeConfig5 = (config) => {
50973
- import_client32.emitWarningIfUnsupportedVersion(process.version);
51484
+ import_client33.emitWarningIfUnsupportedVersion(process.version);
50974
51485
  const defaultsMode = import_config38.resolveDefaultsModeConfig(config);
50975
- const defaultConfigProvider = () => defaultsMode().then(import_client32.loadConfigsForDefaultMode);
51486
+ const defaultConfigProvider = () => defaultsMode().then(import_client33.loadConfigsForDefaultMode);
50976
51487
  const clientSharedValues = getRuntimeConfig4(config);
50977
- import_client31.emitWarningIfUnsupportedVersion(process.version);
51488
+ import_client32.emitWarningIfUnsupportedVersion(process.version);
50978
51489
  const loaderConfig = {
50979
51490
  profile: config?.profile,
50980
51491
  logger: clientSharedValues.logger
@@ -50987,7 +51498,7 @@ var getRuntimeConfig5 = (config) => {
50987
51498
  authSchemePreference: config?.authSchemePreference ?? import_config38.loadConfig(import_httpAuthSchemes6.NODE_AUTH_SCHEME_PREFERENCE_OPTIONS, loaderConfig),
50988
51499
  bodyLengthChecker: config?.bodyLengthChecker ?? import_serde6.calculateBodyLength,
50989
51500
  credentialDefaultProvider: config?.credentialDefaultProvider ?? defaultProvider,
50990
- defaultUserAgentProvider: config?.defaultUserAgentProvider ?? import_client31.createDefaultUserAgentProvider({ serviceId: clientSharedValues.serviceId, clientVersion: package_default3.version }),
51501
+ defaultUserAgentProvider: config?.defaultUserAgentProvider ?? import_client32.createDefaultUserAgentProvider({ serviceId: clientSharedValues.serviceId, clientVersion: package_default3.version }),
50991
51502
  maxAttempts: config?.maxAttempts ?? import_config38.loadConfig(import_retry5.NODE_MAX_ATTEMPT_CONFIG_OPTIONS, config),
50992
51503
  region: config?.region ?? import_config38.loadConfig(import_config38.NODE_REGION_CONFIG_OPTIONS, { ...import_config38.NODE_REGION_CONFIG_FILE_OPTIONS, ...loaderConfig }),
50993
51504
  requestHandler: import_node_http_handler3.NodeHttpHandler.create(config?.requestHandler ?? defaultConfigProvider),
@@ -50998,16 +51509,16 @@ var getRuntimeConfig5 = (config) => {
50998
51509
  streamCollector: config?.streamCollector ?? import_node_http_handler3.streamCollector,
50999
51510
  useDualstackEndpoint: config?.useDualstackEndpoint ?? import_config38.loadConfig(import_config38.NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS, loaderConfig),
51000
51511
  useFipsEndpoint: config?.useFipsEndpoint ?? import_config38.loadConfig(import_config38.NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS, loaderConfig),
51001
- userAgentAppId: config?.userAgentAppId ?? import_config38.loadConfig(import_client31.NODE_APP_ID_CONFIG_OPTIONS, loaderConfig)
51512
+ userAgentAppId: config?.userAgentAppId ?? import_config38.loadConfig(import_client32.NODE_APP_ID_CONFIG_OPTIONS, loaderConfig)
51002
51513
  };
51003
51514
  };
51004
51515
 
51005
- // ../../node_modules/.bun/@aws-sdk+client-ecs@3.1126.0/node_modules/@aws-sdk/client-ecs/dist-es/runtimeExtensions.js
51006
- var import_client33 = __toESM(require_client2(), 1);
51007
- var import_client34 = __toESM(require_client(), 1);
51516
+ // ../../node_modules/.bun/@aws-sdk+client-ecs@3.1127.0/node_modules/@aws-sdk/client-ecs/dist-es/runtimeExtensions.js
51517
+ var import_client34 = __toESM(require_client2(), 1);
51518
+ var import_client35 = __toESM(require_client(), 1);
51008
51519
  var import_protocols9 = __toESM(require_protocols(), 1);
51009
51520
 
51010
- // ../../node_modules/.bun/@aws-sdk+client-ecs@3.1126.0/node_modules/@aws-sdk/client-ecs/dist-es/auth/httpAuthExtensionConfiguration.js
51521
+ // ../../node_modules/.bun/@aws-sdk+client-ecs@3.1127.0/node_modules/@aws-sdk/client-ecs/dist-es/auth/httpAuthExtensionConfiguration.js
51011
51522
  var getHttpAuthExtensionConfiguration3 = (runtimeConfig) => {
51012
51523
  const _httpAuthSchemes = runtimeConfig.httpAuthSchemes;
51013
51524
  let _httpAuthSchemeProvider = runtimeConfig.httpAuthSchemeProvider;
@@ -51046,36 +51557,36 @@ var resolveHttpAuthRuntimeConfig3 = (config) => {
51046
51557
  };
51047
51558
  };
51048
51559
 
51049
- // ../../node_modules/.bun/@aws-sdk+client-ecs@3.1126.0/node_modules/@aws-sdk/client-ecs/dist-es/runtimeExtensions.js
51560
+ // ../../node_modules/.bun/@aws-sdk+client-ecs@3.1127.0/node_modules/@aws-sdk/client-ecs/dist-es/runtimeExtensions.js
51050
51561
  var resolveRuntimeExtensions3 = (runtimeConfig, extensions) => {
51051
- const extensionConfiguration = Object.assign(import_client33.getAwsRegionExtensionConfiguration(runtimeConfig), import_client34.getDefaultExtensionConfiguration(runtimeConfig), import_protocols9.getHttpHandlerExtensionConfiguration(runtimeConfig), getHttpAuthExtensionConfiguration3(runtimeConfig));
51562
+ const extensionConfiguration = Object.assign(import_client34.getAwsRegionExtensionConfiguration(runtimeConfig), import_client35.getDefaultExtensionConfiguration(runtimeConfig), import_protocols9.getHttpHandlerExtensionConfiguration(runtimeConfig), getHttpAuthExtensionConfiguration3(runtimeConfig));
51052
51563
  extensions.forEach((extension) => extension.configure(extensionConfiguration));
51053
- return Object.assign(runtimeConfig, import_client33.resolveAwsRegionExtensionConfiguration(extensionConfiguration), import_client34.resolveDefaultRuntimeConfig(extensionConfiguration), import_protocols9.resolveHttpHandlerRuntimeConfig(extensionConfiguration), resolveHttpAuthRuntimeConfig3(extensionConfiguration));
51564
+ return Object.assign(runtimeConfig, import_client34.resolveAwsRegionExtensionConfiguration(extensionConfiguration), import_client35.resolveDefaultRuntimeConfig(extensionConfiguration), import_protocols9.resolveHttpHandlerRuntimeConfig(extensionConfiguration), resolveHttpAuthRuntimeConfig3(extensionConfiguration));
51054
51565
  };
51055
51566
 
51056
- // ../../node_modules/.bun/@aws-sdk+client-ecs@3.1126.0/node_modules/@aws-sdk/client-ecs/dist-es/ECSClient.js
51057
- class ECSClient extends import_client36.Client {
51567
+ // ../../node_modules/.bun/@aws-sdk+client-ecs@3.1127.0/node_modules/@aws-sdk/client-ecs/dist-es/ECSClient.js
51568
+ class ECSClient extends import_client37.Client {
51058
51569
  config;
51059
51570
  constructor(...[configuration]) {
51060
51571
  const _config_0 = getRuntimeConfig5(configuration || {});
51061
51572
  super(_config_0);
51062
51573
  this.initConfig = _config_0;
51063
51574
  const _config_1 = resolveClientEndpointParameters3(_config_0);
51064
- const _config_2 = import_client35.resolveUserAgentConfig(_config_1);
51575
+ const _config_2 = import_client36.resolveUserAgentConfig(_config_1);
51065
51576
  const _config_3 = import_retry6.resolveRetryConfig(_config_2);
51066
51577
  const _config_4 = import_config39.resolveRegionConfig(_config_3);
51067
- const _config_5 = import_client35.resolveHostHeaderConfig(_config_4);
51578
+ const _config_5 = import_client36.resolveHostHeaderConfig(_config_4);
51068
51579
  const _config_6 = import_endpoints8.resolveEndpointConfig(_config_5);
51069
51580
  const _config_7 = resolveHttpAuthSchemeConfig3(_config_6);
51070
51581
  const _config_8 = resolveRuntimeExtensions3(_config_7, configuration?.extensions || []);
51071
51582
  this.config = _config_8;
51072
51583
  this.middlewareStack.use(import_schema4.getSchemaSerdePlugin(this.config));
51073
- this.middlewareStack.use(import_client35.getUserAgentPlugin(this.config));
51584
+ this.middlewareStack.use(import_client36.getUserAgentPlugin(this.config));
51074
51585
  this.middlewareStack.use(import_retry6.getRetryPlugin(this.config));
51075
51586
  this.middlewareStack.use(import_protocols10.getContentLengthPlugin(this.config));
51076
- this.middlewareStack.use(import_client35.getHostHeaderPlugin(this.config));
51077
- this.middlewareStack.use(import_client35.getLoggerPlugin(this.config));
51078
- this.middlewareStack.use(import_client35.getRecursionDetectionPlugin(this.config));
51587
+ this.middlewareStack.use(import_client36.getHostHeaderPlugin(this.config));
51588
+ this.middlewareStack.use(import_client36.getLoggerPlugin(this.config));
51589
+ this.middlewareStack.use(import_client36.getRecursionDetectionPlugin(this.config));
51079
51590
  this.middlewareStack.use(import_core2.getHttpAuthSchemeEndpointRuleSetPlugin(this.config, {
51080
51591
  httpAuthSchemeParametersProvider: defaultECSHttpAuthSchemeParametersProvider,
51081
51592
  identityProviderConfigProvider: async (config) => new import_core2.DefaultIdentityProviderConfig({
@@ -51089,26 +51600,26 @@ class ECSClient extends import_client36.Client {
51089
51600
  }
51090
51601
  }
51091
51602
 
51092
- // ../../node_modules/.bun/@aws-sdk+client-ecs@3.1126.0/node_modules/@aws-sdk/client-ecs/dist-es/commandBuilder.js
51093
- var import_client37 = __toESM(require_client(), 1);
51603
+ // ../../node_modules/.bun/@aws-sdk+client-ecs@3.1127.0/node_modules/@aws-sdk/client-ecs/dist-es/commandBuilder.js
51604
+ var import_client38 = __toESM(require_client(), 1);
51094
51605
  var import_endpoints9 = __toESM(require_endpoints(), 1);
51095
- var command3 = import_client37.makeBuilder(commonParams3, "AmazonEC2ContainerServiceV20141113", "ECSClient", import_endpoints9.getEndpointPlugin);
51606
+ var command3 = import_client38.makeBuilder(commonParams3, "AmazonEC2ContainerServiceV20141113", "ECSClient", import_endpoints9.getEndpointPlugin);
51096
51607
  var _ep03 = {};
51097
51608
  var _mw03 = (Command, cs, config, o2) => [];
51098
51609
 
51099
- // ../../node_modules/.bun/@aws-sdk+client-ecs@3.1126.0/node_modules/@aws-sdk/client-ecs/dist-es/commands/DescribeTasksCommand.js
51610
+ // ../../node_modules/.bun/@aws-sdk+client-ecs@3.1127.0/node_modules/@aws-sdk/client-ecs/dist-es/commands/DescribeTasksCommand.js
51100
51611
  class DescribeTasksCommand extends command3(_ep03, _mw03, "DescribeTasks", DescribeTasks$) {
51101
51612
  }
51102
51613
 
51103
- // ../../node_modules/.bun/@aws-sdk+client-ecs@3.1126.0/node_modules/@aws-sdk/client-ecs/dist-es/commands/ListTasksCommand.js
51614
+ // ../../node_modules/.bun/@aws-sdk+client-ecs@3.1127.0/node_modules/@aws-sdk/client-ecs/dist-es/commands/ListTasksCommand.js
51104
51615
  class ListTasksCommand extends command3(_ep03, _mw03, "ListTasks", ListTasks$) {
51105
51616
  }
51106
51617
 
51107
- // ../../node_modules/.bun/@aws-sdk+client-ecs@3.1126.0/node_modules/@aws-sdk/client-ecs/dist-es/commands/RunTaskCommand.js
51618
+ // ../../node_modules/.bun/@aws-sdk+client-ecs@3.1127.0/node_modules/@aws-sdk/client-ecs/dist-es/commands/RunTaskCommand.js
51108
51619
  class RunTaskCommand extends command3(_ep03, _mw03, "RunTask", RunTask$) {
51109
51620
  }
51110
51621
 
51111
- // ../../node_modules/.bun/@aws-sdk+client-ecs@3.1126.0/node_modules/@aws-sdk/client-ecs/dist-es/commands/StopTaskCommand.js
51622
+ // ../../node_modules/.bun/@aws-sdk+client-ecs@3.1127.0/node_modules/@aws-sdk/client-ecs/dist-es/commands/StopTaskCommand.js
51112
51623
  class StopTaskCommand extends command3(_ep03, _mw03, "StopTask", StopTask$) {
51113
51624
  }
51114
51625
 
@@ -51434,6 +51945,7 @@ var localRunExecutor = {
51434
51945
  // src/sdk/storage.ts
51435
51946
  var artifactStorageSeam = ArtifactStorage;
51436
51947
  // src/sdk/outputs.ts
51948
+ import { createHash as createHash12 } from "crypto";
51437
51949
  class DatabaseOnlyObjectStore {
51438
51950
  usesS3 = false;
51439
51951
  async materialize(run, artifact, body) {
@@ -51461,9 +51973,13 @@ function createGovernedArtifactWriter(options) {
51461
51973
  const storage2 = options.storage ?? new DatabaseOnlyObjectStore;
51462
51974
  return {
51463
51975
  async write(run, meta, body) {
51976
+ if (typeof body?.bodyText !== "string") {
51977
+ throw new TypeError("Governed artifacts require a text body before persistence");
51978
+ }
51464
51979
  const redacted = redactRunOutput(body.bodyText, config.redactPatterns);
51465
51980
  const redactedBody = { ...body, bodyText: redacted };
51466
- const outputBytes = new TextEncoder().encode(redacted).byteLength;
51981
+ const persistedBytes = new TextEncoder().encode(redacted);
51982
+ const outputBytes = persistedBytes.byteLength;
51467
51983
  if (outputBytes > config.perOutputBytes) {
51468
51984
  throw new GovernanceError(GOVERNANCE_ERROR_CODES.ARTIFACT_LIMIT_EXCEEDED, `output ${meta.relativePath} for run ${run.id} is ${outputBytes} bytes; the per-output limit is ${config.perOutputBytes}`, { gate: "perOutputBytes" });
51469
51985
  }
@@ -51475,6 +51991,8 @@ function createGovernedArtifactWriter(options) {
51475
51991
  const createdAt = new Date().toISOString();
51476
51992
  const stamped = {
51477
51993
  ...meta,
51994
+ byteSize: outputBytes,
51995
+ sha256: createHash12("sha256").update(persistedBytes).digest("hex"),
51478
51996
  visibility: options.visibility ?? config.defaultVisibility,
51479
51997
  ...config.artifactTtlSeconds !== undefined ? { expiresAt: expiresAtFor(createdAt, config.artifactTtlSeconds) } : {}
51480
51998
  };
@@ -51646,6 +52164,108 @@ function createOfflineGate(options) {
51646
52164
  }
51647
52165
  };
51648
52166
  }
52167
+ // src/lib/remote-workspace.ts
52168
+ var record = (value) => !!value && typeof value === "object" && !Array.isArray(value);
52169
+ var cursor = (value) => typeof value === "string" && /^[A-Za-z0-9_-]{1,512}$/.test(value);
52170
+ var uuid = (value) => typeof value === "string" && /^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/i.test(value);
52171
+ function workspaceMembersQuery(options = {}) {
52172
+ if (!record(options) || Object.keys(options).some((key) => key !== "limit" && key !== "cursor") || options.limit !== undefined && (!Number.isInteger(options.limit) || options.limit < 1 || options.limit > 100) || options.cursor !== undefined && !cursor(options.cursor))
52173
+ throw new Error("Use a roster limit from 1 to 100 and an unchanged continuation cursor.");
52174
+ const query = new URLSearchParams;
52175
+ if (options.limit !== undefined)
52176
+ query.set("limit", String(options.limit));
52177
+ if (options.cursor !== undefined)
52178
+ query.set("cursor", options.cursor);
52179
+ return query.size ? `?${query}` : "";
52180
+ }
52181
+ function timestamp(value) {
52182
+ if (typeof value !== "string" || !/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{6}Z$/.test(value))
52183
+ return false;
52184
+ const time = Date.parse(value);
52185
+ return Number.isFinite(time) && new Date(time).toISOString().slice(0, 23) === value.slice(0, 23);
52186
+ }
52187
+ function parseMember(row, fail) {
52188
+ if (!record(row) || !uuid(row.membershipId) || !uuid(row.userId) || typeof row.email !== "string" || !row.email || !(row.displayName === null || typeof row.displayName === "string") || !isRole(row.role) || !timestamp(row.createdAt))
52189
+ return fail();
52190
+ return {
52191
+ membershipId: row.membershipId,
52192
+ userId: row.userId,
52193
+ email: row.email,
52194
+ displayName: row.displayName,
52195
+ role: row.role,
52196
+ createdAt: row.createdAt
52197
+ };
52198
+ }
52199
+ var isRole = (value) => typeof value === "string" && ["owner", "admin", "member", "viewer"].includes(value);
52200
+
52201
+ class WorkspaceMemberInputError extends Error {
52202
+ constructor() {
52203
+ super("Use an unchanged lowercase membership ID and the exact role and expected-role parameters from the roster.");
52204
+ this.name = "WorkspaceMemberInputError";
52205
+ }
52206
+ }
52207
+ function mutationInput(membershipId, input, roleChange) {
52208
+ if (typeof membershipId !== "string" || !uuid(membershipId) || membershipId !== membershipId.toLowerCase() || !record(input) || Object.keys(input).sort().join(",") !== (roleChange ? "expectedRole,role" : "expectedRole"))
52209
+ throw new WorkspaceMemberInputError;
52210
+ const expectedRole = input.expectedRole, role = roleChange ? input.role : undefined;
52211
+ if (!isRole(expectedRole) || roleChange && !isRole(role))
52212
+ throw new WorkspaceMemberInputError;
52213
+ return { membershipId, role, expectedRole };
52214
+ }
52215
+ function workspaceMemberRoleInput(membershipId, input) {
52216
+ const value = mutationInput(membershipId, input, true);
52217
+ return { membershipId: value.membershipId, body: { role: value.role, expectedRole: value.expectedRole } };
52218
+ }
52219
+ function workspaceMemberRemovalInput(membershipId, input) {
52220
+ const value = mutationInput(membershipId, input, false);
52221
+ return { membershipId: value.membershipId, body: { expectedRole: value.expectedRole } };
52222
+ }
52223
+ var invalidMemberResult = "The server returned an invalid workspace member result. Refresh the roster before another action.";
52224
+ function parseWorkspaceMemberRoleResult(value, membershipId, role) {
52225
+ const fail = () => {
52226
+ throw new Error(invalidMemberResult);
52227
+ };
52228
+ if (!record(value) || !uuid(value.organizationId) || typeof value.changed !== "boolean")
52229
+ return fail();
52230
+ const member = parseMember(value.member, fail);
52231
+ if (member.membershipId !== membershipId || member.role !== role)
52232
+ return fail();
52233
+ return { organizationId: value.organizationId, member, changed: value.changed };
52234
+ }
52235
+ function parseWorkspaceMemberRemovalResult(value, membershipId) {
52236
+ if (!record(value) || !uuid(value.organizationId) || value.membershipId !== membershipId || value.removed !== true || typeof value.alreadyRemoved !== "boolean")
52237
+ throw new Error(invalidMemberResult);
52238
+ return { organizationId: value.organizationId, membershipId, removed: true, alreadyRemoved: value.alreadyRemoved };
52239
+ }
52240
+ var workspaceMemberFailures = {
52241
+ INVALID_REQUEST: [400, "Provide the exact membership role parameters."],
52242
+ ACCOUNT_UNAVAILABLE: [403, "Account is unavailable."],
52243
+ INTERACTIVE_SESSION_REQUIRED: [403, "Fresh interactive sign-in is required."],
52244
+ WORKSPACE_ADMIN_REQUIRED: [403, "A current workspace owner or admin is required."],
52245
+ MEMBERSHIP_ACTION_FORBIDDEN: [403, "Your current workspace role cannot perform this membership action."],
52246
+ MEMBERSHIP_NOT_FOUND: [404, "Membership was not found in the current workspace."],
52247
+ SELF_REMOVAL_UNAVAILABLE: [409, "Leaving your own workspace is not available through member removal."],
52248
+ MEMBERSHIP_ROLE_CHANGED: [409, "The member role changed. Refresh the roster before another action."],
52249
+ LAST_OWNER_REQUIRED: [409, "The workspace must retain at least one active owner."],
52250
+ MEMBERSHIP_BUSY: [503, "Membership is busy. Refresh the roster before another action."]
52251
+ };
52252
+ function workspaceMemberFailure(value, status) {
52253
+ if (!record(value) || typeof value.code !== "string" || !Object.hasOwn(workspaceMemberFailures, value.code))
52254
+ return null;
52255
+ const code = value.code;
52256
+ return workspaceMemberFailures[code][0] === status ? code : null;
52257
+ }
52258
+ function parseWorkspaceMembersPage(value) {
52259
+ const fail = () => {
52260
+ throw new Error("The server returned an invalid workspace roster.");
52261
+ };
52262
+ if (!record(value) || !uuid(value.organizationId) || !Array.isArray(value.members) || value.members.length > 100 || !(value.nextCursor === null || cursor(value.nextCursor)) || !value.members.length && value.nextCursor !== null)
52263
+ return fail();
52264
+ const members = value.members.map((row) => parseMember(row, fail));
52265
+ if (new Set(members.map((row) => row.membershipId)).size !== members.length)
52266
+ return fail();
52267
+ return { organizationId: value.organizationId, members, nextCursor: value.nextCursor };
52268
+ }
51649
52269
  // src/lib/auth-store.ts
51650
52270
  function getApiUrl(action, env = process.env, options = {}) {
51651
52271
  return requireSkillsApiOrigin(action, env, options);
@@ -51728,7 +52348,7 @@ function object(value) {
51728
52348
  }
51729
52349
 
51730
52350
  // src/lib/remote-files.ts
51731
- import { createHash as createHash12 } from "crypto";
52351
+ import { createHash as createHash13 } from "crypto";
51732
52352
  var MAX_REMOTE_FILE_BYTES = 64 * 1024 * 1024;
51733
52353
  function describeRemoteFiles(files) {
51734
52354
  if (files.length > 10)
@@ -51746,7 +52366,7 @@ function describeRemoteFiles(files) {
51746
52366
  });
51747
52367
  }
51748
52368
  function sha256(bytes) {
51749
- return createHash12("sha256").update(bytes).digest("hex");
52369
+ return createHash13("sha256").update(bytes).digest("hex");
51750
52370
  }
51751
52371
  async function readBoundedResponse(response, maximum) {
51752
52372
  if (!Number.isSafeInteger(maximum) || maximum < 0 || maximum > MAX_REMOTE_FILE_BYTES)
@@ -51786,6 +52406,37 @@ async function readBoundedResponse(response, maximum) {
51786
52406
  return bytes;
51787
52407
  }
51788
52408
 
52409
+ // src/lib/remote-profile.ts
52410
+ function customerNamePatch(input, field) {
52411
+ if (!isRecord5(input) || Object.keys(input).length !== 1 || !Object.hasOwn(input, field))
52412
+ throw new Error("Provide only the requested name field.");
52413
+ const value = input[field];
52414
+ if (typeof value !== "string" || /[\p{Cc}\p{Cs}\u2028\u2029]/u.test(value) || !value.trim() || [...value.trim()].length > 100) {
52415
+ throw new Error("Use a name of 1\u2013100 characters without control characters or newlines.");
52416
+ }
52417
+ return { [field]: value.trim() };
52418
+ }
52419
+ function isRecord5(value) {
52420
+ return !!value && typeof value === "object" && !Array.isArray(value);
52421
+ }
52422
+ function string(value) {
52423
+ return typeof value === "string" && value.length > 0;
52424
+ }
52425
+ function parseUpdatedProfile(value) {
52426
+ const user = isRecord5(value) && value.user;
52427
+ if (!isRecord5(user) || !string(user.id) || !string(user.email) || !(user.displayName === null || typeof user.displayName === "string") || typeof user.role !== "string" || !["owner", "admin", "member", "viewer"].includes(user.role)) {
52428
+ throw new Error("The server returned an invalid account profile.");
52429
+ }
52430
+ return { user: { id: user.id, email: user.email, displayName: user.displayName, role: user.role } };
52431
+ }
52432
+ function parseUpdatedWorkspace(value) {
52433
+ const organization = isRecord5(value) && value.organization;
52434
+ if (!isRecord5(organization) || !string(organization.id) || !string(organization.slug) || !string(organization.name)) {
52435
+ throw new Error("The server returned an invalid workspace.");
52436
+ }
52437
+ return { organization: { id: organization.id, slug: organization.slug, name: organization.name } };
52438
+ }
52439
+
51789
52440
  // src/lib/remote-client.ts
51790
52441
  class RemoteRouteUnsupportedError extends Error {
51791
52442
  path;
@@ -51803,14 +52454,33 @@ class RemoteRouteUnsupportedError extends Error {
51803
52454
  class RemoteRequestError extends Error {
51804
52455
  path;
51805
52456
  status;
51806
- constructor(path, status, statusText) {
51807
- super(`Remote request to ${path} failed: HTTP ${status}${statusText ? ` ${statusText}` : ""}`);
52457
+ constructor(path, status, _statusText) {
52458
+ super(`Remote request to ${path} failed: HTTP ${status}`);
51808
52459
  this.path = path;
51809
52460
  this.status = status;
51810
52461
  this.name = "RemoteRequestError";
51811
52462
  }
51812
52463
  }
51813
52464
 
52465
+ class RemoteWorkspaceMemberError extends RemoteRequestError {
52466
+ code;
52467
+ constructor(path, code) {
52468
+ super(path, workspaceMemberFailures[code][0]);
52469
+ this.code = code;
52470
+ this.name = "RemoteWorkspaceMemberError";
52471
+ this.message = workspaceMemberFailures[code][1];
52472
+ }
52473
+ }
52474
+
52475
+ class RemoteCapabilityUnavailableError extends RemoteRequestError {
52476
+ code = "SUBSCRIPTION_CHECKOUT_UNAVAILABLE";
52477
+ constructor() {
52478
+ super("/api/v1/billing/checkout", 503);
52479
+ this.name = "RemoteCapabilityUnavailableError";
52480
+ this.message = "Subscription checkout is unavailable on the configured Skills server. " + "Use skills credits packs to view credit packs, or skills billing portal to manage an existing subscription.";
52481
+ }
52482
+ }
52483
+
51814
52484
  class RemoteSkillsClient {
51815
52485
  apiUrl;
51816
52486
  apiKey;
@@ -51838,9 +52508,14 @@ class RemoteSkillsClient {
51838
52508
  if (response.status === 404 && opts.domainNotFoundCodes?.length && await responseBodyCarriesCode(response, opts.domainNotFoundCodes)) {
51839
52509
  return response;
51840
52510
  }
52511
+ response.body?.cancel().catch(() => {});
51841
52512
  throw new RemoteRouteUnsupportedError(routePath, response.status, this.apiUrl);
51842
52513
  }
51843
52514
  if (!response.ok) {
52515
+ if (path === "/api/v1/billing/checkout" && options?.method === "POST" && response.status === 503 && await responseBodyCarriesCode(response, ["SUBSCRIPTION_CHECKOUT_UNAVAILABLE"])) {
52516
+ throw new RemoteCapabilityUnavailableError;
52517
+ }
52518
+ response.body?.cancel().catch(() => {});
51844
52519
  throw new RemoteRequestError(routePath, response.status, response.statusText);
51845
52520
  }
51846
52521
  return response;
@@ -51924,6 +52599,58 @@ class RemoteSkillsClient {
51924
52599
  async getIdentity() {
51925
52600
  return (await this.requestNewRoute("/api/auth/whoami")).json();
51926
52601
  }
52602
+ async updateProfile(input) {
52603
+ const body = customerNamePatch(input, "displayName");
52604
+ return parseUpdatedProfile(await (await this.requestNewRoute("/api/v1/account/profile", { method: "PATCH", body: JSON.stringify(body) })).json());
52605
+ }
52606
+ async updateCurrentWorkspace(input) {
52607
+ const body = customerNamePatch(input, "name");
52608
+ return parseUpdatedWorkspace(await (await this.requestNewRoute("/api/v1/workspaces/current", { method: "PATCH", body: JSON.stringify(body) })).json());
52609
+ }
52610
+ async listWorkspaceMembers(options = {}) {
52611
+ const query = workspaceMembersQuery(options);
52612
+ const requestedCursor = options.cursor;
52613
+ const response = await this.requestNewRoute(`/api/v1/workspace/members${query}`);
52614
+ let value;
52615
+ try {
52616
+ value = await response.json();
52617
+ } catch {
52618
+ throw new Error("The server returned an invalid workspace roster.");
52619
+ }
52620
+ const page = parseWorkspaceMembersPage(value);
52621
+ if (requestedCursor !== undefined && page.nextCursor === requestedCursor)
52622
+ throw new Error("The server returned an invalid workspace roster.");
52623
+ return page;
52624
+ }
52625
+ async setWorkspaceMemberRole(membershipId, input) {
52626
+ const captured = workspaceMemberRoleInput(membershipId, input);
52627
+ const value = await this.requestWorkspaceMember(captured.membershipId, "PATCH", captured.body);
52628
+ return parseWorkspaceMemberRoleResult(value, captured.membershipId, captured.body.role);
52629
+ }
52630
+ async removeWorkspaceMember(membershipId, input) {
52631
+ const captured = workspaceMemberRemovalInput(membershipId, input);
52632
+ return parseWorkspaceMemberRemovalResult(await this.requestWorkspaceMember(captured.membershipId, "DELETE", captured.body), captured.membershipId);
52633
+ }
52634
+ async requestWorkspaceMember(membershipId, method, body) {
52635
+ const path = `/api/v1/workspace/members/${membershipId}`;
52636
+ const response = await this.request(path, { method, body: JSON.stringify(body) });
52637
+ let value;
52638
+ try {
52639
+ value = JSON.parse(new TextDecoder().decode(await readBoundedResponse(response, response.ok ? 64 * 1024 : 4096)));
52640
+ } catch {
52641
+ if (response.ok)
52642
+ throw new Error(invalidMemberResult);
52643
+ }
52644
+ if (!response.ok) {
52645
+ const code = workspaceMemberFailure(value, response.status);
52646
+ if (code)
52647
+ throw new RemoteWorkspaceMemberError(path, code);
52648
+ if (response.status === 404 || response.status === 405)
52649
+ throw new RemoteRouteUnsupportedError(path, response.status, this.apiUrl);
52650
+ throw new RemoteRequestError(path, response.status);
52651
+ }
52652
+ return value;
52653
+ }
51927
52654
  async listApiKeys() {
51928
52655
  return this.arrayResponse("/api/auth/keys");
51929
52656
  }
@@ -52115,8 +52842,10 @@ class RemoteSkillsClient {
52115
52842
  return [];
52116
52843
  if (!response.ok)
52117
52844
  throw new Error(`versions request failed: ${response.status}`);
52118
- const body = await response.json();
52119
- return Array.isArray(body.versions) ? body.versions : [];
52845
+ const body = await readSkillVersionPayload(response);
52846
+ if (!isVersionRecord(body) || !Array.isArray(body.versions) || body.slug !== undefined && body.slug !== slug)
52847
+ throw new Error(INVALID_SKILL_VERSION_RESPONSE);
52848
+ return body.versions.map((entry) => normalizeSkillVersion(entry, slug));
52120
52849
  }
52121
52850
  async getSkillVersion(slug, version2) {
52122
52851
  const response = await this.requestNewRoute(`/api/v1/skills/${encodeURIComponent(slug)}/versions/${encodeURIComponent(version2)}`, undefined, { domainNotFoundCodes: ["SKILL_NOT_FOUND", "SKILL_VERSION_NOT_FOUND"] });
@@ -52124,7 +52853,7 @@ class RemoteSkillsClient {
52124
52853
  return null;
52125
52854
  if (!response.ok)
52126
52855
  throw new Error(`version request failed: ${response.status}`);
52127
- return await response.json();
52856
+ return normalizeSkillVersion(await readSkillVersionPayload(response), slug, version2);
52128
52857
  }
52129
52858
  async listPins() {
52130
52859
  const response = await this.requestNewRoute("/api/v1/pins");
@@ -52172,31 +52901,48 @@ class RemoteSkillsClient {
52172
52901
  return normalizeUpdatedSincePage(await response.json());
52173
52902
  }
52174
52903
  }
52175
- function requireOptionalString(record, field) {
52176
- if (record[field] === undefined)
52904
+ function requireOptionalString(record2, field) {
52905
+ if (record2[field] === undefined)
52177
52906
  return;
52178
- if (typeof record[field] !== "string") {
52907
+ if (typeof record2[field] !== "string") {
52179
52908
  throw new Error(`Remote payload did not match the expected contract (${field} must be a string when present)`);
52180
52909
  }
52181
- return record[field];
52910
+ return record2[field];
52911
+ }
52912
+ var INVALID_SKILL_VERSION_RESPONSE = "Remote skill version payload did not match the expected contract.";
52913
+ function isVersionRecord(value) {
52914
+ return value !== null && typeof value === "object" && !Array.isArray(value);
52915
+ }
52916
+ async function readSkillVersionPayload(response) {
52917
+ try {
52918
+ return await response.json();
52919
+ } catch {
52920
+ throw new Error(INVALID_SKILL_VERSION_RESPONSE);
52921
+ }
52922
+ }
52923
+ function normalizeSkillVersion(entry, slug, version2) {
52924
+ if (!isVersionRecord(entry) || typeof entry.slug !== "string" || !entry.slug.trim() || entry.slug !== slug || typeof entry.version !== "string" || !entry.version.trim() || version2 !== undefined && entry.version !== version2 || typeof entry.bundleSha256 !== "string" || !/^[a-f0-9]{64}$/i.test(entry.bundleSha256) || typeof entry.bundleByteSize !== "number" || !Number.isSafeInteger(entry.bundleByteSize) || entry.bundleByteSize < 0 || typeof entry.createdAt !== "string" || !entry.createdAt.trim() || entry.current !== undefined && typeof entry.current !== "boolean" || entry.storageKind !== undefined && typeof entry.storageKind !== "string" || entry.manifest !== undefined && !isVersionRecord(entry.manifest)) {
52925
+ throw new Error(INVALID_SKILL_VERSION_RESPONSE);
52926
+ }
52927
+ return entry;
52182
52928
  }
52183
52929
  function normalizePin(entry) {
52184
52930
  if (!entry || typeof entry !== "object") {
52185
52931
  throw new Error("Remote pin payload did not match the expected contract (expected an object)");
52186
52932
  }
52187
- const record = entry;
52188
- const slug = typeof record.slug === "string" && record.slug.trim() ? record.slug.trim() : undefined;
52933
+ const record2 = entry;
52934
+ const slug = typeof record2.slug === "string" && record2.slug.trim() ? record2.slug.trim() : undefined;
52189
52935
  if (!slug) {
52190
52936
  throw new Error("Remote pin payload did not match the expected contract (missing slug)");
52191
52937
  }
52192
52938
  let metadata;
52193
- if (record.metadata !== undefined) {
52194
- if (!record.metadata || typeof record.metadata !== "object" || Array.isArray(record.metadata)) {
52939
+ if (record2.metadata !== undefined) {
52940
+ if (!record2.metadata || typeof record2.metadata !== "object" || Array.isArray(record2.metadata)) {
52195
52941
  throw new Error("Remote pin payload did not match the expected contract (metadata must be a JSON object when present)");
52196
52942
  }
52197
- metadata = record.metadata;
52943
+ metadata = record2.metadata;
52198
52944
  }
52199
- const pinnedAt = requireOptionalString(record, "pinnedAt");
52945
+ const pinnedAt = requireOptionalString(record2, "pinnedAt");
52200
52946
  return {
52201
52947
  slug,
52202
52948
  ...pinnedAt !== undefined ? { pinnedAt } : {},
@@ -52213,16 +52959,16 @@ function normalizeSkillSummary(entry) {
52213
52959
  if (!entry || typeof entry !== "object") {
52214
52960
  throw new Error("Remote skill payload did not match the expected contract (expected an object)");
52215
52961
  }
52216
- const record = entry;
52217
- const slug = typeof record.slug === "string" && record.slug.trim() ? record.slug.trim() : undefined;
52962
+ const record2 = entry;
52963
+ const slug = typeof record2.slug === "string" && record2.slug.trim() ? record2.slug.trim() : undefined;
52218
52964
  if (!slug) {
52219
52965
  throw new Error("Remote skill payload did not match the expected contract (missing slug)");
52220
52966
  }
52221
52967
  return {
52222
52968
  slug,
52223
- ...requireOptionalString(record, "name") !== undefined ? { name: requireOptionalString(record, "name") } : {},
52224
- ...requireOptionalString(record, "version") !== undefined ? { version: requireOptionalString(record, "version") } : {},
52225
- ...requireOptionalString(record, "updatedAt") !== undefined ? { updatedAt: requireOptionalString(record, "updatedAt") } : {}
52969
+ ...requireOptionalString(record2, "name") !== undefined ? { name: requireOptionalString(record2, "name") } : {},
52970
+ ...requireOptionalString(record2, "version") !== undefined ? { version: requireOptionalString(record2, "version") } : {},
52971
+ ...requireOptionalString(record2, "updatedAt") !== undefined ? { updatedAt: requireOptionalString(record2, "updatedAt") } : {}
52226
52972
  };
52227
52973
  }
52228
52974
  function normalizeSkillSummaryList(payload) {
@@ -52232,26 +52978,55 @@ function normalizeSkillSummaryList(payload) {
52232
52978
  return payload.map(normalizeSkillSummary);
52233
52979
  }
52234
52980
  async function responseBodyCarriesCode(response, codes) {
52981
+ const reader = response.body?.getReader();
52982
+ if (!reader)
52983
+ return false;
52984
+ const maximum = 8 * 1024;
52985
+ let deadline;
52986
+ const expired = new Promise((_, reject) => {
52987
+ deadline = setTimeout(() => reject(new Error("Error response read deadline exceeded")), 1000);
52988
+ });
52235
52989
  try {
52236
- const payload = await response.clone().json();
52237
- if (!payload || typeof payload !== "object")
52990
+ const chunks = [];
52991
+ let size = 0;
52992
+ while (true) {
52993
+ const next = await Promise.race([reader.read(), expired]);
52994
+ if (next.done)
52995
+ break;
52996
+ size += next.value.byteLength;
52997
+ if (size > maximum)
52998
+ return false;
52999
+ chunks.push(next.value);
53000
+ }
53001
+ const bytes = new Uint8Array(size);
53002
+ let offset = 0;
53003
+ for (const chunk of chunks) {
53004
+ bytes.set(chunk, offset);
53005
+ offset += chunk.byteLength;
53006
+ }
53007
+ const payload = JSON.parse(new TextDecoder("utf-8", { fatal: true }).decode(bytes));
53008
+ if (!payload || typeof payload !== "object" || Array.isArray(payload) || !Object.hasOwn(payload, "code"))
52238
53009
  return false;
52239
53010
  const code = payload.code;
52240
53011
  return typeof code === "string" && codes.includes(code);
52241
53012
  } catch {
52242
53013
  return false;
53014
+ } finally {
53015
+ clearTimeout(deadline);
53016
+ reader.cancel().catch(() => {});
53017
+ reader.releaseLock();
52243
53018
  }
52244
53019
  }
52245
53020
  function normalizeUpdatedSincePage(payload) {
52246
53021
  if (!payload || typeof payload !== "object") {
52247
53022
  throw new Error("Updated-since payload did not match the expected contract (expected an object)");
52248
53023
  }
52249
- const record = payload;
52250
- if (!Array.isArray(record.skills)) {
53024
+ const record2 = payload;
53025
+ if (!Array.isArray(record2.skills)) {
52251
53026
  throw new Error("Updated-since payload did not match the expected contract (missing skills array)");
52252
53027
  }
52253
- const skills = record.skills.map(normalizeSkillSummary);
52254
- const nextCursor = record.nextCursor === undefined || record.nextCursor === null ? null : record.nextCursor;
53028
+ const skills = record2.skills.map(normalizeSkillSummary);
53029
+ const nextCursor = record2.nextCursor === undefined || record2.nextCursor === null ? null : record2.nextCursor;
52255
53030
  if (nextCursor !== null && typeof nextCursor !== "string") {
52256
53031
  throw new Error("Updated-since payload did not match the expected contract (nextCursor must be a string or absent)");
52257
53032
  }
@@ -52301,10 +53076,10 @@ async function requestAuthApi(instance, path, options) {
52301
53076
  const text = await res.text();
52302
53077
  const body = text ? parseJsonBody(text) : {};
52303
53078
  if (!res.ok) {
52304
- const record = isRecord5(body) ? body : {};
52305
- const detail = typeof record.detail === "string" ? record.detail : undefined;
52306
- const error = typeof record.error === "string" ? record.error : undefined;
52307
- const code = typeof record.code === "string" ? record.code : undefined;
53079
+ const record2 = isRecord6(body) ? body : {};
53080
+ const detail = typeof record2.detail === "string" ? record2.detail : undefined;
53081
+ const error = typeof record2.error === "string" ? record2.error : undefined;
53082
+ const code = typeof record2.code === "string" ? record2.code : undefined;
52308
53083
  throw new HostedApiError(detail || error || `${res.status} ${res.statusText}`, {
52309
53084
  status: res.status,
52310
53085
  code,
@@ -52329,7 +53104,7 @@ function condenseErrorBody(text) {
52329
53104
  return collapsed;
52330
53105
  return `${collapsed.slice(0, MAX_ERROR_DETAIL_LENGTH - 1).trimEnd()}\u2026`;
52331
53106
  }
52332
- function isRecord5(value) {
53107
+ function isRecord6(value) {
52333
53108
  return Boolean(value && typeof value === "object" && !Array.isArray(value));
52334
53109
  }
52335
53110
 
@@ -52351,12 +53126,13 @@ class RemoteSkillsAuthClient {
52351
53126
  return this.request("/api/auth/device/token", { method: "POST", body: JSON.stringify({ deviceCode }) });
52352
53127
  }
52353
53128
  async sessionClient(email, code) {
53129
+ const apiOrigin = this.apiOrigin;
52354
53130
  if (!email.includes("@") || !/^\d{6}$/.test(code))
52355
- throw new Error("Fresh email and six-digit verification code are required to manage API keys");
53131
+ throw new Error("Fresh email and six-digit verification code are required to manage this account");
52356
53132
  const login = await this.verifyCode(email, code);
52357
53133
  if (!login || typeof login.token !== "string" || !login.token)
52358
53134
  throw new Error("The server did not return an authorized account session");
52359
- return new RemoteSkillsClient(login.token, this.apiOrigin);
53135
+ return new RemoteSkillsClient(login.token, apiOrigin);
52360
53136
  }
52361
53137
  async createApiKey(email, code, name, scopes) {
52362
53138
  return (await this.sessionClient(email, code)).createApiKey(name, scopes);
@@ -52367,6 +53143,26 @@ class RemoteSkillsAuthClient {
52367
53143
  async revokeApiKey(email, code, keyId) {
52368
53144
  return (await this.sessionClient(email, code)).revokeApiKey(keyId);
52369
53145
  }
53146
+ async updateProfile(email, code, input) {
53147
+ customerNamePatch(input, "displayName");
53148
+ return (await this.sessionClient(email, code)).updateProfile(input);
53149
+ }
53150
+ async updateCurrentWorkspace(email, code, input) {
53151
+ customerNamePatch(input, "name");
53152
+ return (await this.sessionClient(email, code)).updateCurrentWorkspace(input);
53153
+ }
53154
+ async listWorkspaceMembers(email, code, options = {}) {
53155
+ workspaceMembersQuery(options);
53156
+ return (await this.sessionClient(email, code)).listWorkspaceMembers(options);
53157
+ }
53158
+ async setWorkspaceMemberRole(email, code, membershipId, input) {
53159
+ const captured = workspaceMemberRoleInput(membershipId, input);
53160
+ return (await this.sessionClient(email, code)).setWorkspaceMemberRole(captured.membershipId, captured.body);
53161
+ }
53162
+ async removeWorkspaceMember(email, code, membershipId, input) {
53163
+ const captured = workspaceMemberRemovalInput(membershipId, input);
53164
+ return (await this.sessionClient(email, code)).removeWorkspaceMember(captured.membershipId, captured.body);
53165
+ }
52370
53166
  request(path, options) {
52371
53167
  if (!["/api/auth/login", "/api/auth/verify", "/api/auth/device/start", "/api/auth/device/token", "/api/auth/keys", "/api/auth/whoami"].includes(path))
52372
53168
  throw new Error("Unsupported authentication operation");
@@ -52382,6 +53178,7 @@ export {
52382
53178
  skillsCredentialFiles,
52383
53179
  skillsCredentialFilePath,
52384
53180
  settleRun,
53181
+ selectsSkillsLocalMode,
52385
53182
  runTerminalSchema,
52386
53183
  runProtocolSchema,
52387
53184
  runPointersOf,
@@ -52409,6 +53206,7 @@ export {
52409
53206
  leaseGenerationOf,
52410
53207
  isValidSkillSlug,
52411
53208
  isTerminalStatus,
53209
+ isSkillsLocalOptIn,
52412
53210
  isActiveStatus,
52413
53211
  getServerSkillMd,
52414
53212
  getServerSkill,
@@ -52448,14 +53246,17 @@ export {
52448
53246
  SqliteRunExecutionStore,
52449
53247
  SqliteGovernanceStore,
52450
53248
  SkillsFleetCredentialError,
53249
+ SKILLS_LOCAL_OPT_IN_ENV_KEYS,
52451
53250
  SKILLS_APP,
52452
53251
  SKILLS_API_URL_ENV,
52453
53252
  SKILLS_API_KEY_ENV,
53253
+ RemoteWorkspaceMemberError,
52454
53254
  RemoteSkillsClient,
52455
53255
  RemoteSkillsAuthClient,
52456
53256
  RemoteRouteUnsupportedError,
52457
53257
  RemoteRequestError,
52458
53258
  RemoteCreditApprovalError,
53259
+ RemoteCapabilityUnavailableError,
52459
53260
  RUN_PROTOCOL_VERSION,
52460
53261
  RUN_PROTOCOL_STATES,
52461
53262
  RUN_LIFECYCLE_EVENT_TYPES,