@iambarryking/ag 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +199 -0
- package/dist/cli/parser.d.ts +6 -0
- package/dist/cli/parser.d.ts.map +1 -0
- package/dist/cli/parser.js +69 -0
- package/dist/cli/parser.js.map +1 -0
- package/dist/cli/repl.d.ts +10 -0
- package/dist/cli/repl.d.ts.map +1 -0
- package/dist/cli/repl.js +256 -0
- package/dist/cli/repl.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +80 -0
- package/dist/cli.js.map +1 -0
- package/dist/core/agent.d.ts +54 -0
- package/dist/core/agent.d.ts.map +1 -0
- package/dist/core/agent.js +137 -0
- package/dist/core/agent.js.map +1 -0
- package/dist/core/colors.d.ts +10 -0
- package/dist/core/colors.d.ts.map +1 -0
- package/dist/core/colors.js +5 -0
- package/dist/core/colors.js.map +1 -0
- package/dist/core/config.d.ts +11 -0
- package/dist/core/config.d.ts.map +1 -0
- package/dist/core/config.js +30 -0
- package/dist/core/config.js.map +1 -0
- package/dist/core/loader.d.ts +3 -0
- package/dist/core/loader.d.ts.map +1 -0
- package/dist/core/loader.js +39 -0
- package/dist/core/loader.js.map +1 -0
- package/dist/core/types.d.ts +47 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/types.js +2 -0
- package/dist/core/types.js.map +1 -0
- package/dist/memory/memory.d.ts +38 -0
- package/dist/memory/memory.d.ts.map +1 -0
- package/dist/memory/memory.js +153 -0
- package/dist/memory/memory.js.map +1 -0
- package/dist/tools/bash.d.ts +6 -0
- package/dist/tools/bash.d.ts.map +1 -0
- package/dist/tools/bash.js +37 -0
- package/dist/tools/bash.js.map +1 -0
- package/dist/tools/memory.d.ts +3 -0
- package/dist/tools/memory.d.ts.map +1 -0
- package/dist/tools/memory.js +27 -0
- package/dist/tools/memory.js.map +1 -0
- package/dist/tools/plan.d.ts +4 -0
- package/dist/tools/plan.d.ts.map +1 -0
- package/dist/tools/plan.js +49 -0
- package/dist/tools/plan.js.map +1 -0
- package/package.json +28 -0
package/README.md
ADDED
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
# ag
|
|
2
|
+
|
|
3
|
+
A persistent AI coding agent with memory. Any model via OpenRouter.
|
|
4
|
+
|
|
5
|
+
Built as a tool-calling loop with bash -- inspired by [How does Claude Code actually work?](https://youtu.be/I82j7AzMU80). Started as 60 lines, grew to ~600 because persistent memory, plans, and a REPL are worth the extra lines.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npx @iambarryking/ag # run directly (prompts for API key on first use)
|
|
11
|
+
npm install -g @iambarryking/ag # or install globally
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Or from source:
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
git clone <repo>
|
|
18
|
+
cd simple-agent
|
|
19
|
+
npm install && npm run build && npm link
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Usage
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
ag # interactive REPL
|
|
26
|
+
ag "what files are here?" # one-shot mode
|
|
27
|
+
ag -m openai/gpt-4o "help me" # specific model
|
|
28
|
+
ag -m openrouter/auto "help" # let OpenRouter pick
|
|
29
|
+
ag --stats # show memory status
|
|
30
|
+
ag --help # all options
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
On first run, `ag` prompts for your OpenRouter API key and saves it to `~/.ag/config.json`. You can also set it via environment variable:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
export OPENROUTER_API_KEY=sk-or-v1-...
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## CLI Options
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
-m, --model <model> Model ID (default: anthropic/claude-sonnet-4.6)
|
|
43
|
+
-k, --key <key> API key (or set OPENROUTER_API_KEY)
|
|
44
|
+
-s, --system <prompt> Custom system prompt
|
|
45
|
+
-b, --base-url <url> API base URL (default: OpenRouter; use for local LLMs)
|
|
46
|
+
-n, --max-iterations <n> Max tool-call iterations (default: 25)
|
|
47
|
+
--stats Show memory file paths and status
|
|
48
|
+
-h, --help Show help
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## REPL Commands
|
|
52
|
+
|
|
53
|
+
```
|
|
54
|
+
/help Show all commands
|
|
55
|
+
/model <name> Switch model (e.g. /model openai/gpt-4o)
|
|
56
|
+
/model Show current model
|
|
57
|
+
/models [query] List OpenRouter models (e.g. /models claude, /models gemini)
|
|
58
|
+
/tools List loaded tools (built-in + custom)
|
|
59
|
+
/config Show persistent config (API key, model, base URL)
|
|
60
|
+
/config set <k> <v> Set a config value (e.g. /config set model openai/gpt-4o)
|
|
61
|
+
/stats Memory status
|
|
62
|
+
/memory Show global memory
|
|
63
|
+
/project Show project memory
|
|
64
|
+
/plan Show current (latest) plan
|
|
65
|
+
/plan use <name> Activate an older plan (copies as latest)
|
|
66
|
+
/plans List all plans
|
|
67
|
+
/paths Show memory file paths
|
|
68
|
+
/clear project Clear project memory, plans, and history
|
|
69
|
+
/clear all Clear everything including global memory
|
|
70
|
+
/exit Exit
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Tools
|
|
74
|
+
|
|
75
|
+
| Tool | Purpose |
|
|
76
|
+
|------|---------|
|
|
77
|
+
| `bash` | Run any shell command. The universal tool. |
|
|
78
|
+
| `save_memory` | Persist a fact to global or project memory. |
|
|
79
|
+
| `save_plan` | Save a task plan (timestamped, latest auto-loaded). |
|
|
80
|
+
| `list_plans` | List or read previous plans. |
|
|
81
|
+
|
|
82
|
+
## Custom Tools
|
|
83
|
+
|
|
84
|
+
Drop a `.mjs` file in a tools directory and it gets loaded at startup:
|
|
85
|
+
|
|
86
|
+
```
|
|
87
|
+
~/.ag/tools/ # global (all projects)
|
|
88
|
+
.ag/tools/ # project-local (overrides global if same name)
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Each file exports a default tool object:
|
|
92
|
+
|
|
93
|
+
```js
|
|
94
|
+
// ~/.ag/tools/weather.mjs
|
|
95
|
+
export default {
|
|
96
|
+
type: "function",
|
|
97
|
+
function: {
|
|
98
|
+
name: "weather",
|
|
99
|
+
description: "Get current weather for a city",
|
|
100
|
+
parameters: {
|
|
101
|
+
type: "object",
|
|
102
|
+
properties: { city: { type: "string", description: "City name" } },
|
|
103
|
+
required: ["city"]
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
execute: ({ city }) => {
|
|
107
|
+
// your logic here -- can be async
|
|
108
|
+
return `Weather in ${city}: sunny, 22C`;
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
That's it. No config, no registry. Use `/tools` in the REPL to see what's loaded.
|
|
114
|
+
|
|
115
|
+
## Configuration
|
|
116
|
+
|
|
117
|
+
Persistent settings are stored in `~/.ag/config.json`:
|
|
118
|
+
|
|
119
|
+
```json
|
|
120
|
+
{
|
|
121
|
+
"apiKey": "sk-or-v1-...",
|
|
122
|
+
"model": "anthropic/claude-sonnet-4.6",
|
|
123
|
+
"baseURL": "https://openrouter.ai/api/v1",
|
|
124
|
+
"maxIterations": 25
|
|
125
|
+
}
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Set values via the REPL (`/config set model openai/gpt-4o`) or edit the file directly. CLI flags and environment variables always take priority over config file values.
|
|
129
|
+
|
|
130
|
+
## Memory
|
|
131
|
+
|
|
132
|
+
Three tiers, all plain markdown you can edit directly:
|
|
133
|
+
|
|
134
|
+
```
|
|
135
|
+
~/.ag/
|
|
136
|
+
config.json # settings: API key, default model, base URL
|
|
137
|
+
memory.md # global: preferences, patterns
|
|
138
|
+
projects/
|
|
139
|
+
<id>/
|
|
140
|
+
memory.md # project: architecture, decisions
|
|
141
|
+
plans/ # timestamped plan files
|
|
142
|
+
2026-04-13T12-31-22-add-auth.md
|
|
143
|
+
history.jsonl # conversation history
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
All memory is injected into the system prompt on every API call (capped at ~6000 chars total to avoid context bloat). The agent reads it automatically and writes via `save_memory` and `save_plan`.
|
|
147
|
+
|
|
148
|
+
## Local LLMs
|
|
149
|
+
|
|
150
|
+
Point `ag` at any OpenAI-compatible API:
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
ag -b http://localhost:11434/v1 "hello" # Ollama
|
|
154
|
+
ag -b http://localhost:1234/v1 "hello" # LM Studio
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
Or set it permanently:
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
# In the REPL:
|
|
161
|
+
/config set baseURL http://localhost:11434/v1
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
## Workflow
|
|
165
|
+
|
|
166
|
+
- For multi-step coding tasks, the agent creates a plan before starting and updates it as it goes.
|
|
167
|
+
- For simple questions, it just answers directly.
|
|
168
|
+
- At 25 iterations the REPL asks if you want to continue.
|
|
169
|
+
|
|
170
|
+
## When to use something else
|
|
171
|
+
|
|
172
|
+
- **Claude Code** -- if you have a subscription and want the full harness with parallel tool calls, MCP, and a polished UI. ag is not trying to replace it.
|
|
173
|
+
- **aider** -- if your workflow is git-centric (commit-per-change, diff-based editing). ag doesn't know about git.
|
|
174
|
+
- **Cursor / Windsurf** -- if you want IDE integration. ag is terminal-only.
|
|
175
|
+
|
|
176
|
+
ag is for when you want a hackable, persistent, model-agnostic agent you fully control in ~600 lines of TypeScript.
|
|
177
|
+
|
|
178
|
+
## Architecture
|
|
179
|
+
|
|
180
|
+
```
|
|
181
|
+
src/
|
|
182
|
+
cli.ts # entry point
|
|
183
|
+
cli/parser.ts # arg parsing + help
|
|
184
|
+
cli/repl.ts # interactive REPL
|
|
185
|
+
core/agent.ts # the loop
|
|
186
|
+
core/config.ts # persistent config (~/.ag/config.json)
|
|
187
|
+
core/types.ts # interfaces
|
|
188
|
+
core/colors.ts # ANSI colors (respects NO_COLOR)
|
|
189
|
+
memory/memory.ts # three-tier file memory
|
|
190
|
+
tools/bash.ts # shell execution
|
|
191
|
+
tools/memory.ts # save_memory tool
|
|
192
|
+
tools/plan.ts # save_plan + list_plans
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
Zero npm dependencies. Node.js 18+ and TypeScript.
|
|
196
|
+
|
|
197
|
+
## License
|
|
198
|
+
|
|
199
|
+
MIT
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../src/cli/parser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,UAAU,GAAG;IAAE,UAAU,EAAE,MAAM,EAAE,CAAA;CAAE,CAiB/E;AAED,wBAAgB,QAAQ,IAAI,IAAI,CA2C/B"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
export function parseArgs(args) {
|
|
2
|
+
const options = {};
|
|
3
|
+
const positional = [];
|
|
4
|
+
for (let i = 0; i < args.length; i++) {
|
|
5
|
+
const arg = args[i];
|
|
6
|
+
if ((arg === '--model' || arg === '-m') && i + 1 < args.length)
|
|
7
|
+
options.model = args[++i];
|
|
8
|
+
else if ((arg === '--key' || arg === '-k') && i + 1 < args.length)
|
|
9
|
+
options.key = args[++i];
|
|
10
|
+
else if ((arg === '--system' || arg === '-s') && i + 1 < args.length)
|
|
11
|
+
options.system = args[++i];
|
|
12
|
+
else if ((arg === '--base-url' || arg === '-b') && i + 1 < args.length)
|
|
13
|
+
options.baseURL = args[++i];
|
|
14
|
+
else if ((arg === '--max-iterations' || arg === '-n') && i + 1 < args.length)
|
|
15
|
+
options.maxIterations = parseInt(args[++i], 10);
|
|
16
|
+
else if (arg === '--stats')
|
|
17
|
+
options.stats = true;
|
|
18
|
+
else if (arg === '--help' || arg === '-h')
|
|
19
|
+
options.help = true;
|
|
20
|
+
else if (!arg.startsWith('-'))
|
|
21
|
+
positional.push(arg);
|
|
22
|
+
}
|
|
23
|
+
return { ...options, positional };
|
|
24
|
+
}
|
|
25
|
+
export function showHelp() {
|
|
26
|
+
console.log(`
|
|
27
|
+
ag - Persistent AI coding agent with memory (any model via OpenRouter)
|
|
28
|
+
|
|
29
|
+
Usage:
|
|
30
|
+
ag # Interactive REPL
|
|
31
|
+
ag "what files are here?" # One-shot mode
|
|
32
|
+
ag --stats # Show memory stats
|
|
33
|
+
ag -m openai/gpt-4o "help me" # Use specific model
|
|
34
|
+
|
|
35
|
+
Options:
|
|
36
|
+
-m, --model <model> Model ID (default: anthropic/claude-sonnet-4.6)
|
|
37
|
+
-k, --key <key> API key (or set OPENROUTER_API_KEY)
|
|
38
|
+
-s, --system <prompt> Custom system prompt
|
|
39
|
+
-b, --base-url <url> API base URL (default: OpenRouter; use for local LLMs)
|
|
40
|
+
-n, --max-iterations <n> Max tool-call iterations (default: 25)
|
|
41
|
+
--stats Show memory file locations and status
|
|
42
|
+
-h, --help Show this help
|
|
43
|
+
|
|
44
|
+
Config:
|
|
45
|
+
On first run, ag prompts for your API key and saves it to ~/.ag/config.json.
|
|
46
|
+
Use /config in the REPL to view or change persistent settings.
|
|
47
|
+
|
|
48
|
+
Memory (all files editable):
|
|
49
|
+
~/.ag/config.json Settings: API key, default model, base URL
|
|
50
|
+
~/.ag/memory.md Global: patterns, preferences, facts
|
|
51
|
+
~/.ag/projects/<id>/memory.md Project: architecture, decisions, gotchas
|
|
52
|
+
~/.ag/projects/<id>/plans/ Plans: timestamped, latest auto-loaded
|
|
53
|
+
~/.ag/projects/<id>/history.jsonl Conversation history
|
|
54
|
+
|
|
55
|
+
REPL commands:
|
|
56
|
+
/help, /model, /models, /tools, /config, /stats, /memory,
|
|
57
|
+
/project, /plan, /plans, /paths, /clear, /exit
|
|
58
|
+
|
|
59
|
+
Install:
|
|
60
|
+
npx @iambarryking/ag # Run directly
|
|
61
|
+
npm install -g @iambarryking/ag # Install globally
|
|
62
|
+
|
|
63
|
+
Examples:
|
|
64
|
+
ag "debug this typescript error"
|
|
65
|
+
ag -m google/gemini-2.5-flash "refactor this"
|
|
66
|
+
ag -b http://localhost:11434/v1 "hello" # Local Ollama
|
|
67
|
+
`);
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=parser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parser.js","sourceRoot":"","sources":["../../src/cli/parser.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,SAAS,CAAC,IAAc;IACtC,MAAM,OAAO,GAAe,EAAE,CAAC;IAC/B,MAAM,UAAU,GAAa,EAAE,CAAC;IAEhC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACrC,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QACpB,IAAI,CAAC,GAAG,KAAK,SAAS,IAAI,GAAG,KAAK,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,MAAM;YAAE,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;aACrF,IAAI,CAAC,GAAG,KAAK,OAAO,IAAI,GAAG,KAAK,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,MAAM;YAAE,OAAO,CAAC,GAAG,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;aACtF,IAAI,CAAC,GAAG,KAAK,UAAU,IAAI,GAAG,KAAK,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,MAAM;YAAE,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;aAC5F,IAAI,CAAC,GAAG,KAAK,YAAY,IAAI,GAAG,KAAK,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,IA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 'node:readline';
|
|
2
|
+
import { loadConfig, saveConfig, configPath } from '../core/config.js';
|
|
3
|
+
import { C } from '../core/colors.js';
|
|
4
|
+
function maskKey(key) {
|
|
5
|
+
if (key.length <= 8)
|
|
6
|
+
return '****';
|
|
7
|
+
return key.slice(0, 8) + '****';
|
|
8
|
+
}
|
|
9
|
+
export class REPL {
|
|
10
|
+
agent;
|
|
11
|
+
rl;
|
|
12
|
+
constructor(agent) {
|
|
13
|
+
this.agent = agent;
|
|
14
|
+
this.rl = createInterface({ input: process.stdin, output: process.stderr });
|
|
15
|
+
}
|
|
16
|
+
async start() {
|
|
17
|
+
const stats = this.agent.getStats();
|
|
18
|
+
console.error(`${C.bold}ag${C.reset} ${C.dim}(${this.agent.getModel()} via OpenRouter)${C.reset}`);
|
|
19
|
+
if (stats.globalMemory || stats.projectMemory || stats.planCount > 0) {
|
|
20
|
+
const loaded = [stats.globalMemory && 'global', stats.projectMemory && 'project', stats.planCount > 0 && `${stats.planCount} plan(s)`].filter(Boolean);
|
|
21
|
+
console.error(`${C.dim}Memory loaded: ${loaded.join(', ')}${C.reset}`);
|
|
22
|
+
}
|
|
23
|
+
if (stats.historyLines > 0) {
|
|
24
|
+
console.error(`${C.dim}History: ${stats.historyLines} messages${C.reset}`);
|
|
25
|
+
}
|
|
26
|
+
console.error(`${C.dim}Commands: /help${C.reset}\n`);
|
|
27
|
+
while (true) {
|
|
28
|
+
try {
|
|
29
|
+
const input = await this.ask(`${C.green}you>${C.reset} `);
|
|
30
|
+
if (!input.trim())
|
|
31
|
+
continue;
|
|
32
|
+
if (input.startsWith('/')) {
|
|
33
|
+
await this.handleCommand(input);
|
|
34
|
+
continue;
|
|
35
|
+
}
|
|
36
|
+
let response = await this.agent.chat(input);
|
|
37
|
+
while (response === '[Max iterations reached]') {
|
|
38
|
+
console.error(`${C.yellow}Reached iteration limit.${C.reset}`);
|
|
39
|
+
const answer = await this.ask(`${C.yellow}Continue? (y/n)>${C.reset} `);
|
|
40
|
+
if (answer.trim().toLowerCase() !== 'y')
|
|
41
|
+
break;
|
|
42
|
+
response = await this.agent.chat('continue where you left off');
|
|
43
|
+
}
|
|
44
|
+
if (response !== '[Max iterations reached]') {
|
|
45
|
+
console.log(`\n${C.bold}agent>${C.reset} ${response}\n`);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
catch (error) {
|
|
49
|
+
console.error(`${C.red}Error: ${error.message}${C.reset}\n`);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
async handleCommand(command) {
|
|
54
|
+
const [cmd, ...args] = command.slice(1).split(' ');
|
|
55
|
+
const sub = cmd.toLowerCase();
|
|
56
|
+
switch (sub) {
|
|
57
|
+
case 'help':
|
|
58
|
+
console.error(`${C.bold}Commands:${C.reset}`);
|
|
59
|
+
console.error(` ${C.cyan}/help${C.reset} Show this help`);
|
|
60
|
+
console.error(` ${C.cyan}/model <name>${C.reset} Switch model (e.g. anthropic/claude-sonnet-4.6)`);
|
|
61
|
+
console.error(` ${C.cyan}/models [query]${C.reset} List OpenRouter models (e.g. /models claude)`);
|
|
62
|
+
console.error(` ${C.cyan}/tools${C.reset} List loaded tools`);
|
|
63
|
+
console.error(` ${C.cyan}/config${C.reset} Show persistent config`);
|
|
64
|
+
console.error(` ${C.cyan}/config set <k> <v>${C.reset} Set a config value`);
|
|
65
|
+
console.error(` ${C.cyan}/stats${C.reset} Memory status`);
|
|
66
|
+
console.error(` ${C.cyan}/memory${C.reset} Show global memory`);
|
|
67
|
+
console.error(` ${C.cyan}/project${C.reset} Show project memory`);
|
|
68
|
+
console.error(` ${C.cyan}/plan${C.reset} Show current (latest) plan`);
|
|
69
|
+
console.error(` ${C.cyan}/plan use <name>${C.reset} Activate an older plan (copies as latest)`);
|
|
70
|
+
console.error(` ${C.cyan}/plans${C.reset} List all plans`);
|
|
71
|
+
console.error(` ${C.cyan}/clear project${C.reset} Clear project memory + plan + history`);
|
|
72
|
+
console.error(` ${C.cyan}/clear all${C.reset} Clear everything including global`);
|
|
73
|
+
console.error(` ${C.cyan}/paths${C.reset} Show memory file paths`);
|
|
74
|
+
console.error(` ${C.cyan}/exit${C.reset} Exit`);
|
|
75
|
+
console.error('');
|
|
76
|
+
break;
|
|
77
|
+
case 'model':
|
|
78
|
+
if (!args[0]) {
|
|
79
|
+
console.error(`${C.dim}Current model: ${this.agent.getModel()}${C.reset}\n`);
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
this.agent.setModel(args.join('/'));
|
|
83
|
+
console.error(`${C.yellow}Model set to: ${this.agent.getModel()}${C.reset}\n`);
|
|
84
|
+
}
|
|
85
|
+
break;
|
|
86
|
+
case 'models': {
|
|
87
|
+
const query = args.join(' ');
|
|
88
|
+
console.error(`${C.dim}Fetching models from OpenRouter...${C.reset}`);
|
|
89
|
+
try {
|
|
90
|
+
const models = await this.agent.fetchModels(query || undefined);
|
|
91
|
+
if (models.length === 0) {
|
|
92
|
+
console.error(`${C.dim}No models found${query ? ` matching "${query}"` : ''}.${C.reset}\n`);
|
|
93
|
+
break;
|
|
94
|
+
}
|
|
95
|
+
const current = this.agent.getModel();
|
|
96
|
+
const shown = models.slice(0, 30);
|
|
97
|
+
for (const m of shown) {
|
|
98
|
+
const marker = m.id === current ? C.green + '> ' : ' ';
|
|
99
|
+
const ctx = m.context_length ? `${C.dim}${Math.round(m.context_length / 1000)}k${C.reset}` : '';
|
|
100
|
+
const price = m.pricing?.prompt ? `${C.dim}$${(parseFloat(m.pricing.prompt) * 1_000_000).toFixed(2)}/M${C.reset}` : '';
|
|
101
|
+
console.error(`${marker}${C.cyan}${m.id}${C.reset} ${ctx} ${price}`);
|
|
102
|
+
}
|
|
103
|
+
if (models.length > 30)
|
|
104
|
+
console.error(`${C.dim} ...and ${models.length - 30} more. Filter with /models <query>${C.reset}`);
|
|
105
|
+
console.error(`${C.dim} Use /model <id> to switch${C.reset}\n`);
|
|
106
|
+
}
|
|
107
|
+
catch (e) {
|
|
108
|
+
console.error(`${C.red}Error fetching models: ${e.message}${C.reset}\n`);
|
|
109
|
+
}
|
|
110
|
+
break;
|
|
111
|
+
}
|
|
112
|
+
case 'tools': {
|
|
113
|
+
const tools = this.agent.getTools();
|
|
114
|
+
console.error(`${C.bold}Tools (${tools.length}):${C.reset}`);
|
|
115
|
+
for (const t of tools) {
|
|
116
|
+
console.error(` ${C.cyan}${t.name}${C.reset} ${C.dim}${t.description.slice(0, 70)}${t.description.length > 70 ? '...' : ''}${C.reset}`);
|
|
117
|
+
}
|
|
118
|
+
console.error('');
|
|
119
|
+
break;
|
|
120
|
+
}
|
|
121
|
+
case 'config': {
|
|
122
|
+
if (args[0]?.toLowerCase() === 'set' && args[1]) {
|
|
123
|
+
const key = args[1];
|
|
124
|
+
const value = args.slice(2).join(' ');
|
|
125
|
+
if (!value) {
|
|
126
|
+
console.error(`${C.red}Usage: /config set <key> <value>${C.reset}\n`);
|
|
127
|
+
break;
|
|
128
|
+
}
|
|
129
|
+
const validKeys = ['apiKey', 'model', 'baseURL', 'systemPrompt', 'maxIterations'];
|
|
130
|
+
if (!validKeys.includes(key)) {
|
|
131
|
+
console.error(`${C.red}Valid keys: ${validKeys.join(', ')}${C.reset}\n`);
|
|
132
|
+
break;
|
|
133
|
+
}
|
|
134
|
+
const parsed = key === 'maxIterations' ? parseInt(value, 10) : value;
|
|
135
|
+
saveConfig({ [key]: parsed });
|
|
136
|
+
const display = key === 'apiKey' ? maskKey(value) : value;
|
|
137
|
+
console.error(`${C.yellow}Config: ${key} = ${display}${C.reset}`);
|
|
138
|
+
console.error(`${C.dim}Saved to ${configPath()}${C.reset}\n`);
|
|
139
|
+
}
|
|
140
|
+
else if (args[0]?.toLowerCase() === 'path') {
|
|
141
|
+
console.error(`${C.dim}${configPath()}${C.reset}\n`);
|
|
142
|
+
}
|
|
143
|
+
else {
|
|
144
|
+
const cfg = loadConfig();
|
|
145
|
+
console.error(`${C.bold}Config${C.reset} ${C.dim}(${configPath()})${C.reset}`);
|
|
146
|
+
if (cfg.apiKey)
|
|
147
|
+
console.error(` apiKey: ${C.dim}${maskKey(cfg.apiKey)}${C.reset}`);
|
|
148
|
+
if (cfg.model)
|
|
149
|
+
console.error(` model: ${C.cyan}${cfg.model}${C.reset}`);
|
|
150
|
+
if (cfg.baseURL)
|
|
151
|
+
console.error(` baseURL: ${C.dim}${cfg.baseURL}${C.reset}`);
|
|
152
|
+
if (cfg.systemPrompt)
|
|
153
|
+
console.error(` systemPrompt: ${C.dim}${cfg.systemPrompt.slice(0, 60)}...${C.reset}`);
|
|
154
|
+
if (cfg.maxIterations)
|
|
155
|
+
console.error(` maxIterations: ${C.cyan}${cfg.maxIterations}${C.reset}`);
|
|
156
|
+
if (!cfg.apiKey && !cfg.model && !cfg.baseURL && !cfg.systemPrompt && !cfg.maxIterations) {
|
|
157
|
+
console.error(`${C.dim} (empty — using defaults and env vars)${C.reset}`);
|
|
158
|
+
}
|
|
159
|
+
console.error('');
|
|
160
|
+
}
|
|
161
|
+
break;
|
|
162
|
+
}
|
|
163
|
+
case 'stats': {
|
|
164
|
+
const stats = this.agent.getStats();
|
|
165
|
+
console.error(`${C.bold}Memory${C.reset}`);
|
|
166
|
+
console.error(` Global memory: ${stats.globalMemory ? C.green + 'yes' : C.dim + 'none'}${C.reset}`);
|
|
167
|
+
console.error(` Project memory: ${stats.projectMemory ? C.green + 'yes' : C.dim + 'none'}${C.reset}`);
|
|
168
|
+
console.error(` Plans: ${C.cyan}${stats.planCount}${C.reset}`);
|
|
169
|
+
console.error(` History: ${C.cyan}${stats.historyLines}${C.reset} messages`);
|
|
170
|
+
console.error('');
|
|
171
|
+
break;
|
|
172
|
+
}
|
|
173
|
+
case 'memory': {
|
|
174
|
+
const content = this.agent.getGlobalMemory();
|
|
175
|
+
console.error(content ? `${C.bold}Global memory:${C.reset}\n${content}\n` : `${C.dim}No global memory. Edit ~/.ag/memory.md${C.reset}\n`);
|
|
176
|
+
break;
|
|
177
|
+
}
|
|
178
|
+
case 'project': {
|
|
179
|
+
const content = this.agent.getProjectMemory();
|
|
180
|
+
console.error(content ? `${C.bold}Project memory:${C.reset}\n${content}\n` : `${C.dim}No project memory yet.${C.reset}\n`);
|
|
181
|
+
break;
|
|
182
|
+
}
|
|
183
|
+
case 'plan': {
|
|
184
|
+
if (args[0]?.toLowerCase() === 'use' && args[1]) {
|
|
185
|
+
const name = args.slice(1).join(' ');
|
|
186
|
+
const plans = this.agent.getPlans();
|
|
187
|
+
const match = plans.find(p => p.name.includes(name));
|
|
188
|
+
if (!match) {
|
|
189
|
+
console.error(`${C.red}No plan matching "${name}". Use /plans to list.${C.reset}\n`);
|
|
190
|
+
break;
|
|
191
|
+
}
|
|
192
|
+
const content = this.agent.getPlanByName(match.name);
|
|
193
|
+
if (!content) {
|
|
194
|
+
console.error(`${C.red}Plan is empty.${C.reset}\n`);
|
|
195
|
+
break;
|
|
196
|
+
}
|
|
197
|
+
this.agent.setPlan(content, match.name.replace(/^\d{4}-\d{2}-\d{2}T[\d-]+-?/, '').replace(/-/g, ' ').trim() || undefined);
|
|
198
|
+
console.error(`${C.yellow}Activated plan: ${match.name}${C.reset}`);
|
|
199
|
+
console.error(`${C.dim}(copied as new latest plan)${C.reset}\n`);
|
|
200
|
+
}
|
|
201
|
+
else {
|
|
202
|
+
const content = this.agent.getPlan();
|
|
203
|
+
console.error(content ? `${C.bold}Current plan (latest):${C.reset}\n${content}\n` : `${C.dim}No plans yet.${C.reset}\n`);
|
|
204
|
+
}
|
|
205
|
+
break;
|
|
206
|
+
}
|
|
207
|
+
case 'plans': {
|
|
208
|
+
const plans = this.agent.getPlans();
|
|
209
|
+
if (plans.length === 0) {
|
|
210
|
+
console.error(`${C.dim}No plans yet.${C.reset}\n`);
|
|
211
|
+
break;
|
|
212
|
+
}
|
|
213
|
+
console.error(`${C.bold}Plans (${plans.length}):${C.reset}`);
|
|
214
|
+
plans.forEach((p, i) => console.error(` ${i === 0 ? C.green + '>' : ' '} ${p.name}${C.reset}`));
|
|
215
|
+
console.error('');
|
|
216
|
+
break;
|
|
217
|
+
}
|
|
218
|
+
case 'paths': {
|
|
219
|
+
const p = this.agent.getPaths();
|
|
220
|
+
console.error(`${C.bold}Memory files:${C.reset}`);
|
|
221
|
+
console.error(` Config: ${configPath()}`);
|
|
222
|
+
console.error(` Global: ${p.globalMemory}`);
|
|
223
|
+
console.error(` Project: ${p.projectMemory}`);
|
|
224
|
+
console.error(` Plans: ${p.plansDir}/`);
|
|
225
|
+
console.error(` History: ${p.history}`);
|
|
226
|
+
console.error('');
|
|
227
|
+
break;
|
|
228
|
+
}
|
|
229
|
+
case 'clear': {
|
|
230
|
+
const target = args[0]?.toLowerCase();
|
|
231
|
+
if (target === 'project') {
|
|
232
|
+
this.agent.clearProject();
|
|
233
|
+
console.error(`${C.yellow}Project memory, plan, and history cleared.${C.reset}\n`);
|
|
234
|
+
}
|
|
235
|
+
else if (target === 'all') {
|
|
236
|
+
this.agent.clearAll();
|
|
237
|
+
console.error(`${C.yellow}All memory cleared.${C.reset}\n`);
|
|
238
|
+
}
|
|
239
|
+
else {
|
|
240
|
+
console.error(`${C.dim}Usage: /clear project or /clear all${C.reset}\n`);
|
|
241
|
+
}
|
|
242
|
+
break;
|
|
243
|
+
}
|
|
244
|
+
case 'exit':
|
|
245
|
+
case 'quit':
|
|
246
|
+
console.error(`${C.dim}Goodbye!${C.reset}`);
|
|
247
|
+
process.exit(0);
|
|
248
|
+
default:
|
|
249
|
+
console.error(`${C.red}Unknown command: ${sub}. Type /help${C.reset}\n`);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
ask(prompt) {
|
|
253
|
+
return new Promise(resolve => this.rl.question(prompt, resolve));
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
//# sourceMappingURL=repl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repl.js","sourceRoot":"","sources":["../../src/cli/repl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAa,MAAM,eAAe,CAAC;AAE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