@matt82198/aesop 0.1.0-beta.2 → 0.1.0-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +37 -94
- package/CLAUDE-TEMPLATE.md +115 -0
- package/README.md +89 -264
- package/aesop.config.example.json +27 -26
- package/bin/CLAUDE.md +39 -0
- package/bin/cli.js +368 -24
- package/daemons/CLAUDE.md +33 -0
- package/daemons/backup-fleet.sh +92 -21
- package/daemons/run-watchdog.sh +90 -10
- package/dash/CLAUDE.md +32 -0
- package/dash/dash-extra.mjs +194 -21
- package/dash/watchdog-gui.sh +23 -6
- package/docs/BEHAVIORAL-PR-REVIEW.md +86 -0
- package/docs/CHECKPOINTING.md +100 -0
- package/docs/DISPATCH-MODEL.md +11 -7
- package/docs/FORENSICS.md +204 -0
- package/docs/GOVERNANCE.md +4 -2
- package/docs/HOOK-INSTALL.md +307 -0
- package/docs/HOW-THE-LOOP-WORKS.md +175 -0
- package/docs/MEMORY-TEMPLATE.md +61 -0
- package/docs/README.md +44 -0
- package/docs/RELIABILITY.md +61 -0
- package/docs/RESTORE.md +397 -0
- package/docs/SCRIPTS-POLICY.md +97 -0
- package/docs/spikes/tiered-cognition/ACTIVATION.md +125 -0
- package/docs/spikes/tiered-cognition/DESIGN.md +287 -0
- package/docs/spikes/tiered-cognition/FINDINGS.md +113 -0
- package/docs/spikes/tiered-cognition/README.md +29 -0
- package/docs/spikes/tiered-cognition/aesop-cognition.example.md +32 -0
- package/docs/spikes/tiered-cognition/force-model-policy.merged.mjs +673 -0
- package/docs/spikes/tiered-cognition/strip-tools-hook.mjs +434 -0
- package/hooks/CLAUDE.md +38 -0
- package/hooks/claude/force-model-policy.mjs +159 -0
- package/hooks/pre-push-policy.sh +753 -0
- package/monitor/.signal-state.json +3 -0
- package/monitor/ACTIONS.log +1 -0
- package/monitor/BRIEF.md +24 -0
- package/monitor/CHARTER.md +29 -8
- package/monitor/CLAUDE.md +40 -0
- package/monitor/SIGNALS.json +54 -0
- package/monitor/collect-signals.mjs +529 -62
- package/package.json +12 -3
- package/skills/CLAUDE.md +3 -0
- package/skills/power/SKILL.md +161 -0
- package/tools/CLAUDE.md +191 -0
- package/tools/__pycache__/buildlog.cpython-314.pyc +0 -0
- package/tools/__pycache__/ci_merge_wait.cpython-314.pyc +0 -0
- package/tools/__pycache__/ensure_state.cpython-314.pyc +0 -0
- package/tools/__pycache__/eod_sweep.cpython-314.pyc +0 -0
- package/tools/__pycache__/fleet_ledger.cpython-314.pyc +0 -0
- package/tools/__pycache__/heartbeat.cpython-314.pyc +0 -0
- package/tools/__pycache__/inbox_drain.cpython-314.pyc +0 -0
- package/tools/__pycache__/launch_tui.cpython-314.pyc +0 -0
- package/tools/__pycache__/orchestrator_status.cpython-314.pyc +0 -0
- package/tools/__pycache__/power_selftest.cpython-314.pyc +0 -0
- package/tools/__pycache__/prepublish_scan.cpython-314.pyc +0 -0
- package/tools/__pycache__/rotate_logs.cpython-314.pyc +0 -0
- package/tools/__pycache__/scanner_selftest.cpython-314.pyc +0 -0
- package/tools/__pycache__/secret_scan.cpython-314.pyc +0 -0
- package/tools/__pycache__/stall_check.cpython-314.pyc +0 -0
- package/tools/__pycache__/verify_dash.cpython-314.pyc +0 -0
- package/tools/__pycache__/verify_submit_encoding.cpython-314.pyc +0 -0
- package/tools/agent-forensics.sh +186 -0
- package/tools/buildlog.py +182 -0
- package/tools/ci_merge_wait.py +204 -0
- package/tools/ensure_state.py +94 -0
- package/tools/eod_sweep.py +239 -0
- package/tools/fleet_ledger.py +272 -0
- package/tools/heartbeat.py +131 -0
- package/tools/inbox_drain.py +249 -0
- package/tools/launch_tui.py +51 -3
- package/tools/lock.mjs +211 -0
- package/tools/metrics_gate.py +205 -0
- package/tools/orchestrator_status.py +99 -0
- package/tools/power_selftest.py +386 -0
- package/tools/prepublish_scan.py +84 -0
- package/tools/proposals.mjs +248 -0
- package/tools/reconstitute.sh +467 -0
- package/tools/rotate_logs.py +228 -0
- package/tools/scanner_selftest.py +303 -0
- package/tools/secret_scan.py +131 -31
- package/tools/stall_check.py +172 -0
- package/tools/verify_dash.py +694 -0
- package/tools/verify_submit_encoding.py +194 -0
- package/ui/CLAUDE.md +109 -0
- package/ui/__pycache__/agents.cpython-314.pyc +0 -0
- package/ui/__pycache__/collectors.cpython-314.pyc +0 -0
- package/ui/__pycache__/config.cpython-314.pyc +0 -0
- package/ui/__pycache__/csrf.cpython-314.pyc +0 -0
- package/ui/__pycache__/handler.cpython-314.pyc +0 -0
- package/ui/__pycache__/render.cpython-314.pyc +0 -0
- package/ui/__pycache__/serve.cpython-314.pyc +0 -0
- package/ui/__pycache__/sse.cpython-314.pyc +0 -0
- package/ui/agents.py +179 -0
- package/ui/api/__init__.py +84 -0
- package/ui/api/__pycache__/__init__.cpython-314.pyc +0 -0
- package/ui/api/__pycache__/submit.cpython-314.pyc +0 -0
- package/ui/api/__pycache__/tracker.cpython-314.pyc +0 -0
- package/ui/api/submit.py +58 -0
- package/ui/api/tracker.py +116 -0
- package/ui/collectors.py +586 -0
- package/ui/config.py +114 -0
- package/ui/csrf.py +140 -0
- package/ui/handler.py +426 -0
- package/ui/render.py +29 -0
- package/ui/serve.py +68 -796
- package/ui/sse.py +168 -0
- package/ui/templates/dashboard.html +1202 -0
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
Aesop UI API — tracker CRUD logic (wave-10 P0 split from handler.py).
|
|
4
|
+
|
|
5
|
+
Free functions: take already-parsed request input (headers/body bytes/path
|
|
6
|
+
params extracted by ui/handler.py) and call collectors' tracker CRUD,
|
|
7
|
+
returning (status_code, dict). No self/HTTP coupling -- ui/handler.py owns
|
|
8
|
+
parsing the raw request and writing the HTTP response bytes.
|
|
9
|
+
|
|
10
|
+
Every mutation here is CSRF-gated via api.validate_mutation() (create) or a
|
|
11
|
+
direct csrf.validate_csrf_request() check performed by the caller before
|
|
12
|
+
delete (see ui/handler.py's handle_tracker_mutate -- CSRF is checked once,
|
|
13
|
+
before the path is even parsed, matching the pre-split handler's ordering).
|
|
14
|
+
|
|
15
|
+
Reads collectors' tracker CRUD, which itself reads config.X live via
|
|
16
|
+
`import config` -- see ui/CLAUDE.md load-bearing rule.
|
|
17
|
+
"""
|
|
18
|
+
import json
|
|
19
|
+
|
|
20
|
+
from . import validate_mutation
|
|
21
|
+
from collectors import (create_tracker_item, delete_tracker_item,
|
|
22
|
+
get_tracker_items, update_tracker_item)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def list_items(status=None, priority=None):
|
|
26
|
+
"""GET /api/tracker -- list items with optional status/priority filters.
|
|
27
|
+
|
|
28
|
+
Returns:
|
|
29
|
+
(200, items_list) on success.
|
|
30
|
+
(500, error_dict) on failure.
|
|
31
|
+
"""
|
|
32
|
+
try:
|
|
33
|
+
items = get_tracker_items(status=status, priority=priority)
|
|
34
|
+
return 200, items
|
|
35
|
+
except Exception as e:
|
|
36
|
+
return 500, {"error": str(e)}
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def create(headers, body_bytes):
|
|
40
|
+
"""POST /api/tracker -- create a tracker item. CSRF-gated.
|
|
41
|
+
|
|
42
|
+
Args:
|
|
43
|
+
headers: request headers (case-insensitive dict-like).
|
|
44
|
+
body_bytes: raw request body already read + bounded by the caller.
|
|
45
|
+
|
|
46
|
+
Returns:
|
|
47
|
+
(201, item_dict) on success.
|
|
48
|
+
(403, error_dict) on CSRF failure.
|
|
49
|
+
(400, error_dict) on invalid Content-Length or invalid JSON.
|
|
50
|
+
(500, error_dict) on any other failure.
|
|
51
|
+
"""
|
|
52
|
+
try:
|
|
53
|
+
ok, result = validate_mutation(headers, body_bytes)
|
|
54
|
+
if not ok:
|
|
55
|
+
status, error = result
|
|
56
|
+
return status, error
|
|
57
|
+
item = create_tracker_item(result)
|
|
58
|
+
return 201, item
|
|
59
|
+
except json.JSONDecodeError:
|
|
60
|
+
return 400, {"error": "Invalid JSON"}
|
|
61
|
+
except Exception as e:
|
|
62
|
+
return 500, {"error": str(e)}
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def update(item_id, body_bytes):
|
|
66
|
+
"""POST /api/tracker/<id> (default action) -- update a tracker item.
|
|
67
|
+
|
|
68
|
+
CSRF must already have been validated by the caller before invoking this
|
|
69
|
+
(see ui/handler.py's handle_tracker_mutate: CSRF is checked once up front,
|
|
70
|
+
shared with the delete branch). This function only handles JSON parse +
|
|
71
|
+
the update itself, matching the pre-split handler's behavior where a
|
|
72
|
+
malformed JSON body on this path falls through to a generic error rather
|
|
73
|
+
than a dedicated "Invalid JSON" 400 (unlike create()).
|
|
74
|
+
|
|
75
|
+
Args:
|
|
76
|
+
item_id: tracker item id extracted from the URL path by the caller.
|
|
77
|
+
body_bytes: raw request body already read + bounded by the caller.
|
|
78
|
+
|
|
79
|
+
Returns:
|
|
80
|
+
(200, item_dict) on success.
|
|
81
|
+
(404, error_dict) if item_id is unknown.
|
|
82
|
+
(500, error_dict) on any other failure (including malformed JSON --
|
|
83
|
+
preserves the pre-split handler's behavior).
|
|
84
|
+
"""
|
|
85
|
+
try:
|
|
86
|
+
body_str = (body_bytes or b'').decode('utf-8', errors='ignore')
|
|
87
|
+
update_data = json.loads(body_str)
|
|
88
|
+
item = update_tracker_item(item_id, update_data)
|
|
89
|
+
return 200, item
|
|
90
|
+
except Exception as e:
|
|
91
|
+
if "404" in str(e):
|
|
92
|
+
return 404, {"error": str(e)}
|
|
93
|
+
return 500, {"error": str(e)}
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
def delete(item_id):
|
|
97
|
+
"""POST /api/tracker/<id>?action=delete -- soft-delete (archive) an item.
|
|
98
|
+
|
|
99
|
+
CSRF must already have been validated by the caller before invoking this
|
|
100
|
+
(see update()'s docstring -- same shared up-front check).
|
|
101
|
+
|
|
102
|
+
Idempotent: deleting an already-archived item succeeds again (re-sets
|
|
103
|
+
status to "archived"), it does not error.
|
|
104
|
+
|
|
105
|
+
Returns:
|
|
106
|
+
(200, item_dict) on success.
|
|
107
|
+
(404, error_dict) if item_id is unknown.
|
|
108
|
+
(500, error_dict) on any other failure.
|
|
109
|
+
"""
|
|
110
|
+
try:
|
|
111
|
+
item = delete_tracker_item(item_id)
|
|
112
|
+
return 200, item
|
|
113
|
+
except Exception as e:
|
|
114
|
+
if "404" in str(e):
|
|
115
|
+
return 404, {"error": str(e)}
|
|
116
|
+
return 500, {"error": str(e)}
|