Repository navigation
Commit 5fc3468
feat: subscribe_v2 sessions, session reclaim, plan review, and TypeScript 7 (#402)
## Requirement or Bug
Bring in the next batch of engine, server, and TUI fixes and features,
plus TypeScript 7.
## Bug Reproduction Steps
N/A
## Root Cause
N/A
## Code Changes
Engine (`packages/agent-core-v2`):
- idle session reclaim on the server; session-lock takeover for locks
left by exited processes; zombie-lock reclaim
- Plan mode: only the user leaves Plan mode, and every plan goes to
review
- MCP: auto-reconnect after transient failures, wait for discovery
before tool announcements, idle OAuth callback cleanup
- LLM core moved into `human/llm` (protocols, requester composition,
media); our native fixes moved with it: DSML/Hermes text tool-call
recovery now lives in the OpenAI decoder, and OpenAI 401/402/403 billing
rejections still map to a provider error
- media recovery kept across turns and compaction; images can upload
through the provider Files API
- subagents limited to the `[secondary_model]` pool; `force` removed (a
lone `default_model` pins)
- workspace registry with several source folders; append-log recovery
after disk-full; code-point-safe tool-result truncation
- turn-start model fallback (`resolveModelContext(turnId)`) and the
OpenCode `x-opencode-session` header kept
Server (`packages/agent-gateway`):
- `subscribe_v2` replaces `subscribe`/`unsubscribe`; approvals and
questions arrive as interaction frames; snapshot route and roster
tracker removed
- WebSocket limits re-applied on the new path: 4 MiB payload, 64
subscriptions, 32 queued controls, outbound overflow and slow-consumer
disconnects; a subscription that completes after the socket closed is
released
- PTY terminal routes removed; config-domain allowlist and reload
quiescence kept
CLI (`apps/pythinker-code`):
- import Claude Code and Codex sessions (`/import-sessions`, new
`packages/session-import`), `/provider refresh`, expandable streaming
thinking, todo list as a transcript card, compacting spinner, OSC 7501
program status
- login prompts now settle when another panel replaces them (a pending
`/login` could hang)
- Dynamic Workflow naming fixed in prompts and command help
Tooling: TypeScript 7.0.2 and tsdown 0.23.1 across the workspace;
`apps/pythinker-web` stays on TypeScript 6.0.3 because `vue-tsc` needs
the compiler API that TypeScript 7 removed. `flake.nix` pnpmDeps hash
refreshed.
## Behavior Changes and Affected Users
| Behavior | Before | After | Who relies on the old behavior | Escape
hatch |
| --- | --- | --- | --- | --- |
| WebSocket session subscription | `subscribe` / `unsubscribe` frames,
`/sessions/{id}/snapshot` | `subscribe_v2` / `unsubscribe_v2` only;
snapshot route removed | External `pythinker web` clients built on the
old frames | None (major, approved); in-repo web, desktop, VS Code
clients updated |
| PTY terminals | `/api/v1/sessions/{id}/terminals` on loopback |
Removed | Scripts using the terminal API | None (major, approved) |
| Plan mode exit | Agent could leave Plan mode itself | Only the user
leaves; every plan is reviewed | Unattended runs that relied on
self-exit | None; approve the plan in review |
| `[secondary_model] force` | Pinned subagents | Ignored with a warning;
a lone `default_model` pins | Configs with `force = true` | Remove
`force`; behavior is the same |
| Idle `pythinker web` sessions | Stayed in memory | Unloaded after 30
minutes idle, resumed on access | Long-idle web sessions |
`PYTHINKER_CODE_SESSION_IDLE_RECLAIM_MS` |
| Session lock held by an exited process | Blocked the session | Offers
a takeover | Nobody | n/a |
| Workspace `local.toml` additional dirs | Loaded only for trusted
workspaces | Loaded regardless of trust (matches the engine's current
trust model) | Untrusted workspaces with a committed `local.toml` | Do
not commit `additional_dir` in untrusted repos |
| OpenAI-compatible providers that write tool calls as text | Recovered
| Still recovered (moved into the new decoder) | DeepSeek/Hermes-style
endpoints | n/a |
Affected modules and coverage: full suite 19,117 passed, 0 failed (1,035
files); targeted suites for the WebSocket limits, DSML recovery (147),
billing errors, subagent policy (108), and survey/session rating.
## Checklist
- [x] I have read the
[CONTRIBUTING](https://github.com/PyModel/pythinker-code/blob/main/CONTRIBUTING.md)
document.
- [ ] I have linked a related issue (external PRs: issue must have a
maintainer's `/approve`).
- [x] I have added tests that prove my feature works.
- [x] The behavior-change table above is complete, and every removed
behavior or flipped default is named in the changeset and either has an
escape hatch or was explicitly approved by a maintainer in this PR.
- [x] Ran `gen-changesets` skill, or this PR needs no changeset.
- [x] Ran `gen-docs` skill, or this PR needs no doc update.
---------
Co-authored-by: Tower Test <tower-test@example.com>1 parent 13465b8 commit 5fc3468
939 files changed
Lines changed: 49892 additions & 27101 deletions
File tree
- .changeset
- .github/workflows
- apps
- desktop
- pythinker-code
- dist-web
- src
- cli
- v2
- migration
- session-import
- tui
- commands
- components
- chrome
- dialogs
- editor
- messages
- tool-renderers
- panes
- constant
- controllers
- reverse-rpc
- approval
- question
- theme
- utils
- test
- cli
- session-import
- tui
- commands
- components
- dialogs
- editor
- messages
- tool-renderers
- panels
- panes
- controllers
- reverse-rpc
- pythinker-inspect
- src
- components
- interactions
- pythinker-web
- vis
- server
- src/lib
- test
- lib
- routes
- web
- src
- components
- context
- wire
- test
- vscode
- src/handlers
- test
- webview-ui/src/components
- docs
- configuration
- customization
- guides
- reference
- packages
- acp-server
- src
- acp-terminal
- test
- _helpers
- agent-core-v2
- docs
- en
- scripts
- src
- _base
- text
- utils
- agent
- changeNotifier
- contextMemory
- contextProjector
- fullCompaction
- llmRequester
- loop
- machine
- mcp
- media
- permissionMode/injection
- permissionPolicy
- policies
- profile
- replayBuilder
- shellCommand
- task
- tokenCounting
- toolApproval
- toolResultTruncation
- toolSelect
- tools
- agent
- ask-user-question
- read-media-file
- task/task-stop
- usage
- app
- agentProfileCatalog
- defaultWorkspace
- kosongConfig
- mcpConfig
- mcpManagement
- projectLocalConfig
- sessionManager
- telemetry
- workspaceAliases
- workspace
- features
- dynamic_workflow
- agent
- session
- tools/agent-dynamic_workflow
- externalHooks
- agent
- session
- goal
- notify
- plan
- injection
- tools
- enter-plan-mode
- exit-plan-mode
- reminder
- skill/catalog/builtin
- todo
- tower
- injection
- protocol
- tools
- plan
- spawn
- status
- human
- agent
- compaction
- credentials
- eventStore
- llm-pythinker
- llm-requester
- llm
- builtin
- protocol
- anthropic
- google-genai
- openai-responses
- openai
- provider
- pythinker
- media
- policy
- protocol
- kit
- rules
- provider
- providers
- requester/bases
- anthropic
- google-genai
- openai-responses
- openai
- media
- pythinker
- models-dev
- persist/v2
- provider-catalog
- provider/providers
- pythinker
- session
- test
- agent
- compaction
- credentials
- eventStore
- llm
- media
- models-dev
- session
- todo
- tool-select
- usage
- tool-select
- usage
- utils
- llm-adapter
- contract
- model
- protocol
- provider
- mcpCore
- oauth
- os
- backends/node-local
- interface
- persistence
- backends
- memory
- node-fs
- interface
- program
- runtime
- session
- agentLifecycle/profile
- sessionActivity
- sessionTitle
- subagent
- terminal
- tokenCounting
- usage
- workspaceInfo
- state
- tool
- wire
- tree
- workspace
- sessionLifecycle
- workspaceContext
- workspaceDirs
- workspaceFs
- workspaceInstance
- workspaceMcpConfig
- workspaceMcp
- workspaceTrust
- test
- .skip
- _base
- text
- utils
- agent
- agentsMdReminder
- blob
- changeNotifier
- contextMemory
- contextProjector
- fullCompaction
- llmRequester
- loop
- mcp
- media
- tools
- permissionGate
- permissionMode
- permissionPolicy
- policies
- profile
- prompt
- questionTools/tools
- replayBuilder
- runtimeBinding
- task
- tools
- tokenCounting
- toolApproval
- toolDedupe
- toolExecutor
- toolResultTruncation
- toolSelect
- undo
- usage
- app
- agentProfileCatalog
- defaultWorkspace
- gateway
- llmProtocol
- mcpManagement
- mcpRegistry
- sessionManager
- workspaceAliases
- workspace
- features
- btw
- dateChange
- dynamic_workflow
- externalHooks
- fileHistory
- goal
- injection
- tools
- notify
- tools
- plan
- injection
- tools
- reminder
- skill
- catalog
- workspace
- todo
- tower
- tools
- harness
- lint
- llm-adapter
- contract
- model
- protocol
- mcpCore
- fixtures
- oauth
- persistence/backends/node-fs
- program
- runtime
- session
- agentLifecycle
- profile
- sessionTitle
- subagent
- terminal
- state
- tool
- wire
- workspace
- sessionLifecycle
- workspaceAgentProfileLoader
- workspaceDirs
- workspaceFs
- workspaceInstance
- workspaceMcpConfig
- workspaceMcp
- workspaceTrust
- agent-gateway
- src
- lib
- middleware
- openapi
- protocol
- routes
- services
- messages
- transcript
- transport
- ws/v1
- test
- __snapshots__
- services
- messages
- klient
- examples
- src
- contract
- agent
- global
- core/facade
- transports/memory
- test
- e2e
- harness
- legacy
- helpers
- migration-legacy
- src
- test
- node-sdk
- src
- config
- v2
- test
- pi-tui
- native/darwin/prebuilds
- darwin-arm64
- darwin-x64
- src
- components
- test
- fixtures
- product
- src/session-rating/node
- test
- session-import
- src
- test
- transcript
- src/history
- test
- scripts
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
0 commit comments