chore: snapshot working tree - pty_exited notifications + in-flight inference WIP
feat(booterm): structured pty_exited WS notifications. Plan-validated, impl-validated, code-reviewed green (contracts build clean, contracts test 29/29, booterm + web typecheck clean). wip: in-progress inference/provider refactor (agents.ts, provider.ts, new llama-providers.ts, removed llama-args-validator), plus arena, dispatcher, compaction, schema changes. openspec: pty-exit-notifications complete; x-agent-flags planned (not yet implemented).
This commit is contained in:
46
apps/control/remote/boocontrol-edit.ps1
Normal file
46
apps/control/remote/boocontrol-edit.ps1
Normal file
@@ -0,0 +1,46 @@
|
||||
# BooControl forced-command wrapper (sam-desktop / Windows).
|
||||
#
|
||||
# Bound to the BooControl SSH key via authorized_keys:
|
||||
# command="powershell -NoProfile -ExecutionPolicy Bypass -File D:\llama-swap\boocontrol-edit.ps1",restrict ssh-ed25519 AAAA... boocontrol@sam-desktop
|
||||
#
|
||||
# The key can do NOTHING but the verbs below, all hardcoded to D:\llama-swap and
|
||||
# D:\models. The only client-supplied value is the HF repo id, regex-validated.
|
||||
# Place this file at D:\llama-swap\boocontrol-edit.ps1.
|
||||
|
||||
$ErrorActionPreference = 'Stop'
|
||||
$cfg = 'D:\llama-swap\config.yaml'
|
||||
$models = 'D:\models'
|
||||
$service = 'llama-swap' # nssm service name
|
||||
|
||||
$parts = ($env:SSH_ORIGINAL_COMMAND ?? '') -split ' ', 2
|
||||
$verb = $parts[0]
|
||||
$arg = if ($parts.Count -gt 1) { $parts[1].Trim() } else { '' }
|
||||
|
||||
switch ($verb) {
|
||||
'read' {
|
||||
if (Test-Path $cfg) { Get-Content -Raw $cfg } else { '' }
|
||||
}
|
||||
'backup' {
|
||||
$stamp = Get-Date -Format 'yyyyMMddTHHmmssZ'
|
||||
Copy-Item $cfg "$cfg.bak-$stamp"
|
||||
Write-Output "$cfg.bak-$stamp"
|
||||
}
|
||||
'write' {
|
||||
$in = [Console]::In.ReadToEnd()
|
||||
Set-Content -Path $cfg -Value $in -NoNewline
|
||||
}
|
||||
'restart' {
|
||||
nssm restart $service
|
||||
}
|
||||
'pull' {
|
||||
if ($arg -notmatch '^[A-Za-z0-9][A-Za-z0-9._-]*/[A-Za-z0-9][A-Za-z0-9._-]*$') {
|
||||
Write-Error "bad repo id: $arg"; exit 1
|
||||
}
|
||||
$dest = Join-Path $models ($arg -replace '/', '__')
|
||||
# arg is regex-validated to org/name with no spaces/metacharacters.
|
||||
huggingface-cli download $arg --local-dir $dest
|
||||
}
|
||||
default {
|
||||
Write-Error "denied: $verb"; exit 1
|
||||
}
|
||||
}
|
||||
43
apps/control/remote/boocontrol-edit.sh
Normal file
43
apps/control/remote/boocontrol-edit.sh
Normal file
@@ -0,0 +1,43 @@
|
||||
#!/usr/bin/env bash
|
||||
# BooControl forced-command wrapper (embedding / Linux).
|
||||
#
|
||||
# Bound to the BooControl SSH key via authorized_keys:
|
||||
# command="/home/samkintop/llama-swap/boocontrol-edit.sh",restrict ssh-ed25519 AAAA... boocontrol@embedding
|
||||
#
|
||||
# The key can do NOTHING but the verbs below, all hardcoded to
|
||||
# /home/samkintop/llama-swap and /home/samkintop/models. The only client-supplied
|
||||
# value is the HF repo id, regex-validated. Place at the path above and chmod +x.
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
CFG=/home/samkintop/llama-swap/config.yaml
|
||||
MODELS=/home/samkintop/models
|
||||
SERVICE=llama-swap # systemctl --user unit name
|
||||
|
||||
read -r verb arg <<<"${SSH_ORIGINAL_COMMAND:-}"
|
||||
|
||||
case "$verb" in
|
||||
read)
|
||||
[ -f "$CFG" ] && cat "$CFG" || true
|
||||
;;
|
||||
backup)
|
||||
bak="$CFG.bak-$(date -u +%Y%m%dT%H%M%SZ)"
|
||||
cp "$CFG" "$bak"
|
||||
echo "$bak"
|
||||
;;
|
||||
write)
|
||||
cat > "$CFG"
|
||||
;;
|
||||
restart)
|
||||
systemctl --user restart "$SERVICE"
|
||||
;;
|
||||
pull)
|
||||
if [[ ! "$arg" =~ ^[A-Za-z0-9][A-Za-z0-9._-]*/[A-Za-z0-9][A-Za-z0-9._-]*$ ]]; then
|
||||
echo "bad repo id: $arg" >&2; exit 1
|
||||
fi
|
||||
huggingface-cli download "$arg" --local-dir "$MODELS/${arg//\//__}"
|
||||
;;
|
||||
*)
|
||||
echo "denied: $verb" >&2; exit 1
|
||||
;;
|
||||
esac
|
||||
Reference in New Issue
Block a user