Docs: precipitate Action Lookup skill_cli contract (v1.0.119)
All checks were successful
技能自动化发布 / release (push) Successful in 10s

This commit is contained in:
2026-09-28 11:56:12 +08:00
parent bf3bb9cd10
commit c49fcba157
12 changed files with 264 additions and 24 deletions

View File

@@ -6,7 +6,8 @@
- `skill-cell-presentation.example.json`:数据管理单元格呈现文档形状参考(见 `references/CELL_PRESENTATION.md`)。
- `skill-grid-presentation.example.json`:数据管理整行 / 整列 / 区域呈现文档形状参考(见 `references/CELL_PRESENTATION.md`)。
- `render-html.action.example.json`:HTML 报告「重新生成」Action 形状参考(固定 id `render-html`;见 `references/ACTIONS.md`)。
- `lookup-action.example.json`:Action 内联 Lookup 形状参考(单选 + `multiple: true` 多选并列;跨表引用勿填编号;见 `references/ACTIONS.md`「跨表引用:Lookup」)。
- `lookup-action.example.json`:Action 内联 Lookup(**local_sql**)形状参考(单选 + `multiple: true`;同库跨表勿填编号;见 `references/ACTIONS.md`「跨表引用:Lookup」)。
- `lookup-skill-cli.action.example.json`:Action Lookup **`skill_cli`** 形状参考(打开表单时宿主调兄弟技能 CLI 抽 JSON 选项;跨技能账号列表勿再造本库缓存表;见同节)。
- `year-month-action.example.json`:Action / CRUD 账期月份字段 `display_type: year_month` 形状参考(见 `references/ACTIONS.md`「表单字段类型对照」)。
- `visible-when-action.example.json`:Action 参数字段条件显隐 `visibleWhen` 形状参考(互斥模式联动;见 `references/ACTIONS.md`「字段条件显隐」;≠ Policy L3)。
- `selection-label-column.action.example.json`:选择摘要 `bind.labelColumn` 形状参考(见 `references/ACTIONS.md`「选择摘要」)。

View File

