@hasna/skills 0.5.4 → 0.5.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +72 -7
- package/bin/index.js +1875 -595
- package/bin/mcp.js +1780 -328
- package/bin/migrate.js +176 -4
- package/bin/server.js +300 -76
- package/bin/worker.js +294 -103
- package/dist/admin-contract.js +166 -168
- package/dist/cli/commands/private-publications.d.ts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1059 -410
- package/dist/lib/fleet-credentials.d.ts +6 -1
- package/dist/lib/home-adoption.d.ts +2 -7
- package/dist/lib/mcp-contracts.d.ts +1 -0
- package/dist/lib/private-publication-customer.d.ts +10 -0
- package/dist/lib/private-publication-recovery.d.ts +43 -0
- package/dist/lib/remote-account.d.ts +5 -0
- package/dist/lib/remote-auth.d.ts +3 -0
- package/dist/lib/remote-client.d.ts +2 -2
- package/dist/lib/remote-private-publications.d.ts +74 -0
- package/dist/mcp/private-publication-tools.d.ts +2 -0
- package/dist/sdk/execution/dispatchers/ecs.d.ts +25 -14
- package/dist/sdk/index.d.ts +2 -0
- package/dist/sdk/index.js +1137 -463
- package/dist/server/types.d.ts +2 -0
- package/dist/storage.js +33 -35
- package/package.json +1 -1
package/bin/server.js
CHANGED
|
@@ -20,14 +20,12 @@ var __toESM = (mod, isNodeMode, target) => {
|
|
|
20
20
|
}
|
|
21
21
|
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
22
22
|
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
});
|
|
30
|
-
}
|
|
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
|
+
});
|
|
31
29
|
if (canCache)
|
|
32
30
|
cache.set(mod, to);
|
|
33
31
|
return to;
|
|
@@ -50,7 +48,7 @@ var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
|
50
48
|
var __require = import.meta.require;
|
|
51
49
|
|
|
52
50
|
// ../../node_modules/.bun/@smithy+types@4.18.0/node_modules/@smithy/types/dist-cjs/index.js
|
|
53
|
-
var require_dist_cjs = __commonJS(
|
|
51
|
+
var require_dist_cjs = __commonJS((exports) => {
|
|
54
52
|
var HttpAuthLocation;
|
|
55
53
|
(function(HttpAuthLocation2) {
|
|
56
54
|
HttpAuthLocation2["HEADER"] = "header";
|
|
@@ -141,7 +139,7 @@ var require_dist_cjs = __commonJS(function(exports) {
|
|
|
141
139
|
});
|
|
142
140
|
|
|
143
141
|
// ../../node_modules/.bun/@smithy+core@3.33.3/node_modules/@smithy/core/dist-cjs/submodules/transport/index.js
|
|
144
|
-
var require_transport = __commonJS(
|
|
142
|
+
var require_transport = __commonJS((exports) => {
|
|
145
143
|
var { SMITHY_CONTEXT_KEY } = require_dist_cjs();
|
|
146
144
|
var getSmithyContext = (context) => context[SMITHY_CONTEXT_KEY] || (context[SMITHY_CONTEXT_KEY] = {});
|
|
147
145
|
function hasOwn(o, k) {
|
|
@@ -314,7 +312,7 @@ var require_transport = __commonJS(function(exports) {
|
|
|
314
312
|
});
|
|
315
313
|
|
|
316
314
|
// ../../node_modules/.bun/@smithy+core@3.33.3/node_modules/@smithy/core/dist-cjs/submodules/schema/index.js
|
|
317
|
-
var require_schema = __commonJS(
|
|
315
|
+
var require_schema = __commonJS((exports) => {
|
|
318
316
|
var { getSmithyContext, HttpResponse, toEndpointV1 } = require_transport();
|
|
319
317
|
var deref = (schemaRef) => {
|
|
320
318
|
if (typeof schemaRef === "function") {
|
|
@@ -983,7 +981,7 @@ var require_schema = __commonJS(function(exports) {
|
|
|
983
981
|
});
|
|
984
982
|
|
|
985
983
|
// ../../node_modules/.bun/@smithy+core@3.33.3/node_modules/@smithy/core/dist-cjs/submodules/client/index.js
|
|
986
|
-
var require_client = __commonJS(
|
|
984
|
+
var require_client = __commonJS((exports) => {
|
|
987
985
|
var { hasOwn } = require_transport();
|
|
988
986
|
var { getSmithyContext, normalizeProvider } = require_transport();
|
|
989
987
|
exports.getSmithyContext = getSmithyContext;
|
|
@@ -2063,7 +2061,7 @@ var require_client = __commonJS(function(exports) {
|
|
|
2063
2061
|
});
|
|
2064
2062
|
|
|
2065
2063
|
// ../../node_modules/.bun/@smithy+core@3.33.3/node_modules/@smithy/core/dist-cjs/submodules/config/index.js
|
|
2066
|
-
var require_config = __commonJS(
|
|
2064
|
+
var require_config = __commonJS((exports) => {
|
|
2067
2065
|
var { homedir } = __require("os");
|
|
2068
2066
|
var { sep, join: join2 } = __require("path");
|
|
2069
2067
|
var { createHash: createHash2 } = __require("crypto");
|
|
@@ -2758,7 +2756,7 @@ var require_config = __commonJS(function(exports) {
|
|
|
2758
2756
|
});
|
|
2759
2757
|
|
|
2760
2758
|
// ../../node_modules/.bun/@smithy+core@3.33.3/node_modules/@smithy/core/dist-cjs/submodules/endpoints/index.js
|
|
2761
|
-
var require_endpoints = __commonJS(
|
|
2759
|
+
var require_endpoints = __commonJS((exports) => {
|
|
2762
2760
|
var { CONFIG_PREFIX_SEPARATOR, booleanSelector, SelectorType, loadConfig } = require_config();
|
|
2763
2761
|
var { toEndpointV1, getSmithyContext, normalizeProvider, isValidHostLabel, hasOwn } = require_transport();
|
|
2764
2762
|
exports.isValidHostLabel = isValidHostLabel;
|
|
@@ -3572,7 +3570,7 @@ var require_endpoints = __commonJS(function(exports) {
|
|
|
3572
3570
|
});
|
|
3573
3571
|
|
|
3574
3572
|
// ../../node_modules/.bun/@smithy+core@3.33.3/node_modules/@smithy/core/dist-cjs/submodules/serde/index.js
|
|
3575
|
-
var require_serde = __commonJS(
|
|
3573
|
+
var require_serde = __commonJS((exports) => {
|
|
3576
3574
|
var { createHmac: createHmac2, createHash: createHash2, getRandomValues } = __require("crypto");
|
|
3577
3575
|
var { hasOwn, HttpResponse } = require_transport();
|
|
3578
3576
|
exports.hasOwn = hasOwn;
|
|
@@ -5213,7 +5211,7 @@ ${value}\r
|
|
|
5213
5211
|
});
|
|
5214
5212
|
|
|
5215
5213
|
// ../../node_modules/.bun/@smithy+core@3.33.3/node_modules/@smithy/core/dist-cjs/submodules/checksum/index.js
|
|
5216
|
-
var require_checksum = __commonJS(
|
|
5214
|
+
var require_checksum = __commonJS((exports) => {
|
|
5217
5215
|
var { createReadStream } = __require("fs");
|
|
5218
5216
|
var { Writable } = __require("stream");
|
|
5219
5217
|
var { toUint8Array, concatBytes } = require_serde();
|
|
@@ -5829,7 +5827,7 @@ var require_checksum = __commonJS(function(exports) {
|
|
|
5829
5827
|
});
|
|
5830
5828
|
|
|
5831
5829
|
// ../../node_modules/.bun/@smithy+core@3.33.3/node_modules/@smithy/core/dist-cjs/submodules/event-streams/index.js
|
|
5832
|
-
var require_event_streams = __commonJS(
|
|
5830
|
+
var require_event_streams = __commonJS((exports) => {
|
|
5833
5831
|
var { Crc32 } = require_checksum();
|
|
5834
5832
|
var { hasOwn } = require_transport();
|
|
5835
5833
|
var { toHex, fromHex, toUtf8, fromUtf8 } = require_serde();
|
|
@@ -6721,7 +6719,7 @@ var require_event_streams = __commonJS(function(exports) {
|
|
|
6721
6719
|
});
|
|
6722
6720
|
|
|
6723
6721
|
// ../../node_modules/.bun/@smithy+core@3.33.3/node_modules/@smithy/core/dist-cjs/submodules/protocols/index.js
|
|
6724
|
-
var require_protocols = __commonJS(
|
|
6722
|
+
var require_protocols = __commonJS((exports) => {
|
|
6725
6723
|
var { Uint8ArrayBlobAdapter, sdkStreamMixin, splitEvery, splitHeader, fromBase64, _parseEpochTimestamp, _parseRfc7231DateTime, _parseRfc3339DateTimeWithOffset, LazyJsonString, NumericValue, toUtf8, fromUtf8, generateIdempotencyToken, toBase64, dateToUtcString, quoteHeader } = require_serde();
|
|
6726
6724
|
var { HttpRequest, HttpResponse, hasOwn, isValidHostname } = require_transport();
|
|
6727
6725
|
var { parseQueryString, parseUrl } = require_transport();
|
|
@@ -7725,7 +7723,7 @@ var require_protocols = __commonJS(function(exports) {
|
|
|
7725
7723
|
});
|
|
7726
7724
|
|
|
7727
7725
|
// ../../node_modules/.bun/@smithy+core@3.33.3/node_modules/@smithy/core/dist-cjs/submodules/retry/index.js
|
|
7728
|
-
var require_retry = __commonJS(
|
|
7726
|
+
var require_retry = __commonJS((exports) => {
|
|
7729
7727
|
var { Readable } = __require("stream");
|
|
7730
7728
|
var { NoOpLogger, normalizeProvider } = require_client();
|
|
7731
7729
|
var { HttpResponse, HttpRequest } = require_protocols();
|
|
@@ -8525,7 +8523,7 @@ var require_retry = __commonJS(function(exports) {
|
|
|
8525
8523
|
});
|
|
8526
8524
|
|
|
8527
8525
|
// ../../node_modules/.bun/@aws+lambda-invoke-store@0.3.0/node_modules/@aws/lambda-invoke-store/dist-cjs/invoke-store.js
|
|
8528
|
-
var require_invoke_store = __commonJS(
|
|
8526
|
+
var require_invoke_store = __commonJS((exports) => {
|
|
8529
8527
|
var PROTECTED_KEYS = {
|
|
8530
8528
|
REQUEST_ID: Symbol.for("_AWS_LAMBDA_REQUEST_ID"),
|
|
8531
8529
|
X_RAY_TRACE_ID: Symbol.for("_AWS_LAMBDA_X_RAY_TRACE_ID"),
|
|
@@ -8654,7 +8652,7 @@ var require_invoke_store = __commonJS(function(exports) {
|
|
|
8654
8652
|
});
|
|
8655
8653
|
|
|
8656
8654
|
// ../../node_modules/.bun/@smithy+core@3.33.3/node_modules/@smithy/core/dist-cjs/index.js
|
|
8657
|
-
var require_dist_cjs2 = __commonJS(
|
|
8655
|
+
var require_dist_cjs2 = __commonJS((exports) => {
|
|
8658
8656
|
var { getSmithyContext, hasOwn } = require_transport();
|
|
8659
8657
|
exports.getSmithyContext = getSmithyContext;
|
|
8660
8658
|
var { HttpRequest } = require_protocols();
|
|
@@ -8982,7 +8980,7 @@ var require_dist_cjs2 = __commonJS(function(exports) {
|
|
|
8982
8980
|
});
|
|
8983
8981
|
|
|
8984
8982
|
// ../../node_modules/.bun/bowser@2.14.1/node_modules/bowser/es5.js
|
|
8985
|
-
var require_es5 = __commonJS(
|
|
8983
|
+
var require_es5 = __commonJS((exports, module) => {
|
|
8986
8984
|
(function(e, t) {
|
|
8987
8985
|
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();
|
|
8988
8986
|
})(exports, function() {
|
|
@@ -9822,7 +9820,7 @@ var require_es5 = __commonJS(function(exports, module) {
|
|
|
9822
9820
|
});
|
|
9823
9821
|
|
|
9824
9822
|
// ../../node_modules/.bun/@aws-sdk+core@3.977.9/node_modules/@aws-sdk/core/dist-cjs/submodules/client/index.js
|
|
9825
|
-
var require_client2 = __commonJS(
|
|
9823
|
+
var require_client2 = __commonJS((exports) => {
|
|
9826
9824
|
var { Retry, RETRY_MODES } = require_retry();
|
|
9827
9825
|
var { HttpRequest, parseUrl } = require_protocols();
|
|
9828
9826
|
var { InvokeStore } = require_invoke_store();
|
|
@@ -10760,7 +10758,7 @@ More information can be found at: https://a.co/c895JFp`);
|
|
|
10760
10758
|
});
|
|
10761
10759
|
|
|
10762
10760
|
// ../../node_modules/.bun/@aws-sdk+checksums@3.1000.29/node_modules/@aws-sdk/checksums/dist-cjs/submodules/crc/index.js
|
|
10763
|
-
var require_crc = __commonJS(
|
|
10761
|
+
var require_crc = __commonJS((exports) => {
|
|
10764
10762
|
var { Crc32, Crc32Js, Crc32Node } = require_checksum();
|
|
10765
10763
|
exports.Crc32 = Crc32;
|
|
10766
10764
|
exports.Crc32Js = Crc32Js;
|
|
@@ -10917,7 +10915,7 @@ var require_crc = __commonJS(function(exports) {
|
|
|
10917
10915
|
});
|
|
10918
10916
|
|
|
10919
10917
|
// ../../node_modules/.bun/@smithy+signature-v4@5.7.3/node_modules/@smithy/signature-v4/dist-cjs/index.js
|
|
10920
|
-
var require_dist_cjs3 = __commonJS(
|
|
10918
|
+
var require_dist_cjs3 = __commonJS((exports) => {
|
|
10921
10919
|
var { hasOwn, fromUtf8, fromHex, toHex, toUint8Array: toUint8Array2, isArrayBuffer: isArrayBuffer2 } = require_serde();
|
|
10922
10920
|
var { normalizeProvider: normalizeProvider2 } = require_client();
|
|
10923
10921
|
var { escapeUri, HttpRequest: HttpRequest2 } = require_protocols();
|
|
@@ -11469,7 +11467,7 @@ ${toHex(hashedRequest)}`;
|
|
|
11469
11467
|
});
|
|
11470
11468
|
|
|
11471
11469
|
// ../../node_modules/.bun/@aws-sdk+signature-v4-multi-region@3.996.46/node_modules/@aws-sdk/signature-v4-multi-region/dist-cjs/index.js
|
|
11472
|
-
var require_dist_cjs4 = __commonJS(
|
|
11470
|
+
var require_dist_cjs4 = __commonJS((exports) => {
|
|
11473
11471
|
var { SignatureV4, signatureV4aContainer } = require_dist_cjs3();
|
|
11474
11472
|
var signatureV4CrtContainer = {
|
|
11475
11473
|
CrtSignerV4: null
|
|
@@ -11601,7 +11599,7 @@ var require_dist_cjs4 = __commonJS(function(exports) {
|
|
|
11601
11599
|
});
|
|
11602
11600
|
|
|
11603
11601
|
// ../../node_modules/.bun/@aws-sdk+core@3.977.9/node_modules/@aws-sdk/core/dist-cjs/submodules/util/index.js
|
|
11604
|
-
var require_util = __commonJS(
|
|
11602
|
+
var require_util = __commonJS((exports) => {
|
|
11605
11603
|
var { buildQueryString } = require_protocols();
|
|
11606
11604
|
var validate = (str) => typeof str === "string" && str.indexOf("arn:") === 0 && str.split(":").length >= 6;
|
|
11607
11605
|
var parse = (arn) => {
|
|
@@ -11659,7 +11657,7 @@ var require_util = __commonJS(function(exports) {
|
|
|
11659
11657
|
});
|
|
11660
11658
|
|
|
11661
11659
|
// ../../node_modules/.bun/@smithy+core@3.33.3/node_modules/@smithy/core/dist-cjs/submodules/cbor/index.js
|
|
11662
|
-
var require_cbor = __commonJS(
|
|
11660
|
+
var require_cbor = __commonJS((exports) => {
|
|
11663
11661
|
var { nv, NumericValue, calculateBodyLength, generateIdempotencyToken, fromBase64, _parseEpochTimestamp } = require_serde();
|
|
11664
11662
|
var { hasOwn, getSmithyContext } = require_transport();
|
|
11665
11663
|
var { HttpRequest: HttpRequest2, collectBody, SerdeContext, RpcProtocol } = require_protocols();
|
|
@@ -14109,7 +14107,7 @@ var require_cbor = __commonJS(function(exports) {
|
|
|
14109
14107
|
});
|
|
14110
14108
|
|
|
14111
14109
|
// ../../node_modules/.bun/@aws-sdk+xml-builder@3.972.40/node_modules/@aws-sdk/xml-builder/dist-cjs/index.js
|
|
14112
|
-
var require_dist_cjs5 = __commonJS(
|
|
14110
|
+
var require_dist_cjs5 = __commonJS((exports) => {
|
|
14113
14111
|
var ATTR_ESCAPE_RE = /[&<>"]/g;
|
|
14114
14112
|
var ATTR_ESCAPE_MAP = {
|
|
14115
14113
|
"&": "&",
|
|
@@ -14477,7 +14475,7 @@ var require_dist_cjs5 = __commonJS(function(exports) {
|
|
|
14477
14475
|
});
|
|
14478
14476
|
|
|
14479
14477
|
// ../../node_modules/.bun/@aws-sdk+core@3.977.9/node_modules/@aws-sdk/core/dist-cjs/submodules/protocols/index.js
|
|
14480
|
-
var require_protocols2 = __commonJS(
|
|
14478
|
+
var require_protocols2 = __commonJS((exports) => {
|
|
14481
14479
|
var { SmithyRpcV2CborProtocol, loadSmithyRpcV2CborErrorCode } = require_cbor();
|
|
14482
14480
|
var { TypeRegistry, NormalizedSchema, deref } = require_schema();
|
|
14483
14481
|
var { decorateServiceException, getValueFromTextNode } = require_client();
|
|
@@ -17318,7 +17316,7 @@ var require_protocols2 = __commonJS(function(exports) {
|
|
|
17318
17316
|
});
|
|
17319
17317
|
|
|
17320
17318
|
// ../../node_modules/.bun/@aws-sdk+core@3.977.9/node_modules/@aws-sdk/core/dist-cjs/submodules/httpAuthSchemes/index.js
|
|
17321
|
-
var require_httpAuthSchemes = __commonJS(
|
|
17319
|
+
var require_httpAuthSchemes = __commonJS((exports) => {
|
|
17322
17320
|
var { ProviderError, booleanSelector: booleanSelector2, SelectorType: SelectorType3, loadConfig } = require_config();
|
|
17323
17321
|
var { setCredentialFeature } = require_client2();
|
|
17324
17322
|
var { normalizeProvider: normalizeProvider2, memoizeIdentityProvider, isIdentityExpired, doesIdentityRequireRefresh } = require_dist_cjs2();
|
|
@@ -17678,13 +17676,13 @@ var init_fromEnv = __esm(() => {
|
|
|
17678
17676
|
// ../../node_modules/.bun/@aws-sdk+credential-provider-env@3.972.70/node_modules/@aws-sdk/credential-provider-env/dist-es/index.js
|
|
17679
17677
|
var exports_dist_es = {};
|
|
17680
17678
|
__export(exports_dist_es, {
|
|
17681
|
-
|
|
17682
|
-
ENV_CREDENTIAL_SCOPE: () => ENV_CREDENTIAL_SCOPE,
|
|
17683
|
-
ENV_EXPIRATION: () => ENV_EXPIRATION,
|
|
17684
|
-
ENV_KEY: () => ENV_KEY,
|
|
17685
|
-
ENV_SECRET: () => ENV_SECRET,
|
|
17679
|
+
fromEnv: () => fromEnv,
|
|
17686
17680
|
ENV_SESSION: () => ENV_SESSION,
|
|
17687
|
-
|
|
17681
|
+
ENV_SECRET: () => ENV_SECRET,
|
|
17682
|
+
ENV_KEY: () => ENV_KEY,
|
|
17683
|
+
ENV_EXPIRATION: () => ENV_EXPIRATION,
|
|
17684
|
+
ENV_CREDENTIAL_SCOPE: () => ENV_CREDENTIAL_SCOPE,
|
|
17685
|
+
ENV_ACCOUNT_ID: () => ENV_ACCOUNT_ID
|
|
17688
17686
|
});
|
|
17689
17687
|
var init_dist_es = __esm(() => {
|
|
17690
17688
|
init_fromEnv();
|
|
@@ -18068,17 +18066,17 @@ var init_fromInstanceMetadata = __esm(() => {
|
|
|
18068
18066
|
// ../../node_modules/.bun/@smithy+credential-provider-imds@4.5.2/node_modules/@smithy/credential-provider-imds/dist-es/index.js
|
|
18069
18067
|
var exports_dist_es2 = {};
|
|
18070
18068
|
__export(exports_dist_es2, {
|
|
18071
|
-
|
|
18072
|
-
DEFAULT_TIMEOUT: () => DEFAULT_TIMEOUT,
|
|
18073
|
-
ENV_CMDS_AUTH_TOKEN: () => ENV_CMDS_AUTH_TOKEN,
|
|
18074
|
-
ENV_CMDS_FULL_URI: () => ENV_CMDS_FULL_URI,
|
|
18075
|
-
ENV_CMDS_RELATIVE_URI: () => ENV_CMDS_RELATIVE_URI,
|
|
18076
|
-
Endpoint: () => Endpoint,
|
|
18077
|
-
fromContainerMetadata: () => fromContainerMetadata,
|
|
18078
|
-
fromInstanceMetadata: () => fromInstanceMetadata,
|
|
18079
|
-
getInstanceMetadataEndpoint: () => getInstanceMetadataEndpoint,
|
|
18069
|
+
providerConfigFromInit: () => providerConfigFromInit,
|
|
18080
18070
|
httpRequest: () => httpRequest,
|
|
18081
|
-
|
|
18071
|
+
getInstanceMetadataEndpoint: () => getInstanceMetadataEndpoint,
|
|
18072
|
+
fromInstanceMetadata: () => fromInstanceMetadata,
|
|
18073
|
+
fromContainerMetadata: () => fromContainerMetadata,
|
|
18074
|
+
Endpoint: () => Endpoint,
|
|
18075
|
+
ENV_CMDS_RELATIVE_URI: () => ENV_CMDS_RELATIVE_URI,
|
|
18076
|
+
ENV_CMDS_FULL_URI: () => ENV_CMDS_FULL_URI,
|
|
18077
|
+
ENV_CMDS_AUTH_TOKEN: () => ENV_CMDS_AUTH_TOKEN,
|
|
18078
|
+
DEFAULT_TIMEOUT: () => DEFAULT_TIMEOUT,
|
|
18079
|
+
DEFAULT_MAX_RETRIES: () => DEFAULT_MAX_RETRIES
|
|
18082
18080
|
});
|
|
18083
18081
|
var init_dist_es2 = __esm(() => {
|
|
18084
18082
|
init_fromContainerMetadata();
|
|
@@ -18089,7 +18087,7 @@ var init_dist_es2 = __esm(() => {
|
|
|
18089
18087
|
});
|
|
18090
18088
|
|
|
18091
18089
|
// ../../node_modules/.bun/@smithy+node-http-handler@4.12.1/node_modules/@smithy/node-http-handler/dist-cjs/index.js
|
|
18092
|
-
var require_dist_cjs6 = __commonJS(
|
|
18090
|
+
var require_dist_cjs6 = __commonJS((exports) => {
|
|
18093
18091
|
var { hasOwn } = require_serde();
|
|
18094
18092
|
var { streamCollector } = require_serde();
|
|
18095
18093
|
exports.streamCollector = streamCollector;
|
|
@@ -19096,7 +19094,7 @@ var init_constants = __esm(() => {
|
|
|
19096
19094
|
});
|
|
19097
19095
|
|
|
19098
19096
|
// ../../node_modules/.bun/@aws-sdk+nested-clients@3.997.44/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso-oidc/index.js
|
|
19099
|
-
var require_sso_oidc = __commonJS(
|
|
19097
|
+
var require_sso_oidc = __commonJS((exports) => {
|
|
19100
19098
|
var { awsEndpointFunctions: awsEndpointFunctions2, emitWarningIfUnsupportedVersion: emitWarningIfUnsupportedVersion$1, createDefaultUserAgentProvider, NODE_APP_ID_CONFIG_OPTIONS, getAwsRegionExtensionConfiguration, resolveAwsRegionExtensionConfiguration, resolveUserAgentConfig, resolveHostHeaderConfig, getUserAgentPlugin, getHostHeaderPlugin, getLoggerPlugin, getRecursionDetectionPlugin } = require_client2();
|
|
19101
19099
|
var { NoAuthSigner, getHttpAuthSchemeEndpointRuleSetPlugin, DefaultIdentityProviderConfig, getHttpSigningPlugin } = require_dist_cjs2();
|
|
19102
19100
|
var { normalizeProvider: normalizeProvider3, getSmithyContext: getSmithyContext3, ServiceException, NoOpLogger: NoOpLogger2, emitWarningIfUnsupportedVersion, loadConfigsForDefaultMode, getDefaultExtensionConfiguration, resolveDefaultRuntimeConfig, Client, makeBuilder: makeBuilder2, createAggregatedClient } = require_client();
|
|
@@ -20448,8 +20446,8 @@ var init_sso = __esm(() => {
|
|
|
20448
20446
|
// ../../node_modules/.bun/@aws-sdk+credential-provider-sso@3.973.14/node_modules/@aws-sdk/credential-provider-sso/dist-es/loadSso.js
|
|
20449
20447
|
var exports_loadSso = {};
|
|
20450
20448
|
__export(exports_loadSso, {
|
|
20451
|
-
|
|
20452
|
-
|
|
20449
|
+
SSOClient: () => $SSOClient,
|
|
20450
|
+
GetRoleCredentialsCommand: () => $GetRoleCredentialsCommand
|
|
20453
20451
|
});
|
|
20454
20452
|
var init_loadSso = __esm(() => {
|
|
20455
20453
|
init_sso();
|
|
@@ -20642,9 +20640,9 @@ var init_fromSSO = __esm(() => {
|
|
|
20642
20640
|
// ../../node_modules/.bun/@aws-sdk+credential-provider-sso@3.973.14/node_modules/@aws-sdk/credential-provider-sso/dist-es/index.js
|
|
20643
20641
|
var exports_dist_es4 = {};
|
|
20644
20642
|
__export(exports_dist_es4, {
|
|
20645
|
-
|
|
20643
|
+
validateSsoProfile: () => validateSsoProfile,
|
|
20646
20644
|
isSsoProfile: () => isSsoProfile,
|
|
20647
|
-
|
|
20645
|
+
fromSSO: () => fromSSO
|
|
20648
20646
|
});
|
|
20649
20647
|
var init_dist_es5 = __esm(() => {
|
|
20650
20648
|
init_fromSSO();
|
|
@@ -20683,7 +20681,7 @@ var init_resolveCredentialSource = __esm(() => {
|
|
|
20683
20681
|
});
|
|
20684
20682
|
|
|
20685
20683
|
// ../../node_modules/.bun/@aws-sdk+nested-clients@3.997.44/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sts/index.js
|
|
20686
|
-
var require_sts = __commonJS(
|
|
20684
|
+
var require_sts = __commonJS((exports) => {
|
|
20687
20685
|
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();
|
|
20688
20686
|
var { NoAuthSigner: NoAuthSigner2, getHttpAuthSchemeEndpointRuleSetPlugin: getHttpAuthSchemeEndpointRuleSetPlugin2, DefaultIdentityProviderConfig: DefaultIdentityProviderConfig2, getHttpSigningPlugin: getHttpSigningPlugin2 } = require_dist_cjs2();
|
|
20689
20687
|
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();
|
|
@@ -21773,7 +21771,7 @@ var init_resolveAssumeRoleCredentials = __esm(() => {
|
|
|
21773
21771
|
});
|
|
21774
21772
|
|
|
21775
21773
|
// ../../node_modules/.bun/@aws-sdk+nested-clients@3.997.44/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/signin/index.js
|
|
21776
|
-
var require_signin = __commonJS(
|
|
21774
|
+
var require_signin = __commonJS((exports) => {
|
|
21777
21775
|
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();
|
|
21778
21776
|
var { NoAuthSigner: NoAuthSigner2, getHttpAuthSchemeEndpointRuleSetPlugin: getHttpAuthSchemeEndpointRuleSetPlugin2, DefaultIdentityProviderConfig: DefaultIdentityProviderConfig2, getHttpSigningPlugin: getHttpSigningPlugin2 } = require_dist_cjs2();
|
|
21779
21777
|
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();
|
|
@@ -23016,8 +23014,8 @@ var init_fromTokenFile = __esm(() => {
|
|
|
23016
23014
|
// ../../node_modules/.bun/@aws-sdk+credential-provider-web-identity@3.972.76/node_modules/@aws-sdk/credential-provider-web-identity/dist-es/index.js
|
|
23017
23015
|
var exports_dist_es7 = {};
|
|
23018
23016
|
__export(exports_dist_es7, {
|
|
23019
|
-
|
|
23020
|
-
|
|
23017
|
+
fromWebToken: () => fromWebToken,
|
|
23018
|
+
fromTokenFile: () => fromTokenFile
|
|
23021
23019
|
});
|
|
23022
23020
|
var init_dist_es8 = __esm(() => {
|
|
23023
23021
|
init_fromTokenFile();
|
|
@@ -23102,7 +23100,7 @@ var init_dist_es9 = __esm(() => {
|
|
|
23102
23100
|
// package.json
|
|
23103
23101
|
var package_default = {
|
|
23104
23102
|
name: "@hasna/skills",
|
|
23105
|
-
version: "0.5.
|
|
23103
|
+
version: "0.5.5",
|
|
23106
23104
|
description: "Skills library for AI coding agents",
|
|
23107
23105
|
type: "module",
|
|
23108
23106
|
bin: {
|
|
@@ -23234,6 +23232,40 @@ import { createHmac, timingSafeEqual } from "crypto";
|
|
|
23234
23232
|
import { createHash } from "crypto";
|
|
23235
23233
|
import { readFileSync, readdirSync, statSync } from "fs";
|
|
23236
23234
|
import { join, relative } from "path";
|
|
23235
|
+
|
|
23236
|
+
// src/lib/skill-entry-path.ts
|
|
23237
|
+
class SkillEntryPaths {
|
|
23238
|
+
files = new Set;
|
|
23239
|
+
directories = new Set;
|
|
23240
|
+
add(path, maxBytes, invalid, limit) {
|
|
23241
|
+
if (path.length > maxBytes)
|
|
23242
|
+
limit();
|
|
23243
|
+
const encoded = new TextEncoder().encode(path);
|
|
23244
|
+
if (encoded.byteLength > maxBytes)
|
|
23245
|
+
limit();
|
|
23246
|
+
if (new TextDecoder("utf-8", { fatal: true, ignoreBOM: true }).decode(encoded) !== path)
|
|
23247
|
+
invalid("Invalid UTF-8 entry path");
|
|
23248
|
+
if (!path || /[\\:\x00-\x1f\x7f]/u.test(path))
|
|
23249
|
+
invalid("Unsafe entry path");
|
|
23250
|
+
if (path.split("/").some((segment) => !segment || segment === "." || segment === ".."))
|
|
23251
|
+
invalid("Unsafe entry path segment");
|
|
23252
|
+
const key = path.normalize("NFC").toLowerCase().normalize("NFC");
|
|
23253
|
+
if (this.files.has(key) || this.directories.has(key))
|
|
23254
|
+
invalid("Duplicate or conflicting entry path");
|
|
23255
|
+
const parents = key.split("/");
|
|
23256
|
+
parents.pop();
|
|
23257
|
+
while (parents.length) {
|
|
23258
|
+
const parent = parents.join("/");
|
|
23259
|
+
if (this.files.has(parent))
|
|
23260
|
+
invalid("Conflicting entry file ancestor");
|
|
23261
|
+
this.directories.add(parent);
|
|
23262
|
+
parents.pop();
|
|
23263
|
+
}
|
|
23264
|
+
this.files.add(key);
|
|
23265
|
+
}
|
|
23266
|
+
}
|
|
23267
|
+
|
|
23268
|
+
// src/lib/skill-bundle.ts
|
|
23237
23269
|
var BLOCK = 512;
|
|
23238
23270
|
var ANY_SEGMENT_EXCLUDES = new Set([
|
|
23239
23271
|
".git",
|
|
@@ -23514,6 +23546,136 @@ var SKILL_BUNDLE_INSPECTION_LIMITS = Object.freeze({
|
|
|
23514
23546
|
timeoutMs: 5000
|
|
23515
23547
|
});
|
|
23516
23548
|
|
|
23549
|
+
class SkillBundleInspectionError extends Error {
|
|
23550
|
+
code;
|
|
23551
|
+
constructor(code, message) {
|
|
23552
|
+
super(message);
|
|
23553
|
+
this.code = code;
|
|
23554
|
+
this.name = "SkillBundleInspectionError";
|
|
23555
|
+
}
|
|
23556
|
+
}
|
|
23557
|
+
function invalidBundle(message) {
|
|
23558
|
+
throw new SkillBundleInspectionError("BUNDLE_INVALID", message);
|
|
23559
|
+
}
|
|
23560
|
+
class BoundedTarReader {
|
|
23561
|
+
limits;
|
|
23562
|
+
check;
|
|
23563
|
+
header = new Uint8Array(BLOCK);
|
|
23564
|
+
headerOffset = 0;
|
|
23565
|
+
pending;
|
|
23566
|
+
bodyOffset = 0;
|
|
23567
|
+
padding = 0;
|
|
23568
|
+
zeroBlocks = 0;
|
|
23569
|
+
entries = [];
|
|
23570
|
+
paths = new SkillEntryPaths;
|
|
23571
|
+
fileBytes = 0;
|
|
23572
|
+
constructor(limits, check) {
|
|
23573
|
+
this.limits = limits;
|
|
23574
|
+
this.check = check;
|
|
23575
|
+
}
|
|
23576
|
+
push(chunk) {
|
|
23577
|
+
let offset = 0;
|
|
23578
|
+
while (offset < chunk.byteLength) {
|
|
23579
|
+
this.check();
|
|
23580
|
+
if (this.pending) {
|
|
23581
|
+
const count = Math.min(this.pending.bytes.byteLength - this.bodyOffset, chunk.byteLength - offset);
|
|
23582
|
+
this.pending.bytes.set(chunk.subarray(offset, offset + count), this.bodyOffset);
|
|
23583
|
+
offset += count;
|
|
23584
|
+
this.bodyOffset += count;
|
|
23585
|
+
if (this.bodyOffset === this.pending.bytes.byteLength) {
|
|
23586
|
+
this.entries.push(this.pending);
|
|
23587
|
+
this.pending = undefined;
|
|
23588
|
+
}
|
|
23589
|
+
} else if (this.padding) {
|
|
23590
|
+
const count = Math.min(this.padding, chunk.byteLength - offset);
|
|
23591
|
+
if (chunk.subarray(offset, offset + count).some((byte) => byte !== 0))
|
|
23592
|
+
invalidBundle("Nonzero tar body padding");
|
|
23593
|
+
offset += count;
|
|
23594
|
+
this.padding -= count;
|
|
23595
|
+
} else {
|
|
23596
|
+
const count = Math.min(BLOCK - this.headerOffset, chunk.byteLength - offset);
|
|
23597
|
+
this.header.set(chunk.subarray(offset, offset + count), this.headerOffset);
|
|
23598
|
+
offset += count;
|
|
23599
|
+
this.headerOffset += count;
|
|
23600
|
+
if (this.headerOffset === BLOCK) {
|
|
23601
|
+
this.readHeader();
|
|
23602
|
+
this.headerOffset = 0;
|
|
23603
|
+
}
|
|
23604
|
+
}
|
|
23605
|
+
}
|
|
23606
|
+
}
|
|
23607
|
+
finish() {
|
|
23608
|
+
this.check();
|
|
23609
|
+
if (this.pending || this.padding || this.headerOffset || this.zeroBlocks < 2)
|
|
23610
|
+
invalidBundle("Truncated tar bundle");
|
|
23611
|
+
return this.entries;
|
|
23612
|
+
}
|
|
23613
|
+
readHeader() {
|
|
23614
|
+
this.check();
|
|
23615
|
+
const h = this.header;
|
|
23616
|
+
if (h.every((byte) => byte === 0)) {
|
|
23617
|
+
this.zeroBlocks++;
|
|
23618
|
+
return;
|
|
23619
|
+
}
|
|
23620
|
+
if (this.zeroBlocks)
|
|
23621
|
+
invalidBundle("Nonzero tar data after terminator");
|
|
23622
|
+
if (this.entries.length >= this.limits.entries)
|
|
23623
|
+
throw new SkillBundleInspectionError("BUNDLE_LIMIT", "Bundle entry limit exceeded");
|
|
23624
|
+
let checksum = 0;
|
|
23625
|
+
for (let i = 0;i < BLOCK; i++)
|
|
23626
|
+
checksum += i >= 148 && i < 156 ? 32 : h[i];
|
|
23627
|
+
if (tarOctal(h.subarray(148, 156)) !== checksum)
|
|
23628
|
+
invalidBundle("Invalid tar header checksum");
|
|
23629
|
+
if (new TextDecoder().decode(h.subarray(257, 265)) !== "ustar\x00" + "00")
|
|
23630
|
+
invalidBundle("Unsupported tar format");
|
|
23631
|
+
if (h[156] !== 48 && h[156] !== 0 || h.subarray(157, 257).some((b) => b !== 0) || h.subarray(345).some((b) => b !== 0))
|
|
23632
|
+
invalidBundle("Unsupported tar entry or path prefix");
|
|
23633
|
+
const mode = tarOctal(h.subarray(100, 108));
|
|
23634
|
+
if (mode > 511)
|
|
23635
|
+
invalidBundle("Unsupported tar permission bits");
|
|
23636
|
+
tarOctal(h.subarray(108, 116));
|
|
23637
|
+
tarOctal(h.subarray(116, 124));
|
|
23638
|
+
tarOctal(h.subarray(136, 148));
|
|
23639
|
+
const size = tarOctal(h.subarray(124, 136));
|
|
23640
|
+
if (size > this.limits.fileBytes || this.fileBytes + size > this.limits.decompressedBytes) {
|
|
23641
|
+
throw new SkillBundleInspectionError("BUNDLE_LIMIT", "Bundle file byte limit exceeded");
|
|
23642
|
+
}
|
|
23643
|
+
const name = h.subarray(0, 100);
|
|
23644
|
+
const end = name.indexOf(0);
|
|
23645
|
+
if (end !== -1 && name.subarray(end).some((b) => b !== 0))
|
|
23646
|
+
invalidBundle("Invalid tar path padding");
|
|
23647
|
+
const raw = end === -1 ? name : name.subarray(0, end);
|
|
23648
|
+
if (raw.byteLength > this.limits.pathBytes)
|
|
23649
|
+
throw new SkillBundleInspectionError("BUNDLE_LIMIT", "Bundle path byte limit exceeded");
|
|
23650
|
+
let path;
|
|
23651
|
+
try {
|
|
23652
|
+
path = new TextDecoder("utf-8", { fatal: true, ignoreBOM: true }).decode(raw);
|
|
23653
|
+
} catch {
|
|
23654
|
+
return invalidBundle("Invalid UTF-8 bundle path");
|
|
23655
|
+
}
|
|
23656
|
+
this.paths.add(path, this.limits.pathBytes, invalidBundle, () => {
|
|
23657
|
+
throw new SkillBundleInspectionError("BUNDLE_LIMIT", "Bundle path byte limit exceeded");
|
|
23658
|
+
});
|
|
23659
|
+
this.fileBytes += size;
|
|
23660
|
+
this.pending = { path, mode, bytes: new Uint8Array(new ArrayBuffer(size)) };
|
|
23661
|
+
this.bodyOffset = 0;
|
|
23662
|
+
this.padding = (BLOCK - size % BLOCK) % BLOCK;
|
|
23663
|
+
if (!size) {
|
|
23664
|
+
this.entries.push(this.pending);
|
|
23665
|
+
this.pending = undefined;
|
|
23666
|
+
}
|
|
23667
|
+
}
|
|
23668
|
+
}
|
|
23669
|
+
function tarOctal(field) {
|
|
23670
|
+
const text = new TextDecoder().decode(field);
|
|
23671
|
+
if (!/^[0-7]+[\0 ]*$/.test(text))
|
|
23672
|
+
invalidBundle("Invalid tar octal field");
|
|
23673
|
+
const value = Number.parseInt(text, 8);
|
|
23674
|
+
if (!Number.isSafeInteger(value))
|
|
23675
|
+
invalidBundle("Tar integer is out of range");
|
|
23676
|
+
return value;
|
|
23677
|
+
}
|
|
23678
|
+
|
|
23517
23679
|
// src/lib/skill-bundles.ts
|
|
23518
23680
|
var SIGNATURE_PREFIX = "hmac-sha256:";
|
|
23519
23681
|
function signBundleBytes(bytes, key) {
|
|
@@ -34310,10 +34472,16 @@ class SqliteSkillsStore {
|
|
|
34310
34472
|
const orgId = input.principal.orgId;
|
|
34311
34473
|
const now = nowIso();
|
|
34312
34474
|
return this.db.transaction(() => {
|
|
34313
|
-
const previous = this.get("SELECT revision_id, revision_number, bundle_sha256, bundle_byte_size, skill_md, tombstoned_at FROM skills_registry WHERE org_id = ? AND slug = ?", [orgId, input.slug]);
|
|
34475
|
+
const previous = this.get("SELECT revision_id, revision_number, bundle_sha256, bundle_byte_size, skill_md, tombstoned_at, source FROM skills_registry WHERE org_id = ? AND slug = ?", [orgId, input.slug]);
|
|
34314
34476
|
const previousSha = typeof previous?.bundle_sha256 === "string" ? previous.bundle_sha256 : null;
|
|
34315
34477
|
const previousRevisionId = typeof previous?.revision_id === "string" && previous.revision_id ? previous.revision_id : null;
|
|
34316
34478
|
const tombstoned = previous?.tombstoned_at != null;
|
|
34479
|
+
if (input.seedBundledOnly && input.expectedRevisionId && !previous) {
|
|
34480
|
+
throw new SkillRevisionConflictError(input.slug, input.expectedRevisionId, null);
|
|
34481
|
+
}
|
|
34482
|
+
if (input.seedBundledOnly && previous && (tombstoned || previous.source !== "bundled")) {
|
|
34483
|
+
throw new SkillRevisionConflictError(input.slug, input.expectedRevisionId, previousRevisionId);
|
|
34484
|
+
}
|
|
34317
34485
|
const carriedSkillMd = typeof input.skillMd === "string" ? input.skillMd : typeof previous?.skill_md === "string" ? previous.skill_md : null;
|
|
34318
34486
|
if (previous && !tombstoned && input.expectedRevisionId !== previousRevisionId) {
|
|
34319
34487
|
throw new SkillRevisionConflictError(input.slug, input.expectedRevisionId, previousRevisionId);
|
|
@@ -34387,8 +34555,9 @@ class SqliteSkillsStore {
|
|
|
34387
34555
|
tombstoned_at = NULL,
|
|
34388
34556
|
tombstone_purge_after = NULL,
|
|
34389
34557
|
updated_at = excluded.updated_at
|
|
34390
|
-
WHERE skills_registry.tombstoned_at IS NOT NULL
|
|
34391
|
-
|
|
34558
|
+
WHERE (skills_registry.tombstoned_at IS NOT NULL OR skills_registry.revision_id = ?)
|
|
34559
|
+
AND (? = 0 OR (skills_registry.tombstoned_at IS NULL AND skills_registry.source = 'bundled'
|
|
34560
|
+
AND skills_registry.revision_id = ?))
|
|
34392
34561
|
RETURNING *`, [
|
|
34393
34562
|
orgId,
|
|
34394
34563
|
input.slug,
|
|
@@ -34406,6 +34575,8 @@ class SqliteSkillsStore {
|
|
|
34406
34575
|
revisionId,
|
|
34407
34576
|
now,
|
|
34408
34577
|
now,
|
|
34578
|
+
input.expectedRevisionId ?? NO_REVISION_SENTINEL,
|
|
34579
|
+
input.seedBundledOnly ? 1 : 0,
|
|
34409
34580
|
input.expectedRevisionId ?? NO_REVISION_SENTINEL
|
|
34410
34581
|
]);
|
|
34411
34582
|
if (!row) {
|
|
@@ -36713,6 +36884,12 @@ async function storePublishedSkill(store, artifactStorage, principal, parsed, ex
|
|
|
36713
36884
|
principal,
|
|
36714
36885
|
...expectedRevisionId ? { expectedRevisionId } : {}
|
|
36715
36886
|
};
|
|
36887
|
+
if (input.seedBundledOnly && expectedRevisionId && !current) {
|
|
36888
|
+
throw new SkillRevisionConflictError(input.slug, expectedRevisionId, null);
|
|
36889
|
+
}
|
|
36890
|
+
if (input.seedBundledOnly && current && (current.tombstonedAt || current.source !== "bundled")) {
|
|
36891
|
+
throw new SkillRevisionConflictError(input.slug, expectedRevisionId, current.revisionId);
|
|
36892
|
+
}
|
|
36716
36893
|
if (current && !current.tombstonedAt && expectedRevisionId !== current.revisionId) {
|
|
36717
36894
|
throw new SkillRevisionConflictError(input.slug, expectedRevisionId, current.revisionId);
|
|
36718
36895
|
}
|
|
@@ -36962,6 +37139,15 @@ async function seedBundledCorpus(options) {
|
|
|
36962
37139
|
result.skipped.push(slug);
|
|
36963
37140
|
continue;
|
|
36964
37141
|
}
|
|
37142
|
+
const current = await options.store.getSkill(options.principal, slug);
|
|
37143
|
+
if (current) {
|
|
37144
|
+
const previousVersion = current.version ? await options.store.getSkillVersion(options.principal, slug, current.version) : null;
|
|
37145
|
+
const provenance = previousVersion?.manifest.provenance;
|
|
37146
|
+
if (current.tombstonedAt || current.source !== "bundled" || provenance?.seededFrom !== "bundled-corpus" || provenance.seededRevisionId !== current.revisionId) {
|
|
37147
|
+
result.skipped.push(slug);
|
|
37148
|
+
continue;
|
|
37149
|
+
}
|
|
37150
|
+
}
|
|
36965
37151
|
const dir = getSkillPath(slug);
|
|
36966
37152
|
if (!existsSync11(dir)) {
|
|
36967
37153
|
result.skipped.push(slug);
|
|
@@ -36971,32 +37157,40 @@ async function seedBundledCorpus(options) {
|
|
|
36971
37157
|
const packed = packSkillBundle(dir, { maxUnpackedBytes: 50000000 });
|
|
36972
37158
|
const skillMdPath = join14(dir, "SKILL.md");
|
|
36973
37159
|
const skillMd = existsSync11(skillMdPath) ? readFileSync11(skillMdPath, "utf-8") : undefined;
|
|
36974
|
-
const
|
|
37160
|
+
const content = {
|
|
37161
|
+
slug,
|
|
37162
|
+
displayName: manifest.displayName ?? skill.displayName ?? slug,
|
|
37163
|
+
description: manifest.description ?? skill.description ?? slug,
|
|
37164
|
+
category: manifest.category ?? skill.category ?? "Development Tools",
|
|
37165
|
+
tags: manifest.tags ?? skill.tags ?? [],
|
|
37166
|
+
source: "bundled",
|
|
37167
|
+
kind: manifest.kind ?? "instruction",
|
|
37168
|
+
version: version2,
|
|
37169
|
+
...skillMd ? { skillMd } : {},
|
|
37170
|
+
bundleSha256: packed.sha256,
|
|
37171
|
+
bundleByteSize: packed.bytes.byteLength
|
|
37172
|
+
};
|
|
36975
37173
|
const { record } = await storePublishedSkill(options.store, options.artifactStorage, options.principal, {
|
|
36976
37174
|
input: {
|
|
36977
|
-
|
|
36978
|
-
|
|
36979
|
-
description: manifest.description ?? skill.description ?? slug,
|
|
36980
|
-
category: manifest.category ?? skill.category ?? "Development Tools",
|
|
36981
|
-
tags: manifest.tags ?? skill.tags ?? [],
|
|
36982
|
-
source: "bundled",
|
|
36983
|
-
kind: manifest.kind ?? "instruction",
|
|
36984
|
-
version: version2,
|
|
36985
|
-
...skillMd ? { skillMd } : {},
|
|
37175
|
+
...content,
|
|
37176
|
+
seedBundledOnly: true,
|
|
36986
37177
|
bundle: { sha256: packed.sha256, byteSize: packed.bytes.byteLength, contentType: "application/gzip", storageKind: "db" },
|
|
36987
37178
|
versionManifest: {
|
|
36988
37179
|
files: packed.paths,
|
|
36989
37180
|
fileCount: packed.fileCount,
|
|
36990
37181
|
unpackedByteSize: packed.unpackedByteSize,
|
|
36991
37182
|
bundleSha256: packed.sha256,
|
|
36992
|
-
provenance: { seededFrom: "bundled-corpus", packageVersion: package_default.version }
|
|
37183
|
+
provenance: { seededFrom: "bundled-corpus", packageVersion: package_default.version, seededRevisionId: revisionIdOfRecord(content) }
|
|
36993
37184
|
}
|
|
36994
37185
|
},
|
|
36995
37186
|
bundleBytes: packed.bytes
|
|
36996
37187
|
}, current?.revisionId);
|
|
36997
37188
|
result.seeded.push(`${record.slug}@${version2}`);
|
|
36998
37189
|
} catch (error) {
|
|
36999
|
-
|
|
37190
|
+
if (error instanceof SkillRevisionConflictError)
|
|
37191
|
+
result.skipped.push(slug);
|
|
37192
|
+
else
|
|
37193
|
+
result.failed.push({ slug, error: error.message });
|
|
37000
37194
|
}
|
|
37001
37195
|
}
|
|
37002
37196
|
log(`skills: bundled corpus seed v${version2}: ${result.seeded.length} seeded, ${result.skipped.length} skipped, ${result.failed.length} failed`);
|
|
@@ -37206,6 +37400,12 @@ class MemorySkillsStore {
|
|
|
37206
37400
|
const key = skillKey(input.principal.orgId, input.slug);
|
|
37207
37401
|
const now = nowIso();
|
|
37208
37402
|
const previous = this.skills.get(key);
|
|
37403
|
+
if (input.seedBundledOnly && input.expectedRevisionId && !previous) {
|
|
37404
|
+
throw new SkillRevisionConflictError(input.slug, input.expectedRevisionId, null);
|
|
37405
|
+
}
|
|
37406
|
+
if (input.seedBundledOnly && previous && (previous.tombstonedAt || previous.source !== "bundled")) {
|
|
37407
|
+
throw new SkillRevisionConflictError(input.slug, input.expectedRevisionId, previous.revisionId);
|
|
37408
|
+
}
|
|
37209
37409
|
if (previous && !previous.tombstonedAt && input.expectedRevisionId !== previous.revisionId) {
|
|
37210
37410
|
throw new SkillRevisionConflictError(input.slug, input.expectedRevisionId, previous.revisionId);
|
|
37211
37411
|
}
|
|
@@ -37659,13 +37859,19 @@ class PostgresSkillsStore {
|
|
|
37659
37859
|
const orgId = input.principal.orgId;
|
|
37660
37860
|
return await this.sql.begin(async (tx) => {
|
|
37661
37861
|
const previousRows = await tx`
|
|
37662
|
-
SELECT revision_id, revision_number, bundle_sha256, bundle_byte_size, skill_md, tombstoned_at
|
|
37862
|
+
SELECT revision_id, revision_number, bundle_sha256, bundle_byte_size, skill_md, tombstoned_at, source
|
|
37663
37863
|
FROM skills_registry WHERE org_id = ${orgId} AND slug = ${input.slug} LIMIT 1
|
|
37664
37864
|
`;
|
|
37665
37865
|
const previous = previousRows[0];
|
|
37666
37866
|
const previousSha = typeof previous?.bundle_sha256 === "string" ? String(previous.bundle_sha256) : null;
|
|
37667
37867
|
const previousRevisionId = typeof previous?.revision_id === "string" && previous.revision_id ? String(previous.revision_id) : null;
|
|
37668
37868
|
const tombstoned = previous?.tombstoned_at != null;
|
|
37869
|
+
if (input.seedBundledOnly && input.expectedRevisionId && !previous) {
|
|
37870
|
+
throw new SkillRevisionConflictError(input.slug, input.expectedRevisionId, null);
|
|
37871
|
+
}
|
|
37872
|
+
if (input.seedBundledOnly && previous && (tombstoned || previous.source !== "bundled")) {
|
|
37873
|
+
throw new SkillRevisionConflictError(input.slug, input.expectedRevisionId, previousRevisionId);
|
|
37874
|
+
}
|
|
37669
37875
|
const carriedSkillMd = typeof input.skillMd === "string" ? input.skillMd : typeof previous?.skill_md === "string" ? String(previous.skill_md) : null;
|
|
37670
37876
|
if (previous && !tombstoned && input.expectedRevisionId !== previousRevisionId) {
|
|
37671
37877
|
throw new SkillRevisionConflictError(input.slug, input.expectedRevisionId, previousRevisionId);
|
|
@@ -37706,6 +37912,12 @@ class PostgresSkillsStore {
|
|
|
37706
37912
|
body_blob = EXCLUDED.body_blob
|
|
37707
37913
|
`;
|
|
37708
37914
|
}
|
|
37915
|
+
if (input.seedBundledOnly) {
|
|
37916
|
+
const seedRows = await tx`SELECT revision_id FROM skills_registry WHERE org_id = ${orgId} AND slug = ${input.slug} FOR UPDATE`;
|
|
37917
|
+
if (input.expectedRevisionId && !seedRows[0]) {
|
|
37918
|
+
throw new SkillRevisionConflictError(input.slug, input.expectedRevisionId, null);
|
|
37919
|
+
}
|
|
37920
|
+
}
|
|
37709
37921
|
const rows = await tx`
|
|
37710
37922
|
INSERT INTO skills_registry (org_id, slug, display_name, description, category, tags_json, source, kind, version, skill_md,
|
|
37711
37923
|
bundle_sha256, bundle_byte_size, published_by_user_id, revision_id, revision_number, updated_at)
|
|
@@ -37734,8 +37946,11 @@ class PostgresSkillsStore {
|
|
|
37734
37946
|
tombstoned_at = NULL,
|
|
37735
37947
|
tombstone_purge_after = NULL,
|
|
37736
37948
|
updated_at = EXCLUDED.updated_at
|
|
37737
|
-
WHERE skills_registry.tombstoned_at IS NOT NULL
|
|
37738
|
-
OR skills_registry.revision_id = ${input.expectedRevisionId ?? NO_REVISION_SENTINEL2}
|
|
37949
|
+
WHERE (skills_registry.tombstoned_at IS NOT NULL
|
|
37950
|
+
OR skills_registry.revision_id = ${input.expectedRevisionId ?? NO_REVISION_SENTINEL2})
|
|
37951
|
+
AND (NOT ${Boolean(input.seedBundledOnly)} OR
|
|
37952
|
+
(skills_registry.tombstoned_at IS NULL AND skills_registry.source = 'bundled'
|
|
37953
|
+
AND skills_registry.revision_id = ${input.expectedRevisionId ?? NO_REVISION_SENTINEL2}))
|
|
37739
37954
|
RETURNING *
|
|
37740
37955
|
`;
|
|
37741
37956
|
if (!rows[0]) {
|
|
@@ -38150,6 +38365,15 @@ async function createSkillsFetchHandler(options = {}) {
|
|
|
38150
38365
|
}
|
|
38151
38366
|
return async function fetch(request) {
|
|
38152
38367
|
const url = new URL(request.url);
|
|
38368
|
+
const versionedAliases = {
|
|
38369
|
+
"/v1/health": "/health",
|
|
38370
|
+
"/v1/auth/whoami": "/api/auth/whoami"
|
|
38371
|
+
};
|
|
38372
|
+
const alias = versionedAliases[url.pathname] ?? (url.pathname === "/v1" || url.pathname.startsWith("/v1/") ? `/api${url.pathname}` : undefined);
|
|
38373
|
+
if (alias) {
|
|
38374
|
+
url.pathname = alias;
|
|
38375
|
+
request = new Request(url, request);
|
|
38376
|
+
}
|
|
38153
38377
|
const segments = pathSegments(url.pathname);
|
|
38154
38378
|
try {
|
|
38155
38379
|
if (request.method === "GET" && url.pathname === "/health") {
|