@sparkelf/dsh-dataops-managed 0.3.26 → 0.3.28
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/lib/index.js +17 -5
- package/package.json +1 -1
- package/skills/dataops-collect/SKILL.md +17 -18
package/lib/index.js
CHANGED
|
@@ -2444,23 +2444,34 @@ const CAPABILITIES = [
|
|
|
2444
2444
|
name: "数据查询",
|
|
2445
2445
|
description: "通过 DataOps 数据查询能力回答业务问题",
|
|
2446
2446
|
defaultEnabled: true,
|
|
2447
|
+
visible: () => true,
|
|
2447
2448
|
allowed: () => true
|
|
2448
2449
|
},
|
|
2449
2450
|
{
|
|
2450
|
-
id: "
|
|
2451
|
-
name: "
|
|
2452
|
-
description: "
|
|
2451
|
+
id: "resource.manage",
|
|
2452
|
+
name: "资源管理",
|
|
2453
|
+
description: "在对话中批量审批资源申请,给用户或角色授予资源访问权限",
|
|
2453
2454
|
defaultEnabled: true,
|
|
2454
|
-
|
|
2455
|
+
visible: (scope) => isAdmin(scope),
|
|
2456
|
+
allowed: (scope) => isAdmin(scope)
|
|
2455
2457
|
},
|
|
2456
2458
|
{
|
|
2457
2459
|
id: "admin.manage",
|
|
2458
2460
|
name: "万相中台管理",
|
|
2459
2461
|
description: "登录万相中台后台执行管理动作",
|
|
2460
2462
|
defaultEnabled: true,
|
|
2463
|
+
visible: (scope) => isAdmin(scope),
|
|
2461
2464
|
allowed: (scope) => isAdmin(scope)
|
|
2462
2465
|
}
|
|
2463
2466
|
];
|
|
2467
|
+
/**
|
|
2468
|
+
* Persisted ids that moved to a new capability id.
|
|
2469
|
+
*
|
|
2470
|
+
* `approval.push` shipped before the capability grew from approval push into resource
|
|
2471
|
+
* approval and authorization. Its stored toggle carries over to `resource.manage`; when both
|
|
2472
|
+
* keys are present the current id wins.
|
|
2473
|
+
*/
|
|
2474
|
+
const CAPABILITY_ALIASES = { "approval.push": "resource.manage" };
|
|
2464
2475
|
/** The ids the catalogue accepts; any other persisted key is a legacy value. */
|
|
2465
2476
|
const CAPABILITY_IDS = CAPABILITIES.map((capability) => capability.id);
|
|
2466
2477
|
/**
|
|
@@ -2477,6 +2488,7 @@ function migrateCapabilities(value) {
|
|
|
2477
2488
|
const stored = value;
|
|
2478
2489
|
const capabilities = {};
|
|
2479
2490
|
for (const id of CAPABILITY_IDS) if (typeof stored[id] === "boolean") capabilities[id] = stored[id];
|
|
2491
|
+
for (const [legacyId, id] of Object.entries(CAPABILITY_ALIASES)) if (capabilities[id] === void 0 && typeof stored[legacyId] === "boolean") capabilities[id] = stored[legacyId];
|
|
2480
2492
|
return capabilities;
|
|
2481
2493
|
}
|
|
2482
2494
|
/** Read state; a missing or corrupt file is a safe disabled state. */
|
|
@@ -2512,7 +2524,7 @@ async function writeConnectorState(state, path = CONNECTOR_STATE_PATH) {
|
|
|
2512
2524
|
}
|
|
2513
2525
|
/** Build the connector row for one current scope. */
|
|
2514
2526
|
function buildConnectorView(scope, state) {
|
|
2515
|
-
const capabilities = scope === void 0 ? [] : CAPABILITIES.filter((capability) => capability.allowed(scope)).map((capability) => ({
|
|
2527
|
+
const capabilities = scope === void 0 ? [] : CAPABILITIES.filter((capability) => capability.visible(scope) && capability.allowed(scope)).map((capability) => ({
|
|
2516
2528
|
id: capability.id,
|
|
2517
2529
|
name: capability.name,
|
|
2518
2530
|
description: capability.description,
|
package/package.json
CHANGED
|
@@ -38,7 +38,7 @@ description: 把表格 / Excel / CSV 建成可问数的数据资源,或把新
|
|
|
38
38
|
|
|
39
39
|
1. **一次会话一份文件、一个目标资源。** 多文件批量不做。
|
|
40
40
|
2. **有引用 = 追加;无引用 = 先问,不默认新建。** 用户话里已经说清“新建”或“追加”的,跳过这一问;没说清又没引用,必须先出「新建资源 / 选择已有资源」二选一,不能直接出新建计划。
|
|
41
|
-
3. **计划确认是唯一硬闸。**
|
|
41
|
+
3. **计划确认是唯一硬闸。** 用户明确回复「确认」「开始吧」「可以」等之前,绝不调用 `dataops_collect_execute`,绝不建表、绝不写数。预览和计划工具本身不建表,可以放心调用。
|
|
42
42
|
4. **执行走原生工具流。** 不要自己造执行卡、进度卡;工具参数、结果、耗时、失败原因都在原生工具卡里。你只在旁边说人话。
|
|
43
43
|
|
|
44
44
|
## 三、主流程
|
|
@@ -86,43 +86,42 @@ description: 把表格 / Excel / CSV 建成可问数的数据资源,或把新
|
|
|
86
86
|
- 新建表:`plan.mode === 'CREATE_TABLE'`,有 `plan.createTable`、`plan.createSql`;
|
|
87
87
|
- 追加:`plan.mode === 'EXISTING_TABLE'`,有 `plan.mappings`,并在计划里多一行映射摘要(匹配 N 个字段、新增 N 个、N 个类型不兼容)。
|
|
88
88
|
|
|
89
|
-
### 5. 出计划 GenUI
|
|
89
|
+
### 5. 出计划 GenUI(只读预览,语言确认)
|
|
90
90
|
|
|
91
|
-
|
|
91
|
+
计划是主确认点,但**只读**:卡上不放 `input` / `textarea` / 下拉 / `submit`,也不放「开始导入」「再调整」按钮。用户看完卡后,直接用自然语言回复「确认」「开始吧」才执行。
|
|
92
92
|
|
|
93
|
-
|
|
94
|
-
- 目标表(原始层库表名,AI 起草,可改)
|
|
95
|
-
- 导入数据源(只有一个源时自动选中并置灰;多个源时让用户选)
|
|
96
|
-
- 字段总数,以及哪几个类型拿不准(标黄 / 写“需确认”)
|
|
97
|
-
- 去向(新建资源 / 追加到某个已有资源)
|
|
98
|
-
- 描述与标签(AI 起草,可改)
|
|
99
|
-
- 默认权限(仅自己可见)
|
|
93
|
+
必须包含(全部纯展示):
|
|
100
94
|
|
|
101
|
-
|
|
95
|
+
- 资源名(AI 起草)
|
|
96
|
+
- 去向(新建资源 / 追加到「已有资源名」)
|
|
97
|
+
- 目标表(库.表)
|
|
98
|
+
- 导入数据源
|
|
99
|
+
- 行数 / 字段数
|
|
100
|
+
- **表头映射**:原表头 → 目标字段 → 类型;低置信度类型写「需确认」,并用 warning callout 再列一遍(GenUI 表格单元格不支持单独标黄)
|
|
101
|
+
- 默认权限
|
|
102
102
|
|
|
103
|
-
计划 GenUI 示例(把 `<...>`
|
|
103
|
+
计划 GenUI 示例(把 `<...>` 换成真实值;注意没有任何输入控件):
|
|
104
104
|
|
|
105
105
|
```dsh-ui
|
|
106
|
-
{"title":"导入计划","items":[{"type":"text","size":"body","content":"看了下,明细 sheet 共 <行数> 行、<列数> 列;我先按明细建资源。"},{"type":"card","title":"<资源名>","items":[{"type":"keyvalue","pairs":[{"key":"
|
|
106
|
+
{"title":"导入计划","items":[{"type":"text","size":"body","content":"看了下,明细 sheet 共 <行数> 行、<列数> 列;我先按明细建资源。"},{"type":"card","title":"<资源名>","items":[{"type":"keyvalue","pairs":[{"key":"资源名","value":"<资源名>"},{"key":"去向","value":"新建资源"},{"key":"目标表","value":"<schema.table>"},{"key":"导入数据源","value":"<数据源名>"},{"key":"行数 / 字段数","value":"<行数> 行 / <字段数> 列"},{"key":"默认权限","value":"仅自己可见"}]},{"type":"table","columns":["原表头","目标字段","类型"],"rows":[["<原表头1>","<目标字段1>","<类型1>"],["<原表头2>","<目标字段2>","⚠️ 需确认"]]},{"type":"callout","tone":"warning","content":"以下类型需要确认:<列出低置信度字段>。"},{"type":"callout","tone":"info","content":"确认无误请直接回复「确认」或「开始吧」;要改表名、类型或资源名,直接说,我会重新出计划,不会执行。"}]}]}
|
|
107
107
|
```
|
|
108
108
|
|
|
109
109
|
规则:
|
|
110
110
|
|
|
111
|
-
-
|
|
112
|
-
-
|
|
113
|
-
- 确认后,计划折叠成一行“已按此计划执行”的回执,把屏幕让给工具流;
|
|
111
|
+
- 用户提出修改(「表名换成 xxx」「金额按文本存」「资源名改成 xxx」)→ 只在对话里改参数,然后重新调用 `dataops_collect_plan` / 调整计划,**重新出只读计划卡,不要执行**;
|
|
112
|
+
- 用户确认后,计划折叠成一行“已按此计划执行”的回执,把屏幕让给工具流;
|
|
114
113
|
- 确认后如果要改参数,先停,再出新计划。
|
|
115
114
|
|
|
116
115
|
### 6. 执行
|
|
117
116
|
|
|
118
|
-
|
|
117
|
+
用户明确回复「确认」「开始吧」「可以」后,使用计划卡上展示的资源名/目标表/描述调用:
|
|
119
118
|
|
|
120
119
|
`dataops_collect_execute({ session_id, data_source_urn, mode, target_schema?, target_table?, create_plan_json, mappings_json, resource_name, resource_description, resource_tags?, ai_visible?, access_level? })`
|
|
121
120
|
|
|
122
121
|
- `mode` 用 `plan.mode`;
|
|
123
122
|
- 新建表:`create_plan_json` 传 `JSON.stringify(plan.createTable)`,`mappings_json` 传 `"[]"`;
|
|
124
123
|
- 追加:`mappings_json` 传 `JSON.stringify(plan.mappings)`;
|
|
125
|
-
- `resource_name`
|
|
124
|
+
- `resource_name` 用计划卡上展示、用户确认过的资源名;
|
|
126
125
|
- `access_level` 默认 `PRIVATE`;`ai_visible` 默认 `true`。
|
|
127
126
|
|
|
128
127
|
执行期间只说阶段小结,例如:
|