Repository navigation
feat(opencode-kit): add typed job client, job model, and background-result parser - #242
Merged
Merged
Conversation
…esult parser Add the opencode-kit protocol and model layer for background work (ports anomalyco/opencode#64343, #63666, #64966, and the parser half of #64971): - model::job: typed JobInfo, JobKind (Shell, Subagent, Image, Video, CodeMode, Unknown), JobStatus, JobTime, JobListQuery, tolerant JSON and experimental.job.updated SSE parsers, merge_job_list, and the explicit JobTracker state machine with an Unsupported phase for older servers. - client::jobs: Server::list_jobs and Server::cancel_job in a dedicated submodule, returning JobEndpoint::Unsupported on 404/405/501 (excluding SessionNotFoundError) while preserving typed WireError for auth, captive portals, and transport failures. - model::background_result: parse_background_result accepting unified <background-result kind="..."> blocks (#64971) and legacy <shell>, <subagent>, <codemode>, <image>, and <video> blocks, tolerating unknown kinds without dropping or crashing.
|
PR test build retired — merged into |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Adds the reusable
opencode-kitprotocol client, typed job model, explicit race-safe job tracker state machine, and<background-result>notice parser for background work (foundation for anomalyco/opencode#64343, #63666, #64790, #64966, and #64971):crates/opencode-kit/src/model/job.rs: TypedJobInfo,JobKind(Shell,Subagent,Image,Video,CodeMode,Unknown),JobStatus(includingUnknown),JobTime,JobListQuery, tolerant JSON andexperimental.job.updatedSSE parsers,merge_job_list(#64966), and the explicitJobTrackerstate machine (Idle/Loading/Unsupported) that buffers in-flight SSE events over late HTTP list responses and caches older-serverUnsupportedper connection.crates/opencode-kit/src/client/jobs.rs: Dedicated client submodule (Server::list_jobs,Server::cancel_job) returningResult<JobEndpoint<T>, WireError>. Treats404/405/501(excludingSessionNotFoundError404s fromJobHandler.list) asJobEndpoint::Unsupportedfor older OpenCode servers (v2.2.6,v2.3.0, pre-17 Novdev) while preserving typedWireErrorfor auth, captive portals, and transport failures.crates/opencode-kit/src/model/background_result.rs:parse_background_resultsupporting unified<background-result kind="...">blocks (#64971) and legacy<shell>,<subagent>,<codemode>,<image>, and<video>blocks, tolerating unknown kinds and unescaped quotes/>insidecommand/descriptionattributes without dropping or panicking.Verification
pwsh scripts/guardrails.ps1: 5/5 passed (arch-check,file-size,folder-shape,dialog-size,tables-check).cargo clippy -p opencode-kit --no-deps --all-targets -- -D warnings: 0 warnings.cargo check --workspace: passed.pwsh scripts/web.ps1 -Check:opencode-webwasm32-unknown-unknownclean,web-clock995 files / 46 crates clean.e51247f626): confirmedGET /api/experimental/job(200{"data":[]}),GET /api/experimental/job?sessionID=<missing>(404_tag: "SessionNotFoundError"),POST /api/experimental/job/:id/cancel(204 empty), and missing route (404 empty body).