@hasna/skills 0.10.74 → 0.10.76
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 +18 -1
- package/bin/index.js +701 -341
- package/bin/mcp.js +142 -93
- package/bin/migrate.js +1 -1
- package/bin/server.js +1 -1
- package/bin/worker.js +1 -1
- package/dist/cli/stray-arguments.d.ts +29 -0
- package/dist/index.js +572 -243
- package/dist/lib/agent-codex-trust.d.ts +4 -0
- package/dist/lib/agent-integration.d.ts +3 -3
- package/dist/lib/agent-sync.d.ts +6 -4
- package/dist/lib/codex-corpus-write.d.ts +47 -6
- package/dist/lib/codex-hook-rpc.d.ts +3 -0
- package/dist/lib/home-adoption.d.ts +5 -5
- package/dist/lib/installer.d.ts +5 -3
- package/dist/lib/search.d.ts +18 -0
- package/dist/runtime-prerequisites.js +1 -1
- package/dist/sdk/index.js +630 -301
- package/package.json +1 -1
package/dist/sdk/index.js
CHANGED
|
@@ -16765,7 +16765,7 @@ var require_client2 = __commonJS((exports) => {
|
|
|
16765
16765
|
var { HttpRequest, parseUrl } = require_protocols();
|
|
16766
16766
|
var { InvokeStore } = require_invoke_store();
|
|
16767
16767
|
var { normalizeProvider } = require_dist_cjs2();
|
|
16768
|
-
var { platform, release } = __require("os");
|
|
16768
|
+
var { platform, release: release2 } = __require("os");
|
|
16769
16769
|
var { versions, env } = __require("process");
|
|
16770
16770
|
var { isValidHostLabel, isIpAddress, customEndpointFunctions } = require_endpoints();
|
|
16771
16771
|
var { EndpointError, resolveEndpoint } = require_endpoints();
|
|
@@ -17485,7 +17485,7 @@ More information can be found at: https://a.co/c895JFp`);
|
|
|
17485
17485
|
const sections = [
|
|
17486
17486
|
["aws-sdk-js", clientVersion],
|
|
17487
17487
|
["ua", "2.1"],
|
|
17488
|
-
[`os/${platform()}`,
|
|
17488
|
+
[`os/${platform()}`, release2()],
|
|
17489
17489
|
["lang/js"],
|
|
17490
17490
|
runtimeUserAgentPair
|
|
17491
17491
|
];
|
|
@@ -24586,7 +24586,7 @@ var require_httpAuthSchemes = __commonJS((exports) => {
|
|
|
24586
24586
|
});
|
|
24587
24587
|
|
|
24588
24588
|
// node_modules/@aws-sdk/credential-provider-env/dist-es/fromEnv.js
|
|
24589
|
-
var import_client8,
|
|
24589
|
+
var import_client8, import_config10, ENV_KEY = "AWS_ACCESS_KEY_ID", ENV_SECRET = "AWS_SECRET_ACCESS_KEY", ENV_SESSION = "AWS_SESSION_TOKEN", ENV_EXPIRATION = "AWS_CREDENTIAL_EXPIRATION", ENV_CREDENTIAL_SCOPE = "AWS_CREDENTIAL_SCOPE", ENV_ACCOUNT_ID = "AWS_ACCOUNT_ID", fromEnv = (init) => async () => {
|
|
24590
24590
|
init?.logger?.debug("@aws-sdk/credential-provider-env - fromEnv");
|
|
24591
24591
|
const accessKeyId = process.env[ENV_KEY];
|
|
24592
24592
|
const secretAccessKey = process.env[ENV_SECRET];
|
|
@@ -24606,11 +24606,11 @@ var import_client8, import_config9, ENV_KEY = "AWS_ACCESS_KEY_ID", ENV_SECRET =
|
|
|
24606
24606
|
import_client8.setCredentialFeature(credentials, "CREDENTIALS_ENV_VARS", "g");
|
|
24607
24607
|
return credentials;
|
|
24608
24608
|
}
|
|
24609
|
-
throw new
|
|
24609
|
+
throw new import_config10.CredentialsProviderError("Unable to find environment variable credentials.", { logger: init?.logger });
|
|
24610
24610
|
};
|
|
24611
24611
|
var init_fromEnv = __esm(() => {
|
|
24612
24612
|
import_client8 = __toESM(require_client2(), 1);
|
|
24613
|
-
|
|
24613
|
+
import_config10 = __toESM(require_config(), 1);
|
|
24614
24614
|
});
|
|
24615
24615
|
|
|
24616
24616
|
// node_modules/@aws-sdk/credential-provider-env/dist-es/index.js
|
|
@@ -24653,17 +24653,17 @@ function httpRequest(options) {
|
|
|
24653
24653
|
hostname: options.hostname?.replace(/^\[(.+)\]$/, "$1")
|
|
24654
24654
|
});
|
|
24655
24655
|
req.on("error", (err) => {
|
|
24656
|
-
reject(Object.assign(new
|
|
24656
|
+
reject(Object.assign(new import_config11.ProviderError("Unable to connect to instance metadata service"), err));
|
|
24657
24657
|
req.destroy();
|
|
24658
24658
|
});
|
|
24659
24659
|
req.on("timeout", () => {
|
|
24660
|
-
reject(new
|
|
24660
|
+
reject(new import_config11.ProviderError("TimeoutError from instance metadata service"));
|
|
24661
24661
|
req.destroy();
|
|
24662
24662
|
});
|
|
24663
24663
|
req.on("response", (res) => {
|
|
24664
24664
|
const { statusCode = 400 } = res;
|
|
24665
24665
|
if (statusCode < 200 || 300 <= statusCode) {
|
|
24666
|
-
reject(Object.assign(new
|
|
24666
|
+
reject(Object.assign(new import_config11.ProviderError("Error response received from instance metadata service"), { statusCode }));
|
|
24667
24667
|
req.destroy();
|
|
24668
24668
|
}
|
|
24669
24669
|
const chunks = [];
|
|
@@ -24678,10 +24678,10 @@ function httpRequest(options) {
|
|
|
24678
24678
|
req.end();
|
|
24679
24679
|
});
|
|
24680
24680
|
}
|
|
24681
|
-
var
|
|
24681
|
+
var import_config11;
|
|
24682
24682
|
var init_httpRequest = __esm(() => {
|
|
24683
24683
|
init_node_http();
|
|
24684
|
-
|
|
24684
|
+
import_config11 = __toESM(require_config(), 1);
|
|
24685
24685
|
});
|
|
24686
24686
|
|
|
24687
24687
|
// node_modules/@smithy/credential-provider-imds/dist-es/remoteProvider/retry.js
|
|
@@ -24694,13 +24694,13 @@ var retry = (toRetry, maxRetries) => {
|
|
|
24694
24694
|
};
|
|
24695
24695
|
|
|
24696
24696
|
// node_modules/@smithy/credential-provider-imds/dist-es/fromContainerMetadata.js
|
|
24697
|
-
var
|
|
24697
|
+
var import_config12, ENV_CMDS_FULL_URI = "AWS_CONTAINER_CREDENTIALS_FULL_URI", ENV_CMDS_RELATIVE_URI = "AWS_CONTAINER_CREDENTIALS_RELATIVE_URI", ENV_CMDS_AUTH_TOKEN = "AWS_CONTAINER_AUTHORIZATION_TOKEN", fromContainerMetadata = (init = {}) => {
|
|
24698
24698
|
const { timeout: timeout2, maxRetries } = providerConfigFromInit(init);
|
|
24699
24699
|
return () => retry(async () => {
|
|
24700
24700
|
const requestOptions = await getCmdsUri({ logger: init.logger });
|
|
24701
24701
|
const credsResponse = JSON.parse(await requestFromEcsImds(timeout2, requestOptions));
|
|
24702
24702
|
if (!isImdsCredentials(credsResponse)) {
|
|
24703
|
-
throw new
|
|
24703
|
+
throw new import_config12.CredentialsProviderError("Invalid response received from instance metadata service.", {
|
|
24704
24704
|
logger: init.logger
|
|
24705
24705
|
});
|
|
24706
24706
|
}
|
|
@@ -24730,16 +24730,16 @@ var import_config11, ENV_CMDS_FULL_URI = "AWS_CONTAINER_CREDENTIALS_FULL_URI", E
|
|
|
24730
24730
|
try {
|
|
24731
24731
|
parsed = new URL(process.env[ENV_CMDS_FULL_URI]);
|
|
24732
24732
|
} catch {
|
|
24733
|
-
throw new
|
|
24733
|
+
throw new import_config12.CredentialsProviderError(`${process.env[ENV_CMDS_FULL_URI]} is not a valid container metadata service URL`, { tryNextLink: false, logger });
|
|
24734
24734
|
}
|
|
24735
24735
|
if (!parsed.hostname || !GREENGRASS_HOSTS.has(parsed.hostname)) {
|
|
24736
|
-
throw new
|
|
24736
|
+
throw new import_config12.CredentialsProviderError(`${parsed.hostname} is not a valid container metadata service hostname`, {
|
|
24737
24737
|
tryNextLink: false,
|
|
24738
24738
|
logger
|
|
24739
24739
|
});
|
|
24740
24740
|
}
|
|
24741
24741
|
if (!parsed.protocol || !GREENGRASS_PROTOCOLS.has(parsed.protocol)) {
|
|
24742
|
-
throw new
|
|
24742
|
+
throw new import_config12.CredentialsProviderError(`${parsed.protocol} is not a valid container metadata service protocol`, {
|
|
24743
24743
|
tryNextLink: false,
|
|
24744
24744
|
logger
|
|
24745
24745
|
});
|
|
@@ -24751,23 +24751,23 @@ var import_config11, ENV_CMDS_FULL_URI = "AWS_CONTAINER_CREDENTIALS_FULL_URI", E
|
|
|
24751
24751
|
port: parsed.port ? parseInt(parsed.port, 10) : undefined
|
|
24752
24752
|
};
|
|
24753
24753
|
}
|
|
24754
|
-
throw new
|
|
24754
|
+
throw new import_config12.CredentialsProviderError("The container metadata credential provider cannot be used unless" + ` the ${ENV_CMDS_RELATIVE_URI} or ${ENV_CMDS_FULL_URI} environment` + " variable is set", {
|
|
24755
24755
|
tryNextLink: false,
|
|
24756
24756
|
logger
|
|
24757
24757
|
});
|
|
24758
24758
|
};
|
|
24759
24759
|
var init_fromContainerMetadata = __esm(() => {
|
|
24760
24760
|
init_httpRequest();
|
|
24761
|
-
|
|
24761
|
+
import_config12 = __toESM(require_config(), 1);
|
|
24762
24762
|
GREENGRASS_HOSTS = new Set(["localhost", "127.0.0.1"]);
|
|
24763
24763
|
GREENGRASS_PROTOCOLS = new Set(["http:", "https:"]);
|
|
24764
24764
|
});
|
|
24765
24765
|
|
|
24766
24766
|
// node_modules/@smithy/credential-provider-imds/dist-es/error/InstanceMetadataV1FallbackError.js
|
|
24767
|
-
var
|
|
24767
|
+
var import_config13, InstanceMetadataV1FallbackError;
|
|
24768
24768
|
var init_InstanceMetadataV1FallbackError = __esm(() => {
|
|
24769
|
-
|
|
24770
|
-
InstanceMetadataV1FallbackError = class InstanceMetadataV1FallbackError extends
|
|
24769
|
+
import_config13 = __toESM(require_config(), 1);
|
|
24770
|
+
InstanceMetadataV1FallbackError = class InstanceMetadataV1FallbackError extends import_config13.CredentialsProviderError {
|
|
24771
24771
|
tryNextLink;
|
|
24772
24772
|
name = "InstanceMetadataV1FallbackError";
|
|
24773
24773
|
constructor(message, tryNextLink = true) {
|
|
@@ -24818,8 +24818,8 @@ var init_EndpointModeConfigOptions = __esm(() => {
|
|
|
24818
24818
|
});
|
|
24819
24819
|
|
|
24820
24820
|
// node_modules/@smithy/credential-provider-imds/dist-es/utils/getInstanceMetadataEndpoint.js
|
|
24821
|
-
var
|
|
24822
|
-
const endpointMode = await
|
|
24821
|
+
var import_config14, import_protocols, getInstanceMetadataEndpoint = async () => import_protocols.parseUrl(await getFromEndpointConfig() || await getFromEndpointModeConfig()), getFromEndpointConfig = async () => import_config14.loadConfig(ENDPOINT_CONFIG_OPTIONS)(), getFromEndpointModeConfig = async () => {
|
|
24822
|
+
const endpointMode = await import_config14.loadConfig(ENDPOINT_MODE_CONFIG_OPTIONS)();
|
|
24823
24823
|
switch (endpointMode) {
|
|
24824
24824
|
case EndpointMode.IPv4:
|
|
24825
24825
|
return Endpoint.IPv4;
|
|
@@ -24834,7 +24834,7 @@ var init_getInstanceMetadataEndpoint = __esm(() => {
|
|
|
24834
24834
|
init_EndpointConfigOptions();
|
|
24835
24835
|
init_EndpointMode();
|
|
24836
24836
|
init_EndpointModeConfigOptions();
|
|
24837
|
-
|
|
24837
|
+
import_config14 = __toESM(require_config(), 1);
|
|
24838
24838
|
import_protocols = __toESM(require_protocols(), 1);
|
|
24839
24839
|
});
|
|
24840
24840
|
|
|
@@ -24884,7 +24884,7 @@ var init_staticStabilityProvider = __esm(() => {
|
|
|
24884
24884
|
});
|
|
24885
24885
|
|
|
24886
24886
|
// node_modules/@smithy/credential-provider-imds/dist-es/fromInstanceMetadata.js
|
|
24887
|
-
var
|
|
24887
|
+
var import_config15, IMDS_PATH = "/latest/meta-data/iam/security-credentials/", IMDS_TOKEN_PATH = "/latest/api/token", AWS_EC2_METADATA_V1_DISABLED = "AWS_EC2_METADATA_V1_DISABLED", PROFILE_AWS_EC2_METADATA_V1_DISABLED = "ec2_metadata_v1_disabled", X_AWS_EC2_METADATA_TOKEN = "x-aws-ec2-metadata-token", fromInstanceMetadata = (init = {}) => staticStabilityProvider(getInstanceMetadataProvider(init), { logger: init.logger }), getInstanceMetadataProvider = (init = {}) => {
|
|
24888
24888
|
let disableFetchToken = false;
|
|
24889
24889
|
const { logger, profile } = init;
|
|
24890
24890
|
const { timeout: timeout2, maxRetries } = providerConfigFromInit(init);
|
|
@@ -24893,12 +24893,12 @@ var import_config14, IMDS_PATH = "/latest/meta-data/iam/security-credentials/",
|
|
|
24893
24893
|
if (isImdsV1Fallback) {
|
|
24894
24894
|
let fallbackBlockedFromProfile = false;
|
|
24895
24895
|
let fallbackBlockedFromProcessEnv = false;
|
|
24896
|
-
const configValue = await
|
|
24896
|
+
const configValue = await import_config15.loadConfig({
|
|
24897
24897
|
environmentVariableSelector: (env) => {
|
|
24898
24898
|
const envValue = env[AWS_EC2_METADATA_V1_DISABLED];
|
|
24899
24899
|
fallbackBlockedFromProcessEnv = !!envValue && envValue !== "false";
|
|
24900
24900
|
if (envValue === undefined) {
|
|
24901
|
-
throw new
|
|
24901
|
+
throw new import_config15.CredentialsProviderError(`${AWS_EC2_METADATA_V1_DISABLED} not set in env, checking config file next.`, { logger: init.logger });
|
|
24902
24902
|
}
|
|
24903
24903
|
return fallbackBlockedFromProcessEnv;
|
|
24904
24904
|
},
|
|
@@ -24989,7 +24989,7 @@ var import_config14, IMDS_PATH = "/latest/meta-data/iam/security-credentials/",
|
|
|
24989
24989
|
path: IMDS_PATH + profile
|
|
24990
24990
|
})).toString());
|
|
24991
24991
|
if (!isImdsCredentials(credentialsResponse)) {
|
|
24992
|
-
throw new
|
|
24992
|
+
throw new import_config15.CredentialsProviderError("Invalid response received from instance metadata service.", {
|
|
24993
24993
|
logger: init.logger
|
|
24994
24994
|
});
|
|
24995
24995
|
}
|
|
@@ -25000,7 +25000,7 @@ var init_fromInstanceMetadata = __esm(() => {
|
|
|
25000
25000
|
init_httpRequest();
|
|
25001
25001
|
init_getInstanceMetadataEndpoint();
|
|
25002
25002
|
init_staticStabilityProvider();
|
|
25003
|
-
|
|
25003
|
+
import_config15 = __toESM(require_config(), 1);
|
|
25004
25004
|
});
|
|
25005
25005
|
|
|
25006
25006
|
// node_modules/@smithy/credential-provider-imds/dist-es/index.js
|
|
@@ -25853,7 +25853,7 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
|
|
|
25853
25853
|
});
|
|
25854
25854
|
|
|
25855
25855
|
// node_modules/@aws-sdk/credential-provider-http/dist-es/fromHttp/checkUrl.js
|
|
25856
|
-
var
|
|
25856
|
+
var import_config16, ECS_CONTAINER_HOST = "169.254.170.2", EKS_CONTAINER_HOST_IPv4 = "169.254.170.23", EKS_CONTAINER_HOST_IPv6 = "[fd00:ec2::23]", checkUrl = (url, logger) => {
|
|
25857
25857
|
if (url.protocol === "https:") {
|
|
25858
25858
|
return;
|
|
25859
25859
|
}
|
|
@@ -25877,13 +25877,13 @@ var import_config15, ECS_CONTAINER_HOST = "169.254.170.2", EKS_CONTAINER_HOST_IP
|
|
|
25877
25877
|
return;
|
|
25878
25878
|
}
|
|
25879
25879
|
}
|
|
25880
|
-
throw new
|
|
25880
|
+
throw new import_config16.CredentialsProviderError(`URL not accepted. It must either be HTTPS or match one of the following:
|
|
25881
25881
|
- loopback CIDR 127.0.0.0/8 or [::1/128]
|
|
25882
25882
|
- ECS container host 169.254.170.2
|
|
25883
25883
|
- EKS container host 169.254.170.23 or [fd00:ec2::23]`, { logger });
|
|
25884
25884
|
};
|
|
25885
25885
|
var init_checkUrl = __esm(() => {
|
|
25886
|
-
|
|
25886
|
+
import_config16 = __toESM(require_config(), 1);
|
|
25887
25887
|
});
|
|
25888
25888
|
|
|
25889
25889
|
// node_modules/@aws-sdk/credential-provider-http/dist-es/fromHttp/requestHelpers.js
|
|
@@ -25906,7 +25906,7 @@ async function getCredentials(response, logger) {
|
|
|
25906
25906
|
if (response.statusCode === 200) {
|
|
25907
25907
|
const parsed = JSON.parse(str);
|
|
25908
25908
|
if (typeof parsed.AccessKeyId !== "string" || typeof parsed.SecretAccessKey !== "string" || typeof parsed.Token !== "string" || typeof parsed.Expiration !== "string") {
|
|
25909
|
-
throw new
|
|
25909
|
+
throw new import_config17.CredentialsProviderError("HTTP credential provider response not of the required format, an object matching: " + "{ AccessKeyId: string, SecretAccessKey: string, Token: string, Expiration: string(rfc3339) }", { logger });
|
|
25910
25910
|
}
|
|
25911
25911
|
return {
|
|
25912
25912
|
accessKeyId: parsed.AccessKeyId,
|
|
@@ -25920,16 +25920,16 @@ async function getCredentials(response, logger) {
|
|
|
25920
25920
|
try {
|
|
25921
25921
|
parsedBody = JSON.parse(str);
|
|
25922
25922
|
} catch (e3) {}
|
|
25923
|
-
throw Object.assign(new
|
|
25923
|
+
throw Object.assign(new import_config17.CredentialsProviderError(`Server responded with status: ${response.statusCode}`, { logger }), {
|
|
25924
25924
|
Code: parsedBody.Code,
|
|
25925
25925
|
Message: parsedBody.Message
|
|
25926
25926
|
});
|
|
25927
25927
|
}
|
|
25928
|
-
throw new
|
|
25928
|
+
throw new import_config17.CredentialsProviderError(`Server responded with status: ${response.statusCode}`, { logger });
|
|
25929
25929
|
}
|
|
25930
|
-
var
|
|
25930
|
+
var import_config17, import_protocols2, import_serde, import_serde2;
|
|
25931
25931
|
var init_requestHelpers = __esm(() => {
|
|
25932
|
-
|
|
25932
|
+
import_config17 = __toESM(require_config(), 1);
|
|
25933
25933
|
import_protocols2 = __toESM(require_protocols(), 1);
|
|
25934
25934
|
import_serde = __toESM(require_serde(), 1);
|
|
25935
25935
|
import_serde2 = __toESM(require_serde(), 1);
|
|
@@ -25951,7 +25951,7 @@ var retryWrapper = (toRetry, maxRetries, delayMs) => {
|
|
|
25951
25951
|
|
|
25952
25952
|
// node_modules/@aws-sdk/credential-provider-http/dist-es/fromHttp/fromHttp.js
|
|
25953
25953
|
import fs from "fs/promises";
|
|
25954
|
-
var import_client9,
|
|
25954
|
+
var import_client9, import_config18, import_node_http_handler, AWS_CONTAINER_CREDENTIALS_RELATIVE_URI = "AWS_CONTAINER_CREDENTIALS_RELATIVE_URI", DEFAULT_LINK_LOCAL_HOST = "http://169.254.170.2", AWS_CONTAINER_CREDENTIALS_FULL_URI = "AWS_CONTAINER_CREDENTIALS_FULL_URI", AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE = "AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE", AWS_CONTAINER_AUTHORIZATION_TOKEN = "AWS_CONTAINER_AUTHORIZATION_TOKEN", fromHttp = (options = {}) => {
|
|
25955
25955
|
options.logger?.debug("@aws-sdk/credential-provider-http - fromHttp");
|
|
25956
25956
|
let host;
|
|
25957
25957
|
const relative12 = options.awsContainerCredentialsRelativeUri ?? process.env[AWS_CONTAINER_CREDENTIALS_RELATIVE_URI];
|
|
@@ -25972,7 +25972,7 @@ var import_client9, import_config17, import_node_http_handler, AWS_CONTAINER_CRE
|
|
|
25972
25972
|
} else if (full) {
|
|
25973
25973
|
host = full;
|
|
25974
25974
|
} else {
|
|
25975
|
-
throw new
|
|
25975
|
+
throw new import_config18.CredentialsProviderError(`No HTTP credential provider host provided.
|
|
25976
25976
|
Set AWS_CONTAINER_CREDENTIALS_FULL_URI or AWS_CONTAINER_CREDENTIALS_RELATIVE_URI.`, { logger: options.logger });
|
|
25977
25977
|
}
|
|
25978
25978
|
const url = new URL(host);
|
|
@@ -25990,7 +25990,7 @@ Set AWS_CONTAINER_CREDENTIALS_FULL_URI or AWS_CONTAINER_CREDENTIALS_RELATIVE_URI
|
|
|
25990
25990
|
const result = await requestHandler.handle(request2, { requestTimeout });
|
|
25991
25991
|
return getCredentials(result.response).then((creds) => import_client9.setCredentialFeature(creds, "CREDENTIALS_HTTP", "z"));
|
|
25992
25992
|
} catch (e3) {
|
|
25993
|
-
throw new
|
|
25993
|
+
throw new import_config18.CredentialsProviderError(String(e3), { logger: options.logger });
|
|
25994
25994
|
}
|
|
25995
25995
|
}, options.maxRetries ?? 3, options.timeout ?? 1000);
|
|
25996
25996
|
return async () => {
|
|
@@ -26003,7 +26003,7 @@ Set AWS_CONTAINER_CREDENTIALS_FULL_URI or AWS_CONTAINER_CREDENTIALS_RELATIVE_URI
|
|
|
26003
26003
|
}, validateToken = (token) => {
|
|
26004
26004
|
if (token.includes(`\r
|
|
26005
26005
|
`)) {
|
|
26006
|
-
throw new
|
|
26006
|
+
throw new import_config18.CredentialsProviderError("Authorization token contains invalid \\r\\n sequence.");
|
|
26007
26007
|
}
|
|
26008
26008
|
return token;
|
|
26009
26009
|
};
|
|
@@ -26011,7 +26011,7 @@ var init_fromHttp = __esm(() => {
|
|
|
26011
26011
|
init_checkUrl();
|
|
26012
26012
|
init_requestHelpers();
|
|
26013
26013
|
import_client9 = __toESM(require_client2(), 1);
|
|
26014
|
-
|
|
26014
|
+
import_config18 = __toESM(require_config(), 1);
|
|
26015
26015
|
import_node_http_handler = __toESM(require_dist_cjs6(), 1);
|
|
26016
26016
|
});
|
|
26017
26017
|
|
|
@@ -26814,70 +26814,70 @@ var getNewSsoOidcToken = async (ssoToken, ssoRegion, init = {}, callerClientConf
|
|
|
26814
26814
|
var init_getNewSsoOidcToken = () => {};
|
|
26815
26815
|
|
|
26816
26816
|
// node_modules/@aws-sdk/token-providers/dist-es/validateTokenExpiry.js
|
|
26817
|
-
var
|
|
26817
|
+
var import_config20, validateTokenExpiry = (token) => {
|
|
26818
26818
|
if (token.expiration && token.expiration.getTime() < Date.now()) {
|
|
26819
|
-
throw new
|
|
26819
|
+
throw new import_config20.TokenProviderError(`Token is expired. ${REFRESH_MESSAGE}`, false);
|
|
26820
26820
|
}
|
|
26821
26821
|
};
|
|
26822
26822
|
var init_validateTokenExpiry = __esm(() => {
|
|
26823
26823
|
init_constants();
|
|
26824
|
-
|
|
26824
|
+
import_config20 = __toESM(require_config(), 1);
|
|
26825
26825
|
});
|
|
26826
26826
|
|
|
26827
26827
|
// node_modules/@aws-sdk/token-providers/dist-es/validateTokenKey.js
|
|
26828
|
-
var
|
|
26828
|
+
var import_config21, validateTokenKey = (key2, value, forRefresh = false) => {
|
|
26829
26829
|
if (typeof value === "undefined") {
|
|
26830
|
-
throw new
|
|
26830
|
+
throw new import_config21.TokenProviderError(`Value not present for '${key2}' in SSO Token${forRefresh ? ". Cannot refresh" : ""}. ${REFRESH_MESSAGE}`, false);
|
|
26831
26831
|
}
|
|
26832
26832
|
};
|
|
26833
26833
|
var init_validateTokenKey = __esm(() => {
|
|
26834
26834
|
init_constants();
|
|
26835
|
-
|
|
26835
|
+
import_config21 = __toESM(require_config(), 1);
|
|
26836
26836
|
});
|
|
26837
26837
|
|
|
26838
26838
|
// node_modules/@aws-sdk/token-providers/dist-es/writeSSOTokenToFile.js
|
|
26839
26839
|
import { promises as fsPromises } from "fs";
|
|
26840
|
-
var
|
|
26841
|
-
const tokenFilepath =
|
|
26840
|
+
var import_config22, writeFile, writeSSOTokenToFile = (id2, ssoToken) => {
|
|
26841
|
+
const tokenFilepath = import_config22.getSSOTokenFilepath(id2);
|
|
26842
26842
|
const tokenString = JSON.stringify(ssoToken, null, 2);
|
|
26843
26843
|
return writeFile(tokenFilepath, tokenString);
|
|
26844
26844
|
};
|
|
26845
26845
|
var init_writeSSOTokenToFile = __esm(() => {
|
|
26846
|
-
|
|
26846
|
+
import_config22 = __toESM(require_config(), 1);
|
|
26847
26847
|
({ writeFile } = fsPromises);
|
|
26848
26848
|
});
|
|
26849
26849
|
|
|
26850
26850
|
// node_modules/@aws-sdk/token-providers/dist-es/fromSso.js
|
|
26851
|
-
var
|
|
26851
|
+
var import_config23, lastRefreshAttemptTimes, fromSso = (init = {}) => async ({ callerClientConfig } = {}) => {
|
|
26852
26852
|
init.logger?.debug("@aws-sdk/token-providers - fromSso");
|
|
26853
|
-
const profiles = await
|
|
26854
|
-
const profileName =
|
|
26853
|
+
const profiles = await import_config23.parseKnownFiles(init);
|
|
26854
|
+
const profileName = import_config23.getProfileName({
|
|
26855
26855
|
profile: init.profile ?? callerClientConfig?.profile
|
|
26856
26856
|
});
|
|
26857
26857
|
const profile = profiles[profileName];
|
|
26858
26858
|
if (!profile) {
|
|
26859
|
-
throw new
|
|
26859
|
+
throw new import_config23.TokenProviderError(`Profile '${profileName}' could not be found in shared credentials file.`, false);
|
|
26860
26860
|
} else if (!profile["sso_session"]) {
|
|
26861
|
-
throw new
|
|
26861
|
+
throw new import_config23.TokenProviderError(`Profile '${profileName}' is missing required property 'sso_session'.`);
|
|
26862
26862
|
}
|
|
26863
26863
|
const ssoSessionName = profile["sso_session"];
|
|
26864
|
-
const ssoSessions = await
|
|
26864
|
+
const ssoSessions = await import_config23.loadSsoSessionData(init);
|
|
26865
26865
|
const ssoSession = ssoSessions[ssoSessionName];
|
|
26866
26866
|
if (!ssoSession) {
|
|
26867
|
-
throw new
|
|
26867
|
+
throw new import_config23.TokenProviderError(`Sso session '${ssoSessionName}' could not be found in shared credentials file.`, false);
|
|
26868
26868
|
}
|
|
26869
26869
|
for (const ssoSessionRequiredKey of ["sso_start_url", "sso_region"]) {
|
|
26870
26870
|
if (!ssoSession[ssoSessionRequiredKey]) {
|
|
26871
|
-
throw new
|
|
26871
|
+
throw new import_config23.TokenProviderError(`Sso session '${ssoSessionName}' is missing required property '${ssoSessionRequiredKey}'.`, false);
|
|
26872
26872
|
}
|
|
26873
26873
|
}
|
|
26874
26874
|
const ssoStartUrl = ssoSession["sso_start_url"];
|
|
26875
26875
|
const ssoRegion = ssoSession["sso_region"];
|
|
26876
26876
|
let ssoToken;
|
|
26877
26877
|
try {
|
|
26878
|
-
ssoToken = await
|
|
26878
|
+
ssoToken = await import_config23.getSSOTokenFromFile(ssoSessionName);
|
|
26879
26879
|
} catch (e3) {
|
|
26880
|
-
throw new
|
|
26880
|
+
throw new import_config23.TokenProviderError(`The SSO session token associated with profile=${profileName} was not found or is invalid. ${REFRESH_MESSAGE}`, false);
|
|
26881
26881
|
}
|
|
26882
26882
|
validateTokenKey("accessToken", ssoToken.accessToken);
|
|
26883
26883
|
validateTokenKey("expiresAt", ssoToken.expiresAt);
|
|
@@ -26926,7 +26926,7 @@ var init_fromSso = __esm(() => {
|
|
|
26926
26926
|
init_validateTokenExpiry();
|
|
26927
26927
|
init_validateTokenKey();
|
|
26928
26928
|
init_writeSSOTokenToFile();
|
|
26929
|
-
|
|
26929
|
+
import_config23 = __toESM(require_config(), 1);
|
|
26930
26930
|
lastRefreshAttemptTimes = new Map;
|
|
26931
26931
|
});
|
|
26932
26932
|
|
|
@@ -27394,7 +27394,7 @@ var init_loadSso = __esm(() => {
|
|
|
27394
27394
|
});
|
|
27395
27395
|
|
|
27396
27396
|
// node_modules/@aws-sdk/credential-provider-sso/dist-es/resolveSSOCredentials.js
|
|
27397
|
-
var import_client10,
|
|
27397
|
+
var import_client10, import_config24, SHOULD_FAIL_CREDENTIAL_CHAIN = false, resolveSSOCredentials = async ({ ssoStartUrl, ssoSession, ssoAccountId, ssoRegion, ssoRoleName, ssoClient, clientConfig, parentClientConfig, callerClientConfig, profile, filepath, configFilepath, ignoreCache, logger }) => {
|
|
27398
27398
|
let token;
|
|
27399
27399
|
const refreshMessage = `To refresh this SSO session run aws sso login with the corresponding profile.`;
|
|
27400
27400
|
if (ssoSession) {
|
|
@@ -27413,23 +27413,23 @@ var import_client10, import_config23, SHOULD_FAIL_CREDENTIAL_CHAIN = false, reso
|
|
|
27413
27413
|
expiresAt: new Date(_token.expiration).toISOString()
|
|
27414
27414
|
};
|
|
27415
27415
|
} catch (e4) {
|
|
27416
|
-
throw new
|
|
27416
|
+
throw new import_config24.CredentialsProviderError(e4.message, {
|
|
27417
27417
|
tryNextLink: SHOULD_FAIL_CREDENTIAL_CHAIN,
|
|
27418
27418
|
logger
|
|
27419
27419
|
});
|
|
27420
27420
|
}
|
|
27421
27421
|
} else {
|
|
27422
27422
|
try {
|
|
27423
|
-
token = await
|
|
27423
|
+
token = await import_config24.getSSOTokenFromFile(ssoStartUrl);
|
|
27424
27424
|
} catch (e4) {
|
|
27425
|
-
throw new
|
|
27425
|
+
throw new import_config24.CredentialsProviderError(`The SSO session associated with this profile is invalid. ${refreshMessage}`, {
|
|
27426
27426
|
tryNextLink: SHOULD_FAIL_CREDENTIAL_CHAIN,
|
|
27427
27427
|
logger
|
|
27428
27428
|
});
|
|
27429
27429
|
}
|
|
27430
27430
|
}
|
|
27431
27431
|
if (new Date(token.expiresAt).getTime() - Date.now() <= 0) {
|
|
27432
|
-
throw new
|
|
27432
|
+
throw new import_config24.CredentialsProviderError(`The SSO session associated with this profile has expired. ${refreshMessage}`, {
|
|
27433
27433
|
tryNextLink: SHOULD_FAIL_CREDENTIAL_CHAIN,
|
|
27434
27434
|
logger
|
|
27435
27435
|
});
|
|
@@ -27449,14 +27449,14 @@ var import_client10, import_config23, SHOULD_FAIL_CREDENTIAL_CHAIN = false, reso
|
|
|
27449
27449
|
accessToken
|
|
27450
27450
|
}));
|
|
27451
27451
|
} catch (e4) {
|
|
27452
|
-
throw new
|
|
27452
|
+
throw new import_config24.CredentialsProviderError(e4, {
|
|
27453
27453
|
tryNextLink: SHOULD_FAIL_CREDENTIAL_CHAIN,
|
|
27454
27454
|
logger
|
|
27455
27455
|
});
|
|
27456
27456
|
}
|
|
27457
27457
|
const { roleCredentials: { accessKeyId, secretAccessKey, sessionToken, expiration, credentialScope, accountId } = {} } = ssoResp;
|
|
27458
27458
|
if (!accessKeyId || !secretAccessKey || !sessionToken || !expiration) {
|
|
27459
|
-
throw new
|
|
27459
|
+
throw new import_config24.CredentialsProviderError("SSO returns an invalid temporary credential.", {
|
|
27460
27460
|
tryNextLink: SHOULD_FAIL_CREDENTIAL_CHAIN,
|
|
27461
27461
|
logger
|
|
27462
27462
|
});
|
|
@@ -27479,53 +27479,53 @@ var import_client10, import_config23, SHOULD_FAIL_CREDENTIAL_CHAIN = false, reso
|
|
|
27479
27479
|
var init_resolveSSOCredentials = __esm(() => {
|
|
27480
27480
|
init_dist_es4();
|
|
27481
27481
|
import_client10 = __toESM(require_client2(), 1);
|
|
27482
|
-
|
|
27482
|
+
import_config24 = __toESM(require_config(), 1);
|
|
27483
27483
|
});
|
|
27484
27484
|
|
|
27485
27485
|
// node_modules/@aws-sdk/credential-provider-sso/dist-es/validateSsoProfile.js
|
|
27486
|
-
var
|
|
27486
|
+
var import_config25, validateSsoProfile = (profile, logger) => {
|
|
27487
27487
|
const { sso_start_url, sso_account_id, sso_region, sso_role_name } = profile;
|
|
27488
27488
|
if (!sso_start_url || !sso_account_id || !sso_region || !sso_role_name) {
|
|
27489
|
-
throw new
|
|
27489
|
+
throw new import_config25.CredentialsProviderError(`Profile is configured with invalid SSO credentials. Required parameters "sso_account_id", ` + `"sso_region", "sso_role_name", "sso_start_url". Got ${Object.keys(profile).join(", ")}
|
|
27490
27490
|
Reference: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-sso.html`, { tryNextLink: false, logger });
|
|
27491
27491
|
}
|
|
27492
27492
|
return profile;
|
|
27493
27493
|
};
|
|
27494
27494
|
var init_validateSsoProfile = __esm(() => {
|
|
27495
|
-
|
|
27495
|
+
import_config25 = __toESM(require_config(), 1);
|
|
27496
27496
|
});
|
|
27497
27497
|
|
|
27498
27498
|
// node_modules/@aws-sdk/credential-provider-sso/dist-es/fromSSO.js
|
|
27499
|
-
var
|
|
27499
|
+
var import_config26, fromSSO = (init = {}) => async ({ callerClientConfig } = {}) => {
|
|
27500
27500
|
init.logger?.debug("@aws-sdk/credential-provider-sso - fromSSO");
|
|
27501
27501
|
const { ssoStartUrl, ssoAccountId, ssoRegion, ssoRoleName, ssoSession } = init;
|
|
27502
27502
|
const { ssoClient } = init;
|
|
27503
|
-
const profileName =
|
|
27503
|
+
const profileName = import_config26.getProfileName({
|
|
27504
27504
|
profile: init.profile ?? callerClientConfig?.profile
|
|
27505
27505
|
});
|
|
27506
27506
|
if (!ssoStartUrl && !ssoAccountId && !ssoRegion && !ssoRoleName && !ssoSession) {
|
|
27507
|
-
const profiles = await
|
|
27507
|
+
const profiles = await import_config26.parseKnownFiles(init);
|
|
27508
27508
|
const profile = profiles[profileName];
|
|
27509
27509
|
if (!profile) {
|
|
27510
|
-
throw new
|
|
27510
|
+
throw new import_config26.CredentialsProviderError(`Profile ${profileName} was not found.`, { logger: init.logger });
|
|
27511
27511
|
}
|
|
27512
27512
|
if (!isSsoProfile(profile)) {
|
|
27513
|
-
throw new
|
|
27513
|
+
throw new import_config26.CredentialsProviderError(`Profile ${profileName} is not configured with SSO credentials.`, {
|
|
27514
27514
|
logger: init.logger
|
|
27515
27515
|
});
|
|
27516
27516
|
}
|
|
27517
27517
|
if (profile?.sso_session) {
|
|
27518
|
-
const ssoSessions = await
|
|
27518
|
+
const ssoSessions = await import_config26.loadSsoSessionData(init);
|
|
27519
27519
|
const session = ssoSessions[profile.sso_session];
|
|
27520
27520
|
const conflictMsg = ` configurations in profile ${profileName} and sso-session ${profile.sso_session}`;
|
|
27521
27521
|
if (ssoRegion && ssoRegion !== session.sso_region) {
|
|
27522
|
-
throw new
|
|
27522
|
+
throw new import_config26.CredentialsProviderError(`Conflicting SSO region` + conflictMsg, {
|
|
27523
27523
|
tryNextLink: false,
|
|
27524
27524
|
logger: init.logger
|
|
27525
27525
|
});
|
|
27526
27526
|
}
|
|
27527
27527
|
if (ssoStartUrl && ssoStartUrl !== session.sso_start_url) {
|
|
27528
|
-
throw new
|
|
27528
|
+
throw new import_config26.CredentialsProviderError(`Conflicting SSO start_url` + conflictMsg, {
|
|
27529
27529
|
tryNextLink: false,
|
|
27530
27530
|
logger: init.logger
|
|
27531
27531
|
});
|
|
@@ -27551,7 +27551,7 @@ var import_config25, fromSSO = (init = {}) => async ({ callerClientConfig } = {}
|
|
|
27551
27551
|
logger: init.logger
|
|
27552
27552
|
});
|
|
27553
27553
|
} else if (!ssoStartUrl || !ssoAccountId || !ssoRegion || !ssoRoleName) {
|
|
27554
|
-
throw new
|
|
27554
|
+
throw new import_config26.CredentialsProviderError("Incomplete configuration. The fromSSO() argument hash must include " + '"ssoStartUrl", "ssoAccountId", "ssoRegion", "ssoRoleName"', { tryNextLink: false, logger: init.logger });
|
|
27555
27555
|
} else {
|
|
27556
27556
|
return resolveSSOCredentials({
|
|
27557
27557
|
ssoStartUrl,
|
|
@@ -27574,7 +27574,7 @@ var import_config25, fromSSO = (init = {}) => async ({ callerClientConfig } = {}
|
|
|
27574
27574
|
var init_fromSSO = __esm(() => {
|
|
27575
27575
|
init_resolveSSOCredentials();
|
|
27576
27576
|
init_validateSsoProfile();
|
|
27577
|
-
|
|
27577
|
+
import_config26 = __toESM(require_config(), 1);
|
|
27578
27578
|
});
|
|
27579
27579
|
|
|
27580
27580
|
// node_modules/@aws-sdk/credential-provider-sso/dist-es/index.js
|
|
@@ -27590,13 +27590,13 @@ var init_dist_es5 = __esm(() => {
|
|
|
27590
27590
|
});
|
|
27591
27591
|
|
|
27592
27592
|
// node_modules/@aws-sdk/credential-provider-ini/dist-es/resolveCredentialSource.js
|
|
27593
|
-
var import_client11,
|
|
27593
|
+
var import_client11, import_config27, resolveCredentialSource = (credentialSource, profileName, logger) => {
|
|
27594
27594
|
const sourceProvidersMap = {
|
|
27595
27595
|
EcsContainer: async (options) => {
|
|
27596
27596
|
const { fromHttp: fromHttp2 } = await Promise.resolve().then(() => (init_dist_es3(), exports_dist_es3));
|
|
27597
27597
|
const { fromContainerMetadata: fromContainerMetadata2 } = await Promise.resolve().then(() => (init_dist_es2(), exports_dist_es2));
|
|
27598
27598
|
logger?.debug("@aws-sdk/credential-provider-ini - credential_source is EcsContainer");
|
|
27599
|
-
return async () =>
|
|
27599
|
+
return async () => import_config27.chain(fromHttp2(options ?? {}), fromContainerMetadata2(options))().then(setNamedProvider);
|
|
27600
27600
|
},
|
|
27601
27601
|
Ec2InstanceMetadata: async (options) => {
|
|
27602
27602
|
logger?.debug("@aws-sdk/credential-provider-ini - credential_source is Ec2InstanceMetadata");
|
|
@@ -27612,12 +27612,12 @@ var import_client11, import_config26, resolveCredentialSource = (credentialSourc
|
|
|
27612
27612
|
if (credentialSource in sourceProvidersMap) {
|
|
27613
27613
|
return sourceProvidersMap[credentialSource];
|
|
27614
27614
|
} else {
|
|
27615
|
-
throw new
|
|
27615
|
+
throw new import_config27.CredentialsProviderError(`Unsupported credential source in profile ${profileName}. Got ${credentialSource}, expected EcsContainer or Ec2InstanceMetadata or Environment.`, { logger });
|
|
27616
27616
|
}
|
|
27617
27617
|
}, setNamedProvider = (creds) => import_client11.setCredentialFeature(creds, "CREDENTIALS_PROFILE_NAMED_PROVIDER", "p");
|
|
27618
27618
|
var init_resolveCredentialSource = __esm(() => {
|
|
27619
27619
|
import_client11 = __toESM(require_client2(), 1);
|
|
27620
|
-
|
|
27620
|
+
import_config27 = __toESM(require_config(), 1);
|
|
27621
27621
|
});
|
|
27622
27622
|
|
|
27623
27623
|
// node_modules/@aws-sdk/credential-provider-ini/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sts/index.js
|
|
@@ -28643,7 +28643,7 @@ var require_sts = __commonJS((exports) => {
|
|
|
28643
28643
|
});
|
|
28644
28644
|
|
|
28645
28645
|
// node_modules/@aws-sdk/credential-provider-ini/dist-es/resolveAssumeRoleCredentials.js
|
|
28646
|
-
var import_client12,
|
|
28646
|
+
var import_client12, import_config28, isAssumeRoleProfile = (arg, { profile = "default", logger } = {}) => {
|
|
28647
28647
|
return Boolean(arg) && typeof arg === "object" && typeof arg.role_arn === "string" && ["undefined", "string"].indexOf(typeof arg.role_session_name) > -1 && ["undefined", "string"].indexOf(typeof arg.external_id) > -1 && ["undefined", "string"].indexOf(typeof arg.mfa_serial) > -1 && (isAssumeRoleWithSourceProfile(arg, { profile, logger }) || isCredentialSourceProfile(arg, { profile, logger }));
|
|
28648
28648
|
}, isAssumeRoleWithSourceProfile = (arg, { profile, logger }) => {
|
|
28649
28649
|
const withSourceProfile = typeof arg.source_profile === "string" && typeof arg.credential_source === "undefined";
|
|
@@ -28674,7 +28674,7 @@ var import_client12, import_config27, isAssumeRoleProfile = (arg, { profile = "d
|
|
|
28674
28674
|
}, options.clientPlugins);
|
|
28675
28675
|
}
|
|
28676
28676
|
if (source_profile && source_profile in visitedProfiles) {
|
|
28677
|
-
throw new
|
|
28677
|
+
throw new import_config28.CredentialsProviderError(`Detected a cycle attempting to resolve credentials for profile ${import_config28.getProfileName(options)}. Profiles visited: ` + Object.keys(visitedProfiles).join(", "), { logger: options.logger });
|
|
28678
28678
|
}
|
|
28679
28679
|
options.logger?.debug(`@aws-sdk/credential-provider-ini - finding credential resolver using ${source_profile ? `source_profile=[${source_profile}]` : `profile=[${profileName}]`}`);
|
|
28680
28680
|
const sourceCredsProvider = source_profile ? resolveProfileData(source_profile, profiles, options, callerClientConfig, {
|
|
@@ -28693,7 +28693,7 @@ var import_client12, import_config27, isAssumeRoleProfile = (arg, { profile = "d
|
|
|
28693
28693
|
const { mfa_serial } = profileData;
|
|
28694
28694
|
if (mfa_serial) {
|
|
28695
28695
|
if (!options.mfaCodeProvider) {
|
|
28696
|
-
throw new
|
|
28696
|
+
throw new import_config28.CredentialsProviderError(`Profile ${profileName} requires multi-factor authentication, but no MFA code callback was provided.`, { logger: options.logger, tryNextLink: false });
|
|
28697
28697
|
}
|
|
28698
28698
|
params.SerialNumber = mfa_serial;
|
|
28699
28699
|
params.TokenCode = await options.mfaCodeProvider(mfa_serial);
|
|
@@ -28707,7 +28707,7 @@ var import_client12, import_config27, isAssumeRoleProfile = (arg, { profile = "d
|
|
|
28707
28707
|
var init_resolveAssumeRoleCredentials = __esm(() => {
|
|
28708
28708
|
init_resolveCredentialSource();
|
|
28709
28709
|
import_client12 = __toESM(require_client2(), 1);
|
|
28710
|
-
|
|
28710
|
+
import_config28 = __toESM(require_config(), 1);
|
|
28711
28711
|
});
|
|
28712
28712
|
|
|
28713
28713
|
// node_modules/@aws-sdk/credential-provider-ini/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/signin/index.js
|
|
@@ -29447,9 +29447,9 @@ import { createHash as createHash33, createPrivateKey, createPublicKey, sign } f
|
|
|
29447
29447
|
import { promises as fs2 } from "fs";
|
|
29448
29448
|
import { homedir as homedir7 } from "os";
|
|
29449
29449
|
import { dirname as dirname30, join as join44 } from "path";
|
|
29450
|
-
var
|
|
29450
|
+
var import_config29, import_protocols3, LoginCredentialsFetcher;
|
|
29451
29451
|
var init_LoginCredentialsFetcher = __esm(() => {
|
|
29452
|
-
|
|
29452
|
+
import_config29 = __toESM(require_config(), 1);
|
|
29453
29453
|
import_protocols3 = __toESM(require_protocols(), 1);
|
|
29454
29454
|
LoginCredentialsFetcher = class LoginCredentialsFetcher {
|
|
29455
29455
|
profileData;
|
|
@@ -29464,7 +29464,7 @@ var init_LoginCredentialsFetcher = __esm(() => {
|
|
|
29464
29464
|
async loadCredentials() {
|
|
29465
29465
|
const token = await this.loadToken();
|
|
29466
29466
|
if (!token) {
|
|
29467
|
-
throw new
|
|
29467
|
+
throw new import_config29.CredentialsProviderError(`Failed to load a token for session ${this.loginSession}, please re-authenticate using aws login`, { tryNextLink: false, logger: this.logger });
|
|
29468
29468
|
}
|
|
29469
29469
|
const accessToken = token.accessToken;
|
|
29470
29470
|
const now = Date.now();
|
|
@@ -29531,7 +29531,7 @@ var init_LoginCredentialsFetcher = __esm(() => {
|
|
|
29531
29531
|
const { accessKeyId, secretAccessKey, sessionToken } = response.tokenOutput?.accessToken ?? {};
|
|
29532
29532
|
const { refreshToken, expiresIn } = response.tokenOutput ?? {};
|
|
29533
29533
|
if (!accessKeyId || !secretAccessKey || !sessionToken || !refreshToken) {
|
|
29534
|
-
throw new
|
|
29534
|
+
throw new import_config29.CredentialsProviderError("Token refresh response missing required fields", {
|
|
29535
29535
|
logger: this.logger,
|
|
29536
29536
|
tryNextLink: false
|
|
29537
29537
|
});
|
|
@@ -29568,7 +29568,7 @@ var init_LoginCredentialsFetcher = __esm(() => {
|
|
|
29568
29568
|
default:
|
|
29569
29569
|
message = `Failed to refresh token: ${String(error)}. Please re-authenticate using \`aws login\``;
|
|
29570
29570
|
}
|
|
29571
|
-
throw new
|
|
29571
|
+
throw new import_config29.CredentialsProviderError(message, {
|
|
29572
29572
|
logger: this.logger,
|
|
29573
29573
|
tryNextLink: false
|
|
29574
29574
|
});
|
|
@@ -29578,7 +29578,7 @@ var init_LoginCredentialsFetcher = __esm(() => {
|
|
|
29578
29578
|
this.logger?.warn?.(`Failed to refresh token: ${String(error)}. Using existing token until expiry.`);
|
|
29579
29579
|
return this.toCredentials(freshToken.accessToken);
|
|
29580
29580
|
}
|
|
29581
|
-
throw new
|
|
29581
|
+
throw new import_config29.CredentialsProviderError(`Failed to refresh token: ${String(error)}. Please re-authenticate using aws login`, { logger: this.logger });
|
|
29582
29582
|
}
|
|
29583
29583
|
}
|
|
29584
29584
|
async loadToken() {
|
|
@@ -29591,14 +29591,14 @@ var init_LoginCredentialsFetcher = __esm(() => {
|
|
|
29591
29591
|
missingFields.push("accountId");
|
|
29592
29592
|
}
|
|
29593
29593
|
if (missingFields.length > 0) {
|
|
29594
|
-
throw new
|
|
29594
|
+
throw new import_config29.CredentialsProviderError(`Token validation failed, missing fields: ${missingFields.join(", ")}`, {
|
|
29595
29595
|
logger: this.logger,
|
|
29596
29596
|
tryNextLink: false
|
|
29597
29597
|
});
|
|
29598
29598
|
}
|
|
29599
29599
|
return token;
|
|
29600
29600
|
} catch (error) {
|
|
29601
|
-
throw new
|
|
29601
|
+
throw new import_config29.CredentialsProviderError(`Failed to load token from ${tokenFilePath}: ${String(error)}`, {
|
|
29602
29602
|
logger: this.logger,
|
|
29603
29603
|
tryNextLink: false
|
|
29604
29604
|
});
|
|
@@ -29700,22 +29700,22 @@ var init_LoginCredentialsFetcher = __esm(() => {
|
|
|
29700
29700
|
const signatureB64 = rawSignature.toString("base64url");
|
|
29701
29701
|
return `${message}.${signatureB64}`;
|
|
29702
29702
|
} catch (error) {
|
|
29703
|
-
throw new
|
|
29703
|
+
throw new import_config29.CredentialsProviderError(`Failed to generate Dpop proof: ${error instanceof Error ? error.message : String(error)}`, { logger: this.logger, tryNextLink: false });
|
|
29704
29704
|
}
|
|
29705
29705
|
}
|
|
29706
29706
|
};
|
|
29707
29707
|
});
|
|
29708
29708
|
|
|
29709
29709
|
// node_modules/@aws-sdk/credential-provider-ini/node_modules/@aws-sdk/credential-provider-login/dist-es/fromLoginCredentials.js
|
|
29710
|
-
var import_client13,
|
|
29710
|
+
var import_client13, import_config30, fromLoginCredentials = (init) => async ({ callerClientConfig } = {}) => {
|
|
29711
29711
|
init?.logger?.debug?.("@aws-sdk/credential-providers - fromLoginCredentials");
|
|
29712
|
-
const profiles = await
|
|
29713
|
-
const profileName =
|
|
29712
|
+
const profiles = await import_config30.parseKnownFiles(init || {});
|
|
29713
|
+
const profileName = import_config30.getProfileName({
|
|
29714
29714
|
profile: init?.profile ?? callerClientConfig?.profile
|
|
29715
29715
|
});
|
|
29716
29716
|
const profile = profiles[profileName];
|
|
29717
29717
|
if (!profile?.login_session) {
|
|
29718
|
-
throw new
|
|
29718
|
+
throw new import_config30.CredentialsProviderError(`Profile ${profileName} does not contain login_session.`, {
|
|
29719
29719
|
tryNextLink: true,
|
|
29720
29720
|
logger: init?.logger
|
|
29721
29721
|
});
|
|
@@ -29727,7 +29727,7 @@ var import_client13, import_config29, fromLoginCredentials = (init) => async ({
|
|
|
29727
29727
|
var init_fromLoginCredentials = __esm(() => {
|
|
29728
29728
|
init_LoginCredentialsFetcher();
|
|
29729
29729
|
import_client13 = __toESM(require_client2(), 1);
|
|
29730
|
-
|
|
29730
|
+
import_config30 = __toESM(require_config(), 1);
|
|
29731
29731
|
});
|
|
29732
29732
|
|
|
29733
29733
|
// node_modules/@aws-sdk/credential-provider-ini/node_modules/@aws-sdk/credential-provider-login/dist-es/index.js
|
|
@@ -29791,12 +29791,12 @@ var init_getValidatedProcessCredentials = __esm(() => {
|
|
|
29791
29791
|
// node_modules/@aws-sdk/credential-provider-process/dist-es/resolveProcessCredentials.js
|
|
29792
29792
|
import { exec } from "child_process";
|
|
29793
29793
|
import { promisify as promisify2 } from "util";
|
|
29794
|
-
var
|
|
29794
|
+
var import_config31, resolveProcessCredentials = async (profileName, profiles, logger) => {
|
|
29795
29795
|
const profile = profiles[profileName];
|
|
29796
29796
|
if (profiles[profileName]) {
|
|
29797
29797
|
const credentialProcess = profile["credential_process"];
|
|
29798
29798
|
if (credentialProcess !== undefined) {
|
|
29799
|
-
const execPromise = promisify2(
|
|
29799
|
+
const execPromise = promisify2(import_config31.externalDataInterceptor?.getTokenRecord?.().exec ?? exec);
|
|
29800
29800
|
try {
|
|
29801
29801
|
const { stdout } = await execPromise(credentialProcess);
|
|
29802
29802
|
let data;
|
|
@@ -29807,33 +29807,33 @@ var import_config30, resolveProcessCredentials = async (profileName, profiles, l
|
|
|
29807
29807
|
}
|
|
29808
29808
|
return getValidatedProcessCredentials(profileName, data, profiles);
|
|
29809
29809
|
} catch (error) {
|
|
29810
|
-
throw new
|
|
29810
|
+
throw new import_config31.CredentialsProviderError(error.message, { logger });
|
|
29811
29811
|
}
|
|
29812
29812
|
} else {
|
|
29813
|
-
throw new
|
|
29813
|
+
throw new import_config31.CredentialsProviderError(`Profile ${profileName} did not contain credential_process.`, { logger });
|
|
29814
29814
|
}
|
|
29815
29815
|
} else {
|
|
29816
|
-
throw new
|
|
29816
|
+
throw new import_config31.CredentialsProviderError(`Profile ${profileName} could not be found in shared credentials file.`, {
|
|
29817
29817
|
logger
|
|
29818
29818
|
});
|
|
29819
29819
|
}
|
|
29820
29820
|
};
|
|
29821
29821
|
var init_resolveProcessCredentials = __esm(() => {
|
|
29822
29822
|
init_getValidatedProcessCredentials();
|
|
29823
|
-
|
|
29823
|
+
import_config31 = __toESM(require_config(), 1);
|
|
29824
29824
|
});
|
|
29825
29825
|
|
|
29826
29826
|
// node_modules/@aws-sdk/credential-provider-process/dist-es/fromProcess.js
|
|
29827
|
-
var
|
|
29827
|
+
var import_config32, fromProcess = (init = {}) => async ({ callerClientConfig } = {}) => {
|
|
29828
29828
|
init.logger?.debug("@aws-sdk/credential-provider-process - fromProcess");
|
|
29829
|
-
const profiles = await
|
|
29830
|
-
return resolveProcessCredentials(
|
|
29829
|
+
const profiles = await import_config32.parseKnownFiles(init);
|
|
29830
|
+
return resolveProcessCredentials(import_config32.getProfileName({
|
|
29831
29831
|
profile: init.profile ?? callerClientConfig?.profile
|
|
29832
29832
|
}), profiles, init.logger);
|
|
29833
29833
|
};
|
|
29834
29834
|
var init_fromProcess = __esm(() => {
|
|
29835
29835
|
init_resolveProcessCredentials();
|
|
29836
|
-
|
|
29836
|
+
import_config32 = __toESM(require_config(), 1);
|
|
29837
29837
|
});
|
|
29838
29838
|
|
|
29839
29839
|
// node_modules/@aws-sdk/credential-provider-process/dist-es/index.js
|
|
@@ -30947,19 +30947,19 @@ var fromWebToken = (init) => async (awsIdentityProperties) => {
|
|
|
30947
30947
|
|
|
30948
30948
|
// node_modules/@aws-sdk/credential-provider-web-identity/dist-es/fromTokenFile.js
|
|
30949
30949
|
import { readFileSync as readFileSync29 } from "fs";
|
|
30950
|
-
var import_client19,
|
|
30950
|
+
var import_client19, import_config33, ENV_TOKEN_FILE = "AWS_WEB_IDENTITY_TOKEN_FILE", ENV_ROLE_ARN = "AWS_ROLE_ARN", ENV_ROLE_SESSION_NAME = "AWS_ROLE_SESSION_NAME", fromTokenFile = (init = {}) => async (awsIdentityProperties) => {
|
|
30951
30951
|
init.logger?.debug("@aws-sdk/credential-provider-web-identity - fromTokenFile");
|
|
30952
30952
|
const webIdentityTokenFile = init?.webIdentityTokenFile ?? process.env[ENV_TOKEN_FILE];
|
|
30953
30953
|
const roleArn = init?.roleArn ?? process.env[ENV_ROLE_ARN];
|
|
30954
30954
|
const roleSessionName = init?.roleSessionName ?? process.env[ENV_ROLE_SESSION_NAME];
|
|
30955
30955
|
if (!webIdentityTokenFile || !roleArn) {
|
|
30956
|
-
throw new
|
|
30956
|
+
throw new import_config33.CredentialsProviderError("Web identity configuration not specified", {
|
|
30957
30957
|
logger: init.logger
|
|
30958
30958
|
});
|
|
30959
30959
|
}
|
|
30960
30960
|
const credentials = await fromWebToken({
|
|
30961
30961
|
...init,
|
|
30962
|
-
webIdentityToken:
|
|
30962
|
+
webIdentityToken: import_config33.externalDataInterceptor?.getTokenRecord?.()[webIdentityTokenFile] ?? readFileSync29(webIdentityTokenFile, { encoding: "ascii" }),
|
|
30963
30963
|
roleArn,
|
|
30964
30964
|
roleSessionName
|
|
30965
30965
|
})(awsIdentityProperties);
|
|
@@ -30970,7 +30970,7 @@ var import_client19, import_config32, ENV_TOKEN_FILE = "AWS_WEB_IDENTITY_TOKEN_F
|
|
|
30970
30970
|
};
|
|
30971
30971
|
var init_fromTokenFile = __esm(() => {
|
|
30972
30972
|
import_client19 = __toESM(require_client2(), 1);
|
|
30973
|
-
|
|
30973
|
+
import_config33 = __toESM(require_config(), 1);
|
|
30974
30974
|
});
|
|
30975
30975
|
|
|
30976
30976
|
// node_modules/@aws-sdk/credential-provider-web-identity/dist-es/index.js
|
|
@@ -31003,7 +31003,7 @@ var init_resolveWebIdentityCredentials = __esm(() => {
|
|
|
31003
31003
|
});
|
|
31004
31004
|
|
|
31005
31005
|
// node_modules/@aws-sdk/credential-provider-ini/dist-es/resolveProfileData.js
|
|
31006
|
-
var
|
|
31006
|
+
var import_config34, resolveProfileData = async (profileName, profiles, options, callerClientConfig, visitedProfiles = {}, isAssumeRoleRecursiveCall = false) => {
|
|
31007
31007
|
const data = profiles[profileName];
|
|
31008
31008
|
if (Object.keys(visitedProfiles).length > 0 && isStaticCredsProfile(data)) {
|
|
31009
31009
|
return resolveStaticCredentials(data, options);
|
|
@@ -31026,7 +31026,7 @@ var import_config33, resolveProfileData = async (profileName, profiles, options,
|
|
|
31026
31026
|
if (isLoginProfile(data)) {
|
|
31027
31027
|
return resolveLoginCredentials(profileName, options, callerClientConfig);
|
|
31028
31028
|
}
|
|
31029
|
-
throw new
|
|
31029
|
+
throw new import_config34.CredentialsProviderError(`Could not resolve credentials using profile: [${profileName}] in configuration/credentials file(s).`, { logger: options.logger });
|
|
31030
31030
|
};
|
|
31031
31031
|
var init_resolveProfileData = __esm(() => {
|
|
31032
31032
|
init_resolveAssumeRoleCredentials();
|
|
@@ -31035,20 +31035,20 @@ var init_resolveProfileData = __esm(() => {
|
|
|
31035
31035
|
init_resolveSsoCredentials();
|
|
31036
31036
|
init_resolveStaticCredentials();
|
|
31037
31037
|
init_resolveWebIdentityCredentials();
|
|
31038
|
-
|
|
31038
|
+
import_config34 = __toESM(require_config(), 1);
|
|
31039
31039
|
});
|
|
31040
31040
|
|
|
31041
31041
|
// node_modules/@aws-sdk/credential-provider-ini/dist-es/fromIni.js
|
|
31042
|
-
var
|
|
31042
|
+
var import_config35, fromIni = (init = {}) => async ({ callerClientConfig } = {}) => {
|
|
31043
31043
|
init.logger?.debug("@aws-sdk/credential-provider-ini - fromIni");
|
|
31044
|
-
const profiles = await
|
|
31045
|
-
return resolveProfileData(
|
|
31044
|
+
const profiles = await import_config35.parseKnownFiles(init);
|
|
31045
|
+
return resolveProfileData(import_config35.getProfileName({
|
|
31046
31046
|
profile: init.profile ?? callerClientConfig?.profile
|
|
31047
31047
|
}), profiles, init, callerClientConfig);
|
|
31048
31048
|
};
|
|
31049
31049
|
var init_fromIni = __esm(() => {
|
|
31050
31050
|
init_resolveProfileData();
|
|
31051
|
-
|
|
31051
|
+
import_config35 = __toESM(require_config(), 1);
|
|
31052
31052
|
});
|
|
31053
31053
|
|
|
31054
31054
|
// node_modules/@aws-sdk/credential-provider-ini/dist-es/index.js
|
|
@@ -32371,7 +32371,7 @@ var init_event_sink = __esm(() => {
|
|
|
32371
32371
|
init_dist();
|
|
32372
32372
|
});
|
|
32373
32373
|
// package.json
|
|
32374
|
-
var version = "0.10.
|
|
32374
|
+
var version = "0.10.76";
|
|
32375
32375
|
var package_default = {
|
|
32376
32376
|
name: "@hasna/skills",
|
|
32377
32377
|
version,
|
|
@@ -37622,7 +37622,7 @@ function applySessionReconciliation(snapshot, target, planned, record2, verified
|
|
|
37622
37622
|
// src/lib/selected-run.ts
|
|
37623
37623
|
import { createHash as createHash32 } from "crypto";
|
|
37624
37624
|
import { spawn as spawn3 } from "child_process";
|
|
37625
|
-
import { mkdirSync as
|
|
37625
|
+
import { mkdirSync as mkdirSync13, mkdtempSync as mkdtempSync4, writeFileSync as writeFileSync10, realpathSync as realpathSync17 } from "fs";
|
|
37626
37626
|
import { dirname as dirname29, join as join43, resolve as resolve30 } from "path";
|
|
37627
37627
|
import { tmpdir, hostname as stationHostname2 } from "os";
|
|
37628
37628
|
|
|
@@ -38169,14 +38169,35 @@ class KernelLock {
|
|
|
38169
38169
|
}
|
|
38170
38170
|
|
|
38171
38171
|
// src/lib/codex-corpus-write.ts
|
|
38172
|
-
import {
|
|
38172
|
+
import { AsyncLocalStorage } from "async_hooks";
|
|
38173
|
+
import { execFileSync, spawnSync as spawnSync5 } from "child_process";
|
|
38173
38174
|
import { createHash as createHash6 } from "crypto";
|
|
38174
|
-
import { accessSync, constants as constants7, lstatSync as lstatSync7, readFileSync as readFileSync10, realpathSync as realpathSync4, statSync as statSync4 } from "fs";
|
|
38175
|
+
import { accessSync, constants as constants7, lstatSync as lstatSync7, mkdirSync as mkdirSync4, mkdtempSync, readdirSync as readdirSync3, readFileSync as readFileSync10, realpathSync as realpathSync4, rmSync, statSync as statSync4 } from "fs";
|
|
38175
38176
|
import { basename as basename2, delimiter, dirname as dirname5, isAbsolute as isAbsolute4, join as join11, relative as relative4, resolve as resolve4, sep as sep3 } from "path";
|
|
38176
38177
|
var KEY = ".native-corpus-admission";
|
|
38177
|
-
var fail = () => {
|
|
38178
|
-
throw new Error(
|
|
38178
|
+
var fail = (reason) => {
|
|
38179
|
+
throw new Error(`CODEX_CORPUS_ADMISSION_REQUIRED: verified native admission and its existing shared lock are required${reason ? ` (${reason})` : ""}`);
|
|
38179
38180
|
};
|
|
38181
|
+
function codexAdmissionRecord(options) {
|
|
38182
|
+
const record2 = options.onCodexAdmission;
|
|
38183
|
+
const invalid3 = () => {
|
|
38184
|
+
throw new Error("CODEX_CORPUS_ADMISSION_RECORD_INVALID: onCodexAdmission must be a synchronous function");
|
|
38185
|
+
};
|
|
38186
|
+
if (record2 !== undefined && typeof record2 !== "function")
|
|
38187
|
+
invalid3();
|
|
38188
|
+
return { policy: { fallback: typeof record2 === "function" }, deliver(admission) {
|
|
38189
|
+
if (!admission || typeof record2 !== "function")
|
|
38190
|
+
return;
|
|
38191
|
+
const result = record2(admission);
|
|
38192
|
+
if (result !== null && (typeof result === "object" || typeof result === "function") && typeof result.then === "function") {
|
|
38193
|
+
Promise.resolve(result).catch(() => {});
|
|
38194
|
+
invalid3();
|
|
38195
|
+
}
|
|
38196
|
+
} };
|
|
38197
|
+
}
|
|
38198
|
+
function codexAdmissionReceipt(admission) {
|
|
38199
|
+
return admission?.nativeAdmission === "unavailable" && admission.probe ? { nativeAdmission: "unavailable", nativeAdmissionProbe: { ...admission.probe } } : {};
|
|
38200
|
+
}
|
|
38180
38201
|
function physicalTarget(path) {
|
|
38181
38202
|
const suffix = [];
|
|
38182
38203
|
for (let cursor = path;; cursor = dirname5(cursor)) {
|
|
@@ -38258,13 +38279,246 @@ function executable(options) {
|
|
|
38258
38279
|
const digest2 = hash2();
|
|
38259
38280
|
if (options.codexSha256 && digest2 !== options.codexSha256)
|
|
38260
38281
|
return fail();
|
|
38261
|
-
return { path, assertCurrent() {
|
|
38282
|
+
return { path, sha256: digest2, size: Number(initial.size), assertCurrent() {
|
|
38262
38283
|
const current = statSync4(path, { bigint: true });
|
|
38263
38284
|
if (realpathSync4(found) !== path || ["dev", "ino", "size", "mtimeNs", "ctimeNs", "mode"].some((key) => initial[key] !== current[key]) || hash2() !== digest2)
|
|
38264
38285
|
fail();
|
|
38265
38286
|
} };
|
|
38266
38287
|
}
|
|
38267
|
-
|
|
38288
|
+
var PROBE = { timeout: 5000, maxBuffer: 4096, killSignal: "SIGKILL", encoding: "utf8" };
|
|
38289
|
+
var UNRECOGNIZED = /^error: unrecognized subcommand 'corpus-admission-inspect'(?:\r?\n|$)/;
|
|
38290
|
+
var VERSION = /^codex-cli (?:0|[1-9][0-9]{0,5})\.(?:0|[1-9][0-9]{0,5})\.(?:0|[1-9][0-9]{0,5})(?:-[0-9A-Za-z-]{1,32}(?:\.[0-9A-Za-z-]{1,32}){0,7})?$/;
|
|
38291
|
+
var LOCK_DIRECTORY = "codex-corpus-locks";
|
|
38292
|
+
var PROBE_PARENT = "codex-probe-homes";
|
|
38293
|
+
var retain = (hold) => {
|
|
38294
|
+
hold.refs++;
|
|
38295
|
+
return { hold, released: false };
|
|
38296
|
+
};
|
|
38297
|
+
var release = (ref) => {
|
|
38298
|
+
if (ref.released)
|
|
38299
|
+
return;
|
|
38300
|
+
ref.released = true;
|
|
38301
|
+
if (--ref.hold.refs === 0)
|
|
38302
|
+
ref.hold.lock.close();
|
|
38303
|
+
};
|
|
38304
|
+
var enclosing = new AsyncLocalStorage;
|
|
38305
|
+
var leaseHolds = new WeakMap;
|
|
38306
|
+
var contains = (base, path) => {
|
|
38307
|
+
const distance = relative4(base, path);
|
|
38308
|
+
return distance === "" || !distance.startsWith(`..${sep3}`) && distance !== ".." && !isAbsolute4(distance);
|
|
38309
|
+
};
|
|
38310
|
+
function nativeLockAbsent(root) {
|
|
38311
|
+
for (const name of [`${KEY}.flock-v1`, `${KEY}.lock`]) {
|
|
38312
|
+
try {
|
|
38313
|
+
lstatSync7(join11(root, name));
|
|
38314
|
+
return false;
|
|
38315
|
+
} catch (error) {
|
|
38316
|
+
if (error.code !== "ENOENT")
|
|
38317
|
+
throw error;
|
|
38318
|
+
}
|
|
38319
|
+
}
|
|
38320
|
+
return true;
|
|
38321
|
+
}
|
|
38322
|
+
function skillsState(root, leaf, roots) {
|
|
38323
|
+
const chain = [realpathSync4(dirname5(root))];
|
|
38324
|
+
for (const part of [".hasna", "skills", leaf])
|
|
38325
|
+
chain.push(join11(chain.at(-1), part));
|
|
38326
|
+
const path = chain.at(-1);
|
|
38327
|
+
const uid = process.getuid();
|
|
38328
|
+
const verify = () => {
|
|
38329
|
+
if (roots.some((item) => contains(item, path)) || codexCorpusRootForPath(path) !== undefined)
|
|
38330
|
+
fail();
|
|
38331
|
+
for (let ancestor = dirname5(chain[0]);; ancestor = dirname5(ancestor)) {
|
|
38332
|
+
const stat = lstatSync7(ancestor), sticky = stat.uid === 0 && (stat.mode & 512) !== 0;
|
|
38333
|
+
if (!stat.isDirectory() || stat.uid !== uid && stat.uid !== 0 || (stat.mode & 18) !== 0 && !sticky)
|
|
38334
|
+
fail();
|
|
38335
|
+
if (dirname5(ancestor) === ancestor)
|
|
38336
|
+
break;
|
|
38337
|
+
}
|
|
38338
|
+
for (const component of chain) {
|
|
38339
|
+
const stat = lstatSync7(component, { throwIfNoEntry: false });
|
|
38340
|
+
if (!stat)
|
|
38341
|
+
return;
|
|
38342
|
+
if (!stat.isDirectory() || stat.uid !== uid && stat.uid !== 0 || (stat.mode & 18) !== 0 || component === path && stat.uid !== uid)
|
|
38343
|
+
fail();
|
|
38344
|
+
}
|
|
38345
|
+
};
|
|
38346
|
+
verify();
|
|
38347
|
+
return { path, ensure() {
|
|
38348
|
+
verify();
|
|
38349
|
+
for (const component of chain.slice(1)) {
|
|
38350
|
+
try {
|
|
38351
|
+
mkdirSync4(component, { mode: 448 });
|
|
38352
|
+
} catch (error) {
|
|
38353
|
+
if (error.code !== "EEXIST")
|
|
38354
|
+
throw error;
|
|
38355
|
+
}
|
|
38356
|
+
}
|
|
38357
|
+
verify();
|
|
38358
|
+
if (realpathSync4(path) !== path)
|
|
38359
|
+
fail();
|
|
38360
|
+
return path;
|
|
38361
|
+
} };
|
|
38362
|
+
}
|
|
38363
|
+
function probeParent(roots) {
|
|
38364
|
+
const dataRoot = resolve4(getDataDirReadOnly()), path = join11(dataRoot, PROBE_PARENT), uid = process.getuid();
|
|
38365
|
+
const chain = [];
|
|
38366
|
+
for (let component = path;; component = dirname5(component)) {
|
|
38367
|
+
chain.unshift(component);
|
|
38368
|
+
if (dirname5(component) === component)
|
|
38369
|
+
break;
|
|
38370
|
+
}
|
|
38371
|
+
const verify = () => {
|
|
38372
|
+
if (roots.some((item) => contains(item, path)) || codexCorpusRootForPath(path) !== undefined)
|
|
38373
|
+
fail();
|
|
38374
|
+
for (const component of chain) {
|
|
38375
|
+
const stat = lstatSync7(component, { throwIfNoEntry: false });
|
|
38376
|
+
if (!stat)
|
|
38377
|
+
return;
|
|
38378
|
+
const skills = contains(dataRoot, component), sticky = !skills && stat.uid === 0 && (stat.mode & 512) !== 0;
|
|
38379
|
+
if (!stat.isDirectory() || stat.uid !== uid && (skills || stat.uid !== 0) || (stat.mode & 18) !== 0 && !sticky)
|
|
38380
|
+
fail();
|
|
38381
|
+
}
|
|
38382
|
+
};
|
|
38383
|
+
verify();
|
|
38384
|
+
for (const component of chain) {
|
|
38385
|
+
if (lstatSync7(component, { throwIfNoEntry: false }))
|
|
38386
|
+
continue;
|
|
38387
|
+
try {
|
|
38388
|
+
mkdirSync4(component, { mode: 448 });
|
|
38389
|
+
} catch (error) {
|
|
38390
|
+
if (error.code !== "EEXIST")
|
|
38391
|
+
throw error;
|
|
38392
|
+
}
|
|
38393
|
+
}
|
|
38394
|
+
verify();
|
|
38395
|
+
if (realpathSync4(path) !== path)
|
|
38396
|
+
fail();
|
|
38397
|
+
return path;
|
|
38398
|
+
}
|
|
38399
|
+
function probeHomeIntact(home, empty) {
|
|
38400
|
+
const stat = lstatSync7(home.path, { bigint: true, throwIfNoEntry: false });
|
|
38401
|
+
return !!stat && stat.isDirectory() && stat.dev === home.dev && stat.ino === home.ino && stat.uid === BigInt(process.getuid()) && (stat.mode & 0o777n) === 0o700n && realpathSync4(home.path) === home.path && (!empty || readdirSync3(home.path).length === 0);
|
|
38402
|
+
}
|
|
38403
|
+
function removeProbeHome(home) {
|
|
38404
|
+
try {
|
|
38405
|
+
const stat = lstatSync7(home.path, { bigint: true });
|
|
38406
|
+
if (stat.isDirectory() && stat.dev === home.dev && stat.ino === home.ino)
|
|
38407
|
+
rmSync(home.path, { recursive: true, force: true });
|
|
38408
|
+
} catch {}
|
|
38409
|
+
}
|
|
38410
|
+
function probe(path, args, parent, stdio) {
|
|
38411
|
+
const created = mkdtempSync(join11(parent, "probe-")), stat = lstatSync7(created, { bigint: true });
|
|
38412
|
+
const home = { path: created, dev: stat.dev, ino: stat.ino };
|
|
38413
|
+
try {
|
|
38414
|
+
if (!probeHomeIntact(home, true))
|
|
38415
|
+
return;
|
|
38416
|
+
const env = { CODEX_HOME: home.path };
|
|
38417
|
+
for (const key of ["PATH", "HOME"])
|
|
38418
|
+
if (process.env[key] !== undefined)
|
|
38419
|
+
env[key] = process.env[key];
|
|
38420
|
+
const result = spawnSync5(path, args, { ...PROBE, cwd: home.path, env, stdio: ["ignore", stdio, stdio] });
|
|
38421
|
+
return probeHomeIntact(home, false) ? result : undefined;
|
|
38422
|
+
} finally {
|
|
38423
|
+
removeProbeHome(home);
|
|
38424
|
+
}
|
|
38425
|
+
}
|
|
38426
|
+
function probeAdmissionCommand(path, parent) {
|
|
38427
|
+
const help = probe(path, ["help", "corpus-admission-inspect"], parent, "pipe");
|
|
38428
|
+
if (!help || help.error || help.signal !== null)
|
|
38429
|
+
return "inconclusive";
|
|
38430
|
+
if (help.status === 0)
|
|
38431
|
+
return "present";
|
|
38432
|
+
if (help.status !== 2 || help.stdout !== "" || typeof help.stderr !== "string" || !UNRECOGNIZED.test(help.stderr))
|
|
38433
|
+
return "inconclusive";
|
|
38434
|
+
const control = probe(path, ["help", "exec"], parent, "ignore");
|
|
38435
|
+
return control && !control.error && control.signal === null && control.status === 0 ? "absent" : "inconclusive";
|
|
38436
|
+
}
|
|
38437
|
+
function strictVersion(path, parent) {
|
|
38438
|
+
const result = probe(path, ["--version"], parent, "pipe");
|
|
38439
|
+
if (!result || result.error || result.signal !== null || result.status !== 0 || typeof result.stdout !== "string")
|
|
38440
|
+
return;
|
|
38441
|
+
const line = result.stdout.replace(/\r?\n$/, "");
|
|
38442
|
+
return VERSION.test(line) ? line : undefined;
|
|
38443
|
+
}
|
|
38444
|
+
function rootLockKey(root, id2) {
|
|
38445
|
+
return `codex-corpus-${createHash6("sha256").update(`${root}\x00${id2.device}\x00${id2.inode}`).digest("hex")}`;
|
|
38446
|
+
}
|
|
38447
|
+
function acquireFallback(inputs, options) {
|
|
38448
|
+
let reason = "executable-unverified";
|
|
38449
|
+
const refs = new Map, held = [];
|
|
38450
|
+
const close = () => {
|
|
38451
|
+
for (const ref of [...refs.values()].reverse())
|
|
38452
|
+
release(ref);
|
|
38453
|
+
};
|
|
38454
|
+
try {
|
|
38455
|
+
const native = executable(options);
|
|
38456
|
+
reason = "skills-lock-unavailable";
|
|
38457
|
+
const roots = inputs.map((item) => item.root);
|
|
38458
|
+
const locks = new Map(roots.map((root) => [root, skillsState(root, LOCK_DIRECTORY, roots)]));
|
|
38459
|
+
const parent = probeParent(roots);
|
|
38460
|
+
reason = "probe-inconclusive";
|
|
38461
|
+
const state = probeAdmissionCommand(native.path, parent);
|
|
38462
|
+
if (state === "present")
|
|
38463
|
+
reason = "command-present";
|
|
38464
|
+
if (state !== "absent")
|
|
38465
|
+
fail();
|
|
38466
|
+
const version2 = strictVersion(native.path, parent);
|
|
38467
|
+
if (version2 === undefined)
|
|
38468
|
+
fail();
|
|
38469
|
+
reason = "executable-unverified";
|
|
38470
|
+
native.assertCurrent();
|
|
38471
|
+
reason = "skills-lock-unavailable";
|
|
38472
|
+
for (const { input, root } of inputs) {
|
|
38473
|
+
const id2 = identity(root), key = rootLockKey(root, id2);
|
|
38474
|
+
if (!refs.has(key)) {
|
|
38475
|
+
const owner = enclosing.getStore()?.get(key);
|
|
38476
|
+
if (owner && !owner.released)
|
|
38477
|
+
refs.set(key, retain(owner.hold));
|
|
38478
|
+
else {
|
|
38479
|
+
const lock = new KernelLock(locks.get(root).ensure(), key, { mode: "exclusive" });
|
|
38480
|
+
refs.set(key, retain({ lock, refs: 0 }));
|
|
38481
|
+
if (!lock.trySync(1000)) {
|
|
38482
|
+
reason = "writer-busy";
|
|
38483
|
+
fail();
|
|
38484
|
+
}
|
|
38485
|
+
}
|
|
38486
|
+
}
|
|
38487
|
+
held.push({ input, root, id: id2, ref: refs.get(key) });
|
|
38488
|
+
}
|
|
38489
|
+
const assertCurrent = () => {
|
|
38490
|
+
try {
|
|
38491
|
+
for (const item of held) {
|
|
38492
|
+
if (item.ref.released)
|
|
38493
|
+
fail();
|
|
38494
|
+
item.ref.hold.lock.assertUnchanged();
|
|
38495
|
+
if (realpathSync4(item.input) !== item.root || !sameIdentity(identity(item.root), item.id) || !nativeLockAbsent(item.root))
|
|
38496
|
+
fail();
|
|
38497
|
+
}
|
|
38498
|
+
native.assertCurrent();
|
|
38499
|
+
} catch {
|
|
38500
|
+
fail("lease-changed");
|
|
38501
|
+
}
|
|
38502
|
+
};
|
|
38503
|
+
reason = "lease-changed";
|
|
38504
|
+
assertCurrent();
|
|
38505
|
+
const lease = { assertCurrent, close, admission: { nativeAdmission: "unavailable", probe: {
|
|
38506
|
+
kind: "help-unrecognized-subcommand",
|
|
38507
|
+
executable: native.path,
|
|
38508
|
+
sha256: native.sha256,
|
|
38509
|
+
size: native.size,
|
|
38510
|
+
version: version2,
|
|
38511
|
+
probeExitCode: 2,
|
|
38512
|
+
controlExitCode: 0
|
|
38513
|
+
} } };
|
|
38514
|
+
leaseHolds.set(lease, refs);
|
|
38515
|
+
return lease;
|
|
38516
|
+
} catch {
|
|
38517
|
+
close();
|
|
38518
|
+
return fail(reason);
|
|
38519
|
+
}
|
|
38520
|
+
}
|
|
38521
|
+
function acquireCodexCorpusWrite(roots, options, policy = {}) {
|
|
38268
38522
|
const held = [];
|
|
38269
38523
|
const close = () => {
|
|
38270
38524
|
for (const item of held.reverse())
|
|
@@ -38277,10 +38531,20 @@ function acquireCodexCorpusWrite(roots, options) {
|
|
|
38277
38531
|
fail();
|
|
38278
38532
|
}
|
|
38279
38533
|
};
|
|
38534
|
+
let fallback = false, refusal;
|
|
38280
38535
|
try {
|
|
38281
38536
|
if (roots.some((root) => typeof root !== "string" || !isAbsolute4(root) || root.includes("\x00")))
|
|
38282
38537
|
fail();
|
|
38283
38538
|
const inputs = [...new Set(roots)].map((input) => ({ input, root: realpathSync4(input) })).sort((a, b) => a.root.localeCompare(b.root));
|
|
38539
|
+
const absent = inputs.filter(({ root }) => nativeLockAbsent(root));
|
|
38540
|
+
if (absent.length && absent.length !== inputs.length) {
|
|
38541
|
+
refusal = "native-lock-present";
|
|
38542
|
+
fail();
|
|
38543
|
+
}
|
|
38544
|
+
if (absent.length && policy.fallback !== false) {
|
|
38545
|
+
fallback = true;
|
|
38546
|
+
return acquireFallback(inputs, options);
|
|
38547
|
+
}
|
|
38284
38548
|
for (const { input, root } of inputs) {
|
|
38285
38549
|
const lock = new KernelLock(root, KEY, { mode: "shared", existingOnly: true });
|
|
38286
38550
|
held.push({ input, root, lock });
|
|
@@ -38308,19 +38572,25 @@ function acquireCodexCorpusWrite(roots, options) {
|
|
|
38308
38572
|
if (Object.keys(row).sort().join(",") !== "lock,root,schema,state" || row.schema !== "codex-corpus-admission-status/v1" || row.state !== "committed-v1" && row.state !== "committed-v2" || !sameIdentity(row.root, rootIdentity) || !sameIdentity(row.lock, lockIdentity))
|
|
38309
38573
|
fail();
|
|
38310
38574
|
}
|
|
38311
|
-
return { assertCurrent, close };
|
|
38312
|
-
} catch {
|
|
38575
|
+
return { assertCurrent, close, admission: { nativeAdmission: "verified" } };
|
|
38576
|
+
} catch (error) {
|
|
38577
|
+
if (fallback)
|
|
38578
|
+
throw error;
|
|
38313
38579
|
close();
|
|
38314
|
-
return fail();
|
|
38580
|
+
return fail(refusal);
|
|
38315
38581
|
}
|
|
38316
38582
|
}
|
|
38317
|
-
function
|
|
38583
|
+
function scoped(lease, run) {
|
|
38584
|
+
const holds = leaseHolds.get(lease);
|
|
38585
|
+
return holds?.size ? enclosing.run(new Map([...enclosing.getStore() ?? [], ...holds]), run) : run();
|
|
38586
|
+
}
|
|
38587
|
+
function withCodexCorpusWrite(roots, run, options = {}, policy = {}) {
|
|
38318
38588
|
if (!roots.length)
|
|
38319
38589
|
return run(() => {});
|
|
38320
|
-
const lease = acquireCodexCorpusWrite(roots, options);
|
|
38590
|
+
const lease = acquireCodexCorpusWrite(roots, options, policy);
|
|
38321
38591
|
try {
|
|
38322
38592
|
lease.assertCurrent();
|
|
38323
|
-
const result = run(lease.assertCurrent);
|
|
38593
|
+
const result = scoped(lease, () => run(lease.assertCurrent, lease.admission));
|
|
38324
38594
|
lease.assertCurrent();
|
|
38325
38595
|
return result;
|
|
38326
38596
|
} finally {
|
|
@@ -38329,7 +38599,7 @@ function withCodexCorpusWrite(roots, run, options = {}) {
|
|
|
38329
38599
|
}
|
|
38330
38600
|
|
|
38331
38601
|
// src/lib/installer.ts
|
|
38332
|
-
import { existsSync as existsSync14, readFileSync as readFileSync27, rmSync as
|
|
38602
|
+
import { existsSync as existsSync14, readFileSync as readFileSync27, rmSync as rmSync5 } from "fs";
|
|
38333
38603
|
import { join as join41 } from "path";
|
|
38334
38604
|
import { homedir as homedir6 } from "os";
|
|
38335
38605
|
|
|
@@ -38338,12 +38608,12 @@ import {
|
|
|
38338
38608
|
cpSync as cpSync2,
|
|
38339
38609
|
existsSync as existsSync11,
|
|
38340
38610
|
lstatSync as lstatSync33,
|
|
38341
|
-
mkdirSync as
|
|
38342
|
-
mkdtempSync as
|
|
38611
|
+
mkdirSync as mkdirSync11,
|
|
38612
|
+
mkdtempSync as mkdtempSync3,
|
|
38343
38613
|
readFileSync as readFileSync24,
|
|
38344
|
-
readdirSync as
|
|
38614
|
+
readdirSync as readdirSync14,
|
|
38345
38615
|
renameSync as renameSync6,
|
|
38346
|
-
rmSync as
|
|
38616
|
+
rmSync as rmSync4,
|
|
38347
38617
|
statSync as statSync13,
|
|
38348
38618
|
writeFileSync as writeFileSync8
|
|
38349
38619
|
} from "fs";
|
|
@@ -38812,7 +39082,7 @@ function isCodexLocalStdioMcpServer(name, server) {
|
|
|
38812
39082
|
|
|
38813
39083
|
// src/lib/codex-plugin-skill-controls.ts
|
|
38814
39084
|
import { basename as basename4, dirname as dirname7, join as join13, relative as relative5, resolve as resolve6, sep as sep4 } from "path";
|
|
38815
|
-
import { lstatSync as lstatSync9, readdirSync as
|
|
39085
|
+
import { lstatSync as lstatSync9, readdirSync as readdirSync4, readFileSync as readFileSync11, readlinkSync as readlinkSync2, realpathSync as realpathSync7 } from "fs";
|
|
38816
39086
|
|
|
38817
39087
|
// src/lib/codex-native-compatibility.ts
|
|
38818
39088
|
var MEASURED_CODEX_CAPABILITIES = {
|
|
@@ -38954,6 +39224,7 @@ async function connectCodexHookRpc(options) {
|
|
|
38954
39224
|
const rpc = {
|
|
38955
39225
|
version: version2,
|
|
38956
39226
|
processId: child.pid,
|
|
39227
|
+
admission: corpusLease.admission,
|
|
38957
39228
|
request(method, params) {
|
|
38958
39229
|
if (stopped)
|
|
38959
39230
|
return Promise.reject(new Error(configInvalid ? CODEX_CONFIG_INVALID : "CODEX_HOOK_TRUST_NATIVE_RPC_CLOSED"));
|
|
@@ -39407,7 +39678,7 @@ function reviewedRetiredCodexRoot(cache, root, controls, rules, read, allowAbsen
|
|
|
39407
39678
|
if (!enrolled.some((control) => control.namespace === parsed.namespace && control.manifestSha256 === parsed.manifestSha256 && !parsed.appSha256 && !parsed.mcpSha256))
|
|
39408
39679
|
return false;
|
|
39409
39680
|
let entries = 0;
|
|
39410
|
-
const emptySkills = (directory, depth) => depth <= 64 &&
|
|
39681
|
+
const emptySkills = (directory, depth) => depth <= 64 && readdirSync4(directory).every((name) => {
|
|
39411
39682
|
if (++entries > 4096 || name === "SKILL.md")
|
|
39412
39683
|
return false;
|
|
39413
39684
|
const path = join13(directory, name), stat = lstatSync9(path);
|
|
@@ -39432,7 +39703,7 @@ function reviewedCodexPluginCapabilitiesUnchanged(cache, controls, read, rules)
|
|
|
39432
39703
|
if (control.remotePluginId !== undefined && !remoteInstallationMatches(parent, control.remotePluginId, read))
|
|
39433
39704
|
return false;
|
|
39434
39705
|
}
|
|
39435
|
-
const names =
|
|
39706
|
+
const names = readdirSync4(parent);
|
|
39436
39707
|
entries += names.length;
|
|
39437
39708
|
if (entries > 4096)
|
|
39438
39709
|
return false;
|
|
@@ -39622,7 +39893,7 @@ enabled = false
|
|
|
39622
39893
|
|
|
39623
39894
|
// src/lib/codex-native-skill-policy.ts
|
|
39624
39895
|
import { createHash as createHash10, randomUUID as randomUUID2 } from "crypto";
|
|
39625
|
-
import { closeSync as closeSync12, constants as constants9, fstatSync as fstatSync12, fsyncSync as fsyncSync2, lstatSync as lstatSync10, mkdirSync as
|
|
39896
|
+
import { closeSync as closeSync12, constants as constants9, fstatSync as fstatSync12, fsyncSync as fsyncSync2, lstatSync as lstatSync10, mkdirSync as mkdirSync5, openSync as openSync12, readFileSync as readFileSync12, readSync as readSync5, readlinkSync as readlinkSync3, realpathSync as realpathSync8, renameSync as renameSync2, unlinkSync as unlinkSync3, writeFileSync as writeFileSync3 } from "fs";
|
|
39626
39897
|
import { dirname as dirname8, isAbsolute as isAbsolute8, join as join14, resolve as resolve7 } from "path";
|
|
39627
39898
|
import { isDeepStrictEqual as isDeepStrictEqual3 } from "util";
|
|
39628
39899
|
var CODEX_NATIVE_POLICY_CAPABILITY = "host-path-allowlist-v1";
|
|
@@ -39891,7 +40162,7 @@ function writeExecutableCache(dataDir2, entries) {
|
|
|
39891
40162
|
return;
|
|
39892
40163
|
const existing = lstatSync10(directory, { throwIfNoEntry: false });
|
|
39893
40164
|
if (!existing)
|
|
39894
|
-
|
|
40165
|
+
mkdirSync5(directory, { mode: 448 });
|
|
39895
40166
|
else if (existing.isSymbolicLink() || !existing.isDirectory())
|
|
39896
40167
|
return;
|
|
39897
40168
|
const holder = lstatSync10(directory, { throwIfNoEntry: false, bigint: true });
|
|
@@ -40186,7 +40457,7 @@ function recordCodexNativePolicyAcceptance(dataDir2, verification, accepted) {
|
|
|
40186
40457
|
...verification.attestation ? { attestation: { schema: verification.attestation.schema, peerProcessId: verification.attestation.peerProcessId } } : {}
|
|
40187
40458
|
};
|
|
40188
40459
|
try {
|
|
40189
|
-
|
|
40460
|
+
mkdirSync5(directory, { recursive: true, mode: 448 });
|
|
40190
40461
|
const stat = lstatSync10(directory);
|
|
40191
40462
|
if (stat.isSymbolicLink() || !stat.isDirectory())
|
|
40192
40463
|
throw new Error(`the receipt directory is not a real directory: ${directory}`);
|
|
@@ -41941,7 +42212,7 @@ function captureCodexSettingsV6(path, reviewedSources, budget2 = { remaining: 25
|
|
|
41941
42212
|
|
|
41942
42213
|
// src/lib/codex-semantic-cache-witness.ts
|
|
41943
42214
|
import { createHash as createHash18 } from "crypto";
|
|
41944
|
-
import { constants as constants12, closeSync as closeSync15, fstatSync as fstatSync15, lstatSync as lstatSync14, openSync as openSync15, readSync as readSync8, readdirSync as
|
|
42215
|
+
import { constants as constants12, closeSync as closeSync15, fstatSync as fstatSync15, lstatSync as lstatSync14, openSync as openSync15, readSync as readSync8, readdirSync as readdirSync5, realpathSync as realpathSync9 } from "fs";
|
|
41945
42216
|
import { basename as basename9, dirname as dirname14, isAbsolute as isAbsolute15, join as join18, relative as relative6, resolve as resolve14, sep as sep8 } from "path";
|
|
41946
42217
|
var CODEX_SEMANTIC_CACHE_WITNESS_SCHEMA = "hasna.codex-semantic-cache-witness.v1";
|
|
41947
42218
|
var identifier5 = (value) => typeof value === "string" && /^[A-Za-z0-9_-]{1,64}$/.test(value);
|
|
@@ -42106,7 +42377,7 @@ function assertCanonicalDirectory(path) {
|
|
|
42106
42377
|
function walkSafeTree(path, state, depth = 0, root = path) {
|
|
42107
42378
|
if (depth > 64 || ++state.entries > 16384)
|
|
42108
42379
|
refuse5();
|
|
42109
|
-
const names =
|
|
42380
|
+
const names = readdirSync5(path).sort();
|
|
42110
42381
|
const files = [];
|
|
42111
42382
|
for (const name of names) {
|
|
42112
42383
|
if (!name || name === "." || name === ".." || name.includes(sep8) || ++state.entries > 16384)
|
|
@@ -42252,7 +42523,7 @@ function appOnlyParentProjection(cacheRoot, parents2, read) {
|
|
|
42252
42523
|
} catch {
|
|
42253
42524
|
refuse5();
|
|
42254
42525
|
}
|
|
42255
|
-
const versions =
|
|
42526
|
+
const versions = readdirSync5(parent.pluginParent).filter((name) => name !== ".codex-remote-plugin-install.json");
|
|
42256
42527
|
if (!versions.length || versions.length > 4096)
|
|
42257
42528
|
refuse5();
|
|
42258
42529
|
const materializations = versions.map((version2) => {
|
|
@@ -42397,7 +42668,7 @@ function reviewedHookParentProjection(cacheRoot, parents2, read) {
|
|
|
42397
42668
|
if (createHash18("sha256").update(marketplaceText).digest("hex") !== parent.marketplaceSha256 || !codexLocalMarketplaceMapsPlugin(marketplaceText, parts[0], parent.namespace))
|
|
42398
42669
|
refuse5();
|
|
42399
42670
|
}
|
|
42400
|
-
const materializations =
|
|
42671
|
+
const materializations = readdirSync5(parent.pluginParent).filter((name) => name !== ".codex-remote-plugin-install.json").map((version2) => {
|
|
42401
42672
|
if (!/^[A-Za-z0-9][A-Za-z0-9._+-]{0,127}$/.test(version2))
|
|
42402
42673
|
refuse5();
|
|
42403
42674
|
const root = join18(parent.pluginParent, version2), stat = lstatSync14(root, { throwIfNoEntry: false });
|
|
@@ -42431,14 +42702,14 @@ function assertParents(cacheRoot, controls, appOnlyParents, hookParents, files,
|
|
|
42431
42702
|
refuse5();
|
|
42432
42703
|
actual.add(join18(cacheRoot, parts[0], parts[1]));
|
|
42433
42704
|
}
|
|
42434
|
-
const actualMarkets =
|
|
42705
|
+
const actualMarkets = readdirSync5(cacheRoot);
|
|
42435
42706
|
if (actualMarkets.length !== expectedMarkets.size || actualMarkets.some((market) => !expectedMarkets.has(market)))
|
|
42436
42707
|
refuse5();
|
|
42437
42708
|
for (const market of actualMarkets) {
|
|
42438
42709
|
const marketPath = join18(cacheRoot, market), marketStat = lstatSync14(marketPath);
|
|
42439
42710
|
if (!identifier5(market) || !marketStat.isDirectory() || marketStat.isSymbolicLink())
|
|
42440
42711
|
refuse5();
|
|
42441
|
-
for (const plugin of
|
|
42712
|
+
for (const plugin of readdirSync5(marketPath)) {
|
|
42442
42713
|
const parent = join18(marketPath, plugin), stat = lstatSync14(parent);
|
|
42443
42714
|
if (!identifier5(plugin) || !stat.isDirectory() || stat.isSymbolicLink())
|
|
42444
42715
|
refuse5();
|
|
@@ -42490,7 +42761,7 @@ function assertSkillMaterializations(cacheRoot, controls, files, read) {
|
|
|
42490
42761
|
const expectedNames = new Set(rows.map((row) => row.name));
|
|
42491
42762
|
if (expectedNames.size !== rows.length)
|
|
42492
42763
|
refuse5();
|
|
42493
|
-
const entries =
|
|
42764
|
+
const entries = readdirSync5(parent);
|
|
42494
42765
|
let roots = 0;
|
|
42495
42766
|
for (const entry of entries) {
|
|
42496
42767
|
if (entry === ".codex-remote-plugin-install.json")
|
|
@@ -42705,7 +42976,7 @@ var NATIVE_SKILL_ROOTS = [
|
|
|
42705
42976
|
];
|
|
42706
42977
|
|
|
42707
42978
|
// src/lib/codex-vendor-refresh.ts
|
|
42708
|
-
import { lstatSync as lstatSync15, readdirSync as
|
|
42979
|
+
import { lstatSync as lstatSync15, readdirSync as readdirSync6, readFileSync as readFileSync13 } from "fs";
|
|
42709
42980
|
import { isAbsolute as isAbsolute16, join as join19, relative as relative7, resolve as resolve15, sep as sep9 } from "path";
|
|
42710
42981
|
import { isDeepStrictEqual as isDeepStrictEqual7 } from "util";
|
|
42711
42982
|
var CODEX_VENDOR_MARKETPLACES = Object.freeze(["openai-bundled", "openai-curated", "openai-curated-remote"]);
|
|
@@ -42736,11 +43007,11 @@ var MAX_SUBTREE_DEPTH = 32;
|
|
|
42736
43007
|
var hiddenName = (name) => name.startsWith(".") || name === "node_modules";
|
|
42737
43008
|
var isSkillDocument = (name) => name.toLowerCase() === "skill.md";
|
|
42738
43009
|
var present = (path) => lstatSync15(path, { throwIfNoEntry: false }) !== undefined;
|
|
42739
|
-
var holdsOtherControl = (path) =>
|
|
43010
|
+
var holdsOtherControl = (path) => readdirSync6(path).some((name) => OTHER_PLUGIN_CONTROLS.includes(name.toLowerCase()));
|
|
42740
43011
|
function pluginTreeVisible(path, hidden, insideSkill, depth, budget2) {
|
|
42741
43012
|
if (depth > MAX_SUBTREE_DEPTH)
|
|
42742
43013
|
return false;
|
|
42743
|
-
const names =
|
|
43014
|
+
const names = readdirSync6(path);
|
|
42744
43015
|
const skill = names.some(isSkillDocument);
|
|
42745
43016
|
if (skill && (hidden || insideSkill))
|
|
42746
43017
|
return false;
|
|
@@ -42764,7 +43035,7 @@ function codexVendorPluginRootRefreshSafe(root, budget2 = { remaining: MAX_SUBTR
|
|
|
42764
43035
|
return false;
|
|
42765
43036
|
if (!directory(join19(root, ".codex-plugin")))
|
|
42766
43037
|
return false;
|
|
42767
|
-
const controls =
|
|
43038
|
+
const controls = readdirSync6(join19(root, ".codex-plugin"));
|
|
42768
43039
|
if (controls.length !== 1 || controls[0] !== "plugin.json")
|
|
42769
43040
|
return false;
|
|
42770
43041
|
const manifest = join19(root, ".codex-plugin", "plugin.json"), stat = lstatSync15(manifest, { throwIfNoEntry: false });
|
|
@@ -42787,7 +43058,7 @@ function codexVendorPluginRootRefreshSafe(root, budget2 = { remaining: MAX_SUBTR
|
|
|
42787
43058
|
}
|
|
42788
43059
|
function vendorMembers(path, budget2) {
|
|
42789
43060
|
const directories = [];
|
|
42790
|
-
for (const name of
|
|
43061
|
+
for (const name of readdirSync6(path)) {
|
|
42791
43062
|
if (--budget2.remaining < 0)
|
|
42792
43063
|
return null;
|
|
42793
43064
|
const stat = lstatSync15(join19(path, name));
|
|
@@ -42980,7 +43251,7 @@ function codexPluginCacheSkillTree(path, depth) {
|
|
|
42980
43251
|
// src/lib/agent-integration.ts
|
|
42981
43252
|
import { createHash as createHash30, randomUUID as randomUUID4 } from "crypto";
|
|
42982
43253
|
import { isDeepStrictEqual as isDeepStrictEqual10 } from "util";
|
|
42983
|
-
import { existsSync as existsSync7, lstatSync as lstatSync30, statSync as statSync9, mkdirSync as
|
|
43254
|
+
import { existsSync as existsSync7, lstatSync as lstatSync30, statSync as statSync9, mkdirSync as mkdirSync8, readFileSync as readFileSync21, readdirSync as readdirSync11, opendirSync as opendirSync5, readlinkSync as readlinkSync7, realpathSync as realpathSync13, renameSync as renameSync4, rmdirSync as rmdirSync3, writeFileSync as writeFileSync5, unlinkSync as unlinkSync5, chmodSync, openSync as openSync23, closeSync as closeSync23, fsyncSync as fsyncSync7, fstatSync as fstatSync23, readSync as readSync15, constants as constants21, linkSync as linkSync3 } from "fs";
|
|
42984
43255
|
import { basename as basename13, dirname as dirname24, join as join33, resolve as resolve27, relative as relative9, isAbsolute as isAbsolute29, sep as sep14 } from "path";
|
|
42985
43256
|
import { homedir as homedir3 } from "os";
|
|
42986
43257
|
|
|
@@ -43066,7 +43337,7 @@ function requiresCliSkillLoading(dataDir2 = getDataDirReadOnly()) {
|
|
|
43066
43337
|
|
|
43067
43338
|
// src/lib/agent-bridge.ts
|
|
43068
43339
|
import { createHash as createHash19 } from "crypto";
|
|
43069
|
-
import { lstatSync as lstatSync18, readFileSync as readFileSync15, readdirSync as
|
|
43340
|
+
import { lstatSync as lstatSync18, readFileSync as readFileSync15, readdirSync as readdirSync7 } from "fs";
|
|
43070
43341
|
import { join as join22 } from "path";
|
|
43071
43342
|
var CLI_BRIDGE_NAME = "skills-cli";
|
|
43072
43343
|
var CLI_BRIDGE_VERSION = 1;
|
|
@@ -43096,7 +43367,7 @@ function isOwnedCliBridge(path, expectedPaths) {
|
|
|
43096
43367
|
try {
|
|
43097
43368
|
if (!lstatSync18(path).isDirectory())
|
|
43098
43369
|
return false;
|
|
43099
|
-
if (JSON.stringify(
|
|
43370
|
+
if (JSON.stringify(readdirSync7(path).sort()) !== JSON.stringify(Object.keys(CLI_BRIDGE_FILES).sort()))
|
|
43100
43371
|
return false;
|
|
43101
43372
|
return Object.entries(CLI_BRIDGE_FILES).every(([name, content]) => {
|
|
43102
43373
|
const file = join22(path, name), stat = lstatSync18(file);
|
|
@@ -43109,7 +43380,7 @@ function isOwnedCliBridge(path, expectedPaths) {
|
|
|
43109
43380
|
|
|
43110
43381
|
// src/lib/agent-discovery.ts
|
|
43111
43382
|
import { createHash as createHash28 } from "crypto";
|
|
43112
|
-
import { lstatSync as lstatSync28, readFileSync as readFileSync19, readdirSync as
|
|
43383
|
+
import { lstatSync as lstatSync28, readFileSync as readFileSync19, readdirSync as readdirSync10, realpathSync as realpathSync11 } from "fs";
|
|
43113
43384
|
import { basename as basename12, dirname as dirname23, isAbsolute as isAbsolute27, join as join32, relative as relative8, resolve as resolve26, sep as sep13 } from "path";
|
|
43114
43385
|
import { isDeepStrictEqual as isDeepStrictEqual8 } from "util";
|
|
43115
43386
|
|
|
@@ -43368,7 +43639,7 @@ if (failed) process.exitCode = 2;
|
|
|
43368
43639
|
|
|
43369
43640
|
// src/lib/plugin-projection-store.ts
|
|
43370
43641
|
import { createHash as createHash21, randomUUID as randomUUID3 } from "crypto";
|
|
43371
|
-
import { constants as constants14, closeSync as closeSync17, fchmodSync, fstatSync as fstatSync17, fsyncSync as fsyncSync3, linkSync as linkSync2, lstatSync as lstatSync20, mkdirSync as
|
|
43642
|
+
import { constants as constants14, closeSync as closeSync17, fchmodSync, fstatSync as fstatSync17, fsyncSync as fsyncSync3, linkSync as linkSync2, lstatSync as lstatSync20, mkdirSync as mkdirSync6, openSync as openSync17, opendirSync as opendirSync3, readSync as readSync10, renameSync as renameSync3, rmdirSync as rmdirSync2, rmSync as rmSync2, unlinkSync as unlinkSync4, writeSync as writeSync2 } from "fs";
|
|
43372
43643
|
import { dirname as dirname17, isAbsolute as isAbsolute18, join as join24, parse as parse5, resolve as resolve18 } from "path";
|
|
43373
43644
|
|
|
43374
43645
|
// src/lib/plugin-projection.ts
|
|
@@ -43604,7 +43875,7 @@ function ancestors(path, create = false) {
|
|
|
43604
43875
|
let currentStat = stat(current);
|
|
43605
43876
|
if (!currentStat && create) {
|
|
43606
43877
|
try {
|
|
43607
|
-
|
|
43878
|
+
mkdirSync6(current, { mode: 448 });
|
|
43608
43879
|
} catch (error) {
|
|
43609
43880
|
if (!(error && typeof error === "object" && ("code" in error) && error.code === "EEXIST"))
|
|
43610
43881
|
pluginRefusal("Cannot create private plugin storage directory");
|
|
@@ -43817,7 +44088,7 @@ function materializePluginTree(root, entries) {
|
|
|
43817
44088
|
let locked, staged;
|
|
43818
44089
|
try {
|
|
43819
44090
|
try {
|
|
43820
|
-
|
|
44091
|
+
mkdirSync6(lock, { mode: 448 });
|
|
43821
44092
|
locked = stat(lock);
|
|
43822
44093
|
} catch {
|
|
43823
44094
|
pluginRefusal("Plugin projection publication is already locked");
|
|
@@ -43827,7 +44098,7 @@ function materializePluginTree(root, entries) {
|
|
|
43827
44098
|
verifyPluginTree(root, witnesses);
|
|
43828
44099
|
return;
|
|
43829
44100
|
}
|
|
43830
|
-
|
|
44101
|
+
mkdirSync6(staging, { mode: 448 });
|
|
43831
44102
|
staged = stat(staging);
|
|
43832
44103
|
for (const entry of entries) {
|
|
43833
44104
|
const path = join24(staging, entry.path);
|
|
@@ -43846,7 +44117,7 @@ function materializePluginTree(root, entries) {
|
|
|
43846
44117
|
} finally {
|
|
43847
44118
|
if (staged) {
|
|
43848
44119
|
same4(staged, stat(staging), true);
|
|
43849
|
-
|
|
44120
|
+
rmSync2(staging, { recursive: true });
|
|
43850
44121
|
}
|
|
43851
44122
|
if (locked) {
|
|
43852
44123
|
same4(locked, stat(lock), true);
|
|
@@ -44191,11 +44462,11 @@ import { homedir as homedir2 } from "os";
|
|
|
44191
44462
|
import { isAbsolute as isAbsolute21, join as join28, resolve as resolve20 } from "path";
|
|
44192
44463
|
|
|
44193
44464
|
// src/lib/skill-validation.ts
|
|
44194
|
-
import { existsSync as existsSync5, lstatSync as lstatSync22, readFileSync as readFileSync18, readdirSync as
|
|
44465
|
+
import { existsSync as existsSync5, lstatSync as lstatSync22, readFileSync as readFileSync18, readdirSync as readdirSync9, statSync as statSync7 } from "fs";
|
|
44195
44466
|
import { isAbsolute as isAbsolute20, join as join27, normalize as normalize3 } from "path";
|
|
44196
44467
|
|
|
44197
44468
|
// src/lib/hosted-skill-set.ts
|
|
44198
|
-
import { existsSync as existsSync4, readFileSync as readFileSync17, readdirSync as
|
|
44469
|
+
import { existsSync as existsSync4, readFileSync as readFileSync17, readdirSync as readdirSync8, statSync as statSync6 } from "fs";
|
|
44199
44470
|
import { join as join26 } from "path";
|
|
44200
44471
|
var HOSTED_RUNTIMES = new Set(["hosted"]);
|
|
44201
44472
|
var HOSTED_SOURCES = new Set(["remote", "private-hosted"]);
|
|
@@ -44424,7 +44695,7 @@ function validateSkillDirectory(name, skillPath, registryMeta) {
|
|
|
44424
44695
|
if (!VALID_BIN_COMMAND.test(bareName)) {
|
|
44425
44696
|
add(issues, "skill.name_invalid", `Skill name '${bareName}' must use lowercase letters, numbers, dots, underscores, or hyphens`);
|
|
44426
44697
|
}
|
|
44427
|
-
for (const entry of
|
|
44698
|
+
for (const entry of readdirSync9(skillPath).sort()) {
|
|
44428
44699
|
const entryPath = join27(skillPath, entry);
|
|
44429
44700
|
if (RESERVED_SKILL_ENTRIES.has(entry)) {
|
|
44430
44701
|
add(issues, "skill.reserved_file", `Reserved file '${entry}' is not allowed in skill packages`);
|
|
@@ -44610,7 +44881,7 @@ function validateRegistryConsistency(registry, skillsDir) {
|
|
|
44610
44881
|
seen.add(name);
|
|
44611
44882
|
return false;
|
|
44612
44883
|
})));
|
|
44613
|
-
const skillDirs = existsSync5(skillsDir) ?
|
|
44884
|
+
const skillDirs = existsSync5(skillsDir) ? readdirSync9(skillsDir).filter((entry) => {
|
|
44614
44885
|
const fullPath = join27(skillsDir, entry);
|
|
44615
44886
|
return !entry.startsWith(".") && entry !== "_common" && statSync7(fullPath).isDirectory();
|
|
44616
44887
|
}) : [];
|
|
@@ -45442,7 +45713,7 @@ function verifiesCodexHookDiscoverySource(binding, source, currentDigest, witnes
|
|
|
45442
45713
|
}
|
|
45443
45714
|
|
|
45444
45715
|
// src/lib/agent-sumi.ts
|
|
45445
|
-
import { spawnSync as
|
|
45716
|
+
import { spawnSync as spawnSync6 } from "child_process";
|
|
45446
45717
|
import { accessSync as accessSync2, constants as constants18, existsSync as existsSync6, lstatSync as lstatSync26, realpathSync as realpathSync10, statSync as statSync8 } from "fs";
|
|
45447
45718
|
import { delimiter as delimiter2, isAbsolute as isAbsolute25, join as join30, resolve as resolve24 } from "path";
|
|
45448
45719
|
|
|
@@ -45600,7 +45871,7 @@ function sumiPathPlan(home, cwd = process.cwd(), env = process.env) {
|
|
|
45600
45871
|
childEnv[key2] = env[key2];
|
|
45601
45872
|
let child2;
|
|
45602
45873
|
try {
|
|
45603
|
-
child2 =
|
|
45874
|
+
child2 = spawnSync6(executable2, ["--json", "--home", resolve24(home), "--cwd", resolve24(cwd)], {
|
|
45604
45875
|
cwd: resolve24(cwd),
|
|
45605
45876
|
env: childEnv,
|
|
45606
45877
|
encoding: "buffer",
|
|
@@ -45761,7 +46032,7 @@ var SUMI_SKILL_PERMISSIONS = [
|
|
|
45761
46032
|
|
|
45762
46033
|
// src/lib/retained-review-artifacts.ts
|
|
45763
46034
|
import { createHash as createHash27 } from "crypto";
|
|
45764
|
-
import { constants as constants19, closeSync as closeSync21, fstatSync as fstatSync21, fsyncSync as fsyncSync5, lstatSync as lstatSync27, mkdirSync as
|
|
46035
|
+
import { constants as constants19, closeSync as closeSync21, fstatSync as fstatSync21, fsyncSync as fsyncSync5, lstatSync as lstatSync27, mkdirSync as mkdirSync7, openSync as openSync21, readSync as readSync14, writeSync as writeSync3 } from "fs";
|
|
45765
46036
|
import { dirname as dirname22, isAbsolute as isAbsolute26, join as join31, resolve as resolve25, sep as sep12 } from "path";
|
|
45766
46037
|
var sha4 = (bytes) => createHash27("sha256").update(bytes).digest("hex");
|
|
45767
46038
|
var hex = (value) => typeof value === "string" && /^[a-f0-9]{64}$/.test(value);
|
|
@@ -45891,7 +46162,7 @@ function writeReviewArtifactExclusive(change) {
|
|
|
45891
46162
|
for (let parent = dirname22(change.path);!lstatSync27(parent, { throwIfNoEntry: false }); parent = dirname22(parent))
|
|
45892
46163
|
missing2.push(parent);
|
|
45893
46164
|
for (const parent of missing2.reverse())
|
|
45894
|
-
|
|
46165
|
+
mkdirSync7(parent, { mode: 448 });
|
|
45895
46166
|
safe5(change.path);
|
|
45896
46167
|
privateStore(change.artifact.storeRoot);
|
|
45897
46168
|
for (let parent = dirname22(change.path);parent !== change.artifact.storeRoot; parent = dirname22(parent)) {
|
|
@@ -46656,13 +46927,13 @@ function assertProjectDiscovery(agent, directories, home, canonical9 = resolve26
|
|
|
46656
46927
|
for (const name of ["plugin", "plugins"]) {
|
|
46657
46928
|
const path = canonical9(join32(directory2, ".sumi", name));
|
|
46658
46929
|
safe6(path);
|
|
46659
|
-
if (lstatSync28(path, { throwIfNoEntry: false })?.isDirectory() &&
|
|
46930
|
+
if (lstatSync28(path, { throwIfNoEntry: false })?.isDirectory() && readdirSync10(path).length)
|
|
46660
46931
|
throw new Error(`NATIVE_SKILL_DRIFT: project Sumi plugins require a dedicated discovery review: ${path}`);
|
|
46661
46932
|
}
|
|
46662
46933
|
if (agent === "claude") {
|
|
46663
46934
|
const commands = canonical9(join32(directory2, ".claude/commands"));
|
|
46664
46935
|
safe6(commands);
|
|
46665
|
-
if (lstatSync28(commands, { throwIfNoEntry: false })?.isDirectory() &&
|
|
46936
|
+
if (lstatSync28(commands, { throwIfNoEntry: false })?.isDirectory() && readdirSync10(commands).length)
|
|
46666
46937
|
throw new Error("NATIVE_SKILL_DRIFT: legacy project command discovery requires a dedicated format adapter");
|
|
46667
46938
|
}
|
|
46668
46939
|
}
|
|
@@ -46811,7 +47082,7 @@ function resolveAgentDiscovery(options) {
|
|
|
46811
47082
|
for (const path of plugins) {
|
|
46812
47083
|
safe6(path);
|
|
46813
47084
|
if (lstatSync28(path, { throwIfNoEntry: false })?.isDirectory())
|
|
46814
|
-
for (const name of
|
|
47085
|
+
for (const name of readdirSync10(path).sort()) {
|
|
46815
47086
|
if (name === "skills-cli.js" && path === plugins[1])
|
|
46816
47087
|
continue;
|
|
46817
47088
|
const target = join32(path, name);
|
|
@@ -46822,7 +47093,7 @@ function resolveAgentDiscovery(options) {
|
|
|
46822
47093
|
}
|
|
46823
47094
|
for (const root2 of roots) {
|
|
46824
47095
|
safe6(root2);
|
|
46825
|
-
if (lstatSync28(root2, { throwIfNoEntry: false })?.isDirectory() &&
|
|
47096
|
+
if (lstatSync28(root2, { throwIfNoEntry: false })?.isDirectory() && readdirSync10(root2).some((name) => name.endsWith(".md")))
|
|
46826
47097
|
unresolved("flat markdown skills require a dedicated native migration adapter");
|
|
46827
47098
|
}
|
|
46828
47099
|
}
|
|
@@ -46866,7 +47137,7 @@ function resolveAgentDiscovery(options) {
|
|
|
46866
47137
|
safe6(builtinRoot);
|
|
46867
47138
|
if (!lstatSync28(builtinRoot, { throwIfNoEntry: false })?.isDirectory())
|
|
46868
47139
|
unresolved("installed Gemini builtin root is missing");
|
|
46869
|
-
for (const name of
|
|
47140
|
+
for (const name of readdirSync10(builtinRoot).sort()) {
|
|
46870
47141
|
const text2 = witness(join32(builtinRoot, name, "SKILL.md"));
|
|
46871
47142
|
const match = text2?.match(/^---\r?\n[\s\S]*?^name:\s*([a-z0-9][a-z0-9-]*)\s*$/m);
|
|
46872
47143
|
if (!match?.[1] || builtinNames.includes(match[1]))
|
|
@@ -46964,7 +47235,7 @@ function resolveAgentDiscovery(options) {
|
|
|
46964
47235
|
unresolved("plugin hooks require a separate no-skill-injection review");
|
|
46965
47236
|
const commands = join32(root2, "commands");
|
|
46966
47237
|
safe6(commands);
|
|
46967
|
-
if (agent === "claude" && (manifest.commands !== undefined || lstatSync28(commands, { throwIfNoEntry: false })?.isDirectory() &&
|
|
47238
|
+
if (agent === "claude" && (manifest.commands !== undefined || lstatSync28(commands, { throwIfNoEntry: false })?.isDirectory() && readdirSync10(commands).length))
|
|
46968
47239
|
unresolved("legacy command discovery requires retirement or a dedicated format adapter");
|
|
46969
47240
|
const rootSkill = witness(join32(root2, "SKILL.md"));
|
|
46970
47241
|
if (rootSkill !== null)
|
|
@@ -46986,7 +47257,7 @@ function resolveAgentDiscovery(options) {
|
|
|
46986
47257
|
const installed = registrations === null ? {} : parseConfig(registrations, join32(home, ".claude/plugins/installed_plugins.json")).plugins;
|
|
46987
47258
|
const commands = canonical9(join32(home, ".claude/commands"));
|
|
46988
47259
|
safe6(commands);
|
|
46989
|
-
if (lstatSync28(commands, { throwIfNoEntry: false })?.isDirectory() &&
|
|
47260
|
+
if (lstatSync28(commands, { throwIfNoEntry: false })?.isDirectory() && readdirSync10(commands).length)
|
|
46990
47261
|
unresolved("legacy home command discovery requires a dedicated format adapter");
|
|
46991
47262
|
for (const [id2, enabled] of Object.entries(config.enabledPlugins ?? {})) {
|
|
46992
47263
|
if (enabled === false)
|
|
@@ -47028,7 +47299,7 @@ function resolveAgentDiscovery(options) {
|
|
|
47028
47299
|
}
|
|
47029
47300
|
const localPlugins = join32(home, ".config/opencode/plugins");
|
|
47030
47301
|
safe6(localPlugins);
|
|
47031
|
-
if (lstatSync28(localPlugins, { throwIfNoEntry: false }) &&
|
|
47302
|
+
if (lstatSync28(localPlugins, { throwIfNoEntry: false }) && readdirSync10(localPlugins).some((name) => name !== "skills-cli.js"))
|
|
47032
47303
|
unresolved("additional local plugin hooks require review");
|
|
47033
47304
|
} else if (agent === "sumi") {
|
|
47034
47305
|
if ((config.plugin?.length ?? 0) > 0 || (config.plugins?.length ?? 0) > 0 || sources.some((source) => source.path !== canonical9(configPath) && source.path !== canonical9(join32(sumiConfigDirectory(home), "sumi.jsonc")) && source.sha256 !== null))
|
|
@@ -47047,7 +47318,7 @@ function resolveAgentDiscovery(options) {
|
|
|
47047
47318
|
const directory2 = join32(home, ".gemini/extensions");
|
|
47048
47319
|
safe6(directory2);
|
|
47049
47320
|
if (lstatSync28(directory2, { throwIfNoEntry: false }))
|
|
47050
|
-
for (const name of
|
|
47321
|
+
for (const name of readdirSync10(directory2)) {
|
|
47051
47322
|
const root2 = join32(directory2, name);
|
|
47052
47323
|
safe6(root2);
|
|
47053
47324
|
if (!lstatSync28(root2)?.isDirectory())
|
|
@@ -47861,7 +48132,7 @@ function treeHash(root2) {
|
|
|
47861
48132
|
const rel = relative9(root2, path);
|
|
47862
48133
|
if (stat2.isDirectory()) {
|
|
47863
48134
|
hash3.update(`d\x00${rel}\x00`);
|
|
47864
|
-
for (const name of
|
|
48135
|
+
for (const name of readdirSync11(path).sort())
|
|
47865
48136
|
visit2(join33(path, name));
|
|
47866
48137
|
return;
|
|
47867
48138
|
}
|
|
@@ -48756,7 +49027,7 @@ function planClaudeHookEventsUpdate(options) {
|
|
|
48756
49027
|
}
|
|
48757
49028
|
function atomicWrite2(path, content) {
|
|
48758
49029
|
assertSafePath(path);
|
|
48759
|
-
|
|
49030
|
+
mkdirSync8(dirname24(path), { recursive: true, mode: 448 });
|
|
48760
49031
|
const temporary = `${path}.skills-${randomUUID4()}`;
|
|
48761
49032
|
try {
|
|
48762
49033
|
writeFileSync5(temporary, content, { mode: 384, flag: "wx" });
|
|
@@ -48924,7 +49195,7 @@ function planCodexSemanticCacheWitnessUpgrade(options) {
|
|
|
48924
49195
|
throw new Error("Local marketplace hook parent is not enabled in the unchanged Codex settings");
|
|
48925
49196
|
identity5 = { role: "reviewed-hook", pluginId: pluginId2, namespace: parts[1], pluginParent: parent, installation: "local-marketplace", marketplaceSourcePath: source.path, marketplaceSha256: source.sha256 };
|
|
48926
49197
|
}
|
|
48927
|
-
const versions =
|
|
49198
|
+
const versions = readdirSync11(parent).filter((name) => name !== ".codex-remote-plugin-install.json");
|
|
48928
49199
|
if (!versions.length || versions.length > 4096)
|
|
48929
49200
|
throw new Error("Reviewed native-hook parent has no bounded materializations");
|
|
48930
49201
|
for (const version2 of versions) {
|
|
@@ -49018,9 +49289,10 @@ function applyAgentIntegration(plan, options = {}) {
|
|
|
49018
49289
|
const alias = plan.rootAliases?.find((item) => item.agent === "codex" && (change.path === item.target || change.path.startsWith(item.target + "/")));
|
|
49019
49290
|
return lexical ? [lexical] : alias ? [alias.alias] : [];
|
|
49020
49291
|
});
|
|
49021
|
-
return withCodexCorpusWrite(roots, (assertCurrent) => applyAgentIntegrationUnlocked(plan, options, assertCurrent), options);
|
|
49292
|
+
return withCodexCorpusWrite(roots, (assertCurrent, admission) => applyAgentIntegrationUnlocked(plan, options, assertCurrent, admission), options);
|
|
49022
49293
|
}
|
|
49023
|
-
function applyAgentIntegrationUnlocked(plan, options = {}, assertCurrent) {
|
|
49294
|
+
function applyAgentIntegrationUnlocked(plan, options = {}, assertCurrent, admission) {
|
|
49295
|
+
const fallback = codexAdmissionReceipt(admission);
|
|
49024
49296
|
for (const source of plan.reviewArtifactSources ?? [])
|
|
49025
49297
|
verifyReviewArtifactOriginal(source.path, source.sha256);
|
|
49026
49298
|
for (const source of plan.observedNativeSources ?? [])
|
|
@@ -49084,10 +49356,10 @@ function applyAgentIntegrationUnlocked(plan, options = {}, assertCurrent) {
|
|
|
49084
49356
|
recheckRootAliases(aliases);
|
|
49085
49357
|
for (const agent of plan.retainedReviewChecks?.agents ?? [])
|
|
49086
49358
|
assertManagedAgentBridge(agent, { ...plan.retainedReviewChecks, dataDir: plan.dataDir });
|
|
49087
|
-
return { changed: [], backups, ...aliases.length ? { rootAliases: aliases } : {} };
|
|
49359
|
+
return { changed: [], backups, ...aliases.length ? { rootAliases: aliases } : {}, ...fallback };
|
|
49088
49360
|
}
|
|
49089
49361
|
assertSafePath(backupRoot);
|
|
49090
|
-
|
|
49362
|
+
mkdirSync8(backupRoot, { recursive: true, mode: 448 });
|
|
49091
49363
|
chmodSync(backupRoot, 448);
|
|
49092
49364
|
for (const [index, change] of plan.changes.entries())
|
|
49093
49365
|
if (change.before !== null) {
|
|
@@ -49135,7 +49407,7 @@ function applyAgentIntegrationUnlocked(plan, options = {}, assertCurrent) {
|
|
|
49135
49407
|
assertManagedAgentBridge(agent, { home: plan.managedAgentChecks.home, dataDir: plan.dataDir, projectDir: plan.managedAgentChecks.projectDir ?? plan.managedAgentChecks.home });
|
|
49136
49408
|
for (const agent of plan.retainedReviewChecks?.agents ?? [])
|
|
49137
49409
|
assertManagedAgentBridge(agent, { ...plan.retainedReviewChecks, dataDir: plan.dataDir });
|
|
49138
|
-
atomicWrite2(join33(backupRoot, "receipt.json"), JSON.stringify({ version: 1, changes: written.map((change) => ({ path: change.path, beforeHash: change.before === null ? null : sha5(change.before), afterHash: sha5(change.after) })), backups, ...plan.cacheWitnessUpgrade ? { cacheWitnessUpgrade: plan.cacheWitnessUpgrade } : {}, ...plan.retainedReviewArtifacts?.length ? { retainedReviewArtifacts: plan.retainedReviewArtifacts.map((item) => ({ path: item.path, ...item.artifact })) } : {}, ...aliases.length ? { rootAliases: aliases } : {} }) + `
|
|
49410
|
+
atomicWrite2(join33(backupRoot, "receipt.json"), JSON.stringify({ version: 1, changes: written.map((change) => ({ path: change.path, beforeHash: change.before === null ? null : sha5(change.before), afterHash: sha5(change.after) })), backups, ...plan.cacheWitnessUpgrade ? { cacheWitnessUpgrade: plan.cacheWitnessUpgrade } : {}, ...plan.retainedReviewArtifacts?.length ? { retainedReviewArtifacts: plan.retainedReviewArtifacts.map((item) => ({ path: item.path, ...item.artifact })) } : {}, ...aliases.length ? { rootAliases: aliases } : {}, ...fallback }) + `
|
|
49139
49411
|
`);
|
|
49140
49412
|
} catch (error) {
|
|
49141
49413
|
assertCurrent();
|
|
@@ -49163,7 +49435,7 @@ function applyAgentIntegrationUnlocked(plan, options = {}, assertCurrent) {
|
|
|
49163
49435
|
}
|
|
49164
49436
|
throw error;
|
|
49165
49437
|
}
|
|
49166
|
-
return { changed: plan.changes.map((change) => change.path), backups, ...aliases.length ? { rootAliases: aliases } : {} };
|
|
49438
|
+
return { changed: plan.changes.map((change) => change.path), backups, ...aliases.length ? { rootAliases: aliases } : {}, ...fallback };
|
|
49167
49439
|
}
|
|
49168
49440
|
function syncArchiveDirectory(path) {
|
|
49169
49441
|
assertSafePath(path);
|
|
@@ -49203,9 +49475,10 @@ function archiveNativeSkills(inventory, options) {
|
|
|
49203
49475
|
throw new Error("CODEX_CORPUS_ROOT_UNVERIFIED");
|
|
49204
49476
|
return [...new Set([root2, owner2].filter((value) => value !== undefined))];
|
|
49205
49477
|
});
|
|
49206
|
-
return withCodexCorpusWrite(roots, (assertCurrent) => archiveNativeSkillsUnlocked(inventory, options, assertCurrent), options);
|
|
49478
|
+
return withCodexCorpusWrite(roots, (assertCurrent, admission) => archiveNativeSkillsUnlocked(inventory, options, assertCurrent, admission), options);
|
|
49207
49479
|
}
|
|
49208
|
-
function archiveNativeSkillsUnlocked(inventory, options, assertCurrent) {
|
|
49480
|
+
function archiveNativeSkillsUnlocked(inventory, options, assertCurrent, admission) {
|
|
49481
|
+
const fallback = codexAdmissionReceipt(admission);
|
|
49209
49482
|
const aliases = [...new Map(inventory.filter((entry) => entry.rootAlias).map((entry) => [entry.rootAlias.alias, entry.rootAlias])).values()];
|
|
49210
49483
|
if (aliases.length && !options.allowRootAliases)
|
|
49211
49484
|
throw new Error("Native migration requires explicit allowRootAliases for agent root aliases");
|
|
@@ -49223,7 +49496,7 @@ function archiveNativeSkillsUnlocked(inventory, options, assertCurrent) {
|
|
|
49223
49496
|
throw new Error(`Native skill changed after planning: ${entry.path}`);
|
|
49224
49497
|
const targetManifest = options.targetManifest ? { schema: options.targetManifest.schema, digest: options.targetManifest.digest, targetCount: options.targetManifest.targets.length } : undefined;
|
|
49225
49498
|
if (!selected.length)
|
|
49226
|
-
return { entries: [], ...targetManifest ? { targetManifest } : {}, ...aliases.length ? { rootAliases: aliases } : {} };
|
|
49499
|
+
return { entries: [], ...targetManifest ? { targetManifest } : {}, ...aliases.length ? { rootAliases: aliases } : {}, ...fallback };
|
|
49227
49500
|
const operationId = randomUUID4(), archiveRoot = join33(options.dataDir ?? getDataDir(), "migration", operationId, "native"), receiptPath = join33(archiveRoot, "receipt.json");
|
|
49228
49501
|
const entries = selected.map((entry, index) => ({
|
|
49229
49502
|
source: entry.vendor ? join33(entry.path, "SKILL.md") : entry.path,
|
|
@@ -49232,7 +49505,7 @@ function archiveNativeSkillsUnlocked(inventory, options, assertCurrent) {
|
|
|
49232
49505
|
...entry.vendor ? { discoveryOnly: true } : {},
|
|
49233
49506
|
status: "planned"
|
|
49234
49507
|
}));
|
|
49235
|
-
const journal = { version: 2, operationId, status: "planned", entries, ...targetManifest ? { targetManifest } : {}, ...aliases.length ? { rootAliases: aliases } : {} };
|
|
49508
|
+
const journal = { version: 2, operationId, status: "planned", entries, ...targetManifest ? { targetManifest } : {}, ...aliases.length ? { rootAliases: aliases } : {}, ...fallback };
|
|
49236
49509
|
const moved = [];
|
|
49237
49510
|
const verifyArchive = (entry) => {
|
|
49238
49511
|
assertSafePath(entry.archive);
|
|
@@ -49246,7 +49519,7 @@ function archiveNativeSkillsUnlocked(inventory, options, assertCurrent) {
|
|
|
49246
49519
|
const created = [];
|
|
49247
49520
|
for (let path = archiveRoot;!existsSync7(path); path = dirname24(path))
|
|
49248
49521
|
created.push(path);
|
|
49249
|
-
|
|
49522
|
+
mkdirSync8(archiveRoot, { recursive: true, mode: 448 });
|
|
49250
49523
|
try {
|
|
49251
49524
|
for (const directory2 of created)
|
|
49252
49525
|
syncArchiveDirectory(directory2);
|
|
@@ -49329,7 +49602,7 @@ function archiveNativeSkillsUnlocked(inventory, options, assertCurrent) {
|
|
|
49329
49602
|
} catch {}
|
|
49330
49603
|
throw new Error(`Native archive failed; inspect the recovery journal at ${receiptPath} before retrying.`, { cause: error });
|
|
49331
49604
|
}
|
|
49332
|
-
return { entries: entries.map(({ status, conflict, ...entry }) => entry), receiptPath, ...targetManifest ? { targetManifest } : {}, ...aliases.length ? { rootAliases: aliases } : {} };
|
|
49605
|
+
return { entries: entries.map(({ status, conflict, ...entry }) => entry), receiptPath, ...targetManifest ? { targetManifest } : {}, ...aliases.length ? { rootAliases: aliases } : {}, ...fallback };
|
|
49333
49606
|
}
|
|
49334
49607
|
function classifiedCodexPluginCacheCopy(entry, cache, read3, admit) {
|
|
49335
49608
|
try {
|
|
@@ -49671,12 +49944,12 @@ function assertNativeExportAllowed(dataDir2 = getDataDirReadOnly()) {
|
|
|
49671
49944
|
// src/lib/portable-skills.ts
|
|
49672
49945
|
import {
|
|
49673
49946
|
existsSync as existsSync10,
|
|
49674
|
-
mkdirSync as
|
|
49675
|
-
mkdtempSync,
|
|
49676
|
-
readdirSync as
|
|
49947
|
+
mkdirSync as mkdirSync10,
|
|
49948
|
+
mkdtempSync as mkdtempSync2,
|
|
49949
|
+
readdirSync as readdirSync13,
|
|
49677
49950
|
realpathSync as realpathSync16,
|
|
49678
49951
|
renameSync as renameSync5,
|
|
49679
|
-
rmSync as
|
|
49952
|
+
rmSync as rmSync3,
|
|
49680
49953
|
statSync as statSync12,
|
|
49681
49954
|
writeFileSync as writeFileSync7
|
|
49682
49955
|
} from "fs";
|
|
@@ -49687,7 +49960,7 @@ var SKILLS = [];
|
|
|
49687
49960
|
|
|
49688
49961
|
// src/lib/skill-hash.ts
|
|
49689
49962
|
import { createHash as createHash31 } from "crypto";
|
|
49690
|
-
import { existsSync as existsSync8, readdirSync as
|
|
49963
|
+
import { existsSync as existsSync8, readdirSync as readdirSync12, readFileSync as readFileSync22, statSync as statSync10 } from "fs";
|
|
49691
49964
|
import { join as join34, sep as sep15 } from "path";
|
|
49692
49965
|
var CONTENT_HASH_ALGORITHM = "sha256";
|
|
49693
49966
|
var HASH_EXCLUDE_DIRS = new Set([".git", "node_modules", "dist", "build", ".turbo"]);
|
|
@@ -49761,7 +50034,7 @@ function collectBundleFiles(skillPath) {
|
|
|
49761
50034
|
return files.sort((a, b) => a.rel < b.rel ? -1 : a.rel > b.rel ? 1 : 0);
|
|
49762
50035
|
}
|
|
49763
50036
|
function collectDirectory(files, dir, rel) {
|
|
49764
|
-
for (const entry of
|
|
50037
|
+
for (const entry of readdirSync12(dir).sort()) {
|
|
49765
50038
|
if (entry.startsWith("."))
|
|
49766
50039
|
continue;
|
|
49767
50040
|
const absolute = join34(dir, entry);
|
|
@@ -50200,7 +50473,7 @@ import {
|
|
|
50200
50473
|
cpSync,
|
|
50201
50474
|
existsSync as existsSync9,
|
|
50202
50475
|
lstatSync as lstatSync31,
|
|
50203
|
-
mkdirSync as
|
|
50476
|
+
mkdirSync as mkdirSync9,
|
|
50204
50477
|
readFileSync as readFileSync23,
|
|
50205
50478
|
realpathSync as realpathSync14,
|
|
50206
50479
|
writeFileSync as writeFileSync6
|
|
@@ -50321,7 +50594,7 @@ function createInstructionManifest(name, options) {
|
|
|
50321
50594
|
};
|
|
50322
50595
|
}
|
|
50323
50596
|
function writeInstructionSkillTemplate(skillPath, manifest) {
|
|
50324
|
-
|
|
50597
|
+
mkdirSync9(skillPath, { recursive: true });
|
|
50325
50598
|
writeFileSync6(join35(skillPath, "SKILL.md"), renderInstructionSkillMd(manifest));
|
|
50326
50599
|
writeSkillJsonWithHash(skillPath, manifest);
|
|
50327
50600
|
}
|
|
@@ -50372,7 +50645,7 @@ function createPortableManifest(name, options) {
|
|
|
50372
50645
|
};
|
|
50373
50646
|
}
|
|
50374
50647
|
function writePortableSkillTemplate(skillPath, manifest) {
|
|
50375
|
-
|
|
50648
|
+
mkdirSync9(join35(skillPath, "src"), { recursive: true });
|
|
50376
50649
|
writeFileSync6(join35(skillPath, "SKILL.md"), renderSkillMd(manifest));
|
|
50377
50650
|
writeFileSync6(join35(skillPath, "AGENTS.md"), renderAgentsMd(manifest));
|
|
50378
50651
|
writeFileSync6(join35(skillPath, "package.json"), renderPackageJson(manifest));
|
|
@@ -50452,7 +50725,7 @@ function ensurePortableSkillFiles(skillPath, manifest) {
|
|
|
50452
50725
|
};
|
|
50453
50726
|
const entry = next.commands[0]?.entry ?? "src/index.ts";
|
|
50454
50727
|
if (entry && !existsSync9(join35(skillPath, entry))) {
|
|
50455
|
-
|
|
50728
|
+
mkdirSync9(dirname25(join35(skillPath, entry)), { recursive: true });
|
|
50456
50729
|
writeFileSync6(join35(skillPath, entry), renderEntrypoint(next));
|
|
50457
50730
|
}
|
|
50458
50731
|
if (!existsSync9(join35(skillPath, "SKILL.md")))
|
|
@@ -50558,7 +50831,7 @@ function renameInstructionFrontmatter(content, name) {
|
|
|
50558
50831
|
}
|
|
50559
50832
|
function copySkillDirectory(source, destination) {
|
|
50560
50833
|
const resolvedSource = lstatSync31(source).isSymbolicLink() ? realpathSync14(source) : source;
|
|
50561
|
-
|
|
50834
|
+
mkdirSync9(destination, { recursive: true });
|
|
50562
50835
|
cpSync(resolvedSource, destination, {
|
|
50563
50836
|
recursive: true,
|
|
50564
50837
|
filter: (src) => {
|
|
@@ -50879,7 +51152,7 @@ function physicalPath(path) {
|
|
|
50879
51152
|
}
|
|
50880
51153
|
return resolve28(realpathSync15(cursor), ...suffix);
|
|
50881
51154
|
}
|
|
50882
|
-
function
|
|
51155
|
+
function contains2(root2, path) {
|
|
50883
51156
|
return path === root2 || path.startsWith(root2 + sep16);
|
|
50884
51157
|
}
|
|
50885
51158
|
function configuredRoots(home, explicitHome) {
|
|
@@ -50932,14 +51205,14 @@ function assertPortableAuthoringPath(path, options = {}) {
|
|
|
50932
51205
|
const defaults = NATIVE_DISCOVERY_ROOTS.map((parts) => join36(home, ...parts));
|
|
50933
51206
|
defaults.push(join36(home, ".codex/plugins/cache"), join36(home, ".claude/plugins/cache"), join36(home, ".claude/plugins/synced"), join36(home, ".gemini/extensions"));
|
|
50934
51207
|
for (const root2 of defaults) {
|
|
50935
|
-
if (candidates.some((candidate2) =>
|
|
51208
|
+
if (candidates.some((candidate2) => contains2(resolve28(root2), candidate2) || contains2(physicalPath(root2), candidate2)))
|
|
50936
51209
|
native ??= root2;
|
|
50937
51210
|
}
|
|
50938
51211
|
if (native) {
|
|
50939
51212
|
throw new Error(`Refusing portable Skills authoring below native discovery root '${native}': ${lexical}. Set HASNA_SKILLS_DIR to a private authoring corpus outside native roots.`);
|
|
50940
51213
|
}
|
|
50941
51214
|
for (const root2 of configuredRoots(home, options.homeDir !== undefined)) {
|
|
50942
|
-
if (candidates.some((candidate2) =>
|
|
51215
|
+
if (candidates.some((candidate2) => contains2(resolve28(root2), candidate2) || contains2(physicalPath(root2), candidate2))) {
|
|
50943
51216
|
throw new Error(`Refusing portable Skills authoring below configured native discovery root: ${lexical}`);
|
|
50944
51217
|
}
|
|
50945
51218
|
}
|
|
@@ -50982,7 +51255,7 @@ function listPortableSkills(options = {}) {
|
|
|
50982
51255
|
if (!safeIsDirectory(root2))
|
|
50983
51256
|
return [];
|
|
50984
51257
|
const skills = [];
|
|
50985
|
-
for (const entry of
|
|
51258
|
+
for (const entry of readdirSync13(root2).sort()) {
|
|
50986
51259
|
if (entry.startsWith("."))
|
|
50987
51260
|
continue;
|
|
50988
51261
|
const path = join37(root2, entry);
|
|
@@ -51026,7 +51299,7 @@ function scaffoldPortableSkill(name, options = {}) {
|
|
|
51026
51299
|
if (existsSync10(skillPath)) {
|
|
51027
51300
|
if (!options.overwrite)
|
|
51028
51301
|
throw new Error(`Skill '${skillName}' already exists at ${skillPath}`);
|
|
51029
|
-
|
|
51302
|
+
rmSync3(skillPath, { recursive: true, force: true });
|
|
51030
51303
|
}
|
|
51031
51304
|
const kind = options.kind ?? "executable";
|
|
51032
51305
|
const description = options.description ?? `${displayName(skillName)} skill`;
|
|
@@ -51053,7 +51326,7 @@ function portPortableSkillDirectory(sourceDir, options = {}) {
|
|
|
51053
51326
|
};
|
|
51054
51327
|
const imported = [];
|
|
51055
51328
|
const skipped = [];
|
|
51056
|
-
const entries =
|
|
51329
|
+
const entries = readdirSync13(absoluteSource, { withFileTypes: true }).map((entry) => entry.name).filter((entryName) => !entryName.startsWith(".")).sort();
|
|
51057
51330
|
for (const entryName of entries) {
|
|
51058
51331
|
const childPath = join37(absoluteSource, entryName);
|
|
51059
51332
|
if (!safeIsDirectory(childPath))
|
|
@@ -51098,11 +51371,11 @@ function physicalImportPath(path) {
|
|
|
51098
51371
|
function assertDisjointImportPaths(source, destination) {
|
|
51099
51372
|
const sourcePath = realpathSync16(source);
|
|
51100
51373
|
const destinationPath = physicalImportPath(destination);
|
|
51101
|
-
const
|
|
51374
|
+
const contains3 = (parent, child2) => {
|
|
51102
51375
|
const path = relative11(parent, child2);
|
|
51103
51376
|
return path === "" || !isAbsolute30(path) && path !== ".." && !path.startsWith(`..${sep17}`);
|
|
51104
51377
|
};
|
|
51105
|
-
if (
|
|
51378
|
+
if (contains3(sourcePath, destinationPath) || contains3(destinationPath, sourcePath)) {
|
|
51106
51379
|
throw new Error("Source and destination skill directories must not overlap");
|
|
51107
51380
|
}
|
|
51108
51381
|
}
|
|
@@ -51129,9 +51402,9 @@ function portPortableSkill(sourcePath, options = {}) {
|
|
|
51129
51402
|
if (existsSync10(destination)) {
|
|
51130
51403
|
if (!options.overwrite)
|
|
51131
51404
|
throw new Error(`Skill '${skillName}' already exists at ${destination}`);
|
|
51132
|
-
|
|
51405
|
+
rmSync3(destination, { recursive: true, force: true });
|
|
51133
51406
|
}
|
|
51134
|
-
|
|
51407
|
+
mkdirSync10(dirname27(destination), { recursive: true });
|
|
51135
51408
|
copySkillDirectory(absoluteSource, destination);
|
|
51136
51409
|
const base = {
|
|
51137
51410
|
...inferred,
|
|
@@ -51173,7 +51446,7 @@ function writeCorpusSkill(input, options = {}) {
|
|
|
51173
51446
|
const skillPath = join37(root2, name);
|
|
51174
51447
|
assertPortableAuthoringPath(skillPath, options);
|
|
51175
51448
|
const created = !existsSync10(skillPath);
|
|
51176
|
-
|
|
51449
|
+
mkdirSync10(skillPath, { recursive: true });
|
|
51177
51450
|
writeFileSync7(join37(skillPath, "SKILL.md"), input.skillMd);
|
|
51178
51451
|
const manifest = buildCorpusManifest(input, name);
|
|
51179
51452
|
writeSkillJsonWithHash(skillPath, manifest);
|
|
@@ -51187,8 +51460,8 @@ function installCorpusSkillAtomically(input, options = {}) {
|
|
|
51187
51460
|
const target = join37(root2, name);
|
|
51188
51461
|
assertPortableAuthoringPath(target, options);
|
|
51189
51462
|
const created = !existsSync10(target);
|
|
51190
|
-
|
|
51191
|
-
const staging =
|
|
51463
|
+
mkdirSync10(root2, { recursive: true });
|
|
51464
|
+
const staging = mkdtempSync2(join37(root2, `.pull-${name}-`));
|
|
51192
51465
|
let moved = false;
|
|
51193
51466
|
let backup = null;
|
|
51194
51467
|
try {
|
|
@@ -51196,16 +51469,16 @@ function installCorpusSkillAtomically(input, options = {}) {
|
|
|
51196
51469
|
const manifest = buildCorpusManifest(input, name);
|
|
51197
51470
|
writeSkillJsonWithHash(staging, manifest);
|
|
51198
51471
|
if (existsSync10(target)) {
|
|
51199
|
-
backup =
|
|
51472
|
+
backup = mkdtempSync2(join37(root2, `.pull-backup-${name}-`));
|
|
51200
51473
|
renameSync5(target, join37(backup, name));
|
|
51201
51474
|
moved = true;
|
|
51202
51475
|
}
|
|
51203
51476
|
renameSync5(staging, target);
|
|
51204
51477
|
if (moved && backup)
|
|
51205
|
-
|
|
51478
|
+
rmSync3(backup, { recursive: true, force: true });
|
|
51206
51479
|
return { name, path: target, manifest, created };
|
|
51207
51480
|
} catch (error) {
|
|
51208
|
-
|
|
51481
|
+
rmSync3(staging, { recursive: true, force: true });
|
|
51209
51482
|
if (moved && backup && existsSync10(join37(backup, name))) {
|
|
51210
51483
|
try {
|
|
51211
51484
|
renameSync5(join37(backup, name), target);
|
|
@@ -51502,7 +51775,7 @@ function packageSourceRoots(source) {
|
|
|
51502
51775
|
function containsSkillDirectories(path) {
|
|
51503
51776
|
let entries;
|
|
51504
51777
|
try {
|
|
51505
|
-
entries =
|
|
51778
|
+
entries = readdirSync14(path);
|
|
51506
51779
|
} catch {
|
|
51507
51780
|
return false;
|
|
51508
51781
|
}
|
|
@@ -51597,12 +51870,16 @@ function writeManagedAgentSkill(params) {
|
|
|
51597
51870
|
agent: params.agent,
|
|
51598
51871
|
path: result.path,
|
|
51599
51872
|
action: result.action,
|
|
51600
|
-
...result.reason ? { reason: result.reason } : {}
|
|
51873
|
+
...result.reason ? { reason: result.reason } : {},
|
|
51874
|
+
...result.nativeAdmission ? { nativeAdmission: result.nativeAdmission, nativeAdmissionProbe: result.nativeAdmissionProbe } : {}
|
|
51601
51875
|
};
|
|
51602
51876
|
}
|
|
51603
51877
|
function writeManagedSkillDir(dir, skillMd, options) {
|
|
51604
51878
|
const root2 = options.dryRun ? undefined : codexCorpusRootForPath(dir);
|
|
51605
|
-
return withCodexCorpusWrite(root2 ? [root2] : [], (assertCurrent) =>
|
|
51879
|
+
return withCodexCorpusWrite(root2 ? [root2] : [], (assertCurrent, admission) => {
|
|
51880
|
+
const result = writeManagedSkillDirUnlocked(dir, skillMd, options, assertCurrent);
|
|
51881
|
+
return { ...result, ...codexAdmissionReceipt(admission) };
|
|
51882
|
+
}, options);
|
|
51606
51883
|
}
|
|
51607
51884
|
function writeManagedSkillDirUnlocked(dir, skillMd, options, assertCurrent) {
|
|
51608
51885
|
const skillMdPath = join38(dir, "SKILL.md");
|
|
@@ -51643,8 +51920,8 @@ function writeManagedSkillDirUnlocked(dir, skillMd, options, assertCurrent) {
|
|
|
51643
51920
|
if (options.dryRun)
|
|
51644
51921
|
return { action, path: skillMdPath };
|
|
51645
51922
|
const parentDir = dirname28(dir);
|
|
51646
|
-
|
|
51647
|
-
const transactionDir =
|
|
51923
|
+
mkdirSync11(parentDir, { recursive: true });
|
|
51924
|
+
const transactionDir = mkdtempSync3(join38(parentDir, `.hasna-skills-write-${basename17(dir)}-`));
|
|
51648
51925
|
const candidateDir = join38(transactionDir, "candidate");
|
|
51649
51926
|
const backupDir = join38(transactionDir, "backup");
|
|
51650
51927
|
const candidateSkillMdPath = join38(candidateDir, "SKILL.md");
|
|
@@ -51662,7 +51939,7 @@ function writeManagedSkillDirUnlocked(dir, skillMd, options, assertCurrent) {
|
|
|
51662
51939
|
if (options.resourceDir) {
|
|
51663
51940
|
cpSync2(options.resourceDir, candidateDir, { recursive: true, force: true });
|
|
51664
51941
|
} else {
|
|
51665
|
-
|
|
51942
|
+
mkdirSync11(candidateDir, { recursive: true });
|
|
51666
51943
|
}
|
|
51667
51944
|
writeFileSync8(candidateSkillMdPath, skillMd.endsWith(`
|
|
51668
51945
|
`) ? skillMd : `${skillMd}
|
|
@@ -51686,7 +51963,7 @@ function writeManagedSkillDirUnlocked(dir, skillMd, options, assertCurrent) {
|
|
|
51686
51963
|
try {
|
|
51687
51964
|
assertCurrent();
|
|
51688
51965
|
if (existsSync11(dir))
|
|
51689
|
-
|
|
51966
|
+
rmSync4(dir, { recursive: true, force: true });
|
|
51690
51967
|
renameDirectory(backupDir, dir);
|
|
51691
51968
|
originalMoved = false;
|
|
51692
51969
|
} catch (rollbackError) {
|
|
@@ -51699,22 +51976,26 @@ function writeManagedSkillDirUnlocked(dir, skillMd, options, assertCurrent) {
|
|
|
51699
51976
|
if (!preserveTransaction) {
|
|
51700
51977
|
try {
|
|
51701
51978
|
assertCurrent();
|
|
51702
|
-
|
|
51979
|
+
rmSync4(transactionDir, { recursive: true, force: true });
|
|
51703
51980
|
} catch {}
|
|
51704
51981
|
}
|
|
51705
51982
|
}
|
|
51706
51983
|
return { action, path: skillMdPath };
|
|
51707
51984
|
}
|
|
51708
51985
|
function removeManagedAgentSkill(skill, agent, homeDir3 = homedir5(), options = {}) {
|
|
51986
|
+
const record6 = codexAdmissionRecord(options);
|
|
51709
51987
|
const dir = join38(agentGlobalSkillsDir(agent, homeDir3), skill);
|
|
51710
51988
|
const root2 = codexCorpusRootForPath(dir);
|
|
51711
|
-
return withCodexCorpusWrite(root2 ? [root2] : [], () =>
|
|
51989
|
+
return withCodexCorpusWrite(root2 ? [root2] : [], (_assertCurrent, admission) => {
|
|
51990
|
+
record6.deliver(admission);
|
|
51991
|
+
return removeManagedAgentSkillUnlocked(skill, agent, homeDir3, options);
|
|
51992
|
+
}, options, record6.policy);
|
|
51712
51993
|
}
|
|
51713
51994
|
function removeManagedAgentSkillUnlocked(skill, agent, homeDir3 = homedir5(), options = {}) {
|
|
51714
51995
|
const dir = join38(agentGlobalSkillsDir(agent, homeDir3), skill);
|
|
51715
51996
|
if (!hasSkillsOwnershipMarker(dir))
|
|
51716
51997
|
return false;
|
|
51717
|
-
|
|
51998
|
+
rmSync4(dir, { recursive: true, force: true });
|
|
51718
51999
|
return true;
|
|
51719
52000
|
}
|
|
51720
52001
|
function sourceSkillMd(skillPath, name, description, kind, preferBundledDocs = false) {
|
|
@@ -51751,7 +52032,7 @@ function normalizeSkillName(name) {
|
|
|
51751
52032
|
}
|
|
51752
52033
|
|
|
51753
52034
|
// src/lib/registry.ts
|
|
51754
|
-
import { existsSync as existsSync12, readFileSync as readFileSync25, readdirSync as
|
|
52035
|
+
import { existsSync as existsSync12, readFileSync as readFileSync25, readdirSync as readdirSync15 } from "fs";
|
|
51755
52036
|
import { join as join39 } from "path";
|
|
51756
52037
|
|
|
51757
52038
|
// src/lib/registry-merge.ts
|
|
@@ -51913,10 +52194,33 @@ function searchSkills(query, registry = loadRegistry()) {
|
|
|
51913
52194
|
scored.sort((a, b) => b.score - a.score);
|
|
51914
52195
|
return scored.map((s) => s.skill);
|
|
51915
52196
|
}
|
|
52197
|
+
function findCloseSkillNames(query, names, maxResults = 3) {
|
|
52198
|
+
if (maxResults <= 0)
|
|
52199
|
+
return [];
|
|
52200
|
+
const q = query.trim().toLowerCase();
|
|
52201
|
+
if (q.length === 0)
|
|
52202
|
+
return [];
|
|
52203
|
+
const tokens = q.split("-").filter(Boolean);
|
|
52204
|
+
const ranked = [];
|
|
52205
|
+
if (q.length >= 3) {
|
|
52206
|
+
for (const name of names) {
|
|
52207
|
+
const candidate2 = name.toLowerCase();
|
|
52208
|
+
const rank = candidate2 === q ? 0 : candidate2.endsWith(`-${q}`) || candidate2.startsWith(`${q}-`) ? 1 : tokens.length > 1 && tokens.every((token) => candidate2.split("-").includes(token)) ? 2 : undefined;
|
|
52209
|
+
if (rank !== undefined)
|
|
52210
|
+
ranked.push([name, rank]);
|
|
52211
|
+
}
|
|
52212
|
+
}
|
|
52213
|
+
ranked.sort((a, b) => a[1] - b[1] || a[0].length - b[0].length || a[0].localeCompare(b[0]));
|
|
52214
|
+
const found = ranked.slice(0, maxResults).map(([name]) => name);
|
|
52215
|
+
if (found.length === maxResults)
|
|
52216
|
+
return found;
|
|
52217
|
+
const taken = new Set(found);
|
|
52218
|
+
const threshold = Math.max(3, Math.floor(q.length / 2));
|
|
52219
|
+
const byDistance = names.filter((name) => !taken.has(name)).map((name) => ({ name, distance: editDistance(q, name.toLowerCase()) })).filter((entry) => entry.distance <= threshold).sort((a, b) => a.distance - b.distance || a.name.localeCompare(b.name));
|
|
52220
|
+
return [...found, ...byDistance.slice(0, maxResults - found.length).map((entry) => entry.name)];
|
|
52221
|
+
}
|
|
51916
52222
|
function findSimilarSkills(query, maxResults = 3, registry = loadRegistry()) {
|
|
51917
|
-
|
|
51918
|
-
const scored = registry.map((s) => ({ name: s.name, dist: editDistance(q, s.name.toLowerCase()) })).filter((s) => s.dist <= Math.max(3, Math.floor(q.length / 2))).sort((a, b) => a.dist - b.dist);
|
|
51919
|
-
return scored.slice(0, maxResults).map((s) => s.name);
|
|
52223
|
+
return findCloseSkillNames(query, registry.map((skill) => skill.name), maxResults);
|
|
51920
52224
|
}
|
|
51921
52225
|
// src/lib/registry.ts
|
|
51922
52226
|
function isBasicSkillName(name) {
|
|
@@ -51958,7 +52262,7 @@ function discoverSkillsInDir(dir, source = "custom") {
|
|
|
51958
52262
|
return [];
|
|
51959
52263
|
const result = [];
|
|
51960
52264
|
try {
|
|
51961
|
-
const entries =
|
|
52265
|
+
const entries = readdirSync15(dir, { withFileTypes: true });
|
|
51962
52266
|
for (const entry of entries) {
|
|
51963
52267
|
if (!entry.isDirectory())
|
|
51964
52268
|
continue;
|
|
@@ -51994,7 +52298,7 @@ function findExtensionSkillPath(name) {
|
|
|
51994
52298
|
if (!config.extensionsDir || !existsSync12(config.extensionsDir))
|
|
51995
52299
|
return null;
|
|
51996
52300
|
try {
|
|
51997
|
-
const entries =
|
|
52301
|
+
const entries = readdirSync15(config.extensionsDir, { withFileTypes: true });
|
|
51998
52302
|
for (const entry of entries) {
|
|
51999
52303
|
if (!entry.isDirectory())
|
|
52000
52304
|
continue;
|
|
@@ -52069,7 +52373,7 @@ function getAllTags(catalog) {
|
|
|
52069
52373
|
}
|
|
52070
52374
|
|
|
52071
52375
|
// src/lib/project-state.ts
|
|
52072
|
-
import { existsSync as existsSync13, mkdirSync as
|
|
52376
|
+
import { existsSync as existsSync13, mkdirSync as mkdirSync12, readFileSync as readFileSync26, writeFileSync as writeFileSync9 } from "fs";
|
|
52073
52377
|
import { join as join40 } from "path";
|
|
52074
52378
|
var VALID_PIN_SOURCES = [
|
|
52075
52379
|
"official",
|
|
@@ -52116,7 +52420,7 @@ function ensureProjectConfig(targetDir = process.cwd()) {
|
|
|
52116
52420
|
}
|
|
52117
52421
|
function saveProjectConfig(config, targetDir = process.cwd()) {
|
|
52118
52422
|
const dir = getProjectStateDir(targetDir);
|
|
52119
|
-
|
|
52423
|
+
mkdirSync12(dir, { recursive: true });
|
|
52120
52424
|
const normalized2 = normalizeProjectConfig({ ...config, updatedAt: new Date().toISOString() });
|
|
52121
52425
|
writeFileSync9(getProjectConfigPath(targetDir), JSON.stringify(normalized2, null, 2) + `
|
|
52122
52426
|
`);
|
|
@@ -52385,15 +52689,20 @@ function installSkillForAgent(name, options, generateSkillMd) {
|
|
|
52385
52689
|
codexCommand: options.codexCommand,
|
|
52386
52690
|
codexSha256: options.codexSha256
|
|
52387
52691
|
});
|
|
52692
|
+
const fallback = result.nativeAdmission ? { nativeAdmission: result.nativeAdmission, nativeAdmissionProbe: result.nativeAdmissionProbe } : {};
|
|
52388
52693
|
if (result.action === "skip") {
|
|
52389
|
-
return { skill: canonicalName, success: false, error: result.reason ?? "skipped", path: result.path };
|
|
52694
|
+
return { skill: canonicalName, success: false, error: result.reason ?? "skipped", path: result.path, ...fallback };
|
|
52390
52695
|
}
|
|
52391
|
-
return { skill: canonicalName, success: true, path: result.path };
|
|
52696
|
+
return { skill: canonicalName, success: true, path: result.path, ...fallback };
|
|
52392
52697
|
}
|
|
52393
52698
|
function removeSkillForAgent(name, options) {
|
|
52699
|
+
const record6 = codexAdmissionRecord(options);
|
|
52394
52700
|
const dir = getAgentSkillPath(name, options.agent, options.scope ?? "global", options.projectDir);
|
|
52395
52701
|
const root2 = codexCorpusRootForPath(dir);
|
|
52396
|
-
return withCodexCorpusWrite(root2 ? [root2] : [], () =>
|
|
52702
|
+
return withCodexCorpusWrite(root2 ? [root2] : [], (_assertCurrent, admission) => {
|
|
52703
|
+
record6.deliver(admission);
|
|
52704
|
+
return removeSkillForAgentUnlocked(name, options);
|
|
52705
|
+
}, options, record6.policy);
|
|
52397
52706
|
}
|
|
52398
52707
|
function removeSkillForAgentUnlocked(name, options) {
|
|
52399
52708
|
const canonicalName = getCanonicalSkillName(name);
|
|
@@ -52401,7 +52710,7 @@ function removeSkillForAgentUnlocked(name, options) {
|
|
|
52401
52710
|
const dir = getAgentSkillPath(canonicalName, options.agent, scope, options.projectDir);
|
|
52402
52711
|
if (!hasSkillsOwnershipMarker(dir))
|
|
52403
52712
|
return false;
|
|
52404
|
-
|
|
52713
|
+
rmSync5(dir, { recursive: true, force: true });
|
|
52405
52714
|
return true;
|
|
52406
52715
|
}
|
|
52407
52716
|
function resolveAgentSkillMd(name, generateSkillMd) {
|
|
@@ -52937,11 +53246,31 @@ function exactProfileSelection(spec, profile) {
|
|
|
52937
53246
|
const at = spec.lastIndexOf("@");
|
|
52938
53247
|
const slug = at > 0 ? spec.slice(0, at) : spec;
|
|
52939
53248
|
const version2 = at > 0 ? spec.slice(at + 1) : undefined;
|
|
52940
|
-
const
|
|
52941
|
-
if (
|
|
52942
|
-
throw new SkillSelectionError("SKILL_NOT_SELECTED",
|
|
53249
|
+
const named = profile.selections.filter((entry) => entry.slug === slug || entry.aliases?.includes(slug));
|
|
53250
|
+
if (version2 === "")
|
|
53251
|
+
throw new SkillSelectionError("SKILL_NOT_SELECTED", emptyVersionRefusal(spec));
|
|
53252
|
+
if (named.length === 0)
|
|
53253
|
+
throw new SkillSelectionError("SKILL_NOT_SELECTED", unknownNameRefusal(slug, profile));
|
|
53254
|
+
const selection2 = version2 === undefined ? named[0] : named.find((entry) => entry.version === version2);
|
|
53255
|
+
if (!selection2)
|
|
53256
|
+
throw new SkillSelectionError("SKILL_NOT_SELECTED", wrongVersionRefusal(slug, version2, named));
|
|
52943
53257
|
return selection2;
|
|
52944
53258
|
}
|
|
53259
|
+
var ACCEPTED_FORM = "Accepted form: '<slug>' or '<slug>@<version>'.";
|
|
53260
|
+
function emptyVersionRefusal(spec) {
|
|
53261
|
+
return `The requested name '${spec}' has an empty version. ${ACCEPTED_FORM}`;
|
|
53262
|
+
}
|
|
53263
|
+
function wrongVersionRefusal(slug, version2, named) {
|
|
53264
|
+
const versions = [...new Set(named.map((entry) => entry.version))].sort();
|
|
53265
|
+
const canonical9 = named[0].slug;
|
|
53266
|
+
return `Skill '${slug}' is selected at version '${versions.join("', '")}', but '${version2}' was requested. ` + `Accepted form: '${canonical9}@${versions[0]}'.`;
|
|
53267
|
+
}
|
|
53268
|
+
function unknownNameRefusal(slug, profile) {
|
|
53269
|
+
const names = profile.selections.flatMap((entry) => [entry.slug, ...entry.aliases ?? []]);
|
|
53270
|
+
const close = findCloseSkillNames(slug, names);
|
|
53271
|
+
const hint = close.length > 0 ? ` Did you mean: ${close.join(", ")}?` : "";
|
|
53272
|
+
return `Skill '${slug}' is not selected by this Skills profile or project lock.${hint} ` + `Read the accepted names with 'skills search <term>' or 'skills list --all --json'; accept one with 'skills pin <name>'. ${ACCEPTED_FORM}`;
|
|
53273
|
+
}
|
|
52945
53274
|
|
|
52946
53275
|
// src/lib/selected-run.ts
|
|
52947
53276
|
async function resolveSelectedRun(spec, profileId, options = {}) {
|
|
@@ -53065,7 +53394,7 @@ async function executeSelectedLocal(selected, options = {}) {
|
|
|
53065
53394
|
throw new SkillSelectionError("INVALID_SECRET_BINDINGS", "Explicit environment values must be bounded strings without NUL bytes.");
|
|
53066
53395
|
secretEnv[name] = value;
|
|
53067
53396
|
}
|
|
53068
|
-
const runDirectory =
|
|
53397
|
+
const runDirectory = mkdtempSync4(join43(tmpdir(), "skills-execution-"));
|
|
53069
53398
|
const paths = new SkillEntryPaths;
|
|
53070
53399
|
for (const entry of entries) {
|
|
53071
53400
|
paths.add(entry.path, 100, () => {
|
|
@@ -53074,7 +53403,7 @@ async function executeSelectedLocal(selected, options = {}) {
|
|
|
53074
53403
|
throw new SkillSelectionError("INVALID_BUNDLE_PATH", "The execution bundle path exceeds its limit.");
|
|
53075
53404
|
});
|
|
53076
53405
|
const destination = join43(runDirectory, entry.path);
|
|
53077
|
-
|
|
53406
|
+
mkdirSync13(dirname29(destination), { recursive: true, mode: 448 });
|
|
53078
53407
|
writeFileSync10(destination, entry.bytes, { flag: "wx", mode: entry.mode & 511 });
|
|
53079
53408
|
}
|
|
53080
53409
|
env.SKILLS_INPUT_JSON = input;
|
|
@@ -54234,7 +54563,7 @@ var $resolveS3Config = resolveS3Config;
|
|
|
54234
54563
|
// node_modules/@aws-sdk/client-s3/dist-es/S3Client.js
|
|
54235
54564
|
var import_core = __toESM(require_dist_cjs2(), 1);
|
|
54236
54565
|
var import_client27 = __toESM(require_client(), 1);
|
|
54237
|
-
var
|
|
54566
|
+
var import_config38 = __toESM(require_config(), 1);
|
|
54238
54567
|
var import_endpoints5 = __toESM(require_endpoints(), 1);
|
|
54239
54568
|
var import_event_streams2 = __toESM(require_event_streams(), 1);
|
|
54240
54569
|
var import_protocols6 = __toESM(require_protocols(), 1);
|
|
@@ -62237,21 +62566,21 @@ var import_httpAuthSchemes3 = __toESM(require_httpAuthSchemes(), 1);
|
|
|
62237
62566
|
|
|
62238
62567
|
// node_modules/@aws-sdk/credential-provider-node/dist-es/defaultProvider.js
|
|
62239
62568
|
init_dist_es();
|
|
62240
|
-
var
|
|
62569
|
+
var import_config36 = __toESM(require_config(), 1);
|
|
62241
62570
|
|
|
62242
62571
|
// node_modules/@aws-sdk/credential-provider-node/dist-es/remoteProvider.js
|
|
62243
|
-
var
|
|
62572
|
+
var import_config19 = __toESM(require_config(), 1);
|
|
62244
62573
|
var ENV_IMDS_DISABLED = "AWS_EC2_METADATA_DISABLED";
|
|
62245
62574
|
var remoteProvider = async (init) => {
|
|
62246
62575
|
const { ENV_CMDS_FULL_URI: ENV_CMDS_FULL_URI2, ENV_CMDS_RELATIVE_URI: ENV_CMDS_RELATIVE_URI2, fromContainerMetadata: fromContainerMetadata2, fromInstanceMetadata: fromInstanceMetadata2 } = await Promise.resolve().then(() => (init_dist_es2(), exports_dist_es2));
|
|
62247
62576
|
if (process.env[ENV_CMDS_RELATIVE_URI2] || process.env[ENV_CMDS_FULL_URI2]) {
|
|
62248
62577
|
init.logger?.debug("@aws-sdk/credential-provider-node - remoteProvider::fromHttp/fromContainerMetadata");
|
|
62249
62578
|
const { fromHttp: fromHttp2 } = await Promise.resolve().then(() => (init_dist_es3(), exports_dist_es3));
|
|
62250
|
-
return
|
|
62579
|
+
return import_config19.chain(fromHttp2(init), fromContainerMetadata2(init));
|
|
62251
62580
|
}
|
|
62252
62581
|
if (process.env[ENV_IMDS_DISABLED] && process.env[ENV_IMDS_DISABLED] !== "false") {
|
|
62253
62582
|
return async () => {
|
|
62254
|
-
throw new
|
|
62583
|
+
throw new import_config19.CredentialsProviderError("EC2 Instance Metadata Service access disabled", { logger: init.logger });
|
|
62255
62584
|
};
|
|
62256
62585
|
}
|
|
62257
62586
|
init.logger?.debug("@aws-sdk/credential-provider-node - remoteProvider::fromInstanceMetadata");
|
|
@@ -62326,7 +62655,7 @@ var internalCreateChain = (providers) => async (awsIdentityProperties) => {
|
|
|
62326
62655
|
var multipleCredentialSourceWarningEmitted = false;
|
|
62327
62656
|
var defaultProvider = (init = {}) => memoizeChain([
|
|
62328
62657
|
async () => {
|
|
62329
|
-
const profile = init.profile ?? process.env[
|
|
62658
|
+
const profile = init.profile ?? process.env[import_config36.ENV_PROFILE];
|
|
62330
62659
|
if (profile) {
|
|
62331
62660
|
const envStaticCredentialsAreSet = process.env[ENV_KEY] && process.env[ENV_SECRET];
|
|
62332
62661
|
if (envStaticCredentialsAreSet) {
|
|
@@ -62344,7 +62673,7 @@ var defaultProvider = (init = {}) => memoizeChain([
|
|
|
62344
62673
|
multipleCredentialSourceWarningEmitted = true;
|
|
62345
62674
|
}
|
|
62346
62675
|
}
|
|
62347
|
-
throw new
|
|
62676
|
+
throw new import_config36.CredentialsProviderError("AWS_PROFILE is set, skipping fromEnv provider.", {
|
|
62348
62677
|
logger: init.logger,
|
|
62349
62678
|
tryNextLink: true
|
|
62350
62679
|
});
|
|
@@ -62356,7 +62685,7 @@ var defaultProvider = (init = {}) => memoizeChain([
|
|
|
62356
62685
|
init.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::fromSSO");
|
|
62357
62686
|
const { ssoStartUrl, ssoAccountId, ssoRegion, ssoRoleName, ssoSession } = init;
|
|
62358
62687
|
if (!ssoStartUrl && !ssoAccountId && !ssoRegion && !ssoRoleName && !ssoSession) {
|
|
62359
|
-
throw new
|
|
62688
|
+
throw new import_config36.CredentialsProviderError("Skipping SSO provider in default chain (inputs do not include SSO fields).", { logger: init.logger });
|
|
62360
62689
|
}
|
|
62361
62690
|
const { fromSSO: fromSSO2 } = await Promise.resolve().then(() => (init_dist_es5(), exports_dist_es4));
|
|
62362
62691
|
return fromSSO2(init)(awsIdentityProperties);
|
|
@@ -62381,7 +62710,7 @@ var defaultProvider = (init = {}) => memoizeChain([
|
|
|
62381
62710
|
return (await remoteProvider(init))();
|
|
62382
62711
|
},
|
|
62383
62712
|
async () => {
|
|
62384
|
-
throw new
|
|
62713
|
+
throw new import_config36.CredentialsProviderError("Could not load credentials from any providers", {
|
|
62385
62714
|
tryNextLink: false,
|
|
62386
62715
|
logger: init.logger
|
|
62387
62716
|
});
|
|
@@ -62391,7 +62720,7 @@ var credentialsTreatedAsExpired = (credentials) => credentials?.expiration !== u
|
|
|
62391
62720
|
// node_modules/@aws-sdk/client-s3/dist-es/runtimeConfig.js
|
|
62392
62721
|
var import_checksum2 = __toESM(require_checksum(), 1);
|
|
62393
62722
|
var import_client23 = __toESM(require_client(), 1);
|
|
62394
|
-
var
|
|
62723
|
+
var import_config37 = __toESM(require_config(), 1);
|
|
62395
62724
|
var import_event_streams = __toESM(require_event_streams(), 1);
|
|
62396
62725
|
var import_retry3 = __toESM(require_retry(), 1);
|
|
62397
62726
|
var import_serde4 = __toESM(require_serde(), 1);
|
|
@@ -62681,7 +63010,7 @@ var getRuntimeConfig2 = (config) => {
|
|
|
62681
63010
|
// node_modules/@aws-sdk/client-s3/dist-es/runtimeConfig.js
|
|
62682
63011
|
var getRuntimeConfig3 = (config) => {
|
|
62683
63012
|
import_client23.emitWarningIfUnsupportedVersion(process.version);
|
|
62684
|
-
const defaultsMode =
|
|
63013
|
+
const defaultsMode = import_config37.resolveDefaultsModeConfig(config);
|
|
62685
63014
|
const defaultConfigProvider = () => defaultsMode().then(import_client23.loadConfigsForDefaultMode);
|
|
62686
63015
|
const clientSharedValues = getRuntimeConfig2(config);
|
|
62687
63016
|
import_client22.emitWarningIfUnsupportedVersion(process.version);
|
|
@@ -62694,28 +63023,28 @@ var getRuntimeConfig3 = (config) => {
|
|
|
62694
63023
|
...config,
|
|
62695
63024
|
runtime: "node",
|
|
62696
63025
|
defaultsMode,
|
|
62697
|
-
authSchemePreference: config?.authSchemePreference ??
|
|
63026
|
+
authSchemePreference: config?.authSchemePreference ?? import_config37.loadConfig(import_httpAuthSchemes3.NODE_AUTH_SCHEME_PREFERENCE_OPTIONS, loaderConfig),
|
|
62698
63027
|
bodyLengthChecker: config?.bodyLengthChecker ?? import_serde4.calculateBodyLength,
|
|
62699
63028
|
credentialDefaultProvider: config?.credentialDefaultProvider ?? defaultProvider,
|
|
62700
63029
|
defaultUserAgentProvider: config?.defaultUserAgentProvider ?? import_client22.createDefaultUserAgentProvider({ serviceId: clientSharedValues.serviceId, clientVersion: package_default2.version }),
|
|
62701
|
-
disableS3ExpressSessionAuth: config?.disableS3ExpressSessionAuth ??
|
|
63030
|
+
disableS3ExpressSessionAuth: config?.disableS3ExpressSessionAuth ?? import_config37.loadConfig($NODE_DISABLE_S3_EXPRESS_SESSION_AUTH_OPTIONS, loaderConfig),
|
|
62702
63031
|
eventStreamSerdeProvider: config?.eventStreamSerdeProvider ?? import_event_streams.eventStreamSerdeProvider,
|
|
62703
|
-
maxAttempts: config?.maxAttempts ??
|
|
62704
|
-
region: config?.region ??
|
|
62705
|
-
requestChecksumCalculation: config?.requestChecksumCalculation ??
|
|
63032
|
+
maxAttempts: config?.maxAttempts ?? import_config37.loadConfig(import_retry3.NODE_MAX_ATTEMPT_CONFIG_OPTIONS, config),
|
|
63033
|
+
region: config?.region ?? import_config37.loadConfig(import_config37.NODE_REGION_CONFIG_OPTIONS, { ...import_config37.NODE_REGION_CONFIG_FILE_OPTIONS, ...loaderConfig }),
|
|
63034
|
+
requestChecksumCalculation: config?.requestChecksumCalculation ?? import_config37.loadConfig($NODE_REQUEST_CHECKSUM_CALCULATION_CONFIG_OPTIONS, loaderConfig),
|
|
62706
63035
|
requestHandler: import_node_http_handler2.NodeHttpHandler.create(config?.requestHandler ?? defaultConfigProvider),
|
|
62707
|
-
responseChecksumValidation: config?.responseChecksumValidation ??
|
|
62708
|
-
retryMode: config?.retryMode ??
|
|
63036
|
+
responseChecksumValidation: config?.responseChecksumValidation ?? import_config37.loadConfig($NODE_RESPONSE_CHECKSUM_VALIDATION_CONFIG_OPTIONS, loaderConfig),
|
|
63037
|
+
retryMode: config?.retryMode ?? import_config37.loadConfig({
|
|
62709
63038
|
...import_retry3.NODE_RETRY_MODE_CONFIG_OPTIONS,
|
|
62710
63039
|
default: async () => (await defaultConfigProvider()).retryMode || import_retry3.DEFAULT_RETRY_MODE
|
|
62711
63040
|
}, config),
|
|
62712
|
-
sigv4aSigningRegionSet: config?.sigv4aSigningRegionSet ??
|
|
63041
|
+
sigv4aSigningRegionSet: config?.sigv4aSigningRegionSet ?? import_config37.loadConfig(import_httpAuthSchemes3.NODE_SIGV4A_CONFIG_OPTIONS, loaderConfig),
|
|
62713
63042
|
streamCollector: config?.streamCollector ?? import_node_http_handler2.streamCollector,
|
|
62714
63043
|
streamHasher: config?.streamHasher ?? import_checksum2.readableStreamHasher,
|
|
62715
|
-
useArnRegion: config?.useArnRegion ??
|
|
62716
|
-
useDualstackEndpoint: config?.useDualstackEndpoint ??
|
|
62717
|
-
useFipsEndpoint: config?.useFipsEndpoint ??
|
|
62718
|
-
userAgentAppId: config?.userAgentAppId ??
|
|
63044
|
+
useArnRegion: config?.useArnRegion ?? import_config37.loadConfig($NODE_USE_ARN_REGION_CONFIG_OPTIONS, loaderConfig),
|
|
63045
|
+
useDualstackEndpoint: config?.useDualstackEndpoint ?? import_config37.loadConfig(import_config37.NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS, loaderConfig),
|
|
63046
|
+
useFipsEndpoint: config?.useFipsEndpoint ?? import_config37.loadConfig(import_config37.NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS, loaderConfig),
|
|
63047
|
+
userAgentAppId: config?.userAgentAppId ?? import_config37.loadConfig(import_client22.NODE_APP_ID_CONFIG_OPTIONS, loaderConfig)
|
|
62719
63048
|
};
|
|
62720
63049
|
};
|
|
62721
63050
|
|
|
@@ -62781,7 +63110,7 @@ class S3Client extends import_client27.Client {
|
|
|
62781
63110
|
const _config_2 = import_client26.resolveUserAgentConfig(_config_1);
|
|
62782
63111
|
const _config_3 = $resolveFlexibleChecksumsConfig(_config_2);
|
|
62783
63112
|
const _config_4 = import_retry4.resolveRetryConfig(_config_3);
|
|
62784
|
-
const _config_5 =
|
|
63113
|
+
const _config_5 = import_config38.resolveRegionConfig(_config_4);
|
|
62785
63114
|
const _config_6 = import_client26.resolveHostHeaderConfig(_config_5);
|
|
62786
63115
|
const _config_7 = import_endpoints5.resolveEndpointConfig(_config_6);
|
|
62787
63116
|
const _config_8 = import_event_streams2.resolveEventStreamSerdeConfig(_config_7);
|
|
@@ -63176,7 +63505,7 @@ function assertReservationCents(value, field3) {
|
|
|
63176
63505
|
// src/sdk/governance-store.ts
|
|
63177
63506
|
import { Database as Database2 } from "bun:sqlite";
|
|
63178
63507
|
import { randomUUID as randomUUID9 } from "crypto";
|
|
63179
|
-
import { mkdirSync as
|
|
63508
|
+
import { mkdirSync as mkdirSync15 } from "fs";
|
|
63180
63509
|
import { dirname as dirname33 } from "path";
|
|
63181
63510
|
|
|
63182
63511
|
// src/server/database-url.ts
|
|
@@ -63472,7 +63801,7 @@ class PostgresSkillSelectionStore {
|
|
|
63472
63801
|
|
|
63473
63802
|
// src/server/sqlite-store.ts
|
|
63474
63803
|
import { randomUUID as randomUUID8 } from "crypto";
|
|
63475
|
-
import { mkdirSync as
|
|
63804
|
+
import { mkdirSync as mkdirSync14, readFileSync as readFileSync30, readdirSync as readdirSync16 } from "fs";
|
|
63476
63805
|
import { dirname as dirname32, join as join47 } from "path";
|
|
63477
63806
|
|
|
63478
63807
|
// src/server/auth.ts
|
|
@@ -63849,7 +64178,7 @@ class SqliteSkillsStore {
|
|
|
63849
64178
|
constructor(path = SQLITE_MEMORY_PATH, options = {}) {
|
|
63850
64179
|
const inMemory = path === SQLITE_MEMORY_PATH;
|
|
63851
64180
|
if (!inMemory)
|
|
63852
|
-
|
|
64181
|
+
mkdirSync14(dirname32(path), { recursive: true });
|
|
63853
64182
|
this.db = openDatabase(path);
|
|
63854
64183
|
this.db.exec(`PRAGMA busy_timeout = ${Math.max(0, options.busyTimeoutMs ?? 5000)}`);
|
|
63855
64184
|
if (!inMemory)
|
|
@@ -64521,7 +64850,7 @@ function applySqliteMigrations(db, migrationsDir = resolveMigrationsDir("sqlite"
|
|
|
64521
64850
|
version text PRIMARY KEY,
|
|
64522
64851
|
applied_at text NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))
|
|
64523
64852
|
)`);
|
|
64524
|
-
const files =
|
|
64853
|
+
const files = readdirSync16(migrationsDir).filter((name) => name.endsWith(".sql")).sort();
|
|
64525
64854
|
if (files.length === 0) {
|
|
64526
64855
|
throw new Error(`no .sql migrations found in ${migrationsDir}`);
|
|
64527
64856
|
}
|
|
@@ -64675,7 +65004,7 @@ class SqliteGovernanceStore {
|
|
|
64675
65004
|
closed = false;
|
|
64676
65005
|
constructor(path = SQLITE_MEMORY_PATH, options = {}) {
|
|
64677
65006
|
if (path !== SQLITE_MEMORY_PATH)
|
|
64678
|
-
|
|
65007
|
+
mkdirSync15(dirname33(path), { recursive: true });
|
|
64679
65008
|
this.db = new Database2(path, { create: true, readwrite: true });
|
|
64680
65009
|
this.db.exec("PRAGMA busy_timeout = 5000");
|
|
64681
65010
|
this.db.exec("PRAGMA foreign_keys = ON");
|
|
@@ -65780,7 +66109,7 @@ async function handleProfileApi(store, principal, request2, parts, config) {
|
|
|
65780
66109
|
|
|
65781
66110
|
// src/server/runtime-store.ts
|
|
65782
66111
|
import { Database as Database3 } from "bun:sqlite";
|
|
65783
|
-
import { mkdirSync as
|
|
66112
|
+
import { mkdirSync as mkdirSync16 } from "fs";
|
|
65784
66113
|
import { dirname as dirname34 } from "path";
|
|
65785
66114
|
|
|
65786
66115
|
// src/sdk/execution/types.ts
|
|
@@ -65837,7 +66166,7 @@ class RuntimeExecutionStore {
|
|
|
65837
66166
|
}
|
|
65838
66167
|
const path = target.kind === "sqlite" ? target.path : ":memory:";
|
|
65839
66168
|
if (path !== ":memory:")
|
|
65840
|
-
|
|
66169
|
+
mkdirSync16(dirname34(path), { recursive: true });
|
|
65841
66170
|
const db = new Database3(path);
|
|
65842
66171
|
db.run("PRAGMA busy_timeout=5000");
|
|
65843
66172
|
db.run("PRAGMA journal_mode=WAL");
|
|
@@ -66861,7 +67190,7 @@ function createReceiptService(store) {
|
|
|
66861
67190
|
var import_client36 = __toESM(require_client2(), 1);
|
|
66862
67191
|
var import_core2 = __toESM(require_dist_cjs2(), 1);
|
|
66863
67192
|
var import_client37 = __toESM(require_client(), 1);
|
|
66864
|
-
var
|
|
67193
|
+
var import_config41 = __toESM(require_config(), 1);
|
|
66865
67194
|
var import_endpoints8 = __toESM(require_endpoints(), 1);
|
|
66866
67195
|
var import_protocols10 = __toESM(require_protocols(), 1);
|
|
66867
67196
|
var import_retry6 = __toESM(require_retry(), 1);
|
|
@@ -67000,7 +67329,7 @@ var package_default3 = {
|
|
|
67000
67329
|
var import_client32 = __toESM(require_client2(), 1);
|
|
67001
67330
|
var import_httpAuthSchemes6 = __toESM(require_httpAuthSchemes(), 1);
|
|
67002
67331
|
var import_client33 = __toESM(require_client(), 1);
|
|
67003
|
-
var
|
|
67332
|
+
var import_config40 = __toESM(require_config(), 1);
|
|
67004
67333
|
var import_retry5 = __toESM(require_retry(), 1);
|
|
67005
67334
|
var import_serde6 = __toESM(require_serde(), 1);
|
|
67006
67335
|
var import_node_http_handler3 = __toESM(require_dist_cjs6(), 1);
|
|
@@ -69942,7 +70271,7 @@ var getRuntimeConfig4 = (config) => {
|
|
|
69942
70271
|
// node_modules/@aws-sdk/client-ecs/dist-es/runtimeConfig.js
|
|
69943
70272
|
var getRuntimeConfig5 = (config) => {
|
|
69944
70273
|
import_client33.emitWarningIfUnsupportedVersion(process.version);
|
|
69945
|
-
const defaultsMode =
|
|
70274
|
+
const defaultsMode = import_config40.resolveDefaultsModeConfig(config);
|
|
69946
70275
|
const defaultConfigProvider = () => defaultsMode().then(import_client33.loadConfigsForDefaultMode);
|
|
69947
70276
|
const clientSharedValues = getRuntimeConfig4(config);
|
|
69948
70277
|
import_client32.emitWarningIfUnsupportedVersion(process.version);
|
|
@@ -69955,21 +70284,21 @@ var getRuntimeConfig5 = (config) => {
|
|
|
69955
70284
|
...config,
|
|
69956
70285
|
runtime: "node",
|
|
69957
70286
|
defaultsMode,
|
|
69958
|
-
authSchemePreference: config?.authSchemePreference ??
|
|
70287
|
+
authSchemePreference: config?.authSchemePreference ?? import_config40.loadConfig(import_httpAuthSchemes6.NODE_AUTH_SCHEME_PREFERENCE_OPTIONS, loaderConfig),
|
|
69959
70288
|
bodyLengthChecker: config?.bodyLengthChecker ?? import_serde6.calculateBodyLength,
|
|
69960
70289
|
credentialDefaultProvider: config?.credentialDefaultProvider ?? defaultProvider,
|
|
69961
70290
|
defaultUserAgentProvider: config?.defaultUserAgentProvider ?? import_client32.createDefaultUserAgentProvider({ serviceId: clientSharedValues.serviceId, clientVersion: package_default3.version }),
|
|
69962
|
-
maxAttempts: config?.maxAttempts ??
|
|
69963
|
-
region: config?.region ??
|
|
70291
|
+
maxAttempts: config?.maxAttempts ?? import_config40.loadConfig(import_retry5.NODE_MAX_ATTEMPT_CONFIG_OPTIONS, config),
|
|
70292
|
+
region: config?.region ?? import_config40.loadConfig(import_config40.NODE_REGION_CONFIG_OPTIONS, { ...import_config40.NODE_REGION_CONFIG_FILE_OPTIONS, ...loaderConfig }),
|
|
69964
70293
|
requestHandler: import_node_http_handler3.NodeHttpHandler.create(config?.requestHandler ?? defaultConfigProvider),
|
|
69965
|
-
retryMode: config?.retryMode ??
|
|
70294
|
+
retryMode: config?.retryMode ?? import_config40.loadConfig({
|
|
69966
70295
|
...import_retry5.NODE_RETRY_MODE_CONFIG_OPTIONS,
|
|
69967
70296
|
default: async () => (await defaultConfigProvider()).retryMode || import_retry5.DEFAULT_RETRY_MODE
|
|
69968
70297
|
}, config),
|
|
69969
70298
|
streamCollector: config?.streamCollector ?? import_node_http_handler3.streamCollector,
|
|
69970
|
-
useDualstackEndpoint: config?.useDualstackEndpoint ??
|
|
69971
|
-
useFipsEndpoint: config?.useFipsEndpoint ??
|
|
69972
|
-
userAgentAppId: config?.userAgentAppId ??
|
|
70299
|
+
useDualstackEndpoint: config?.useDualstackEndpoint ?? import_config40.loadConfig(import_config40.NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS, loaderConfig),
|
|
70300
|
+
useFipsEndpoint: config?.useFipsEndpoint ?? import_config40.loadConfig(import_config40.NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS, loaderConfig),
|
|
70301
|
+
userAgentAppId: config?.userAgentAppId ?? import_config40.loadConfig(import_client32.NODE_APP_ID_CONFIG_OPTIONS, loaderConfig)
|
|
69973
70302
|
};
|
|
69974
70303
|
};
|
|
69975
70304
|
|
|
@@ -70034,7 +70363,7 @@ class ECSClient extends import_client37.Client {
|
|
|
70034
70363
|
const _config_1 = resolveClientEndpointParameters3(_config_0);
|
|
70035
70364
|
const _config_2 = import_client36.resolveUserAgentConfig(_config_1);
|
|
70036
70365
|
const _config_3 = import_retry6.resolveRetryConfig(_config_2);
|
|
70037
|
-
const _config_4 =
|
|
70366
|
+
const _config_4 = import_config41.resolveRegionConfig(_config_3);
|
|
70038
70367
|
const _config_5 = import_client36.resolveHostHeaderConfig(_config_4);
|
|
70039
70368
|
const _config_6 = import_endpoints8.resolveEndpointConfig(_config_5);
|
|
70040
70369
|
const _config_7 = resolveHttpAuthSchemeConfig3(_config_6);
|
|
@@ -98528,7 +98857,7 @@ class RemoteSkillsAuthClient {
|
|
|
98528
98857
|
}
|
|
98529
98858
|
}
|
|
98530
98859
|
// src/lib/private-publication-recovery.ts
|
|
98531
|
-
import { constants as constants22, closeSync as closeSync24, fsyncSync as fsyncSync8, fstatSync as fstatSync24, lstatSync as lstatSync34, mkdirSync as
|
|
98860
|
+
import { constants as constants22, closeSync as closeSync24, fsyncSync as fsyncSync8, fstatSync as fstatSync24, lstatSync as lstatSync34, mkdirSync as mkdirSync17, openSync as openSync24, readSync as readSync16, realpathSync as realpathSync18, renameSync as renameSync7, unlinkSync as unlinkSync6, writeFileSync as writeFileSync11 } from "fs";
|
|
98532
98861
|
import { dirname as dirname35, isAbsolute as isAbsolute32, join as join49, resolve as resolve32 } from "path";
|
|
98533
98862
|
import { randomUUID as randomUUID12 } from "crypto";
|
|
98534
98863
|
var fail2 = () => {
|
|
@@ -98675,7 +99004,7 @@ async function preparePrivatePublication(client2, sourceDirectory, recoveryDirec
|
|
|
98675
99004
|
};
|
|
98676
99005
|
if (!isAbsolute32(recoveryDirectory) || resolve32(recoveryDirectory) !== recoveryDirectory || realpathSync18(dirname35(recoveryDirectory)) !== dirname35(recoveryDirectory))
|
|
98677
99006
|
return fail2();
|
|
98678
|
-
|
|
99007
|
+
mkdirSync17(recoveryDirectory, { mode: 448 });
|
|
98679
99008
|
safeDirectory(recoveryDirectory);
|
|
98680
99009
|
const parent = openSync24(dirname35(recoveryDirectory), constants22.O_RDONLY | constants22.O_NOFOLLOW);
|
|
98681
99010
|
try {
|