İçeriğe geç

SDK

OpenCode'u kendi betiklerinizden, CI işlerinizden ve araçlarınızdan yönetin. SDK, OpenCode'u kendi yapılandırmanız ve modellerinizle sürecinizin içinde çalıştırır. Tipli istemcisi oturum oluşturur, prompt gönderir ve her olayı aktarır.

Özellikler

CI'ı koddan düzelt

Kısa bir betik OpenCode'dan başarısız testleri düzeltmesini ister ve testleri yeniden çalıştırır.

Her adımı izle

Ajanın çağırdığı her aracı anında görmek için olayları aktarın.

Kendi araçların

OpenCode'u birkaç satırla botlara, panolara ve iş akışlarına bağlayın.

Kendi sürecinizde

OpenCode'u kendi yapılandırmanız ve modellerinizle sürecinizin içinde çalıştırır.

  • TypeScript istemcisi@opencode/client ile aynı değerlere sahip tipli istekler ve olaylar.
  • Koddan oturumlarHerhangi bir betikten oturum oluşturun ve prompt gönderin.
  • Her modelOpenCode kurulumunuzdaki modelleri kullanır.
  • npm ya da bunnpm i @opencode/sdk ya da bun add @opencode/sdk ile kurun.
  • Süreç içi hostOpenCode'u ağ adımı olmadan bellekte çalıştırır.
  • EklentilerinizSüreç içi host'u oluştururken kendi eklentilerinizi verin.
  • Promise ya da EffectAynı değerlerle bir Promise API'si ve bir Effect API'si.
  • Cloudflare WorkersOpenCode'u Workers üzerinde bir Cloudflare Durable Object içinde çalıştırın.

  • npmnpm i @opencode/sdk
  • bunbun add @opencode/sdk
SDK dokümanlarını okuyun

Yenilikler

  1. v2.2.4

    Publish Interactive Artifacts

    Enable "experimental": { "artifacts": true } in opencode.json to let agents publish, update, and serve HTML or static artifacts through the built-in local provider or plugin-provided storage.#60351

    İyileştirmeler

    • SDKExtended client.experimental.persistentPty.update to rename terminals or clear a user title, and exposed userTitle plus persistent-pty.updated events.#60329
  2. v2.2.3

    Added lazy loading for stored image references when experimental.media_blob is enabled

    Added lazy loading for stored image references when experimental.media_blob is enabled. Images are downloaded only for previews, while undo, revert, fork, and prompt recall restore referenced attachments safely.#60116

    İyileştirmeler

    • SDKPreserved partial LLMResponse output on AIError.partial when generation, object generation, or a tool loop fails.#60477
    • SDKUnified Effect and Promise tool declarations around tool(...), with optional output schemas and executable or declaration-only tools.#60407
    • SDKAdded typed OpenRouter debug, models, plugins, provider, and user options to the Responses route.#60044

    Düzeltmeler

    • SDKMatched the Promise AI client more closely to the Effect API and accepted typed tools in loops.#60465#60390
    • SDKKept tools whose execute handler can throw available to the AI client.#60431
    • SDKContinued polling queued media generations when providers return unknown intermediate statuses.#59988
    • SDKStopped sending an incompatible filename alongside file_url on OpenAI Responses requests.#60382
  3. v2.2.2

    Exposed SessionInfo.time.busy for the latest execution’s start time

    İyileştirmeler

    • SDKAdded if and until inputs for client.experimental.schedule.create, plus schedule check results and output fields.#60137
    • SDKAdded optional source metadata to prompt file attachments.
Tüm güncellemeleri gör