@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/bin/worker.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
- if (mod && typeof mod === "object" || typeof mod === "function") {
24
- for (let key of __getOwnPropNames(mod))
25
- if (!__hasOwnProp.call(to, key))
26
- __defProp(to, key, {
27
- get: __accessProp.bind(mod, key),
28
- enumerable: true
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(function(exports) {
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(function(exports) {
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(function(exports) {
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(function(exports) {
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(function(exports) {
2064
+ var require_config = __commonJS((exports) => {
2067
2065
  var { homedir } = __require("os");
2068
2066
  var { sep, join } = __require("path");
2069
2067
  var { createHash } = __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(function(exports) {
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(function(exports) {
3573
+ var require_serde = __commonJS((exports) => {
3576
3574
  var { createHmac, createHash, 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(function(exports) {
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();
@@ -5458,7 +5456,7 @@ var require_checksum = __commonJS(function(exports) {
5458
5456
  }
5459
5457
  };
5460
5458
  }
5461
- var BLOCK = 64;
5459
+ var BLOCK2 = 64;
5462
5460
  var DIGEST_LENGTH = 32;
5463
5461
  var MAX_HASHABLE_LENGTH = 2 ** 53 - 1;
5464
5462
 
@@ -5478,13 +5476,13 @@ var require_checksum = __commonJS(function(exports) {
5478
5476
  this.inner = new Sha256Js;
5479
5477
  this.outer = new Sha256Js;
5480
5478
  const { inner, outer } = this;
5481
- const pad = new Uint8Array(BLOCK * 2);
5482
- for (let i = 0;i < BLOCK; ++i) {
5479
+ const pad = new Uint8Array(BLOCK2 * 2);
5480
+ for (let i = 0;i < BLOCK2; ++i) {
5483
5481
  pad[i] = 54 ^ key[i];
5484
- pad[i + BLOCK] = 92 ^ key[i];
5482
+ pad[i + BLOCK2] = 92 ^ key[i];
5485
5483
  }
5486
- inner.update(pad.subarray(0, BLOCK));
5487
- outer.update(pad.subarray(BLOCK));
5484
+ inner.update(pad.subarray(0, BLOCK2));
5485
+ outer.update(pad.subarray(BLOCK2));
5488
5486
  }
5489
5487
  }
5490
5488
  update(data) {
@@ -5505,7 +5503,7 @@ var require_checksum = __commonJS(function(exports) {
5505
5503
  while (byteLength > 0) {
5506
5504
  this.buffer[this.bufferLength++] = chunk[position++];
5507
5505
  byteLength--;
5508
- if (this.bufferLength === BLOCK) {
5506
+ if (this.bufferLength === BLOCK2) {
5509
5507
  this.hashBuffer();
5510
5508
  this.bufferLength = 0;
5511
5509
  }
@@ -5537,18 +5535,18 @@ var require_checksum = __commonJS(function(exports) {
5537
5535
  const bitsHashed = this.bytesHashed * 8;
5538
5536
  const bufferView = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength);
5539
5537
  bufferView.setUint8(bufferLength++, 128);
5540
- if ((bufferLength - 1) % BLOCK >= BLOCK - 8) {
5541
- for (let i = bufferLength;i < BLOCK; ++i) {
5538
+ if ((bufferLength - 1) % BLOCK2 >= BLOCK2 - 8) {
5539
+ for (let i = bufferLength;i < BLOCK2; ++i) {
5542
5540
  bufferView.setUint8(i, 0);
5543
5541
  }
5544
5542
  this.hashBufferWith(state, buffer);
5545
5543
  bufferLength = 0;
5546
5544
  }
5547
- for (let i = bufferLength;i < BLOCK - 8; ++i) {
5545
+ for (let i = bufferLength;i < BLOCK2 - 8; ++i) {
5548
5546
  bufferView.setUint8(i, 0);
5549
5547
  }
5550
- bufferView.setUint32(BLOCK - 8, Math.floor(bitsHashed / 4294967296), false);
5551
- bufferView.setUint32(BLOCK - 4, bitsHashed, false);
5548
+ bufferView.setUint32(BLOCK2 - 8, Math.floor(bitsHashed / 4294967296), false);
5549
+ bufferView.setUint32(BLOCK2 - 4, bitsHashed, false);
5552
5550
  this.hashBufferWith(state, buffer);
5553
5551
  const out = new Uint8Array(DIGEST_LENGTH);
5554
5552
  for (let i = 0;i < 8; ++i) {
@@ -5561,16 +5559,16 @@ var require_checksum = __commonJS(function(exports) {
5561
5559
  }
5562
5560
  static normalizeKey(secret) {
5563
5561
  const key = toUint8Array(secret);
5564
- if (key.byteLength > BLOCK) {
5562
+ if (key.byteLength > BLOCK2) {
5565
5563
  const h = new Sha256Js;
5566
5564
  h.update(key);
5567
5565
  const out = h.digestSync();
5568
- const padded = new Uint8Array(BLOCK);
5566
+ const padded = new Uint8Array(BLOCK2);
5569
5567
  padded.set(out);
5570
5568
  return padded;
5571
5569
  }
5572
- if (key.byteLength < BLOCK) {
5573
- const padded = new Uint8Array(BLOCK);
5570
+ if (key.byteLength < BLOCK2) {
5571
+ const padded = new Uint8Array(BLOCK2);
5574
5572
  padded.set(key);
5575
5573
  return padded;
5576
5574
  }
@@ -5582,7 +5580,7 @@ var require_checksum = __commonJS(function(exports) {
5582
5580
  hashBufferWith(state, buffer) {
5583
5581
  const w = this.w ??= new Int32Array(64);
5584
5582
  let s0 = state[0], s1 = state[1], s2 = state[2], s3 = state[3], s4 = state[4], s5 = state[5], s6 = state[6], s7 = state[7];
5585
- for (let i = 0;i < BLOCK; ++i) {
5583
+ for (let i = 0;i < BLOCK2; ++i) {
5586
5584
  if (i < 16) {
5587
5585
  w[i] = (buffer[i * 4] & 255) << 24 | (buffer[i * 4 + 1] & 255) << 16 | (buffer[i * 4 + 2] & 255) << 8 | buffer[i * 4 + 3] & 255;
5588
5586
  } else {
@@ -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(function(exports) {
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(function(exports) {
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(function(exports) {
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(function(exports) {
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(function(exports) {
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(function(exports, module) {
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(function(exports) {
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(function(exports) {
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(function(exports) {
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(function(exports) {
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(function(exports) {
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(function(exports) {
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(function(exports) {
14110
+ var require_dist_cjs5 = __commonJS((exports) => {
14113
14111
  var ATTR_ESCAPE_RE = /[&<>"]/g;
14114
14112
  var ATTR_ESCAPE_MAP = {
14115
14113
  "&": "&amp;",
@@ -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(function(exports) {
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(function(exports) {
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
- ENV_ACCOUNT_ID: () => ENV_ACCOUNT_ID,
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
- fromEnv: () => fromEnv
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
- DEFAULT_MAX_RETRIES: () => DEFAULT_MAX_RETRIES,
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
- providerConfigFromInit: () => providerConfigFromInit
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(function(exports) {
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(function(exports) {
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
- GetRoleCredentialsCommand: () => $GetRoleCredentialsCommand,
20452
- SSOClient: () => $SSOClient
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
- fromSSO: () => fromSSO,
20643
+ validateSsoProfile: () => validateSsoProfile,
20646
20644
  isSsoProfile: () => isSsoProfile,
20647
- validateSsoProfile: () => validateSsoProfile
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(function(exports) {
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(function(exports) {
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
- fromTokenFile: () => fromTokenFile,
23020
- fromWebToken: () => fromWebToken
23017
+ fromWebToken: () => fromWebToken,
23018
+ fromTokenFile: () => fromTokenFile
23021
23019
  });
23022
23020
  var init_dist_es8 = __esm(() => {
23023
23021
  init_fromTokenFile();
@@ -23105,7 +23103,7 @@ import { randomUUID as randomUUID4 } from "crypto";
23105
23103
  // package.json
23106
23104
  var package_default = {
23107
23105
  name: "@hasna/skills",
23108
- version: "0.5.4",
23106
+ version: "0.5.5",
23109
23107
  description: "Skills library for AI coding agents",
23110
23108
  type: "module",
23111
23109
  bin: {
@@ -23227,7 +23225,40 @@ var package_default = {
23227
23225
  }
23228
23226
  };
23229
23227
 
23228
+ // src/lib/skill-entry-path.ts
23229
+ class SkillEntryPaths {
23230
+ files = new Set;
23231
+ directories = new Set;
23232
+ add(path, maxBytes, invalid, limit) {
23233
+ if (path.length > maxBytes)
23234
+ limit();
23235
+ const encoded = new TextEncoder().encode(path);
23236
+ if (encoded.byteLength > maxBytes)
23237
+ limit();
23238
+ if (new TextDecoder("utf-8", { fatal: true, ignoreBOM: true }).decode(encoded) !== path)
23239
+ invalid("Invalid UTF-8 entry path");
23240
+ if (!path || /[\\:\x00-\x1f\x7f]/u.test(path))
23241
+ invalid("Unsafe entry path");
23242
+ if (path.split("/").some((segment) => !segment || segment === "." || segment === ".."))
23243
+ invalid("Unsafe entry path segment");
23244
+ const key = path.normalize("NFC").toLowerCase().normalize("NFC");
23245
+ if (this.files.has(key) || this.directories.has(key))
23246
+ invalid("Duplicate or conflicting entry path");
23247
+ const parents = key.split("/");
23248
+ parents.pop();
23249
+ while (parents.length) {
23250
+ const parent = parents.join("/");
23251
+ if (this.files.has(parent))
23252
+ invalid("Conflicting entry file ancestor");
23253
+ this.directories.add(parent);
23254
+ parents.pop();
23255
+ }
23256
+ this.files.add(key);
23257
+ }
23258
+ }
23259
+
23230
23260
  // src/lib/skill-bundle.ts
23261
+ var BLOCK = 512;
23231
23262
  var ANY_SEGMENT_EXCLUDES = new Set([
23232
23263
  ".git",
23233
23264
  ".ds_store",
@@ -23364,6 +23395,136 @@ var SKILL_BUNDLE_INSPECTION_LIMITS = Object.freeze({
23364
23395
  timeoutMs: 5000
23365
23396
  });
23366
23397
 
23398
+ class SkillBundleInspectionError extends Error {
23399
+ code;
23400
+ constructor(code, message) {
23401
+ super(message);
23402
+ this.code = code;
23403
+ this.name = "SkillBundleInspectionError";
23404
+ }
23405
+ }
23406
+ function invalidBundle(message) {
23407
+ throw new SkillBundleInspectionError("BUNDLE_INVALID", message);
23408
+ }
23409
+ class BoundedTarReader {
23410
+ limits;
23411
+ check;
23412
+ header = new Uint8Array(BLOCK);
23413
+ headerOffset = 0;
23414
+ pending;
23415
+ bodyOffset = 0;
23416
+ padding = 0;
23417
+ zeroBlocks = 0;
23418
+ entries = [];
23419
+ paths = new SkillEntryPaths;
23420
+ fileBytes = 0;
23421
+ constructor(limits, check) {
23422
+ this.limits = limits;
23423
+ this.check = check;
23424
+ }
23425
+ push(chunk) {
23426
+ let offset = 0;
23427
+ while (offset < chunk.byteLength) {
23428
+ this.check();
23429
+ if (this.pending) {
23430
+ const count = Math.min(this.pending.bytes.byteLength - this.bodyOffset, chunk.byteLength - offset);
23431
+ this.pending.bytes.set(chunk.subarray(offset, offset + count), this.bodyOffset);
23432
+ offset += count;
23433
+ this.bodyOffset += count;
23434
+ if (this.bodyOffset === this.pending.bytes.byteLength) {
23435
+ this.entries.push(this.pending);
23436
+ this.pending = undefined;
23437
+ }
23438
+ } else if (this.padding) {
23439
+ const count = Math.min(this.padding, chunk.byteLength - offset);
23440
+ if (chunk.subarray(offset, offset + count).some((byte) => byte !== 0))
23441
+ invalidBundle("Nonzero tar body padding");
23442
+ offset += count;
23443
+ this.padding -= count;
23444
+ } else {
23445
+ const count = Math.min(BLOCK - this.headerOffset, chunk.byteLength - offset);
23446
+ this.header.set(chunk.subarray(offset, offset + count), this.headerOffset);
23447
+ offset += count;
23448
+ this.headerOffset += count;
23449
+ if (this.headerOffset === BLOCK) {
23450
+ this.readHeader();
23451
+ this.headerOffset = 0;
23452
+ }
23453
+ }
23454
+ }
23455
+ }
23456
+ finish() {
23457
+ this.check();
23458
+ if (this.pending || this.padding || this.headerOffset || this.zeroBlocks < 2)
23459
+ invalidBundle("Truncated tar bundle");
23460
+ return this.entries;
23461
+ }
23462
+ readHeader() {
23463
+ this.check();
23464
+ const h = this.header;
23465
+ if (h.every((byte) => byte === 0)) {
23466
+ this.zeroBlocks++;
23467
+ return;
23468
+ }
23469
+ if (this.zeroBlocks)
23470
+ invalidBundle("Nonzero tar data after terminator");
23471
+ if (this.entries.length >= this.limits.entries)
23472
+ throw new SkillBundleInspectionError("BUNDLE_LIMIT", "Bundle entry limit exceeded");
23473
+ let checksum = 0;
23474
+ for (let i = 0;i < BLOCK; i++)
23475
+ checksum += i >= 148 && i < 156 ? 32 : h[i];
23476
+ if (tarOctal(h.subarray(148, 156)) !== checksum)
23477
+ invalidBundle("Invalid tar header checksum");
23478
+ if (new TextDecoder().decode(h.subarray(257, 265)) !== "ustar\x00" + "00")
23479
+ invalidBundle("Unsupported tar format");
23480
+ if (h[156] !== 48 && h[156] !== 0 || h.subarray(157, 257).some((b) => b !== 0) || h.subarray(345).some((b) => b !== 0))
23481
+ invalidBundle("Unsupported tar entry or path prefix");
23482
+ const mode = tarOctal(h.subarray(100, 108));
23483
+ if (mode > 511)
23484
+ invalidBundle("Unsupported tar permission bits");
23485
+ tarOctal(h.subarray(108, 116));
23486
+ tarOctal(h.subarray(116, 124));
23487
+ tarOctal(h.subarray(136, 148));
23488
+ const size = tarOctal(h.subarray(124, 136));
23489
+ if (size > this.limits.fileBytes || this.fileBytes + size > this.limits.decompressedBytes) {
23490
+ throw new SkillBundleInspectionError("BUNDLE_LIMIT", "Bundle file byte limit exceeded");
23491
+ }
23492
+ const name = h.subarray(0, 100);
23493
+ const end = name.indexOf(0);
23494
+ if (end !== -1 && name.subarray(end).some((b) => b !== 0))
23495
+ invalidBundle("Invalid tar path padding");
23496
+ const raw = end === -1 ? name : name.subarray(0, end);
23497
+ if (raw.byteLength > this.limits.pathBytes)
23498
+ throw new SkillBundleInspectionError("BUNDLE_LIMIT", "Bundle path byte limit exceeded");
23499
+ let path;
23500
+ try {
23501
+ path = new TextDecoder("utf-8", { fatal: true, ignoreBOM: true }).decode(raw);
23502
+ } catch {
23503
+ return invalidBundle("Invalid UTF-8 bundle path");
23504
+ }
23505
+ this.paths.add(path, this.limits.pathBytes, invalidBundle, () => {
23506
+ throw new SkillBundleInspectionError("BUNDLE_LIMIT", "Bundle path byte limit exceeded");
23507
+ });
23508
+ this.fileBytes += size;
23509
+ this.pending = { path, mode, bytes: new Uint8Array(new ArrayBuffer(size)) };
23510
+ this.bodyOffset = 0;
23511
+ this.padding = (BLOCK - size % BLOCK) % BLOCK;
23512
+ if (!size) {
23513
+ this.entries.push(this.pending);
23514
+ this.pending = undefined;
23515
+ }
23516
+ }
23517
+ }
23518
+ function tarOctal(field) {
23519
+ const text = new TextDecoder().decode(field);
23520
+ if (!/^[0-7]+[\0 ]*$/.test(text))
23521
+ invalidBundle("Invalid tar octal field");
23522
+ const value = Number.parseInt(text, 8);
23523
+ if (!Number.isSafeInteger(value))
23524
+ invalidBundle("Tar integer is out of range");
23525
+ return value;
23526
+ }
23527
+
23367
23528
  // ../../node_modules/.bun/@aws-sdk+checksums@3.1000.29/node_modules/@aws-sdk/checksums/dist-cjs/submodules/flexible-checksums/index.js
23368
23529
  var { setFeature } = require_client2();
23369
23530
  var { HttpRequest } = require_protocols();
@@ -32535,7 +32696,7 @@ var import_node_http_handler2 = __toESM(require_dist_cjs6(), 1);
32535
32696
  var { toUint8Array: toUint8Array2, concatBytes } = require_serde();
32536
32697
  var { createHmac, createHash: createHash2 } = __require("crypto");
32537
32698
  var { Sha256: Sha2562, Sha256Js, Sha256Node } = require_checksum();
32538
- var BLOCK = 64;
32699
+ var BLOCK2 = 64;
32539
32700
  var DIGEST_LENGTH = 20;
32540
32701
  var INIT = new Int32Array([1732584193, 4023233417, 2562383102, 271733878, 3285377520]);
32541
32702
  var K2 = new Int32Array([1518500249, 1859775393, 2400959708, 3395469782]);
@@ -32544,7 +32705,7 @@ class Sha1Js {
32544
32705
  digestLength = DIGEST_LENGTH;
32545
32706
  state = Int32Array.from(INIT);
32546
32707
  w;
32547
- buffer = new Uint8Array(BLOCK);
32708
+ buffer = new Uint8Array(BLOCK2);
32548
32709
  bufferLength = 0;
32549
32710
  bytesHashed = 0;
32550
32711
  finished = false;
@@ -32555,13 +32716,13 @@ class Sha1Js {
32555
32716
  const key = Sha1Js.normalizeKey(secret);
32556
32717
  this.inner = new Sha1Js;
32557
32718
  this.outer = new Sha1Js;
32558
- const pad = new Uint8Array(BLOCK * 2);
32559
- for (let i3 = 0;i3 < BLOCK; ++i3) {
32719
+ const pad = new Uint8Array(BLOCK2 * 2);
32720
+ for (let i3 = 0;i3 < BLOCK2; ++i3) {
32560
32721
  pad[i3] = 54 ^ key[i3];
32561
- pad[i3 + BLOCK] = 92 ^ key[i3];
32722
+ pad[i3 + BLOCK2] = 92 ^ key[i3];
32562
32723
  }
32563
- this.inner.update(pad.subarray(0, BLOCK));
32564
- this.outer.update(pad.subarray(BLOCK));
32724
+ this.inner.update(pad.subarray(0, BLOCK2));
32725
+ this.outer.update(pad.subarray(BLOCK2));
32565
32726
  }
32566
32727
  }
32567
32728
  update(data) {
@@ -32576,19 +32737,19 @@ class Sha1Js {
32576
32737
  let { length } = data;
32577
32738
  this.bytesHashed += length;
32578
32739
  if (this.bufferLength > 0) {
32579
- while (length > 0 && this.bufferLength < BLOCK) {
32740
+ while (length > 0 && this.bufferLength < BLOCK2) {
32580
32741
  this.buffer[this.bufferLength++] = data[pos++];
32581
32742
  --length;
32582
32743
  }
32583
- if (this.bufferLength === BLOCK) {
32744
+ if (this.bufferLength === BLOCK2) {
32584
32745
  this.hashBuffer(this.buffer, 0);
32585
32746
  this.bufferLength = 0;
32586
32747
  }
32587
32748
  }
32588
- while (length >= BLOCK) {
32749
+ while (length >= BLOCK2) {
32589
32750
  this.hashBuffer(data, pos);
32590
- pos += BLOCK;
32591
- length -= BLOCK;
32751
+ pos += BLOCK2;
32752
+ length -= BLOCK2;
32592
32753
  }
32593
32754
  while (length > 0) {
32594
32755
  this.buffer[this.bufferLength++] = data[pos++];
@@ -32609,7 +32770,7 @@ class Sha1Js {
32609
32770
  }
32610
32771
  reset() {
32611
32772
  this.state = Int32Array.from(INIT);
32612
- this.buffer = new Uint8Array(BLOCK);
32773
+ this.buffer = new Uint8Array(BLOCK2);
32613
32774
  this.bufferLength = 0;
32614
32775
  this.bytesHashed = 0;
32615
32776
  }
@@ -32620,19 +32781,19 @@ class Sha1Js {
32620
32781
  const bitsHi = this.bytesHashed / 536870912 | 0;
32621
32782
  const bitsLo = this.bytesHashed << 3;
32622
32783
  buffer[bufferLength++] = 128;
32623
- if (bufferLength > BLOCK - 8) {
32624
- for (let i3 = bufferLength;i3 < BLOCK; ++i3) {
32784
+ if (bufferLength > BLOCK2 - 8) {
32785
+ for (let i3 = bufferLength;i3 < BLOCK2; ++i3) {
32625
32786
  buffer[i3] = 0;
32626
32787
  }
32627
32788
  this.hashBufferWith(state, buffer, 0);
32628
32789
  bufferLength = 0;
32629
32790
  }
32630
- for (let i3 = bufferLength;i3 < BLOCK - 8; ++i3) {
32791
+ for (let i3 = bufferLength;i3 < BLOCK2 - 8; ++i3) {
32631
32792
  buffer[i3] = 0;
32632
32793
  }
32633
- const v2 = new DataView(buffer.buffer, buffer.byteOffset, BLOCK);
32634
- v2.setUint32(BLOCK - 8, bitsHi, false);
32635
- v2.setUint32(BLOCK - 4, bitsLo, false);
32794
+ const v2 = new DataView(buffer.buffer, buffer.byteOffset, BLOCK2);
32795
+ v2.setUint32(BLOCK2 - 8, bitsHi, false);
32796
+ v2.setUint32(BLOCK2 - 4, bitsLo, false);
32636
32797
  this.hashBufferWith(state, buffer, 0);
32637
32798
  const out = new Uint8Array(DIGEST_LENGTH);
32638
32799
  out[0] = state[0] >>> 24 & 255;
@@ -32659,15 +32820,15 @@ class Sha1Js {
32659
32820
  }
32660
32821
  static normalizeKey(secret) {
32661
32822
  const key = toUint8Array2(secret);
32662
- if (key.byteLength > BLOCK) {
32823
+ if (key.byteLength > BLOCK2) {
32663
32824
  const h3 = new Sha1Js;
32664
32825
  h3.update(key);
32665
32826
  const digest = h3.digestSync();
32666
- const padded2 = new Uint8Array(BLOCK);
32827
+ const padded2 = new Uint8Array(BLOCK2);
32667
32828
  padded2.set(digest);
32668
32829
  return padded2;
32669
32830
  }
32670
- const padded = new Uint8Array(BLOCK);
32831
+ const padded = new Uint8Array(BLOCK2);
32671
32832
  padded.set(key);
32672
32833
  return padded;
32673
32834
  }
@@ -33967,10 +34128,16 @@ class SqliteSkillsStore {
33967
34128
  const orgId = input.principal.orgId;
33968
34129
  const now = nowIso();
33969
34130
  return this.db.transaction(() => {
33970
- 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]);
34131
+ 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]);
33971
34132
  const previousSha = typeof previous?.bundle_sha256 === "string" ? previous.bundle_sha256 : null;
33972
34133
  const previousRevisionId = typeof previous?.revision_id === "string" && previous.revision_id ? previous.revision_id : null;
33973
34134
  const tombstoned = previous?.tombstoned_at != null;
34135
+ if (input.seedBundledOnly && input.expectedRevisionId && !previous) {
34136
+ throw new SkillRevisionConflictError(input.slug, input.expectedRevisionId, null);
34137
+ }
34138
+ if (input.seedBundledOnly && previous && (tombstoned || previous.source !== "bundled")) {
34139
+ throw new SkillRevisionConflictError(input.slug, input.expectedRevisionId, previousRevisionId);
34140
+ }
33974
34141
  const carriedSkillMd = typeof input.skillMd === "string" ? input.skillMd : typeof previous?.skill_md === "string" ? previous.skill_md : null;
33975
34142
  if (previous && !tombstoned && input.expectedRevisionId !== previousRevisionId) {
33976
34143
  throw new SkillRevisionConflictError(input.slug, input.expectedRevisionId, previousRevisionId);
@@ -34044,8 +34211,9 @@ class SqliteSkillsStore {
34044
34211
  tombstoned_at = NULL,
34045
34212
  tombstone_purge_after = NULL,
34046
34213
  updated_at = excluded.updated_at
34047
- WHERE skills_registry.tombstoned_at IS NOT NULL
34048
- OR skills_registry.revision_id = ?
34214
+ WHERE (skills_registry.tombstoned_at IS NOT NULL OR skills_registry.revision_id = ?)
34215
+ AND (? = 0 OR (skills_registry.tombstoned_at IS NULL AND skills_registry.source = 'bundled'
34216
+ AND skills_registry.revision_id = ?))
34049
34217
  RETURNING *`, [
34050
34218
  orgId,
34051
34219
  input.slug,
@@ -34063,6 +34231,8 @@ class SqliteSkillsStore {
34063
34231
  revisionId,
34064
34232
  now,
34065
34233
  now,
34234
+ input.expectedRevisionId ?? NO_REVISION_SENTINEL,
34235
+ input.seedBundledOnly ? 1 : 0,
34066
34236
  input.expectedRevisionId ?? NO_REVISION_SENTINEL
34067
34237
  ]);
34068
34238
  if (!row) {
@@ -35354,6 +35524,12 @@ class MemorySkillsStore {
35354
35524
  const key = skillKey(input.principal.orgId, input.slug);
35355
35525
  const now = nowIso();
35356
35526
  const previous = this.skills.get(key);
35527
+ if (input.seedBundledOnly && input.expectedRevisionId && !previous) {
35528
+ throw new SkillRevisionConflictError(input.slug, input.expectedRevisionId, null);
35529
+ }
35530
+ if (input.seedBundledOnly && previous && (previous.tombstonedAt || previous.source !== "bundled")) {
35531
+ throw new SkillRevisionConflictError(input.slug, input.expectedRevisionId, previous.revisionId);
35532
+ }
35357
35533
  if (previous && !previous.tombstonedAt && input.expectedRevisionId !== previous.revisionId) {
35358
35534
  throw new SkillRevisionConflictError(input.slug, input.expectedRevisionId, previous.revisionId);
35359
35535
  }
@@ -35807,13 +35983,19 @@ class PostgresSkillsStore {
35807
35983
  const orgId = input.principal.orgId;
35808
35984
  return await this.sql.begin(async (tx) => {
35809
35985
  const previousRows = await tx`
35810
- SELECT revision_id, revision_number, bundle_sha256, bundle_byte_size, skill_md, tombstoned_at
35986
+ SELECT revision_id, revision_number, bundle_sha256, bundle_byte_size, skill_md, tombstoned_at, source
35811
35987
  FROM skills_registry WHERE org_id = ${orgId} AND slug = ${input.slug} LIMIT 1
35812
35988
  `;
35813
35989
  const previous = previousRows[0];
35814
35990
  const previousSha = typeof previous?.bundle_sha256 === "string" ? String(previous.bundle_sha256) : null;
35815
35991
  const previousRevisionId = typeof previous?.revision_id === "string" && previous.revision_id ? String(previous.revision_id) : null;
35816
35992
  const tombstoned = previous?.tombstoned_at != null;
35993
+ if (input.seedBundledOnly && input.expectedRevisionId && !previous) {
35994
+ throw new SkillRevisionConflictError(input.slug, input.expectedRevisionId, null);
35995
+ }
35996
+ if (input.seedBundledOnly && previous && (tombstoned || previous.source !== "bundled")) {
35997
+ throw new SkillRevisionConflictError(input.slug, input.expectedRevisionId, previousRevisionId);
35998
+ }
35817
35999
  const carriedSkillMd = typeof input.skillMd === "string" ? input.skillMd : typeof previous?.skill_md === "string" ? String(previous.skill_md) : null;
35818
36000
  if (previous && !tombstoned && input.expectedRevisionId !== previousRevisionId) {
35819
36001
  throw new SkillRevisionConflictError(input.slug, input.expectedRevisionId, previousRevisionId);
@@ -35854,6 +36036,12 @@ class PostgresSkillsStore {
35854
36036
  body_blob = EXCLUDED.body_blob
35855
36037
  `;
35856
36038
  }
36039
+ if (input.seedBundledOnly) {
36040
+ const seedRows = await tx`SELECT revision_id FROM skills_registry WHERE org_id = ${orgId} AND slug = ${input.slug} FOR UPDATE`;
36041
+ if (input.expectedRevisionId && !seedRows[0]) {
36042
+ throw new SkillRevisionConflictError(input.slug, input.expectedRevisionId, null);
36043
+ }
36044
+ }
35857
36045
  const rows = await tx`
35858
36046
  INSERT INTO skills_registry (org_id, slug, display_name, description, category, tags_json, source, kind, version, skill_md,
35859
36047
  bundle_sha256, bundle_byte_size, published_by_user_id, revision_id, revision_number, updated_at)
@@ -35882,8 +36070,11 @@ class PostgresSkillsStore {
35882
36070
  tombstoned_at = NULL,
35883
36071
  tombstone_purge_after = NULL,
35884
36072
  updated_at = EXCLUDED.updated_at
35885
- WHERE skills_registry.tombstoned_at IS NOT NULL
35886
- OR skills_registry.revision_id = ${input.expectedRevisionId ?? NO_REVISION_SENTINEL2}
36073
+ WHERE (skills_registry.tombstoned_at IS NOT NULL
36074
+ OR skills_registry.revision_id = ${input.expectedRevisionId ?? NO_REVISION_SENTINEL2})
36075
+ AND (NOT ${Boolean(input.seedBundledOnly)} OR
36076
+ (skills_registry.tombstoned_at IS NULL AND skills_registry.source = 'bundled'
36077
+ AND skills_registry.revision_id = ${input.expectedRevisionId ?? NO_REVISION_SENTINEL2}))
35887
36078
  RETURNING *
35888
36079
  `;
35889
36080
  if (!rows[0]) {