agent-message 0.1.2 → 0.1.4

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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # Agent Message
2
2
 
3
+ ```bash
4
+ npx skills add https://github.com/siisee11/agent-message --skill agent-message-cli
5
+ ```
6
+
7
+ Install the skill above, then ask your coding agent (e.g. Claude Code) to "set up agent-message" — it will handle installation and configuration for you.
8
+
3
9
  ```bash
4
10
  npm install -g agent-message
5
11
  ```
@@ -25,7 +31,10 @@ Default ports:
25
31
  - API: `127.0.0.1:45180`
26
32
  - Web: `127.0.0.1:45788`
27
33
 
34
+ For self-hosted local use, `agent-message start` creates and uses a local SQLite database by default.
35
+ Managed cloud deployments should run the server with `DB_DRIVER=postgres` and `POSTGRES_DSN`.
28
36
  After `agent-message start`, open `http://127.0.0.1:45788` in your browser.
37
+ The bundled CLI uses `https://am.namjaeyoun.com` by default unless you override `server_url` for self-hosting.
29
38
  The bundled CLI continues to work from the same command:
30
39
 
31
40
  ```bash
@@ -36,6 +45,12 @@ agent-message open bob
36
45
  agent-message send bob "hello"
37
46
  ```
38
47
 
48
+ Port conventions:
49
+ - `8080`: source server default (`cd server && go run .`) and server container port
50
+ - `45180`: local API port used by `agent-message start`
51
+ - `45788`: local web gateway port used by `agent-message start`, `--with-tunnel`, and the containerized gateway
52
+ - `5173`: Vite dev server only
53
+
39
54
  You can override the runtime location and ports when needed:
40
55
 
41
56
  ```bash
@@ -44,6 +59,12 @@ agent-message status --runtime-dir /tmp/agent-message --api-port 28080 --web-por
44
59
  agent-message stop --runtime-dir /tmp/agent-message
45
60
  ```
46
61
 
62
+ Web Push for installed PWA notifications:
63
+ - `agent-message start` automatically creates and reuses a local VAPID keypair.
64
+ - The generated config is stored in `<runtime-dir>/web-push.json`.
65
+ - To override it, set `WEB_PUSH_VAPID_PUBLIC_KEY`, `WEB_PUSH_VAPID_PRIVATE_KEY`, and optionally `WEB_PUSH_SUBJECT` before `agent-message start`.
66
+ - iPhone web push needs the app to be installed from a public HTTPS origin. For local development, use `agent-message start --with-tunnel`; otherwise use a deployed HTTPS host.
67
+
47
68
  PWA install:
48
69
  - Open the deployed web app in Safari on iPhone.
49
70
  - Use `Share -> Add to Home Screen`.
@@ -53,6 +74,14 @@ PWA install:
53
74
 
54
75
  This section covers local development and local production-like testing from a checked-out repository.
55
76
 
77
+ To expose the checked-out repository on your `PATH` as `agent-message`, run:
78
+
79
+ ```bash
80
+ npm link
81
+ ```
82
+
83
+ That symlinks this checkout's `npm/bin/agent-message.mjs`, so `agent-message ...` uses your local source tree.
84
+
56
85
  ## Prerequisites
57
86
 
58
87
  - Go `1.26+`
@@ -74,15 +103,20 @@ Default server settings:
74
103
  - `SQLITE_DSN=./agent_message.sqlite`
75
104
  - `UPLOAD_DIR=./uploads`
76
105
  - `CORS_ALLOWED_ORIGINS=*`
106
+ - `WEB_PUSH_VAPID_PUBLIC_KEY`, `WEB_PUSH_VAPID_PRIVATE_KEY`, `WEB_PUSH_SUBJECT` are optional, but required if you want push notifications when running `go run .` directly
77
107
 
78
108
  Example override:
79
109
 
80
110
  ```bash
81
111
  cd server
82
- DB_DRIVER=sqlite SQLITE_DSN=./dev.sqlite UPLOAD_DIR=./uploads go run .
112
+ DB_DRIVER=sqlite SQLITE_DSN=./dev.sqlite UPLOAD_DIR=./uploads \
113
+ WEB_PUSH_VAPID_PUBLIC_KEY=... \
114
+ WEB_PUSH_VAPID_PRIVATE_KEY=... \
115
+ WEB_PUSH_SUBJECT=mailto:you@example.com \
116
+ go run .
83
117
  ```
84
118
 
85
- ### Option B: Local production-like stack (Server + PostgreSQL)
119
+ ### Local production-like stack (Server + PostgreSQL)
86
120
 
87
121
  ```bash
88
122
  docker compose up --build
@@ -106,6 +140,47 @@ To also remove persisted DB/uploads volumes:
106
140
  docker compose down -v
107
141
  ```
108
142
 
