@mastra/server 1.18.1-alpha.0 → 1.19.0
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 +25 -0
- package/dist/{chunk-U5XW3WOS.js → chunk-5CDCKTHB.js} +38 -20
- package/dist/chunk-5CDCKTHB.js.map +1 -0
- package/dist/{chunk-POOOTRUM.cjs → chunk-DAEHQAZC.cjs} +38 -20
- package/dist/chunk-DAEHQAZC.cjs.map +1 -0
- package/dist/{chunk-FTGC7KXM.js → chunk-TV5D5RRD.js} +132 -17
- package/dist/chunk-TV5D5RRD.js.map +1 -0
- package/dist/{chunk-MS7GNCN3.cjs → chunk-YSCEBPUJ.cjs} +145 -30
- package/dist/chunk-YSCEBPUJ.cjs.map +1 -0
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/docs/references/docs-server-custom-adapters.md +3 -1
- package/dist/{observational-memory-SASGM6OW-3S6D4TAF.js → observational-memory-B25SASRW-L4GYD2ZN.js} +3 -3
- package/dist/{observational-memory-SASGM6OW-3S6D4TAF.js.map → observational-memory-B25SASRW-L4GYD2ZN.js.map} +1 -1
- package/dist/{observational-memory-SASGM6OW-2G3RBRTW.cjs → observational-memory-B25SASRW-T76NSRNU.cjs} +26 -26
- package/dist/{observational-memory-SASGM6OW-2G3RBRTW.cjs.map → observational-memory-B25SASRW-T76NSRNU.cjs.map} +1 -1
- package/dist/server/handlers/agent-builder.cjs +16 -16
- package/dist/server/handlers/agent-builder.js +1 -1
- package/dist/server/handlers.cjs +2 -2
- package/dist/server/handlers.js +1 -1
- package/dist/server/server-adapter/index.cjs +24 -16
- package/dist/server/server-adapter/index.cjs.map +1 -1
- package/dist/server/server-adapter/index.js +10 -2
- package/dist/server/server-adapter/index.js.map +1 -1
- package/dist/server/server-adapter/routes/observability.d.ts +881 -119
- package/dist/server/server-adapter/routes/observability.d.ts.map +1 -1
- package/package.json +8 -8
- package/dist/chunk-FTGC7KXM.js.map +0 -1
- package/dist/chunk-MS7GNCN3.cjs.map +0 -1
- package/dist/chunk-POOOTRUM.cjs.map +0 -1
- package/dist/chunk-U5XW3WOS.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
# @mastra/server
|
|
2
2
|
|
|
3
|
+
## 1.19.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Registered missing observability score and feedback aggregate routes. The handlers for `scores/aggregate`, `scores/breakdown`, `scores/timeseries`, `scores/percentiles` and their feedback counterparts were defined but not wired into the server route array, resulting in 404s. ([#14885](https://github.com/mastra-ai/mastra/pull/14885))
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`180aaaf`](https://github.com/mastra-ai/mastra/commit/180aaaf4d0903d33a49bc72de2d40ca69a5bc599), [`9140989`](https://github.com/mastra-ai/mastra/commit/91409890e83f4f1d9c1b39223f1af91a6a53b549), [`d7c98cf`](https://github.com/mastra-ai/mastra/commit/d7c98cfc9d75baba9ecbf1a8835b5183d0a0aec8), [`acf5fbc`](https://github.com/mastra-ai/mastra/commit/acf5fbcb890dc7ca7167bec386ce5874dfadb997), [`24ca2ae`](https://github.com/mastra-ai/mastra/commit/24ca2ae57538ec189fabb9daee6175ad27035853), [`0762516`](https://github.com/mastra-ai/mastra/commit/07625167e029a8268ea7aaf0402416e6d8832874), [`9c57f2f`](https://github.com/mastra-ai/mastra/commit/9c57f2f7241e9f94769aa99fc86c531e8207d0f9), [`5bfc691`](https://github.com/mastra-ai/mastra/commit/5bfc69104c07ba7a9b55c2f8536422c0878b9c57), [`2de3d36`](https://github.com/mastra-ai/mastra/commit/2de3d36932b7f73ad26bc403f7da26cfe89e903e), [`d3736cb`](https://github.com/mastra-ai/mastra/commit/d3736cb9ce074d2b8e8b00218a01f790fe81a1b4), [`c627366`](https://github.com/mastra-ai/mastra/commit/c6273666f9ef4c8c617c68b7d07fe878a322f85c)]:
|
|
10
|
+
- @mastra/core@1.19.0
|
|
11
|
+
|
|
12
|
+
## 1.19.0-alpha.2
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Updated dependencies [[`9c57f2f`](https://github.com/mastra-ai/mastra/commit/9c57f2f7241e9f94769aa99fc86c531e8207d0f9), [`5bfc691`](https://github.com/mastra-ai/mastra/commit/5bfc69104c07ba7a9b55c2f8536422c0878b9c57)]:
|
|
17
|
+
- @mastra/core@1.19.0-alpha.2
|
|
18
|
+
|
|
19
|
+
## 1.18.1-alpha.1
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- Registered missing observability score and feedback aggregate routes. The handlers for `scores/aggregate`, `scores/breakdown`, `scores/timeseries`, `scores/percentiles` and their feedback counterparts were defined but not wired into the server route array, resulting in 404s. ([#14885](https://github.com/mastra-ai/mastra/pull/14885))
|
|
24
|
+
|
|
25
|
+
- Updated dependencies [[`9140989`](https://github.com/mastra-ai/mastra/commit/91409890e83f4f1d9c1b39223f1af91a6a53b549), [`d7c98cf`](https://github.com/mastra-ai/mastra/commit/d7c98cfc9d75baba9ecbf1a8835b5183d0a0aec8), [`acf5fbc`](https://github.com/mastra-ai/mastra/commit/acf5fbcb890dc7ca7167bec386ce5874dfadb997), [`24ca2ae`](https://github.com/mastra-ai/mastra/commit/24ca2ae57538ec189fabb9daee6175ad27035853), [`0762516`](https://github.com/mastra-ai/mastra/commit/07625167e029a8268ea7aaf0402416e6d8832874), [`2de3d36`](https://github.com/mastra-ai/mastra/commit/2de3d36932b7f73ad26bc403f7da26cfe89e903e), [`d3736cb`](https://github.com/mastra-ai/mastra/commit/d3736cb9ce074d2b8e8b00218a01f790fe81a1b4), [`c627366`](https://github.com/mastra-ai/mastra/commit/c6273666f9ef4c8c617c68b7d07fe878a322f85c)]:
|
|
26
|
+
- @mastra/core@1.18.1-alpha.1
|
|
27
|
+
|
|
3
28
|
## 1.18.1-alpha.0
|
|
4
29
|
|
|
5
30
|
### Patch Changes
|
|
@@ -1952,7 +1952,11 @@ var ObservationStrategy = class _ObservationStrategy {
|
|
|
1952
1952
|
retrieval;
|
|
1953
1953
|
/** Select the right strategy based on scope and mode. Wired up by index.ts. */
|
|
1954
1954
|
static create;
|
|
1955
|
-
/**
|
|
1955
|
+
/**
|
|
1956
|
+
* Run the full observation lifecycle.
|
|
1957
|
+
* @returns `true` if a full observation cycle completed; `false` if skipped (stale lock) or async-buffer failure was swallowed.
|
|
1958
|
+
* @throws On sync/resource-scoped observer failure after failed markers (same as pre–Option-A contract).
|
|
1959
|
+
*/
|
|
1956
1960
|
async run() {
|
|
1957
1961
|
const { record, threadId, abortSignal, writer, reflectionHooks, requestContext } = this.opts;
|
|
1958
1962
|
const cycleId = this.generateCycleId();
|
|
@@ -1960,7 +1964,7 @@ var ObservationStrategy = class _ObservationStrategy {
|
|
|
1960
1964
|
if (this.needsLock) {
|
|
1961
1965
|
const fresh = await this.storage.getObservationalMemory(record.threadId, record.resourceId);
|
|
1962
1966
|
if (fresh?.lastObservedAt && record.lastObservedAt && fresh.lastObservedAt > record.lastObservedAt) {
|
|
1963
|
-
return;
|
|
1967
|
+
return false;
|
|
1964
1968
|
}
|
|
1965
1969
|
}
|
|
1966
1970
|
const { messages, existingObservations } = await this.prepare();
|
|
@@ -1981,23 +1985,29 @@ var ObservationStrategy = class _ObservationStrategy {
|
|
|
1981
1985
|
observabilityContext: this.opts.observabilityContext
|
|
1982
1986
|
});
|
|
1983
1987
|
}
|
|
1988
|
+
return true;
|
|
1984
1989
|
} catch (error) {
|
|
1985
1990
|
await this.emitFailedMarkers(cycleId, error);
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
1991
|
+
if (!this.rethrowOnFailure) {
|
|
1992
|
+
const failedMarkerForStorage = {
|
|
1993
|
+
type: "data-om-observation-failed",
|
|
1994
|
+
data: {
|
|
1995
|
+
cycleId,
|
|
1996
|
+
operationType: "observation",
|
|
1997
|
+
startedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1998
|
+
error: error instanceof Error ? error.message : String(error),
|
|
1999
|
+
recordId: record.id,
|
|
2000
|
+
threadId
|
|
2001
|
+
}
|
|
2002
|
+
};
|
|
2003
|
+
await this.persistMarkerToStorage(failedMarkerForStorage, threadId, this.opts.resourceId).catch(() => {
|
|
2004
|
+
});
|
|
2005
|
+
if (abortSignal?.aborted) throw error;
|
|
2006
|
+
omError("[OM] Observation failed", error);
|
|
2007
|
+
return false;
|
|
2008
|
+
}
|
|
2000
2009
|
omError("[OM] Observation failed", error);
|
|
2010
|
+
throw error;
|
|
2001
2011
|
}
|
|
2002
2012
|
}
|
|
2003
2013
|
// ── Shared helpers ──────────────────────────────────────────
|
|
@@ -2218,6 +2228,9 @@ var SyncObservationStrategy = class extends ObservationStrategy {
|
|
|
2218
2228
|
get needsReflection() {
|
|
2219
2229
|
return true;
|
|
2220
2230
|
}
|
|
2231
|
+
get rethrowOnFailure() {
|
|
2232
|
+
return true;
|
|
2233
|
+
}
|
|
2221
2234
|
async prepare() {
|
|
2222
2235
|
const { record, threadId, messages } = this.opts;
|
|
2223
2236
|
this.deps.emitDebugEvent({
|
|
@@ -2409,6 +2422,9 @@ var AsyncBufferObservationStrategy = class extends ObservationStrategy {
|
|
|
2409
2422
|
get needsReflection() {
|
|
2410
2423
|
return false;
|
|
2411
2424
|
}
|
|
2425
|
+
get rethrowOnFailure() {
|
|
2426
|
+
return false;
|
|
2427
|
+
}
|
|
2412
2428
|
generateCycleId() {
|
|
2413
2429
|
return this.cycleId;
|
|
2414
2430
|
}
|
|
@@ -2545,6 +2561,9 @@ var ResourceScopedObservationStrategy = class extends ObservationStrategy {
|
|
|
2545
2561
|
get needsReflection() {
|
|
2546
2562
|
return true;
|
|
2547
2563
|
}
|
|
2564
|
+
get rethrowOnFailure() {
|
|
2565
|
+
return true;
|
|
2566
|
+
}
|
|
2548
2567
|
async prepare() {
|
|
2549
2568
|
const { record, threadId: currentThreadId, messages: currentThreadMessages } = this.opts;
|
|
2550
2569
|
const { threads: allThreads } = await this.storage.listThreads({ filter: { resourceId: this.resourceId } });
|
|
@@ -8797,7 +8816,7 @@ ${grouped}` : grouped;
|
|
|
8797
8816
|
}
|
|
8798
8817
|
hooks?.onObservationStart?.();
|
|
8799
8818
|
try {
|
|
8800
|
-
await ObservationStrategy.create(this, {
|
|
8819
|
+
observed = await ObservationStrategy.create(this, {
|
|
8801
8820
|
record: freshRecord,
|
|
8802
8821
|
threadId,
|
|
8803
8822
|
resourceId,
|
|
@@ -8807,7 +8826,6 @@ ${grouped}` : grouped;
|
|
|
8807
8826
|
writer: opts.writer,
|
|
8808
8827
|
observabilityContext: opts.observabilityContext
|
|
8809
8828
|
}).run();
|
|
8810
|
-
observed = true;
|
|
8811
8829
|
} finally {
|
|
8812
8830
|
hooks?.onObservationEnd?.();
|
|
8813
8831
|
}
|
|
@@ -9412,5 +9430,5 @@ function getObservationsAsOf(activeObservations, asOf) {
|
|
|
9412
9430
|
}
|
|
9413
9431
|
|
|
9414
9432
|
export { ModelByInputTokens, OBSERVER_SYSTEM_PROMPT, ObservationalMemory, ObservationalMemoryProcessor, TokenCounter, buildObserverPrompt, buildObserverSystemPrompt, combineObservationGroupRanges, deriveObservationGroupProvenance, e, estimateTokenCount, extractCurrentTask, formatMessagesForObserver, formatToolResultForObserver, getObservationsAsOf, hasCurrentTaskSection, injectAnchorIds, optimizeObservationsForContext, parseAnchorId, parseObservationGroups, parseObserverOutput, reconcileObservationGroupsFromReflection, renderObservationGroupsForReflection, resolveToolResultValue, stripEphemeralAnchorIds, stripObservationGroups, truncateStringByTokens, wrapInObservationGroup };
|
|
9415
|
-
//# sourceMappingURL=chunk-
|
|
9416
|
-
//# sourceMappingURL=chunk-
|
|
9433
|
+
//# sourceMappingURL=chunk-5CDCKTHB.js.map
|
|
9434
|
+
//# sourceMappingURL=chunk-5CDCKTHB.js.map
|