@adhdev/daemon-standalone 0.8.77 → 0.8.79

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,60 +1,172 @@
1
1
  # @adhdev/daemon-standalone
2
2
 
3
- ADHDev standalone packages the local dashboard, local HTTP/WebSocket API, and session-host-backed CLI runtime management into a single binary.
3
+ ADHDev standalone packages the local dashboard, local HTTP/WebSocket API, and standalone session-host-backed runtime stack into a single self-hosted binary.
4
4
 
5
5
  ## Quick Start
6
6
 
7
+ Recommended path via the main CLI:
8
+
7
9
  ```bash
8
- npx @adhdev/daemon-standalone
10
+ npm install -g adhdev
11
+ adhdev standalone
9
12
  ```
10
13
 
11
- Or install it directly:
14
+ Direct standalone package:
12
15
 
13
16
  ```bash
14
17
  npm install -g @adhdev/daemon-standalone
15
18
  adhdev-standalone
16
19
  ```
17
20
 
18
- Open `http://localhost:3847`.
21
+ One-shot without a global install:
22
+
23
+ ```bash
24
+ npx @adhdev/daemon-standalone
25
+ ```
26
+
27
+ Then open `http://localhost:3847`.
28
+
29
+ ## What It Runs
30
+
31
+ The standalone package runs these local layers together:
32
+
33
+ - bundled standalone dashboard UI
34
+ - local HTTP command/status API
35
+ - local WebSocket transport for real-time updates
36
+ - standalone session-host namespace for hosted CLI runtime recovery
37
+ - terminal-mux routes for local workspace terminal flows
38
+
39
+ Everything runs on your machine. No cloud account is required for this package.
19
40
 
20
- ## What It Exposes
41
+ ## Current Local Surface
21
42
 
22
- - Bundled standalone dashboard
23
- - Local API routes such as `GET /api/v1/status` and `POST /api/v1/command`
24
- - Runtime snapshot and event streams for hosted CLI sessions
25
- - Workspace mux routes for local terminal flows
26
- - `ws://localhost:3847/ws` for real-time updates
27
- - Local runtime commands: `list`, `attach`, and `open`
43
+ Standalone currently exposes:
44
+
45
+ - `GET /api/v1/status`
46
+ - `POST /api/v1/command`
47
+ - `GET /api/v1/runtime/:sessionId/snapshot`
48
+ - `GET /api/v1/runtime/:sessionId/events`
49
+ - `GET /api/v1/mux/:workspaceName/state`
50
+ - `GET /api/v1/mux/:workspaceName/socket-info`
51
+ - `POST /api/v1/mux/:workspaceName/control`
52
+ - `GET /api/v1/mux/:workspaceName/events`
53
+ - `GET /auth/session`
54
+ - `POST /auth/login`
55
+ - `POST /auth/logout`
56
+ - `POST /auth/password`
57
+ - `GET /api/v1/standalone/preferences`
58
+ - `POST /api/v1/standalone/preferences`
59
+ - `ws://localhost:3847/ws`
60
+
61
+ Canonical runtime contract:
62
+
63
+ - `GET /api/v1/status` and its `sessions[]` array are the source of truth
64
+ - raw `targetSessionId` is the canonical runtime identifier for command routing
65
+ - older per-surface projections should be treated as convenience views, not the main runtime model
28
66
 
29
67
  ## Options
30
68
 
31
69
  | Flag | Description |
32
70
  |------|-------------|
33
- | `--port, -p <port>` | Port to listen on (default: `3847`) |
34
- | `--host, -H` | Listen on all interfaces and bind to `0.0.0.0` |
35
- | `--no-open` | Don't open browser automatically on start |
36
- | `--token <secret>` | Enable token authentication for API and WebSocket |
71
+ | `--port, -p <port>` | Change the local HTTP and WebSocket port (default: `3847`) |
72
+ | `--host, -H` | Bind to `0.0.0.0` so other devices on your LAN can open the dashboard |
73
+ | `--no-open` | Do not auto-open the browser on startup |
74
+ | `--token <secret>` | Enable token auth for dashboard, API, and WebSocket access |
37
75
  | `--dev` | Enable DevConsole and provider debugging helpers |
