@mastra/server 0.0.0-fix-bundle-cleanup-20250911062914 → 0.0.0-fix-cloud-peer-deps-20250923194656
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 +211 -4
- package/README.md +0 -5
- package/dist/{chunk-GUI3CROV.cjs → chunk-2GDLSAVJ.cjs} +60 -22
- package/dist/chunk-2GDLSAVJ.cjs.map +1 -0
- package/dist/{chunk-3TETONBL.cjs → chunk-2WMATOMO.cjs} +93 -8
- package/dist/chunk-2WMATOMO.cjs.map +1 -0
- package/dist/{chunk-6LUKYSWE.cjs → chunk-57HWW2TY.cjs} +96 -119
- package/dist/chunk-57HWW2TY.cjs.map +1 -0
- package/dist/{chunk-R7NOGUZG.js → chunk-5KRXONRF.js} +43 -4
- package/dist/chunk-5KRXONRF.js.map +1 -0
- package/dist/{chunk-L265APUD.cjs → chunk-5N724Q2T.cjs} +43 -3
- package/dist/chunk-5N724Q2T.cjs.map +1 -0
- package/dist/{chunk-3THIIWWW.cjs → chunk-AVEPEUN4.cjs} +4 -3
- package/dist/chunk-AVEPEUN4.cjs.map +1 -0
- package/dist/{chunk-DMSCGAWM.js → chunk-BZT5VYDT.js} +92 -9
- package/dist/chunk-BZT5VYDT.js.map +1 -0
- package/dist/chunk-CNU4A2XU.js +129 -0
- package/dist/chunk-CNU4A2XU.js.map +1 -0
- package/dist/{chunk-B2V3PUB7.js → chunk-G662L2YZ.js} +93 -116
- package/dist/chunk-G662L2YZ.js.map +1 -0
- package/dist/chunk-GDWMF6SB.cjs +133 -0
- package/dist/chunk-GDWMF6SB.cjs.map +1 -0
- package/dist/{chunk-7QEJ5QG5.js → chunk-IYJW2OVQ.js} +60 -22
- package/dist/chunk-IYJW2OVQ.js.map +1 -0
- package/dist/{chunk-A75S4TDD.js → chunk-JRDEOHAJ.js} +19 -11
- package/dist/chunk-JRDEOHAJ.js.map +1 -0
- package/dist/{chunk-SYRRSBGL.js → chunk-KM7EJKXV.js} +8 -4
- package/dist/chunk-KM7EJKXV.js.map +1 -0
- package/dist/{chunk-J7BPKKOG.cjs → chunk-LJFAAEU7.cjs} +8 -4
- package/dist/chunk-LJFAAEU7.cjs.map +1 -0
- package/dist/{chunk-WZC6CIVD.cjs → chunk-NLWACBE7.cjs} +19 -11
- package/dist/chunk-NLWACBE7.cjs.map +1 -0
- package/dist/{chunk-2JEDATG5.cjs → chunk-PLNQ4XER.cjs} +191 -150
- package/dist/chunk-PLNQ4XER.cjs.map +1 -0
- package/dist/{chunk-5QUKZCEF.js → chunk-PUYSH3IL.js} +4 -3
- package/dist/chunk-PUYSH3IL.js.map +1 -0
- package/dist/{chunk-OTU37YZO.js → chunk-X7564COI.js} +172 -131
- package/dist/chunk-X7564COI.js.map +1 -0
- package/dist/index.cjs +4 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/server/handlers/a2a.cjs +7 -7
- 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 +16 -16
- package/dist/server/handlers/agent-builder.d.ts +5 -4
- 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 +23 -15
- package/dist/server/handlers/agents.d.ts +46 -4
- package/dist/server/handlers/agents.d.ts.map +1 -1
- package/dist/server/handlers/agents.js +1 -1
- package/dist/server/handlers/observability.cjs +7 -3
- package/dist/server/handlers/observability.d.ts +18 -0
- package/dist/server/handlers/observability.d.ts.map +1 -1
- package/dist/server/handlers/observability.js +1 -1
- package/dist/server/handlers/scores.cjs +7 -7
- package/dist/server/handlers/scores.d.ts +208 -6
- package/dist/server/handlers/scores.d.ts.map +1 -1
- package/dist/server/handlers/scores.js +1 -1
- package/dist/server/handlers/tools.cjs +6 -6
- package/dist/server/handlers/tools.d.ts.map +1 -1
- package/dist/server/handlers/tools.js +1 -1
- package/dist/server/handlers/vNextNetwork.d.ts +73 -6
- package/dist/server/handlers/vNextNetwork.d.ts.map +1 -1
- package/dist/server/handlers/voice.cjs +5 -5
- package/dist/server/handlers/voice.d.ts +6 -4
- package/dist/server/handlers/voice.d.ts.map +1 -1
- package/dist/server/handlers/voice.js +1 -1
- package/dist/server/handlers/workflows.cjs +24 -16
- package/dist/server/handlers/workflows.d.ts +16 -7
- package/dist/server/handlers/workflows.d.ts.map +1 -1
- package/dist/server/handlers/workflows.js +1 -1
- package/dist/server/handlers.cjs +16 -21
- package/dist/server/handlers.d.ts +0 -1
- package/dist/server/handlers.d.ts.map +1 -1
- package/dist/server/handlers.js +8 -9
- package/dist/server/utils.d.ts +2 -0
- package/dist/server/utils.d.ts.map +1 -1
- package/package.json +8 -8
- package/dist/chunk-2JEDATG5.cjs.map +0 -1
- package/dist/chunk-3TETONBL.cjs.map +0 -1
- package/dist/chunk-3THIIWWW.cjs.map +0 -1
- package/dist/chunk-5QUKZCEF.js.map +0 -1
- package/dist/chunk-6LUKYSWE.cjs.map +0 -1
- package/dist/chunk-7QEJ5QG5.js.map +0 -1
- package/dist/chunk-A75S4TDD.js.map +0 -1
- package/dist/chunk-B2V3PUB7.js.map +0 -1
- package/dist/chunk-DMSCGAWM.js.map +0 -1
- package/dist/chunk-GUI3CROV.cjs.map +0 -1
- package/dist/chunk-IY34NOLA.cjs +0 -150
- package/dist/chunk-IY34NOLA.cjs.map +0 -1
- package/dist/chunk-J7BPKKOG.cjs.map +0 -1
- package/dist/chunk-L265APUD.cjs.map +0 -1
- package/dist/chunk-OTU37YZO.js.map +0 -1
- package/dist/chunk-R7NOGUZG.js.map +0 -1
- package/dist/chunk-SYRRSBGL.js.map +0 -1
- package/dist/chunk-U46VIX2V.js +0 -144
- package/dist/chunk-U46VIX2V.js.map +0 -1
- package/dist/chunk-WZC6CIVD.cjs.map +0 -1
- package/dist/server/handlers/network.cjs +0 -24
- package/dist/server/handlers/network.cjs.map +0 -1
- package/dist/server/handlers/network.d.ts +0 -50
- package/dist/server/handlers/network.d.ts.map +0 -1
- package/dist/server/handlers/network.js +0 -3
- package/dist/server/handlers/network.js.map +0 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk57HWW2TY_cjs = require('./chunk-57HWW2TY.cjs');
|
|
4
|
+
var chunkGDWMF6SB_cjs = require('./chunk-GDWMF6SB.cjs');
|
|
4
5
|
var chunkFALVL2VV_cjs = require('./chunk-FALVL2VV.cjs');
|
|
5
6
|
var chunkHVBBFCDH_cjs = require('./chunk-HVBBFCDH.cjs');
|
|
6
7
|
var chunkPPYGWINI_cjs = require('./chunk-PPYGWINI.cjs');
|
|
@@ -3204,6 +3205,39 @@ function createAbortError() {
|
|
|
3204
3205
|
function extractResponseHeaders(response) {
|
|
3205
3206
|
return Object.fromEntries([...response.headers]);
|
|
3206
3207
|
}
|
|
3208
|
+
function getRuntimeEnvironmentUserAgent(globalThisAny = globalThis) {
|
|
3209
|
+
var _a19, _b8, _c;
|
|
3210
|
+
if (globalThisAny.window) {
|
|
3211
|
+
return `runtime/browser`;
|
|
3212
|
+
}
|
|
3213
|
+
if ((_a19 = globalThisAny.navigator) == null ? void 0 : _a19.userAgent) {
|
|
3214
|
+
return `runtime/${globalThisAny.navigator.userAgent.toLowerCase()}`;
|
|
3215
|
+
}
|
|
3216
|
+
if ((_c = (_b8 = globalThisAny.process) == null ? void 0 : _b8.versions) == null ? void 0 : _c.node) {
|
|
3217
|
+
return `runtime/node.js/${globalThisAny.process.version.substring(0)}`;
|
|
3218
|
+
}
|
|
3219
|
+
if (globalThisAny.EdgeRuntime) {
|
|
3220
|
+
return `runtime/vercel-edge`;
|
|
3221
|
+
}
|
|
3222
|
+
return "runtime/unknown";
|
|
3223
|
+
}
|
|
3224
|
+
function removeUndefinedEntries(record) {
|
|
3225
|
+
return Object.fromEntries(
|
|
3226
|
+
Object.entries(record).filter(([_key, value]) => value != null)
|
|
3227
|
+
);
|
|
3228
|
+
}
|
|
3229
|
+
function withUserAgentSuffix(headers, ...userAgentSuffixParts) {
|
|
3230
|
+
const cleanedHeaders = removeUndefinedEntries(
|
|
3231
|
+
headers != null ? headers : {}
|
|
3232
|
+
);
|
|
3233
|
+
const normalizedHeaders = new Headers(cleanedHeaders);
|
|
3234
|
+
const currentUserAgentHeader = normalizedHeaders.get("user-agent") || "";
|
|
3235
|
+
normalizedHeaders.set(
|
|
3236
|
+
"user-agent",
|
|
3237
|
+
[currentUserAgentHeader, ...userAgentSuffixParts].filter(Boolean).join(" ")
|
|
3238
|
+
);
|
|
3239
|
+
return Object.fromEntries(normalizedHeaders);
|
|
3240
|
+
}
|
|
3207
3241
|
var createIdGenerator2 = ({
|
|
3208
3242
|
prefix,
|
|
3209
3243
|
size = 16,
|
|
@@ -3270,11 +3304,7 @@ function handleFetchError({
|
|
|
3270
3304
|
}
|
|
3271
3305
|
return error;
|
|
3272
3306
|
}
|
|
3273
|
-
|
|
3274
|
-
return Object.fromEntries(
|
|
3275
|
-
Object.entries(record).filter(([_key, value]) => value != null)
|
|
3276
|
-
);
|
|
3277
|
-
}
|
|
3307
|
+
var VERSION2 = "3.0.9" ;
|
|
3278
3308
|
var getOriginalFetch = () => globalThis.fetch;
|
|
3279
3309
|
var getFromApi = async ({
|
|
3280
3310
|
url,
|
|
@@ -3287,7 +3317,11 @@ var getFromApi = async ({
|
|
|
3287
3317
|
try {
|
|
3288
3318
|
const response = await fetch2(url, {
|
|
3289
3319
|
method: "GET",
|
|
3290
|
-
headers:
|
|
3320
|
+
headers: withUserAgentSuffix(
|
|
3321
|
+
headers,
|
|
3322
|
+
`ai-sdk/provider-utils/${VERSION2}`,
|
|
3323
|
+
getRuntimeEnvironmentUserAgent()
|
|
3324
|
+
),
|
|
3291
3325
|
signal: abortSignal
|
|
3292
3326
|
});
|
|
3293
3327
|
const responseHeaders = extractResponseHeaders(response);
|
|
@@ -3542,7 +3576,11 @@ var postToApi = async ({
|
|
|
3542
3576
|
try {
|
|
3543
3577
|
const response = await fetch2(url, {
|
|
3544
3578
|
method: "POST",
|
|
3545
|
-
headers:
|
|
3579
|
+
headers: withUserAgentSuffix(
|
|
3580
|
+
headers,
|
|
3581
|
+
`ai-sdk/provider-utils/${VERSION2}`,
|
|
3582
|
+
getRuntimeEnvironmentUserAgent()
|
|
3583
|
+
),
|
|
3546
3584
|
body: body.content,
|
|
3547
3585
|
signal: abortSignal
|
|
3548
3586
|
});
|
|
@@ -5382,7 +5420,7 @@ var GatewayEmbeddingModel = class {
|
|
|
5382
5420
|
),
|
|
5383
5421
|
body: {
|
|
5384
5422
|
input: values.length === 1 ? values[0] : values,
|
|
5385
|
-
...providerOptions
|
|
5423
|
+
...providerOptions ? { providerOptions } : {}
|
|
5386
5424
|
},
|
|
5387
5425
|
successfulResponseHandler: createJsonResponseHandler(
|
|
5388
5426
|
gatewayEmbeddingResponseSchema
|
|
@@ -6111,6 +6149,7 @@ function prepareRetries2({
|
|
|
6111
6149
|
function stepCountIs(stepCount) {
|
|
6112
6150
|
return ({ steps }) => steps.length === stepCount;
|
|
6113
6151
|
}
|
|
6152
|
+
var VERSION3 = "5.0.44" ;
|
|
6114
6153
|
createIdGenerator2({
|
|
6115
6154
|
prefix: "aitxt",
|
|
6116
6155
|
size: 24
|
|
@@ -6615,10 +6654,14 @@ async function embedMany2({
|
|
|
6615
6654
|
maxRetries: maxRetriesArg,
|
|
6616
6655
|
abortSignal
|
|
6617
6656
|
});
|
|
6657
|
+
const headersWithUserAgent = withUserAgentSuffix(
|
|
6658
|
+
headers != null ? headers : {},
|
|
6659
|
+
`ai/${VERSION3}`
|
|
6660
|
+
);
|
|
6618
6661
|
const baseTelemetryAttributes = getBaseTelemetryAttributes2({
|
|
6619
6662
|
model,
|
|
6620
6663
|
telemetry,
|
|
6621
|
-
headers,
|
|
6664
|
+
headers: headersWithUserAgent,
|
|
6622
6665
|
settings: { maxRetries }
|
|
6623
6666
|
});
|
|
6624
6667
|
const tracer = getTracer2(telemetry);
|
|
@@ -6667,7 +6710,7 @@ async function embedMany2({
|
|
|
6667
6710
|
const modelResponse = await model.doEmbed({
|
|
6668
6711
|
values,
|
|
6669
6712
|
abortSignal,
|
|
6670
|
-
headers,
|
|
6713
|
+
headers: headersWithUserAgent,
|
|
6671
6714
|
providerOptions
|
|
6672
6715
|
});
|
|
6673
6716
|
const embeddings3 = modelResponse.embeddings;
|
|
@@ -6749,7 +6792,7 @@ async function embedMany2({
|
|
|
6749
6792
|
const modelResponse = await model.doEmbed({
|
|
6750
6793
|
values: chunk,
|
|
6751
6794
|
abortSignal,
|
|
6752
|
-
headers,
|
|
6795
|
+
headers: headersWithUserAgent,
|
|
6753
6796
|
providerOptions
|
|
6754
6797
|
});
|
|
6755
6798
|
const embeddings2 = modelResponse.embeddings;
|
|
@@ -7116,6 +7159,7 @@ var toolUIPartSchemas = [
|
|
|
7116
7159
|
type: z42.z.string().startsWith("tool-"),
|
|
7117
7160
|
toolCallId: z42.z.string(),
|
|
7118
7161
|
state: z42.z.literal("input-streaming"),
|
|
7162
|
+
providerExecuted: z42.z.boolean().optional(),
|
|
7119
7163
|
input: z42.z.unknown().optional(),
|
|
7120
7164
|
output: z42.z.never().optional(),
|
|
7121
7165
|
errorText: z42.z.never().optional()
|
|
@@ -7124,6 +7168,7 @@ var toolUIPartSchemas = [
|
|
|
7124
7168
|
type: z42.z.string().startsWith("tool-"),
|
|
7125
7169
|
toolCallId: z42.z.string(),
|
|
7126
7170
|
state: z42.z.literal("input-available"),
|
|
7171
|
+
providerExecuted: z42.z.boolean().optional(),
|
|
7127
7172
|
input: z42.z.unknown(),
|
|
7128
7173
|
output: z42.z.never().optional(),
|
|
7129
7174
|
errorText: z42.z.never().optional(),
|
|
@@ -7133,6 +7178,7 @@ var toolUIPartSchemas = [
|
|
|
7133
7178
|
type: z42.z.string().startsWith("tool-"),
|
|
7134
7179
|
toolCallId: z42.z.string(),
|
|
7135
7180
|
state: z42.z.literal("output-available"),
|
|
7181
|
+
providerExecuted: z42.z.boolean().optional(),
|
|
7136
7182
|
input: z42.z.unknown(),
|
|
7137
7183
|
output: z42.z.unknown(),
|
|
7138
7184
|
errorText: z42.z.never().optional(),
|
|
@@ -7143,6 +7189,7 @@ var toolUIPartSchemas = [
|
|
|
7143
7189
|
type: z42.z.string().startsWith("tool-"),
|
|
7144
7190
|
toolCallId: z42.z.string(),
|
|
7145
7191
|
state: z42.z.literal("output-error"),
|
|
7192
|
+
providerExecuted: z42.z.boolean().optional(),
|
|
7146
7193
|
input: z42.z.unknown(),
|
|
7147
7194
|
output: z42.z.never().optional(),
|
|
7148
7195
|
errorText: z42.z.string(),
|
|
@@ -8577,7 +8624,7 @@ var Memory = class extends memory.MastraMemory {
|
|
|
8577
8624
|
const resourceScope = typeof config?.semanticRecall === "object" && config?.semanticRecall?.scope === `resource`;
|
|
8578
8625
|
if (config?.semanticRecall && selectBy?.vectorSearchString && this.vector) {
|
|
8579
8626
|
const { embeddings, dimension } = await this.embedMessageContent(selectBy.vectorSearchString);
|
|
8580
|
-
const { indexName } = await this.createEmbeddingIndex(dimension);
|
|
8627
|
+
const { indexName } = await this.createEmbeddingIndex(dimension, config);
|
|
8581
8628
|
await Promise.all(
|
|
8582
8629
|
embeddings.map(async (embedding) => {
|
|
8583
8630
|
if (typeof this.vector === `undefined`) {
|
|
@@ -8931,7 +8978,7 @@ ${workingMemory}`;
|
|
|
8931
8978
|
if (!textForEmbedding) return;
|
|
8932
8979
|
const { embeddings, chunks, dimension } = await this.embedMessageContent(textForEmbedding);
|
|
8933
8980
|
if (typeof indexName === `undefined`) {
|
|
8934
|
-
indexName = this.createEmbeddingIndex(dimension).then((result2) => result2.indexName);
|
|
8981
|
+
indexName = this.createEmbeddingIndex(dimension, config).then((result2) => result2.indexName);
|
|
8935
8982
|
}
|
|
8936
8983
|
if (typeof this.vector === `undefined`) {
|
|
8937
8984
|
throw new Error(
|
|
@@ -9703,7 +9750,7 @@ function isInWorkspaceSubfolder(cwd) {
|
|
|
9703
9750
|
if (currentDir === cwd) {
|
|
9704
9751
|
continue;
|
|
9705
9752
|
}
|
|
9706
|
-
console.
|
|
9753
|
+
console.info(`Checking for workspace indicators in: ${currentDir}`);
|
|
9707
9754
|
if (fs.existsSync(path.resolve(currentDir, "pnpm-workspace.yaml"))) {
|
|
9708
9755
|
return true;
|
|
9709
9756
|
}
|
|
@@ -9723,7 +9770,7 @@ function isInWorkspaceSubfolder(cwd) {
|
|
|
9723
9770
|
}
|
|
9724
9771
|
return false;
|
|
9725
9772
|
} catch (error) {
|
|
9726
|
-
console.
|
|
9773
|
+
console.warn(`Error in workspace detection: ${error}`);
|
|
9727
9774
|
return false;
|
|
9728
9775
|
}
|
|
9729
9776
|
}
|
|
@@ -9794,12 +9841,12 @@ function spawnWithOutput(command, args, options) {
|
|
|
9794
9841
|
}
|
|
9795
9842
|
async function spawnSWPM(cwd, command, packageNames) {
|
|
9796
9843
|
try {
|
|
9797
|
-
console.
|
|
9844
|
+
console.info("Running install command with swpm");
|
|
9798
9845
|
const swpmPath = module$1.createRequire(undefined).resolve("swpm");
|
|
9799
9846
|
await spawn(swpmPath, [command, ...packageNames], { cwd });
|
|
9800
9847
|
return;
|
|
9801
9848
|
} catch (e2) {
|
|
9802
|
-
console.
|
|
9849
|
+
console.warn("Failed to run install command with swpm", e2);
|
|
9803
9850
|
}
|
|
9804
9851
|
try {
|
|
9805
9852
|
let packageManager;
|
|
@@ -9827,11 +9874,11 @@ async function spawnSWPM(cwd, command, packageNames) {
|
|
|
9827
9874
|
}
|
|
9828
9875
|
}
|
|
9829
9876
|
args.push(...packageNames);
|
|
9830
|
-
console.
|
|
9877
|
+
console.info(`Falling back to ${packageManager} ${args.join(" ")}`);
|
|
9831
9878
|
await spawn(packageManager, args, { cwd });
|
|
9832
9879
|
return;
|
|
9833
9880
|
} catch (e2) {
|
|
9834
|
-
console.
|
|
9881
|
+
console.warn(`Failed to run install command with native package manager: ${e2}`);
|
|
9835
9882
|
}
|
|
9836
9883
|
throw new Error(`Failed to run install command with swpm and native package managers`);
|
|
9837
9884
|
}
|
|
@@ -9845,10 +9892,10 @@ async function logGitState(targetPath, label) {
|
|
|
9845
9892
|
const gitStatusResult = await git(targetPath, "status", "--porcelain");
|
|
9846
9893
|
const gitLogResult = await git(targetPath, "log", "--oneline", "-3");
|
|
9847
9894
|
const gitCountResult = await git(targetPath, "rev-list", "--count", "HEAD");
|
|
9848
|
-
console.
|
|
9849
|
-
console.
|
|
9850
|
-
console.
|
|
9851
|
-
console.
|
|
9895
|
+
console.info(`\u{1F4CA} Git state ${label}:`);
|
|
9896
|
+
console.info("Status:", gitStatusResult.stdout.trim() || "Clean working directory");
|
|
9897
|
+
console.info("Recent commits:", gitLogResult.stdout.trim());
|
|
9898
|
+
console.info("Total commits:", gitCountResult.stdout.trim());
|
|
9852
9899
|
} catch (gitError) {
|
|
9853
9900
|
console.warn(`Could not get git state ${label}:`, gitError);
|
|
9854
9901
|
}
|
|
@@ -9920,18 +9967,18 @@ async function gitCheckoutBranch(branchName, targetPath) {
|
|
|
9920
9967
|
try {
|
|
9921
9968
|
if (!await isInsideGitRepo(targetPath)) return;
|
|
9922
9969
|
await git(targetPath, "checkout", "-b", branchName);
|
|
9923
|
-
console.
|
|
9970
|
+
console.info(`Created new branch: ${branchName}`);
|
|
9924
9971
|
} catch (error) {
|
|
9925
9972
|
const errorStr = error instanceof Error ? error.message : String(error);
|
|
9926
9973
|
if (errorStr.includes("already exists")) {
|
|
9927
9974
|
try {
|
|
9928
9975
|
await git(targetPath, "checkout", branchName);
|
|
9929
|
-
console.
|
|
9976
|
+
console.info(`Switched to existing branch: ${branchName}`);
|
|
9930
9977
|
} catch {
|
|
9931
9978
|
const timestamp = Date.now().toString().slice(-6);
|
|
9932
9979
|
const uniqueBranchName = `${branchName}-${timestamp}`;
|
|
9933
9980
|
await git(targetPath, "checkout", "-b", uniqueBranchName);
|
|
9934
|
-
console.
|
|
9981
|
+
console.info(`Created unique branch: ${uniqueBranchName}`);
|
|
9935
9982
|
}
|
|
9936
9983
|
} else {
|
|
9937
9984
|
throw error;
|
|
@@ -9941,9 +9988,9 @@ async function gitCheckoutBranch(branchName, targetPath) {
|
|
|
9941
9988
|
async function backupAndReplaceFile(sourceFile, targetFile) {
|
|
9942
9989
|
const backupFile = `${targetFile}.backup-${Date.now()}`;
|
|
9943
9990
|
await promises.copyFile(targetFile, backupFile);
|
|
9944
|
-
console.
|
|
9991
|
+
console.info(`\u{1F4E6} Created backup: ${path.basename(backupFile)}`);
|
|
9945
9992
|
await promises.copyFile(sourceFile, targetFile);
|
|
9946
|
-
console.
|
|
9993
|
+
console.info(`\u{1F504} Replaced file with template version (backup created)`);
|
|
9947
9994
|
}
|
|
9948
9995
|
async function renameAndCopyFile(sourceFile, targetFile) {
|
|
9949
9996
|
let counter = 1;
|
|
@@ -9957,7 +10004,7 @@ async function renameAndCopyFile(sourceFile, targetFile) {
|
|
|
9957
10004
|
counter++;
|
|
9958
10005
|
}
|
|
9959
10006
|
await promises.copyFile(sourceFile, uniqueTargetFile);
|
|
9960
|
-
console.
|
|
10007
|
+
console.info(`\u{1F4DD} Copied with unique name: ${path.basename(uniqueTargetFile)}`);
|
|
9961
10008
|
return uniqueTargetFile;
|
|
9962
10009
|
}
|
|
9963
10010
|
var isValidMastraLanguageModel = (model) => {
|
|
@@ -10006,7 +10053,7 @@ var mergeGitignoreFiles = (targetContent, templateContent, templateSlug) => {
|
|
|
10006
10053
|
if (!hasConflict) {
|
|
10007
10054
|
newEntries.push(trimmed);
|
|
10008
10055
|
} else {
|
|
10009
|
-
console.
|
|
10056
|
+
console.info(`\u26A0 Skipping conflicting .gitignore rule: ${trimmed} (conflicts with existing rule)`);
|
|
10010
10057
|
}
|
|
10011
10058
|
}
|
|
10012
10059
|
}
|
|
@@ -10041,7 +10088,7 @@ var mergeEnvFiles = (targetContent, templateVariables, templateSlug) => {
|
|
|
10041
10088
|
if (!existingVars.has(key)) {
|
|
10042
10089
|
newVars.push({ key, value });
|
|
10043
10090
|
} else {
|
|
10044
|
-
console.
|
|
10091
|
+
console.info(`\u26A0 Skipping existing environment variable: ${key} (already exists in .env)`);
|
|
10045
10092
|
}
|
|
10046
10093
|
}
|
|
10047
10094
|
if (newVars.length === 0) {
|
|
@@ -10062,7 +10109,7 @@ var detectAISDKVersion = async (projectPath) => {
|
|
|
10062
10109
|
try {
|
|
10063
10110
|
const packageJsonPath = path.join(projectPath, "package.json");
|
|
10064
10111
|
if (!fs.existsSync(packageJsonPath)) {
|
|
10065
|
-
console.
|
|
10112
|
+
console.info("No package.json found, defaulting to v2");
|
|
10066
10113
|
return "v2";
|
|
10067
10114
|
}
|
|
10068
10115
|
const packageContent = await promises.readFile(packageJsonPath, "utf-8");
|
|
@@ -10080,16 +10127,16 @@ var detectAISDKVersion = async (projectPath) => {
|
|
|
10080
10127
|
if (versionMatch) {
|
|
10081
10128
|
const majorVersion = parseInt(versionMatch[1]);
|
|
10082
10129
|
if (majorVersion >= 2) {
|
|
10083
|
-
console.
|
|
10130
|
+
console.info(`Detected ${pkg} v${majorVersion} -> using v2 specification`);
|
|
10084
10131
|
return "v2";
|
|
10085
10132
|
} else {
|
|
10086
|
-
console.
|
|
10133
|
+
console.info(`Detected ${pkg} v${majorVersion} -> using v1 specification`);
|
|
10087
10134
|
return "v1";
|
|
10088
10135
|
}
|
|
10089
10136
|
}
|
|
10090
10137
|
}
|
|
10091
10138
|
}
|
|
10092
|
-
console.
|
|
10139
|
+
console.info("No AI SDK version detected, defaulting to v2");
|
|
10093
10140
|
return "v2";
|
|
10094
10141
|
} catch (error) {
|
|
10095
10142
|
console.warn(`Failed to detect AI SDK version: ${error instanceof Error ? error.message : String(error)}`);
|
|
@@ -10150,7 +10197,7 @@ var createModelInstance = async (provider, modelId, version = "v2") => {
|
|
|
10150
10197
|
return null;
|
|
10151
10198
|
}
|
|
10152
10199
|
const modelInstance = await providerFn();
|
|
10153
|
-
console.
|
|
10200
|
+
console.info(`Created ${provider} model instance (${version}): ${modelId}`);
|
|
10154
10201
|
return modelInstance;
|
|
10155
10202
|
} catch (error) {
|
|
10156
10203
|
console.error(`Failed to create model instance: ${error instanceof Error ? error.message : String(error)}`);
|
|
@@ -10164,7 +10211,7 @@ var resolveModel = async ({
|
|
|
10164
10211
|
}) => {
|
|
10165
10212
|
const modelFromContext = runtimeContext.get("model");
|
|
10166
10213
|
if (modelFromContext) {
|
|
10167
|
-
console.
|
|
10214
|
+
console.info("Using model from runtime context");
|
|
10168
10215
|
if (isValidMastraLanguageModel(modelFromContext)) {
|
|
10169
10216
|
return modelFromContext;
|
|
10170
10217
|
}
|
|
@@ -10174,7 +10221,7 @@ var resolveModel = async ({
|
|
|
10174
10221
|
}
|
|
10175
10222
|
const selectedModel = runtimeContext.get("selectedModel");
|
|
10176
10223
|
if (selectedModel?.provider && selectedModel?.modelId && projectPath) {
|
|
10177
|
-
console.
|
|
10224
|
+
console.info(`Resolving selected model: ${selectedModel.provider}/${selectedModel.modelId}`);
|
|
10178
10225
|
const version = await detectAISDKVersion(projectPath);
|
|
10179
10226
|
const modelInstance = await createModelInstance(selectedModel.provider, selectedModel.modelId, version);
|
|
10180
10227
|
if (modelInstance) {
|
|
@@ -10182,7 +10229,7 @@ var resolveModel = async ({
|
|
|
10182
10229
|
return modelInstance;
|
|
10183
10230
|
}
|
|
10184
10231
|
}
|
|
10185
|
-
console.
|
|
10232
|
+
console.info("Using default model");
|
|
10186
10233
|
return defaultModel;
|
|
10187
10234
|
};
|
|
10188
10235
|
var AgentBuilderDefaults = class _AgentBuilderDefaults {
|
|
@@ -11216,7 +11263,7 @@ export const mastra = new Mastra({
|
|
|
11216
11263
|
error: stderr
|
|
11217
11264
|
};
|
|
11218
11265
|
} catch (error) {
|
|
11219
|
-
console.
|
|
11266
|
+
console.error(error);
|
|
11220
11267
|
return {
|
|
11221
11268
|
success: false,
|
|
11222
11269
|
message: `Failed to create project: ${error instanceof Error ? error.message : String(error)}`
|
|
@@ -11231,7 +11278,7 @@ export const mastra = new Mastra({
|
|
|
11231
11278
|
projectPath
|
|
11232
11279
|
}) {
|
|
11233
11280
|
try {
|
|
11234
|
-
console.
|
|
11281
|
+
console.info("Installing packages:", JSON.stringify(packages, null, 2));
|
|
11235
11282
|
const packageStrings = packages.map((p) => `${p.name}`);
|
|
11236
11283
|
await spawnSWPM(projectPath || "", "add", packageStrings);
|
|
11237
11284
|
return {
|
|
@@ -11255,7 +11302,7 @@ export const mastra = new Mastra({
|
|
|
11255
11302
|
projectPath
|
|
11256
11303
|
}) {
|
|
11257
11304
|
try {
|
|
11258
|
-
console.
|
|
11305
|
+
console.info("Upgrading specific packages:", JSON.stringify(packages, null, 2));
|
|
11259
11306
|
let packageNames = [];
|
|
11260
11307
|
if (packages && packages.length > 0) {
|
|
11261
11308
|
packageNames = packages.map((p) => `${p.name}`);
|
|
@@ -12846,13 +12893,13 @@ var analyzePackageStep = workflows.createStep({
|
|
|
12846
12893
|
inputSchema: CloneTemplateResultSchema,
|
|
12847
12894
|
outputSchema: PackageAnalysisSchema,
|
|
12848
12895
|
execute: async ({ inputData }) => {
|
|
12849
|
-
console.
|
|
12896
|
+
console.info("Analyzing template package.json...");
|
|
12850
12897
|
const { templateDir } = inputData;
|
|
12851
12898
|
const packageJsonPath = path.join(templateDir, "package.json");
|
|
12852
12899
|
try {
|
|
12853
12900
|
const packageJsonContent = await promises.readFile(packageJsonPath, "utf-8");
|
|
12854
12901
|
const packageJson = JSON.parse(packageJsonContent);
|
|
12855
|
-
console.
|
|
12902
|
+
console.info("Template package.json:", JSON.stringify(packageJson, null, 2));
|
|
12856
12903
|
return {
|
|
12857
12904
|
dependencies: packageJson.dependencies || {},
|
|
12858
12905
|
devDependencies: packageJson.devDependencies || {},
|
|
@@ -12888,7 +12935,7 @@ var discoverUnitsStep = workflows.createStep({
|
|
|
12888
12935
|
const { templateDir } = inputData;
|
|
12889
12936
|
const targetPath = resolveTargetPath(inputData, runtimeContext);
|
|
12890
12937
|
const tools = await AgentBuilderDefaults.DEFAULT_TOOLS(templateDir);
|
|
12891
|
-
console.
|
|
12938
|
+
console.info("targetPath", targetPath);
|
|
12892
12939
|
const model = await resolveModel({ runtimeContext, projectPath: targetPath, defaultModel: chunkPPYGWINI_cjs.openai("gpt-4.1") });
|
|
12893
12940
|
try {
|
|
12894
12941
|
const agent$1 = new agent.Agent({
|
|
@@ -12976,7 +13023,7 @@ Return the actual exported names of the units, as well as the file names.`,
|
|
|
12976
13023
|
template.other?.forEach((otherId) => {
|
|
12977
13024
|
units.push({ kind: "other", id: otherId.name, file: otherId.file });
|
|
12978
13025
|
});
|
|
12979
|
-
console.
|
|
13026
|
+
console.info("Discovered units:", JSON.stringify(units, null, 2));
|
|
12980
13027
|
if (units.length === 0) {
|
|
12981
13028
|
throw new Error(`No Mastra units (agents, workflows, tools) found in template.
|
|
12982
13029
|
Possible causes:
|
|
@@ -13052,7 +13099,7 @@ var packageMergeStep = workflows.createStep({
|
|
|
13052
13099
|
inputSchema: PackageMergeInputSchema,
|
|
13053
13100
|
outputSchema: PackageMergeResultSchema,
|
|
13054
13101
|
execute: async ({ inputData, runtimeContext }) => {
|
|
13055
|
-
console.
|
|
13102
|
+
console.info("Package merge step starting...");
|
|
13056
13103
|
const { slug, packageInfo } = inputData;
|
|
13057
13104
|
const targetPath = resolveTargetPath(inputData, runtimeContext);
|
|
13058
13105
|
try {
|
|
@@ -13129,7 +13176,7 @@ var installStep = workflows.createStep({
|
|
|
13129
13176
|
inputSchema: InstallInputSchema,
|
|
13130
13177
|
outputSchema: InstallResultSchema,
|
|
13131
13178
|
execute: async ({ inputData, runtimeContext }) => {
|
|
13132
|
-
console.
|
|
13179
|
+
console.info("Running install step...");
|
|
13133
13180
|
const targetPath = resolveTargetPath(inputData, runtimeContext);
|
|
13134
13181
|
try {
|
|
13135
13182
|
await spawnSWPM(targetPath, "install", []);
|
|
@@ -13157,7 +13204,7 @@ var programmaticFileCopyStep = workflows.createStep({
|
|
|
13157
13204
|
inputSchema: FileCopyInputSchema,
|
|
13158
13205
|
outputSchema: FileCopyResultSchema,
|
|
13159
13206
|
execute: async ({ inputData, runtimeContext }) => {
|
|
13160
|
-
console.
|
|
13207
|
+
console.info("Programmatic file copy step starting...");
|
|
13161
13208
|
const { orderedUnits, templateDir, commitSha, slug } = inputData;
|
|
13162
13209
|
const targetPath = resolveTargetPath(inputData, runtimeContext);
|
|
13163
13210
|
try {
|
|
@@ -13200,7 +13247,7 @@ var programmaticFileCopyStep = workflows.createStep({
|
|
|
13200
13247
|
}
|
|
13201
13248
|
};
|
|
13202
13249
|
for (const unit of orderedUnits) {
|
|
13203
|
-
console.
|
|
13250
|
+
console.info(`Processing ${unit.kind} unit "${unit.id}" from file "${unit.file}"`);
|
|
13204
13251
|
let sourceFile;
|
|
13205
13252
|
let resolvedUnitFile;
|
|
13206
13253
|
if (unit.file.includes("/")) {
|
|
@@ -13231,7 +13278,7 @@ var programmaticFileCopyStep = workflows.createStep({
|
|
|
13231
13278
|
}
|
|
13232
13279
|
const targetDir = path.dirname(resolvedUnitFile);
|
|
13233
13280
|
const namingConvention = await analyzeNamingConvention(targetDir);
|
|
13234
|
-
console.
|
|
13281
|
+
console.info(`Detected naming convention in ${targetDir}: ${namingConvention}`);
|
|
13235
13282
|
const hasExtension = path.extname(unit.id) !== "";
|
|
13236
13283
|
const baseId = hasExtension ? path.basename(unit.id, path.extname(unit.id)) : unit.id;
|
|
13237
13284
|
const fileExtension = path.extname(unit.file);
|
|
@@ -13239,7 +13286,7 @@ var programmaticFileCopyStep = workflows.createStep({
|
|
|
13239
13286
|
const targetFile = path.resolve(targetPath, targetDir, convertedFileName);
|
|
13240
13287
|
if (fs.existsSync(targetFile)) {
|
|
13241
13288
|
const strategy = determineConflictStrategy();
|
|
13242
|
-
console.
|
|
13289
|
+
console.info(`File exists: ${convertedFileName}, using strategy: ${strategy}`);
|
|
13243
13290
|
switch (strategy) {
|
|
13244
13291
|
case "skip":
|
|
13245
13292
|
conflicts.push({
|
|
@@ -13248,7 +13295,7 @@ var programmaticFileCopyStep = workflows.createStep({
|
|
|
13248
13295
|
sourceFile: unit.file,
|
|
13249
13296
|
targetFile: `${targetDir}/${convertedFileName}`
|
|
13250
13297
|
});
|
|
13251
|
-
console.
|
|
13298
|
+
console.info(`\u23ED\uFE0F Skipped ${unit.kind} "${unit.id}": file already exists`);
|
|
13252
13299
|
continue;
|
|
13253
13300
|
case "backup-and-replace":
|
|
13254
13301
|
try {
|
|
@@ -13258,7 +13305,7 @@ var programmaticFileCopyStep = workflows.createStep({
|
|
|
13258
13305
|
destination: targetFile,
|
|
13259
13306
|
unit: { kind: unit.kind, id: unit.id }
|
|
13260
13307
|
});
|
|
13261
|
-
console.
|
|
13308
|
+
console.info(
|
|
13262
13309
|
`\u{1F504} Replaced ${unit.kind} "${unit.id}": ${unit.file} \u2192 ${convertedFileName} (backup created)`
|
|
13263
13310
|
);
|
|
13264
13311
|
continue;
|
|
@@ -13279,7 +13326,7 @@ var programmaticFileCopyStep = workflows.createStep({
|
|
|
13279
13326
|
destination: uniqueTargetFile,
|
|
13280
13327
|
unit: { kind: unit.kind, id: unit.id }
|
|
13281
13328
|
});
|
|
13282
|
-
console.
|
|
13329
|
+
console.info(`\u{1F4DD} Renamed ${unit.kind} "${unit.id}": ${unit.file} \u2192 ${path.basename(uniqueTargetFile)}`);
|
|
13283
13330
|
continue;
|
|
13284
13331
|
} catch (renameError) {
|
|
13285
13332
|
conflicts.push({
|
|
@@ -13308,7 +13355,7 @@ var programmaticFileCopyStep = workflows.createStep({
|
|
|
13308
13355
|
destination: targetFile,
|
|
13309
13356
|
unit: { kind: unit.kind, id: unit.id }
|
|
13310
13357
|
});
|
|
13311
|
-
console.
|
|
13358
|
+
console.info(`\u2713 Copied ${unit.kind} "${unit.id}": ${unit.file} \u2192 ${convertedFileName}`);
|
|
13312
13359
|
} catch (copyError) {
|
|
13313
13360
|
conflicts.push({
|
|
13314
13361
|
unit: { kind: unit.kind, id: unit.id },
|
|
@@ -13329,7 +13376,7 @@ var programmaticFileCopyStep = workflows.createStep({
|
|
|
13329
13376
|
destination: targetTsconfig,
|
|
13330
13377
|
unit: { kind: "other", id: "tsconfig.json" }
|
|
13331
13378
|
});
|
|
13332
|
-
console.
|
|
13379
|
+
console.info("\u2713 Copied tsconfig.json from template to target");
|
|
13333
13380
|
} else {
|
|
13334
13381
|
const minimalTsconfig = {
|
|
13335
13382
|
compilerOptions: {
|
|
@@ -13351,7 +13398,7 @@ var programmaticFileCopyStep = workflows.createStep({
|
|
|
13351
13398
|
destination: targetTsconfig,
|
|
13352
13399
|
unit: { kind: "other", id: "tsconfig.json" }
|
|
13353
13400
|
});
|
|
13354
|
-
console.
|
|
13401
|
+
console.info("\u2713 Generated minimal tsconfig.json in target");
|
|
13355
13402
|
}
|
|
13356
13403
|
}
|
|
13357
13404
|
} catch (e2) {
|
|
@@ -13376,7 +13423,7 @@ var programmaticFileCopyStep = workflows.createStep({
|
|
|
13376
13423
|
destination: targetMastraIndex,
|
|
13377
13424
|
unit: { kind: "other", id: "mastra-index" }
|
|
13378
13425
|
});
|
|
13379
|
-
console.
|
|
13426
|
+
console.info("\u2713 Copied Mastra index file from template");
|
|
13380
13427
|
}
|
|
13381
13428
|
}
|
|
13382
13429
|
} catch (e2) {
|
|
@@ -13400,7 +13447,7 @@ var programmaticFileCopyStep = workflows.createStep({
|
|
|
13400
13447
|
destination: targetGitignore,
|
|
13401
13448
|
unit: { kind: "other", id: "gitignore" }
|
|
13402
13449
|
});
|
|
13403
|
-
console.
|
|
13450
|
+
console.info("\u2713 Copied .gitignore from template to target");
|
|
13404
13451
|
} else {
|
|
13405
13452
|
const targetContent = await promises.readFile(targetGitignore, "utf-8");
|
|
13406
13453
|
const templateContent = await promises.readFile(templateGitignore, "utf-8");
|
|
@@ -13413,9 +13460,9 @@ var programmaticFileCopyStep = workflows.createStep({
|
|
|
13413
13460
|
destination: targetGitignore,
|
|
13414
13461
|
unit: { kind: "other", id: "gitignore-merge" }
|
|
13415
13462
|
});
|
|
13416
|
-
console.
|
|
13463
|
+
console.info(`\u2713 Merged template .gitignore entries into existing .gitignore (${addedLines} new entries)`);
|
|
13417
13464
|
} else {
|
|
13418
|
-
console.
|
|
13465
|
+
console.info("\u2139 No new .gitignore entries to add from template");
|
|
13419
13466
|
}
|
|
13420
13467
|
}
|
|
13421
13468
|
}
|
|
@@ -13443,7 +13490,7 @@ var programmaticFileCopyStep = workflows.createStep({
|
|
|
13443
13490
|
destination: targetEnv,
|
|
13444
13491
|
unit: { kind: "other", id: "env" }
|
|
13445
13492
|
});
|
|
13446
|
-
console.
|
|
13493
|
+
console.info(`\u2713 Created .env file with ${Object.keys(variables).length} template variables`);
|
|
13447
13494
|
} else {
|
|
13448
13495
|
const targetContent = await promises.readFile(targetEnv, "utf-8");
|
|
13449
13496
|
const mergedContent = mergeEnvFiles(targetContent, variables, slug);
|
|
@@ -13455,9 +13502,9 @@ var programmaticFileCopyStep = workflows.createStep({
|
|
|
13455
13502
|
destination: targetEnv,
|
|
13456
13503
|
unit: { kind: "other", id: "env-merge" }
|
|
13457
13504
|
});
|
|
13458
|
-
console.
|
|
13505
|
+
console.info(`\u2713 Merged new environment variables into existing .env file (${addedLines} new entries)`);
|
|
13459
13506
|
} else {
|
|
13460
|
-
console.
|
|
13507
|
+
console.info("\u2139 No new environment variables to add (all already exist in .env)");
|
|
13461
13508
|
}
|
|
13462
13509
|
}
|
|
13463
13510
|
}
|
|
@@ -13478,13 +13525,13 @@ var programmaticFileCopyStep = workflows.createStep({
|
|
|
13478
13525
|
fileList,
|
|
13479
13526
|
{ skipIfNoStaged: true }
|
|
13480
13527
|
);
|
|
13481
|
-
console.
|
|
13528
|
+
console.info(`\u2713 Committed ${copiedFiles.length} copied files`);
|
|
13482
13529
|
} catch (commitError) {
|
|
13483
13530
|
console.warn("Failed to commit copied files:", commitError);
|
|
13484
13531
|
}
|
|
13485
13532
|
}
|
|
13486
13533
|
const message = `Programmatic file copy completed. Copied ${copiedFiles.length} files, ${conflicts.length} conflicts detected.`;
|
|
13487
|
-
console.
|
|
13534
|
+
console.info(message);
|
|
13488
13535
|
return {
|
|
13489
13536
|
success: true,
|
|
13490
13537
|
copiedFiles,
|
|
@@ -13509,7 +13556,7 @@ var intelligentMergeStep = workflows.createStep({
|
|
|
13509
13556
|
inputSchema: IntelligentMergeInputSchema,
|
|
13510
13557
|
outputSchema: IntelligentMergeResultSchema,
|
|
13511
13558
|
execute: async ({ inputData, runtimeContext }) => {
|
|
13512
|
-
console.
|
|
13559
|
+
console.info("Intelligent merge step starting...");
|
|
13513
13560
|
const { conflicts, copiedFiles, commitSha, slug, templateDir, branchName } = inputData;
|
|
13514
13561
|
const targetPath = resolveTargetPath(inputData, runtimeContext);
|
|
13515
13562
|
try {
|
|
@@ -13636,8 +13683,8 @@ Template information:
|
|
|
13636
13683
|
const registrableFiles = copiedFiles.filter((f) => registrableKinds.has(f.unit.kind));
|
|
13637
13684
|
const targetMastraIndex = path.resolve(targetPath, "src/mastra/index.ts");
|
|
13638
13685
|
const mastraIndexExists = fs.existsSync(targetMastraIndex);
|
|
13639
|
-
console.
|
|
13640
|
-
console.
|
|
13686
|
+
console.info(`Mastra index exists: ${mastraIndexExists} at ${targetMastraIndex}`);
|
|
13687
|
+
console.info(
|
|
13641
13688
|
"Registrable components:",
|
|
13642
13689
|
registrableFiles.map((f) => `${f.unit.kind}:${f.unit.id}`)
|
|
13643
13690
|
);
|
|
@@ -13651,7 +13698,7 @@ Template information:
|
|
|
13651
13698
|
notes: `Components to register: ${registrableFiles.map((f) => `${f.unit.kind}:${f.unit.id}`).join(", ")}`
|
|
13652
13699
|
});
|
|
13653
13700
|
}
|
|
13654
|
-
console.
|
|
13701
|
+
console.info(`Creating task list with ${tasks.length} tasks...`);
|
|
13655
13702
|
await AgentBuilderDefaults.manageTaskList({ action: "create", tasks });
|
|
13656
13703
|
await logGitState(targetPath, "before intelligent merge");
|
|
13657
13704
|
const prompt = `
|
|
@@ -13703,12 +13750,12 @@ Start by listing your tasks and work through them systematically!
|
|
|
13703
13750
|
for await (const chunk of result.fullStream) {
|
|
13704
13751
|
if (chunk.type === "step-finish" || chunk.type === "step-start") {
|
|
13705
13752
|
const chunkData = "payload" in chunk ? chunk.payload : chunk;
|
|
13706
|
-
console.
|
|
13753
|
+
console.info({
|
|
13707
13754
|
type: chunk.type,
|
|
13708
13755
|
msgId: chunkData.messageId
|
|
13709
13756
|
});
|
|
13710
13757
|
} else {
|
|
13711
|
-
console.
|
|
13758
|
+
console.info(JSON.stringify(chunk, null, 2));
|
|
13712
13759
|
if (chunk.type === "tool-result") {
|
|
13713
13760
|
const chunkData = "payload" in chunk ? chunk.payload : chunk;
|
|
13714
13761
|
if (chunkData.toolName === "manageTaskList") {
|
|
@@ -13722,7 +13769,7 @@ Start by listing your tasks and work through them systematically!
|
|
|
13722
13769
|
content: toolResult.content || "",
|
|
13723
13770
|
notes: toolResult.notes
|
|
13724
13771
|
});
|
|
13725
|
-
console.
|
|
13772
|
+
console.info(`\u{1F4CB} Task completed: ${toolResult.taskId} - ${toolResult.content}`);
|
|
13726
13773
|
}
|
|
13727
13774
|
} catch (parseError) {
|
|
13728
13775
|
console.warn("Failed to parse task management result:", parseError);
|
|
@@ -13777,12 +13824,12 @@ var validationAndFixStep = workflows.createStep({
|
|
|
13777
13824
|
inputSchema: ValidationFixInputSchema,
|
|
13778
13825
|
outputSchema: ValidationFixResultSchema,
|
|
13779
13826
|
execute: async ({ inputData, runtimeContext }) => {
|
|
13780
|
-
console.
|
|
13827
|
+
console.info("Validation and fix step starting...");
|
|
13781
13828
|
const { commitSha, slug, orderedUnits, templateDir, copiedFiles, conflictsResolved, maxIterations = 5 } = inputData;
|
|
13782
13829
|
const targetPath = resolveTargetPath(inputData, runtimeContext);
|
|
13783
13830
|
const hasChanges = copiedFiles.length > 0 || conflictsResolved && conflictsResolved.length > 0;
|
|
13784
13831
|
if (!hasChanges) {
|
|
13785
|
-
console.
|
|
13832
|
+
console.info("\u23ED\uFE0F Skipping validation - no files copied or conflicts resolved");
|
|
13786
13833
|
return {
|
|
13787
13834
|
success: true,
|
|
13788
13835
|
applied: false,
|
|
@@ -13794,7 +13841,7 @@ var validationAndFixStep = workflows.createStep({
|
|
|
13794
13841
|
}
|
|
13795
13842
|
};
|
|
13796
13843
|
}
|
|
13797
|
-
console.
|
|
13844
|
+
console.info(
|
|
13798
13845
|
`\u{1F4CB} Changes detected: ${copiedFiles.length} files copied, ${conflictsResolved?.length || 0} conflicts resolved`
|
|
13799
13846
|
);
|
|
13800
13847
|
let currentIteration = 1;
|
|
@@ -13920,7 +13967,7 @@ Be thorough and methodical. Always use listDirectory to verify actual file exist
|
|
|
13920
13967
|
executeCommand: allTools.executeCommand
|
|
13921
13968
|
}
|
|
13922
13969
|
});
|
|
13923
|
-
console.
|
|
13970
|
+
console.info("Starting validation and fix agent with internal loop...");
|
|
13924
13971
|
let validationResults = {
|
|
13925
13972
|
valid: false,
|
|
13926
13973
|
errorsFixed: 0,
|
|
@@ -13931,7 +13978,7 @@ Be thorough and methodical. Always use listDirectory to verify actual file exist
|
|
|
13931
13978
|
// Store the actual error details
|
|
13932
13979
|
};
|
|
13933
13980
|
while (validationResults.remainingErrors > 0 && currentIteration <= maxIterations) {
|
|
13934
|
-
console.
|
|
13981
|
+
console.info(`
|
|
13935
13982
|
=== Validation Iteration ${currentIteration} ===`);
|
|
13936
13983
|
const iterationPrompt = currentIteration === 1 ? `Please validate the template integration and fix any errors found in the project at ${targetPath}. The template "${slug}" (${commitSha.substring(0, 7)}) was just integrated and may have validation issues that need fixing.
|
|
13937
13984
|
|
|
@@ -13951,13 +13998,13 @@ Previous iterations may have fixed some issues, so start by re-running validateC
|
|
|
13951
13998
|
for await (const chunk of result.fullStream) {
|
|
13952
13999
|
if (chunk.type === "step-finish" || chunk.type === "step-start") {
|
|
13953
14000
|
const chunkData = "payload" in chunk ? chunk.payload : chunk;
|
|
13954
|
-
console.
|
|
14001
|
+
console.info({
|
|
13955
14002
|
type: chunk.type,
|
|
13956
14003
|
msgId: chunkData.messageId,
|
|
13957
14004
|
iteration: currentIteration
|
|
13958
14005
|
});
|
|
13959
14006
|
} else {
|
|
13960
|
-
console.
|
|
14007
|
+
console.info(JSON.stringify(chunk, null, 2));
|
|
13961
14008
|
}
|
|
13962
14009
|
if (chunk.type === "tool-result") {
|
|
13963
14010
|
const chunkData = "payload" in chunk ? chunk.payload : chunk;
|
|
@@ -13966,7 +14013,7 @@ Previous iterations may have fixed some issues, so start by re-running validateC
|
|
|
13966
14013
|
lastValidationResult = toolResult;
|
|
13967
14014
|
if (toolResult?.summary) {
|
|
13968
14015
|
iterationErrors = toolResult.summary.totalErrors || 0;
|
|
13969
|
-
console.
|
|
14016
|
+
console.info(`Iteration ${currentIteration}: Found ${iterationErrors} errors`);
|
|
13970
14017
|
}
|
|
13971
14018
|
}
|
|
13972
14019
|
}
|
|
@@ -13978,12 +14025,12 @@ Previous iterations may have fixed some issues, so start by re-running validateC
|
|
|
13978
14025
|
if (iterationErrors > 0 && lastValidationResult?.errors) {
|
|
13979
14026
|
validationResults.lastValidationErrors = lastValidationResult.errors;
|
|
13980
14027
|
}
|
|
13981
|
-
console.
|
|
14028
|
+
console.info(`Iteration ${currentIteration} complete: ${iterationErrors} errors remaining`);
|
|
13982
14029
|
if (iterationErrors === 0) {
|
|
13983
|
-
console.
|
|
14030
|
+
console.info(`\u2705 All validation issues resolved in ${currentIteration} iterations!`);
|
|
13984
14031
|
break;
|
|
13985
14032
|
} else if (currentIteration >= maxIterations) {
|
|
13986
|
-
console.
|
|
14033
|
+
console.info(`\u26A0\uFE0F Max iterations (${maxIterations}) reached. ${iterationErrors} errors still remaining.`);
|
|
13987
14034
|
break;
|
|
13988
14035
|
}
|
|
13989
14036
|
currentIteration++;
|
|
@@ -14028,7 +14075,7 @@ Previous iterations may have fixed some issues, so start by re-running validateC
|
|
|
14028
14075
|
} finally {
|
|
14029
14076
|
try {
|
|
14030
14077
|
await promises.rm(templateDir, { recursive: true, force: true });
|
|
14031
|
-
console.
|
|
14078
|
+
console.info(`\u2713 Cleaned up template directory: ${templateDir}`);
|
|
14032
14079
|
} catch (cleanupError) {
|
|
14033
14080
|
console.warn("Failed to cleanup template directory:", cleanupError);
|
|
14034
14081
|
}
|
|
@@ -14504,12 +14551,10 @@ var planningIterationStep = workflows.createStep({
|
|
|
14504
14551
|
research,
|
|
14505
14552
|
userAnswers
|
|
14506
14553
|
} = inputData;
|
|
14507
|
-
console.
|
|
14554
|
+
console.info("Starting planning iteration...");
|
|
14508
14555
|
const qaKey = "workflow-builder-qa";
|
|
14509
14556
|
let storedQAPairs = runtimeContext.get(qaKey) || [];
|
|
14510
14557
|
const newAnswers = { ...userAnswers || {}, ...resumeData?.answers || {} };
|
|
14511
|
-
console.log("before", storedQAPairs);
|
|
14512
|
-
console.log("newAnswers", newAnswers);
|
|
14513
14558
|
if (Object.keys(newAnswers).length > 0) {
|
|
14514
14559
|
storedQAPairs = storedQAPairs.map((pair) => {
|
|
14515
14560
|
if (newAnswers[pair.question.id]) {
|
|
@@ -14523,10 +14568,6 @@ var planningIterationStep = workflows.createStep({
|
|
|
14523
14568
|
});
|
|
14524
14569
|
runtimeContext.set(qaKey, storedQAPairs);
|
|
14525
14570
|
}
|
|
14526
|
-
console.log("after", storedQAPairs);
|
|
14527
|
-
console.log(
|
|
14528
|
-
`Current Q&A state: ${storedQAPairs.length} question-answer pairs, ${storedQAPairs.filter((p) => p.answer).length} answered`
|
|
14529
|
-
);
|
|
14530
14571
|
try {
|
|
14531
14572
|
const model = await resolveModel({ runtimeContext });
|
|
14532
14573
|
const planningAgent = new agent.Agent({
|
|
@@ -14574,8 +14615,8 @@ var planningIterationStep = workflows.createStep({
|
|
|
14574
14615
|
};
|
|
14575
14616
|
}
|
|
14576
14617
|
if (planResult.questions && planResult.questions.length > 0 && !planResult.planComplete) {
|
|
14577
|
-
console.
|
|
14578
|
-
console.
|
|
14618
|
+
console.info(`Planning needs user clarification: ${planResult.questions.length} questions`);
|
|
14619
|
+
console.info(planResult.questions);
|
|
14579
14620
|
const newQAPairs = planResult.questions.map((question) => ({
|
|
14580
14621
|
question,
|
|
14581
14622
|
answer: null,
|
|
@@ -14584,7 +14625,7 @@ var planningIterationStep = workflows.createStep({
|
|
|
14584
14625
|
}));
|
|
14585
14626
|
storedQAPairs = [...storedQAPairs, ...newQAPairs];
|
|
14586
14627
|
runtimeContext.set(qaKey, storedQAPairs);
|
|
14587
|
-
console.
|
|
14628
|
+
console.info(
|
|
14588
14629
|
`Updated Q&A state: ${storedQAPairs.length} total question-answer pairs, ${storedQAPairs.filter((p) => p.answer).length} answered`
|
|
14589
14630
|
);
|
|
14590
14631
|
return suspend({
|
|
@@ -14596,9 +14637,9 @@ var planningIterationStep = workflows.createStep({
|
|
|
14596
14637
|
}
|
|
14597
14638
|
});
|
|
14598
14639
|
}
|
|
14599
|
-
console.
|
|
14640
|
+
console.info(`Planning complete with ${planResult.tasks.length} tasks`);
|
|
14600
14641
|
runtimeContext.set(qaKey, storedQAPairs);
|
|
14601
|
-
console.
|
|
14642
|
+
console.info(
|
|
14602
14643
|
`Final Q&A state: ${storedQAPairs.length} total question-answer pairs, ${storedQAPairs.filter((p) => p.answer).length} answered`
|
|
14603
14644
|
);
|
|
14604
14645
|
return {
|
|
@@ -14641,7 +14682,7 @@ var taskApprovalStep = workflows.createStep({
|
|
|
14641
14682
|
execute: async ({ inputData, resumeData, suspend }) => {
|
|
14642
14683
|
const { tasks } = inputData;
|
|
14643
14684
|
if (!resumeData?.approved && resumeData?.approved !== false) {
|
|
14644
|
-
console.
|
|
14685
|
+
console.info(`Requesting user approval for ${tasks.length} tasks`);
|
|
14645
14686
|
const summary = `Task List for Approval:
|
|
14646
14687
|
|
|
14647
14688
|
${tasks.length} tasks planned:
|
|
@@ -14654,14 +14695,14 @@ ${tasks.map((task, i) => `${i + 1}. [${task.priority.toUpperCase()}] ${task.cont
|
|
|
14654
14695
|
});
|
|
14655
14696
|
}
|
|
14656
14697
|
if (resumeData.approved) {
|
|
14657
|
-
console.
|
|
14698
|
+
console.info("Task list approved by user");
|
|
14658
14699
|
return {
|
|
14659
14700
|
approved: true,
|
|
14660
14701
|
tasks,
|
|
14661
14702
|
message: "Task list approved, ready for execution"
|
|
14662
14703
|
};
|
|
14663
14704
|
} else {
|
|
14664
|
-
console.
|
|
14705
|
+
console.info("Task list rejected by user");
|
|
14665
14706
|
return {
|
|
14666
14707
|
approved: false,
|
|
14667
14708
|
tasks,
|
|
@@ -14678,7 +14719,7 @@ var planningAndApprovalWorkflow = workflows.createWorkflow({
|
|
|
14678
14719
|
outputSchema: TaskApprovalOutputSchema,
|
|
14679
14720
|
steps: [planningIterationStep, taskApprovalStep]
|
|
14680
14721
|
}).dountil(planningIterationStep, async ({ inputData }) => {
|
|
14681
|
-
console.
|
|
14722
|
+
console.info(`Sub-workflow planning check: planComplete=${inputData.planComplete}`);
|
|
14682
14723
|
return inputData.planComplete === true;
|
|
14683
14724
|
}).map(async ({ inputData }) => {
|
|
14684
14725
|
return {
|
|
@@ -15129,12 +15170,12 @@ var workflowDiscoveryStep = workflows.createStep({
|
|
|
15129
15170
|
inputSchema: WorkflowBuilderInputSchema,
|
|
15130
15171
|
outputSchema: WorkflowDiscoveryResultSchema,
|
|
15131
15172
|
execute: async ({ inputData, runtimeContext: _runtimeContext }) => {
|
|
15132
|
-
console.
|
|
15173
|
+
console.info("Starting workflow discovery...");
|
|
15133
15174
|
const { projectPath = process.cwd() } = inputData;
|
|
15134
15175
|
try {
|
|
15135
15176
|
const workflowsPath = path.join(projectPath, "src/mastra/workflows");
|
|
15136
15177
|
if (!fs.existsSync(workflowsPath)) {
|
|
15137
|
-
console.
|
|
15178
|
+
console.info("No workflows directory found");
|
|
15138
15179
|
return {
|
|
15139
15180
|
success: true,
|
|
15140
15181
|
workflows: [],
|
|
@@ -15163,7 +15204,7 @@ var workflowDiscoveryStep = workflows.createStep({
|
|
|
15163
15204
|
}
|
|
15164
15205
|
}
|
|
15165
15206
|
}
|
|
15166
|
-
console.
|
|
15207
|
+
console.info(`Discovered ${workflows.length} existing workflows`);
|
|
15167
15208
|
return {
|
|
15168
15209
|
success: true,
|
|
15169
15210
|
workflows,
|
|
@@ -15188,7 +15229,7 @@ var projectDiscoveryStep = workflows.createStep({
|
|
|
15188
15229
|
inputSchema: WorkflowDiscoveryResultSchema,
|
|
15189
15230
|
outputSchema: ProjectDiscoveryResultSchema,
|
|
15190
15231
|
execute: async ({ inputData: _inputData, runtimeContext: _runtimeContext }) => {
|
|
15191
|
-
console.
|
|
15232
|
+
console.info("Starting project discovery...");
|
|
15192
15233
|
try {
|
|
15193
15234
|
const projectPath = process.cwd();
|
|
15194
15235
|
const projectStructure = {
|
|
@@ -15209,7 +15250,7 @@ var projectDiscoveryStep = workflows.createStep({
|
|
|
15209
15250
|
console.warn("Failed to read package.json:", error);
|
|
15210
15251
|
}
|
|
15211
15252
|
}
|
|
15212
|
-
console.
|
|
15253
|
+
console.info("Project discovery completed");
|
|
15213
15254
|
return {
|
|
15214
15255
|
success: true,
|
|
15215
15256
|
structure: {
|
|
@@ -15250,7 +15291,7 @@ var workflowResearchStep = workflows.createStep({
|
|
|
15250
15291
|
inputSchema: ProjectDiscoveryResultSchema,
|
|
15251
15292
|
outputSchema: WorkflowResearchResultSchema,
|
|
15252
15293
|
execute: async ({ inputData, runtimeContext }) => {
|
|
15253
|
-
console.
|
|
15294
|
+
console.info("Starting workflow research...");
|
|
15254
15295
|
try {
|
|
15255
15296
|
const model = await resolveModel({ runtimeContext });
|
|
15256
15297
|
const researchAgent = new agent.Agent({
|
|
@@ -15282,7 +15323,7 @@ var workflowResearchStep = workflows.createStep({
|
|
|
15282
15323
|
error: "Research agent failed to generate valid response"
|
|
15283
15324
|
};
|
|
15284
15325
|
}
|
|
15285
|
-
console.
|
|
15326
|
+
console.info("Research completed successfully");
|
|
15286
15327
|
return {
|
|
15287
15328
|
success: true,
|
|
15288
15329
|
documentation: {
|
|
@@ -15326,12 +15367,12 @@ var taskExecutionStep = workflows.createStep({
|
|
|
15326
15367
|
research,
|
|
15327
15368
|
projectPath
|
|
15328
15369
|
} = inputData;
|
|
15329
|
-
console.
|
|
15330
|
-
console.
|
|
15370
|
+
console.info(`Starting task execution for ${action}ing workflow: ${workflowName}`);
|
|
15371
|
+
console.info(`Executing ${tasks.length} tasks using AgentBuilder stream...`);
|
|
15331
15372
|
try {
|
|
15332
15373
|
const model = await resolveModel({ runtimeContext });
|
|
15333
15374
|
const currentProjectPath = projectPath || process.cwd();
|
|
15334
|
-
console.
|
|
15375
|
+
console.info("Pre-populating taskManager with planned tasks...");
|
|
15335
15376
|
const taskManagerContext = {
|
|
15336
15377
|
action: "create",
|
|
15337
15378
|
tasks: tasks.map((task) => ({
|
|
@@ -15344,7 +15385,7 @@ var taskExecutionStep = workflows.createStep({
|
|
|
15344
15385
|
}))
|
|
15345
15386
|
};
|
|
15346
15387
|
const taskManagerResult = await AgentBuilderDefaults.manageTaskList(taskManagerContext);
|
|
15347
|
-
console.
|
|
15388
|
+
console.info(`Task manager initialized with ${taskManagerResult.tasks.length} tasks`);
|
|
15348
15389
|
if (!taskManagerResult.success) {
|
|
15349
15390
|
throw new Error(`Failed to initialize task manager: ${taskManagerResult.message}`);
|
|
15350
15391
|
}
|
|
@@ -15397,13 +15438,13 @@ ${additionalInstructions}`;
|
|
|
15397
15438
|
const currentTaskStatus = await AgentBuilderDefaults.manageTaskList({ action: "list" });
|
|
15398
15439
|
const completedTasks = currentTaskStatus.tasks.filter((task) => task.status === "completed");
|
|
15399
15440
|
const pendingTasks = currentTaskStatus.tasks.filter((task) => task.status !== "completed");
|
|
15400
|
-
console.
|
|
15441
|
+
console.info(`
|
|
15401
15442
|
=== EXECUTION ITERATION ${iterationCount} ===`);
|
|
15402
|
-
console.
|
|
15403
|
-
console.
|
|
15443
|
+
console.info(`Completed tasks: ${completedTasks.length}/${expectedTaskIds.length}`);
|
|
15444
|
+
console.info(`Remaining tasks: ${pendingTasks.map((t2) => t2.id).join(", ")}`);
|
|
15404
15445
|
allTasksCompleted = pendingTasks.length === 0;
|
|
15405
15446
|
if (allTasksCompleted) {
|
|
15406
|
-
console.
|
|
15447
|
+
console.info("All tasks completed! Breaking execution loop.");
|
|
15407
15448
|
break;
|
|
15408
15449
|
}
|
|
15409
15450
|
const iterationPrompt = iterationCount === 1 ? executionPrompt : `${workflowBuilderPrompts.executionAgent.iterationPrompt({
|
|
@@ -15427,19 +15468,19 @@ ${workflowBuilderPrompts.validation.instructions}`;
|
|
|
15427
15468
|
finalMessage += chunk.payload.text;
|
|
15428
15469
|
}
|
|
15429
15470
|
if (chunk.type === "step-finish") {
|
|
15430
|
-
console.
|
|
15471
|
+
console.info(finalMessage);
|
|
15431
15472
|
finalMessage = "";
|
|
15432
15473
|
}
|
|
15433
15474
|
if (chunk.type === "tool-result") {
|
|
15434
|
-
console.
|
|
15475
|
+
console.info(JSON.stringify(chunk, null, 2));
|
|
15435
15476
|
}
|
|
15436
15477
|
if (chunk.type === "finish") {
|
|
15437
|
-
console.
|
|
15478
|
+
console.info(chunk);
|
|
15438
15479
|
}
|
|
15439
15480
|
}
|
|
15440
15481
|
await stream.consumeStream();
|
|
15441
15482
|
finalResult = await stream.object;
|
|
15442
|
-
console.
|
|
15483
|
+
console.info(`Iteration ${iterationCount} result:`, { finalResult });
|
|
15443
15484
|
if (!finalResult) {
|
|
15444
15485
|
throw new Error(`No result received from agent execution on iteration ${iterationCount}`);
|
|
15445
15486
|
}
|
|
@@ -15447,17 +15488,17 @@ ${workflowBuilderPrompts.validation.instructions}`;
|
|
|
15447
15488
|
const postCompletedTasks = postIterationTaskStatus.tasks.filter((task) => task.status === "completed");
|
|
15448
15489
|
const postPendingTasks = postIterationTaskStatus.tasks.filter((task) => task.status !== "completed");
|
|
15449
15490
|
allTasksCompleted = postPendingTasks.length === 0;
|
|
15450
|
-
console.
|
|
15491
|
+
console.info(
|
|
15451
15492
|
`After iteration ${iterationCount}: ${postCompletedTasks.length}/${expectedTaskIds.length} tasks completed in taskManager`
|
|
15452
15493
|
);
|
|
15453
15494
|
if (finalResult.status === "needs_clarification" && finalResult.questions && finalResult.questions.length > 0) {
|
|
15454
|
-
console.
|
|
15495
|
+
console.info(
|
|
15455
15496
|
`Agent needs clarification on iteration ${iterationCount}: ${finalResult.questions.length} questions`
|
|
15456
15497
|
);
|
|
15457
15498
|
break;
|
|
15458
15499
|
}
|
|
15459
15500
|
if (finalResult.status === "completed" && !allTasksCompleted) {
|
|
15460
|
-
console.
|
|
15501
|
+
console.info(
|
|
15461
15502
|
`Agent claimed completion but taskManager shows pending tasks: ${postPendingTasks.map((t2) => t2.id).join(", ")}`
|
|
15462
15503
|
);
|
|
15463
15504
|
}
|
|
@@ -15470,8 +15511,8 @@ ${workflowBuilderPrompts.validation.instructions}`;
|
|
|
15470
15511
|
throw new Error("No result received from agent execution");
|
|
15471
15512
|
}
|
|
15472
15513
|
if (finalResult.status === "needs_clarification" && finalResult.questions && finalResult.questions.length > 0) {
|
|
15473
|
-
console.
|
|
15474
|
-
console.
|
|
15514
|
+
console.info(`Agent needs clarification: ${finalResult.questions.length} questions`);
|
|
15515
|
+
console.info("finalResult", JSON.stringify(finalResult, null, 2));
|
|
15475
15516
|
return suspend({
|
|
15476
15517
|
questions: finalResult.questions,
|
|
15477
15518
|
currentProgress: finalResult.progress,
|
|
@@ -15487,7 +15528,7 @@ ${workflowBuilderPrompts.validation.instructions}`;
|
|
|
15487
15528
|
const finalAllTasksCompleted = finalPendingTasks.length === 0;
|
|
15488
15529
|
const success = finalAllTasksCompleted && !finalResult.error;
|
|
15489
15530
|
const message = success ? `Successfully completed workflow ${action} - all ${tasksExpected} tasks completed after ${iterationCount} iteration(s): ${finalResult.message}` : `Workflow execution finished with issues after ${iterationCount} iteration(s): ${finalResult.message}. Completed: ${tasksCompleted}/${tasksExpected} tasks`;
|
|
15490
|
-
console.
|
|
15531
|
+
console.info(message);
|
|
15491
15532
|
const missingTasks = finalPendingTasks.map((task) => task.id);
|
|
15492
15533
|
const validationErrors = [];
|
|
15493
15534
|
if (finalResult.error) {
|
|
@@ -15555,7 +15596,7 @@ var workflowBuilderWorkflow = workflows.createWorkflow({
|
|
|
15555
15596
|
userAnswers: void 0
|
|
15556
15597
|
};
|
|
15557
15598
|
}).dountil(planningAndApprovalWorkflow, async ({ inputData }) => {
|
|
15558
|
-
console.
|
|
15599
|
+
console.info(`Sub-workflow check: approved=${inputData.approved}`);
|
|
15559
15600
|
return inputData.approved === true;
|
|
15560
15601
|
}).map(async ({ getStepResult, getInitData }) => {
|
|
15561
15602
|
const initData = getInitData();
|
|
@@ -15587,8 +15628,8 @@ function createAgentBuilderWorkflowHandler(workflowHandlerFn, logMessage) {
|
|
|
15587
15628
|
const mastra = actionArgs.mastra;
|
|
15588
15629
|
const logger = mastra.getLogger();
|
|
15589
15630
|
try {
|
|
15590
|
-
|
|
15591
|
-
if (actionId && !
|
|
15631
|
+
chunkGDWMF6SB_cjs.WorkflowRegistry.registerTemporaryWorkflows(agentBuilderWorkflows, mastra);
|
|
15632
|
+
if (actionId && !chunkGDWMF6SB_cjs.WorkflowRegistry.isAgentBuilderWorkflow(actionId)) {
|
|
15592
15633
|
throw new chunk7NADHFD2_cjs.HTTPException(400, {
|
|
15593
15634
|
message: `Invalid agent-builder action: ${actionId}. Valid actions are: ${Object.keys(agentBuilderWorkflows).join(", ")}`
|
|
15594
15635
|
});
|
|
@@ -15603,7 +15644,7 @@ function createAgentBuilderWorkflowHandler(workflowHandlerFn, logMessage) {
|
|
|
15603
15644
|
const result = await workflowHandlerFn(handlerArgs);
|
|
15604
15645
|
return result;
|
|
15605
15646
|
} finally {
|
|
15606
|
-
|
|
15647
|
+
chunkGDWMF6SB_cjs.WorkflowRegistry.cleanup();
|
|
15607
15648
|
}
|
|
15608
15649
|
} catch (error) {
|
|
15609
15650
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
@@ -15617,10 +15658,10 @@ function createAgentBuilderWorkflowHandler(workflowHandlerFn, logMessage) {
|
|
|
15617
15658
|
}
|
|
15618
15659
|
var getAgentBuilderActionsHandler = createAgentBuilderWorkflowHandler(async () => {
|
|
15619
15660
|
try {
|
|
15620
|
-
const registryWorkflows =
|
|
15661
|
+
const registryWorkflows = chunkGDWMF6SB_cjs.WorkflowRegistry.getAllWorkflows();
|
|
15621
15662
|
const _workflows = Object.entries(registryWorkflows).reduce(
|
|
15622
15663
|
(acc, [key, workflow]) => {
|
|
15623
|
-
acc[key] =
|
|
15664
|
+
acc[key] = chunkGDWMF6SB_cjs.getWorkflowInfo(workflow);
|
|
15624
15665
|
return acc;
|
|
15625
15666
|
},
|
|
15626
15667
|
{}
|
|
@@ -15631,59 +15672,59 @@ var getAgentBuilderActionsHandler = createAgentBuilderWorkflowHandler(async () =
|
|
|
15631
15672
|
}
|
|
15632
15673
|
}, "Getting agent builder actions");
|
|
15633
15674
|
var getAgentBuilderActionByIdHandler = createAgentBuilderWorkflowHandler(
|
|
15634
|
-
|
|
15675
|
+
chunk57HWW2TY_cjs.getWorkflowByIdHandler,
|
|
15635
15676
|
"Getting agent builder action by ID"
|
|
15636
15677
|
);
|
|
15637
15678
|
var getAgentBuilderActionRunByIdHandler = createAgentBuilderWorkflowHandler(
|
|
15638
|
-
|
|
15679
|
+
chunk57HWW2TY_cjs.getWorkflowRunByIdHandler,
|
|
15639
15680
|
"Getting agent builder action run by ID"
|
|
15640
15681
|
);
|
|
15641
15682
|
var getAgentBuilderActionRunExecutionResultHandler = createAgentBuilderWorkflowHandler(
|
|
15642
|
-
|
|
15683
|
+
chunk57HWW2TY_cjs.getWorkflowRunExecutionResultHandler,
|
|
15643
15684
|
"Getting agent builder action run execution result"
|
|
15644
15685
|
);
|
|
15645
15686
|
var createAgentBuilderActionRunHandler = createAgentBuilderWorkflowHandler(
|
|
15646
|
-
|
|
15687
|
+
chunk57HWW2TY_cjs.createWorkflowRunHandler,
|
|
15647
15688
|
"Creating agent builder action run"
|
|
15648
15689
|
);
|
|
15649
15690
|
var startAsyncAgentBuilderActionHandler = createAgentBuilderWorkflowHandler(
|
|
15650
|
-
|
|
15691
|
+
chunk57HWW2TY_cjs.startAsyncWorkflowHandler,
|
|
15651
15692
|
"Starting async agent builder action"
|
|
15652
15693
|
);
|
|
15653
15694
|
var startAgentBuilderActionRunHandler = createAgentBuilderWorkflowHandler(
|
|
15654
|
-
|
|
15695
|
+
chunk57HWW2TY_cjs.startWorkflowRunHandler,
|
|
15655
15696
|
"Starting agent builder action run"
|
|
15656
15697
|
);
|
|
15657
15698
|
var watchAgentBuilderActionHandler = createAgentBuilderWorkflowHandler(
|
|
15658
|
-
|
|
15699
|
+
chunk57HWW2TY_cjs.watchWorkflowHandler,
|
|
15659
15700
|
"Watching agent builder action"
|
|
15660
15701
|
);
|
|
15661
15702
|
var streamAgentBuilderActionHandler = createAgentBuilderWorkflowHandler(
|
|
15662
|
-
|
|
15703
|
+
chunk57HWW2TY_cjs.streamWorkflowHandler,
|
|
15663
15704
|
"Streaming agent builder action"
|
|
15664
15705
|
);
|
|
15665
15706
|
var streamVNextAgentBuilderActionHandler = createAgentBuilderWorkflowHandler(
|
|
15666
|
-
|
|
15707
|
+
chunk57HWW2TY_cjs.streamVNextWorkflowHandler,
|
|
15667
15708
|
"Streaming VNext agent builder action"
|
|
15668
15709
|
);
|
|
15669
15710
|
var resumeAsyncAgentBuilderActionHandler = createAgentBuilderWorkflowHandler(
|
|
15670
|
-
|
|
15711
|
+
chunk57HWW2TY_cjs.resumeAsyncWorkflowHandler,
|
|
15671
15712
|
"Resuming async agent builder action"
|
|
15672
15713
|
);
|
|
15673
15714
|
var resumeAgentBuilderActionHandler = createAgentBuilderWorkflowHandler(
|
|
15674
|
-
|
|
15715
|
+
chunk57HWW2TY_cjs.resumeWorkflowHandler,
|
|
15675
15716
|
"Resuming agent builder action"
|
|
15676
15717
|
);
|
|
15677
15718
|
var getAgentBuilderActionRunsHandler = createAgentBuilderWorkflowHandler(
|
|
15678
|
-
|
|
15719
|
+
chunk57HWW2TY_cjs.getWorkflowRunsHandler,
|
|
15679
15720
|
"Getting agent builder action runs"
|
|
15680
15721
|
);
|
|
15681
15722
|
var cancelAgentBuilderActionRunHandler = createAgentBuilderWorkflowHandler(
|
|
15682
|
-
|
|
15723
|
+
chunk57HWW2TY_cjs.cancelWorkflowRunHandler,
|
|
15683
15724
|
"Cancelling agent builder action run"
|
|
15684
15725
|
);
|
|
15685
15726
|
var sendAgentBuilderActionRunEventHandler = createAgentBuilderWorkflowHandler(
|
|
15686
|
-
|
|
15727
|
+
chunk57HWW2TY_cjs.sendWorkflowRunEventHandler,
|
|
15687
15728
|
"Sending agent builder action run event"
|
|
15688
15729
|
);
|
|
15689
15730
|
|
|
@@ -15703,5 +15744,5 @@ exports.startAsyncAgentBuilderActionHandler = startAsyncAgentBuilderActionHandle
|
|
|
15703
15744
|
exports.streamAgentBuilderActionHandler = streamAgentBuilderActionHandler;
|
|
15704
15745
|
exports.streamVNextAgentBuilderActionHandler = streamVNextAgentBuilderActionHandler;
|
|
15705
15746
|
exports.watchAgentBuilderActionHandler = watchAgentBuilderActionHandler;
|
|
15706
|
-
//# sourceMappingURL=chunk-
|
|
15707
|
-
//# sourceMappingURL=chunk-
|
|
15747
|
+
//# sourceMappingURL=chunk-PLNQ4XER.cjs.map
|
|
15748
|
+
//# sourceMappingURL=chunk-PLNQ4XER.cjs.map
|