chore: openclaw plugins init tools
This commit is contained in:
commit
bb367eb952
7 files changed
+120
No files matched your search
@@ -0,0 +1,12 @@
|
|||||||
|
# Tools
|
||||||
|
|
||||||
|
Simple OpenClaw tool plugin.
|
||||||
|
|
||||||
|
## Build
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npm install
|
||||||
|
npm run plugin:build
|
||||||
|
npm run plugin:validate
|
||||||
|
npm test
|
||||||
|
```
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
"id": "tools",
|
||||||
|
"name": "Tools",
|
||||||
|
"description": "Add Tools tools to OpenClaw.",
|
||||||
|
"version": "0.1.0",
|
||||||
|
"configSchema": {
|
||||||
|
"type": "object",
|
||||||
|
"additionalProperties": false,
|
||||||
|
"properties": {}
|
||||||
|
},
|
||||||
|
"activation": {
|
||||||
|
"onStartup": true
|
||||||
|
},
|
||||||
|
"contracts": {
|
||||||
|
"tools": [
|
||||||
|
"echo"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
{
|
||||||
|
"name": "openclaw-plugin-tools",
|
||||||
|
"version": "0.1.0",
|
||||||
|
"type": "module",
|
||||||
|
"private": true,
|
||||||
|
"scripts": {
|
||||||
|
"build": "tsc -p tsconfig.json",
|
||||||
|
"plugin:build": "npm run build && openclaw plugins build --entry ./dist/index.js",
|
||||||
|
"plugin:validate": "npm run build && openclaw plugins validate --entry ./dist/index.js",
|
||||||
|
"test": "vitest run --config ./vitest.config.ts"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"dist",
|
||||||
|
"openclaw.plugin.json",
|
||||||
|
"README.md"
|
||||||
|
],
|
||||||
|
"peerDependencies": {
|
||||||
|
"openclaw": ">=2026.5.17"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"typebox": "^1.1.38"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"openclaw": "latest",
|
||||||
|
"typescript": "7.0.2",
|
||||||
|
"vitest": "^3.2.0"
|
||||||
|
},
|
||||||
|
"openclaw": {
|
||||||
|
"extensions": [
|
||||||
|
"./dist/index.js"
|
||||||
|
],
|
||||||
|
"compat": {
|
||||||
|
"pluginApi": ">=2026.5.17"
|
||||||
|
},
|
||||||
|
"build": {
|
||||||
|
"openclawVersion": "2026.10.1"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
import { describe, expect, it } from "vitest";
|
||||||
|
import entry from "./index.js";
|
||||||
|
import { getToolPluginMetadata } from "openclaw/plugin-sdk/tool-plugin";
|
||||||
|
|
||||||
|
describe("tools", () => {
|
||||||
|
it("declares tool metadata", () => {
|
||||||
|
expect(getToolPluginMetadata(entry)?.tools.map((tool) => tool.name)).toEqual(["echo"]);
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
import { Type } from "typebox";
|
||||||
|
import { defineToolPlugin } from "openclaw/plugin-sdk/tool-plugin";
|
||||||
|
|
||||||
|
export default defineToolPlugin({
|
||||||
|
id: "tools",
|
||||||
|
name: "Tools",
|
||||||
|
description: "Add Tools tools to OpenClaw.",
|
||||||
|
tools: (tool) => [
|
||||||
|
tool({
|
||||||
|
name: "echo",
|
||||||
|
description: "Echo input text.",
|
||||||
|
parameters: Type.Object({
|
||||||
|
input: Type.String({ description: "Text to echo." }),
|
||||||
|
}),
|
||||||
|
execute: async ({ input }) => ({ input }),
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
});
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"target": "ES2022",
|
||||||
|
"module": "NodeNext",
|
||||||
|
"moduleResolution": "NodeNext",
|
||||||
|
"strict": true,
|
||||||
|
"declaration": true,
|
||||||
|
"rootDir": "src",
|
||||||
|
"outDir": "dist",
|
||||||
|
"skipLibCheck": true
|
||||||
|
},
|
||||||
|
"include": [
|
||||||
|
"src/index.ts"
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
import { defineConfig } from "vitest/config";
|
||||||
|
|
||||||
|
export default defineConfig({
|
||||||
|
test: {
|
||||||
|
environment: "node",
|
||||||
|
include: ["src/**/*.test.ts"],
|
||||||
|
},
|
||||||
|
});
|
||||||
Reference in new issue
Block a user