38
76
  | `--public <path>` | Serve the dashboard from a custom build directory |
39
77
 
40
- ## Runtime Commands
78
+ ### What These Choices Mean In Practice
79
+
80
+ | Choice | End-user effect |
81
+ |--------|-----------------|
82
+ | `adhdev-standalone` | Dashboard is reachable only from the same machine via localhost |
83
+ | `adhdev-standalone --host` | Dashboard is also reachable from other devices on the same LAN |
84
+ | `adhdev-standalone --token mysecret` | Browser/API/WebSocket access must authenticate with that token |
85
+ | dashboard password enabled in Settings | Browser users see a password prompt and then get a local session cookie |
86
+ | `--host` with no token and no password | Standalone warns that the dashboard is exposed to the LAN without protection |
87
+ | `--no-open` | Server starts normally, but does not auto-launch a browser window |
88
+
89
+ Environment variables:
90
+
91
+ - `ADHDEV_TOKEN` — token auth fallback when `--token` is not passed
92
+ - `ADHDEV_SESSION_HOST_NAME` — override the standalone session-host namespace (default: `adhdev-standalone`)
93
+ - `ADHDEV_RESTORE_HOSTED_SESSIONS_ON_STARTUP=1` — opt into restoring hosted runtimes on startup; ordinary standalone launch stays fresh by default
94
+
95
+ ## Auth And Network Behavior
96
+
97
+ For end-user behavior, the canonical docs are:
98
+
99
+ - setup and startup flags → https://docs.adhf.dev/self-hosted/setup
100
+ - password auth and saved network defaults → https://docs.adhf.dev/self-hosted/configuration
101
+ - local route contract and examples → https://docs.adhf.dev/self-hosted/local-api
102
+
103
+ By default, standalone binds to localhost only.
104
+
105
+ For LAN access:
106
+
107
+ ```bash
108
+ adhdev-standalone --host
109
+ ```
110
+
111
+ If you expose standalone on `0.0.0.0` without either token auth or a dashboard password, startup logs warn that anyone on your LAN can open and control the dashboard until you secure it.
112
+
113
+ `--host` does not publish your machine to the public internet by itself. It only changes the bind address from localhost to all interfaces on the current network. Whether that is reachable outside your LAN still depends on your router/firewall setup.
114
+
115
+ Standalone supports two local auth patterns:
116
+
117
+ 1. token auth via `--token` or `ADHDEV_TOKEN`
118
+ 2. dashboard-managed password auth for browser sessions
119
+
120
+ Use token auth for scripts, curl, and explicit operator access. Use the dashboard password when you want normal browser users on the machine or LAN to see a login prompt and get a local session cookie after signing in.
121
+
122
+ You can set or rotate the dashboard password from:
123
+
124
+ - `Settings` → `Dashboard Security`
125
+
126
+ You can also save the default network bind preference from:
127
+
128
+ - `Settings` → `Network Access`
129
+
130
+ That preference is stored locally under `~/.adhdev/` and controls whether future launches default to localhost-only or LAN bind mode.
131
+
132
+ Common end-user patterns:
133
+
134
+ - using ADHDev only from the same machine → run plain `adhdev-standalone`
135
+ - opening the dashboard from another device on the same Wi-Fi → use `--host`, then set a dashboard password from `Settings` → `Dashboard Security`
136
+ - calling the local API from scripts or curl → use `--token`
137
+
138
+ ## Runtime Helpers
139
+
140
+ The standalone package itself exposes lightweight session-host helpers:
41
141
 
42
142
  ```bash
43
143
  adhdev-standalone list
144
+ adhdev-standalone list --all
44
145
  adhdev-standalone attach <sessionId>
45
- adhdev-standalone open <sessionId>
146
+ adhdev-standalone attach <sessionId> --read-only
147
+ adhdev-standalone attach <sessionId> --takeover
46
148
  ```
47
149
 
