refactor(skill): 参数改为动词作键,去掉 op/name/input_args

形状:{"list":"all"} / {"get":"<名>"} / {"run":"<名>","args":{...}},三者恰好给一个。
- 互斥无法用 required 表达,校验与报错回显放在 toolSkill
- list 取值是字符串范围而非布尔,为将来的技能分类留扩展位;今天只认 all
- list/get 带非空 args 一律报错,不静默丢弃
- 旧形状 {op,name,input_args} 仍由 toolSkill 兜底翻译,只为兼容存量技能文档,不再对外文档化
- README/AGENTS/skills 文档与内置技能调用示例同步为新形态
This commit is contained in:
2026-10-21 09:25:25 +08:00
parent 767caa8574
commit 76a0e9ad86
15 changed files with 124 additions and 73 deletions
+2 -2
View File
@@ -31,7 +31,7 @@ visit_url: /app/{task_id}/
## 初始化
调用 `skill(name="data-page", op="run")`,无需参数。它会把以下文件复制到 `.app/`:
调用 `skill {"run":"data-page"}`,无需参数。它会把以下文件复制到 `.app/`:
- `table.html` / `dashboard.html` / `kanban.html` —— 三个数据页模板
- `nav.html` —— 多页导航首页模板(静态卡片,无 config)
@@ -80,7 +80,7 @@ const taskId = location.pathname.split('/').filter(Boolean)[1];
1. **明确数据结构**:与用户确认字段。如果描述模糊,可以建议合理的结构。
2. **创建表并录入数据**:用 `db` 工具完成。
3. **初始化**:调用 `skill(name="data-page", op="run")`。
3. **初始化**:调用 `skill {"run":"data-page"}`。
4. **为每个要生成的页面写 config 文件**(见下一节)。**不要读也不要改模板本身**。
5. **选定入口页 `.app/index.html`**(index 是副本,允许编辑;模板本体不动):
- **用到 ≥2 个模板页** → `cp .app/nav.html .app/index.html`,改标题为业务名,并把未启用页面的卡片删掉(没配过的页点开会报 no such table)。子页标题左侧的「‹」返回键链回此导航页。
+1 -1
View File
@@ -25,7 +25,7 @@ def main():
try:
args = json.loads(sys.argv[1])
if not isinstance(args, dict):
raise ValueError('input_args 必须是 JSON 对象')
raise ValueError('技能参数必须是 JSON 对象')
if args:
print('本技能无参数,收到:' + json.dumps(args, ensure_ascii=False),
file=sys.stderr)