@mastra/core 0.0.0-storage-20250225005900
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.d.ts +15 -0
- package/dist/agent/index.js +1 -0
- package/dist/base-CHNzbTDj.d.ts +894 -0
- package/dist/base-eWkcLLSb.d.ts +139 -0
- package/dist/base.d.ts +6 -0
- package/dist/base.js +1 -0
- package/dist/bundler/index.d.ts +28 -0
- package/dist/bundler/index.js +1 -0
- package/dist/chunk-4IIE6KIC.js +10 -0
- package/dist/chunk-4ZNSY7J7.js +215 -0
- package/dist/chunk-4ZRHVG25.js +402 -0
- package/dist/chunk-5275WBGX.js +318 -0
- package/dist/chunk-6RDA4JYW.js +49 -0
- package/dist/chunk-BB4KXGBU.js +83 -0
- package/dist/chunk-C6A6W6XS.js +77 -0
- package/dist/chunk-FEBWYMJQ.js +416 -0
- package/dist/chunk-KP5SHTKA.js +145 -0
- package/dist/chunk-N7KZVQDK.js +61 -0
- package/dist/chunk-NDQR6IPC.js +37 -0
- package/dist/chunk-NUDAZEOG.js +35 -0
- package/dist/chunk-ORM3OCHX.js +1367 -0
- package/dist/chunk-PNZK456O.js +88 -0
- package/dist/chunk-QXPUH6PK.js +620 -0
- package/dist/chunk-RG66XEJT.js +8 -0
- package/dist/chunk-SIFBBGY6.js +190 -0
- package/dist/chunk-TCMOYQ74.js +1204 -0
- package/dist/chunk-WIBGG4X6.js +173 -0
- package/dist/chunk-YKDBP67T.js +346 -0
- package/dist/chunk-YUOADWSP.js +22 -0
- package/dist/chunk-Z735LDV7.js +10 -0
- package/dist/chunk-ZDWFBE5L.js +1 -0
- package/dist/chunk-ZINPRHAN.js +22 -0
- package/dist/deployer/index.d.ts +19 -0
- package/dist/deployer/index.js +1 -0
- package/dist/eval/index.d.ts +28 -0
- package/dist/eval/index.js +1 -0
- package/dist/filter/index.d.ts +90 -0
- package/dist/filter/index.js +1 -0
- package/dist/hooks/index.d.ts +33 -0
- package/dist/hooks/index.js +1 -0
- package/dist/index-C5uPdbs4.d.ts +90 -0
- package/dist/index.d.ts +98 -0
- package/dist/index.js +119 -0
- package/dist/integration/index.d.ts +53 -0
- package/dist/integration/index.js +1 -0
- package/dist/llm/index.d.ts +15 -0
- package/dist/llm/index.js +1 -0
- package/dist/logger/index.d.ts +3 -0
- package/dist/logger/index.js +1 -0
- package/dist/mastra/index.d.ts +68 -0
- package/dist/mastra/index.js +1 -0
- package/dist/memory/index.d.ts +15 -0
- package/dist/memory/index.js +1 -0
- package/dist/relevance/index.d.ts +21 -0
- package/dist/relevance/index.js +1 -0
- package/dist/storage/index.d.ts +15 -0
- package/dist/storage/index.js +2 -0
- package/dist/storage/libsql/index.d.ts +81 -0
- package/dist/storage/libsql/index.js +1 -0
- package/dist/telemetry/index.d.ts +51 -0
- package/dist/telemetry/index.js +1 -0
- package/dist/telemetry/otel-vendor.d.ts +7 -0
- package/dist/telemetry/otel-vendor.js +7 -0
- package/dist/tools/index.d.ts +29 -0
- package/dist/tools/index.js +1 -0
- package/dist/tts/index.d.ts +28 -0
- package/dist/tts/index.js +1 -0
- package/dist/types-m9RryK9a.d.ts +14 -0
- package/dist/utils.d.ts +26 -0
- package/dist/utils.js +1 -0
- package/dist/vector/index.d.ts +29 -0
- package/dist/vector/index.js +1 -0
- package/dist/vector/libsql/index.d.ts +29 -0
- package/dist/vector/libsql/index.js +1 -0
- package/dist/voice/index.d.ts +67 -0
- package/dist/voice/index.js +76 -0
- package/dist/workflow-CddifUps.d.ts +92 -0
- package/dist/workflows/index.d.ts +31 -0
- package/dist/workflows/index.js +1 -0
- package/package.json +134 -0
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { M as MastraStorage, T as TABLE_NAMES, S as StorageColumn, b as StorageThreadType, c as MessageType, d as StorageGetMessagesArg, E as EvalRow } from '../../base-CHNzbTDj.js';
|
|
2
|
+
import 'ai';
|
|
3
|
+
import '../../base-eWkcLLSb.js';
|
|
4
|
+
import '@opentelemetry/api';
|
|
5
|
+
import '../../index-C5uPdbs4.js';
|
|
6
|
+
import 'pino';
|
|
7
|
+
import 'stream';
|
|
8
|
+
import '@opentelemetry/sdk-trace-base';
|
|
9
|
+
import '../../types-m9RryK9a.js';
|
|
10
|
+
import 'sift';
|
|
11
|
+
import 'zod';
|
|
12
|
+
import 'json-schema';
|
|
13
|
+
import '../../vector/index.js';
|
|
14
|
+
import '../../voice/index.js';
|
|
15
|
+
import '../../tts/index.js';
|
|
16
|
+
|
|
17
|
+
interface LibSQLConfig {
|
|
18
|
+
url: string;
|
|
19
|
+
authToken?: string;
|
|
20
|
+
}
|
|
21
|
+
declare class LibSQLStore extends MastraStorage {
|
|
22
|
+
private client;
|
|
23
|
+
constructor({ config }: {
|
|
24
|
+
config: LibSQLConfig;
|
|
25
|
+
});
|
|
26
|
+
protected rewriteDbUrl(url: string): string;
|
|
27
|
+
private getCreateTableSQL;
|
|
28
|
+
createTable({ tableName, schema, }: {
|
|
29
|
+
tableName: TABLE_NAMES;
|
|
30
|
+
schema: Record<string, StorageColumn>;
|
|
31
|
+
}): Promise<void>;
|
|
32
|
+
clearTable({ tableName }: {
|
|
33
|
+
tableName: TABLE_NAMES;
|
|
34
|
+
}): Promise<void>;
|
|
35
|
+
private prepareStatement;
|
|
36
|
+
insert({ tableName, record }: {
|
|
37
|
+
tableName: TABLE_NAMES;
|
|
38
|
+
record: Record<string, any>;
|
|
39
|
+
}): Promise<void>;
|
|
40
|
+
batchInsert({ tableName, records }: {
|
|
41
|
+
tableName: TABLE_NAMES;
|
|
42
|
+
records: Record<string, any>[];
|
|
43
|
+
}): Promise<void>;
|
|
44
|
+
load<R>({ tableName, keys }: {
|
|
45
|
+
tableName: TABLE_NAMES;
|
|
46
|
+
keys: Record<string, string>;
|
|
47
|
+
}): Promise<R | null>;
|
|
48
|
+
getThreadById({ threadId }: {
|
|
49
|
+
threadId: string;
|
|
50
|
+
}): Promise<StorageThreadType | null>;
|
|
51
|
+
getThreadsByResourceId({ resourceId }: {
|
|
52
|
+
resourceId: string;
|
|
53
|
+
}): Promise<StorageThreadType[]>;
|
|
54
|
+
saveThread({ thread }: {
|
|
55
|
+
thread: StorageThreadType;
|
|
56
|
+
}): Promise<StorageThreadType>;
|
|
57
|
+
updateThread({ id, title, metadata, }: {
|
|
58
|
+
id: string;
|
|
59
|
+
title: string;
|
|
60
|
+
metadata: Record<string, unknown>;
|
|
61
|
+
}): Promise<StorageThreadType>;
|
|
62
|
+
deleteThread({ threadId }: {
|
|
63
|
+
threadId: string;
|
|
64
|
+
}): Promise<void>;
|
|
65
|
+
private parseRow;
|
|
66
|
+
getMessages<T extends MessageType[]>({ threadId, selectBy }: StorageGetMessagesArg): Promise<T>;
|
|
67
|
+
saveMessages({ messages }: {
|
|
68
|
+
messages: MessageType[];
|
|
69
|
+
}): Promise<MessageType[]>;
|
|
70
|
+
private transformEvalRow;
|
|
71
|
+
getEvalsByAgentName(agentName: string, type?: 'test' | 'live'): Promise<EvalRow[]>;
|
|
72
|
+
getTraces({ name, scope, page, perPage, attributes, }?: {
|
|
73
|
+
name?: string;
|
|
74
|
+
scope?: string;
|
|
75
|
+
page: number;
|
|
76
|
+
perPage: number;
|
|
77
|
+
attributes?: Record<string, string>;
|
|
78
|
+
}): Promise<any[]>;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export { LibSQLStore as DefaultStorage, type LibSQLConfig, LibSQLStore };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { LibSQLStore as DefaultStorage, LibSQLStore } from '../../chunk-FEBWYMJQ.js';
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export { O as OtelConfig, S as SamplingStrategy, T as Telemetry } from '../base-eWkcLLSb.js';
|
|
2
|
+
import { SpanKind } from '@opentelemetry/api';
|
|
3
|
+
import { ExportResult } from '@opentelemetry/core';
|
|
4
|
+
import { SpanExporter, ReadableSpan } from '@opentelemetry/sdk-trace-base';
|
|
5
|
+
import { L as Logger } from '../index-C5uPdbs4.js';
|
|
6
|
+
import { M as MastraStorage } from '../base-CHNzbTDj.js';
|
|
7
|
+
import 'pino';
|
|
8
|
+
import 'stream';
|
|
9
|
+
import 'ai';
|
|
10
|
+
import '../types-m9RryK9a.js';
|
|
11
|
+
import 'sift';
|
|
12
|
+
import 'zod';
|
|
13
|
+
import 'json-schema';
|
|
14
|
+
import '../vector/index.js';
|
|
15
|
+
import '../voice/index.js';
|
|
16
|
+
import '../tts/index.js';
|
|
17
|
+
|
|
18
|
+
declare function withSpan(options: {
|
|
19
|
+
spanName?: string;
|
|
20
|
+
skipIfNoTelemetry?: boolean;
|
|
21
|
+
spanKind?: SpanKind;
|
|
22
|
+
tracerName?: string;
|
|
23
|
+
}): any;
|
|
24
|
+
declare function InstrumentClass(options?: {
|
|
25
|
+
prefix?: string;
|
|
26
|
+
spanKind?: SpanKind;
|
|
27
|
+
excludeMethods?: string[];
|
|
28
|
+
methodFilter?: (methodName: string) => boolean;
|
|
29
|
+
tracerName?: string;
|
|
30
|
+
}): (target: any) => any;
|
|
31
|
+
|
|
32
|
+
declare function hasActiveTelemetry(tracerName?: string): boolean;
|
|
33
|
+
|
|
34
|
+
declare class OTLPTraceExporter implements SpanExporter {
|
|
35
|
+
private storage;
|
|
36
|
+
private queue;
|
|
37
|
+
private serializer;
|
|
38
|
+
private logger;
|
|
39
|
+
private activeFlush;
|
|
40
|
+
constructor({ logger, storage }: {
|
|
41
|
+
logger: Logger;
|
|
42
|
+
storage: MastraStorage;
|
|
43
|
+
});
|
|
44
|
+
export(internalRepresentation: ReadableSpan[], resultCallback: (result: ExportResult) => void): void;
|
|
45
|
+
shutdown(): Promise<void>;
|
|
46
|
+
flush(): Promise<void>;
|
|
47
|
+
forceFlush(): Promise<void>;
|
|
48
|
+
__setLogger(logger: Logger): void;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export { InstrumentClass, OTLPTraceExporter as OTLPStorageExporter, hasActiveTelemetry, withSpan };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { InstrumentClass, OTLPTraceExporter as OTLPStorageExporter, Telemetry, hasActiveTelemetry, withSpan } from '../chunk-4ZRHVG25.js';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { NodeSDK } from '@opentelemetry/sdk-node';
|
|
2
|
+
export { ConsoleSpanExporter } from '@opentelemetry/sdk-trace-node';
|
|
3
|
+
export { getNodeAutoInstrumentations } from '@opentelemetry/auto-instrumentations-node';
|
|
4
|
+
export { ATTR_SERVICE_NAME } from '@opentelemetry/semantic-conventions';
|
|
5
|
+
export { Resource } from '@opentelemetry/resources';
|
|
6
|
+
export { OTLPTraceExporter as OTLPHttpExporter } from '@opentelemetry/exporter-trace-otlp-http';
|
|
7
|
+
export { AlwaysOffSampler, AlwaysOnSampler, ParentBasedSampler, Sampler, TraceIdRatioBasedSampler } from '@opentelemetry/sdk-trace-base';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { NodeSDK } from '@opentelemetry/sdk-node';
|
|
2
|
+
export { ConsoleSpanExporter } from '@opentelemetry/sdk-trace-node';
|
|
3
|
+
export { getNodeAutoInstrumentations } from '@opentelemetry/auto-instrumentations-node';
|
|
4
|
+
export { ATTR_SERVICE_NAME } from '@opentelemetry/semantic-conventions';
|
|
5
|
+
export { Resource } from '@opentelemetry/resources';
|
|
6
|
+
export { OTLPTraceExporter as OTLPHttpExporter } from '@opentelemetry/exporter-trace-otlp-http';
|
|
7
|
+
export { AlwaysOffSampler, AlwaysOnSampler, ParentBasedSampler, TraceIdRatioBasedSampler } from '@opentelemetry/sdk-trace-base';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { o as ToolExecutionContext, m as ToolAction, g as MastraPrimitives } from '../base-CHNzbTDj.js';
|
|
3
|
+
export { U as CoreTool } from '../base-CHNzbTDj.js';
|
|
4
|
+
import 'ai';
|
|
5
|
+
import '../base-eWkcLLSb.js';
|
|
6
|
+
import '@opentelemetry/api';
|
|
7
|
+
import '../index-C5uPdbs4.js';
|
|
8
|
+
import 'pino';
|
|
9
|
+
import 'stream';
|
|
10
|
+
import '@opentelemetry/sdk-trace-base';
|
|
11
|
+
import '../types-m9RryK9a.js';
|
|
12
|
+
import 'sift';
|
|
13
|
+
import 'json-schema';
|
|
14
|
+
import '../vector/index.js';
|
|
15
|
+
import '../voice/index.js';
|
|
16
|
+
import '../tts/index.js';
|
|
17
|
+
|
|
18
|
+
declare class Tool<TId extends string, TSchemaIn extends z.ZodSchema | undefined = undefined, TSchemaOut extends z.ZodSchema | undefined = undefined, TContext extends ToolExecutionContext<TSchemaIn> = ToolExecutionContext<TSchemaIn>> implements ToolAction<TId, TSchemaIn, TSchemaOut, TContext> {
|
|
19
|
+
id: TId;
|
|
20
|
+
description?: string;
|
|
21
|
+
inputSchema?: TSchemaIn;
|
|
22
|
+
outputSchema?: TSchemaOut;
|
|
23
|
+
execute: (context: TContext) => Promise<TSchemaOut extends z.ZodSchema ? z.infer<TSchemaOut> : unknown>;
|
|
24
|
+
mastra?: MastraPrimitives;
|
|
25
|
+
constructor(opts: ToolAction<TId, TSchemaIn, TSchemaOut, TContext>);
|
|
26
|
+
}
|
|
27
|
+
declare function createTool<TId extends string, TSchemaIn extends z.ZodSchema | undefined = undefined, TSchemaOut extends z.ZodSchema | undefined = undefined, TContext extends ToolExecutionContext<TSchemaIn> = ToolExecutionContext<TSchemaIn>>(opts: ToolAction<TId, TSchemaIn, TSchemaOut, TContext>): Tool<TId, TSchemaIn, TSchemaOut, TContext>;
|
|
28
|
+
|
|
29
|
+
export { Tool, ToolAction, ToolExecutionContext, createTool };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Tool, createTool } from '../chunk-ZINPRHAN.js';
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { M as MastraBase } from '../base-eWkcLLSb.js';
|
|
2
|
+
import '@opentelemetry/api';
|
|
3
|
+
import '../index-C5uPdbs4.js';
|
|
4
|
+
import 'pino';
|
|
5
|
+
import 'stream';
|
|
6
|
+
import '@opentelemetry/sdk-trace-base';
|
|
7
|
+
|
|
8
|
+
interface BuiltInModelConfig {
|
|
9
|
+
provider: string;
|
|
10
|
+
name: string;
|
|
11
|
+
apiKey?: string;
|
|
12
|
+
}
|
|
13
|
+
interface TTSConfig {
|
|
14
|
+
model: BuiltInModelConfig;
|
|
15
|
+
}
|
|
16
|
+
declare abstract class MastraTTS extends MastraBase {
|
|
17
|
+
model: BuiltInModelConfig;
|
|
18
|
+
constructor({ model }: TTSConfig);
|
|
19
|
+
traced<T extends Function>(method: T, methodName: string): T;
|
|
20
|
+
abstract generate({ text }: {
|
|
21
|
+
text: string;
|
|
22
|
+
}): Promise<any>;
|
|
23
|
+
abstract stream({ text }: {
|
|
24
|
+
text: string;
|
|
25
|
+
}): Promise<any>;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export { MastraTTS, type TTSConfig };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { MastraTTS } from '../chunk-NDQR6IPC.js';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
interface MetricResult {
|
|
2
|
+
score: number;
|
|
3
|
+
info?: Record<string, any>;
|
|
4
|
+
}
|
|
5
|
+
declare abstract class Metric {
|
|
6
|
+
abstract measure(input: string, output: string): Promise<MetricResult>;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
interface TestInfo {
|
|
10
|
+
testName?: string;
|
|
11
|
+
testPath?: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export { type MetricResult as M, type TestInfo as T, Metric as a };
|
package/dist/utils.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { z, ZodObject } from 'zod';
|
|
2
|
+
|
|
3
|
+
declare const delay: (ms: number) => Promise<unknown>;
|
|
4
|
+
declare function jsonSchemaPropertiesToTSTypes(value: any): z.ZodTypeAny;
|
|
5
|
+
declare function jsonSchemaToModel(jsonSchema: Record<string, any>): ZodObject<any>;
|
|
6
|
+
/**
|
|
7
|
+
* Deep merges two objects, recursively merging nested objects and arrays
|
|
8
|
+
*/
|
|
9
|
+
declare function deepMerge<T extends object = object>(target: T, source: Partial<T>): T;
|
|
10
|
+
interface TagMaskOptions {
|
|
11
|
+
/** Called when masking begins */
|
|
12
|
+
onStart?: () => void;
|
|
13
|
+
/** Called when masking ends */
|
|
14
|
+
onEnd?: () => void;
|
|
15
|
+
/** Called for each chunk that is masked */
|
|
16
|
+
onMask?: (chunk: string) => void;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Transforms a stream by masking content between XML tags.
|
|
20
|
+
* @param stream Input stream to transform
|
|
21
|
+
* @param tag Tag name to mask between (e.g. for <foo>...</foo>, use 'foo')
|
|
22
|
+
* @param options Optional configuration for masking behavior
|
|
23
|
+
*/
|
|
24
|
+
declare function maskStreamTags(stream: AsyncIterable<string>, tag: string, options?: TagMaskOptions): AsyncIterable<string>;
|
|
25
|
+
|
|
26
|
+
export { type TagMaskOptions, deepMerge, delay, jsonSchemaPropertiesToTSTypes, jsonSchemaToModel, maskStreamTags };
|
package/dist/utils.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { deepMerge, delay, jsonSchemaPropertiesToTSTypes, jsonSchemaToModel, maskStreamTags } from './chunk-WIBGG4X6.js';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { M as MastraBase } from '../base-eWkcLLSb.js';
|
|
2
|
+
import '@opentelemetry/api';
|
|
3
|
+
import '../index-C5uPdbs4.js';
|
|
4
|
+
import 'pino';
|
|
5
|
+
import 'stream';
|
|
6
|
+
import '@opentelemetry/sdk-trace-base';
|
|
7
|
+
|
|
8
|
+
interface QueryResult {
|
|
9
|
+
id: string;
|
|
10
|
+
score: number;
|
|
11
|
+
metadata?: Record<string, any>;
|
|
12
|
+
vector?: number[];
|
|
13
|
+
}
|
|
14
|
+
interface IndexStats {
|
|
15
|
+
dimension: number;
|
|
16
|
+
count: number;
|
|
17
|
+
metric?: 'cosine' | 'euclidean' | 'dotproduct';
|
|
18
|
+
}
|
|
19
|
+
declare abstract class MastraVector extends MastraBase {
|
|
20
|
+
constructor();
|
|
21
|
+
abstract upsert(indexName: string, vectors: number[][], metadata?: Record<string, any>[], ids?: string[]): Promise<string[]>;
|
|
22
|
+
abstract createIndex(indexName: string, dimension: number, metric?: 'cosine' | 'euclidean' | 'dotproduct'): Promise<void>;
|
|
23
|
+
abstract query(indexName: string, queryVector: number[], topK?: number, filter?: Record<string, any>, includeVector?: boolean): Promise<QueryResult[]>;
|
|
24
|
+
abstract listIndexes(): Promise<string[]>;
|
|
25
|
+
abstract describeIndex(indexName: string): Promise<IndexStats>;
|
|
26
|
+
abstract deleteIndex(indexName: string): Promise<void>;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export { type IndexStats, MastraVector, type QueryResult };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { MastraVector } from '../chunk-4IIE6KIC.js';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Filter } from '../../filter/index.js';
|
|
2
|
+
import { MastraVector, QueryResult, IndexStats } from '../index.js';
|
|
3
|
+
import '../../base-eWkcLLSb.js';
|
|
4
|
+
import '@opentelemetry/api';
|
|
5
|
+
import '../../index-C5uPdbs4.js';
|
|
6
|
+
import 'pino';
|
|
7
|
+
import 'stream';
|
|
8
|
+
import '@opentelemetry/sdk-trace-base';
|
|
9
|
+
|
|
10
|
+
declare class LibSQLVector extends MastraVector {
|
|
11
|
+
private turso;
|
|
12
|
+
constructor({ connectionUrl, authToken, syncUrl, syncInterval, }: {
|
|
13
|
+
connectionUrl: string;
|
|
14
|
+
authToken?: string;
|
|
15
|
+
syncUrl?: string;
|
|
16
|
+
syncInterval?: number;
|
|
17
|
+
});
|
|
18
|
+
protected rewriteDbUrl(url: string): string;
|
|
19
|
+
transformFilter(filter?: Filter): Filter;
|
|
20
|
+
query(indexName: string, queryVector: number[], topK?: number, filter?: Filter, includeVector?: boolean, minScore?: number): Promise<QueryResult[]>;
|
|
21
|
+
upsert(indexName: string, vectors: number[][], metadata?: Record<string, any>[], ids?: string[]): Promise<string[]>;
|
|
22
|
+
createIndex(indexName: string, dimension: number, _metric?: 'cosine' | 'euclidean' | 'dotproduct'): Promise<void>;
|
|
23
|
+
deleteIndex(indexName: string): Promise<void>;
|
|
24
|
+
listIndexes(): Promise<string[]>;
|
|
25
|
+
describeIndex(indexName: string): Promise<IndexStats>;
|
|
26
|
+
truncateIndex(indexName: string): Promise<void>;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export { LibSQLVector as DefaultVectorDB, LibSQLVector };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { LibSQLVector as DefaultVectorDB, LibSQLVector } from '../../chunk-QXPUH6PK.js';
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { M as MastraBase } from '../base-eWkcLLSb.js';
|
|
2
|
+
import '@opentelemetry/api';
|
|
3
|
+
import '../index-C5uPdbs4.js';
|
|
4
|
+
import 'pino';
|
|
5
|
+
import 'stream';
|
|
6
|
+
import '@opentelemetry/sdk-trace-base';
|
|
7
|
+
|
|
8
|
+
interface BuiltInModelConfig {
|
|
9
|
+
name: string;
|
|
10
|
+
apiKey?: string;
|
|
11
|
+
}
|
|
12
|
+
interface VoiceConfig {
|
|
13
|
+
listeningModel?: BuiltInModelConfig;
|
|
14
|
+
speechModel?: BuiltInModelConfig;
|
|
15
|
+
speaker?: string;
|
|
16
|
+
}
|
|
17
|
+
declare abstract class MastraVoice extends MastraBase {
|
|
18
|
+
protected listeningModel?: BuiltInModelConfig;
|
|
19
|
+
protected speechModel?: BuiltInModelConfig;
|
|
20
|
+
protected speaker?: string;
|
|
21
|
+
constructor({ listeningModel, speechModel, speaker }?: VoiceConfig);
|
|
22
|
+
traced<T extends Function>(method: T, methodName: string): T;
|
|
23
|
+
/**
|
|
24
|
+
* Convert text to speech
|
|
25
|
+
* @param input Text or text stream to convert to speech
|
|
26
|
+
* @param options Speech options including speaker and provider-specific options
|
|
27
|
+
* @returns Audio stream
|
|
28
|
+
*/
|
|
29
|
+
abstract speak(input: string | NodeJS.ReadableStream, options?: {
|
|
30
|
+
speaker?: string;
|
|
31
|
+
[key: string]: any;
|
|
32
|
+
}): Promise<NodeJS.ReadableStream>;
|
|
33
|
+
/**
|
|
34
|
+
* Convert speech to text
|
|
35
|
+
* @param audioStream Audio stream to transcribe
|
|
36
|
+
* @param options Provider-specific transcription options
|
|
37
|
+
* @returns Text or text stream
|
|
38
|
+
*/
|
|
39
|
+
abstract listen(audioStream: NodeJS.ReadableStream, options?: {
|
|
40
|
+
[key: string]: any;
|
|
41
|
+
}): Promise<string | NodeJS.ReadableStream>;
|
|
42
|
+
/**
|
|
43
|
+
* Get available speakers/voices
|
|
44
|
+
* @returns Array of available voice IDs and their metadata
|
|
45
|
+
*/
|
|
46
|
+
abstract getSpeakers(): Promise<Array<{
|
|
47
|
+
voiceId: string;
|
|
48
|
+
[key: string]: any;
|
|
49
|
+
}>>;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
declare class CompositeVoice extends MastraVoice {
|
|
53
|
+
protected speakProvider?: MastraVoice;
|
|
54
|
+
protected listenProvider?: MastraVoice;
|
|
55
|
+
constructor({ speakProvider, listenProvider }: {
|
|
56
|
+
speakProvider?: MastraVoice;
|
|
57
|
+
listenProvider?: MastraVoice;
|
|
58
|
+
});
|
|
59
|
+
speak(input: string | NodeJS.ReadableStream, options?: any): Promise<NodeJS.ReadableStream>;
|
|
60
|
+
listen(audioStream: NodeJS.ReadableStream, options?: any): Promise<string | NodeJS.ReadableStream>;
|
|
61
|
+
getSpeakers(): Promise<{
|
|
62
|
+
[key: string]: any;
|
|
63
|
+
voiceId: string;
|
|
64
|
+
}[]>;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export { CompositeVoice, MastraVoice, type VoiceConfig };
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { InstrumentClass } from '../chunk-4ZRHVG25.js';
|
|
2
|
+
import { MastraBase } from '../chunk-6RDA4JYW.js';
|
|
3
|
+
import { __decoratorStart, __decorateElement, __runInitializers } from '../chunk-C6A6W6XS.js';
|
|
4
|
+
|
|
5
|
+
// src/voice/voice.ts
|
|
6
|
+
var _MastraVoice_decorators, _init, _a;
|
|
7
|
+
_MastraVoice_decorators = [InstrumentClass({
|
|
8
|
+
prefix: "voice",
|
|
9
|
+
excludeMethods: ["__setTools", "__setLogger", "__setTelemetry", "#log"]
|
|
10
|
+
})];
|
|
11
|
+
var MastraVoice = class extends (_a = MastraBase) {
|
|
12
|
+
listeningModel;
|
|
13
|
+
speechModel;
|
|
14
|
+
speaker;
|
|
15
|
+
constructor({
|
|
16
|
+
listeningModel,
|
|
17
|
+
speechModel,
|
|
18
|
+
speaker
|
|
19
|
+
} = {}) {
|
|
20
|
+
super({
|
|
21
|
+
component: "VOICE"
|
|
22
|
+
});
|
|
23
|
+
this.listeningModel = listeningModel;
|
|
24
|
+
this.speechModel = speechModel;
|
|
25
|
+
this.speaker = speaker;
|
|
26
|
+
}
|
|
27
|
+
traced(method, methodName) {
|
|
28
|
+
return this.telemetry?.traceMethod(method, {
|
|
29
|
+
spanName: `voice.${methodName}`,
|
|
30
|
+
attributes: {
|
|
31
|
+
"voice.type": this.speechModel?.name || this.listeningModel?.name || "unknown"
|
|
32
|
+
}
|
|
33
|
+
}) ?? method;
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
MastraVoice = /*@__PURE__*/(_ => {
|
|
37
|
+
_init = __decoratorStart(_a);
|
|
38
|
+
MastraVoice = __decorateElement(_init, 0, "MastraVoice", _MastraVoice_decorators, MastraVoice);
|
|
39
|
+
__runInitializers(_init, 1, MastraVoice);
|
|
40
|
+
|
|
41
|
+
// src/voice/composite-voice.ts
|
|
42
|
+
return MastraVoice;
|
|
43
|
+
})();
|
|
44
|
+
// src/voice/composite-voice.ts
|
|
45
|
+
var CompositeVoice = class extends MastraVoice {
|
|
46
|
+
speakProvider;
|
|
47
|
+
listenProvider;
|
|
48
|
+
constructor({
|
|
49
|
+
speakProvider,
|
|
50
|
+
listenProvider
|
|
51
|
+
}) {
|
|
52
|
+
super();
|
|
53
|
+
this.speakProvider = speakProvider;
|
|
54
|
+
this.listenProvider = listenProvider;
|
|
55
|
+
}
|
|
56
|
+
async speak(input, options) {
|
|
57
|
+
if (!this.speakProvider) {
|
|
58
|
+
throw new Error("No speak provider configured");
|
|
59
|
+
}
|
|
60
|
+
return this.speakProvider.speak(input, options);
|
|
61
|
+
}
|
|
62
|
+
async listen(audioStream, options) {
|
|
63
|
+
if (!this.listenProvider) {
|
|
64
|
+
throw new Error("No listen provider configured");
|
|
65
|
+
}
|
|
66
|
+
return this.listenProvider.listen(audioStream, options);
|
|
67
|
+
}
|
|
68
|
+
async getSpeakers() {
|
|
69
|
+
if (!this.speakProvider) {
|
|
70
|
+
throw new Error("No speak provider configured");
|
|
71
|
+
}
|
|
72
|
+
return this.speakProvider.getSpeakers();
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
export { CompositeVoice, MastraVoice };
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { Snapshot } from 'xstate';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { e as StepExecutionContext, f as StepAction, R as RetryConfig, g as MastraPrimitives, W as WorkflowOptions, I as IAction, h as StepVariableType, i as StepConfig, j as StepResult, k as WorkflowRunState, l as StepGraph } from './base-CHNzbTDj.js';
|
|
4
|
+
import { M as MastraBase } from './base-eWkcLLSb.js';
|
|
5
|
+
|
|
6
|
+
declare class Step<TStepId extends string = any, TSchemaIn extends z.ZodSchema | undefined = undefined, TSchemaOut extends z.ZodSchema | undefined = undefined, TContext extends StepExecutionContext<TSchemaIn> = StepExecutionContext<TSchemaIn>> implements StepAction<TStepId, TSchemaIn, TSchemaOut, TContext> {
|
|
7
|
+
id: TStepId;
|
|
8
|
+
description?: string;
|
|
9
|
+
inputSchema?: TSchemaIn;
|
|
10
|
+
outputSchema?: TSchemaOut;
|
|
11
|
+
payload?: TSchemaIn extends z.ZodSchema ? Partial<z.infer<TSchemaIn>> : unknown;
|
|
12
|
+
execute: (context: TContext) => Promise<TSchemaOut extends z.ZodSchema ? z.infer<TSchemaOut> : unknown>;
|
|
13
|
+
retryConfig?: RetryConfig;
|
|
14
|
+
mastra?: MastraPrimitives;
|
|
15
|
+
constructor({ id, description, execute, payload, outputSchema, inputSchema, retryConfig, }: StepAction<TStepId, TSchemaIn, TSchemaOut, TContext>);
|
|
16
|
+
}
|
|
17
|
+
declare function createStep<TId extends string, TSchemaIn extends z.ZodSchema | undefined, TSchemaOut extends z.ZodSchema | undefined, TContext extends StepExecutionContext<TSchemaIn>>(opts: StepAction<TId, TSchemaIn, TSchemaOut, TContext>): Step<TId, TSchemaIn, TSchemaOut, TContext>;
|
|
18
|
+
|
|
19
|
+
interface WorkflowResultReturn<T extends z.ZodType<any>> {
|
|
20
|
+
runId: string;
|
|
21
|
+
start: (props?: {
|
|
22
|
+
triggerData?: z.infer<T>;
|
|
23
|
+
} | undefined) => Promise<{
|
|
24
|
+
triggerData?: z.infer<T>;
|
|
25
|
+
results: Record<string, StepResult<any>>;
|
|
26
|
+
runId: string;
|
|
27
|
+
}>;
|
|
28
|
+
}
|
|
29
|
+
declare class Workflow<TSteps extends Step<any, any, any>[] = any, TTriggerSchema extends z.ZodType<any> = any> extends MastraBase {
|
|
30
|
+
#private;
|
|
31
|
+
name: string;
|
|
32
|
+
triggerSchema?: TTriggerSchema;
|
|
33
|
+
/**
|
|
34
|
+
* Creates a new Workflow instance
|
|
35
|
+
* @param name - Identifier for the workflow (not necessarily unique)
|
|
36
|
+
* @param logger - Optional logger instance
|
|
37
|
+
*/
|
|
38
|
+
constructor({ name, triggerSchema, retryConfig, mastra }: WorkflowOptions<TTriggerSchema>);
|
|
39
|
+
/**
|
|
40
|
+
* Initializes the XState machine for the workflow
|
|
41
|
+
*
|
|
42
|
+
* Registers the machine's types, actions, actors, initial context, entry actions, initial state, and states
|
|
43
|
+
* @returns The initialized machine
|
|
44
|
+
*/
|
|
45
|
+
private initializeMachine;
|
|
46
|
+
step<TStep extends IAction<any, any, any, any>, CondStep extends StepVariableType<any, any, any, any>, VarStep extends StepVariableType<any, any, any, any>>(step: TStep, config?: StepConfig<TStep, CondStep, VarStep, TTriggerSchema>): this;
|
|
47
|
+
then<TStep extends IAction<any, any, any, any>, CondStep extends StepVariableType<any, any, any, any>, VarStep extends StepVariableType<any, any, any, any>>(step: TStep, config?: StepConfig<TStep, CondStep, VarStep, TTriggerSchema>): this;
|
|
48
|
+
after<TStep extends IAction<any, any, any, any>>(step: TStep): Omit<typeof this, "then" | "after">;
|
|
49
|
+
/**
|
|
50
|
+
* Executes the workflow with the given trigger data
|
|
51
|
+
* @param triggerData - Initial data to start the workflow with
|
|
52
|
+
* @returns Promise resolving to workflow results or rejecting with error
|
|
53
|
+
* @throws Error if trigger schema validation fails
|
|
54
|
+
*/
|
|
55
|
+
createRun(): WorkflowResultReturn<TTriggerSchema>;
|
|
56
|
+
execute({ triggerData, snapshot, runId, stepId, }?: {
|
|
57
|
+
stepId?: string;
|
|
58
|
+
triggerData?: z.infer<TTriggerSchema>;
|
|
59
|
+
runId?: string;
|
|
60
|
+
snapshot?: Snapshot<any>;
|
|
61
|
+
}): Promise<{
|
|
62
|
+
triggerData?: z.infer<TTriggerSchema>;
|
|
63
|
+
results: Record<string, StepResult<any>>;
|
|
64
|
+
runId: string;
|
|
65
|
+
}>;
|
|
66
|
+
/**
|
|
67
|
+
* Rebuilds the machine with the current steps configuration and validates the workflow
|
|
68
|
+
*
|
|
69
|
+
* This is the last step of a workflow builder method chain
|
|
70
|
+
* @throws Error if validation fails
|
|
71
|
+
*
|
|
72
|
+
* @returns this instance for method chaining
|
|
73
|
+
*/
|
|
74
|
+
commit(): this;
|
|
75
|
+
getState(runId: string): Promise<WorkflowRunState | null>;
|
|
76
|
+
watch(onTransition: (state: WorkflowRunState) => void): () => void;
|
|
77
|
+
resume({ runId, stepId, context: resumeContext, }: {
|
|
78
|
+
runId: string;
|
|
79
|
+
stepId: string;
|
|
80
|
+
context?: Record<string, any>;
|
|
81
|
+
}): Promise<{
|
|
82
|
+
triggerData?: z.infer<TTriggerSchema>;
|
|
83
|
+
results: Record<string, StepResult<any>>;
|
|
84
|
+
runId: string;
|
|
85
|
+
}>;
|
|
86
|
+
__registerPrimitives(p: MastraPrimitives): void;
|
|
87
|
+
get stepGraph(): StepGraph;
|
|
88
|
+
get stepSubscriberGraph(): Record<string, StepGraph>;
|
|
89
|
+
get steps(): Record<string, IAction<any, any, any, any>>;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export { Step as S, Workflow as W, createStep as c };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export { S as Step, W as Workflow, c as createStep } from '../workflow-CddifUps.js';
|
|
2
|
+
import { X as VariableReference, j as StepResult } from '../base-CHNzbTDj.js';
|
|
3
|
+
export { Z as ActionContext, Y as BaseCondition, a6 as DependencyCheckOutput, ac as ExtractSchemaFromStep, af as ExtractSchemaType, ad as ExtractStepResult, ag as PathsToStringProps, a3 as ResolverFunctionInput, a4 as ResolverFunctionOutput, R as RetryConfig, f as StepAction, $ as StepCondition, i as StepConfig, _ as StepDef, e as StepExecutionContext, l as StepGraph, ab as StepId, ae as StepInputType, V as StepNode, h as StepVariableType, a5 as SubscriberFunctionOutput, a8 as WorkflowActionParams, a9 as WorkflowActions, a7 as WorkflowActors, a0 as WorkflowContext, a2 as WorkflowEvent, a1 as WorkflowLogMessage, W as WorkflowOptions, k as WorkflowRunState, aa as WorkflowState } from '../base-CHNzbTDj.js';
|
|
4
|
+
import 'xstate';
|
|
5
|
+
import 'zod';
|
|
6
|
+
import '../base-eWkcLLSb.js';
|
|
7
|
+
import '@opentelemetry/api';
|
|
8
|
+
import '../index-C5uPdbs4.js';
|
|
9
|
+
import 'pino';
|
|
10
|
+
import 'stream';
|
|
11
|
+
import '@opentelemetry/sdk-trace-base';
|
|
12
|
+
import 'ai';
|
|
13
|
+
import '../types-m9RryK9a.js';
|
|
14
|
+
import 'sift';
|
|
15
|
+
import 'json-schema';
|
|
16
|
+
import '../vector/index.js';
|
|
17
|
+
import '../voice/index.js';
|
|
18
|
+
import '../tts/index.js';
|
|
19
|
+
|
|
20
|
+
declare function isErrorEvent(stateEvent: any): stateEvent is {
|
|
21
|
+
type: `xstate.error.actor.${string}`;
|
|
22
|
+
error: Error;
|
|
23
|
+
};
|
|
24
|
+
declare function isTransitionEvent(stateEvent: any): stateEvent is {
|
|
25
|
+
type: `xstate.done.actor.${string}`;
|
|
26
|
+
output?: unknown;
|
|
27
|
+
};
|
|
28
|
+
declare function isVariableReference(value: any): value is VariableReference<any, any>;
|
|
29
|
+
declare function getStepResult(result?: StepResult<any>): any;
|
|
30
|
+
|
|
31
|
+
export { StepResult, VariableReference, getStepResult, isErrorEvent, isTransitionEvent, isVariableReference };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Step, Workflow, createStep, getStepResult, isErrorEvent, isTransitionEvent, isVariableReference } from '../chunk-TCMOYQ74.js';
|