mastracode 0.3.0 → 0.4.0
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 +132 -0
- package/README.md +60 -12
- package/dist/agents/instructions.d.ts.map +1 -1
- package/dist/agents/model.d.ts +4 -1
- package/dist/agents/model.d.ts.map +1 -1
- package/dist/auth/claude-max-warning.d.ts +9 -0
- package/dist/auth/claude-max-warning.d.ts.map +1 -0
- package/dist/{chunk-7TFV3VBB.cjs → chunk-C4X3C2DL.cjs} +1091 -607
- package/dist/chunk-C4X3C2DL.cjs.map +1 -0
- package/dist/{chunk-7K5VFY2N.cjs → chunk-K4WJUBEC.cjs} +151 -48
- package/dist/chunk-K4WJUBEC.cjs.map +1 -0
- package/dist/{chunk-HHX6BKLR.js → chunk-M5LKPQB4.js} +12 -11
- package/dist/chunk-M5LKPQB4.js.map +1 -0
- package/dist/{chunk-V4HZ2AVV.js → chunk-REVOTI2T.js} +143 -38
- package/dist/chunk-REVOTI2T.js.map +1 -0
- package/dist/{chunk-C6XKRHRK.cjs → chunk-S5ZLN7DR.cjs} +6 -2
- package/dist/chunk-S5ZLN7DR.cjs.map +1 -0
- package/dist/{chunk-VRZZSUQE.js → chunk-SM3QCOA7.js} +6 -3
- package/dist/chunk-SM3QCOA7.js.map +1 -0
- package/dist/{chunk-LYETHS2L.js → chunk-X3BGE7CL.js} +877 -394
- package/dist/chunk-X3BGE7CL.js.map +1 -0
- package/dist/{chunk-VZFPT5N7.cjs → chunk-Z4QRXVST.cjs} +62 -61
- package/dist/chunk-Z4QRXVST.cjs.map +1 -0
- package/dist/cli.cjs +20 -10
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +14 -4
- package/dist/cli.js.map +1 -1
- package/dist/docs/SKILL.md +30 -0
- package/dist/docs/assets/SOURCE_MAP.json +11 -0
- package/dist/docs/references/docs-mastra-code-configuration.md +299 -0
- package/dist/docs/references/docs-mastra-code-customization.md +228 -0
- package/dist/docs/references/docs-mastra-code-modes.md +104 -0
- package/dist/docs/references/docs-mastra-code-overview.md +135 -0
- package/dist/docs/references/docs-mastra-code-tools.md +229 -0
- package/dist/docs/references/reference-mastra-code-createMastraCode.md +108 -0
- package/dist/index.cjs +2 -2
- package/dist/index.js +1 -1
- package/dist/onboarding/onboarding-inline.d.ts +5 -0
- package/dist/onboarding/onboarding-inline.d.ts.map +1 -1
- package/dist/onboarding/settings.d.ts +3 -0
- package/dist/onboarding/settings.d.ts.map +1 -1
- package/dist/providers/openai-codex.d.ts +5 -1
- package/dist/providers/openai-codex.d.ts.map +1 -1
- package/dist/schema.d.ts +7 -1
- package/dist/schema.d.ts.map +1 -1
- package/dist/storage-PO4VN5NF.cjs +24 -0
- package/dist/{storage-JFFX7LJJ.cjs.map → storage-PO4VN5NF.cjs.map} +1 -1
- package/dist/storage-PQOHJLBI.js +3 -0
- package/dist/{storage-52Y5MKTG.js.map → storage-PQOHJLBI.js.map} +1 -1
- package/dist/tui/claude-max-warning.d.ts +18 -0
- package/dist/tui/claude-max-warning.d.ts.map +1 -0
- 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/login.d.ts.map +1 -1
- package/dist/tui/commands/models-pack.d.ts.map +1 -1
- package/dist/tui/commands/settings.d.ts.map +1 -1
- package/dist/tui/commands/skills.d.ts.map +1 -1
- package/dist/tui/commands/theme.d.ts +6 -0
- package/dist/tui/commands/theme.d.ts.map +1 -0
- package/dist/tui/commands/think.d.ts +1 -1
- package/dist/tui/commands/think.d.ts.map +1 -1
- package/dist/tui/components/banner.d.ts.map +1 -1
- package/dist/tui/components/diff-output.d.ts.map +1 -1
- package/dist/tui/components/help-overlay.d.ts.map +1 -1
- package/dist/tui/components/obi-loader.d.ts.map +1 -1
- package/dist/tui/components/settings.d.ts +1 -0
- package/dist/tui/components/settings.d.ts.map +1 -1
- package/dist/tui/components/shell-output.d.ts.map +1 -1
- package/dist/tui/components/task-progress.d.ts.map +1 -1
- package/dist/tui/components/thinking-settings.d.ts +11 -22
- package/dist/tui/components/thinking-settings.d.ts.map +1 -1
- package/dist/tui/components/tool-execution-enhanced.d.ts.map +1 -1
- package/dist/tui/detect-theme.d.ts +17 -0
- package/dist/tui/detect-theme.d.ts.map +1 -0
- package/dist/tui/event-dispatch.d.ts.map +1 -1
- package/dist/tui/handlers/agent-lifecycle.d.ts.map +1 -1
- package/dist/tui/index.d.ts +2 -2
- package/dist/tui/index.d.ts.map +1 -1
- package/dist/tui/mastra-tui.d.ts +8 -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.map +1 -1
- package/dist/tui/status-line.d.ts.map +1 -1
- package/dist/tui/theme.d.ts +33 -20
- package/dist/tui/theme.d.ts.map +1 -1
- package/dist/tui.cjs +27 -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-processor.d.ts.map +1 -1
- package/package.json +8 -8
- package/dist/chunk-7K5VFY2N.cjs.map +0 -1
- package/dist/chunk-7TFV3VBB.cjs.map +0 -1
- package/dist/chunk-C6XKRHRK.cjs.map +0 -1
- package/dist/chunk-HHX6BKLR.js.map +0 -1
- package/dist/chunk-LYETHS2L.js.map +0 -1
- package/dist/chunk-V4HZ2AVV.js.map +0 -1
- package/dist/chunk-VRZZSUQE.js.map +0 -1
- package/dist/chunk-VZFPT5N7.cjs.map +0 -1
- package/dist/storage-52Y5MKTG.js +0 -3
- package/dist/storage-JFFX7LJJ.cjs +0 -24
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AuthStorage, getAppDataDir } from './chunk-
|
|
1
|
+
import { AuthStorage, getAppDataDir } from './chunk-SM3QCOA7.js';
|
|
2
2
|
import { exec, spawn } from 'child_process';
|
|
3
3
|
import * as fs8 from 'fs';
|
|
4
4
|
import { readFileSync, writeFileSync, promises, existsSync, mkdirSync } from 'fs';
|
|
@@ -2267,33 +2267,48 @@ function setAuthStorage2(storage) {
|
|
|
2267
2267
|
var CODEX_INSTRUCTIONS = `You are an interactive CLI tool that helps users with software engineering tasks. Use the instructions below and the tools available to you to assist the user.
|
|
2268
2268
|
|
|
2269
2269
|
IMPORTANT: You should be concise, direct, and helpful. Focus on solving the user's problem efficiently.`;
|
|
2270
|
-
var
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
params.providerOptions = {
|
|
2277
|
-
...params.providerOptions,
|
|
2278
|
-
openai: {
|
|
2279
|
-
...params.providerOptions?.openai ?? {},
|
|
2280
|
-
// Codex API requires instructions
|
|
2281
|
-
instructions: CODEX_INSTRUCTIONS,
|
|
2282
|
-
// Codex API requires store to be false
|
|
2283
|
-
store: false
|
|
2284
|
-
}
|
|
2285
|
-
};
|
|
2286
|
-
return params;
|
|
2287
|
-
}
|
|
2270
|
+
var THINKING_LEVEL_TO_REASONING_EFFORT = {
|
|
2271
|
+
off: void 0,
|
|
2272
|
+
low: "low",
|
|
2273
|
+
medium: "medium",
|
|
2274
|
+
high: "high",
|
|
2275
|
+
xhigh: "xhigh"
|
|
2288
2276
|
};
|
|
2289
|
-
function
|
|
2277
|
+
function createCodexMiddleware(reasoningEffort) {
|
|
2278
|
+
return {
|
|
2279
|
+
specificationVersion: "v3",
|
|
2280
|
+
transformParams: async ({ params }) => {
|
|
2281
|
+
if (params.temperature !== void 0 && params.temperature !== null) {
|
|
2282
|
+
delete params.topP;
|
|
2283
|
+
}
|
|
2284
|
+
params.providerOptions = {
|
|
2285
|
+
...params.providerOptions,
|
|
2286
|
+
openai: {
|
|
2287
|
+
...params.providerOptions?.openai ?? {},
|
|
2288
|
+
instructions: CODEX_INSTRUCTIONS,
|
|
2289
|
+
// Codex API requires store to be false
|
|
2290
|
+
store: false,
|
|
2291
|
+
// Enable reasoning for Codex models — without this, the model
|
|
2292
|
+
// skips the reasoning/action phase and goes straight to final_answer,
|
|
2293
|
+
// resulting in narration instead of tool calls.
|
|
2294
|
+
...reasoningEffort ? { reasoningEffort } : {}
|
|
2295
|
+
}
|
|
2296
|
+
};
|
|
2297
|
+
return params;
|
|
2298
|
+
}
|
|
2299
|
+
};
|
|
2300
|
+
}
|
|
2301
|
+
function openaiCodexProvider(modelId = "codex-mini-latest", options) {
|
|
2302
|
+
const level = options?.thinkingLevel ?? "medium";
|
|
2303
|
+
const reasoningEffort = THINKING_LEVEL_TO_REASONING_EFFORT[level];
|
|
2304
|
+
const middleware = createCodexMiddleware(reasoningEffort);
|
|
2290
2305
|
if (process.env.NODE_ENV === "test" || process.env.VITEST) {
|
|
2291
2306
|
const openai2 = createOpenAI({
|
|
2292
2307
|
apiKey: process.env.OPENAI_API_KEY || "test-api-key"
|
|
2293
2308
|
});
|
|
2294
2309
|
return wrapLanguageModel({
|
|
2295
2310
|
model: openai2.responses(modelId),
|
|
2296
|
-
middleware: [
|
|
2311
|
+
middleware: [middleware]
|
|
2297
2312
|
});
|
|
2298
2313
|
}
|
|
2299
2314
|
const oauthFetch = async (url, init) => {
|
|
@@ -2354,11 +2369,11 @@ function openaiCodexProvider(modelId = "codex-mini-latest") {
|
|
|
2354
2369
|
});
|
|
2355
2370
|
return wrapLanguageModel({
|
|
2356
2371
|
model: openai.responses(modelId),
|
|
2357
|
-
middleware: [
|
|
2372
|
+
middleware: [middleware]
|
|
2358
2373
|
});
|
|
2359
2374
|
}
|
|
2360
2375
|
var authStorage = new AuthStorage();
|
|
2361
|
-
function resolveModel(modelId) {
|
|
2376
|
+
function resolveModel(modelId, options) {
|
|
2362
2377
|
authStorage.reload();
|
|
2363
2378
|
const isAnthropicModel = modelId.startsWith("anthropic/");
|
|
2364
2379
|
const isOpenAIModel = modelId.startsWith("openai/");
|
|
@@ -2375,7 +2390,9 @@ function resolveModel(modelId) {
|
|
|
2375
2390
|
} else if (isAnthropicModel) {
|
|
2376
2391
|
return opencodeClaudeMaxProvider(modelId.substring(`anthropic/`.length));
|
|
2377
2392
|
} else if (isOpenAIModel && authStorage.isLoggedIn("openai-codex")) {
|
|
2378
|
-
return openaiCodexProvider(modelId.substring(`openai/`.length)
|
|
2393
|
+
return openaiCodexProvider(modelId.substring(`openai/`.length), {
|
|
2394
|
+
thinkingLevel: options?.thinkingLevel
|
|
2395
|
+
});
|
|
2379
2396
|
} else {
|
|
2380
2397
|
return new ModelRouterLanguageModel(modelId);
|
|
2381
2398
|
}
|
|
@@ -2388,7 +2405,8 @@ function getDynamicModel({
|
|
|
2388
2405
|
if (!modelId) {
|
|
2389
2406
|
throw new Error("No model selected. Use /models to select a model first.");
|
|
2390
2407
|
}
|
|
2391
|
-
|
|
2408
|
+
const thinkingLevel = harnessContext?.state?.thinkingLevel;
|
|
2409
|
+
return resolveModel(modelId, { thinkingLevel });
|
|
2392
2410
|
}
|
|
2393
2411
|
|
|
2394
2412
|
// src/agents/subagents/execute.ts
|
|
@@ -3001,7 +3019,7 @@ var requestSandboxAccessTool = createTool({
|
|
|
3001
3019
|
// src/onboarding/packs.ts
|
|
3002
3020
|
function getAvailableModePacks(access, savedCustomPacks = []) {
|
|
3003
3021
|
const packs = [];
|
|
3004
|
-
const openaiCodex = "openai/gpt-5.
|
|
3022
|
+
const openaiCodex = "openai/gpt-5.3-codex";
|
|
3005
3023
|
const anthropicBuild = access.anthropic === "oauth" ? "anthropic/claude-opus-4-6" : "anthropic/claude-sonnet-4-5";
|
|
3006
3024
|
if (access.anthropic && access.openai) {
|
|
3007
3025
|
packs.push({
|
|
@@ -3114,7 +3132,8 @@ var DEFAULTS = {
|
|
|
3114
3132
|
skippedAt: null,
|
|
3115
3133
|
version: 0,
|
|
3116
3134
|
modePackId: null,
|
|
3117
|
-
omPackId: null
|
|
3135
|
+
omPackId: null,
|
|
3136
|
+
claudeMaxOAuthWarningAcknowledgedAt: null
|
|
3118
3137
|
},
|
|
3119
3138
|
models: {
|
|
3120
3139
|
activeModelPackId: null,
|
|
@@ -3124,7 +3143,8 @@ var DEFAULTS = {
|
|
|
3124
3143
|
subagentModels: {}
|
|
3125
3144
|
},
|
|
3126
3145
|
preferences: {
|
|
3127
|
-
yolo: null
|
|
3146
|
+
yolo: null,
|
|
3147
|
+
theme: "auto"
|
|
3128
3148
|
},
|
|
3129
3149
|
storage: { ...STORAGE_DEFAULTS },
|
|
3130
3150
|
customModelPacks: [],
|
|
@@ -3250,7 +3270,11 @@ function saveSettings(settings, filePath = getSettingsPath()) {
|
|
|
3250
3270
|
}
|
|
3251
3271
|
writeFileSync(filePath, JSON.stringify(settings, null, 2), "utf-8");
|
|
3252
3272
|
}
|
|
3253
|
-
var
|
|
3273
|
+
var currentThemeMode = "dark";
|
|
3274
|
+
function getThemeMode() {
|
|
3275
|
+
return currentThemeMode;
|
|
3276
|
+
}
|
|
3277
|
+
var mastraBrand = {
|
|
3254
3278
|
purple: "#7f45e0",
|
|
3255
3279
|
// #b588fe brand is too washed out for terminal
|
|
3256
3280
|
green: "#059669",
|
|
@@ -3261,22 +3285,49 @@ var mastra = {
|
|
|
3261
3285
|
// #6ccdfb brand is to washed out
|
|
3262
3286
|
red: "#DC5663",
|
|
3263
3287
|
// #ff4758 too intense
|
|
3264
|
-
yellow: "#e7e67b"
|
|
3265
|
-
|
|
3288
|
+
yellow: "#e7e67b"
|
|
3289
|
+
};
|
|
3290
|
+
var darkSurface = {
|
|
3266
3291
|
bg: "#020202",
|
|
3267
3292
|
antiGrid: "#0d0d0d",
|
|
3268
3293
|
elevationSm: "#1a1a1a",
|
|
3269
3294
|
elevationLg: "#141414",
|
|
3270
3295
|
hover: "#262626",
|
|
3271
|
-
// Text colors
|
|
3272
3296
|
white: "#f0f0f0",
|
|
3273
3297
|
specialGray: "#cccccc",
|
|
3274
3298
|
mainGray: "#939393",
|
|
3275
3299
|
darkGray: "#424242",
|
|
3276
|
-
// Border colors
|
|
3277
3300
|
borderAntiGrid: "#141414",
|
|
3278
3301
|
borderElevation: "#1a1a1a"
|
|
3279
3302
|
};
|
|
3303
|
+
var lightSurface = {
|
|
3304
|
+
bg: "#ffffff",
|
|
3305
|
+
antiGrid: "#eaeaea",
|
|
3306
|
+
elevationSm: "#ebebeb",
|
|
3307
|
+
elevationLg: "#f0f0f0",
|
|
3308
|
+
hover: "#e0e0e0",
|
|
3309
|
+
white: "#1a1a1a",
|
|
3310
|
+
specialGray: "#444444",
|
|
3311
|
+
mainGray: "#6b6b6b",
|
|
3312
|
+
darkGray: "#b0b0b0",
|
|
3313
|
+
borderAntiGrid: "#e5e5e5",
|
|
3314
|
+
borderElevation: "#e0e0e0"
|
|
3315
|
+
};
|
|
3316
|
+
function getSurface() {
|
|
3317
|
+
return currentThemeMode === "dark" ? darkSurface : lightSurface;
|
|
3318
|
+
}
|
|
3319
|
+
var mastra = new Proxy({}, {
|
|
3320
|
+
get(_target, prop) {
|
|
3321
|
+
if (prop in mastraBrand) {
|
|
3322
|
+
return mastraBrand[prop];
|
|
3323
|
+
}
|
|
3324
|
+
const surface = getSurface();
|
|
3325
|
+
if (prop in surface) {
|
|
3326
|
+
return surface[prop];
|
|
3327
|
+
}
|
|
3328
|
+
return void 0;
|
|
3329
|
+
}
|
|
3330
|
+
});
|
|
3280
3331
|
function tintHex(hex, factor) {
|
|
3281
3332
|
const r = Math.floor(parseInt(hex.slice(1, 3), 16) * factor);
|
|
3282
3333
|
const g = Math.floor(parseInt(hex.slice(3, 5), 16) * factor);
|
|
@@ -3329,9 +3380,59 @@ var darkTheme = {
|
|
|
3329
3380
|
function: "#60a5fa",
|
|
3330
3381
|
// Light blue for function names
|
|
3331
3382
|
// Selection
|
|
3332
|
-
selectedBg:
|
|
3383
|
+
selectedBg: darkSurface.hover,
|
|
3384
|
+
// Overlays
|
|
3385
|
+
overlayBg: darkSurface.antiGrid
|
|
3386
|
+
};
|
|
3387
|
+
var lightTheme = {
|
|
3388
|
+
// Core UI
|
|
3389
|
+
accent: "#7c3aed",
|
|
3390
|
+
// Purple stays the same
|
|
3391
|
+
border: "#d4d4d8",
|
|
3392
|
+
borderAccent: "#7c3aed",
|
|
3393
|
+
borderMuted: "#e4e4e7",
|
|
3394
|
+
success: "#16a34a",
|
|
3395
|
+
error: "#dc2626",
|
|
3396
|
+
warning: "#d97706",
|
|
3397
|
+
muted: "#71717a",
|
|
3398
|
+
dim: "#a1a1aa",
|
|
3399
|
+
text: "#18181b",
|
|
3400
|
+
thinkingText: "#71717a",
|
|
3401
|
+
// User messages
|
|
3402
|
+
userMessageBg: "#eff6ff",
|
|
3403
|
+
// Light blue
|
|
3404
|
+
userMessageText: "#18181b",
|
|
3405
|
+
// System reminders
|
|
3406
|
+
systemReminderBg: "#fefce8",
|
|
3407
|
+
// Light yellow
|
|
3408
|
+
// Tool execution
|
|
3409
|
+
toolPendingBg: "#f5f3ff",
|
|
3410
|
+
// Light purple
|
|
3411
|
+
toolSuccessBg: "#f5f3ff",
|
|
3412
|
+
// Light purple (same as pending)
|
|
3413
|
+
toolErrorBg: "#fef2f2",
|
|
3414
|
+
// Light red
|
|
3415
|
+
toolBorderPending: "#6366f1",
|
|
3416
|
+
// Indigo for pending
|
|
3417
|
+
toolBorderSuccess: "#16a34a",
|
|
3418
|
+
// Green for success
|
|
3419
|
+
toolBorderError: "#dc2626",
|
|
3420
|
+
// Red for error
|
|
3421
|
+
toolTitle: "#7c3aed",
|
|
3422
|
+
toolOutput: "#3f3f46",
|
|
3423
|
+
// Error display
|
|
3424
|
+
errorBg: "#fef2f2",
|
|
3425
|
+
// Light red
|
|
3426
|
+
path: "#6b7280",
|
|
3427
|
+
// Gray for file paths
|
|
3428
|
+
number: "#b45309",
|
|
3429
|
+
// Amber for line numbers
|
|
3430
|
+
function: "#2563eb",
|
|
3431
|
+
// Blue for function names
|
|
3432
|
+
// Selection
|
|
3433
|
+
selectedBg: lightSurface.hover,
|
|
3333
3434
|
// Overlays
|
|
3334
|
-
overlayBg:
|
|
3435
|
+
overlayBg: lightSurface.antiGrid
|
|
3335
3436
|
};
|
|
3336
3437
|
var currentTheme = darkTheme;
|
|
3337
3438
|
function getTheme() {
|
|
@@ -3340,6 +3441,10 @@ function getTheme() {
|
|
|
3340
3441
|
function setTheme(colors) {
|
|
3341
3442
|
currentTheme = colors;
|
|
3342
3443
|
}
|
|
3444
|
+
function applyThemeMode(mode) {
|
|
3445
|
+
currentThemeMode = mode;
|
|
3446
|
+
currentTheme = mode === "light" ? lightTheme : darkTheme;
|
|
3447
|
+
}
|
|
3343
3448
|
function fg(color, text) {
|
|
3344
3449
|
const hex = currentTheme[color];
|
|
3345
3450
|
if (!hex) return text;
|
|
@@ -3497,6 +3602,6 @@ function releaseAllThreadLocks() {
|
|
|
3497
3602
|
}
|
|
3498
3603
|
}
|
|
3499
3604
|
|
|
3500
|
-
export { ONBOARDING_VERSION, ThreadLockError, acquireThreadLock,
|
|
3501
|
-
//# sourceMappingURL=chunk-
|
|
3502
|
-
//# sourceMappingURL=chunk-
|
|
3605
|
+
export { ONBOARDING_VERSION, ThreadLockError, acquireThreadLock, applyThemeMode, astSmartEditTool, createExecuteCommandTool, createGlobTool, createGrepTool, createViewTool, createWebExtractTool, createWebSearchTool, createWriteFileTool, executeSubagent, exploreSubagent, getAvailableModePacks, getAvailableOmPacks, getDynamicModel, getEditorTheme, getMarkdownTheme, getSelectListTheme, getSettingsListTheme, getThemeMode, hasTavilyKey, loadSettings, mastra, mastraBrand, parseSubagentMeta, planSubagent, releaseAllThreadLocks, releaseThreadLock, requestSandboxAccessTool, resolveModel, resolveModelDefaults, resolveOmModel, saveSettings, setAuthStorage, setAuthStorage2, stringReplaceLspTool, theme, tintHex };
|
|
3606
|
+
//# sourceMappingURL=chunk-REVOTI2T.js.map
|
|
3607
|
+
//# sourceMappingURL=chunk-REVOTI2T.js.map
|