@mastra/core 0.0.0-commonjs-20250227130920
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/LICENSE +21 -0
- package/README.md +180 -0
- package/dist/agent/index.cjs +1865 -0
- package/dist/agent/index.d.cts +15 -0
- package/dist/agent/index.d.ts +15 -0
- package/dist/agent/index.js +1 -0
- package/dist/base-D90KQ4XI.d.ts +139 -0
- package/dist/base-hs9NDAZ2.d.cts +139 -0
- package/dist/base-nKCMCNrM.d.ts +920 -0
- package/dist/base-nhesrHv3.d.cts +920 -0
- package/dist/base.cjs +138 -0
- package/dist/base.d.cts +6 -0
- package/dist/base.d.ts +6 -0
- package/dist/base.js +1 -0
- package/dist/bundler/index.cjs +158 -0
- package/dist/bundler/index.d.cts +28 -0
- package/dist/bundler/index.d.ts +28 -0
- package/dist/bundler/index.js +1 -0
- package/dist/chunk-33GSTUNK.js +620 -0
- package/dist/chunk-4YRYBCOZ.js +10 -0
- package/dist/chunk-55NFNRKO.js +10 -0
- package/dist/chunk-5XPCMNGW.js +215 -0
- package/dist/chunk-B3M27AMP.js +1479 -0
- package/dist/chunk-BB4KXGBU.js +83 -0
- package/dist/chunk-C6A6W6XS.js +77 -0
- package/dist/chunk-HQ55LN2U.js +318 -0
- package/dist/chunk-KNVTCZW7.js +416 -0
- package/dist/chunk-LH47WVJL.js +61 -0
- package/dist/chunk-NGD2HQYW.js +346 -0
- package/dist/chunk-NUDAZEOG.js +35 -0
- package/dist/chunk-OZ4XVJ6F.js +49 -0
- package/dist/chunk-PHMSPCTC.js +145 -0
- package/dist/chunk-PNZK456O.js +88 -0
- package/dist/chunk-QAAJAHDB.js +37 -0
- package/dist/chunk-RG66XEJT.js +8 -0
- package/dist/chunk-SIFBBGY6.js +190 -0
- package/dist/chunk-SVEAENO7.js +22 -0
- package/dist/chunk-SY5244IR.js +1499 -0
- package/dist/chunk-W5HVJX45.js +402 -0
- package/dist/chunk-WIBGG4X6.js +173 -0
- package/dist/chunk-ZDWFBE5L.js +1 -0
- package/dist/chunk-ZINPRHAN.js +22 -0
- package/dist/deployer/index.cjs +165 -0
- package/dist/deployer/index.d.cts +19 -0
- package/dist/deployer/index.d.ts +19 -0
- package/dist/deployer/index.js +1 -0
- package/dist/eval/index.cjs +110 -0
- package/dist/eval/index.d.cts +28 -0
- package/dist/eval/index.d.ts +28 -0
- package/dist/eval/index.js +1 -0
- package/dist/filter/index.cjs +192 -0
- package/dist/filter/index.d.cts +90 -0
- package/dist/filter/index.d.ts +90 -0
- package/dist/filter/index.js +1 -0
- package/dist/hooks/index.cjs +87 -0
- package/dist/hooks/index.d.cts +33 -0
- package/dist/hooks/index.d.ts +33 -0
- package/dist/hooks/index.js +1 -0
- package/dist/index-mKY1XrpK.d.cts +90 -0
- package/dist/index-mKY1XrpK.d.ts +90 -0
- package/dist/index.cjs +6844 -0
- package/dist/index.d.cts +97 -0
- package/dist/index.d.ts +97 -0
- package/dist/index.js +119 -0
- package/dist/integration/index.cjs +113 -0
- package/dist/integration/index.d.cts +52 -0
- package/dist/integration/index.d.ts +52 -0
- package/dist/integration/index.js +1 -0
- package/dist/llm/index.cjs +2 -0
- package/dist/llm/index.d.cts +15 -0
- package/dist/llm/index.d.ts +15 -0
- package/dist/llm/index.js +1 -0
- package/dist/logger/index.cjs +159 -0
- package/dist/logger/index.d.cts +3 -0
- package/dist/logger/index.d.ts +3 -0
- package/dist/logger/index.js +1 -0
- package/dist/mastra/index.cjs +1741 -0
- package/dist/mastra/index.d.cts +67 -0
- package/dist/mastra/index.d.ts +67 -0
- package/dist/mastra/index.js +1 -0
- package/dist/memory/index.cjs +1907 -0
- package/dist/memory/index.d.cts +15 -0
- package/dist/memory/index.d.ts +15 -0
- package/dist/memory/index.js +1 -0
- package/dist/relevance/index.cjs +1927 -0
- package/dist/relevance/index.d.cts +21 -0
- package/dist/relevance/index.d.ts +21 -0
- package/dist/relevance/index.js +1 -0
- package/dist/storage/index.cjs +361 -0
- package/dist/storage/index.d.cts +15 -0
- package/dist/storage/index.d.ts +15 -0
- package/dist/storage/index.js +2 -0
- package/dist/storage/libsql/index.cjs +770 -0
- package/dist/storage/libsql/index.d.cts +81 -0
- package/dist/storage/libsql/index.d.ts +81 -0
- package/dist/storage/libsql/index.js +1 -0
- package/dist/telemetry/index.cjs +413 -0
- package/dist/telemetry/index.d.cts +51 -0
- package/dist/telemetry/index.d.ts +51 -0
- package/dist/telemetry/index.js +1 -0
- package/dist/telemetry/otel-vendor.cjs +52 -0
- package/dist/telemetry/otel-vendor.d.cts +7 -0
- package/dist/telemetry/otel-vendor.d.ts +7 -0
- package/dist/telemetry/otel-vendor.js +7 -0
- package/dist/tools/index.cjs +25 -0
- package/dist/tools/index.d.cts +29 -0
- package/dist/tools/index.d.ts +29 -0
- package/dist/tools/index.js +1 -0
- package/dist/tts/index.cjs +328 -0
- package/dist/tts/index.d.cts +28 -0
- package/dist/tts/index.d.ts +28 -0
- package/dist/tts/index.js +1 -0
- package/dist/types-m9RryK9a.d.cts +14 -0
- package/dist/types-m9RryK9a.d.ts +14 -0
- package/dist/utils.cjs +179 -0
- package/dist/utils.d.cts +26 -0
- package/dist/utils.d.ts +26 -0
- package/dist/utils.js +1 -0
- package/dist/vector/index.cjs +145 -0
- package/dist/vector/index.d.cts +30 -0
- package/dist/vector/index.d.ts +30 -0
- package/dist/vector/index.js +1 -0
- package/dist/vector/libsql/index.cjs +951 -0
- package/dist/vector/libsql/index.d.cts +29 -0
- package/dist/vector/libsql/index.d.ts +29 -0
- package/dist/vector/libsql/index.js +1 -0
- package/dist/voice/index.cjs +369 -0
- package/dist/voice/index.d.cts +67 -0
- package/dist/voice/index.d.ts +67 -0
- package/dist/voice/index.js +76 -0
- package/dist/workflow-DqQ4pON_.d.cts +84 -0
- package/dist/workflow-Ng_F_Zaf.d.ts +84 -0
- package/dist/workflows/index.cjs +1628 -0
- package/dist/workflows/index.d.cts +48 -0
- package/dist/workflows/index.d.ts +48 -0
- package/dist/workflows/index.js +1 -0
- package/package.json +162 -0
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
type BasicOperator = '$eq' | '$ne';
|
|
2
|
+
type NumericOperator = '$gt' | '$gte' | '$lt' | '$lte';
|
|
3
|
+
type LogicalOperator = '$and' | '$not' | '$nor' | '$or';
|
|
4
|
+
type ArrayOperator = '$all' | '$in' | '$nin' | '$elemMatch';
|
|
5
|
+
type ElementOperator = '$exists';
|
|
6
|
+
type RegexOperator = '$regex' | '$options';
|
|
7
|
+
type QueryOperator = BasicOperator | NumericOperator | LogicalOperator | ArrayOperator | ElementOperator | RegexOperator;
|
|
8
|
+
type OperatorCondition = {
|
|
9
|
+
[K in QueryOperator]?: any;
|
|
10
|
+
};
|
|
11
|
+
type FieldCondition = OperatorCondition | any;
|
|
12
|
+
type Filter = {
|
|
13
|
+
[field: string]: FieldCondition | Filter;
|
|
14
|
+
};
|
|
15
|
+
type OperatorSupport = {
|
|
16
|
+
logical?: LogicalOperator[];
|
|
17
|
+
array?: ArrayOperator[];
|
|
18
|
+
basic?: BasicOperator[];
|
|
19
|
+
numeric?: NumericOperator[];
|
|
20
|
+
element?: ElementOperator[];
|
|
21
|
+
regex?: RegexOperator[];
|
|
22
|
+
custom?: string[];
|
|
23
|
+
};
|
|
24
|
+
declare abstract class BaseFilterTranslator {
|
|
25
|
+
abstract translate(filter: Filter): unknown;
|
|
26
|
+
/**
|
|
27
|
+
* Operator type checks
|
|
28
|
+
*/
|
|
29
|
+
protected isOperator(key: string): key is QueryOperator;
|
|
30
|
+
protected static readonly BASIC_OPERATORS: BasicOperator[];
|
|
31
|
+
protected static readonly NUMERIC_OPERATORS: NumericOperator[];
|
|
32
|
+
protected static readonly ARRAY_OPERATORS: ArrayOperator[];
|
|
33
|
+
protected static readonly LOGICAL_OPERATORS: LogicalOperator[];
|
|
34
|
+
protected static readonly ELEMENT_OPERATORS: ElementOperator[];
|
|
35
|
+
protected static readonly REGEX_OPERATORS: RegexOperator[];
|
|
36
|
+
static readonly DEFAULT_OPERATORS: {
|
|
37
|
+
logical: LogicalOperator[];
|
|
38
|
+
basic: BasicOperator[];
|
|
39
|
+
numeric: NumericOperator[];
|
|
40
|
+
array: ArrayOperator[];
|
|
41
|
+
element: "$exists"[];
|
|
42
|
+
regex: RegexOperator[];
|
|
43
|
+
};
|
|
44
|
+
protected isLogicalOperator(key: string): key is LogicalOperator;
|
|
45
|
+
protected isBasicOperator(key: string): key is BasicOperator;
|
|
46
|
+
protected isNumericOperator(key: string): key is NumericOperator;
|
|
47
|
+
protected isArrayOperator(key: string): key is ArrayOperator;
|
|
48
|
+
protected isElementOperator(key: string): key is ElementOperator;
|
|
49
|
+
protected isRegexOperator(key: string): key is RegexOperator;
|
|
50
|
+
protected isFieldOperator(key: string): key is QueryOperator;
|
|
51
|
+
protected isCustomOperator(key: string): boolean;
|
|
52
|
+
protected getSupportedOperators(): OperatorSupport;
|
|
53
|
+
protected isValidOperator(key: string): boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Value normalization for comparison operators
|
|
56
|
+
*/
|
|
57
|
+
protected normalizeComparisonValue(value: any): any;
|
|
58
|
+
/**
|
|
59
|
+
* Helper method to simulate $all operator using $and + $eq when needed.
|
|
60
|
+
* Some vector stores don't support $all natively.
|
|
61
|
+
*/
|
|
62
|
+
protected simulateAllOperator(field: string, values: any[]): Filter;
|
|
63
|
+
/**
|
|
64
|
+
* Utility functions for type checking
|
|
65
|
+
*/
|
|
66
|
+
protected isPrimitive(value: any): boolean;
|
|
67
|
+
protected isRegex(value: any): boolean;
|
|
68
|
+
protected isEmpty(obj: any): boolean;
|
|
69
|
+
protected static readonly ErrorMessages: {
|
|
70
|
+
readonly UNSUPPORTED_OPERATOR: (op: string) => string;
|
|
71
|
+
readonly INVALID_LOGICAL_OPERATOR_LOCATION: (op: string, path: string) => string;
|
|
72
|
+
readonly NOT_REQUIRES_OBJECT: "$not operator requires an object";
|
|
73
|
+
readonly NOT_CANNOT_BE_EMPTY: "$not operator cannot be empty";
|
|
74
|
+
readonly INVALID_LOGICAL_OPERATOR_CONTENT: (path: string) => string;
|
|
75
|
+
readonly INVALID_TOP_LEVEL_OPERATOR: (op: string) => string;
|
|
76
|
+
readonly ELEM_MATCH_REQUIRES_OBJECT: "$elemMatch requires an object with conditions";
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* Helper to handle array value normalization consistently
|
|
80
|
+
*/
|
|
81
|
+
protected normalizeArrayValues(values: any[]): any[];
|
|
82
|
+
protected validateFilter(filter: Filter): void;
|
|
83
|
+
/**
|
|
84
|
+
* Validates if a filter structure is supported by the specific vector DB
|
|
85
|
+
* and returns detailed validation information.
|
|
86
|
+
*/
|
|
87
|
+
private validateFilterSupport;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export { type ArrayOperator, BaseFilterTranslator, type BasicOperator, type ElementOperator, type FieldCondition, type Filter, type LogicalOperator, type NumericOperator, type OperatorCondition, type OperatorSupport, type QueryOperator, type RegexOperator };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { BaseFilterTranslator } from '../chunk-SIFBBGY6.js';
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// src/hooks/mitt.ts
|
|
4
|
+
function mitt(all) {
|
|
5
|
+
all = all || /* @__PURE__ */ new Map();
|
|
6
|
+
return {
|
|
7
|
+
/**
|
|
8
|
+
* A Map of event names to registered handler functions.
|
|
9
|
+
*/
|
|
10
|
+
all,
|
|
11
|
+
/**
|
|
12
|
+
* Register an event handler for the given type.
|
|
13
|
+
* @param {string|symbol} type Type of event to listen for, or `'*'` for all events
|
|
14
|
+
* @param {Function} handler Function to call in response to given event
|
|
15
|
+
* @memberOf mitt
|
|
16
|
+
*/
|
|
17
|
+
on(type, handler) {
|
|
18
|
+
const handlers = all.get(type);
|
|
19
|
+
if (handlers) {
|
|
20
|
+
handlers.push(handler);
|
|
21
|
+
} else {
|
|
22
|
+
all.set(type, [handler]);
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
/**
|
|
26
|
+
* Remove an event handler for the given type.
|
|
27
|
+
* If `handler` is omitted, all handlers of the given type are removed.
|
|
28
|
+
* @param {string|symbol} type Type of event to unregister `handler` from (`'*'` to remove a wildcard handler)
|
|
29
|
+
* @param {Function} [handler] Handler function to remove
|
|
30
|
+
* @memberOf mitt
|
|
31
|
+
*/
|
|
32
|
+
off(type, handler) {
|
|
33
|
+
const handlers = all.get(type);
|
|
34
|
+
if (handlers) {
|
|
35
|
+
if (handler) {
|
|
36
|
+
handlers.splice(handlers.indexOf(handler) >>> 0, 1);
|
|
37
|
+
} else {
|
|
38
|
+
all.set(type, []);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
/**
|
|
43
|
+
* Invoke all handlers for the given type.
|
|
44
|
+
* If present, `'*'` handlers are invoked after type-matched handlers.
|
|
45
|
+
*
|
|
46
|
+
* Note: Manually firing '*' handlers is not supported.
|
|
47
|
+
*
|
|
48
|
+
* @param {string|symbol} type The event type to invoke
|
|
49
|
+
* @param {Any} [evt] Any value (object is recommended and powerful), passed to each handler
|
|
50
|
+
* @memberOf mitt
|
|
51
|
+
*/
|
|
52
|
+
emit(type, evt) {
|
|
53
|
+
let handlers = all.get(type);
|
|
54
|
+
if (handlers) {
|
|
55
|
+
handlers.slice().map((handler) => {
|
|
56
|
+
handler(evt);
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
handlers = all.get("*");
|
|
60
|
+
if (handlers) {
|
|
61
|
+
handlers.slice().map((handler) => {
|
|
62
|
+
handler(type, evt);
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// src/hooks/index.ts
|
|
70
|
+
var AvailableHooks = /* @__PURE__ */ ((AvailableHooks2) => {
|
|
71
|
+
AvailableHooks2["ON_EVALUATION"] = "onEvaluation";
|
|
72
|
+
AvailableHooks2["ON_GENERATION"] = "onGeneration";
|
|
73
|
+
return AvailableHooks2;
|
|
74
|
+
})(AvailableHooks || {});
|
|
75
|
+
var hooks = mitt();
|
|
76
|
+
function registerHook(hook, action) {
|
|
77
|
+
hooks.on(hook, action);
|
|
78
|
+
}
|
|
79
|
+
function executeHook(hook, data) {
|
|
80
|
+
setImmediate(() => {
|
|
81
|
+
hooks.emit(hook, data);
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
exports.AvailableHooks = AvailableHooks;
|
|
86
|
+
exports.executeHook = executeHook;
|
|
87
|
+
exports.registerHook = registerHook;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { M as MetricResult, T as TestInfo, a as Metric } from '../types-m9RryK9a.cjs';
|
|
2
|
+
|
|
3
|
+
type Handler<T = unknown> = (event: T) => void;
|
|
4
|
+
|
|
5
|
+
declare enum AvailableHooks {
|
|
6
|
+
ON_EVALUATION = "onEvaluation",
|
|
7
|
+
ON_GENERATION = "onGeneration"
|
|
8
|
+
}
|
|
9
|
+
type EvaluationHookData = {
|
|
10
|
+
input: string;
|
|
11
|
+
output: string;
|
|
12
|
+
result: MetricResult;
|
|
13
|
+
agentName: string;
|
|
14
|
+
metricName: string;
|
|
15
|
+
instructions: string;
|
|
16
|
+
runId: string;
|
|
17
|
+
globalRunId: string;
|
|
18
|
+
testInfo?: TestInfo;
|
|
19
|
+
};
|
|
20
|
+
type GenerationHookData = {
|
|
21
|
+
input: string;
|
|
22
|
+
output: string;
|
|
23
|
+
metric: Metric;
|
|
24
|
+
runId: string;
|
|
25
|
+
agentName: string;
|
|
26
|
+
instructions: string;
|
|
27
|
+
};
|
|
28
|
+
declare function registerHook(hook: AvailableHooks.ON_EVALUATION, action: Handler<EvaluationHookData>): void;
|
|
29
|
+
declare function registerHook(hook: AvailableHooks.ON_GENERATION, action: Handler<GenerationHookData>): void;
|
|
30
|
+
declare function executeHook(hook: AvailableHooks.ON_EVALUATION, action: EvaluationHookData): void;
|
|
31
|
+
declare function executeHook(hook: AvailableHooks.ON_GENERATION, action: GenerationHookData): void;
|
|
32
|
+
|
|
33
|
+
export { AvailableHooks, executeHook, registerHook };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { M as MetricResult, T as TestInfo, a as Metric } from '../types-m9RryK9a.js';
|
|
2
|
+
|
|
3
|
+
type Handler<T = unknown> = (event: T) => void;
|
|
4
|
+
|
|
5
|
+
declare enum AvailableHooks {
|
|
6
|
+
ON_EVALUATION = "onEvaluation",
|
|
7
|
+
ON_GENERATION = "onGeneration"
|
|
8
|
+
}
|
|
9
|
+
type EvaluationHookData = {
|
|
10
|
+
input: string;
|
|
11
|
+
output: string;
|
|
12
|
+
result: MetricResult;
|
|
13
|
+
agentName: string;
|
|
14
|
+
metricName: string;
|
|
15
|
+
instructions: string;
|
|
16
|
+
runId: string;
|
|
17
|
+
globalRunId: string;
|
|
18
|
+
testInfo?: TestInfo;
|
|
19
|
+
};
|
|
20
|
+
type GenerationHookData = {
|
|
21
|
+
input: string;
|
|
22
|
+
output: string;
|
|
23
|
+
metric: Metric;
|
|
24
|
+
runId: string;
|
|
25
|
+
agentName: string;
|
|
26
|
+
instructions: string;
|
|
27
|
+
};
|
|
28
|
+
declare function registerHook(hook: AvailableHooks.ON_EVALUATION, action: Handler<EvaluationHookData>): void;
|
|
29
|
+
declare function registerHook(hook: AvailableHooks.ON_GENERATION, action: Handler<GenerationHookData>): void;
|
|
30
|
+
declare function executeHook(hook: AvailableHooks.ON_EVALUATION, action: EvaluationHookData): void;
|
|
31
|
+
declare function executeHook(hook: AvailableHooks.ON_GENERATION, action: GenerationHookData): void;
|
|
32
|
+
|
|
33
|
+
export { AvailableHooks, executeHook, registerHook };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { AvailableHooks, executeHook, registerHook } from '../chunk-BB4KXGBU.js';
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { Transform } from 'stream';
|
|
2
|
+
import pino from 'pino';
|
|
3
|
+
|
|
4
|
+
type RunStatus = 'created' | 'running' | 'completed' | 'failed';
|
|
5
|
+
type Run = {
|
|
6
|
+
runId?: string;
|
|
7
|
+
runStatus?: RunStatus;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
declare const RegisteredLogger: {
|
|
11
|
+
readonly AGENT: "AGENT";
|
|
12
|
+
readonly WORKFLOW: "WORKFLOW";
|
|
13
|
+
readonly LLM: "LLM";
|
|
14
|
+
readonly TTS: "TTS";
|
|
15
|
+
readonly VOICE: "VOICE";
|
|
16
|
+
readonly VECTOR: "VECTOR";
|
|
17
|
+
readonly BUNDLER: "BUNDLER";
|
|
18
|
+
readonly DEPLOYER: "DEPLOYER";
|
|
19
|
+
readonly MEMORY: "MEMORY";
|
|
20
|
+
readonly STORAGE: "STORAGE";
|
|
21
|
+
readonly EMBEDDINGS: "EMBEDDINGS";
|
|
22
|
+
};
|
|
23
|
+
type RegisteredLogger = (typeof RegisteredLogger)[keyof typeof RegisteredLogger];
|
|
24
|
+
declare const LogLevel: {
|
|
25
|
+
readonly DEBUG: "debug";
|
|
26
|
+
readonly INFO: "info";
|
|
27
|
+
readonly WARN: "warn";
|
|
28
|
+
readonly ERROR: "error";
|
|
29
|
+
readonly NONE: "silent";
|
|
30
|
+
};
|
|
31
|
+
type LogLevel = (typeof LogLevel)[keyof typeof LogLevel];
|
|
32
|
+
interface BaseLogMessage extends Run {
|
|
33
|
+
msg: string;
|
|
34
|
+
level: number;
|
|
35
|
+
time: Date;
|
|
36
|
+
pid: number;
|
|
37
|
+
hostname: string;
|
|
38
|
+
name: string;
|
|
39
|
+
}
|
|
40
|
+
declare class LoggerTransport extends Transform {
|
|
41
|
+
constructor(opts?: any);
|
|
42
|
+
getLogsByRunId(_args: {
|
|
43
|
+
runId: string;
|
|
44
|
+
}): Promise<BaseLogMessage[]>;
|
|
45
|
+
getLogs(): Promise<BaseLogMessage[]>;
|
|
46
|
+
}
|
|
47
|
+
type TransportMap = Record<string, LoggerTransport>;
|
|
48
|
+
declare class Logger {
|
|
49
|
+
protected logger: pino.Logger;
|
|
50
|
+
transports: TransportMap;
|
|
51
|
+
constructor(options?: {
|
|
52
|
+
name?: string;
|
|
53
|
+
level?: LogLevel;
|
|
54
|
+
transports?: TransportMap;
|
|
55
|
+
overrideDefaultTransports?: boolean;
|
|
56
|
+
});
|
|
57
|
+
debug(message: string, args?: Record<string, any>): void;
|
|
58
|
+
info(message: string, args?: Record<string, any>): void;
|
|
59
|
+
warn(message: string, args?: Record<string, any>): void;
|
|
60
|
+
error(message: string, args?: Record<string, any>): void;
|
|
61
|
+
createStream(): Transform;
|
|
62
|
+
getLogs(transportId: string): Promise<BaseLogMessage[]>;
|
|
63
|
+
getLogsByRunId({ runId, transportId }: {
|
|
64
|
+
transportId: string;
|
|
65
|
+
runId: string;
|
|
66
|
+
}): Promise<BaseLogMessage[] | undefined>;
|
|
67
|
+
}
|
|
68
|
+
declare function createLogger(options: {
|
|
69
|
+
name?: string;
|
|
70
|
+
level?: LogLevel;
|
|
71
|
+
transports?: TransportMap;
|
|
72
|
+
}): Logger;
|
|
73
|
+
declare class MultiLogger {
|
|
74
|
+
private loggers;
|
|
75
|
+
constructor(loggers: Logger[]);
|
|
76
|
+
debug(message: string, ...args: any[]): void;
|
|
77
|
+
info(message: string, ...args: any[]): void;
|
|
78
|
+
warn(message: string, ...args: any[]): void;
|
|
79
|
+
error(message: string, ...args: any[]): void;
|
|
80
|
+
}
|
|
81
|
+
declare function combineLoggers(loggers: Logger[]): MultiLogger;
|
|
82
|
+
declare const noopLogger: {
|
|
83
|
+
debug: () => void;
|
|
84
|
+
info: () => void;
|
|
85
|
+
warn: () => void;
|
|
86
|
+
error: () => void;
|
|
87
|
+
cleanup: () => Promise<void>;
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
export { type BaseLogMessage as B, Logger as L, MultiLogger as M, RegisteredLogger as R, type TransportMap as T, LogLevel as a, LoggerTransport as b, combineLoggers as c, type Run as d, createLogger as e, noopLogger as n };
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { Transform } from 'stream';
|
|
2
|
+
import pino from 'pino';
|
|
3
|
+
|
|
4
|
+
type RunStatus = 'created' | 'running' | 'completed' | 'failed';
|
|
5
|
+
type Run = {
|
|
6
|
+
runId?: string;
|
|
7
|
+
runStatus?: RunStatus;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
declare const RegisteredLogger: {
|
|
11
|
+
readonly AGENT: "AGENT";
|
|
12
|
+
readonly WORKFLOW: "WORKFLOW";
|
|
13
|
+
readonly LLM: "LLM";
|
|
14
|
+
readonly TTS: "TTS";
|
|
15
|
+
readonly VOICE: "VOICE";
|
|
16
|
+
readonly VECTOR: "VECTOR";
|
|
17
|
+
readonly BUNDLER: "BUNDLER";
|
|
18
|
+
readonly DEPLOYER: "DEPLOYER";
|
|
19
|
+
readonly MEMORY: "MEMORY";
|
|
20
|
+
readonly STORAGE: "STORAGE";
|
|
21
|
+
readonly EMBEDDINGS: "EMBEDDINGS";
|
|
22
|
+
};
|
|
23
|
+
type RegisteredLogger = (typeof RegisteredLogger)[keyof typeof RegisteredLogger];
|
|
24
|
+
declare const LogLevel: {
|
|
25
|
+
readonly DEBUG: "debug";
|
|
26
|
+
readonly INFO: "info";
|
|
27
|
+
readonly WARN: "warn";
|
|
28
|
+
readonly ERROR: "error";
|
|
29
|
+
readonly NONE: "silent";
|
|
30
|
+
};
|
|
31
|
+
type LogLevel = (typeof LogLevel)[keyof typeof LogLevel];
|
|
32
|
+
interface BaseLogMessage extends Run {
|
|
33
|
+
msg: string;
|
|
34
|
+
level: number;
|
|
35
|
+
time: Date;
|
|
36
|
+
pid: number;
|
|
37
|
+
hostname: string;
|
|
38
|
+
name: string;
|
|
39
|
+
}
|
|
40
|
+
declare class LoggerTransport extends Transform {
|
|
41
|
+
constructor(opts?: any);
|
|
42
|
+
getLogsByRunId(_args: {
|
|
43
|
+
runId: string;
|
|
44
|
+
}): Promise<BaseLogMessage[]>;
|
|
45
|
+
getLogs(): Promise<BaseLogMessage[]>;
|
|
46
|
+
}
|
|
47
|
+
type TransportMap = Record<string, LoggerTransport>;
|
|
48
|
+
declare class Logger {
|
|
49
|
+
protected logger: pino.Logger;
|
|
50
|
+
transports: TransportMap;
|
|
51
|
+
constructor(options?: {
|
|
52
|
+
name?: string;
|
|
53
|
+
level?: LogLevel;
|
|
54
|
+
transports?: TransportMap;
|
|
55
|
+
overrideDefaultTransports?: boolean;
|
|
56
|
+
});
|
|
57
|
+
debug(message: string, args?: Record<string, any>): void;
|
|
58
|
+
info(message: string, args?: Record<string, any>): void;
|
|
59
|
+
warn(message: string, args?: Record<string, any>): void;
|
|
60
|
+
error(message: string, args?: Record<string, any>): void;
|
|
61
|
+
createStream(): Transform;
|
|
62
|
+
getLogs(transportId: string): Promise<BaseLogMessage[]>;
|
|
63
|
+
getLogsByRunId({ runId, transportId }: {
|
|
64
|
+
transportId: string;
|
|
65
|
+
runId: string;
|
|
66
|
+
}): Promise<BaseLogMessage[] | undefined>;
|
|
67
|
+
}
|
|
68
|
+
declare function createLogger(options: {
|
|
69
|
+
name?: string;
|
|
70
|
+
level?: LogLevel;
|
|
71
|
+
transports?: TransportMap;
|
|
72
|
+
}): Logger;
|
|
73
|
+
declare class MultiLogger {
|
|
74
|
+
private loggers;
|
|
75
|
+
constructor(loggers: Logger[]);
|
|
76
|
+
debug(message: string, ...args: any[]): void;
|
|
77
|
+
info(message: string, ...args: any[]): void;
|
|
78
|
+
warn(message: string, ...args: any[]): void;
|
|
79
|
+
error(message: string, ...args: any[]): void;
|
|
80
|
+
}
|
|
81
|
+
declare function combineLoggers(loggers: Logger[]): MultiLogger;
|
|
82
|
+
declare const noopLogger: {
|
|
83
|
+
debug: () => void;
|
|
84
|
+
info: () => void;
|
|
85
|
+
warn: () => void;
|
|
86
|
+
error: () => void;
|
|
87
|
+
cleanup: () => Promise<void>;
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
export { type BaseLogMessage as B, Logger as L, MultiLogger as M, RegisteredLogger as R, type TransportMap as T, LogLevel as a, LoggerTransport as b, combineLoggers as c, type Run as d, createLogger as e, noopLogger as n };
|