@hasna/skills 0.4.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +220 -5
- package/bin/index.js +7747 -5645
- package/bin/mcp.js +1493 -431
- package/bin/migrate.js +148 -40
- package/bin/server.js +53 -83
- package/bin/worker.js +41 -73
- package/dist/admin-contract.d.ts +37 -19
- package/dist/admin-contract.js +1 -1
- package/dist/cli/cli.test-utils.d.ts +10 -8
- package/dist/cli/commands/customer-profile.d.ts +2 -0
- package/dist/cli/commands/customer-verification.d.ts +5 -0
- package/dist/cli/commands/tool-primitives.d.ts +1 -1
- package/dist/cli/commands/workspace-member-mutations.d.ts +2 -0
- package/dist/cli/commands/workspace-members.d.ts +2 -0
- package/dist/cli/commands/workspace-selection.d.ts +11 -0
- package/dist/cli/env-assignment.d.ts +9 -0
- package/dist/index.d.ts +8 -2
- package/dist/index.js +841 -167
- package/dist/lib/agent-sync.d.ts +13 -8
- package/dist/lib/api-url.d.ts +4 -3
- package/dist/lib/app-home.d.ts +0 -1
- package/dist/lib/client-types.d.ts +75 -0
- package/dist/lib/credential-state.d.ts +12 -0
- package/dist/lib/fleet-credentials.d.ts +41 -15
- package/dist/lib/home-adoption.d.ts +2 -0
- package/dist/lib/home-census.d.ts +3 -1
- package/dist/lib/local-opt-in.d.ts +24 -0
- package/dist/lib/portable-skills-files.d.ts +6 -2
- package/dist/lib/read-access.d.ts +83 -0
- package/dist/lib/remote-auth.d.ts +23 -3
- package/dist/lib/remote-client.d.ts +45 -5
- package/dist/lib/remote-profile.d.ts +26 -0
- package/dist/lib/remote-registry.d.ts +7 -3
- package/dist/lib/remote-workspace-selection.d.ts +58 -0
- package/dist/lib/remote-workspace.d.ts +76 -0
- package/dist/lib/skillinfo.d.ts +1 -1
- package/dist/lib/workspace-profile.d.ts +49 -0
- package/dist/mcp/helpers.d.ts +22 -0
- package/dist/mcp/index.d.ts +16 -0
- package/dist/sdk/governance-store.d.ts +1 -0
- package/dist/sdk/index.d.ts +8 -2
- package/dist/sdk/index.js +1312 -297
- package/dist/sdk/outputs.d.ts +0 -11
- package/dist/sdk/runs.d.ts +1 -1
- package/dist/storage.js +6 -40
- package/docs/skill-standard.md +30 -2
- package/package.json +6 -4
- 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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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) =>
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
20532
|
+
import_client10.setCredentialFeature(credentials, "CREDENTIALS_SSO", "s");
|
|
20533
20533
|
} else {
|
|
20534
|
-
|
|
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
|
-
|
|
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
|
|
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) =>
|
|
20676
|
+
}, setNamedProvider = (creds) => import_client11.setCredentialFeature(creds, "CREDENTIALS_PROFILE_NAMED_PROVIDER", "p");
|
|
20677
20677
|
var init_resolveCredentialSource = __esm(() => {
|
|
20678
|
-
|
|
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
|
|
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) =>
|
|
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) =>
|
|
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
|
-
|
|
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
|
|
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
|
|
22784
|
+
return import_client13.setCredentialFeature(credentials, "CREDENTIALS_LOGIN", "AD");
|
|
22785
22785
|
};
|
|
22786
22786
|
var init_fromLoginCredentials = __esm(() => {
|
|
22787
22787
|
init_LoginCredentialsFetcher();
|
|
22788
|
-
|
|
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
|
|
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
|
|
22810
|
+
return import_client14.setCredentialFeature(credentials, "CREDENTIALS_PROFILE_LOGIN", "AC");
|
|
22811
22811
|
};
|
|
22812
22812
|
var init_resolveLoginCredentials = __esm(() => {
|
|
22813
|
-
|
|
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
|
|
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
|
-
|
|
22843
|
+
import_client15.setCredentialFeature(credentials, "CREDENTIALS_PROCESS", "w");
|
|
22844
22844
|
return credentials;
|
|
22845
22845
|
};
|
|
22846
22846
|
var init_getValidatedProcessCredentials = __esm(() => {
|
|
22847
|
-
|
|
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
|
|
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
|
|
22914
|
+
return import_client16.setCredentialFeature(credentials, "CREDENTIALS_PROFILE_PROCESS", "v");
|
|
22915
22915
|
};
|
|
22916
22916
|
var init_resolveProcessCredentials2 = __esm(() => {
|
|
22917
|
-
|
|
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
|
|
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
|
|
22932
|
+
return import_client17.setCredentialFeature(creds, "CREDENTIALS_PROFILE_SSO", "r");
|
|
22933
22933
|
} else {
|
|
22934
|
-
return
|
|
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
|
-
|
|
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
|
|
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
|
|
22952
|
+
return import_client18.setCredentialFeature(credentials, "CREDENTIALS_PROFILE", "n");
|
|
22953
22953
|
};
|
|
22954
22954
|
var init_resolveStaticCredentials = __esm(() => {
|
|
22955
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
|
23036
|
+
return import_client20.setCredentialFeature(credentials, "CREDENTIALS_PROFILE_STS_WEB_ID_TOKEN", "q");
|
|
23037
23037
|
};
|
|
23038
23038
|
var init_resolveWebIdentityCredentials = __esm(() => {
|
|
23039
|
-
|
|
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
|
-
//
|
|
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 ||
|
|
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(
|
|
23216
|
-
this.dataDir =
|
|
23217
|
-
this.runtime = localJsonRuntime(
|
|
23218
|
-
this.channelsPath =
|
|
23219
|
-
this.eventsPath =
|
|
23220
|
-
this.deliveriesPath =
|
|
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 (!
|
|
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(
|
|
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 ${
|
|
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)(
|
|
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((
|
|
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
|
-
|
|
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
|
-
|
|
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,
|
|
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
|
|
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
|
-
|
|
24871
|
-
|
|
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
|
|
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
|
-
|
|
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.
|
|
25465
|
+
version: "0.5.1",
|
|
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/
|
|
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.
|
|
25893
|
-
var
|
|
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.
|
|
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
|
|
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.
|
|
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
|
|
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.
|
|
26517
|
-
var
|
|
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.
|
|
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.
|
|
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 =
|
|
28973
|
+
import_endpoints2.customEndpointFunctions.aws = import_client4.awsEndpointFunctions;
|
|
28491
28974
|
|
|
28492
|
-
// ../../node_modules/.bun/@aws-sdk+client-s3@3.
|
|
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 =
|
|
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:
|
|
28508
|
-
region: await
|
|
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:
|
|
29087
|
+
authSchemePreference: import_client5.normalizeProvider(config.authSchemePreference ?? [])
|
|
28605
29088
|
});
|
|
28606
29089
|
};
|
|
28607
29090
|
|
|
28608
|
-
// ../../node_modules/.bun/@aws-sdk+client-s3@3.
|
|
28609
|
-
var
|
|
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.
|
|
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.
|
|
28639
|
-
var command =
|
|
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.
|
|
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.
|
|
28674
|
-
var
|
|
28675
|
-
class S3ServiceException extends
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
34501
|
-
var
|
|
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.
|
|
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
|
|
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.
|
|
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
|
|
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
|
|
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.
|
|
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
|
-
|
|
35432
|
+
import_client23.emitWarningIfUnsupportedVersion(process.version);
|
|
34950
35433
|
const defaultsMode = import_config28.resolveDefaultsModeConfig(config);
|
|
34951
|
-
const defaultConfigProvider = () => defaultsMode().then(
|
|
35434
|
+
const defaultConfigProvider = () => defaultsMode().then(import_client23.loadConfigsForDefaultMode);
|
|
34952
35435
|
const clientSharedValues = getRuntimeConfig2(config);
|
|
34953
|
-
|
|
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 ??
|
|
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(
|
|
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.
|
|
34989
|
-
var
|
|
34990
|
-
var
|
|
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.
|
|
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.
|
|
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(
|
|
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,
|
|
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.
|
|
35040
|
-
class S3Client extends
|
|
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 =
|
|
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 =
|
|
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(
|
|
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(
|
|
35063
|
-
this.middlewareStack.use(
|
|
35064
|
-
this.middlewareStack.use(
|
|
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.
|
|
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.
|
|
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.
|
|
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
|
|
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
|
|
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[
|
|
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
|
-
|
|
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
|
|
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(
|
|
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
|
|
36886
|
-
|
|
36887
|
-
|
|
36888
|
-
|
|
36889
|
-
this.db.
|
|
36890
|
-
|
|
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 =
|
|
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 =
|
|
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 =
|
|
39785
|
+
const inferred = readPortableSkillManifestForImport(absoluteSource);
|
|
39289
39786
|
const explicitName = options.name != null;
|
|
39290
|
-
const skillName =
|
|
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 =
|
|
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 (!
|
|
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 (!
|
|
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.
|
|
47890
|
-
var
|
|
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
|
|
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.
|
|
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
|
|
48412
|
+
var import_client28 = __toESM(require_client(), 1);
|
|
47902
48413
|
var defaultECSHttpAuthSchemeParametersProvider = async (config, context, input) => {
|
|
47903
48414
|
return {
|
|
47904
|
-
operation:
|
|
47905
|
-
region: await
|
|
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:
|
|
48448
|
+
authSchemePreference: import_client28.normalizeProvider(config.authSchemePreference ?? [])
|
|
47938
48449
|
});
|
|
47939
48450
|
};
|
|
47940
48451
|
|
|
47941
|
-
// ../../node_modules/.bun/@aws-sdk+client-ecs@3.
|
|
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.
|
|
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.
|
|
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.
|
|
48029
|
-
var
|
|
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
|
|
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.
|
|
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
|
|
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.
|
|
48046
|
-
var
|
|
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.
|
|
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.
|
|
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 =
|
|
48654
|
+
import_endpoints7.customEndpointFunctions.aws = import_client29.awsEndpointFunctions;
|
|
48144
48655
|
|
|
48145
|
-
// ../../node_modules/.bun/@aws-sdk+client-ecs@3.
|
|
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.
|
|
48149
|
-
var
|
|
48150
|
-
class ECSServiceException extends
|
|
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.
|
|
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.
|
|
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.
|
|
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
|
|
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.
|
|
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
|
-
|
|
51484
|
+
import_client33.emitWarningIfUnsupportedVersion(process.version);
|
|
50974
51485
|
const defaultsMode = import_config38.resolveDefaultsModeConfig(config);
|
|
50975
|
-
const defaultConfigProvider = () => defaultsMode().then(
|
|
51486
|
+
const defaultConfigProvider = () => defaultsMode().then(import_client33.loadConfigsForDefaultMode);
|
|
50976
51487
|
const clientSharedValues = getRuntimeConfig4(config);
|
|
50977
|
-
|
|
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 ??
|
|
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(
|
|
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.
|
|
51006
|
-
var
|
|
51007
|
-
var
|
|
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.
|
|
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.
|
|
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(
|
|
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,
|
|
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.
|
|
51057
|
-
class ECSClient extends
|
|
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 =
|
|
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 =
|
|
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(
|
|
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(
|
|
51077
|
-
this.middlewareStack.use(
|
|
51078
|
-
this.middlewareStack.use(
|
|
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.
|
|
51093
|
-
var
|
|
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 =
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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
|
|
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,202 @@ function createOfflineGate(options) {
|
|
|
51646
52164
|
}
|
|
51647
52165
|
};
|
|
51648
52166
|
}
|
|
52167
|
+
// src/lib/remote-workspace-selection.ts
|
|
52168
|
+
var record = (v2) => !!v2 && typeof v2 === "object" && !Array.isArray(v2);
|
|
52169
|
+
var uuid = (v2) => typeof v2 === "string" && /^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/.test(v2);
|
|
52170
|
+
var text = (v2, max = 1024) => typeof v2 === "string" && !!v2.trim() && v2.length <= max && !/[\p{Cc}\p{Cs}\u2028\u2029]/u.test(v2);
|
|
52171
|
+
var role = (v2) => typeof v2 === "string" && ["owner", "admin", "member", "viewer"].includes(v2);
|
|
52172
|
+
var invalidWorkspaceResult = "The server returned an invalid workspace selection result.";
|
|
52173
|
+
|
|
52174
|
+
class WorkspaceContextInputError extends Error {
|
|
52175
|
+
constructor() {
|
|
52176
|
+
super("Provide the observed user ID and exact lowercase membership ID.");
|
|
52177
|
+
this.name = "WorkspaceContextInputError";
|
|
52178
|
+
}
|
|
52179
|
+
}
|
|
52180
|
+
|
|
52181
|
+
class WorkspaceIdentityMismatchError extends Error {
|
|
52182
|
+
constructor() {
|
|
52183
|
+
super("The verified account does not match the requested workspace context.");
|
|
52184
|
+
this.name = "WorkspaceIdentityMismatchError";
|
|
52185
|
+
}
|
|
52186
|
+
}
|
|
52187
|
+
function workspaceExpectedUserId(value) {
|
|
52188
|
+
if (!uuid(value))
|
|
52189
|
+
throw new WorkspaceContextInputError;
|
|
52190
|
+
return value;
|
|
52191
|
+
}
|
|
52192
|
+
function workspaceContext(value) {
|
|
52193
|
+
if (!record(value) || Object.keys(value).sort().join(",") !== "membershipId,userId" || !uuid(value.userId) || !uuid(value.membershipId))
|
|
52194
|
+
throw new WorkspaceContextInputError;
|
|
52195
|
+
return { userId: value.userId, membershipId: value.membershipId };
|
|
52196
|
+
}
|
|
52197
|
+
function invalid() {
|
|
52198
|
+
throw new Error(invalidWorkspaceResult);
|
|
52199
|
+
}
|
|
52200
|
+
function organization(v2) {
|
|
52201
|
+
if (!record(v2) || !uuid(v2.id) || !text(v2.slug) || !text(v2.name))
|
|
52202
|
+
return invalid();
|
|
52203
|
+
return { id: v2.id, slug: v2.slug, name: v2.name };
|
|
52204
|
+
}
|
|
52205
|
+
function parseAccountWorkspaces(value) {
|
|
52206
|
+
if (!record(value) || !Array.isArray(value.workspaces) || !value.workspaces.length || value.workspaces.length > 1000)
|
|
52207
|
+
return invalid();
|
|
52208
|
+
const workspaces = value.workspaces.map((v2) => {
|
|
52209
|
+
if (!record(v2) || !uuid(v2.membershipId) || !role(v2.role) || typeof v2.current !== "boolean")
|
|
52210
|
+
return invalid();
|
|
52211
|
+
return { membershipId: v2.membershipId, organization: organization(v2.organization), role: v2.role, current: v2.current };
|
|
52212
|
+
});
|
|
52213
|
+
if (workspaces.filter((w2) => w2.current).length !== 1 || new Set(workspaces.map((w2) => w2.membershipId)).size !== workspaces.length || new Set(workspaces.map((w2) => w2.organization.id)).size !== workspaces.length)
|
|
52214
|
+
return invalid();
|
|
52215
|
+
return { workspaces };
|
|
52216
|
+
}
|
|
52217
|
+
function parseWorkspaceIdentity(value, expectedUserId) {
|
|
52218
|
+
if (!record(value))
|
|
52219
|
+
return invalid();
|
|
52220
|
+
const user = value.user;
|
|
52221
|
+
if (!record(user) || !uuid(user.id) || !uuid(user.membershipId) || !text(user.email, 320) || !(user.displayName === null || text(user.displayName)) || !role(user.role))
|
|
52222
|
+
return invalid();
|
|
52223
|
+
if (user.id !== expectedUserId)
|
|
52224
|
+
throw new WorkspaceIdentityMismatchError;
|
|
52225
|
+
return { user: { id: user.id, membershipId: user.membershipId, email: user.email, displayName: user.displayName, role: user.role }, organization: organization(value.organization) };
|
|
52226
|
+
}
|
|
52227
|
+
function sessionToken(value) {
|
|
52228
|
+
if (typeof value !== "string" || !value || value.length > 8192 || /[^\x21-\x7e]/.test(value) || value.startsWith("sk_"))
|
|
52229
|
+
return invalid();
|
|
52230
|
+
return value;
|
|
52231
|
+
}
|
|
52232
|
+
function parseWorkspaceSession(value, expected) {
|
|
52233
|
+
const identity = parseWorkspaceIdentity(value, expected.userId);
|
|
52234
|
+
if (identity.user.membershipId !== expected.membershipId)
|
|
52235
|
+
throw new WorkspaceIdentityMismatchError;
|
|
52236
|
+
return { token: sessionToken(value.token), ...identity };
|
|
52237
|
+
}
|
|
52238
|
+
function parseWorkspaceLogin(value, expectedUserId) {
|
|
52239
|
+
const user = record(value) && value.user;
|
|
52240
|
+
if (!record(value) || !record(user) || !uuid(user.id))
|
|
52241
|
+
return invalid();
|
|
52242
|
+
if (expectedUserId !== undefined && user.id !== expectedUserId)
|
|
52243
|
+
throw new WorkspaceIdentityMismatchError;
|
|
52244
|
+
return { token: sessionToken(value.token), userId: user.id };
|
|
52245
|
+
}
|
|
52246
|
+
var workspaceSelectionFailures = {
|
|
52247
|
+
INVALID_WORKSPACE_SELECTION: [400, "Provide only the exact membership ID from your workspace list."],
|
|
52248
|
+
SESSION_EXPIRED: [401, "Sign in again before selecting a workspace."],
|
|
52249
|
+
ACCOUNT_UNAVAILABLE: [403, "Account is unavailable."],
|
|
52250
|
+
INTERACTIVE_SESSION_REQUIRED: [403, "Interactive sign-in is required to select a workspace."],
|
|
52251
|
+
WORKSPACE_UNAVAILABLE: [404, "Workspace is unavailable. Refresh your workspace list."],
|
|
52252
|
+
WORKSPACE_BUSY: [503, "Workspace is busy. Refresh before retrying."]
|
|
52253
|
+
};
|
|
52254
|
+
function workspaceSelectionFailure(value, status) {
|
|
52255
|
+
if (!record(value) || typeof value.code !== "string" || !Object.hasOwn(workspaceSelectionFailures, value.code))
|
|
52256
|
+
return null;
|
|
52257
|
+
const code = value.code;
|
|
52258
|
+
return workspaceSelectionFailures[code][0] === status ? code : null;
|
|
52259
|
+
}
|
|
52260
|
+
|
|
52261
|
+
// src/lib/remote-workspace.ts
|
|
52262
|
+
var record2 = (value) => !!value && typeof value === "object" && !Array.isArray(value);
|
|
52263
|
+
var cursor = (value) => typeof value === "string" && /^[A-Za-z0-9_-]{1,512}$/.test(value);
|
|
52264
|
+
var uuid2 = (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);
|
|
52265
|
+
function workspaceMembersQuery(options = {}) {
|
|
52266
|
+
if (!record2(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))
|
|
52267
|
+
throw new Error("Use a roster limit from 1 to 100 and an unchanged continuation cursor.");
|
|
52268
|
+
const query = new URLSearchParams;
|
|
52269
|
+
if (options.limit !== undefined)
|
|
52270
|
+
query.set("limit", String(options.limit));
|
|
52271
|
+
if (options.cursor !== undefined)
|
|
52272
|
+
query.set("cursor", options.cursor);
|
|
52273
|
+
return query.size ? `?${query}` : "";
|
|
52274
|
+
}
|
|
52275
|
+
function timestamp(value) {
|
|
52276
|
+
if (typeof value !== "string" || !/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{6}Z$/.test(value))
|
|
52277
|
+
return false;
|
|
52278
|
+
const time = Date.parse(value);
|
|
52279
|
+
return Number.isFinite(time) && new Date(time).toISOString().slice(0, 23) === value.slice(0, 23);
|
|
52280
|
+
}
|
|
52281
|
+
function parseMember(row, fail) {
|
|
52282
|
+
if (!record2(row) || !uuid2(row.membershipId) || !uuid2(row.userId) || typeof row.email !== "string" || !row.email || !(row.displayName === null || typeof row.displayName === "string") || !isRole(row.role) || !timestamp(row.createdAt))
|
|
52283
|
+
return fail();
|
|
52284
|
+
return {
|
|
52285
|
+
membershipId: row.membershipId,
|
|
52286
|
+
userId: row.userId,
|
|
52287
|
+
email: row.email,
|
|
52288
|
+
displayName: row.displayName,
|
|
52289
|
+
role: row.role,
|
|
52290
|
+
createdAt: row.createdAt
|
|
52291
|
+
};
|
|
52292
|
+
}
|
|
52293
|
+
var isRole = (value) => typeof value === "string" && ["owner", "admin", "member", "viewer"].includes(value);
|
|
52294
|
+
|
|
52295
|
+
class WorkspaceMemberInputError extends Error {
|
|
52296
|
+
constructor() {
|
|
52297
|
+
super("Use an unchanged lowercase membership ID and the exact role and expected-role parameters from the roster.");
|
|
52298
|
+
this.name = "WorkspaceMemberInputError";
|
|
52299
|
+
}
|
|
52300
|
+
}
|
|
52301
|
+
function mutationInput(membershipId, input, roleChange) {
|
|
52302
|
+
if (typeof membershipId !== "string" || !uuid2(membershipId) || membershipId !== membershipId.toLowerCase() || !record2(input) || Object.keys(input).sort().join(",") !== (roleChange ? "expectedRole,role" : "expectedRole"))
|
|
52303
|
+
throw new WorkspaceMemberInputError;
|
|
52304
|
+
const expectedRole = input.expectedRole, role2 = roleChange ? input.role : undefined;
|
|
52305
|
+
if (!isRole(expectedRole) || roleChange && !isRole(role2))
|
|
52306
|
+
throw new WorkspaceMemberInputError;
|
|
52307
|
+
return { membershipId, role: role2, expectedRole };
|
|
52308
|
+
}
|
|
52309
|
+
function workspaceMemberRoleInput(membershipId, input) {
|
|
52310
|
+
const value = mutationInput(membershipId, input, true);
|
|
52311
|
+
return { membershipId: value.membershipId, body: { role: value.role, expectedRole: value.expectedRole } };
|
|
52312
|
+
}
|
|
52313
|
+
function workspaceMemberRemovalInput(membershipId, input) {
|
|
52314
|
+
const value = mutationInput(membershipId, input, false);
|
|
52315
|
+
return { membershipId: value.membershipId, body: { expectedRole: value.expectedRole } };
|
|
52316
|
+
}
|
|
52317
|
+
var invalidMemberResult = "The server returned an invalid workspace member result. Refresh the roster before another action.";
|
|
52318
|
+
function parseWorkspaceMemberRoleResult(value, membershipId, role2) {
|
|
52319
|
+
const fail = () => {
|
|
52320
|
+
throw new Error(invalidMemberResult);
|
|
52321
|
+
};
|
|
52322
|
+
if (!record2(value) || !uuid2(value.organizationId) || typeof value.changed !== "boolean")
|
|
52323
|
+
return fail();
|
|
52324
|
+
const member = parseMember(value.member, fail);
|
|
52325
|
+
if (member.membershipId !== membershipId || member.role !== role2)
|
|
52326
|
+
return fail();
|
|
52327
|
+
return { organizationId: value.organizationId, member, changed: value.changed };
|
|
52328
|
+
}
|
|
52329
|
+
function parseWorkspaceMemberRemovalResult(value, membershipId) {
|
|
52330
|
+
if (!record2(value) || !uuid2(value.organizationId) || value.membershipId !== membershipId || value.removed !== true || typeof value.alreadyRemoved !== "boolean")
|
|
52331
|
+
throw new Error(invalidMemberResult);
|
|
52332
|
+
return { organizationId: value.organizationId, membershipId, removed: true, alreadyRemoved: value.alreadyRemoved };
|
|
52333
|
+
}
|
|
52334
|
+
var workspaceMemberFailures = {
|
|
52335
|
+
INVALID_REQUEST: [400, "Provide the exact membership role parameters."],
|
|
52336
|
+
ACCOUNT_UNAVAILABLE: [403, "Account is unavailable."],
|
|
52337
|
+
INTERACTIVE_SESSION_REQUIRED: [403, "Fresh interactive sign-in is required."],
|
|
52338
|
+
WORKSPACE_ADMIN_REQUIRED: [403, "A current workspace owner or admin is required."],
|
|
52339
|
+
MEMBERSHIP_ACTION_FORBIDDEN: [403, "Your current workspace role cannot perform this membership action."],
|
|
52340
|
+
MEMBERSHIP_NOT_FOUND: [404, "Membership was not found in the current workspace."],
|
|
52341
|
+
SELF_REMOVAL_UNAVAILABLE: [409, "Leaving your own workspace is not available through member removal."],
|
|
52342
|
+
MEMBERSHIP_ROLE_CHANGED: [409, "The member role changed. Refresh the roster before another action."],
|
|
52343
|
+
LAST_OWNER_REQUIRED: [409, "The workspace must retain at least one active owner."],
|
|
52344
|
+
MEMBERSHIP_BUSY: [503, "Membership is busy. Refresh the roster before another action."]
|
|
52345
|
+
};
|
|
52346
|
+
function workspaceMemberFailure(value, status) {
|
|
52347
|
+
if (!record2(value) || typeof value.code !== "string" || !Object.hasOwn(workspaceMemberFailures, value.code))
|
|
52348
|
+
return null;
|
|
52349
|
+
const code = value.code;
|
|
52350
|
+
return workspaceMemberFailures[code][0] === status ? code : null;
|
|
52351
|
+
}
|
|
52352
|
+
function parseWorkspaceMembersPage(value) {
|
|
52353
|
+
const fail = () => {
|
|
52354
|
+
throw new Error("The server returned an invalid workspace roster.");
|
|
52355
|
+
};
|
|
52356
|
+
if (!record2(value) || !uuid2(value.organizationId) || !Array.isArray(value.members) || value.members.length > 100 || !(value.nextCursor === null || cursor(value.nextCursor)) || !value.members.length && value.nextCursor !== null)
|
|
52357
|
+
return fail();
|
|
52358
|
+
const members = value.members.map((row) => parseMember(row, fail));
|
|
52359
|
+
if (new Set(members.map((row) => row.membershipId)).size !== members.length)
|
|
52360
|
+
return fail();
|
|
52361
|
+
return { organizationId: value.organizationId, members, nextCursor: value.nextCursor };
|
|
52362
|
+
}
|
|
51649
52363
|
// src/lib/auth-store.ts
|
|
51650
52364
|
function getApiUrl(action, env = process.env, options = {}) {
|
|
51651
52365
|
return requireSkillsApiOrigin(action, env, options);
|
|
@@ -51728,7 +52442,7 @@ function object(value) {
|
|
|
51728
52442
|
}
|
|
51729
52443
|
|
|
51730
52444
|
// src/lib/remote-files.ts
|
|
51731
|
-
import { createHash as
|
|
52445
|
+
import { createHash as createHash13 } from "crypto";
|
|
51732
52446
|
var MAX_REMOTE_FILE_BYTES = 64 * 1024 * 1024;
|
|
51733
52447
|
function describeRemoteFiles(files) {
|
|
51734
52448
|
if (files.length > 10)
|
|
@@ -51746,7 +52460,7 @@ function describeRemoteFiles(files) {
|
|
|
51746
52460
|
});
|
|
51747
52461
|
}
|
|
51748
52462
|
function sha256(bytes) {
|
|
51749
|
-
return
|
|
52463
|
+
return createHash13("sha256").update(bytes).digest("hex");
|
|
51750
52464
|
}
|
|
51751
52465
|
async function readBoundedResponse(response, maximum) {
|
|
51752
52466
|
if (!Number.isSafeInteger(maximum) || maximum < 0 || maximum > MAX_REMOTE_FILE_BYTES)
|
|
@@ -51786,6 +52500,37 @@ async function readBoundedResponse(response, maximum) {
|
|
|
51786
52500
|
return bytes;
|
|
51787
52501
|
}
|
|
51788
52502
|
|
|
52503
|
+
// src/lib/remote-profile.ts
|
|
52504
|
+
function customerNamePatch(input, field) {
|
|
52505
|
+
if (!isRecord5(input) || Object.keys(input).length !== 1 || !Object.hasOwn(input, field))
|
|
52506
|
+
throw new Error("Provide only the requested name field.");
|
|
52507
|
+
const value = input[field];
|
|
52508
|
+
if (typeof value !== "string" || /[\p{Cc}\p{Cs}\u2028\u2029]/u.test(value) || !value.trim() || [...value.trim()].length > 100) {
|
|
52509
|
+
throw new Error("Use a name of 1\u2013100 characters without control characters or newlines.");
|
|
52510
|
+
}
|
|
52511
|
+
return { [field]: value.trim() };
|
|
52512
|
+
}
|
|
52513
|
+
function isRecord5(value) {
|
|
52514
|
+
return !!value && typeof value === "object" && !Array.isArray(value);
|
|
52515
|
+
}
|
|
52516
|
+
function string(value) {
|
|
52517
|
+
return typeof value === "string" && value.length > 0;
|
|
52518
|
+
}
|
|
52519
|
+
function parseUpdatedProfile(value) {
|
|
52520
|
+
const user = isRecord5(value) && value.user;
|
|
52521
|
+
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)) {
|
|
52522
|
+
throw new Error("The server returned an invalid account profile.");
|
|
52523
|
+
}
|
|
52524
|
+
return { user: { id: user.id, email: user.email, displayName: user.displayName, role: user.role } };
|
|
52525
|
+
}
|
|
52526
|
+
function parseUpdatedWorkspace(value) {
|
|
52527
|
+
const organization2 = isRecord5(value) && value.organization;
|
|
52528
|
+
if (!isRecord5(organization2) || !string(organization2.id) || !string(organization2.slug) || !string(organization2.name)) {
|
|
52529
|
+
throw new Error("The server returned an invalid workspace.");
|
|
52530
|
+
}
|
|
52531
|
+
return { organization: { id: organization2.id, slug: organization2.slug, name: organization2.name } };
|
|
52532
|
+
}
|
|
52533
|
+
|
|
51789
52534
|
// src/lib/remote-client.ts
|
|
51790
52535
|
class RemoteRouteUnsupportedError extends Error {
|
|
51791
52536
|
path;
|
|
@@ -51803,14 +52548,43 @@ class RemoteRouteUnsupportedError extends Error {
|
|
|
51803
52548
|
class RemoteRequestError extends Error {
|
|
51804
52549
|
path;
|
|
51805
52550
|
status;
|
|
51806
|
-
constructor(path, status,
|
|
51807
|
-
super(`Remote request to ${path} failed: HTTP ${status}
|
|
52551
|
+
constructor(path, status, _statusText) {
|
|
52552
|
+
super(`Remote request to ${path} failed: HTTP ${status}`);
|
|
51808
52553
|
this.path = path;
|
|
51809
52554
|
this.status = status;
|
|
51810
52555
|
this.name = "RemoteRequestError";
|
|
51811
52556
|
}
|
|
51812
52557
|
}
|
|
51813
52558
|
|
|
52559
|
+
class RemoteWorkspaceMemberError extends RemoteRequestError {
|
|
52560
|
+
code;
|
|
52561
|
+
constructor(path, code) {
|
|
52562
|
+
super(path, workspaceMemberFailures[code][0]);
|
|
52563
|
+
this.code = code;
|
|
52564
|
+
this.name = "RemoteWorkspaceMemberError";
|
|
52565
|
+
this.message = workspaceMemberFailures[code][1];
|
|
52566
|
+
}
|
|
52567
|
+
}
|
|
52568
|
+
|
|
52569
|
+
class RemoteWorkspaceSelectionError extends RemoteRequestError {
|
|
52570
|
+
code;
|
|
52571
|
+
constructor(path, code) {
|
|
52572
|
+
super(path, workspaceSelectionFailures[code][0]);
|
|
52573
|
+
this.code = code;
|
|
52574
|
+
this.name = "RemoteWorkspaceSelectionError";
|
|
52575
|
+
this.message = workspaceSelectionFailures[code][1];
|
|
52576
|
+
}
|
|
52577
|
+
}
|
|
52578
|
+
|
|
52579
|
+
class RemoteCapabilityUnavailableError extends RemoteRequestError {
|
|
52580
|
+
code = "SUBSCRIPTION_CHECKOUT_UNAVAILABLE";
|
|
52581
|
+
constructor() {
|
|
52582
|
+
super("/api/v1/billing/checkout", 503);
|
|
52583
|
+
this.name = "RemoteCapabilityUnavailableError";
|
|
52584
|
+
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.";
|
|
52585
|
+
}
|
|
52586
|
+
}
|
|
52587
|
+
|
|
51814
52588
|
class RemoteSkillsClient {
|
|
51815
52589
|
apiUrl;
|
|
51816
52590
|
apiKey;
|
|
@@ -51823,6 +52597,7 @@ class RemoteSkillsClient {
|
|
|
51823
52597
|
return fetch(`${this.apiUrl}${path}`, {
|
|
51824
52598
|
...options,
|
|
51825
52599
|
redirect: "error",
|
|
52600
|
+
credentials: "omit",
|
|
51826
52601
|
signal: options?.signal ?? AbortSignal.timeout(15000),
|
|
51827
52602
|
headers: {
|
|
51828
52603
|
Authorization: `Bearer ${this.apiKey}`,
|
|
@@ -51838,9 +52613,14 @@ class RemoteSkillsClient {
|
|
|
51838
52613
|
if (response.status === 404 && opts.domainNotFoundCodes?.length && await responseBodyCarriesCode(response, opts.domainNotFoundCodes)) {
|
|
51839
52614
|
return response;
|
|
51840
52615
|
}
|
|
52616
|
+
response.body?.cancel().catch(() => {});
|
|
51841
52617
|
throw new RemoteRouteUnsupportedError(routePath, response.status, this.apiUrl);
|
|
51842
52618
|
}
|
|
51843
52619
|
if (!response.ok) {
|
|
52620
|
+
if (path === "/api/v1/billing/checkout" && options?.method === "POST" && response.status === 503 && await responseBodyCarriesCode(response, ["SUBSCRIPTION_CHECKOUT_UNAVAILABLE"])) {
|
|
52621
|
+
throw new RemoteCapabilityUnavailableError;
|
|
52622
|
+
}
|
|
52623
|
+
response.body?.cancel().catch(() => {});
|
|
51844
52624
|
throw new RemoteRequestError(routePath, response.status, response.statusText);
|
|
51845
52625
|
}
|
|
51846
52626
|
return response;
|
|
@@ -51924,6 +52704,117 @@ class RemoteSkillsClient {
|
|
|
51924
52704
|
async getIdentity() {
|
|
51925
52705
|
return (await this.requestNewRoute("/api/auth/whoami")).json();
|
|
51926
52706
|
}
|
|
52707
|
+
async listAccountWorkspaces(expectedUserId) {
|
|
52708
|
+
const expected = expectedUserId === undefined ? undefined : workspaceExpectedUserId(expectedUserId);
|
|
52709
|
+
const connection = new RemoteSkillsClient(this.apiKey, this.apiUrl);
|
|
52710
|
+
let identity;
|
|
52711
|
+
if (expected !== undefined) {
|
|
52712
|
+
const value = await connection.requestWorkspaceSelection("/api/auth/whoami");
|
|
52713
|
+
if (!value || typeof value !== "object" || value.authMethod !== "jwt")
|
|
52714
|
+
throw new RemoteWorkspaceSelectionError("/api/v1/account/workspaces", "INTERACTIVE_SESSION_REQUIRED");
|
|
52715
|
+
identity = parseWorkspaceIdentity(value, expected);
|
|
52716
|
+
}
|
|
52717
|
+
const result = parseAccountWorkspaces(await connection.requestWorkspaceSelection("/api/v1/account/workspaces"));
|
|
52718
|
+
const current = result.workspaces.find((workspace) => workspace.current);
|
|
52719
|
+
if (identity && (current.membershipId !== identity.user.membershipId || current.organization.id !== identity.organization.id))
|
|
52720
|
+
throw new WorkspaceIdentityMismatchError;
|
|
52721
|
+
return result;
|
|
52722
|
+
}
|
|
52723
|
+
async switchWorkspace(context) {
|
|
52724
|
+
const target = workspaceContext(context);
|
|
52725
|
+
const connection = new RemoteSkillsClient(this.apiKey, this.apiUrl);
|
|
52726
|
+
const value = await connection.requestWorkspaceSelection("/api/auth/whoami");
|
|
52727
|
+
if (!value || typeof value !== "object" || value.authMethod !== "jwt")
|
|
52728
|
+
throw new RemoteWorkspaceSelectionError("/api/v1/account/workspaces/switch", "INTERACTIVE_SESSION_REQUIRED");
|
|
52729
|
+
parseWorkspaceIdentity(value, target.userId);
|
|
52730
|
+
const selected = parseWorkspaceSession(await connection.requestWorkspaceSelection("/api/v1/account/workspaces/switch", {
|
|
52731
|
+
method: "POST",
|
|
52732
|
+
body: JSON.stringify({ membershipId: target.membershipId })
|
|
52733
|
+
}), target);
|
|
52734
|
+
const verified = await new RemoteSkillsClient(selected.token, connection.apiUrl).requestWorkspaceSelection("/api/auth/whoami");
|
|
52735
|
+
if (!verified || typeof verified !== "object" || verified.authMethod !== "jwt")
|
|
52736
|
+
throw new RemoteWorkspaceSelectionError("/api/v1/account/workspaces/switch", "INTERACTIVE_SESSION_REQUIRED");
|
|
52737
|
+
const identity = parseWorkspaceIdentity(verified, target.userId);
|
|
52738
|
+
if (identity.user.membershipId !== target.membershipId || identity.organization.id !== selected.organization.id)
|
|
52739
|
+
throw new WorkspaceIdentityMismatchError;
|
|
52740
|
+
return { token: selected.token, ...identity };
|
|
52741
|
+
}
|
|
52742
|
+
async requestWorkspaceSelection(path, options) {
|
|
52743
|
+
let response;
|
|
52744
|
+
try {
|
|
52745
|
+
response = await this.request(path, { ...options, credentials: "omit" });
|
|
52746
|
+
} catch {
|
|
52747
|
+
throw new Error("Unable to reach the Skills workspace API.");
|
|
52748
|
+
}
|
|
52749
|
+
let value;
|
|
52750
|
+
try {
|
|
52751
|
+
value = JSON.parse(new TextDecoder().decode(await readBoundedResponse(response, response.ok ? 1024 * 1024 : 4096)));
|
|
52752
|
+
} catch {
|
|
52753
|
+
if (response.ok)
|
|
52754
|
+
throw new Error(invalidWorkspaceResult);
|
|
52755
|
+
}
|
|
52756
|
+
if (!response.ok) {
|
|
52757
|
+
const code = workspaceSelectionFailure(value, response.status);
|
|
52758
|
+
if (code)
|
|
52759
|
+
throw new RemoteWorkspaceSelectionError(path, code);
|
|
52760
|
+
if (response.status === 404 || response.status === 405)
|
|
52761
|
+
throw new RemoteRouteUnsupportedError(path, response.status, this.apiUrl);
|
|
52762
|
+
throw new RemoteRequestError(path, response.status);
|
|
52763
|
+
}
|
|
52764
|
+
return value;
|
|
52765
|
+
}
|
|
52766
|
+
async updateProfile(input) {
|
|
52767
|
+
const body = customerNamePatch(input, "displayName");
|
|
52768
|
+
return parseUpdatedProfile(await (await this.requestNewRoute("/api/v1/account/profile", { method: "PATCH", body: JSON.stringify(body) })).json());
|
|
52769
|
+
}
|
|
52770
|
+
async updateCurrentWorkspace(input) {
|
|
52771
|
+
const body = customerNamePatch(input, "name");
|
|
52772
|
+
return parseUpdatedWorkspace(await (await this.requestNewRoute("/api/v1/workspaces/current", { method: "PATCH", body: JSON.stringify(body) })).json());
|
|
52773
|
+
}
|
|
52774
|
+
async listWorkspaceMembers(options = {}) {
|
|
52775
|
+
const query = workspaceMembersQuery(options);
|
|
52776
|
+
const requestedCursor = options.cursor;
|
|
52777
|
+
const response = await this.requestNewRoute(`/api/v1/workspace/members${query}`);
|
|
52778
|
+
let value;
|
|
52779
|
+
try {
|
|
52780
|
+
value = await response.json();
|
|
52781
|
+
} catch {
|
|
52782
|
+
throw new Error("The server returned an invalid workspace roster.");
|
|
52783
|
+
}
|
|
52784
|
+
const page = parseWorkspaceMembersPage(value);
|
|
52785
|
+
if (requestedCursor !== undefined && page.nextCursor === requestedCursor)
|
|
52786
|
+
throw new Error("The server returned an invalid workspace roster.");
|
|
52787
|
+
return page;
|
|
52788
|
+
}
|
|
52789
|
+
async setWorkspaceMemberRole(membershipId, input) {
|
|
52790
|
+
const captured = workspaceMemberRoleInput(membershipId, input);
|
|
52791
|
+
const value = await this.requestWorkspaceMember(captured.membershipId, "PATCH", captured.body);
|
|
52792
|
+
return parseWorkspaceMemberRoleResult(value, captured.membershipId, captured.body.role);
|
|
52793
|
+
}
|
|
52794
|
+
async removeWorkspaceMember(membershipId, input) {
|
|
52795
|
+
const captured = workspaceMemberRemovalInput(membershipId, input);
|
|
52796
|
+
return parseWorkspaceMemberRemovalResult(await this.requestWorkspaceMember(captured.membershipId, "DELETE", captured.body), captured.membershipId);
|
|
52797
|
+
}
|
|
52798
|
+
async requestWorkspaceMember(membershipId, method, body) {
|
|
52799
|
+
const path = `/api/v1/workspace/members/${membershipId}`;
|
|
52800
|
+
const response = await this.request(path, { method, body: JSON.stringify(body) });
|
|
52801
|
+
let value;
|
|
52802
|
+
try {
|
|
52803
|
+
value = JSON.parse(new TextDecoder().decode(await readBoundedResponse(response, response.ok ? 64 * 1024 : 4096)));
|
|
52804
|
+
} catch {
|
|
52805
|
+
if (response.ok)
|
|
52806
|
+
throw new Error(invalidMemberResult);
|
|
52807
|
+
}
|
|
52808
|
+
if (!response.ok) {
|
|
52809
|
+
const code = workspaceMemberFailure(value, response.status);
|
|
52810
|
+
if (code)
|
|
52811
|
+
throw new RemoteWorkspaceMemberError(path, code);
|
|
52812
|
+
if (response.status === 404 || response.status === 405)
|
|
52813
|
+
throw new RemoteRouteUnsupportedError(path, response.status, this.apiUrl);
|
|
52814
|
+
throw new RemoteRequestError(path, response.status);
|
|
52815
|
+
}
|
|
52816
|
+
return value;
|
|
52817
|
+
}
|
|
51927
52818
|
async listApiKeys() {
|
|
51928
52819
|
return this.arrayResponse("/api/auth/keys");
|
|
51929
52820
|
}
|
|
@@ -52115,8 +53006,10 @@ class RemoteSkillsClient {
|
|
|
52115
53006
|
return [];
|
|
52116
53007
|
if (!response.ok)
|
|
52117
53008
|
throw new Error(`versions request failed: ${response.status}`);
|
|
52118
|
-
const body = await response
|
|
52119
|
-
|
|
53009
|
+
const body = await readSkillVersionPayload(response);
|
|
53010
|
+
if (!isVersionRecord(body) || !Array.isArray(body.versions) || body.slug !== undefined && body.slug !== slug)
|
|
53011
|
+
throw new Error(INVALID_SKILL_VERSION_RESPONSE);
|
|
53012
|
+
return body.versions.map((entry) => normalizeSkillVersion(entry, slug));
|
|
52120
53013
|
}
|
|
52121
53014
|
async getSkillVersion(slug, version2) {
|
|
52122
53015
|
const response = await this.requestNewRoute(`/api/v1/skills/${encodeURIComponent(slug)}/versions/${encodeURIComponent(version2)}`, undefined, { domainNotFoundCodes: ["SKILL_NOT_FOUND", "SKILL_VERSION_NOT_FOUND"] });
|
|
@@ -52124,7 +53017,7 @@ class RemoteSkillsClient {
|
|
|
52124
53017
|
return null;
|
|
52125
53018
|
if (!response.ok)
|
|
52126
53019
|
throw new Error(`version request failed: ${response.status}`);
|
|
52127
|
-
return await response
|
|
53020
|
+
return normalizeSkillVersion(await readSkillVersionPayload(response), slug, version2);
|
|
52128
53021
|
}
|
|
52129
53022
|
async listPins() {
|
|
52130
53023
|
const response = await this.requestNewRoute("/api/v1/pins");
|
|
@@ -52172,31 +53065,48 @@ class RemoteSkillsClient {
|
|
|
52172
53065
|
return normalizeUpdatedSincePage(await response.json());
|
|
52173
53066
|
}
|
|
52174
53067
|
}
|
|
52175
|
-
function requireOptionalString(
|
|
52176
|
-
if (
|
|
53068
|
+
function requireOptionalString(record3, field) {
|
|
53069
|
+
if (record3[field] === undefined)
|
|
52177
53070
|
return;
|
|
52178
|
-
if (typeof
|
|
53071
|
+
if (typeof record3[field] !== "string") {
|
|
52179
53072
|
throw new Error(`Remote payload did not match the expected contract (${field} must be a string when present)`);
|
|
52180
53073
|
}
|
|
52181
|
-
return
|
|
53074
|
+
return record3[field];
|
|
53075
|
+
}
|
|
53076
|
+
var INVALID_SKILL_VERSION_RESPONSE = "Remote skill version payload did not match the expected contract.";
|
|
53077
|
+
function isVersionRecord(value) {
|
|
53078
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
53079
|
+
}
|
|
53080
|
+
async function readSkillVersionPayload(response) {
|
|
53081
|
+
try {
|
|
53082
|
+
return await response.json();
|
|
53083
|
+
} catch {
|
|
53084
|
+
throw new Error(INVALID_SKILL_VERSION_RESPONSE);
|
|
53085
|
+
}
|
|
53086
|
+
}
|
|
53087
|
+
function normalizeSkillVersion(entry, slug, version2) {
|
|
53088
|
+
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)) {
|
|
53089
|
+
throw new Error(INVALID_SKILL_VERSION_RESPONSE);
|
|
53090
|
+
}
|
|
53091
|
+
return entry;
|
|
52182
53092
|
}
|
|
52183
53093
|
function normalizePin(entry) {
|
|
52184
53094
|
if (!entry || typeof entry !== "object") {
|
|
52185
53095
|
throw new Error("Remote pin payload did not match the expected contract (expected an object)");
|
|
52186
53096
|
}
|
|
52187
|
-
const
|
|
52188
|
-
const slug = typeof
|
|
53097
|
+
const record3 = entry;
|
|
53098
|
+
const slug = typeof record3.slug === "string" && record3.slug.trim() ? record3.slug.trim() : undefined;
|
|
52189
53099
|
if (!slug) {
|
|
52190
53100
|
throw new Error("Remote pin payload did not match the expected contract (missing slug)");
|
|
52191
53101
|
}
|
|
52192
53102
|
let metadata;
|
|
52193
|
-
if (
|
|
52194
|
-
if (!
|
|
53103
|
+
if (record3.metadata !== undefined) {
|
|
53104
|
+
if (!record3.metadata || typeof record3.metadata !== "object" || Array.isArray(record3.metadata)) {
|
|
52195
53105
|
throw new Error("Remote pin payload did not match the expected contract (metadata must be a JSON object when present)");
|
|
52196
53106
|
}
|
|
52197
|
-
metadata =
|
|
53107
|
+
metadata = record3.metadata;
|
|
52198
53108
|
}
|
|
52199
|
-
const pinnedAt = requireOptionalString(
|
|
53109
|
+
const pinnedAt = requireOptionalString(record3, "pinnedAt");
|
|
52200
53110
|
return {
|
|
52201
53111
|
slug,
|
|
52202
53112
|
...pinnedAt !== undefined ? { pinnedAt } : {},
|
|
@@ -52213,16 +53123,16 @@ function normalizeSkillSummary(entry) {
|
|
|
52213
53123
|
if (!entry || typeof entry !== "object") {
|
|
52214
53124
|
throw new Error("Remote skill payload did not match the expected contract (expected an object)");
|
|
52215
53125
|
}
|
|
52216
|
-
const
|
|
52217
|
-
const slug = typeof
|
|
53126
|
+
const record3 = entry;
|
|
53127
|
+
const slug = typeof record3.slug === "string" && record3.slug.trim() ? record3.slug.trim() : undefined;
|
|
52218
53128
|
if (!slug) {
|
|
52219
53129
|
throw new Error("Remote skill payload did not match the expected contract (missing slug)");
|
|
52220
53130
|
}
|
|
52221
53131
|
return {
|
|
52222
53132
|
slug,
|
|
52223
|
-
...requireOptionalString(
|
|
52224
|
-
...requireOptionalString(
|
|
52225
|
-
...requireOptionalString(
|
|
53133
|
+
...requireOptionalString(record3, "name") !== undefined ? { name: requireOptionalString(record3, "name") } : {},
|
|
53134
|
+
...requireOptionalString(record3, "version") !== undefined ? { version: requireOptionalString(record3, "version") } : {},
|
|
53135
|
+
...requireOptionalString(record3, "updatedAt") !== undefined ? { updatedAt: requireOptionalString(record3, "updatedAt") } : {}
|
|
52226
53136
|
};
|
|
52227
53137
|
}
|
|
52228
53138
|
function normalizeSkillSummaryList(payload) {
|
|
@@ -52232,26 +53142,55 @@ function normalizeSkillSummaryList(payload) {
|
|
|
52232
53142
|
return payload.map(normalizeSkillSummary);
|
|
52233
53143
|
}
|
|
52234
53144
|
async function responseBodyCarriesCode(response, codes) {
|
|
53145
|
+
const reader = response.body?.getReader();
|
|
53146
|
+
if (!reader)
|
|
53147
|
+
return false;
|
|
53148
|
+
const maximum = 8 * 1024;
|
|
53149
|
+
let deadline;
|
|
53150
|
+
const expired = new Promise((_, reject) => {
|
|
53151
|
+
deadline = setTimeout(() => reject(new Error("Error response read deadline exceeded")), 1000);
|
|
53152
|
+
});
|
|
52235
53153
|
try {
|
|
52236
|
-
const
|
|
52237
|
-
|
|
53154
|
+
const chunks = [];
|
|
53155
|
+
let size = 0;
|
|
53156
|
+
while (true) {
|
|
53157
|
+
const next = await Promise.race([reader.read(), expired]);
|
|
53158
|
+
if (next.done)
|
|
53159
|
+
break;
|
|
53160
|
+
size += next.value.byteLength;
|
|
53161
|
+
if (size > maximum)
|
|
53162
|
+
return false;
|
|
53163
|
+
chunks.push(next.value);
|
|
53164
|
+
}
|
|
53165
|
+
const bytes = new Uint8Array(size);
|
|
53166
|
+
let offset = 0;
|
|
53167
|
+
for (const chunk of chunks) {
|
|
53168
|
+
bytes.set(chunk, offset);
|
|
53169
|
+
offset += chunk.byteLength;
|
|
53170
|
+
}
|
|
53171
|
+
const payload = JSON.parse(new TextDecoder("utf-8", { fatal: true }).decode(bytes));
|
|
53172
|
+
if (!payload || typeof payload !== "object" || Array.isArray(payload) || !Object.hasOwn(payload, "code"))
|
|
52238
53173
|
return false;
|
|
52239
53174
|
const code = payload.code;
|
|
52240
53175
|
return typeof code === "string" && codes.includes(code);
|
|
52241
53176
|
} catch {
|
|
52242
53177
|
return false;
|
|
53178
|
+
} finally {
|
|
53179
|
+
clearTimeout(deadline);
|
|
53180
|
+
reader.cancel().catch(() => {});
|
|
53181
|
+
reader.releaseLock();
|
|
52243
53182
|
}
|
|
52244
53183
|
}
|
|
52245
53184
|
function normalizeUpdatedSincePage(payload) {
|
|
52246
53185
|
if (!payload || typeof payload !== "object") {
|
|
52247
53186
|
throw new Error("Updated-since payload did not match the expected contract (expected an object)");
|
|
52248
53187
|
}
|
|
52249
|
-
const
|
|
52250
|
-
if (!Array.isArray(
|
|
53188
|
+
const record3 = payload;
|
|
53189
|
+
if (!Array.isArray(record3.skills)) {
|
|
52251
53190
|
throw new Error("Updated-since payload did not match the expected contract (missing skills array)");
|
|
52252
53191
|
}
|
|
52253
|
-
const skills =
|
|
52254
|
-
const nextCursor =
|
|
53192
|
+
const skills = record3.skills.map(normalizeSkillSummary);
|
|
53193
|
+
const nextCursor = record3.nextCursor === undefined || record3.nextCursor === null ? null : record3.nextCursor;
|
|
52255
53194
|
if (nextCursor !== null && typeof nextCursor !== "string") {
|
|
52256
53195
|
throw new Error("Updated-since payload did not match the expected contract (nextCursor must be a string or absent)");
|
|
52257
53196
|
}
|
|
@@ -52298,13 +53237,13 @@ async function requestAuthApi(instance, path, options) {
|
|
|
52298
53237
|
apiUrl: safeUrl
|
|
52299
53238
|
});
|
|
52300
53239
|
}
|
|
52301
|
-
const
|
|
52302
|
-
const body =
|
|
53240
|
+
const text2 = await res.text();
|
|
53241
|
+
const body = text2 ? parseJsonBody(text2) : {};
|
|
52303
53242
|
if (!res.ok) {
|
|
52304
|
-
const
|
|
52305
|
-
const detail = typeof
|
|
52306
|
-
const error = typeof
|
|
52307
|
-
const code = typeof
|
|
53243
|
+
const record3 = isRecord6(body) ? body : {};
|
|
53244
|
+
const detail = typeof record3.detail === "string" ? record3.detail : undefined;
|
|
53245
|
+
const error = typeof record3.error === "string" ? record3.error : undefined;
|
|
53246
|
+
const code = typeof record3.code === "string" ? record3.code : undefined;
|
|
52308
53247
|
throw new HostedApiError(detail || error || `${res.status} ${res.statusText}`, {
|
|
52309
53248
|
status: res.status,
|
|
52310
53249
|
code,
|
|
@@ -52315,21 +53254,21 @@ async function requestAuthApi(instance, path, options) {
|
|
|
52315
53254
|
}
|
|
52316
53255
|
return body;
|
|
52317
53256
|
}
|
|
52318
|
-
function parseJsonBody(
|
|
53257
|
+
function parseJsonBody(text2) {
|
|
52319
53258
|
try {
|
|
52320
|
-
return JSON.parse(
|
|
53259
|
+
return JSON.parse(text2);
|
|
52321
53260
|
} catch {
|
|
52322
|
-
return { detail: condenseErrorBody(
|
|
53261
|
+
return { detail: condenseErrorBody(text2) };
|
|
52323
53262
|
}
|
|
52324
53263
|
}
|
|
52325
|
-
function condenseErrorBody(
|
|
52326
|
-
const stripped = /<[a-z!/]/i.test(
|
|
53264
|
+
function condenseErrorBody(text2) {
|
|
53265
|
+
const stripped = /<[a-z!/]/i.test(text2) ? text2.replace(/<(script|style)[\s\S]*?<\/\1>/gi, " ").replace(/<[^>]*>/g, " ") : text2;
|
|
52327
53266
|
const collapsed = stripped.replace(/\s+/g, " ").trim();
|
|
52328
53267
|
if (collapsed.length <= MAX_ERROR_DETAIL_LENGTH)
|
|
52329
53268
|
return collapsed;
|
|
52330
53269
|
return `${collapsed.slice(0, MAX_ERROR_DETAIL_LENGTH - 1).trimEnd()}\u2026`;
|
|
52331
53270
|
}
|
|
52332
|
-
function
|
|
53271
|
+
function isRecord6(value) {
|
|
52333
53272
|
return Boolean(value && typeof value === "object" && !Array.isArray(value));
|
|
52334
53273
|
}
|
|
52335
53274
|
|
|
@@ -52350,22 +53289,90 @@ class RemoteSkillsAuthClient {
|
|
|
52350
53289
|
pollDevice(deviceCode) {
|
|
52351
53290
|
return this.request("/api/auth/device/token", { method: "POST", body: JSON.stringify({ deviceCode }) });
|
|
52352
53291
|
}
|
|
52353
|
-
async sessionClient(email, code) {
|
|
53292
|
+
async sessionClient(email, code, context) {
|
|
53293
|
+
if (context !== undefined) {
|
|
53294
|
+
const target = workspaceContext(context), apiOrigin2 = this.apiOrigin;
|
|
53295
|
+
const session = await this.switchWorkspace(email, code, target);
|
|
53296
|
+
return new RemoteSkillsClient(session.token, apiOrigin2);
|
|
53297
|
+
}
|
|
53298
|
+
const apiOrigin = this.apiOrigin;
|
|
52354
53299
|
if (!email.includes("@") || !/^\d{6}$/.test(code))
|
|
52355
|
-
throw new Error("Fresh email and six-digit verification code are required to manage
|
|
53300
|
+
throw new Error("Fresh email and six-digit verification code are required to manage this account");
|
|
52356
53301
|
const login = await this.verifyCode(email, code);
|
|
52357
53302
|
if (!login || typeof login.token !== "string" || !login.token)
|
|
52358
53303
|
throw new Error("The server did not return an authorized account session");
|
|
52359
|
-
return new RemoteSkillsClient(login.token,
|
|
53304
|
+
return new RemoteSkillsClient(login.token, apiOrigin);
|
|
53305
|
+
}
|
|
53306
|
+
async listAccountWorkspaces(email, code, expectedUserId) {
|
|
53307
|
+
const login = await this.workspaceLogin(email, code, expectedUserId);
|
|
53308
|
+
const result = await new RemoteSkillsClient(login.token, login.apiOrigin).listAccountWorkspaces(login.userId);
|
|
53309
|
+
return { userId: login.userId, ...result };
|
|
53310
|
+
}
|
|
53311
|
+
async switchWorkspace(email, code, context) {
|
|
53312
|
+
const target = workspaceContext(context);
|
|
53313
|
+
const login = await this.workspaceLogin(email, code, target.userId);
|
|
53314
|
+
return new RemoteSkillsClient(login.token, login.apiOrigin).switchWorkspace(target);
|
|
53315
|
+
}
|
|
53316
|
+
async workspaceLogin(email, code, expectedUserId) {
|
|
53317
|
+
const expected = expectedUserId === undefined ? undefined : workspaceExpectedUserId(expectedUserId);
|
|
53318
|
+
const apiOrigin = this.apiOrigin;
|
|
53319
|
+
if (typeof email !== "string" || !email.includes("@") || typeof code !== "string" || !/^\d{6}$/.test(code))
|
|
53320
|
+
throw new Error("Fresh email and six-digit verification code are required to manage this account");
|
|
53321
|
+
let response;
|
|
53322
|
+
try {
|
|
53323
|
+
response = await fetch(`${apiOrigin}/api/auth/verify`, {
|
|
53324
|
+
method: "POST",
|
|
53325
|
+
redirect: "error",
|
|
53326
|
+
credentials: "omit",
|
|
53327
|
+
signal: AbortSignal.timeout(15000),
|
|
53328
|
+
headers: { "Content-Type": "application/json" },
|
|
53329
|
+
body: JSON.stringify({ email, code })
|
|
53330
|
+
});
|
|
53331
|
+
} catch {
|
|
53332
|
+
throw new HostedApiError("Unable to verify the Skills account.");
|
|
53333
|
+
}
|
|
53334
|
+
if (!response.ok) {
|
|
53335
|
+
response.body?.cancel().catch(() => {});
|
|
53336
|
+
throw new HostedApiError("Unable to verify the Skills account.", { status: response.status });
|
|
53337
|
+
}
|
|
53338
|
+
let value;
|
|
53339
|
+
try {
|
|
53340
|
+
value = JSON.parse(new TextDecoder().decode(await readBoundedResponse(response, 64 * 1024)));
|
|
53341
|
+
} catch {
|
|
53342
|
+
throw new HostedApiError("The server returned an invalid account verification result.");
|
|
53343
|
+
}
|
|
53344
|
+
return { ...parseWorkspaceLogin(value, expected), apiOrigin };
|
|
53345
|
+
}
|
|
53346
|
+
async createApiKey(email, code, name, scopes, context) {
|
|
53347
|
+
const capturedScopes = scopes === undefined ? undefined : [...scopes];
|
|
53348
|
+
return (await this.sessionClient(email, code, context)).createApiKey(name, capturedScopes);
|
|
53349
|
+
}
|
|
53350
|
+
async listApiKeys(email, code, context) {
|
|
53351
|
+
return (await this.sessionClient(email, code, context)).listApiKeys();
|
|
53352
|
+
}
|
|
53353
|
+
async revokeApiKey(email, code, keyId, context) {
|
|
53354
|
+
return (await this.sessionClient(email, code, context)).revokeApiKey(keyId);
|
|
53355
|
+
}
|
|
53356
|
+
async updateProfile(email, code, input, context) {
|
|
53357
|
+
const body = customerNamePatch(input, "displayName");
|
|
53358
|
+
return (await this.sessionClient(email, code, context)).updateProfile({ displayName: body.displayName });
|
|
53359
|
+
}
|
|
53360
|
+
async updateCurrentWorkspace(email, code, input, context) {
|
|
53361
|
+
const body = customerNamePatch(input, "name");
|
|
53362
|
+
return (await this.sessionClient(email, code, context)).updateCurrentWorkspace({ name: body.name });
|
|
52360
53363
|
}
|
|
52361
|
-
async
|
|
52362
|
-
|
|
53364
|
+
async listWorkspaceMembers(email, code, options = {}, context) {
|
|
53365
|
+
workspaceMembersQuery(options);
|
|
53366
|
+
const captured = { ...options };
|
|
53367
|
+
return (await this.sessionClient(email, code, context)).listWorkspaceMembers(captured);
|
|
52363
53368
|
}
|
|
52364
|
-
async
|
|
52365
|
-
|
|
53369
|
+
async setWorkspaceMemberRole(email, code, membershipId, input, context) {
|
|
53370
|
+
const captured = workspaceMemberRoleInput(membershipId, input);
|
|
53371
|
+
return (await this.sessionClient(email, code, context)).setWorkspaceMemberRole(captured.membershipId, captured.body);
|
|
52366
53372
|
}
|
|
52367
|
-
async
|
|
52368
|
-
|
|
53373
|
+
async removeWorkspaceMember(email, code, membershipId, input, context) {
|
|
53374
|
+
const captured = workspaceMemberRemovalInput(membershipId, input);
|
|
53375
|
+
return (await this.sessionClient(email, code, context)).removeWorkspaceMember(captured.membershipId, captured.body);
|
|
52369
53376
|
}
|
|
52370
53377
|
request(path, options) {
|
|
52371
53378
|
if (!["/api/auth/login", "/api/auth/verify", "/api/auth/device/start", "/api/auth/device/token", "/api/auth/keys", "/api/auth/whoami"].includes(path))
|
|
@@ -52382,6 +53389,7 @@ export {
|
|
|
52382
53389
|
skillsCredentialFiles,
|
|
52383
53390
|
skillsCredentialFilePath,
|
|
52384
53391
|
settleRun,
|
|
53392
|
+
selectsSkillsLocalMode,
|
|
52385
53393
|
runTerminalSchema,
|
|
52386
53394
|
runProtocolSchema,
|
|
52387
53395
|
runPointersOf,
|
|
@@ -52409,6 +53417,7 @@ export {
|
|
|
52409
53417
|
leaseGenerationOf,
|
|
52410
53418
|
isValidSkillSlug,
|
|
52411
53419
|
isTerminalStatus,
|
|
53420
|
+
isSkillsLocalOptIn,
|
|
52412
53421
|
isActiveStatus,
|
|
52413
53422
|
getServerSkillMd,
|
|
52414
53423
|
getServerSkill,
|
|
@@ -52444,18 +53453,24 @@ export {
|
|
|
52444
53453
|
assertDurableTarget,
|
|
52445
53454
|
assertDurableStore,
|
|
52446
53455
|
artifactStorageSeam,
|
|
53456
|
+
WorkspaceIdentityMismatchError,
|
|
53457
|
+
WorkspaceContextInputError,
|
|
52447
53458
|
SqliteSkillsStore,
|
|
52448
53459
|
SqliteRunExecutionStore,
|
|
52449
53460
|
SqliteGovernanceStore,
|
|
52450
53461
|
SkillsFleetCredentialError,
|
|
53462
|
+
SKILLS_LOCAL_OPT_IN_ENV_KEYS,
|
|
52451
53463
|
SKILLS_APP,
|
|
52452
53464
|
SKILLS_API_URL_ENV,
|
|
52453
53465
|
SKILLS_API_KEY_ENV,
|
|
53466
|
+
RemoteWorkspaceSelectionError,
|
|
53467
|
+
RemoteWorkspaceMemberError,
|
|
52454
53468
|
RemoteSkillsClient,
|
|
52455
53469
|
RemoteSkillsAuthClient,
|
|
52456
53470
|
RemoteRouteUnsupportedError,
|
|
52457
53471
|
RemoteRequestError,
|
|
52458
53472
|
RemoteCreditApprovalError,
|
|
53473
|
+
RemoteCapabilityUnavailableError,
|
|
52459
53474
|
RUN_PROTOCOL_VERSION,
|
|
52460
53475
|
RUN_PROTOCOL_STATES,
|
|
52461
53476
|
RUN_LIFECYCLE_EVENT_TYPES,
|