env: session-scoped env via -e flag; remove daemon-global env export

- s/sh: add -e VAR1,VAR2 flag to inject named vars from frontend env
  into session spec as env.NAME=VALUE lines
- s/sh: remove $MOUNT/env export loop (global env file removed)
- Bump core and 9p submodules

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Levi Neely 2026-04-18 19:02:35 +02:00
parent 72eeff473a
commit ed2316c2d0
3 changed files with 12 additions and 8 deletions

2
9p

@ -1 +1 @@
Subproject commit eef8ccecd93aa4c5a0ec604257cb22d3eaef68eb
Subproject commit 0c585b4346c40275e47adedc554d75e579e990db

2
core

@ -1 +1 @@
Subproject commit 44bff71a65da2b5703b10c70d122c30c67c53115
Subproject commit 97e453d453a5ddf21594764c35acf70278959070

View File

@ -43,6 +43,7 @@ Flags:
-backend BACKEND backend override (e.g. ollama, anthropic)
-model MODEL model override
-agent AGENT agent config name
-e VAR1,VAR2 inject env vars from this shell into the session
-help show this help
Input at the prompt:
@ -69,7 +70,7 @@ EOF
# Parse flags
new=0; resume=0; id_flag=; name=
backend=; model=; agent=; cwd=
backend=; model=; agent=; cwd=; env=
while [ $# -gt 0 ]; do
case $1 in
-new) new=1 ;;
@ -80,6 +81,7 @@ while [ $# -gt 0 ]; do
-model) model=$2; shift ;;
-agent) agent=$2; shift ;;
-cwd) cwd=$2; shift ;;
-e) env=$2; shift ;;
-help) usage ;;
*) die "unknown flag: $1" ;;
esac
@ -94,6 +96,13 @@ write_new() {
[ -n "$backend" ] && printf 'backend=%s\n' "$backend"
[ -n "$model" ] && printf 'model=%s\n' "$model"
[ -n "$agent" ] && printf 'agent=%s\n' "$agent"
if [ -n "$env" ]; then
IFS=, read -ra _vars <<< "$env"
for _v in "${_vars[@]}"; do
eval "_val=\$$_v"
[ -n "$_val" ] && printf 'env.%s=%s\n' "$_v" "$_val"
done
fi
true
} > "$MOUNT/s/new" || die "write s/new"
}
@ -145,11 +154,6 @@ fi
S=$MOUNT/s/$id
chat_off=$(wc -c < "$S/chat" 2>/dev/null || echo 0)
# Export daemon environment to this shell.
while IFS='=' read -r k v; do
[ -n "$k" ] && export "$k=$v"
done < "$MOUNT/env" 2>/dev/null || true
trap '
[ "$(tr -d "[:space:]" < "$S/state" 2>/dev/null)" = "idle" ] && exit
printf "\n" >&2; printf "stop\n" > "$S/ctl"