js-hello-ops-skill · diff
v1.0.0 to v1.0.0
1 added, 1 removed. Audit A to A.
---
name: js-hello-ops-skill
description: JS Eyes Skills 最小样例 — 读取任意标签页的标题。
version: 1.0.0
metadata:
openclaw:
emoji: "\U0001F44B"
homepage: https://github.com/imjszhang/js-eyes
requires:
skills:
- js-eyes
bins:
- node
---
# js-hello-ops-skill
JS Eyes Skills **最小 V2 样例** — 一个工具、零副作用,演示
`skill.manifest.json` + `skill.definition.js` + `skill.entry.js` 的最简形态。
## 依赖
- JS Eyes Server 已运行
- 浏览器已装 JS Eyes 扩展并连上服务器
- Node.js >= 22
- (可选)OpenClaw 加载 `js-eyes` 插件并 `tools.alsoAllow: ["js-eyes"]`
## 提供的 AI 工具
| 工具 | 说明 |
|------|------|
| `hello_get_title` | 读取指定标签页的 `title` 与 `url`(底层调 `BrowserAutomation.getPageInfo`) |
## 编程 API
```javascript
const { BrowserAutomation } = require('./lib/js-eyes-client');
const { getTitle } = require('./scripts/hello');
const bot = new BrowserAutomation('ws://localhost:18080');
const { title, url } = await getTitle(bot, { tabId: 123 });
```
## CLI
```bash
# 查看所有命令
node index.js --help
# 或
node cli/index.js --help
# 读取 tabId=123 的标题
node index.js title 123
# 指定浏览器
node index.js title 123 --target firefox
```
## 目录结构
```text
js-hello-ops-skill/
├── SKILL.md # 本文件(给 Agent 读)
├── package.json
├── skill.manifest.json # V2 静态元数据(发现阶段只读此文件)
├── skill.definition.js # TOOL_DEFINITIONS + capabilities / requirements
├── skill.entry.js # handlers(发现阶段不会执行)
├── index.js # CLI 入口
├── cli/index.js # CLI 帮助文案
├── scripts/hello.js # 业务实现
└── lib/
├── js-eyes-client.js # 自包含 WebSocket 客户端
└── runtimeConfig.js # 极简 serverUrl 解析
```
## 详细教程
- 开发指南:[docs/dev/js-eyes-skills/authoring.zh.md](../../../docs/dev/js-eyes-skills/authoring.zh.md)
- 部署启用:[docs/dev/js-eyes-skills/deployment.zh.md](../../../docs/dev/js-eyes-skills/deployment.zh.md)
- - V1 契约样例(已弃用):[examples/legacy/](../../legacy/)
+ - V1 已移除;迁移说明:[examples/legacy/](../../legacy/)