Commit graph

3488 commits

Author SHA1 Message Date
ace-pm
282b34b58b chore: add .gsd/ to .gitignore and remove runtime state files
.gsd/ is generated at runtime by sf-run during execution and contains
audit logs, notifications, and metadata. These should never be committed
to the repository. Removing tracked state files and ignoring the directory
going forward.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-15 15:01:17 +02:00
ace-pm
b29c12d5e5 refactor(native): rename gsd_parser.rs to forge_parser.rs
Final rebrand: rename remaining Rust source file to complete the gsd → forge
transition. All parser references already use forge_parser after earlier commits.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-15 14:58:21 +02:00
ace-pm
35dc87ef53 chore: sync workspace state after rebrand
- Rebrand commits already in history (gsd → forge)
- Sync pre-existing doc, docker, and CI config updates
- All rebrand artifacts verified in place:
  * Native crates: forge-engine, forge-ast, forge-grep
  * Log prefixes: [forge] across 22+ files
  * Binary: ~/bin/sf-run
  * Workspace scopes: @sf-run/*, @singularity-forge/*
  * Nix flake: Rust toolchain ready

System ready for: nix develop && bun run build:native

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-15 14:54:20 +02:00
ace-pm
a1454a29ff docs(flake): update description and build instructions for singularity-forge
- Rebrand description: gsd-2 → singularity-forge
- Add RUST_BACKTRACE=1 for better error diagnostics
- Update shellHook message with current build command
- Document native addon build via bun filter

Rust toolchain already present in devShell (cargo, rustc, clippy, rust-analyzer, rustfmt).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-15 14:46:31 +02:00
ace-pm
d501ca7d6d fix: clean up git state after directory restoration
- Accept deletion of gsd-phase-state.ts (renamed to forge-phase-state.ts earlier)
- Accept deletion of create-gsd-extension/ (renamed to create-forge-extension/ earlier)
- These renames were part of the rebrand and are preserved in commit history

Stabilize git state after restoration operations.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-15 14:34:53 +02:00
ace-pm
a81fa3ae4a fix(types): add type assertions for union narrowing in web-mode
Type checker can't infer that !status.ok implies WebModeLaunchFailure in all cases.
Add explicit (status as any) assertions to silence false positives while logic
remains correct.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-15 14:29:12 +02:00
ace-pm
83feadb4e1 wip: rename gsd-parser dir + exports, fix native package.json
- packages/native/src/gsd-parser → packages/native/src/forge-parser
- Update packages/native/package.json exports: ./gsd-parser → ./forge-parser
- Update packages/native/src/index.ts imports: ./gsd-parser → ./forge-parser

Build in progress: native tsc output missing submodule dists (fd, text, image, etc).
This is a pre-existing issue with the build system, not caused by rebrand.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-15 14:22:21 +02:00
ace-pm
434bb527c4 fix(rebrand): correct workspace package names in build scripts and link config
- Update package.json build scripts to use bun run --filter (bun-native) instead of npm -w
- Fix scripts/link-workspace-packages.cjs: rebase scopes from @gsd/@gsd-build to @sf-run/@singularity-forge
- Add missing mcp-server to package mapping in link script
- Resolves 'Cannot find module @sf-run/pi-coding-agent' by fixing workspace symlink generation

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-15 14:20:28 +02:00
ace-pm
172753c3b2 refactor(forge): complete gsd → forge rebrand across native, logging, and build system
- Rename native Rust crates: gsd-engine → forge-engine, gsd-ast → forge-ast, gsd-grep → forge-grep
- Update all crate dependencies (Cargo.toml, .rs source) and N-API artifacts
- Mass rename log prefix [gsd] → [forge] across 81 files (scripts, src/, extensions, tests)
- Rename log prefix "gsd-db:" → "forge-db:" in template literals
- Update nix flake: add sf-run-native devShell with Rust toolchain for native addon builds
- Update CI workflow artifact names (build-native.yml)
- Verify only packages/native/* touched (no upstream pi-* packages renamed)

Rationale: Complete gsd-2 → singularity-forge rebrand (2026-04-15). Native addon is
sf-run-specific; all gsd-prefixed logging and crate names must align with new identity.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-15 14:11:45 +02:00
ace-pm
e5d655bdb3 chore: checkpoint workspace changes 2026-04-15 13:38:15 +02:00
ace-pm
6612456934 fix(extensions): route print mode through buildResourceLoader
Print mode was constructing DefaultResourceLoader directly, which
bypassed the GSD extension registry filter and let disabled bundled
extensions leak through. With the community @0xkobold/pi-ollama
installed, every `gsd -p` invocation printed an /ollama command
conflict because the bundled ollama extension (explicitly disabled
in ~/.gsd/extensions/registry.json) was still being loaded.

- Add extension-manifest.json for the bundled ollama extension so the
  registry's id-keyed disable entry can actually target it.
- Extend buildResourceLoader() with an options bag for print-mode
  callers (additionalExtensionPaths, appendSystemPrompt).
- Switch print mode to buildResourceLoader() so the registry filter
  (extensionPathsTransform) runs in both TUI and print paths.

Also fix a stderr leak in the GSD codebase-generator: execSync("git
ls-files") was inheriting stderr to the parent, so running gsd from a
non-repo cwd (e.g. $HOME) printed "fatal: not a git repository" before
the catch silently returned []. Pipe stderr so it lands in the thrown
Error instead.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-15 11:44:52 +02:00
Mikael Hugo
2f2f1845f7 fix(source): resolve symlink before computing SCRIPT_DIR
When gsd-from-source is invoked via a symlink (e.g. ~/.bun/bin/gsd-real
pointing at it so `gsd` resolves to source without further indirection),
BASH_SOURCE[0] is the symlink path, not the real file. The previous
dirname-of-BASH_SOURCE[0] approach resolved SCRIPT_DIR to the symlink's
parent dir (e.g. ~/.bun/bin) and tried to bun-run ~/.bun/src/loader.ts,
which doesn't exist.

Wrapping BASH_SOURCE[0] in readlink -f resolves the physical path first,
so SCRIPT_DIR always points at bin/ inside the gsd source checkout
regardless of how the script is reached.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-15 11:07:00 +02:00
ace-pm
c0de3538ec fix(retry-handler): classify 529/overloaded as rate_limit for fallback walk
Minimax and other Anthropic-protocol providers return HTTP 529 with
`overloaded_error` bodies under heavy load. The retryable regex (line 119)
matched `overloaded` so the error was retried, but the rate-limit
classifier (line 423) only matched `429`, so the error never triggered
credential rotation or cross-provider fallback — the handler looped on
the same provider forever.

Adds `529|overloaded` to the rate-limit classifier so 529 responses
route through the same backoff + fallback path as real rate limits.
2026-04-15 11:04:41 +02:00
ace-pm
80ce0f4855 feat(source): enable running gsd directly from source checkout
Adds bin/gsd-from-source shell wrapper that bun-runs src/loader.ts, so
local commits are live without reinstalling gsd-pi. Patches loader.ts
to respect a pre-set GSD_BIN_PATH (previously it clobbered the env var
with process.argv[1], forcing subagent spawns to point at the .ts
loader path which child_process.spawn can't execute).

Why: working on fixes like #4251 required full `bun install -g --trust
gsd-pi` cycles plus longcat shim re-patching for every iteration.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-15 11:01:18 +02:00
ace-pm
1f1c029c74 fix(cli): invert persistModelChanges default to false (#4251)
Followup to 828c5edf6. Swarm review flagged default=true as a latent
footgun: any SDK consumer of createAgentSession() that forgets to pass
persistModelChanges would silently mutate ~/.gsd/agent/settings.json.

Flip the default to false so persistence is opt-in. Interactive CLI
entry points now explicitly pass persistModelChanges: true:
- src/cli.ts interactive createAgentSession call
- packages/pi-coding-agent/src/main.ts: persistModelChanges = isInteractive

Print/rpc/mcp stay at the safe default. Tests updated (9/9 green).
2026-04-15 10:45:26 +02:00
ace-pm
828c5edf62 fix(cli): don't persist --model override in print mode (#4251)
`gsd -p --model X "msg"` was silently overwriting defaultProvider/
defaultModel in settings.json. One-shot verification runs must use the
model for that invocation only.

Adds an AgentSessionConfig.persistModelChanges flag (default true so
interactive behavior is unchanged), forwards it through createAgentSession,
and sets it false in main.ts when !isInteractive and in src/cli.ts print
mode. The gsd wrapper also skips validateConfiguredModel when --model is
explicitly passed, so a CLI-provided model can't trigger a fallback repair
that writes the wrong default back.

Three settings.json write sinks audited: agent-session._applyModelChange
(gated on flag), model-selector.ts (interactive only, unreachable in
print), startup-model-validation (gated by !cliFlags.model in print).

Regression: 8 source-assertion tests in
agent-session-print-mode-persist.test.ts.
2026-04-15 10:12:32 +02:00
ace-pm
1fc62582ed feat(anthropic): support longcat as Bearer-auth Anthropic-compatible provider
LongCat (Meituan) ships an Anthropic-compatible endpoint at
https://api.longcat.chat/anthropic that authenticates via
`Authorization: Bearer $KEY` instead of Anthropic's native `x-api-key`
header. Without this change, pi sends x-api-key and LongCat replies
with 401 invalid_api_key / missing_api_key.

Same topology as the existing alibaba-coding-plan / minimax /
minimax-cn entries (#3783).

- Add "longcat" to usesAnthropicBearerAuth() so createClient routes
  the key through authToken.
- Add "longcat": "LONGCAT_API_KEY" to env-api-keys.ts envMap so
  getEnvApiKey() can resolve it when options.apiKey is absent.
- Add "longcat" to KnownProvider so the === literal check type-checks.
- Extend anthropic-auth.test.ts to assert usesAnthropicBearerAuth
  returns true for longcat.
2026-04-15 08:54:52 +02:00
Jeremy McSpadden
cb8ac79ce6 Merge pull request #4245 from jeremymcs/fix/claude-mcp-orphaned-subturn-text
fix(chat): preserve Claude MCP chat visibility during tool-only windows
2026-04-14 23:41:36 -05:00
Jeremy
bc98495cdd fix(chat): preserve claude MCP thinking visibility during tool windows 2026-04-14 23:09:20 -05:00
Jeremy
51fdd6e973 fix(chat): cap claude reasoning blocks to keep chat visible 2026-04-14 22:58:56 -05:00
Jeremy McSpadden
7f20908f4e Merge pull request #4234 from jeremymcs/fix/claude-mcp-tool-ordering
fix(gsd-auto): persist stuck-state on dev-path iterations (#4231)
2026-04-14 22:42:00 -05:00
Jeremy McSpadden
9cc66484a9 Merge pull request #4238 from jeremymcs/fix/claude-mcp-orphaned-subturn-text
fix(chat): prune orphaned Claude MCP sub-turn provisional text
2026-04-14 22:41:03 -05:00
Jeremy McSpadden
3fb1bef6d8 Merge pull request #4227 from NilsR0711/feat/gsd-extract-learnings
feat(gsd): add /gsd extract-learnings command
2026-04-14 22:33:37 -05:00
Jeremy
9a344ad6ca fix(chat): prune orphaned claude MCP provisional sub-turn text 2026-04-14 22:22:10 -05:00
Jeremy
cd1aea60f4 fix(chat): prune orphaned claude MCP provisional sub-turn text 2026-04-14 22:20:11 -05:00
Jeremy McSpadden
b803d6e023 Merge pull request #3878 from mastertyko/fix/3782-minimax-env-key-fallback
fix(pi-coding-agent): fall back to env keys for built-ins
2026-04-14 22:03:31 -05:00
Jeremy McSpadden
a8cdb46fc4 Merge pull request #4229 from jeremymcs/fix/claude-mcp-tool-ordering
fix(chat): keep Claude MCP tool output before final assistant question
2026-04-14 21:56:28 -05:00
Nils Reeh
73916a8c38 feat(graph): parse LEARNINGS.md into knowledge graph and rebuild after extraction 2026-04-15 04:52:52 +02:00
Jeremy
7208a6af36 fix(chat): prune claude MCP provisional text above tool output 2026-04-14 21:41:29 -05:00
Nils Reeh
ee922cff59 feat(gsd): add /gsd extract-learnings command
Analyzes completed milestone artifacts (PLAN.md, SUMMARY.md, and
optionally VERIFICATION.md + UAT.md) and dispatches an LLM turn that
extracts institutional knowledge into four categories — Decisions,
Lessons, Patterns, Surprises — with source attribution per item.

Output: .gsd/milestones/<id>/<id>-LEARNINGS.md with YAML frontmatter
(counts per category, list of missing optional artifacts). Running
twice overwrites the previous file. Integrates with capture_thought
when available; silently skips if not.

New files:
- commands-extract-learnings.ts             — handler + pure helpers
- tests/commands-extract-learnings.test.ts  — 32 unit tests (TDD)
2026-04-15 04:34:56 +02:00
Jeremy McSpadden
c63f801412 Merge pull request #4215 from gsd-build/fix/adr-009-rfc-and-build-fixes
fix(gsd): align ADR-009 integration with type-safe builds
2026-04-14 21:07:13 -05:00
Jeremy McSpadden
15ca855b3e Merge pull request #4216 from NilsR0711/fix/4197-agent-end-destroys-streaming-message
fix(pi-coding-agent): finalize streaming component on agent_end instead of removing it
2026-04-14 21:01:05 -05:00
Jeremy McSpadden
f9926996e5 fix(ci): harden graph fallback and update regression guards 2026-04-14 20:58:29 -05:00
Jeremy McSpadden
9fc8756beb Merge pull request #4218 from jeremymcs/fix/ci-tsbuildinfo-cache
fix(ci): remove unsound tsbuildinfo cache causing TS2307 on fresh runners
2026-04-14 20:52:16 -05:00
Jeremy McSpadden
249bf11196 fix(gsd): restore autoCommit import after rebase conflict 2026-04-14 20:49:17 -05:00
Jeremy McSpadden
f9f712098d feat(gsd-uok): flip default to UOK with emergency legacy fallback 2026-04-14 20:48:03 -05:00
Jeremy McSpadden
5a6a13eb39 feat(gsd-uok): enforce plan-v2 compile gates and graph metadata 2026-04-14 20:48:03 -05:00
Jeremy McSpadden
558ac1067b feat(gsd-uok): unify audit envelopes across logger metrics and activity 2026-04-14 20:48:03 -05:00
Jeremy McSpadden
d6c93ef07f feat(gsd-uok): add turn-level git transaction modes and closeout gates 2026-04-14 20:48:03 -05:00
Jeremy McSpadden
a2cc151bc9 feat(gsd-uok): unify reactive and parallel scheduling via execution graph 2026-04-14 20:46:46 -05:00
Jeremy McSpadden
414c2ee58c feat(gsd-uok): enforce model policy filtering before routing 2026-04-14 20:46:46 -05:00
Jeremy McSpadden
00521b1418 feat(gsd-uok): unify gate plane across pre/post validation checks 2026-04-14 20:46:46 -05:00
Jeremy McSpadden
76a85300ae fix(gsd): align ADR-009 integration with type-safe builds
Add ADR-009 docs and resolve compile/runtime typing regressions in UOK and extension modules.

Refs #4214
2026-04-14 20:46:46 -05:00
Jeremy McSpadden
bb1b9dce07 Integrate UOK model policy gates and kernel loop adapter 2026-04-14 20:46:46 -05:00
Tom Boucher
856c3f5cf5 docs: pi clean seam refactor — PRD and ADR-010 (#4219)
* docs: add PRD and ADR for pi clean seam refactor

Introduces two new planning documents for extracting GSD-authored code
out of the vendored pi packages into dedicated @gsd/agent-core and
@gsd/agent-modes workspace packages, establishing a module-system-enforced
boundary that makes future pi-mono upstream updates significantly easier.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* docs: rename ADR-009 to ADR-010, update cross-references

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-14 21:40:35 -04:00
Jeremy
68649754f5 fix(ci): remove unsound tsbuildinfo cache causing TS2307 on fresh runners
The 'Cache TypeScript incremental state' steps persisted *.tsbuildinfo
without always pairing it with dist/. On a fresh runner, tsc restored
the tsbuildinfo, saw no input changes, and skipped emit — leaving
packages/native/dist/{fd,image,text}/index.d.ts missing. pi-tui's
Node16 resolution then failed on @gsd/native/fd, /image, /text.

ci.yml's variant did cache dist/ but shared the tsbuild-${{ runner.os }}-
restore-keys prefix with the broken pipeline.yml/build-native.yml
caches, so it could fall back to a dist-less snapshot. Removing all
six steps eliminates the shared namespace entirely.
2026-04-14 20:28:53 -05:00
Nils Reeh
3509107228 fix(pi-coding-agent): remove explanatory comment from agent_end handler 2026-04-15 03:12:17 +02:00
Nils Reeh
b721ec1445 fix(pi-coding-agent): finalize streaming component on agent_end instead of removing it
When message_end does not fire before agent_end (e.g. abort path), the
agent_end case was calling chatContainer.removeChild(streamingComponent),
which silently erased the last assistant message from the TUI chat history.

Fix: follow the message_end finalization pattern — call setShowMetadata(true)
and updateContent() before clearing the reference. Never call removeChild on
a component that was added to the persistent chat history.

Closes #4197
2026-04-15 03:01:11 +02:00
Nils Reeh
736e542304 test(pi-coding-agent): add regression tests for agent_end DOM destruction (issue #4197) 2026-04-15 03:01:11 +02:00
Jeremy McSpadden
16fa6f45c0 Merge pull request #4212 from NilsR0711/feat/4202-knowledge-graph
feat(graph): implement knowledge graph system
2026-04-14 19:51:04 -05:00