@mastra/server 0.0.0-fix-memory-search-fetch-20251027160505 → 0.0.0-fix-persist-session-cache-option-mcp-server-20251030161352
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +35 -3
- package/README.md +1 -1
- package/dist/{chunk-AHB4JCIQ.js → chunk-2XD2KQEK.js} +13 -13
- package/dist/chunk-2XD2KQEK.js.map +1 -0
- package/dist/{chunk-AW5BU3RQ.js → chunk-36CWLQQT.js} +19 -19
- package/dist/chunk-36CWLQQT.js.map +1 -0
- package/dist/{chunk-EGLGMBWW.cjs → chunk-4BKR6543.cjs} +181 -219
- package/dist/chunk-4BKR6543.cjs.map +1 -0
- package/dist/{chunk-ABCBHBR7.js → chunk-4YFT3JFJ.js} +160 -203
- package/dist/chunk-4YFT3JFJ.js.map +1 -0
- package/dist/{chunk-KSFLUEWV.js → chunk-6562SOHJ.js} +4 -4
- package/dist/{chunk-KSFLUEWV.js.map → chunk-6562SOHJ.js.map} +1 -1
- package/dist/{chunk-SPRRK3P7.cjs → chunk-6IGZKIRM.cjs} +19 -19
- package/dist/chunk-6IGZKIRM.cjs.map +1 -0
- package/dist/{chunk-QQXMIP6C.js → chunk-74ZF4DII.js} +10 -10
- package/dist/{chunk-QQXMIP6C.js.map → chunk-74ZF4DII.js.map} +1 -1
- package/dist/{chunk-ABRFV4XP.js → chunk-7KNKINQE.js} +11 -11
- package/dist/chunk-7KNKINQE.js.map +1 -0
- package/dist/{chunk-6VPAV4ZV.js → chunk-7MCHFMDF.js} +102 -129
- package/dist/chunk-7MCHFMDF.js.map +1 -0
- package/dist/{chunk-3SNGNFUJ.cjs → chunk-7YHMDEQ6.cjs} +10 -10
- package/dist/{chunk-3SNGNFUJ.cjs.map → chunk-7YHMDEQ6.cjs.map} +1 -1
- package/dist/{chunk-TRGAMKHX.cjs → chunk-BMOVKZO7.cjs} +19 -19
- package/dist/chunk-BMOVKZO7.cjs.map +1 -0
- package/dist/{chunk-OGK26QPW.js → chunk-CXVOX4WB.js} +41 -65
- package/dist/chunk-CXVOX4WB.js.map +1 -0
- package/dist/{chunk-LF2ZLOFP.js → chunk-GQRJOUV7.js} +64 -34
- package/dist/chunk-GQRJOUV7.js.map +1 -0
- package/dist/{chunk-YSHNCC6F.cjs → chunk-HLIRV42R.cjs} +109 -137
- package/dist/chunk-HLIRV42R.cjs.map +1 -0
- package/dist/{chunk-Y7SH5ZKM.cjs → chunk-LROVQBIB.cjs} +41 -66
- package/dist/chunk-LROVQBIB.cjs.map +1 -0
- package/dist/{chunk-GU4EWMZB.cjs → chunk-LZKJT7QP.cjs} +64 -34
- package/dist/chunk-LZKJT7QP.cjs.map +1 -0
- package/dist/{chunk-MN2TZQ7I.js → chunk-OEW3R7V4.js} +13 -13
- package/dist/chunk-OEW3R7V4.js.map +1 -0
- package/dist/{chunk-B7QWVGQQ.cjs → chunk-PUYDRTPG.cjs} +49 -58
- package/dist/chunk-PUYDRTPG.cjs.map +1 -0
- package/dist/{chunk-ZLBL4NQC.js → chunk-S4IOWSI3.js} +45 -54
- package/dist/chunk-S4IOWSI3.js.map +1 -0
- package/dist/{chunk-K5T5A3AL.cjs → chunk-SED4H2GJ.cjs} +14 -14
- package/dist/chunk-SED4H2GJ.cjs.map +1 -0
- package/dist/{chunk-XN74I6VW.cjs → chunk-WH5RPLO4.cjs} +13 -13
- package/dist/chunk-WH5RPLO4.cjs.map +1 -0
- package/dist/{chunk-CJFKRVED.cjs → chunk-YNGDJJOH.cjs} +14 -14
- package/dist/{chunk-CJFKRVED.cjs.map → chunk-YNGDJJOH.cjs.map} +1 -1
- package/dist/server/handlers/a2a.cjs +7 -7
- package/dist/server/handlers/a2a.d.ts +10 -10
- package/dist/server/handlers/a2a.d.ts.map +1 -1
- package/dist/server/handlers/a2a.js +1 -1
- package/dist/server/handlers/agent-builder.cjs +36 -16
- package/dist/server/handlers/agent-builder.d.ts +22 -6
- package/dist/server/handlers/agent-builder.d.ts.map +1 -1
- package/dist/server/handlers/agent-builder.js +1 -1
- package/dist/server/handlers/agents.cjs +25 -29
- package/dist/server/handlers/agents.d.ts +34 -47
- package/dist/server/handlers/agents.d.ts.map +1 -1
- package/dist/server/handlers/agents.js +1 -1
- package/dist/server/handlers/logs.cjs +7 -7
- package/dist/server/handlers/logs.d.ts +3 -3
- package/dist/server/handlers/logs.d.ts.map +1 -1
- package/dist/server/handlers/logs.js +1 -1
- package/dist/server/handlers/memory.cjs +17 -21
- package/dist/server/handlers/memory.d.ts +18 -21
- package/dist/server/handlers/memory.d.ts.map +1 -1
- package/dist/server/handlers/memory.js +1 -1
- package/dist/server/handlers/scores.cjs +10 -10
- package/dist/server/handlers/scores.d.ts +8 -8
- package/dist/server/handlers/scores.d.ts.map +1 -1
- package/dist/server/handlers/scores.js +1 -1
- package/dist/server/handlers/tools.cjs +7 -7
- package/dist/server/handlers/tools.d.ts +8 -8
- package/dist/server/handlers/tools.d.ts.map +1 -1
- package/dist/server/handlers/tools.js +1 -1
- package/dist/server/handlers/voice.cjs +5 -5
- package/dist/server/handlers/voice.d.ts +6 -6
- package/dist/server/handlers/voice.js +1 -1
- package/dist/server/handlers/workflows.cjs +23 -23
- package/dist/server/handlers/workflows.d.ts +19 -19
- package/dist/server/handlers/workflows.d.ts.map +1 -1
- package/dist/server/handlers/workflows.js +1 -1
- package/dist/server/handlers.cjs +19 -24
- package/dist/server/handlers.d.ts +0 -1
- package/dist/server/handlers.d.ts.map +1 -1
- package/dist/server/handlers.js +9 -10
- package/package.json +6 -6
- package/dist/chunk-6VPAV4ZV.js.map +0 -1
- package/dist/chunk-ABCBHBR7.js.map +0 -1
- package/dist/chunk-ABRFV4XP.js.map +0 -1
- package/dist/chunk-AHB4JCIQ.js.map +0 -1
- package/dist/chunk-AW5BU3RQ.js.map +0 -1
- package/dist/chunk-B7QWVGQQ.cjs.map +0 -1
- package/dist/chunk-EGLGMBWW.cjs.map +0 -1
- package/dist/chunk-GU4EWMZB.cjs.map +0 -1
- package/dist/chunk-I3C4ODGV.cjs +0 -335
- package/dist/chunk-I3C4ODGV.cjs.map +0 -1
- package/dist/chunk-K5T5A3AL.cjs.map +0 -1
- package/dist/chunk-LF2ZLOFP.js.map +0 -1
- package/dist/chunk-LLUOPR3J.js +0 -323
- package/dist/chunk-LLUOPR3J.js.map +0 -1
- package/dist/chunk-MN2TZQ7I.js.map +0 -1
- package/dist/chunk-OGK26QPW.js.map +0 -1
- package/dist/chunk-SPRRK3P7.cjs.map +0 -1
- package/dist/chunk-TRGAMKHX.cjs.map +0 -1
- package/dist/chunk-XN74I6VW.cjs.map +0 -1
- package/dist/chunk-Y7SH5ZKM.cjs.map +0 -1
- package/dist/chunk-YSHNCC6F.cjs.map +0 -1
- package/dist/chunk-ZLBL4NQC.js.map +0 -1
- package/dist/server/handlers/legacyWorkflows.cjs +0 -48
- package/dist/server/handlers/legacyWorkflows.cjs.map +0 -1
- package/dist/server/handlers/legacyWorkflows.d.ts +0 -59
- package/dist/server/handlers/legacyWorkflows.d.ts.map +0 -1
- package/dist/server/handlers/legacyWorkflows.js +0 -3
- package/dist/server/handlers/legacyWorkflows.js.map +0 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var chunkB7QWVGQQ_cjs = require('./chunk-B7QWVGQQ.cjs');
|
|
4
3
|
var chunkX6C7BUWN_cjs = require('./chunk-X6C7BUWN.cjs');
|
|
5
4
|
var chunk2PLXW4ZX_cjs = require('./chunk-2PLXW4ZX.cjs');
|
|
6
5
|
var chunkLPM6BBAX_cjs = require('./chunk-LPM6BBAX.cjs');
|
|
7
|
-
var
|
|
6
|
+
var chunkPUYDRTPG_cjs = require('./chunk-PUYDRTPG.cjs');
|
|
7
|
+
var chunkYNGDJJOH_cjs = require('./chunk-YNGDJJOH.cjs');
|
|
8
8
|
var chunkRE4RPXT2_cjs = require('./chunk-RE4RPXT2.cjs');
|
|
9
9
|
var chunk7NADHFD2_cjs = require('./chunk-7NADHFD2.cjs');
|
|
10
10
|
var chunkO7I5CWRX_cjs = require('./chunk-O7I5CWRX.cjs');
|
|
@@ -744,12 +744,17 @@ chunkO7I5CWRX_cjs.__export(agent_builder_exports, {
|
|
|
744
744
|
getAgentBuilderActionRunExecutionResultHandler: () => getAgentBuilderActionRunExecutionResultHandler,
|
|
745
745
|
getAgentBuilderActionRunsHandler: () => getAgentBuilderActionRunsHandler,
|
|
746
746
|
getAgentBuilderActionsHandler: () => getAgentBuilderActionsHandler,
|
|
747
|
+
observeStreamAgentBuilderActionHandler: () => observeStreamAgentBuilderActionHandler,
|
|
748
|
+
observeStreamLegacyAgentBuilderActionHandler: () => observeStreamLegacyAgentBuilderActionHandler,
|
|
749
|
+
observeStreamVNextAgentBuilderActionHandler: () => observeStreamVNextAgentBuilderActionHandler,
|
|
747
750
|
resumeAgentBuilderActionHandler: () => resumeAgentBuilderActionHandler,
|
|
748
751
|
resumeAsyncAgentBuilderActionHandler: () => resumeAsyncAgentBuilderActionHandler,
|
|
752
|
+
resumeStreamAgentBuilderActionHandler: () => resumeStreamAgentBuilderActionHandler,
|
|
749
753
|
sendAgentBuilderActionRunEventHandler: () => sendAgentBuilderActionRunEventHandler,
|
|
750
754
|
startAgentBuilderActionRunHandler: () => startAgentBuilderActionRunHandler,
|
|
751
755
|
startAsyncAgentBuilderActionHandler: () => startAsyncAgentBuilderActionHandler,
|
|
752
756
|
streamAgentBuilderActionHandler: () => streamAgentBuilderActionHandler,
|
|
757
|
+
streamLegacyAgentBuilderActionHandler: () => streamLegacyAgentBuilderActionHandler,
|
|
753
758
|
streamVNextAgentBuilderActionHandler: () => streamVNextAgentBuilderActionHandler,
|
|
754
759
|
watchAgentBuilderActionHandler: () => watchAgentBuilderActionHandler
|
|
755
760
|
});
|
|
@@ -2026,15 +2031,64 @@ var zodToJsonSchema = (schema, options) => {
|
|
|
2026
2031
|
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/index.js
|
|
2027
2032
|
var esm_default = zodToJsonSchema;
|
|
2028
2033
|
|
|
2029
|
-
// ../schema-compat/dist/chunk-
|
|
2034
|
+
// ../schema-compat/dist/chunk-U2HXWNAF.js
|
|
2035
|
+
var PATCHED = Symbol("__mastra_patched__");
|
|
2036
|
+
function patchRecordSchemas(schema) {
|
|
2037
|
+
if (!schema || typeof schema !== "object") return schema;
|
|
2038
|
+
if (schema[PATCHED]) return schema;
|
|
2039
|
+
schema[PATCHED] = true;
|
|
2040
|
+
const def = schema._zod?.def;
|
|
2041
|
+
if (def?.type === "record" && def.keyType && !def.valueType) {
|
|
2042
|
+
def.valueType = def.keyType;
|
|
2043
|
+
def.keyType = zod.z.string();
|
|
2044
|
+
}
|
|
2045
|
+
if (!def) return schema;
|
|
2046
|
+
if (def.type === "object" && def.shape) {
|
|
2047
|
+
const shape = typeof def.shape === "function" ? def.shape() : def.shape;
|
|
2048
|
+
for (const key of Object.keys(shape)) {
|
|
2049
|
+
patchRecordSchemas(shape[key]);
|
|
2050
|
+
}
|
|
2051
|
+
}
|
|
2052
|
+
if (def.type === "array" && def.element) {
|
|
2053
|
+
patchRecordSchemas(def.element);
|
|
2054
|
+
}
|
|
2055
|
+
if (def.type === "union" && def.options) {
|
|
2056
|
+
def.options.forEach(patchRecordSchemas);
|
|
2057
|
+
}
|
|
2058
|
+
if (def.type === "record") {
|
|
2059
|
+
if (def.keyType) patchRecordSchemas(def.keyType);
|
|
2060
|
+
if (def.valueType) patchRecordSchemas(def.valueType);
|
|
2061
|
+
}
|
|
2062
|
+
if (def.type === "intersection") {
|
|
2063
|
+
if (def.left) patchRecordSchemas(def.left);
|
|
2064
|
+
if (def.right) patchRecordSchemas(def.right);
|
|
2065
|
+
}
|
|
2066
|
+
if (def.type === "lazy") {
|
|
2067
|
+
if (def.getter && typeof def.getter === "function") {
|
|
2068
|
+
const originalGetter = def.getter;
|
|
2069
|
+
def.getter = function() {
|
|
2070
|
+
const innerSchema = originalGetter();
|
|
2071
|
+
if (innerSchema) {
|
|
2072
|
+
patchRecordSchemas(innerSchema);
|
|
2073
|
+
}
|
|
2074
|
+
return innerSchema;
|
|
2075
|
+
};
|
|
2076
|
+
}
|
|
2077
|
+
}
|
|
2078
|
+
if (def.innerType) {
|
|
2079
|
+
patchRecordSchemas(def.innerType);
|
|
2080
|
+
}
|
|
2081
|
+
return schema;
|
|
2082
|
+
}
|
|
2030
2083
|
function zodToJsonSchema2(zodSchema4, target = "jsonSchema7", strategy = "relative") {
|
|
2031
2084
|
const fn = "toJSONSchema";
|
|
2032
2085
|
if (fn in zod.z) {
|
|
2086
|
+
patchRecordSchemas(zodSchema4);
|
|
2033
2087
|
return zod.z[fn](zodSchema4, {
|
|
2034
2088
|
unrepresentable: "any",
|
|
2035
2089
|
override: (ctx) => {
|
|
2036
|
-
const def = ctx.zodSchema?._zod?.def;
|
|
2037
|
-
if (def && def.type === "date") {
|
|
2090
|
+
const def = ctx.zodSchema?._def || ctx.zodSchema?._zod?.def;
|
|
2091
|
+
if (def && (def.typeName === "ZodDate" || def.type === "date")) {
|
|
2038
2092
|
ctx.jsonSchema.type = "string";
|
|
2039
2093
|
ctx.jsonSchema.format = "date-time";
|
|
2040
2094
|
}
|
|
@@ -9871,6 +9925,16 @@ var ContainsHandler = class {
|
|
|
9871
9925
|
);
|
|
9872
9926
|
}
|
|
9873
9927
|
};
|
|
9928
|
+
var DefaultHandler = class {
|
|
9929
|
+
apply(zodSchema4, schema) {
|
|
9930
|
+
const { default: v } = schema;
|
|
9931
|
+
if (v === void 0) return zodSchema4;
|
|
9932
|
+
if (!zodSchema4.safeParse(v).success) {
|
|
9933
|
+
return zodSchema4;
|
|
9934
|
+
}
|
|
9935
|
+
return zodSchema4.default(v);
|
|
9936
|
+
}
|
|
9937
|
+
};
|
|
9874
9938
|
var primitiveHandlers = [
|
|
9875
9939
|
// Type constraints - should run first
|
|
9876
9940
|
new ConstHandler(),
|
|
@@ -9917,6 +9981,7 @@ var refinementHandlers = [
|
|
|
9917
9981
|
// Other refinements
|
|
9918
9982
|
new NotHandler(),
|
|
9919
9983
|
new UniqueItemsHandler(),
|
|
9984
|
+
new DefaultHandler(),
|
|
9920
9985
|
// Metadata last
|
|
9921
9986
|
new MetadataHandler()
|
|
9922
9987
|
];
|
|
@@ -10510,6 +10575,9 @@ var Memory = class extends memory.MastraMemory {
|
|
|
10510
10575
|
sortDirection
|
|
10511
10576
|
});
|
|
10512
10577
|
}
|
|
10578
|
+
async listThreadsByResourceId(args) {
|
|
10579
|
+
return this.storage.listThreadsByResourceId(args);
|
|
10580
|
+
}
|
|
10513
10581
|
async handleWorkingMemoryFromMetadata({
|
|
10514
10582
|
workingMemory,
|
|
10515
10583
|
resourceId,
|
|
@@ -11036,7 +11104,7 @@ ${template.content !== this.defaultWorkingMemoryTemplate ? `- Only store informa
|
|
|
11036
11104
|
const isMDWorkingMemory = !(`schema` in config.workingMemory) && (typeof config.workingMemory.template === `string` || config.workingMemory.template) && config.workingMemory;
|
|
11037
11105
|
return Boolean(isMDWorkingMemory && isMDWorkingMemory.version === `vnext`);
|
|
11038
11106
|
}
|
|
11039
|
-
|
|
11107
|
+
listTools(config) {
|
|
11040
11108
|
const mergedConfig = this.getMergedThreadConfig(config);
|
|
11041
11109
|
if (mergedConfig.workingMemory?.enabled) {
|
|
11042
11110
|
return {
|
|
@@ -12643,13 +12711,13 @@ function asSchema3(schema) {
|
|
|
12643
12711
|
}
|
|
12644
12712
|
var __defProp4 = Object.defineProperty;
|
|
12645
12713
|
var __export4 = (target, all) => {
|
|
12646
|
-
for (var
|
|
12647
|
-
__defProp4(target,
|
|
12714
|
+
for (var name163 in all)
|
|
12715
|
+
__defProp4(target, name163, { get: all[name163], enumerable: true });
|
|
12648
12716
|
};
|
|
12649
|
-
var
|
|
12650
|
-
var
|
|
12651
|
-
var
|
|
12652
|
-
var
|
|
12717
|
+
var name65 = "AI_NoObjectGeneratedError";
|
|
12718
|
+
var marker65 = `vercel.ai.error.${name65}`;
|
|
12719
|
+
var symbol65 = Symbol.for(marker65);
|
|
12720
|
+
var _a65;
|
|
12653
12721
|
var NoObjectGeneratedError3 = class extends AISDKError2 {
|
|
12654
12722
|
constructor({
|
|
12655
12723
|
message = "No object generated.",
|
|
@@ -12659,18 +12727,18 @@ var NoObjectGeneratedError3 = class extends AISDKError2 {
|
|
|
12659
12727
|
usage,
|
|
12660
12728
|
finishReason
|
|
12661
12729
|
}) {
|
|
12662
|
-
super({ name:
|
|
12663
|
-
this[
|
|
12730
|
+
super({ name: name65, message, cause });
|
|
12731
|
+
this[_a65] = true;
|
|
12664
12732
|
this.text = text22;
|
|
12665
12733
|
this.response = response;
|
|
12666
12734
|
this.usage = usage;
|
|
12667
12735
|
this.finishReason = finishReason;
|
|
12668
12736
|
}
|
|
12669
12737
|
static isInstance(error) {
|
|
12670
|
-
return AISDKError2.hasMarker(error,
|
|
12738
|
+
return AISDKError2.hasMarker(error, marker65);
|
|
12671
12739
|
}
|
|
12672
12740
|
};
|
|
12673
|
-
|
|
12741
|
+
_a65 = symbol65;
|
|
12674
12742
|
var dataContentSchema3 = z42.z.union([
|
|
12675
12743
|
z42.z.string(),
|
|
12676
12744
|
z42.z.instanceof(Uint8Array),
|
|
@@ -12678,8 +12746,8 @@ var dataContentSchema3 = z42.z.union([
|
|
|
12678
12746
|
z42.z.custom(
|
|
12679
12747
|
// Buffer might not be available in some environments such as CloudFlare:
|
|
12680
12748
|
(value) => {
|
|
12681
|
-
var
|
|
12682
|
-
return (_b8 = (
|
|
12749
|
+
var _a163, _b8;
|
|
12750
|
+
return (_b8 = (_a163 = globalThis.Buffer) == null ? void 0 : _a163.isBuffer(value)) != null ? _b8 : false;
|
|
12683
12751
|
},
|
|
12684
12752
|
{ message: "Must be a Buffer" }
|
|
12685
12753
|
)
|
|
@@ -13228,130 +13296,6 @@ var object3 = ({
|
|
|
13228
13296
|
}
|
|
13229
13297
|
};
|
|
13230
13298
|
};
|
|
13231
|
-
var ClientOrServerImplementationSchema3 = z42.z.looseObject({
|
|
13232
|
-
name: z42.z.string(),
|
|
13233
|
-
version: z42.z.string()
|
|
13234
|
-
});
|
|
13235
|
-
var BaseParamsSchema3 = z42.z.looseObject({
|
|
13236
|
-
_meta: z42.z.optional(z42.z.object({}).loose())
|
|
13237
|
-
});
|
|
13238
|
-
var ResultSchema3 = BaseParamsSchema3;
|
|
13239
|
-
var RequestSchema3 = z42.z.object({
|
|
13240
|
-
method: z42.z.string(),
|
|
13241
|
-
params: z42.z.optional(BaseParamsSchema3)
|
|
13242
|
-
});
|
|
13243
|
-
var ServerCapabilitiesSchema3 = z42.z.looseObject({
|
|
13244
|
-
experimental: z42.z.optional(z42.z.object({}).loose()),
|
|
13245
|
-
logging: z42.z.optional(z42.z.object({}).loose()),
|
|
13246
|
-
prompts: z42.z.optional(
|
|
13247
|
-
z42.z.looseObject({
|
|
13248
|
-
listChanged: z42.z.optional(z42.z.boolean())
|
|
13249
|
-
})
|
|
13250
|
-
),
|
|
13251
|
-
resources: z42.z.optional(
|
|
13252
|
-
z42.z.looseObject({
|
|
13253
|
-
subscribe: z42.z.optional(z42.z.boolean()),
|
|
13254
|
-
listChanged: z42.z.optional(z42.z.boolean())
|
|
13255
|
-
})
|
|
13256
|
-
),
|
|
13257
|
-
tools: z42.z.optional(
|
|
13258
|
-
z42.z.looseObject({
|
|
13259
|
-
listChanged: z42.z.optional(z42.z.boolean())
|
|
13260
|
-
})
|
|
13261
|
-
)
|
|
13262
|
-
});
|
|
13263
|
-
ResultSchema3.extend({
|
|
13264
|
-
protocolVersion: z42.z.string(),
|
|
13265
|
-
capabilities: ServerCapabilitiesSchema3,
|
|
13266
|
-
serverInfo: ClientOrServerImplementationSchema3,
|
|
13267
|
-
instructions: z42.z.optional(z42.z.string())
|
|
13268
|
-
});
|
|
13269
|
-
var PaginatedResultSchema3 = ResultSchema3.extend({
|
|
13270
|
-
nextCursor: z42.z.optional(z42.z.string())
|
|
13271
|
-
});
|
|
13272
|
-
var ToolSchema3 = z42.z.object({
|
|
13273
|
-
name: z42.z.string(),
|
|
13274
|
-
description: z42.z.optional(z42.z.string()),
|
|
13275
|
-
inputSchema: z42.z.object({
|
|
13276
|
-
type: z42.z.literal("object"),
|
|
13277
|
-
properties: z42.z.optional(z42.z.object({}).loose())
|
|
13278
|
-
}).loose()
|
|
13279
|
-
}).loose();
|
|
13280
|
-
PaginatedResultSchema3.extend({
|
|
13281
|
-
tools: z42.z.array(ToolSchema3)
|
|
13282
|
-
});
|
|
13283
|
-
var TextContentSchema3 = z42.z.object({
|
|
13284
|
-
type: z42.z.literal("text"),
|
|
13285
|
-
text: z42.z.string()
|
|
13286
|
-
}).loose();
|
|
13287
|
-
var ImageContentSchema3 = z42.z.object({
|
|
13288
|
-
type: z42.z.literal("image"),
|
|
13289
|
-
data: z42.z.base64(),
|
|
13290
|
-
mimeType: z42.z.string()
|
|
13291
|
-
}).loose();
|
|
13292
|
-
var ResourceContentsSchema3 = z42.z.object({
|
|
13293
|
-
/**
|
|
13294
|
-
* The URI of this resource.
|
|
13295
|
-
*/
|
|
13296
|
-
uri: z42.z.string(),
|
|
13297
|
-
/**
|
|
13298
|
-
* The MIME type of this resource, if known.
|
|
13299
|
-
*/
|
|
13300
|
-
mimeType: z42.z.optional(z42.z.string())
|
|
13301
|
-
}).loose();
|
|
13302
|
-
var TextResourceContentsSchema3 = ResourceContentsSchema3.extend({
|
|
13303
|
-
text: z42.z.string()
|
|
13304
|
-
});
|
|
13305
|
-
var BlobResourceContentsSchema3 = ResourceContentsSchema3.extend({
|
|
13306
|
-
blob: z42.z.base64()
|
|
13307
|
-
});
|
|
13308
|
-
var EmbeddedResourceSchema3 = z42.z.object({
|
|
13309
|
-
type: z42.z.literal("resource"),
|
|
13310
|
-
resource: z42.z.union([TextResourceContentsSchema3, BlobResourceContentsSchema3])
|
|
13311
|
-
}).loose();
|
|
13312
|
-
ResultSchema3.extend({
|
|
13313
|
-
content: z42.z.array(
|
|
13314
|
-
z42.z.union([TextContentSchema3, ImageContentSchema3, EmbeddedResourceSchema3])
|
|
13315
|
-
),
|
|
13316
|
-
isError: z42.z.boolean().default(false).optional()
|
|
13317
|
-
}).or(
|
|
13318
|
-
ResultSchema3.extend({
|
|
13319
|
-
toolResult: z42.z.unknown()
|
|
13320
|
-
})
|
|
13321
|
-
);
|
|
13322
|
-
var JSONRPC_VERSION3 = "2.0";
|
|
13323
|
-
var JSONRPCRequestSchema3 = z42.z.object({
|
|
13324
|
-
jsonrpc: z42.z.literal(JSONRPC_VERSION3),
|
|
13325
|
-
id: z42.z.union([z42.z.string(), z42.z.number().int()])
|
|
13326
|
-
}).merge(RequestSchema3).strict();
|
|
13327
|
-
var JSONRPCResponseSchema3 = z42.z.object({
|
|
13328
|
-
jsonrpc: z42.z.literal(JSONRPC_VERSION3),
|
|
13329
|
-
id: z42.z.union([z42.z.string(), z42.z.number().int()]),
|
|
13330
|
-
result: ResultSchema3
|
|
13331
|
-
}).strict();
|
|
13332
|
-
var JSONRPCErrorSchema3 = z42.z.object({
|
|
13333
|
-
jsonrpc: z42.z.literal(JSONRPC_VERSION3),
|
|
13334
|
-
id: z42.z.union([z42.z.string(), z42.z.number().int()]),
|
|
13335
|
-
error: z42.z.object({
|
|
13336
|
-
code: z42.z.number().int(),
|
|
13337
|
-
message: z42.z.string(),
|
|
13338
|
-
data: z42.z.optional(z42.z.unknown())
|
|
13339
|
-
})
|
|
13340
|
-
}).strict();
|
|
13341
|
-
var JSONRPCNotificationSchema3 = z42.z.object({
|
|
13342
|
-
jsonrpc: z42.z.literal(JSONRPC_VERSION3)
|
|
13343
|
-
}).merge(
|
|
13344
|
-
z42.z.object({
|
|
13345
|
-
method: z42.z.string(),
|
|
13346
|
-
params: z42.z.optional(BaseParamsSchema3)
|
|
13347
|
-
})
|
|
13348
|
-
).strict();
|
|
13349
|
-
z42.z.union([
|
|
13350
|
-
JSONRPCRequestSchema3,
|
|
13351
|
-
JSONRPCNotificationSchema3,
|
|
13352
|
-
JSONRPCResponseSchema3,
|
|
13353
|
-
JSONRPCErrorSchema3
|
|
13354
|
-
]);
|
|
13355
13299
|
|
|
13356
13300
|
// ../agent-builder/dist/index.js
|
|
13357
13301
|
var UNIT_KINDS = ["mcp-server", "tool", "workflow", "agent", "integration", "network", "other"];
|
|
@@ -13818,11 +13762,11 @@ async function renameAndCopyFile(sourceFile, targetFile) {
|
|
|
13818
13762
|
var isValidMastraLanguageModel = (model) => {
|
|
13819
13763
|
return model && typeof model === "object" && typeof model.modelId === "string";
|
|
13820
13764
|
};
|
|
13821
|
-
var resolveTargetPath = (inputData,
|
|
13765
|
+
var resolveTargetPath = (inputData, requestContext) => {
|
|
13822
13766
|
if (inputData.targetPath) {
|
|
13823
13767
|
return inputData.targetPath;
|
|
13824
13768
|
}
|
|
13825
|
-
const contextPath =
|
|
13769
|
+
const contextPath = requestContext.get("targetPath");
|
|
13826
13770
|
if (contextPath) {
|
|
13827
13771
|
return contextPath;
|
|
13828
13772
|
}
|
|
@@ -13991,13 +13935,13 @@ var createModelInstance = async (provider, modelId, version = "v2") => {
|
|
|
13991
13935
|
}
|
|
13992
13936
|
};
|
|
13993
13937
|
var resolveModel = async ({
|
|
13994
|
-
|
|
13938
|
+
requestContext,
|
|
13995
13939
|
defaultModel = "openai/gpt-4.1",
|
|
13996
13940
|
projectPath
|
|
13997
13941
|
}) => {
|
|
13998
|
-
const modelFromContext =
|
|
13942
|
+
const modelFromContext = requestContext.get("model");
|
|
13999
13943
|
if (modelFromContext) {
|
|
14000
|
-
console.info("Using model from
|
|
13944
|
+
console.info("Using model from request context");
|
|
14001
13945
|
if (isValidMastraLanguageModel(modelFromContext)) {
|
|
14002
13946
|
return modelFromContext;
|
|
14003
13947
|
}
|
|
@@ -14005,13 +13949,13 @@ var resolveModel = async ({
|
|
|
14005
13949
|
'Invalid model provided. Model must be a MastraLanguageModel instance (e.g., openai("gpt-4"), anthropic("claude-3-5-sonnet"), etc.)'
|
|
14006
13950
|
);
|
|
14007
13951
|
}
|
|
14008
|
-
const selectedModel =
|
|
13952
|
+
const selectedModel = requestContext.get("selectedModel");
|
|
14009
13953
|
if (selectedModel?.provider && selectedModel?.modelId && projectPath) {
|
|
14010
13954
|
console.info(`Resolving selected model: ${selectedModel.provider}/${selectedModel.modelId}`);
|
|
14011
13955
|
const version = await detectAISDKVersion(projectPath);
|
|
14012
13956
|
const modelInstance = await createModelInstance(selectedModel.provider, selectedModel.modelId, version);
|
|
14013
13957
|
if (modelInstance) {
|
|
14014
|
-
|
|
13958
|
+
requestContext.set("model", modelInstance);
|
|
14015
13959
|
return modelInstance;
|
|
14016
13960
|
}
|
|
14017
13961
|
}
|
|
@@ -15022,7 +14966,7 @@ export const mastra = new Mastra({
|
|
|
15022
14966
|
/**
|
|
15023
14967
|
* Get tools for a specific mode
|
|
15024
14968
|
*/
|
|
15025
|
-
static async
|
|
14969
|
+
static async listToolsForMode(projectPath, mode = "code-editor") {
|
|
15026
14970
|
const allTools = await _AgentBuilderDefaults.DEFAULT_TOOLS(projectPath);
|
|
15027
14971
|
if (mode === "template") {
|
|
15028
14972
|
return _AgentBuilderDefaults.filterToolsForTemplateBuilder(allTools);
|
|
@@ -16503,7 +16447,7 @@ ${config.instructions}` : "";
|
|
|
16503
16447
|
model: config.model,
|
|
16504
16448
|
tools: async () => {
|
|
16505
16449
|
return {
|
|
16506
|
-
...await AgentBuilderDefaults.
|
|
16450
|
+
...await AgentBuilderDefaults.listToolsForMode(config.projectPath, config.mode),
|
|
16507
16451
|
...config.tools || {}
|
|
16508
16452
|
};
|
|
16509
16453
|
},
|
|
@@ -16527,7 +16471,7 @@ ${config.instructions}` : "";
|
|
|
16527
16471
|
*/
|
|
16528
16472
|
generateLegacy = async (messages, generateOptions = {}) => {
|
|
16529
16473
|
const { maxSteps, ...baseOptions } = generateOptions;
|
|
16530
|
-
const originalInstructions = await this.getInstructions({
|
|
16474
|
+
const originalInstructions = await this.getInstructions({ requestContext: generateOptions?.requestContext });
|
|
16531
16475
|
const additionalInstructions = baseOptions.instructions;
|
|
16532
16476
|
let enhancedInstructions = originalInstructions;
|
|
16533
16477
|
if (additionalInstructions) {
|
|
@@ -16556,7 +16500,7 @@ ${additionalInstructions}`;
|
|
|
16556
16500
|
*/
|
|
16557
16501
|
streamLegacy = async (messages, streamOptions = {}) => {
|
|
16558
16502
|
const { maxSteps, ...baseOptions } = streamOptions;
|
|
16559
|
-
const originalInstructions = await this.getInstructions({
|
|
16503
|
+
const originalInstructions = await this.getInstructions({ requestContext: streamOptions?.requestContext });
|
|
16560
16504
|
const additionalInstructions = baseOptions.instructions;
|
|
16561
16505
|
let enhancedInstructions = originalInstructions;
|
|
16562
16506
|
if (additionalInstructions) {
|
|
@@ -16585,7 +16529,7 @@ ${additionalInstructions}`;
|
|
|
16585
16529
|
*/
|
|
16586
16530
|
async stream(messages, streamOptions) {
|
|
16587
16531
|
const { ...baseOptions } = streamOptions || {};
|
|
16588
|
-
const originalInstructions = await this.getInstructions({
|
|
16532
|
+
const originalInstructions = await this.getInstructions({ requestContext: streamOptions?.requestContext });
|
|
16589
16533
|
const additionalInstructions = baseOptions.instructions;
|
|
16590
16534
|
let enhancedInstructions = originalInstructions;
|
|
16591
16535
|
if (additionalInstructions) {
|
|
@@ -16609,7 +16553,7 @@ ${additionalInstructions}`;
|
|
|
16609
16553
|
}
|
|
16610
16554
|
async generate(messages, options) {
|
|
16611
16555
|
const { ...baseOptions } = options || {};
|
|
16612
|
-
const originalInstructions = await this.getInstructions({
|
|
16556
|
+
const originalInstructions = await this.getInstructions({ requestContext: options?.requestContext });
|
|
16613
16557
|
const additionalInstructions = baseOptions.instructions;
|
|
16614
16558
|
let enhancedInstructions = originalInstructions;
|
|
16615
16559
|
if (additionalInstructions) {
|
|
@@ -16717,12 +16661,12 @@ var discoverUnitsStep = workflows.createStep({
|
|
|
16717
16661
|
description: "Discover template units by analyzing the templates directory structure",
|
|
16718
16662
|
inputSchema: CloneTemplateResultSchema,
|
|
16719
16663
|
outputSchema: DiscoveryResultSchema,
|
|
16720
|
-
execute: async ({ inputData,
|
|
16664
|
+
execute: async ({ inputData, requestContext }) => {
|
|
16721
16665
|
const { templateDir } = inputData;
|
|
16722
|
-
const targetPath = resolveTargetPath(inputData,
|
|
16666
|
+
const targetPath = resolveTargetPath(inputData, requestContext);
|
|
16723
16667
|
const tools = await AgentBuilderDefaults.DEFAULT_TOOLS(templateDir);
|
|
16724
16668
|
console.info("targetPath", targetPath);
|
|
16725
|
-
const model = await resolveModel({
|
|
16669
|
+
const model = await resolveModel({ requestContext, projectPath: targetPath, defaultModel: chunk2PLXW4ZX_cjs.openai("gpt-4.1") });
|
|
16726
16670
|
try {
|
|
16727
16671
|
const agent$1 = new agent.Agent({
|
|
16728
16672
|
model,
|
|
@@ -16861,8 +16805,8 @@ var prepareBranchStep = workflows.createStep({
|
|
|
16861
16805
|
description: "Create or switch to integration branch before modifications",
|
|
16862
16806
|
inputSchema: PrepareBranchInputSchema,
|
|
16863
16807
|
outputSchema: PrepareBranchResultSchema,
|
|
16864
|
-
execute: async ({ inputData,
|
|
16865
|
-
const targetPath = resolveTargetPath(inputData,
|
|
16808
|
+
execute: async ({ inputData, requestContext }) => {
|
|
16809
|
+
const targetPath = resolveTargetPath(inputData, requestContext);
|
|
16866
16810
|
try {
|
|
16867
16811
|
const branchName = `feat/install-template-${inputData.slug}`;
|
|
16868
16812
|
await gitCheckoutBranch(branchName, targetPath);
|
|
@@ -16886,10 +16830,10 @@ var packageMergeStep = workflows.createStep({
|
|
|
16886
16830
|
description: "Merge template package.json dependencies into target project",
|
|
16887
16831
|
inputSchema: PackageMergeInputSchema,
|
|
16888
16832
|
outputSchema: PackageMergeResultSchema,
|
|
16889
|
-
execute: async ({ inputData,
|
|
16833
|
+
execute: async ({ inputData, requestContext }) => {
|
|
16890
16834
|
console.info("Package merge step starting...");
|
|
16891
16835
|
const { slug, packageInfo } = inputData;
|
|
16892
|
-
const targetPath = resolveTargetPath(inputData,
|
|
16836
|
+
const targetPath = resolveTargetPath(inputData, requestContext);
|
|
16893
16837
|
try {
|
|
16894
16838
|
const targetPkgPath = path.join(targetPath, "package.json");
|
|
16895
16839
|
let targetPkgRaw = "{}";
|
|
@@ -16963,9 +16907,9 @@ var installStep = workflows.createStep({
|
|
|
16963
16907
|
description: "Install packages based on merged package.json",
|
|
16964
16908
|
inputSchema: InstallInputSchema,
|
|
16965
16909
|
outputSchema: InstallResultSchema,
|
|
16966
|
-
execute: async ({ inputData,
|
|
16910
|
+
execute: async ({ inputData, requestContext }) => {
|
|
16967
16911
|
console.info("Running install step...");
|
|
16968
|
-
const targetPath = resolveTargetPath(inputData,
|
|
16912
|
+
const targetPath = resolveTargetPath(inputData, requestContext);
|
|
16969
16913
|
try {
|
|
16970
16914
|
await spawnSWPM(targetPath, "install", []);
|
|
16971
16915
|
const lock = ["pnpm-lock.yaml", "package-lock.json", "yarn.lock"].map((f) => path.join(targetPath, f)).find((f) => fs.existsSync(f));
|
|
@@ -16991,10 +16935,10 @@ var programmaticFileCopyStep = workflows.createStep({
|
|
|
16991
16935
|
description: "Programmatically copy template files to target project based on ordered units",
|
|
16992
16936
|
inputSchema: FileCopyInputSchema,
|
|
16993
16937
|
outputSchema: FileCopyResultSchema,
|
|
16994
|
-
execute: async ({ inputData,
|
|
16938
|
+
execute: async ({ inputData, requestContext }) => {
|
|
16995
16939
|
console.info("Programmatic file copy step starting...");
|
|
16996
16940
|
const { orderedUnits, templateDir, commitSha, slug } = inputData;
|
|
16997
|
-
const targetPath = resolveTargetPath(inputData,
|
|
16941
|
+
const targetPath = resolveTargetPath(inputData, requestContext);
|
|
16998
16942
|
try {
|
|
16999
16943
|
const copiedFiles = [];
|
|
17000
16944
|
const conflicts = [];
|
|
@@ -17343,12 +17287,12 @@ var intelligentMergeStep = workflows.createStep({
|
|
|
17343
17287
|
description: "Use AgentBuilder to intelligently merge template files",
|
|
17344
17288
|
inputSchema: IntelligentMergeInputSchema,
|
|
17345
17289
|
outputSchema: IntelligentMergeResultSchema,
|
|
17346
|
-
execute: async ({ inputData,
|
|
17290
|
+
execute: async ({ inputData, requestContext }) => {
|
|
17347
17291
|
console.info("Intelligent merge step starting...");
|
|
17348
17292
|
const { conflicts, copiedFiles, commitSha, slug, templateDir, branchName } = inputData;
|
|
17349
|
-
const targetPath = resolveTargetPath(inputData,
|
|
17293
|
+
const targetPath = resolveTargetPath(inputData, requestContext);
|
|
17350
17294
|
try {
|
|
17351
|
-
const model = await resolveModel({
|
|
17295
|
+
const model = await resolveModel({ requestContext, projectPath: targetPath, defaultModel: chunk2PLXW4ZX_cjs.openai("gpt-4.1") });
|
|
17352
17296
|
const copyFileTool = tools.createTool({
|
|
17353
17297
|
id: "copy-file",
|
|
17354
17298
|
description: "Copy a file from template to target project (use only for edge cases - most files are already copied programmatically).",
|
|
@@ -17611,10 +17555,10 @@ var validationAndFixStep = workflows.createStep({
|
|
|
17611
17555
|
description: "Validate the merged template code and fix any issues using a specialized agent",
|
|
17612
17556
|
inputSchema: ValidationFixInputSchema,
|
|
17613
17557
|
outputSchema: ValidationFixResultSchema,
|
|
17614
|
-
execute: async ({ inputData,
|
|
17558
|
+
execute: async ({ inputData, requestContext }) => {
|
|
17615
17559
|
console.info("Validation and fix step starting...");
|
|
17616
17560
|
const { commitSha, slug, orderedUnits, templateDir, copiedFiles, conflictsResolved, maxIterations = 5 } = inputData;
|
|
17617
|
-
const targetPath = resolveTargetPath(inputData,
|
|
17561
|
+
const targetPath = resolveTargetPath(inputData, requestContext);
|
|
17618
17562
|
const hasChanges = copiedFiles.length > 0 || conflictsResolved && conflictsResolved.length > 0;
|
|
17619
17563
|
if (!hasChanges) {
|
|
17620
17564
|
console.info("\u23ED\uFE0F Skipping validation - no files copied or conflicts resolved");
|
|
@@ -17634,8 +17578,8 @@ var validationAndFixStep = workflows.createStep({
|
|
|
17634
17578
|
);
|
|
17635
17579
|
let currentIteration = 1;
|
|
17636
17580
|
try {
|
|
17637
|
-
const model = await resolveModel({
|
|
17638
|
-
const allTools = await AgentBuilderDefaults.
|
|
17581
|
+
const model = await resolveModel({ requestContext, projectPath: targetPath, defaultModel: chunk2PLXW4ZX_cjs.openai("gpt-4.1") });
|
|
17582
|
+
const allTools = await AgentBuilderDefaults.listToolsForMode(targetPath, "template");
|
|
17639
17583
|
const validationAgent = new agent.Agent({
|
|
17640
17584
|
name: "code-validator-fixer",
|
|
17641
17585
|
description: "Specialized agent for validating and fixing template integration issues",
|
|
@@ -18330,7 +18274,7 @@ var planningIterationStep = workflows.createStep({
|
|
|
18330
18274
|
outputSchema: PlanningIterationResultSchema,
|
|
18331
18275
|
suspendSchema: PlanningIterationSuspendSchema,
|
|
18332
18276
|
resumeSchema: PlanningIterationResumeSchema,
|
|
18333
|
-
execute: async ({ inputData, resumeData, suspend,
|
|
18277
|
+
execute: async ({ inputData, resumeData, suspend, requestContext }) => {
|
|
18334
18278
|
const {
|
|
18335
18279
|
action,
|
|
18336
18280
|
workflowName,
|
|
@@ -18343,7 +18287,7 @@ var planningIterationStep = workflows.createStep({
|
|
|
18343
18287
|
} = inputData;
|
|
18344
18288
|
console.info("Starting planning iteration...");
|
|
18345
18289
|
const qaKey = "workflow-builder-qa";
|
|
18346
|
-
let storedQAPairs =
|
|
18290
|
+
let storedQAPairs = requestContext.get(qaKey) || [];
|
|
18347
18291
|
const newAnswers = { ...userAnswers || {}, ...resumeData?.answers || {} };
|
|
18348
18292
|
if (Object.keys(newAnswers).length > 0) {
|
|
18349
18293
|
storedQAPairs = storedQAPairs.map((pair) => {
|
|
@@ -18356,10 +18300,10 @@ var planningIterationStep = workflows.createStep({
|
|
|
18356
18300
|
}
|
|
18357
18301
|
return pair;
|
|
18358
18302
|
});
|
|
18359
|
-
|
|
18303
|
+
requestContext.set(qaKey, storedQAPairs);
|
|
18360
18304
|
}
|
|
18361
18305
|
try {
|
|
18362
|
-
const model = await resolveModel({
|
|
18306
|
+
const model = await resolveModel({ requestContext });
|
|
18363
18307
|
const planningAgent = new agent.Agent({
|
|
18364
18308
|
model,
|
|
18365
18309
|
instructions: taskPlanningPrompts.planningAgent.instructions({
|
|
@@ -18416,7 +18360,7 @@ var planningIterationStep = workflows.createStep({
|
|
|
18416
18360
|
answeredAt: null
|
|
18417
18361
|
}));
|
|
18418
18362
|
storedQAPairs = [...storedQAPairs, ...newQAPairs];
|
|
18419
|
-
|
|
18363
|
+
requestContext.set(qaKey, storedQAPairs);
|
|
18420
18364
|
console.info(
|
|
18421
18365
|
`Updated Q&A state: ${storedQAPairs.length} total question-answer pairs, ${storedQAPairs.filter((p) => p.answer).length} answered`
|
|
18422
18366
|
);
|
|
@@ -18430,7 +18374,7 @@ var planningIterationStep = workflows.createStep({
|
|
|
18430
18374
|
});
|
|
18431
18375
|
}
|
|
18432
18376
|
console.info(`Planning complete with ${planResult.tasks.length} tasks`);
|
|
18433
|
-
|
|
18377
|
+
requestContext.set(qaKey, storedQAPairs);
|
|
18434
18378
|
console.info(
|
|
18435
18379
|
`Final Q&A state: ${storedQAPairs.length} total question-answer pairs, ${storedQAPairs.filter((p) => p.answer).length} answered`
|
|
18436
18380
|
);
|
|
@@ -18573,7 +18517,7 @@ const myStep = createStep({
|
|
|
18573
18517
|
- \`mastra\`: Access to Mastra instance (agents, tools, other workflows)
|
|
18574
18518
|
- \`getStepResult(stepInstance)\`: Get results from previous steps
|
|
18575
18519
|
- \`getInitData()\`: Access original workflow input data
|
|
18576
|
-
- \`
|
|
18520
|
+
- \`requestContext\`: Runtime dependency injection context
|
|
18577
18521
|
- \`runCount\`: Number of times this step has run (useful for retries)
|
|
18578
18522
|
|
|
18579
18523
|
### **\u{1F504} CONTROL FLOW METHODS**
|
|
@@ -18652,10 +18596,10 @@ const toolStep = createStep(myTool);
|
|
|
18652
18596
|
|
|
18653
18597
|
// Method 2: Call tool in execute function
|
|
18654
18598
|
const step = createStep({
|
|
18655
|
-
execute: async ({ inputData,
|
|
18599
|
+
execute: async ({ inputData, requestContext }) => {
|
|
18656
18600
|
const result = await myTool.execute({
|
|
18657
18601
|
context: inputData,
|
|
18658
|
-
|
|
18602
|
+
requestContext
|
|
18659
18603
|
});
|
|
18660
18604
|
return result;
|
|
18661
18605
|
}
|
|
@@ -18771,7 +18715,7 @@ run.watch((event) => console.log(event));
|
|
|
18771
18715
|
- Use workflows as steps: \`.then(otherWorkflow)\`
|
|
18772
18716
|
- Enable complex workflow composition
|
|
18773
18717
|
|
|
18774
|
-
**
|
|
18718
|
+
**Request Context:**
|
|
18775
18719
|
- Pass shared data across all steps
|
|
18776
18720
|
- Enable dependency injection patterns
|
|
18777
18721
|
|
|
@@ -18961,7 +18905,7 @@ var workflowDiscoveryStep = workflows.createStep({
|
|
|
18961
18905
|
description: "Discover existing workflows in the project",
|
|
18962
18906
|
inputSchema: WorkflowBuilderInputSchema,
|
|
18963
18907
|
outputSchema: WorkflowDiscoveryResultSchema,
|
|
18964
|
-
execute: async ({ inputData,
|
|
18908
|
+
execute: async ({ inputData, requestContext: _requestContext }) => {
|
|
18965
18909
|
console.info("Starting workflow discovery...");
|
|
18966
18910
|
const { projectPath = process.cwd() } = inputData;
|
|
18967
18911
|
try {
|
|
@@ -19020,7 +18964,7 @@ var projectDiscoveryStep = workflows.createStep({
|
|
|
19020
18964
|
description: "Analyze the project structure and setup",
|
|
19021
18965
|
inputSchema: WorkflowDiscoveryResultSchema,
|
|
19022
18966
|
outputSchema: ProjectDiscoveryResultSchema,
|
|
19023
|
-
execute: async ({ inputData: _inputData,
|
|
18967
|
+
execute: async ({ inputData: _inputData, requestContext: _requestContext }) => {
|
|
19024
18968
|
console.info("Starting project discovery...");
|
|
19025
18969
|
try {
|
|
19026
18970
|
const projectPath = process.cwd();
|
|
@@ -19082,10 +19026,10 @@ var workflowResearchStep = workflows.createStep({
|
|
|
19082
19026
|
description: "Research Mastra workflows and gather relevant documentation",
|
|
19083
19027
|
inputSchema: ProjectDiscoveryResultSchema,
|
|
19084
19028
|
outputSchema: WorkflowResearchResultSchema,
|
|
19085
|
-
execute: async ({ inputData,
|
|
19029
|
+
execute: async ({ inputData, requestContext }) => {
|
|
19086
19030
|
console.info("Starting workflow research...");
|
|
19087
19031
|
try {
|
|
19088
|
-
const model = await resolveModel({
|
|
19032
|
+
const model = await resolveModel({ requestContext });
|
|
19089
19033
|
const researchAgent = new agent.Agent({
|
|
19090
19034
|
model,
|
|
19091
19035
|
instructions: workflowBuilderPrompts.researchAgent.instructions,
|
|
@@ -19151,7 +19095,7 @@ var taskExecutionStep = workflows.createStep({
|
|
|
19151
19095
|
outputSchema: TaskExecutionResultSchema,
|
|
19152
19096
|
suspendSchema: TaskExecutionSuspendSchema,
|
|
19153
19097
|
resumeSchema: TaskExecutionResumeSchema,
|
|
19154
|
-
execute: async ({ inputData, resumeData, suspend,
|
|
19098
|
+
execute: async ({ inputData, resumeData, suspend, requestContext }) => {
|
|
19155
19099
|
const {
|
|
19156
19100
|
action,
|
|
19157
19101
|
workflowName,
|
|
@@ -19164,7 +19108,7 @@ var taskExecutionStep = workflows.createStep({
|
|
|
19164
19108
|
console.info(`Starting task execution for ${action}ing workflow: ${workflowName}`);
|
|
19165
19109
|
console.info(`Executing ${tasks.length} tasks using AgentBuilder stream...`);
|
|
19166
19110
|
try {
|
|
19167
|
-
const model = await resolveModel({
|
|
19111
|
+
const model = await resolveModel({ requestContext });
|
|
19168
19112
|
const currentProjectPath = projectPath || process.cwd();
|
|
19169
19113
|
console.info("Pre-populating taskManager with planned tasks...");
|
|
19170
19114
|
const taskManagerContext = {
|
|
@@ -19209,18 +19153,11 @@ ${workflowBuilderPrompts.validation.instructions}`
|
|
|
19209
19153
|
tasks,
|
|
19210
19154
|
resumeData
|
|
19211
19155
|
});
|
|
19212
|
-
const originalInstructions = await executionAgent.getInstructions({
|
|
19213
|
-
const additionalInstructions = executionAgent.instructions;
|
|
19214
|
-
let enhancedInstructions = originalInstructions;
|
|
19215
|
-
if (additionalInstructions) {
|
|
19216
|
-
enhancedInstructions = `${originalInstructions}
|
|
19217
|
-
|
|
19218
|
-
${additionalInstructions}`;
|
|
19219
|
-
}
|
|
19156
|
+
const originalInstructions = await executionAgent.getInstructions({ requestContext });
|
|
19220
19157
|
const enhancedOptions = {
|
|
19221
19158
|
stopWhen: stepCountIs(100),
|
|
19222
19159
|
temperature: 0.3,
|
|
19223
|
-
instructions:
|
|
19160
|
+
instructions: originalInstructions
|
|
19224
19161
|
};
|
|
19225
19162
|
let finalResult = null;
|
|
19226
19163
|
let allTasksCompleted = false;
|
|
@@ -19422,8 +19359,8 @@ function createAgentBuilderWorkflowHandler(workflowHandlerFn, logMessage) {
|
|
|
19422
19359
|
const mastra = actionArgs.mastra;
|
|
19423
19360
|
const logger = mastra.getLogger();
|
|
19424
19361
|
try {
|
|
19425
|
-
|
|
19426
|
-
if (actionId && !
|
|
19362
|
+
chunkYNGDJJOH_cjs.WorkflowRegistry.registerTemporaryWorkflows(agentBuilderWorkflows, mastra);
|
|
19363
|
+
if (actionId && !chunkYNGDJJOH_cjs.WorkflowRegistry.isAgentBuilderWorkflow(actionId)) {
|
|
19427
19364
|
throw new chunk7NADHFD2_cjs.HTTPException(400, {
|
|
19428
19365
|
message: `Invalid agent-builder action: ${actionId}. Valid actions are: ${Object.keys(agentBuilderWorkflows).join(", ")}`
|
|
19429
19366
|
});
|
|
@@ -19438,7 +19375,7 @@ function createAgentBuilderWorkflowHandler(workflowHandlerFn, logMessage) {
|
|
|
19438
19375
|
const result = await workflowHandlerFn(handlerArgs);
|
|
19439
19376
|
return result;
|
|
19440
19377
|
} finally {
|
|
19441
|
-
|
|
19378
|
+
chunkYNGDJJOH_cjs.WorkflowRegistry.cleanup();
|
|
19442
19379
|
}
|
|
19443
19380
|
} catch (error) {
|
|
19444
19381
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
@@ -19452,10 +19389,10 @@ function createAgentBuilderWorkflowHandler(workflowHandlerFn, logMessage) {
|
|
|
19452
19389
|
}
|
|
19453
19390
|
var getAgentBuilderActionsHandler = createAgentBuilderWorkflowHandler(async () => {
|
|
19454
19391
|
try {
|
|
19455
|
-
const registryWorkflows =
|
|
19392
|
+
const registryWorkflows = chunkYNGDJJOH_cjs.WorkflowRegistry.getAllWorkflows();
|
|
19456
19393
|
const _workflows = Object.entries(registryWorkflows).reduce(
|
|
19457
19394
|
(acc, [key, workflow]) => {
|
|
19458
|
-
acc[key] =
|
|
19395
|
+
acc[key] = chunkYNGDJJOH_cjs.getWorkflowInfo(workflow);
|
|
19459
19396
|
return acc;
|
|
19460
19397
|
},
|
|
19461
19398
|
{}
|
|
@@ -19466,59 +19403,79 @@ var getAgentBuilderActionsHandler = createAgentBuilderWorkflowHandler(async () =
|
|
|
19466
19403
|
}
|
|
19467
19404
|
}, "Getting agent builder actions");
|
|
19468
19405
|
var getAgentBuilderActionByIdHandler = createAgentBuilderWorkflowHandler(
|
|
19469
|
-
|
|
19406
|
+
chunkPUYDRTPG_cjs.getWorkflowByIdHandler,
|
|
19470
19407
|
"Getting agent builder action by ID"
|
|
19471
19408
|
);
|
|
19472
19409
|
var getAgentBuilderActionRunByIdHandler = createAgentBuilderWorkflowHandler(
|
|
19473
|
-
|
|
19410
|
+
chunkPUYDRTPG_cjs.getWorkflowRunByIdHandler,
|
|
19474
19411
|
"Getting agent builder action run by ID"
|
|
19475
19412
|
);
|
|
19476
19413
|
var getAgentBuilderActionRunExecutionResultHandler = createAgentBuilderWorkflowHandler(
|
|
19477
|
-
|
|
19414
|
+
chunkPUYDRTPG_cjs.getWorkflowRunExecutionResultHandler,
|
|
19478
19415
|
"Getting agent builder action run execution result"
|
|
19479
19416
|
);
|
|
19480
19417
|
var createAgentBuilderActionRunHandler = createAgentBuilderWorkflowHandler(
|
|
19481
|
-
|
|
19418
|
+
chunkPUYDRTPG_cjs.createWorkflowRunHandler,
|
|
19482
19419
|
"Creating agent builder action run"
|
|
19483
19420
|
);
|
|
19484
19421
|
var startAsyncAgentBuilderActionHandler = createAgentBuilderWorkflowHandler(
|
|
19485
|
-
|
|
19422
|
+
chunkPUYDRTPG_cjs.startAsyncWorkflowHandler,
|
|
19486
19423
|
"Starting async agent builder action"
|
|
19487
19424
|
);
|
|
19488
19425
|
var startAgentBuilderActionRunHandler = createAgentBuilderWorkflowHandler(
|
|
19489
|
-
|
|
19426
|
+
chunkPUYDRTPG_cjs.startWorkflowRunHandler,
|
|
19490
19427
|
"Starting agent builder action run"
|
|
19491
19428
|
);
|
|
19492
19429
|
var watchAgentBuilderActionHandler = createAgentBuilderWorkflowHandler(
|
|
19493
|
-
|
|
19430
|
+
chunkPUYDRTPG_cjs.watchWorkflowHandler,
|
|
19494
19431
|
"Watching agent builder action"
|
|
19495
19432
|
);
|
|
19496
19433
|
var streamAgentBuilderActionHandler = createAgentBuilderWorkflowHandler(
|
|
19497
|
-
|
|
19434
|
+
chunkPUYDRTPG_cjs.streamWorkflowHandler,
|
|
19498
19435
|
"Streaming agent builder action"
|
|
19499
19436
|
);
|
|
19437
|
+
var streamLegacyAgentBuilderActionHandler = createAgentBuilderWorkflowHandler(
|
|
19438
|
+
chunkPUYDRTPG_cjs.streamLegacyWorkflowHandler,
|
|
19439
|
+
"Streaming legacy agent builder action"
|
|
19440
|
+
);
|
|
19500
19441
|
var streamVNextAgentBuilderActionHandler = createAgentBuilderWorkflowHandler(
|
|
19501
|
-
|
|
19442
|
+
chunkPUYDRTPG_cjs.streamVNextWorkflowHandler,
|
|
19502
19443
|
"Streaming VNext agent builder action"
|
|
19503
19444
|
);
|
|
19445
|
+
var observeStreamLegacyAgentBuilderActionHandler = createAgentBuilderWorkflowHandler(
|
|
19446
|
+
chunkPUYDRTPG_cjs.observeStreamLegacyWorkflowHandler,
|
|
19447
|
+
"Observing legacy stream for agent builder action"
|
|
19448
|
+
);
|
|
19449
|
+
var observeStreamAgentBuilderActionHandler = createAgentBuilderWorkflowHandler(
|
|
19450
|
+
chunkPUYDRTPG_cjs.observeStreamWorkflowHandler,
|
|
19451
|
+
"Observing stream for agent builder action"
|
|
19452
|
+
);
|
|
19453
|
+
var observeStreamVNextAgentBuilderActionHandler = createAgentBuilderWorkflowHandler(
|
|
19454
|
+
chunkPUYDRTPG_cjs.observeStreamVNextWorkflowHandler,
|
|
19455
|
+
"Observing VNext stream for agent builder action"
|
|
19456
|
+
);
|
|
19504
19457
|
var resumeAsyncAgentBuilderActionHandler = createAgentBuilderWorkflowHandler(
|
|
19505
|
-
|
|
19458
|
+
chunkPUYDRTPG_cjs.resumeAsyncWorkflowHandler,
|
|
19506
19459
|
"Resuming async agent builder action"
|
|
19507
19460
|
);
|
|
19508
19461
|
var resumeAgentBuilderActionHandler = createAgentBuilderWorkflowHandler(
|
|
19509
|
-
|
|
19462
|
+
chunkPUYDRTPG_cjs.resumeWorkflowHandler,
|
|
19510
19463
|
"Resuming agent builder action"
|
|
19511
19464
|
);
|
|
19465
|
+
var resumeStreamAgentBuilderActionHandler = createAgentBuilderWorkflowHandler(
|
|
19466
|
+
chunkPUYDRTPG_cjs.resumeStreamWorkflowHandler,
|
|
19467
|
+
"Resuming stream for agent builder action"
|
|
19468
|
+
);
|
|
19512
19469
|
var getAgentBuilderActionRunsHandler = createAgentBuilderWorkflowHandler(
|
|
19513
|
-
|
|
19470
|
+
chunkPUYDRTPG_cjs.listWorkflowRunsHandler,
|
|
19514
19471
|
"Getting agent builder action runs"
|
|
19515
19472
|
);
|
|
19516
19473
|
var cancelAgentBuilderActionRunHandler = createAgentBuilderWorkflowHandler(
|
|
19517
|
-
|
|
19474
|
+
chunkPUYDRTPG_cjs.cancelWorkflowRunHandler,
|
|
19518
19475
|
"Cancelling agent builder action run"
|
|
19519
19476
|
);
|
|
19520
19477
|
var sendAgentBuilderActionRunEventHandler = createAgentBuilderWorkflowHandler(
|
|
19521
|
-
|
|
19478
|
+
chunkPUYDRTPG_cjs.sendWorkflowRunEventHandler,
|
|
19522
19479
|
"Sending agent builder action run event"
|
|
19523
19480
|
);
|
|
19524
19481
|
|
|
@@ -19530,13 +19487,18 @@ exports.getAgentBuilderActionRunByIdHandler = getAgentBuilderActionRunByIdHandle
|
|
|
19530
19487
|
exports.getAgentBuilderActionRunExecutionResultHandler = getAgentBuilderActionRunExecutionResultHandler;
|
|
19531
19488
|
exports.getAgentBuilderActionRunsHandler = getAgentBuilderActionRunsHandler;
|
|
19532
19489
|
exports.getAgentBuilderActionsHandler = getAgentBuilderActionsHandler;
|
|
19490
|
+
exports.observeStreamAgentBuilderActionHandler = observeStreamAgentBuilderActionHandler;
|
|
19491
|
+
exports.observeStreamLegacyAgentBuilderActionHandler = observeStreamLegacyAgentBuilderActionHandler;
|
|
19492
|
+
exports.observeStreamVNextAgentBuilderActionHandler = observeStreamVNextAgentBuilderActionHandler;
|
|
19533
19493
|
exports.resumeAgentBuilderActionHandler = resumeAgentBuilderActionHandler;
|
|
19534
19494
|
exports.resumeAsyncAgentBuilderActionHandler = resumeAsyncAgentBuilderActionHandler;
|
|
19495
|
+
exports.resumeStreamAgentBuilderActionHandler = resumeStreamAgentBuilderActionHandler;
|
|
19535
19496
|
exports.sendAgentBuilderActionRunEventHandler = sendAgentBuilderActionRunEventHandler;
|
|
19536
19497
|
exports.startAgentBuilderActionRunHandler = startAgentBuilderActionRunHandler;
|
|
19537
19498
|
exports.startAsyncAgentBuilderActionHandler = startAsyncAgentBuilderActionHandler;
|
|
19538
19499
|
exports.streamAgentBuilderActionHandler = streamAgentBuilderActionHandler;
|
|
19500
|
+
exports.streamLegacyAgentBuilderActionHandler = streamLegacyAgentBuilderActionHandler;
|
|
19539
19501
|
exports.streamVNextAgentBuilderActionHandler = streamVNextAgentBuilderActionHandler;
|
|
19540
19502
|
exports.watchAgentBuilderActionHandler = watchAgentBuilderActionHandler;
|
|
19541
|
-
//# sourceMappingURL=chunk-
|
|
19542
|
-
//# sourceMappingURL=chunk-
|
|
19503
|
+
//# sourceMappingURL=chunk-4BKR6543.cjs.map
|
|
19504
|
+
//# sourceMappingURL=chunk-4BKR6543.cjs.map
|