@monster-orange/den 0.4.3 → 0.4.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.
Files changed (58) hide show
  1. package/CHANGELOG.md +179 -0
  2. package/README.md +9 -9
  3. package/docs/distributions.md +215 -65
  4. package/package.json +1 -1
  5. package/src/shared/agents/catalog-runtime.ts +178 -0
  6. package/src/shared/agents/catalog.ts +343 -0
  7. package/src/shared/agents/den-claude.ts +14 -18
  8. package/src/shared/agents/runtime-search.ts +142 -15
  9. package/src/shared/agents/runtime.ts +18 -1
  10. package/src/shared/agents/runtimes.ts +23 -1
  11. package/src/shared/auth/sudo-vault.ts +16 -0
  12. package/src/shared/den-config.ts +57 -3
  13. package/src/shared/edge/status.ts +134 -0
  14. package/src/shared/environment-manager/health.ts +82 -8
  15. package/src/shared/environment-manager/workspaces.ts +54 -0
  16. package/src/shared/health/not-checked.ts +42 -0
  17. package/src/shared/health/rollup.ts +4 -0
  18. package/src/shared/process/spawn-streaming.ts +8 -3
  19. package/src/shared/sessions/client.ts +5 -1
  20. package/src/shared/sessions/host.ts +29 -1
  21. package/src/shared/sessions/protocol.ts +6 -1
  22. package/src/shared/sessions/types.ts +6 -0
  23. package/src/shared/stacks/status.ts +24 -0
  24. package/src/shared/strategies/registry.ts +5 -0
  25. package/src/shared/types/index.ts +6 -0
  26. package/src/ui/cli/agent-ops.ts +210 -19
  27. package/src/ui/cli/agents-command.ts +50 -21
  28. package/src/ui/cli/edge-command.ts +16 -3
  29. package/src/ui/cli/health-display.ts +4 -1
  30. package/src/ui/mcp/scope.ts +23 -3
  31. package/src/ui/mcp/server.ts +31 -7
  32. package/src/ui/mcp/tools.ts +327 -20
  33. package/src/ui/mcp/views.ts +450 -0
  34. package/src/ui/server/agent-routes.ts +118 -28
  35. package/src/ui/server/index.ts +77 -6
  36. package/src/ui/server/public/agent-start.js +46 -7
  37. package/src/ui/server/public/agents-page.js +232 -97
  38. package/src/ui/server/public/agents-section.js +3 -5
  39. package/src/ui/server/public/agents.html +12 -28
  40. package/src/ui/server/public/graph-model.js +2 -0
  41. package/src/ui/server/public/header.js +2 -3
  42. package/src/ui/server/public/health-rollup.js +20 -8
  43. package/src/ui/server/public/i18n/es.js +15 -13
  44. package/src/ui/server/public/i18n/ja.js +14 -13
  45. package/src/ui/server/public/index.html +17 -4
  46. package/src/ui/server/public/local-dev.html +28 -17
  47. package/src/ui/server/public/services.html +21 -5
  48. package/src/ui/server/public/settings-page.js +3 -2
  49. package/src/ui/server/public/settings-registry.js +225 -0
  50. package/src/ui/server/public/settings.html +90 -1
  51. package/src/ui/server/public/shell.js +28 -23
  52. package/src/ui/server/public/topbar.js +166 -206
  53. package/src/ui/server/readonly-routes.ts +29 -5
  54. package/src/ui/server/request-guard.ts +1 -1
  55. package/src/ui/server/route-classes.ts +14 -2
  56. package/src/ui/server/session-routes.ts +9 -1
  57. package/src/ui/server/sudo-store.ts +170 -6
  58. package/src/ui/server/workspace-routes.ts +10 -3
package/CHANGELOG.md CHANGED
@@ -4,6 +4,185 @@ All notable changes to Den are documented here. Each release lists the
4
4
  config and manifest changes a distribution must make to move to it under
5
5
  **Migrations**.
6
6
 