150
+ Notes:
151
+
152
+ - `list` and `runtimes` are equivalent helper commands
153
+ - the standalone package does not currently expose a direct `open` helper command
154
+ - for the fuller hosted-runtime workflow (`runtime recover`, `runtime restart`, `runtime snapshot`, `runtime open`), use the main `adhdev` CLI docs
155
+
48
156
  ## Notes
49
157
 
50
- - The canonical runtime model is `GET /api/v1/status` and its `sessions[]` array.
51
- - Treat built-in provider inventory as shipped inventory, not blanket verified support.
52
- - On Windows, Node.js 24+ is currently blocked for the normal install/start path. Use Node.js 22.x instead.
158
+ - standalone uses its own default session-host namespace: `adhdev-standalone`
159
+ - cloud/global daemon defaults to `adhdev`
160
+ - keeping those separate avoids standalone and cloud-connected runtimes fighting over the same hosted sessions on one machine
161
+ - built-in provider inventory means shipped inventory, not blanket verified support
162
+ - on Windows, Node.js 24+ is currently blocked for the normal install/start path; use Node.js 22.x instead
53
163
 
54
164
  ## Links
55
165
 
56
166
  - [Self-hosted setup](https://docs.adhf.dev/self-hosted/setup)
167
+ - [Self-hosted configuration](https://docs.adhf.dev/self-hosted/configuration)
57
168
  - [Self-hosted local API](https://docs.adhf.dev/self-hosted/local-api)
169
+ - [Self-hosted session host](https://docs.adhf.dev/self-hosted/session-host)
58
170
  - [GitHub](https://github.com/vilmire/adhdev)
59
171
 
60
172
  ## License
package/dist/index.js CHANGED
@@ -31509,7 +31509,8 @@ ${data.message || ""}`.trim();
31509
31509
  resetState: () => resetState,
31510
31510
  resolveChatMessageKind: () => resolveChatMessageKind,
31511
31511
  resolveDebugRuntimeConfig: () => resolveDebugRuntimeConfig,
31512
- resolveSessionHostAppName: () => resolveSessionHostAppName2,
31512
+ resolveSessionHostAppName: () => resolveSessionHostAppName,
31513
+ resolveSessionHostAppNameResolution: () => resolveSessionHostAppNameResolution2,
31513
31514
  runAsyncBatch: () => runAsyncBatch2,
31514
31515
  saveConfig: () => saveConfig,
31515
31516
  saveState: () => saveState,
@@ -44200,10 +44201,15 @@ Run 'adhdev doctor' for detailed diagnostics.`
44200
44201
  }
44201
44202
  var SKIP_COMMANDS = /* @__PURE__ */ new Set([
44202
44203
  "heartbeat",
44203
- "status_report"
44204
+ "status_report",
44205
+ "read_chat",
44206
+ "mark_session_seen"
44204
44207
  ]);
44208
+ function shouldLogCommand(cmd) {
44209
+ return !SKIP_COMMANDS.has(cmd);
44210
+ }
44205
44211
  function logCommand(entry) {
44206
- if (SKIP_COMMANDS.has(entry.cmd)) return;
44212
+ if (!shouldLogCommand(entry.cmd)) return;
44207
44213
  try {
44208
44214
  if (++writeCount2 % 500 === 0) {
44209
44215
  checkRotation();
@@ -52629,20 +52635,32 @@ data: ${JSON.stringify(msg.data)}
52629
52635
  };
52630
52636
  var DEFAULT_SESSION_HOST_APP_NAME = "adhdev";
52631
52637
  var DEFAULT_STANDALONE_SESSION_HOST_APP_NAME = "adhdev-standalone";
52632
- function validateStandaloneSessionHostAppName(explicit) {
52633
- if (explicit !== DEFAULT_SESSION_HOST_APP_NAME) return;
52634
- throw new Error(
52635
- `Standalone session-host namespace '${DEFAULT_SESSION_HOST_APP_NAME}' is reserved for the global daemon. Use '${DEFAULT_STANDALONE_SESSION_HOST_APP_NAME}' or another non-default namespace.`
52636
- );
52638
+ function getReservedStandaloneNamespaceWarning() {
52639
+ return `Standalone session-host namespace '${DEFAULT_SESSION_HOST_APP_NAME}' is reserved for the global daemon. Falling back to '${DEFAULT_STANDALONE_SESSION_HOST_APP_NAME}' for this standalone run.`;
52637
52640
  }
52638
- function resolveSessionHostAppName2(options = {}) {
52641
+ function resolveSessionHostAppNameResolution2(options = {}) {
52639
52642
  const env = options.env || process.env;
52640
52643
  const explicit = typeof env.ADHDEV_SESSION_HOST_NAME === "string" ? env.ADHDEV_SESSION_HOST_NAME.trim() : "";
52641
52644
  if (explicit) {
52642
- if (options.standalone) validateStandaloneSessionHostAppName(explicit);
52643
- return explicit;
52645
+ if (options.standalone && explicit === DEFAULT_SESSION_HOST_APP_NAME) {
52646
+ return {
52647
+ appName: DEFAULT_STANDALONE_SESSION_HOST_APP_NAME,
52648
+ warning: getReservedStandaloneNamespaceWarning(),
52649
+ source: "reserved-standalone-fallback"
52650
+ };
52651
+ }
52652
+ return {
52653
+ appName: explicit,
52654
+ source: "explicit"
52655
+ };
52644
52656
  }
52645
- return options.standalone ? DEFAULT_STANDALONE_SESSION_HOST_APP_NAME : DEFAULT_SESSION_HOST_APP_NAME;
52657
+ return {
52658
+ appName: options.standalone ? DEFAULT_STANDALONE_SESSION_HOST_APP_NAME : DEFAULT_SESSION_HOST_APP_NAME,
52659
+ source: "default"
52660
+ };
52661
+ }
52662
+ function resolveSessionHostAppName(options = {}) {
52663
+ return resolveSessionHostAppNameResolution2(options).appName;
52646
52664
  }
52647
52665
  var import_session_host_core32 = require_dist();
52648
52666
  var STARTUP_TIMEOUT_MS = 8e3;
@@ -53191,11 +53209,15 @@ var fs2 = __toESM(require("fs"));
53191
53209
  var os2 = __toESM(require("os"));
53192
53210
  var path = __toESM(require("path"));
53193
53211
  var import_daemon_core = __toESM(require_dist2());
53194
- var SESSION_HOST_APP_NAME = (0, import_daemon_core.resolveSessionHostAppName)({ standalone: true });
53212
+ var SESSION_HOST_APP_NAME_RESOLUTION = (0, import_daemon_core.resolveSessionHostAppNameResolution)({ standalone: true });
53213
+ var SESSION_HOST_APP_NAME = SESSION_HOST_APP_NAME_RESOLUTION.appName;
53195
53214
  var SESSION_HOST_START_TIMEOUT_MS = 15e3;
53196
53215
  function getStandaloneSessionHostAppName() {
53197
53216
  return SESSION_HOST_APP_NAME;
53198
53217
  }
53218
+ function getStandaloneSessionHostAppNameWarning() {
53219
+ return SESSION_HOST_APP_NAME_RESOLUTION.warning;
53220
+ }
53199
53221
  function buildSessionHostEnv(baseEnv) {
53200
53222
  const env = {};
53201
53223
  for (const [key, value] of Object.entries(baseEnv)) {
@@ -54167,6 +54189,10 @@ var StandaloneServer = class {
54167
54189
  const cdpCount = [...this.components.cdpManagers.values()].filter((m) => m.isConnected).length;
54168
54190
  console.log(` CDP: ${cdpCount > 0 ? `\u2705 ${cdpCount} connected` : "\u274C none"}`);
54169
54191
  console.log(` Providers: ${this.components.providerLoader.getAll().length} loaded`);
54192
+ const sessionHostWarning = getStandaloneSessionHostAppNameWarning();
54193
+ if (sessionHostWarning) {
54194
+ console.warn(` \u26A0\uFE0F ${sessionHostWarning}`);
54195
+ }
54170
54196
  console.log(` Session Host: ${getStandaloneSessionHostAppName()}`);
54171
54197
  if (options.dev) {
54172
54198
  console.log(` \u{1F6E0}\uFE0F DevConsole: http://127.0.0.1:19280`);