Dashboard › opencode › Distillation
8f5ca132-b770-48e2-bf05-35f1342e967d["lore_tm_v1_OcgHub10i_CAvgwKY4U9edQ9n4hH_724AMWggbn3VbM","lore_tm_v1_9eZ240uJr8vJSZ7EFUfB4Rsx-F3U9MfUuwv0xkZUkC4","lore_tm_v1_XfVb1AeYYOI0KGPGeRq1elcoxb65fyPdNPkjQxG8qIs","lore_tm_v1_DaVtD2SmQ_adSXRsFABGEyndR-QppI5RYNCmyo93gRo","lore_tm_v1_mlpd0e9nRcoVbLW064VAeOidV38z2yvmqeBkR7MoYLc","lore_tm_v1_n_Hmxp-jlvDsk7T9RVZTZE-BOJujcIVzCWRG4DWE-iM","lore_tm_v1_JsacpQpCzdoRtCZd_Npjs6MqIQbkPIaIK_PESB1SPcU","lore_tm_v1_mbaG5pU08I4uiyDRXqSnnpOKNrHje6bWLFt7CJFTKBg","lore_tm_v1_baMtyZwKB2MffJC3sNPe5k0_nLUsvmcBUHrBrPLtsrM","lore_tm_v1_rMWp6j8FtFNHzHKCCCa37qk43gr15l_ZYsYEySFXTfI","lore_tm_v1_oeBb86pN7o-euvWjXO3L6RxQnMT5uc71qojCSq_98aE","lore_tm_v1_FHNuzvomopwHxc8KC_ZhU92sjFo-1X42WeAznre4StI"]
/home/byk/Code/opencode-v2-pilot/packages/plugin/test/host.test.ts./home/byk/Code/opencode-v2-pilot/packages/core/src/session/model-request.ts defines HookScope with sessionID: SessionSchema.ID, agent: Agent.ID, model: Model.Ref, and kind: SessionRequestKind.sessionHeaders() emits "x-session-affinity", "X-Session-Id", optional "x-parent-session-id", "User-Agent", "x-opencode-project", "x-opencode-session", and "x-opencode-client"; promptCacheKey() strips the ses_ prefix only from session IDs matching /^ses_[0-9a-f]{64}$/.applyModelHooks() triggers "session" / "model.request" with mutable baseURL and copied headers, then updates the model route when event.baseURL changes and reconstructs HttpOptions with the original body/query and hook-mutated headers.httpMiddleware() exposes outbound exchanges through web-standard Request/Response: it triggers "session" / "http.request", preserves a request body by cloning it into a Uint8Array, calls the handler, triggers "session" / "http.response", treats status codes 204, 205, and 304 as bodyless, and maps non-Error causes to new Error(String(cause)).SessionModelRequest.prepare creates hook-editable context fields system, messages, tools, generation: {}, and providerOptions: {}. Tool definitions may be edited, renamed, moved, or removed; object identity takes precedence over key matching so a renamed definition still executes its canonical tool, while hook-invented definitions matching neither identity nor key are dropped.SessionModelRequest.prepare uses contextAgentID ?? agentID for the "session" / "context" hook, but uses agentID for model and HTTP hook scope. It can skip context hooks when input.contextHooks === false.session.fork?.sessionID ?? session.id for promptCacheKey, pass transformed system/messages/tools and optional generation/provider options, and die with Error("Provider context is incompatible with the route selected by model request hooks") when a routing hook moves a request with an opaque compaction window to an incompatible provider context.hooks.has("session", "http.request", providerID) or hooks.has("session", "http.response", providerID) is true. Responses WebSocket transport is used only when capability responsesWebsockets === true, the provider flag resolves true, input.webSocket === "session", and no matching HTTP hooks exist./home/byk/Code/opencode-v2-pilot/packages/core/src/agent.ts defines defaultID = ID.make("build"); the agent editor supports list, get, default, update, and remove, while the service supports get, resolve, select, and list.external_directory access to path.join(global.data, "shell", "*", "*"), path.join(global.data, "tool-output", "*"), path.join(global.tmp, "*"), and path.join(global.config, "*").mode === "subagent" or hidden === true; selection priority is the configured default, then agent "build", then the first selectable agent. list() moves the selected default to the front, and select() falls back to ID "build" even if no selectable agent info exists./home/byk/Code/opencode-v2-pilot/packages/core/src/plugin/supervisor.ts states: βThe new revision never became a generation, so the one already running keeps its place.β This establishes that a failed new revision never became a generation and must not displace the running generation./home/byk/Code/opencode-v2-pilot/packages/core/src/plugin.ts maintains one index-aligned Slot per requested plugin definition, including setup failures, so a failed revision is not retried until its revision changes. Plugin IDs are normalized with Plugin.ID.make(), and duplicate IDs defect with Error(\Duplicate plugin ID: ${definition.id}`)`.Semaphore.makeUnsafe(1) plus a Latch readiness hold tracked by tokens in pending. holdUnsafe() closes readiness while tokens remain; release removes its token and reopens readiness only when pending.size === 0.State.group(), inherited state, plugin-specific storage, and span "Plugin.load". A transform failure records Plugin disabled after ${failure.state}.transform failed. Check server logs for details. with an err_ reference built from the first 8 characters of a UUID and queues a PendingFailure."failed to restore plugin; deactivating".Effect.ensuring(...) with Effect.forkScoped({ startImmediately: true }), including when an inventory observer fails.Activation, preventing an old queue item from disabling a replacement. Under the lock it rebuilds inventory, runs State.batch(item.refresh), publishes Plugin.Event.Updated, and logs refresh/report/cleanup failures separately before ensuring item.release.closed = true, clears pending readiness tokens, opens the readiness latch, clears active slots, and performs State.shutdown(Scope.close(scope, exit))./home/byk/Code/opencode-v2-pilot/packages/sdk/test/import-boundaries.test.ts test "bundles the Promise and Effect clients with the in-memory host" bundles @opencode/sdk and @opencode/sdk/effect and requires both bundles to include inputs from packages/client, packages/core, and packages/server.build, --target=bun, --format=esm, --packages=bundle, --metafile=${metafile}, and --outdir=${join(temporary, "out")}; it parses metadata.inputs and always removes the temporary directory recursively with force: true./home/byk/Code/opencode-lore/packages/opencode/tsconfig.json extends ../../tsconfig.base.json, sets "noEmit": true, "types": ["bun"], maps "@loreai/core" to ["../core/src/index.ts"], and includes ["src", "test", "script", "scripts", "eval"]./home/byk/Code/opencode-v2-pilot/packages/sdk/test/instances-effect.test.ts defines a test model "instance-model" from provider "test" using OpenAIChat.route, with capabilities { tools: true, input: ["text"], output: ["text"] }, empty cost, and limits { context: 200_000, output: 8_192 }."reconstructs configured instances before automatic recovery executes tools" configures persisted sessions in sessions.db, app metadata { name: "instance-test", version: "1.2.3" }, events persistence, no model fetching, and no file watching. Instance keys come from metadata field threadID."thread-tools", grants agent "build" permission { action: "*", resource: "*", effect: "allow" }, sets event.generation.temperature = 0.25, and adds tool "thread_echo" with description "Report the configured thread", empty struct input, Schema.String output, and { codemode: false }."thread_echo" records its configuration generation, renames the session to ${key}:${generation}, and returns { output: key, content: key }. Recovery expects configurations ["thread-recovery", "thread-recovery"], execution only in generation [2], title "thread-recovery:2", and exactly 3 LLM requests each with temperature 0.25 and tools ["thread_echo"]; scopes close in order [1, 2]. Test timeout is 15_000 ms."qualifies application keys by workspace and reselects a moved Session" creates 2 memory workspaces and 2 sessions with the same instance key "same-thread". Plugin "placement-hook" captures ctx.location and appends :${ctx.location.workspaceID} to prompt text."same-thread" twice, once per workspace. After moving the first session into the second workspace, its next prompt becomes Moved:${secondWorkspace}, its location reports the second workspace, and no third instance configuration occurs."configures instances from services provided to the SDK layer" defines service Personas with of(threadID), supplies persona-for-${threadID}, and configures plugin "persona" to append that persona to prompt text."thread-7" instance construction fails with Error("Persona store cold"), immediately releases "thread-7:1", and leaves the host running. A second attempt succeeds and changes "Hello" to "Hello:persona-for-thread-7"; host closure then releases "thread-7:2". Test timeout is 15_000 ms./home/byk/Code/opencode-v2-pilot/packages/plugin/src/effect/plugin.ts defines Effect plugin Context with app, location, options, agent, aisdk, catalog, command, event, experimental.terminal.read, integration, mcp, generate, permission, plugin.list, reference, rpc, session, shell, skill, storage, tool, vcs, websearch, and worktree.Plugin<R = Scope.Scope> has id: string and effect: (context: Context) => Effect.Effect<void, never, R>; define<R = Scope.Scope>() returns the plugin unchanged./home/byk/Code/opencode-v2-pilot/packages/core/src/plugin/hooks.ts supports domains aisdk, session, permission, shell, and tool. Only tool.execute.before may fail through ToolFailures; all other hook failure channels are never.ModelHookOptions. Provider filtering derives providerID from event.model.providerID; trigger() invokes callbacks in registration order and skips entries whose explicit provider differs, while has() returns true for either an unfiltered callback or a callback matching the requested provider.PluginHooks.register() stores callbacks under ${domain}.${name}, attaches disposal to the current Scope.Scope, and returns { dispose }; disposal is idempotent and deletes the map key when its last callback is removed./home/byk/Code/opencode-v2-pilot/packages/plugin/src/promise/index.ts exports PluginOptions, StorageEntry, StorageScanOptions, StorageScanResult, and Plugin, plus schema namespaces in exact order: 1. Agent, 2. Command, 3. Connection, 4. Credential, 5. Integration, 6. Location, 7. Mcp, 8. Model, 9. PersistentPty, 10. Provider, 11. Reference, 12. Rpc, 13. Skill, 14. Vcs, 15. WebSearch, 16. Worktree.