Dropstone SDK 總覽
Dropstone agent 的型別化 TypeScript 與 JavaScript 用戶端,提供兩個進入點:一個用於 CI 或 serverless 函式的無狀態 API 呼叫,另一個則在本機執行 agent,並使用與 CLI 和 Chat 相同的帳戶記憶體。
Dropstone SDK 是 Dropstone agent 執行環境的型別化 TypeScript 與 JavaScript 用戶端。它讓你的程式碼能以程式化方式存取與 Dropstone Chat 和 CLI 中相同的 agent:工作階段、工具、串流回覆,以及結構化輸出。
npm install @blankline/dropstone-sdk
方法參考位於 docs.dropstone.io/cli/sdk。此頁面為總覽,而 安裝並執行你的第一個工作階段 則為逐步教學。
兩個進入點
SDK 提供兩個用戶端,選擇哪一個取決於你的程式碼執行位置。
| 無狀態 API 用戶端 | 本機 agent 用戶端 | |
|---|---|---|
| 匯入 | createDropstoneApi | createDropstone |
| 連線至 | api.dropstone.io/api/v1 | 由它為你啟動的 dropstone serve 程序 |
| 驗證方式 | API 金鑰 | 同一台機器上 CLI 的登入狀態 |
| 計費方式 | 從你的餘額中按使用量付費 | 每週配額,與 CLI 相同 |
| 你的記憶體 | 無。這是一個無狀態的 completions 端點 | 有,即 Chat 和 CLI 使用的帳戶記憶體 |
| 適用場景 | CI、批次作業、serverless,以及任何未安裝 CLI 的主機 | 在 Node 應用程式中嵌入互動式 agent |
另外還有兩個進入點:createDropstoneClient 可將相同的型別化用戶端指向你已在執行的伺服器,而 createDropstoneTui 則可從 Node 程序啟動互動式終端介面。
一個記憶體,隨處可用
本機工作階段以你的帳戶身分執行,因此會從 Dropstone 在其他介面上學到的所有內容開始。你在 Chat 中設定的規則,在透過 SDK 執行的程式碼中同樣有效,而工作階段記錄的內容,也會在你下次開啟 CLI 時出現。請參閱 每個介面上的單一記憶體。
無狀態用戶端則刻意相反:這是一個無狀態、與 OpenAI 相容的 completions 端點,不附加任何記憶體,因此管線能獲得可預期的輸入與輸出。請參閱 搭配你的方案使用 API。
端到端型別化
請求、回應、串流事件與工具呼叫皆由伺服器的 OpenAPI 規格產生,因此編輯器能自動補齊,編譯器也能檢查。單一套件中包含兩個介面:穩定的 v1 用戶端,以及位於 @blankline/dropstone-sdk/v2 的 v2 用戶端,後者提供更豐富的檔案與工作區資源模型。新端點會加入 v2。
需求
- Node.js
- 若使用本機 agent 用戶端,需在同一台機器上安裝 Dropstone CLI,並以
dropstone login登入 - 若使用無狀態用戶端,需具備 API 金鑰 與已儲值的餘額
取得協助
CLI 參考 是方法層級問題的第一站。若為帳戶、計費或存取問題,請參閱 如何取得支援。
Related articles
- Install and run your first sessionInstall the Dropstone SDK, make a headless API call with an API key, and run a local agent session that carries your account memory. Includes streaming, structured output, and using the OpenAI SDK against Dropstone.
- Using the API with your planCall Dropstone over HTTP with an API key. The endpoint is OpenAI-compatible, billed pay-per-use from your credit balance, and works from any language. Keys, errors, rate limits, and what the API does not carry.
- One memory across every surfaceThe account memory that follows you across Dropstone Chat, the CLI, and the SDK, what shares it and what does not, and how to keep an integration's learning out of your own memory.
- Install the CLIInstall the Dropstone CLI on macOS, Linux, or Windows with one command, sign in, and check it works. Upgrading and uninstalling.
- Memory across chat, CLI, and SDKDropstone memory belongs to your account, not to one app. A rule you set in the CLI applies in chat, and something learned in chat is available to the SDK. One memory, every surface.