@rubytech/create-maxy 1.0.877 → 1.0.879

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 (44) hide show
  1. package/package.json +1 -1
  2. package/payload/platform/lib/graph-trash/dist/index.js +1 -1
  3. package/payload/platform/lib/graph-trash/dist/index.js.map +1 -1
  4. package/payload/platform/lib/graph-trash/src/index.ts +1 -1
  5. package/payload/platform/plugins/admin/hooks/__tests__/pre-tool-use-base64-guard.test.sh +204 -0
  6. package/payload/platform/plugins/admin/hooks/pre-tool-use.sh +96 -0
  7. package/payload/platform/plugins/cloudflare/PLUGIN.md +9 -0
  8. package/payload/platform/plugins/docs/references/platform.md +8 -2
  9. package/payload/platform/templates/agents/admin/IDENTITY.md +6 -0
  10. package/payload/server/chunk-2INJCOYG.js +1373 -0
  11. package/payload/server/chunk-DOIAYD3J.js +2282 -0
  12. package/payload/server/chunk-ICY65BIH.js +11364 -0
  13. package/payload/server/chunk-INI2ED6U.js +2277 -0
  14. package/payload/server/chunk-JTZYXIUW.js +1373 -0
  15. package/payload/server/chunk-LQDUG4II.js +11336 -0
  16. package/payload/server/chunk-Q5J4NI6Q.js +660 -0
  17. package/payload/server/chunk-RP25NRQY.js +660 -0
  18. package/payload/server/client-pool-AIZ5QKFD.js +34 -0
  19. package/payload/server/client-pool-JAM3QHGW.js +34 -0
  20. package/payload/server/cloudflare-task-tracker-B6FXP3HI.js +20 -0
  21. package/payload/server/cloudflare-task-tracker-HUTXJQXO.js +20 -0
  22. package/payload/server/maxy-edge.js +3 -3
  23. package/payload/server/public/assets/{Checkbox-m3yLBLrp.js → Checkbox-CqsIsmEi.js} +1 -1
  24. package/payload/server/public/assets/admin-uVxIhs_u.js +352 -0
  25. package/payload/server/public/assets/data-CH-nQ7oX.js +1 -0
  26. package/payload/server/public/assets/graph-labels-D0qUVHtZ.js +1 -0
  27. package/payload/server/public/assets/graph-mpWDe4rf.js +1 -0
  28. package/payload/server/public/assets/{jsx-runtime-DJwgVAMg.css → jsx-runtime-Cy_HdZWV.css} +1 -1
  29. package/payload/server/public/assets/page-CnyySOZF.js +1 -0
  30. package/payload/server/public/assets/{page-BLRjaAoU.js → page-DcK36vDf.js} +2 -2
  31. package/payload/server/public/assets/public-SXA00FTv.js +5 -0
  32. package/payload/server/public/assets/{useVoiceRecorder-JwwBC5pd.js → useVoiceRecorder-DcByEBLy.js} +1 -1
  33. package/payload/server/public/data.html +5 -5
  34. package/payload/server/public/graph.html +6 -6
  35. package/payload/server/public/index.html +8 -8
  36. package/payload/server/public/public.html +5 -5
  37. package/payload/server/server.js +569 -443
  38. package/payload/server/public/assets/admin-DEm0CCga.js +0 -352
  39. package/payload/server/public/assets/data-BkbjVYwP.js +0 -1
  40. package/payload/server/public/assets/graph-Cic-rDfg.js +0 -1
  41. package/payload/server/public/assets/graph-labels-C13OVh5P.js +0 -1
  42. package/payload/server/public/assets/page-p-Fj8Guk.js +0 -1
  43. package/payload/server/public/assets/public-4udeVi_T.js +0 -5
  44. /package/payload/server/public/assets/{jsx-runtime-Bd3TJ8Bg.js → jsx-runtime-BEjEWeaF.js} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rubytech/create-maxy",
3
- "version": "1.0.877",
3
+ "version": "1.0.879",
4
4
  "description": "Install Maxy — AI for Productive People",
