@hasna/skills 0.5.2 → 0.5.4
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 +169 -1
- package/bin/index.js +1541 -1042
- package/bin/mcp.js +28461 -27173
- package/bin/migrate.js +9 -1
- package/bin/server.js +80 -56
- package/bin/worker.js +80 -56
- package/dist/admin-contract.js +168 -166
- package/dist/cli/commands/invitation-recovery.d.ts +2 -0
- package/dist/cli/commands/invitation-verification.d.ts +8 -0
- package/dist/cli/commands/workspace-invitations.d.ts +2 -0
- package/dist/index.d.ts +6 -2
- package/dist/index.js +1516 -611
- package/dist/lib/invitation-customer-action.d.ts +14 -0
- package/dist/lib/invitation-recovery-target.d.ts +5 -0
- package/dist/lib/remote-auth.d.ts +12 -0
- package/dist/lib/remote-client.d.ts +19 -0
- package/dist/lib/remote-invitation-recovery.d.ts +62 -0
- package/dist/lib/remote-invitations.d.ts +128 -0
- package/dist/lib/remote-quote-errors.d.ts +12 -0
- package/dist/lib/skill-bundle.d.ts +54 -1
- package/dist/lib/skill-entry-path.d.ts +6 -0
- package/dist/lib/skill-hash.d.ts +33 -0
- package/dist/mcp/index.d.ts +0 -1
- package/dist/mcp/invitation-recovery.d.ts +2 -0
- package/dist/mcp/remote-invitation-tools.d.ts +2 -0
- package/dist/sdk/index.d.ts +5 -1
- package/dist/sdk/index.js +1316 -389
- package/dist/sdk/registry.d.ts +6 -0
- package/dist/storage.js +35 -33
- package/package.json +1 -1
package/dist/sdk/index.js
CHANGED
|
@@ -19,12 +19,14 @@ 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
|
-
|
|
22
|
+
if (mod && typeof mod === "object" || typeof mod === "function") {
|
|
23
|
+
for (let key of __getOwnPropNames(mod))
|
|
24
|
+
if (!__hasOwnProp.call(to, key))
|
|
25
|
+
__defProp(to, key, {
|
|
26
|
+
get: __accessProp.bind(mod, key),
|
|
27
|
+
enumerable: true
|
|
28
|
+
});
|
|
29
|
+
}
|
|
28
30
|
if (canCache)
|
|
29
31
|
cache.set(mod, to);
|
|
30
32
|
return to;
|
|
@@ -47,7 +49,7 @@ var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
|
47
49
|
var __require = import.meta.require;
|
|
48
50
|
|
|
49
51
|
// ../../node_modules/.bun/@smithy+types@4.18.0/node_modules/@smithy/types/dist-cjs/index.js
|
|
50
|
-
var require_dist_cjs = __commonJS((exports)
|
|
52
|
+
var require_dist_cjs = __commonJS(function(exports) {
|
|
51
53
|
var HttpAuthLocation;
|
|
52
54
|
(function(HttpAuthLocation2) {
|
|
53
55
|
HttpAuthLocation2["HEADER"] = "header";
|
|
@@ -138,7 +140,7 @@ var require_dist_cjs = __commonJS((exports) => {
|
|
|
138
140
|
});
|
|
139
141
|
|
|
140
142
|
// ../../node_modules/.bun/@smithy+core@3.33.3/node_modules/@smithy/core/dist-cjs/submodules/transport/index.js
|
|
141
|
-
var require_transport = __commonJS((exports)
|
|
143
|
+
var require_transport = __commonJS(function(exports) {
|
|
142
144
|
var { SMITHY_CONTEXT_KEY } = require_dist_cjs();
|
|
143
145
|
var getSmithyContext = (context) => context[SMITHY_CONTEXT_KEY] || (context[SMITHY_CONTEXT_KEY] = {});
|
|
144
146
|
function hasOwn2(o, k) {
|
|
@@ -311,7 +313,7 @@ var require_transport = __commonJS((exports) => {
|
|
|
311
313
|
});
|
|
312
314
|
|
|
313
315
|
// ../../node_modules/.bun/@smithy+core@3.33.3/node_modules/@smithy/core/dist-cjs/submodules/schema/index.js
|
|
314
|
-
var require_schema = __commonJS((exports)
|
|
316
|
+
var require_schema = __commonJS(function(exports) {
|
|
315
317
|
var { getSmithyContext, HttpResponse, toEndpointV1 } = require_transport();
|
|
316
318
|
var deref = (schemaRef) => {
|
|
317
319
|
if (typeof schemaRef === "function") {
|
|
@@ -980,7 +982,7 @@ var require_schema = __commonJS((exports) => {
|
|
|
980
982
|
});
|
|
981
983
|
|
|
982
984
|
// ../../node_modules/.bun/@smithy+core@3.33.3/node_modules/@smithy/core/dist-cjs/submodules/client/index.js
|
|
983
|
-
var require_client = __commonJS((exports)
|
|
985
|
+
var require_client = __commonJS(function(exports) {
|
|
984
986
|
var { hasOwn: hasOwn2 } = require_transport();
|
|
985
987
|
var { getSmithyContext, normalizeProvider } = require_transport();
|
|
986
988
|
exports.getSmithyContext = getSmithyContext;
|
|
@@ -2060,7 +2062,7 @@ var require_client = __commonJS((exports) => {
|
|
|
2060
2062
|
});
|
|
2061
2063
|
|
|
2062
2064
|
// ../../node_modules/.bun/@smithy+core@3.33.3/node_modules/@smithy/core/dist-cjs/submodules/config/index.js
|
|
2063
|
-
var require_config = __commonJS((exports)
|
|
2065
|
+
var require_config = __commonJS(function(exports) {
|
|
2064
2066
|
var { homedir } = __require("os");
|
|
2065
2067
|
var { sep, join: join3 } = __require("path");
|
|
2066
2068
|
var { createHash: createHash2 } = __require("crypto");
|
|
@@ -2755,7 +2757,7 @@ var require_config = __commonJS((exports) => {
|
|
|
2755
2757
|
});
|
|
2756
2758
|
|
|
2757
2759
|
// ../../node_modules/.bun/@smithy+core@3.33.3/node_modules/@smithy/core/dist-cjs/submodules/endpoints/index.js
|
|
2758
|
-
var require_endpoints = __commonJS((exports)
|
|
2760
|
+
var require_endpoints = __commonJS(function(exports) {
|
|
2759
2761
|
var { CONFIG_PREFIX_SEPARATOR, booleanSelector, SelectorType, loadConfig } = require_config();
|
|
2760
2762
|
var { toEndpointV1, getSmithyContext, normalizeProvider, isValidHostLabel, hasOwn: hasOwn2 } = require_transport();
|
|
2761
2763
|
exports.isValidHostLabel = isValidHostLabel;
|
|
@@ -3569,7 +3571,7 @@ var require_endpoints = __commonJS((exports) => {
|
|
|
3569
3571
|
});
|
|
3570
3572
|
|
|
3571
3573
|
// ../../node_modules/.bun/@smithy+core@3.33.3/node_modules/@smithy/core/dist-cjs/submodules/serde/index.js
|
|
3572
|
-
var require_serde = __commonJS((exports)
|
|
3574
|
+
var require_serde = __commonJS(function(exports) {
|
|
3573
3575
|
var { createHmac: createHmac2, createHash: createHash2, getRandomValues } = __require("crypto");
|
|
3574
3576
|
var { hasOwn: hasOwn2, HttpResponse } = require_transport();
|
|
3575
3577
|
exports.hasOwn = hasOwn2;
|
|
@@ -5210,7 +5212,7 @@ ${value}\r
|
|
|
5210
5212
|
});
|
|
5211
5213
|
|
|
5212
5214
|
// ../../node_modules/.bun/@smithy+core@3.33.3/node_modules/@smithy/core/dist-cjs/submodules/checksum/index.js
|
|
5213
|
-
var require_checksum = __commonJS((exports)
|
|
5215
|
+
var require_checksum = __commonJS(function(exports) {
|
|
5214
5216
|
var { createReadStream } = __require("fs");
|
|
5215
5217
|
var { Writable } = __require("stream");
|
|
5216
5218
|
var { toUint8Array, concatBytes } = require_serde();
|
|
@@ -5826,7 +5828,7 @@ var require_checksum = __commonJS((exports) => {
|
|
|
5826
5828
|
});
|
|
5827
5829
|
|
|
5828
5830
|
// ../../node_modules/.bun/@smithy+core@3.33.3/node_modules/@smithy/core/dist-cjs/submodules/event-streams/index.js
|
|
5829
|
-
var require_event_streams = __commonJS((exports)
|
|
5831
|
+
var require_event_streams = __commonJS(function(exports) {
|
|
5830
5832
|
var { Crc32 } = require_checksum();
|
|
5831
5833
|
var { hasOwn: hasOwn2 } = require_transport();
|
|
5832
5834
|
var { toHex, fromHex, toUtf8, fromUtf8 } = require_serde();
|
|
@@ -6718,7 +6720,7 @@ var require_event_streams = __commonJS((exports) => {
|
|
|
6718
6720
|
});
|
|
6719
6721
|
|
|
6720
6722
|
// ../../node_modules/.bun/@smithy+core@3.33.3/node_modules/@smithy/core/dist-cjs/submodules/protocols/index.js
|
|
6721
|
-
var require_protocols = __commonJS((exports)
|
|
6723
|
+
var require_protocols = __commonJS(function(exports) {
|
|
6722
6724
|
var { Uint8ArrayBlobAdapter, sdkStreamMixin, splitEvery, splitHeader, fromBase64, _parseEpochTimestamp, _parseRfc7231DateTime, _parseRfc3339DateTimeWithOffset, LazyJsonString, NumericValue, toUtf8, fromUtf8, generateIdempotencyToken, toBase64, dateToUtcString, quoteHeader } = require_serde();
|
|
6723
6725
|
var { HttpRequest, HttpResponse, hasOwn: hasOwn2, isValidHostname } = require_transport();
|
|
6724
6726
|
var { parseQueryString, parseUrl } = require_transport();
|
|
@@ -7722,7 +7724,7 @@ var require_protocols = __commonJS((exports) => {
|
|
|
7722
7724
|
});
|
|
7723
7725
|
|
|
7724
7726
|
// ../../node_modules/.bun/@smithy+core@3.33.3/node_modules/@smithy/core/dist-cjs/submodules/retry/index.js
|
|
7725
|
-
var require_retry = __commonJS((exports)
|
|
7727
|
+
var require_retry = __commonJS(function(exports) {
|
|
7726
7728
|
var { Readable } = __require("stream");
|
|
7727
7729
|
var { NoOpLogger, normalizeProvider } = require_client();
|
|
7728
7730
|
var { HttpResponse, HttpRequest } = require_protocols();
|
|
@@ -8522,7 +8524,7 @@ var require_retry = __commonJS((exports) => {
|
|
|
8522
8524
|
});
|
|
8523
8525
|
|
|
8524
8526
|
// ../../node_modules/.bun/@aws+lambda-invoke-store@0.3.0/node_modules/@aws/lambda-invoke-store/dist-cjs/invoke-store.js
|
|
8525
|
-
var require_invoke_store = __commonJS((exports)
|
|
8527
|
+
var require_invoke_store = __commonJS(function(exports) {
|
|
8526
8528
|
var PROTECTED_KEYS = {
|
|
8527
8529
|
REQUEST_ID: Symbol.for("_AWS_LAMBDA_REQUEST_ID"),
|
|
8528
8530
|
X_RAY_TRACE_ID: Symbol.for("_AWS_LAMBDA_X_RAY_TRACE_ID"),
|
|
@@ -8651,7 +8653,7 @@ var require_invoke_store = __commonJS((exports) => {
|
|
|
8651
8653
|
});
|
|
8652
8654
|
|
|
8653
8655
|
// ../../node_modules/.bun/@smithy+core@3.33.3/node_modules/@smithy/core/dist-cjs/index.js
|
|
8654
|
-
var require_dist_cjs2 = __commonJS((exports)
|
|
8656
|
+
var require_dist_cjs2 = __commonJS(function(exports) {
|
|
8655
8657
|
var { getSmithyContext, hasOwn: hasOwn2 } = require_transport();
|
|
8656
8658
|
exports.getSmithyContext = getSmithyContext;
|
|
8657
8659
|
var { HttpRequest } = require_protocols();
|
|
@@ -8979,7 +8981,7 @@ var require_dist_cjs2 = __commonJS((exports) => {
|
|
|
8979
8981
|
});
|
|
8980
8982
|
|
|
8981
8983
|
// ../../node_modules/.bun/bowser@2.14.1/node_modules/bowser/es5.js
|
|
8982
|
-
var require_es5 = __commonJS((exports, module)
|
|
8984
|
+
var require_es5 = __commonJS(function(exports, module) {
|
|
8983
8985
|
(function(e, t) {
|
|
8984
8986
|
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();
|
|
8985
8987
|
})(exports, function() {
|
|
@@ -9819,7 +9821,7 @@ var require_es5 = __commonJS((exports, module) => {
|
|
|
9819
9821
|
});
|
|
9820
9822
|
|
|
9821
9823
|
// ../../node_modules/.bun/@aws-sdk+core@3.977.9/node_modules/@aws-sdk/core/dist-cjs/submodules/client/index.js
|
|
9822
|
-
var require_client2 = __commonJS((exports)
|
|
9824
|
+
var require_client2 = __commonJS(function(exports) {
|
|
9823
9825
|
var { Retry, RETRY_MODES } = require_retry();
|
|
9824
9826
|
var { HttpRequest, parseUrl } = require_protocols();
|
|
9825
9827
|
var { InvokeStore } = require_invoke_store();
|
|
@@ -10757,7 +10759,7 @@ More information can be found at: https://a.co/c895JFp`);
|
|
|
10757
10759
|
});
|
|
10758
10760
|
|
|
10759
10761
|
// ../../node_modules/.bun/@aws-sdk+checksums@3.1000.29/node_modules/@aws-sdk/checksums/dist-cjs/submodules/crc/index.js
|
|
10760
|
-
var require_crc = __commonJS((exports)
|
|
10762
|
+
var require_crc = __commonJS(function(exports) {
|
|
10761
10763
|
var { Crc32, Crc32Js, Crc32Node } = require_checksum();
|
|
10762
10764
|
exports.Crc32 = Crc32;
|
|
10763
10765
|
exports.Crc32Js = Crc32Js;
|
|
@@ -10914,7 +10916,7 @@ var require_crc = __commonJS((exports) => {
|
|
|
10914
10916
|
});
|
|
10915
10917
|
|
|
10916
10918
|
// ../../node_modules/.bun/@smithy+signature-v4@5.7.3/node_modules/@smithy/signature-v4/dist-cjs/index.js
|
|
10917
|
-
var require_dist_cjs3 = __commonJS((exports)
|
|
10919
|
+
var require_dist_cjs3 = __commonJS(function(exports) {
|
|
10918
10920
|
var { hasOwn: hasOwn2, fromUtf8, fromHex, toHex, toUint8Array: toUint8Array2, isArrayBuffer: isArrayBuffer2 } = require_serde();
|
|
10919
10921
|
var { normalizeProvider: normalizeProvider2 } = require_client();
|
|
10920
10922
|
var { escapeUri, HttpRequest: HttpRequest2 } = require_protocols();
|
|
@@ -11466,7 +11468,7 @@ ${toHex(hashedRequest)}`;
|
|
|
11466
11468
|
});
|
|
11467
11469
|
|
|
11468
11470
|
// ../../node_modules/.bun/@aws-sdk+signature-v4-multi-region@3.996.46/node_modules/@aws-sdk/signature-v4-multi-region/dist-cjs/index.js
|
|
11469
|
-
var require_dist_cjs4 = __commonJS((exports)
|
|
11471
|
+
var require_dist_cjs4 = __commonJS(function(exports) {
|
|
11470
11472
|
var { SignatureV4, signatureV4aContainer } = require_dist_cjs3();
|
|
11471
11473
|
var signatureV4CrtContainer = {
|
|
11472
11474
|
CrtSignerV4: null
|
|
@@ -11598,7 +11600,7 @@ var require_dist_cjs4 = __commonJS((exports) => {
|
|
|
11598
11600
|
});
|
|
11599
11601
|
|
|
11600
11602
|
// ../../node_modules/.bun/@aws-sdk+core@3.977.9/node_modules/@aws-sdk/core/dist-cjs/submodules/util/index.js
|
|
11601
|
-
var require_util = __commonJS((exports)
|
|
11603
|
+
var require_util = __commonJS(function(exports) {
|
|
11602
11604
|
var { buildQueryString } = require_protocols();
|
|
11603
11605
|
var validate = (str) => typeof str === "string" && str.indexOf("arn:") === 0 && str.split(":").length >= 6;
|
|
11604
11606
|
var parse = (arn) => {
|
|
@@ -11656,7 +11658,7 @@ var require_util = __commonJS((exports) => {
|
|
|
11656
11658
|
});
|
|
11657
11659
|
|
|
11658
11660
|
// ../../node_modules/.bun/@smithy+core@3.33.3/node_modules/@smithy/core/dist-cjs/submodules/cbor/index.js
|
|
11659
|
-
var require_cbor = __commonJS((exports)
|
|
11661
|
+
var require_cbor = __commonJS(function(exports) {
|
|
11660
11662
|
var { nv, NumericValue, calculateBodyLength, generateIdempotencyToken, fromBase64, _parseEpochTimestamp } = require_serde();
|
|
11661
11663
|
var { hasOwn: hasOwn2, getSmithyContext } = require_transport();
|
|
11662
11664
|
var { HttpRequest: HttpRequest2, collectBody, SerdeContext, RpcProtocol } = require_protocols();
|
|
@@ -14106,7 +14108,7 @@ var require_cbor = __commonJS((exports) => {
|
|
|
14106
14108
|
});
|
|
14107
14109
|
|
|
14108
14110
|
// ../../node_modules/.bun/@aws-sdk+xml-builder@3.972.40/node_modules/@aws-sdk/xml-builder/dist-cjs/index.js
|
|
14109
|
-
var require_dist_cjs5 = __commonJS((exports)
|
|
14111
|
+
var require_dist_cjs5 = __commonJS(function(exports) {
|
|
14110
14112
|
var ATTR_ESCAPE_RE = /[&<>"]/g;
|
|
14111
14113
|
var ATTR_ESCAPE_MAP = {
|
|
14112
14114
|
"&": "&",
|
|
@@ -14474,7 +14476,7 @@ var require_dist_cjs5 = __commonJS((exports) => {
|
|
|
14474
14476
|
});
|
|
14475
14477
|
|
|
14476
14478
|
// ../../node_modules/.bun/@aws-sdk+core@3.977.9/node_modules/@aws-sdk/core/dist-cjs/submodules/protocols/index.js
|
|
14477
|
-
var require_protocols2 = __commonJS((exports)
|
|
14479
|
+
var require_protocols2 = __commonJS(function(exports) {
|
|
14478
14480
|
var { SmithyRpcV2CborProtocol, loadSmithyRpcV2CborErrorCode } = require_cbor();
|
|
14479
14481
|
var { TypeRegistry, NormalizedSchema, deref } = require_schema();
|
|
14480
14482
|
var { decorateServiceException, getValueFromTextNode } = require_client();
|
|
@@ -17315,7 +17317,7 @@ var require_protocols2 = __commonJS((exports) => {
|
|
|
17315
17317
|
});
|
|
17316
17318
|
|
|
17317
17319
|
// ../../node_modules/.bun/@aws-sdk+core@3.977.9/node_modules/@aws-sdk/core/dist-cjs/submodules/httpAuthSchemes/index.js
|
|
17318
|
-
var require_httpAuthSchemes = __commonJS((exports)
|
|
17320
|
+
var require_httpAuthSchemes = __commonJS(function(exports) {
|
|
17319
17321
|
var { ProviderError, booleanSelector: booleanSelector2, SelectorType: SelectorType3, loadConfig } = require_config();
|
|
17320
17322
|
var { setCredentialFeature } = require_client2();
|
|
17321
17323
|
var { normalizeProvider: normalizeProvider2, memoizeIdentityProvider, isIdentityExpired, doesIdentityRequireRefresh } = require_dist_cjs2();
|
|
@@ -17675,13 +17677,13 @@ var init_fromEnv = __esm(() => {
|
|
|
17675
17677
|
// ../../node_modules/.bun/@aws-sdk+credential-provider-env@3.972.70/node_modules/@aws-sdk/credential-provider-env/dist-es/index.js
|
|
17676
17678
|
var exports_dist_es = {};
|
|
17677
17679
|
__export(exports_dist_es, {
|
|
17678
|
-
|
|
17679
|
-
ENV_SESSION: () => ENV_SESSION,
|
|
17680
|
-
ENV_SECRET: () => ENV_SECRET,
|
|
17681
|
-
ENV_KEY: () => ENV_KEY,
|
|
17682
|
-
ENV_EXPIRATION: () => ENV_EXPIRATION,
|
|
17680
|
+
ENV_ACCOUNT_ID: () => ENV_ACCOUNT_ID,
|
|
17683
17681
|
ENV_CREDENTIAL_SCOPE: () => ENV_CREDENTIAL_SCOPE,
|
|
17684
|
-
|
|
17682
|
+
ENV_EXPIRATION: () => ENV_EXPIRATION,
|
|
17683
|
+
ENV_KEY: () => ENV_KEY,
|
|
17684
|
+
ENV_SECRET: () => ENV_SECRET,
|
|
17685
|
+
ENV_SESSION: () => ENV_SESSION,
|
|
17686
|
+
fromEnv: () => fromEnv
|
|
17685
17687
|
});
|
|
17686
17688
|
var init_dist_es = __esm(() => {
|
|
17687
17689
|
init_fromEnv();
|
|
@@ -18065,17 +18067,17 @@ var init_fromInstanceMetadata = __esm(() => {
|
|
|
18065
18067
|
// ../../node_modules/.bun/@smithy+credential-provider-imds@4.5.2/node_modules/@smithy/credential-provider-imds/dist-es/index.js
|
|
18066
18068
|
var exports_dist_es2 = {};
|
|
18067
18069
|
__export(exports_dist_es2, {
|
|
18068
|
-
|
|
18069
|
-
httpRequest: () => httpRequest,
|
|
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,
|
|
18070
|
+
DEFAULT_MAX_RETRIES: () => DEFAULT_MAX_RETRIES,
|
|
18077
18071
|
DEFAULT_TIMEOUT: () => DEFAULT_TIMEOUT,
|
|
18078
|
-
|
|
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,
|
|
18079
|
+
httpRequest: () => httpRequest,
|
|
18080
|
+
providerConfigFromInit: () => providerConfigFromInit
|
|
18079
18081
|
});
|
|
18080
18082
|
var init_dist_es2 = __esm(() => {
|
|
18081
18083
|
init_fromContainerMetadata();
|
|
@@ -18086,7 +18088,7 @@ var init_dist_es2 = __esm(() => {
|
|
|
18086
18088
|
});
|
|
18087
18089
|
|
|
18088
18090
|
// ../../node_modules/.bun/@smithy+node-http-handler@4.12.1/node_modules/@smithy/node-http-handler/dist-cjs/index.js
|
|
18089
|
-
var require_dist_cjs6 = __commonJS((exports)
|
|
18091
|
+
var require_dist_cjs6 = __commonJS(function(exports) {
|
|
18090
18092
|
var { hasOwn: hasOwn2 } = require_serde();
|
|
18091
18093
|
var { streamCollector } = require_serde();
|
|
18092
18094
|
exports.streamCollector = streamCollector;
|
|
@@ -19093,7 +19095,7 @@ var init_constants = __esm(() => {
|
|
|
19093
19095
|
});
|
|
19094
19096
|
|
|
19095
19097
|
// ../../node_modules/.bun/@aws-sdk+nested-clients@3.997.44/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso-oidc/index.js
|
|
19096
|
-
var require_sso_oidc = __commonJS((exports)
|
|
19098
|
+
var require_sso_oidc = __commonJS(function(exports) {
|
|
19097
19099
|
var { awsEndpointFunctions: awsEndpointFunctions2, emitWarningIfUnsupportedVersion: emitWarningIfUnsupportedVersion$1, createDefaultUserAgentProvider, NODE_APP_ID_CONFIG_OPTIONS, getAwsRegionExtensionConfiguration, resolveAwsRegionExtensionConfiguration, resolveUserAgentConfig, resolveHostHeaderConfig, getUserAgentPlugin, getHostHeaderPlugin, getLoggerPlugin, getRecursionDetectionPlugin } = require_client2();
|
|
19098
19100
|
var { NoAuthSigner, getHttpAuthSchemeEndpointRuleSetPlugin, DefaultIdentityProviderConfig, getHttpSigningPlugin } = require_dist_cjs2();
|
|
19099
19101
|
var { normalizeProvider: normalizeProvider3, getSmithyContext: getSmithyContext3, ServiceException, NoOpLogger: NoOpLogger2, emitWarningIfUnsupportedVersion, loadConfigsForDefaultMode, getDefaultExtensionConfiguration, resolveDefaultRuntimeConfig, Client, makeBuilder: makeBuilder2, createAggregatedClient } = require_client();
|
|
@@ -20445,8 +20447,8 @@ var init_sso = __esm(() => {
|
|
|
20445
20447
|
// ../../node_modules/.bun/@aws-sdk+credential-provider-sso@3.973.14/node_modules/@aws-sdk/credential-provider-sso/dist-es/loadSso.js
|
|
20446
20448
|
var exports_loadSso = {};
|
|
20447
20449
|
__export(exports_loadSso, {
|
|
20448
|
-
|
|
20449
|
-
|
|
20450
|
+
GetRoleCredentialsCommand: () => $GetRoleCredentialsCommand,
|
|
20451
|
+
SSOClient: () => $SSOClient
|
|
20450
20452
|
});
|
|
20451
20453
|
var init_loadSso = __esm(() => {
|
|
20452
20454
|
init_sso();
|
|
@@ -20639,9 +20641,9 @@ var init_fromSSO = __esm(() => {
|
|
|
20639
20641
|
// ../../node_modules/.bun/@aws-sdk+credential-provider-sso@3.973.14/node_modules/@aws-sdk/credential-provider-sso/dist-es/index.js
|
|
20640
20642
|
var exports_dist_es4 = {};
|
|
20641
20643
|
__export(exports_dist_es4, {
|
|
20642
|
-
|
|
20644
|
+
fromSSO: () => fromSSO,
|
|
20643
20645
|
isSsoProfile: () => isSsoProfile,
|
|
20644
|
-
|
|
20646
|
+
validateSsoProfile: () => validateSsoProfile
|
|
20645
20647
|
});
|
|
20646
20648
|
var init_dist_es5 = __esm(() => {
|
|
20647
20649
|
init_fromSSO();
|
|
@@ -20680,7 +20682,7 @@ var init_resolveCredentialSource = __esm(() => {
|
|
|
20680
20682
|
});
|
|
20681
20683
|
|
|
20682
20684
|
// ../../node_modules/.bun/@aws-sdk+nested-clients@3.997.44/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sts/index.js
|
|
20683
|
-
var require_sts = __commonJS((exports)
|
|
20685
|
+
var require_sts = __commonJS(function(exports) {
|
|
20684
20686
|
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();
|
|
20685
20687
|
var { NoAuthSigner: NoAuthSigner2, getHttpAuthSchemeEndpointRuleSetPlugin: getHttpAuthSchemeEndpointRuleSetPlugin2, DefaultIdentityProviderConfig: DefaultIdentityProviderConfig2, getHttpSigningPlugin: getHttpSigningPlugin2 } = require_dist_cjs2();
|
|
20686
20688
|
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();
|
|
@@ -21770,7 +21772,7 @@ var init_resolveAssumeRoleCredentials = __esm(() => {
|
|
|
21770
21772
|
});
|
|
21771
21773
|
|
|
21772
21774
|
// ../../node_modules/.bun/@aws-sdk+nested-clients@3.997.44/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/signin/index.js
|
|
21773
|
-
var require_signin = __commonJS((exports)
|
|
21775
|
+
var require_signin = __commonJS(function(exports) {
|
|
21774
21776
|
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();
|
|
21775
21777
|
var { NoAuthSigner: NoAuthSigner2, getHttpAuthSchemeEndpointRuleSetPlugin: getHttpAuthSchemeEndpointRuleSetPlugin2, DefaultIdentityProviderConfig: DefaultIdentityProviderConfig2, getHttpSigningPlugin: getHttpSigningPlugin2 } = require_dist_cjs2();
|
|
21776
21778
|
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();
|
|
@@ -23013,8 +23015,8 @@ var init_fromTokenFile = __esm(() => {
|
|
|
23013
23015
|
// ../../node_modules/.bun/@aws-sdk+credential-provider-web-identity@3.972.76/node_modules/@aws-sdk/credential-provider-web-identity/dist-es/index.js
|
|
23014
23016
|
var exports_dist_es7 = {};
|
|
23015
23017
|
__export(exports_dist_es7, {
|
|
23016
|
-
|
|
23017
|
-
|
|
23018
|
+
fromTokenFile: () => fromTokenFile,
|
|
23019
|
+
fromWebToken: () => fromWebToken
|
|
23018
23020
|
});
|
|
23019
23021
|
var init_dist_es8 = __esm(() => {
|
|
23020
23022
|
init_fromTokenFile();
|
|
@@ -23115,6 +23117,7 @@ import { spawn } from "child_process";
|
|
|
23115
23117
|
import { request as nodeHttpRequest } from "http";
|
|
23116
23118
|
import { request as nodeHttpsRequest } from "https";
|
|
23117
23119
|
import { randomUUID as randomUUID22 } from "crypto";
|
|
23120
|
+
import { createRequire as createRequire2 } from "module";
|
|
23118
23121
|
function getPathValue(input, path) {
|
|
23119
23122
|
return path.split(".").reduce((value, part) => {
|
|
23120
23123
|
if (value && typeof value === "object" && part in value) {
|
|
@@ -24330,7 +24333,7 @@ function normalizeRetryPolicy(policy) {
|
|
|
24330
24333
|
}
|
|
24331
24334
|
var PATHS_RESOLVER_KIND_ENV, PATHS_RESOLVER_APP_SLUG_RE2, HASNA_EVENTS_DIR_ENV = "HASNA_EVENTS_DIR", HASNA_EVENTS_HOME_ENV = "HASNA_EVENTS_HOME", EVENTS_STORE_SENTINEL_FILE = "events.json", LOCAL_JSON_EVENT_CURSOR_PREFIX = "local-json-v1:", DEFAULT_EVENT_PAGE_LIMIT = 100, MAX_EVENT_PAGE_LIMIT = 1000, DEFAULT_SIGNATURE_TOLERANCE_MS, DEFAULT_MAX_REDIRECTS = 5, IPV4_PRIVATE_RANGES, IPV6_SPECIAL_PREFIXES, defaultTargetLookup = async (hostname) => {
|
|
24332
24335
|
return dnsLookup(hostname, { all: true, verbatim: false });
|
|
24333
|
-
}, EventValidationError, defaultEventTypeCatalog, APP_EVENT_V1_MAX_DATA_BYTES;
|
|
24336
|
+
}, EventValidationError, defaultEventTypeCatalog, APP_EVENT_V1_MAX_DATA_BYTES, MAX_CREDENTIAL_FILE_BYTES2, INSPECT_CUSTOM2, CREDENTIAL_SEAL2, AMBIENT_ENVIRONMENT2, SECRETS_PACKAGE_SPECIFIER2, requireSecretsSdk2, IDEMPOTENT_METHODS2, AUTHORITY_OVERRIDE_HEADERS2, MAX_ENVELOPE_BYTES, MAX_REQUEST_BYTES;
|
|
24334
24337
|
var init_dist = __esm(() => {
|
|
24335
24338
|
PATHS_RESOLVER_KIND_ENV = {
|
|
24336
24339
|
config: "HASNA_CONFIG_HOME",
|
|
@@ -24386,6 +24389,22 @@ var init_dist = __esm(() => {
|
|
|
24386
24389
|
};
|
|
24387
24390
|
defaultEventTypeCatalog = new EventTypeCatalog;
|
|
24388
24391
|
APP_EVENT_V1_MAX_DATA_BYTES = 32 * 1024;
|
|
24392
|
+
MAX_CREDENTIAL_FILE_BYTES2 = 64 * 1024;
|
|
24393
|
+
INSPECT_CUSTOM2 = Symbol.for("nodejs.util.inspect.custom");
|
|
24394
|
+
CREDENTIAL_SEAL2 = Symbol.for("hasna:contracts:sealedCredential");
|
|
24395
|
+
AMBIENT_ENVIRONMENT2 = Symbol.for("hasna:contracts:ambientClientEnvironment");
|
|
24396
|
+
SECRETS_PACKAGE_SPECIFIER2 = "@hasna/" + "secrets";
|
|
24397
|
+
requireSecretsSdk2 = createRequire2(import.meta.url);
|
|
24398
|
+
IDEMPOTENT_METHODS2 = new Set(["GET", "HEAD", "PUT", "DELETE", "OPTIONS"]);
|
|
24399
|
+
AUTHORITY_OVERRIDE_HEADERS2 = new Set([
|
|
24400
|
+
"host",
|
|
24401
|
+
":authority",
|
|
24402
|
+
"forwarded",
|
|
24403
|
+
"x-forwarded-host",
|
|
24404
|
+
"x-original-host"
|
|
24405
|
+
]);
|
|
24406
|
+
MAX_ENVELOPE_BYTES = 256 * 1024;
|
|
24407
|
+
MAX_REQUEST_BYTES = MAX_ENVELOPE_BYTES * 2 + 8192;
|
|
24389
24408
|
});
|
|
24390
24409
|
|
|
24391
24410
|
// src/sdk/event-sink.ts
|
|
@@ -25462,7 +25481,7 @@ class MissingSkillsFleetError extends Error {
|
|
|
25462
25481
|
// package.json
|
|
25463
25482
|
var package_default = {
|
|
25464
25483
|
name: "@hasna/skills",
|
|
25465
|
-
version: "0.5.
|
|
25484
|
+
version: "0.5.4",
|
|
25466
25485
|
description: "Skills library for AI coding agents",
|
|
25467
25486
|
type: "module",
|
|
25468
25487
|
bin: {
|
|
@@ -25635,6 +25654,41 @@ import { createHmac, timingSafeEqual } from "crypto";
|
|
|
25635
25654
|
import { createHash } from "crypto";
|
|
25636
25655
|
import { readFileSync as readFileSync2, readdirSync, statSync } from "fs";
|
|
25637
25656
|
import { join as join2, relative } from "path";
|
|
25657
|
+
import { createGunzip } from "zlib";
|
|
25658
|
+
|
|
25659
|
+
// src/lib/skill-entry-path.ts
|
|
25660
|
+
class SkillEntryPaths {
|
|
25661
|
+
files = new Set;
|
|
25662
|
+
directories = new Set;
|
|
25663
|
+
add(path, maxBytes, invalid, limit) {
|
|
25664
|
+
if (path.length > maxBytes)
|
|
25665
|
+
limit();
|
|
25666
|
+
const encoded = new TextEncoder().encode(path);
|
|
25667
|
+
if (encoded.byteLength > maxBytes)
|
|
25668
|
+
limit();
|
|
25669
|
+
if (new TextDecoder("utf-8", { fatal: true, ignoreBOM: true }).decode(encoded) !== path)
|
|
25670
|
+
invalid("Invalid UTF-8 entry path");
|
|
25671
|
+
if (!path || /[\\:\x00-\x1f\x7f]/u.test(path))
|
|
25672
|
+
invalid("Unsafe entry path");
|
|
25673
|
+
if (path.split("/").some((segment) => !segment || segment === "." || segment === ".."))
|
|
25674
|
+
invalid("Unsafe entry path segment");
|
|
25675
|
+
const key = path.normalize("NFC").toLowerCase().normalize("NFC");
|
|
25676
|
+
if (this.files.has(key) || this.directories.has(key))
|
|
25677
|
+
invalid("Duplicate or conflicting entry path");
|
|
25678
|
+
const parents = key.split("/");
|
|
25679
|
+
parents.pop();
|
|
25680
|
+
while (parents.length) {
|
|
25681
|
+
const parent = parents.join("/");
|
|
25682
|
+
if (this.files.has(parent))
|
|
25683
|
+
invalid("Conflicting entry file ancestor");
|
|
25684
|
+
this.directories.add(parent);
|
|
25685
|
+
parents.pop();
|
|
25686
|
+
}
|
|
25687
|
+
this.files.add(key);
|
|
25688
|
+
}
|
|
25689
|
+
}
|
|
25690
|
+
|
|
25691
|
+
// src/lib/skill-bundle.ts
|
|
25638
25692
|
var BLOCK = 512;
|
|
25639
25693
|
var ANY_SEGMENT_EXCLUDES = new Set([
|
|
25640
25694
|
".git",
|
|
@@ -25957,6 +26011,227 @@ function concat(chunks) {
|
|
|
25957
26011
|
}
|
|
25958
26012
|
return merged;
|
|
25959
26013
|
}
|
|
26014
|
+
var SKILL_BUNDLE_INSPECTION_LIMITS = Object.freeze({
|
|
26015
|
+
compressedBytes: 16 * 1024 * 1024,
|
|
26016
|
+
decompressedBytes: 64 * 1024 * 1024,
|
|
26017
|
+
entries: 1024,
|
|
26018
|
+
fileBytes: 16 * 1024 * 1024,
|
|
26019
|
+
pathBytes: 100,
|
|
26020
|
+
timeoutMs: 5000
|
|
26021
|
+
});
|
|
26022
|
+
|
|
26023
|
+
class SkillBundleInspectionError extends Error {
|
|
26024
|
+
code;
|
|
26025
|
+
constructor(code, message) {
|
|
26026
|
+
super(message);
|
|
26027
|
+
this.code = code;
|
|
26028
|
+
this.name = "SkillBundleInspectionError";
|
|
26029
|
+
}
|
|
26030
|
+
}
|
|
26031
|
+
function invalidBundle(message) {
|
|
26032
|
+
throw new SkillBundleInspectionError("BUNDLE_INVALID", message);
|
|
26033
|
+
}
|
|
26034
|
+
function inspectionLimits(options) {
|
|
26035
|
+
const limits = { ...SKILL_BUNDLE_INSPECTION_LIMITS };
|
|
26036
|
+
for (const key of Object.keys(options.limits ?? {})) {
|
|
26037
|
+
if (!Object.hasOwn(limits, key))
|
|
26038
|
+
throw new SkillBundleInspectionError("BUNDLE_LIMIT", "Unknown bundle limit");
|
|
26039
|
+
const field = key;
|
|
26040
|
+
const value = options.limits[field];
|
|
26041
|
+
if (!Number.isSafeInteger(value) || value <= 0 || value > limits[field]) {
|
|
26042
|
+
throw new SkillBundleInspectionError("BUNDLE_LIMIT", "Bundle limits must be positive integers within the hard ceilings");
|
|
26043
|
+
}
|
|
26044
|
+
limits[field] = value;
|
|
26045
|
+
}
|
|
26046
|
+
return limits;
|
|
26047
|
+
}
|
|
26048
|
+
async function inspectSkillBundle(bundle, options = {}) {
|
|
26049
|
+
const signal = options.signal;
|
|
26050
|
+
const limits = inspectionLimits(options);
|
|
26051
|
+
const deadline = performance.now() + limits.timeoutMs;
|
|
26052
|
+
const check = () => {
|
|
26053
|
+
if (signal?.aborted)
|
|
26054
|
+
throw new SkillBundleInspectionError("BUNDLE_ABORTED", "Bundle inspection aborted");
|
|
26055
|
+
if (performance.now() >= deadline)
|
|
26056
|
+
throw new SkillBundleInspectionError("BUNDLE_TIMEOUT", "Bundle inspection deadline exceeded");
|
|
26057
|
+
};
|
|
26058
|
+
check();
|
|
26059
|
+
if (bundle.byteLength > limits.compressedBytes)
|
|
26060
|
+
throw new SkillBundleInspectionError("BUNDLE_LIMIT", "Compressed bundle exceeds byte limit");
|
|
26061
|
+
const snapshot = ownBytes(bundle);
|
|
26062
|
+
check();
|
|
26063
|
+
const sha256 = sha256Hex(snapshot);
|
|
26064
|
+
check();
|
|
26065
|
+
const parser = new BoundedTarReader(limits, check);
|
|
26066
|
+
const streamOptions = { chunkSize: 16 * 1024, highWaterMark: 16 * 1024 };
|
|
26067
|
+
const decoder = createGunzip(streamOptions);
|
|
26068
|
+
let terminalError;
|
|
26069
|
+
const stop = (code) => {
|
|
26070
|
+
terminalError ??= new SkillBundleInspectionError(code, code === "BUNDLE_ABORTED" ? "Bundle inspection aborted" : "Bundle inspection deadline exceeded");
|
|
26071
|
+
decoder.destroy(terminalError);
|
|
26072
|
+
};
|
|
26073
|
+
const onAbort = () => stop("BUNDLE_ABORTED");
|
|
26074
|
+
const timer = setTimeout(() => stop("BUNDLE_TIMEOUT"), Math.max(1, deadline - performance.now()));
|
|
26075
|
+
signal?.addEventListener("abort", onAbort, { once: true });
|
|
26076
|
+
let decompressedByteSize = 0;
|
|
26077
|
+
let bytesSinceYield = 0;
|
|
26078
|
+
try {
|
|
26079
|
+
check();
|
|
26080
|
+
decoder.end(snapshot);
|
|
26081
|
+
for await (const chunk of decoder) {
|
|
26082
|
+
check();
|
|
26083
|
+
decompressedByteSize += chunk.byteLength;
|
|
26084
|
+
if (decompressedByteSize > limits.decompressedBytes)
|
|
26085
|
+
throw new SkillBundleInspectionError("BUNDLE_LIMIT", "Decompressed bundle exceeds byte limit");
|
|
26086
|
+
parser.push(chunk);
|
|
26087
|
+
bytesSinceYield += chunk.byteLength;
|
|
26088
|
+
if (bytesSinceYield >= 256 * 1024) {
|
|
26089
|
+
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
26090
|
+
bytesSinceYield = 0;
|
|
26091
|
+
check();
|
|
26092
|
+
}
|
|
26093
|
+
}
|
|
26094
|
+
check();
|
|
26095
|
+
const entries = parser.finish();
|
|
26096
|
+
return {
|
|
26097
|
+
entries,
|
|
26098
|
+
sha256,
|
|
26099
|
+
compressedByteSize: snapshot.byteLength,
|
|
26100
|
+
decompressedByteSize,
|
|
26101
|
+
unpackedByteSize: parser.fileBytes,
|
|
26102
|
+
fileCount: entries.length
|
|
26103
|
+
};
|
|
26104
|
+
} catch (error) {
|
|
26105
|
+
if (terminalError)
|
|
26106
|
+
throw terminalError;
|
|
26107
|
+
if (error instanceof SkillBundleInspectionError)
|
|
26108
|
+
throw error;
|
|
26109
|
+
throw new SkillBundleInspectionError("BUNDLE_INVALID", "Invalid or truncated gzip bundle");
|
|
26110
|
+
} finally {
|
|
26111
|
+
clearTimeout(timer);
|
|
26112
|
+
signal?.removeEventListener("abort", onAbort);
|
|
26113
|
+
decoder.destroy();
|
|
26114
|
+
}
|
|
26115
|
+
}
|
|
26116
|
+
|
|
26117
|
+
class BoundedTarReader {
|
|
26118
|
+
limits;
|
|
26119
|
+
check;
|
|
26120
|
+
header = new Uint8Array(BLOCK);
|
|
26121
|
+
headerOffset = 0;
|
|
26122
|
+
pending;
|
|
26123
|
+
bodyOffset = 0;
|
|
26124
|
+
padding = 0;
|
|
26125
|
+
zeroBlocks = 0;
|
|
26126
|
+
entries = [];
|
|
26127
|
+
paths = new SkillEntryPaths;
|
|
26128
|
+
fileBytes = 0;
|
|
26129
|
+
constructor(limits, check) {
|
|
26130
|
+
this.limits = limits;
|
|
26131
|
+
this.check = check;
|
|
26132
|
+
}
|
|
26133
|
+
push(chunk) {
|
|
26134
|
+
let offset = 0;
|
|
26135
|
+
while (offset < chunk.byteLength) {
|
|
26136
|
+
this.check();
|
|
26137
|
+
if (this.pending) {
|
|
26138
|
+
const count = Math.min(this.pending.bytes.byteLength - this.bodyOffset, chunk.byteLength - offset);
|
|
26139
|
+
this.pending.bytes.set(chunk.subarray(offset, offset + count), this.bodyOffset);
|
|
26140
|
+
offset += count;
|
|
26141
|
+
this.bodyOffset += count;
|
|
26142
|
+
if (this.bodyOffset === this.pending.bytes.byteLength) {
|
|
26143
|
+
this.entries.push(this.pending);
|
|
26144
|
+
this.pending = undefined;
|
|
26145
|
+
}
|
|
26146
|
+
} else if (this.padding) {
|
|
26147
|
+
const count = Math.min(this.padding, chunk.byteLength - offset);
|
|
26148
|
+
if (chunk.subarray(offset, offset + count).some((byte) => byte !== 0))
|
|
26149
|
+
invalidBundle("Nonzero tar body padding");
|
|
26150
|
+
offset += count;
|
|
26151
|
+
this.padding -= count;
|
|
26152
|
+
} else {
|
|
26153
|
+
const count = Math.min(BLOCK - this.headerOffset, chunk.byteLength - offset);
|
|
26154
|
+
this.header.set(chunk.subarray(offset, offset + count), this.headerOffset);
|
|
26155
|
+
offset += count;
|
|
26156
|
+
this.headerOffset += count;
|
|
26157
|
+
if (this.headerOffset === BLOCK) {
|
|
26158
|
+
this.readHeader();
|
|
26159
|
+
this.headerOffset = 0;
|
|
26160
|
+
}
|
|
26161
|
+
}
|
|
26162
|
+
}
|
|
26163
|
+
}
|
|
26164
|
+
finish() {
|
|
26165
|
+
this.check();
|
|
26166
|
+
if (this.pending || this.padding || this.headerOffset || this.zeroBlocks < 2)
|
|
26167
|
+
invalidBundle("Truncated tar bundle");
|
|
26168
|
+
return this.entries;
|
|
26169
|
+
}
|
|
26170
|
+
readHeader() {
|
|
26171
|
+
this.check();
|
|
26172
|
+
const h = this.header;
|
|
26173
|
+
if (h.every((byte) => byte === 0)) {
|
|
26174
|
+
this.zeroBlocks++;
|
|
26175
|
+
return;
|
|
26176
|
+
}
|
|
26177
|
+
if (this.zeroBlocks)
|
|
26178
|
+
invalidBundle("Nonzero tar data after terminator");
|
|
26179
|
+
if (this.entries.length >= this.limits.entries)
|
|
26180
|
+
throw new SkillBundleInspectionError("BUNDLE_LIMIT", "Bundle entry limit exceeded");
|
|
26181
|
+
let checksum = 0;
|
|
26182
|
+
for (let i = 0;i < BLOCK; i++)
|
|
26183
|
+
checksum += i >= 148 && i < 156 ? 32 : h[i];
|
|
26184
|
+
if (tarOctal(h.subarray(148, 156)) !== checksum)
|
|
26185
|
+
invalidBundle("Invalid tar header checksum");
|
|
26186
|
+
if (new TextDecoder().decode(h.subarray(257, 265)) !== "ustar\x00" + "00")
|
|
26187
|
+
invalidBundle("Unsupported tar format");
|
|
26188
|
+
if (h[156] !== 48 && h[156] !== 0 || h.subarray(157, 257).some((b) => b !== 0) || h.subarray(345).some((b) => b !== 0))
|
|
26189
|
+
invalidBundle("Unsupported tar entry or path prefix");
|
|
26190
|
+
const mode = tarOctal(h.subarray(100, 108));
|
|
26191
|
+
if (mode > 511)
|
|
26192
|
+
invalidBundle("Unsupported tar permission bits");
|
|
26193
|
+
tarOctal(h.subarray(108, 116));
|
|
26194
|
+
tarOctal(h.subarray(116, 124));
|
|
26195
|
+
tarOctal(h.subarray(136, 148));
|
|
26196
|
+
const size = tarOctal(h.subarray(124, 136));
|
|
26197
|
+
if (size > this.limits.fileBytes || this.fileBytes + size > this.limits.decompressedBytes) {
|
|
26198
|
+
throw new SkillBundleInspectionError("BUNDLE_LIMIT", "Bundle file byte limit exceeded");
|
|
26199
|
+
}
|
|
26200
|
+
const name = h.subarray(0, 100);
|
|
26201
|
+
const end = name.indexOf(0);
|
|
26202
|
+
if (end !== -1 && name.subarray(end).some((b) => b !== 0))
|
|
26203
|
+
invalidBundle("Invalid tar path padding");
|
|
26204
|
+
const raw = end === -1 ? name : name.subarray(0, end);
|
|
26205
|
+
if (raw.byteLength > this.limits.pathBytes)
|
|
26206
|
+
throw new SkillBundleInspectionError("BUNDLE_LIMIT", "Bundle path byte limit exceeded");
|
|
26207
|
+
let path;
|
|
26208
|
+
try {
|
|
26209
|
+
path = new TextDecoder("utf-8", { fatal: true, ignoreBOM: true }).decode(raw);
|
|
26210
|
+
} catch {
|
|
26211
|
+
return invalidBundle("Invalid UTF-8 bundle path");
|
|
26212
|
+
}
|
|
26213
|
+
this.paths.add(path, this.limits.pathBytes, invalidBundle, () => {
|
|
26214
|
+
throw new SkillBundleInspectionError("BUNDLE_LIMIT", "Bundle path byte limit exceeded");
|
|
26215
|
+
});
|
|
26216
|
+
this.fileBytes += size;
|
|
26217
|
+
this.pending = { path, mode, bytes: new Uint8Array(new ArrayBuffer(size)) };
|
|
26218
|
+
this.bodyOffset = 0;
|
|
26219
|
+
this.padding = (BLOCK - size % BLOCK) % BLOCK;
|
|
26220
|
+
if (!size) {
|
|
26221
|
+
this.entries.push(this.pending);
|
|
26222
|
+
this.pending = undefined;
|
|
26223
|
+
}
|
|
26224
|
+
}
|
|
26225
|
+
}
|
|
26226
|
+
function tarOctal(field) {
|
|
26227
|
+
const text = new TextDecoder().decode(field);
|
|
26228
|
+
if (!/^[0-7]+[\0 ]*$/.test(text))
|
|
26229
|
+
invalidBundle("Invalid tar octal field");
|
|
26230
|
+
const value = Number.parseInt(text, 8);
|
|
26231
|
+
if (!Number.isSafeInteger(value))
|
|
26232
|
+
invalidBundle("Tar integer is out of range");
|
|
26233
|
+
return value;
|
|
26234
|
+
}
|
|
25960
26235
|
|
|
25961
26236
|
// src/lib/skill-bundles.ts
|
|
25962
26237
|
var SKILLS_SIGNING_KEY_ENV = "SKILLS_SIGNING_KEY";
|
|
@@ -38659,6 +38934,9 @@ import { existsSync as existsSync6, readdirSync as readdirSync6, readFileSync as
|
|
|
38659
38934
|
import { join as join11, sep } from "path";
|
|
38660
38935
|
var CONTENT_HASH_ALGORITHM = "sha256";
|
|
38661
38936
|
var HASH_EXCLUDE_DIRS = new Set([".git", "node_modules", "dist", "build", ".turbo"]);
|
|
38937
|
+
function excludedHashEntry(name, directory) {
|
|
38938
|
+
return name.startsWith(".") || directory && HASH_EXCLUDE_DIRS.has(name);
|
|
38939
|
+
}
|
|
38662
38940
|
var HASH_COVERAGE = [
|
|
38663
38941
|
"SKILL.md",
|
|
38664
38942
|
"skill.json",
|
|
@@ -38740,7 +39018,7 @@ function collectDirectory(files, dir, rel) {
|
|
|
38740
39018
|
if (stats.isSymbolicLink())
|
|
38741
39019
|
continue;
|
|
38742
39020
|
if (stats.isDirectory()) {
|
|
38743
|
-
if (
|
|
39021
|
+
if (excludedHashEntry(entry, true))
|
|
38744
39022
|
continue;
|
|
38745
39023
|
collectDirectory(files, absolute, childRel);
|
|
38746
39024
|
} else if (stats.isFile()) {
|
|
@@ -38750,28 +39028,242 @@ function collectDirectory(files, dir, rel) {
|
|
|
38750
39028
|
}
|
|
38751
39029
|
function collectFile(files, absolute, rel) {
|
|
38752
39030
|
const buffer = readFileSync8(absolute);
|
|
39031
|
+
files.push(normalizeBundleFile(rel.split(sep).join("/"), buffer));
|
|
39032
|
+
}
|
|
39033
|
+
function normalizeBundleFile(rel, buffer) {
|
|
38753
39034
|
if (rel === "skill.json") {
|
|
38754
|
-
|
|
38755
|
-
return;
|
|
39035
|
+
return { rel, content: new TextEncoder().encode(canonicalizeManifest(new TextDecoder().decode(buffer))) };
|
|
38756
39036
|
}
|
|
38757
39037
|
if (looksLikeText(buffer)) {
|
|
38758
39038
|
const normalized = normalizeLineEndings(new TextDecoder().decode(buffer));
|
|
38759
|
-
|
|
38760
|
-
return;
|
|
39039
|
+
return { rel, content: new TextEncoder().encode(normalized) };
|
|
38761
39040
|
}
|
|
38762
|
-
|
|
39041
|
+
return { rel, content: buffer };
|
|
38763
39042
|
}
|
|
38764
39043
|
function computeContentHash(skillPath) {
|
|
39044
|
+
return hashBundleFiles(collectBundleFiles(skillPath));
|
|
39045
|
+
}
|
|
39046
|
+
function* bundleHashParts(files) {
|
|
39047
|
+
for (const file of files) {
|
|
39048
|
+
yield new TextEncoder().encode(file.rel);
|
|
39049
|
+
yield new TextEncoder().encode(`\x00${file.content.length}\x00`);
|
|
39050
|
+
yield file.content;
|
|
39051
|
+
yield new TextEncoder().encode("\x00");
|
|
39052
|
+
}
|
|
39053
|
+
yield new TextEncoder().encode("\x00");
|
|
39054
|
+
}
|
|
39055
|
+
function hashBundleFiles(files) {
|
|
39056
|
+
const hash = createHash6(CONTENT_HASH_ALGORITHM);
|
|
39057
|
+
for (const part of bundleHashParts(files))
|
|
39058
|
+
hash.update(part);
|
|
39059
|
+
return hash.digest("hex");
|
|
39060
|
+
}
|
|
39061
|
+
async function hashBundleFilesCooperatively(files, check) {
|
|
38765
39062
|
const hash = createHash6(CONTENT_HASH_ALGORITHM);
|
|
38766
|
-
|
|
38767
|
-
|
|
38768
|
-
|
|
38769
|
-
|
|
38770
|
-
|
|
39063
|
+
let bytesSinceYield = 0;
|
|
39064
|
+
for (const part of bundleHashParts(files)) {
|
|
39065
|
+
for (let offset = 0;offset < part.byteLength; offset += 64 * 1024) {
|
|
39066
|
+
check();
|
|
39067
|
+
const chunk = part.subarray(offset, offset + 64 * 1024);
|
|
39068
|
+
hash.update(chunk);
|
|
39069
|
+
bytesSinceYield += chunk.byteLength;
|
|
39070
|
+
if (bytesSinceYield >= 256 * 1024) {
|
|
39071
|
+
await new Promise((resolve2) => setImmediate(resolve2));
|
|
39072
|
+
bytesSinceYield = 0;
|
|
39073
|
+
}
|
|
39074
|
+
}
|
|
38771
39075
|
}
|
|
38772
|
-
|
|
39076
|
+
check();
|
|
38773
39077
|
return hash.digest("hex");
|
|
38774
39078
|
}
|
|
39079
|
+
var CONTENT_HASH_LIMITS = Object.freeze({
|
|
39080
|
+
entries: 1024,
|
|
39081
|
+
rawBytes: 64 * 1024 * 1024,
|
|
39082
|
+
normalizedBytes: 64 * 1024 * 1024,
|
|
39083
|
+
fileBytes: 16 * 1024 * 1024,
|
|
39084
|
+
normalizedFileBytes: 16 * 1024 * 1024,
|
|
39085
|
+
pathBytes: 100,
|
|
39086
|
+
manifestBytes: 16 * 1024,
|
|
39087
|
+
manifestDepth: 64,
|
|
39088
|
+
timeoutMs: 5000
|
|
39089
|
+
});
|
|
39090
|
+
|
|
39091
|
+
class ContentHashInputError extends Error {
|
|
39092
|
+
code;
|
|
39093
|
+
constructor(code, message) {
|
|
39094
|
+
super(message);
|
|
39095
|
+
this.code = code;
|
|
39096
|
+
this.name = "ContentHashInputError";
|
|
39097
|
+
}
|
|
39098
|
+
}
|
|
39099
|
+
function invalidContent(message = "Invalid content hash input") {
|
|
39100
|
+
throw new ContentHashInputError("CONTENT_HASH_INVALID", message);
|
|
39101
|
+
}
|
|
39102
|
+
function contentLimit(message) {
|
|
39103
|
+
throw new ContentHashInputError("CONTENT_HASH_LIMIT", message);
|
|
39104
|
+
}
|
|
39105
|
+
function contentRecord(value, allowed) {
|
|
39106
|
+
if (!value || typeof value !== "object" || ![Object.prototype, null].includes(Object.getPrototypeOf(value)))
|
|
39107
|
+
invalidContent();
|
|
39108
|
+
const result = Object.create(null);
|
|
39109
|
+
for (const key of Reflect.ownKeys(value)) {
|
|
39110
|
+
if (typeof key !== "string" || !allowed.includes(key))
|
|
39111
|
+
invalidContent();
|
|
39112
|
+
const descriptor = Object.getOwnPropertyDescriptor(value, key);
|
|
39113
|
+
if (!descriptor || !("value" in descriptor))
|
|
39114
|
+
invalidContent("Accessor content hash input is unsupported");
|
|
39115
|
+
result[key] = descriptor.value;
|
|
39116
|
+
}
|
|
39117
|
+
return result;
|
|
39118
|
+
}
|
|
39119
|
+
function contentOptions(options) {
|
|
39120
|
+
const record = contentRecord(options, ["limits", "signal"]);
|
|
39121
|
+
const limits = { ...CONTENT_HASH_LIMITS };
|
|
39122
|
+
if (record.limits !== undefined) {
|
|
39123
|
+
const supplied = contentRecord(record.limits, Object.keys(limits));
|
|
39124
|
+
for (const key of Object.keys(supplied)) {
|
|
39125
|
+
const value = supplied[key];
|
|
39126
|
+
if (typeof value !== "number" || !Number.isSafeInteger(value) || value <= 0 || value > limits[key])
|
|
39127
|
+
contentLimit("Invalid content hash limit");
|
|
39128
|
+
limits[key] = value;
|
|
39129
|
+
}
|
|
39130
|
+
}
|
|
39131
|
+
if (record.signal !== undefined && !(record.signal instanceof AbortSignal))
|
|
39132
|
+
invalidContent("Invalid content hash signal");
|
|
39133
|
+
return { limits, signal: record.signal };
|
|
39134
|
+
}
|
|
39135
|
+
var typedArrayPrototype = Object.getPrototypeOf(Uint8Array.prototype);
|
|
39136
|
+
var byteLengthOf = Object.getOwnPropertyDescriptor(typedArrayPrototype, "byteLength").get;
|
|
39137
|
+
var bufferOf = Object.getOwnPropertyDescriptor(typedArrayPrototype, "buffer").get;
|
|
39138
|
+
function snapshotContentEntries(entries, limits, check) {
|
|
39139
|
+
if (!Array.isArray(entries))
|
|
39140
|
+
invalidContent("Content hash entries must be an array");
|
|
39141
|
+
if (entries.length > limits.entries)
|
|
39142
|
+
contentLimit("Content hash entry limit exceeded");
|
|
39143
|
+
if (Reflect.ownKeys(entries).length !== entries.length + 1)
|
|
39144
|
+
invalidContent("Invalid content hash entry array");
|
|
39145
|
+
const snapshot = [];
|
|
39146
|
+
const paths = new SkillEntryPaths;
|
|
39147
|
+
let rawBytes = 0;
|
|
39148
|
+
for (let index = 0;index < entries.length; index++) {
|
|
39149
|
+
check();
|
|
39150
|
+
const descriptor = Object.getOwnPropertyDescriptor(entries, String(index));
|
|
39151
|
+
if (!descriptor || !("value" in descriptor))
|
|
39152
|
+
invalidContent("Invalid content hash entry array");
|
|
39153
|
+
const entry = contentRecord(descriptor.value, ["path", "bytes", "mode"]);
|
|
39154
|
+
if (typeof entry.path !== "string" || typeof entry.mode !== "number" || !Number.isInteger(entry.mode) || entry.mode < 0 || entry.mode > 511)
|
|
39155
|
+
invalidContent("Invalid regular-file content hash entry");
|
|
39156
|
+
paths.add(entry.path, limits.pathBytes, invalidContent, () => contentLimit("Content hash path limit exceeded"));
|
|
39157
|
+
if (!(entry.bytes instanceof Uint8Array) || !ArrayBuffer.isView(entry.bytes))
|
|
39158
|
+
invalidContent("Content hash entry requires bytes");
|
|
39159
|
+
const size = byteLengthOf.call(entry.bytes);
|
|
39160
|
+
if (!(bufferOf.call(entry.bytes) instanceof ArrayBuffer))
|
|
39161
|
+
invalidContent("Shared content hash bytes are unsupported");
|
|
39162
|
+
if (size > limits.fileBytes || rawBytes + size > limits.rawBytes)
|
|
39163
|
+
contentLimit("Content hash raw byte limit exceeded");
|
|
39164
|
+
if (entry.path === "skill.json" && size > limits.manifestBytes)
|
|
39165
|
+
contentLimit("Content hash manifest byte limit exceeded");
|
|
39166
|
+
rawBytes += size;
|
|
39167
|
+
const bytes = new Uint8Array(new ArrayBuffer(size));
|
|
39168
|
+
bytes.set(entry.bytes);
|
|
39169
|
+
snapshot.push({ path: entry.path, bytes, mode: entry.mode });
|
|
39170
|
+
}
|
|
39171
|
+
check();
|
|
39172
|
+
return snapshot;
|
|
39173
|
+
}
|
|
39174
|
+
function coveredContentPath(path) {
|
|
39175
|
+
const segments = path.split("/");
|
|
39176
|
+
if (!HASH_COVERAGE.includes(segments[0]))
|
|
39177
|
+
return false;
|
|
39178
|
+
return !segments.slice(1).some((segment, index) => excludedHashEntry(segment, index < segments.length - 2));
|
|
39179
|
+
}
|
|
39180
|
+
function boundedManifest(raw, maxDepth) {
|
|
39181
|
+
let parsed;
|
|
39182
|
+
try {
|
|
39183
|
+
parsed = JSON.parse(raw);
|
|
39184
|
+
} catch {
|
|
39185
|
+
return;
|
|
39186
|
+
}
|
|
39187
|
+
const pending = [{ value: parsed, depth: 1 }];
|
|
39188
|
+
while (pending.length) {
|
|
39189
|
+
const { value, depth } = pending.pop();
|
|
39190
|
+
if (!value || typeof value !== "object")
|
|
39191
|
+
continue;
|
|
39192
|
+
if (depth > maxDepth)
|
|
39193
|
+
contentLimit("Content hash manifest depth limit exceeded");
|
|
39194
|
+
for (const child of Object.values(value))
|
|
39195
|
+
pending.push({ value: child, depth: depth + 1 });
|
|
39196
|
+
}
|
|
39197
|
+
return parsed;
|
|
39198
|
+
}
|
|
39199
|
+
async function hashContentEntries(entries, options) {
|
|
39200
|
+
const { limits, signal } = contentOptions(options);
|
|
39201
|
+
const deadline = performance.now() + limits.timeoutMs;
|
|
39202
|
+
let terminal;
|
|
39203
|
+
const abort = () => {
|
|
39204
|
+
terminal ??= new ContentHashInputError("CONTENT_HASH_ABORTED", "Content hashing aborted");
|
|
39205
|
+
};
|
|
39206
|
+
const timer = setTimeout(() => {
|
|
39207
|
+
terminal ??= new ContentHashInputError("CONTENT_HASH_TIMEOUT", "Content hashing deadline exceeded");
|
|
39208
|
+
}, limits.timeoutMs);
|
|
39209
|
+
const check = () => {
|
|
39210
|
+
if (signal?.aborted)
|
|
39211
|
+
abort();
|
|
39212
|
+
if (terminal)
|
|
39213
|
+
throw terminal;
|
|
39214
|
+
if (performance.now() >= deadline)
|
|
39215
|
+
throw new ContentHashInputError("CONTENT_HASH_TIMEOUT", "Content hashing deadline exceeded");
|
|
39216
|
+
};
|
|
39217
|
+
try {
|
|
39218
|
+
signal?.addEventListener("abort", abort, { once: true });
|
|
39219
|
+
check();
|
|
39220
|
+
const snapshot = snapshotContentEntries(entries, limits, check);
|
|
39221
|
+
const normalized = [];
|
|
39222
|
+
let normalizedBytes = 0;
|
|
39223
|
+
let manifest;
|
|
39224
|
+
await new Promise((resolve2) => setImmediate(resolve2));
|
|
39225
|
+
for (const entry of snapshot) {
|
|
39226
|
+
check();
|
|
39227
|
+
if (!coveredContentPath(entry.path))
|
|
39228
|
+
continue;
|
|
39229
|
+
if (entry.path === "skill.json")
|
|
39230
|
+
manifest = boundedManifest(new TextDecoder().decode(entry.bytes), limits.manifestDepth);
|
|
39231
|
+
const file = normalizeBundleFile(entry.path, entry.bytes);
|
|
39232
|
+
check();
|
|
39233
|
+
if (file.content.byteLength > limits.normalizedFileBytes || normalizedBytes + file.content.byteLength > limits.normalizedBytes)
|
|
39234
|
+
contentLimit("Content hash normalized byte limit exceeded");
|
|
39235
|
+
normalizedBytes += file.content.byteLength;
|
|
39236
|
+
normalized.push(file);
|
|
39237
|
+
await new Promise((resolve2) => setImmediate(resolve2));
|
|
39238
|
+
}
|
|
39239
|
+
normalized.sort((a3, b3) => a3.rel < b3.rel ? -1 : a3.rel > b3.rel ? 1 : 0);
|
|
39240
|
+
check();
|
|
39241
|
+
return { hash: await hashBundleFilesCooperatively(normalized, check), manifest };
|
|
39242
|
+
} catch (error) {
|
|
39243
|
+
if (error instanceof ContentHashInputError)
|
|
39244
|
+
throw error;
|
|
39245
|
+
throw new ContentHashInputError("CONTENT_HASH_INVALID", "Invalid content hash input");
|
|
39246
|
+
} finally {
|
|
39247
|
+
clearTimeout(timer);
|
|
39248
|
+
signal?.removeEventListener("abort", abort);
|
|
39249
|
+
}
|
|
39250
|
+
}
|
|
39251
|
+
async function computeContentHashFromEntries(entries, options = {}) {
|
|
39252
|
+
return (await hashContentEntries(entries, options)).hash;
|
|
39253
|
+
}
|
|
39254
|
+
async function verifyContentHashFromEntries(entries, options = {}) {
|
|
39255
|
+
const { hash, manifest } = await hashContentEntries(entries, options);
|
|
39256
|
+
const provenance = manifest && typeof manifest === "object" && !Array.isArray(manifest) ? manifest.provenance : undefined;
|
|
39257
|
+
const value = provenance && typeof provenance === "object" && !Array.isArray(provenance) ? provenance.content_hash : undefined;
|
|
39258
|
+
if (value !== undefined && typeof value !== "string")
|
|
39259
|
+
invalidContent("Invalid content hash declaration");
|
|
39260
|
+
const declaredHash = value?.trim() || undefined;
|
|
39261
|
+
if (!declaredHash)
|
|
39262
|
+
return { declared: false, valid: false };
|
|
39263
|
+
if (!/^[a-f0-9]{64}$/.test(declaredHash))
|
|
39264
|
+
return { declared: true, valid: false, declaredHash };
|
|
39265
|
+
return { declared: true, valid: hash === declaredHash, declaredHash, computedHash: hash };
|
|
39266
|
+
}
|
|
38775
39267
|
function verifyContentHash(skillPath, manifest) {
|
|
38776
39268
|
const declaredHash = manifest?.provenance?.content_hash?.trim() || undefined;
|
|
38777
39269
|
if (!declaredHash)
|
|
@@ -43566,113 +44058,113 @@ var currentVersionService = {
|
|
|
43566
44058
|
// ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/external.js
|
|
43567
44059
|
var exports_external = {};
|
|
43568
44060
|
__export(exports_external, {
|
|
43569
|
-
|
|
43570
|
-
util: () => util,
|
|
43571
|
-
unknown: () => unknownType,
|
|
43572
|
-
union: () => unionType,
|
|
43573
|
-
undefined: () => undefinedType,
|
|
43574
|
-
tuple: () => tupleType,
|
|
43575
|
-
transformer: () => effectsType,
|
|
43576
|
-
symbol: () => symbolType,
|
|
43577
|
-
string: () => stringType,
|
|
43578
|
-
strictObject: () => strictObjectType,
|
|
43579
|
-
setErrorMap: () => setErrorMap,
|
|
43580
|
-
set: () => setType,
|
|
43581
|
-
record: () => recordType,
|
|
43582
|
-
quotelessJson: () => quotelessJson,
|
|
43583
|
-
promise: () => promiseType,
|
|
43584
|
-
preprocess: () => preprocessType,
|
|
43585
|
-
pipeline: () => pipelineType,
|
|
43586
|
-
ostring: () => ostring,
|
|
43587
|
-
optional: () => optionalType,
|
|
43588
|
-
onumber: () => onumber,
|
|
43589
|
-
oboolean: () => oboolean,
|
|
43590
|
-
objectUtil: () => objectUtil,
|
|
43591
|
-
object: () => objectType,
|
|
43592
|
-
number: () => numberType,
|
|
43593
|
-
nullable: () => nullableType,
|
|
43594
|
-
null: () => nullType,
|
|
43595
|
-
never: () => neverType,
|
|
43596
|
-
nativeEnum: () => nativeEnumType,
|
|
43597
|
-
nan: () => nanType,
|
|
43598
|
-
map: () => mapType,
|
|
43599
|
-
makeIssue: () => makeIssue,
|
|
43600
|
-
literal: () => literalType,
|
|
43601
|
-
lazy: () => lazyType,
|
|
43602
|
-
late: () => late,
|
|
43603
|
-
isValid: () => isValid,
|
|
43604
|
-
isDirty: () => isDirty,
|
|
43605
|
-
isAsync: () => isAsync,
|
|
43606
|
-
isAborted: () => isAborted,
|
|
43607
|
-
intersection: () => intersectionType,
|
|
43608
|
-
instanceof: () => instanceOfType,
|
|
43609
|
-
getParsedType: () => getParsedType,
|
|
43610
|
-
getErrorMap: () => getErrorMap,
|
|
43611
|
-
function: () => functionType,
|
|
43612
|
-
enum: () => enumType,
|
|
43613
|
-
effect: () => effectsType,
|
|
43614
|
-
discriminatedUnion: () => discriminatedUnionType,
|
|
43615
|
-
defaultErrorMap: () => en_default,
|
|
43616
|
-
datetimeRegex: () => datetimeRegex,
|
|
43617
|
-
date: () => dateType,
|
|
43618
|
-
custom: () => custom,
|
|
43619
|
-
coerce: () => coerce,
|
|
43620
|
-
boolean: () => booleanType,
|
|
43621
|
-
bigint: () => bigIntType,
|
|
43622
|
-
array: () => arrayType,
|
|
43623
|
-
any: () => anyType,
|
|
43624
|
-
addIssueToContext: () => addIssueToContext,
|
|
43625
|
-
ZodVoid: () => ZodVoid,
|
|
43626
|
-
ZodUnknown: () => ZodUnknown,
|
|
43627
|
-
ZodUnion: () => ZodUnion,
|
|
43628
|
-
ZodUndefined: () => ZodUndefined,
|
|
43629
|
-
ZodType: () => ZodType,
|
|
43630
|
-
ZodTuple: () => ZodTuple,
|
|
43631
|
-
ZodTransformer: () => ZodEffects,
|
|
43632
|
-
ZodSymbol: () => ZodSymbol,
|
|
43633
|
-
ZodString: () => ZodString,
|
|
43634
|
-
ZodSet: () => ZodSet,
|
|
43635
|
-
ZodSchema: () => ZodType,
|
|
43636
|
-
ZodRecord: () => ZodRecord,
|
|
43637
|
-
ZodReadonly: () => ZodReadonly,
|
|
43638
|
-
ZodPromise: () => ZodPromise,
|
|
43639
|
-
ZodPipeline: () => ZodPipeline,
|
|
43640
|
-
ZodParsedType: () => ZodParsedType,
|
|
43641
|
-
ZodOptional: () => ZodOptional,
|
|
43642
|
-
ZodObject: () => ZodObject,
|
|
43643
|
-
ZodNumber: () => ZodNumber,
|
|
43644
|
-
ZodNullable: () => ZodNullable,
|
|
43645
|
-
ZodNull: () => ZodNull,
|
|
43646
|
-
ZodNever: () => ZodNever,
|
|
43647
|
-
ZodNativeEnum: () => ZodNativeEnum,
|
|
43648
|
-
ZodNaN: () => ZodNaN,
|
|
43649
|
-
ZodMap: () => ZodMap,
|
|
43650
|
-
ZodLiteral: () => ZodLiteral,
|
|
43651
|
-
ZodLazy: () => ZodLazy,
|
|
43652
|
-
ZodIssueCode: () => ZodIssueCode,
|
|
43653
|
-
ZodIntersection: () => ZodIntersection,
|
|
43654
|
-
ZodFunction: () => ZodFunction,
|
|
43655
|
-
ZodFirstPartyTypeKind: () => ZodFirstPartyTypeKind,
|
|
43656
|
-
ZodError: () => ZodError,
|
|
43657
|
-
ZodEnum: () => ZodEnum,
|
|
43658
|
-
ZodEffects: () => ZodEffects,
|
|
43659
|
-
ZodDiscriminatedUnion: () => ZodDiscriminatedUnion,
|
|
43660
|
-
ZodDefault: () => ZodDefault,
|
|
43661
|
-
ZodDate: () => ZodDate,
|
|
43662
|
-
ZodCatch: () => ZodCatch,
|
|
43663
|
-
ZodBranded: () => ZodBranded,
|
|
43664
|
-
ZodBoolean: () => ZodBoolean,
|
|
43665
|
-
ZodBigInt: () => ZodBigInt,
|
|
43666
|
-
ZodArray: () => ZodArray,
|
|
43667
|
-
ZodAny: () => ZodAny,
|
|
43668
|
-
Schema: () => ZodType,
|
|
43669
|
-
ParseStatus: () => ParseStatus,
|
|
43670
|
-
OK: () => OK,
|
|
43671
|
-
NEVER: () => NEVER,
|
|
43672
|
-
INVALID: () => INVALID,
|
|
43673
|
-
EMPTY_PATH: () => EMPTY_PATH,
|
|
44061
|
+
BRAND: () => BRAND,
|
|
43674
44062
|
DIRTY: () => DIRTY,
|
|
43675
|
-
|
|
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,
|
|
44166
|
+
util: () => util,
|
|
44167
|
+
void: () => voidType
|
|
43676
44168
|
});
|
|
43677
44169
|
|
|
43678
44170
|
// ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/helpers/util.js
|
|
@@ -52164,11 +52656,174 @@ function createOfflineGate(options) {
|
|
|
52164
52656
|
}
|
|
52165
52657
|
};
|
|
52166
52658
|
}
|
|
52167
|
-
// src/lib/remote-
|
|
52659
|
+
// src/lib/remote-invitations.ts
|
|
52660
|
+
class WorkspaceInvitationInputError extends Error {
|
|
52661
|
+
code = "INVITATION_INPUT_INVALID";
|
|
52662
|
+
constructor() {
|
|
52663
|
+
super("Provide only the documented invitation fields, exact lowercase IDs, expected generation and explicit confirmation. Issue and resend require your stable idempotency key.");
|
|
52664
|
+
this.name = "WorkspaceInvitationInputError";
|
|
52665
|
+
}
|
|
52666
|
+
}
|
|
52667
|
+
var invitationFailures = {
|
|
52668
|
+
INVALID_REQUEST: [400, "Invitation parameters were refused."],
|
|
52669
|
+
ACCOUNT_UNAVAILABLE: [403, "Account is unavailable."],
|
|
52670
|
+
INTERACTIVE_SESSION_REQUIRED: [403, "Fresh interactive sign-in is required."],
|
|
52671
|
+
WORKSPACE_ADMIN_REQUIRED: [403, "A current workspace owner or admin is required."],
|
|
52672
|
+
INVITATION_FORBIDDEN: [403, "Your current role cannot manage this invitation."],
|
|
52673
|
+
INVITATION_UNAVAILABLE: [404, "Invitation is unavailable for this account."],
|
|
52674
|
+
INVITATION_CHANGED: [409, "Invitation changed. Read its current generation before another action."],
|
|
52675
|
+
INVITATION_EXISTS: [409, "A pending invitation already exists. Read current invitations."],
|
|
52676
|
+
ALREADY_MEMBER: [409, "An active membership already exists. An invitation cannot change its role."],
|
|
52677
|
+
IDEMPOTENCY_CONFLICT: [409, "This request key was used for different invitation parameters. Reconcile the original request."],
|
|
52678
|
+
INVITATION_LIMIT: [429, "Invitation limit reached. Wait before issuing or resending."],
|
|
52679
|
+
INVITATION_BUSY: [503, "Invitation is busy. Read its state before another action."],
|
|
52680
|
+
INVITATION_DELIVERY_UNAVAILABLE: [503, "Invitation email delivery is unavailable."]
|
|
52681
|
+
};
|
|
52682
|
+
|
|
52683
|
+
class RemoteWorkspaceInvitationError extends Error {
|
|
52684
|
+
code;
|
|
52685
|
+
status;
|
|
52686
|
+
constructor(code) {
|
|
52687
|
+
super(invitationFailures[code][1]);
|
|
52688
|
+
this.code = code;
|
|
52689
|
+
this.name = "RemoteWorkspaceInvitationError";
|
|
52690
|
+
this.status = invitationFailures[code][0];
|
|
52691
|
+
}
|
|
52692
|
+
}
|
|
52693
|
+
|
|
52694
|
+
class RemoteWorkspaceInvitationUnconfirmedError extends Error {
|
|
52695
|
+
code = "INVITATION_UNCONFIRMED";
|
|
52696
|
+
constructor() {
|
|
52697
|
+
super("The invitation outcome is unconfirmed. Read current invitations or memberships. Reconcile issue/resend only with the same request key, parameters, server and membership; never generate a new key or retry automatically. Saved credentials are unchanged.");
|
|
52698
|
+
this.name = "RemoteWorkspaceInvitationUnconfirmedError";
|
|
52699
|
+
}
|
|
52700
|
+
}
|
|
52701
|
+
|
|
52702
|
+
class RemoteWorkspaceInvitationReadError extends Error {
|
|
52703
|
+
code = "INVITATION_READ_FAILED";
|
|
52704
|
+
constructor() {
|
|
52705
|
+
super("Unable to read a valid invitation result. Check the selected server, account, current membership and permissions.");
|
|
52706
|
+
this.name = "RemoteWorkspaceInvitationReadError";
|
|
52707
|
+
}
|
|
52708
|
+
}
|
|
52709
|
+
function invitationFailure(value, status) {
|
|
52710
|
+
if (!record(value) || typeof value.code !== "string" || !Object.hasOwn(invitationFailures, value.code))
|
|
52711
|
+
return null;
|
|
52712
|
+
const code = value.code;
|
|
52713
|
+
return invitationFailures[code][0] === status ? code : null;
|
|
52714
|
+
}
|
|
52168
52715
|
var record = (v2) => !!v2 && typeof v2 === "object" && !Array.isArray(v2);
|
|
52169
52716
|
var uuid = (v2) => typeof v2 === "string" && /^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/.test(v2);
|
|
52170
|
-
var text = (v2, max = 1024) => typeof v2 === "string" && !!v2.trim() && v2.length <= max && !/[\p{Cc}\p{Cs}\u2028\u2029]/u.test(v2);
|
|
52171
52717
|
var role = (v2) => typeof v2 === "string" && ["owner", "admin", "member", "viewer"].includes(v2);
|
|
52718
|
+
var email = (v2) => typeof v2 === "string" && v2.length <= 254 && !/[\p{Cc}\p{Cs}\u2028\u2029\s]/u.test(v2) && /^[^@]+@[^@]+\.[^@]+$/.test(v2);
|
|
52719
|
+
var timestamp = (v2) => typeof v2 === "string" && v2.length <= 40 && /^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.\d{1,6})?(?:Z|[+-]\d\d:\d\d)$/.test(v2) && Number.isFinite(Date.parse(v2));
|
|
52720
|
+
var inputFailure = () => {
|
|
52721
|
+
throw new WorkspaceInvitationInputError;
|
|
52722
|
+
};
|
|
52723
|
+
function invitationInput(action, input) {
|
|
52724
|
+
if (!record(input))
|
|
52725
|
+
return inputFailure();
|
|
52726
|
+
const keys = {
|
|
52727
|
+
list: ["after"],
|
|
52728
|
+
get: ["invitationId"],
|
|
52729
|
+
issue: ["email", "role", "idempotencyKey", "confirm"],
|
|
52730
|
+
resend: ["invitationId", "expectedGeneration", "idempotencyKey", "confirm"],
|
|
52731
|
+
revoke: ["invitationId", "expectedGeneration", "confirm"],
|
|
52732
|
+
accept: ["invitationId", "token", "confirm"]
|
|
52733
|
+
};
|
|
52734
|
+
if (Object.keys(input).some((key) => !keys[action].includes(key)) || action !== "list" && keys[action].some((key) => !Object.hasOwn(input, key)))
|
|
52735
|
+
return inputFailure();
|
|
52736
|
+
const value = { ...input };
|
|
52737
|
+
if (action === "list") {
|
|
52738
|
+
if (value.after !== undefined && !uuid(value.after))
|
|
52739
|
+
return inputFailure();
|
|
52740
|
+
}
|
|
52741
|
+
if (["get", "resend", "revoke", "accept"].includes(action) && !uuid(value.invitationId))
|
|
52742
|
+
return inputFailure();
|
|
52743
|
+
if (!["list", "get"].includes(action) && value.confirm !== true)
|
|
52744
|
+
return inputFailure();
|
|
52745
|
+
if (["issue", "resend"].includes(action) && !uuid(value.idempotencyKey))
|
|
52746
|
+
return inputFailure();
|
|
52747
|
+
if (action === "issue") {
|
|
52748
|
+
if (typeof value.email !== "string")
|
|
52749
|
+
return inputFailure();
|
|
52750
|
+
value.email = value.email.trim().toLowerCase();
|
|
52751
|
+
if (!email(value.email) || !role(value.role))
|
|
52752
|
+
return inputFailure();
|
|
52753
|
+
}
|
|
52754
|
+
if (["resend", "revoke"].includes(action) && (!Number.isInteger(value.expectedGeneration) || Number(value.expectedGeneration) < 1 || Number(value.expectedGeneration) > 10))
|
|
52755
|
+
return inputFailure();
|
|
52756
|
+
if (action === "accept" && (typeof value.token !== "string" || !/^[A-Za-z0-9_-]{43}$/.test(value.token)))
|
|
52757
|
+
return inputFailure();
|
|
52758
|
+
return value;
|
|
52759
|
+
}
|
|
52760
|
+
function invitationRequest(action, input) {
|
|
52761
|
+
const base = "/api/v1/workspace/invitations", value = input;
|
|
52762
|
+
const { confirm: _confirm, invitationId: id, ...body } = value;
|
|
52763
|
+
if (action === "list")
|
|
52764
|
+
return { path: base + (value.after ? `?after=${value.after}` : ""), method: "GET" };
|
|
52765
|
+
if (action === "get")
|
|
52766
|
+
return { path: `${base}/${id}`, method: "GET" };
|
|
52767
|
+
if (action === "accept")
|
|
52768
|
+
return { path: "/api/v1/account/invitations/accept", method: "POST", body: JSON.stringify({ invitationId: id, token: value.token }) };
|
|
52769
|
+
return { path: action === "issue" ? base : `${base}/${id}${action === "resend" ? "/resend" : ""}`, method: action === "revoke" ? "DELETE" : "POST", body: JSON.stringify(body) };
|
|
52770
|
+
}
|
|
52771
|
+
function invalid() {
|
|
52772
|
+
throw new RemoteWorkspaceInvitationReadError;
|
|
52773
|
+
}
|
|
52774
|
+
function projection(v2, organizationId) {
|
|
52775
|
+
if (!record(v2) || !uuid(v2.id) || v2.organizationId !== organizationId || !email(v2.email) || v2.email !== v2.email.trim().toLowerCase() || !role(v2.role) || !Number.isInteger(v2.generation) || Number(v2.generation) < 1 || Number(v2.generation) > 10 || typeof v2.status !== "string" || !["pending", "expired", "accepted", "revoked"].includes(v2.status) || !timestamp(v2.expiresAt) || !timestamp(v2.createdAt) || !record(v2.delivery) || typeof v2.delivery.state !== "string" || !["queued", "sending", "uncertain", "provider_accepted", "failed", "cancelled"].includes(v2.delivery.state) || !Number.isInteger(v2.delivery.attempts) || Number(v2.delivery.attempts) < 0 || Number(v2.delivery.attempts) > 5)
|
|
52776
|
+
return invalid();
|
|
52777
|
+
return {
|
|
52778
|
+
id: v2.id,
|
|
52779
|
+
organizationId,
|
|
52780
|
+
email: v2.email,
|
|
52781
|
+
role: v2.role,
|
|
52782
|
+
generation: Number(v2.generation),
|
|
52783
|
+
status: v2.status,
|
|
52784
|
+
expiresAt: v2.expiresAt,
|
|
52785
|
+
createdAt: v2.createdAt,
|
|
52786
|
+
delivery: { state: v2.delivery.state, attempts: Number(v2.delivery.attempts) }
|
|
52787
|
+
};
|
|
52788
|
+
}
|
|
52789
|
+
function parseInvitationResult(action, value, input, organizationId) {
|
|
52790
|
+
if (!record(value))
|
|
52791
|
+
return invalid();
|
|
52792
|
+
const request = input;
|
|
52793
|
+
if (action === "accept") {
|
|
52794
|
+
if (!uuid(value.organizationId) || !uuid(value.membershipId) || value.accepted !== true || typeof value.changed !== "boolean")
|
|
52795
|
+
return invalid();
|
|
52796
|
+
return { organizationId: value.organizationId, membershipId: value.membershipId, accepted: true, changed: value.changed };
|
|
52797
|
+
}
|
|
52798
|
+
if (action === "list") {
|
|
52799
|
+
if (value.organizationId !== organizationId || !Array.isArray(value.invitations) || value.invitations.length > 50 || value.nextCursor !== null && !uuid(value.nextCursor))
|
|
52800
|
+
return invalid();
|
|
52801
|
+
const invitations = value.invitations.map((v2) => projection(v2, organizationId));
|
|
52802
|
+
if (invitations.some((v2, n2) => v2.id <= String(n2 ? invitations[n2 - 1].id : request.after ?? "")) || value.nextCursor !== null && (invitations.length !== 50 || value.nextCursor !== invitations.at(-1)?.id))
|
|
52803
|
+
return invalid();
|
|
52804
|
+
return { organizationId, invitations, nextCursor: value.nextCursor };
|
|
52805
|
+
}
|
|
52806
|
+
const invitation = projection(value.invitation, organizationId);
|
|
52807
|
+
if (action !== "issue" && invitation.id !== request.invitationId)
|
|
52808
|
+
return invalid();
|
|
52809
|
+
if (action === "get")
|
|
52810
|
+
return { invitation };
|
|
52811
|
+
if (typeof value.changed !== "boolean")
|
|
52812
|
+
return invalid();
|
|
52813
|
+
if (action === "issue" && (invitation.email !== request.email || invitation.role !== request.role || value.changed && invitation.generation !== 1))
|
|
52814
|
+
return invalid();
|
|
52815
|
+
if (action === "resend" && (value.changed ? invitation.generation !== Number(request.expectedGeneration) + 1 : invitation.generation <= Number(request.expectedGeneration)))
|
|
52816
|
+
return invalid();
|
|
52817
|
+
if (action === "revoke" && (invitation.status !== "revoked" || invitation.generation < Number(request.expectedGeneration) || value.changed && invitation.generation !== request.expectedGeneration))
|
|
52818
|
+
return invalid();
|
|
52819
|
+
return { invitation, changed: value.changed };
|
|
52820
|
+
}
|
|
52821
|
+
|
|
52822
|
+
// src/lib/remote-workspace-selection.ts
|
|
52823
|
+
var record2 = (v2) => !!v2 && typeof v2 === "object" && !Array.isArray(v2);
|
|
52824
|
+
var uuid2 = (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);
|
|
52825
|
+
var text = (v2, max = 1024) => typeof v2 === "string" && !!v2.trim() && v2.length <= max && !/[\p{Cc}\p{Cs}\u2028\u2029]/u.test(v2);
|
|
52826
|
+
var role2 = (v2) => typeof v2 === "string" && ["owner", "admin", "member", "viewer"].includes(v2);
|
|
52172
52827
|
var invalidWorkspaceResult = "The server returned an invalid workspace selection result.";
|
|
52173
52828
|
|
|
52174
52829
|
class WorkspaceContextInputError extends Error {
|
|
@@ -52185,48 +52840,48 @@ class WorkspaceIdentityMismatchError extends Error {
|
|
|
52185
52840
|
}
|
|
52186
52841
|
}
|
|
52187
52842
|
function workspaceExpectedUserId(value) {
|
|
52188
|
-
if (!
|
|
52843
|
+
if (!uuid2(value))
|
|
52189
52844
|
throw new WorkspaceContextInputError;
|
|
52190
52845
|
return value;
|
|
52191
52846
|
}
|
|
52192
52847
|
function workspaceContext(value) {
|
|
52193
|
-
if (!
|
|
52848
|
+
if (!record2(value) || Object.keys(value).sort().join(",") !== "membershipId,userId" || !uuid2(value.userId) || !uuid2(value.membershipId))
|
|
52194
52849
|
throw new WorkspaceContextInputError;
|
|
52195
52850
|
return { userId: value.userId, membershipId: value.membershipId };
|
|
52196
52851
|
}
|
|
52197
|
-
function
|
|
52852
|
+
function invalid2() {
|
|
52198
52853
|
throw new Error(invalidWorkspaceResult);
|
|
52199
52854
|
}
|
|
52200
52855
|
function organization(v2) {
|
|
52201
|
-
if (!
|
|
52202
|
-
return
|
|
52856
|
+
if (!record2(v2) || !uuid2(v2.id) || !text(v2.slug) || !text(v2.name))
|
|
52857
|
+
return invalid2();
|
|
52203
52858
|
return { id: v2.id, slug: v2.slug, name: v2.name };
|
|
52204
52859
|
}
|
|
52205
52860
|
function parseAccountWorkspaces(value) {
|
|
52206
|
-
if (!
|
|
52207
|
-
return
|
|
52861
|
+
if (!record2(value) || !Array.isArray(value.workspaces) || !value.workspaces.length || value.workspaces.length > 1000)
|
|
52862
|
+
return invalid2();
|
|
52208
52863
|
const workspaces = value.workspaces.map((v2) => {
|
|
52209
|
-
if (!
|
|
52210
|
-
return
|
|
52864
|
+
if (!record2(v2) || !uuid2(v2.membershipId) || !role2(v2.role) || typeof v2.current !== "boolean")
|
|
52865
|
+
return invalid2();
|
|
52211
52866
|
return { membershipId: v2.membershipId, organization: organization(v2.organization), role: v2.role, current: v2.current };
|
|
52212
52867
|
});
|
|
52213
52868
|
if (workspaces.filter((w2) => w2.current).length !== 1 || new Set(workspaces.map((w2) => w2.membershipId)).size !== workspaces.length || new Set(workspaces.map((w2) => w2.organization.id)).size !== workspaces.length)
|
|
52214
|
-
return
|
|
52869
|
+
return invalid2();
|
|
52215
52870
|
return { workspaces };
|
|
52216
52871
|
}
|
|
52217
52872
|
function parseWorkspaceIdentity(value, expectedUserId) {
|
|
52218
|
-
if (!
|
|
52219
|
-
return
|
|
52873
|
+
if (!record2(value))
|
|
52874
|
+
return invalid2();
|
|
52220
52875
|
const user = value.user;
|
|
52221
|
-
if (!
|
|
52222
|
-
return
|
|
52876
|
+
if (!record2(user) || !uuid2(user.id) || !uuid2(user.membershipId) || !text(user.email, 320) || !(user.displayName === null || text(user.displayName)) || !role2(user.role))
|
|
52877
|
+
return invalid2();
|
|
52223
52878
|
if (user.id !== expectedUserId)
|
|
52224
52879
|
throw new WorkspaceIdentityMismatchError;
|
|
52225
52880
|
return { user: { id: user.id, membershipId: user.membershipId, email: user.email, displayName: user.displayName, role: user.role }, organization: organization(value.organization) };
|
|
52226
52881
|
}
|
|
52227
52882
|
function sessionToken(value) {
|
|
52228
52883
|
if (typeof value !== "string" || !value || value.length > 8192 || /[^\x21-\x7e]/.test(value) || value.startsWith("sk_"))
|
|
52229
|
-
return
|
|
52884
|
+
return invalid2();
|
|
52230
52885
|
return value;
|
|
52231
52886
|
}
|
|
52232
52887
|
function parseWorkspaceSession(value, expected) {
|
|
@@ -52236,9 +52891,9 @@ function parseWorkspaceSession(value, expected) {
|
|
|
52236
52891
|
return { token: sessionToken(value.token), ...identity };
|
|
52237
52892
|
}
|
|
52238
52893
|
function parseWorkspaceLogin(value, expectedUserId) {
|
|
52239
|
-
const user =
|
|
52240
|
-
if (!
|
|
52241
|
-
return
|
|
52894
|
+
const user = record2(value) && value.user;
|
|
52895
|
+
if (!record2(value) || !record2(user) || !uuid2(user.id))
|
|
52896
|
+
return invalid2();
|
|
52242
52897
|
if (expectedUserId !== undefined && user.id !== expectedUserId)
|
|
52243
52898
|
throw new WorkspaceIdentityMismatchError;
|
|
52244
52899
|
return { token: sessionToken(value.token), userId: user.id };
|
|
@@ -52252,18 +52907,18 @@ var workspaceSelectionFailures = {
|
|
|
52252
52907
|
WORKSPACE_BUSY: [503, "Workspace is busy. Refresh before retrying."]
|
|
52253
52908
|
};
|
|
52254
52909
|
function workspaceSelectionFailure(value, status) {
|
|
52255
|
-
if (!
|
|
52910
|
+
if (!record2(value) || typeof value.code !== "string" || !Object.hasOwn(workspaceSelectionFailures, value.code))
|
|
52256
52911
|
return null;
|
|
52257
52912
|
const code = value.code;
|
|
52258
52913
|
return workspaceSelectionFailures[code][0] === status ? code : null;
|
|
52259
52914
|
}
|
|
52260
52915
|
|
|
52261
52916
|
// src/lib/remote-workspace.ts
|
|
52262
|
-
var
|
|
52917
|
+
var record3 = (value) => !!value && typeof value === "object" && !Array.isArray(value);
|
|
52263
52918
|
var cursor = (value) => typeof value === "string" && /^[A-Za-z0-9_-]{1,512}$/.test(value);
|
|
52264
|
-
var
|
|
52919
|
+
var uuid3 = (value) => typeof value === "string" && /^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/i.test(value);
|
|
52265
52920
|
function workspaceMembersQuery(options = {}) {
|
|
52266
|
-
if (!
|
|
52921
|
+
if (!record3(options) || Object.keys(options).some((key) => key !== "limit" && key !== "cursor") || options.limit !== undefined && (!Number.isInteger(options.limit) || options.limit < 1 || options.limit > 100) || options.cursor !== undefined && !cursor(options.cursor))
|
|
52267
52922
|
throw new Error("Use a roster limit from 1 to 100 and an unchanged continuation cursor.");
|
|
52268
52923
|
const query = new URLSearchParams;
|
|
52269
52924
|
if (options.limit !== undefined)
|
|
@@ -52272,14 +52927,14 @@ function workspaceMembersQuery(options = {}) {
|
|
|
52272
52927
|
query.set("cursor", options.cursor);
|
|
52273
52928
|
return query.size ? `?${query}` : "";
|
|
52274
52929
|
}
|
|
52275
|
-
function
|
|
52930
|
+
function timestamp2(value) {
|
|
52276
52931
|
if (typeof value !== "string" || !/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{6}Z$/.test(value))
|
|
52277
52932
|
return false;
|
|
52278
52933
|
const time = Date.parse(value);
|
|
52279
52934
|
return Number.isFinite(time) && new Date(time).toISOString().slice(0, 23) === value.slice(0, 23);
|
|
52280
52935
|
}
|
|
52281
52936
|
function parseMember(row, fail) {
|
|
52282
|
-
if (!
|
|
52937
|
+
if (!record3(row) || !uuid3(row.membershipId) || !uuid3(row.userId) || typeof row.email !== "string" || !row.email || !(row.displayName === null || typeof row.displayName === "string") || !isRole(row.role) || !timestamp2(row.createdAt))
|
|
52283
52938
|
return fail();
|
|
52284
52939
|
return {
|
|
52285
52940
|
membershipId: row.membershipId,
|
|
@@ -52299,12 +52954,12 @@ class WorkspaceMemberInputError extends Error {
|
|
|
52299
52954
|
}
|
|
52300
52955
|
}
|
|
52301
52956
|
function mutationInput(membershipId, input, roleChange) {
|
|
52302
|
-
if (typeof membershipId !== "string" || !
|
|
52957
|
+
if (typeof membershipId !== "string" || !uuid3(membershipId) || membershipId !== membershipId.toLowerCase() || !record3(input) || Object.keys(input).sort().join(",") !== (roleChange ? "expectedRole,role" : "expectedRole"))
|
|
52303
52958
|
throw new WorkspaceMemberInputError;
|
|
52304
|
-
const expectedRole = input.expectedRole,
|
|
52305
|
-
if (!isRole(expectedRole) || roleChange && !isRole(
|
|
52959
|
+
const expectedRole = input.expectedRole, role3 = roleChange ? input.role : undefined;
|
|
52960
|
+
if (!isRole(expectedRole) || roleChange && !isRole(role3))
|
|
52306
52961
|
throw new WorkspaceMemberInputError;
|
|
52307
|
-
return { membershipId, role:
|
|
52962
|
+
return { membershipId, role: role3, expectedRole };
|
|
52308
52963
|
}
|
|
52309
52964
|
function workspaceMemberRoleInput(membershipId, input) {
|
|
52310
52965
|
const value = mutationInput(membershipId, input, true);
|
|
@@ -52315,19 +52970,19 @@ function workspaceMemberRemovalInput(membershipId, input) {
|
|
|
52315
52970
|
return { membershipId: value.membershipId, body: { expectedRole: value.expectedRole } };
|
|
52316
52971
|
}
|
|
52317
52972
|
var invalidMemberResult = "The server returned an invalid workspace member result. Refresh the roster before another action.";
|
|
52318
|
-
function parseWorkspaceMemberRoleResult(value, membershipId,
|
|
52973
|
+
function parseWorkspaceMemberRoleResult(value, membershipId, role3) {
|
|
52319
52974
|
const fail = () => {
|
|
52320
52975
|
throw new Error(invalidMemberResult);
|
|
52321
52976
|
};
|
|
52322
|
-
if (!
|
|
52977
|
+
if (!record3(value) || !uuid3(value.organizationId) || typeof value.changed !== "boolean")
|
|
52323
52978
|
return fail();
|
|
52324
52979
|
const member = parseMember(value.member, fail);
|
|
52325
|
-
if (member.membershipId !== membershipId || member.role !==
|
|
52980
|
+
if (member.membershipId !== membershipId || member.role !== role3)
|
|
52326
52981
|
return fail();
|
|
52327
52982
|
return { organizationId: value.organizationId, member, changed: value.changed };
|
|
52328
52983
|
}
|
|
52329
52984
|
function parseWorkspaceMemberRemovalResult(value, membershipId) {
|
|
52330
|
-
if (!
|
|
52985
|
+
if (!record3(value) || !uuid3(value.organizationId) || value.membershipId !== membershipId || value.removed !== true || typeof value.alreadyRemoved !== "boolean")
|
|
52331
52986
|
throw new Error(invalidMemberResult);
|
|
52332
52987
|
return { organizationId: value.organizationId, membershipId, removed: true, alreadyRemoved: value.alreadyRemoved };
|
|
52333
52988
|
}
|
|
@@ -52344,7 +52999,7 @@ var workspaceMemberFailures = {
|
|
|
52344
52999
|
MEMBERSHIP_BUSY: [503, "Membership is busy. Refresh the roster before another action."]
|
|
52345
53000
|
};
|
|
52346
53001
|
function workspaceMemberFailure(value, status) {
|
|
52347
|
-
if (!
|
|
53002
|
+
if (!record3(value) || typeof value.code !== "string" || !Object.hasOwn(workspaceMemberFailures, value.code))
|
|
52348
53003
|
return null;
|
|
52349
53004
|
const code = value.code;
|
|
52350
53005
|
return workspaceMemberFailures[code][0] === status ? code : null;
|
|
@@ -52353,7 +53008,7 @@ function parseWorkspaceMembersPage(value) {
|
|
|
52353
53008
|
const fail = () => {
|
|
52354
53009
|
throw new Error("The server returned an invalid workspace roster.");
|
|
52355
53010
|
};
|
|
52356
|
-
if (!
|
|
53011
|
+
if (!record3(value) || !uuid3(value.organizationId) || !Array.isArray(value.members) || value.members.length > 100 || !(value.nextCursor === null || cursor(value.nextCursor)) || !value.members.length && value.nextCursor !== null)
|
|
52357
53012
|
return fail();
|
|
52358
53013
|
const members = value.members.map((row) => parseMember(row, fail));
|
|
52359
53014
|
if (new Set(members.map((row) => row.membershipId)).size !== members.length)
|
|
@@ -52590,6 +53245,69 @@ function parseUpdatedWorkspace(value) {
|
|
|
52590
53245
|
return { organization: { id: organization2.id, slug: organization2.slug, name: organization2.name } };
|
|
52591
53246
|
}
|
|
52592
53247
|
|
|
53248
|
+
// src/lib/remote-quote-errors.ts
|
|
53249
|
+
var quoteUnavailableMessages = Object.freeze({
|
|
53250
|
+
HOSTED_PROVIDER_UNAVAILABLE: "Hosted execution is temporarily unavailable on this Skills instance.",
|
|
53251
|
+
HOSTED_CONNECTORS_UNAVAILABLE: "Hosted connector execution is unavailable on this Skills instance.",
|
|
53252
|
+
SKILL_IMPLEMENTATION_UNAVAILABLE: "This skill has no hosted execution implementation.",
|
|
53253
|
+
HOSTED_PRICING_UNAVAILABLE: "Hosted execution is unavailable while this skill's pricing is reviewed.",
|
|
53254
|
+
RUNTIME_ALLOWLIST_REQUIRED: "Hosted execution is unavailable until this Skills instance enables its skill catalog.",
|
|
53255
|
+
RUNTIME_SKILL_NOT_ALLOWED: "This skill is not enabled for hosted execution on this Skills instance."
|
|
53256
|
+
});
|
|
53257
|
+
async function readQuoteUnavailableCode(response) {
|
|
53258
|
+
const maximum = 16 * 1024;
|
|
53259
|
+
const length = response.headers.get("content-length");
|
|
53260
|
+
if (response.status !== 503 || response.headers.get("content-type")?.split(";")[0]?.trim().toLowerCase() !== "application/json" || length !== null && (!/^\d+$/.test(length) || Number(length) > maximum)) {
|
|
53261
|
+
response.body?.cancel().catch(() => {});
|
|
53262
|
+
return null;
|
|
53263
|
+
}
|
|
53264
|
+
const reader = response.body?.getReader();
|
|
53265
|
+
if (!reader)
|
|
53266
|
+
return null;
|
|
53267
|
+
let timer;
|
|
53268
|
+
let deadlineExceeded = false;
|
|
53269
|
+
const expired = Symbol("quote body deadline");
|
|
53270
|
+
const deadline = new Promise((resolve4) => {
|
|
53271
|
+
timer = setTimeout(() => {
|
|
53272
|
+
deadlineExceeded = true;
|
|
53273
|
+
resolve4(expired);
|
|
53274
|
+
reader.cancel().catch(() => {});
|
|
53275
|
+
}, 1500);
|
|
53276
|
+
});
|
|
53277
|
+
const chunks = [];
|
|
53278
|
+
let size = 0;
|
|
53279
|
+
try {
|
|
53280
|
+
while (true) {
|
|
53281
|
+
const next = await Promise.race([reader.read(), deadline]);
|
|
53282
|
+
if (next === expired || deadlineExceeded)
|
|
53283
|
+
return null;
|
|
53284
|
+
if (next.done)
|
|
53285
|
+
break;
|
|
53286
|
+
size += next.value.byteLength;
|
|
53287
|
+
if (size > maximum)
|
|
53288
|
+
return null;
|
|
53289
|
+
chunks.push(next.value);
|
|
53290
|
+
}
|
|
53291
|
+
const bytes = new Uint8Array(size);
|
|
53292
|
+
let offset = 0;
|
|
53293
|
+
for (const chunk of chunks) {
|
|
53294
|
+
bytes.set(chunk, offset);
|
|
53295
|
+
offset += chunk.byteLength;
|
|
53296
|
+
}
|
|
53297
|
+
const value = JSON.parse(new TextDecoder("utf-8", { fatal: true }).decode(bytes));
|
|
53298
|
+
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
53299
|
+
return null;
|
|
53300
|
+
const code = value.code;
|
|
53301
|
+
return typeof code === "string" && Object.hasOwn(quoteUnavailableMessages, code) ? code : null;
|
|
53302
|
+
} catch {
|
|
53303
|
+
return null;
|
|
53304
|
+
} finally {
|
|
53305
|
+
clearTimeout(timer);
|
|
53306
|
+
reader.cancel().catch(() => {});
|
|
53307
|
+
reader.releaseLock();
|
|
53308
|
+
}
|
|
53309
|
+
}
|
|
53310
|
+
|
|
52593
53311
|
// src/lib/remote-client.ts
|
|
52594
53312
|
class RemoteRouteUnsupportedError extends Error {
|
|
52595
53313
|
path;
|
|
@@ -52615,6 +53333,18 @@ class RemoteRequestError extends Error {
|
|
|
52615
53333
|
}
|
|
52616
53334
|
}
|
|
52617
53335
|
|
|
53336
|
+
class RemoteQuoteUnavailableError extends RemoteRequestError {
|
|
53337
|
+
code;
|
|
53338
|
+
constructor(path, code) {
|
|
53339
|
+
super(path, 503);
|
|
53340
|
+
this.code = code;
|
|
53341
|
+
if (!Object.hasOwn(quoteUnavailableMessages, code))
|
|
53342
|
+
throw new Error("Unknown quote refusal code");
|
|
53343
|
+
this.name = "RemoteQuoteUnavailableError";
|
|
53344
|
+
this.message = quoteUnavailableMessages[code];
|
|
53345
|
+
}
|
|
53346
|
+
}
|
|
53347
|
+
|
|
52618
53348
|
class RemoteWorkspaceMemberError extends RemoteRequestError {
|
|
52619
53349
|
code;
|
|
52620
53350
|
constructor(path, code) {
|
|
@@ -52676,6 +53406,11 @@ class RemoteSkillsClient {
|
|
|
52676
53406
|
throw new RemoteRouteUnsupportedError(routePath, response.status, this.apiUrl);
|
|
52677
53407
|
}
|
|
52678
53408
|
if (!response.ok) {
|
|
53409
|
+
if (opts.quoteRefusal && options?.method === "POST" && /^\/api\/v1\/skills\/[^/?#]+\/quote$/.test(routePath) && response.status === 503) {
|
|
53410
|
+
const code = await readQuoteUnavailableCode(response);
|
|
53411
|
+
if (code)
|
|
53412
|
+
throw new RemoteQuoteUnavailableError(routePath, code);
|
|
53413
|
+
}
|
|
52679
53414
|
if (path === "/api/v1/billing/checkout" && options?.method === "POST" && response.status === 503 && await responseBodyCarriesCode(response, ["SUBSCRIPTION_CHECKOUT_UNAVAILABLE"])) {
|
|
52680
53415
|
throw new RemoteCapabilityUnavailableError;
|
|
52681
53416
|
}
|
|
@@ -52733,7 +53468,7 @@ class RemoteSkillsClient {
|
|
|
52733
53468
|
const response = await this.requestNewRoute(`/api/v1/skills/${encodeURIComponent(slug)}/quote`, {
|
|
52734
53469
|
method: "POST",
|
|
52735
53470
|
body: JSON.stringify({ input, args })
|
|
52736
|
-
});
|
|
53471
|
+
}, { quoteRefusal: true });
|
|
52737
53472
|
return parseRemoteRunQuote(await response.json());
|
|
52738
53473
|
}
|
|
52739
53474
|
getCapabilities() {
|
|
@@ -52898,6 +53633,53 @@ class RemoteSkillsClient {
|
|
|
52898
53633
|
}
|
|
52899
53634
|
return parseWorkspaceLeaveResult(body, captured.context.membershipId, identity.organization.id);
|
|
52900
53635
|
}
|
|
53636
|
+
listWorkspaceInvitations(context, options = {}) {
|
|
53637
|
+
return this.requestWorkspaceInvitation(context, "list", options);
|
|
53638
|
+
}
|
|
53639
|
+
getWorkspaceInvitation(context, invitationId) {
|
|
53640
|
+
return this.requestWorkspaceInvitation(context, "get", { invitationId });
|
|
53641
|
+
}
|
|
53642
|
+
issueWorkspaceInvitation(context, input) {
|
|
53643
|
+
return this.requestWorkspaceInvitation(context, "issue", input);
|
|
53644
|
+
}
|
|
53645
|
+
resendWorkspaceInvitation(context, invitationId, input) {
|
|
53646
|
+
return this.requestWorkspaceInvitation(context, "resend", { ...input, invitationId });
|
|
53647
|
+
}
|
|
53648
|
+
revokeWorkspaceInvitation(context, invitationId, input) {
|
|
53649
|
+
return this.requestWorkspaceInvitation(context, "revoke", { ...input, invitationId });
|
|
53650
|
+
}
|
|
53651
|
+
acceptWorkspaceInvitation(context, invitationId, input) {
|
|
53652
|
+
return this.requestWorkspaceInvitation(context, "accept", { ...input, invitationId });
|
|
53653
|
+
}
|
|
53654
|
+
async requestWorkspaceInvitation(context, action, input) {
|
|
53655
|
+
const target = workspaceContext(context), captured = invitationInput(action, input);
|
|
53656
|
+
const connection = new RemoteSkillsClient(this.apiKey, this.apiUrl);
|
|
53657
|
+
const identityValue = await connection.requestWorkspaceSelection("/api/auth/whoami");
|
|
53658
|
+
if (!identityValue || typeof identityValue !== "object" || identityValue.authMethod !== "jwt")
|
|
53659
|
+
throw new RemoteWorkspaceInvitationError("INTERACTIVE_SESSION_REQUIRED");
|
|
53660
|
+
const identity = parseWorkspaceIdentity(identityValue, target.userId);
|
|
53661
|
+
if (identity.user.membershipId !== target.membershipId)
|
|
53662
|
+
throw new WorkspaceIdentityMismatchError;
|
|
53663
|
+
const request = invitationRequest(action, captured), read = action === "list" || action === "get";
|
|
53664
|
+
let response, value;
|
|
53665
|
+
try {
|
|
53666
|
+
response = await connection.request(request.path, { method: request.method, ...request.body ? { body: request.body } : {}, credentials: "omit" });
|
|
53667
|
+
value = JSON.parse(new TextDecoder().decode(await readBoundedResponse(response, response.ok ? 64 * 1024 : 4096)));
|
|
53668
|
+
} catch {
|
|
53669
|
+
throw read ? new RemoteWorkspaceInvitationReadError : new RemoteWorkspaceInvitationUnconfirmedError;
|
|
53670
|
+
}
|
|
53671
|
+
if (!response.ok) {
|
|
53672
|
+
const code = invitationFailure(value, response.status);
|
|
53673
|
+
if (code)
|
|
53674
|
+
throw new RemoteWorkspaceInvitationError(code);
|
|
53675
|
+
throw read ? new RemoteWorkspaceInvitationReadError : new RemoteWorkspaceInvitationUnconfirmedError;
|
|
53676
|
+
}
|
|
53677
|
+
try {
|
|
53678
|
+
return parseInvitationResult(action, value, captured, identity.organization.id);
|
|
53679
|
+
} catch {
|
|
53680
|
+
throw read ? new RemoteWorkspaceInvitationReadError : new RemoteWorkspaceInvitationUnconfirmedError;
|
|
53681
|
+
}
|
|
53682
|
+
}
|
|
52901
53683
|
async listApiKeys() {
|
|
52902
53684
|
return this.arrayResponse("/api/auth/keys");
|
|
52903
53685
|
}
|
|
@@ -53148,13 +53930,13 @@ class RemoteSkillsClient {
|
|
|
53148
53930
|
return normalizeUpdatedSincePage(await response.json());
|
|
53149
53931
|
}
|
|
53150
53932
|
}
|
|
53151
|
-
function requireOptionalString(
|
|
53152
|
-
if (
|
|
53933
|
+
function requireOptionalString(record4, field) {
|
|
53934
|
+
if (record4[field] === undefined)
|
|
53153
53935
|
return;
|
|
53154
|
-
if (typeof
|
|
53936
|
+
if (typeof record4[field] !== "string") {
|
|
53155
53937
|
throw new Error(`Remote payload did not match the expected contract (${field} must be a string when present)`);
|
|
53156
53938
|
}
|
|
53157
|
-
return
|
|
53939
|
+
return record4[field];
|
|
53158
53940
|
}
|
|
53159
53941
|
var INVALID_SKILL_VERSION_RESPONSE = "Remote skill version payload did not match the expected contract.";
|
|
53160
53942
|
function isVersionRecord(value) {
|
|
@@ -53177,19 +53959,19 @@ function normalizePin(entry) {
|
|
|
53177
53959
|
if (!entry || typeof entry !== "object") {
|
|
53178
53960
|
throw new Error("Remote pin payload did not match the expected contract (expected an object)");
|
|
53179
53961
|
}
|
|
53180
|
-
const
|
|
53181
|
-
const slug = typeof
|
|
53962
|
+
const record4 = entry;
|
|
53963
|
+
const slug = typeof record4.slug === "string" && record4.slug.trim() ? record4.slug.trim() : undefined;
|
|
53182
53964
|
if (!slug) {
|
|
53183
53965
|
throw new Error("Remote pin payload did not match the expected contract (missing slug)");
|
|
53184
53966
|
}
|
|
53185
53967
|
let metadata;
|
|
53186
|
-
if (
|
|
53187
|
-
if (!
|
|
53968
|
+
if (record4.metadata !== undefined) {
|
|
53969
|
+
if (!record4.metadata || typeof record4.metadata !== "object" || Array.isArray(record4.metadata)) {
|
|
53188
53970
|
throw new Error("Remote pin payload did not match the expected contract (metadata must be a JSON object when present)");
|
|
53189
53971
|
}
|
|
53190
|
-
metadata =
|
|
53972
|
+
metadata = record4.metadata;
|
|
53191
53973
|
}
|
|
53192
|
-
const pinnedAt = requireOptionalString(
|
|
53974
|
+
const pinnedAt = requireOptionalString(record4, "pinnedAt");
|
|
53193
53975
|
return {
|
|
53194
53976
|
slug,
|
|
53195
53977
|
...pinnedAt !== undefined ? { pinnedAt } : {},
|
|
@@ -53206,16 +53988,16 @@ function normalizeSkillSummary(entry) {
|
|
|
53206
53988
|
if (!entry || typeof entry !== "object") {
|
|
53207
53989
|
throw new Error("Remote skill payload did not match the expected contract (expected an object)");
|
|
53208
53990
|
}
|
|
53209
|
-
const
|
|
53210
|
-
const slug = typeof
|
|
53991
|
+
const record4 = entry;
|
|
53992
|
+
const slug = typeof record4.slug === "string" && record4.slug.trim() ? record4.slug.trim() : undefined;
|
|
53211
53993
|
if (!slug) {
|
|
53212
53994
|
throw new Error("Remote skill payload did not match the expected contract (missing slug)");
|
|
53213
53995
|
}
|
|
53214
53996
|
return {
|
|
53215
53997
|
slug,
|
|
53216
|
-
...requireOptionalString(
|
|
53217
|
-
...requireOptionalString(
|
|
53218
|
-
...requireOptionalString(
|
|
53998
|
+
...requireOptionalString(record4, "name") !== undefined ? { name: requireOptionalString(record4, "name") } : {},
|
|
53999
|
+
...requireOptionalString(record4, "version") !== undefined ? { version: requireOptionalString(record4, "version") } : {},
|
|
54000
|
+
...requireOptionalString(record4, "updatedAt") !== undefined ? { updatedAt: requireOptionalString(record4, "updatedAt") } : {}
|
|
53219
54001
|
};
|
|
53220
54002
|
}
|
|
53221
54003
|
function normalizeSkillSummaryList(payload) {
|
|
@@ -53268,12 +54050,12 @@ function normalizeUpdatedSincePage(payload) {
|
|
|
53268
54050
|
if (!payload || typeof payload !== "object") {
|
|
53269
54051
|
throw new Error("Updated-since payload did not match the expected contract (expected an object)");
|
|
53270
54052
|
}
|
|
53271
|
-
const
|
|
53272
|
-
if (!Array.isArray(
|
|
54053
|
+
const record4 = payload;
|
|
54054
|
+
if (!Array.isArray(record4.skills)) {
|
|
53273
54055
|
throw new Error("Updated-since payload did not match the expected contract (missing skills array)");
|
|
53274
54056
|
}
|
|
53275
|
-
const skills =
|
|
53276
|
-
const nextCursor =
|
|
54057
|
+
const skills = record4.skills.map(normalizeSkillSummary);
|
|
54058
|
+
const nextCursor = record4.nextCursor === undefined || record4.nextCursor === null ? null : record4.nextCursor;
|
|
53277
54059
|
if (nextCursor !== null && typeof nextCursor !== "string") {
|
|
53278
54060
|
throw new Error("Updated-since payload did not match the expected contract (nextCursor must be a string or absent)");
|
|
53279
54061
|
}
|
|
@@ -53283,6 +54065,101 @@ async function createRemoteSkillsClient(env = process.env) {
|
|
|
53283
54065
|
const connection = await resolveSkillsConnection(env);
|
|
53284
54066
|
return connection ? new RemoteSkillsClient(connection.apiKey, connection.apiOrigin) : null;
|
|
53285
54067
|
}
|
|
54068
|
+
// src/lib/remote-invitation-recovery.ts
|
|
54069
|
+
class InvitationEmailInputError extends Error {
|
|
54070
|
+
code = "INVITATION_EMAIL_INPUT_INVALID";
|
|
54071
|
+
constructor() {
|
|
54072
|
+
super("Use an explicit Skills API URL, exact invitation and retained challenge IDs, secret input, and deliberate confirmation.");
|
|
54073
|
+
this.name = "InvitationEmailInputError";
|
|
54074
|
+
}
|
|
54075
|
+
}
|
|
54076
|
+
var refusals = {
|
|
54077
|
+
INVALID_REQUEST: [400, "Invitation recovery parameters were refused."],
|
|
54078
|
+
ORIGIN_REQUIRED: [403, "Invitation recovery requires the configured site origin."],
|
|
54079
|
+
INVITATION_PROOF_UNAVAILABLE: [401, "Invitation proof is unavailable. Sign in or explicitly request another recovery code."],
|
|
54080
|
+
RATE_LIMITED: [429, "Invitation verification is rate limited. Wait before another deliberate action."],
|
|
54081
|
+
INVITATION_BUSY: [503, "Invitation is busy. Sign in to check membership before another deliberate action."],
|
|
54082
|
+
INVITATION_DELIVERY_UNAVAILABLE: [503, "Invitation recovery is unavailable on this service."]
|
|
54083
|
+
};
|
|
54084
|
+
|
|
54085
|
+
class RemoteInvitationEmailError extends Error {
|
|
54086
|
+
code;
|
|
54087
|
+
status;
|
|
54088
|
+
constructor(code) {
|
|
54089
|
+
super(refusals[code][1]);
|
|
54090
|
+
this.code = code;
|
|
54091
|
+
this.name = "RemoteInvitationEmailError";
|
|
54092
|
+
this.status = refusals[code][0];
|
|
54093
|
+
}
|
|
54094
|
+
}
|
|
54095
|
+
|
|
54096
|
+
class RemoteInvitationEmailUnconfirmedError extends Error {
|
|
54097
|
+
action;
|
|
54098
|
+
code = "INVITATION_EMAIL_UNCONFIRMED";
|
|
54099
|
+
constructor(action) {
|
|
54100
|
+
super(action === "challenge" ? "The recovery challenge outcome is unconfirmed. Retain the same invitation, challenge ID and server. Check your inbox; never rotate the challenge or retry automatically. No delivery is confirmed." : "Invitation acceptance is unconfirmed. Use fresh ordinary sign-in to inspect available memberships. Do not retry acceptance automatically; explicitly request another recovery code only if needed. Saved credentials are unchanged.");
|
|
54101
|
+
this.action = action;
|
|
54102
|
+
this.name = "RemoteInvitationEmailUnconfirmedError";
|
|
54103
|
+
}
|
|
54104
|
+
}
|
|
54105
|
+
var record4 = (v2) => !!v2 && typeof v2 === "object" && !Array.isArray(v2);
|
|
54106
|
+
var uuid4 = (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);
|
|
54107
|
+
function invitationEmailIds(invitationId, challengeId) {
|
|
54108
|
+
if (!uuid4(invitationId) || !uuid4(challengeId))
|
|
54109
|
+
throw new InvitationEmailInputError;
|
|
54110
|
+
return { invitationId, challengeId };
|
|
54111
|
+
}
|
|
54112
|
+
function invitationEmailInput(action, input) {
|
|
54113
|
+
const keys = ["invitationId", "token", "challengeId", "confirm", ...action === "accept" ? ["code"] : []];
|
|
54114
|
+
if (!record4(input) || Object.keys(input).length !== keys.length || keys.some((key) => !Object.hasOwn(input, key)))
|
|
54115
|
+
throw new InvitationEmailInputError;
|
|
54116
|
+
const value = { ...input };
|
|
54117
|
+
const ids = invitationEmailIds(value.invitationId, value.challengeId);
|
|
54118
|
+
if (value.confirm !== true || typeof value.token !== "string" || !/^[A-Za-z0-9_-]{43}$/.test(value.token) || action === "accept" && (typeof value.code !== "string" || !/^\d{6}$/.test(value.code)))
|
|
54119
|
+
throw new InvitationEmailInputError;
|
|
54120
|
+
return { ...ids, token: value.token, confirm: true, ...action === "accept" ? { code: value.code } : {} };
|
|
54121
|
+
}
|
|
54122
|
+
async function requestInvitationEmail(origin, action, input) {
|
|
54123
|
+
const value = invitationEmailInput(action, input);
|
|
54124
|
+
let target;
|
|
54125
|
+
try {
|
|
54126
|
+
target = normalizeSkillsApiOrigin(origin);
|
|
54127
|
+
} catch {
|
|
54128
|
+
throw new InvitationEmailInputError;
|
|
54129
|
+
}
|
|
54130
|
+
const body = JSON.stringify({ invitationId: value.invitationId, token: value.token, challengeId: value.challengeId, ...action === "accept" ? { code: value.code } : {} });
|
|
54131
|
+
try {
|
|
54132
|
+
const response = await fetch(`${target}/api/v1/account/invitations/email-${action}`, {
|
|
54133
|
+
method: "POST",
|
|
54134
|
+
headers: { "Content-Type": "application/json" },
|
|
54135
|
+
body,
|
|
54136
|
+
credentials: "omit",
|
|
54137
|
+
redirect: "error",
|
|
54138
|
+
cache: "no-store",
|
|
54139
|
+
referrerPolicy: "no-referrer",
|
|
54140
|
+
signal: AbortSignal.timeout(15000)
|
|
54141
|
+
});
|
|
54142
|
+
const parsed = JSON.parse(new TextDecoder("utf-8", { fatal: true }).decode(await readBoundedResponse(response, 4096)));
|
|
54143
|
+
if (!response.ok && record4(parsed) && typeof parsed.code === "string" && Object.hasOwn(refusals, parsed.code)) {
|
|
54144
|
+
const code = parsed.code;
|
|
54145
|
+
if (response.status === refusals[code][0])
|
|
54146
|
+
throw new RemoteInvitationEmailError(code);
|
|
54147
|
+
}
|
|
54148
|
+
if (!record4(parsed))
|
|
54149
|
+
throw new RemoteInvitationEmailUnconfirmedError(action);
|
|
54150
|
+
if (action === "challenge" && response.status === 202 && parsed.challengeId === value.challengeId && parsed.expiresIn === 600 && typeof parsed.message === "string" && parsed.message.length <= 256) {
|
|
54151
|
+
return { challengeId: value.challengeId, message: "If this invitation is eligible, a verification code will arrive. Delivery is not confirmed.", expiresIn: 600 };
|
|
54152
|
+
}
|
|
54153
|
+
if (action === "accept" && response.status === 200 && uuid4(parsed.organizationId) && uuid4(parsed.membershipId) && parsed.accepted === true && parsed.changed === true && parsed.signInRequired === true) {
|
|
54154
|
+
return { organizationId: parsed.organizationId, membershipId: parsed.membershipId, accepted: true, changed: true, signInRequired: true };
|
|
54155
|
+
}
|
|
54156
|
+
} catch (error) {
|
|
54157
|
+
if (error instanceof RemoteInvitationEmailError)
|
|
54158
|
+
throw error;
|
|
54159
|
+
}
|
|
54160
|
+
throw new RemoteInvitationEmailUnconfirmedError(action);
|
|
54161
|
+
}
|
|
54162
|
+
|
|
53286
54163
|
// src/lib/remote-auth.ts
|
|
53287
54164
|
var MAX_ERROR_DETAIL_LENGTH = 200;
|
|
53288
54165
|
|
|
@@ -53323,10 +54200,10 @@ async function requestAuthApi(instance, path, options) {
|
|
|
53323
54200
|
const text2 = await res.text();
|
|
53324
54201
|
const body = text2 ? parseJsonBody(text2) : {};
|
|
53325
54202
|
if (!res.ok) {
|
|
53326
|
-
const
|
|
53327
|
-
const detail = typeof
|
|
53328
|
-
const error = typeof
|
|
53329
|
-
const code = typeof
|
|
54203
|
+
const record5 = isRecord6(body) ? body : {};
|
|
54204
|
+
const detail = typeof record5.detail === "string" ? record5.detail : undefined;
|
|
54205
|
+
const error = typeof record5.error === "string" ? record5.error : undefined;
|
|
54206
|
+
const code = typeof record5.code === "string" ? record5.code : undefined;
|
|
53330
54207
|
throw new HostedApiError(detail || error || `${res.status} ${res.statusText}`, {
|
|
53331
54208
|
status: res.status,
|
|
53332
54209
|
code,
|
|
@@ -53360,11 +54237,17 @@ class RemoteSkillsAuthClient {
|
|
|
53360
54237
|
constructor(apiUrl) {
|
|
53361
54238
|
this.apiOrigin = normalizeSkillsApiOrigin(apiUrl);
|
|
53362
54239
|
}
|
|
53363
|
-
|
|
53364
|
-
return this.
|
|
54240
|
+
requestInvitationEmailChallenge(input) {
|
|
54241
|
+
return requestInvitationEmail(this.apiOrigin, "challenge", input);
|
|
53365
54242
|
}
|
|
53366
|
-
|
|
53367
|
-
return this.
|
|
54243
|
+
acceptInvitationEmailChallenge(input) {
|
|
54244
|
+
return requestInvitationEmail(this.apiOrigin, "accept", input);
|
|
54245
|
+
}
|
|
54246
|
+
requestCode(email2) {
|
|
54247
|
+
return this.request("/api/auth/login", { method: "POST", body: JSON.stringify({ email: email2 }) });
|
|
54248
|
+
}
|
|
54249
|
+
verifyCode(email2, code) {
|
|
54250
|
+
return this.request("/api/auth/verify", { method: "POST", body: JSON.stringify({ email: email2, code }) });
|
|
53368
54251
|
}
|
|
53369
54252
|
startDevice() {
|
|
53370
54253
|
return this.request("/api/auth/device/start", { method: "POST", body: JSON.stringify({ client: "skills-sdk" }) });
|
|
@@ -53372,34 +54255,34 @@ class RemoteSkillsAuthClient {
|
|
|
53372
54255
|
pollDevice(deviceCode) {
|
|
53373
54256
|
return this.request("/api/auth/device/token", { method: "POST", body: JSON.stringify({ deviceCode }) });
|
|
53374
54257
|
}
|
|
53375
|
-
async sessionClient(
|
|
54258
|
+
async sessionClient(email2, code, context) {
|
|
53376
54259
|
if (context !== undefined) {
|
|
53377
54260
|
const target = workspaceContext(context), apiOrigin2 = this.apiOrigin;
|
|
53378
|
-
const session = await this.switchWorkspace(
|
|
54261
|
+
const session = await this.switchWorkspace(email2, code, target);
|
|
53379
54262
|
return new RemoteSkillsClient(session.token, apiOrigin2);
|
|
53380
54263
|
}
|
|
53381
54264
|
const apiOrigin = this.apiOrigin;
|
|
53382
|
-
if (!
|
|
54265
|
+
if (!email2.includes("@") || !/^\d{6}$/.test(code))
|
|
53383
54266
|
throw new Error("Fresh email and six-digit verification code are required to manage this account");
|
|
53384
|
-
const login = await this.verifyCode(
|
|
54267
|
+
const login = await this.verifyCode(email2, code);
|
|
53385
54268
|
if (!login || typeof login.token !== "string" || !login.token)
|
|
53386
54269
|
throw new Error("The server did not return an authorized account session");
|
|
53387
54270
|
return new RemoteSkillsClient(login.token, apiOrigin);
|
|
53388
54271
|
}
|
|
53389
|
-
async listAccountWorkspaces(
|
|
53390
|
-
const login = await this.workspaceLogin(
|
|
54272
|
+
async listAccountWorkspaces(email2, code, expectedUserId) {
|
|
54273
|
+
const login = await this.workspaceLogin(email2, code, expectedUserId);
|
|
53391
54274
|
const result = await new RemoteSkillsClient(login.token, login.apiOrigin).listAccountWorkspaces(login.userId);
|
|
53392
54275
|
return { userId: login.userId, ...result };
|
|
53393
54276
|
}
|
|
53394
|
-
async switchWorkspace(
|
|
54277
|
+
async switchWorkspace(email2, code, context) {
|
|
53395
54278
|
const target = workspaceContext(context);
|
|
53396
|
-
const login = await this.workspaceLogin(
|
|
54279
|
+
const login = await this.workspaceLogin(email2, code, target.userId);
|
|
53397
54280
|
return new RemoteSkillsClient(login.token, login.apiOrigin).switchWorkspace(target);
|
|
53398
54281
|
}
|
|
53399
|
-
async workspaceLogin(
|
|
54282
|
+
async workspaceLogin(email2, code, expectedUserId) {
|
|
53400
54283
|
const expected = expectedUserId === undefined ? undefined : workspaceExpectedUserId(expectedUserId);
|
|
53401
54284
|
const apiOrigin = this.apiOrigin;
|
|
53402
|
-
if (typeof
|
|
54285
|
+
if (typeof email2 !== "string" || !email2.includes("@") || typeof code !== "string" || !/^\d{6}$/.test(code))
|
|
53403
54286
|
throw new Error("Fresh email and six-digit verification code are required to manage this account");
|
|
53404
54287
|
let response;
|
|
53405
54288
|
try {
|
|
@@ -53409,7 +54292,7 @@ class RemoteSkillsAuthClient {
|
|
|
53409
54292
|
credentials: "omit",
|
|
53410
54293
|
signal: AbortSignal.timeout(15000),
|
|
53411
54294
|
headers: { "Content-Type": "application/json" },
|
|
53412
|
-
body: JSON.stringify({ email, code })
|
|
54295
|
+
body: JSON.stringify({ email: email2, code })
|
|
53413
54296
|
});
|
|
53414
54297
|
} catch {
|
|
53415
54298
|
throw new HostedApiError("Unable to verify the Skills account.");
|
|
@@ -53426,40 +54309,67 @@ class RemoteSkillsAuthClient {
|
|
|
53426
54309
|
}
|
|
53427
54310
|
return { ...parseWorkspaceLogin(value, expected), apiOrigin };
|
|
53428
54311
|
}
|
|
53429
|
-
async
|
|
54312
|
+
async listWorkspaceInvitations(email2, code, context, options = {}) {
|
|
54313
|
+
const target = workspaceContext(context), captured = invitationInput("list", options);
|
|
54314
|
+
return (await this.sessionClient(email2, code, target)).listWorkspaceInvitations(target, captured);
|
|
54315
|
+
}
|
|
54316
|
+
async getWorkspaceInvitation(email2, code, context, invitationId) {
|
|
54317
|
+
const target = workspaceContext(context), captured = invitationInput("get", { invitationId });
|
|
54318
|
+
return (await this.sessionClient(email2, code, target)).getWorkspaceInvitation(target, captured.invitationId);
|
|
54319
|
+
}
|
|
54320
|
+
async issueWorkspaceInvitation(email2, code, context, input) {
|
|
54321
|
+
const target = workspaceContext(context), captured = invitationInput("issue", input);
|
|
54322
|
+
return (await this.sessionClient(email2, code, target)).issueWorkspaceInvitation(target, captured);
|
|
54323
|
+
}
|
|
54324
|
+
async resendWorkspaceInvitation(email2, code, context, invitationId, input) {
|
|
54325
|
+
const target = workspaceContext(context), captured = invitationInput("resend", { ...input, invitationId });
|
|
54326
|
+
const { invitationId: id, ...options } = captured;
|
|
54327
|
+
return (await this.sessionClient(email2, code, target)).resendWorkspaceInvitation(target, id, options);
|
|
54328
|
+
}
|
|
54329
|
+
async revokeWorkspaceInvitation(email2, code, context, invitationId, input) {
|
|
54330
|
+
const target = workspaceContext(context), captured = invitationInput("revoke", { ...input, invitationId });
|
|
54331
|
+
const { invitationId: id, ...options } = captured;
|
|
54332
|
+
return (await this.sessionClient(email2, code, target)).revokeWorkspaceInvitation(target, id, options);
|
|
54333
|
+
}
|
|
54334
|
+
async acceptWorkspaceInvitation(email2, code, context, invitationId, input) {
|
|
54335
|
+
const target = workspaceContext(context), captured = invitationInput("accept", { ...input, invitationId });
|
|
54336
|
+
const { invitationId: id, ...options } = captured;
|
|
54337
|
+
return (await this.sessionClient(email2, code, target)).acceptWorkspaceInvitation(target, id, options);
|
|
54338
|
+
}
|
|
54339
|
+
async createApiKey(email2, code, name, scopes, context) {
|
|
53430
54340
|
const capturedScopes = scopes === undefined ? undefined : [...scopes];
|
|
53431
|
-
return (await this.sessionClient(
|
|
54341
|
+
return (await this.sessionClient(email2, code, context)).createApiKey(name, capturedScopes);
|
|
53432
54342
|
}
|
|
53433
|
-
async listApiKeys(
|
|
53434
|
-
return (await this.sessionClient(
|
|
54343
|
+
async listApiKeys(email2, code, context) {
|
|
54344
|
+
return (await this.sessionClient(email2, code, context)).listApiKeys();
|
|
53435
54345
|
}
|
|
53436
|
-
async revokeApiKey(
|
|
53437
|
-
return (await this.sessionClient(
|
|
54346
|
+
async revokeApiKey(email2, code, keyId, context) {
|
|
54347
|
+
return (await this.sessionClient(email2, code, context)).revokeApiKey(keyId);
|
|
53438
54348
|
}
|
|
53439
|
-
async updateProfile(
|
|
54349
|
+
async updateProfile(email2, code, input, context) {
|
|
53440
54350
|
const body = customerNamePatch(input, "displayName");
|
|
53441
|
-
return (await this.sessionClient(
|
|
54351
|
+
return (await this.sessionClient(email2, code, context)).updateProfile({ displayName: body.displayName });
|
|
53442
54352
|
}
|
|
53443
|
-
async updateCurrentWorkspace(
|
|
54353
|
+
async updateCurrentWorkspace(email2, code, input, context) {
|
|
53444
54354
|
const body = customerNamePatch(input, "name");
|
|
53445
|
-
return (await this.sessionClient(
|
|
54355
|
+
return (await this.sessionClient(email2, code, context)).updateCurrentWorkspace({ name: body.name });
|
|
53446
54356
|
}
|
|
53447
|
-
async listWorkspaceMembers(
|
|
54357
|
+
async listWorkspaceMembers(email2, code, options = {}, context) {
|
|
53448
54358
|
workspaceMembersQuery(options);
|
|
53449
54359
|
const captured = { ...options };
|
|
53450
|
-
return (await this.sessionClient(
|
|
54360
|
+
return (await this.sessionClient(email2, code, context)).listWorkspaceMembers(captured);
|
|
53451
54361
|
}
|
|
53452
|
-
async setWorkspaceMemberRole(
|
|
54362
|
+
async setWorkspaceMemberRole(email2, code, membershipId, input, context) {
|
|
53453
54363
|
const captured = workspaceMemberRoleInput(membershipId, input);
|
|
53454
|
-
return (await this.sessionClient(
|
|
54364
|
+
return (await this.sessionClient(email2, code, context)).setWorkspaceMemberRole(captured.membershipId, captured.body);
|
|
53455
54365
|
}
|
|
53456
|
-
async leaveWorkspace(
|
|
54366
|
+
async leaveWorkspace(email2, code, context, input) {
|
|
53457
54367
|
const captured = workspaceLeaveInput(context, input);
|
|
53458
|
-
return (await this.sessionClient(
|
|
54368
|
+
return (await this.sessionClient(email2, code, captured.context)).leaveWorkspace(captured.context, captured.input);
|
|
53459
54369
|
}
|
|
53460
|
-
async removeWorkspaceMember(
|
|
54370
|
+
async removeWorkspaceMember(email2, code, membershipId, input, context) {
|
|
53461
54371
|
const captured = workspaceMemberRemovalInput(membershipId, input);
|
|
53462
|
-
return (await this.sessionClient(
|
|
54372
|
+
return (await this.sessionClient(email2, code, context)).removeWorkspaceMember(captured.membershipId, captured.body);
|
|
53463
54373
|
}
|
|
53464
54374
|
request(path, options) {
|
|
53465
54375
|
if (!["/api/auth/login", "/api/auth/verify", "/api/auth/device/start", "/api/auth/device/token", "/api/auth/keys", "/api/auth/whoami"].includes(path))
|
|
@@ -53468,126 +54378,143 @@ class RemoteSkillsAuthClient {
|
|
|
53468
54378
|
}
|
|
53469
54379
|
}
|
|
53470
54380
|
export {
|
|
53471
|
-
|
|
53472
|
-
startedByFor,
|
|
53473
|
-
startSkillsServer,
|
|
53474
|
-
skillsServeLimits,
|
|
53475
|
-
skillsCredentialOrReason,
|
|
53476
|
-
skillsCredentialFiles,
|
|
53477
|
-
skillsCredentialFilePath,
|
|
53478
|
-
settleRun,
|
|
53479
|
-
selectsSkillsLocalMode,
|
|
53480
|
-
runTerminalSchema,
|
|
53481
|
-
runProtocolSchema,
|
|
53482
|
-
runPointersOf,
|
|
53483
|
-
runLeaseSchema,
|
|
53484
|
-
runAdmissionSchema,
|
|
53485
|
-
resolveSkillsFleet,
|
|
53486
|
-
resolveSkillsApiOrigin,
|
|
53487
|
-
resolveServerConfig,
|
|
53488
|
-
resolveImageProfile,
|
|
53489
|
-
resolveDatabaseTarget,
|
|
53490
|
-
reservationId,
|
|
53491
|
-
requireSkillsFleet,
|
|
53492
|
-
requireSkillsApiOrigin,
|
|
53493
|
-
requestDigestFor,
|
|
53494
|
-
registerRoutes,
|
|
53495
|
-
redactRunOutput,
|
|
53496
|
-
receiptId,
|
|
53497
|
-
protocolStateOf,
|
|
53498
|
-
noticeLocalSkillsMode,
|
|
53499
|
-
normalizeSkillsApiOrigin,
|
|
53500
|
-
normalizeRemoteSkillRunContract,
|
|
53501
|
-
newRunId,
|
|
53502
|
-
localRunExecutor,
|
|
53503
|
-
listServerSkills,
|
|
53504
|
-
leaseGenerationOf,
|
|
53505
|
-
isValidSkillSlug,
|
|
53506
|
-
isTerminalStatus,
|
|
53507
|
-
isSkillsLocalOptIn,
|
|
53508
|
-
isActiveStatus,
|
|
53509
|
-
getServerSkillMd,
|
|
53510
|
-
getServerSkill,
|
|
53511
|
-
expiresAtFor,
|
|
53512
|
-
expireArtifacts,
|
|
53513
|
-
executeRun,
|
|
53514
|
-
digestInput,
|
|
53515
|
-
dependencyLayerRule,
|
|
53516
|
-
currentVersionService,
|
|
53517
|
-
createSubmitRunService,
|
|
53518
|
-
createStore,
|
|
53519
|
-
createSpendService,
|
|
53520
|
-
createSkillsFetchHandler,
|
|
53521
|
-
createServer,
|
|
53522
|
-
createRunStateMachine,
|
|
53523
|
-
createRunService,
|
|
53524
|
-
createRunEventEmitter,
|
|
53525
|
-
createRemoteSkillsClient,
|
|
53526
|
-
createReceiptService,
|
|
53527
|
-
createOfflineGate,
|
|
53528
|
-
createImageProfileRegistry,
|
|
53529
|
-
createGovernedArtifactWriter,
|
|
53530
|
-
createGovernanceStore,
|
|
53531
|
-
createCancelService,
|
|
53532
|
-
createAwsEcsClient,
|
|
53533
|
-
configuredSkillsApiUrl,
|
|
53534
|
-
clientTokenFor,
|
|
53535
|
-
canonicalSystemDepsKey,
|
|
53536
|
-
canonicalJson,
|
|
53537
|
-
bundledRegistry,
|
|
53538
|
-
buildRunLifecycleEvent,
|
|
53539
|
-
attemptIdOf,
|
|
53540
|
-
assertDurableTarget,
|
|
53541
|
-
assertDurableStore,
|
|
53542
|
-
artifactStorageSeam,
|
|
53543
|
-
WorkspaceLeaveInputError,
|
|
53544
|
-
WorkspaceIdentityMismatchError,
|
|
53545
|
-
WorkspaceContextInputError,
|
|
53546
|
-
SqliteSkillsStore,
|
|
53547
|
-
SqliteRunExecutionStore,
|
|
53548
|
-
SqliteGovernanceStore,
|
|
53549
|
-
SkillsFleetCredentialError,
|
|
53550
|
-
SKILLS_LOCAL_OPT_IN_ENV_KEYS,
|
|
53551
|
-
SKILLS_APP,
|
|
53552
|
-
SKILLS_API_URL_ENV,
|
|
53553
|
-
SKILLS_API_KEY_ENV,
|
|
53554
|
-
RemoteWorkspaceSelectionError,
|
|
53555
|
-
RemoteWorkspaceMemberError,
|
|
53556
|
-
RemoteWorkspaceLeaveUnconfirmedError,
|
|
53557
|
-
RemoteWorkspaceLeaveError,
|
|
53558
|
-
RemoteSkillsClient,
|
|
53559
|
-
RemoteSkillsAuthClient,
|
|
53560
|
-
RemoteRouteUnsupportedError,
|
|
53561
|
-
RemoteRequestError,
|
|
53562
|
-
RemoteCreditApprovalError,
|
|
53563
|
-
RemoteCapabilityUnavailableError,
|
|
53564
|
-
RUN_PROTOCOL_VERSION,
|
|
53565
|
-
RUN_PROTOCOL_STATES,
|
|
53566
|
-
RUN_LIFECYCLE_EVENT_TYPES,
|
|
53567
|
-
RUN_LIFECYCLE_EVENT_FIELDS,
|
|
53568
|
-
REMOTE_SKILL_RUN_CONTRACT_VERSION,
|
|
53569
|
-
PostgresSkillsStore,
|
|
53570
|
-
PostgresGovernanceStore,
|
|
53571
|
-
MissingSkillsFleetError,
|
|
53572
|
-
MemorySkillsStore,
|
|
53573
|
-
MemoryRunExecutionStore,
|
|
53574
|
-
MemoryGovernanceStore,
|
|
53575
|
-
LEGAL_TRANSITIONS,
|
|
53576
|
-
ImageProfileResolutionError,
|
|
53577
|
-
HostedApiError,
|
|
53578
|
-
GovernanceError,
|
|
53579
|
-
GOVERNANCE_ERROR_CODES,
|
|
53580
|
-
EcsDispatcher,
|
|
53581
|
-
EXECUTION_PROTOCOL_VERSION,
|
|
53582
|
-
E2bDispatcher,
|
|
53583
|
-
E2B_LANE_STATUS,
|
|
53584
|
-
DispatcherNotImplementedError,
|
|
53585
|
-
DEFAULT_SPEND_CEILINGS,
|
|
53586
|
-
DEFAULT_RUN_QUOTA,
|
|
53587
|
-
DEFAULT_RUN_POLICY,
|
|
53588
|
-
DEFAULT_RUN_LIMITS,
|
|
53589
|
-
DEFAULT_OUTPUT_GOVERNANCE,
|
|
53590
|
-
DEFAULT_IMAGE_PROFILES,
|
|
54381
|
+
ArtifactStorage,
|
|
53591
54382
|
CLIENT_TOKEN_BYTES,
|
|
53592
|
-
|
|
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,
|
|
54518
|
+
validateRunLifecycleEvent,
|
|
54519
|
+
verifyContentHashFromEntries
|
|
53593
54520
|
};
|