@syngy/create-webskill 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -6,4 +6,5 @@ Create a BotWorks web skill package skeleton.
6
6
  npm create @syngy/webskill web-skills/example -- --title "Example workflow" --domain example.com
7
7
  ```
8
8
 
9
- Edit the generated files, then publish them from BotWorks with `browser_use.web_skill_publish`.
9
+ The generated package includes `SKILL.md`, `manifest.json`, `scripts/README.md`, and `scripts/check_current_page.js`.
10
+ Publish the generated package from BotWorks with `browser_use.web_skill_publish`.
@@ -34,7 +34,17 @@ function filesFor({ title, domain }) {
34
34
  domains: [domain],
35
35
  pathPatterns: ['/**'],
36
36
  entryPath: 'SKILL.md',
37
- tools: []
37
+ tools: [
38
+ {
39
+ name: 'check_current_page',
40
+ summary: 'Read the current page title and URL after the documented steps.',
41
+ script: 'scripts/check_current_page.js',
42
+ inputSchema: {
43
+ type: 'object',
44
+ properties: {}
45
+ }
46
+ }
47
+ ]
38
48
  }
39
49
  return {
40
50
  'SKILL.md': `# ${title}
@@ -46,17 +56,22 @@ function filesFor({ title, domain }) {
46
56
 
47
57
  ## 成功链路
48
58
 
49
- 把已经验证通过的浏览器操作步骤写在这里。步骤应包含入口页面、关键按钮或输入框、必要等待条件、完成后的可验证页面状态。
59
+ 1. 打开 \`https://${domain}/\`。
60
+ 2. 等待页面加载完成。
61
+ 3. 确认当前 URL 属于 \`${domain}\`。
62
+ 4. 按当前任务要求核对页面标题或页面上的关键文字。
50
63
 
51
64
  ## 脚本
52
65
 
53
- 脚本文件放在 \`scripts/\` 下。需要暴露脚本工具时,在 \`manifest.json\` \`tools\` 中增加工具名、说明、脚本路径和 inputSchema。
66
+ \`scripts/check_current_page.js\` 会读取当前页面标题和 URL,可用于确认页面状态。
54
67
 
55
- 脚本入口固定为:
68
+ 脚本入口:
56
69
 
57
70
  \`\`\`js
58
71
  async function run(args, context) {
59
- return { result: { title: context.title, url: context.url } };
72
+ const title = await context.pageTool.page.title();
73
+ const url = await context.pageTool.page.url();
74
+ return { result: { title: title.value, url: url.value } };
60
75
  }
61
76
  \`\`\`
62
77
 
@@ -85,15 +100,17 @@ const code = await context.pageTool.visual.getImageContent({ ref: "e4" }, { type
85
100
 
86
101
  Method groups:
87
102
 
88
- - \`page.url()\`, \`page.title()\`, \`page.viewport()\`, \`page.waitForLoadState(state)\`, \`page.waitForTimeout(ms)\`
89
- - \`keyboard.type(text)\`, \`keyboard.press(key)\`, \`keyboard.down(key)\`, \`keyboard.up(key)\`, \`keyboard.insertText(text)\`
90
- - \`mouse.move(x, y)\`, \`mouse.click(x, y)\`, \`mouse.dblclick(x, y)\`, \`mouse.down()\`, \`mouse.up()\`, \`mouse.wheel(deltaX, deltaY)\`
91
- - \`element.click(target)\`, \`element.hover(target)\`, \`element.type(target, text)\`, \`element.fill(target, value)\`, \`element.press(target, key)\`
92
- - \`element.text(target)\`, \`element.html(target)\`, \`element.box(target)\`, \`element.exists(target)\`
93
- - \`visual.getElementContent(target, schema)\`, \`visual.getViewportContent(schema)\`, \`visual.getImageContent(target, schema)\`
103
+ - \`context.pageTool.page.url()\`, \`context.pageTool.page.title()\`, \`context.pageTool.page.viewport()\`, \`context.pageTool.page.waitForLoadState(state)\`, \`context.pageTool.page.waitForTimeout(ms)\`
104
+ - \`context.pageTool.keyboard.type(text)\`, \`context.pageTool.keyboard.press(key)\`, \`context.pageTool.keyboard.down(key)\`, \`context.pageTool.keyboard.up(key)\`, \`context.pageTool.keyboard.insertText(text)\`
105
+ - \`context.pageTool.mouse.move(x, y)\`, \`context.pageTool.mouse.click(x, y)\`, \`context.pageTool.mouse.dblclick(x, y)\`, \`context.pageTool.mouse.down()\`, \`context.pageTool.mouse.up()\`, \`context.pageTool.mouse.wheel(deltaX, deltaY)\`
106
+ - \`context.pageTool.element.click(target)\`, \`context.pageTool.element.hover(target)\`, \`context.pageTool.element.type(target, text)\`, \`context.pageTool.element.fill(target, value)\`, \`context.pageTool.element.press(target, key)\`
107
+ - \`context.pageTool.element.text(target)\`, \`context.pageTool.element.html(target)\`, \`context.pageTool.element.box(target)\`, \`context.pageTool.element.exists(target)\`
108
+ - \`context.pageTool.visual.getElementContent(target, schema)\`, \`context.pageTool.visual.getViewportContent(schema)\`, \`context.pageTool.visual.getImageContent(target, schema)\`
94
109
  `,
95
- 'scripts/example.js': `async function run(args, context) {
96
- return { result: { title: context.title, url: context.url } };
110
+ 'scripts/check_current_page.js': `async function run(args, context) {
111
+ const title = await context.pageTool.page.title();
112
+ const url = await context.pageTool.page.url();
113
+ return { result: { title: title.value, url: url.value } };
97
114
  }
98
115
  `,
99
116
  '.webskill/source.json': `${JSON.stringify({ source: 'init' }, null, 2)}\n`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@syngy/create-webskill",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Create a BotWorks web skill package skeleton",
5
5
  "type": "module",
6
6
  "bin": {