dsh-sum-numbers
v0.1.1
Published
A dsh bundle that adds the sum_numbers tool.
Readme
dsh-sum-numbers
这是一个可以发布到 npm 的 dsh bundle,安装后会给 dsh 增加一个 sum_numbers 工具。
本地验证
在仓库根目录执行:
pnpm exec tsx dsh-sum-numbers/verify.js预期输出:
[sum-numbers] bundle loaded
registered tools: sum_numbers
tool result: {
"isError": false,
"content": [
{
"type": "text",
"text": "Sum: 10 (4 numbers)"
}
],
"value": {
"sum": 10,
"count": 4
}
}打包
cd dsh-sum-numbers
pnpm pack生成 dsh-sum-numbers-0.1.0.tgz。
发布到 npm
发布前先确认 npm 已登录:
npm whoami --registry=https://registry.npmjs.org未登录时执行:
npm login --registry=https://registry.npmjs.org然后从 dsh-sum-numbers/ 目录发布:
npm publish --registry=https://registry.npmjs.org发布成功后,任何人都可以裸装到 dsh profile:
pnpm dsh plugin --profile web add dsh-sum-numbers
dsh plugin --profile web add dsh-sum-numbers在 Web UI 验证
启动:
pnpm dsh web
dsh web终端出现:
[sum-numbers] bundle loaded然后在会话里提示模型:
Use the sum_numbers tool to add 2, 5 and 8.模型调用后应返回:
Sum: 15 (3 numbers)卸载
pnpm dsh plugin --profile web remove dsh-sum-numbers
dsh plugin --profile web remove dsh-sum-numbers