Commit graph

218 commits

Author SHA1 Message Date
deseltrus
ff42dccb58 fix: persist defaultProvider when user selects Claude Code CLI in onboarding (#4104)
The claude-cli onboarding path stored the auth sentinel for claude-code
but did not update defaultProvider in settings.json. Users who had an
existing Anthropic API key were left on the "anthropic" provider because
the startup migration in cli.ts correctly skips direct-key holders.

Write defaultProvider = "claude-code" to settings.json in the claude-cli
branch so the provider switch takes effect immediately.

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 06:46:58 -04:00
Claude
1eb357ca46 fix(mcp): expose every registered tool and fix SDK subpath resolution
Two related fixes for `gsd --mode mcp` that the audit missed on first pass:

1. Tool inventory — session.agent.state.tools was the *active* subset, not
   the full registry. Before this change, MCP clients connected to GSD saw
   63 tools and four built-ins were silently missing: `find`, `grep`, `ls`,
   and `hashline_edit`. After: 67 tools, matching the full _toolRegistry.
   Fix: call session.getAllTools() + session.setActiveToolsByName() before
   starting the MCP transport so every registered tool is active for the
   lifetime of the MCP session.

2. SDK subpath resolution — the #3603 createRequire workaround no longer
   works with @modelcontextprotocol/sdk 1.27.x + current Node. The
   wildcard export ./* → ./dist/cjs/* does NOT auto-append `.js`, and
   _require.resolve fails with "Cannot find module .../server/stdio".
   End-to-end handshake was actually broken in src/mcp-server.ts even
   before my earlier F5 change. Fix: use explicit `.js` suffixes on
   every subpath import (server/index.js, server/stdio.js, types.js),
   matching the convention already in use by packages/mcp-server/.

The regression test is rewritten to enforce the `.js`-suffix convention
and reject any bare subpath or lingering createRequire resolution.

Verified end-to-end via raw JSON-RPC against `gsd --mode mcp --bare`:
  BEFORE_COUNT=63
  AFTER_COUNT=67
  diff: +find +grep +hashline_edit +ls

Test sweep: 76 tests pass across mcp-createRequire, stream-adapter,
mcp-server, workflow-tools.

https://claude.ai/code/session_0174sYny3VvdwYTdCNTmY4Do
2026-04-13 01:40:05 +00:00
Claude
701ab18d81 fix(models): block unconfigured models from selection surfaces
Filter models whose provider has no working API key or OAuth out of
every user-facing selection path. Previously, stale defaults and scoped
sets could leak unconfigured models into /model, /gsd model, and auto
run — the user could "pick" a model that immediately threw on use.

- model-selector: filter scopedModels via isProviderRequestReady;
  default to "all" scope when no scoped model is ready.
- model-controller: same filter for getModelCandidates, so exact-match
  resolution from /model <term> can't return an unauth'd scoped model.
- model-resolver: gate findInitialModel step 3 on provider readiness so
  a stale saved default falls through to the available-models path.
- startup-model-validation: check configuredExists against getAvailable
  instead of getAll, so a configured-but-unauth default triggers the
  fallback picker and thinking-level reset.
- auto-start: validate resolveDefaultSessionModel against the live
  registry + auth before snapshotting, and warn when PREFERENCES.md
  names an unconfigured model.

https://claude.ai/code/session_015q6b23ap9Pyqdogzz2FXGh
2026-04-12 17:25:06 -05:00
mastertyko
1ab3d9a04f fix(headless): keep idle timeout off during interactive tools 2026-04-12 14:04:15 +02:00
Jeremy
488e4b5110 fix(cli): include all internal node_modules entries in pnpm merged dir
PR #3564 narrowed the internal overlay to @gsd* prefixes only, which
dropped non-hoisted optional deps like @anthropic-ai/claude-agent-sdk
from the merged ~/.gsd/agent/node_modules directory. Revert to overlaying
all non-dotfile internal entries so optional deps resolve correctly.
2026-04-12 02:12:13 -05:00
Jeremy McSpadden
c900e1004a Merge pull request #3564 from Tibsfox/fix/node-modules-symlink-target
fix(cli): resolve hoisted node_modules for global installs
2026-04-12 00:00:51 -05:00
Tibsfox
a6286ac32c fix(cli): address review findings for pnpm merged node_modules
- Use content fingerprint (packageRoot + sorted entry names from both
  dirs) in .gsd-merged marker so pnpm add/remove triggers rebuild
- Restrict overlay loop to @gsd* scopes only, preventing accidental
  shadowing of hoisted deps with internal versions
- Guard marker write behind linkedCount > 0 to avoid stamping success
  on a broken/empty merged directory
- Log warnings when readdirSync fails on hoisted/internal roots

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-11 21:45:12 -07:00
Tibsfox
42d2e25e0b fix(cli): handle pnpm global installs by merging both node_modules roots
pnpm's virtual-store layout doesn't hoist @gsd/* workspace scopes to
the parent node_modules, so the simple symlink-to-hoisted approach from
the original fix (#3529) left workspace packages unresolvable.

Detect when workspace scopes are missing from the hoisted root and
create a real node_modules directory with symlinks from both the hoisted
root (external deps) and internal root (workspace packages). A .gsd-merged
marker file skips rebuild on subsequent startups.

Restores behavioral tests deleted in the original PR and adds unit tests
for the pnpm merge path and scope detection logic.

Reported-by: @moekify
Fixes: #3564 (comment)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-11 21:40:32 -07:00
Jeremy McSpadden
2f92714cbb Merge pull request #3882 from mastertyko/fix/3860-onboarding-custom-default-provider
fix(cli): honor custom-provider defaults before onboarding
2026-04-11 22:56:09 -05:00
Jeremy McSpadden
9dde1b9410 Merge pull request #3987 from mastertyko/fix/3911-preserve-anthropic-api-provider
fix(cli): preserve anthropic api provider
2026-04-11 22:51:18 -05:00
mastertyko
656ad2791a test(cli): avoid secret-scan false positives 2026-04-11 18:12:09 +02:00
mastertyko
a335a87703 fix(mcp-server): use explicit sdk js subpaths 2026-04-11 18:10:09 +02:00
mastertyko
fee16a70c3 fix(cli): preserve anthropic api provider 2026-04-11 18:10:09 +02:00
Jeremy McSpadden
679587bee2 Merge pull request #3970 from jeremymcs/fix/ask-user-question-stream-order
fix(web): preserve only final ask_user_questions text
2026-04-11 07:36:30 -05:00
Jeremy
bd91186e2f fix(web): drop provisional pre-tool question text 2026-04-11 07:20:18 -05:00
Jeremy McSpadden
19cbb17683 Merge pull request #3961 from jeremymcs/fix/windows-portability-sweep
fix: harden Windows portability across runtime and tooling
2026-04-10 21:53:10 -05:00
Jeremy
153ed252fe fix(ci): unblock windows portability follow-up 2026-04-10 20:45:51 -05:00
Jeremy
61204ce771 fix(windows): harden portability across runtime and tooling 2026-04-10 20:33:18 -05:00
Jeremy McSpadden
b5ffff50ee Merge pull request #3886 from mastertyko/fix/3806-update-registry-version-fallback
fix(update): fetch latest version from registry
2026-04-10 20:31:06 -05:00
Jeremy
e26c5cff56 fix(auto): use pathToFileURL for cross-platform import and reconcile regression test
Convert resource-loader import path to file URL via pathToFileURL() to
fix Windows ERR_UNSUPPORTED_ESM_URL_SCHEME. Update existing regression
test to validate the GSD_PKG_ROOT + pathToFileURL contract.
2026-04-10 20:05:32 -05:00
Jeremy
7b2601e6a0 fix(auto): resolve resource-loader.js from GSD_PKG_ROOT on resume (#3949)
Auto-mode resume crashed with "Cannot find module" because the relative
import ../../../resource-loader.js only works from the source tree, not
from the deployed path at ~/.gsd/agent/extensions/gsd/auto.js.

Expose GSD_PKG_ROOT from loader.ts and use it in auto.ts to construct
an absolute path to dist/resource-loader.js that works in both contexts.
2026-04-10 20:00:46 -05:00
Jeremy
3c6093cf37 test remove secret-like onboarding fixture 2026-04-10 19:30:38 -05:00
Jeremy
7ee1fa0c46 fix(pi-ai): remove Anthropic OAuth flow for TOS compliance
Delete the Anthropic OAuth module, remove it from the built-in provider
registry, strip the OAuth client branch from the Anthropic streaming
provider, and replace the daemon orchestrator's token refresh with a
simple ANTHROPIC_API_KEY requirement.

Anthropic access is now API key or local Claude Code CLI only.

Closes #3952
2026-04-10 17:33:34 -05:00
Jeremy
6c2964c502 test(mcp-server): cover ask_user_questions elicitation 2026-04-10 16:14:34 -05:00
Jeremy
ac1a51ef55 fix: Claude Code MCP tool output rendering and real-time streaming
- Stream tool results in real-time during Claude Code SDK sessions
  instead of deferring until session end. Tool calls (read, bash, write,
  etc.) now show their output as they complete, not collapsed as "..."

- Stop suppressing toolcall_start/delta/end events from stream adapter
  so the TUI can render tool call progress during streaming

- On SDK turn boundary (user message with tool results), push synthetic
  toolcall_end events with externalResult attached for immediate rendering

- Chat controller checks for externalResult on toolcall_end message
  updates and calls updateResult on pending ToolExecutionComponents

- Fix case-sensitive tool name matching (Read vs read, Bash vs bash)
  in TUI ToolExecutionComponent rendering

- Auto-discover and pass GSD_WORKFLOW_EXECUTORS_MODULE and
  GSD_WORKFLOW_WRITE_GATE_MODULE env vars in MCP server launch config

- Add /gsd mcp init command and auto-bootstrap .mcp.json for Claude
  Code provider during auto-start

- Add tool_execution_update event type for web UI streaming updates

- Add setStderrLoggingEnabled toggle for workflow logger
2026-04-10 06:12:44 -05:00
mastertyko
c1f732fae8 fix(update): fetch latest version from registry 2026-04-09 18:39:16 +02:00
mastertyko
266f02147d fix(cli): honor custom-provider defaults before onboarding 2026-04-09 18:03:00 +02:00
Jeremy McSpadden
dde62ebc75 Merge pull request #3865 from mastertyko/fix/3786-provider-manager-non-oauth-auth
fix(pi-coding-agent): avoid OAuth login for API-key providers
2026-04-09 08:46:34 -05:00
Jeremy McSpadden
76d3925ea7 Merge pull request #3863 from mastertyko/fix/3848-pi-ai-event-stream-factory
fix(pi-ai): restore event stream factory export
2026-04-09 08:09:03 -05:00
mastertyko
c671e3912f fix(pi-coding-agent): avoid oauth login for api-key providers 2026-04-09 15:08:33 +02:00
Jeremy
82944a845d fix(platform): harden command execution and stabilize onboarding sync 2026-04-09 06:39:19 -05:00
mastertyko
ebf5ca398a fix(pi-ai): restore event stream factory export 2026-04-09 13:03:27 +02:00
Jeremy
d98456cad7 test(pi-tui): add regression tests for slash command TUI interactions
Add 3 new tests covering editor↔selector/input component swaps that
happen during /gsd prefs, /gsd migrate, and /gsd setup:

- editor-to-selector swap: verifies cursor tracking when editor with
  CURSOR_MARKER is replaced by a selector without one
- selector-to-editor swap: verifies cursor restores to CURSOR_MARKER
  position when editor returns after selector dismissal
- input component swap: verifies typing in prefs wizard text input
  produces correct cursor movement without jumps

All tests confirm hardwareCursorRow baseline computes correct movement
deltas for these interactive component transitions.
2026-04-08 12:09:21 -05:00
Jeremy
c0236254a2 fix(pi-tui): revert contentCursorRow, use hardwareCursorRow as movement baseline
PR #3744 and #3765 introduced contentCursorRow which diverges from the
actual terminal cursor position after IME repositioning. computeLineDiff
computes ANSI escape movements which are relative to where the cursor
physically is — that must be hardwareCursorRow, not a phantom position.

Remove contentCursorRow entirely and revert computeLineDiff baseline to
hardwareCursorRow. The ghost-line test was asserting wrong movement
direction (UP from phantom position vs DOWN from actual cursor).

Closes #3764
2026-04-07 23:37:52 -05:00
Jeremy
a28a56b3e4 test(pi-tui): add regression tests for contentCursorRow tracking
Verify that contentCursorRow is correctly maintained across renders
and that IME repositioning does not cause spurious cursor jumps
during normal typing or content shrinking.

Refs #3764
2026-04-07 22:39:00 -05:00
mastertyko
9f4666be61 fix: clear autocomplete rows from content bottom
Use the rendered content row as the shrink diff baseline instead of\nreusing the IME hardware cursor row. Add a focused TUI regression test\nthat reproduces the ghost-line cleanup path when autocomplete shrinks.\n\nCloses #3721
2026-04-08 01:25:31 +02:00
Alan Alwakeel
6d96386cc5 test: add test isolation and pause wiring tests
- worktree.ts: Added _resetServiceCache() for test isolation
- test-isolation.ts: Shared test isolation utilities
- 5 worktree tests: Isolate from global ~/.gsd/preferences.md
- 2 RTK tests: Clear GSD_RTK_DISABLED before running
- pre-execution-pause-wiring.test.ts: Pause wiring integration tests
- preferences.ts: Add enhanced_verification to mergePreferences
2026-04-07 11:35:12 -04:00
Jeremy McSpadden
0163b5b5bf Merge pull request #3685 from Tibsfox/fix/mcp-server-subpath-imports
fix(mcp): use createRequire to resolve SDK wildcard subpath imports
2026-04-07 07:04:38 -05:00
Tibsfox
faf8c95c8a test: add regression test for provider manager Enter key handler
Structural verification that selectConfirm handler and onSetupAuth
callback exist in provider-manager.ts (#3579).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-06 22:25:26 -07:00
Tibsfox
26d1222096 test: add regression test for MCP createRequire subpath resolution
Structural verification that createRequire import and _require.resolve
usage exist in mcp-server.ts (#3603).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-06 22:24:58 -07:00
Jeremy McSpadden
42caabdd0d Merge pull request #3563 from Tibsfox/fix/headless-discuss-multi-turn
fix(headless): treat discuss and plan as multi-turn commands
2026-04-06 15:58:04 -05:00
deseltrus
4744e86c8f test: structural regression tests for session memory/CPU leak fixes
Verifies that defensive guards (render-skip, chat cap, dispose, signal
handler cleanup, alert cap, orphan kill) are present in source. These
are structural tests because the leaks manifest over hours of real
usage, not in unit test timescales.
2026-04-06 09:57:40 +02:00
Jeremy
0d92f2fbba test(ui): add regression test for full-width separator lines
Verifies separator lines extend to the full terminal width when
the terminal is wider than 200 columns.
2026-04-05 17:57:23 -05:00
Jeremy McSpadden
d1b7f6f85c Merge pull request #3570 from Tibsfox/fix/headless-query-extension-drift
fix(headless): sync resources and use agent dir for query
2026-04-05 16:05:56 -05:00
Jeremy McSpadden
46b18818a6 Merge pull request #3561 from Tibsfox/fix/ollama-fallback-provider-ready
fix(pi-coding-agent): make Ollama visible to fallback resolver
2026-04-05 15:59:20 -05:00
Tibsfox
4b68e8c9d9 test(headless): add extension path alignment test 2026-04-05 11:57:40 -07:00
Tibsfox
469acf53af test(cli): add update diagnostics regression test 2026-04-05 11:57:25 -07:00
Tibsfox
a3f2de828e test(cli): add node_modules symlink regression test 2026-04-05 11:56:58 -07:00
Tibsfox
3213cd8c80 test(headless): add multi-turn command classification test 2026-04-05 11:56:44 -07:00
Tibsfox
d4b6eb714c test(pi-coding-agent): add custom provider registration test 2026-04-05 11:56:29 -07:00