Commit graph

438 commits

Author SHA1 Message Date
frizynn
eeb5202842 fix: display ⌥ instead of Alt for keybindings on macOS
On macOS the Alt key is the Option key (⌥), but all UI hints showed
"Alt+". Added formatKeyForDisplay() utility that converts alt+ to ⌥
on darwin, applied it in formatKeys() for dynamic keybinding hints,
and updated hardcoded strings in tree-selector, models-selector,
settings-selector, auto-mode dashboard, and extension shortcut display.
2026-03-13 22:40:39 -03:00
Lex Christopherson
105fc0103a 2.10.6
Native Rust modules (truncation, hashing, bash stream), memory extraction pipeline, 1M context model, TUI crash fix, and rate limit improvements
2026-03-13 16:56:36 -06:00
Lex Christopherson
539262ee64 fix: strip hashline prefixes from TUI read output (#265)
Hashline prefixes (e.g. "1#BQ:") were leaking into the TUI display
for file reads, showing as weird characters to users. Strip them
before rendering since they're only meant for model consumption.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-13 16:56:06 -06:00
Lex Christopherson
ca8697ae26 feat: use server-requested retry delay for Anthropic rate limits
Anthropic's 429 responses include retry-after and x-ratelimit-reset-*
headers that tell us exactly when to retry. Previously we ignored these
and used exponential backoff (2s, 4s, 8s), which is both wrong and
misleading in the UI countdown.

- Add retryAfterMs to AssistantMessage as the structured carrier
- Extract retry-after / x-ratelimit-reset-requests / x-ratelimit-reset-tokens
  from Anthropic SDK APIError.headers in the provider catch block
- Session uses retryAfterMs when present (capped by maxDelayMs=60s),
  falls back to exponential backoff for errors with no timing hint

The UI countdown now shows the actual Anthropic reset time. No UI changes needed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-13 16:51:17 -06:00
Lex Christopherson
7664163c1f fix: truncate oversized TUI lines instead of crashing (#287)
Lines exceeding terminal width are now silently truncated at the render
boundary rather than throwing a fatal error that kills the session.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-13 16:50:58 -06:00
TÂCHES
60a3607ff7 feat: native Rust output truncation module (#268)
* feat: add native Rust output truncation module

Line-boundary-aware truncation for tool outputs (bash, grep, file reads),
replacing JS byte-counting with native Rust via napi-rs. Supports head,
tail, and both modes. Counts by UTF-8 bytes, respects line boundaries,
uses memchr for fast newline scanning.

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

* fix: remove unsafe blocks and fix truncation message byte counts

Replace unsafe from_utf8_unchecked with safe from_utf8().expect() —
the invariant (splitting at newline boundaries) is sound but the perf
difference is negligible, so no reason to use unsafe.

Fix truncateOutput messages that reported the byte budget as "bytes
truncated" instead of the actual number of bytes removed.

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:48:49 -06:00
TÂCHES
b730ed87d0 feat: native Rust xxHash32 for hashline (#272)
* feat: replace pure-JS xxHash32 with native Rust implementation via napi

The hashline edit tool calls xxHash32 on every line of every file read/edit.
Moving this to a native Rust implementation (xxhash-rust crate) eliminates
JS overhead for this hot path. Hash output is identical -- verified by tests
comparing native vs JS reference across 11 input vectors including empty
strings, short/long inputs, unicode, and seeded variants.

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

* fix: use typed native interface and remove version-drag comment in xxhash wrapper

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:46:08 -06:00
TÂCHES
8ac5a82409 feat: memory extraction pipeline (#261)
* feat: add memory extraction pipeline extension

Two-phase pipeline that extracts durable knowledge from session transcripts
and consolidates into project-scoped memory artifacts injected into future
sessions via system prompt.

- MemorySettings in settings-manager (disabled by default)
- SQLite storage with lease-based job queue (better-sqlite3)
- Phase 1: scan .jsonl sessions, extract knowledge via LLM
- Phase 2: consolidate extractions into MEMORY.md
- /memory command: view, clear, rebuild, stats
- Secret redaction on all stored output
- Watermark tracking to skip unchanged sessions

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

* fix: harden memory extraction pipeline security and performance

- Expand secret redaction patterns (Stripe, JWT, PEM, npm, Anthropic, OpenAI keys)
- Stream-read session file headers instead of loading entire file for cwd check
- Add 50MB file size cap to prevent OOM with concurrent extraction workers
- Delete orphaned prompt .md files (prompts are inlined in pipeline.ts)
- Reset package-lock.json to current main to fix version drift

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:41:13 -06:00
TÂCHES
8a5465d901 feat: native Rust bash stream processor for single-pass chunk processing (#271)
Replaces the multi-pass JS pipeline (TextDecoder → stripAnsi → sanitizeBinaryOutput)
in bash-executor.ts with a single native Rust call that handles UTF-8 decoding,
ANSI stripping, binary sanitization, and CR removal in one pass.

Key features:
- StreamState tracks incomplete UTF-8 and ANSI sequences across chunk boundaries
- Standalone stripAnsiNative() and sanitizeBinaryOutputNative() for use elsewhere
- Comprehensive test coverage for split multibyte, split ANSI, binary data

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-13 16:34:17 -06:00
Lex Christopherson
6b63b51087 ci: skip main package publish if already on npm (mirrors platform package handling) 2026-03-13 16:31:56 -06:00
Jamie Nelson
17074c4db5 fix: update tests for current implementation (#284)
- idle-recovery.test.ts: Use 'unknown-type' instead of 'execute-task'
  for null-path test (execute-task now has artifact paths for task summaries)

- app-smoke.test.ts: Remove AGENTS.md assertions (merged into system.md
  in commit 0b6d88f). Add ENOBUFS skip handling for tarball tests
  (system buffer exhaustion is not a code issue).
2026-03-13 16:26:17 -06:00
Juan Francisco Lebrero
5ff362ed0e feat: add claude-opus-4-6[1m] model with 1M context window (#288)
Add the 1M context variant of Claude Opus 4.6 to the model registry
and fix model resolver to try exact match before glob detection, so
model IDs containing bracket characters (like [1m]) are not
misinterpreted as glob patterns.
2026-03-13 16:25:45 -06:00
Lex Christopherson
d23b77ff32 ci: guard main package publish until all platform packages are verified on npm
Prevents publishing gsd-pi to npm if any @gsd-build/engine-* optional
dependency is missing at the expected version. Avoids the failure mode
seen in 2.10.5 where the main package shipped before platform packages
were available, causing 'Cannot find module' errors on fresh installs.
2026-03-13 16:24:07 -06:00
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