Dashboard › opencode › Distillation
bddfc367-82a0-4d62-8ca4-d70921606baa["lore_tm_v1_GUcSCEVw9lCie9sw_Oaq6pae4RkXKR-S-Ab9mljOJMg","lore_tm_v1_Q9Kz8Kun5BAVPpuRBK71vapbE6fN7EzLK9v-lhCfpLU","lore_tm_v1_91vtsnW6FERIzXOnYf24WDQhiixT2ko2bDyMwPWTaNw","lore_tm_v1_0pmEVM1pBdAMHmaOt4WTlSSf97d6V_m6_tEHTVty_ww","lore_tm_v1_MfFJcMyTCzSj2MzJPMuwUaIKkxwTVlZaTIQDAEmp6Ng"]
MAX_LENGTH = 100, MAX_CONTEXT_LENGTH = 8_000, MAX_FIRST_MESSAGE_LENGTH = 2_000, and titleChanged = Symbol("Session title changed"); truncate() limits generated titles to 100 characters by retaining the first 97 and appending ..., while isUntitled() delegates to isExactRootFallback() using the title and creation epoch milliseconds.SessionTitle.attempt() prepares a title request with kind: "title", the selected session/agent/model scope, the title agent’s optional system prompt, one user message containing the bounded title context, and contextHooks: false. It streams through LLMClient, collects textDelta chunks, marks provider or AI.Error failures, accumulates stepFinish usage via SessionUsage.record()/SessionUsage.add(), and publishes SessionEvent.UsageRecorded with source: "title" even on interruption.SessionTitle.attempt() returns no title on any provider/AI failure; otherwise it joins streamed text, splits on newlines, trims each line, and uses the first nonempty line.SessionTitle.generate() exits when the session or first user message is absent. For an exact root-fallback/untitled session it sends the complete first-user text; for retitling, it constructs Original request:\n plus at most the first 2_000 characters of that message, then appends recent user messages other than the first and assistant text parts under Recent conversation:\n, retaining the trailing portion needed to stay within 8_000 characters. If loading context fails, it falls back to the unbounded first-user text.selection.selected, then retries with selection.primary only when the first attempt yields no title, selection.primary exists, and its model ref is not deeply equal to the selected ref. Before publishing SessionEvent.Renamed, it re-reads the session and refuses stale/no-op writes when the session disappeared, its title changed, or it already equals truncate(title).SessionTitle.generate() calculates expectedSequence = Bus.latestSequence(db, sessionID) + 1 and guards the rename commit so only that exact sequence succeeds; a sequence race defects with the private titleChanged symbol and is swallowed, while every other defect is rethrown. The @opencode/SessionTitle location node depends on Bus.node, llmClient, SessionContext.node, SessionStore.node, and Database.node.SessionContext implementation separates resolution into two phases: select(sessionID) fixes the session, agent, instruction sources, and tool snapshot; load(selection) adds the resolved model and active runner history. Auxiliary title selection avoids instruction/tool preflight, and model-request preparation remains delegated to SessionModelRequest.Interface["prepare"].SessionContext.selectTitle() loads agent ID "title", resolves the session’s primary model while tolerating resolution failure, then chooses model information from the title agent’s explicit model or catalog.model.small(primary.ref.providerID). Minimal reasoning variants are preferred in exact order: 1. "none", 2. "minimal", 3. "low"; an explicit agent.model.variant takes precedence. It resolves the preferred model with the chosen variant and selects preferred ?? primary, returning undefined if no title agent or usable model exists.SessionContext.select() dies with Error(\Session not found: ${sessionID}`)for a missing session and interrupts when the session’slocation.directoryorlocation.workspaceIDdiffers from the active location. It flushes MCP tools, selects the session agent, and returnsAgentNotFoundError({ sessionID, agent })` when the agent has no info.SessionContext.select() loads seven resources concurrently with { concurrency: "unbounded" }: 1. permission-filtered registry.snapshot(agent.info.permissions), 2. built-ins via builtins.load(sessionID), 3. discovered instructions via discovery.load(), 4. skill instructions via skillInstructions.load(agent), 5. reference instructions via referenceInstructions.load(), 6. MCP instructions via mcpInstructions.load(agent), and 7. session instruction entries via entries.load(sessionID).SessionContext.select() combines instructions in this exact order: 1. loaded built-ins, 2. CodeModeInstructions.make(loaded.tools.codeModeCatalog), 3. discovery, 4. skills, 5. references, 6. MCP, 7. entries; it returns that list with the session, selected agent info, and the permission-filtered tool snapshot.SessionContext.load() resolves the selected session model and calls SessionHistory.entriesForRunner(db, session.id, instructions, SessionProviderContext.provenance(model) ?? "local"); it returns history.initial, each history.entries item’s message, and the selection’s existing session, agent, and tool snapshot.@opencode/SessionContext location node depends on Agent.node, Catalog.node, Database.node, InstructionBuiltIns.node, InstructionDiscovery.node, InstructionEntry.node, Location.node, McpInstructions.node, McpTool.node, ReferenceInstructions.node, SessionRunnerModel.node, SessionModelRequest.node, SessionStore.node, SkillInstructions.node, and Tool.node./home/byk/Code/opencode-lore-v2/.github/workflows/ci.yml runs pnpm run build for refs/heads/release/*, then packs exactly four workspaces—packages/core, packages/opencode, packages/pi, and packages/gateway—with pnpm pack --pack-destination ../../dist-tarballs. pnpm pack was chosen because it rewrites workspace:* dependencies to actual versions; npm pack was rejected because it leaves literal workspace:* specifiers and breaks installation./home/byk/Code/opencode-lore-v2/.github/workflows/ci.yml creates the legacy opencode-lore alias by extracting dist-tarballs/loreai-opencode-${version}.tgz, changing .name in package/package.json to "opencode-lore" with jq, and repacking dist-tarballs/opencode-lore-${version}.tgz; @loreai/opencode and opencode-lore contain identical content and are published in parallel for existing users.pnpm tsx packages/gateway/script/pack-ort-npm.ts --version "$version" --tarballs "$GITHUB_WORKSPACE/dist-tarballs" to pack all 6 native @loreai/onnxruntime-<os>-<arch> packages and inject them as optionalDependencies into the gateway tarball, allowing npm/plugin installs to use native ONNX Runtime while retaining bundled WASM as the dist-only fallback for issue #763./home/byk/Code/opencode-lore-v2/.github/workflows/ci.yml runs pnpm --filter @loreai/gateway run build:binary:sea --platforms darwin-arm64 --prepare-only on pushes to main, with SENTRY_AUTH_TOKEN and FOSSILIZE_CACHE_DIR=${{ github.workspace }}/.node-cache, then uploads hidden directory packages/gateway/.sea-staging/ as artifact sea-staging using actions/upload-artifact@v7 and include-hidden-files: true.rcodesign for macOS cross-signing because Linux-cross-compiled Darwin binaries otherwise remain unsigned and cannot execute on Apple Silicon./home/byk/Code/opencode-lore-v2 failed to load semver: Error: Cannot find module 'semver', code MODULE_NOT_FOUND, with require stack /home/byk/Code/opencode-lore-v2/[eval]; the runtime was Node.js v24.16.0.