@mastra/core 1.87.0-alpha.1 → 1.87.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent/durable/index.cjs +1 -1
- package/dist/agent/durable/index.js +1 -1
- package/dist/agent/index.cjs +2 -2
- package/dist/agent/index.js +2 -2
- package/dist/agent-builder/ee/index.cjs +1 -1
- package/dist/agent-builder/ee/index.js +1 -1
- package/dist/agent-controller/index.cjs +1 -1
- package/dist/agent-controller/index.js +1 -1
- package/dist/{agent-controller-C1bK0CXm.js → agent-controller-Dc58ARqw.js} +5 -5
- package/dist/{agent-controller-BTIxiD1u.cjs → agent-controller-v64JbuDa.cjs} +5 -5
- package/dist/background-tasks/index.cjs +1 -1
- package/dist/background-tasks/index.js +1 -1
- package/dist/{background-tasks-CVl6e0Jo.cjs → background-tasks-DgiQNKh7.cjs} +1 -1
- package/dist/{background-tasks-BbVsBghi.js → background-tasks-E-Jjxks4.js} +1 -1
- package/dist/browser/index.cjs +1 -1
- package/dist/browser/index.js +1 -1
- package/dist/{builder-BRJPSTig.cjs → builder-Dfp6Ckjr.cjs} +2 -2
- package/dist/{builder-C8XzrtBQ.js → builder-Dh175HnQ.js} +2 -2
- package/dist/channels/index.cjs +2 -2
- package/dist/channels/index.js +2 -2
- package/dist/{channels-DegTNzaq.js → channels-0AO7PMJF.js} +1 -1
- package/dist/{channels-Cl-pRrWB.cjs → channels-BZL9RT2i.cjs} +1 -1
- package/dist/coding-agent/index.cjs +1 -1
- package/dist/coding-agent/index.js +1 -1
- package/dist/datasets/index.cjs +2 -2
- package/dist/datasets/index.js +2 -2
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +452 -452
- package/dist/evals/index.cjs +1 -1
- package/dist/evals/index.js +1 -1
- package/dist/evals/scoreTraces/index.cjs +1 -1
- package/dist/evals/scoreTraces/index.js +1 -1
- package/dist/harness/index.cjs +1 -1
- package/dist/harness/index.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/knowledge/importers/host.d.ts +7 -1
- package/dist/knowledge/importers/runner.d.ts +12 -0
- package/dist/knowledge/importers/types.d.ts +2 -0
- package/dist/knowledge/index.cjs +82 -6
- package/dist/knowledge/index.js +82 -6
- package/dist/llm/index.cjs +3 -3
- package/dist/llm/index.js +3 -3
- package/dist/{llm-CMkzIFAk.js → llm-B46V7Mi7.js} +2 -2
- package/dist/{llm-BKxlS9Kk.cjs → llm-B4AeSFvV.cjs} +2 -2
- package/dist/loop/index.cjs +2 -2
- package/dist/loop/index.js +2 -2
- package/dist/{manager-C-eQXmRq.js → manager-BRAvwB9b.js} +2 -2
- package/dist/{manager-CasaT35Q.cjs → manager-BwDxA1Nn.cjs} +2 -2
- package/dist/mastra/index.cjs +1 -1
- package/dist/mastra/index.js +1 -1
- package/dist/{mastra-5EEmN3Ok.js → mastra-CIx6qEq2.js} +16 -16
- package/dist/{mastra-C7Tj4U8c.cjs → mastra-DBhdD172.cjs} +16 -16
- package/dist/memory/index.cjs +2 -2
- package/dist/memory/index.js +2 -2
- package/dist/{model-DCLUL-8a.js → model-CJMsDU8w.js} +1 -1
- package/dist/{model-9HA-W0tg.cjs → model-CYhAa5qO.cjs} +1 -1
- package/dist/{netlify-Cq3H-A9I.cjs → netlify-Bw7Vd58y.cjs} +1 -1
- package/dist/{netlify-DaWURNSU.js → netlify-C9aJA6Cv.js} +1 -1
- package/dist/notifications/index.cjs +1 -1
- package/dist/notifications/index.js +1 -1
- package/dist/processor-provider/index.cjs +1 -1
- package/dist/processor-provider/index.js +1 -1
- package/dist/processors/index.cjs +2 -2
- package/dist/processors/index.js +2 -2
- package/dist/{provider-registry-a649fS5r.cjs → provider-registry-Bn_7VvZ8.cjs} +4 -4
- package/dist/{provider-registry-DWixjFX7.js → provider-registry-DOfYSEju.js} +4 -4
- package/dist/{registry-generator-BuKC7UKd.cjs → registry-generator-BnK5Npgr.cjs} +1 -1
- package/dist/{registry-generator-BYJC7p8M.js → registry-generator-Cw594Ttt.js} +1 -1
- package/dist/{rehydrate-DR2_WAz2.cjs → rehydrate-BWnd_TEx.cjs} +2 -2
- package/dist/{rehydrate-DPhmASM6.js → rehydrate-Dgqkw7Py.js} +2 -2
- package/dist/relevance/index.cjs +2 -2
- package/dist/relevance/index.js +2 -2
- package/dist/{run-registry-D3X7XvUL.js → run-registry-DhOKJtlb.js} +7 -7
- package/dist/{run-registry-oUNF6szW.cjs → run-registry-lLRc7EE6.cjs} +7 -7
- package/dist/storage/index.cjs +2 -2
- package/dist/storage/index.js +2 -2
- package/dist/stream/index.cjs +2 -2
- package/dist/stream/index.js +2 -2
- package/dist/{stream-DQC1vpvl.cjs → stream-BIDts1fZ.cjs} +1 -1
- package/dist/{stream-DoZ6F41o.js → stream-C8HKG3qC.js} +1 -1
- package/dist/test-utils/llm-mock.cjs +1 -1
- package/dist/test-utils/llm-mock.js +1 -1
- package/dist/tool-loop-agent/index.cjs +1 -1
- package/dist/tool-loop-agent/index.js +1 -1
- package/dist/{tool-loop-agent-C9YkvDRd.js → tool-loop-agent-DM5V_0XS.js} +3 -3
- package/dist/{tool-loop-agent-Cy4NDOMS.cjs → tool-loop-agent-PEY5a1R6.cjs} +3 -3
- package/dist/{utils-Bs2IYyOb.cjs → utils-CxMSu_wc.cjs} +1 -1
- package/dist/{utils-9JyiKu5r.js → utils-DcnKVK34.js} +1 -1
- package/dist/utils.cjs +1 -1
- package/dist/utils.js +1 -1
- package/dist/{validate-8j0phWFV.js → validate-Dn750ciE.js} +1 -1
- package/dist/{validate-BE3mVxVy.cjs → validate-RVKgazCf.cjs} +1 -1
- package/dist/vector/index.cjs +1 -1
- package/dist/vector/index.js +1 -1
- package/dist/worker/index.cjs +1 -1
- package/dist/worker/index.js +1 -1
- package/dist/{worker-BiK1kfMa.cjs → worker-CFPu9qwV.cjs} +2 -2
- package/dist/{worker-DIRdEwih.js → worker-DJPAdazC.js} +2 -2
- package/dist/{worker-DwdgU6E9.cjs → worker-Dx0ZHMGX.cjs} +2 -2
- package/dist/{worker-BfWFqSH2.js → worker-SDi9jbP5.js} +2 -2
- package/dist/{workflow-ni-keg2i.js → workflow-DkBqNn7X.js} +3 -3
- package/dist/{workflow-CxQMcTbT.cjs → workflow-ZFOz_365.cjs} +3 -3
- package/dist/workflows/builder/index.cjs +1 -1
- package/dist/workflows/builder/index.js +1 -1
- package/dist/workflows/evented/index.cjs +1 -1
- package/dist/workflows/evented/index.js +1 -1
- package/dist/workflows/index.cjs +4 -4
- package/dist/workflows/index.js +4 -4
- package/package.json +7 -7
package/dist/evals/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_run_registry = require("../run-registry-
|
|
2
|
+
const require_run_registry = require("../run-registry-lLRc7EE6.cjs");
|
|
3
3
|
const require_constants = require("../constants-B9ZDvXZ4.cjs");
|
|
4
4
|
const require_collect_tool_mocks = require("../collect-tool-mocks-k9fM6oDl.cjs");
|
|
5
5
|
exports.MastraScorer = require_run_registry.MastraScorer;
|
package/dist/evals/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as MastraScorer, D as isNotScorable, E as filterRun, Mc as evaluateScoringPredicate, Nc as validateScoringPredicate, O as notScorable, S as createClassifierScorer, T as createScorer, jc as SCORING_PREDICATE_ROOTS, v as runEvals, w as ScorerRunError } from "../run-registry-
|
|
1
|
+
import { C as MastraScorer, D as isNotScorable, E as filterRun, Mc as evaluateScoringPredicate, Nc as validateScoringPredicate, O as notScorable, S as createClassifierScorer, T as createScorer, jc as SCORING_PREDICATE_ROOTS, v as runEvals, w as ScorerRunError } from "../run-registry-DhOKJtlb.js";
|
|
2
2
|
import { Ar as scoringEntityTypeSchema, Cr as extractTrajectory, Dr as saveScorePayloadSchema, Er as listScoresResponseSchema, Fr as scoringInputWithExtractStepResultAndScoreAndReasonSchema, Ir as scoringInputWithExtractStepResultSchema, Lr as scoringPromptsSchema, Mr as scoringHookInputSchema, Nr as scoringInputSchema, Or as scoreResultSchema, Pr as scoringInputWithExtractStepResultAndAnalyzeStepResultSchema, Rr as scoringSourceSchema, Tr as extractWorkflowTrajectory, jr as scoringExtractStepResultSchema, kr as scoreRowDataSchema, wr as extractTrajectoryFromTrace, zr as scoringValueSchema } from "../constants-BmdTvEYN.js";
|
|
3
3
|
import { t as collectToolMocks } from "../collect-tool-mocks-3s2BN8o7.js";
|
|
4
4
|
export { MastraScorer, SCORING_PREDICATE_ROOTS, ScorerRunError, collectToolMocks, createClassifierScorer, createScorer, evaluateScoringPredicate, extractTrajectory, extractTrajectoryFromTrace, extractWorkflowTrajectory, filterRun, isNotScorable, listScoresResponseSchema, notScorable, runEvals, saveScorePayloadSchema, scoreResultSchema, scoreRowDataSchema, scoringEntityTypeSchema, scoringExtractStepResultSchema, scoringHookInputSchema, scoringInputSchema, scoringInputWithExtractStepResultAndAnalyzeStepResultSchema, scoringInputWithExtractStepResultAndScoreAndReasonSchema, scoringInputWithExtractStepResultSchema, scoringPromptsSchema, scoringSourceSchema, scoringValueSchema, validateScoringPredicate };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_error = require("../../error-D90lJ6M7.cjs");
|
|
3
3
|
const require_utils = require("../../utils-D-eNsgDM.cjs");
|
|
4
|
-
const require_run_registry = require("../../run-registry-
|
|
4
|
+
const require_run_registry = require("../../run-registry-lLRc7EE6.cjs");
|
|
5
5
|
const require_constants = require("../../constants-B9ZDvXZ4.cjs");
|
|
6
6
|
let zod_v4 = require("zod/v4");
|
|
7
7
|
// src/evals/scoreTraces/scoreTraces.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { i as MastraError, n as ErrorDomain, t as ErrorCategory } from "../../error-oh2DLsP2.js";
|
|
2
2
|
import { i as getEntityTypeForSpan } from "../../utils-DU_pU5SK.js";
|
|
3
|
-
import { Hs as createStep, Us as createWorkflow } from "../../run-registry-
|
|
3
|
+
import { Hs as createStep, Us as createWorkflow } from "../../run-registry-DhOKJtlb.js";
|
|
4
4
|
import { Dr as saveScorePayloadSchema } from "../../constants-BmdTvEYN.js";
|
|
5
5
|
import { z } from "zod/v4";
|
|
6
6
|
// src/evals/scoreTraces/scoreTraces.ts
|
package/dist/harness/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_state_processor = require("../state-processor-kRNZ38Nf.cjs");
|
|
3
3
|
const require_tools = require("../tools-CGF5Ik6j.cjs");
|
|
4
|
-
const require_agent_controller = require("../agent-controller-
|
|
4
|
+
const require_agent_controller = require("../agent-controller-v64JbuDa.cjs");
|
|
5
5
|
// src/harness/index.ts
|
|
6
6
|
/**
|
|
7
7
|
* @deprecated Backwards-compatibility entrypoint.
|
package/dist/harness/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { f as taskCheckTool, h as taskWriteTool, m as taskUpdateTool, o as assignTaskIds, p as taskCompleteTool } from "../state-processor-B9kxpM53.js";
|
|
2
2
|
import { s as askUserTool, t as submitPlanTool } from "../tools-CDfyMpzN.js";
|
|
3
|
-
import { a as Session, c as defaultDisplayState, l as defaultOMProgressState, n as parseSubagentMeta, t as AgentController } from "../agent-controller-
|
|
3
|
+
import { a as Session, c as defaultDisplayState, l as defaultOMProgressState, n as parseSubagentMeta, t as AgentController } from "../agent-controller-Dc58ARqw.js";
|
|
4
4
|
// src/harness/index.ts
|
|
5
5
|
/**
|
|
6
6
|
* @deprecated Backwards-compatibility entrypoint.
|
package/dist/index.cjs
CHANGED
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as Mastra } from "./mastra-
|
|
1
|
+
export { t as Mastra } from "./mastra-CIx6qEq2.js";
|
|
@@ -24,6 +24,12 @@ export type KnowledgeImporterRunStart = {
|
|
|
24
24
|
* trusts only what the host returns here; the runner picks the importer from it.
|
|
25
25
|
*/
|
|
26
26
|
binding?: KnowledgeImporterRunBinding;
|
|
27
|
+
/**
|
|
28
|
+
* The largest flush request the host takes, in bytes of the request encoded as JSON. The
|
|
29
|
+
* runner keeps under the lower of this and its own `maxFlushBytes`. Ignored unless a positive
|
|
30
|
+
* whole number.
|
|
31
|
+
*/
|
|
32
|
+
maxFlushBytes?: number;
|
|
27
33
|
}
|
|
28
34
|
/** Another run of the binding is going; the host recorded this one as skipped. */
|
|
29
35
|
| {
|
|
@@ -100,7 +106,7 @@ export declare class KnowledgeImporterHostConflictError extends Error {
|
|
|
100
106
|
readonly status = 409;
|
|
101
107
|
constructor(code: KnowledgeImporterHostConflictCode, message: string);
|
|
102
108
|
}
|
|
103
|
-
export declare const KNOWLEDGE_IMPORTER_ERROR_CODES: readonly ["source_auth_failed", "source_unreachable", "source_rate_limited", "source_bad_response", "source_not_found", "settings_invalid", "credential_missing", "importer_missing_from_deploy", "importer_error", "stopped", "lease_expired", "deadline_exceeded"];
|
|
109
|
+
export declare const KNOWLEDGE_IMPORTER_ERROR_CODES: readonly ["source_auth_failed", "source_unreachable", "source_rate_limited", "source_bad_response", "source_not_found", "settings_invalid", "credential_missing", "importer_missing_from_deploy", "importer_error", "flush_too_large", "stopped", "lease_expired", "deadline_exceeded"];
|
|
104
110
|
export type NormalizedKnowledgeImporterFinish = Omit<KnowledgeImporterRunReceipt, 'runId' | 'counts' | 'chain'>;
|
|
105
111
|
/**
|
|
106
112
|
* The finish request as a host stores and compares it: missing optional fields become null.
|
|
@@ -21,6 +21,18 @@ export interface RunKnowledgeImportOptions {
|
|
|
21
21
|
maxPasses?: number;
|
|
22
22
|
/** Ops per flush. Default 200. */
|
|
23
23
|
bufferSize?: number;
|
|
24
|
+
/**
|
|
25
|
+
* Largest flush request, in bytes of the request encoded as JSON (`runId`, `generation`, `seq`,
|
|
26
|
+
* `digest`, `ops` and `state`): the buffer is sent before an op or a saved state would take it
|
|
27
|
+
* over. An op or a state too big for a request on its own ends the run `flush_too_large` before
|
|
28
|
+
* anything more is sent, and so does any request that would still be over it when sent. With a
|
|
29
|
+
* limit, each pushed op is copied through JSON when handed over, so later changes to it are not
|
|
30
|
+
* sent and values JSON can't carry arrive as JSON makes them. A host that
|
|
31
|
+
* wraps the request, or limits its whole HTTP body, sets this a little under its limit. A host
|
|
32
|
+
* can also give a limit when the run starts; the lower of the two applies. A positive whole
|
|
33
|
+
* number. Default no limit.
|
|
34
|
+
*/
|
|
35
|
+
maxFlushBytes?: number;
|
|
24
36
|
/**
|
|
25
37
|
* How long the oldest buffered op may wait before it is sent without waiting for a full buffer.
|
|
26
38
|
* A timed flush sends items only; the cursor is still saved only by `ctx.state.set`. A positive
|
|
@@ -94,6 +94,8 @@ export type KnowledgeImporterRunOutcome = 'succeeded' | 'failed' | 'canceled';
|
|
|
94
94
|
* show them, so an app's exception text never leaves the app's own logs.
|
|
95
95
|
*/
|
|
96
96
|
export type KnowledgeImporterErrorCode = 'source_auth_failed' | 'source_unreachable' | 'source_rate_limited' | 'source_bad_response' | 'source_not_found' | 'settings_invalid' | 'credential_missing' | 'importer_missing_from_deploy' | 'importer_error'
|
|
97
|
+
/** An op, or a state saved with `ctx.state.set`, is bigger than the host takes in one flush. */
|
|
98
|
+
| 'flush_too_large'
|
|
97
99
|
/** Hard deadline reached; the cursor stays behind what didn't land. */
|
|
98
100
|
| 'stopped'
|
|
99
101
|
/** Recorded by a host that ended the run: its runner stopped renewing the lease. */
|
package/dist/knowledge/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_base = require("../base-BIzR1D3_.cjs");
|
|
3
|
-
const require_run_registry = require("../run-registry-
|
|
3
|
+
const require_run_registry = require("../run-registry-lLRc7EE6.cjs");
|
|
4
4
|
const require_tool = require("../tool-CYlT2UA-.cjs");
|
|
5
5
|
let crypto = require("crypto");
|
|
6
6
|
let _mastra_schema_compat_schema = require("@mastra/schema-compat/schema");
|
|
@@ -174,6 +174,7 @@ const KNOWLEDGE_IMPORTER_ERROR_CODES = [
|
|
|
174
174
|
"credential_missing",
|
|
175
175
|
"importer_missing_from_deploy",
|
|
176
176
|
"importer_error",
|
|
177
|
+
"flush_too_large",
|
|
177
178
|
"stopped",
|
|
178
179
|
"lease_expired",
|
|
179
180
|
"deadline_exceeded"
|
|
@@ -671,17 +672,22 @@ function sourceError(error) {
|
|
|
671
672
|
* @experimental
|
|
672
673
|
*/
|
|
673
674
|
async function runKnowledgeImport(options) {
|
|
674
|
-
const { host, budgetMs = 15e5, graceMs = 18e4, maxPasses = 200, bufferSize = 200, flushAfterMs = 3e4, heartbeatMs = 3e4, maxRetries = 8, hostCallTimeoutMs = 6e4, retryDelayMs = (attempt) => Math.min(250 * 2 ** attempt, 1e4) } = options;
|
|
675
|
+
const { host, budgetMs = 15e5, graceMs = 18e4, maxPasses = 200, bufferSize = 200, maxFlushBytes: ownMaxFlushBytes = Infinity, flushAfterMs = 3e4, heartbeatMs = 3e4, maxRetries = 8, hostCallTimeoutMs = 6e4, retryDelayMs = (attempt) => Math.min(250 * 2 ** attempt, 1e4) } = options;
|
|
675
676
|
if (!Number.isFinite(flushAfterMs) || flushAfterMs <= 0 || flushAfterMs > 2 ** 31 - 1) throw new TypeError(`flushAfterMs must be a positive number of milliseconds up to 2147483647, got ${flushAfterMs}`);
|
|
677
|
+
if (ownMaxFlushBytes !== Infinity && !(Number.isInteger(ownMaxFlushBytes) && ownMaxFlushBytes > 0)) throw new TypeError(`maxFlushBytes must be a positive whole number of bytes, got ${ownMaxFlushBytes}`);
|
|
676
678
|
const started = await within(host.startRun(options.bindingId, options.start), hostCallTimeoutMs, () => new KnowledgeImporterHostError("host call timed out"));
|
|
677
679
|
if (started.status === "skipped") return started;
|
|
678
680
|
const { runId, generation } = started;
|
|
681
|
+
const hostMaxFlushBytes = started.maxFlushBytes;
|
|
682
|
+
const maxFlushBytes = typeof hostMaxFlushBytes === "number" && Number.isInteger(hostMaxFlushBytes) && hostMaxFlushBytes > 0 ? Math.min(ownMaxFlushBytes, hostMaxFlushBytes) : ownMaxFlushBytes;
|
|
679
683
|
const startedAt = Date.now();
|
|
680
684
|
let lastSeq = started.lastSeq;
|
|
681
685
|
/** A flush sent but never acknowledged: it may have committed. */
|
|
682
686
|
let unsettledSeq;
|
|
683
687
|
let state = { ...started.state };
|
|
684
688
|
let buffer = [];
|
|
689
|
+
/** Encoded bytes of the ops in `buffer`, without the commas between them. */
|
|
690
|
+
let bufferBytes = 0;
|
|
685
691
|
let stop;
|
|
686
692
|
/** Armed while the buffer holds ops; sends them once the oldest has waited `flushAfterMs`. */
|
|
687
693
|
let flushTimer;
|
|
@@ -732,6 +738,7 @@ async function runKnowledgeImport(options) {
|
|
|
732
738
|
disarm();
|
|
733
739
|
const ops = buffer;
|
|
734
740
|
buffer = [];
|
|
741
|
+
bufferBytes = 0;
|
|
735
742
|
const next = flushing.then(async () => {
|
|
736
743
|
if (stop) throw stop;
|
|
737
744
|
if (ops.length === 0 && !staged && !settle) return;
|
|
@@ -756,6 +763,11 @@ async function runKnowledgeImport(options) {
|
|
|
756
763
|
digest,
|
|
757
764
|
...body
|
|
758
765
|
};
|
|
766
|
+
if (maxFlushBytes !== Infinity && encodedBytes(request) > maxFlushBytes) {
|
|
767
|
+
flushFailure = { code: "flush_too_large" };
|
|
768
|
+
halt("flush");
|
|
769
|
+
throw stop;
|
|
770
|
+
}
|
|
759
771
|
unsettledSeq = seq;
|
|
760
772
|
try {
|
|
761
773
|
const receipt = await withRetries(() => host.flush(request), "mutation");
|
|
@@ -780,14 +792,70 @@ async function runKnowledgeImport(options) {
|
|
|
780
792
|
flushing = next.catch(() => {});
|
|
781
793
|
return next;
|
|
782
794
|
}
|
|
783
|
-
|
|
795
|
+
/** The request around the ops, at the longest `seq` it can have; `ops` empty, no `state`. */
|
|
796
|
+
const envelopeBytes = encodedBytes({
|
|
797
|
+
runId,
|
|
798
|
+
generation,
|
|
799
|
+
seq: Number.MAX_SAFE_INTEGER,
|
|
800
|
+
digest: "0".repeat(64),
|
|
801
|
+
ops: []
|
|
802
|
+
});
|
|
803
|
+
/**
|
|
804
|
+
* The envelope at the shortest `seq` the next request can have. A request's `seq` is only known
|
|
805
|
+
* when it is sent, so splitting plans for the longest; refusing what can never fit uses the
|
|
806
|
+
* shortest, and the request as sent is measured again before it goes.
|
|
807
|
+
*/
|
|
808
|
+
const shortestEnvelopeBytes = () => envelopeBytes - String(Number.MAX_SAFE_INTEGER).length + String(lastSeq + 1).length;
|
|
809
|
+
/** Bytes of a request holding the buffer plus `extra` more ops' bytes over `more` ops, and a state. */
|
|
810
|
+
const requestBytes = (extra, more, stateBytes) => {
|
|
811
|
+
const count = buffer.length + more;
|
|
812
|
+
const commas = Math.max(count - 1, 0);
|
|
813
|
+
const state = stateBytes === void 0 ? 0 : 9 + stateBytes;
|
|
814
|
+
return envelopeBytes + bufferBytes + extra + commas + state;
|
|
815
|
+
};
|
|
816
|
+
/**
|
|
817
|
+
* Measures what the importer hands over and returns a copy decoded from that encoding, so a value
|
|
818
|
+
* the importer changes after handing it over can't outgrow its measured size. Anything
|
|
819
|
+
* unencodable or too big ends the run here.
|
|
820
|
+
*/
|
|
821
|
+
const measure = (value, alone) => {
|
|
822
|
+
let json;
|
|
823
|
+
let bytes;
|
|
824
|
+
try {
|
|
825
|
+
json = JSON.stringify(value);
|
|
826
|
+
bytes = new TextEncoder().encode(json).byteLength;
|
|
827
|
+
} catch (error) {
|
|
828
|
+
flushFailure = { code: "importer_error" };
|
|
829
|
+
halt("flush");
|
|
830
|
+
throw error;
|
|
831
|
+
}
|
|
832
|
+
if (alone(bytes) > maxFlushBytes) {
|
|
833
|
+
flushFailure = { code: "flush_too_large" };
|
|
834
|
+
halt("flush");
|
|
835
|
+
throw stop;
|
|
836
|
+
}
|
|
837
|
+
return {
|
|
838
|
+
bytes,
|
|
839
|
+
copy: JSON.parse(json)
|
|
840
|
+
};
|
|
841
|
+
};
|
|
842
|
+
const push = async (handed) => {
|
|
784
843
|
if (stop) throw stop;
|
|
844
|
+
let op = handed;
|
|
845
|
+
let sending;
|
|
846
|
+
if (maxFlushBytes !== Infinity) {
|
|
847
|
+
const { bytes, copy } = measure(handed, (opBytes) => shortestEnvelopeBytes() + opBytes);
|
|
848
|
+
op = copy;
|
|
849
|
+
if (buffer.length > 0 && requestBytes(bytes, 1) > maxFlushBytes) sending = flush();
|
|
850
|
+
bufferBytes += bytes;
|
|
851
|
+
}
|
|
785
852
|
buffer.push(op);
|
|
786
|
-
if (buffer.length
|
|
787
|
-
else if (!flushTimer) {
|
|
853
|
+
if (!flushTimer && buffer.length < bufferSize) {
|
|
788
854
|
flushTimer = setTimeout(() => flush().catch(() => {}), flushAfterMs);
|
|
789
855
|
flushTimer.unref?.();
|
|
790
856
|
}
|
|
857
|
+
if (sending) await sending;
|
|
858
|
+
if (buffer.length >= bufferSize) await flush();
|
|
791
859
|
};
|
|
792
860
|
const finish = async (request) => {
|
|
793
861
|
const result = await finishRun(host, {
|
|
@@ -851,7 +919,12 @@ async function runKnowledgeImport(options) {
|
|
|
851
919
|
get: async (key) => state[key],
|
|
852
920
|
set: async (key, value) => {
|
|
853
921
|
if (stop) throw stop;
|
|
854
|
-
|
|
922
|
+
const staged = { [key]: value };
|
|
923
|
+
if (maxFlushBytes !== Infinity) {
|
|
924
|
+
const { bytes } = measure(staged, (stateBytes) => shortestEnvelopeBytes() + 9 + stateBytes);
|
|
925
|
+
if (requestBytes(0, 0, bytes) > maxFlushBytes) flush().catch(() => {});
|
|
926
|
+
}
|
|
927
|
+
await flush(staged);
|
|
855
928
|
}
|
|
856
929
|
},
|
|
857
930
|
items: {
|
|
@@ -957,6 +1030,9 @@ async function finishRun(host, request, lastSeq, unsettledSeq, withRetries) {
|
|
|
957
1030
|
lastSeq
|
|
958
1031
|
};
|
|
959
1032
|
}
|
|
1033
|
+
function encodedBytes(value) {
|
|
1034
|
+
return new TextEncoder().encode(JSON.stringify(value)).byteLength;
|
|
1035
|
+
}
|
|
960
1036
|
// src/knowledge/importers/sink.ts
|
|
961
1037
|
/**
|
|
962
1038
|
* Applies one flush's ops to pages and the node map, on a transaction view. Pages are found by id
|
package/dist/knowledge/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as MastraBase } from "../base-CKLWBhDo.js";
|
|
2
|
-
import { $t as knowledgeDeliveredPins, Ai as MAX_KNOWLEDGE_PAGE_BODY_LINKS, Bi as knowledgeLinkRefKey, Ci as parseKnowledgeWikilinks, Cn as knowledgeRunScopes, Di as KnowledgePageKeyConflictError, Dn as encodeKnowledgeScopeId, Ei as KnowledgePageHasChildrenError, En as decodeKnowledgeScopeId, Fi as MAX_KNOWLEDGE_PAGE_LIST_LIMIT, Gi as parseKnowledgePageRef, Hi as knowledgePinDepth, Ii as MAX_KNOWLEDGE_PIN_LIST_DEPTH, Ki as KnowledgeInvalidCursorError, Li as assertKnowledgeNoteTextWithinBound, Mi as MAX_KNOWLEDGE_PAGE_DESCRIPTION_TOKENS, Ni as MAX_KNOWLEDGE_PAGE_LINKS, Oi as MAX_KNOWLEDGE_MOVE_PAGES, On as buildKnowledgeInstructions, Pi as MAX_KNOWLEDGE_PAGE_LINK_REF_LENGTH, Qt as PINNED_READ_MEMO_KEY, Ri as assertKnowledgePageDescriptionWithinBound, Si as inspectKnowledgeSchema, Sn as knowledgeMemoryScopes, Ti as KnowledgePageDepthError, Tn as strongerKnowledgeRole, Ui as knowledgePositionBetween, Uo as augmentWithInit, Vi as knowledgePagePath, Wi as knowledgeScopeReadable, Wo as getStorageSource, _i as KnowledgeStorage, _n as knowledgeAccessGrants, _r as knowledgeScopeKey, an as removeKnowledgeNote, bi as assertKnowledgeSchemaCompatible, bn as KnowledgeDeclarationError, br as knowledgeVisibleScopeKeys, ci as InMemoryKnowledgeStorage, cn as upsertKnowledgePage, cr as MAX_KNOWLEDGE_SCOPE_TAGS, di as KnowledgeImportersStorage, dn as KnowledgeLinkRefreshIncompleteError, dr as assertKnowledgeRecordTextWithinBound, en as buildKnowledgePageTools, fi as KNOWLEDGE_STORAGE_CONTRACT_VERSION, fn as knowledgeSubtree, fr as assertKnowledgeScopeWithinCeiling, gi as KnowledgeSchemaResetRequiredError, gn as updateKnowledgeLinks, gr as isKnowledgeScopeVisible, hi as KnowledgeNotFoundError, hn as syncKnowledgePageBodyLinks, hr as expandKnowledgeScope, in as moveKnowledgePage, ji as MAX_KNOWLEDGE_PAGE_DEPTH, ki as MAX_KNOWLEDGE_NOTE_TOKENS, li as KnowledgeImporterBindingConflictError, ln as KnowledgeSemanticIndex, lr as assertKnowledgeCeilingRaised, mi as KnowledgeConflictError, mn as reindexKnowledgeLinks, mr as createKnowledgeNodeCursor, nn as knowledgeRunPrincipals, on as removeKnowledgePage, or as MAX_KNOWLEDGE_NODE_DESCRIPTION_LENGTH, pi as KNOWLEDGE_STORAGE_SCHEMA_VERSION, pn as refreshKnowledgeLinksTo, pr as canonicalizeKnowledgeScope, rn as addKnowledgeNote, sn as updateKnowledgeNote, sr as MAX_KNOWLEDGE_RECORD_TEXT_LENGTH, tn as KnowledgeRun, ui as KnowledgeImporterRunStateError, ur as assertKnowledgeDescriptionWithinBound, vi as KnowledgeTransactionDeadlineError, vn as knowledgeReadScopeFor, vr as knowledgeSemanticDocumentId, wi as KnowledgeMoveTooLargeError, wn as knowledgeScopeAddress, xi as createKnowledgeUlid, xn as compileKnowledgeScopes, xr as parseKnowledgeNodeCursor, yi as KnowledgeUnsupportedCapabilityError, yn as knowledgeRoleOn, yr as knowledgeSemanticIdempotencyKey, zi as canonicalKnowledgeName } from "../run-registry-
|
|
2
|
+
import { $t as knowledgeDeliveredPins, Ai as MAX_KNOWLEDGE_PAGE_BODY_LINKS, Bi as knowledgeLinkRefKey, Ci as parseKnowledgeWikilinks, Cn as knowledgeRunScopes, Di as KnowledgePageKeyConflictError, Dn as encodeKnowledgeScopeId, Ei as KnowledgePageHasChildrenError, En as decodeKnowledgeScopeId, Fi as MAX_KNOWLEDGE_PAGE_LIST_LIMIT, Gi as parseKnowledgePageRef, Hi as knowledgePinDepth, Ii as MAX_KNOWLEDGE_PIN_LIST_DEPTH, Ki as KnowledgeInvalidCursorError, Li as assertKnowledgeNoteTextWithinBound, Mi as MAX_KNOWLEDGE_PAGE_DESCRIPTION_TOKENS, Ni as MAX_KNOWLEDGE_PAGE_LINKS, Oi as MAX_KNOWLEDGE_MOVE_PAGES, On as buildKnowledgeInstructions, Pi as MAX_KNOWLEDGE_PAGE_LINK_REF_LENGTH, Qt as PINNED_READ_MEMO_KEY, Ri as assertKnowledgePageDescriptionWithinBound, Si as inspectKnowledgeSchema, Sn as knowledgeMemoryScopes, Ti as KnowledgePageDepthError, Tn as strongerKnowledgeRole, Ui as knowledgePositionBetween, Uo as augmentWithInit, Vi as knowledgePagePath, Wi as knowledgeScopeReadable, Wo as getStorageSource, _i as KnowledgeStorage, _n as knowledgeAccessGrants, _r as knowledgeScopeKey, an as removeKnowledgeNote, bi as assertKnowledgeSchemaCompatible, bn as KnowledgeDeclarationError, br as knowledgeVisibleScopeKeys, ci as InMemoryKnowledgeStorage, cn as upsertKnowledgePage, cr as MAX_KNOWLEDGE_SCOPE_TAGS, di as KnowledgeImportersStorage, dn as KnowledgeLinkRefreshIncompleteError, dr as assertKnowledgeRecordTextWithinBound, en as buildKnowledgePageTools, fi as KNOWLEDGE_STORAGE_CONTRACT_VERSION, fn as knowledgeSubtree, fr as assertKnowledgeScopeWithinCeiling, gi as KnowledgeSchemaResetRequiredError, gn as updateKnowledgeLinks, gr as isKnowledgeScopeVisible, hi as KnowledgeNotFoundError, hn as syncKnowledgePageBodyLinks, hr as expandKnowledgeScope, in as moveKnowledgePage, ji as MAX_KNOWLEDGE_PAGE_DEPTH, ki as MAX_KNOWLEDGE_NOTE_TOKENS, li as KnowledgeImporterBindingConflictError, ln as KnowledgeSemanticIndex, lr as assertKnowledgeCeilingRaised, mi as KnowledgeConflictError, mn as reindexKnowledgeLinks, mr as createKnowledgeNodeCursor, nn as knowledgeRunPrincipals, on as removeKnowledgePage, or as MAX_KNOWLEDGE_NODE_DESCRIPTION_LENGTH, pi as KNOWLEDGE_STORAGE_SCHEMA_VERSION, pn as refreshKnowledgeLinksTo, pr as canonicalizeKnowledgeScope, rn as addKnowledgeNote, sn as updateKnowledgeNote, sr as MAX_KNOWLEDGE_RECORD_TEXT_LENGTH, tn as KnowledgeRun, ui as KnowledgeImporterRunStateError, ur as assertKnowledgeDescriptionWithinBound, vi as KnowledgeTransactionDeadlineError, vn as knowledgeReadScopeFor, vr as knowledgeSemanticDocumentId, wi as KnowledgeMoveTooLargeError, wn as knowledgeScopeAddress, xi as createKnowledgeUlid, xn as compileKnowledgeScopes, xr as parseKnowledgeNodeCursor, yi as KnowledgeUnsupportedCapabilityError, yn as knowledgeRoleOn, yr as knowledgeSemanticIdempotencyKey, zi as canonicalKnowledgeName } from "../run-registry-DhOKJtlb.js";
|
|
3
3
|
import { standardSchemaToJSONSchema, toStandardSchema } from "../schema/index.js";
|
|
4
4
|
import { i as createStandardSchemaIssuesError } from "../tool-Z3bykc1m.js";
|
|
5
5
|
import { randomUUID } from "crypto";
|
|
@@ -173,6 +173,7 @@ const KNOWLEDGE_IMPORTER_ERROR_CODES = [
|
|
|
173
173
|
"credential_missing",
|
|
174
174
|
"importer_missing_from_deploy",
|
|
175
175
|
"importer_error",
|
|
176
|
+
"flush_too_large",
|
|
176
177
|
"stopped",
|
|
177
178
|
"lease_expired",
|
|
178
179
|
"deadline_exceeded"
|
|
@@ -670,17 +671,22 @@ function sourceError(error) {
|
|
|
670
671
|
* @experimental
|
|
671
672
|
*/
|
|
672
673
|
async function runKnowledgeImport(options) {
|
|
673
|
-
const { host, budgetMs = 15e5, graceMs = 18e4, maxPasses = 200, bufferSize = 200, flushAfterMs = 3e4, heartbeatMs = 3e4, maxRetries = 8, hostCallTimeoutMs = 6e4, retryDelayMs = (attempt) => Math.min(250 * 2 ** attempt, 1e4) } = options;
|
|
674
|
+
const { host, budgetMs = 15e5, graceMs = 18e4, maxPasses = 200, bufferSize = 200, maxFlushBytes: ownMaxFlushBytes = Infinity, flushAfterMs = 3e4, heartbeatMs = 3e4, maxRetries = 8, hostCallTimeoutMs = 6e4, retryDelayMs = (attempt) => Math.min(250 * 2 ** attempt, 1e4) } = options;
|
|
674
675
|
if (!Number.isFinite(flushAfterMs) || flushAfterMs <= 0 || flushAfterMs > 2 ** 31 - 1) throw new TypeError(`flushAfterMs must be a positive number of milliseconds up to 2147483647, got ${flushAfterMs}`);
|
|
676
|
+
if (ownMaxFlushBytes !== Infinity && !(Number.isInteger(ownMaxFlushBytes) && ownMaxFlushBytes > 0)) throw new TypeError(`maxFlushBytes must be a positive whole number of bytes, got ${ownMaxFlushBytes}`);
|
|
675
677
|
const started = await within(host.startRun(options.bindingId, options.start), hostCallTimeoutMs, () => new KnowledgeImporterHostError("host call timed out"));
|
|
676
678
|
if (started.status === "skipped") return started;
|
|
677
679
|
const { runId, generation } = started;
|
|
680
|
+
const hostMaxFlushBytes = started.maxFlushBytes;
|
|
681
|
+
const maxFlushBytes = typeof hostMaxFlushBytes === "number" && Number.isInteger(hostMaxFlushBytes) && hostMaxFlushBytes > 0 ? Math.min(ownMaxFlushBytes, hostMaxFlushBytes) : ownMaxFlushBytes;
|
|
678
682
|
const startedAt = Date.now();
|
|
679
683
|
let lastSeq = started.lastSeq;
|
|
680
684
|
/** A flush sent but never acknowledged: it may have committed. */
|
|
681
685
|
let unsettledSeq;
|
|
682
686
|
let state = { ...started.state };
|
|
683
687
|
let buffer = [];
|
|
688
|
+
/** Encoded bytes of the ops in `buffer`, without the commas between them. */
|
|
689
|
+
let bufferBytes = 0;
|
|
684
690
|
let stop;
|
|
685
691
|
/** Armed while the buffer holds ops; sends them once the oldest has waited `flushAfterMs`. */
|
|
686
692
|
let flushTimer;
|
|
@@ -731,6 +737,7 @@ async function runKnowledgeImport(options) {
|
|
|
731
737
|
disarm();
|
|
732
738
|
const ops = buffer;
|
|
733
739
|
buffer = [];
|
|
740
|
+
bufferBytes = 0;
|
|
734
741
|
const next = flushing.then(async () => {
|
|
735
742
|
if (stop) throw stop;
|
|
736
743
|
if (ops.length === 0 && !staged && !settle) return;
|
|
@@ -755,6 +762,11 @@ async function runKnowledgeImport(options) {
|
|
|
755
762
|
digest,
|
|
756
763
|
...body
|
|
757
764
|
};
|
|
765
|
+
if (maxFlushBytes !== Infinity && encodedBytes(request) > maxFlushBytes) {
|
|
766
|
+
flushFailure = { code: "flush_too_large" };
|
|
767
|
+
halt("flush");
|
|
768
|
+
throw stop;
|
|
769
|
+
}
|
|
758
770
|
unsettledSeq = seq;
|
|
759
771
|
try {
|
|
760
772
|
const receipt = await withRetries(() => host.flush(request), "mutation");
|
|
@@ -779,14 +791,70 @@ async function runKnowledgeImport(options) {
|
|
|
779
791
|
flushing = next.catch(() => {});
|
|
780
792
|
return next;
|
|
781
793
|
}
|
|
782
|
-
|
|
794
|
+
/** The request around the ops, at the longest `seq` it can have; `ops` empty, no `state`. */
|
|
795
|
+
const envelopeBytes = encodedBytes({
|
|
796
|
+
runId,
|
|
797
|
+
generation,
|
|
798
|
+
seq: Number.MAX_SAFE_INTEGER,
|
|
799
|
+
digest: "0".repeat(64),
|
|
800
|
+
ops: []
|
|
801
|
+
});
|
|
802
|
+
/**
|
|
803
|
+
* The envelope at the shortest `seq` the next request can have. A request's `seq` is only known
|
|
804
|
+
* when it is sent, so splitting plans for the longest; refusing what can never fit uses the
|
|
805
|
+
* shortest, and the request as sent is measured again before it goes.
|
|
806
|
+
*/
|
|
807
|
+
const shortestEnvelopeBytes = () => envelopeBytes - String(Number.MAX_SAFE_INTEGER).length + String(lastSeq + 1).length;
|
|
808
|
+
/** Bytes of a request holding the buffer plus `extra` more ops' bytes over `more` ops, and a state. */
|
|
809
|
+
const requestBytes = (extra, more, stateBytes) => {
|
|
810
|
+
const count = buffer.length + more;
|
|
811
|
+
const commas = Math.max(count - 1, 0);
|
|
812
|
+
const state = stateBytes === void 0 ? 0 : 9 + stateBytes;
|
|
813
|
+
return envelopeBytes + bufferBytes + extra + commas + state;
|
|
814
|
+
};
|
|
815
|
+
/**
|
|
816
|
+
* Measures what the importer hands over and returns a copy decoded from that encoding, so a value
|
|
817
|
+
* the importer changes after handing it over can't outgrow its measured size. Anything
|
|
818
|
+
* unencodable or too big ends the run here.
|
|
819
|
+
*/
|
|
820
|
+
const measure = (value, alone) => {
|
|
821
|
+
let json;
|
|
822
|
+
let bytes;
|
|
823
|
+
try {
|
|
824
|
+
json = JSON.stringify(value);
|
|
825
|
+
bytes = new TextEncoder().encode(json).byteLength;
|
|
826
|
+
} catch (error) {
|
|
827
|
+
flushFailure = { code: "importer_error" };
|
|
828
|
+
halt("flush");
|
|
829
|
+
throw error;
|
|
830
|
+
}
|
|
831
|
+
if (alone(bytes) > maxFlushBytes) {
|
|
832
|
+
flushFailure = { code: "flush_too_large" };
|
|
833
|
+
halt("flush");
|
|
834
|
+
throw stop;
|
|
835
|
+
}
|
|
836
|
+
return {
|
|
837
|
+
bytes,
|
|
838
|
+
copy: JSON.parse(json)
|
|
839
|
+
};
|
|
840
|
+
};
|
|
841
|
+
const push = async (handed) => {
|
|
783
842
|
if (stop) throw stop;
|
|
843
|
+
let op = handed;
|
|
844
|
+
let sending;
|
|
845
|
+
if (maxFlushBytes !== Infinity) {
|
|
846
|
+
const { bytes, copy } = measure(handed, (opBytes) => shortestEnvelopeBytes() + opBytes);
|
|
847
|
+
op = copy;
|
|
848
|
+
if (buffer.length > 0 && requestBytes(bytes, 1) > maxFlushBytes) sending = flush();
|
|
849
|
+
bufferBytes += bytes;
|
|
850
|
+
}
|
|
784
851
|
buffer.push(op);
|
|
785
|
-
if (buffer.length
|
|
786
|
-
else if (!flushTimer) {
|
|
852
|
+
if (!flushTimer && buffer.length < bufferSize) {
|
|
787
853
|
flushTimer = setTimeout(() => flush().catch(() => {}), flushAfterMs);
|
|
788
854
|
flushTimer.unref?.();
|
|
789
855
|
}
|
|
856
|
+
if (sending) await sending;
|
|
857
|
+
if (buffer.length >= bufferSize) await flush();
|
|
790
858
|
};
|
|
791
859
|
const finish = async (request) => {
|
|
792
860
|
const result = await finishRun(host, {
|
|
@@ -850,7 +918,12 @@ async function runKnowledgeImport(options) {
|
|
|
850
918
|
get: async (key) => state[key],
|
|
851
919
|
set: async (key, value) => {
|
|
852
920
|
if (stop) throw stop;
|
|
853
|
-
|
|
921
|
+
const staged = { [key]: value };
|
|
922
|
+
if (maxFlushBytes !== Infinity) {
|
|
923
|
+
const { bytes } = measure(staged, (stateBytes) => shortestEnvelopeBytes() + 9 + stateBytes);
|
|
924
|
+
if (requestBytes(0, 0, bytes) > maxFlushBytes) flush().catch(() => {});
|
|
925
|
+
}
|
|
926
|
+
await flush(staged);
|
|
854
927
|
}
|
|
855
928
|
},
|
|
856
929
|
items: {
|
|
@@ -956,6 +1029,9 @@ async function finishRun(host, request, lastSeq, unsettledSeq, withRetries) {
|
|
|
956
1029
|
lastSeq
|
|
957
1030
|
};
|
|
958
1031
|
}
|
|
1032
|
+
function encodedBytes(value) {
|
|
1033
|
+
return new TextEncoder().encode(JSON.stringify(value)).byteLength;
|
|
1034
|
+
}
|
|
959
1035
|
// src/knowledge/importers/sink.ts
|
|
960
1036
|
/**
|
|
961
1037
|
* Applies one flush's ops to pages and the node map, on a transaction view. Pages are found by id
|
package/dist/llm/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_llm = require("../llm-
|
|
3
|
-
const require_netlify = require("../netlify-
|
|
4
|
-
const require_provider_registry = require("../provider-registry-
|
|
2
|
+
const require_llm = require("../llm-B4AeSFvV.cjs");
|
|
3
|
+
const require_netlify = require("../netlify-Bw7Vd58y.cjs");
|
|
4
|
+
const require_provider_registry = require("../provider-registry-Bn_7VvZ8.cjs");
|
|
5
5
|
exports.AzureOpenAIGateway = require_llm.AzureOpenAIGateway;
|
|
6
6
|
exports.EMBEDDING_MODELS = require_llm.EMBEDDING_MODELS;
|
|
7
7
|
exports.GATEWAY_AUTH_HEADER = require_netlify.GATEWAY_AUTH_HEADER;
|
package/dist/llm/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as ModelRouterLanguageModel, c as AzureOpenAIGateway, i as resolveModelConfig, l as defaultGateways, n as ModelRouterEmbeddingModel, r as resolveModelAuth, t as EMBEDDING_MODELS } from "../llm-
|
|
2
|
-
import { c as GATEWAY_AUTH_HEADER, f as findGatewayForModel, p as getGatewayId, r as ModelsDevGateway, t as NetlifyGateway, v as MastraModelGateway } from "../netlify-
|
|
3
|
-
import { c as modelSupportsStructuredOutput, f as MastraGateway, i as getProviderConfig, l as modelSupportsTemperature, n as PROVIDER_REGISTRY, r as getModelReasoningOptions, s as modelSupportsAttachments, t as GatewayRegistry, u as parseModelString } from "../provider-registry-
|
|
1
|
+
import { a as ModelRouterLanguageModel, c as AzureOpenAIGateway, i as resolveModelConfig, l as defaultGateways, n as ModelRouterEmbeddingModel, r as resolveModelAuth, t as EMBEDDING_MODELS } from "../llm-B46V7Mi7.js";
|
|
2
|
+
import { c as GATEWAY_AUTH_HEADER, f as findGatewayForModel, p as getGatewayId, r as ModelsDevGateway, t as NetlifyGateway, v as MastraModelGateway } from "../netlify-C9aJA6Cv.js";
|
|
3
|
+
import { c as modelSupportsStructuredOutput, f as MastraGateway, i as getProviderConfig, l as modelSupportsTemperature, n as PROVIDER_REGISTRY, r as getModelReasoningOptions, s as modelSupportsAttachments, t as GatewayRegistry, u as parseModelString } from "../provider-registry-DOfYSEju.js";
|
|
4
4
|
export { AzureOpenAIGateway, EMBEDDING_MODELS, GATEWAY_AUTH_HEADER, GatewayRegistry, MastraGateway, MastraModelGateway, ModelRouterEmbeddingModel, ModelRouterLanguageModel, ModelsDevGateway, NetlifyGateway, PROVIDER_REGISTRY, defaultGateways, findGatewayForModel, getGatewayId, getModelReasoningOptions, getProviderConfig, modelSupportsAttachments, modelSupportsStructuredOutput, modelSupportsTemperature, parseModelString, resolveModelAuth, resolveModelConfig };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { _ as MASTRA_GATEWAY_STREAM_TRANSPORT, a as interpolateUrlTemplate, b as createOpenAICompatible, f as findGatewayForModel, h as shouldEnableGateway, l as MASTRA_USER_AGENT, m as hasAuthCredentials, o as parseModelRouterId, p as getGatewayId, r as ModelsDevGateway, s as createGoogleGenerativeAI, t as NetlifyGateway, v as MastraModelGateway, x as EventSourceParserStream, y as createOpenAI } from "./netlify-
|
|
1
|
+
import { _ as MASTRA_GATEWAY_STREAM_TRANSPORT, a as interpolateUrlTemplate, b as createOpenAICompatible, f as findGatewayForModel, h as shouldEnableGateway, l as MASTRA_USER_AGENT, m as hasAuthCredentials, o as parseModelRouterId, p as getGatewayId, r as ModelsDevGateway, s as createGoogleGenerativeAI, t as NetlifyGateway, v as MastraModelGateway, x as EventSourceParserStream, y as createOpenAI } from "./netlify-C9aJA6Cv.js";
|
|
2
2
|
import { n as prepareAzureStrictToolSchemas, r as createStreamFromGenerateResult, t as AISDKV5LanguageModel } from "./model-DS-b2R-R.js";
|
|
3
3
|
import { i as aiV5PromptToAIV7Prompt, r as aiV5PromptToAIV6Prompt } from "./to-prompt-BsDtVXrf.js";
|
|
4
4
|
import { t as convertToDataContent } from "./content-CFBIylxS.js";
|
|
5
|
-
import { f as MastraGateway, l as modelSupportsTemperature, n as PROVIDER_REGISTRY, p as gatewayServesObservationalMemory, t as GatewayRegistry } from "./provider-registry-
|
|
5
|
+
import { f as MastraGateway, l as modelSupportsTemperature, n as PROVIDER_REGISTRY, p as gatewayServesObservationalMemory, t as GatewayRegistry } from "./provider-registry-DOfYSEju.js";
|
|
6
6
|
import { i as MastraError, n as ErrorDomain, t as ErrorCategory } from "./error-oh2DLsP2.js";
|
|
7
7
|
import { u as RequestContext } from "./request-context-COnZHt2-.js";
|
|
8
8
|
import { n as resolveDynamicArgument } from "./dynamic-argument-BzPK3qPN.js";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
const require_rolldown_runtime = require("./rolldown-runtime-BrhgMLW6.cjs");
|
|
2
|
-
const require_netlify = require("./netlify-
|
|
2
|
+
const require_netlify = require("./netlify-Bw7Vd58y.cjs");
|
|
3
3
|
const require_model = require("./model-jBymoqGa.cjs");
|
|
4
4
|
const require_to_prompt = require("./to-prompt-B9eZo2U5.cjs");
|
|
5
5
|
const require_content = require("./content-CC0W1d5p.cjs");
|
|
6
|
-
const require_provider_registry = require("./provider-registry-
|
|
6
|
+
const require_provider_registry = require("./provider-registry-Bn_7VvZ8.cjs");
|
|
7
7
|
const require_error = require("./error-D90lJ6M7.cjs");
|
|
8
8
|
const require_request_context = require("./request-context-D9RXYCy8.cjs");
|
|
9
9
|
const require_dynamic_argument = require("./dynamic-argument-CUc1BBOS.cjs");
|
package/dist/loop/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_run_registry = require("../run-registry-
|
|
3
|
-
const require_stream = require("../stream-
|
|
2
|
+
const require_run_registry = require("../run-registry-lLRc7EE6.cjs");
|
|
3
|
+
const require_stream = require("../stream-BIDts1fZ.cjs");
|
|
4
4
|
exports.MastraTimeoutError = require_stream.MastraTimeoutError;
|
|
5
5
|
exports.createScorer = require_run_registry.createScorer;
|
|
6
6
|
exports.createTimeoutAbortSignal = require_stream.createTimeoutAbortSignal;
|
package/dist/loop/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { Bt as formatCompletionFeedback, Gt as runChecks, Ht as formatValidationFeedback, Jt as runStreamCompletionScorers, Kt as runCompletionScorers, T as createScorer, Ut as generateFinalResult, Vt as formatStreamCompletionFeedback, Wt as generateStructuredFinalResult, Xt as loop, Yt as runValidation, qt as runDefaultCompletionCheck, zt as formatCheckFeedback } from "../run-registry-
|
|
2
|
-
import { Cn as isMastraTimeoutError, vn as MastraTimeoutError, yn as createTimeoutAbortSignal } from "../stream-
|
|
1
|
+
import { Bt as formatCompletionFeedback, Gt as runChecks, Ht as formatValidationFeedback, Jt as runStreamCompletionScorers, Kt as runCompletionScorers, T as createScorer, Ut as generateFinalResult, Vt as formatStreamCompletionFeedback, Wt as generateStructuredFinalResult, Xt as loop, Yt as runValidation, qt as runDefaultCompletionCheck, zt as formatCheckFeedback } from "../run-registry-DhOKJtlb.js";
|
|
2
|
+
import { Cn as isMastraTimeoutError, vn as MastraTimeoutError, yn as createTimeoutAbortSignal } from "../stream-C8HKG3qC.js";
|
|
3
3
|
export { MastraTimeoutError, createScorer, createTimeoutAbortSignal, formatCheckFeedback, formatCompletionFeedback, formatStreamCompletionFeedback, formatValidationFeedback, generateFinalResult, generateStructuredFinalResult, isMastraTimeoutError, loop, runChecks, runCompletionScorers, runDefaultCompletionCheck, runStreamCompletionScorers, runValidation };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { n as __exportAll } from "./rolldown-runtime-tIEjjQTE.js";
|
|
2
|
-
import { Hs as createStep, Us as createWorkflow, ta as assertSupportedPatterns, w as ScorerRunError, x as validateAndSaveScore, y as flushBeforeTraceRead } from "./run-registry-
|
|
2
|
+
import { Hs as createStep, Us as createWorkflow, ta as assertSupportedPatterns, w as ScorerRunError, x as validateAndSaveScore, y as flushBeforeTraceRead } from "./run-registry-DhOKJtlb.js";
|
|
3
3
|
import { S as resolveObservabilityContext } from "./observability-D7RNOAPx.js";
|
|
4
4
|
import { i as MastraError } from "./error-oh2DLsP2.js";
|
|
5
|
-
import { dt as loadStepResults, ln as isSupportedLanguageModel } from "./stream-
|
|
5
|
+
import { dt as loadStepResults, ln as isSupportedLanguageModel } from "./stream-C8HKG3qC.js";
|
|
6
6
|
import { o as MASTRA_RESOURCE_ID_KEY, p as withoutLiveRequestKeys, u as RequestContext } from "./request-context-COnZHt2-.js";
|
|
7
7
|
import { t as EntityType } from "./storage-Cc50aQAp.js";
|
|
8
8
|
import { a as getOrCreateSpan } from "./utils-DU_pU5SK.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
const require_rolldown_runtime = require("./rolldown-runtime-BrhgMLW6.cjs");
|
|
2
|
-
const require_run_registry = require("./run-registry-
|
|
2
|
+
const require_run_registry = require("./run-registry-lLRc7EE6.cjs");
|
|
3
3
|
const require_observability = require("./observability-B0R_D1PZ.cjs");
|
|
4
4
|
const require_error = require("./error-D90lJ6M7.cjs");
|
|
5
|
-
const require_stream = require("./stream-
|
|
5
|
+
const require_stream = require("./stream-BIDts1fZ.cjs");
|
|
6
6
|
const require_request_context = require("./request-context-D9RXYCy8.cjs");
|
|
7
7
|
const require_storage = require("./storage-CfG0I2aF.cjs");
|
|
8
8
|
const require_utils = require("./utils-D-eNsgDM.cjs");
|
package/dist/mastra/index.cjs
CHANGED
package/dist/mastra/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as Mastra } from "../mastra-
|
|
1
|
+
export { t as Mastra } from "../mastra-CIx6qEq2.js";
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { Ar as WorkflowsInMemory, Bc as normalizeConcurrency, Cl as assertDrainTimeout, Dc as nestedRunParentOf, Ec as createNestedRunParentStatusLookup, El as hasDurableExecution, Fc as renewWorkflowLease, Hs as createStep, Ic as repeatAfterSettled, Ks as computeScheduleDefinitionHash, Lc as runFenceConflictOf, Oc as nestedRunRecoveryAction, Ol as isDurableAgentLike, Or as InMemoryStore, Pc as WORKFLOW_RUN_LEASE_TTL_MS, Tc as cancelNestedRun, Uo as augmentWithInit, Us as createWorkflow, Vc as runWithConcurrency, Wo as getStorageSource, Ws as WorkflowEventProcessor, b as createOnScorerHook, da as BackgroundTasksInMemory, i as abandonDurableAgentExecutions, jt as __registerMastraCtor, kc as nestedRunStatusOf, kn as AgentChannels, m as agentThreadStreamRuntime, qr as dispatchDueNotifications, s as getActiveDurableAgentWorkflowExecutions, su as runOutsideRunFenceScope, u as isDurableAgentExecutionDetached, wl as waitMs, zc as createConcurrencyLimiter } from "./run-registry-
|
|
2
|
-
import { s as BackgroundTaskManager } from "./background-tasks-
|
|
1
|
+
import { Ar as WorkflowsInMemory, Bc as normalizeConcurrency, Cl as assertDrainTimeout, Dc as nestedRunParentOf, Ec as createNestedRunParentStatusLookup, El as hasDurableExecution, Fc as renewWorkflowLease, Hs as createStep, Ic as repeatAfterSettled, Ks as computeScheduleDefinitionHash, Lc as runFenceConflictOf, Oc as nestedRunRecoveryAction, Ol as isDurableAgentLike, Or as InMemoryStore, Pc as WORKFLOW_RUN_LEASE_TTL_MS, Tc as cancelNestedRun, Uo as augmentWithInit, Us as createWorkflow, Vc as runWithConcurrency, Wo as getStorageSource, Ws as WorkflowEventProcessor, b as createOnScorerHook, da as BackgroundTasksInMemory, i as abandonDurableAgentExecutions, jt as __registerMastraCtor, kc as nestedRunStatusOf, kn as AgentChannels, m as agentThreadStreamRuntime, qr as dispatchDueNotifications, s as getActiveDurableAgentWorkflowExecutions, su as runOutsideRunFenceScope, u as isDurableAgentExecutionDetached, wl as waitMs, zc as createConcurrencyLimiter } from "./run-registry-DhOKJtlb.js";
|
|
2
|
+
import { s as BackgroundTaskManager } from "./background-tasks-E-Jjxks4.js";
|
|
3
3
|
import { t as InMemoryServerCache } from "./inmemory-BK3zLwvM.js";
|
|
4
|
-
import { t as DatasetsManager } from "./manager-
|
|
4
|
+
import { t as DatasetsManager } from "./manager-BRAvwB9b.js";
|
|
5
5
|
import { i as MastraError, n as ErrorDomain, t as ErrorCategory } from "./error-oh2DLsP2.js";
|
|
6
6
|
import { u as isRunLocalTopic, v as EventEmitterPubSub } from "./output-helpers-CVzhy1Y0.js";
|
|
7
7
|
import { a as registerHook, r as deregisterHook } from "./hooks-Bth8Cjpj.js";
|
|
8
8
|
import { LicenseClient } from "./license/index.js";
|
|
9
|
-
import { p as getGatewayId } from "./netlify-
|
|
10
|
-
import { l as defaultGateways } from "./llm-
|
|
9
|
+
import { p as getGatewayId } from "./netlify-C9aJA6Cv.js";
|
|
10
|
+
import { l as defaultGateways } from "./llm-B46V7Mi7.js";
|
|
11
11
|
import { l as isAdaptableLogger, n as LogLevel, t as ConsoleLogger, u as noopLogger } from "./logger-BwbmRqfc.js";
|
|
12
12
|
import { DualLogger, createExportSuppressedLogger, isObservabilityExportSuppressed, resolveTraceFields } from "./logger/index.js";
|
|
13
13
|
import { c as fsAgentScheduleRowId, g as toEpochMs, h as computeNextFireAt, l as parseFsAgentScheduleRowId, m as computeNextFire, t as Schedules } from "./schedules-DZfSx-7P.js";
|
|
@@ -16,14 +16,14 @@ import { initContextStorage } from "./observability/context-storage.js";
|
|
|
16
16
|
import { f as resolveCurrentSpan } from "./utils-DU_pU5SK.js";
|
|
17
17
|
import { r as InMemoryDB } from "./source-fNa6u1kH.js";
|
|
18
18
|
import { r as trackFeatureUsage } from "./feature-telemetry-DdR8J_5o.js";
|
|
19
|
-
import { r as isToolLoopAgentLike, t as toolLoopAgentToMastraAgent } from "./tool-loop-agent-
|
|
19
|
+
import { r as isToolLoopAgentLike, t as toolLoopAgentToMastraAgent } from "./tool-loop-agent-DM5V_0XS.js";
|
|
20
20
|
import { r as normalizeToolPayloadTransformPolicy } from "./payload-transform-Dj3HUeD4.js";
|
|
21
|
-
import { v as readPositiveIntEnv } from "./utils-
|
|
22
|
-
import { i as OrchestrationWorker, n as BackgroundTaskWorker, r as SchedulerWorker } from "./worker-
|
|
23
|
-
import { n as normalizeWorkflowBuilderDefinition } from "./builder-
|
|
24
|
-
import { d as toJsonSchemaOrUndefined, p as collectNestedWorkflowIds, t as assertValidDynamicWorkflow } from "./validate-
|
|
25
|
-
import { t as rehydrateWorkflow } from "./rehydrate-
|
|
26
|
-
import { jn as createRunScope } from "./stream-
|
|
21
|
+
import { v as readPositiveIntEnv } from "./utils-DcnKVK34.js";
|
|
22
|
+
import { i as OrchestrationWorker, n as BackgroundTaskWorker, r as SchedulerWorker } from "./worker-SDi9jbP5.js";
|
|
23
|
+
import { n as normalizeWorkflowBuilderDefinition } from "./builder-Dh175HnQ.js";
|
|
24
|
+
import { d as toJsonSchemaOrUndefined, p as collectNestedWorkflowIds, t as assertValidDynamicWorkflow } from "./validate-Dn750ciE.js";
|
|
25
|
+
import { t as rehydrateWorkflow } from "./rehydrate-Dgqkw7Py.js";
|
|
26
|
+
import { jn as createRunScope } from "./stream-C8HKG3qC.js";
|
|
27
27
|
import { z } from "zod/v4";
|
|
28
28
|
// src/notifications/workflow.ts
|
|
29
29
|
const NOTIFICATION_DISPATCH_WORKFLOW_ID = "__mastra_notification_dispatcher";
|
|
@@ -2868,7 +2868,7 @@ var Mastra = class Mastra {
|
|
|
2868
2868
|
*/
|
|
2869
2869
|
async __ensureExperimentWorkflow() {
|
|
2870
2870
|
if (this.__hasInternalWorkflow("__mastra-experiment")) return;
|
|
2871
|
-
const { buildExperimentWorkflow } = await import("./manager-
|
|
2871
|
+
const { buildExperimentWorkflow } = await import("./manager-BRAvwB9b.js").then((n) => n.b);
|
|
2872
2872
|
if (this.__hasInternalWorkflow("__mastra-experiment")) return;
|
|
2873
2873
|
this.__registerInternalWorkflow(buildExperimentWorkflow(), void 0, { distributed: true });
|
|
2874
2874
|
}
|
|
@@ -5069,7 +5069,7 @@ var Mastra = class Mastra {
|
|
|
5069
5069
|
if (!this.#workerFilter || this.#workerFilter.has("agent-schedule")) {
|
|
5070
5070
|
let agentScheduleWorker = this.#findAgentScheduleWorker();
|
|
5071
5071
|
if (!agentScheduleWorker) {
|
|
5072
|
-
const { AgentScheduleWorker } = await import("./worker-
|
|
5072
|
+
const { AgentScheduleWorker } = await import("./worker-DJPAdazC.js");
|
|
5073
5073
|
agentScheduleWorker = new AgentScheduleWorker();
|
|
5074
5074
|
agentScheduleWorker.__registerMastra(this);
|
|
5075
5075
|
this.#workers.push(agentScheduleWorker);
|
|
@@ -5709,7 +5709,7 @@ var Mastra = class Mastra {
|
|
|
5709
5709
|
this.#workers.push(sw);
|
|
5710
5710
|
}
|
|
5711
5711
|
if (!this.#findAgentScheduleWorker()) {
|
|
5712
|
-
const { AgentScheduleWorker } = await import("./worker-
|
|
5712
|
+
const { AgentScheduleWorker } = await import("./worker-DJPAdazC.js");
|
|
5713
5713
|
const asw = new AgentScheduleWorker();
|
|
5714
5714
|
asw.__registerMastra(this);
|
|
5715
5715
|
this.#workers.push(asw);
|
|
@@ -6154,7 +6154,7 @@ var Mastra = class Mastra {
|
|
|
6154
6154
|
#syncGatewayRegistry() {
|
|
6155
6155
|
try {
|
|
6156
6156
|
if (process.env.MASTRA_DEV !== "true" && process.env.MASTRA_DEV !== "1") return;
|
|
6157
|
-
import("./provider-registry-
|
|
6157
|
+
import("./provider-registry-DOfYSEju.js").then((n) => n.d).then(async ({ GatewayRegistry }) => {
|
|
6158
6158
|
const registry = GatewayRegistry.getInstance();
|
|
6159
6159
|
const customGateways = Object.values(this.#gateways || {});
|
|
6160
6160
|
registry.registerCustomGateways(customGateways);
|