Dropstone SDK
一个用于 Dropstone 代理的类型化 TypeScript 和 JavaScript 客户端,具有两个入口点:一个用于 CI 或 serverless 函数中的无头 API 调用,另一个在本地运行代理,并具有与 CLI 和 Chat 相同的账户记忆。
Dropstone SDK 是 Dropstone 代理运行时的类型化 TypeScript 和 JavaScript 客户端。它为你的代码提供对 Dropstone Chat 和 CLI 中运行的同一代理的程序化访问:会话、工具、流式回复和结构化输出。
npm install @blankline/dropstone-sdk
方法参考位于 docs.dropstone.io/cli/sdk。本页是概述,安装并运行你的第一个会话 是操作指南。
两个入口点
SDK 附带两个客户端,你需要哪一个取决于你的代码运行在哪里。
| 无头 API 客户端 | 本地代理客户端 | |
|---|---|---|
| 导入 | createDropstoneApi | createDropstone |
| 连接至 | api.dropstone.io/api/v1 | 它为你启动的 dropstone serve 进程 |
| 认证方式 | API 密钥 | 同一台机器上 CLI 的登录状态 |
| 计费 | 从你的信用余额中按使用量付费 | 你的每周配额,与 CLI 相同 |
| 你的记忆 | 否。它是一个无状态的补全端点 | 是,Chat 和 CLI 使用的账户记忆 |
| 用于 | CI、作业、serverless、任何没有 CLI 的主机 | 在 Node 应用中嵌入交互式代理 |
它还附带两个额外的入口点:createDropstoneClient 将相同的类型化客户端指向你已在运行的服务器,createDropstoneTui 从 Node 进程启动交互式终端 UI。
一处记忆,处处可用
本地会话以你的账户身份运行,因此它从 Dropstone 在其他表面上已学习到的所有内容开始。你在 Chat 中设置的规则在通过 SDK 运行的代码中同样生效,而会话记录的内容在你下次打开 CLI 时也会存在。请参阅 每个表面上的统一记忆。
无头客户端则刻意相反:一个无状态的、兼容 OpenAI 的补全端点,不附带任何记忆,因此管道可以获得可预测的输入和输出。请参阅 将 API 与你的计划一起使用。
端到端类型化
请求、响应、流式事件和工具调用均根据服务器的 OpenAPI 规范生成,因此编辑器可以自动补全,编译器可以检查它们。一个包中附带两个表面:稳定的 v1 客户端,以及位于 @blankline/dropstone-sdk/v2 的 v2 客户端,后者为文件和工作区提供了更丰富的资源模型。新端点会落在 v2 上。
要求
- Node.js
- 对于本地代理客户端,同一台机器上需要安装 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.