7
+ ## [0.4.4] - 2026-11-07
8
+
9
+ The admin password is for sudo, and nothing else (LK-0). An agent's
10
+ terminal uses its pane's width, and Den knows Codex, Gemini and Grok as
11
+ well as Claude Code (AG-0.5). A scoped agent gets a whole, honest picture
12
+ through Den's MCP (MCP-2).
13
+
14
+ ### Changed
15
+
16
+ - **Nothing asks for the admin password up front.** It was a lock: agent
17
+ start, stop and resume answered `423 locked` without it, and the pages
18
+ asked for it before agent actions, service actions and syncs. It is no
19
+ access check (that is sign-in, the Host/Origin/CSRF checks and agent
20
+ tokens), and Den now asks for it only when a command it runs is about to
21
+ run sudo. Agents, sessions, terminals and services whose commands run no
22
+ sudo never ask. The agent routes' `423 locked` is gone, and so is the
23
+ Start agent dialog's password field.
24
+ - **A run that needs sudo says so, and the page asks then.** Every service
25
+ command (up, down, restart, setup, sync) gets a `sudo` shim first on its
26
+ PATH. With the password held, it gives it to sudo, as before. Without
27
+ it, sudo that needs no password (NOPASSWD, a warm cache) runs as it
28
+ would; anything else never prompts: the run's events carry
29
+ `{ "type": "needs-sudo", "command": "sudo <command>", "step": "<service>" }`
30
+ (sudo's own "a password is required" counts too, without the command).
31
+ The page then says "`sudo <command>` needs your admin password", in the
32
+ top layer, and runs the action again after it. Before asking, it asks
33
+ the server (another tab or device may have set it) and, when one is
34
+ stored, the vault. Local Dev no longer loads it from the vault on page
35
+ load.
36
+ - **No Locked/Unlocked chip.** The top bar shows "🔑 Admin password
37
+ needed" only while a run waits for it. Settings › Command line › Admin
38
+ password says "Saved in 1Password", "Saved for this session" or "Not
39
+ saved", with Forget (`POST /api/sudo-password/forget`, which also clears
40
+ the vault's copy when this server saved or loaded it there).
41
+ `GET /api/sudo-password/status` adds `saved` and `vault`.
42
+ - **Scoped answers say so (MCP-2.2).** `status`, `services`,
43
+ `applications`, `graph`, `stacks` and `workspaces` on a scoped server
44
+ carry a `scope` block: the workspace shown and what is left out
45
+ (`hidden: { repos: 6 }`), pointing at `org_summary`. Their descriptions
46
+ say "This workspace only", and a pinned server registers them without
47
+ the `workspace` parameter (with grants it stays, as the scope's own or a
48
+ granted one). A scoped `graph` is the workspace's own repos and the edges
49
+ out of them; unscoped it is labelled `map: "org-wide"`. Before, `graph`
50
+ listed every repo while every other tool showed one workspace's.
51
+ - **Refusals say how to get more (MCP-2.3).** A call naming another
52
+ workspace says a person adds it to `agents.<id>.grants` in the org config
53
+ and restarts the agent; a refused log read says logs stay inside each
54
+ workspace and a grant does not widen them.
55
+ - **`status` (MCP tool) is an object:** `{ env, counts, services }`, each
56
+ service with a `state` and, when it has no plain verdict, `why`. It was
57
+ the bare `/api/health` array.
58
+
59
+ ### Added
60
+
61
+ - **The runtime catalog (AG-0.5).** Den ships, as data, the vendor CLIs it
62
+ can find: Claude Code (`den-claude`), OpenAI's Codex CLI (`codex`),
63
+ Google's Gemini CLI (`gemini`) and xAI's Grok Build (`grok`), each with
64
+ its binary names, version command, install directories and launch
65
+ command, checked against the vendor's docs. Installed runtimes are
66
+ listed first, with their versions, in the Start agent dialog, Settings
67
+ and `agents doctor`. A runtime other than Claude Code runs its own
68
+ interactive CLI in the workspace's directory, tagged "Den tools:
69
+ coming"; nothing is offered as startable unless it can start here.
70
+ When a catalog runtime is still not found, Den asks your interactive
71
+ shell (`$SHELL -ilc`) once, and says so (`interactive-shell`).
72
+ - **Runtime paths per workspace.** `<ws>.agents.runtimes.<id>.bin` in
73
+ `config/local/workspaces.yml` wins over `agents.runtimes.<id>.bin` in
74
+ `config/local/user.yml`, which wins over what Den finds. **Settings ›
75
+ Agents › Runtimes** shows each runtime's status, version, path and its
76
+ source; **Set path…** runs the version command and refuses a path that
77
+ isn't that runtime, and a selector edits one workspace's paths.
78
+ `agents doctor -w <ws>` shows that workspace's.
79
+ - **The Start agent dialog is the approved width** (the mock's 600px of
80
+ content: 638px wide, never wider than the window less 16px a side).
81
+ - **`org_summary`, the org at a glance for every agent (MCP-2.1).** A new
82
+ read tool: every workspace and repo with status counts (running, partial,
83
+ stopped, inactive; up, down, redirect, not checked), the dependency graph
84
+ (names and edge kinds), the edge (up, TLS, whether HTTPS serves) and the
85
+ environments. Scoped, `yours` adds the agent's own workspace's services
86
+ in full, so "what are our servers?" is answered without `docker ps`. For
87
+ other workspaces it carries names and counts only: never logs, env
88
+ values, commands, URLs, paths or check output.
89
+ - **`edge_status.https` (MCP-2.5)**: the TLS strategy, who supplies the
90
+ cert (`den` or `distribution`) and whether HTTPS is serving, from a TLS
91
+ handshake on the edge's https port. `edge status` prints it too.
92
+
93
+ ### Fixed
94
+
95
+ - **A service's first lines reach the page.** A started service writes to
96
+ its log, and Den tails that log back to the page. The tail started at the
97
+ log's end, so a command that wrote and exited before the tail opened the
98
+ file (on Linux, a refused sudo) showed nothing, and the page never asked
99
+ for the admin password. The tail now reads from the start of this run.
100
+
101
+ - **An agent's terminal uses the pane's width.** A session has one PTY
102
+ size, and the last viewer to resize it won: a second, narrower browser
103
+ (or a hidden tab) left the TUI wrapping at its width in every other
104
+ viewer. The viewer in use now wins: focusing a pane, typing in it after
105
+ another viewer changed the size, and the page being shown again each
106
+ send that pane's size; a hidden pane never resizes the PTY, and no
107
+ resize under 2×2 is sent (the server refuses one too). The server tells
108
+ every viewer the PTY's size on attach and on each change (a `size`
109
+ frame), so a viewer knows when it is out of step. A session host
110
+ that outlived an upgrade sends no such frame, so then every keystroke
111
+ says the typing viewer's size (the same size again redraws nothing). The cells are also
112
+ measured again once fonts finish loading and after a theme is applied,
113
+ so a theme's web font no longer leaves the terminal fitted to the
114
+ fallback font's width.
115
+ - **A Settings row with its own control is drawn.** A custom row without a
116
+ write was drawn as an empty read-only value, so Browser sign-in showed
117
+ nothing; it now shows its state and Sign out.
118
+ - **A redirect is not down (MCP-2.4).** A health check answered `302 →
119
+ /login` (a production app's login page) was reported down. The bug was
120
+ in the shared HTTP check, so the web health row and `<cli> status` had
121
+ it too. A 3xx is now `redirect`: ok null, with its status and target (the
122
+ query dropped), never green, so an ALB's 301 for a stopped service is
123
+ still not taken for up. `target.expect` listing the code counts it as up.
124
+ `<cli> status` shows `redirect 302 → /login`, and `up` and `restart` no
125
+ longer wait out a service that answers with a redirect.
126
+ - **An unchecked service says why (MCP-2.4).** `ok: null` with no reason
127
+ (`runs: none` in beta and prod) now carries `why` on the web health row
128
+ and in `status`: no health check for the env, remote with no check, not
129
+ deployed in the env, or no manifest.
130
+ - **An empty `stacks` explains itself (MCP-2.4):** `/api/stacks` says the
131
+ org config declares no `stacks:` and no repo of the workspace has a
132
+ `compose:` block (or the workspace doesn't exist); scoped, that the
133
+ stacks listed belong to repos outside it.
134
+ - **`certIssued: false` while HTTPS works (MCP-2.5).** It meant "Den minted
135
+ the cert", which is false under `tls: files`. Renamed `certIssuedByDen`.
136
+ - **Security: a scoped `mcp --call` goes through the scoped path, and
137
+ says so.** A review reported that `mcp --workspace A --actor agent:<id>
138
+ --call services '{"workspace":"B"}'` could read workspace B's services
139
+ (paths and commands included). A one-shot now lists and validates
140
+ against the pinned tools exactly as the stdio server registers them, a
141
+ `workspace` naming another workspace always reaches Den's refusal, and
142
+ `--call` prints its scope on stderr (`<cli> mcp --call: scoped to A as
143
+ agent:<id>`), so an unscoped run can't pass for a scoped one. Tests now
144
+ drive the real `bin/den mcp --call` entry.
145
+ - **An ungranted workspace gets Den's refusal (MCP-2.3).** On a scoped
146
+ server with grants, naming a workspace that is not granted answered
147
+ `MCP error -32602 … expected one of "A"|"C"` (the schema). The
148
+ `workspace` parameter is now a name whose description lists the allowed
149
+ ones, and any other gets the refusal naming `agents.<id>.grants` and how
150
+ a person grants it.
151
+ - **The org-wide map is org-wide.** `org_summary.graph` and an unscoped
152
+ `graph` held only the focused workspace's repos, so a repo only in
153
+ another active workspace was missing. They now merge every active
154
+ workspace's graph (`workspaces` names them; `order`, a startup order
155
+ within one workspace, only when one is active); `org_summary` keeps
156
+ names and edge kinds only. `graph` with a `workspace` is labelled
157
+ `map: "workspace"`.
158
+ - **A service's command runs in its own workspace.** The Services page's
159
+ and the tests page's setup, up, down and restart sent no workspace, so a
160
+ service only in a non-focused active workspace failed: `Command "setup"
161
+ not found for <repo>/<svc> … Active workspace: <focus>`. They now send
162
+ the workspace the row was built from. (0.4.3 had the same bug.)
163
+ - **`agents doctor -w <ws>` works.** It answered `workspaces not loaded`;
164
+ it now loads the workspaces config first, as `agents start` does.
165
+ - **A redirect is a redirect in `status`.** A repo row's reason counted a
166
+ service that answered with a redirect as "1 not checked"; it now says
167
+ "1 redirect" (the web header and graph cards too).
168
+
169
+ ### Migrations
170
+
171
+ - A page script that imported `requireUnlock`, `checkUnlock`,
172
+ `isUnlocked` or `onLockChange` from `header.js` or `topbar.js`: they are
173
+ gone. Run the action; when its run's events carry `needs-sudo`, the
174
+ shell asks (`sudoRun()` from `header.js`: `see(msg)` on each event,
175
+ `done(retry)` when the run ends).
176
+ - A client that handled `423 locked` from the agent routes: it no longer
177
+ happens.
178
+ - A distribution may add runtimes with `agents.runtime_catalog` (see
179
+ Runtimes in docs/distributions.md).
180
+ - A script reading `<cli> mcp --call status` gets `{ env, counts, services
181
+ }` in place of the array: read `.services`.
182
+ - `edge_status.certIssued` (and `/api/edge`'s) is deprecated: read
183
+ `certIssuedByDen`, or `https.serving` for whether HTTPS works. It goes in
184
+ the release after 0.4.4.
185
+
7
186
  ## [0.4.3] - 2026-11-06
8
187
 
9
188
  Agents start, and the edge counts as local.
package/README.md CHANGED
@@ -10,8 +10,8 @@
10
10
  </p>
11
11
 
12
12
  <picture>
13
- <source media="(prefers-color-scheme: dark)" srcset="docs/images/0.4.3/hero-dark.png">
14
- <img src="docs/images/0.4.3/hero-light.png" width="100%" alt="Den's Graph page: the demo workspace's services grouped by application, all healthy, with the status chip and the left rail">
13
+ <source media="(prefers-color-scheme: dark)" srcset="docs/images/0.4.4/hero-dark.png">
14
+ <img src="docs/images/0.4.4/hero-light.png" width="100%" alt="Den's Graph page: the demo workspace's services grouped by application, all healthy, with the status chip and the left rail">
15
15
  </picture>
16
16
 
17
17
  ## What Den is
@@ -24,7 +24,7 @@ It doesn't replace your tools. Your repos, Docker, your test runners, your secre
24
24
  yours. Den connects them and turns on good practice from the start.
25
25
 
26
26
  <p align="center">
27
- <img src="docs/images/0.4.3/up.gif" width="100%" alt="make up in the Graph page: every stack down, then demo-api, demo-web and demo-notes come up in dependency order until the status chip reads All 3 healthy">
27
+ <img src="docs/images/0.4.4/up.gif" width="100%" alt="make up in the Graph page: every stack down, then demo-api, demo-web and demo-notes come up in dependency order until the status chip reads All 3 healthy">
28
28
  </p>
29
29
 
30
30
  ## How it helps
@@ -43,8 +43,8 @@ yours. Den connects them and turns on good practice from the start.
43
43
  - **Agents work by the same rules as you.** Start an agent from a persona (planner, orchestrator, developers,
44
44
  devops, reviewer, UX designer, or your own) in a workspace. Its terminal opens in the Agents tab and keeps
45
45
  running when you close the page or restart the web server. Over MCP it sees your stack with the same guards
46
- and audit trail as a person, under a token of its own. Agents can read and investigate. Acting is opt-in,
47
- and the lock still guards starting and stopping things.
46
+ and audit trail as a person, under a token of its own. Agents can read and investigate, and acting is opt-in.
47
+ Starting an agent never asks for your admin password: Den asks for it only when a command it runs needs sudo.
48
48
  - **Safe on localhost, signed in beyond it.** On localhost there is nothing to sign in to. Reached through the
49
49
  edge or your network, every page and call needs a sign-in, and there is no password: `acme web login` prints a
50
50
  one-time link.
@@ -53,10 +53,10 @@ yours. Den connects them and turns on good practice from the start.
53
53
  lives in your own repo.
54
54
 
55
55
  <p align="center">
56
- <img src="docs/images/0.4.3/agents.png" width="49%" alt="The Agents tab: the demo workspace's sessions on the left, and one open in a terminal pane on the right, running demo-api's test and then the service">
57
- <img src="docs/images/0.4.3/workspaces.png" width="49%" alt="The Workspaces page: the demo workspace's repos with their health, mode and Start, Stop, Restart and Logs actions">
58
- <img src="docs/images/0.4.3/status-drawer.png" width="49%" alt="The status drawer: nothing needs attention, and every service in the demo workspace, by application, with its latency">
59
- <img src="docs/images/0.4.3/edge.png" width="49%" alt="The Edge page: the edge container up, its ports and TLS, and every route it serves, Den's own and each stack's, with its upstream">
56
+ <img src="docs/images/0.4.4/agents.png" width="49%" alt="The Agents tab: the demo workspace's sessions on the left, and one open in a terminal pane on the right, running demo-api's test and then the service">
57
+ <img src="docs/images/0.4.4/workspaces.png" width="49%" alt="The Workspaces page: the demo workspace's repos with their health, mode and Start, Stop, Restart and Logs actions">
58
+ <img src="docs/images/0.4.4/status-drawer.png" width="49%" alt="The status drawer: nothing needs attention, and every service in the demo workspace, by application, with its latency">
59
+ <img src="docs/images/0.4.4/edge.png" width="49%" alt="The Edge page: the edge container up, its ports and TLS, and every route it serves, Den's own and each stack's, with its upstream">
60
60
  </p>
61
61
 
62
62
  ## Get started