Dashboard › opencode › Distillation
3e07cd54-3852-44cd-b320-21e6bcdd1327["lore_tm_v1_keYHPSAIkcljoQqq4z1l5Mzf5QJuMQ6UvlmLIjA9iCA","lore_tm_v1__NHW8so41lA0jTKpiMRhSq0PMkKlNE43Uz_9KZgLJok","lore_tm_v1_OgK1W69i93PqO7m1c-Ph-YvgjXqQxSk-NknWdhqLpeA","lore_tm_v1_4PNBZpZyWjX4HFmBkB8LjaNSR76jvD2Qv64QI2qff1c","lore_tm_v1_sxAGjhvewUoQQtljKQRj-GqfcSohEscZmZafLwJ4_Ic","lore_tm_v1_8N4wS6pME-CbvpNXeD5X7t2j8IMzhgDShvoml_WAPr8","lore_tm_v1_bPuk4Oj4U6lFUjrm9x7l1p32bzyX-RavP4TR7qos8nI","lore_tm_v1_CFb3xgshEpUEfRMnypb_u9_tsSbLs6DO1-IyDE0Iv90","lore_tm_v1_pb75jWlSScktgIrogIKHx2dOYz58lErm9BAfVl4nZfo"]
Date: Sep 14, 2026
/home/byk/Code/opencode/packages/opencode/specs/v2/message-shape.md, including the replay/resume requirement (βstored messages need enough data to replay and resume a session laterβ), tools?: Record<string, boolean>, model example { providerID: "openai", modelID: "gpt-5" }, and repeated prompt text "Summarize the tool output above and continue."/home/byk/Code/opencode/packages/opencode/specs/v2/tui-command-shim.md, /home/byk/Code/opencode/packages/opencode/specs/v2/notifications.md, and /home/byk/Code/opencode/packages/opencode/specs/v2/message-shape.md./home/byk/Code/opencode/packages/protocol/src/groups/session.ts: session.active at line 146 and session.interrupt at line 345./home/byk/Code/opencode/packages/protocol/src/groups/session.ts defines session.active as GET /api/session/active, returning Schema.Record(Session.ID, SessionActive) for foreground Session drains owned by the current OpenCode process; absent sessions are inactive. It defines session.interrupt as POST /api/session/:sessionID/interrupt, returning HttpApiSchema.NoContent; interruption affects active execution owned by the current process, while idle interruption is a no-op./home/byk/Code/opencode/packages/protocol/src/groups/session.ts were: session.create β POST /api/session; session.get β GET /api/session/:sessionID; session.switchAgent β POST /api/session/:sessionID/agent; session.switchModel β POST /api/session/:sessionID/model; session.prompt β POST /api/session/:sessionID/prompt; session.compact β POST /api/session/:sessionID/compact; session.wait β POST /api/session/:sessionID/wait; session.revert.stage β POST /api/session/:sessionID/revert/stage; session.revert.clear β POST /api/session/:sessionID/revert/clear; session.revert.commit β POST /api/session/:sessionID/revert/commit; session.context β GET /api/session/:sessionID/context; session.history β GET /api/session/:sessionID/history; session.events β GET /api/session/:sessionID/event; and session.message β GET /api/session/:sessionID/message/:messageID.session.prompt accepts optional id, optional delivery, optional resume, and required prompt; it durably admits one Session input and schedules agent-loop execution unless resume is false. session.history returns { data: Schema.Array(SessionEvent.Durable), hasMore: Schema.Boolean }; session.events uses SSE to replay durable events after an aggregate sequence and continue with new durable events./home/byk/Code/opencode/packages/cli/src/services/daemon.ts, 3 recovery tests in /home/byk/Code/opencode/packages/core/test/session-runner.test.ts, /home/byk/Code/opencode/packages/core/test/tool-bash.test.ts, /home/byk/Code/opencode/packages/core/src/file-mutation.ts, /home/byk/Code/opencode/packages/core/src/background-job.ts, /home/byk/Code/opencode/packages/opencode/test/background/job.test.ts, /home/byk/Code/opencode/packages/core/src/tool/bash.ts, and restart-interruption translations in /home/byk/Code/opencode/packages/app/src/i18n/en.ts and /home/byk/Code/opencode/packages/app/src/i18n/cs.ts./home/byk/Code/opencode/packages/core/test/session-runner.test.ts cover durably failing local tools left running by a prior process, durably failing hosted tools left running by a prior process before continuing inline, and durably failing pending tool input left by a prior process before continuing./home/byk/Code/opencode/packages/core/src/file-mutation.ts:198-207 defers formatter integration, watcher/file-edit events, snapshots/undo, LSP notification and diagnostics, and multi-file transaction/rollback design. Edits are currently sequential and report partial application. Crash recovery and idempotency remain undefined for side effects occurring between Tool.Called and durable settlement./home/byk/Code/opencode/packages/core/src/file-mutation.ts provides create, write, writeTextPreservingBom, writeIfUnchanged, and remove; remove treats PlatformError/NotFound as existed: false. BOM helpers strip repeated \uFEFF, preserve one BOM when requested, and detect UTF-8 BOM bytes 0xef 0xbb 0xbf./home/byk/Code/opencode/packages/core/src/tool/registry.ts defines canonical ToolRegistry materialization: Location registrations overlay application registrations; the latest active local registration wins; wholly denied tools are filtered from definitions; settlement captures the materialized registration identity and reports Stale tool call: ${input.call.name} when an advertised registration has changed, or Unknown tool: ${input.call.name} when unavailable./home/byk/Code/opencode/packages/core/src/tool/registry.ts:62-81 invokes settle(...) with sessionID, agent, assistantMessageID, and toolCallID; converts LLM.ToolFailure to an error result; bounds successful output through ToolOutputStore.Service.bound(...); converts bounded output via ToolOutput.toResultValue(...); and returns managed outputPaths only when nonempty./home/byk/Code/opencode/packages/core/src/tool/AGENTS.md directs that permission sources are always constructed from the canonical invocation context: const source = { type: "tool" as const, messageID: context.assistantMessageID, callID: context.toolCallID }./home/byk/Code/opencode/packages/core/src/tool/AGENTS.md requires leaves to own resolution, permission, and side-effect ordering; only expected typed errors may be translated into ToolFailure; catchCause must not be used because interruption and defects must survive./home/byk/Code/opencode/packages/core/src/tool/AGENTS.md states that registry.ts must store only canonical tools and must not introduce a second executable entry type, registry-owned executor, authorization callback, output-path callback, or legacy normalization path. ToolRegistry.Service is Location-scoped, while ApplicationTools.Service is process-scoped and shared by all Locations./home/byk/Code/opencode/packages/core/src/tool/AGENTS.md distinguishes catalog visibility from execution authorization: the registry has no PermissionV2.Service dependency, whole-tool definition filtering does not authorize execution, and a call reaching settlement still executes its captured leaf policy. Most tools use their registered name as the permission action; edit, write, and apply_patch share the edit action./home/byk/Code/opencode/packages/core/src/tool/AGENTS.md: plugin boot has not yet been redesigned around canonical Tools.Service registration; MCP and future Session-scoped registrations need an explicit canonical registration design; and replacing public Session outputPaths requires a future opaque managed-output reference design./home/byk/Code/opencode/packages/core/src/session/runner/llm.ts: each provider turn uses exactly one llm.stream(request), tool execution and continuation remain in the runner, requests set "x-session-affinity": session.id, and the provider stream is created with llm.stream(request).