|
1 | | -- To regenerate the JavaScript SDK, run `./packages/sdk/js/script/build.ts`. |
| 1 | +- To regenerate the legacy JavaScript SDK, run `./packages/sdk/js/script/build.ts`. |
| 2 | +- After changing the public Protocol or Server `HttpApi`, run `bun run generate` from `packages/client`. Do not edit `src/generated` or `src/generated-effect` directly. |
| 3 | +- Keep runtime dependencies directed from Schema to Core and Protocol, then from Core and Protocol to Server. Client runtime code may depend on Schema and Protocol but never Core or Server; `sdk-next` composes Client, Core, and Server. |
2 | 4 | - ALWAYS USE PARALLEL TOOLS WHEN APPLICABLE. |
3 | 5 | - Prefer automation: execute requested actions without confirmation unless blocked by missing info or safety/irreversibility. |
4 | 6 | - The default branch in this fork is `main`; upstream's default branch is `dev`. |
@@ -29,6 +31,7 @@ Examples: `fix(tui): simplify thinking toggle styling`, `docs: update contributi |
29 | 31 | - Rely on type inference when possible; avoid explicit type annotations or interfaces unless necessary for exports or clarity |
30 | 32 | - Prefer functional array methods (flatMap, filter, map) over for loops; use type guards on filter to maintain type inference downstream |
31 | 33 | - In `src/config`, follow the existing self-export pattern at the top of the file (for example `export * as ConfigAgent from "./agent"`) when adding a new config module. |
| 34 | +- In Effect generators, bind services to named variables before calling methods. Do not use nested service yields such as `yield* (yield* Foo.Service).bar()`. |
32 | 35 |
|
33 | 36 | Reduce total variable count by inlining when a value is only used once. |
34 | 37 |
|
@@ -138,7 +141,7 @@ const table = sqliteTable("session", { |
138 | 141 |
|
139 | 142 | ## Testing |
140 | 143 |
|
141 | | -- Avoid mocks as much as possible |
| 144 | +- Avoid mocks as much as possible, you shouldn't be using globalThis.\* at all unless it's the only option. |
142 | 145 | - Test actual implementation, do not duplicate logic into tests |
143 | 146 | - Tests cannot run from repo root (guard: `do-not-run-tests-from-root`); run from package dirs like `packages/opencode`. |
144 | 147 |
|
@@ -226,7 +229,7 @@ runs this filtered command. |
226 | 229 | - Keep `SessionExecution` process-global and Session-ID based. Its local implementation owns the process-local Session coordinator and discovers placement through `SessionStore` plus `LocationServiceMap.get(session.location)` only when a drain starts; no layer should take a Session ID. V2 interruption targets the active process-local ownership chain for that Session; idle or missing interruption is a no-op. |
227 | 230 | - Keep `SessionRunner`, model resolution, tool registry, permissions, and filesystem Location-scoped. Omitted `Location.workspaceID` means implicit-local placement; explicit workspace identity remains reserved for future placement semantics. |
228 | 231 | - Preserve one explicit `llm.stream(request)` call per provider turn and reload projected history before durable continuation. Do not bridge through legacy `SessionPrompt.loop(...)` or delegate orchestration to an in-memory tool loop. |
229 | | -- Keep local Session drains process-local until clustering is implemented. `SessionRunCoordinator` joins explicit same-Session resumes, coalesces prompt wakeups, and allows different Sessions to run concurrently. Advisory wakes drain eligible durable inbox rows only; post-crash activity recovery requires a separate explicit design before it may retry provider work. |
230 | | -- Keep delivery vocabulary explicit. Prompts steer by default and coalesce into the active activity at the next safe provider-turn boundary. Explicit `queue` inputs open FIFO future activities one at a time after the active activity settles. |
| 232 | +- Keep local Session drains process-local until clustering is implemented. `SessionRunCoordinator` joins explicit same-Session resumes, coalesces prompt wakeups, and allows different Sessions to run concurrently. Advisory wakes drain eligible durable inbox rows only; post-crash continuation recovery requires a separate explicit design before it may retry provider work. A drain has no durable identity or transcript boundary. |
| 233 | +- Keep delivery vocabulary explicit. Prompts steer by default and promote at the next safe provider-turn boundary while the current drain requires continuation. An explicit `queue` input remains pending until the Session would otherwise become idle; promote one queued input at that boundary, then reevaluate continuation before promoting another. Promoting any new user input resets the selected agent's provider-turn allowance; a batch of steers resets it once. |
231 | 234 | - Keep EventV2 replay owner claims separate from clustered Session execution ownership. |
232 | 235 | - Keep the System Context algebra, registry, and built-ins in `src/system-context`; keep Context Source producers with their observed domains, and keep Session History selection plus Context Epoch persistence Session-owned. |
0 commit comments