@harperfast/agent 0.10.6

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 ADDED
@@ -0,0 +1,172 @@
1
+ ![](assets/logo.png) ![npx -y harper-agent](./README.svg)
2
+
3
+ AI to help you with Harper app creation and management.
4
+
5
+ ## Prerequisites
6
+
7
+ - Node.js (v24 or higher recommended)
8
+ - An API key for your preferred AI model:
9
+ - **OpenAI**: https://platform.openai.com/api-keys
10
+ - **Anthropic**: https://console.anthropic.com/settings/keys
11
+ - **Google Gemini**: https://aistudio.google.com/app/apikey
12
+ - **Ollama**: (No API key required, see [Ollama Support](#ollama-support-local-models) below)
13
+
14
+ ## Getting Started
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.
17
+
18
+ If you prefer to set it manually, you can create a `.env` file:
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.)
32
+
33
+ Now install harper-agent:
34
+
35
+ ```bash
36
+ npm install -g @harperfast/agent
37
+ ```
38
+
39
+ Or run it with npx:
40
+
41
+ ```
42
+ npx -y @harperfast/agent
43
+ ```
44
+
45
+ You're ready to go!
46
+
47
+ ```bash
48
+ > harper-agent
49
+
50
+ Working directory: /Users/dawson/Code/softwork-beats
51
+ Harper app detected: Yes
52
+ Press Ctrl+C or hit enter twice to exit.
53
+
54
+ Harper: What do you want to do together today?
55
+
56
+ >
57
+ ```
58
+
59
+ ## Model Selection
60
+
61
+ By default, `harper-agent` uses OpenAI. You can switch to other models using the `--model` (or `-m`) flag:
62
+
63
+ ```bash
64
+ # Use Claude 3.5 Sonnet
65
+ harper-agent --model claude-3-5-sonnet-20241022
66
+
67
+ # Use Gemini 1.5 Pro
68
+ harper-agent --model gemini-1.5-pro
69
+
70
+ # Use a specific OpenAI model
71
+ harper-agent --model gpt-4o-mini
72
+ ```
73
+
74
+ You can also set the default model via the `HARPER_AGENT_MODEL` environment variable.
75
+
76
+ ### Compaction Model
77
+
78
+ 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:
79
+
80
+ ```bash
81
+ # Use a different compaction model
82
+ harper-agent --compaction-model claude-3-haiku-20240307
83
+ ```
84
+
85
+ You can also set the default compaction model via the `HARPER_AGENT_COMPACTION_MODEL` environment variable.
86
+
87
+ ### Session Persistence
88
+
89
+ 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:
90
+
91
+ ```bash
92
+ # Persist session to a file
93
+ harper-agent --session ./my-session.db
94
+ ```
95
+
96
+ This will save all conversation history to the specified file. If the file already exists, `harper-agent` will resume the session from where you left off.
97
+
98
+ You can also set the default session path via the `HARPER_AGENT_SESSION` environment variable.
99
+
100
+ ### Service Tier (OpenAI Only)
101
+
102
+ By default, `harper-agent` uses the `auto` service tier. You can force the `flex` tier to be used with the `--flex-tier` flag:
103
+
104
+ ```bash
105
+ # Use flex service tier
106
+ harper-agent --flex-tier
107
+ ```
108
+
109
+ Forcing the `flex` tier can help reduce costs, although it may result in more frequent errors during periods of high system load.
110
+
111
+ You can also set this via the `HARPER_AGENT_FLEX_TIER=true` environment variable.
112
+
113
+ ### Ollama Support (Local Models)
114
+
115
+ To use local models with [Ollama](https://ollama.com/), use the `ollama-` prefix:
116
+
117
+ ```bash
118
+ # Use Llama 3 via Ollama
119
+ harper-agent --model ollama-llama3
120
+ ```
121
+
122
+ If your Ollama instance is running on a custom URL, you can set the `OLLAMA_BASE_URL` environment variable:
123
+
124
+ ```bash
125
+ export OLLAMA_BASE_URL=http://localhost:11434
126
+ harper-agent --model ollama-llama3
127
+ ```
128
+
129
+ ### OpenAI API Key Permissions
130
+
131
+ If you are using a restricted API key, ensure the following permissions are enabled:
132
+
133
+ - **Models**: `Write` access for `gpt-5.2` (the main model) and `gpt-4o-mini` (the memory summarizer)
134
+ - **Model capabilities**: `Write` (to allow tool calling and completions).
135
+
136
+ No other permissions (like Assistants, Threads, or Files) are required as `harper-agent` runs its tools locally.
137
+
138
+ # Contributing to Our Development
139
+
140
+ If you want to help us advance the source code that powers harper-agent, take a look at the steps below!
141
+
142
+ ## Local Development
143
+
144
+ ### Setup
145
+
146
+ 1. Clone the repository.
147
+ 2. Install dependencies:
148
+ ```bash
149
+ npm install
150
+ ```
151
+ 3. Create a `.env` file in the root directory and add your API key:
152
+ ```env
153
+ OPENAI_API_KEY=your_api_key_here
154
+ # OR ANTHROPIC_API_KEY / GOOGLE_GENERATIVE_AI_API_KEY
155
+ HARPER_AGENT_SKIP_UPDATE=true
156
+ ```
157
+
158
+ ### Running the Agent
159
+
160
+ To use the `harper-agent` command globally from your local source so you can use it on other projects:
161
+
162
+ ```bash
163
+ npm link
164
+ ```
165
+
166
+ Now you can run `harper-agent` from any directory.
167
+
168
+ ## Usage
169
+
170
+ 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.
171
+
172
+ Press `Ctrl+C` or hit enter twice to exit.
package/README.svg ADDED
@@ -0,0 +1,78 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <svg
3
+ xmlns="http://www.w3.org/2000/svg"
4
+ viewBox="0 0 1280 200"
5
+ width="640"
6
+ height="200"
7
+ role="img"
8
+ aria-label="npx -y harper-agent"
9
+ >
10
+ <defs>
11
+ <!-- Brand-ish gradient for the wordmark -->
12
+ <linearGradient id="harperGrad" x1="0" y1="0" x2="1" y2="0">
13
+ <stop offset="0%" stop-color="#45b581" />
14
+ <stop offset="55%" stop-color="#2fe7a4" />
15
+ <stop offset="100%" stop-color="#45b581" />
16
+ </linearGradient>
17
+
18
+ <!-- Subtle shadow -->
19
+ <filter id="softShadow" x="-20%" y="-20%" width="140%" height="140%">
20
+ <feDropShadow dx="0" dy="2" stdDeviation="3" flood-opacity="0.18" />
21
+ </filter>
22
+
23
+ <!-- Palette classes -->
24
+ <style>
25
+ .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; }
26
+ .sans { font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji"; }
27
+ </style>
28
+ </defs>
29
+
30
+ <!-- Wordmark + tagline -->
31
+ <g transform="translate(50 58)">
32
+ <text
33
+ class="sans"
34
+ x="0"
35
+ y="62"
36
+ font-size="200"
37
+ font-weight="800"
38
+ letter-spacing="-1.5"
39
+ fill="url(#harperGrad)"
40
+ >harper agent</text>
41
+
42
+ <!-- little “terminal” capsule -->
43
+ <g transform="translate(0 120)">
44
+ <rect
45
+ x="0"
46
+ y="0"
47
+ rx="14"
48
+ ry="14"
49
+ width="800"
50
+ height="56"
51
+ fill="#0b1020"
52
+ opacity="0.92"
53
+ />
54
+ <circle cx="22" cy="28" r="6" fill="#ff5f56" />
55
+ <circle cx="42" cy="28" r="6" fill="#ffbd2e" />
56
+ <circle cx="62" cy="28" r="6" fill="#27c93f" />
57
+
58
+ <text
59
+ class="mono"
60
+ x="90"
61
+ y="37"
62
+ font-size="22"
63
+ fill="#e6f7ff"
64
+ opacity="0.96"
65
+ >$ npx -y harper-agent</text>
66
+
67
+ <!-- blinking cursor -->
68
+ <rect x="380" y="17" width="12" height="24" fill="#e6f7ff" opacity="0.55">
69
+ <animate
70
+ attributeName="opacity"
71
+ values="0.1;0.8;0.1"
72
+ dur="1.1s"
73
+ repeatCount="indefinite"
74
+ />
75
+ </rect>
76
+ </g>
77
+ </g>
78
+ </svg>
@@ -0,0 +1 @@
1
+ #!/usr/bin/env node