@mastra/server 1.83.0-alpha.4 → 1.83.0-alpha.6
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/dist/{agent-builder-73cAYGts.cjs → agent-builder-BP3doUBF.cjs} +2 -2
- package/dist/{agent-builder-73cAYGts.cjs.map → agent-builder-BP3doUBF.cjs.map} +1 -1
- package/dist/{agent-builder-pQaGXyFz.js → agent-builder-tQdzjW0P.js} +2 -2
- package/dist/{agent-builder-pQaGXyFz.js.map → agent-builder-tQdzjW0P.js.map} +1 -1
- package/dist/{api-schema-manifest-C4KWBHOE.cjs → api-schema-manifest-Bsbh_Rp6.cjs} +2 -2
- package/dist/{api-schema-manifest-C4KWBHOE.cjs.map → api-schema-manifest-Bsbh_Rp6.cjs.map} +1 -1
- package/dist/{api-schema-manifest-BNmKPj1d.js → api-schema-manifest-BuUPZy-0.js} +2 -2
- package/dist/{api-schema-manifest-BNmKPj1d.js.map → api-schema-manifest-BuUPZy-0.js.map} +1 -1
- package/dist/{dist-CXxA_Jnu.js → dist-C3cKdDos.js} +82 -21
- package/dist/{dist-CXxA_Jnu.js.map → dist-C3cKdDos.js.map} +1 -1
- package/dist/dist-CDQ0dDmK.js +1 -0
- package/dist/{dist-Dhi6UZwv.cjs → dist-DlH7rr5l.cjs} +1 -1
- package/dist/{dist-DIeKEdwH.cjs → dist-bVYV7beH.cjs} +82 -21
- package/dist/{dist-DIeKEdwH.cjs.map → dist-bVYV7beH.cjs.map} +1 -1
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/{helpers-B29a1nM3.js → helpers-C3dENOkQ.js} +183 -53
- package/dist/helpers-C3dENOkQ.js.map +1 -0
- package/dist/{helpers-CylvUIZm.cjs → helpers-D7d2R3LL.cjs} +188 -52
- package/dist/helpers-D7d2R3LL.cjs.map +1 -0
- package/dist/{memory-JzgWJevA.js → memory-B_qwCpu5.js} +89 -39
- package/dist/memory-B_qwCpu5.js.map +1 -0
- package/dist/{memory-DIos0BE-.cjs → memory-BfabRYCo.cjs} +89 -39
- package/dist/memory-BfabRYCo.cjs.map +1 -0
- package/dist/{probe-image-size-C2efNs3R.cjs → probe-image-size-0dhxcl8e.cjs} +2 -2
- package/dist/{probe-image-size-C2efNs3R.cjs.map → probe-image-size-0dhxcl8e.cjs.map} +1 -1
- package/dist/{probe-image-size-CO02-278.js → probe-image-size-fFwPOWWg.js} +2 -2
- package/dist/{probe-image-size-CO02-278.js.map → probe-image-size-fFwPOWWg.js.map} +1 -1
- package/dist/route-builder-BKEzjw_M.js.map +1 -1
- package/dist/route-builder-DHqDrSSy.cjs.map +1 -1
- package/dist/{routes-BtJyuAGq.cjs → routes-B0HqAMAk.cjs} +3 -3
- package/dist/{routes-BtJyuAGq.cjs.map → routes-B0HqAMAk.cjs.map} +1 -1
- package/dist/{routes-DgMuPPQr.js → routes-u0J9BsY1.js} +3 -3
- package/dist/{routes-DgMuPPQr.js.map → routes-u0J9BsY1.js.map} +1 -1
- package/dist/server/auth/custom-route-matcher.d.ts +54 -0
- package/dist/server/auth/custom-route-matcher.d.ts.map +1 -0
- package/dist/server/auth/helpers.d.ts +14 -5
- package/dist/server/auth/helpers.d.ts.map +1 -1
- package/dist/server/auth/index.cjs +1 -1
- package/dist/server/auth/index.js +1 -1
- package/dist/server/auth/path-pattern.d.ts.map +1 -1
- package/dist/server/handlers/agent-builder.cjs +1 -1
- package/dist/server/handlers/agent-builder.js +1 -1
- package/dist/server/handlers/auth.cjs +1 -1
- package/dist/server/handlers/auth.js +1 -1
- package/dist/server/handlers/datasets.cjs +22 -3
- package/dist/server/handlers/datasets.cjs.map +1 -1
- package/dist/server/handlers/datasets.d.ts +8 -2
- package/dist/server/handlers/datasets.d.ts.map +1 -1
- package/dist/server/handlers/datasets.js +22 -3
- package/dist/server/handlers/datasets.js.map +1 -1
- package/dist/server/handlers/memory.cjs +1 -1
- package/dist/server/handlers/memory.d.ts.map +1 -1
- package/dist/server/handlers/memory.js +1 -1
- package/dist/server/handlers/system.cjs +1 -1
- package/dist/server/handlers/system.js +1 -1
- package/dist/server/handlers.cjs +2 -2
- package/dist/server/handlers.js +2 -2
- package/dist/server/server-adapter/api-schema-manifest.d.ts +1 -1
- package/dist/server/server-adapter/index.cjs +68 -4
- package/dist/server/server-adapter/index.cjs.map +1 -1
- package/dist/server/server-adapter/index.d.ts +34 -0
- package/dist/server/server-adapter/index.d.ts.map +1 -1
- package/dist/server/server-adapter/index.js +68 -4
- package/dist/server/server-adapter/index.js.map +1 -1
- package/dist/server/server-adapter/openapi-utils.d.ts +1 -1
- package/dist/server/server-adapter/routes/datasets.d.ts +8 -2
- package/dist/server/server-adapter/routes/datasets.d.ts.map +1 -1
- package/dist/server/server-adapter/routes/workspace.d.ts +23 -23
- package/package.json +4 -4
- package/dist/dist-CQGBYe6U.js +0 -1
- package/dist/helpers-B29a1nM3.js.map +0 -1
- package/dist/helpers-CylvUIZm.cjs.map +0 -1
- package/dist/memory-DIos0BE-.cjs.map +0 -1
- package/dist/memory-JzgWJevA.js.map +0 -1
- /package/dist/_types/{@mastra_schema-compat@1.3.17 → @mastra_schema-compat@1.3.18-alpha.0}/dist/_types/@internal_ai-sdk-v4@0.0.95/dist/index.d.ts +0 -0
- /package/dist/_types/{@mastra_schema-compat@1.3.17 → @mastra_schema-compat@1.3.18-alpha.0}/dist/_types/@internal_ai-sdk-v5@0.0.95/dist/index.d.ts +0 -0
- /package/dist/_types/{@mastra_schema-compat@1.3.17 → @mastra_schema-compat@1.3.18-alpha.0}/dist/_types/@internal_ai-v6@0.0.95/dist/index.d.ts +0 -0
- /package/dist/_types/{@mastra_schema-compat@1.3.17 → @mastra_schema-compat@1.3.18-alpha.0}/dist/_types/@standard-schema_spec@1.1.0/dist/index.d.ts +0 -0
- /package/dist/_types/{@mastra_schema-compat@1.3.17 → @mastra_schema-compat@1.3.18-alpha.0}/dist/_types/@types_json-schema@7.0.15/index.d.ts +0 -0
- /package/dist/_types/{@mastra_schema-compat@1.3.17 → @mastra_schema-compat@1.3.18-alpha.0}/dist/index.d.ts +0 -0
- /package/dist/_types/{@mastra_schema-compat@1.3.17 → @mastra_schema-compat@1.3.18-alpha.0}/dist/null-to-undefined.d.ts +0 -0
- /package/dist/_types/{@mastra_schema-compat@1.3.17 → @mastra_schema-compat@1.3.18-alpha.0}/dist/provider-compats/anthropic.d.ts +0 -0
- /package/dist/_types/{@mastra_schema-compat@1.3.17 → @mastra_schema-compat@1.3.18-alpha.0}/dist/provider-compats/deepseek.d.ts +0 -0
- /package/dist/_types/{@mastra_schema-compat@1.3.17 → @mastra_schema-compat@1.3.18-alpha.0}/dist/provider-compats/google.d.ts +0 -0
- /package/dist/_types/{@mastra_schema-compat@1.3.17 → @mastra_schema-compat@1.3.18-alpha.0}/dist/provider-compats/meta.d.ts +0 -0
- /package/dist/_types/{@mastra_schema-compat@1.3.17 → @mastra_schema-compat@1.3.18-alpha.0}/dist/provider-compats/openai-reasoning.d.ts +0 -0
- /package/dist/_types/{@mastra_schema-compat@1.3.17 → @mastra_schema-compat@1.3.18-alpha.0}/dist/provider-compats/openai.d.ts +0 -0
- /package/dist/_types/{@mastra_schema-compat@1.3.17 → @mastra_schema-compat@1.3.18-alpha.0}/dist/schema-compatibility-v3.d.ts +0 -0
- /package/dist/_types/{@mastra_schema-compat@1.3.17 → @mastra_schema-compat@1.3.18-alpha.0}/dist/schema-compatibility-v4.d.ts +0 -0
- /package/dist/_types/{@mastra_schema-compat@1.3.17 → @mastra_schema-compat@1.3.18-alpha.0}/dist/schema-compatibility.d.ts +0 -0
- /package/dist/_types/{@mastra_schema-compat@1.3.17 → @mastra_schema-compat@1.3.18-alpha.0}/dist/schema.d.ts +0 -0
- /package/dist/_types/{@mastra_schema-compat@1.3.17 → @mastra_schema-compat@1.3.18-alpha.0}/dist/schema.types.d.ts +0 -0
- /package/dist/_types/{@mastra_schema-compat@1.3.17 → @mastra_schema-compat@1.3.18-alpha.0}/dist/standard-schema/standard-schema.d.ts +0 -0
- /package/dist/_types/{@mastra_schema-compat@1.3.17 → @mastra_schema-compat@1.3.18-alpha.0}/dist/standard-schema/standard-schema.types.d.ts +0 -0
- /package/dist/_types/{@mastra_schema-compat@1.3.17 → @mastra_schema-compat@1.3.18-alpha.0}/dist/standard-schema-compat.d.ts +0 -0
- /package/dist/_types/{@mastra_schema-compat@1.3.17 → @mastra_schema-compat@1.3.18-alpha.0}/dist/types.d.ts +0 -0
- /package/dist/_types/{@mastra_schema-compat@1.3.17 → @mastra_schema-compat@1.3.18-alpha.0}/dist/utils.d.ts +0 -0
- /package/dist/_types/{@mastra_schema-compat@1.3.17 → @mastra_schema-compat@1.3.18-alpha.0}/dist/zod-to-json.d.ts +0 -0
- /package/dist/_types/{@mastra_schema-compat@1.3.17 → @mastra_schema-compat@1.3.18-alpha.0}/package.json +0 -0
|
@@ -8654,7 +8654,7 @@ function splitLines(text) {
|
|
|
8654
8654
|
else result.push(result.pop().slice(0, -1));
|
|
8655
8655
|
return result;
|
|
8656
8656
|
}
|
|
8657
|
-
// ../memory/dist/src-
|
|
8657
|
+
// ../memory/dist/src-KIKQ7ztT.js
|
|
8658
8658
|
var __defProp$3 = Object.defineProperty;
|
|
8659
8659
|
var __exportAll = (all, no_symbols) => {
|
|
8660
8660
|
let target = {};
|
|
@@ -32492,6 +32492,9 @@ Observation groups with range IDs and your recall tool allows you to think back
|
|
|
32492
32492
|
### Additional recall guidance
|
|
32493
32493
|
${custom}`;
|
|
32494
32494
|
}
|
|
32495
|
+
/** Sentinel a required inline section uses to signal that no update is needed. */
|
|
32496
|
+
const UNCHANGED_EXTRACTOR_VALUE = "UNCHANGED";
|
|
32497
|
+
const UNCHANGED_PATTERN = new RegExp(`^[\\s\`'"*]*${UNCHANGED_EXTRACTOR_VALUE}[\\s\`'"*.!]*$`, "i");
|
|
32495
32498
|
const BUILT_IN_SLUGS = /* @__PURE__ */ new Set([
|
|
32496
32499
|
"current-task",
|
|
32497
32500
|
"suggested-response",
|
|
@@ -32557,11 +32560,16 @@ var Extractor = class Extractor {
|
|
|
32557
32560
|
metadataKeyPath;
|
|
32558
32561
|
onExtracted;
|
|
32559
32562
|
retryStructuredExtractionOnEmptyObject;
|
|
32563
|
+
/**
|
|
32564
|
+
* @internal Require this inline section in single-thread observer calls. A missing section is recorded as an
|
|
32565
|
+
* extraction failure, and `UNCHANGED` is skipped rather than stored. Batched multi-thread calls treat it as optional.
|
|
32566
|
+
*/
|
|
32567
|
+
required;
|
|
32560
32568
|
/** @internal */
|
|
32561
32569
|
internal;
|
|
32562
32570
|
instructionsConfig;
|
|
32563
32571
|
schemaConfig;
|
|
32564
|
-
constructor(config, internal = false) {
|
|
32572
|
+
constructor(config, internal = false, required = false) {
|
|
32565
32573
|
const name = config.name.trim();
|
|
32566
32574
|
const instructions = typeof config.instructions === "string" ? config.instructions.trim() : void 0;
|
|
32567
32575
|
const slug = slugifyExtractorName(name);
|
|
@@ -32584,6 +32592,7 @@ var Extractor = class Extractor {
|
|
|
32584
32592
|
this.metadataKeyPath = isHook ? false : config.metadataKeyPath ?? `extracted.${slug}`;
|
|
32585
32593
|
this.onExtracted = config.onExtracted;
|
|
32586
32594
|
this.retryStructuredExtractionOnEmptyObject = config.retryStructuredExtractionOnEmptyObject ?? false;
|
|
32595
|
+
this.required = required;
|
|
32587
32596
|
this.internal = internal;
|
|
32588
32597
|
}
|
|
32589
32598
|
async resolve(context) {
|
|
@@ -32599,7 +32608,7 @@ var Extractor = class Extractor {
|
|
|
32599
32608
|
metadataKeyPath: this.metadataKeyPath,
|
|
32600
32609
|
onExtracted: this.onExtracted,
|
|
32601
32610
|
retryStructuredExtractionOnEmptyObject: this.retryStructuredExtractionOnEmptyObject
|
|
32602
|
-
}, this.internal);
|
|
32611
|
+
}, this.internal, this.required);
|
|
32603
32612
|
}
|
|
32604
32613
|
};
|
|
32605
32614
|
async function resolveExtractors(extractors, context) {
|
|
@@ -32654,6 +32663,7 @@ function parseExtractedValues(output, extractors) {
|
|
|
32654
32663
|
const values = {};
|
|
32655
32664
|
const failures = [];
|
|
32656
32665
|
const inlineExtractors = extractors.filter((extractor) => extractor.mode === "inline");
|
|
32666
|
+
const unchangedSlugs = /* @__PURE__ */ new Set();
|
|
32657
32667
|
const regex = new RegExp(`<${EXTRACTED_VALUES_TAG}>([\\s\\S]*?)<\\/${EXTRACTED_VALUES_TAG}>`, "gi");
|
|
32658
32668
|
const matches = [...output.matchAll(regex)];
|
|
32659
32669
|
for (const match of matches) try {
|
|
@@ -32663,6 +32673,10 @@ function parseExtractedValues(output, extractors) {
|
|
|
32663
32673
|
if (!Object.prototype.hasOwnProperty.call(extractedValues, extractor.slug)) continue;
|
|
32664
32674
|
const rawValue = extractedValues[extractor.slug];
|
|
32665
32675
|
if (rawValue === void 0 || rawValue === null || rawValue === "") continue;
|
|
32676
|
+
if (extractor.required && typeof rawValue === "string" && UNCHANGED_PATTERN.test(rawValue)) {
|
|
32677
|
+
unchangedSlugs.add(extractor.slug);
|
|
32678
|
+
continue;
|
|
32679
|
+
}
|
|
32666
32680
|
const parsed = extractor.schema.safeParse(rawValue);
|
|
32667
32681
|
if (parsed.success) values[extractor.slug] = parsed.data;
|
|
32668
32682
|
else failures.push({
|
|
@@ -32677,10 +32691,17 @@ function parseExtractedValues(output, extractors) {
|
|
|
32677
32691
|
});
|
|
32678
32692
|
}
|
|
32679
32693
|
for (const extractor of inlineExtractors) {
|
|
32680
|
-
if (Object.prototype.hasOwnProperty.call(values, extractor.slug)) continue;
|
|
32694
|
+
if (Object.prototype.hasOwnProperty.call(values, extractor.slug) || unchangedSlugs.has(extractor.slug)) continue;
|
|
32681
32695
|
const tagRegex = new RegExp(`<${extractor.slug}>([\\s\\S]*?)<\\/${extractor.slug}>`, "gi");
|
|
32682
32696
|
const rawValue = [...output.matchAll(tagRegex)].at(-1)?.[1]?.trim();
|
|
32683
|
-
if (!rawValue)
|
|
32697
|
+
if (!rawValue) {
|
|
32698
|
+
if (extractor.required) failures.push({
|
|
32699
|
+
slug: extractor.slug,
|
|
32700
|
+
error: `Observer output did not include the required <${extractor.slug}> section`
|
|
32701
|
+
});
|
|
32702
|
+
continue;
|
|
32703
|
+
}
|
|
32704
|
+
if (extractor.required && UNCHANGED_PATTERN.test(rawValue)) continue;
|
|
32684
32705
|
try {
|
|
32685
32706
|
values[extractor.slug] = parseExtractorValue(extractor, rawValue);
|
|
32686
32707
|
} catch (error) {
|
|
@@ -32701,13 +32722,21 @@ function stripExtractorSections(output, extractors) {
|
|
|
32701
32722
|
for (const extractor of inlineExtractors) stripped = stripped.replace(new RegExp(`[ \\t]*<${extractor.slug}>[\\s\\S]*?<\\/${extractor.slug}>\\s*`, "gi"), "");
|
|
32702
32723
|
return stripped;
|
|
32703
32724
|
}
|
|
32725
|
+
/**
|
|
32726
|
+
* Batched multi-thread observer calls share one output across threads, so a per-thread required
|
|
32727
|
+
* section would duplicate resource-level values and record spurious failures. Treat them as optional there.
|
|
32728
|
+
*/
|
|
32729
|
+
function withoutRequiredSections(extractors) {
|
|
32730
|
+
return extractors.map((extractor) => extractor.required ? Object.assign(Object.create(Object.getPrototypeOf(extractor)), extractor, { required: false }) : extractor);
|
|
32731
|
+
}
|
|
32704
32732
|
function buildExtractorOutputSections(extractors) {
|
|
32705
32733
|
const inlineExtractors = extractors.filter((extractor) => extractor.mode === "inline");
|
|
32706
32734
|
if (inlineExtractors.length === 0) return "";
|
|
32707
|
-
|
|
32735
|
+
const sections = inlineExtractors.map((extractor) => `<${extractor.slug}>
|
|
32708
32736
|
${extractor.instructions}
|
|
32709
|
-
Include this section when the observations contain relevant information for <${extractor.slug}>. Write only that information inside the tag
|
|
32710
|
-
</${extractor.slug}>`).join("\n\n")
|
|
32737
|
+
${extractor.required ? `This section is REQUIRED: always output <${extractor.slug}>. If nothing needs to change, write exactly ${UNCHANGED_EXTRACTOR_VALUE} inside the tag.` : `Include this section when the observations contain relevant information for <${extractor.slug}>. Write only that information inside the tag.`}
|
|
32738
|
+
</${extractor.slug}>`).join("\n\n");
|
|
32739
|
+
return `${inlineExtractors.some((extractor) => extractor.required) ? "Additional XML sections:\nOutput these tags after <observations>, following the instructions in each tag." : "Additional optional XML sections:\nIf the observations include information relevant to any of these tags, output that tag after <observations> and include the relevant information."}\n${sections}`;
|
|
32711
32740
|
}
|
|
32712
32741
|
function renderPriorValue(value) {
|
|
32713
32742
|
return typeof value === "string" ? value : JSON.stringify(value);
|
|
@@ -36136,6 +36165,11 @@ var ObserverRunner = class {
|
|
|
36136
36165
|
});
|
|
36137
36166
|
const extractedValues = mergeExtractedValues(parsed.extractedValues, structuredExtraction.values);
|
|
36138
36167
|
const extractionFailures = mergeExtractionFailures(parsed.extractionFailures, structuredExtraction.failures);
|
|
36168
|
+
const failedSlugs = activeExtractors.filter((extractor) => extractor.mode === "inline" && extractor.required).map((extractor) => extractor.slug).filter((slug) => parsed.extractionFailures?.some((failure) => failure.slug === slug));
|
|
36169
|
+
if (failedSlugs.length > 0) this.mastra?.getLogger?.().warn("OM observer could not extract required sections", {
|
|
36170
|
+
failedSlugs,
|
|
36171
|
+
threadId: messagesToObserve[0]?.threadId
|
|
36172
|
+
});
|
|
36139
36173
|
const builtIns = getBuiltInExtractedValues(extractedValues);
|
|
36140
36174
|
const systemPrompt = buildObserverSystemPrompt(false, this.observationConfig.instruction, this.observationConfig.threadTitle, activeExtractors);
|
|
36141
36175
|
this.lastExchange = {
|
|
@@ -36268,10 +36302,11 @@ var ObserverRunner = class {
|
|
|
36268
36302
|
usage: totalUsage
|
|
36269
36303
|
};
|
|
36270
36304
|
}
|
|
36271
|
-
const
|
|
36305
|
+
const batchExtractors = withoutRequiredSections(activeExtractors);
|
|
36306
|
+
const agent = this.createAgent(resolvedModel.model, true, void 0, batchExtractors);
|
|
36272
36307
|
const internalRequestContext = withOmInternalThreadId(requestContext, agent.id);
|
|
36273
36308
|
const multiThreadAttachmentFilter = this.resolveAttachmentFilter(resolvedModel.model, requestContext);
|
|
36274
|
-
const observerMessages = [buildMultiThreadObserverRequestMessage(existingObservations, messagesByThread, threadOrder, priorMetadataByThread, wasTruncated, this.observationConfig.threadTitle,
|
|
36309
|
+
const observerMessages = [buildMultiThreadObserverRequestMessage(existingObservations, messagesByThread, threadOrder, priorMetadataByThread, wasTruncated, this.observationConfig.threadTitle, batchExtractors, {
|
|
36275
36310
|
attachmentFilter: multiThreadAttachmentFilter,
|
|
36276
36311
|
timeZone
|
|
36277
36312
|
})];
|
|
@@ -36327,12 +36362,12 @@ var ObserverRunner = class {
|
|
|
36327
36362
|
});
|
|
36328
36363
|
};
|
|
36329
36364
|
let result = await doGenerate();
|
|
36330
|
-
let parsed = parseMultiThreadObserverOutput(result.text,
|
|
36365
|
+
let parsed = parseMultiThreadObserverOutput(result.text, batchExtractors);
|
|
36331
36366
|
let retriedDueToDegenerate = false;
|
|
36332
36367
|
if (parsed.degenerate) {
|
|
36333
36368
|
omDebug(`[OM:callMultiThreadObserver] degenerate repetition detected, retrying once. ${describeDegenerateOutput(result.text, 2e3)}`);
|
|
36334
36369
|
result = await doGenerate();
|
|
36335
|
-
parsed = parseMultiThreadObserverOutput(result.text,
|
|
36370
|
+
parsed = parseMultiThreadObserverOutput(result.text, batchExtractors);
|
|
36336
36371
|
retriedDueToDegenerate = true;
|
|
36337
36372
|
if (parsed.degenerate) {
|
|
36338
36373
|
omDebug(`[OM:callMultiThreadObserver] degenerate repetition on retry, failing. ${describeDegenerateOutput(result.text, 2e3)}`);
|
|
@@ -36343,7 +36378,7 @@ var ObserverRunner = class {
|
|
|
36343
36378
|
const aggregatedExtractedValues = mergeExtractedValues(...Array.from(parsed.threads, ([threadId, threadResult]) => mergeExtractedValues(threadResult.extractedValues, structuredExtractionByThread.get(threadId)?.values)));
|
|
36344
36379
|
const aggregatedExtractionFailures = mergeExtractionFailures(...Array.from(parsed.threads, ([threadId, threadResult]) => mergeExtractionFailures(threadResult.extractionFailures, structuredExtractionByThread.get(threadId)?.failures)));
|
|
36345
36380
|
const aggregatedBuiltIns = getBuiltInExtractedValues(aggregatedExtractedValues);
|
|
36346
|
-
const systemPrompt = buildObserverSystemPrompt(true, this.observationConfig.instruction, this.observationConfig.threadTitle,
|
|
36381
|
+
const systemPrompt = buildObserverSystemPrompt(true, this.observationConfig.instruction, this.observationConfig.threadTitle, batchExtractors);
|
|
36347
36382
|
this.lastExchange = {
|
|
36348
36383
|
systemPrompt,
|
|
36349
36384
|
observerMessages,
|
|
@@ -36375,7 +36410,7 @@ var ObserverRunner = class {
|
|
|
36375
36410
|
threadTitle: builtIns.threadTitle ?? threadResult.threadTitle,
|
|
36376
36411
|
extractedValues,
|
|
36377
36412
|
extractionFailures,
|
|
36378
|
-
extractors:
|
|
36413
|
+
extractors: batchExtractors
|
|
36379
36414
|
});
|
|
36380
36415
|
}
|
|
36381
36416
|
for (const threadId of results.keys()) for (const msg of messagesByThread.get(threadId) ?? []) this.observedMessageIds.add(msg.id);
|
|
@@ -36414,7 +36449,8 @@ function assertRecognizedObserverOutput(output, label, isRecognized) {
|
|
|
36414
36449
|
function hasSingleThreadObserverContent(text, extractors) {
|
|
36415
36450
|
if (/^[ \t]*<observations>/im.test(text)) return true;
|
|
36416
36451
|
const parsed = parseObserverOutput(text, extractors);
|
|
36417
|
-
|
|
36452
|
+
const requiredSlugs = new Set(extractors.filter((extractor) => extractor.mode === "inline" && extractor.required).map((extractor) => extractor.slug));
|
|
36453
|
+
return Boolean(parsed.degenerate || parsed.observations || parsed.currentTask || parsed.suggestedContinuation || parsed.threadTitle || Object.keys(parsed.extractedValues ?? {}).length || parsed.extractionFailures?.some((failure) => !requiredSlugs.has(failure.slug)));
|
|
36418
36454
|
}
|
|
36419
36455
|
/**
|
|
36420
36456
|
* Multi-thread replies carry every recognised section inside `<thread>` blocks, so a reply
|
|
@@ -36735,7 +36771,7 @@ async function resolveImageDimensionsAsync(part) {
|
|
|
36735
36771
|
const url = resolveHttpAssetUrl(getObjectValue(part, "image") ?? getObjectValue(part, "data"));
|
|
36736
36772
|
if (!url) return existing;
|
|
36737
36773
|
try {
|
|
36738
|
-
const probeImageSize = (await import("./probe-image-size-
|
|
36774
|
+
const probeImageSize = (await import("./probe-image-size-fFwPOWWg.js").then((m) => /* @__PURE__ */ __toESM$1(m.default, 1))).default;
|
|
36739
36775
|
const probed = await probeImageSize(url, {
|
|
36740
36776
|
open_timeout: REMOTE_IMAGE_PROBE_TIMEOUT_MS,
|
|
36741
36777
|
response_timeout: REMOTE_IMAGE_PROBE_TIMEOUT_MS,
|
|
@@ -38312,7 +38348,7 @@ var WorkingMemoryExtractor = class extends Extractor {
|
|
|
38312
38348
|
});
|
|
38313
38349
|
return document;
|
|
38314
38350
|
}
|
|
38315
|
-
});
|
|
38351
|
+
}, false, true);
|
|
38316
38352
|
}
|
|
38317
38353
|
};
|
|
38318
38354
|
/**
|
|
@@ -38673,6 +38709,31 @@ function wrapInObservationGroup(observations, range, id = generateAnchorId(), _s
|
|
|
38673
38709
|
const content = observations.trim();
|
|
38674
38710
|
return `<observation-group id="${id}" range="${range}"${kind ? ` kind="${kind}"` : ""}>\n${content}\n</observation-group>`;
|
|
38675
38711
|
}
|
|
38712
|
+
function isObservationGroupOpeningLine(line) {
|
|
38713
|
+
const trimmed = line.trimStart();
|
|
38714
|
+
return trimmed.startsWith(OBSERVATION_GROUP_OPEN) && /\s/.test(trimmed[18] ?? "");
|
|
38715
|
+
}
|
|
38716
|
+
/**
|
|
38717
|
+
* Moves a cut of `cut` leading lines so it never splits an observation group. A cut inside a group
|
|
38718
|
+
* moves back to just before the group's opening tag (and the blank lines that separate it from the
|
|
38719
|
+
* previous group). When nothing precedes that group, the cut moves forward to just after its closing
|
|
38720
|
+
* tag instead, so the whole group is cut. A cut outside every group, and observations without group
|
|
38721
|
+
* tags, are returned unchanged.
|
|
38722
|
+
*/
|
|
38723
|
+
function alignLineCutToObservationGroups(lines, cut) {
|
|
38724
|
+
let openingLine = -1;
|
|
38725
|
+
for (let i = 0; i < cut; i++) {
|
|
38726
|
+
const line = lines[i];
|
|
38727
|
+
if (isObservationGroupOpeningLine(line)) openingLine = i;
|
|
38728
|
+
else if (line.trim() === OBSERVATION_GROUP_CLOSE) openingLine = -1;
|
|
38729
|
+
}
|
|
38730
|
+
if (openingLine === -1) return cut;
|
|
38731
|
+
let before = openingLine;
|
|
38732
|
+
while (before > 0 && lines[before - 1].trim() === "") before--;
|
|
38733
|
+
if (before > 0) return before;
|
|
38734
|
+
for (let i = cut; i < lines.length; i++) if (lines[i].trim() === OBSERVATION_GROUP_CLOSE) return i + 1;
|
|
38735
|
+
return cut;
|
|
38736
|
+
}
|
|
38676
38737
|
function parseObservationGroups(observations) {
|
|
38677
38738
|
if (!observations) return [];
|
|
38678
38739
|
const groups = [];
|
|
@@ -44468,7 +44529,7 @@ var ReflectorRunner = class {
|
|
|
44468
44529
|
const totalLines = allLines.length;
|
|
44469
44530
|
const avgTokensPerLine = totalLines > 0 ? observationTokens / totalLines : 0;
|
|
44470
44531
|
const activationPointTokens = reflectThreshold * bufferActivation;
|
|
44471
|
-
const linesToReflect = avgTokensPerLine > 0 ? Math.min(Math.floor(activationPointTokens / avgTokensPerLine), totalLines) : totalLines;
|
|
44532
|
+
const linesToReflect = alignLineCutToObservationGroups(allLines, avgTokensPerLine > 0 ? Math.min(Math.floor(activationPointTokens / avgTokensPerLine), totalLines) : totalLines);
|
|
44472
44533
|
const hookContext = {
|
|
44473
44534
|
threadId: currentRecord.threadId ?? void 0,
|
|
44474
44535
|
resourceId: currentRecord.resourceId ?? void 0,
|
|
@@ -49125,7 +49186,7 @@ var Memory = class Memory extends MastraMemory {
|
|
|
49125
49186
|
const config = this.getMergedThreadConfig(memoryConfig || {});
|
|
49126
49187
|
this.assertWorkingMemoryStateSignalsCompatibility(config);
|
|
49127
49188
|
if (!config.workingMemory?.enabled) throw new Error("Working memory is not enabled for this memory instance");
|
|
49128
|
-
const mutexKey =
|
|
49189
|
+
const mutexKey = (config.workingMemory.scope || "resource") === "resource" ? `resource-${resourceId}` : `thread-${threadId}`;
|
|
49129
49190
|
const mutex = this.updateWorkingMemoryMutexes.has(mutexKey) ? this.updateWorkingMemoryMutexes.get(mutexKey) : new Mutex();
|
|
49130
49191
|
this.updateWorkingMemoryMutexes.set(mutexKey, mutex);
|
|
49131
49192
|
const release = await mutex.acquire();
|
|
@@ -51946,7 +52007,7 @@ const createModelInstance = async (provider, modelId, version = "v2") => {
|
|
|
51946
52007
|
try {
|
|
51947
52008
|
const providerFn = version === `v1` ? { v1: {
|
|
51948
52009
|
openai: async () => {
|
|
51949
|
-
const { openai } = await import("./dist-
|
|
52010
|
+
const { openai } = await import("./dist-CDQ0dDmK.js");
|
|
51950
52011
|
return openai(modelId);
|
|
51951
52012
|
},
|
|
51952
52013
|
anthropic: async () => {
|
|
@@ -59702,4 +59763,4 @@ function createAgentBuilderWorkflows() {
|
|
|
59702
59763
|
}
|
|
59703
59764
|
export { require_tiff as a, require_png as c, createAgentBuilderWorkflows, require_gif as d, require_bmp as f, require_webp as i, require_jpeg as l, require_utils as m, openai as n, require_svg as o, require_avif as p, require_sync as r, require_psd as s, createOpenAI as t, require_ico as u };
|
|
59704
59765
|
|
|
59705
|
-
//# sourceMappingURL=dist-
|
|
59766
|
+
//# sourceMappingURL=dist-C3cKdDos.js.map
|