@mastra/core 1.87.0-alpha.6 → 1.87.0-alpha.8
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/agent.d.ts +3 -1
- package/dist/agent/durable/index.cjs +1 -1
- package/dist/agent/durable/index.js +1 -1
- package/dist/agent/index.cjs +3 -2
- package/dist/agent/index.d.ts +2 -0
- package/dist/agent/index.js +3 -3
- package/dist/agent/merge-persona.d.ts +15 -0
- package/dist/agent-builder/ee/index.cjs +1 -1
- package/dist/agent-builder/ee/index.js +1 -1
- package/dist/agent-controller/index.cjs +2 -2
- package/dist/agent-controller/index.js +2 -2
- package/dist/{agent-controller-BkG0M35j.js → agent-controller-C4zDemm6.js} +7 -7
- package/dist/{agent-controller-BL-0CKSF.cjs → agent-controller-CrEpnHiS.cjs} +7 -7
- package/dist/background-tasks/index.cjs +1 -1
- package/dist/background-tasks/index.js +1 -1
- package/dist/{background-tasks-DL-ATSvp.cjs → background-tasks-Co3gtkk9.cjs} +1 -1
- package/dist/{background-tasks-CQ1M8SHw.js → background-tasks-DKY9-67c.js} +1 -1
- package/dist/browser/index.cjs +2 -2
- package/dist/browser/index.js +2 -2
- package/dist/{builder-CVEDotdf.cjs → builder-DSyz2DUR.cjs} +2 -2
- package/dist/{builder-DnbKjNuO.js → builder-ntKskSX0.js} +2 -2
- package/dist/capabilities/302ai.json +208 -208
- package/dist/capabilities/abliteratedllm.json +34 -34
- package/dist/capabilities/abliteration-ai.json +11 -11
- package/dist/capabilities/above.json +24 -24
- package/dist/capabilities/adaption.json +15 -15
- package/dist/capabilities/adzuki.json +29 -29
- package/dist/capabilities/agentrouter.json +9 -9
- package/dist/capabilities/agnes.json +3 -3
- package/dist/capabilities/ai-router.json +8 -8
- package/dist/capabilities/aiand.json +25 -25
- package/dist/capabilities/aigrow.json +13 -13
- package/dist/capabilities/aimlapi.json +150 -150
- package/dist/capabilities/aixy.json +22 -22
- package/dist/capabilities/aki-io.json +14 -14
- package/dist/capabilities/alibaba-cn.json +108 -102
- package/dist/capabilities/alibaba-coding-plan-cn.json +6 -6
- package/dist/capabilities/alibaba-coding-plan.json +6 -6
- package/dist/capabilities/alibaba-token-plan-cn.json +53 -53
- package/dist/capabilities/alibaba-token-plan.json +52 -52
- package/dist/capabilities/alibaba.json +71 -71
- package/dist/capabilities/ambient.json +17 -17
- package/dist/capabilities/amd.json +9 -9
- package/dist/capabilities/anthropic.json +49 -49
- package/dist/capabilities/anyapi.json +16 -16
- package/dist/capabilities/apiko.json +5 -5
- package/dist/capabilities/arcee.json +7 -7
- package/dist/capabilities/augure.json +4 -4
- package/dist/capabilities/auriko.json +20 -20
- package/dist/capabilities/bailing.json +4 -4
- package/dist/capabilities/baseten.json +36 -36
- package/dist/capabilities/bee.json +4 -4
- package/dist/capabilities/berget.json +4 -4
- package/dist/capabilities/bothub.json +16 -16
- package/dist/capabilities/boundless.json +33 -33
- package/dist/capabilities/bumo.json +36 -36
- package/dist/capabilities/byteplus.json +29 -29
- package/dist/capabilities/cheapaimodel.json +10 -10
- package/dist/capabilities/cheapest-token.json +30 -30
- package/dist/capabilities/chutes.json +8 -8
- package/dist/capabilities/cline-pass.json +41 -41
- package/dist/capabilities/cloudcode.json +4 -4
- package/dist/capabilities/cloudflare-workers-ai.json +18 -18
- package/dist/capabilities/commandcode.json +137 -137
- package/dist/capabilities/concentrate.json +270 -270
- package/dist/capabilities/cortecs.json +113 -113
- package/dist/capabilities/crossmodel.json +188 -188
- package/dist/capabilities/crusoe.json +10 -10
- package/dist/capabilities/daoxe.json +7 -7
- package/dist/capabilities/databricks.json +133 -133
- package/dist/capabilities/deepinfra.json +94 -94
- package/dist/capabilities/deepseek.json +4 -4
- package/dist/capabilities/digitalocean.json +114 -114
- package/dist/capabilities/dothoosh.json +30 -30
- package/dist/capabilities/doubleword.json +25 -25
- package/dist/capabilities/edenai.json +278 -278
- package/dist/capabilities/empiriolabs.json +168 -168
- package/dist/capabilities/engy.json +19 -19
- package/dist/capabilities/entrim.json +6 -6
- package/dist/capabilities/evroc.json +14 -14
- package/dist/capabilities/ezkielyna.json +5 -5
- package/dist/capabilities/fastrouter.json +80 -80
- package/dist/capabilities/fireworks-ai.json +83 -83
- package/dist/capabilities/freemodel.json +20 -20
- package/dist/capabilities/friendli.json +6 -6
- package/dist/capabilities/frogbot.json +93 -93
- package/dist/capabilities/gisoo.json +20 -20
- package/dist/capabilities/gmicloud.json +14 -14
- package/dist/capabilities/google.json +52 -52
- package/dist/capabilities/graphn.json +12 -12
- package/dist/capabilities/greenpt.json +35 -35
- package/dist/capabilities/groq.json +8 -8
- package/dist/capabilities/helicone.json +82 -82
- package/dist/capabilities/hostinger-router.json +8 -8
- package/dist/capabilities/hpc-ai.json +12 -12
- package/dist/capabilities/huawei-maas.json +15 -15
- package/dist/capabilities/hubris.json +30 -30
- package/dist/capabilities/huggingface.json +70 -174
- package/dist/capabilities/hyper.json +24 -24
- package/dist/capabilities/impossibl.json +147 -147
- package/dist/capabilities/inception.json +2 -2
- package/dist/capabilities/inceptron.json +8 -8
- package/dist/capabilities/inco.json +4 -4
- package/dist/capabilities/infer.json +14 -14
- package/dist/capabilities/inferall.json +14 -14
- package/dist/capabilities/inference-coop.json +2 -2
- package/dist/capabilities/inferenceapis.json +27 -27
- package/dist/capabilities/inferris.json +4 -4
- package/dist/capabilities/infersia.json +14 -14
- package/dist/capabilities/inferx.json +2 -2
- package/dist/capabilities/infomaniak.json +2 -2
- package/dist/capabilities/isoquant.json +4 -4
- package/dist/capabilities/iteracompute.json +55 -55
- package/dist/capabilities/jad-ai.json +2 -2
- package/dist/capabilities/jalapeno.json +10 -10
- package/dist/capabilities/jiekou.json +70 -70
- package/dist/capabilities/joingonka.json +4 -4
- package/dist/capabilities/jzstoken.json +54 -54
- package/dist/capabilities/keln.json +24 -24
- package/dist/capabilities/kenari.json +124 -124
- package/dist/capabilities/kilo.json +634 -641
- package/dist/capabilities/kimi-code-plan-cn.json +9 -9
- package/dist/capabilities/kimi-code-plan-global.json +9 -9
- package/dist/capabilities/kitani.json +6 -6
- package/dist/capabilities/klavo.json +20 -20
- package/dist/capabilities/korouter.json +30 -30
- package/dist/capabilities/kunavo.json +6 -6
- package/dist/capabilities/liquid.json +9 -9
- package/dist/capabilities/lithosai.json +2 -2
- package/dist/capabilities/llmgateway-providers.json +935 -919
- package/dist/capabilities/llmgateway.json +340 -338
- package/dist/capabilities/llmtr.json +22 -22
- package/dist/capabilities/lowrouter.json +52 -52
- package/dist/capabilities/lyceum.json +10 -10
- package/dist/capabilities/melious.json +15 -15
- package/dist/capabilities/merge-gateway.json +279 -279
- package/dist/capabilities/meta.json +6 -6
- package/dist/capabilities/minimax-cn-coding-plan.json +2 -2
- package/dist/capabilities/minimax-coding-plan.json +2 -2
- package/dist/capabilities/mistral.json +20 -20
- package/dist/capabilities/mixlayer.json +4 -4
- package/dist/capabilities/modal.json +12 -12
- package/dist/capabilities/model-oracle-ai.json +15 -15
- package/dist/capabilities/modelis.json +15 -15
- package/dist/capabilities/modular.json +6 -6
- package/dist/capabilities/moneo.json +13 -13
- package/dist/capabilities/moonshotai-cn.json +5 -5
- package/dist/capabilities/moonshotai.json +5 -5
- package/dist/capabilities/morph.json +14 -14
- package/dist/capabilities/munito-eu.json +6 -6
- package/dist/capabilities/munito.json +10 -10
- package/dist/capabilities/nan.json +28 -28
- package/dist/capabilities/nano-gpt.json +576 -583
- package/dist/capabilities/nearai.json +108 -108
- package/dist/capabilities/nebius.json +34 -34
- package/dist/capabilities/neon.json +135 -135
- package/dist/capabilities/neuralwatt.json +42 -42
- package/dist/capabilities/nokeep.json +4 -4
- package/dist/capabilities/novita-ai.json +169 -169
- package/dist/capabilities/nvidia.json +41 -41
- package/dist/capabilities/obscurify.json +28 -28
- package/dist/capabilities/oci.json +8 -8
- package/dist/capabilities/ofox.json +396 -396
- package/dist/capabilities/ollama-cloud.json +60 -60
- package/dist/capabilities/openai.json +55 -55
- package/dist/capabilities/opencode-go.json +86 -86
- package/dist/capabilities/openreason.json +6 -6
- package/dist/capabilities/openrouter.json +567 -568
- package/dist/capabilities/opper.json +29 -29
- package/dist/capabilities/orcarouter.json +247 -247
- package/dist/capabilities/outerlabs.json +25 -25
- package/dist/capabilities/ovhcloud.json +19 -19
- package/dist/capabilities/pareto.json +5 -5
- package/dist/capabilities/pendra.json +4 -4
- package/dist/capabilities/perplexity-agent.json +65 -65
- package/dist/capabilities/phala.json +32 -32
- package/dist/capabilities/pioneer.json +25 -25
- package/dist/capabilities/poe.json +132 -132
- package/dist/capabilities/poolside.json +3 -3
- package/dist/capabilities/powerspring.json +4 -4
- package/dist/capabilities/primalabs.json +10 -10
- package/dist/capabilities/prime.json +122 -113
- package/dist/capabilities/privatemode-ai.json +8 -8
- package/dist/capabilities/proxystacks.json +3 -3
- package/dist/capabilities/qiniu-ai.json +11 -11
- package/dist/capabilities/refuseless.json +3 -3
- package/dist/capabilities/regolo-ai.json +10 -10
- package/dist/capabilities/requesty.json +369 -165
- package/dist/capabilities/ruapi.json +16 -16
- package/dist/capabilities/runcrate.json +12 -12
- package/dist/capabilities/runinfra.json +17 -17
- package/dist/capabilities/sakana.json +5 -5
- package/dist/capabilities/sambanova.json +5 -5
- package/dist/capabilities/sandbase.json +21 -21
- package/dist/capabilities/sarvam.json +10 -10
- package/dist/capabilities/scaleway.json +15 -15
- package/dist/capabilities/scnet-token-plan.json +13 -13
- package/dist/capabilities/scx-ai.json +27 -27
- package/dist/capabilities/sensenova.json +15 -15
- package/dist/capabilities/siliconflow-cn.json +72 -72
- package/dist/capabilities/siliconflow.json +56 -56
- package/dist/capabilities/snowflake-cortex.json +25 -25
- package/dist/capabilities/sokkan.json +9 -9
- package/dist/capabilities/sparrowcodes.json +21 -21
- package/dist/capabilities/standardcompute.json +101 -101
- package/dist/capabilities/steadyrouter.json +45 -45
- package/dist/capabilities/stepping-stone.json +17 -17
- package/dist/capabilities/synthetic.json +14 -14
- package/dist/capabilities/synthorai.json +25 -25
- package/dist/capabilities/teamorouter.json +24 -24
- package/dist/capabilities/teapot-router.json +5 -5
- package/dist/capabilities/tencent-token-plan-intl.json +22 -22
- package/dist/capabilities/tencent-token-plan.json +44 -44
- package/dist/capabilities/tencent-tokenhub.json +44 -44
- package/dist/capabilities/tensorx.json +42 -42
- package/dist/capabilities/the-grid-ai.json +23 -23
- package/dist/capabilities/thinkingmachines.json +56 -56
- package/dist/capabilities/tinfoil.json +10 -10
- package/dist/capabilities/toapis.json +3 -3
- package/dist/capabilities/togetherai.json +51 -51
- package/dist/capabilities/tokengo.json +25 -25
- package/dist/capabilities/tokenify.json +10 -10
- package/dist/capabilities/trustedrouter.json +5 -5
- package/dist/capabilities/trustedtokens.json +17 -17
- package/dist/capabilities/umans-ai-coding-plan.json +16 -16
- package/dist/capabilities/umans-ai.json +13 -13
- package/dist/capabilities/unrestricted.json +4 -4
- package/dist/capabilities/uplinkswitch.json +15 -15
- package/dist/capabilities/upstage.json +5 -5
- package/dist/capabilities/vancine.json +24 -24
- package/dist/capabilities/vercel.json +560 -560
- package/dist/capabilities/vivgrid.json +80 -80
- package/dist/capabilities/volcengine-coding-plan.json +27 -27
- package/dist/capabilities/volcengine.json +29 -28
- package/dist/capabilities/vultr.json +32 -32
- package/dist/capabilities/wafer.ai.json +19 -19
- package/dist/capabilities/wally.json +12 -12
- package/dist/capabilities/wandb.json +21 -21
- package/dist/capabilities/watt.json +21 -21
- package/dist/capabilities/xai.json +4 -4
- package/dist/capabilities/xiaomi-token-plan-ams.json +2 -2
- package/dist/capabilities/xiaomi-token-plan-cn.json +2 -2
- package/dist/capabilities/xiaomi-token-plan-sgp.json +2 -2
- package/dist/capabilities/xiaomi.json +2 -2
- package/dist/capabilities/xpersona.json +11 -11
- package/dist/capabilities/xxapi.json +28 -28
- package/dist/capabilities/zai-coding-plan.json +18 -18
- package/dist/capabilities/zai.json +27 -27
- package/dist/capabilities/zenifra.json +30 -30
- package/dist/capabilities/zenmux.json +181 -181
- package/dist/capabilities/zerogpu.json +12 -12
- package/dist/capabilities/zhipuai-coding-plan.json +4 -4
- package/dist/capabilities/zhipuai.json +26 -26
- package/dist/capabilities/zro.json +5 -5
- package/dist/channels/index.cjs +2 -2
- package/dist/channels/index.js +2 -2
- package/dist/{channels-DCd_dDOB.cjs → channels-CO1XGZll.cjs} +1 -1
- package/dist/{channels-DwAd1RtQ.js → channels-EtP7uAxI.js} +1 -1
- package/dist/coding-agent/index.cjs +2 -2
- package/dist/coding-agent/index.js +2 -2
- 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 +534 -519
- package/dist/docs/references/docs-agents-code-mode.md +20 -0
- package/dist/docs/references/docs-knowledge-agents-and-tools.md +2 -0
- package/dist/docs/references/reference-tools-create-code-mode.md +22 -0
- 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 +2 -2
- package/dist/harness/index.js +2 -2
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/knowledge/agent-scopes.d.ts +17 -0
- package/dist/knowledge/declarations.d.ts +2 -0
- package/dist/knowledge/held-scopes-state-processor.d.ts +50 -0
- package/dist/knowledge/importers/types.d.ts +2 -0
- package/dist/knowledge/index.cjs +65 -15
- package/dist/knowledge/index.d.ts +6 -0
- package/dist/knowledge/index.js +64 -16
- package/dist/knowledge/page-tools.d.ts +14 -0
- package/dist/knowledge/run.d.ts +1 -0
- package/dist/llm/index.cjs +3 -3
- package/dist/llm/index.js +3 -3
- package/dist/llm/model/provider-types.generated.d.ts +7982 -7987
- package/dist/{llm-DQTGexjo.cjs → llm-BFX_NqOg.cjs} +2 -2
- package/dist/{llm-BdHdjrHp.js → llm-CCrVS2x2.js} +2 -2
- package/dist/loop/index.cjs +2 -2
- package/dist/loop/index.js +2 -2
- package/dist/{manager-BxE49QHe.js → manager-UMKLXQfC.js} +2 -2
- package/dist/{manager-CjT4ivOl.cjs → manager-thZrFty9.cjs} +2 -2
- package/dist/mastra/index.cjs +1 -1
- package/dist/mastra/index.js +1 -1
- package/dist/{mastra-DKjpNZ-1.js → mastra-BIFCuq8a.js} +16 -16
- package/dist/{mastra-CraMHXhw.cjs → mastra-Dum21R9e.cjs} +16 -16
- package/dist/memory/index.cjs +2 -2
- package/dist/memory/index.js +2 -2
- package/dist/{model-BEFQWHnG.cjs → model-BSJM-uPh.cjs} +1 -1
- package/dist/{model-X2gWHlAy.js → model-ylucqLzJ.js} +1 -1
- package/dist/{netlify-BFgeBsaW.cjs → netlify-DlmO_1PJ.cjs} +1 -1
- package/dist/{netlify-kxJSdqCW.js → netlify-Dwaz8kVT.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/processors/runner.d.ts +12 -0
- package/dist/{provider-registry-BXDosXMN.cjs → provider-registry-BPAmstg2.cjs} +22839 -22840
- package/dist/{provider-registry-DgezoItQ.js → provider-registry-BmJ_yV84.js} +22839 -22840
- package/dist/provider-registry.json +23227 -23224
- package/dist/{registry-generator-BMXgTdbx.cjs → registry-generator-BDMF_ksT.cjs} +1 -1
- package/dist/{registry-generator-B50FrVGs.js → registry-generator-BJvpKeLl.js} +1 -1
- package/dist/{rehydrate-CBcjKKGA.cjs → rehydrate-BLx0h6x3.cjs} +2 -2
- package/dist/{rehydrate-Dp8f_1MN.js → rehydrate-BxSMnG8L.js} +2 -2
- package/dist/relevance/index.cjs +2 -2
- package/dist/relevance/index.js +2 -2
- package/dist/{run-registry-BRO8xz9z.cjs → run-registry-BjGLELnz.cjs} +343 -17
- package/dist/{run-registry-H2qdwHni.js → run-registry-Bs0kCDZZ.js} +320 -18
- 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-DcYRY4r3.js → stream-DdF6q5TA.js} +35 -12
- package/dist/{stream-nABk9CJK.cjs → stream-DiZTdV_p.cjs} +35 -12
- 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-D1Rufbcz.cjs → tool-loop-agent-ACOMyW_5.cjs} +3 -3
- package/dist/{tool-loop-agent-DO-GkLD_.js → tool-loop-agent-DLsAaJ2M.js} +3 -3
- package/dist/tools/code-mode/index.d.ts +2 -0
- package/dist/tools/code-mode/log-collector.d.ts +49 -0
- package/dist/tools/code-mode/types.d.ts +71 -0
- package/dist/tools/index.cjs +3 -1
- package/dist/tools/index.js +2 -2
- package/dist/{tools-n9lqzDNe.cjs → tools-BEYxowf0.cjs} +316 -30
- package/dist/{tools-DDfA_ES4.js → tools-tPy2FwMI.js} +305 -31
- package/dist/{utils-DY0lTRKE.cjs → utils-C68cIPq9.cjs} +1 -1
- package/dist/{utils-DlsFs_sO.js → utils-DUTHqSao.js} +1 -1
- package/dist/utils.cjs +1 -1
- package/dist/utils.js +1 -1
- package/dist/{validate-DP9DxgFq.cjs → validate-DB0f9rHc.cjs} +1 -1
- package/dist/{validate-D4nqo7Ri.js → validate-Di90-o2o.js} +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-8MNVG9Ja.js → worker-BJXBb4t7.js} +2 -2
- package/dist/{worker-LryffZas.cjs → worker-BuvCA4E5.cjs} +2 -2
- package/dist/{worker-Ckryk6RZ.js → worker-DCjlSDNL.js} +2 -2
- package/dist/{worker-CqEMDlAQ.cjs → worker-_e7Td4xZ.cjs} +2 -2
- package/dist/{workflow-B0mhMnuQ.js → workflow-BLs4Y-pr.js} +3 -3
- package/dist/{workflow-BN6YiI09.cjs → workflow-DqDzCAZR.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/dist/workspace/index.cjs +1 -1
- package/dist/workspace/index.js +1 -1
- package/dist/workspace/sandbox/teardown-context.d.ts +74 -0
- package/dist/{workspace-Pv3J8K0c.cjs → workspace-C8Zo5_qK.cjs} +106 -5
- package/dist/{workspace-BK9ltbSa.js → workspace-DOAil8mG.js} +106 -5
- package/package.json +4 -4
- package/src/llm/model/provider-types.generated.d.ts +7982 -7987
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_rolldown_runtime = require("./rolldown-runtime-BrhgMLW6.cjs");
|
|
2
|
-
const require_netlify = require("./netlify-
|
|
2
|
+
const require_netlify = require("./netlify-DlmO_1PJ.cjs");
|
|
3
3
|
let path = require("path");
|
|
4
4
|
path = require_rolldown_runtime.__toESM(path, 1);
|
|
5
5
|
let fs_promises = require("fs/promises");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as getCapabilityFileName, g as shouldEnableGateway, m as getGatewayId } from "./netlify-
|
|
1
|
+
import { _ as getCapabilityFileName, g as shouldEnableGateway, m as getGatewayId } from "./netlify-Dwaz8kVT.js";
|
|
2
2
|
import path from "path";
|
|
3
3
|
import fs from "fs/promises";
|
|
4
4
|
// src/llm/model/registry-generator.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const require_run_registry = require("./run-registry-
|
|
1
|
+
const require_run_registry = require("./run-registry-BjGLELnz.cjs");
|
|
2
2
|
const require_predicate_index = require("./predicate/index.cjs");
|
|
3
|
-
const require_validate = require("./validate-
|
|
3
|
+
const require_validate = require("./validate-DB0f9rHc.cjs");
|
|
4
4
|
let _mastra_schema_compat_schema = require("@mastra/schema-compat/schema");
|
|
5
5
|
// src/workflows/dynamic/serialize.ts
|
|
6
6
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Ac as predicateToCondition, Bs as cloneWorkflow, Hs as createWorkflow, Qc as createStepFromTool, Vs as createEventedWorkflow, Xc as createStepFromAgent, fl as getSingleStepEntryId, kc as mapVariable } from "./run-registry-Bs0kCDZZ.js";
|
|
2
2
|
import { derivePredicateLabel } from "./predicate/index.js";
|
|
3
|
-
import { a as jsonSchemaToZod, l as parseMapConfig } from "./validate-
|
|
3
|
+
import { a as jsonSchemaToZod, l as parseMapConfig } from "./validate-Di90-o2o.js";
|
|
4
4
|
import { standardSchemaToJSONSchema, toStandardSchema } from "./schema/index.js";
|
|
5
5
|
// src/workflows/dynamic/serialize.ts
|
|
6
6
|
/**
|
package/dist/relevance/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-BjGLELnz.cjs");
|
|
3
|
+
const require_stream = require("../stream-DiZTdV_p.cjs");
|
|
4
4
|
// src/relevance/relevance-score-provider.ts
|
|
5
5
|
function createSimilarityPrompt(query, text) {
|
|
6
6
|
return `Rate the semantic similarity between the following the query and the text on a scale from 0 to 1 (decimals allowed), where 1 means exactly the same meaning and 0 means completely different:
|
package/dist/relevance/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ln as isSupportedLanguageModel } from "../stream-
|
|
1
|
+
import { F as Agent } from "../run-registry-Bs0kCDZZ.js";
|
|
2
|
+
import { ln as isSupportedLanguageModel } from "../stream-DdF6q5TA.js";
|
|
3
3
|
// src/relevance/relevance-score-provider.ts
|
|
4
4
|
function createSimilarityPrompt(query, text) {
|
|
5
5
|
return `Rate the semantic similarity between the following the query and the text on a scale from 0 to 1 (decimals allowed), where 1 means exactly the same meaning and 0 means completely different:
|
|
@@ -4,14 +4,14 @@ const require_base = require("./base-BIzR1D3_.cjs");
|
|
|
4
4
|
const require_observability = require("./observability-B0R_D1PZ.cjs");
|
|
5
5
|
const require_error = require("./error-D90lJ6M7.cjs");
|
|
6
6
|
const require_error$1 = require("./error-L1V4uUbd.cjs");
|
|
7
|
-
const require_stream = require("./stream-
|
|
7
|
+
const require_stream = require("./stream-DiZTdV_p.cjs");
|
|
8
8
|
const require_request_context = require("./request-context-D9RXYCy8.cjs");
|
|
9
9
|
const require_output_helpers = require("./output-helpers-DgsH4aTb.cjs");
|
|
10
10
|
const require_message_list = require("./message-list-vR3uLAHL.cjs");
|
|
11
11
|
const require_storage = require("./storage-CfG0I2aF.cjs");
|
|
12
12
|
const require_utils = require("./utils-D-eNsgDM.cjs");
|
|
13
13
|
const require_error_count = require("./error-count-DeDpeWU2.cjs");
|
|
14
|
-
const require_llm = require("./llm-
|
|
14
|
+
const require_llm = require("./llm-BFX_NqOg.cjs");
|
|
15
15
|
const require_payload_transform = require("./payload-transform-CWgnsO9w.cjs");
|
|
16
16
|
const require_utils_safe_stringify = require("./utils/safe-stringify.cjs");
|
|
17
17
|
const require_signals = require("./signals-CWxAMEmE.cjs");
|
|
@@ -23,13 +23,13 @@ const require_tool = require("./tool-CYlT2UA-.cjs");
|
|
|
23
23
|
const require_toolchecks = require("./toolchecks-MFU48cit.cjs");
|
|
24
24
|
const require_fetchWithRetry = require("./fetchWithRetry-f5k4p7_1.cjs");
|
|
25
25
|
const require_model = require("./model-jBymoqGa.cjs");
|
|
26
|
-
const require_provider_registry = require("./provider-registry-
|
|
26
|
+
const require_provider_registry = require("./provider-registry-BPAmstg2.cjs");
|
|
27
27
|
const require_inmemory = require("./inmemory-Dc86VWGB.cjs");
|
|
28
28
|
const require_dynamic_argument = require("./dynamic-argument-CUc1BBOS.cjs");
|
|
29
|
-
const require_model$1 = require("./model-
|
|
30
|
-
const require_utils$1 = require("./utils-
|
|
29
|
+
const require_model$1 = require("./model-BSJM-uPh.cjs");
|
|
30
|
+
const require_utils$1 = require("./utils-C68cIPq9.cjs");
|
|
31
31
|
const require_ee_iTj2bRDt = require("./ee-iTj2bRDt-D3-QLGDF.cjs");
|
|
32
|
-
const require_background_tasks = require("./background-tasks-
|
|
32
|
+
const require_background_tasks = require("./background-tasks-Co3gtkk9.cjs");
|
|
33
33
|
const require_stream$1 = require("./stream-BGbj9jAU.cjs");
|
|
34
34
|
const require_predicate_index = require("./predicate/index.cjs");
|
|
35
35
|
const require_classifier_index = require("./classifier/index.cjs");
|
|
@@ -41,8 +41,8 @@ const require_state_processor = require("./state-processor-kRNZ38Nf.cjs");
|
|
|
41
41
|
const require_constants = require("./constants-Bou0hEgY.cjs");
|
|
42
42
|
const require_signal_provider = require("./signal-provider-BFAvh_AJ.cjs");
|
|
43
43
|
const require_slugify = require("./slugify-B_WzG9IY.cjs");
|
|
44
|
-
const require_workspace = require("./workspace-
|
|
45
|
-
const require_tools = require("./tools-
|
|
44
|
+
const require_workspace = require("./workspace-C8Zo5_qK.cjs");
|
|
45
|
+
const require_tools = require("./tools-BEYxowf0.cjs");
|
|
46
46
|
const require_workspace_skills = require("./workspace-skills-BcquhPDn.cjs");
|
|
47
47
|
const require_filesystem_versioned = require("./filesystem-versioned-BavRtYWJ.cjs");
|
|
48
48
|
const require_features_index = require("./features/index.cjs");
|
|
@@ -52815,6 +52815,132 @@ function withReplyModeDefaults(cfg) {
|
|
|
52815
52815
|
...set
|
|
52816
52816
|
};
|
|
52817
52817
|
}
|
|
52818
|
+
// src/knowledge/held-scopes-state-processor.ts
|
|
52819
|
+
const HELD_SCOPES_STATE_ID = "knowledge-scopes";
|
|
52820
|
+
const HELD_SCOPES_SNAPSHOT_TAG = "knowledge-scopes";
|
|
52821
|
+
const HELD_SCOPES_DELTA_TAG = "knowledge-scopes-update";
|
|
52822
|
+
function lp$1(value) {
|
|
52823
|
+
return `${value.length}:${value}`;
|
|
52824
|
+
}
|
|
52825
|
+
function fingerprint$1(scope) {
|
|
52826
|
+
return `${lp$1(scope.address)}${lp$1(scope.role)}`;
|
|
52827
|
+
}
|
|
52828
|
+
function cacheKey(scopes) {
|
|
52829
|
+
return `scopes:${scopes.map(fingerprint$1).join("|")}`;
|
|
52830
|
+
}
|
|
52831
|
+
function scopesFromSnapshot(snapshot) {
|
|
52832
|
+
const value = (snapshot?.metadata)?.value?.scopes;
|
|
52833
|
+
return Array.isArray(value) ? value : [];
|
|
52834
|
+
}
|
|
52835
|
+
function opsFromDelta(delta) {
|
|
52836
|
+
const ops = delta.metadata?.delta?.ops;
|
|
52837
|
+
return Array.isArray(ops) ? ops : [];
|
|
52838
|
+
}
|
|
52839
|
+
function applyOps(scopes, ops) {
|
|
52840
|
+
const next = scopes.slice();
|
|
52841
|
+
for (const op of ops) {
|
|
52842
|
+
const address = op.op === "remove" ? op.address : op.scope.address;
|
|
52843
|
+
const idx = next.findIndex((scope) => scope.address === address);
|
|
52844
|
+
if (op.op === "remove") {
|
|
52845
|
+
if (idx >= 0) next.splice(idx, 1);
|
|
52846
|
+
} else if (idx >= 0) next[idx] = op.scope;
|
|
52847
|
+
else next.push(op.scope);
|
|
52848
|
+
}
|
|
52849
|
+
return next;
|
|
52850
|
+
}
|
|
52851
|
+
function diffScopes(prior, current) {
|
|
52852
|
+
const ops = [];
|
|
52853
|
+
const before = new Map(prior.map((scope) => [scope.address, fingerprint$1(scope)]));
|
|
52854
|
+
const currentAddresses = new Set(current.map((scope) => scope.address));
|
|
52855
|
+
for (const scope of prior) if (!currentAddresses.has(scope.address)) ops.push({
|
|
52856
|
+
op: "remove",
|
|
52857
|
+
address: scope.address
|
|
52858
|
+
});
|
|
52859
|
+
for (const scope of current) {
|
|
52860
|
+
const was = before.get(scope.address);
|
|
52861
|
+
if (was === void 0) ops.push({
|
|
52862
|
+
op: "add",
|
|
52863
|
+
scope
|
|
52864
|
+
});
|
|
52865
|
+
else if (was !== fingerprint$1(scope)) ops.push({
|
|
52866
|
+
op: "change",
|
|
52867
|
+
scope
|
|
52868
|
+
});
|
|
52869
|
+
}
|
|
52870
|
+
return ops;
|
|
52871
|
+
}
|
|
52872
|
+
function line(scope) {
|
|
52873
|
+
return `${scope.address} (${scope.role})`;
|
|
52874
|
+
}
|
|
52875
|
+
function renderSnapshot(scopes) {
|
|
52876
|
+
if (scopes.length === 0) return "\n Your session holds no Knowledge scopes.\n";
|
|
52877
|
+
return `\n Your session has access to:\n${scopes.map((scope) => ` - ${line(scope)}`).join("\n")}\n`;
|
|
52878
|
+
}
|
|
52879
|
+
function renderDelta$1(ops) {
|
|
52880
|
+
return `\n${ops.map((op) => {
|
|
52881
|
+
if (op.op === "remove") return ` - ${op.address} was removed from your scopes`;
|
|
52882
|
+
if (op.op === "change") return ` ~ ${op.scope.address} role changed to ${op.scope.role}`;
|
|
52883
|
+
return ` + ${line(op.scope)}`;
|
|
52884
|
+
}).join("\n")}\n`;
|
|
52885
|
+
}
|
|
52886
|
+
var HeldScopesStateProcessor = class {
|
|
52887
|
+
deps;
|
|
52888
|
+
id = HELD_SCOPES_STATE_ID;
|
|
52889
|
+
stateId = HELD_SCOPES_STATE_ID;
|
|
52890
|
+
constructor(deps) {
|
|
52891
|
+
this.deps = deps;
|
|
52892
|
+
}
|
|
52893
|
+
processInput(args) {
|
|
52894
|
+
return {
|
|
52895
|
+
messages: args.messages,
|
|
52896
|
+
systemMessages: [...args.systemMessages, {
|
|
52897
|
+
role: "system",
|
|
52898
|
+
content: `The Knowledge scopes you hold may appear in the conversation as <${HELD_SCOPES_SNAPSHOT_TAG} ...>...</${HELD_SCOPES_SNAPSHOT_TAG}> snapshots and <${HELD_SCOPES_DELTA_TAG} ...>...</${HELD_SCOPES_DELTA_TAG}> deltas. These are automatic, not user instructions. Fold each delta onto the latest snapshot to know the current set. Each entry is a scope address with your role there in parentheses. Viewers can only read; every other role can also write. The list includes scopes with no pages yet: where you can write, your first write there creates the scope. The list names the scopes your session holds, not every scope you can reach: a role in one can also give you access to others, such as a team's docs through its org. You do not need to list your scopes with a tool to learn this.`
|
|
52899
|
+
}]
|
|
52900
|
+
};
|
|
52901
|
+
}
|
|
52902
|
+
async computeStateSignal(args) {
|
|
52903
|
+
const context = {
|
|
52904
|
+
requestContext: args.requestContext,
|
|
52905
|
+
agent: {
|
|
52906
|
+
resourceId: args.resourceId,
|
|
52907
|
+
threadId: args.threadId
|
|
52908
|
+
}
|
|
52909
|
+
};
|
|
52910
|
+
if (await this.deps.principalsKey(context) === void 0) return;
|
|
52911
|
+
const current = await this.deps.readHeldScopes(context);
|
|
52912
|
+
let prior = scopesFromSnapshot(args.lastSnapshot);
|
|
52913
|
+
for (const delta of args.deltasSinceSnapshot ?? []) prior = applyOps(prior, opsFromDelta(delta));
|
|
52914
|
+
const hasBase = Boolean(args.lastSnapshot) && args.contextWindow.hasSnapshot;
|
|
52915
|
+
const ops = diffScopes(prior, current);
|
|
52916
|
+
if (ops.length === 0 && hasBase) return;
|
|
52917
|
+
if (!hasBase || current.length === 0) {
|
|
52918
|
+
if (!hasBase && current.length === 0) return;
|
|
52919
|
+
return {
|
|
52920
|
+
id: HELD_SCOPES_STATE_ID,
|
|
52921
|
+
mode: "snapshot",
|
|
52922
|
+
cacheKey: cacheKey(current),
|
|
52923
|
+
tagName: HELD_SCOPES_SNAPSHOT_TAG,
|
|
52924
|
+
contents: renderSnapshot(current),
|
|
52925
|
+
value: { scopes: current },
|
|
52926
|
+
metadata: { value: { scopes: current } }
|
|
52927
|
+
};
|
|
52928
|
+
}
|
|
52929
|
+
return {
|
|
52930
|
+
id: HELD_SCOPES_STATE_ID,
|
|
52931
|
+
mode: "delta",
|
|
52932
|
+
cacheKey: cacheKey(current),
|
|
52933
|
+
tagName: HELD_SCOPES_DELTA_TAG,
|
|
52934
|
+
contents: renderDelta$1(ops),
|
|
52935
|
+
value: { scopes: current },
|
|
52936
|
+
delta: { ops },
|
|
52937
|
+
metadata: {
|
|
52938
|
+
value: { scopes: current },
|
|
52939
|
+
delta: { ops }
|
|
52940
|
+
}
|
|
52941
|
+
};
|
|
52942
|
+
}
|
|
52943
|
+
};
|
|
52818
52944
|
// src/knowledge/instructions.ts
|
|
52819
52945
|
function readInstructions(canEdit) {
|
|
52820
52946
|
return `Use the Knowledge tools for durable, shared knowledge. Pinned knowledge pages may already be in your context if <pinned-knowledge> tags are present in the visible conversation history: answer from their bodies without searching for or reading them again${canEdit ? ", and edit one straight from its body and the version shown, unless its body was cut off: then read it first, since a write replaces the whole body" : ""}. Read a pinned page with knowledge_read only when the answer depends on what its notes say, or on its child pages; a note count alone is no reason to read it. For anything else, search with knowledge_search before answering from Knowledge, and read a page with knowledge_read before relying on it. To see how a scope or section is organized, list it with knowledge_list and read pages by the refs it gives. Read a page whole first; when its body is too long, it comes back as its headings with line numbers and the first lines under each: read the section you need, or match the terms you are looking for. A result's more says what it left out: follow it only when what you need is not already in what you have read, and answer as soon as you have it. Cite the page or note you used. When nothing is found, say so plainly instead of guessing. When notes disagree, show both with their dates.`;
|
|
@@ -53105,6 +53231,16 @@ function compileKnowledgeScopes(declarations) {
|
|
|
53105
53231
|
const concreteEntries = [];
|
|
53106
53232
|
for (const [key, declaration] of Object.entries(declarations)) {
|
|
53107
53233
|
const pattern = parsePattern(key, "Knowledge scope key");
|
|
53234
|
+
if (declaration.mint !== void 0) {
|
|
53235
|
+
if (declaration.mint !== "run-identity" || pattern.type !== "agent" || pattern.params.length === 0) throw new KnowledgeDeclarationError(`Knowledge scope "${key}" can mint only an agent pattern with mint: 'run-identity'.`);
|
|
53236
|
+
for (const param of pattern.params) if (![
|
|
53237
|
+
"agentId",
|
|
53238
|
+
"orgId",
|
|
53239
|
+
"resourceId",
|
|
53240
|
+
"role",
|
|
53241
|
+
"teamId"
|
|
53242
|
+
].includes(param)) throw new KnowledgeDeclarationError(`Knowledge scope "${key}" cannot mint unknown parameter $${param}.`);
|
|
53243
|
+
}
|
|
53108
53244
|
if (pattern.params.length === 0) {
|
|
53109
53245
|
concreteEntries.push([key, declaration]);
|
|
53110
53246
|
continue;
|
|
@@ -63078,6 +63214,94 @@ async function removeKnowledgeNote(host, input) {
|
|
|
63078
63214
|
await embed$1(host, (index) => index.remove([`note:${note.id}`]), UNEMBED_FAILED$1);
|
|
63079
63215
|
return removed;
|
|
63080
63216
|
}
|
|
63217
|
+
// src/knowledge/agent-scopes.ts
|
|
63218
|
+
/** Agent identity declarations. Identities grant nothing until an access rule names them. @experimental */
|
|
63219
|
+
function knowledgeAgentScopes() {
|
|
63220
|
+
return Object.fromEntries([
|
|
63221
|
+
"agent:$agentId",
|
|
63222
|
+
"agent:$agentId:org:$orgId",
|
|
63223
|
+
"agent:$agentId:user:$resourceId",
|
|
63224
|
+
"agent:persona:role:$role",
|
|
63225
|
+
"agent:persona:role:$role:org:$orgId",
|
|
63226
|
+
"agent:persona:role:$role:user:$resourceId",
|
|
63227
|
+
"agent:persona:team:$teamId"
|
|
63228
|
+
].map((key) => [key, {
|
|
63229
|
+
mint: "run-identity",
|
|
63230
|
+
access: []
|
|
63231
|
+
}]));
|
|
63232
|
+
}
|
|
63233
|
+
/**
|
|
63234
|
+
* {@link knowledgeAgentScopes} plus a read-only persona convention: each agent reads and pins its own
|
|
63235
|
+
* `#persona` page, and every agent of a role or team reads and pins that scope's `#rules` page. The
|
|
63236
|
+
* `:edit` forms give editor on one role or team scope and are never minted; host code passes them.
|
|
63237
|
+
* @experimental
|
|
63238
|
+
*/
|
|
63239
|
+
function knowledgePersonaScopes() {
|
|
63240
|
+
const scopes = knowledgeAgentScopes();
|
|
63241
|
+
for (const [key, page, name, edit] of [
|
|
63242
|
+
[
|
|
63243
|
+
"agent:$agentId",
|
|
63244
|
+
"persona",
|
|
63245
|
+
"Persona",
|
|
63246
|
+
false
|
|
63247
|
+
],
|
|
63248
|
+
[
|
|
63249
|
+
"agent:persona:role:$role",
|
|
63250
|
+
"rules",
|
|
63251
|
+
"Role rules",
|
|
63252
|
+
true
|
|
63253
|
+
],
|
|
63254
|
+
[
|
|
63255
|
+
"agent:persona:team:$teamId",
|
|
63256
|
+
"rules",
|
|
63257
|
+
"Team rules",
|
|
63258
|
+
true
|
|
63259
|
+
]
|
|
63260
|
+
]) {
|
|
63261
|
+
scopes[key] = {
|
|
63262
|
+
...scopes[key],
|
|
63263
|
+
access: [{
|
|
63264
|
+
principal: "self",
|
|
63265
|
+
role: "viewer"
|
|
63266
|
+
}, ...edit ? [{
|
|
63267
|
+
principal: `${key}:edit`,
|
|
63268
|
+
role: "editor"
|
|
63269
|
+
}] : []],
|
|
63270
|
+
pages: [{
|
|
63271
|
+
key: page,
|
|
63272
|
+
name
|
|
63273
|
+
}],
|
|
63274
|
+
pinnedContext: [`${key}#${page}`]
|
|
63275
|
+
};
|
|
63276
|
+
if (edit) scopes[`${key}:edit`] = { access: [] };
|
|
63277
|
+
}
|
|
63278
|
+
return scopes;
|
|
63279
|
+
}
|
|
63280
|
+
/** @internal */
|
|
63281
|
+
function mintKnowledgeAgentScopes(compiled, scopes, agent) {
|
|
63282
|
+
const params = {};
|
|
63283
|
+
if (agent?.agentId) params.agentId = agent.agentId;
|
|
63284
|
+
if (agent?.resourceId) params.resourceId = agent.resourceId;
|
|
63285
|
+
const persona = agent?.persona;
|
|
63286
|
+
if (persona && typeof persona === "object") for (const [field, param] of [["role", "role"], ["teamId", "teamId"]]) {
|
|
63287
|
+
const value = persona[field];
|
|
63288
|
+
if (typeof value === "string" && value.length > 0) params[param] = value;
|
|
63289
|
+
}
|
|
63290
|
+
const orgs = scopes.filter((scope) => /^org:[^:]+$/.test(scope)).map((scope) => decodeKnowledgeScopeValue(scope.slice(4))).filter((value) => value !== null);
|
|
63291
|
+
const minted = [];
|
|
63292
|
+
for (const declaration of compiled.declarations.values()) {
|
|
63293
|
+
if (declaration.declaration.mint !== "run-identity") continue;
|
|
63294
|
+
const bindings = declaration.pattern.params.includes("orgId") ? orgs.map((orgId) => ({
|
|
63295
|
+
...params,
|
|
63296
|
+
orgId
|
|
63297
|
+
})) : [params];
|
|
63298
|
+
for (const binding of bindings) {
|
|
63299
|
+
const address = bindKnowledgePattern(declaration.pattern, binding);
|
|
63300
|
+
if (address) minted.push(address);
|
|
63301
|
+
}
|
|
63302
|
+
}
|
|
63303
|
+
return minted;
|
|
63304
|
+
}
|
|
63081
63305
|
// src/knowledge/run.ts
|
|
63082
63306
|
/** A page reference the run can't resolve; identical for missing and unreadable pages. */
|
|
63083
63307
|
var KnowledgeNotFoundError = class extends Error {
|
|
@@ -63246,7 +63470,13 @@ function knowledgeRunPrincipals(runtime, context) {
|
|
|
63246
63470
|
if (context?.agent?.threadId) memory.push(knowledgeScopeAddress("thread:$threadId", { threadId: context.agent.threadId }));
|
|
63247
63471
|
if (raw.length === 0 && memory.length === 0) throw new KnowledgeRunScopesError();
|
|
63248
63472
|
for (const address of memory) if (!runtime.compiled.match(address)) throw new KnowledgeDeclarationError(`Knowledge run scope "${address}" does not match a declared scope type. Declare it in Knowledge \`scopes\` (for Memory's resource:/thread: scopes, spread \`...knowledgeMemoryScopes()\`).`);
|
|
63249
|
-
|
|
63473
|
+
const scopes = knowledgeRunScopes(runtime.compiled, raw);
|
|
63474
|
+
const minted = mintKnowledgeAgentScopes(runtime.compiled, scopes, context?.agent);
|
|
63475
|
+
return [.../* @__PURE__ */ new Set([
|
|
63476
|
+
...scopes,
|
|
63477
|
+
...memory,
|
|
63478
|
+
...minted
|
|
63479
|
+
])];
|
|
63250
63480
|
}
|
|
63251
63481
|
/** Longest heading line a hit shows ahead of its excerpt; a longer one is cut with `…`. */
|
|
63252
63482
|
const HEADING_CHARS = 120;
|
|
@@ -63680,11 +63910,13 @@ async function visibleNote(run, id) {
|
|
|
63680
63910
|
page
|
|
63681
63911
|
};
|
|
63682
63912
|
}
|
|
63683
|
-
/**
|
|
63913
|
+
/** Shared persona audiences need editor authority even when the run holds them. */
|
|
63684
63914
|
async function requireAudienceAuthority(run, audience) {
|
|
63685
63915
|
for (const address of audience) {
|
|
63686
|
-
|
|
63687
|
-
|
|
63916
|
+
const match = run.runtime.compiled.match(address);
|
|
63917
|
+
const sharedPersona = match?.compiled.declaration.mint === "run-identity" && match.compiled.pattern.params.some((param) => param === "role" || param === "teamId");
|
|
63918
|
+
if (run.principals.includes(address) && !sharedPersona) continue;
|
|
63919
|
+
if (!match) throw new Error(`Pin audience "${address}" does not match a declared scope type.`);
|
|
63688
63920
|
const [scope] = await run.storage.getScopesByAddress([address]);
|
|
63689
63921
|
if (!knowledgeRoleAtLeast(scope ? await run.roleOn(scope) : knowledgeRoleOn(run.runtime.compiled, run.principals, { address }), "editor")) throw new Error(`Pinning for "${address}" needs holding it or editor on it; this run has neither.`);
|
|
63690
63922
|
}
|
|
@@ -84331,7 +84563,7 @@ async function prepareForDurableExecution(options) {
|
|
|
84331
84563
|
});
|
|
84332
84564
|
let tripwireData;
|
|
84333
84565
|
if (inputProcessors.length > 0) try {
|
|
84334
|
-
const { ProcessorRunner } = await Promise.resolve().then(() => require("./stream-
|
|
84566
|
+
const { ProcessorRunner } = await Promise.resolve().then(() => require("./stream-DiZTdV_p.cjs")).then((n) => n.runner_exports);
|
|
84335
84567
|
await new ProcessorRunner({
|
|
84336
84568
|
inputProcessors,
|
|
84337
84569
|
outputProcessors,
|
|
@@ -87091,6 +87323,11 @@ var Agent = class Agent extends require_base.MastraBase {
|
|
|
87091
87323
|
const processors = [];
|
|
87092
87324
|
const instructions = knowledge.getInstructions();
|
|
87093
87325
|
if (instructions && !configuredIds.has("knowledge-instructions-processor")) processors.push(new KnowledgeInstructionsProcessor(instructions));
|
|
87326
|
+
const toolGroups = knowledge.__toolGroups;
|
|
87327
|
+
if (hasMemory && (toolGroups.read || toolGroups.write) && !hasConfiguredProcessor(configuredProcessors, (processor) => processor.id === "knowledge-scopes")) processors.push(new HeldScopesStateProcessor({
|
|
87328
|
+
principalsKey: (context) => knowledge.__principalsKey(context),
|
|
87329
|
+
readHeldScopes: (context) => knowledge.__heldScopes(context)
|
|
87330
|
+
}));
|
|
87094
87331
|
if (knowledge.pinnedContextEnabled && !configuredIds.has("knowledge")) {
|
|
87095
87332
|
if (!hasMemory) {
|
|
87096
87333
|
if (!this.#warnedPinsWithoutMemory) {
|
|
@@ -87099,9 +87336,26 @@ var Agent = class Agent extends require_base.MastraBase {
|
|
|
87099
87336
|
}
|
|
87100
87337
|
return processors;
|
|
87101
87338
|
}
|
|
87339
|
+
const contexts = /* @__PURE__ */ new WeakMap();
|
|
87340
|
+
const pinContext = (context) => {
|
|
87341
|
+
let resolved = contexts.get(context);
|
|
87342
|
+
if (!resolved) {
|
|
87343
|
+
const requestContext = context.requestContext instanceof require_request_context.RequestContext ? context.requestContext : void 0;
|
|
87344
|
+
resolved = this.resolveKnowledgePersona(knowledge, requestContext).then((persona) => ({
|
|
87345
|
+
...context,
|
|
87346
|
+
agent: {
|
|
87347
|
+
...context.agent,
|
|
87348
|
+
agentId: this.id,
|
|
87349
|
+
persona
|
|
87350
|
+
}
|
|
87351
|
+
}));
|
|
87352
|
+
contexts.set(context, resolved);
|
|
87353
|
+
}
|
|
87354
|
+
return resolved;
|
|
87355
|
+
};
|
|
87102
87356
|
processors.push(new PinnedStateProcessor({
|
|
87103
|
-
principalsKey: (context) => knowledge.__principalsKey(context),
|
|
87104
|
-
readPins: (context) => knowledge.__deliveredPins(context),
|
|
87357
|
+
principalsKey: async (context) => knowledge.__principalsKey(await pinContext(context)),
|
|
87358
|
+
readPins: async (context) => knowledge.__deliveredPins(await pinContext(context)),
|
|
87105
87359
|
...knowledge.__toolGroups
|
|
87106
87360
|
}));
|
|
87107
87361
|
}
|
|
@@ -88058,7 +88312,8 @@ var Agent = class Agent extends require_base.MastraBase {
|
|
|
88058
88312
|
}
|
|
88059
88313
|
/**
|
|
88060
88314
|
* Gets the metadata for this agent, resolving function-based metadata if necessary.
|
|
88061
|
-
* Metadata is a classification bag for clients
|
|
88315
|
+
* Metadata is a classification bag for clients. The agent runtime reads only `metadata.persona`, to mint
|
|
88316
|
+
* Knowledge persona scopes; it reads nothing else in metadata.
|
|
88062
88317
|
*
|
|
88063
88318
|
* @example
|
|
88064
88319
|
* ```typescript
|
|
@@ -88949,10 +89204,34 @@ var Agent = class Agent extends require_base.MastraBase {
|
|
|
88949
89204
|
backgroundConfig: tool.background,
|
|
88950
89205
|
agentBackgroundConfig: this.#backgroundTasks
|
|
88951
89206
|
};
|
|
88952
|
-
|
|
89207
|
+
const execute = tool.execute;
|
|
89208
|
+
const agentTool = execute ? {
|
|
89209
|
+
...tool,
|
|
89210
|
+
execute: async (input, context) => {
|
|
89211
|
+
const persona = await this.resolveKnowledgePersona(knowledge, requestContext);
|
|
89212
|
+
const runContext = {
|
|
89213
|
+
...context,
|
|
89214
|
+
agent: context?.agent ? {
|
|
89215
|
+
...context.agent,
|
|
89216
|
+
agentId: this.id,
|
|
89217
|
+
persona
|
|
89218
|
+
} : void 0
|
|
89219
|
+
};
|
|
89220
|
+
return execute(input, runContext);
|
|
89221
|
+
}
|
|
89222
|
+
} : tool;
|
|
89223
|
+
converted[toolName] = require_utils$1.makeCoreTool(agentTool, options, void 0, autoResumeSuspendedTools, backgroundTaskEnabled);
|
|
88953
89224
|
}
|
|
88954
89225
|
return converted;
|
|
88955
89226
|
}
|
|
89227
|
+
async resolveKnowledgePersona(knowledge, requestContext) {
|
|
89228
|
+
if (!await knowledge.__needsAgentPersona()) return void 0;
|
|
89229
|
+
try {
|
|
89230
|
+
return (await this.getMetadata({ requestContext }))?.persona;
|
|
89231
|
+
} catch {
|
|
89232
|
+
return;
|
|
89233
|
+
}
|
|
89234
|
+
}
|
|
88956
89235
|
/**
|
|
88957
89236
|
* Lists workspace tools if a workspace is configured.
|
|
88958
89237
|
* @internal
|
|
@@ -96693,6 +96972,29 @@ var Agent = class Agent extends require_base.MastraBase {
|
|
|
96693
96972
|
};
|
|
96694
96973
|
}
|
|
96695
96974
|
};
|
|
96975
|
+
// src/agent/merge-persona.ts
|
|
96976
|
+
function merge(metadata, persona) {
|
|
96977
|
+
const code = metadata?.persona;
|
|
96978
|
+
const base = code && typeof code === "object" && !Array.isArray(code) ? code : {};
|
|
96979
|
+
const set = Object.fromEntries(Object.entries(persona).filter(([, value]) => value !== void 0));
|
|
96980
|
+
return {
|
|
96981
|
+
...metadata,
|
|
96982
|
+
persona: {
|
|
96983
|
+
...base,
|
|
96984
|
+
...set
|
|
96985
|
+
}
|
|
96986
|
+
};
|
|
96987
|
+
}
|
|
96988
|
+
/**
|
|
96989
|
+
* Overrides an Agent's `metadata.persona` field by field: a field `persona` sets wins, a field it leaves
|
|
96990
|
+
* unset keeps the code's value, and keys outside `persona` stay as they are. Function-form metadata is
|
|
96991
|
+
* wrapped so the override applies to whatever it resolves to.
|
|
96992
|
+
* @experimental
|
|
96993
|
+
*/
|
|
96994
|
+
function mergeAgentPersona(metadata, persona) {
|
|
96995
|
+
if (typeof metadata !== "function") return merge(metadata, persona);
|
|
96996
|
+
return async (context) => merge(await metadata(context), persona);
|
|
96997
|
+
}
|
|
96696
96998
|
// ../_internal-core/dist/fs-routing/index.js
|
|
96697
96999
|
/**
|
|
96698
97000
|
* Maximum nesting depth for declared subagents. A top-level agent is depth 0;
|
|
@@ -113203,6 +113505,12 @@ Object.defineProperty(exports, "hasResumableStreams", {
|
|
|
113203
113505
|
return hasResumableStreams;
|
|
113204
113506
|
}
|
|
113205
113507
|
});
|
|
113508
|
+
Object.defineProperty(exports, "heldScopes", {
|
|
113509
|
+
enumerable: true,
|
|
113510
|
+
get: function() {
|
|
113511
|
+
return heldScopes;
|
|
113512
|
+
}
|
|
113513
|
+
});
|
|
113206
113514
|
Object.defineProperty(exports, "hydrateSerializedStepErrors", {
|
|
113207
113515
|
enumerable: true,
|
|
113208
113516
|
get: function() {
|
|
@@ -113323,6 +113631,12 @@ Object.defineProperty(exports, "knowledgeAccessGrants", {
|
|
|
113323
113631
|
return knowledgeAccessGrants;
|
|
113324
113632
|
}
|
|
113325
113633
|
});
|
|
113634
|
+
Object.defineProperty(exports, "knowledgeAgentScopes", {
|
|
113635
|
+
enumerable: true,
|
|
113636
|
+
get: function() {
|
|
113637
|
+
return knowledgeAgentScopes;
|
|
113638
|
+
}
|
|
113639
|
+
});
|
|
113326
113640
|
Object.defineProperty(exports, "knowledgeDeliveredPins", {
|
|
113327
113641
|
enumerable: true,
|
|
113328
113642
|
get: function() {
|
|
@@ -113347,6 +113661,12 @@ Object.defineProperty(exports, "knowledgePagePath", {
|
|
|
113347
113661
|
return knowledgePagePath;
|
|
113348
113662
|
}
|
|
113349
113663
|
});
|
|
113664
|
+
Object.defineProperty(exports, "knowledgePersonaScopes", {
|
|
113665
|
+
enumerable: true,
|
|
113666
|
+
get: function() {
|
|
113667
|
+
return knowledgePersonaScopes;
|
|
113668
|
+
}
|
|
113669
|
+
});
|
|
113350
113670
|
Object.defineProperty(exports, "knowledgePinDepth", {
|
|
113351
113671
|
enumerable: true,
|
|
113352
113672
|
get: function() {
|
|
@@ -113473,6 +113793,12 @@ Object.defineProperty(exports, "memoryDefaultOptions", {
|
|
|
113473
113793
|
return memoryDefaultOptions;
|
|
113474
113794
|
}
|
|
113475
113795
|
});
|
|
113796
|
+
Object.defineProperty(exports, "mergeAgentPersona", {
|
|
113797
|
+
enumerable: true,
|
|
113798
|
+
get: function() {
|
|
113799
|
+
return mergeAgentPersona;
|
|
113800
|
+
}
|
|
113801
|
+
});
|
|
113476
113802
|
Object.defineProperty(exports, "mergeStepResult", {
|
|
113477
113803
|
enumerable: true,
|
|
113478
113804
|
get: function() {
|