-
Notifications
You must be signed in to change notification settings - Fork 3k
feat(sdk): Add standalone session APIs #10294
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| # Standalone PR4 TypeScript SDK Implementation Plan | ||
|
|
||
| ## Scope | ||
|
|
||
| Build the TypeScript SDK surface for the `standalone_sessions_v1` daemon API introduced by PR #10179. This stage changes only `packages/sdk-typescript` plus this implementation plan. WebUI, WebShell, daemon routes, and standalone lifecycle semantics remain out of scope. | ||
|
|
||
| The implementation is stacked on PR #10179 at `fbd3bf32bd207424e39bb7063728807f873d1668`. Before publication against `main`, rebase onto the merged PR3 result and re-audit the final route contract. | ||
|
|
||
| ## Public API | ||
|
|
||
| - Add narrow standalone session, restored session, summary, lookup, list, working-directory, metadata, batch, and creation-recovery types. | ||
| - Add capability-gated `DaemonClient` methods for create, list, exact lookup, load, resume, repair, rename, export, archive, unarchive, and delete. | ||
| - Let create accept an optional caller UUID; otherwise generate a UUID before the request. Never retry the create request. | ||
| - On a structured `standalone_creation_outcome_unknown` response, malformed successful response, or transport-level unknown outcome, perform one exact lookup and throw an error containing the generated UUID and the observed recovery state. | ||
| - Add `DaemonSessionClient` standalone create/load/resume factories and store an explicit restore strategy. Reattach workspace sessions by cwd and standalone sessions through the dedicated route. | ||
| - Runtime-validate every new JSON response before exposing it to consumers. | ||
|
|
||
| ## Compatibility and failure behavior | ||
|
|
||
| - Every standalone method first requires `standalone_sessions_v1`; an old daemon fails before any standalone route is called. | ||
| - Standalone request types cannot express `workspaceCwd`, source, scope, branch, or worktree overrides. | ||
| - Exact lookup preserves the daemon's `202 creating`, `200 existing`, and `404 standalone_session_not_found` contract. | ||
| - A definite HTTP rejection remains a `DaemonHttpError`. Only an unknown create outcome is wrapped with recovery context. | ||
| - Browser code uses `globalThis.crypto.randomUUID()` and introduces no Node-only import. | ||
| - Existing workspace methods and the default workspace restore behavior remain source-compatible. | ||
|
|
||
| ## Verification | ||
|
|
||
| - Request-shape tests for every route, including query encoding and client identity headers. | ||
| - Capability-absence tests proving no standalone request is sent. | ||
| - Create tests for generated and caller UUIDs, canonical response identity, structured outcome unknown, transport timeout, malformed success, and `202/200/404` lookup recovery. | ||
| - Runtime-validation tests for malformed sessions, summaries, working-directory results, metadata, and batch results. | ||
| - `DaemonSessionClient` tests for standalone create/load/resume and standalone versus workspace reattach. | ||
| - Public export type checks, TypeScript package tests, typecheck, lint, formatting, Node/browser builds, repository build, and repository typecheck. | ||
|
|
||
| ## Audit decisions | ||
|
|
||
| - Keep HTTP ownership in `DaemonClient` and session-bound recovery in `DaemonSessionClient`; do not add another standalone client object. | ||
| - Keep validators in one standalone-specific leaf module to avoid expanding the already-large general daemon type file and to keep runtime checks reusable without UI dependencies. | ||
| - Perform exactly one automatic exact lookup after an unknown create result. Do not poll, load, resume, or issue a second create automatically; the caller retains control over further recovery. | ||
| - Do not cache capability results in PR4. Existing SDK capability checks are live probes, and adding cache invalidation would broaden this stage. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.