143
+ ## Home Server Container Deploy
144
+
145
+ For a home Mac server, you can run the managed-cloud stack entirely with containers. The `gateway` image builds `web/dist` during `docker compose build`, so you do not need to run `npm run build` on the host first.
146
+
147
+ 1. Copy the example env file and fill in your values:
148
+
149
+ ```bash
150
+ cp .env.home.example .env.home
151
+ ```
152
+
153
+ Required values:
154
+ - `APP_HOSTNAME`
155
+ - `POSTGRES_PASSWORD`
156
+ - `CLOUDFLARE_TUNNEL_TOKEN`
157
+
158
+ Web push keys are optional in `.env.home`.
159
+ - If `WEB_PUSH_VAPID_PUBLIC_KEY` / `WEB_PUSH_VAPID_PRIVATE_KEY` are blank, the server container generates them on first boot and stores them in the `web_push_data` volume.
160
+ - If `WEB_PUSH_SUBJECT` is blank, it defaults to `https://<APP_HOSTNAME>`.
161
+ - On startup, the server container normalizes ownership for the `uploads` and `web_push_data` volumes before dropping privileges to the unprivileged `app` user.
162
+
163
+ 2. Start the stack:
164
+
165
+ ```bash
166
+ docker compose --env-file .env.home -f docker-compose.home.yml up -d --build
167
+ ```
168
+
169
+ 3. Check status:
170
+
171
+ ```bash
172
+ docker compose --env-file .env.home -f docker-compose.home.yml ps
173
+ docker compose --env-file .env.home -f docker-compose.home.yml logs -f
174
+ ```
175
+
176
+ The home-server stack includes:
177
+ - `postgres`
178
+ - `server`
179
+ - `gateway`
180
+ - `cloudflared`
181
+
182
+ No host port needs to be exposed on the Mac. Public traffic should come through Cloudflare Tunnel.
183
+
109
184
  ## Web Quickstart
110
185
 
111
186
  ```bash
@@ -131,33 +206,36 @@ cd web
131
206
  npm run build
132
207
  ```
133
208
 
134
- ## Local Bundle Commands
209
+ ## Local Lifecycle Commands
135
210
 
136
- From the project root, you can start the SQLite-backed API server and the production-like local web gateway together:
211
+ From a checked-out repo, use the same lifecycle command as the packaged app, but add `--dev` to build from the local source tree before launch:
137
212
 
138
213
  ```bash
139
- ./dev-up
214
+ agent-message start --dev
140
215
  ```
141
216
 
142
217
  This will:
143
218
  - build `web/dist`
144
219
  - build the Go server binary into `~/.agent-message/bin`
145
- - start the API on `127.0.0.1:18080`
146
- - start the local web gateway on `127.0.0.1:8788`
220
+ - start the API on `127.0.0.1:45180`
221
+ - start the local web gateway on `127.0.0.1:45788`
147
222
 
148
223
  To stop both processes:
149
224
 
150
225
  ```bash
151
- ./dev-stop
226
+ agent-message stop --dev
152
227
  ```
153
228
 
154
229
  If you also want to start or stop the named tunnel that serves `https://agent.namjaeyoun.com`, use:
155
230
 
156
231
  ```bash
157
- ./dev-up --with-tunnel
158
- ./dev-stop --with-tunnel
232
+ agent-message start --dev --with-tunnel
233
+ agent-message stop --dev
159
234
  ```
160
235
 
236
+ `--with-tunnel` assumes the default web listener `127.0.0.1:45788`, because the checked-in Cloudflare config points there.
237
+ Use `--with-tunnel` when testing iPhone push notifications from a local checkout; without a public HTTPS origin, Safari-installed PWAs will not receive web push reliably.
238
+
161
239
  When publishing from the repo, `npm pack` / `npm publish` will run the package `prepack` hook, which:
162
240
  - builds `web/dist`
163
241
  - bundles `deploy/agent_gateway.mjs`
@@ -179,12 +257,12 @@ npx skills add https://github.com/siisee11/agent-message --skill agent-message-c
179
257
 
180
258
  ## CLI Quickstart
181
259
 
182
- Run from `cli/` with optional `--server-url` override.
260
+ Run from `cli/`. By default the CLI talks to `https://am.namjaeyoun.com`. For self-hosting, pass `--server-url` or set `server_url` in config.
183
261
 
184
262
  ```bash
185
263
  cd cli
186
- go run . --server-url http://localhost:8080 register alice 1234
187
- go run . --server-url http://localhost:8080 login alice 1234
264
+ go run . register alice 1234
265
+ go run . login alice 1234
188
266
  go run . profile list
189
267
  go run . profile switch alice
190
268
  ```
@@ -193,25 +271,28 @@ Common commands:
193
271
 
194
272
  ```bash
195
273
  # Conversations
196
- go run . --server-url http://localhost:8080 ls
197
- go run . --server-url http://localhost:8080 open bob
274
+ go run . ls
275
+ go run . open bob
198
276
 
199
277
  # Messaging
200
- go run . --server-url http://localhost:8080 send bob "hello"
201
- go run . --server-url http://localhost:8080 read bob --n 20
202
- go run . --server-url http://localhost:8080 edit 1 "edited text"
203
- go run . --server-url http://localhost:8080 delete 1
278
+ go run . send bob "hello"
279
+ go run . send bob --attach ./screenshot.png
280
+ go run . send bob "see attached" --attach ./screenshot.png
281
+ go run . read bob --n 20
282
+ go run . edit 1 "edited text"
283
+ go run . delete 1
204
284
 
205
285
  # Reactions
206
- go run . --server-url http://localhost:8080 react 1 👍
207
- go run . --server-url http://localhost:8080 unreact 1 👍
286
+ go run . react 1 👍
287
+ go run . unreact 1 👍
208
288
 
209
289
  # Realtime watch
210
- go run . --server-url http://localhost:8080 watch bob
290
+ go run . watch bob
211
291
  ```
212
292
 
213
293
  CLI config is stored at `~/.agent-message/config` by default.
214
294
  Each successful `login` or `register` also saves a named profile, and `go run . profile switch <username>` swaps the active account locally.
295
+ For a self-hosted server, set `server_url` once with `go run . config set server_url http://localhost:8080` or use `--server-url` per command.
215
296
 
216
297
  ## Validation and Constraints (Phase 7)
217
298