@mastra/core 0.24.9 → 0.24.10-alpha.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 +58 -0
- package/dist/agent/agent.d.ts.map +1 -1
- package/dist/agent/index.cjs +10 -10
- package/dist/agent/index.js +1 -1
- package/dist/agent/input-processor/index.cjs +6 -6
- package/dist/agent/input-processor/index.js +1 -1
- package/dist/agent/utils.d.ts.map +1 -1
- package/dist/bundler/types.d.ts +14 -1
- package/dist/bundler/types.d.ts.map +1 -1
- package/dist/{chunk-PAW64WWA.cjs → chunk-33WE5PVS.cjs} +4 -4
- package/dist/{chunk-PAW64WWA.cjs.map → chunk-33WE5PVS.cjs.map} +1 -1
- package/dist/{chunk-ZWWHTQ72.cjs → chunk-3RX5ZF4V.cjs} +13 -13
- package/dist/chunk-3RX5ZF4V.cjs.map +1 -0
- package/dist/{chunk-QLPSR67Y.cjs → chunk-5O7NDXXO.cjs} +14 -14
- package/dist/{chunk-QLPSR67Y.cjs.map → chunk-5O7NDXXO.cjs.map} +1 -1
- package/dist/{chunk-GSQD3QNR.js → chunk-6PQUBAHQ.js} +9 -9
- package/dist/chunk-6PQUBAHQ.js.map +1 -0
- package/dist/{chunk-QQKRUSCB.js → chunk-ALNSKEAS.js} +4 -4
- package/dist/{chunk-QQKRUSCB.js.map → chunk-ALNSKEAS.js.map} +1 -1
- package/dist/{chunk-2BIQL3SK.js → chunk-BIJINR66.js} +3 -3
- package/dist/{chunk-2BIQL3SK.js.map → chunk-BIJINR66.js.map} +1 -1
- package/dist/{chunk-HHPXFPNO.js → chunk-BRZYJS5M.js} +3 -3
- package/dist/{chunk-HHPXFPNO.js.map → chunk-BRZYJS5M.js.map} +1 -1
- package/dist/{chunk-MSFEDB5Z.cjs → chunk-CHMAIN4O.cjs} +8 -8
- package/dist/{chunk-MSFEDB5Z.cjs.map → chunk-CHMAIN4O.cjs.map} +1 -1
- package/dist/{chunk-CSHVFDF6.cjs → chunk-CJR37VWC.cjs} +4 -4
- package/dist/{chunk-CSHVFDF6.cjs.map → chunk-CJR37VWC.cjs.map} +1 -1
- package/dist/{chunk-7GUQ2EQ4.cjs → chunk-EQQWSQ5G.cjs} +33 -3
- package/dist/chunk-EQQWSQ5G.cjs.map +1 -0
- package/dist/{chunk-DGL7I4HZ.cjs → chunk-J4B3HR7H.cjs} +9 -9
- package/dist/{chunk-DGL7I4HZ.cjs.map → chunk-J4B3HR7H.cjs.map} +1 -1
- package/dist/{chunk-5S5X3QPR.js → chunk-JP6JLYGP.js} +33 -3
- package/dist/chunk-JP6JLYGP.js.map +1 -0
- package/dist/{chunk-EHTC7VYS.cjs → chunk-L4HKPD5B.cjs} +4 -4
- package/dist/{chunk-EHTC7VYS.cjs.map → chunk-L4HKPD5B.cjs.map} +1 -1
- package/dist/{chunk-GEHKQTB2.js → chunk-MJQV65J5.js} +3 -3
- package/dist/{chunk-GEHKQTB2.js.map → chunk-MJQV65J5.js.map} +1 -1
- package/dist/{chunk-4DWBTEHS.js → chunk-QSNEKU46.js} +3 -3
- package/dist/{chunk-4DWBTEHS.js.map → chunk-QSNEKU46.js.map} +1 -1
- package/dist/{chunk-5KSHWBRH.js → chunk-S5NJWVPG.js} +3 -3
- package/dist/{chunk-5KSHWBRH.js.map → chunk-S5NJWVPG.js.map} +1 -1
- package/dist/index.cjs +33 -33
- package/dist/index.js +6 -6
- package/dist/loop/index.cjs +2 -2
- package/dist/loop/index.js +1 -1
- package/dist/loop/test-utils/streamObject.d.ts.map +1 -1
- package/dist/loop/workflows/agentic-execution/llm-execution-step.d.ts +1 -1
- package/dist/loop/workflows/agentic-execution/llm-execution-step.d.ts.map +1 -1
- package/dist/mastra/index.cjs +2 -2
- package/dist/mastra/index.js +1 -1
- package/dist/processors/index.cjs +11 -11
- package/dist/processors/index.js +1 -1
- package/dist/relevance/index.cjs +4 -4
- package/dist/relevance/index.js +1 -1
- package/dist/scores/index.cjs +4 -4
- package/dist/scores/index.js +1 -1
- package/dist/scores/scoreTraces/index.cjs +3 -3
- package/dist/scores/scoreTraces/index.js +1 -1
- package/dist/server/index.cjs +2 -2
- package/dist/server/index.js +1 -1
- package/dist/stream/aisdk/v5/output.d.ts.map +1 -1
- package/dist/stream/base/output.d.ts.map +1 -1
- package/dist/stream/index.cjs +8 -8
- package/dist/stream/index.js +1 -1
- package/dist/stream/types.d.ts +2 -1
- package/dist/stream/types.d.ts.map +1 -1
- package/dist/telemetry/index.cjs +7 -7
- package/dist/telemetry/index.js +1 -1
- package/dist/telemetry/telemetry.d.ts +18 -0
- package/dist/telemetry/telemetry.d.ts.map +1 -1
- package/dist/telemetry/utility.d.ts +7 -0
- package/dist/telemetry/utility.d.ts.map +1 -1
- package/dist/tts/index.cjs +2 -2
- package/dist/tts/index.js +1 -1
- package/dist/voice/index.cjs +6 -6
- package/dist/voice/index.js +1 -1
- package/dist/workflows/evented/index.cjs +10 -10
- package/dist/workflows/evented/index.js +1 -1
- package/dist/workflows/index.cjs +17 -17
- package/dist/workflows/index.js +1 -1
- package/dist/workflows/legacy/index.cjs +22 -22
- package/dist/workflows/legacy/index.js +1 -1
- package/package.json +3 -3
- package/dist/chunk-5S5X3QPR.js.map +0 -1
- package/dist/chunk-7GUQ2EQ4.cjs.map +0 -1
- package/dist/chunk-GSQD3QNR.js.map +0 -1
- package/dist/chunk-ZWWHTQ72.cjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,63 @@
|
|
|
1
1
|
# @mastra/core
|
|
2
2
|
|
|
3
|
+
## 0.24.10-alpha.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Fix model-level and runtime header support for LLM calls ([#11303](https://github.com/mastra-ai/mastra/pull/11303))
|
|
8
|
+
|
|
9
|
+
This fixes a bug where custom headers configured on models (like `anthropic-beta`) were not being passed through to the underlying AI SDK calls. The fix properly handles headers from multiple sources with correct priority:
|
|
10
|
+
|
|
11
|
+
**Header Priority (low to high):**
|
|
12
|
+
1. Model config headers - Headers set in model configuration
|
|
13
|
+
2. ModelSettings headers - Runtime headers that override model config
|
|
14
|
+
3. Provider-level headers - Headers baked into AI SDK providers (not overridden)
|
|
15
|
+
|
|
16
|
+
**Examples that now work:**
|
|
17
|
+
|
|
18
|
+
```typescript
|
|
19
|
+
// Model config headers
|
|
20
|
+
new Agent({
|
|
21
|
+
model: {
|
|
22
|
+
id: 'anthropic/claude-4-5-sonnet',
|
|
23
|
+
headers: { 'anthropic-beta': 'context-1m-2025-08-07' },
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
// Runtime headers override config
|
|
28
|
+
agent.generate('...', {
|
|
29
|
+
modelSettings: { headers: { 'x-custom': 'runtime-value' } },
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
// Provider-level headers preserved
|
|
33
|
+
const openai = createOpenAI({ headers: { 'openai-organization': 'org-123' } });
|
|
34
|
+
new Agent({ model: openai('gpt-4o-mini') });
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
- Add helpful JSDoc comments to `BundlerConfig` properties (used with `bundler` option) ([#11300](https://github.com/mastra-ai/mastra/pull/11300))
|
|
38
|
+
|
|
39
|
+
- Fix telemetry disabled configuration being ignored by decorators ([#11267](https://github.com/mastra-ai/mastra/pull/11267))
|
|
40
|
+
|
|
41
|
+
The `hasActiveTelemetry()` function now properly checks the `enabled` configuration flag before creating spans. Previously, it only checked if a tracer existed (which always returns true in OpenTelemetry), causing decorators to create spans even when `telemetry: { enabled: false }` was set.
|
|
42
|
+
|
|
43
|
+
**What changed:**
|
|
44
|
+
- Added short-circuit evaluation in `hasActiveTelemetry()` to check `globalThis.__TELEMETRY__?.isEnabled()` before checking for tracer existence
|
|
45
|
+
- This prevents unnecessary span creation overhead when telemetry is disabled
|
|
46
|
+
|
|
47
|
+
**How to use:**
|
|
48
|
+
|
|
49
|
+
```typescript
|
|
50
|
+
// Telemetry disabled at initialization
|
|
51
|
+
const mastra = new Mastra({
|
|
52
|
+
telemetry: { enabled: false },
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
// Or disable at runtime
|
|
56
|
+
Telemetry.setEnabled(false);
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
**Breaking changes:** None - this is a bug fix that makes the existing API work as documented.
|
|
60
|
+
|
|
3
61
|
## 0.24.9
|
|
4
62
|
|
|
5
63
|
### Patch Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../src/agent/agent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAIjD,OAAO,KAAK,EAAE,WAAW,EAAE,kBAAkB,EAAkB,SAAS,EAAE,MAAM,IAAI,CAAC;AAErF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AACrC,OAAO,KAAK,EAAE,gBAAgB,EAAe,MAAM,WAAW,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAoC,MAAM,eAAe,CAAC;AAC7E,OAAO,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAC/F,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAErC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAGtC,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,EAIV,oBAAoB,EACpB,kBAAkB,EAOlB,gBAAgB,EACjB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,KAAK,EAEV,mBAAmB,EAEnB,iBAAiB,EAClB,MAAM,2BAA2B,CAAC;AAGnC,OAA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AAC,YAAY,CAAC,EAAE,eAAe,CAAC,MAAM,CAAC,CAAA;KAAE,GACrF,SAAS,GACZ;QACD,cAAc,EAAE,OAAO,CAAC;QACxB,KAAK,CAAC,EAAE,eAAe,CAAC,iBAAiB,CAAC,CAAC;QAC3C,YAAY,CAAC,EAAE,eAAe,CAAC,MAAM,CAAC,CAAC;KACxC;IAgBD;;;OAGG;IACG,wBAAwB,CAC5B,cAAc,EAAE,cAAc,EAC9B,YAAY,CAAC,EAAE,eAAe,CAAC,MAAM,CAAC,GACrC,OAAO,CAAC,MAAM,CAAC;CAqBnB"}
|
package/dist/agent/index.cjs
CHANGED
|
@@ -1,45 +1,45 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk3RX5ZF4V_cjs = require('../chunk-3RX5ZF4V.cjs');
|
|
4
4
|
var chunkRDD5YB3T_cjs = require('../chunk-RDD5YB3T.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
Object.defineProperty(exports, "Agent", {
|
|
9
9
|
enumerable: true,
|
|
10
|
-
get: function () { return
|
|
10
|
+
get: function () { return chunk3RX5ZF4V_cjs.Agent; }
|
|
11
11
|
});
|
|
12
12
|
Object.defineProperty(exports, "LanguageDetectorInputProcessor", {
|
|
13
13
|
enumerable: true,
|
|
14
|
-
get: function () { return
|
|
14
|
+
get: function () { return chunk3RX5ZF4V_cjs.LanguageDetectorInputProcessor; }
|
|
15
15
|
});
|
|
16
16
|
Object.defineProperty(exports, "ModerationInputProcessor", {
|
|
17
17
|
enumerable: true,
|
|
18
|
-
get: function () { return
|
|
18
|
+
get: function () { return chunk3RX5ZF4V_cjs.ModerationInputProcessor; }
|
|
19
19
|
});
|
|
20
20
|
Object.defineProperty(exports, "PIIDetectorInputProcessor", {
|
|
21
21
|
enumerable: true,
|
|
22
|
-
get: function () { return
|
|
22
|
+
get: function () { return chunk3RX5ZF4V_cjs.PIIDetectorInputProcessor; }
|
|
23
23
|
});
|
|
24
24
|
Object.defineProperty(exports, "PromptInjectionDetectorInputProcessor", {
|
|
25
25
|
enumerable: true,
|
|
26
|
-
get: function () { return
|
|
26
|
+
get: function () { return chunk3RX5ZF4V_cjs.PromptInjectionDetectorInputProcessor; }
|
|
27
27
|
});
|
|
28
28
|
Object.defineProperty(exports, "TripWire", {
|
|
29
29
|
enumerable: true,
|
|
30
|
-
get: function () { return
|
|
30
|
+
get: function () { return chunk3RX5ZF4V_cjs.TripWire; }
|
|
31
31
|
});
|
|
32
32
|
Object.defineProperty(exports, "UnicodeNormalizerInputProcessor", {
|
|
33
33
|
enumerable: true,
|
|
34
|
-
get: function () { return
|
|
34
|
+
get: function () { return chunk3RX5ZF4V_cjs.UnicodeNormalizerInputProcessor; }
|
|
35
35
|
});
|
|
36
36
|
Object.defineProperty(exports, "tryGenerateWithJsonFallback", {
|
|
37
37
|
enumerable: true,
|
|
38
|
-
get: function () { return
|
|
38
|
+
get: function () { return chunk3RX5ZF4V_cjs.tryGenerateWithJsonFallback; }
|
|
39
39
|
});
|
|
40
40
|
Object.defineProperty(exports, "tryStreamWithJsonFallback", {
|
|
41
41
|
enumerable: true,
|
|
42
|
-
get: function () { return
|
|
42
|
+
get: function () { return chunk3RX5ZF4V_cjs.tryStreamWithJsonFallback; }
|
|
43
43
|
});
|
|
44
44
|
Object.defineProperty(exports, "MessageList", {
|
|
45
45
|
enumerable: true,
|
package/dist/agent/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { Agent, LanguageDetectorInputProcessor, ModerationInputProcessor, PIIDetectorInputProcessor, PromptInjectionDetectorInputProcessor, TripWire, UnicodeNormalizerInputProcessor, tryGenerateWithJsonFallback, tryStreamWithJsonFallback } from '../chunk-
|
|
1
|
+
export { Agent, LanguageDetectorInputProcessor, ModerationInputProcessor, PIIDetectorInputProcessor, PromptInjectionDetectorInputProcessor, TripWire, UnicodeNormalizerInputProcessor, tryGenerateWithJsonFallback, tryStreamWithJsonFallback } from '../chunk-6PQUBAHQ.js';
|
|
2
2
|
export { MessageList, convertMessages } from '../chunk-NFJJ6B6P.js';
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk3RX5ZF4V_cjs = require('../../chunk-3RX5ZF4V.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
Object.defineProperty(exports, "LanguageDetectorInputProcessor", {
|
|
8
8
|
enumerable: true,
|
|
9
|
-
get: function () { return
|
|
9
|
+
get: function () { return chunk3RX5ZF4V_cjs.LanguageDetectorInputProcessor; }
|
|
10
10
|
});
|
|
11
11
|
Object.defineProperty(exports, "ModerationInputProcessor", {
|
|
12
12
|
enumerable: true,
|
|
13
|
-
get: function () { return
|
|
13
|
+
get: function () { return chunk3RX5ZF4V_cjs.ModerationInputProcessor; }
|
|
14
14
|
});
|
|
15
15
|
Object.defineProperty(exports, "PIIDetectorInputProcessor", {
|
|
16
16
|
enumerable: true,
|
|
17
|
-
get: function () { return
|
|
17
|
+
get: function () { return chunk3RX5ZF4V_cjs.PIIDetectorInputProcessor; }
|
|
18
18
|
});
|
|
19
19
|
Object.defineProperty(exports, "PromptInjectionDetectorInputProcessor", {
|
|
20
20
|
enumerable: true,
|
|
21
|
-
get: function () { return
|
|
21
|
+
get: function () { return chunk3RX5ZF4V_cjs.PromptInjectionDetectorInputProcessor; }
|
|
22
22
|
});
|
|
23
23
|
Object.defineProperty(exports, "UnicodeNormalizerInputProcessor", {
|
|
24
24
|
enumerable: true,
|
|
25
|
-
get: function () { return
|
|
25
|
+
get: function () { return chunk3RX5ZF4V_cjs.UnicodeNormalizerInputProcessor; }
|
|
26
26
|
});
|
|
27
27
|
//# sourceMappingURL=index.cjs.map
|
|
28
28
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { LanguageDetectorInputProcessor, ModerationInputProcessor, PIIDetectorInputProcessor, PromptInjectionDetectorInputProcessor, UnicodeNormalizerInputProcessor } from '../../chunk-
|
|
1
|
+
export { LanguageDetectorInputProcessor, ModerationInputProcessor, PIIDetectorInputProcessor, PromptInjectionDetectorInputProcessor, UnicodeNormalizerInputProcessor } from '../../chunk-6PQUBAHQ.js';
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/agent/utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAC3D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAEvD,wBAAsB,2BAA2B,CAC/C,MAAM,SAAS,YAAY,GAAG,SAAS,EACvC,MAAM,SAAS,OAAO,GAAG,QAAQ,GAAG,QAAQ,EAC5C,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,gBAAgB,EAAE,OAAO,EAAE,qBAAqB,CAAC,MAAM,EAAE,MAAM,CAAC;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/agent/utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAC3D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAEvD,wBAAsB,2BAA2B,CAC/C,MAAM,SAAS,YAAY,GAAG,SAAS,EACvC,MAAM,SAAS,OAAO,GAAG,QAAQ,GAAG,QAAQ,EAC5C,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,gBAAgB,EAAE,OAAO,EAAE,qBAAqB,CAAC,MAAM,EAAE,MAAM,CAAC;;;;;;;;;;;;;;;;;;;;;;;;mBAsDw9jB,+DAAgC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAAhC,+DAAgC;;;;;;;;;;;;;GAnC/kkB;AAED,wBAAsB,yBAAyB,CAC7C,MAAM,SAAS,YAAY,GAAG,SAAS,EACvC,MAAM,SAAS,OAAO,GAAG,QAAQ,GAAG,QAAQ,EAC5C,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,gBAAgB,EAAE,OAAO,EAAE,qBAAqB,CAAC,MAAM,EAAE,MAAM,CAAC,qIA6BvF"}
|
package/dist/bundler/types.d.ts
CHANGED
|
@@ -1,6 +1,19 @@
|
|
|
1
1
|
export type BundlerConfig = {
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Controls which dependencies are excluded from the bundle and installed separately.
|
|
4
|
+
* - `true`: Excludes all non-workspace packages from bundling
|
|
5
|
+
* - `string[]`: Specifies custom packages to exclude (merged with global externals like 'pino', 'pg', '@libsql/client')
|
|
6
|
+
*/
|
|
7
|
+
externals?: boolean | string[];
|
|
8
|
+
/**
|
|
9
|
+
* Enables source map generation for debugging bundled code.
|
|
10
|
+
* Generates `.mjs.map` files alongside bundled output.
|
|
11
|
+
*/
|
|
3
12
|
sourcemap?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Packages requiring TypeScript/modern JS transpilation during bundling.
|
|
15
|
+
* Automatically includes workspace packages.
|
|
16
|
+
*/
|
|
4
17
|
transpilePackages?: string[];
|
|
5
18
|
};
|
|
6
19
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/bundler/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GAAG;IAC1B,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/bundler/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GAAG;IAC1B;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,GAAG,MAAM,EAAE,CAAC;IAC/B;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC9B,CAAC"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkEQQWSQ5G_cjs = require('./chunk-EQQWSQ5G.cjs');
|
|
4
4
|
var chunk6VOPKVYH_cjs = require('./chunk-6VOPKVYH.cjs');
|
|
5
5
|
var chunkEBVYYC2Q_cjs = require('./chunk-EBVYYC2Q.cjs');
|
|
6
6
|
|
|
7
7
|
// src/tts/index.ts
|
|
8
8
|
var _MastraTTS_decorators, _init, _a;
|
|
9
|
-
_MastraTTS_decorators = [
|
|
9
|
+
_MastraTTS_decorators = [chunkEQQWSQ5G_cjs.InstrumentClass({
|
|
10
10
|
prefix: "tts",
|
|
11
11
|
excludeMethods: ["__setTools", "__setLogger", "__setTelemetry", "#log"]
|
|
12
12
|
})];
|
|
@@ -35,5 +35,5 @@ exports.MastraTTS = /*@__PURE__*/(_ => {
|
|
|
35
35
|
chunkEBVYYC2Q_cjs.__runInitializers(_init, 1, exports.MastraTTS);
|
|
36
36
|
return exports.MastraTTS;
|
|
37
37
|
})();
|
|
38
|
-
//# sourceMappingURL=chunk-
|
|
39
|
-
//# sourceMappingURL=chunk-
|
|
38
|
+
//# sourceMappingURL=chunk-33WE5PVS.cjs.map
|
|
39
|
+
//# sourceMappingURL=chunk-33WE5PVS.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/tts/index.ts"],"names":["MastraTTS","__decoratorStart","__decorateElement","__runInitializers"],"mappings":";;;;;;;;;;;;;;;AAAA,IAAA;AAaA,GAAA,EAAA;AAAiB,IACf,KAAA,CAAQ;AAAA,MACR,SAAA,EAAA;AACF,KAAC,CAAA;AACM,IAAe,IAAA,CAAA,KAAA;AAA6B,EACjD;AAAA,EACA,MAAA,CAAA,MAAY,EAAE,UAAoB,EAAA;AAChC,IAAA,OAAM,IAAA,CAAA,SAAA,EAAA,WAAA,CAAA,MAAA,EAAA;AAAA,MACJ,QAAA,EAAA,CAAW,EAAA,IAAA,CAAA,KAAA,CAAA,IAAA,CAAA,KAAA,EAAA,UAAA,CAAA,CAAA;AAAA,MACZ,UAAA,EAAA;AACD,QAAA,UAAa,EAAA,CAAA,EAAA,IAAA,CAAA,KAAA,CAAA,IAAA,CAAA;AAAA;AACf,KAEA,CAAA;AACE,EAAA;AACsC;AACYA,iBAC9C,gBAAY,CAAA,CAAA,IAAA;AAAA,EAAA,KAAA,GACVC,kCAAe,CAAA,EAAK,CAAA;AAAU,EAAAD,iBAChC,GAAAE,mCAAA,CAAA,KAAA,EAAA,CAAA,EAAA,WAAA,EAAA,qBAAA,EAAAF,iBAAA,CAAA;AAAA,EAAAG,mCACI,CAAA,KAAA,EAAA,CAAA,EAAAH,iBAAA,CAAA;AAAA,EAEV,OAAAA,iBAAA;AAIF,CAAA,EAAA","file":"chunk-
|
|
1
|
+
{"version":3,"sources":["../src/tts/index.ts"],"names":["MastraTTS","__decoratorStart","__decorateElement","__runInitializers"],"mappings":";;;;;;;;;;;;;;;AAAA,IAAA;AAaA,GAAA,EAAA;AAAiB,IACf,KAAA,CAAQ;AAAA,MACR,SAAA,EAAA;AACF,KAAC,CAAA;AACM,IAAe,IAAA,CAAA,KAAA;AAA6B,EACjD;AAAA,EACA,MAAA,CAAA,MAAY,EAAE,UAAoB,EAAA;AAChC,IAAA,OAAM,IAAA,CAAA,SAAA,EAAA,WAAA,CAAA,MAAA,EAAA;AAAA,MACJ,QAAA,EAAA,CAAW,EAAA,IAAA,CAAA,KAAA,CAAA,IAAA,CAAA,KAAA,EAAA,UAAA,CAAA,CAAA;AAAA,MACZ,UAAA,EAAA;AACD,QAAA,UAAa,EAAA,CAAA,EAAA,IAAA,CAAA,KAAA,CAAA,IAAA,CAAA;AAAA;AACf,KAEA,CAAA;AACE,EAAA;AACsC;AACYA,iBAC9C,gBAAY,CAAA,CAAA,IAAA;AAAA,EAAA,KAAA,GACVC,kCAAe,CAAA,EAAK,CAAA;AAAU,EAAAD,iBAChC,GAAAE,mCAAA,CAAA,KAAA,EAAA,CAAA,EAAA,WAAA,EAAA,qBAAA,EAAAF,iBAAA,CAAA;AAAA,EAAAG,mCACI,CAAA,KAAA,EAAA,CAAA,EAAAH,iBAAA,CAAA;AAAA,EAEV,OAAAA,iBAAA;AAIF,CAAA,EAAA","file":"chunk-33WE5PVS.cjs","sourcesContent":["import { MastraBase } from '../base';\nimport { InstrumentClass } from '../telemetry';\n\ninterface BuiltInModelConfig {\n provider: string;\n name: string;\n apiKey?: string;\n}\n\nexport interface TTSConfig {\n model: BuiltInModelConfig;\n}\n\n@InstrumentClass({\n prefix: 'tts',\n excludeMethods: ['__setTools', '__setLogger', '__setTelemetry', '#log'],\n})\nexport abstract class MastraTTS extends MastraBase {\n model: BuiltInModelConfig;\n constructor({ model }: TTSConfig) {\n super({\n component: 'TTS',\n });\n this.model = model;\n }\n\n traced<T extends Function>(method: T, methodName: string): T {\n return (\n this.telemetry?.traceMethod(method, {\n spanName: `${this.model.name}-tts.${methodName}`,\n attributes: {\n 'tts.type': `${this.model.name}`,\n },\n }) ?? method\n );\n }\n\n abstract generate({ text }: { text: string }): Promise<any>;\n abstract stream({ text }: { text: string }): Promise<any>;\n}\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkL4HKPD5B_cjs = require('./chunk-L4HKPD5B.cjs');
|
|
4
4
|
var chunkABJOUEVA_cjs = require('./chunk-ABJOUEVA.cjs');
|
|
5
|
-
var
|
|
5
|
+
var chunkEQQWSQ5G_cjs = require('./chunk-EQQWSQ5G.cjs');
|
|
6
6
|
var chunkRDD5YB3T_cjs = require('./chunk-RDD5YB3T.cjs');
|
|
7
7
|
var chunk22DLIF7L_cjs = require('./chunk-22DLIF7L.cjs');
|
|
8
8
|
var chunkQWOKGSO2_cjs = require('./chunk-QWOKGSO2.cjs');
|
|
@@ -450,7 +450,7 @@ async function processOutputStream({tools,messageId,messageList,outputStream,run
|
|
|
450
450
|
// BUT does this cause other issues?
|
|
451
451
|
// Alternative solution: in message list allow combining text deltas together when the message source is "response" and the text parts are directly next to each other
|
|
452
452
|
// simple solution for now is to not flush text deltas on response-metadata
|
|
453
|
-
chunk.type!=="response-metadata"&&runState.state.isStreaming){if(runState.state.textDeltas.length){const textStartPayload=chunk.payload;const providerMetadata=textStartPayload.providerMetadata??runState.state.providerOptions;const message={id:messageId,role:"assistant",content:{format:2,parts:[{type:"text",text:runState.state.textDeltas.join(""),...(providerMetadata?{providerMetadata}:{})}],...(runState.state.providerOptions?{providerMetadata:runState.state.providerOptions}:{})},createdAt:/* @__PURE__ */new Date()};messageList.add(message,"response");}runState.setState({isStreaming:false,textDeltas:[]});}if(chunk.type!=="reasoning-start"&&chunk.type!=="reasoning-delta"&&chunk.type!=="reasoning-end"&&chunk.type!=="redacted-reasoning"&&chunk.type!=="reasoning-signature"&&chunk.type!=="response-metadata"&&runState.state.isReasoning){runState.setState({isReasoning:false,reasoningDeltas:[]});}switch(chunk.type){case "response-metadata":runState.setState({responseMetadata:{id:chunk.payload.id,timestamp:chunk.payload.timestamp,modelId:chunk.payload.modelId,headers:chunk.payload.headers}});break;case "text-delta":{const textDeltasFromState=runState.state.textDeltas;textDeltasFromState.push(chunk.payload.text);runState.setState({textDeltas:textDeltasFromState,isStreaming:true});if(isControllerOpen(controller)){controller.enqueue(chunk);}break;}case "tool-call-input-streaming-start":{const tool=tools?.[chunk.payload.toolName]||Object.values(tools||{})?.find(tool2=>`id`in tool2&&tool2.id===chunk.payload.toolName);if(tool&&"onInputStart"in tool){try{await tool?.onInputStart?.({toolCallId:chunk.payload.toolCallId,messages:messageList.get.input.aiV5.model(),abortSignal:options?.abortSignal});}catch(error2){console.error("Error calling onInputStart",error2);}}if(isControllerOpen(controller)){controller.enqueue(chunk);}break;}case "tool-call-delta":{const tool=tools?.[chunk.payload.toolName||""]||Object.values(tools||{})?.find(tool2=>`id`in tool2&&tool2.id===chunk.payload.toolName);if(tool&&"onInputDelta"in tool){try{await tool?.onInputDelta?.({inputTextDelta:chunk.payload.argsTextDelta,toolCallId:chunk.payload.toolCallId,messages:messageList.get.input.aiV5.model(),abortSignal:options?.abortSignal});}catch(error2){console.error("Error calling onInputDelta",error2);}}if(isControllerOpen(controller)){controller.enqueue(chunk);}break;}case "reasoning-start":{runState.setState({isReasoning:true,reasoningDeltas:[],providerOptions:chunk.payload.providerMetadata??runState.state.providerOptions});if(Object.values(chunk.payload.providerMetadata||{}).find(v=>v?.redactedData)){const message={id:messageId,role:"assistant",content:{format:2,parts:[{type:"reasoning",reasoning:"",details:[{type:"redacted",data:""}],providerMetadata:chunk.payload.providerMetadata??runState.state.providerOptions}]},createdAt:/* @__PURE__ */new Date()};messageList.add(message,"response");if(isControllerOpen(controller)){controller.enqueue(chunk);}break;}if(isControllerOpen(controller)){controller.enqueue(chunk);}break;}case "reasoning-delta":{const reasoningDeltasFromState=runState.state.reasoningDeltas;reasoningDeltasFromState.push(chunk.payload.text);runState.setState({isReasoning:true,reasoningDeltas:reasoningDeltasFromState,providerOptions:chunk.payload.providerMetadata??runState.state.providerOptions});if(isControllerOpen(controller)){controller.enqueue(chunk);}break;}case "reasoning-end":{const reasoningProviderMetadata=chunk.payload.providerMetadata??runState.state.providerOptions;const hasReasoningDeltas=runState.state.reasoningDeltas.length>0;const hasProviderMetadata=reasoningProviderMetadata&&Object.keys(reasoningProviderMetadata).length>0;if(hasReasoningDeltas||hasProviderMetadata){const message={id:messageId,role:"assistant",content:{format:2,parts:[{type:"reasoning",reasoning:"",details:hasReasoningDeltas?[{type:"text",text:runState.state.reasoningDeltas.join("")}]:[],providerMetadata:reasoningProviderMetadata}]},createdAt:/* @__PURE__ */new Date()};messageList.add(message,"response");}runState.setState({isReasoning:false,reasoningDeltas:[]});if(isControllerOpen(controller)){controller.enqueue(chunk);}break;}case "file":messageList.add({id:messageId,role:"assistant",content:[{type:"file",data:chunk.payload.data,mimeType:chunk.payload.mimeType}]},"response");controller.enqueue(chunk);break;case "source":messageList.add({id:messageId,role:"assistant",content:{format:2,parts:[{type:"source",source:{sourceType:"url",id:chunk.payload.id,url:chunk.payload.url||"",title:chunk.payload.title,providerMetadata:chunk.payload.providerMetadata}}]},createdAt:/* @__PURE__ */new Date()},"response");controller.enqueue(chunk);break;case "finish":runState.setState({providerOptions:chunk.payload.metadata.providerMetadata,stepResult:{reason:chunk.payload.reason,logprobs:chunk.payload.logprobs,warnings:responseFromModel.warnings,totalUsage:chunk.payload.totalUsage,headers:responseFromModel.rawResponse?.headers,messageId,isContinued:!["stop","error"].includes(chunk.payload.stepResult.reason),request:responseFromModel.request}});break;case "error":if(providerUtilsV5.isAbortError(chunk.payload.error)&&options?.abortSignal?.aborted){break;}runState.setState({hasErrored:true});runState.setState({stepResult:{isContinued:false,reason:"error"}});const error=chunk5NTO7S5I_cjs.getErrorFromUnknown(chunk.payload.error,{fallbackMessage:"Unknown error in agent stream"});controller.enqueue({...chunk,payload:{...chunk.payload,error}});await options?.onError?.({error});break;default:if(isControllerOpen(controller)){controller.enqueue(chunk);}}if(["text-delta","reasoning-delta","source","tool-call","tool-call-input-streaming-start","tool-call-delta","raw"].includes(chunk.type)){if(chunk.type==="raw"&&!includeRawChunks){continue;}await options?.onChunk?.(chunk);}if(runState.state.hasErrored){break;}}}function executeStreamWithFallbackModels(models){return async callback=>{let index=0;let finalResult;let done=false;for(const modelConfig of models){index++;const maxRetries=modelConfig.maxRetries||0;let attempt=0;if(done){break;}while(attempt<=maxRetries){try{const isLastModel=attempt===maxRetries&&index===models.length;const result=await callback(modelConfig.model,isLastModel);finalResult=result;done=true;break;}catch(err){attempt++;console.error(`Error executing model ${modelConfig.model.modelId}, attempt ${attempt}====`,err);if(attempt>maxRetries){break;}}}}if(typeof finalResult==="undefined"){console.error("Exhausted all fallback models and reached the maximum number of retries.");throw new Error("Exhausted all fallback models and reached the maximum number of retries.");}return finalResult;};}function createLLMExecutionStep({models,_internal,messageId,runId,modelStreamSpan,telemetry_settings,tools,toolChoice,messageList,includeRawChunks,modelSettings,providerOptions,options,toolCallStreaming,controller,structuredOutput,outputProcessors,headers,downloadRetries,downloadConcurrency,processorStates,methodType}){return createStep({id:"llm-execution",inputSchema:llmIterationOutputSchema,outputSchema:llmIterationOutputSchema,execute:async({inputData,bail,tracingContext})=>{let modelResult;let warnings;let request;let rawResponse;const{outputStream,callBail,runState}=await executeStreamWithFallbackModels(models)(async(model,isLastModel)=>{const runState2=new AgenticRunState({_internal,model});switch(model.specificationVersion){case "v2":{const messageListPromptArgs={downloadRetries,downloadConcurrency,supportedUrls:model?.supportedUrls};let inputMessages=await messageList.get.all.aiV5.llmPrompt(messageListPromptArgs);let stepModel=model;let stepToolChoice=toolChoice;let stepTools=tools;if(options?.prepareStep){try{const prepareStepResult=await options.prepareStep({stepNumber:inputData.output?.steps?.length||0,steps:inputData.output?.steps||[],model,messages:messageList.get.all.aiV5.model()});if(prepareStepResult){if(prepareStepResult.model){stepModel=prepareStepResult.model;}if(prepareStepResult.toolChoice){stepToolChoice=prepareStepResult.toolChoice;}if(prepareStepResult.activeTools&&stepTools){const activeToolsSet=new Set(prepareStepResult.activeTools);stepTools=Object.fromEntries(Object.entries(stepTools).filter(([toolName])=>activeToolsSet.has(toolName)));}if(prepareStepResult.messages){const newMessages=prepareStepResult.messages;const newMessageList=new chunkRDD5YB3T_cjs.MessageList();for(const message of newMessages){if(message.role==="system"){newMessageList.addSystem(message);}else if(message.role==="user"){newMessageList.add(message,"input");}else if(message.role==="assistant"||message.role==="tool"){newMessageList.add(message,"response");}}inputMessages=await newMessageList.get.all.aiV5.llmPrompt(messageListPromptArgs);}}}catch(error){console.error("Error in prepareStep callback:",error);}}modelResult=execute({runId,model:stepModel,providerOptions,inputMessages,tools:stepTools,toolChoice:stepToolChoice,options,modelSettings,telemetry_settings,includeRawChunks,structuredOutput,headers,methodType,onResult:({warnings:warningsFromStream,request:requestFromStream,rawResponse:rawResponseFromStream})=>{warnings=warningsFromStream;request=requestFromStream||{};rawResponse=rawResponseFromStream;if(!isControllerOpen(controller)){return;}controller.enqueue({runId,from:"AGENT"/* AGENT */,type:"step-start",payload:{request:request||{},warnings:warnings||[],messageId}});},modelStreamSpan,shouldThrowError:!isLastModel});break;}default:{throw new Error(`Unsupported model version: ${model.specificationVersion}`);}}const outputStream2=new MastraModelOutput({model:{modelId:model.modelId,provider:model.provider,version:model.specificationVersion},stream:modelResult,messageList,messageId,options:{runId,rootSpan:modelStreamSpan,toolCallStreaming,telemetry_settings,includeRawChunks,structuredOutput,outputProcessors,isLLMExecutionStep:true,tracingContext,processorStates}});try{await processOutputStream({outputStream:outputStream2,includeRawChunks,tools,messageId,messageList,runState:runState2,options,controller,responseFromModel:{warnings,request,rawResponse}});}catch(error){console.error("Error in LLM Execution Step",error);if(providerUtilsV5.isAbortError(error)&&options?.abortSignal?.aborted){await options?.onAbort?.({steps:inputData?.output?.steps??[]});if(isControllerOpen(controller)){controller.enqueue({type:"abort",runId,from:"AGENT"/* AGENT */,payload:{}});}return {callBail:true,outputStream:outputStream2,runState:runState2};}if(isLastModel){if(isControllerOpen(controller)){controller.enqueue({type:"error",runId,from:"AGENT"/* AGENT */,payload:{error}});}runState2.setState({hasErrored:true,stepResult:{isContinued:false,reason:"error"}});}else {throw error;}}return {outputStream:outputStream2,callBail:false,runState:runState2};});if(callBail){const usage2=outputStream._getImmediateUsage();const responseMetadata2=runState.state.responseMetadata;const text2=outputStream._getImmediateText();return bail({messageId,stepResult:{reason:"abort",warnings,isContinued:false},metadata:{providerMetadata:runState.state.providerOptions,...responseMetadata2,modelMetadata:runState.state.modelMetadata,headers:rawResponse?.headers,request},output:{text:text2,toolCalls:[],usage:usage2??inputData.output?.usage,steps:[]},messages:{all:messageList.get.all.aiV5.model(),user:messageList.get.input.aiV5.model(),nonUser:messageList.get.response.aiV5.model()}});}if(outputStream.tripwire){runState.setState({stepResult:{isContinued:false,reason:"abort"}});}const toolCalls=outputStream._getImmediateToolCalls()?.map(chunk=>chunk.payload);if(toolCalls.length>0){const message={id:messageId,role:"assistant",content:{format:2,parts:toolCalls.map(toolCall=>{return {type:"tool-invocation",toolInvocation:{state:"call",toolCallId:toolCall.toolCallId,toolName:toolCall.toolName,args:toolCall.args},// Only include providerMetadata if it's actually present
|
|
453
|
+
chunk.type!=="response-metadata"&&runState.state.isStreaming){if(runState.state.textDeltas.length){const textStartPayload=chunk.payload;const providerMetadata=textStartPayload.providerMetadata??runState.state.providerOptions;const message={id:messageId,role:"assistant",content:{format:2,parts:[{type:"text",text:runState.state.textDeltas.join(""),...(providerMetadata?{providerMetadata}:{})}],...(runState.state.providerOptions?{providerMetadata:runState.state.providerOptions}:{})},createdAt:/* @__PURE__ */new Date()};messageList.add(message,"response");}runState.setState({isStreaming:false,textDeltas:[]});}if(chunk.type!=="reasoning-start"&&chunk.type!=="reasoning-delta"&&chunk.type!=="reasoning-end"&&chunk.type!=="redacted-reasoning"&&chunk.type!=="reasoning-signature"&&chunk.type!=="response-metadata"&&runState.state.isReasoning){runState.setState({isReasoning:false,reasoningDeltas:[]});}switch(chunk.type){case "response-metadata":runState.setState({responseMetadata:{id:chunk.payload.id,timestamp:chunk.payload.timestamp,modelId:chunk.payload.modelId,headers:chunk.payload.headers}});break;case "text-delta":{const textDeltasFromState=runState.state.textDeltas;textDeltasFromState.push(chunk.payload.text);runState.setState({textDeltas:textDeltasFromState,isStreaming:true});if(isControllerOpen(controller)){controller.enqueue(chunk);}break;}case "tool-call-input-streaming-start":{const tool=tools?.[chunk.payload.toolName]||Object.values(tools||{})?.find(tool2=>`id`in tool2&&tool2.id===chunk.payload.toolName);if(tool&&"onInputStart"in tool){try{await tool?.onInputStart?.({toolCallId:chunk.payload.toolCallId,messages:messageList.get.input.aiV5.model(),abortSignal:options?.abortSignal});}catch(error2){console.error("Error calling onInputStart",error2);}}if(isControllerOpen(controller)){controller.enqueue(chunk);}break;}case "tool-call-delta":{const tool=tools?.[chunk.payload.toolName||""]||Object.values(tools||{})?.find(tool2=>`id`in tool2&&tool2.id===chunk.payload.toolName);if(tool&&"onInputDelta"in tool){try{await tool?.onInputDelta?.({inputTextDelta:chunk.payload.argsTextDelta,toolCallId:chunk.payload.toolCallId,messages:messageList.get.input.aiV5.model(),abortSignal:options?.abortSignal});}catch(error2){console.error("Error calling onInputDelta",error2);}}if(isControllerOpen(controller)){controller.enqueue(chunk);}break;}case "reasoning-start":{runState.setState({isReasoning:true,reasoningDeltas:[],providerOptions:chunk.payload.providerMetadata??runState.state.providerOptions});if(Object.values(chunk.payload.providerMetadata||{}).find(v=>v?.redactedData)){const message={id:messageId,role:"assistant",content:{format:2,parts:[{type:"reasoning",reasoning:"",details:[{type:"redacted",data:""}],providerMetadata:chunk.payload.providerMetadata??runState.state.providerOptions}]},createdAt:/* @__PURE__ */new Date()};messageList.add(message,"response");if(isControllerOpen(controller)){controller.enqueue(chunk);}break;}if(isControllerOpen(controller)){controller.enqueue(chunk);}break;}case "reasoning-delta":{const reasoningDeltasFromState=runState.state.reasoningDeltas;reasoningDeltasFromState.push(chunk.payload.text);runState.setState({isReasoning:true,reasoningDeltas:reasoningDeltasFromState,providerOptions:chunk.payload.providerMetadata??runState.state.providerOptions});if(isControllerOpen(controller)){controller.enqueue(chunk);}break;}case "reasoning-end":{const reasoningProviderMetadata=chunk.payload.providerMetadata??runState.state.providerOptions;const hasReasoningDeltas=runState.state.reasoningDeltas.length>0;const hasProviderMetadata=reasoningProviderMetadata&&Object.keys(reasoningProviderMetadata).length>0;if(hasReasoningDeltas||hasProviderMetadata){const message={id:messageId,role:"assistant",content:{format:2,parts:[{type:"reasoning",reasoning:"",details:hasReasoningDeltas?[{type:"text",text:runState.state.reasoningDeltas.join("")}]:[],providerMetadata:reasoningProviderMetadata}]},createdAt:/* @__PURE__ */new Date()};messageList.add(message,"response");}runState.setState({isReasoning:false,reasoningDeltas:[]});if(isControllerOpen(controller)){controller.enqueue(chunk);}break;}case "file":messageList.add({id:messageId,role:"assistant",content:[{type:"file",data:chunk.payload.data,mimeType:chunk.payload.mimeType}]},"response");controller.enqueue(chunk);break;case "source":messageList.add({id:messageId,role:"assistant",content:{format:2,parts:[{type:"source",source:{sourceType:"url",id:chunk.payload.id,url:chunk.payload.url||"",title:chunk.payload.title,providerMetadata:chunk.payload.providerMetadata}}]},createdAt:/* @__PURE__ */new Date()},"response");controller.enqueue(chunk);break;case "finish":runState.setState({providerOptions:chunk.payload.metadata.providerMetadata,stepResult:{reason:chunk.payload.reason,logprobs:chunk.payload.logprobs,warnings:responseFromModel.warnings,totalUsage:chunk.payload.totalUsage,headers:responseFromModel.rawResponse?.headers,messageId,isContinued:!["stop","error"].includes(chunk.payload.stepResult.reason),request:responseFromModel.request}});break;case "error":if(providerUtilsV5.isAbortError(chunk.payload.error)&&options?.abortSignal?.aborted){break;}runState.setState({hasErrored:true});runState.setState({stepResult:{isContinued:false,reason:"error"}});const error=chunk5NTO7S5I_cjs.getErrorFromUnknown(chunk.payload.error,{fallbackMessage:"Unknown error in agent stream"});controller.enqueue({...chunk,payload:{...chunk.payload,error}});await options?.onError?.({error});break;default:if(isControllerOpen(controller)){controller.enqueue(chunk);}}if(["text-delta","reasoning-delta","source","tool-call","tool-call-input-streaming-start","tool-call-delta","raw"].includes(chunk.type)){if(chunk.type==="raw"&&!includeRawChunks){continue;}await options?.onChunk?.(chunk);}if(runState.state.hasErrored){break;}}}function executeStreamWithFallbackModels(models){return async callback=>{let index=0;let finalResult;let done=false;for(const modelConfig of models){index++;const maxRetries=modelConfig.maxRetries||0;let attempt=0;if(done){break;}while(attempt<=maxRetries){try{const isLastModel=attempt===maxRetries&&index===models.length;const result=await callback(modelConfig,isLastModel);finalResult=result;done=true;break;}catch(err){attempt++;console.error(`Error executing model ${modelConfig.model.modelId}, attempt ${attempt}====`,err);if(attempt>maxRetries){break;}}}}if(typeof finalResult==="undefined"){console.error("Exhausted all fallback models and reached the maximum number of retries.");throw new Error("Exhausted all fallback models and reached the maximum number of retries.");}return finalResult;};}function createLLMExecutionStep({models,_internal,messageId,runId,modelStreamSpan,telemetry_settings,tools,toolChoice,messageList,includeRawChunks,modelSettings,providerOptions,options,toolCallStreaming,controller,structuredOutput,outputProcessors,downloadRetries,downloadConcurrency,processorStates,methodType}){return createStep({id:"llm-execution",inputSchema:llmIterationOutputSchema,outputSchema:llmIterationOutputSchema,execute:async({inputData,bail,tracingContext})=>{let modelResult;let warnings;let request;let rawResponse;const{outputStream,callBail,runState}=await executeStreamWithFallbackModels(models)(async(modelConfig,isLastModel)=>{const model=modelConfig.model;const modelHeaders=modelConfig.headers;const runState2=new AgenticRunState({_internal,model});switch(model.specificationVersion){case "v2":{const messageListPromptArgs={downloadRetries,downloadConcurrency,supportedUrls:model?.supportedUrls};let inputMessages=await messageList.get.all.aiV5.llmPrompt(messageListPromptArgs);let stepModel=model;let stepToolChoice=toolChoice;let stepTools=tools;if(options?.prepareStep){try{const prepareStepResult=await options.prepareStep({stepNumber:inputData.output?.steps?.length||0,steps:inputData.output?.steps||[],model,messages:messageList.get.all.aiV5.model()});if(prepareStepResult){if(prepareStepResult.model){stepModel=prepareStepResult.model;}if(prepareStepResult.toolChoice){stepToolChoice=prepareStepResult.toolChoice;}if(prepareStepResult.activeTools&&stepTools){const activeToolsSet=new Set(prepareStepResult.activeTools);stepTools=Object.fromEntries(Object.entries(stepTools).filter(([toolName])=>activeToolsSet.has(toolName)));}if(prepareStepResult.messages){const newMessages=prepareStepResult.messages;const newMessageList=new chunkRDD5YB3T_cjs.MessageList();for(const message of newMessages){if(message.role==="system"){newMessageList.addSystem(message);}else if(message.role==="user"){newMessageList.add(message,"input");}else if(message.role==="assistant"||message.role==="tool"){newMessageList.add(message,"response");}}inputMessages=await newMessageList.get.all.aiV5.llmPrompt(messageListPromptArgs);}}}catch(error){console.error("Error in prepareStep callback:",error);}}modelResult=execute({runId,model:stepModel,providerOptions,inputMessages,tools:stepTools,toolChoice:stepToolChoice,options,modelSettings,telemetry_settings,includeRawChunks,structuredOutput,headers:modelHeaders||modelSettings?.headers?{...modelHeaders,...modelSettings?.headers}:void 0,methodType,onResult:({warnings:warningsFromStream,request:requestFromStream,rawResponse:rawResponseFromStream})=>{warnings=warningsFromStream;request=requestFromStream||{};rawResponse=rawResponseFromStream;if(!isControllerOpen(controller)){return;}controller.enqueue({runId,from:"AGENT"/* AGENT */,type:"step-start",payload:{request:request||{},warnings:warnings||[],messageId}});},modelStreamSpan,shouldThrowError:!isLastModel});break;}default:{throw new Error(`Unsupported model version: ${model.specificationVersion}`);}}const outputStream2=new MastraModelOutput({model:{modelId:model.modelId,provider:model.provider,version:model.specificationVersion},stream:modelResult,messageList,messageId,options:{runId,rootSpan:modelStreamSpan,toolCallStreaming,telemetry_settings,includeRawChunks,structuredOutput,outputProcessors,isLLMExecutionStep:true,tracingContext,processorStates}});try{await processOutputStream({outputStream:outputStream2,includeRawChunks,tools,messageId,messageList,runState:runState2,options,controller,responseFromModel:{warnings,request,rawResponse}});}catch(error){console.error("Error in LLM Execution Step",error);if(providerUtilsV5.isAbortError(error)&&options?.abortSignal?.aborted){await options?.onAbort?.({steps:inputData?.output?.steps??[]});if(isControllerOpen(controller)){controller.enqueue({type:"abort",runId,from:"AGENT"/* AGENT */,payload:{}});}return {callBail:true,outputStream:outputStream2,runState:runState2};}if(isLastModel){if(isControllerOpen(controller)){controller.enqueue({type:"error",runId,from:"AGENT"/* AGENT */,payload:{error}});}runState2.setState({hasErrored:true,stepResult:{isContinued:false,reason:"error"}});}else {throw error;}}return {outputStream:outputStream2,callBail:false,runState:runState2};});if(callBail){const usage2=outputStream._getImmediateUsage();const responseMetadata2=runState.state.responseMetadata;const text2=outputStream._getImmediateText();return bail({messageId,stepResult:{reason:"abort",warnings,isContinued:false},metadata:{providerMetadata:runState.state.providerOptions,...responseMetadata2,modelMetadata:runState.state.modelMetadata,headers:rawResponse?.headers,request},output:{text:text2,toolCalls:[],usage:usage2??inputData.output?.usage,steps:[]},messages:{all:messageList.get.all.aiV5.model(),user:messageList.get.input.aiV5.model(),nonUser:messageList.get.response.aiV5.model()}});}if(outputStream.tripwire){runState.setState({stepResult:{isContinued:false,reason:"abort"}});}const toolCalls=outputStream._getImmediateToolCalls()?.map(chunk=>chunk.payload);if(toolCalls.length>0){const message={id:messageId,role:"assistant",content:{format:2,parts:toolCalls.map(toolCall=>{return {type:"tool-invocation",toolInvocation:{state:"call",toolCallId:toolCall.toolCallId,toolName:toolCall.toolName,args:toolCall.args},// Only include providerMetadata if it's actually present
|
|
454
454
|
...(toolCall.providerMetadata?{providerMetadata:toolCall.providerMetadata}:{})};})},createdAt:/* @__PURE__ */new Date()};messageList.add(message,"response");}const finishReason=runState?.state?.stepResult?.reason??outputStream._getImmediateFinishReason();const hasErrored=runState.state.hasErrored;const usage=outputStream._getImmediateUsage();const responseMetadata=runState.state.responseMetadata;const text=outputStream._getImmediateText();const object=outputStream._getImmediateObject();const tripwireTriggered=outputStream.tripwire;const steps=inputData.output?.steps||[];const existingResponseCount=inputData.messages?.nonUser?.length||0;const allResponseContent=messageList.get.response.aiV5.modelContent(steps.length);const currentIterationContent=allResponseContent.slice(existingResponseCount);steps.push(new DefaultStepResult({warnings:outputStream._getImmediateWarnings(),providerMetadata:runState.state.providerOptions,finishReason:runState.state.stepResult?.reason,content:currentIterationContent,response:{...responseMetadata,...rawResponse,messages:messageList.get.response.aiV5.model()},request,usage:outputStream._getImmediateUsage()}));const messages={all:messageList.get.all.aiV5.model(),user:messageList.get.input.aiV5.model(),nonUser:messageList.get.response.aiV5.model()};return {messageId,stepResult:{reason:tripwireTriggered?"abort":hasErrored?"error":finishReason,warnings,isContinued:tripwireTriggered?false:!["stop","error"].includes(finishReason)},metadata:{providerMetadata:runState.state.providerOptions,...responseMetadata,...rawResponse,modelMetadata:runState.state.modelMetadata,headers:rawResponse?.headers,request},output:{text,toolCalls,usage:usage??inputData.output?.usage,steps,...(object?{object}:{})},messages};}});}// src/loop/workflows/agentic-execution/llm-mapping-step.ts
|
|
455
455
|
function createLLMMappingStep({models,telemetry_settings,_internal,modelStreamSpan,...rest},llmExecutionStep){return createStep({id:"llmExecutionMappingStep",inputSchema:z9__default.default.array(toolCallOutputSchema),outputSchema:llmIterationOutputSchema,execute:async({inputData,getStepResult:getStepResult3,bail})=>{const initialResult=getStepResult3(llmExecutionStep);if(inputData?.every(toolCall=>toolCall?.result===void 0)){const errorResults=inputData.filter(toolCall=>toolCall?.error);const toolResultMessageId=rest.experimental_generateMessageId?.()||_internal?.generateId?.();if(errorResults?.length){errorResults.forEach(toolCall=>{const chunk={type:"tool-error",runId:rest.runId,from:"AGENT"/* AGENT */,payload:{error:toolCall.error,args:toolCall.args,toolCallId:toolCall.toolCallId,toolName:toolCall.toolName,providerMetadata:toolCall.providerMetadata}};rest.controller.enqueue(chunk);});const msg={id:toolResultMessageId,role:"assistant",content:{format:2,parts:errorResults.map(toolCallErrorResult=>{return {type:"tool-invocation",toolInvocation:{state:"result",toolCallId:toolCallErrorResult.toolCallId,toolName:toolCallErrorResult.toolName,args:toolCallErrorResult.args,result:toolCallErrorResult.error?.message??toolCallErrorResult.error},...(toolCallErrorResult.providerMetadata?{providerMetadata:toolCallErrorResult.providerMetadata}:{})};})},createdAt:/* @__PURE__ */new Date()};rest.messageList.add(msg,"response");}initialResult.stepResult.isContinued=false;return bail(initialResult);}if(inputData?.length){for(const toolCall of inputData){const chunk={type:"tool-result",runId:rest.runId,from:"AGENT"/* AGENT */,payload:{args:toolCall.args,toolCallId:toolCall.toolCallId,toolName:toolCall.toolName,result:toolCall.result,providerMetadata:toolCall.providerMetadata,providerExecuted:toolCall.providerExecuted}};rest.controller.enqueue(chunk);if(initialResult?.metadata?.modelVersion==="v2"){await rest.options?.onChunk?.({chunk:convertMastraChunkToAISDKv5({chunk})});}const toolResultMessageId=rest.experimental_generateMessageId?.()||_internal?.generateId?.();const toolResultMessage={id:toolResultMessageId,role:"assistant",content:{format:2,parts:inputData.map(toolCall2=>{return {type:"tool-invocation",toolInvocation:{state:"result",toolCallId:toolCall2.toolCallId,toolName:toolCall2.toolName,args:toolCall2.args,result:toolCall2.result},...(toolCall2.providerMetadata?{providerMetadata:toolCall2.providerMetadata}:{})};})},createdAt:/* @__PURE__ */new Date()};rest.messageList.add(toolResultMessage,"response");}return {...initialResult,messages:{all:rest.messageList.get.all.aiV5.model(),user:rest.messageList.get.input.aiV5.model(),nonUser:rest.messageList.get.response.aiV5.model()}};}}});}// src/loop/workflows/agentic-execution/tool-call-step.ts
|
|
456
456
|
function createToolCallStep({tools,messageList,options,telemetry_settings,writer,controller,runId,streamState,modelSpanTracker,_internal}){return createStep({id:"toolCallStep",inputSchema:toolCallInputSchema,outputSchema:toolCallOutputSchema,execute:async({inputData,suspend,resumeData,runtimeContext})=>{const addToolApprovalMetadata=(toolCallId,toolName,args)=>{const responseMessages=messageList.get.response.v2();const lastAssistantMessage=[...responseMessages].reverse().find(msg=>msg.role==="assistant");if(lastAssistantMessage){const content=lastAssistantMessage.content;if(!content)return;const metadata=typeof lastAssistantMessage.content.metadata==="object"&&lastAssistantMessage.content.metadata!==null?lastAssistantMessage.content.metadata:{};metadata.pendingToolApprovals=metadata.pendingToolApprovals||{};metadata.pendingToolApprovals[toolCallId]={toolName,args,type:"approval",runId// Store the runId so we can resume after page refresh
|
|
@@ -467,7 +467,7 @@ finishReason:typedInputData.stepResult?.reason||"unknown",warnings:typedInputDat
|
|
|
467
467
|
payload:typedInputData});}}modelStreamSpan.setAttributes({"stream.response.id":typedInputData.metadata?.id,"stream.response.model":typedInputData.metadata?.modelId,...(typedInputData.metadata?.providerMetadata?{"stream.response.providerMetadata":JSON.stringify(typedInputData.metadata.providerMetadata)}:{}),"stream.response.finishReason":typedInputData.stepResult?.reason,"stream.usage.inputTokens":typedInputData.output.usage?.inputTokens,"stream.usage.outputTokens":typedInputData.output.usage?.outputTokens,"stream.usage.totalTokens":typedInputData.output.usage?.totalTokens,...(telemetry_settings?.recordOutputs!==false?{"stream.response.text":typedInputData.output.text,"stream.prompt.messages":JSON.stringify(messageList.get.input.aiV5.model())}:{})});modelStreamSpan.end();const reason=typedInputData.stepResult?.reason;if(reason===void 0){return false;}return typedInputData.stepResult?.isContinued??false;}).commit();}// src/loop/workflows/stream.ts
|
|
468
468
|
function isControllerOpen(controller){return controller.desiredSize!==0&&controller.desiredSize!==null;}function workflowLoopStream({resumeContext,requireToolApproval,telemetry_settings,models,toolChoice,modelSettings,_internal,modelStreamSpan,messageId,runId,messageList,startTimestamp,streamState,agentId,toolCallId,...rest}){return new web.ReadableStream({start:async controller=>{const writer=new WritableStream({write:chunk=>{controller.enqueue(chunk);}});modelStreamSpan.setAttributes({...(telemetry_settings?.recordInputs!==false?{"stream.prompt.toolChoice":toolChoice?JSON.stringify(toolChoice):"auto"}:{})});const agenticLoopWorkflow=createAgenticLoopWorkflow({resumeContext,messageId,models,telemetry_settings,_internal,modelSettings,toolChoice,modelStreamSpan,controller,writer,runId,messageList,startTimestamp,streamState,agentId,...rest});if(rest.mastra){agenticLoopWorkflow.__registerMastra(rest.mastra);}const initialData={messageId,messages:{all:messageList.get.all.aiV5.model(),user:messageList.get.input.aiV5.model(),nonUser:[]},output:{steps:[],usage:{inputTokens:0,outputTokens:0,totalTokens:0}},metadata:{},stepResult:{reason:"undefined",warnings:[],isContinued:true,totalUsage:{inputTokens:0,outputTokens:0,totalTokens:0}}};const msToFirstChunk=_internal?.now?.()-startTimestamp;modelStreamSpan.addEvent("ai.stream.firstChunk",{"ai.response.msToFirstChunk":msToFirstChunk});modelStreamSpan.setAttributes({"stream.response.timestamp":new Date(startTimestamp).toISOString(),"stream.response.msToFirstChunk":msToFirstChunk});if(!resumeContext){controller.enqueue({type:"start",runId,from:"AGENT"/* AGENT */,payload:{id:agentId}});}const run=await agenticLoopWorkflow.createRunAsync({runId});const runtimeContext=new chunkGPWMM745_cjs.RuntimeContext();if(requireToolApproval){runtimeContext.set("__mastra_requireToolApproval",true);}const executionResult=resumeContext?await run.resume({resumeData:resumeContext.resumeData,tracingContext:rest.modelSpanTracker?.getTracingContext(),label:toolCallId}):await run.start({inputData:initialData,tracingContext:rest.modelSpanTracker?.getTracingContext(),runtimeContext});if(executionResult.status!=="success"){if(executionResult.status==="failed"){let executionResultError=executionResult.error;if(typeof executionResult.error==="string"){const prependedErrorString="Error: ";if(executionResult.error.startsWith(`${prependedErrorString}${prependedErrorString}`)){executionResultError=executionResult.error.substring(`${prependedErrorString}${prependedErrorString}`.length);}else if(executionResult.error.startsWith(prependedErrorString)){executionResultError=executionResult.error.substring(prependedErrorString.length);}}const error=chunk5NTO7S5I_cjs.getErrorFromUnknown(executionResultError,{fallbackMessage:"Unknown error in agent workflow stream"});controller.enqueue({type:"error",runId,from:"AGENT"/* AGENT */,payload:{error}});if(rest.options?.onError){await rest.options?.onError?.({error});}}controller.close();return;}if(executionResult.result.stepResult?.reason==="abort"){controller.close();return;}controller.enqueue({type:"finish",runId,from:"AGENT"/* AGENT */,payload:{...executionResult.result,stepResult:{...executionResult.result.stepResult,// @ts-ignore we add 'abort' for tripwires so the type is not compatible
|
|
469
469
|
reason:executionResult.result.stepResult.reason}}});const msToFinish=(_internal?.now?.()??Date.now())-startTimestamp;modelStreamSpan.addEvent("ai.stream.finish");modelStreamSpan.setAttributes({"stream.response.msToFinish":msToFinish,"stream.response.avgOutputTokensPerSecond":1e3*(executionResult?.result?.output?.usage?.outputTokens??0)/msToFinish});controller.close();}});}// src/loop/loop.ts
|
|
470
|
-
function loop({resumeContext,models,logger,runId,idGenerator,telemetry_settings,messageList,includeRawChunks,modelSettings,tools,_internal,mode="stream",outputProcessors,returnScorerData,requireToolApproval,agentId,...rest}){let loggerToUse=logger||new chunkA5KDVZDL_cjs.ConsoleLogger({level:"debug"});if(models.length===0||!models[0]){const mastraError=new chunk5NTO7S5I_cjs.MastraError({id:"LOOP_MODELS_EMPTY",domain:"LLM"/* LLM */,category:"USER"/* USER */});loggerToUse.trackException(mastraError);loggerToUse.error(mastraError.toString());throw mastraError;}const firstModel=models[0];let runIdToUse=runId;if(!runIdToUse){runIdToUse=idGenerator?.()||crypto.randomUUID();}const internalToUse={now:_internal?.now||(()=>Date.now()),generateId:_internal?.generateId||(()=>aiV5.generateId()),currentDate:_internal?.currentDate||(()=>/* @__PURE__ */new Date()),saveQueueManager:_internal?.saveQueueManager,memoryConfig:_internal?.memoryConfig,threadId:_internal?.threadId,resourceId:_internal?.resourceId,memory:_internal?.memory,threadExists:_internal?.threadExists};let startTimestamp=internalToUse.now?.();const{rootSpan}=getRootSpan({operationId:mode==="stream"?`mastra.stream`:`mastra.generate`,model:{modelId:firstModel.model.modelId,provider:firstModel.model.provider},modelSettings,headers:modelSettings?.headers
|
|
470
|
+
function loop({resumeContext,models,logger,runId,idGenerator,telemetry_settings,messageList,includeRawChunks,modelSettings,tools,_internal,mode="stream",outputProcessors,returnScorerData,requireToolApproval,agentId,...rest}){let loggerToUse=logger||new chunkA5KDVZDL_cjs.ConsoleLogger({level:"debug"});if(models.length===0||!models[0]){const mastraError=new chunk5NTO7S5I_cjs.MastraError({id:"LOOP_MODELS_EMPTY",domain:"LLM"/* LLM */,category:"USER"/* USER */});loggerToUse.trackException(mastraError);loggerToUse.error(mastraError.toString());throw mastraError;}const firstModel=models[0];let runIdToUse=runId;if(!runIdToUse){runIdToUse=idGenerator?.()||crypto.randomUUID();}const internalToUse={now:_internal?.now||(()=>Date.now()),generateId:_internal?.generateId||(()=>aiV5.generateId()),currentDate:_internal?.currentDate||(()=>/* @__PURE__ */new Date()),saveQueueManager:_internal?.saveQueueManager,memoryConfig:_internal?.memoryConfig,threadId:_internal?.threadId,resourceId:_internal?.resourceId,memory:_internal?.memory,threadExists:_internal?.threadExists};let startTimestamp=internalToUse.now?.();const{rootSpan}=getRootSpan({operationId:mode==="stream"?`mastra.stream`:`mastra.generate`,model:{modelId:firstModel.model.modelId,provider:firstModel.model.provider},modelSettings,headers:modelSettings?.headers,telemetry_settings});rootSpan.setAttributes({...(telemetry_settings?.recordOutputs!==false?{"stream.prompt.messages":JSON.stringify(messageList.get.input.aiV5.model())}:{})});const{rootSpan:modelStreamSpan}=getRootSpan({operationId:`mastra.${mode}.aisdk.doStream`,model:{modelId:firstModel.model.modelId,provider:firstModel.model.provider},modelSettings,headers:modelSettings?.headers,telemetry_settings});const messageId=rest.experimental_generateMessageId?.()||internalToUse.generateId?.();let modelOutput;const serializeStreamState=()=>{return modelOutput?.serializeState();};const deserializeStreamState=state=>{modelOutput?.deserializeState(state);};const processorStates=outputProcessors&&outputProcessors.length>0?/* @__PURE__ */new Map():void 0;const workflowLoopProps={resumeContext,models,runId:runIdToUse,logger:loggerToUse,startTimestamp,messageList,includeRawChunks:!!includeRawChunks,_internal:internalToUse,tools,modelStreamSpan,telemetry_settings,modelSettings,outputProcessors,messageId,agentId,requireToolApproval,streamState:{serialize:serializeStreamState,deserialize:deserializeStreamState},processorStates,...rest};const existingSnapshot=resumeContext?.snapshot;let initialStreamState;if(existingSnapshot){for(const key in existingSnapshot?.context){const step=existingSnapshot?.context[key];if(step&&step.status==="suspended"&&step.suspendPayload?.__streamState){initialStreamState=step.suspendPayload?.__streamState;break;}}}const baseStream=workflowLoopStream(workflowLoopProps);const stream=rest.modelSpanTracker?.wrapStream(baseStream)??baseStream;modelOutput=new MastraModelOutput({model:{modelId:firstModel.model.modelId,provider:firstModel.model.provider,version:firstModel.model.specificationVersion},stream,messageList,messageId,options:{runId:runIdToUse,telemetry_settings,rootSpan,toolCallStreaming:rest.toolCallStreaming,onFinish:rest.options?.onFinish,onStepFinish:rest.options?.onStepFinish,includeRawChunks:!!includeRawChunks,structuredOutput:rest.structuredOutput,outputProcessors,returnScorerData,tracingContext:rest.modelSpanTracker?.getTracingContext()},initialState:initialStreamState});return createDestructurableOutput(modelOutput);}// src/llm/model/model.loop.ts
|
|
471
471
|
var MastraLLMVNext=class extends chunk6VOPKVYH_cjs.MastraBase{#models;#mastra;#options;#firstModel;constructor({mastra,models,options}){super({name:"aisdk"});this.#options=options;if(mastra){this.#mastra=mastra;if(mastra.getLogger()){this.__setLogger(this.#mastra.getLogger());}}if(models.length===0||!models[0]){const mastraError=new chunk5NTO7S5I_cjs.MastraError({id:"LLM_LOOP_MODELS_EMPTY",domain:"LLM"/* LLM */,category:"USER"/* USER */});this.logger.trackException(mastraError);this.logger.error(mastraError.toString());throw mastraError;}else {this.#models=models;this.#firstModel=models[0];}}__registerPrimitives(p){if(p.telemetry){this.__setTelemetry(p.telemetry);}if(p.logger){this.__setLogger(p.logger);}}__registerMastra(p){this.#mastra=p;}getProvider(){return this.#firstModel.model.provider;}getModelId(){return this.#firstModel.model.modelId;}getModel(){return this.#firstModel.model;}_applySchemaCompat(schema){const model=this.#firstModel.model;const schemaCompatLayers=[];if(model){const modelInfo={modelId:model.modelId,supportsStructuredOutputs:true,provider:model.provider};schemaCompatLayers.push(new schemaCompat.OpenAIReasoningSchemaCompatLayer(modelInfo),new schemaCompat.OpenAISchemaCompatLayer(modelInfo),new schemaCompat.GoogleSchemaCompatLayer(modelInfo),new schemaCompat.AnthropicSchemaCompatLayer(modelInfo),new schemaCompat.DeepSeekSchemaCompatLayer(modelInfo),new schemaCompat.MetaSchemaCompatLayer(modelInfo));}return schemaCompat.applyCompatLayer({schema,compatLayers:schemaCompatLayers,mode:"aiSdkSchema"});}convertToMessages(messages){if(Array.isArray(messages)){return messages.map(m=>{if(typeof m==="string"){return {role:"user",content:m};}return m;});}return [{role:"user",content:messages}];}stream({resumeContext,runId,stopWhen=aiV5.stepCountIs(5),maxSteps,tools={},modelSettings,toolChoice="auto",telemetry_settings,threadId,resourceId,structuredOutput,options,outputProcessors,returnScorerData,providerOptions,tracingContext,messageList,requireToolApproval,_internal,agentId,toolCallId,methodType,includeRawChunks}){let stopWhenToUse;if(maxSteps&&typeof maxSteps==="number"){stopWhenToUse=aiV5.stepCountIs(maxSteps);}else {stopWhenToUse=stopWhen;}const messages=messageList.get.all.aiV5.model();const firstModel=this.#firstModel.model;this.logger.debug(`[LLM] - Streaming text`,{runId,threadId,resourceId,messages,tools:Object.keys(tools||{})});const llmAISpan=tracingContext?.currentSpan?.createChildSpan({name:`llm: '${firstModel.modelId}'`,type:"model_generation"/* MODEL_GENERATION */,input:{messages:[...messageList.getSystemMessages(),...messages]},attributes:{model:firstModel.modelId,provider:firstModel.provider,streaming:true,parameters:modelSettings},metadata:{runId,threadId,resourceId},tracingPolicy:this.#options?.tracingPolicy});const modelSpanTracker=new chunkQGJF6TRY_cjs.ModelSpanTracker(llmAISpan);try{const loopOptions={mastra:this.#mastra,resumeContext,runId,toolCallId,messageList,models:this.#models,tools,stopWhen:stopWhenToUse,toolChoice,modelSettings,providerOptions,telemetry_settings:{...this.experimental_telemetry,...telemetry_settings},_internal,structuredOutput,outputProcessors,returnScorerData,modelSpanTracker,requireToolApproval,agentId,methodType,includeRawChunks,options:{...options,onStepFinish:async props=>{try{await options?.onStepFinish?.({...props,runId});}catch(e){const mastraError=new chunk5NTO7S5I_cjs.MastraError({id:"LLM_STREAM_ON_STEP_FINISH_CALLBACK_EXECUTION_FAILED",domain:"LLM"/* LLM */,category:"USER"/* USER */,details:{modelId:props.model?.modelId,modelProvider:props.model?.provider,runId:runId??"unknown",threadId:threadId??"unknown",resourceId:resourceId??"unknown",finishReason:props?.finishReason,toolCalls:props?.toolCalls?JSON.stringify(props.toolCalls):"",toolResults:props?.toolResults?JSON.stringify(props.toolResults):"",usage:props?.usage?JSON.stringify(props.usage):""}},e);modelSpanTracker?.reportGenerationError({error:mastraError});this.logger.trackException(mastraError);throw mastraError;}this.logger.debug("[LLM] - Stream Step Change:",{text:props?.text,toolCalls:props?.toolCalls,toolResults:props?.toolResults,finishReason:props?.finishReason,usage:props?.usage,runId});const remainingTokens=parseInt(props?.response?.headers?.["x-ratelimit-remaining-tokens"]??"",10);if(!isNaN(remainingTokens)&&remainingTokens>0&&remainingTokens<2e3){this.logger.warn("Rate limit approaching, waiting 10 seconds",{runId});await chunkQGJF6TRY_cjs.delay(10*1e3);}},onFinish:async props=>{modelSpanTracker?.endGeneration({output:{files:props?.files,object:props?.object,reasoning:props?.reasoning,reasoningText:props?.reasoningText,sources:props?.sources,text:props?.text,warnings:props?.warnings},attributes:{finishReason:props?.finishReason,usage:{inputTokens:props?.totalUsage?.inputTokens,outputTokens:props?.totalUsage?.outputTokens,totalTokens:props?.totalUsage?.totalTokens,reasoningTokens:props?.totalUsage?.reasoningTokens,cachedInputTokens:props?.totalUsage?.cachedInputTokens}}});try{await options?.onFinish?.({...props,runId});}catch(e){const mastraError=new chunk5NTO7S5I_cjs.MastraError({id:"LLM_STREAM_ON_FINISH_CALLBACK_EXECUTION_FAILED",domain:"LLM"/* LLM */,category:"USER"/* USER */,details:{modelId:props.model?.modelId,modelProvider:props.model?.provider,runId:runId??"unknown",threadId:threadId??"unknown",resourceId:resourceId??"unknown",finishReason:props?.finishReason,toolCalls:props?.toolCalls?JSON.stringify(props.toolCalls):"",toolResults:props?.toolResults?JSON.stringify(props.toolResults):"",usage:props?.usage?JSON.stringify(props.usage):""}},e);modelSpanTracker?.reportGenerationError({error:mastraError});this.logger.trackException(mastraError);throw mastraError;}this.logger.debug("[LLM] - Stream Finished:",{text:props?.text,toolCalls:props?.toolCalls,toolResults:props?.toolResults,finishReason:props?.finishReason,usage:props?.usage,runId,threadId,resourceId});}}};return loop(loopOptions);}catch(e){const mastraError=new chunk5NTO7S5I_cjs.MastraError({id:"LLM_STREAM_TEXT_AI_SDK_EXECUTION_FAILED",domain:"LLM"/* LLM */,category:"THIRD_PARTY"/* THIRD_PARTY */,details:{modelId:firstModel.modelId,modelProvider:firstModel.provider,runId:runId??"unknown",threadId:threadId??"unknown",resourceId:resourceId??"unknown"}},e);modelSpanTracker?.reportGenerationError({error:mastraError});throw mastraError;}}};// src/loop/network/index.ts
|
|
472
472
|
var MastraAgentNetworkStream=class extends web.ReadableStream{#usageCount={inputTokens:0,outputTokens:0,totalTokens:0};#streamPromise;#run;constructor({createStream,run}){const deferredPromise={promise:null,resolve:null,reject:null};deferredPromise.promise=new Promise((resolve,reject)=>{deferredPromise.resolve=resolve;deferredPromise.reject=reject;});const updateUsageCount=usage=>{this.#usageCount.inputTokens+=parseInt(usage?.inputTokens?.toString()??"0",10);this.#usageCount.outputTokens+=parseInt(usage?.outputTokens?.toString()??"0",10);this.#usageCount.totalTokens+=parseInt(usage?.totalTokens?.toString()??"0",10);};super({start:async controller=>{const writer=new WritableStream({write:chunk=>{if(chunk.type==="step-output"&&chunk.payload?.output?.from==="AGENT"&&chunk.payload?.output?.type==="finish"||chunk.type==="step-output"&&chunk.payload?.output?.from==="WORKFLOW"&&chunk.payload?.output?.type==="finish"){const output=chunk.payload?.output;if(output&&"payload"in output&&output.payload){const finishPayload=output.payload;if("usage"in finishPayload&&finishPayload.usage){updateUsageCount(finishPayload.usage);}}}controller.enqueue(chunk);}});const stream=await createStream(writer);const getInnerChunk=chunk=>{if(chunk.type==="workflow-step-output"){return getInnerChunk(chunk.payload.output);}return chunk;};for await(const chunk of stream){if(chunk.type==="workflow-step-output"){const innerChunk=getInnerChunk(chunk);if(innerChunk.type==="routing-agent-end"||innerChunk.type==="agent-execution-end"||innerChunk.type==="workflow-execution-end"){if(innerChunk.payload?.usage){updateUsageCount(innerChunk.payload.usage);}}if(innerChunk.type==="network-execution-event-step-finish"){const finishPayload={...innerChunk.payload,usage:this.#usageCount};controller.enqueue({...innerChunk,payload:finishPayload});}else {controller.enqueue(innerChunk);}}}controller.close();deferredPromise.resolve();}});this.#run=run;this.#streamPromise=deferredPromise;}get status(){return this.#streamPromise.promise.then(()=>this.#run._getExecutionResults()).then(res=>res.status);}get result(){return this.#streamPromise.promise.then(()=>this.#run._getExecutionResults());}get usage(){return this.#streamPromise.promise.then(()=>this.#usageCount);}};// src/loop/types.ts
|
|
473
473
|
var PRIMITIVE_TYPES=z9__default.default.enum(["agent","workflow","none","tool"]);// src/loop/network/index.ts
|
|
@@ -726,7 +726,7 @@ function createPrepareToolsStep({capabilities,options,threadFromArgs,resourceId,
|
|
|
726
726
|
function createStreamStep({capabilities,runId,returnScorerData,format="mastra",requireToolApproval,resumeContext,agentId,toolCallId,methodType,saveQueueManager,memoryConfig,memory,resourceId}){return createStep({id:"stream-text-step",inputSchema:z9.z.any(),// tried to type this in various ways but it's too complex
|
|
727
727
|
outputSchema:z9.z.union([z9.z.instanceof(MastraModelOutput),z9.z.instanceof(AISDKV5OutputStream)]),execute:async({inputData,tracingContext})=>{const validatedInputData=inputData;capabilities.logger.debug(`Starting agent ${capabilities.agentName} llm stream call`,{runId});const processors=validatedInputData.outputProcessors||(capabilities.outputProcessors?typeof capabilities.outputProcessors==="function"?await capabilities.outputProcessors({runtimeContext:validatedInputData.runtimeContext||new chunkGPWMM745_cjs.RuntimeContext()}):capabilities.outputProcessors:[]);const modelMethodType=getModelMethodFromAgentMethod(methodType);const streamResult=capabilities.llm.stream({...validatedInputData,outputProcessors:processors,returnScorerData,tracingContext,requireToolApproval,resumeContext,_internal:{generateId:capabilities.generateMessageId,saveQueueManager,memoryConfig,threadId:validatedInputData.threadId,resourceId,memory},agentId,toolCallId,methodType:modelMethodType});if(format==="aisdk"){return streamResult.aisdk.v5;}return streamResult;}});}// src/agent/workflows/prepare-stream/index.ts
|
|
728
728
|
function createPrepareStreamWorkflow({capabilities,options,threadFromArgs,resourceId,runId,runtimeContext,agentAISpan,methodType,format,instructions,memoryConfig,memory,saveQueueManager,returnScorerData,requireToolApproval,resumeContext,agentId,toolCallId}){const prepareToolsStep=createPrepareToolsStep({capabilities,options,threadFromArgs,resourceId,runId,runtimeContext,agentAISpan,methodType,memory});const prepareMemoryStep2=createPrepareMemoryStep({capabilities,options,threadFromArgs,resourceId,runId,runtimeContext,instructions,memoryConfig,memory});const streamStep=createStreamStep({capabilities,runId,returnScorerData,format,requireToolApproval,resumeContext,agentId,toolCallId,methodType,saveQueueManager,memoryConfig,memory,resourceId});const mapResultsStep=createMapResultsStep({capabilities,options,resourceId,runId,runtimeContext,memory,memoryConfig,saveQueueManager,agentAISpan,instructions,agentId,methodType});return createWorkflow({id:"execution-workflow",inputSchema:z9.z.object({}),outputSchema:z9.z.union([z9.z.instanceof(MastraModelOutput),z9.z.instanceof(AISDKV5OutputStream)]),steps:[prepareToolsStep,prepareMemoryStep2,streamStep],options:{tracingPolicy:{internal:1/* WORKFLOW */}}}).parallel([prepareToolsStep,prepareMemoryStep2]).map(mapResultsStep).then(streamStep).commit();}// src/agent/agent.ts
|
|
729
|
-
function resolveMaybePromise(value,cb){if(value instanceof Promise||value!=null&&typeof value.then==="function"){return Promise.resolve(value).then(cb);}return cb(value);}function resolveThreadIdFromArgs(args){if(args?.memory?.thread){if(typeof args.memory.thread==="string")return {id:args.memory.thread};if(typeof args.memory.thread==="object"&&args.memory.thread.id)return args.memory.thread;}if(args?.threadId)return {id:args.threadId};return void 0;}var _Agent_decorators,_init,_a;_Agent_decorators=[
|
|
729
|
+
function resolveMaybePromise(value,cb){if(value instanceof Promise||value!=null&&typeof value.then==="function"){return Promise.resolve(value).then(cb);}return cb(value);}function resolveThreadIdFromArgs(args){if(args?.memory?.thread){if(typeof args.memory.thread==="string")return {id:args.memory.thread};if(typeof args.memory.thread==="object"&&args.memory.thread.id)return args.memory.thread;}if(args?.threadId)return {id:args.threadId};return void 0;}var _Agent_decorators,_init,_a;_Agent_decorators=[chunkEQQWSQ5G_cjs.InstrumentClass({prefix:"agent",excludeMethods:["hasOwnMemory","getMemory","__primitive","__registerMastra","__registerPrimitives","__runInputProcessors","__runOutputProcessors","_wrapToolsWithAITracing","getProcessorRunner","__setTools","__setLogger","__setTelemetry","log","listAgents","getModel","getInstructions","getTools","getLLM","getWorkflows","getDefaultGenerateOptions","getDefaultStreamOptions","getDescription","getScorers","getVoice"]})];exports.Agent=class Agent extends(_a=chunk6VOPKVYH_cjs.MastraBase){id;name;#instructions;#description;model;#originalModel;maxRetries;#mastra;#memory;#workflows;#defaultGenerateOptions;#defaultStreamOptions;#defaultVNextStreamOptions;#tools;evals;#scorers;#agents;#voice;#inputProcessors;#outputProcessors;#options;// This flag is for agent network messages. We should change the agent network formatting and remove this flag after.
|
|
730
730
|
_agentNetworkAppend=false;/**
|
|
731
731
|
* Creates a new Agent instance with the specified configuration.
|
|
732
732
|
*
|
|
@@ -744,7 +744,7 @@ _agentNetworkAppend=false;/**
|
|
|
744
744
|
* maxRetries: 2,
|
|
745
745
|
* });
|
|
746
746
|
* ```
|
|
747
|
-
*/constructor(config){super({component:chunkA5KDVZDL_cjs.RegisteredLogger.AGENT});this.name=config.name;this.id=config.id??config.name;this.#instructions=config.instructions;this.#description=config.description;this.#options=config.options;if(!config.model){const mastraError=new chunk5NTO7S5I_cjs.MastraError({id:"AGENT_CONSTRUCTOR_MODEL_REQUIRED",domain:"AGENT"/* AGENT */,category:"USER"/* USER */,details:{agentName:config.name},text:`LanguageModel is required to create an Agent. Please provide the 'model'.`});this.logger.trackException(mastraError);this.logger.error(mastraError.toString());throw mastraError;}if(Array.isArray(config.model)){if(config.model.length===0){const mastraError=new chunk5NTO7S5I_cjs.MastraError({id:"AGENT_CONSTRUCTOR_MODEL_ARRAY_EMPTY",domain:"AGENT"/* AGENT */,category:"USER"/* USER */,details:{agentName:config.name},text:`Model array is empty. Please provide at least one model.`});this.logger.trackException(mastraError);this.logger.error(mastraError.toString());throw mastraError;}this.model=config.model.map(mdl=>({id:crypto2.randomUUID(),model:mdl.model,maxRetries:mdl.maxRetries??config?.maxRetries??0,enabled:mdl.enabled??true}));this.#originalModel=[...this.model];}else {this.model=config.model;this.#originalModel=config.model;}this.maxRetries=config.maxRetries??0;if(config.workflows){this.#workflows=config.workflows;}this.#defaultGenerateOptions=config.defaultGenerateOptions||{};this.#defaultStreamOptions=config.defaultStreamOptions||{};this.#defaultVNextStreamOptions=config.defaultVNextStreamOptions||{};this.#tools=config.tools||{};this.evals={};if(config.mastra){this.__registerMastra(config.mastra);this.__registerPrimitives({telemetry:config.mastra.getTelemetry(),logger:config.mastra.getLogger()});}this.#scorers=config.scorers||{};this.#agents=config.agents||{};if(config.evals){this.evals=config.evals;}if(config.memory){this.#memory=config.memory;}if(config.voice){this.#voice=config.voice;if(typeof config.tools!=="function"){this.#voice?.addTools(this.tools);}if(typeof config.instructions==="string"){this.#voice?.addInstructions(config.instructions);}}else {this.#voice=new
|
|
747
|
+
*/constructor(config){super({component:chunkA5KDVZDL_cjs.RegisteredLogger.AGENT});this.name=config.name;this.id=config.id??config.name;this.#instructions=config.instructions;this.#description=config.description;this.#options=config.options;if(!config.model){const mastraError=new chunk5NTO7S5I_cjs.MastraError({id:"AGENT_CONSTRUCTOR_MODEL_REQUIRED",domain:"AGENT"/* AGENT */,category:"USER"/* USER */,details:{agentName:config.name},text:`LanguageModel is required to create an Agent. Please provide the 'model'.`});this.logger.trackException(mastraError);this.logger.error(mastraError.toString());throw mastraError;}if(Array.isArray(config.model)){if(config.model.length===0){const mastraError=new chunk5NTO7S5I_cjs.MastraError({id:"AGENT_CONSTRUCTOR_MODEL_ARRAY_EMPTY",domain:"AGENT"/* AGENT */,category:"USER"/* USER */,details:{agentName:config.name},text:`Model array is empty. Please provide at least one model.`});this.logger.trackException(mastraError);this.logger.error(mastraError.toString());throw mastraError;}this.model=config.model.map(mdl=>({id:crypto2.randomUUID(),model:mdl.model,maxRetries:mdl.maxRetries??config?.maxRetries??0,enabled:mdl.enabled??true}));this.#originalModel=[...this.model];}else {this.model=config.model;this.#originalModel=config.model;}this.maxRetries=config.maxRetries??0;if(config.workflows){this.#workflows=config.workflows;}this.#defaultGenerateOptions=config.defaultGenerateOptions||{};this.#defaultStreamOptions=config.defaultStreamOptions||{};this.#defaultVNextStreamOptions=config.defaultVNextStreamOptions||{};this.#tools=config.tools||{};this.evals={};if(config.mastra){this.__registerMastra(config.mastra);this.__registerPrimitives({telemetry:config.mastra.getTelemetry(),logger:config.mastra.getLogger()});}this.#scorers=config.scorers||{};this.#agents=config.agents||{};if(config.evals){this.evals=config.evals;}if(config.memory){this.#memory=config.memory;}if(config.voice){this.#voice=config.voice;if(typeof config.tools!=="function"){this.#voice?.addTools(this.tools);}if(typeof config.instructions==="string"){this.#voice?.addInstructions(config.instructions);}}else {this.#voice=new chunkL4HKPD5B_cjs.DefaultVoice();}if(config.inputProcessors){this.#inputProcessors=config.inputProcessors;}if(config.outputProcessors){this.#outputProcessors=config.outputProcessors;}this._agentNetworkAppend=config._agentNetworkAppend||false;}getMastraInstance(){return this.#mastra;}/**
|
|
748
748
|
* Returns the agents configured for this agent, resolving function-based agents if necessary.
|
|
749
749
|
* Used in multi-agent collaboration scenarios where this agent can delegate to other agents.
|
|
750
750
|
*
|
|
@@ -804,7 +804,7 @@ _agentNetworkAppend=false;/**
|
|
|
804
804
|
* const voice = await agent.getVoice();
|
|
805
805
|
* const audioStream = await voice.speak('Hello world');
|
|
806
806
|
* ```
|
|
807
|
-
*/async getVoice({runtimeContext}={}){if(this.#voice){const voice=this.#voice;voice?.addTools(await this.getTools({runtimeContext}));const instructions=await this.getInstructions({runtimeContext});voice?.addInstructions(this.#convertInstructionsToString(instructions));return voice;}else {return new
|
|
807
|
+
*/async getVoice({runtimeContext}={}){if(this.#voice){const voice=this.#voice;voice?.addTools(await this.getTools({runtimeContext}));const instructions=await this.getInstructions({runtimeContext});voice?.addInstructions(this.#convertInstructionsToString(instructions));return voice;}else {return new chunkL4HKPD5B_cjs.DefaultVoice();}}get instructions(){this.logger.warn("The instructions property is deprecated. Please use getInstructions() instead.");if(typeof this.#instructions==="function"){const mastraError=new chunk5NTO7S5I_cjs.MastraError({id:"AGENT_INSTRUCTIONS_INCOMPATIBLE_WITH_FUNCTION_INSTRUCTIONS",domain:"AGENT"/* AGENT */,category:"USER"/* USER */,details:{agentName:this.name},text:"Instructions are not compatible when instructions are a function. Please use getInstructions() instead."});this.logger.trackException(mastraError);this.logger.error(mastraError.toString());throw mastraError;}if(typeof this.#instructions!=="string"){const mastraError=new chunk5NTO7S5I_cjs.MastraError({id:"AGENT_INSTRUCTIONS_MUST_BE_STRING_FOR_DEPRECATED_GETTER",domain:"AGENT"/* AGENT */,category:"USER"/* USER */,details:{agentName:this.name,instructionsType:Array.isArray(this.#instructions)?"array":"object"},text:"The instructions getter is deprecated and only supports string instructions. For non-string instructions, please use getInstructions() instead."});this.logger.trackException(mastraError);this.logger.error(mastraError.toString());throw mastraError;}return this.#instructions;}/**
|
|
808
808
|
* Gets the instructions for this agent, resolving function-based instructions if necessary.
|
|
809
809
|
* Instructions define the agent's behavior and capabilities.
|
|
810
810
|
*
|
|
@@ -1000,17 +1000,17 @@ _agentNetworkAppend:this._agentNetworkAppend}).add(result.response.messages,"res
|
|
|
1000
1000
|
* @internal
|
|
1001
1001
|
*/resolveOverrideScorerReferences(overrideScorers){const result={};for(const[id,scorerObject]of Object.entries(overrideScorers)){if(typeof scorerObject.scorer==="string"){try{if(!this.#mastra){throw new chunk5NTO7S5I_cjs.MastraError({id:"AGENT_GENEREATE_SCORER_NOT_FOUND",domain:"AGENT"/* AGENT */,category:"USER"/* USER */,text:`Mastra not found when fetching scorer. Make sure to fetch agent from mastra.getAgent()`});}const scorer=this.#mastra.getScorerByName(scorerObject.scorer);result[id]={scorer,sampling:scorerObject.sampling};}catch(error){this.logger.warn(`[Agent:${this.name}] - Failed to get scorer ${scorerObject.scorer}: ${error}`);}}else {result[id]=scorerObject;}}if(Object.keys(result).length===0){throw new chunk5NTO7S5I_cjs.MastraError({id:"AGENT_GENEREATE_SCORER_NOT_FOUND",domain:"AGENT"/* AGENT */,category:"USER"/* USER */,text:`No scorers found in overrideScorers`});}return result;}/**
|
|
1002
1002
|
* @internal
|
|
1003
|
-
*/async prepareLLMOptions(messages,options,methodType){const{context,memoryOptions:memoryConfigFromArgs,resourceId:resourceIdFromArgs,maxSteps,onStepFinish,toolsets,clientTools,temperature,toolChoice="auto",runtimeContext=new chunkGPWMM745_cjs.RuntimeContext(),tracingContext,tracingOptions,savePerStep,writableStream,...args}=options;const threadFromArgs=resolveThreadIdFromArgs({threadId:args.threadId,memory:args.memory});const resourceId=args.memory?.resource||resourceIdFromArgs;const memoryConfig=args.memory?.options||memoryConfigFromArgs;if(resourceId&&threadFromArgs&&!this.hasOwnMemory()){this.logger.warn(`[Agent:${this.name}] - No memory is configured but resourceId and threadId were passed in args. This will not work.`);}const runId=args.runId||this.#mastra?.generateId()||crypto2.randomUUID();const instructions=args.instructions||(await this.getInstructions({runtimeContext}));const llm=await this.getLLM({runtimeContext});const activeSpan=
|
|
1003
|
+
*/async prepareLLMOptions(messages,options,methodType){const{context,memoryOptions:memoryConfigFromArgs,resourceId:resourceIdFromArgs,maxSteps,onStepFinish,toolsets,clientTools,temperature,toolChoice="auto",runtimeContext=new chunkGPWMM745_cjs.RuntimeContext(),tracingContext,tracingOptions,savePerStep,writableStream,...args}=options;const threadFromArgs=resolveThreadIdFromArgs({threadId:args.threadId,memory:args.memory});const resourceId=args.memory?.resource||resourceIdFromArgs;const memoryConfig=args.memory?.options||memoryConfigFromArgs;if(resourceId&&threadFromArgs&&!this.hasOwnMemory()){this.logger.warn(`[Agent:${this.name}] - No memory is configured but resourceId and threadId were passed in args. This will not work.`);}const runId=args.runId||this.#mastra?.generateId()||crypto2.randomUUID();const instructions=args.instructions||(await this.getInstructions({runtimeContext}));const llm=await this.getLLM({runtimeContext});const activeSpan=chunkEQQWSQ5G_cjs.Telemetry.getActiveSpan();const baggageEntries={};if(threadFromArgs?.id){if(activeSpan){activeSpan.setAttribute("threadId",threadFromArgs.id);}baggageEntries.threadId={value:threadFromArgs.id};}if(resourceId){if(activeSpan){activeSpan.setAttribute("resourceId",resourceId);}baggageEntries.resourceId={value:resourceId};}if(Object.keys(baggageEntries).length>0){chunkEQQWSQ5G_cjs.Telemetry.setBaggage(baggageEntries);}const memory=await this.getMemory({runtimeContext});const saveQueueManager=new SaveQueueManager({logger:this.logger,memory});const{before,after}=this.__primitive({messages,instructions,context,thread:threadFromArgs,memoryConfig,resourceId,runId,toolsets,clientTools,runtimeContext,saveQueueManager,writableStream,methodType,tracingContext,tracingOptions});let messageList;let thread;let threadExists;return {llm,before:async()=>{const beforeResult=await before();const{messageObjects,convertedTools,agentAISpan}=beforeResult;threadExists=beforeResult.threadExists||false;messageList=beforeResult.messageList;thread=beforeResult.thread;const threadId=thread?.id;const result={...options,messages:messageObjects,tools:convertedTools,runId,temperature,toolChoice,threadId,resourceId,runtimeContext,onStepFinish:async props=>{if(savePerStep){if(!threadExists&&memory&&thread){await memory.createThread({threadId,title:thread.title,metadata:thread.metadata,resourceId:thread.resourceId,memoryConfig});threadExists=true;}await this.saveStepMessages({saveQueueManager,result:props,messageList,threadId,memoryConfig,runId});}return onStepFinish?.({...props,runId});},...(beforeResult.tripwire&&{tripwire:beforeResult.tripwire,tripwireReason:beforeResult.tripwireReason}),...args,agentAISpan};return result;},after:async({result,outputText,structuredOutput=false,agentAISpan,overrideScorers})=>{const afterResult=await after({result,outputText,threadId:thread?.id,thread,memoryConfig,runId,messageList,structuredOutput,threadExists,agentAISpan,overrideScorers});return afterResult;}};}/**
|
|
1004
1004
|
* Resolves and prepares model configurations for the LLM.
|
|
1005
1005
|
* @internal
|
|
1006
|
-
*/async prepareModels(runtimeContext,model){if(model||!Array.isArray(this.model)){const modelToUse=model??this.model;const resolvedModel=typeof modelToUse==="function"?await modelToUse({runtimeContext,mastra:this.#mastra}):modelToUse;if(resolvedModel?.specificationVersion!=="v2"){const mastraError=new chunk5NTO7S5I_cjs.MastraError({id:"AGENT_PREPARE_MODELS_INCOMPATIBLE_WITH_MODEL_ARRAY_V1",domain:"AGENT"/* AGENT */,category:"USER"/* USER */,details:{agentName:this.name},text:`[Agent:${this.name}] - Only v2 models are allowed when an array of models is provided`});this.logger.trackException(mastraError);this.logger.error(mastraError.toString());throw mastraError;}return [{id:"main",// TODO fix type check
|
|
1007
|
-
model:resolvedModel,maxRetries:this.maxRetries??0,enabled:true}];}const models=await Promise.all(this.model.map(async modelConfig=>{const model2=await this.resolveModelConfig(modelConfig.model,runtimeContext);if(!isV2Model(model2)){const mastraError=new chunk5NTO7S5I_cjs.MastraError({id:"AGENT_PREPARE_MODELS_INCOMPATIBLE_WITH_MODEL_ARRAY_V1",domain:"AGENT"/* AGENT */,category:"USER"/* USER */,details:{agentName:this.name},text:`[Agent:${this.name}] - Only v2 models are allowed when an array of models is provided`});this.logger.trackException(mastraError);this.logger.error(mastraError.toString());throw mastraError;}const modelId=modelConfig.id||model2.modelId;if(!modelId){const mastraError=new chunk5NTO7S5I_cjs.MastraError({id:"AGENT_PREPARE_MODELS_MISSING_MODEL_ID",domain:"AGENT"/* AGENT */,category:"USER"/* USER */,details:{agentName:this.name},text:`[Agent:${this.name}] - Unable to determine model ID. Please provide an explicit ID in the model configuration.`});this.logger.trackException(mastraError);this.logger.error(mastraError.toString());throw mastraError;}return {id:modelId,model:model2,maxRetries:modelConfig.maxRetries??0,enabled:modelConfig.enabled??true};}));return models;}/**
|
|
1006
|
+
*/async prepareModels(runtimeContext,model){if(model||!Array.isArray(this.model)){const modelToUse=model??this.model;const resolvedModel=typeof modelToUse==="function"?await modelToUse({runtimeContext,mastra:this.#mastra}):modelToUse;if(resolvedModel?.specificationVersion!=="v2"){const mastraError=new chunk5NTO7S5I_cjs.MastraError({id:"AGENT_PREPARE_MODELS_INCOMPATIBLE_WITH_MODEL_ARRAY_V1",domain:"AGENT"/* AGENT */,category:"USER"/* USER */,details:{agentName:this.name},text:`[Agent:${this.name}] - Only v2 models are allowed when an array of models is provided`});this.logger.trackException(mastraError);this.logger.error(mastraError.toString());throw mastraError;}let headers;if(resolvedModel instanceof chunk22DLIF7L_cjs.ModelRouterLanguageModel){headers=resolvedModel.config?.headers;}return [{id:"main",// TODO fix type check
|
|
1007
|
+
model:resolvedModel,maxRetries:this.maxRetries??0,enabled:true,headers}];}const models=await Promise.all(this.model.map(async modelConfig=>{const model2=await this.resolveModelConfig(modelConfig.model,runtimeContext);if(!isV2Model(model2)){const mastraError=new chunk5NTO7S5I_cjs.MastraError({id:"AGENT_PREPARE_MODELS_INCOMPATIBLE_WITH_MODEL_ARRAY_V1",domain:"AGENT"/* AGENT */,category:"USER"/* USER */,details:{agentName:this.name},text:`[Agent:${this.name}] - Only v2 models are allowed when an array of models is provided`});this.logger.trackException(mastraError);this.logger.error(mastraError.toString());throw mastraError;}const modelId=modelConfig.id||model2.modelId;if(!modelId){const mastraError=new chunk5NTO7S5I_cjs.MastraError({id:"AGENT_PREPARE_MODELS_MISSING_MODEL_ID",domain:"AGENT"/* AGENT */,category:"USER"/* USER */,details:{agentName:this.name},text:`[Agent:${this.name}] - Unable to determine model ID. Please provide an explicit ID in the model configuration.`});this.logger.trackException(mastraError);this.logger.error(mastraError.toString());throw mastraError;}let headers;if(model2 instanceof chunk22DLIF7L_cjs.ModelRouterLanguageModel){headers=model2.config?.headers;}return {id:modelId,model:model2,maxRetries:modelConfig.maxRetries??0,enabled:modelConfig.enabled??true,headers};}));return models;}/**
|
|
1008
1008
|
* Merges telemetry wrapper with default onFinish callback when needed
|
|
1009
1009
|
* @internal
|
|
1010
1010
|
*/#mergeOnFinishWithTelemetry(streamOptions,defaultStreamOptions){let finalOnFinish=streamOptions?.onFinish||defaultStreamOptions.onFinish;if(streamOptions?.onFinish&&streamOptions.onFinish.__hasOriginalOnFinish===false&&defaultStreamOptions.onFinish){const telemetryWrapper=streamOptions.onFinish;const defaultCallback=defaultStreamOptions.onFinish;finalOnFinish=async data=>{await telemetryWrapper(data);await defaultCallback(data);};}return finalOnFinish;}/**
|
|
1011
1011
|
* Executes the agent with VNext execution model, handling tools, memory, and streaming.
|
|
1012
1012
|
* @internal
|
|
1013
|
-
*/async#execute({methodType,format="mastra",resumeContext,...options}){const existingSnapshot=resumeContext?.snapshot;let snapshotMemoryInfo;if(existingSnapshot){for(const key in existingSnapshot?.context){const step=existingSnapshot?.context[key];if(step&&step.status==="suspended"&&step.suspendPayload?.__streamState){snapshotMemoryInfo=step.suspendPayload?.__streamState?.messageList?.memoryInfo;break;}}}const runtimeContext=options.runtimeContext||new chunkGPWMM745_cjs.RuntimeContext();const threadFromArgs=resolveThreadIdFromArgs({threadId:options.threadId||snapshotMemoryInfo?.threadId,memory:options.memory});const resourceId=options.memory?.resource||options.resourceId||snapshotMemoryInfo?.resourceId;const memoryConfig=options.memory?.options;if(resourceId&&threadFromArgs&&!this.hasOwnMemory()){this.logger.warn(`[Agent:${this.name}] - No memory is configured but resourceId and threadId were passed in args. This will not work.`);}const llm=await this.getLLM({runtimeContext,model:options.model});const runId=options.runId||this.#mastra?.generateId()||crypto2.randomUUID();const instructions=options.instructions||(await this.getInstructions({runtimeContext}));const agentAISpan=chunkQGJF6TRY_cjs.getOrCreateSpan({type:"agent_run"/* AGENT_RUN */,name:`agent run: '${this.id}'`,input:options.messages,attributes:{agentId:this.id,instructions:this.#convertInstructionsToString(instructions)},metadata:{runId,resourceId,threadId:threadFromArgs?.id},tracingPolicy:this.#options?.tracingPolicy,tracingOptions:options.tracingOptions,tracingContext:options.tracingContext,runtimeContext});const activeSpan=
|
|
1013
|
+
*/async#execute({methodType,format="mastra",resumeContext,...options}){const existingSnapshot=resumeContext?.snapshot;let snapshotMemoryInfo;if(existingSnapshot){for(const key in existingSnapshot?.context){const step=existingSnapshot?.context[key];if(step&&step.status==="suspended"&&step.suspendPayload?.__streamState){snapshotMemoryInfo=step.suspendPayload?.__streamState?.messageList?.memoryInfo;break;}}}const runtimeContext=options.runtimeContext||new chunkGPWMM745_cjs.RuntimeContext();const threadFromArgs=resolveThreadIdFromArgs({threadId:options.threadId||snapshotMemoryInfo?.threadId,memory:options.memory});const resourceId=options.memory?.resource||options.resourceId||snapshotMemoryInfo?.resourceId;const memoryConfig=options.memory?.options;if(resourceId&&threadFromArgs&&!this.hasOwnMemory()){this.logger.warn(`[Agent:${this.name}] - No memory is configured but resourceId and threadId were passed in args. This will not work.`);}const llm=await this.getLLM({runtimeContext,model:options.model});const runId=options.runId||this.#mastra?.generateId()||crypto2.randomUUID();const instructions=options.instructions||(await this.getInstructions({runtimeContext}));const agentAISpan=chunkQGJF6TRY_cjs.getOrCreateSpan({type:"agent_run"/* AGENT_RUN */,name:`agent run: '${this.id}'`,input:options.messages,attributes:{agentId:this.id,instructions:this.#convertInstructionsToString(instructions)},metadata:{runId,resourceId,threadId:threadFromArgs?.id},tracingPolicy:this.#options?.tracingPolicy,tracingOptions:options.tracingOptions,tracingContext:options.tracingContext,runtimeContext});const activeSpan=chunkEQQWSQ5G_cjs.Telemetry.getActiveSpan();const baggageEntries={};if(threadFromArgs?.id){if(activeSpan){activeSpan.setAttribute("threadId",threadFromArgs.id);}baggageEntries.threadId={value:threadFromArgs.id};}if(resourceId){if(activeSpan){activeSpan.setAttribute("resourceId",resourceId);}baggageEntries.resourceId={value:resourceId};}if(Object.keys(baggageEntries).length>0){chunkEQQWSQ5G_cjs.Telemetry.setBaggage(baggageEntries);}const memory=await this.getMemory({runtimeContext});const saveQueueManager=new SaveQueueManager({logger:this.logger,memory});if(process.env.NODE_ENV!=="test"){this.logger.debug(`[Agents:${this.name}] - Starting generation`,{runId});}const capabilities={agentName:this.name,logger:this.logger,getMemory:this.getMemory.bind(this),getModel:this.getModel.bind(this),generateMessageId:this.#mastra?.generateId?.bind(this.#mastra)||(()=>crypto2.randomUUID()),_agentNetworkAppend:"_agentNetworkAppend"in this?Boolean(this._agentNetworkAppend):void 0,saveStepMessages:this.saveStepMessages.bind(this),convertTools:this.convertTools.bind(this),getMemoryMessages:this.getMemoryMessages.bind(this),runInputProcessors:this.__runInputProcessors.bind(this),executeOnFinish:this.#executeOnFinish.bind(this),outputProcessors:this.#outputProcessors,llm,getTelemetry:this.#mastra?.getTelemetry?.bind(this.#mastra)};const executionWorkflow=createPrepareStreamWorkflow({capabilities,options:{...options,methodType},threadFromArgs,resourceId,runId,runtimeContext,agentAISpan,methodType,format,instructions,memoryConfig,memory,saveQueueManager,returnScorerData:options.returnScorerData,requireToolApproval:options.requireToolApproval,resumeContext,agentId:this.id,toolCallId:options.toolCallId});const run=await executionWorkflow.createRunAsync();const result=await run.start({tracingContext:{currentSpan:agentAISpan}});return result;}/**
|
|
1014
1014
|
* Handles post-execution tasks including memory persistence and title generation.
|
|
1015
1015
|
* @internal
|
|
1016
1016
|
*/async#executeOnFinish({result,instructions,readOnlyMemory,thread:threadAfter,threadId,resourceId,memoryConfig,outputText,runtimeContext,agentAISpan,runId,messageList,threadExists,structuredOutput=false,saveQueueManager,overrideScorers}){const resToLog={text:result.text,object:result.object,toolResults:result.toolResults,toolCalls:result.toolCalls,usage:result.usage,steps:result.steps.map(s=>{return {stepType:s.stepType,text:s.text,toolResults:s.toolResults,toolCalls:s.toolCalls,usage:s.usage};})};this.logger.debug(`[Agent:${this.name}] - Post processing LLM response`,{runId,result:resToLog,threadId,resourceId});const messageListResponses=messageList.get.response.aiV4.core();const usedWorkingMemory=messageListResponses.some(m=>m.role==="tool"&&m.content.some(c=>c.toolName==="updateWorkingMemory"));const memory=await this.getMemory({runtimeContext});const thread=usedWorkingMemory?threadId?await memory?.getThreadById({threadId}):void 0:threadAfter;if(memory&&resourceId&&thread&&!readOnlyMemory){try{let responseMessages=result.response.messages;if(!responseMessages&&result.object){responseMessages=[{id:result.response.id,role:"assistant",content:[{type:"text",text:outputText// outputText contains the stringified object
|
|
@@ -1314,5 +1314,5 @@ exports.updateStepInHierarchy = updateStepInHierarchy;
|
|
|
1314
1314
|
exports.validateStepInput = validateStepInput;
|
|
1315
1315
|
exports.validateStepResumeData = validateStepResumeData;
|
|
1316
1316
|
exports.workflowToStep = workflowToStep;
|
|
1317
|
-
//# sourceMappingURL=chunk-
|
|
1318
|
-
//# sourceMappingURL=chunk-
|
|
1317
|
+
//# sourceMappingURL=chunk-3RX5ZF4V.cjs.map
|
|
1318
|
+
//# sourceMappingURL=chunk-3RX5ZF4V.cjs.map
|