Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
5136899
feat(dual-impl): Phase 1 — types, worktree, parser dualImpl stamp
anbangr Apr 28, 2026
89471da
fix(dual-impl): Phase 1 post-review fixes — align WorktreePair field …
anbangr Apr 28, 2026
29b0248
feat(dual-impl): Phase 2 — phase-runner state machine + ApplyResultExtra
anbangr Apr 28, 2026
cb35dc9
fix(dual-impl): Phase 2 post-review HIGH fixes — fail-closed on missi…
anbangr Apr 28, 2026
8f3701b
v1.16.0.0 feat: tunnel allowlist 17→26 + canDispatchOverTunnel pure f…
garrytan Apr 28, 2026
675717e
v1.17.0.0: setup-gbrain wireup ships the gbrain federation surface (#…
garrytan Apr 28, 2026
088d53d
fix(dual-impl): /review pass — maxBuffer 50MB + cleaner squashed-comm…
anbangr Apr 28, 2026
4c04f1d
feat(dual-impl): Phase 3 — sub-agents.ts (runCodexImpl, runJudgeOpus,…
anbangr Apr 28, 2026
e01da88
fix(dual-impl): Phase 3 post-review HIGH+MEDIUM+LOW fixes
anbangr Apr 28, 2026
73ef5b0
feat(dual-impl): Phase 4 — cli.ts dispatch handlers + --dual-impl flag
anbangr Apr 28, 2026
177b6b9
fix(dual-impl): Phase 4 post-review HIGH+MEDIUM fixes
anbangr Apr 28, 2026
7b08e15
feat(dual-impl): Phase 5 — README + SKILL.md.tmpl v1.15.0 + integrati…
anbangr Apr 28, 2026
368b689
docs(dual-impl): Phase 5 post-review LOW + MEDIUM fixes
anbangr Apr 28, 2026
fc33f98
fix(dual-impl): Codex /review pass — 3 P2/P3 findings fixed
anbangr Apr 28, 2026
619de3e
fix(sub-agents): mergeOutputFile empty-fallback — preserve verdict st…
anbangr Apr 28, 2026
bc33cdd
chore: merge upstream gstack v1.17.0.0 — gbrain wireup + tunnel allow…
anbangr Apr 28, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
145 changes: 142 additions & 3 deletions CHANGELOG.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ through `POST /pty-session` only.
**Transport-layer security** (v1.6.0.0+). When `pair-agent` starts an ngrok tunnel,
the daemon binds two HTTP listeners: a local listener (127.0.0.1, full command
surface, never forwarded) and a tunnel listener (locked allowlist: `/connect`,
`/command` with a scoped token + 17-command browser-driving allowlist,
`/command` with a scoped token + 26-command browser-driving allowlist,
`/sidebar-chat`). ngrok forwards only the tunnel port. Root tokens over the tunnel
return 403. SSE endpoints use a 30-minute HttpOnly `gstack_sse` cookie minted via
`POST /sse-session` (never valid against `/command`). Tunnel-surface rejections go
Expand Down
1 change: 1 addition & 0 deletions USING_GBRAIN_WITH_GSTACK.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ The skill re-collects a PAT (one-time, discarded after), lists every project in
| `gstack-gbrain-supabase-verify` | Structural URL check. Rejects direct-connection URLs (`db.*.supabase.co:5432`) with exit 3 |
| `gstack-gbrain-supabase-provision` | Management API wrapper. Subcommands: `list-orgs`, `create`, `wait`, `pooler-url`, `list-orphans`, `delete-project`. All require `SUPABASE_ACCESS_TOKEN` in env. `create` and `pooler-url` also require `DB_PASS`. `--json` mode available on every subcommand. |
| `gstack-gbrain-repo-policy` | Per-remote trust triad. Subcommands: `get`, `set`, `list`, `normalize` |
| `gstack-gbrain-source-wireup` | Registers your `~/.gstack/` brain repo with gbrain as a federated source via `gbrain sources add` + `git worktree`, then runs an initial `gbrain sync`. Idempotent. Replaces the dead `consumers.json + /ingest-repo` HTTP wireup from v1.12.x. Flags: `--strict`, `--source-id <id>`, `--no-pull`, `--uninstall`, `--probe`. |

### gbrain CLI (upstream tool)

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.15.0.0
1.17.0.0
5 changes: 5 additions & 0 deletions bin/gstack-brain-consumer
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
#!/usr/bin/env bash
# gstack-brain-consumer — manage the consumer (reader) registry.
#
# DEPRECATED in v1.17.0.0. This binary targets a gbrain HTTP /ingest-repo
# endpoint that never shipped on the gbrain side. Live federation now uses
# `gbrain sources` directly via bin/gstack-gbrain-source-wireup. This file
# stays for one cycle to avoid breaking external scripts; removal in v1.18.0.0.
#
# Consumer = a reader that ingests the gstack-brain git repo as a source of
# session memory. v1 primary consumer is GBrain; later versions can register
# Codex, OpenClaw, or third-party readers.
Expand Down
75 changes: 6 additions & 69 deletions bin/gstack-brain-init
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,16 @@
# 8. Prompt for remote (default: gh repo create --private gstack-brain-$USER)
# 9. Initial commit + push
# 10. Write ~/.gstack-brain-remote.txt (URL-only, safe to share)
# 11. Register GBrain consumer (HTTP POST if GBRAIN_URL set; else defer)
#
# Env:
# GSTACK_HOME — override ~/.gstack
# GBRAIN_URL — GBrain ingest endpoint base URL (for consumer registration)

set -euo pipefail

GSTACK_HOME="${GSTACK_HOME:-$HOME/.gstack}"
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
CONFIG_BIN="$SCRIPT_DIR/gstack-config"
REMOTE_FILE="$HOME/.gstack-brain-remote.txt"
CONSUMERS_FILE="$GSTACK_HOME/consumers.json"

REMOTE_URL=""
while [ $# -gt 0 ]; do
Expand Down Expand Up @@ -280,68 +277,6 @@ fi
echo "$REMOTE_URL" > "$REMOTE_FILE"
chmod 600 "$REMOTE_FILE"

# ---- register GBrain consumer ----
mkdir -p "$GSTACK_HOME"
CONSUMER_STATUS="pending"
GBRAIN_URL_VAL="${GBRAIN_URL:-$("$CONFIG_BIN" get gbrain_url 2>/dev/null || echo "")}"
GBRAIN_TOKEN_VAL="${GBRAIN_TOKEN:-$("$CONFIG_BIN" get gbrain_token 2>/dev/null || echo "")}"

if [ -n "$GBRAIN_URL_VAL" ] && [ -n "$GBRAIN_TOKEN_VAL" ]; then
# Try the HTTP handoff.
HTTP_RESP=$(curl -sS -X POST "${GBRAIN_URL_VAL%/}/ingest-repo" \
-H "Authorization: Bearer $GBRAIN_TOKEN_VAL" \
-H "Content-Type: application/json" \
--data "{\"repo_url\":\"$REMOTE_URL\"}" \
-w "\n%{http_code}" 2>&1 || echo -e "\ncurl-error")
HTTP_CODE=$(echo "$HTTP_RESP" | tail -1)
if [ "$HTTP_CODE" = "200" ] || [ "$HTTP_CODE" = "201" ] || [ "$HTTP_CODE" = "204" ]; then
CONSUMER_STATUS="ok"
echo "GBrain consumer registered: $GBRAIN_URL_VAL"
else
echo "GBrain ingest endpoint returned HTTP $HTTP_CODE; will retry on next skill run."
fi
elif [ -z "$GBRAIN_URL_VAL" ]; then
echo "(GBRAIN_URL not configured; skipping consumer registration. Set it with:"
echo " gstack-config set gbrain_url <url>"
echo " gstack-config set gbrain_token <token>"
echo " then run: gstack-brain-consumer add gbrain --ingest-url <url> --token <token>)"
fi

# Write consumers.json — the canonical registry. Tokens are NOT stored here;
# they stay in gstack-config (machine-local). This file IS synced so a new
# machine knows which consumers exist and can prompt for tokens.
python3 - "$CONSUMERS_FILE" "$GBRAIN_URL_VAL" "$CONSUMER_STATUS" <<'PYEOF'
import sys, json, os
path, url, status = sys.argv[1:4]
try:
with open(path) as f:
data = json.load(f)
except (FileNotFoundError, json.JSONDecodeError):
data = {"consumers": []}
# Upsert GBrain entry.
entry = {"name": "gbrain", "ingest_url": url, "status": status, "token_ref": "gbrain_token"}
updated = False
for i, c in enumerate(data.get("consumers", [])):
if c.get("name") == "gbrain":
data["consumers"][i] = entry
updated = True
break
if not updated:
data.setdefault("consumers", []).append(entry)
with open(path, "w") as f:
json.dump(data, f, indent=2)
f.write("\n")
PYEOF

# Stage and commit consumers.json in the same session.
cd "$GSTACK_HOME"
git add -f consumers.json 2>/dev/null || true
if ! git diff --cached --quiet 2>/dev/null; then
git -c user.email="gstack@localhost" -c user.name="gstack-brain-init" \
commit -q -m "chore: register GBrain consumer"
git push -q origin HEAD 2>/dev/null || true
fi

# ---- done ----
cat <<EOF

Expand All @@ -350,12 +285,14 @@ Repo: $GSTACK_HOME (git)
Remote: $REMOTE_URL
Remote URL also saved at: $REMOTE_FILE

Sync happens automatically at the start and end of each skill (no daemon).
Check status anytime with:
Sync to GitHub happens automatically at the start and end of each skill
(no daemon). Check status anytime with:
gstack-brain-sync --status

To activate sync, the next skill you run will ask you one question about
privacy mode (sync everything / artifacts only / off).
The next skill run will ask you one question about privacy mode (full /
artifacts-only / off). After that, /setup-gbrain Step 7 (or the
gstack-gbrain-source-wireup helper) registers this repo as a federated
source on gbrain so its content is searchable via 'gbrain search'.

New machine? On the other laptop, put a copy of:
$REMOTE_FILE
Expand Down
28 changes: 8 additions & 20 deletions bin/gstack-brain-restore
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
# 3. rsync-copy tracked files into ~/.gstack/ with skip-if-same-hash
# 4. Move staging's .git into ~/.gstack/.git
# 5. Register local git config merge drivers (they don't clone from remote)
# 6. Rehydrate consumers.json endpoints; prompt for tokens
# 6. Wire the cloned brain into gbrain via gstack-gbrain-source-wireup
# (best-effort; restore continues even if gbrain wireup fails)
#
# Env:
# GSTACK_HOME — override ~/.gstack
Expand Down Expand Up @@ -195,25 +196,6 @@ sys.exit(0)
HOOK_EOF
chmod +x "$HOOK"

# ---- rehydrate consumers, prompt for tokens ----
if [ -f "$GSTACK_HOME/consumers.json" ]; then
echo ""
echo "Consumer registry restored. Tokens are machine-local and NOT synced."
echo "Run these for each consumer to re-enter tokens:"
python3 - "$GSTACK_HOME/consumers.json" <<'PYEOF'
import sys, json
try:
with open(sys.argv[1]) as f:
data = json.load(f)
except Exception:
sys.exit(0)
for c in data.get("consumers", []):
name = c.get("name", "")
token_ref = c.get("token_ref", f"{name}_token")
print(f" gstack-config set {token_ref} <your-token>")
PYEOF
fi

# ---- write remote helper file if missing ----
if [ ! -f "$REMOTE_FILE" ]; then
echo "$REMOTE_URL" > "$REMOTE_FILE"
Expand All @@ -222,6 +204,12 @@ if [ ! -f "$REMOTE_FILE" ]; then
echo "Wrote $REMOTE_FILE for future skill-run auto-detection."
fi

# ---- wire the cloned brain into gbrain (best-effort) ----
WIREUP_BIN="$SCRIPT_DIR/gstack-gbrain-source-wireup"
if [ -x "$WIREUP_BIN" ]; then
"$WIREUP_BIN" || >&2 echo "WARNING: gbrain wireup failed; run $WIREUP_BIN manually after fixing prereqs"
fi

cat <<EOF

gstack-brain-restore complete.
Expand Down
10 changes: 10 additions & 0 deletions bin/gstack-brain-uninstall
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,16 @@ rm -f "$GSTACK_HOME/.brain-last-pull" 2>/dev/null || true
rm -f "$GSTACK_HOME/.brain-skip.txt" 2>/dev/null || true
rm -f "$GSTACK_HOME/.brain-sync-status.json" 2>/dev/null || true
rm -rf "$GSTACK_HOME/.brain-sync.lock.d" 2>/dev/null || true

# ---- unregister gbrain federated source + remove worktree (best-effort) ----
# The wireup helper handles: gbrain sources remove, git worktree remove,
# launchd plist (future). All best-effort; uninstall continues on failure.
WIREUP_BIN="$SCRIPT_DIR/gstack-gbrain-source-wireup"
if [ -x "$WIREUP_BIN" ]; then
"$WIREUP_BIN" --uninstall 2>/dev/null || true
fi

# ---- legacy consumers.json (no longer written by gstack-brain-init since v1.17.0.0) ----
rm -f "$GSTACK_HOME/consumers.json" 2>/dev/null || true

# ---- clear config keys ----
Expand Down
Loading