@harperfast/agent 0.13.8 → 0.14.1

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.
Files changed (3) hide show
  1. package/README.md +38 -44
  2. package/dist/agent.js +4825 -1526
  3. package/package.json +10 -1
package/README.md CHANGED
@@ -13,22 +13,11 @@ AI to help you with Harper app creation and management.
13
13
 
14
14
  ## Getting Started
15
15
 
16
- When you first run `harper-agent`, it will prompt you for an API key if one is not found in your environment. It will then automatically save it to a `.env` file in your current working directory.
16
+ When you first run `harper-agent`, it will guide you through setting up your environment.
17
17
 
18
- If you prefer to set it manually, you can create a `.env` file:
18
+ ![What model provider would you like to use today? OpenAI, Anthropic, Google or Ollama](guidance/pick-a-provider.png)
19
19
 
20
- ```bash
21
- # For OpenAI (default)
22
- OPENAI_API_KEY=your_api_key_here
23
-
24
- # For Anthropic
25
- ANTHROPIC_API_KEY=your_api_key_here
26
-
27
- # For Google Gemini
28
- GOOGLE_GENERATIVE_AI_API_KEY=your_api_key_here
29
- ```
30
-
31
- (If you'd rather export these environment variables from within your .zshrc or equivalent file, you can do that instead.)
20
+ It will then automatically save it to either `~/.harper/harper-agent-env` or your local `.env` file in your current working directory.
32
21
 
33
22
  Now install harper-agent:
34
23
 
@@ -44,61 +33,72 @@ npx -y @harperfast/agent
44
33
 
45
34
  You're ready to go!
46
35
 
47
- ```bash
48
- > harper-agent
36
+ ![What would you like to create together?](guidance/what-would-you-like-to-create-together.png)
49
37
 
50
- Working directory: /Users/dawson/Code/softwork-beats
51
- Harper app detected: Yes
52
- Press Ctrl+C or hit enter twice to exit.
38
+ ## Usage
53
39
 
54
- Harper: What do you want to do together today?
40
+ Once installed or running, you can ask harper-agent to help you with tasks in your current directory, such as applying patches or managing your Harper application.
55
41
 
56
- >
57
- ```
42
+ Press `Ctrl+C` or type "exit" or hit enter twice to exit.
58
43
 
59
- ### Non-interactive: pipe an initial prompt
44
+ ### Non-interactive: pass an initial prompt
60
45
 
61
- You can pass an initial chat dump via stdin. This runs a one-shot interaction and exits after responding:
46
+ You can pass an initial `--prompt=`. Harper Agent will turn that into an actionable plan, and then it will iterate until it completes it.
62
47
 
63
48
  ```bash
64
- cat somePrompt.md | harper-agent
65
- # or
66
- harper-agent < somePrompt.md
49
+ harper-agent --prompt="Write a poem generation app, please"
67
50
  ```
68
51
 
69
52
  In this mode, the initial greeting question is suppressed, and the agent processes the provided prompt immediately.
70
53
 
54
+ ## Manual Environment Configuration
55
+
56
+ If you prefer to set up your environment manually, you can create a `.env` file:
57
+
58
+ ```bash
59
+ # For OpenAI (default)
60
+ OPENAI_API_KEY=your_api_key_here
61
+
62
+ # For Anthropic
63
+ ANTHROPIC_API_KEY=your_api_key_here
64
+
65
+ # For Google Gemini
66
+ GOOGLE_GENERATIVE_AI_API_KEY=your_api_key_here
67
+ ```
68
+
69
+ (If you'd rather export these environment variables from within your .zshrc or equivalent file, you can do that instead.)
70
+
71
71
  ## Model Selection
72
72
 
73
- By default, `harper-agent` uses OpenAI. You can switch to other models using the `--model` (or `-m`) flag:
73
+ When you first fire up Harper Agent, it will ask you what model you want to use. You can also control this with command line arguments:
74
74
 
75
75
  ```bash
76
76
  # Use Claude 3.5 Sonnet
77
- harper-agent --model claude-3-5-sonnet-20241022
77
+ harper-agent --model claude-4-6-opus-latest
78
78
 
79
79
  # Use Gemini 1.5 Pro
80
- harper-agent --model gemini-1.5-pro
80
+ harper-agent --model gemini-3-pro
81
81
 
82
82
  # Use a specific OpenAI model
83
- harper-agent --model gpt-4o-mini
83
+ harper-agent --model gpt-5.2
84
84
  ```
85
85
 
86
- You can also set the default model via the `HARPER_AGENT_MODEL` environment variable.
86
+ Or you can set the default model via the `HARPER_AGENT_MODEL` environment variable in your `.env` file or in `~/.harper/harper-agent-env`
87
87
 
88
88
  ### Compaction Model
89
89
 
90
- By default, `harper-agent` uses `gpt-4o-mini` for session memory compaction. You can switch this to another model using the `--compaction-model` (or `-c`) flag:
90
+ A smaller model will be used for compaction, depending on your chosen LLM provider. You can specify your model using the `--compaction-model` (or `-c`) flag:
91
91
 
92
92
  ```bash
93
93
  # Use a different compaction model
94
- harper-agent --compaction-model claude-3-haiku-20240307
94
+ harper-agent --compaction-model claude-4-5-haiku-latest
95
95
  ```
96
96
 
97
97
  You can also set the default compaction model via the `HARPER_AGENT_COMPACTION_MODEL` environment variable.
98
98
 
99
99
  ### Session Persistence
100
100
 
101
- By default, `harper-agent` uses an in-memory session that is lost when you exit. You can persist your chat session to a SQLite database on disk using the `--session` (or `-s`) flag:
101
+ Harper Agent will ask if it can persist your chat session to a JSON database on disk using the `--session` (or `-s`) flag:
102
102
 
103
103
  ```bash
104
104
  # Persist session to a file
@@ -128,21 +128,21 @@ To use local models with [Ollama](https://ollama.com/), use the `ollama-` prefix
128
128
 
129
129
  ```bash
130
130
  # Use Llama 3 via Ollama
131
- harper-agent --model ollama-llama3
131
+ harper-agent --model ollama-qwen2.5-coder
132
132
  ```
133
133
 
134
134
  If your Ollama instance is running on a custom URL, you can set the `OLLAMA_BASE_URL` environment variable:
135
135
 
136
136
  ```bash
137
137
  export OLLAMA_BASE_URL=http://localhost:11434
138
- harper-agent --model ollama-llama3
138
+ harper-agent --model ollama-qwen2.5-coder
139
139
  ```
140
140
 
141
141
  ### OpenAI API Key Permissions
142
142
 
143
143
  If you are using a restricted API key, ensure the following permissions are enabled:
144
144
 
145
- - **Models**: `Write` access for `gpt-5.2` (the main model) and `gpt-4o-mini` (the memory summarizer)
145
+ - **Models**: `Write` access for `gpt-5.2` (the main model) and `gpt-5-nano` (the memory summarizer)
146
146
  - **Model capabilities**: `Write` (to allow tool calling and completions).
147
147
 
148
148
  No other permissions (like Assistants, Threads, or Files) are required as `harper-agent` runs its tools locally.
@@ -176,9 +176,3 @@ npm link
176
176
  ```
177
177
 
178
178
  Now you can run `harper-agent` from any directory.
179
-
180
- ## Usage
181
-
182
- Once installed or running, you can ask harper-agent to help you with tasks in your current directory, such as applying patches or managing your Harper application.
183
-
184
- Press `Ctrl+C` or hit enter twice to exit.