Compare commits

..
Author SHA1 Message Date
Cursor AgentandTheo Browne d41af12fde Assert smoke runtime imports shared fake codex helper
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 16:07:25 +00:00
Cursor AgentandTheo Browne d01bd5e60a Use shared fake-codex helpers for TS tests and smoke runtime
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 16:04:17 +00:00
Cursor AgentandTheo Browne 9e3e806593 Align CI Bun version with workspace toolchain
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 15:58:59 +00:00
Cursor AgentandTheo Browne dd947023a5 Guard smoke script fake-codex independence in architecture tests
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 15:58:28 +00:00
Cursor AgentandTheo Browne 3e0bdaff2f Bundle runtime-core in t3 build configuration
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 15:57:17 +00:00
Cursor AgentandTheo Browne eb38f3c475 Share fake codex test helper across runtime test suites
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 15:49:57 +00:00
Cursor AgentandTheo Browne 8046bd25ca Refresh architecture plan docs for runtime-core ownership
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 15:47:23 +00:00
Cursor AgentandTheo Browne ef331412b3 Clarify fake-codex test behavior and smoke script usage
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 15:43:24 +00:00
Cursor AgentandTheo Browne 3db534fbac Tighten smoke bootstrap expectations under fake codex runtime
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 15:41:49 +00:00
Cursor AgentandTheo Browne 54aec2a00f Use fake codex in smoke tests and cover provider happy-path flows
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 15:39:47 +00:00
Cursor AgentandTheo Browne 796848d2a9 Test bootstrap success path with fake codex runtime
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 15:34:23 +00:00
Cursor AgentandTheo Browne ef0c62df5d Document runtime-core as sole runtime implementation source
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 15:22:26 +00:00
Cursor AgentandTheo Browne 30be248837 Add runtime-core provider lifecycle integration test with fake codex
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 15:20:53 +00:00
Cursor AgentandTheo Browne 0d9f9d1d0f Assert legacy desktop workspace package remains removed
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 15:17:09 +00:00
Cursor AgentandTheo Browne 2b5fc5297d Cover provider approval-response flow with fake codex app-server
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 15:16:08 +00:00
Cursor AgentandTheo Browne 350f6bcf85 Add fake codex integration coverage for provider lifecycle RPCs
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 15:12:56 +00:00
Cursor AgentandTheo Browne f2cd81e0c8 Remove desktop compatibility package after runtime-core migration
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 15:10:22 +00:00
Cursor AgentandTheo Browne 8c74af6c33 Prune obsolete desktop and t3 direct dependencies
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 15:08:02 +00:00
Cursor AgentandTheo Browne 39fb56b2bc Expand t3 architecture guard to all runtime source files
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 15:01:29 +00:00
Cursor AgentandTheo Browne 5a963a63e8 Add runtime-core architecture boundary regression tests
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 15:00:46 +00:00
Cursor AgentandTheo Browne d6d3e6985b Add desktop compatibility-surface guard tests
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 15:00:12 +00:00
Cursor AgentandTheo Browne e67d936a37 Update docs for runtime-core codex and provider ownership
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 14:59:39 +00:00
Cursor AgentandTheo Browne 106f55558e Move codex app-server manager implementation into runtime-core
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 14:58:25 +00:00
Cursor AgentandTheo Browne 97296d42dd Document provider manager in shared runtime-core package role
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 14:52:57 +00:00
Cursor AgentandTheo Browne c27785271b Enforce t3 runtime service boundary through runtime-core
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 14:51:50 +00:00
Cursor AgentandTheo Browne 98d11e156b Route provider manager through shared runtime-core package
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 14:50:11 +00:00
Cursor AgentandTheo Browne 115367db13 Document runtime-core shared service package in repo guides
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 14:37:46 +00:00
Cursor AgentandTheo Browne 1bf5a4e389 Add runtime-core tests for process and todo services
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 14:36:34 +00:00
Cursor AgentandTheo Browne e2cb297b5a Extract process and todo runtime services into shared package
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 14:34:42 +00:00
Cursor AgentandTheo Browne 669e960ff9 Document shared websocket method registry and coverage
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 14:17:46 +00:00
Cursor AgentandTheo Browne 9115604af5 Use shared websocket method schema for runtime dispatch
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 14:16:56 +00:00
Cursor AgentandTheo Browne 2462a90227 Add canonical websocket method list and runtime coverage test
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 14:14:26 +00:00
Cursor AgentandTheo Browne e0a9865d02 Reject empty agent session ids in websocket event envelopes
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 14:04:02 +00:00
Cursor AgentandTheo Browne dd02660502 Require non-empty session ids for agent event payloads
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 14:03:03 +00:00
Cursor AgentandTheo Browne b0113d029e Expand renderer strict nested payload field rejection coverage
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 13:54:29 +00:00
Cursor AgentandTheo Browne 48fdeab3a1 Document nonblank websocket field requirements
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 13:44:45 +00:00
Cursor AgentandTheo Browne 2071e98177 Reject blank websocket ids methods and error fields
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 13:43:54 +00:00
Cursor AgentandTheo Browne 6e3d048d82 Summarize oversized filesystem paths in runtime error messages
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 13:30:12 +00:00
Cursor AgentandTheo Browne c6d7efc213 Cover renderer handling of overlong websocket error responses
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 13:19:54 +00:00
Cursor AgentandTheo Browne a59108c31f Share agent.write input schema across runtime and contracts
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 13:18:28 +00:00
Cursor AgentandTheo Browne ebd984dd4e Share editor and shell-open input schemas in contracts
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 13:16:28 +00:00
Cursor AgentandTheo Browne 3b465089a4 Document bounded websocket error envelope semantics
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 13:14:37 +00:00
Cursor AgentandTheo Browne 170460f6dd Bound websocket error field sizes and sanitize runtime errors
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 13:13:58 +00:00
Cursor AgentandTheo Browne 2cf291e504 Document strict core transport contract object semantics
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 13:02:05 +00:00
Cursor AgentandTheo Browne 2638534226 Make core contract object schemas strict
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 13:01:31 +00:00
Cursor AgentandTheo Browne 2f1eb3d30d Test strict app payload unexpected-field rejection in renderer
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 12:52:36 +00:00
Cursor AgentandTheo Browne a124fd9cb9 Add malformed payload coverage for todo add and provider void RPCs
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 12:50:19 +00:00
Cursor AgentandTheo Browne 6edbcff33c Document over-limit websocket request handling semantics
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 12:47:59 +00:00
Cursor AgentandTheo Browne 6b2bd27c41 Cover max-length unknown websocket method errors end-to-end
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 12:47:25 +00:00
Cursor AgentandTheo Browne d8df4dbecb Use shared websocket id bound constant in renderer tests
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 12:45:39 +00:00
Cursor AgentandTheo Browne 8afca7081f Make app bootstrap and health result schemas strict
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 12:44:49 +00:00
Cursor AgentandTheo Browne 5d13d3cd61 Cover max-length websocket request id boundaries end-to-end
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 12:38:04 +00:00
Cursor AgentandTheo Browne f57cff53e6 Document dialogs and agent coverage in renderer payload validation
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 12:30:48 +00:00
Cursor AgentandTheo Browne 0a877b5a7e Share dialogs pick-folder result schema across runtime and renderer
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 12:30:08 +00:00
Cursor AgentandTheo Browne 00896ff92b Remove redundant renderer event payload re-validation
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 12:27:33 +00:00
Cursor AgentandTheo Browne bce4b2a0e5 Document shared runtime and renderer success payload validation
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 12:21:29 +00:00
Cursor AgentandTheo Browne f07aed6c97 Use shared app and session schemas in renderer RPC parsing
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 12:21:00 +00:00
Cursor AgentandTheo Browne e6dcffe027 Resolve contracts imports from source exports in workspace
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 12:19:37 +00:00
Cursor AgentandTheo Browne 807676a74e Expand app bootstrap and health schema regression tests
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 12:12:17 +00:00
Cursor AgentandTheo Browne a8d7b1371b Await async runtime method results before schema validation
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 12:10:42 +00:00
Cursor AgentandTheo Browne 65b85a9566 Add renderer malformed-success coverage for spawn turn and shell RPCs
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 12:01:52 +00:00
Cursor AgentandTheo Browne 749876208c Expand renderer rejection coverage for malformed RPC success payloads
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 11:54:18 +00:00
Cursor AgentandTheo Browne 511dcb7bbd Document renderer RPC payload validation safeguards
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 11:52:32 +00:00
Cursor AgentandTheo Browne 21b1681474 Validate critical renderer RPC payloads before resolving responses
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 11:52:08 +00:00
Cursor AgentandTheo Browne 0063db3a20 Document websocket request and method 256-char limits
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 11:40:31 +00:00
Cursor AgentandTheo Browne e83a163ce8 Test renderer ignores overlong websocket response ids
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 11:40:15 +00:00
Cursor AgentandTheo Browne c97eccb7a8 Align smoke parser response id bounds with websocket contracts
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 11:39:48 +00:00
Cursor AgentandTheo Browne ff8341761c Use websocket length constants in runtime malformed-request tests
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 11:39:16 +00:00
Cursor AgentandTheo Browne 6ad9bda3c6 Cover overlong websocket request envelopes in runtime and smoke
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 11:38:52 +00:00
Cursor AgentandTheo Browne 8dd0ec5261 Document websocket request id and method length bounds
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 11:33:41 +00:00
Cursor AgentandTheo Browne 8d84fdc3f5 Bound websocket request id and method lengths in contracts
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 11:33:24 +00:00
Cursor AgentandTheo Browne 0ba9932438 Cover strict-invalid websocket envelopes in renderer adapter tests
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 11:32:29 +00:00
Cursor AgentandTheo Browne 730e30a6bb Make smoke parser enforce strict websocket top-level keys
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 11:31:49 +00:00
Cursor AgentandTheo Browne 29b07316e6 Expand strict websocket schema tests for event and error keys
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 11:31:03 +00:00
Cursor AgentandTheo Browne f28015c47e Ignore malformed extra-field websocket requests safely
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 11:26:02 +00:00
Cursor AgentandTheo Browne 2642ce3c4b Document strict websocket envelope field handling
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 11:25:14 +00:00
Cursor AgentandTheo Browne dc4e46ed89 Enforce strict websocket envelope object schemas
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 11:25:01 +00:00
Cursor AgentandTheo Browne 32e0f58e6d Document typed websocket event payload envelopes
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 11:18:34 +00:00
Cursor AgentandTheo Browne c93cf95cbe Type runtime event fanout by websocket channel contracts
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 11:18:22 +00:00
Cursor AgentandTheo Browne fcd4bd5a77 Tighten smoke websocket event envelope parsing
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 11:17:35 +00:00
Cursor AgentandTheo Browne 8313d3c6ca Enforce typed websocket event payload schemas in contracts
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 11:15:51 +00:00
Cursor AgentandTheo Browne 75b853a4dd Assert null agent void RPC results in runtime server tests
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 11:08:28 +00:00
Cursor AgentandTheo Browne 12c03c6c98 Document renderer validation of websocket event payloads
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 11:07:05 +00:00
Cursor AgentandTheo Browne 5bfbe9605c Validate renderer websocket event payload shapes before dispatch
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 11:06:18 +00:00
Cursor AgentandTheo Browne 0d88eaeca0 Validate outbound runtime websocket envelopes before send
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 10:54:12 +00:00
Cursor AgentandTheo Browne 555f080ae0 Harden smoke websocket parsing with envelope validation
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 10:53:26 +00:00
Cursor AgentandTheo Browne a7296d268b Validate runtime websocket test messages against contracts schema
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 10:50:56 +00:00
Cursor AgentandTheo Browne ffff14edc1 Document stable result field in runtime success responses
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 10:50:02 +00:00
Cursor AgentandTheo Browne 2a08d8ea2a Normalize undefined runtime success results to null
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 10:49:01 +00:00
Cursor AgentandTheo Browne 4b25e84c2e Assert null RPC results for void agent methods in smoke tests
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 10:47:13 +00:00
Cursor AgentandTheo Browne 95b1a45d41 Cover over-depth cause-chain fallback in renderer diagnostics
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 10:41:16 +00:00
Cursor AgentandTheo Browne e4b842b822 Document cause-chain websocket diagnostics extraction
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 10:33:25 +00:00
Cursor AgentandTheo Browne 634b11d388 Support cause-chain websocket diagnostics extraction in renderer
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 10:33:00 +00:00
Cursor AgentandTheo Browne 44b145e72c Document bounded-depth websocket diagnostics fallback
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 10:31:01 +00:00
Cursor AgentandTheo Browne 6ea0b0453a Broaden renderer nested error extraction depth coverage
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 10:30:33 +00:00
Cursor AgentandTheo Browne 1382c944ad Document safe fallback for malformed websocket error payloads
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 10:29:27 +00:00
Cursor AgentandTheo Browne ec402cfb24 Cover cyclic error payload fallback safety in renderer diagnostics
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 10:28:14 +00:00
Cursor AgentandTheo Browne 07a775c03f Cover nested and fallback send-failure diagnostics in renderer
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 10:24:21 +00:00
Cursor AgentandTheo Browne 00879b3dcc Support deep nested websocket error payload diagnostics
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 10:10:15 +00:00
Cursor AgentandTheo Browne e49b33bbf2 Cover trimmed generic close reason diagnostics in renderer
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 10:05:02 +00:00
Cursor AgentandTheo Browne 37be29136c Cover sliced DataView websocket request payloads
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 10:00:41 +00:00
Cursor AgentandTheo Browne 38f792c737 Cover nested string websocket error payload diagnostics in renderer
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 09:57:21 +00:00
Cursor AgentandTheo Browne 964390d9fb Cover renderer resilience to invalid ws response envelope shapes
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 09:46:51 +00:00
Cursor AgentandTheo Browne 1df8e444e7 Cover dataview and sliced uint8 websocket request payloads
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 09:43:44 +00:00
Cursor AgentandTheo Browne 95a31b71bd Cover sliced Uint8Array websocket message decoding in renderer
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 09:37:50 +00:00
Cursor AgentandTheo Browne 5b480344fa Tighten websocket response schema result and error invariants
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 09:35:27 +00:00
Cursor AgentandTheo Browne f16a7c372a Document renderer websocket ArrayBufferView decode support
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 09:26:08 +00:00
Cursor AgentandTheo Browne dd9cee82d6 Support ArrayBufferView websocket message decoding in renderer
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 09:24:53 +00:00
Cursor AgentandTheo Browne 22c644927f Add websocket contract guards for empty requests and hello version
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 09:21:59 +00:00
Cursor AgentandTheo Browne 2af6a90fab Expand websocket contract schema validation coverage
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 09:19:44 +00:00
Cursor AgentandTheo Browne 9d4acd40c3 Cover string send-failure propagation to pending renderer requests
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 09:17:20 +00:00
Cursor AgentandTheo Browne 39d0a1f3de Cover non-integer websocket close code normalization in renderer
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 09:15:11 +00:00
Cursor AgentandTheo Browne bf826329fb Document detailed send-failure request diagnostics
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 09:12:52 +00:00
Cursor AgentandTheo Browne cbd4ba0f74 Surface non-Error send failure details in renderer requests
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 09:12:03 +00:00
Cursor AgentandTheo Browne a4069fb203 Document string websocket error payload diagnostics
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 09:03:15 +00:00
Cursor AgentandTheo Browne 8b92651bdf Support string websocket error payload diagnostics in renderer
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 09:02:21 +00:00
Cursor AgentandTheo Browne 436a2b89ec Document renderer close metadata normalization
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 08:51:58 +00:00
Cursor AgentandTheo Browne 539258dd29 Normalize websocket close metadata in renderer diagnostics
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 08:51:08 +00:00
Cursor AgentandTheo Browne d05ba708e2 Cover no-auth wrong-path unauthorized non-eviction
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 08:41:11 +00:00
Cursor AgentandTheo Browne 3cab8e6602 Cover wrong-path unauthorized non-eviction behavior
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 08:38:33 +00:00
Cursor AgentandTheo Browne 90f6d84729 Cover renderer constructor error message normalization edge cases
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 08:36:05 +00:00
Cursor AgentandTheo Browne 73794df6fa Document constructor failure diagnostics for websocket connect
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 08:32:48 +00:00
Cursor AgentandTheo Browne a5aae62386 Surface websocket constructor failures in renderer connect errors
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 08:32:09 +00:00
Cursor AgentandTheo Browne 7298c6cba6 Trim websocket error messages in renderer diagnostics
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 08:28:54 +00:00
Cursor AgentandTheo Browne 52f9acbf27 Document pending request rejection on websocket send failures
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 08:26:14 +00:00
Cursor AgentandTheo Browne c9c70742f1 Reject all pending renderer requests after websocket send failure
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 08:25:38 +00:00
Cursor AgentandTheo Browne 0705246a51 Document nested websocket error detail reporting
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 08:16:47 +00:00
Cursor AgentandTheo Browne 1990e7bd26 Surface nested websocket error messages in renderer diagnostics
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 08:15:05 +00:00
Cursor AgentandTheo Browne 0302f61b88 Guard websocket close metadata uniqueness in contracts tests
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 08:11:46 +00:00
Cursor AgentandTheo Browne dfd11e6140 Cover disconnect close code precedence in renderer diagnostics
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 08:09:18 +00:00
Cursor AgentandTheo Browne 7df0b667f8 Cover pre-open close code precedence in renderer diagnostics
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 08:06:56 +00:00
Cursor AgentandTheo Browne ed6f58ae11 Cover no-auth wrong-token-key unauthorized non-eviction
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 08:04:33 +00:00
Cursor AgentandTheo Browne f048627128 Cover close reason precedence in renderer websocket diagnostics
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 08:03:07 +00:00
Cursor AgentandTheo Browne ef5ab36862 Cover wrong-token-key unauthorized non-eviction behavior
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 08:01:41 +00:00
Cursor AgentandTheo Browne be8fccb92d Deduplicate smoke auth token query encoding
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 07:58:34 +00:00
Cursor AgentandTheo Browne c7e7775bf5 Document lowercase token query key requirement
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 07:56:34 +00:00
Cursor AgentandTheo Browne 068093c5fb Cover auth token key case-sensitivity websocket rejection
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 07:56:06 +00:00
Cursor AgentandTheo Browne 706fa19c11 Document renderer websocket reset after send failures
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 07:54:28 +00:00
Cursor AgentandTheo Browne fbd55625ed Reset renderer websocket after request send failures
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 07:53:56 +00:00
Cursor AgentandTheo Browne 3421e53f96 Cover renderer recovery after transient websocket send failures
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 07:51:36 +00:00
Cursor AgentandTheo Browne b1c96a56e6 Cover auth-mode missing-token extra-query websocket rejection
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 07:49:58 +00:00
Cursor AgentandTheo Browne 995fceaa6c Cover non-eviction for duplicate identical token auth attempts
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 07:48:02 +00:00
Cursor AgentandTheo Browne f831e3b852 Clarify duplicate-token rejection includes identical values
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 07:46:28 +00:00
Cursor AgentandTheo Browne 136570cacc Reject duplicate identical websocket token parameters
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 07:45:56 +00:00
Cursor AgentandTheo Browne 10bb74b81e Clarify stale provider and agent stream isolation docs
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 07:44:11 +00:00
Cursor AgentandTheo Browne 817541ca52 Cover stale agent event isolation after renderer reconnect
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 07:42:45 +00:00
Cursor AgentandTheo Browne ebfd4057ce Cover stale provider event isolation after renderer reconnect
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 07:40:58 +00:00
Cursor AgentandTheo Browne bb9804cf70 Cover stale websocket message isolation after renderer reconnect
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 07:38:23 +00:00
Cursor AgentandTheo Browne 5323a138c4 Document renderer auto-reconnect after close and error disconnects
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 07:36:23 +00:00
Cursor AgentandTheo Browne b2d7c3e242 Cover renderer reconnect after idle websocket error
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 07:35:38 +00:00
Cursor AgentandTheo Browne 4a5c2bf711 Cover concurrent pending request rejection on websocket error
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 07:33:52 +00:00
Cursor AgentandTheo Browne 124cd5ea0d Cover renderer stale-error isolation and generic error fallback
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 07:32:54 +00:00
Cursor AgentandTheo Browne 9598488fe9 Document renderer websocket connect error detail reporting
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 07:25:43 +00:00
Cursor AgentandTheo Browne 091f9f2a69 Report websocket open error details in renderer connect failures
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 07:25:04 +00:00
Cursor AgentandTheo Browne 166e11c1a9 Document stale websocket event isolation after reconnect
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 07:19:01 +00:00
Cursor AgentandTheo Browne f3a5077010 Ignore stale websocket events after renderer reconnect
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 07:18:25 +00:00
Cursor AgentandTheo Browne dc60bdb1bc Document renderer websocket error-event request failures
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 07:12:31 +00:00
Cursor AgentandTheo Browne 73f2b3e4ae Handle websocket error events for pending renderer requests
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 07:11:56 +00:00
Cursor AgentandTheo Browne 7c423d46b7 Cover concurrent pending request rejection on unauthorized disconnect
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 07:06:24 +00:00
Cursor AgentandTheo Browne 5b81ceb0e1 Cover renderer reconnect after unauthorized pending-request disconnect
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 07:01:20 +00:00
Cursor AgentandTheo Browne 0fb1da8371 Cover renderer reconnection after unauthorized and replacement closes
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 07:00:36 +00:00
Cursor AgentandTheo Browne 4633e3f0a3 Cover renderer reason-only close metadata mappings
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 06:55:32 +00:00
Cursor AgentandTheo Browne 30c19f0e71 Surface reason-only websocket close diagnostics in renderer
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 06:54:44 +00:00
Cursor AgentandTheo Browne 273ac4bbb8 Cover renderer close code-only fallback messaging
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 06:49:40 +00:00
Cursor AgentandTheo Browne c183380225 Cover renderer websocket close-metadata fallback branches
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 06:48:57 +00:00
Cursor AgentandTheo Browne 9cef7b77d5 Document renderer in-flight disconnect diagnostics
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 06:43:48 +00:00
Cursor AgentandTheo Browne 324b94381f Improve renderer request disconnect errors with close metadata
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 06:43:18 +00:00
Cursor AgentandTheo Browne beb26880eb Document renderer websocket close-metadata diagnostics
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 06:42:32 +00:00
Cursor AgentandTheo Browne 43173d100c Expand renderer websocket close metadata test coverage
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 06:42:03 +00:00
Cursor AgentandTheo Browne d5f970c961 Surface websocket close metadata in renderer connection errors
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 06:36:34 +00:00
Cursor AgentandTheo Browne 4966661956 Test shared websocket close metadata constants
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 06:29:23 +00:00
Cursor AgentandTheo Browne f7ae3e85ea Centralize websocket close constants in smoke harness
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 06:28:40 +00:00
Cursor AgentandTheo Browne d9b539a661 Use shared websocket close constants in runtime tests
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 06:27:54 +00:00
Cursor AgentandTheo Browne 3cbec3a139 Introduce shared websocket close code and reason constants
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 06:27:11 +00:00
Cursor AgentandTheo Browne 7e2bbaa403 Assert unauthorized close reasons in non-eviction scenarios
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 06:20:45 +00:00
Cursor AgentandTheo Browne 775c5d797a Assert unauthorized close reasons across auth token rejection cases
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 06:19:34 +00:00
Cursor AgentandTheo Browne 27269388aa Assert unauthorized close reasons in no-auth websocket rejections
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 06:18:49 +00:00
Cursor AgentandTheo Browne 30cfb90254 Cover buffer websocket request payloads in smoke test
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 06:18:17 +00:00
Cursor AgentandTheo Browne c30a9e3152 Assert websocket close reasons in smoke authorization checks
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 06:13:22 +00:00
Cursor AgentandTheo Browne cd2da30eb4 Document unauthorized websocket close semantics
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 06:12:20 +00:00
Cursor AgentandTheo Browne 503e6d8a75 Assert unauthorized websocket close reason semantics
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 06:11:56 +00:00
Cursor AgentandTheo Browne dda8abba23 Document websocket replacement close reason
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 06:11:26 +00:00
Cursor AgentandTheo Browne d8b62998da Cover arraybuffer smoke requests and replacement close reasons
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 06:11:06 +00:00
Cursor AgentandTheo Browne 992532873c Harden smoke websocket helpers for close/error handling
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 06:05:49 +00:00
Cursor AgentandTheo Browne f997cc3716 Assert listSessions reflects bootstrap session when startup succeeds
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 06:05:09 +00:00
Cursor AgentandTheo Browne c4b7956430 Assert malformed websocket tolerance and unknown agent controls
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 06:03:55 +00:00
Cursor AgentandTheo Browne 4cb1055551 Document websocket replacement close code semantics
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 05:59:13 +00:00
Cursor AgentandTheo Browne 92ca009560 Cover no-auth token-query websocket rejection
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 05:58:30 +00:00
Cursor AgentandTheo Browne b6b20455e4 Cover binary websocket request payloads in smoke test
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 05:58:03 +00:00
Cursor AgentandTheo Browne 397edfe088 Assert terminal.run timeout semantics in smoke test
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 05:57:27 +00:00
Cursor AgentandTheo Browne 1488f40bae Cover invalid todos and shell cwd payload errors in smoke
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 05:56:52 +00:00
Cursor AgentandTheo Browne 8da9a329a3 Assert invalid providers payload errors in smoke test
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 05:54:31 +00:00
Cursor AgentandTheo Browne 64152e816d Exercise agent.kill and agent.write RPCs in smoke test
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 05:47:39 +00:00
Cursor AgentandTheo Browne 684388fbbf Cover no-auth unexpected-query unauthorized non-eviction
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 05:46:24 +00:00
Cursor AgentandTheo Browne 90da976395 Assert structured validation errors in websocket smoke flow
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 05:45:50 +00:00
Cursor AgentandTheo Browne 90ec32f69c Cover providers.listSessions RPC in smoke test
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 05:44:55 +00:00
Cursor AgentandTheo Browne fae88186f9 Exercise agent event streaming over websocket in smoke test
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 05:44:28 +00:00
Cursor AgentandTheo Browne 0d6e84fe81 Cover extra-query unauthorized connection non-eviction
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 05:39:41 +00:00
Cursor AgentandTheo Browne 6098003dad Require strict websocket query params for authorization
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 05:38:23 +00:00
Cursor AgentandTheo Browne 8e88da9add Assert app.bootstrap payload contract in smoke test
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 05:35:50 +00:00
Cursor AgentandTheo Browne 6606bd4b60 Validate terminal.run RPC success in smoke test
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 05:35:22 +00:00
Cursor AgentandTheo Browne ec7eb7bc56 Exercise todos websocket CRUD flow in smoke test
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 05:34:44 +00:00
Cursor AgentandTheo Browne 825a48e1cc Verify active-client replacement behavior in smoke test
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 05:33:35 +00:00
Cursor AgentandTheo Browne 1b65041ac3 Document root-path websocket connection requirement
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 05:28:23 +00:00
Cursor AgentandTheo Browne 76be201215 Reject websocket connections on non-root paths
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 05:28:10 +00:00
Cursor AgentandTheo Browne 144143544a Verify structured unknown-method websocket errors in smoke test
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 05:26:49 +00:00
Cursor AgentandTheo Browne d68b1bbc68 Assert conditional 304 content-type header stability
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 05:20:37 +00:00
Cursor AgentandTheo Browne a83aec31ca Cover malformed whitespace-only suffix range rejection
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 05:19:23 +00:00
Cursor AgentandTheo Browne 0c69ed5452 Cover mixed-case spaced suffix range parsing
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 05:18:12 +00:00
Cursor AgentandTheo Browne 7c070b6425 Assert duplicate-token auth attempts do not evict active client
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 05:17:09 +00:00
Cursor AgentandTheo Browne 8edbf85b54 Cover duplicate-token unauthorized non-eviction behavior
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 05:15:25 +00:00
Cursor AgentandTheo Browne e6b40ac013 Document duplicate-token websocket auth rejection
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 05:14:22 +00:00
Cursor AgentandTheo Browne 7f29e39d9d Reject duplicate websocket token parameters
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 05:12:56 +00:00
Cursor AgentandTheo Browne cd327137fd Cover whitespace-padded suffix and open-ended ranges
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 05:07:15 +00:00
Cursor AgentandTheo Browne c1bec99a7a Cover unknown T3_NO_OPEN value handling
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 05:02:11 +00:00
Cursor AgentandTheo Browne aa016aa047 Assert whitespace websocket token rejection in smoke
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 05:00:32 +00:00
Cursor AgentandTheo Browne 8951ec7072 Cover whitespace token query rejection for auth runtime
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 04:59:32 +00:00
Cursor AgentandTheo Browne b16ca1c9ee Cover falsey T3_NO_OPEN environment parsing
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 04:58:36 +00:00
Cursor AgentandTheo Browne 0e775333a0 Document full T3_NO_OPEN boolean token support
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 04:57:40 +00:00
Cursor AgentandTheo Browne 8364f8a166 Cover trimmed uppercase T3_NO_OPEN falsey parsing
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 04:56:11 +00:00
Cursor AgentandTheo Browne 4627c42841 Cover trimmed uppercase T3_NO_OPEN truthy parsing
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 04:55:18 +00:00
Cursor AgentandTheo Browne fa4089f461 Cover tabbed environment port trimming semantics
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 04:54:26 +00:00
Cursor AgentandTheo Browne 288c773b3e Assert empty websocket token rejection in smoke
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 04:52:56 +00:00
Cursor AgentandTheo Browne a1021ecd49 Cover empty token query rejection for auth runtime
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 04:52:00 +00:00
Cursor AgentandTheo Browne 2a88b31f3a Assert tab-spaced Range headers in smoke coverage
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 04:50:32 +00:00
Cursor AgentandTheo Browne 1929660b3b Cover tab-separated Range header whitespace tolerance
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 04:49:40 +00:00
Cursor AgentandTheo Browne de10ddea16 Cover zero environment backend and web port rejection
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 04:48:13 +00:00
Cursor AgentandTheo Browne c557259673 Cover zero explicit backend and web port rejection
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 04:47:18 +00:00
Cursor AgentandTheo Browne c9b921c532 Clarify valid CLI port value range in docs
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 04:45:48 +00:00
Cursor AgentandTheo Browne eef8485eb4 Cover null runtime port startup rejection
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 04:44:50 +00:00
Cursor AgentandTheo Browne 933cc42054 Assert ranged If-Unmodified-Since and If-None-Match behavior
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 04:44:00 +00:00
Cursor AgentandTheo Browne 78eea79845 Assert current If-Unmodified-Since with If-None-Match
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 04:42:56 +00:00
Cursor AgentandTheo Browne 741c02eaba Refactor first-header extraction across conditional helpers
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 04:42:02 +00:00
Cursor AgentandTheo Browne 0d7afe0021 Document oversized suffix range normalization behavior
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 04:40:47 +00:00
Cursor AgentandTheo Browne 3180b28b33 Assert oversized suffix range fallback in smoke
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 04:40:02 +00:00
Cursor AgentandTheo Browne 8a424f2c03 Cover oversized suffix range clamping semantics
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 04:39:12 +00:00
Cursor AgentandTheo Browne fb6a083b5b Cover null launchCwd startup rejection
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 04:38:23 +00:00
Cursor AgentandTheo Browne d90ec00087 Assert stale ranged If-Modified-Since returns partial content
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 04:37:36 +00:00
Cursor AgentandTheo Browne 738a1de007 Assert mismatched If-None-Match keeps ranged 206 flow
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 04:36:43 +00:00
Cursor AgentandTheo Browne 482aeb7c57 Cover trimmed comma-separated If-Match tokens
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 04:35:48 +00:00
Cursor AgentandTheo Browne b520aa63f4 Cover null runtime auth token startup rejection
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 04:35:06 +00:00
Cursor AgentandTheo Browne 6b20a47021 Assert HEAD wildcard If-Match and If-None-Match behavior
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 04:34:22 +00:00
Cursor AgentandTheo Browne 965a21f973 Cover wildcard If-Match support in array headers
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 04:33:35 +00:00
Cursor AgentandTheo Browne 3eb0abbc53 Clarify non-empty cwd requirement in docs
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 04:32:47 +00:00
Cursor AgentandTheo Browne 198621a881 Cover whitespace-only launchCwd startup rejection
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 04:32:06 +00:00
Cursor AgentandTheo Browne 1acc3a5141 Cover non-number runtime option rejection paths
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 04:31:24 +00:00
Cursor AgentandTheo Browne b0482d89f4 Document tolerant whitespace in Range header parsing
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 04:30:30 +00:00
Cursor AgentandTheo Browne 94e661f01d Assert spaced Range headers in smoke coverage
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 04:29:50 +00:00
Cursor AgentandTheo Browne aa455d13cc Allow optional spaces in Range header parsing
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 04:29:07 +00:00
Cursor AgentandTheo Browne 0431e648c8 Assert wildcard If-Match with If-None-Match interplay
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 04:24:34 +00:00
Cursor AgentandTheo Browne 8e1db9f909 Assert wildcard If-None-Match with range returns 304
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 04:23:16 +00:00
Cursor AgentandTheo Browne 7d17ff43fd Cover invalid-first If-Unmodified-Since array semantics
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 04:22:31 +00:00
Cursor AgentandTheo Browne 347474a6b2 Cover If-Modified-Since array first-value precedence
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 04:21:51 +00:00
Cursor AgentandTheo Browne 60e6d7a2e8 Cover trimmed case-insensitive short -o values
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 04:21:10 +00:00
Cursor AgentandTheo Browne df14dafe32 Document If-Unmodified-Since precedence over 304 paths
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 04:20:31 +00:00
Cursor AgentandTheo Browne 396d1c311b Assert If-Unmodified-Since failures override If-None-Match
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 04:19:57 +00:00
Cursor AgentandTheo Browne 2b33d2881c Document If-Match precedence over cache validators
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 04:19:12 +00:00
Cursor AgentandTheo Browne fea6876a46 Assert If-Match precedence over If-None-Match mismatches
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 04:18:33 +00:00
Cursor AgentandTheo Browne 926d1a03a9 Assert If-Match and If-None-Match combined behavior
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 04:17:54 +00:00
Cursor AgentandTheo Browne 3155e47d99 Assert HEAD stale If-Unmodified-Since validator headers
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 04:17:08 +00:00
Cursor AgentandTheo Browne 587cca9b84 Cover If-Unmodified-Since array first-value precedence
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 04:16:28 +00:00
Cursor AgentandTheo Browne 95b52ecb47 Assert wildcard If-Match preserves ranged responses
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 04:15:48 +00:00
Cursor AgentandTheo Browne b36185d40e Cover whitespace-trimmed weak If-None-Match parsing
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 04:14:38 +00:00
Cursor AgentandTheo Browne 5493a814b7 Document strong versus weak static validator semantics
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 04:14:02 +00:00
Cursor AgentandTheo Browne ab400664bd Expand ETag precondition helper edge-case tests
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 04:13:24 +00:00
Cursor AgentandTheo Browne e33e0e42dd Cover client socket shutdown on runtime close
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 04:12:40 +00:00
Cursor AgentandTheo Browne a735874acf Extract static precondition-failure response helper
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 04:11:39 +00:00
Cursor AgentandTheo Browne 9ebf691747 Assert 412 responses keep range capability headers
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 04:10:49 +00:00
Cursor AgentandTheo Browne 262f9e242c Assert lowercase weak validator behavior in smoke
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 04:09:44 +00:00
Cursor AgentandTheo Browne 28ee12ba15 Handle lowercase weak ETag validators consistently
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 04:08:59 +00:00
Cursor AgentandTheo Browne 028a1786f7 Cover If-Range array-first-value semantics
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 04:08:01 +00:00
Cursor AgentandTheo Browne fd1fbe45a7 Assert invalid If-Range dates fall back to full response
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 04:07:18 +00:00
Cursor AgentandTheo Browne 912901c3b6 Document wildcard static validator support
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 04:06:20 +00:00
Cursor AgentandTheo Browne f6f9900104 Refactor static validator and range header emission
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 04:05:27 +00:00
Cursor AgentandTheo Browne e92d432cae Expand short -o equals-value parser coverage
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 04:04:08 +00:00
Cursor AgentandTheo Browne a80816d86c Cover comma-separated If-Match value parsing
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 04:03:04 +00:00
Cursor AgentandTheo Browne ae24ea691c Assert HEAD stale If-Unmodified-Since failures
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 04:02:09 +00:00
Cursor AgentandTheo Browne 0aebf5b590 Document 416 static range validator metadata
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 04:01:12 +00:00
Cursor AgentandTheo Browne 8b93f3b144 Include validators on 416 static range responses
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 04:00:21 +00:00
Cursor AgentandTheo Browne 9dffec959c Cover byte-range parsing invalid file-size inputs
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 03:54:47 +00:00
Cursor AgentandTheo Browne 390c340bdc Cover auth token trimming across whitespace characters
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 03:53:55 +00:00
Cursor AgentandTheo Browne c41fe91c51 Cover bootstrap timeout lower bound acceptance
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 03:53:06 +00:00
Cursor AgentandTheo Browne 30dcbb3877 Cover If-Range wildcard rejection semantics
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 03:52:13 +00:00
Cursor AgentandTheo Browne 82ee14bc7e Assert wildcard If-None-Match and If-Match behavior
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 03:51:19 +00:00
Cursor AgentandTheo Browne 44728d6cd3 Expand If-Match and If-Unmodified-Since helper tests
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 03:50:27 +00:00
Cursor AgentandTheo Browne d4b999650f Assert 412 precondition content-type and length headers
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 03:48:52 +00:00
Cursor AgentandTheo Browne 9ebee1113d Document 412 static validator response headers
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 03:47:53 +00:00
Cursor AgentandTheo Browne c5b1cd7c94 Include validators on 412 static precondition responses
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 03:47:07 +00:00
Cursor AgentandTheo Browne ec2012e0d2 Assert ranged If-Unmodified-Since precondition failures
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 03:45:49 +00:00
Cursor AgentandTheo Browne fae9aeba8d Assert range requests honor If-Match preconditions
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 03:44:59 +00:00
Cursor AgentandTheo Browne 262d5088f8 Assert If-Match precedence over If-Unmodified-Since
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 03:44:05 +00:00
Cursor AgentandTheo Browne ffa2756cf6 Assert 412 precondition responses keep no-store policy
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 03:43:14 +00:00
Cursor AgentandTheo Browne b80e1dcac2 Document If-Match and If-Unmodified-Since support
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 03:42:24 +00:00
Cursor AgentandTheo Browne 8aa5ed80f5 Support If-Match and If-Unmodified-Since preconditions
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 03:41:39 +00:00
Cursor AgentandTheo Browne 3e109a88e6 Document Last-Modified static validator headers
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 03:35:55 +00:00
Cursor AgentandTheo Browne 2ba14edf36 Assert Last-Modified stability on conditional responses
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 03:35:12 +00:00
Cursor AgentandTheo Browne d81c547169 Assert HEAD asset ETag and Last-Modified headers
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 03:34:23 +00:00
Cursor AgentandTheo Browne 44604dd0c6 Document whitespace cwd rejection for runtime APIs
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 03:33:04 +00:00
Cursor AgentandTheo Browne 33edb9235d Reject whitespace cwd values for runtime path APIs
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 03:32:13 +00:00
Cursor AgentandTheo Browne dcb44cb729 Reject empty launchCwd values at runtime startup
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 03:30:05 +00:00
Cursor AgentandTheo Browne 60e9c8c00b Assert stale If-Range date falls back to full response
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 03:29:01 +00:00
Cursor AgentandTheo Browne e0b1b7a44d Validate runtime auth token type at startup
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 03:27:43 +00:00
Cursor AgentandTheo Browne 665b435ca4 Cover byte-range whitespace and multi-range parsing
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 03:26:02 +00:00
Cursor AgentandTheo Browne e1f6c86c75 Cover NaN and infinite bootstrap timeout rejection
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 03:25:21 +00:00
Cursor AgentandTheo Browne 79de5bf9a2 Assert weak If-Range falls back to full response
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 03:23:57 +00:00
Cursor AgentandTheo Browne d941966436 Document conditional precondition precedence over ranges
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 03:23:12 +00:00
Cursor AgentandTheo Browne 28db4bb777 Apply conditional preconditions before range handling
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 03:22:28 +00:00
Cursor AgentandTheo Browne 8f2fd0919c Assert 304 static responses preserve security headers
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 03:19:53 +00:00
Cursor AgentandTheo Browne 56bb28267d Expand If-Range helper edge-case coverage
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 03:18:47 +00:00
Cursor AgentandTheo Browne 13d771a71f Assert ranged If-Modified-Since remains partial
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 03:18:10 +00:00
Cursor AgentandTheo Browne 035d257d98 Document static If-Range response semantics
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 03:17:20 +00:00
Cursor AgentandTheo Browne f358ab2a3c Honor If-Range semantics for static byte requests
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 03:16:41 +00:00
Cursor AgentandTheo Browne 830dd2e118 Document If-Modified-Since static caching behavior
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 03:15:04 +00:00
Cursor AgentandTheo Browne f8aae93a16 Add Last-Modified conditional handling for static files
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 03:14:28 +00:00
Cursor AgentandTheo Browne 4ed9832794 Assert 304 responses omit content-length in smoke
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 03:12:38 +00:00
Cursor AgentandTheo Browne adac335c3f Support weak If-None-Match ETag comparison
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 03:11:52 +00:00
Cursor AgentandTheo Browne 55faded027 Cover conditional HEAD static responses in smoke
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 03:10:45 +00:00
Cursor AgentandTheo Browne 1934d79dba Document static ETag and conditional cache behavior
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 03:10:03 +00:00
Cursor AgentandTheo Browne f6210af9d0 Add ETag conditional handling for static files
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 03:09:07 +00:00
Cursor AgentandTheo Browne 01b32b2d35 Expose range capability headers on 416 responses
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 03:04:27 +00:00
Cursor AgentandTheo Browne 6ae469074c Refactor static file GET and HEAD response path
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 02:59:48 +00:00
Cursor AgentandTheo Browne d315271987 Document static Vary range header behavior
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 02:58:18 +00:00
Cursor AgentandTheo Browne 133a9cd5a9 Add Vary header for static range responses
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 02:57:50 +00:00
Cursor AgentandTheo Browne 10c7207895 Cover zero-length file byte-range rejection cases
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 02:56:57 +00:00
Cursor AgentandTheo Browne cf73b44095 Cover case-insensitive byte range unit parsing
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 02:56:27 +00:00
Cursor AgentandTheo Browne b03573eeb0 Cover HEAD unsatisfiable range responses in smoke
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 02:55:43 +00:00
Cursor AgentandTheo Browne d168f0ea0d Assert HEAD byte-range behavior in smoke test
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 02:55:08 +00:00
Cursor AgentandTheo Browne 3f5c18850d Document static byte-range response support
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 02:54:34 +00:00
Cursor AgentandTheo Browne 50cfbd4393 Add byte-range support to static asset responses
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 02:54:05 +00:00
Cursor AgentandTheo Browne 28ac180980 Use direct runtime manager imports in API server
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 02:50:41 +00:00
Cursor AgentandTheo Browne e1ba3988a1 Document static range and security response headers
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 02:49:15 +00:00
Cursor AgentandTheo Browne fd72e0ae3f Serve and assert Accept-Ranges on static files
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 02:48:44 +00:00
Cursor AgentandTheo Browne a020b53e44 Cover bootstrap timeout upper bound acceptance
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 02:47:27 +00:00
Cursor AgentandTheo Browne 9b8d67e932 Handle uppercase absolute request URL schemes
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 02:43:55 +00:00
Cursor AgentandTheo Browne 814f075ddc Cover -o=true override of T3_NO_OPEN env
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 02:42:43 +00:00
Cursor AgentandTheo Browne cbb0476d29 Cover --web-port guard for -o=bool token
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 02:41:41 +00:00
Cursor AgentandTheo Browne 5e8665bb13 Exercise -o=0 launch path in smoke test
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 02:40:41 +00:00
Cursor AgentandTheo Browne 3c222b17b7 Support equals-style short -o boolean parsing
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 02:39:42 +00:00
Cursor AgentandTheo Browne ffe58dbb90 Cover -o token guards after value-taking flags
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 02:38:00 +00:00
Cursor AgentandTheo Browne 6509eefec2 Add -o short alias for open flag
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 02:37:05 +00:00
Cursor AgentandTheo Browne d95e2fc125 Cover empty equals-style --open parsing errors
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 02:35:33 +00:00
Cursor AgentandTheo Browne f96ecb6d06 Use --open=0 path in smoke launch arguments
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 02:34:40 +00:00
Cursor AgentandTheo Browne ce06a538c6 Cover numeric equals-style --open parsing
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 02:33:43 +00:00
Cursor AgentandTheo Browne c31f0c8de2 Assert HEAD missing-asset content-length in smoke
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 02:32:49 +00:00
Cursor AgentandTheo Browne 4fb9e1769c Assert HEAD asset content-length in smoke test
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 02:31:57 +00:00
Cursor AgentandTheo Browne e8dee9f7b6 Cover --open token as missing port argument value
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 02:31:01 +00:00
Cursor AgentandTheo Browne 845ab9a76b Destroy static file stream when response closes
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 02:30:05 +00:00
Cursor AgentandTheo Browne f5b1b638ce Stream static file responses instead of buffering
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 02:29:11 +00:00
Cursor AgentandTheo Browne 524c11709a Cover end-marker use after positional cwd selection
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 02:24:53 +00:00
Cursor AgentandTheo Browne d47b08fc99 Cover T3_NO_OPEN false-value environment parsing
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 02:23:47 +00:00
Cursor AgentandTheo Browne 1870118593 Cover equals-style open/no-open precedence rules
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 02:22:55 +00:00
Cursor AgentandTheo Browne 9da397664f Assert HEAD asset security headers in smoke
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 02:22:03 +00:00
Cursor AgentandTheo Browne 98d09fa267 Assert HEAD missing-asset security headers in smoke
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 02:21:09 +00:00
Cursor AgentandTheo Browne 81a80e7f06 Expand unknown argument parser coverage
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 02:20:15 +00:00
Cursor AgentandTheo Browne 48d5f7263c Cover absolute-form resolution in static read-target helper
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 02:19:23 +00:00
Cursor AgentandTheo Browne cab673a105 Cover NaN and infinite runtime port rejection
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 02:18:33 +00:00
Cursor AgentandTheo Browne 2d7754c19f Handle absolute-form static request targets safely
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 02:17:34 +00:00
Cursor AgentandTheo Browne 1345ec325a Assert HEAD security headers in smoke checks
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 02:14:13 +00:00
Cursor AgentandTheo Browne ed3d0be205 Cover --open token guards for port value parsing
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 02:12:43 +00:00
Cursor AgentandTheo Browne 2c885142b2 Cover trimmed equals-style --open parsing
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 02:09:24 +00:00
Cursor AgentandTheo Browne 20ac731149 Assert HEAD missing-asset cache behavior in smoke
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 02:08:12 +00:00
Cursor AgentandTheo Browne 148711b2ac Assert missing-asset security headers in smoke test
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 02:07:16 +00:00
Cursor AgentandTheo Browne e58bc32113 Trim whitespace in explicit CLI port values
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 02:06:22 +00:00
Cursor AgentandTheo Browne bc65ad73aa Assert built asset frame and referrer headers
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 02:04:40 +00:00
Cursor AgentandTheo Browne ab9e47fae4 Document accepted boolean values for --open
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 02:03:49 +00:00
Cursor AgentandTheo Browne 35e381dcbf Cover --open=off equals-value parsing
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 02:03:10 +00:00
Cursor AgentandTheo Browne 5bb68e21b5 Exercise --open=false path in smoke launch
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 02:02:29 +00:00
Cursor AgentandTheo Browne 7a704b2eae Treat equals-style flags as missing arg values
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 02:01:40 +00:00
Cursor AgentandTheo Browne 86e541a697 Cover --open=true equals-value parsing
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 02:00:07 +00:00
Cursor AgentandTheo Browne 9be9837d48 Support equals-style boolean values for --open
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 01:59:28 +00:00
Cursor AgentandTheo Browne e61ed3ce38 Cover --cwd missing-value guard for --open token
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 01:58:21 +00:00
Cursor AgentandTheo Browne ed8e29dedc Add --open flag to override no-open defaults
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 01:57:39 +00:00
Cursor AgentandTheo Browne e0089ea5c7 Cover query-plus-fragment static path parsing
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 01:53:56 +00:00
Cursor AgentandTheo Browne 01021f85df Refactor CLI boolean token parsing constants
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 01:53:11 +00:00
Cursor AgentandTheo Browne 3f59add5b4 Cover T3_NO_OPEN off-value environment parsing
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 01:52:23 +00:00
Cursor AgentandTheo Browne bb152c985c Cover --no-open=yes equals-value parsing
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 01:51:39 +00:00
Cursor AgentandTheo Browne adb7824166 Cover off-value handling for --no-open
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 01:50:36 +00:00
Cursor AgentandTheo Browne 6ce75a0b3a Cover trimmed equals-style --no-open parsing
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 01:49:51 +00:00
Cursor AgentandTheo Browne 2fbf261d52 Assert built asset COOP header in smoke test
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 01:49:15 +00:00
Cursor AgentandTheo Browne b6eeef55bc Add COOP headers to static runtime responses
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 01:48:35 +00:00
Cursor AgentandTheo Browne 3397175977 Expand --no-open equals-value parser coverage
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 01:47:31 +00:00
Cursor AgentandTheo Browne d943f75b7c Support equals-style boolean values for --no-open
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 01:46:49 +00:00
Cursor AgentandTheo Browne 2c3789dd40 Assert HEAD asset cache headers in smoke test
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 01:45:31 +00:00
Cursor AgentandTheo Browne 1db2ef8e82 Assert built asset security headers in smoke test
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 01:44:49 +00:00
Cursor AgentandTheo Browne 9b3ffaa235 Strip URL hash fragments in static path resolution
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 01:43:59 +00:00
Cursor AgentandTheo Browne 4e3b3d0a80 Refactor static security header assignment
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 01:42:59 +00:00
Cursor AgentandTheo Browne b800536e74 Assert POST error content-length in smoke test
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 01:41:40 +00:00
Cursor AgentandTheo Browne ebf290e8f5 Assert POST error content-type in smoke test
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 01:41:03 +00:00
Cursor AgentandTheo Browne 5b28cfbbe9 Reset active client reference during runtime shutdown
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 01:40:18 +00:00
Cursor AgentandTheo Browne ea0f27dc60 Clear active client pointer on socket error closure
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 01:39:35 +00:00
Cursor AgentandTheo Browne d3f580dc95 Cover end-marker handling after flag value parsers
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 01:38:53 +00:00
Cursor AgentandTheo Browne 79028d6952 Add X-Frame-Options to static runtime responses
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 01:38:09 +00:00
Cursor AgentandTheo Browne d161e0b987 Cover validateLaunchDirectory relative cwd resolution
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 01:37:20 +00:00
Cursor AgentandTheo Browne 4915ff769a Cover CLI version fallback for blank env value
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 01:36:29 +00:00
Cursor AgentandTheo Browne 2752dbbd02 Add CORP headers to static runtime responses
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 01:35:49 +00:00
Cursor AgentandTheo Browne 3ac9d76509 Cover relative missing terminal cwd error details
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 01:35:01 +00:00
Cursor AgentandTheo Browne 516b86c825 Cover relative missing shell target error details
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 01:34:27 +00:00
Cursor AgentandTheo Browne 282ff394dd Cover plus-prefixed port rejection cases
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 01:33:51 +00:00
Cursor AgentandTheo Browne 6cb05e1c0e Document static cache-control behavior in README
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 01:33:19 +00:00
Cursor AgentandTheo Browne 59f56ce3a8 Add referrer-policy headers to static responses
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 01:32:23 +00:00
Cursor AgentandTheo Browne dbff0f96d3 Assert static asset max-age cache policy in smoke
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 01:31:38 +00:00
Cursor AgentandTheo Browne 0a1a0c0a27 Require decimal-only CLI port values
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 01:30:53 +00:00
Cursor AgentandTheo Browne 5badab515f Preserve original causes in directory access errors
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 01:30:04 +00:00
Cursor AgentandTheo Browne 976ff6fcdf Assert HEAD cache-control semantics in smoke test
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 01:28:41 +00:00
Cursor AgentandTheo Browne 5f17ee8a33 Expand end-of-options positional parsing coverage
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 01:28:02 +00:00
Cursor AgentandTheo Browne e060cf4fd4 Assert POST error response security headers in smoke
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 01:27:25 +00:00
Cursor AgentandTheo Browne 855923ce13 Bound bootstrap timeout configuration range
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 01:26:51 +00:00
Cursor AgentandTheo Browne f951587e52 Cover port flags rejecting known-flag values
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 01:26:01 +00:00
Cursor AgentandTheo Browne 8f9096c626 Parse negative port args as invalid values
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 01:25:31 +00:00
Cursor AgentandTheo Browne ea69ec16fe Cover equals-style dash-prefixed cwd parsing
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 01:23:01 +00:00
Cursor AgentandTheo Browne 271d78a9a5 Set immutable cache headers for built static assets
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 01:22:29 +00:00
Cursor AgentandTheo Browne 7957e29cbf Mark static error responses as no-store
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 01:19:35 +00:00
Cursor AgentandTheo Browne a04f832761 Cover trimmed environment port parsing semantics
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 01:18:43 +00:00
Cursor AgentandTheo Browne a0ef9976df Apply nosniff headers to static error responses
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 01:18:03 +00:00
Cursor AgentandTheo Browne bb00a48f70 Document launch-based relative cwd resolution
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 01:17:14 +00:00
Cursor AgentandTheo Browne 77ebbad521 Resolve relative runtime cwd paths from launch directory
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 01:16:41 +00:00
Cursor AgentandTheo Browne b2263e752f Cover safe in-dist symlink static resolution
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 01:14:56 +00:00
Cursor AgentandTheo Browne fc16b8ac58 Disable HTML caching in static runtime responses
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 01:14:17 +00:00
Cursor AgentandTheo Browne 524ba15e62 Document runtime cwd defaults and validation behavior
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 01:13:25 +00:00
Cursor AgentandTheo Browne 8a1ad4e763 Reuse shared directory validation in runtime methods
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 01:12:50 +00:00
Cursor AgentandTheo Browne eed51b69d9 Cover non-integer runtime port startup rejection
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 01:12:02 +00:00
Cursor AgentandTheo Browne c0becc4431 Validate runtime server port range on startup
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 01:11:29 +00:00
Cursor AgentandTheo Browne 5326137670 Validate bootstrap timeout configuration at startup
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 01:10:21 +00:00
Cursor AgentandTheo Browne a201790c40 Default terminal.run cwd to launch project directory
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 01:09:35 +00:00
Cursor AgentandTheo Browne c217a55d3d Assert static POST rejection in smoke test
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 01:08:38 +00:00
Cursor AgentandTheo Browne 94b265759b Allow dash-prefixed cwd values in --cwd form
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 01:08:03 +00:00
Cursor AgentandTheo Browne 79f54596e7 Document launch directory validation requirement
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 01:05:13 +00:00
Cursor AgentandTheo Browne b0d168b6ae Validate runtime launchCwd before server startup
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 01:04:52 +00:00
Cursor AgentandTheo Browne 053488cd66 Cover relative shell editor cwd handling
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 01:04:06 +00:00
Cursor AgentandTheo Browne bf2d01729f Cover relative cwd resolution in terminal integration tests
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 01:03:32 +00:00
Cursor AgentandTheo Browne b54a6bc127 Validate shell editor targets are directories
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 01:03:02 +00:00
Cursor AgentandTheo Browne a9ef944b9d Assert missing static assets return 404 in smoke test
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 01:01:58 +00:00
Cursor AgentandTheo Browne 525c0f6a34 Return 404 for missing static assets with extensions
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 01:01:23 +00:00
Cursor AgentandTheo Browne 9f3f723db8 Trim CLI version sources before reporting
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 01:00:38 +00:00
Cursor AgentandTheo Browne d013808e3f Handle oversized websocket payload errors safely
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 00:59:45 +00:00
Cursor AgentandTheo Browne 9a5a8c7e5d Cap websocket client payload size in runtime
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 00:58:51 +00:00
Cursor AgentandTheo Browne 62bdc914e8 Cover terminal cwd file-path validation error
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 00:58:13 +00:00
Cursor AgentandTheo Browne e018d55032 Validate terminal cwd exists before command execution
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 00:57:43 +00:00
Cursor AgentandTheo Browne ead26b4c26 Optimize static HEAD responses with content-length
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 00:56:32 +00:00
Cursor AgentandTheo Browne 678da637a6 Support HEAD and 405 handling in static server
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 00:55:40 +00:00
Cursor AgentandTheo Browne 31733ba5c0 Add nosniff header for static runtime responses
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 00:54:51 +00:00
Cursor AgentandTheo Browne 9bc6b6529a Document end-of-options path flag usage
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 00:53:53 +00:00
Cursor AgentandTheo Browne be21363654 Support -- end-of-options path parsing
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 00:53:19 +00:00
Cursor AgentandTheo Browne a5b9eb61c9 Validate launch directory before starting runtime
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 00:52:40 +00:00
Cursor AgentandTheo Browne a9bb1d6b19 Reject null-byte encoded static asset paths
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 00:50:26 +00:00
Cursor AgentandTheo Browne 06785908e1 Return 404 when static fallback index is missing
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 00:49:52 +00:00
Cursor AgentandTheo Browne 92bedca342 Assert unauthorized sockets receive no frames in smoke test
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 00:49:14 +00:00
Cursor AgentandTheo Browne fcc8117975 Cache static dist realpath across requests
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 00:48:34 +00:00
Cursor AgentandTheo Browne 8dd83d1f5c Reject empty env port values in CLI parser
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 00:48:00 +00:00
Cursor AgentandTheo Browne f86860cff2 Cover backend env port upper-bound validation
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 00:46:01 +00:00
Cursor AgentandTheo Browne be9c7df998 Block static server symlink escape paths
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 00:45:20 +00:00
Cursor AgentandTheo Browne e0d34cd373 Validate CLI ports are within TCP range
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 00:42:22 +00:00
Cursor AgentandTheo Browne 6ab19a1970 Harden static asset path resolution and cwd normalization
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 00:41:35 +00:00
Cursor AgentandTheo Browne 5c6834db05 Resolve relative cwd args against parser launch directory
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 00:36:20 +00:00
Cursor AgentandTheo Browne e773e60486 Clarify T3_NO_OPEN truthy variants in CLI help text
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 00:35:03 +00:00
Cursor AgentandTheo Browne 9bd8e7b1db Normalize session cwd matching for bootstrap reuse
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 00:34:23 +00:00
Cursor AgentandTheo Browne b688456810 Cover Uint8Array websocket request decoding in runtime tests
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 00:32:20 +00:00
Cursor AgentandTheo Browne 61ddbacb77 Make static web server shutdown idempotent
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 00:31:35 +00:00
Cursor AgentandTheo Browne 35b83d45b0 Handle websocket close-before-open failures in adapter
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 00:30:52 +00:00
Cursor AgentandTheo Browne 99c9dee1b1 Make runtime server close path concurrency-safe
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 00:29:34 +00:00
Cursor AgentandTheo Browne 7cd846a5ed Cleanup runtime resources when websocket startup fails
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 00:28:30 +00:00
Cursor AgentandTheo Browne c99e231578 Assert bootstrap project name derivation in runtime tests
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 00:25:48 +00:00
Cursor AgentandTheo Browne a60abc3bb5 Unref terminal timeout watchdog timer
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 00:24:54 +00:00
Cursor AgentandTheo Browne 3db1ffe8a9 Assert unauthorized clients receive no websocket messages
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 00:22:43 +00:00
Cursor AgentandTheo Browne 01759eefcb Hoist shell.openInEditor input schema for reuse
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 00:22:02 +00:00
Cursor AgentandTheo Browne 86fcc2a949 Cover trimmed positional cwd argument parsing
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 00:21:26 +00:00
Cursor AgentandTheo Browne 223f4063ec Enforce non-empty positional cwd arguments in CLI parser
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 00:20:54 +00:00
Cursor AgentandTheo Browne b2d7c19868 Cover malformed error-response tolerance in ws adapter
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 00:17:55 +00:00
Cursor AgentandTheo Browne 0f6dd6a3ed Assert websocket hello payload in smoke test handshake
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 00:16:50 +00:00
Cursor AgentandTheo Browne cfd273e78f Cover idempotent runtime server shutdown in integration tests
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 00:16:04 +00:00
Cursor AgentandTheo Browne 14fcd1acc4 Cover websocket binaryType configuration in adapter tests
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 00:15:20 +00:00
Cursor AgentandTheo Browne 7ba2ef2027 Cover websocket recovery after open-event connection failures
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 00:14:47 +00:00
Cursor AgentandTheo Browne baf36427b3 Cover unknown agent session write and kill runtime behavior
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 00:14:14 +00:00
Cursor AgentandTheo Browne a9fbb004bf Cover shell cursor open path in runtime integration tests
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 00:13:32 +00:00
Cursor AgentandTheo Browne 9c3b44edf4 Cover dialogs.pickFolder response contract in runtime tests
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 00:12:59 +00:00
Cursor AgentandTheo Browne abe616bda8 Cover shell file-manager open path in runtime integration tests
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 00:12:20 +00:00
Cursor AgentandTheo Browne b869dc61b4 Cover websocket reconnect behavior after socket close
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 00:11:40 +00:00
Cursor AgentandTheo Browne 4f48f21186 Cover invalid providers interrupt and stop payload errors
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 00:11:09 +00:00
Cursor AgentandTheo Browne 7e196a74dd Reset failed websocket connect attempts for retry
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 00:08:58 +00:00
Cursor AgentandTheo Browne d068a0c1fc Strengthen smoke-test app.health payload assertions
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 00:08:05 +00:00
Cursor AgentandTheo Browne e01496a19c Handle websocket constructor failures in browser adapter
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 00:07:14 +00:00
Cursor AgentandTheo Browne 694818e5b3 Cover websocket responses with unknown request ids
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 00:06:20 +00:00
Cursor AgentandTheo Browne be2f37526f Assert hello protocol version in runtime integration test
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 00:05:44 +00:00
Cursor AgentandTheo Browne 0a83664bbd Cover non-zero terminal exit semantics in runtime tests
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 00:05:15 +00:00
Cursor AgentandTheo Browne 4d90913dcb Cover unknown T3_NO_OPEN values as disabled
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 00:04:34 +00:00
Cursor AgentandTheo Browne 13801292f2 Cover websocket adapter recovery after request timeouts
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 00:04:01 +00:00
Cursor AgentandTheo Browne 02c653535a Cover websocket request timeout rejection in adapter tests
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 00:03:29 +00:00
Cursor AgentandTheo Browne 7a515bc5e4 Cover providers.listSessions success path in runtime tests
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 00:02:38 +00:00
Cursor AgentandTheo Browne cef4be1258 Force-kill timed-out terminal commands when SIGTERM is ignored
Co-authored-by: Theo Browne <[email protected]>
2026-02-10 00:01:48 +00:00
Cursor AgentandTheo Browne ec24213db7 Cover terminal.run cwd execution semantics in runtime tests
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 23:59:40 +00:00
Cursor AgentandTheo Browne 4d7fdad80b Cover T3_NO_OPEN yes-value parsing
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 23:59:03 +00:00
Cursor AgentandTheo Browne 3787530124 Cover terminal timeout behavior in runtime integration tests
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 23:58:31 +00:00
Cursor AgentandTheo Browne 114ba314ec Refactor runtime agent-event polling helper in tests
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 23:57:45 +00:00
Cursor AgentandTheo Browne 123a7a62bc Assert full app.health payload in runtime integration test
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 23:57:15 +00:00
Cursor AgentandTheo Browne 4eeb87d476 Cover agent write and kill lifecycle in runtime integration tests
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 23:56:50 +00:00
Cursor AgentandTheo Browne 582561232e Cover agent output and exit event streaming in runtime tests
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 23:56:15 +00:00
Cursor AgentandTheo Browne 2d9e88e0cf Cover todo mutation lifecycle in runtime integration tests
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 23:55:16 +00:00
Cursor AgentandTheo Browne 04f619491c Cover terminal.run success path in runtime integration tests
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 23:54:43 +00:00
Cursor AgentandTheo Browne 3e2d282d58 Test ws adapter recovery from blob decode failures
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 23:52:15 +00:00
Cursor AgentandTheo Browne b20067263b Guard ws adapter decode path against async message errors
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 23:51:35 +00:00
Cursor AgentandTheo Browne f04d1204f9 Guard runtime websocket sends against state races
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 23:50:58 +00:00
Cursor AgentandTheo Browne 8f2e258849 Assert hello launchCwd metadata in runtime test
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 23:50:19 +00:00
Cursor AgentandTheo Browne ac6bae97fb Cover T3_NO_OPEN on-value parsing
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 23:49:46 +00:00
Cursor AgentandTheo Browne 2bd2fe2869 Unref bootstrap session timeout timer
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 23:49:11 +00:00
Cursor AgentandTheo Browne db8a36fc74 Cover case-insensitive T3_NO_OPEN parsing
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 23:48:33 +00:00
Cursor AgentandTheo Browne ee7ff3a849 Document flexible T3_NO_OPEN truthy values
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 23:48:01 +00:00
Cursor AgentandTheo Browne f3a1e40fce Use WebSocket.OPEN constant for runtime send guard
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 23:47:26 +00:00
Cursor AgentandTheo Browne 74a5c87bac Support truthy T3_NO_OPEN environment values
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 23:46:44 +00:00
Cursor AgentandTheo Browne 53b815b194 Reuse shared TextDecoder in ws adapter message parsing
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 23:45:59 +00:00
Cursor AgentandTheo Browne 33c3cb9a81 Clear bootstrap startup timeout on session resolution
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 23:45:26 +00:00
Cursor AgentandTheo Browne 2f6d8d790d Cover invalid providers.startSession payload errors
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 23:43:18 +00:00
Cursor AgentandTheo Browne 77a2256347 Cover invalid providers.sendTurn payload errors
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 23:42:45 +00:00
Cursor AgentandTheo Browne d747326096 Cover invalid provider respond decision payload errors
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 23:42:11 +00:00
Cursor AgentandTheo Browne c020e23735 Cover provider control error propagation in ws adapter
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 23:41:36 +00:00
Cursor AgentandTheo Browne 6e9fae8c56 Cover bootstrap error passthrough in runtime and ws adapter tests
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 23:41:00 +00:00
Cursor AgentandTheo Browne e4fdcf59d1 Expand ws adapter tests for provider turn-control methods
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 23:40:07 +00:00
Cursor AgentandTheo Browne 6ffbb138c7 Cover invalid agent.spawn payload errors
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 23:37:50 +00:00
Cursor AgentandTheo Browne 1ba6f29f58 Cover dialogs and agent method mappings in ws adapter
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 23:37:18 +00:00
Cursor AgentandTheo Browne e0a29a17ba Cover invalid todos.toggle payload errors
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 23:35:20 +00:00
Cursor AgentandTheo Browne c06af1b25e Cover invalid terminal.run payload errors
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 23:34:47 +00:00
Cursor AgentandTheo Browne 0e1f3844bf Cover invalid shell.openInEditor payload errors
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 23:34:12 +00:00
Cursor AgentandTheo Browne ff82a2c6c2 Cover todo mutation request mappings in ws adapter tests
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 23:33:35 +00:00
Cursor AgentandTheo Browne 8e429e52f1 Extend ws adapter tests for terminal and provider methods
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 23:31:03 +00:00
Cursor AgentandTheo Browne 167e97cf65 Expand ws adapter tests for bootstrap and shell methods
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 23:30:32 +00:00
Cursor AgentandTheo Browne edb3d89959 Expand runtime tests for token encoding and cwd normalization
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 23:29:47 +00:00
Cursor AgentandTheo Browne e5065c9664 Cover app.health request mapping in ws adapter tests
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 23:28:01 +00:00
Cursor AgentandTheo Browne 5012c6af70 Cover authorized single-client replacement path
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 23:27:32 +00:00
Cursor AgentandTheo Browne f3ac685f1c Assert agent event unsubscribe behavior in ws adapter
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 23:26:59 +00:00
Cursor AgentandTheo Browne 770af97034 Cover agent event subscriber paths in ws adapter tests
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 23:26:33 +00:00
Cursor AgentandTheo Browne 2b3e44046c Test ws adapter provider-event subscription lifecycle
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 23:25:45 +00:00
Cursor AgentandTheo Browne 4e36ebaea0 Cover runtime tolerance for malformed client messages
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 23:24:26 +00:00
Cursor AgentandTheo Browne bed026aed1 Cover ws adapter tolerance for malformed server messages
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 23:23:56 +00:00
Cursor AgentandTheo Browne 811e4e0365 Cover blob message decoding in ws adapter tests
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 23:23:26 +00:00
Cursor AgentandTheo Browne ffc03e7efe Cover arraybuffer responses in ws adapter tests
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 23:23:02 +00:00
Cursor AgentandTheo Browne 601fc201f0 Cover runtime auth token trimming semantics
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 23:22:37 +00:00
Cursor AgentandTheo Browne 2937134836 Cover whitespace equals-style cwd rejection
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 23:21:51 +00:00
Cursor AgentandTheo Browne 6afafe9c20 Cover empty equals-style web port values
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 23:21:28 +00:00
Cursor AgentandTheo Browne 5757cd144c Cover empty equals-style backend port values
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 23:21:07 +00:00
Cursor AgentandTheo Browne a1f0ac0724 Cover short CLI flag aliases in parser tests
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 23:20:48 +00:00
Cursor AgentandTheo Browne 51c8517395 Add ws adapter test for connection failure path
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 23:20:26 +00:00
Cursor AgentandTheo Browne f7f9f144e7 Cover ws native API singleton caching behavior
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 23:19:58 +00:00
Cursor AgentandTheo Browne 45fcdef07f Cover no-auth websocket connection behavior
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 23:19:36 +00:00
Cursor AgentandTheo Browne 6bde37d6cf Document websocket token rejection behavior
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 23:19:10 +00:00
Cursor AgentandTheo Browne 37cd2b696b Cover missing --cwd value parsing error
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 23:18:55 +00:00
Cursor AgentandTheo Browne b708a4ec89 Test missing backend and web port values
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 23:18:35 +00:00
Cursor AgentandTheo Browne 0cf6572336 Test ws adapter handling of hello prelude messages
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 23:18:11 +00:00
Cursor AgentandTheo Browne d4bd385419 Verify wrong-token websocket rejection paths
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 23:17:45 +00:00
Cursor AgentandTheo Browne ce6e47e35d Validate non-empty runtime websocket auth token
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 23:15:48 +00:00
Cursor AgentandTheo Browne e9cbb40c3d Cover whitespace-only cwd flag rejection
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 23:15:09 +00:00
Cursor AgentandTheo Browne f67a82e93c Document single-client websocket runtime policy
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 23:14:44 +00:00
Cursor AgentandTheo Browne 5816b37e5c Test trimmed --cwd argument parsing
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 23:14:21 +00:00
Cursor AgentandTheo Browne b5a830b328 Cover websocket disconnect rejection in adapter tests
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 23:13:53 +00:00
Cursor AgentandTheo Browne 2cb6ed9615 Add ws adapter test for structured error responses
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 23:13:30 +00:00
Cursor AgentandTheo Browne 8bd155f790 Cover arraybuffer websocket request decoding
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 23:13:04 +00:00
Cursor AgentandTheo Browne a73b95ae73 Ensure unauthorized websocket clients cannot evict active session
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 23:12:40 +00:00
Cursor AgentandTheo Browne cfe32a9623 Test ws adapter default runtime URL fallback
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 23:12:05 +00:00
Cursor AgentandTheo Browne 85ecef6fd6 Handle websocket send failures in browser adapter
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 23:11:38 +00:00
Cursor AgentandTheo Browne 133b0abd56 Assert unauthorized websocket rejection in smoke test
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 23:10:16 +00:00
Cursor AgentandTheo Browne f5e2112bf5 Decode non-string websocket client payloads
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 23:09:45 +00:00
Cursor AgentandTheo Browne 8ba5a22d45 Cover invalid backend env port parsing in CLI tests
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 23:09:01 +00:00
Cursor AgentandTheo Browne a5b1268ad4 Ensure smoke-test child shutdown cannot hang
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 23:08:43 +00:00
Cursor AgentandTheo Browne 5787d9cc25 Harden smoke test startup and ws token assertions
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 23:07:18 +00:00
Cursor AgentandTheo Browne ba30900df9 Assert tokenized ws URL in runtime auth test
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 23:05:42 +00:00
Cursor AgentandTheo Browne 0b9fbd7a7c Reject empty --cwd values in CLI parser
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 23:05:09 +00:00
Cursor AgentandTheo Browne 6185784ea2 Require ephemeral websocket token for CLI runtime
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 23:04:03 +00:00
Cursor AgentandTheo Browne a00269cab6 Validate environment port variables strictly
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 23:01:18 +00:00
Cursor AgentandTheo Browne 0600372cdd Drop useCallback from theme hook
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 23:00:28 +00:00
Cursor AgentandTheo Browne 709d9984c9 Remove ChatView useMemo-derived state wrappers
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 22:59:54 +00:00
Cursor AgentandTheo Browne ed2ef7d178 Support positional cwd argument for t3 CLI
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 22:55:59 +00:00
Cursor AgentandTheo Browne f153feb623 Eliminate lint warnings and remove await-in-loop patterns
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 22:53:58 +00:00
Cursor AgentandTheo Browne ff65c1356f Document automatic default port retry behavior
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 22:50:10 +00:00
Cursor AgentandTheo Browne 51d61e4894 Auto-retry default ports when startup hits EADDRINUSE
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 22:49:45 +00:00
Cursor AgentandTheo Browne ebefed3567 Improve startup errors with actionable port conflict guidance
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 22:46:55 +00:00
Cursor AgentandTheo Browne e6540e7f2d Resolve CLI version from package metadata with tests
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 22:45:13 +00:00
Cursor AgentandTheo Browne c263ff67ed Reduce redundant useMemo/useCallback around native API access
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 22:43:56 +00:00
Cursor AgentandTheo Browne f1841006c3 Add runtime health polling and sidebar offline indicator
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 22:42:11 +00:00
Cursor AgentandTheo Browne 6cc4e616bb Surface runtime connectivity errors in renderer bootstrap
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 22:40:23 +00:00
Cursor AgentandTheo Browne 39adcb6f04 Deduplicate bootstrap fallback state across repeated requests
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 22:38:14 +00:00
Cursor AgentandTheo Browne 9ca17fd398 Add runtime app.health API and smoke-test health check
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 22:34:36 +00:00
Cursor AgentandTheo Browne e2a8f16e9e Harden CLI startup cleanup and error propagation
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 22:32:39 +00:00
Cursor AgentandTheo Browne b06d25073e Support --version and strict CLI port validation
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 22:30:47 +00:00
Cursor AgentandTheo Browne b53656c055 Refresh README wording for runtime provider dispatch
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 22:28:51 +00:00
Cursor AgentandTheo Browne cb29c60edb Run t3 smoke test in CI quality pipeline
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 22:28:26 +00:00
Cursor AgentandTheo Browne 283177f852 Make bootstrap timeout configurable for faster tests
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 22:27:54 +00:00
Cursor AgentandTheo Browne 10e0622019 Add t3 smoke-test script and root runner
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 22:27:16 +00:00
Cursor AgentandTheo Browne dec8db5155 Document t3 CLI flags in quickstart
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 22:26:08 +00:00
Cursor AgentandTheo Browne 4bffbf086f Add CLI argument parsing and help coverage
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 22:25:45 +00:00
Cursor AgentandTheo Browne f1b5e8ee06 Cap bootstrap session startup latency and expand runtime tests
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 22:23:53 +00:00
Cursor AgentandTheo Browne f72970d0cc Add websocket runtime integration tests and lifecycle fixes
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 22:21:56 +00:00
Cursor AgentandTheo Browne f85db4e56d Add websocket client request timeouts and binary-safe decoding
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 22:19:20 +00:00
Cursor AgentandTheo Browne d9ec69477b Make prepack independent of PATH bun setup
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 22:16:51 +00:00
Cursor AgentandTheo Browne 9e804c3c85 Handle launcher opener failures and add no-open mode
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 22:14:37 +00:00
Cursor AgentandTheo Browne e58c71a30e Make bootstrap resilient when codex startup fails
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 22:12:27 +00:00
Cursor AgentandTheo Browne 29aeea5bdb Harden t3 packaging for npx distribution
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 22:08:41 +00:00
Cursor AgentandTheo Browne 6dc4c80bc9 Replace Electron shell with t3 websocket browser architecture
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 22:03:50 +00:00
Cursor AgentandTheo Browne cf568902cd Add renderer websocket native API adapter and bootstrap flow
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 21:52:30 +00:00
Cursor AgentandTheo Browne 1f4ff504bb Add t3 websocket runtime server and CLI launcher
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 21:49:33 +00:00
Cursor AgentandTheo Browne 6614b93ccc Add websocket transport contracts and app bootstrap API
Co-authored-by: Theo Browne <[email protected]>
2026-02-09 21:46:02 +00:00
614 changed files with 21873 additions and 127403 deletions

No files matched your search

+20
View File
@@ -0,0 +1,20 @@
---
name: btca-cli
description: btca is a cli for getting information from other git repositories by querying them with natural language. Spawns an external subagent to explore external codebases (i.e. a github repo) and answer questions about them. Great when integrating complex libraries, frameworks, or tools.
---
btca is a cli for asking questions about various folders, primarily git repositories. It's built to give you the exact information you need without bloating your context window. btca uses agents under the hood to answer your question, so prompt it the way you would prompt a tool similar to yourself.
For example, assuming you have a resource named `codex`, you can ask questions like:
```bash
btca ask -r codex -q "What is the return format for Codex App Server responses? Are there any edge cases worth knowing?"
```
Your prompt may include specific names for resources to use, if they do then you should try those first. If you need to check available resources, you can use the `btca resources` command.
New resources can be created if the ones you need do not yet exist.
```bash
btca add -n svelte-dev https://github.com/sveltejs/svelte.dev
```
@@ -0,0 +1,3 @@
interface:
display_name: "BTCA CLI"
short_description: "Help with BTCA CLI setup and usage workflows"
-143
View File
@@ -1,143 +0,0 @@
# Architecture
T3 Code runs as a **Node.js WebSocket server** that wraps `codex app-server` (JSON-RPC over stdio) and serves a React web app.
```
┌─────────────────────────────────┐
│ Browser (React + Vite) │
│ wsTransport (state machine) │
│ Typed push decode at boundary │
└──────────┬──────────────────────┘
│ ws://localhost:3773
┌──────────▼──────────────────────┐
│ apps/server (Node.js) │
│ WebSocket + HTTP static server │
│ ServerPushBus (ordered pushes) │
│ ServerReadiness (startup gate) │
│ OrchestrationEngine │
│ ProviderService │
│ CheckpointReactor │
│ RuntimeReceiptBus │
└──────────┬──────────────────────┘
│ JSON-RPC over stdio
┌──────────▼──────────────────────┐
│ codex app-server │
└─────────────────────────────────┘
```
## Components
- **Browser app**: The React app renders session state, owns the client-side WebSocket transport, and treats typed push events as the boundary between server runtime details and UI state.
- **Server**: `apps/server` is the main coordinator. It serves the web app, accepts WebSocket requests, waits for startup readiness before welcoming clients, and sends all outbound pushes through a single ordered push path.
- **Provider runtime**: `codex app-server` does the actual provider/session work. The server talks to it over JSON-RPC on stdio and translates those runtime events into the app's orchestration model.
- **Background workers**: Long-running async flows such as runtime ingestion, command reaction, and checkpoint processing run as queue-backed workers. This keeps work ordered, reduces timing races, and gives tests a deterministic way to wait for the system to go idle.
- **Runtime signals**: The server emits lightweight typed receipts when important async milestones finish, such as checkpoint capture, diff finalization, or a turn becoming fully quiescent. Tests and orchestration code wait on these signals instead of polling internal state.
## Event Lifecycle
### Startup and client connect
```mermaid
sequenceDiagram
participant Browser
participant Transport as WsTransport
participant Server as wsServer
participant Layers as serverLayers
participant Ready as ServerReadiness
participant Push as ServerPushBus
Browser->>Transport: Load app and open WebSocket
Transport->>Server: Connect
Server->>Layers: Start runtime services
Server->>Ready: Wait for startup barriers
Ready-->>Server: Ready
Server->>Push: Publish server.welcome
Push-->>Transport: Ordered welcome push
Transport-->>Browser: Hydrate initial state
```
1. The browser boots [`WsTransport`][1] and registers typed listeners in [`wsNativeApi`][2].
2. The server accepts the connection in [`wsServer`][3] and brings up the runtime graph defined in [`serverLayers`][7].
3. [`ServerReadiness`][4] waits until the key startup barriers are complete.
4. Once the server is ready, [`wsServer`][3] sends `server.welcome` from the contracts in [`ws.ts`][6] through [`ServerPushBus`][5].
5. The browser receives that ordered push through [`WsTransport`][1], and [`wsNativeApi`][2] uses it to seed local client state.
### User turn flow
```mermaid
sequenceDiagram
participant Browser
participant Transport as WsTransport
participant Server as wsServer
participant Provider as ProviderService
participant Codex as codex app-server
participant Ingest as ProviderRuntimeIngestion
participant Engine as OrchestrationEngine
participant Push as ServerPushBus
Browser->>Transport: Send user action
Transport->>Server: Typed WebSocket request
Server->>Provider: Route request
Provider->>Codex: JSON-RPC over stdio
Codex-->>Ingest: Provider runtime events
Ingest->>Engine: Normalize into orchestration events
Engine-->>Server: Domain events
Server->>Push: Publish orchestration.domainEvent
Push-->>Browser: Typed push
```
1. A user action in the browser becomes a typed request through [`WsTransport`][1] and the browser API layer in [`nativeApi`][12].
2. [`wsServer`][3] decodes that request using the shared WebSocket contracts in [`ws.ts`][6] and routes it to the right service.
3. [`ProviderService`][8] starts or resumes a session and talks to `codex app-server` over JSON-RPC on stdio.
4. Provider-native events are pulled back into the server by [`ProviderRuntimeIngestion`][9], which converts them into orchestration events.
5. [`OrchestrationEngine`][10] persists those events, updates the read model, and exposes them as domain events.
6. [`wsServer`][3] pushes those updates to the browser through [`ServerPushBus`][5] on channels defined in [`orchestration.ts`][11].
### Async completion flow
```mermaid
sequenceDiagram
participant Server as wsServer
participant Worker as Queue-backed workers
participant Cmd as ProviderCommandReactor
participant Checkpoint as CheckpointReactor
participant Receipt as RuntimeReceiptBus
participant Push as ServerPushBus
participant Browser
Server->>Worker: Enqueue follow-up work
Worker->>Cmd: Process provider commands
Worker->>Checkpoint: Process checkpoint tasks
Checkpoint->>Receipt: Publish completion receipt
Cmd-->>Server: Produce orchestration changes
Checkpoint-->>Server: Produce orchestration changes
Server->>Push: Publish resulting state updates
Push-->>Browser: User-visible push
```
1. Some work continues after the initial request returns, especially in [`ProviderRuntimeIngestion`][9], [`ProviderCommandReactor`][13], and [`CheckpointReactor`][14].
2. These flows run as queue-backed workers using [`DrainableWorker`][16], which helps keep side effects ordered and test synchronization deterministic.
3. When a milestone completes, the server emits a typed receipt on [`RuntimeReceiptBus`][15], such as checkpoint completion or turn quiescence.
4. Tests and orchestration code wait on those receipts instead of polling git state, projections, or timers.
5. Any user-visible state changes produced by that async work still go back through [`wsServer`][3] and [`ServerPushBus`][5].
[1]: ../apps/web/src/wsTransport.ts
[2]: ../apps/web/src/wsNativeApi.ts
[3]: ../apps/server/src/wsServer.ts
[4]: ../apps/server/src/wsServer/readiness.ts
[5]: ../apps/server/src/wsServer/pushBus.ts
[6]: ../packages/contracts/src/ws.ts
[7]: ../apps/server/src/serverLayers.ts
[8]: ../apps/server/src/provider/Layers/ProviderService.ts
[9]: ../apps/server/src/orchestration/Layers/ProviderRuntimeIngestion.ts
[10]: ../apps/server/src/orchestration/Layers/OrchestrationEngine.ts
[11]: ../packages/contracts/src/orchestration.ts
[12]: ../apps/web/src/nativeApi.ts
[13]: ../apps/server/src/orchestration/Layers/ProviderCommandReactor.ts
[14]: ../apps/server/src/orchestration/Layers/CheckpointReactor.ts
[15]: ../apps/server/src/orchestration/Layers/RuntimeReceiptBus.ts
[16]: ../packages/shared/src/DrainableWorker.ts
-6
View File
@@ -1,6 +0,0 @@
# CI quality gates
- `.github/workflows/ci.yml` runs `bun run lint`, `bun run typecheck`, and `bun run test` on pull requests and pushes to `main`.
- `.github/workflows/release.yml` builds macOS (`arm64` and `x64`), Linux (`x64`), and Windows (`x64`) desktop artifacts from a single `v*.*.*` tag and publishes one GitHub release.
- The release workflow auto-enables signing only when secrets are present: Apple credentials for macOS and Azure Trusted Signing credentials for Windows. Without secrets, it still releases unsigned artifacts.
- See `docs/release.md` for full release/signing setup checklist.
-5
View File
@@ -1,5 +0,0 @@
# Codex prerequisites
- Install Codex CLI so `codex` is on your PATH.
- Authenticate Codex before running T3 Code (for example via API key or ChatGPT auth supported by Codex).
- T3 Code starts the server via `codex app-server` per session.
-180
View File
@@ -1,180 +0,0 @@
# Encyclopedia
This is a living glossary for T3 Code. It explains what common terms mean in this codebase.
## Table of contents
- [Project and workspace](#project-and-workspace)
- [Thread timeline](#thread-timeline)
- [Orchestration](#orchestration)
- [Provider runtime](#provider-runtime)
- [Checkpointing](#checkpointing)
## Concepts
### Project and workspace
#### Project
The top-level workspace record in the app. In [the orchestration contracts][1], a project has a `workspaceRoot`, a title, and one or more threads. See [workspace-layout.md][2].
#### Workspace root
The root filesystem path for a project. In [the orchestration model][1], it is the base directory for branches and optional worktrees. See [workspace-layout.md][2].
#### Worktree
A Git worktree used as an isolated workspace for a thread. If a thread has a `worktreePath` in [the contracts][1], it runs there instead of in the main working tree. Git operations live in [GitCore.ts][3].
### Thread timeline
#### Thread
The main durable unit of conversation and workspace history. In [the orchestration contracts][1], a thread holds messages, activities, checkpoints, and session-related state. See [projector.ts][4].
#### Turn
A single user-to-assistant work cycle inside a thread. It starts with user input and ends when follow-up work like checkpointing settles. See [the contracts][1], [ProviderRuntimeIngestion.ts][5], and [CheckpointReactor.ts][6].
#### Activity
A user-visible log item attached to a thread. In [the contracts][1], activities cover important non-message events like approvals, tool actions, and failures. They are projected into thread state in [projector.ts][4].
### Orchestration
Orchestration is the server-side domain layer that turns runtime activity into stable app state. The main entry point is [OrchestrationEngine.ts][7], with core logic in [decider.ts][8] and [projector.ts][4].
#### Aggregate
The domain object a command or event belongs to. In [the contracts][1], that is usually `project` or `thread`. See [decider.ts][8].
#### Command
A typed request to change domain state. In [the contracts][1], commands are validated in [commandInvariants.ts][9] and turned into events by [decider.ts][8].
Examples include `thread.create`, `thread.turn.start`, and `thread.checkpoint.revert`.
#### Domain Event
A persisted fact that something already happened. In [the contracts][1], events are the source of truth, and [projector.ts][4] shows how they are applied.
Examples include `thread.created`, `thread.message-sent`, and `thread.turn-diff-completed`.
#### Decider
The pure orchestration logic that turns commands plus current state into events. The core implementation is in [decider.ts][8], with preconditions in [commandInvariants.ts][9].
#### Projection
A read-optimized view derived from events. See [projector.ts][4], [ProjectionPipeline.ts][11], and [ProjectionSnapshotQuery.ts][10].
#### Projector
The logic that applies domain events to the read model or projection tables. See [projector.ts][4] and [ProjectionPipeline.ts][11].
#### Read model
The current materialized view of orchestration state. In [the contracts][1], it holds projects, threads, messages, activities, checkpoints, and session state. See [ProjectionSnapshotQuery.ts][10] and [OrchestrationEngine.ts][7].
#### Reactor
A side-effecting service that handles follow-up work after events or runtime signals. Examples include [CheckpointReactor.ts][6], [ProviderCommandReactor.ts][12], and [ProviderRuntimeIngestion.ts][5].
#### Receipt
A lightweight typed runtime signal emitted when an async milestone completes. See [RuntimeReceiptBus.ts][13].
Examples include `checkpoint.baseline.captured`, `checkpoint.diff.finalized`, and `turn.processing.quiesced`, which are emitted by flows such as [CheckpointReactor.ts][6].
#### Quiesced
"Quiesced" means a turn has gone quiet and stable. In [the receipt schema][13], it means the follow-up work has settled, including work in [CheckpointReactor.ts][6].
### Provider runtime
The live backend agent implementation and its event stream. The main service is [ProviderService.ts][14], the adapter contract is [ProviderAdapter.ts][15], and the overview is in [provider-architecture.md][16].
#### Provider
The backend agent runtime that actually performs work. See [ProviderService.ts][14], [ProviderAdapter.ts][15], and [CodexAdapter.ts][17].
#### Session
The live provider-backed runtime attached to a thread. Session shape is in [the orchestration contracts][1], and lifecycle is managed in [ProviderService.ts][14].
#### Runtime mode
The safety/access mode for a thread or session. In [the contracts][1], the main values are `approval-required` and `full-access`. See [runtime-modes.md][18].
#### Interaction mode
The agent interaction style for a thread. In [the contracts][1], the main values are `default` and `plan`. See [runtime-modes.md][18].
#### Assistant delivery mode
Controls how assistant text reaches the thread timeline. In [the contracts][1], `streaming` updates incrementally and `buffered` delivers a completed result. See [ProviderService.ts][14].
#### Snapshot
A point-in-time view of state. The word is used in multiple layers, including orchestration, provider, and checkpointing. See [ProjectionSnapshotQuery.ts][10], [ProviderAdapter.ts][15], and [CheckpointStore.ts][19].
### Checkpointing
Checkpointing captures workspace state over time so the app can diff turns and restore earlier points. The main pieces are [CheckpointStore.ts][19], [CheckpointDiffQuery.ts][20], and [CheckpointReactor.ts][6].
#### Checkpoint
A saved snapshot of a thread workspace at a particular turn. In practice it is a hidden Git ref in [CheckpointStore.ts][19] plus a projected summary from [ProjectionCheckpoints.ts][21]. Capture and lifecycle work happen in [CheckpointReactor.ts][6].
#### Checkpoint ref
The durable identifier for a filesystem checkpoint, stored as a Git ref. It is typed in [the contracts][1], constructed in [Utils.ts][22], and used by [CheckpointStore.ts][19].
#### Checkpoint baseline
The starting checkpoint for diffing a thread timeline. This flow is surfaced through [RuntimeReceiptBus.ts][13], coordinated in [CheckpointReactor.ts][6], and supported by [Utils.ts][22].
#### Checkpoint diff
The patch difference between two checkpoints. Query logic lives in [CheckpointDiffQuery.ts][20], diff parsing lives in [Diffs.ts][23], and finalization is coordinated by [CheckpointReactor.ts][6].
#### Turn diff
The file patch and changed-file summary for one turn. It is usually computed in [CheckpointDiffQuery.ts][20], represented in [the contracts][1], and recorded into thread state by [projector.ts][4].
## Practical Shortcuts
- If you see `requested`, think "intent recorded".
- If you see `completed`, think "result applied".
- If you see `receipt`, think "async milestone signal".
- If you see `checkpoint`, think "workspace snapshot for diff/restore".
- If you see `quiesced`, think "all relevant follow-up work has gone idle".
## Related Docs
- [architecture.md][24]
- [provider-architecture.md][16]
- [runtime-modes.md][18]
- [workspace-layout.md][2]
[1]: ../packages/contracts/src/orchestration.ts
[2]: ./workspace-layout.md
[3]: ../apps/server/src/git/Layers/GitCore.ts
[4]: ../apps/server/src/orchestration/projector.ts
[5]: ../apps/server/src/orchestration/Layers/ProviderRuntimeIngestion.ts
[6]: ../apps/server/src/orchestration/Layers/CheckpointReactor.ts
[7]: ../apps/server/src/orchestration/Layers/OrchestrationEngine.ts
[8]: ../apps/server/src/orchestration/decider.ts
[9]: ../apps/server/src/orchestration/commandInvariants.ts
[10]: ../apps/server/src/orchestration/Layers/ProjectionSnapshotQuery.ts
[11]: ../apps/server/src/orchestration/Layers/ProjectionPipeline.ts
[12]: ../apps/server/src/orchestration/Layers/ProviderCommandReactor.ts
[13]: ../apps/server/src/orchestration/Services/RuntimeReceiptBus.ts
[14]: ../apps/server/src/provider/Layers/ProviderService.ts
[15]: ../apps/server/src/provider/Services/ProviderAdapter.ts
[16]: ./provider-architecture.md
[17]: ../apps/server/src/provider/Layers/CodexAdapter.ts
[18]: ./runtime-modes.md
[19]: ../apps/server/src/checkpointing/Services/CheckpointStore.ts
[20]: ../apps/server/src/checkpointing/Services/CheckpointDiffQuery.ts
[21]: ../apps/server/src/persistence/Services/ProjectionCheckpoints.ts
[22]: ../apps/server/src/checkpointing/Utils.ts
[23]: ../apps/server/src/checkpointing/Diffs.ts
[24]: ./architecture.md
-30
View File
@@ -1,30 +0,0 @@
# Provider architecture
The web app communicates with the server via WebSocket using a simple JSON-RPC-style protocol:
- **Request/Response**: `{ id, method, params }` → `{ id, result }` or `{ id, error }`
- **Push events**: typed envelopes with `channel`, `sequence` (monotonic per connection), and channel-specific `data`
Push channels: `server.welcome`, `server.configUpdated`, `terminal.event`, `orchestration.domainEvent`. Payloads are schema-validated at the transport boundary (`wsTransport.ts`). Decode failures produce structured `WsDecodeDiagnostic` with `code`, `reason`, and path info.
Methods mirror the `NativeApi` interface defined in `@t3tools/contracts`:
- `providers.startSession`, `providers.sendTurn`, `providers.interruptTurn`
- `providers.respondToRequest`, `providers.stopSession`
- `shell.openInEditor`, `server.getConfig`
Codex is the only implemented provider. `claudeCode` is reserved in contracts/UI.
## Client transport
`wsTransport.ts` manages connection state: `connecting` → `open` → `reconnecting` → `closed` → `disposed`. Outbound requests are queued while disconnected and flushed on reconnect. Inbound pushes are decoded and validated at the boundary, then cached per channel. Subscribers can opt into `replayLatest` to receive the last push on subscribe.
## Server-side orchestration layers
Provider runtime events flow through queue-based workers:
1. **ProviderRuntimeIngestion** — consumes provider runtime streams, emits orchestration commands
2. **ProviderCommandReactor** — reacts to orchestration intent events, dispatches provider calls
3. **CheckpointReactor** — captures git checkpoints on turn start/complete, publishes runtime receipts
All three use `DrainableWorker` internally and expose `drain()` for deterministic test synchronization.
-22
View File
@@ -1,22 +0,0 @@
# Quick start
```bash
# Development (with hot reload)
bun run dev
# Desktop development
bun run dev:desktop
# Desktop development on an isolated port set
T3CODE_DEV_INSTANCE=feature-xyz bun run dev:desktop
# Production
bun run build
bun run start
# Build a shareable macOS .dmg (arm64 by default)
bun run dist:desktop:dmg
# Or from any project directory after publishing:
npx t3
```
-6
View File
@@ -1,6 +0,0 @@
# Runtime modes
T3 Code has a global runtime mode switch in the chat toolbar:
- **Full access** (default): starts sessions with `approvalPolicy: never` and `sandboxMode: danger-full-access`.
- **Supervised**: starts sessions with `approvalPolicy: on-request` and `sandboxMode: workspace-write`, then prompts in-app for command/file approvals.
-42
View File
@@ -1,42 +0,0 @@
# Scripts
- `bun run dev` — Starts contracts, server, and web in `turbo watch` mode.
- `bun run dev:server` — Starts just the WebSocket server (uses Bun TypeScript execution).
- `bun run dev:web` — Starts just the Vite dev server for the web app.
- Dev commands default `T3CODE_STATE_DIR` to `~/.t3/dev` to keep dev state isolated from desktop/prod state.
- Override server CLI-equivalent flags from root dev commands with `--`, for example:
`bun run dev -- --state-dir ~/.t3/another-dev-state`
- `bun run start` — Runs the production server (serves built web app as static files).
- `bun run build` — Builds contracts, web app, and server through Turbo.
- `bun run typecheck` — Strict TypeScript checks for all packages.
- `bun run test` — Runs workspace tests.
- `bun run dist:desktop:artifact -- --platform <mac|linux|win> --target <target> --arch <arch>` — Builds a desktop artifact for a specific platform/target/arch.
- `bun run dist:desktop:dmg` — Builds a shareable macOS `.dmg` into `./release`.
- `bun run dist:desktop:dmg:x64` — Builds an Intel macOS `.dmg`.
- `bun run dist:desktop:linux` — Builds a Linux AppImage into `./release`.
- `bun run dist:desktop:win` — Builds a Windows NSIS installer into `./release`.
## Desktop `.dmg` packaging notes
- Default build is unsigned/not notarized for local sharing.
- The DMG build uses `assets/macos-icon-1024.png` as the production app icon source.
- Desktop production windows load the bundled UI from `t3://app/index.html` (not a `127.0.0.1` document URL).
- Desktop packaging includes `apps/server/dist` (the `t3` backend) and starts it on loopback with an auth token for WebSocket/API traffic.
- Your tester can still open it on macOS by right-clicking the app and choosing **Open** on first launch.
- To keep staging files for debugging package contents, run: `bun run dist:desktop:dmg -- --keep-stage`
- To allow code-signing/notarization when configured in CI/secrets, add: `--signed`.
- Windows `--signed` uses Azure Trusted Signing and expects:
`AZURE_TRUSTED_SIGNING_ENDPOINT`, `AZURE_TRUSTED_SIGNING_ACCOUNT_NAME`,
`AZURE_TRUSTED_SIGNING_CERTIFICATE_PROFILE_NAME`, and `AZURE_TRUSTED_SIGNING_PUBLISHER_NAME`.
- Azure authentication env vars are also required (for example service principal with secret):
`AZURE_TENANT_ID`, `AZURE_CLIENT_ID`, `AZURE_CLIENT_SECRET`.
## Running multiple dev instances
Set `T3CODE_DEV_INSTANCE` to any value to deterministically shift all dev ports together.
- Default ports: server `3773`, web `5733`
- Shifted ports: `base + offset` (offset is hashed from `T3CODE_DEV_INSTANCE`)
- Example: `T3CODE_DEV_INSTANCE=branch-a bun run dev:desktop`
If you want full control instead of hashing, set `T3CODE_PORT_OFFSET` to a numeric offset.
-7
View File
@@ -1,7 +0,0 @@
# Workspace layout
- `/apps/server`: Node.js WebSocket server. Wraps Codex app-server, serves the built web app, and opens the browser on start.
- `/apps/web`: React + Vite UI. Session control, conversation, and provider event rendering. Connects to the server via WebSocket.
- `/apps/desktop`: Electron shell. Spawns a desktop-scoped `t3` backend process and loads the shared web app.
- `/packages/contracts`: Shared effect/Schema schemas and TypeScript contracts for provider events, WebSocket protocol, and model/session types.
- `/packages/shared`: Shared runtime utilities consumed by both server and web. Uses explicit subpath exports (e.g. `@t3tools/shared/git`, `@t3tools/shared/DrainableWorker`) — no barrel index.
-117
View File
@@ -1,117 +0,0 @@
name: Bug report
description: Report broken behavior, regressions, crashes, or reliability issues.
title: "[Bug]: "
labels:
- bug
- needs-triage
body:
- type: markdown
attributes:
value: |
Use this form for broken behavior, regressions, crashes, or reliability problems.
Search existing issues first and keep the report focused on one problem.
- type: checkboxes
id: checks
attributes:
label: Before submitting
options:
- label: I searched existing issues and did not find a duplicate.
required: true
- label: I included enough detail to reproduce or investigate the problem.
required: true
- type: dropdown
id: area
attributes:
label: Area
description: Which part of the project is affected?
options:
- apps/web
- apps/server
- apps/desktop
- packages/contracts or packages/shared
- Build, CI, or release tooling
- Docs
- Not sure
validations:
required: true
- type: textarea
id: steps
attributes:
label: Steps to reproduce
description: Provide a minimal, deterministic repro.
placeholder: |
1. Start the app with ...
2. Open ...
3. Disconnect the network
4. Reconnect and send another prompt
validations:
required: true
- type: textarea
id: expected
attributes:
label: Expected behavior
placeholder: The thread should resume normally and accept the new message.
validations:
required: true
- type: textarea
id: actual
attributes:
label: Actual behavior
placeholder: The composer clears, no new turn starts, and the session stays in a pending state.
validations:
required: true
- type: dropdown
id: impact
attributes:
label: Impact
description: How bad is this in practice?
options:
- Blocks work completely
- Major degradation or frequent failure
- Minor bug or occasional failure
- Cosmetic issue
validations:
required: true
- type: input
id: version
attributes:
label: Version or commit
description: Release version, commit SHA, or branch name if known.
placeholder: main @ abc1234
- type: input
id: environment
attributes:
label: Environment
description: OS, browser or desktop app version, Node/Bun version, provider/model if relevant.
placeholder: macOS 15.3, Chrome 135, Bun 1.3.9, Codex app-server ...
- type: textarea
id: logs
attributes:
label: Logs or stack traces
description: Paste the most relevant output only. Redact secrets.
render: shell
- type: upload
id: attachments
attributes:
label: Screenshots, recordings, or supporting files
description: Upload screenshots, short recordings, repro archives, or log files. Redact secrets before uploading.
validations:
required: false
accept: ".png,.jpg,.jpeg,.gif,.webp,.svg,.mp4,.mov,.webm,.log,.txt,.json,.zip"
- type: textarea
id: workaround
attributes:
label: Workaround
description: If you found a temporary workaround, include it.
placeholder: Restarting the provider session clears the stuck state.
-101
View File
@@ -1,101 +0,0 @@
name: Feature request
description: Propose a scoped improvement or new capability.
title: "[Feature]: "
labels:
- enhancement
- needs-triage
body:
- type: markdown
attributes:
value: |
Use this form for new capabilities or meaningful improvements to existing behavior.
This repo is still early. Small, concrete requests that clearly explain the problem and scope are much easier to evaluate.
- type: checkboxes
id: checks
attributes:
label: Before submitting
options:
- label: I searched existing issues and did not find a duplicate.
required: true
- label: I am describing a concrete problem or use case, not just a vague idea.
required: true
- type: dropdown
id: area
attributes:
label: Area
description: Which part of the project would this change affect?
options:
- apps/web
- apps/server
- apps/desktop
- packages/contracts or packages/shared
- Build, CI, or release tooling
- Docs
- Not sure
validations:
required: true
- type: textarea
id: problem
attributes:
label: Problem or use case
description: What are you trying to do? What is hard, slow, or impossible today?
placeholder: I want to reconnect to an existing provider session after a browser refresh without losing the current thread state.
validations:
required: true
- type: textarea
id: proposal
attributes:
label: Proposed solution
description: Describe the behavior, API, or UX you want.
placeholder: Persist enough session metadata so the client can discover and reattach to the active provider session on load.
validations:
required: true
- type: textarea
id: value
attributes:
label: Why this matters
description: Who benefits, and what outcome does this unlock?
placeholder: This would make reconnects predictable during network drops and reduce accidental duplicate sessions.
validations:
required: true
- type: textarea
id: scope
attributes:
label: Smallest useful scope
description: What is the narrowest version of this request that would still solve your problem?
placeholder: A first pass only needs to support restoring the active session for the current thread.
validations:
required: true
- type: textarea
id: alternatives
attributes:
label: Alternatives considered
description: Workarounds, prior art, or other approaches you considered.
placeholder: I currently work around this by manually restarting the provider session, but that loses in-flight context.
- type: textarea
id: tradeoffs
attributes:
label: Risks or tradeoffs
description: What costs, complexity, or edge cases should be considered?
placeholder: This may require careful handling when the underlying provider session has already exited.
- type: textarea
id: references
attributes:
label: Examples or references
description: Links, screenshots, mockups, or comparable tools.
- type: checkboxes
id: contribution
attributes:
label: Contribution
options:
- label: I would be open to helping implement this.
-31
View File
@@ -1,31 +0,0 @@
# Trust list for this repository.
#
# External contributors listed here are treated as trusted by the vouch
# workflow. Collaborators with write access are automatically trusted and
# do not need to be duplicated in this file.
#
# Syntax:
# github:username
# -github:username reason for denouncement
#
# Keep entries sorted alphabetically.
github:adityavardhansharma
github:binbandit
github:chuks-qua
github:cursoragent
github:gbarros-dev
github:github-actions[bot]
github:hwanseoc
github:jamesx0416
github:jasonLaster
github:JoeEverest
github:maria-rcks
github:nmggithub
github:Noojuno
github:notkainoa
github:PatrickBauer
github:realAhmedRoach
github:shiroyasha9
github:Yash-Singh1
github:eggfriedrice24
github:Ymit24
-33
View File
@@ -1,33 +0,0 @@
<!--
⚠️ READ BEFORE OPENING ⚠️
We are not actively accepting contributions right now.
You can still open a PR, but please do so knowing there is a high chance
we may close it without merging it, or never review it.
- Small, focused PRs are strongly preferred. Bug fixes are most likely to be merged.
- New features will most likely just annoy us.
- 1,000+ line PRs with a bunch of new features will probably get you banned from the repo.
-->
## What Changed
<!-- Describe the change clearly and keep scope tight. -->
## Why
<!-- Explain the problem being solved and why this approach is the right one. -->
## UI Changes
<!-- If this PR changes UI, include clear before/after screenshots.
If the change involves motion or interaction, include a short video.
Delete this section if not applicable. -->
## Checklist
- [ ] This PR is small and focused
- [ ] I explained what changed and why
- [ ] I included before/after screenshots for any UI changes
- [ ] I included a video for animation/interaction changes
+7 -56
View File
@@ -8,24 +8,19 @@ on:
jobs:
quality:
name: Format, Lint, Typecheck, Test, Browser Test, Build
runs-on: blacksmith-4vcpu-ubuntu-2404
name: Lint, Typecheck, Test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version-file: package.json
- name: Setup Node
uses: actions/setup-node@v6
with:
node-version-file: package.json
bun-version: 1.3.9
- name: Cache Bun and Turbo
uses: actions/cache@v5
uses: actions/cache@v4
with:
path: |
~/.bun/install/cache
@@ -34,20 +29,9 @@ jobs:
restore-keys: |
${{ runner.os }}-bun-${{ hashFiles('bun.lock') }}-
- name: Cache Playwright browsers
uses: actions/cache@v5
with:
path: ~/.cache/ms-playwright
key: ${{ runner.os }}-playwright-${{ hashFiles('bun.lock') }}
restore-keys: |
${{ runner.os }}-playwright-
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Format
run: bun run fmt:check
- name: Lint
run: bun run lint
@@ -57,38 +41,5 @@ jobs:
- name: Test
run: bun run test
- name: Install browser test runtime
run: |
cd apps/web
bunx playwright install --with-deps chromium
- name: Browser test
run: bun run --cwd apps/web test:browser
- name: Build desktop pipeline
run: bun run build:desktop
- name: Verify preload bundle output
run: |
test -f apps/desktop/dist-electron/preload.js
grep -nE "desktopBridge|getWsUrl|PICK_FOLDER_CHANNEL|wsUrl" apps/desktop/dist-electron/preload.js
release_smoke:
name: Release Smoke
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version-file: package.json
- name: Setup Node
uses: actions/setup-node@v6
with:
node-version-file: package.json
- name: Exercise release-only workflow steps
run: node scripts/release-smoke.ts
- name: Smoke Test (t3 runtime)
run: bun run --cwd apps/t3 build && bun run smoke-test
-75
View File
@@ -1,75 +0,0 @@
name: Issue Labels
on:
push:
branches:
- main
paths:
- .github/ISSUE_TEMPLATE/**
- .github/workflows/issue-labels.yml
workflow_dispatch:
permissions:
issues: write
jobs:
sync:
name: Sync issue labels
runs-on: ubuntu-24.04
steps:
- name: Ensure managed issue labels exist
uses: actions/github-script@v7
with:
script: |
const managedLabels = [
{
name: "bug",
color: "d73a4a",
description: "Something is broken or behaving incorrectly.",
},
{
name: "enhancement",
color: "a2eeef",
description: "Requested improvement or new capability.",
},
{
name: "needs-triage",
color: "fbca04",
description: "Issue needs maintainer review and initial categorization.",
},
];
for (const label of managedLabels) {
try {
const { data: existing } = await github.rest.issues.getLabel({
owner: context.repo.owner,
repo: context.repo.repo,
name: label.name,
});
if (
existing.color !== label.color ||
(existing.description ?? "") !== label.description
) {
await github.rest.issues.updateLabel({
owner: context.repo.owner,
repo: context.repo.repo,
name: label.name,
color: label.color,
description: label.description,
});
}
} catch (error) {
if (error.status !== 404) {
throw error;
}
await github.rest.issues.createLabel({
owner: context.repo.owner,
repo: context.repo.repo,
name: label.name,
color: label.color,
description: label.description,
});
}
}
-202
View File
@@ -1,202 +0,0 @@
name: PR Size
on:
pull_request_target:
types: [opened, reopened, synchronize, ready_for_review, converted_to_draft]
permissions:
contents: read
jobs:
prepare-config:
name: Prepare PR size config
runs-on: ubuntu-24.04
outputs:
labels_json: ${{ steps.config.outputs.labels_json }}
steps:
- id: config
name: Build PR size label config
uses: actions/github-script@v8
with:
result-encoding: string
script: |
const managedLabels = [
{
name: "size:XS",
color: "0e8a16",
description: "0-9 changed lines (additions + deletions).",
},
{
name: "size:S",
color: "5ebd3e",
description: "10-29 changed lines (additions + deletions).",
},
{
name: "size:M",
color: "fbca04",
description: "30-99 changed lines (additions + deletions).",
},
{
name: "size:L",
color: "fe7d37",
description: "100-499 changed lines (additions + deletions).",
},
{
name: "size:XL",
color: "d93f0b",
description: "500-999 changed lines (additions + deletions).",
},
{
name: "size:XXL",
color: "b60205",
description: "1,000+ changed lines (additions + deletions).",
},
];
core.setOutput("labels_json", JSON.stringify(managedLabels));
sync-label-definitions:
name: Sync PR size label definitions
needs: prepare-config
if: github.event_name != 'pull_request_target'
runs-on: ubuntu-24.04
permissions:
contents: read
issues: write
steps:
- name: Ensure PR size labels exist
uses: actions/github-script@v8
env:
PR_SIZE_LABELS_JSON: ${{ needs.prepare-config.outputs.labels_json }}
with:
script: |
const managedLabels = JSON.parse(process.env.PR_SIZE_LABELS_JSON ?? "[]");
for (const label of managedLabels) {
try {
const { data: existing } = await github.rest.issues.getLabel({
owner: context.repo.owner,
repo: context.repo.repo,
name: label.name,
});
if (
existing.color !== label.color ||
(existing.description ?? "") !== label.description
) {
await github.rest.issues.updateLabel({
owner: context.repo.owner,
repo: context.repo.repo,
name: label.name,
color: label.color,
description: label.description,
});
}
} catch (error) {
if (error.status !== 404) {
throw error;
}
try {
await github.rest.issues.createLabel({
owner: context.repo.owner,
repo: context.repo.repo,
name: label.name,
color: label.color,
description: label.description,
});
} catch (createError) {
if (createError.status !== 422) {
throw createError;
}
}
}
}
label:
name: Label PR size
needs: prepare-config
if: github.event_name == 'pull_request_target'
runs-on: ubuntu-24.04
permissions:
contents: read
issues: read
pull-requests: write
concurrency:
group: pr-size-${{ github.event.pull_request.number }}
cancel-in-progress: true
steps:
- name: Sync PR size label
uses: actions/github-script@v8
env:
PR_SIZE_LABELS_JSON: ${{ needs.prepare-config.outputs.labels_json }}
with:
script: |
const issueNumber = context.payload.pull_request.number;
const additions = context.payload.pull_request.additions ?? 0;
const deletions = context.payload.pull_request.deletions ?? 0;
const changedLines = additions + deletions;
const managedLabels = JSON.parse(process.env.PR_SIZE_LABELS_JSON ?? "[]");
const managedLabelNames = new Set(managedLabels.map((label) => label.name));
const resolveSizeLabel = (totalChangedLines) => {
if (totalChangedLines < 10) {
return "size:XS";
}
if (totalChangedLines < 30) {
return "size:S";
}
if (totalChangedLines < 100) {
return "size:M";
}
if (totalChangedLines < 500) {
return "size:L";
}
if (totalChangedLines < 1000) {
return "size:XL";
}
return "size:XXL";
};
const nextLabelName = resolveSizeLabel(changedLines);
const { data: currentLabels } = await github.rest.issues.listLabelsOnIssue({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issueNumber,
per_page: 100,
});
for (const label of currentLabels) {
if (!managedLabelNames.has(label.name) || label.name === nextLabelName) {
continue;
}
try {
await github.rest.issues.removeLabel({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issueNumber,
name: label.name,
});
} catch (removeError) {
if (removeError.status !== 404) {
throw removeError;
}
}
}
if (!currentLabels.some((label) => label.name === nextLabelName)) {
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issueNumber,
labels: [nextLabelName],
});
}
core.info(`PR #${issueNumber}: ${changedLines} changed lines -> ${nextLabelName}`);
-199
View File
@@ -1,199 +0,0 @@
name: PR Vouch
on:
pull_request_target:
types: [opened, reopened, synchronize, ready_for_review, converted_to_draft]
issue_comment:
types: [created]
push:
branches:
- main
paths:
- .github/VOUCHED.td
- .github/workflows/pr-vouch.yml
permissions:
contents: read
issues: write
pull-requests: write
jobs:
collect-targets:
name: Collect PR targets
runs-on: ubuntu-24.04
outputs:
targets: ${{ steps.collect.outputs.targets }}
steps:
- id: collect
uses: actions/github-script@v8
with:
script: |
if (context.eventName === "pull_request_target") {
const pr = context.payload.pull_request;
core.setOutput("targets", JSON.stringify([{ number: pr.number, user: pr.user.login }]));
return;
}
if (context.eventName === "issue_comment") {
const issue = context.payload.issue;
const body = context.payload.comment?.body ?? "";
if (!issue?.pull_request || !body.includes("/recheck-vouch")) {
core.setOutput("targets", "[]");
return;
}
core.setOutput(
"targets",
JSON.stringify([{ number: issue.number, user: issue.user.login }]),
);
return;
}
const pulls = await github.paginate(github.rest.pulls.list, {
owner: context.repo.owner,
repo: context.repo.repo,
state: "open",
per_page: 100,
});
const targets = pulls.map((pull) => ({
number: pull.number,
user: pull.user.login,
}));
core.setOutput("targets", JSON.stringify(targets));
label:
name: Label PR ${{ matrix.target.number }}
needs: collect-targets
if: ${{ needs.collect-targets.outputs.targets != '[]' }}
runs-on: ubuntu-24.04
concurrency:
group: pr-vouch-${{ matrix.target.number }}
cancel-in-progress: true
strategy:
fail-fast: false
matrix:
target: ${{ fromJson(needs.collect-targets.outputs.targets) }}
steps:
- id: vouch
name: Check PR author trust
uses: mitchellh/vouch/action/check-user@v1
with:
user: ${{ matrix.target.user }}
allow-fail: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Sync PR labels
uses: actions/github-script@v8
env:
PR_NUMBER: ${{ matrix.target.number }}
VOUCH_STATUS: ${{ steps.vouch.outputs.status }}
with:
script: |
const issueNumber = Number(process.env.PR_NUMBER);
const status = process.env.VOUCH_STATUS;
const managedLabels = [
{
name: "vouch:trusted",
color: "1f883d",
description: "PR author is trusted by repo permissions or the VOUCHED list.",
},
{
name: "vouch:unvouched",
color: "fbca04",
description: "PR author is not yet trusted in the VOUCHED list.",
},
{
name: "vouch:denounced",
color: "d1242f",
description: "PR author is explicitly blocked by the VOUCHED list.",
},
];
const managedLabelNames = new Set(managedLabels.map((label) => label.name));
for (const label of managedLabels) {
try {
const { data: existing } = await github.rest.issues.getLabel({
owner: context.repo.owner,
repo: context.repo.repo,
name: label.name,
});
if (
existing.color !== label.color ||
(existing.description ?? "") !== label.description
) {
await github.rest.issues.updateLabel({
owner: context.repo.owner,
repo: context.repo.repo,
name: label.name,
color: label.color,
description: label.description,
});
}
} catch (error) {
if (error.status !== 404) {
throw error;
}
try {
await github.rest.issues.createLabel({
owner: context.repo.owner,
repo: context.repo.repo,
name: label.name,
color: label.color,
description: label.description,
});
} catch (createError) {
if (createError.status !== 422) {
throw createError;
}
}
}
}
const nextLabelName =
status === "denounced"
? "vouch:denounced"
: ["bot", "collaborator", "vouched"].includes(status)
? "vouch:trusted"
: "vouch:unvouched";
const { data: currentLabels } = await github.rest.issues.listLabelsOnIssue({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issueNumber,
per_page: 100,
});
for (const label of currentLabels) {
if (!managedLabelNames.has(label.name) || label.name === nextLabelName) {
continue;
}
try {
await github.rest.issues.removeLabel({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issueNumber,
name: label.name,
});
} catch (removeError) {
if (removeError.status !== 404) {
throw removeError;
}
}
}
if (!currentLabels.some((label) => label.name === nextLabelName)) {
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issueNumber,
labels: [nextLabelName],
});
}
core.info(`PR #${issueNumber}: ${status} -> ${nextLabelName}`);
-377
View File
@@ -1,377 +0,0 @@
name: Release Desktop
on:
push:
tags:
- "v*.*.*"
workflow_dispatch:
inputs:
version:
description: "Release version (for example 1.2.3 or v1.2.3)"
required: true
type: string
permissions:
contents: write
id-token: write
jobs:
preflight:
name: Preflight
runs-on: ubuntu-24.04
outputs:
version: ${{ steps.release_meta.outputs.version }}
tag: ${{ steps.release_meta.outputs.tag }}
is_prerelease: ${{ steps.release_meta.outputs.is_prerelease }}
make_latest: ${{ steps.release_meta.outputs.make_latest }}
ref: ${{ github.sha }}
steps:
- name: Checkout
uses: actions/checkout@v6
- id: release_meta
name: Resolve release version
shell: bash
run: |
if [[ "${GITHUB_EVENT_NAME}" == "workflow_dispatch" ]]; then
raw="${{ github.event.inputs.version }}"
else
raw="${GITHUB_REF_NAME}"
fi
version="${raw#v}"
if [[ ! "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+([.-][0-9A-Za-z.-]+)?$ ]]; then
echo "Invalid release version: $raw" >&2
exit 1
fi
echo "version=$version" >> "$GITHUB_OUTPUT"
echo "tag=v$version" >> "$GITHUB_OUTPUT"
if [[ "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "is_prerelease=false" >> "$GITHUB_OUTPUT"
echo "make_latest=true" >> "$GITHUB_OUTPUT"
else
echo "is_prerelease=true" >> "$GITHUB_OUTPUT"
echo "make_latest=false" >> "$GITHUB_OUTPUT"
fi
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version-file: package.json
- name: Setup Node
uses: actions/setup-node@v6
with:
node-version-file: package.json
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Lint
run: bun run lint
- name: Typecheck
run: bun run typecheck
- name: Test
run: bun run test
build:
name: Build ${{ matrix.label }}
needs: preflight
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
- label: macOS arm64
runner: macos-14
platform: mac
target: dmg
arch: arm64
- label: macOS x64
runner: macos-15-intel
platform: mac
target: dmg
arch: x64
- label: Linux x64
runner: ubuntu-24.04
platform: linux
target: AppImage
arch: x64
- label: Windows x64
runner: windows-2022
platform: win
target: nsis
arch: x64
steps:
- name: Checkout
uses: actions/checkout@v6
with:
ref: ${{ needs.preflight.outputs.ref }}
fetch-depth: 0
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version-file: package.json
- name: Setup Node
uses: actions/setup-node@v6
with:
node-version-file: package.json
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Align package versions to release version
run: node scripts/update-release-package-versions.ts "${{ needs.preflight.outputs.version }}"
- name: Build desktop artifact
shell: bash
env:
CSC_LINK: ${{ secrets.CSC_LINK }}
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
APPLE_API_KEY: ${{ secrets.APPLE_API_KEY }}
APPLE_API_KEY_ID: ${{ secrets.APPLE_API_KEY_ID }}
APPLE_API_ISSUER: ${{ secrets.APPLE_API_ISSUER }}
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
AZURE_TRUSTED_SIGNING_ENDPOINT: ${{ secrets.AZURE_TRUSTED_SIGNING_ENDPOINT }}
AZURE_TRUSTED_SIGNING_ACCOUNT_NAME: ${{ secrets.AZURE_TRUSTED_SIGNING_ACCOUNT_NAME }}
AZURE_TRUSTED_SIGNING_CERTIFICATE_PROFILE_NAME: ${{ secrets.AZURE_TRUSTED_SIGNING_CERTIFICATE_PROFILE_NAME }}
AZURE_TRUSTED_SIGNING_PUBLISHER_NAME: ${{ secrets.AZURE_TRUSTED_SIGNING_PUBLISHER_NAME }}
run: |
args=(
--platform "${{ matrix.platform }}"
--target "${{ matrix.target }}"
--arch "${{ matrix.arch }}"
--build-version "${{ needs.preflight.outputs.version }}"
--verbose
)
has_all() {
for value in "$@"; do
if [[ -z "$value" ]]; then
return 1
fi
done
return 0
}
if [[ "${{ matrix.platform }}" == "mac" ]]; then
if has_all "$CSC_LINK" "$CSC_KEY_PASSWORD" "$APPLE_API_KEY" "$APPLE_API_KEY_ID" "$APPLE_API_ISSUER"; then
key_path="$RUNNER_TEMP/AuthKey_${APPLE_API_KEY_ID}.p8"
printf '%s' "$APPLE_API_KEY" > "$key_path"
export APPLE_API_KEY="$key_path"
echo "macOS signing enabled."
args+=(--signed)
else
echo "macOS signing disabled (missing one or more Apple signing secrets)."
fi
elif [[ "${{ matrix.platform }}" == "win" ]]; then
if has_all \
"$AZURE_TENANT_ID" \
"$AZURE_CLIENT_ID" \
"$AZURE_CLIENT_SECRET" \
"$AZURE_TRUSTED_SIGNING_ENDPOINT" \
"$AZURE_TRUSTED_SIGNING_ACCOUNT_NAME" \
"$AZURE_TRUSTED_SIGNING_CERTIFICATE_PROFILE_NAME" \
"$AZURE_TRUSTED_SIGNING_PUBLISHER_NAME"; then
echo "Windows signing enabled (Azure Trusted Signing)."
args+=(--signed)
else
echo "Windows signing disabled (missing one or more Azure Trusted Signing secrets)."
fi
else
echo "Signing disabled for ${{ matrix.platform }}."
fi
bun run dist:desktop:artifact -- "${args[@]}"
- name: Collect release assets
shell: bash
run: |
set -euo pipefail
mkdir -p release-publish
shopt -s nullglob
for pattern in \
"release/*.dmg" \
"release/*.zip" \
"release/*.AppImage" \
"release/*.exe" \
"release/*.blockmap" \
"release/latest*.yml"; do
for file in $pattern; do
cp "$file" release-publish/
done
done
if [[ "${{ matrix.platform }}" == "mac" && "${{ matrix.arch }}" != "arm64" ]]; then
if [[ -f release-publish/latest-mac.yml ]]; then
mv release-publish/latest-mac.yml "release-publish/latest-mac-${{ matrix.arch }}.yml"
fi
fi
- name: Upload build artifacts
uses: actions/upload-artifact@v7
with:
name: desktop-${{ matrix.platform }}-${{ matrix.arch }}
path: release-publish/*
if-no-files-found: error
publish_cli:
name: Publish CLI to npm
needs: [preflight, build]
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v6
with:
ref: ${{ needs.preflight.outputs.ref }}
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version-file: package.json
- name: Setup Node
uses: actions/setup-node@v6
with:
node-version-file: package.json
registry-url: https://registry.npmjs.org
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Align package versions to release version
run: node scripts/update-release-package-versions.ts "${{ needs.preflight.outputs.version }}"
- name: Build CLI package
run: bun run build --filter=@t3tools/web --filter=t3
- name: Publish CLI package
run: node apps/server/scripts/cli.ts publish --tag latest --app-version "${{ needs.preflight.outputs.version }}" --verbose
release:
name: Publish GitHub Release
needs: [preflight, build, publish_cli]
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v6
with:
ref: ${{ needs.preflight.outputs.ref }}
- name: Setup Node
uses: actions/setup-node@v6
with:
node-version-file: package.json
- name: Download all desktop artifacts
uses: actions/download-artifact@v8
with:
pattern: desktop-*
merge-multiple: true
path: release-assets
- name: Merge macOS updater manifests
run: |
node scripts/merge-mac-update-manifests.ts \
release-assets/latest-mac.yml \
release-assets/latest-mac-x64.yml
rm -f release-assets/latest-mac-x64.yml
- name: Publish release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ needs.preflight.outputs.tag }}
target_commitish: ${{ needs.preflight.outputs.ref }}
name: T3 Code v${{ needs.preflight.outputs.version }}
generate_release_notes: true
prerelease: ${{ needs.preflight.outputs.is_prerelease }}
make_latest: ${{ needs.preflight.outputs.make_latest }}
files: |
release-assets/*.dmg
release-assets/*.zip
release-assets/*.AppImage
release-assets/*.exe
release-assets/*.blockmap
release-assets/latest*.yml
fail_on_unmatched_files: true
finalize:
name: Finalize release
needs: [preflight, release]
runs-on: ubuntu-24.04
steps:
- id: app_token
name: Mint release app token
uses: actions/create-github-app-token@v2
with:
app-id: ${{ vars.RELEASE_APP_ID }}
private-key: ${{ secrets.RELEASE_APP_PRIVATE_KEY }}
owner: ${{ github.repository_owner }}
- name: Checkout
uses: actions/checkout@v6
with:
ref: main
fetch-depth: 0
token: ${{ steps.app_token.outputs.token }}
persist-credentials: true
- id: app_bot
name: Resolve GitHub App bot identity
env:
GH_TOKEN: ${{ steps.app_token.outputs.token }}
APP_SLUG: ${{ steps.app_token.outputs.app-slug }}
run: |
user_id="$(gh api "/users/${APP_SLUG}[bot]" --jq .id)"
echo "name=${APP_SLUG}[bot]" >> "$GITHUB_OUTPUT"
echo "email=${user_id}+${APP_SLUG}[bot]@users.noreply.github.com" >> "$GITHUB_OUTPUT"
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version-file: package.json
- name: Setup Node
uses: actions/setup-node@v6
with:
node-version-file: package.json
- id: update_versions
name: Update version strings
env:
RELEASE_VERSION: ${{ needs.preflight.outputs.version }}
run: node scripts/update-release-package-versions.ts "$RELEASE_VERSION" --github-output
- name: Format package.json files
if: steps.update_versions.outputs.changed == 'true'
run: bunx oxfmt apps/server/package.json apps/desktop/package.json apps/web/package.json packages/contracts/package.json
- name: Refresh lockfile
if: steps.update_versions.outputs.changed == 'true'
run: bun install --lockfile-only --ignore-scripts
- name: Commit and push version bump
if: steps.update_versions.outputs.changed == 'true'
shell: bash
env:
RELEASE_TAG: ${{ needs.preflight.outputs.tag }}
run: |
if git diff --quiet -- apps/server/package.json apps/desktop/package.json apps/web/package.json packages/contracts/package.json bun.lock; then
echo "No version changes to commit."
exit 0
fi
git config user.name "${{ steps.app_bot.outputs.name }}"
git config user.email "${{ steps.app_bot.outputs.email }}"
git add apps/server/package.json apps/desktop/package.json apps/web/package.json packages/contracts/package.json bun.lock
git commit -m "chore(release): prepare $RELEASE_TAG"
git push origin HEAD:main
-8
View File
@@ -5,16 +5,8 @@ node_modules
*.log
*.tsbuildinfo
apps/*/dist
.astro
packages/*/dist
.env
.env.local
build/
.logs/
release/
.t3
.idea/
apps/web/.playwright
apps/web/playwright-report
apps/web/src/components/__screenshots__
.vitest-*
-3
View File
@@ -1,3 +0,0 @@
[tools]
node = "24.13.1"
bun = "1.3.9"
+2 -5
View File
@@ -3,12 +3,9 @@
"ignorePatterns": [
".plans",
"dist",
"dist-electron",
"node_modules",
"bun.lock",
"*.tsbuildinfo",
"**/routeTree.gen.ts",
"apps/web/public/mockServiceWorker.js"
"*.tsbuildinfo"
],
"sortPackageJson": {}
"experimentalSortPackageJson": {}
}
+2 -11
View File
@@ -1,13 +1,6 @@
{
"$schema": "./node_modules/oxlint/configuration_schema.json",
"ignorePatterns": [
"dist",
"dist-electron",
"node_modules",
"bun.lock",
"*.tsbuildinfo",
"**/routeTree.gen.ts"
],
"ignorePatterns": ["dist", "node_modules", "bun.lock", "*.tsbuildinfo"],
"plugins": ["eslint", "oxc", "react", "unicorn", "typescript"],
"categories": {
"correctness": "warn",
@@ -15,8 +8,6 @@
"perf": "warn"
},
"rules": {
"react-in-jsx-scope": "off",
"eslint/no-shadow": "off",
"eslint/no-await-in-loop": "off"
"react-in-jsx-scope": "off"
}
}
+3 -10
View File
@@ -1,24 +1,20 @@
# Plan: Centralize Model Normalization in Contracts
## Summary
Move model alias/default normalization into `packages/contracts` so desktop and renderer use one shared source of truth.
## Motivation
- Removes duplicated logic between:
- `apps/desktop/src/codexAppServerManager.ts`
- `packages/runtime-core/src/codexAppServerManager.ts`
- `apps/renderer/src/model-logic.ts`
- Prevents behavior drift when model aliases/defaults are updated.
## Scope
- Add shared model utilities to contracts.
- Update desktop and renderer to consume shared utilities.
- Keep renderer-specific display options in renderer.
## Proposed Changes
1. Add `packages/contracts/src/model.ts` with:
- Canonical model list
- Alias map
@@ -26,24 +22,21 @@ Move model alias/default normalization into `packages/contracts` so desktop and
- `resolveModelSlug`
- `DEFAULT_MODEL`
2. Export model utilities from `packages/contracts/src/index.ts`.
3. Update `apps/desktop/src/codexAppServerManager.ts` to replace local alias map/helper.
3. Update `packages/runtime-core/src/codexAppServerManager.ts` to replace local alias map/helper.
4. Update `apps/renderer/src/model-logic.ts` to wrap or re-export shared functions.
5. Update tests:
- Move/duplicate normalization tests to contracts.
- Keep renderer tests focused on renderer-only behavior.
## Risks
- Desktop/renderer may currently rely on slightly different fallback behavior.
- Import graph must avoid bundling issues for Electron main/preload.
## Validation
- `bun run test`
- `bun run typecheck`
- Manual check that model selection and session start still send expected model slug.
## Done Criteria
- No duplicated alias/default map in desktop and renderer.
- No duplicated alias/default map in runtime-core and renderer.
- Shared model utilities are contract-tested.
+13 -20
View File
@@ -1,44 +1,37 @@
# Plan: Strengthen Typed IPC Boundaries in Main Process
# Plan: Strengthen Typed WS RPC Boundaries in Runtime Server
## Summary
Replace loose payload casting in IPC handlers with strict schema parsing and typed helper wrappers.
Replace loose payload casting in runtime RPC handlers with strict schema parsing and typed helper wrappers.
## Motivation
- `apps/desktop/src/main.ts` currently uses casts like `payload as Parameters<...>`.
- `apps/t3/src/runtimeApiServer.ts` should avoid payload casts and parse all unknown input at the RPC boundary.
- Casts can hide contract breakages until runtime.
## Scope
- Desktop main process IPC registration.
- Optional shared helper for handler registration.
- Runtime WebSocket RPC registration and method dispatch.
- Optional shared helper for method-level parse/dispatch registration.
## Proposed Changes
1. Add IPC helper utility (e.g. `apps/desktop/src/ipcHelpers.ts`) to:
1. Add RPC helper utility (e.g. `apps/t3/src/rpcHelpers.ts`) to:
- Parse payload(s) with Zod schemas
- Standardize typed handler signatures
2. Refactor provider IPC handlers in `apps/desktop/src/main.ts` to use:
2. Refactor provider RPC handlers in `apps/t3/src/runtimeApiServer.ts` to use:
- `providerSessionStartInputSchema.parse`
- `providerSendTurnInputSchema.parse`
- `providerInterruptTurnInputSchema.parse`
- `providerStopSessionInputSchema.parse`
3. Apply same pattern to agent/terminal handlers where possible.
4. Add tests for handler parsing failure paths (invalid payloads).
3. Apply same pattern to app/todo/agent/terminal/shell handlers where possible.
4. Add tests for parsing failure paths (invalid payloads).
## Risks
- Refactor can subtly change IPC error shape/messages.
- Refactor can subtly change RPC error shape/messages.
- Helper abstraction should stay simple and not obscure control flow.
## Validation
- `bun run test`
- `bun run typecheck`
- Manual invalid payload check from renderer/devtools to confirm fast failure.
- Manual invalid payload check from websocket client/devtools to confirm fast failure.
## Done Criteria
- No provider handler uses `payload as Parameters<...>`.
- All IPC entrypoints parse unknown payloads at boundary.
- No runtime handler uses `payload as Parameters<...>`.
- All websocket RPC entrypoints parse unknown payloads at boundary.
+2 -9
View File
@@ -1,12 +1,10 @@
# Plan: Decompose CodexAppServerManager
## Summary
Split `CodexAppServerManager` into smaller modules with clear responsibilities.
## Motivation
- `apps/desktop/src/codexAppServerManager.ts` is large and mixes:
- `packages/runtime-core/src/codexAppServerManager.ts` is large and mixes:
- Process lifecycle
- JSON-RPC parsing/routing
- Session state transitions
@@ -14,12 +12,10 @@ Split `CodexAppServerManager` into smaller modules with clear responsibilities.
- This increases regression risk and slows changes.
## Scope
- Desktop provider internals only.
- Runtime-core provider internals only.
- Keep external behavior/API stable.
## Proposed Changes
1. Extract modules:
- `codex/processLifecycle.ts`
- `codex/jsonrpcRouter.ts`
@@ -33,16 +29,13 @@ Split `CodexAppServerManager` into smaller modules with clear responsibilities.
- Session state transitions
## Risks
- Reordering event handling can change behavior.
- Must preserve pending request timeout/cancellation semantics.
## Validation
- Existing tests pass.
- Add module-level tests for parsing and transition logic.
## Done Criteria
- Main manager file materially smaller and orchestration-focused.
- Core protocol/state logic covered by focused tests.
-7
View File
@@ -1,11 +1,9 @@
# Plan: Split ChatView into Smaller UI/Logic Units
## Summary
Refactor `ChatView.tsx` into composable pieces with isolated responsibilities.
## Motivation
- `apps/renderer/src/components/ChatView.tsx` is large and handles:
- Session orchestration
- Send/interrupt actions
@@ -15,12 +13,10 @@ Refactor `ChatView.tsx` into composable pieces with isolated responsibilities.
- Hard to test and maintain as one component.
## Scope
- Renderer component boundaries and hooks.
- Keep visual behavior unchanged.
## Proposed Changes
1. Create hook: `apps/renderer/src/hooks/useChatSession.ts`
- `ensureSession`
- `sendTurn`
@@ -33,15 +29,12 @@ Refactor `ChatView.tsx` into composable pieces with isolated responsibilities.
4. Add focused tests for hook behavior (error handling, session reuse).
## Risks
- Refactor can break subtle UI interactions (auto-scroll, menu close, keyboard send).
## Validation
- `bun run test`
- Manual smoke: send, stream, interrupt, model switch.
## Done Criteria
- `ChatView.tsx` significantly reduced and easier to scan.
- Session logic isolated from rendering.
@@ -1,21 +1,17 @@
# Plan: Move Renderer Persisted-State Validation to Zod
## Summary
Use explicit Zod schemas for localStorage state parsing and migration.
## Motivation
- `apps/renderer/src/store.ts` has large manual sanitize functions.
- Manual type guards are verbose and easier to get wrong during schema evolution.
## Scope
- Renderer state hydration/persistence path.
- No backend/protocol changes.
## Proposed Changes
1. Add schema module: `apps/renderer/src/persistenceSchema.ts`
- Persisted payload versions (`v1`, `v2`)
- Thread/message/project schemas
@@ -27,15 +23,12 @@ Use explicit Zod schemas for localStorage state parsing and migration.
- Unknown thread/project references filtered
## Risks
- Overly strict schemas could drop valid historical data unexpectedly.
## Validation
- Unit tests for migration/hydration.
- Manual reload test with existing localStorage data.
## Done Criteria
- Store hydration logic is schema-driven.
- Migration behavior is tested and documented.
+4 -11
View File
@@ -1,38 +1,31 @@
# Plan: Add Provider Log Stream Lifecycle Management
## Summary
Ensure `ProviderManager` logging stream is initialized, rotated/structured, and closed safely.
## Motivation
- `apps/desktop/src/providerManager.ts` opens a write stream in constructor.
- `packages/runtime-core/src/providerManager.ts` opens a write stream in constructor.
- Stream lifecycle is not explicit on shutdown.
## Scope
- Desktop provider logging behavior.
- App shutdown integration.
- Runtime-core provider logging behavior.
- Runtime server shutdown integration.
## Proposed Changes
1. Add explicit `dispose()` on `ProviderManager`:
- Remove event listeners
- End/close log stream
2. Call `providerManager.dispose()` from app shutdown path in `apps/desktop/src/main.ts`.
2. Call `providerManager.dispose()` from app shutdown path in `apps/t3/src/runtimeApiServer.ts` close flow.
3. Optional: change log format to JSON lines with stable fields.
4. Optional: per-session log files under `.logs/providers/`.
## Risks
- Improper close sequencing may lose final log lines.
## Validation
- Manual run/quit cycle to ensure no open handle warnings.
- Confirm logs flush on quit and file descriptors are not leaked.
## Done Criteria
- ProviderManager owns complete log stream lifecycle.
- Shutdown path explicitly disposes provider resources.
-7
View File
@@ -1,21 +1,17 @@
# Plan: Add CI Workflow for Core Quality Gates
## Summary
Add GitHub Actions workflow to run lint/typecheck/test (and optionally smoke-test) on pushes and PRs.
## Motivation
- Repository currently has no CI workflow files.
- Quality checks are only local/manual.
## Scope
- `.github/workflows/ci.yml`
- Bun + Turbo setup in CI.
## Proposed Changes
1. Add `ci.yml` with jobs:
- Setup Bun and Node environment
- Install deps
@@ -26,16 +22,13 @@ Add GitHub Actions workflow to run lint/typecheck/test (and optionally smoke-tes
3. Configure caching for Bun/Turbo as appropriate.
## Risks
- Smoke test may be flaky in headless CI environments.
- CI runtime can grow if caching is misconfigured.
## Validation
- Verify workflow runs on a branch PR.
- Ensure failures surface clearly by job name.
## Done Criteria
- CI blocks regressions in lint/typecheck/test.
- Workflow docs added to README.
-7
View File
@@ -1,21 +1,17 @@
# Plan: Add Pre-Commit Formatting/Lint Hooks
## Summary
Introduce pre-commit automation so formatting and basic lint checks happen before commits.
## Motivation
- Current lint failures include formatting-only issues.
- Shift-left feedback reduces noisy CI failures and cleanup churn.
## Scope
- Root tooling config and package scripts.
- No runtime code changes.
## Proposed Changes
1. Add hook tooling (e.g. Husky + lint-staged or Lefthook).
2. Configure staged-file tasks:
- `biome format --write`
@@ -24,16 +20,13 @@ Introduce pre-commit automation so formatting and basic lint checks happen befor
4. Keep checks fast to avoid developer friction.
## Risks
- Slow hooks can frustrate contributors and be bypassed.
- Need to ensure compatibility with Bun workspace setup.
## Validation
- Create sample staged changes and verify hook behavior.
- Confirm formatting fixes are applied automatically.
## Done Criteria
- Pre-commit hook installed and documented.
- Formatting-only lint failures drop significantly.
-7
View File
@@ -1,21 +1,17 @@
# Plan: Expand Event/State Transition Test Coverage
## Summary
Add focused tests for renderer event handling and session evolution logic.
## Motivation
- Core behavior is event-driven and stateful.
- Existing renderer tests cover only a subset of timeline/model behavior.
## Scope
- `apps/renderer/src/session-logic.test.ts`
- Optional reducer tests for `apps/renderer/src/store.ts`.
## Proposed Changes
1. Add tests for `evolveSession`:
- `thread/started`
- `turn/started`
@@ -28,15 +24,12 @@ Add focused tests for renderer event handling and session evolution logic.
3. Add reducer integration tests for `APPLY_EVENT`.
## Risks
- Tests may be brittle if event payload fixtures are too coupled to implementation details.
## Validation
- `bun run test`
- Ensure new tests remain deterministic and fast.
## Done Criteria
- High-risk event transitions are covered by unit tests.
- Regressions in stream assembly/session status are caught quickly.
@@ -1,21 +1,17 @@
# Plan: Unify Process and PTY Session Abstractions in ProcessManager
## Summary
Refactor `ProcessManager` to use a single runtime-session interface for child-process and PTY modes.
## Motivation
- `apps/desktop/src/processManager.ts` maintains parallel maps and branch-heavy logic.
- `packages/runtime-core/src/processManager.ts` maintains parallel maps and branch-heavy logic.
- New execution backends/providers will multiply complexity.
## Scope
- Desktop process execution internals.
- Runtime-core process execution internals.
- Preserve public `ProcessManager` API.
## Proposed Changes
1. Introduce internal interface (e.g. `RuntimeSession`):
- `write(data)`
- `kill()`
@@ -28,15 +24,12 @@ Refactor `ProcessManager` to use a single runtime-session interface for child-pr
5. Add tests for both implementations.
## Risks
- PTY behavior differs by platform; abstraction must not hide required differences.
## Validation
- Existing `processManager.test.ts` passes.
- Add PTY-path tests where feasible.
## Done Criteria
- Manager no longer branches per backend in `write/kill/killAll`.
- Session backends are independently testable.
-40
View File
@@ -1,40 +0,0 @@
PR 1: Service contracts + error taxonomy
Add ProviderService, CodexService, CheckpointStore as Context.Tag service defs.
Add typed Schema.TaggedError hierarchies for all 3 services (cause: Schema.optional(Schema.Defect) on each).
No behavior change yet, just interfaces and compile-time wiring points.
PR 2: CheckpointStore Effect adapter
Wrap current filesystemCheckpointStore behind CheckpointStoreLive (adapter).
Map all thrown/Promise errors to tagged errors.
Add service tests proving parity for isGitRepository, capture, restore, diff, prune.
PR 3: CodexService Effect adapter
Wrap current CodexAppServerManager behind CodexServiceLive (adapter).
Convert public API to Effect return types with typed errors.
Preserve existing EventEmitter internally for now, but expose Effect-friendly subscribe API.
PR 4: ProviderService Effect adapter
Wrap current ProviderManager behind ProviderServiceLive (adapter).
Provider methods become Effect methods with typed errors.
Route emitted provider events through an Effect PubSub surface.
PR 5: wsServer migration to Effect services
Stop instantiating provider/codex classes directly in wsServer.
Resolve ProviderService (and related services) from one runtime/layer graph.
Keep WS contract behavior identical.
PR 6: Native CheckpointStore implementation
Refactor checkpoint internals from Promise/throws to native Effect.
Replace ad-hoc locking with Effect concurrency primitive (keyed lock/semaphore/queue).
Keep adapter tests plus new failure-path tests.
PR 7: Codex transport/RPC core as native Effect
Split codex into scoped process layer + RPC request/response layer + session registry.
Replace timeout/pending maps with Deferred + Effect timeout/finalizer semantics.
Keep protocol behavior and ordering guarantees.
PR 8: Codex protocol decoding hardening
Replace ad-hoc unknown parsing with runtime schema decoding for inbound/outbound protocol shapes.
Map decode failures to typed tagged errors (with root cause).
Add regression tests for malformed/partial protocol messages.
PR 9: Native ProviderService orchestration
Rebuild provider logic in Effect using CodexService + CheckpointStore dependencies.
Move event fanout, checkpoint capture/revert orchestration, thread-log routing to Effect state/services.
Remove throw-based flow entirely from provider path.
PR 10: Cleanup + deprecation removal
Remove legacy class implementations/adapters once parity is proven.
Finalize layer composition and startup graph docs.
Add architecture notes for service boundaries and error model.
-67
View File
@@ -1,67 +0,0 @@
# Effect Migration Plan (From Current State)
Current status summary:
- Service contracts, typed errors, and most checkpoint/persistence services exist.
- `ProviderServiceLive` is already native orchestration (not a thin adapter).
- Production server path still uses legacy `ProviderManager`/`FilesystemCheckpointStore`.
- Checkpoint flow now avoids snapshot re-sync and is write-time driven.
## PR 1: Wire Provider/Checkpoint Effect Stack Into `wsServer`
- Build one runtime layer graph for provider + checkpoint + persistence + orchestration.
- Resolve `ProviderService` from runtime in `wsServer`.
- Replace `ProviderManager` method calls in WS handlers with `ProviderService` calls.
- Forward provider events by subscribing to `ProviderService.subscribeToEvents`.
- Keep WS method/push payloads identical.
## PR 2: Runtime Composition + Startup Ownership
- Create/centralize `AppLive` composition for server startup.
- Ensure outer runtime provides Node/platform services once.
- Ensure migrations run at startup via scoped/layer startup path.
- Remove ad-hoc service initialization in request-time paths.
## PR 3: Session Lifecycle Hygiene + Checkpoint Invariants
- Add explicit checkpoint session cleanup on `stopSession` / `stopAll`.
- Remove per-session lock/cwd map leaks.
- Keep strict invariant model:
- root checkpoint created at session initialization before agent modifications
- each completed turn captures filesystem checkpoint and persists metadata
- no after-the-fact metadata rebuild/sync
- Add tests for lifecycle cleanup and invariant-failure surfaces.
## PR 4: Provider Event Stream Hardening (Without Extra Service Fragmentation)
- Keep `ProviderService` as the public event surface.
- Internally move callback fanout to Effect concurrency primitives (`Queue`/`PubSub`) for ordering/backpressure control.
- Keep API as `subscribeToEvents` unless we explicitly choose stream API later.
- Add tests for ordering and subscriber isolation under load.
## PR 5: Codex Runtime Split (Scoped Effect Core)
- Extract `CodexAppServerManager` responsibilities into Effect-native layers:
- scoped process lifecycle
- RPC request/response + pending map via `Deferred`
- session registry/state
- Keep `CodexAdapter` contract stable while swapping internals.
- Preserve protocol behavior and timeout semantics.
## PR 6: Codex Protocol Decode Hardening
- Replace ad-hoc unknown parsing with runtime schema decode.
- Map decode failures to typed tagged errors with `cause` retained.
- Add regression tests for malformed/partial protocol frames.
## PR 7: Remove Legacy Provider Stack
- Remove `ProviderManager` + legacy checkpoint integration from runtime path.
- Remove `FilesystemCheckpointStore` from active server flow (keep only if explicitly needed for compatibility tooling).
- Update tests to assert only Effect service path is used.
## PR 8: Final Cleanup + Docs
- Update architecture docs with final layer graph and service boundaries.
- Document error model and recovery semantics.
- Trim dead compatibility code and stale plan references.
@@ -1,123 +0,0 @@
# ProviderService Integration Test Plan
Goal:
- Validate end-to-end `ProviderService` behavior with real layers:
- `ProviderServiceLive`
- `CheckpointServiceLive`
- `CheckpointStoreLive`
- `CheckpointRepositoryLive` (sqlite in-memory)
- `ProviderSessionDirectoryLive`
- Only fake the adapter event source (deterministic Codex-like stream).
- Avoid mocking checkpointing/persistence orchestration logic.
## Test Harness
Build a deterministic `TestProviderAdapterLive` in `apps/server/src/provider/Layers/TestProviderAdapter.integration.ts`:
- Service contract: `ProviderAdapterShape<ProviderAdapterError>`.
- Internal state:
- session registry (session + cwd + threadId)
- thread snapshot store (`threadId`, `turns`)
- event subscribers
- Behavior:
- `startSession`: creates session with threadId.
- `sendTurn`: appends a deterministic turn snapshot and emits ordered events:
- `turn/started`
- `item/started` / `item/completed` (tool + approval variants depending on scenario)
- `item/agentMessage/delta` chunks
- `turn/completed`
- optional "mutator" callback per turn to change workspace files before completion.
- `readThread`, `rollbackThread`, `stopSession`, `stopAll`.
Use real git-backed temporary workspaces in integration tests:
- initialize repo with baseline commit
- run provider turn in workspace
- assert checkpoint diffs against real git refs
## Core Integration Specs
1. `startSession` initializes checkpoint root exactly once
- Arrange:
- start provider session in git repo.
- Assert:
- `provider_checkpoints` contains root row (turn 0).
- checkpoint ref exists in git.
- second `startSession` for new session creates a new independent root.
2. Turn without filesystem change
- Arrange:
- emit normal turn events, no file mutation.
- Assert:
- provider subscribers receive:
- `turn/started`
- `turn/completed`
- synthetic `checkpoint/captured`
- `listCheckpoints` returns root + turn 1.
- `getCheckpointDiff(0 -> 1)` returns empty/no-op diff.
3. Turn with filesystem change
- Arrange:
- mutate `README.md` during turn.
- Assert:
- `listCheckpoints` returns root + turn 1.
- `getCheckpointDiff(0 -> 1)` contains file path and hunk.
- persisted checkpoint metadata includes non-empty `checkpointRef`.
4. Multi-turn sequencing and checkpoint monotonicity
- Arrange:
- turn 1: no file change
- turn 2: file change
- turn 3: file change
- Assert:
- turn counts are monotonic and contiguous in DB (0,1,2,3).
- latest checkpoint is marked current.
- diffs for adjacent turns map to expected filesystem deltas.
5. Revert to checkpoint
- Arrange:
- execute 3 turns with at least one file-changing turn.
- call `revertToCheckpoint(turnCount=1)`.
- Assert:
- workspace content matches turn 1 state.
- adapter `rollbackThread` called with `numTurns=2`.
- DB rows for turns >1 are removed.
- later refs are deleted from git.
6. Capture failure surface
- Arrange:
- adapter emits `turn/completed`, but file mutation leaves invalid repo state or store capture fails.
- Assert:
- `ProviderService` emits `checkpoint/captureError`.
- no partial metadata/ref divergence is left behind.
## WebSocket Coverage (Thin Integration)
Add one ws server integration spec:
- Subscribe to `providers.event`.
- Run a deterministic provider turn through ws methods.
- Assert push stream includes:
- `turn/started`, tool events, `turn/completed`, `checkpoint/captured`.
- Assert orchestration projection still updates assistant message and turn diff summary.
## Proposed PR Split
PR A:
- Test adapter harness + shared integration fixtures (repo setup, runtime/layer setup).
PR B:
- Core ProviderService integration specs (cases 1-4).
PR C:
- Revert + failure-path specs (cases 5-6) + ws thin integration spec.
@@ -1,227 +0,0 @@
# Server-Authoritative Event-Sourcing Cleanup Plan
Goal:
- Move to a cleaner service architecture with:
- durable, server-authoritative event sourcing
- strict command routing/validation
- pluggable provider adapters
- explicit separation between transport, domain orchestration, provider runtime, and persistence
## Target Service Graph (ASCII)
```text
+---------------------------+
| wsServer |
| transport |
+---------------------------+
| orchestration.dispatchCommand
v
+-------------------------------------------+
| OrchestrationCommandRouter |
+-------------------------------------------+
|
v
+-------------------------------------------+
| OrchestrationCommandHandlers |
+-------------------------------------------+
|
v
+-------------------------------------------+
| OrchestrationEventStore |
+-------------------------------------------+
|
v
+-------------------------------------------+
| OrchestrationProjectionService |
+-------------------------------------------+
| snapshot/replay
+---------------------------> wsServer
wsServer -- providers.* RPC --> +---------------------------+
| ProviderService |
+---------------------------+
| |
v v
+-------------------+ +-------------------------+
| ProviderSession | | ProviderAdapterRegistry |
| Registry (durable)| +-------------------------+
+-------------------+ |
^ v
| +-------------------------+
| | ProviderAdapter(s) |
| +-------------------------+
| |
| runtime events v
| +---------------------------+
+----------| ProviderRuntimeIngestion |
+---------------------------+
| | |
v v v
Router Session Checkpoint
Registry Service
+-------------------------------------------+
| CheckpointService |
+-------------------------------------------+
| | |
v v v
+--------------------+ +-------------+ +-------------------+
| CheckpointCatalog | | Checkpoint | | ProviderAdapter(s)|
| (durable) | | Store (git) | | (read/rollback) |
+--------------------+ +-------------+ +-------------------+
|
v
+------+
|SQLite|
+------+
OrchestrationEventStore ------> SQLite
OrchestrationProjectionService -> SQLite
ProviderSessionRegistry ------> SQLite
CheckpointCatalog ------> SQLite
```
## Commit Series
### Commit 1: Split public vs system orchestration command contracts
- Create separate schemas/types:
- `ClientOrchestrationCommandSchema`
- `SystemOrchestrationCommandSchema`
- `OrchestrationCommandSchema = union(client, system)`
- Ensure client transport can only submit client commands.
- Keep system commands for server-internal workflows only.
- Expected files:
- `packages/contracts/src/orchestration.ts`
- `apps/server/src/wsServer.ts`
- orchestration/service tests
- Tests:
- reject system-only command via WS dispatch path
- preserve internal dispatch functionality for system commands
### Commit 2: Introduce `OrchestrationCommandRouter` + handler boundary
- Add dedicated router service to validate, authorize, and route commands.
- Move command-to-event mapping out of `orchestration/Layer.ts` into handlers.
- Add aggregate-level invariant checks before append (thread exists, project exists, etc.).
- Expected files:
- `apps/server/src/orchestration/Services/CommandRouter.ts` (new)
- `apps/server/src/orchestration/Layers/CommandRouter.ts` (new)
- `apps/server/src/orchestration/Layer.ts`
- `apps/server/src/orchestration/reducer.ts` (only if needed for event payload changes)
- Tests:
- router validation and invariant failures
- handler happy-path tests per command type
### Commit 3: Harden event store for idempotency + optimistic append metadata
- Add DB-level idempotency guard for `command_id` (`UNIQUE` where non-null).
- Extend append API to support idempotent replays and deterministic return of prior event on duplicate `commandId`.
- Add optional aggregate version metadata for future optimistic concurrency.
- Expected files:
- `apps/server/src/persistence/Migrations/00x_*.ts` (new migration)
- `apps/server/src/persistence/Services/OrchestrationEvents.ts`
- `apps/server/src/persistence/Layers/OrchestrationEvents.ts`
- Tests:
- duplicate command ID append returns same event/sequence (or explicit idempotent behavior)
- concurrent append behavior stays ordered and deterministic
### Commit 4: Extract provider-runtime -> orchestration bridge from `wsServer`
- Create `ProviderRuntimeIngestionService` that:
- subscribes to `ProviderService.streamEvents`
- translates runtime events into orchestration commands
- dispatches through router/engine
- Remove provider-to-orchestration state mutation logic from `wsServer`.
- Expected files:
- `apps/server/src/orchestration/Services/ProviderRuntimeIngestion.ts` (new)
- `apps/server/src/orchestration/Layers/ProviderRuntimeIngestion.ts` (new)
- `apps/server/src/wsServer.ts`
- Tests:
- ingestion service mapping tests (turn started/completed, message delta/completed, runtime error)
- ws integration confirms same external push behavior
### Commit 5: Make session directory durable (`ProviderSessionRegistry`)
- Replace in-memory-only `ProviderSessionDirectoryLive` with persistence-backed registry.
- Keep in-memory cache optional, but source of truth must be persistent.
- Add startup reconciliation to prune dead sessions / keep known thread mapping.
- Expected files:
- `apps/server/src/provider/Services/ProviderSessionDirectory.ts` (or new SessionRegistry service)
- `apps/server/src/provider/Layers/ProviderSessionDirectory.ts`
- `apps/server/src/persistence/Migrations/00x_*.ts` (new table/indexes)
- provider persistence tests
- Tests:
- survives server restart with correct mapping
- stale session cleanup semantics
### Commit 6: Re-key checkpoint metadata from session to thread identity
- Change checkpoint catalog primary identity from `provider_session_id` to durable `thread_id`.
- Keep `session_id` as nullable metadata only.
- Update checkpoint flows (`initialize`, `capture`, `list`, `diff`, `revert`) to use thread identity.
- Expected files:
- `apps/server/src/persistence/Migrations/00x_*.ts` (checkpoint schema migration)
- `apps/server/src/persistence/Services/Checkpoints.ts`
- `apps/server/src/persistence/Layers/Checkpoints.ts`
- `apps/server/src/checkpointing/Layers/CheckpointService.ts`
- Tests:
- resume/new session over same thread sees same checkpoint history
- revert/diff still work after session churn
### Commit 7: Add durable projection persistence for orchestration read models
- Introduce projection tables/snapshots persisted in DB to avoid full replay dependency.
- Keep event stream as source of truth; projection rebuild stays deterministic.
- `getSnapshot` reads from projection store (memory cache optional).
- Expected files:
- `apps/server/src/persistence/Migrations/00x_*.ts` (projection tables)
- `apps/server/src/orchestration/*` projection service/layer
- `apps/server/src/wsServer.ts` (snapshot/replay path wiring)
- Tests:
- cold boot snapshot load without replaying full history in process
- projection rebuild from events yields same result as previous reducer semantics
### Commit 8: Narrow `ProviderService` responsibilities
- Keep `ProviderService` focused on provider RPC/session lifecycle + unified runtime stream.
- Move checkpoint-capture side effects out of provider event worker into dedicated ingestion/checkpoint pipeline service.
- Preserve adapter pluggability and provider-neutral contracts.
- Expected files:
- `apps/server/src/provider/Layers/ProviderService.ts`
- new orchestration/checkpoint runtime coordinator service(s)
- Tests:
- provider service routing stays intact
- checkpoint capture still triggered by turn completion through new coordinator
### Commit 9: Look over schemas (contracts and events)
- Scan for unused schemas.
- Use effect/Schema everywhere
- Analyze which we need
- RPC Input/Output (both for routeRequest and command handler)
- Event payloads
- Persistence entities
### Commit 10: Remove dead legacy path and finalize docs
- Remove unused legacy manager/store path from active architecture:
- `providerManager.ts`
- `filesystemCheckpointStore.ts` (if no longer needed by tests/tools)
- Look over effect services for unused methods, errors, etc
- Update architecture docs with final service boundaries and boot/runtime graph.
- Expected files:
- legacy files + references
- `AGENTS.md`/docs as needed
- `.plans` docs linkage
- Tests:
- full server integration suite passes on Effect-only path
- no regressions in WS protocol behavior
## Risk Controls
- Keep WS method names and payload contracts stable throughout.
- Gate each commit with targeted integration tests before moving forward.
- Avoid broad event-type churn in one step; migrate schemas incrementally with clear compatibility windows.
-11
View File
@@ -1,11 +0,0 @@
Rewrite `createServer` and `index.ts` to be Effect native.
Maybe use `effect/unstable/Socket` for the web socket server
- https://github.com/Effect-TS/effect-smol/blob/main/packages/effect/src/unstable/socket/SocketServer.ts
- https://github.com/Effect-TS/effect-smol/blob/main/packages/platform-node/test/NodeSocket.test.ts
- Migrate remaining runtime code to Effect
- `gitManager` -> `src/git`
- `terminalManager` -> `src/terminal` (Manager + PTY)
- ...
-165
View File
@@ -1,165 +0,0 @@
# PR #89 Review Remediation Plan (Phased)
## How To Use These Files
- Working checklist with updateable status per item (single source of truth): `.plans/16c-pr89-remediation-checklist.md`
- This file (`16-pr89-review-remediation-phases.md`): phase strategy and grouping.
## Scope
- Source: GitHub review comments on PR #89 (`Add server-side orchestration engine with event sourcing`).
- Triage baseline used here:
- Total threads: 185
- Outdated: 94 (excluded)
- Active unresolved: 85
- Invalid/false-positive: 3 (excluded)
- Duplicate reposts: collapsed
- Unique actionable findings after filtering: 58
- Post-rewrite validity audit: 5 additional stale items marked invalid, leaving 53 actionable (`34 valid` + `19 partially-valid`)
## Phase 0: Canonical Triage Lock
- Create a single tracking checklist for the 53 currently actionable findings.
- Map every duplicate thread to its canonical item.
- Mark invalid/false-positive items with explicit rationale.
Exit criteria:
- Every open thread is mapped to one canonical fix item or marked invalid.
## Phase 1: Runtime Survival and Critical Event Wiring
Related bug groups solved together:
- Worker loop/fiber fatal error handling in orchestration reactors.
- WebSocket message error boundaries and unhandled rejection guards.
- Close invalid `providers.event` review findings as documented architecture mismatch (no code change expected).
Primary files:
- `apps/server/src/orchestration/Layers/ProviderRuntimeIngestion.ts`
- `apps/server/src/orchestration/Layers/CheckpointReactor.ts`
- `apps/server/src/wsServer.ts`
Exit criteria:
- A single event-processing failure cannot permanently stop ingestion/reactor loops.
- WS message handling cannot produce unhandled promise rejections.
- Invalid provider-event-channel review findings are closed with architecture rationale.
## Phase 2: State Consistency and Ordering
Related bug groups solved together:
- Fire-and-forget revert completion causing consistency windows.
- Non-atomic append/projection paths and retry behavior.
- Race-sensitive thread/event association issues.
Primary files:
- `apps/server/src/orchestration/Layers/CheckpointReactor.ts`
- `apps/server/src/orchestration/Layers/OrchestrationEngine.ts`
- `apps/server/src/orchestration/Layers/ProjectionPipeline.ts`
- `apps/server/src/orchestration/Layers/ProviderRuntimeIngestion.ts`
Exit criteria:
- Revert flow is deterministically reflected in read model updates.
- Append/project failure mode is explicit and safe under retry.
- No cross-thread misassociation under concurrent runtime events.
## Phase 3: Checkpointing Correctness Bundle
Related bug groups solved together:
- Checkpoint input normalization consistency.
- Snapshot/projector coverage mismatches.
- Checkpoint ref/workspace CWD utility duplication.
- Checkpoint diff/error handling behavior gaps.
Primary files:
- `apps/server/src/checkpointing/Layers/CheckpointStore.ts`
- `apps/server/src/checkpointing/Layers/CheckpointDiffQuery.ts`
- `apps/server/src/orchestration/Layers/ProjectionSnapshotQuery.ts`
- `apps/server/src/orchestration/Layers/CheckpointReactor.ts`
- `apps/server/src/wsServer.ts`
Exit criteria:
- Checkpoint capture/restore/revert paths use one normalization policy.
- Required projectors are actually represented in snapshot reads.
- Shared checkpoint/ref/CWD helpers are centralized.
## Phase 4: Memory and Lifecycle Hygiene
Related bug groups solved together:
- Unbounded in-memory dedup sets/maps.
- Missing cleanup/lifecycle protections in long-lived effects/resources.
Primary files:
- `apps/server/src/orchestration/Layers/ProviderCommandReactor.ts`
- `apps/server/src/orchestration/Layers/ProviderRuntimeIngestion.ts`
- `apps/server/src/config.ts`
Exit criteria:
- Long-running server memory does not grow unbounded from dedup bookkeeping.
- Resource cleanup paths are registered for interruption/shutdown.
## Phase 5: Transport, Parsing, and Platform Edge Cases
Related bug groups solved together:
- UTF-8 chunk boundary decode correctness.
- Markdown/file-link parsing edge cases.
- Shell/OS-specific PATH parsing behavior.
- Git rename parsing and small keybinding edge cases.
Primary files:
- `apps/server/src/wsServer.ts`
- `apps/server/src/git/Layers/CodexTextGeneration.ts`
- `apps/web/src/markdown-links.ts`
- `apps/server/src/os-jank.ts`
- `apps/server/src/git/Layers/GitCore.ts`
- `apps/server/src/keybindings.ts`
Exit criteria:
- Edge-case parsers are robust across valid but non-trivial inputs.
- Platform-dependent command behavior has safe fallbacks.
## Phase 6: Build and Maintainability Cleanup
Related bug groups solved together:
- Build script/runtime assumption cleanup.
- Redundant error-union declarations and utility/type duplication.
- Non-functional cleanup comments/docs markers.
Primary files:
- `apps/server/package.json`
- `apps/server/src/checkpointing/Errors.ts`
- Shared utility locations introduced during earlier phases
- `AGENTS.md` (if cleanup is still pending)
Exit criteria:
- Build path is explicit and environment-safe.
- Redundant types/utilities are removed in favor of single sources of truth.
## Phase 7: Verification and Closeout
- Add backend tests for all behavioral fixes (integration-focused; external services may be layered/mocked, core business logic not mocked out).
- Run lint and backend tests for all touched packages.
- Resolve threads with fix references per canonical checklist item.
Exit criteria:
- Lint passes.
- Backend tests pass.
- All actionable review threads are resolved or explicitly justified.
-478
View File
@@ -1,478 +0,0 @@
# PR #89 Remediation Checklist (Consolidated)
_Last updated: 2026-02-26_
This is the working checklist for remediation execution.
Status values:
- `TODO`: Not started
- `IN_PROGRESS`: Currently being worked
- `BLOCKED`: Waiting on decision/dependency
- `DONE`: Implemented and verified
- `CLOSED_INVALID`: Stale/invalid review finding
Counts: active `51` (`valid=33`, `partially-valid=18`), closed-invalid `6`
## Active Checklist
### Phase 1
- [x] `C002` A dispatch error in `processEvent` will terminate the `Effect.forever` loop, permanently halting event ingestion. Consider adding error recovery (e.g., `Effect.catchAll` with logging) around `processEvent` so failures don't kill the fiber.
- Status: `DONE`
- Verdict: `valid`
- Severity: `High`
- Area: `Runtime resilience and failure handling`
- File: `apps/server/src/orchestration/Layers/ProviderRuntimeIngestion.ts:333`
- Threads: PRRT_kwDORLtfbc5wj4cH, PRRT_kwDORLtfbc5wnWwF, PRRT_kwDORLtfbc5wyTaP, PRRT_kwDORLtfbc5wzliw, PRRT_kwDORLtfbc5w0_g3, PRRT_kwDORLtfbc5w1HGT (+5 duplicate thread(s))
- Audit note: Ingestion worker loop can terminate on unhandled processEvent failure.
- [x] `C003` Consider attaching a no-op error listener before `socket.write` (e.g., `socket.on('error', () => {})`) to prevent an unhandled `EPIPE`/`ECONNRESET` from crashing the process if the client disconnects mid-handshake.
- Status: `DONE`
- Verdict: `valid`
- Severity: `High`
- Area: `WebSocket robustness`
- File: `apps/server/src/wsServer.ts:75`
- Threads: PRRT_kwDORLtfbc5v-cf4
- Audit note: Upgrade reject writes then destroys socket without defensive error listener.
- [x] `C012` Forked revert dispatch risks read model inconsistency
- Status: `DONE`
- Verdict: `valid`
- Severity: `Medium`
- Area: `Runtime resilience and failure handling`
- File: `apps/server/src/orchestration/Layers/CheckpointReactor.ts:542`
- Threads: PRRT_kwDORLtfbc5whszW, PRRT_kwDORLtfbc5wyTaS, PRRT_kwDORLtfbc5wzli0, PRRT_kwDORLtfbc5w0_g4, PRRT_kwDORLtfbc5w1HGX (+4 duplicate thread(s))
- Audit note: Revert completion dispatch remains forked; state consistency window remains.
- [ ] `C019` ProviderRuntimeIngestion processes events for wrong thread on race
- Status: `TODO`
- Verdict: `partially-valid`
- Severity: `Medium`
- Area: `Runtime resilience and failure handling`
- File: `apps/server/src/orchestration/Layers/ProviderRuntimeIngestion.ts:178`
- Threads: PRRT_kwDORLtfbc5wkPaL
- Audit note: SessionId-only routing can misassociate events under races/rebinds.
- [x] `C020` On `message.completed`, the message ID is added to the set and `thread.message.assistant.complete` is dispatched. On `turn.completed`, the same set is iterated and `thread.message.assistant.complete` is dispatched again for each ID—including already-completed ones. Consider removing message IDs from the set after dispatching on `message.completed`, or filtering out already-completed IDs before the `turn.completed` loop.
- Status: `DONE`
- Verdict: `partially-valid`
- Severity: `Medium`
- Area: `Runtime resilience and failure handling`
- File: `apps/server/src/orchestration/Layers/ProviderRuntimeIngestion.ts:266`
- Threads: PRRT_kwDORLtfbc5w1GPr
- Audit note: Duplicate complete dispatch exists; downstream impact often idempotent.
- [x] `C026` Consider adding `.catch(() => {})` after `Effect.runPromise(handleMessage(ws, raw))` to prevent unhandled rejections from crashing the server if `encodeResponse` or setup logic fails.
- Status: `DONE`
- Verdict: `valid`
- Severity: `Medium`
- Area: `WebSocket robustness`
- File: `apps/server/src/wsServer.ts:545`
- Threads: PRRT_kwDORLtfbc5wj4cE
- Audit note: runPromise result still not caught; rejection can surface unhandled.
- [x] `C027` WS message handler can cause unhandled promise rejection
- Status: `DONE`
- Verdict: `valid`
- Severity: `Medium`
- Area: `Runtime resilience and failure handling`
- File: `apps/server/src/wsServer.ts:545`
- Threads: PRRT_kwDORLtfbc5wyTaW, PRRT_kwDORLtfbc5wzli3 (+1 duplicate thread(s))
- Audit note: Same unhandled rejection path remains in WS message handler.
- [x] `C042` Duplicated `resolveThreadWorkspaceCwd` across three files
- Status: `DONE`
- Verdict: `partially-valid`
- Severity: `Low`
- Area: `Runtime resilience and failure handling`
- File: `apps/server/src/orchestration/Layers/CheckpointReactor.ts:62`
- Threads: PRRT_kwDORLtfbc5wzli2
- Audit note: Duplication exists but one instance is variant logic, so impact is moderate.
- [x] `C043` Duplicated workspace CWD resolution logic across reactor modules
- Status: `DONE`
- Verdict: `valid`
- Severity: `Low`
- Area: `Runtime resilience and failure handling`
- File: `apps/server/src/orchestration/Layers/CheckpointReactor.ts:62`
- Threads: PRRT_kwDORLtfbc5wnWwM, PRRT_kwDORLtfbc5w1C3-, PRRT_kwDORLtfbc5w1HGZ (+2 duplicate thread(s))
- Audit note: Workspace CWD resolution duplication still present across modules.
- [x] `C044` Checkpoint reactor swallows diff errors silently for `turn.completed`
- Status: `DONE`
- Verdict: `partially-valid`
- Severity: `Low`
- Area: `Runtime resilience and failure handling`
- File: `apps/server/src/orchestration/Layers/CheckpointReactor.ts:274`
- Threads: PRRT_kwDORLtfbc5wkPaO
- Audit note: Errors are swallowed to empty diff with warning; not fully silent but still lossy.
- [x] `C045` `truncateDetail` slices to `limit - 1` then appends `"..."` (3 chars), producing strings of length `limit + 2`. Consider slicing to `limit - 3` instead. <details> <summary>🚀 Reply "<strong>fix it for me</strong>" or copy this <strong>AI Prompt</strong> for your agent:</summary>
- Status: `DONE`
- Verdict: `valid`
- Severity: `Low`
- Area: `Runtime resilience and failure handling`
- File: `apps/server/src/orchestration/Layers/ProviderRuntimeIngestion.ts:29`
- Threads: PRRT_kwDORLtfbc5wzp4R
- Audit note: truncateDetail still overshoots limit.
- [x] `C046` `latestMessageIdByTurnKey` is written to but never read, and `clearAssistantMessageIdsForTurn` doesn't clear its entries—only `clearTurnStateForSession` does. Consider removing this map entirely if unused, or clearing it alongside `turnMessageIdsByTurnKey` in `clearAssistantMessageIdsForTurn`. <details> <summary>🚀 Reply "<strong>fix it for me</strong>" or copy this <strong>AI Prompt</strong> for your agent:</summary>
- Status: `DONE`
- Verdict: `valid`
- Severity: `Low`
- Area: `Runtime resilience and failure handling`
- File: `apps/server/src/orchestration/Layers/ProviderRuntimeIngestion.ts:133`
- Threads: PRRT_kwDORLtfbc5wxvIQ
- Audit note: latestMessageIdByTurnKey still unused/unpruned in per-turn clear path.
- [x] `C053` Consider using `socket.end(response)` instead of `socket.write(response)` + `socket.destroy()` to ensure the HTTP error response is fully flushed before closing the connection.
- Status: `DONE`
- Verdict: `valid`
- Severity: `Low`
- Area: `WebSocket robustness`
- File: `apps/server/src/wsServer.ts:83`
- Threads: PRRT_kwDORLtfbc5v-WPD
- Audit note: Still uses write+destroy rather than end() for rejection response.
- [ ] `C054` When array chunks contain a multi-byte UTF-8 character split across boundaries, decoding each chunk separately produces replacement characters. Consider using `Buffer.concat()` on all chunks before calling `.toString("utf8")`. <details> <summary>🚀 Reply "<strong>fix it for me</strong>" or copy this <strong>AI Prompt</strong> for your agent:</summary>
- Status: `TODO`
- Verdict: `valid`
- Severity: `Low`
- Area: `WebSocket robustness`
- File: `apps/server/src/wsServer.ts:104`
- Threads: PRRT_kwDORLtfbc5whtrR
- Audit note: Array chunk UTF-8 decode remains vulnerable to split multibyte corruption.
- [x] `C059` Suggestion: don’t spread `params` into `body`; it can override `_tag` and mishandle non-object values. Keep `_tag` separate and nest `params` under a single key (e.g., `data`), or validate `params` is a plain object.
- Status: `DONE`
- Verdict: `partially-valid`
- Severity: `Low`
- Area: `WebSocket robustness`
- File: `apps/web/src/wsTransport.ts:59`
- Threads: PRRT_kwDORLtfbc5whtrN
- Audit note: Transport \_tag override risk exists but current callsites are constrained.
### Phase 2
- [x] `C001` Non-atomic event appending can corrupt state on retry. If an error occurs mid-loop (lines 96-102) after some events are persisted but before the receipt is written, the command appears to fail. A retry generates new UUIDs via `crypto.randomUUID()` in the decider, appending duplicate events. Consider wrapping the loop in a transaction or using deterministic event IDs derived from `commandId`. <details> <summary>🚀 Reply "<strong>fix it for me</strong>" or copy this <strong>AI Prompt</strong> for your agent:</summary>
- Status: `DONE`
- Verdict: `valid`
- Severity: `High`
- Area: `Event ordering and state consistency`
- File: `apps/server/src/orchestration/Layers/OrchestrationEngine.ts:96`
- Threads: PRRT_kwDORLtfbc5wzp4T
- Audit note: Append/project/receipt are non-atomic; retry can duplicate events.
- [x] `C013` If `projectionPipeline.projectEvent` fails after `eventStore.append` succeeds, the event is persisted but `readModel` isn't updated, causing desync. Consider updating the in-memory `readModel` immediately after append (before the external projection), so local state stays consistent regardless of downstream failures.
- Status: `DONE`
- Verdict: `valid`
- Severity: `Medium`
- Area: `Event ordering and state consistency`
- File: `apps/server/src/orchestration/Layers/OrchestrationEngine.ts:99`
- Threads: PRRT_kwDORLtfbc5whtrM
- Audit note: Persisted event can outpace in-memory projection on mid-flight failure.
- [x] `C015` The gap-filling fallback logic can retain messages from turns that are about to be deleted, causing foreign key violations. Consider removing the fallback logic entirely, or filtering `fallbackUserMessages` and `fallbackAssistantMessages` to only include messages whose `turnId` is in `retainedTurnIds`. <details> <summary>🚀 Reply "<strong>fix it for me</strong>" or copy this <strong>AI Prompt</strong> for your agent:</summary>
- Status: `DONE`
- Verdict: `partially-valid`
- Severity: `Medium`
- Area: `Event ordering and state consistency`
- File: `apps/server/src/orchestration/Layers/ProjectionPipeline.ts:99`
- Threads: PRRT_kwDORLtfbc5whxJO
- Audit note: Message fallback retention issue is real, but prior FK-violation claim is overstated.
- [x] `C016` The in-memory `pendingTurnStartByThreadId` map isn't restored during bootstrap. If the service restarts after processing `thread.turn-start-requested` but before `thread.session-set`, the `userMessageId` and `startedAt` will be lost since bootstrap resumes _after_ the committed sequence. Consider persisting this pending state or processing these two events atomically. <details> <summary>🚀 Reply "<strong>fix it for me</strong>" or copy this <strong>AI Prompt</strong> for your agent:</summary>
- Status: `DONE`
- Verdict: `valid`
- Severity: `Medium`
- Area: `Event ordering and state consistency`
- File: `apps/server/src/orchestration/Layers/ProjectionPipeline.ts:490`
- Threads: PRRT_kwDORLtfbc5wxvH8
- Audit note: Pending turn-start map is in-memory only and not rebuilt on bootstrap.
### Phase 3
- [x] `C008` Inconsistent input normalization across CheckpointStore methods
- Status: `DONE`
- Verdict: `partially-valid`
- Severity: `Medium`
- Area: `Checkpointing correctness`
- File: `apps/server/src/checkpointing/Layers/CheckpointStore.ts:94`
- Threads: PRRT*kwDORLtfbc5widJw, PRRT_kwDORLtfbc5wnWv*, PRRT_kwDORLtfbc5w0_g7, PRRT_kwDORLtfbc5w1C36 (+3 duplicate thread(s))
- Audit note: Edge schema strategy is in place across contracts/consumers (trim/normalize via schemas and decode at boundaries); CheckpointStore remains an internal repository boundary.
- [x] `C017` `REQUIRED_SNAPSHOT_PROJECTORS` includes `pending-approvals` and `thread-turns`, but `getSnapshot` doesn't query their data. If these projectors lag behind, the returned `snapshotSequence` will be lower than what the included data actually reflects, causing clients to replay already-applied events. Consider filtering `REQUIRED_SNAPSHOT_PROJECTORS` to only include projectors whose data is actually fetched in the snapshot. <details> <summary>🚀 Reply "<strong>fix it for me</strong>" or copy this <strong>AI Prompt</strong> for your agent:</summary>
- Status: `DONE`
- Verdict: `partially-valid`
- Severity: `Medium`
- Area: `Checkpointing correctness`
- File: `apps/server/src/orchestration/Layers/ProjectionSnapshotQuery.ts:71`
- Threads: PRRT_kwDORLtfbc5wiLhQ
- Audit note: Snapshot sequence can under-report due to extra projectors, but replay impact is lower now.
- [x] `C033` Three error classes defined but never instantiated anywhere
- Status: `DONE`
- Verdict: `partially-valid`
- Severity: `Low`
- Area: `Checkpointing correctness`
- File: `apps/server/src/checkpointing/Errors.ts:51`
- Threads: PRRT_kwDORLtfbc5wlYgo
- Audit note: Original claim overstated; some errors used, others appear unused.
- [x] `C034` Redundant `CheckpointInvariantError` in `CheckpointServiceError` union type
- Status: `DONE`
- Verdict: `valid`
- Severity: `Low`
- Area: `Checkpointing correctness`
- File: `apps/server/src/checkpointing/Errors.ts:79`
- Threads: PRRT_kwDORLtfbc5wj5fn
- Audit note: CheckpointInvariantError remains redundantly included in service union.
- [x] `C035` Redundant error type in CheckpointServiceError union definition
- Status: `DONE`
- Verdict: `valid`
- Severity: `Low`
- Area: `Checkpointing correctness`
- File: `apps/server/src/checkpointing/Errors.ts:79`
- Threads: PRRT_kwDORLtfbc5wlYgs, PRRT_kwDORLtfbc5wxsO6, PRRT_kwDORLtfbc5w1C4B (+2 duplicate thread(s))
- Audit note: Same as C034.
### Phase 4
- [ ] `C018` Unbounded memory growth in turn start deduplication set
- Status: `TODO`
- Verdict: `valid`
- Severity: `Medium`
- Area: `Memory/resource growth`
- File: `apps/server/src/orchestration/Layers/ProviderCommandReactor.ts:84`
- Threads: PRRT_kwDORLtfbc5whszQ, PRRT_kwDORLtfbc5wl2A8, PRRT_kwDORLtfbc5wyTaT, PRRT_kwDORLtfbc5wzliz, PRRT_kwDORLtfbc5w0_g-, PRRT_kwDORLtfbc5w1HGW (+5 duplicate thread(s))
- Audit note: handledTurnStartKeys still grows without pruning.
### Phase 5
- [ ] `C009` Git's braced rename syntax (e.g., `src/{old => new}/file.ts`) isn't handled correctly. The current slice after `=>` produces invalid paths like `new}/file.ts`. Consider expanding the braces to construct the full destination path. <details> <summary>🚀 Reply "<strong>fix it for me</strong>" or copy this <strong>AI Prompt</strong> for your agent:</summary>
- Status: `TODO`
- Verdict: `valid`
- Severity: `Medium`
- Area: `Edge-case parsing/platform behavior`
- File: `apps/server/src/git/Layers/GitCore.ts:41`
- Threads: PRRT_kwDORLtfbc5w1CxT
- Audit note: Braced rename parsing still breaks paths like src/{old => new}/file.ts.
- [ ] `C010` `loadCustomKeybindingsConfig` fails when the config file doesn't exist, which is expected for new users. Consider catching `ENOENT` and returning an empty array instead. <details> <summary>🚀 Reply "<strong>fix it for me</strong>" or copy this <strong>AI Prompt</strong> for your agent:</summary>
- Status: `TODO`
- Verdict: `valid`
- Severity: `Medium`
- Area: `Edge-case parsing/platform behavior`
- File: `apps/server/src/keybindings.ts:418`
- Threads: PRRT_kwDORLtfbc5wxvIJ
- Audit note: ENOENT for missing keybindings config still not handled as empty/default.
- [ ] `C022` Fish shell outputs `$PATH` as space-separated, not colon-separated. Consider checking if the shell is fish and using `string join : $PATH` instead, or validating the result contains colons before assigning.
- Status: `TODO`
- Verdict: `valid`
- Severity: `Medium`
- Area: `Edge-case parsing/platform behavior`
- File: `apps/server/src/os-jank.ts:10`
- Threads: PRRT_kwDORLtfbc5wkRZM
- Audit note: fish PATH formatting risk still exists in os-jank path recovery.
- [ ] `C023` Using `-il` flags causes the shell to source profile scripts that may print banners or other text, polluting the captured `PATH`. Consider using `-lc` (login only, non-interactive) to reduce unwanted output.
- Status: `TODO`
- Verdict: `valid`
- Severity: `Medium`
- Area: `Edge-case parsing/platform behavior`
- File: `apps/server/src/os-jank.ts:10`
- Threads: PRRT_kwDORLtfbc5wj4cM
- Audit note: -ilc shell invocation can pollute captured PATH output.
- [x] `C029` `parseFileUrlHref` already decodes the path (line 46), but `safeDecode` is called again here, corrupting filenames containing `%` sequences. Consider skipping the decode when `fileUrlTarget` is non-null.
- Status: `DONE`
- Verdict: `valid`
- Severity: `Medium`
- Area: `Edge-case parsing/platform behavior`
- File: `apps/web/src/markdown-links.ts:105`
- Threads: PRRT_kwDORLtfbc5wnVsU
- Audit note: file URL decoding still double-decodes in one path.
- [x] `C030` `EXTERNAL_SCHEME_PATTERN` matches `script.ts:10` as a scheme because `.ts:` looks like `scheme:`. Consider requiring `://` after the colon, or checking that what follows the colon is not just digits. <details> <summary>🚀 Reply "<strong>fix it for me</strong>" or copy this <strong>AI Prompt</strong> for your agent:</summary>
- Status: `DONE`
- Verdict: `valid`
- Severity: `Medium`
- Area: `Edge-case parsing/platform behavior`
- File: `apps/web/src/markdown-links.ts:111`
- Threads: PRRT_kwDORLtfbc5wnVsK
- Audit note: Scheme regex still misclassifies script.ts:10 as external scheme.
- [ ] `C038` Multi-byte UTF-8 characters split across chunks will be corrupted when decoding each chunk separately. Consider accumulating all chunks first, then decoding once, or use `TextDecoder` with `stream: true`. <details> <summary>🚀 Reply "<strong>fix it for me</strong>" or copy this <strong>AI Prompt</strong> for your agent:</summary>
- Status: `TODO`
- Verdict: `valid`
- Severity: `Low`
- Area: `Edge-case parsing/platform behavior`
- File: `apps/server/src/git/Layers/CodexTextGeneration.ts:136`
- Threads: PRRT_kwDORLtfbc5w1GPo
- Audit note: Chunk-by-chunk UTF-8 decode can still corrupt split multibyte characters.
- [x] `C039` The `+` key can be parsed (via trailing `+` handling) but cannot be encoded because `shortcut.key.includes("+")` returns true for the literal `+` key. Consider checking `shortcut.key === "+"` separately and encoding it as `"space"` style (e.g., a special token), or adjusting the condition to allow the single `+` character. <details> <summary>🚀 Reply "<strong>fix it for me</strong>" or copy this <strong>AI Prompt</strong> for your agent:</summary>
- Status: `DONE`
- Verdict: `partially-valid`
- Severity: `Low`
- Area: `Edge-case parsing/platform behavior`
- File: `apps/server/src/keybindings.ts:352`
- Threads: PRRT_kwDORLtfbc5wxvIB
- Audit note: Parser/encoder mismatch remains, but encoder path currently low-use.
- [x] `C040` `upsertKeybindingRule` has a race condition: concurrent calls read the same file state, then the last write overwrites earlier changes. Consider wrapping the read-modify-write sequence with `Effect.Semaphore` to serialize access. <details> <summary>🚀 Reply "<strong>fix it for me</strong>" or copy this <strong>AI Prompt</strong> for your agent:</summary>
- Status: `DONE`
- Verdict: `valid`
- Severity: `Low`
- Area: `Edge-case parsing/platform behavior`
- File: `apps/server/src/keybindings.ts:488`
- Threads: PRRT_kwDORLtfbc5wxvIA
- Audit note: upsertKeybindingRule read-modify-write remains race-prone.
### Phase 6
- [ ] `C028` Branch sync dispatches both server and stale local update
- Status: `TODO`
- Verdict: `partially-valid`
- Severity: `Medium`
- Area: `Other`
- File: `apps/web/src/components/BranchToolbar.tsx:102`
- Threads: PRRT_kwDORLtfbc5v-XCu
- Audit note: Optimistic local+server dual update is intentional but can temporarily diverge.
- [x] `C037` `Effect.callback` should return a cleanup function to close the server(s) on fiber interruption. Without it, the `Net.Server` handles keep the process alive and leak the port if the effect is cancelled. <details> <summary>🚀 Reply "<strong>fix it for me</strong>" or copy this <strong>AI Prompt</strong> for your agent:</summary>
- Status: `DONE`
- Verdict: `partially-valid`
- Severity: `Low`
- Area: `Other`
- File: `apps/server/src/config.ts:41`
- Threads: PRRT_kwDORLtfbc5wj4cO
- Audit note: Callback cleanup missing, but practical exposure is low in one-shot startup path.
- [ ] `C047` `SqlSchema.findOneOption` can produce both SQL errors and decode errors, but `mapError` wraps all as `PersistenceSqlError`. Consider distinguishing `ParseError` from SQL errors and mapping decode failures to `PersistenceDecodeError` instead. <details> <summary>🚀 Reply "<strong>fix it for me</strong>" or copy this <strong>AI Prompt</strong> for your agent:</summary>
- Status: `TODO`
- Verdict: `valid`
- Severity: `Low`
- Area: `Other`
- File: `apps/server/src/persistence/Layers/OrchestrationCommandReceipts.ts:75`
- Threads: PRRT_kwDORLtfbc5wiaR-
- Audit note: Decode and SQL errors still collapsed into one persistence error kind.
- [x] `C049` `JSON.stringify(cause)` returns `undefined` for `undefined`, functions, or symbols, violating the `string` return type. Consider coercing the result to a string (e.g., `String(JSON.stringify(cause))`) or adding a fallback.
- Status: `DONE`
- Verdict: `valid`
- Severity: `Low`
- Area: `Other`
- File: `apps/server/src/provider/Layers/ProviderService.ts:59`
- Threads: PRRT_kwDORLtfbc5wnVsI
- Audit note: JSON.stringify(cause) may return undefined despite string expectations.
- [ ] `C050` The read-modify-write pattern (`getBySessionId` → merge → `upsert`) is susceptible to lost updates under concurrent writes. Consider wrapping in a transaction or adding optimistic concurrency control (e.g., version field) if concurrent session updates are expected. <details> <summary>🚀 Reply "<strong>fix it for me</strong>" or copy this <strong>AI Prompt</strong> for your agent:</summary>
- Status: `TODO`
- Verdict: `valid`
- Severity: `Low`
- Area: `Other`
- File: `apps/server/src/provider/Layers/ProviderSessionDirectory.ts:94`
- Threads: PRRT_kwDORLtfbc5wiLhY
- Audit note: ProviderSessionDirectory upsert remains read-merge-write without concurrency control.
- [x] `C051` Using `??` for `providerThreadId` and `adapterKey` makes it impossible to clear these fields by passing `null`, since `null ?? existing` evaluates to `existing`. Consider using explicit `undefined` checks (like `resumeCursor` does) if clearing should be supported. <details> <summary>🚀 Reply "<strong>fix it for me</strong>" or copy this <strong>AI Prompt</strong> for your agent:</summary>
- Status: `DONE`
- Verdict: `partially-valid`
- Severity: `Low`
- Area: `Other`
- File: `apps/server/src/provider/Layers/ProviderSessionDirectory.ts:119`
- Threads: PRRT_kwDORLtfbc5wxvH9
- Audit note: Null-clearing issue is real for providerThreadId; adapterKey part overstated.
- [ ] `C052` Race condition: `processHandle` may be `null` when `data` callback fires, since it's assigned after `Bun.spawn` returns. Consider initializing `BunPtyProcess` first, then passing it to the callback to avoid losing initial output. <details> <summary>🚀 Reply "<strong>fix it for me</strong>" or copy this <strong>AI Prompt</strong> for your agent:</summary>
- Status: `TODO`
- Verdict: `valid`
- Severity: `Low`
- Area: `Other`
- File: `apps/server/src/terminal/Layers/BunPTY.ts:97`
- Threads: PRRT_kwDORLtfbc5w1CxE
- Audit note: Data callback may race before processHandle assignment.
- [ ] `C056` When `onOpenChange` is provided without `open`, the internal `_open` state never updates because `setOpenProp` takes precedence. Consider calling `_setOpen` when `openProp === undefined`, regardless of whether `setOpenProp` exists.
- Status: `TODO`
- Verdict: `partially-valid`
- Severity: `Low`
- Area: `Other`
- File: `apps/web/src/components/ui/sidebar.tsx:114`
- Threads: PRRT_kwDORLtfbc5wxvIq
- Audit note: Bug pattern exists, but current callsites mostly avoid triggering it.
- [ ] `C057` The `resizable` object is recreated on every render, causing `SidebarRail`'s `useEffect` to repeatedly read localStorage and update the DOM. Consider memoizing the object with `useMemo`. <details> <summary>🚀 Reply "<strong>fix it for me</strong>" or copy this <strong>AI Prompt</strong> for your agent:</summary>
- Status: `TODO`
- Verdict: `valid`
- Severity: `Low`
- Area: `Other`
- File: `apps/web/src/routes/_chat.$threadId.tsx:105`
- Threads: PRRT_kwDORLtfbc5wyWz4
- Audit note: Resizable object recreation still retriggers effect/storage reads.
- [ ] `C058` When `localStorage.getItem()` returns `null`, `Number(null)` evaluates to `0`, which passes `Number.isFinite(0)`. This causes the sidebar to clamp to `minWidth` on first load, overriding the `DIFF_INLINE_DEFAULT_WIDTH` CSS clamp. Consider checking for `null` or empty string before parsing, e.g. guard with `storedWidth === null || storedWidth === ''`. <details> <summary>🚀 Reply "<strong>fix it for me</strong>" or copy this <strong>AI Prompt</strong> for your agent:</summary>
- Status: `TODO`
- Verdict: `valid`
- Severity: `Low`
- Area: `Other`
- File: `apps/web/src/routes/_chat.$threadId.tsx:122`
- Threads: PRRT_kwDORLtfbc5wnVsX
- Audit note: Number(null) -> 0 path still forces min width on initial load.
- [ ] `C060` `defaultModel` should be `Schema.optional(Schema.NullOr(Schema.String))` to allow clearing the value. Currently there's no way to reset it to `null` since omitting means "no change" in patch semantics. <details> <summary>🚀 Reply "<strong>fix it for me</strong>" or copy this <strong>AI Prompt</strong> for your agent:</summary>
- Status: `TODO`
- Verdict: `valid`
- Severity: `Low`
- Area: `Other`
- File: `packages/contracts/src/orchestration.ts:253`
- Threads: PRRT_kwDORLtfbc5whxJC
- Audit note: Schema still cannot express null clear for defaultModel patch.
## Closed Invalid Items
- [x] `C014` Engine error handler catches all errors including non-invariant ones
- Status: `CLOSED_INVALID`
- Severity: `Medium`
- File: `apps/server/src/orchestration/Layers/OrchestrationEngine.ts:144`
- Threads: PRRT_kwDORLtfbc5wkPaJ
- Rationale: Broad catch is intentional for worker liveness; transactional dispatch path prevents the claimed non-invariant idempotency break in current design.
- [x] `C021` Shared mutable default metadata object causes stale eventId
- Status: `CLOSED_INVALID`
- Severity: `Medium`
- File: `apps/server/src/orchestration/decider.ts:27`
- Threads: PRRT_kwDORLtfbc5wkPaA
- Rationale: Stale-eventId claim no longer applies; eventId is regenerated per event.
- [x] `C025` Duplicated checkpoint ref computation across two files
- Status: `CLOSED_INVALID`
- Severity: `Medium`
- File: `apps/server/src/wsServer.ts:128`
- Threads: PRRT_kwDORLtfbc5wvwag
- Rationale: No longer duplicated; checkpoint ref helper now centralized.
- [x] `C031` Revert uses wrong turn count from positional inference
- Status: `CLOSED_INVALID`
- Severity: `Medium`
- File: `apps/web/src/session-logic.ts:127`
- Threads: PRRT_kwDORLtfbc5v9SCp
- Rationale: Revert now uses explicit checkpointTurnCount first; positional fallback is non-primary.
- [x] `C036` Duplicate `checkpointRefForThreadTurn` function in two production files
- Status: `CLOSED_INVALID`
- Severity: `Low`
- File: `apps/server/src/checkpointing/Layers/CheckpointStore.ts:284`
- Threads: PRRT_kwDORLtfbc5wiqFX
- Rationale: No longer duplicated; single production source via Refs.ts.
- [x] `C055` Duplicate `checkpointRefForThreadTurn` function across files
- Status: `CLOSED_INVALID`
- Severity: `Low`
- File: `apps/server/src/wsServer.ts:128`
- Threads: PRRT_kwDORLtfbc5wkPaG
- Rationale: No longer duplicated; helper is centralized.
-441
View File
@@ -1,441 +0,0 @@
# Plan: Claude Code Integration (Orchestration Architecture)
## Why this plan was rewritten
The previous plan targeted a pre-orchestration architecture (`ProviderManager`, provider-native WS event methods, and direct provider UI wiring). The current app now routes everything through:
1. `orchestration.dispatchCommand` (client intent)
2. `OrchestrationEngine` (decide + persist + publish domain events)
3. `ProviderCommandReactor` (domain intent -> `ProviderService`)
4. `ProviderService` (adapter routing + canonical runtime stream)
5. `ProviderRuntimeIngestion` (provider runtime -> internal orchestration commands)
6. `orchestration.domainEvent` (single push channel consumed by web)
Claude integration must plug into this path instead of reintroducing legacy provider-specific flows.
---
## Current constraints to design around (post-Stage 1)
1. Provider runtime ingestion expects canonical `ProviderRuntimeEvent` shapes, not provider-native payloads.
2. Start input now uses typed `providerOptions` and generic `resumeCursor`; top-level provider-specific fields were removed.
3. `resumeCursor` is intentionally opaque outside adapters and must never be synthesized from `providerThreadId`.
4. `ProviderService` still requires adapter `startSession()` to return a `ProviderSession` with `threadId`.
5. Checkpoint revert currently calls `providerService.rollbackConversation()`, so Claude adapter needs a rollback strategy compatible with current reactor behavior.
6. Web currently marks Claude as unavailable (`"Claude Code (soon)"`) and model picker is Codex-only.
---
## Architecture target
Add Claude as a first-class provider adapter that emits canonical runtime events and works with existing orchestration reactors without adding new WS channels or bypass paths.
Key decisions:
1. Keep orchestration provider-agnostic; adapt Claude inside adapter/layer boundaries.
2. Use the existing canonical runtime stream (`ProviderRuntimeEvent`) as the only ingestion contract.
3. Keep provider session routing in `ProviderService` and `ProviderSessionDirectory`.
4. Add explicit provider selection to turn-start intent so first turn can start Claude session intentionally.
---
## Phase 1: Contracts and command shape updates
### 1.1 Provider-aware model contract
Update `packages/contracts/src/model.ts` so model resolution can be provider-aware instead of Codex-only.
Expected outcomes:
1. Introduce provider-scoped model lists (Codex + Claude).
2. Add helpers that resolve model by provider.
3. Preserve backwards compatibility for existing Codex defaults.
### 1.2 Turn-start provider intent
Update `packages/contracts/src/orchestration.ts`:
1. Add optional `provider: ProviderKind` to `ThreadTurnStartCommand`.
2. Carry provider through `ThreadTurnStartRequestedPayload`.
3. Keep existing command valid when provider is omitted.
This removes the implicit “Codex unless session already exists” behavior as the only path.
### 1.3 Provider session start input for Claude runtime knobs (completed)
Update `packages/contracts/src/provider.ts`:
1. Move provider-specific start fields into typed `providerOptions`:
- `providerOptions.codex`
- `providerOptions.claudeCode`
2. Keep `resumeCursor` as the single cross-provider resume input in `ProviderSessionStartInput`.
3. Deprecate/remove `resumeThreadId` from the generic start contract.
4. Treat `resumeCursor` as adapter-owned opaque state.
### 1.4 Contract tests (completed)
Update/add tests in `packages/contracts/src/*.test.ts` for:
1. New command payload shape.
2. Provider-aware model resolution behavior.
3. Breaking-change expectations for removed top-level provider fields.
---
## Phase 2: Claude adapter implementation
### 2.1 Add adapter service + layer
Create:
1. `apps/server/src/provider/Services/ClaudeAdapter.ts`
2. `apps/server/src/provider/Layers/ClaudeAdapter.ts`
Adapter must implement `ProviderAdapterShape<ProviderAdapterError>`.
### 2.1.a SDK dependency and baseline config
Add server dependency:
1. `@anthropic-ai/claude-agent-sdk`
Baseline adapter options to support from day one:
1. `cwd`
2. `model`
3. `pathToClaudeCodeExecutable` (from `providerOptions.claudeCode.binaryPath`)
4. `permissionMode` (from `providerOptions.claudeCode.permissionMode`)
5. `maxThinkingTokens` (from `providerOptions.claudeCode.maxThinkingTokens`)
6. `resume`
7. `resumeSessionAt`
8. `includePartialMessages`
9. `canUseTool`
10. `hooks`
11. `env` and `additionalDirectories` (if needed for sandbox/workspace parity)
### 2.2 Claude runtime bridge
Implement a Claude runtime bridge (either directly in adapter layer or via dedicated manager file) that wraps Agent SDK query lifecycle.
Required capabilities:
1. Long-lived session context per adapter session.
2. Multi-turn input queue.
3. Interrupt support.
4. Approval request/response bridge.
5. Resume support via opaque `resumeCursor` (parsed inside Claude adapter only).
#### 2.2.a Agent SDK details to preserve
The adapter should explicitly rely on these SDK capabilities:
1. `query()` returns an async iterable message stream and control methods (`interrupt`, `setModel`, `setPermissionMode`, `setMaxThinkingTokens`, account/status helpers).
2. Multi-turn input is supported via async-iterable prompt input.
3. Tool approval decisions are provided via `canUseTool`.
4. Resume support uses `resume` and optional `resumeSessionAt`, both derived by parsing adapter-owned `resumeCursor`.
5. Hooks can be used for lifecycle signals (`Stop`, `PostToolUse`, etc.) when we need adapter-originated checkpoint/runtime events.
#### 2.2.b Effect-native session lifecycle skeleton
```ts
import { query } from "@anthropic-ai/claude-agent-sdk";
import { Effect } from "effect";
const acquireSession = (input: ProviderSessionStartInput) =>
Effect.acquireRelease(
Effect.tryPromise({
try: async () => {
const claudeOptions = input.providerOptions?.claudeCode;
const resumeState = readClaudeResumeState(input.resumeCursor);
const abortController = new AbortController();
const result = query({
prompt: makePromptAsyncIterable(),
options: {
cwd: input.cwd,
model: input.model,
permissionMode: claudeOptions?.permissionMode,
maxThinkingTokens: claudeOptions?.maxThinkingTokens,
pathToClaudeCodeExecutable: claudeOptions?.binaryPath,
resume: resumeState?.threadId,
resumeSessionAt: resumeState?.sessionAt,
signal: abortController.signal,
includePartialMessages: true,
canUseTool: makeCanUseTool(),
hooks: makeClaudeHooks(),
},
});
return { abortController, result };
},
catch: (cause) =>
new ProviderAdapterProcessError({
provider: "claudeCode",
sessionId: "pending",
detail: "Failed to start Claude runtime session.",
cause,
}),
}),
({ abortController }) => Effect.sync(() => abortController.abort()),
);
```
#### 2.2.c AsyncIterable -> Effect Stream integration
Preferred when available in the pinned Effect version:
```ts
const sdkMessageStream = Stream.fromAsyncIterable(
session.result,
(cause) =>
new ProviderAdapterProcessError({
provider: "claudeCode",
sessionId,
detail: "Claude runtime stream failed.",
cause,
}),
);
```
Portable fallback (already aligned with current server patterns):
```ts
const sdkMessageStream = Stream.async<ClaudeSdkMessage, ProviderAdapterProcessError>((emit) => {
let cancelled = false;
void (async () => {
try {
for await (const message of session.result) {
if (cancelled) break;
emit.single(message);
}
emit.end();
} catch (cause) {
emit.fail(
new ProviderAdapterProcessError({
provider: "claudeCode",
sessionId,
detail: "Claude runtime stream failed.",
cause,
}),
);
}
})();
return Effect.sync(() => {
cancelled = true;
});
});
```
### 2.3 Canonical event mapping
Claude adapter must translate Agent SDK output into canonical `ProviderRuntimeEvent`.
Initial mapping target:
1. assistant text deltas -> `content.delta`
2. final assistant text -> `item.completed` and/or `turn.completed`
3. approval requests -> `request.opened`
4. approval results -> `request.resolved`
5. system lifecycle -> `session.*`, `thread.*`, `turn.*`
6. errors -> `runtime.error`
7. plan/proposed-plan content when derivable
Implementation note:
1. Keep raw Claude message on `raw` for debugging.
2. Prefer canonical item/request kinds over provider-native enums.
3. If Claude emits extra event kinds we do not model yet, map them to `tool.summary`, `runtime.warning`, or `unknown`-compatible payloads instead of dropping silently.
### 2.4 Resume cursor strategy
Define Claude-owned opaque resume state, e.g.:
```ts
interface ClaudeResumeCursor {
readonly version: 1;
readonly threadId?: string;
readonly sessionAt?: string;
}
```
Rules:
1. Serialize only adapter-owned state into `resumeCursor`.
2. Parse/validate only inside Claude adapter.
3. Store updated cursor when Claude runtime yields enough data to resume safely.
4. Never overload orchestration thread id as Claude thread id.
### 2.5 Interrupt and stop semantics
Map orchestration stop/interrupt expectations onto SDK controls:
1. `interruptTurn()` -> active query interrupt.
2. `stopSession()` -> close session resources and prevent future sends.
3. `rollbackThread()` -> see Phase 4.
---
## Phase 3: Provider service and composition
### 3.1 Register Claude adapter
Update provider registry layer to include Claude:
1. add `claudeCode` -> `ClaudeAdapter`
2. ensure `ProviderService.listProviderStatuses()` reports Claude availability
### 3.2 Persist provider binding
Current `ProviderSessionDirectory` already stores provider/thread binding and opaque `resumeCursor`.
Required validation:
1. Claude bindings survive restart.
2. resume cursor remains opaque and round-trips untouched.
3. stopAll + restart can recover Claude sessions when possible.
### 3.3 Provider start routing
Update `ProviderCommandReactor` / orchestration flow:
1. If a thread turn start requests `provider: "claudeCode"`, start Claude if no active session exists.
2. If a thread already has Claude session binding, reuse it.
3. If provider switches between Codex and Claude, explicitly stop/rebind before next send.
---
## Phase 4: Checkpoint and revert strategy
Claude does not necessarily expose the same conversation rewind primitive as Codex app-server. Current architecture expects `providerService.rollbackConversation()`.
Pick one explicit strategy:
### Option A: provider-native rewind
If SDK/runtime supports safe rewind:
1. implement in Claude adapter
2. keep `CheckpointReactor` unchanged
### Option B: session restart + state truncation shim
If no native rewind exists:
1. Claude adapter returns successful rollback by:
- stopping current Claude session
- clearing/rewriting stored Claude resume cursor to last safe resumable point
- forcing next turn to recreate session from persisted orchestration state
2. Document that rollback is “conversation reset to checkpoint boundary”, not provider-native turn deletion.
Whichever option is chosen:
1. behavior must be deterministic
2. checkpoint revert tests must pass under orchestration expectations
3. user-visible activity log should explain failures clearly when provider rollback is impossible
---
## Phase 5: Web integration
### 5.1 Provider picker and model picker
Update web state/UI:
1. allow choosing Claude as thread provider before first turn
2. show Claude model list from provider-aware model helpers
3. preserve existing Codex default behavior when provider omitted
Likely touch points:
1. `apps/web/src/store.ts`
2. `apps/web/src/components/ChatView.tsx`
3. `apps/web/src/types.ts`
4. `packages/shared/src/model.ts`
### 5.2 Settings for Claude executable/options
Add app settings if needed for:
1. Claude binary path
2. default permission mode
3. default max thinking tokens
Do not hardcode provider-specific config into generic session state if it belongs in app settings or typed `providerOptions`.
### 5.3 Session rendering
No new WS channel should be needed. Claude should appear through existing:
1. thread messages
2. activities/worklog
3. approvals
4. session state
5. checkpoints/diffs
---
## Phase 6: Testing strategy
### 6.1 Contract tests
Cover:
1. provider-aware model schemas
2. provider field on turn-start command
3. provider-specific start options schema
### 6.2 Adapter layer tests
Add `ClaudeAdapter.test.ts` covering:
1. session start
2. event mapping
3. approval bridge
4. resume cursor parse/serialize
5. interrupt behavior
6. rollback behavior or explicit unsupported error path
Use SDK-facing layer tests/mocks only at the boundary. Do not mock orchestration business logic in higher-level tests.
### 6.3 Provider service integration tests
Extend provider integration coverage so Claude is exercised through `ProviderService`:
1. start Claude session
2. send turn
3. receive canonical runtime events
4. restart/recover using persisted binding
### 6.4 Orchestration integration tests
Add/extend integration tests around:
1. first-turn provider selection
2. Claude approval requests routed through orchestration
3. Claude runtime ingestion -> messages/activities/session updates
4. checkpoint revert behavior under Claude
5. stopAll/restart recovery
These should validate real orchestration flows, not just adapter behavior.
---
## Phase 7: Rollout order
Recommended implementation order:
1. contracts/provider-aware models
2. provider field on turn-start
3. Claude adapter skeleton + start/send/stream
4. canonical event mapping
5. provider registry/service wiring
6. orchestration recovery + checkpoint strategy
7. web provider/model picker
8. full integration tests
---
## Non-goals
1. Reintroducing provider-specific WS methods/channels.
2. Storing provider-native thread ids as orchestration ids.
3. Bypassing orchestration engine for Claude-specific UI flows.
4. Encoding Claude resume semantics outside adapter-owned `resumeCursor`.
@@ -1,109 +0,0 @@
# Plan: Provider-Neutral Runtime Determinism and Flake Elimination
## Summary
Replace timing-sensitive websocket and orchestration behavior with explicit typed runtime boundaries, ordered push delivery, and server-owned completion receipts. The cutover is broad and single-shot: no compatibility shim, no mixed old/new transport. The design must reduce flakes without baking Codex-specific lifecycle semantics into generic runtime code.
## Implementation Status
All 7 sections are implemented. CI passes (format, lint, typecheck, test, browser test, build). One deferred item remains: the shared `WsTestClient` helper from section 7 — tests use direct transport subscription and receipt-based waits instead.
### New files
| File | Purpose |
|------|---------|
| `packages/shared/src/DrainableWorker.ts` | Queue-based Effect worker with deterministic `drain` signal |
| `packages/shared/src/schemaJson.ts` | Two-phase JSON→Schema decode helpers (`decodeJsonResult`, `formatSchemaError`) |
| `apps/server/src/wsServer/pushBus.ts` | `ServerPushBus` — ordered typed push pipeline with auto-incrementing sequence |
| `apps/server/src/wsServer/readiness.ts` | `ServerReadiness` — Deferred-based barriers for startup sequencing |
| `apps/server/src/orchestration/Services/RuntimeReceiptBus.ts` | Receipt schema union: checkpoint captured, diff finalized, turn quiesced |
| `apps/server/src/orchestration/Layers/RuntimeReceiptBus.ts` | PubSub-backed receipt bus implementation |
| `apps/server/src/watchFileWithStatPolling.ts` | Stat-polling file watcher for containers where `fs.watch` is unreliable |
| `apps/server/vitest.config.ts` | Server-specific test config (timeout bumps) |
| `apps/server/src/wsServer/pushBus.test.ts` | Push bus serialization and welcome-gating tests |
| `packages/shared/src/DrainableWorker.test.ts` | Drainable worker enqueue/drain lifecycle tests |
### Key modifications
| File | Change |
|------|--------|
| `packages/contracts/src/ws.ts` | Channel-indexed `WsPushPayloadByChannel` map, `WsPush` union schema, `WsPushSequence` |
| `apps/server/src/wsServer.ts` | Integrated `ServerPushBus` and `ServerReadiness`; welcome gated on readiness |
| `apps/server/src/keybindings.ts` | Explicit runtime with `start`/`ready`/`snapshot`; dual `fs.watch` + stat-polling watcher |
| `apps/web/src/wsTransport.ts` | Connection state machine (`connecting`→`open`→`reconnecting`→`closed`→`disposed`); two-phase decode at boundary; cached latest push by channel |
| `apps/web/src/wsNativeApi.ts` | Removed decode logic; delegates to pre-validated transport messages |
| `apps/server/src/orchestration/Layers/CheckpointReactor.ts` | Uses `DrainableWorker`; publishes completion receipts |
| `apps/server/src/orchestration/Layers/ProviderCommandReactor.ts` | Uses `DrainableWorker` for command processing |
| `apps/server/src/orchestration/Layers/ProviderRuntimeIngestion.ts` | Uses `DrainableWorker` for event ingestion |
| `apps/server/integration/OrchestrationEngineHarness.integration.ts` | Receipt-based waits replace polling loops |
## Key Changes
### 1. Strengthen the generic boundaries, not the Codex boundary — DONE
- `ProviderRuntimeEvent` remains the canonical provider event contract; `ProviderService` remains the only cross-provider facade.
- Raw Codex payloads and event ordering stay isolated in `CodexAdapter.ts` and `codexAppServerManager.ts`.
- `ProviderKind` was not expanded. The runtime stays provider-neutral by contract.
### 2. Replace loose websocket envelopes with channel-indexed typed pushes — DONE
- `packages/contracts/src/ws.ts` now derives push messages from a `WsPushPayloadByChannel` channel-to-schema map. `WsPush` is a union schema replacing `channel: string` + `data: unknown`.
- Every server push carries `sequence: number`, auto-incremented in `ServerPushBus`.
- `packages/shared/src/schemaJson.ts` provides structured decode diagnostics via `formatSchemaError`.
- `packages/contracts/src/ws.test.ts` covers typed push envelope validation and channel/payload mismatch rejection.
### 3. Introduce explicit server readiness and a single push pipeline — DONE
- `apps/server/src/wsServer/pushBus.ts`: `ServerPushBus` with `publishAll` (broadcast) and `publishClient` (targeted) methods, backed by one ordered path. All pushes flow through it.
- `apps/server/src/wsServer/readiness.ts`: `ServerReadiness` with Deferred-based barriers for HTTP listening, push bus, keybindings, terminal subscriptions, and orchestration subscriptions.
- `server.welcome` is emitted only after connection-scoped and server-scoped readiness is complete.
- `wsServer.ts` no longer publishes directly from ad hoc background streams.
### 4. Turn background watchers into explicit runtimes — DONE
- `apps/server/src/keybindings.ts` refactored as explicit `KeybindingsShape` service with `start`, `ready`, `snapshot` semantics.
- Initial config load, cache warmup, and dual watcher attachment (`fs.watch` + `watchFileWithStatPolling`) complete before `ready` resolves.
- `watchFileWithStatPolling.ts` is the thin adapter for environments where `fs.watch` is unreliable.
### 5. Replace polling-based orchestration waiting with receipts — DONE
- `RuntimeReceiptBus` service defines three receipt types: `CheckpointBaselineCapturedReceipt`, `CheckpointDiffFinalizedReceipt` (with `status: "ready"|"missing"|"error"`), and `TurnProcessingQuiescedReceipt`.
- `CheckpointReactor`, `ProviderCommandReactor`, and `ProviderRuntimeIngestion` use `DrainableWorker` and publish receipts on completion.
- Integration harness and checkpoint tests await receipts instead of polling snapshots and git refs.
### 6. Centralize client transport state and decoding — DONE
- `apps/web/src/wsTransport.ts` implements an explicit connection state machine: `connecting`, `open`, `reconnecting`, `closed`, `disposed`.
- Two-phase decode (JSON parse → Schema validate) happens at the transport boundary. `wsNativeApi.ts` receives pre-validated messages.
- Cached latest welcome/config modeled as explicit `latestPushByChannel` state.
### 7. Replace ad hoc test helpers with semantic test clients — MOSTLY DONE
- `DrainableWorker` replaces timing-sensitive `Effect.sleep` with deterministic `drain()` across reactor tests.
- Orchestration harness waits on receipts/barriers instead of `waitForThread`, `waitForGitRef`, and retry loops.
- Behavioral assertions moved to deterministic unit-style harnesses; narrow integration tests kept for real filesystem/socket behavior.
- **Deferred:** Shared `WsTestClient` helper (connect, awaitSemanticWelcome, awaitTypedPush, trackSequence, matchRpcResponseById). Tests use direct transport subscription instead.
## Provider-Coupling Guardrails
- No generic runtime API may depend on Codex-native event names, thread IDs, or request payload shapes.
- No readiness barrier may be defined as "Codex has emitted X." Readiness is owned by the server runtime, not by provider event order.
- No websocket channel payload may contain raw provider-native payloads unless the channel is explicitly debug/internal.
- Any provider-specific divergence must be exposed through provider capabilities from `ProviderService.getCapabilities()`, not `if provider === "codex"` branches in shared runtime code.
- Generic tests must use canonical `ProviderRuntimeEvent` fixtures. Codex-specific ordering and translation tests stay in adapter/app-server suites only.
- Keep UI/provider-specific knobs such as Codex-only options scoped to provider UX code. Do not pull them into generic transport or orchestration state.
## Test Plan
- Contracts:
- schema tests for typed push envelopes and structured decode diagnostics
- ordering tests for `sequence`
- Server:
- readiness tests proving `server.welcome` cannot precede runtime readiness
- push bus tests proving terminal/config/orchestration pushes are serialized and typed
- keybindings runtime tests with fake watch source plus one real watcher integration test
- Orchestration:
- receipt tests proving checkpoint refs and projections are complete before completion signals resolve
- replacement of polling-based checkpoint/integration waits with receipt-based waits
- Web:
- transport tests for invalid JSON, invalid envelope, invalid payload, reconnect queue flushing, cached semantic state
- Validation gate:
- `bun run lint`
- `bun run typecheck`
- `mise exec -- bun run test`
- repeated full-suite run after cutover to confirm flake removal
## Assumptions and Defaults
- This remains a single-provider product during the cutover, but the runtime contracts must stay provider-neutral.
- No backward-compatibility layer is required for old websocket push envelopes.
- The goal is deterministic runtime behavior first; reducing retries and sleeps in tests is a consequence, not the primary mechanism.
- If a completion signal cannot be expressed provider-neutrally, it does not belong in the shared runtime layer and must stay adapter-local.
@@ -1,74 +0,0 @@
# Branch/Environment Picker in ChatView Input
## Summary
Add a secondary toolbar below the ChatView input area (similar to Codex UI) that lets users select the target branch and environment mode (Local vs New worktree) before sending their first message.
## UX
- A toolbar appears **below** the input form (always visible when it's a git repo)
- Two controls:
1. **Environment mode** (left side): toggles between "Local" and "New worktree" — **locked after first message** (no longer clickable, just shows current mode as label)
2. **Branch picker** (right side): dropdown showing local branches — **always changeable**, even after messages are sent
- If not a git repo, the toolbar is hidden entirely (thread uses project cwd as-is)
## Changes
### 0. Install `@tanstack/react-query` in `apps/renderer`
Add dependency + wrap app in `QueryClientProvider`.
### 1. `apps/renderer/src/store.ts` — MODIFY
Add a new action to the reducer:
```ts
| { type: "SET_THREAD_BRANCH"; threadId: string; branch: string | null; worktreePath: string | null }
```
Reducer case updates `branch` and `worktreePath` on the thread.
### 2. `apps/renderer/src/components/ChatView.tsx` — MODIFY
**Fetch branches** via `useQuery`:
```ts
const branchQuery = useQuery({
queryKey: ["git-branches", activeProject?.cwd],
queryFn: () => api.git.listBranches({ cwd: activeProject!.cwd }),
enabled: !!activeProject,
});
```
**Local state:**
- `envMode: "local" | "worktree"` — environment mode (local component state)
**UI:** Below the `<form>`, render a toolbar bar (hidden if `!branchQuery.data?.isRepo`):
- Left side: env mode button ("Local" / "New worktree") — disabled after first message (locked in)
- Right side: branch dropdown from `branchQuery.data.branches`
- Both styled like existing model picker (small text, chevron, dropdown menus)
**Behavior:**
- Branch picker is always active — changing branch dispatches `SET_THREAD_BRANCH` immediately
- Env mode is only clickable when `activeThread.messages.length === 0`. After first message, it becomes a static label showing the locked-in mode
- On first send (`onSend`): if `envMode === "worktree"` and a branch is selected, call `api.git.createWorktree` before starting the session, then dispatch `SET_THREAD_BRANCH` with the worktreePath
- `ensureSession` already uses `activeThread.worktreePath ?? activeProject.cwd`
### Files to modify
1. `apps/renderer/package.json` — add `@tanstack/react-query`
2. `apps/renderer/src/main.tsx` (or App entry) — wrap in `QueryClientProvider`
3. `apps/renderer/src/store.ts` — add `SET_THREAD_BRANCH` action
4. `apps/renderer/src/components/ChatView.tsx` — branch/env picker UI with `useQuery`
## Verification
1. `turbo build` — compiles
2. Create a new thread → branch bar appears below input with "Local" + current branch
3. Change branch in dropdown → branch updates on thread
4. Toggle "New worktree" → send message → worktree created, session uses worktree cwd
5. After first message: env mode label locks to "Worktree" (not clickable), branch picker still works
6. Non-git project → no branch bar shown
-99
View File
@@ -1,99 +0,0 @@
# Git Flows Integration Tests
## Overview
Real integration tests that run actual git commands against temporary repos. No mocking.
## Step 1: Extract git functions into `apps/desktop/src/git.ts`
The git functions (`listGitBranches`, `createGitWorktree`, `removeGitWorktree`, `createGitBranch`, `checkoutGitBranch`, `initGitRepo`) and their helper `runTerminalCommand` are currently private in `main.ts`. Extract them into a new `apps/desktop/src/git.ts` module with named exports.
`main.ts` will import and re-use them — no behavior change, just moving code.
**Files modified:**
- `apps/desktop/src/git.ts` — new file with all git functions exported
- `apps/desktop/src/main.ts` — import from `./git` instead of defining inline
## Step 2: Create `apps/desktop/src/git.test.ts`
Integration tests using real temp git repos. Each test group creates a fresh temp directory with `git init`, makes commits, creates branches as needed, and cleans up after.
### Setup/teardown pattern
```ts
import { mkdtemp, rm, writeFile } from "node:fs/promises";
import { tmpdir } from "node:os";
import path from "node:path";
import { afterEach, beforeEach, describe, expect, it } from "vitest";
import {
listGitBranches,
createGitBranch,
checkoutGitBranch,
createGitWorktree,
removeGitWorktree,
initGitRepo,
} from "./git";
// Helper: run a raw git command in a dir (for test setup, not under test)
// Helper: create an initial commit (git needs at least one commit for branches)
```
### Test groups
**1. initGitRepo**
- Creates a valid git repo in a temp dir
- listGitBranches reports `isRepo: true` after init
**2. listGitBranches**
- Returns `isRepo: false` for non-git directory
- Returns the current branch with `current: true`
- Sorts current branch first
- Lists multiple branches after creating them
- `isDefault` is false when no remote (no origin/HEAD)
**3. checkoutGitBranch**
- Checks out an existing branch (current flag moves)
- Throws when branch doesn't exist
- Throws when checkout would overwrite uncommitted changes (dirty working tree)
**4. createGitBranch**
- Creates a new branch (appears in listGitBranches)
- Throws when branch already exists
**5. createGitWorktree + removeGitWorktree**
- Creates a worktree directory at the expected path
- Worktree has the correct branch checked out
- Throws when branch is already checked out in another worktree
- removeGitWorktree cleans up the worktree
**6. Full flow: local branch checkout**
- init → commit → create branch → checkout → verify current
**7. Full flow: worktree creation from selected branch**
- init → commit → create branch → create worktree → verify worktree dir exists and has correct branch
**8. Full flow: thread switching simulation**
- init → commit → create branch-a, branch-b → checkout a → checkout b → checkout a → verify current matches
**9. Full flow: checkout conflict**
- init → commit → create branch → modify file (unstaged) → checkout other branch → expect error
## Verification
```bash
# Run the git integration tests
cd apps/desktop && bun run test
# Or just the git test file
npx vitest run apps/desktop/src/git.test.ts
```
-103
View File
@@ -1,103 +0,0 @@
# Git Flows Test Plan
## Overview
Add tests for git branch/worktree flows. Two files:
1. **Extend** `apps/renderer/src/store.test.ts` — reducer tests for `SET_THREAD_BRANCH`
2. **Create** `apps/renderer/src/git-flows.test.ts` — flow logic tests
All tests are pure Vitest unit tests (no React rendering). They test the reducer directly and simulate handler logic via sequential reducer dispatches + mocked API calls.
## File 1: `apps/renderer/src/store.test.ts` (extend)
Add `describe("SET_THREAD_BRANCH reducer")` with 6 tests:
- Sets branch + worktreePath atomically
- Clears both to null
- Updates branch while preserving worktreePath
- Does not affect other threads (multi-thread state)
- No-op for nonexistent thread id
- Does not mutate messages, error, or session fields
Uses existing `makeThread`, `makeState` factories.
## File 2: `apps/renderer/src/git-flows.test.ts` (new)
### Factories
- `makeThread()`, `makeState()`, `makeSession()` — same pattern as store.test.ts
- `makeBranch()` — creates `GitBranch` objects
- `makeMessage()` — creates `ChatMessage` objects
- `makeGitApi()` — returns `{ checkout, createWorktree, createBranch, listBranches }` with `vi.fn()` mocks
### Test groups (~30 tests total)
**1. Local branch checkout flow** (2 tests)
- Successful checkout → SET_THREAD_BRANCH updates branch
- Checkout failure → SET_ERROR, branch unchanged
**2. Thread branch conflict on send** (3 tests)
- Two threads maintain independent branch state after SET_ACTIVE_THREAD
- Branch state preserved through multiple thread switches + updates
- Checkout failure on thread switch sets error only on target thread
**3. Worktree creation on send** (5 tests)
- First message in worktree mode → createWorktree → SET_THREAD_BRANCH with worktreePath
- No worktree when messages already exist
- No worktree in local envMode
- No worktree when worktreePath already set
- createWorktree failure → SET_ERROR, send aborted, no messages pushed
**4. Env mode locking** (4 tests)
- envLocked=false when no messages
- envLocked=true with messages
- Transitions false→true after PUSH_USER_MESSAGE
- Remains true after SET_ERROR and UPDATE_SESSION
**5. Auto-fill current branch** (3 tests)
- Dispatches SET_THREAD_BRANCH when thread has no branch and current branch exists
- Does not overwrite existing branch
- No-op when no branch is marked current
**6. Default branch detection** (2 tests)
- isDefault flag on branch objects
- current and isDefault can be on different branches
**7. Branch creation + checkout** (3 tests)
- Successful create + checkout updates branch
- createBranch failure → error, branch unchanged
- checkout failure after successful create → error, branch unchanged
**8. Session CWD resolution** (3 tests)
- Uses worktreePath when available
- cwdOverride takes precedence over worktreePath
- Falls back to project cwd when no worktree
**9. Error handling patterns** (4 tests)
- SET_ERROR sets error on correct thread
- SET_ERROR with null clears error
- Error on one thread doesn't affect others
- Error cleared before successful branch operations
## Verification
```bash
# Run all renderer tests
cd apps/renderer && bun run test
# Run just the new test file
npx vitest run apps/renderer/src/git-flows.test.ts
# Run just the store tests
npx vitest run apps/renderer/src/store.test.ts
```
@@ -1,115 +0,0 @@
# Git Integration: Branch Picker + Worktrees
## Summary
Add git integration to let users start new threads from a specific branch, optionally creating a git worktree for isolated agent work.
## UX Flow
- **Left click** "+ New thread" → immediately creates a thread (current behavior, unchanged)
- **Right click** "+ New thread" → opens a context menu with git options:
- List of local branches → clicking one creates a thread on that branch (uses project cwd)
- Each branch has a "worktree" sub-option → creates a worktree, then creates thread with worktree as cwd
- When thread has a worktree, the agent session uses the worktree path as its cwd
- If git fails (not a repo), context menu shows "Not a git repository" disabled item
## Changes
### 1. `packages/contracts/src/git.ts` — CREATE
New Zod schemas and types:
- `gitListBranchesInputSchema` — `{ cwd: string }`
- `gitCreateWorktreeInputSchema` — `{ cwd: string, branch: string, path?: string }`
- `gitRemoveWorktreeInputSchema` — `{ cwd: string, path: string }`
- `gitBranchSchema` — `{ name: string, current: boolean }`
- Result types for each
### 2. `packages/contracts/src/ipc.ts` — MODIFY
- Add 3 IPC channels: `git:list-branches`, `git:create-worktree`, `git:remove-worktree`
- Add `git` namespace to `NativeApi` with `listBranches`, `createWorktree`, `removeWorktree`
### 3. `packages/contracts/src/index.ts` — MODIFY
- Add `export * from "./git"`
### 4. `apps/desktop/src/main.ts` — MODIFY
Add 3 IPC handlers + helper functions:
- `listGitBranches()` — runs `git branch --no-color`, parses output into `{ name, current }[]`
- `createGitWorktree()` — runs `git worktree add <path> <branch>`, defaults path to `../{repo}-worktrees/{branch}`
- `removeGitWorktree()` — runs `git worktree remove <path>`
Reuses existing `runTerminalCommand()`.
### 5. `apps/desktop/src/preload.ts` — MODIFY
Add `git` namespace with 3 `ipcRenderer.invoke` calls.
### 6. `apps/renderer/src/types.ts` — MODIFY
Add to `Thread`:
```
branch: string | null
worktreePath: string | null
```
### 7. `apps/renderer/src/persistenceSchema.ts` — MODIFY
- Add optional `branch`/`worktreePath` to persisted thread schema (`.nullable().optional()` for backwards compat)
- Add V3 schema, update union
- Update `hydrateThread` to default new fields to `null`
- Update `toPersistedState` to serialize new fields
### 8. `apps/renderer/src/store.ts` — MODIFY
- Update persisted state key to v3, keep v2 as legacy fallback
### 9. `apps/renderer/src/components/Sidebar.tsx` — MODIFY (main UI work)
- Keep existing left-click `handleNewThread` unchanged (immediate thread creation)
- Add `onContextMenu` handler to "+ New thread" buttons (both global and per-project)
- On right-click: fetch branches via `api.git.listBranches`, show a custom context menu
- Context menu items: branch names, each with a nested option to create with worktree
- Clicking a branch → creates thread with `branch` set, title = branch name
- Clicking "with worktree" → calls `api.git.createWorktree` first, then creates thread with `worktreePath`
- Show branch badge on thread list items
- If not a git repo, show "Not a git repository" as disabled menu item
Context menu component: a positioned `<div>` with `position: fixed` anchored to the click position, dismissed on click-outside or Escape. Follows the existing dropdown pattern from ChatView's model picker.
### 10. `apps/renderer/src/components/ChatView.tsx` — MODIFY
- Line 157: use `activeThread.worktreePath ?? activeProject.cwd` as session cwd
- Show branch/worktree badge in header bar
## Implementation Order
1. `packages/contracts/src/git.ts` (new schemas)
2. `packages/contracts/src/ipc.ts` + `index.ts` (wire up channels)
3. `apps/desktop/src/main.ts` (git command handlers)
4. `apps/desktop/src/preload.ts` (bridge methods)
5. `apps/renderer/src/types.ts` (Thread type update)
6. `apps/renderer/src/persistenceSchema.ts` + `store.ts` (persistence migration)
7. `apps/renderer/src/components/Sidebar.tsx` (branch picker UI)
8. `apps/renderer/src/components/ChatView.tsx` (worktree cwd + badge)
## Edge Cases
- **Not a git repo**: `git branch` fails → context menu shows "Not a git repository" disabled item
- **Branch has slashes**: `feature/foo` → worktree dir becomes `feature-foo`
- **Worktree exists**: git error surfaces to user via inline error message in context menu
- **No persistence breakage**: `.nullable().optional()` fields parse fine with old data
## Verification
1. `turbo build` — confirm contracts/desktop/renderer all compile
2. Launch app, add a project pointing to a git repo
3. Click "+ New thread" → verify branch list loads
4. Select a branch, click Start → thread created with branch in title
5. Enable worktree checkbox, pick branch, Start → verify worktree directory created on disk
6. Send a message in worktree thread → verify agent runs in worktree cwd
7. Add a non-git project → verify graceful error, can still create thread
-252
View File
@@ -1,252 +0,0 @@
# Spec 1:1 Cutover Plan
Goal: Align the orchestration model to `SPEC.md` 1:1 and remove legacy persistence/application cruft.
Execution mode for this plan:
- Hard cutover only. Existing DB and migration history are disposable.
- Intermediate steps are allowed to break runtime, tests, typecheck, and lint.
- We optimize for small, reviewable work units, not continuous app operability.
- Only the final gate requires everything to run cleanly.
## 1. Freeze SPEC contract as source of truth
Work units:
- Create `.plans/spec-contract-matrix.md` with one row per requirement in `SPEC.md` sections `7.1`-`7.4`.
- Add exact SQL-level requirements per row: table, column, type, nullability, PK/unique, index, and invariants.
- Add app-level requirements per row: writer path, reader path, and owning module.
- Mark each row with status labels: `required`, `implemented`, `to-replace`, `delete`.
- Identify any ambiguous spec lines and record a concrete interpretation in the matrix.
Deliverables:
- Complete matrix file with no unclassified rows.
- Single source checklist used by all later steps.
Breakage allowed:
- No code changes required yet.
Exit criteria:
- Every requirement in `7.1`-`7.4` has exactly one matrix row.
## 2. Hard cutover migrations (replace current migration set)
Work units:
- Delete the current legacy migration files and rewrite migration loader ordering.
- Create `001_orchestration_events.ts` with full envelope columns and required event indexes.
- Create `002_orchestration_command_receipts.ts` with PK + lookup indexes.
- Create `003_checkpoint_diff_blobs.ts` with uniqueness on `(thread_id, from_turn_count, to_turn_count)`.
- Create `004_provider_session_runtime.ts` with PK and runtime lookup indexes.
- Create `005_projections.ts` with all projection tables:
- `projection_projects`
- `projection_threads`
- `projection_thread_messages`
- `projection_thread_activities`
- `projection_thread_sessions`
- `projection_thread_turns`
- `projection_checkpoints`
- `projection_pending_approvals`
- `projection_state`
- Add all required indexes/constraints in `005_projections.ts`.
- Ensure old tables (`projects`, `provider_checkpoints`, `provider_sessions`) are not recreated.
Deliverables:
- New 5-file migration chain.
- Updated migration loader references only new migrations.
Breakage allowed:
- Repositories/services can be temporarily broken due to removed old tables.
Exit criteria:
- Fresh DB initializes with only canonical tables plus migration bookkeeping.
## 3. Align persistence row/request schemas to DB 1:1
Work units:
- Define row schemas for each canonical table (contracts or persistence layer module).
- Define request schemas for every insert/update/query operation touching canonical tables.
- Remove or deprecate row/request schemas tied to deleted legacy tables.
- Normalize enum and null semantics to match contracts exactly.
- Ensure SQL aliases map 1:1 to schema field names (no implicit shape transforms).
Deliverables:
- Canonical row/request schemas committed.
- Zero references to legacy row schemas in active code paths.
Breakage allowed:
- Runtime can still fail while query layers are being rewired.
Exit criteria:
- Every canonical table used in code has a typed row schema and typed request schema.
## 4. Rewrite event store for full persisted envelope
Work units:
- Refactor append path to write full envelope fields:
- `event_id`, `aggregate_kind`, `stream_id`, `stream_version`, `event_type`, `occurred_at`, `command_id`, `causation_event_id`, `correlation_id`, `actor_kind`, `payload_json`, `metadata_json`
- Implement stream version assignment/checking per aggregate stream.
- Refactor read/replay path to decode payload and metadata from JSON and return `OrchestrationEvent` consistently.
- Remove assumptions from old minimal schema (`aggregate_id`, missing metadata/actor).
- Add explicit SQL ordering guarantees for replay (`ORDER BY sequence ASC`).
Deliverables:
- Event store append/replay fully aligned with canonical envelope.
Breakage allowed:
- Command dispatch flow can be partially broken until receipts/projectors are updated.
Exit criteria:
- Event store no longer depends on legacy event table shape.
## 5. Add command receipt idempotency
Work units:
- Introduce persistence access layer for `orchestration_command_receipts`.
- In command dispatch flow, check existing receipt by `commandId` before append.
- On first execution, persist accepted receipt with `resultSequence`.
- On domain rejection, persist rejected receipt with error payload.
- On duplicate command, return prior result from receipt without re-appending event.
- Ensure receipt write and event append ordering is deterministic.
Deliverables:
- Dispatch path with idempotency behavior wired through receipts.
Breakage allowed:
- Snapshot/read model may still be inconsistent until projectors are fully wired.
Exit criteria:
- Duplicate command IDs no longer create duplicate events.
## 6. Build DB-backed projection pipeline
Work units:
- Create projector runner that consumes events and applies table-specific projections.
- Implement projector handlers for each projection table.
- For each handler, update target row(s) and `projection_state.last_applied_sequence` in the same transaction.
- Define projector names used in `projection_state` and make them stable constants.
- Add replay bootstrap from event store to bring projections up to latest sequence on startup.
- Add safe resume logic from projector `last_applied_sequence`.
Deliverables:
- Persistent projector pipeline writing all `projection_*` tables.
Breakage allowed:
- Web/API layer may still read old in-memory model until step 7.
Exit criteria:
- Events drive projection rows in DB; projection state advances transactionally.
## 7. Move RPC reads to projections and diff blobs
Work units:
- Implement snapshot query service reading only projection tables.
- Build thread hydration from projection rows: messages, activities, checkpoints, session.
- Compute `snapshotSequence` as the minimum required projector sequence from `projection_state`.
- Implement `getTurnDiff` query backed by `checkpoint_diff_blobs` only.
- Remove or bypass in-memory snapshot construction for RPC responses.
- Validate replay handoff contract: snapshot sequence -> replay from `fromSequenceExclusive`.
Deliverables:
- `orchestration.getSnapshot` and `orchestration.getTurnDiff` served from DB projections/blob store.
Breakage allowed:
- Provider runtime persistence may still be partially legacy until step 8.
Exit criteria:
- No orchestration read RPC depends on legacy tables or in-memory-only state.
## 8. Migrate provider runtime persistence to canonical table
Work units:
- Create repository/service for `provider_session_runtime`.
- Update adapter/session manager to persist runtime/resume cursor in new table.
- Ensure domain-visible session state still flows through orchestration events to `projection_thread_sessions`.
- Remove writes to legacy provider session tables.
- Verify restart/resume path reads runtime state from canonical table only.
Deliverables:
- Provider runtime state entirely backed by `provider_session_runtime`.
Breakage allowed:
- Some legacy interfaces may still exist but should be disconnected.
Exit criteria:
- Runtime restore no longer reads/writes legacy provider session persistence.
## 9. Remove old cruft aggressively
Work units:
- Delete legacy repositories/services that map to removed tables.
- Remove dead migration imports and obsolete persistence service interfaces.
- Remove compatibility code paths that translate legacy row shapes.
- Remove unused contracts/types linked to deprecated persistence model.
- Update internal docs/comments to reference canonical projection/event model only.
Deliverables:
- Legacy persistence and translation layers removed from active codebase.
Breakage allowed:
- Temporary compile failures acceptable while deletion/refactor is in progress.
Exit criteria:
- No production code path references deleted legacy tables/services.
## 10. Final verification gate (first point where green is required)
Work units:
- Add migration tests that assert canonical tables, columns, constraints, and indexes.
- Add event store tests for envelope persistence, metadata, actor kind, and replay.
- Add receipt idempotency tests for accept/reject/duplicate paths.
- Add projector tests for transactional row updates + `projection_state` updates.
- Add snapshot tests verifying projection-sourced output and `snapshotSequence` semantics.
- Add turn diff tests verifying `checkpoint_diff_blobs` source of truth.
- Add provider runtime tests for persist + restart + resume behavior.
- Run project lint/typecheck/tests and fix failures.
Deliverables:
- Green checks with canonical schema + persistence model in place.
Breakage allowed:
- None at end of step.
Exit criteria:
- SPEC `7.1`-`7.4` requirements satisfied and validated by tests.
-433
View File
@@ -1,433 +0,0 @@
# SPEC Contract Matrix (Sections 7.1-7.4)
Status legend:
- `required`: requirement acknowledged, no current implementation claim yet.
- `implemented`: requirement currently satisfied in code + schema.
- `to-replace`: partial/misaligned implementation exists and must be replaced.
- `delete`: current path actively conflicts with SPEC and should be removed.
## 7.1 Write-Side Persisted Tables
### W1
- Spec ref: `7.1.1 orchestration_events`
- Requirement: append-only event store with canonical envelope columns.
- SQL contract:
- `sequence INTEGER PRIMARY KEY` (global monotonic)
- `event_id TEXT UNIQUE NOT NULL`
- `aggregate_kind TEXT NOT NULL CHECK IN ('project','thread')`
- `stream_id TEXT NOT NULL`
- `stream_version INTEGER NOT NULL`
- `event_type TEXT NOT NULL`
- `occurred_at TEXT NOT NULL`
- `command_id TEXT NULL`
- `causation_event_id TEXT NULL`
- `correlation_id TEXT NULL`
- `actor_kind TEXT NOT NULL CHECK IN ('client','server','provider')`
- `payload_json TEXT NOT NULL`
- `metadata_json TEXT NOT NULL`
- Current writer path: `apps/server/src/persistence/Layers/OrchestrationEventStore.ts`
- Current reader path: `apps/server/src/persistence/Layers/OrchestrationEventStore.ts`
- Owner module: `apps/server/src/persistence` (event store + migrations)
- Status: `to-replace`
- Notes: current migration/table lacks `stream_id`, `stream_version`, `causation_event_id`, `correlation_id`, `actor_kind`, `metadata_json`.
### W2
- Spec ref: `7.1.2 orchestration_command_receipts`
- Requirement: command idempotency + ack replay receipts table.
- SQL contract:
- `command_id TEXT PRIMARY KEY`
- `aggregate_kind TEXT NOT NULL CHECK IN ('project','thread')`
- `aggregate_id TEXT NOT NULL`
- `accepted_at TEXT NOT NULL`
- `result_sequence INTEGER NOT NULL`
- `status TEXT NOT NULL CHECK IN ('accepted','rejected')`
- `error TEXT NULL`
- Current writer path: none
- Current reader path: none
- Owner module: `apps/server/src/orchestration` dispatch boundary + `apps/server/src/persistence`
- Status: `to-replace`
- Notes: missing table and missing idempotency flow.
### W3
- Spec ref: `7.1.3 checkpoint_diff_blobs`
- Requirement: store large plaintext diffs separate from checkpoint summaries.
- SQL contract:
- `thread_id TEXT NOT NULL`
- `from_turn_count INTEGER NOT NULL`
- `to_turn_count INTEGER NOT NULL`
- `diff TEXT NOT NULL`
- `created_at TEXT NOT NULL`
- `UNIQUE(thread_id, from_turn_count, to_turn_count)`
- Current writer path: none
- Current reader path: none
- Owner module: `apps/server/src/persistence` + turn diff query service
- Status: `to-replace`
- Notes: no canonical diff blob table yet.
### W4
- Spec ref: `7.1.4 provider_session_runtime`
- Requirement: server-internal provider runtime/resume state.
- SQL contract:
- `provider_session_id TEXT PRIMARY KEY`
- `thread_id TEXT NOT NULL`
- `provider_name TEXT NOT NULL`
- `adapter_key TEXT NOT NULL`
- `provider_thread_id TEXT NULL`
- `status TEXT NOT NULL CHECK IN ('starting','running','stopped','error')`
- `last_seen_at TEXT NOT NULL`
- `resume_cursor_json TEXT NULL`
- `runtime_payload_json TEXT NULL`
- Current writer path: legacy provider session persistence (`apps/server/src/persistence/Layers/ProviderSessions.ts`)
- Current reader path: legacy provider session persistence (`apps/server/src/persistence/Layers/ProviderSessions.ts`)
- Owner module: provider runtime manager + persistence runtime repository
- Status: `to-replace`
- Notes: existing `provider_sessions` schema is incompatible and too small.
## 7.2 Canonical Persisted Event Schema
### E1
- Spec ref: `7.2 OrchestrationPersistedEventSchema`
- Requirement: full typed persisted event envelope in shared contracts.
- SQL contract: envelope fields in W1 must map 1:1 to contracts schema.
- Current writer path: contracts defined in `packages/contracts/src/orchestration.ts`
- Current reader path: used by persistence decode boundaries (partial)
- Owner module: `packages/contracts`
- Status: `implemented`
- Notes: contract schema exists; DB + store mapping still incomplete.
### E2
- Spec ref: `7.2 Rules/payload discriminated by eventType`
- Requirement: `payload` validation keyed by `eventType`.
- SQL contract: `event_type` drives payload decode schema; invalid combinations rejected.
- Current writer path: `packages/contracts/src/orchestration.ts`
- Current reader path: `apps/server/src/persistence/Layers/OrchestrationEventStore.ts` decode path
- Owner module: contracts + event store
- Status: `to-replace`
- Notes: decode is present but DB does not persist full envelope columns.
### E3
- Spec ref: `7.2 Rules/provider ids scope`
- Requirement: provider ids live in metadata/provider payload, not as thread identity replacement.
- SQL contract: provider fields persisted inside `metadata_json`; `stream_id` remains project/thread id.
- Current writer path: `apps/server/src/orchestration/decider.ts` (metadata mostly empty)
- Current reader path: projector/event consumers
- Owner module: decider + provider ingestion + event store
- Status: `to-replace`
- Notes: metadata plumbing is incomplete in persistence path.
### E4
- Spec ref: `7.2 Rules/streamVersion concurrency guard`
- Requirement: stream version monotonic per aggregate stream; enforced on write.
- SQL contract: `stream_version INTEGER NOT NULL` + uniqueness/invariant enforcement per stream.
- Current writer path: none
- Current reader path: none
- Owner module: event store append logic + DB constraints
- Status: `to-replace`
- Notes: no stream version assignment/checking today.
## 7.3 Required Projected Tables (Read Models)
### P1
- Spec ref: `7.3.1 projection_projects`
- Requirement: persisted project projection table.
- SQL contract:
- `project_id TEXT PRIMARY KEY`
- `title TEXT NOT NULL`
- `workspace_root TEXT NOT NULL`
- `default_model TEXT NULL`
- `created_at TEXT NOT NULL`
- `updated_at TEXT NOT NULL`
- `deleted_at TEXT NULL`
- Current writer path: none (in-memory projector only)
- Current reader path: none (snapshot not DB-projected)
- Owner module: projector pipeline + snapshot query
- Status: `to-replace`
- Notes: legacy `projects` table is separate concept and should be removed from orchestration model.
### P2
- Spec ref: `7.3.2 projection_threads`
- Requirement: persisted thread projection table.
- SQL contract:
- `thread_id TEXT PRIMARY KEY`
- `project_id TEXT NOT NULL`
- `title TEXT NOT NULL`
- `model TEXT NOT NULL`
- `branch TEXT NULL`
- `worktree_path TEXT NULL`
- `latest_turn_id TEXT NULL`
- `created_at TEXT NOT NULL`
- `updated_at TEXT NOT NULL`
- `deleted_at TEXT NULL`
- Current writer path: none (in-memory projector only)
- Current reader path: none (snapshot not DB-projected)
- Owner module: projector pipeline + snapshot query
- Status: `to-replace`
- Notes: missing table and projector writes.
### P3
- Spec ref: `7.3.3 projection_thread_messages`
- Requirement: persisted thread message projection table.
- SQL contract:
- `message_id TEXT PRIMARY KEY`
- `thread_id TEXT NOT NULL`
- `turn_id TEXT NULL`
- `role TEXT NOT NULL CHECK IN ('user','assistant','system')`
- `text TEXT NOT NULL`
- `is_streaming INTEGER/BOOLEAN NOT NULL`
- `created_at TEXT NOT NULL`
- `updated_at TEXT NOT NULL`
- Current writer path: none (in-memory projector only)
- Current reader path: none (snapshot not DB-projected)
- Owner module: projector pipeline + snapshot query
- Status: `to-replace`
- Notes: missing table and message projection writes.
### P4
- Spec ref: `7.3.4 projection_thread_activities`
- Requirement: persisted thread activity projection table.
- SQL contract:
- `activity_id TEXT PRIMARY KEY`
- `thread_id TEXT NOT NULL`
- `turn_id TEXT NULL`
- `tone TEXT NOT NULL CHECK IN ('info','tool','approval','error')`
- `kind TEXT NOT NULL`
- `summary TEXT NOT NULL`
- `payload_json TEXT NOT NULL`
- `created_at TEXT NOT NULL`
- Current writer path: none (in-memory projector only)
- Current reader path: none (snapshot not DB-projected)
- Owner module: projector pipeline + snapshot query
- Status: `to-replace`
- Notes: no canonical activity projection persistence.
### P5
- Spec ref: `7.3.5 projection_thread_sessions`
- Requirement: persisted thread session projection table.
- SQL contract:
- `thread_id TEXT PRIMARY KEY`
- `status TEXT NOT NULL CHECK IN ('idle','starting','running','ready','interrupted','stopped','error')`
- `provider_name TEXT NULL`
- `provider_session_id TEXT NULL`
- `provider_thread_id TEXT NULL`
- `active_turn_id TEXT NULL`
- `last_error TEXT NULL`
- `updated_at TEXT NOT NULL`
- Current writer path: none (in-memory projector only)
- Current reader path: none (snapshot not DB-projected)
- Owner module: projector pipeline + snapshot query
- Status: `to-replace`
- Notes: current provider session table is not this domain projection.
### P6
- Spec ref: `7.3.6 projection_thread_turns`
- Requirement: persisted thread turn projection table.
- SQL contract:
- `turn_id TEXT PRIMARY KEY`
- `thread_id TEXT NOT NULL`
- `turn_count INTEGER NOT NULL`
- `status TEXT NOT NULL CHECK IN ('running','completed','interrupted','error')`
- `user_message_id TEXT NULL`
- `assistant_message_id TEXT NULL`
- `started_at TEXT NOT NULL`
- `completed_at TEXT NULL`
- Current writer path: none
- Current reader path: none
- Owner module: projector pipeline + session/turn query helpers
- Status: `to-replace`
- Notes: missing table and projection logic.
### P7
- Spec ref: `7.3.7 projection_checkpoints`
- Requirement: persisted checkpoint summary projection table.
- SQL contract:
- `thread_id TEXT NOT NULL`
- `turn_id TEXT NOT NULL`
- `checkpoint_turn_count INTEGER NOT NULL`
- `checkpoint_ref TEXT NOT NULL`
- `status TEXT NOT NULL CHECK IN ('ready','missing','error')`
- `files_json TEXT NOT NULL`
- `assistant_message_id TEXT NULL`
- `completed_at TEXT NOT NULL`
- `UNIQUE(thread_id, checkpoint_turn_count)`
- Current writer path: legacy `provider_checkpoints` writes in `apps/server/src/persistence/Layers/Checkpoints.ts`
- Current reader path: legacy checkpoint repository
- Owner module: projector pipeline + checkpoint query layer
- Status: `to-replace`
- Notes: current table semantics do not match canonical checkpoint projection schema.
### P8
- Spec ref: `7.3.8 projection_pending_approvals`
- Requirement: persisted pending-approval projection table.
- SQL contract:
- `request_id TEXT PRIMARY KEY`
- `thread_id TEXT NOT NULL`
- `turn_id TEXT NULL`
- `status TEXT NOT NULL CHECK IN ('pending','resolved')`
- `decision TEXT NULL CHECK IN ('accept','acceptForSession','decline','cancel')`
- `created_at TEXT NOT NULL`
- `resolved_at TEXT NULL`
- Current writer path: none
- Current reader path: none
- Owner module: projector pipeline + approval query layer
- Status: `to-replace`
- Notes: missing table and projection logic.
### P9
- Spec ref: `7.3.9 projection_state`
- Requirement: projector progress tracking table.
- SQL contract:
- `projector TEXT PRIMARY KEY`
- `last_applied_sequence INTEGER NOT NULL`
- `updated_at TEXT NOT NULL`
- Current writer path: none
- Current reader path: none
- Owner module: projector runner/checkpointing
- Status: `to-replace`
- Notes: missing table and projector bookkeeping.
### P10
- Spec ref: `7.3 Projection consistency rules`
- Requirement: projector row updates and `projection_state` update must be atomic per event.
- SQL contract: per-projector transaction boundary covering both projection write and state update.
- Current writer path: none (in-memory projector has no SQL transaction)
- Current reader path: none
- Owner module: projector runner
- Status: `to-replace`
- Notes: requires transactional projection executor.
### P11
- Spec ref: `7.3 Optional debug field`
- Requirement: `lastEventSequence` on projection rows is optional and not required for correctness.
- SQL contract: optional; not required in baseline schema.
- Current writer path: none
- Current reader path: none
- Owner module: projector runner
- Status: `required`
- Notes: interpretation: exclude from first cutover unless debugging requires it.
## 7.4 Snapshot and RPC Requirements
### R1
- Spec ref: `7.4.1`
- Requirement: `orchestration.getSnapshot` fully served from projection tables and returns `snapshotSequence`.
- SQL contract: snapshot query joins/reads only `projection_*` + `projection_state`.
- Current writer path: in-memory model built in `apps/server/src/orchestration/projector.ts`
- Current reader path: `apps/server/src/orchestration/Layers/OrchestrationEngine.ts#getReadModel`
- Owner module: snapshot query service + ws RPC handler
- Status: `delete`
- Notes: current in-memory read model path must be removed for SPEC compliance.
### R2
- Spec ref: `7.4.2`
- Requirement: snapshot `projects[]` source is `projection_projects`.
- SQL contract: `projects` collection assembled from `projection_projects` rows.
- Current writer path: none
- Current reader path: in-memory thread/project arrays
- Owner module: snapshot query service
- Status: `to-replace`
- Notes: no DB project projection reader exists yet.
### R3
- Spec ref: `7.4.3`
- Requirement: thread snapshot `checkpoints[]` source is `projection_checkpoints` with required fields.
- SQL contract: fields `turnId`, `completedAt`, `status`, `files[]`, `checkpointRef`, optional `assistantMessageId`, `checkpointTurnCount`.
- Current writer path: legacy checkpoint repo data model
- Current reader path: in-memory checkpoints from orchestration events
- Owner module: snapshot query service + checkpoint projector
- Status: `to-replace`
- Notes: canonical projection table and reader not implemented.
### R4
- Spec ref: `7.4.4`
- Requirement: no `listCheckpoints` orchestration RPC; list in snapshot + full diff via `getTurnDiff` from diff blobs.
- SQL contract: `getTurnDiff` reads `checkpoint_diff_blobs` only.
- Current writer path: none for diff blobs
- Current reader path: `orchestration.getTurnDiff` schema exists, data backing incomplete
- Owner module: ws RPC handler + diff query service
- Status: `to-replace`
- Notes: current checkpoint repository is not canonical source.
### R5
- Spec ref: `7.4.5`
- Requirement: client acts on `ThreadId`; server resolves provider session via `projection_thread_sessions`.
- SQL contract: session lookup by `thread_id` from projection table.
- Current writer path: mixed provider/session handling paths
- Current reader path: legacy provider session persistence lookups
- Owner module: provider dispatch/session resolution
- Status: `to-replace`
- Notes: remove provider-session-as-routing-key behavior.
### R6
- Spec ref: `7.4.6`
- Requirement: `snapshotSequence` derived from `projection_state` minimum over dependent projectors.
- SQL contract: `MIN(last_applied_sequence)` across required projector keys.
- Current writer path: none
- Current reader path: currently from in-memory event projection sequence
- Owner module: snapshot query service
- Status: `to-replace`
- Notes: must move from in-memory sequence to DB projection-state semantics.
### R7
- Spec ref: `7.4.7`
- Requirement: snapshot/replay handoff has no gap (`getSnapshot` -> subscribe from snapshot sequence).
- SQL contract: read consistency strategy guaranteeing no missing events between snapshot visibility and replay start.
- Current writer path: event stream via `OrchestrationEventStore.readFromSequence`
- Current reader path: ws replay flow in `apps/server/src/wsServer.ts`
- Owner module: ws RPC + event stream handoff layer
- Status: `to-replace`
- Notes: interpretation requires explicit consistency boundary (transaction, sequence fence, or equivalent).
## Ambiguous/Interpretation Decisions (tracked upfront)
### A1
- Topic: `orchestration_events.stream_id` vs event runtime `aggregateId` naming.
- Decision: persist canonical DB column name `stream_id`; map to runtime `aggregateId` where needed in decider/projector code.
### A2
- Topic: JSON column typing in SQLite for `payload`, `metadata`, projection payload/files, runtime cursor/payload.
- Decision: store as `TEXT` JSON with strict encode/decode schemas at boundaries.
### A3
- Topic: `snapshotSequence` dependency set for min-sequence computation.
- Decision: include all projectors used to construct snapshot payload (`projects`, `threads`, `messages`, `activities`, `sessions`, `turns`, `checkpoints`, `pending_approvals`).
### A4
- Topic: no-gap handoff mechanism in `7.4.7`.
- Decision: implement explicit sequence fence semantics at snapshot time; replay starts from fence `fromSequenceExclusive`.
## Checklist Completeness Statement
- Coverage scope: `SPEC.md` sections `7.1`, `7.2`, `7.3`, `7.4`.
- Requirement rows present: `W1-W4`, `E1-E4`, `P1-P11`, `R1-R7`.
- Unclassified rows: `0`.
+1 -2
View File
@@ -4,6 +4,5 @@
"editor.codeActionsOnSave": {
"source.fixAll.oxc": "always"
},
"oxc.unusedDisableDirectives": "warn",
"typescript.tsdk": "node_modules/typescript/lib"
"oxc.unusedDisableDirectives": "warn"
}
+11 -19
View File
@@ -1,13 +1,8 @@
# AGENTS.md
## Task Completion Requirements
- All of `bun fmt`, `bun lint`, and `bun typecheck` must pass before considering tasks completed.
- NEVER run `bun test`. Always use `bun run test` (runs Vitest).
## Project Snapshot
T3 Code is a minimal web GUI for using coding agents like Codex and Claude.
CodeThing is a minimal GUI for using code agents like Codex and Claude Code (coming soon).
This repository is a VERY EARLY WIP. Proposing sweeping changes that improve long-term maintainability is encouraged.
@@ -19,27 +14,24 @@ This repository is a VERY EARLY WIP. Proposing sweeping changes that improve lon
If a tradeoff is required, choose correctness and robustness over short-term convenience.
## Maintainability
Long term maintainability is a core priority. If you add new functionality, first check if there is shared logic that can be extracted to a separate module. Duplicate logic across multiple files is a code smell and should be avoided. Don't be afraid to change existing code. Don't take shortcuts by just adding local logic to solve a problem.
## Package Roles
- `apps/server`: Node.js WebSocket server. Wraps Codex app-server (JSON-RPC over stdio), serves the React web app, and manages provider sessions.
- `apps/web`: React/Vite UI. Owns session UX, conversation/event rendering, and client-side state. Connects to the server via WebSocket.
- `packages/contracts`: Shared effect/Schema schemas and TypeScript contracts for provider events, WebSocket protocol, and model/session types. Keep this package schema-only — no runtime logic.
- `packages/shared`: Shared runtime utilities consumed by both server and web. Uses explicit subpath exports (e.g. `@t3tools/shared/git`) — no barrel index.
- `apps/t3`: Node CLI/runtime. Owns WebSocket server lifecycle, browser launch, and RPC routing.
- `apps/renderer`: React/Vite UI. Owns session UX, conversation/event rendering, and client-side state.
- `packages/contracts`: Shared Zod schemas and TypeScript contracts for provider events, WebSocket payloads, and model/session types.
- `packages/runtime-core`: Shared Node runtime services (`ProcessManager`, `TodoStore`, `ProviderManager`, `CodexAppServerManager`) used by `apps/t3`.
- Legacy desktop runtime wrapper package has been removed; `runtime-core` is the canonical runtime service source.
- Legacy desktop runtime wrapper package has been removed; `runtime-core` is the canonical runtime service source.
## Codex App Server (Important)
T3 Code is currently Codex-first. The server starts `codex app-server` (JSON-RPC over stdio) per provider session, then streams structured events to the browser through WebSocket push messages.
CodeThing is currently Codex-first. The `t3` runtime starts `codex app-server` (JSON-RPC over stdio) per provider session, then streams structured events into the renderer through the provider APIs.
How we use it in this codebase:
- Session startup/resume and turn lifecycle are brokered in `apps/server/src/codexAppServerManager.ts`.
- Provider dispatch and thread event logging are coordinated in `apps/server/src/providerManager.ts`.
- WebSocket server routes NativeApi methods in `apps/server/src/wsServer.ts`.
- Web app consumes orchestration domain events via WebSocket push on channel `orchestration.domainEvent` (provider runtime activity is projected into orchestration events server-side).
- Session startup/resume and turn lifecycle are brokered in `packages/runtime-core/src/codexAppServerManager.ts`.
- Provider dispatch and thread event logging are coordinated in `packages/runtime-core/src/providerManager.ts`.
- Renderer consumes provider event streams via `nativeApi.providers.onEvent`.
Docs:
+1 -1
View File
@@ -1 +1 @@
AGENTS.md
AGENTS.md
-65
View File
@@ -1,65 +0,0 @@
# Contributing
## Read This First
We are not actively accepting contributions right now.
You can still open an issue or PR, but please do so knowing there is a high chance we close it, defer it forever, or never look at it.
If that sounds annoying, that is because it is. This project is still early and we are trying to keep scope, quality, and direction under control.
PRs are automatically labeled with a `vouch:*` trust status and a `size:*` diff size based on changed lines.
If you are an external contributor, expect `vouch:unvouched` until we explicitly add you to [.github/VOUCHED.td](.github/VOUCHED.td).
## What We Are Most Likely To Accept
Small, focused bug fixes.
Small reliability fixes.
Small performance improvements.
Tightly scoped maintenance work that clearly improves the project without changing its direction.
## What We Are Least Likely To Accept
Large PRs.
Drive-by feature work.
Opinionated rewrites.
Anything that expands product scope without us asking for it first.
If you open a 1,000+ line PR full of new features, we will probably close it quickly and remember that you ignored the clearly written instructions.
## If You Still Want To Open A PR
Keep it small.
Explain exactly what changed.
Explain exactly why the change should exist.
Do not mix unrelated fixes together.
If the PR makes anything resembling a UI change, include clear before/after images.
If the change depends on motion, timing, transitions, or interaction details, include a short video.
If we have to guess what changed, we are much less likely to review it.
## Issues First
If you are thinking about a non-trivial change, open an issue first.
That still does not mean we will want the PR, but it gives you a chance to avoid wasting your time.
## Be Realistic
Opening a PR does not create an obligation on our side.
We may close it. We may ignore it. We may ask you to shrink it. We may reimplement the idea ourselves later.
If you are fine with that, proceed.
-101
View File
@@ -1,101 +0,0 @@
# Keybindings
T3 Code reads keybindings from:
- `~/.t3/keybindings.json`
The file must be a JSON array of rules:
```json
[
{ "key": "mod+g", "command": "terminal.toggle" },
{ "key": "mod+shift+g", "command": "terminal.new", "when": "terminalFocus" }
]
```
See the full schema for more details: [`packages/contracts/src/keybindings.ts`](packages/contracts/src/keybindings.ts)
## Defaults
```json
[
{ "key": "mod+j", "command": "terminal.toggle" },
{ "key": "mod+d", "command": "terminal.split", "when": "terminalFocus" },
{ "key": "mod+n", "command": "terminal.new", "when": "terminalFocus" },
{ "key": "mod+w", "command": "terminal.close", "when": "terminalFocus" },
{ "key": "mod+n", "command": "chat.new", "when": "!terminalFocus" },
{ "key": "mod+shift+o", "command": "chat.new", "when": "!terminalFocus" },
{ "key": "mod+shift+n", "command": "chat.newLocal", "when": "!terminalFocus" },
{ "key": "mod+o", "command": "editor.openFavorite" }
]
```
For most up to date defaults, see [`DEFAULT_KEYBINDINGS` in `apps/server/src/keybindings.ts`](apps/server/src/keybindings.ts)
## Configuration
### Rule Shape
Each entry supports:
- `key` (required): shortcut string, like `mod+j`, `ctrl+k`, `cmd+shift+d`
- `command` (required): action ID
- `when` (optional): boolean expression controlling when the shortcut is active
Invalid rules are ignored. Invalid config files are ignored. Warnings are logged by the server.
### Available Commands
- `terminal.toggle`: open/close terminal drawer
- `terminal.split`: split terminal (in focused terminal context by default)
- `terminal.new`: create new terminal (in focused terminal context by default)
- `terminal.close`: close/kill the focused terminal (in focused terminal context by default)
- `chat.new`: create a new chat thread preserving the active thread's branch/worktree state
- `chat.newLocal`: create a new chat thread for the active project in a new environment (local/worktree determined by app settings (default `local`))
- `editor.openFavorite`: open current project/worktree in the last-used editor
- `script.{id}.run`: run a project script by id (for example `script.test.run`)
### Key Syntax
Supported modifiers:
- `mod` (`cmd` on macOS, `ctrl` on non-macOS)
- `cmd` / `meta`
- `ctrl` / `control`
- `shift`
- `alt` / `option`
Examples:
- `mod+j`
- `mod+shift+d`
- `ctrl+l`
- `cmd+k`
### `when` Conditions
Currently available context keys:
- `terminalFocus`
- `terminalOpen`
Supported operators:
- `!` (not)
- `&&` (and)
- `||` (or)
- parentheses: `(` `)`
Examples:
- `"when": "terminalFocus"`
- `"when": "terminalOpen && !terminalFocus"`
- `"when": "terminalFocus || terminalOpen"`
Unknown condition keys evaluate to `false`.
### Precedence
- Rules are evaluated in array order.
- For a key event, the last rule where both `key` matches and `when` evaluates to `true` wins.
- That means precedence is across commands, not only within the same command.
-21
View File
@@ -1,21 +0,0 @@
MIT License
Copyright (c) 2026 T3 Tools Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+141 -13
View File
@@ -1,28 +1,156 @@
# T3 Code
# CodeThing (`t3`: Node + WebSocket + Browser)
T3 Code is a minimal web GUI for coding agents (currently Codex and Claude, more coming soon).
CodeThing now runs as a local Node.js runtime that serves a browser UI and exposes a local WebSocket API.
## How to use
Current implementation is:
> [!WARNING]
> You need to have [Codex CLI](https://github.com/openai/codex) installed and authorized for T3 Code to work.
1. Codex-first: connects to `codex app-server` and streams turn/item events.
2. Provider-ready: renderer speaks a provider abstraction so Claude Code can plug in later.
3. Typed end-to-end: contracts validate payloads across the WebSocket boundary.
## Quickstart
```bash
npx t3
```
You can also just install the desktop app. It's cooler.
On launch, `t3`:
Install the [desktop app from the Releases page](https://github.com/pingdotgg/t3code/releases)
1. starts a local WebSocket runtime (`127.0.0.1`),
2. serves the web UI in your browser,
3. auto-connects to your current working directory as the default project.
## Some notes
CLI flags:
We are very very early in this project. Expect bugs.
- `--no-open[=bool]` — disable browser auto-open (supports `true/false`, `1/0`, `yes/no`, `on/off` in equals form).
- `-o, --open[=bool]` — force browser auto-open (supports `true/false`, `1/0`, `yes/no`, `on/off` in equals form; overrides `T3_NO_OPEN`).
- `--backend-port <port>` — set WebSocket runtime port.
- `--web-port <port>` — set web UI port.
- `--cwd <path>` — choose launch project directory (defaults to current directory).
- `<path>` — shorthand positional argument equivalent to `--cwd <path>`.
- `-- <path>` — treat following argument as path even if it starts with `-`.
- `--version` — print CLI version.
- `--help` — print CLI usage.
We are not accepting contributions yet.
`--cwd` (or positional path) must be a non-empty value pointing to an existing directory; startup fails fast with a clear error otherwise.
Port values must be decimal integers in the range `1..65535`.
## If you REALLY want to contribute still.... read this first
If default ports are busy, `t3` will automatically retry with the next available port pair unless ports are explicitly pinned via CLI flags or environment variables.
Read [CONTRIBUTING.md](./CONTRIBUTING.md) before opening an issue or PR.
Optional environment variables:
Need support? Join the [Discord](https://discord.gg/jn4EGJjrvv).
- `T3_NO_OPEN=1` — start runtime without auto-opening a browser window (parses `true/false`, `1/0`, `yes/no`, `on/off`).
- `T3_BACKEND_PORT` — override local WebSocket runtime port (default `4317`).
- `T3_WEB_PORT` — override local web UI port (default `4318`).
Runtime command semantics:
- `terminal.run` executes in the launch directory when `cwd` is omitted.
- Relative `cwd` values for `terminal.run` and `shell.openInEditor` resolve from the launch directory.
- `terminal.run` and `shell.openInEditor` reject empty/whitespace, missing, or non-directory cwd targets with structured request errors.
## Workspace layout
- `/apps/t3`: CLI launcher + local WebSocket runtime server.
- `/apps/renderer`: React + Vite UI for session control, conversation, and protocol event stream.
- `/packages/contracts`: shared Zod schemas + TypeScript types for WS protocol, provider events, and API contracts.
- `/packages/runtime-core`: shared Node runtime services (`ProcessManager`, `TodoStore`, `ProviderManager`, `CodexAppServerManager`) consumed by `apps/t3`.
- Legacy desktop runtime wrapper package has been removed; `runtime-core` is now the sole source of runtime service implementations.
## Codex prerequisites
- Install Codex CLI so `codex` is on your PATH.
- Authenticate Codex before running CodeThing (for example via API key or ChatGPT auth supported by Codex).
- CodeThing starts the server via `codex app-server` per session.
- Note: test suites use an in-process fake `codex app-server` shim, so CI/local tests do not require the real Codex CLI.
## Runtime boundary model
- `t3` starts a localhost-only WebSocket server.
- Launch URLs include an ephemeral WebSocket token so only the opened browser session can attach.
- Connections missing the token (or using a wrong token) are rejected by the runtime.
- Connections with duplicate token query parameters are also rejected (even when duplicate values match) to avoid ambiguous auth parsing.
- Runtime auth token lookup is strict on the lowercase `token` query key; alternate key casing is rejected.
- Connections with unexpected query parameters are rejected (auth mode requires only `token`; no-auth mode allows no query params).
- WebSocket control connections are accepted only on the root runtime path (`/`) to keep the API surface narrow.
- Unauthorized websocket attempts close with code `4001` and reason `unauthorized`.
- Browser renderer talks through a typed `NativeApi` adapter over that WebSocket.
- Runtime currently enforces a single active browser client (new client replaces old one).
- When replaced by a newer connection, the previous active websocket is closed with code `4000`.
- Replacement closes use reason string `replaced-by-new-client` for deterministic client handling.
- Renderer websocket connection errors now preserve close metadata (`code`/`reason`) to improve reconnect diagnostics.
- Renderer normalizes close metadata before diagnostics (e.g. trims close reasons and ignores malformed close codes) for cleaner error messages.
- Renderer decodes websocket message payloads from strings, `ArrayBuffer`, `ArrayBufferView` (e.g. `Uint8Array`/`DataView`), and `Blob`.
- Renderer validates provider/agent event payload shapes before dispatch, ignoring malformed event payloads to keep client state stable.
- Renderer validates critical RPC success payload shapes (`app.health`, `app.bootstrap`, `providers.listSessions`, `dialogs.pickFolder`, plus terminal/todo/provider/agent control flows) and fails fast on malformed responses.
- In-flight renderer requests now surface unauthorized/replacement disconnect causes explicitly.
- Renderer also fails in-flight requests immediately on websocket `error` events (without waiting for close) for faster feedback.
- After reconnect, renderer ignores stale events from prior sockets (including provider and agent streams) to avoid cross-connection state corruption.
- Initial websocket connect failures now include detailed diagnostics from socket/open and constructor failures (including nested/string/cause-chain payload messages, with bounded-depth fallback for malformed/cyclic payloads).
- Subsequent requests automatically reconnect after close/error disconnects, including idle (no pending request) error scenarios.
- Renderer now proactively resets the websocket after request send failures, rejects any in-flight requests, and reconnects cleanly on later requests.
- Send-failure request errors now include non-Error payload details when available (for clearer diagnostics).
- Runtime validates request payloads with shared Zod contracts.
- Websocket RPC method names are centralized in shared contracts (`WS_NATIVE_API_METHODS`), and runtime dispatch validates method strings against that shared list.
- Runtime tests now assert that every declared websocket method is wired through the server dispatch path (preventing contract/runtime drift).
- Runtime and renderer both validate critical success payloads with shared contracts to prevent malformed envelope data from entering app state.
- Core transport schemas (provider/agent/todo/terminal/app payloads) are strict objects, so unexpected fields are rejected at the contract boundary.
- Runtime successful responses always include `result` (using `null` for void methods) to keep websocket envelopes schema-safe.
- Websocket event envelopes are channel-typed (`provider:event`, `agent:output`, `agent:exit`) and validated against shared payload schemas.
- Websocket protocol envelopes are strict (unexpected top-level fields are rejected) to keep RPC/event parsing deterministic.
- Websocket request envelope guards also cap request id/method lengths (currently 256 chars each); over-limit requests are treated as malformed and ignored.
- Runtime error envelopes are bounded (`code`/`message` max lengths) and oversized error text is normalized before sending to avoid protocol-invalid responses.
- Blank/whitespace-only websocket ids, methods, and error fields are rejected at schema boundaries.
- Codex execution sandbox policy (`read-only`, `workspace-write`, `danger-full-access`) is still selected per session startup options.
- Static HTML responses are served with `Cache-Control: no-store`; built `/assets/*` files are served with long-lived immutable cache headers.
- Static file success responses include `Accept-Ranges: bytes`, `Vary: Range`, deterministic `ETag` and `Last-Modified` validators, plus hardened browser headers (`X-Content-Type-Options`, `X-Frame-Options`, `Referrer-Policy`, `Cross-Origin-Resource-Policy`, `Cross-Origin-Opener-Policy`).
- Static files support single-range byte requests (`Range: bytes=...`) with standards-compliant `206` / `416` behavior.
- Static range parsing tolerates optional separator whitespace (e.g. `Range: bytes = 0 - 1023`).
- Oversized suffix ranges are normalized to full-file spans (for example `bytes=-999999` on small assets).
- Static non-range requests support `If-None-Match` and `If-Modified-Since` conditional caching via `304 Not Modified`.
- Static range requests support `If-Range` semantics (matched validator keeps `206`; mismatched validator falls back to full `200` response).
- `If-None-Match` / `If-Modified-Since` preconditions are evaluated before range handling, so satisfied validators return `304` even when a `Range` header is present.
- Static precondition headers `If-Match` and `If-Unmodified-Since` are enforced with `412 Precondition Failed` semantics.
- Failed `If-Match` checks take precedence over cache validators (e.g. matching `If-None-Match` still results in `412` if `If-Match` fails).
- Failed `If-Unmodified-Since` checks also return `412` before cache-based `304` handling.
- Wildcard validators are supported where applicable (`If-None-Match: *`, `If-Match: *`).
- Strong/weak validator semantics follow HTTP rules: weak ETags participate in `If-None-Match` weak comparison, but are rejected for strong-only checks (`If-Match`, `If-Range`).
- `412` static precondition responses include validator headers (`ETag`, `Last-Modified`) and range capability metadata (`Accept-Ranges`, `Vary: Range`).
- `416` unsatisfiable-range responses include both range metadata and validators (`Content-Range`, `Accept-Ranges`, `Vary: Range`, `ETag`, `Last-Modified`).
## Runtime modes
CodeThing has a global runtime mode switch in the sidebar:
- `Full access` (default): starts new sessions with `approvalPolicy: never` and `sandboxMode: danger-full-access`.
- `Approval required`: starts new sessions with `approvalPolicy: on-request` and `sandboxMode: workspace-write`, then prompts in-app for command/file approvals.
Mode changes apply across all threads. Existing live sessions are restarted so old and new threads use the selected mode.
## Scripts
- `bun run dev`: builds contracts, starts `t3` runtime, opens browser UI.
- `bun run build`: builds contracts, renderer static assets, and `t3` CLI bundle.
- `bun run typecheck`: strict TypeScript checks for all packages.
- `bun run test`: runs workspace tests.
- `bun run smoke-test`: runs end-to-end CLI/WebSocket smoke coverage (against the fake Codex app-server shim).
- `bun run --cwd apps/t3 dev`: run the CLI directly in dev mode.
## Provider architecture
The renderer depends on `nativeApi.providers.*`:
1. `startSession`
2. `sendTurn`
3. `interruptTurn`
4. `respondToRequest`
5. `stopSession`
6. `listSessions`
7. `onEvent`
Codex is the only implemented provider right now. `claudeCode` is reserved in contracts/UI but currently returns a not-implemented runtime error.
Runtime app utilities exposed via `nativeApi.app.*`:
1. `bootstrap`
2. `health`
-65
View File
@@ -1,65 +0,0 @@
# Remote Access Setup
Use this when you want to open T3 Code from another device (phone, tablet, another laptop).
## CLI ↔ Env option map
The T3 Code CLI accepts the following configuration options, available either as CLI flags or environment variables:
| CLI flag | Env var | Notes |
| ----------------------- | --------------------- | ---------------------------------- |
| `--mode <web\|desktop>` | `T3CODE_MODE` | Runtime mode. |
| `--port <number>` | `T3CODE_PORT` | HTTP/WebSocket port. |
| `--host <address>` | `T3CODE_HOST` | Bind interface/address. |
| `--state-dir <path>` | `T3CODE_STATE_DIR` | State directory. |
| `--dev-url <url>` | `VITE_DEV_SERVER_URL` | Dev web URL redirect/proxy target. |
| `--no-browser` | `T3CODE_NO_BROWSER` | Disable auto-open browser. |
| `--auth-token <token>` | `T3CODE_AUTH_TOKEN` | WebSocket auth token. |
> TIP: Use the `--help` flag to see all available options and their descriptions.
## Security First
- Always set `--auth-token` before exposing the server outside localhost.
- Treat the token like a password.
- Prefer binding to trusted interfaces (LAN IP or Tailnet IP) instead of opening all interfaces unless needed.
## 1) Build + run server for remote access
Remote access should use the built web app (not local Vite redirect mode).
```bash
bun run build
TOKEN="$(openssl rand -hex 24)"
bun run --cwd apps/server start -- --host 0.0.0.0 --port 3773 --auth-token "$TOKEN" --no-browser
```
Then open on your phone:
`http://<your-machine-ip>:3773`
Example:
`http://192.168.1.42:3773`
Notes:
- `--host 0.0.0.0` listens on all IPv4 interfaces.
- `--no-browser` prevents local auto-open, which is usually better for headless/remote sessions.
- Ensure your OS firewall allows inbound TCP on the selected port.
## 2) Tailnet / Tailscale access
If you use Tailscale, you can bind directly to your Tailnet address.
```bash
TAILNET_IP="$(tailscale ip -4)"
TOKEN="$(openssl rand -hex 24)"
bun run --cwd apps/server start -- --host "$(tailscale ip -4)" --port 3773 --auth-token "$TOKEN" --no-browser
```
Open from any device in your tailnet:
`http://<tailnet-ip>:3773`
You can also bind `--host 0.0.0.0` and connect through the Tailnet IP, but binding directly to the Tailnet IP limits exposure.
+7 -8
View File
@@ -1,13 +1,12 @@
# TODO
## TODO
## Small things
- [ ] Submitting new messages should scroll to bottom
- [ ] 1 click copy in codeblocks
- [ ] Pasting/adding images to submit with prompts
- [ ] Only show last 10 threads for a given project
- [ ] Thread archiving
- [ ] Selecting folder should instantly create project
- [ ] New projects should go on top
- [ ] Projects should be sorted by latest thread update
## Bigger things
- [ ] Queueing messages
- [ ] "Response" bar should ONLY appear on work completed
- [ ] "Response" bar should ONLY appear above the FINAL message in a series
- [ ] Reduce noise of tool calls (combine "command run" and "command completed", make tool calls a "box" with limited # of calls shown at a time, etc)
-2
View File
@@ -1,2 +0,0 @@
dist-electron/
.electron-runtime/
-31
View File
@@ -1,31 +0,0 @@
{
"name": "@t3tools/desktop",
"version": "0.0.10",
"private": true,
"main": "dist-electron/main.js",
"scripts": {
"dev": "bun run --parallel dev:bundle dev:electron",
"dev:bundle": "tsdown --watch",
"dev:electron": "bun run scripts/dev-electron.mjs",
"build": "tsdown",
"start": "bun run scripts/start-electron.mjs",
"typecheck": "tsc --noEmit",
"test": "vitest run --passWithNoTests",
"smoke-test": "node scripts/smoke-test.mjs"
},
"dependencies": {
"effect": "catalog:",
"electron": "40.6.0",
"electron-updater": "^6.6.2"
},
"devDependencies": {
"@t3tools/contracts": "workspace:*",
"@t3tools/shared": "workspace:*",
"@types/node": "catalog:",
"tsdown": "catalog:",
"typescript": "catalog:",
"vitest": "catalog:",
"wait-on": "^8.0.2"
},
"productName": "T3 Code (Alpha)"
}
Binary file not shown.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 279 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 313 KiB

-216
View File
@@ -1,216 +0,0 @@
import { spawn, spawnSync } from "node:child_process";
import { watch } from "node:fs";
import { join } from "node:path";
import waitOn from "wait-on";
import { desktopDir, resolveElectronPath } from "./electron-launcher.mjs";
const port = Number(process.env.ELECTRON_RENDERER_PORT ?? 5733);
const devServerUrl = `http://localhost:${port}`;
const requiredFiles = [
"dist-electron/main.js",
"dist-electron/preload.js",
"../server/dist/index.mjs",
];
const watchedDirectories = [
{ directory: "dist-electron", files: new Set(["main.js", "preload.js"]) },
{ directory: "../server/dist", files: new Set(["index.mjs"]) },
];
const forcedShutdownTimeoutMs = 1_500;
const restartDebounceMs = 120;
const childTreeGracePeriodMs = 1_200;
await waitOn({
resources: [`tcp:${port}`, ...requiredFiles.map((filePath) => `file:${filePath}`)],
});
const childEnv = { ...process.env };
delete childEnv.ELECTRON_RUN_AS_NODE;
let shuttingDown = false;
let restartTimer = null;
let currentApp = null;
let restartQueue = Promise.resolve();
const expectedExits = new WeakSet();
const watchers = [];
function killChildTreeByPid(pid, signal) {
if (process.platform === "win32" || typeof pid !== "number") {
return;
}
spawnSync("pkill", [`-${signal}`, "-P", String(pid)], { stdio: "ignore" });
}
function cleanupStaleDevApps() {
if (process.platform === "win32") {
return;
}
spawnSync("pkill", ["-f", "--", `--t3code-dev-root=${desktopDir}`], { stdio: "ignore" });
}
function startApp() {
if (shuttingDown || currentApp !== null) {
return;
}
const app = spawn(
resolveElectronPath(),
[`--t3code-dev-root=${desktopDir}`, "dist-electron/main.js"],
{
cwd: desktopDir,
env: {
...childEnv,
VITE_DEV_SERVER_URL: devServerUrl,
},
stdio: "inherit",
},
);
currentApp = app;
app.once("error", () => {
if (currentApp === app) {
currentApp = null;
}
if (!shuttingDown) {
scheduleRestart();
}
});
app.once("exit", (code, signal) => {
if (currentApp === app) {
currentApp = null;
}
const exitedAbnormally = signal !== null || code !== 0;
if (!shuttingDown && !expectedExits.has(app) && exitedAbnormally) {
scheduleRestart();
}
});
}
async function stopApp() {
const app = currentApp;
if (!app) {
return;
}
currentApp = null;
expectedExits.add(app);
await new Promise((resolve) => {
let settled = false;
const finish = () => {
if (settled) {
return;
}
settled = true;
resolve();
};
app.once("exit", finish);
app.kill("SIGTERM");
killChildTreeByPid(app.pid, "TERM");
setTimeout(() => {
if (settled) {
return;
}
app.kill("SIGKILL");
killChildTreeByPid(app.pid, "KILL");
finish();
}, forcedShutdownTimeoutMs).unref();
});
}
function scheduleRestart() {
if (shuttingDown) {
return;
}
if (restartTimer) {
clearTimeout(restartTimer);
}
restartTimer = setTimeout(() => {
restartTimer = null;
restartQueue = restartQueue
.catch(() => undefined)
.then(async () => {
await stopApp();
if (!shuttingDown) {
startApp();
}
});
}, restartDebounceMs);
}
function startWatchers() {
for (const { directory, files } of watchedDirectories) {
const watcher = watch(
join(desktopDir, directory),
{ persistent: true },
(_eventType, filename) => {
if (typeof filename !== "string" || !files.has(filename)) {
return;
}
scheduleRestart();
},
);
watchers.push(watcher);
}
}
function killChildTree(signal) {
if (process.platform === "win32") {
return;
}
// Kill direct children as a final fallback in case normal shutdown leaves stragglers.
spawnSync("pkill", [`-${signal}`, "-P", String(process.pid)], { stdio: "ignore" });
}
async function shutdown(exitCode) {
if (shuttingDown) return;
shuttingDown = true;
if (restartTimer) {
clearTimeout(restartTimer);
restartTimer = null;
}
for (const watcher of watchers) {
watcher.close();
}
await stopApp();
killChildTree("TERM");
await new Promise((resolve) => {
setTimeout(resolve, childTreeGracePeriodMs);
});
killChildTree("KILL");
process.exit(exitCode);
}
startWatchers();
cleanupStaleDevApps();
startApp();
process.once("SIGINT", () => {
void shutdown(130);
});
process.once("SIGTERM", () => {
void shutdown(143);
});
process.once("SIGHUP", () => {
void shutdown(129);
});
-144
View File
@@ -1,144 +0,0 @@
// This file mostly exists because we want dev mode to say "T3 Code (Dev)" instead of "electron"
import { spawnSync } from "node:child_process";
import {
copyFileSync,
cpSync,
existsSync,
mkdirSync,
readFileSync,
readdirSync,
rmSync,
statSync,
writeFileSync,
} from "node:fs";
import { createRequire } from "node:module";
import { dirname, join, resolve } from "node:path";
import { fileURLToPath } from "node:url";
const isDevelopment = Boolean(process.env.VITE_DEV_SERVER_URL);
const APP_DISPLAY_NAME = isDevelopment ? "T3 Code (Dev)" : "T3 Code (Alpha)";
const APP_BUNDLE_ID = "com.t3tools.t3code";
const LAUNCHER_VERSION = 1;
const __dirname = dirname(fileURLToPath(import.meta.url));
export const desktopDir = resolve(__dirname, "..");
function setPlistString(plistPath, key, value) {
const replaceResult = spawnSync("plutil", ["-replace", key, "-string", value, plistPath], {
encoding: "utf8",
});
if (replaceResult.status === 0) {
return;
}
const insertResult = spawnSync("plutil", ["-insert", key, "-string", value, plistPath], {
encoding: "utf8",
});
if (insertResult.status === 0) {
return;
}
const details = [replaceResult.stderr, insertResult.stderr].filter(Boolean).join("\n");
throw new Error(`Failed to update plist key "${key}" at ${plistPath}: ${details}`.trim());
}
function patchMainBundleInfoPlist(appBundlePath, iconPath) {
const infoPlistPath = join(appBundlePath, "Contents", "Info.plist");
setPlistString(infoPlistPath, "CFBundleDisplayName", APP_DISPLAY_NAME);
setPlistString(infoPlistPath, "CFBundleName", APP_DISPLAY_NAME);
setPlistString(infoPlistPath, "CFBundleIdentifier", APP_BUNDLE_ID);
setPlistString(infoPlistPath, "CFBundleIconFile", "icon.icns");
const resourcesDir = join(appBundlePath, "Contents", "Resources");
copyFileSync(iconPath, join(resourcesDir, "icon.icns"));
copyFileSync(iconPath, join(resourcesDir, "electron.icns"));
}
function patchHelperBundleInfoPlists(appBundlePath) {
const frameworksDir = join(appBundlePath, "Contents", "Frameworks");
if (!existsSync(frameworksDir)) {
return;
}
for (const entry of readdirSync(frameworksDir, { withFileTypes: true })) {
if (!entry.isDirectory() || !entry.name.endsWith(".app")) {
continue;
}
if (!entry.name.startsWith("Electron Helper")) {
continue;
}
const helperPlistPath = join(frameworksDir, entry.name, "Contents", "Info.plist");
if (!existsSync(helperPlistPath)) {
continue;
}
const suffix = entry.name.replace("Electron Helper", "").replace(".app", "").trim();
const helperName = suffix
? `${APP_DISPLAY_NAME} Helper ${suffix}`
: `${APP_DISPLAY_NAME} Helper`;
const helperIdSuffix = suffix.replace(/[()]/g, "").trim().toLowerCase().replace(/\s+/g, "-");
const helperBundleId = helperIdSuffix
? `${APP_BUNDLE_ID}.helper.${helperIdSuffix}`
: `${APP_BUNDLE_ID}.helper`;
setPlistString(helperPlistPath, "CFBundleDisplayName", helperName);
setPlistString(helperPlistPath, "CFBundleName", helperName);
setPlistString(helperPlistPath, "CFBundleIdentifier", helperBundleId);
}
}
function readJson(path) {
try {
return JSON.parse(readFileSync(path, "utf8"));
} catch {
return null;
}
}
function buildMacLauncher(electronBinaryPath) {
const sourceAppBundlePath = resolve(electronBinaryPath, "../../..");
const runtimeDir = join(desktopDir, ".electron-runtime");
const targetAppBundlePath = join(runtimeDir, `${APP_DISPLAY_NAME}.app`);
const targetBinaryPath = join(targetAppBundlePath, "Contents", "MacOS", "Electron");
const iconPath = join(desktopDir, "resources", "icon.icns");
const metadataPath = join(runtimeDir, "metadata.json");
mkdirSync(runtimeDir, { recursive: true });
const expectedMetadata = {
launcherVersion: LAUNCHER_VERSION,
sourceAppBundlePath,
sourceAppMtimeMs: statSync(sourceAppBundlePath).mtimeMs,
iconMtimeMs: statSync(iconPath).mtimeMs,
};
const currentMetadata = readJson(metadataPath);
if (
existsSync(targetBinaryPath) &&
currentMetadata &&
JSON.stringify(currentMetadata) === JSON.stringify(expectedMetadata)
) {
return targetBinaryPath;
}
rmSync(targetAppBundlePath, { recursive: true, force: true });
cpSync(sourceAppBundlePath, targetAppBundlePath, { recursive: true });
patchMainBundleInfoPlist(targetAppBundlePath, iconPath);
patchHelperBundleInfoPlists(targetAppBundlePath);
writeFileSync(metadataPath, `${JSON.stringify(expectedMetadata, null, 2)}\n`);
return targetBinaryPath;
}
export function resolveElectronPath() {
const require = createRequire(import.meta.url);
const electronBinaryPath = require("electron");
if (process.platform !== "darwin") {
return electronBinaryPath;
}
return buildMacLauncher(electronBinaryPath);
}
-57
View File
@@ -1,57 +0,0 @@
import { spawn } from "node:child_process";
import { dirname, resolve } from "node:path";
import { fileURLToPath } from "node:url";
const __dirname = dirname(fileURLToPath(import.meta.url));
const desktopDir = resolve(__dirname, "..");
const electronBin = resolve(desktopDir, "node_modules/.bin/electron");
const mainJs = resolve(desktopDir, "dist-electron/main.js");
console.log("\nLaunching Electron smoke test...");
const child = spawn(electronBin, [mainJs], {
stdio: ["pipe", "pipe", "pipe"],
env: {
...process.env,
VITE_DEV_SERVER_URL: "",
ELECTRON_ENABLE_LOGGING: "1",
},
});
let output = "";
child.stdout.on("data", (chunk) => {
output += chunk.toString();
});
child.stderr.on("data", (chunk) => {
output += chunk.toString();
});
const timeout = setTimeout(() => {
child.kill();
}, 8_000);
child.on("exit", () => {
clearTimeout(timeout);
const fatalPatterns = [
"Cannot find module",
"MODULE_NOT_FOUND",
"Refused to execute",
"Uncaught Error",
"Uncaught TypeError",
"Uncaught ReferenceError",
];
const failures = fatalPatterns.filter((pattern) => output.includes(pattern));
if (failures.length > 0) {
console.error("\nDesktop smoke test failed:");
for (const failure of failures) {
console.error(` - ${failure}`);
}
console.error("\nFull output:\n" + output);
process.exit(1);
}
console.log("Desktop smoke test passed.");
process.exit(0);
});
-20
View File
@@ -1,20 +0,0 @@
import { spawn } from "node:child_process";
import { desktopDir, resolveElectronPath } from "./electron-launcher.mjs";
const childEnv = { ...process.env };
delete childEnv.ELECTRON_RUN_AS_NODE;
const child = spawn(resolveElectronPath(), ["dist-electron/main.js"], {
stdio: "inherit",
cwd: desktopDir,
env: childEnv,
});
child.on("exit", (code, signal) => {
if (signal) {
process.kill(process.pid, signal);
return;
}
process.exit(code ?? 0);
});
-57
View File
@@ -1,57 +0,0 @@
import type { BrowserWindow } from "electron";
import { beforeEach, describe, expect, it, vi } from "vitest";
const { showMessageBoxMock } = vi.hoisted(() => ({
showMessageBoxMock: vi.fn(),
}));
vi.mock("electron", () => ({
dialog: {
showMessageBox: showMessageBoxMock,
},
}));
import { showDesktopConfirmDialog } from "./confirmDialog";
describe("showDesktopConfirmDialog", () => {
beforeEach(() => {
showMessageBoxMock.mockReset();
});
it("returns false and does not open a dialog for empty messages", async () => {
const result = await showDesktopConfirmDialog(" ", null);
expect(result).toBe(false);
expect(showMessageBoxMock).not.toHaveBeenCalled();
});
it("opens a dialog for the focused window and returns true on confirm", async () => {
const ownerWindow = { id: 1 } as BrowserWindow;
showMessageBoxMock.mockResolvedValue({ response: 1 });
const result = await showDesktopConfirmDialog("Delete worktree?", ownerWindow);
expect(result).toBe(true);
expect(showMessageBoxMock).toHaveBeenCalledWith(
ownerWindow,
expect.objectContaining({
buttons: ["No", "Yes"],
message: "Delete worktree?",
}),
);
});
it("opens an app-level dialog when there is no focused window", async () => {
showMessageBoxMock.mockResolvedValue({ response: 0 });
const result = await showDesktopConfirmDialog("Delete worktree?", null);
expect(result).toBe(false);
expect(showMessageBoxMock).toHaveBeenCalledWith(
expect.objectContaining({
buttons: ["No", "Yes"],
message: "Delete worktree?",
}),
);
});
});
-26
View File
@@ -1,26 +0,0 @@
import { type BrowserWindow, dialog } from "electron";
const CONFIRM_BUTTON_INDEX = 1;
export async function showDesktopConfirmDialog(
message: string,
ownerWindow: BrowserWindow | null,
): Promise<boolean> {
const normalizedMessage = message.trim();
if (normalizedMessage.length === 0) {
return false;
}
const options = {
type: "question" as const,
buttons: ["No", "Yes"],
defaultId: CONFIRM_BUTTON_INDEX,
cancelId: 0,
noLink: true,
message: normalizedMessage,
};
const result = ownerWindow
? await dialog.showMessageBox(ownerWindow, options)
: await dialog.showMessageBox(options);
return result.response === CONFIRM_BUTTON_INDEX;
}
File diff suppressed because it is too large. Load diff
-48
View File
@@ -1,48 +0,0 @@
import { contextBridge, ipcRenderer } from "electron";
import type { DesktopBridge } from "@t3tools/contracts";
const PICK_FOLDER_CHANNEL = "desktop:pick-folder";
const CONFIRM_CHANNEL = "desktop:confirm";
const SET_THEME_CHANNEL = "desktop:set-theme";
const CONTEXT_MENU_CHANNEL = "desktop:context-menu";
const OPEN_EXTERNAL_CHANNEL = "desktop:open-external";
const MENU_ACTION_CHANNEL = "desktop:menu-action";
const UPDATE_STATE_CHANNEL = "desktop:update-state";
const UPDATE_GET_STATE_CHANNEL = "desktop:update-get-state";
const UPDATE_DOWNLOAD_CHANNEL = "desktop:update-download";
const UPDATE_INSTALL_CHANNEL = "desktop:update-install";
const wsUrl = process.env.T3CODE_DESKTOP_WS_URL ?? null;
contextBridge.exposeInMainWorld("desktopBridge", {
getWsUrl: () => wsUrl,
pickFolder: () => ipcRenderer.invoke(PICK_FOLDER_CHANNEL),
confirm: (message) => ipcRenderer.invoke(CONFIRM_CHANNEL, message),
setTheme: (theme) => ipcRenderer.invoke(SET_THEME_CHANNEL, theme),
showContextMenu: (items, position) => ipcRenderer.invoke(CONTEXT_MENU_CHANNEL, items, position),
openExternal: (url: string) => ipcRenderer.invoke(OPEN_EXTERNAL_CHANNEL, url),
onMenuAction: (listener) => {
const wrappedListener = (_event: Electron.IpcRendererEvent, action: unknown) => {
if (typeof action !== "string") return;
listener(action);
};
ipcRenderer.on(MENU_ACTION_CHANNEL, wrappedListener);
return () => {
ipcRenderer.removeListener(MENU_ACTION_CHANNEL, wrappedListener);
};
},
getUpdateState: () => ipcRenderer.invoke(UPDATE_GET_STATE_CHANNEL),
downloadUpdate: () => ipcRenderer.invoke(UPDATE_DOWNLOAD_CHANNEL),
installUpdate: () => ipcRenderer.invoke(UPDATE_INSTALL_CHANNEL),
onUpdateState: (listener) => {
const wrappedListener = (_event: Electron.IpcRendererEvent, state: unknown) => {
if (typeof state !== "object" || state === null) return;
listener(state as Parameters<typeof listener>[0]);
};
ipcRenderer.on(UPDATE_STATE_CHANNEL, wrappedListener);
return () => {
ipcRenderer.removeListener(UPDATE_STATE_CHANNEL, wrappedListener);
};
},
} satisfies DesktopBridge);
-74
View File
@@ -1,74 +0,0 @@
import fs from "node:fs";
import os from "node:os";
import path from "node:path";
import { RotatingFileSink } from "@t3tools/shared/logging";
import { afterEach, describe, expect, it } from "vitest";
const tempRoots: string[] = [];
function makeTempDir(): string {
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "t3-rotating-log-"));
tempRoots.push(dir);
return dir;
}
afterEach(() => {
for (const dir of tempRoots.splice(0)) {
fs.rmSync(dir, { recursive: true, force: true });
}
});
describe("RotatingFileSink", () => {
it("rotates when writes exceed max bytes", () => {
const dir = makeTempDir();
const logPath = path.join(dir, "desktop-main.log");
const sink = new RotatingFileSink({
filePath: logPath,
maxBytes: 10,
maxFiles: 3,
});
sink.write("12345");
sink.write("67890");
sink.write("abc");
expect(fs.readFileSync(path.join(dir, "desktop-main.log"), "utf8")).toBe("abc");
expect(fs.readFileSync(path.join(dir, "desktop-main.log.1"), "utf8")).toBe("1234567890");
});
it("retains only maxFiles backups", () => {
const dir = makeTempDir();
const logPath = path.join(dir, "server-child.log");
const sink = new RotatingFileSink({
filePath: logPath,
maxBytes: 4,
maxFiles: 2,
});
sink.write("aaaa");
sink.write("bbbb");
sink.write("cccc");
sink.write("dddd");
expect(fs.existsSync(path.join(dir, "server-child.log.1"))).toBe(true);
expect(fs.existsSync(path.join(dir, "server-child.log.2"))).toBe(true);
expect(fs.existsSync(path.join(dir, "server-child.log.3"))).toBe(false);
});
it("prunes stale backups above maxFiles on startup", () => {
const dir = makeTempDir();
const logPath = path.join(dir, "desktop-main.log");
fs.writeFileSync(path.join(dir, "desktop-main.log.1"), "first");
fs.writeFileSync(path.join(dir, "desktop-main.log.4"), "stale");
const sink = new RotatingFileSink({
filePath: logPath,
maxBytes: 16,
maxFiles: 2,
});
sink.write("hello");
expect(fs.existsSync(path.join(dir, "desktop-main.log.4"))).toBe(false);
});
});
-49
View File
@@ -1,49 +0,0 @@
import { describe, expect, it } from "vitest";
import { isArm64HostRunningIntelBuild, resolveDesktopRuntimeInfo } from "./runtimeArch";
describe("resolveDesktopRuntimeInfo", () => {
it("detects Rosetta-translated Intel builds on Apple Silicon", () => {
const runtimeInfo = resolveDesktopRuntimeInfo({
platform: "darwin",
processArch: "x64",
runningUnderArm64Translation: true,
});
expect(runtimeInfo).toEqual({
hostArch: "arm64",
appArch: "x64",
runningUnderArm64Translation: true,
});
expect(isArm64HostRunningIntelBuild(runtimeInfo)).toBe(true);
});
it("detects native Apple Silicon builds", () => {
const runtimeInfo = resolveDesktopRuntimeInfo({
platform: "darwin",
processArch: "arm64",
runningUnderArm64Translation: false,
});
expect(runtimeInfo).toEqual({
hostArch: "arm64",
appArch: "arm64",
runningUnderArm64Translation: false,
});
expect(isArm64HostRunningIntelBuild(runtimeInfo)).toBe(false);
});
it("passes through non-mac builds without translation", () => {
const runtimeInfo = resolveDesktopRuntimeInfo({
platform: "linux",
processArch: "x64",
runningUnderArm64Translation: true,
});
expect(runtimeInfo).toEqual({
hostArch: "x64",
appArch: "x64",
runningUnderArm64Translation: false,
});
});
});
-39
View File
@@ -1,39 +0,0 @@
import type { DesktopRuntimeArch, DesktopRuntimeInfo } from "@t3tools/contracts";
interface ResolveDesktopRuntimeInfoInput {
readonly platform: NodeJS.Platform;
readonly processArch: string;
readonly runningUnderArm64Translation: boolean;
}
function normalizeDesktopArch(arch: string): DesktopRuntimeArch {
if (arch === "arm64") return "arm64";
if (arch === "x64") return "x64";
return "other";
}
export function resolveDesktopRuntimeInfo(
input: ResolveDesktopRuntimeInfoInput,
): DesktopRuntimeInfo {
const appArch = normalizeDesktopArch(input.processArch);
if (input.platform !== "darwin") {
return {
hostArch: appArch,
appArch,
runningUnderArm64Translation: false,
};
}
const hostArch = appArch === "arm64" || input.runningUnderArm64Translation ? "arm64" : appArch;
return {
hostArch,
appArch,
runningUnderArm64Translation: input.runningUnderArm64Translation,
};
}
export function isArm64HostRunningIntelBuild(runtimeInfo: DesktopRuntimeInfo): boolean {
return runtimeInfo.hostArch === "arm64" && runtimeInfo.appArch === "x64";
}
@@ -1,85 +0,0 @@
import { describe, expect, it, vi } from "vitest";
import { syncShellEnvironment } from "./syncShellEnvironment";
describe("syncShellEnvironment", () => {
it("hydrates PATH and missing SSH_AUTH_SOCK from the login shell on macOS", () => {
const env: NodeJS.ProcessEnv = {
SHELL: "/bin/zsh",
PATH: "/usr/bin",
};
const readEnvironment = vi.fn(() => ({
PATH: "/opt/homebrew/bin:/usr/bin",
SSH_AUTH_SOCK: "/tmp/secretive.sock",
}));
syncShellEnvironment(env, {
platform: "darwin",
readEnvironment,
});
expect(readEnvironment).toHaveBeenCalledWith("/bin/zsh", ["PATH", "SSH_AUTH_SOCK"]);
expect(env.PATH).toBe("/opt/homebrew/bin:/usr/bin");
expect(env.SSH_AUTH_SOCK).toBe("/tmp/secretive.sock");
});
it("preserves an inherited SSH_AUTH_SOCK value", () => {
const env: NodeJS.ProcessEnv = {
SHELL: "/bin/zsh",
PATH: "/usr/bin",
SSH_AUTH_SOCK: "/tmp/inherited.sock",
};
const readEnvironment = vi.fn(() => ({
PATH: "/opt/homebrew/bin:/usr/bin",
SSH_AUTH_SOCK: "/tmp/login-shell.sock",
}));
syncShellEnvironment(env, {
platform: "darwin",
readEnvironment,
});
expect(env.PATH).toBe("/opt/homebrew/bin:/usr/bin");
expect(env.SSH_AUTH_SOCK).toBe("/tmp/inherited.sock");
});
it("preserves inherited values when the login shell omits them", () => {
const env: NodeJS.ProcessEnv = {
SHELL: "/bin/zsh",
PATH: "/usr/bin",
SSH_AUTH_SOCK: "/tmp/inherited.sock",
};
const readEnvironment = vi.fn(() => ({
PATH: "/opt/homebrew/bin:/usr/bin",
}));
syncShellEnvironment(env, {
platform: "darwin",
readEnvironment,
});
expect(env.PATH).toBe("/opt/homebrew/bin:/usr/bin");
expect(env.SSH_AUTH_SOCK).toBe("/tmp/inherited.sock");
});
it("does nothing outside macOS", () => {
const env: NodeJS.ProcessEnv = {
SHELL: "/bin/zsh",
PATH: "/usr/bin",
SSH_AUTH_SOCK: "/tmp/inherited.sock",
};
const readEnvironment = vi.fn(() => ({
PATH: "/opt/homebrew/bin:/usr/bin",
SSH_AUTH_SOCK: "/tmp/secretive.sock",
}));
syncShellEnvironment(env, {
platform: "linux",
readEnvironment,
});
expect(readEnvironment).not.toHaveBeenCalled();
expect(env.PATH).toBe("/usr/bin");
expect(env.SSH_AUTH_SOCK).toBe("/tmp/inherited.sock");
});
});
-29
View File
@@ -1,29 +0,0 @@
import { readEnvironmentFromLoginShell, ShellEnvironmentReader } from "@t3tools/shared/shell";
export function syncShellEnvironment(
env: NodeJS.ProcessEnv = process.env,
options: {
platform?: NodeJS.Platform;
readEnvironment?: ShellEnvironmentReader;
} = {},
): void {
if ((options.platform ?? process.platform) !== "darwin") return;
try {
const shell = env.SHELL ?? "/bin/zsh";
const shellEnvironment = (options.readEnvironment ?? readEnvironmentFromLoginShell)(shell, [
"PATH",
"SSH_AUTH_SOCK",
]);
if (shellEnvironment.PATH) {
env.PATH = shellEnvironment.PATH;
}
if (!env.SSH_AUTH_SOCK && shellEnvironment.SSH_AUTH_SOCK) {
env.SSH_AUTH_SOCK = shellEnvironment.SSH_AUTH_SOCK;
}
} catch {
// Keep inherited environment if shell lookup fails.
}
}
-139
View File
@@ -1,139 +0,0 @@
import { describe, expect, it } from "vitest";
import {
createInitialDesktopUpdateState,
reduceDesktopUpdateStateOnCheckFailure,
reduceDesktopUpdateStateOnCheckStart,
reduceDesktopUpdateStateOnDownloadComplete,
reduceDesktopUpdateStateOnDownloadFailure,
reduceDesktopUpdateStateOnDownloadProgress,
reduceDesktopUpdateStateOnDownloadStart,
reduceDesktopUpdateStateOnInstallFailure,
reduceDesktopUpdateStateOnNoUpdate,
reduceDesktopUpdateStateOnUpdateAvailable,
} from "./updateMachine";
const runtimeInfo = {
hostArch: "x64",
appArch: "x64",
runningUnderArm64Translation: false,
} as const;
describe("updateMachine", () => {
it("clears transient errors when a check starts", () => {
const state = reduceDesktopUpdateStateOnCheckStart(
{
...createInitialDesktopUpdateState("1.0.0", runtimeInfo),
enabled: true,
status: "error",
message: "network",
errorContext: "check",
canRetry: true,
},
"2026-03-04T00:00:00.000Z",
);
expect(state.status).toBe("checking");
expect(state.message).toBeNull();
expect(state.errorContext).toBeNull();
expect(state.canRetry).toBe(false);
});
it("records a check failure without exposing an action", () => {
const state = reduceDesktopUpdateStateOnCheckFailure(
{
...createInitialDesktopUpdateState("1.0.0", runtimeInfo),
enabled: true,
status: "checking",
},
"network unavailable",
"2026-03-04T00:00:00.000Z",
);
expect(state.status).toBe("error");
expect(state.errorContext).toBe("check");
expect(state.canRetry).toBe(true);
});
it("preserves available version on download failure for retry", () => {
const state = reduceDesktopUpdateStateOnDownloadFailure(
{
...createInitialDesktopUpdateState("1.0.0", runtimeInfo),
enabled: true,
status: "downloading",
availableVersion: "1.1.0",
downloadPercent: 43,
},
"checksum mismatch",
);
expect(state.status).toBe("available");
expect(state.availableVersion).toBe("1.1.0");
expect(state.errorContext).toBe("download");
expect(state.canRetry).toBe(true);
});
it("transitions to downloaded and then preserves install retry state", () => {
const downloaded = reduceDesktopUpdateStateOnDownloadComplete(
{
...createInitialDesktopUpdateState("1.0.0", runtimeInfo),
enabled: true,
status: "downloading",
availableVersion: "1.1.0",
},
"1.1.0",
);
const failedInstall = reduceDesktopUpdateStateOnInstallFailure(
downloaded,
"backend shutdown timed out",
);
expect(downloaded.status).toBe("downloaded");
expect(downloaded.downloadedVersion).toBe("1.1.0");
expect(failedInstall.status).toBe("downloaded");
expect(failedInstall.errorContext).toBe("install");
expect(failedInstall.canRetry).toBe(true);
});
it("clears stale download state when no update is available", () => {
const state = reduceDesktopUpdateStateOnNoUpdate(
{
...createInitialDesktopUpdateState("1.0.0", runtimeInfo),
enabled: true,
status: "error",
availableVersion: "1.1.0",
downloadedVersion: "1.1.0",
message: "old failure",
errorContext: "download",
canRetry: true,
},
"2026-03-04T00:00:00.000Z",
);
expect(state.status).toBe("up-to-date");
expect(state.availableVersion).toBeNull();
expect(state.downloadedVersion).toBeNull();
expect(state.message).toBeNull();
expect(state.errorContext).toBeNull();
});
it("tracks available, download start, and progress cleanly", () => {
const available = reduceDesktopUpdateStateOnUpdateAvailable(
{
...createInitialDesktopUpdateState("1.0.0", runtimeInfo),
enabled: true,
status: "checking",
},
"1.1.0",
"2026-03-04T00:00:00.000Z",
);
const downloading = reduceDesktopUpdateStateOnDownloadStart(available);
const progress = reduceDesktopUpdateStateOnDownloadProgress(downloading, 55.5);
expect(available.status).toBe("available");
expect(downloading.status).toBe("downloading");
expect(downloading.downloadPercent).toBe(0);
expect(progress.downloadPercent).toBe(55.5);
expect(progress.errorContext).toBeNull();
});
});
-160
View File
@@ -1,160 +0,0 @@
import type { DesktopRuntimeInfo, DesktopUpdateState } from "@t3tools/contracts";
import { getCanRetryAfterDownloadFailure, nextStatusAfterDownloadFailure } from "./updateState";
export function createInitialDesktopUpdateState(
currentVersion: string,
runtimeInfo: DesktopRuntimeInfo,
): DesktopUpdateState {
return {
enabled: false,
status: "disabled",
currentVersion,
hostArch: runtimeInfo.hostArch,
appArch: runtimeInfo.appArch,
runningUnderArm64Translation: runtimeInfo.runningUnderArm64Translation,
availableVersion: null,
downloadedVersion: null,
downloadPercent: null,
checkedAt: null,
message: null,
errorContext: null,
canRetry: false,
};
}
export function reduceDesktopUpdateStateOnCheckStart(
state: DesktopUpdateState,
checkedAt: string,
): DesktopUpdateState {
return {
...state,
status: "checking",
checkedAt,
message: null,
downloadPercent: null,
errorContext: null,
canRetry: false,
};
}
export function reduceDesktopUpdateStateOnCheckFailure(
state: DesktopUpdateState,
message: string,
checkedAt: string,
): DesktopUpdateState {
return {
...state,
status: "error",
message,
checkedAt,
downloadPercent: null,
errorContext: "check",
canRetry: true,
};
}
export function reduceDesktopUpdateStateOnUpdateAvailable(
state: DesktopUpdateState,
version: string,
checkedAt: string,
): DesktopUpdateState {
return {
...state,
status: "available",
availableVersion: version,
downloadedVersion: null,
downloadPercent: null,
checkedAt,
message: null,
errorContext: null,
canRetry: false,
};
}
export function reduceDesktopUpdateStateOnNoUpdate(
state: DesktopUpdateState,
checkedAt: string,
): DesktopUpdateState {
return {
...state,
status: "up-to-date",
availableVersion: null,
downloadedVersion: null,
downloadPercent: null,
checkedAt,
message: null,
errorContext: null,
canRetry: false,
};
}
export function reduceDesktopUpdateStateOnDownloadStart(
state: DesktopUpdateState,
): DesktopUpdateState {
return {
...state,
status: "downloading",
downloadPercent: 0,
message: null,
errorContext: null,
canRetry: false,
};
}
export function reduceDesktopUpdateStateOnDownloadFailure(
state: DesktopUpdateState,
message: string,
): DesktopUpdateState {
return {
...state,
status: nextStatusAfterDownloadFailure(state),
message,
downloadPercent: null,
errorContext: "download",
canRetry: getCanRetryAfterDownloadFailure(state),
};
}
export function reduceDesktopUpdateStateOnDownloadProgress(
state: DesktopUpdateState,
percent: number,
): DesktopUpdateState {
return {
...state,
status: "downloading",
downloadPercent: percent,
message: null,
errorContext: null,
canRetry: false,
};
}
export function reduceDesktopUpdateStateOnDownloadComplete(
state: DesktopUpdateState,
version: string,
): DesktopUpdateState {
return {
...state,
status: "downloaded",
availableVersion: version,
downloadedVersion: version,
downloadPercent: 100,
message: null,
errorContext: null,
canRetry: true,
};
}
export function reduceDesktopUpdateStateOnInstallFailure(
state: DesktopUpdateState,
message: string,
): DesktopUpdateState {
return {
...state,
status: "downloaded",
message,
errorContext: "install",
canRetry: true,
};
}
-145
View File
@@ -1,145 +0,0 @@
import { describe, expect, it } from "vitest";
import type { DesktopUpdateState } from "@t3tools/contracts";
import {
getCanRetryAfterDownloadFailure,
getAutoUpdateDisabledReason,
nextStatusAfterDownloadFailure,
shouldBroadcastDownloadProgress,
} from "./updateState";
const baseState: DesktopUpdateState = {
enabled: true,
status: "idle",
currentVersion: "1.0.0",
hostArch: "x64",
appArch: "x64",
runningUnderArm64Translation: false,
availableVersion: null,
downloadedVersion: null,
downloadPercent: null,
checkedAt: null,
message: null,
errorContext: null,
canRetry: false,
};
describe("shouldBroadcastDownloadProgress", () => {
it("broadcasts the first downloading progress update", () => {
expect(
shouldBroadcastDownloadProgress(
{ ...baseState, status: "downloading", downloadPercent: null },
1,
),
).toBe(true);
});
it("skips progress updates within the same 10% bucket", () => {
expect(
shouldBroadcastDownloadProgress(
{ ...baseState, status: "downloading", downloadPercent: 11.2 },
18.7,
),
).toBe(false);
});
it("broadcasts progress updates when a new 10% bucket is reached", () => {
expect(
shouldBroadcastDownloadProgress(
{ ...baseState, status: "downloading", downloadPercent: 19.9 },
20.1,
),
).toBe(true);
});
it("broadcasts progress updates when a retry resets the download percentage", () => {
expect(
shouldBroadcastDownloadProgress(
{ ...baseState, status: "downloading", downloadPercent: 50.4 },
0.2,
),
).toBe(true);
});
});
describe("getAutoUpdateDisabledReason", () => {
it("reports development builds as disabled", () => {
expect(
getAutoUpdateDisabledReason({
isDevelopment: true,
isPackaged: false,
platform: "darwin",
appImage: undefined,
disabledByEnv: false,
}),
).toContain("packaged production builds");
});
it("reports env-disabled auto updates", () => {
expect(
getAutoUpdateDisabledReason({
isDevelopment: false,
isPackaged: true,
platform: "darwin",
appImage: undefined,
disabledByEnv: true,
}),
).toContain("T3CODE_DISABLE_AUTO_UPDATE");
});
it("reports linux non-AppImage builds as disabled", () => {
expect(
getAutoUpdateDisabledReason({
isDevelopment: false,
isPackaged: true,
platform: "linux",
appImage: undefined,
disabledByEnv: false,
}),
).toContain("AppImage");
});
});
describe("nextStatusAfterDownloadFailure", () => {
it("returns available when an update version is still known", () => {
expect(
nextStatusAfterDownloadFailure({
...baseState,
status: "downloading",
availableVersion: "1.1.0",
}),
).toBe("available");
});
it("returns error when no update version can be retried", () => {
expect(
nextStatusAfterDownloadFailure({
...baseState,
status: "downloading",
availableVersion: null,
}),
).toBe("error");
});
});
describe("getCanRetryAfterDownloadFailure", () => {
it("returns true when an available version is still present", () => {
expect(
getCanRetryAfterDownloadFailure({
...baseState,
status: "downloading",
availableVersion: "1.1.0",
}),
).toBe(true);
});
it("returns false when no version is available to retry", () => {
expect(
getCanRetryAfterDownloadFailure({
...baseState,
status: "downloading",
availableVersion: null,
}),
).toBe(false);
});
});
-48
View File
@@ -1,48 +0,0 @@
import type { DesktopUpdateState } from "@t3tools/contracts";
export function shouldBroadcastDownloadProgress(
currentState: DesktopUpdateState,
nextPercent: number,
): boolean {
if (currentState.status !== "downloading") {
return true;
}
const currentPercent = currentState.downloadPercent;
if (currentPercent === null) {
return true;
}
const previousStep = Math.floor(currentPercent / 10);
const nextStep = Math.floor(nextPercent / 10);
return nextStep !== previousStep || nextPercent === 100;
}
export function nextStatusAfterDownloadFailure(
currentState: DesktopUpdateState,
): DesktopUpdateState["status"] {
return currentState.availableVersion ? "available" : "error";
}
export function getCanRetryAfterDownloadFailure(currentState: DesktopUpdateState): boolean {
return currentState.availableVersion !== null;
}
export function getAutoUpdateDisabledReason(args: {
isDevelopment: boolean;
isPackaged: boolean;
platform: NodeJS.Platform;
appImage?: string | undefined;
disabledByEnv: boolean;
}): string | null {
if (args.isDevelopment || !args.isPackaged) {
return "Automatic updates are only available in packaged production builds.";
}
if (args.disabledByEnv) {
return "Automatic updates are disabled by the T3CODE_DISABLE_AUTO_UPDATE setting.";
}
if (args.platform === "linux" && !args.appImage) {
return "Automatic updates on Linux require running the AppImage build.";
}
return null;
}
-9
View File
@@ -1,9 +0,0 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"composite": true,
"types": ["node", "electron"],
"lib": ["ES2023", "DOM", "esnext.disposable"]
},
"include": ["src", "tsdown.config.ts"]
}
-21
View File
@@ -1,21 +0,0 @@
import { defineConfig } from "tsdown";
const shared = {
format: "cjs" as const,
outDir: "dist-electron",
sourcemap: true,
outExtensions: () => ({ js: ".js" }),
};
export default defineConfig([
{
...shared,
entry: ["src/main.ts"],
clean: true,
noExternal: (id) => id.startsWith("@t3tools/"),
},
{
...shared,
entry: ["src/preload.ts"],
},
]);
-24
View File
@@ -1,24 +0,0 @@
{
"$schema": "https://turbo.build/schema.json",
"extends": ["//"],
"tasks": {
"build": {
"dependsOn": ["^build"],
"outputs": ["dist-electron/**"],
},
"dev": {
"dependsOn": ["t3#build"],
"persistent": true,
},
"start": {
"dependsOn": ["build", "@t3tools/web#build", "t3#build"],
"cache": false,
"persistent": true,
},
"smoke-test": {
"dependsOn": ["build", "@t3tools/web#build", "t3#build"],
"cache": false,
"outputs": [],
},
},
}
-7
View File
@@ -1,7 +0,0 @@
import { defineConfig } from "astro/config";
export default defineConfig({
server: {
port: Number(process.env.PORT ?? 4173),
},
});
-19
View File
@@ -1,19 +0,0 @@
{
"name": "@t3tools/marketing",
"version": "0.0.0",
"private": true,
"type": "module",
"scripts": {
"dev": "astro dev",
"build": "astro build",
"preview": "astro preview",
"typecheck": "astro check"
},
"dependencies": {
"astro": "^6.0.4"
},
"devDependencies": {
"@astrojs/check": "^0.9.7",
"typescript": "catalog:"
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 414 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 662 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 652 KiB

-228
View File
@@ -1,228 +0,0 @@
---
interface Props {
title?: string;
description?: string;
}
const {
title = "T3 Code",
description = "T3 Code — The best way to code with AI.",
} = Astro.props;
---
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content={description} />
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=DM+Sans:opsz,[email protected],400;9..40,500;9..40,600&display=swap"
rel="stylesheet"
/>
<link rel="icon" href="/favicon.ico" sizes="48x48" />
<link rel="icon" type="image/png" href="/favicon-32x32.png" sizes="32x32" />
<link rel="icon" type="image/png" href="/favicon-16x16.png" sizes="16x16" />
<link rel="apple-touch-icon" href="/apple-touch-icon.png" />
<title>{title}</title>
</head>
<body>
<div class="page">
<nav class="nav">
<a href="/" class="nav-brand">
<img src="/icon.png" alt="T3" class="nav-icon" />
</a>
<a
href="https://github.com/pingdotgg/t3code"
target="_blank"
rel="noopener noreferrer"
class="nav-github"
>
GitHub
<span class="nav-github-arrow" aria-hidden="true">&#8599;</span>
</a>
</nav>
<main class="main">
<slot />
</main>
<footer class="footer">
<span class="footer-copy">&copy; {new Date().getFullYear()} T3 Tools Inc</span>
<div class="footer-links">
<a href="https://github.com/pingdotgg/t3code" target="_blank" rel="noopener noreferrer">GitHub</a>
<a href="https://discord.gg/jn4EGJjrvv" target="_blank" rel="noopener noreferrer">Discord</a>
</div>
</footer>
</div>
</body>
</html>
<style is:global>
:root {
--bg: #09090b;
--fg: #fafafa;
--fg-muted: #a1a1aa;
--fg-dim: #71717a;
--border: rgba(255, 255, 255, 0.08);
}
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
html {
color-scheme: dark;
}
body {
background: var(--bg);
color: var(--fg);
font-family: "DM Sans", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
min-height: 100vh;
overflow-x: hidden;
}
body::after {
content: "";
position: fixed;
inset: 0;
pointer-events: none;
opacity: 0.035;
background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
background-repeat: repeat;
background-size: 256px 256px;
z-index: 9999;
}
a {
color: inherit;
text-decoration: none;
}
img {
display: block;
max-width: 100%;
}
@keyframes fade-in {
from {
opacity: 0;
transform: translateY(8px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
</style>
<style>
/* ── Page ── */
.page {
min-height: 100vh;
display: flex;
flex-direction: column;
overflow-x: hidden;
}
/* ── Navbar ── */
.nav {
display: flex;
align-items: center;
justify-content: space-between;
padding: 1.5rem 2.5rem;
opacity: 0.5;
transition: opacity 0.4s ease;
}
.nav:hover {
opacity: 1;
}
.nav-brand {
display: flex;
align-items: center;
}
.nav-icon {
width: 28px;
height: 28px;
border-radius: 6px;
}
.nav-github {
display: flex;
align-items: center;
gap: 0.35rem;
color: var(--fg-muted);
font-size: 0.875rem;
transition: color 0.3s ease;
}
.nav-github:hover {
color: var(--fg);
}
.nav-github-arrow {
display: inline-block;
transition: transform 0.3s ease;
}
.nav-github:hover .nav-github-arrow {
transform: translateX(2px) translateY(-1px);
}
/* ── Main content ── */
.main {
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
}
/* ── Footer ── */
.footer {
display: flex;
align-items: center;
justify-content: space-between;
padding: 1.5rem 2.5rem;
font-size: 0.8rem;
color: var(--fg-dim);
}
.footer-links {
display: flex;
gap: 1.25rem;
}
.footer-links a {
color: var(--fg-dim);
transition: color 0.3s ease;
}
.footer-links a:hover {
color: var(--fg);
}
/* ── Mobile ── */
@media (max-width: 640px) {
.nav {
padding: 1.25rem;
}
.footer {
padding: 1.25rem;
}
}
</style>
-30
View File
@@ -1,30 +0,0 @@
const REPO = "pingdotgg/t3code";
export const RELEASES_URL = `https://github.com/${REPO}/releases`;
const API_URL = `https://api.github.com/repos/${REPO}/releases/latest`;
const CACHE_KEY = "t3code-latest-release";
export interface ReleaseAsset {
name: string;
browser_download_url: string;
}
export interface Release {
tag_name: string;
html_url: string;
assets: ReleaseAsset[];
}
export async function fetchLatestRelease(): Promise<Release> {
const cached = sessionStorage.getItem(CACHE_KEY);
if (cached) return JSON.parse(cached);
const data = await fetch(API_URL).then((r) => r.json());
if (data?.assets) {
sessionStorage.setItem(CACHE_KEY, JSON.stringify(data));
}
return data;
}
-271
View File
@@ -1,271 +0,0 @@
---
import Layout from "../layouts/Layout.astro";
---
<Layout title="Download — T3 Code" description="Download T3 Code for macOS, Windows, or Linux.">
<h1 class="heading">Download T3 Code</h1>
<p class="subheading">
<span id="version-label">Loading latest release&hellip;</span>
<a id="changelog-link" class="changelog-link" href="#" target="_blank" rel="noopener noreferrer" style="display:none">View changelog<span aria-hidden="true"> &#8599;</span></a>
</p>
<div class="platforms" id="platforms">
<!-- macOS -->
<section class="platform-section">
<div class="platform-header">
<svg class="platform-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 814 1000" aria-hidden="true"><path fill="currentColor" d="M788.1 340.9c-5.8 4.5-108.2 62.2-108.2 190.5 0 148.4 130.3 200.9 134.2 202.2-.6 3.2-20.7 71.9-68.7 141.9-42.8 61.6-87.5 123.1-155.5 123.1s-85.5-39.5-164-39.5c-76.5 0-103.7 40.8-165.9 40.8s-105.6-57-155.5-127C46.7 790.7 0 663 0 541.8c0-194.4 126.4-297.5 250.8-297.5 66.1 0 121.2 43.4 162.7 43.4 39.5 0 101.1-46 176.3-46 28.5 0 130.9 2.6 198.3 99.2zm-234-181.5c31.1-36.9 53.1-88.1 53.1-139.3 0-7.1-.6-14.3-1.9-20.1-50.6 1.9-110.8 33.7-147.1 75.8-28.5 32.4-55.1 83.6-55.1 135.5 0 7.8 1.3 15.6 1.9 18.1 3.2.6 8.4 1.3 13.6 1.3 45.4 0 102.5-30.4 135.5-71.3z"/></svg>
<h2 class="platform-name">macOS</h2>
</div>
<div class="download-cards">
<a class="download-card" data-asset="arm64.dmg" href="#">
<span class="card-arch">Apple Silicon (arm64)</span>
<span class="card-format">.dmg</span>
</a>
<a class="download-card" data-asset="x64.dmg" href="#">
<span class="card-arch">Intel (x64)</span>
<span class="card-format">.dmg</span>
</a>
</div>
</section>
<!-- Windows -->
<section class="platform-section">
<div class="platform-header">
<svg class="platform-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 88 88" aria-hidden="true"><path fill="currentColor" d="m0 12.402 35.687-4.86.016 34.423-35.67.203zm35.67 33.529.028 34.453L.028 75.48.026 45.7zm4.326-39.025L87.314 0v41.527l-47.318.376zm47.329 39.349-.011 41.34-47.318-6.678-.066-34.739z"/></svg>
<h2 class="platform-name">Windows</h2>
</div>
<div class="download-cards">
<a class="download-card" data-asset="x64.exe" href="#">
<span class="card-arch">Windows 10, 11</span>
<span class="card-format">.exe</span>
</a>
</div>
</section>
<!-- Linux -->
<section class="platform-section">
<div class="platform-header">
<svg class="platform-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 295" aria-hidden="true"><defs><linearGradient id="lt0" x1="48.548%" x2="51.047%" y1="115.276%" y2="41.364%"><stop offset="0%" stop-color="#FFEED7"/><stop offset="100%" stop-color="#BDBFC2"/></linearGradient><linearGradient id="lt6" x1="49.984%" x2="49.984%" y1="89.845%" y2="40.632%"><stop offset="0%" stop-color="#FFEED7"/><stop offset="100%" stop-color="#BDBFC2"/></linearGradient><linearGradient id="lt8" x1="49.841%" x2="50.241%" y1="13.229%" y2="94.673%"><stop offset="0%" stop-color="#FFF" stop-opacity=".8"/><stop offset="100%" stop-color="#FFF" stop-opacity="0"/></linearGradient><linearGradient id="ltc" x1="53.467%" x2="38.949%" y1="48.921%" y2="98.1%"><stop offset="0%" stop-color="#FFA63F"/><stop offset="100%" stop-color="#FF0"/></linearGradient><linearGradient id="lte" x1="30.581%" x2="65.887%" y1="34.024%" y2="89.175%"><stop offset="0%" stop-color="#FFA63F"/><stop offset="100%" stop-color="#FF0"/></linearGradient><linearGradient id="lti" x1="49.733%" x2="50.558%" y1="17.609%" y2="99.385%"><stop offset="0%" stop-color="#FFA63F"/><stop offset="100%" stop-color="#FF0"/></linearGradient></defs><g fill="none"><path fill="#000" d="M63.213 215.474c-11.387-16.346-13.591-69.606 12.947-102.39C89.292 97.383 92.69 86.455 93.7 71.67c.734-16.805-11.846-66.851 35.537-70.616 48.027-3.857 45.364 43.526 45.088 68.596-.183 21.12 15.52 33.15 26.355 49.68 19.927 30.303 18.274 82.461-3.765 110.745-27.916 35.354-51.791 20.018-67.678 21.304-29.752 1.745-30.762 17.54-66.024-35.905"/><path fill="url(#lt6)" d="M81.027 145.684c6.52-14.785 20.386-40.772 20.662-60.883 0-15.978 47.843-19.835 51.7-3.856 3.856 15.978 13.59 39.853 19.834 51.424 6.245 11.478 24.335 48.118 5.051 80.074-17.356 28.284-69.973 50.69-98.073-3.856-9.55-18.917-7.806-42.333.826-62.903"/><path fill="url(#lt8)" d="M166.428 151.285c0 16.162-15.519 37.1-42.15 36.916-27.456.183-39.118-20.754-39.118-36.916 0-16.161 18.182-29.293 40.588-29.293 22.498.092 40.68 13.132 40.68 29.293"/><path fill="#000" stroke="#000" stroke-width=".977" d="M176.805 117.86c13.59 11.02 38.292 49.587 2.204 74.748-11.846 7.806 10.468 32.508 23.049 19.927 43.618-43.894-1.102-94.308-16.53-111.664-13.774-15.151-25.987 3.49-8.723 16.989z"/><path fill="#000" stroke="#000" stroke-width="1.25" d="M79.925 122.727c-8.907 14.509-30.211 48.669-1.652 66.484 38.384 23.6 27.548 47.108-7.53 25.895-49.404-29.568-5.97-89.257 13.774-112.03 22.59-25.529 4.316 4.683-4.592 19.65z"/><path fill="url(#ltc)" stroke="#E68C3F" stroke-width="6.25" d="M51.835 258.542c-20.57-10.928-50.414 2.112-39.578-27.457 2.204-6.704-3.214-16.805.275-23.325 4.133-7.989 13.04-6.244 18.366-11.57 5.234-5.51 8.54-15.06 18.366-13.59 9.734 1.468 16.254 13.406 23.049 28.099 5.05 10.468 22.865 25.253 21.672 37.007-1.47 17.998-21.948 21.396-42.15 10.836z" transform="translate(10)"/><path fill="url(#lte)" stroke="#E68C3F" stroke-width="6.251" d="M194.445 253.49c15.06-18.273 48.578-14.508 25.988-39.577-4.775-5.418-3.306-16.989-9.183-21.947-6.887-6.061-14.509-1.102-21.488-4.224-6.979-3.398-14.325-9.918-22.865-5.327-8.54 4.684-9.459 16.805-10.285 32.783-.735 11.479-11.203 30.671-5.602 41.231 8.081 16.346 29.11 14.142 43.435-2.938z" transform="translate(10)"/><path fill="url(#lti)" stroke="#E68C3F" stroke-width="3.75" d="M97.107 66.344c3.673-3.398 12.58-13.774 29.477-2.939 3.122 2.02 5.693 2.204 11.662 4.775 12.03 4.96 6.336 16.897-6.52 20.937-5.51 1.745-10.468 8.449-20.386 7.806-8.54-.46-10.744-6.06-15.978-9.091-9.275-5.234-10.652-12.305-5.602-16.07 5.051-3.765 6.98-5.143 7.347-5.418z" transform="translate(10)"/><path fill="#000" d="M133.186 57.712c-.092 5.234 2.48 9.458 5.877 9.458 3.306 0 6.153-4.224 6.245-9.366.091-5.234-2.48-9.459-5.878-9.459-3.397 0-6.152 4.225-6.244 9.367m-21.212.092c.459 4.316-1.194 7.989-3.582 8.356-2.387.276-4.683-2.938-5.142-7.254-.46-4.316 1.194-7.99 3.581-8.357 2.388-.275 4.684 2.939 5.143 7.255"/></g></svg>
<h2 class="platform-name">Linux</h2>
</div>
<div class="download-cards">
<a class="download-card" data-asset="x86_64.AppImage" href="#">
<span class="card-arch">x86_64</span>
<span class="card-format">AppImage</span>
</a>
</div>
</section>
</div>
<p class="releases-link">
Looking for older versions? Check the
<a href="https://github.com/pingdotgg/t3code/releases" target="_blank" rel="noopener noreferrer">
GitHub releases page<span aria-hidden="true"> &#8599;</span>
</a>
</p>
</Layout>
<script>
import { fetchLatestRelease, RELEASES_URL } from "../lib/releases";
async function init() {
const versionLabel = document.getElementById("version-label");
const cards = document.querySelectorAll<HTMLAnchorElement>(".download-card");
try {
const release = await fetchLatestRelease();
if (versionLabel && release.tag_name) {
versionLabel.textContent = `Latest (${release.tag_name})`;
}
const changelogLink = document.getElementById("changelog-link") as HTMLAnchorElement | null;
if (changelogLink && release.html_url) {
changelogLink.href = release.html_url;
changelogLink.style.display = "";
}
cards.forEach((card) => {
const suffix = card.dataset.asset;
if (!suffix) return;
const match = (release.assets ?? []).find((a) => a.name.endsWith(`-${suffix}`));
if (match) {
card.href = match.browser_download_url;
} else {
card.href = RELEASES_URL;
}
});
} catch {
if (versionLabel) {
versionLabel.textContent = "Could not load release info.";
}
cards.forEach((card) => {
card.href = RELEASES_URL;
});
}
}
init();
</script>
<style>
.main {
padding: 8vh 1.5rem 4rem;
}
/* ── Heading ── */
.heading {
font-weight: 500;
font-size: clamp(1.75rem, 4vw, 2.75rem);
letter-spacing: -0.035em;
line-height: 1.15;
text-align: center;
margin-bottom: 0.5rem;
opacity: 0;
animation: fade-in 1s ease-out forwards;
}
.subheading {
font-size: 0.9rem;
color: var(--fg-dim);
margin-bottom: 3.5rem;
opacity: 0;
animation: fade-in 1s ease-out 0.1s forwards;
display: flex;
align-items: center;
gap: 0.75rem;
}
.changelog-link {
color: var(--fg-muted);
font-size: 0.8rem;
text-decoration: underline;
text-decoration-color: rgba(161, 161, 170, 0.4);
text-underline-offset: 3px;
transition: color 0.3s ease, text-decoration-color 0.3s ease;
}
.changelog-link:hover {
color: var(--fg);
text-decoration-color: var(--fg);
}
/* ── Platforms ── */
.platforms {
width: 100%;
max-width: 720px;
display: flex;
flex-direction: column;
gap: 2.5rem;
opacity: 0;
animation: fade-in 1s ease-out 0.2s forwards;
}
.platform-section {
display: flex;
flex-direction: column;
gap: 0.75rem;
}
.platform-header {
display: flex;
align-items: center;
gap: 0.6rem;
padding-bottom: 0.5rem;
border-bottom: 1px solid var(--border);
}
.platform-icon {
width: 1.15em;
height: 1.15em;
color: var(--fg-muted);
flex-shrink: 0;
}
.platform-name {
font-weight: 500;
font-size: 1.1rem;
letter-spacing: -0.01em;
}
/* ── Download cards ── */
.download-cards {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 0.5rem;
}
.download-card {
display: flex;
flex-direction: column;
gap: 0.2rem;
padding: 0.85rem 1rem;
border-radius: 10px;
border: 1px solid var(--border);
background: rgba(255, 255, 255, 0.02);
transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}
.download-card:hover {
background: rgba(255, 255, 255, 0.06);
border-color: rgba(255, 255, 255, 0.15);
transform: translateY(-1px);
}
.download-card:active {
transform: translateY(0);
}
.card-arch {
font-weight: 600;
font-size: 0.95rem;
}
.card-format {
font-size: 0.8rem;
color: var(--fg-dim);
}
/* ── Releases link ── */
.releases-link {
margin-top: 3rem;
font-size: 0.825rem;
color: var(--fg-dim);
opacity: 0;
animation: fade-in 1s ease-out 0.35s forwards;
}
.releases-link a {
color: var(--fg-muted);
text-decoration: underline;
text-decoration-color: rgba(161, 161, 170, 0.4);
text-underline-offset: 3px;
transition: color 0.3s ease, text-decoration-color 0.3s ease;
}
.releases-link a:hover {
color: var(--fg);
text-decoration-color: var(--fg);
}
/* ── Mobile ── */
@media (max-width: 640px) {
.main {
padding: 5vh 1.25rem 4rem;
}
.platforms {
padding: 0 0.25rem;
}
.download-cards {
grid-template-columns: 1fr;
}
}
</style>
-237
View File
@@ -1,237 +0,0 @@
---
import Layout from "../layouts/Layout.astro";
---
<Layout>
<h1 class="tagline">T3 Code is the best way to code with AI.</h1>
<a
id="download-btn"
href="https://github.com/pingdotgg/t3code/releases"
class="hero-button"
>
<svg class="hero-button-icon hero-button-icon--apple" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 814 1000" aria-hidden="true"><path fill="currentColor" d="M788.1 340.9c-5.8 4.5-108.2 62.2-108.2 190.5 0 148.4 130.3 200.9 134.2 202.2-.6 3.2-20.7 71.9-68.7 141.9-42.8 61.6-87.5 123.1-155.5 123.1s-85.5-39.5-164-39.5c-76.5 0-103.7 40.8-165.9 40.8s-105.6-57-155.5-127C46.7 790.7 0 663 0 541.8c0-194.4 126.4-297.5 250.8-297.5 66.1 0 121.2 43.4 162.7 43.4 39.5 0 101.1-46 176.3-46 28.5 0 130.9 2.6 198.3 99.2zm-234-181.5c31.1-36.9 53.1-88.1 53.1-139.3 0-7.1-.6-14.3-1.9-20.1-50.6 1.9-110.8 33.7-147.1 75.8-28.5 32.4-55.1 83.6-55.1 135.5 0 7.8 1.3 15.6 1.9 18.1 3.2.6 8.4 1.3 13.6 1.3 45.4 0 102.5-30.4 135.5-71.3z"/></svg>
<svg class="hero-button-icon hero-button-icon--windows" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 88 88" aria-hidden="true"><path fill="currentColor" d="m0 12.402 35.687-4.86.016 34.423-35.67.203zm35.67 33.529.028 34.453L.028 75.48.026 45.7zm4.326-39.025L87.314 0v41.527l-47.318.376zm47.329 39.349-.011 41.34-47.318-6.678-.066-34.739z"/></svg>
<svg class="hero-button-icon hero-button-icon--linux" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 295" aria-hidden="true"><defs><linearGradient id="lt0" x1="48.548%" x2="51.047%" y1="115.276%" y2="41.364%"><stop offset="0%" stop-color="#FFEED7"/><stop offset="100%" stop-color="#BDBFC2"/></linearGradient><linearGradient id="lt6" x1="49.984%" x2="49.984%" y1="89.845%" y2="40.632%"><stop offset="0%" stop-color="#FFEED7"/><stop offset="100%" stop-color="#BDBFC2"/></linearGradient><linearGradient id="lt8" x1="49.841%" x2="50.241%" y1="13.229%" y2="94.673%"><stop offset="0%" stop-color="#FFF" stop-opacity=".8"/><stop offset="100%" stop-color="#FFF" stop-opacity="0"/></linearGradient><linearGradient id="ltc" x1="53.467%" x2="38.949%" y1="48.921%" y2="98.1%"><stop offset="0%" stop-color="#FFA63F"/><stop offset="100%" stop-color="#FF0"/></linearGradient><linearGradient id="lte" x1="30.581%" x2="65.887%" y1="34.024%" y2="89.175%"><stop offset="0%" stop-color="#FFA63F"/><stop offset="100%" stop-color="#FF0"/></linearGradient><linearGradient id="lti" x1="49.733%" x2="50.558%" y1="17.609%" y2="99.385%"><stop offset="0%" stop-color="#FFA63F"/><stop offset="100%" stop-color="#FF0"/></linearGradient></defs><g fill="none"><path fill="#000" d="M63.213 215.474c-11.387-16.346-13.591-69.606 12.947-102.39C89.292 97.383 92.69 86.455 93.7 71.67c.734-16.805-11.846-66.851 35.537-70.616 48.027-3.857 45.364 43.526 45.088 68.596-.183 21.12 15.52 33.15 26.355 49.68 19.927 30.303 18.274 82.461-3.765 110.745-27.916 35.354-51.791 20.018-67.678 21.304-29.752 1.745-30.762 17.54-66.024-35.905"/><path fill="url(#lt6)" d="M81.027 145.684c6.52-14.785 20.386-40.772 20.662-60.883 0-15.978 47.843-19.835 51.7-3.856 3.856 15.978 13.59 39.853 19.834 51.424 6.245 11.478 24.335 48.118 5.051 80.074-17.356 28.284-69.973 50.69-98.073-3.856-9.55-18.917-7.806-42.333.826-62.903"/><path fill="url(#lt8)" d="M166.428 151.285c0 16.162-15.519 37.1-42.15 36.916-27.456.183-39.118-20.754-39.118-36.916 0-16.161 18.182-29.293 40.588-29.293 22.498.092 40.68 13.132 40.68 29.293"/><path fill="#000" stroke="#000" stroke-width=".977" d="M176.805 117.86c13.59 11.02 38.292 49.587 2.204 74.748-11.846 7.806 10.468 32.508 23.049 19.927 43.618-43.894-1.102-94.308-16.53-111.664-13.774-15.151-25.987 3.49-8.723 16.989z"/><path fill="#000" stroke="#000" stroke-width="1.25" d="M79.925 122.727c-8.907 14.509-30.211 48.669-1.652 66.484 38.384 23.6 27.548 47.108-7.53 25.895-49.404-29.568-5.97-89.257 13.774-112.03 22.59-25.529 4.316 4.683-4.592 19.65z"/><path fill="url(#ltc)" stroke="#E68C3F" stroke-width="6.25" d="M51.835 258.542c-20.57-10.928-50.414 2.112-39.578-27.457 2.204-6.704-3.214-16.805.275-23.325 4.133-7.989 13.04-6.244 18.366-11.57 5.234-5.51 8.54-15.06 18.366-13.59 9.734 1.468 16.254 13.406 23.049 28.099 5.05 10.468 22.865 25.253 21.672 37.007-1.47 17.998-21.948 21.396-42.15 10.836z" transform="translate(10)"/><path fill="url(#lte)" stroke="#E68C3F" stroke-width="6.251" d="M194.445 253.49c15.06-18.273 48.578-14.508 25.988-39.577-4.775-5.418-3.306-16.989-9.183-21.947-6.887-6.061-14.509-1.102-21.488-4.224-6.979-3.398-14.325-9.918-22.865-5.327-8.54 4.684-9.459 16.805-10.285 32.783-.735 11.479-11.203 30.671-5.602 41.231 8.081 16.346 29.11 14.142 43.435-2.938z" transform="translate(10)"/><path fill="url(#lti)" stroke="#E68C3F" stroke-width="3.75" d="M97.107 66.344c3.673-3.398 12.58-13.774 29.477-2.939 3.122 2.02 5.693 2.204 11.662 4.775 12.03 4.96 6.336 16.897-6.52 20.937-5.51 1.745-10.468 8.449-20.386 7.806-8.54-.46-10.744-6.06-15.978-9.091-9.275-5.234-10.652-12.305-5.602-16.07 5.051-3.765 6.98-5.143 7.347-5.418z" transform="translate(10)"/><path fill="#000" d="M133.186 57.712c-.092 5.234 2.48 9.458 5.877 9.458 3.306 0 6.153-4.224 6.245-9.366.091-5.234-2.48-9.459-5.878-9.459-3.397 0-6.152 4.225-6.244 9.367m-21.212.092c.459 4.316-1.194 7.989-3.582 8.356-2.387.276-4.683-2.938-5.142-7.254-.46-4.316 1.194-7.99 3.581-8.357 2.388-.275 4.684 2.939 5.143 7.255"/></g></svg>
<span id="download-label">Download now</span>
</a>
<a href="/download" class="other-platforms">Other platforms</a>
<div class="screenshot-wrap">
<img src="/screenshot.jpeg" alt="T3 Code" class="screenshot" />
</div>
</Layout>
<script>
import { fetchLatestRelease, RELEASES_URL, type ReleaseAsset } from "../lib/releases";
type Platform = { os: "mac" | "win" | "linux"; label: string; arch?: string };
function detectPlatform(): Platform | null {
const ua = navigator.userAgent;
if (/Win/i.test(ua)) return { os: "win", label: "Download for Windows" };
if (/Mac/i.test(ua)) {
return {
os: "mac",
label: `Download for macOS`,
arch: "arm64",
};
}
if (/Linux/i.test(ua)) return { os: "linux", label: "Download for Linux" };
return null;
}
function pickAsset(assets: ReleaseAsset[], platform: Platform): string | null {
if (platform.os === "win") {
return (
assets.find((a) => a.name.endsWith("-x64.exe"))
?.browser_download_url ?? null
);
}
if (platform.os === "mac") {
const preferred = assets.find((a) =>
a.name.endsWith(`-${platform.arch}.dmg`),
);
const fallback = assets.find((a) => a.name.endsWith(".dmg"));
return (preferred ?? fallback)?.browser_download_url ?? null;
}
if (platform.os === "linux") {
return (
assets.find((a) => a.name.endsWith(".AppImage"))
?.browser_download_url ?? null
);
}
return null;
}
async function init() {
const btn = document.getElementById("download-btn") as HTMLAnchorElement | null;
const label = document.getElementById("download-label");
if (!btn || !label) return;
const platform = detectPlatform();
if (!platform) return;
document.documentElement.dataset.platform = platform.os;
label.textContent = platform.label;
try {
const release = await fetchLatestRelease();
const url = pickAsset(release.assets ?? [], platform);
if (url) {
btn.href = url;
btn.removeAttribute("target");
btn.removeAttribute("rel");
}
} catch {
btn.href = RELEASES_URL;
}
}
init();
</script>
<style>
.main {
padding-top: 10vh;
}
/* ── Tagline ── */
.tagline {
font-weight: 500;
font-size: clamp(2rem, 5vw, 3.5rem);
letter-spacing: -0.035em;
line-height: 1.15;
text-align: center;
margin: 0 0 6vh;
opacity: 0;
animation: fade-in 1s ease-out forwards;
}
/* ── Hero button ── */
.hero-button {
display: inline-flex;
align-items: center;
gap: 0.55rem;
background: #fafafa;
color: #09090b;
padding: 0.75rem 2rem;
border-radius: 999px;
font-weight: 600;
font-size: 0.9rem;
margin-bottom: 1.25rem;
opacity: 0;
animation: fade-in 1s ease-out 0.15s forwards;
transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.hero-button:hover {
transform: scale(1.03);
box-shadow: 0 0 24px rgba(255, 255, 255, 0.08);
}
.hero-button:active {
transform: scale(0.98);
}
.hero-button-icon {
display: none;
width: 1em;
height: 1em;
flex-shrink: 0;
}
:global([data-platform="mac"]) .hero-button-icon--apple {
display: block;
}
:global([data-platform="win"]) .hero-button-icon--windows {
display: block;
}
:global([data-platform="linux"]) .hero-button-icon--linux {
display: block;
}
/* ── Other platforms link ── */
.other-platforms {
font-size: 0.825rem;
color: var(--fg-dim);
margin-bottom: 5vh;
opacity: 0;
animation: fade-in 1s ease-out 0.3s forwards;
transition: color 0.3s ease;
text-decoration: underline;
text-decoration-color: rgba(113, 113, 122, 0.4);
text-underline-offset: 3px;
}
.other-platforms:hover {
color: var(--fg-muted);
text-decoration-color: var(--fg-muted);
}
/* ── Screenshot ── */
.screenshot-wrap {
margin: 0 auto;
width: min(95vw, 1400px);
opacity: 0;
transform: scale(0.98);
animation: screenshot-in 1s ease-out 0.15s forwards;
}
.screenshot {
width: 100%;
display: block;
border-radius: 16px;
border: 1px solid rgba(255, 255, 255, 0.06);
mask-image: linear-gradient(to bottom, black 80%, transparent 100%);
-webkit-mask-image: linear-gradient(to bottom, black 80%, transparent 100%);
}
.screenshot-wrap::after {
content: "";
display: block;
width: 100%;
height: 120px;
background: inherit;
margin-top: -1px;
opacity: 0.04;
transform: scaleY(-1);
mask-image: linear-gradient(to bottom, black 0%, transparent 60%);
-webkit-mask-image: linear-gradient(to bottom, black 0%, transparent 60%);
pointer-events: none;
}
@keyframes screenshot-in {
from {
opacity: 0;
transform: scale(0.98);
}
to {
opacity: 1;
transform: scale(1);
}
}
/* ── Mobile ── */
@media (max-width: 640px) {
.main {
padding-top: 7vh;
}
.tagline {
margin-bottom: 4vh;
}
.screenshot-wrap {
width: 95vw;
}
}
</style>
-3
View File
@@ -1,3 +0,0 @@
{
"extends": "astro/tsconfigs/strict"
}
+12
View File
@@ -0,0 +1,12 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>CodeThing</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
+34
View File
@@ -0,0 +1,34 @@
{
"name": "@acme/renderer",
"version": "0.0.0",
"private": true,
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview",
"typecheck": "tsc --noEmit",
"test": "vitest run --passWithNoTests"
},
"dependencies": {
"@acme/contracts": "workspace:*",
"highlight.js": "^11.11.1",
"lucide-react": "^0.563.0",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"react-markdown": "^10.1.0",
"rehype-highlight": "^7.0.2",
"remark-gfm": "^4.0.1",
"zod": "^3.24.1"
},
"devDependencies": {
"@tailwindcss/vite": "^4.0.0",
"@types/react": "^19.0.0",
"@types/react-dom": "^19.0.0",
"@vitejs/plugin-react": "^4.3.4",
"babel-plugin-react-compiler": "^19.0.0-beta-e552027-20250112",
"tailwindcss": "^4.0.0",
"typescript": "^5.7.3",
"vite": "^6.0.5"
}
}
+140
View File
@@ -0,0 +1,140 @@
import { useEffect, useRef } from "react";
import ChatView from "./components/ChatView";
import DiffPanel from "./components/DiffPanel";
import Sidebar from "./components/Sidebar";
import { readNativeApi } from "./session-logic";
import { StoreProvider, useStore } from "./store";
function EventRouter() {
const api = readNativeApi();
const { dispatch } = useStore();
const activeAssistantItemRef = useRef<string | null>(null);
useEffect(() => {
if (!api) return;
return api.providers.onEvent((event) => {
dispatch({
type: "APPLY_EVENT",
event,
activeAssistantItemRef,
});
});
}, [api, dispatch]);
return null;
}
function BootstrapRouter() {
const api = readNativeApi();
const { dispatch } = useStore();
useEffect(() => {
if (!api) return;
let cancelled = false;
void api.app
.bootstrap()
.then((bootstrap) => {
if (cancelled) return;
dispatch({
type: "BOOTSTRAP_FROM_SERVER",
bootstrap,
});
})
.catch((error) => {
if (cancelled) return;
dispatch({
type: "SET_RUNTIME_ERROR",
error:
error instanceof Error
? error.message
: "Could not connect to the local t3 runtime.",
});
});
return () => {
cancelled = true;
};
}, [api, dispatch]);
return null;
}
function RuntimeHealthRouter() {
const api = readNativeApi();
const { dispatch } = useStore();
useEffect(() => {
if (!api) return;
let cancelled = false;
const checkHealth = async () => {
try {
await api.app.health();
if (cancelled) return;
dispatch({ type: "SET_RUNTIME_ERROR", error: null });
} catch (error) {
if (cancelled) return;
dispatch({
type: "SET_RUNTIME_ERROR",
error:
error instanceof Error
? error.message
: "Could not connect to the local t3 runtime.",
});
}
};
void checkHealth();
const interval = window.setInterval(() => {
void checkHealth();
}, 8_000);
return () => {
cancelled = true;
window.clearInterval(interval);
};
}, [api, dispatch]);
return null;
}
function Layout() {
const api = readNativeApi();
const { state } = useStore();
if (!api) {
return (
<div className="flex h-screen flex-col bg-background text-foreground">
<div className="drag-region h-[52px] shrink-0" />
<div className="flex flex-1 items-center justify-center">
<p className="text-sm text-muted-foreground">Local t3 runtime unavailable.</p>
</div>
</div>
);
}
return (
<div className="flex h-screen overflow-hidden bg-background text-foreground">
<BootstrapRouter />
<RuntimeHealthRouter />
<EventRouter />
{state.runtimeError && state.projects.length === 0 && (
<div className="pointer-events-none fixed right-4 top-4 z-50 max-w-[440px] rounded-lg border border-rose-400/30 bg-rose-500/10 px-3 py-2 text-xs text-rose-100">
Runtime connection failed: {state.runtimeError}
</div>
)}
<Sidebar />
<ChatView />
{state.diffOpen && <DiffPanel />}
</div>
);
}
export default function App() {
return (
<StoreProvider>
<Layout />
</StoreProvider>
);
}
@@ -0,0 +1,28 @@
import type { Components } from "react-markdown";
import ReactMarkdown from "react-markdown";
import rehypeHighlight from "rehype-highlight";
import remarkGfm from "remark-gfm";
interface ChatMarkdownProps {
text: string;
}
const markdownComponents: Components = {
a({ node: _node, ...props }) {
return <a {...props} target="_blank" rel="noreferrer" />;
},
};
export default function ChatMarkdown({ text }: ChatMarkdownProps) {
return (
<div className="chat-markdown text-sm leading-relaxed text-foreground/80">
<ReactMarkdown
remarkPlugins={[remarkGfm]}
rehypePlugins={[[rehypeHighlight, { detect: true, ignoreMissing: true }]]}
components={markdownComponents}
>
{text}
</ReactMarkdown>
</div>
);
}
Loaded 100 of 614 files, more files were not shown because too many files have changed in this diff. Show more