hilos-agent 0.11.2 → 0.11.3

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,13 +1,16 @@
1
1
  # hilos-agent
2
2
 
3
- Run **your own** coding agent — Claude Code, Codex, Cursor, opencode, Hermes, or any command — as
3
+ Run **your own** coding agent — Claude Code, Codex, Cursor, opencode,
4
+ Antigravity, Hermes, or any command — as
4
5
  an autonomous teammate inside a [hilos](https://hilos.sh) channel.
5
6
 
6
7
  It connects to hilos over MCP, watches for `@mentions` of your agent in a
7
8
  git-linked channel (including thread replies) and for **every message in a DM
8
9
  with your agent — no tag needed there**, runs your coding agent in a
9
- **local** checkout, and — by default — **opens a PR for review**. Your code and
10
- your git/`gh` credentials never leave your machine hilos only relays messages.
10
+ **local** checkout, and — by default — **opens a PR for review**. The checkout
11
+ and your coding-provider/git credentials stay on your machine. Changes go to the
12
+ configured Git remote; hilos receives bounded plans, progress, reports, and—when
13
+ the pre-push gate is enabled—the proposal diff.
11
14
 
12
15
  ```
13
16
  hilos channel ──MCP/HTTPS──▶ hilos-agent (your laptop)
@@ -19,13 +22,13 @@ hilos channel ──MCP/HTTPS──▶ hilos-agent (your laptop)
19
22
  Changes ▶ agent re-works with your note
20
23
  ```
21
24
 
22
- Prefer **approve-before-push**? Set `"gate": true` — the agent then posts the
23
- proposed diff as a card and pushes only after you Approve (nothing leaves your
24
- machine until then).
25
+ Prefer **approve-before-push**? Set `"gate": true` — the agent posts a bounded
26
+ proposed diff to hilos as a card, then pushes the change to the Git remote only
27
+ after you Approve.
25
28
 
26
29
  ## Quick start
27
30
 
28
- In hilos: open your agent's profile → **Connect** → **Run in channel**. Copy the
31
+ In hilos: open your agent's profile → **Connect agent** → **Run in channel**. Copy the
29
32
  terminal command and run it from inside your repo's folder. It waits at a hidden
30
33
  prompt; copy the private join code from Hilos and paste it there. The daemon
31
34
  matches the repo by its git remote, so no config is needed, and the reusable
@@ -39,30 +42,42 @@ npx hilos-agent@latest --join-stdin # then paste the private join code when ask
39
42
  Previously copied `--join <blob>` commands remain compatible. New commands use
40
43
  stdin because the blob contains the agent token and should not live in argv.
41
44
 
42
- Running from elsewhere, or want to map several repos explicitly? Use a config:
45
+ Running from elsewhere, or want to map several repos explicitly? Save this as
46
+ `~/.hilos/agent.json` (or `./hilos-agent.json`). The file is strict JSON, so it
47
+ cannot contain comments:
43
48
 
44
- ```jsonc
45
- // ~/.hilos/agent.json (or ./hilos-agent.json)
49
+ ```json
46
50
  {
47
51
  "url": "https://hilos.sh/api/mcp",
48
52
  "token": "mgo_…",
49
53
  "repos": { "your-org/your-repo": "/Users/you/code/your-repo" },
50
- "codingCmd": "claude -p --permission-mode acceptEdits", // safe default; see Permissions / autonomy. or "codex exec", "cursor-agent -p --output-format text --trust", "opencode run", "agy -p", any command
51
- "codingModel": "", // Codex tier ("most-capable" | "balanced" | "fastest"), resolved against this account's own model list; "" = the tool's default
52
- "chatCmd": "", // FAST command for chat replies + the plan-ack. Empty = derived from codingCmd's tool (codex daemons chat with codex, etc.); set to override
53
- "webSearch": true, // native public-web tools are on by default; false stops Hilos enablement/instructions
54
+ "codingCmd": "claude -p --permission-mode acceptEdits",
55
+ "codingModel": "",
56
+ "chatCmd": "",
57
+ "webSearch": true,
54
58
  "defaultBranch": "main",
55
- "gate": false, // default: open a PR directly. true = approve-before-push
56
- "heartbeatMs": 180000, // long runs post one "still working…" thread reply this often (0 = off, min 15s)
57
- "chatTimeoutMs": 90000, // cap a chat reply / plan-ack so a stalled model can't go silent
58
- "longPollMs": 20000, // ask the server to HOLD the mention poll and answer the moment work lands (0 = plain 5s polling; older servers fall back automatically)
59
- "catchupMs": 86400000 // how far back a restart replays mentions from the persisted cursor (default 24h; 0 = restart at "now", the pre-0866 behavior)
59
+ "gate": false,
60
+ "heartbeatMs": 180000,
61
+ "chatTimeoutMs": 90000,
62
+ "longPollMs": 20000,
63
+ "catchupMs": 86400000
60
64
  }
61
65
  ```
62
66
 
67
+ `codingCmd` above is the safe default; it can also be `codex exec`,
68
+ `cursor-agent -p --output-format text --trust`, `opencode run`, `agy -p`, or a
69
+ custom command. `codingModel` accepts the Codex tiers `most-capable`, `balanced`,
70
+ or `fastest`; empty uses the tool's default. Empty `chatCmd` derives a fast chat
71
+ command from `codingCmd`. `webSearch: false` disables hilos's web-search
72
+ enablement, and `gate: true` switches to approve-before-push. `heartbeatMs: 0`
73
+ disables the heartbeat (minimum nonzero value 15 seconds); `longPollMs: 0` uses
74
+ plain five-second polling; `catchupMs: 0` restarts at now instead of replaying
75
+ the default 24-hour window.
76
+
63
77
  **Staying responsive.** Every code task posts an **instant acknowledgement**
64
- (under a second), and — if your server exposes `edit_message` and a `chatCmd` is
65
- set a quick **plan** ("On it I'll do X, then open a PR") edits into it. On a
78
+ (under a second), and — if your server exposes `edit_message` and a fast chat
79
+ command can be resolved (explicit `chatCmd` or one derived from `codingCmd`)
80
+ a quick **plan** ("On it — I'll do X, then open a PR") edits into it. On a
66
81
  run longer than `heartbeatMs` (default 3 min; env `HILOS_HEARTBEAT_MS`, `0`
67
82
  disables, clamped to ≥15s) the agent posts **one progress reply** in the thread
68
83
  then edits it in place with elapsed time + the CLI's latest line — so the channel
@@ -98,7 +113,7 @@ The local daemon can give its coding and chat agents a narrow bridge to
98
113
  third-party WebMCP sites. It is off until you name exact origins and exact read
99
114
  tools in the machine's config:
100
115
 
101
- ```jsonc
116
+ ```json
102
117
  {
103
118
  "webMcp": {
104
119
  "origins": {
@@ -152,8 +167,10 @@ access its operator granted. See the complete contract in
152
167
  it", "approved", or "go for it" after a request, in any language → a code run.
153
168
  - **Repo resolution** — the channel's linked repo is mapped to a local path via
154
169
  `repos`. No mapping → the agent says so and stops.
155
- - **Run** — it branches off `defaultBranch` (refuses a dirty tree), runs
156
- `codingCmd` with the task, and stages the result.
170
+ - **Run** — it temporarily stashes a dirty checkout, branches off
171
+ `defaultBranch`, runs `codingCmd` with the task, stages the result, and attempts
172
+ to restore the person's pre-existing work on every exit path. If `stash pop`
173
+ conflicts, the stash stays intact and the room gets the recovery command.
157
174
  - **Continue the thread's PR** — when the mention lands in a thread hilos says is
158
175
  about a pull request, the daemon works on *that* PR instead of opening a second
159
176
  one: it fetches the PR's head branch, commits there, and the same PR updates.
@@ -192,8 +209,7 @@ to a plain **local folder** and the agent works in it **directly** — it edits
192
209
  files in place (no branch, no commit, no PR), then posts a report of what changed.
193
210
  It's your own machine, so this is the same trust as running the CLI yourself.
194
211
 
195
- ```jsonc
196
- // hilos-agent.json
212
+ ```json
197
213
  {
198
214
  "folders": { "<channelId>": "/Users/you/notes-site" }
199
215
  }
@@ -227,7 +243,7 @@ It's your own machine, so this is the same trust as running the CLI yourself.
227
243
 
228
244
  Add an optional per-channel deploy target next to `folders`:
229
245
 
230
- ```jsonc
246
+ ```json
231
247
  {
232
248
  "folders": { "<channelId>": "/Users/you/notes-site" },
233
249
  "deploy": { "<channelId>": { "provider": "vercel", "prod": false } }
@@ -282,30 +298,29 @@ touching the token.
282
298
 
283
299
  ## Permissions / autonomy
284
300
 
285
- `codingCmd` decides how much the coding agent can do on its own. Three levels,
286
- safest first:
287
-
288
- - **`opencode run` (runtime-gated).** When the connected hilos server advertises
289
- runtime permissions, the daemon runs OpenCode through an authenticated
290
- loopback server and becomes its sole permission responder. A tool ask pauses
291
- mechanically, posts a card in the run thread, and resumes only after a channel
292
- member chooses **Allow once**, an exact harness-suggested **Always** rule, or
293
- **Deny**. Missing transport, expiry, and cancellation all reject the tool
294
- call. `opencode run --auto` deliberately bypasses these cards and keeps
295
- OpenCode's dangerous auto-approve behavior.
296
- - **`--permission-mode acceptEdits` (default).** The agent edits files without
297
- prompting, but in headless `claude -p` a step that needs bash — run the tests,
298
- install a dep has no interactive prompt to grant, so the task can **stall**.
299
- Good when the work is edit-only; frustrating for anything that needs to run
300
- commands.
301
- - **`--dangerously-skip-permissions` (recommended for independent agents).** Full
302
- autonomy: the agent can run the tests, install deps, and finish hands-off.
303
- Caution: it can run **any** command in the repo you point it at — only use it
304
- on a repo and machine where that's acceptable. This is the option to pick if
305
- you want the agent to actually work on its own.
306
-
307
- ```jsonc
308
- "codingCmd": "claude -p --dangerously-skip-permissions"
301
+ There are two separate gates:
302
+
303
+ - **Room runtime permissions.** When the workspace has granted runtime
304
+ permissions, current daemons put Claude Code, Codex, Cursor, and OpenCode
305
+ behind the same server-authorized card flow. A tool ask pauses mechanically
306
+ and resumes only after an eligible channel member chooses **Allow once**, an
307
+ exact harness-suggested **Always** rule, or **Deny**. Cursor and OpenCode use
308
+ ACP; Claude Code uses its permission-prompt tool; Codex uses `codex
309
+ mcp-server` because `codex exec` has no approval transport. Once a relay is
310
+ active, authority loss, expiry, cancellation, and transport failure all fail
311
+ closed. A positively unavailable old-CLI transport is the compatibility
312
+ exception: the daemon warns the room, then starts the ungated fallback.
313
+ Explicit vendor bypass modes such as `opencode run --auto` or Claude Code's
314
+ `--dangerously-skip-permissions` deliberately opt out of the cards.
315
+ - **The CLI's own mode.** Without a workspace runtime grant, `codingCmd` remains
316
+ authoritative. The default Claude Code command uses
317
+ `--permission-mode acceptEdits`: it may edit without prompting, but a headless
318
+ command that needs additional approval can stall. For a fully independent
319
+ local agent, `--dangerously-skip-permissions` can run any command in the repo
320
+ you point it at, so use it only where that trust is acceptable.
321
+
322
+ ```json
323
+ { "codingCmd": "claude -p --dangerously-skip-permissions" }
309
324
  ```
310
325
 
311
326
  - **Approve-before-push (`gate:true`), most cautious.** Independent of the two
@@ -314,9 +329,9 @@ safest first:
314
329
 
315
330
  The default stays `acceptEdits`. Reach for `--dangerously-skip-permissions` when
316
331
  you want a truly hands-off teammate, and keep `gate:true` if you'd rather review
317
- before anything is pushed. When the workspace grants runtime approvals,
318
- OpenCode, Cursor, Claude Code, and Codex all pause on the same durable hilos
319
- permission card. A refusal or broken decision path fails closed.
332
+ before anything is pushed. Runtime cards and the push gate are independent: one
333
+ governs tools during the run, the other governs when the resulting code leaves
334
+ the machine.
320
335
 
321
336
  ## Hooks — keep a raw Codex, Claude Code, or Cursor session in the room
322
337
 
@@ -365,8 +380,9 @@ npx hilos-agent@latest hooks print
365
380
  live card. The normal one-line `--join` flow does not need that file for
366
381
  replies: its token stays in daemon memory, and Hilos signs each session
367
382
  binding so the daemon can verify it before resuming local code.
368
- - Keep `hilos-agent` running to pick replies up. Hooks alone still stream live
369
- steps, but MCP has no server-push channel that can wake an idle local client.
383
+ - Keep `hilos-agent` running to pick replies up. Hooks only emit lifecycle
384
+ events; the daemon is the consumer that waits on the server's wake/long-poll
385
+ path and resumes the local session.
370
386
 
371
387
  **What you get:**
372
388
  - Team members see "Editing lib/x.ts" or "Running pnpm test" on the agent's live
@@ -422,8 +438,9 @@ An older server simply leaves it off.
422
438
  ### Run transcripts are opt-in
423
439
 
424
440
  The room gets what a teammate needs to see: a plan, live progress, a report, a
425
- PR. The coding tool's own stream is **not** part of that by default — the live
426
- card is an eight-step window and nothing keeps it after the run.
441
+ PR. The coding tool's raw stream is **not** part of that by default. Current
442
+ servers do keep a bounded, redacted set of structured activity facts through
443
+ the runtime-neutral event protocol described above; that is not a transcript.
427
444
 
428
445
  Set `"uploadTranscripts": true` and the daemon, after posting its report, sends
429
446
  the tail of that run's stream to hilos, where it becomes the same transcript a
@@ -457,8 +474,14 @@ arguments can be visible to other processes on the machine, so use
457
474
  Likewise, prefer `--join-stdin` over the legacy `--join <blob>` form for a new
458
475
  connection.
459
476
 
460
- Env: `HILOS_TOKEN`, `HILOS_URL`, `HILOS_CHANNEL`, `CODING_CMD`, `HILOS_ONCE=1`,
461
- `HILOS_BACKFILL=1`, `HILOS_UPLOAD_TRANSCRIPTS=1|0`.
477
+ See `hilos-agent --help` for the `init`, `webmcp`, `web doctor`, and `hooks`
478
+ subcommands.
479
+
480
+ Env: `HILOS_TOKEN`, `HILOS_URL`, `HILOS_CHANNEL`, `CODING_CMD`,
481
+ `HILOS_CODING_MODEL`, `HILOS_CHAT_CMD`, `HILOS_WEB_SEARCH=1|0`,
482
+ `HILOS_ACP=1|0`, `HILOS_HEARTBEAT_MS`, `HILOS_PROGRESS_MS`,
483
+ `HILOS_CHAT_TIMEOUT_MS`, `HILOS_REPLY_BRIDGE=1|0`, `HILOS_ONCE=1`,
484
+ `HILOS_BACKFILL=1`, and `HILOS_UPLOAD_TRANSCRIPTS=1|0`.
462
485
 
463
486
  ## Releasing
464
487
 
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  // hilos-agent — run your coding agent as an autonomous teammate in a hilos
3
- // channel. Picks up @mentions and opens a PR by default; --gate adds a human
4
- // approval checkpoint before the push. Your code + credentials never leave
5
- // your machine.
3
+ // channel. Picks up @mentions and opens a PR by default; an optional pre-push
4
+ // gate waits for a person's approval. The checkout and credentials stay local;
5
+ // changes go to the configured Git remote and bounded run state goes to hilos.
6
6
  //
7
7
  // Usage:
8
8
  // hilos-agent --join <blob> connect with a copy-paste link from hilos
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "hilos-agent",
3
- "version": "0.11.2",
4
- "description": "Run your own coding agent (Claude Code, Codex, Cursor, OpenCode, Hermes, or any command) as a teammate in a hilos room. It picks up mentions, makes the change locally, and opens a PR for human review.",
3
+ "version": "0.11.3",
4
+ "description": "Run your own coding agent (Claude Code, Codex, Cursor, OpenCode, Hermes, or any command) as a teammate in a hilos room. The checkout and credentials stay local; changes go to your configured Git remote as a PR for human review, and bounded progress and reports go to hilos.",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "hilos-agent": "bin/hilos-agent.mjs"
package/src/handler.mjs CHANGED
@@ -5,7 +5,8 @@
5
5
  //
6
6
  // Turn an @mention in a git-linked channel into a branch + a coding-agent run.
7
7
  // By default it opens a PR for review; with gate:true it posts a proposed diff
8
- // and pushes only after approval. Your code + credentials stay local.
8
+ // and pushes only after approval. The checkout and credentials stay local;
9
+ // bounded progress/reports go to hilos and changes go to the Git remote.
9
10
 
10
11
  import { spawnSync } from "node:child_process";
11
12
  import { randomBytes, randomUUID } from "node:crypto";