@mastra/code-sdk 0.0.0-livekit-beta-v3-20260709031728
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/LICENSE.md +30 -0
- package/README.md +50 -0
- package/dist/acp/agent.d.ts +35 -0
- package/dist/acp/agent.d.ts.map +1 -0
- package/dist/acp/agent.js +173 -0
- package/dist/acp/agent.js.map +1 -0
- package/dist/acp/event-mapper.d.ts +22 -0
- package/dist/acp/event-mapper.d.ts.map +1 -0
- package/dist/acp/event-mapper.js +166 -0
- package/dist/acp/event-mapper.js.map +1 -0
- package/dist/acp/index.d.ts +8 -0
- package/dist/acp/index.d.ts.map +1 -0
- package/dist/acp/index.js +54 -0
- package/dist/acp/index.js.map +1 -0
- package/dist/acp/server.d.ts +7 -0
- package/dist/acp/server.d.ts.map +1 -0
- package/dist/acp/server.js +34 -0
- package/dist/acp/server.js.map +1 -0
- package/dist/acp.d.ts +2 -0
- package/dist/acp.d.ts.map +1 -0
- package/dist/acp.js +5 -0
- package/dist/acp.js.map +1 -0
- package/dist/agents/instructions.d.ts +6 -0
- package/dist/agents/instructions.d.ts.map +1 -0
- package/dist/agents/instructions.js +41 -0
- package/dist/agents/instructions.js.map +1 -0
- package/dist/agents/mastracode-gateway.d.ts +65 -0
- package/dist/agents/mastracode-gateway.d.ts.map +1 -0
- package/dist/agents/mastracode-gateway.js +442 -0
- package/dist/agents/mastracode-gateway.js.map +1 -0
- package/dist/agents/memory.d.ts +13 -0
- package/dist/agents/memory.d.ts.map +1 -0
- package/dist/agents/memory.js +107 -0
- package/dist/agents/memory.js.map +1 -0
- package/dist/agents/model.d.ts +55 -0
- package/dist/agents/model.d.ts.map +1 -0
- package/dist/agents/model.js +115 -0
- package/dist/agents/model.js.map +1 -0
- package/dist/agents/modes/build.d.ts +10 -0
- package/dist/agents/modes/build.d.ts.map +1 -0
- package/dist/agents/modes/build.js +45 -0
- package/dist/agents/modes/build.js.map +1 -0
- package/dist/agents/modes/explore.d.ts +10 -0
- package/dist/agents/modes/explore.d.ts.map +1 -0
- package/dist/agents/modes/explore.js +38 -0
- package/dist/agents/modes/explore.js.map +1 -0
- package/dist/agents/modes/plan.d.ts +6 -0
- package/dist/agents/modes/plan.d.ts.map +1 -0
- package/dist/agents/modes/plan.js +38 -0
- package/dist/agents/modes/plan.js.map +1 -0
- package/dist/agents/prompts/agent-instructions.d.ts +20 -0
- package/dist/agents/prompts/agent-instructions.d.ts.map +1 -0
- package/dist/agents/prompts/agent-instructions.js +82 -0
- package/dist/agents/prompts/agent-instructions.js.map +1 -0
- package/dist/agents/prompts/build.d.ts +12 -0
- package/dist/agents/prompts/build.d.ts.map +1 -0
- package/dist/agents/prompts/build.js +73 -0
- package/dist/agents/prompts/build.js.map +1 -0
- package/dist/agents/prompts/fast.d.ts +5 -0
- package/dist/agents/prompts/fast.d.ts.map +1 -0
- package/dist/agents/prompts/fast.js +22 -0
- package/dist/agents/prompts/fast.js.map +1 -0
- package/dist/agents/prompts/index.d.ts +19 -0
- package/dist/agents/prompts/index.d.ts.map +1 -0
- package/dist/agents/prompts/index.js +57 -0
- package/dist/agents/prompts/index.js.map +1 -0
- package/dist/agents/prompts/model.d.ts +5 -0
- package/dist/agents/prompts/model.d.ts.map +1 -0
- package/dist/agents/prompts/model.js +22 -0
- package/dist/agents/prompts/model.js.map +1 -0
- package/dist/agents/prompts/plan.d.ts +6 -0
- package/dist/agents/prompts/plan.d.ts.map +1 -0
- package/dist/agents/prompts/plan.js +107 -0
- package/dist/agents/prompts/plan.js.map +1 -0
- package/dist/agents/prompts/tool-guidance.d.ts +13 -0
- package/dist/agents/prompts/tool-guidance.d.ts.map +1 -0
- package/dist/agents/prompts/tool-guidance.js +181 -0
- package/dist/agents/prompts/tool-guidance.js.map +1 -0
- package/dist/agents/sandbox-filesystem.d.ts +89 -0
- package/dist/agents/sandbox-filesystem.d.ts.map +1 -0
- package/dist/agents/sandbox-filesystem.js +268 -0
- package/dist/agents/sandbox-filesystem.js.map +1 -0
- package/dist/agents/sandbox-reattach.d.ts +19 -0
- package/dist/agents/sandbox-reattach.d.ts.map +1 -0
- package/dist/agents/sandbox-reattach.js +17 -0
- package/dist/agents/sandbox-reattach.js.map +1 -0
- package/dist/agents/thread-caveman-state.d.ts +17 -0
- package/dist/agents/thread-caveman-state.d.ts.map +1 -0
- package/dist/agents/thread-caveman-state.js +96 -0
- package/dist/agents/thread-caveman-state.js.map +1 -0
- package/dist/agents/tool-availability.d.ts +10 -0
- package/dist/agents/tool-availability.d.ts.map +1 -0
- package/dist/agents/tool-availability.js +105 -0
- package/dist/agents/tool-availability.js.map +1 -0
- package/dist/agents/tools.d.ts +18 -0
- package/dist/agents/tools.d.ts.map +1 -0
- package/dist/agents/tools.js +126 -0
- package/dist/agents/tools.js.map +1 -0
- package/dist/agents/workspace.d.ts +22 -0
- package/dist/agents/workspace.d.ts.map +1 -0
- package/dist/agents/workspace.js +194 -0
- package/dist/agents/workspace.js.map +1 -0
- package/dist/analytics.d.ts +18 -0
- package/dist/analytics.d.ts.map +1 -0
- package/dist/analytics.js +152 -0
- package/dist/analytics.js.map +1 -0
- package/dist/auth/index.d.ts +9 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +11 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/auth/pkce.d.ts +13 -0
- package/dist/auth/pkce.d.ts.map +1 -0
- package/dist/auth/pkce.js +21 -0
- package/dist/auth/pkce.js.map +1 -0
- package/dist/auth/providers/anthropic.d.ts +17 -0
- package/dist/auth/providers/anthropic.d.ts.map +1 -0
- package/dist/auth/providers/anthropic.js +94 -0
- package/dist/auth/providers/anthropic.js.map +1 -0
- package/dist/auth/providers/github-copilot.d.ts +100 -0
- package/dist/auth/providers/github-copilot.d.ts.map +1 -0
- package/dist/auth/providers/github-copilot.js +302 -0
- package/dist/auth/providers/github-copilot.js.map +1 -0
- package/dist/auth/providers/openai-codex.d.ts +95 -0
- package/dist/auth/providers/openai-codex.d.ts.map +1 -0
- package/dist/auth/providers/openai-codex.js +527 -0
- package/dist/auth/providers/openai-codex.js.map +1 -0
- package/dist/auth/storage.d.ts +91 -0
- package/dist/auth/storage.d.ts.map +1 -0
- package/dist/auth/storage.js +187 -0
- package/dist/auth/storage.js.map +1 -0
- package/dist/auth/types.d.ts +68 -0
- package/dist/auth/types.d.ts.map +1 -0
- package/dist/auth/types.js +1 -0
- package/dist/auth/types.js.map +1 -0
- package/dist/clipboard/index.d.ts +26 -0
- package/dist/clipboard/index.d.ts.map +1 -0
- package/dist/clipboard/index.js +192 -0
- package/dist/clipboard/index.js.map +1 -0
- package/dist/constants.d.ts +10 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +23 -0
- package/dist/constants.js.map +1 -0
- package/dist/error-classification.d.ts +10 -0
- package/dist/error-classification.d.ts.map +1 -0
- package/dist/error-classification.js +14 -0
- package/dist/error-classification.js.map +1 -0
- package/dist/evals/context-builder.d.ts +41 -0
- package/dist/evals/context-builder.d.ts.map +1 -0
- package/dist/evals/context-builder.js +120 -0
- package/dist/evals/context-builder.js.map +1 -0
- package/dist/evals/index.d.ts +4 -0
- package/dist/evals/index.d.ts.map +1 -0
- package/dist/evals/index.js +8 -0
- package/dist/evals/index.js.map +1 -0
- package/dist/evals/scorers/classify-command.d.ts +31 -0
- package/dist/evals/scorers/classify-command.d.ts.map +1 -0
- package/dist/evals/scorers/classify-command.js +52 -0
- package/dist/evals/scorers/classify-command.js.map +1 -0
- package/dist/evals/scorers/efficiency.d.ts +44 -0
- package/dist/evals/scorers/efficiency.d.ts.map +1 -0
- package/dist/evals/scorers/efficiency.js +201 -0
- package/dist/evals/scorers/efficiency.js.map +1 -0
- package/dist/evals/scorers/extract-tools.d.ts +25 -0
- package/dist/evals/scorers/extract-tools.d.ts.map +1 -0
- package/dist/evals/scorers/extract-tools.js +56 -0
- package/dist/evals/scorers/extract-tools.js.map +1 -0
- package/dist/evals/scorers/index.d.ts +3 -0
- package/dist/evals/scorers/index.d.ts.map +1 -0
- package/dist/evals/scorers/index.js +7 -0
- package/dist/evals/scorers/index.js.map +1 -0
- package/dist/evals/scorers/outcome.d.ts +49 -0
- package/dist/evals/scorers/outcome.d.ts.map +1 -0
- package/dist/evals/scorers/outcome.js +238 -0
- package/dist/evals/scorers/outcome.js.map +1 -0
- package/dist/headless/cli.d.ts +42 -0
- package/dist/headless/cli.d.ts.map +1 -0
- package/dist/headless/cli.js +196 -0
- package/dist/headless/cli.js.map +1 -0
- package/dist/headless/flags.d.ts +33 -0
- package/dist/headless/flags.d.ts.map +1 -0
- package/dist/headless/flags.js +188 -0
- package/dist/headless/flags.js.map +1 -0
- package/dist/headless/format.d.ts +38 -0
- package/dist/headless/format.d.ts.map +1 -0
- package/dist/headless/format.js +85 -0
- package/dist/headless/format.js.map +1 -0
- package/dist/headless/index.d.ts +25 -0
- package/dist/headless/index.d.ts.map +1 -0
- package/dist/headless/index.js +32 -0
- package/dist/headless/index.js.map +1 -0
- package/dist/headless/policy.d.ts +17 -0
- package/dist/headless/policy.d.ts.map +1 -0
- package/dist/headless/policy.js +38 -0
- package/dist/headless/policy.js.map +1 -0
- package/dist/headless/run-mc.d.ts +7 -0
- package/dist/headless/run-mc.d.ts.map +1 -0
- package/dist/headless/run-mc.js +296 -0
- package/dist/headless/run-mc.js.map +1 -0
- package/dist/headless/types.d.ts +134 -0
- package/dist/headless/types.d.ts.map +1 -0
- package/dist/headless/types.js +9 -0
- package/dist/headless/types.js.map +1 -0
- package/dist/hooks/config.d.ts +11 -0
- package/dist/hooks/config.d.ts.map +1 -0
- package/dist/hooks/config.js +78 -0
- package/dist/hooks/config.js.map +1 -0
- package/dist/hooks/executor.d.ts +13 -0
- package/dist/hooks/executor.d.ts.map +1 -0
- package/dist/hooks/executor.js +125 -0
- package/dist/hooks/executor.js.map +1 -0
- package/dist/hooks/index.d.ts +6 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +16 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/hooks/manager.d.ts +47 -0
- package/dist/hooks/manager.d.ts.map +1 -0
- package/dist/hooks/manager.js +284 -0
- package/dist/hooks/manager.js.map +1 -0
- package/dist/hooks/types.d.ts +152 -0
- package/dist/hooks/types.d.ts.map +1 -0
- package/dist/hooks/types.js +7 -0
- package/dist/hooks/types.js.map +1 -0
- package/dist/index.d.ts +241 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +712 -0
- package/dist/index.js.map +1 -0
- package/dist/ipc/ipc-reporter.d.ts +14 -0
- package/dist/ipc/ipc-reporter.d.ts.map +1 -0
- package/dist/ipc/ipc-reporter.js +24 -0
- package/dist/ipc/ipc-reporter.js.map +1 -0
- package/dist/lsp/client.d.ts +56 -0
- package/dist/lsp/client.d.ts.map +1 -0
- package/dist/lsp/client.js +309 -0
- package/dist/lsp/client.js.map +1 -0
- package/dist/lsp/index.d.ts +4 -0
- package/dist/lsp/index.d.ts.map +1 -0
- package/dist/lsp/index.js +9 -0
- package/dist/lsp/index.js.map +1 -0
- package/dist/lsp/language.d.ts +9 -0
- package/dist/lsp/language.d.ts.map +1 -0
- package/dist/lsp/language.js +48 -0
- package/dist/lsp/language.js.map +1 -0
- package/dist/lsp/manager.d.ts +34 -0
- package/dist/lsp/manager.d.ts.map +1 -0
- package/dist/lsp/manager.js +97 -0
- package/dist/lsp/manager.js.map +1 -0
- package/dist/lsp/server.d.ts +27 -0
- package/dist/lsp/server.d.ts.map +1 -0
- package/dist/lsp/server.js +128 -0
- package/dist/lsp/server.js.map +1 -0
- package/dist/lsp/workspace.d.ts +9 -0
- package/dist/lsp/workspace.d.ts.map +1 -0
- package/dist/lsp/workspace.js +52 -0
- package/dist/lsp/workspace.js.map +1 -0
- package/dist/mcp/config.d.ts +34 -0
- package/dist/mcp/config.d.ts.map +1 -0
- package/dist/mcp/config.js +205 -0
- package/dist/mcp/config.js.map +1 -0
- package/dist/mcp/index.d.ts +5 -0
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/mcp/index.js +10 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/mcp/manager.d.ts +49 -0
- package/dist/mcp/manager.d.ts.map +1 -0
- package/dist/mcp/manager.js +374 -0
- package/dist/mcp/manager.js.map +1 -0
- package/dist/mcp/types.d.ts +85 -0
- package/dist/mcp/types.d.ts.map +1 -0
- package/dist/mcp/types.js +1 -0
- package/dist/mcp/types.js.map +1 -0
- package/dist/onboarding/custom-packs.d.ts +7 -0
- package/dist/onboarding/custom-packs.d.ts.map +1 -0
- package/dist/onboarding/custom-packs.js +20 -0
- package/dist/onboarding/custom-packs.js.map +1 -0
- package/dist/onboarding/custom-providers.d.ts +4 -0
- package/dist/onboarding/custom-providers.d.ts.map +1 -0
- package/dist/onboarding/custom-providers.js +28 -0
- package/dist/onboarding/custom-providers.js.map +1 -0
- package/dist/onboarding/index.d.ts +5 -0
- package/dist/onboarding/index.d.ts.map +1 -0
- package/dist/onboarding/index.js +21 -0
- package/dist/onboarding/index.js.map +1 -0
- package/dist/onboarding/om-settings.d.ts +20 -0
- package/dist/onboarding/om-settings.d.ts.map +1 -0
- package/dist/onboarding/om-settings.js +26 -0
- package/dist/onboarding/om-settings.js.map +1 -0
- package/dist/onboarding/packs.d.ts +48 -0
- package/dist/onboarding/packs.d.ts.map +1 -0
- package/dist/onboarding/packs.js +111 -0
- package/dist/onboarding/packs.js.map +1 -0
- package/dist/onboarding/settings.d.ts +323 -0
- package/dist/onboarding/settings.d.ts.map +1 -0
- package/dist/onboarding/settings.js +594 -0
- package/dist/onboarding/settings.js.map +1 -0
- package/dist/permissions.d.ts +55 -0
- package/dist/permissions.d.ts.map +1 -0
- package/dist/permissions.js +119 -0
- package/dist/permissions.js.map +1 -0
- package/dist/plugin.d.ts +81 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/plugin.js +30 -0
- package/dist/plugin.js.map +1 -0
- package/dist/plugins/dependencies.d.ts +9 -0
- package/dist/plugins/dependencies.d.ts.map +1 -0
- package/dist/plugins/dependencies.js +141 -0
- package/dist/plugins/dependencies.js.map +1 -0
- package/dist/plugins/install.d.ts +21 -0
- package/dist/plugins/install.d.ts.map +1 -0
- package/dist/plugins/install.js +200 -0
- package/dist/plugins/install.js.map +1 -0
- package/dist/plugins/loader.d.ts +15 -0
- package/dist/plugins/loader.d.ts.map +1 -0
- package/dist/plugins/loader.js +221 -0
- package/dist/plugins/loader.js.map +1 -0
- package/dist/plugins/manager.d.ts +60 -0
- package/dist/plugins/manager.d.ts.map +1 -0
- package/dist/plugins/manager.js +378 -0
- package/dist/plugins/manager.js.map +1 -0
- package/dist/plugins/manifest.d.ts +14 -0
- package/dist/plugins/manifest.d.ts.map +1 -0
- package/dist/plugins/manifest.js +75 -0
- package/dist/plugins/manifest.js.map +1 -0
- package/dist/plugins/package-link.d.ts +3 -0
- package/dist/plugins/package-link.d.ts.map +1 -0
- package/dist/plugins/package-link.js +77 -0
- package/dist/plugins/package-link.js.map +1 -0
- package/dist/plugins/paths.d.ts +10 -0
- package/dist/plugins/paths.d.ts.map +1 -0
- package/dist/plugins/paths.js +26 -0
- package/dist/plugins/paths.js.map +1 -0
- package/dist/plugins/registry.d.ts +8 -0
- package/dist/plugins/registry.d.ts.map +1 -0
- package/dist/plugins/registry.js +96 -0
- package/dist/plugins/registry.js.map +1 -0
- package/dist/plugins/scaffold.d.ts +10 -0
- package/dist/plugins/scaffold.d.ts.map +1 -0
- package/dist/plugins/scaffold.js +152 -0
- package/dist/plugins/scaffold.js.map +1 -0
- package/dist/plugins/types.d.ts +45 -0
- package/dist/plugins/types.d.ts.map +1 -0
- package/dist/plugins/types.js +1 -0
- package/dist/plugins/types.js.map +1 -0
- package/dist/processors/plan-rejection-abort.d.ts +12 -0
- package/dist/processors/plan-rejection-abort.d.ts.map +1 -0
- package/dist/processors/plan-rejection-abort.js +53 -0
- package/dist/processors/plan-rejection-abort.js.map +1 -0
- package/dist/providers/amazon-bedrock-gateway.d.ts +40 -0
- package/dist/providers/amazon-bedrock-gateway.d.ts.map +1 -0
- package/dist/providers/amazon-bedrock-gateway.js +79 -0
- package/dist/providers/amazon-bedrock-gateway.js.map +1 -0
- package/dist/providers/amazon-bedrock.d.ts +28 -0
- package/dist/providers/amazon-bedrock.d.ts.map +1 -0
- package/dist/providers/amazon-bedrock.js +62 -0
- package/dist/providers/amazon-bedrock.js.map +1 -0
- package/dist/providers/claude-max.d.ts +50 -0
- package/dist/providers/claude-max.d.ts.map +1 -0
- package/dist/providers/claude-max.js +151 -0
- package/dist/providers/claude-max.js.map +1 -0
- package/dist/providers/github-copilot.d.ts +58 -0
- package/dist/providers/github-copilot.d.ts.map +1 -0
- package/dist/providers/github-copilot.js +263 -0
- package/dist/providers/github-copilot.js.map +1 -0
- package/dist/providers/openai-codex.d.ts +70 -0
- package/dist/providers/openai-codex.d.ts.map +1 -0
- package/dist/providers/openai-codex.js +291 -0
- package/dist/providers/openai-codex.js.map +1 -0
- package/dist/schema.d.ts +167 -0
- package/dist/schema.d.ts.map +1 -0
- package/dist/schema.js +92 -0
- package/dist/schema.js.map +1 -0
- package/dist/theme-palette.d.ts +17 -0
- package/dist/theme-palette.d.ts.map +1 -0
- package/dist/theme-palette.js +17 -0
- package/dist/theme-palette.js.map +1 -0
- package/dist/tool-names.d.ts +73 -0
- package/dist/tool-names.d.ts.map +1 -0
- package/dist/tool-names.js +43 -0
- package/dist/tool-names.js.map +1 -0
- package/dist/tools/index.d.ts +6 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +9 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/request-sandbox-access.d.ts +6 -0
- package/dist/tools/request-sandbox-access.d.ts.map +1 -0
- package/dist/tools/request-sandbox-access.js +88 -0
- package/dist/tools/request-sandbox-access.js.map +1 -0
- package/dist/tools/utils.d.ts +20 -0
- package/dist/tools/utils.d.ts.map +1 -0
- package/dist/tools/utils.js +22 -0
- package/dist/tools/utils.js.map +1 -0
- package/dist/tools/web-search.d.ts +35 -0
- package/dist/tools/web-search.d.ts.map +1 -0
- package/dist/tools/web-search.js +65 -0
- package/dist/tools/web-search.js.map +1 -0
- package/dist/utils/binaries.d.ts +7 -0
- package/dist/utils/binaries.d.ts.map +1 -0
- package/dist/utils/binaries.js +74 -0
- package/dist/utils/binaries.js.map +1 -0
- package/dist/utils/debug-log.d.ts +12 -0
- package/dist/utils/debug-log.d.ts.map +1 -0
- package/dist/utils/debug-log.js +55 -0
- package/dist/utils/debug-log.js.map +1 -0
- package/dist/utils/errors.d.ts +36 -0
- package/dist/utils/errors.d.ts.map +1 -0
- package/dist/utils/errors.js +207 -0
- package/dist/utils/errors.js.map +1 -0
- package/dist/utils/gateway-sync.d.ts +26 -0
- package/dist/utils/gateway-sync.d.ts.map +1 -0
- package/dist/utils/gateway-sync.js +49 -0
- package/dist/utils/gateway-sync.js.map +1 -0
- package/dist/utils/plan-diff.d.ts +25 -0
- package/dist/utils/plan-diff.d.ts.map +1 -0
- package/dist/utils/plan-diff.js +43 -0
- package/dist/utils/plan-diff.js.map +1 -0
- package/dist/utils/plans.d.ts +56 -0
- package/dist/utils/plans.d.ts.map +1 -0
- package/dist/utils/plans.js +99 -0
- package/dist/utils/plans.js.map +1 -0
- package/dist/utils/project.d.ts +161 -0
- package/dist/utils/project.d.ts.map +1 -0
- package/dist/utils/project.js +302 -0
- package/dist/utils/project.js.map +1 -0
- package/dist/utils/signals-pubsub.d.ts +41 -0
- package/dist/utils/signals-pubsub.d.ts.map +1 -0
- package/dist/utils/signals-pubsub.js +104 -0
- package/dist/utils/signals-pubsub.js.map +1 -0
- package/dist/utils/slash-command-loader.d.ts +48 -0
- package/dist/utils/slash-command-loader.d.ts.map +1 -0
- package/dist/utils/slash-command-loader.js +155 -0
- package/dist/utils/slash-command-loader.js.map +1 -0
- package/dist/utils/slash-command-processor.d.ts +14 -0
- package/dist/utils/slash-command-processor.d.ts.map +1 -0
- package/dist/utils/slash-command-processor.js +96 -0
- package/dist/utils/slash-command-processor.js.map +1 -0
- package/dist/utils/stdin-pipe.d.ts +33 -0
- package/dist/utils/stdin-pipe.d.ts.map +1 -0
- package/dist/utils/stdin-pipe.js +72 -0
- package/dist/utils/stdin-pipe.js.map +1 -0
- package/dist/utils/storage-factory.d.ts +50 -0
- package/dist/utils/storage-factory.d.ts.map +1 -0
- package/dist/utils/storage-factory.js +98 -0
- package/dist/utils/storage-factory.js.map +1 -0
- package/dist/utils/thread-lock.d.ts +26 -0
- package/dist/utils/thread-lock.d.ts.map +1 -0
- package/dist/utils/thread-lock.js +108 -0
- package/dist/utils/thread-lock.js.map +1 -0
- package/dist/utils/token-estimator.d.ts +3 -0
- package/dist/utils/token-estimator.d.ts.map +1 -0
- package/dist/utils/token-estimator.js +21 -0
- package/dist/utils/token-estimator.js.map +1 -0
- package/dist/utils/update-check.d.ts +52 -0
- package/dist/utils/update-check.d.ts.map +1 -0
- package/dist/utils/update-check.js +177 -0
- package/dist/utils/update-check.js.map +1 -0
- package/dist/voice/stt-registry.d.ts +64 -0
- package/dist/voice/stt-registry.d.ts.map +1 -0
- package/dist/voice/stt-registry.js +126 -0
- package/dist/voice/stt-registry.js.map +1 -0
- package/package.json +92 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Load project and global agent instruction files (AGENTS.md, CLAUDE.md).
|
|
3
|
+
* Prefers AGENTS.md over CLAUDE.md when multiple exist at the same location.
|
|
4
|
+
*/
|
|
5
|
+
export interface InstructionSource {
|
|
6
|
+
path: string;
|
|
7
|
+
content: string;
|
|
8
|
+
scope: 'global' | 'project';
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Load all agent instruction files from global and project locations.
|
|
12
|
+
* Returns an array of instruction sources, with global ones first.
|
|
13
|
+
*/
|
|
14
|
+
export declare function loadAgentInstructions(projectPath: string, configDirName?: string): InstructionSource[];
|
|
15
|
+
export declare function getStaticallyLoadedInstructionPaths(projectPath: string): string[];
|
|
16
|
+
/**
|
|
17
|
+
* Format loaded instructions into a string for the system prompt.
|
|
18
|
+
*/
|
|
19
|
+
export declare function formatAgentInstructions(sources: InstructionSource[]): string;
|
|
20
|
+
//# sourceMappingURL=agent-instructions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-instructions.d.ts","sourceRoot":"","sources":["../../../src/agents/prompts/agent-instructions.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAmBH,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,QAAQ,GAAG,SAAS,CAAC;CAC7B;AAgBD;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,WAAW,EAAE,MAAM,EAAE,aAAa,SAAqB,GAAG,iBAAiB,EAAE,CAiDlH;AAED,wBAAgB,mCAAmC,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,EAAE,CAEjF;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,iBAAiB,EAAE,GAAG,MAAM,CAS5E"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
2
|
+
import { homedir } from "node:os";
|
|
3
|
+
import { join, normalize } from "node:path";
|
|
4
|
+
import { DEFAULT_CONFIG_DIR } from "../../constants.js";
|
|
5
|
+
const INSTRUCTION_FILES = ["AGENTS.md", "CLAUDE.md"];
|
|
6
|
+
const PROJECT_LOCATIONS = [
|
|
7
|
+
"",
|
|
8
|
+
// project root
|
|
9
|
+
".claude",
|
|
10
|
+
".mastracode"
|
|
11
|
+
];
|
|
12
|
+
const GLOBAL_LOCATIONS = [".claude", ".mastracode", ".config/claude", ".config/mastracode"];
|
|
13
|
+
function findInstructionFile(basePath) {
|
|
14
|
+
for (const filename of INSTRUCTION_FILES) {
|
|
15
|
+
const fullPath = join(basePath, filename);
|
|
16
|
+
if (existsSync(fullPath)) {
|
|
17
|
+
return fullPath;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
function loadAgentInstructions(projectPath, configDirName = DEFAULT_CONFIG_DIR) {
|
|
23
|
+
const sources = [];
|
|
24
|
+
const home = homedir();
|
|
25
|
+
const projectLocations = PROJECT_LOCATIONS.map((loc) => loc === ".mastracode" ? configDirName : loc);
|
|
26
|
+
const globalLocations = GLOBAL_LOCATIONS.map((loc) => {
|
|
27
|
+
if (loc === ".mastracode") return configDirName;
|
|
28
|
+
if (loc === ".config/mastracode") return ".config/" + configDirName.replace(/^\./, "");
|
|
29
|
+
return loc;
|
|
30
|
+
});
|
|
31
|
+
for (const location of globalLocations) {
|
|
32
|
+
const basePath = join(home, location);
|
|
33
|
+
const filePath = findInstructionFile(basePath);
|
|
34
|
+
if (filePath) {
|
|
35
|
+
try {
|
|
36
|
+
const content = readFileSync(filePath, "utf-8").trim();
|
|
37
|
+
if (content) {
|
|
38
|
+
sources.push({ path: filePath, content, scope: "global" });
|
|
39
|
+
break;
|
|
40
|
+
}
|
|
41
|
+
} catch {
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
for (const location of projectLocations) {
|
|
46
|
+
const basePath = location ? join(projectPath, location) : projectPath;
|
|
47
|
+
const filePath = findInstructionFile(basePath);
|
|
48
|
+
if (filePath) {
|
|
49
|
+
try {
|
|
50
|
+
const content = readFileSync(filePath, "utf-8").trim();
|
|
51
|
+
if (content) {
|
|
52
|
+
sources.push({ path: filePath, content, scope: "project" });
|
|
53
|
+
break;
|
|
54
|
+
}
|
|
55
|
+
} catch {
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return sources;
|
|
60
|
+
}
|
|
61
|
+
function getStaticallyLoadedInstructionPaths(projectPath) {
|
|
62
|
+
return loadAgentInstructions(projectPath).map((source) => normalize(source.path));
|
|
63
|
+
}
|
|
64
|
+
function formatAgentInstructions(sources) {
|
|
65
|
+
if (sources.length === 0) return "";
|
|
66
|
+
const sections = sources.map((source) => {
|
|
67
|
+
const label = source.scope === "global" ? "Global" : "Project";
|
|
68
|
+
return `<!-- ${label} instructions from ${source.path} -->
|
|
69
|
+
${source.content}`;
|
|
70
|
+
});
|
|
71
|
+
return `
|
|
72
|
+
# Agent Instructions
|
|
73
|
+
|
|
74
|
+
${sections.join("\n\n")}
|
|
75
|
+
`;
|
|
76
|
+
}
|
|
77
|
+
export {
|
|
78
|
+
formatAgentInstructions,
|
|
79
|
+
getStaticallyLoadedInstructionPaths,
|
|
80
|
+
loadAgentInstructions
|
|
81
|
+
};
|
|
82
|
+
//# sourceMappingURL=agent-instructions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/agents/prompts/agent-instructions.ts"],"sourcesContent":["/**\n * Load project and global agent instruction files (AGENTS.md, CLAUDE.md).\n * Prefers AGENTS.md over CLAUDE.md when multiple exist at the same location.\n */\n\nimport { existsSync, readFileSync } from 'node:fs';\nimport { homedir } from 'node:os';\nimport { join, normalize } from 'node:path';\nimport { DEFAULT_CONFIG_DIR } from '../../constants.js';\n\n// Filenames to check, in order of preference\nconst INSTRUCTION_FILES = ['AGENTS.md', 'CLAUDE.md'];\n\n// Locations to scan (relative to project root or home)\nconst PROJECT_LOCATIONS = [\n '', // project root\n '.claude',\n '.mastracode',\n];\n\nconst GLOBAL_LOCATIONS = ['.claude', '.mastracode', '.config/claude', '.config/mastracode'];\n\nexport interface InstructionSource {\n path: string;\n content: string;\n scope: 'global' | 'project';\n}\n\n/**\n * Find the first existing instruction file at a given base path.\n * Prefers AGENTS.md over CLAUDE.md.\n */\nfunction findInstructionFile(basePath: string): string | null {\n for (const filename of INSTRUCTION_FILES) {\n const fullPath = join(basePath, filename);\n if (existsSync(fullPath)) {\n return fullPath;\n }\n }\n return null;\n}\n\n/**\n * Load all agent instruction files from global and project locations.\n * Returns an array of instruction sources, with global ones first.\n */\nexport function loadAgentInstructions(projectPath: string, configDirName = DEFAULT_CONFIG_DIR): InstructionSource[] {\n const sources: InstructionSource[] = [];\n const home = homedir();\n\n // Derive location arrays from the base constants, substituting the config dir name\n const projectLocations = PROJECT_LOCATIONS.map(loc => (loc === '.mastracode' ? configDirName : loc));\n const globalLocations = GLOBAL_LOCATIONS.map(loc => {\n if (loc === '.mastracode') return configDirName;\n // XDG-style path (~/.config/<name>): strip the leading dot since the\n // .config/ prefix already signals a hidden/config directory.\n if (loc === '.config/mastracode') return '.config/' + configDirName.replace(/^\\./, '');\n return loc;\n });\n\n // Load global instructions first\n for (const location of globalLocations) {\n const basePath = join(home, location);\n const filePath = findInstructionFile(basePath);\n if (filePath) {\n try {\n const content = readFileSync(filePath, 'utf-8').trim();\n if (content) {\n sources.push({ path: filePath, content, scope: 'global' });\n break; // Only use first found global instruction file\n }\n } catch {\n // Skip unreadable files\n }\n }\n }\n\n // Load project instructions\n for (const location of projectLocations) {\n const basePath = location ? join(projectPath, location) : projectPath;\n const filePath = findInstructionFile(basePath);\n if (filePath) {\n try {\n const content = readFileSync(filePath, 'utf-8').trim();\n if (content) {\n sources.push({ path: filePath, content, scope: 'project' });\n break; // Only use first found project instruction file\n }\n } catch {\n // Skip unreadable files\n }\n }\n }\n\n return sources;\n}\n\nexport function getStaticallyLoadedInstructionPaths(projectPath: string): string[] {\n return loadAgentInstructions(projectPath).map(source => normalize(source.path));\n}\n\n/**\n * Format loaded instructions into a string for the system prompt.\n */\nexport function formatAgentInstructions(sources: InstructionSource[]): string {\n if (sources.length === 0) return '';\n\n const sections = sources.map(source => {\n const label = source.scope === 'global' ? 'Global' : 'Project';\n return `<!-- ${label} instructions from ${source.path} -->\\n${source.content}`;\n });\n\n return `\\n# Agent Instructions\\n\\n${sections.join('\\n\\n')}\\n`;\n}\n"],"mappings":"AAKA,SAAS,YAAY,oBAAoB;AACzC,SAAS,eAAe;AACxB,SAAS,MAAM,iBAAiB;AAChC,SAAS,0BAA0B;AAGnC,MAAM,oBAAoB,CAAC,aAAa,WAAW;AAGnD,MAAM,oBAAoB;AAAA,EACxB;AAAA;AAAA,EACA;AAAA,EACA;AACF;AAEA,MAAM,mBAAmB,CAAC,WAAW,eAAe,kBAAkB,oBAAoB;AAY1F,SAAS,oBAAoB,UAAiC;AAC5D,aAAW,YAAY,mBAAmB;AACxC,UAAM,WAAW,KAAK,UAAU,QAAQ;AACxC,QAAI,WAAW,QAAQ,GAAG;AACxB,aAAO;AAAA,IACT;AAAA,EACF;AACA,SAAO;AACT;AAMO,SAAS,sBAAsB,aAAqB,gBAAgB,oBAAyC;AAClH,QAAM,UAA+B,CAAC;AACtC,QAAM,OAAO,QAAQ;AAGrB,QAAM,mBAAmB,kBAAkB,IAAI,SAAQ,QAAQ,gBAAgB,gBAAgB,GAAI;AACnG,QAAM,kBAAkB,iBAAiB,IAAI,SAAO;AAClD,QAAI,QAAQ,cAAe,QAAO;AAGlC,QAAI,QAAQ,qBAAsB,QAAO,aAAa,cAAc,QAAQ,OAAO,EAAE;AACrF,WAAO;AAAA,EACT,CAAC;AAGD,aAAW,YAAY,iBAAiB;AACtC,UAAM,WAAW,KAAK,MAAM,QAAQ;AACpC,UAAM,WAAW,oBAAoB,QAAQ;AAC7C,QAAI,UAAU;AACZ,UAAI;AACF,cAAM,UAAU,aAAa,UAAU,OAAO,EAAE,KAAK;AACrD,YAAI,SAAS;AACX,kBAAQ,KAAK,EAAE,MAAM,UAAU,SAAS,OAAO,SAAS,CAAC;AACzD;AAAA,QACF;AAAA,MACF,QAAQ;AAAA,MAER;AAAA,IACF;AAAA,EACF;AAGA,aAAW,YAAY,kBAAkB;AACvC,UAAM,WAAW,WAAW,KAAK,aAAa,QAAQ,IAAI;AAC1D,UAAM,WAAW,oBAAoB,QAAQ;AAC7C,QAAI,UAAU;AACZ,UAAI;AACF,cAAM,UAAU,aAAa,UAAU,OAAO,EAAE,KAAK;AACrD,YAAI,SAAS;AACX,kBAAQ,KAAK,EAAE,MAAM,UAAU,SAAS,OAAO,UAAU,CAAC;AAC1D;AAAA,QACF;AAAA,MACF,QAAQ;AAAA,MAER;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AACT;AAEO,SAAS,oCAAoC,aAA+B;AACjF,SAAO,sBAAsB,WAAW,EAAE,IAAI,YAAU,UAAU,OAAO,IAAI,CAAC;AAChF;AAKO,SAAS,wBAAwB,SAAsC;AAC5E,MAAI,QAAQ,WAAW,EAAG,QAAO;AAEjC,QAAM,WAAW,QAAQ,IAAI,YAAU;AACrC,UAAM,QAAQ,OAAO,UAAU,WAAW,WAAW;AACrD,WAAO,QAAQ,KAAK,sBAAsB,OAAO,IAAI;AAAA,EAAS,OAAO,OAAO;AAAA,EAC9E,CAAC;AAED,SAAO;AAAA;AAAA;AAAA,EAA6B,SAAS,KAAK,MAAM,CAAC;AAAA;AAC3D;","names":[]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Build mode prompt — full tool access, make changes and verify.
|
|
3
|
+
*/
|
|
4
|
+
import type { PromptContext } from './index.js';
|
|
5
|
+
/**
|
|
6
|
+
* Dynamic build mode prompt function.
|
|
7
|
+
* When an approved plan exists in state, prepends it so the agent
|
|
8
|
+
* knows exactly what to implement.
|
|
9
|
+
*/
|
|
10
|
+
export declare function buildModePromptFn(ctx: PromptContext): string;
|
|
11
|
+
export declare const buildModePrompt = "\n# Build Mode\n\nYou are in BUILD mode. You have full access to all tools and can read, write, edit, and execute commands.\n\n## Working Style\n\n**For simple tasks** (typo fixes, small edits, single-file changes):\n- Just do it. No need to explain your plan first.\n\n**For non-trivial tasks** (3+ files, architectural decisions, unclear requirements):\n- Use the available task-management tools to create and update your task list\n- Work on ONE step at a time \u2014 complete it and verify it works before moving on\n- If multiple approaches are plausible and the choice would materially affect scope, behavior, or risk, stop and ask the user\n\n## The Implementation Loop\n\nFor each change you make:\n\n1. **Understand** \u2014 Read the relevant code. Check how similar things are done elsewhere.\n2. **Implement** \u2014 Make the change. Follow existing patterns and conventions.\n3. **Verify** \u2014 Test that it works. Don't assume \u2014 actually run it.\n4. **Prove** \u2014 Proactively prove that the change is good, makes sense in context, is a positive contribution, and works fully. The burden of proof is on YOU.\n5. **Clean up** \u2014 Ensure no broken code, no debug statements, no half-done features.\n\nOnly move to the next change after the current one is verified and proved to be working.\n\n## Verification is Required\n\nBefore considering any task complete:\n- Run relevant tests (check package.json for test scripts)\n- For TypeScript, run `tsc --noEmit` to catch type errors\n- If there are no automated tests, manually verify the behavior works as expected\n- Confirm the result makes sense in the codebase and improves the requested behavior\n- Use available task-checking tools to ensure all tracked tasks are done\n\n**Don't mark something as done until you've verified and proved it actually works.**\n\n## Error Recovery\n\nWhen something breaks:\n1. Read the full error output carefully \u2014 don't guess\n2. Find the root cause, not just the symptom\n3. Fix it properly \u2014 no casts or suppressions to hide errors\n4. Re-run to confirm the fix\n5. If progress is blocked after reasonable attempts, briefly explain the blocker, what you've tried, and the next best option\n\n## Git in Build Mode\n\n- Before committing, verify the code compiles and passes lint\n- Use descriptive branch names: `feat/...`, `fix/...`, `refactor/...`\n";
|
|
12
|
+
//# sourceMappingURL=build.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../../src/agents/prompts/build.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,aAAa,GAAG,MAAM,CAiB5D;AAED,eAAO,MAAM,eAAe,00EAmD3B,CAAC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
function buildModePromptFn(ctx) {
|
|
2
|
+
if (ctx.activePlan) {
|
|
3
|
+
return `# Approved Plan
|
|
4
|
+
|
|
5
|
+
**${ctx.activePlan.title}**
|
|
6
|
+
|
|
7
|
+
${ctx.activePlan.plan}
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
Implement the approved plan above. Follow the steps in order and verify each step works before moving on.
|
|
12
|
+
|
|
13
|
+
` + buildModePrompt;
|
|
14
|
+
}
|
|
15
|
+
return buildModePrompt;
|
|
16
|
+
}
|
|
17
|
+
const buildModePrompt = `
|
|
18
|
+
# Build Mode
|
|
19
|
+
|
|
20
|
+
You are in BUILD mode. You have full access to all tools and can read, write, edit, and execute commands.
|
|
21
|
+
|
|
22
|
+
## Working Style
|
|
23
|
+
|
|
24
|
+
**For simple tasks** (typo fixes, small edits, single-file changes):
|
|
25
|
+
- Just do it. No need to explain your plan first.
|
|
26
|
+
|
|
27
|
+
**For non-trivial tasks** (3+ files, architectural decisions, unclear requirements):
|
|
28
|
+
- Use the available task-management tools to create and update your task list
|
|
29
|
+
- Work on ONE step at a time \u2014 complete it and verify it works before moving on
|
|
30
|
+
- If multiple approaches are plausible and the choice would materially affect scope, behavior, or risk, stop and ask the user
|
|
31
|
+
|
|
32
|
+
## The Implementation Loop
|
|
33
|
+
|
|
34
|
+
For each change you make:
|
|
35
|
+
|
|
36
|
+
1. **Understand** \u2014 Read the relevant code. Check how similar things are done elsewhere.
|
|
37
|
+
2. **Implement** \u2014 Make the change. Follow existing patterns and conventions.
|
|
38
|
+
3. **Verify** \u2014 Test that it works. Don't assume \u2014 actually run it.
|
|
39
|
+
4. **Prove** \u2014 Proactively prove that the change is good, makes sense in context, is a positive contribution, and works fully. The burden of proof is on YOU.
|
|
40
|
+
5. **Clean up** \u2014 Ensure no broken code, no debug statements, no half-done features.
|
|
41
|
+
|
|
42
|
+
Only move to the next change after the current one is verified and proved to be working.
|
|
43
|
+
|
|
44
|
+
## Verification is Required
|
|
45
|
+
|
|
46
|
+
Before considering any task complete:
|
|
47
|
+
- Run relevant tests (check package.json for test scripts)
|
|
48
|
+
- For TypeScript, run \`tsc --noEmit\` to catch type errors
|
|
49
|
+
- If there are no automated tests, manually verify the behavior works as expected
|
|
50
|
+
- Confirm the result makes sense in the codebase and improves the requested behavior
|
|
51
|
+
- Use available task-checking tools to ensure all tracked tasks are done
|
|
52
|
+
|
|
53
|
+
**Don't mark something as done until you've verified and proved it actually works.**
|
|
54
|
+
|
|
55
|
+
## Error Recovery
|
|
56
|
+
|
|
57
|
+
When something breaks:
|
|
58
|
+
1. Read the full error output carefully \u2014 don't guess
|
|
59
|
+
2. Find the root cause, not just the symptom
|
|
60
|
+
3. Fix it properly \u2014 no casts or suppressions to hide errors
|
|
61
|
+
4. Re-run to confirm the fix
|
|
62
|
+
5. If progress is blocked after reasonable attempts, briefly explain the blocker, what you've tried, and the next best option
|
|
63
|
+
|
|
64
|
+
## Git in Build Mode
|
|
65
|
+
|
|
66
|
+
- Before committing, verify the code compiles and passes lint
|
|
67
|
+
- Use descriptive branch names: \`feat/...\`, \`fix/...\`, \`refactor/...\`
|
|
68
|
+
`;
|
|
69
|
+
export {
|
|
70
|
+
buildModePrompt,
|
|
71
|
+
buildModePromptFn
|
|
72
|
+
};
|
|
73
|
+
//# sourceMappingURL=build.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/agents/prompts/build.ts"],"sourcesContent":["/**\n * Build mode prompt — full tool access, make changes and verify.\n */\n\nimport type { PromptContext } from './index.js';\n\n/**\n * Dynamic build mode prompt function.\n * When an approved plan exists in state, prepends it so the agent\n * knows exactly what to implement.\n */\nexport function buildModePromptFn(ctx: PromptContext): string {\n if (ctx.activePlan) {\n return (\n `# Approved Plan\n\n**${ctx.activePlan.title}**\n\n${ctx.activePlan.plan}\n\n---\n\nImplement the approved plan above. Follow the steps in order and verify each step works before moving on.\n\n` + buildModePrompt\n );\n }\n return buildModePrompt;\n}\n\nexport const buildModePrompt = `\n# Build Mode\n\nYou are in BUILD mode. You have full access to all tools and can read, write, edit, and execute commands.\n\n## Working Style\n\n**For simple tasks** (typo fixes, small edits, single-file changes):\n- Just do it. No need to explain your plan first.\n\n**For non-trivial tasks** (3+ files, architectural decisions, unclear requirements):\n- Use the available task-management tools to create and update your task list\n- Work on ONE step at a time — complete it and verify it works before moving on\n- If multiple approaches are plausible and the choice would materially affect scope, behavior, or risk, stop and ask the user\n\n## The Implementation Loop\n\nFor each change you make:\n\n1. **Understand** — Read the relevant code. Check how similar things are done elsewhere.\n2. **Implement** — Make the change. Follow existing patterns and conventions.\n3. **Verify** — Test that it works. Don't assume — actually run it.\n4. **Prove** — Proactively prove that the change is good, makes sense in context, is a positive contribution, and works fully. The burden of proof is on YOU.\n5. **Clean up** — Ensure no broken code, no debug statements, no half-done features.\n\nOnly move to the next change after the current one is verified and proved to be working.\n\n## Verification is Required\n\nBefore considering any task complete:\n- Run relevant tests (check package.json for test scripts)\n- For TypeScript, run \\`tsc --noEmit\\` to catch type errors\n- If there are no automated tests, manually verify the behavior works as expected\n- Confirm the result makes sense in the codebase and improves the requested behavior\n- Use available task-checking tools to ensure all tracked tasks are done\n\n**Don't mark something as done until you've verified and proved it actually works.**\n\n## Error Recovery\n\nWhen something breaks:\n1. Read the full error output carefully — don't guess\n2. Find the root cause, not just the symptom\n3. Fix it properly — no casts or suppressions to hide errors\n4. Re-run to confirm the fix\n5. If progress is blocked after reasonable attempts, briefly explain the blocker, what you've tried, and the next best option\n\n## Git in Build Mode\n\n- Before committing, verify the code compiles and passes lint\n- Use descriptive branch names: \\`feat/...\\`, \\`fix/...\\`, \\`refactor/...\\`\n`;\n"],"mappings":"AAWO,SAAS,kBAAkB,KAA4B;AAC5D,MAAI,IAAI,YAAY;AAClB,WACE;AAAA;AAAA,IAEF,IAAI,WAAW,KAAK;AAAA;AAAA,EAEtB,IAAI,WAAW,IAAI;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAMjB;AAAA,EAEF;AACA,SAAO;AACT;AAEO,MAAM,kBAAkB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;","names":[]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fast mode prompt — quick answers and small edits, minimal overhead.
|
|
3
|
+
*/
|
|
4
|
+
export declare const fastModePrompt = "\n# Fast Mode\n\nYou are in FAST mode. Optimize for speed and brevity.\n\n## Rules\n- Keep responses short. Under 200 words unless the task genuinely requires more.\n- Skip planning. Just do the task directly.\n- For questions: give the direct answer, not a tutorial.\n- For edits: make the change, show what you did, move on.\n- Don't explore the codebase more than necessary for the immediate task.\n\n## When to Use Tools vs. Just Answer\n- If the user asks a general programming question, answer directly from knowledge. Don't search the codebase.\n- If the user asks about THIS project's code, use tools to look it up \u2014 don't guess.\n- If the user asks for a quick edit and you know the file, read it and edit it. Don't ask for confirmation.\n- One tool call to read + one to edit is ideal. Minimize round trips.\n";
|
|
5
|
+
//# sourceMappingURL=fast.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fast.d.ts","sourceRoot":"","sources":["../../../src/agents/prompts/fast.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,eAAO,MAAM,cAAc,6zBAiB1B,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
const fastModePrompt = `
|
|
2
|
+
# Fast Mode
|
|
3
|
+
|
|
4
|
+
You are in FAST mode. Optimize for speed and brevity.
|
|
5
|
+
|
|
6
|
+
## Rules
|
|
7
|
+
- Keep responses short. Under 200 words unless the task genuinely requires more.
|
|
8
|
+
- Skip planning. Just do the task directly.
|
|
9
|
+
- For questions: give the direct answer, not a tutorial.
|
|
10
|
+
- For edits: make the change, show what you did, move on.
|
|
11
|
+
- Don't explore the codebase more than necessary for the immediate task.
|
|
12
|
+
|
|
13
|
+
## When to Use Tools vs. Just Answer
|
|
14
|
+
- If the user asks a general programming question, answer directly from knowledge. Don't search the codebase.
|
|
15
|
+
- If the user asks about THIS project's code, use tools to look it up \u2014 don't guess.
|
|
16
|
+
- If the user asks for a quick edit and you know the file, read it and edit it. Don't ask for confirmation.
|
|
17
|
+
- One tool call to read + one to edit is ideal. Minimize round trips.
|
|
18
|
+
`;
|
|
19
|
+
export {
|
|
20
|
+
fastModePrompt
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=fast.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/agents/prompts/fast.ts"],"sourcesContent":["/**\n * Fast mode prompt — quick answers and small edits, minimal overhead.\n */\n\nexport const fastModePrompt = `\n# Fast Mode\n\nYou are in FAST mode. Optimize for speed and brevity.\n\n## Rules\n- Keep responses short. Under 200 words unless the task genuinely requires more.\n- Skip planning. Just do the task directly.\n- For questions: give the direct answer, not a tutorial.\n- For edits: make the change, show what you did, move on.\n- Don't explore the codebase more than necessary for the immediate task.\n\n## When to Use Tools vs. Just Answer\n- If the user asks a general programming question, answer directly from knowledge. Don't search the codebase.\n- If the user asks about THIS project's code, use tools to look it up — don't guess.\n- If the user asks for a quick edit and you know the file, read it and edit it. Don't ask for confirmation.\n- One tool call to read + one to edit is ideal. Minimize round trips.\n`;\n"],"mappings":"AAIO,MAAM,iBAAiB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;","names":[]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prompt system — exports the prompt builder and mode-specific prompts.
|
|
3
|
+
*/
|
|
4
|
+
export { buildModePrompt, buildModePromptFn } from './build.js';
|
|
5
|
+
export { planModePrompt } from './plan.js';
|
|
6
|
+
export { fastModePrompt } from './fast.js';
|
|
7
|
+
import type { PromptContext as BasePromptContext } from '@mastra/core/coding-agent';
|
|
8
|
+
export interface PromptContext extends Omit<BasePromptContext, 'toolGuidance'> {
|
|
9
|
+
modeId: string;
|
|
10
|
+
state?: any;
|
|
11
|
+
currentDate: string;
|
|
12
|
+
workingDir: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Build the full system prompt for a given mode and context.
|
|
16
|
+
* Combines the base prompt with mode-specific instructions.
|
|
17
|
+
*/
|
|
18
|
+
export declare function buildFullPrompt(ctx: PromptContext): string;
|
|
19
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/agents/prompts/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAG3C,OAAO,KAAK,EAAE,aAAa,IAAI,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAUpF,MAAM,WAAW,aAAc,SAAQ,IAAI,CAAC,iBAAiB,EAAE,cAAc,CAAC;IAC5E,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;CACpB;AAQD;;;GAGG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,aAAa,GAAG,MAAM,CAmD1D"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { buildModePrompt, buildModePromptFn } from "./build.js";
|
|
2
|
+
import { planModePrompt } from "./plan.js";
|
|
3
|
+
import { fastModePrompt } from "./fast.js";
|
|
4
|
+
import { buildBasePrompt } from "@mastra/core/coding-agent";
|
|
5
|
+
import { hasTavilyKey } from "../../tools/index.js";
|
|
6
|
+
import { loadAgentInstructions, formatAgentInstructions } from "./agent-instructions.js";
|
|
7
|
+
import { buildModePromptFn as buildModePromptFn2 } from "./build.js";
|
|
8
|
+
import { fastModePrompt as fastModePrompt2 } from "./fast.js";
|
|
9
|
+
import { modelSpecificPrompts } from "./model.js";
|
|
10
|
+
import { planModePrompt as planModePrompt2 } from "./plan.js";
|
|
11
|
+
import { buildToolGuidance } from "./tool-guidance.js";
|
|
12
|
+
const modePrompts = {
|
|
13
|
+
build: buildModePromptFn2,
|
|
14
|
+
plan: planModePrompt2,
|
|
15
|
+
fast: fastModePrompt2
|
|
16
|
+
};
|
|
17
|
+
function buildFullPrompt(ctx) {
|
|
18
|
+
const modelId = ctx.modelId;
|
|
19
|
+
const hasWebSearch = hasTavilyKey() || !!modelId && modelId.startsWith("anthropic/");
|
|
20
|
+
const deniedTools = /* @__PURE__ */ new Set();
|
|
21
|
+
const permRules = ctx.state?.permissionRules;
|
|
22
|
+
if (permRules?.tools) {
|
|
23
|
+
for (const [name, policy] of Object.entries(permRules.tools)) {
|
|
24
|
+
if (policy === "deny") deniedTools.add(name);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
const toolGuidance = buildToolGuidance(ctx.modeId, { hasWebSearch, deniedTools });
|
|
28
|
+
const baseCtx = {
|
|
29
|
+
projectPath: ctx.workingDir,
|
|
30
|
+
projectName: ctx.projectName || "unknown",
|
|
31
|
+
gitBranch: ctx.gitBranch,
|
|
32
|
+
platform: process.platform,
|
|
33
|
+
commonBinaries: ctx.commonBinaries,
|
|
34
|
+
date: ctx.currentDate,
|
|
35
|
+
mode: ctx.modeId,
|
|
36
|
+
modelId: ctx.modelId,
|
|
37
|
+
activePlan: ctx.state?.activePlan,
|
|
38
|
+
toolGuidance
|
|
39
|
+
};
|
|
40
|
+
const base = buildBasePrompt(baseCtx);
|
|
41
|
+
const entry = modePrompts[ctx.modeId] || modePrompts.build;
|
|
42
|
+
const modeSpecific = (typeof entry === "function" ? entry(ctx) : entry) ?? "";
|
|
43
|
+
const modelSpecific = ctx.modelId ? modelSpecificPrompts[ctx.modelId] ?? "" : "";
|
|
44
|
+
const configDir = ctx.state?.configDir;
|
|
45
|
+
const instructionSources = loadAgentInstructions(ctx.workingDir, configDir);
|
|
46
|
+
const instructionsSection = formatAgentInstructions(instructionSources);
|
|
47
|
+
const sections = [base, instructionsSection.trim(), modelSpecific.trim(), modeSpecific.trim()].filter(Boolean);
|
|
48
|
+
return sections.join("\n\n");
|
|
49
|
+
}
|
|
50
|
+
export {
|
|
51
|
+
buildFullPrompt,
|
|
52
|
+
buildModePrompt,
|
|
53
|
+
buildModePromptFn,
|
|
54
|
+
fastModePrompt,
|
|
55
|
+
planModePrompt
|
|
56
|
+
};
|
|
57
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/agents/prompts/index.ts"],"sourcesContent":["/**\n * Prompt system — exports the prompt builder and mode-specific prompts.\n */\n\nexport { buildModePrompt, buildModePromptFn } from './build.js';\nexport { planModePrompt } from './plan.js';\nexport { fastModePrompt } from './fast.js';\n\nimport { buildBasePrompt } from '@mastra/core/coding-agent';\nimport type { PromptContext as BasePromptContext } from '@mastra/core/coding-agent';\nimport { hasTavilyKey } from '../../tools/index.js';\nimport { loadAgentInstructions, formatAgentInstructions } from './agent-instructions.js';\nimport { buildModePromptFn } from './build.js';\nimport { fastModePrompt } from './fast.js';\nimport { modelSpecificPrompts } from './model.js';\nimport { planModePrompt } from './plan.js';\nimport { buildToolGuidance } from './tool-guidance.js';\n\n// Extended prompt context that includes runtime information\nexport interface PromptContext extends Omit<BasePromptContext, 'toolGuidance'> {\n modeId: string;\n state?: any;\n currentDate: string;\n workingDir: string;\n}\n\nconst modePrompts: Record<string, string | ((ctx: PromptContext) => string)> = {\n build: buildModePromptFn,\n plan: planModePrompt,\n fast: fastModePrompt,\n};\n\n/**\n * Build the full system prompt for a given mode and context.\n * Combines the base prompt with mode-specific instructions.\n */\nexport function buildFullPrompt(ctx: PromptContext): string {\n // Determine whether web search tools are available\n const modelId = ctx.modelId;\n const hasWebSearch = hasTavilyKey() || (!!modelId && modelId.startsWith('anthropic/'));\n\n // Collect per-tool deny rules so guidance omits denied tools\n const deniedTools = new Set<string>();\n const permRules = ctx.state?.permissionRules as { tools?: Record<string, string> } | undefined;\n if (permRules?.tools) {\n for (const [name, policy] of Object.entries(permRules.tools)) {\n if (policy === 'deny') deniedTools.add(name);\n }\n }\n\n // Build mode-aware tool guidance\n const toolGuidance = buildToolGuidance(ctx.modeId, { hasWebSearch, deniedTools });\n\n // Map new context to base context\n const baseCtx: BasePromptContext = {\n projectPath: ctx.workingDir,\n projectName: ctx.projectName || 'unknown',\n gitBranch: ctx.gitBranch,\n platform: process.platform,\n commonBinaries: ctx.commonBinaries,\n date: ctx.currentDate,\n mode: ctx.modeId,\n modelId: ctx.modelId,\n activePlan: ctx.state?.activePlan,\n toolGuidance,\n };\n\n const base = buildBasePrompt(baseCtx);\n const entry = modePrompts[ctx.modeId] || modePrompts.build;\n const modeSpecific = (typeof entry === 'function' ? entry(ctx) : entry) ?? '';\n const modelSpecific = ctx.modelId\n ? (modelSpecificPrompts[ctx.modelId as keyof typeof modelSpecificPrompts] ?? '')\n : '';\n\n // The current task list is carried on the agent state-signal lane (see\n // TaskStateProcessor) rather than injected into the cached system prompt. This\n // keeps the prompt prefix stable across task updates (preserving prompt cache)\n // while still surviving observational-memory truncation.\n\n // Load and inject agent instructions from AGENTS.md/CLAUDE.md files\n const configDir = ctx.state?.configDir as string | undefined;\n const instructionSources = loadAgentInstructions(ctx.workingDir, configDir);\n const instructionsSection = formatAgentInstructions(instructionSources);\n\n const sections = [base, instructionsSection.trim(), modelSpecific.trim(), modeSpecific.trim()].filter(Boolean);\n\n return sections.join('\\n\\n');\n}\n"],"mappings":"AAIA,SAAS,iBAAiB,yBAAyB;AACnD,SAAS,sBAAsB;AAC/B,SAAS,sBAAsB;AAE/B,SAAS,uBAAuB;AAEhC,SAAS,oBAAoB;AAC7B,SAAS,uBAAuB,+BAA+B;AAC/D,SAAS,qBAAAA,0BAAyB;AAClC,SAAS,kBAAAC,uBAAsB;AAC/B,SAAS,4BAA4B;AACrC,SAAS,kBAAAC,uBAAsB;AAC/B,SAAS,yBAAyB;AAUlC,MAAM,cAAyE;AAAA,EAC7E,OAAOF;AAAA,EACP,MAAME;AAAA,EACN,MAAMD;AACR;AAMO,SAAS,gBAAgB,KAA4B;AAE1D,QAAM,UAAU,IAAI;AACpB,QAAM,eAAe,aAAa,KAAM,CAAC,CAAC,WAAW,QAAQ,WAAW,YAAY;AAGpF,QAAM,cAAc,oBAAI,IAAY;AACpC,QAAM,YAAY,IAAI,OAAO;AAC7B,MAAI,WAAW,OAAO;AACpB,eAAW,CAAC,MAAM,MAAM,KAAK,OAAO,QAAQ,UAAU,KAAK,GAAG;AAC5D,UAAI,WAAW,OAAQ,aAAY,IAAI,IAAI;AAAA,IAC7C;AAAA,EACF;AAGA,QAAM,eAAe,kBAAkB,IAAI,QAAQ,EAAE,cAAc,YAAY,CAAC;AAGhF,QAAM,UAA6B;AAAA,IACjC,aAAa,IAAI;AAAA,IACjB,aAAa,IAAI,eAAe;AAAA,IAChC,WAAW,IAAI;AAAA,IACf,UAAU,QAAQ;AAAA,IAClB,gBAAgB,IAAI;AAAA,IACpB,MAAM,IAAI;AAAA,IACV,MAAM,IAAI;AAAA,IACV,SAAS,IAAI;AAAA,IACb,YAAY,IAAI,OAAO;AAAA,IACvB;AAAA,EACF;AAEA,QAAM,OAAO,gBAAgB,OAAO;AACpC,QAAM,QAAQ,YAAY,IAAI,MAAM,KAAK,YAAY;AACrD,QAAM,gBAAgB,OAAO,UAAU,aAAa,MAAM,GAAG,IAAI,UAAU;AAC3E,QAAM,gBAAgB,IAAI,UACrB,qBAAqB,IAAI,OAA4C,KAAK,KAC3E;AAQJ,QAAM,YAAY,IAAI,OAAO;AAC7B,QAAM,qBAAqB,sBAAsB,IAAI,YAAY,SAAS;AAC1E,QAAM,sBAAsB,wBAAwB,kBAAkB;AAEtE,QAAM,WAAW,CAAC,MAAM,oBAAoB,KAAK,GAAG,cAAc,KAAK,GAAG,aAAa,KAAK,CAAC,EAAE,OAAO,OAAO;AAE7G,SAAO,SAAS,KAAK,MAAM;AAC7B;","names":["buildModePromptFn","fastModePrompt","planModePrompt"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../../src/agents/prompts/model.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,oBAAoB;;;CAiBhC,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
const modelSpecificPrompts = {
|
|
2
|
+
"openai/gpt-5.4": `<autonomy_and_persistence>
|
|
3
|
+
Persist until the task is fully handled end-to-end within the current turn whenever feasible: do not stop at analysis or partial fixes; carry changes through implementation, verification, and a clear explanation of outcomes unless the user explicitly pauses or redirects you.
|
|
4
|
+
|
|
5
|
+
Unless the user explicitly asks for a plan, asks a question about the code, is brainstorming potential solutions, or some other intent that makes it clear that code should not be written, assume the user wants you to make code changes or run tools to solve the user's problem. In these cases, it's bad to output your proposed solution in a message, you should go ahead and actually implement the change. If you encounter challenges or blockers, you should attempt to resolve them yourself.
|
|
6
|
+
</autonomy_and_persistence>
|
|
7
|
+
`,
|
|
8
|
+
"openai/gpt-5.5": `<coding_behavior>
|
|
9
|
+
Work outcome-first: infer the user's goal, define what "done" means from the request and repo context, then choose an efficient path that reaches that outcome without sacrificing correctness, maintainability, or proof.
|
|
10
|
+
|
|
11
|
+
For non-trivial multi-step or tool-heavy tasks, start with a short visible preamble that acknowledges the request and states the first action. Skip the preamble for direct answers and tiny edits. Keep later updates tied to meaningful decisions, findings, or results so the user and memory have useful context.
|
|
12
|
+
|
|
13
|
+
Use efficient retrieval. Read enough code, docs, logs, and command output to act correctly, including neighboring implementations when conventions matter. Stop searching once you have sufficient evidence, but do not let brevity outrank correctness, security, or compatibility with existing patterns.
|
|
14
|
+
|
|
15
|
+
For coding work, make focused changes that follow the surrounding conventions. Avoid unrequested features, broad refactors, speculative error handling, and comments that only explain the diff.
|
|
16
|
+
</coding_behavior>
|
|
17
|
+
`
|
|
18
|
+
};
|
|
19
|
+
export {
|
|
20
|
+
modelSpecificPrompts
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/agents/prompts/model.ts"],"sourcesContent":["export const modelSpecificPrompts = {\n 'openai/gpt-5.4': `<autonomy_and_persistence>\nPersist until the task is fully handled end-to-end within the current turn whenever feasible: do not stop at analysis or partial fixes; carry changes through implementation, verification, and a clear explanation of outcomes unless the user explicitly pauses or redirects you.\n\nUnless the user explicitly asks for a plan, asks a question about the code, is brainstorming potential solutions, or some other intent that makes it clear that code should not be written, assume the user wants you to make code changes or run tools to solve the user's problem. In these cases, it's bad to output your proposed solution in a message, you should go ahead and actually implement the change. If you encounter challenges or blockers, you should attempt to resolve them yourself.\n</autonomy_and_persistence>\n`,\n 'openai/gpt-5.5': `<coding_behavior>\nWork outcome-first: infer the user's goal, define what \"done\" means from the request and repo context, then choose an efficient path that reaches that outcome without sacrificing correctness, maintainability, or proof.\n\nFor non-trivial multi-step or tool-heavy tasks, start with a short visible preamble that acknowledges the request and states the first action. Skip the preamble for direct answers and tiny edits. Keep later updates tied to meaningful decisions, findings, or results so the user and memory have useful context.\n\nUse efficient retrieval. Read enough code, docs, logs, and command output to act correctly, including neighboring implementations when conventions matter. Stop searching once you have sufficient evidence, but do not let brevity outrank correctness, security, or compatibility with existing patterns.\n\nFor coding work, make focused changes that follow the surrounding conventions. Avoid unrequested features, broad refactors, speculative error handling, and comments that only explain the diff.\n</coding_behavior>\n`,\n};\n"],"mappings":"AAAO,MAAM,uBAAuB;AAAA,EAClC,kBAAkB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMlB,kBAAkB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAUpB;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plan.d.ts","sourceRoot":"","sources":["../../../src/agents/prompts/plan.ts"],"names":[],"mappings":"AAKA,UAAU,iBAAiB;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACjC;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,iBAAiB,GAAG,MAAM,CAsG9D"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { getLocalPlansRelativeDir } from "../../utils/plans.js";
|
|
2
|
+
function planModePrompt(_ctx) {
|
|
3
|
+
const plansDir = getLocalPlansRelativeDir();
|
|
4
|
+
const examplePath = `${plansDir}/add-dark-mode.md`;
|
|
5
|
+
return `
|
|
6
|
+
# Plan Mode \u2014 READ-ONLY (except plan files)
|
|
7
|
+
|
|
8
|
+
You are in PLAN mode. Your job is to explore the codebase and design an implementation plan \u2014 NOT to make changes to the project.
|
|
9
|
+
|
|
10
|
+
## CRITICAL: Read-Only Mode (project files)
|
|
11
|
+
|
|
12
|
+
This mode is **read-only for project files**. You must NOT modify the project.
|
|
13
|
+
|
|
14
|
+
- Do NOT modify, create, or delete project files
|
|
15
|
+
- Do NOT run commands that change state (no git commit, no npm install, no file creation)
|
|
16
|
+
- Do NOT run build commands, tests, or scripts that have side effects
|
|
17
|
+
|
|
18
|
+
The ONE exception is plan files: you CAN create and edit markdown files inside \`${plansDir}/\` (e.g. \`${examplePath}\`). You may NOT write anywhere else.
|
|
19
|
+
|
|
20
|
+
If the user asks you to make changes while in Plan mode, explain that you're in read-only mode and they should switch to Build mode (\`/mode build\`) first.
|
|
21
|
+
|
|
22
|
+
## Exploration Strategy
|
|
23
|
+
|
|
24
|
+
Before writing any plan, build a mental model of the codebase:
|
|
25
|
+
1. Start with the directory structure (\`view\` on the project root or relevant subdirectory).
|
|
26
|
+
2. Find the relevant entry points and core files using \`search_content\` and \`find_files\`.
|
|
27
|
+
3. Read the actual code \u2014 don't assume based on file names alone.
|
|
28
|
+
4. Trace data flow: where does input come from, how is it transformed, where does it go?
|
|
29
|
+
5. Identify existing patterns the codebase uses (naming, structure, error handling, testing).
|
|
30
|
+
|
|
31
|
+
## Goal-Ready Plans
|
|
32
|
+
|
|
33
|
+
The submit_plan approval UI can let the user approve the plan normally or start it as a persistent goal. Write plans so they can be carried out as a goal if the user chooses that option:
|
|
34
|
+
- Make the desired outcome explicit and verifiable.
|
|
35
|
+
- Break work into ordered, actionable steps that can be executed autonomously.
|
|
36
|
+
- Include constraints, risks, blockers, and decision points that may require user input.
|
|
37
|
+
- Include concrete verification criteria so the goal judge can tell when the work is done.
|
|
38
|
+
|
|
39
|
+
## Your Plan Output
|
|
40
|
+
|
|
41
|
+
Produce a clear, step-by-step plan with this structure:
|
|
42
|
+
|
|
43
|
+
### Overview
|
|
44
|
+
One paragraph: what the change does and why.
|
|
45
|
+
|
|
46
|
+
### Complexity Estimate
|
|
47
|
+
- **Size**: Small (1-2 files) / Medium (3-5 files) / Large (6+ files)
|
|
48
|
+
- **Risk**: Low (additive, no breaking changes) / Medium (modifies existing behavior) / High (architectural, affects many consumers)
|
|
49
|
+
- **Dependencies**: List any new packages, external services, or migration steps needed.
|
|
50
|
+
|
|
51
|
+
### Steps
|
|
52
|
+
For each step:
|
|
53
|
+
1. **File**: path to create or modify
|
|
54
|
+
2. **Change**: what to add/modify/remove, with enough specificity to implement directly
|
|
55
|
+
3. **Why**: brief rationale connecting this step to the overall goal
|
|
56
|
+
|
|
57
|
+
### Verification
|
|
58
|
+
- What tests to run
|
|
59
|
+
- What to check manually
|
|
60
|
+
- What could go wrong
|
|
61
|
+
|
|
62
|
+
## Plan File Workflow
|
|
63
|
+
|
|
64
|
+
Write each plan to its own markdown file under \`${plansDir}/\` (e.g. \`${examplePath}\`). Start the file with a \`# Title\` heading describing the plan.
|
|
65
|
+
|
|
66
|
+
1. **First submission**: Write your plan to a file under \`${plansDir}/\` using \`write_file\`, then call \`submit_plan\` with the \`path\` to that file.
|
|
67
|
+
2. **Reading**: Use \`view\` to read a plan file.
|
|
68
|
+
3. **Editing**: Use \`string_replace_lsp\` for targeted edits to specific sections.
|
|
69
|
+
|
|
70
|
+
**Reuse the same file while you keep iterating on the same plan.** Only create a NEW file when you're starting a genuinely different plan \u2014 that keeps each plan available to look back at and keeps revision diffs meaningful.
|
|
71
|
+
|
|
72
|
+
## IMMEDIATE ACTION: Write plan file, then call submit_plan
|
|
73
|
+
|
|
74
|
+
As soon as your plan is complete:
|
|
75
|
+
1. Write it to a file under \`${plansDir}/\` using \`write_file\`
|
|
76
|
+
2. Call \`submit_plan\` with the \`path\` to that file
|
|
77
|
+
|
|
78
|
+
**CRITICAL:** Do NOT generate a long text response describing your plan. The plan content belongs in the plan file, not in your text output or the \`submit_plan\` arguments.
|
|
79
|
+
|
|
80
|
+
\`\`\`javascript
|
|
81
|
+
submit_plan({
|
|
82
|
+
path: "${examplePath}"
|
|
83
|
+
})
|
|
84
|
+
\`\`\`
|
|
85
|
+
|
|
86
|
+
The user will see the plan rendered inline and can:
|
|
87
|
+
- **Approve** \u2014 automatically switches to Build mode for implementation
|
|
88
|
+
- **Start as goal** \u2014 approves the plan and enters goal mode so the agent keeps working toward the plan until judged complete, paused, or waiting for user input
|
|
89
|
+
- **Request changes** \u2014 rejects the plan; the agent stops immediately and the user provides revision feedback in their next chat message
|
|
90
|
+
|
|
91
|
+
## Revision Workflow
|
|
92
|
+
|
|
93
|
+
If the user requests changes, you will be stopped immediately. Wait for their next message \u2014 it will contain their revision feedback. When you receive it:
|
|
94
|
+
1. Use \`view\` to read the SAME plan file
|
|
95
|
+
2. Use \`string_replace_lsp\` to make targeted edits based on feedback
|
|
96
|
+
3. Use \`view\` to re-read the updated file
|
|
97
|
+
4. Call \`submit_plan\` again with the same \`path\` \u2014 editing the file alone does NOT resubmit it
|
|
98
|
+
|
|
99
|
+
The user will see a diff of what changed between the previous and revised plan. Use \`string_replace_lsp\` for targeted edits so the diff is clear and meaningful \u2014 do NOT rewrite the entire plan from scratch for small changes, and do NOT move the plan to a new file for a revision.
|
|
100
|
+
|
|
101
|
+
Do NOT start implementing until the plan is approved.
|
|
102
|
+
`;
|
|
103
|
+
}
|
|
104
|
+
export {
|
|
105
|
+
planModePrompt
|
|
106
|
+
};
|
|
107
|
+
//# sourceMappingURL=plan.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/agents/prompts/plan.ts"],"sourcesContent":["/**\n * Plan mode prompt — read-only exploration and planning.\n */\nimport { getLocalPlansRelativeDir } from '../../utils/plans.js';\n\ninterface PlanPromptContext {\n state?: Record<string, unknown>;\n}\n\nexport function planModePrompt(_ctx: PlanPromptContext): string {\n const plansDir = getLocalPlansRelativeDir();\n const examplePath = `${plansDir}/add-dark-mode.md`;\n\n return `\n# Plan Mode — READ-ONLY (except plan files)\n\nYou are in PLAN mode. Your job is to explore the codebase and design an implementation plan — NOT to make changes to the project.\n\n## CRITICAL: Read-Only Mode (project files)\n\nThis mode is **read-only for project files**. You must NOT modify the project.\n\n- Do NOT modify, create, or delete project files\n- Do NOT run commands that change state (no git commit, no npm install, no file creation)\n- Do NOT run build commands, tests, or scripts that have side effects\n\nThe ONE exception is plan files: you CAN create and edit markdown files inside \\`${plansDir}/\\` (e.g. \\`${examplePath}\\`). You may NOT write anywhere else.\n\nIf the user asks you to make changes while in Plan mode, explain that you're in read-only mode and they should switch to Build mode (\\`/mode build\\`) first.\n\n## Exploration Strategy\n\nBefore writing any plan, build a mental model of the codebase:\n1. Start with the directory structure (\\`view\\` on the project root or relevant subdirectory).\n2. Find the relevant entry points and core files using \\`search_content\\` and \\`find_files\\`.\n3. Read the actual code — don't assume based on file names alone.\n4. Trace data flow: where does input come from, how is it transformed, where does it go?\n5. Identify existing patterns the codebase uses (naming, structure, error handling, testing).\n\n## Goal-Ready Plans\n\nThe submit_plan approval UI can let the user approve the plan normally or start it as a persistent goal. Write plans so they can be carried out as a goal if the user chooses that option:\n- Make the desired outcome explicit and verifiable.\n- Break work into ordered, actionable steps that can be executed autonomously.\n- Include constraints, risks, blockers, and decision points that may require user input.\n- Include concrete verification criteria so the goal judge can tell when the work is done.\n\n## Your Plan Output\n\nProduce a clear, step-by-step plan with this structure:\n\n### Overview\nOne paragraph: what the change does and why.\n\n### Complexity Estimate\n- **Size**: Small (1-2 files) / Medium (3-5 files) / Large (6+ files)\n- **Risk**: Low (additive, no breaking changes) / Medium (modifies existing behavior) / High (architectural, affects many consumers)\n- **Dependencies**: List any new packages, external services, or migration steps needed.\n\n### Steps\nFor each step:\n1. **File**: path to create or modify\n2. **Change**: what to add/modify/remove, with enough specificity to implement directly\n3. **Why**: brief rationale connecting this step to the overall goal\n\n### Verification\n- What tests to run\n- What to check manually\n- What could go wrong\n\n## Plan File Workflow\n\nWrite each plan to its own markdown file under \\`${plansDir}/\\` (e.g. \\`${examplePath}\\`). Start the file with a \\`# Title\\` heading describing the plan.\n\n1. **First submission**: Write your plan to a file under \\`${plansDir}/\\` using \\`write_file\\`, then call \\`submit_plan\\` with the \\`path\\` to that file.\n2. **Reading**: Use \\`view\\` to read a plan file.\n3. **Editing**: Use \\`string_replace_lsp\\` for targeted edits to specific sections.\n\n**Reuse the same file while you keep iterating on the same plan.** Only create a NEW file when you're starting a genuinely different plan — that keeps each plan available to look back at and keeps revision diffs meaningful.\n\n## IMMEDIATE ACTION: Write plan file, then call submit_plan\n\nAs soon as your plan is complete:\n1. Write it to a file under \\`${plansDir}/\\` using \\`write_file\\`\n2. Call \\`submit_plan\\` with the \\`path\\` to that file\n\n**CRITICAL:** Do NOT generate a long text response describing your plan. The plan content belongs in the plan file, not in your text output or the \\`submit_plan\\` arguments.\n\n\\`\\`\\`javascript\nsubmit_plan({\n path: \"${examplePath}\"\n})\n\\`\\`\\`\n\nThe user will see the plan rendered inline and can:\n- **Approve** — automatically switches to Build mode for implementation\n- **Start as goal** — approves the plan and enters goal mode so the agent keeps working toward the plan until judged complete, paused, or waiting for user input\n- **Request changes** — rejects the plan; the agent stops immediately and the user provides revision feedback in their next chat message\n\n## Revision Workflow\n\nIf the user requests changes, you will be stopped immediately. Wait for their next message — it will contain their revision feedback. When you receive it:\n1. Use \\`view\\` to read the SAME plan file\n2. Use \\`string_replace_lsp\\` to make targeted edits based on feedback\n3. Use \\`view\\` to re-read the updated file\n4. Call \\`submit_plan\\` again with the same \\`path\\` — editing the file alone does NOT resubmit it\n\nThe user will see a diff of what changed between the previous and revised plan. Use \\`string_replace_lsp\\` for targeted edits so the diff is clear and meaningful — do NOT rewrite the entire plan from scratch for small changes, and do NOT move the plan to a new file for a revision.\n\nDo NOT start implementing until the plan is approved.\n`;\n}\n"],"mappings":"AAGA,SAAS,gCAAgC;AAMlC,SAAS,eAAe,MAAiC;AAC9D,QAAM,WAAW,yBAAyB;AAC1C,QAAM,cAAc,GAAG,QAAQ;AAE/B,SAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mFAa0E,QAAQ,eAAe,WAAW;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mDA8ClE,QAAQ,eAAe,WAAW;AAAA;AAAA,6DAExB,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gCASrC,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,WAO7B,WAAW;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAqBtB;","names":[]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mode-specific tool behavioral guidance.
|
|
3
|
+
* Generates tool usage instructions that match the actual registered tool names
|
|
4
|
+
* and are scoped to what's available in the current mode.
|
|
5
|
+
*/
|
|
6
|
+
interface ToolGuidanceOptions {
|
|
7
|
+
hasWebSearch?: boolean;
|
|
8
|
+
/** Tool names that have been denied — omit their guidance sections. */
|
|
9
|
+
deniedTools?: Set<string>;
|
|
10
|
+
}
|
|
11
|
+
export declare function buildToolGuidance(modeId: string, options?: ToolGuidanceOptions): string;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=tool-guidance.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-guidance.d.ts","sourceRoot":"","sources":["../../../src/agents/prompts/tool-guidance.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,UAAU,mBAAmB;IAC3B,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,uEAAuE;IACvE,WAAW,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CAC3B;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE,mBAAwB,GAAG,MAAM,CA+N3F"}
|