@stacksjs/ai 0.58.28 → 0.58.44

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.
Files changed (2) hide show
  1. package/dist/index.js +200 -480
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -1533,7 +1533,7 @@ var require_constants = __commonJS((exports) => {
1533
1533
  });
1534
1534
 
1535
1535
  // /home/runner/work/stacks/stacks/node_modules/@aws-sdk/util-locate-window/dist-cjs/index.js
1536
- var require_dist_cjs2 = __commonJS((exports) => {
1536
+ var require_dist_cjs2 = __commonJS((exports, module) => {
1537
1537
  var locateWindow = function() {
1538
1538
  if (typeof window !== "undefined") {
1539
1539
  return window;
@@ -1542,10 +1542,31 @@ var require_dist_cjs2 = __commonJS((exports) => {
1542
1542
  }
1543
1543
  return fallbackWindow;
1544
1544
  };
1545
- Object.defineProperty(exports, "__esModule", { value: true });
1546
- exports.locateWindow = undefined;
1545
+ var __defProp2 = Object.defineProperty;
1546
+ var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
1547
+ var __getOwnPropNames2 = Object.getOwnPropertyNames;
1548
+ var __hasOwnProp2 = Object.prototype.hasOwnProperty;
1549
+ var __name = (target, value) => __defProp2(target, "name", { value, configurable: true });
1550
+ var __export2 = (target, all) => {
1551
+ for (var name in all)
1552
+ __defProp2(target, name, { get: all[name], enumerable: true });
1553
+ };
1554
+ var __copyProps = (to, from, except, desc) => {
1555
+ if (from && typeof from === "object" || typeof from === "function") {
1556
+ for (let key of __getOwnPropNames2(from))
1557
+ if (!__hasOwnProp2.call(to, key) && key !== except)
1558
+ __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
1559
+ }
1560
+ return to;
1561
+ };
1562
+ var __toCommonJS2 = (mod) => __copyProps(__defProp2({}, "__esModule", { value: true }), mod);
1563
+ var src_exports = {};
1564
+ __export2(src_exports, {
1565
+ locateWindow: () => locateWindow
1566
+ });
1567
+ module.exports = __toCommonJS2(src_exports);
1547
1568
  var fallbackWindow = {};
1548
- exports.locateWindow = locateWindow;
1569
+ __name(locateWindow, "locateWindow");
1549
1570
  });
1550
1571
 
1551
1572
  // /home/runner/work/stacks/stacks/node_modules/@aws-crypto/sha256-browser/build/ie11Sha256.js
@@ -4746,10 +4767,96 @@ var UUID_PATTERN = /^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12
4746
4767
 
4747
4768
  // /home/runner/work/stacks/stacks/node_modules/@smithy/eventstream-codec/dist-es/splitMessage.js
4748
4769
  var crc32 = __toESM(require_build2(), 1);
4770
+ function splitMessage({ byteLength, byteOffset, buffer }) {
4771
+ if (byteLength < MINIMUM_MESSAGE_LENGTH) {
4772
+ throw new Error("Provided message too short to accommodate event stream message overhead");
4773
+ }
4774
+ const view = new DataView(buffer, byteOffset, byteLength);
4775
+ const messageLength = view.getUint32(0, false);
4776
+ if (byteLength !== messageLength) {
4777
+ throw new Error("Reported message length does not match received message length");
4778
+ }
4779
+ const headerLength = view.getUint32(PRELUDE_MEMBER_LENGTH, false);
4780
+ const expectedPreludeChecksum = view.getUint32(PRELUDE_LENGTH, false);
4781
+ const expectedMessageChecksum = view.getUint32(byteLength - CHECKSUM_LENGTH, false);
4782
+ const checksummer = new crc32.Crc32().update(new Uint8Array(buffer, byteOffset, PRELUDE_LENGTH));
4783
+ if (expectedPreludeChecksum !== checksummer.digest()) {
4784
+ throw new Error(`The prelude checksum specified in the message (${expectedPreludeChecksum}) does not match the calculated CRC32 checksum (${checksummer.digest()})`);
4785
+ }
4786
+ checksummer.update(new Uint8Array(buffer, byteOffset + PRELUDE_LENGTH, byteLength - (PRELUDE_LENGTH + CHECKSUM_LENGTH)));
4787
+ if (expectedMessageChecksum !== checksummer.digest()) {
4788
+ throw new Error(`The message checksum (${checksummer.digest()}) did not match the expected value of ${expectedMessageChecksum}`);
4789
+ }
4790
+ return {
4791
+ headers: new DataView(buffer, byteOffset + PRELUDE_LENGTH + CHECKSUM_LENGTH, headerLength),
4792
+ body: new Uint8Array(buffer, byteOffset + PRELUDE_LENGTH + CHECKSUM_LENGTH + headerLength, messageLength - headerLength - (PRELUDE_LENGTH + CHECKSUM_LENGTH + CHECKSUM_LENGTH))
4793
+ };
4794
+ }
4749
4795
  var PRELUDE_MEMBER_LENGTH = 4;
4750
4796
  var PRELUDE_LENGTH = PRELUDE_MEMBER_LENGTH * 2;
4751
4797
  var CHECKSUM_LENGTH = 4;
4752
4798
  var MINIMUM_MESSAGE_LENGTH = PRELUDE_LENGTH + CHECKSUM_LENGTH * 2;
4799
+
4800
+ // /home/runner/work/stacks/stacks/node_modules/@smithy/eventstream-codec/dist-es/EventStreamCodec.js
4801
+ class EventStreamCodec {
4802
+ constructor(toUtf8, fromUtf8) {
4803
+ this.headerMarshaller = new HeaderMarshaller(toUtf8, fromUtf8);
4804
+ this.messageBuffer = [];
4805
+ this.isEndOfStream = false;
4806
+ }
4807
+ feed(message) {
4808
+ this.messageBuffer.push(this.decode(message));
4809
+ }
4810
+ endOfStream() {
4811
+ this.isEndOfStream = true;
4812
+ }
4813
+ getMessage() {
4814
+ const message = this.messageBuffer.pop();
4815
+ const isEndOfStream = this.isEndOfStream;
4816
+ return {
4817
+ getMessage() {
4818
+ return message;
4819
+ },
4820
+ isEndOfStream() {
4821
+ return isEndOfStream;
4822
+ }
4823
+ };
4824
+ }
4825
+ getAvailableMessages() {
4826
+ const messages = this.messageBuffer;
4827
+ this.messageBuffer = [];
4828
+ const isEndOfStream = this.isEndOfStream;
4829
+ return {
4830
+ getMessages() {
4831
+ return messages;
4832
+ },
4833
+ isEndOfStream() {
4834
+ return isEndOfStream;
4835
+ }
4836
+ };
4837
+ }
4838
+ encode({ headers: rawHeaders, body }) {
4839
+ const headers = this.headerMarshaller.format(rawHeaders);
4840
+ const length = headers.byteLength + body.byteLength + 16;
4841
+ const out = new Uint8Array(length);
4842
+ const view = new DataView(out.buffer, out.byteOffset, out.byteLength);
4843
+ const checksum3 = new crc322.Crc32;
4844
+ view.setUint32(0, length, false);
4845
+ view.setUint32(4, headers.byteLength, false);
4846
+ view.setUint32(8, checksum3.update(out.subarray(0, 8)).digest(), false);
4847
+ out.set(headers, 12);
4848
+ out.set(body, headers.byteLength + 12);
4849
+ view.setUint32(length - 4, checksum3.update(out.subarray(8, length - 4)).digest(), false);
4850
+ return out;
4851
+ }
4852
+ decode(message) {
4853
+ const { headers, body } = splitMessage(message);
4854
+ return { headers: this.headerMarshaller.parse(headers), body };
4855
+ }
4856
+ formatHeaders(rawHeaders) {
4857
+ return this.headerMarshaller.format(rawHeaders);
4858
+ }
4859
+ }
4753
4860
  // /home/runner/work/stacks/stacks/node_modules/@smithy/eventstream-codec/dist-es/MessageDecoderStream.js
4754
4861
  class MessageDecoderStream {
4755
4862
  constructor(options) {
@@ -8169,10 +8276,10 @@ var commonParams = {
8169
8276
  var package_default = {
8170
8277
  name: "@aws-sdk/client-bedrock",
8171
8278
  description: "AWS SDK for JavaScript Bedrock Client for Node.js, Browser and React Native",
8172
- version: "3.490.0",
8279
+ version: "3.503.1",
8173
8280
  scripts: {
8174
8281
  build: "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
8175
- "build:cjs": "tsc -p tsconfig.cjs.json",
8282
+ "build:cjs": "node ../../scripts/compilation/inline client-bedrock",
8176
8283
  "build:es": "tsc -p tsconfig.es.json",
8177
8284
  "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build",
8178
8285
  "build:types": "tsc -p tsconfig.types.json",
@@ -8188,48 +8295,48 @@ var package_default = {
8188
8295
  dependencies: {
8189
8296
  "@aws-crypto/sha256-browser": "3.0.0",
8190
8297
  "@aws-crypto/sha256-js": "3.0.0",
8191
- "@aws-sdk/client-sts": "3.490.0",
8192
- "@aws-sdk/core": "3.490.0",
8193
- "@aws-sdk/credential-provider-node": "3.490.0",
8194
- "@aws-sdk/middleware-host-header": "3.489.0",
8195
- "@aws-sdk/middleware-logger": "3.489.0",
8196
- "@aws-sdk/middleware-recursion-detection": "3.489.0",
8197
- "@aws-sdk/middleware-signing": "3.489.0",
8198
- "@aws-sdk/middleware-user-agent": "3.489.0",
8199
- "@aws-sdk/region-config-resolver": "3.489.0",
8200
- "@aws-sdk/types": "3.489.0",
8201
- "@aws-sdk/util-endpoints": "3.489.0",
8202
- "@aws-sdk/util-user-agent-browser": "3.489.0",
8203
- "@aws-sdk/util-user-agent-node": "3.489.0",
8204
- "@smithy/config-resolver": "^2.0.23",
8205
- "@smithy/core": "^1.2.2",
8206
- "@smithy/fetch-http-handler": "^2.3.2",
8207
- "@smithy/hash-node": "^2.0.18",
8208
- "@smithy/invalid-dependency": "^2.0.16",
8209
- "@smithy/middleware-content-length": "^2.0.18",
8210
- "@smithy/middleware-endpoint": "^2.3.0",
8211
- "@smithy/middleware-retry": "^2.0.26",
8212
- "@smithy/middleware-serde": "^2.0.16",
8213
- "@smithy/middleware-stack": "^2.0.10",
8214
- "@smithy/node-config-provider": "^2.1.9",
8215
- "@smithy/node-http-handler": "^2.2.2",
8216
- "@smithy/protocol-http": "^3.0.12",
8217
- "@smithy/smithy-client": "^2.2.1",
8218
- "@smithy/types": "^2.8.0",
8219
- "@smithy/url-parser": "^2.0.16",
8220
- "@smithy/util-base64": "^2.0.1",
8221
- "@smithy/util-body-length-browser": "^2.0.1",
8222
- "@smithy/util-body-length-node": "^2.1.0",
8223
- "@smithy/util-defaults-mode-browser": "^2.0.24",
8224
- "@smithy/util-defaults-mode-node": "^2.0.32",
8225
- "@smithy/util-endpoints": "^1.0.8",
8226
- "@smithy/util-retry": "^2.0.9",
8227
- "@smithy/util-utf8": "^2.0.2",
8298
+ "@aws-sdk/client-sts": "3.502.0",
8299
+ "@aws-sdk/core": "3.496.0",
8300
+ "@aws-sdk/credential-provider-node": "3.503.1",
8301
+ "@aws-sdk/middleware-host-header": "3.502.0",
8302
+ "@aws-sdk/middleware-logger": "3.502.0",
8303
+ "@aws-sdk/middleware-recursion-detection": "3.502.0",
8304
+ "@aws-sdk/middleware-signing": "3.502.0",
8305
+ "@aws-sdk/middleware-user-agent": "3.502.0",
8306
+ "@aws-sdk/region-config-resolver": "3.502.0",
8307
+ "@aws-sdk/types": "3.502.0",
8308
+ "@aws-sdk/util-endpoints": "3.502.0",
8309
+ "@aws-sdk/util-user-agent-browser": "3.502.0",
8310
+ "@aws-sdk/util-user-agent-node": "3.502.0",
8311
+ "@smithy/config-resolver": "^2.1.1",
8312
+ "@smithy/core": "^1.3.1",
8313
+ "@smithy/fetch-http-handler": "^2.4.1",
8314
+ "@smithy/hash-node": "^2.1.1",
8315
+ "@smithy/invalid-dependency": "^2.1.1",
8316
+ "@smithy/middleware-content-length": "^2.1.1",
8317
+ "@smithy/middleware-endpoint": "^2.4.1",
8318
+ "@smithy/middleware-retry": "^2.1.1",
8319
+ "@smithy/middleware-serde": "^2.1.1",
8320
+ "@smithy/middleware-stack": "^2.1.1",
8321
+ "@smithy/node-config-provider": "^2.2.1",
8322
+ "@smithy/node-http-handler": "^2.3.1",
8323
+ "@smithy/protocol-http": "^3.1.1",
8324
+ "@smithy/smithy-client": "^2.3.1",
8325
+ "@smithy/types": "^2.9.1",
8326
+ "@smithy/url-parser": "^2.1.1",
8327
+ "@smithy/util-base64": "^2.1.1",
8328
+ "@smithy/util-body-length-browser": "^2.1.1",
8329
+ "@smithy/util-body-length-node": "^2.2.1",
8330
+ "@smithy/util-defaults-mode-browser": "^2.1.1",
8331
+ "@smithy/util-defaults-mode-node": "^2.1.1",
8332
+ "@smithy/util-endpoints": "^1.1.1",
8333
+ "@smithy/util-retry": "^2.1.1",
8334
+ "@smithy/util-utf8": "^2.1.1",
8228
8335
  tslib: "^2.5.0",
8229
8336
  uuid: "^8.3.2"
8230
8337
  },
8231
8338
  devDependencies: {
8232
- "@smithy/service-client-documentation-generator": "^2.0.0",
8339
+ "@smithy/service-client-documentation-generator": "^2.1.1",
8233
8340
  "@tsconfig/node14": "1.0.3",
8234
8341
  "@types/node": "^14.14.31",
8235
8342
  "@types/uuid": "^8.3.0",
@@ -9225,10 +9332,10 @@ var commonParams2 = {
9225
9332
  var package_default2 = {
9226
9333
  name: "@aws-sdk/client-bedrock-runtime",
9227
9334
  description: "AWS SDK for JavaScript Bedrock Runtime Client for Node.js, Browser and React Native",
9228
- version: "3.490.0",
9335
+ version: "3.503.1",
9229
9336
  scripts: {
9230
9337
  build: "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
9231
- "build:cjs": "tsc -p tsconfig.cjs.json",
9338
+ "build:cjs": "node ../../scripts/compilation/inline client-bedrock-runtime",
9232
9339
  "build:es": "tsc -p tsconfig.es.json",
9233
9340
  "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build",
9234
9341
  "build:types": "tsc -p tsconfig.types.json",
@@ -9244,51 +9351,51 @@ var package_default2 = {
9244
9351
  dependencies: {
9245
9352
  "@aws-crypto/sha256-browser": "3.0.0",
9246
9353
  "@aws-crypto/sha256-js": "3.0.0",
9247
- "@aws-sdk/client-sts": "3.490.0",
9248
- "@aws-sdk/core": "3.490.0",
9249
- "@aws-sdk/credential-provider-node": "3.490.0",
9250
- "@aws-sdk/middleware-host-header": "3.489.0",
9251
- "@aws-sdk/middleware-logger": "3.489.0",
9252
- "@aws-sdk/middleware-recursion-detection": "3.489.0",
9253
- "@aws-sdk/middleware-signing": "3.489.0",
9254
- "@aws-sdk/middleware-user-agent": "3.489.0",
9255
- "@aws-sdk/region-config-resolver": "3.489.0",
9256
- "@aws-sdk/types": "3.489.0",
9257
- "@aws-sdk/util-endpoints": "3.489.0",
9258
- "@aws-sdk/util-user-agent-browser": "3.489.0",
9259
- "@aws-sdk/util-user-agent-node": "3.489.0",
9260
- "@smithy/config-resolver": "^2.0.23",
9261
- "@smithy/core": "^1.2.2",
9262
- "@smithy/eventstream-serde-browser": "^2.0.16",
9263
- "@smithy/eventstream-serde-config-resolver": "^2.0.16",
9264
- "@smithy/eventstream-serde-node": "^2.0.16",
9265
- "@smithy/fetch-http-handler": "^2.3.2",
9266
- "@smithy/hash-node": "^2.0.18",
9267
- "@smithy/invalid-dependency": "^2.0.16",
9268
- "@smithy/middleware-content-length": "^2.0.18",
9269
- "@smithy/middleware-endpoint": "^2.3.0",
9270
- "@smithy/middleware-retry": "^2.0.26",
9271
- "@smithy/middleware-serde": "^2.0.16",
9272
- "@smithy/middleware-stack": "^2.0.10",
9273
- "@smithy/node-config-provider": "^2.1.9",
9274
- "@smithy/node-http-handler": "^2.2.2",
9275
- "@smithy/protocol-http": "^3.0.12",
9276
- "@smithy/smithy-client": "^2.2.1",
9277
- "@smithy/types": "^2.8.0",
9278
- "@smithy/url-parser": "^2.0.16",
9279
- "@smithy/util-base64": "^2.0.1",
9280
- "@smithy/util-body-length-browser": "^2.0.1",
9281
- "@smithy/util-body-length-node": "^2.1.0",
9282
- "@smithy/util-defaults-mode-browser": "^2.0.24",
9283
- "@smithy/util-defaults-mode-node": "^2.0.32",
9284
- "@smithy/util-endpoints": "^1.0.8",
9285
- "@smithy/util-retry": "^2.0.9",
9286
- "@smithy/util-stream": "^2.0.24",
9287
- "@smithy/util-utf8": "^2.0.2",
9354
+ "@aws-sdk/client-sts": "3.502.0",
9355
+ "@aws-sdk/core": "3.496.0",
9356
+ "@aws-sdk/credential-provider-node": "3.503.1",
9357
+ "@aws-sdk/middleware-host-header": "3.502.0",
9358
+ "@aws-sdk/middleware-logger": "3.502.0",
9359
+ "@aws-sdk/middleware-recursion-detection": "3.502.0",
9360
+ "@aws-sdk/middleware-signing": "3.502.0",
9361
+ "@aws-sdk/middleware-user-agent": "3.502.0",
9362
+ "@aws-sdk/region-config-resolver": "3.502.0",
9363
+ "@aws-sdk/types": "3.502.0",
9364
+ "@aws-sdk/util-endpoints": "3.502.0",
9365
+ "@aws-sdk/util-user-agent-browser": "3.502.0",
9366
+ "@aws-sdk/util-user-agent-node": "3.502.0",
9367
+ "@smithy/config-resolver": "^2.1.1",
9368
+ "@smithy/core": "^1.3.1",
9369
+ "@smithy/eventstream-serde-browser": "^2.1.1",
9370
+ "@smithy/eventstream-serde-config-resolver": "^2.1.1",
9371
+ "@smithy/eventstream-serde-node": "^2.1.1",
9372
+ "@smithy/fetch-http-handler": "^2.4.1",
9373
+ "@smithy/hash-node": "^2.1.1",
9374
+ "@smithy/invalid-dependency": "^2.1.1",
9375
+ "@smithy/middleware-content-length": "^2.1.1",
9376
+ "@smithy/middleware-endpoint": "^2.4.1",
9377
+ "@smithy/middleware-retry": "^2.1.1",
9378
+ "@smithy/middleware-serde": "^2.1.1",
9379
+ "@smithy/middleware-stack": "^2.1.1",
9380
+ "@smithy/node-config-provider": "^2.2.1",
9381
+ "@smithy/node-http-handler": "^2.3.1",
9382
+ "@smithy/protocol-http": "^3.1.1",
9383
+ "@smithy/smithy-client": "^2.3.1",
9384
+ "@smithy/types": "^2.9.1",
9385
+ "@smithy/url-parser": "^2.1.1",
9386
+ "@smithy/util-base64": "^2.1.1",
9387
+ "@smithy/util-body-length-browser": "^2.1.1",
9388
+ "@smithy/util-body-length-node": "^2.2.1",
9389
+ "@smithy/util-defaults-mode-browser": "^2.1.1",
9390
+ "@smithy/util-defaults-mode-node": "^2.1.1",
9391
+ "@smithy/util-endpoints": "^1.1.1",
9392
+ "@smithy/util-retry": "^2.1.1",
9393
+ "@smithy/util-stream": "^2.1.1",
9394
+ "@smithy/util-utf8": "^2.1.1",
9288
9395
  tslib: "^2.5.0"
9289
9396
  },
9290
9397
  devDependencies: {
9291
- "@smithy/service-client-documentation-generator": "^2.0.0",
9398
+ "@smithy/service-client-documentation-generator": "^2.1.1",
9292
9399
  "@tsconfig/node14": "1.0.3",
9293
9400
  "@types/node": "^14.14.31",
9294
9401
  concurrently: "7.0.0",
@@ -9331,393 +9438,6 @@ var package_default2 = {
9331
9438
  // /home/runner/work/stacks/stacks/node_modules/@aws-sdk/client-bedrock-runtime/dist-es/runtimeConfig.browser.js
9332
9439
  var sha256_browser2 = __toESM(require_build6(), 1);
9333
9440
 
9334
- // /home/runner/work/stacks/stacks/node_modules/@smithy/eventstream-serde-universal/node_modules/@smithy/eventstream-codec/dist-es/EventStreamCodec.js
9335
- var crc324 = __toESM(require_build2(), 1);
9336
-
9337
- // /home/runner/work/stacks/stacks/node_modules/@smithy/eventstream-serde-universal/node_modules/@smithy/eventstream-codec/dist-es/Int64.js
9338
- var negate2 = function(bytes) {
9339
- for (let i2 = 0;i2 < 8; i2++) {
9340
- bytes[i2] ^= 255;
9341
- }
9342
- for (let i2 = 7;i2 > -1; i2--) {
9343
- bytes[i2]++;
9344
- if (bytes[i2] !== 0)
9345
- break;
9346
- }
9347
- };
9348
-
9349
- class Int644 {
9350
- constructor(bytes) {
9351
- this.bytes = bytes;
9352
- if (bytes.byteLength !== 8) {
9353
- throw new Error("Int64 buffers must be exactly 8 bytes");
9354
- }
9355
- }
9356
- static fromNumber(number) {
9357
- if (number > 9223372036854776000 || number < -9223372036854776000) {
9358
- throw new Error(`${number} is too large (or, if negative, too small) to represent as an Int64`);
9359
- }
9360
- const bytes = new Uint8Array(8);
9361
- for (let i2 = 7, remaining = Math.abs(Math.round(number));i2 > -1 && remaining > 0; i2--, remaining /= 256) {
9362
- bytes[i2] = remaining;
9363
- }
9364
- if (number < 0) {
9365
- negate2(bytes);
9366
- }
9367
- return new Int644(bytes);
9368
- }
9369
- valueOf() {
9370
- const bytes = this.bytes.slice(0);
9371
- const negative = bytes[0] & 128;
9372
- if (negative) {
9373
- negate2(bytes);
9374
- }
9375
- return parseInt(toHex(bytes), 16) * (negative ? -1 : 1);
9376
- }
9377
- toString() {
9378
- return String(this.valueOf());
9379
- }
9380
- }
9381
-
9382
- // /home/runner/work/stacks/stacks/node_modules/@smithy/eventstream-serde-universal/node_modules/@smithy/eventstream-codec/dist-es/HeaderMarshaller.js
9383
- class HeaderMarshaller4 {
9384
- constructor(toUtf83, fromUtf84) {
9385
- this.toUtf8 = toUtf83;
9386
- this.fromUtf8 = fromUtf84;
9387
- }
9388
- format(headers) {
9389
- const chunks = [];
9390
- for (const headerName of Object.keys(headers)) {
9391
- const bytes = this.fromUtf8(headerName);
9392
- chunks.push(Uint8Array.from([bytes.byteLength]), bytes, this.formatHeaderValue(headers[headerName]));
9393
- }
9394
- const out = new Uint8Array(chunks.reduce((carry, bytes) => carry + bytes.byteLength, 0));
9395
- let position = 0;
9396
- for (const chunk of chunks) {
9397
- out.set(chunk, position);
9398
- position += chunk.byteLength;
9399
- }
9400
- return out;
9401
- }
9402
- formatHeaderValue(header) {
9403
- switch (header.type) {
9404
- case "boolean":
9405
- return Uint8Array.from([header.value ? 0 : 1]);
9406
- case "byte":
9407
- return Uint8Array.from([2, header.value]);
9408
- case "short":
9409
- const shortView = new DataView(new ArrayBuffer(3));
9410
- shortView.setUint8(0, 3);
9411
- shortView.setInt16(1, header.value, false);
9412
- return new Uint8Array(shortView.buffer);
9413
- case "integer":
9414
- const intView = new DataView(new ArrayBuffer(5));
9415
- intView.setUint8(0, 4);
9416
- intView.setInt32(1, header.value, false);
9417
- return new Uint8Array(intView.buffer);
9418
- case "long":
9419
- const longBytes = new Uint8Array(9);
9420
- longBytes[0] = 5;
9421
- longBytes.set(header.value.bytes, 1);
9422
- return longBytes;
9423
- case "binary":
9424
- const binView = new DataView(new ArrayBuffer(3 + header.value.byteLength));
9425
- binView.setUint8(0, 6);
9426
- binView.setUint16(1, header.value.byteLength, false);
9427
- const binBytes = new Uint8Array(binView.buffer);
9428
- binBytes.set(header.value, 3);
9429
- return binBytes;
9430
- case "string":
9431
- const utf8Bytes = this.fromUtf8(header.value);
9432
- const strView = new DataView(new ArrayBuffer(3 + utf8Bytes.byteLength));
9433
- strView.setUint8(0, 7);
9434
- strView.setUint16(1, utf8Bytes.byteLength, false);
9435
- const strBytes = new Uint8Array(strView.buffer);
9436
- strBytes.set(utf8Bytes, 3);
9437
- return strBytes;
9438
- case "timestamp":
9439
- const tsBytes = new Uint8Array(9);
9440
- tsBytes[0] = 8;
9441
- tsBytes.set(Int644.fromNumber(header.value.valueOf()).bytes, 1);
9442
- return tsBytes;
9443
- case "uuid":
9444
- if (!UUID_PATTERN2.test(header.value)) {
9445
- throw new Error(`Invalid UUID received: ${header.value}`);
9446
- }
9447
- const uuidBytes = new Uint8Array(17);
9448
- uuidBytes[0] = 9;
9449
- uuidBytes.set(fromHex(header.value.replace(/\-/g, "")), 1);
9450
- return uuidBytes;
9451
- }
9452
- }
9453
- parse(headers) {
9454
- const out = {};
9455
- let position = 0;
9456
- while (position < headers.byteLength) {
9457
- const nameLength = headers.getUint8(position++);
9458
- const name = this.toUtf8(new Uint8Array(headers.buffer, headers.byteOffset + position, nameLength));
9459
- position += nameLength;
9460
- switch (headers.getUint8(position++)) {
9461
- case 0:
9462
- out[name] = {
9463
- type: BOOLEAN_TAG2,
9464
- value: true
9465
- };
9466
- break;
9467
- case 1:
9468
- out[name] = {
9469
- type: BOOLEAN_TAG2,
9470
- value: false
9471
- };
9472
- break;
9473
- case 2:
9474
- out[name] = {
9475
- type: BYTE_TAG2,
9476
- value: headers.getInt8(position++)
9477
- };
9478
- break;
9479
- case 3:
9480
- out[name] = {
9481
- type: SHORT_TAG2,
9482
- value: headers.getInt16(position, false)
9483
- };
9484
- position += 2;
9485
- break;
9486
- case 4:
9487
- out[name] = {
9488
- type: INT_TAG2,
9489
- value: headers.getInt32(position, false)
9490
- };
9491
- position += 4;
9492
- break;
9493
- case 5:
9494
- out[name] = {
9495
- type: LONG_TAG2,
9496
- value: new Int644(new Uint8Array(headers.buffer, headers.byteOffset + position, 8))
9497
- };
9498
- position += 8;
9499
- break;
9500
- case 6:
9501
- const binaryLength = headers.getUint16(position, false);
9502
- position += 2;
9503
- out[name] = {
9504
- type: BINARY_TAG2,
9505
- value: new Uint8Array(headers.buffer, headers.byteOffset + position, binaryLength)
9506
- };
9507
- position += binaryLength;
9508
- break;
9509
- case 7:
9510
- const stringLength = headers.getUint16(position, false);
9511
- position += 2;
9512
- out[name] = {
9513
- type: STRING_TAG2,
9514
- value: this.toUtf8(new Uint8Array(headers.buffer, headers.byteOffset + position, stringLength))
9515
- };
9516
- position += stringLength;
9517
- break;
9518
- case 8:
9519
- out[name] = {
9520
- type: TIMESTAMP_TAG2,
9521
- value: new Date(new Int644(new Uint8Array(headers.buffer, headers.byteOffset + position, 8)).valueOf())
9522
- };
9523
- position += 8;
9524
- break;
9525
- case 9:
9526
- const uuidBytes = new Uint8Array(headers.buffer, headers.byteOffset + position, 16);
9527
- position += 16;
9528
- out[name] = {
9529
- type: UUID_TAG2,
9530
- value: `${toHex(uuidBytes.subarray(0, 4))}-${toHex(uuidBytes.subarray(4, 6))}-${toHex(uuidBytes.subarray(6, 8))}-${toHex(uuidBytes.subarray(8, 10))}-${toHex(uuidBytes.subarray(10))}`
9531
- };
9532
- break;
9533
- default:
9534
- throw new Error(`Unrecognized header type tag`);
9535
- }
9536
- }
9537
- return out;
9538
- }
9539
- }
9540
- var HEADER_VALUE_TYPE2;
9541
- (function(HEADER_VALUE_TYPE3) {
9542
- HEADER_VALUE_TYPE3[HEADER_VALUE_TYPE3["boolTrue"] = 0] = "boolTrue";
9543
- HEADER_VALUE_TYPE3[HEADER_VALUE_TYPE3["boolFalse"] = 1] = "boolFalse";
9544
- HEADER_VALUE_TYPE3[HEADER_VALUE_TYPE3["byte"] = 2] = "byte";
9545
- HEADER_VALUE_TYPE3[HEADER_VALUE_TYPE3["short"] = 3] = "short";
9546
- HEADER_VALUE_TYPE3[HEADER_VALUE_TYPE3["integer"] = 4] = "integer";
9547
- HEADER_VALUE_TYPE3[HEADER_VALUE_TYPE3["long"] = 5] = "long";
9548
- HEADER_VALUE_TYPE3[HEADER_VALUE_TYPE3["byteArray"] = 6] = "byteArray";
9549
- HEADER_VALUE_TYPE3[HEADER_VALUE_TYPE3["string"] = 7] = "string";
9550
- HEADER_VALUE_TYPE3[HEADER_VALUE_TYPE3["timestamp"] = 8] = "timestamp";
9551
- HEADER_VALUE_TYPE3[HEADER_VALUE_TYPE3["uuid"] = 9] = "uuid";
9552
- })(HEADER_VALUE_TYPE2 || (HEADER_VALUE_TYPE2 = {}));
9553
- var BOOLEAN_TAG2 = "boolean";
9554
- var BYTE_TAG2 = "byte";
9555
- var SHORT_TAG2 = "short";
9556
- var INT_TAG2 = "integer";
9557
- var LONG_TAG2 = "long";
9558
- var BINARY_TAG2 = "binary";
9559
- var STRING_TAG2 = "string";
9560
- var TIMESTAMP_TAG2 = "timestamp";
9561
- var UUID_TAG2 = "uuid";
9562
- var UUID_PATTERN2 = /^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/;
9563
-
9564
- // /home/runner/work/stacks/stacks/node_modules/@smithy/eventstream-serde-universal/node_modules/@smithy/eventstream-codec/dist-es/splitMessage.js
9565
- var crc323 = __toESM(require_build2(), 1);
9566
- function splitMessage3({ byteLength, byteOffset, buffer }) {
9567
- if (byteLength < MINIMUM_MESSAGE_LENGTH2) {
9568
- throw new Error("Provided message too short to accommodate event stream message overhead");
9569
- }
9570
- const view = new DataView(buffer, byteOffset, byteLength);
9571
- const messageLength = view.getUint32(0, false);
9572
- if (byteLength !== messageLength) {
9573
- throw new Error("Reported message length does not match received message length");
9574
- }
9575
- const headerLength = view.getUint32(PRELUDE_MEMBER_LENGTH2, false);
9576
- const expectedPreludeChecksum = view.getUint32(PRELUDE_LENGTH2, false);
9577
- const expectedMessageChecksum = view.getUint32(byteLength - CHECKSUM_LENGTH2, false);
9578
- const checksummer = new crc323.Crc32().update(new Uint8Array(buffer, byteOffset, PRELUDE_LENGTH2));
9579
- if (expectedPreludeChecksum !== checksummer.digest()) {
9580
- throw new Error(`The prelude checksum specified in the message (${expectedPreludeChecksum}) does not match the calculated CRC32 checksum (${checksummer.digest()})`);
9581
- }
9582
- checksummer.update(new Uint8Array(buffer, byteOffset + PRELUDE_LENGTH2, byteLength - (PRELUDE_LENGTH2 + CHECKSUM_LENGTH2)));
9583
- if (expectedMessageChecksum !== checksummer.digest()) {
9584
- throw new Error(`The message checksum (${checksummer.digest()}) did not match the expected value of ${expectedMessageChecksum}`);
9585
- }
9586
- return {
9587
- headers: new DataView(buffer, byteOffset + PRELUDE_LENGTH2 + CHECKSUM_LENGTH2, headerLength),
9588
- body: new Uint8Array(buffer, byteOffset + PRELUDE_LENGTH2 + CHECKSUM_LENGTH2 + headerLength, messageLength - headerLength - (PRELUDE_LENGTH2 + CHECKSUM_LENGTH2 + CHECKSUM_LENGTH2))
9589
- };
9590
- }
9591
- var PRELUDE_MEMBER_LENGTH2 = 4;
9592
- var PRELUDE_LENGTH2 = PRELUDE_MEMBER_LENGTH2 * 2;
9593
- var CHECKSUM_LENGTH2 = 4;
9594
- var MINIMUM_MESSAGE_LENGTH2 = PRELUDE_LENGTH2 + CHECKSUM_LENGTH2 * 2;
9595
-
9596
- // /home/runner/work/stacks/stacks/node_modules/@smithy/eventstream-serde-universal/node_modules/@smithy/eventstream-codec/dist-es/EventStreamCodec.js
9597
- class EventStreamCodec2 {
9598
- constructor(toUtf83, fromUtf84) {
9599
- this.headerMarshaller = new HeaderMarshaller4(toUtf83, fromUtf84);
9600
- this.messageBuffer = [];
9601
- this.isEndOfStream = false;
9602
- }
9603
- feed(message) {
9604
- this.messageBuffer.push(this.decode(message));
9605
- }
9606
- endOfStream() {
9607
- this.isEndOfStream = true;
9608
- }
9609
- getMessage() {
9610
- const message = this.messageBuffer.pop();
9611
- const isEndOfStream = this.isEndOfStream;
9612
- return {
9613
- getMessage() {
9614
- return message;
9615
- },
9616
- isEndOfStream() {
9617
- return isEndOfStream;
9618
- }
9619
- };
9620
- }
9621
- getAvailableMessages() {
9622
- const messages = this.messageBuffer;
9623
- this.messageBuffer = [];
9624
- const isEndOfStream = this.isEndOfStream;
9625
- return {
9626
- getMessages() {
9627
- return messages;
9628
- },
9629
- isEndOfStream() {
9630
- return isEndOfStream;
9631
- }
9632
- };
9633
- }
9634
- encode({ headers: rawHeaders, body }) {
9635
- const headers = this.headerMarshaller.format(rawHeaders);
9636
- const length = headers.byteLength + body.byteLength + 16;
9637
- const out = new Uint8Array(length);
9638
- const view = new DataView(out.buffer, out.byteOffset, out.byteLength);
9639
- const checksum4 = new crc324.Crc32;
9640
- view.setUint32(0, length, false);
9641
- view.setUint32(4, headers.byteLength, false);
9642
- view.setUint32(8, checksum4.update(out.subarray(0, 8)).digest(), false);
9643
- out.set(headers, 12);
9644
- out.set(body, headers.byteLength + 12);
9645
- view.setUint32(length - 4, checksum4.update(out.subarray(8, length - 4)).digest(), false);
9646
- return out;
9647
- }
9648
- decode(message) {
9649
- const { headers, body } = splitMessage3(message);
9650
- return { headers: this.headerMarshaller.parse(headers), body };
9651
- }
9652
- formatHeaders(rawHeaders) {
9653
- return this.headerMarshaller.format(rawHeaders);
9654
- }
9655
- }
9656
- // /home/runner/work/stacks/stacks/node_modules/@smithy/eventstream-serde-universal/node_modules/@smithy/eventstream-codec/dist-es/MessageDecoderStream.js
9657
- class MessageDecoderStream3 {
9658
- constructor(options) {
9659
- this.options = options;
9660
- }
9661
- [Symbol.asyncIterator]() {
9662
- return this.asyncIterator();
9663
- }
9664
- async* asyncIterator() {
9665
- for await (const bytes of this.options.inputStream) {
9666
- const decoded = this.options.decoder.decode(bytes);
9667
- yield decoded;
9668
- }
9669
- }
9670
- }
9671
- // /home/runner/work/stacks/stacks/node_modules/@smithy/eventstream-serde-universal/node_modules/@smithy/eventstream-codec/dist-es/MessageEncoderStream.js
9672
- class MessageEncoderStream3 {
9673
- constructor(options) {
9674
- this.options = options;
9675
- }
9676
- [Symbol.asyncIterator]() {
9677
- return this.asyncIterator();
9678
- }
9679
- async* asyncIterator() {
9680
- for await (const msg of this.options.messageStream) {
9681
- const encoded = this.options.encoder.encode(msg);
9682
- yield encoded;
9683
- }
9684
- if (this.options.includeEndFrame) {
9685
- yield new Uint8Array(0);
9686
- }
9687
- }
9688
- }
9689
- // /home/runner/work/stacks/stacks/node_modules/@smithy/eventstream-serde-universal/node_modules/@smithy/eventstream-codec/dist-es/SmithyMessageDecoderStream.js
9690
- class SmithyMessageDecoderStream3 {
9691
- constructor(options) {
9692
- this.options = options;
9693
- }
9694
- [Symbol.asyncIterator]() {
9695
- return this.asyncIterator();
9696
- }
9697
- async* asyncIterator() {
9698
- for await (const message of this.options.messageStream) {
9699
- const deserialized = await this.options.deserializer(message);
9700
- if (deserialized === undefined)
9701
- continue;
9702
- yield deserialized;
9703
- }
9704
- }
9705
- }
9706
- // /home/runner/work/stacks/stacks/node_modules/@smithy/eventstream-serde-universal/node_modules/@smithy/eventstream-codec/dist-es/SmithyMessageEncoderStream.js
9707
- class SmithyMessageEncoderStream3 {
9708
- constructor(options) {
9709
- this.options = options;
9710
- }
9711
- [Symbol.asyncIterator]() {
9712
- return this.asyncIterator();
9713
- }
9714
- async* asyncIterator() {
9715
- for await (const chunk of this.options.inputStream) {
9716
- const payloadBuf = this.options.serializer(chunk);
9717
- yield payloadBuf;
9718
- }
9719
- }
9720
- }
9721
9441
  // /home/runner/work/stacks/stacks/node_modules/@smithy/eventstream-serde-universal/dist-es/getChunkedStream.js
9722
9442
  function getChunkedStream(source) {
9723
9443
  let currentMessageTotalLength = 0;
@@ -9819,19 +9539,19 @@ function getMessageUnmarshaller(deserializer, toUtf83) {
9819
9539
  // /home/runner/work/stacks/stacks/node_modules/@smithy/eventstream-serde-universal/dist-es/EventStreamMarshaller.js
9820
9540
  class EventStreamMarshaller {
9821
9541
  constructor({ utf8Encoder, utf8Decoder }) {
9822
- this.eventStreamCodec = new EventStreamCodec2(utf8Encoder, utf8Decoder);
9542
+ this.eventStreamCodec = new EventStreamCodec(utf8Encoder, utf8Decoder);
9823
9543
  this.utfEncoder = utf8Encoder;
9824
9544
  }
9825
9545
  deserialize(body, deserializer) {
9826
9546
  const inputStream = getChunkedStream(body);
9827
- return new SmithyMessageDecoderStream3({
9828
- messageStream: new MessageDecoderStream3({ inputStream, decoder: this.eventStreamCodec }),
9547
+ return new SmithyMessageDecoderStream({
9548
+ messageStream: new MessageDecoderStream({ inputStream, decoder: this.eventStreamCodec }),
9829
9549
  deserializer: getMessageUnmarshaller(deserializer, this.utfEncoder)
9830
9550
  });
9831
9551
  }
9832
9552
  serialize(inputStream, serializer) {
9833
- return new MessageEncoderStream3({
9834
- messageStream: new SmithyMessageEncoderStream3({ inputStream, serializer }),
9553
+ return new MessageEncoderStream({
9554
+ messageStream: new SmithyMessageEncoderStream({ inputStream, serializer }),
9835
9555
  encoder: this.eventStreamCodec,
9836
9556
  includeEndFrame: true
9837
9557
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/ai",
3
3
  "type": "module",
4
- "version": "0.58.28",
4
+ "version": "0.58.44",
5
5
  "description": "Stacks Artificial Intelligence.",
6
6
  "author": "Chris Breuer",
7
7
  "license": "MIT",
@@ -48,10 +48,10 @@
48
48
  "prepublishOnly": "bun --bun run build"
49
49
  },
50
50
  "peerDependencies": {
51
- "@aws-sdk/client-bedrock-runtime": "^3.490.0"
51
+ "@aws-sdk/client-bedrock-runtime": "^3.502.0"
52
52
  },
53
53
  "dependencies": {
54
- "@aws-sdk/client-bedrock-runtime": "^3.490.0"
54
+ "@aws-sdk/client-bedrock-runtime": "^3.502.0"
55
55
  },
56
56
  "devDependencies": {
57
57
  "@stacksjs/development": "workspace:*"