Dashboard › opencode › Distillation
8e008bbb-7177-4285-883d-55d5a787187c["lore_tm_v1_AKXKf6OmR3tQ9DSkZfmlPT5or5iZIzfI0pCMvaM3Ru0","lore_tm_v1_aPKeRTH0CYlOQfLKbtsuc2pBNrtSkMpn8LC_-3EkIb8","lore_tm_v1_SAv_6JxZAJOxW_hrrtkWWBkElUk9njqAa8-gBIrR3LI","lore_tm_v1_iJMeoVJ0ceL6H1jG5_T_Amx-9vgw7BiUZ5AtAQkfPZU","lore_tm_v1_3mNa7H8mR0hLvEcXnGvyhR4AT2rqeSq7wXufvjlJb0M","lore_tm_v1_U63oPqjrPuXt6kcjIw2aFw5UHCt_DQNbRpw0X2Na1GE","lore_tm_v1_GeOWAVGvOfz-1OMQkQevi-u931XXCAVvlJYNRyaCbS0","lore_tm_v1_CAEHEqcdLKcffI8fV_EEBUteSjVaZCor5-iky5n_xPw","lore_tm_v1_biWsWiVHua2xyHT2RgQplh_4S4W-aJrDkzoagyh8Fk4"]
Date: Sep 14, 2026
/home/byk/Code/opencode/packages/sdk-next/src/opencode.ts defines create as Effect.fn("OpenCode.create"); it obtains Scope.Scope, creates a Layer.makeMemoMap, and builds AppNodeBuilder.build(LayerNode.group([ApplicationTools.node, PermissionSaved.node])) with Layer.buildWithMemoMap(...).create extracts ApplicationTools.Service and PermissionSaved.Service, then acquires an embedded web handler via HttpRouter.toWebHandler(createEmbeddedRoutes().pipe(HttpRouter.provideRequest(Layer.succeed(PermissionSaved.Service, permissions)), Layer.provide(HttpServer.layerServices)), { disableLogger: true, memoMap }); release calls Effect.promise(web.dispose)./home/byk/Code/opencode/packages/sdk-next/src/opencode.ts implements a custom fetch by passing new Request(input, init) to web.handler, adds preconnect: () => undefined, and creates the client with OpenCode.make({ baseUrl: "http://opencode.local" }), FetchHttpClient.layer, and FetchHttpClient.Fetch.create result spreads the OpenCode client and exposes tools: { register: tools.register }; Interface is Effect.Success<ReturnType<typeof create>>, Service uses identifier "@opencode-ai/sdk-next/OpenCode", and layer is Layer.effect(Service, create())./home/byk/Code/opencode/specs/v2/session.md specifies sessions.create({ id?, location, ... }) and sessions.prompt({ id?, sessionID, prompt, delivery?, resume? }); session interruption affects active execution on the current process.SessionExecution and read-side SessionStore process-global, while SessionRunner, catalog, model resolver, tool registry, permission state, and filesystem are cached per Location; no layer takes a Session ID. Omitted Location.workspaceID means implicit-local placement, while explicit workspace identity is reserved for future placement semantics.running from a previous process with Tool execution interrupted before assembling the next provider request.llm.stream(request) per provider turn, durably projects each complete local tool call before eagerly starting its structured child execution, awaits every started tool fiber after provider-stream closure, and reloads projected history once before continuation.Location initializes a complete baseline on its next run.sessions.active() and includes only foreground Session drains owned by the current process; background subagents and tasks do not add parent Sessions. This snapshot is runtime-only and is empty after process restart./home/byk/Code/opencode/packages/core/src/session/runner/llm.ts found provider-turn continuation support marked complete for durable user steering during an active provider turn, while continuation for compaction or another required continuation condition remained unchecked in the file comment./home/byk/Code/opencode/packages/core/src/session/runner/llm.ts defines TurnTransitionError variants { _tag: "ContinueAfterCompaction"; step: number } and { _tag: "ContinueAfterOverflowCompaction"; step: number }, helper constructors continueAfterCompaction(step) and an overflow counterpart, plus handling for "ContinueAfterOverflowCompaction" around lines 367 and 382.SessionEvent.Synthetic projected in /home/byk/Code/opencode/packages/core/src/session/projector.ts; "session.next.synthetic" handled by /home/byk/Code/opencode/packages/core/src/session/message-updater.ts; "synthetic" converted in /home/byk/Code/opencode/packages/core/src/session/runner/to-llm-message.ts; and compaction serialization in /home/byk/Code/opencode/packages/core/src/session/compaction.ts as [Synthetic context]: ${message.text}."session.next.synthetic" in /home/byk/Code/opencode/packages/schema/src/session-event.ts, generated client types in /home/byk/Code/opencode/packages/client/src/generated/types.ts and /home/byk/Code/opencode/packages/sdk/js/src/v2/gen/types.gen.ts, publishing tests in /home/byk/Code/opencode/packages/core/test/session-projector.test.ts and /home/byk/Code/opencode/packages/core/test/session-prompt.test.ts, and runtime handling in session/projector.ts and session/message-updater.ts./home/byk/Code/opencode/packages/core/test/session-projector.test.ts test "updates only the newest incomplete assistant projection" inserts msg_assistant_1 at sequence 0 and msg_assistant_2 at sequence 1, publishes SessionEvent.Step.Ended for msg_assistant_2 with timestamp DateTime.makeUnsafe(1), finish: "stop", cost: 0, and all token counts 0, then verifies the first message remains incomplete while the second receives finish: "stop" and time.completed: DateTime.makeUnsafe(1)./home/byk/Code/opencode/packages/core/test/session-projector.test.ts test "does not revive a stale incomplete assistant projection" inserts incomplete msg_assistant_stale at sequence 0 and completed msg_assistant_completed at sequence 1 with creation time 1 and completion time 2; publishing SessionEvent.Text.Started for the completed message at time 3 with textID: "text-stale" adds an empty assistant-text part only to msg_assistant_completed, while msg_assistant_stale remains incomplete with empty content.session.next.compaction.started.1 to durably identify an attempt; compaction deltas are live-only progress; and session.next.compaction.ended.1 durably stores the final summary and serialized recent context. Only the completed event projects a model-visible compaction message, so failed or interrupted attempts leave the prior history boundary active./home/byk/Code/opencode/specs/v2/session.md: a wake does not infer that ambiguous provider work is safe to retry after input promotion, while explicit run may deliberately continue from durable projected history. A future recovery slice must jointly model provider-dispatch ambiguity, required continuation, queued-input promotion, retry policy, and visible recovery status without assuming an enclosing durable execution identity./home/byk/Code/opencode/specs/v2/schema-changelog.md requires preserving full durable history while compaction changes only the active model representation, and says background bash should be reintroduced only with durable status observation, completion delivery, and explicit cancellation semantics.