@agentified/mastra 0.0.1
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/adapter.d.ts +88 -0
- package/dist/adapter.d.ts.map +1 -0
- package/dist/adapter.js +349 -0
- package/dist/adapter.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/schema.d.ts +3 -0
- package/dist/schema.d.ts.map +1 -0
- package/dist/schema.js +47 -0
- package/dist/schema.js.map +1 -0
- package/dist/stream-sse.d.ts +5 -0
- package/dist/stream-sse.d.ts.map +1 -0
- package/dist/stream-sse.js +18 -0
- package/dist/stream-sse.js.map +1 -0
- package/package.json +41 -0
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import type { BaseEvent } from "@ag-ui/client";
|
|
2
|
+
import type { Agent } from "@mastra/core/agent";
|
|
3
|
+
import type { RegisterResponse, ServerTool } from "@agentified/sdk";
|
|
4
|
+
import { Observable } from "rxjs";
|
|
5
|
+
export interface GenerateOptions {
|
|
6
|
+
messages: Array<{
|
|
7
|
+
role: string;
|
|
8
|
+
content: string;
|
|
9
|
+
}>;
|
|
10
|
+
maxSteps?: number;
|
|
11
|
+
turnId?: string;
|
|
12
|
+
toolLimit?: number;
|
|
13
|
+
seed?: number;
|
|
14
|
+
debug?: boolean;
|
|
15
|
+
onStepFinish?: (event: {
|
|
16
|
+
usage: any;
|
|
17
|
+
toolCalls: any[];
|
|
18
|
+
}) => void;
|
|
19
|
+
}
|
|
20
|
+
export interface DebugEntry {
|
|
21
|
+
phase: string;
|
|
22
|
+
detail: Record<string, unknown>;
|
|
23
|
+
}
|
|
24
|
+
export interface GenerateResult {
|
|
25
|
+
text: string;
|
|
26
|
+
toolCalls: Array<{
|
|
27
|
+
toolName: string;
|
|
28
|
+
toolCallId: string;
|
|
29
|
+
args: Record<string, unknown>;
|
|
30
|
+
}>;
|
|
31
|
+
steps: any[];
|
|
32
|
+
usage: {
|
|
33
|
+
inputTokens: number;
|
|
34
|
+
outputTokens: number;
|
|
35
|
+
totalTokens: number;
|
|
36
|
+
cachedInputTokens?: number;
|
|
37
|
+
reasoningTokens?: number;
|
|
38
|
+
};
|
|
39
|
+
hydratedTools: string[];
|
|
40
|
+
turnId?: string;
|
|
41
|
+
durationMs: number;
|
|
42
|
+
debugLog?: DebugEntry[];
|
|
43
|
+
}
|
|
44
|
+
export interface AgentifiedMastraConfig {
|
|
45
|
+
agentifiedUrl: string;
|
|
46
|
+
tools: ServerTool[];
|
|
47
|
+
toolHandlers: Record<string, (args: Record<string, unknown>) => Promise<unknown>>;
|
|
48
|
+
agent: Agent;
|
|
49
|
+
}
|
|
50
|
+
export interface RunOptions {
|
|
51
|
+
messages: Array<{
|
|
52
|
+
role: string;
|
|
53
|
+
content: string;
|
|
54
|
+
toolCallId?: string;
|
|
55
|
+
toolCalls?: Array<{
|
|
56
|
+
id: string;
|
|
57
|
+
type: "function";
|
|
58
|
+
function: {
|
|
59
|
+
name: string;
|
|
60
|
+
arguments: string;
|
|
61
|
+
};
|
|
62
|
+
}>;
|
|
63
|
+
}>;
|
|
64
|
+
frontendTools?: string[];
|
|
65
|
+
}
|
|
66
|
+
export declare class AgentifiedMastra {
|
|
67
|
+
private config;
|
|
68
|
+
private sdk;
|
|
69
|
+
private lastPrefetchResult;
|
|
70
|
+
constructor(config: AgentifiedMastraConfig);
|
|
71
|
+
/**
|
|
72
|
+
* WORKAROUND: @ag-ui/mastra strips providerOptions during message conversion,
|
|
73
|
+
* losing Gemini 3's required thoughtSignature on function call parts.
|
|
74
|
+
* We wrap agent.stream() to inject a dummy signature so Gemini 3 doesn't 400.
|
|
75
|
+
*
|
|
76
|
+
* Tracked: https://github.com/ag-ui-protocol/ag-ui/issues/TBD
|
|
77
|
+
* Remove when: ag-ui preserves providerOptions in convertAGUIMessagesToMastra()
|
|
78
|
+
*/
|
|
79
|
+
private patchAgentStreamForGemini;
|
|
80
|
+
private static hasToolResults;
|
|
81
|
+
register(): Promise<RegisterResponse>;
|
|
82
|
+
generate(options: GenerateOptions): Promise<GenerateResult>;
|
|
83
|
+
run(options: RunOptions): Promise<Observable<BaseEvent>>;
|
|
84
|
+
private buildAllMastraTools;
|
|
85
|
+
private buildMastraTools;
|
|
86
|
+
private createDiscoverMastraTool;
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAe,MAAM,eAAe,CAAC;AAC5D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAIhD,OAAO,KAAK,EAGV,gBAAgB,EAChB,UAAU,EACX,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,UAAU,EAAW,MAAM,MAAM,CAAC;AAI3C,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACnD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,KAAK,EAAE,GAAG,CAAC;QAAC,SAAS,EAAE,GAAG,EAAE,CAAA;KAAE,KAAK,IAAI,CAAC;CAClE;AAED,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACjC;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,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C;CAC1B;AAED,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,MAAM,CAAyB;IACvC,OAAO,CAAC,GAAG,CAAa;IACxB,OAAO,CAAC,kBAAkB,CAA6D;gBAE3E,MAAM,EAAE,sBAAsB;IAS1C;;;;;;;OAOG;IACH,OAAO,CAAC,yBAAyB;IAqCjC,OAAO,CAAC,MAAM,CAAC,cAAc;IAIvB,QAAQ,IAAI,OAAO,CAAC,gBAAgB,CAAC;IAIrC,QAAQ,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC;IAsJ3D,GAAG,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;IAiG9D,OAAO,CAAC,mBAAmB;IAkB3B,OAAO,CAAC,gBAAgB;IAMxB,OAAO,CAAC,wBAAwB;CAqCjC"}
|
package/dist/adapter.js
ADDED
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
import { createTool } from "@mastra/core/tools";
|
|
2
|
+
import { MastraAgent } from "@ag-ui/mastra";
|
|
3
|
+
import { Agentified } from "@agentified/sdk";
|
|
4
|
+
import { Observable, Subject } from "rxjs";
|
|
5
|
+
import { z } from "zod";
|
|
6
|
+
import { jsonSchemaToZod } from "./schema.js";
|
|
7
|
+
export class AgentifiedMastra {
|
|
8
|
+
config;
|
|
9
|
+
sdk;
|
|
10
|
+
lastPrefetchResult = null;
|
|
11
|
+
constructor(config) {
|
|
12
|
+
this.config = config;
|
|
13
|
+
this.sdk = new Agentified({
|
|
14
|
+
serverUrl: config.agentifiedUrl,
|
|
15
|
+
tools: config.tools,
|
|
16
|
+
});
|
|
17
|
+
this.patchAgentStreamForGemini();
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* WORKAROUND: @ag-ui/mastra strips providerOptions during message conversion,
|
|
21
|
+
* losing Gemini 3's required thoughtSignature on function call parts.
|
|
22
|
+
* We wrap agent.stream() to inject a dummy signature so Gemini 3 doesn't 400.
|
|
23
|
+
*
|
|
24
|
+
* Tracked: https://github.com/ag-ui-protocol/ag-ui/issues/TBD
|
|
25
|
+
* Remove when: ag-ui preserves providerOptions in convertAGUIMessagesToMastra()
|
|
26
|
+
*/
|
|
27
|
+
patchAgentStreamForGemini() {
|
|
28
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
29
|
+
const agent = this.config.agent;
|
|
30
|
+
const originalStream = agent.stream.bind(agent);
|
|
31
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
32
|
+
agent.stream = async (messages, ...rest) => {
|
|
33
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
34
|
+
const patched = messages.map((m) => {
|
|
35
|
+
if (m.role === "assistant" &&
|
|
36
|
+
Array.isArray(m.content) &&
|
|
37
|
+
m.content.some((p) => p.type === "tool-call")) {
|
|
38
|
+
return {
|
|
39
|
+
...m,
|
|
40
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
41
|
+
content: m.content.map((part) => {
|
|
42
|
+
if (part.providerOptions?.google?.thoughtSignature)
|
|
43
|
+
return part;
|
|
44
|
+
return {
|
|
45
|
+
...part,
|
|
46
|
+
providerOptions: {
|
|
47
|
+
...part.providerOptions,
|
|
48
|
+
google: {
|
|
49
|
+
...part.providerOptions?.google,
|
|
50
|
+
thoughtSignature: "skip_thought_signature_validator",
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
}),
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
return m;
|
|
58
|
+
});
|
|
59
|
+
return originalStream(patched, ...rest);
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
static hasToolResults(messages) {
|
|
63
|
+
return messages.some((m) => m.role === "tool");
|
|
64
|
+
}
|
|
65
|
+
async register() {
|
|
66
|
+
return this.sdk.register();
|
|
67
|
+
}
|
|
68
|
+
async generate(options) {
|
|
69
|
+
const start = performance.now();
|
|
70
|
+
const debug = options.debug ?? false;
|
|
71
|
+
const debugLog = [];
|
|
72
|
+
const log = (phase, detail) => {
|
|
73
|
+
if (!debug)
|
|
74
|
+
return;
|
|
75
|
+
debugLog.push({ phase, detail });
|
|
76
|
+
console.error(`[agentified] ${phase}:`, JSON.stringify(detail));
|
|
77
|
+
};
|
|
78
|
+
// 1. Prefetch (with turnId for session continuity)
|
|
79
|
+
const ranked = await this.sdk.prefetch({
|
|
80
|
+
messages: options.messages.map(m => ({ role: m.role, content: m.content })),
|
|
81
|
+
turnId: options.turnId,
|
|
82
|
+
...(options.toolLimit !== undefined && { limit: options.toolLimit }),
|
|
83
|
+
}) ?? [];
|
|
84
|
+
const prefilledNames = ranked.map(t => t.name);
|
|
85
|
+
log("prefetch", {
|
|
86
|
+
toolCount: ranked.length,
|
|
87
|
+
tools: ranked.map(t => ({ name: t.name, score: t.score })),
|
|
88
|
+
});
|
|
89
|
+
// 2. Build ALL tools (not just ranked — needed for discover → use)
|
|
90
|
+
const allTools = this.buildAllMastraTools();
|
|
91
|
+
const registryNames = new Set(Object.keys(allTools));
|
|
92
|
+
// 3. Discover tool
|
|
93
|
+
const discoverDef = this.sdk.asDiscoverTool();
|
|
94
|
+
const discoverTool = createTool({
|
|
95
|
+
id: "agentified_discover",
|
|
96
|
+
description: discoverDef.definition.description,
|
|
97
|
+
inputSchema: z.object({ query: z.string(), limit: z.number().optional() }),
|
|
98
|
+
execute: async (input) => {
|
|
99
|
+
const result = await discoverDef.execute(input);
|
|
100
|
+
log("discover-result", {
|
|
101
|
+
query: input.query,
|
|
102
|
+
tools: Array.isArray(result) ? result.map((t) => t.name) : result,
|
|
103
|
+
});
|
|
104
|
+
return result;
|
|
105
|
+
},
|
|
106
|
+
});
|
|
107
|
+
// 4. Active tool set — grows as discover returns results
|
|
108
|
+
const activeSet = new Set(prefilledNames);
|
|
109
|
+
activeSet.add("agentified_discover");
|
|
110
|
+
// 5. Inject full tool set into agent
|
|
111
|
+
const fullTools = { ...allTools, agentified_discover: discoverTool };
|
|
112
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
113
|
+
this.config.agent.__setTools(fullTools);
|
|
114
|
+
log("setup", {
|
|
115
|
+
totalToolsRegistered: Object.keys(fullTools).length,
|
|
116
|
+
initialActiveSet: [...activeSet],
|
|
117
|
+
});
|
|
118
|
+
// 6. Call agent.generate() with prepareStep
|
|
119
|
+
const result = await this.config.agent.generate(options.messages, {
|
|
120
|
+
maxSteps: options.maxSteps ?? 10,
|
|
121
|
+
...(options.seed !== undefined && { seed: options.seed }),
|
|
122
|
+
onStepFinish: options.onStepFinish,
|
|
123
|
+
prepareStep: async ({ stepNumber, steps }) => {
|
|
124
|
+
// Merge discovered tools from prior steps (handle AG-UI payload wrapping)
|
|
125
|
+
const prevSize = activeSet.size;
|
|
126
|
+
for (const step of steps) {
|
|
127
|
+
for (const tr of step.toolResults ?? []) {
|
|
128
|
+
const trName = tr.toolName ?? tr.payload?.toolName;
|
|
129
|
+
const trResult = tr.result ?? tr.payload?.result;
|
|
130
|
+
if (trName === "agentified_discover" && Array.isArray(trResult)) {
|
|
131
|
+
for (const t of trResult) {
|
|
132
|
+
if (registryNames.has(t.name))
|
|
133
|
+
activeSet.add(t.name);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
const newTools = activeSet.size > prevSize
|
|
139
|
+
? [...activeSet].filter(n => !prefilledNames.includes(n) && n !== "agentified_discover")
|
|
140
|
+
: [];
|
|
141
|
+
log("prepareStep", {
|
|
142
|
+
stepNumber,
|
|
143
|
+
activeSet: [...activeSet],
|
|
144
|
+
newlyAdded: newTools.length > 0 ? newTools : undefined,
|
|
145
|
+
});
|
|
146
|
+
return { activeTools: [...activeSet] };
|
|
147
|
+
},
|
|
148
|
+
});
|
|
149
|
+
// 7. Collect tool calls (excluding discover)
|
|
150
|
+
// Mastra wraps tool calls in AG-UI events: { payload: { toolName, toolCallId, args } }
|
|
151
|
+
const toolCalls = [];
|
|
152
|
+
for (const step of result.steps ?? []) {
|
|
153
|
+
for (const tc of step.toolCalls ?? []) {
|
|
154
|
+
const name = tc.toolName ?? tc.payload?.toolName;
|
|
155
|
+
const id = tc.toolCallId ?? tc.payload?.toolCallId;
|
|
156
|
+
const args = tc.args ?? tc.payload?.args ?? {};
|
|
157
|
+
if (name === "agentified_discover")
|
|
158
|
+
continue;
|
|
159
|
+
toolCalls.push({ toolName: name, toolCallId: id, args });
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
// 8. Post-process: expand activeSet from result steps
|
|
163
|
+
for (const step of result.steps ?? []) {
|
|
164
|
+
for (const tr of step.toolResults ?? []) {
|
|
165
|
+
const trName = tr.toolName ?? tr.payload?.toolName;
|
|
166
|
+
const trResult = tr.result ?? tr.payload?.result;
|
|
167
|
+
if (trName === "agentified_discover" && Array.isArray(trResult)) {
|
|
168
|
+
for (const t of trResult) {
|
|
169
|
+
if (registryNames.has(t.name))
|
|
170
|
+
activeSet.add(t.name);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
// 9. Capture turn for session continuity
|
|
176
|
+
const toolsLoaded = [...activeSet].filter(n => n !== "agentified_discover");
|
|
177
|
+
let turnId;
|
|
178
|
+
try {
|
|
179
|
+
const capture = await this.sdk.captureTurn({
|
|
180
|
+
toolsLoaded,
|
|
181
|
+
message: options.messages[options.messages.length - 1]?.content ?? "",
|
|
182
|
+
});
|
|
183
|
+
turnId = capture.turnId;
|
|
184
|
+
}
|
|
185
|
+
catch { /* non-fatal */ }
|
|
186
|
+
const usage = result.usage ?? {};
|
|
187
|
+
const inputTokens = usage.inputTokens ?? usage.promptTokens ?? 0;
|
|
188
|
+
const outputTokens = usage.outputTokens ?? usage.completionTokens ?? 0;
|
|
189
|
+
return {
|
|
190
|
+
text: result.text ?? "",
|
|
191
|
+
toolCalls,
|
|
192
|
+
steps: result.steps ?? [],
|
|
193
|
+
usage: {
|
|
194
|
+
inputTokens,
|
|
195
|
+
outputTokens,
|
|
196
|
+
totalTokens: usage.totalTokens ?? (inputTokens + outputTokens),
|
|
197
|
+
cachedInputTokens: usage.cachedInputTokens,
|
|
198
|
+
reasoningTokens: usage.reasoningTokens,
|
|
199
|
+
},
|
|
200
|
+
hydratedTools: toolsLoaded,
|
|
201
|
+
turnId,
|
|
202
|
+
durationMs: performance.now() - start,
|
|
203
|
+
...(debug && { debugLog }),
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
async run(options) {
|
|
207
|
+
const allFrontendNames = this.sdk.getFrontendToolNames();
|
|
208
|
+
const available = new Set(options.frontendTools ?? []);
|
|
209
|
+
const unavailable = allFrontendNames.filter((n) => !available.has(n));
|
|
210
|
+
let ranked;
|
|
211
|
+
let prefetchDurationMs;
|
|
212
|
+
let prefetchSkipped = false;
|
|
213
|
+
if (this.lastPrefetchResult && AgentifiedMastra.hasToolResults(options.messages)) {
|
|
214
|
+
ranked = this.lastPrefetchResult.ranked;
|
|
215
|
+
prefetchDurationMs = this.lastPrefetchResult.durationMs;
|
|
216
|
+
prefetchSkipped = true;
|
|
217
|
+
}
|
|
218
|
+
else {
|
|
219
|
+
const prefetchStart = performance.now();
|
|
220
|
+
ranked = await this.sdk.prefetch({
|
|
221
|
+
messages: options.messages.map((m) => ({
|
|
222
|
+
role: m.role,
|
|
223
|
+
content: m.content,
|
|
224
|
+
})),
|
|
225
|
+
exclude: unavailable.length > 0 ? unavailable : undefined,
|
|
226
|
+
});
|
|
227
|
+
prefetchDurationMs = performance.now() - prefetchStart;
|
|
228
|
+
this.lastPrefetchResult = { ranked, durationMs: prefetchDurationMs };
|
|
229
|
+
}
|
|
230
|
+
const subject = new Subject();
|
|
231
|
+
const mastraTools = this.buildMastraTools(ranked);
|
|
232
|
+
const discoverTool = this.createDiscoverMastraTool(subject);
|
|
233
|
+
const frontendToolDefs = this.sdk
|
|
234
|
+
.getFrontendTools()
|
|
235
|
+
.filter((t) => available.has(t.name))
|
|
236
|
+
.map((t) => ({
|
|
237
|
+
name: t.name,
|
|
238
|
+
description: t.description,
|
|
239
|
+
parameters: t.parameters,
|
|
240
|
+
}));
|
|
241
|
+
const runId = crypto.randomUUID();
|
|
242
|
+
const threadId = crypto.randomUUID();
|
|
243
|
+
return new Observable((subscriber) => {
|
|
244
|
+
// Inject tools synchronously (safe: runs on subscribe, same tick)
|
|
245
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
246
|
+
this.config.agent.__setTools({ ...mastraTools, agentified_discover: discoverTool });
|
|
247
|
+
const mastraAgent = new MastraAgent({ agent: this.config.agent, resourceId: this.config.agent.name });
|
|
248
|
+
subscriber.next({
|
|
249
|
+
type: "RUN_STARTED",
|
|
250
|
+
runId,
|
|
251
|
+
threadId,
|
|
252
|
+
});
|
|
253
|
+
subscriber.next({
|
|
254
|
+
type: "CUSTOM",
|
|
255
|
+
name: prefetchSkipped ? "agentified:prefetch:skipped" : "agentified:prefetch:complete",
|
|
256
|
+
value: { tools: ranked, durationMs: prefetchDurationMs },
|
|
257
|
+
});
|
|
258
|
+
const agentObs = mastraAgent.run({
|
|
259
|
+
messages: options.messages.map((m) => {
|
|
260
|
+
const msg = {
|
|
261
|
+
id: crypto.randomUUID(),
|
|
262
|
+
role: m.role,
|
|
263
|
+
content: m.content,
|
|
264
|
+
};
|
|
265
|
+
if (m.toolCallId)
|
|
266
|
+
msg.toolCallId = m.toolCallId;
|
|
267
|
+
if (m.toolCalls)
|
|
268
|
+
msg.toolCalls = m.toolCalls;
|
|
269
|
+
return msg;
|
|
270
|
+
}),
|
|
271
|
+
threadId,
|
|
272
|
+
runId,
|
|
273
|
+
tools: frontendToolDefs,
|
|
274
|
+
context: [],
|
|
275
|
+
});
|
|
276
|
+
const agentSub = agentObs.subscribe({
|
|
277
|
+
next: (e) => {
|
|
278
|
+
if (e.type === "RUN_STARTED")
|
|
279
|
+
return;
|
|
280
|
+
subscriber.next(e);
|
|
281
|
+
},
|
|
282
|
+
error: (err) => subscriber.error(err),
|
|
283
|
+
complete: () => subscriber.complete(),
|
|
284
|
+
});
|
|
285
|
+
const subjectSub = subject.subscribe({
|
|
286
|
+
next: (e) => subscriber.next(e),
|
|
287
|
+
});
|
|
288
|
+
return () => {
|
|
289
|
+
agentSub.unsubscribe();
|
|
290
|
+
subjectSub.unsubscribe();
|
|
291
|
+
};
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
295
|
+
buildAllMastraTools() {
|
|
296
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
297
|
+
const tools = {};
|
|
298
|
+
for (const def of this.config.tools) {
|
|
299
|
+
const handler = this.config.toolHandlers[def.name];
|
|
300
|
+
if (!handler)
|
|
301
|
+
continue;
|
|
302
|
+
tools[def.name] = createTool({
|
|
303
|
+
id: def.name,
|
|
304
|
+
description: def.description,
|
|
305
|
+
inputSchema: jsonSchemaToZod(def.parameters),
|
|
306
|
+
execute: async (inputData) => handler(inputData),
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
return tools;
|
|
310
|
+
}
|
|
311
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
312
|
+
buildMastraTools(ranked) {
|
|
313
|
+
const names = new Set(ranked.map((t) => t.name));
|
|
314
|
+
const all = this.buildAllMastraTools();
|
|
315
|
+
return Object.fromEntries(Object.entries(all).filter(([n]) => names.has(n)));
|
|
316
|
+
}
|
|
317
|
+
createDiscoverMastraTool(subject) {
|
|
318
|
+
const discoverTool = this.sdk.asDiscoverTool();
|
|
319
|
+
return createTool({
|
|
320
|
+
id: discoverTool.definition.name,
|
|
321
|
+
description: discoverTool.definition.description,
|
|
322
|
+
inputSchema: z.object({
|
|
323
|
+
query: z.string(),
|
|
324
|
+
limit: z.number().optional(),
|
|
325
|
+
}),
|
|
326
|
+
execute: async (input) => {
|
|
327
|
+
subject.next({
|
|
328
|
+
type: "CUSTOM",
|
|
329
|
+
name: "agentified:discover:start",
|
|
330
|
+
value: { type: "agentified:discover:start", query: input.query },
|
|
331
|
+
});
|
|
332
|
+
const start = performance.now();
|
|
333
|
+
const tools = await discoverTool.execute(input);
|
|
334
|
+
subject.next({
|
|
335
|
+
type: "CUSTOM",
|
|
336
|
+
name: "agentified:discover:complete",
|
|
337
|
+
value: {
|
|
338
|
+
type: "agentified:discover:complete",
|
|
339
|
+
query: input.query,
|
|
340
|
+
tools,
|
|
341
|
+
durationMs: performance.now() - start,
|
|
342
|
+
},
|
|
343
|
+
});
|
|
344
|
+
return tools;
|
|
345
|
+
},
|
|
346
|
+
});
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
//# sourceMappingURL=adapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapter.js","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAO7C,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC3C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AA0D9C,MAAM,OAAO,gBAAgB;IACnB,MAAM,CAAyB;IAC/B,GAAG,CAAa;IAChB,kBAAkB,GAAwD,IAAI,CAAC;IAEvF,YAAY,MAA8B;QACxC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,GAAG,GAAG,IAAI,UAAU,CAAC;YACxB,SAAS,EAAE,MAAM,CAAC,aAAa;YAC/B,KAAK,EAAE,MAAM,CAAC,KAAK;SACpB,CAAC,CAAC;QACH,IAAI,CAAC,yBAAyB,EAAE,CAAC;IACnC,CAAC;IAED;;;;;;;OAOG;IACK,yBAAyB;QAC/B,8DAA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,KAAK,EAAE,KAAK,EAAE,EAAE;gBACvB,OAAO,CAAC,IAAI,CAAC;oBACX,IAAI,EAAE,QAAQ;oBACd,IAAI,EAAE,2BAA2B;oBACjC,KAAK,EAAE,EAAE,IAAI,EAAE,2BAA2B,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE;iBAClD,CAAC,CAAC;gBAElB,MAAM,KAAK,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC;gBAChC,MAAM,KAAK,GAAG,MAAM,YAAY,CAAC,OAAO,CACtC,KAAqC,CACtC,CAAC;gBAEF,OAAO,CAAC,IAAI,CAAC;oBACX,IAAI,EAAE,QAAQ;oBACd,IAAI,EAAE,8BAA8B;oBACpC,KAAK,EAAE;wBACL,IAAI,EAAE,8BAA8B;wBACpC,KAAK,EAAE,KAAK,CAAC,KAAK;wBAClB,KAAK;wBACL,UAAU,EAAE,WAAW,CAAC,GAAG,EAAE,GAAG,KAAK;qBACtC;iBACa,CAAC,CAAC;gBAElB,OAAO,KAAK,CAAC;YACf,CAAC;SACF,CAAC,CAAC;IACL,CAAC;CACF"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { AgentifiedMastra } from "./adapter.js";
|
|
2
|
+
export { streamSSE } from "./stream-sse.js";
|
|
3
|
+
export { jsonSchemaToZod } from "./schema.js";
|
|
4
|
+
export type { AgentifiedMastraConfig, RunOptions, GenerateOptions, GenerateResult } from "./adapter.js";
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,YAAY,EAAE,sBAAsB,EAAE,UAAU,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/schema.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,KAAK,UAAU,EAAE,MAAM,KAAK,CAAC;AAEzC,wBAAgB,eAAe,CAC7B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC9B,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAezC"}
|
package/dist/schema.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export function jsonSchemaToZod(schema) {
|
|
3
|
+
const props = (schema.properties ?? {});
|
|
4
|
+
const required = new Set((schema.required ?? []));
|
|
5
|
+
const shape = {};
|
|
6
|
+
for (const [key, prop] of Object.entries(props)) {
|
|
7
|
+
let field = jsonSchemaFieldToZod(prop);
|
|
8
|
+
if (!required.has(key))
|
|
9
|
+
field = field.optional();
|
|
10
|
+
shape[key] = field;
|
|
11
|
+
}
|
|
12
|
+
return z.object(shape).passthrough();
|
|
13
|
+
}
|
|
14
|
+
function jsonSchemaFieldToZod(prop) {
|
|
15
|
+
const type = prop.type;
|
|
16
|
+
const desc = prop.description;
|
|
17
|
+
let field;
|
|
18
|
+
if (prop.enum) {
|
|
19
|
+
const values = prop.enum;
|
|
20
|
+
field = z.enum(values);
|
|
21
|
+
}
|
|
22
|
+
else if (type === "number" || type === "integer") {
|
|
23
|
+
field = z.number();
|
|
24
|
+
}
|
|
25
|
+
else if (type === "boolean") {
|
|
26
|
+
field = z.boolean();
|
|
27
|
+
}
|
|
28
|
+
else if (type === "array") {
|
|
29
|
+
const items = (prop.items ?? {});
|
|
30
|
+
field = z.array(jsonSchemaFieldToZod(items));
|
|
31
|
+
}
|
|
32
|
+
else if (type === "object") {
|
|
33
|
+
if (prop.properties) {
|
|
34
|
+
field = jsonSchemaToZod(prop);
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
field = z.record(z.unknown());
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
field = z.string();
|
|
42
|
+
}
|
|
43
|
+
if (desc)
|
|
44
|
+
field = field.describe(desc);
|
|
45
|
+
return field;
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAmB,MAAM,KAAK,CAAC;AAEzC,MAAM,UAAU,eAAe,CAC7B,MAA+B;IAE/B,MAAM,KAAK,GAAG,CAAC,MAAM,CAAC,UAAU,IAAI,EAAE,CAGrC,CAAC;IACF,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,CAAC,QAAQ,IAAI,EAAE,CAAa,CAAC,CAAC;IAC9D,MAAM,KAAK,GAA+B,EAAE,CAAC;IAE7C,KAAK,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QAChD,IAAI,KAAK,GAAG,oBAAoB,CAAC,IAAI,CAAC,CAAC;QACvC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC;YAAE,KAAK,GAAG,KAAK,CAAC,QAAQ,EAAE,CAAC;QACjD,KA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;IAED,IAAI,IAAI;QAAE,KAAK,GAAG,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IACvC,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ServerResponse } from "node:http";
|
|
2
|
+
import type { Observable } from "rxjs";
|
|
3
|
+
import type { BaseEvent } from "@ag-ui/client";
|
|
4
|
+
export declare function streamSSE(observable: Observable<BaseEvent>, res: ServerResponse): void;
|
|
5
|
+
//# sourceMappingURL=stream-sse.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stream-sse.d.ts","sourceRoot":"","sources":["../src/stream-sse.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AACvC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE/C,wBAAgB,SAAS,CACvB,UAAU,EAAE,UAAU,CAAC,SAAS,CAAC,EACjC,GAAG,EAAE,cAAc,GAClB,IAAI,CAoBN"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export function streamSSE(observable, res) {
|
|
2
|
+
res.writeHead(200, {
|
|
3
|
+
"Content-Type": "text/event-stream",
|
|
4
|
+
"Cache-Control": "no-cache",
|
|
5
|
+
Connection: "keep-alive",
|
|
6
|
+
});
|
|
7
|
+
const sub = observable.subscribe({
|
|
8
|
+
next: (e) => res.write(`data: ${JSON.stringify(e)}\n\n`),
|
|
9
|
+
complete: () => res.end(),
|
|
10
|
+
error: (err) => {
|
|
11
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
12
|
+
res.write(`data: ${JSON.stringify({ type: "RUN_ERROR", message: msg })}\n\n`);
|
|
13
|
+
res.end();
|
|
14
|
+
},
|
|
15
|
+
});
|
|
16
|
+
res.on("close", () => sub.unsubscribe());
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=stream-sse.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stream-sse.js","sourceRoot":"","sources":["../src/stream-sse.ts"],"names":[],"mappings":"AAIA,MAAM,UAAU,SAAS,CACvB,UAAiC,EACjC,GAAmB;IAEnB,GAAG,CAAC,SAAS,CAAC,GAAG,EAAE;QACjB,cAAc,EAAE,mBAAmB;QACnC,eAAe,EAAE,UAAU;QAC3B,UAAU,EAAE,YAAY;KACzB,CAAC,CAAC;IAEH,MAAM,GAAG,GAAG,UAAU,CAAC,SAAS,CAAC;QAC/B,IAAI,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,SAAS,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC;QACxD,QAAQ,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,GAAG,EAAE;QACzB,KAAK,EAAE,CAAC,GAAG,EAAE,EAAE;YACb,MAAM,GAAG,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YAC7D,GAAG,CAAC,KAAK,CACP,SAAS,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,MAAM,CACnE,CAAC;YACF,GAAG,CAAC,GAAG,EAAE,CAAC;QACZ,CAAC;KACF,CAAC,CAAC;IAEH,GAAG,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,CAAC;AAC3C,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@agentified/mastra",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"import": "./dist/index.js"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"files": ["dist"],
|
|
14
|
+
"publishConfig": {
|
|
15
|
+
"access": "public"
|
|
16
|
+
},
|
|
17
|
+
"scripts": {
|
|
18
|
+
"build": "tsc -p tsconfig.build.json --noCheck",
|
|
19
|
+
"test": "vitest run"
|
|
20
|
+
},
|
|
21
|
+
"peerDependencies": {
|
|
22
|
+
"@ag-ui/client": ">=0.0.45",
|
|
23
|
+
"@ag-ui/mastra": ">=1.0.0",
|
|
24
|
+
"@agentified/sdk": "workspace:*",
|
|
25
|
+
"@mastra/core": ">=1.0.0",
|
|
26
|
+
"zod": ">=3.0.0"
|
|
27
|
+
},
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"rxjs": "^7.8.0"
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"@ag-ui/client": "^0.0.45",
|
|
33
|
+
"@ag-ui/mastra": "^1.0.0",
|
|
34
|
+
"@agentified/sdk": "workspace:*",
|
|
35
|
+
"@mastra/core": "^1.6.0",
|
|
36
|
+
"@types/node": "^22.0.0",
|
|
37
|
+
"typescript": "^5.9.0",
|
|
38
|
+
"vitest": "^2.1.0",
|
|
39
|
+
"zod": "^3.25.0"
|
|
40
|
+
}
|
|
41
|
+
}
|