Commit graph

381 commits

Author SHA1 Message Date
Tom Boucher
2ea668ee09 fix: handle pause_turn stop reason to prevent 400 errors with native web search (#2869) (#3248)
Map pause_turn to "pauseTurn" instead of "stop" so the agent loop
continues when Anthropic's server pauses a long-running turn (e.g.
native web search hitting its iteration limit). Previously the
incomplete server_tool_use block was saved to history, causing a
400 invalid_request_error on the next API call.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-30 13:51:18 -06:00
Tom Boucher
a725fa2d9d fix: classify long-context entitlement 429 as quota_exhausted, not rate_limit (#2803) (#3257)
The "Extra usage is required for long context requests" error from
Anthropic is a billing gate, not a transient rate limit. Classify it as
quota_exhausted so the handler enters the fallback path instead of an
infinite backoff loop. When no cross-provider fallback exists, attempt a
[1m] to base model downgrade before stopping cleanly.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-30 13:50:36 -06:00
Tom Boucher
3d896eee8a fix: skip TUI render loop on non-TTY stdout to prevent CPU burn (#3095) (#3263)
When gsd is spawned as an RPC bridge child process, stdout is a pipe
(process.stdout.isTTY === undefined). The TUI render loop would run at
~4,600 renders/sec writing ANSI escape codes to the pipe, consuming
500%+ CPU per process while idle.

Add isTTY guard to Terminal interface, ProcessTerminal.start(), TUI.start(),
and requestRender() so the entire render pipeline is skipped on non-TTY stdout.
RemoteTerminal (browser-backed) correctly reports isTTY=true.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-30 13:49:55 -06:00
TÂCHES
efe61c2fcc wip: M005 daemon — orchestrator, event bridge, formatter, batcher improvements (#2929)
Saves in-progress daemon work from M005-m138xe that was sitting uncommitted.
Includes orchestrator expansion, event bridge/formatter enhancements,
message batcher tweaks, and discord bot additions.
2026-03-27 20:22:30 -06:00
github-actions[bot]
1783559610 release: v2.58.0 2026-03-28 02:14:33 +00:00
TÂCHES
8d0a81ff89 Merge pull request #2925 from gsd-build/fix/2923-double-startauto-race
fix(auto): guard startAuto() against concurrent invocation
2026-03-27 19:45:38 -06:00
github-actions[bot]
ab7961000e release: v2.57.0 2026-03-28 00:06:04 +00:00
TÂCHES
a2705218f7 Merge pull request #2890 from Matt-Aurora-Ventures/feat/zai-glm-models
feat(models): add GLM-5.1 to Z.AI provider
2026-03-27 17:38:48 -06:00
Lex Christopherson
eb2cfa580c fix: Fixed 3 bugs (launchd JSON parsing, login race condition, interact…
- "packages/daemon/src/launchd.ts"
- "packages/daemon/src/discord-bot.ts"
- "packages/daemon/src/launchd.test.ts"

GSD-Task: S07/T02
2026-03-27 17:17:40 -06:00
Matt Haynes
9b3c21f25a test(models): add GLM-5.1 custom model tests
Tests cover: provider registration, base URL + API type, reasoning +
context window specs, and non-collision with generated zai models.

Required by CI lint gate (require-tests.sh).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-27 16:48:11 -06:00
Lex Christopherson
0de87955d3 feat: Added 6 discord.js shard/error/warn event listeners for reconnect…
- "packages/daemon/src/discord-bot.ts"
- "packages/daemon/src/daemon.ts"
- "packages/daemon/src/daemon.test.ts"

GSD-Task: S06/T02
2026-03-27 16:20:10 -06:00
Lex Christopherson
14297845e9 test: Created launchd.ts with plist XML generation, install/uninstall/s…
- "packages/daemon/src/launchd.ts"
- "packages/daemon/src/launchd.test.ts"
- "packages/daemon/src/cli.ts"
- "packages/daemon/src/index.ts"

GSD-Task: S06/T01
2026-03-27 16:16:44 -06:00
Lex Christopherson
d1c948086e merge: Resolve conflicts with origin/main
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-27 15:56:48 -06:00
Lex Christopherson
898e797772 feat: Extended DaemonConfig with control_channel_id and orchestrator se…
- "packages/daemon/src/types.ts"
- "packages/daemon/src/config.ts"
- "packages/daemon/src/daemon.ts"
- "packages/daemon/src/discord-bot.ts"
- "packages/daemon/src/discord-bot.test.ts"
- "packages/daemon/src/index.ts"

GSD-Task: S05/T02
2026-03-27 15:46:58 -06:00
Lex Christopherson
bbba5f83b9 test: Built Orchestrator class with 5 LLM tool definitions, tool-use ag…
- "packages/daemon/src/orchestrator.ts"
- "packages/daemon/src/orchestrator.test.ts"
- "packages/daemon/package.json"

GSD-Task: S05/T01
2026-03-27 15:39:53 -06:00
github-actions[bot]
b5715c20bb release: v2.56.0 2026-03-27 21:29:07 +00:00
Lex Christopherson
6ef99ee727 test: Wired EventBridge into Daemon lifecycle with /gsd-verbose slash c…
- "packages/daemon/src/commands.ts"
- "packages/daemon/src/discord-bot.ts"
- "packages/daemon/src/daemon.ts"
- "packages/daemon/src/index.ts"
- "packages/daemon/src/discord-bot.test.ts"

GSD-Task: S04/T04
2026-03-27 15:17:53 -06:00
Lex Christopherson
f26ec3a55d test: Built EventBridge orchestrator wiring session events to Discord w…
- "packages/daemon/src/event-bridge.ts"
- "packages/daemon/src/event-bridge.test.ts"

GSD-Task: S04/T03
2026-03-27 15:11:52 -06:00
Lex Christopherson
05abf86912 test: Built rate-limit-aware MessageBatcher with timer/capacity flush,…
- "packages/daemon/src/message-batcher.ts"
- "packages/daemon/src/message-batcher.test.ts"

GSD-Task: S04/T02
2026-03-27 15:04:55 -06:00
Lex Christopherson
4c8bbca46f feat: Created pure-function event formatters (10 functions) mapping RPC…
- "packages/daemon/src/event-formatter.ts"
- "packages/daemon/src/verbosity.ts"
- "packages/daemon/src/event-formatter.test.ts"
- "packages/daemon/src/verbosity.test.ts"
- "packages/daemon/src/types.ts"
- "packages/daemon/src/config.ts"

GSD-Task: S04/T01
2026-03-27 15:01:19 -06:00
Matt Haynes
64f0a5e7b3 feat(models): add GLM-5.1 to Z.AI provider in custom models
GLM-5.1 is the latest Zhipu AI model with 204K context window and
131K max output tokens. It uses the Z.AI Coding Plan endpoint
(OpenAI-compatible) and supports reasoning via enable_thinking.

Not yet tracked by models.dev, so added to models.custom.ts alongside
existing alibaba-coding-plan entries. Merges additively with the
generated Z.AI provider (glm-5, glm-5-turbo, etc.).

Specs from https://docs.z.ai/devpack/using5.1

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-27 14:49:43 -06:00
github-actions[bot]
a6bb48e82d release: v2.55.0 2026-03-27 20:44:58 +00:00
Lex Christopherson
b5adaf2d9f test: Created commands.ts with slash command definitions and registrati…
- "packages/daemon/src/commands.ts"
- "packages/daemon/src/discord-bot.ts"
- "packages/daemon/src/discord-bot.test.ts"
- "packages/daemon/src/index.ts"

GSD-Task: S03/T03
2026-03-27 14:43:03 -06:00
Lex Christopherson
d13885a54e test: Built ChannelManager with category resolution, channel create/arc…
- "packages/daemon/src/channel-manager.ts"
- "packages/daemon/src/discord-bot.test.ts"

GSD-Task: S03/T02
2026-03-27 14:39:00 -06:00
Lex Christopherson
31af5ecfbd feat: Added discord.js v14, DiscordBot class with auth guard and lifecy…
- "packages/daemon/src/discord-bot.ts"
- "packages/daemon/src/discord-bot.test.ts"
- "packages/daemon/src/daemon.ts"
- "packages/daemon/src/index.ts"
- "packages/daemon/package.json"

GSD-Task: S03/T01
2026-03-27 14:33:36 -06:00
Lex Christopherson
7732558d04 test: Wired scanner and session manager into Daemon with scanProjects()…
- "packages/daemon/src/daemon.ts"
- "packages/daemon/src/index.ts"
- "packages/daemon/src/daemon.test.ts"

GSD-Task: S02/T03
2026-03-27 14:20:02 -06:00
Lex Christopherson
5910c6523e test: Built SessionManager with EventEmitter lifecycle events, Logger i…
- "packages/daemon/src/session-manager.ts"
- "packages/daemon/src/session-manager.test.ts"
- "packages/daemon/src/types.ts"
- "packages/daemon/package.json"

GSD-Task: S02/T02
2026-03-27 14:15:18 -06:00
Lex Christopherson
9af08f6480 test: Extended daemon types with session management interfaces and buil…
- "packages/daemon/src/types.ts"
- "packages/daemon/src/project-scanner.ts"
- "packages/daemon/src/project-scanner.test.ts"

GSD-Task: S02/T01
2026-03-27 14:08:04 -06:00
Lex Christopherson
2a0d63accd test: Built Daemon class with lifecycle management, CLI entry point wit…
- "packages/daemon/src/daemon.ts"
- "packages/daemon/src/cli.ts"
- "packages/daemon/src/daemon.test.ts"
- "packages/daemon/src/index.ts"

GSD-Task: S01/T03
2026-03-27 13:52:58 -06:00
Lex Christopherson
fa2bde5677 test: Implemented YAML config loader with validation/defaults and struc…
- "packages/daemon/src/config.ts"
- "packages/daemon/src/logger.ts"
- "packages/daemon/src/daemon.test.ts"

GSD-Task: S01/T02
2026-03-27 13:43:46 -06:00
Lex Christopherson
c37eb1a5c3 feat: Created packages/daemon workspace package with DaemonConfig/LogLe…
- "packages/daemon/package.json"
- "packages/daemon/tsconfig.json"
- "packages/daemon/src/types.ts"
- "packages/daemon/src/index.ts"

GSD-Task: S01/T01
2026-03-27 13:40:25 -06:00
mastertyko
c5907c3677 fix(interactive): fully remove providers from /providers (#2852)
* test(integration): suppress npm pack buffer overflows

* fix(interactive): fully remove providers from /providers
2026-03-27 09:53:35 -06:00
github-actions[bot]
97de0a6d94 release: v2.54.0 2026-03-27 14:54:34 +00:00
TÂCHES
a91b8bec34 feat: Headless Integration Hardening & Release (M002) (#2811)
* feat: Migrated headless orchestrator to use execution_complete events,…

- "src/headless.ts"
- "src/headless-ui.ts"
- "src/tests/headless-v2-migration.test.ts"

GSD-Task: S06/T02

* test: Wired pi-coding-agent to re-export JSONL utils from @gsd/rpc-clie…

- "packages/pi-coding-agent/src/modes/rpc/jsonl.ts"
- "packages/pi-coding-agent/package.json"
- "packages/rpc-client/src/index.ts"
- "packages/rpc-client/src/jsonl.ts"
- "packages/rpc-client/src/rpc-client.ts"
- "packages/rpc-client/src/rpc-types.ts"
- "packages/rpc-client/src/rpc-client.test.ts"
- "packages/rpc-client/package.json"

GSD-Task: S06/T03

* feat: Wire --resume flag to resolve session IDs via prefix matching and…

- "src/headless.ts"
- "dist/headless.js"

GSD-Task: S01/T01

* test: Added 5 e2e integration tests proving headless JSON batch, SIGINT…

- "src/tests/integration/e2e-headless.test.ts"

GSD-Task: S01/T02

* test: Updated @gsd/rpc-client and @gsd/mcp-server to 2.52.0 with publis…

- "packages/rpc-client/package.json"
- "packages/mcp-server/package.json"
- "packages/rpc-client/.npmignore"
- "packages/mcp-server/.npmignore"

GSD-Task: S02/T01

* chore: auto-commit after complete-milestone

GSD-Unit: M002-gzq23a

* fix: revert jsonl.ts to inline implementation — @gsd-build/rpc-client not available at source-level test time in CI

The re-export from @gsd-build/rpc-client fails in CI because tests run against
TypeScript source (--experimental-strip-types) before any build step. The npm
dependency resolves to node_modules/ which requires dist/ to exist. Reverting
to the original inline implementation eliminates the cross-package dependency
for source-level imports.
2026-03-26 23:33:22 -06:00
Lex Christopherson
98eb2ae802 fix: revert jsonl.ts to inline implementation — @gsd-build/rpc-client not available at source-level test time in CI
The re-export from @gsd-build/rpc-client fails in CI because tests run against
TypeScript source (--experimental-strip-types) before any build step. The npm
dependency resolves to node_modules/ which requires dist/ to exist. Reverting
to the original inline implementation eliminates the cross-package dependency
for source-level imports.
2026-03-26 23:20:53 -06:00
Lex Christopherson
2cc7653efb chore: auto-commit after complete-milestone
GSD-Unit: M002-gzq23a
2026-03-26 22:57:10 -06:00
Lex Christopherson
b22f5d5bd6 test: Updated @gsd/rpc-client and @gsd/mcp-server to 2.52.0 with publis…
- "packages/rpc-client/package.json"
- "packages/mcp-server/package.json"
- "packages/rpc-client/.npmignore"
- "packages/mcp-server/.npmignore"

GSD-Task: S02/T01
2026-03-26 22:13:27 -06:00
github-actions[bot]
112090706e release: v2.53.0 2026-03-27 02:50:02 +00:00
Lex Christopherson
bb6d64a5ba test: Wired pi-coding-agent to re-export JSONL utils from @gsd/rpc-clie…
- "packages/pi-coding-agent/src/modes/rpc/jsonl.ts"
- "packages/pi-coding-agent/package.json"
- "packages/rpc-client/src/index.ts"
- "packages/rpc-client/src/jsonl.ts"
- "packages/rpc-client/src/rpc-client.ts"
- "packages/rpc-client/src/rpc-types.ts"
- "packages/rpc-client/src/rpc-client.test.ts"
- "packages/rpc-client/package.json"

GSD-Task: S06/T03
2026-03-26 20:17:05 -06:00
github-actions[bot]
34bbee21bc release: v2.52.0 2026-03-27 00:07:48 +00:00
TÂCHES
1c2d7ab307 fix: add missing runtime stage name to Dockerfile (#2765)
* feat: Registered 6 MCP tools (gsd_execute, gsd_status, gsd_result, gsd_…

- "packages/mcp-server/src/server.ts"
- "packages/mcp-server/src/cli.ts"
- "packages/mcp-server/src/index.ts"
- "packages/rpc-client/dist/index.d.ts"

GSD-Task: S05/T02

* docs: Added 31 integration tests, build pipeline, and consumer README f…

- "packages/mcp-server/src/mcp-server.test.ts"
- "packages/mcp-server/README.md"
- "packages/mcp-server/dist/"

GSD-Task: S05/T03

* fix: add missing runtime stage name to Dockerfile

CI pipeline uses `docker build --target runtime` but the FROM line
lacked the `AS runtime` alias, causing the build to fail.

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-26 17:52:45 -06:00
Jeremy McSpadden
f8814f5a15 refactor(pi-ai): replace model-ID pattern matching with capability metadata (#2548)
* refactor(pi-ai): replace model-ID pattern matching with capability metadata

Add ModelCapabilities to Model<TApi> and a CAPABILITY_PATCHES mechanism
so call sites read model.capabilities fields instead of parsing model IDs
or hardcoding provider names.

- types.ts: add ModelCapabilities interface (supportsXhigh, requiresToolCallId,
  supportsServiceTier, charsPerToken) and capabilities?: ModelCapabilities to
  Model<TApi>
- models.ts: add CAPABILITY_PATCHES table applied at registry init; patches
  declare GPT-5.x and Opus 4.6 capabilities once instead of repeating ID
  checks at every call site; supportsXhigh() now reads capabilities only
- service-tier.ts: extract SERVICE_TIER_MODEL_PREFIXES constant so the gating
  list has a single named home; add path comment pointing to issue #2546 for
  the full capability-driven follow-up

No behaviour change. New models and providers can declare capabilities in
their model definitions without touching function logic.

Closes #2546

* fix(pi-ai): apply capability patches to custom/discovered/extension models

Models constructed outside the static pi-ai registry (custom models
from models.json, extension-registered models, discovered models)
bypassed CAPABILITY_PATCHES — causing supportsXhigh() to silently
return false for GPT-5.x or Opus 4.6 variants registered through
those paths.

Export applyCapabilityPatches() from pi-ai and call it in ModelRegistry
after model assembly in all three construction paths: loadModels(),
applyProviderConfig(), and discoverModels().

Add regression tests covering patching, precedence, idempotency,
and synthetic models that mimic the custom/extension path.

Closes #2546
2026-03-26 16:38:29 -06:00
TÂCHES
41dda26b9a Merge pull request #2748 from gsd-build/fix/2743-web-search-duplicate-rendering
fix: Remove premature pendingTools.delete causing web_search duplicate rendering
2026-03-26 16:08:39 -06:00
Matt Haynes
c557aea8de fix(windows): prevent EINVAL by disabling detached process groups on Win32 (#2744)
On Windows, `spawn()` with `detached: true` sets the
CREATE_NEW_PROCESS_GROUP flag in CreateProcess. In certain terminal
contexts — notably VSCode's integrated terminal (ConPTY), Windows
Terminal, and some MSYS2/Git Bash configurations — this flag conflicts
with the parent process group hierarchy and causes a synchronous EINVAL
from libuv, making *every* bash/async_bash/bg_shell command fail
immediately with `spawn EINVAL`.

The bg-shell extension already guards against this with
`detached: process.platform !== "win32"` (process-manager.ts:109),
but three other spawn sites were missed:

- `packages/pi-coding-agent/src/core/tools/bash.ts` (bash tool)
- `packages/pi-coding-agent/src/core/bash-executor.ts` (RPC executor)
- `src/resources/extensions/async-jobs/async-bash-tool.ts` (async_bash)

This commit aligns all spawn sites with the bg-shell pattern.

Additionally fixes two related issues:

1. `killProcessTree()` in shell.ts used `detached: true` on its own
   `taskkill` spawn call — unnecessary and potentially problematic
   in the same terminal contexts. Removed.

2. `killTree()` in async-bash-tool.ts used Unix-only
   `process.kill(-pid)` with no Windows fallback. On Windows, negative
   PIDs (process group kill) are not supported, so orphaned child
   processes could survive timeout kills. Now uses `taskkill /F /T`
   on Windows, matching the bg-shell and shell.ts implementations.

Includes a regression test that statically verifies no spawn site
uses unconditional `detached: true`, plus a smoke test confirming
the platform-guarded pattern works on all platforms.

Reproduction: Run GSD v2.42-v2.51 inside VSCode on Windows 11 with
Git Bash as the shell. Any bash tool call fails with `spawn EINVAL`.
The error is 100% reproducible and affects all shell operations
(bash, async_bash, bg_shell start).

Co-authored-by: Matt Haynes <matt@auroraventures.io>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-26 16:08:03 -06:00
Lex Christopherson
ef310574da fix: Remove premature pendingTools.delete in webSearchResult handler (#2743)
The webSearchResult branch deleted entries from pendingTools after rendering,
which removed the duplicate-prevention guard. Subsequent streaming tokens
re-iterated content blocks, re-created the serverToolUse component, and
re-rendered the search result — producing 18+ duplicate blocks.

The message_end handler already calls pendingTools.clear(), so the explicit
deletes were unnecessary and harmful.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-26 16:03:07 -06:00
Lex Christopherson
c5b38d69e3 feat: Wire --bare mode across headless → pi-coding-agent → resource-loa…
- "src/headless.ts"
- "packages/pi-coding-agent/src/cli/args.ts"
- "packages/pi-coding-agent/src/main.ts"
- "src/tests/headless-cli-surface.test.ts"

GSD-Task: S02/T02
2026-03-26 11:39:25 -06:00
Lex Christopherson
4d218353ac test: Added 61 tests across 9 suites covering JSONL utilities, v2 type…
- "packages/pi-coding-agent/src/modes/rpc/rpc-protocol-v2.test.ts"

GSD-Task: S01/T03
2026-03-26 11:12:04 -06:00
Lex Christopherson
c5bc9208c4 feat: Added runId generation on prompt/steer/follow_up commands, event…
- "packages/pi-coding-agent/src/modes/rpc/rpc-mode.ts"
- "packages/pi-coding-agent/src/modes/rpc/rpc-client.ts"
- "packages/pi-coding-agent/src/modes/rpc/rpc-types.ts"

GSD-Task: S01/T02
2026-03-26 11:05:32 -06:00
Lex Christopherson
01e37670e1 feat: Added RPC protocol v2 types, init handshake with version detectio…
- "packages/pi-coding-agent/src/modes/rpc/rpc-types.ts"
- "packages/pi-coding-agent/src/modes/rpc/rpc-mode.ts"
- "packages/pi-coding-agent/src/modes/rpc/rpc-client.ts"
- "packages/pi-coding-agent/src/modes/index.ts"
- "packages/pi-coding-agent/src/index.ts"

GSD-Task: S01/T01
2026-03-26 11:01:58 -06:00
github-actions[bot]
913984c26e release: v2.51.0 2026-03-26 15:58:14 +00:00