create-mastra 0.1.0-alpha.30 → 0.1.0-alpha.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +92 -409
- package/dist/index.js.map +1 -1
- package/dist/starter-files/tools.ts +1 -1
- package/dist/starter-files/workflow.ts +1 -1
- package/dist/templates/dev.entry.js +5 -5
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -779,313 +779,11 @@ function yoctoSpinner(options) {
|
|
|
779
779
|
return new YoctoSpinner(options);
|
|
780
780
|
}
|
|
781
781
|
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
}
|
|
788
|
-
i.done ? t(u) : Promise.resolve(u).then(r, o);
|
|
789
|
-
}
|
|
790
|
-
function _asyncToGenerator(n) {
|
|
791
|
-
return function() {
|
|
792
|
-
var t = this, e = arguments;
|
|
793
|
-
return new Promise(function(r, o) {
|
|
794
|
-
var a = n.apply(t, e);
|
|
795
|
-
function _next(n2) {
|
|
796
|
-
asyncGeneratorStep(a, r, o, _next, _throw, "next", n2);
|
|
797
|
-
}
|
|
798
|
-
function _throw(n2) {
|
|
799
|
-
asyncGeneratorStep(a, r, o, _next, _throw, "throw", n2);
|
|
800
|
-
}
|
|
801
|
-
_next(undefined);
|
|
802
|
-
});
|
|
803
|
-
};
|
|
804
|
-
}
|
|
805
|
-
function _regeneratorRuntime() {
|
|
806
|
-
_regeneratorRuntime = function() {
|
|
807
|
-
return e;
|
|
808
|
-
};
|
|
809
|
-
var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function(t2, e2, r2) {
|
|
810
|
-
t2[e2] = r2.value;
|
|
811
|
-
}, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag";
|
|
812
|
-
function define(t2, e2, r2) {
|
|
813
|
-
return Object.defineProperty(t2, e2, {
|
|
814
|
-
value: r2,
|
|
815
|
-
enumerable: true,
|
|
816
|
-
configurable: true,
|
|
817
|
-
writable: true
|
|
818
|
-
}), t2[e2];
|
|
819
|
-
}
|
|
820
|
-
try {
|
|
821
|
-
define({}, "");
|
|
822
|
-
} catch (t2) {
|
|
823
|
-
define = function(t3, e2, r2) {
|
|
824
|
-
return t3[e2] = r2;
|
|
825
|
-
};
|
|
826
|
-
}
|
|
827
|
-
function wrap(t2, e2, r2, n2) {
|
|
828
|
-
var i2 = e2 && e2.prototype instanceof Generator ? e2 : Generator, a2 = Object.create(i2.prototype), c2 = new Context(n2 || []);
|
|
829
|
-
return o(a2, "_invoke", {
|
|
830
|
-
value: makeInvokeMethod(t2, r2, c2)
|
|
831
|
-
}), a2;
|
|
832
|
-
}
|
|
833
|
-
function tryCatch(t2, e2, r2) {
|
|
834
|
-
try {
|
|
835
|
-
return {
|
|
836
|
-
type: "normal",
|
|
837
|
-
arg: t2.call(e2, r2)
|
|
838
|
-
};
|
|
839
|
-
} catch (t3) {
|
|
840
|
-
return {
|
|
841
|
-
type: "throw",
|
|
842
|
-
arg: t3
|
|
843
|
-
};
|
|
844
|
-
}
|
|
845
|
-
}
|
|
846
|
-
e.wrap = wrap;
|
|
847
|
-
var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {};
|
|
848
|
-
function Generator() {
|
|
849
|
-
}
|
|
850
|
-
function GeneratorFunction() {
|
|
851
|
-
}
|
|
852
|
-
function GeneratorFunctionPrototype() {
|
|
853
|
-
}
|
|
854
|
-
var p = {};
|
|
855
|
-
define(p, a, function() {
|
|
856
|
-
return this;
|
|
857
|
-
});
|
|
858
|
-
var d = Object.getPrototypeOf, v = d && d(d(values([])));
|
|
859
|
-
v && v !== r && n.call(v, a) && (p = v);
|
|
860
|
-
var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
|
|
861
|
-
function defineIteratorMethods(t2) {
|
|
862
|
-
["next", "throw", "return"].forEach(function(e2) {
|
|
863
|
-
define(t2, e2, function(t3) {
|
|
864
|
-
return this._invoke(e2, t3);
|
|
865
|
-
});
|
|
866
|
-
});
|
|
867
|
-
}
|
|
868
|
-
function AsyncIterator(t2, e2) {
|
|
869
|
-
function invoke(r3, o2, i2, a2) {
|
|
870
|
-
var c2 = tryCatch(t2[r3], t2, o2);
|
|
871
|
-
if ("throw" !== c2.type) {
|
|
872
|
-
var u2 = c2.arg, h2 = u2.value;
|
|
873
|
-
return h2 && "object" == typeof h2 && n.call(h2, "__await") ? e2.resolve(h2.__await).then(function(t3) {
|
|
874
|
-
invoke("next", t3, i2, a2);
|
|
875
|
-
}, function(t3) {
|
|
876
|
-
invoke("throw", t3, i2, a2);
|
|
877
|
-
}) : e2.resolve(h2).then(function(t3) {
|
|
878
|
-
u2.value = t3, i2(u2);
|
|
879
|
-
}, function(t3) {
|
|
880
|
-
return invoke("throw", t3, i2, a2);
|
|
881
|
-
});
|
|
882
|
-
}
|
|
883
|
-
a2(c2.arg);
|
|
884
|
-
}
|
|
885
|
-
var r2;
|
|
886
|
-
o(this, "_invoke", {
|
|
887
|
-
value: function(t3, n2) {
|
|
888
|
-
function callInvokeWithMethodAndArg() {
|
|
889
|
-
return new e2(function(e3, r3) {
|
|
890
|
-
invoke(t3, n2, e3, r3);
|
|
891
|
-
});
|
|
892
|
-
}
|
|
893
|
-
return r2 = r2 ? r2.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
894
|
-
}
|
|
895
|
-
});
|
|
896
|
-
}
|
|
897
|
-
function makeInvokeMethod(e2, r2, n2) {
|
|
898
|
-
var o2 = h;
|
|
899
|
-
return function(i2, a2) {
|
|
900
|
-
if (o2 === f) throw Error("Generator is already running");
|
|
901
|
-
if (o2 === s) {
|
|
902
|
-
if ("throw" === i2) throw a2;
|
|
903
|
-
return {
|
|
904
|
-
value: t,
|
|
905
|
-
done: true
|
|
906
|
-
};
|
|
907
|
-
}
|
|
908
|
-
for (n2.method = i2, n2.arg = a2; ; ) {
|
|
909
|
-
var c2 = n2.delegate;
|
|
910
|
-
if (c2) {
|
|
911
|
-
var u2 = maybeInvokeDelegate(c2, n2);
|
|
912
|
-
if (u2) {
|
|
913
|
-
if (u2 === y) continue;
|
|
914
|
-
return u2;
|
|
915
|
-
}
|
|
916
|
-
}
|
|
917
|
-
if ("next" === n2.method) n2.sent = n2._sent = n2.arg;
|
|
918
|
-
else if ("throw" === n2.method) {
|
|
919
|
-
if (o2 === h) throw o2 = s, n2.arg;
|
|
920
|
-
n2.dispatchException(n2.arg);
|
|
921
|
-
} else "return" === n2.method && n2.abrupt("return", n2.arg);
|
|
922
|
-
o2 = f;
|
|
923
|
-
var p2 = tryCatch(e2, r2, n2);
|
|
924
|
-
if ("normal" === p2.type) {
|
|
925
|
-
if (o2 = n2.done ? s : l, p2.arg === y) continue;
|
|
926
|
-
return {
|
|
927
|
-
value: p2.arg,
|
|
928
|
-
done: n2.done
|
|
929
|
-
};
|
|
930
|
-
}
|
|
931
|
-
"throw" === p2.type && (o2 = s, n2.method = "throw", n2.arg = p2.arg);
|
|
932
|
-
}
|
|
933
|
-
};
|
|
934
|
-
}
|
|
935
|
-
function maybeInvokeDelegate(e2, r2) {
|
|
936
|
-
var n2 = r2.method, o2 = e2.iterator[n2];
|
|
937
|
-
if (o2 === t) return r2.delegate = null, "throw" === n2 && e2.iterator.return && (r2.method = "return", r2.arg = t, maybeInvokeDelegate(e2, r2), "throw" === r2.method) || "return" !== n2 && (r2.method = "throw", r2.arg = new TypeError("The iterator does not provide a '" + n2 + "' method")), y;
|
|
938
|
-
var i2 = tryCatch(o2, e2.iterator, r2.arg);
|
|
939
|
-
if ("throw" === i2.type) return r2.method = "throw", r2.arg = i2.arg, r2.delegate = null, y;
|
|
940
|
-
var a2 = i2.arg;
|
|
941
|
-
return a2 ? a2.done ? (r2[e2.resultName] = a2.value, r2.next = e2.nextLoc, "return" !== r2.method && (r2.method = "next", r2.arg = t), r2.delegate = null, y) : a2 : (r2.method = "throw", r2.arg = new TypeError("iterator result is not an object"), r2.delegate = null, y);
|
|
942
|
-
}
|
|
943
|
-
function pushTryEntry(t2) {
|
|
944
|
-
var e2 = {
|
|
945
|
-
tryLoc: t2[0]
|
|
946
|
-
};
|
|
947
|
-
1 in t2 && (e2.catchLoc = t2[1]), 2 in t2 && (e2.finallyLoc = t2[2], e2.afterLoc = t2[3]), this.tryEntries.push(e2);
|
|
948
|
-
}
|
|
949
|
-
function resetTryEntry(t2) {
|
|
950
|
-
var e2 = t2.completion || {};
|
|
951
|
-
e2.type = "normal", delete e2.arg, t2.completion = e2;
|
|
952
|
-
}
|
|
953
|
-
function Context(t2) {
|
|
954
|
-
this.tryEntries = [{
|
|
955
|
-
tryLoc: "root"
|
|
956
|
-
}], t2.forEach(pushTryEntry, this), this.reset(true);
|
|
957
|
-
}
|
|
958
|
-
function values(e2) {
|
|
959
|
-
if (e2 || "" === e2) {
|
|
960
|
-
var r2 = e2[a];
|
|
961
|
-
if (r2) return r2.call(e2);
|
|
962
|
-
if ("function" == typeof e2.next) return e2;
|
|
963
|
-
if (!isNaN(e2.length)) {
|
|
964
|
-
var o2 = -1, i2 = function next() {
|
|
965
|
-
for (; ++o2 < e2.length; ) if (n.call(e2, o2)) return next.value = e2[o2], next.done = false, next;
|
|
966
|
-
return next.value = t, next.done = true, next;
|
|
967
|
-
};
|
|
968
|
-
return i2.next = i2;
|
|
969
|
-
}
|
|
970
|
-
}
|
|
971
|
-
throw new TypeError(typeof e2 + " is not iterable");
|
|
972
|
-
}
|
|
973
|
-
return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
|
|
974
|
-
value: GeneratorFunctionPrototype,
|
|
975
|
-
configurable: true
|
|
976
|
-
}), o(GeneratorFunctionPrototype, "constructor", {
|
|
977
|
-
value: GeneratorFunction,
|
|
978
|
-
configurable: true
|
|
979
|
-
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function(t2) {
|
|
980
|
-
var e2 = "function" == typeof t2 && t2.constructor;
|
|
981
|
-
return !!e2 && (e2 === GeneratorFunction || "GeneratorFunction" === (e2.displayName || e2.name));
|
|
982
|
-
}, e.mark = function(t2) {
|
|
983
|
-
return Object.setPrototypeOf ? Object.setPrototypeOf(t2, GeneratorFunctionPrototype) : (t2.__proto__ = GeneratorFunctionPrototype, define(t2, u, "GeneratorFunction")), t2.prototype = Object.create(g), t2;
|
|
984
|
-
}, e.awrap = function(t2) {
|
|
985
|
-
return {
|
|
986
|
-
__await: t2
|
|
987
|
-
};
|
|
988
|
-
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function() {
|
|
989
|
-
return this;
|
|
990
|
-
}), e.AsyncIterator = AsyncIterator, e.async = function(t2, r2, n2, o2, i2) {
|
|
991
|
-
undefined === i2 && (i2 = Promise);
|
|
992
|
-
var a2 = new AsyncIterator(wrap(t2, r2, n2, o2), i2);
|
|
993
|
-
return e.isGeneratorFunction(r2) ? a2 : a2.next().then(function(t3) {
|
|
994
|
-
return t3.done ? t3.value : a2.next();
|
|
995
|
-
});
|
|
996
|
-
}, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function() {
|
|
997
|
-
return this;
|
|
998
|
-
}), define(g, "toString", function() {
|
|
999
|
-
return "[object Generator]";
|
|
1000
|
-
}), e.keys = function(t2) {
|
|
1001
|
-
var e2 = Object(t2), r2 = [];
|
|
1002
|
-
for (var n2 in e2) r2.push(n2);
|
|
1003
|
-
return r2.reverse(), function next() {
|
|
1004
|
-
for (; r2.length; ) {
|
|
1005
|
-
var t3 = r2.pop();
|
|
1006
|
-
if (t3 in e2) return next.value = t3, next.done = false, next;
|
|
1007
|
-
}
|
|
1008
|
-
return next.done = true, next;
|
|
1009
|
-
};
|
|
1010
|
-
}, e.values = values, Context.prototype = {
|
|
1011
|
-
constructor: Context,
|
|
1012
|
-
reset: function(e2) {
|
|
1013
|
-
if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = false, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e2) for (var r2 in this) "t" === r2.charAt(0) && n.call(this, r2) && !isNaN(+r2.slice(1)) && (this[r2] = t);
|
|
1014
|
-
},
|
|
1015
|
-
stop: function() {
|
|
1016
|
-
this.done = true;
|
|
1017
|
-
var t2 = this.tryEntries[0].completion;
|
|
1018
|
-
if ("throw" === t2.type) throw t2.arg;
|
|
1019
|
-
return this.rval;
|
|
1020
|
-
},
|
|
1021
|
-
dispatchException: function(e2) {
|
|
1022
|
-
if (this.done) throw e2;
|
|
1023
|
-
var r2 = this;
|
|
1024
|
-
function handle(n2, o3) {
|
|
1025
|
-
return a2.type = "throw", a2.arg = e2, r2.next = n2, o3 && (r2.method = "next", r2.arg = t), !!o3;
|
|
1026
|
-
}
|
|
1027
|
-
for (var o2 = this.tryEntries.length - 1; o2 >= 0; --o2) {
|
|
1028
|
-
var i2 = this.tryEntries[o2], a2 = i2.completion;
|
|
1029
|
-
if ("root" === i2.tryLoc) return handle("end");
|
|
1030
|
-
if (i2.tryLoc <= this.prev) {
|
|
1031
|
-
var c2 = n.call(i2, "catchLoc"), u2 = n.call(i2, "finallyLoc");
|
|
1032
|
-
if (c2 && u2) {
|
|
1033
|
-
if (this.prev < i2.catchLoc) return handle(i2.catchLoc, true);
|
|
1034
|
-
if (this.prev < i2.finallyLoc) return handle(i2.finallyLoc);
|
|
1035
|
-
} else if (c2) {
|
|
1036
|
-
if (this.prev < i2.catchLoc) return handle(i2.catchLoc, true);
|
|
1037
|
-
} else {
|
|
1038
|
-
if (!u2) throw Error("try statement without catch or finally");
|
|
1039
|
-
if (this.prev < i2.finallyLoc) return handle(i2.finallyLoc);
|
|
1040
|
-
}
|
|
1041
|
-
}
|
|
1042
|
-
}
|
|
1043
|
-
},
|
|
1044
|
-
abrupt: function(t2, e2) {
|
|
1045
|
-
for (var r2 = this.tryEntries.length - 1; r2 >= 0; --r2) {
|
|
1046
|
-
var o2 = this.tryEntries[r2];
|
|
1047
|
-
if (o2.tryLoc <= this.prev && n.call(o2, "finallyLoc") && this.prev < o2.finallyLoc) {
|
|
1048
|
-
var i2 = o2;
|
|
1049
|
-
break;
|
|
1050
|
-
}
|
|
1051
|
-
}
|
|
1052
|
-
i2 && ("break" === t2 || "continue" === t2) && i2.tryLoc <= e2 && e2 <= i2.finallyLoc && (i2 = null);
|
|
1053
|
-
var a2 = i2 ? i2.completion : {};
|
|
1054
|
-
return a2.type = t2, a2.arg = e2, i2 ? (this.method = "next", this.next = i2.finallyLoc, y) : this.complete(a2);
|
|
1055
|
-
},
|
|
1056
|
-
complete: function(t2, e2) {
|
|
1057
|
-
if ("throw" === t2.type) throw t2.arg;
|
|
1058
|
-
return "break" === t2.type || "continue" === t2.type ? this.next = t2.arg : "return" === t2.type ? (this.rval = this.arg = t2.arg, this.method = "return", this.next = "end") : "normal" === t2.type && e2 && (this.next = e2), y;
|
|
1059
|
-
},
|
|
1060
|
-
finish: function(t2) {
|
|
1061
|
-
for (var e2 = this.tryEntries.length - 1; e2 >= 0; --e2) {
|
|
1062
|
-
var r2 = this.tryEntries[e2];
|
|
1063
|
-
if (r2.finallyLoc === t2) return this.complete(r2.completion, r2.afterLoc), resetTryEntry(r2), y;
|
|
1064
|
-
}
|
|
1065
|
-
},
|
|
1066
|
-
catch: function(t2) {
|
|
1067
|
-
for (var e2 = this.tryEntries.length - 1; e2 >= 0; --e2) {
|
|
1068
|
-
var r2 = this.tryEntries[e2];
|
|
1069
|
-
if (r2.tryLoc === t2) {
|
|
1070
|
-
var n2 = r2.completion;
|
|
1071
|
-
if ("throw" === n2.type) {
|
|
1072
|
-
var o2 = n2.arg;
|
|
1073
|
-
resetTryEntry(r2);
|
|
1074
|
-
}
|
|
1075
|
-
return o2;
|
|
1076
|
-
}
|
|
1077
|
-
}
|
|
1078
|
-
throw Error("illegal catch attempt");
|
|
1079
|
-
},
|
|
1080
|
-
delegateYield: function(e2, r2, n2) {
|
|
1081
|
-
return this.delegate = {
|
|
1082
|
-
iterator: values(e2),
|
|
1083
|
-
resultName: r2,
|
|
1084
|
-
nextLoc: n2
|
|
1085
|
-
}, "next" === this.method && (this.arg = t), y;
|
|
1086
|
-
}
|
|
1087
|
-
}, e;
|
|
1088
|
-
}
|
|
782
|
+
var __defProp = Object.defineProperty;
|
|
783
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
784
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
785
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
786
|
+
|
|
1089
787
|
var LogLevel = {
|
|
1090
788
|
DEBUG: "debug",
|
|
1091
789
|
INFO: "info",
|
|
@@ -1093,131 +791,116 @@ var LogLevel = {
|
|
|
1093
791
|
ERROR: "error",
|
|
1094
792
|
NONE: "silent"
|
|
1095
793
|
};
|
|
1096
|
-
var
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
794
|
+
var _LoggerTransport = class _LoggerTransport2 extends Transform {
|
|
795
|
+
async getLogsByRunId({ runId }) {
|
|
796
|
+
console.log(runId);
|
|
797
|
+
return [];
|
|
798
|
+
}
|
|
799
|
+
async getLogs() {
|
|
800
|
+
return [];
|
|
801
|
+
}
|
|
802
|
+
};
|
|
803
|
+
__name(_LoggerTransport, "LoggerTransport");
|
|
804
|
+
var _Logger = class _Logger2 {
|
|
805
|
+
constructor(options = {}) {
|
|
806
|
+
__publicField(this, "logger");
|
|
807
|
+
__publicField(this, "transports");
|
|
1104
808
|
this.transports = options.transports || {};
|
|
1105
|
-
|
|
809
|
+
const transportsAry = Object.entries(this.transports);
|
|
1106
810
|
this.logger = pino({
|
|
1107
811
|
name: options.name || "app",
|
|
1108
812
|
level: options.level || LogLevel.INFO
|
|
1109
|
-
}, options.overrideDefaultTransports ?
|
|
813
|
+
}, options.overrideDefaultTransports ? options?.transports?.default : transportsAry.length === 0 ? pretty({
|
|
1110
814
|
colorize: true,
|
|
1111
815
|
levelFirst: true,
|
|
1112
816
|
ignore: "pid,hostname",
|
|
1113
817
|
colorizeObjects: true,
|
|
1114
818
|
translateTime: "SYS:standard",
|
|
1115
819
|
singleLine: false
|
|
1116
|
-
}) : pino.multistream([
|
|
1117
|
-
|
|
1118
|
-
return {
|
|
820
|
+
}) : pino.multistream([
|
|
821
|
+
...transportsAry.map(([_, transport]) => ({
|
|
1119
822
|
stream: transport,
|
|
1120
823
|
level: options.level || LogLevel.INFO
|
|
1121
|
-
}
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
824
|
+
})),
|
|
825
|
+
{
|
|
826
|
+
stream: pretty({
|
|
827
|
+
colorize: true,
|
|
828
|
+
levelFirst: true,
|
|
829
|
+
ignore: "pid,hostname",
|
|
830
|
+
colorizeObjects: true,
|
|
831
|
+
translateTime: "SYS:standard",
|
|
832
|
+
singleLine: false
|
|
833
|
+
}),
|
|
834
|
+
level: options.level || LogLevel.INFO
|
|
835
|
+
}
|
|
836
|
+
]));
|
|
1133
837
|
}
|
|
1134
|
-
|
|
1135
|
-
_proto2.debug = function debug2(message, args) {
|
|
1136
|
-
if (args === undefined) {
|
|
1137
|
-
args = {};
|
|
1138
|
-
}
|
|
838
|
+
debug(message, args = {}) {
|
|
1139
839
|
this.logger.debug(args, message);
|
|
1140
|
-
}
|
|
1141
|
-
|
|
1142
|
-
if (args === undefined) {
|
|
1143
|
-
args = {};
|
|
1144
|
-
}
|
|
840
|
+
}
|
|
841
|
+
info(message, args = {}) {
|
|
1145
842
|
this.logger.info(args, message);
|
|
1146
|
-
}
|
|
1147
|
-
|
|
1148
|
-
if (args === undefined) {
|
|
1149
|
-
args = {};
|
|
1150
|
-
}
|
|
843
|
+
}
|
|
844
|
+
warn(message, args = {}) {
|
|
1151
845
|
this.logger.warn(args, message);
|
|
1152
|
-
}
|
|
1153
|
-
|
|
1154
|
-
if (args === undefined) {
|
|
1155
|
-
args = {};
|
|
1156
|
-
}
|
|
846
|
+
}
|
|
847
|
+
error(message, args = {}) {
|
|
1157
848
|
this.logger.error(args, message);
|
|
1158
|
-
}
|
|
1159
|
-
|
|
1160
|
-
|
|
849
|
+
}
|
|
850
|
+
// Stream creation for process output handling
|
|
851
|
+
createStream() {
|
|
1161
852
|
return new Transform({
|
|
1162
|
-
transform:
|
|
1163
|
-
|
|
853
|
+
transform: /* @__PURE__ */ __name((chunk, _encoding, callback) => {
|
|
854
|
+
const line = chunk.toString().trim();
|
|
1164
855
|
if (line) {
|
|
1165
|
-
|
|
856
|
+
this.info(line);
|
|
1166
857
|
}
|
|
1167
858
|
callback(null, chunk);
|
|
1168
|
-
}
|
|
859
|
+
}, "transform")
|
|
1169
860
|
});
|
|
1170
|
-
}
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
return
|
|
1174
|
-
while (1) switch (_context3.prev = _context3.next) {
|
|
1175
|
-
case 0:
|
|
1176
|
-
if (!(!transportId || !this.transports[transportId])) {
|
|
1177
|
-
_context3.next = 2;
|
|
1178
|
-
break;
|
|
1179
|
-
}
|
|
1180
|
-
return _context3.abrupt("return", []);
|
|
1181
|
-
case 2:
|
|
1182
|
-
return _context3.abrupt("return", this.transports[transportId].getLogs());
|
|
1183
|
-
case 3:
|
|
1184
|
-
case "end":
|
|
1185
|
-
return _context3.stop();
|
|
1186
|
-
}
|
|
1187
|
-
}, _callee3, this);
|
|
1188
|
-
}));
|
|
1189
|
-
function getLogs(_x2) {
|
|
1190
|
-
return _getLogs2.apply(this, arguments);
|
|
1191
|
-
}
|
|
1192
|
-
return getLogs;
|
|
1193
|
-
}();
|
|
1194
|
-
_proto2.getLogsByRunId = /* @__PURE__ */ function() {
|
|
1195
|
-
var _getLogsByRunId2 = /* @__PURE__ */ _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee4(_ref3) {
|
|
1196
|
-
var _this$transports$tran;
|
|
1197
|
-
var runId, transportId;
|
|
1198
|
-
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
1199
|
-
while (1) switch (_context4.prev = _context4.next) {
|
|
1200
|
-
case 0:
|
|
1201
|
-
runId = _ref3.runId, transportId = _ref3.transportId;
|
|
1202
|
-
return _context4.abrupt("return", (_this$transports$tran = this.transports[transportId]) == null ? undefined : _this$transports$tran.getLogsByRunId({
|
|
1203
|
-
runId
|
|
1204
|
-
}));
|
|
1205
|
-
case 2:
|
|
1206
|
-
case "end":
|
|
1207
|
-
return _context4.stop();
|
|
1208
|
-
}
|
|
1209
|
-
}, _callee4, this);
|
|
1210
|
-
}));
|
|
1211
|
-
function getLogsByRunId(_x3) {
|
|
1212
|
-
return _getLogsByRunId2.apply(this, arguments);
|
|
861
|
+
}
|
|
862
|
+
async getLogs(transportId) {
|
|
863
|
+
if (!transportId || !this.transports[transportId]) {
|
|
864
|
+
return [];
|
|
1213
865
|
}
|
|
1214
|
-
return
|
|
1215
|
-
}
|
|
1216
|
-
|
|
1217
|
-
|
|
866
|
+
return this.transports[transportId].getLogs();
|
|
867
|
+
}
|
|
868
|
+
async getLogsByRunId({ runId, transportId }) {
|
|
869
|
+
return this.transports[transportId]?.getLogsByRunId({
|
|
870
|
+
runId
|
|
871
|
+
});
|
|
872
|
+
}
|
|
873
|
+
};
|
|
874
|
+
__name(_Logger, "Logger");
|
|
875
|
+
var Logger = _Logger;
|
|
1218
876
|
function createLogger(options) {
|
|
1219
877
|
return new Logger(options);
|
|
1220
878
|
}
|
|
879
|
+
__name(createLogger, "createLogger");
|
|
880
|
+
var _MultiLogger = class _MultiLogger2 {
|
|
881
|
+
constructor(loggers) {
|
|
882
|
+
__publicField(this, "loggers");
|
|
883
|
+
this.loggers = loggers;
|
|
884
|
+
}
|
|
885
|
+
debug(message, ...args) {
|
|
886
|
+
this.loggers.forEach((logger) => logger.debug(message, ...args));
|
|
887
|
+
}
|
|
888
|
+
info(message, ...args) {
|
|
889
|
+
this.loggers.forEach((logger) => logger.info(message, ...args));
|
|
890
|
+
}
|
|
891
|
+
warn(message, ...args) {
|
|
892
|
+
this.loggers.forEach((logger) => logger.warn(message, ...args));
|
|
893
|
+
}
|
|
894
|
+
error(message, ...args) {
|
|
895
|
+
this.loggers.forEach((logger) => logger.error(message, ...args));
|
|
896
|
+
}
|
|
897
|
+
};
|
|
898
|
+
__name(_MultiLogger, "MultiLogger");
|
|
899
|
+
var MultiLogger = _MultiLogger;
|
|
900
|
+
function combineLoggers(loggers) {
|
|
901
|
+
return new MultiLogger(loggers);
|
|
902
|
+
}
|
|
903
|
+
__name(combineLoggers, "combineLoggers");
|
|
1221
904
|
|
|
1222
905
|
var DepsService = class {
|
|
1223
906
|
packageManager;
|
|
@@ -1441,7 +1124,7 @@ async function writeAgentSample(llmProvider, destPath, addExampleTool) {
|
|
|
1441
1124
|
${addExampleTool ? "Use the weatherTool to fetch current weather data." : ""}
|
|
1442
1125
|
`;
|
|
1443
1126
|
const content = `
|
|
1444
|
-
import { Agent } from '@mastra/core';
|
|
1127
|
+
import { Agent } from '@mastra/core/agent';
|
|
1445
1128
|
${addExampleTool ? `import { weatherTool } from '../tools';` : ""}
|
|
1446
1129
|
|
|
1447
1130
|
export const weatherAgent = new Agent({
|
|
@@ -1510,7 +1193,7 @@ export const mastra = new Mastra()
|
|
|
1510
1193
|
await fs4.writeFile(
|
|
1511
1194
|
destPath,
|
|
1512
1195
|
`
|
|
1513
|
-
import { Mastra } from '@mastra/core';
|
|
1196
|
+
import { Mastra } from '@mastra/core/mastra';
|
|
1514
1197
|
import { createLogger } from '@mastra/core/logger';
|
|
1515
1198
|
${addWorkflow ? `import { weatherWorkflow } from './workflows';` : ""}
|
|
1516
1199
|
${addAgent ? `import { weatherAgent } from './agents';` : ""}
|
|
@@ -1817,7 +1500,7 @@ program.name("create-mastra").description("Create a new Mastra project").option(
|
|
|
1817
1500
|
return;
|
|
1818
1501
|
}
|
|
1819
1502
|
await create({
|
|
1820
|
-
components: args.components,
|
|
1503
|
+
components: args.components ? args.components.split(",") : [],
|
|
1821
1504
|
llmProvider: args.llm,
|
|
1822
1505
|
addExample: args.example,
|
|
1823
1506
|
llmApiKey: args["llm-api-key"]
|