@mohanscodex/spectra-code 0.4.5
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/README.md +275 -0
- package/dist/package.json +62 -0
- package/dist/src/agents/definitions.d.ts +16 -0
- package/dist/src/agents/definitions.d.ts.map +1 -0
- package/dist/src/agents/definitions.js +148 -0
- package/dist/src/agents/definitions.js.map +1 -0
- package/dist/src/agents/registry.d.ts +11 -0
- package/dist/src/agents/registry.d.ts.map +1 -0
- package/dist/src/agents/registry.js +13 -0
- package/dist/src/agents/registry.js.map +1 -0
- package/dist/src/cli.d.ts +3 -0
- package/dist/src/cli.d.ts.map +1 -0
- package/dist/src/cli.js +436 -0
- package/dist/src/cli.js.map +1 -0
- package/dist/src/commands/agent.d.ts +3 -0
- package/dist/src/commands/agent.d.ts.map +1 -0
- package/dist/src/commands/agent.js +28 -0
- package/dist/src/commands/agent.js.map +1 -0
- package/dist/src/commands/db.d.ts +3 -0
- package/dist/src/commands/db.d.ts.map +1 -0
- package/dist/src/commands/db.js +47 -0
- package/dist/src/commands/db.js.map +1 -0
- package/dist/src/commands/doctor.d.ts +12 -0
- package/dist/src/commands/doctor.d.ts.map +1 -0
- package/dist/src/commands/doctor.js +59 -0
- package/dist/src/commands/doctor.js.map +1 -0
- package/dist/src/commands/mcp.d.ts +9 -0
- package/dist/src/commands/mcp.d.ts.map +1 -0
- package/dist/src/commands/mcp.js +208 -0
- package/dist/src/commands/mcp.js.map +1 -0
- package/dist/src/commands/plugin.d.ts +3 -0
- package/dist/src/commands/plugin.d.ts.map +1 -0
- package/dist/src/commands/plugin.js +36 -0
- package/dist/src/commands/plugin.js.map +1 -0
- package/dist/src/commands/session.d.ts +3 -0
- package/dist/src/commands/session.d.ts.map +1 -0
- package/dist/src/commands/session.js +49 -0
- package/dist/src/commands/session.js.map +1 -0
- package/dist/src/index.d.ts +19 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +17 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/integrations/acp/index.d.ts +2 -0
- package/dist/src/integrations/acp/index.d.ts.map +1 -0
- package/dist/src/integrations/acp/index.js +2 -0
- package/dist/src/integrations/acp/index.js.map +1 -0
- package/dist/src/integrations/acp/server.d.ts +11 -0
- package/dist/src/integrations/acp/server.d.ts.map +1 -0
- package/dist/src/integrations/acp/server.js +220 -0
- package/dist/src/integrations/acp/server.js.map +1 -0
- package/dist/src/integrations/custom-tools/index.d.ts +3 -0
- package/dist/src/integrations/custom-tools/index.d.ts.map +1 -0
- package/dist/src/integrations/custom-tools/index.js +2 -0
- package/dist/src/integrations/custom-tools/index.js.map +1 -0
- package/dist/src/integrations/custom-tools/loader.d.ts +16 -0
- package/dist/src/integrations/custom-tools/loader.d.ts.map +1 -0
- package/dist/src/integrations/custom-tools/loader.js +95 -0
- package/dist/src/integrations/custom-tools/loader.js.map +1 -0
- package/dist/src/integrations/mcp/client.d.ts +32 -0
- package/dist/src/integrations/mcp/client.d.ts.map +1 -0
- package/dist/src/integrations/mcp/client.js +117 -0
- package/dist/src/integrations/mcp/client.js.map +1 -0
- package/dist/src/integrations/mcp/index.d.ts +3 -0
- package/dist/src/integrations/mcp/index.d.ts.map +1 -0
- package/dist/src/integrations/mcp/index.js +2 -0
- package/dist/src/integrations/mcp/index.js.map +1 -0
- package/dist/src/security/doom-loop.d.ts +22 -0
- package/dist/src/security/doom-loop.d.ts.map +1 -0
- package/dist/src/security/doom-loop.js +72 -0
- package/dist/src/security/doom-loop.js.map +1 -0
- package/dist/src/security/index.d.ts +46 -0
- package/dist/src/security/index.d.ts.map +1 -0
- package/dist/src/security/index.js +362 -0
- package/dist/src/security/index.js.map +1 -0
- package/dist/src/security/path-safety.d.ts +15 -0
- package/dist/src/security/path-safety.d.ts.map +1 -0
- package/dist/src/security/path-safety.js +57 -0
- package/dist/src/security/path-safety.js.map +1 -0
- package/dist/src/security/permissions.d.ts +7 -0
- package/dist/src/security/permissions.d.ts.map +1 -0
- package/dist/src/security/permissions.js +41 -0
- package/dist/src/security/permissions.js.map +1 -0
- package/dist/src/security/read-tracker.d.ts +20 -0
- package/dist/src/security/read-tracker.d.ts.map +1 -0
- package/dist/src/security/read-tracker.js +73 -0
- package/dist/src/security/read-tracker.js.map +1 -0
- package/dist/src/security/ssrf-guard.d.ts +19 -0
- package/dist/src/security/ssrf-guard.d.ts.map +1 -0
- package/dist/src/security/ssrf-guard.js +98 -0
- package/dist/src/security/ssrf-guard.js.map +1 -0
- package/dist/src/security/types.d.ts +70 -0
- package/dist/src/security/types.d.ts.map +1 -0
- package/dist/src/security/types.js +2 -0
- package/dist/src/security/types.js.map +1 -0
- package/dist/src/security/wildcard.d.ts +5 -0
- package/dist/src/security/wildcard.d.ts.map +1 -0
- package/dist/src/security/wildcard.js +50 -0
- package/dist/src/security/wildcard.js.map +1 -0
- package/dist/src/services/auth-store.d.ts +25 -0
- package/dist/src/services/auth-store.d.ts.map +1 -0
- package/dist/src/services/auth-store.js +40 -0
- package/dist/src/services/auth-store.js.map +1 -0
- package/dist/src/services/config.d.ts +66 -0
- package/dist/src/services/config.d.ts.map +1 -0
- package/dist/src/services/config.js +83 -0
- package/dist/src/services/config.js.map +1 -0
- package/dist/src/services/context.d.ts +7 -0
- package/dist/src/services/context.d.ts.map +1 -0
- package/dist/src/services/context.js +23 -0
- package/dist/src/services/context.js.map +1 -0
- package/dist/src/services/custom-providers.d.ts +5 -0
- package/dist/src/services/custom-providers.d.ts.map +1 -0
- package/dist/src/services/custom-providers.js +213 -0
- package/dist/src/services/custom-providers.js.map +1 -0
- package/dist/src/services/session-store.d.ts +76 -0
- package/dist/src/services/session-store.d.ts.map +1 -0
- package/dist/src/services/session-store.js +199 -0
- package/dist/src/services/session-store.js.map +1 -0
- package/dist/src/services/snapshot-manager.d.ts +46 -0
- package/dist/src/services/snapshot-manager.d.ts.map +1 -0
- package/dist/src/services/snapshot-manager.js +183 -0
- package/dist/src/services/snapshot-manager.js.map +1 -0
- package/dist/src/tools/edit.d.ts +3 -0
- package/dist/src/tools/edit.d.ts.map +1 -0
- package/dist/src/tools/edit.js +57 -0
- package/dist/src/tools/edit.js.map +1 -0
- package/dist/src/tools/glob.d.ts +3 -0
- package/dist/src/tools/glob.d.ts.map +1 -0
- package/dist/src/tools/glob.js +46 -0
- package/dist/src/tools/glob.js.map +1 -0
- package/dist/src/tools/grep.d.ts +3 -0
- package/dist/src/tools/grep.d.ts.map +1 -0
- package/dist/src/tools/grep.js +50 -0
- package/dist/src/tools/grep.js.map +1 -0
- package/dist/src/tools/index.d.ts +26 -0
- package/dist/src/tools/index.d.ts.map +1 -0
- package/dist/src/tools/index.js +202 -0
- package/dist/src/tools/index.js.map +1 -0
- package/dist/src/tools/mcp-tool.d.ts +5 -0
- package/dist/src/tools/mcp-tool.d.ts.map +1 -0
- package/dist/src/tools/mcp-tool.js +82 -0
- package/dist/src/tools/mcp-tool.js.map +1 -0
- package/dist/src/tools/read.d.ts +3 -0
- package/dist/src/tools/read.d.ts.map +1 -0
- package/dist/src/tools/read.js +48 -0
- package/dist/src/tools/read.js.map +1 -0
- package/dist/src/tools/shell.d.ts +3 -0
- package/dist/src/tools/shell.d.ts.map +1 -0
- package/dist/src/tools/shell.js +266 -0
- package/dist/src/tools/shell.js.map +1 -0
- package/dist/src/tools/task.d.ts +3 -0
- package/dist/src/tools/task.d.ts.map +1 -0
- package/dist/src/tools/task.js +75 -0
- package/dist/src/tools/task.js.map +1 -0
- package/dist/src/tools/types.d.ts +18 -0
- package/dist/src/tools/types.d.ts.map +1 -0
- package/dist/src/tools/types.js +2 -0
- package/dist/src/tools/types.js.map +1 -0
- package/dist/src/tools/utils.d.ts +4 -0
- package/dist/src/tools/utils.d.ts.map +1 -0
- package/dist/src/tools/utils.js +10 -0
- package/dist/src/tools/utils.js.map +1 -0
- package/dist/src/tools/web-fetch.d.ts +3 -0
- package/dist/src/tools/web-fetch.d.ts.map +1 -0
- package/dist/src/tools/web-fetch.js +81 -0
- package/dist/src/tools/web-fetch.js.map +1 -0
- package/dist/src/tools/write.d.ts +3 -0
- package/dist/src/tools/write.d.ts.map +1 -0
- package/dist/src/tools/write.js +28 -0
- package/dist/src/tools/write.js.map +1 -0
- package/dist/src/tui/app-constants.d.ts +3 -0
- package/dist/src/tui/app-constants.d.ts.map +1 -0
- package/dist/src/tui/app-constants.js +4 -0
- package/dist/src/tui/app-constants.js.map +1 -0
- package/dist/src/tui/app.d.ts +5 -0
- package/dist/src/tui/app.d.ts.map +1 -0
- package/dist/src/tui/app.js +322 -0
- package/dist/src/tui/app.js.map +1 -0
- package/dist/src/tui/commands.d.ts +61 -0
- package/dist/src/tui/commands.d.ts.map +1 -0
- package/dist/src/tui/commands.js +95 -0
- package/dist/src/tui/commands.js.map +1 -0
- package/dist/src/tui/components/chat-area.d.ts +9 -0
- package/dist/src/tui/components/chat-area.d.ts.map +1 -0
- package/dist/src/tui/components/chat-area.js +12 -0
- package/dist/src/tui/components/chat-area.js.map +1 -0
- package/dist/src/tui/components/command-palette.d.ts +18 -0
- package/dist/src/tui/components/command-palette.d.ts.map +1 -0
- package/dist/src/tui/components/command-palette.js +50 -0
- package/dist/src/tui/components/command-palette.js.map +1 -0
- package/dist/src/tui/components/message.d.ts +9 -0
- package/dist/src/tui/components/message.d.ts.map +1 -0
- package/dist/src/tui/components/message.js +116 -0
- package/dist/src/tui/components/message.js.map +1 -0
- package/dist/src/tui/components/slash-autocomplete.d.ts +14 -0
- package/dist/src/tui/components/slash-autocomplete.d.ts.map +1 -0
- package/dist/src/tui/components/slash-autocomplete.js +29 -0
- package/dist/src/tui/components/slash-autocomplete.js.map +1 -0
- package/dist/src/tui/components/toast.d.ts +8 -0
- package/dist/src/tui/components/toast.d.ts.map +1 -0
- package/dist/src/tui/components/toast.js +29 -0
- package/dist/src/tui/components/toast.js.map +1 -0
- package/dist/src/tui/hooks/use-agent.d.ts +20 -0
- package/dist/src/tui/hooks/use-agent.d.ts.map +1 -0
- package/dist/src/tui/hooks/use-agent.js +129 -0
- package/dist/src/tui/hooks/use-agent.js.map +1 -0
- package/dist/src/tui/hooks/use-app-keyboard.d.ts +53 -0
- package/dist/src/tui/hooks/use-app-keyboard.d.ts.map +1 -0
- package/dist/src/tui/hooks/use-app-keyboard.js +155 -0
- package/dist/src/tui/hooks/use-app-keyboard.js.map +1 -0
- package/dist/src/tui/hooks/use-chat-submit.d.ts +61 -0
- package/dist/src/tui/hooks/use-chat-submit.d.ts.map +1 -0
- package/dist/src/tui/hooks/use-chat-submit.js +269 -0
- package/dist/src/tui/hooks/use-chat-submit.js.map +1 -0
- package/dist/src/tui/hooks/use-permission-queue.d.ts +10 -0
- package/dist/src/tui/hooks/use-permission-queue.d.ts.map +1 -0
- package/dist/src/tui/hooks/use-permission-queue.js +26 -0
- package/dist/src/tui/hooks/use-permission-queue.js.map +1 -0
- package/dist/src/tui/hooks/use-revert.d.ts +26 -0
- package/dist/src/tui/hooks/use-revert.d.ts.map +1 -0
- package/dist/src/tui/hooks/use-revert.js +88 -0
- package/dist/src/tui/hooks/use-revert.js.map +1 -0
- package/dist/src/tui/index.d.ts +5 -0
- package/dist/src/tui/index.d.ts.map +1 -0
- package/dist/src/tui/index.js +38 -0
- package/dist/src/tui/index.js.map +1 -0
- package/dist/src/tui/prompt-bar.d.ts +29 -0
- package/dist/src/tui/prompt-bar.d.ts.map +1 -0
- package/dist/src/tui/prompt-bar.js +41 -0
- package/dist/src/tui/prompt-bar.js.map +1 -0
- package/dist/src/tui/slash-commands.d.ts +20 -0
- package/dist/src/tui/slash-commands.d.ts.map +1 -0
- package/dist/src/tui/slash-commands.js +30 -0
- package/dist/src/tui/slash-commands.js.map +1 -0
- package/dist/src/tui/theme.d.ts +29 -0
- package/dist/src/tui/theme.d.ts.map +1 -0
- package/dist/src/tui/theme.js +54 -0
- package/dist/src/tui/theme.js.map +1 -0
- package/dist/src/tui/tips.d.ts +2 -0
- package/dist/src/tui/tips.d.ts.map +1 -0
- package/dist/src/tui/tips.js +40 -0
- package/dist/src/tui/tips.js.map +1 -0
- package/dist/src/tui/types.d.ts +34 -0
- package/dist/src/tui/types.d.ts.map +1 -0
- package/dist/src/tui/types.js +2 -0
- package/dist/src/tui/types.js.map +1 -0
- package/dist/src/tui/ui/about-dialog.d.ts +8 -0
- package/dist/src/tui/ui/about-dialog.d.ts.map +1 -0
- package/dist/src/tui/ui/about-dialog.js +21 -0
- package/dist/src/tui/ui/about-dialog.js.map +1 -0
- package/dist/src/tui/ui/agent-switcher.d.ts +10 -0
- package/dist/src/tui/ui/agent-switcher.d.ts.map +1 -0
- package/dist/src/tui/ui/agent-switcher.js +77 -0
- package/dist/src/tui/ui/agent-switcher.js.map +1 -0
- package/dist/src/tui/ui/debug-dialog.d.ts +15 -0
- package/dist/src/tui/ui/debug-dialog.d.ts.map +1 -0
- package/dist/src/tui/ui/debug-dialog.js +74 -0
- package/dist/src/tui/ui/debug-dialog.js.map +1 -0
- package/dist/src/tui/ui/doctor-dialog.d.ts +9 -0
- package/dist/src/tui/ui/doctor-dialog.d.ts.map +1 -0
- package/dist/src/tui/ui/doctor-dialog.js +45 -0
- package/dist/src/tui/ui/doctor-dialog.js.map +1 -0
- package/dist/src/tui/ui/manage-providers-dialog.d.ts +10 -0
- package/dist/src/tui/ui/manage-providers-dialog.d.ts.map +1 -0
- package/dist/src/tui/ui/manage-providers-dialog.js +257 -0
- package/dist/src/tui/ui/manage-providers-dialog.js.map +1 -0
- package/dist/src/tui/ui/mcp-toggle-dialog.d.ts +8 -0
- package/dist/src/tui/ui/mcp-toggle-dialog.d.ts.map +1 -0
- package/dist/src/tui/ui/mcp-toggle-dialog.js +89 -0
- package/dist/src/tui/ui/mcp-toggle-dialog.js.map +1 -0
- package/dist/src/tui/ui/message-controls.d.ts +16 -0
- package/dist/src/tui/ui/message-controls.d.ts.map +1 -0
- package/dist/src/tui/ui/message-controls.js +102 -0
- package/dist/src/tui/ui/message-controls.js.map +1 -0
- package/dist/src/tui/ui/model-switcher.d.ts +10 -0
- package/dist/src/tui/ui/model-switcher.d.ts.map +1 -0
- package/dist/src/tui/ui/model-switcher.js +139 -0
- package/dist/src/tui/ui/model-switcher.js.map +1 -0
- package/dist/src/tui/ui/permission-dialog.d.ts +12 -0
- package/dist/src/tui/ui/permission-dialog.d.ts.map +1 -0
- package/dist/src/tui/ui/permission-dialog.js +37 -0
- package/dist/src/tui/ui/permission-dialog.js.map +1 -0
- package/dist/src/tui/ui/provider-dialog.d.ts +11 -0
- package/dist/src/tui/ui/provider-dialog.d.ts.map +1 -0
- package/dist/src/tui/ui/provider-dialog.js +232 -0
- package/dist/src/tui/ui/provider-dialog.js.map +1 -0
- package/dist/src/tui/ui/session-list.d.ts +23 -0
- package/dist/src/tui/ui/session-list.d.ts.map +1 -0
- package/dist/src/tui/ui/session-list.js +147 -0
- package/dist/src/tui/ui/session-list.js.map +1 -0
- package/dist/src/tui/ui/thinking-effort-dialog.d.ts +11 -0
- package/dist/src/tui/ui/thinking-effort-dialog.d.ts.map +1 -0
- package/dist/src/tui/ui/thinking-effort-dialog.js +79 -0
- package/dist/src/tui/ui/thinking-effort-dialog.js.map +1 -0
- package/dist/src/tui/utils/model-config.d.ts +9 -0
- package/dist/src/tui/utils/model-config.d.ts.map +1 -0
- package/dist/src/tui/utils/model-config.js +63 -0
- package/dist/src/tui/utils/model-config.js.map +1 -0
- package/dist/src/tui/utils/session-messages.d.ts +22 -0
- package/dist/src/tui/utils/session-messages.d.ts.map +1 -0
- package/dist/src/tui/utils/session-messages.js +62 -0
- package/dist/src/tui/utils/session-messages.js.map +1 -0
- package/dist/src/tui/utils.d.ts +6 -0
- package/dist/src/tui/utils.d.ts.map +1 -0
- package/dist/src/tui/utils.js +23 -0
- package/dist/src/tui/utils.js.map +1 -0
- package/dist/src/tui/variant-cycle.d.ts +10 -0
- package/dist/src/tui/variant-cycle.d.ts.map +1 -0
- package/dist/src/tui/variant-cycle.js +64 -0
- package/dist/src/tui/variant-cycle.js.map +1 -0
- package/dist/src/utils/paths.d.ts +10 -0
- package/dist/src/utils/paths.d.ts.map +1 -0
- package/dist/src/utils/paths.js +106 -0
- package/dist/src/utils/paths.js.map +1 -0
- package/dist/src/utils/platform.d.ts +10 -0
- package/dist/src/utils/platform.d.ts.map +1 -0
- package/dist/src/utils/platform.js +133 -0
- package/dist/src/utils/platform.js.map +1 -0
- package/package.json +62 -0
package/README.md
ADDED
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
# Spectra Code
|
|
2
|
+
|
|
3
|
+
> AI coding agent in your terminal. Built on the Spectra agent framework.
|
|
4
|
+
|
|
5
|
+
Spectra Code is a terminal-native AI coding agent with a full-screen TUI, CLI commands, MCP integration, and ACP support for editor integration. It runs locally, respects your config, and keeps your API keys in a secure auth store.
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- **TUI** — Full-screen terminal UI with session management, model switching, and real-time streaming
|
|
10
|
+
- **CLI** — Command-line interface for scripting and automation
|
|
11
|
+
- **Custom Tools** — Define your own tools as `.ts` files in `.spectra/tools/`; loaded automatically alongside built-in tools
|
|
12
|
+
- **MCP + ACP** — MCP client (stdio + HTTP) for external tool servers; ACP server (JSON-RPC 2.0) for editor integration with Zed, Neovim, JetBrains
|
|
13
|
+
- **Multiple agents** — Build, Plan, Debug, and Explore modes with tailored tool sets
|
|
14
|
+
- **Sessions** — Persistent session storage with fork, archive, revert, and checkpointing
|
|
15
|
+
- **Custom providers** — Register any LLM provider via the TUI or config
|
|
16
|
+
- **Auth store** — Secure API key management with file permissions
|
|
17
|
+
|
|
18
|
+
## Install
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
bun add @mohanscodex/spectra-code
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Or run directly:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
npx @mohanscodex/spectra-code
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Usage
|
|
31
|
+
|
|
32
|
+
### TUI (default)
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
spectra
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Launches the full-screen terminal UI. Navigate with keyboard shortcuts, switch models, browse sessions, and chat with agents.
|
|
39
|
+
|
|
40
|
+
### CLI Commands
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
spectra session list # List all sessions
|
|
44
|
+
spectra session delete --id <id> # Delete a session
|
|
45
|
+
spectra agent list # List available agent modes
|
|
46
|
+
spectra doctor # Run system health check
|
|
47
|
+
spectra db path # Show data directory path
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
#### MCP Server Management
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
spectra mcp list # List configured MCP servers
|
|
54
|
+
spectra mcp add my-server --command "npx ..." # Add a local MCP server
|
|
55
|
+
spectra mcp add my-api --url "https://..." # Add a remote MCP server
|
|
56
|
+
spectra mcp connect my-server # Connect to a server
|
|
57
|
+
spectra mcp disconnect my-server # Disconnect
|
|
58
|
+
spectra mcp tools --server my-server # List available tools
|
|
59
|
+
spectra mcp remove my-server # Remove from config
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### ACP
|
|
63
|
+
|
|
64
|
+
Use Spectra Code as the AI agent inside your editor:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
spectra acp
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Compatible with [any editor that supports ACP](https://agentclientprotocol.com) — Zed, Neovim (avante.nvim, CodeCompanion), JetBrains, and more.
|
|
71
|
+
|
|
72
|
+
#### Zed Configuration
|
|
73
|
+
|
|
74
|
+
Add to `~/.config/zed/settings.json`:
|
|
75
|
+
|
|
76
|
+
```json
|
|
77
|
+
{
|
|
78
|
+
"agent_servers": {
|
|
79
|
+
"Spectra Code": {
|
|
80
|
+
"command": "spectra",
|
|
81
|
+
"args": ["acp"]
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
#### Neovim (avante.nvim)
|
|
88
|
+
|
|
89
|
+
```lua
|
|
90
|
+
{
|
|
91
|
+
acp_providers = {
|
|
92
|
+
["spectra"] = {
|
|
93
|
+
command = "spectra",
|
|
94
|
+
args = { "acp" }
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Custom Tools
|
|
101
|
+
|
|
102
|
+
Define your own tools the agent can call. Place `.ts` files in `.spectra/tools/` (project) or `~/.config/spectra/tools/` (global). Each file becomes a tool named after the filename.
|
|
103
|
+
|
|
104
|
+
```typescript
|
|
105
|
+
// .spectra/tools/weather.ts
|
|
106
|
+
import { z } from "zod";
|
|
107
|
+
|
|
108
|
+
export default {
|
|
109
|
+
description: "Get current weather for a location",
|
|
110
|
+
args: {
|
|
111
|
+
location: z.string().describe("City name"),
|
|
112
|
+
},
|
|
113
|
+
async execute(args: { location: string }) {
|
|
114
|
+
const res = await fetch(
|
|
115
|
+
`https://api.weather.com/current?city=${encodeURIComponent(args.location)}`
|
|
116
|
+
);
|
|
117
|
+
const data = await res.json();
|
|
118
|
+
return `Weather in ${args.location}: ${data.temp}°C, ${data.condition}`;
|
|
119
|
+
},
|
|
120
|
+
};
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
Multiple tools per file using named exports:
|
|
124
|
+
|
|
125
|
+
```typescript
|
|
126
|
+
// .spectra/tools/math.ts
|
|
127
|
+
import { z } from "zod";
|
|
128
|
+
|
|
129
|
+
export const add = {
|
|
130
|
+
description: "Add two numbers",
|
|
131
|
+
args: { a: z.number(), b: z.number() },
|
|
132
|
+
async execute(args: { a: number; b: number }) {
|
|
133
|
+
return String(args.a + args.b);
|
|
134
|
+
},
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
export const multiply = {
|
|
138
|
+
description: "Multiply two numbers",
|
|
139
|
+
args: { a: z.number(), b: z.number() },
|
|
140
|
+
async execute(args: { a: number; b: number }) {
|
|
141
|
+
return String(args.a * args.b);
|
|
142
|
+
},
|
|
143
|
+
};
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
This creates two tools: `math_add` and `math_multiply`. Tools are loaded automatically by the ACP server and merged into the agent's toolset alongside built-in and MCP tools.
|
|
147
|
+
|
|
148
|
+
## Configuration
|
|
149
|
+
|
|
150
|
+
Spectra Code reads config from `spectra.json`, `opencode.json`, or `config.json` in the project or global config directory (`~/.config/spectra/` on Linux, `%LOCALAPPDATA%/spectra/Config/` on Windows).
|
|
151
|
+
|
|
152
|
+
```json
|
|
153
|
+
{
|
|
154
|
+
"model": "anthropic/claude-sonnet-4-20250514",
|
|
155
|
+
"agent": "build",
|
|
156
|
+
"theme": "dark",
|
|
157
|
+
"mcp": [
|
|
158
|
+
{
|
|
159
|
+
"name": "filesystem",
|
|
160
|
+
"command": "npx",
|
|
161
|
+
"args": ["-y", "@modelcontextprotocol/server-filesystem", "."],
|
|
162
|
+
"enabled": true
|
|
163
|
+
}
|
|
164
|
+
]
|
|
165
|
+
}
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
Environment variables: `ANTHROPIC_API_KEY`, `OPENAI_API_KEY`, `SPECTRA_MODEL`, `SPECTRA_PROVIDER`.
|
|
169
|
+
|
|
170
|
+
## Security
|
|
171
|
+
|
|
172
|
+
Spectra Code runs with layered, configurable security — everything has sensible defaults but nothing is locked down.
|
|
173
|
+
|
|
174
|
+
### Permission System
|
|
175
|
+
|
|
176
|
+
Three-action model per tool and pattern: `allow`, `ask`, or `deny`. Everything defaults to `ask` unless configured.
|
|
177
|
+
|
|
178
|
+
```json
|
|
179
|
+
{
|
|
180
|
+
"permission": {
|
|
181
|
+
"*": "allow",
|
|
182
|
+
"external_directory": { "*": "ask", "~/Downloads/*": "allow" },
|
|
183
|
+
"bash": { "git *": "allow", "rm *": "deny", "*": "ask" },
|
|
184
|
+
"write": { "*.env": "deny" }
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
**Permission keys:** `read`, `write` (covers edit/write/apply_patch), `bash`, `grep`, `glob`, `web_fetch`, `task`, `external_directory`
|
|
190
|
+
|
|
191
|
+
### Tool Capabilities
|
|
192
|
+
|
|
193
|
+
Every tool declares its intent — `reads` (returns file content to the model) and/or `writes` (modifies files). Custom tools declare their own and automatically get guards and permission grouping.
|
|
194
|
+
|
|
195
|
+
| Tool | reads | writes |
|
|
196
|
+
|---|---|---|
|
|
197
|
+
| read, glob, grep | ✓ | |
|
|
198
|
+
| edit, write, apply_patch | | ✓ |
|
|
199
|
+
| bash | ✓ | ✓ |
|
|
200
|
+
| web_fetch, task | | |
|
|
201
|
+
|
|
202
|
+
### Read-Before-Write Guard
|
|
203
|
+
|
|
204
|
+
Applies to all write-capable tools. Files must be read before they can be overwritten. Modes:
|
|
205
|
+
|
|
206
|
+
- **soft** (default): first untracked write to existing file refused, second attempt allowed
|
|
207
|
+
- **strict**: permanent block until the file is read
|
|
208
|
+
- **off**: disabled entirely
|
|
209
|
+
|
|
210
|
+
### Path Safety
|
|
211
|
+
|
|
212
|
+
Sensitive paths blocked by default: `.ssh/`, `.aws/credentials`, `.gnupg/`, `/etc/shadow`, `.docker/config.json`, `.kube/config`, and more. Override via `allowedPaths`.
|
|
213
|
+
|
|
214
|
+
```json
|
|
215
|
+
{
|
|
216
|
+
"security": {
|
|
217
|
+
"blockedPaths": ["**/.ssh/**"],
|
|
218
|
+
"allowedPaths": [".env.example"],
|
|
219
|
+
"writeGuard": "soft",
|
|
220
|
+
"writeGuardExclude": ["apply_patch"]
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
### SSRF Guard
|
|
226
|
+
|
|
227
|
+
Blocks loopback and RFC1918 addresses for `web_fetch`. Configurable allowlist.
|
|
228
|
+
|
|
229
|
+
```json
|
|
230
|
+
{
|
|
231
|
+
"security": {
|
|
232
|
+
"ssrf": { "blockPrivate": true, "allowedHosts": ["api.internal.corp"] }
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
### Doom Loop Detection
|
|
238
|
+
|
|
239
|
+
- Identical tool calls 3+ times → blocks the loop
|
|
240
|
+
- 8+ consecutive reads without writes → injects warning
|
|
241
|
+
- 4+ patch failures on same file → suggests rewrite
|
|
242
|
+
|
|
243
|
+
### File Checkpointing
|
|
244
|
+
|
|
245
|
+
Files are snapshotted before each turn. Ctrl+Shift+Y rolls back file changes. Everything is overridable — no hardcoded restrictions.
|
|
246
|
+
|
|
247
|
+
## Architecture
|
|
248
|
+
|
|
249
|
+
```
|
|
250
|
+
cli.ts CLI entry point (yargs)
|
|
251
|
+
├── tui/ Full-screen terminal UI (React + @opentui)
|
|
252
|
+
├── commands/ CLI command handlers
|
|
253
|
+
├── services/ Config, session store, auth, snapshots
|
|
254
|
+
├── tools/ Built-in agent tools (read, write, edit, shell, grep, glob, web_fetch, task)
|
|
255
|
+
├── agents/ Agent definitions (build, plan, debug, explore)
|
|
256
|
+
├── security/ Permission engine, path safety, read tracker, doom loop, SSRF guard
|
|
257
|
+
└── integrations/
|
|
258
|
+
├── mcp/ MCP client (stdio + HTTP)
|
|
259
|
+
├── acp/ ACP server (JSON-RPC 2.0)
|
|
260
|
+
└── custom-tools/ Custom tool loader
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
## API
|
|
264
|
+
|
|
265
|
+
```typescript
|
|
266
|
+
import { launchTui, loadConfig, SessionStore } from "@mohanscodex/spectra-code";
|
|
267
|
+
import { shellTool, readTool, writeTool } from "@mohanscodex/spectra-code";
|
|
268
|
+
|
|
269
|
+
const store = new SessionStore();
|
|
270
|
+
const sessions = store.list();
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
## License
|
|
274
|
+
|
|
275
|
+
MIT
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@mohanscodex/spectra-code",
|
|
3
|
+
"version": "0.4.5",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "Spectra Code — TUI coding agent with CLI commands, tools, and LLM integration",
|
|
6
|
+
"bin": {
|
|
7
|
+
"spectra": "dist/src/cli.js"
|
|
8
|
+
},
|
|
9
|
+
"main": "./dist/src/index.js",
|
|
10
|
+
"types": "./dist/src/index.d.ts",
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"types": "./dist/src/index.d.ts",
|
|
14
|
+
"import": "./dist/src/index.js"
|
|
15
|
+
},
|
|
16
|
+
"./cli": {
|
|
17
|
+
"types": "./dist/src/cli.d.ts",
|
|
18
|
+
"import": "./dist/src/cli.js"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"files": [
|
|
22
|
+
"dist"
|
|
23
|
+
],
|
|
24
|
+
"scripts": {
|
|
25
|
+
"build": "tsc",
|
|
26
|
+
"dev": "bun src/cli.ts",
|
|
27
|
+
"start": "bun src/cli.ts",
|
|
28
|
+
"spectra:help": "tsx src/cli.ts --help",
|
|
29
|
+
"test": "vitest --run",
|
|
30
|
+
"lint": "tsc --noEmit"
|
|
31
|
+
},
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"@clack/prompts": "^1.4.0",
|
|
34
|
+
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
35
|
+
"@opentui/core": ">=0.2.6",
|
|
36
|
+
"@opentui/react": "^0.2.10",
|
|
37
|
+
"@mohanscodex/spectra-agent": "workspace:*",
|
|
38
|
+
"@mohanscodex/spectra-ai": "workspace:*",
|
|
39
|
+
"chalk": "^5.6.2",
|
|
40
|
+
"clipboardy": "^5.3.1",
|
|
41
|
+
"openai": "^5.3.0",
|
|
42
|
+
"react": "^19.2.6",
|
|
43
|
+
"strip-ansi": "^7.2.0",
|
|
44
|
+
"yargs": "^18.0.0",
|
|
45
|
+
"zod": "^3.25.0"
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"@types/node": "^22.0.0",
|
|
49
|
+
"@types/react": "^19.2.14",
|
|
50
|
+
"@types/react-dom": "^19.2.3",
|
|
51
|
+
"@types/strip-ansi": "^5.2.1",
|
|
52
|
+
"@types/yargs": "^17.0.0",
|
|
53
|
+
"tsx": "^4.19.0",
|
|
54
|
+
"typescript": "^5.7.0",
|
|
55
|
+
"vitest": "^3.2.0"
|
|
56
|
+
},
|
|
57
|
+
"license": "MIT",
|
|
58
|
+
"engines": {
|
|
59
|
+
"bun": ">=1.0.0"
|
|
60
|
+
},
|
|
61
|
+
"preferGlobal": true
|
|
62
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { AgentTool } from "@mohanscodex/spectra-agent";
|
|
2
|
+
export interface AgentDefinition {
|
|
3
|
+
name: string;
|
|
4
|
+
mode: "primary" | "subagent";
|
|
5
|
+
description: string;
|
|
6
|
+
tools: string[];
|
|
7
|
+
maxTurns: number;
|
|
8
|
+
temperature?: number;
|
|
9
|
+
prompt: string;
|
|
10
|
+
}
|
|
11
|
+
export declare const AGENT_DEFINITIONS: Record<string, AgentDefinition>;
|
|
12
|
+
export declare const PRIMARY_AGENTS: string[];
|
|
13
|
+
export declare const SUBAGENTS: string[];
|
|
14
|
+
export declare function getToolNamesForAgent(agentName: string): string[];
|
|
15
|
+
export declare function filterToolsByAgent(allTools: AgentTool[], agentName: string): AgentTool[];
|
|
16
|
+
//# sourceMappingURL=definitions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"definitions.d.ts","sourceRoot":"","sources":["../../../src/agents/definitions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAA;AAE3D,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,SAAS,GAAG,UAAU,CAAA;IAC5B,WAAW,EAAE,MAAM,CAAA;IACnB,KAAK,EAAE,MAAM,EAAE,CAAA;IACf,QAAQ,EAAE,MAAM,CAAA;IAChB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,MAAM,EAAE,MAAM,CAAA;CACf;AAED,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAuI7D,CAAA;AAED,eAAO,MAAM,cAAc,UAEN,CAAA;AAErB,eAAO,MAAM,SAAS,UAED,CAAA;AAErB,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,CAGhE;AAED,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,SAAS,EAAE,EACrB,SAAS,EAAE,MAAM,GAChB,SAAS,EAAE,CAGb"}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
export const AGENT_DEFINITIONS = {
|
|
2
|
+
build: {
|
|
3
|
+
name: "build",
|
|
4
|
+
mode: "primary",
|
|
5
|
+
description: "Full development agent with all tools enabled. Use for implementation, editing, and running commands.",
|
|
6
|
+
tools: ["read", "write", "edit", "bash", "glob", "grep", "web_fetch", "task"],
|
|
7
|
+
maxTurns: 30,
|
|
8
|
+
temperature: 0,
|
|
9
|
+
prompt: `## Mode: Build
|
|
10
|
+
|
|
11
|
+
You are in build mode — full development access. All tools are available.
|
|
12
|
+
|
|
13
|
+
### Execution
|
|
14
|
+
- Execute changes confidently using write, edit, and bash.
|
|
15
|
+
- Read files before editing to understand context and surrounding code patterns.
|
|
16
|
+
- Prefer edit for small surgical changes (single function, block, or parameter). Use write for new files or large sections.
|
|
17
|
+
- Run lint, typecheck, and test commands after making changes to verify correctness. Check package.json or README for the correct commands.
|
|
18
|
+
- Use glob and grep for discovery before reading individual files.
|
|
19
|
+
|
|
20
|
+
### Code Style
|
|
21
|
+
- Mimic the existing code's conventions — indentation, naming, patterns, framework choices.
|
|
22
|
+
- Do NOT add comments unless the user explicitly asks for them.
|
|
23
|
+
- Never assume a library is available — verify it exists in the project first.
|
|
24
|
+
- The smallest correct change is usually the best.
|
|
25
|
+
|
|
26
|
+
### Guardrails
|
|
27
|
+
- Never commit unless asked. Never amend, force push, or hard reset.
|
|
28
|
+
- Never revert changes you did not make.
|
|
29
|
+
- Never expose or commit secrets, API keys, or .env files.
|
|
30
|
+
- Explain destructive commands (rm, force push, hard reset) before running them.
|
|
31
|
+
|
|
32
|
+
### Output
|
|
33
|
+
- After making changes, do not add explanations or summaries unless asked.
|
|
34
|
+
- When referencing code, use the \`file_path:line_number\` format.
|
|
35
|
+
- Be direct and concise — no conversational filler.`,
|
|
36
|
+
},
|
|
37
|
+
plan: {
|
|
38
|
+
name: "plan",
|
|
39
|
+
mode: "primary",
|
|
40
|
+
description: "Read-only planning and analysis. Cannot edit files or run commands. Use for designing approaches and understanding code.",
|
|
41
|
+
tools: ["read", "glob", "grep", "web_fetch", "task"],
|
|
42
|
+
maxTurns: 15,
|
|
43
|
+
temperature: 0,
|
|
44
|
+
prompt: `## Mode: Plan
|
|
45
|
+
|
|
46
|
+
You are in plan mode — read-only analysis and design. You CANNOT edit files, write code, or run bash commands.
|
|
47
|
+
|
|
48
|
+
### Exploration
|
|
49
|
+
- Explore the codebase using read, glob, grep, and web_fetch.
|
|
50
|
+
- Use grep and glob to understand the project structure before drilling into individual files.
|
|
51
|
+
- Launch sub-agents (task tool) for parallel exploration when the scope spans multiple areas.
|
|
52
|
+
|
|
53
|
+
### Analysis
|
|
54
|
+
- Identify patterns, dependencies, and affected areas for the task at hand.
|
|
55
|
+
- Note existing conventions: code style, naming patterns, framework choices, test structure.
|
|
56
|
+
- Flag risks, edge cases, and testing strategy explicitly.
|
|
57
|
+
- When evaluating approaches, prioritize the simplest correct solution.
|
|
58
|
+
|
|
59
|
+
### Deliverable
|
|
60
|
+
- Design a clear implementation plan with specific files and concrete changes.
|
|
61
|
+
- Break complex tasks into numbered, sequential steps.
|
|
62
|
+
- Include verification steps: what commands to run (lint, test, build) to confirm correctness.
|
|
63
|
+
- When done, the user will switch to build mode to execute.
|
|
64
|
+
|
|
65
|
+
### Constraints
|
|
66
|
+
- Do NOT make any edits. Do NOT run bash commands. Do NOT create or modify files.
|
|
67
|
+
- Do not add code comments or implementation details in your analysis — save those for the plan.
|
|
68
|
+
- Be thorough but structured. Avoid tangential exploration.`,
|
|
69
|
+
},
|
|
70
|
+
debug: {
|
|
71
|
+
name: "debug",
|
|
72
|
+
mode: "primary",
|
|
73
|
+
description: "Investigation and debugging. Can read files and run safe commands but cannot edit. Use for diagnosing issues.",
|
|
74
|
+
tools: ["read", "bash", "grep", "glob"],
|
|
75
|
+
maxTurns: 20,
|
|
76
|
+
temperature: 0,
|
|
77
|
+
prompt: `## Mode: Debug
|
|
78
|
+
|
|
79
|
+
You are in debug mode — investigation and diagnosis. You can read files and run diagnostic commands, but CANNOT edit code.
|
|
80
|
+
|
|
81
|
+
### Investigation
|
|
82
|
+
- Reproduce the issue first: run the failing command, test, or scenario.
|
|
83
|
+
- Trace the execution path using read and grep. Follow the data flow, not just error locations.
|
|
84
|
+
- Inspect logs, error messages, stack traces, and relevant environment state.
|
|
85
|
+
- Use bash for diagnostic commands: version checks, environment inspection, test runs, build outputs.
|
|
86
|
+
- Use grep to find all callers/consumers of the affected code.
|
|
87
|
+
|
|
88
|
+
### Diagnosis
|
|
89
|
+
- Identify the root cause with evidence, not speculation.
|
|
90
|
+
- Distinguish between symptoms and causes — don't stop at the first error.
|
|
91
|
+
- If the issue involves configuration or environment, check those explicitly.
|
|
92
|
+
- Consider recent changes (git log, git diff) as potential causes.
|
|
93
|
+
|
|
94
|
+
### Output
|
|
95
|
+
- State the root cause clearly with file/line references.
|
|
96
|
+
- Propose a concrete fix — but do NOT apply it (the user will switch to build mode).
|
|
97
|
+
- If multiple causes exist, list them in order of likelihood with supporting evidence.
|
|
98
|
+
- If you cannot determine the cause, state what you've ruled out and what remains uncertain.
|
|
99
|
+
|
|
100
|
+
### Constraints
|
|
101
|
+
- Do NOT edit files. Do NOT make code changes.
|
|
102
|
+
- Safe diagnostic commands are allowed (reading state, running tests). Destructive commands are not.`,
|
|
103
|
+
},
|
|
104
|
+
explore: {
|
|
105
|
+
name: "explore",
|
|
106
|
+
mode: "subagent",
|
|
107
|
+
description: "Fast, read-only codebase explorer. Use for file search, code navigation, and answering questions about the codebase.",
|
|
108
|
+
tools: ["read", "glob", "grep", "web_fetch"],
|
|
109
|
+
maxTurns: 5,
|
|
110
|
+
temperature: 0,
|
|
111
|
+
prompt: `## Mode: Explore
|
|
112
|
+
|
|
113
|
+
You are a codebase exploration specialist — fast, thorough, read-only. Your job is to find, read, and report. No edits, no commands.
|
|
114
|
+
|
|
115
|
+
### Search Strategy
|
|
116
|
+
- Start with glob to find files by pattern (e.g., \`**/*.ts\`, \`src/components/**/*.tsx\`).
|
|
117
|
+
- Use grep to search for specific patterns, functions, classes, imports across the codebase.
|
|
118
|
+
- Read files to understand implementations, but only after narrowing down with glob/grep.
|
|
119
|
+
- Prefer grep over reading entire files — it's faster and uses less context.
|
|
120
|
+
- When the scope is broad, launch parallel explorations via the task tool.
|
|
121
|
+
|
|
122
|
+
### Reporting
|
|
123
|
+
- Return findings concisely with absolute file paths and line references.
|
|
124
|
+
- Separate what is verified (directly observed in code) from what is inferred.
|
|
125
|
+
- If a search returns nothing, say so explicitly rather than guessing.
|
|
126
|
+
- When answering "how does X work" questions, trace the flow end-to-end and cite each step with \`file:line\`.
|
|
127
|
+
|
|
128
|
+
### Constraints
|
|
129
|
+
- Read-only. Do NOT edit, write, or run bash commands.
|
|
130
|
+
- Be thorough but fast — complete your task within ${5} turns.
|
|
131
|
+
- Do not explore tangentially unless instructed. Stay focused on the query.`,
|
|
132
|
+
},
|
|
133
|
+
};
|
|
134
|
+
export const PRIMARY_AGENTS = Object.values(AGENT_DEFINITIONS)
|
|
135
|
+
.filter((d) => d.mode === "primary")
|
|
136
|
+
.map((d) => d.name);
|
|
137
|
+
export const SUBAGENTS = Object.values(AGENT_DEFINITIONS)
|
|
138
|
+
.filter((d) => d.mode === "subagent")
|
|
139
|
+
.map((d) => d.name);
|
|
140
|
+
export function getToolNamesForAgent(agentName) {
|
|
141
|
+
const def = AGENT_DEFINITIONS[agentName];
|
|
142
|
+
return def ? [...def.tools] : [];
|
|
143
|
+
}
|
|
144
|
+
export function filterToolsByAgent(allTools, agentName) {
|
|
145
|
+
const allowed = getToolNamesForAgent(agentName);
|
|
146
|
+
return allTools.filter((t) => allowed.includes(t.name));
|
|
147
|
+
}
|
|
148
|
+
//# sourceMappingURL=definitions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../../src/agents/definitions.ts"],"names":[],"mappings":"AAYA,MAAM,CAAC,MAAM,iBAAiB,GAAoC;IAChE,KAAK,EAAE;QACL,IAAI,EAAE,OAAO;QACb,IAAI,EAAE,SAAS;QACf,WAAW,EAAE,uGAAuG;QACpH,KAAK,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,CAAC;QAC7E,QAAQ,EAAE,EAAE;QACZ,WAAW,EAAE,CAAC;QACd,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;oDA0BwC;KACjD;IAED,IAAI,EAAE;QACJ,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,SAAS;QACf,WAAW,EAAE,0HAA0H;QACvI,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,CAAC;QACpD,QAAQ,EAAE,EAAE;QACZ,WAAW,EAAE,CAAC;QACd,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;;;;4DAwBgD;KACzD;IAED,KAAK,EAAE;QACL,IAAI,EAAE,OAAO;QACb,IAAI,EAAE,SAAS;QACf,WAAW,EAAE,+GAA+G;QAC5H,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;QACvC,QAAQ,EAAE,EAAE;QACZ,WAAW,EAAE,CAAC;QACd,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;qGAyByF;KAClG;IAED,OAAO,EAAE;QACP,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,UAAU;QAChB,WAAW,EAAE,sHAAsH;QACnI,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,CAAC;QAC5C,QAAQ,EAAE,CAAC;QACX,WAAW,EAAE,CAAC;QACd,MAAM,EAAE;;;;;;;;;;;;;;;;;;;qDAmByC,CAAC;4EACsB;KACzE;CACF,CAAA;AAED,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,CAAC,iBAAiB,CAAC;KAC3D,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,SAAS,CAAC;KACnC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA;AAErB,MAAM,CAAC,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,iBAAiB,CAAC;KACtD,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,UAAU,CAAC;KACpC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA;AAErB,MAAM,UAAU,oBAAoB,CAAC,SAAiB;IACpD,MAAM,GAAG,GAAG,iBAAiB,CAAC,SAAS,CAAC,CAAA;IACxC,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;AAClC,CAAC;AAED,MAAM,UAAU,kBAAkB,CAChC,QAAqB,EACrB,SAAiB;IAEjB,MAAM,OAAO,GAAG,oBAAoB,CAAC,SAAS,CAAC,CAAA;IAC/C,OAAO,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAA;AACzD,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Model } from "@mohanscodex/spectra-ai";
|
|
2
|
+
export interface AgentRegistryConfig {
|
|
3
|
+
model: Model;
|
|
4
|
+
getApiKey?: (provider: string) => Promise<string | undefined> | string | undefined;
|
|
5
|
+
}
|
|
6
|
+
export declare const AgentRegistry: {
|
|
7
|
+
setConfig(config: AgentRegistryConfig): void;
|
|
8
|
+
getConfig(): AgentRegistryConfig | null;
|
|
9
|
+
clear(): void;
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../src/agents/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AAEpD,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,KAAK,CAAA;IACZ,SAAS,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,GAAG,MAAM,GAAG,SAAS,CAAA;CACnF;AAID,eAAO,MAAM,aAAa;sBACN,mBAAmB;iBAGxB,mBAAmB,GAAG,IAAI;;CAMxC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../../src/agents/registry.ts"],"names":[],"mappings":"AAOA,IAAI,aAAa,GAA+B,IAAI,CAAA;AAEpD,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,SAAS,CAAC,MAA2B;QACnC,aAAa,GAAG,MAAM,CAAA;IACxB,CAAC;IACD,SAAS;QACP,OAAO,aAAa,CAAA;IACtB,CAAC;IACD,KAAK;QACH,aAAa,GAAG,IAAI,CAAA;IACtB,CAAC;CACF,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/cli.ts"],"names":[],"mappings":""}
|