mastracode 0.23.0 → 0.23.1-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/CHANGELOG.md +41 -0
- package/dist/agents/workspace.d.ts +14 -1
- package/dist/agents/workspace.d.ts.map +1 -1
- package/dist/{chunk-3CO7PY6M.cjs → chunk-3PNUO4FX.cjs} +118 -83
- package/dist/chunk-3PNUO4FX.cjs.map +1 -0
- package/dist/{chunk-RDIIIT54.js → chunk-7QUEBL6Z.js} +56 -21
- package/dist/chunk-7QUEBL6Z.js.map +1 -0
- package/dist/{chunk-FXYM4OEI.js → chunk-AUIPVVAS.js} +3 -3
- package/dist/{chunk-FXYM4OEI.js.map → chunk-AUIPVVAS.js.map} +1 -1
- package/dist/{chunk-J3ISOP5J.cjs → chunk-BULVNQ2P.cjs} +6 -2
- package/dist/chunk-BULVNQ2P.cjs.map +1 -0
- package/dist/{chunk-GKGPZBID.js → chunk-EWXZ5A65.js} +391 -301
- package/dist/chunk-EWXZ5A65.js.map +1 -0
- package/dist/{chunk-CBPEMMRV.cjs → chunk-RDG7DHFG.cjs} +1244 -1154
- package/dist/chunk-RDG7DHFG.cjs.map +1 -0
- package/dist/{chunk-XPPJHUAD.cjs → chunk-S2RM75NL.cjs} +7 -7
- package/dist/{chunk-XPPJHUAD.cjs.map → chunk-S2RM75NL.cjs.map} +1 -1
- package/dist/{chunk-5FT2NNFO.js → chunk-Z5EMG7I2.js} +6 -2
- package/dist/chunk-Z5EMG7I2.js.map +1 -0
- package/dist/cli.cjs +24 -22
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +8 -6
- package/dist/cli.js.map +1 -1
- package/dist/headless.d.ts.map +1 -1
- package/dist/hooks/config.d.ts +2 -2
- package/dist/hooks/config.d.ts.map +1 -1
- package/dist/hooks/manager.d.ts +2 -1
- package/dist/hooks/manager.d.ts.map +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/schema.d.ts +2 -0
- package/dist/schema.d.ts.map +1 -1
- package/dist/storage-OFG4C77R.js +3 -0
- package/dist/{storage-SJM4TJX5.js.map → storage-OFG4C77R.js.map} +1 -1
- package/dist/storage-RIEW2ZEA.cjs +24 -0
- package/dist/{storage-LJRPYE5O.cjs.map → storage-RIEW2ZEA.cjs.map} +1 -1
- package/dist/tui/commands/api-keys.d.ts.map +1 -1
- package/dist/tui/commands/browser.d.ts.map +1 -1
- package/dist/tui/commands/goal.d.ts.map +1 -1
- package/dist/tui/components/judge-display.d.ts +3 -2
- package/dist/tui/components/judge-display.d.ts.map +1 -1
- package/dist/tui/goal-manager.d.ts +1 -1
- package/dist/tui/goal-manager.d.ts.map +1 -1
- package/dist/tui/handlers/agent-lifecycle.d.ts.map +1 -1
- package/dist/tui/mastra-tui.d.ts +1 -0
- package/dist/tui/mastra-tui.d.ts.map +1 -1
- package/dist/tui/render-messages.d.ts.map +1 -1
- package/dist/tui/setup.d.ts +1 -1
- package/dist/tui/setup.d.ts.map +1 -1
- package/dist/tui/state.d.ts +5 -3
- package/dist/tui/state.d.ts.map +1 -1
- package/dist/tui.cjs +19 -19
- package/dist/tui.js +2 -2
- package/dist/utils/project.d.ts.map +1 -1
- package/dist/utils/update-check.d.ts.map +1 -1
- package/package.json +18 -18
- package/dist/chunk-3CO7PY6M.cjs.map +0 -1
- package/dist/chunk-5FT2NNFO.js.map +0 -1
- package/dist/chunk-CBPEMMRV.cjs.map +0 -1
- package/dist/chunk-GKGPZBID.js.map +0 -1
- package/dist/chunk-J3ISOP5J.cjs.map +0 -1
- package/dist/chunk-RDIIIT54.js.map +0 -1
- package/dist/storage-LJRPYE5O.cjs +0 -24
- package/dist/storage-SJM4TJX5.js +0 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,46 @@
|
|
|
1
1
|
# mastracode
|
|
2
2
|
|
|
3
|
+
## 0.23.1-alpha.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Made the native Agent goal mechanism robust, restoring behavior that regressed when goal handling moved into core. ([#18016](https://github.com/mastra-ai/mastra/pull/18016))
|
|
8
|
+
- **Tool-capable judges.** Scorer judge configs accept optional `tools`, and the default goal scorer can use them to verify the agent's work against reality instead of grading prose alone. MastraCode wires its read-only workspace tools (`view`, `search_content`, `find_files`, `file_stat`, `lsp_inspect`) into `goal.tools`.
|
|
9
|
+
- **Judge memory restored.** Scorer judge configs accept optional `memory`; goal scoring uses the original MastraCode per-goal judge thread shape and prompt format so repeated evaluations retain prior facts, feedback, and user checkpoints through judge memory.
|
|
10
|
+
- **Tri-state waiting.** The default goal scorer emits `done`/`continue`/`waiting`; a `waiting` decision (only when the goal text explicitly asks to stop for the user) stops the auto-loop but keeps the objective `active` so the next agent turn is still judged — no `/goal resume` needed.
|
|
11
|
+
- **Budget-exhaustion pause.** Reaching `maxRuns` without completing now parks the objective as `paused` with a clear reason, resumable by raising `maxRuns` and reactivating, instead of silently leaving it `active`.
|
|
12
|
+
- **Judge-failure pause (no infinite loop).** Any failure while evaluating the goal — including judge-model/tools resolution, not just the scorer run — pauses the objective and stops the loop, surfacing the cause, rather than re-running the model against a broken judge every turn.
|
|
13
|
+
- **Structured-output retry.** `tryGenerateWithJsonFallback` now retries with `jsonPromptInjection` when the judge resolves without a parseable object (not only on a thrown error), matching the streaming path.
|
|
14
|
+
- **Signal-based feedback.** Goal judge feedback is now injected as a `goal-judge` system-reminder signal instead of an assistant-authored "Completion Check Results" transcript message, so reloads and subsequent model context match the original MastraCode goal loop. Continuation, waiting, paused, and done decisions all persist structured evaluation metadata for replay.
|
|
15
|
+
- **TUI activity/replay fixes.** Goal evaluation chunks close the current assistant message before rendering the judge UI, stream judge activity with useful tool targets, stream partial judge reason text while scoring, replay persisted judge results as judge display components instead of raw Goal reminder text, and correctly persist Esc/Ctrl+C pauses while the judge is running.
|
|
16
|
+
|
|
17
|
+
The goal evaluation chunk now carries `pausedReason`, `judgeFailed`, `waitingForUser`, `pending` (emitted before scoring starts so consumers can show a loading indicator), and judge `activity` entries including streamed `reason` updates.
|
|
18
|
+
|
|
19
|
+
- Updated dependencies [[`b7dff0a`](https://github.com/mastra-ai/mastra/commit/b7dff0a3d1022eb6868f48dc40a2b1febd5c277f), [`b91d921`](https://github.com/mastra-ai/mastra/commit/b91d9213a4998eb343dccd0ff780c42ba22bdfa1), [`02087e1`](https://github.com/mastra-ai/mastra/commit/02087e1fbc54aa07f3071f7a200df1bf5be601a8), [`ab975d4`](https://github.com/mastra-ai/mastra/commit/ab975d4dd9488752f05bda7afa03166d207e3e2a)]:
|
|
20
|
+
- @mastra/core@1.44.0-alpha.1
|
|
21
|
+
- @mastra/github-signals@0.1.4-alpha.1
|
|
22
|
+
|
|
23
|
+
## 0.23.1-alpha.0
|
|
24
|
+
|
|
25
|
+
### Patch Changes
|
|
26
|
+
|
|
27
|
+
- Security remediation for the 2026-06-17 "easy-day-js" supply-chain incident. Patch bump to publish clean versions and move the `latest` dist-tag forward, superseding the compromised versions that declared the malicious `easy-day-js` dependency. ([#18056](https://github.com/mastra-ai/mastra/pull/18056))
|
|
28
|
+
|
|
29
|
+
- Updated dependencies [[`77a2351`](https://github.com/mastra-ai/mastra/commit/77a2351ee79296e360bce822cb3391f7cfd6489d)]:
|
|
30
|
+
- @mastra/agent-browser@0.3.4-alpha.0
|
|
31
|
+
- @mastra/core@1.43.1-alpha.0
|
|
32
|
+
- @mastra/duckdb@1.4.3-alpha.0
|
|
33
|
+
- @mastra/fastembed@1.1.3-alpha.0
|
|
34
|
+
- @mastra/github-signals@0.1.4-alpha.0
|
|
35
|
+
- @mastra/libsql@1.13.3-alpha.0
|
|
36
|
+
- @mastra/mcp@1.10.1-alpha.0
|
|
37
|
+
- @mastra/memory@1.20.6-alpha.0
|
|
38
|
+
- @mastra/observability@1.14.4-alpha.0
|
|
39
|
+
- @mastra/pg@1.13.3-alpha.0
|
|
40
|
+
- @mastra/schema-compat@1.2.14-alpha.0
|
|
41
|
+
- @mastra/stagehand@0.2.7-alpha.0
|
|
42
|
+
- @mastra/tavily@1.0.5-alpha.0
|
|
43
|
+
|
|
3
44
|
## 0.23.0
|
|
4
45
|
|
|
5
46
|
### Minor Changes
|
|
@@ -1,9 +1,22 @@
|
|
|
1
|
+
import type { ToolsInput } from '@mastra/core/agent';
|
|
1
2
|
import type { Mastra } from '@mastra/core/mastra';
|
|
2
3
|
import type { RequestContext } from '@mastra/core/request-context';
|
|
3
4
|
import { Workspace, LocalFilesystem, LocalSandbox } from '@mastra/core/workspace';
|
|
4
|
-
export declare function buildSkillPaths(projectPath: string, configDir: string): string[];
|
|
5
|
+
export declare function buildSkillPaths(projectPath: string, configDir: string, homeDir?: string): string[];
|
|
5
6
|
export declare function getDynamicWorkspace({ requestContext, mastra }: {
|
|
6
7
|
requestContext: RequestContext;
|
|
7
8
|
mastra?: Mastra;
|
|
8
9
|
}): Workspace<LocalFilesystem, LocalSandbox, undefined>;
|
|
10
|
+
/**
|
|
11
|
+
* Resolver for the agent's `goal.tools` config. Builds the request's workspace
|
|
12
|
+
* (same per-request resolution as the agent's own tools) and returns only the
|
|
13
|
+
* read-only verification subset, remapped to mastracode's tool names (`view`,
|
|
14
|
+
* `search_content`, etc.). Returns `undefined` when no workspace can be resolved
|
|
15
|
+
* (e.g. no project path), keeping the default judge text-only rather than
|
|
16
|
+
* throwing inside the goal step.
|
|
17
|
+
*/
|
|
18
|
+
export declare function getGoalJudgeTools({ requestContext, mastra, }: {
|
|
19
|
+
requestContext: RequestContext;
|
|
20
|
+
mastra?: Mastra;
|
|
21
|
+
}): Promise<ToolsInput | undefined>;
|
|
9
22
|
//# sourceMappingURL=workspace.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workspace.d.ts","sourceRoot":"","sources":["../../src/agents/workspace.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"workspace.d.ts","sourceRoot":"","sources":["../../src/agents/workspace.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,YAAY,EAAwB,MAAM,wBAAwB,CAAC;AA8ExG,wBAAgB,eAAe,CAAC,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,SAAe,GAAG,MAAM,EAAE,CAgBxG;AA2BD,wBAAgB,mBAAmB,CAAC,EAAE,cAAc,EAAE,MAAM,EAAE,EAAE;IAAE,cAAc,EAAE,cAAc,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,uDAkElH;AAiBD;;;;;;;GAOG;AACH,wBAAsB,iBAAiB,CAAC,EACtC,cAAc,EACd,MAAM,GACP,EAAE;IACD,cAAc,EAAE,cAAc,CAAC;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,GAAG,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CAclC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunkS2RM75NL_cjs = require('./chunk-S2RM75NL.cjs');
|
|
4
|
+
var chunkBULVNQ2P_cjs = require('./chunk-BULVNQ2P.cjs');
|
|
5
5
|
var chunkJHYTJMKT_cjs = require('./chunk-JHYTJMKT.cjs');
|
|
6
6
|
var path = require('path');
|
|
7
7
|
var agent = require('@mastra/core/agent');
|
|
@@ -516,8 +516,6 @@ function buildSandboxEnv() {
|
|
|
516
516
|
DEBIAN_FRONTEND: "noninteractive"
|
|
517
517
|
};
|
|
518
518
|
}
|
|
519
|
-
var claudeGlobalSkillsPath = path__namespace.default.join(os__namespace.default.homedir(), ".claude", "skills");
|
|
520
|
-
var agentSkillsGlobalPath = path__namespace.default.join(os__namespace.default.homedir(), ".agents", "skills");
|
|
521
519
|
function collectSkillPaths(skillsDirs) {
|
|
522
520
|
const paths = [];
|
|
523
521
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -549,11 +547,13 @@ function collectSkillPaths(skillsDirs) {
|
|
|
549
547
|
}
|
|
550
548
|
return paths;
|
|
551
549
|
}
|
|
552
|
-
function buildSkillPaths(projectPath, configDir) {
|
|
550
|
+
function buildSkillPaths(projectPath, configDir, homeDir = os__namespace.default.homedir()) {
|
|
553
551
|
const mastraCodeLocalSkillsPath = path__namespace.default.join(projectPath, configDir, "skills");
|
|
554
552
|
const claudeLocalSkillsPath = path__namespace.default.join(projectPath, ".claude", "skills");
|
|
555
553
|
const agentSkillsLocalPath = path__namespace.default.join(projectPath, ".agents", "skills");
|
|
556
|
-
const mastraCodeGlobalSkillsPath = path__namespace.default.join(
|
|
554
|
+
const mastraCodeGlobalSkillsPath = path__namespace.default.join(homeDir, configDir, "skills");
|
|
555
|
+
const claudeGlobalSkillsPath = path__namespace.default.join(homeDir, ".claude", "skills");
|
|
556
|
+
const agentSkillsGlobalPath = path__namespace.default.join(homeDir, ".agents", "skills");
|
|
557
557
|
return collectSkillPaths([
|
|
558
558
|
mastraCodeLocalSkillsPath,
|
|
559
559
|
claudeLocalSkillsPath,
|
|
@@ -585,8 +585,8 @@ function getDynamicWorkspace({ requestContext, mastra: mastra2 }) {
|
|
|
585
585
|
throw new Error("Project path is required");
|
|
586
586
|
}
|
|
587
587
|
const projectPath = path__namespace.default.resolve(rawProjectPath);
|
|
588
|
-
const configDir = state?.configDir ??
|
|
589
|
-
const skillPaths = buildSkillPaths(projectPath, configDir);
|
|
588
|
+
const configDir = state?.configDir ?? chunkBULVNQ2P_cjs.DEFAULT_CONFIG_DIR;
|
|
589
|
+
const skillPaths = buildSkillPaths(projectPath, configDir, state?.homeDir);
|
|
590
590
|
const workspaceId = `${WORKSPACE_ID_PREFIX}-${projectPath}`;
|
|
591
591
|
const sandboxPaths = state?.sandboxAllowedPaths ?? [];
|
|
592
592
|
const allowedPaths = [...skillPaths, ...DEFAULT_ALLOWED_PATHS, ...sandboxPaths.map((p) => path__namespace.default.resolve(p))];
|
|
@@ -609,8 +609,8 @@ function getDynamicWorkspace({ requestContext, mastra: mastra2 }) {
|
|
|
609
609
|
existing.setToolsConfig(workspaceTools);
|
|
610
610
|
return existing;
|
|
611
611
|
}
|
|
612
|
-
const userLsp =
|
|
613
|
-
const mcModulePath = path.join(path.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-
|
|
612
|
+
const userLsp = chunkS2RM75NL_cjs.loadSettings().lsp ?? {};
|
|
613
|
+
const mcModulePath = path.join(path.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-3PNUO4FX.cjs', document.baseURI).href)))), "..");
|
|
614
614
|
const lspConfig = {
|
|
615
615
|
...userLsp,
|
|
616
616
|
packageRunner: userLsp.packageRunner || detectPackageRunner(projectPath),
|
|
@@ -633,6 +633,30 @@ function getDynamicWorkspace({ requestContext, mastra: mastra2 }) {
|
|
|
633
633
|
lsp: lspConfig
|
|
634
634
|
});
|
|
635
635
|
}
|
|
636
|
+
var GOAL_JUDGE_READONLY_TOOLS = [
|
|
637
|
+
chunkJHYTJMKT_cjs.MC_TOOLS.VIEW,
|
|
638
|
+
chunkJHYTJMKT_cjs.MC_TOOLS.SEARCH_CONTENT,
|
|
639
|
+
chunkJHYTJMKT_cjs.MC_TOOLS.FIND_FILES,
|
|
640
|
+
chunkJHYTJMKT_cjs.MC_TOOLS.FILE_STAT,
|
|
641
|
+
chunkJHYTJMKT_cjs.MC_TOOLS.LSP_INSPECT
|
|
642
|
+
];
|
|
643
|
+
async function getGoalJudgeTools({
|
|
644
|
+
requestContext,
|
|
645
|
+
mastra: mastra2
|
|
646
|
+
}) {
|
|
647
|
+
let workspace$1;
|
|
648
|
+
try {
|
|
649
|
+
workspace$1 = getDynamicWorkspace({ requestContext, mastra: mastra2 });
|
|
650
|
+
} catch {
|
|
651
|
+
return void 0;
|
|
652
|
+
}
|
|
653
|
+
const allTools = await workspace.createWorkspaceTools(workspace$1, { requestContext, workspace: workspace$1 });
|
|
654
|
+
const readonly = {};
|
|
655
|
+
for (const name of GOAL_JUDGE_READONLY_TOOLS) {
|
|
656
|
+
if (allTools[name]) readonly[name] = allTools[name];
|
|
657
|
+
}
|
|
658
|
+
return Object.keys(readonly).length > 0 ? readonly : void 0;
|
|
659
|
+
}
|
|
636
660
|
|
|
637
661
|
// src/tools/utils.ts
|
|
638
662
|
function isPathAllowed(targetPath, projectRoot, allowedPaths = []) {
|
|
@@ -644,7 +668,7 @@ function getAllowedPathsFromContext(toolContext) {
|
|
|
644
668
|
const harnessCtx = toolContext?.requestContext?.get("harness");
|
|
645
669
|
const state = harnessCtx?.getState?.() ?? harnessCtx?.state;
|
|
646
670
|
const projectPath = state?.projectPath ? path__namespace.resolve(state.projectPath) : process.cwd();
|
|
647
|
-
const configDir = state?.configDir ??
|
|
671
|
+
const configDir = state?.configDir ?? chunkBULVNQ2P_cjs.DEFAULT_CONFIG_DIR;
|
|
648
672
|
const skillPaths = buildSkillPaths(projectPath, configDir);
|
|
649
673
|
const sandboxPaths = state?.sandboxAllowedPaths ?? [];
|
|
650
674
|
return [...skillPaths, ...sandboxPaths];
|
|
@@ -744,7 +768,7 @@ function findInstructionFile(basePath) {
|
|
|
744
768
|
}
|
|
745
769
|
return null;
|
|
746
770
|
}
|
|
747
|
-
function loadAgentInstructions(projectPath, configDirName =
|
|
771
|
+
function loadAgentInstructions(projectPath, configDirName = chunkBULVNQ2P_cjs.DEFAULT_CONFIG_DIR) {
|
|
748
772
|
const sources = [];
|
|
749
773
|
const home = os.homedir();
|
|
750
774
|
const projectLocations = PROJECT_LOCATIONS.map((loc) => loc === ".mastracode" ? configDirName : loc);
|
|
@@ -1038,7 +1062,7 @@ async function getDynamicInstructions({ requestContext }) {
|
|
|
1038
1062
|
const promptCtx = {
|
|
1039
1063
|
projectPath,
|
|
1040
1064
|
projectName: state?.projectName ?? "",
|
|
1041
|
-
gitBranch: await
|
|
1065
|
+
gitBranch: await chunkBULVNQ2P_cjs.getCurrentGitBranchAsync(projectPath) ?? state?.gitBranch,
|
|
1042
1066
|
platform: process.platform,
|
|
1043
1067
|
commonBinaries: await detectCommonBinariesAsync(),
|
|
1044
1068
|
date: (/* @__PURE__ */ new Date()).toISOString().split("T")[0],
|
|
@@ -1062,7 +1086,7 @@ var OAUTH_REQUIRED_BETAS = [
|
|
|
1062
1086
|
var authStorageInstance = null;
|
|
1063
1087
|
function getAuthStorage() {
|
|
1064
1088
|
if (!authStorageInstance) {
|
|
1065
|
-
authStorageInstance = new
|
|
1089
|
+
authStorageInstance = new chunkBULVNQ2P_cjs.AuthStorage();
|
|
1066
1090
|
}
|
|
1067
1091
|
return authStorageInstance;
|
|
1068
1092
|
}
|
|
@@ -1195,7 +1219,7 @@ var COPILOT_PROVIDER_ID = "github-copilot";
|
|
|
1195
1219
|
var authStorageInstance2 = null;
|
|
1196
1220
|
function getAuthStorage2() {
|
|
1197
1221
|
if (!authStorageInstance2) {
|
|
1198
|
-
authStorageInstance2 = new
|
|
1222
|
+
authStorageInstance2 = new chunkBULVNQ2P_cjs.AuthStorage();
|
|
1199
1223
|
}
|
|
1200
1224
|
return authStorageInstance2;
|
|
1201
1225
|
}
|
|
@@ -1285,7 +1309,7 @@ function buildGitHubCopilotOAuthFetch(opts = {}) {
|
|
|
1285
1309
|
if (isVision) {
|
|
1286
1310
|
headers.set("Copilot-Vision-Request", "true");
|
|
1287
1311
|
}
|
|
1288
|
-
for (const [key, value] of Object.entries(
|
|
1312
|
+
for (const [key, value] of Object.entries(chunkBULVNQ2P_cjs.COPILOT_HEADERS)) {
|
|
1289
1313
|
if (!headers.has(key)) {
|
|
1290
1314
|
headers.set(key, value);
|
|
1291
1315
|
}
|
|
@@ -1305,7 +1329,7 @@ function buildGitHubCopilotOAuthFetch(opts = {}) {
|
|
|
1305
1329
|
}
|
|
1306
1330
|
function rewriteToCopilotBase(url, token, enterpriseDomain) {
|
|
1307
1331
|
const original = url instanceof URL ? url : new URL(typeof url === "string" ? url : url.url);
|
|
1308
|
-
const base = new URL(
|
|
1332
|
+
const base = new URL(chunkBULVNQ2P_cjs.getGitHubCopilotBaseUrl(token, enterpriseDomain));
|
|
1309
1333
|
const pathname = original.pathname.replace(/^\/v1(\/|$)/, "/");
|
|
1310
1334
|
return new URL(`${pathname}${original.search}`, base);
|
|
1311
1335
|
}
|
|
@@ -1405,11 +1429,11 @@ async function getCopilotModelCatalog(opts = {}) {
|
|
|
1405
1429
|
storage.reload();
|
|
1406
1430
|
const refreshed = storage.get(COPILOT_PROVIDER_ID);
|
|
1407
1431
|
const enterpriseUrl = refreshed?.enterpriseUrl;
|
|
1408
|
-
const baseUrl =
|
|
1432
|
+
const baseUrl = chunkBULVNQ2P_cjs.getGitHubCopilotBaseUrl(accessToken, enterpriseUrl);
|
|
1409
1433
|
const controller = new AbortController();
|
|
1410
1434
|
const timer = setTimeout(() => controller.abort(), CATALOG_FETCH_TIMEOUT_MS);
|
|
1411
1435
|
try {
|
|
1412
|
-
const models = await
|
|
1436
|
+
const models = await chunkBULVNQ2P_cjs.fetchCopilotModels({
|
|
1413
1437
|
baseUrl,
|
|
1414
1438
|
bearerToken: accessToken,
|
|
1415
1439
|
signal: controller.signal
|
|
@@ -1442,7 +1466,7 @@ var CODEX_USER_AGENT = "mastracode";
|
|
|
1442
1466
|
var authStorageInstance3 = null;
|
|
1443
1467
|
function getAuthStorage3() {
|
|
1444
1468
|
if (!authStorageInstance3) {
|
|
1445
|
-
authStorageInstance3 = new
|
|
1469
|
+
authStorageInstance3 = new chunkBULVNQ2P_cjs.AuthStorage();
|
|
1446
1470
|
}
|
|
1447
1471
|
return authStorageInstance3;
|
|
1448
1472
|
}
|
|
@@ -1596,7 +1620,7 @@ var CODEX_OPENAI_MODEL_REMAPS = {
|
|
|
1596
1620
|
"gpt-5.1-mini": "gpt-5.1-codex-mini",
|
|
1597
1621
|
"gpt-5": "gpt-5-codex"
|
|
1598
1622
|
};
|
|
1599
|
-
var authStorage = new
|
|
1623
|
+
var authStorage = new chunkBULVNQ2P_cjs.AuthStorage();
|
|
1600
1624
|
function reloadAuthStorage() {
|
|
1601
1625
|
authStorage.reload();
|
|
1602
1626
|
}
|
|
@@ -1752,7 +1776,7 @@ var MastraCodeGateway = class _MastraCodeGateway extends llm.MastraModelGateway
|
|
|
1752
1776
|
this.#settingsPath = settingsPath;
|
|
1753
1777
|
}
|
|
1754
1778
|
static getMemoryGatewayApiKey() {
|
|
1755
|
-
return authStorage.getStoredApiKey(
|
|
1779
|
+
return authStorage.getStoredApiKey(chunkS2RM75NL_cjs.MEMORY_GATEWAY_PROVIDER) ?? process.env["MASTRA_GATEWAY_API_KEY"];
|
|
1756
1780
|
}
|
|
1757
1781
|
static resolveProviderAuth(request, memoryGatewayApiKey) {
|
|
1758
1782
|
if (request.gatewayId === "mastra" && memoryGatewayApiKey) {
|
|
@@ -1793,14 +1817,14 @@ var MastraCodeGateway = class _MastraCodeGateway extends llm.MastraModelGateway
|
|
|
1793
1817
|
return _MastraCodeGateway.createModelCatalogProvider(this);
|
|
1794
1818
|
}
|
|
1795
1819
|
#getCustomProviders() {
|
|
1796
|
-
return this.#customProviders ??
|
|
1820
|
+
return this.#customProviders ?? chunkS2RM75NL_cjs.loadSettings(this.#settingsPath).customProviders;
|
|
1797
1821
|
}
|
|
1798
1822
|
async fetchProviders() {
|
|
1799
1823
|
const providers = {};
|
|
1800
1824
|
for (const provider of this.#getCustomProviders()) {
|
|
1801
1825
|
const models = provider.models ?? [];
|
|
1802
1826
|
if (!models.length) continue;
|
|
1803
|
-
providers[
|
|
1827
|
+
providers[chunkS2RM75NL_cjs.getCustomProviderId(provider.name)] = {
|
|
1804
1828
|
name: provider.name,
|
|
1805
1829
|
url: provider.url,
|
|
1806
1830
|
apiKeyEnvVar: "",
|
|
@@ -1836,7 +1860,7 @@ var MastraCodeGateway = class _MastraCodeGateway extends llm.MastraModelGateway
|
|
|
1836
1860
|
return { apiKey: this.#mastraGatewayApiKey, source: "gateway" };
|
|
1837
1861
|
}
|
|
1838
1862
|
const customProvider = this.#getCustomProviders().find(
|
|
1839
|
-
(provider) => request.providerId ===
|
|
1863
|
+
(provider) => request.providerId === chunkS2RM75NL_cjs.getCustomProviderId(provider.name)
|
|
1840
1864
|
);
|
|
1841
1865
|
if (customProvider?.apiKey) {
|
|
1842
1866
|
return { apiKey: customProvider.apiKey, source: "gateway" };
|
|
@@ -1845,7 +1869,7 @@ var MastraCodeGateway = class _MastraCodeGateway extends llm.MastraModelGateway
|
|
|
1845
1869
|
}
|
|
1846
1870
|
resolveLanguageModel(args) {
|
|
1847
1871
|
const customProvider = this.#getCustomProviders().find(
|
|
1848
|
-
(provider) => args.providerId ===
|
|
1872
|
+
(provider) => args.providerId === chunkS2RM75NL_cjs.getCustomProviderId(provider.name)
|
|
1849
1873
|
);
|
|
1850
1874
|
if (customProvider) {
|
|
1851
1875
|
const provider = openaiCompatible.createOpenAICompatible({
|
|
@@ -1981,7 +2005,7 @@ function createMastraCodeModelCatalogProvider(gateway) {
|
|
|
1981
2005
|
function resolveModel(modelId, options) {
|
|
1982
2006
|
reloadAuthStorage();
|
|
1983
2007
|
const headers = getHarnessHeaders(options?.requestContext);
|
|
1984
|
-
const settings =
|
|
2008
|
+
const settings = chunkS2RM75NL_cjs.loadSettings();
|
|
1985
2009
|
const isMastraGatewayModel = modelId.startsWith(MASTRA_GATEWAY_PREFIX);
|
|
1986
2010
|
const normalizedModelId = stripMastraGatewayPrefix(modelId);
|
|
1987
2011
|
const [providerId, ...modelParts] = normalizedModelId.split("/");
|
|
@@ -2022,7 +2046,7 @@ function getDynamicModel({ requestContext }) {
|
|
|
2022
2046
|
return resolveModel(modelId, { thinkingLevel, requestContext });
|
|
2023
2047
|
}
|
|
2024
2048
|
function getGoalJudgeModel({ requestContext }, settingsPath) {
|
|
2025
|
-
const judgeModelId =
|
|
2049
|
+
const judgeModelId = chunkS2RM75NL_cjs.loadSettings(settingsPath).models.goalJudgeModel;
|
|
2026
2050
|
if (!judgeModelId) return void 0;
|
|
2027
2051
|
return resolveModel(judgeModelId, { requestContext });
|
|
2028
2052
|
}
|
|
@@ -2035,13 +2059,13 @@ function getHarnessState(requestContext) {
|
|
|
2035
2059
|
}
|
|
2036
2060
|
function getObserverModel({ requestContext }) {
|
|
2037
2061
|
const state = getHarnessState(requestContext);
|
|
2038
|
-
return resolveModel(state?.observerModelId ??
|
|
2062
|
+
return resolveModel(state?.observerModelId ?? chunkBULVNQ2P_cjs.DEFAULT_OM_MODEL_ID, {
|
|
2039
2063
|
requestContext
|
|
2040
2064
|
});
|
|
2041
2065
|
}
|
|
2042
2066
|
function getReflectorModel({ requestContext }) {
|
|
2043
2067
|
const state = getHarnessState(requestContext);
|
|
2044
|
-
return resolveModel(state?.reflectorModelId ??
|
|
2068
|
+
return resolveModel(state?.reflectorModelId ?? chunkBULVNQ2P_cjs.DEFAULT_OM_MODEL_ID, {
|
|
2045
2069
|
requestContext
|
|
2046
2070
|
});
|
|
2047
2071
|
}
|
|
@@ -2071,9 +2095,9 @@ Drop caveman for: security warnings, irreversible action confirmations, multi-st
|
|
|
2071
2095
|
function getDynamicMemory(storage, vector) {
|
|
2072
2096
|
return ({ requestContext }) => {
|
|
2073
2097
|
const state = getHarnessState(requestContext);
|
|
2074
|
-
const omScope = state?.omScope ??
|
|
2075
|
-
const obsThreshold = state?.observationThreshold ??
|
|
2076
|
-
const refThreshold = state?.reflectionThreshold ??
|
|
2098
|
+
const omScope = state?.omScope ?? chunkBULVNQ2P_cjs.getOmScope(state?.projectPath);
|
|
2099
|
+
const obsThreshold = state?.observationThreshold ?? chunkBULVNQ2P_cjs.DEFAULT_OBS_THRESHOLD;
|
|
2100
|
+
const refThreshold = state?.reflectionThreshold ?? chunkBULVNQ2P_cjs.DEFAULT_REF_THRESHOLD;
|
|
2077
2101
|
const caveman = state?.cavemanObservations ?? false;
|
|
2078
2102
|
const observerPreviousObservationTokens = 1e3;
|
|
2079
2103
|
const observeAttachments = state?.observeAttachments;
|
|
@@ -2927,18 +2951,18 @@ var VALID_EVENTS = [
|
|
|
2927
2951
|
"SessionEnd",
|
|
2928
2952
|
"Notification"
|
|
2929
2953
|
];
|
|
2930
|
-
function loadHooksConfig(projectDir, configDirName =
|
|
2931
|
-
const globalPath = getGlobalHooksPath(configDirName);
|
|
2954
|
+
function loadHooksConfig(projectDir, configDirName = chunkBULVNQ2P_cjs.DEFAULT_CONFIG_DIR, homeDir) {
|
|
2955
|
+
const globalPath = getGlobalHooksPath(configDirName, homeDir);
|
|
2932
2956
|
const projectPath = getProjectHooksPath(projectDir, configDirName);
|
|
2933
2957
|
const globalConfig = loadSingleConfig(globalPath);
|
|
2934
2958
|
const projectConfig = loadSingleConfig(projectPath);
|
|
2935
2959
|
return mergeConfigs(globalConfig, projectConfig);
|
|
2936
2960
|
}
|
|
2937
|
-
function getProjectHooksPath(projectDir, configDirName =
|
|
2961
|
+
function getProjectHooksPath(projectDir, configDirName = chunkBULVNQ2P_cjs.DEFAULT_CONFIG_DIR) {
|
|
2938
2962
|
return path__namespace.join(projectDir, configDirName, "hooks.json");
|
|
2939
2963
|
}
|
|
2940
|
-
function getGlobalHooksPath(configDirName =
|
|
2941
|
-
return path__namespace.join(
|
|
2964
|
+
function getGlobalHooksPath(configDirName = chunkBULVNQ2P_cjs.DEFAULT_CONFIG_DIR, homeDir = os__namespace.homedir()) {
|
|
2965
|
+
return path__namespace.join(homeDir, configDirName, "hooks.json");
|
|
2942
2966
|
}
|
|
2943
2967
|
function loadSingleConfig(filePath) {
|
|
2944
2968
|
try {
|
|
@@ -3109,14 +3133,16 @@ var HookManager = class {
|
|
|
3109
3133
|
projectDir;
|
|
3110
3134
|
sessionId;
|
|
3111
3135
|
configDirName;
|
|
3112
|
-
|
|
3136
|
+
homeDir;
|
|
3137
|
+
constructor(projectDir, sessionId, configDirName = chunkBULVNQ2P_cjs.DEFAULT_CONFIG_DIR, homeDir) {
|
|
3113
3138
|
this.projectDir = projectDir;
|
|
3114
3139
|
this.sessionId = sessionId;
|
|
3115
3140
|
this.configDirName = configDirName;
|
|
3116
|
-
this.
|
|
3141
|
+
this.homeDir = homeDir;
|
|
3142
|
+
this.config = loadHooksConfig(projectDir, configDirName, homeDir);
|
|
3117
3143
|
}
|
|
3118
3144
|
reload() {
|
|
3119
|
-
this.config = loadHooksConfig(this.projectDir, this.configDirName);
|
|
3145
|
+
this.config = loadHooksConfig(this.projectDir, this.configDirName, this.homeDir);
|
|
3120
3146
|
}
|
|
3121
3147
|
setSessionId(sessionId) {
|
|
3122
3148
|
this.sessionId = sessionId;
|
|
@@ -3130,7 +3156,7 @@ var HookManager = class {
|
|
|
3130
3156
|
getConfigPaths() {
|
|
3131
3157
|
return {
|
|
3132
3158
|
project: getProjectHooksPath(this.projectDir, this.configDirName),
|
|
3133
|
-
global: getGlobalHooksPath(this.configDirName)
|
|
3159
|
+
global: getGlobalHooksPath(this.configDirName, this.homeDir)
|
|
3134
3160
|
};
|
|
3135
3161
|
}
|
|
3136
3162
|
// =========================================================================
|
|
@@ -3235,16 +3261,16 @@ var HookManager = class {
|
|
|
3235
3261
|
});
|
|
3236
3262
|
}
|
|
3237
3263
|
};
|
|
3238
|
-
function loadMcpConfig(projectDir, configDirName =
|
|
3264
|
+
function loadMcpConfig(projectDir, configDirName = chunkBULVNQ2P_cjs.DEFAULT_CONFIG_DIR) {
|
|
3239
3265
|
const claudeConfig = loadClaudeSettings(projectDir);
|
|
3240
3266
|
const globalConfig = loadSingleConfig2(getGlobalMcpPath(configDirName));
|
|
3241
3267
|
const projectConfig = loadSingleConfig2(getProjectMcpPath(projectDir, configDirName));
|
|
3242
3268
|
return mergeConfigs2(claudeConfig, globalConfig, projectConfig);
|
|
3243
3269
|
}
|
|
3244
|
-
function getProjectMcpPath(projectDir, configDirName =
|
|
3270
|
+
function getProjectMcpPath(projectDir, configDirName = chunkBULVNQ2P_cjs.DEFAULT_CONFIG_DIR) {
|
|
3245
3271
|
return path__namespace.join(projectDir, configDirName, "mcp.json");
|
|
3246
3272
|
}
|
|
3247
|
-
function getGlobalMcpPath(configDirName =
|
|
3273
|
+
function getGlobalMcpPath(configDirName = chunkBULVNQ2P_cjs.DEFAULT_CONFIG_DIR) {
|
|
3248
3274
|
return path__namespace.join(os__namespace.homedir(), configDirName, "mcp.json");
|
|
3249
3275
|
}
|
|
3250
3276
|
function getClaudeSettingsPath(projectDir) {
|
|
@@ -3447,7 +3473,7 @@ function getOAuthStoragePath(projectDir, name, cfg) {
|
|
|
3447
3473
|
clientId: cfg.oauth?.clientId,
|
|
3448
3474
|
scopes: cfg.oauth?.scopes ?? []
|
|
3449
3475
|
});
|
|
3450
|
-
return path.join(
|
|
3476
|
+
return path.join(chunkBULVNQ2P_cjs.getAppDataDir(), "mcp-oauth", `${getStorageKeyFingerprint(key)}.json`);
|
|
3451
3477
|
}
|
|
3452
3478
|
function getStorageKeyFingerprint(value) {
|
|
3453
3479
|
let fingerprint = 0xcbf29ce484222325n;
|
|
@@ -3457,7 +3483,7 @@ function getStorageKeyFingerprint(value) {
|
|
|
3457
3483
|
}
|
|
3458
3484
|
return fingerprint.toString(16).padStart(16, "0");
|
|
3459
3485
|
}
|
|
3460
|
-
function createMcpManager(projectDir, configDirName =
|
|
3486
|
+
function createMcpManager(projectDir, configDirName = chunkBULVNQ2P_cjs.DEFAULT_CONFIG_DIR, extraServers) {
|
|
3461
3487
|
const applyExtraServers = (base) => {
|
|
3462
3488
|
if (!extraServers || Object.keys(extraServers).length === 0) return base;
|
|
3463
3489
|
return { ...base, mcpServers: { ...base.mcpServers, ...extraServers } };
|
|
@@ -3772,12 +3798,13 @@ var stateSchema = zod.z.object({
|
|
|
3772
3798
|
subagentModelId: zod.z.string().optional(),
|
|
3773
3799
|
projectPath: zod.z.string().optional(),
|
|
3774
3800
|
projectName: zod.z.string().optional(),
|
|
3775
|
-
configDir: zod.z.string().default(
|
|
3801
|
+
configDir: zod.z.string().default(chunkBULVNQ2P_cjs.DEFAULT_CONFIG_DIR),
|
|
3802
|
+
homeDir: zod.z.string().optional(),
|
|
3776
3803
|
gitBranch: zod.z.string().optional(),
|
|
3777
3804
|
lastCommand: zod.z.string().optional(),
|
|
3778
3805
|
// Observational Memory model settings
|
|
3779
|
-
observerModelId: zod.z.string().default(
|
|
3780
|
-
reflectorModelId: zod.z.string().default(
|
|
3806
|
+
observerModelId: zod.z.string().default(chunkBULVNQ2P_cjs.DEFAULT_OM_MODEL_ID),
|
|
3807
|
+
reflectorModelId: zod.z.string().default(chunkBULVNQ2P_cjs.DEFAULT_OM_MODEL_ID),
|
|
3781
3808
|
// Observational Memory threshold settings
|
|
3782
3809
|
observationThreshold: zod.z.number().default(3e4),
|
|
3783
3810
|
reflectionThreshold: zod.z.number().default(4e4),
|
|
@@ -3964,7 +3991,7 @@ var MASTRA_CODE_LOCAL_PRAGMAS = {
|
|
|
3964
3991
|
function createFallbackLibSQL() {
|
|
3965
3992
|
return new libsql.LibSQLStore({
|
|
3966
3993
|
id: "mastra-code-storage",
|
|
3967
|
-
url: `file:${
|
|
3994
|
+
url: `file:${chunkBULVNQ2P_cjs.getDatabasePath()}`,
|
|
3968
3995
|
localPragmas: MASTRA_CODE_LOCAL_PRAGMAS
|
|
3969
3996
|
});
|
|
3970
3997
|
}
|
|
@@ -4034,7 +4061,7 @@ async function createVectorStore(config, effectiveBackend = config.backend) {
|
|
|
4034
4061
|
}
|
|
4035
4062
|
return new libsql.LibSQLVector({
|
|
4036
4063
|
id: "mastra-code-vectors",
|
|
4037
|
-
url: `file:${
|
|
4064
|
+
url: `file:${chunkBULVNQ2P_cjs.getVectorDatabasePath()}`
|
|
4038
4065
|
});
|
|
4039
4066
|
}
|
|
4040
4067
|
|
|
@@ -4053,7 +4080,7 @@ function applyEffectiveDefaultsToModes(modes, effectiveDefaults) {
|
|
|
4053
4080
|
});
|
|
4054
4081
|
}
|
|
4055
4082
|
function createAuthStorage() {
|
|
4056
|
-
const authStorage2 = new
|
|
4083
|
+
const authStorage2 = new chunkBULVNQ2P_cjs.AuthStorage();
|
|
4057
4084
|
setAuthStorage(authStorage2);
|
|
4058
4085
|
setAuthStorage3(authStorage2);
|
|
4059
4086
|
setAuthStorage2(authStorage2);
|
|
@@ -4062,7 +4089,7 @@ function createAuthStorage() {
|
|
|
4062
4089
|
function resolveCloudObservabilityConfig(settings, authStorage2, resourceId) {
|
|
4063
4090
|
const resourceConfig = settings.observability.resources[resourceId];
|
|
4064
4091
|
if (resourceConfig) {
|
|
4065
|
-
const token = authStorage2.getStoredApiKey(`${
|
|
4092
|
+
const token = authStorage2.getStoredApiKey(`${chunkS2RM75NL_cjs.OBSERVABILITY_AUTH_PREFIX}${resourceId}`);
|
|
4066
4093
|
if (token) {
|
|
4067
4094
|
return { accessToken: token, projectId: resourceConfig.projectId };
|
|
4068
4095
|
}
|
|
@@ -4074,17 +4101,18 @@ function resolveCloudObservabilityConfig(settings, authStorage2, resourceId) {
|
|
|
4074
4101
|
}
|
|
4075
4102
|
async function createMastraCode(config) {
|
|
4076
4103
|
const cwd = config?.cwd ?? process.cwd();
|
|
4077
|
-
const
|
|
4078
|
-
|
|
4079
|
-
|
|
4104
|
+
const homeDir = config?.homeDir ?? config?.initialState?.homeDir;
|
|
4105
|
+
const configDir = config?.configDir ?? chunkBULVNQ2P_cjs.DEFAULT_CONFIG_DIR;
|
|
4106
|
+
if (configDir !== chunkBULVNQ2P_cjs.DEFAULT_CONFIG_DIR) {
|
|
4107
|
+
chunkBULVNQ2P_cjs.validateConfigDirName(configDir);
|
|
4080
4108
|
}
|
|
4081
4109
|
try {
|
|
4082
4110
|
process.loadEnvFile(path__namespace.default.join(cwd, ".env"));
|
|
4083
4111
|
} catch {
|
|
4084
4112
|
}
|
|
4085
4113
|
const authStorage2 = createAuthStorage();
|
|
4086
|
-
const globalSettings =
|
|
4087
|
-
const storedGatewayKey = authStorage2.getStoredApiKey(
|
|
4114
|
+
const globalSettings = chunkS2RM75NL_cjs.loadSettings(config?.settingsPath);
|
|
4115
|
+
const storedGatewayKey = authStorage2.getStoredApiKey(chunkS2RM75NL_cjs.MEMORY_GATEWAY_PROVIDER);
|
|
4088
4116
|
const storedGatewayUrl = globalSettings.memoryGateway?.baseUrl;
|
|
4089
4117
|
if (storedGatewayKey) {
|
|
4090
4118
|
process.env["MASTRA_GATEWAY_API_KEY"] ??= storedGatewayKey;
|
|
@@ -4099,11 +4127,11 @@ async function createMastraCode(config) {
|
|
|
4099
4127
|
const envVars = cfg?.apiKeyEnvVar;
|
|
4100
4128
|
providerEnvVars[provider] = Array.isArray(envVars) ? envVars[0] : envVars;
|
|
4101
4129
|
}
|
|
4102
|
-
providerEnvVars[
|
|
4130
|
+
providerEnvVars[chunkS2RM75NL_cjs.MEMORY_GATEWAY_PROVIDER] ??= "MASTRA_GATEWAY_API_KEY";
|
|
4103
4131
|
authStorage2.loadStoredApiKeysIntoEnv(providerEnvVars);
|
|
4104
4132
|
} catch {
|
|
4105
4133
|
authStorage2.loadStoredApiKeysIntoEnv({
|
|
4106
|
-
[
|
|
4134
|
+
[chunkS2RM75NL_cjs.MEMORY_GATEWAY_PROVIDER]: "MASTRA_GATEWAY_API_KEY",
|
|
4107
4135
|
anthropic: "ANTHROPIC_API_KEY",
|
|
4108
4136
|
openai: "OPENAI_API_KEY",
|
|
4109
4137
|
google: "GOOGLE_GENERATIVE_AI_API_KEY",
|
|
@@ -4119,8 +4147,8 @@ async function createMastraCode(config) {
|
|
|
4119
4147
|
routeThroughMastraGateway: false,
|
|
4120
4148
|
settingsPath: config?.settingsPath
|
|
4121
4149
|
});
|
|
4122
|
-
const project =
|
|
4123
|
-
const resourceIdOverride =
|
|
4150
|
+
const project = chunkBULVNQ2P_cjs.detectProject(cwd);
|
|
4151
|
+
const resourceIdOverride = chunkBULVNQ2P_cjs.getResourceIdOverride(project.rootPath, configDir);
|
|
4124
4152
|
if (resourceIdOverride) {
|
|
4125
4153
|
project.resourceId = resourceIdOverride;
|
|
4126
4154
|
project.resourceIdOverride = true;
|
|
@@ -4132,7 +4160,7 @@ async function createMastraCode(config) {
|
|
|
4132
4160
|
if (crossProcessPubSub && !signalsPubSub) {
|
|
4133
4161
|
throw new Error("crossProcessPubSub requires a pubsub instance");
|
|
4134
4162
|
}
|
|
4135
|
-
const storageConfig = config?.storage ??
|
|
4163
|
+
const storageConfig = config?.storage ?? chunkBULVNQ2P_cjs.getStorageConfig(project.rootPath, globalSettings.storage, configDir);
|
|
4136
4164
|
const storageResult = await createStorage(storageConfig);
|
|
4137
4165
|
const storageWarning = storageResult.warning;
|
|
4138
4166
|
let observabilityDomain;
|
|
@@ -4141,7 +4169,7 @@ async function createMastraCode(config) {
|
|
|
4141
4169
|
try {
|
|
4142
4170
|
const observabilityDuckDB = new duckdb.DuckDBStore({
|
|
4143
4171
|
id: "mastra-code-observability",
|
|
4144
|
-
path:
|
|
4172
|
+
path: chunkBULVNQ2P_cjs.getObservabilityDatabasePath()
|
|
4145
4173
|
});
|
|
4146
4174
|
await observabilityDuckDB.db.getConnection();
|
|
4147
4175
|
observabilityDomain = observabilityDuckDB.observability;
|
|
@@ -4219,13 +4247,14 @@ async function createMastraCode(config) {
|
|
|
4219
4247
|
}
|
|
4220
4248
|
});
|
|
4221
4249
|
const vectorStore = await createVectorStore(storageConfig, storageResult.backend);
|
|
4222
|
-
const memory = config?.memory ?? getDynamicMemory(storage$1, vectorStore);
|
|
4250
|
+
const memory = config?.memory === false ? void 0 : config?.memory ?? getDynamicMemory(storage$1, vectorStore);
|
|
4223
4251
|
const mcpManager = config?.disableMcp ? void 0 : createMcpManager(project.rootPath, configDir, config?.mcpServers);
|
|
4224
|
-
const hookManager = config?.disableHooks ? void 0 : new HookManager(project.rootPath, "session-init", configDir);
|
|
4252
|
+
const hookManager = config?.disableHooks ? void 0 : new HookManager(project.rootPath, "session-init", configDir, homeDir);
|
|
4225
4253
|
const outcomeScorer = createOutcomeScorer();
|
|
4226
4254
|
const efficiencyScorer = createEfficiencyScorer();
|
|
4227
4255
|
const githubSignals$1 = globalSettings.signals?.experimentalGithubSignals ? new githubSignals.GithubSignals({
|
|
4228
4256
|
cwd: project.rootPath,
|
|
4257
|
+
gitcrawlCommand: process.env.MASTRACODE_GITCRAWL_BIN ?? process.env.GITCRAWL_BIN ?? process.env.MASTRACODE_GITCRAWL_COMMAND ?? process.env.GITCRAWL_COMMAND,
|
|
4229
4258
|
getNotificationStreamOptions: ({ resourceId, threadId }) => {
|
|
4230
4259
|
const requestContext$1 = new requestContext.RequestContext();
|
|
4231
4260
|
const harnessContext = {
|
|
@@ -4285,7 +4314,13 @@ async function createMastraCode(config) {
|
|
|
4285
4314
|
// config (a custom settings file would otherwise diverge).
|
|
4286
4315
|
judge: (ctx) => getGoalJudgeModel(ctx, config?.settingsPath),
|
|
4287
4316
|
maxRuns: globalSettings.models.goalMaxTurns ?? 50,
|
|
4288
|
-
prompt: tools.DEFAULT_GOAL_JUDGE_PROMPT
|
|
4317
|
+
prompt: tools.DEFAULT_GOAL_JUDGE_PROMPT,
|
|
4318
|
+
// Read-only workspace tools the default goal judge may call to verify the
|
|
4319
|
+
// agent's work against the actual filesystem (view, search_content,
|
|
4320
|
+
// find_files, file_stat, lsp_inspect) rather than grading prose alone —
|
|
4321
|
+
// restoring the original MastraCode judge's verification ability. Resolved
|
|
4322
|
+
// per-request from the active workspace (mirrors `judge`).
|
|
4323
|
+
tools: getGoalJudgeTools
|
|
4289
4324
|
},
|
|
4290
4325
|
inputProcessors: [
|
|
4291
4326
|
new processors.AgentsMDInjector({
|
|
@@ -4304,21 +4339,21 @@ async function createMastraCode(config) {
|
|
|
4304
4339
|
...buildMode,
|
|
4305
4340
|
metadata: {
|
|
4306
4341
|
...buildMode.metadata,
|
|
4307
|
-
color:
|
|
4342
|
+
color: chunkS2RM75NL_cjs.mastra.green
|
|
4308
4343
|
}
|
|
4309
4344
|
},
|
|
4310
4345
|
{
|
|
4311
4346
|
...planMode,
|
|
4312
4347
|
metadata: {
|
|
4313
4348
|
...planMode.metadata,
|
|
4314
|
-
color:
|
|
4349
|
+
color: chunkS2RM75NL_cjs.mastra.purple
|
|
4315
4350
|
}
|
|
4316
4351
|
},
|
|
4317
4352
|
{
|
|
4318
4353
|
...fastMode,
|
|
4319
4354
|
metadata: {
|
|
4320
4355
|
...fastMode.metadata,
|
|
4321
|
-
color:
|
|
4356
|
+
color: chunkS2RM75NL_cjs.mastra.orange
|
|
4322
4357
|
}
|
|
4323
4358
|
}
|
|
4324
4359
|
];
|
|
@@ -4359,11 +4394,11 @@ async function createMastraCode(config) {
|
|
|
4359
4394
|
}
|
|
4360
4395
|
} catch {
|
|
4361
4396
|
}
|
|
4362
|
-
const builtinPacks =
|
|
4363
|
-
const builtinOmPacks =
|
|
4364
|
-
const effectiveDefaults =
|
|
4365
|
-
const effectiveObserverModel =
|
|
4366
|
-
const effectiveReflectorModel =
|
|
4397
|
+
const builtinPacks = chunkS2RM75NL_cjs.getAvailableModePacks(startupAccess);
|
|
4398
|
+
const builtinOmPacks = chunkS2RM75NL_cjs.getAvailableOmPacks(startupAccess);
|
|
4399
|
+
const effectiveDefaults = chunkS2RM75NL_cjs.resolveModelDefaults(globalSettings, builtinPacks);
|
|
4400
|
+
const effectiveObserverModel = chunkS2RM75NL_cjs.resolveOmRoleModel(globalSettings, "observer", builtinOmPacks);
|
|
4401
|
+
const effectiveReflectorModel = chunkS2RM75NL_cjs.resolveOmRoleModel(globalSettings, "reflector", builtinOmPacks);
|
|
4367
4402
|
const effectiveObservationThreshold = globalSettings.models.omObservationThreshold ?? void 0;
|
|
4368
4403
|
const effectiveReflectionThreshold = globalSettings.models.omReflectionThreshold ?? void 0;
|
|
4369
4404
|
const effectiveCavemanObservations = globalSettings.models.omCavemanObservations ?? void 0;
|
|
@@ -4436,19 +4471,19 @@ async function createMastraCode(config) {
|
|
|
4436
4471
|
heartbeatHandlers,
|
|
4437
4472
|
resolveModel,
|
|
4438
4473
|
customModelCatalogProvider: createMastraCodeModelCatalogProvider(mastraCodeGateway),
|
|
4439
|
-
modelUseCountProvider: () =>
|
|
4474
|
+
modelUseCountProvider: () => chunkS2RM75NL_cjs.loadSettings().modelUseCounts,
|
|
4440
4475
|
modelUseCountTracker: (modelId) => {
|
|
4441
4476
|
try {
|
|
4442
|
-
const settings =
|
|
4477
|
+
const settings = chunkS2RM75NL_cjs.loadSettings();
|
|
4443
4478
|
settings.modelUseCounts[modelId] = (settings.modelUseCounts[modelId] ?? 0) + 1;
|
|
4444
|
-
|
|
4479
|
+
chunkS2RM75NL_cjs.saveSettings(settings);
|
|
4445
4480
|
} catch (error) {
|
|
4446
4481
|
console.error("Failed to persist model usage count", error);
|
|
4447
4482
|
}
|
|
4448
4483
|
},
|
|
4449
4484
|
threadLock: crossProcessPubSub ? void 0 : {
|
|
4450
|
-
acquire:
|
|
4451
|
-
release:
|
|
4485
|
+
acquire: chunkS2RM75NL_cjs.acquireThreadLock,
|
|
4486
|
+
release: chunkS2RM75NL_cjs.releaseThreadLock
|
|
4452
4487
|
}
|
|
4453
4488
|
// , harnessV1
|
|
4454
4489
|
});
|
|
@@ -4507,5 +4542,5 @@ async function createMastraCode(config) {
|
|
|
4507
4542
|
|
|
4508
4543
|
exports.createAuthStorage = createAuthStorage;
|
|
4509
4544
|
exports.createMastraCode = createMastraCode;
|
|
4510
|
-
//# sourceMappingURL=chunk-
|
|
4511
|
-
//# sourceMappingURL=chunk-
|
|
4545
|
+
//# sourceMappingURL=chunk-3PNUO4FX.cjs.map
|
|
4546
|
+
//# sourceMappingURL=chunk-3PNUO4FX.cjs.map
|