mirror of
https://github.com/getcompanion-ai/computer-guest.git
synced 2026-04-15 06:04:38 +00:00
* feat: add Firecracker API client methods for VM pause/resume and snapshots
Add PatchVm, GetVm, PutSnapshotCreate, and PutSnapshotLoad methods to the
API client, along with supporting types (VmState, SnapshotCreateParams,
SnapshotLoadParams, MemBackend).
* feat: add snapshot data layer - contract types, model, store, config
Add SnapshotID and snapshot contract types, SnapshotRecord model,
store interface CRUD methods with file store implementation,
snapshot paths helper, SnapshotsDir config, and directory creation.
* feat: add runtime methods for VM pause, resume, snapshot, and restore
Implement Pause, Resume, CreateSnapshot, and RestoreBoot on the
firecracker Runtime. RestoreBoot launches a jailer, stages snapshot
files into the chroot, loads the snapshot, and resumes the VM.
* feat: add daemon snapshot create, restore, and reconciliation logic
Implement CreateSnapshot (pause, snapshot, COW-copy disk, resume),
RestoreSnapshot (COW-copy disk, RestoreBoot, wait for guest),
GetSnapshot, ListSnapshots, DeleteSnapshotByID, and crash recovery
reconciliation for snapshot and restore operations.
* feat: add HTTP endpoints for snapshot create, get, list, delete, restore
Wire 5 snapshot routes: POST /machines/{id}/snapshots (create),
GET /machines/{id}/snapshots (list), GET /snapshots/{id} (get),
DELETE /snapshots/{id} (delete), POST /snapshots/{id}/restore (restore).
* fix: cross-device rename, restore network, and snapshot cleanup
- Replace os.Rename with copy+remove for moving snapshot files out of
/proc/<pid>/root/ (cross-device link error on Linux)
- Reconfigure network interface after snapshot load so the restored VM
uses its own tap device instead of the source VM's
- Clean partial snapshot dirs immediately on failure instead of only
via reconcile
- Reject snapshot requests while a machine operation is already pending
* fix: test and modify snapshot runtime
* feat: snapshot lifecycle update, align runtime issues between host image
and daemon
79 lines
2.2 KiB
Bash
79 lines
2.2 KiB
Bash
HISTFILE="${HOME}/.zsh_history"
|
|
HISTSIZE=50000
|
|
SAVEHIST=50000
|
|
|
|
setopt append_history
|
|
setopt extended_history
|
|
setopt hist_ignore_all_dups
|
|
setopt hist_reduce_blanks
|
|
setopt share_history
|
|
setopt prompt_subst
|
|
|
|
bindkey -v
|
|
bindkey '^?' backward-delete-char
|
|
|
|
computer_prompt_base_name() {
|
|
local name=""
|
|
if [ -r /etc/microagent/machine-name ]; then
|
|
IFS= read -r name </etc/microagent/machine-name || true
|
|
elif [ -r /etc/hostname ]; then
|
|
IFS= read -r name </etc/hostname || true
|
|
elif [ -n "${COMPUTER_NAME:-}" ]; then
|
|
name="${COMPUTER_NAME}"
|
|
elif [ -n "${COMPUTER_HANDLE:-}" ]; then
|
|
name="${COMPUTER_HANDLE}"
|
|
fi
|
|
if [ -z "$name" ]; then
|
|
name="microagentcomputer"
|
|
fi
|
|
printf '%s' "$name"
|
|
}
|
|
|
|
computer_prompt_name() {
|
|
printf '%s' "$(computer_prompt_base_name)"
|
|
}
|
|
|
|
ZSH_CACHE_DIR="${XDG_CACHE_HOME:-$HOME/.cache}/zsh"
|
|
export ZSH_COMPDUMP="${ZSH_COMPDUMP:-$ZSH_CACHE_DIR/.zcompdump}"
|
|
mkdir -p "$ZSH_CACHE_DIR" 2>/dev/null || true
|
|
|
|
autoload -Uz compinit
|
|
zmodload zsh/complist 2>/dev/null || true
|
|
if [ -s "$ZSH_COMPDUMP" ]; then
|
|
compinit -C -d "$ZSH_COMPDUMP"
|
|
else
|
|
compinit -d "$ZSH_COMPDUMP"
|
|
fi
|
|
|
|
export EDITOR="${EDITOR:-nvim}"
|
|
export VISUAL="${VISUAL:-nvim}"
|
|
alias vim='nvim'
|
|
alias vi='nvim'
|
|
alias ls='eza --group-directories-first --icons=auto'
|
|
alias la='eza -a --group-directories-first --icons=auto'
|
|
alias ll='eza -lah --git --group-directories-first --icons=auto'
|
|
alias lt='eza --tree --level=2 --group-directories-first --icons=auto'
|
|
|
|
if [ -r /usr/share/zsh-autosuggestions/zsh-autosuggestions.zsh ]; then
|
|
source /usr/share/zsh-autosuggestions/zsh-autosuggestions.zsh
|
|
fi
|
|
|
|
if [ -r /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh ]; then
|
|
source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
|
|
fi
|
|
|
|
if [ -r /opt/zsh/pure/pure.zsh ] && [ -r /opt/zsh/pure/async.zsh ]; then
|
|
fpath=(/opt/zsh/pure $fpath)
|
|
autoload -Uz promptinit
|
|
promptinit
|
|
if prompt pure >/dev/null 2>&1; then
|
|
prompt_pure_context() { :; }
|
|
zstyle ':prompt:pure:path' color blue
|
|
pure_prompt="$PROMPT"
|
|
PROMPT='%F{green}$(computer_prompt_name)%f '"$pure_prompt"
|
|
else
|
|
PROMPT='%F{green}$(computer_prompt_name)%f %F{blue}%~%f %# '
|
|
fi
|
|
else
|
|
PROMPT='%F{green}$(computer_prompt_name)%f %F{blue}%~%f %# '
|
|
fi
|