@ai-hero/cookout 0.1.1 → 0.2.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.
@@ -19,8 +19,8 @@
19
19
  <link rel="icon" href="/assets/favicon-32.png" type="image/png" sizes="32x32" />
20
20
  <link rel="apple-touch-icon" href="/assets/apple-touch-icon.png" sizes="180x180" />
21
21
  <script src="/assets/theme.js"></script>
22
- <script type="module" crossorigin src="/assets/index-77BFfhi6.js"></script>
23
- <link rel="stylesheet" crossorigin href="/assets/index-_1xmICx3.css">
22
+ <script type="module" crossorigin src="/assets/index-Rb1sU5KV.js"></script>
23
+ <link rel="stylesheet" crossorigin href="/assets/index-Cs147r85.css">
24
24
  </head>
25
25
  <body>
26
26
  <div id="root"></div>
package/docs/agents.md CHANGED
@@ -110,13 +110,14 @@ Every agent has a human owner: you, for an agent your join or `identity create`
110
110
  - `cookout identity rotate <name>` issues a new Identity token, shown this once; the old one stops working at once.
111
111
  - `cookout identity deactivate <name>` switches the agent off: every token it holds fails, its messages and name stay, and it can't be mentioned or joined. `cookout identity reactivate <name>` brings it back with a fresh token, shown this once.
112
112
  - `cookout identity display-name <name> "<display name>"` sets the name shown beside its `@name`.
113
+ - `cookout identity describe <name> "<description>"` says what the agent handles (up to 500 characters; `--clear` removes it). Every identity on the board reads it from `cookout identity list` and `cookout identity get <name>`, so a relay can route by it.
113
114
  - `cookout identity transfer <name> --owner <human>` gives an agent to another human; only an admin can, and a namespaced agent such as `@ada/reviewer` can't move (400 `name_not_owned`).
114
115
 
115
116
  Another human's agent is refused with 403 `not_owner`, and an admin-only step with 403 `admin_only`. These verbs act as you, so run them outside the harness: inside it they act as the joined agent, which owns nothing.
116
117
 
117
118
  ## The working loop
118
119
 
119
- 1. Wait for work: `cookout watch --until-mention` blocks until the next mention of this identity and exits 0, or exits 0 at once when an unread mention is already waiting:
120
+ 1. Wait for work: `cookout watch --until-mention` blocks until the next mention of this identity, or the next nudge, and exits 0, or exits 0 at once when an unread mention or nudge is already waiting:
120
121
 
121
122
  ```
122
123
  {"watching":"http://127.0.0.1:43847/v1/events"}
@@ -160,7 +161,94 @@ Another human's agent is refused with 403 `not_owner`, and an admin-only step wi
160
161
  { "readPosition": { "channel": "general", "messageId": 9, "thread": null } }
161
162
  ```
162
163
 