@@ -1,5 +1,5 @@
{
"_comment": "形状参考:Action 参数引用同库另一张表时用 Lookup。单选与多选同一 lookup 对象,多选只加 multiple:true。完整契约见 references/ACTIONS.md「跨表引用:Lookup」与 references/SCHEMA.md。",
"_comment": "形状参考:Action 参数引用同库另一张表时用 Lookup(local_sql)。单选与多选同一 lookup 对象,多选只加 multiple:true。跨技能列表见 lookup-skill-cli.action.example.json。完整契约见 references/ACTIONS.md「跨表引用:Lookup」。",
"schemaVersion": 1,
"skill": "your-skill-slug",
"actions": [

View File

@@ -0,0 +1,51 @@
{
"_comment": "形状参考:Action Lookup 的 skill_cli 源——打开表单时宿主 sync 调用兄弟技能 CLI,从 stdout JSON 抽选项。完整契约见 references/ACTIONS.md「跨表引用:Lookup」。本例对标 account-manager 遗留 list-json(stdout 为账号数组,字段 id / account_label);其它依赖技能请核对自己的命令与 JSON 形状。",
"schemaVersion": 1,
"skill": "your-skill-slug",
"actions": [
{
"id": "publish-with-account",
"label": "发布(示例)",
"description": "演示跨技能选账号:skill_cli 调 account-manager,勿在本技能维护账号缓存表。",
"placements": ["toolbar", "cron"],
"executionProfile": "async",
"interaction": "form",
"bind": {
"tables": ["articles"],
"selectionMode": "none"
},
"entrypoint": {
"type": "cli",
"command": "run",
"args": ["--account-id", "{{accountId}}", "--pick", "{{pickCount}}"]
},
"inputSchema": {
"type": "object",
"required": ["pickCount"],
"properties": {
"pickCount": {
"type": "number",
"title": "发布数量",
"description": "从未发布队列领取的条数",
"default": 1,
"minimum": 1
},
"accountId": {
"type": "string",
"title": "发布账号",
"description": "不选则由系统自动分配;选定后本次全部使用该号。",
"display_type": "lookup",
"lookup": {
"source": "skill_cli",
"skill": "account-manager",
"command": "list-json",
"args": ["toutiao"],
"value_column": "id",
"label_column": "account_label"
}
}
}
}
}
]
}

View File

@@ -139,7 +139,7 @@
},
"lookup": {
"$ref": "#/$defs/lookupConfig",
"description": "可选。内联同库表关联 Lookup(与列 options_json lookup 对象同构)。用于当前表没有对应列时;推荐同时设 display_type=lookup。见 ACTIONS.md「跨表引用:Lookup」。"
"description": "可选。Action 内联 Lookup:local_sql(同库表)/ skill_cli(兄弟技能 CLI JSON)/ external_api(预留)。打开表单时由宿主解析。推荐同时设 display_type=lookup。见 ACTIONS.md「跨表引用:Lookup」。"
},
"visibleWhen": {
"description": "可选。表单字段条件显隐。宿主在数据管理/定时任务参数表单中:规则不满足则隐藏该字段、提交时省略、且不校验 required。支持 {field,equals} / {field,in:[...]},或单键简写 {collectMode:\"按关键词采集\"} / {collectMode:[\"a\",\"b\"]}。Agent/CLI 无 UI 时同样按当前 input 求值后剥离隐藏字段。",
@@ -187,26 +187,35 @@
},
"lookupConfig": {
"type": "object",
"required": ["ref_table", "value_column", "label_column"],
"additionalProperties": false,
"properties": {
"source": {
"type": "string",
"enum": ["local_sql", "skill_cli", "external_api"],
"description": "可选。显式数据源;省略时:有 ref_table→local_sql,有 skill→skill_cli,有 url→external_api。"
},
"lookup_source": {
"type": "string",
"enum": ["local_sql", "skill_cli", "external_api"],
"description": "可选。source 别名。"
},
"ref_table": {
"type": "string",
"minLength": 1,
"pattern": "^[a-zA-Z_][a-zA-Z0-9_]*$",
"description": "同库被引用表名"
"description": "local_sql:同库被引用表名"
},
"value_column": {
"type": "string",
"minLength": 1,
"pattern": "^[a-zA-Z_][a-zA-Z0-9_]*$",
"description": "提交值列(编号 / 外键)"
"description": "提交值列;local_sql 必填;skill_cli/external_api 默认可为 id"
},
"label_column": {
"type": "string",
"minLength": 1,
"pattern": "^[a-zA-Z_][a-zA-Z0-9_]*$",
"description": "主文案列"
"description": "主文案列;local_sql 必填;skill_cli 默认可为 display_label"
},
"extra_column": {
"type": "string",
@@ -218,18 +227,90 @@
"type": "string",
"minLength": 1,
"pattern": "^[a-zA-Z_][a-zA-Z0-9_]*$",
"description": "可选。等值过滤列"
"description": "可选。local_sql 等值过滤列"
},
"filter_value": {
"type": ["string", "number", "boolean", "null"],
"description": "可选。与 filter_column 配对的等值"
},
"skill": {
"type": "string",
"minLength": 1,
"description": "skill_cli:兄弟/依赖技能 slug"
},
"skill_slug": {
"type": "string",
"minLength": 1,
"description": "skill_cli:skill 别名"
},
"command": {
"type": "string",
"minLength": 1,
"description": "skill_cli:CLI 子命令(argv[0])"
},
"cli_command": {
"type": "string",
"minLength": 1,
"description": "skill_cli:command 别名"
},
"args": {
"oneOf": [
{
"type": "array",
"items": { "type": "string" }
},
{ "type": "string" }
],
"description": "skill_cli:追加 argv;数组或逗号分隔串"
},
"items_path": {
"type": "string",
"minLength": 1,
"description": "skill_cli / external_api:stdout JSON 内选项数组点路径,默认 items"
},
"url": {
"type": "string",
"minLength": 1,
"description": "external_api(预留):HTTP URL"
},
"endpoint": {
"type": "string",
"minLength": 1,
"description": "external_api:url 别名"
},
"method": {
"type": "string",
"enum": ["GET", "POST"],
"description": "external_api:HTTP 方法,默认 GET"
},
"multiple": {
"type": "boolean",
"description": "可选。true=多选 Lookup(存/提交 TEXT 逗号分隔 id);省略或 false=单选(默认)。与 CRUD options_json lookup 同构。"
"description": "可选。true=多选 Lookup(存/提交 TEXT 逗号分隔 id);省略或 false=单选(默认)。"
}
},
"description": "同库 FK 式 Lookup。展示:value · label;有 extra 时 value · label(extra)。multiple 时多选。宿主亦接受 camelCase 键名。"
"oneOf": [
{
"required": ["ref_table", "value_column", "label_column"],
"description": "local_sql(同库表)"
},
{
"anyOf": [
{ "required": ["skill", "command"] },
{ "required": ["skill", "cli_command"] },
{ "required": ["skill_slug", "command"] },
{ "required": ["skill_slug", "cli_command"] }
],
"description": "skill_cli(兄弟技能 CLI JSON)"
},
{
"anyOf": [
{ "required": ["url"] },
{ "required": ["endpoint"] }
],
"description": "external_api(预留)"
}
],
"description": "Action Lookup:local_sql / skill_cli / external_api。展示:value · label;有 extra 时 value · label(extra)。宿主亦接受 camelCase。列 Lookup 仅 local_sql,见 SCHEMA.md。"
},
"inputSchema": {
"type": "object",