@timqi/pier 0.0.4 → 0.0.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 +9 -6
- package/dist/agent/events.js +6 -1
- package/dist/agent/pi.js +28 -3
- package/dist/channels/chunk.js +34 -0
- package/dist/channels/control.js +6 -12
- package/dist/channels/dedup.js +45 -0
- package/dist/channels/lark-api.js +233 -0
- package/dist/channels/lark-outbound.js +101 -0
- package/dist/channels/lark-panel.js +95 -0
- package/dist/channels/lark-render.js +107 -0
- package/dist/channels/lark.js +501 -0
- package/dist/channels/lines.js +19 -0
- package/dist/channels/panel.js +4 -0
- package/dist/channels/receipts.js +15 -0
- package/dist/channels/routes.js +0 -1
- package/dist/channels/runtime.js +5 -1
- package/dist/channels/slack-api.js +4 -2
- package/dist/channels/slack-panel.js +3 -6
- package/dist/channels/slack-render.js +3 -23
- package/dist/channels/slack.js +39 -72
- package/dist/channels/telegram-api.js +4 -2
- package/dist/channels/telegram-panel.js +3 -3
- package/dist/channels/telegram.js +55 -51
- package/dist/channels/types.js +9 -0
- package/dist/cli.js +3 -1
- package/dist/core/inbox.js +67 -1
- package/dist/core/types.js +4 -0
- package/dist/db.js +83 -20
- package/dist/main.js +5 -0
- package/dist/service.js +1 -1
- package/dist/web/auth.js +36 -9
- package/dist/web/public/assets/__vite-browser-external-2447137e-BvRk9kiK.js +0 -0
- package/dist/web/public/assets/ghostty-web-ODXT71Ln.js +13 -0
- package/dist/web/public/assets/index-BUNGxtMe.css +2 -0
- package/dist/web/public/assets/index-QPYgeBhQ.js +90 -0
- package/dist/web/public/index.html +10 -2
- package/dist/web/server.js +86 -19
- package/dist/web/session-state.js +59 -25
- package/dist/web/terminal.js +334 -0
- package/docs/deploy.md +33 -21
- package/package.json +10 -2
- package/dist/web/public/assets/index-B3MvJUJP.js +0 -90
- package/dist/web/public/assets/index-CwBoxtXP.css +0 -2
package/docs/deploy.md
CHANGED
|
@@ -24,6 +24,8 @@ you want the unit to say something different.
|
|
|
24
24
|
## Prerequisites
|
|
25
25
|
|
|
26
26
|
- Node 24 or newer (`node:sqlite` is used unflagged).
|
|
27
|
+
- Python 3, `make` and a C/C++ compiler for Microsoft's `node-pty`; its npm
|
|
28
|
+
package has no Linux prebuild (`apt install python3 build-essential` on Debian/Ubuntu).
|
|
27
29
|
- A user-writable global npm prefix. The updater runs as you, so an initial
|
|
28
30
|
install that needed `sudo npm install -g` cannot later update itself.
|
|
29
31
|
- The `sqlite3` CLI is optional, for the off-machine backup and password steps
|
|
@@ -265,10 +267,10 @@ pier update # installs the latest release; hard-stops/restarts Pier
|
|
|
265
267
|
pier update --check # only says whether one exists
|
|
266
268
|
```
|
|
267
269
|
|
|
268
|
-
The workbench footer says the same thing without being asked: the server
|
|
269
|
-
`registry.npmjs.org` every
|
|
270
|
-
into `v0.0.1 → 0.0.2` when there is something newer. A failed
|
|
271
|
-
by design — an offline box is not a broken one.
|
|
270
|
+
The workbench footer says the same thing without being asked: the server asks
|
|
271
|
+
`registry.npmjs.org` at boot and at most every 30 minutes after that, and the
|
|
272
|
+
version turns into `v0.0.1 → 0.0.2` when there is something newer. A failed
|
|
273
|
+
check is silent by design — an offline box is not a broken one.
|
|
272
274
|
|
|
273
275
|
From a checkout instead, stop and back up before replacing the build:
|
|
274
276
|
|
|
@@ -287,10 +289,12 @@ path do: both drain (new work refused, running turns finished, the rest
|
|
|
287
289
|
ledgered for the next boot to report) before the updater unit is started.
|
|
288
290
|
|
|
289
291
|
Either way the updater snapshots the database to
|
|
290
|
-
`~/.pier/db/pier.db.release
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
292
|
+
`~/.pier/db/backups/pier.db.release-<version>.bak` before npm touches the
|
|
293
|
+
package — `<version>` being the Pier that is being replaced, i.e. the release to
|
|
294
|
+
reinstall if that copy is ever restored. This happens for every release,
|
|
295
|
+
including releases with no schema change. If installation or backup fails, the
|
|
296
|
+
updater unit still tries to start the previously installed service and reports
|
|
297
|
+
the failure in its journal.
|
|
294
298
|
|
|
295
299
|
### Automatic updates
|
|
296
300
|
|
|
@@ -313,22 +317,27 @@ pier service install --force # re-records the current node and npm
|
|
|
313
317
|
A newer Pier brings its own schema up on the next start: the migrations run in
|
|
314
318
|
one transaction before the port opens, and the version they leave behind is
|
|
315
319
|
stamped in the database. It also snapshots the immediately preceding schema to
|
|
316
|
-
`~/.pier/db/pier.db.v<N>.bak` (`N` = the schema it was at). **Upgrades
|
|
317
|
-
Start an older Pier on a database a newer one has migrated and it
|
|
318
|
-
rather than write tables it does not understand — the way back
|
|
319
|
-
|
|
320
|
+
`~/.pier/db/backups/pier.db.v<N>.bak` (`N` = the schema it was at). **Upgrades
|
|
321
|
+
only.** Start an older Pier on a database a newer one has migrated and it
|
|
322
|
+
refuses to run rather than write tables it does not understand — the way back
|
|
323
|
+
down is either a release backup or that schema snapshot:
|
|
320
324
|
|
|
321
325
|
```sh
|
|
322
326
|
systemctl --user stop pier
|
|
323
|
-
|
|
324
|
-
|
|
327
|
+
ls -t ~/.pier/db/backups/ # newest first
|
|
328
|
+
cd ~/.pier/db && rm -f pier.db pier.db-wal pier.db-shm
|
|
329
|
+
cp backups/pier.db.release-0.0.4.bak pier.db # the version in the name
|
|
330
|
+
# then reinstall that Pier release: npm install -g @timqi/pier@0.0.4
|
|
325
331
|
```
|
|
326
332
|
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
333
|
+
Every copy lives in `~/.pier/db/backups/`, written under a temporary name and
|
|
334
|
+
renamed into place, so a `.bak` name only ever refers to a finished copy. The
|
|
335
|
+
three newest of **each kind** are kept — three release backups and three schema
|
|
336
|
+
snapshots, counted separately so a run of releases cannot evict the copies taken
|
|
337
|
+
before a migration. Backing up twice at the same version replaces that version's
|
|
338
|
+
copy. Each is a full copy of the database, one directory below it, and therefore
|
|
339
|
+
protects against a bad upgrade, not against a lost disk — an off-machine copy is
|
|
340
|
+
still yours to take.
|
|
332
341
|
|
|
333
342
|
### Can it update itself?
|
|
334
343
|
|
|
@@ -382,7 +391,9 @@ elsewhere, pick a tunnel rather than a wider bind:
|
|
|
382
391
|
there, preserve the external `Host` (or pass `X-Forwarded-Host`), and pass
|
|
383
392
|
`X-Forwarded-For`; Pier uses the external host for write-origin checks and
|
|
384
393
|
counts login failures per forwarded client. Its session cookie is marked
|
|
385
|
-
`Secure` when the proxy reports `X-Forwarded-Proto: https`.
|
|
394
|
+
`Secure` when the proxy reports `X-Forwarded-Proto: https`. The proxy must
|
|
395
|
+
pass WebSocket upgrades for `/api/terminal` (Caddy does automatically;
|
|
396
|
+
nginx needs its usual HTTP/1.1 `Upgrade`/`Connection` forwarding).
|
|
386
397
|
|
|
387
398
|
## Backups
|
|
388
399
|
|
|
@@ -390,7 +401,8 @@ Three paths hold everything: `~/.pier/db/pier.db` (tasks, channels, the chat →
|
|
|
390
401
|
session map, workbench state, settings, the password hash, and the sealed
|
|
391
402
|
provider credentials and channel tokens), `~/.pier/master.key` (the key that
|
|
392
403
|
seals them — without it the database's sealed values are unreadable), and
|
|
393
|
-
`~/.pier/boards/`.
|
|
404
|
+
`~/.pier/boards/`. `~/.pier/db/backups/` holds the automatic pre-update and
|
|
405
|
+
pre-migration copies, named for the release or schema they came from.
|
|
394
406
|
For off-machine backups, use `sqlite3 ... "VACUUM INTO '…'"` rather than `cp`,
|
|
395
407
|
which under WAL can miss the most recent commits. Pi's own session history lives
|
|
396
408
|
under `~/.pier/pi` (Pier sets `PI_CODING_AGENT_DIR` there unless the environment
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@timqi/pier",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"description": "A self-hosted workspace for coding agents: web workbench and IM channels in front of Pi sessions",
|
|
5
5
|
"license": "AGPL-3.0-only",
|
|
6
6
|
"repository": "github:timqi/pier",
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@tailwindcss/typography": "^0.5.20",
|
|
37
37
|
"@tailwindcss/vite": "^4.3.3",
|
|
38
|
+
"@types/ws": "^8.18.1",
|
|
38
39
|
"oxlint": "^1.79.0",
|
|
39
40
|
"tailwindcss": "^4.3.3",
|
|
40
41
|
"tsx": "^4.23.12",
|
|
@@ -45,11 +46,18 @@
|
|
|
45
46
|
"dependencies": {
|
|
46
47
|
"@earendil-works/pi-coding-agent": "^0.84.2",
|
|
47
48
|
"@hono/node-server": "^2.1.1",
|
|
49
|
+
"@larksuiteoapi/node-sdk": "^1.73.0",
|
|
48
50
|
"croner": "^10.0.1",
|
|
49
51
|
"dompurify": "^3.4.14",
|
|
52
|
+
"ghostty-web": "^0.4.0",
|
|
50
53
|
"highlight.js": "^11.12.0",
|
|
51
54
|
"hono": "^4.13.3",
|
|
52
55
|
"marked": "^18.0.10",
|
|
53
|
-
"
|
|
56
|
+
"node-pty": "^1.1.0",
|
|
57
|
+
"typebox": "^1.3.7",
|
|
58
|
+
"ws": "^8.21.3"
|
|
59
|
+
},
|
|
60
|
+
"allowScripts": {
|
|
61
|
+
"node-pty@1.1.0": true
|
|
54
62
|
}
|
|
55
63
|
}
|