@rubytech/create-maxy-code 0.1.216 → 0.1.219
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/package.json +1 -1
- package/payload/platform/lib/mcp-eager/dist/index.d.ts +0 -55
- package/payload/platform/lib/mcp-eager/dist/index.d.ts.map +1 -1
- package/payload/platform/lib/mcp-eager/dist/index.js +0 -76
- package/payload/platform/lib/mcp-eager/dist/index.js.map +1 -1
- package/payload/platform/lib/mcp-eager/src/index.ts +0 -101
- package/payload/platform/plugins/admin/hooks/__tests__/hook-emit-stale-lock-ttl.test.sh +102 -0
- package/payload/platform/plugins/admin/hooks/__tests__/pre-tool-use-admin-tool-gate.test.sh +52 -112
- package/payload/platform/plugins/admin/hooks/lib/hook-emit.sh +29 -1
- package/payload/platform/plugins/admin/hooks/post-tool-use-agent.sh +20 -1
- package/payload/platform/plugins/admin/hooks/pre-tool-use.sh +0 -72
- package/payload/platform/plugins/admin/skills/platform-architecture/SKILL.md +11 -18
- package/payload/platform/plugins/browser/mcp/dist/index.js +19 -19
- package/payload/platform/plugins/browser/mcp/dist/index.js.map +1 -1
- package/payload/platform/plugins/docs/references/platform.md +10 -17
- package/payload/platform/plugins/email/mcp/dist/index.js +12 -12
- package/payload/platform/plugins/email/mcp/dist/index.js.map +1 -1
- package/payload/platform/plugins/memory/mcp/dist/index.js +8 -8
- package/payload/platform/plugins/memory/mcp/dist/index.js.map +1 -1
- package/payload/platform/plugins/url-get/mcp/dist/index.js +2 -2
- package/payload/platform/plugins/url-get/mcp/dist/index.js.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/http-server.d.ts +0 -14
- package/payload/platform/services/claude-session-manager/dist/http-server.d.ts.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/http-server.js +25 -69
- package/payload/platform/services/claude-session-manager/dist/http-server.js.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/index.js +12 -31
- package/payload/platform/services/claude-session-manager/dist/index.js.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/jsonl-tail.d.ts +3 -0
- package/payload/platform/services/claude-session-manager/dist/jsonl-tail.d.ts.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/jsonl-tail.js +55 -1
- package/payload/platform/services/claude-session-manager/dist/jsonl-tail.js.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/pty-spawner.d.ts +1 -1
- package/payload/platform/services/claude-session-manager/dist/pty-spawner.js +1 -1
- package/payload/platform/services/claude-session-manager/dist/rc-daemon.d.ts +23 -17
- package/payload/platform/services/claude-session-manager/dist/rc-daemon.d.ts.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/rc-daemon.js +94 -73
- package/payload/platform/services/claude-session-manager/dist/rc-daemon.js.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/rc-life.d.ts +4 -0
- package/payload/platform/services/claude-session-manager/dist/rc-life.d.ts.map +1 -0
- package/payload/platform/services/claude-session-manager/dist/rc-life.js +16 -0
- package/payload/platform/services/claude-session-manager/dist/rc-life.js.map +1 -0
- package/payload/platform/services/claude-session-manager/dist/systemd-scope.d.ts +12 -46
- package/payload/platform/services/claude-session-manager/dist/systemd-scope.d.ts.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/systemd-scope.js +24 -73
- package/payload/platform/services/claude-session-manager/dist/systemd-scope.js.map +1 -1
- package/payload/platform/templates/agents/admin/IDENTITY.md +3 -3
- package/payload/premium-plugins/writer-craft/mcp/dist/index.d.ts.map +1 -1
- package/payload/premium-plugins/writer-craft/mcp/dist/index.js +4 -5
- package/payload/premium-plugins/writer-craft/mcp/dist/index.js.map +1 -1
- package/payload/premium-plugins/writer-craft/mcp/src/index.ts +4 -5
- package/payload/server/public/assets/AdminShell-BcxEZnpu.js +1 -0
- package/payload/server/public/assets/{admin-DjGGOx2K.js → admin-DMo5DWKH.js} +1 -1
- package/payload/server/public/assets/{data-WBEvtRV-.js → data-D6IQdm0R.js} +1 -1
- package/payload/server/public/assets/{graph-DsOLsIPf.js → graph-PkZKVkWD.js} +1 -1
- package/payload/server/public/data.html +2 -2
- package/payload/server/public/graph.html +2 -2
- package/payload/server/public/index.html +2 -2
- package/payload/server/server.js +0 -6
- package/payload/premium-plugins/writer-craft/lib/mcp-eager/dist/index.d.ts +0 -116
- package/payload/premium-plugins/writer-craft/lib/mcp-eager/dist/index.d.ts.map +0 -1
- package/payload/premium-plugins/writer-craft/lib/mcp-eager/dist/index.js +0 -125
- package/payload/premium-plugins/writer-craft/lib/mcp-eager/dist/index.js.map +0 -1
- package/payload/premium-plugins/writer-craft/lib/mcp-eager/package.json +0 -7
- package/payload/server/public/assets/AdminShell-CPWbJ_I8.js +0 -1
|
@@ -28,6 +28,8 @@ set -uo pipefail
|
|
|
28
28
|
: "${MAXY_HOOK_SERVER_LOG:=$HOME/.maxy-code/logs/server.log}"
|
|
29
29
|
: "${MAXY_HOOK_LOCK_ATTEMPTS:=100}"
|
|
30
30
|
: "${MAXY_HOOK_LOCK_SLEEP:=0.01}"
|
|
31
|
+
# Task 569 — TTL for orphaned lockdirs (see hook-emit.sh for rationale).
|
|
32
|
+
: "${MAXY_HOOK_LOCK_TTL_SECONDS:=5}"
|
|
31
33
|
|
|
32
34
|
if [ -t 0 ]; then
|
|
33
35
|
# No stdin — no correlation possible. Fail-open.
|
|
@@ -65,9 +67,26 @@ NOW_EPOCH=$(date +%s)
|
|
|
65
67
|
N_OBSERVED=0
|
|
66
68
|
N_EMITTED=0
|
|
67
69
|
|
|
70
|
+
# Task 569 — same stale-lockdir TTL reclamation as hook-emit.sh.
|
|
71
|
+
_drain_lockdir_age_seconds() {
|
|
72
|
+
local lockdir="$1" mtime now
|
|
73
|
+
mtime=$(stat -c %Y "$lockdir" 2>/dev/null || stat -f %m "$lockdir" 2>/dev/null)
|
|
74
|
+
[[ -z "$mtime" ]] && { echo -1; return; }
|
|
75
|
+
now=$(date +%s)
|
|
76
|
+
echo $((now - mtime))
|
|
77
|
+
}
|
|
78
|
+
|
|
68
79
|
_drain_acquire_lock() {
|
|
69
|
-
local lockdir="$1" i=0
|
|
80
|
+
local lockdir="$1" i=0 age
|
|
70
81
|
while ! mkdir "$lockdir" 2>/dev/null; do
|
|
82
|
+
age=$(_drain_lockdir_age_seconds "$lockdir")
|
|
83
|
+
if [[ "$age" -ge "$MAXY_HOOK_LOCK_TTL_SECONDS" ]]; then
|
|
84
|
+
rmdir "$lockdir" 2>/dev/null || rm -rf "$lockdir" 2>/dev/null
|
|
85
|
+
mkdir -p "$(dirname "$MAXY_HOOK_SERVER_LOG")" 2>/dev/null
|
|
86
|
+
printf '[hook-propagate-error] reason=stale-lock-reclaimed lockdir=%s ageSeconds=%s\n' \
|
|
87
|
+
"$lockdir" "$age" >>"$MAXY_HOOK_SERVER_LOG" 2>/dev/null || true
|
|
88
|
+
mkdir "$lockdir" 2>/dev/null && return 0
|
|
89
|
+
fi
|
|
71
90
|
i=$((i+1))
|
|
72
91
|
[[ "$i" -ge "$MAXY_HOOK_LOCK_ATTEMPTS" ]] && return 1
|
|
73
92
|
sleep "$MAXY_HOOK_LOCK_SLEEP" 2>/dev/null || true
|
|
@@ -43,78 +43,6 @@ except Exception:
|
|
|
43
43
|
# ---------------------------------------------------------------------------
|
|
44
44
|
if [ "$AGENT_TYPE" = "admin" ]; then
|
|
45
45
|
|
|
46
|
-
# ── Orchestration-only authoring + research block (Task 529, 559, 566) ───
|
|
47
|
-
# The admin seat is orchestration + clarification + delivery only.
|
|
48
|
-
# Write/Edit/MultiEdit/Bash/WebFetch/WebSearch are specialist-owned —
|
|
49
|
-
# content-producer for authoring, research-assistant for research, the
|
|
50
|
-
# shell tools for whichever specialist owns the workflow that needs them.
|
|
51
|
-
# In-window Task subagents must keep these tools (Task 222 regression
|
|
52
|
-
# class). Maxy MCP `Agent`-spawned specialists are separate top-level
|
|
53
|
-
# `claude rc` processes — they have no `parent_tool_use_id` but pty-spawner
|
|
54
|
-
# stamps `MAXY_SPECIALIST=<name>` on the child env (pty-spawner.ts:1601).
|
|
55
|
-
#
|
|
56
|
-
# Discriminator (union of positive markers, never path-shape inference):
|
|
57
|
-
# parent_tool_use_id non-empty → in-window Task subagent (allow)
|
|
58
|
-
# $MAXY_SPECIALIST non-empty → maxy MCP Agent specialist (allow)
|
|
59
|
-
# $MAXY_SESSION_ROLE = admin → admin-direct (block, orchestration-only)
|
|
60
|
-
# none of the above → fail closed (missing-marker)
|
|
61
|
-
#
|
|
62
|
-
# Adding a future spawn shape that lands neither marker surfaces as a loud
|
|
63
|
-
# `reason=missing-marker` block, not a silent passthrough or a silent
|
|
64
|
-
# admin-direct block on legitimate specialist work.
|
|
65
|
-
case "$TOOL_NAME" in
|
|
66
|
-
Write|Edit|MultiEdit|Bash|WebFetch|WebSearch)
|
|
67
|
-
PARENT_TOOL_USE_ID=$(echo "$INPUT" | python3 -c '
|
|
68
|
-
import sys, json
|
|
69
|
-
try:
|
|
70
|
-
v = json.load(sys.stdin).get("parent_tool_use_id", "")
|
|
71
|
-
print(v if isinstance(v, str) else "")
|
|
72
|
-
except Exception:
|
|
73
|
-
print("")
|
|
74
|
-
' 2>/dev/null)
|
|
75
|
-
SPECIALIST="${MAXY_SPECIALIST:-}"
|
|
76
|
-
SESSION_ROLE="${MAXY_SESSION_ROLE:-}"
|
|
77
|
-
if [ -n "$PARENT_TOOL_USE_ID" ] || [ -n "$SPECIALIST" ]; then
|
|
78
|
-
# Subagent — passthrough. Tool name resolves on the subagent's
|
|
79
|
-
# own frontmatter `tools:` allowlist downstream.
|
|
80
|
-
SOURCE="task-subagent"
|
|
81
|
-
if [ -n "$SPECIALIST" ] && [ -n "$PARENT_TOOL_USE_ID" ]; then
|
|
82
|
-
SOURCE="task-subagent+mcp-specialist"
|
|
83
|
-
elif [ -n "$SPECIALIST" ]; then
|
|
84
|
-
SOURCE="mcp-specialist"
|
|
85
|
-
fi
|
|
86
|
-
echo "[admin-tool-gate] role=subagent parent_tool_use_id=${PARENT_TOOL_USE_ID:--} specialist=${SPECIALIST:--} session_role=${SESSION_ROLE:--} tool=${TOOL_NAME} decision=allow source=${SOURCE}" >&2
|
|
87
|
-
elif [ "$SESSION_ROLE" = "admin" ]; then
|
|
88
|
-
# Admin direct invocation — refuse with dispatch hint.
|
|
89
|
-
case "$TOOL_NAME" in
|
|
90
|
-
Write|Edit|MultiEdit)
|
|
91
|
-
OWNER="content-producer"
|
|
92
|
-
;;
|
|
93
|
-
Bash)
|
|
94
|
-
OWNER="the specialist that owns the workflow needing shell access"
|
|
95
|
-
;;
|
|
96
|
-
WebFetch|WebSearch)
|
|
97
|
-
OWNER="research-assistant"
|
|
98
|
-
;;
|
|
99
|
-
esac
|
|
100
|
-
echo "[admin-tool-gate] role=admin parent_tool_use_id=- specialist=- session_role=admin tool=${TOOL_NAME} decision=block reason=orchestration-only owner=${OWNER}" >&2
|
|
101
|
-
hook_block_with_emit "$SESSION_ID" "admin-tool-gate" "${TOOL_NAME}" \
|
|
102
|
-
"orchestration-only" \
|
|
103
|
-
"Blocked: \`${TOOL_NAME}\` is not callable from the admin seat. The admin seat is orchestration + clarification + delivery only — authoring, shell work, and web research are owned by specialists.
|
|
104
|
-
Dispatch the work to ${OWNER} via the Agent tool."
|
|
105
|
-
else
|
|
106
|
-
# No positive marker — fail closed. A new spawn shape that lands
|
|
107
|
-
# neither parent_tool_use_id nor MAXY_SPECIALIST and is not the
|
|
108
|
-
# admin seat should surface visibly, not silently pass or silently
|
|
109
|
-
# block under the wrong reason.
|
|
110
|
-
echo "[admin-tool-gate] role=unknown parent_tool_use_id=- specialist=- session_role=${SESSION_ROLE:--} tool=${TOOL_NAME} decision=block reason=missing-marker" >&2
|
|
111
|
-
hook_block_with_emit "$SESSION_ID" "admin-tool-gate" "${TOOL_NAME}" \
|
|
112
|
-
"missing-marker" \
|
|
113
|
-
"Blocked: \`${TOOL_NAME}\` call carries no positive role marker (no parent_tool_use_id, no MAXY_SPECIALIST, MAXY_SESSION_ROLE is not 'admin'). Failing closed so a new spawn shape cannot silently bypass orchestration gating."
|
|
114
|
-
fi
|
|
115
|
-
;;
|
|
116
|
-
esac
|
|
117
|
-
|
|
118
46
|
# ── Code directory protection ────────────────────────────────────────────
|
|
119
47
|
case "$TOOL_NAME" in
|
|
120
48
|
Write|Edit)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: platform-architecture
|
|
3
3
|
description: Use when grounding any documented-surface claim about what Maxy ships — plugins, skills, specialists, install/deploy flows, internals. This is the install catalogue, not evidence of what is enabled on the current account. For install state on this account, call `capabilities-here`; for documented surface, cite the `Source:` URL inline.
|
|
4
|
-
content-hash: sha256:
|
|
4
|
+
content-hash: sha256:d8c18dc6630fbbddd4408fa971e7786cddfe36288714ac1e3840530d18903e91
|
|
5
5
|
brand: maxy-code
|
|
6
6
|
product-name: Maxy
|
|
7
7
|
---
|
|
@@ -218,21 +218,23 @@ Each session row also carries a small muted timestamp crumb under the name showi
|
|
|
218
218
|
|
|
219
219
|
**Download JSONL (Task 197).** `GET /<id>/log?download=1` is a one-shot byte-stream of the session's JSONL transcript with attachment-disposition headers, designed for the pane's **Download JSONL** button. Headers: `Content-Type: application/x-ndjson`, `Content-Disposition: attachment; filename="<sessionId>.jsonl"` (the basename is sanitised so any non-`[A-Za-z0-9._-]` character is replaced with underscore), `Cache-Control: no-store`. Four status branches: **200** with the byte-identical file body; **404** `{error: 'session-not-found'}` when the store has no row for the id; **202** `{pending: true, jsonlPath: null}` when the row exists but claude has not flushed the first turn yet; **404** `{error: 'jsonl-missing-on-disk'}` when the row carries a `jsonlPath` but the file has been removed under the manager (post-Purge race). The download branch is declared **before** the follow check, so `?download=1` always wins over `?follow=1` if both are set. The proxy at `app.get('/:sessionId/log')` rebuilds the upstream query from a fixed `follow|download` allowlist; inbound query keys outside that allowlist are dropped. Observability: `[claude-session-manager] log-download sessionId=<sid> bytes=<n> ms=<n>` lands per successful stream completion; the browser console emits `[admin-ui] pane-download-jsonl sessionId=<8> outcome=initiated` on click. `outcome=initiated` rather than `outcome=ok` is intentional — the handler resolves before the browser writes the bytes, so the log line names "the request was kicked off", not "the file landed". If the file does not appear in the operator's downloads folder, check the manager line for the bytes count and the browser's downloads UI for the suppression record. Auth is unchanged from the rest of the `/api/admin/claude-sessions` surface (cookie session via `requireAdminSession`); there is no new key surface.
|
|
220
220
|
|
|
221
|
-
**Two spawn
|
|
221
|
+
**Two spawn surfaces, one primitive (Task 573).** The manager runs two on-device spawn surfaces, both backed by the same primitive: **node-pty wrapped in `systemd-run --user --scope`** (via `index.ts::spawnPtyAdapter`).
|
|
222
222
|
|
|
223
|
-
- **`claude rc` daemon** — spawned at platform boot by `rc-daemon.ts
|
|
224
|
-
- **`claude --remote-control` on-device sidebar spawn** — spawned per-click by `/rc-spawn` in `http-server.ts
|
|
223
|
+
- **`claude rc` daemon** — spawned at platform boot by `rc-daemon.ts`. One supervised daemon per account; owns the long-lived composer session that backs claude.ai/code Remote Control. Master fd held for the daemon's lifetime, released on natural exit / restart.
|
|
224
|
+
- **`claude --remote-control` on-device sidebar spawn** — spawned per-click by `/rc-spawn` in `http-server.ts`. One PTY per click; the manager holds the master fd **for the session's entire lifetime**. The pty master IS the live session — claude operates on the slave, and closing the master hangs up the slave. Valid master-release points: (1) explicit operator teardown — `/stop` → `stopSession` → `op=archive-release` — and (2) the natural-exit path inside `pty.onExit → handlePtyNaturalExit`.
|
|
225
225
|
|
|
226
|
-
|
|
226
|
+
Inside the scope, `sh -c 'trap "" HUP; exec "$@"' sh <claudeBin> <args...>` keeps claude resident across PTY master-close (SIGHUP trap) and preserves the pid through the exec chain. The earlier `script(1)` wrap and the non-PTY scope primitive (Tasks 552/556/562) are gone; node-pty allocates the TTY directly.
|
|
227
|
+
|
|
228
|
+
**`/rc-spawn` lifecycle observability (Task 573).** Every on-device sidebar resume emits a stream of `[rc-spawn]` lines tagged with the same `unitToken=rc-resume-<uuid>` so one spawn's full lifeline can be reconstructed by `grep` alone. The lines, in order:
|
|
227
229
|
|
|
228
230
|
| Step | Line shape |
|
|
229
231
|
|------|-----------|
|
|
230
232
|
| 1 | `[rc-spawn] op=request unitToken=<t> sessionId=<8|new> name=<…|none> mode=<resume|fresh> jsonl=<path|none>` |
|
|
231
233
|
| 2 | `[rc-spawn] op=argv unitToken=<t> cwd=<dir> argv=<json>` (inner claude argv; the `systemd-run --scope` wrap is composed by the spawnPty adapter) |
|
|
232
234
|
| 3 | `[rc-spawn] op=pty-spawned unitToken=<t> pid=<pid> openFds=<n>` (fd baseline) |
|
|
233
|
-
| 4 | `[rc-spawn] op=child-output unitToken=<t> pid=<pid> head=<json>` (first ≤1 KB or 500 ms idle — claude's own words
|
|
234
|
-
| 5 | `[rc-spawn] op=
|
|
235
|
-
| 6 | `[rc-spawn] op=
|
|
235
|
+
| 4 | `[rc-spawn] op=child-output unitToken=<t> pid=<pid> head=<json>` (first ≤1 KB or 500 ms idle — claude's own words) |
|
|
236
|
+
| 5 | `[rc-spawn] op=early-exit unitToken=<t> pid=<pid> ranMs=<n> exitCode=<n> signal=<…>` — fires when `pty.onExit` lands before the pid file |
|
|
237
|
+
| 6 | `[rc-spawn] op=pidfile-present unitToken=<t> pid=<pid> path=<sessions/<pid>.json> ageMs=<n> bridgeId=<…>` — **terminal success.** The on-disk PID file IS the evidence; no synchronous liveness inference. The tracker remains in `livePtys` for the session's lifetime. |
|
|
236
238
|
| 7 | `[pty-tracker] op=spawn sessionId=<8> pid=<pid> size=<n>` (also fires for spawnClaudeSession; same line shape on the rc-spawn path) |
|
|
237
239
|
| 8 | `[rc-spawn] op=exit unitToken=<t> pid=<pid> ranMs=<n>` paired with `[pty-tracker] op=exit` from `handlePtyNaturalExit` — fires when claude exits on its own (operator typed `/quit`, SIGINT in the PTY, crash). |
|
|
238
240
|
|
|
@@ -242,7 +244,7 @@ Each session row also carries a small muted timestamp crumb under the name showi
|
|
|
242
244
|
|
|
243
245
|
`verified=true` requires `master-fd=closed` AND `fdDelta>=1` AND `trackerRemoved=true`. `master-fd=close-failed` is logged at error level (`[rc-spawn-error]` prefix) — never swallowed; the next post-archive sweep is the catch-net.
|
|
244
246
|
|
|
245
|
-
**Cross-arm `[rc-life]` schema
|
|
247
|
+
**Cross-arm `[rc-life]` schema.** rc-spawn and rc-daemon emit a shared log shape so the populations can be compared from `server.log` alone. One spawn's full lifeline is `grep <unitToken>`; one surface's signature is `grep 'source=rc-spawn'` or `'source=rc-daemon'`. Success on both surfaces is `op=pidfile-present`; failure is `op=spawn-failed` / `op=early-exit` / `op=wait-pid-failed`. Full schema and operator runbook in [`.docs/rc-life-observability.md`](../../../.docs/rc-life-observability.md).
|
|
246
248
|
|
|
247
249
|
**Post-archive fd sweep (Task 558).** Independent of spawn/archive request traffic, the manager runs a 60 s sweep that walks both directions of the master-fd invariant:
|
|
248
250
|
|
|
@@ -257,15 +259,6 @@ The sweep is the catch-net for `master-fd=close-failed` and any future regressio
|
|
|
257
259
|
|
|
258
260
|
`openFdCount()` reads `/proc/self/fd` directly on Linux and returns `-1` on darwin (the dev-Mac path). The fd-leak audit on the laptop: `~/maxy-code/platform/scripts/logs-read.sh --tail server 400 | grep -E '\[fd-audit\]|op=archive-release'`. Full per-spawn lifeline: `grep -E '\[rc-spawn\]|\[pty-tracker\]'` filtered by `unitToken`.
|
|
259
261
|
|
|
260
|
-
**Non-PTY scope spawn — activation gate (Tasks 552 + 554 + 555 + 556).** `claude rc` daemon spawns (and historically `/rc-spawn`, until Task 557 restored node-pty for that path) go through `systemdSpawn` (a `child_process.spawn` around `systemd-run --user --scope ...`, no PTY). The scope's inner command is `script -q -f -c "<claude cmd>" "<captureFilePath>"` (Task 556): `script(1)` allocates a real pty master and slave so claude runs on a TTY (without one, `claude --remote-control --resume` and `claude rc --spawn` early-exit because `--scope` units inherit the launcher's `stdio: 'ignore'` fds), and writes its typescript to a per-spawn capture file at `~/.<brand>/logs/spawn-<unitToken>.log`. The capture file holds the child's stdout/stderr and survives scope reaping, so a fast-exiting child's last words are recoverable by reading the file. (The prior Task 555 attempt — `StandardOutput=journal` + `SyslogIdentifier=` scope properties — was a no-op because those are `Exec*=` *service-unit* fields that systemd silently ignores on `--scope` units.) The activation gate polls `systemctl show -p ActiveState -p ControlGroup -p Result -p SubState` every 50 ms until either the scope reaches `ActiveState=active` with a pid in `cgroup.procs` (success — a handle is returned) or it reaches a terminal state. Four terminal outcomes are distinguished:
|
|
261
|
-
|
|
262
|
-
- **`boot-crash`** — `cgroup.procs` was observed non-empty at some point and is now empty: claude reached init and crashed. The observed pid is included.
|
|
263
|
-
- **`child-exited-during-activation`** — `cgroup.procs` was never observed populated and systemd reports `Result=success`: the child exited normally faster than the poll interval (50 ms). Task 555 added this branch to distinguish a clean fast-exit from a genuine systemd-side start failure. Pre-Task-556 the canonical trigger was a `--remote-control … --resume <sid>` spawn that received `/dev/null` on stdin and exited at the no-input branch in ~50 ms; with the script(1) TTY wrap in place, this branch now fires only for genuine fast-exits (a missing transcript, a bad `--resume` id, etc.).
|
|
264
|
-
- **`systemd-start-failure`** — `cgroup.procs` was never observed populated and systemd reports `Result=failed` (or any non-`success`): systemd itself rejected the unit (bad cwd, missing binary, slice not loaded).
|
|
265
|
-
- **`activation-timeout`** — the 5 s deadline expired without `ActiveState` ever leaving the activating set: a genuine systemd hang.
|
|
266
|
-
|
|
267
|
-
Every terminal-branch error envelope embeds the last ~2 KB of the capture file as `captureTail=<json>`, so the admin-UI log line carries the child's actual exit message without an SSH-into-the-box step. The capture file itself persists at `~/.<brand>/logs/spawn-<unitToken>.log` after the scope is reaped — `cat`, `tail -f`, or any other file tool reads it; no `journalctl` round-trip required.
|
|
268
|
-
|
|
269
262
|
**PTY lifecycle contract (Tasks 170 + 176 + 260).** A PTY reaches its end via one of two branches: **operator-request** (operator clicks End or the auto-archive Stop hook calls `killSession`) or **natural-exit** (the claude child exits on its own — operator typed `/quit`, SIGINT in the PTY, crash, network drop on `--remote-control`). Both branches honour a single invariant: the pty master file descriptor is released by an explicit `pty.destroy()` and the in-process tracker entry is removed before the next `/list` or `/events` tick. As of Task 260 the tracker is a module-scoped `Map<sessionId, PtyTracker>` in `pty-spawner.ts` — the metadata-rich `SessionStore` is gone; the tracker holds only what the file system cannot (PtyHandle + pid + bridge ids + runtime flags). Without the explicit destroy, the master fd lingers in node-pty's internal socket until V8 GC finalises the IPty object — non-deterministic and accumulates under load until the kernel pty cap (Linux 3072, macOS 511) refuses new spawns. Without the explicit row removal, the manager shutdown loop SIGTERMs PIDs that already logged `process-exited`, masking the leak only because the manager restarts every few hours. When both branches fire on the same exit (operator clicks End and node-pty's `onExit` fans out the SIGTERM to both listeners), a per-row `fdReleased` flag short-circuits the second branch so `pty.destroy()` runs exactly once on the live socket — without the flag, the second call throws "socket already destroyed" and the operator-request line would falsely log `master-fd=close-failed`. If the first branch's destroy throws and is rescued, the flag stays unset and the second branch retries (defense in depth). Every `kill … pid=<n>` log line carries a `master-fd=closed` suffix (or `master-fd=close-failed err=<msg>` on the rescued throw branch — a graceful degradation so a corner-case socket-state failure cannot turn a logically-successful exit into a 500); the operator-request line additionally identifies `reason=operator-request`, the natural-exit line identifies `reason=process-exited`. Both branches are verified by the `stop-session-fd-release` and `endpoint-stop-delete` integration tests (operator-request live and already-exited cycles + natural-exit cycle + throw-then-retry coordination, Linux kernel-level ptmx fd accounting on each).
|
|
270
263
|
|
|
271
264
|
The metadata pane subscribes to the same /list projection. When an operator clicks End on an alive row, the DELETE returns 200 and the post-mutation refetch decides what happens next: a session that wrote a JSONL surfaces as a dehydrated `status: 'ended'` row (the pane swaps `End session` for `Purge JSONL` plus `Resume`), and a session that never wrote a JSONL (`Turns: 0`) leaves the list entirely (the pane shows a `Session ended without a transcript. Close this pane.` banner with a Close button and no destructive action). The manager's `/list` and `/meta` are the only authorities on post-End state; the client does not pre-empt either response with an optimistic mutation.
|
|
@@ -2,7 +2,7 @@ import { initStderrTee } from "../../../../lib/mcp-stderr-tee/dist/index.js";
|
|
|
2
2
|
initStderrTee("browser");
|
|
3
3
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
4
4
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
5
|
-
import {
|
|
5
|
+
import { eagerTool } from "../../../../lib/mcp-eager/dist/index.js";
|
|
6
6
|
import { z } from "zod";
|
|
7
7
|
import { writeFile } from "node:fs/promises";
|
|
8
8
|
import { renderPage } from "./lib/cdp-render.js";
|
|
@@ -29,7 +29,7 @@ function cap(s, max) {
|
|
|
29
29
|
return { body: s, truncated: false };
|
|
30
30
|
return { body: s.slice(0, max), truncated: true };
|
|
31
31
|
}
|
|
32
|
-
|
|
32
|
+
eagerTool(server, "browser-render", "Render a JavaScript-heavy web page in the device's real Chromium and return its fully rendered DOM. Use this for pages that WebFetch and url-get return empty or as a shell because they require JS execution (client-rendered SPAs, content gated behind in-page scripts). Returns the rendered HTML and the page's visible text. For static, server-rendered pages prefer url-get (verbatim) or WebFetch (summary) — this tool is the heavier JS-rendering path.", {
|
|
33
33
|
url: z.string().url().describe("Absolute http(s) URL to render"),
|
|
34
34
|
loadTimeoutMs: z.number().int().positive().optional().describe("Max wait for the page load event (default 30000)"),
|
|
35
35
|
}, async (params) => {
|
|
@@ -79,54 +79,54 @@ function reply(label, r, successText) {
|
|
|
79
79
|
}
|
|
80
80
|
return { content: [{ type: "text", text: successText ?? `${label}: ok` }] };
|
|
81
81
|
}
|
|
82
|
-
|
|
82
|
+
eagerTool(server, "browser-navigate", "Open a URL in the device's Chromium and keep the page alive for follow-up automation (click, fill, snapshot, pdf-save, screenshot). This is the entry point for interactive browser work — call it before any other browser-* automation tool. Reuses the one live automation page; use browser-tabs to open a separate page. For one-shot read-only retrieval of a JS page use browser-render instead.", {
|
|
83
83
|
url: z.string().url().describe("Absolute http(s) URL to open"),
|
|
84
84
|
loadTimeoutMs: z.number().int().positive().optional().describe("Max wait for the page load event (default 30000)"),
|
|
85
85
|
}, async (params) => reply("browser-navigate", await actions.navigate(browserSession, params, actionCtx), `Navigated to ${params.url}`));
|
|
86
|
-
|
|
86
|
+
eagerTool(server, "browser-snapshot", "Return an accessibility snapshot of the current page: each interactive or landmark element as role, accessible name, and a unique CSS selector. Use the returned selector verbatim with browser-click / browser-fill / browser-hover — it targets exactly the element you saw. Call this after browser-navigate (or after an action changes the page) to know what is on the page.", {}, async () => {
|
|
87
87
|
const r = await actions.snapshot(browserSession, {}, actionCtx);
|
|
88
88
|
return reply("browser-snapshot", r, r.data?.text);
|
|
89
89
|
});
|
|
90
|
-
|
|
91
|
-
|
|
90
|
+
eagerTool(server, "browser-click", "Click the element matching a CSS selector on the current page. Use a selector from browser-snapshot. Returns selector-not-found if nothing matches.", { selector: z.string().describe("CSS selector of the element to click") }, async (params) => reply("browser-click", await actions.click(browserSession, params, actionCtx), `Clicked ${params.selector}`));
|
|
91
|
+
eagerTool(server, "browser-fill", "Set the value of one input, textarea, or contenteditable matching a CSS selector, firing input/change events. For multiple fields in one call use browser-fill-form.", {
|
|
92
92
|
selector: z.string().describe("CSS selector of the field"),
|
|
93
93
|
value: z.string().describe("Value to set"),
|
|
94
94
|
}, async (params) => reply("browser-fill", await actions.fill(browserSession, params, actionCtx), `Filled ${params.selector}`));
|
|
95
|
-
|
|
95
|
+
eagerTool(server, "browser-fill-form", "Fill several fields in one call. Each field is a CSS selector and the value to set. Reports every selector that matched nothing.", {
|
|
96
96
|
fields: z.array(z.object({
|
|
97
97
|
selector: z.string().describe("CSS selector of the field"),
|
|
98
98
|
value: z.string().describe("Value to set"),
|
|
99
99
|
})).describe("Fields to fill"),
|
|
100
100
|
}, async (params) => reply("browser-fill-form", await actions.fillForm(browserSession, params, actionCtx), `Filled ${params.fields.length} field(s)`));
|
|
101
|
-
|
|
101
|
+
eagerTool(server, "browser-type", "Type text into the focused element via real keyboard input. Pass a selector to focus that element first. Use this when setting value directly (browser-fill) does not trigger the page's keystroke handlers (autocompletes, rich editors).", {
|
|
102
102
|
text: z.string().describe("Text to type"),
|
|
103
103
|
selector: z.string().optional().describe("Optional CSS selector to focus before typing"),
|
|
104
104
|
}, async (params) => reply("browser-type", await actions.type(browserSession, params, actionCtx), "Typed text"));
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
105
|
+
eagerTool(server, "browser-press-key", "Press a single key on the focused element (Enter, Tab, Escape, Backspace, Delete, Arrow keys, Home, End, PageUp, PageDown, Space, or a single character). Use for submitting forms (Enter) or keyboard navigation.", { key: z.string().describe("Key name or single character") }, async (params) => reply("browser-press-key", await actions.pressKey(browserSession, params, actionCtx), `Pressed ${params.key}`));
|
|
106
|
+
eagerTool(server, "browser-hover", "Hover the pointer over the element matching a CSS selector, firing pointer/mouse-over events. Use to reveal hover menus or tooltips before reading or clicking.", { selector: z.string().describe("CSS selector of the element to hover") }, async (params) => reply("browser-hover", await actions.hover(browserSession, params, actionCtx), `Hovered ${params.selector}`));
|
|
107
|
+
eagerTool(server, "browser-select-option", "Choose an option in a <select> dropdown by option value or visible label, firing a change event.", {
|
|
108
108
|
selector: z.string().describe("CSS selector of the <select>"),
|
|
109
109
|
value: z.string().optional().describe("Option value to select"),
|
|
110
110
|
label: z.string().optional().describe("Option visible text/label to select"),
|
|
111
111
|
}, async (params) => reply("browser-select-option", await actions.selectOption(browserSession, params, actionCtx), `Selected option in ${params.selector}`));
|
|
112
|
-
|
|
112
|
+
eagerTool(server, "browser-wait-for", "Wait until an element (CSS selector) appears or some text is present on the page, up to a timeout. Use after an action that loads content asynchronously, before reading or interacting.", {
|
|
113
113
|
selector: z.string().optional().describe("CSS selector to wait for"),
|
|
114
114
|
text: z.string().optional().describe("Visible text to wait for"),
|
|
115
115
|
timeoutMs: z.number().int().positive().optional().describe("Max wait (default 30000)"),
|
|
116
116
|
}, async (params) => reply("browser-wait-for", await actions.waitFor(browserSession, params, actionCtx), "Condition met"));
|
|
117
|
-
|
|
117
|
+
eagerTool(server, "browser-handle-dialog", "Arm how the next JavaScript dialog(s) — alert, confirm, prompt — on the current page are answered. Set this BEFORE the action that triggers the dialog, because dialogs block the page and cannot be answered after the fact. The policy stands until changed. Unarmed dialogs are auto-dismissed and reported by browser-console-messages.", {
|
|
118
118
|
accept: z.boolean().describe("true to accept/OK, false to dismiss/Cancel"),
|
|
119
119
|
promptText: z.string().optional().describe("Text to enter into a prompt() dialog when accepting"),
|
|
120
120
|
}, async (params) => reply("browser-handle-dialog", actions.handleDialog(browserSession, params), `Dialog policy armed: accept=${params.accept}`));
|
|
121
|
-
|
|
121
|
+
eagerTool(server, "browser-evaluate", "Run a JavaScript expression in the current page and return its value (awaits a returned promise). Use for reading page state or driving behaviour that no other tool covers. The expression runs in the page, not in Node.", { expression: z.string().describe("JavaScript expression to evaluate in the page") }, async (params) => {
|
|
122
122
|
const r = await actions.evaluate(browserSession, params, actionCtx);
|
|
123
123
|
return reply("browser-evaluate", r, `Result: ${JSON.stringify(r.data?.value ?? null)}`);
|
|
124
124
|
});
|
|
125
|
-
|
|
125
|
+
eagerTool(server, "browser-console-messages", "Return and clear the buffered console output and uncaught errors from the current page (captured since navigation). Use to debug why a page or interaction did not behave as expected.", {}, async () => {
|
|
126
126
|
const r = actions.consoleMessages(browserSession);
|
|
127
127
|
return reply("browser-console-messages", r, r.data?.text);
|
|
128
128
|
});
|
|
129
|
-
|
|
129
|
+
eagerTool(server, "browser-tabs", "Manage browser tabs/pages: list open pages, open a new page (optionally at a URL and switch to it), select an existing page by id, or close a page by id. Use 'new' or 'select' to get a fresh page so stale state from a prior task does not leak in.", {
|
|
130
130
|
action: z.enum(["list", "new", "select", "close"]).describe("Tab action"),
|
|
131
131
|
id: z.string().optional().describe("Target id (required for select/close)"),
|
|
132
132
|
url: z.string().optional().describe("URL to open (optional for new)"),
|
|
@@ -138,7 +138,7 @@ eagerToolGated(server, "browser-tabs", "research-assistant", "Manage browser tab
|
|
|
138
138
|
: `tabs ${params.action}: ok`;
|
|
139
139
|
return reply("browser-tabs", r, text);
|
|
140
140
|
});
|
|
141
|
-
|
|
141
|
+
eagerTool(server, "browser-pdf-save", "Render the current page to a PDF file on the device using Chromium's print pipeline (honours @page/@media print CSS, prints backgrounds). Pass an absolute output path. This is the on-device replacement for the old Playwright browser_pdf_save: navigate to the HTML (served over http, or a file path the browser can open), then call this.", {
|
|
142
142
|
path: z.string().describe("Absolute output path for the .pdf file"),
|
|
143
143
|
landscape: z.boolean().optional().describe("Landscape orientation (default false)"),
|
|
144
144
|
scale: z.number().optional().describe("Scale of the page rendering (default 1)"),
|
|
@@ -147,7 +147,7 @@ eagerToolGated(server, "browser-pdf-save", "research-assistant", "Render the cur
|
|
|
147
147
|
const r = await actions.pdfSave(browserSession, params, actionCtx);
|
|
148
148
|
return reply("browser-pdf-save", r, `Saved PDF to ${params.path} (${r.data?.bytes ?? 0} bytes)`);
|
|
149
149
|
});
|
|
150
|
-
|
|
150
|
+
eagerTool(server, "browser-screenshot", "Capture a PNG of the current page (or one element, via a CSS selector clip) to a file on the device. Pass an absolute output path. Use selector clips to capture glassmorphism/blur sections as print fallback images for A4 PDFs.", {
|
|
151
151
|
path: z.string().describe("Absolute output path for the .png file"),
|
|
152
152
|
selector: z.string().optional().describe("CSS selector to clip to a single element"),
|
|
153
153
|
fullPage: z.boolean().optional().describe("Capture beyond the viewport (default false)"),
|
|
@@ -155,7 +155,7 @@ eagerToolGated(server, "browser-screenshot", "research-assistant", "Capture a PN
|
|
|
155
155
|
const r = await actions.screenshot(browserSession, params, actionCtx);
|
|
156
156
|
return reply("browser-screenshot", r, `Saved screenshot to ${params.path} (${r.data?.bytes ?? 0} bytes)`);
|
|
157
157
|
});
|
|
158
|
-
|
|
158
|
+
eagerTool(server, "browser-resize", "Set the current page's viewport size in CSS pixels. Use before a screenshot to control the rendered dimensions (e.g. match an element's measured size to avoid scrollbars).", {
|
|
159
159
|
width: z.number().int().positive().describe("Viewport width in CSS pixels"),
|
|
160
160
|
height: z.number().int().positive().describe("Viewport height in CSS pixels"),
|
|
161
161
|
}, async (params) => reply("browser-resize", await actions.resize(browserSession, params, actionCtx), `Resized to ${params.width}x${params.height}`));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/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EAAE,uBAAuB,MAAM,CAAC,IAAI,KAAM,CAAC,CAAC,IAA2B,EAAE,KAAK,IAAI,CAAC,SAAS,CAAC,CAAC;AACpI,CAAC,CACF,CAAC;AAEF,SAAS,CACP,MAAM,EACN,gBAAgB,EAChB,6KAA6K,EAC7K;IACE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,8BAA8B,CAAC;IAC3E,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,+BAA+B,CAAC;CAC9E,EACD,KAAK,EAAE,MAAyC,EAAE,EAAE,CAClD,KAAK,CAAC,gBAAgB,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,cAAc,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,cAAc,MAAM,CAAC,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC,CAClI,CAAC;AAEF,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;AAE5C,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;AAC7C,MAAO,MAAoB,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC"}
|
|
@@ -106,21 +106,23 @@ Each session row also carries a small muted timestamp crumb under the name showi
|
|
|
106
106
|
|
|
107
107
|
**Download JSONL (Task 197).** `GET /<id>/log?download=1` is a one-shot byte-stream of the session's JSONL transcript with attachment-disposition headers, designed for the pane's **Download JSONL** button. Headers: `Content-Type: application/x-ndjson`, `Content-Disposition: attachment; filename="<sessionId>.jsonl"` (the basename is sanitised so any non-`[A-Za-z0-9._-]` character is replaced with underscore), `Cache-Control: no-store`. Four status branches: **200** with the byte-identical file body; **404** `{error: 'session-not-found'}` when the store has no row for the id; **202** `{pending: true, jsonlPath: null}` when the row exists but claude has not flushed the first turn yet; **404** `{error: 'jsonl-missing-on-disk'}` when the row carries a `jsonlPath` but the file has been removed under the manager (post-Purge race). The download branch is declared **before** the follow check, so `?download=1` always wins over `?follow=1` if both are set. The proxy at `app.get('/:sessionId/log')` rebuilds the upstream query from a fixed `follow|download` allowlist; inbound query keys outside that allowlist are dropped. Observability: `[claude-session-manager] log-download sessionId=<sid> bytes=<n> ms=<n>` lands per successful stream completion; the browser console emits `[admin-ui] pane-download-jsonl sessionId=<8> outcome=initiated` on click. `outcome=initiated` rather than `outcome=ok` is intentional — the handler resolves before the browser writes the bytes, so the log line names "the request was kicked off", not "the file landed". If the file does not appear in the operator's downloads folder, check the manager line for the bytes count and the browser's downloads UI for the suppression record. Auth is unchanged from the rest of the `/api/admin/claude-sessions` surface (cookie session via `requireAdminSession`); there is no new key surface.
|
|
108
108
|
|
|
109
|
-
**Two spawn
|
|
109
|
+
**Two spawn surfaces, one primitive (Task 573).** The manager runs two on-device spawn surfaces, both backed by the same primitive: **node-pty wrapped in `systemd-run --user --scope`** (via `index.ts::spawnPtyAdapter`).
|
|
110
110
|
|
|
111
|
-
- **`claude rc` daemon** — spawned at platform boot by `rc-daemon.ts
|
|
112
|
-
- **`claude --remote-control` on-device sidebar spawn** — spawned per-click by `/rc-spawn` in `http-server.ts
|
|
111
|
+
- **`claude rc` daemon** — spawned at platform boot by `rc-daemon.ts`. One supervised daemon per account; owns the long-lived composer session that backs claude.ai/code Remote Control. Master fd held for the daemon's lifetime, released on natural exit / restart.
|
|
112
|
+
- **`claude --remote-control` on-device sidebar spawn** — spawned per-click by `/rc-spawn` in `http-server.ts`. One PTY per click; the manager holds the master fd **for the session's entire lifetime**. The pty master IS the live session — claude operates on the slave, and closing the master hangs up the slave. Valid master-release points: (1) explicit operator teardown — `/stop` → `stopSession` → `op=archive-release` — and (2) the natural-exit path inside `pty.onExit → handlePtyNaturalExit`.
|
|
113
113
|
|
|
114
|
-
|
|
114
|
+
Inside the scope, `sh -c 'trap "" HUP; exec "$@"' sh <claudeBin> <args...>` keeps claude resident across PTY master-close (SIGHUP trap) and preserves the pid through the exec chain. The earlier `script(1)` wrap and the non-PTY scope primitive (Tasks 552/556/562) are gone; node-pty allocates the TTY directly.
|
|
115
|
+
|
|
116
|
+
**`/rc-spawn` lifecycle observability (Task 573).** Every on-device sidebar resume emits a stream of `[rc-spawn]` lines tagged with the same `unitToken=rc-resume-<uuid>` so one spawn's full lifeline can be reconstructed by `grep` alone. The lines, in order:
|
|
115
117
|
|
|
116
118
|
| Step | Line shape |
|
|
117
119
|
|------|-----------|
|
|
118
120
|
| 1 | `[rc-spawn] op=request unitToken=<t> sessionId=<8|new> name=<…|none> mode=<resume|fresh> jsonl=<path|none>` |
|
|
119
121
|
| 2 | `[rc-spawn] op=argv unitToken=<t> cwd=<dir> argv=<json>` (inner claude argv; the `systemd-run --scope` wrap is composed by the spawnPty adapter) |
|
|
120
122
|
| 3 | `[rc-spawn] op=pty-spawned unitToken=<t> pid=<pid> openFds=<n>` (fd baseline) |
|
|
121
|
-
| 4 | `[rc-spawn] op=child-output unitToken=<t> pid=<pid> head=<json>` (first ≤1 KB or 500 ms idle — claude's own words
|
|
122
|
-
| 5 | `[rc-spawn] op=
|
|
123
|
-
| 6 | `[rc-spawn] op=
|
|
123
|
+
| 4 | `[rc-spawn] op=child-output unitToken=<t> pid=<pid> head=<json>` (first ≤1 KB or 500 ms idle — claude's own words) |
|
|
124
|
+
| 5 | `[rc-spawn] op=early-exit unitToken=<t> pid=<pid> ranMs=<n> exitCode=<n> signal=<…>` — fires when `pty.onExit` lands before the pid file |
|
|
125
|
+
| 6 | `[rc-spawn] op=pidfile-present unitToken=<t> pid=<pid> path=<sessions/<pid>.json> ageMs=<n> bridgeId=<…>` — **terminal success.** The on-disk PID file IS the evidence; no synchronous liveness inference. The tracker remains in `livePtys` for the session's lifetime. |
|
|
124
126
|
| 7 | `[pty-tracker] op=spawn sessionId=<8> pid=<pid> size=<n>` (also fires for spawnClaudeSession; same line shape on the rc-spawn path) |
|
|
125
127
|
| 8 | `[rc-spawn] op=exit unitToken=<t> pid=<pid> ranMs=<n>` paired with `[pty-tracker] op=exit` from `handlePtyNaturalExit` — fires when claude exits on its own (operator typed `/quit`, SIGINT in the PTY, crash). |
|
|
126
128
|
|
|
@@ -130,7 +132,7 @@ Each session row also carries a small muted timestamp crumb under the name showi
|
|
|
130
132
|
|
|
131
133
|
`verified=true` requires `master-fd=closed` AND `fdDelta>=1` AND `trackerRemoved=true`. `master-fd=close-failed` is logged at error level (`[rc-spawn-error]` prefix) — never swallowed; the next post-archive sweep is the catch-net.
|
|
132
134
|
|
|
133
|
-
**Cross-arm `[rc-life]` schema
|
|
135
|
+
**Cross-arm `[rc-life]` schema.** rc-spawn and rc-daemon emit a shared log shape so the populations can be compared from `server.log` alone. One spawn's full lifeline is `grep <unitToken>`; one surface's signature is `grep 'source=rc-spawn'` or `'source=rc-daemon'`. Success on both surfaces is `op=pidfile-present`; failure is `op=spawn-failed` / `op=early-exit` / `op=wait-pid-failed`. Full schema and operator runbook in [`.docs/rc-life-observability.md`](../../../.docs/rc-life-observability.md).
|
|
134
136
|
|
|
135
137
|
**Post-archive fd sweep (Task 558).** Independent of spawn/archive request traffic, the manager runs a 60 s sweep that walks both directions of the master-fd invariant:
|
|
136
138
|
|
|
@@ -145,15 +147,6 @@ The sweep is the catch-net for `master-fd=close-failed` and any future regressio
|
|
|
145
147
|
|
|
146
148
|
`openFdCount()` reads `/proc/self/fd` directly on Linux and returns `-1` on darwin (the dev-Mac path). The fd-leak audit on the laptop: `~/maxy-code/platform/scripts/logs-read.sh --tail server 400 | grep -E '\[fd-audit\]|op=archive-release'`. Full per-spawn lifeline: `grep -E '\[rc-spawn\]|\[pty-tracker\]'` filtered by `unitToken`.
|
|
147
149
|
|
|
148
|
-
**Non-PTY scope spawn — activation gate (Tasks 552 + 554 + 555 + 556).** `claude rc` daemon spawns (and historically `/rc-spawn`, until Task 557 restored node-pty for that path) go through `systemdSpawn` (a `child_process.spawn` around `systemd-run --user --scope ...`, no PTY). The scope's inner command is `script -q -f -c "<claude cmd>" "<captureFilePath>"` (Task 556): `script(1)` allocates a real pty master and slave so claude runs on a TTY (without one, `claude --remote-control --resume` and `claude rc --spawn` early-exit because `--scope` units inherit the launcher's `stdio: 'ignore'` fds), and writes its typescript to a per-spawn capture file at `~/.<brand>/logs/spawn-<unitToken>.log`. The capture file holds the child's stdout/stderr and survives scope reaping, so a fast-exiting child's last words are recoverable by reading the file. (The prior Task 555 attempt — `StandardOutput=journal` + `SyslogIdentifier=` scope properties — was a no-op because those are `Exec*=` *service-unit* fields that systemd silently ignores on `--scope` units.) The activation gate polls `systemctl show -p ActiveState -p ControlGroup -p Result -p SubState` every 50 ms until either the scope reaches `ActiveState=active` with a pid in `cgroup.procs` (success — a handle is returned) or it reaches a terminal state. Four terminal outcomes are distinguished:
|
|
149
|
-
|
|
150
|
-
- **`boot-crash`** — `cgroup.procs` was observed non-empty at some point and is now empty: claude reached init and crashed. The observed pid is included.
|
|
151
|
-
- **`child-exited-during-activation`** — `cgroup.procs` was never observed populated and systemd reports `Result=success`: the child exited normally faster than the poll interval (50 ms). Task 555 added this branch to distinguish a clean fast-exit from a genuine systemd-side start failure. Pre-Task-556 the canonical trigger was a `--remote-control … --resume <sid>` spawn that received `/dev/null` on stdin and exited at the no-input branch in ~50 ms; with the script(1) TTY wrap in place, this branch now fires only for genuine fast-exits (a missing transcript, a bad `--resume` id, etc.).
|
|
152
|
-
- **`systemd-start-failure`** — `cgroup.procs` was never observed populated and systemd reports `Result=failed` (or any non-`success`): systemd itself rejected the unit (bad cwd, missing binary, slice not loaded).
|
|
153
|
-
- **`activation-timeout`** — the 5 s deadline expired without `ActiveState` ever leaving the activating set: a genuine systemd hang.
|
|
154
|
-
|
|
155
|
-
Every terminal-branch error envelope embeds the last ~2 KB of the capture file as `captureTail=<json>`, so the admin-UI log line carries the child's actual exit message without an SSH-into-the-box step. The capture file itself persists at `~/.<brand>/logs/spawn-<unitToken>.log` after the scope is reaped — `cat`, `tail -f`, or any other file tool reads it; no `journalctl` round-trip required.
|
|
156
|
-
|
|
157
150
|
**PTY lifecycle contract (Tasks 170 + 176 + 260).** A PTY reaches its end via one of two branches: **operator-request** (operator clicks End or the auto-archive Stop hook calls `killSession`) or **natural-exit** (the claude child exits on its own — operator typed `/quit`, SIGINT in the PTY, crash, network drop on `--remote-control`). Both branches honour a single invariant: the pty master file descriptor is released by an explicit `pty.destroy()` and the in-process tracker entry is removed before the next `/list` or `/events` tick. As of Task 260 the tracker is a module-scoped `Map<sessionId, PtyTracker>` in `pty-spawner.ts` — the metadata-rich `SessionStore` is gone; the tracker holds only what the file system cannot (PtyHandle + pid + bridge ids + runtime flags). Without the explicit destroy, the master fd lingers in node-pty's internal socket until V8 GC finalises the IPty object — non-deterministic and accumulates under load until the kernel pty cap (Linux 3072, macOS 511) refuses new spawns. Without the explicit row removal, the manager shutdown loop SIGTERMs PIDs that already logged `process-exited`, masking the leak only because the manager restarts every few hours. When both branches fire on the same exit (operator clicks End and node-pty's `onExit` fans out the SIGTERM to both listeners), a per-row `fdReleased` flag short-circuits the second branch so `pty.destroy()` runs exactly once on the live socket — without the flag, the second call throws "socket already destroyed" and the operator-request line would falsely log `master-fd=close-failed`. If the first branch's destroy throws and is rescued, the flag stays unset and the second branch retries (defense in depth). Every `kill … pid=<n>` log line carries a `master-fd=closed` suffix (or `master-fd=close-failed err=<msg>` on the rescued throw branch — a graceful degradation so a corner-case socket-state failure cannot turn a logically-successful exit into a 500); the operator-request line additionally identifies `reason=operator-request`, the natural-exit line identifies `reason=process-exited`. Both branches are verified by the `stop-session-fd-release` and `endpoint-stop-delete` integration tests (operator-request live and already-exited cycles + natural-exit cycle + throw-then-retry coordination, Linux kernel-level ptmx fd accounting on each).
|
|
158
151
|
|
|
159
152
|
The metadata pane subscribes to the same /list projection. When an operator clicks End on an alive row, the DELETE returns 200 and the post-mutation refetch decides what happens next: a session that wrote a JSONL surfaces as a dehydrated `status: 'ended'` row (the pane swaps `End session` for `Purge JSONL` plus `Resume`), and a session that never wrote a JSONL (`Turns: 0`) leaves the list entirely (the pane shows a `Session ended without a transcript. Close this pane.` banner with a Close button and no destructive action). The manager's `/list` and `/meta` are the only authorities on post-End state; the client does not pre-empt either response with an optimistic mutation.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { initStderrTee } from "../../../../lib/mcp-stderr-tee/dist/index.js";
|
|
2
2
|
initStderrTee("email");
|
|
3
3
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
4
|
-
import {
|
|
4
|
+
import { eagerTool } from "../../../../lib/mcp-eager/dist/index.js";
|
|
5
5
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
6
6
|
import { z } from "zod";
|
|
7
7
|
import { emailSetup } from "./tools/email-setup.js";
|
|
@@ -45,7 +45,7 @@ function refuseNoAccount(toolName) {
|
|
|
45
45
|
// must answer in plugin-system metadata-only mode too, and there is nothing
|
|
46
46
|
// account-scoped to protect. Call this BEFORE asking for any password so the
|
|
47
47
|
// provider's app-password / IMAP-enable requirement is surfaced first.
|
|
48
|
-
|
|
48
|
+
eagerTool(server, "email-provider-info", "Given just an email address, return the provider's IMAP/SMTP host settings and — crucially — its app-password / trusted-application / IMAP-enable requirement, BEFORE any password is requested. Most providers (Gmail, iCloud, StartMail, Fastmail, etc.) reject the normal login password and need a credential minted in the provider's own settings UI. Relay that requirement to the operator first, then ask for the app password. Returns 'unknown' (operator must supply hosts) or 'unsupported' (provider blocks IMAP/SMTP, e.g. Tuta) where applicable.", {
|
|
49
49
|
email: z.string().email().describe("The email address to look up (only the domain is used)."),
|
|
50
50
|
}, async ({ email }) => {
|
|
51
51
|
const info = describeProvider(email);
|
|
@@ -77,7 +77,7 @@ eagerToolGated(server, "email-provider-info", "personal-assistant", "Given just
|
|
|
77
77
|
// ===================================================================
|
|
78
78
|
// email-setup — collect and validate email credentials
|
|
79
79
|
// ===================================================================
|
|
80
|
-
|
|
80
|
+
eagerTool(server, "email-setup", "Set up the agent's dedicated email account. Validates IMAP and SMTP connectivity before storing credentials. Infers host settings from known providers (Gmail, Outlook, iCloud, Yahoo, Protonmail).", {
|
|
81
81
|
email: z.string().email().describe("The email address for the agent's account (used for IMAP/SMTP authentication)"),
|
|
82
82
|
password: z.string().min(1).describe("The password or app-specific password"),
|
|
83
83
|
agentAddress: z.string().email().optional().describe("The address the agent operates as (for catchall domains where auth email differs from the agent's alias). Defaults to email if not set."),
|
|
@@ -116,7 +116,7 @@ eagerToolGated(server, "email-setup", "personal-assistant", "Set up the agent's
|
|
|
116
116
|
// ===================================================================
|
|
117
117
|
// email-read — fetch recent inbox messages
|
|
118
118
|
// ===================================================================
|
|
119
|
-
|
|
119
|
+
eagerTool(server, "email-read", "List recent messages (from, subject, date — no body content). Supports filtering by sender, subject, date range, and recipient. Supports pagination via before_uid cursor and folder selection (inbox or sent). Max 50 messages per request.", {
|
|
120
120
|
sender: z.string().optional().describe("Filter by sender address or domain"),
|
|
121
121
|
subjectPattern: z.string().optional().describe("Regex pattern to match subject lines"),
|
|
122
122
|
since: z.string().optional().describe("ISO date — only messages after this date"),
|
|
@@ -147,7 +147,7 @@ eagerToolGated(server, "email-read", "personal-assistant", "List recent messages
|
|
|
147
147
|
// ===================================================================
|
|
148
148
|
// email-send — send an email via SMTP
|
|
149
149
|
// ===================================================================
|
|
150
|
-
|
|
150
|
+
eagerTool(server, "email-send", "Send an email from the agent's email account via SMTP.", {
|
|
151
151
|
to: z.string().email().describe("Recipient email address"),
|
|
152
152
|
subject: z.string().describe("Email subject line"),
|
|
153
153
|
body: z.string().describe("Plain text email body"),
|
|
@@ -174,7 +174,7 @@ eagerToolGated(server, "email-send", "personal-assistant", "Send an email from t
|
|
|
174
174
|
// ===================================================================
|
|
175
175
|
// email-search — search inbox by criteria
|
|
176
176
|
// ===================================================================
|
|
177
|
-
|
|
177
|
+
eagerTool(server, "email-search", "Search messages by sender, subject, body, or date range. Returns message list (from, subject, date — no body content). Supports pagination via before_uid cursor and folder selection (inbox or sent). Max 50 messages per request.", {
|
|
178
178
|
sender: z.string().optional().describe("Search by sender address or domain"),
|
|
179
179
|
subject: z.string().optional().describe("Search by subject text"),
|
|
180
180
|
body: z.string().optional().describe("Search by keyword in body"),
|
|
@@ -206,7 +206,7 @@ eagerToolGated(server, "email-search", "personal-assistant", "Search messages by
|
|
|
206
206
|
// ===================================================================
|
|
207
207
|
// email-otp-extract — poll for and extract OTP verification codes
|
|
208
208
|
// ===================================================================
|
|
209
|
-
|
|
209
|
+
eagerTool(server, "email-otp-extract", "Poll the agent's email inbox for a verification code (OTP) from a specific sender. Searches recent messages first, then polls at intervals until a matching email arrives or the timeout is reached. Used by other skills during service authentication.", {
|
|
210
210
|
sender: z.string().describe("Expected sender domain (e.g. cloudflare.com, stripe.com)"),
|
|
211
211
|
subjectPattern: z.string().optional().describe("Optional regex pattern for subject line"),
|
|
212
212
|
timeout: z.number().int().optional().describe("Seconds to poll before giving up (default: 60)"),
|
|
@@ -235,7 +235,7 @@ eagerToolGated(server, "email-otp-extract", "personal-assistant", "Poll the agen
|
|
|
235
235
|
// ===================================================================
|
|
236
236
|
// email-status — check email connection health
|
|
237
237
|
// ===================================================================
|
|
238
|
-
|
|
238
|
+
eagerTool(server, "email-status", "Check the health of the agent's email configuration — IMAP and SMTP connectivity, authentication validity, and inbox status.", {}, async () => {
|
|
239
239
|
if (!accountId)
|
|
240
240
|
return refuseNoAccount("email-status");
|
|
241
241
|
try {
|
|
@@ -257,7 +257,7 @@ eagerToolGated(server, "email-status", "personal-assistant", "Check the health o
|
|
|
257
257
|
// ===================================================================
|
|
258
258
|
// email-reply — reply to an existing email in-thread
|
|
259
259
|
// ===================================================================
|
|
260
|
-
|
|
260
|
+
eagerTool(server, "email-reply", "Reply to an email in-thread. Looks up the original message by Message-ID via IMAP (searching INBOX then Sent), sets In-Reply-To and References headers for correct threading, and sends via SMTP. Use this instead of email-send when responding to a received email.", {
|
|
261
261
|
messageId: z.string().min(1).describe("The Message-ID of the email being replied to (from email-read output)"),
|
|
262
262
|
body: z.string().min(1).describe("Plain text reply body"),
|
|
263
263
|
html: z.string().optional().describe("Optional HTML reply body"),
|
|
@@ -284,7 +284,7 @@ eagerToolGated(server, "email-reply", "personal-assistant", "Reply to an email i
|
|
|
284
284
|
// ===================================================================
|
|
285
285
|
// email-graph-query — query stored email :ConversationArchive rows in the graph
|
|
286
286
|
// ===================================================================
|
|
287
|
-
|
|
287
|
+
eagerTool(server, "email-graph-query", "Query email threads stored in the graph as :ConversationArchive {source:'email'} with :Section chunks. Without a query, lists archives sorted by last-message date (filterable by participant address and date range). With a query, runs semantic search over :Section chunks and ranks parent archives. Use this for email history and recall — not for checking the live inbox (use email-read/email-search for that).", {
|
|
288
288
|
query: z.string().optional().describe("Natural-language search query (e.g. 'threads about cabbages'). When omitted, lists all stored email archives."),
|
|
289
289
|
sender: z.string().optional().describe("Filter by participant email (case-insensitive substring match against :Person/:AdminUser linked via :PARTICIPANT_IN)"),
|
|
290
290
|
dateFrom: z.string().optional().describe("ISO date — only archives with at least one :Section whose lastMessageAt is on or after this date"),
|
|
@@ -313,7 +313,7 @@ eagerToolGated(server, "email-graph-query", "personal-assistant", "Query email t
|
|
|
313
313
|
// ===================================================================
|
|
314
314
|
// email-fetch — operator-initiated inbox triage (no graph writes)
|
|
315
315
|
// ===================================================================
|
|
316
|
-
|
|
316
|
+
eagerTool(server, "email-fetch", "List new inbox messages since the last ingested UID, metadata + body preview only. Writes nothing to the graph. Used by the email-ingest skill: the operator reviews each message returned here and then calls email-ingest with a per-message disposition (ingest or discard).", {
|
|
317
317
|
since_uid: z.coerce.number().int().optional().describe("UID to fetch after (exclusive). Defaults to the stored high-water mark — usually what you want."),
|
|
318
318
|
}, async (params) => {
|
|
319
319
|
if (!accountId)
|
|
@@ -337,7 +337,7 @@ eagerToolGated(server, "email-fetch", "personal-assistant", "List new inbox mess
|
|
|
337
337
|
// ===================================================================
|
|
338
338
|
// email-ingest — write operator-approved messages from the pending batch
|
|
339
339
|
// ===================================================================
|
|
340
|
-
|
|
340
|
+
eagerTool(server, "email-ingest", "Apply the operator's per-message decisions to the batch returned by the most recent email-fetch. Every Message-ID from that batch must appear in decisions with a disposition of 'ingest' (write to graph) or 'discard' (skip). Advances the inbox high-water mark only after a successful write. Refuses if any pending Message-ID is missing a decision.", {
|
|
341
341
|
decisions: z.array(z.object({
|
|
342
342
|
messageId: z.string().min(1).describe("Message-ID from the email-fetch listing (angle brackets optional)."),
|
|
343
343
|
disposition: z.enum(["ingest", "discard"]).describe("'ingest' writes the message into a :ConversationArchive {source:'email'} thread (per Task 426); 'discard' skips it without writing."),
|