@hasna/skills 0.5.4 → 0.5.5
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 +72 -7
- package/bin/index.js +1875 -595
- package/bin/mcp.js +1780 -328
- package/bin/migrate.js +176 -4
- package/bin/server.js +300 -76
- package/bin/worker.js +294 -103
- package/dist/admin-contract.js +166 -168
- package/dist/cli/commands/private-publications.d.ts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1059 -410
- package/dist/lib/fleet-credentials.d.ts +6 -1
- package/dist/lib/home-adoption.d.ts +2 -7
- package/dist/lib/mcp-contracts.d.ts +1 -0
- package/dist/lib/private-publication-customer.d.ts +10 -0
- package/dist/lib/private-publication-recovery.d.ts +43 -0
- package/dist/lib/remote-account.d.ts +5 -0
- package/dist/lib/remote-auth.d.ts +3 -0
- package/dist/lib/remote-client.d.ts +2 -2
- package/dist/lib/remote-private-publications.d.ts +74 -0
- package/dist/mcp/private-publication-tools.d.ts +2 -0
- package/dist/sdk/execution/dispatchers/ecs.d.ts +25 -14
- package/dist/sdk/index.d.ts +2 -0
- package/dist/sdk/index.js +1137 -463
- package/dist/server/types.d.ts +2 -0
- package/dist/storage.js +33 -35
- package/package.json +1 -1
package/dist/sdk/index.js
CHANGED
|
@@ -19,14 +19,12 @@ var __toESM = (mod, isNodeMode, target) => {
|
|
|
19
19
|
}
|
|
20
20
|
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
21
21
|
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
});
|
|
29
|
-
}
|
|
22
|
+
for (let key of __getOwnPropNames(mod))
|
|
23
|
+
if (!__hasOwnProp.call(to, key))
|
|
24
|
+
__defProp(to, key, {
|
|
25
|
+
get: __accessProp.bind(mod, key),
|
|
26
|
+
enumerable: true
|
|
27
|
+
});
|
|
30
28
|
if (canCache)
|
|
31
29
|
cache.set(mod, to);
|
|
32
30
|
return to;
|
|
@@ -49,7 +47,7 @@ var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
|
49
47
|
var __require = import.meta.require;
|
|
50
48
|
|
|
51
49
|
// ../../node_modules/.bun/@smithy+types@4.18.0/node_modules/@smithy/types/dist-cjs/index.js
|
|
52
|
-
var require_dist_cjs = __commonJS(
|
|
50
|
+
var require_dist_cjs = __commonJS((exports) => {
|
|
53
51
|
var HttpAuthLocation;
|
|
54
52
|
(function(HttpAuthLocation2) {
|
|
55
53
|
HttpAuthLocation2["HEADER"] = "header";
|
|
@@ -140,7 +138,7 @@ var require_dist_cjs = __commonJS(function(exports) {
|
|
|
140
138
|
});
|
|
141
139
|
|
|
142
140
|
// ../../node_modules/.bun/@smithy+core@3.33.3/node_modules/@smithy/core/dist-cjs/submodules/transport/index.js
|
|
143
|
-
var require_transport = __commonJS(
|
|
141
|
+
var require_transport = __commonJS((exports) => {
|
|
144
142
|
var { SMITHY_CONTEXT_KEY } = require_dist_cjs();
|
|
145
143
|
var getSmithyContext = (context) => context[SMITHY_CONTEXT_KEY] || (context[SMITHY_CONTEXT_KEY] = {});
|
|
146
144
|
function hasOwn2(o, k) {
|
|
@@ -313,7 +311,7 @@ var require_transport = __commonJS(function(exports) {
|
|
|
313
311
|
});
|
|
314
312
|
|
|
315
313
|
// ../../node_modules/.bun/@smithy+core@3.33.3/node_modules/@smithy/core/dist-cjs/submodules/schema/index.js
|
|
316
|
-
var require_schema = __commonJS(
|
|
314
|
+
var require_schema = __commonJS((exports) => {
|
|
317
315
|
var { getSmithyContext, HttpResponse, toEndpointV1 } = require_transport();
|
|
318
316
|
var deref = (schemaRef) => {
|
|
319
317
|
if (typeof schemaRef === "function") {
|
|
@@ -982,7 +980,7 @@ var require_schema = __commonJS(function(exports) {
|
|
|
982
980
|
});
|
|
983
981
|
|
|
984
982
|
// ../../node_modules/.bun/@smithy+core@3.33.3/node_modules/@smithy/core/dist-cjs/submodules/client/index.js
|
|
985
|
-
var require_client = __commonJS(
|
|
983
|
+
var require_client = __commonJS((exports) => {
|
|
986
984
|
var { hasOwn: hasOwn2 } = require_transport();
|
|
987
985
|
var { getSmithyContext, normalizeProvider } = require_transport();
|
|
988
986
|
exports.getSmithyContext = getSmithyContext;
|
|
@@ -2062,7 +2060,7 @@ var require_client = __commonJS(function(exports) {
|
|
|
2062
2060
|
});
|
|
2063
2061
|
|
|
2064
2062
|
// ../../node_modules/.bun/@smithy+core@3.33.3/node_modules/@smithy/core/dist-cjs/submodules/config/index.js
|
|
2065
|
-
var require_config = __commonJS(
|
|
2063
|
+
var require_config = __commonJS((exports) => {
|
|
2066
2064
|
var { homedir } = __require("os");
|
|
2067
2065
|
var { sep, join: join3 } = __require("path");
|
|
2068
2066
|
var { createHash: createHash2 } = __require("crypto");
|
|
@@ -2757,7 +2755,7 @@ var require_config = __commonJS(function(exports) {
|
|
|
2757
2755
|
});
|
|
2758
2756
|
|
|
2759
2757
|
// ../../node_modules/.bun/@smithy+core@3.33.3/node_modules/@smithy/core/dist-cjs/submodules/endpoints/index.js
|
|
2760
|
-
var require_endpoints = __commonJS(
|
|
2758
|
+
var require_endpoints = __commonJS((exports) => {
|
|
2761
2759
|
var { CONFIG_PREFIX_SEPARATOR, booleanSelector, SelectorType, loadConfig } = require_config();
|
|
2762
2760
|
var { toEndpointV1, getSmithyContext, normalizeProvider, isValidHostLabel, hasOwn: hasOwn2 } = require_transport();
|
|
2763
2761
|
exports.isValidHostLabel = isValidHostLabel;
|
|
@@ -3571,7 +3569,7 @@ var require_endpoints = __commonJS(function(exports) {
|
|
|
3571
3569
|
});
|
|
3572
3570
|
|
|
3573
3571
|
// ../../node_modules/.bun/@smithy+core@3.33.3/node_modules/@smithy/core/dist-cjs/submodules/serde/index.js
|
|
3574
|
-
var require_serde = __commonJS(
|
|
3572
|
+
var require_serde = __commonJS((exports) => {
|
|
3575
3573
|
var { createHmac: createHmac2, createHash: createHash2, getRandomValues } = __require("crypto");
|
|
3576
3574
|
var { hasOwn: hasOwn2, HttpResponse } = require_transport();
|
|
3577
3575
|
exports.hasOwn = hasOwn2;
|
|
@@ -5212,7 +5210,7 @@ ${value}\r
|
|
|
5212
5210
|
});
|
|
5213
5211
|
|
|
5214
5212
|
// ../../node_modules/.bun/@smithy+core@3.33.3/node_modules/@smithy/core/dist-cjs/submodules/checksum/index.js
|
|
5215
|
-
var require_checksum = __commonJS(
|
|
5213
|
+
var require_checksum = __commonJS((exports) => {
|
|
5216
5214
|
var { createReadStream } = __require("fs");
|
|
5217
5215
|
var { Writable } = __require("stream");
|
|
5218
5216
|
var { toUint8Array, concatBytes } = require_serde();
|
|
@@ -5828,7 +5826,7 @@ var require_checksum = __commonJS(function(exports) {
|
|
|
5828
5826
|
});
|
|
5829
5827
|
|
|
5830
5828
|
// ../../node_modules/.bun/@smithy+core@3.33.3/node_modules/@smithy/core/dist-cjs/submodules/event-streams/index.js
|
|
5831
|
-
var require_event_streams = __commonJS(
|
|
5829
|
+
var require_event_streams = __commonJS((exports) => {
|
|
5832
5830
|
var { Crc32 } = require_checksum();
|
|
5833
5831
|
var { hasOwn: hasOwn2 } = require_transport();
|
|
5834
5832
|
var { toHex, fromHex, toUtf8, fromUtf8 } = require_serde();
|
|
@@ -6720,7 +6718,7 @@ var require_event_streams = __commonJS(function(exports) {
|
|
|
6720
6718
|
});
|
|
6721
6719
|
|
|
6722
6720
|
// ../../node_modules/.bun/@smithy+core@3.33.3/node_modules/@smithy/core/dist-cjs/submodules/protocols/index.js
|
|
6723
|
-
var require_protocols = __commonJS(
|
|
6721
|
+
var require_protocols = __commonJS((exports) => {
|
|
6724
6722
|
var { Uint8ArrayBlobAdapter, sdkStreamMixin, splitEvery, splitHeader, fromBase64, _parseEpochTimestamp, _parseRfc7231DateTime, _parseRfc3339DateTimeWithOffset, LazyJsonString, NumericValue, toUtf8, fromUtf8, generateIdempotencyToken, toBase64, dateToUtcString, quoteHeader } = require_serde();
|
|
6725
6723
|
var { HttpRequest, HttpResponse, hasOwn: hasOwn2, isValidHostname } = require_transport();
|
|
6726
6724
|
var { parseQueryString, parseUrl } = require_transport();
|
|
@@ -7724,7 +7722,7 @@ var require_protocols = __commonJS(function(exports) {
|
|
|
7724
7722
|
});
|
|
7725
7723
|
|
|
7726
7724
|
// ../../node_modules/.bun/@smithy+core@3.33.3/node_modules/@smithy/core/dist-cjs/submodules/retry/index.js
|
|
7727
|
-
var require_retry = __commonJS(
|
|
7725
|
+
var require_retry = __commonJS((exports) => {
|
|
7728
7726
|
var { Readable } = __require("stream");
|
|
7729
7727
|
var { NoOpLogger, normalizeProvider } = require_client();
|
|
7730
7728
|
var { HttpResponse, HttpRequest } = require_protocols();
|
|
@@ -8524,7 +8522,7 @@ var require_retry = __commonJS(function(exports) {
|
|
|
8524
8522
|
});
|
|
8525
8523
|
|
|
8526
8524
|
// ../../node_modules/.bun/@aws+lambda-invoke-store@0.3.0/node_modules/@aws/lambda-invoke-store/dist-cjs/invoke-store.js
|
|
8527
|
-
var require_invoke_store = __commonJS(
|
|
8525
|
+
var require_invoke_store = __commonJS((exports) => {
|
|
8528
8526
|
var PROTECTED_KEYS = {
|
|
8529
8527
|
REQUEST_ID: Symbol.for("_AWS_LAMBDA_REQUEST_ID"),
|
|
8530
8528
|
X_RAY_TRACE_ID: Symbol.for("_AWS_LAMBDA_X_RAY_TRACE_ID"),
|
|
@@ -8653,7 +8651,7 @@ var require_invoke_store = __commonJS(function(exports) {
|
|
|
8653
8651
|
});
|
|
8654
8652
|
|
|
8655
8653
|
// ../../node_modules/.bun/@smithy+core@3.33.3/node_modules/@smithy/core/dist-cjs/index.js
|
|
8656
|
-
var require_dist_cjs2 = __commonJS(
|
|
8654
|
+
var require_dist_cjs2 = __commonJS((exports) => {
|
|
8657
8655
|
var { getSmithyContext, hasOwn: hasOwn2 } = require_transport();
|
|
8658
8656
|
exports.getSmithyContext = getSmithyContext;
|
|
8659
8657
|
var { HttpRequest } = require_protocols();
|
|
@@ -8981,7 +8979,7 @@ var require_dist_cjs2 = __commonJS(function(exports) {
|
|
|
8981
8979
|
});
|
|
8982
8980
|
|
|
8983
8981
|
// ../../node_modules/.bun/bowser@2.14.1/node_modules/bowser/es5.js
|
|
8984
|
-
var require_es5 = __commonJS(
|
|
8982
|
+
var require_es5 = __commonJS((exports, module) => {
|
|
8985
8983
|
(function(e, t) {
|
|
8986
8984
|
typeof exports == "object" && typeof module == "object" ? module.exports = t() : typeof define == "function" && define.amd ? define([], t) : typeof exports == "object" ? exports.bowser = t() : e.bowser = t();
|
|
8987
8985
|
})(exports, function() {
|
|
@@ -9821,7 +9819,7 @@ var require_es5 = __commonJS(function(exports, module) {
|
|
|
9821
9819
|
});
|
|
9822
9820
|
|
|
9823
9821
|
// ../../node_modules/.bun/@aws-sdk+core@3.977.9/node_modules/@aws-sdk/core/dist-cjs/submodules/client/index.js
|
|
9824
|
-
var require_client2 = __commonJS(
|
|
9822
|
+
var require_client2 = __commonJS((exports) => {
|
|
9825
9823
|
var { Retry, RETRY_MODES } = require_retry();
|
|
9826
9824
|
var { HttpRequest, parseUrl } = require_protocols();
|
|
9827
9825
|
var { InvokeStore } = require_invoke_store();
|
|
@@ -10759,7 +10757,7 @@ More information can be found at: https://a.co/c895JFp`);
|
|
|
10759
10757
|
});
|
|
10760
10758
|
|
|
10761
10759
|
// ../../node_modules/.bun/@aws-sdk+checksums@3.1000.29/node_modules/@aws-sdk/checksums/dist-cjs/submodules/crc/index.js
|
|
10762
|
-
var require_crc = __commonJS(
|
|
10760
|
+
var require_crc = __commonJS((exports) => {
|
|
10763
10761
|
var { Crc32, Crc32Js, Crc32Node } = require_checksum();
|
|
10764
10762
|
exports.Crc32 = Crc32;
|
|
10765
10763
|
exports.Crc32Js = Crc32Js;
|
|
@@ -10916,7 +10914,7 @@ var require_crc = __commonJS(function(exports) {
|
|
|
10916
10914
|
});
|
|
10917
10915
|
|
|
10918
10916
|
// ../../node_modules/.bun/@smithy+signature-v4@5.7.3/node_modules/@smithy/signature-v4/dist-cjs/index.js
|
|
10919
|
-
var require_dist_cjs3 = __commonJS(
|
|
10917
|
+
var require_dist_cjs3 = __commonJS((exports) => {
|
|
10920
10918
|
var { hasOwn: hasOwn2, fromUtf8, fromHex, toHex, toUint8Array: toUint8Array2, isArrayBuffer: isArrayBuffer2 } = require_serde();
|
|
10921
10919
|
var { normalizeProvider: normalizeProvider2 } = require_client();
|
|
10922
10920
|
var { escapeUri, HttpRequest: HttpRequest2 } = require_protocols();
|
|
@@ -11468,7 +11466,7 @@ ${toHex(hashedRequest)}`;
|
|
|
11468
11466
|
});
|
|
11469
11467
|
|
|
11470
11468
|
// ../../node_modules/.bun/@aws-sdk+signature-v4-multi-region@3.996.46/node_modules/@aws-sdk/signature-v4-multi-region/dist-cjs/index.js
|
|
11471
|
-
var require_dist_cjs4 = __commonJS(
|
|
11469
|
+
var require_dist_cjs4 = __commonJS((exports) => {
|
|
11472
11470
|
var { SignatureV4, signatureV4aContainer } = require_dist_cjs3();
|
|
11473
11471
|
var signatureV4CrtContainer = {
|
|
11474
11472
|
CrtSignerV4: null
|
|
@@ -11600,7 +11598,7 @@ var require_dist_cjs4 = __commonJS(function(exports) {
|
|
|
11600
11598
|
});
|
|
11601
11599
|
|
|
11602
11600
|
// ../../node_modules/.bun/@aws-sdk+core@3.977.9/node_modules/@aws-sdk/core/dist-cjs/submodules/util/index.js
|
|
11603
|
-
var require_util = __commonJS(
|
|
11601
|
+
var require_util = __commonJS((exports) => {
|
|
11604
11602
|
var { buildQueryString } = require_protocols();
|
|
11605
11603
|
var validate = (str) => typeof str === "string" && str.indexOf("arn:") === 0 && str.split(":").length >= 6;
|
|
11606
11604
|
var parse = (arn) => {
|
|
@@ -11658,7 +11656,7 @@ var require_util = __commonJS(function(exports) {
|
|
|
11658
11656
|
});
|
|
11659
11657
|
|
|
11660
11658
|
// ../../node_modules/.bun/@smithy+core@3.33.3/node_modules/@smithy/core/dist-cjs/submodules/cbor/index.js
|
|
11661
|
-
var require_cbor = __commonJS(
|
|
11659
|
+
var require_cbor = __commonJS((exports) => {
|
|
11662
11660
|
var { nv, NumericValue, calculateBodyLength, generateIdempotencyToken, fromBase64, _parseEpochTimestamp } = require_serde();
|
|
11663
11661
|
var { hasOwn: hasOwn2, getSmithyContext } = require_transport();
|
|
11664
11662
|
var { HttpRequest: HttpRequest2, collectBody, SerdeContext, RpcProtocol } = require_protocols();
|
|
@@ -14108,7 +14106,7 @@ var require_cbor = __commonJS(function(exports) {
|
|
|
14108
14106
|
});
|
|
14109
14107
|
|
|
14110
14108
|
// ../../node_modules/.bun/@aws-sdk+xml-builder@3.972.40/node_modules/@aws-sdk/xml-builder/dist-cjs/index.js
|
|
14111
|
-
var require_dist_cjs5 = __commonJS(
|
|
14109
|
+
var require_dist_cjs5 = __commonJS((exports) => {
|
|
14112
14110
|
var ATTR_ESCAPE_RE = /[&<>"]/g;
|
|
14113
14111
|
var ATTR_ESCAPE_MAP = {
|
|
14114
14112
|
"&": "&",
|
|
@@ -14476,7 +14474,7 @@ var require_dist_cjs5 = __commonJS(function(exports) {
|
|
|
14476
14474
|
});
|
|
14477
14475
|
|
|
14478
14476
|
// ../../node_modules/.bun/@aws-sdk+core@3.977.9/node_modules/@aws-sdk/core/dist-cjs/submodules/protocols/index.js
|
|
14479
|
-
var require_protocols2 = __commonJS(
|
|
14477
|
+
var require_protocols2 = __commonJS((exports) => {
|
|
14480
14478
|
var { SmithyRpcV2CborProtocol, loadSmithyRpcV2CborErrorCode } = require_cbor();
|
|
14481
14479
|
var { TypeRegistry, NormalizedSchema, deref } = require_schema();
|
|
14482
14480
|
var { decorateServiceException, getValueFromTextNode } = require_client();
|
|
@@ -17317,7 +17315,7 @@ var require_protocols2 = __commonJS(function(exports) {
|
|
|
17317
17315
|
});
|
|
17318
17316
|
|
|
17319
17317
|
// ../../node_modules/.bun/@aws-sdk+core@3.977.9/node_modules/@aws-sdk/core/dist-cjs/submodules/httpAuthSchemes/index.js
|
|
17320
|
-
var require_httpAuthSchemes = __commonJS(
|
|
17318
|
+
var require_httpAuthSchemes = __commonJS((exports) => {
|
|
17321
17319
|
var { ProviderError, booleanSelector: booleanSelector2, SelectorType: SelectorType3, loadConfig } = require_config();
|
|
17322
17320
|
var { setCredentialFeature } = require_client2();
|
|
17323
17321
|
var { normalizeProvider: normalizeProvider2, memoizeIdentityProvider, isIdentityExpired, doesIdentityRequireRefresh } = require_dist_cjs2();
|
|
@@ -17677,13 +17675,13 @@ var init_fromEnv = __esm(() => {
|
|
|
17677
17675
|
// ../../node_modules/.bun/@aws-sdk+credential-provider-env@3.972.70/node_modules/@aws-sdk/credential-provider-env/dist-es/index.js
|
|
17678
17676
|
var exports_dist_es = {};
|
|
17679
17677
|
__export(exports_dist_es, {
|
|
17680
|
-
|
|
17681
|
-
ENV_CREDENTIAL_SCOPE: () => ENV_CREDENTIAL_SCOPE,
|
|
17682
|
-
ENV_EXPIRATION: () => ENV_EXPIRATION,
|
|
17683
|
-
ENV_KEY: () => ENV_KEY,
|
|
17684
|
-
ENV_SECRET: () => ENV_SECRET,
|
|
17678
|
+
fromEnv: () => fromEnv,
|
|
17685
17679
|
ENV_SESSION: () => ENV_SESSION,
|
|
17686
|
-
|
|
17680
|
+
ENV_SECRET: () => ENV_SECRET,
|
|
17681
|
+
ENV_KEY: () => ENV_KEY,
|
|
17682
|
+
ENV_EXPIRATION: () => ENV_EXPIRATION,
|
|
17683
|
+
ENV_CREDENTIAL_SCOPE: () => ENV_CREDENTIAL_SCOPE,
|
|
17684
|
+
ENV_ACCOUNT_ID: () => ENV_ACCOUNT_ID
|
|
17687
17685
|
});
|
|
17688
17686
|
var init_dist_es = __esm(() => {
|
|
17689
17687
|
init_fromEnv();
|
|
@@ -18067,17 +18065,17 @@ var init_fromInstanceMetadata = __esm(() => {
|
|
|
18067
18065
|
// ../../node_modules/.bun/@smithy+credential-provider-imds@4.5.2/node_modules/@smithy/credential-provider-imds/dist-es/index.js
|
|
18068
18066
|
var exports_dist_es2 = {};
|
|
18069
18067
|
__export(exports_dist_es2, {
|
|
18070
|
-
|
|
18071
|
-
DEFAULT_TIMEOUT: () => DEFAULT_TIMEOUT,
|
|
18072
|
-
ENV_CMDS_AUTH_TOKEN: () => ENV_CMDS_AUTH_TOKEN,
|
|
18073
|
-
ENV_CMDS_FULL_URI: () => ENV_CMDS_FULL_URI,
|
|
18074
|
-
ENV_CMDS_RELATIVE_URI: () => ENV_CMDS_RELATIVE_URI,
|
|
18075
|
-
Endpoint: () => Endpoint,
|
|
18076
|
-
fromContainerMetadata: () => fromContainerMetadata,
|
|
18077
|
-
fromInstanceMetadata: () => fromInstanceMetadata,
|
|
18078
|
-
getInstanceMetadataEndpoint: () => getInstanceMetadataEndpoint,
|
|
18068
|
+
providerConfigFromInit: () => providerConfigFromInit,
|
|
18079
18069
|
httpRequest: () => httpRequest,
|
|
18080
|
-
|
|
18070
|
+
getInstanceMetadataEndpoint: () => getInstanceMetadataEndpoint,
|
|
18071
|
+
fromInstanceMetadata: () => fromInstanceMetadata,
|
|
18072
|
+
fromContainerMetadata: () => fromContainerMetadata,
|
|
18073
|
+
Endpoint: () => Endpoint,
|
|
18074
|
+
ENV_CMDS_RELATIVE_URI: () => ENV_CMDS_RELATIVE_URI,
|
|
18075
|
+
ENV_CMDS_FULL_URI: () => ENV_CMDS_FULL_URI,
|
|
18076
|
+
ENV_CMDS_AUTH_TOKEN: () => ENV_CMDS_AUTH_TOKEN,
|
|
18077
|
+
DEFAULT_TIMEOUT: () => DEFAULT_TIMEOUT,
|
|
18078
|
+
DEFAULT_MAX_RETRIES: () => DEFAULT_MAX_RETRIES
|
|
18081
18079
|
});
|
|
18082
18080
|
var init_dist_es2 = __esm(() => {
|
|
18083
18081
|
init_fromContainerMetadata();
|
|
@@ -18088,7 +18086,7 @@ var init_dist_es2 = __esm(() => {
|
|
|
18088
18086
|
});
|
|
18089
18087
|
|
|
18090
18088
|
// ../../node_modules/.bun/@smithy+node-http-handler@4.12.1/node_modules/@smithy/node-http-handler/dist-cjs/index.js
|
|
18091
|
-
var require_dist_cjs6 = __commonJS(
|
|
18089
|
+
var require_dist_cjs6 = __commonJS((exports) => {
|
|
18092
18090
|
var { hasOwn: hasOwn2 } = require_serde();
|
|
18093
18091
|
var { streamCollector } = require_serde();
|
|
18094
18092
|
exports.streamCollector = streamCollector;
|
|
@@ -19095,7 +19093,7 @@ var init_constants = __esm(() => {
|
|
|
19095
19093
|
});
|
|
19096
19094
|
|
|
19097
19095
|
// ../../node_modules/.bun/@aws-sdk+nested-clients@3.997.44/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso-oidc/index.js
|
|
19098
|
-
var require_sso_oidc = __commonJS(
|
|
19096
|
+
var require_sso_oidc = __commonJS((exports) => {
|
|
19099
19097
|
var { awsEndpointFunctions: awsEndpointFunctions2, emitWarningIfUnsupportedVersion: emitWarningIfUnsupportedVersion$1, createDefaultUserAgentProvider, NODE_APP_ID_CONFIG_OPTIONS, getAwsRegionExtensionConfiguration, resolveAwsRegionExtensionConfiguration, resolveUserAgentConfig, resolveHostHeaderConfig, getUserAgentPlugin, getHostHeaderPlugin, getLoggerPlugin, getRecursionDetectionPlugin } = require_client2();
|
|
19100
19098
|
var { NoAuthSigner, getHttpAuthSchemeEndpointRuleSetPlugin, DefaultIdentityProviderConfig, getHttpSigningPlugin } = require_dist_cjs2();
|
|
19101
19099
|
var { normalizeProvider: normalizeProvider3, getSmithyContext: getSmithyContext3, ServiceException, NoOpLogger: NoOpLogger2, emitWarningIfUnsupportedVersion, loadConfigsForDefaultMode, getDefaultExtensionConfiguration, resolveDefaultRuntimeConfig, Client, makeBuilder: makeBuilder2, createAggregatedClient } = require_client();
|
|
@@ -20447,8 +20445,8 @@ var init_sso = __esm(() => {
|
|
|
20447
20445
|
// ../../node_modules/.bun/@aws-sdk+credential-provider-sso@3.973.14/node_modules/@aws-sdk/credential-provider-sso/dist-es/loadSso.js
|
|
20448
20446
|
var exports_loadSso = {};
|
|
20449
20447
|
__export(exports_loadSso, {
|
|
20450
|
-
|
|
20451
|
-
|
|
20448
|
+
SSOClient: () => $SSOClient,
|
|
20449
|
+
GetRoleCredentialsCommand: () => $GetRoleCredentialsCommand
|
|
20452
20450
|
});
|
|
20453
20451
|
var init_loadSso = __esm(() => {
|
|
20454
20452
|
init_sso();
|
|
@@ -20641,9 +20639,9 @@ var init_fromSSO = __esm(() => {
|
|
|
20641
20639
|
// ../../node_modules/.bun/@aws-sdk+credential-provider-sso@3.973.14/node_modules/@aws-sdk/credential-provider-sso/dist-es/index.js
|
|
20642
20640
|
var exports_dist_es4 = {};
|
|
20643
20641
|
__export(exports_dist_es4, {
|
|
20644
|
-
|
|
20642
|
+
validateSsoProfile: () => validateSsoProfile,
|
|
20645
20643
|
isSsoProfile: () => isSsoProfile,
|
|
20646
|
-
|
|
20644
|
+
fromSSO: () => fromSSO
|
|
20647
20645
|
});
|
|
20648
20646
|
var init_dist_es5 = __esm(() => {
|
|
20649
20647
|
init_fromSSO();
|
|
@@ -20682,7 +20680,7 @@ var init_resolveCredentialSource = __esm(() => {
|
|
|
20682
20680
|
});
|
|
20683
20681
|
|
|
20684
20682
|
// ../../node_modules/.bun/@aws-sdk+nested-clients@3.997.44/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sts/index.js
|
|
20685
|
-
var require_sts = __commonJS(
|
|
20683
|
+
var require_sts = __commonJS((exports) => {
|
|
20686
20684
|
var { awsEndpointFunctions: awsEndpointFunctions3, emitWarningIfUnsupportedVersion: emitWarningIfUnsupportedVersion$12, createDefaultUserAgentProvider: createDefaultUserAgentProvider2, NODE_APP_ID_CONFIG_OPTIONS: NODE_APP_ID_CONFIG_OPTIONS2, getAwsRegionExtensionConfiguration: getAwsRegionExtensionConfiguration2, resolveAwsRegionExtensionConfiguration: resolveAwsRegionExtensionConfiguration2, resolveUserAgentConfig: resolveUserAgentConfig2, resolveHostHeaderConfig: resolveHostHeaderConfig2, getUserAgentPlugin: getUserAgentPlugin2, getHostHeaderPlugin: getHostHeaderPlugin2, getLoggerPlugin: getLoggerPlugin2, getRecursionDetectionPlugin: getRecursionDetectionPlugin2, setCredentialFeature: setCredentialFeature5, stsRegionDefaultResolver } = require_client2();
|
|
20687
20685
|
var { NoAuthSigner: NoAuthSigner2, getHttpAuthSchemeEndpointRuleSetPlugin: getHttpAuthSchemeEndpointRuleSetPlugin2, DefaultIdentityProviderConfig: DefaultIdentityProviderConfig2, getHttpSigningPlugin: getHttpSigningPlugin2 } = require_dist_cjs2();
|
|
20688
20686
|
var { normalizeProvider: normalizeProvider4, getSmithyContext: getSmithyContext4, ServiceException: ServiceException2, NoOpLogger: NoOpLogger3, emitWarningIfUnsupportedVersion: emitWarningIfUnsupportedVersion2, loadConfigsForDefaultMode: loadConfigsForDefaultMode2, getDefaultExtensionConfiguration: getDefaultExtensionConfiguration2, resolveDefaultRuntimeConfig: resolveDefaultRuntimeConfig2, Client: Client2, makeBuilder: makeBuilder3, createAggregatedClient: createAggregatedClient2 } = require_client();
|
|
@@ -21772,7 +21770,7 @@ var init_resolveAssumeRoleCredentials = __esm(() => {
|
|
|
21772
21770
|
});
|
|
21773
21771
|
|
|
21774
21772
|
// ../../node_modules/.bun/@aws-sdk+nested-clients@3.997.44/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/signin/index.js
|
|
21775
|
-
var require_signin = __commonJS(
|
|
21773
|
+
var require_signin = __commonJS((exports) => {
|
|
21776
21774
|
var { awsEndpointFunctions: awsEndpointFunctions3, emitWarningIfUnsupportedVersion: emitWarningIfUnsupportedVersion$12, createDefaultUserAgentProvider: createDefaultUserAgentProvider2, NODE_APP_ID_CONFIG_OPTIONS: NODE_APP_ID_CONFIG_OPTIONS2, getAwsRegionExtensionConfiguration: getAwsRegionExtensionConfiguration2, resolveAwsRegionExtensionConfiguration: resolveAwsRegionExtensionConfiguration2, resolveUserAgentConfig: resolveUserAgentConfig2, resolveHostHeaderConfig: resolveHostHeaderConfig2, getUserAgentPlugin: getUserAgentPlugin2, getHostHeaderPlugin: getHostHeaderPlugin2, getLoggerPlugin: getLoggerPlugin2, getRecursionDetectionPlugin: getRecursionDetectionPlugin2 } = require_client2();
|
|
21777
21775
|
var { NoAuthSigner: NoAuthSigner2, getHttpAuthSchemeEndpointRuleSetPlugin: getHttpAuthSchemeEndpointRuleSetPlugin2, DefaultIdentityProviderConfig: DefaultIdentityProviderConfig2, getHttpSigningPlugin: getHttpSigningPlugin2 } = require_dist_cjs2();
|
|
21778
21776
|
var { normalizeProvider: normalizeProvider4, getSmithyContext: getSmithyContext4, ServiceException: ServiceException2, NoOpLogger: NoOpLogger3, emitWarningIfUnsupportedVersion: emitWarningIfUnsupportedVersion2, loadConfigsForDefaultMode: loadConfigsForDefaultMode2, getDefaultExtensionConfiguration: getDefaultExtensionConfiguration2, resolveDefaultRuntimeConfig: resolveDefaultRuntimeConfig2, Client: Client2, makeBuilder: makeBuilder3, createAggregatedClient: createAggregatedClient2 } = require_client();
|
|
@@ -23015,8 +23013,8 @@ var init_fromTokenFile = __esm(() => {
|
|
|
23015
23013
|
// ../../node_modules/.bun/@aws-sdk+credential-provider-web-identity@3.972.76/node_modules/@aws-sdk/credential-provider-web-identity/dist-es/index.js
|
|
23016
23014
|
var exports_dist_es7 = {};
|
|
23017
23015
|
__export(exports_dist_es7, {
|
|
23018
|
-
|
|
23019
|
-
|
|
23016
|
+
fromWebToken: () => fromWebToken,
|
|
23017
|
+
fromTokenFile: () => fromTokenFile
|
|
23020
23018
|
});
|
|
23021
23019
|
var init_dist_es8 = __esm(() => {
|
|
23022
23020
|
init_fromTokenFile();
|
|
@@ -25256,7 +25254,9 @@ function normalizeSkillsApiOrigin(apiUrl) {
|
|
|
25256
25254
|
throw new SkillsFleetCredentialError("A Skills API URL must use HTTPS (or loopback HTTP), without credentials, query or fragment", "INVALID_API_URL");
|
|
25257
25255
|
}
|
|
25258
25256
|
const pathname = url.pathname.replace(/\/+$/, "");
|
|
25259
|
-
if (
|
|
25257
|
+
if (url.origin === "https://api.hasna.com" && pathname === "/skills/v1") {
|
|
25258
|
+
url.pathname = "/skills";
|
|
25259
|
+
} else if (pathname === "/api" || pathname === "/api/v1") {
|
|
25260
25260
|
url.pathname = "/";
|
|
25261
25261
|
} else if (pathname.endsWith("/api/v1")) {
|
|
25262
25262
|
url.pathname = pathname.slice(0, -"/api/v1".length) || "/";
|
|
@@ -25265,6 +25265,21 @@ function normalizeSkillsApiOrigin(apiUrl) {
|
|
|
25265
25265
|
}
|
|
25266
25266
|
return url.toString().replace(/\/+$/, "");
|
|
25267
25267
|
}
|
|
25268
|
+
function skillsApiRequestUrl(apiUrl, route) {
|
|
25269
|
+
const origin = normalizeSkillsApiOrigin(apiUrl);
|
|
25270
|
+
if (!route.startsWith("/api/") || route.includes("#") || route.includes("\\")) {
|
|
25271
|
+
throw new SkillsFleetCredentialError("Invalid Skills API route", "INVALID_API_URL");
|
|
25272
|
+
}
|
|
25273
|
+
if (origin === "https://api.hasna.com/skills") {
|
|
25274
|
+
if (route === "/api/auth/whoami")
|
|
25275
|
+
return `${origin}/v1/auth/whoami`;
|
|
25276
|
+
if (!route.startsWith("/api/v1/")) {
|
|
25277
|
+
throw new SkillsFleetCredentialError("The internal Skills gateway has no established login contract yet. Select an explicitly configured instance with supported authentication.", "GATEWAY_AUTH_UNAVAILABLE");
|
|
25278
|
+
}
|
|
25279
|
+
return `${origin}${route.slice("/api".length)}`;
|
|
25280
|
+
}
|
|
25281
|
+
return `${origin}${route}`;
|
|
25282
|
+
}
|
|
25268
25283
|
function configuredSkillsApiUrl(env = process.env, keychain, profile) {
|
|
25269
25284
|
const declared = SKILLS_API_URL_ENV_KEYS.filter((key) => env[key] !== undefined).map((key) => ({ key, value: env[key] }));
|
|
25270
25285
|
for (const entry of declared) {
|
|
@@ -25481,7 +25496,7 @@ class MissingSkillsFleetError extends Error {
|
|
|
25481
25496
|
// package.json
|
|
25482
25497
|
var package_default = {
|
|
25483
25498
|
name: "@hasna/skills",
|
|
25484
|
-
version: "0.5.
|
|
25499
|
+
version: "0.5.5",
|
|
25485
25500
|
description: "Skills library for AI coding agents",
|
|
25486
25501
|
type: "module",
|
|
25487
25502
|
bin: {
|
|
@@ -37116,10 +37131,16 @@ class SqliteSkillsStore {
|
|
|
37116
37131
|
const orgId = input.principal.orgId;
|
|
37117
37132
|
const now = nowIso();
|
|
37118
37133
|
return this.db.transaction(() => {
|
|
37119
|
-
const previous = this.get("SELECT revision_id, revision_number, bundle_sha256, bundle_byte_size, skill_md, tombstoned_at FROM skills_registry WHERE org_id = ? AND slug = ?", [orgId, input.slug]);
|
|
37134
|
+
const previous = this.get("SELECT revision_id, revision_number, bundle_sha256, bundle_byte_size, skill_md, tombstoned_at, source FROM skills_registry WHERE org_id = ? AND slug = ?", [orgId, input.slug]);
|
|
37120
37135
|
const previousSha = typeof previous?.bundle_sha256 === "string" ? previous.bundle_sha256 : null;
|
|
37121
37136
|
const previousRevisionId = typeof previous?.revision_id === "string" && previous.revision_id ? previous.revision_id : null;
|
|
37122
37137
|
const tombstoned = previous?.tombstoned_at != null;
|
|
37138
|
+
if (input.seedBundledOnly && input.expectedRevisionId && !previous) {
|
|
37139
|
+
throw new SkillRevisionConflictError(input.slug, input.expectedRevisionId, null);
|
|
37140
|
+
}
|
|
37141
|
+
if (input.seedBundledOnly && previous && (tombstoned || previous.source !== "bundled")) {
|
|
37142
|
+
throw new SkillRevisionConflictError(input.slug, input.expectedRevisionId, previousRevisionId);
|
|
37143
|
+
}
|
|
37123
37144
|
const carriedSkillMd = typeof input.skillMd === "string" ? input.skillMd : typeof previous?.skill_md === "string" ? previous.skill_md : null;
|
|
37124
37145
|
if (previous && !tombstoned && input.expectedRevisionId !== previousRevisionId) {
|
|
37125
37146
|
throw new SkillRevisionConflictError(input.slug, input.expectedRevisionId, previousRevisionId);
|
|
@@ -37193,8 +37214,9 @@ class SqliteSkillsStore {
|
|
|
37193
37214
|
tombstoned_at = NULL,
|
|
37194
37215
|
tombstone_purge_after = NULL,
|
|
37195
37216
|
updated_at = excluded.updated_at
|
|
37196
|
-
WHERE skills_registry.tombstoned_at IS NOT NULL
|
|
37197
|
-
|
|
37217
|
+
WHERE (skills_registry.tombstoned_at IS NOT NULL OR skills_registry.revision_id = ?)
|
|
37218
|
+
AND (? = 0 OR (skills_registry.tombstoned_at IS NULL AND skills_registry.source = 'bundled'
|
|
37219
|
+
AND skills_registry.revision_id = ?))
|
|
37198
37220
|
RETURNING *`, [
|
|
37199
37221
|
orgId,
|
|
37200
37222
|
input.slug,
|
|
@@ -37212,6 +37234,8 @@ class SqliteSkillsStore {
|
|
|
37212
37234
|
revisionId,
|
|
37213
37235
|
now,
|
|
37214
37236
|
now,
|
|
37237
|
+
input.expectedRevisionId ?? NO_REVISION_SENTINEL,
|
|
37238
|
+
input.seedBundledOnly ? 1 : 0,
|
|
37215
37239
|
input.expectedRevisionId ?? NO_REVISION_SENTINEL
|
|
37216
37240
|
]);
|
|
37217
37241
|
if (!row) {
|
|
@@ -42257,6 +42281,12 @@ async function storePublishedSkill(store, artifactStorage, principal, parsed, ex
|
|
|
42257
42281
|
principal,
|
|
42258
42282
|
...expectedRevisionId ? { expectedRevisionId } : {}
|
|
42259
42283
|
};
|
|
42284
|
+
if (input.seedBundledOnly && expectedRevisionId && !current) {
|
|
42285
|
+
throw new SkillRevisionConflictError(input.slug, expectedRevisionId, null);
|
|
42286
|
+
}
|
|
42287
|
+
if (input.seedBundledOnly && current && (current.tombstonedAt || current.source !== "bundled")) {
|
|
42288
|
+
throw new SkillRevisionConflictError(input.slug, expectedRevisionId, current.revisionId);
|
|
42289
|
+
}
|
|
42260
42290
|
if (current && !current.tombstonedAt && expectedRevisionId !== current.revisionId) {
|
|
42261
42291
|
throw new SkillRevisionConflictError(input.slug, expectedRevisionId, current.revisionId);
|
|
42262
42292
|
}
|
|
@@ -42506,6 +42536,15 @@ async function seedBundledCorpus(options) {
|
|
|
42506
42536
|
result.skipped.push(slug);
|
|
42507
42537
|
continue;
|
|
42508
42538
|
}
|
|
42539
|
+
const current = await options.store.getSkill(options.principal, slug);
|
|
42540
|
+
if (current) {
|
|
42541
|
+
const previousVersion = current.version ? await options.store.getSkillVersion(options.principal, slug, current.version) : null;
|
|
42542
|
+
const provenance = previousVersion?.manifest.provenance;
|
|
42543
|
+
if (current.tombstonedAt || current.source !== "bundled" || provenance?.seededFrom !== "bundled-corpus" || provenance.seededRevisionId !== current.revisionId) {
|
|
42544
|
+
result.skipped.push(slug);
|
|
42545
|
+
continue;
|
|
42546
|
+
}
|
|
42547
|
+
}
|
|
42509
42548
|
const dir = getSkillPath(slug);
|
|
42510
42549
|
if (!existsSync15(dir)) {
|
|
42511
42550
|
result.skipped.push(slug);
|
|
@@ -42515,32 +42554,40 @@ async function seedBundledCorpus(options) {
|
|
|
42515
42554
|
const packed = packSkillBundle(dir, { maxUnpackedBytes: 50000000 });
|
|
42516
42555
|
const skillMdPath = join19(dir, "SKILL.md");
|
|
42517
42556
|
const skillMd = existsSync15(skillMdPath) ? readFileSync16(skillMdPath, "utf-8") : undefined;
|
|
42518
|
-
const
|
|
42557
|
+
const content = {
|
|
42558
|
+
slug,
|
|
42559
|
+
displayName: manifest.displayName ?? skill.displayName ?? slug,
|
|
42560
|
+
description: manifest.description ?? skill.description ?? slug,
|
|
42561
|
+
category: manifest.category ?? skill.category ?? "Development Tools",
|
|
42562
|
+
tags: manifest.tags ?? skill.tags ?? [],
|
|
42563
|
+
source: "bundled",
|
|
42564
|
+
kind: manifest.kind ?? "instruction",
|
|
42565
|
+
version: version2,
|
|
42566
|
+
...skillMd ? { skillMd } : {},
|
|
42567
|
+
bundleSha256: packed.sha256,
|
|
42568
|
+
bundleByteSize: packed.bytes.byteLength
|
|
42569
|
+
};
|
|
42519
42570
|
const { record } = await storePublishedSkill(options.store, options.artifactStorage, options.principal, {
|
|
42520
42571
|
input: {
|
|
42521
|
-
|
|
42522
|
-
|
|
42523
|
-
description: manifest.description ?? skill.description ?? slug,
|
|
42524
|
-
category: manifest.category ?? skill.category ?? "Development Tools",
|
|
42525
|
-
tags: manifest.tags ?? skill.tags ?? [],
|
|
42526
|
-
source: "bundled",
|
|
42527
|
-
kind: manifest.kind ?? "instruction",
|
|
42528
|
-
version: version2,
|
|
42529
|
-
...skillMd ? { skillMd } : {},
|
|
42572
|
+
...content,
|
|
42573
|
+
seedBundledOnly: true,
|
|
42530
42574
|
bundle: { sha256: packed.sha256, byteSize: packed.bytes.byteLength, contentType: "application/gzip", storageKind: "db" },
|
|
42531
42575
|
versionManifest: {
|
|
42532
42576
|
files: packed.paths,
|
|
42533
42577
|
fileCount: packed.fileCount,
|
|
42534
42578
|
unpackedByteSize: packed.unpackedByteSize,
|
|
42535
42579
|
bundleSha256: packed.sha256,
|
|
42536
|
-
provenance: { seededFrom: "bundled-corpus", packageVersion: package_default.version }
|
|
42580
|
+
provenance: { seededFrom: "bundled-corpus", packageVersion: package_default.version, seededRevisionId: revisionIdOfRecord(content) }
|
|
42537
42581
|
}
|
|
42538
42582
|
},
|
|
42539
42583
|
bundleBytes: packed.bytes
|
|
42540
42584
|
}, current?.revisionId);
|
|
42541
42585
|
result.seeded.push(`${record.slug}@${version2}`);
|
|
42542
42586
|
} catch (error) {
|
|
42543
|
-
|
|
42587
|
+
if (error instanceof SkillRevisionConflictError)
|
|
42588
|
+
result.skipped.push(slug);
|
|
42589
|
+
else
|
|
42590
|
+
result.failed.push({ slug, error: error.message });
|
|
42544
42591
|
}
|
|
42545
42592
|
}
|
|
42546
42593
|
log(`skills: bundled corpus seed v${version2}: ${result.seeded.length} seeded, ${result.skipped.length} skipped, ${result.failed.length} failed`);
|
|
@@ -42750,6 +42797,12 @@ class MemorySkillsStore {
|
|
|
42750
42797
|
const key = skillKey(input.principal.orgId, input.slug);
|
|
42751
42798
|
const now = nowIso();
|
|
42752
42799
|
const previous = this.skills.get(key);
|
|
42800
|
+
if (input.seedBundledOnly && input.expectedRevisionId && !previous) {
|
|
42801
|
+
throw new SkillRevisionConflictError(input.slug, input.expectedRevisionId, null);
|
|
42802
|
+
}
|
|
42803
|
+
if (input.seedBundledOnly && previous && (previous.tombstonedAt || previous.source !== "bundled")) {
|
|
42804
|
+
throw new SkillRevisionConflictError(input.slug, input.expectedRevisionId, previous.revisionId);
|
|
42805
|
+
}
|
|
42753
42806
|
if (previous && !previous.tombstonedAt && input.expectedRevisionId !== previous.revisionId) {
|
|
42754
42807
|
throw new SkillRevisionConflictError(input.slug, input.expectedRevisionId, previous.revisionId);
|
|
42755
42808
|
}
|
|
@@ -43203,13 +43256,19 @@ class PostgresSkillsStore {
|
|
|
43203
43256
|
const orgId = input.principal.orgId;
|
|
43204
43257
|
return await this.sql.begin(async (tx) => {
|
|
43205
43258
|
const previousRows = await tx`
|
|
43206
|
-
SELECT revision_id, revision_number, bundle_sha256, bundle_byte_size, skill_md, tombstoned_at
|
|
43259
|
+
SELECT revision_id, revision_number, bundle_sha256, bundle_byte_size, skill_md, tombstoned_at, source
|
|
43207
43260
|
FROM skills_registry WHERE org_id = ${orgId} AND slug = ${input.slug} LIMIT 1
|
|
43208
43261
|
`;
|
|
43209
43262
|
const previous = previousRows[0];
|
|
43210
43263
|
const previousSha = typeof previous?.bundle_sha256 === "string" ? String(previous.bundle_sha256) : null;
|
|
43211
43264
|
const previousRevisionId = typeof previous?.revision_id === "string" && previous.revision_id ? String(previous.revision_id) : null;
|
|
43212
43265
|
const tombstoned = previous?.tombstoned_at != null;
|
|
43266
|
+
if (input.seedBundledOnly && input.expectedRevisionId && !previous) {
|
|
43267
|
+
throw new SkillRevisionConflictError(input.slug, input.expectedRevisionId, null);
|
|
43268
|
+
}
|
|
43269
|
+
if (input.seedBundledOnly && previous && (tombstoned || previous.source !== "bundled")) {
|
|
43270
|
+
throw new SkillRevisionConflictError(input.slug, input.expectedRevisionId, previousRevisionId);
|
|
43271
|
+
}
|
|
43213
43272
|
const carriedSkillMd = typeof input.skillMd === "string" ? input.skillMd : typeof previous?.skill_md === "string" ? String(previous.skill_md) : null;
|
|
43214
43273
|
if (previous && !tombstoned && input.expectedRevisionId !== previousRevisionId) {
|
|
43215
43274
|
throw new SkillRevisionConflictError(input.slug, input.expectedRevisionId, previousRevisionId);
|
|
@@ -43250,6 +43309,12 @@ class PostgresSkillsStore {
|
|
|
43250
43309
|
body_blob = EXCLUDED.body_blob
|
|
43251
43310
|
`;
|
|
43252
43311
|
}
|
|
43312
|
+
if (input.seedBundledOnly) {
|
|
43313
|
+
const seedRows = await tx`SELECT revision_id FROM skills_registry WHERE org_id = ${orgId} AND slug = ${input.slug} FOR UPDATE`;
|
|
43314
|
+
if (input.expectedRevisionId && !seedRows[0]) {
|
|
43315
|
+
throw new SkillRevisionConflictError(input.slug, input.expectedRevisionId, null);
|
|
43316
|
+
}
|
|
43317
|
+
}
|
|
43253
43318
|
const rows = await tx`
|
|
43254
43319
|
INSERT INTO skills_registry (org_id, slug, display_name, description, category, tags_json, source, kind, version, skill_md,
|
|
43255
43320
|
bundle_sha256, bundle_byte_size, published_by_user_id, revision_id, revision_number, updated_at)
|
|
@@ -43278,8 +43343,11 @@ class PostgresSkillsStore {
|
|
|
43278
43343
|
tombstoned_at = NULL,
|
|
43279
43344
|
tombstone_purge_after = NULL,
|
|
43280
43345
|
updated_at = EXCLUDED.updated_at
|
|
43281
|
-
WHERE skills_registry.tombstoned_at IS NOT NULL
|
|
43282
|
-
OR skills_registry.revision_id = ${input.expectedRevisionId ?? NO_REVISION_SENTINEL2}
|
|
43346
|
+
WHERE (skills_registry.tombstoned_at IS NOT NULL
|
|
43347
|
+
OR skills_registry.revision_id = ${input.expectedRevisionId ?? NO_REVISION_SENTINEL2})
|
|
43348
|
+
AND (NOT ${Boolean(input.seedBundledOnly)} OR
|
|
43349
|
+
(skills_registry.tombstoned_at IS NULL AND skills_registry.source = 'bundled'
|
|
43350
|
+
AND skills_registry.revision_id = ${input.expectedRevisionId ?? NO_REVISION_SENTINEL2}))
|
|
43283
43351
|
RETURNING *
|
|
43284
43352
|
`;
|
|
43285
43353
|
if (!rows[0]) {
|
|
@@ -43694,6 +43762,15 @@ async function createSkillsFetchHandler(options = {}) {
|
|
|
43694
43762
|
}
|
|
43695
43763
|
return async function fetch2(request) {
|
|
43696
43764
|
const url = new URL(request.url);
|
|
43765
|
+
const versionedAliases = {
|
|
43766
|
+
"/v1/health": "/health",
|
|
43767
|
+
"/v1/auth/whoami": "/api/auth/whoami"
|
|
43768
|
+
};
|
|
43769
|
+
const alias = versionedAliases[url.pathname] ?? (url.pathname === "/v1" || url.pathname.startsWith("/v1/") ? `/api${url.pathname}` : undefined);
|
|
43770
|
+
if (alias) {
|
|
43771
|
+
url.pathname = alias;
|
|
43772
|
+
request = new Request(url, request);
|
|
43773
|
+
}
|
|
43697
43774
|
const segments = pathSegments(url.pathname);
|
|
43698
43775
|
try {
|
|
43699
43776
|
if (request.method === "GET" && url.pathname === "/health") {
|
|
@@ -44058,113 +44135,113 @@ var currentVersionService = {
|
|
|
44058
44135
|
// ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/external.js
|
|
44059
44136
|
var exports_external = {};
|
|
44060
44137
|
__export(exports_external, {
|
|
44061
|
-
|
|
44062
|
-
DIRTY: () => DIRTY,
|
|
44063
|
-
EMPTY_PATH: () => EMPTY_PATH,
|
|
44064
|
-
INVALID: () => INVALID,
|
|
44065
|
-
NEVER: () => NEVER,
|
|
44066
|
-
OK: () => OK,
|
|
44067
|
-
ParseStatus: () => ParseStatus,
|
|
44068
|
-
Schema: () => ZodType,
|
|
44069
|
-
ZodAny: () => ZodAny,
|
|
44070
|
-
ZodArray: () => ZodArray,
|
|
44071
|
-
ZodBigInt: () => ZodBigInt,
|
|
44072
|
-
ZodBoolean: () => ZodBoolean,
|
|
44073
|
-
ZodBranded: () => ZodBranded,
|
|
44074
|
-
ZodCatch: () => ZodCatch,
|
|
44075
|
-
ZodDate: () => ZodDate,
|
|
44076
|
-
ZodDefault: () => ZodDefault,
|
|
44077
|
-
ZodDiscriminatedUnion: () => ZodDiscriminatedUnion,
|
|
44078
|
-
ZodEffects: () => ZodEffects,
|
|
44079
|
-
ZodEnum: () => ZodEnum,
|
|
44080
|
-
ZodError: () => ZodError,
|
|
44081
|
-
ZodFirstPartyTypeKind: () => ZodFirstPartyTypeKind,
|
|
44082
|
-
ZodFunction: () => ZodFunction,
|
|
44083
|
-
ZodIntersection: () => ZodIntersection,
|
|
44084
|
-
ZodIssueCode: () => ZodIssueCode,
|
|
44085
|
-
ZodLazy: () => ZodLazy,
|
|
44086
|
-
ZodLiteral: () => ZodLiteral,
|
|
44087
|
-
ZodMap: () => ZodMap,
|
|
44088
|
-
ZodNaN: () => ZodNaN,
|
|
44089
|
-
ZodNativeEnum: () => ZodNativeEnum,
|
|
44090
|
-
ZodNever: () => ZodNever,
|
|
44091
|
-
ZodNull: () => ZodNull,
|
|
44092
|
-
ZodNullable: () => ZodNullable,
|
|
44093
|
-
ZodNumber: () => ZodNumber,
|
|
44094
|
-
ZodObject: () => ZodObject,
|
|
44095
|
-
ZodOptional: () => ZodOptional,
|
|
44096
|
-
ZodParsedType: () => ZodParsedType,
|
|
44097
|
-
ZodPipeline: () => ZodPipeline,
|
|
44098
|
-
ZodPromise: () => ZodPromise,
|
|
44099
|
-
ZodReadonly: () => ZodReadonly,
|
|
44100
|
-
ZodRecord: () => ZodRecord,
|
|
44101
|
-
ZodSchema: () => ZodType,
|
|
44102
|
-
ZodSet: () => ZodSet,
|
|
44103
|
-
ZodString: () => ZodString,
|
|
44104
|
-
ZodSymbol: () => ZodSymbol,
|
|
44105
|
-
ZodTransformer: () => ZodEffects,
|
|
44106
|
-
ZodTuple: () => ZodTuple,
|
|
44107
|
-
ZodType: () => ZodType,
|
|
44108
|
-
ZodUndefined: () => ZodUndefined,
|
|
44109
|
-
ZodUnion: () => ZodUnion,
|
|
44110
|
-
ZodUnknown: () => ZodUnknown,
|
|
44111
|
-
ZodVoid: () => ZodVoid,
|
|
44112
|
-
addIssueToContext: () => addIssueToContext,
|
|
44113
|
-
any: () => anyType,
|
|
44114
|
-
array: () => arrayType,
|
|
44115
|
-
bigint: () => bigIntType,
|
|
44116
|
-
boolean: () => booleanType,
|
|
44117
|
-
coerce: () => coerce,
|
|
44118
|
-
custom: () => custom,
|
|
44119
|
-
date: () => dateType,
|
|
44120
|
-
datetimeRegex: () => datetimeRegex,
|
|
44121
|
-
defaultErrorMap: () => en_default,
|
|
44122
|
-
discriminatedUnion: () => discriminatedUnionType,
|
|
44123
|
-
effect: () => effectsType,
|
|
44124
|
-
enum: () => enumType,
|
|
44125
|
-
function: () => functionType,
|
|
44126
|
-
getErrorMap: () => getErrorMap,
|
|
44127
|
-
getParsedType: () => getParsedType,
|
|
44128
|
-
instanceof: () => instanceOfType,
|
|
44129
|
-
intersection: () => intersectionType,
|
|
44130
|
-
isAborted: () => isAborted,
|
|
44131
|
-
isAsync: () => isAsync,
|
|
44132
|
-
isDirty: () => isDirty,
|
|
44133
|
-
isValid: () => isValid,
|
|
44134
|
-
late: () => late,
|
|
44135
|
-
lazy: () => lazyType,
|
|
44136
|
-
literal: () => literalType,
|
|
44137
|
-
makeIssue: () => makeIssue,
|
|
44138
|
-
map: () => mapType,
|
|
44139
|
-
nan: () => nanType,
|
|
44140
|
-
nativeEnum: () => nativeEnumType,
|
|
44141
|
-
never: () => neverType,
|
|
44142
|
-
null: () => nullType,
|
|
44143
|
-
nullable: () => nullableType,
|
|
44144
|
-
number: () => numberType,
|
|
44145
|
-
object: () => objectType,
|
|
44146
|
-
objectUtil: () => objectUtil,
|
|
44147
|
-
oboolean: () => oboolean,
|
|
44148
|
-
onumber: () => onumber,
|
|
44149
|
-
optional: () => optionalType,
|
|
44150
|
-
ostring: () => ostring,
|
|
44151
|
-
pipeline: () => pipelineType,
|
|
44152
|
-
preprocess: () => preprocessType,
|
|
44153
|
-
promise: () => promiseType,
|
|
44154
|
-
quotelessJson: () => quotelessJson,
|
|
44155
|
-
record: () => recordType,
|
|
44156
|
-
set: () => setType,
|
|
44157
|
-
setErrorMap: () => setErrorMap,
|
|
44158
|
-
strictObject: () => strictObjectType,
|
|
44159
|
-
string: () => stringType,
|
|
44160
|
-
symbol: () => symbolType,
|
|
44161
|
-
transformer: () => effectsType,
|
|
44162
|
-
tuple: () => tupleType,
|
|
44163
|
-
undefined: () => undefinedType,
|
|
44164
|
-
union: () => unionType,
|
|
44165
|
-
unknown: () => unknownType,
|
|
44138
|
+
void: () => voidType,
|
|
44166
44139
|
util: () => util,
|
|
44167
|
-
|
|
44140
|
+
unknown: () => unknownType,
|
|
44141
|
+
union: () => unionType,
|
|
44142
|
+
undefined: () => undefinedType,
|
|
44143
|
+
tuple: () => tupleType,
|
|
44144
|
+
transformer: () => effectsType,
|
|
44145
|
+
symbol: () => symbolType,
|
|
44146
|
+
string: () => stringType,
|
|
44147
|
+
strictObject: () => strictObjectType,
|
|
44148
|
+
setErrorMap: () => setErrorMap,
|
|
44149
|
+
set: () => setType,
|
|
44150
|
+
record: () => recordType,
|
|
44151
|
+
quotelessJson: () => quotelessJson,
|
|
44152
|
+
promise: () => promiseType,
|
|
44153
|
+
preprocess: () => preprocessType,
|
|
44154
|
+
pipeline: () => pipelineType,
|
|
44155
|
+
ostring: () => ostring,
|
|
44156
|
+
optional: () => optionalType,
|
|
44157
|
+
onumber: () => onumber,
|
|
44158
|
+
oboolean: () => oboolean,
|
|
44159
|
+
objectUtil: () => objectUtil,
|
|
44160
|
+
object: () => objectType,
|
|
44161
|
+
number: () => numberType,
|
|
44162
|
+
nullable: () => nullableType,
|
|
44163
|
+
null: () => nullType,
|
|
44164
|
+
never: () => neverType,
|
|
44165
|
+
nativeEnum: () => nativeEnumType,
|
|
44166
|
+
nan: () => nanType,
|
|
44167
|
+
map: () => mapType,
|
|
44168
|
+
makeIssue: () => makeIssue,
|
|
44169
|
+
literal: () => literalType,
|
|
44170
|
+
lazy: () => lazyType,
|
|
44171
|
+
late: () => late,
|
|
44172
|
+
isValid: () => isValid,
|
|
44173
|
+
isDirty: () => isDirty,
|
|
44174
|
+
isAsync: () => isAsync,
|
|
44175
|
+
isAborted: () => isAborted,
|
|
44176
|
+
intersection: () => intersectionType,
|
|
44177
|
+
instanceof: () => instanceOfType,
|
|
44178
|
+
getParsedType: () => getParsedType,
|
|
44179
|
+
getErrorMap: () => getErrorMap,
|
|
44180
|
+
function: () => functionType,
|
|
44181
|
+
enum: () => enumType,
|
|
44182
|
+
effect: () => effectsType,
|
|
44183
|
+
discriminatedUnion: () => discriminatedUnionType,
|
|
44184
|
+
defaultErrorMap: () => en_default,
|
|
44185
|
+
datetimeRegex: () => datetimeRegex,
|
|
44186
|
+
date: () => dateType,
|
|
44187
|
+
custom: () => custom,
|
|
44188
|
+
coerce: () => coerce,
|
|
44189
|
+
boolean: () => booleanType,
|
|
44190
|
+
bigint: () => bigIntType,
|
|
44191
|
+
array: () => arrayType,
|
|
44192
|
+
any: () => anyType,
|
|
44193
|
+
addIssueToContext: () => addIssueToContext,
|
|
44194
|
+
ZodVoid: () => ZodVoid,
|
|
44195
|
+
ZodUnknown: () => ZodUnknown,
|
|
44196
|
+
ZodUnion: () => ZodUnion,
|
|
44197
|
+
ZodUndefined: () => ZodUndefined,
|
|
44198
|
+
ZodType: () => ZodType,
|
|
44199
|
+
ZodTuple: () => ZodTuple,
|
|
44200
|
+
ZodTransformer: () => ZodEffects,
|
|
44201
|
+
ZodSymbol: () => ZodSymbol,
|
|
44202
|
+
ZodString: () => ZodString,
|
|
44203
|
+
ZodSet: () => ZodSet,
|
|
44204
|
+
ZodSchema: () => ZodType,
|
|
44205
|
+
ZodRecord: () => ZodRecord,
|
|
44206
|
+
ZodReadonly: () => ZodReadonly,
|
|
44207
|
+
ZodPromise: () => ZodPromise,
|
|
44208
|
+
ZodPipeline: () => ZodPipeline,
|
|
44209
|
+
ZodParsedType: () => ZodParsedType,
|
|
44210
|
+
ZodOptional: () => ZodOptional,
|
|
44211
|
+
ZodObject: () => ZodObject,
|
|
44212
|
+
ZodNumber: () => ZodNumber,
|
|
44213
|
+
ZodNullable: () => ZodNullable,
|
|
44214
|
+
ZodNull: () => ZodNull,
|
|
44215
|
+
ZodNever: () => ZodNever,
|
|
44216
|
+
ZodNativeEnum: () => ZodNativeEnum,
|
|
44217
|
+
ZodNaN: () => ZodNaN,
|
|
44218
|
+
ZodMap: () => ZodMap,
|
|
44219
|
+
ZodLiteral: () => ZodLiteral,
|
|
44220
|
+
ZodLazy: () => ZodLazy,
|
|
44221
|
+
ZodIssueCode: () => ZodIssueCode,
|
|
44222
|
+
ZodIntersection: () => ZodIntersection,
|
|
44223
|
+
ZodFunction: () => ZodFunction,
|
|
44224
|
+
ZodFirstPartyTypeKind: () => ZodFirstPartyTypeKind,
|
|
44225
|
+
ZodError: () => ZodError,
|
|
44226
|
+
ZodEnum: () => ZodEnum,
|
|
44227
|
+
ZodEffects: () => ZodEffects,
|
|
44228
|
+
ZodDiscriminatedUnion: () => ZodDiscriminatedUnion,
|
|
44229
|
+
ZodDefault: () => ZodDefault,
|
|
44230
|
+
ZodDate: () => ZodDate,
|
|
44231
|
+
ZodCatch: () => ZodCatch,
|
|
44232
|
+
ZodBranded: () => ZodBranded,
|
|
44233
|
+
ZodBoolean: () => ZodBoolean,
|
|
44234
|
+
ZodBigInt: () => ZodBigInt,
|
|
44235
|
+
ZodArray: () => ZodArray,
|
|
44236
|
+
ZodAny: () => ZodAny,
|
|
44237
|
+
Schema: () => ZodType,
|
|
44238
|
+
ParseStatus: () => ParseStatus,
|
|
44239
|
+
OK: () => OK,
|
|
44240
|
+
NEVER: () => NEVER,
|
|
44241
|
+
INVALID: () => INVALID,
|
|
44242
|
+
EMPTY_PATH: () => EMPTY_PATH,
|
|
44243
|
+
DIRTY: () => DIRTY,
|
|
44244
|
+
BRAND: () => BRAND
|
|
44168
44245
|
});
|
|
44169
44246
|
|
|
44170
44247
|
// ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/helpers/util.js
|
|
@@ -52117,7 +52194,13 @@ class StopTaskCommand extends command3(_ep03, _mw03, "StopTask", StopTask$) {
|
|
|
52117
52194
|
|
|
52118
52195
|
// src/sdk/execution/dispatchers/ecs.ts
|
|
52119
52196
|
var CLIENT_TOKEN_BYTES = 16;
|
|
52120
|
-
var
|
|
52197
|
+
var LIVE_TASK_STATUSES = new Set(["PROVISIONING", "PENDING", "ACTIVATING", "RUNNING", "DEACTIVATING", "STOPPING", "DEPROVISIONING"]);
|
|
52198
|
+
function observedTask(states, taskArn) {
|
|
52199
|
+
if (states.length !== 1 || states[0]?.taskArn !== taskArn)
|
|
52200
|
+
return;
|
|
52201
|
+
const state = states[0];
|
|
52202
|
+
return state.lastStatus === "STOPPED" || LIVE_TASK_STATUSES.has(state.lastStatus) ? state : undefined;
|
|
52203
|
+
}
|
|
52121
52204
|
function clientTokenFor(runId2, attemptId) {
|
|
52122
52205
|
return createHash11("sha256").update(`${runId2}\x00${attemptId}`).digest("hex").slice(0, CLIENT_TOKEN_BYTES * 2);
|
|
52123
52206
|
}
|
|
@@ -52169,28 +52252,47 @@ class EcsDispatcher {
|
|
|
52169
52252
|
const run = await this.store.getRun(runId2);
|
|
52170
52253
|
if (!run)
|
|
52171
52254
|
return { accepted: false, detail: "no such run" };
|
|
52172
|
-
if (run.status === "cancelled")
|
|
52173
|
-
return { accepted: true, detail: "already cancelled" };
|
|
52174
52255
|
if (run.status === "succeeded" || run.status === "failed") {
|
|
52175
52256
|
return { accepted: false, detail: `run already ${run.status}` };
|
|
52176
52257
|
}
|
|
52177
52258
|
const attempts = await this.store.listAttempts(runId2);
|
|
52178
52259
|
const current = attempts[attempts.length - 1];
|
|
52179
52260
|
if (!current) {
|
|
52180
|
-
|
|
52181
|
-
|
|
52261
|
+
if (run.status === "cancelled")
|
|
52262
|
+
return { accepted: true, detail: "already cancelled (no attempt launched)" };
|
|
52263
|
+
const cancelled = await this.stateMachine.cancel(runId2);
|
|
52264
|
+
return cancelled.ok ? { accepted: true, detail: "cancelled (no attempt launched)" } : { accepted: false, detail: cancelled.reason };
|
|
52182
52265
|
}
|
|
52183
|
-
|
|
52184
|
-
|
|
52266
|
+
if (!this.cancellationReceipt(await this.receipts.get(runId2, current.attemptId), run.admission, current)) {
|
|
52267
|
+
return { accepted: false, detail: "matching cancellation receipt is unavailable or contradictory" };
|
|
52268
|
+
}
|
|
52269
|
+
const observation = await this.reconcile(run.admission, current);
|
|
52270
|
+
if (observation.kind !== "already-launched" && observation.kind !== "previous-terminal") {
|
|
52271
|
+
return { accepted: false, detail: "task state unknown; cancellation is not yet confirmed" };
|
|
52272
|
+
}
|
|
52273
|
+
const taskArn = observation.kind === "already-launched" ? observation.taskId : (await this.store.listAttempts(runId2)).find((row) => row.attemptId === current.attemptId)?.taskId ?? null;
|
|
52274
|
+
if (!taskArn)
|
|
52275
|
+
return { accepted: false, detail: "stopped task identity is not confirmed" };
|
|
52276
|
+
if (observation.kind === "already-launched") {
|
|
52185
52277
|
try {
|
|
52186
|
-
await this.client.stopTask(
|
|
52278
|
+
await this.client.stopTask(observation.taskId);
|
|
52187
52279
|
} catch {}
|
|
52280
|
+
const stopped = await this.reconcile(run.admission, { ...current, taskId: observation.taskId });
|
|
52281
|
+
if (stopped.kind !== "previous-terminal") {
|
|
52282
|
+
return { accepted: false, target: observation.taskId, detail: "task stop is not yet confirmed; reconcile before retrying cancellation" };
|
|
52283
|
+
}
|
|
52188
52284
|
}
|
|
52189
|
-
|
|
52190
|
-
|
|
52191
|
-
|
|
52192
|
-
|
|
52193
|
-
|
|
52285
|
+
if (run.status !== "cancelled") {
|
|
52286
|
+
const cancelled = await this.stateMachine.cancel(runId2);
|
|
52287
|
+
if (!cancelled.ok)
|
|
52288
|
+
return { accepted: false, detail: cancelled.reason };
|
|
52289
|
+
}
|
|
52290
|
+
try {
|
|
52291
|
+
await this.writeCancellationReceipt(run.admission, current, taskArn);
|
|
52292
|
+
} catch {
|
|
52293
|
+
return { accepted: false, target: taskArn, detail: "task stopped; cancellation receipt is not yet confirmed" };
|
|
52294
|
+
}
|
|
52295
|
+
return { accepted: true, target: taskArn, detail: "cancelled after confirmed task stop and receipt" };
|
|
52194
52296
|
}
|
|
52195
52297
|
async launchAttempt(runId2) {
|
|
52196
52298
|
const run = await this.store.getRun(runId2);
|
|
@@ -52201,16 +52303,10 @@ class EcsDispatcher {
|
|
|
52201
52303
|
}
|
|
52202
52304
|
const attempts = await this.store.listAttempts(runId2);
|
|
52203
52305
|
const previous = attempts[attempts.length - 1];
|
|
52204
|
-
if (previous
|
|
52205
|
-
|
|
52206
|
-
if (reconciled.kind === "already-launched" || reconciled.kind === "previous-terminal") {
|
|
52207
|
-
return reconciled;
|
|
52208
|
-
}
|
|
52209
|
-
if (reconciled.kind === "ambiguous") {
|
|
52210
|
-
return reconciled;
|
|
52211
|
-
}
|
|
52306
|
+
if (previous) {
|
|
52307
|
+
return this.reconcile(run.admission, previous);
|
|
52212
52308
|
}
|
|
52213
|
-
const attemptNumber =
|
|
52309
|
+
const attemptNumber = 1;
|
|
52214
52310
|
const attempt = await this.store.createAttempt({ runId: runId2, attemptNumber });
|
|
52215
52311
|
const claimed = await this.stateMachine.claim({
|
|
52216
52312
|
runId: runId2,
|
|
@@ -52245,68 +52341,43 @@ class EcsDispatcher {
|
|
|
52245
52341
|
} catch {
|
|
52246
52342
|
await this.store.recordLaunchState({ runId: runId2, attemptId: attempt.attemptId, launchState: "ambiguous" });
|
|
52247
52343
|
const reconciled = await this.reconcile(run.admission, intent.attempt);
|
|
52248
|
-
|
|
52249
|
-
return reconciled;
|
|
52250
|
-
return reconciled.kind === "previous-terminal" ? reconciled : { kind: "launch-failed-absent", attemptId: attempt.attemptId };
|
|
52344
|
+
return reconciled;
|
|
52251
52345
|
}
|
|
52252
52346
|
await this.store.recordLaunchState({ runId: runId2, attemptId: attempt.attemptId, launchState: "launched", taskId: result.taskArn });
|
|
52253
52347
|
return { kind: "launched", attemptId: attempt.attemptId, taskId: result.taskArn };
|
|
52254
52348
|
}
|
|
52255
52349
|
async reconcile(admission, attempt) {
|
|
52256
|
-
|
|
52257
|
-
|
|
52350
|
+
const ambiguous = () => ({ kind: "ambiguous", attemptId: attempt.attemptId });
|
|
52351
|
+
let taskArn = attempt.taskId;
|
|
52352
|
+
if (!taskArn) {
|
|
52353
|
+
if (!attempt.startedBy)
|
|
52354
|
+
return ambiguous();
|
|
52355
|
+
let taskArns;
|
|
52258
52356
|
try {
|
|
52259
|
-
|
|
52357
|
+
taskArns = await this.client.listTasksByStartedBy(attempt.startedBy);
|
|
52260
52358
|
} catch {
|
|
52261
|
-
return
|
|
52262
|
-
}
|
|
52263
|
-
const live2 = states2.filter((state) => !TERMINAL_TASK_STATUSES.has(state.lastStatus));
|
|
52264
|
-
if (live2.length > 0) {
|
|
52265
|
-
return { kind: "already-launched", attemptId: attempt.attemptId, taskId: attempt.taskId };
|
|
52359
|
+
return ambiguous();
|
|
52266
52360
|
}
|
|
52267
|
-
|
|
52268
|
-
|
|
52269
|
-
|
|
52270
|
-
const token = attempt.startedBy;
|
|
52271
|
-
if (!token) {
|
|
52272
|
-
await this.store.recordLaunchState({ runId: admission.runId, attemptId: attempt.attemptId, launchState: "absent" });
|
|
52273
|
-
return { kind: "launch-failed-absent", attemptId: attempt.attemptId };
|
|
52274
|
-
}
|
|
52275
|
-
let taskArns;
|
|
52276
|
-
try {
|
|
52277
|
-
taskArns = await this.client.listTasksByStartedBy(token);
|
|
52278
|
-
} catch {
|
|
52279
|
-
return { kind: "ambiguous", attemptId: attempt.attemptId };
|
|
52280
|
-
}
|
|
52281
|
-
if (taskArns.length === 0) {
|
|
52282
|
-
await this.store.recordLaunchState({ runId: admission.runId, attemptId: attempt.attemptId, launchState: "absent" });
|
|
52283
|
-
return { kind: "launch-failed-absent", attemptId: attempt.attemptId };
|
|
52361
|
+
if (taskArns.length !== 1 || !taskArns[0])
|
|
52362
|
+
return ambiguous();
|
|
52363
|
+
taskArn = taskArns[0];
|
|
52284
52364
|
}
|
|
52285
52365
|
let states;
|
|
52286
52366
|
try {
|
|
52287
|
-
states = await this.client.describeTasks(
|
|
52367
|
+
states = await this.client.describeTasks([taskArn]);
|
|
52288
52368
|
} catch {
|
|
52289
|
-
return
|
|
52369
|
+
return ambiguous();
|
|
52290
52370
|
}
|
|
52291
|
-
const
|
|
52292
|
-
if (
|
|
52293
|
-
|
|
52294
|
-
|
|
52295
|
-
|
|
52371
|
+
const state = observedTask(states, taskArn);
|
|
52372
|
+
if (!state)
|
|
52373
|
+
return ambiguous();
|
|
52374
|
+
if (state.lastStatus !== "STOPPED") {
|
|
52375
|
+
await this.store.recordLaunchState({ runId: admission.runId, attemptId: attempt.attemptId, launchState: "launched", taskId: taskArn });
|
|
52376
|
+
return { kind: "already-launched", attemptId: attempt.attemptId, taskId: taskArn };
|
|
52296
52377
|
}
|
|
52297
|
-
await this.store.recordLaunchState({ runId: admission.runId, attemptId: attempt.attemptId, launchState: "terminal", taskId:
|
|
52378
|
+
await this.store.recordLaunchState({ runId: admission.runId, attemptId: attempt.attemptId, launchState: "terminal", taskId: taskArn });
|
|
52298
52379
|
return { kind: "previous-terminal", attemptId: attempt.attemptId };
|
|
52299
52380
|
}
|
|
52300
|
-
async resolveTaskArn(admission, attempt) {
|
|
52301
|
-
if (attempt.taskId)
|
|
52302
|
-
return attempt.taskId;
|
|
52303
|
-
if (attempt.launchState === "launching" || attempt.launchState === "ambiguous") {
|
|
52304
|
-
const outcome = await this.reconcile(admission, attempt);
|
|
52305
|
-
if (outcome.kind === "already-launched")
|
|
52306
|
-
return outcome.taskId;
|
|
52307
|
-
}
|
|
52308
|
-
return null;
|
|
52309
|
-
}
|
|
52310
52381
|
runTaskInput(admission, attempt, clientToken, startedBy, requestDigest) {
|
|
52311
52382
|
const limits = admission.limits;
|
|
52312
52383
|
const cpuUnits = Math.max(256, Math.round(limits.maxCpuUnits / 256) * 256);
|
|
@@ -52331,81 +52402,103 @@ class EcsDispatcher {
|
|
|
52331
52402
|
]
|
|
52332
52403
|
};
|
|
52333
52404
|
}
|
|
52334
|
-
|
|
52335
|
-
|
|
52336
|
-
|
|
52337
|
-
|
|
52338
|
-
|
|
52339
|
-
attempt: { ...attempt, clientToken: attempt.clientToken ?? clientTokenFor(admission.runId, attempt.attemptId), requestDigest: attempt.requestDigest ?? "", startedBy: attempt.startedBy ?? "" },
|
|
52340
|
-
taskId: taskArn,
|
|
52341
|
-
launchedAt: this.now().toISOString()
|
|
52342
|
-
});
|
|
52405
|
+
cancellationReceipt(receipt, admission, attempt) {
|
|
52406
|
+
try {
|
|
52407
|
+
return !!receipt && receipt.runId === admission.runId && receipt.attemptId === attempt.attemptId && !!attempt.clientToken && receipt.clientToken === attempt.clientToken && !!attempt.requestDigest && receipt.requestDigest === attempt.requestDigest && !!attempt.startedBy && receipt.startedBy === attempt.startedBy && receipt.bundleDigest === admission.bundleDigest && receipt.runtimeImageDigest === admission.runtimeImageDigest && receipt.dependencyLayerTag === admission.dependencyLayerTag && canonicalJson(receipt.policy) === canonicalJson(admission.policy) && canonicalJson(receipt.limits) === canonicalJson(admission.limits) && (receipt.taskId === null || receipt.taskId === attempt.taskId) && (receipt.status === null && receipt.completedAt === null || receipt.status === "cancelled" && typeof receipt.completedAt === "string" && Number.isFinite(Date.parse(receipt.completedAt)));
|
|
52408
|
+
} catch {
|
|
52409
|
+
return false;
|
|
52343
52410
|
}
|
|
52344
|
-
await this.receipts.finalize({
|
|
52345
|
-
runId: admission.runId,
|
|
52346
|
-
attemptId: attempt.attemptId,
|
|
52347
|
-
status: "cancelled",
|
|
52348
|
-
exitCode: null,
|
|
52349
|
-
completedAt: this.now().toISOString()
|
|
52350
|
-
});
|
|
52351
52411
|
}
|
|
52352
|
-
|
|
52353
|
-
|
|
52354
|
-
|
|
52355
|
-
|
|
52356
|
-
|
|
52357
|
-
|
|
52412
|
+
async writeCancellationReceipt(admission, attempt, taskArn) {
|
|
52413
|
+
const existing = await this.receipts.get(admission.runId, attempt.attemptId);
|
|
52414
|
+
if (!this.cancellationReceipt(existing, admission, { ...attempt, taskId: taskArn }))
|
|
52415
|
+
throw Error("Cancellation receipt authority unavailable");
|
|
52416
|
+
const completedAt = existing.completedAt ?? this.now().toISOString();
|
|
52417
|
+
const expected = { ...existing, status: "cancelled", completedAt, exitCode: existing.status === "cancelled" ? existing.exitCode : null };
|
|
52418
|
+
const run = await this.store.getRun(admission.runId);
|
|
52419
|
+
if (existing.status !== "cancelled" || run?.status !== "cancelled" || run.terminalReceiptId !== attempt.attemptId) {
|
|
52420
|
+
await this.receipts.finalize({ runId: admission.runId, attemptId: attempt.attemptId, status: "cancelled", exitCode: expected.exitCode, completedAt });
|
|
52421
|
+
}
|
|
52422
|
+
const persisted = await this.receipts.get(admission.runId, attempt.attemptId);
|
|
52423
|
+
const finalized = await this.store.getRun(admission.runId);
|
|
52424
|
+
if (!persisted || canonicalJson(persisted) !== canonicalJson(expected) || finalized?.status !== "cancelled" || finalized.terminalReceiptId !== attempt.attemptId) {
|
|
52425
|
+
throw Error("Cancellation receipt persistence is unconfirmed");
|
|
52426
|
+
}
|
|
52427
|
+
}
|
|
52428
|
+
}
|
|
52429
|
+
function createAwsEcsClient(region, options = {}) {
|
|
52430
|
+
if (options.cluster !== undefined && !validText(options.cluster))
|
|
52431
|
+
throw Error("An explicit nonempty ECS cluster is required");
|
|
52432
|
+
const client = options.transport ?? new ECSClient({ region });
|
|
52433
|
+
let boundCluster = options.cluster;
|
|
52434
|
+
const cluster = (requested) => {
|
|
52435
|
+
const next = requested ?? boundCluster ?? "default";
|
|
52436
|
+
if (!validText(next) || boundCluster !== undefined && next !== boundCluster)
|
|
52437
|
+
throw Error("ECS client cluster binding changed");
|
|
52438
|
+
return boundCluster ??= next;
|
|
52439
|
+
};
|
|
52440
|
+
const response = (value) => {
|
|
52441
|
+
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
52442
|
+
throw Error("Incomplete ECS response");
|
|
52443
|
+
const result = value;
|
|
52444
|
+
if (result.failures !== undefined && (!Array.isArray(result.failures) || result.failures.length > 0))
|
|
52445
|
+
throw Error("ECS response contains failures");
|
|
52446
|
+
return result;
|
|
52447
|
+
};
|
|
52358
52448
|
return {
|
|
52359
52449
|
async runTask(input) {
|
|
52360
|
-
const
|
|
52361
|
-
cluster: input.cluster,
|
|
52450
|
+
const result = response(await client.send(new RunTaskCommand({
|
|
52451
|
+
cluster: cluster(input.cluster),
|
|
52362
52452
|
taskDefinition: input.taskDefinition,
|
|
52363
52453
|
launchType: input.launchType,
|
|
52364
52454
|
clientToken: input.clientToken,
|
|
52365
52455
|
startedBy: input.startedBy,
|
|
52366
|
-
networkConfiguration: {
|
|
52367
|
-
|
|
52368
|
-
|
|
52369
|
-
|
|
52370
|
-
|
|
52371
|
-
|
|
52372
|
-
},
|
|
52373
|
-
overrides: {
|
|
52374
|
-
containerOverrides: [
|
|
52375
|
-
{
|
|
52376
|
-
name: input.containerName,
|
|
52377
|
-
environment: input.environment,
|
|
52378
|
-
cpu: Number(input.cpu),
|
|
52379
|
-
memory: Number(input.memory)
|
|
52380
|
-
}
|
|
52381
|
-
]
|
|
52382
|
-
}
|
|
52383
|
-
}));
|
|
52384
|
-
const taskArn = response.tasks?.[0]?.taskArn ?? null;
|
|
52385
|
-
if (!taskArn) {
|
|
52386
|
-
const failure = response.failures?.[0];
|
|
52387
|
-
throw new Error(`RunTask refused: ${failure?.reason ?? "no task and no failure detail"}`);
|
|
52388
|
-
}
|
|
52389
|
-
return { taskArn };
|
|
52456
|
+
networkConfiguration: { awsvpcConfiguration: { subnets: input.subnets, securityGroups: input.securityGroups, assignPublicIp: "DISABLED" } },
|
|
52457
|
+
overrides: { containerOverrides: [{ name: input.containerName, environment: input.environment, cpu: Number(input.cpu), memory: Number(input.memory) }] }
|
|
52458
|
+
})));
|
|
52459
|
+
if (!Array.isArray(result.tasks) || result.tasks.length !== 1 || !validText(result.tasks[0]?.taskArn))
|
|
52460
|
+
throw Error("RunTask did not return one exact task");
|
|
52461
|
+
return { taskArn: result.tasks[0].taskArn };
|
|
52390
52462
|
},
|
|
52391
52463
|
async listTasksByStartedBy(startedBy) {
|
|
52392
|
-
const
|
|
52393
|
-
|
|
52464
|
+
const configuredCluster = cluster(), arns = [], tokens = new Set;
|
|
52465
|
+
let nextToken;
|
|
52466
|
+
for (let page = 0;page < 20; page++) {
|
|
52467
|
+
const result = response(await client.send(new ListTasksCommand({ cluster: configuredCluster, startedBy, ...nextToken ? { nextToken } : {} })));
|
|
52468
|
+
if (!Array.isArray(result.taskArns) || result.taskArns.length > 100 || !result.taskArns.every(validText))
|
|
52469
|
+
throw Error("Incomplete ECS task listing");
|
|
52470
|
+
arns.push(...result.taskArns);
|
|
52471
|
+
if (new Set(arns).size !== arns.length)
|
|
52472
|
+
throw Error("Repeated ECS task identity in listing");
|
|
52473
|
+
if (result.nextToken === undefined)
|
|
52474
|
+
return arns;
|
|
52475
|
+
if (!validText(result.nextToken) || tokens.has(result.nextToken))
|
|
52476
|
+
throw Error("Invalid ECS pagination cursor");
|
|
52477
|
+
tokens.add(result.nextToken);
|
|
52478
|
+
nextToken = result.nextToken;
|
|
52479
|
+
}
|
|
52480
|
+
throw Error("ECS task listing exceeded the bounded page limit");
|
|
52394
52481
|
},
|
|
52395
52482
|
async describeTasks(taskArns) {
|
|
52396
|
-
|
|
52397
|
-
|
|
52398
|
-
|
|
52399
|
-
|
|
52400
|
-
|
|
52401
|
-
|
|
52402
|
-
}));
|
|
52483
|
+
if (!taskArns.length || taskArns.length > 100 || !taskArns.every(validText) || new Set(taskArns).size !== taskArns.length)
|
|
52484
|
+
throw Error("Invalid ECS task identities");
|
|
52485
|
+
const result = response(await client.send(new DescribeTasksCommand({ cluster: cluster(), tasks: taskArns })));
|
|
52486
|
+
if (!Array.isArray(result.tasks) || result.tasks.length !== taskArns.length || new Set(result.tasks.map((task) => task?.taskArn)).size !== taskArns.length || result.tasks.some((task) => !taskArns.includes(task?.taskArn) || !validText(task?.lastStatus)))
|
|
52487
|
+
throw Error("Incomplete ECS task descriptions");
|
|
52488
|
+
return result.tasks.map((task) => ({ taskArn: task.taskArn, lastStatus: task.lastStatus, stopCode: task.stopCode ?? null, exitCode: task.containers?.[0]?.exitCode ?? null }));
|
|
52403
52489
|
},
|
|
52404
52490
|
async stopTask(taskArn) {
|
|
52405
|
-
|
|
52491
|
+
if (!validText(taskArn))
|
|
52492
|
+
throw Error("Invalid ECS task identity");
|
|
52493
|
+
const result = response(await client.send(new StopTaskCommand({ cluster: cluster(), task: taskArn })));
|
|
52494
|
+
if (result.task?.taskArn !== taskArn || !validText(result.task?.lastStatus))
|
|
52495
|
+
throw Error("Incomplete ECS stop response");
|
|
52406
52496
|
}
|
|
52407
52497
|
};
|
|
52408
52498
|
}
|
|
52499
|
+
function validText(value) {
|
|
52500
|
+
return typeof value === "string" && value.length > 0 && value.trim() === value && value.length <= 2048;
|
|
52501
|
+
}
|
|
52409
52502
|
// src/sdk/execution/dispatchers/e2b.ts
|
|
52410
52503
|
var E2B_LANE_STATUS = "e2b-lane-todo-infinity";
|
|
52411
52504
|
|
|
@@ -53097,8 +53190,17 @@ function creditCount(value) {
|
|
|
53097
53190
|
}
|
|
53098
53191
|
return value;
|
|
53099
53192
|
}
|
|
53193
|
+
function runQuoteReceipt(value) {
|
|
53194
|
+
if (value === undefined)
|
|
53195
|
+
return;
|
|
53196
|
+
if (typeof value !== "string" || !value.length || Buffer.byteLength(value, "utf8") > 4096) {
|
|
53197
|
+
throw new Error("Invalid quote receipt");
|
|
53198
|
+
}
|
|
53199
|
+
return value;
|
|
53200
|
+
}
|
|
53100
53201
|
function parseRemoteRunQuote(value) {
|
|
53101
53202
|
const quote = object(value);
|
|
53203
|
+
runQuoteReceipt(quote.quoteReceipt);
|
|
53102
53204
|
const pricing = object(quote.pricing);
|
|
53103
53205
|
if (typeof quote.skill !== "string" || !/^[a-z0-9][a-z0-9-]*$/.test(quote.skill))
|
|
53104
53206
|
throw new Error("Invalid quoted skill");
|
|
@@ -53383,7 +53485,7 @@ class RemoteSkillsClient {
|
|
|
53383
53485
|
this.apiUrl = normalizeSkillsApiOrigin(apiUrl);
|
|
53384
53486
|
}
|
|
53385
53487
|
async request(path, options) {
|
|
53386
|
-
return fetch(
|
|
53488
|
+
return fetch(skillsApiRequestUrl(this.apiUrl, path), {
|
|
53387
53489
|
...options,
|
|
53388
53490
|
redirect: "error",
|
|
53389
53491
|
credentials: "omit",
|
|
@@ -53443,6 +53545,7 @@ class RemoteSkillsClient {
|
|
|
53443
53545
|
return { status: res.status, body };
|
|
53444
53546
|
}
|
|
53445
53547
|
async submitRun(slug, input, args, approval = {}) {
|
|
53548
|
+
const quoteReceipt = runQuoteReceipt(approval.quoteReceipt);
|
|
53446
53549
|
if (approval.idempotencyKey !== undefined && !/^[A-Za-z0-9._:-]{1,128}$/.test(approval.idempotencyKey))
|
|
53447
53550
|
throw new Error("Idempotency key must be 1-128 URL-safe characters");
|
|
53448
53551
|
if (approval.maxCostCents !== undefined)
|
|
@@ -53459,15 +53562,20 @@ class RemoteSkillsClient {
|
|
|
53459
53562
|
...approval.maxCredits !== undefined ? { maxCredits: approval.maxCredits } : {},
|
|
53460
53563
|
...approval.maxCostCents !== undefined ? { maxCostCents: approval.maxCostCents } : {},
|
|
53461
53564
|
...approval.idempotencyKey !== undefined ? { idempotencyKey: approval.idempotencyKey } : {},
|
|
53462
|
-
...approval.inputFiles !== undefined ? { files: approval.inputFiles } : {}
|
|
53565
|
+
...approval.inputFiles !== undefined ? { files: approval.inputFiles } : {},
|
|
53566
|
+
...quoteReceipt !== undefined ? { quoteReceipt } : {}
|
|
53463
53567
|
})
|
|
53464
53568
|
});
|
|
53569
|
+
if (!res.ok) {
|
|
53570
|
+
res.body?.cancel().catch(() => {});
|
|
53571
|
+
throw new RemoteRequestError(`/api/v1/runs/${encodeURIComponent(slug)}`, res.status);
|
|
53572
|
+
}
|
|
53465
53573
|
return normalizeRemoteSkillRunContract(await res.json(), slug);
|
|
53466
53574
|
}
|
|
53467
|
-
async quoteRun(slug, input = {}, args = []) {
|
|
53575
|
+
async quoteRun(slug, input = {}, args = [], files) {
|
|
53468
53576
|
const response = await this.requestNewRoute(`/api/v1/skills/${encodeURIComponent(slug)}/quote`, {
|
|
53469
53577
|
method: "POST",
|
|
53470
|
-
body: JSON.stringify({ input, args })
|
|
53578
|
+
body: JSON.stringify({ input, args, ...files === undefined ? {} : { files } })
|
|
53471
53579
|
}, { quoteRefusal: true });
|
|
53472
53580
|
return parseRemoteRunQuote(await response.json());
|
|
53473
53581
|
}
|
|
@@ -53483,17 +53591,24 @@ class RemoteSkillsClient {
|
|
|
53483
53591
|
return this.capabilities;
|
|
53484
53592
|
}
|
|
53485
53593
|
async submitQuotedRun(slug, input = {}, args = [], approval = {}) {
|
|
53594
|
+
runQuoteReceipt(approval.quoteReceipt);
|
|
53595
|
+
({ input, args, approval } = JSON.parse(JSON.stringify({ input, args, approval })));
|
|
53486
53596
|
const maximum = creditCount(approval.maxCredits ?? approval.maxCostCents ?? 0);
|
|
53487
53597
|
if (approval.maxCostCents !== undefined && approval.maxCostCents !== maximum)
|
|
53488
53598
|
throw new Error("Credit approval fields disagree");
|
|
53489
|
-
const quote = await this.quoteRun(slug, input, args);
|
|
53490
|
-
if (quote.pricing.costCents > maximum)
|
|
53599
|
+
const quote = approval.quoteReceipt === undefined ? await this.quoteRun(slug, input, args, approval.inputFiles?.length ? approval.inputFiles : undefined) : undefined;
|
|
53600
|
+
if (quote && quote.pricing.costCents > maximum)
|
|
53491
53601
|
throw new RemoteCreditApprovalError(quote.pricing.costCents, maximum);
|
|
53492
53602
|
const capabilities = await this.getCapabilities();
|
|
53493
53603
|
if (!capabilities.capabilities.includes("runs.submit") || capabilities.billing?.boundedRunApproval !== true || capabilities.billing.unit !== "credits") {
|
|
53494
53604
|
throw new Error("The configured server does not support bounded credit approval; refusing remote submission");
|
|
53495
53605
|
}
|
|
53496
|
-
return this.submitRun(quote
|
|
53606
|
+
return this.submitRun(quote?.skill ?? slug, input, args, {
|
|
53607
|
+
...approval,
|
|
53608
|
+
maxCredits: maximum,
|
|
53609
|
+
maxCostCents: maximum,
|
|
53610
|
+
...(quote?.quoteReceipt ?? approval.quoteReceipt) === undefined ? {} : { quoteReceipt: quote?.quoteReceipt ?? approval.quoteReceipt }
|
|
53611
|
+
});
|
|
53497
53612
|
}
|
|
53498
53613
|
async getIdentity() {
|
|
53499
53614
|
return (await this.requestNewRoute("/api/auth/whoami")).json();
|
|
@@ -53781,6 +53896,10 @@ class RemoteSkillsClient {
|
|
|
53781
53896
|
return { id: artifactId2, fileName: String(artifact.fileName ?? artifactId2), bytes, byteSize: bytes.byteLength, sha256: artifact.sha256 };
|
|
53782
53897
|
}
|
|
53783
53898
|
async submitQuotedRunWithFiles(slug, input, args, files, approval = {}) {
|
|
53899
|
+
runQuoteReceipt(approval.quoteReceipt);
|
|
53900
|
+
({ input, args, approval } = JSON.parse(JSON.stringify({ input, args, approval })));
|
|
53901
|
+
describeRemoteFiles(files);
|
|
53902
|
+
files = files.map((file) => ({ name: file.name, contentType: file.contentType, bytes: new Uint8Array(file.bytes) }));
|
|
53784
53903
|
const inputFiles = describeRemoteFiles(files);
|
|
53785
53904
|
if (files.length && !(await this.getCapabilities()).capabilities.includes("runs.uploads"))
|
|
53786
53905
|
throw new Error("The configured server does not support input uploads");
|
|
@@ -53844,7 +53963,7 @@ class RemoteSkillsClient {
|
|
|
53844
53963
|
const headers = { Authorization: `Bearer ${this.apiKey}` };
|
|
53845
53964
|
if (ifMatch)
|
|
53846
53965
|
headers["If-Match"] = ifMatch;
|
|
53847
|
-
return fetch(
|
|
53966
|
+
return fetch(skillsApiRequestUrl(this.apiUrl, "/api/v1/skills"), {
|
|
53848
53967
|
method: "POST",
|
|
53849
53968
|
headers,
|
|
53850
53969
|
body: form,
|
|
@@ -54129,7 +54248,7 @@ async function requestInvitationEmail(origin, action, input) {
|
|
|
54129
54248
|
}
|
|
54130
54249
|
const body = JSON.stringify({ invitationId: value.invitationId, token: value.token, challengeId: value.challengeId, ...action === "accept" ? { code: value.code } : {} });
|
|
54131
54250
|
try {
|
|
54132
|
-
const response = await fetch(
|
|
54251
|
+
const response = await fetch(skillsApiRequestUrl(target, `/api/v1/account/invitations/email-${action}`), {
|
|
54133
54252
|
method: "POST",
|
|
54134
54253
|
headers: { "Content-Type": "application/json" },
|
|
54135
54254
|
body,
|
|
@@ -54160,6 +54279,312 @@ async function requestInvitationEmail(origin, action, input) {
|
|
|
54160
54279
|
throw new RemoteInvitationEmailUnconfirmedError(action);
|
|
54161
54280
|
}
|
|
54162
54281
|
|
|
54282
|
+
// src/lib/remote-private-publications.ts
|
|
54283
|
+
import { createHash as createHash14 } from "crypto";
|
|
54284
|
+
var PRIVATE_PUBLICATION_MAX_BYTES = 16 * 1024 * 1024;
|
|
54285
|
+
var failures = {
|
|
54286
|
+
INVALID_REQUEST: [400, "The publication request is invalid."],
|
|
54287
|
+
SESSION_EXPIRED: [401, "Sign in again to manage this publication."],
|
|
54288
|
+
ACCOUNT_UNAVAILABLE: [403, "The account is unavailable."],
|
|
54289
|
+
INTERACTIVE_SESSION_REQUIRED: [403, "An interactive account session is required."],
|
|
54290
|
+
PUBLICATION_FORBIDDEN: [403, "This session cannot manage the publication."],
|
|
54291
|
+
PUBLICATION_ENTITLEMENT_REQUIRED: [403, "The workspace is not entitled to publish private skills."],
|
|
54292
|
+
PUBLICATION_UNAVAILABLE: [404, "The publication is unavailable to this session."],
|
|
54293
|
+
MANIFEST_NAME_MISMATCH: [409, "The manifest name does not match the selected skill."],
|
|
54294
|
+
IDEMPOTENCY_CONFLICT: [409, "This request key already identifies different publication bytes. Use the saved recovery directory."],
|
|
54295
|
+
CURRENT_VERSION_CHANGED: [409, "The current version changed. Inspect it before explicitly starting another publication."],
|
|
54296
|
+
VERSION_EXISTS: [409, "This version already exists."],
|
|
54297
|
+
VERSION_RESERVED: [409, "This version is reserved by another publication."],
|
|
54298
|
+
PUBLICATION_COMMITTED: [409, "The publication is already committed."],
|
|
54299
|
+
PUBLICATION_UPLOAD_UNAVAILABLE: [409, "This publication cannot receive another upload."],
|
|
54300
|
+
PUBLICATION_LIMIT: [429, "The workspace publication limit has been reached."],
|
|
54301
|
+
PUBLICATION_BUSY: [503, "The publication is busy. Reconcile the saved intent before retrying."],
|
|
54302
|
+
PUBLICATION_UNCERTAIN: [503, "The publication outcome is uncertain. Reconcile the saved intent."],
|
|
54303
|
+
PUBLICATION_CAPABILITY_UNAVAILABLE: [503, "Private publishing is not enabled on this server."],
|
|
54304
|
+
PUBLICATION_SIGNING_UNAVAILABLE: [503, "Upload authorization is temporarily unavailable. Keep the same intent."]
|
|
54305
|
+
};
|
|
54306
|
+
|
|
54307
|
+
class PrivatePublicationError extends Error {
|
|
54308
|
+
code;
|
|
54309
|
+
uncertain;
|
|
54310
|
+
status;
|
|
54311
|
+
constructor(code, message, uncertain = false, status) {
|
|
54312
|
+
super(message);
|
|
54313
|
+
this.code = code;
|
|
54314
|
+
this.uncertain = uncertain;
|
|
54315
|
+
this.status = status;
|
|
54316
|
+
this.name = "PrivatePublicationError";
|
|
54317
|
+
}
|
|
54318
|
+
}
|
|
54319
|
+
var bad = () => {
|
|
54320
|
+
throw new PrivatePublicationError("INVALID_PUBLICATION_INPUT", "Invalid publication input or recovery data.");
|
|
54321
|
+
};
|
|
54322
|
+
var invalid3 = () => {
|
|
54323
|
+
throw new PrivatePublicationError("INVALID_PUBLICATION_RESPONSE", "The server returned an invalid publication result.");
|
|
54324
|
+
};
|
|
54325
|
+
var publicationUuid = (v2) => typeof v2 === "string" && /^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/.test(v2);
|
|
54326
|
+
var hash = (v2) => typeof v2 === "string" && /^[a-f0-9]{64}$/.test(v2);
|
|
54327
|
+
var record5 = (v2) => !!v2 && typeof v2 === "object" && !Array.isArray(v2);
|
|
54328
|
+
var exact = (v2, keys) => record5(v2) && Object.keys(v2).sort().join(",") === keys.sort().join(",");
|
|
54329
|
+
var date = (v2) => typeof v2 === "string" && /^\d{4}-\d\d-\d\dT[0-9:.]+(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/.test(v2) && Number.isFinite(Date.parse(v2));
|
|
54330
|
+
var publicationSha256 = (bytes) => createHash14("sha256").update(bytes).digest("hex");
|
|
54331
|
+
function checkedPublicationDeclaration(value) {
|
|
54332
|
+
if (!exact(value, ["idempotencyKey", "version", "expectedCurrentVersionId", "manifestText", "archiveSha256", "archiveByteSize"]) || !publicationUuid(value.idempotencyKey) || !(value.expectedCurrentVersionId === null || publicationUuid(value.expectedCurrentVersionId)) || typeof value.version !== "string" || !value.version || value.version.length > 128 || /[\p{Cc}\p{Cs}]/u.test(value.version) || typeof value.manifestText !== "string" || Buffer.byteLength(value.manifestText) > 16384 || !hash(value.archiveSha256) || !Number.isSafeInteger(value.archiveByteSize) || Number(value.archiveByteSize) < 1 || Number(value.archiveByteSize) > PRIVATE_PUBLICATION_MAX_BYTES)
|
|
54333
|
+
return bad();
|
|
54334
|
+
try {
|
|
54335
|
+
const manifest = JSON.parse(value.manifestText);
|
|
54336
|
+
if (!record5(manifest) || manifest.version !== value.version || validatePortableManifestContract(manifest, { strict: true }).length || !hash(manifest.provenance?.content_hash))
|
|
54337
|
+
return bad();
|
|
54338
|
+
} catch {
|
|
54339
|
+
return bad();
|
|
54340
|
+
}
|
|
54341
|
+
return Object.freeze({ ...value });
|
|
54342
|
+
}
|
|
54343
|
+
function checkedPublicationView(value, skillId, intentId, declaration) {
|
|
54344
|
+
if (!exact(value, ["id", "skillId", "version", "expectedCurrentVersionId", "archiveSha256", "archiveByteSize", "state", "expiresAt", "createdAt", "versionId"]) || !publicationUuid(value.id) || value.skillId !== skillId || intentId !== undefined && value.id !== intentId || typeof value.version !== "string" || !value.version || value.version.length > 128 || /[\p{Cc}\p{Cs}]/u.test(value.version) || !(value.expectedCurrentVersionId === null || publicationUuid(value.expectedCurrentVersionId)) || !hash(value.archiveSha256) || !Number.isSafeInteger(value.archiveByteSize) || Number(value.archiveByteSize) < 1 || Number(value.archiveByteSize) > PRIVATE_PUBLICATION_MAX_BYTES || typeof value.state !== "string" || !["awaiting_upload", "queued", "verifying", "needs_attention", "committed", "rejected", "cancelled", "expired"].includes(value.state) || !date(value.expiresAt) || !date(value.createdAt) || !(value.versionId === null || publicationUuid(value.versionId)) || value.state === "committed" && value.versionId === null)
|
|
54345
|
+
return invalid3();
|
|
54346
|
+
if (declaration && ["version", "expectedCurrentVersionId", "archiveSha256", "archiveByteSize"].some((k4) => value[k4] !== declaration[k4]))
|
|
54347
|
+
return invalid3();
|
|
54348
|
+
return Object.freeze({ ...value });
|
|
54349
|
+
}
|
|
54350
|
+
async function boundedJson(url, init, token, mutation, budget = 15000, signal) {
|
|
54351
|
+
const controller = new AbortController;
|
|
54352
|
+
let reader;
|
|
54353
|
+
let response;
|
|
54354
|
+
const timeout = new PrivatePublicationError("PUBLICATION_UNCONFIRMED", "No confirmed publication result. Inspect the saved intent before retrying.", mutation);
|
|
54355
|
+
let timer;
|
|
54356
|
+
let abort;
|
|
54357
|
+
try {
|
|
54358
|
+
return await Promise.race([(async () => {
|
|
54359
|
+
if (signal?.aborted)
|
|
54360
|
+
throw timeout;
|
|
54361
|
+
response = await fetch(url, {
|
|
54362
|
+
...init,
|
|
54363
|
+
redirect: "error",
|
|
54364
|
+
credentials: "omit",
|
|
54365
|
+
signal: controller.signal,
|
|
54366
|
+
headers: { "Content-Type": "application/json", Authorization: `Bearer ${token}` }
|
|
54367
|
+
});
|
|
54368
|
+
const length = response.headers.get("content-length");
|
|
54369
|
+
if (length !== null && (!/^\d+$/.test(length) || Number(length) > 65536))
|
|
54370
|
+
return invalid3();
|
|
54371
|
+
reader = response.body?.getReader();
|
|
54372
|
+
const chunks = [];
|
|
54373
|
+
let size = 0;
|
|
54374
|
+
if (reader)
|
|
54375
|
+
while (true) {
|
|
54376
|
+
const part = await reader.read();
|
|
54377
|
+
if (part.done)
|
|
54378
|
+
break;
|
|
54379
|
+
size += part.value.byteLength;
|
|
54380
|
+
if (size > 65536)
|
|
54381
|
+
return invalid3();
|
|
54382
|
+
chunks.push(part.value);
|
|
54383
|
+
}
|
|
54384
|
+
if (controller.signal.aborted)
|
|
54385
|
+
throw timeout;
|
|
54386
|
+
const bytes = Buffer.concat(chunks);
|
|
54387
|
+
let body;
|
|
54388
|
+
try {
|
|
54389
|
+
body = JSON.parse(new TextDecoder("utf-8", { fatal: true }).decode(bytes));
|
|
54390
|
+
} catch {
|
|
54391
|
+
return invalid3();
|
|
54392
|
+
}
|
|
54393
|
+
if (!response.ok) {
|
|
54394
|
+
const code = record5(body) && typeof body.code === "string" && Object.hasOwn(failures, body.code) ? body.code : null;
|
|
54395
|
+
if (code && failures[code][0] === response.status)
|
|
54396
|
+
throw new PrivatePublicationError(code, failures[code][1], mutation && code === "PUBLICATION_UNCERTAIN", response.status);
|
|
54397
|
+
throw new PrivatePublicationError("PUBLICATION_REQUEST_FAILED", "The publication request was refused. Inspect its status before retrying.", mutation && response.status >= 500, response.status);
|
|
54398
|
+
}
|
|
54399
|
+
return body;
|
|
54400
|
+
})(), new Promise((_, reject) => {
|
|
54401
|
+
abort = () => {
|
|
54402
|
+
controller.abort();
|
|
54403
|
+
reject(timeout);
|
|
54404
|
+
};
|
|
54405
|
+
timer = setTimeout(abort, Math.max(1, Math.min(15000, budget)));
|
|
54406
|
+
signal?.addEventListener("abort", abort, { once: true });
|
|
54407
|
+
})]);
|
|
54408
|
+
} catch (error) {
|
|
54409
|
+
if (error instanceof PrivatePublicationError) {
|
|
54410
|
+
if (mutation && error.code === "INVALID_PUBLICATION_RESPONSE")
|
|
54411
|
+
throw timeout;
|
|
54412
|
+
throw error;
|
|
54413
|
+
}
|
|
54414
|
+
throw timeout;
|
|
54415
|
+
} finally {
|
|
54416
|
+
if (timer)
|
|
54417
|
+
clearTimeout(timer);
|
|
54418
|
+
if (abort)
|
|
54419
|
+
signal?.removeEventListener("abort", abort);
|
|
54420
|
+
controller.abort();
|
|
54421
|
+
if (reader)
|
|
54422
|
+
reader.cancel().catch(() => {});
|
|
54423
|
+
else
|
|
54424
|
+
response?.body?.cancel().catch(() => {});
|
|
54425
|
+
}
|
|
54426
|
+
}
|
|
54427
|
+
|
|
54428
|
+
class RemotePrivatePublicationsClient {
|
|
54429
|
+
apiOrigin;
|
|
54430
|
+
organizationId;
|
|
54431
|
+
userId;
|
|
54432
|
+
membershipId;
|
|
54433
|
+
#token;
|
|
54434
|
+
constructor(apiUrl, session) {
|
|
54435
|
+
const checked = parseWorkspaceSession(session, { userId: session?.user?.id, membershipId: session?.user?.membershipId });
|
|
54436
|
+
if (checked.user.role === "viewer")
|
|
54437
|
+
throw new PrivatePublicationError("PUBLICATION_FORBIDDEN", failures.PUBLICATION_FORBIDDEN[1]);
|
|
54438
|
+
this.apiOrigin = normalizeSkillsApiOrigin(apiUrl);
|
|
54439
|
+
this.#token = checked.token;
|
|
54440
|
+
this.organizationId = checked.organization.id;
|
|
54441
|
+
this.userId = checked.user.id;
|
|
54442
|
+
this.membershipId = checked.user.membershipId;
|
|
54443
|
+
Object.freeze(this);
|
|
54444
|
+
}
|
|
54445
|
+
async getCapability(options = {}) {
|
|
54446
|
+
if (options.timeoutMs !== undefined && (!Number.isSafeInteger(options.timeoutMs) || options.timeoutMs < 1 || options.timeoutMs > 15000))
|
|
54447
|
+
return bad();
|
|
54448
|
+
const response = await boundedJson(skillsApiRequestUrl(this.apiOrigin, "/api/v1/capabilities"), {}, this.#token, false, options.timeoutMs, options.signal);
|
|
54449
|
+
const p2 = record5(response) && response.privatePublishing;
|
|
54450
|
+
if (!record5(response) || response.contractVersion !== 1 || response.apiVersion !== 1 || !exact(p2, ["contractVersion", "enabled", "authentication", "maxArchiveBytes", "uploadMaxTtlSeconds", "executionEnabled"]) || p2.contractVersion !== 1 || typeof p2.enabled !== "boolean" || p2.authentication !== "interactive-session" || p2.maxArchiveBytes !== PRIVATE_PUBLICATION_MAX_BYTES || p2.uploadMaxTtlSeconds !== 300 || p2.executionEnabled !== false)
|
|
54451
|
+
throw new PrivatePublicationError("PUBLICATION_CONTRACT_UNAVAILABLE", "This server does not support the hosted private publication contract.");
|
|
54452
|
+
return Object.freeze({ ...p2 });
|
|
54453
|
+
}
|
|
54454
|
+
async#gate(enabled, options = {}) {
|
|
54455
|
+
if (!(await this.getCapability(options)).enabled && enabled)
|
|
54456
|
+
throw new PrivatePublicationError("PUBLICATION_CAPABILITY_UNAVAILABLE", failures.PUBLICATION_CAPABILITY_UNAVAILABLE[1]);
|
|
54457
|
+
}
|
|
54458
|
+
#path(skillId, intentId) {
|
|
54459
|
+
if (!publicationUuid(skillId) || intentId !== undefined && !publicationUuid(intentId))
|
|
54460
|
+
return bad();
|
|
54461
|
+
return skillsApiRequestUrl(this.apiOrigin, `/api/v1/skills/${skillId}/publication-uploads${intentId ? `/${intentId}` : ""}`);
|
|
54462
|
+
}
|
|
54463
|
+
async#view(path, method, skillId, intentId, declaration, options = {}) {
|
|
54464
|
+
const value = await boundedJson(path, { method, ...method === "GET" ? {} : { body: JSON.stringify(declaration ?? {}) } }, this.#token, method !== "GET", options.timeoutMs, options.signal);
|
|
54465
|
+
try {
|
|
54466
|
+
if (!record5(value) || !Object.keys(value).every((k4) => k4 === "upload" || k4 === "changed") || value.changed !== undefined && typeof value.changed !== "boolean")
|
|
54467
|
+
return invalid3();
|
|
54468
|
+
return checkedPublicationView(value.upload, skillId, intentId, declaration);
|
|
54469
|
+
} catch (error) {
|
|
54470
|
+
if (method !== "GET")
|
|
54471
|
+
throw new PrivatePublicationError("PUBLICATION_UNCONFIRMED", "The publication result could not be confirmed. Reconcile the saved intent before another action.", true);
|
|
54472
|
+
throw error;
|
|
54473
|
+
}
|
|
54474
|
+
}
|
|
54475
|
+
async begin(skillId, input) {
|
|
54476
|
+
const path = this.#path(skillId), declaration = checkedPublicationDeclaration(input);
|
|
54477
|
+
await this.#gate(true);
|
|
54478
|
+
return this.#view(path, "POST", skillId, undefined, declaration);
|
|
54479
|
+
}
|
|
54480
|
+
async get(skillId, intentId, options = {}) {
|
|
54481
|
+
const path = this.#path(skillId, intentId), until = Date.now() + (options.timeoutMs ?? 15000);
|
|
54482
|
+
await this.#gate(false, options);
|
|
54483
|
+
return this.#view(path, "GET", skillId, intentId, undefined, { ...options, timeoutMs: Math.max(1, until - Date.now()) });
|
|
54484
|
+
}
|
|
54485
|
+
async finalize(skillId, intentId) {
|
|
54486
|
+
const path = this.#path(skillId, intentId);
|
|
54487
|
+
await this.#gate(true);
|
|
54488
|
+
return this.#view(`${path}/finalize`, "POST", skillId, intentId);
|
|
54489
|
+
}
|
|
54490
|
+
async cancel(skillId, intentId) {
|
|
54491
|
+
const path = this.#path(skillId, intentId);
|
|
54492
|
+
await this.#gate(false);
|
|
54493
|
+
return this.#view(path, "DELETE", skillId, intentId);
|
|
54494
|
+
}
|
|
54495
|
+
async upload(skillId, intent, bytes) {
|
|
54496
|
+
const captured = checkedPublicationView(intent, skillId), path = this.#path(skillId, captured.id);
|
|
54497
|
+
if (!(bytes instanceof Uint8Array) || bytes.byteLength !== captured.archiveByteSize)
|
|
54498
|
+
return bad();
|
|
54499
|
+
const owned = Buffer.from(bytes);
|
|
54500
|
+
if (captured.state !== "awaiting_upload" || owned.byteLength !== captured.archiveByteSize || publicationSha256(owned) !== captured.archiveSha256)
|
|
54501
|
+
return bad();
|
|
54502
|
+
await this.#gate(true);
|
|
54503
|
+
const value = await boundedJson(`${path}/upload-url`, { method: "POST", body: "{}" }, this.#token, false);
|
|
54504
|
+
const upload = this.#upload(value, captured);
|
|
54505
|
+
const controller = new AbortController;
|
|
54506
|
+
let timer;
|
|
54507
|
+
const uncertain = () => new PrivatePublicationError("PUBLICATION_UPLOAD_UNCONFIRMED", "Upload acceptance is uncertain. Resume this saved intent to finalize and inspect it; do not upload again.", true);
|
|
54508
|
+
try {
|
|
54509
|
+
await Promise.race([(async () => {
|
|
54510
|
+
const response = await fetch(upload.uploadUrl, { method: "PUT", headers: upload.headers, body: owned, redirect: "error", credentials: "omit", signal: controller.signal });
|
|
54511
|
+
response.body?.cancel().catch(() => {});
|
|
54512
|
+
if (response.status !== 200 || controller.signal.aborted)
|
|
54513
|
+
throw uncertain();
|
|
54514
|
+
})(), new Promise((_, reject) => {
|
|
54515
|
+
timer = setTimeout(() => {
|
|
54516
|
+
controller.abort();
|
|
54517
|
+
reject(uncertain());
|
|
54518
|
+
}, 30000);
|
|
54519
|
+
})]);
|
|
54520
|
+
} catch {
|
|
54521
|
+
throw uncertain();
|
|
54522
|
+
} finally {
|
|
54523
|
+
if (timer)
|
|
54524
|
+
clearTimeout(timer);
|
|
54525
|
+
controller.abort();
|
|
54526
|
+
}
|
|
54527
|
+
}
|
|
54528
|
+
#upload(value, intent) {
|
|
54529
|
+
if (!exact(value, ["upload"]) || !exact(value.upload, ["method", "uploadUrl", "headers", "expiresAt"]))
|
|
54530
|
+
return invalid3();
|
|
54531
|
+
const p2 = value.upload;
|
|
54532
|
+
if (p2.method !== "PUT" || typeof p2.uploadUrl !== "string" || p2.uploadUrl.length > 8192 || /[\x00-\x20\x7f]/.test(p2.uploadUrl) || !date(p2.expiresAt) || Date.parse(p2.expiresAt) - Date.now() < 1000 || Date.parse(p2.expiresAt) - Date.now() > 300000 || Date.parse(p2.expiresAt) > Date.parse(intent.expiresAt) || !exact(p2.headers, ["content-type", "content-length", "x-amz-checksum-sha256", "x-amz-expected-bucket-owner"]) || p2.headers["content-type"] !== "application/gzip" || p2.headers["content-length"] !== String(intent.archiveByteSize) || p2.headers["x-amz-checksum-sha256"] !== Buffer.from(intent.archiveSha256, "hex").toString("base64") || typeof p2.headers["x-amz-expected-bucket-owner"] !== "string" || !/^\d{12}$/.test(p2.headers["x-amz-expected-bucket-owner"]))
|
|
54533
|
+
return invalid3();
|
|
54534
|
+
let url;
|
|
54535
|
+
try {
|
|
54536
|
+
url = new URL(p2.uploadUrl);
|
|
54537
|
+
} catch {
|
|
54538
|
+
return invalid3();
|
|
54539
|
+
}
|
|
54540
|
+
if (url.protocol !== "https:" || url.port || url.username || url.password || url.hash || !/^[a-z0-9][a-z0-9-]{1,61}[a-z0-9]\.s3\.[a-z]{2}(?:-[a-z]+)+-[1-9]\.amazonaws\.com$/.test(url.hostname) || url.pathname !== `/private-publication-staging/${this.organizationId}/${intent.id}/bundle.tgz` || !url.search || url.searchParams.get("X-Amz-Algorithm") !== "AWS4-HMAC-SHA256" || url.searchParams.get("X-Amz-SignedHeaders") !== "content-length;content-type;host;x-amz-checksum-sha256;x-amz-expected-bucket-owner" || !/^[a-f0-9]{64}$/.test(url.searchParams.get("X-Amz-Signature") ?? ""))
|
|
54541
|
+
return invalid3();
|
|
54542
|
+
const queryKeys = ["X-Amz-Algorithm", "X-Amz-Credential", "X-Amz-Date", "X-Amz-Expires", "X-Amz-Security-Token", "X-Amz-Signature", "X-Amz-SignedHeaders"];
|
|
54543
|
+
if ([...url.searchParams.keys()].sort().join(",") !== queryKeys.sort().join(","))
|
|
54544
|
+
return invalid3();
|
|
54545
|
+
const issued = url.searchParams.get("X-Amz-Date"), ttl = url.searchParams.get("X-Amz-Expires"), credential = url.searchParams.get("X-Amz-Credential");
|
|
54546
|
+
const timestamp3 = /^(\d{4})(\d\d)(\d\d)T(\d\d)(\d\d)(\d\d)Z$/.exec(issued);
|
|
54547
|
+
const region = url.hostname.split(".s3.")[1].split(".amazonaws.com")[0];
|
|
54548
|
+
if (!timestamp3 || !/^[1-9]\d{0,2}$/.test(ttl) || Number(ttl) > 300 || !/^[A-Z0-9]{16,128}\//.test(credential) || credential.split("/").slice(1).join("/") !== `${issued.slice(0, 8)}/${region}/s3/aws4_request` || !/^[\x21-\x7e]{1,4096}$/.test(url.searchParams.get("X-Amz-Security-Token")))
|
|
54549
|
+
return invalid3();
|
|
54550
|
+
const issuedAt = Date.parse(`${timestamp3[1]}-${timestamp3[2]}-${timestamp3[3]}T${timestamp3[4]}:${timestamp3[5]}:${timestamp3[6]}Z`);
|
|
54551
|
+
if (!Number.isFinite(issuedAt) || issuedAt > Date.now() + 1000 || issuedAt + Number(ttl) * 1000 !== Date.parse(p2.expiresAt))
|
|
54552
|
+
return invalid3();
|
|
54553
|
+
return { method: "PUT", uploadUrl: url.href, expiresAt: p2.expiresAt, headers: Object.freeze({ ...p2.headers }) };
|
|
54554
|
+
}
|
|
54555
|
+
async wait(skillId, intentId, options = {}) {
|
|
54556
|
+
const timeout = options.timeoutMs ?? 60000;
|
|
54557
|
+
if (!Number.isSafeInteger(timeout) || timeout < 0 || timeout > 300000)
|
|
54558
|
+
return bad();
|
|
54559
|
+
const until = Date.now() + timeout;
|
|
54560
|
+
let previous;
|
|
54561
|
+
while (true) {
|
|
54562
|
+
if (options.signal?.aborted)
|
|
54563
|
+
throw new PrivatePublicationError("PUBLICATION_WAIT_ABORTED", "Stopped waiting. The server publication continues; inspect the saved intent.");
|
|
54564
|
+
let view;
|
|
54565
|
+
try {
|
|
54566
|
+
view = await this.get(skillId, intentId, { timeoutMs: timeout === 0 ? 15000 : Math.max(1, Math.min(15000, until - Date.now())), signal: options.signal });
|
|
54567
|
+
} catch (error) {
|
|
54568
|
+
if (previous && Date.now() >= until && !options.signal?.aborted)
|
|
54569
|
+
return previous;
|
|
54570
|
+
throw error;
|
|
54571
|
+
}
|
|
54572
|
+
previous = view;
|
|
54573
|
+
if (!["queued", "verifying"].includes(view.state) || Date.now() >= until)
|
|
54574
|
+
return view;
|
|
54575
|
+
await new Promise((resolve4) => {
|
|
54576
|
+
const timer = setTimeout(done, Math.min(1000, until - Date.now()));
|
|
54577
|
+
function done() {
|
|
54578
|
+
clearTimeout(timer);
|
|
54579
|
+
options.signal?.removeEventListener("abort", done);
|
|
54580
|
+
resolve4();
|
|
54581
|
+
}
|
|
54582
|
+
options.signal?.addEventListener("abort", done, { once: true });
|
|
54583
|
+
});
|
|
54584
|
+
}
|
|
54585
|
+
}
|
|
54586
|
+
}
|
|
54587
|
+
|
|
54163
54588
|
// src/lib/remote-auth.ts
|
|
54164
54589
|
var MAX_ERROR_DETAIL_LENGTH = 200;
|
|
54165
54590
|
|
|
@@ -54182,10 +54607,11 @@ class HostedApiError extends Error {
|
|
|
54182
54607
|
async function requestAuthApi(instance, path, options) {
|
|
54183
54608
|
const url = normalizeSkillsApiOrigin(instance);
|
|
54184
54609
|
const safeUrl = url;
|
|
54185
|
-
const
|
|
54610
|
+
const requestUrl = skillsApiRequestUrl(url, path);
|
|
54611
|
+
const endpoint = `${(options?.method || "GET").toUpperCase()} ${requestUrl}`;
|
|
54186
54612
|
let res;
|
|
54187
54613
|
try {
|
|
54188
|
-
res = await fetch(
|
|
54614
|
+
res = await fetch(requestUrl, {
|
|
54189
54615
|
...options,
|
|
54190
54616
|
redirect: "error",
|
|
54191
54617
|
signal: options?.signal ?? AbortSignal.timeout(15000),
|
|
@@ -54200,10 +54626,10 @@ async function requestAuthApi(instance, path, options) {
|
|
|
54200
54626
|
const text2 = await res.text();
|
|
54201
54627
|
const body = text2 ? parseJsonBody(text2) : {};
|
|
54202
54628
|
if (!res.ok) {
|
|
54203
|
-
const
|
|
54204
|
-
const detail = typeof
|
|
54205
|
-
const error = typeof
|
|
54206
|
-
const code = typeof
|
|
54629
|
+
const record6 = isRecord6(body) ? body : {};
|
|
54630
|
+
const detail = typeof record6.detail === "string" ? record6.detail : undefined;
|
|
54631
|
+
const error = typeof record6.error === "string" ? record6.error : undefined;
|
|
54632
|
+
const code = typeof record6.code === "string" ? record6.code : undefined;
|
|
54207
54633
|
throw new HostedApiError(detail || error || `${res.status} ${res.statusText}`, {
|
|
54208
54634
|
status: res.status,
|
|
54209
54635
|
code,
|
|
@@ -54237,6 +54663,10 @@ class RemoteSkillsAuthClient {
|
|
|
54237
54663
|
constructor(apiUrl) {
|
|
54238
54664
|
this.apiOrigin = normalizeSkillsApiOrigin(apiUrl);
|
|
54239
54665
|
}
|
|
54666
|
+
async openPrivatePublications(email2, code, context) {
|
|
54667
|
+
const origin = this.apiOrigin, captured = workspaceContext(context);
|
|
54668
|
+
return new RemotePrivatePublicationsClient(origin, await this.switchWorkspace(email2, code, captured));
|
|
54669
|
+
}
|
|
54240
54670
|
requestInvitationEmailChallenge(input) {
|
|
54241
54671
|
return requestInvitationEmail(this.apiOrigin, "challenge", input);
|
|
54242
54672
|
}
|
|
@@ -54284,9 +54714,10 @@ class RemoteSkillsAuthClient {
|
|
|
54284
54714
|
const apiOrigin = this.apiOrigin;
|
|
54285
54715
|
if (typeof email2 !== "string" || !email2.includes("@") || typeof code !== "string" || !/^\d{6}$/.test(code))
|
|
54286
54716
|
throw new Error("Fresh email and six-digit verification code are required to manage this account");
|
|
54717
|
+
const requestUrl = skillsApiRequestUrl(apiOrigin, "/api/auth/verify");
|
|
54287
54718
|
let response;
|
|
54288
54719
|
try {
|
|
54289
|
-
response = await fetch(
|
|
54720
|
+
response = await fetch(requestUrl, {
|
|
54290
54721
|
method: "POST",
|
|
54291
54722
|
redirect: "error",
|
|
54292
54723
|
credentials: "omit",
|
|
@@ -54377,144 +54808,387 @@ class RemoteSkillsAuthClient {
|
|
|
54377
54808
|
return requestAuthApi(this.apiOrigin, path, options);
|
|
54378
54809
|
}
|
|
54379
54810
|
}
|
|
54811
|
+
// src/lib/private-publication-recovery.ts
|
|
54812
|
+
import { constants as constants2, closeSync as closeSync3, fsyncSync, fstatSync as fstatSync3, lstatSync as lstatSync5, mkdirSync as mkdirSync8, openSync as openSync3, readSync as readSync2, realpathSync as realpathSync2, renameSync as renameSync3, unlinkSync, writeFileSync as writeFileSync6 } from "fs";
|
|
54813
|
+
import { dirname as dirname10, isAbsolute as isAbsolute5, join as join21, resolve as resolve4 } from "path";
|
|
54814
|
+
import { randomUUID as randomUUID6 } from "crypto";
|
|
54815
|
+
var fail = () => {
|
|
54816
|
+
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.");
|
|
54817
|
+
};
|
|
54818
|
+
function safeDirectory(directory) {
|
|
54819
|
+
if (!isAbsolute5(directory) || directory !== resolve4(directory) || realpathSync2(directory) !== directory)
|
|
54820
|
+
return fail();
|
|
54821
|
+
for (let path = directory;; path = dirname10(path)) {
|
|
54822
|
+
const stat = lstatSync5(path);
|
|
54823
|
+
if (!stat.isDirectory() || stat.isSymbolicLink())
|
|
54824
|
+
return fail();
|
|
54825
|
+
if (path === dirname10(path))
|
|
54826
|
+
break;
|
|
54827
|
+
}
|
|
54828
|
+
const own = lstatSync5(directory);
|
|
54829
|
+
if ((own.mode & 63) !== 0 || process.getuid && own.uid !== process.getuid())
|
|
54830
|
+
return fail();
|
|
54831
|
+
return { dev: own.dev, ino: own.ino };
|
|
54832
|
+
}
|
|
54833
|
+
function unchangedDirectory(directory, identity) {
|
|
54834
|
+
const now2 = safeDirectory(directory);
|
|
54835
|
+
if (now2.dev !== identity.dev || now2.ino !== identity.ino)
|
|
54836
|
+
return fail();
|
|
54837
|
+
}
|
|
54838
|
+
function readOwned(directory, name, max) {
|
|
54839
|
+
const identity = safeDirectory(directory), file = join21(directory, name);
|
|
54840
|
+
const fd = openSync3(file, constants2.O_RDONLY | constants2.O_NOFOLLOW);
|
|
54841
|
+
try {
|
|
54842
|
+
const stat = fstatSync3(fd);
|
|
54843
|
+
if (!stat.isFile() || stat.nlink !== 1 || stat.size > max || stat.size < 1 || (stat.mode & 63) !== 0 || process.getuid && stat.uid !== process.getuid())
|
|
54844
|
+
return fail();
|
|
54845
|
+
const buffer = Buffer.alloc(Math.min(max, stat.size) + 1);
|
|
54846
|
+
let length = 0;
|
|
54847
|
+
while (length < buffer.length) {
|
|
54848
|
+
const count = readSync2(fd, buffer, length, buffer.length - length, length);
|
|
54849
|
+
if (count === 0)
|
|
54850
|
+
break;
|
|
54851
|
+
length += count;
|
|
54852
|
+
}
|
|
54853
|
+
const bytes = buffer.subarray(0, length), after = fstatSync3(fd);
|
|
54854
|
+
unchangedDirectory(directory, identity);
|
|
54855
|
+
if (bytes.length !== stat.size || stat.size !== after.size || stat.mtimeMs !== after.mtimeMs || stat.ctimeMs !== after.ctimeMs)
|
|
54856
|
+
return fail();
|
|
54857
|
+
return bytes;
|
|
54858
|
+
} finally {
|
|
54859
|
+
closeSync3(fd);
|
|
54860
|
+
}
|
|
54861
|
+
}
|
|
54862
|
+
function writeOwned(directory, name, bytes) {
|
|
54863
|
+
const fd = openSync3(join21(directory, name), constants2.O_WRONLY | constants2.O_CREAT | constants2.O_EXCL | constants2.O_NOFOLLOW, 384);
|
|
54864
|
+
try {
|
|
54865
|
+
writeFileSync6(fd, bytes);
|
|
54866
|
+
fsyncSync(fd);
|
|
54867
|
+
} finally {
|
|
54868
|
+
closeSync3(fd);
|
|
54869
|
+
}
|
|
54870
|
+
}
|
|
54871
|
+
function save(directory, value) {
|
|
54872
|
+
const identity = safeDirectory(directory), temporary = `.receipt-${randomUUID6()}.json`;
|
|
54873
|
+
writeOwned(directory, temporary, JSON.stringify(value) + `
|
|
54874
|
+
`);
|
|
54875
|
+
unchangedDirectory(directory, identity);
|
|
54876
|
+
renameSync3(join21(directory, temporary), join21(directory, "receipt.json"));
|
|
54877
|
+
const fd = openSync3(directory, constants2.O_RDONLY | constants2.O_NOFOLLOW);
|
|
54878
|
+
try {
|
|
54879
|
+
fsyncSync(fd);
|
|
54880
|
+
} finally {
|
|
54881
|
+
closeSync3(fd);
|
|
54882
|
+
}
|
|
54883
|
+
}
|
|
54884
|
+
function bind(client, receipt) {
|
|
54885
|
+
if (["apiOrigin", "organizationId", "userId", "membershipId"].some((k4) => client[k4] !== receipt[k4]))
|
|
54886
|
+
throw new PrivatePublicationError("PUBLICATION_IDENTITY_CHANGED", "The fresh session does not match the recovery directory's server, account and membership.");
|
|
54887
|
+
}
|
|
54888
|
+
async function locked(directory, action) {
|
|
54889
|
+
const identity = safeDirectory(directory), file = join21(directory, "operation.lock");
|
|
54890
|
+
let fd;
|
|
54891
|
+
try {
|
|
54892
|
+
fd = openSync3(file, constants2.O_WRONLY | constants2.O_CREAT | constants2.O_EXCL | constants2.O_NOFOLLOW, 384);
|
|
54893
|
+
} catch {
|
|
54894
|
+
throw new PrivatePublicationError("PUBLICATION_RECOVERY_BUSY", "Another operation holds this recovery directory. If it crashed, confirm that process has stopped before explicitly removing operation.lock and resuming.");
|
|
54895
|
+
}
|
|
54896
|
+
const lock = fstatSync3(fd);
|
|
54897
|
+
try {
|
|
54898
|
+
writeFileSync6(fd, JSON.stringify({ pid: process.pid }) + `
|
|
54899
|
+
`);
|
|
54900
|
+
fsyncSync(fd);
|
|
54901
|
+
return await action();
|
|
54902
|
+
} finally {
|
|
54903
|
+
closeSync3(fd);
|
|
54904
|
+
unchangedDirectory(directory, identity);
|
|
54905
|
+
const now2 = lstatSync5(file);
|
|
54906
|
+
if (now2.dev !== lock.dev || now2.ino !== lock.ino || !now2.isFile() || now2.isSymbolicLink())
|
|
54907
|
+
fail();
|
|
54908
|
+
unlinkSync(file);
|
|
54909
|
+
}
|
|
54910
|
+
}
|
|
54911
|
+
function readPrivatePublicationRecovery(directory) {
|
|
54912
|
+
try {
|
|
54913
|
+
const value = JSON.parse(new TextDecoder("utf-8", { fatal: true }).decode(readOwned(directory, "receipt.json", 65536)));
|
|
54914
|
+
if (!value || typeof value !== "object" || Array.isArray(value) || Object.keys(value).sort().join(",") !== ["contractVersion", "apiOrigin", "organizationId", "userId", "membershipId", "skillId", "declaration", "phase", "intent"].sort().join(",") || value.contractVersion !== 1 || ![value.organizationId, value.userId, value.membershipId, value.skillId].every(publicationUuid) || typeof value.apiOrigin !== "string" || normalizeSkillsApiOrigin(value.apiOrigin) !== value.apiOrigin || !["prepared", "begin_uncertain", "awaiting_upload", "upload_uncertain", "uploaded", "finalize_uncertain", "observed"].includes(value.phase))
|
|
54915
|
+
return fail();
|
|
54916
|
+
value.declaration = checkedPublicationDeclaration(value.declaration);
|
|
54917
|
+
if (value.intent !== null)
|
|
54918
|
+
value.intent = checkedPublicationView(value.intent, value.skillId, undefined, value.declaration);
|
|
54919
|
+
if (value.intent === null && !["prepared", "begin_uncertain"].includes(value.phase))
|
|
54920
|
+
return fail();
|
|
54921
|
+
const bytes = readOwned(directory, "bundle.tgz", PRIVATE_PUBLICATION_MAX_BYTES);
|
|
54922
|
+
if (bytes.length !== value.declaration.archiveByteSize || publicationSha256(bytes) !== value.declaration.archiveSha256)
|
|
54923
|
+
return fail();
|
|
54924
|
+
return { receipt: value, bytes };
|
|
54925
|
+
} catch {
|
|
54926
|
+
return fail();
|
|
54927
|
+
}
|
|
54928
|
+
}
|
|
54929
|
+
async function preparePrivatePublication(client, sourceDirectory, recoveryDirectory, input) {
|
|
54930
|
+
if (!publicationUuid(input.skillId) || !(input.expectedCurrentVersionId === null || publicationUuid(input.expectedCurrentVersionId)) || input.idempotencyKey !== undefined && !publicationUuid(input.idempotencyKey))
|
|
54931
|
+
return fail();
|
|
54932
|
+
const packed = packSkillBundle(sourceDirectory, { maxUnpackedBytes: 32 * 1024 * 1024 });
|
|
54933
|
+
const inspected = await inspectSkillBundle(packed.bytes, { limits: { compressedBytes: PRIVATE_PUBLICATION_MAX_BYTES } });
|
|
54934
|
+
const manifest = inspected.entries.find((entry) => entry.path === "skill.json");
|
|
54935
|
+
if (!manifest || manifest.bytes.length > 16384 || !(await verifyContentHashFromEntries(inspected.entries)).valid)
|
|
54936
|
+
throw new PrivatePublicationError("PUBLICATION_BUNDLE_INVALID", "The skill must have a valid skill.json with its current content hash. Validate the skill before publishing.");
|
|
54937
|
+
const manifestText = new TextDecoder("utf-8", { fatal: true }).decode(manifest.bytes);
|
|
54938
|
+
const declaration = checkedPublicationDeclaration({
|
|
54939
|
+
idempotencyKey: input.idempotencyKey ?? randomUUID6(),
|
|
54940
|
+
version: JSON.parse(manifestText).version,
|
|
54941
|
+
expectedCurrentVersionId: input.expectedCurrentVersionId,
|
|
54942
|
+
manifestText,
|
|
54943
|
+
archiveSha256: inspected.sha256,
|
|
54944
|
+
archiveByteSize: packed.bytes.length
|
|
54945
|
+
});
|
|
54946
|
+
const receipt = {
|
|
54947
|
+
contractVersion: 1,
|
|
54948
|
+
apiOrigin: client.apiOrigin,
|
|
54949
|
+
organizationId: client.organizationId,
|
|
54950
|
+
userId: client.userId,
|
|
54951
|
+
membershipId: client.membershipId,
|
|
54952
|
+
skillId: input.skillId,
|
|
54953
|
+
declaration,
|
|
54954
|
+
phase: "prepared",
|
|
54955
|
+
intent: null
|
|
54956
|
+
};
|
|
54957
|
+
if (!isAbsolute5(recoveryDirectory) || resolve4(recoveryDirectory) !== recoveryDirectory || realpathSync2(dirname10(recoveryDirectory)) !== dirname10(recoveryDirectory))
|
|
54958
|
+
return fail();
|
|
54959
|
+
mkdirSync8(recoveryDirectory, { mode: 448 });
|
|
54960
|
+
safeDirectory(recoveryDirectory);
|
|
54961
|
+
const parent = openSync3(dirname10(recoveryDirectory), constants2.O_RDONLY | constants2.O_NOFOLLOW);
|
|
54962
|
+
try {
|
|
54963
|
+
fsyncSync(parent);
|
|
54964
|
+
} finally {
|
|
54965
|
+
closeSync3(parent);
|
|
54966
|
+
}
|
|
54967
|
+
writeOwned(recoveryDirectory, "bundle.tgz", packed.bytes);
|
|
54968
|
+
save(recoveryDirectory, receipt);
|
|
54969
|
+
return receipt;
|
|
54970
|
+
}
|
|
54971
|
+
function privatePublicationResult(directory, receipt) {
|
|
54972
|
+
const state = receipt.intent?.state ?? receipt.phase, committed = state === "committed";
|
|
54973
|
+
const nextAction = committed ? "The version is published. Private execution remains unavailable." : ["rejected", "cancelled", "expired"].includes(state) ? "This intent is terminal. Inspect the result before explicitly preparing another version." : state === "needs_attention" ? "Keep this intent and contact the service operator; do not create a replacement or upload again." : receipt.phase === "upload_uncertain" ? "Run publication resume with this recovery directory to finalize the same intent without another upload." : receipt.intent ? "Run publication status or resume with this recovery directory; cancel explicitly if you want to stop." : "Run publication resume with this recovery directory to reconcile the identical request key and declaration.";
|
|
54974
|
+
return {
|
|
54975
|
+
recoveryDirectory: directory,
|
|
54976
|
+
skillId: receipt.skillId,
|
|
54977
|
+
intentId: receipt.intent?.id ?? null,
|
|
54978
|
+
state,
|
|
54979
|
+
versionId: receipt.intent?.versionId ?? null,
|
|
54980
|
+
committed,
|
|
54981
|
+
executionEnabled: false,
|
|
54982
|
+
nextAction
|
|
54983
|
+
};
|
|
54984
|
+
}
|
|
54985
|
+
async function continuePrivatePublication(client, directory, options) {
|
|
54986
|
+
if (options.confirm !== true)
|
|
54987
|
+
throw new PrivatePublicationError("PUBLICATION_CONFIRM_REQUIRED", "Explicit upload confirmation is required.");
|
|
54988
|
+
if (options.waitMs !== undefined && (!Number.isSafeInteger(options.waitMs) || options.waitMs < 0 || options.waitMs > 300000))
|
|
54989
|
+
return fail();
|
|
54990
|
+
return locked(directory, () => continueLocked(client, directory, options));
|
|
54991
|
+
}
|
|
54992
|
+
async function continueLocked(client, directory, options) {
|
|
54993
|
+
const { receipt, bytes } = readPrivatePublicationRecovery(directory);
|
|
54994
|
+
bind(client, receipt);
|
|
54995
|
+
if (!receipt.intent) {
|
|
54996
|
+
receipt.phase = "begin_uncertain";
|
|
54997
|
+
save(directory, receipt);
|
|
54998
|
+
receipt.intent = await client.begin(receipt.skillId, receipt.declaration);
|
|
54999
|
+
receipt.phase = "awaiting_upload";
|
|
55000
|
+
save(directory, receipt);
|
|
55001
|
+
} else {
|
|
55002
|
+
receipt.intent = checkedPublicationView(await client.get(receipt.skillId, receipt.intent.id), receipt.skillId, receipt.intent.id, receipt.declaration);
|
|
55003
|
+
save(directory, receipt);
|
|
55004
|
+
}
|
|
55005
|
+
if (receipt.intent.state === "awaiting_upload") {
|
|
55006
|
+
if (receipt.phase === "awaiting_upload") {
|
|
55007
|
+
receipt.phase = "upload_uncertain";
|
|
55008
|
+
save(directory, receipt);
|
|
55009
|
+
try {
|
|
55010
|
+
await client.upload(receipt.skillId, receipt.intent, bytes);
|
|
55011
|
+
} catch (error) {
|
|
55012
|
+
if (error instanceof PrivatePublicationError && !error.uncertain) {
|
|
55013
|
+
receipt.phase = "awaiting_upload";
|
|
55014
|
+
save(directory, receipt);
|
|
55015
|
+
}
|
|
55016
|
+
throw error;
|
|
55017
|
+
}
|
|
55018
|
+
receipt.phase = "uploaded";
|
|
55019
|
+
save(directory, receipt);
|
|
55020
|
+
}
|
|
55021
|
+
receipt.phase = "finalize_uncertain";
|
|
55022
|
+
save(directory, receipt);
|
|
55023
|
+
receipt.intent = checkedPublicationView(await client.finalize(receipt.skillId, receipt.intent.id), receipt.skillId, receipt.intent.id, receipt.declaration);
|
|
55024
|
+
receipt.phase = "observed";
|
|
55025
|
+
save(directory, receipt);
|
|
55026
|
+
}
|
|
55027
|
+
if (options.waitMs !== undefined && options.waitMs > 0 && ["queued", "verifying"].includes(receipt.intent.state)) {
|
|
55028
|
+
receipt.intent = checkedPublicationView(await client.wait(receipt.skillId, receipt.intent.id, { timeoutMs: options.waitMs }), receipt.skillId, receipt.intent.id, receipt.declaration);
|
|
55029
|
+
receipt.phase = "observed";
|
|
55030
|
+
save(directory, receipt);
|
|
55031
|
+
}
|
|
55032
|
+
return privatePublicationResult(directory, receipt);
|
|
55033
|
+
}
|
|
55034
|
+
async function inspectPrivatePublication(client, directory, cancel = false) {
|
|
55035
|
+
return locked(directory, () => inspectLocked(client, directory, cancel));
|
|
55036
|
+
}
|
|
55037
|
+
async function inspectLocked(client, directory, cancel) {
|
|
55038
|
+
const { receipt } = readPrivatePublicationRecovery(directory);
|
|
55039
|
+
bind(client, receipt);
|
|
55040
|
+
if (receipt.intent) {
|
|
55041
|
+
receipt.intent = checkedPublicationView(await (cancel ? client.cancel(receipt.skillId, receipt.intent.id) : client.get(receipt.skillId, receipt.intent.id)), receipt.skillId, receipt.intent.id, receipt.declaration);
|
|
55042
|
+
save(directory, receipt);
|
|
55043
|
+
} else if (cancel)
|
|
55044
|
+
throw new PrivatePublicationError("PUBLICATION_INTENT_UNKNOWN", "Reconcile the saved begin request with publication resume before cancelling its intent.");
|
|
55045
|
+
return privatePublicationResult(directory, receipt);
|
|
55046
|
+
}
|
|
54380
55047
|
export {
|
|
54381
|
-
|
|
54382
|
-
CLIENT_TOKEN_BYTES,
|
|
54383
|
-
CONTENT_HASH_LIMITS,
|
|
54384
|
-
ContentHashInputError,
|
|
54385
|
-
DEFAULT_IMAGE_PROFILES,
|
|
54386
|
-
DEFAULT_OUTPUT_GOVERNANCE,
|
|
54387
|
-
DEFAULT_RUN_LIMITS,
|
|
54388
|
-
DEFAULT_RUN_POLICY,
|
|
54389
|
-
DEFAULT_RUN_QUOTA,
|
|
54390
|
-
DEFAULT_SPEND_CEILINGS,
|
|
54391
|
-
DispatcherNotImplementedError,
|
|
54392
|
-
E2B_LANE_STATUS,
|
|
54393
|
-
E2bDispatcher,
|
|
54394
|
-
EXECUTION_PROTOCOL_VERSION,
|
|
54395
|
-
EcsDispatcher,
|
|
54396
|
-
GOVERNANCE_ERROR_CODES,
|
|
54397
|
-
GovernanceError,
|
|
54398
|
-
HostedApiError,
|
|
54399
|
-
ImageProfileResolutionError,
|
|
54400
|
-
InvitationEmailInputError,
|
|
54401
|
-
LEGAL_TRANSITIONS,
|
|
54402
|
-
MemoryGovernanceStore,
|
|
54403
|
-
MemoryRunExecutionStore,
|
|
54404
|
-
MemorySkillsStore,
|
|
54405
|
-
MissingSkillsFleetError,
|
|
54406
|
-
PostgresGovernanceStore,
|
|
54407
|
-
PostgresSkillsStore,
|
|
54408
|
-
REMOTE_SKILL_RUN_CONTRACT_VERSION,
|
|
54409
|
-
RUN_LIFECYCLE_EVENT_FIELDS,
|
|
54410
|
-
RUN_LIFECYCLE_EVENT_TYPES,
|
|
54411
|
-
RUN_PROTOCOL_STATES,
|
|
54412
|
-
RUN_PROTOCOL_VERSION,
|
|
54413
|
-
RemoteCapabilityUnavailableError,
|
|
54414
|
-
RemoteCreditApprovalError,
|
|
54415
|
-
RemoteInvitationEmailError,
|
|
54416
|
-
RemoteInvitationEmailUnconfirmedError,
|
|
54417
|
-
RemoteQuoteUnavailableError,
|
|
54418
|
-
RemoteRequestError,
|
|
54419
|
-
RemoteRouteUnsupportedError,
|
|
54420
|
-
RemoteSkillsAuthClient,
|
|
54421
|
-
RemoteSkillsClient,
|
|
54422
|
-
RemoteWorkspaceInvitationError,
|
|
54423
|
-
RemoteWorkspaceInvitationReadError,
|
|
54424
|
-
RemoteWorkspaceInvitationUnconfirmedError,
|
|
54425
|
-
RemoteWorkspaceLeaveError,
|
|
54426
|
-
RemoteWorkspaceLeaveUnconfirmedError,
|
|
54427
|
-
RemoteWorkspaceMemberError,
|
|
54428
|
-
RemoteWorkspaceSelectionError,
|
|
54429
|
-
SKILLS_API_KEY_ENV,
|
|
54430
|
-
SKILLS_API_URL_ENV,
|
|
54431
|
-
SKILLS_APP,
|
|
54432
|
-
SKILLS_LOCAL_OPT_IN_ENV_KEYS,
|
|
54433
|
-
SKILL_BUNDLE_INSPECTION_LIMITS,
|
|
54434
|
-
SkillBundleInspectionError,
|
|
54435
|
-
SkillsFleetCredentialError,
|
|
54436
|
-
SqliteGovernanceStore,
|
|
54437
|
-
SqliteRunExecutionStore,
|
|
54438
|
-
SqliteSkillsStore,
|
|
54439
|
-
WorkspaceContextInputError,
|
|
54440
|
-
WorkspaceIdentityMismatchError,
|
|
54441
|
-
WorkspaceInvitationInputError,
|
|
54442
|
-
WorkspaceLeaveInputError,
|
|
54443
|
-
artifactStorageSeam,
|
|
54444
|
-
assertDurableStore,
|
|
54445
|
-
assertDurableTarget,
|
|
54446
|
-
attemptIdOf,
|
|
54447
|
-
buildRunLifecycleEvent,
|
|
54448
|
-
bundledRegistry,
|
|
54449
|
-
canonicalJson,
|
|
54450
|
-
canonicalSystemDepsKey,
|
|
54451
|
-
clientTokenFor,
|
|
54452
|
-
computeContentHashFromEntries,
|
|
54453
|
-
configuredSkillsApiUrl,
|
|
54454
|
-
createAwsEcsClient,
|
|
54455
|
-
createCancelService,
|
|
54456
|
-
createGovernanceStore,
|
|
54457
|
-
createGovernedArtifactWriter,
|
|
54458
|
-
createImageProfileRegistry,
|
|
54459
|
-
createOfflineGate,
|
|
54460
|
-
createReceiptService,
|
|
54461
|
-
createRemoteSkillsClient,
|
|
54462
|
-
createRunEventEmitter,
|
|
54463
|
-
createRunService,
|
|
54464
|
-
createRunStateMachine,
|
|
54465
|
-
createServer,
|
|
54466
|
-
createSkillsFetchHandler,
|
|
54467
|
-
createSpendService,
|
|
54468
|
-
createStore,
|
|
54469
|
-
createSubmitRunService,
|
|
54470
|
-
currentVersionService,
|
|
54471
|
-
dependencyLayerRule,
|
|
54472
|
-
digestInput,
|
|
54473
|
-
executeRun,
|
|
54474
|
-
expireArtifacts,
|
|
54475
|
-
expiresAtFor,
|
|
54476
|
-
getServerSkill,
|
|
54477
|
-
getServerSkillMd,
|
|
54478
|
-
inspectSkillBundle,
|
|
54479
|
-
isActiveStatus,
|
|
54480
|
-
isSkillsLocalOptIn,
|
|
54481
|
-
isTerminalStatus,
|
|
54482
|
-
isValidSkillSlug,
|
|
54483
|
-
leaseGenerationOf,
|
|
54484
|
-
listServerSkills,
|
|
54485
|
-
localRunExecutor,
|
|
54486
|
-
newRunId,
|
|
54487
|
-
normalizeRemoteSkillRunContract,
|
|
54488
|
-
normalizeSkillsApiOrigin,
|
|
54489
|
-
noticeLocalSkillsMode,
|
|
54490
|
-
packSkillBundle,
|
|
54491
|
-
protocolStateOf,
|
|
54492
|
-
receiptId,
|
|
54493
|
-
redactRunOutput,
|
|
54494
|
-
registerRoutes,
|
|
54495
|
-
requestDigestFor,
|
|
54496
|
-
requireSkillsApiOrigin,
|
|
54497
|
-
requireSkillsFleet,
|
|
54498
|
-
reservationId,
|
|
54499
|
-
resolveDatabaseTarget,
|
|
54500
|
-
resolveImageProfile,
|
|
54501
|
-
resolveServerConfig,
|
|
54502
|
-
resolveSkillsApiOrigin,
|
|
54503
|
-
resolveSkillsFleet,
|
|
54504
|
-
revisionIdOf,
|
|
54505
|
-
runAdmissionSchema,
|
|
54506
|
-
runLeaseSchema,
|
|
54507
|
-
runPointersOf,
|
|
54508
|
-
runProtocolSchema,
|
|
54509
|
-
runTerminalSchema,
|
|
54510
|
-
selectsSkillsLocalMode,
|
|
54511
|
-
settleRun,
|
|
54512
|
-
skillsCredentialFilePath,
|
|
54513
|
-
skillsCredentialFiles,
|
|
54514
|
-
skillsCredentialOrReason,
|
|
54515
|
-
skillsServeLimits,
|
|
54516
|
-
startSkillsServer,
|
|
54517
|
-
startedByFor,
|
|
55048
|
+
verifyContentHashFromEntries,
|
|
54518
55049
|
validateRunLifecycleEvent,
|
|
54519
|
-
|
|
55050
|
+
startedByFor,
|
|
55051
|
+
startSkillsServer,
|
|
55052
|
+
skillsServeLimits,
|
|
55053
|
+
skillsCredentialOrReason,
|
|
55054
|
+
skillsCredentialFiles,
|
|
55055
|
+
skillsCredentialFilePath,
|
|
55056
|
+
settleRun,
|
|
55057
|
+
selectsSkillsLocalMode,
|
|
55058
|
+
runTerminalSchema,
|
|
55059
|
+
runProtocolSchema,
|
|
55060
|
+
runPointersOf,
|
|
55061
|
+
runLeaseSchema,
|
|
55062
|
+
runAdmissionSchema,
|
|
55063
|
+
revisionIdOf,
|
|
55064
|
+
resolveSkillsFleet,
|
|
55065
|
+
resolveSkillsApiOrigin,
|
|
55066
|
+
resolveServerConfig,
|
|
55067
|
+
resolveImageProfile,
|
|
55068
|
+
resolveDatabaseTarget,
|
|
55069
|
+
reservationId,
|
|
55070
|
+
requireSkillsFleet,
|
|
55071
|
+
requireSkillsApiOrigin,
|
|
55072
|
+
requestDigestFor,
|
|
55073
|
+
registerRoutes,
|
|
55074
|
+
redactRunOutput,
|
|
55075
|
+
receiptId,
|
|
55076
|
+
readPrivatePublicationRecovery,
|
|
55077
|
+
protocolStateOf,
|
|
55078
|
+
preparePrivatePublication,
|
|
55079
|
+
packSkillBundle,
|
|
55080
|
+
noticeLocalSkillsMode,
|
|
55081
|
+
normalizeSkillsApiOrigin,
|
|
55082
|
+
normalizeRemoteSkillRunContract,
|
|
55083
|
+
newRunId,
|
|
55084
|
+
localRunExecutor,
|
|
55085
|
+
listServerSkills,
|
|
55086
|
+
leaseGenerationOf,
|
|
55087
|
+
isValidSkillSlug,
|
|
55088
|
+
isTerminalStatus,
|
|
55089
|
+
isSkillsLocalOptIn,
|
|
55090
|
+
isActiveStatus,
|
|
55091
|
+
inspectSkillBundle,
|
|
55092
|
+
inspectPrivatePublication,
|
|
55093
|
+
getServerSkillMd,
|
|
55094
|
+
getServerSkill,
|
|
55095
|
+
expiresAtFor,
|
|
55096
|
+
expireArtifacts,
|
|
55097
|
+
executeRun,
|
|
55098
|
+
digestInput,
|
|
55099
|
+
dependencyLayerRule,
|
|
55100
|
+
currentVersionService,
|
|
55101
|
+
createSubmitRunService,
|
|
55102
|
+
createStore,
|
|
55103
|
+
createSpendService,
|
|
55104
|
+
createSkillsFetchHandler,
|
|
55105
|
+
createServer,
|
|
55106
|
+
createRunStateMachine,
|
|
55107
|
+
createRunService,
|
|
55108
|
+
createRunEventEmitter,
|
|
55109
|
+
createRemoteSkillsClient,
|
|
55110
|
+
createReceiptService,
|
|
55111
|
+
createOfflineGate,
|
|
55112
|
+
createImageProfileRegistry,
|
|
55113
|
+
createGovernedArtifactWriter,
|
|
55114
|
+
createGovernanceStore,
|
|
55115
|
+
createCancelService,
|
|
55116
|
+
createAwsEcsClient,
|
|
55117
|
+
continuePrivatePublication,
|
|
55118
|
+
configuredSkillsApiUrl,
|
|
55119
|
+
computeContentHashFromEntries,
|
|
55120
|
+
clientTokenFor,
|
|
55121
|
+
canonicalSystemDepsKey,
|
|
55122
|
+
canonicalJson,
|
|
55123
|
+
bundledRegistry,
|
|
55124
|
+
buildRunLifecycleEvent,
|
|
55125
|
+
attemptIdOf,
|
|
55126
|
+
assertDurableTarget,
|
|
55127
|
+
assertDurableStore,
|
|
55128
|
+
artifactStorageSeam,
|
|
55129
|
+
WorkspaceLeaveInputError,
|
|
55130
|
+
WorkspaceInvitationInputError,
|
|
55131
|
+
WorkspaceIdentityMismatchError,
|
|
55132
|
+
WorkspaceContextInputError,
|
|
55133
|
+
SqliteSkillsStore,
|
|
55134
|
+
SqliteRunExecutionStore,
|
|
55135
|
+
SqliteGovernanceStore,
|
|
55136
|
+
SkillsFleetCredentialError,
|
|
55137
|
+
SkillBundleInspectionError,
|
|
55138
|
+
SKILL_BUNDLE_INSPECTION_LIMITS,
|
|
55139
|
+
SKILLS_LOCAL_OPT_IN_ENV_KEYS,
|
|
55140
|
+
SKILLS_APP,
|
|
55141
|
+
SKILLS_API_URL_ENV,
|
|
55142
|
+
SKILLS_API_KEY_ENV,
|
|
55143
|
+
RemoteWorkspaceSelectionError,
|
|
55144
|
+
RemoteWorkspaceMemberError,
|
|
55145
|
+
RemoteWorkspaceLeaveUnconfirmedError,
|
|
55146
|
+
RemoteWorkspaceLeaveError,
|
|
55147
|
+
RemoteWorkspaceInvitationUnconfirmedError,
|
|
55148
|
+
RemoteWorkspaceInvitationReadError,
|
|
55149
|
+
RemoteWorkspaceInvitationError,
|
|
55150
|
+
RemoteSkillsClient,
|
|
55151
|
+
RemoteSkillsAuthClient,
|
|
55152
|
+
RemoteRouteUnsupportedError,
|
|
55153
|
+
RemoteRequestError,
|
|
55154
|
+
RemoteQuoteUnavailableError,
|
|
55155
|
+
RemotePrivatePublicationsClient,
|
|
55156
|
+
RemoteInvitationEmailUnconfirmedError,
|
|
55157
|
+
RemoteInvitationEmailError,
|
|
55158
|
+
RemoteCreditApprovalError,
|
|
55159
|
+
RemoteCapabilityUnavailableError,
|
|
55160
|
+
RUN_PROTOCOL_VERSION,
|
|
55161
|
+
RUN_PROTOCOL_STATES,
|
|
55162
|
+
RUN_LIFECYCLE_EVENT_TYPES,
|
|
55163
|
+
RUN_LIFECYCLE_EVENT_FIELDS,
|
|
55164
|
+
REMOTE_SKILL_RUN_CONTRACT_VERSION,
|
|
55165
|
+
PrivatePublicationError,
|
|
55166
|
+
PostgresSkillsStore,
|
|
55167
|
+
PostgresGovernanceStore,
|
|
55168
|
+
PRIVATE_PUBLICATION_MAX_BYTES,
|
|
55169
|
+
MissingSkillsFleetError,
|
|
55170
|
+
MemorySkillsStore,
|
|
55171
|
+
MemoryRunExecutionStore,
|
|
55172
|
+
MemoryGovernanceStore,
|
|
55173
|
+
LEGAL_TRANSITIONS,
|
|
55174
|
+
InvitationEmailInputError,
|
|
55175
|
+
ImageProfileResolutionError,
|
|
55176
|
+
HostedApiError,
|
|
55177
|
+
GovernanceError,
|
|
55178
|
+
GOVERNANCE_ERROR_CODES,
|
|
55179
|
+
EcsDispatcher,
|
|
55180
|
+
EXECUTION_PROTOCOL_VERSION,
|
|
55181
|
+
E2bDispatcher,
|
|
55182
|
+
E2B_LANE_STATUS,
|
|
55183
|
+
DispatcherNotImplementedError,
|
|
55184
|
+
DEFAULT_SPEND_CEILINGS,
|
|
55185
|
+
DEFAULT_RUN_QUOTA,
|
|
55186
|
+
DEFAULT_RUN_POLICY,
|
|
55187
|
+
DEFAULT_RUN_LIMITS,
|
|
55188
|
+
DEFAULT_OUTPUT_GOVERNANCE,
|
|
55189
|
+
DEFAULT_IMAGE_PROFILES,
|
|
55190
|
+
ContentHashInputError,
|
|
55191
|
+
CONTENT_HASH_LIMITS,
|
|
55192
|
+
CLIENT_TOKEN_BYTES,
|
|
55193
|
+
ArtifactStorage
|
|
54520
55194
|
};
|