@@ -134,12 +134,12 @@ lookup_default() {
134134 redact_repo_visibility) echo " " ;; # empty → fall through to gh/glab detection
135135 redact_prepush_hook) echo " false" ;;
136136 # Brain-aware planning (v1.48 / T5+T10+T16). Defaults documented inline:
137- # brain_trust_policy@<hash > — unset on fresh install; setup-gbrain
137+ # brain_trust_policy@<endpoint-id > — unset on fresh install; setup-gbrain
138138 # writes 'personal' for local engines,
139139 # asks the user for remote-ambiguous.
140140 # salience_allowlist — empty falls through to
141141 # SALIENCE_DEFAULT_ALLOWLIST (D9).
142- # user_slug_at_<hash> — empty triggers resolve-user-slug
142+ # user_slug_at_<endpoint-id> — empty triggers resolve-user-slug
143143 # fallback chain (D4 A3) on first call.
144144 brain_trust_policy* ) echo " unset" ;;
145145 salience_allowlist) echo " " ;;
@@ -260,14 +260,16 @@ resolve_user_slug() {
260260case " ${1:- } " in
261261 get)
262262 KEY=" ${2:? Usage: gstack-config get <key>} "
263- # Validate key (alphanumeric + underscore + optional @<hash> suffix for
264- # endpoint-namespaced keys introduced by the brain-aware planning layer)
265- if ! printf ' %s' " $KEY " | grep -qE ' ^[a-zA-Z0-9_]+(@[a-f0-9]+)?$' ; then
266- echo " Error: key must contain only alphanumeric characters, underscores, and an optional @<hex-hash> suffix" >&2
263+ # Validate key (alphanumeric + underscore + optional @<endpoint-id> suffix for
264+ # endpoint-namespaced keys introduced by the brain-aware planning layer).
265+ # Endpoint ids are sha8/sha16 hex for remote MCP URLs, or the literal
266+ # "local" for stdio/PGLite engines (see endpoint_hash).
267+ if ! printf ' %s' " $KEY " | grep -qE ' ^[a-zA-Z0-9_]+(@[a-zA-Z0-9]+)?$' ; then
268+ echo " Error: key must contain only alphanumeric characters, underscores, and an optional @<endpoint-id> suffix" >&2
267269 exit 1
268270 fi
269- # Use literal match for keys containing @ (sha hashes ), regex otherwise
270- VALUE=$( grep -F " ${KEY} :" " $CONFIG_FILE " 2> /dev/null | grep -E " ^${KEY%@* } (@[a-f0 -9]+)?:" | grep -F " ${KEY} :" | tail -1 | awk ' {print $2}' | tr -d ' [:space:]' || true)
271+ # Use literal match for keys containing @ (endpoint ids ), regex otherwise
272+ VALUE=$( grep -F " ${KEY} :" " $CONFIG_FILE " 2> /dev/null | grep -E " ^${KEY%@* } (@[a-zA-Z0 -9]+)?:" | grep -F " ${KEY} :" | tail -1 | awk ' {print $2}' | tr -d ' [:space:]' || true)
271273 if [ -z " $VALUE " ]; then
272274 VALUE=$( lookup_default " $KEY " )
273275 fi
@@ -276,9 +278,10 @@ case "${1:-}" in
276278 set)
277279 KEY=" ${2:? Usage: gstack-config set <key> <value>} "
278280 VALUE=" ${3:? Usage: gstack-config set <key> <value>} "
279- # Validate key (alphanumeric + underscore + optional @<hash> suffix)
280- if ! printf ' %s' " $KEY " | grep -qE ' ^[a-zA-Z0-9_]+(@[a-f0-9]+)?$' ; then
281- echo " Error: key must contain only alphanumeric characters, underscores, and an optional @<hex-hash> suffix" >&2
281+ # Validate key (alphanumeric + underscore + optional @<endpoint-id> suffix).
282+ # Accepts hex hashes and the literal "local" from endpoint_hash.
283+ if ! printf ' %s' " $KEY " | grep -qE ' ^[a-zA-Z0-9_]+(@[a-zA-Z0-9]+)?$' ; then
284+ echo " Error: key must contain only alphanumeric characters, underscores, and an optional @<endpoint-id> suffix" >&2
282285 exit 1
283286 fi
284287 # Validate brain_trust_policy value domain (D4 / D11)
0 commit comments