@mastra/deployer 0.10.14 → 0.10.15-alpha.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/_tsup-dts-rollup.d.cts +9 -1
- package/dist/_tsup-dts-rollup.d.ts +9 -1
- package/dist/bundler/index.cjs +2 -2
- package/dist/bundler/index.js +1 -1
- package/dist/{chunk-2C7ENC5E.js → chunk-D57U647E.js} +22 -4
- package/dist/{chunk-MKB7NDY3.cjs → chunk-UFVGATV6.cjs} +23 -5
- package/dist/index.cjs +2 -2
- package/dist/index.js +1 -1
- package/dist/server/index.cjs +120 -0
- package/dist/server/index.js +121 -1
- package/package.json +5 -5
|
@@ -94,9 +94,13 @@ export declare abstract class Bundler extends MastraBundler {
|
|
|
94
94
|
}>;
|
|
95
95
|
protected installDependencies(outputDirectory: string, rootDir?: string): Promise<void>;
|
|
96
96
|
protected copyPublic(mastraDir: string, outputDirectory: string): Promise<void>;
|
|
97
|
+
protected copyDOTNPMRC({ rootDir, outputDirectory, }: {
|
|
98
|
+
rootDir?: string;
|
|
99
|
+
outputDirectory: string;
|
|
100
|
+
}): Promise<void>;
|
|
97
101
|
protected getBundlerOptions(serverFile: string, mastraEntryFile: string, analyzedBundleInfo: Awaited<ReturnType<typeof analyzeBundle>>, toolsPaths: string[]): Promise<InputOptions>;
|
|
98
102
|
getToolsInputOptions(toolsPaths: string[]): Promise<Record<string, string>>;
|
|
99
|
-
protected _bundle(serverFile: string, mastraEntryFile: string, outputDirectory: string, toolsPaths?: string[], bundleLocation?: string): Promise<void>;
|
|
103
|
+
protected _bundle(serverFile: string, mastraEntryFile: string, outputDirectory: string, toolsPaths?: string[], bundleLocation?: string, installDependencies?: boolean): Promise<void>;
|
|
100
104
|
lint(_entryFile: string, _outputDirectory: string, toolsPaths: string[]): Promise<void>;
|
|
101
105
|
}
|
|
102
106
|
|
|
@@ -609,6 +613,8 @@ export declare function getWorkflowRunsHandler(c: Context): Promise<Response>;
|
|
|
609
613
|
|
|
610
614
|
export declare function getWorkflowsHandler(c: Context): Promise<Response>;
|
|
611
615
|
|
|
616
|
+
export declare function getWorkingMemoryHandler(c: Context): Promise<Response>;
|
|
617
|
+
|
|
612
618
|
export declare function handleClientsRefresh(c: Context): Response;
|
|
613
619
|
|
|
614
620
|
export declare function handleError(error: unknown, defaultMessage: string): Promise<Response>;
|
|
@@ -790,6 +796,8 @@ export declare function tsConfigPaths({ tsConfigPath, respectCoreModule }?: Plug
|
|
|
790
796
|
|
|
791
797
|
export declare function updateThreadHandler(c: Context): Promise<Response>;
|
|
792
798
|
|
|
799
|
+
export declare function updateWorkingMemoryHandler(c: Context): Promise<Response>;
|
|
800
|
+
|
|
793
801
|
export declare function upsertMastraDir({ dir }: {
|
|
794
802
|
dir?: string;
|
|
795
803
|
}): void;
|
|
@@ -94,9 +94,13 @@ export declare abstract class Bundler extends MastraBundler {
|
|
|
94
94
|
}>;
|
|
95
95
|
protected installDependencies(outputDirectory: string, rootDir?: string): Promise<void>;
|
|
96
96
|
protected copyPublic(mastraDir: string, outputDirectory: string): Promise<void>;
|
|
97
|
+
protected copyDOTNPMRC({ rootDir, outputDirectory, }: {
|
|
98
|
+
rootDir?: string;
|
|
99
|
+
outputDirectory: string;
|
|
100
|
+
}): Promise<void>;
|
|
97
101
|
protected getBundlerOptions(serverFile: string, mastraEntryFile: string, analyzedBundleInfo: Awaited<ReturnType<typeof analyzeBundle>>, toolsPaths: string[]): Promise<InputOptions>;
|
|
98
102
|
getToolsInputOptions(toolsPaths: string[]): Promise<Record<string, string>>;
|
|
99
|
-
protected _bundle(serverFile: string, mastraEntryFile: string, outputDirectory: string, toolsPaths?: string[], bundleLocation?: string): Promise<void>;
|
|
103
|
+
protected _bundle(serverFile: string, mastraEntryFile: string, outputDirectory: string, toolsPaths?: string[], bundleLocation?: string, installDependencies?: boolean): Promise<void>;
|
|
100
104
|
lint(_entryFile: string, _outputDirectory: string, toolsPaths: string[]): Promise<void>;
|
|
101
105
|
}
|
|
102
106
|
|
|
@@ -609,6 +613,8 @@ export declare function getWorkflowRunsHandler(c: Context): Promise<Response>;
|
|
|
609
613
|
|
|
610
614
|
export declare function getWorkflowsHandler(c: Context): Promise<Response>;
|
|
611
615
|
|
|
616
|
+
export declare function getWorkingMemoryHandler(c: Context): Promise<Response>;
|
|
617
|
+
|
|
612
618
|
export declare function handleClientsRefresh(c: Context): Response;
|
|
613
619
|
|
|
614
620
|
export declare function handleError(error: unknown, defaultMessage: string): Promise<Response>;
|
|
@@ -790,6 +796,8 @@ export declare function tsConfigPaths({ tsConfigPath, respectCoreModule }?: Plug
|
|
|
790
796
|
|
|
791
797
|
export declare function updateThreadHandler(c: Context): Promise<Response>;
|
|
792
798
|
|
|
799
|
+
export declare function updateWorkingMemoryHandler(c: Context): Promise<Response>;
|
|
800
|
+
|
|
793
801
|
export declare function upsertMastraDir({ dir }: {
|
|
794
802
|
dir?: string;
|
|
795
803
|
}): void;
|
package/dist/bundler/index.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkUFVGATV6_cjs = require('../chunk-UFVGATV6.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
Object.defineProperty(exports, "Bundler", {
|
|
8
8
|
enumerable: true,
|
|
9
|
-
get: function () { return
|
|
9
|
+
get: function () { return chunkUFVGATV6_cjs.Bundler; }
|
|
10
10
|
});
|
package/dist/bundler/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { Bundler } from '../chunk-
|
|
1
|
+
export { Bundler } from '../chunk-D57U647E.js';
|
|
@@ -238,6 +238,19 @@ var Bundler = class extends MastraBundler {
|
|
|
238
238
|
}
|
|
239
239
|
await copy(publicDir, join(outputDirectory, this.outputDir));
|
|
240
240
|
}
|
|
241
|
+
async copyDOTNPMRC({
|
|
242
|
+
rootDir = process.cwd(),
|
|
243
|
+
outputDirectory
|
|
244
|
+
}) {
|
|
245
|
+
const sourceDotNpmRcPath = join(rootDir, ".npmrc");
|
|
246
|
+
const targetDotNpmRcPath = join(outputDirectory, this.outputDir, ".npmrc");
|
|
247
|
+
try {
|
|
248
|
+
await stat(sourceDotNpmRcPath);
|
|
249
|
+
await copy(sourceDotNpmRcPath, targetDotNpmRcPath);
|
|
250
|
+
} catch {
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
253
|
+
}
|
|
241
254
|
async getBundlerOptions(serverFile, mastraEntryFile, analyzedBundleInfo, toolsPaths) {
|
|
242
255
|
const inputOptions = await getInputOptions(mastraEntryFile, analyzedBundleInfo, "node", {
|
|
243
256
|
"process.env.NODE_ENV": JSON.stringify("production")
|
|
@@ -282,7 +295,7 @@ var Bundler = class extends MastraBundler {
|
|
|
282
295
|
}
|
|
283
296
|
return inputs;
|
|
284
297
|
}
|
|
285
|
-
async _bundle(serverFile, mastraEntryFile, outputDirectory, toolsPaths = [], bundleLocation = join(outputDirectory, this.outputDir)) {
|
|
298
|
+
async _bundle(serverFile, mastraEntryFile, outputDirectory, toolsPaths = [], bundleLocation = join(outputDirectory, this.outputDir), installDependencies = true) {
|
|
286
299
|
this.logger.info("Start bundling Mastra");
|
|
287
300
|
let analyzedBundleInfo;
|
|
288
301
|
try {
|
|
@@ -446,9 +459,14 @@ export const tools = [${toolsExports.join(", ")}]`
|
|
|
446
459
|
this.logger.info("Copying public files");
|
|
447
460
|
await this.copyPublic(dirname(mastraEntryFile), outputDirectory);
|
|
448
461
|
this.logger.info("Done copying public files");
|
|
449
|
-
this.logger.info("
|
|
450
|
-
await this.
|
|
451
|
-
this.logger.info("Done
|
|
462
|
+
this.logger.info("Copying .npmrc file");
|
|
463
|
+
await this.copyDOTNPMRC({ outputDirectory });
|
|
464
|
+
this.logger.info("Done copying .npmrc file");
|
|
465
|
+
if (installDependencies) {
|
|
466
|
+
this.logger.info("Installing dependencies");
|
|
467
|
+
await this.installDependencies(outputDirectory);
|
|
468
|
+
this.logger.info("Done installing dependencies");
|
|
469
|
+
}
|
|
452
470
|
} catch (error) {
|
|
453
471
|
const message = error instanceof Error ? error.message : String(error);
|
|
454
472
|
throw new MastraError(
|
|
@@ -169,7 +169,7 @@ var Bundler = class extends bundler.MastraBundler {
|
|
|
169
169
|
}
|
|
170
170
|
async writeInstrumentationFile(outputDirectory, customInstrumentationFile) {
|
|
171
171
|
const instrumentationFile = path.join(outputDirectory, "instrumentation.mjs");
|
|
172
|
-
const __dirname = path.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-
|
|
172
|
+
const __dirname = path.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-UFVGATV6.cjs', document.baseURI).href))));
|
|
173
173
|
if (customInstrumentationFile) {
|
|
174
174
|
await fsExtra.copy(customInstrumentationFile, instrumentationFile);
|
|
175
175
|
} else {
|
|
@@ -250,6 +250,19 @@ var Bundler = class extends bundler.MastraBundler {
|
|
|
250
250
|
}
|
|
251
251
|
await fsExtra.copy(publicDir, path.join(outputDirectory, this.outputDir));
|
|
252
252
|
}
|
|
253
|
+
async copyDOTNPMRC({
|
|
254
|
+
rootDir = process.cwd(),
|
|
255
|
+
outputDirectory
|
|
256
|
+
}) {
|
|
257
|
+
const sourceDotNpmRcPath = path.join(rootDir, ".npmrc");
|
|
258
|
+
const targetDotNpmRcPath = path.join(outputDirectory, this.outputDir, ".npmrc");
|
|
259
|
+
try {
|
|
260
|
+
await promises.stat(sourceDotNpmRcPath);
|
|
261
|
+
await fsExtra.copy(sourceDotNpmRcPath, targetDotNpmRcPath);
|
|
262
|
+
} catch {
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
253
266
|
async getBundlerOptions(serverFile, mastraEntryFile, analyzedBundleInfo, toolsPaths) {
|
|
254
267
|
const inputOptions = await chunkD2DCFCLH_cjs.getInputOptions(mastraEntryFile, analyzedBundleInfo, "node", {
|
|
255
268
|
"process.env.NODE_ENV": JSON.stringify("production")
|
|
@@ -294,7 +307,7 @@ var Bundler = class extends bundler.MastraBundler {
|
|
|
294
307
|
}
|
|
295
308
|
return inputs;
|
|
296
309
|
}
|
|
297
|
-
async _bundle(serverFile, mastraEntryFile, outputDirectory, toolsPaths = [], bundleLocation = path.join(outputDirectory, this.outputDir)) {
|
|
310
|
+
async _bundle(serverFile, mastraEntryFile, outputDirectory, toolsPaths = [], bundleLocation = path.join(outputDirectory, this.outputDir), installDependencies = true) {
|
|
298
311
|
this.logger.info("Start bundling Mastra");
|
|
299
312
|
let analyzedBundleInfo;
|
|
300
313
|
try {
|
|
@@ -458,9 +471,14 @@ export const tools = [${toolsExports.join(", ")}]`
|
|
|
458
471
|
this.logger.info("Copying public files");
|
|
459
472
|
await this.copyPublic(path.dirname(mastraEntryFile), outputDirectory);
|
|
460
473
|
this.logger.info("Done copying public files");
|
|
461
|
-
this.logger.info("
|
|
462
|
-
await this.
|
|
463
|
-
this.logger.info("Done
|
|
474
|
+
this.logger.info("Copying .npmrc file");
|
|
475
|
+
await this.copyDOTNPMRC({ outputDirectory });
|
|
476
|
+
this.logger.info("Done copying .npmrc file");
|
|
477
|
+
if (installDependencies) {
|
|
478
|
+
this.logger.info("Installing dependencies");
|
|
479
|
+
await this.installDependencies(outputDirectory);
|
|
480
|
+
this.logger.info("Done installing dependencies");
|
|
481
|
+
}
|
|
464
482
|
} catch (error$1) {
|
|
465
483
|
const message = error$1 instanceof Error ? error$1.message : String(error$1);
|
|
466
484
|
throw new error.MastraError(
|
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkUFVGATV6_cjs = require('./chunk-UFVGATV6.cjs');
|
|
4
4
|
var chunkXKH6F4NE_cjs = require('./chunk-XKH6F4NE.cjs');
|
|
5
5
|
var chunkKCP5ITLV_cjs = require('./chunk-KCP5ITLV.cjs');
|
|
6
6
|
var babel = require('@babel/core');
|
|
@@ -33,7 +33,7 @@ var esbuild__default = /*#__PURE__*/_interopDefault(esbuild);
|
|
|
33
33
|
var commonjs__default = /*#__PURE__*/_interopDefault(commonjs);
|
|
34
34
|
|
|
35
35
|
// src/deploy/base.ts
|
|
36
|
-
var Deployer = class extends
|
|
36
|
+
var Deployer = class extends chunkUFVGATV6_cjs.Bundler {
|
|
37
37
|
deps = new chunkKCP5ITLV_cjs.DepsService();
|
|
38
38
|
constructor(args) {
|
|
39
39
|
super(args.name, "DEPLOYER");
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Bundler } from './chunk-
|
|
1
|
+
import { Bundler } from './chunk-D57U647E.js';
|
|
2
2
|
import { recursiveRemoveNonReferencedNodes } from './chunk-UYQZMNZL.js';
|
|
3
3
|
import { DepsService, FileService } from './chunk-GPD54HBC.js';
|
|
4
4
|
export { Deps, FileService, createChildProcessLogger, createPinoStream } from './chunk-GPD54HBC.js';
|
package/dist/server/index.cjs
CHANGED
|
@@ -3726,6 +3726,44 @@ async function getMessagesHandler(c2) {
|
|
|
3726
3726
|
return handleError(error, "Error getting messages");
|
|
3727
3727
|
}
|
|
3728
3728
|
}
|
|
3729
|
+
async function updateWorkingMemoryHandler(c2) {
|
|
3730
|
+
try {
|
|
3731
|
+
const mastra = c2.get("mastra");
|
|
3732
|
+
const agentId = c2.req.query("agentId");
|
|
3733
|
+
const threadId = c2.req.param("threadId");
|
|
3734
|
+
const networkId = c2.req.query("networkId");
|
|
3735
|
+
const body = await c2.req.json();
|
|
3736
|
+
const result = await memory.updateWorkingMemoryHandler({
|
|
3737
|
+
mastra,
|
|
3738
|
+
agentId,
|
|
3739
|
+
threadId,
|
|
3740
|
+
body,
|
|
3741
|
+
networkId
|
|
3742
|
+
});
|
|
3743
|
+
return c2.json(result);
|
|
3744
|
+
} catch (error) {
|
|
3745
|
+
return handleError(error, "Error updating working memory");
|
|
3746
|
+
}
|
|
3747
|
+
}
|
|
3748
|
+
async function getWorkingMemoryHandler(c2) {
|
|
3749
|
+
try {
|
|
3750
|
+
const mastra = c2.get("mastra");
|
|
3751
|
+
const agentId = c2.req.query("agentId");
|
|
3752
|
+
const threadId = c2.req.param("threadId");
|
|
3753
|
+
const resourceId = c2.req.query("resourceId");
|
|
3754
|
+
const networkId = c2.req.query("networkId");
|
|
3755
|
+
const result = await memory.getWorkingMemoryHandler({
|
|
3756
|
+
mastra,
|
|
3757
|
+
agentId,
|
|
3758
|
+
threadId,
|
|
3759
|
+
resourceId,
|
|
3760
|
+
networkId
|
|
3761
|
+
});
|
|
3762
|
+
return c2.json(result);
|
|
3763
|
+
} catch (error) {
|
|
3764
|
+
return handleError(error, "Error getting working memory");
|
|
3765
|
+
}
|
|
3766
|
+
}
|
|
3729
3767
|
async function getNetworksHandler(c2) {
|
|
3730
3768
|
try {
|
|
3731
3769
|
const mastra = c2.get("mastra");
|
|
@@ -6876,6 +6914,88 @@ ${err.stack.split("\n").slice(1).join("\n")}
|
|
|
6876
6914
|
}),
|
|
6877
6915
|
getMessagesHandler
|
|
6878
6916
|
);
|
|
6917
|
+
app.get(
|
|
6918
|
+
"/api/memory/threads/:threadId/working-memory",
|
|
6919
|
+
w({
|
|
6920
|
+
description: "Get working memory for a thread",
|
|
6921
|
+
tags: ["memory"],
|
|
6922
|
+
parameters: [
|
|
6923
|
+
{
|
|
6924
|
+
name: "threadId",
|
|
6925
|
+
in: "path",
|
|
6926
|
+
required: true,
|
|
6927
|
+
schema: { type: "string" }
|
|
6928
|
+
},
|
|
6929
|
+
{
|
|
6930
|
+
name: "agentId",
|
|
6931
|
+
in: "query",
|
|
6932
|
+
required: true,
|
|
6933
|
+
schema: { type: "string" }
|
|
6934
|
+
},
|
|
6935
|
+
{
|
|
6936
|
+
name: "resourceId",
|
|
6937
|
+
in: "query",
|
|
6938
|
+
required: false,
|
|
6939
|
+
schema: { type: "string" }
|
|
6940
|
+
}
|
|
6941
|
+
],
|
|
6942
|
+
responses: {
|
|
6943
|
+
200: {
|
|
6944
|
+
description: "Working memory details"
|
|
6945
|
+
},
|
|
6946
|
+
404: {
|
|
6947
|
+
description: "Thread not found"
|
|
6948
|
+
}
|
|
6949
|
+
}
|
|
6950
|
+
}),
|
|
6951
|
+
getWorkingMemoryHandler
|
|
6952
|
+
);
|
|
6953
|
+
app.post(
|
|
6954
|
+
"/api/memory/threads/:threadId/working-memory",
|
|
6955
|
+
bodyLimit.bodyLimit(bodyLimitOptions),
|
|
6956
|
+
w({
|
|
6957
|
+
description: "Update working memory for a thread",
|
|
6958
|
+
tags: ["memory"],
|
|
6959
|
+
parameters: [
|
|
6960
|
+
{
|
|
6961
|
+
name: "threadId",
|
|
6962
|
+
in: "path",
|
|
6963
|
+
required: true,
|
|
6964
|
+
schema: { type: "string" }
|
|
6965
|
+
},
|
|
6966
|
+
{
|
|
6967
|
+
name: "agentId",
|
|
6968
|
+
in: "query",
|
|
6969
|
+
required: true,
|
|
6970
|
+
schema: { type: "string" }
|
|
6971
|
+
}
|
|
6972
|
+
],
|
|
6973
|
+
requestBody: {
|
|
6974
|
+
required: true,
|
|
6975
|
+
content: {
|
|
6976
|
+
"application/json": {
|
|
6977
|
+
schema: {
|
|
6978
|
+
type: "object",
|
|
6979
|
+
properties: {
|
|
6980
|
+
workingMemory: { type: "string" },
|
|
6981
|
+
resourceId: { type: "string" }
|
|
6982
|
+
},
|
|
6983
|
+
required: ["workingMemory"]
|
|
6984
|
+
}
|
|
6985
|
+
}
|
|
6986
|
+
}
|
|
6987
|
+
},
|
|
6988
|
+
responses: {
|
|
6989
|
+
200: {
|
|
6990
|
+
description: "Working memory updated successfully"
|
|
6991
|
+
},
|
|
6992
|
+
404: {
|
|
6993
|
+
description: "Thread not found"
|
|
6994
|
+
}
|
|
6995
|
+
}
|
|
6996
|
+
}),
|
|
6997
|
+
updateWorkingMemoryHandler
|
|
6998
|
+
);
|
|
6879
6999
|
app.post(
|
|
6880
7000
|
"/api/memory/threads",
|
|
6881
7001
|
bodyLimit.bodyLimit(bodyLimitOptions),
|
package/dist/server/index.js
CHANGED
|
@@ -24,7 +24,7 @@ import { getLegacyWorkflowsHandler as getLegacyWorkflowsHandler$1, getLegacyWork
|
|
|
24
24
|
import { getLogsHandler as getLogsHandler$1, getLogTransports as getLogTransports$1, getLogsByRunIdHandler as getLogsByRunIdHandler$1 } from '@mastra/server/handlers/logs';
|
|
25
25
|
import util from 'util';
|
|
26
26
|
import { Buffer as Buffer$1 } from 'buffer';
|
|
27
|
-
import { getMemoryStatusHandler as getMemoryStatusHandler$1, getThreadsHandler as getThreadsHandler$1, getThreadByIdHandler as getThreadByIdHandler$1, getMessagesHandler as getMessagesHandler$1, createThreadHandler as createThreadHandler$1, updateThreadHandler as updateThreadHandler$1, deleteThreadHandler as deleteThreadHandler$1, saveMessagesHandler as saveMessagesHandler$1 } from '@mastra/server/handlers/memory';
|
|
27
|
+
import { getMemoryStatusHandler as getMemoryStatusHandler$1, getThreadsHandler as getThreadsHandler$1, getThreadByIdHandler as getThreadByIdHandler$1, getMessagesHandler as getMessagesHandler$1, createThreadHandler as createThreadHandler$1, updateThreadHandler as updateThreadHandler$1, deleteThreadHandler as deleteThreadHandler$1, saveMessagesHandler as saveMessagesHandler$1, getWorkingMemoryHandler as getWorkingMemoryHandler$1, updateWorkingMemoryHandler as updateWorkingMemoryHandler$1 } from '@mastra/server/handlers/memory';
|
|
28
28
|
import { getNetworksHandler as getNetworksHandler$1, getNetworkByIdHandler as getNetworkByIdHandler$1, generateHandler as generateHandler$1, streamGenerateHandler as streamGenerateHandler$1 } from '@mastra/server/handlers/network';
|
|
29
29
|
import { Agent } from '@mastra/core/agent';
|
|
30
30
|
import { z } from 'zod';
|
|
@@ -3719,6 +3719,44 @@ async function getMessagesHandler(c2) {
|
|
|
3719
3719
|
return handleError(error, "Error getting messages");
|
|
3720
3720
|
}
|
|
3721
3721
|
}
|
|
3722
|
+
async function updateWorkingMemoryHandler(c2) {
|
|
3723
|
+
try {
|
|
3724
|
+
const mastra = c2.get("mastra");
|
|
3725
|
+
const agentId = c2.req.query("agentId");
|
|
3726
|
+
const threadId = c2.req.param("threadId");
|
|
3727
|
+
const networkId = c2.req.query("networkId");
|
|
3728
|
+
const body = await c2.req.json();
|
|
3729
|
+
const result = await updateWorkingMemoryHandler$1({
|
|
3730
|
+
mastra,
|
|
3731
|
+
agentId,
|
|
3732
|
+
threadId,
|
|
3733
|
+
body,
|
|
3734
|
+
networkId
|
|
3735
|
+
});
|
|
3736
|
+
return c2.json(result);
|
|
3737
|
+
} catch (error) {
|
|
3738
|
+
return handleError(error, "Error updating working memory");
|
|
3739
|
+
}
|
|
3740
|
+
}
|
|
3741
|
+
async function getWorkingMemoryHandler(c2) {
|
|
3742
|
+
try {
|
|
3743
|
+
const mastra = c2.get("mastra");
|
|
3744
|
+
const agentId = c2.req.query("agentId");
|
|
3745
|
+
const threadId = c2.req.param("threadId");
|
|
3746
|
+
const resourceId = c2.req.query("resourceId");
|
|
3747
|
+
const networkId = c2.req.query("networkId");
|
|
3748
|
+
const result = await getWorkingMemoryHandler$1({
|
|
3749
|
+
mastra,
|
|
3750
|
+
agentId,
|
|
3751
|
+
threadId,
|
|
3752
|
+
resourceId,
|
|
3753
|
+
networkId
|
|
3754
|
+
});
|
|
3755
|
+
return c2.json(result);
|
|
3756
|
+
} catch (error) {
|
|
3757
|
+
return handleError(error, "Error getting working memory");
|
|
3758
|
+
}
|
|
3759
|
+
}
|
|
3722
3760
|
async function getNetworksHandler(c2) {
|
|
3723
3761
|
try {
|
|
3724
3762
|
const mastra = c2.get("mastra");
|
|
@@ -6869,6 +6907,88 @@ ${err.stack.split("\n").slice(1).join("\n")}
|
|
|
6869
6907
|
}),
|
|
6870
6908
|
getMessagesHandler
|
|
6871
6909
|
);
|
|
6910
|
+
app.get(
|
|
6911
|
+
"/api/memory/threads/:threadId/working-memory",
|
|
6912
|
+
w({
|
|
6913
|
+
description: "Get working memory for a thread",
|
|
6914
|
+
tags: ["memory"],
|
|
6915
|
+
parameters: [
|
|
6916
|
+
{
|
|
6917
|
+
name: "threadId",
|
|
6918
|
+
in: "path",
|
|
6919
|
+
required: true,
|
|
6920
|
+
schema: { type: "string" }
|
|
6921
|
+
},
|
|
6922
|
+
{
|
|
6923
|
+
name: "agentId",
|
|
6924
|
+
in: "query",
|
|
6925
|
+
required: true,
|
|
6926
|
+
schema: { type: "string" }
|
|
6927
|
+
},
|
|
6928
|
+
{
|
|
6929
|
+
name: "resourceId",
|
|
6930
|
+
in: "query",
|
|
6931
|
+
required: false,
|
|
6932
|
+
schema: { type: "string" }
|
|
6933
|
+
}
|
|
6934
|
+
],
|
|
6935
|
+
responses: {
|
|
6936
|
+
200: {
|
|
6937
|
+
description: "Working memory details"
|
|
6938
|
+
},
|
|
6939
|
+
404: {
|
|
6940
|
+
description: "Thread not found"
|
|
6941
|
+
}
|
|
6942
|
+
}
|
|
6943
|
+
}),
|
|
6944
|
+
getWorkingMemoryHandler
|
|
6945
|
+
);
|
|
6946
|
+
app.post(
|
|
6947
|
+
"/api/memory/threads/:threadId/working-memory",
|
|
6948
|
+
bodyLimit(bodyLimitOptions),
|
|
6949
|
+
w({
|
|
6950
|
+
description: "Update working memory for a thread",
|
|
6951
|
+
tags: ["memory"],
|
|
6952
|
+
parameters: [
|
|
6953
|
+
{
|
|
6954
|
+
name: "threadId",
|
|
6955
|
+
in: "path",
|
|
6956
|
+
required: true,
|
|
6957
|
+
schema: { type: "string" }
|
|
6958
|
+
},
|
|
6959
|
+
{
|
|
6960
|
+
name: "agentId",
|
|
6961
|
+
in: "query",
|
|
6962
|
+
required: true,
|
|
6963
|
+
schema: { type: "string" }
|
|
6964
|
+
}
|
|
6965
|
+
],
|
|
6966
|
+
requestBody: {
|
|
6967
|
+
required: true,
|
|
6968
|
+
content: {
|
|
6969
|
+
"application/json": {
|
|
6970
|
+
schema: {
|
|
6971
|
+
type: "object",
|
|
6972
|
+
properties: {
|
|
6973
|
+
workingMemory: { type: "string" },
|
|
6974
|
+
resourceId: { type: "string" }
|
|
6975
|
+
},
|
|
6976
|
+
required: ["workingMemory"]
|
|
6977
|
+
}
|
|
6978
|
+
}
|
|
6979
|
+
}
|
|
6980
|
+
},
|
|
6981
|
+
responses: {
|
|
6982
|
+
200: {
|
|
6983
|
+
description: "Working memory updated successfully"
|
|
6984
|
+
},
|
|
6985
|
+
404: {
|
|
6986
|
+
description: "Thread not found"
|
|
6987
|
+
}
|
|
6988
|
+
}
|
|
6989
|
+
}),
|
|
6990
|
+
updateWorkingMemoryHandler
|
|
6991
|
+
);
|
|
6872
6992
|
app.post(
|
|
6873
6993
|
"/api/memory/threads",
|
|
6874
6994
|
bodyLimit(bodyLimitOptions),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/deployer",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.15-alpha.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -108,7 +108,7 @@
|
|
|
108
108
|
"rollup-plugin-node-externals": "^8.0.1",
|
|
109
109
|
"typescript-paths": "^1.5.1",
|
|
110
110
|
"zod": "^3.25.67",
|
|
111
|
-
"@mastra/server": "^0.10.
|
|
111
|
+
"@mastra/server": "^0.10.15-alpha.1"
|
|
112
112
|
},
|
|
113
113
|
"devDependencies": {
|
|
114
114
|
"@hono/node-server": "^1.14.4",
|
|
@@ -118,7 +118,7 @@
|
|
|
118
118
|
"@types/babel__helper-module-imports": "^7.18.3",
|
|
119
119
|
"@types/fs-extra": "^11.0.4",
|
|
120
120
|
"@types/node": "^20.19.0",
|
|
121
|
-
"eslint": "^9.
|
|
121
|
+
"eslint": "^9.30.1",
|
|
122
122
|
"fetch-to-node": "^2.1.0",
|
|
123
123
|
"hono-openapi": "^0.4.8",
|
|
124
124
|
"rollup-plugin-visualizer": "^5.14.0",
|
|
@@ -128,8 +128,8 @@
|
|
|
128
128
|
"typescript": "^5.8.3",
|
|
129
129
|
"vitest": "^3.2.4",
|
|
130
130
|
"@internal/lint": "0.0.19",
|
|
131
|
-
"@mastra/
|
|
132
|
-
"@mastra/
|
|
131
|
+
"@mastra/core": "0.10.15-alpha.1",
|
|
132
|
+
"@mastra/mcp": "^0.10.6"
|
|
133
133
|
},
|
|
134
134
|
"peerDependencies": {
|
|
135
135
|
"@mastra/core": ">=0.10.9-0 <0.11.0-0"
|