Commit graph

525 commits

Author SHA1 Message Date
TÂCHES
8b9cfae9e9 feat: native Rust streaming JSON parser (#266)
* feat: add native Rust streaming JSON parser for LLM tool call argument parsing

Replaces the JS partial-json library with a Rust implementation exposed via napi-rs.
The parser handles incomplete JSON from streaming deltas by closing unclosed strings,
objects, arrays, removing trailing commas, and completing truncated literals.

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

* fix: handle truncated numbers and remove dead partial-json dependency

Adds truncated number recovery (e.g. `{"key": 12`, `{"key": 3.`, `{"key": 1e`)
to the Rust streaming JSON parser, and removes the now-unused `partial-json`
npm dependency from pi-ai.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-13 16:21:58 -06:00
Juan Francisco Lebrero
9b0f31e39a fix: use version ranges for native engine optional dependencies (#286)
The v2.10.5 release broke on darwin-arm64 because the main package
was published before the native CI built and published the platform
packages. With exact version pinning, npm silently skips the
optional dep when the version doesn't exist, causing a fatal crash.

Change to >=2.10.2 range so npm installs the latest available
binary. The native API is stable across patch versions.

Also stop sync-platform-versions.cjs from overwriting the ranges
back to exact versions during CI.
2026-03-13 16:20:44 -06:00
Lex Christopherson
4959ecfd33 fix: guard publish against uncommitted version sync changes
Adds a git diff check after sync-platform-versions so npm publish fails
if the sync had to make changes. Prevents a repeat of #276 where
optionalDependencies were out of sync with the published version.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-13 16:12:37 -06:00
TÂCHES
54df619891 feat: task isolation for subagent filesystem safety (#254)
* feat: add task isolation for subagent filesystem safety

Subagents can run in isolated git worktrees (or FUSE overlays on Linux)
so concurrent tasks don't stomp on each other's files. Changes are
captured as unified diffs and merged back via git apply.

- New isolation.ts module with worktree and FUSE overlay backends
- TaskIsolationSettings in settings-manager (mode + merge strategy)
- isolated parameter on the subagent tool schema
- Baseline capture/apply mirrors the parent repo's dirty state
- Process exit handler for best-effort cleanup of stale worktrees

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: correct delta capture to exclude parent baseline state

The worktree backend now commits a baseline snapshot after applying the
parent's dirty state, so captureDeltaPatch diffs only the subagent's
actual changes against the post-baseline HEAD (not the original HEAD).

The FUSE overlay backend tracks the parent's dirty file set at mount
time and filters the upper dir during delta capture to exclude inherited
dirty files.

Also removes dead code: findGitRoot (unused), readIsolationMergeStrategy
(exported but never called).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-13 16:10:55 -06:00
Lex Christopherson
fdeb520332 fix: restore bashInterceptor settings dropped by async-jobs merge
The async-jobs PR (#260) accidentally dropped `bashInterceptor` from the
Settings interface and the getBashInterceptorEnabled/getBashInterceptorRules
methods from SettingsManager, breaking the TypeScript build on main.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-13 16:06:21 -06:00
Lex Christopherson
4c2e40b9a3 docs: update system prompt routing for async_bash vs bg_shell 2026-03-13 16:05:09 -06:00
Juan Francisco Lebrero
bd5bf996a8 fix: show 'keep current' option in config when already authenticated (#283)
When running `gsd config` with existing LLM auth or web search
configured, show a 'Keep current (provider)' option at the top
so users don't have to re-authenticate.

Co-authored-by: Juan Francisco Lebrero <fran@Juans-MacBook-Air.local>
2026-03-13 16:04:35 -06:00
TÂCHES
fa9477f638 feat: async background jobs extension (#260) 2026-03-13 16:01:30 -06:00
TÂCHES
7b0b71da79 Merge pull request #281 from gsd-build/fix/276-version-sync
fix: 2.10.5 — correct optionalDependencies version sync (#276)
2026-03-13 16:00:16 -06:00
Lex Christopherson
16518a217e 2.10.5
Fix optionalDependencies version sync — 2.10.4 shipped with engine packages pinned to 2.10.2 (the broken version), so users never got the fixed binaries. Closes #276.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-13 15:59:24 -06:00
TÂCHES
7741df9d2a Merge pull request #278 from frizynn/feat/web-search-onboarding
feat: add web search provider step to onboarding wizard
2026-03-13 15:57:03 -06:00
Juan Francisco Lebrero
866ada5c66 feat: add web search provider selection to onboarding wizard
After LLM provider login, ask how to search the web:
- Anthropic built-in (no key needed, shown when using Claude)
- Brave Search (API key)
- Tavily (API key)
- Skip

Moves Brave/Brave Answers out of the generic tool keys step into
the dedicated web search step for better discoverability.
2026-03-13 18:56:02 -03:00
TÂCHES
79587229a1 Merge pull request #273 from frizynn/feat/update-subcommand
feat: add `gsd update` subcommand
2026-03-13 15:50:44 -06:00
TÂCHES
6ffa0ad677 Merge pull request #274 from frizynn/feat/simpler-onboarding
feat: simplify onboarding into two-step auth flow
2026-03-13 15:50:22 -06:00
Juan Francisco Lebrero
45b269df0e fix: use plain language instead of OAuth jargon in onboarding 2026-03-13 18:50:02 -03:00
TÂCHES
2452d34f53 Merge pull request #255 from gsd-build/feat/multi-credential
feat: multi-credential round-robin with rate-limit fallback
2026-03-13 15:49:57 -06:00
Lex Christopherson
e9676202e1 fix: add tests and clarify edge cases for multi-credential auth storage
- Add 14 tests covering round-robin, session-sticky, login accumulation,
  backoff/fallback, and getAll() truncation behavior
- Document getAll() truncation is intentional (OAuth refresh only)
- Add comment in markUsageLimitReached explaining round-robin race
  is benign in single-threaded event loop context

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-13 15:49:44 -06:00
Juan Francisco Lebrero
049ce9577c feat: simplify onboarding into two-step auth flow
Replace the flat 9-option provider list with a two-step flow:
1. How to sign in? (Browser login / API key / Skip)
2. Which provider? (filtered by auth method)

This reduces cognitive load on first launch — users pick their
auth method first, then see only the relevant providers.
2026-03-13 18:49:05 -03:00
TÂCHES
bdb6bcde35 Merge pull request #258 from gsd-build/feat/bash-interceptor
feat: bash interceptor for tool discipline
2026-03-13 15:47:53 -06:00
Juan Francisco Lebrero
0858092098 feat: add gsd update subcommand for self-update
Adds a CLI subcommand that checks npm for the latest version and
runs `npm install -g gsd-pi@latest` if an update is available.
Prints current/latest version and clear success/failure messages.
2026-03-13 18:47:33 -03:00
Lex Christopherson
e55b6dd994 fix: bash interceptor regex bugs and add unit tests
- Fix cat rule to exclude heredoc syntax (cat <<EOF) via negative lookahead
- Fix write rule: exclude >> append and digit-prefixed fd redirects (2>)
  using lookbehind (?<![|>\d])>(?!>)
- Add compileInterceptor() — pre-compiles rules once at construction time
  instead of on every bash call; export CompiledInterceptor type
- Update createBashTool to use pre-compiled interceptor instance
- Add 33 unit tests covering all rules, edge cases, and pass-throughs
2026-03-13 15:46:08 -06:00
TÂCHES
40e30f61dc Merge pull request #264 from frizynn/fix/gsd-merge-all-conflicts
fix: auto-resolve .gsd/ planning artifact conflicts during slice merge
2026-03-13 15:40:49 -06:00
Lex Christopherson
8ba6c9a853 fix: collapse tool output by default
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-13 15:31:18 -06:00
Juan Francisco Lebrero
6f50c02a19 fix: auto-resolve .gsd/ planning artifact conflicts during slice merge
The merge conflict auto-resolution only handled RUNTIME_EXCLUSION_PATHS
(.gsd/activity/, .gsd/runtime/, .gsd/metrics.json, etc). Planning
artifacts like DECISIONS.md, REQUIREMENTS.md, PROJECT.md, and
ROADMAP.md were not covered, causing the merge to fail and auto-mode
to loop when both main and the slice branch modified these files.

Now any conflict limited to .gsd/ files is auto-resolved by taking
the slice branch version (--theirs), since the LLM just finished
updating these artifacts during complete-slice.
2026-03-13 18:30:38 -03:00
TÂCHES
e5cedfa81b Merge pull request #263 from dbachelder/fix/native-build-cache
ci: cache native Rust builds per platform
2026-03-13 15:27:22 -06:00
dan
8064981764 ci: cache native Rust builds per platform 2026-03-13 14:18:38 -07:00
Lex Christopherson
b607a1df73 2.10.4
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-13 15:13:35 -06:00
Lex Christopherson
4c750c985b docs: update changelog for v2.10.3
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-13 15:08:58 -06:00
Lex Christopherson
0675c8f52a fix: use macos-14 for darwin-x64 cross-compilation
macos-13 runners are deprecated on GitHub Actions. Use macos-14 (ARM64)
and cross-compile for x86_64-apple-darwin instead.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-13 14:53:28 -06:00
Lex Christopherson
d0f84d9a38 feat: add bash interceptor to block commands that duplicate dedicated tools
Regex-based pre-execution check in the bash tool blocks shell commands
(grep, cat, sed -i, etc.) when the dedicated replacement tool is available
in the session. Configurable via bashInterceptor settings.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-13 14:50:10 -06:00
Lex Christopherson
1774d6e1f4 fix: use @gsd-build npm scope and remove committed binary
Rename all platform packages from @gsd/engine-* to @gsd-build/engine-*
to match the npm org. Remove the darwin-arm64 binary from git and
native/addon from files — production binaries come exclusively from
CI-published platform packages.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-13 14:49:26 -06:00
Lex Christopherson
4b6a43c2b3 feat: multi-credential round-robin with rate-limit fallback
Support multiple API keys per provider with automatic rotation:
- AuthStorageData accepts single credential or array per provider
- Round-robin selection across credentials (no sessionId)
- Session-sticky hashing when sessionId is provided
- Credential backoff on rate limits (30s), quota exhaustion (30min),
  server errors (20s)
- markUsageLimitReached() backs off failing credential and returns
  whether an alternate is available
- Login accumulation: duplicate provider logins append API keys
  instead of replacing
- Agent retry handler tries credential fallback before counting
  against retry budget (immediate retry, no delay)
- All getApiKey call sites thread sessionId for sticky selection

Backward compatible: single credentials work unchanged.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-13 14:45:35 -06:00
Lex Christopherson
1a0d5cf740 fix: address CI workflow audit findings
- Use CARGO_ENCODED_RUSTFLAGS="" to override target-specific rustflags
  in .cargo/config.toml (RUSTFLAGS env var doesn't override [target.*])
- Fix sync script filename: .cjs not .js
- Fail hard when no library found instead of silent exit 0
- Only tolerate "already published" errors, fail on real publish errors
- Use --ignore-scripts for main package publish to skip redundant build
- Use cd "$GITHUB_WORKSPACE" instead of cd - for reliability

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-13 14:40:49 -06:00
Lex Christopherson
bd8380315c feat: per-platform optional dependencies for native binary distribution
Add the esbuild/swc pattern for distributing platform-specific native
binaries via npm optional dependencies. Each supported platform gets its
own @gsd/engine-{platform} package containing just the .node binary.

- 5 platform package stubs (darwin-arm64, darwin-x64, linux-x64-gnu,
  linux-arm64-gnu, win32-x64-msvc) with os/cpu filters
- Rewritten native loader: tries npm package first, then local build
- Version sync script keeps platform packages in lock-step with root
- GitHub Actions workflow for cross-platform build + publish on tag push

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-13 14:36:18 -06:00
Lex Christopherson
d49af589d0 fix: include darwin-arm64 native binary in npm tarball (Phase A hotfix)
The native .node binary was excluded from npm pack due to native/.gitignore
ignoring addon/. Add native/.npmignore (overrides .gitignore for npm) and
include native/addon in the files whitelist. Also improve the error message
in the native loader to list supported platforms and link to issues.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-13 14:33:37 -06:00
Lex Christopherson
d641a48895 docs: add OAuth ToS disclaimer to README
Closes community discussion (#86) about potential ToS implications
of using subscription OAuth tokens outside native applications.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-13 14:30:42 -06:00
Lex Christopherson
a35e844ba0 2.10.2 2026-03-13 14:21:14 -06:00
Lex Christopherson
341273e957 chore: update Cargo.lock 2026-03-13 14:21:14 -06:00
Lex Christopherson
9fafadf38c docs: update changelog for v2.10.2 2026-03-13 14:21:02 -06:00
TÂCHES
85197d54f7 feat: native Rust GSD file parser
feat: native Rust GSD file parser
2026-03-13 14:12:29 -06:00
Lex Christopherson
064c4cfc1a feat: add native Rust GSD file parser for .gsd/ directory parsing
Implements a Rust napi-rs module that parses YAML-like frontmatter,
markdown sections, and roadmap structures from .gsd/ files. Provides
parseFrontmatter, extractSection, extractAllSections, batchParseGsdFiles,
and parseRoadmapFile functions exposed via @gsd/native. The JS parsers
in files.ts fall back transparently when the native module is unavailable.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-13 14:12:17 -06:00
TÂCHES
b37819e30a feat: native Rust diff engine for edit tool
feat: native Rust diff engine for edit tool
2026-03-13 14:12:00 -06:00
Lex Christopherson
4c97d59536 feat: add native Rust diff engine for edit tool
Move the edit tool's hot-path diffing operations from JS to native Rust:
- `normalizeForFuzzyMatch`: single-pass Unicode normalization (smart quotes,
  dashes, special spaces, trailing whitespace)
- `fuzzyFindText`: exact-then-fuzzy substring search with UTF-16 index
  conversion for JS compatibility
- `generateDiff`: unified diff generation using the `similar` crate
  (Myers' algorithm with optimizations)

The Rust module at `native/crates/engine/src/diff.rs` exposes three napi
functions. The TypeScript wrapper at `packages/native/src/diff/` follows
the existing module pattern. `edit-diff.ts` now delegates to native
implementations while keeping line-ending handling and file I/O in JS.

18 tests covering normalization, fuzzy matching (including UTF-16 index
correctness with emoji/surrogate pairs), and diff generation.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-13 14:11:40 -06:00
TÂCHES
886bc9b571 feat: native Rust TTSR regex engine
feat: native Rust TTSR regex engine
2026-03-13 14:11:01 -06:00
Lex Christopherson
b04e1e161d 2.10.1 2026-03-13 14:06:45 -06:00
Lex Christopherson
da5a336e33 docs: update changelog for v2.10.1 2026-03-13 14:06:37 -06:00
Lex Christopherson
e6be5ac03f fix: compile @gsd/native to JS before publish
@gsd/native shipped raw .ts files in node_modules, which Node.js
refuses to import (ERR_UNSUPPORTED_NODE_MODULES_TYPE_STRIPPING on
Node 22/24, ERR_UNKNOWN_FILE_EXTENSION on Node 20). Add tsc build
step, point exports at dist/, and add to bundleDependencies.

Closes #248

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-13 14:05:41 -06:00
Lex Christopherson
ac34c7c283 feat: add native Rust TTSR regex engine via RegexSet
TTSR's checkDelta() runs O(rules x conditions) regex evaluations per
streaming token — the hottest path in GSD. This adds a Rust native
module that compiles all condition patterns into a single RegexSet,
testing them in one DFA pass instead of sequential JS RegExp iteration.

The TtsrManager transparently uses the native engine when available and
falls back to the existing JS regex loop when it is not.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-13 13:57:12 -06:00
Lex Christopherson
d5b7ecb58c fix: resolve TypeScript build errors in glob callback type and hashline test import 2026-03-13 13:47:33 -06:00
Lex Christopherson
3ee5402ed2 2.10.0 2026-03-13 13:45:30 -06:00