@mastra/memory 1.18.0-alpha.3 → 1.18.0-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -0
- package/dist/{chunk-XVVCS6R6.js → chunk-LPMZNXSF.js} +241 -104
- package/dist/chunk-LPMZNXSF.js.map +1 -0
- package/dist/{chunk-ET2TVAT3.cjs → chunk-NRYX4QWV.cjs} +241 -104
- package/dist/chunk-NRYX4QWV.cjs.map +1 -0
- package/dist/docs/SKILL.md +2 -1
- package/dist/docs/assets/SOURCE_MAP.json +39 -39
- package/dist/docs/references/reference-storage-dsql.md +428 -0
- package/dist/docs/references/reference-storage-dynamodb.md +1 -1
- package/dist/docs/references/reference-storage-libsql.md +1 -1
- package/dist/docs/references/reference-storage-postgresql.md +1 -1
- package/dist/docs/references/reference-storage-upstash.md +1 -1
- package/dist/index.cjs +97 -145
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +88 -136
- package/dist/index.js.map +1 -1
- package/dist/{observational-memory-2PRVG6BF.js → observational-memory-NL7AQHZV.js} +3 -3
- package/dist/{observational-memory-2PRVG6BF.js.map → observational-memory-NL7AQHZV.js.map} +1 -1
- package/dist/{observational-memory-UJUAQKJB.cjs → observational-memory-TZ67ZA32.cjs} +26 -26
- package/dist/{observational-memory-UJUAQKJB.cjs.map → observational-memory-TZ67ZA32.cjs.map} +1 -1
- package/dist/processors/index.cjs +24 -24
- package/dist/processors/index.js +1 -1
- package/dist/processors/observational-memory/observation-strategies/async-buffer.d.ts.map +1 -1
- package/dist/processors/observational-memory/observation-strategies/sync.d.ts.map +1 -1
- package/dist/processors/observational-memory/observer-runner.d.ts.map +1 -1
- package/dist/processors/observational-memory/reflector-runner.d.ts.map +1 -1
- package/dist/processors/observational-memory/retry.d.ts +63 -0
- package/dist/processors/observational-memory/retry.d.ts.map +1 -0
- package/package.json +4 -4
- package/dist/chunk-ET2TVAT3.cjs.map +0 -1
- package/dist/chunk-XVVCS6R6.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkNRYX4QWV_cjs = require('./chunk-NRYX4QWV.cjs');
|
|
4
4
|
var v3 = require('zod/v3');
|
|
5
5
|
var zod = require('zod');
|
|
6
6
|
var z4 = require('zod/v4');
|
|
@@ -40,7 +40,7 @@ function _interopNamespace(e) {
|
|
|
40
40
|
var z4__namespace = /*#__PURE__*/_interopNamespace(z4);
|
|
41
41
|
var xxhash__default = /*#__PURE__*/_interopDefault(xxhash);
|
|
42
42
|
|
|
43
|
-
// ../_vendored/ai_v4/dist/chunk-
|
|
43
|
+
// ../_vendored/ai_v4/dist/chunk-OPIPXJLE.js
|
|
44
44
|
var __create = Object.create;
|
|
45
45
|
var __defProp = Object.defineProperty;
|
|
46
46
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -4314,9 +4314,6 @@ var ParseError = class extends Error {
|
|
|
4314
4314
|
super(message), this.name = "ParseError", this.type = options.type, this.field = options.field, this.value = options.value, this.line = options.line;
|
|
4315
4315
|
}
|
|
4316
4316
|
};
|
|
4317
|
-
var LF = 10;
|
|
4318
|
-
var CR = 13;
|
|
4319
|
-
var SPACE = 32;
|
|
4320
4317
|
function noop(_arg) {
|
|
4321
4318
|
}
|
|
4322
4319
|
function createParser(callbacks) {
|
|
@@ -4324,109 +4321,39 @@ function createParser(callbacks) {
|
|
|
4324
4321
|
throw new TypeError(
|
|
4325
4322
|
"`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?"
|
|
4326
4323
|
);
|
|
4327
|
-
const { onEvent = noop, onError = noop, onRetry = noop, onComment } = callbacks
|
|
4328
|
-
let isFirstChunk = true, id, data = "",
|
|
4329
|
-
function feed(
|
|
4330
|
-
|
|
4331
|
-
|
|
4332
|
-
|
|
4333
|
-
|
|
4334
|
-
|
|
4335
|
-
|
|
4336
|
-
|
|
4337
|
-
pendingFragments.push(chunk);
|
|
4338
|
-
return;
|
|
4339
|
-
}
|
|
4340
|
-
pendingFragments.push(chunk);
|
|
4341
|
-
const input = pendingFragments.join("");
|
|
4342
|
-
pendingFragments.length = 0;
|
|
4343
|
-
const trailing = processLines(input);
|
|
4344
|
-
trailing !== "" && pendingFragments.push(trailing);
|
|
4345
|
-
}
|
|
4346
|
-
function processLines(chunk) {
|
|
4347
|
-
let searchIndex = 0;
|
|
4348
|
-
if (chunk.indexOf("\r") === -1) {
|
|
4349
|
-
let lfIndex = chunk.indexOf(`
|
|
4350
|
-
`, searchIndex);
|
|
4351
|
-
for (; lfIndex !== -1; ) {
|
|
4352
|
-
if (searchIndex === lfIndex) {
|
|
4353
|
-
dataLines > 0 && onEvent({ id, event: eventType, data }), id = void 0, data = "", dataLines = 0, eventType = void 0, searchIndex = lfIndex + 1, lfIndex = chunk.indexOf(`
|
|
4354
|
-
`, searchIndex);
|
|
4355
|
-
continue;
|
|
4356
|
-
}
|
|
4357
|
-
const firstCharCode = chunk.charCodeAt(searchIndex);
|
|
4358
|
-
if (isDataPrefix(chunk, searchIndex, firstCharCode)) {
|
|
4359
|
-
const valueStart = chunk.charCodeAt(searchIndex + 5) === SPACE ? searchIndex + 6 : searchIndex + 5, value = chunk.slice(valueStart, lfIndex);
|
|
4360
|
-
if (dataLines === 0 && chunk.charCodeAt(lfIndex + 1) === LF) {
|
|
4361
|
-
onEvent({ id, event: eventType, data: value }), id = void 0, data = "", eventType = void 0, searchIndex = lfIndex + 2, lfIndex = chunk.indexOf(`
|
|
4362
|
-
`, searchIndex);
|
|
4363
|
-
continue;
|
|
4364
|
-
}
|
|
4365
|
-
data = dataLines === 0 ? value : `${data}
|
|
4366
|
-
${value}`, dataLines++;
|
|
4367
|
-
} else isEventPrefix(chunk, searchIndex, firstCharCode) ? eventType = chunk.slice(
|
|
4368
|
-
chunk.charCodeAt(searchIndex + 6) === SPACE ? searchIndex + 7 : searchIndex + 6,
|
|
4369
|
-
lfIndex
|
|
4370
|
-
) || void 0 : parseLine(chunk, searchIndex, lfIndex);
|
|
4371
|
-
searchIndex = lfIndex + 1, lfIndex = chunk.indexOf(`
|
|
4372
|
-
`, searchIndex);
|
|
4373
|
-
}
|
|
4374
|
-
return chunk.slice(searchIndex);
|
|
4375
|
-
}
|
|
4376
|
-
for (; searchIndex < chunk.length; ) {
|
|
4377
|
-
const crIndex = chunk.indexOf("\r", searchIndex), lfIndex = chunk.indexOf(`
|
|
4378
|
-
`, searchIndex);
|
|
4379
|
-
let lineEnd = -1;
|
|
4380
|
-
if (crIndex !== -1 && lfIndex !== -1 ? lineEnd = crIndex < lfIndex ? crIndex : lfIndex : crIndex !== -1 ? crIndex === chunk.length - 1 ? lineEnd = -1 : lineEnd = crIndex : lfIndex !== -1 && (lineEnd = lfIndex), lineEnd === -1)
|
|
4381
|
-
break;
|
|
4382
|
-
parseLine(chunk, searchIndex, lineEnd), searchIndex = lineEnd + 1, chunk.charCodeAt(searchIndex - 1) === CR && chunk.charCodeAt(searchIndex) === LF && searchIndex++;
|
|
4383
|
-
}
|
|
4384
|
-
return chunk.slice(searchIndex);
|
|
4385
|
-
}
|
|
4386
|
-
function parseLine(chunk, start, end) {
|
|
4387
|
-
if (start === end) {
|
|
4324
|
+
const { onEvent = noop, onError = noop, onRetry = noop, onComment } = callbacks;
|
|
4325
|
+
let incompleteLine = "", isFirstChunk = true, id, data = "", eventType = "";
|
|
4326
|
+
function feed(newChunk) {
|
|
4327
|
+
const chunk = isFirstChunk ? newChunk.replace(/^\xEF\xBB\xBF/, "") : newChunk, [complete, incomplete] = splitLines(`${incompleteLine}${chunk}`);
|
|
4328
|
+
for (const line of complete)
|
|
4329
|
+
parseLine(line);
|
|
4330
|
+
incompleteLine = incomplete, isFirstChunk = false;
|
|
4331
|
+
}
|
|
4332
|
+
function parseLine(line) {
|
|
4333
|
+
if (line === "") {
|
|
4388
4334
|
dispatchEvent();
|
|
4389
4335
|
return;
|
|
4390
4336
|
}
|
|
4391
|
-
|
|
4392
|
-
|
|
4393
|
-
const valueStart = chunk.charCodeAt(start + 5) === SPACE ? start + 6 : start + 5, value2 = chunk.slice(valueStart, end);
|
|
4394
|
-
data = dataLines === 0 ? value2 : `${data}
|
|
4395
|
-
${value2}`, dataLines++;
|
|
4396
|
-
return;
|
|
4397
|
-
}
|
|
4398
|
-
if (isEventPrefix(chunk, start, firstCharCode)) {
|
|
4399
|
-
eventType = chunk.slice(chunk.charCodeAt(start + 6) === SPACE ? start + 7 : start + 6, end) || void 0;
|
|
4400
|
-
return;
|
|
4401
|
-
}
|
|
4402
|
-
if (firstCharCode === 105 && chunk.charCodeAt(start + 1) === 100 && chunk.charCodeAt(start + 2) === 58) {
|
|
4403
|
-
const value2 = chunk.slice(chunk.charCodeAt(start + 3) === SPACE ? start + 4 : start + 3, end);
|
|
4404
|
-
id = value2.includes("\0") ? void 0 : value2;
|
|
4405
|
-
return;
|
|
4406
|
-
}
|
|
4407
|
-
if (firstCharCode === 58) {
|
|
4408
|
-
if (onComment) {
|
|
4409
|
-
const line2 = chunk.slice(start, end);
|
|
4410
|
-
onComment(line2.slice(chunk.charCodeAt(start + 1) === SPACE ? 2 : 1));
|
|
4411
|
-
}
|
|
4337
|
+
if (line.startsWith(":")) {
|
|
4338
|
+
onComment && onComment(line.slice(line.startsWith(": ") ? 2 : 1));
|
|
4412
4339
|
return;
|
|
4413
4340
|
}
|
|
4414
|
-
const
|
|
4415
|
-
if (fieldSeparatorIndex
|
|
4416
|
-
|
|
4341
|
+
const fieldSeparatorIndex = line.indexOf(":");
|
|
4342
|
+
if (fieldSeparatorIndex !== -1) {
|
|
4343
|
+
const field = line.slice(0, fieldSeparatorIndex), offset = line[fieldSeparatorIndex + 1] === " " ? 2 : 1, value = line.slice(fieldSeparatorIndex + offset);
|
|
4344
|
+
processField(field, value, line);
|
|
4417
4345
|
return;
|
|
4418
4346
|
}
|
|
4419
|
-
|
|
4420
|
-
processField(field, value, line);
|
|
4347
|
+
processField(line, "", line);
|
|
4421
4348
|
}
|
|
4422
4349
|
function processField(field, value, line) {
|
|
4423
4350
|
switch (field) {
|
|
4424
4351
|
case "event":
|
|
4425
|
-
eventType = value
|
|
4352
|
+
eventType = value;
|
|
4426
4353
|
break;
|
|
4427
4354
|
case "data":
|
|
4428
|
-
data =
|
|
4429
|
-
|
|
4355
|
+
data = `${data}${value}
|
|
4356
|
+
`;
|
|
4430
4357
|
break;
|
|
4431
4358
|
case "id":
|
|
4432
4359
|
id = value.includes("\0") ? void 0 : value;
|
|
@@ -4451,26 +4378,37 @@ ${value}`, dataLines++;
|
|
|
4451
4378
|
}
|
|
4452
4379
|
}
|
|
4453
4380
|
function dispatchEvent() {
|
|
4454
|
-
|
|
4381
|
+
data.length > 0 && onEvent({
|
|
4455
4382
|
id,
|
|
4456
|
-
event: eventType,
|
|
4457
|
-
data
|
|
4458
|
-
|
|
4383
|
+
event: eventType || void 0,
|
|
4384
|
+
// If the data buffer's last character is a U+000A LINE FEED (LF) character,
|
|
4385
|
+
// then remove the last character from the data buffer.
|
|
4386
|
+
data: data.endsWith(`
|
|
4387
|
+
`) ? data.slice(0, -1) : data
|
|
4388
|
+
}), id = void 0, data = "", eventType = "";
|
|
4459
4389
|
}
|
|
4460
4390
|
function reset(options = {}) {
|
|
4461
|
-
|
|
4462
|
-
const incompleteLine = pendingFragments.join("");
|
|
4463
|
-
parseLine(incompleteLine, 0, incompleteLine.length);
|
|
4464
|
-
}
|
|
4465
|
-
isFirstChunk = true, id = void 0, data = "", dataLines = 0, eventType = void 0, pendingFragments.length = 0;
|
|
4391
|
+
incompleteLine && options.consume && parseLine(incompleteLine), isFirstChunk = true, id = void 0, data = "", eventType = "", incompleteLine = "";
|
|
4466
4392
|
}
|
|
4467
4393
|
return { feed, reset };
|
|
4468
4394
|
}
|
|
4469
|
-
function
|
|
4470
|
-
|
|
4471
|
-
|
|
4472
|
-
|
|
4473
|
-
|
|
4395
|
+
function splitLines(chunk) {
|
|
4396
|
+
const lines = [];
|
|
4397
|
+
let incompleteLine = "", searchIndex = 0;
|
|
4398
|
+
for (; searchIndex < chunk.length; ) {
|
|
4399
|
+
const crIndex = chunk.indexOf("\r", searchIndex), lfIndex = chunk.indexOf(`
|
|
4400
|
+
`, searchIndex);
|
|
4401
|
+
let lineEnd = -1;
|
|
4402
|
+
if (crIndex !== -1 && lfIndex !== -1 ? lineEnd = Math.min(crIndex, lfIndex) : crIndex !== -1 ? crIndex === chunk.length - 1 ? lineEnd = -1 : lineEnd = crIndex : lfIndex !== -1 && (lineEnd = lfIndex), lineEnd === -1) {
|
|
4403
|
+
incompleteLine = chunk.slice(searchIndex);
|
|
4404
|
+
break;
|
|
4405
|
+
} else {
|
|
4406
|
+
const line = chunk.slice(searchIndex, lineEnd);
|
|
4407
|
+
lines.push(line), searchIndex = lineEnd + 1, chunk[searchIndex - 1] === "\r" && chunk[searchIndex] === `
|
|
4408
|
+
` && searchIndex++;
|
|
4409
|
+
}
|
|
4410
|
+
}
|
|
4411
|
+
return [lines, incompleteLine];
|
|
4474
4412
|
}
|
|
4475
4413
|
var EventSourceParserStream = class extends TransformStream {
|
|
4476
4414
|
constructor({ onError, onRetry, onComment } = {}) {
|
|
@@ -7468,7 +7406,7 @@ async function getVercelRequestId() {
|
|
|
7468
7406
|
var _a932;
|
|
7469
7407
|
return (_a932 = getContext().headers) == null ? void 0 : _a932["x-vercel-id"];
|
|
7470
7408
|
}
|
|
7471
|
-
var VERSION3 = "2.0.
|
|
7409
|
+
var VERSION3 = "2.0.88";
|
|
7472
7410
|
var AI_GATEWAY_PROTOCOL_VERSION = "0.0.1";
|
|
7473
7411
|
function createGatewayProvider(options = {}) {
|
|
7474
7412
|
var _a932, _b93;
|
|
@@ -8455,7 +8393,7 @@ function getGlobalProvider() {
|
|
|
8455
8393
|
var _a163;
|
|
8456
8394
|
return (_a163 = globalThis.AI_SDK_DEFAULT_PROVIDER) != null ? _a163 : gateway;
|
|
8457
8395
|
}
|
|
8458
|
-
var VERSION32 = "5.0.
|
|
8396
|
+
var VERSION32 = "5.0.186";
|
|
8459
8397
|
var dataContentSchema2 = z4.z.union([
|
|
8460
8398
|
z4.z.string(),
|
|
8461
8399
|
z4.z.instanceof(Uint8Array),
|
|
@@ -9760,9 +9698,9 @@ var ParseError2 = class extends Error {
|
|
|
9760
9698
|
super(message), this.name = "ParseError", this.type = options.type, this.field = options.field, this.value = options.value, this.line = options.line;
|
|
9761
9699
|
}
|
|
9762
9700
|
};
|
|
9763
|
-
var
|
|
9764
|
-
var
|
|
9765
|
-
var
|
|
9701
|
+
var LF = 10;
|
|
9702
|
+
var CR = 13;
|
|
9703
|
+
var SPACE = 32;
|
|
9766
9704
|
function noop2(_arg) {
|
|
9767
9705
|
}
|
|
9768
9706
|
function createParser2(callbacks) {
|
|
@@ -9801,17 +9739,17 @@ function createParser2(callbacks) {
|
|
|
9801
9739
|
continue;
|
|
9802
9740
|
}
|
|
9803
9741
|
const firstCharCode = chunk.charCodeAt(searchIndex);
|
|
9804
|
-
if (
|
|
9805
|
-
const valueStart = chunk.charCodeAt(searchIndex + 5) ===
|
|
9806
|
-
if (dataLines === 0 && chunk.charCodeAt(lfIndex + 1) ===
|
|
9742
|
+
if (isDataPrefix(chunk, searchIndex, firstCharCode)) {
|
|
9743
|
+
const valueStart = chunk.charCodeAt(searchIndex + 5) === SPACE ? searchIndex + 6 : searchIndex + 5, value = chunk.slice(valueStart, lfIndex);
|
|
9744
|
+
if (dataLines === 0 && chunk.charCodeAt(lfIndex + 1) === LF) {
|
|
9807
9745
|
onEvent({ id, event: eventType, data: value }), id = void 0, data = "", eventType = void 0, searchIndex = lfIndex + 2, lfIndex = chunk.indexOf(`
|
|
9808
9746
|
`, searchIndex);
|
|
9809
9747
|
continue;
|
|
9810
9748
|
}
|
|
9811
9749
|
data = dataLines === 0 ? value : `${data}
|
|
9812
9750
|
${value}`, dataLines++;
|
|
9813
|
-
} else
|
|
9814
|
-
chunk.charCodeAt(searchIndex + 6) ===
|
|
9751
|
+
} else isEventPrefix(chunk, searchIndex, firstCharCode) ? eventType = chunk.slice(
|
|
9752
|
+
chunk.charCodeAt(searchIndex + 6) === SPACE ? searchIndex + 7 : searchIndex + 6,
|
|
9815
9753
|
lfIndex
|
|
9816
9754
|
) || void 0 : parseLine(chunk, searchIndex, lfIndex);
|
|
9817
9755
|
searchIndex = lfIndex + 1, lfIndex = chunk.indexOf(`
|
|
@@ -9825,7 +9763,7 @@ ${value}`, dataLines++;
|
|
|
9825
9763
|
let lineEnd = -1;
|
|
9826
9764
|
if (crIndex !== -1 && lfIndex !== -1 ? lineEnd = crIndex < lfIndex ? crIndex : lfIndex : crIndex !== -1 ? crIndex === chunk.length - 1 ? lineEnd = -1 : lineEnd = crIndex : lfIndex !== -1 && (lineEnd = lfIndex), lineEnd === -1)
|
|
9827
9765
|
break;
|
|
9828
|
-
parseLine(chunk, searchIndex, lineEnd), searchIndex = lineEnd + 1, chunk.charCodeAt(searchIndex - 1) ===
|
|
9766
|
+
parseLine(chunk, searchIndex, lineEnd), searchIndex = lineEnd + 1, chunk.charCodeAt(searchIndex - 1) === CR && chunk.charCodeAt(searchIndex) === LF && searchIndex++;
|
|
9829
9767
|
}
|
|
9830
9768
|
return chunk.slice(searchIndex);
|
|
9831
9769
|
}
|
|
@@ -9835,25 +9773,25 @@ ${value}`, dataLines++;
|
|
|
9835
9773
|
return;
|
|
9836
9774
|
}
|
|
9837
9775
|
const firstCharCode = chunk.charCodeAt(start);
|
|
9838
|
-
if (
|
|
9839
|
-
const valueStart = chunk.charCodeAt(start + 5) ===
|
|
9776
|
+
if (isDataPrefix(chunk, start, firstCharCode)) {
|
|
9777
|
+
const valueStart = chunk.charCodeAt(start + 5) === SPACE ? start + 6 : start + 5, value2 = chunk.slice(valueStart, end);
|
|
9840
9778
|
data = dataLines === 0 ? value2 : `${data}
|
|
9841
9779
|
${value2}`, dataLines++;
|
|
9842
9780
|
return;
|
|
9843
9781
|
}
|
|
9844
|
-
if (
|
|
9845
|
-
eventType = chunk.slice(chunk.charCodeAt(start + 6) ===
|
|
9782
|
+
if (isEventPrefix(chunk, start, firstCharCode)) {
|
|
9783
|
+
eventType = chunk.slice(chunk.charCodeAt(start + 6) === SPACE ? start + 7 : start + 6, end) || void 0;
|
|
9846
9784
|
return;
|
|
9847
9785
|
}
|
|
9848
9786
|
if (firstCharCode === 105 && chunk.charCodeAt(start + 1) === 100 && chunk.charCodeAt(start + 2) === 58) {
|
|
9849
|
-
const value2 = chunk.slice(chunk.charCodeAt(start + 3) ===
|
|
9787
|
+
const value2 = chunk.slice(chunk.charCodeAt(start + 3) === SPACE ? start + 4 : start + 3, end);
|
|
9850
9788
|
id = value2.includes("\0") ? void 0 : value2;
|
|
9851
9789
|
return;
|
|
9852
9790
|
}
|
|
9853
9791
|
if (firstCharCode === 58) {
|
|
9854
9792
|
if (onComment) {
|
|
9855
9793
|
const line2 = chunk.slice(start, end);
|
|
9856
|
-
onComment(line2.slice(chunk.charCodeAt(start + 1) ===
|
|
9794
|
+
onComment(line2.slice(chunk.charCodeAt(start + 1) === SPACE ? 2 : 1));
|
|
9857
9795
|
}
|
|
9858
9796
|
return;
|
|
9859
9797
|
}
|
|
@@ -9862,7 +9800,7 @@ ${value2}`, dataLines++;
|
|
|
9862
9800
|
processField(line, "", line);
|
|
9863
9801
|
return;
|
|
9864
9802
|
}
|
|
9865
|
-
const field = line.slice(0, fieldSeparatorIndex), offset = line.charCodeAt(fieldSeparatorIndex + 1) ===
|
|
9803
|
+
const field = line.slice(0, fieldSeparatorIndex), offset = line.charCodeAt(fieldSeparatorIndex + 1) === SPACE ? 2 : 1, value = line.slice(fieldSeparatorIndex + offset);
|
|
9866
9804
|
processField(field, value, line);
|
|
9867
9805
|
}
|
|
9868
9806
|
function processField(field, value, line) {
|
|
@@ -9912,10 +9850,10 @@ ${value}`, dataLines++;
|
|
|
9912
9850
|
}
|
|
9913
9851
|
return { feed, reset };
|
|
9914
9852
|
}
|
|
9915
|
-
function
|
|
9853
|
+
function isDataPrefix(chunk, i, firstCharCode) {
|
|
9916
9854
|
return firstCharCode === 100 && chunk.charCodeAt(i + 1) === 97 && chunk.charCodeAt(i + 2) === 116 && chunk.charCodeAt(i + 3) === 97 && chunk.charCodeAt(i + 4) === 58;
|
|
9917
9855
|
}
|
|
9918
|
-
function
|
|
9856
|
+
function isEventPrefix(chunk, i, firstCharCode) {
|
|
9919
9857
|
return firstCharCode === 101 && chunk.charCodeAt(i + 1) === 118 && chunk.charCodeAt(i + 2) === 101 && chunk.charCodeAt(i + 3) === 110 && chunk.charCodeAt(i + 4) === 116 && chunk.charCodeAt(i + 5) === 58;
|
|
9920
9858
|
}
|
|
9921
9859
|
var EventSourceParserStream2 = class extends TransformStream {
|
|
@@ -10128,7 +10066,7 @@ function withUserAgentSuffix2(headers, ...userAgentSuffixParts) {
|
|
|
10128
10066
|
);
|
|
10129
10067
|
return Object.fromEntries(normalizedHeaders.entries());
|
|
10130
10068
|
}
|
|
10131
|
-
var VERSION4 = "4.0.
|
|
10069
|
+
var VERSION4 = "4.0.27";
|
|
10132
10070
|
var getOriginalFetch3 = () => globalThis.fetch;
|
|
10133
10071
|
var getFromApi2 = async ({
|
|
10134
10072
|
url,
|
|
@@ -13295,7 +13233,7 @@ async function getVercelRequestId2() {
|
|
|
13295
13233
|
var _a932;
|
|
13296
13234
|
return (_a932 = getContext2().headers) == null ? void 0 : _a932["x-vercel-id"];
|
|
13297
13235
|
}
|
|
13298
|
-
var VERSION5 = "3.0.
|
|
13236
|
+
var VERSION5 = "3.0.112";
|
|
13299
13237
|
var AI_GATEWAY_PROTOCOL_VERSION2 = "0.0.1";
|
|
13300
13238
|
function createGatewayProvider2(options = {}) {
|
|
13301
13239
|
var _a932, _b93;
|
|
@@ -14405,7 +14343,7 @@ function getTotalTimeoutMs(timeout) {
|
|
|
14405
14343
|
}
|
|
14406
14344
|
return timeout.totalMs;
|
|
14407
14345
|
}
|
|
14408
|
-
var VERSION33 = "6.0.
|
|
14346
|
+
var VERSION33 = "6.0.177";
|
|
14409
14347
|
var dataContentSchema3 = z4.z.union([
|
|
14410
14348
|
z4.z.string(),
|
|
14411
14349
|
z4.z.instanceof(Uint8Array),
|
|
@@ -15586,10 +15524,18 @@ createIdGenerator3({
|
|
|
15586
15524
|
prefix: "aitxt",
|
|
15587
15525
|
size: 24
|
|
15588
15526
|
});
|
|
15527
|
+
z4.z.record(
|
|
15528
|
+
z4.z.string(),
|
|
15529
|
+
jsonValueSchema3.optional()
|
|
15530
|
+
);
|
|
15589
15531
|
createIdGenerator3({
|
|
15590
15532
|
prefix: "aitxt",
|
|
15591
15533
|
size: 24
|
|
15592
15534
|
});
|
|
15535
|
+
z4.z.record(
|
|
15536
|
+
z4.z.string(),
|
|
15537
|
+
jsonValueSchema3.optional()
|
|
15538
|
+
);
|
|
15593
15539
|
function splitArray3(array2, chunkSize) {
|
|
15594
15540
|
if (chunkSize <= 0) {
|
|
15595
15541
|
throw new Error("chunkSize must be greater than 0");
|
|
@@ -16110,7 +16056,7 @@ function formatTimestamp(date) {
|
|
|
16110
16056
|
}
|
|
16111
16057
|
function truncateByTokens(text4, maxTokens, hint) {
|
|
16112
16058
|
if (tokenx.estimateTokenCount(text4) <= maxTokens) return { text: text4, wasTruncated: false };
|
|
16113
|
-
const truncated =
|
|
16059
|
+
const truncated = chunkNRYX4QWV_cjs.truncateStringByTokens(text4, maxTokens);
|
|
16114
16060
|
const suffix = hint ? ` [${hint} for more]` : "";
|
|
16115
16061
|
return { text: truncated + suffix, wasTruncated: true };
|
|
16116
16062
|
}
|
|
@@ -16162,11 +16108,11 @@ ${JSON.stringify(inv.args, null, 2)}`;
|
|
|
16162
16108
|
});
|
|
16163
16109
|
}
|
|
16164
16110
|
if (inv.state === "result") {
|
|
16165
|
-
const { value: resultValue } =
|
|
16111
|
+
const { value: resultValue } = chunkNRYX4QWV_cjs.resolveToolResultValue(
|
|
16166
16112
|
part,
|
|
16167
16113
|
inv.result
|
|
16168
16114
|
);
|
|
16169
|
-
const resultStr =
|
|
16115
|
+
const resultStr = chunkNRYX4QWV_cjs.formatToolResultForObserver(resultValue, { maxTokens: HIGH_DETAIL_TOOL_RESULT_TOKENS });
|
|
16170
16116
|
const fullText = `[Tool Result: ${inv.toolName}]
|
|
16171
16117
|
${resultStr}`;
|
|
16172
16118
|
parts.push(makePart(msg, i, "tool-result", fullText, detail, inv.toolName));
|
|
@@ -16193,7 +16139,7 @@ ${typeof rawArgs === "string" ? rawArgs : JSON.stringify(rawArgs, null, 2)}`;
|
|
|
16193
16139
|
const toolName = part.toolName;
|
|
16194
16140
|
if (toolName) {
|
|
16195
16141
|
const rawResult = part.output ?? part.result;
|
|
16196
|
-
const resultStr =
|
|
16142
|
+
const resultStr = chunkNRYX4QWV_cjs.formatToolResultForObserver(rawResult, { maxTokens: HIGH_DETAIL_TOOL_RESULT_TOKENS });
|
|
16197
16143
|
const fullText = `[Tool Result: ${toolName}]
|
|
16198
16144
|
${resultStr}`;
|
|
16199
16145
|
parts.push(makePart(msg, i, "tool-result", fullText, detail, toolName));
|
|
@@ -16272,7 +16218,7 @@ function renderFormattedParts(parts, timestamps, options) {
|
|
|
16272
16218
|
const text4 = buildRenderedText(parts, timestamps);
|
|
16273
16219
|
let totalTokens = tokenx.estimateTokenCount(text4);
|
|
16274
16220
|
if (totalTokens > options.maxTokens) {
|
|
16275
|
-
const truncated =
|
|
16221
|
+
const truncated = chunkNRYX4QWV_cjs.truncateStringByTokens(text4, options.maxTokens);
|
|
16276
16222
|
return { text: truncated, truncated: true, tokenOffset: totalTokens - options.maxTokens };
|
|
16277
16223
|
}
|
|
16278
16224
|
const truncatedIndices = parts.map((p, i) => ({ part: p, index: i })).filter(({ part }) => part.text !== part.fullText).sort((a, b) => expandPriority(a.part) - expandPriority(b.part));
|
|
@@ -16305,7 +16251,7 @@ function renderFormattedParts(parts, timestamps, options) {
|
|
|
16305
16251
|
if (expandedTokens <= options.maxTokens) {
|
|
16306
16252
|
return { text: expanded, truncated: false, tokenOffset: 0 };
|
|
16307
16253
|
}
|
|
16308
|
-
const hardTruncated =
|
|
16254
|
+
const hardTruncated = chunkNRYX4QWV_cjs.truncateStringByTokens(expanded, options.maxTokens);
|
|
16309
16255
|
return { text: hardTruncated, truncated: true, tokenOffset: expandedTokens - options.maxTokens };
|
|
16310
16256
|
}
|
|
16311
16257
|
async function recallPart({
|
|
@@ -16356,7 +16302,7 @@ async function recallPart({
|
|
|
16356
16302
|
|
|
16357
16303
|
`;
|
|
16358
16304
|
const fallbackText = `${fallbackNote}${firstNextPart.text}`;
|
|
16359
|
-
const truncatedText2 =
|
|
16305
|
+
const truncatedText2 = chunkNRYX4QWV_cjs.truncateStringByTokens(fallbackText, maxTokens);
|
|
16360
16306
|
const wasTruncated2 = truncatedText2 !== fallbackText;
|
|
16361
16307
|
return {
|
|
16362
16308
|
text: truncatedText2,
|
|
@@ -16371,7 +16317,7 @@ async function recallPart({
|
|
|
16371
16317
|
}
|
|
16372
16318
|
throw new Error(`Part index ${partIndex} not found in message ${cursor}. Available indices: ${availableIndices}`);
|
|
16373
16319
|
}
|
|
16374
|
-
const truncatedText =
|
|
16320
|
+
const truncatedText = chunkNRYX4QWV_cjs.truncateStringByTokens(target.text, maxTokens);
|
|
16375
16321
|
const wasTruncated = truncatedText !== target.text;
|
|
16376
16322
|
return {
|
|
16377
16323
|
text: truncatedText,
|
|
@@ -17154,10 +17100,16 @@ function extractWorkingMemoryContent(text4) {
|
|
|
17154
17100
|
return text4.substring(contentStart, end);
|
|
17155
17101
|
}
|
|
17156
17102
|
function isSystemReminderMessage(message) {
|
|
17157
|
-
if (
|
|
17103
|
+
if (!isRecord(message.content)) {
|
|
17158
17104
|
return false;
|
|
17159
17105
|
}
|
|
17160
17106
|
const metadata = message.content.metadata;
|
|
17107
|
+
if (message.role === "signal") {
|
|
17108
|
+
return isRecord(metadata) && isRecord(metadata.signal) && metadata.signal.type === "system-reminder";
|
|
17109
|
+
}
|
|
17110
|
+
if (message.role !== "user") {
|
|
17111
|
+
return false;
|
|
17112
|
+
}
|
|
17161
17113
|
if (isRecord(metadata) && (isRecord(metadata.systemReminder) || LEGACY_SYSTEM_REMINDER_METADATA_KEY in metadata)) {
|
|
17162
17114
|
return true;
|
|
17163
17115
|
}
|
|
@@ -18123,7 +18075,7 @@ ${workingMemory}`;
|
|
|
18123
18075
|
"Observational memory requires @mastra/core support for request-response-id-rotation. Please bump @mastra/core to a newer version."
|
|
18124
18076
|
);
|
|
18125
18077
|
}
|
|
18126
|
-
const { ObservationalMemory: OMClass } = await import('./observational-memory-
|
|
18078
|
+
const { ObservationalMemory: OMClass } = await import('./observational-memory-TZ67ZA32.cjs');
|
|
18127
18079
|
const onIndexObservations = this.hasRetrievalSearch(omConfig.retrieval) ? async (observation) => {
|
|
18128
18080
|
await this.indexObservation(observation);
|
|
18129
18081
|
} : void 0;
|
|
@@ -19049,7 +19001,7 @@ Notes:
|
|
|
19049
19001
|
if (!effectiveConfig) return null;
|
|
19050
19002
|
const engine = await this.omEngine;
|
|
19051
19003
|
if (!engine) return null;
|
|
19052
|
-
const { ObservationalMemoryProcessor } = await import('./observational-memory-
|
|
19004
|
+
const { ObservationalMemoryProcessor } = await import('./observational-memory-TZ67ZA32.cjs');
|
|
19053
19005
|
return new ObservationalMemoryProcessor(engine, this, {
|
|
19054
19006
|
temporalMarkers: effectiveConfig.temporalMarkers
|
|
19055
19007
|
});
|
|
@@ -19058,11 +19010,11 @@ Notes:
|
|
|
19058
19010
|
|
|
19059
19011
|
Object.defineProperty(exports, "ModelByInputTokens", {
|
|
19060
19012
|
enumerable: true,
|
|
19061
|
-
get: function () { return
|
|
19013
|
+
get: function () { return chunkNRYX4QWV_cjs.ModelByInputTokens; }
|
|
19062
19014
|
});
|
|
19063
19015
|
Object.defineProperty(exports, "getObservationsAsOf", {
|
|
19064
19016
|
enumerable: true,
|
|
19065
|
-
get: function () { return
|
|
19017
|
+
get: function () { return chunkNRYX4QWV_cjs.getObservationsAsOf; }
|
|
19066
19018
|
});
|
|
19067
19019
|
Object.defineProperty(exports, "MessageHistory", {
|
|
19068
19020
|
enumerable: true,
|