mastracode 0.9.3-alpha.4 → 0.10.0-alpha.6
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/CHANGELOG.md +25 -0
- package/dist/agents/memory.d.ts +2 -1
- package/dist/agents/memory.d.ts.map +1 -1
- package/dist/{chunk-PNTTJLEX.js → chunk-3WUT5CKI.js} +42 -11
- package/dist/chunk-3WUT5CKI.js.map +1 -0
- package/dist/{chunk-7FCUOW5Y.cjs → chunk-FQ6BQZ7X.cjs} +820 -760
- package/dist/chunk-FQ6BQZ7X.cjs.map +1 -0
- package/dist/{chunk-MFRKXIJB.cjs → chunk-GE6PEBOR.cjs} +8 -6
- package/dist/chunk-GE6PEBOR.cjs.map +1 -0
- package/dist/{chunk-VJAVSE45.cjs → chunk-HULGMREX.cjs} +73 -42
- package/dist/chunk-HULGMREX.cjs.map +1 -0
- package/dist/{chunk-RL6AQQK7.js → chunk-J4DT4CDH.js} +83 -22
- package/dist/chunk-J4DT4CDH.js.map +1 -0
- package/dist/{chunk-SCGR45LE.cjs → chunk-P2NLJLNZ.cjs} +6 -2
- package/dist/chunk-P2NLJLNZ.cjs.map +1 -0
- package/dist/{chunk-IXFFPLAG.js → chunk-SOFDIZWA.js} +5 -3
- package/dist/chunk-SOFDIZWA.js.map +1 -0
- package/dist/{chunk-YIBXRSXL.js → chunk-WGXQUI3D.js} +6 -3
- package/dist/chunk-WGXQUI3D.js.map +1 -0
- package/dist/cli.cjs +17 -17
- package/dist/cli.js +4 -4
- package/dist/index.cjs +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/onboarding/settings.d.ts +4 -0
- package/dist/onboarding/settings.d.ts.map +1 -1
- package/dist/storage-EVBOAXYI.js +3 -0
- package/dist/{storage-T6AFSPIY.js.map → storage-EVBOAXYI.js.map} +1 -1
- package/dist/storage-FHIJ2CJ5.cjs +24 -0
- package/dist/{storage-6BUW7JXT.cjs.map → storage-FHIJ2CJ5.cjs.map} +1 -1
- package/dist/tui/command-dispatch.d.ts.map +1 -1
- package/dist/tui/commands/index.d.ts +1 -0
- package/dist/tui/commands/index.d.ts.map +1 -1
- package/dist/tui/commands/om.d.ts.map +1 -1
- package/dist/tui/commands/thread.d.ts +3 -0
- package/dist/tui/commands/thread.d.ts.map +1 -0
- package/dist/tui/components/help-overlay.d.ts.map +1 -1
- package/dist/tui/setup.d.ts.map +1 -1
- package/dist/tui.cjs +19 -19
- package/dist/tui.js +2 -2
- package/dist/utils/project.d.ts +5 -0
- package/dist/utils/project.d.ts.map +1 -1
- package/dist/utils/slash-command-loader.d.ts +5 -2
- package/dist/utils/slash-command-loader.d.ts.map +1 -1
- package/dist/utils/storage-factory.d.ts +9 -0
- package/dist/utils/storage-factory.d.ts.map +1 -1
- package/package.json +7 -7
- package/dist/chunk-7FCUOW5Y.cjs.map +0 -1
- package/dist/chunk-IXFFPLAG.js.map +0 -1
- package/dist/chunk-MFRKXIJB.cjs.map +0 -1
- package/dist/chunk-PNTTJLEX.js.map +0 -1
- package/dist/chunk-RL6AQQK7.js.map +0 -1
- package/dist/chunk-SCGR45LE.cjs.map +0 -1
- package/dist/chunk-VJAVSE45.cjs.map +0 -1
- package/dist/chunk-YIBXRSXL.js.map +0 -1
- package/dist/storage-6BUW7JXT.cjs +0 -24
- package/dist/storage-T6AFSPIY.js +0 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
# mastracode
|
|
2
2
|
|
|
3
|
+
## 0.10.0-alpha.6
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Added a /thread command to show the active thread, resource, and pending-new-thread state. ([#14567](https://github.com/mastra-ai/mastra/pull/14567))
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Persist observational memory threshold settings across restarts and restore per-thread overrides. ([#14788](https://github.com/mastra-ai/mastra/pull/14788))
|
|
12
|
+
|
|
13
|
+
- Limit dynamically injected AGENTS.md reminders to 1000 estimated tokens by default and tell mastracode observational memory to ignore those ephemeral reminder messages. ([#14790](https://github.com/mastra-ai/mastra/pull/14790))
|
|
14
|
+
|
|
15
|
+
- Updated dependencies [[`e333b77`](https://github.com/mastra-ai/mastra/commit/e333b77e2d76ba57ccec1818e08cebc1993469ff), [`60a224d`](https://github.com/mastra-ai/mastra/commit/60a224dd497240e83698cfa5bfd02e3d1d854844), [`949b7bf`](https://github.com/mastra-ai/mastra/commit/949b7bfd4e40f2b2cba7fef5eb3f108a02cfe938), [`d084b66`](https://github.com/mastra-ai/mastra/commit/d084b6692396057e83c086b954c1857d20b58a14), [`79c699a`](https://github.com/mastra-ai/mastra/commit/79c699acf3cd8a77e11c55530431f48eb48456e9), [`62757b6`](https://github.com/mastra-ai/mastra/commit/62757b6db6e8bb86569d23ad0b514178f57053f8), [`3d70b0b`](https://github.com/mastra-ai/mastra/commit/3d70b0b3524d817173ad870768f259c06d61bd23), [`3b45a13`](https://github.com/mastra-ai/mastra/commit/3b45a138d09d040779c0aba1edbbfc1b57442d23), [`dd668a0`](https://github.com/mastra-ai/mastra/commit/dd668a0e4d6b3fd75cbe780028b578f0ac0ec635), [`8127d96`](https://github.com/mastra-ai/mastra/commit/8127d96280492e335d49b244501088dfdd59a8f1)]:
|
|
16
|
+
- @mastra/core@1.18.0-alpha.3
|
|
17
|
+
- @mastra/memory@1.11.0-alpha.4
|
|
18
|
+
|
|
19
|
+
## 0.9.3-alpha.5
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- Custom slash commands now load correctly from all configured directories ([#14727](https://github.com/mastra-ai/mastra/pull/14727))
|
|
24
|
+
|
|
25
|
+
- Updated dependencies [[`f16d92c`](https://github.com/mastra-ai/mastra/commit/f16d92c677a119a135cebcf7e2b9f51ada7a9df4)]:
|
|
26
|
+
- @mastra/core@1.18.0-alpha.2
|
|
27
|
+
|
|
3
28
|
## 0.9.3-alpha.4
|
|
4
29
|
|
|
5
30
|
### Patch Changes
|
package/dist/agents/memory.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import type { RequestContext } from '@mastra/core/request-context';
|
|
2
2
|
import type { MastraCompositeStore } from '@mastra/core/storage';
|
|
3
|
+
import type { MastraVector } from '@mastra/core/vector';
|
|
3
4
|
import { Memory } from '@mastra/memory';
|
|
4
5
|
/**
|
|
5
6
|
* Dynamic memory factory function.
|
|
6
7
|
* Reads OM thresholds from harness state via requestContext.
|
|
7
8
|
* Model functions also read from requestContext (no mutable bridge needed).
|
|
8
9
|
*/
|
|
9
|
-
export declare function getDynamicMemory(storage: MastraCompositeStore): ({ requestContext }: {
|
|
10
|
+
export declare function getDynamicMemory(storage: MastraCompositeStore, vector?: MastraVector): ({ requestContext }: {
|
|
10
11
|
requestContext: RequestContext;
|
|
11
12
|
}) => Memory;
|
|
12
13
|
//# sourceMappingURL=memory.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../../src/agents/memory.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAyCxC;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,oBAAoB,
|
|
1
|
+
{"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../../src/agents/memory.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAyCxC;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,oBAAoB,EAAE,MAAM,CAAC,EAAE,YAAY,IAC3E,oBAAoB;IAAE,cAAc,EAAE,cAAc,CAAA;CAAE,YAiD/D"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { loadSettings, getAvailableModePacks, getAvailableOmPacks, resolveModelDefaults, resolveOmModel, mastra, releaseThreadLock, acquireThreadLock, getCustomProviderId, toCustomProviderModelId, saveSettings } from './chunk-
|
|
2
|
-
import { AuthStorage, detectProject, getResourceIdOverride, getStorageConfig, getCurrentGitBranch, getOmScope, getDatabasePath } from './chunk-
|
|
1
|
+
import { loadSettings, getAvailableModePacks, getAvailableOmPacks, resolveModelDefaults, resolveOmModel, mastra, releaseThreadLock, acquireThreadLock, getCustomProviderId, toCustomProviderModelId, saveSettings } from './chunk-SOFDIZWA.js';
|
|
2
|
+
import { AuthStorage, detectProject, getResourceIdOverride, getStorageConfig, getVectorDatabasePath, getCurrentGitBranch, getOmScope, getDatabasePath } from './chunk-WGXQUI3D.js';
|
|
3
3
|
import { MC_TOOLS, getToolCategory, TOOL_NAME_OVERRIDES } from './chunk-JP7WKMD4.js';
|
|
4
4
|
import { Agent } from '@mastra/core/agent';
|
|
5
5
|
import { taskCheckTool, taskWriteTool, Harness } from '@mastra/core/harness';
|
|
@@ -18,13 +18,14 @@ import { LocalFilesystem, Workspace, LocalSandbox } from '@mastra/core/workspace
|
|
|
18
18
|
import * as fs4 from 'fs';
|
|
19
19
|
import fs4__default, { readFileSync, existsSync } from 'fs';
|
|
20
20
|
import { fileURLToPath } from 'url';
|
|
21
|
+
import { fastembed } from '@mastra/fastembed';
|
|
21
22
|
import { Memory } from '@mastra/memory';
|
|
22
23
|
import { createAnthropic } from '@ai-sdk/anthropic';
|
|
23
24
|
import { createOpenAI } from '@ai-sdk/openai';
|
|
24
25
|
import { wrapLanguageModel } from 'ai';
|
|
25
26
|
import { spawn } from 'child_process';
|
|
26
27
|
import { MCPClient } from '@mastra/mcp';
|
|
27
|
-
import { LibSQLStore } from '@mastra/libsql';
|
|
28
|
+
import { LibSQLStore, LibSQLVector } from '@mastra/libsql';
|
|
28
29
|
import { PostgresStore } from '@mastra/pg';
|
|
29
30
|
|
|
30
31
|
// src/agents/prompts/base.ts
|
|
@@ -1320,7 +1321,7 @@ function getReflectorModel({ requestContext }) {
|
|
|
1320
1321
|
requestContext
|
|
1321
1322
|
});
|
|
1322
1323
|
}
|
|
1323
|
-
function getDynamicMemory(storage) {
|
|
1324
|
+
function getDynamicMemory(storage, vector) {
|
|
1324
1325
|
return ({ requestContext }) => {
|
|
1325
1326
|
const state = getHarnessState(requestContext);
|
|
1326
1327
|
const omScope = state?.omScope ?? getOmScope(state?.projectPath);
|
|
@@ -1334,10 +1335,12 @@ function getDynamicMemory(storage) {
|
|
|
1334
1335
|
const isResourceScope = omScope === "resource";
|
|
1335
1336
|
cachedMemory = new Memory({
|
|
1336
1337
|
storage,
|
|
1338
|
+
vector: vector || false,
|
|
1339
|
+
embedder: vector ? fastembed.small : void 0,
|
|
1337
1340
|
options: {
|
|
1338
1341
|
observationalMemory: {
|
|
1339
1342
|
enabled: true,
|
|
1340
|
-
retrieval:
|
|
1343
|
+
retrieval: vector ? { vector: true } : true,
|
|
1341
1344
|
scope: omScope,
|
|
1342
1345
|
observation: {
|
|
1343
1346
|
bufferTokens: isResourceScope ? false : 1 / 5,
|
|
@@ -1346,7 +1349,8 @@ function getDynamicMemory(storage) {
|
|
|
1346
1349
|
messageTokens: obsThreshold,
|
|
1347
1350
|
blockAfter: 2,
|
|
1348
1351
|
previousObserverTokens: observerPreviousObservationTokens,
|
|
1349
|
-
threadTitle: true
|
|
1352
|
+
threadTitle: true,
|
|
1353
|
+
instruction: 'Messages wrapped in <system-reminder type="dynamic-agents-md" ...>...</system-reminder> are ephemeral project-context instructions injected from files on disk. Do NOT observe or extract information from these messages \u2014 they are reloaded automatically when needed and should not be stored in memory.'
|
|
1350
1354
|
},
|
|
1351
1355
|
reflection: {
|
|
1352
1356
|
bufferActivation: isResourceScope ? void 0 : 1 / 2,
|
|
@@ -2474,13 +2478,15 @@ async function createStorage(config) {
|
|
|
2474
2478
|
id: "mastra-code-storage",
|
|
2475
2479
|
url: config.url,
|
|
2476
2480
|
...config.authToken ? { authToken: config.authToken } : {}
|
|
2477
|
-
})
|
|
2481
|
+
}),
|
|
2482
|
+
backend: "libsql"
|
|
2478
2483
|
};
|
|
2479
2484
|
}
|
|
2480
2485
|
async function createPgStorage(config) {
|
|
2481
2486
|
if (!config.connectionString && !config.host) {
|
|
2482
2487
|
return {
|
|
2483
2488
|
storage: createFallbackLibSQL(),
|
|
2489
|
+
backend: "libsql",
|
|
2484
2490
|
warning: "PostgreSQL backend selected but no connection info configured. Using LibSQL fallback. Set a connection string via /settings."
|
|
2485
2491
|
};
|
|
2486
2492
|
}
|
|
@@ -2509,11 +2515,27 @@ async function createPgStorage(config) {
|
|
|
2509
2515
|
}
|
|
2510
2516
|
return {
|
|
2511
2517
|
storage: createFallbackLibSQL(),
|
|
2518
|
+
backend: "libsql",
|
|
2512
2519
|
warning: `Failed to connect to PostgreSQL at ${target}: ${msg}
|
|
2513
2520
|
Using LibSQL fallback. Fix the connection via /settings.`
|
|
2514
2521
|
};
|
|
2515
2522
|
}
|
|
2516
|
-
return { storage: store };
|
|
2523
|
+
return { storage: store, backend: "pg" };
|
|
2524
|
+
}
|
|
2525
|
+
async function createVectorStore(config, effectiveBackend = config.backend) {
|
|
2526
|
+
if (effectiveBackend === "pg") {
|
|
2527
|
+
const pgConfig = config;
|
|
2528
|
+
if (!pgConfig.connectionString && !pgConfig.host) return void 0;
|
|
2529
|
+
const { PgVector } = await import('@mastra/pg');
|
|
2530
|
+
return new PgVector({
|
|
2531
|
+
id: "mastra-code-vectors",
|
|
2532
|
+
connectionString: pgConfig.connectionString ?? `postgresql://${pgConfig.user}:${pgConfig.password}@${pgConfig.host}:${pgConfig.port ?? 5432}/${pgConfig.database}`
|
|
2533
|
+
});
|
|
2534
|
+
}
|
|
2535
|
+
return new LibSQLVector({
|
|
2536
|
+
id: "mastra-code-vectors",
|
|
2537
|
+
url: `file:${getVectorDatabasePath()}`
|
|
2538
|
+
});
|
|
2517
2539
|
}
|
|
2518
2540
|
|
|
2519
2541
|
// src/index.ts
|
|
@@ -2551,7 +2573,8 @@ async function createMastraCode(config) {
|
|
|
2551
2573
|
const storageResult = await createStorage(storageConfig);
|
|
2552
2574
|
const storage = storageResult.storage;
|
|
2553
2575
|
const storageWarning = storageResult.warning;
|
|
2554
|
-
const
|
|
2576
|
+
const vectorStore = await createVectorStore(storageConfig, storageResult.backend);
|
|
2577
|
+
const memory = getDynamicMemory(storage, vectorStore);
|
|
2555
2578
|
const mcpManager = config?.disableMcp ? void 0 : createMcpManager(project.rootPath, config?.mcpServers);
|
|
2556
2579
|
const hookManager = config?.disableHooks ? void 0 : new HookManager(project.rootPath, "session-init");
|
|
2557
2580
|
if (hookManager?.hasHooks()) {
|
|
@@ -2633,6 +2656,8 @@ async function createMastraCode(config) {
|
|
|
2633
2656
|
const builtinOmPacks = getAvailableOmPacks(startupAccess);
|
|
2634
2657
|
const effectiveDefaults = resolveModelDefaults(globalSettings, builtinPacks);
|
|
2635
2658
|
const effectiveOmModel = resolveOmModel(globalSettings, builtinOmPacks);
|
|
2659
|
+
const effectiveObservationThreshold = globalSettings.models.omObservationThreshold ?? void 0;
|
|
2660
|
+
const effectiveReflectionThreshold = globalSettings.models.omReflectionThreshold ?? void 0;
|
|
2636
2661
|
const modes = (config?.modes ?? defaultModes).map((mode) => {
|
|
2637
2662
|
const savedModel = effectiveDefaults[mode.id];
|
|
2638
2663
|
return savedModel ? { ...mode, defaultModelId: savedModel } : mode;
|
|
@@ -2663,6 +2688,12 @@ async function createMastraCode(config) {
|
|
|
2663
2688
|
globalInitialState.observerModelId = effectiveOmModel;
|
|
2664
2689
|
globalInitialState.reflectorModelId = effectiveOmModel;
|
|
2665
2690
|
}
|
|
2691
|
+
if (effectiveObservationThreshold !== void 0) {
|
|
2692
|
+
globalInitialState.observationThreshold = effectiveObservationThreshold;
|
|
2693
|
+
}
|
|
2694
|
+
if (effectiveReflectionThreshold !== void 0) {
|
|
2695
|
+
globalInitialState.reflectionThreshold = effectiveReflectionThreshold;
|
|
2696
|
+
}
|
|
2666
2697
|
if (globalSettings.preferences.yolo !== null) {
|
|
2667
2698
|
globalInitialState.yolo = globalSettings.preferences.yolo;
|
|
2668
2699
|
}
|
|
@@ -2770,5 +2801,5 @@ async function createMastraCode(config) {
|
|
|
2770
2801
|
}
|
|
2771
2802
|
|
|
2772
2803
|
export { createAuthStorage, createMastraCode };
|
|
2773
|
-
//# sourceMappingURL=chunk-
|
|
2774
|
-
//# sourceMappingURL=chunk-
|
|
2804
|
+
//# sourceMappingURL=chunk-3WUT5CKI.js.map
|
|
2805
|
+
//# sourceMappingURL=chunk-3WUT5CKI.js.map
|