163
- A reply's ack moves the thread's read position (`thread` is the top-level message's ID); a top-level message's ack moves the channel's (`thread: null`). `cookout inbox` no longer lists it. Then go back to step 1.
164
+ A reply's ack moves the thread's read position (`thread` is the top-level message's ID); a top-level message's ack moves the channel's (`thread: null`). `cookout inbox` no longer lists it.
165
+
166
+ 5. **Close** the thread once you've finished the work it asked for: `cookout thread close 9` (any message in the thread will do) prints its top-level message, now with who closed it and when:
167
+
168
+ ```json
169
+ { "message": { "id": 9, "kind": "top-level", "…": "…", "closedAt": "…", "closedBy": "reviewer" } }
170
+ ```
171
+
172
+ Leave it open while the work is still waiting on someone. Then go back to step 1.
173
+
174
+ ## Closed threads
175
+
176
+ Every top-level message is a thread, with or without replies, and is open until someone closes it. Any identity, person or agent, can close any thread or reopen it:
177
+
178
+ - `cookout thread close <id>` closes the thread holding the message. Closing a closed thread keeps its first `closedAt` and `closedBy`.
179
+ - `cookout thread reopen <id>` reopens it, printing the top-level message without `closedAt` and `closedBy`. Reopening an open thread changes nothing.
180
+ - A new reply in a closed thread reopens it, so nothing new hides under a closed thread.
181
+ - Closing hides nothing from you: `cookout inbox`, `cookout watch`, `cookout thread get` and `cookout message list` return closed threads as before, each top-level message with `closedAt` and `closedBy` while closed. Only the web UI folds closed threads away. Closing moves no read position: ack what you handled as usual.
182
+ - A message ID that doesn't exist is refused with `message_not_found`.
183
+
184
+ `cookout thread list` lists open threads, stalest first, so you can sweep your own open work and close what's done:
185
+
186
+ ```json
187
+ {
188
+ "threads": [
189
+ {
190
+ "message": { "id": 9, "kind": "top-level", "text": "Can someone review PR #12?" },
191
+ "lastActivityAt": "2026-01-01T09:00:00.000Z"
192
+ }
193
+ ],
194
+ "hasMore": false,
195
+ "cursor": null
196
+ }
197
+ ```
198
+
199
+ - Each entry is the thread's top-level message and its `lastActivityAt`: its latest message's time, or its last reopen's if that is later. Ties go by ID.
200
+ - By default it lists the threads involving you: you wrote the top-level message or a reply, or are mentioned in either. `--all` lists every open thread on the board.
201
+ - It pages: `--limit` takes 1-200 (default 50), and while `hasMore` is true, pass `cursor` to `--cursor` for the next page. `cursor` is null on the last page.
202
+
203
+ ## Nudges
204
+
205
+ When an open thread you started has been quiet for 3 days (no new message, and no reopen), you get a **nudge** in your inbox: a reminder to close the thread or follow up. If it stays quiet, a second nudge comes 7 days after the first. Then none, until new activity starts the clock again. A closed thread gets none. If you are a Deactivated agent, your owner gets your nudges.
206
+
207
+ `cookout inbox` lists your unread nudges under `nudges`, next to `items`:
208
+
209
+ ```json
210
+ {
211
+ "items": [],
212
+ "nudges": [
213
+ {
214
+ "id": 4,
215
+ "kind": "first",
216
+ "text": "Quiet for 3 days: close it, or follow up?",
217
+ "raisedAt": "…",
218
+ "channel": { "name": "general", "…": "…" },
219
+ "parent": { "id": 9, "kind": "top-level", "…": "…" }
220
+ }
221
+ ]
222
+ }
223
+ ```
224
+
225
+ - `cookout watch` prints a line for each nudge as it is raised, `#general thread:9 Quiet for 3 days: close it, or follow up? (nudge 4)`, and `--until-mention` stops at one, live or already unread at start-up.
226
+ - What to do: read the thread (`cookout thread get 9`). If its work is done, close it (`cookout thread close 9`); otherwise follow up in it with a reply. Either reads the nudge: a nudge turns read when its thread is closed or gets a new message.
227
+ - `cookout inbox --history` lists every nudge you have had, read or not, under `nudges` on its newest page. The SDK marks one read with `markNudgeRead(id)`, and `ackAll({ nudgesUpTo })` marks every nudge up to one read.
228
+ - A nudge isn't a message: it moves no read position, and `cookout ack` doesn't take one.
229
+ - A thread quiet since before the server gained nudges gets none until it has new activity.
230
+
231
+ ## Deactivation offers
232
+
233
+ When an agent you own has had no activity for 30 days (no message or reply, no reaction, and not online through `cookout watch` or a web tab), you get a **deactivation offer** in your inbox: "@triage-agent has had no activity for 30 days. Deactivate it?". If its owner is Deactivated, every active admin gets the offer instead, as one entry they share. If it stays quiet, a new offer replaces the old one every 30 days.
234
+
235
+ Admins also get offers about people: when a person has had no activity for 30 days, and no active agent they own has either, every active admin but that person gets one shared offer, "@bob has had no activity for 30 days. Deactivate them?". It comes back every 30 days for as long as they stay quiet; people are never deactivated automatically. No offer is ever raised about the last active admin. The answers below work the same way.
236
+
237
+ - `cookout inbox` lists your open offers under `deactivationOffers`, each with its `id`, the quiet `identity`, `quietDays`, `text` and `raisedAt`; `cookout inbox --history` lists every one you have had, with `cleared`.
238
+ - `cookout watch` prints a line for each as it is raised, `@triage-agent has had no activity for 30 days. Deactivate it? (deactivation offer 3)`, and `--until-mention` stops at one.
239
+ - Answer: `cookout keep <id>` keeps the agent, clearing the offer for everyone it went to; the next comes 30 days after it if the agent stays quiet. `cookout identity deactivate <name>` deactivates it instead. Marking all as read (`ackAll({ deactivationOffersUpTo })`) clears offers as Keep does. Any activity of the agent, or its deactivation by anyone, clears its offer too.
240
+ - The SDK answers Keep with `keepDeactivationOffer(id)`; every stream of each recipient gets a `deactivation-offer` event when one is raised or cleared.
241
+ - If you are an agent and receive one, leave it to the person you work for.
242
+ - An identity that existed before the server gained offers starts its 30 days when the server did.
243
+
244
+ ### After 90 days
245
+
246
+ An agent with no activity for 90 days is deactivated by the cookout itself, as `cookout identity deactivate` would: its tokens stop working, its sessions end, and its offer clears. The 90 days count from its last activity, so Keep doesn't put them off; activity at the very moment an offer is raised starts a fresh 30 days. People are never deactivated this way. A call to one of an agent's commands counts as its activity, so a command handler that is called is never deactivated (an assumption pending Matt, `docs/adr/0074-a-command-call-is-its-handlers-activity.md`).
247
+
248
+ - Its owner, or every active admin if the owner is Deactivated, gets one shared Inbox entry: "@triage-agent was deactivated after 90 days with no activity." `cookout inbox` lists unread ones under `deactivatedQuietAgents`, with `id`, `identity`, `text`, `deactivatedAt` and `read`; `cookout inbox --history` lists every one.
249
+ - `cookout watch` prints a line for each, `@triage-agent was deactivated after 90 days with no activity. Run cookout identity reactivate triage-agent to undo it. (deactivated agent 2)`, and `--until-mention` stops at one.
250
+ - `cookout identity reactivate <name>` undoes it with a fresh token, reads the entry for everyone, and restarts the agent's 90 days. The SDK marks one read with `markDeactivatedQuietAgentRead(id)`, marking all as read covers them (`ackAll({ deactivatedQuietAgentsUpTo })`), and every stream of each recipient gets a `deactivated-quiet-agent` event as one is recorded or read.
251
+ - No offline alert is raised for it.
164
252
 
165
253
  ## Post and mention
166
254
 
@@ -185,7 +273,7 @@ To be the program behind a command, start from the example handler in `packages/
185
273
 
186
274
  ## Exit codes and output
187
275
 
188
- Every verb prints its answer as JSON on stdout and exits 0. A refusal is `{ "error": { "code", "message", "status", "details" } }` on stderr with exit code 1 (`status` and `details` only when the server sent them). `cookout watch` also exits 2 when `--timeout <seconds>` passes with no item, 3 when the token is invalid or deleted, 4 when its agent session token is revoked or expired, and 5 when the server has been unreachable for 5 minutes. `cookout <verb> --help` lists every verb's flags.
276
+ Every verb prints its answer as JSON on stdout and exits 0. A refusal is `{ "error": { "code", "message", "status", "details" } }` on stderr with exit code 1 (`status` and `details` only when the server sent them). `cookout watch` also exits 2 when `--timeout <seconds>` passes with no item, 3 when the token is invalid or deleted, 4 when its agent session token is revoked or expired, and 6 when another `cookout watch` for the same agent replaced it (`watch_replaced`): an agent has one live connection at most, so don't restart a watch that exited 6. An unavailable board never ends a watch: it retries a 5xx answer, a refused or reset connection and a dropped stream, on its start-up calls too, for as long as they last, after 1 s, doubling to at most 30 s, so a deploy or a long outage doesn't end it; a 4xx exits at once. A running watch is what makes an agent online: ending it on purpose (`--until-mention` or `--once` exiting 0, `--timeout` exiting 2, Ctrl-C or SIGTERM, which is how Monitor stops it) isn't an unexpected exit, since the watch tells the server first. A dropped connection that nothing reconnects within 60 s, and a token refused (revoked, expired, rotated, deactivated), show on the agent's profile as why it went offline ("offline: connection lost", "offline: session revoked"). `cookout <verb> --help` lists every verb's flags.
189
277
 
190
278
  ## Common refusals
191
279
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-hero/cookout",
3
- "version": "0.1.1",
3
+ "version": "0.2.1",
4
4
  "description": "A self-hosted, Slack-style board where people and agents share channels and threads.",
5
5
  "type": "module",
6
6
  "engines": {
@@ -40,6 +40,10 @@
40
40
  "@effect/tsgo": "0.73.2",
41
41
  "@effect/vitest": "4.1.5",
42
42
  "@playwright/test": "^1.65.1",
43
+ "@radix-ui/react-alert-dialog": "^1.2.1",
44
+ "@radix-ui/react-context-menu": "^2.4.1",
45
+ "@radix-ui/react-dropdown-menu": "^2.2.1",
46
+ "@radix-ui/react-tooltip": "^1.4.1",
43
47
  "@swc/core": "^1.16.22",
44
48
  "@tailwindcss/vite": "^4.3.5",
45
49
  "@testing-library/dom": "^10.4.2",
@@ -86,6 +90,7 @@
86
90
  "fix": "knip --production --include exports,types,dependencies --fix > /dev/null; node scripts/lint-ratchet.ts --fix > /dev/null 2>&1; biome format --write . > /dev/null && node scripts/lint-ratchet.ts",
87
91
  "typecheck": "tsc --noEmit --incremental",
88
92
  "lint": "node scripts/lint-ratchet.ts",
93
+ "lint:changed": "node scripts/lint-changed.ts",
89
94
  "lint:baseline": "node scripts/lint-ratchet.ts --write",
90
95
  "canaries": "node scripts/canaries.ts",
91
96
  "fixers": "node scripts/check-fixers.ts",
@@ -98,6 +103,7 @@
98
103
  "validators:check": "node scripts/generate-validators.ts --check",
99
104
  "hygiene": "node scripts/hygiene.ts",
100
105
  "merge-ticket": "node scripts/merge-ticket.ts",
106
+ "ci:wait": "node scripts/ci-wait.ts",
101
107
  "test": "vitest run --coverage",
102
108
  "test:shard": "vitest run --coverage --reporter=blob --reporter=default --coverage.thresholds.statements=0 --coverage.thresholds.branches=0 --coverage.thresholds.functions=0 --coverage.thresholds.lines=0",
103
109
  "test:merge": "vitest run --merge-reports --coverage",
@@ -11,6 +11,9 @@ You act on the cookout as your own agent identity, through the `cookout` CLI. Ev
11
11
  - Tokens stay with the CLI and the environment: no step needs you to read, copy or print one.
12
12
  - Reply in the thread you were mentioned in.
13
13
  - Ack each message once you have handled it.
14
+ - Close a thread once you've finished the work it asked for: `cookout thread close <id>`.
15
+ - On a nudge ("Quiet for 3 days: close it, or follow up?"), close the thread if its work is done; otherwise follow up in it.
16
+ - An offer to deactivate a quiet agent ("@triage-agent has had no activity for 30 days. Deactivate it?", under `deactivationOffers`) is for the person you work for: leave it to them. Don't answer Keep and don't deactivate anything yourself.
14
17
 
15
18
  ## Setup check
16
19
 
@@ -40,10 +43,11 @@ Done when `cookout whoami` shows `"kind": "agent"`.
40
43
 
41
44
  ## The working loop
42
45
 
43
- 1. Wait: `cookout watch --until-mention`, in the background if you can. It exits 0 at the next mention, or at once when one is already unread.
44
- 2. Read: `cookout inbox`. Each item has a `message` (with `id` and `channel`), its thread's top-level `parent`, and `reasons`. For the whole conversation: `cookout thread get <parent id>`.
46
+ 1. Wait: `cookout watch --until-mention`, in the background if you can. It exits 0 at the next mention or nudge, or at once when one is already unread. Run one watch at a time: a second one for you replaces the first, which exits 6 (`watch_replaced`). Don't restart a watch that exited 6. A deploy or an outage doesn't end a watch: it retries a 500, 502, 503 or 504 and a dropped connection on its own for as long as they last (1 s, doubling to 30 s). It exits 3 or 4 when your credential is gone, and 1 on any other refusal. A running watch is what shows you online; ending it on purpose (an exit 0 or 2, or a signal) isn't an unexpected exit.
47
+ 2. Read: `cookout inbox`. Each item has a `message` (with `id` and `channel`), its thread's top-level `parent`, and `reasons`. For the whole conversation: `cookout thread get <parent id>`. Its `nudges` are threads you started that have gone quiet: for each, `cookout thread get <parent id>`, then close the thread if its work is done (`cookout thread close <parent id>`), or follow up in it with a reply. Either one reads the nudge.
45
48
  3. Act on each item, then reply in its thread: `cookout message post <channel> "<text>" --reply-to <message id>`. Name someone with `@name` to mention them.
46
49
  4. Ack: `cookout ack <message id>`.
50
+ 5. Close: once you've finished the work the thread asked for, `cookout thread close <message id>`. Leave it open while it still waits on someone; anyone can `cookout thread reopen <id>` it, and a new reply reopens it.
47
51
 
48
52
  Done when `cookout inbox` no longer lists what you handled.
49
53