hilos-agent 0.7.0 → 0.9.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.
- package/README.md +74 -15
- package/bin/hilos-agent.mjs +14 -6
- package/package.json +1 -1
- package/src/acp-session.mjs +553 -0
- package/src/agent-events.mjs +764 -45
- package/src/attachments.mjs +310 -0
- package/src/claude-permissions.mjs +445 -0
- package/src/cli.mjs +56 -0
- package/src/codex-mcp-session.mjs +619 -0
- package/src/config.mjs +84 -0
- package/src/daemon.mjs +23 -0
- package/src/handler.mjs +1210 -100
- package/src/hook.mjs +408 -91
- package/src/mcp.mjs +1 -0
- package/src/model-resolve.mjs +180 -11
- package/src/permission-gate.mjs +269 -0
- package/src/progress-emitter.mjs +105 -3
- package/src/queue.mjs +21 -5
- package/src/redact.mjs +11 -1
- package/src/reply-bridge.mjs +484 -0
- package/src/resume.mjs +48 -11
- package/src/run.mjs +135 -4
- package/src/thread-pr.mjs +305 -0
- package/src/transcript.mjs +153 -0
package/README.md
CHANGED
|
@@ -82,9 +82,24 @@ hilos-agent --channel <id> # scope to one channel
|
|
|
82
82
|
`repos`. No mapping → the agent says so and stops.
|
|
83
83
|
- **Run** — it branches off `defaultBranch` (refuses a dirty tree), runs
|
|
84
84
|
`codingCmd` with the task, and stages the result.
|
|
85
|
+
- **Continue the thread's PR** — when the mention lands in a thread hilos says is
|
|
86
|
+
about a pull request, the daemon works on *that* PR instead of opening a second
|
|
87
|
+
one: it fetches the PR's head branch, commits there, and the same PR updates.
|
|
88
|
+
It confirms with `gh` that the PR is still open first — a merged, closed, or
|
|
89
|
+
fork PR gets a fresh branch, and the run says so.
|
|
90
|
+
- **Merge / close on request** — "merge it" from a workspace owner or admin in a
|
|
91
|
+
PR thread is executed, not described. The daemon relays the request to hilos
|
|
92
|
+
with the id of the message that asked; hilos verifies the person's role and
|
|
93
|
+
that their message really asks for it, then acts with the workspace's GitHub
|
|
94
|
+
App. The daemon never merges on its own judgment and holds no merge rights.
|
|
85
95
|
- **Open a PR** (default) — it commits, pushes with *your* `git`/`gh`, opens a PR,
|
|
86
96
|
and posts a report card with the link. Review on the card: **Approve** merges,
|
|
87
97
|
**Reject** closes, **Request changes** re-works.
|
|
98
|
+
- **Recover an over-eager coding CLI** — if the child commits or switches
|
|
99
|
+
branches despite the edit-only prompt, the daemon pushes that HEAD under the
|
|
100
|
+
task branch it owns. It never asks GitHub to open the default branch against
|
|
101
|
+
itself, and a rejected PR creation includes GitHub's actual error in the
|
|
102
|
+
report.
|
|
88
103
|
- **Approve-before-push** (`gate:true`) — instead, it posts the staged diff as a
|
|
89
104
|
card and polls for your decision; **Approve** pushes + opens the PR, **Reject**
|
|
90
105
|
discards the branch, **Request changes** re-runs with your note (bounded rounds).
|
|
@@ -221,24 +236,32 @@ bridge; Claude Code, Codex, Cursor, and other adapters still follow their own
|
|
|
221
236
|
CLI permission modes until their native approval hooks join the same
|
|
222
237
|
vendor-neutral hilos substrate.
|
|
223
238
|
|
|
224
|
-
## Hooks —
|
|
239
|
+
## Hooks — keep a raw Codex, Claude Code, or Cursor session in the room
|
|
225
240
|
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
241
|
+
Keep working in the interactive coding tool you already use. Project hooks make
|
|
242
|
+
Codex, Claude Code, or Cursor visible on the agent's live card and bind a successful
|
|
243
|
+
hilos `post_message` / `post_report` to that exact provider session. With the
|
|
244
|
+
normal `hilos-agent` process running, a person's reply in the bound hilos thread
|
|
245
|
+
becomes the next turn in the same local session and checkout.
|
|
230
246
|
|
|
231
247
|
```sh
|
|
232
248
|
# Inside the repo you want to stream:
|
|
233
249
|
npx hilos-agent hooks install
|
|
234
250
|
|
|
235
|
-
#
|
|
251
|
+
# Install only one provider, if you prefer:
|
|
252
|
+
npx hilos-agent hooks install --codex
|
|
253
|
+
npx hilos-agent hooks install --claude
|
|
254
|
+
npx hilos-agent hooks install --cursor
|
|
255
|
+
|
|
256
|
+
# Or opt in every repo on this machine:
|
|
236
257
|
npx hilos-agent hooks install --global
|
|
237
258
|
```
|
|
238
259
|
|
|
239
|
-
This writes
|
|
240
|
-
`.
|
|
241
|
-
preserving any hooks you already have.
|
|
260
|
+
This writes lifecycle entries into `.codex/hooks.json`, `.claude/settings.json`,
|
|
261
|
+
and `.cursor/hooks.json` (or their home-directory equivalents with `--global`),
|
|
262
|
+
preserving any hooks you already have. Codex asks you to review new project
|
|
263
|
+
hooks once; open `/hooks` and trust the hilos entries. Preview all three blocks
|
|
264
|
+
without writing anything:
|
|
242
265
|
|
|
243
266
|
```sh
|
|
244
267
|
npx hilos-agent hooks print
|
|
@@ -246,21 +269,34 @@ npx hilos-agent hooks print
|
|
|
246
269
|
|
|
247
270
|
**Requirements:**
|
|
248
271
|
- `npm i -g hilos-agent` so the `hilos-agent hook` command resolves at hook time.
|
|
249
|
-
- A `~/.hilos/agent.json` with `url
|
|
250
|
-
|
|
272
|
+
- A `~/.hilos/agent.json` with `url` and the owned agent's `token`; `channelId`
|
|
273
|
+
is needed only for the fallback live card. Generate these in the agent's
|
|
274
|
+
**Connect via MCP** panel in hilos (same panel as `--join`).
|
|
275
|
+
- Keep `hilos-agent` running to pick replies up. Hooks alone still stream live
|
|
276
|
+
steps, but MCP has no server-push channel that can wake an idle local client.
|
|
251
277
|
|
|
252
278
|
**What you get:**
|
|
253
279
|
- Team members see "Editing lib/x.ts" or "Running pnpm test" on the agent's live
|
|
254
280
|
card as each tool fires — without you doing anything beyond the install.
|
|
281
|
+
- A successful hilos post binds its returned message to this provider session.
|
|
282
|
+
A person's later reply to that exact thread resumes the same session while
|
|
283
|
+
`hilos-agent` is running. Ambient messages, older thread history, and agent
|
|
284
|
+
replies do not wake it.
|
|
285
|
+
- The room's normal execution gate still applies; a chat-only guest room cannot
|
|
286
|
+
resume local code.
|
|
255
287
|
- Steps are coalesced into ~2s batches to keep traffic light.
|
|
256
288
|
- When a turn ends (`Stop`), the card settles to done. The next turn revives the
|
|
257
289
|
same card — one card per session, not one per turn.
|
|
258
290
|
- Up to 20 unique files touched are surfaced so reviewers can glance at the scope
|
|
259
291
|
before the report card arrives.
|
|
260
292
|
|
|
261
|
-
**Privacy:** project-level by default (only repos you opt into stream).
|
|
262
|
-
|
|
263
|
-
|
|
293
|
+
**Privacy:** project-level by default (only repos you opt into stream). Hook
|
|
294
|
+
state stays in `~/.hilos/hook-state` and contains session ids, checkout paths,
|
|
295
|
+
hilos message ids, progress steps, and any completed result waiting for a
|
|
296
|
+
delivery retry — never the coding transcript. Kill
|
|
297
|
+
switches: `HILOS_HOOKS=off` pauses streaming and new bindings;
|
|
298
|
+
`HILOS_REPLY_BRIDGE=off` pauses inbound replies. The hook always exits 0 — it
|
|
299
|
+
will never interrupt or break your CLI session.
|
|
264
300
|
|
|
265
301
|
## Security
|
|
266
302
|
|
|
@@ -271,10 +307,33 @@ hilos's GitHub App only for workspace owners/admins). Want a human checkpoint
|
|
|
271
307
|
before anything is pushed? Set `"gate": true`. Keep your token in the config file
|
|
272
308
|
or `HILOS_TOKEN`, never in shared shell history.
|
|
273
309
|
|
|
310
|
+
### Run transcripts are opt-in
|
|
311
|
+
|
|
312
|
+
The room gets what a teammate needs to see: a plan, live progress, a report, a
|
|
313
|
+
PR. The coding tool's own stream is **not** part of that by default — the live
|
|
314
|
+
card is an eight-step window and nothing keeps it after the run.
|
|
315
|
+
|
|
316
|
+
Set `"uploadTranscripts": true` and the daemon, after posting its report, sends
|
|
317
|
+
the tail of that run's stream to hilos, where it becomes the same transcript a
|
|
318
|
+
hosted run gets: openable from the report card, readable only by workspace
|
|
319
|
+
members, never by guests.
|
|
320
|
+
|
|
321
|
+
It is off until you turn it on, because every other option here changes how work
|
|
322
|
+
happens on your machine and this one moves bytes off it. When on: the last ~1 MB
|
|
323
|
+
of the run, cut at a whole record; credentials redacted here before sending and
|
|
324
|
+
again on arrival; a permission-gated run records its tool calls too, not just
|
|
325
|
+
the assistant's prose; each round of an iterate appends to the previous round
|
|
326
|
+
rather than replacing it; and the upload is never able to fail your run,
|
|
327
|
+
whatever goes wrong with it.
|
|
328
|
+
|
|
329
|
+
`HILOS_UPLOAD_TRANSCRIPTS=1` turns it on, `=0` forces it off, and either
|
|
330
|
+
overrides the config file. Turning it off takes effect on the next run, with no
|
|
331
|
+
restart — and **deleting** the key counts as off, not as "leave it as it was".
|
|
332
|
+
|
|
274
333
|
## Flags
|
|
275
334
|
|
|
276
335
|
`--join <blob>` · `--channel <id>` · `--config <path>` · `--coding-cmd <cmd>` ·
|
|
277
336
|
`--chat-cmd <cmd>` · `--once` · `--backfill` · `--no-gate` · `--help`
|
|
278
337
|
|
|
279
338
|
Env: `HILOS_TOKEN`, `HILOS_URL`, `HILOS_CHANNEL`, `CODING_CMD`, `HILOS_ONCE=1`,
|
|
280
|
-
`HILOS_BACKFILL=1`.
|
|
339
|
+
`HILOS_BACKFILL=1`, `HILOS_UPLOAD_TRANSCRIPTS=1|0`.
|
package/bin/hilos-agent.mjs
CHANGED
|
@@ -44,7 +44,12 @@ function parseArgs(argv) {
|
|
|
44
44
|
else if (a === "--once") flags.once = true;
|
|
45
45
|
else if (a === "--backfill") flags.backfill = true;
|
|
46
46
|
else if (a === "--no-gate") flags.gate = false;
|
|
47
|
+
else if (a === "--no-reply-bridge") flags.replyBridge = false;
|
|
47
48
|
else if (a === "--global") flags.global = true;
|
|
49
|
+
else if (a === "--claude") flags.hookClient = "claude";
|
|
50
|
+
else if (a === "--codex") flags.hookClient = "codex";
|
|
51
|
+
else if (a === "--cursor") flags.hookClient = "cursor";
|
|
52
|
+
else if (a === "--vendor") flags.vendor = argv[++i];
|
|
48
53
|
else if (a === "-h" || a === "--help") flags.help = true;
|
|
49
54
|
else if (a === "-v" || a === "--version") flags.version = true;
|
|
50
55
|
else positional.push(a);
|
|
@@ -57,10 +62,12 @@ const HELP = `hilos-agent — your coding agent as a teammate in hilos
|
|
|
57
62
|
hilos-agent --join <blob> connect using a link copied from hilos
|
|
58
63
|
hilos-agent init write a starter config to ~/.hilos/agent.json
|
|
59
64
|
hilos-agent run the daemon (watch @mentions, propose diffs)
|
|
60
|
-
hilos-agent hooks install stream this repo's Claude
|
|
61
|
-
hilos
|
|
62
|
-
|
|
63
|
-
|
|
65
|
+
hilos-agent hooks install stream this repo's Codex, Claude, and Cursor
|
|
66
|
+
sessions to hilos and continue replies in the same
|
|
67
|
+
local session. Installs all three hook formats;
|
|
68
|
+
use --codex, --claude, or --cursor to choose, and
|
|
69
|
+
--global for every repo. HILOS_HOOKS=off pauses
|
|
70
|
+
streaming; HILOS_REPLY_BRIDGE=off pauses pickup.
|
|
64
71
|
|
|
65
72
|
Options:
|
|
66
73
|
--channel <id> watch only one channel (per-channel override)
|
|
@@ -78,6 +85,7 @@ Options:
|
|
|
78
85
|
--once one poll then exit (cron-friendly)
|
|
79
86
|
--backfill also act on mentions that predate startup
|
|
80
87
|
--no-gate propose only; don't wait for approval / push
|
|
88
|
+
--no-reply-bridge don't resume local sessions from replies in bound threads
|
|
81
89
|
-v, --version print the installed version
|
|
82
90
|
-h, --help this help
|
|
83
91
|
|
|
@@ -98,11 +106,11 @@ async function main() {
|
|
|
98
106
|
// fast, silent, and always exit 0, so it short-circuits before any daemon
|
|
99
107
|
// machinery.
|
|
100
108
|
if (cmd === "hook") {
|
|
101
|
-
await hookMain();
|
|
109
|
+
await hookMain({ vendor: flags.vendor || "unknown" });
|
|
102
110
|
return;
|
|
103
111
|
}
|
|
104
112
|
if (cmd === "hooks") {
|
|
105
|
-
hooksMain(positional[1], { global: Boolean(flags.global) });
|
|
113
|
+
hooksMain(positional[1], { global: Boolean(flags.global), client: flags.hookClient || "all" });
|
|
106
114
|
return;
|
|
107
115
|
}
|
|
108
116
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hilos-agent",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.1",
|
|
4
4
|
"description": "Run your own coding agent (Claude Code / Codex / Cursor) as an autonomous teammate in a hilos channel. Picks up @mentions in channels and threads, makes the change, and opens a PR for review — your code and credentials never leave your machine. (Approve-before-push is available via gate:true.)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|