5
5
  "bin": {
6
6
  "create-maxy": "./dist/index.js"
@@ -45,7 +45,7 @@ const UNIQUE_KEYS_BY_LABEL = {
45
45
  Event: ["eventId"],
46
46
  KnowledgeDocument: ["attachmentId"],
47
47
  DigitalDocument: ["attachmentId"],
48
- Conversation: ["conversationId", "sessionKey"],
48
+ Conversation: ["conversationId"],
49
49
  Message: ["messageId"],
50
50
  OnboardingState: ["accountId"],
51
51
  Workflow: ["workflowId"],
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;GAu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M,CAAC,IAAI,MAAM;QAAE,KAAK,MAAM,CAAC,IAAI,oBAAoB,CAAC,CAAC,CAAC,IAAI,EAAE;YAAE,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAClF,OAAO,CAAC,GAAG,GAAG,CAAC,CAAC;AAClB,CAAC;AAED,2FAA2F;AAC9E,QAAA,oBAAoB,GAAsB,gBAAgB,CAAC"}
@@ -40,7 +40,7 @@ const UNIQUE_KEYS_BY_LABEL: Record<string, string[]> = {
40
40
  Event: ["eventId"],
41
41
  KnowledgeDocument: ["attachmentId"],
42
42
  DigitalDocument: ["attachmentId"],
43
- Conversation: ["conversationId", "sessionKey"],
43
+ Conversation: ["conversationId"],
44
44
  Message: ["messageId"],
45
45
  OnboardingState: ["accountId"],
46
46
  Workflow: ["workflowId"],
@@ -0,0 +1,204 @@
1
+ #!/usr/bin/env bash
2
+ # Regression test for the Task 983 base64 context-overflow guard.
3
+ #
4
+ # Covers two PreToolUse rejection paths in pre-tool-use.sh:
5
+ #
6
+ # 1. Bash producer guard — `tool_input.command` invoking `base64` (encode
7
+ # direction) or `xxd -p` is rejected; `base64 -d|-D|--decode` is allowed.
8
+ # 2. Write/Edit consumer guard — `tool_input.content` (Write) or
9
+ # `tool_input.new_string` (Edit) carrying `data:<mime>;base64,<≥4096 chars>`
10
+ # is rejected; small inline data URIs and plain content are allowed.
11
+ #
12
+ # Plus a fail-open case (malformed stdin → exit 0 silent) to pin the contract
13
+ # established by the playwright-file-guard test (terminal-stdin guard + parse-
14
+ # error fail-open).
15
+
16
+ set -u
17
+
18
+ HOOK="$(cd "$(dirname "$0")/.." && pwd)/pre-tool-use.sh"
19
+ if [[ ! -x "$HOOK" ]]; then
20
+ echo "FAIL: $HOOK not executable" >&2
21
+ exit 1
22
+ fi
23
+
24
+ TMPFILES=()
25
+ cleanup_test_state() {
26
+ for f in "${TMPFILES[@]:-}"; do
27
+ [[ -n "$f" ]] && rm -f "$f" 2>/dev/null || true
28
+ done
29
+ }
30
+ trap cleanup_test_state EXIT
31
+
32
+ PASS=0
33
+ FAIL=0
34
+ pass() { echo "PASS: $1"; PASS=$((PASS + 1)); }
35
+ fail() { echo "FAIL: $1" >&2; FAIL=$((FAIL + 1)); }
36
+
37
+ # Helper: run hook with Bash tool_input.command and assert exit code + stderr.
38
+ run_bash() {
39
+ local command_text="$1"; local expected_rc="$2"; local stderr_pattern="$3"; local label="$4"
40
+ local input_json
41
+ # Build the input JSON via python3 so command_text with quotes / specials is safe.
42
+ input_json=$(python3 -c '
43
+ import json, sys
44
+ print(json.dumps({"hook_event_name": "PreToolUse", "tool_name": "Bash", "tool_input": {"command": sys.argv[1]}}, separators=(",", ":")))
45
+ ' "$command_text")
46
+ local stdout_file; stdout_file=$(mktemp); TMPFILES+=("$stdout_file")
47
+ local stderr_file; stderr_file=$(mktemp); TMPFILES+=("$stderr_file")
48
+ printf '%s' "$input_json" | bash "$HOOK" admin >"$stdout_file" 2>"$stderr_file"
49
+ local rc=$?
50
+ if [[ "$rc" -ne "$expected_rc" ]]; then
51
+ fail "$label: expected exit $expected_rc, got $rc. Stderr: $(cat "$stderr_file")"
52
+ return
53
+ fi
54
+ if [[ -n "$stderr_pattern" ]] && ! grep -qE "$stderr_pattern" "$stderr_file"; then
55
+ fail "$label: stderr missing pattern '$stderr_pattern'. Got: $(cat "$stderr_file")"
56
+ return
57
+ fi
58
+ pass "$label"
59
+ }
60
+
61
+ # Helper: run hook with Write tool_input.content and assert exit code + stderr.
62
+ run_write() {
63
+ local content="$1"; local expected_rc="$2"; local stderr_pattern="$3"; local label="$4"
64
+ local input_json
65
+ input_json=$(python3 -c '
66
+ import json, sys
67
+ print(json.dumps({"hook_event_name": "PreToolUse", "tool_name": "Write", "tool_input": {"file_path": "/tmp/test.html", "content": sys.argv[1]}}, separators=(",", ":")))
68
+ ' "$content")
69
+ local stdout_file; stdout_file=$(mktemp); TMPFILES+=("$stdout_file")
70
+ local stderr_file; stderr_file=$(mktemp); TMPFILES+=("$stderr_file")
71
+ printf '%s' "$input_json" | bash "$HOOK" admin >"$stdout_file" 2>"$stderr_file"
72
+ local rc=$?
73
+ if [[ "$rc" -ne "$expected_rc" ]]; then
74
+ fail "$label: expected exit $expected_rc, got $rc. Stderr: $(cat "$stderr_file")"
75
+ return
76
+ fi
77
+ if [[ -n "$stderr_pattern" ]] && ! grep -qE "$stderr_pattern" "$stderr_file"; then
78
+ fail "$label: stderr missing pattern '$stderr_pattern'. Got: $(cat "$stderr_file")"
79
+ return
80
+ fi
81
+ pass "$label"
82
+ }
83
+
84
+ # Helper: run hook with Edit tool_input.new_string and assert exit code.
85
+ run_edit() {
86
+ local new_string="$1"; local expected_rc="$2"; local stderr_pattern="$3"; local label="$4"
87
+ local input_json
88
+ input_json=$(python3 -c '
89
+ import json, sys
90
+ print(json.dumps({"hook_event_name": "PreToolUse", "tool_name": "Edit", "tool_input": {"file_path": "/tmp/test.html", "old_string": "OLD", "new_string": sys.argv[1]}}, separators=(",", ":")))
91
+ ' "$new_string")
92
+ local stdout_file; stdout_file=$(mktemp); TMPFILES+=("$stdout_file")
93
+ local stderr_file; stderr_file=$(mktemp); TMPFILES+=("$stderr_file")
94
+ printf '%s' "$input_json" | bash "$HOOK" admin >"$stdout_file" 2>"$stderr_file"
95
+ local rc=$?
96
+ if [[ "$rc" -ne "$expected_rc" ]]; then
97
+ fail "$label: expected exit $expected_rc, got $rc. Stderr: $(cat "$stderr_file")"
98
+ return
99
+ fi
100
+ if [[ -n "$stderr_pattern" ]] && ! grep -qE "$stderr_pattern" "$stderr_file"; then
101
+ fail "$label: stderr missing pattern '$stderr_pattern'. Got: $(cat "$stderr_file")"
102
+ return
103
+ fi
104
+ pass "$label"
105
+ }
106
+
107
+ # Generate a base64-character blob >= 4096 chars (data-URI body trigger).
108
+ LARGE_B64=$(python3 -c "print('A' * 5000)")
109
+
110
+ # ───────── Bash producer guard ──────────────────────────────────────────────
111
+ run_bash "echo hello world" 0 "" \
112
+ "Test 1: bare Bash command (no base64) allowed"
113
+
114
+ run_bash "ls -la" 0 "" \
115
+ "Test 2: ls -la (no base64 token) allowed"
116
+
117
+ run_bash "base64 /tmp/foo.png" 2 '\[pre-tool-use\] guard=base64-tool-result.*tool=Bash.*reason=base64-encoder.*action=reject' \
118
+ "Test 3: 'base64 file' (encode) rejected"
119
+
120
+ run_bash "cat foo.png | base64" 2 '\[pre-tool-use\] guard=base64-tool-result.*action=reject' \
121
+ "Test 4: 'cat | base64' (encode pipeline) rejected"
122
+
123
+ run_bash "cat foo.png|base64 -w0" 2 '\[pre-tool-use\] guard=base64-tool-result.*action=reject' \
124
+ "Test 5: 'base64 -w0' (encode with line-wrap flag) rejected"
125
+
126
+ run_bash "xxd -p file.bin" 2 '\[pre-tool-use\] guard=base64-tool-result.*reason=xxd-plain-hex.*action=reject' \
127
+ "Test 6: 'xxd -p' (plain hex encode) rejected"
128
+
129
+ run_bash "base64 -d input.b64 > output.bin" 0 "" \
130
+ "Test 7: 'base64 -d' (decode direction) allowed"
131
+
132
+ run_bash "base64 --decode < x.b64 > y.bin" 0 "" \
133
+ "Test 8: 'base64 --decode' (decode long-form) allowed"
134
+
135
+ run_bash "echo Zm9v | base64 -d" 0 "" \
136
+ "Test 9: 'base64 -d' decode pipeline allowed"
137
+
138
+ run_bash "echo '--debug-base64-foo'" 0 "" \
139
+ "Test 10: 'base64' substring inside flag name does NOT false-match"
140
+
141
+ run_bash "ls mybase64tool" 0 "" \
142
+ "Test 11: 'base64' substring inside identifier does NOT false-match"
143
+
144
+ run_bash "cat in.b64 | base64 -d > /tmp/foo.bin; cat /tmp/bar.png | base64" 2 '\[pre-tool-use\] guard=base64-tool-result.*reason=base64-encoder.*action=reject' \
145
+ "Test 11b: compound (decode ; encode) rejects encoder segment (per-segment scan)"
146
+
147
+ run_bash "echo data | base64 -d > x.bin && cat y.png | base64 > y.b64" 2 '\[pre-tool-use\] guard=base64-tool-result.*action=reject' \
148
+ "Test 11c: compound (decode && encode) rejects encoder segment"
149
+
150
+ run_bash "base64 -d in.b64 > out.bin; base64 -d in2.b64 > out2.bin" 0 "" \
151
+ "Test 11d: compound (decode ; decode) allowed"
152
+
153
+ # ───────── Write/Edit consumer guard ────────────────────────────────────────
154
+ run_write "<html><body>hello world</body></html>" 0 "" \
155
+ "Test 12: Write small HTML content (no data URI) allowed"
156
+
157
+ run_write "<img src='data:image/png;base64,AAAA'>" 0 "" \
158
+ "Test 13: Write content with small inline data URI (<4096 chars) allowed"
159
+
160
+ run_write "<img src='data:image/png;base64,${LARGE_B64}'>" 2 '\[pre-tool-use\] guard=base64-write-content.*action=reject' \
161
+ "Test 14: Write content with large inline data URI (>4096 chars) rejected"
162
+
163
+ run_edit "<img src='data:image/png;base64,${LARGE_B64}'>" 2 '\[pre-tool-use\] guard=base64-write-content.*action=reject' \
164
+ "Test 15: Edit new_string with large inline data URI rejected"
165
+
166
+ run_edit "<p>just text replacement</p>" 0 "" \
167
+ "Test 16: Edit new_string with plain text allowed"
168
+
169
+ # ───────── Fail-open / structural ───────────────────────────────────────────
170
+ STDOUT_FILE=$(mktemp); STDERR_FILE=$(mktemp); TMPFILES+=("$STDOUT_FILE" "$STDERR_FILE")
171
+ printf '%s' 'not json at all { ' | bash "$HOOK" admin >"$STDOUT_FILE" 2>"$STDERR_FILE"
172
+ RC=$?
173
+ if [[ "$RC" -ne 0 ]]; then
174
+ fail "Test 17: malformed stdin should fail open (exit 0), got $RC. Stderr: $(cat "$STDERR_FILE")"
175
+ else
176
+ pass "Test 17: malformed stdin → silent passthrough (fail-open)"
177
+ fi
178
+
179
+ # Terminal-stdin guard preserved (no -t 0 test runs in test harness; assert
180
+ # the guard line exists in source).
181
+ if ! grep -q '\[ -t 0 \]' "$HOOK"; then
182
+ fail "Test 18: terminal stdin guard missing from hook source"
183
+ else
184
+ pass "Test 18: terminal stdin guard present in source"
185
+ fi
186
+
187
+ # Pre-existing guards still active — entitlement file edit still rejected.
188
+ ENT_JSON=$(python3 -c 'import json; print(json.dumps({"hook_event_name":"PreToolUse","tool_name":"Write","tool_input":{"file_path":"/srv/entitlement.json","content":"{\"tier\":\"max\"}"}}, separators=(",", ":")))')
189
+ STDOUT_FILE=$(mktemp); STDERR_FILE=$(mktemp); TMPFILES+=("$STDOUT_FILE" "$STDERR_FILE")
190
+ printf '%s' "$ENT_JSON" | bash "$HOOK" admin >"$STDOUT_FILE" 2>"$STDERR_FILE"
191
+ RC=$?
192
+ if [[ "$RC" -ne 2 ]]; then
193
+ fail "Test 19: pre-existing entitlement guard regressed (expected exit 2, got $RC)"
194
+ else
195
+ pass "Test 19: pre-existing entitlement guard still rejects entitlement.json"
196
+ fi
197
+
198
+ echo
199
+ echo "──────── pre-tool-use base64 guard test summary ────────"
200
+ echo "PASS: $PASS"
201
+ echo "FAIL: $FAIL"
202
+
203
+ [[ "$FAIL" -gt 0 ]] && exit 1
204
+ exit 0
@@ -94,6 +94,102 @@ if [ "$AGENT_TYPE" = "admin" ]; then
94
94
  ;;
95
95
  esac
96
96
 
97
+ # ── Base64 context-overflow guard (Task 983) ─────────────────────────────
98
+ # Block inline base64 payloads from reaching the model context. Two paths:
99
+ #
100
+ # 1. Bash command that ENCODES a binary file to base64/hex (the producer).
101
+ # 2. Write/Edit content carrying an inline `data:<mime>;base64,…` blob
102
+ # (the consumer — agent quoting bytes from a prior tool_result into a
103
+ # HTML/markdown Write).
104
+ #
105
+ # Either path landed ~33 KB of base64 in the SDK request and the next turn
106
+ # tripped `main_stream_stalled` at 180 s (see Task 983 reproduction). The
107
+ # remediation is symmetric: the agent saves bytes to `$ACCOUNT_DIR/tmp/<sha1>.<ext>`
108
+ # and references the path (`<img src="./file">` or Read-by-path) instead of
109
+ # carrying bytes through the assistant turn.
110
+ #
111
+ # Parsing uses python3 (already a hook dependency at the action-id site
112
+ # below); grep on JSON is unsafe for content with escaped quotes or
113
+ # embedded newlines. Parse failure is fail-open (empty extracted string,
114
+ # no match, allow) — matches the playwright-file-guard fail-open contract.
115
+ # Single python3 invocation parses the JSON, runs the tool-specific
116
+ # regex match (avoiding BSD-vs-GNU grep interval-count incompatibilities —
117
+ # `grep -E '{4096,}'` errors with "invalid repetition count(s)" on macOS
118
+ # BSD grep under some pattern combinations), and prints the rejection
119
+ # outcome to stdout as `REJECT:<reason>:<bytes>` or `ALLOW`. The wrapping
120
+ # bash logic reads the verdict and emits the rejection log/stderr/exit-2.
121
+ # Parse failure prints `ALLOW` (fail-open, matching the playwright-file-
122
+ # guard contract for malformed stdin).
123
+ GUARD_VERDICT=$(echo "$INPUT" | python3 -c '
124
+ import sys, json, re
125
+ try:
126
+ d = json.load(sys.stdin)
127
+ tool = d.get("tool_name", "")
128
+ ti = d.get("tool_input", {}) or {}
129
+ if tool in ("Write", "Edit"):
130
+ # Write.content OR Edit.new_string can carry inline base64.
131
+ content = ti.get("content") or ti.get("new_string") or ""
132
+ if not isinstance(content, str):
133
+ print("ALLOW"); sys.exit(0)
134
+ # data:<mime>;base64,<≥4096 base64 chars> — threshold matches the
135
+ # doctrine paragraph in .docs/agents.md. The 4096-char body is
136
+ # ~3 KB binary, far above any legitimate inline icon.
137
+ m = re.search(r"data:[^;]+;base64,[A-Za-z0-9+/]{4096,}={0,2}", content)
138
+ if m:
139
+ print(f"REJECT:base64-write-content:{len(content)}")
140
+ else:
141
+ print("ALLOW")
142
+ elif tool == "Bash":
143
+ command = ti.get("command", "")
144
+ if not isinstance(command, str):
145
+ print("ALLOW"); sys.exit(0)
146
+ # Per-segment scan. A compound command like
147
+ # cat in.b64 | base64 -d > out.bin; cat photo.png | base64
148
+ # contains both a legitimate decode AND a malicious encoder. A whole-
149
+ # command decode-flag check is fooled into allowing the encoder. Split
150
+ # on shell separators (;, &&, ||, &) and scan each segment as its own
151
+ # command — the encoder rejection fires when ANY segment is a bare
152
+ # base64 invocation without a paired decode flag in the SAME segment.
153
+ # Pipelines (|) keep the segment together because the encoder direction
154
+ # of `cat file | base64` lives across the pipe.
155
+ segments = re.split(r";|&&|\|\||(?<![|&])&(?![|&])", command)
156
+ rejected = None
157
+ for seg in segments:
158
+ if re.search(r"(?:^|[\s|;&])xxd[\t ]+-p(?![A-Za-z0-9_-])", seg):
159
+ rejected = "xxd-plain-hex"; break
160
+ if re.search(r"(?:^|[\s|;&])base64(?![A-Za-z0-9_-])", seg):
161
+ if not re.search(r"base64[\t ]+[^|]*(?:-d|-D|--decode)(?![A-Za-z0-9_])", seg):
162
+ rejected = "base64-encoder"; break
163
+ if rejected:
164
+ print(f"REJECT:{rejected}:{len(command)}")
165
+ else:
166
+ print("ALLOW")
167
+ else:
168
+ print("ALLOW")
169
+ except Exception:
170
+ print("ALLOW")
171
+ ' 2>/dev/null || echo "ALLOW")
172
+ case "$GUARD_VERDICT" in
173
+ REJECT:base64-write-content:*)
174
+ BYTES="${GUARD_VERDICT##*:}"
175
+ echo "[pre-tool-use] guard=base64-write-content bytes=${BYTES} action=reject" >&2
176
+ echo "Blocked: ${TOOL_NAME} content carries an inline base64 payload (>4 KB encoded). Inline binary in Write.content overloads the model context — the same path produced a main_stream_stalled at ~33 KB on 2026-05-09." >&2
177
+ echo "Save the bytes to \$ACCOUNT_DIR/tmp/<sha1>.<ext> via Bash (e.g. 'base64 -d > out.png'), then reference the file from the document: <img src=\"./<file>\"> or Read-by-path. Do not carry binary bytes through the assistant turn." >&2
178
+ exit 2
179
+ ;;
180
+ REJECT:base64-encoder:*|REJECT:xxd-plain-hex:*)
181
+ REASON="${GUARD_VERDICT#REJECT:}"; REASON="${REASON%:*}"
182
+ BYTES="${GUARD_VERDICT##*:}"
183
+ echo "[pre-tool-use] guard=base64-tool-result bytes=${BYTES} tool=Bash reason=${REASON} action=reject" >&2
184
+ echo "Blocked: Bash command would emit binary as inline base64/hex to stdout, which lands in the assistant turn and overloads the model context (the 2026-05-09 Rubytech-invoice path hit 66% context after a single ~33 KB tool_result)." >&2
185
+ echo "Instead: save the bytes directly to \$ACCOUNT_DIR/tmp/<sha1>.<ext> and operate on the file via path — Read for inspection, <img src=\"./<file>\"> for HTML embedding, file-attach for delivery. Decoding base64 (e.g. 'base64 -d in.b64 > out.bin') is allowed." >&2
186
+ exit 2
187
+ ;;
188
+ *)
189
+ : # ALLOW — fall through to approval gating below
190
+ ;;
191
+ esac
192
+
97
193
  # ── Approval gating (EU AI Act Article 14 — human oversight) ─────────────
98
194
  # Strip the mcp__<plugin>__ prefix to get the short tool name.
99
195
  # Built-in tools (no prefix) pass through unchanged.
@@ -53,6 +53,15 @@ The agent loads these references on demand via `plugin-read` as the conversation
53
53
 
54
54
  VNC surfacing is post-navigation, never on form submit. Two sites call `useDeviceUrlActions().onShowVnc()` and both fire only after a successful CDP nav: `DeviceUrlBlock` (tool-output URL clicks) and `ActionLogPanel.handleOauthRespawn` (the "Re-open on Pi browser" button rendered when an OAuth URL appears in the action log). The form (`cloudflare-setup-form`) must NOT call `onShowVnc()` on POST resolve — pre-warming the fullscreen overlay before the OAuth URL is on the brand chromium hides the form, the ActionLogPanel, and the very button operators must click. The `[browser-viewer] event=mount surface="overlay"` line must appear within 5 s of `[device-url:click] navigateResult=ok`, never before.
55
55
 
56
+ ### Error envelope contract
57
+
58
+ Every `POST /api/admin/cloudflare/setup` failure returns a `CloudflareSetupError` carrying — in addition to `field`, `message`, `output`, `correlationId`, `streamLogPath` — two structured fields the form relays into the chat as a fenced JSON block:
59
+
60
+ - `inputsAlreadyHeld: { admin?: string; public?: string; apex?: string }` — the FQDNs the route composed from the submit body before `err()` fired. Pre-validation failures emit `{}` so absence is itself deterministic.
61
+ - `discoveryResults: { tunnels: { id; name }[]; domains: string[] }` — the last-known snapshot from the process-lifetime `discoveryCache` Map that `GET /tunnels` and `GET /domains` write to on success.
62
+
63
+ The chat relay appends both as a fenced ```` ```json ```` block under "Held by deterministic tools (do not re-solicit)". The admin agent's reply quotes those values back rather than re-soliciting; the rule lives in IDENTITY.md § "Post-deterministic-error reply contract" and `.docs/agents.md` § "Intent Gate — post-deterministic-error reply contract". The shared `TunnelEntry` shape lives in [`platform/ui/app/lib/cloudflare-setup-types.ts`](../../ui/app/lib/cloudflare-setup-types.ts).
64
+
56
65
  ## Identity model
57
66
 
58
67
  - **Product identity** (Maxy vs Real Agent) — known from `brand.json` (`productName`, `configDir`).
@@ -65,7 +65,7 @@ There is no dashboard, no settings panel, no menus. Everything is done through c
65
65
 
66
66
  The chat input auto-grows as you type — it expands to fit your message and shrinks back when you delete text. You can also drag the resize handle above the input to set a custom height.
67
67
 
68
- The admin interface is a three-pane layout: a sidebar on the left with your brand mark, navigation (Chat, People, Agents, Projects, Tasks, Artefacts), and your recent conversations; the chat in the middle; and an artefact pane on the right that opens when you select a document, click a project, or open Browser, Data, or Graph from the menu — holding the surface side-by-side with the conversation so the chat stays live while you work in it. The sidebar's nav rows swap the list view in place — Chat shows recent conversations, Projects shows your active work projects, and Artefacts lists every KnowledgeDocument plus this account's agent templates (your admin agent's IDENTITY, SOUL, and KNOWLEDGE files plus one entry per enabled specialist). The People, Agents, and Tasks rows are graph shortcuts: clicking each opens the artefact-pane Graph filtered to every Person, every public Agent, or every Task in your account respectively, with no side-list — the graph itself is the result. Public agents become first-class graph entities the moment you create them, with edges to their IDENTITY/SOUL/KNOWLEDGE files, edges to every knowledge document they have access to, and edges from every conversation they have handled, so a single Agents click reveals the whole shape of who knows what and who has been talking to whom. Click an artefact row to open the document. KnowledgeDocuments and your admin agent's templates are editable — type in the document and changes save automatically; specialist agent templates are read-only because they ship with Maxy and your edits would be overwritten on the next install. PDF artefacts render inline so you can read them without leaving the pane. If your browser doesn't have a built-in PDF viewer, a Download button appears instead. Artefacts that have no readable file backing them (orphan rows, files removed from disk, unsupported content types) show a one-line banner explaining the skip instead of opening to a blank pane. Click a project row to open the Graph view focused on that project's neighbourhood — clicking a second project swaps the focus rather than stacking on top. The chat / artefact divider is drag-resizable — drag the line between the columns to make either side wider; double-click it to reset to half of the available width (viewport minus sidebar), clamped to the chat / artefact min-width floors. Your chosen width is remembered across reloads. On wider screens (>1280px) all three panes are visible. The sidebar narrows at 1280px, the artefact pane hides at 1080px (Browser, Data, and Graph then open as full-window pages instead), and the sidebar collapses to a 56px icon rail at 820px. On phones (<720px) the sidebar slides in as a drawer from the left when you tap the menu icon in the chat header — the drawer animation only fires on tap (220ms slide in or out); resizing your window across the 720px boundary snaps the layout without animation, so you never see a half-open flash. Breakpoint summary: >1280px = full sidebar + chat + artefact pane (drag-resizable divider); 1280px→1080px = sidebar narrows; 1080px→820px = artefact pane hides (Browser/Data/Graph open as full-window pages instead); 820px→720px = sidebar collapses to 56px icon rail; ≤720px = sidebar becomes off-canvas drawer (vertical stack of brand mark, nav, recents list, foot — same shape as the desktop sidebar, just on top of the chat instead of beside it). When the sidebar is collapsed to the 56px icon rail, clicking the Artefacts icon expands the rail back open so the artefact list is visible — the row was previously a silent no-op in collapsed state.
68
+ The admin interface is a three-pane layout: a sidebar on the left with your brand mark, navigation (Chat, People, Agents, Projects, Tasks, Artefacts), and your recent conversations; the chat in the middle; and an artefact pane on the right that opens when you select a document, click a project, or open Browser, Data, or Graph from the menu — holding the surface side-by-side with the conversation so the chat stays live while you work in it. The sidebar's nav rows swap the list view in place — Chat shows recent conversations, Projects shows your active work projects, and Artefacts lists every KnowledgeDocument plus this account's agent templates (your admin agent's IDENTITY, SOUL, and KNOWLEDGE files plus one entry per enabled specialist). The People, Agents, and Tasks rows are graph shortcuts: clicking each opens the artefact-pane Graph filtered to every Person, every public Agent, or every Task in your account respectively, with no side-list — the graph itself is the result. Public agents become first-class graph entities the moment you create them, with edges to their IDENTITY/SOUL/KNOWLEDGE files, edges to every knowledge document they have access to, and edges from every conversation they have handled, so a single Agents click reveals the whole shape of who knows what and who has been talking to whom. Click an artefact row to open the document. KnowledgeDocuments and your admin agent's templates are editable — type in the document and changes save automatically; specialist agent templates are read-only because they ship with Maxy and your edits would be overwritten on the next install. PDF artefacts render inline so you can read them without leaving the pane. If your browser doesn't have a built-in PDF viewer, a Download button appears instead. Artefacts that have no readable file backing them (orphan rows, files removed from disk, unsupported content types) show a one-line banner explaining the skip instead of opening to a blank pane. Click a project row to open the Graph view focused on that project's neighbourhood — clicking a second project swaps the focus rather than stacking on top. The chat / artefact divider is drag-resizable — drag the line between the columns to make either side wider; double-click it to reset to half of the available width (viewport minus sidebar), clamped to the chat / artefact min-width floors. Your chosen width is remembered across reloads. On wider screens (>1280px) all three panes are visible. The sidebar narrows at 1280px, the artefact pane hides at 1080px (Browser, Data, and Graph then open as full-window pages instead), and the sidebar collapses to a 56px icon rail at 820px. On phones (<720px) the sidebar slides in as a drawer from the left when you tap the brand-mark logo at the start of the chat header (the same logo is the open trigger; inside the open drawer's header, the sidebar toggle is the close affordance) — the drawer animation only fires on tap (220ms slide in or out); resizing your window across the 720px boundary snaps the layout without animation, so you never see a half-open flash. Breakpoint summary: >1280px = full sidebar + chat + artefact pane (drag-resizable divider); 1280px→1080px = sidebar narrows; 1080px→820px = artefact pane hides (Browser/Data/Graph open as full-window pages instead); 820px→720px = sidebar collapses to 56px icon rail; ≤720px = sidebar becomes off-canvas drawer (vertical stack of brand mark, nav, recents list, foot — same shape as the desktop sidebar, just on top of the chat instead of beside it). When the sidebar is collapsed to the 56px icon rail, clicking the Artefacts icon expands the rail back open so the artefact list is visible — the row was previously a silent no-op in collapsed state.
69
69
 
70
70
  Page titles are brand-aware: the browser tab shows your product name (e.g. `Real Agent` instead of `Maxy`) on every shell — chat, graph, and data — so a non-default brand never leaks the default name in tab strips or browser history.
71
71
 
@@ -82,7 +82,13 @@ There is no free-form terminal surface in the admin UI — ad-hoc shell access s
82
82
 
83
83
  If the browser drops the SSE connection mid-upgrade (typical during the maxy restart window), the panel reconnects within two seconds and replays any lines you missed from the persisted log.
84
84
 
85
- **Cloudflare setup flow.** Same pattern POST to `/api/admin/cloudflare/setup` launches a `cloudflare-setup` action that runs `~/setup-tunnel.sh <brand> <port> <hostname...>`. When the script emits the OAuth consent URL on stdout, the log panel surfaces an **"Authorise in Cloudflare"** button; clicking it opens the consent page in a new tab. After you approve, the script's callback receives `cert.pem` and the setup continues through `tunnel create`/`route`/`run`. On devices where a VNC Chromium is also running, the script can drive the click via CDP automatically (same button remains a harmless safety net).
85
+ **Mid-turn stream-drop banners.** If a chat turn ends abruptly the bubble shows one of two messages depending on what actually happened. You see "Server is restarting — reconnect will happen automatically." only when the app server itself emits the restart signal typically during a Software Update or a Cloudflare setup that re-launches the brand service. You see "Lost connection retrying." when your browser's connection to the Pi dropped mid-stream while the server was still up typically a flaky Wi-Fi moment or the tunnel hiccupping. Either way the chat resumes once the connection is back; the previously-rendered messages stay on screen so you don't lose context.
86
+
87
+ **Cloudflare setup flow.** Same pattern — POST to `/api/admin/cloudflare/setup` launches a `cloudflare-setup` action that runs `~/setup-tunnel.sh <brand> <port> <hostname...>`. When the script emits the OAuth consent URL on stdout, the log panel surfaces an **"Authorise in Cloudflare"** button; clicking it opens the consent page in a new tab. After you approve, the script's callback receives `cert.pem` and the setup continues through `tunnel create`/`route`/`run`. On devices where a VNC Chromium is also running, the script can drive the click via CDP automatically (same button remains a harmless safety net). Setup failures return a `CloudflareSetupError` carrying `inputsAlreadyHeld:{admin,public,apex}` and `discoveryResults:{tunnels,domains}` (from the process-lifetime discovery cache `/tunnels` and `/domains` populate on success); the form appends both fields as a fenced JSON block to the chat-relay body so the agent's next reply quotes held values verbatim rather than re-soliciting hostnames.
88
+
89
+ **Active-chat stream-log click telemetry.** Clicking "Stream log" in the active chat fetches the URL inline (`/api/admin/logs?type=stream&conversationId=…&download=1`), emits a `[stream-log-click] status=<c> bytes=<n> conversationId=<tail>` line in `server.log` via the `/api/_client-error` event pipe, and downloads the same response. Operator-grep `[stream-log-click] status=404` for client/server identity mismatches.
90
+
91
+ **Bundle-mtime session prelude.** Each admin session boot stamps `[boot] bundleMtime=<iso> conversationId=<tail>` in `server.log` next to `[plugins] MCP servers for session:`; the same value is injected into the admin system prompt as `<deployment>bundleMtime=…</deployment>` so the agent can compare deploy time against any earlier `phase=error` in the conversation and re-invoke the deterministic path when the bundle post-dates the failure.
86
92
 
87
93
  **Sudo password** is prompted once per upgrade. The admin server pipes it to `sudo -S -v` to validate + cache, then forwards it to the action unit via `systemd-run --setenv=SUDO_PASSWORD` so the installer's in-unit `sudo -S` reads it directly — per-TTY sudoers configurations where the user-level cache does not cover a fresh systemd-run unit still work. The password is never written to any log, SSE frame, or persisted file.
88
94
 
@@ -30,6 +30,10 @@ No action without clear intent. Before acting on any request, you must know:
30
30
 
31
31
  When the owner's words are precise, all three are self-evident — act without delay. When any of the three requires assumption, stop and ask. Vagueness and urgency are signals to slow down, not speed up. Once confirmed, the rules of engagement are binding for the duration of the task.
32
32
 
33
+ **Antecedent lookup before asking.** The owner's words are not the only source of intent — the chain on this conversationId is the first place to consult, not the last. Before emitting any "stop and ask"-class reply (phrasings such as "what are you referring to?", "not enough signal", "could you clarify?"), call `mcp__memory__conversation-search` against the live conversationId. Only when that lookup returns nothing relevant may you ask. Asking while your own history sits one tool-call away unread is a doctrine violation — the chain is your memory, and ignoring it is the same failure mode as paraphrasing a tool result instead of reading it.
34
+
35
+ **Recovery from any recorded breakdown.** If the chain holds a recent `:TurnFailure` event (mode such as `server-shutdown` or `client-network-drop`) and the owner's next message is a natural follow-up to that breakdown ("what happened?", "where are we?", "did that work?"), the reply names the recorded failure mode and resumes from the preserved chain. Never ask the owner to reframe what they were doing — that information is already in the chain.
36
+
33
37
  This governs everything below.
34
38
 
35
39
  ---
@@ -85,6 +89,8 @@ Do not retry the same tool against the same target within a turn. A second ident
85
89
 
86
90
  When a tool returns a structured failure whose error content begins with an UPPERCASE_ERROR_CODE (for example `WEBFETCH_CANNOT_READ_JS_SPA`), the runtime has already determined that retrying the same tool will fail and that a substitute would launder uncertainty. Read the error's plain-English explanation, then write one or two sentences to the owner that name (a) what failed, (b) the reason in their language, and (c) the concrete actions they can take to unblock — typically pasting text or sending a screenshot. Do not silently dispatch a substitute (Playwright, research-assistant, memory-search) to continue the original instruction; that hides the failure and the owner loses the ability to judge whether the substitute's output answers their question. A verbal instruction in the current conversation is not consent — only an explicit standing policy recorded in account configuration counts, and no such mechanism exists today. Until one exists, every structured tool failure becomes a question for the owner. Wait for direction before resuming.
87
91
 
92
+ **Post-deterministic-error reply contract — never re-solicit held values.** When a Cloudflare form failure surfaces in the chat relay, the trailing fenced `json` block labelled "Held by deterministic tools (do not re-solicit)" is the route's structured payload. It carries `inputsAlreadyHeld` (the FQDNs already submitted: `admin`, `public`, `apex`) and `discoveryResults` (the discovery snapshot the route was holding: `tunnels`, `domains`). The next reply structurally consumes this payload — restate the held values verbatim, name the literal error, and decide between two actions: (a) if the `<deployment>` block's `bundleMtime` post-dates this failure's timestamp, the deterministic path has been redeployed with a fix — re-invoke the same path immediately; (b) otherwise surface the literal error plus the next deterministic step from the relevant SKILL (`setup-tunnel.sh`, `reset-tunnel.sh`, `dashboard-guide.md`). Asking the operator for a hostname, tunnel name, or apex that already appears in `inputsAlreadyHeld` or `discoveryResults` is a doctrine violation — the structured payload is the answer set; the deterministic path holds the values; the chat relay is for restatement, not re-entry.
93
+
88
94
  ## Cypher schema
89
95
 
90
96
  Your system prompt contains a `# SCHEMA (Neo4j graph, canonical reference)` block listing every label and relationship type your graph actually contains. Before authoring any cypher against the memory graph, consult that block. Never invent an edge or label name that is not in it — the plausible-sounding names you half-remember from other systems (`HAS_MESSAGE`, `IN_CONVERSATION`, `CONTAINS_MESSAGE`) do not exist here; Messages attach to Conversations via `:PART_OF`, not any other edge.