@mastra/code-sdk 1.4.1-alpha.2 → 1.5.0-alpha.7
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 +72 -0
- package/dist/agents/context-audit.d.ts +84 -0
- package/dist/agents/context-audit.d.ts.map +1 -0
- package/dist/agents/context-audit.js +118 -0
- package/dist/agents/context-audit.js.map +1 -0
- package/dist/agents/instructions.d.ts +12 -1
- package/dist/agents/instructions.d.ts.map +1 -1
- package/dist/agents/instructions.js +23 -5
- package/dist/agents/instructions.js.map +1 -1
- package/dist/agents/model.d.ts +11 -4
- package/dist/agents/model.d.ts.map +1 -1
- package/dist/agents/model.js +2 -1
- package/dist/agents/model.js.map +1 -1
- package/dist/agents/prompts/agent-instructions.d.ts +9 -0
- package/dist/agents/prompts/agent-instructions.d.ts.map +1 -1
- package/dist/agents/prompts/agent-instructions.js +14 -4
- package/dist/agents/prompts/agent-instructions.js.map +1 -1
- package/dist/agents/prompts/index.d.ts +28 -0
- package/dist/agents/prompts/index.d.ts.map +1 -1
- package/dist/agents/prompts/index.js +49 -7
- package/dist/agents/prompts/index.js.map +1 -1
- package/dist/agents/tools.js +1 -1
- package/dist/agents/workspace.d.ts.map +1 -1
- package/dist/agents/workspace.js +12 -9
- package/dist/agents/workspace.js.map +1 -1
- package/dist/onboarding/settings.d.ts +9 -7
- package/dist/onboarding/settings.d.ts.map +1 -1
- package/dist/onboarding/settings.js +27 -25
- package/dist/onboarding/settings.js.map +1 -1
- package/dist/providers/openai-codex.d.ts +3 -4
- package/dist/providers/openai-codex.d.ts.map +1 -1
- package/dist/providers/openai-codex.js +1 -9
- package/dist/providers/openai-codex.js.map +1 -1
- package/dist/schema.d.ts +4 -3
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +2 -8
- package/dist/schema.js.map +1 -1
- package/dist/thinking.d.ts +33 -0
- package/dist/thinking.d.ts.map +1 -0
- package/dist/thinking.js +58 -0
- package/dist/thinking.js.map +1 -0
- package/dist/workflows/register-primitives.js +1 -1
- package/package.json +10 -10
package/dist/schema.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","names":[],"sources":["../src/schema.ts"],"sourcesContent":["import { z } from 'zod';\nimport { DEFAULT_CONFIG_DIR, DEFAULT_OM_MODEL_ID } from './constants.js';\n\nexport type PermissionPolicy = 'allow' | 'ask' | 'deny';\n\nexport type MastraCodeSessionState = {\n currentModelId: string;\n modeId: string;\n};\n\nexport type MastraCodeComposedState = MastraCodeState & MastraCodeSessionState;\n\nexport interface MastraCodeState {\n [key: string]: unknown;\n [key: `subagentModelId_${string}`]: string | undefined;\n subagentModelId?: string;\n projectPath?: string;\n projectName?: string;\n /** Factory project that owns this session. */\n factoryProjectId?: string;\n /** Authoritative organization id seeded by factory at session construction. */\n factoryOrgId?: string;\n /** Linked repository used by this session when source-control execution is required. */\n projectRepositoryId?: string;\n /** Persisted sandbox id for reattaching the project's cloud workspace. */\n sandboxId?: string;\n /** Path inside the sandbox the repo is cloned into. */\n sandboxWorkdir?: string;\n /** Active git worktree path inside the sandbox for the current unit of work. */\n worktreePath?: string;\n /** Active feature branch checked out in the worktree. */\n branch?: string;\n /**\n * The session's checkout contains third-party content (e.g. a PR branch\n * under review). Project-level instruction files (AGENTS.md, CLAUDE.md)\n * are attacker-writable there and must not be ingested into the system\n * prompt or injected as reminders.\n */\n untrustedCheckout?: boolean;\n /**\n * Trusted git ref (typically the PR's base branch) to serve project\n * instruction files from when the checkout is untrusted. Without it,\n * project-scope instruction files are skipped entirely.\n */\n baseRef?: string;\n /**\n * Skip the home-directory instruction files (~/.claude/AGENTS.md and\n * friends). Hosts running sessions for someone else set this so a run never\n * inherits the machine owner's personal configuration.\n */\n skipGlobalInstructions?: boolean;\n configDir: string;\n homeDir?: string;\n gitBranch?: string;\n lastCommand?: string;\n observerModelId: string;\n reflectorModelId: string;\n observationThreshold: number;\n reflectionThreshold: number;\n cavemanObservations: boolean;\n observeAttachments: 'auto' | boolean;\n omScope?: 'thread' | 'resource';\n /**\n * Session-level reasoning-effort override. When unset, the effective level is\n * resolved at request time from settings (`models.modeThinkingDefaults[mode]`\n * falling back to `preferences.thinkingLevel`).\n */\n thinkingLevel?: 'off' | 'low' | 'medium' | 'high' | 'xhigh' | 'max';\n yolo: boolean;\n permissionRules: {\n categories: Record<string, PermissionPolicy>;\n tools: Record<string, PermissionPolicy>;\n };\n smartEditing: boolean;\n notifications: 'bell' | 'system' | 'both' | 'off';\n tasks: Array<{\n id?: string;\n content: string;\n status: 'pending' | 'in_progress' | 'completed';\n activeForm: string;\n }>;\n sandboxAllowedPaths: string[];\n pluginSkillPaths: string[];\n pluginCommandPaths: string[];\n pluginInstructions: string[];\n activePlan: {\n title: string;\n plan: string;\n approvedAt: string;\n } | null;\n activeBrowserSettings?: {\n enabled: boolean;\n provider: 'stagehand' | 'agent-browser';\n headless?: boolean;\n viewport?: { width: number; height: number } | 'window';\n cdpUrl?: string;\n stagehand?: {\n env: 'LOCAL' | 'BROWSERBASE';\n apiKey?: string;\n projectId?: string;\n };\n };\n}\n\nexport const stateSchema = z.object({\n // Session-scoped selection.\n // validates state against this schema, so they MUST be declared here — Zod\n // strips unknown keys on parse, which would otherwise silently discard the\n // seeded model and leave the controller with no model selected.\n currentModelId: z.string().optional(),\n modeId: z.string().optional(),\n subagentModelId: z.string().optional(),\n projectPath: z.string().optional(),\n projectName: z.string().optional(),\n factoryProjectId: z.string().optional(),\n factoryOrgId: z.string().optional(),\n projectRepositoryId: z.string().optional(),\n sandboxId: z.string().optional(),\n sandboxWorkdir: z.string().optional(),\n worktreePath: z.string().optional(),\n branch: z.string().optional(),\n // Session operates on an untrusted checkout — suppress AGENTS.md ingestion.\n untrustedCheckout: z.boolean().optional(),\n // Trusted ref to serve instruction files from on untrusted checkouts.\n baseRef: z.string().optional(),\n // Skip the operator machine's home-directory instruction files.\n skipGlobalInstructions: z.boolean().optional(),\n configDir: z.string().default(DEFAULT_CONFIG_DIR),\n homeDir: z.string().optional(),\n gitBranch: z.string().optional(),\n lastCommand: z.string().optional(),\n // Observational Memory model settings\n observerModelId: z.string().default(DEFAULT_OM_MODEL_ID),\n reflectorModelId: z.string().default(DEFAULT_OM_MODEL_ID),\n // Observational Memory threshold settings\n observationThreshold: z.number().default(30_000),\n reflectionThreshold: z.number().default(40_000),\n // Whether observations and reflections use the terse caveman-style instruction.\n // Off by default — caveman style is opt-in via `/om` settings; observers and\n // reflectors fall back to their built-in (prose) behavior unless enabled.\n cavemanObservations: z.boolean().default(false),\n // Whether OM forwards image/file attachment parts to the Observer LLM.\n // 'auto' (default) checks the provider capabilities registry to decide.\n // true/false forces the setting regardless of model capabilities.\n observeAttachments: z.union([z.literal('auto'), z.boolean()]).default('auto'),\n // Observational Memory scope — 'thread' (per-conversation) or 'resource' (shared across threads)\n omScope: z.enum(['thread', 'resource']).optional(),\n // Thinking level for model reasoning effort. Optional: absent means \"no\n // session override\" — the effective level is resolved from settings\n // (per-mode defaults, then the global preference) at request time.\n thinkingLevel: z.enum(['off', 'low', 'medium', 'high', 'xhigh', 'max']).optional(),\n // YOLO mode — auto-approve all tool calls\n yolo: z.boolean().default(false),\n // Permission rules — per-category and per-tool approval policies\n permissionRules: z\n .object({\n categories: z.record(z.string(), z.enum(['allow', 'ask', 'deny'])).default({}),\n tools: z.record(z.string(), z.enum(['allow', 'ask', 'deny'])).default({}),\n })\n .default({ categories: {}, tools: {} }),\n // Smart editing mode — use AST-based analysis for code edits\n smartEditing: z.boolean().default(true),\n // Notification mode — alert when TUI needs user attention\n notifications: z.enum(['bell', 'system', 'both', 'off']).default('off'),\n // Task list (ephemeral per-thread, cleared on thread switch/creation)\n tasks: z\n .array(\n z.object({\n id: z.string().optional(),\n content: z.string(),\n status: z.enum(['pending', 'in_progress', 'completed']),\n activeForm: z.string(),\n }),\n )\n .default([]),\n // Sandbox allowed paths (per-thread, absolute paths allowed in addition to project root)\n sandboxAllowedPaths: z.array(z.string()).default([]),\n // Asset directories contributed by active plugins.\n pluginSkillPaths: z.array(z.string()).default([]),\n pluginCommandPaths: z.array(z.string()).default([]),\n pluginInstructions: z.array(z.string()).default([]),\n // Active plan (set when a plan is approved in Plan mode)\n activePlan: z\n .object({\n title: z.string(),\n plan: z.string(),\n approvedAt: z.string(),\n })\n .nullable()\n .default(null),\n // Active browser settings (tracks what's actually running vs. what's in the settings file)\n activeBrowserSettings: z\n .object({\n enabled: z.boolean(),\n provider: z.enum(['stagehand', 'agent-browser']),\n headless: z.boolean().optional(),\n viewport: z\n .union([\n z.object({\n width: z.number(),\n height: z.number(),\n }),\n z.literal('window'),\n ])\n .optional(),\n cdpUrl: z.string().optional(),\n stagehand: z\n .object({\n env: z.enum(['LOCAL', 'BROWSERBASE']),\n apiKey: z.string().optional(),\n projectId: z.string().optional(),\n })\n .optional(),\n })\n .optional(),\n});\n"],"mappings":";;;AAwGA,MAAa,cAAc,EAAE,OAAO;CAKlC,gBAAgB,EAAE,OAAO,CAAC,CAAC,SAAS;CACpC,QAAQ,EAAE,OAAO,CAAC,CAAC,SAAS;CAC5B,iBAAiB,EAAE,OAAO,CAAC,CAAC,SAAS;CACrC,aAAa,EAAE,OAAO,CAAC,CAAC,SAAS;CACjC,aAAa,EAAE,OAAO,CAAC,CAAC,SAAS;CACjC,kBAAkB,EAAE,OAAO,CAAC,CAAC,SAAS;CACtC,cAAc,EAAE,OAAO,CAAC,CAAC,SAAS;CAClC,qBAAqB,EAAE,OAAO,CAAC,CAAC,SAAS;CACzC,WAAW,EAAE,OAAO,CAAC,CAAC,SAAS;CAC/B,gBAAgB,EAAE,OAAO,CAAC,CAAC,SAAS;CACpC,cAAc,EAAE,OAAO,CAAC,CAAC,SAAS;CAClC,QAAQ,EAAE,OAAO,CAAC,CAAC,SAAS;CAE5B,mBAAmB,EAAE,QAAQ,CAAC,CAAC,SAAS;CAExC,SAAS,EAAE,OAAO,CAAC,CAAC,SAAS;CAE7B,wBAAwB,EAAE,QAAQ,CAAC,C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,CACD,SAAS;CACd,CAAC,CAAC,CACD,SAAS;AACd,CAAC"}
|
|
1
|
+
{"version":3,"file":"schema.js","names":[],"sources":["../src/schema.ts"],"sourcesContent":["import { z } from 'zod';\nimport { DEFAULT_CONFIG_DIR, DEFAULT_OM_MODEL_ID } from './constants.js';\nimport { THINKING_LEVEL_VALUES } from './thinking.js';\nimport type { ThinkingLevelSetting } from './thinking.js';\n\nexport type PermissionPolicy = 'allow' | 'ask' | 'deny';\n\nexport type MastraCodeSessionState = {\n currentModelId: string;\n modeId: string;\n};\n\nexport type MastraCodeComposedState = MastraCodeState & MastraCodeSessionState;\n\nexport interface MastraCodeState {\n [key: string]: unknown;\n [key: `subagentModelId_${string}`]: string | undefined;\n subagentModelId?: string;\n projectPath?: string;\n projectName?: string;\n /** Factory project that owns this session. */\n factoryProjectId?: string;\n /** Authoritative organization id seeded by factory at session construction. */\n factoryOrgId?: string;\n /** Linked repository used by this session when source-control execution is required. */\n projectRepositoryId?: string;\n /** Persisted sandbox id for reattaching the project's cloud workspace. */\n sandboxId?: string;\n /** Path inside the sandbox the repo is cloned into. */\n sandboxWorkdir?: string;\n /** Active git worktree path inside the sandbox for the current unit of work. */\n worktreePath?: string;\n /** Active feature branch checked out in the worktree. */\n branch?: string;\n /**\n * The session's checkout contains third-party content (e.g. a PR branch\n * under review). Project-level instruction files (AGENTS.md, CLAUDE.md)\n * are attacker-writable there and must not be ingested into the system\n * prompt or injected as reminders.\n */\n untrustedCheckout?: boolean;\n /**\n * Trusted git ref (typically the PR's base branch) to serve project\n * instruction files from when the checkout is untrusted. Without it,\n * project-scope instruction files are skipped entirely.\n */\n baseRef?: string;\n /**\n * Skip the home-directory instruction files (~/.claude/AGENTS.md and\n * friends). Hosts running sessions for someone else set this so a run never\n * inherits the machine owner's personal configuration.\n */\n skipGlobalInstructions?: boolean;\n configDir: string;\n homeDir?: string;\n gitBranch?: string;\n lastCommand?: string;\n observerModelId: string;\n reflectorModelId: string;\n observationThreshold: number;\n reflectionThreshold: number;\n cavemanObservations: boolean;\n observeAttachments: 'auto' | boolean;\n omScope?: 'thread' | 'resource';\n /**\n * Session-level reasoning-effort override. When unset, the effective level is\n * resolved at request time from settings (`models.modeThinkingDefaults[mode]`\n * falling back to `preferences.thinkingLevel`).\n */\n thinkingLevel?: ThinkingLevelSetting;\n yolo: boolean;\n permissionRules: {\n categories: Record<string, PermissionPolicy>;\n tools: Record<string, PermissionPolicy>;\n };\n smartEditing: boolean;\n notifications: 'bell' | 'system' | 'both' | 'off';\n tasks: Array<{\n id?: string;\n content: string;\n status: 'pending' | 'in_progress' | 'completed';\n activeForm: string;\n }>;\n sandboxAllowedPaths: string[];\n pluginSkillPaths: string[];\n pluginCommandPaths: string[];\n pluginInstructions: string[];\n activePlan: {\n title: string;\n plan: string;\n approvedAt: string;\n } | null;\n activeBrowserSettings?: {\n enabled: boolean;\n provider: 'stagehand' | 'agent-browser';\n headless?: boolean;\n viewport?: { width: number; height: number } | 'window';\n cdpUrl?: string;\n stagehand?: {\n env: 'LOCAL' | 'BROWSERBASE';\n apiKey?: string;\n projectId?: string;\n };\n };\n}\n\nexport const stateSchema = z.object({\n // Session-scoped selection.\n // validates state against this schema, so they MUST be declared here — Zod\n // strips unknown keys on parse, which would otherwise silently discard the\n // seeded model and leave the controller with no model selected.\n currentModelId: z.string().optional(),\n modeId: z.string().optional(),\n subagentModelId: z.string().optional(),\n projectPath: z.string().optional(),\n projectName: z.string().optional(),\n factoryProjectId: z.string().optional(),\n factoryOrgId: z.string().optional(),\n projectRepositoryId: z.string().optional(),\n sandboxId: z.string().optional(),\n sandboxWorkdir: z.string().optional(),\n worktreePath: z.string().optional(),\n branch: z.string().optional(),\n // Session operates on an untrusted checkout — suppress AGENTS.md ingestion.\n untrustedCheckout: z.boolean().optional(),\n // Trusted ref to serve instruction files from on untrusted checkouts.\n baseRef: z.string().optional(),\n // Skip the operator machine's home-directory instruction files.\n skipGlobalInstructions: z.boolean().optional(),\n configDir: z.string().default(DEFAULT_CONFIG_DIR),\n homeDir: z.string().optional(),\n gitBranch: z.string().optional(),\n lastCommand: z.string().optional(),\n // Observational Memory model settings\n observerModelId: z.string().default(DEFAULT_OM_MODEL_ID),\n reflectorModelId: z.string().default(DEFAULT_OM_MODEL_ID),\n // Observational Memory threshold settings\n observationThreshold: z.number().default(30_000),\n reflectionThreshold: z.number().default(40_000),\n // Whether observations and reflections use the terse caveman-style instruction.\n // Off by default — caveman style is opt-in via `/om` settings; observers and\n // reflectors fall back to their built-in (prose) behavior unless enabled.\n cavemanObservations: z.boolean().default(false),\n // Whether OM forwards image/file attachment parts to the Observer LLM.\n // 'auto' (default) checks the provider capabilities registry to decide.\n // true/false forces the setting regardless of model capabilities.\n observeAttachments: z.union([z.literal('auto'), z.boolean()]).default('auto'),\n // Observational Memory scope — 'thread' (per-conversation) or 'resource' (shared across threads)\n omScope: z.enum(['thread', 'resource']).optional(),\n // Thinking level for model reasoning effort. Optional: absent means \"no\n // session override\" — the effective level is resolved from settings\n // (per-mode defaults, then the global preference) at request time.\n thinkingLevel: z.preprocess(value => (value === null ? undefined : value), z.enum(THINKING_LEVEL_VALUES).optional()),\n // YOLO mode — auto-approve all tool calls\n yolo: z.boolean().default(false),\n // Permission rules — per-category and per-tool approval policies\n permissionRules: z\n .object({\n categories: z.record(z.string(), z.enum(['allow', 'ask', 'deny'])).default({}),\n tools: z.record(z.string(), z.enum(['allow', 'ask', 'deny'])).default({}),\n })\n .default({ categories: {}, tools: {} }),\n // Smart editing mode — use AST-based analysis for code edits\n smartEditing: z.boolean().default(true),\n // Notification mode — alert when TUI needs user attention\n notifications: z.enum(['bell', 'system', 'both', 'off']).default('off'),\n // Task list (ephemeral per-thread, cleared on thread switch/creation)\n tasks: z\n .array(\n z.object({\n id: z.string().optional(),\n content: z.string(),\n status: z.enum(['pending', 'in_progress', 'completed']),\n activeForm: z.string(),\n }),\n )\n .default([]),\n // Sandbox allowed paths (per-thread, absolute paths allowed in addition to project root)\n sandboxAllowedPaths: z.array(z.string()).default([]),\n // Asset directories contributed by active plugins.\n pluginSkillPaths: z.array(z.string()).default([]),\n pluginCommandPaths: z.array(z.string()).default([]),\n pluginInstructions: z.array(z.string()).default([]),\n // Active plan (set when a plan is approved in Plan mode)\n activePlan: z\n .object({\n title: z.string(),\n plan: z.string(),\n approvedAt: z.string(),\n })\n .nullable()\n .default(null),\n // Active browser settings (tracks what's actually running vs. what's in the settings file)\n activeBrowserSettings: z\n .object({\n enabled: z.boolean(),\n provider: z.enum(['stagehand', 'agent-browser']),\n headless: z.boolean().optional(),\n viewport: z\n .union([\n z.object({\n width: z.number(),\n height: z.number(),\n }),\n z.literal('window'),\n ])\n .optional(),\n cdpUrl: z.string().optional(),\n stagehand: z\n .object({\n env: z.enum(['LOCAL', 'BROWSERBASE']),\n apiKey: z.string().optional(),\n projectId: z.string().optional(),\n })\n .optional(),\n })\n .optional(),\n});\n"],"mappings":";;;;AA0GA,MAAa,cAAc,EAAE,OAAO;CAKlC,gBAAgB,EAAE,OAAO,CAAC,CAAC,SAAS;CACpC,QAAQ,EAAE,OAAO,CAAC,CAAC,SAAS;CAC5B,iBAAiB,EAAE,OAAO,CAAC,CAAC,SAAS;CACrC,aAAa,EAAE,OAAO,CAAC,CAAC,SAAS;CACjC,aAAa,EAAE,OAAO,CAAC,CAAC,SAAS;CACjC,kBAAkB,EAAE,OAAO,CAAC,CAAC,SAAS;CACtC,cAAc,EAAE,OAAO,CAAC,CAAC,SAAS;CAClC,qBAAqB,EAAE,OAAO,CAAC,CAAC,SAAS;CACzC,WAAW,EAAE,OAAO,CAAC,CAAC,SAAS;CAC/B,gBAAgB,EAAE,OAAO,CAAC,CAAC,SAAS;CACpC,cAAc,EAAE,OAAO,CAAC,CAAC,SAAS;CAClC,QAAQ,EAAE,OAAO,CAAC,CAAC,SAAS;CAE5B,mBAAmB,EAAE,QAAQ,CAAC,CAAC,SAAS;CAExC,SAAS,EAAE,OAAO,CAAC,CAAC,SAAS;CAE7B,wBAAwB,EAAE,QAAQ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SAAS;EACjC,CAAC,CAAC,CACD,SAAS;CACd,CAAC,CAAC,CACD,SAAS;AACd,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export type ThinkingLevelSetting = 'off' | 'low' | 'medium' | 'high' | 'xhigh' | 'max';
|
|
2
|
+
export type ThinkingLevelSource = 'mode-default' | 'global';
|
|
3
|
+
export interface ThinkingDefaults {
|
|
4
|
+
globalDefault: ThinkingLevelSetting;
|
|
5
|
+
modeDefaults: Readonly<Record<string, ThinkingLevelSetting>>;
|
|
6
|
+
}
|
|
7
|
+
export declare const THINKING_LEVEL_VALUES: ThinkingLevelSetting[];
|
|
8
|
+
export declare const THINK_COMMAND_DESCRIPTOR: {
|
|
9
|
+
name: string;
|
|
10
|
+
args: string;
|
|
11
|
+
description: string;
|
|
12
|
+
};
|
|
13
|
+
export type ThinkCommandAction = {
|
|
14
|
+
kind: 'status';
|
|
15
|
+
} | {
|
|
16
|
+
kind: 'clear';
|
|
17
|
+
} | {
|
|
18
|
+
kind: 'set';
|
|
19
|
+
level: ThinkingLevelSetting;
|
|
20
|
+
} | {
|
|
21
|
+
kind: 'invalid';
|
|
22
|
+
value: string;
|
|
23
|
+
levels: readonly ThinkingLevelSetting[];
|
|
24
|
+
};
|
|
25
|
+
export declare function isThinkingLevelSetting(value: unknown): value is ThinkingLevelSetting;
|
|
26
|
+
export declare function supportsMaxReasoningEffort(modelId: string): boolean;
|
|
27
|
+
export declare function getAvailableThinkingLevelsForModel(modelId: string): ThinkingLevelSetting[];
|
|
28
|
+
export declare function parseThinkCommand(input: string, levels?: readonly ThinkingLevelSetting[]): ThinkCommandAction;
|
|
29
|
+
export declare function resolveDefaultThinkingLevel(defaults: ThinkingDefaults, mode?: string | null): {
|
|
30
|
+
level: ThinkingLevelSetting;
|
|
31
|
+
source: ThinkingLevelSource;
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=thinking.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,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oB,CAAC;IAAC,MAAM,EAAE,mBAAmB,CAAA;CAAE,CAG9D"}
|
package/dist/thinking.js
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
//#region src/thinking.ts
|
|
2
|
+
const THINKING_LEVEL_VALUES = [
|
|
3
|
+
"off",
|
|
4
|
+
"low",
|
|
5
|
+
"medium",
|
|
6
|
+
"high",
|
|
7
|
+
"xhigh",
|
|
8
|
+
"max"
|
|
9
|
+
];
|
|
10
|
+
const THINK_COMMAND_DESCRIPTOR = {
|
|
11
|
+
name: "think",
|
|
12
|
+
args: "[status|default|off|low|medium|high|xhigh|max]",
|
|
13
|
+
description: "Show or set session thinking level"
|
|
14
|
+
};
|
|
15
|
+
const GPT_VERSION_RE = /^gpt-(\d+)(?:\.(\d+))?/;
|
|
16
|
+
function isThinkingLevelSetting(value) {
|
|
17
|
+
return typeof value === "string" && THINKING_LEVEL_VALUES.some((level) => level === value);
|
|
18
|
+
}
|
|
19
|
+
function supportsMaxReasoningEffort(modelId) {
|
|
20
|
+
const bareModelId = modelId.startsWith("openai/") ? modelId.slice(7) : modelId;
|
|
21
|
+
const match = GPT_VERSION_RE.exec(bareModelId);
|
|
22
|
+
if (!match) return false;
|
|
23
|
+
const major = Number(match[1]);
|
|
24
|
+
const minor = Number(match[2] ?? 0);
|
|
25
|
+
return major > 5 || major === 5 && minor >= 6;
|
|
26
|
+
}
|
|
27
|
+
function getAvailableThinkingLevelsForModel(modelId) {
|
|
28
|
+
if (!modelId.startsWith("openai/") || supportsMaxReasoningEffort(modelId)) return [...THINKING_LEVEL_VALUES];
|
|
29
|
+
return THINKING_LEVEL_VALUES.filter((level) => level !== "max");
|
|
30
|
+
}
|
|
31
|
+
function parseThinkCommand(input, levels = THINKING_LEVEL_VALUES) {
|
|
32
|
+
const value = input.trim().toLowerCase();
|
|
33
|
+
if (!value || value === "status") return { kind: "status" };
|
|
34
|
+
if (value === "default" || value === "clear") return { kind: "clear" };
|
|
35
|
+
const level = levels.find((candidate) => candidate === value);
|
|
36
|
+
return level ? {
|
|
37
|
+
kind: "set",
|
|
38
|
+
level
|
|
39
|
+
} : {
|
|
40
|
+
kind: "invalid",
|
|
41
|
+
value,
|
|
42
|
+
levels
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
function resolveDefaultThinkingLevel(defaults, mode) {
|
|
46
|
+
const modeLevel = mode ? defaults.modeDefaults[mode] : void 0;
|
|
47
|
+
return modeLevel ? {
|
|
48
|
+
level: modeLevel,
|
|
49
|
+
source: "mode-default"
|
|
50
|
+
} : {
|
|
51
|
+
level: defaults.globalDefault,
|
|
52
|
+
source: "global"
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
//#endregion
|
|
56
|
+
export { THINKING_LEVEL_VALUES, THINK_COMMAND_DESCRIPTOR, getAvailableThinkingLevelsForModel, isThinkingLevelSetting, parseThinkCommand, resolveDefaultThinkingLevel, supportsMaxReasoningEffort };
|
|
57
|
+
|
|
58
|
+
//# sourceMappingURL=thinking.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"thinking.js","names":[],"sources":["../src/thinking.ts"],"sourcesContent":["export type ThinkingLevelSetting = 'off' | 'low' | 'medium' | 'high' | 'xhigh' | 'max';\n\nexport type ThinkingLevelSource = 'mode-default' | 'global';\n\nexport interface ThinkingDefaults {\n globalDefault: ThinkingLevelSetting;\n modeDefaults: Readonly<Record<string, ThinkingLevelSetting>>;\n}\n\nexport const THINKING_LEVEL_VALUES: ThinkingLevelSetting[] = ['off', 'low', 'medium', 'high', 'xhigh', 'max'];\n\nexport const THINK_COMMAND_DESCRIPTOR = {\n name: 'think',\n args: '[status|default|off|low|medium|high|xhigh|max]',\n description: 'Show or set session thinking level',\n};\n\nexport type ThinkCommandAction =\n | { kind: 'status' }\n | { kind: 'clear' }\n | { kind: 'set'; level: ThinkingLevelSetting }\n | { kind: 'invalid'; value: string; levels: readonly ThinkingLevelSetting[] };\n\nconst GPT_VERSION_RE = /^gpt-(\\d+)(?:\\.(\\d+))?/;\n\nexport function isThinkingLevelSetting(value: unknown): value is ThinkingLevelSetting {\n return typeof value === 'string' && THINKING_LEVEL_VALUES.some(level => level === value);\n}\n\nexport function supportsMaxReasoningEffort(modelId: string): boolean {\n const bareModelId = modelId.startsWith('openai/') ? modelId.slice('openai/'.length) : modelId;\n const match = GPT_VERSION_RE.exec(bareModelId);\n if (!match) return false;\n const major = Number(match[1]);\n const minor = Number(match[2] ?? 0);\n return major > 5 || (major === 5 && minor >= 6);\n}\n\nexport function getAvailableThinkingLevelsForModel(modelId: string): ThinkingLevelSetting[] {\n if (!modelId.startsWith('openai/') || supportsMaxReasoningEffort(modelId)) {\n return [...THINKING_LEVEL_VALUES];\n }\n return THINKING_LEVEL_VALUES.filter(level => level !== 'max');\n}\n\nexport function parseThinkCommand(\n input: string,\n levels: readonly ThinkingLevelSetting[] = THINKING_LEVEL_VALUES,\n): ThinkCommandAction {\n const value = input.trim().toLowerCase();\n if (!value || value === 'status') return { kind: 'status' };\n if (value === 'default' || value === 'clear') return { kind: 'clear' };\n const level = levels.find(candidate => candidate === value);\n return level ? { kind: 'set', level } : { kind: 'invalid', value, levels };\n}\n\nexport function resolveDefaultThinkingLevel(\n defaults: ThinkingDefaults,\n mode?: string | null,\n): { level: ThinkingLevelSetting; source: ThinkingLevelSource } {\n const modeLevel = mode ? defaults.modeDefaults[mode] : undefined;\n return modeLevel ? { level: modeLevel, source: 'mode-default' } : { level: defaults.globalDefault, source: 'global' };\n}\n"],"mappings":";AASA,MAAa,wBAAgD;CAAC;CAAO;CAAO;CAAU;CAAQ;CAAS;AAAK;AAE5G,MAAa,2BAA2B;CACtC,MAAM;CACN,MAAM;CACN,aAAa;AACf;AAQA,MAAM,iBAAiB;AAEvB,SAAgB,uBAAuB,OAA+C;CACpF,OAAO,OAAO,UAAU,YAAY,sBAAsB,MAAK,UAAS,UAAU,KAAK;AACzF;AAEA,SAAgB,2BAA2B,SAA0B;CACnE,MAAM,cAAc,QAAQ,WAAW,SAAS,IAAI,QAAQ,MAAM,CAAgB,IAAI;CACtF,MAAM,QAAQ,eAAe,KAAK,WAAW;CAC7C,IAAI,CAAC,OAAO,OAAO;CACnB,MAAM,QAAQ,OAAO,MAAM,EAAE;CAC7B,MAAM,QAAQ,OAAO,MAAM,MAAM,CAAC;CAClC,OAAO,QAAQ,KAAM,UAAU,KAAK,SAAS;AAC/C;AAEA,SAAgB,mCAAmC,SAAyC;CAC1F,IAAI,CAAC,QAAQ,WAAW,SAAS,KAAK,2BAA2B,OAAO,GACtE,OAAO,CAAC,GAAG,qBAAqB;CAElC,OAAO,sBAAsB,QAAO,UAAS,UAAU,KAAK;AAC9D;AAEA,SAAgB,kBACd,OACA,SAA0C,uBACtB;CACpB,MAAM,QAAQ,MAAM,KAAK,CAAC,CAAC,YAAY;CACvC,IAAI,CAAC,SAAS,UAAU,UAAU,OAAO,EAAE,MAAM,SAAS;CAC1D,IAAI,UAAU,aAAa,UAAU,SAAS,OAAO,EAAE,MAAM,QAAQ;CACrE,MAAM,QAAQ,OAAO,MAAK,cAAa,cAAc,KAAK;CAC1D,OAAO,QAAQ;EAAE,MAAM;EAAO;CAAM,IAAI;EAAE,MAAM;EAAW;EAAO;CAAO;AAC3E;AAEA,SAAgB,4BACd,UACA,MAC8D;CAC9D,MAAM,YAAY,OAAO,SAAS,aAAa,QAAQ,KAAA;CACvD,OAAO,YAAY;EAAE,OAAO;EAAW,QAAQ;CAAe,IAAI;EAAE,OAAO,SAAS;EAAe,QAAQ;CAAS;AACtH"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { createWebExtractTool, createWebSearchTool, hasTavilyKey } from "../tools/web-search.js";
|
|
2
1
|
import { MC_TOOLS } from "../tool-names.js";
|
|
2
|
+
import { createWebExtractTool, createWebSearchTool, hasTavilyKey } from "../tools/web-search.js";
|
|
3
3
|
import { MASTRACODE_WORKSPACE_TOOLS } from "../agents/tool-availability.js";
|
|
4
4
|
import { LazyNotificationsStorage } from "../agents/tools.js";
|
|
5
5
|
import { workflowBuilderAgent } from "../agents/workflow-builder-agent.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/code-sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0-alpha.7",
|
|
4
4
|
"description": "Mastra Code SDK: the agent core behind Mastra Code (everything except the TUI) — build your own UIs and surfaces on top of it",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
@@ -58,18 +58,18 @@
|
|
|
58
58
|
"yaml": "^2.7.1",
|
|
59
59
|
"zod": "^4.3.6",
|
|
60
60
|
"@mastra/agent-browser": "0.5.1",
|
|
61
|
-
"@mastra/core": "1.62.0-alpha.
|
|
62
|
-
"@mastra/duckdb": "1.6.3-alpha.0",
|
|
61
|
+
"@mastra/core": "1.62.0-alpha.7",
|
|
63
62
|
"@mastra/github-signals": "0.2.5",
|
|
63
|
+
"@mastra/duckdb": "1.6.3-alpha.0",
|
|
64
64
|
"@mastra/fastembed": "1.2.0",
|
|
65
|
-
"@mastra/
|
|
66
|
-
"@mastra/
|
|
67
|
-
"@mastra/observability": "1.17.2-alpha.
|
|
68
|
-
"@mastra/
|
|
69
|
-
"@mastra/memory": "1.27.0",
|
|
65
|
+
"@mastra/mcp": "1.17.2-alpha.2",
|
|
66
|
+
"@mastra/memory": "1.28.0-alpha.2",
|
|
67
|
+
"@mastra/observability": "1.17.2-alpha.1",
|
|
68
|
+
"@mastra/libsql": "1.22.0-alpha.1",
|
|
70
69
|
"@mastra/stagehand": "0.3.3",
|
|
71
|
-
"@mastra/
|
|
72
|
-
"@mastra/
|
|
70
|
+
"@mastra/tavily": "1.1.1",
|
|
71
|
+
"@mastra/schema-compat": "1.3.7",
|
|
72
|
+
"@mastra/pg": "1.22.0-alpha.3"
|
|
73
73
|
},
|
|
74
74
|
"devDependencies": {
|
|
75
75
|
"@libsql/client": "^0.17.4",
|