@flame0510/project-aether 1.6.2 → 1.7.0
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/LICENSE +21 -0
- package/README.md +5 -2
- package/agent-templates/atlas/HEARTBEAT.md +1 -1
- package/app/agents/ImageDownloadBanner.tsx +171 -37
- package/app/api/agents/download-image/route.ts +29 -5
- package/app/api/agents/image-status/route.ts +17 -2
- package/app/api/assistant/route.ts +13 -4
- package/app/api/auth/login/route.ts +2 -2
- package/app/api/setup/agent-image/route.ts +6 -4
- package/app/api/system-health/route.ts +3 -3
- package/app/components/DashboardToolbar.tsx +2 -2
- package/app/components/LineageGraphPage.tsx +4 -4
- package/app/components/SessionDrawer.tsx +8 -8
- package/app/components/SystemCockpit.tsx +1 -1
- package/app/globals.css +1 -1
- package/app/setup/PageClient.tsx +1 -1
- package/bin/postinstall.js +5 -1
- package/daemon.js +13 -34
- package/docs/ARCHITECTURE.md +44 -26
- package/docs/CONTAINER-TERMINAL.md +17 -8
- package/docs/DESIGN-SYSTEM.md +21 -12
- package/docs/FRONTEND-ARCHITECTURE.md +2 -2
- package/docs/REV4A.md +35 -85
- package/docs/dev/API-REFERENCE.md +73 -19
- package/docs/dev/DATABASE.md +18 -7
- package/docs/dev/SESSION-MAINTENANCE-PLAN.md +6 -6
- package/docs/rag/DATA-FRESHNESS.md +20 -9
- package/docs/rag/GLOSSARY.md +2 -2
- package/docs/rag/REV4A-OVERVIEW.md +10 -6
- package/docs/rag/WHAT-I-CAN-ANSWER.md +3 -3
- package/lib/agent-images.ts +43 -14
- package/lib/buildAgentImage.ts +142 -6
- package/lib/patterns/sessionPresentation.ts +4 -2
- package/lib/rev4a-auth.d.ts +1 -0
- package/lib/rev4a-auth.js +18 -2
- package/next.config.mjs +9 -1
- package/package.json +2 -2
- package/scripts/backup.sh +48 -54
- package/scripts/check-language.mjs +21 -3
- package/scripts/restore.sh +77 -59
package/scripts/restore.sh
CHANGED
|
@@ -1,82 +1,100 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
|
-
# restore.sh —
|
|
2
|
+
# restore.sh — restore Rev4a's data directory from a backup.sh archive
|
|
3
3
|
#
|
|
4
4
|
# Usage:
|
|
5
|
-
#
|
|
5
|
+
# bash scripts/restore.sh ~/rev4a-backups/rev4a-backup-20260926-120000.tar.gz
|
|
6
6
|
#
|
|
7
|
-
#
|
|
8
|
-
#
|
|
9
|
-
#
|
|
10
|
-
# - data/agents-token.json
|
|
11
|
-
# - models.config.json
|
|
12
|
-
# - .env
|
|
7
|
+
# Restores into $REV4A_DATA_DIR when set, otherwise ~/.config/rev4a — the directory
|
|
8
|
+
# backup.sh archived. Run it as the user Rev4a runs as: under `sudo` HOME becomes /root
|
|
9
|
+
# and REV4A_DATA_DIR is dropped, so pass it explicitly (`sudo REV4A_DATA_DIR=… bash …`).
|
|
13
10
|
#
|
|
14
|
-
#
|
|
11
|
+
# The data directory is replaced as a whole, not overwritten file by file: a file the
|
|
12
|
+
# backup does not have (a leftover SQLite -wal, for one) would otherwise be mixed into
|
|
13
|
+
# the restored state. The current contents are archived first into ~/rev4a-backups, so a
|
|
14
|
+
# restore can itself be undone.
|
|
15
|
+
#
|
|
16
|
+
# Rev4a must not be running. When the rev4a systemd service is active it is stopped (and
|
|
17
|
+
# must be started again afterwards); a `rev4a serve` started any other way makes the
|
|
18
|
+
# script refuse until it is stopped.
|
|
15
19
|
set -euo pipefail
|
|
16
20
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
21
|
+
DATA_DIR="${REV4A_DATA_DIR:-${HOME}/.config/rev4a}"
|
|
22
|
+
PRE_DIR="${HOME}/rev4a-backups"
|
|
20
23
|
ARCHIVE="${1:-}"
|
|
21
24
|
|
|
22
25
|
if [[ -z "$ARCHIVE" ]]; then
|
|
23
|
-
echo "Usage:
|
|
26
|
+
echo "Usage: bash scripts/restore.sh <rev4a-backup-….tar.gz>"
|
|
24
27
|
echo ""
|
|
25
|
-
echo "
|
|
26
|
-
|
|
27
|
-
ls -lh "${REV4A_ROOT}/backups/"*.tar.gz 2>/dev/null || echo " (none)"
|
|
28
|
-
else
|
|
29
|
-
echo " (no backups directory)"
|
|
30
|
-
fi
|
|
28
|
+
echo "Backups in ~/rev4a-backups:"
|
|
29
|
+
ls -lh "${HOME}/rev4a-backups/"rev4a-backup-*.tar.gz 2>/dev/null || echo " (none)"
|
|
31
30
|
exit 1
|
|
32
31
|
fi
|
|
33
|
-
|
|
34
32
|
if [[ ! -f "$ARCHIVE" ]]; then
|
|
35
|
-
echo "Error:
|
|
33
|
+
echo "Error: archive not found: $ARCHIVE" >&2
|
|
36
34
|
exit 1
|
|
37
35
|
fi
|
|
36
|
+
if [[ ! -d "$DATA_DIR" ]]; then
|
|
37
|
+
# Restoring into a directory nothing reads would "succeed" and change nothing. On a new
|
|
38
|
+
# machine, create it first — the check is only there to catch a wrong path.
|
|
39
|
+
echo "Error: Rev4a data directory not found: $DATA_DIR" >&2
|
|
40
|
+
echo "Set REV4A_DATA_DIR to the directory Rev4a uses, or create it first on a new machine." >&2
|
|
41
|
+
exit 1
|
|
42
|
+
fi
|
|
43
|
+
# The real directory: when the path is a symlink, the swap below replaces its target.
|
|
44
|
+
DATA_DIR="$(cd "$DATA_DIR" && pwd -P)"
|
|
38
45
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
done
|
|
46
|
+
# Refuse an archive that is not a backup.sh archive of a Rev4a data directory. The listing
|
|
47
|
+
# is read whole: `grep -q` would stop reading early and, with pipefail, turn tar's SIGPIPE
|
|
48
|
+
# into a false refusal on large archives.
|
|
49
|
+
LISTING="$(tar -tvzf "$ARCHIVE")"
|
|
50
|
+
if ! grep -E '[[:space:]]\./(\.env|data/)' <<<"$LISTING" >/dev/null; then
|
|
51
|
+
echo "Error: $ARCHIVE does not look like a Rev4a data backup (no .env or data/ inside)." >&2
|
|
52
|
+
exit 1
|
|
53
|
+
fi
|
|
54
|
+
# backup.sh never stores links; a link in the archive could point outside the data directory.
|
|
55
|
+
if grep -E '^[lh]' <<<"$LISTING" >/dev/null; then
|
|
56
|
+
echo "Error: $ARCHIVE contains symbolic or hard links — refusing to restore it." >&2
|
|
57
|
+
exit 1
|
|
58
|
+
fi
|
|
53
59
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
60
|
+
if command -v systemctl >/dev/null 2>&1 && systemctl is-active --quiet rev4a.service 2>/dev/null; then
|
|
61
|
+
echo "Stopping rev4a.service..."
|
|
62
|
+
systemctl stop rev4a.service
|
|
63
|
+
STOPPED=1
|
|
64
|
+
fi
|
|
65
|
+
if pgrep -f 'rev4a(\.js)? serve' >/dev/null 2>&1; then
|
|
66
|
+
echo "Error: Rev4a is running (rev4a serve). Stop it first: it keeps the databases open." >&2
|
|
67
|
+
exit 1
|
|
59
68
|
fi
|
|
60
69
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
70
|
+
umask 077
|
|
71
|
+
mkdir -p "$PRE_DIR"
|
|
72
|
+
PRE="${PRE_DIR}/rev4a-pre-restore-$(date -u +%Y%m%d-%H%M%S).tar.gz"
|
|
73
|
+
echo "Archiving the current state first: $PRE"
|
|
74
|
+
set -o noclobber
|
|
75
|
+
tar -C "$DATA_DIR" -czf - . > "$PRE"
|
|
76
|
+
set +o noclobber
|
|
77
|
+
chmod 600 "$PRE"
|
|
64
78
|
|
|
65
|
-
#
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
79
|
+
# Extract next to the data directory, then swap: a failed extraction leaves the current
|
|
80
|
+
# data untouched, and nothing from the current state survives into the restored one.
|
|
81
|
+
PARENT="$(dirname "$DATA_DIR")"
|
|
82
|
+
STAGE="$(mktemp -d "${PARENT}/.rev4a-restore.XXXXXX")"
|
|
83
|
+
trap 'rm -rf "$STAGE"' EXIT
|
|
84
|
+
echo "Restoring into: $DATA_DIR"
|
|
85
|
+
tar -C "$STAGE" --no-same-owner -xzf "$ARCHIVE"
|
|
86
|
+
find "$STAGE" -type d -exec chmod 700 {} +
|
|
87
|
+
[[ -f "$STAGE/.env" ]] && chmod 600 "$STAGE/.env"
|
|
88
|
+
[[ -d "$STAGE/data" ]] && find "$STAGE/data" -type f -exec chmod 600 {} +
|
|
89
|
+
|
|
90
|
+
OLD="${PARENT}/.rev4a-replaced.$$"
|
|
91
|
+
mv "$DATA_DIR" "$OLD"
|
|
92
|
+
mv "$STAGE" "$DATA_DIR"
|
|
93
|
+
trap - EXIT
|
|
94
|
+
rm -rf "$OLD"
|
|
69
95
|
|
|
70
96
|
echo ""
|
|
71
|
-
echo "
|
|
72
|
-
echo "
|
|
73
|
-
echo "
|
|
74
|
-
|
|
75
|
-
echo " Previous state saved to: ${PRE_DIR}"
|
|
76
|
-
echo ""
|
|
77
|
-
echo " To restart Rev4a:"
|
|
78
|
-
echo " sudo systemctl start rev4a.service"
|
|
79
|
-
echo ""
|
|
80
|
-
echo " If something went wrong, restore previous state from:"
|
|
81
|
-
echo " ${PRE_DIR}"
|
|
82
|
-
echo "=============================================="
|
|
97
|
+
echo "Restore complete."
|
|
98
|
+
echo "The previous state is in: $PRE"
|
|
99
|
+
[[ -n "${STOPPED:-}" ]] && echo "Start Rev4a again: systemctl start rev4a.service"
|
|
100
|
+
exit 0
|