文件最后提交记录最后更新时间
sync: OpenCode v1.14.48 -> v1.14.49 Upstream commits: - fix keymap fallback priority and TUI config diagnostics (#27384) - fix(server): map busy sessions in http handlers (#27375) - fix(provider): restore model suggestions (#27372) - fix(run): restore non-interactive exit behavior (#27371) - refactor(flags): route installation/llm client through runtime flags (#27368, #27369) - effect(git/installation/worktree/format/snapshot): migrate to AppProcess.run (#27185-#27190) - refactor(flags): route control-plane/sync/session workspaces through runtime flags (#27335-#27337) - effect(core): add stdin option to AppProcess.run; migrate snapshot+clipboard (#27224) - chore: delete unused util/lock and util/color modules (#27223, #27331) - core: expose v2 model listing API (#25821) - feat: session switching (DEVECO_EXPERIMENTAL_SESSION_SWITCHING) - feat(app): ctrl/cmd+number keybinds to switch projects (#26280) - feat(tui): pin, quick-switch, and cycle recent sessions (#26858) - Tests migrated to Effect style (testEffect, it.instance, it.live) - Zod removal from core, replaced with Effect Schema Conflicts resolved: 74 files - package.json (18): accept upstream version, preserve name=deveco and workspace deps - bun.lock: accept upstream - extension.toml: accept upstream version URL - flag.ts: keep DEVECO_* naming, add DEVECO_EXPERIMENTAL_SESSION_SWITCHING - llm.ts: keep x-deveco-* headers and User-Agent brand - websearch.ts: keep DEVECO_WEBSEARCH_PROVIDER env var - logo.tsx/ui.ts: keep local branded UI (not upstream animated logo) - AGENTS.md: keep local doc index, upstream content -> OPENCODE-AGENTS.md - Source files: accept upstream Flag->RuntimeFlags refactor, replace OPENCODE_->DEVECO_ - Test files: accept upstream Effect migration, replace OPENCODE_->DEVECO_ Brand identifiers preserved throughout, DEVECO_* flags maintained Product rebranded from CodeGenie to DevEco Code Signed-off-by: OwenO <ouwen7@huawei.com> 15 天前
sync: OpenCode v1.14.41 -> v1.14.42 Upstream commits: - feat(core): add scout agent for repo research (#24149) - Add native LLM core foundation (#24712) - feat(opencode): add interactive split-footer mode to run (#23557) - feat(server): add HTTP API response compression (#26440) - feat(core): be smarter about generating a worktree name (#26368) - feat(core): allow external workspace creation (#26212) - feat(desktop): working indicator on project sidebar (#26223) - feat(desktop): allow silent install and only user-wide scope (#26253) - feat(websearch): add parallel provider rollout (#26227) - fix(server): clean up post-Hono-deletion scar tissue (#26542) - fix(server): validate permission and question ids (#26456) - fix(server): include auth challenge on typed 401 (#26455) - fix(server): return structured validation errors (#26457) - fix(server): match Hono wire format for authorize errors (#26474) - fix(tui): sort session picker by full updated timestamp (#24725) - fix(cli): forward signals from npm shim (#26259) - fix(workspace): claim detached sessions to source project (#26413) - fix(tui): retain cleared prompt drafts (#26258) - fix(provider): align Gemini thinking controls (#26279) - fix(provider): align Anthropic Opus 4.5 efforts (#26275) - fix(provider): constrain OpenAI deep research efforts (#26273) - fix(provider): align GPT-5 reasoning variants (#26268) - fix(skill): allow missing descriptions (#26391) - fix: ensure tools are always in same order (#26370) - fix: adjust tui retry dialog logic (#26366) - fix(web): normalize shell output carriage returns (#26426) - fix: tweaks to transform logic for anthropic and bedrock (#26276) - flatten to keybind compatible config (#26421) - introduce opentui keymap as sole key/cmd engine (#26053) - internal which-key plugin, inactive by default (#26337) - refactor(desktop): convert main process to Effect-TS (#26148) - research: delete Hono backend (#25667) - release: v1.14.42 Conflicts resolved: 77 files - package.json (17): accepted upstream versions, preserved name: "codegenie" - bun.lock, nix/hashes.json: accepted upstream - extension.toml: accepted upstream version and download URL - server source (12): accepted upstream architecture, preserved CODEGENIE_ brand - server tests (27): accepted upstream test structure, preserved CODEGENIE_ brand - tui/plugin (6): accepted upstream TUI changes, preserved CodeGenie customizations - desktop (2): accepted upstream Effect-TS refactor, preserved brand - bin/codegenie: preserved CODEGENIE_BIN_PATH and .codegenie cache - modify/delete (6): accepted upstream deletions (Hono cleanup) - sdk/build (1): accepted upstream - flag.ts: accepted upstream flags, converted OPENCODE_ to CODEGENIE_ Brand identifiers preserved throughout, HarmonyOS tools and plugins retained Signed-off-by: zhangyuchen <zhangyuchen45@huawei.com> 20 天前
sync: OpenCode v1.15.4 -> v1.15.5 Upstream commits: - Preview native LLM runtime stack (#27114) - feat(tui): add syntax highlighting for elixir, fsharp, r, make, vim, xml, agda - perf(app): virtualize session timeline rows (#26949) - fix(plugin): ask in tools from plugins returns promise instead of effect - fix(bus): acquire PubSub subscription eagerly to close /event race - refactor(session): move prompt reminders out of core loop - refactor(session): extract prompt tool resolution - refactor(session): extract reference prompt helpers - refactor(reference): split materialization state - refactor(repository): add cache service + type cache failures - fix(core): fix file references in workspaces - fix(ui): guard reasoning renderer, fix question dock overflow - fix(tui): copy pasted prompt content, collapse long tool output lines - Load models.dev snapshot from build global (models-snapshot.js deleted) - Upgrade Bun to final non-rust version - Multiple test migrations to instance fixtures Conflicts resolved: 28 files - package.json (17): version bump, accept upstream - packages/opencode/package.json: accept upstream + keep name/bin/deveco-codegenie deps - packages/web/package.json: accept upstream + fix deveco workspace dep - bun.lock/extension.toml/sdks/vscode/package.json: accept upstream - build scripts (3): DEVECO_MODELS_DEV define, generate.ts export - runtime-flags.ts: new experimentalNativeLlm flag with DEVECO_ prefix - session/llm.ts: accept upstream native LLM runtime architecture, keep DEVECO_ headers + debug logging - test files (3): DEVECO_TEST_HOME branding Brand identifiers preserved throughout, HarmonyOS tools and plugins retained Baseline updated in BASELINE.md Signed-off-by: OwenO <ouwen7@huawei.com> 13 天前
sync: OpenCode v1.14.49 -> v1.14.50 Upstream commits: - fix(httpapi): preserve event stream context (#27425) - refactor(storage): remove not found wire serializer (#27416) - fix(session): type busy errors (#27410) - fix(provider): make small model fallback optional (#27405) - fix(llm): preserve tool error defects (#27403) - refactor(core): move models.dev into core (#27347) - effect(patch,tool): migrate patch/index and tool/read to AppFileSystem (#27155) - effect(server): typed errors in session/sync handlers, fix concurrency (#27146) - effect(core): track stderr truncation; polish AppProcess callers (#27353) - effect(util): migrate filesystem callers to AppFileSystem.Service (#27152) - fix(provider): type model not found errors (#27334) Conflicts resolved: 22 files - **/package.json (19 files): version bump, kept name: "deveco" for opencode package - bun.lock: accepted upstream - packages/extensions/zed/extension.toml: accepted upstream version/URL - packages/core/src/flag/flag.ts: accepted upstream (removed falsy/unstableDefault/EXPERIMENTAL_MARKDOWN/EXPERIMENTAL_CUSTOMIZE_SKILL), replaced OPENCODE_ → DEVECO_ Brand identifiers preserved throughout Baseline updated in BASELINE.md Signed-off-by: OwenO <ouwen7@huawei.com> 15 天前
sync: OpenCode v1.14.48 -> v1.14.49 Upstream commits: - fix keymap fallback priority and TUI config diagnostics (#27384) - fix(server): map busy sessions in http handlers (#27375) - fix(provider): restore model suggestions (#27372) - fix(run): restore non-interactive exit behavior (#27371) - refactor(flags): route installation/llm client through runtime flags (#27368, #27369) - effect(git/installation/worktree/format/snapshot): migrate to AppProcess.run (#27185-#27190) - refactor(flags): route control-plane/sync/session workspaces through runtime flags (#27335-#27337) - effect(core): add stdin option to AppProcess.run; migrate snapshot+clipboard (#27224) - chore: delete unused util/lock and util/color modules (#27223, #27331) - core: expose v2 model listing API (#25821) - feat: session switching (DEVECO_EXPERIMENTAL_SESSION_SWITCHING) - feat(app): ctrl/cmd+number keybinds to switch projects (#26280) - feat(tui): pin, quick-switch, and cycle recent sessions (#26858) - Tests migrated to Effect style (testEffect, it.instance, it.live) - Zod removal from core, replaced with Effect Schema Conflicts resolved: 74 files - package.json (18): accept upstream version, preserve name=deveco and workspace deps - bun.lock: accept upstream - extension.toml: accept upstream version URL - flag.ts: keep DEVECO_* naming, add DEVECO_EXPERIMENTAL_SESSION_SWITCHING - llm.ts: keep x-deveco-* headers and User-Agent brand - websearch.ts: keep DEVECO_WEBSEARCH_PROVIDER env var - logo.tsx/ui.ts: keep local branded UI (not upstream animated logo) - AGENTS.md: keep local doc index, upstream content -> OPENCODE-AGENTS.md - Source files: accept upstream Flag->RuntimeFlags refactor, replace OPENCODE_->DEVECO_ - Test files: accept upstream Effect migration, replace OPENCODE_->DEVECO_ Brand identifiers preserved throughout, DEVECO_* flags maintained Product rebranded from CodeGenie to DevEco Code Signed-off-by: OwenO <ouwen7@huawei.com> 15 天前
sync: OpenCode v1.14.48 -> v1.14.49 Upstream commits: - fix keymap fallback priority and TUI config diagnostics (#27384) - fix(server): map busy sessions in http handlers (#27375) - fix(provider): restore model suggestions (#27372) - fix(run): restore non-interactive exit behavior (#27371) - refactor(flags): route installation/llm client through runtime flags (#27368, #27369) - effect(git/installation/worktree/format/snapshot): migrate to AppProcess.run (#27185-#27190) - refactor(flags): route control-plane/sync/session workspaces through runtime flags (#27335-#27337) - effect(core): add stdin option to AppProcess.run; migrate snapshot+clipboard (#27224) - chore: delete unused util/lock and util/color modules (#27223, #27331) - core: expose v2 model listing API (#25821) - feat: session switching (DEVECO_EXPERIMENTAL_SESSION_SWITCHING) - feat(app): ctrl/cmd+number keybinds to switch projects (#26280) - feat(tui): pin, quick-switch, and cycle recent sessions (#26858) - Tests migrated to Effect style (testEffect, it.instance, it.live) - Zod removal from core, replaced with Effect Schema Conflicts resolved: 74 files - package.json (18): accept upstream version, preserve name=deveco and workspace deps - bun.lock: accept upstream - extension.toml: accept upstream version URL - flag.ts: keep DEVECO_* naming, add DEVECO_EXPERIMENTAL_SESSION_SWITCHING - llm.ts: keep x-deveco-* headers and User-Agent brand - websearch.ts: keep DEVECO_WEBSEARCH_PROVIDER env var - logo.tsx/ui.ts: keep local branded UI (not upstream animated logo) - AGENTS.md: keep local doc index, upstream content -> OPENCODE-AGENTS.md - Source files: accept upstream Flag->RuntimeFlags refactor, replace OPENCODE_->DEVECO_ - Test files: accept upstream Effect migration, replace OPENCODE_->DEVECO_ Brand identifiers preserved throughout, DEVECO_* flags maintained Product rebranded from CodeGenie to DevEco Code Signed-off-by: OwenO <ouwen7@huawei.com> 15 天前
sync: OpenCode v1.15.4 -> v1.15.5 Upstream commits: - Preview native LLM runtime stack (#27114) - feat(tui): add syntax highlighting for elixir, fsharp, r, make, vim, xml, agda - perf(app): virtualize session timeline rows (#26949) - fix(plugin): ask in tools from plugins returns promise instead of effect - fix(bus): acquire PubSub subscription eagerly to close /event race - refactor(session): move prompt reminders out of core loop - refactor(session): extract prompt tool resolution - refactor(session): extract reference prompt helpers - refactor(reference): split materialization state - refactor(repository): add cache service + type cache failures - fix(core): fix file references in workspaces - fix(ui): guard reasoning renderer, fix question dock overflow - fix(tui): copy pasted prompt content, collapse long tool output lines - Load models.dev snapshot from build global (models-snapshot.js deleted) - Upgrade Bun to final non-rust version - Multiple test migrations to instance fixtures Conflicts resolved: 28 files - package.json (17): version bump, accept upstream - packages/opencode/package.json: accept upstream + keep name/bin/deveco-codegenie deps - packages/web/package.json: accept upstream + fix deveco workspace dep - bun.lock/extension.toml/sdks/vscode/package.json: accept upstream - build scripts (3): DEVECO_MODELS_DEV define, generate.ts export - runtime-flags.ts: new experimentalNativeLlm flag with DEVECO_ prefix - session/llm.ts: accept upstream native LLM runtime architecture, keep DEVECO_ headers + debug logging - test files (3): DEVECO_TEST_HOME branding Brand identifiers preserved throughout, HarmonyOS tools and plugins retained Baseline updated in BASELINE.md Signed-off-by: OwenO <ouwen7@huawei.com> 13 天前
sync: OpenCode v1.14.46 -> v1.14.47 Upstream commits (50): - feat(scout): materialize configured reference repos (#26692) - feat: better image handling (auto resize & max size constraints) (#26401) - feat(http-recorder): default mode to "auto" (#26719) - Source HTTP API ID path patterns (#26623) - Source workspace path pattern (#26632) - Source diff message query pattern (#26638) - Persist session model switches outside event flag (#26765) - restore managed textarea keymap handling (#26771) - fix(server): return diagnosable body for schema rejections (#26631) - Add explicit LLM stream lifecycle events (#26722) - refactor(http-recorder): use Schema.TaggedErrorClass for cassette errors (#26729) - refactor(http-recorder): hide cassette format behind Cassette seam (#26725) - refactor(http-recorder): Redactor + Recorder seams, README (#26636) - Scope boolean query overrides - Drop unused ID Zod statics (#26740) - Drop compaction create facade (#26739) - Replace compaction create test fixtures (#26738) - Migrate compaction tool-call/plugin/LLM/overflow tests - Use Effect timeout in compaction test (#26728) - Format TUI paths relative to session directory (#26648) - Remove redundant ID Zod overrides (#26633) - Zen: Ring 2.6 1T, fix usage css, fix reasoning token - Go: hy3 preview, tencent icon - Various chore: generate commits - release: v1.14.47 Conflicts resolved: - 17 package.json: version bump, kept codegenie name - packages/opencode/package.json: version bump, kept name=codegenie - packages/web/package.json: version bump, fixed workspace dep - bun.lock: accepted upstream - extension.toml: version/URL upgrade - AGENTS.md: kept local CodeGenie docs index - agent.ts: accepted Reference.resolveAll refactor, kept CODEGENIE_ brand - read.ts: merged imports (isImageAttachment + Reference) - event.ts: accepted bypassExperimentalEventSystem option, kept CODEGENIE_ brand - prompt-traits.test.ts: accepted upstream new test file Brand cleanup: - reference.ts, reference.test.ts, read.test.ts: OPENCODE_ -> CODEGENIE_ Signed-off-by: zhangyuchen <zhangyuchen45@huawei.com> 20 天前
sync: OpenCode v1.14.41 -> v1.14.42 Upstream commits: - feat(core): add scout agent for repo research (#24149) - Add native LLM core foundation (#24712) - feat(opencode): add interactive split-footer mode to run (#23557) - feat(server): add HTTP API response compression (#26440) - feat(core): be smarter about generating a worktree name (#26368) - feat(core): allow external workspace creation (#26212) - feat(desktop): working indicator on project sidebar (#26223) - feat(desktop): allow silent install and only user-wide scope (#26253) - feat(websearch): add parallel provider rollout (#26227) - fix(server): clean up post-Hono-deletion scar tissue (#26542) - fix(server): validate permission and question ids (#26456) - fix(server): include auth challenge on typed 401 (#26455) - fix(server): return structured validation errors (#26457) - fix(server): match Hono wire format for authorize errors (#26474) - fix(tui): sort session picker by full updated timestamp (#24725) - fix(cli): forward signals from npm shim (#26259) - fix(workspace): claim detached sessions to source project (#26413) - fix(tui): retain cleared prompt drafts (#26258) - fix(provider): align Gemini thinking controls (#26279) - fix(provider): align Anthropic Opus 4.5 efforts (#26275) - fix(provider): constrain OpenAI deep research efforts (#26273) - fix(provider): align GPT-5 reasoning variants (#26268) - fix(skill): allow missing descriptions (#26391) - fix: ensure tools are always in same order (#26370) - fix: adjust tui retry dialog logic (#26366) - fix(web): normalize shell output carriage returns (#26426) - fix: tweaks to transform logic for anthropic and bedrock (#26276) - flatten to keybind compatible config (#26421) - introduce opentui keymap as sole key/cmd engine (#26053) - internal which-key plugin, inactive by default (#26337) - refactor(desktop): convert main process to Effect-TS (#26148) - research: delete Hono backend (#25667) - release: v1.14.42 Conflicts resolved: 77 files - package.json (17): accepted upstream versions, preserved name: "codegenie" - bun.lock, nix/hashes.json: accepted upstream - extension.toml: accepted upstream version and download URL - server source (12): accepted upstream architecture, preserved CODEGENIE_ brand - server tests (27): accepted upstream test structure, preserved CODEGENIE_ brand - tui/plugin (6): accepted upstream TUI changes, preserved CodeGenie customizations - desktop (2): accepted upstream Effect-TS refactor, preserved brand - bin/codegenie: preserved CODEGENIE_BIN_PATH and .codegenie cache - modify/delete (6): accepted upstream deletions (Hono cleanup) - sdk/build (1): accepted upstream - flag.ts: accepted upstream flags, converted OPENCODE_ to CODEGENIE_ Brand identifiers preserved throughout, HarmonyOS tools and plugins retained Signed-off-by: zhangyuchen <zhangyuchen45@huawei.com> 20 天前
README.md

@opencode-ai/llm

Schema-first LLM core for opencode. One typed request, response, event, and tool language; provider quirks live in adapters, not in calling code.

import { Effect } from "effect"
import { LLM, LLMClient } from "@opencode-ai/llm"
import { OpenAI } from "@opencode-ai/llm/providers"

const model = OpenAI.model("gpt-4o-mini", { apiKey: process.env.OPENAI_API_KEY })

const request = LLM.request({
  model,
  system: "You are concise.",
  prompt: "Say hello in one short sentence.",
  generation: { maxTokens: 40 },
})

const program = Effect.gen(function* () {
  const response = yield* LLMClient.generate(request)
  console.log(response.text)
})

Run LLMClient.stream(request) instead of generate when you want incremental LLMEvents. The event stream is provider-neutral — same shape across OpenAI Chat, OpenAI Responses, Anthropic Messages, Gemini, Bedrock Converse, and any OpenAI-compatible deployment.

Public API

  • LLM.request({...}) — build a provider-neutral LLMRequest. Accepts ergonomic inputs (system: string, prompt: string) that normalize into the canonical Schema classes.
  • LLM.generate / LLM.stream — re-exported from LLMClient for one-import use.
  • LLM.user(...) / LLM.assistant(...) / LLM.toolMessage(...) — message constructors.
  • LLM.toolCall(...) / LLM.toolResult(...) / LLM.toolDefinition(...) — tool-related parts.
  • LLMClient.prepare(request) — compile a request through protocol body construction, validation, and HTTP preparation without sending. Useful for inspection and testing.
  • LLMEvent.is.* — typed guards (is.text, is.toolCall, is.requestFinish, …) for filtering streams.

Caching

Prompt caching is on by default. Every LLMRequest resolves to cache: "auto" unless the caller opts out with cache: "none". Each protocol translates CacheHints to its wire format (cache_control on Anthropic, cachePoint on Bedrock; OpenAI and Gemini do implicit caching server-side and don't need inline markers — auto is a no-op there).

Auto placement

"auto" places three breakpoints — last tool definition, last system part, latest user message. The last-user-message boundary is the load-bearing detail: in a tool-use loop, a single user turn expands into many assistant/tool round-trips, all sharing that prefix. Caching at that boundary lets every intra-turn API call hit.

The math justifies the default: Anthropic's 5-minute cache write is 1.25× base, read is 0.1×, so a single reuse within 5 minutes already wins. One-shot completions below the per-model minimum-cacheable-token threshold silently no-op on the wire, so the worst case is harmless.

Opting out

LLM.request({
  model,
  system,
  prompt: "one-off question",
  cache: "none",
})

Granular policy

cache: {
  tools?: boolean,
  system?: boolean,
  messages?: "latest-user-message" | "latest-assistant" | { tail: number },
  ttlSeconds?: number,         // ≥ 3600 → 1h on Anthropic/Bedrock; else 5m
}

Manual hints

Inline CacheHint on any text / system / tool / tool-result part overrides automatic placement. The auto policy preserves manual hints; it only fills gaps.

LLM.request({
  model,
  system: [
    { type: "text", text: "stable system prompt", cache: { type: "ephemeral" } },
  ],
  ...
})

Provider behavior table

Protocol cache: "auto"
Anthropic Messages emits up to 3 cache_control markers (4-breakpoint cap enforced)
Bedrock Converse emits up to 3 cachePoint blocks (4-breakpoint cap enforced)
OpenAI Chat / Responses no-op (implicit caching above 1024 tokens)
Gemini no-op (implicit caching on 2.5+; explicit CachedContent is out-of-band)

Normalized cache usage is read back into response.usage.cacheReadInputTokens and cacheWriteInputTokens across every provider.

Providers

Each provider exports a model(...) helper that records identity, protocol, capabilities, auth, and defaults.

import { Anthropic } from "@opencode-ai/llm/providers"

const model = Anthropic.model("claude-sonnet-4-6", {
  apiKey: process.env.ANTHROPIC_API_KEY,
})

Included providers: OpenAI, Anthropic, Google (Gemini), Amazon Bedrock, Azure OpenAI, Cloudflare, GitHub Copilot, OpenRouter, xAI, plus generic OpenAI-compatible helpers for DeepSeek, Cerebras, Groq, Fireworks, Together, etc.

Provider options & HTTP overlays

Three escape hatches in order of stability:

  1. generation — portable knobs (maxTokens, temperature, topP, topK, penalties, seed, stop).
  2. providerOptions: { <provider>: {...} } — typed-at-the-facade provider-specific knobs (OpenAI promptCacheKey, Anthropic thinking, Gemini thinkingConfig, OpenRouter routing).
  3. http: { body, headers, query } — last-resort serializable overlays merged into the final HTTP request. Reach for this only when a stable typed path doesn't yet exist.

Model-level defaults are overridden by request-level values for each axis.

Routes

Adding a new model or deployment is usually 5–15 lines using Route.make({ protocol, transport, ... }). The four orthogonal pieces are protocol (body construction + stream parsing), transport (endpoint + auth + framing + encoding), defaults, and capabilities. See AGENTS.md for the architectural detail.

Effect

This package is built on Effect. Public methods return Effect or Stream; provide LLMClient.layer (the default registers every shipped route) for runtime dispatch. The example at example/tutorial.ts is a runnable walkthrough.

See also

  • AGENTS.md — architecture, route construction, contributor guide
  • example/tutorial.ts — runnable end-to-end walkthrough
  • test/provider/*.test.ts — fixture-first protocol tests; *.recorded.test.ts files cover live cassettes