@hasna/skills 0.9.11 → 0.9.12
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 +67 -0
- package/bin/index.js +17043 -16822
- package/bin/mcp.js +11574 -9832
- package/bin/migrate.js +1 -1
- package/bin/server.js +1 -1
- package/bin/worker.js +1 -1
- package/dist/cli/commands/profile-sync.d.ts +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +7917 -7530
- package/dist/lib/agent-codex-trust.d.ts +15 -0
- package/dist/lib/agent-discovery.d.ts +1 -0
- package/dist/lib/agent-integration.d.ts +15 -0
- package/dist/lib/authoring-path.d.ts +10 -0
- package/dist/lib/claude-settings-witness.d.ts +6 -0
- package/dist/lib/codex-hook-additions-review.d.ts +42 -0
- package/dist/lib/native-discovery-roots.d.ts +2 -0
- package/dist/sdk/index.js +779 -395
- package/docs/skill-standard.md +7 -1
- package/package.json +1 -1
package/dist/sdk/index.js
CHANGED
|
@@ -8209,7 +8209,7 @@ var require_client = __commonJS((exports) => {
|
|
|
8209
8209
|
};
|
|
8210
8210
|
};
|
|
8211
8211
|
var sleep = (seconds) => {
|
|
8212
|
-
return new Promise((
|
|
8212
|
+
return new Promise((resolve18) => setTimeout(resolve18, seconds * 1000));
|
|
8213
8213
|
};
|
|
8214
8214
|
var waiterServiceDefaults = {
|
|
8215
8215
|
minDelay: 2,
|
|
@@ -8338,8 +8338,8 @@ var require_client = __commonJS((exports) => {
|
|
|
8338
8338
|
};
|
|
8339
8339
|
var abortTimeout = (abortSignal) => {
|
|
8340
8340
|
let onAbort;
|
|
8341
|
-
const promise = new Promise((
|
|
8342
|
-
onAbort = () =>
|
|
8341
|
+
const promise = new Promise((resolve18) => {
|
|
8342
|
+
onAbort = () => resolve18({ state: WaiterState.ABORTED });
|
|
8343
8343
|
if (typeof abortSignal.addEventListener === "function") {
|
|
8344
8344
|
abortSignal.addEventListener("abort", onAbort);
|
|
8345
8345
|
} else {
|
|
@@ -9002,8 +9002,8 @@ var require_client = __commonJS((exports) => {
|
|
|
9002
9002
|
|
|
9003
9003
|
// node_modules/@smithy/core/dist-cjs/submodules/config/index.js
|
|
9004
9004
|
var require_config = __commonJS((exports) => {
|
|
9005
|
-
var { homedir:
|
|
9006
|
-
var { sep:
|
|
9005
|
+
var { homedir: homedir7 } = __require("os");
|
|
9006
|
+
var { sep: sep8, join: join4 } = __require("path");
|
|
9007
9007
|
var { createHash: createHash19 } = __require("crypto");
|
|
9008
9008
|
var { readFile: readFile$1 } = __require("fs/promises");
|
|
9009
9009
|
var { IniSectionType } = require_dist_cjs();
|
|
@@ -9143,7 +9143,7 @@ var require_config = __commonJS((exports) => {
|
|
|
9143
9143
|
return "DEFAULT";
|
|
9144
9144
|
};
|
|
9145
9145
|
var getHomeDir = () => {
|
|
9146
|
-
const { HOME, USERPROFILE, HOMEPATH, HOMEDRIVE = `C:${
|
|
9146
|
+
const { HOME, USERPROFILE, HOMEPATH, HOMEDRIVE = `C:${sep8}` } = process.env;
|
|
9147
9147
|
if (HOME)
|
|
9148
9148
|
return HOME;
|
|
9149
9149
|
if (USERPROFILE)
|
|
@@ -9152,7 +9152,7 @@ var require_config = __commonJS((exports) => {
|
|
|
9152
9152
|
return `${HOMEDRIVE}${HOMEPATH}`;
|
|
9153
9153
|
const homeDirCacheKey = getHomeDirCacheKey();
|
|
9154
9154
|
if (!homeDirCache[homeDirCacheKey])
|
|
9155
|
-
homeDirCache[homeDirCacheKey] =
|
|
9155
|
+
homeDirCache[homeDirCacheKey] = homedir7();
|
|
9156
9156
|
return homeDirCache[homeDirCacheKey];
|
|
9157
9157
|
};
|
|
9158
9158
|
var ENV_PROFILE = "AWS_PROFILE";
|
|
@@ -9477,7 +9477,7 @@ var require_config = __commonJS((exports) => {
|
|
|
9477
9477
|
};
|
|
9478
9478
|
var imdsRequest = async (options) => {
|
|
9479
9479
|
const { request: request2 } = __require("http");
|
|
9480
|
-
return new Promise((
|
|
9480
|
+
return new Promise((resolve18, reject) => {
|
|
9481
9481
|
const req = request2({
|
|
9482
9482
|
hostname: options.hostname,
|
|
9483
9483
|
port: options.port,
|
|
@@ -9505,7 +9505,7 @@ var require_config = __commonJS((exports) => {
|
|
|
9505
9505
|
const chunks = [];
|
|
9506
9506
|
res.on("data", (chunk) => chunks.push(chunk));
|
|
9507
9507
|
res.on("end", () => {
|
|
9508
|
-
|
|
9508
|
+
resolve18(Buffer.concat(chunks));
|
|
9509
9509
|
req.destroy();
|
|
9510
9510
|
});
|
|
9511
9511
|
});
|
|
@@ -10514,7 +10514,7 @@ var require_serde = __commonJS((exports) => {
|
|
|
10514
10514
|
var { createHmac: createHmac2, createHash: createHash19, getRandomValues } = __require("crypto");
|
|
10515
10515
|
var { hasOwn: hasOwn2, HttpResponse } = require_transport();
|
|
10516
10516
|
exports.hasOwn = hasOwn2;
|
|
10517
|
-
var { ReadStream, lstatSync:
|
|
10517
|
+
var { ReadStream, lstatSync: lstatSync22, fstatSync: fstatSync4 } = __require("fs");
|
|
10518
10518
|
var { toEndpointV1 } = require_endpoints();
|
|
10519
10519
|
var { Readable, Writable, PassThrough } = __require("stream");
|
|
10520
10520
|
var isArrayBuffer = (arg) => typeof ArrayBuffer === "function" && arg instanceof ArrayBuffer || Object.prototype.toString.call(arg) === "[object ArrayBuffer]";
|
|
@@ -11280,7 +11280,7 @@ var require_serde = __commonJS((exports) => {
|
|
|
11280
11280
|
return body.end + 1 - body.start;
|
|
11281
11281
|
} else if (body instanceof ReadStream) {
|
|
11282
11282
|
if (body.path != null) {
|
|
11283
|
-
return
|
|
11283
|
+
return lstatSync22(body.path).size;
|
|
11284
11284
|
} else if (typeof body.fd === "number") {
|
|
11285
11285
|
return fstatSync4(body.fd).size;
|
|
11286
11286
|
}
|
|
@@ -11861,7 +11861,7 @@ ${value}\r
|
|
|
11861
11861
|
if (isReadableStream(stream)) {
|
|
11862
11862
|
return headStream$1(stream, bytes);
|
|
11863
11863
|
}
|
|
11864
|
-
return new Promise((
|
|
11864
|
+
return new Promise((resolve18, reject) => {
|
|
11865
11865
|
const collector = new Collector$1;
|
|
11866
11866
|
collector.limit = bytes;
|
|
11867
11867
|
stream.pipe(collector);
|
|
@@ -11872,7 +11872,7 @@ ${value}\r
|
|
|
11872
11872
|
collector.on("error", reject);
|
|
11873
11873
|
collector.on("finish", function() {
|
|
11874
11874
|
const bytes2 = concatBytes(this.buffers);
|
|
11875
|
-
|
|
11875
|
+
resolve18(bytes2);
|
|
11876
11876
|
});
|
|
11877
11877
|
});
|
|
11878
11878
|
};
|
|
@@ -11986,7 +11986,7 @@ ${value}\r
|
|
|
11986
11986
|
if (isReadableStream(stream)) {
|
|
11987
11987
|
return collectReadableStream(stream);
|
|
11988
11988
|
}
|
|
11989
|
-
return new Promise((
|
|
11989
|
+
return new Promise((resolve18, reject) => {
|
|
11990
11990
|
const collector = new Collector;
|
|
11991
11991
|
const nodeStream = stream;
|
|
11992
11992
|
nodeStream.pipe(collector);
|
|
@@ -11997,7 +11997,7 @@ ${value}\r
|
|
|
11997
11997
|
collector.on("error", reject);
|
|
11998
11998
|
collector.on("finish", function() {
|
|
11999
11999
|
const bytes = concatBytes(this.bufferedBytes);
|
|
12000
|
-
|
|
12000
|
+
resolve18(bytes);
|
|
12001
12001
|
});
|
|
12002
12002
|
});
|
|
12003
12003
|
};
|
|
@@ -12189,7 +12189,7 @@ var require_checksum = __commonJS((exports) => {
|
|
|
12189
12189
|
callback();
|
|
12190
12190
|
}
|
|
12191
12191
|
}
|
|
12192
|
-
var fileStreamHasher = (hashCtor, fileStream) => new Promise((
|
|
12192
|
+
var fileStreamHasher = (hashCtor, fileStream) => new Promise((resolve18, reject) => {
|
|
12193
12193
|
if (!isReadStream(fileStream)) {
|
|
12194
12194
|
reject(new Error("Unable to calculate hash for non-file streams."));
|
|
12195
12195
|
return;
|
|
@@ -12207,7 +12207,7 @@ var require_checksum = __commonJS((exports) => {
|
|
|
12207
12207
|
});
|
|
12208
12208
|
hashCalculator.on("error", reject);
|
|
12209
12209
|
hashCalculator.on("finish", function() {
|
|
12210
|
-
hash2.digest().then(
|
|
12210
|
+
hash2.digest().then(resolve18).catch(reject);
|
|
12211
12211
|
});
|
|
12212
12212
|
});
|
|
12213
12213
|
var isReadStream = (stream) => typeof stream.path === "string";
|
|
@@ -12218,14 +12218,14 @@ var require_checksum = __commonJS((exports) => {
|
|
|
12218
12218
|
const hash2 = new hashCtor;
|
|
12219
12219
|
const hashCalculator = new HashCalculator(hash2);
|
|
12220
12220
|
readableStream.pipe(hashCalculator);
|
|
12221
|
-
return new Promise((
|
|
12221
|
+
return new Promise((resolve18, reject) => {
|
|
12222
12222
|
readableStream.on("error", (err) => {
|
|
12223
12223
|
hashCalculator.end();
|
|
12224
12224
|
reject(err);
|
|
12225
12225
|
});
|
|
12226
12226
|
hashCalculator.on("error", reject);
|
|
12227
12227
|
hashCalculator.on("finish", () => {
|
|
12228
|
-
hash2.digest().then(
|
|
12228
|
+
hash2.digest().then(resolve18).catch(reject);
|
|
12229
12229
|
});
|
|
12230
12230
|
});
|
|
12231
12231
|
};
|
|
@@ -13334,7 +13334,7 @@ var require_event_streams = __commonJS((exports) => {
|
|
|
13334
13334
|
streamEnded = true;
|
|
13335
13335
|
});
|
|
13336
13336
|
while (!generationEnded) {
|
|
13337
|
-
const value = await new Promise((
|
|
13337
|
+
const value = await new Promise((resolve18) => setTimeout(() => resolve18(records.shift()), 0));
|
|
13338
13338
|
if (value) {
|
|
13339
13339
|
yield value;
|
|
13340
13340
|
}
|
|
@@ -14852,7 +14852,7 @@ var require_retry = __commonJS((exports) => {
|
|
|
14852
14852
|
}
|
|
14853
14853
|
};
|
|
14854
14854
|
}
|
|
14855
|
-
var cooldown = (ms) => new Promise((
|
|
14855
|
+
var cooldown = (ms) => new Promise((resolve18) => setTimeout(resolve18, ms));
|
|
14856
14856
|
var isRetryStrategyV2 = (retryStrategy) => typeof retryStrategy.acquireInitialRetryToken !== "undefined" && typeof retryStrategy.refreshRetryTokenForRetry !== "undefined" && typeof retryStrategy.recordSuccess !== "undefined";
|
|
14857
14857
|
var getRetryErrorInfo = (error, logger) => {
|
|
14858
14858
|
const errorInfo = {
|
|
@@ -14951,7 +14951,7 @@ var require_retry = __commonJS((exports) => {
|
|
|
14951
14951
|
this.refillTokenBucket();
|
|
14952
14952
|
while (amount > this.availableTokens) {
|
|
14953
14953
|
const delay = (amount - this.availableTokens) / this.fillRate * 1000;
|
|
14954
|
-
await new Promise((
|
|
14954
|
+
await new Promise((resolve18) => DefaultRateLimiter.setTimeoutFn(resolve18, delay));
|
|
14955
14955
|
this.refillTokenBucket();
|
|
14956
14956
|
}
|
|
14957
14957
|
this.availableTokens = this.availableTokens - amount;
|
|
@@ -15293,7 +15293,7 @@ var require_retry = __commonJS((exports) => {
|
|
|
15293
15293
|
const delayFromResponse = getDelayFromRetryAfterHeader(err.$response);
|
|
15294
15294
|
const delay = Math.max(delayFromResponse || 0, delayFromDecider);
|
|
15295
15295
|
totalDelay += delay;
|
|
15296
|
-
await new Promise((
|
|
15296
|
+
await new Promise((resolve18) => setTimeout(resolve18, delay));
|
|
15297
15297
|
continue;
|
|
15298
15298
|
}
|
|
15299
15299
|
if (!err.$metadata) {
|
|
@@ -24586,7 +24586,7 @@ var require_httpAuthSchemes = __commonJS((exports) => {
|
|
|
24586
24586
|
});
|
|
24587
24587
|
|
|
24588
24588
|
// node_modules/@aws-sdk/credential-provider-env/dist-es/fromEnv.js
|
|
24589
|
-
var import_client8,
|
|
24589
|
+
var import_client8, import_config9, ENV_KEY = "AWS_ACCESS_KEY_ID", ENV_SECRET = "AWS_SECRET_ACCESS_KEY", ENV_SESSION = "AWS_SESSION_TOKEN", ENV_EXPIRATION = "AWS_CREDENTIAL_EXPIRATION", ENV_CREDENTIAL_SCOPE = "AWS_CREDENTIAL_SCOPE", ENV_ACCOUNT_ID = "AWS_ACCOUNT_ID", fromEnv = (init) => async () => {
|
|
24590
24590
|
init?.logger?.debug("@aws-sdk/credential-provider-env - fromEnv");
|
|
24591
24591
|
const accessKeyId = process.env[ENV_KEY];
|
|
24592
24592
|
const secretAccessKey = process.env[ENV_SECRET];
|
|
@@ -24606,11 +24606,11 @@ var import_client8, import_config8, ENV_KEY = "AWS_ACCESS_KEY_ID", ENV_SECRET =
|
|
|
24606
24606
|
import_client8.setCredentialFeature(credentials, "CREDENTIALS_ENV_VARS", "g");
|
|
24607
24607
|
return credentials;
|
|
24608
24608
|
}
|
|
24609
|
-
throw new
|
|
24609
|
+
throw new import_config9.CredentialsProviderError("Unable to find environment variable credentials.", { logger: init?.logger });
|
|
24610
24610
|
};
|
|
24611
24611
|
var init_fromEnv = __esm(() => {
|
|
24612
24612
|
import_client8 = __toESM(require_client2(), 1);
|
|
24613
|
-
|
|
24613
|
+
import_config9 = __toESM(require_config(), 1);
|
|
24614
24614
|
});
|
|
24615
24615
|
|
|
24616
24616
|
// node_modules/@aws-sdk/credential-provider-env/dist-es/index.js
|
|
@@ -24646,24 +24646,24 @@ var init_node_http = () => {};
|
|
|
24646
24646
|
|
|
24647
24647
|
// node_modules/@smithy/credential-provider-imds/dist-es/remoteProvider/httpRequest.js
|
|
24648
24648
|
function httpRequest(options) {
|
|
24649
|
-
return new Promise((
|
|
24649
|
+
return new Promise((resolve18, reject) => {
|
|
24650
24650
|
const req = node_http.request({
|
|
24651
24651
|
method: "GET",
|
|
24652
24652
|
...options,
|
|
24653
24653
|
hostname: options.hostname?.replace(/^\[(.+)\]$/, "$1")
|
|
24654
24654
|
});
|
|
24655
24655
|
req.on("error", (err) => {
|
|
24656
|
-
reject(Object.assign(new
|
|
24656
|
+
reject(Object.assign(new import_config10.ProviderError("Unable to connect to instance metadata service"), err));
|
|
24657
24657
|
req.destroy();
|
|
24658
24658
|
});
|
|
24659
24659
|
req.on("timeout", () => {
|
|
24660
|
-
reject(new
|
|
24660
|
+
reject(new import_config10.ProviderError("TimeoutError from instance metadata service"));
|
|
24661
24661
|
req.destroy();
|
|
24662
24662
|
});
|
|
24663
24663
|
req.on("response", (res) => {
|
|
24664
24664
|
const { statusCode = 400 } = res;
|
|
24665
24665
|
if (statusCode < 200 || 300 <= statusCode) {
|
|
24666
|
-
reject(Object.assign(new
|
|
24666
|
+
reject(Object.assign(new import_config10.ProviderError("Error response received from instance metadata service"), { statusCode }));
|
|
24667
24667
|
req.destroy();
|
|
24668
24668
|
}
|
|
24669
24669
|
const chunks = [];
|
|
@@ -24671,17 +24671,17 @@ function httpRequest(options) {
|
|
|
24671
24671
|
chunks.push(chunk);
|
|
24672
24672
|
});
|
|
24673
24673
|
res.on("end", () => {
|
|
24674
|
-
|
|
24674
|
+
resolve18(Buffer.concat(chunks));
|
|
24675
24675
|
req.destroy();
|
|
24676
24676
|
});
|
|
24677
24677
|
});
|
|
24678
24678
|
req.end();
|
|
24679
24679
|
});
|
|
24680
24680
|
}
|
|
24681
|
-
var
|
|
24681
|
+
var import_config10;
|
|
24682
24682
|
var init_httpRequest = __esm(() => {
|
|
24683
24683
|
init_node_http();
|
|
24684
|
-
|
|
24684
|
+
import_config10 = __toESM(require_config(), 1);
|
|
24685
24685
|
});
|
|
24686
24686
|
|
|
24687
24687
|
// node_modules/@smithy/credential-provider-imds/dist-es/remoteProvider/retry.js
|
|
@@ -24694,13 +24694,13 @@ var retry = (toRetry, maxRetries) => {
|
|
|
24694
24694
|
};
|
|
24695
24695
|
|
|
24696
24696
|
// node_modules/@smithy/credential-provider-imds/dist-es/fromContainerMetadata.js
|
|
24697
|
-
var
|
|
24697
|
+
var import_config11, ENV_CMDS_FULL_URI = "AWS_CONTAINER_CREDENTIALS_FULL_URI", ENV_CMDS_RELATIVE_URI = "AWS_CONTAINER_CREDENTIALS_RELATIVE_URI", ENV_CMDS_AUTH_TOKEN = "AWS_CONTAINER_AUTHORIZATION_TOKEN", fromContainerMetadata = (init = {}) => {
|
|
24698
24698
|
const { timeout, maxRetries } = providerConfigFromInit(init);
|
|
24699
24699
|
return () => retry(async () => {
|
|
24700
24700
|
const requestOptions = await getCmdsUri({ logger: init.logger });
|
|
24701
24701
|
const credsResponse = JSON.parse(await requestFromEcsImds(timeout, requestOptions));
|
|
24702
24702
|
if (!isImdsCredentials(credsResponse)) {
|
|
24703
|
-
throw new
|
|
24703
|
+
throw new import_config11.CredentialsProviderError("Invalid response received from instance metadata service.", {
|
|
24704
24704
|
logger: init.logger
|
|
24705
24705
|
});
|
|
24706
24706
|
}
|
|
@@ -24730,16 +24730,16 @@ var import_config10, ENV_CMDS_FULL_URI = "AWS_CONTAINER_CREDENTIALS_FULL_URI", E
|
|
|
24730
24730
|
try {
|
|
24731
24731
|
parsed = new URL(process.env[ENV_CMDS_FULL_URI]);
|
|
24732
24732
|
} catch {
|
|
24733
|
-
throw new
|
|
24733
|
+
throw new import_config11.CredentialsProviderError(`${process.env[ENV_CMDS_FULL_URI]} is not a valid container metadata service URL`, { tryNextLink: false, logger });
|
|
24734
24734
|
}
|
|
24735
24735
|
if (!parsed.hostname || !GREENGRASS_HOSTS.has(parsed.hostname)) {
|
|
24736
|
-
throw new
|
|
24736
|
+
throw new import_config11.CredentialsProviderError(`${parsed.hostname} is not a valid container metadata service hostname`, {
|
|
24737
24737
|
tryNextLink: false,
|
|
24738
24738
|
logger
|
|
24739
24739
|
});
|
|
24740
24740
|
}
|
|
24741
24741
|
if (!parsed.protocol || !GREENGRASS_PROTOCOLS.has(parsed.protocol)) {
|
|
24742
|
-
throw new
|
|
24742
|
+
throw new import_config11.CredentialsProviderError(`${parsed.protocol} is not a valid container metadata service protocol`, {
|
|
24743
24743
|
tryNextLink: false,
|
|
24744
24744
|
logger
|
|
24745
24745
|
});
|
|
@@ -24751,23 +24751,23 @@ var import_config10, ENV_CMDS_FULL_URI = "AWS_CONTAINER_CREDENTIALS_FULL_URI", E
|
|
|
24751
24751
|
port: parsed.port ? parseInt(parsed.port, 10) : undefined
|
|
24752
24752
|
};
|
|
24753
24753
|
}
|
|
24754
|
-
throw new
|
|
24754
|
+
throw new import_config11.CredentialsProviderError("The container metadata credential provider cannot be used unless" + ` the ${ENV_CMDS_RELATIVE_URI} or ${ENV_CMDS_FULL_URI} environment` + " variable is set", {
|
|
24755
24755
|
tryNextLink: false,
|
|
24756
24756
|
logger
|
|
24757
24757
|
});
|
|
24758
24758
|
};
|
|
24759
24759
|
var init_fromContainerMetadata = __esm(() => {
|
|
24760
24760
|
init_httpRequest();
|
|
24761
|
-
|
|
24761
|
+
import_config11 = __toESM(require_config(), 1);
|
|
24762
24762
|
GREENGRASS_HOSTS = new Set(["localhost", "127.0.0.1"]);
|
|
24763
24763
|
GREENGRASS_PROTOCOLS = new Set(["http:", "https:"]);
|
|
24764
24764
|
});
|
|
24765
24765
|
|
|
24766
24766
|
// node_modules/@smithy/credential-provider-imds/dist-es/error/InstanceMetadataV1FallbackError.js
|
|
24767
|
-
var
|
|
24767
|
+
var import_config12, InstanceMetadataV1FallbackError;
|
|
24768
24768
|
var init_InstanceMetadataV1FallbackError = __esm(() => {
|
|
24769
|
-
|
|
24770
|
-
InstanceMetadataV1FallbackError = class InstanceMetadataV1FallbackError extends
|
|
24769
|
+
import_config12 = __toESM(require_config(), 1);
|
|
24770
|
+
InstanceMetadataV1FallbackError = class InstanceMetadataV1FallbackError extends import_config12.CredentialsProviderError {
|
|
24771
24771
|
tryNextLink;
|
|
24772
24772
|
name = "InstanceMetadataV1FallbackError";
|
|
24773
24773
|
constructor(message, tryNextLink = true) {
|
|
@@ -24818,8 +24818,8 @@ var init_EndpointModeConfigOptions = __esm(() => {
|
|
|
24818
24818
|
});
|
|
24819
24819
|
|
|
24820
24820
|
// node_modules/@smithy/credential-provider-imds/dist-es/utils/getInstanceMetadataEndpoint.js
|
|
24821
|
-
var
|
|
24822
|
-
const endpointMode = await
|
|
24821
|
+
var import_config13, import_protocols, getInstanceMetadataEndpoint = async () => import_protocols.parseUrl(await getFromEndpointConfig() || await getFromEndpointModeConfig()), getFromEndpointConfig = async () => import_config13.loadConfig(ENDPOINT_CONFIG_OPTIONS)(), getFromEndpointModeConfig = async () => {
|
|
24822
|
+
const endpointMode = await import_config13.loadConfig(ENDPOINT_MODE_CONFIG_OPTIONS)();
|
|
24823
24823
|
switch (endpointMode) {
|
|
24824
24824
|
case EndpointMode.IPv4:
|
|
24825
24825
|
return Endpoint.IPv4;
|
|
@@ -24834,7 +24834,7 @@ var init_getInstanceMetadataEndpoint = __esm(() => {
|
|
|
24834
24834
|
init_EndpointConfigOptions();
|
|
24835
24835
|
init_EndpointMode();
|
|
24836
24836
|
init_EndpointModeConfigOptions();
|
|
24837
|
-
|
|
24837
|
+
import_config13 = __toESM(require_config(), 1);
|
|
24838
24838
|
import_protocols = __toESM(require_protocols(), 1);
|
|
24839
24839
|
});
|
|
24840
24840
|
|
|
@@ -24884,7 +24884,7 @@ var init_staticStabilityProvider = __esm(() => {
|
|
|
24884
24884
|
});
|
|
24885
24885
|
|
|
24886
24886
|
// node_modules/@smithy/credential-provider-imds/dist-es/fromInstanceMetadata.js
|
|
24887
|
-
var
|
|
24887
|
+
var import_config14, IMDS_PATH = "/latest/meta-data/iam/security-credentials/", IMDS_TOKEN_PATH = "/latest/api/token", AWS_EC2_METADATA_V1_DISABLED = "AWS_EC2_METADATA_V1_DISABLED", PROFILE_AWS_EC2_METADATA_V1_DISABLED = "ec2_metadata_v1_disabled", X_AWS_EC2_METADATA_TOKEN = "x-aws-ec2-metadata-token", fromInstanceMetadata = (init = {}) => staticStabilityProvider(getInstanceMetadataProvider(init), { logger: init.logger }), getInstanceMetadataProvider = (init = {}) => {
|
|
24888
24888
|
let disableFetchToken = false;
|
|
24889
24889
|
const { logger, profile } = init;
|
|
24890
24890
|
const { timeout, maxRetries } = providerConfigFromInit(init);
|
|
@@ -24893,12 +24893,12 @@ var import_config13, IMDS_PATH = "/latest/meta-data/iam/security-credentials/",
|
|
|
24893
24893
|
if (isImdsV1Fallback) {
|
|
24894
24894
|
let fallbackBlockedFromProfile = false;
|
|
24895
24895
|
let fallbackBlockedFromProcessEnv = false;
|
|
24896
|
-
const configValue = await
|
|
24896
|
+
const configValue = await import_config14.loadConfig({
|
|
24897
24897
|
environmentVariableSelector: (env) => {
|
|
24898
24898
|
const envValue = env[AWS_EC2_METADATA_V1_DISABLED];
|
|
24899
24899
|
fallbackBlockedFromProcessEnv = !!envValue && envValue !== "false";
|
|
24900
24900
|
if (envValue === undefined) {
|
|
24901
|
-
throw new
|
|
24901
|
+
throw new import_config14.CredentialsProviderError(`${AWS_EC2_METADATA_V1_DISABLED} not set in env, checking config file next.`, { logger: init.logger });
|
|
24902
24902
|
}
|
|
24903
24903
|
return fallbackBlockedFromProcessEnv;
|
|
24904
24904
|
},
|
|
@@ -24989,7 +24989,7 @@ var import_config13, IMDS_PATH = "/latest/meta-data/iam/security-credentials/",
|
|
|
24989
24989
|
path: IMDS_PATH + profile
|
|
24990
24990
|
})).toString());
|
|
24991
24991
|
if (!isImdsCredentials(credentialsResponse)) {
|
|
24992
|
-
throw new
|
|
24992
|
+
throw new import_config14.CredentialsProviderError("Invalid response received from instance metadata service.", {
|
|
24993
24993
|
logger: init.logger
|
|
24994
24994
|
});
|
|
24995
24995
|
}
|
|
@@ -25000,7 +25000,7 @@ var init_fromInstanceMetadata = __esm(() => {
|
|
|
25000
25000
|
init_httpRequest();
|
|
25001
25001
|
init_getInstanceMetadataEndpoint();
|
|
25002
25002
|
init_staticStabilityProvider();
|
|
25003
|
-
|
|
25003
|
+
import_config14 = __toESM(require_config(), 1);
|
|
25004
25004
|
});
|
|
25005
25005
|
|
|
25006
25006
|
// node_modules/@smithy/credential-provider-imds/dist-es/index.js
|
|
@@ -25168,21 +25168,21 @@ var require_dist_cjs6 = __commonJS((exports) => {
|
|
|
25168
25168
|
let sendBody = true;
|
|
25169
25169
|
if (!externalAgent && expect === "100-continue") {
|
|
25170
25170
|
sendBody = await Promise.race([
|
|
25171
|
-
new Promise((
|
|
25172
|
-
timeoutId = Number(timing.setTimeout(() =>
|
|
25171
|
+
new Promise((resolve18) => {
|
|
25172
|
+
timeoutId = Number(timing.setTimeout(() => resolve18(true), Math.max(MIN_WAIT_TIME, maxContinueTimeoutMs)));
|
|
25173
25173
|
}),
|
|
25174
|
-
new Promise((
|
|
25174
|
+
new Promise((resolve18) => {
|
|
25175
25175
|
httpRequest2.on("continue", () => {
|
|
25176
25176
|
timing.clearTimeout(timeoutId);
|
|
25177
|
-
|
|
25177
|
+
resolve18(true);
|
|
25178
25178
|
});
|
|
25179
25179
|
httpRequest2.on("response", () => {
|
|
25180
25180
|
timing.clearTimeout(timeoutId);
|
|
25181
|
-
|
|
25181
|
+
resolve18(false);
|
|
25182
25182
|
});
|
|
25183
25183
|
httpRequest2.on("error", () => {
|
|
25184
25184
|
timing.clearTimeout(timeoutId);
|
|
25185
|
-
|
|
25185
|
+
resolve18(false);
|
|
25186
25186
|
});
|
|
25187
25187
|
})
|
|
25188
25188
|
]);
|
|
@@ -25259,13 +25259,13 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
|
|
|
25259
25259
|
return socketWarningTimestamp;
|
|
25260
25260
|
}
|
|
25261
25261
|
constructor(options) {
|
|
25262
|
-
this.configProvider = new Promise((
|
|
25262
|
+
this.configProvider = new Promise((resolve18, reject) => {
|
|
25263
25263
|
if (typeof options === "function") {
|
|
25264
25264
|
options().then((_options) => {
|
|
25265
|
-
|
|
25265
|
+
resolve18(this.resolveDefaultConfig(_options));
|
|
25266
25266
|
}).catch(reject);
|
|
25267
25267
|
} else {
|
|
25268
|
-
|
|
25268
|
+
resolve18(this.resolveDefaultConfig(options));
|
|
25269
25269
|
}
|
|
25270
25270
|
});
|
|
25271
25271
|
}
|
|
@@ -25297,7 +25297,7 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
|
|
|
25297
25297
|
timing.clearTimeout(socketTimeoutId);
|
|
25298
25298
|
timing.clearTimeout(keepAliveTimeoutId);
|
|
25299
25299
|
};
|
|
25300
|
-
const
|
|
25300
|
+
const resolve18 = async (arg) => {
|
|
25301
25301
|
await writeRequestBodyPromise;
|
|
25302
25302
|
clearTimeouts();
|
|
25303
25303
|
_resolve(arg);
|
|
@@ -25361,7 +25361,7 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
|
|
|
25361
25361
|
headers: getTransformedHeaders(res.headers),
|
|
25362
25362
|
body: res
|
|
25363
25363
|
});
|
|
25364
|
-
|
|
25364
|
+
resolve18({ response: httpResponse });
|
|
25365
25365
|
});
|
|
25366
25366
|
req.on("error", (err) => {
|
|
25367
25367
|
if (NODEJS_TIMEOUT_ERROR_CODES.includes(err.code)) {
|
|
@@ -25693,13 +25693,13 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
|
|
|
25693
25693
|
return new NodeHttp2Handler(instanceOrOptions);
|
|
25694
25694
|
}
|
|
25695
25695
|
constructor(options) {
|
|
25696
|
-
this.configProvider = new Promise((
|
|
25696
|
+
this.configProvider = new Promise((resolve18, reject) => {
|
|
25697
25697
|
if (typeof options === "function") {
|
|
25698
25698
|
options().then((opts) => {
|
|
25699
|
-
|
|
25699
|
+
resolve18(opts || {});
|
|
25700
25700
|
}).catch(reject);
|
|
25701
25701
|
} else {
|
|
25702
|
-
|
|
25702
|
+
resolve18(options || {});
|
|
25703
25703
|
}
|
|
25704
25704
|
});
|
|
25705
25705
|
}
|
|
@@ -25724,7 +25724,7 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
|
|
|
25724
25724
|
return new Promise((_resolve, _reject) => {
|
|
25725
25725
|
let fulfilled = false;
|
|
25726
25726
|
let writeRequestBodyPromise = undefined;
|
|
25727
|
-
const
|
|
25727
|
+
const resolve18 = async (arg) => {
|
|
25728
25728
|
await writeRequestBodyPromise;
|
|
25729
25729
|
_resolve(arg);
|
|
25730
25730
|
};
|
|
@@ -25809,7 +25809,7 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
|
|
|
25809
25809
|
body: clientHttp2Stream
|
|
25810
25810
|
});
|
|
25811
25811
|
fulfilled = true;
|
|
25812
|
-
|
|
25812
|
+
resolve18({ response: httpResponse });
|
|
25813
25813
|
if (useIsolatedSession) {
|
|
25814
25814
|
session.close();
|
|
25815
25815
|
clientHttp2Stream.on("end", () => {
|
|
@@ -25853,7 +25853,7 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
|
|
|
25853
25853
|
});
|
|
25854
25854
|
|
|
25855
25855
|
// node_modules/@aws-sdk/credential-provider-http/dist-es/fromHttp/checkUrl.js
|
|
25856
|
-
var
|
|
25856
|
+
var import_config15, ECS_CONTAINER_HOST = "169.254.170.2", EKS_CONTAINER_HOST_IPv4 = "169.254.170.23", EKS_CONTAINER_HOST_IPv6 = "[fd00:ec2::23]", checkUrl = (url, logger) => {
|
|
25857
25857
|
if (url.protocol === "https:") {
|
|
25858
25858
|
return;
|
|
25859
25859
|
}
|
|
@@ -25877,13 +25877,13 @@ var import_config14, ECS_CONTAINER_HOST = "169.254.170.2", EKS_CONTAINER_HOST_IP
|
|
|
25877
25877
|
return;
|
|
25878
25878
|
}
|
|
25879
25879
|
}
|
|
25880
|
-
throw new
|
|
25880
|
+
throw new import_config15.CredentialsProviderError(`URL not accepted. It must either be HTTPS or match one of the following:
|
|
25881
25881
|
- loopback CIDR 127.0.0.0/8 or [::1/128]
|
|
25882
25882
|
- ECS container host 169.254.170.2
|
|
25883
25883
|
- EKS container host 169.254.170.23 or [fd00:ec2::23]`, { logger });
|
|
25884
25884
|
};
|
|
25885
25885
|
var init_checkUrl = __esm(() => {
|
|
25886
|
-
|
|
25886
|
+
import_config15 = __toESM(require_config(), 1);
|
|
25887
25887
|
});
|
|
25888
25888
|
|
|
25889
25889
|
// node_modules/@aws-sdk/credential-provider-http/dist-es/fromHttp/requestHelpers.js
|
|
@@ -25906,7 +25906,7 @@ async function getCredentials(response, logger) {
|
|
|
25906
25906
|
if (response.statusCode === 200) {
|
|
25907
25907
|
const parsed = JSON.parse(str);
|
|
25908
25908
|
if (typeof parsed.AccessKeyId !== "string" || typeof parsed.SecretAccessKey !== "string" || typeof parsed.Token !== "string" || typeof parsed.Expiration !== "string") {
|
|
25909
|
-
throw new
|
|
25909
|
+
throw new import_config16.CredentialsProviderError("HTTP credential provider response not of the required format, an object matching: " + "{ AccessKeyId: string, SecretAccessKey: string, Token: string, Expiration: string(rfc3339) }", { logger });
|
|
25910
25910
|
}
|
|
25911
25911
|
return {
|
|
25912
25912
|
accessKeyId: parsed.AccessKeyId,
|
|
@@ -25920,16 +25920,16 @@ async function getCredentials(response, logger) {
|
|
|
25920
25920
|
try {
|
|
25921
25921
|
parsedBody = JSON.parse(str);
|
|
25922
25922
|
} catch (e3) {}
|
|
25923
|
-
throw Object.assign(new
|
|
25923
|
+
throw Object.assign(new import_config16.CredentialsProviderError(`Server responded with status: ${response.statusCode}`, { logger }), {
|
|
25924
25924
|
Code: parsedBody.Code,
|
|
25925
25925
|
Message: parsedBody.Message
|
|
25926
25926
|
});
|
|
25927
25927
|
}
|
|
25928
|
-
throw new
|
|
25928
|
+
throw new import_config16.CredentialsProviderError(`Server responded with status: ${response.statusCode}`, { logger });
|
|
25929
25929
|
}
|
|
25930
|
-
var
|
|
25930
|
+
var import_config16, import_protocols2, import_serde, import_serde2;
|
|
25931
25931
|
var init_requestHelpers = __esm(() => {
|
|
25932
|
-
|
|
25932
|
+
import_config16 = __toESM(require_config(), 1);
|
|
25933
25933
|
import_protocols2 = __toESM(require_protocols(), 1);
|
|
25934
25934
|
import_serde = __toESM(require_serde(), 1);
|
|
25935
25935
|
import_serde2 = __toESM(require_serde(), 1);
|
|
@@ -25942,7 +25942,7 @@ var retryWrapper = (toRetry, maxRetries, delayMs) => {
|
|
|
25942
25942
|
try {
|
|
25943
25943
|
return await toRetry();
|
|
25944
25944
|
} catch (e3) {
|
|
25945
|
-
await new Promise((
|
|
25945
|
+
await new Promise((resolve18) => setTimeout(resolve18, delayMs));
|
|
25946
25946
|
}
|
|
25947
25947
|
}
|
|
25948
25948
|
return await toRetry();
|
|
@@ -25951,7 +25951,7 @@ var retryWrapper = (toRetry, maxRetries, delayMs) => {
|
|
|
25951
25951
|
|
|
25952
25952
|
// node_modules/@aws-sdk/credential-provider-http/dist-es/fromHttp/fromHttp.js
|
|
25953
25953
|
import fs from "fs/promises";
|
|
25954
|
-
var import_client9,
|
|
25954
|
+
var import_client9, import_config17, import_node_http_handler, AWS_CONTAINER_CREDENTIALS_RELATIVE_URI = "AWS_CONTAINER_CREDENTIALS_RELATIVE_URI", DEFAULT_LINK_LOCAL_HOST = "http://169.254.170.2", AWS_CONTAINER_CREDENTIALS_FULL_URI = "AWS_CONTAINER_CREDENTIALS_FULL_URI", AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE = "AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE", AWS_CONTAINER_AUTHORIZATION_TOKEN = "AWS_CONTAINER_AUTHORIZATION_TOKEN", fromHttp = (options = {}) => {
|
|
25955
25955
|
options.logger?.debug("@aws-sdk/credential-provider-http - fromHttp");
|
|
25956
25956
|
let host;
|
|
25957
25957
|
const relative6 = options.awsContainerCredentialsRelativeUri ?? process.env[AWS_CONTAINER_CREDENTIALS_RELATIVE_URI];
|
|
@@ -25972,7 +25972,7 @@ var import_client9, import_config16, import_node_http_handler, AWS_CONTAINER_CRE
|
|
|
25972
25972
|
} else if (full) {
|
|
25973
25973
|
host = full;
|
|
25974
25974
|
} else {
|
|
25975
|
-
throw new
|
|
25975
|
+
throw new import_config17.CredentialsProviderError(`No HTTP credential provider host provided.
|
|
25976
25976
|
Set AWS_CONTAINER_CREDENTIALS_FULL_URI or AWS_CONTAINER_CREDENTIALS_RELATIVE_URI.`, { logger: options.logger });
|
|
25977
25977
|
}
|
|
25978
25978
|
const url = new URL(host);
|
|
@@ -25990,7 +25990,7 @@ Set AWS_CONTAINER_CREDENTIALS_FULL_URI or AWS_CONTAINER_CREDENTIALS_RELATIVE_URI
|
|
|
25990
25990
|
const result = await requestHandler.handle(request2, { requestTimeout });
|
|
25991
25991
|
return getCredentials(result.response).then((creds) => import_client9.setCredentialFeature(creds, "CREDENTIALS_HTTP", "z"));
|
|
25992
25992
|
} catch (e3) {
|
|
25993
|
-
throw new
|
|
25993
|
+
throw new import_config17.CredentialsProviderError(String(e3), { logger: options.logger });
|
|
25994
25994
|
}
|
|
25995
25995
|
}, options.maxRetries ?? 3, options.timeout ?? 1000);
|
|
25996
25996
|
return async () => {
|
|
@@ -26003,7 +26003,7 @@ Set AWS_CONTAINER_CREDENTIALS_FULL_URI or AWS_CONTAINER_CREDENTIALS_RELATIVE_URI
|
|
|
26003
26003
|
}, validateToken = (token) => {
|
|
26004
26004
|
if (token.includes(`\r
|
|
26005
26005
|
`)) {
|
|
26006
|
-
throw new
|
|
26006
|
+
throw new import_config17.CredentialsProviderError("Authorization token contains invalid \\r\\n sequence.");
|
|
26007
26007
|
}
|
|
26008
26008
|
return token;
|
|
26009
26009
|
};
|
|
@@ -26011,7 +26011,7 @@ var init_fromHttp = __esm(() => {
|
|
|
26011
26011
|
init_checkUrl();
|
|
26012
26012
|
init_requestHelpers();
|
|
26013
26013
|
import_client9 = __toESM(require_client2(), 1);
|
|
26014
|
-
|
|
26014
|
+
import_config17 = __toESM(require_config(), 1);
|
|
26015
26015
|
import_node_http_handler = __toESM(require_dist_cjs6(), 1);
|
|
26016
26016
|
});
|
|
26017
26017
|
|
|
@@ -26814,70 +26814,70 @@ var getNewSsoOidcToken = async (ssoToken, ssoRegion, init = {}, callerClientConf
|
|
|
26814
26814
|
var init_getNewSsoOidcToken = () => {};
|
|
26815
26815
|
|
|
26816
26816
|
// node_modules/@aws-sdk/token-providers/dist-es/validateTokenExpiry.js
|
|
26817
|
-
var
|
|
26817
|
+
var import_config19, validateTokenExpiry = (token) => {
|
|
26818
26818
|
if (token.expiration && token.expiration.getTime() < Date.now()) {
|
|
26819
|
-
throw new
|
|
26819
|
+
throw new import_config19.TokenProviderError(`Token is expired. ${REFRESH_MESSAGE}`, false);
|
|
26820
26820
|
}
|
|
26821
26821
|
};
|
|
26822
26822
|
var init_validateTokenExpiry = __esm(() => {
|
|
26823
26823
|
init_constants();
|
|
26824
|
-
|
|
26824
|
+
import_config19 = __toESM(require_config(), 1);
|
|
26825
26825
|
});
|
|
26826
26826
|
|
|
26827
26827
|
// node_modules/@aws-sdk/token-providers/dist-es/validateTokenKey.js
|
|
26828
|
-
var
|
|
26828
|
+
var import_config20, validateTokenKey = (key, value, forRefresh = false) => {
|
|
26829
26829
|
if (typeof value === "undefined") {
|
|
26830
|
-
throw new
|
|
26830
|
+
throw new import_config20.TokenProviderError(`Value not present for '${key}' in SSO Token${forRefresh ? ". Cannot refresh" : ""}. ${REFRESH_MESSAGE}`, false);
|
|
26831
26831
|
}
|
|
26832
26832
|
};
|
|
26833
26833
|
var init_validateTokenKey = __esm(() => {
|
|
26834
26834
|
init_constants();
|
|
26835
|
-
|
|
26835
|
+
import_config20 = __toESM(require_config(), 1);
|
|
26836
26836
|
});
|
|
26837
26837
|
|
|
26838
26838
|
// node_modules/@aws-sdk/token-providers/dist-es/writeSSOTokenToFile.js
|
|
26839
26839
|
import { promises as fsPromises } from "fs";
|
|
26840
|
-
var
|
|
26841
|
-
const tokenFilepath =
|
|
26840
|
+
var import_config21, writeFile, writeSSOTokenToFile = (id2, ssoToken) => {
|
|
26841
|
+
const tokenFilepath = import_config21.getSSOTokenFilepath(id2);
|
|
26842
26842
|
const tokenString = JSON.stringify(ssoToken, null, 2);
|
|
26843
26843
|
return writeFile(tokenFilepath, tokenString);
|
|
26844
26844
|
};
|
|
26845
26845
|
var init_writeSSOTokenToFile = __esm(() => {
|
|
26846
|
-
|
|
26846
|
+
import_config21 = __toESM(require_config(), 1);
|
|
26847
26847
|
({ writeFile } = fsPromises);
|
|
26848
26848
|
});
|
|
26849
26849
|
|
|
26850
26850
|
// node_modules/@aws-sdk/token-providers/dist-es/fromSso.js
|
|
26851
|
-
var
|
|
26851
|
+
var import_config22, 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_config22.parseKnownFiles(init);
|
|
26854
|
+
const profileName = import_config22.getProfileName({
|
|
26855
26855
|
profile: init.profile ?? callerClientConfig?.profile
|
|
26856
26856
|
});
|
|
26857
26857
|
const profile = profiles[profileName];
|
|
26858
26858
|
if (!profile) {
|
|
26859
|
-
throw new
|
|
26859
|
+
throw new import_config22.TokenProviderError(`Profile '${profileName}' could not be found in shared credentials file.`, false);
|
|
26860
26860
|
} else if (!profile["sso_session"]) {
|
|
26861
|
-
throw new
|
|
26861
|
+
throw new import_config22.TokenProviderError(`Profile '${profileName}' is missing required property 'sso_session'.`);
|
|
26862
26862
|
}
|
|
26863
26863
|
const ssoSessionName = profile["sso_session"];
|
|
26864
|
-
const ssoSessions = await
|
|
26864
|
+
const ssoSessions = await import_config22.loadSsoSessionData(init);
|
|
26865
26865
|
const ssoSession = ssoSessions[ssoSessionName];
|
|
26866
26866
|
if (!ssoSession) {
|
|
26867
|
-
throw new
|
|
26867
|
+
throw new import_config22.TokenProviderError(`Sso session '${ssoSessionName}' could not be found in shared credentials file.`, false);
|
|
26868
26868
|
}
|
|
26869
26869
|
for (const ssoSessionRequiredKey of ["sso_start_url", "sso_region"]) {
|
|
26870
26870
|
if (!ssoSession[ssoSessionRequiredKey]) {
|
|
26871
|
-
throw new
|
|
26871
|
+
throw new import_config22.TokenProviderError(`Sso session '${ssoSessionName}' is missing required property '${ssoSessionRequiredKey}'.`, false);
|
|
26872
26872
|
}
|
|
26873
26873
|
}
|
|
26874
26874
|
const ssoStartUrl = ssoSession["sso_start_url"];
|
|
26875
26875
|
const ssoRegion = ssoSession["sso_region"];
|
|
26876
26876
|
let ssoToken;
|
|
26877
26877
|
try {
|
|
26878
|
-
ssoToken = await
|
|
26878
|
+
ssoToken = await import_config22.getSSOTokenFromFile(ssoSessionName);
|
|
26879
26879
|
} catch (e3) {
|
|
26880
|
-
throw new
|
|
26880
|
+
throw new import_config22.TokenProviderError(`The SSO session token associated with profile=${profileName} was not found or is invalid. ${REFRESH_MESSAGE}`, false);
|
|
26881
26881
|
}
|
|
26882
26882
|
validateTokenKey("accessToken", ssoToken.accessToken);
|
|
26883
26883
|
validateTokenKey("expiresAt", ssoToken.expiresAt);
|
|
@@ -26926,7 +26926,7 @@ var init_fromSso = __esm(() => {
|
|
|
26926
26926
|
init_validateTokenExpiry();
|
|
26927
26927
|
init_validateTokenKey();
|
|
26928
26928
|
init_writeSSOTokenToFile();
|
|
26929
|
-
|
|
26929
|
+
import_config22 = __toESM(require_config(), 1);
|
|
26930
26930
|
lastRefreshAttemptTimes = new Map;
|
|
26931
26931
|
});
|
|
26932
26932
|
|
|
@@ -27394,7 +27394,7 @@ var init_loadSso = __esm(() => {
|
|
|
27394
27394
|
});
|
|
27395
27395
|
|
|
27396
27396
|
// node_modules/@aws-sdk/credential-provider-sso/dist-es/resolveSSOCredentials.js
|
|
27397
|
-
var import_client10,
|
|
27397
|
+
var import_client10, import_config23, SHOULD_FAIL_CREDENTIAL_CHAIN = false, resolveSSOCredentials = async ({ ssoStartUrl, ssoSession, ssoAccountId, ssoRegion, ssoRoleName, ssoClient, clientConfig, parentClientConfig, callerClientConfig, profile, filepath, configFilepath, ignoreCache, logger }) => {
|
|
27398
27398
|
let token;
|
|
27399
27399
|
const refreshMessage = `To refresh this SSO session run aws sso login with the corresponding profile.`;
|
|
27400
27400
|
if (ssoSession) {
|
|
@@ -27413,23 +27413,23 @@ var import_client10, import_config22, SHOULD_FAIL_CREDENTIAL_CHAIN = false, reso
|
|
|
27413
27413
|
expiresAt: new Date(_token.expiration).toISOString()
|
|
27414
27414
|
};
|
|
27415
27415
|
} catch (e4) {
|
|
27416
|
-
throw new
|
|
27416
|
+
throw new import_config23.CredentialsProviderError(e4.message, {
|
|
27417
27417
|
tryNextLink: SHOULD_FAIL_CREDENTIAL_CHAIN,
|
|
27418
27418
|
logger
|
|
27419
27419
|
});
|
|
27420
27420
|
}
|
|
27421
27421
|
} else {
|
|
27422
27422
|
try {
|
|
27423
|
-
token = await
|
|
27423
|
+
token = await import_config23.getSSOTokenFromFile(ssoStartUrl);
|
|
27424
27424
|
} catch (e4) {
|
|
27425
|
-
throw new
|
|
27425
|
+
throw new import_config23.CredentialsProviderError(`The SSO session associated with this profile is invalid. ${refreshMessage}`, {
|
|
27426
27426
|
tryNextLink: SHOULD_FAIL_CREDENTIAL_CHAIN,
|
|
27427
27427
|
logger
|
|
27428
27428
|
});
|
|
27429
27429
|
}
|
|
27430
27430
|
}
|
|
27431
27431
|
if (new Date(token.expiresAt).getTime() - Date.now() <= 0) {
|
|
27432
|
-
throw new
|
|
27432
|
+
throw new import_config23.CredentialsProviderError(`The SSO session associated with this profile has expired. ${refreshMessage}`, {
|
|
27433
27433
|
tryNextLink: SHOULD_FAIL_CREDENTIAL_CHAIN,
|
|
27434
27434
|
logger
|
|
27435
27435
|
});
|
|
@@ -27449,14 +27449,14 @@ var import_client10, import_config22, SHOULD_FAIL_CREDENTIAL_CHAIN = false, reso
|
|
|
27449
27449
|
accessToken
|
|
27450
27450
|
}));
|
|
27451
27451
|
} catch (e4) {
|
|
27452
|
-
throw new
|
|
27452
|
+
throw new import_config23.CredentialsProviderError(e4, {
|
|
27453
27453
|
tryNextLink: SHOULD_FAIL_CREDENTIAL_CHAIN,
|
|
27454
27454
|
logger
|
|
27455
27455
|
});
|
|
27456
27456
|
}
|
|
27457
27457
|
const { roleCredentials: { accessKeyId, secretAccessKey, sessionToken, expiration, credentialScope, accountId } = {} } = ssoResp;
|
|
27458
27458
|
if (!accessKeyId || !secretAccessKey || !sessionToken || !expiration) {
|
|
27459
|
-
throw new
|
|
27459
|
+
throw new import_config23.CredentialsProviderError("SSO returns an invalid temporary credential.", {
|
|
27460
27460
|
tryNextLink: SHOULD_FAIL_CREDENTIAL_CHAIN,
|
|
27461
27461
|
logger
|
|
27462
27462
|
});
|
|
@@ -27479,53 +27479,53 @@ var import_client10, import_config22, SHOULD_FAIL_CREDENTIAL_CHAIN = false, reso
|
|
|
27479
27479
|
var init_resolveSSOCredentials = __esm(() => {
|
|
27480
27480
|
init_dist_es4();
|
|
27481
27481
|
import_client10 = __toESM(require_client2(), 1);
|
|
27482
|
-
|
|
27482
|
+
import_config23 = __toESM(require_config(), 1);
|
|
27483
27483
|
});
|
|
27484
27484
|
|
|
27485
27485
|
// node_modules/@aws-sdk/credential-provider-sso/dist-es/validateSsoProfile.js
|
|
27486
|
-
var
|
|
27486
|
+
var import_config24, validateSsoProfile = (profile, logger) => {
|
|
27487
27487
|
const { sso_start_url, sso_account_id, sso_region, sso_role_name } = profile;
|
|
27488
27488
|
if (!sso_start_url || !sso_account_id || !sso_region || !sso_role_name) {
|
|
27489
|
-
throw new
|
|
27489
|
+
throw new import_config24.CredentialsProviderError(`Profile is configured with invalid SSO credentials. Required parameters "sso_account_id", ` + `"sso_region", "sso_role_name", "sso_start_url". Got ${Object.keys(profile).join(", ")}
|
|
27490
27490
|
Reference: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-sso.html`, { tryNextLink: false, logger });
|
|
27491
27491
|
}
|
|
27492
27492
|
return profile;
|
|
27493
27493
|
};
|
|
27494
27494
|
var init_validateSsoProfile = __esm(() => {
|
|
27495
|
-
|
|
27495
|
+
import_config24 = __toESM(require_config(), 1);
|
|
27496
27496
|
});
|
|
27497
27497
|
|
|
27498
27498
|
// node_modules/@aws-sdk/credential-provider-sso/dist-es/fromSSO.js
|
|
27499
|
-
var
|
|
27499
|
+
var import_config25, fromSSO = (init = {}) => async ({ callerClientConfig } = {}) => {
|
|
27500
27500
|
init.logger?.debug("@aws-sdk/credential-provider-sso - fromSSO");
|
|
27501
27501
|
const { ssoStartUrl, ssoAccountId, ssoRegion, ssoRoleName, ssoSession } = init;
|
|
27502
27502
|
const { ssoClient } = init;
|
|
27503
|
-
const profileName =
|
|
27503
|
+
const profileName = import_config25.getProfileName({
|
|
27504
27504
|
profile: init.profile ?? callerClientConfig?.profile
|
|
27505
27505
|
});
|
|
27506
27506
|
if (!ssoStartUrl && !ssoAccountId && !ssoRegion && !ssoRoleName && !ssoSession) {
|
|
27507
|
-
const profiles = await
|
|
27507
|
+
const profiles = await import_config25.parseKnownFiles(init);
|
|
27508
27508
|
const profile = profiles[profileName];
|
|
27509
27509
|
if (!profile) {
|
|
27510
|
-
throw new
|
|
27510
|
+
throw new import_config25.CredentialsProviderError(`Profile ${profileName} was not found.`, { logger: init.logger });
|
|
27511
27511
|
}
|
|
27512
27512
|
if (!isSsoProfile(profile)) {
|
|
27513
|
-
throw new
|
|
27513
|
+
throw new import_config25.CredentialsProviderError(`Profile ${profileName} is not configured with SSO credentials.`, {
|
|
27514
27514
|
logger: init.logger
|
|
27515
27515
|
});
|
|
27516
27516
|
}
|
|
27517
27517
|
if (profile?.sso_session) {
|
|
27518
|
-
const ssoSessions = await
|
|
27518
|
+
const ssoSessions = await import_config25.loadSsoSessionData(init);
|
|
27519
27519
|
const session = ssoSessions[profile.sso_session];
|
|
27520
27520
|
const conflictMsg = ` configurations in profile ${profileName} and sso-session ${profile.sso_session}`;
|
|
27521
27521
|
if (ssoRegion && ssoRegion !== session.sso_region) {
|
|
27522
|
-
throw new
|
|
27522
|
+
throw new import_config25.CredentialsProviderError(`Conflicting SSO region` + conflictMsg, {
|
|
27523
27523
|
tryNextLink: false,
|
|
27524
27524
|
logger: init.logger
|
|
27525
27525
|
});
|
|
27526
27526
|
}
|
|
27527
27527
|
if (ssoStartUrl && ssoStartUrl !== session.sso_start_url) {
|
|
27528
|
-
throw new
|
|
27528
|
+
throw new import_config25.CredentialsProviderError(`Conflicting SSO start_url` + conflictMsg, {
|
|
27529
27529
|
tryNextLink: false,
|
|
27530
27530
|
logger: init.logger
|
|
27531
27531
|
});
|
|
@@ -27551,7 +27551,7 @@ var import_config24, fromSSO = (init = {}) => async ({ callerClientConfig } = {}
|
|
|
27551
27551
|
logger: init.logger
|
|
27552
27552
|
});
|
|
27553
27553
|
} else if (!ssoStartUrl || !ssoAccountId || !ssoRegion || !ssoRoleName) {
|
|
27554
|
-
throw new
|
|
27554
|
+
throw new import_config25.CredentialsProviderError("Incomplete configuration. The fromSSO() argument hash must include " + '"ssoStartUrl", "ssoAccountId", "ssoRegion", "ssoRoleName"', { tryNextLink: false, logger: init.logger });
|
|
27555
27555
|
} else {
|
|
27556
27556
|
return resolveSSOCredentials({
|
|
27557
27557
|
ssoStartUrl,
|
|
@@ -27574,7 +27574,7 @@ var import_config24, fromSSO = (init = {}) => async ({ callerClientConfig } = {}
|
|
|
27574
27574
|
var init_fromSSO = __esm(() => {
|
|
27575
27575
|
init_resolveSSOCredentials();
|
|
27576
27576
|
init_validateSsoProfile();
|
|
27577
|
-
|
|
27577
|
+
import_config25 = __toESM(require_config(), 1);
|
|
27578
27578
|
});
|
|
27579
27579
|
|
|
27580
27580
|
// node_modules/@aws-sdk/credential-provider-sso/dist-es/index.js
|
|
@@ -27590,13 +27590,13 @@ var init_dist_es5 = __esm(() => {
|
|
|
27590
27590
|
});
|
|
27591
27591
|
|
|
27592
27592
|
// node_modules/@aws-sdk/credential-provider-ini/dist-es/resolveCredentialSource.js
|
|
27593
|
-
var import_client11,
|
|
27593
|
+
var import_client11, import_config26, resolveCredentialSource = (credentialSource, profileName, logger) => {
|
|
27594
27594
|
const sourceProvidersMap = {
|
|
27595
27595
|
EcsContainer: async (options) => {
|
|
27596
27596
|
const { fromHttp: fromHttp2 } = await Promise.resolve().then(() => (init_dist_es3(), exports_dist_es3));
|
|
27597
27597
|
const { fromContainerMetadata: fromContainerMetadata2 } = await Promise.resolve().then(() => (init_dist_es2(), exports_dist_es2));
|
|
27598
27598
|
logger?.debug("@aws-sdk/credential-provider-ini - credential_source is EcsContainer");
|
|
27599
|
-
return async () =>
|
|
27599
|
+
return async () => import_config26.chain(fromHttp2(options ?? {}), fromContainerMetadata2(options))().then(setNamedProvider);
|
|
27600
27600
|
},
|
|
27601
27601
|
Ec2InstanceMetadata: async (options) => {
|
|
27602
27602
|
logger?.debug("@aws-sdk/credential-provider-ini - credential_source is Ec2InstanceMetadata");
|
|
@@ -27612,12 +27612,12 @@ var import_client11, import_config25, resolveCredentialSource = (credentialSourc
|
|
|
27612
27612
|
if (credentialSource in sourceProvidersMap) {
|
|
27613
27613
|
return sourceProvidersMap[credentialSource];
|
|
27614
27614
|
} else {
|
|
27615
|
-
throw new
|
|
27615
|
+
throw new import_config26.CredentialsProviderError(`Unsupported credential source in profile ${profileName}. Got ${credentialSource}, expected EcsContainer or Ec2InstanceMetadata or Environment.`, { logger });
|
|
27616
27616
|
}
|
|
27617
27617
|
}, setNamedProvider = (creds) => import_client11.setCredentialFeature(creds, "CREDENTIALS_PROFILE_NAMED_PROVIDER", "p");
|
|
27618
27618
|
var init_resolveCredentialSource = __esm(() => {
|
|
27619
27619
|
import_client11 = __toESM(require_client2(), 1);
|
|
27620
|
-
|
|
27620
|
+
import_config26 = __toESM(require_config(), 1);
|
|
27621
27621
|
});
|
|
27622
27622
|
|
|
27623
27623
|
// node_modules/@aws-sdk/credential-provider-ini/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sts/index.js
|
|
@@ -28643,7 +28643,7 @@ var require_sts = __commonJS((exports) => {
|
|
|
28643
28643
|
});
|
|
28644
28644
|
|
|
28645
28645
|
// node_modules/@aws-sdk/credential-provider-ini/dist-es/resolveAssumeRoleCredentials.js
|
|
28646
|
-
var import_client12,
|
|
28646
|
+
var import_client12, import_config27, isAssumeRoleProfile = (arg, { profile = "default", logger } = {}) => {
|
|
28647
28647
|
return Boolean(arg) && typeof arg === "object" && typeof arg.role_arn === "string" && ["undefined", "string"].indexOf(typeof arg.role_session_name) > -1 && ["undefined", "string"].indexOf(typeof arg.external_id) > -1 && ["undefined", "string"].indexOf(typeof arg.mfa_serial) > -1 && (isAssumeRoleWithSourceProfile(arg, { profile, logger }) || isCredentialSourceProfile(arg, { profile, logger }));
|
|
28648
28648
|
}, isAssumeRoleWithSourceProfile = (arg, { profile, logger }) => {
|
|
28649
28649
|
const withSourceProfile = typeof arg.source_profile === "string" && typeof arg.credential_source === "undefined";
|
|
@@ -28674,7 +28674,7 @@ var import_client12, import_config26, isAssumeRoleProfile = (arg, { profile = "d
|
|
|
28674
28674
|
}, options.clientPlugins);
|
|
28675
28675
|
}
|
|
28676
28676
|
if (source_profile && source_profile in visitedProfiles) {
|
|
28677
|
-
throw new
|
|
28677
|
+
throw new import_config27.CredentialsProviderError(`Detected a cycle attempting to resolve credentials for profile ${import_config27.getProfileName(options)}. Profiles visited: ` + Object.keys(visitedProfiles).join(", "), { logger: options.logger });
|
|
28678
28678
|
}
|
|
28679
28679
|
options.logger?.debug(`@aws-sdk/credential-provider-ini - finding credential resolver using ${source_profile ? `source_profile=[${source_profile}]` : `profile=[${profileName}]`}`);
|
|
28680
28680
|
const sourceCredsProvider = source_profile ? resolveProfileData(source_profile, profiles, options, callerClientConfig, {
|
|
@@ -28693,7 +28693,7 @@ var import_client12, import_config26, isAssumeRoleProfile = (arg, { profile = "d
|
|
|
28693
28693
|
const { mfa_serial } = profileData;
|
|
28694
28694
|
if (mfa_serial) {
|
|
28695
28695
|
if (!options.mfaCodeProvider) {
|
|
28696
|
-
throw new
|
|
28696
|
+
throw new import_config27.CredentialsProviderError(`Profile ${profileName} requires multi-factor authentication, but no MFA code callback was provided.`, { logger: options.logger, tryNextLink: false });
|
|
28697
28697
|
}
|
|
28698
28698
|
params.SerialNumber = mfa_serial;
|
|
28699
28699
|
params.TokenCode = await options.mfaCodeProvider(mfa_serial);
|
|
@@ -28707,7 +28707,7 @@ var import_client12, import_config26, isAssumeRoleProfile = (arg, { profile = "d
|
|
|
28707
28707
|
var init_resolveAssumeRoleCredentials = __esm(() => {
|
|
28708
28708
|
init_resolveCredentialSource();
|
|
28709
28709
|
import_client12 = __toESM(require_client2(), 1);
|
|
28710
|
-
|
|
28710
|
+
import_config27 = __toESM(require_config(), 1);
|
|
28711
28711
|
});
|
|
28712
28712
|
|
|
28713
28713
|
// node_modules/@aws-sdk/credential-provider-ini/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/signin/index.js
|
|
@@ -29445,11 +29445,11 @@ var require_signin = __commonJS((exports) => {
|
|
|
29445
29445
|
// node_modules/@aws-sdk/credential-provider-ini/node_modules/@aws-sdk/credential-provider-login/dist-es/LoginCredentialsFetcher.js
|
|
29446
29446
|
import { createHash as createHash19, createPrivateKey, createPublicKey, sign } from "crypto";
|
|
29447
29447
|
import { promises as fs2 } from "fs";
|
|
29448
|
-
import { homedir as
|
|
29449
|
-
import { dirname as
|
|
29450
|
-
var
|
|
29448
|
+
import { homedir as homedir7 } from "os";
|
|
29449
|
+
import { dirname as dirname20, join as join32 } from "path";
|
|
29450
|
+
var import_config28, import_protocols3, LoginCredentialsFetcher;
|
|
29451
29451
|
var init_LoginCredentialsFetcher = __esm(() => {
|
|
29452
|
-
|
|
29452
|
+
import_config28 = __toESM(require_config(), 1);
|
|
29453
29453
|
import_protocols3 = __toESM(require_protocols(), 1);
|
|
29454
29454
|
LoginCredentialsFetcher = class LoginCredentialsFetcher {
|
|
29455
29455
|
profileData;
|
|
@@ -29464,7 +29464,7 @@ var init_LoginCredentialsFetcher = __esm(() => {
|
|
|
29464
29464
|
async loadCredentials() {
|
|
29465
29465
|
const token = await this.loadToken();
|
|
29466
29466
|
if (!token) {
|
|
29467
|
-
throw new
|
|
29467
|
+
throw new import_config28.CredentialsProviderError(`Failed to load a token for session ${this.loginSession}, please re-authenticate using aws login`, { tryNextLink: false, logger: this.logger });
|
|
29468
29468
|
}
|
|
29469
29469
|
const accessToken = token.accessToken;
|
|
29470
29470
|
const now = Date.now();
|
|
@@ -29531,7 +29531,7 @@ var init_LoginCredentialsFetcher = __esm(() => {
|
|
|
29531
29531
|
const { accessKeyId, secretAccessKey, sessionToken } = response.tokenOutput?.accessToken ?? {};
|
|
29532
29532
|
const { refreshToken, expiresIn } = response.tokenOutput ?? {};
|
|
29533
29533
|
if (!accessKeyId || !secretAccessKey || !sessionToken || !refreshToken) {
|
|
29534
|
-
throw new
|
|
29534
|
+
throw new import_config28.CredentialsProviderError("Token refresh response missing required fields", {
|
|
29535
29535
|
logger: this.logger,
|
|
29536
29536
|
tryNextLink: false
|
|
29537
29537
|
});
|
|
@@ -29568,7 +29568,7 @@ var init_LoginCredentialsFetcher = __esm(() => {
|
|
|
29568
29568
|
default:
|
|
29569
29569
|
message = `Failed to refresh token: ${String(error)}. Please re-authenticate using \`aws login\``;
|
|
29570
29570
|
}
|
|
29571
|
-
throw new
|
|
29571
|
+
throw new import_config28.CredentialsProviderError(message, {
|
|
29572
29572
|
logger: this.logger,
|
|
29573
29573
|
tryNextLink: false
|
|
29574
29574
|
});
|
|
@@ -29578,7 +29578,7 @@ var init_LoginCredentialsFetcher = __esm(() => {
|
|
|
29578
29578
|
this.logger?.warn?.(`Failed to refresh token: ${String(error)}. Using existing token until expiry.`);
|
|
29579
29579
|
return this.toCredentials(freshToken.accessToken);
|
|
29580
29580
|
}
|
|
29581
|
-
throw new
|
|
29581
|
+
throw new import_config28.CredentialsProviderError(`Failed to refresh token: ${String(error)}. Please re-authenticate using aws login`, { logger: this.logger });
|
|
29582
29582
|
}
|
|
29583
29583
|
}
|
|
29584
29584
|
async loadToken() {
|
|
@@ -29591,14 +29591,14 @@ var init_LoginCredentialsFetcher = __esm(() => {
|
|
|
29591
29591
|
missingFields.push("accountId");
|
|
29592
29592
|
}
|
|
29593
29593
|
if (missingFields.length > 0) {
|
|
29594
|
-
throw new
|
|
29594
|
+
throw new import_config28.CredentialsProviderError(`Token validation failed, missing fields: ${missingFields.join(", ")}`, {
|
|
29595
29595
|
logger: this.logger,
|
|
29596
29596
|
tryNextLink: false
|
|
29597
29597
|
});
|
|
29598
29598
|
}
|
|
29599
29599
|
return token;
|
|
29600
29600
|
} catch (error) {
|
|
29601
|
-
throw new
|
|
29601
|
+
throw new import_config28.CredentialsProviderError(`Failed to load token from ${tokenFilePath}: ${String(error)}`, {
|
|
29602
29602
|
logger: this.logger,
|
|
29603
29603
|
tryNextLink: false
|
|
29604
29604
|
});
|
|
@@ -29606,17 +29606,17 @@ var init_LoginCredentialsFetcher = __esm(() => {
|
|
|
29606
29606
|
}
|
|
29607
29607
|
async saveToken(token) {
|
|
29608
29608
|
const tokenFilePath = this.getTokenFilePath();
|
|
29609
|
-
const directory =
|
|
29609
|
+
const directory = dirname20(tokenFilePath);
|
|
29610
29610
|
try {
|
|
29611
29611
|
await fs2.mkdir(directory, { recursive: true });
|
|
29612
29612
|
} catch (error) {}
|
|
29613
29613
|
await fs2.writeFile(tokenFilePath, JSON.stringify(token, null, 2), "utf8");
|
|
29614
29614
|
}
|
|
29615
29615
|
getTokenFilePath() {
|
|
29616
|
-
const directory = process.env.AWS_LOGIN_CACHE_DIRECTORY ??
|
|
29616
|
+
const directory = process.env.AWS_LOGIN_CACHE_DIRECTORY ?? join32(homedir7(), ".aws", "login", "cache");
|
|
29617
29617
|
const loginSessionBytes = Buffer.from(this.loginSession, "utf8");
|
|
29618
29618
|
const loginSessionSha256 = createHash19("sha256").update(loginSessionBytes).digest("hex");
|
|
29619
|
-
return
|
|
29619
|
+
return join32(directory, `${loginSessionSha256}.json`);
|
|
29620
29620
|
}
|
|
29621
29621
|
derToRawSignature(derSignature) {
|
|
29622
29622
|
let offset = 2;
|
|
@@ -29700,22 +29700,22 @@ var init_LoginCredentialsFetcher = __esm(() => {
|
|
|
29700
29700
|
const signatureB64 = rawSignature.toString("base64url");
|
|
29701
29701
|
return `${message}.${signatureB64}`;
|
|
29702
29702
|
} catch (error) {
|
|
29703
|
-
throw new
|
|
29703
|
+
throw new import_config28.CredentialsProviderError(`Failed to generate Dpop proof: ${error instanceof Error ? error.message : String(error)}`, { logger: this.logger, tryNextLink: false });
|
|
29704
29704
|
}
|
|
29705
29705
|
}
|
|
29706
29706
|
};
|
|
29707
29707
|
});
|
|
29708
29708
|
|
|
29709
29709
|
// node_modules/@aws-sdk/credential-provider-ini/node_modules/@aws-sdk/credential-provider-login/dist-es/fromLoginCredentials.js
|
|
29710
|
-
var import_client13,
|
|
29710
|
+
var import_client13, import_config29, 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_config29.parseKnownFiles(init || {});
|
|
29713
|
+
const profileName = import_config29.getProfileName({
|
|
29714
29714
|
profile: init?.profile ?? callerClientConfig?.profile
|
|
29715
29715
|
});
|
|
29716
29716
|
const profile = profiles[profileName];
|
|
29717
29717
|
if (!profile?.login_session) {
|
|
29718
|
-
throw new
|
|
29718
|
+
throw new import_config29.CredentialsProviderError(`Profile ${profileName} does not contain login_session.`, {
|
|
29719
29719
|
tryNextLink: true,
|
|
29720
29720
|
logger: init?.logger
|
|
29721
29721
|
});
|
|
@@ -29727,7 +29727,7 @@ var import_client13, import_config28, fromLoginCredentials = (init) => async ({
|
|
|
29727
29727
|
var init_fromLoginCredentials = __esm(() => {
|
|
29728
29728
|
init_LoginCredentialsFetcher();
|
|
29729
29729
|
import_client13 = __toESM(require_client2(), 1);
|
|
29730
|
-
|
|
29730
|
+
import_config29 = __toESM(require_config(), 1);
|
|
29731
29731
|
});
|
|
29732
29732
|
|
|
29733
29733
|
// node_modules/@aws-sdk/credential-provider-ini/node_modules/@aws-sdk/credential-provider-login/dist-es/index.js
|
|
@@ -29791,12 +29791,12 @@ var init_getValidatedProcessCredentials = __esm(() => {
|
|
|
29791
29791
|
// node_modules/@aws-sdk/credential-provider-process/dist-es/resolveProcessCredentials.js
|
|
29792
29792
|
import { exec } from "child_process";
|
|
29793
29793
|
import { promisify } from "util";
|
|
29794
|
-
var
|
|
29794
|
+
var import_config30, resolveProcessCredentials = async (profileName, profiles, logger) => {
|
|
29795
29795
|
const profile = profiles[profileName];
|
|
29796
29796
|
if (profiles[profileName]) {
|
|
29797
29797
|
const credentialProcess = profile["credential_process"];
|
|
29798
29798
|
if (credentialProcess !== undefined) {
|
|
29799
|
-
const execPromise = promisify(
|
|
29799
|
+
const execPromise = promisify(import_config30.externalDataInterceptor?.getTokenRecord?.().exec ?? exec);
|
|
29800
29800
|
try {
|
|
29801
29801
|
const { stdout } = await execPromise(credentialProcess);
|
|
29802
29802
|
let data;
|
|
@@ -29807,33 +29807,33 @@ var import_config29, resolveProcessCredentials = async (profileName, profiles, l
|
|
|
29807
29807
|
}
|
|
29808
29808
|
return getValidatedProcessCredentials(profileName, data, profiles);
|
|
29809
29809
|
} catch (error) {
|
|
29810
|
-
throw new
|
|
29810
|
+
throw new import_config30.CredentialsProviderError(error.message, { logger });
|
|
29811
29811
|
}
|
|
29812
29812
|
} else {
|
|
29813
|
-
throw new
|
|
29813
|
+
throw new import_config30.CredentialsProviderError(`Profile ${profileName} did not contain credential_process.`, { logger });
|
|
29814
29814
|
}
|
|
29815
29815
|
} else {
|
|
29816
|
-
throw new
|
|
29816
|
+
throw new import_config30.CredentialsProviderError(`Profile ${profileName} could not be found in shared credentials file.`, {
|
|
29817
29817
|
logger
|
|
29818
29818
|
});
|
|
29819
29819
|
}
|
|
29820
29820
|
};
|
|
29821
29821
|
var init_resolveProcessCredentials = __esm(() => {
|
|
29822
29822
|
init_getValidatedProcessCredentials();
|
|
29823
|
-
|
|
29823
|
+
import_config30 = __toESM(require_config(), 1);
|
|
29824
29824
|
});
|
|
29825
29825
|
|
|
29826
29826
|
// node_modules/@aws-sdk/credential-provider-process/dist-es/fromProcess.js
|
|
29827
|
-
var
|
|
29827
|
+
var import_config31, 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_config31.parseKnownFiles(init);
|
|
29830
|
+
return resolveProcessCredentials(import_config31.getProfileName({
|
|
29831
29831
|
profile: init.profile ?? callerClientConfig?.profile
|
|
29832
29832
|
}), profiles, init.logger);
|
|
29833
29833
|
};
|
|
29834
29834
|
var init_fromProcess = __esm(() => {
|
|
29835
29835
|
init_resolveProcessCredentials();
|
|
29836
|
-
|
|
29836
|
+
import_config31 = __toESM(require_config(), 1);
|
|
29837
29837
|
});
|
|
29838
29838
|
|
|
29839
29839
|
// node_modules/@aws-sdk/credential-provider-process/dist-es/index.js
|
|
@@ -30947,19 +30947,19 @@ var fromWebToken = (init) => async (awsIdentityProperties) => {
|
|
|
30947
30947
|
|
|
30948
30948
|
// node_modules/@aws-sdk/credential-provider-web-identity/dist-es/fromTokenFile.js
|
|
30949
30949
|
import { readFileSync as readFileSync21 } from "fs";
|
|
30950
|
-
var import_client19,
|
|
30950
|
+
var import_client19, import_config32, ENV_TOKEN_FILE = "AWS_WEB_IDENTITY_TOKEN_FILE", ENV_ROLE_ARN = "AWS_ROLE_ARN", ENV_ROLE_SESSION_NAME = "AWS_ROLE_SESSION_NAME", fromTokenFile = (init = {}) => async (awsIdentityProperties) => {
|
|
30951
30951
|
init.logger?.debug("@aws-sdk/credential-provider-web-identity - fromTokenFile");
|
|
30952
30952
|
const webIdentityTokenFile = init?.webIdentityTokenFile ?? process.env[ENV_TOKEN_FILE];
|
|
30953
30953
|
const roleArn = init?.roleArn ?? process.env[ENV_ROLE_ARN];
|
|
30954
30954
|
const roleSessionName = init?.roleSessionName ?? process.env[ENV_ROLE_SESSION_NAME];
|
|
30955
30955
|
if (!webIdentityTokenFile || !roleArn) {
|
|
30956
|
-
throw new
|
|
30956
|
+
throw new import_config32.CredentialsProviderError("Web identity configuration not specified", {
|
|
30957
30957
|
logger: init.logger
|
|
30958
30958
|
});
|
|
30959
30959
|
}
|
|
30960
30960
|
const credentials = await fromWebToken({
|
|
30961
30961
|
...init,
|
|
30962
|
-
webIdentityToken:
|
|
30962
|
+
webIdentityToken: import_config32.externalDataInterceptor?.getTokenRecord?.()[webIdentityTokenFile] ?? readFileSync21(webIdentityTokenFile, { encoding: "ascii" }),
|
|
30963
30963
|
roleArn,
|
|
30964
30964
|
roleSessionName
|
|
30965
30965
|
})(awsIdentityProperties);
|
|
@@ -30970,7 +30970,7 @@ var import_client19, import_config31, ENV_TOKEN_FILE = "AWS_WEB_IDENTITY_TOKEN_F
|
|
|
30970
30970
|
};
|
|
30971
30971
|
var init_fromTokenFile = __esm(() => {
|
|
30972
30972
|
import_client19 = __toESM(require_client2(), 1);
|
|
30973
|
-
|
|
30973
|
+
import_config32 = __toESM(require_config(), 1);
|
|
30974
30974
|
});
|
|
30975
30975
|
|
|
30976
30976
|
// node_modules/@aws-sdk/credential-provider-web-identity/dist-es/index.js
|
|
@@ -31003,7 +31003,7 @@ var init_resolveWebIdentityCredentials = __esm(() => {
|
|
|
31003
31003
|
});
|
|
31004
31004
|
|
|
31005
31005
|
// node_modules/@aws-sdk/credential-provider-ini/dist-es/resolveProfileData.js
|
|
31006
|
-
var
|
|
31006
|
+
var import_config33, resolveProfileData = async (profileName, profiles, options, callerClientConfig, visitedProfiles = {}, isAssumeRoleRecursiveCall = false) => {
|
|
31007
31007
|
const data = profiles[profileName];
|
|
31008
31008
|
if (Object.keys(visitedProfiles).length > 0 && isStaticCredsProfile(data)) {
|
|
31009
31009
|
return resolveStaticCredentials(data, options);
|
|
@@ -31026,7 +31026,7 @@ var import_config32, resolveProfileData = async (profileName, profiles, options,
|
|
|
31026
31026
|
if (isLoginProfile(data)) {
|
|
31027
31027
|
return resolveLoginCredentials(profileName, options, callerClientConfig);
|
|
31028
31028
|
}
|
|
31029
|
-
throw new
|
|
31029
|
+
throw new import_config33.CredentialsProviderError(`Could not resolve credentials using profile: [${profileName}] in configuration/credentials file(s).`, { logger: options.logger });
|
|
31030
31030
|
};
|
|
31031
31031
|
var init_resolveProfileData = __esm(() => {
|
|
31032
31032
|
init_resolveAssumeRoleCredentials();
|
|
@@ -31035,20 +31035,20 @@ var init_resolveProfileData = __esm(() => {
|
|
|
31035
31035
|
init_resolveSsoCredentials();
|
|
31036
31036
|
init_resolveStaticCredentials();
|
|
31037
31037
|
init_resolveWebIdentityCredentials();
|
|
31038
|
-
|
|
31038
|
+
import_config33 = __toESM(require_config(), 1);
|
|
31039
31039
|
});
|
|
31040
31040
|
|
|
31041
31041
|
// node_modules/@aws-sdk/credential-provider-ini/dist-es/fromIni.js
|
|
31042
|
-
var
|
|
31042
|
+
var import_config34, 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_config34.parseKnownFiles(init);
|
|
31045
|
+
return resolveProfileData(import_config34.getProfileName({
|
|
31046
31046
|
profile: init.profile ?? callerClientConfig?.profile
|
|
31047
31047
|
}), profiles, init, callerClientConfig);
|
|
31048
31048
|
};
|
|
31049
31049
|
var init_fromIni = __esm(() => {
|
|
31050
31050
|
init_resolveProfileData();
|
|
31051
|
-
|
|
31051
|
+
import_config34 = __toESM(require_config(), 1);
|
|
31052
31052
|
});
|
|
31053
31053
|
|
|
31054
31054
|
// node_modules/@aws-sdk/credential-provider-ini/dist-es/index.js
|
|
@@ -31066,8 +31066,8 @@ import { Buffer as Buffer2 } from "buffer";
|
|
|
31066
31066
|
import { existsSync as existsSync22 } from "fs";
|
|
31067
31067
|
import { join as join210 } from "path";
|
|
31068
31068
|
import { existsSync as existsSync16 } from "fs";
|
|
31069
|
-
import { homedir as
|
|
31070
|
-
import { join as
|
|
31069
|
+
import { homedir as homedir8 } from "os";
|
|
31070
|
+
import { join as join36, resolve as resolve18 } from "path";
|
|
31071
31071
|
import { homedir as pathsResolverHomedir2 } from "os";
|
|
31072
31072
|
import { join as pathsResolverJoin2 } from "path";
|
|
31073
31073
|
import { createHmac as createHmac4, timingSafeEqual as timingSafeEqual3 } from "crypto";
|
|
@@ -31225,10 +31225,10 @@ function dataDir2(options) {
|
|
|
31225
31225
|
return pathsResolverResolve("data", options);
|
|
31226
31226
|
}
|
|
31227
31227
|
function effectiveHome2() {
|
|
31228
|
-
return process.env["HOME"] || process.env["USERPROFILE"] ||
|
|
31228
|
+
return process.env["HOME"] || process.env["USERPROFILE"] || homedir8();
|
|
31229
31229
|
}
|
|
31230
31230
|
function legacyHomeDir() {
|
|
31231
|
-
return
|
|
31231
|
+
return join36(effectiveHome2(), ".hasna", "events");
|
|
31232
31232
|
}
|
|
31233
31233
|
function resolverHome() {
|
|
31234
31234
|
return dataDir2({ app: "events", home: effectiveHome2() || undefined });
|
|
@@ -31237,7 +31237,7 @@ function adoptResolverHome(resolved, env = process.env) {
|
|
|
31237
31237
|
const dataOverride = env.HASNA_DATA_HOME;
|
|
31238
31238
|
if (typeof dataOverride === "string" && dataOverride.trim().length > 0)
|
|
31239
31239
|
return true;
|
|
31240
|
-
return existsSync16(
|
|
31240
|
+
return existsSync16(join36(resolved, EVENTS_STORE_SENTINEL_FILE));
|
|
31241
31241
|
}
|
|
31242
31242
|
function exactEventsHome() {
|
|
31243
31243
|
const dir = process.env[HASNA_EVENTS_DIR_ENV];
|
|
@@ -31251,9 +31251,9 @@ function exactEventsHome() {
|
|
|
31251
31251
|
function getEventsHome() {
|
|
31252
31252
|
const exact = exactEventsHome();
|
|
31253
31253
|
if (exact)
|
|
31254
|
-
return
|
|
31254
|
+
return resolve18(exact);
|
|
31255
31255
|
const resolved = resolverHome();
|
|
31256
|
-
return adoptResolverHome(resolved) ?
|
|
31256
|
+
return adoptResolverHome(resolved) ? resolve18(resolved) : resolve18(legacyHomeDir());
|
|
31257
31257
|
}
|
|
31258
31258
|
function getEventsDataDir(override) {
|
|
31259
31259
|
return override || getEventsHome();
|
|
@@ -32373,7 +32373,7 @@ var init_event_sink = __esm(() => {
|
|
|
32373
32373
|
// package.json
|
|
32374
32374
|
var package_default = {
|
|
32375
32375
|
name: "@hasna/skills",
|
|
32376
|
-
version: "0.9.
|
|
32376
|
+
version: "0.9.12",
|
|
32377
32377
|
description: "Skills library for AI coding agents",
|
|
32378
32378
|
type: "module",
|
|
32379
32379
|
bin: {
|
|
@@ -37212,8 +37212,8 @@ async function reconcileSkillSession(input, options = {}) {
|
|
|
37212
37212
|
// src/lib/selected-run.ts
|
|
37213
37213
|
import { createHash as createHash18 } from "crypto";
|
|
37214
37214
|
import { spawn } from "child_process";
|
|
37215
|
-
import { mkdirSync as mkdirSync10, mkdtempSync as mkdtempSync3, writeFileSync as writeFileSync9, realpathSync as
|
|
37216
|
-
import { dirname as
|
|
37215
|
+
import { mkdirSync as mkdirSync10, mkdtempSync as mkdtempSync3, writeFileSync as writeFileSync9, realpathSync as realpathSync8 } from "fs";
|
|
37216
|
+
import { dirname as dirname19, join as join31, resolve as resolve17 } from "path";
|
|
37217
37217
|
import { tmpdir, hostname as stationHostname2 } from "os";
|
|
37218
37218
|
|
|
37219
37219
|
// src/lib/dependency-preparation.ts
|
|
@@ -37425,18 +37425,18 @@ async function prepareSkillDependencies(skillPath, env, timeoutMs = DEFAULT_PREP
|
|
|
37425
37425
|
|
|
37426
37426
|
// src/lib/skillinfo.ts
|
|
37427
37427
|
import { existsSync as existsSync14, readFileSync as readFileSync20 } from "fs";
|
|
37428
|
-
import { join as
|
|
37428
|
+
import { join as join30 } from "path";
|
|
37429
37429
|
|
|
37430
37430
|
// src/lib/installer.ts
|
|
37431
37431
|
import { existsSync as existsSync13, readFileSync as readFileSync19, rmSync as rmSync4 } from "fs";
|
|
37432
|
-
import { join as
|
|
37433
|
-
import { homedir as
|
|
37432
|
+
import { join as join29 } from "path";
|
|
37433
|
+
import { homedir as homedir6 } from "os";
|
|
37434
37434
|
|
|
37435
37435
|
// src/lib/agent-sync.ts
|
|
37436
37436
|
import {
|
|
37437
37437
|
cpSync as cpSync2,
|
|
37438
37438
|
existsSync as existsSync10,
|
|
37439
|
-
lstatSync as
|
|
37439
|
+
lstatSync as lstatSync21,
|
|
37440
37440
|
mkdirSync as mkdirSync8,
|
|
37441
37441
|
mkdtempSync as mkdtempSync2,
|
|
37442
37442
|
readFileSync as readFileSync16,
|
|
@@ -37446,8 +37446,27 @@ import {
|
|
|
37446
37446
|
statSync as statSync9,
|
|
37447
37447
|
writeFileSync as writeFileSync7
|
|
37448
37448
|
} from "fs";
|
|
37449
|
-
import { homedir as
|
|
37450
|
-
import { basename as
|
|
37449
|
+
import { homedir as homedir5 } from "os";
|
|
37450
|
+
import { basename as basename10, dirname as dirname18, join as join26 } from "path";
|
|
37451
|
+
|
|
37452
|
+
// src/lib/native-discovery-roots.ts
|
|
37453
|
+
var NATIVE_SKILL_ROOTS = [
|
|
37454
|
+
["claude", ".claude/skills"],
|
|
37455
|
+
["codex", ".codex/skills"],
|
|
37456
|
+
["codex", ".agents/skills"],
|
|
37457
|
+
["gemini", ".gemini/skills"],
|
|
37458
|
+
["codewith", ".codewith/skills"],
|
|
37459
|
+
["opencode", ".config/opencode/skills"],
|
|
37460
|
+
["opencode", ".opencode/skills"],
|
|
37461
|
+
["cursor", ".cursor/skills"],
|
|
37462
|
+
["hermes", ".hermes/skills"],
|
|
37463
|
+
["windsurf", ".windsurf/skills"],
|
|
37464
|
+
["pi", ".pi/agent/skills"],
|
|
37465
|
+
["amp", ".amp/skills"],
|
|
37466
|
+
["cline", ".cline/skills"],
|
|
37467
|
+
["roo", ".roo/skills"],
|
|
37468
|
+
["copilot", ".github/skills"]
|
|
37469
|
+
];
|
|
37451
37470
|
|
|
37452
37471
|
// src/lib/agent-integration.ts
|
|
37453
37472
|
import { createHash as createHash16, randomUUID as randomUUID3 } from "crypto";
|
|
@@ -37812,6 +37831,48 @@ function assertHermesEnvironment(home) {
|
|
|
37812
37831
|
if (process.env.HERMES_ENABLE_PROJECT_PLUGINS?.trim() && !["0", "false", "no", "off"].includes(process.env.HERMES_ENABLE_PROJECT_PLUGINS.trim().toLowerCase()))
|
|
37813
37832
|
throw new Error("NATIVE_SKILL_DRIFT: Hermes project plugins require a dedicated discovery review");
|
|
37814
37833
|
}
|
|
37834
|
+
function read(path) {
|
|
37835
|
+
for (let current = path;; current = dirname4(current)) {
|
|
37836
|
+
if (lstatSync7(current, { throwIfNoEntry: false })?.isSymbolicLink())
|
|
37837
|
+
throw new Error("NATIVE_SKILL_DRIFT: symlink Hermes protection input");
|
|
37838
|
+
if (dirname4(current) === current)
|
|
37839
|
+
break;
|
|
37840
|
+
}
|
|
37841
|
+
const stat = lstatSync7(path, { throwIfNoEntry: false });
|
|
37842
|
+
if (!stat)
|
|
37843
|
+
return null;
|
|
37844
|
+
if (!stat.isFile() || stat.size > 1024 * 1024)
|
|
37845
|
+
throw new Error("NATIVE_SKILL_DRIFT: invalid Hermes protection input");
|
|
37846
|
+
return readFileSync9(path, "utf8");
|
|
37847
|
+
}
|
|
37848
|
+
function assertHermesProtection(home, config, command, profile, supervisor) {
|
|
37849
|
+
assertHermesEnvironment(home);
|
|
37850
|
+
if (read(join12(home, ".hermes", HERMES_OPT_OUT)) === null)
|
|
37851
|
+
throw new Error("NATIVE_SKILL_DRIFT: Hermes bundled skill reseeding is not disabled; run skills hook install");
|
|
37852
|
+
if (!supervisor || !isAbsolute4(supervisor.path) || supervisor.runtime !== process.execPath || read(supervisor.path) !== renderHermesSupervisor(command, profile))
|
|
37853
|
+
throw new Error("NATIVE_SKILL_DRIFT: Hermes owned supervisor changed; run skills hook install");
|
|
37854
|
+
const raw = read(join12(home, ".hermes/shell-hooks-allowlist.json"));
|
|
37855
|
+
let trust;
|
|
37856
|
+
try {
|
|
37857
|
+
trust = raw === null ? undefined : JSON.parse(raw);
|
|
37858
|
+
} catch {
|
|
37859
|
+
throw new Error("NATIVE_SKILL_DRIFT: invalid Hermes native hook trust");
|
|
37860
|
+
}
|
|
37861
|
+
for (const [event, entry] of Object.entries(hermesHookDefinitions(supervisor))) {
|
|
37862
|
+
if (!Array.isArray(config.hooks?.[event]) || config.hooks[event].filter((actual) => sameEntry(actual, entry)).length !== 1)
|
|
37863
|
+
throw new Error("NATIVE_SKILL_DRIFT: Hermes required native hooks changed; run skills hook install");
|
|
37864
|
+
if (!Array.isArray(trust?.approvals) || !trust.approvals.some((approval) => object3(approval) && approval.event === event && approval.command === entry.command))
|
|
37865
|
+
throw new Error("NATIVE_SKILL_DRIFT: approve the exact managed commands through Hermes normal native hook trust before starting a session");
|
|
37866
|
+
}
|
|
37867
|
+
if (config.skills?.platform_disabled !== undefined && !object3(config.skills.platform_disabled))
|
|
37868
|
+
throw new Error("NATIVE_SKILL_DRIFT: malformed Hermes platform skill settings");
|
|
37869
|
+
const disabled = config.skills?.disabled;
|
|
37870
|
+
if (disabled !== undefined && (!Array.isArray(disabled) || disabled.some((value) => typeof value !== "string") || disabled.includes("skills-cli")))
|
|
37871
|
+
throw new Error("NATIVE_SKILL_DRIFT: Hermes Skills CLI bridge is disabled or its names are malformed");
|
|
37872
|
+
for (const names of Object.values(config.skills?.platform_disabled ?? {}))
|
|
37873
|
+
if (!Array.isArray(names) || names.some((value) => typeof value !== "string") || names.includes("skills-cli"))
|
|
37874
|
+
throw new Error("NATIVE_SKILL_DRIFT: a Hermes platform disables the Skills CLI bridge");
|
|
37875
|
+
}
|
|
37815
37876
|
function assertNoHermesLegacyShadow(root) {
|
|
37816
37877
|
let entries = 0;
|
|
37817
37878
|
for (let cursor = resolve4(root);; cursor = dirname4(cursor)) {
|
|
@@ -40054,6 +40115,27 @@ function canonical3(value) {
|
|
|
40054
40115
|
return { kind: "array", items: value.items.map(canonical3) };
|
|
40055
40116
|
return value;
|
|
40056
40117
|
}
|
|
40118
|
+
function assertClaudeStopHookReplacement(before, replacement) {
|
|
40119
|
+
function bounded(text2) {
|
|
40120
|
+
need3(typeof text2 === "string" && Buffer.byteLength(text2) <= CLAUDE_SETTINGS_WITNESS_LIMITS.bytes, "Stop update exceeds its byte limit");
|
|
40121
|
+
return parse6(text2);
|
|
40122
|
+
}
|
|
40123
|
+
const original = bounded(before ?? "{}"), next = bounded(replacement);
|
|
40124
|
+
const hadHooks = original.entries.some(([key]) => key === "hooks");
|
|
40125
|
+
function withoutStop(value) {
|
|
40126
|
+
const hooks = value.entries.find(([key]) => key === "hooks")?.[1];
|
|
40127
|
+
if (hooks !== undefined) {
|
|
40128
|
+
need3(hooks.kind === "object", "Stop update requires an object of hooks");
|
|
40129
|
+
const stop = hooks.entries.find(([key]) => key === "Stop")?.[1];
|
|
40130
|
+
need3(stop === undefined || stop.kind === "array", "Stop update requires a Stop array");
|
|
40131
|
+
hooks.entries = hooks.entries.filter(([key]) => key !== "Stop");
|
|
40132
|
+
if (!hadHooks && hooks.entries.length === 0)
|
|
40133
|
+
value.entries = value.entries.filter(([key]) => key !== "hooks");
|
|
40134
|
+
}
|
|
40135
|
+
return canonical3(value);
|
|
40136
|
+
}
|
|
40137
|
+
need3(JSON.stringify(withoutStop(original)) === JSON.stringify(withoutStop(next)), "Stop update changed settings outside hooks.Stop");
|
|
40138
|
+
}
|
|
40057
40139
|
function settingsDigest(text2) {
|
|
40058
40140
|
const value = parse6(text2);
|
|
40059
40141
|
value.entries = value.entries.filter(([key, child]) => {
|
|
@@ -40174,7 +40256,7 @@ function safe4(path) {
|
|
|
40174
40256
|
break;
|
|
40175
40257
|
}
|
|
40176
40258
|
}
|
|
40177
|
-
function
|
|
40259
|
+
function read2(path, changes) {
|
|
40178
40260
|
safe4(path);
|
|
40179
40261
|
if (changes?.has(path))
|
|
40180
40262
|
return changes.get(path);
|
|
@@ -40218,7 +40300,7 @@ function projected(source, changes, budget = discoveryByteBudget()) {
|
|
|
40218
40300
|
return hashDiscoveryPathFile(source.path, budget, changes);
|
|
40219
40301
|
return hashRawDiscoveryFile(source.path, budget, changes);
|
|
40220
40302
|
}
|
|
40221
|
-
const text2 =
|
|
40303
|
+
const text2 = read2(source.path, changes);
|
|
40222
40304
|
if (text2 === null)
|
|
40223
40305
|
return null;
|
|
40224
40306
|
if (!source.format)
|
|
@@ -40278,6 +40360,49 @@ function captureDiscoveryPathSources(paths) {
|
|
|
40278
40360
|
const budget = discoveryByteBudget();
|
|
40279
40361
|
return paths.map((path) => ({ path, hashMode: "path-bytes", sha256: hashDiscoveryPathFile(path, budget) }));
|
|
40280
40362
|
}
|
|
40363
|
+
function assertProjectDiscovery(agent, directories, home, canonical4 = resolve13, reviewed) {
|
|
40364
|
+
for (const directory of directories) {
|
|
40365
|
+
const isHome = resolve13(directory) === resolve13(home);
|
|
40366
|
+
if (agent === "hermes") {
|
|
40367
|
+
assertHermesEnvironment(home);
|
|
40368
|
+
continue;
|
|
40369
|
+
}
|
|
40370
|
+
if (isHome && agent !== "claude")
|
|
40371
|
+
continue;
|
|
40372
|
+
const paths = agent === "claude" ? [...isHome ? [] : [".claude/settings.json"], ".claude/settings.local.json"] : agent === "codex" ? [".codex/config.toml"] : agent === "gemini" ? [".gemini/settings.json"] : agent === "opencode" ? ["opencode.json", "opencode.jsonc", ".opencode/opencode.json", ".opencode/opencode.jsonc"] : [".cursor/hooks.json"];
|
|
40373
|
+
for (const suffix of paths) {
|
|
40374
|
+
const path = canonical4(join20(directory, suffix)), raw = read2(path);
|
|
40375
|
+
if (raw === null)
|
|
40376
|
+
continue;
|
|
40377
|
+
if (agent === "claude" && suffix === ".claude/settings.json" && path === canonical4(join20(home, suffix)))
|
|
40378
|
+
continue;
|
|
40379
|
+
if (suffix.endsWith(".jsonc"))
|
|
40380
|
+
throw new Error(`NATIVE_SKILL_DRIFT: project JSONC discovery configuration requires review: ${path}`);
|
|
40381
|
+
const config = parseConfig(raw, path, suffix.endsWith(".toml"));
|
|
40382
|
+
const keys2 = agent === "claude" ? ["enabledPlugins", "extraKnownMarketplaces", "skillOverrides"] : agent === "codex" ? ["plugins", "marketplaces", "skills"] : agent === "gemini" ? ["skills", "extensions"] : agent === "opencode" ? ["plugin", "skills"] : ["hooks"];
|
|
40383
|
+
let admittedPlugins = false;
|
|
40384
|
+
if (agent === "claude" && reviewed?.agent === agent && reviewed.method === "reviewed" && config.enabledPlugins && typeof config.enabledPlugins === "object" && !Array.isArray(config.enabledPlugins)) {
|
|
40385
|
+
const exact = reviewed.sources.find((source) => source.path === path && source.format === undefined && source.fields === undefined && (source.hashMode === undefined || source.hashMode === "bytes"));
|
|
40386
|
+
const managed = reviewed.sources.flatMap((source) => source.hashMode === "claude-plugin-registry" ? source.managedPlugins ?? [] : []);
|
|
40387
|
+
if (exact && projected(exact) === exact.sha256 && managed.length) {
|
|
40388
|
+
const bindings = managed.map((item) => readPluginBinding(item.storeRoot, item.bindingId));
|
|
40389
|
+
admittedPlugins = Object.entries(config.enabledPlugins).every(([id2, enabled]) => typeof enabled === "boolean" && bindings.some((binding) => binding.target.pluginId === id2 && binding.target.registrations.some((scope) => scope.scope === "project" && scope.projectPath === canonical4(directory))));
|
|
40390
|
+
}
|
|
40391
|
+
}
|
|
40392
|
+
if (keys2.some((key) => config[key] !== undefined && !(key === "enabledPlugins" && admittedPlugins)) || config.disableAllHooks === true || config.disableBundledSkills === false || config.hooksConfig?.enabled === false || config.permission?.skill !== undefined || config.permissions?.deny?.some((rule) => typeof rule === "string" && /^Skill(?:\(|$)/.test(rule)))
|
|
40393
|
+
throw new Error(`NATIVE_SKILL_DRIFT: higher-precedence project skill or hook configuration requires review: ${path}`);
|
|
40394
|
+
}
|
|
40395
|
+
if (agent === "claude") {
|
|
40396
|
+
const commands = canonical4(join20(directory, ".claude/commands"));
|
|
40397
|
+
safe4(commands);
|
|
40398
|
+
if (lstatSync17(commands, { throwIfNoEntry: false })?.isDirectory() && readdirSync6(commands).length)
|
|
40399
|
+
throw new Error("NATIVE_SKILL_DRIFT: legacy project command discovery requires a dedicated format adapter");
|
|
40400
|
+
}
|
|
40401
|
+
}
|
|
40402
|
+
}
|
|
40403
|
+
function agentDiscoveryConfigPath(home, agent) {
|
|
40404
|
+
return join20(home, agent === "hermes" ? ".hermes/config.yaml" : agent === "opencode" ? ".config/opencode/opencode.json" : `.${agent}/${agent === "codex" ? "config.toml" : agent === "cursor" ? "hooks.json" : "settings.json"}`);
|
|
40405
|
+
}
|
|
40281
40406
|
function resolveAgentDiscovery(options) {
|
|
40282
40407
|
const canonical4 = options.canonical ?? resolve13, home = resolve13(options.home), agent = options.agent;
|
|
40283
40408
|
const sources = [], roots = new Set, builtinNames = [];
|
|
@@ -40285,11 +40410,11 @@ function resolveAgentDiscovery(options) {
|
|
|
40285
40410
|
const source = { path: canonical4(path), sha256: null, ...format ? { format, fields } : {} };
|
|
40286
40411
|
source.sha256 = projected(source);
|
|
40287
40412
|
sources.push(source);
|
|
40288
|
-
return
|
|
40413
|
+
return read2(source.path);
|
|
40289
40414
|
};
|
|
40290
40415
|
if (agent === "hermes")
|
|
40291
40416
|
assertHermesEnvironment(home);
|
|
40292
|
-
const configPath =
|
|
40417
|
+
const configPath = agentDiscoveryConfigPath(home, agent);
|
|
40293
40418
|
const configText = witness(configPath, agent === "hermes" ? "yaml" : agent === "codex" ? "toml" : "json", agent === "hermes" ? ["skills", "plugins", "hooks"] : agent === "claude" ? ["enabledPlugins", "extraKnownMarketplaces"] : agent === "codex" ? ["plugins", "marketplaces", "skills"] : agent === "gemini" ? ["skills", "extensions", "security"] : agent === "opencode" ? ["plugin", "skills"] : ["version"]);
|
|
40294
40419
|
const config = configText === null ? {} : agent === "hermes" ? parseHermesConfig(configText) : parseConfig(configText, configPath, agent === "codex");
|
|
40295
40420
|
const unresolved = (detail) => {
|
|
@@ -40320,7 +40445,7 @@ function resolveAgentDiscovery(options) {
|
|
|
40320
40445
|
if (executable) {
|
|
40321
40446
|
let packageRoot;
|
|
40322
40447
|
for (let directory = dirname13(realpathSync3(executable)), depth = 0;depth < 8; directory = dirname13(directory), depth++) {
|
|
40323
|
-
const path = join20(directory, "package.json"), raw =
|
|
40448
|
+
const path = join20(directory, "package.json"), raw = read2(path);
|
|
40324
40449
|
if (raw !== null && parseConfig(raw, path).name === "@google/gemini-cli") {
|
|
40325
40450
|
packageRoot = directory;
|
|
40326
40451
|
witness(path);
|
|
@@ -40612,23 +40737,7 @@ function disableCodexBundledSkills(text2) {
|
|
|
40612
40737
|
|
|
40613
40738
|
// src/lib/agent-integration.ts
|
|
40614
40739
|
var sha2 = (data) => createHash16("sha256").update(data).digest("hex");
|
|
40615
|
-
var ROOTS =
|
|
40616
|
-
["claude", ".claude/skills"],
|
|
40617
|
-
["codex", ".codex/skills"],
|
|
40618
|
-
["codex", ".agents/skills"],
|
|
40619
|
-
["gemini", ".gemini/skills"],
|
|
40620
|
-
["codewith", ".codewith/skills"],
|
|
40621
|
-
["opencode", ".config/opencode/skills"],
|
|
40622
|
-
["opencode", ".opencode/skills"],
|
|
40623
|
-
["cursor", ".cursor/skills"],
|
|
40624
|
-
["hermes", ".hermes/skills"],
|
|
40625
|
-
["windsurf", ".windsurf/skills"],
|
|
40626
|
-
["pi", ".pi/agent/skills"],
|
|
40627
|
-
["amp", ".amp/skills"],
|
|
40628
|
-
["cline", ".cline/skills"],
|
|
40629
|
-
["roo", ".roo/skills"],
|
|
40630
|
-
["copilot", ".github/skills"]
|
|
40631
|
-
];
|
|
40740
|
+
var ROOTS = NATIVE_SKILL_ROOTS;
|
|
40632
40741
|
function assertSafePath(path) {
|
|
40633
40742
|
let cursor = resolve14(path);
|
|
40634
40743
|
while (true) {
|
|
@@ -40925,6 +41034,22 @@ function configureHooks(config, agent, command, profileId, nativeReady) {
|
|
|
40925
41034
|
if (!Array.isArray(existing))
|
|
40926
41035
|
throw new Error(`Expected ${event} hooks array`);
|
|
40927
41036
|
const hookCommand = renderAgentHookCommand(command, agent, profileId, event);
|
|
41037
|
+
if (agent === "codex") {
|
|
41038
|
+
let ownedIndex = -1;
|
|
41039
|
+
for (const [index, entry] of existing.entries()) {
|
|
41040
|
+
if (!entry || !Array.isArray(entry.hooks))
|
|
41041
|
+
throw new Error(`Malformed ${event} hook entry`);
|
|
41042
|
+
const owned = entry.hooks.filter((hook) => hook?.type === "command" && typeof hook.command === "string" && /(?:^|\s)hook user-prompt --agent codex(?: --selection-profile [A-Za-z0-9._-]+)?(?: --event [A-Za-z]+)?$/.test(hook.command));
|
|
41043
|
+
if (!owned.length)
|
|
41044
|
+
continue;
|
|
41045
|
+
if (ownedIndex !== -1 || entry.hooks.length !== 1 || Object.keys(entry).length !== 1)
|
|
41046
|
+
throw new Error(`Review ambiguous ${event} Codex Skills hook groups before installation; unrelated native hook positions must be preserved`);
|
|
41047
|
+
ownedIndex = index;
|
|
41048
|
+
}
|
|
41049
|
+
const replacement = { hooks: [{ type: "command", command: hookCommand, timeout: 15 }] };
|
|
41050
|
+
config.hooks[event] = ownedIndex === -1 ? [...existing, replacement] : existing.map((entry, index) => index === ownedIndex ? replacement : entry);
|
|
41051
|
+
continue;
|
|
41052
|
+
}
|
|
40928
41053
|
const retained = existing.flatMap((entry) => {
|
|
40929
41054
|
if (agent === "cursor") {
|
|
40930
41055
|
if (!entry || typeof entry.command !== "string")
|
|
@@ -41130,6 +41255,62 @@ function planAgentIntegration(options) {
|
|
|
41130
41255
|
recheckRootAliases(aliases);
|
|
41131
41256
|
return { dataDir: dataDir2, profileId, changes, nativeSkills, observedPolicy: { path: policyPath, before: previousPolicy }, discoveryBefore: discoveries, discoveryAfter, ...aliases.length ? { rootAliases: aliases } : {} };
|
|
41132
41257
|
}
|
|
41258
|
+
function planClaudeStopHookUpdate(options) {
|
|
41259
|
+
const home = resolve14(options.home ?? homedir3()), dataDir2 = options.dataDir ?? getDataDirReadOnly();
|
|
41260
|
+
const policyPath = join21(dataDir2, "agent-policy.json");
|
|
41261
|
+
assertSafePath(policyPath);
|
|
41262
|
+
const snapshot2 = readManagedSkillPolicySnapshot(dataDir2);
|
|
41263
|
+
if (!snapshot2)
|
|
41264
|
+
return null;
|
|
41265
|
+
const policy = snapshot2.value, bridge = policy.bridge;
|
|
41266
|
+
if (!bridge || bridge.home !== home || bridge.version !== CLI_BRIDGE_VERSION || bridge.digest !== CLI_BRIDGE_DIGEST || !Array.isArray(bridge.agents) || !bridge.agents.length || bridge.agents.some((agent) => !INTEGRATION_AGENTS.includes(agent)) || new Set(bridge.agents).size !== bridge.agents.length || !bridge.discovery || typeof bridge.discovery !== "object" || Array.isArray(bridge.discovery)) {
|
|
41267
|
+
throw new Error("Invalid managed bridge for Claude settings update");
|
|
41268
|
+
}
|
|
41269
|
+
const aliases = bridge.rootAliases ?? [];
|
|
41270
|
+
recheckRootAliases(aliases);
|
|
41271
|
+
const path = canonicalAgentPath(join21(home, ".claude", "settings.json"), aliases);
|
|
41272
|
+
assertSafePath(path);
|
|
41273
|
+
const before = lstatSync18(path, { throwIfNoEntry: false }) ? new TextDecoder("utf-8", { fatal: true, ignoreBOM: true }).decode(readNativeBytes(path, 1024 * 1024)) : null;
|
|
41274
|
+
if ((before === null ? "absent" : sha2(before)) !== options.expectedSettingsSha256)
|
|
41275
|
+
throw new Error("Claude settings preimage changed");
|
|
41276
|
+
assertClaudeStopHookReplacement(before, options.replacement);
|
|
41277
|
+
const agents = bridge.agents;
|
|
41278
|
+
const discoveries = Object.entries(bridge.discovery).map(([agent, binding]) => {
|
|
41279
|
+
if (!agents.includes(agent) || binding?.agent !== agent)
|
|
41280
|
+
throw new Error("Invalid managed discovery owner");
|
|
41281
|
+
return binding;
|
|
41282
|
+
});
|
|
41283
|
+
if (discoveries.length !== agents.length)
|
|
41284
|
+
throw new Error("Missing managed discovery coverage");
|
|
41285
|
+
for (const agent of agents)
|
|
41286
|
+
assertManagedAgentBridge(agent, { home, dataDir: dataDir2, projectDir: home });
|
|
41287
|
+
const replacements = new Map(before === options.replacement ? [] : [[path, options.replacement]]);
|
|
41288
|
+
const discoveryAfter = discoveries.map((binding) => rebindAgentDiscovery(binding, replacements));
|
|
41289
|
+
const nextPolicy = { ...policy, bridge: { ...bridge, discovery: Object.fromEntries(discoveryAfter.map((binding) => [binding.agent, binding])) } };
|
|
41290
|
+
const changes = before === options.replacement ? [] : [{ path, before, after: options.replacement }];
|
|
41291
|
+
if (JSON.stringify(nextPolicy) !== JSON.stringify(policy))
|
|
41292
|
+
changes.push({ path: policyPath, before: snapshot2.text, after: serializeManagedSkillPolicy(nextPolicy) });
|
|
41293
|
+
recheckRootAliases(aliases);
|
|
41294
|
+
const nativeSkills = inventoryNativeSkills(home, {
|
|
41295
|
+
agents,
|
|
41296
|
+
projectDir: home,
|
|
41297
|
+
includeVendor: true,
|
|
41298
|
+
guardHermes: agents.includes("hermes"),
|
|
41299
|
+
allowRootAliases: aliases.length > 0,
|
|
41300
|
+
agentRoots: discoveries.flatMap((binding) => binding.roots.map((path2) => ({ agent: binding.agent, path: path2 })))
|
|
41301
|
+
});
|
|
41302
|
+
return {
|
|
41303
|
+
dataDir: dataDir2,
|
|
41304
|
+
profileId: policy.profileId ?? "default",
|
|
41305
|
+
changes,
|
|
41306
|
+
nativeSkills,
|
|
41307
|
+
observedPolicy: { path: policyPath, before: snapshot2.text },
|
|
41308
|
+
discoveryBefore: discoveries,
|
|
41309
|
+
discoveryAfter,
|
|
41310
|
+
rootAliases: aliases,
|
|
41311
|
+
managedAgentChecks: { home, agents: [...agents] }
|
|
41312
|
+
};
|
|
41313
|
+
}
|
|
41133
41314
|
function atomicWrite2(path, content) {
|
|
41134
41315
|
assertSafePath(path);
|
|
41135
41316
|
mkdirSync5(dirname14(path), { recursive: true, mode: 448 });
|
|
@@ -41152,6 +41333,8 @@ function applyAgentIntegration(plan) {
|
|
|
41152
41333
|
parseManagedSkillPolicy(change.after);
|
|
41153
41334
|
const aliases = plan.rootAliases ?? [];
|
|
41154
41335
|
recheckRootAliases(aliases);
|
|
41336
|
+
for (const agent of plan.managedAgentChecks?.agents ?? [])
|
|
41337
|
+
assertManagedAgentBridge(agent, { home: plan.managedAgentChecks.home, dataDir: plan.dataDir, projectDir: plan.managedAgentChecks.home });
|
|
41155
41338
|
for (const binding of plan.discoveryBefore ?? [])
|
|
41156
41339
|
verifyAgentDiscovery(binding);
|
|
41157
41340
|
if (plan.observedPolicy && currentText(plan.observedPolicy.path) !== plan.observedPolicy.before)
|
|
@@ -41187,6 +41370,8 @@ function applyAgentIntegration(plan) {
|
|
|
41187
41370
|
recheckRootAliases(aliases);
|
|
41188
41371
|
for (const binding of plan.discoveryAfter ?? [])
|
|
41189
41372
|
verifyAgentDiscovery(binding);
|
|
41373
|
+
for (const agent of plan.managedAgentChecks?.agents ?? [])
|
|
41374
|
+
assertManagedAgentBridge(agent, { home: plan.managedAgentChecks.home, dataDir: plan.dataDir, projectDir: plan.managedAgentChecks.home });
|
|
41190
41375
|
atomicWrite2(join21(backupRoot, "receipt.json"), JSON.stringify({ version: 1, changes: written.map((change) => ({ path: change.path, beforeHash: change.before === null ? null : sha2(change.before), afterHash: sha2(change.after) })), backups, ...aliases.length ? { rootAliases: aliases } : {} }) + `
|
|
41191
41376
|
`);
|
|
41192
41377
|
} catch (error) {
|
|
@@ -41367,6 +41552,97 @@ function archiveNativeSkills(inventory, options) {
|
|
|
41367
41552
|
}
|
|
41368
41553
|
return { entries: entries.map(({ status, conflict, ...entry }) => entry), receiptPath, ...targetManifest ? { targetManifest } : {}, ...aliases.length ? { rootAliases: aliases } : {} };
|
|
41369
41554
|
}
|
|
41555
|
+
function assertManagedAgentBridge(agent, options = {}) {
|
|
41556
|
+
const home = resolve14(options.home ?? homedir3()), dataDir2 = options.dataDir ?? getDataDirReadOnly();
|
|
41557
|
+
assertSafePath(join21(dataDir2, "agent-policy.json"));
|
|
41558
|
+
const snapshot2 = readManagedSkillPolicySnapshot(dataDir2);
|
|
41559
|
+
if (!snapshot2)
|
|
41560
|
+
throw new Error("NATIVE_SKILL_DRIFT: install the Skills bridge with skills hook install");
|
|
41561
|
+
const binding = snapshot2.value.bridge;
|
|
41562
|
+
if (!binding || binding.version !== CLI_BRIDGE_VERSION || binding.digest !== CLI_BRIDGE_DIGEST || binding.home !== home || !Array.isArray(binding.agents) || !binding.agents.includes(agent))
|
|
41563
|
+
throw new Error("NATIVE_SKILL_DRIFT: the managed Skills bridge binding is missing or incompatible; run skills hook install");
|
|
41564
|
+
const aliases = binding.rootAliases ?? [];
|
|
41565
|
+
if (!Array.isArray(aliases))
|
|
41566
|
+
throw new Error("NATIVE_SKILL_DRIFT: invalid root alias binding");
|
|
41567
|
+
recheckRootAliases(aliases);
|
|
41568
|
+
const expected = canonicalAgentPath(join21(home, AGENT_ADAPTERS[agent].root, CLI_BRIDGE_NAME), aliases);
|
|
41569
|
+
if (!isOwnedCliBridge(expected, [expected]))
|
|
41570
|
+
throw new Error("NATIVE_SKILL_DRIFT: the native Skills bridge is missing or modified; repair it before continuing");
|
|
41571
|
+
const roots = projectAncestorDirectories([options.projectDir ?? process.cwd(), ...options.projectDirs ?? [], ...agent === "hermes" && process.env.TERMINAL_CWD ? [process.cwd()] : []]);
|
|
41572
|
+
const visible = (entry) => entry.agent === agent || ["codex", "gemini", "opencode", "hermes"].includes(agent) && entry.path.includes(`${sep4}.agents${sep4}skills${sep4}`) || agent === "opencode" && entry.agent === "claude";
|
|
41573
|
+
const discovery = binding.discovery?.[agent];
|
|
41574
|
+
assertProjectDiscovery(agent, [...roots], home, (path) => canonicalAgentPath(path, aliases), discovery);
|
|
41575
|
+
const configPath = canonicalAgentPath(join21(home, AGENT_ADAPTERS[agent].config), aliases), config = agent === "hermes" ? parseHermesConfig(readOptional(configPath)) : jsonObject(readOptional(configPath), configPath);
|
|
41576
|
+
const command = binding.commands?.[agent], profile = binding.profiles?.[agent];
|
|
41577
|
+
if (typeof command !== "string" || typeof profile !== "string")
|
|
41578
|
+
throw new Error("NATIVE_SKILL_DRIFT: the native hook command/profile binding is missing");
|
|
41579
|
+
if (options.profileId !== undefined && options.profileId !== profile)
|
|
41580
|
+
throw new Error("NATIVE_SKILL_DRIFT: the hook selection profile differs from its managed binding; restart the native client after reviewing skills hook install");
|
|
41581
|
+
if (agent === "hermes") {
|
|
41582
|
+
const supervisor = binding.supervisors?.hermes;
|
|
41583
|
+
if (supervisor?.path !== join21(dataDir2, "agent-hooks", "hermes.js") || supervisor?.sha256 !== sha2(renderHermesSupervisor(command, profile)))
|
|
41584
|
+
throw new Error("NATIVE_SKILL_DRIFT: Hermes supervisor binding changed; run skills hook install");
|
|
41585
|
+
assertHermesProtection(home, config, command, profile, supervisor);
|
|
41586
|
+
} else if (agent === "opencode") {
|
|
41587
|
+
if (JSON.stringify(config.permission?.skill) !== JSON.stringify({ "*": "deny", [CLI_BRIDGE_NAME]: "allow" }) || readOptional(join21(home, ".config", "opencode", "plugins", "skills-cli.js")) !== renderOpenCodePlugin(command, profile))
|
|
41588
|
+
throw new Error("NATIVE_SKILL_DRIFT: OpenCode bridge protection changed; run skills hook install");
|
|
41589
|
+
} else {
|
|
41590
|
+
const required = {};
|
|
41591
|
+
configureHooks(required, agent, command, profile, true);
|
|
41592
|
+
for (const [event, entries] of Object.entries(required.hooks))
|
|
41593
|
+
for (const entry of entries) {
|
|
41594
|
+
if (!Array.isArray(config.hooks?.[event]) || config.hooks[event].filter((actual) => JSON.stringify(actual) === JSON.stringify(entry)).length !== 1)
|
|
41595
|
+
throw new Error("NATIVE_SKILL_DRIFT: required native prompt/skill hooks changed; run skills hook install");
|
|
41596
|
+
}
|
|
41597
|
+
if (agent === "claude" && (config.disableBundledSkills !== true || config.disableAllHooks === true || !config.permissions?.allow?.includes(`Skill(${CLI_BRIDGE_NAME})`) || config.permissions?.deny?.includes("Skill")))
|
|
41598
|
+
throw new Error("NATIVE_SKILL_DRIFT: Claude bridge or bundled-skill protection changed; retire copies and run skills hook install");
|
|
41599
|
+
if (agent === "claude" && config.syncClaudeAiSkills !== false)
|
|
41600
|
+
throw new Error("NATIVE_SKILL_DRIFT: Claude account skill synchronization is not disabled (syncClaudeAiSkills); run skills hook install to prevent native copies from returning");
|
|
41601
|
+
if (agent === "gemini" && (config.hooksConfig?.enabled === false || config.skills?.enabled !== true || !["antigravity-support", "skill-creator"].every((name) => config.skills?.disabled?.includes(name)) || config.skills?.disabled?.includes(CLI_BRIDGE_NAME)))
|
|
41602
|
+
throw new Error("NATIVE_SKILL_DRIFT: Gemini bridge or bundled-skill protection changed; run skills hook install");
|
|
41603
|
+
}
|
|
41604
|
+
const codexPath = canonicalAgentPath(join21(home, ".codex", "config.toml"), aliases);
|
|
41605
|
+
if (options.codexDiscoveryRecovery && (agent !== "codex" || options.codexDiscoveryRecovery.configPath !== codexPath))
|
|
41606
|
+
throw new Error("NATIVE_SKILL_DRIFT: Codex trust recovery names a different configuration root");
|
|
41607
|
+
const codexConfig = agent === "codex" ? Bun.TOML.parse(readOptional(codexPath) ?? "") : {};
|
|
41608
|
+
if (agent === "codex" && codexConfig.skills?.bundled?.enabled !== false)
|
|
41609
|
+
throw new Error("NATIVE_SKILL_DRIFT: Codex bundled skill reseeding is not disabled (skills.bundled.enabled); run skills hook install");
|
|
41610
|
+
const setting = (path) => (codexConfig.skills?.config ?? []).filter((entry) => typeof entry.path === "string" && [path, join21(path, "SKILL.md")].includes(canonicalAgentPath(entry.path, aliases)));
|
|
41611
|
+
if (agent === "codex" && [...setting(expected), ...(codexConfig.skills?.config ?? []).filter((entry) => typeof entry.name === "string" && entry.name.trim() === CLI_BRIDGE_NAME)].some((entry) => entry.enabled === false))
|
|
41612
|
+
throw new Error("NATIVE_SKILL_DRIFT: the Codex CLI bridge is disabled; run skills hook install");
|
|
41613
|
+
const disabledBuiltin = (entry) => {
|
|
41614
|
+
if (agent !== "codex" || !entry.vendor || !entry.path.startsWith(canonicalAgentPath(join21(home, ".codex", "skills", ".system"), aliases) + sep4))
|
|
41615
|
+
return false;
|
|
41616
|
+
const matched = Array.isArray(binding.disabledBuiltins) && binding.disabledBuiltins.some((item) => item.path === entry.path && item.hash === entry.hash);
|
|
41617
|
+
const settings = setting(entry.path);
|
|
41618
|
+
return matched && settings.length === 1 && settings[0]?.enabled === false;
|
|
41619
|
+
};
|
|
41620
|
+
if (!discovery || discovery.agent !== agent)
|
|
41621
|
+
throw new Error("NATIVE_SKILL_DRIFT: native discovery coverage is missing; run skills hook install");
|
|
41622
|
+
if (agent === "gemini" && !discovery.builtinNames?.every((name) => config.skills.disabled.includes(name)))
|
|
41623
|
+
throw new Error("NATIVE_SKILL_DRIFT: an installed Gemini builtin is not disabled");
|
|
41624
|
+
try {
|
|
41625
|
+
verifyAgentDiscovery(discovery, options.codexDiscoveryRecovery);
|
|
41626
|
+
if (discovery.method === "automatic") {
|
|
41627
|
+
const current = resolveAgentDiscovery({ home, agent, canonical: (path) => canonicalAgentPath(path, aliases) });
|
|
41628
|
+
if (JSON.stringify(current) !== JSON.stringify(discovery))
|
|
41629
|
+
throw new Error("Configured native discovery roots changed");
|
|
41630
|
+
}
|
|
41631
|
+
} catch (error) {
|
|
41632
|
+
throw new Error(`NATIVE_SKILL_DRIFT: ${error.message}`);
|
|
41633
|
+
}
|
|
41634
|
+
const inventory = inventoryNativeSkills(home, { includeVendor: true, guardHermes: agent === "hermes", agents: [agent], projectDirs: [...roots], agentRoots: discovery.roots.map((path) => ({ agent, path })), allowRootAliases: aliases.length > 0 });
|
|
41635
|
+
const unexpected = inventory.filter((entry) => visible(entry) && !entry.bridge && !disabledBuiltin(entry));
|
|
41636
|
+
if (unexpected.length) {
|
|
41637
|
+
const paths = unexpected.slice(0, 3).map((entry) => {
|
|
41638
|
+
const escaped = JSON.stringify(entry.path).replace(/[\u007f-\u009f\u061c\u200e\u200f\u2028-\u202e\u2066-\u2069]/g, (character) => `\\u${character.charCodeAt(0).toString(16).padStart(4, "0")}`);
|
|
41639
|
+
return escaped.length > 768 ? `${escaped.slice(0, 384)}...${escaped.slice(-381)}` : escaped;
|
|
41640
|
+
});
|
|
41641
|
+
const remaining = unexpected.length - paths.length;
|
|
41642
|
+
throw new Error(`NATIVE_SKILL_DRIFT: ${unexpected.length} unexpected native skill copies were found: ${paths.join(", ")}${remaining ? `; ${remaining} more` : ""}. Review skills migrate native --project <working-directory> --include-unmanaged --include-vendor --json before continuing; it inventories that directory and its ancestors. Use --apply after reviewing the archive plan.`);
|
|
41643
|
+
}
|
|
41644
|
+
recheckRootAliases(aliases);
|
|
41645
|
+
}
|
|
41370
41646
|
function assertNativeExportAllowed(dataDir2 = getDataDirReadOnly()) {
|
|
41371
41647
|
if (requiresCliSkillLoading(dataDir2))
|
|
41372
41648
|
throw new Error("NATIVE_SKILL_EXPORT_DISABLED: this station loads skills through the Skills CLI; use skills sync --selection-profile <id>");
|
|
@@ -41378,13 +41654,13 @@ import {
|
|
|
41378
41654
|
mkdirSync as mkdirSync7,
|
|
41379
41655
|
mkdtempSync,
|
|
41380
41656
|
readdirSync as readdirSync9,
|
|
41381
|
-
realpathSync as
|
|
41657
|
+
realpathSync as realpathSync7,
|
|
41382
41658
|
renameSync as renameSync4,
|
|
41383
41659
|
rmSync as rmSync2,
|
|
41384
41660
|
statSync as statSync8,
|
|
41385
41661
|
writeFileSync as writeFileSync6
|
|
41386
41662
|
} from "fs";
|
|
41387
|
-
import { basename as
|
|
41663
|
+
import { basename as basename9, dirname as dirname17, isAbsolute as isAbsolute16, join as join25, normalize as normalize2, relative as relative5, resolve as resolve16, sep as sep7 } from "path";
|
|
41388
41664
|
|
|
41389
41665
|
// src/lib/registry-data/index.ts
|
|
41390
41666
|
var SKILLS = [];
|
|
@@ -41834,7 +42110,7 @@ function validatePortableManifestContract(manifest, options = {}) {
|
|
|
41834
42110
|
function validateRuntimeContract(manifest, issues, strict) {
|
|
41835
42111
|
const runtime = manifest.runtime;
|
|
41836
42112
|
if (runtime === undefined) {
|
|
41837
|
-
if (strict) {
|
|
42113
|
+
if (strict && manifest.kind !== "instruction") {
|
|
41838
42114
|
add2(issues, "contract.runtime_missing", "runtime contract is required: { runtime, entrypoint?, timeout?, needs_network?, env?, sandbox?, system_deps?, artifacts? }");
|
|
41839
42115
|
}
|
|
41840
42116
|
return;
|
|
@@ -42021,7 +42297,6 @@ function createInstructionManifest(name, options) {
|
|
|
42021
42297
|
kind: "instruction",
|
|
42022
42298
|
inputs: [],
|
|
42023
42299
|
commands: [],
|
|
42024
|
-
runtime: defaultRuntimeContract(),
|
|
42025
42300
|
provenance: defaultProvenance()
|
|
42026
42301
|
};
|
|
42027
42302
|
}
|
|
@@ -42090,7 +42365,7 @@ function fillContractDefaults(manifest, entrypoint) {
|
|
|
42090
42365
|
return {
|
|
42091
42366
|
...manifest,
|
|
42092
42367
|
standard: PORTABLE_SKILL_STANDARD,
|
|
42093
|
-
runtime: manifest.runtime ?? defaultRuntimeContract(resolvedEntrypoint),
|
|
42368
|
+
...manifest.kind === "instruction" ? {} : { runtime: manifest.runtime ?? defaultRuntimeContract(resolvedEntrypoint) },
|
|
42094
42369
|
provenance: {
|
|
42095
42370
|
...defaultProvenance(),
|
|
42096
42371
|
...manifest.provenance ?? {}
|
|
@@ -42552,6 +42827,103 @@ function displayName(name) {
|
|
|
42552
42827
|
function escapeJsString(value) {
|
|
42553
42828
|
return value.replace(/\\/g, "\\\\").replace(/"/g, "\\\"").replace(/\r?\n/g, " ");
|
|
42554
42829
|
}
|
|
42830
|
+
|
|
42831
|
+
// src/lib/authoring-path.ts
|
|
42832
|
+
import { lstatSync as lstatSync20, realpathSync as realpathSync6 } from "fs";
|
|
42833
|
+
import { homedir as homedir4 } from "os";
|
|
42834
|
+
import { basename as basename8, dirname as dirname16, join as join24, resolve as resolve15, sep as sep6 } from "path";
|
|
42835
|
+
var NATIVE_DISCOVERY_ROOTS = NATIVE_SKILL_ROOTS.map(([, path]) => path.split("/"));
|
|
42836
|
+
function pathParts(path) {
|
|
42837
|
+
return resolve15(path).split(sep6).filter(Boolean);
|
|
42838
|
+
}
|
|
42839
|
+
function nativeRootMatch(path) {
|
|
42840
|
+
const parts = pathParts(path);
|
|
42841
|
+
for (let start = 0;start < parts.length; start += 1) {
|
|
42842
|
+
for (const root2 of NATIVE_DISCOVERY_ROOTS) {
|
|
42843
|
+
if (root2.every((part, offset) => parts[start + offset] === part)) {
|
|
42844
|
+
return root2.join("/");
|
|
42845
|
+
}
|
|
42846
|
+
}
|
|
42847
|
+
}
|
|
42848
|
+
return;
|
|
42849
|
+
}
|
|
42850
|
+
function physicalPath(path) {
|
|
42851
|
+
let cursor = resolve15(path);
|
|
42852
|
+
const suffix = [];
|
|
42853
|
+
while (!lstatSync20(cursor, { throwIfNoEntry: false })) {
|
|
42854
|
+
suffix.unshift(basename8(cursor));
|
|
42855
|
+
const parent = dirname16(cursor);
|
|
42856
|
+
if (parent === cursor)
|
|
42857
|
+
return resolve15(path);
|
|
42858
|
+
cursor = parent;
|
|
42859
|
+
}
|
|
42860
|
+
return resolve15(realpathSync6(cursor), ...suffix);
|
|
42861
|
+
}
|
|
42862
|
+
function contains(root2, path) {
|
|
42863
|
+
return path === root2 || path.startsWith(root2 + sep6);
|
|
42864
|
+
}
|
|
42865
|
+
function configuredRoots(home, explicitHome) {
|
|
42866
|
+
const homeData = join24(home, ".hasna", "skills");
|
|
42867
|
+
const homePolicy = readManagedSkillPolicySnapshot(homeData);
|
|
42868
|
+
const configuredPolicy = !explicitHome && resolve15(getDataDirReadOnly()) !== resolve15(homeData) ? readManagedSkillPolicySnapshot(getDataDirReadOnly()) : null;
|
|
42869
|
+
const policy = homePolicy ?? configuredPolicy;
|
|
42870
|
+
const bridge = policy?.value.bridge;
|
|
42871
|
+
if (bridge && (typeof bridge.home !== "string" || physicalPath(bridge.home) !== physicalPath(home))) {
|
|
42872
|
+
throw new Error("Native discovery policy belongs to a different home; refusing portable authoring");
|
|
42873
|
+
}
|
|
42874
|
+
const roots = [];
|
|
42875
|
+
const admitBinding = (binding) => {
|
|
42876
|
+
if (!INTEGRATION_AGENTS.includes(binding.agent) || !binding.sources.some((source) => source.path === physicalPath(agentDiscoveryConfigPath(home, binding.agent)))) {
|
|
42877
|
+
throw new Error("Native discovery policy does not bind the current account configuration");
|
|
42878
|
+
}
|
|
42879
|
+
verifyAgentDiscovery(binding);
|
|
42880
|
+
roots.push(...binding.roots);
|
|
42881
|
+
};
|
|
42882
|
+
if (homePolicy && configuredPolicy?.value.bridge) {
|
|
42883
|
+
if (physicalPath(configuredPolicy.value.bridge.home) !== physicalPath(home))
|
|
42884
|
+
throw new Error("Native discovery policy belongs to a different home; refusing portable authoring");
|
|
42885
|
+
for (const binding of Object.values(configuredPolicy.value.bridge.discovery ?? {})) {
|
|
42886
|
+
admitBinding(binding);
|
|
42887
|
+
}
|
|
42888
|
+
}
|
|
42889
|
+
for (const agent of INTEGRATION_AGENTS) {
|
|
42890
|
+
const binding = bridge?.discovery?.[agent];
|
|
42891
|
+
if (binding !== undefined) {
|
|
42892
|
+
if (binding.agent !== agent)
|
|
42893
|
+
throw new Error("Invalid native discovery policy binding");
|
|
42894
|
+
admitBinding(binding);
|
|
42895
|
+
continue;
|
|
42896
|
+
}
|
|
42897
|
+
const nativeHome = join24(home, agent === "opencode" ? ".config/opencode" : `.${agent}`);
|
|
42898
|
+
if (!lstatSync20(nativeHome, { throwIfNoEntry: false }))
|
|
42899
|
+
continue;
|
|
42900
|
+
roots.push(...resolveAgentDiscovery({ home, agent, canonical: physicalPath }).roots);
|
|
42901
|
+
}
|
|
42902
|
+
return roots;
|
|
42903
|
+
}
|
|
42904
|
+
function assertPortableAuthoringPath(path, options = {}) {
|
|
42905
|
+
if (typeof path !== "string" || !path || path.includes("\x00"))
|
|
42906
|
+
throw new Error("Invalid portable authoring path");
|
|
42907
|
+
const lexical = resolve15(path);
|
|
42908
|
+
const physical = physicalPath(lexical);
|
|
42909
|
+
const candidates = [lexical, physical];
|
|
42910
|
+
let native = candidates.map(nativeRootMatch).find(Boolean);
|
|
42911
|
+
const home = resolve15(options.homeDir ?? homedir4());
|
|
42912
|
+
const defaults = NATIVE_DISCOVERY_ROOTS.map((parts) => join24(home, ...parts));
|
|
42913
|
+
defaults.push(join24(home, ".codex/plugins/cache"), join24(home, ".claude/plugins/cache"), join24(home, ".claude/plugins/synced"), join24(home, ".gemini/extensions"));
|
|
42914
|
+
for (const root2 of defaults) {
|
|
42915
|
+
if (candidates.some((candidate2) => contains(resolve15(root2), candidate2) || contains(physicalPath(root2), candidate2)))
|
|
42916
|
+
native ??= root2;
|
|
42917
|
+
}
|
|
42918
|
+
if (native) {
|
|
42919
|
+
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.`);
|
|
42920
|
+
}
|
|
42921
|
+
for (const root2 of configuredRoots(home, options.homeDir !== undefined)) {
|
|
42922
|
+
if (candidates.some((candidate2) => contains(resolve15(root2), candidate2) || contains(physicalPath(root2), candidate2))) {
|
|
42923
|
+
throw new Error(`Refusing portable Skills authoring below configured native discovery root: ${lexical}`);
|
|
42924
|
+
}
|
|
42925
|
+
}
|
|
42926
|
+
}
|
|
42555
42927
|
// src/lib/portable-skills.ts
|
|
42556
42928
|
function getPortableSkillsRoot(options = {}) {
|
|
42557
42929
|
return resolvePortableSkillsRoot(options, true);
|
|
@@ -42559,15 +42931,15 @@ function getPortableSkillsRoot(options = {}) {
|
|
|
42559
42931
|
function resolvePortableSkillsRoot(options, migrate) {
|
|
42560
42932
|
if (options.rootDir)
|
|
42561
42933
|
return options.rootDir;
|
|
42562
|
-
const appDir = options.homeDir ?
|
|
42563
|
-
const cache =
|
|
42934
|
+
const appDir = options.homeDir ? join25(options.homeDir, ".hasna", "skills") : migrate ? getDataDir() : getDataDirReadOnly();
|
|
42935
|
+
const cache = join25(appDir, SKILLS_CACHE_DIRNAME);
|
|
42564
42936
|
if (isOwnerLayoutMigrated(appDir) && safeIsDirectory(cache))
|
|
42565
42937
|
return cache;
|
|
42566
|
-
const installed =
|
|
42938
|
+
const installed = join25(appDir, INSTALLED_SKILLS_DIRNAME);
|
|
42567
42939
|
return installed;
|
|
42568
42940
|
}
|
|
42569
42941
|
function getPortableSkillPath(name, options = {}) {
|
|
42570
|
-
return
|
|
42942
|
+
return join25(getPortableSkillsRoot(options), normalizePortableSkillName(name));
|
|
42571
42943
|
}
|
|
42572
42944
|
function findPortableSkill(name, options = {}) {
|
|
42573
42945
|
let normalized;
|
|
@@ -42593,7 +42965,7 @@ function listPortableSkills(options = {}) {
|
|
|
42593
42965
|
for (const entry of readdirSync9(root2).sort()) {
|
|
42594
42966
|
if (entry.startsWith("."))
|
|
42595
42967
|
continue;
|
|
42596
|
-
const path =
|
|
42968
|
+
const path = join25(root2, entry);
|
|
42597
42969
|
if (!safeIsDirectory(path))
|
|
42598
42970
|
continue;
|
|
42599
42971
|
try {
|
|
@@ -42626,8 +42998,11 @@ function isOfficialSkillName(name) {
|
|
|
42626
42998
|
}
|
|
42627
42999
|
function scaffoldPortableSkill(name, options = {}) {
|
|
42628
43000
|
const skillName = normalizeNewPortableSkillName(name);
|
|
43001
|
+
const readOnlyRoot = resolvePortableSkillsRoot(options, false);
|
|
43002
|
+
assertPortableAuthoringPath(join25(readOnlyRoot, skillName), options);
|
|
42629
43003
|
const root2 = getPortableSkillsRoot(options);
|
|
42630
|
-
const skillPath =
|
|
43004
|
+
const skillPath = join25(root2, skillName);
|
|
43005
|
+
assertPortableAuthoringPath(skillPath, options);
|
|
42631
43006
|
if (existsSync9(skillPath)) {
|
|
42632
43007
|
if (!options.overwrite)
|
|
42633
43008
|
throw new Error(`Skill '${skillName}' already exists at ${skillPath}`);
|
|
@@ -42660,7 +43035,7 @@ function portPortableSkillDirectory(sourceDir, options = {}) {
|
|
|
42660
43035
|
const skipped = [];
|
|
42661
43036
|
const entries = readdirSync9(absoluteSource, { withFileTypes: true }).map((entry) => entry.name).filter((entryName) => !entryName.startsWith(".")).sort();
|
|
42662
43037
|
for (const entryName of entries) {
|
|
42663
|
-
const childPath =
|
|
43038
|
+
const childPath = join25(absoluteSource, entryName);
|
|
42664
43039
|
if (!safeIsDirectory(childPath))
|
|
42665
43040
|
continue;
|
|
42666
43041
|
if (!isSkillCandidate(childPath)) {
|
|
@@ -42689,25 +43064,25 @@ function portPortableSkillDirectory(sourceDir, options = {}) {
|
|
|
42689
43064
|
};
|
|
42690
43065
|
}
|
|
42691
43066
|
function isSkillCandidate(dir) {
|
|
42692
|
-
return existsSync9(
|
|
43067
|
+
return existsSync9(join25(dir, "SKILL.md")) || existsSync9(join25(dir, "skill.json")) || existsSync9(join25(dir, "package.json"));
|
|
42693
43068
|
}
|
|
42694
43069
|
function physicalImportPath(path) {
|
|
42695
|
-
let ancestor =
|
|
43070
|
+
let ancestor = resolve16(path);
|
|
42696
43071
|
const suffix = [];
|
|
42697
43072
|
while (!existsSync9(ancestor)) {
|
|
42698
|
-
suffix.unshift(
|
|
42699
|
-
ancestor =
|
|
43073
|
+
suffix.unshift(basename9(ancestor));
|
|
43074
|
+
ancestor = dirname17(ancestor);
|
|
42700
43075
|
}
|
|
42701
|
-
return
|
|
43076
|
+
return join25(realpathSync7(ancestor), ...suffix);
|
|
42702
43077
|
}
|
|
42703
43078
|
function assertDisjointImportPaths(source, destination) {
|
|
42704
|
-
const sourcePath =
|
|
43079
|
+
const sourcePath = realpathSync7(source);
|
|
42705
43080
|
const destinationPath = physicalImportPath(destination);
|
|
42706
|
-
const
|
|
43081
|
+
const contains2 = (parent, child) => {
|
|
42707
43082
|
const path = relative5(parent, child);
|
|
42708
|
-
return path === "" || !isAbsolute16(path) && path !== ".." && !path.startsWith(`..${
|
|
43083
|
+
return path === "" || !isAbsolute16(path) && path !== ".." && !path.startsWith(`..${sep7}`);
|
|
42709
43084
|
};
|
|
42710
|
-
if (
|
|
43085
|
+
if (contains2(sourcePath, destinationPath) || contains2(destinationPath, sourcePath)) {
|
|
42711
43086
|
throw new Error("Source and destination skill directories must not overlap");
|
|
42712
43087
|
}
|
|
42713
43088
|
}
|
|
@@ -42720,20 +43095,23 @@ function portPortableSkill(sourcePath, options = {}) {
|
|
|
42720
43095
|
const explicitName = options.name != null;
|
|
42721
43096
|
const skillName = normalizeNewPortableSkillName(options.name ?? inferred.name);
|
|
42722
43097
|
if (isOfficialSkillName(skillName) && !options.allowShadow) {
|
|
42723
|
-
const sourceSlug = safeNormalizeName(
|
|
42724
|
-
const via = explicitName ? `Name '${skillName}' matches a bundled official skill.` : `Inferred name '${skillName}'${sourceSlug && sourceSlug !== skillName ? ` (from source folder '${
|
|
43098
|
+
const sourceSlug = safeNormalizeName(basename9(absoluteSource));
|
|
43099
|
+
const via = explicitName ? `Name '${skillName}' matches a bundled official skill.` : `Inferred name '${skillName}'${sourceSlug && sourceSlug !== skillName ? ` (from source folder '${basename9(absoluteSource)}')` : ""} matches a bundled official skill.`;
|
|
42725
43100
|
throw new Error(`${via} Importing it would shadow the official '${skillName}'. ` + `Pass --name to choose a different name, or --allow-shadow to override deliberately.`);
|
|
42726
43101
|
}
|
|
42727
|
-
|
|
43102
|
+
const readOnlyDestination = join25(resolvePortableSkillsRoot(options, false), skillName);
|
|
43103
|
+
assertPortableAuthoringPath(readOnlyDestination, options);
|
|
43104
|
+
assertDisjointImportPaths(absoluteSource, readOnlyDestination);
|
|
42728
43105
|
const root2 = getPortableSkillsRoot(options);
|
|
42729
|
-
const destination =
|
|
43106
|
+
const destination = join25(root2, skillName);
|
|
43107
|
+
assertPortableAuthoringPath(destination, options);
|
|
42730
43108
|
assertDisjointImportPaths(absoluteSource, destination);
|
|
42731
43109
|
if (existsSync9(destination)) {
|
|
42732
43110
|
if (!options.overwrite)
|
|
42733
43111
|
throw new Error(`Skill '${skillName}' already exists at ${destination}`);
|
|
42734
43112
|
rmSync2(destination, { recursive: true, force: true });
|
|
42735
43113
|
}
|
|
42736
|
-
mkdirSync7(
|
|
43114
|
+
mkdirSync7(dirname17(destination), { recursive: true });
|
|
42737
43115
|
copySkillDirectory(absoluteSource, destination);
|
|
42738
43116
|
const base = {
|
|
42739
43117
|
...inferred,
|
|
@@ -42769,31 +43147,37 @@ function buildCorpusManifest(input, name) {
|
|
|
42769
43147
|
}
|
|
42770
43148
|
function writeCorpusSkill(input, options = {}) {
|
|
42771
43149
|
const name = normalizePortableSkillName(input.name);
|
|
43150
|
+
const readOnlyRoot = resolvePortableSkillsRoot(options, false);
|
|
43151
|
+
assertPortableAuthoringPath(join25(readOnlyRoot, name), options);
|
|
42772
43152
|
const root2 = getPortableSkillsRoot(options);
|
|
42773
|
-
const skillPath =
|
|
43153
|
+
const skillPath = join25(root2, name);
|
|
43154
|
+
assertPortableAuthoringPath(skillPath, options);
|
|
42774
43155
|
const created = !existsSync9(skillPath);
|
|
42775
43156
|
mkdirSync7(skillPath, { recursive: true });
|
|
42776
|
-
writeFileSync6(
|
|
43157
|
+
writeFileSync6(join25(skillPath, "SKILL.md"), input.skillMd);
|
|
42777
43158
|
const manifest = buildCorpusManifest(input, name);
|
|
42778
43159
|
writeSkillJsonWithHash(skillPath, manifest);
|
|
42779
43160
|
return { name, path: skillPath, manifest, created };
|
|
42780
43161
|
}
|
|
42781
43162
|
function installCorpusSkillAtomically(input, options = {}) {
|
|
42782
43163
|
const name = normalizePortableSkillName(input.name);
|
|
43164
|
+
const readOnlyRoot = resolvePortableSkillsRoot(options, false);
|
|
43165
|
+
assertPortableAuthoringPath(join25(readOnlyRoot, name), options);
|
|
42783
43166
|
const root2 = getPortableSkillsRoot(options);
|
|
42784
|
-
const target =
|
|
43167
|
+
const target = join25(root2, name);
|
|
43168
|
+
assertPortableAuthoringPath(target, options);
|
|
42785
43169
|
const created = !existsSync9(target);
|
|
42786
43170
|
mkdirSync7(root2, { recursive: true });
|
|
42787
|
-
const staging = mkdtempSync(
|
|
43171
|
+
const staging = mkdtempSync(join25(root2, `.pull-${name}-`));
|
|
42788
43172
|
let moved = false;
|
|
42789
43173
|
let backup = null;
|
|
42790
43174
|
try {
|
|
42791
|
-
writeFileSync6(
|
|
43175
|
+
writeFileSync6(join25(staging, "SKILL.md"), input.skillMd);
|
|
42792
43176
|
const manifest = buildCorpusManifest(input, name);
|
|
42793
43177
|
writeSkillJsonWithHash(staging, manifest);
|
|
42794
43178
|
if (existsSync9(target)) {
|
|
42795
|
-
backup = mkdtempSync(
|
|
42796
|
-
renameSync4(target,
|
|
43179
|
+
backup = mkdtempSync(join25(root2, `.pull-backup-${name}-`));
|
|
43180
|
+
renameSync4(target, join25(backup, name));
|
|
42797
43181
|
moved = true;
|
|
42798
43182
|
}
|
|
42799
43183
|
renameSync4(staging, target);
|
|
@@ -42802,9 +43186,9 @@ function installCorpusSkillAtomically(input, options = {}) {
|
|
|
42802
43186
|
return { name, path: target, manifest, created };
|
|
42803
43187
|
} catch (error) {
|
|
42804
43188
|
rmSync2(staging, { recursive: true, force: true });
|
|
42805
|
-
if (moved && backup && existsSync9(
|
|
43189
|
+
if (moved && backup && existsSync9(join25(backup, name))) {
|
|
42806
43190
|
try {
|
|
42807
|
-
renameSync4(
|
|
43191
|
+
renameSync4(join25(backup, name), target);
|
|
42808
43192
|
} catch {}
|
|
42809
43193
|
}
|
|
42810
43194
|
throw error;
|
|
@@ -42817,8 +43201,8 @@ function validatePortableSkillDirectory(name, skillPath) {
|
|
|
42817
43201
|
const warnings = [...base.warnings];
|
|
42818
43202
|
let manifest;
|
|
42819
43203
|
if (existsSync9(skillPath)) {
|
|
42820
|
-
const skillJsonPath =
|
|
42821
|
-
const skillMdPath =
|
|
43204
|
+
const skillJsonPath = join25(skillPath, "skill.json");
|
|
43205
|
+
const skillMdPath = join25(skillPath, "SKILL.md");
|
|
42822
43206
|
if (!existsSync9(skillJsonPath) && !existsSync9(skillMdPath)) {
|
|
42823
43207
|
add3(issues, "portable.manifest_missing", "Missing portable manifest: expected SKILL.md frontmatter and/or skill.json");
|
|
42824
43208
|
}
|
|
@@ -42838,7 +43222,7 @@ function validatePortableSkillDirectory(name, skillPath) {
|
|
|
42838
43222
|
add3(issues, "portable.version_missing", "Portable manifest missing version");
|
|
42839
43223
|
}
|
|
42840
43224
|
const contractIssues = validatePortableManifestContract(manifest, {
|
|
42841
|
-
strict: existsSync9(
|
|
43225
|
+
strict: existsSync9(join25(skillPath, "skill.json")),
|
|
42842
43226
|
skillPath
|
|
42843
43227
|
});
|
|
42844
43228
|
for (const issue of contractIssues)
|
|
@@ -42878,7 +43262,7 @@ function validatePortableSkillDirectory(name, skillPath) {
|
|
|
42878
43262
|
add3(issues, "portable.command_entry_unsafe", `Command '${command.name}' entry '${command.entry}' must stay inside the skill directory`);
|
|
42879
43263
|
continue;
|
|
42880
43264
|
}
|
|
42881
|
-
const entryPath =
|
|
43265
|
+
const entryPath = join25(skillPath, command.entry);
|
|
42882
43266
|
if (!existsSync9(entryPath))
|
|
42883
43267
|
add3(issues, "portable.command_entry_missing", `Command '${command.name}' entry '${command.entry}' is missing`);
|
|
42884
43268
|
else if (statSync8(entryPath).isDirectory())
|
|
@@ -42889,7 +43273,7 @@ function validatePortableSkillDirectory(name, skillPath) {
|
|
|
42889
43273
|
} catch (error) {
|
|
42890
43274
|
add3(issues, "portable.manifest_invalid", error.message);
|
|
42891
43275
|
}
|
|
42892
|
-
if (manifest?.kind !== "instruction" && !existsSync9(
|
|
43276
|
+
if (manifest?.kind !== "instruction" && !existsSync9(join25(skillPath, "AGENTS.md"))) {
|
|
42893
43277
|
add3(issues, "portable.agents_missing", "Missing AGENTS.md with build-out instructions for coding agents");
|
|
42894
43278
|
}
|
|
42895
43279
|
}
|
|
@@ -42925,12 +43309,12 @@ async function runPortableSkill(name, args, options = {}) {
|
|
|
42925
43309
|
if (!isSafeRelativePath2(command.entry)) {
|
|
42926
43310
|
return { exitCode: 1, error: `Portable skill '${name}' command entry is unsafe` };
|
|
42927
43311
|
}
|
|
42928
|
-
const entryPath =
|
|
43312
|
+
const entryPath = join25(skill.path, command.entry);
|
|
42929
43313
|
if (!existsSync9(entryPath)) {
|
|
42930
43314
|
return { exitCode: 1, error: `Entry point '${command.entry}' not found in portable skill '${name}'` };
|
|
42931
43315
|
}
|
|
42932
|
-
const pkgPath =
|
|
42933
|
-
const nodeModules =
|
|
43316
|
+
const pkgPath = join25(skill.path, "package.json");
|
|
43317
|
+
const nodeModules = join25(skill.path, "node_modules");
|
|
42934
43318
|
if (existsSync9(pkgPath) && !existsSync9(nodeModules) && hasPackageDependencies(pkgPath)) {
|
|
42935
43319
|
const install = Bun.spawn(["bun", "install", "--no-save"], {
|
|
42936
43320
|
cwd: skill.path,
|
|
@@ -43002,9 +43386,9 @@ function isSkillsOwnershipMarker(marker) {
|
|
|
43002
43386
|
return typeof marker === "object" && marker !== null && Object.hasOwn(marker, "managedBy") && marker.managedBy === SYNC_MARKER_MANAGED_BY;
|
|
43003
43387
|
}
|
|
43004
43388
|
function hasSkillsOwnershipMarker(dir) {
|
|
43005
|
-
const path =
|
|
43389
|
+
const path = join26(dir, SYNC_MARKER_FILE);
|
|
43006
43390
|
try {
|
|
43007
|
-
if (!
|
|
43391
|
+
if (!lstatSync21(path).isFile())
|
|
43008
43392
|
return false;
|
|
43009
43393
|
const marker = JSON.parse(readFileSync16(path, "utf8"));
|
|
43010
43394
|
return isSkillsOwnershipMarker(marker);
|
|
@@ -43023,12 +43407,12 @@ function resolveSyncAgents(arg) {
|
|
|
43023
43407
|
}
|
|
43024
43408
|
return [arg];
|
|
43025
43409
|
}
|
|
43026
|
-
function agentGlobalSkillsDir(agent, homeDir3 =
|
|
43410
|
+
function agentGlobalSkillsDir(agent, homeDir3 = homedir5()) {
|
|
43027
43411
|
switch (agent) {
|
|
43028
43412
|
case "opencode":
|
|
43029
|
-
return
|
|
43413
|
+
return join26(homeDir3, ".config", "opencode", "skills");
|
|
43030
43414
|
default:
|
|
43031
|
-
return
|
|
43415
|
+
return join26(homeDir3, `.${agent}`, "skills");
|
|
43032
43416
|
}
|
|
43033
43417
|
}
|
|
43034
43418
|
function adaptSkillMdForAgent(skillMd, agent) {
|
|
@@ -43087,7 +43471,7 @@ function resolveSyncCorpus(options = {}) {
|
|
|
43087
43471
|
function packageSourceRoots(source) {
|
|
43088
43472
|
const roots = [];
|
|
43089
43473
|
for (const sub of ["skills"]) {
|
|
43090
|
-
const candidate2 =
|
|
43474
|
+
const candidate2 = join26(source, sub);
|
|
43091
43475
|
if (existsSync10(candidate2) && isDirectory(candidate2))
|
|
43092
43476
|
roots.push(candidate2);
|
|
43093
43477
|
}
|
|
@@ -43103,10 +43487,10 @@ function containsSkillDirectories(path) {
|
|
|
43103
43487
|
return false;
|
|
43104
43488
|
}
|
|
43105
43489
|
return entries.some((entry) => {
|
|
43106
|
-
const candidate2 =
|
|
43490
|
+
const candidate2 = join26(path, entry);
|
|
43107
43491
|
if (!isDirectory(candidate2))
|
|
43108
43492
|
return false;
|
|
43109
|
-
return existsSync10(
|
|
43493
|
+
return existsSync10(join26(candidate2, "SKILL.md")) || existsSync10(join26(candidate2, "skill.json")) || existsSync10(join26(candidate2, "package.json"));
|
|
43110
43494
|
});
|
|
43111
43495
|
}
|
|
43112
43496
|
function isDirectory(path) {
|
|
@@ -43120,7 +43504,7 @@ function syncSkillsToAgents(options = {}) {
|
|
|
43120
43504
|
assertNativeExportAllowed();
|
|
43121
43505
|
const requested = normalizeRequested(options.names);
|
|
43122
43506
|
const agents = options.agents?.length ? options.agents : [...SYNC_AGENTS];
|
|
43123
|
-
const homeDir3 = options.homeDir ??
|
|
43507
|
+
const homeDir3 = options.homeDir ?? homedir5();
|
|
43124
43508
|
const { roots, source } = resolveSyncCorpus(options);
|
|
43125
43509
|
const corpus = listPortableSkillsAcrossRoots(roots);
|
|
43126
43510
|
const byName = new Map(corpus.map((skill) => [skill.name, skill]));
|
|
@@ -43146,7 +43530,7 @@ function syncSkillsToAgents(options = {}) {
|
|
|
43146
43530
|
actions.push({
|
|
43147
43531
|
skill: name,
|
|
43148
43532
|
agent,
|
|
43149
|
-
path:
|
|
43533
|
+
path: join26(agentGlobalSkillsDir(agent, homeDir3), name, "SKILL.md"),
|
|
43150
43534
|
action: "skip",
|
|
43151
43535
|
reason: "not found in this machine's corpus"
|
|
43152
43536
|
});
|
|
@@ -43175,8 +43559,8 @@ function syncSkillsToAgents(options = {}) {
|
|
|
43175
43559
|
return { actions };
|
|
43176
43560
|
}
|
|
43177
43561
|
function writeManagedAgentSkill(params) {
|
|
43178
|
-
const homeDir3 = params.homeDir ??
|
|
43179
|
-
const dir =
|
|
43562
|
+
const homeDir3 = params.homeDir ?? homedir5();
|
|
43563
|
+
const dir = join26(agentGlobalSkillsDir(params.agent, homeDir3), params.skill);
|
|
43180
43564
|
const result = writeManagedSkillDir(dir, params.skillMd, {
|
|
43181
43565
|
skill: params.skill,
|
|
43182
43566
|
source: params.source,
|
|
@@ -43193,8 +43577,8 @@ function writeManagedAgentSkill(params) {
|
|
|
43193
43577
|
};
|
|
43194
43578
|
}
|
|
43195
43579
|
function writeManagedSkillDir(dir, skillMd, options) {
|
|
43196
|
-
const skillMdPath =
|
|
43197
|
-
const markerPath =
|
|
43580
|
+
const skillMdPath = join26(dir, "SKILL.md");
|
|
43581
|
+
const markerPath = join26(dir, SYNC_MARKER_FILE);
|
|
43198
43582
|
const dirExists = existsSync10(dir);
|
|
43199
43583
|
const managed = hasSkillsOwnershipMarker(dir);
|
|
43200
43584
|
const hasSkillMd = existsSync10(skillMdPath);
|
|
@@ -43230,13 +43614,13 @@ function writeManagedSkillDir(dir, skillMd, options) {
|
|
|
43230
43614
|
const action = dirExists ? "update" : "create";
|
|
43231
43615
|
if (options.dryRun)
|
|
43232
43616
|
return { action, path: skillMdPath };
|
|
43233
|
-
const parentDir =
|
|
43617
|
+
const parentDir = dirname18(dir);
|
|
43234
43618
|
mkdirSync8(parentDir, { recursive: true });
|
|
43235
|
-
const transactionDir = mkdtempSync2(
|
|
43236
|
-
const candidateDir =
|
|
43237
|
-
const backupDir =
|
|
43238
|
-
const candidateSkillMdPath =
|
|
43239
|
-
const candidateMarkerPath =
|
|
43619
|
+
const transactionDir = mkdtempSync2(join26(parentDir, `.hasna-skills-write-${basename10(dir)}-`));
|
|
43620
|
+
const candidateDir = join26(transactionDir, "candidate");
|
|
43621
|
+
const backupDir = join26(transactionDir, "backup");
|
|
43622
|
+
const candidateSkillMdPath = join26(candidateDir, "SKILL.md");
|
|
43623
|
+
const candidateMarkerPath = join26(candidateDir, SYNC_MARKER_FILE);
|
|
43240
43624
|
const marker = {
|
|
43241
43625
|
managedBy: SYNC_MARKER_MANAGED_BY,
|
|
43242
43626
|
skill: options.skill,
|
|
@@ -43284,8 +43668,8 @@ function writeManagedSkillDir(dir, skillMd, options) {
|
|
|
43284
43668
|
}
|
|
43285
43669
|
return { action, path: skillMdPath };
|
|
43286
43670
|
}
|
|
43287
|
-
function removeManagedAgentSkill(skill, agent, homeDir3 =
|
|
43288
|
-
const dir =
|
|
43671
|
+
function removeManagedAgentSkill(skill, agent, homeDir3 = homedir5()) {
|
|
43672
|
+
const dir = join26(agentGlobalSkillsDir(agent, homeDir3), skill);
|
|
43289
43673
|
if (!hasSkillsOwnershipMarker(dir))
|
|
43290
43674
|
return false;
|
|
43291
43675
|
rmSync3(dir, { recursive: true, force: true });
|
|
@@ -43293,7 +43677,7 @@ function removeManagedAgentSkill(skill, agent, homeDir3 = homedir4()) {
|
|
|
43293
43677
|
}
|
|
43294
43678
|
function sourceSkillMd(skillPath, name, description, kind, preferBundledDocs = false) {
|
|
43295
43679
|
if (kind === undefined || kind === "instruction" || preferBundledDocs) {
|
|
43296
|
-
const skillMdPath =
|
|
43680
|
+
const skillMdPath = join26(skillPath, "SKILL.md");
|
|
43297
43681
|
if (existsSync10(skillMdPath))
|
|
43298
43682
|
return readFileSync16(skillMdPath, "utf-8");
|
|
43299
43683
|
}
|
|
@@ -43326,7 +43710,7 @@ function normalizeSkillName(name) {
|
|
|
43326
43710
|
|
|
43327
43711
|
// src/lib/registry.ts
|
|
43328
43712
|
import { existsSync as existsSync11, readFileSync as readFileSync17, readdirSync as readdirSync11 } from "fs";
|
|
43329
|
-
import { join as
|
|
43713
|
+
import { join as join27 } from "path";
|
|
43330
43714
|
|
|
43331
43715
|
// src/lib/registry-merge.ts
|
|
43332
43716
|
var SKILL_SOURCE_PRECEDENCE = {
|
|
@@ -43536,7 +43920,7 @@ function discoverSkillsInDir(dir, source = "custom") {
|
|
|
43536
43920
|
for (const entry of entries) {
|
|
43537
43921
|
if (!entry.isDirectory())
|
|
43538
43922
|
continue;
|
|
43539
|
-
const skillMdPath =
|
|
43923
|
+
const skillMdPath = join27(dir, entry.name, "SKILL.md");
|
|
43540
43924
|
if (!existsSync11(skillMdPath))
|
|
43541
43925
|
continue;
|
|
43542
43926
|
let content;
|
|
@@ -43556,7 +43940,7 @@ function discoverSkillsInDir(dir, source = "custom") {
|
|
|
43556
43940
|
category: fm.category || "Development Tools",
|
|
43557
43941
|
tags: fm.tags || [],
|
|
43558
43942
|
...fm.kind ? { kind: fm.kind } : {},
|
|
43559
|
-
...isHostedMetadataSkillDir(
|
|
43943
|
+
...isHostedMetadataSkillDir(join27(dir, entry.name)) ? { serverOwned: true } : {},
|
|
43560
43944
|
source
|
|
43561
43945
|
});
|
|
43562
43946
|
}
|
|
@@ -43572,8 +43956,8 @@ function findExtensionSkillPath(name) {
|
|
|
43572
43956
|
for (const entry of entries) {
|
|
43573
43957
|
if (!entry.isDirectory())
|
|
43574
43958
|
continue;
|
|
43575
|
-
const skillDir =
|
|
43576
|
-
const skillMdPath =
|
|
43959
|
+
const skillDir = join27(config.extensionsDir, entry.name);
|
|
43960
|
+
const skillMdPath = join27(skillDir, "SKILL.md");
|
|
43577
43961
|
if (!existsSync11(skillMdPath))
|
|
43578
43962
|
continue;
|
|
43579
43963
|
let content;
|
|
@@ -43644,7 +44028,7 @@ function getAllTags() {
|
|
|
43644
44028
|
|
|
43645
44029
|
// src/lib/project-state.ts
|
|
43646
44030
|
import { existsSync as existsSync12, mkdirSync as mkdirSync9, readFileSync as readFileSync18, writeFileSync as writeFileSync8 } from "fs";
|
|
43647
|
-
import { join as
|
|
44031
|
+
import { join as join28 } from "path";
|
|
43648
44032
|
var VALID_PIN_SOURCES = [
|
|
43649
44033
|
"official",
|
|
43650
44034
|
"custom",
|
|
@@ -43659,10 +44043,10 @@ var SKILLS_PROJECT_DIR = ".skills";
|
|
|
43659
44043
|
var PROJECT_CONFIG_FILE = "project.json";
|
|
43660
44044
|
var DEFAULT_EXPORT_DIR = ".skills/exports";
|
|
43661
44045
|
function getProjectStateDir(targetDir = process.cwd()) {
|
|
43662
|
-
return
|
|
44046
|
+
return join28(targetDir, SKILLS_PROJECT_DIR);
|
|
43663
44047
|
}
|
|
43664
44048
|
function getProjectConfigPath(targetDir = process.cwd()) {
|
|
43665
|
-
return
|
|
44049
|
+
return join28(getProjectStateDir(targetDir), PROJECT_CONFIG_FILE);
|
|
43666
44050
|
}
|
|
43667
44051
|
function loadProjectConfig(targetDir = process.cwd()) {
|
|
43668
44052
|
const path = getProjectConfigPath(targetDir);
|
|
@@ -43791,7 +44175,7 @@ function getSkillPath(name) {
|
|
|
43791
44175
|
const extensionPath = findExtensionSkillPath(skillName);
|
|
43792
44176
|
if (extensionPath)
|
|
43793
44177
|
return extensionPath;
|
|
43794
|
-
return
|
|
44178
|
+
return join29(getPortableSkillsRoot(), skillName);
|
|
43795
44179
|
}
|
|
43796
44180
|
function getCanonicalSkillName(name) {
|
|
43797
44181
|
return getSkill(name)?.name ?? resolveSkillAlias(normalizeSkillSlug(name));
|
|
@@ -43854,7 +44238,7 @@ function createLocalSkillManifest(name, generateSkillMd) {
|
|
|
43854
44238
|
if (!existsSync13(sourcePath))
|
|
43855
44239
|
return null;
|
|
43856
44240
|
let skillMd = "";
|
|
43857
|
-
const skillMdPath =
|
|
44241
|
+
const skillMdPath = join29(sourcePath, "SKILL.md");
|
|
43858
44242
|
if (existsSync13(skillMdPath)) {
|
|
43859
44243
|
skillMd = readFileSync19(skillMdPath, "utf-8");
|
|
43860
44244
|
} else if (generateSkillMd) {
|
|
@@ -43928,16 +44312,16 @@ function getAgentSkillsDir(agent, scope = "global", projectDir) {
|
|
|
43928
44312
|
const base = projectDir || process.cwd();
|
|
43929
44313
|
switch (agent) {
|
|
43930
44314
|
case "pi":
|
|
43931
|
-
return scope === "project" ?
|
|
44315
|
+
return scope === "project" ? join29(base, ".pi", "skills") : join29(homedir6(), ".pi", "agent", "skills");
|
|
43932
44316
|
case "opencode":
|
|
43933
|
-
return scope === "project" ?
|
|
44317
|
+
return scope === "project" ? join29(base, ".opencode", "skills") : join29(homedir6(), ".config", "opencode", "skills");
|
|
43934
44318
|
default:
|
|
43935
|
-
return scope === "project" ?
|
|
44319
|
+
return scope === "project" ? join29(base, `.${agent}`, "skills") : join29(homedir6(), `.${agent}`, "skills");
|
|
43936
44320
|
}
|
|
43937
44321
|
}
|
|
43938
44322
|
function getAgentSkillPath(name, agent, scope = "global", projectDir) {
|
|
43939
44323
|
const skillName = normalizeSkillName(getCanonicalSkillName(name));
|
|
43940
|
-
return
|
|
44324
|
+
return join29(getAgentSkillsDir(agent, scope, projectDir), skillName);
|
|
43941
44325
|
}
|
|
43942
44326
|
function installSkillForAgent(name, options, generateSkillMd) {
|
|
43943
44327
|
assertNativeExportAllowed();
|
|
@@ -43973,7 +44357,7 @@ function removeSkillForAgent(name, options) {
|
|
|
43973
44357
|
}
|
|
43974
44358
|
function resolveAgentSkillMd(name, generateSkillMd) {
|
|
43975
44359
|
const sourcePath = getSkillPath(name);
|
|
43976
|
-
const skillMdPath =
|
|
44360
|
+
const skillMdPath = join29(sourcePath, "SKILL.md");
|
|
43977
44361
|
if (existsSync13(skillMdPath))
|
|
43978
44362
|
return readFileSync19(skillMdPath, "utf-8");
|
|
43979
44363
|
if (generateSkillMd)
|
|
@@ -44008,7 +44392,7 @@ function generateMinimalSkillMd(name) {
|
|
|
44008
44392
|
"---",
|
|
44009
44393
|
""
|
|
44010
44394
|
].filter(Boolean);
|
|
44011
|
-
const fallbackDoc = readFileIfExists(
|
|
44395
|
+
const fallbackDoc = readFileIfExists(join29(sourcePath, "README.md")) || readFileIfExists(join29(sourcePath, "CLAUDE.md"));
|
|
44012
44396
|
if (fallbackDoc)
|
|
44013
44397
|
return `${frontmatter.join(`
|
|
44014
44398
|
`)}${fallbackDoc.trim()}
|
|
@@ -44027,7 +44411,7 @@ skills run ${canonicalName}
|
|
|
44027
44411
|
`;
|
|
44028
44412
|
}
|
|
44029
44413
|
function readBundledSkillVersion(name) {
|
|
44030
|
-
const pkgPath =
|
|
44414
|
+
const pkgPath = join29(getSkillPath(name), "package.json");
|
|
44031
44415
|
if (!existsSync13(pkgPath))
|
|
44032
44416
|
return "unknown";
|
|
44033
44417
|
try {
|
|
@@ -44082,7 +44466,7 @@ function selectSkillDoc(docs, file) {
|
|
|
44082
44466
|
function isInstructionSkillDir(skillPath, meta) {
|
|
44083
44467
|
if (meta?.kind === "instruction")
|
|
44084
44468
|
return true;
|
|
44085
|
-
const skillMdPath =
|
|
44469
|
+
const skillMdPath = join30(skillPath, "SKILL.md");
|
|
44086
44470
|
if (!existsSync14(skillMdPath))
|
|
44087
44471
|
return false;
|
|
44088
44472
|
try {
|
|
@@ -44112,9 +44496,9 @@ function getSkillDocs(name) {
|
|
|
44112
44496
|
if (!existsSync14(skillPath))
|
|
44113
44497
|
return null;
|
|
44114
44498
|
return {
|
|
44115
|
-
skillMd: readIfExists(
|
|
44116
|
-
readme: readIfExists(
|
|
44117
|
-
claudeMd: readIfExists(
|
|
44499
|
+
skillMd: readIfExists(join30(skillPath, "SKILL.md")),
|
|
44500
|
+
readme: readIfExists(join30(skillPath, "README.md")),
|
|
44501
|
+
claudeMd: readIfExists(join30(skillPath, "CLAUDE.md"))
|
|
44118
44502
|
};
|
|
44119
44503
|
}
|
|
44120
44504
|
function getSkillBestDoc(name, file) {
|
|
@@ -44130,14 +44514,14 @@ function getSkillRequirements(name) {
|
|
|
44130
44514
|
return null;
|
|
44131
44515
|
const texts = [];
|
|
44132
44516
|
for (const file of ["SKILL.md", "README.md", "CLAUDE.md", ".env.example", ".env.local.example"]) {
|
|
44133
|
-
const content = readIfExists(
|
|
44517
|
+
const content = readIfExists(join30(skillPath, file));
|
|
44134
44518
|
if (content)
|
|
44135
44519
|
texts.push(content);
|
|
44136
44520
|
}
|
|
44137
44521
|
const meta = getSkill(name);
|
|
44138
44522
|
let dependencies = {};
|
|
44139
44523
|
try {
|
|
44140
|
-
dependencies = JSON.parse(readFileSync20(
|
|
44524
|
+
dependencies = JSON.parse(readFileSync20(join30(skillPath, "package.json"), "utf8")).dependencies || {};
|
|
44141
44525
|
} catch {}
|
|
44142
44526
|
return getSkillRequirementsFromContent(name, texts, dependencies, meta);
|
|
44143
44527
|
}
|
|
@@ -44199,7 +44583,7 @@ async function runSkill(name, args, options = {}) {
|
|
|
44199
44583
|
error: `Skill '${name}' is an instruction skill (kind: instruction) and is not runnable. Instruction skills are consumed by coding agents via SKILL.md, not executed with 'skills run'.`
|
|
44200
44584
|
};
|
|
44201
44585
|
}
|
|
44202
|
-
const pkgPath =
|
|
44586
|
+
const pkgPath = join30(skillPath, "package.json");
|
|
44203
44587
|
if (!existsSync14(pkgPath)) {
|
|
44204
44588
|
return { exitCode: 1, error: `No package.json in skill '${name}'` };
|
|
44205
44589
|
}
|
|
@@ -44219,12 +44603,12 @@ async function runSkill(name, args, options = {}) {
|
|
|
44219
44603
|
} catch {
|
|
44220
44604
|
return { exitCode: 1, error: `Failed to parse package.json for skill '${name}'` };
|
|
44221
44605
|
}
|
|
44222
|
-
const entryPath =
|
|
44606
|
+
const entryPath = join30(skillPath, entryPoint2);
|
|
44223
44607
|
if (!existsSync14(entryPath)) {
|
|
44224
44608
|
return { exitCode: 1, error: `Entry point '${entryPoint2}' not found in skill '${name}'` };
|
|
44225
44609
|
}
|
|
44226
44610
|
const env = { ...process.env, ...options.env };
|
|
44227
|
-
if (!existsSync14(
|
|
44611
|
+
if (!existsSync14(join30(skillPath, "node_modules")) || hasDependencyPreparationMarker(skillPath)) {
|
|
44228
44612
|
const failure = await prepareSkillDependencies(skillPath, env, options.preparationTimeoutMs);
|
|
44229
44613
|
if (failure)
|
|
44230
44614
|
return failure;
|
|
@@ -44302,10 +44686,10 @@ function generateSkillMd(name) {
|
|
|
44302
44686
|
"---"
|
|
44303
44687
|
].join(`
|
|
44304
44688
|
`);
|
|
44305
|
-
const readme = readIfExists(
|
|
44306
|
-
const claudeMd = readIfExists(
|
|
44689
|
+
const readme = readIfExists(join30(skillPath, "README.md"));
|
|
44690
|
+
const claudeMd = readIfExists(join30(skillPath, "CLAUDE.md"));
|
|
44307
44691
|
let cliCommand = null;
|
|
44308
|
-
const pkgPath =
|
|
44692
|
+
const pkgPath = join30(skillPath, "package.json");
|
|
44309
44693
|
if (existsSync14(pkgPath)) {
|
|
44310
44694
|
try {
|
|
44311
44695
|
const pkg = JSON.parse(readFileSync20(pkgPath, "utf-8"));
|
|
@@ -44587,7 +44971,7 @@ async function executeSelectedLocal(selected, options = {}) {
|
|
|
44587
44971
|
throw new SkillSelectionError("INVALID_SECRET_BINDINGS", "Explicit environment values must be bounded strings without NUL bytes.");
|
|
44588
44972
|
secretEnv[name] = value;
|
|
44589
44973
|
}
|
|
44590
|
-
const runDirectory = mkdtempSync3(
|
|
44974
|
+
const runDirectory = mkdtempSync3(join31(tmpdir(), "skills-execution-"));
|
|
44591
44975
|
const paths = new SkillEntryPaths;
|
|
44592
44976
|
for (const entry of entries) {
|
|
44593
44977
|
paths.add(entry.path, 100, () => {
|
|
@@ -44595,12 +44979,12 @@ async function executeSelectedLocal(selected, options = {}) {
|
|
|
44595
44979
|
}, () => {
|
|
44596
44980
|
throw new SkillSelectionError("INVALID_BUNDLE_PATH", "The execution bundle path exceeds its limit.");
|
|
44597
44981
|
});
|
|
44598
|
-
const destination =
|
|
44599
|
-
mkdirSync10(
|
|
44982
|
+
const destination = join31(runDirectory, entry.path);
|
|
44983
|
+
mkdirSync10(dirname19(destination), { recursive: true, mode: 448 });
|
|
44600
44984
|
writeFileSync9(destination, entry.bytes, { flag: "wx", mode: entry.mode & 511 });
|
|
44601
44985
|
}
|
|
44602
44986
|
env.SKILLS_INPUT_JSON = input;
|
|
44603
|
-
env.SKILLS_WORKSPACE_DIR =
|
|
44987
|
+
env.SKILLS_WORKSPACE_DIR = resolve17(options.cwd ?? process.cwd());
|
|
44604
44988
|
env.SKILLS_RUN_DIR = runDirectory;
|
|
44605
44989
|
if (runtime.version) {
|
|
44606
44990
|
const version = await subprocess([executable, ...runtimeName === "bun" ? ["--no-env-file"] : [], "--version"], runDirectory, env, "", Math.min(timeoutMs, 5000));
|
|
@@ -44613,7 +44997,7 @@ async function executeSelectedLocal(selected, options = {}) {
|
|
|
44613
44997
|
const { authority: authority2, workspaceId, profileRevision, slug, version, bundleDigest } = selection2;
|
|
44614
44998
|
const request2 = {
|
|
44615
44999
|
selection: { authority: authority2, workspaceId, profileId, profileRevision, slug, version, bundleDigest },
|
|
44616
|
-
consumer: { stationId: process.env.HASNA_STATION || stationHostname2(), workspaceDirectory:
|
|
45000
|
+
consumer: { stationId: process.env.HASNA_STATION || stationHostname2(), workspaceDirectory: realpathSync8(options.cwd ?? process.cwd()) }
|
|
44617
45001
|
};
|
|
44618
45002
|
const grant = await (options.resolveExecutionGrant ?? resolveExecutionGrant)(request2);
|
|
44619
45003
|
if (!grant || !grantIdentifier(grant.policyRevision) || !grantIdentifier(grant.grantId))
|
|
@@ -44623,7 +45007,7 @@ async function executeSelectedLocal(selected, options = {}) {
|
|
|
44623
45007
|
}
|
|
44624
45008
|
if (bindings)
|
|
44625
45009
|
secretEnv = await resolveSelectedSecrets(bindings, options.createSecretsClient);
|
|
44626
|
-
const result = await subprocess([executable, ...runtimeName === "bun" ? ["--no-env-file"] : [],
|
|
45010
|
+
const result = await subprocess([executable, ...runtimeName === "bun" ? ["--no-env-file"] : [], join31(runDirectory, declaredEntry), ...args], runDirectory, { ...env, ...secretEnv }, input, timeoutMs);
|
|
44627
45011
|
result.stdout = redactExecutionSecrets(result.stdout, secretEnv);
|
|
44628
45012
|
result.stderr = redactExecutionSecrets(result.stderr, secretEnv);
|
|
44629
45013
|
const receipt = {
|
|
@@ -44636,7 +45020,7 @@ async function executeSelectedLocal(selected, options = {}) {
|
|
|
44636
45020
|
...bindings ? { secretBinding: { schema: bindings.schema, selection: bindings.selection, consumer: bindings.consumer, secretsAuthority: bindings.secretsAuthority, bindings: bindings.bindings } } : {},
|
|
44637
45021
|
...result
|
|
44638
45022
|
};
|
|
44639
|
-
writeFileSync9(
|
|
45023
|
+
writeFileSync9(join31(runDirectory, ".execution-receipt.json"), JSON.stringify({ ...receipt, stdout: undefined, stderr: undefined }), { mode: 384 });
|
|
44640
45024
|
return receipt;
|
|
44641
45025
|
}
|
|
44642
45026
|
async function subprocess(command, cwd, env, input, timeoutMs) {
|
|
@@ -45755,7 +46139,7 @@ var $resolveS3Config = resolveS3Config;
|
|
|
45755
46139
|
// node_modules/@aws-sdk/client-s3/dist-es/S3Client.js
|
|
45756
46140
|
var import_core = __toESM(require_dist_cjs2(), 1);
|
|
45757
46141
|
var import_client27 = __toESM(require_client(), 1);
|
|
45758
|
-
var
|
|
46142
|
+
var import_config37 = __toESM(require_config(), 1);
|
|
45759
46143
|
var import_endpoints5 = __toESM(require_endpoints(), 1);
|
|
45760
46144
|
var import_event_streams2 = __toESM(require_event_streams(), 1);
|
|
45761
46145
|
var import_protocols6 = __toESM(require_protocols(), 1);
|
|
@@ -53758,21 +54142,21 @@ var import_httpAuthSchemes3 = __toESM(require_httpAuthSchemes(), 1);
|
|
|
53758
54142
|
|
|
53759
54143
|
// node_modules/@aws-sdk/credential-provider-node/dist-es/defaultProvider.js
|
|
53760
54144
|
init_dist_es();
|
|
53761
|
-
var
|
|
54145
|
+
var import_config35 = __toESM(require_config(), 1);
|
|
53762
54146
|
|
|
53763
54147
|
// node_modules/@aws-sdk/credential-provider-node/dist-es/remoteProvider.js
|
|
53764
|
-
var
|
|
54148
|
+
var import_config18 = __toESM(require_config(), 1);
|
|
53765
54149
|
var ENV_IMDS_DISABLED = "AWS_EC2_METADATA_DISABLED";
|
|
53766
54150
|
var remoteProvider = async (init) => {
|
|
53767
54151
|
const { ENV_CMDS_FULL_URI: ENV_CMDS_FULL_URI2, ENV_CMDS_RELATIVE_URI: ENV_CMDS_RELATIVE_URI2, fromContainerMetadata: fromContainerMetadata2, fromInstanceMetadata: fromInstanceMetadata2 } = await Promise.resolve().then(() => (init_dist_es2(), exports_dist_es2));
|
|
53768
54152
|
if (process.env[ENV_CMDS_RELATIVE_URI2] || process.env[ENV_CMDS_FULL_URI2]) {
|
|
53769
54153
|
init.logger?.debug("@aws-sdk/credential-provider-node - remoteProvider::fromHttp/fromContainerMetadata");
|
|
53770
54154
|
const { fromHttp: fromHttp2 } = await Promise.resolve().then(() => (init_dist_es3(), exports_dist_es3));
|
|
53771
|
-
return
|
|
54155
|
+
return import_config18.chain(fromHttp2(init), fromContainerMetadata2(init));
|
|
53772
54156
|
}
|
|
53773
54157
|
if (process.env[ENV_IMDS_DISABLED] && process.env[ENV_IMDS_DISABLED] !== "false") {
|
|
53774
54158
|
return async () => {
|
|
53775
|
-
throw new
|
|
54159
|
+
throw new import_config18.CredentialsProviderError("EC2 Instance Metadata Service access disabled", { logger: init.logger });
|
|
53776
54160
|
};
|
|
53777
54161
|
}
|
|
53778
54162
|
init.logger?.debug("@aws-sdk/credential-provider-node - remoteProvider::fromInstanceMetadata");
|
|
@@ -53847,7 +54231,7 @@ var internalCreateChain = (providers) => async (awsIdentityProperties) => {
|
|
|
53847
54231
|
var multipleCredentialSourceWarningEmitted = false;
|
|
53848
54232
|
var defaultProvider = (init = {}) => memoizeChain([
|
|
53849
54233
|
async () => {
|
|
53850
|
-
const profile = init.profile ?? process.env[
|
|
54234
|
+
const profile = init.profile ?? process.env[import_config35.ENV_PROFILE];
|
|
53851
54235
|
if (profile) {
|
|
53852
54236
|
const envStaticCredentialsAreSet = process.env[ENV_KEY] && process.env[ENV_SECRET];
|
|
53853
54237
|
if (envStaticCredentialsAreSet) {
|
|
@@ -53865,7 +54249,7 @@ var defaultProvider = (init = {}) => memoizeChain([
|
|
|
53865
54249
|
multipleCredentialSourceWarningEmitted = true;
|
|
53866
54250
|
}
|
|
53867
54251
|
}
|
|
53868
|
-
throw new
|
|
54252
|
+
throw new import_config35.CredentialsProviderError("AWS_PROFILE is set, skipping fromEnv provider.", {
|
|
53869
54253
|
logger: init.logger,
|
|
53870
54254
|
tryNextLink: true
|
|
53871
54255
|
});
|
|
@@ -53877,7 +54261,7 @@ var defaultProvider = (init = {}) => memoizeChain([
|
|
|
53877
54261
|
init.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::fromSSO");
|
|
53878
54262
|
const { ssoStartUrl, ssoAccountId, ssoRegion, ssoRoleName, ssoSession } = init;
|
|
53879
54263
|
if (!ssoStartUrl && !ssoAccountId && !ssoRegion && !ssoRoleName && !ssoSession) {
|
|
53880
|
-
throw new
|
|
54264
|
+
throw new import_config35.CredentialsProviderError("Skipping SSO provider in default chain (inputs do not include SSO fields).", { logger: init.logger });
|
|
53881
54265
|
}
|
|
53882
54266
|
const { fromSSO: fromSSO2 } = await Promise.resolve().then(() => (init_dist_es5(), exports_dist_es4));
|
|
53883
54267
|
return fromSSO2(init)(awsIdentityProperties);
|
|
@@ -53902,7 +54286,7 @@ var defaultProvider = (init = {}) => memoizeChain([
|
|
|
53902
54286
|
return (await remoteProvider(init))();
|
|
53903
54287
|
},
|
|
53904
54288
|
async () => {
|
|
53905
|
-
throw new
|
|
54289
|
+
throw new import_config35.CredentialsProviderError("Could not load credentials from any providers", {
|
|
53906
54290
|
tryNextLink: false,
|
|
53907
54291
|
logger: init.logger
|
|
53908
54292
|
});
|
|
@@ -53912,7 +54296,7 @@ var credentialsTreatedAsExpired = (credentials) => credentials?.expiration !== u
|
|
|
53912
54296
|
// node_modules/@aws-sdk/client-s3/dist-es/runtimeConfig.js
|
|
53913
54297
|
var import_checksum2 = __toESM(require_checksum(), 1);
|
|
53914
54298
|
var import_client23 = __toESM(require_client(), 1);
|
|
53915
|
-
var
|
|
54299
|
+
var import_config36 = __toESM(require_config(), 1);
|
|
53916
54300
|
var import_event_streams = __toESM(require_event_streams(), 1);
|
|
53917
54301
|
var import_retry3 = __toESM(require_retry(), 1);
|
|
53918
54302
|
var import_serde4 = __toESM(require_serde(), 1);
|
|
@@ -54202,7 +54586,7 @@ var getRuntimeConfig2 = (config) => {
|
|
|
54202
54586
|
// node_modules/@aws-sdk/client-s3/dist-es/runtimeConfig.js
|
|
54203
54587
|
var getRuntimeConfig3 = (config) => {
|
|
54204
54588
|
import_client23.emitWarningIfUnsupportedVersion(process.version);
|
|
54205
|
-
const defaultsMode =
|
|
54589
|
+
const defaultsMode = import_config36.resolveDefaultsModeConfig(config);
|
|
54206
54590
|
const defaultConfigProvider = () => defaultsMode().then(import_client23.loadConfigsForDefaultMode);
|
|
54207
54591
|
const clientSharedValues = getRuntimeConfig2(config);
|
|
54208
54592
|
import_client22.emitWarningIfUnsupportedVersion(process.version);
|
|
@@ -54215,28 +54599,28 @@ var getRuntimeConfig3 = (config) => {
|
|
|
54215
54599
|
...config,
|
|
54216
54600
|
runtime: "node",
|
|
54217
54601
|
defaultsMode,
|
|
54218
|
-
authSchemePreference: config?.authSchemePreference ??
|
|
54602
|
+
authSchemePreference: config?.authSchemePreference ?? import_config36.loadConfig(import_httpAuthSchemes3.NODE_AUTH_SCHEME_PREFERENCE_OPTIONS, loaderConfig),
|
|
54219
54603
|
bodyLengthChecker: config?.bodyLengthChecker ?? import_serde4.calculateBodyLength,
|
|
54220
54604
|
credentialDefaultProvider: config?.credentialDefaultProvider ?? defaultProvider,
|
|
54221
54605
|
defaultUserAgentProvider: config?.defaultUserAgentProvider ?? import_client22.createDefaultUserAgentProvider({ serviceId: clientSharedValues.serviceId, clientVersion: package_default2.version }),
|
|
54222
|
-
disableS3ExpressSessionAuth: config?.disableS3ExpressSessionAuth ??
|
|
54606
|
+
disableS3ExpressSessionAuth: config?.disableS3ExpressSessionAuth ?? import_config36.loadConfig($NODE_DISABLE_S3_EXPRESS_SESSION_AUTH_OPTIONS, loaderConfig),
|
|
54223
54607
|
eventStreamSerdeProvider: config?.eventStreamSerdeProvider ?? import_event_streams.eventStreamSerdeProvider,
|
|
54224
|
-
maxAttempts: config?.maxAttempts ??
|
|
54225
|
-
region: config?.region ??
|
|
54226
|
-
requestChecksumCalculation: config?.requestChecksumCalculation ??
|
|
54608
|
+
maxAttempts: config?.maxAttempts ?? import_config36.loadConfig(import_retry3.NODE_MAX_ATTEMPT_CONFIG_OPTIONS, config),
|
|
54609
|
+
region: config?.region ?? import_config36.loadConfig(import_config36.NODE_REGION_CONFIG_OPTIONS, { ...import_config36.NODE_REGION_CONFIG_FILE_OPTIONS, ...loaderConfig }),
|
|
54610
|
+
requestChecksumCalculation: config?.requestChecksumCalculation ?? import_config36.loadConfig($NODE_REQUEST_CHECKSUM_CALCULATION_CONFIG_OPTIONS, loaderConfig),
|
|
54227
54611
|
requestHandler: import_node_http_handler2.NodeHttpHandler.create(config?.requestHandler ?? defaultConfigProvider),
|
|
54228
|
-
responseChecksumValidation: config?.responseChecksumValidation ??
|
|
54229
|
-
retryMode: config?.retryMode ??
|
|
54612
|
+
responseChecksumValidation: config?.responseChecksumValidation ?? import_config36.loadConfig($NODE_RESPONSE_CHECKSUM_VALIDATION_CONFIG_OPTIONS, loaderConfig),
|
|
54613
|
+
retryMode: config?.retryMode ?? import_config36.loadConfig({
|
|
54230
54614
|
...import_retry3.NODE_RETRY_MODE_CONFIG_OPTIONS,
|
|
54231
54615
|
default: async () => (await defaultConfigProvider()).retryMode || import_retry3.DEFAULT_RETRY_MODE
|
|
54232
54616
|
}, config),
|
|
54233
|
-
sigv4aSigningRegionSet: config?.sigv4aSigningRegionSet ??
|
|
54617
|
+
sigv4aSigningRegionSet: config?.sigv4aSigningRegionSet ?? import_config36.loadConfig(import_httpAuthSchemes3.NODE_SIGV4A_CONFIG_OPTIONS, loaderConfig),
|
|
54234
54618
|
streamCollector: config?.streamCollector ?? import_node_http_handler2.streamCollector,
|
|
54235
54619
|
streamHasher: config?.streamHasher ?? import_checksum2.readableStreamHasher,
|
|
54236
|
-
useArnRegion: config?.useArnRegion ??
|
|
54237
|
-
useDualstackEndpoint: config?.useDualstackEndpoint ??
|
|
54238
|
-
useFipsEndpoint: config?.useFipsEndpoint ??
|
|
54239
|
-
userAgentAppId: config?.userAgentAppId ??
|
|
54620
|
+
useArnRegion: config?.useArnRegion ?? import_config36.loadConfig($NODE_USE_ARN_REGION_CONFIG_OPTIONS, loaderConfig),
|
|
54621
|
+
useDualstackEndpoint: config?.useDualstackEndpoint ?? import_config36.loadConfig(import_config36.NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS, loaderConfig),
|
|
54622
|
+
useFipsEndpoint: config?.useFipsEndpoint ?? import_config36.loadConfig(import_config36.NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS, loaderConfig),
|
|
54623
|
+
userAgentAppId: config?.userAgentAppId ?? import_config36.loadConfig(import_client22.NODE_APP_ID_CONFIG_OPTIONS, loaderConfig)
|
|
54240
54624
|
};
|
|
54241
54625
|
};
|
|
54242
54626
|
|
|
@@ -54302,7 +54686,7 @@ class S3Client extends import_client27.Client {
|
|
|
54302
54686
|
const _config_2 = import_client26.resolveUserAgentConfig(_config_1);
|
|
54303
54687
|
const _config_3 = $resolveFlexibleChecksumsConfig(_config_2);
|
|
54304
54688
|
const _config_4 = import_retry4.resolveRetryConfig(_config_3);
|
|
54305
|
-
const _config_5 =
|
|
54689
|
+
const _config_5 = import_config37.resolveRegionConfig(_config_4);
|
|
54306
54690
|
const _config_6 = import_client26.resolveHostHeaderConfig(_config_5);
|
|
54307
54691
|
const _config_7 = import_endpoints5.resolveEndpointConfig(_config_6);
|
|
54308
54692
|
const _config_8 = import_event_streams2.resolveEventStreamSerdeConfig(_config_7);
|
|
@@ -54698,10 +55082,10 @@ function assertReservationCents(value, field2) {
|
|
|
54698
55082
|
import { Database as Database2 } from "bun:sqlite";
|
|
54699
55083
|
import { randomUUID as randomUUID8 } from "crypto";
|
|
54700
55084
|
import { mkdirSync as mkdirSync12 } from "fs";
|
|
54701
|
-
import { dirname as
|
|
55085
|
+
import { dirname as dirname23 } from "path";
|
|
54702
55086
|
|
|
54703
55087
|
// src/server/database-url.ts
|
|
54704
|
-
import { isAbsolute as isAbsolute17, join as
|
|
55088
|
+
import { isAbsolute as isAbsolute17, join as join33 } from "path";
|
|
54705
55089
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
54706
55090
|
var DEFAULT_SQLITE_FILENAME2 = "server.db";
|
|
54707
55091
|
var SQLITE_MEMORY_PATH = ":memory:";
|
|
@@ -54710,7 +55094,7 @@ var SQLITE_SCHEMES = new Set(["sqlite", "sqlite3", "file"]);
|
|
|
54710
55094
|
var MEMORY_SCHEMES = new Set(["memory"]);
|
|
54711
55095
|
var SQLITE_EXTENSIONS = [".db", ".sqlite", ".sqlite3", ".db3"];
|
|
54712
55096
|
function defaultSqlitePath() {
|
|
54713
|
-
return
|
|
55097
|
+
return join33(getDataDir(), DEFAULT_SQLITE_FILENAME2);
|
|
54714
55098
|
}
|
|
54715
55099
|
function resolveDatabaseTarget(raw) {
|
|
54716
55100
|
const value = raw?.trim();
|
|
@@ -54737,7 +55121,7 @@ function resolveDatabaseTarget(raw) {
|
|
|
54737
55121
|
throw new Error(`unsupported database scheme "${scheme}:". Supported: postgres://, postgresql://, sqlite:, file:, ` + `an absolute or relative path to a .db/.sqlite file, ":memory:", or "memory:" (non-durable, tests only). ` + `Leave the setting empty to use the default SQLite database at ${defaultSqlitePath()}.`);
|
|
54738
55122
|
}
|
|
54739
55123
|
if (looksLikeSqlitePath(value)) {
|
|
54740
|
-
const path = isAbsolute17(value) ? value :
|
|
55124
|
+
const path = isAbsolute17(value) ? value : join33(process.cwd(), value);
|
|
54741
55125
|
return { kind: "sqlite", path, durable: true, label: `sqlite (${path})` };
|
|
54742
55126
|
}
|
|
54743
55127
|
throw new Error(`could not resolve a database backend from "${value}". Use postgres://\u2026, sqlite:\u2026, an absolute or ` + `relative path ending in ${SQLITE_EXTENSIONS.join("/")}, ":memory:", or leave it empty for the ` + `default SQLite database at ${defaultSqlitePath()}.`);
|
|
@@ -54761,7 +55145,7 @@ function sqlitePathFromUrl(value, scheme) {
|
|
|
54761
55145
|
}
|
|
54762
55146
|
return rest.slice(2).replace(/^\/\/+/, "/");
|
|
54763
55147
|
}
|
|
54764
|
-
return isAbsolute17(rest) ? rest :
|
|
55148
|
+
return isAbsolute17(rest) ? rest : join33(process.cwd(), rest);
|
|
54765
55149
|
}
|
|
54766
55150
|
function looksLikeSqlitePath(value) {
|
|
54767
55151
|
if (value.includes("/"))
|
|
@@ -54994,7 +55378,7 @@ class PostgresSkillSelectionStore {
|
|
|
54994
55378
|
// src/server/sqlite-store.ts
|
|
54995
55379
|
import { randomUUID as randomUUID7 } from "crypto";
|
|
54996
55380
|
import { mkdirSync as mkdirSync11, readFileSync as readFileSync22, readdirSync as readdirSync12 } from "fs";
|
|
54997
|
-
import { dirname as
|
|
55381
|
+
import { dirname as dirname22, join as join35 } from "path";
|
|
54998
55382
|
|
|
54999
55383
|
// src/server/auth.ts
|
|
55000
55384
|
import { createHash as createHash21 } from "crypto";
|
|
@@ -55028,24 +55412,24 @@ function publicPrincipal(partial = {}) {
|
|
|
55028
55412
|
function permitsSkillsRoute(principal, method, resource) {
|
|
55029
55413
|
const scopes = new Set(principal.scopes);
|
|
55030
55414
|
if (resource === "execution-grants") {
|
|
55031
|
-
const
|
|
55032
|
-
if (!
|
|
55415
|
+
const read4 = method === "GET" || method === "HEAD";
|
|
55416
|
+
if (!read4 && method !== "POST" && !["owner", "admin"].includes(principal.role))
|
|
55033
55417
|
return false;
|
|
55034
|
-
const allowed2 =
|
|
55418
|
+
const allowed2 = read4 ? ["*", "execution-grants:*", "execution-grants:read"] : method === "POST" ? ["*", "execution-grants:*", "execution-grants:resolve", "skills:read", "skills:*"] : ["*", "execution-grants:*", "execution-grants:write"];
|
|
55035
55419
|
return allowed2.some((scope) => scopes.has(scope));
|
|
55036
55420
|
}
|
|
55037
55421
|
if (scopes.has("*"))
|
|
55038
55422
|
return true;
|
|
55039
|
-
const
|
|
55040
|
-
if (resource === "capabilities" &&
|
|
55423
|
+
const read3 = method === "GET" || method === "HEAD";
|
|
55424
|
+
if (resource === "capabilities" && read3)
|
|
55041
55425
|
return true;
|
|
55042
55426
|
let allowed;
|
|
55043
55427
|
if (resource === "runs" || resource === "executions") {
|
|
55044
|
-
allowed =
|
|
55428
|
+
allowed = read3 ? ["runs:read", "runs:*", "skills:read", "skills:*"] : ["runs:write", "runs:*"];
|
|
55045
55429
|
} else if (resource === "stations") {
|
|
55046
|
-
allowed =
|
|
55430
|
+
allowed = read3 ? ["stations:read", "stations:*", "skills:read", "skills:*"] : ["stations:write", "stations:*", "skills:*"];
|
|
55047
55431
|
} else if (["skills", "pins", "tags", "profiles", "capabilities"].includes(resource)) {
|
|
55048
|
-
allowed =
|
|
55432
|
+
allowed = read3 ? ["skills:read", "skills:*"] : ["skills:write", "skills:publish", "skills:*"];
|
|
55049
55433
|
} else
|
|
55050
55434
|
return true;
|
|
55051
55435
|
return allowed.some((scope) => scopes.has(scope));
|
|
@@ -55053,17 +55437,17 @@ function permitsSkillsRoute(principal, method, resource) {
|
|
|
55053
55437
|
|
|
55054
55438
|
// src/server/migrations-dir.ts
|
|
55055
55439
|
import { existsSync as existsSync15 } from "fs";
|
|
55056
|
-
import { dirname as
|
|
55440
|
+
import { dirname as dirname21, join as join34 } from "path";
|
|
55057
55441
|
var MIGRATION_DIALECTS = ["postgres", "sqlite"];
|
|
55058
55442
|
var MAX_WALK_UP = 6;
|
|
55059
55443
|
function findMigrationsRoot(startDirs = defaultStartDirs()) {
|
|
55060
55444
|
for (const start of startDirs) {
|
|
55061
55445
|
let dir = start;
|
|
55062
55446
|
for (let level = 0;level < MAX_WALK_UP; level += 1) {
|
|
55063
|
-
const candidate2 =
|
|
55064
|
-
if (MIGRATION_DIALECTS.some((dialect) => existsSync15(
|
|
55447
|
+
const candidate2 = join34(dir, "migrations");
|
|
55448
|
+
if (MIGRATION_DIALECTS.some((dialect) => existsSync15(join34(candidate2, dialect))))
|
|
55065
55449
|
return candidate2;
|
|
55066
|
-
const parent =
|
|
55450
|
+
const parent = dirname21(dir);
|
|
55067
55451
|
if (parent === dir)
|
|
55068
55452
|
break;
|
|
55069
55453
|
dir = parent;
|
|
@@ -55075,7 +55459,7 @@ function resolveMigrationsDir(dialect, root4 = findMigrationsRoot()) {
|
|
|
55075
55459
|
if (!root4) {
|
|
55076
55460
|
throw new Error(`could not locate the migrations directory for dialect "${dialect}". ` + `Expected a migrations/${dialect}/ folder alongside the package root.`);
|
|
55077
55461
|
}
|
|
55078
|
-
const dir =
|
|
55462
|
+
const dir = join34(root4, dialect);
|
|
55079
55463
|
if (!existsSync15(dir)) {
|
|
55080
55464
|
throw new Error(`migrations directory not found: ${dir}`);
|
|
55081
55465
|
}
|
|
@@ -55356,7 +55740,7 @@ class SqliteSkillsStore {
|
|
|
55356
55740
|
constructor(path = SQLITE_MEMORY_PATH, options = {}) {
|
|
55357
55741
|
const inMemory = path === SQLITE_MEMORY_PATH;
|
|
55358
55742
|
if (!inMemory)
|
|
55359
|
-
mkdirSync11(
|
|
55743
|
+
mkdirSync11(dirname22(path), { recursive: true });
|
|
55360
55744
|
this.db = openDatabase(path);
|
|
55361
55745
|
this.db.exec(`PRAGMA busy_timeout = ${Math.max(0, options.busyTimeoutMs ?? 5000)}`);
|
|
55362
55746
|
if (!inMemory)
|
|
@@ -56019,7 +56403,7 @@ function applySqliteMigrations(db, migrationsDir = resolveMigrationsDir("sqlite"
|
|
|
56019
56403
|
const appliedNow = [];
|
|
56020
56404
|
for (const file of files) {
|
|
56021
56405
|
const version2 = file.replace(/\.sql$/, "");
|
|
56022
|
-
const text2 = readFileSync22(
|
|
56406
|
+
const text2 = readFileSync22(join35(migrationsDir, file), "utf8");
|
|
56023
56407
|
const apply = db.transaction(() => {
|
|
56024
56408
|
const already = db.query("SELECT 1 AS present FROM schema_migrations WHERE version = ? LIMIT 1").get(version2);
|
|
56025
56409
|
if (already)
|
|
@@ -56166,7 +56550,7 @@ class SqliteGovernanceStore {
|
|
|
56166
56550
|
closed = false;
|
|
56167
56551
|
constructor(path = SQLITE_MEMORY_PATH, options = {}) {
|
|
56168
56552
|
if (path !== SQLITE_MEMORY_PATH)
|
|
56169
|
-
mkdirSync12(
|
|
56553
|
+
mkdirSync12(dirname23(path), { recursive: true });
|
|
56170
56554
|
this.db = new Database2(path, { create: true, readwrite: true });
|
|
56171
56555
|
this.db.exec("PRAGMA busy_timeout = 5000");
|
|
56172
56556
|
this.db.exec("PRAGMA foreign_keys = ON");
|
|
@@ -57254,7 +57638,7 @@ async function handleProfileApi(store, principal, request2, parts, config) {
|
|
|
57254
57638
|
// src/server/runtime-store.ts
|
|
57255
57639
|
import { Database as Database3 } from "bun:sqlite";
|
|
57256
57640
|
import { mkdirSync as mkdirSync13 } from "fs";
|
|
57257
|
-
import { dirname as
|
|
57641
|
+
import { dirname as dirname24 } from "path";
|
|
57258
57642
|
|
|
57259
57643
|
// src/sdk/execution/types.ts
|
|
57260
57644
|
var EXECUTION_PROTOCOL_VERSION = REMOTE_SKILL_RUN_CONTRACT_VERSION;
|
|
@@ -57310,7 +57694,7 @@ class RuntimeExecutionStore {
|
|
|
57310
57694
|
}
|
|
57311
57695
|
const path = target.kind === "sqlite" ? target.path : ":memory:";
|
|
57312
57696
|
if (path !== ":memory:")
|
|
57313
|
-
mkdirSync13(
|
|
57697
|
+
mkdirSync13(dirname24(path), { recursive: true });
|
|
57314
57698
|
const db = new Database3(path);
|
|
57315
57699
|
db.run("PRAGMA busy_timeout=5000");
|
|
57316
57700
|
db.run("PRAGMA journal_mode=WAL");
|
|
@@ -58334,7 +58718,7 @@ function createReceiptService(store) {
|
|
|
58334
58718
|
var import_client36 = __toESM(require_client2(), 1);
|
|
58335
58719
|
var import_core2 = __toESM(require_dist_cjs2(), 1);
|
|
58336
58720
|
var import_client37 = __toESM(require_client(), 1);
|
|
58337
|
-
var
|
|
58721
|
+
var import_config40 = __toESM(require_config(), 1);
|
|
58338
58722
|
var import_endpoints8 = __toESM(require_endpoints(), 1);
|
|
58339
58723
|
var import_protocols10 = __toESM(require_protocols(), 1);
|
|
58340
58724
|
var import_retry6 = __toESM(require_retry(), 1);
|
|
@@ -58473,7 +58857,7 @@ var package_default3 = {
|
|
|
58473
58857
|
var import_client32 = __toESM(require_client2(), 1);
|
|
58474
58858
|
var import_httpAuthSchemes6 = __toESM(require_httpAuthSchemes(), 1);
|
|
58475
58859
|
var import_client33 = __toESM(require_client(), 1);
|
|
58476
|
-
var
|
|
58860
|
+
var import_config39 = __toESM(require_config(), 1);
|
|
58477
58861
|
var import_retry5 = __toESM(require_retry(), 1);
|
|
58478
58862
|
var import_serde6 = __toESM(require_serde(), 1);
|
|
58479
58863
|
var import_node_http_handler3 = __toESM(require_dist_cjs6(), 1);
|
|
@@ -61415,7 +61799,7 @@ var getRuntimeConfig4 = (config) => {
|
|
|
61415
61799
|
// node_modules/@aws-sdk/client-ecs/dist-es/runtimeConfig.js
|
|
61416
61800
|
var getRuntimeConfig5 = (config) => {
|
|
61417
61801
|
import_client33.emitWarningIfUnsupportedVersion(process.version);
|
|
61418
|
-
const defaultsMode =
|
|
61802
|
+
const defaultsMode = import_config39.resolveDefaultsModeConfig(config);
|
|
61419
61803
|
const defaultConfigProvider = () => defaultsMode().then(import_client33.loadConfigsForDefaultMode);
|
|
61420
61804
|
const clientSharedValues = getRuntimeConfig4(config);
|
|
61421
61805
|
import_client32.emitWarningIfUnsupportedVersion(process.version);
|
|
@@ -61428,21 +61812,21 @@ var getRuntimeConfig5 = (config) => {
|
|
|
61428
61812
|
...config,
|
|
61429
61813
|
runtime: "node",
|
|
61430
61814
|
defaultsMode,
|
|
61431
|
-
authSchemePreference: config?.authSchemePreference ??
|
|
61815
|
+
authSchemePreference: config?.authSchemePreference ?? import_config39.loadConfig(import_httpAuthSchemes6.NODE_AUTH_SCHEME_PREFERENCE_OPTIONS, loaderConfig),
|
|
61432
61816
|
bodyLengthChecker: config?.bodyLengthChecker ?? import_serde6.calculateBodyLength,
|
|
61433
61817
|
credentialDefaultProvider: config?.credentialDefaultProvider ?? defaultProvider,
|
|
61434
61818
|
defaultUserAgentProvider: config?.defaultUserAgentProvider ?? import_client32.createDefaultUserAgentProvider({ serviceId: clientSharedValues.serviceId, clientVersion: package_default3.version }),
|
|
61435
|
-
maxAttempts: config?.maxAttempts ??
|
|
61436
|
-
region: config?.region ??
|
|
61819
|
+
maxAttempts: config?.maxAttempts ?? import_config39.loadConfig(import_retry5.NODE_MAX_ATTEMPT_CONFIG_OPTIONS, config),
|
|
61820
|
+
region: config?.region ?? import_config39.loadConfig(import_config39.NODE_REGION_CONFIG_OPTIONS, { ...import_config39.NODE_REGION_CONFIG_FILE_OPTIONS, ...loaderConfig }),
|
|
61437
61821
|
requestHandler: import_node_http_handler3.NodeHttpHandler.create(config?.requestHandler ?? defaultConfigProvider),
|
|
61438
|
-
retryMode: config?.retryMode ??
|
|
61822
|
+
retryMode: config?.retryMode ?? import_config39.loadConfig({
|
|
61439
61823
|
...import_retry5.NODE_RETRY_MODE_CONFIG_OPTIONS,
|
|
61440
61824
|
default: async () => (await defaultConfigProvider()).retryMode || import_retry5.DEFAULT_RETRY_MODE
|
|
61441
61825
|
}, config),
|
|
61442
61826
|
streamCollector: config?.streamCollector ?? import_node_http_handler3.streamCollector,
|
|
61443
|
-
useDualstackEndpoint: config?.useDualstackEndpoint ??
|
|
61444
|
-
useFipsEndpoint: config?.useFipsEndpoint ??
|
|
61445
|
-
userAgentAppId: config?.userAgentAppId ??
|
|
61827
|
+
useDualstackEndpoint: config?.useDualstackEndpoint ?? import_config39.loadConfig(import_config39.NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS, loaderConfig),
|
|
61828
|
+
useFipsEndpoint: config?.useFipsEndpoint ?? import_config39.loadConfig(import_config39.NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS, loaderConfig),
|
|
61829
|
+
userAgentAppId: config?.userAgentAppId ?? import_config39.loadConfig(import_client32.NODE_APP_ID_CONFIG_OPTIONS, loaderConfig)
|
|
61446
61830
|
};
|
|
61447
61831
|
};
|
|
61448
61832
|
|
|
@@ -61507,7 +61891,7 @@ class ECSClient extends import_client37.Client {
|
|
|
61507
61891
|
const _config_1 = resolveClientEndpointParameters3(_config_0);
|
|
61508
61892
|
const _config_2 = import_client36.resolveUserAgentConfig(_config_1);
|
|
61509
61893
|
const _config_3 = import_retry6.resolveRetryConfig(_config_2);
|
|
61510
|
-
const _config_4 =
|
|
61894
|
+
const _config_4 = import_config40.resolveRegionConfig(_config_3);
|
|
61511
61895
|
const _config_5 = import_client36.resolveHostHeaderConfig(_config_4);
|
|
61512
61896
|
const _config_6 = import_endpoints8.resolveEndpointConfig(_config_5);
|
|
61513
61897
|
const _config_7 = resolveHttpAuthSchemeConfig3(_config_6);
|
|
@@ -62006,13 +62390,13 @@ async function inspectPureBundle(bytes, contract) {
|
|
|
62006
62390
|
throw Error("Pure entrypoint integrity failed");
|
|
62007
62391
|
if (entries.some((e5) => e5.path.split("/").includes("node_modules")))
|
|
62008
62392
|
throw Error("Pure bundle cannot supply dependencies");
|
|
62009
|
-
const
|
|
62393
|
+
const read3 = (name) => {
|
|
62010
62394
|
const entry2 = entries.find((e5) => e5.path === name);
|
|
62011
62395
|
if (!entry2)
|
|
62012
62396
|
throw Error("Pure bundle manifest missing");
|
|
62013
62397
|
return object5(uniqueJson(Buffer.from(entry2.bytes).toString("utf8")));
|
|
62014
62398
|
};
|
|
62015
|
-
const manifest =
|
|
62399
|
+
const manifest = read3("skill.json"), runtime = object5(manifest.runtime), pkg = read3("package.json");
|
|
62016
62400
|
if (manifest.kind !== "executable" || runtime.runtime !== "bun" || runtime.entrypoint !== contract.entrypoint || !Array.isArray(runtime.env) || runtime.env.length !== 0 || runtime.system_deps !== undefined && (!Array.isArray(runtime.system_deps) || runtime.system_deps.length !== 0) || runtime.needs_network === true || manifest.needs_network === true)
|
|
62017
62401
|
throw Error("Pure bundle requires a credential-free self-contained Bun entrypoint");
|
|
62018
62402
|
for (const key of ["dependencies", "optionalDependencies", "peerDependencies", "devDependencies", "scripts"])
|
|
@@ -87489,7 +87873,7 @@ function assertRecurringCapability(value, action) {
|
|
|
87489
87873
|
}
|
|
87490
87874
|
function recurringRequest(action, input2) {
|
|
87491
87875
|
const row = input2, base = "/api/v1/recurring-consents";
|
|
87492
|
-
const
|
|
87876
|
+
const read3 = ["draft", "list", "get", "occurrences"].includes(action);
|
|
87493
87877
|
let path2 = action === "preview" ? `${base}/preview` : action === "draft" ? `/api/v1/recurring-consent-drafts/${row.draftId}` : action === "activate" ? `${base}/${row.draftId}/activate` : action === "list" ? base : `${base}/${row.consentId}${action === "get" ? "" : `/${action}`}`;
|
|
87494
87878
|
if (action === "list" || action === "occurrences") {
|
|
87495
87879
|
const query = new URLSearchParams;
|
|
@@ -87500,7 +87884,7 @@ function recurringRequest(action, input2) {
|
|
|
87500
87884
|
if (query.size)
|
|
87501
87885
|
path2 += `?${query}`;
|
|
87502
87886
|
}
|
|
87503
|
-
return { path: path2, read:
|
|
87887
|
+
return { path: path2, read: read3, method: read3 ? "GET" : "POST", body: read3 ? undefined : JSON.stringify(action === "preview" ? input2 : action === "activate" ? row.approval : { contractVersion: 1 }) };
|
|
87504
87888
|
}
|
|
87505
87889
|
var budget = exports_external2.object({ reservedCredits: integer2, settledCredits: integer2, admittedOccurrences: integer2 });
|
|
87506
87890
|
var period = exports_external2.object({ startsAt: instant2, endsAt: instant2 });
|
|
@@ -88232,10 +88616,10 @@ async function readQuoteUnavailableCode(response) {
|
|
|
88232
88616
|
let timer;
|
|
88233
88617
|
let deadlineExceeded = false;
|
|
88234
88618
|
const expired = Symbol("quote body deadline");
|
|
88235
|
-
const deadline = new Promise((
|
|
88619
|
+
const deadline = new Promise((resolve19) => {
|
|
88236
88620
|
timer = setTimeout(() => {
|
|
88237
88621
|
deadlineExceeded = true;
|
|
88238
|
-
|
|
88622
|
+
resolve19(expired);
|
|
88239
88623
|
reader.cancel().catch(() => {});
|
|
88240
88624
|
}, 1500);
|
|
88241
88625
|
});
|
|
@@ -88761,24 +89145,24 @@ class RemoteSkillsClient {
|
|
|
88761
89145
|
const identity3 = parseWorkspaceIdentity(identityValue, target.userId);
|
|
88762
89146
|
if (identity3.user.membershipId !== target.membershipId)
|
|
88763
89147
|
throw new WorkspaceIdentityMismatchError;
|
|
88764
|
-
const request2 = invitationRequest(action, captured),
|
|
89148
|
+
const request2 = invitationRequest(action, captured), read3 = action === "list" || action === "get";
|
|
88765
89149
|
let response, value;
|
|
88766
89150
|
try {
|
|
88767
89151
|
response = await connection.request(request2.path, { method: request2.method, ...request2.body ? { body: request2.body } : {}, credentials: "omit" });
|
|
88768
89152
|
value = JSON.parse(new TextDecoder().decode(await readBoundedResponse(response, response.ok ? 64 * 1024 : 4096)));
|
|
88769
89153
|
} catch {
|
|
88770
|
-
throw
|
|
89154
|
+
throw read3 ? new RemoteWorkspaceInvitationReadError : new RemoteWorkspaceInvitationUnconfirmedError;
|
|
88771
89155
|
}
|
|
88772
89156
|
if (!response.ok) {
|
|
88773
89157
|
const code = invitationFailure(value, response.status);
|
|
88774
89158
|
if (code)
|
|
88775
89159
|
throw new RemoteWorkspaceInvitationError(code);
|
|
88776
|
-
throw
|
|
89160
|
+
throw read3 ? new RemoteWorkspaceInvitationReadError : new RemoteWorkspaceInvitationUnconfirmedError;
|
|
88777
89161
|
}
|
|
88778
89162
|
try {
|
|
88779
89163
|
return parseInvitationResult(action, value, captured, identity3.organization.id);
|
|
88780
89164
|
} catch {
|
|
88781
|
-
throw
|
|
89165
|
+
throw read3 ? new RemoteWorkspaceInvitationReadError : new RemoteWorkspaceInvitationUnconfirmedError;
|
|
88782
89166
|
}
|
|
88783
89167
|
}
|
|
88784
89168
|
previewRecurringConsent(request2, context) {
|
|
@@ -89708,12 +90092,12 @@ class RemotePrivatePublicationsClient {
|
|
|
89708
90092
|
previous = view;
|
|
89709
90093
|
if (!["queued", "verifying"].includes(view.state) || Date.now() >= until)
|
|
89710
90094
|
return view;
|
|
89711
|
-
await new Promise((
|
|
90095
|
+
await new Promise((resolve19) => {
|
|
89712
90096
|
const timer = setTimeout(done, Math.min(1000, until - Date.now()));
|
|
89713
90097
|
function done() {
|
|
89714
90098
|
clearTimeout(timer);
|
|
89715
90099
|
options.signal?.removeEventListener("abort", done);
|
|
89716
|
-
|
|
90100
|
+
resolve19();
|
|
89717
90101
|
}
|
|
89718
90102
|
options.signal?.addEventListener("abort", done, { once: true });
|
|
89719
90103
|
});
|
|
@@ -89945,23 +90329,23 @@ class RemoteSkillsAuthClient {
|
|
|
89945
90329
|
}
|
|
89946
90330
|
}
|
|
89947
90331
|
// src/lib/private-publication-recovery.ts
|
|
89948
|
-
import { constants as constants13, closeSync as closeSync17, fsyncSync as fsyncSync5, fstatSync as fstatSync17, lstatSync as
|
|
89949
|
-
import { dirname as
|
|
90332
|
+
import { constants as constants13, closeSync as closeSync17, fsyncSync as fsyncSync5, fstatSync as fstatSync17, lstatSync as lstatSync22, mkdirSync as mkdirSync14, openSync as openSync17, readSync as readSync12, realpathSync as realpathSync9, renameSync as renameSync6, unlinkSync as unlinkSync5, writeFileSync as writeFileSync10 } from "fs";
|
|
90333
|
+
import { dirname as dirname25, isAbsolute as isAbsolute18, join as join37, resolve as resolve19 } from "path";
|
|
89950
90334
|
import { randomUUID as randomUUID11 } from "crypto";
|
|
89951
90335
|
var fail = () => {
|
|
89952
90336
|
throw new PrivatePublicationError("PUBLICATION_RECOVERY_INVALID", "The recovery directory is invalid or changed. Preserve it and inspect the existing intent; do not start a replacement automatically.");
|
|
89953
90337
|
};
|
|
89954
90338
|
function safeDirectory(directory) {
|
|
89955
|
-
if (!isAbsolute18(directory) || directory !==
|
|
90339
|
+
if (!isAbsolute18(directory) || directory !== resolve19(directory) || realpathSync9(directory) !== directory)
|
|
89956
90340
|
return fail();
|
|
89957
|
-
for (let path2 = directory;; path2 =
|
|
89958
|
-
const stat2 =
|
|
90341
|
+
for (let path2 = directory;; path2 = dirname25(path2)) {
|
|
90342
|
+
const stat2 = lstatSync22(path2);
|
|
89959
90343
|
if (!stat2.isDirectory() || stat2.isSymbolicLink())
|
|
89960
90344
|
return fail();
|
|
89961
|
-
if (path2 ===
|
|
90345
|
+
if (path2 === dirname25(path2))
|
|
89962
90346
|
break;
|
|
89963
90347
|
}
|
|
89964
|
-
const own2 =
|
|
90348
|
+
const own2 = lstatSync22(directory);
|
|
89965
90349
|
if ((own2.mode & 63) !== 0 || process.getuid && own2.uid !== process.getuid())
|
|
89966
90350
|
return fail();
|
|
89967
90351
|
return { dev: own2.dev, ino: own2.ino };
|
|
@@ -89972,7 +90356,7 @@ function unchangedDirectory(directory, identity3) {
|
|
|
89972
90356
|
return fail();
|
|
89973
90357
|
}
|
|
89974
90358
|
function readOwned(directory, name, max) {
|
|
89975
|
-
const identity3 = safeDirectory(directory), file2 =
|
|
90359
|
+
const identity3 = safeDirectory(directory), file2 = join37(directory, name);
|
|
89976
90360
|
const fd = openSync17(file2, constants13.O_RDONLY | constants13.O_NOFOLLOW);
|
|
89977
90361
|
try {
|
|
89978
90362
|
const stat2 = fstatSync17(fd);
|
|
@@ -89996,7 +90380,7 @@ function readOwned(directory, name, max) {
|
|
|
89996
90380
|
}
|
|
89997
90381
|
}
|
|
89998
90382
|
function writeOwned(directory, name, bytes) {
|
|
89999
|
-
const fd = openSync17(
|
|
90383
|
+
const fd = openSync17(join37(directory, name), constants13.O_WRONLY | constants13.O_CREAT | constants13.O_EXCL | constants13.O_NOFOLLOW, 384);
|
|
90000
90384
|
try {
|
|
90001
90385
|
writeFileSync10(fd, bytes);
|
|
90002
90386
|
fsyncSync5(fd);
|
|
@@ -90009,7 +90393,7 @@ function save(directory, value) {
|
|
|
90009
90393
|
writeOwned(directory, temporary, JSON.stringify(value) + `
|
|
90010
90394
|
`);
|
|
90011
90395
|
unchangedDirectory(directory, identity3);
|
|
90012
|
-
renameSync6(
|
|
90396
|
+
renameSync6(join37(directory, temporary), join37(directory, "receipt.json"));
|
|
90013
90397
|
const fd = openSync17(directory, constants13.O_RDONLY | constants13.O_NOFOLLOW);
|
|
90014
90398
|
try {
|
|
90015
90399
|
fsyncSync5(fd);
|
|
@@ -90022,7 +90406,7 @@ function bind(client2, receipt) {
|
|
|
90022
90406
|
throw new PrivatePublicationError("PUBLICATION_IDENTITY_CHANGED", "The fresh session does not match the recovery directory's server, account and membership.");
|
|
90023
90407
|
}
|
|
90024
90408
|
async function locked(directory, action) {
|
|
90025
|
-
const identity3 = safeDirectory(directory), file2 =
|
|
90409
|
+
const identity3 = safeDirectory(directory), file2 = join37(directory, "operation.lock");
|
|
90026
90410
|
let fd;
|
|
90027
90411
|
try {
|
|
90028
90412
|
fd = openSync17(file2, constants13.O_WRONLY | constants13.O_CREAT | constants13.O_EXCL | constants13.O_NOFOLLOW, 384);
|
|
@@ -90038,7 +90422,7 @@ async function locked(directory, action) {
|
|
|
90038
90422
|
} finally {
|
|
90039
90423
|
closeSync17(fd);
|
|
90040
90424
|
unchangedDirectory(directory, identity3);
|
|
90041
|
-
const now2 =
|
|
90425
|
+
const now2 = lstatSync22(file2);
|
|
90042
90426
|
if (now2.dev !== lock.dev || now2.ino !== lock.ino || !now2.isFile() || now2.isSymbolicLink())
|
|
90043
90427
|
fail();
|
|
90044
90428
|
unlinkSync5(file2);
|
|
@@ -90090,11 +90474,11 @@ async function preparePrivatePublication(client2, sourceDirectory, recoveryDirec
|
|
|
90090
90474
|
phase: "prepared",
|
|
90091
90475
|
intent: null
|
|
90092
90476
|
};
|
|
90093
|
-
if (!isAbsolute18(recoveryDirectory) ||
|
|
90477
|
+
if (!isAbsolute18(recoveryDirectory) || resolve19(recoveryDirectory) !== recoveryDirectory || realpathSync9(dirname25(recoveryDirectory)) !== dirname25(recoveryDirectory))
|
|
90094
90478
|
return fail();
|
|
90095
90479
|
mkdirSync14(recoveryDirectory, { mode: 448 });
|
|
90096
90480
|
safeDirectory(recoveryDirectory);
|
|
90097
|
-
const parent = openSync17(
|
|
90481
|
+
const parent = openSync17(dirname25(recoveryDirectory), constants13.O_RDONLY | constants13.O_NOFOLLOW);
|
|
90098
90482
|
try {
|
|
90099
90483
|
fsyncSync5(parent);
|
|
90100
90484
|
} finally {
|