feat: v2.7.8 — Artifacts hub, clone related repos as extra folders, quieter resume prompt
- Artifacts (/artifacts): claude.ai pages sessions publish (captured from the Artifact tool's hook), pinned workspace files, skills and plugins, each kept as a snapshot; shared ones appear in a Hub and a skill or plugin installs into the viewer's own account (server/lib/artifacts.js, /api/artifacts, docs/plans/artifacts/). - Workspace extra folders: clone one or more related repos beside the workspace and add them in one step (POST /api/lanes/:id/sources/clone). - A pane that ended by itself while tmux kept running is no longer offered for resume (tmux.serverStartedAt in reconcileOrphans). - Changes panel: a folder that is not a git repo opens on Files, and its files open from there. - Plus the parallel sessions' work in this tree: File Explorer button in the panel header, user delete, RSA SSH keys, chat/terminal and pet fixes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -7,11 +7,16 @@
|
||||
# agenthub-provision create <name> Linux user ah-<name>, home <USERS_ROOT>/<name>
|
||||
# agenthub-provision disable <name> lock the account and end its processes
|
||||
# agenthub-provision enable <name> unlock it
|
||||
# agenthub-provision delete <name> end its processes, remove the account
|
||||
# and its home <USERS_ROOT>/<name>
|
||||
#
|
||||
# Nothing but an action and a name comes from the caller; every path comes
|
||||
# from /etc/agenthub/server.conf (root's). It never deletes an account or a
|
||||
# home, never touches an account that is not an AgentHub member (one that
|
||||
# already exists outside group agenthub-members is refused), and never
|
||||
# from /etc/agenthub/server.conf (root's). It deletes only on `delete` (an
|
||||
# admin's step-up-confirmed "Delete user" on the Users page): only an AgentHub
|
||||
# member's account, and only the home at exactly <USERS_ROOT>/<name> — a real
|
||||
# directory, never a link, removed without following links or leaving its
|
||||
# filesystem. It never touches an account that is not an AgentHub member (one
|
||||
# that already exists outside group agenthub-members is refused), and never
|
||||
# grants a member sudo.
|
||||
# @author Nguyễn Ngọc Trí Vĩ <vinnt@smartgift.vn>
|
||||
set -euo pipefail
|
||||
@@ -20,7 +25,7 @@ cd / # runuser keeps the cwd: one every account may enter
|
||||
|
||||
die() { echo "agenthub-provision: $*" >&2; exit "${2:-1}"; }
|
||||
[ "$(id -u)" = 0 ] || die "must run as root (through sudo)"
|
||||
[ $# -eq 2 ] || die "usage: agenthub-provision create|disable|enable <name>" 2
|
||||
[ $# -eq 2 ] || die "usage: agenthub-provision create|disable|enable|delete <name>" 2
|
||||
|
||||
CONF=/etc/agenthub/server.conf
|
||||
[ -f "$CONF" ] || die "$CONF is missing — run agenthub server install-system first"
|
||||
@@ -84,5 +89,30 @@ case "$ACTION" in
|
||||
usermod --unlock "$LOGIN" >/dev/null 2>&1 || true
|
||||
echo "enabled $LOGIN"
|
||||
;;
|
||||
delete)
|
||||
if id "$LOGIN" >/dev/null 2>&1; then
|
||||
is_member || die "$LOGIN is not an AgentHub member — refusing to delete it" 4
|
||||
# Locked first, so nothing new starts while its processes are ended.
|
||||
usermod --lock --expiredate 1 "$LOGIN"
|
||||
for _ in 1 2 3; do
|
||||
pkill -KILL -u "$LOGIN" 2>/dev/null || true
|
||||
pgrep -u "$LOGIN" >/dev/null 2>&1 || break
|
||||
sleep 1
|
||||
done
|
||||
userdel "$LOGIN"
|
||||
# Its own user group, if userdel left it and nobody else is in it.
|
||||
if getent group "$LOGIN" >/dev/null 2>&1; then groupdel "$LOGIN" 2>/dev/null || true; fi
|
||||
fi
|
||||
if [ -e "$HOME_DIR" ] || [ -L "$HOME_DIR" ]; then
|
||||
# Exactly <USERS_ROOT>/<name>: a real directory sitting directly in the
|
||||
# (root-owned) users root — never a link a member planted elsewhere.
|
||||
[ -d "$HOME_DIR" ] && [ ! -L "$HOME_DIR" ] || die "$HOME_DIR is not a plain directory" 5
|
||||
ROOT_REAL=$(realpath -e "$USERS_ROOT")
|
||||
[ "$(realpath -e "$HOME_DIR")" = "$ROOT_REAL/$NAME" ] || die "$HOME_DIR resolves elsewhere" 5
|
||||
# rm never follows a link it removes; --one-file-system stays on this disk.
|
||||
rm -rf --one-file-system -- "$HOME_DIR"
|
||||
fi
|
||||
echo "deleted $LOGIN $HOME_DIR"
|
||||
;;
|
||||
*) die "unknown action: $ACTION" 2 ;;
|
||||
esac
|
||||
|
||||
Reference in New Issue
Block a user