@arcticdata/dsh-datarc-assistant 0.0.0-stage → 26.39.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 +46 -2
- package/api-operations.js +404 -0
- package/client.js +475 -0
- package/cordis.patch.yml +4 -0
- package/entry/SKILL.md +34 -0
- package/icon.png +0 -0
- package/index.js +69 -0
- package/locale/en.json +6 -0
- package/locale/zh.json +6 -0
- package/native-api.mjs +326 -0
- package/native-contracts.js +195 -0
- package/native-execution.js +184 -0
- package/native-runner.mjs +107 -0
- package/native-state.js +67 -0
- package/native-tools.js +241 -0
- package/operations.js +1260 -0
- package/package.json +65 -6
- package/runtime/datarc-access-permissions/SKILL.md +30 -0
- package/runtime/datarc-access-permissions/references/api.md +31 -0
- package/runtime/datarc-access-permissions/references/write-order.md +16 -0
- package/runtime/datarc-analysis-report/SKILL.md +125 -0
- package/runtime/datarc-analysis-report/agents/openai.yaml +6 -0
- package/runtime/datarc-analysis-report/references/analyst-frameworks.md +215 -0
- package/runtime/datarc-analysis-report/references/api-contracts.md +478 -0
- package/runtime/datarc-analysis-report/references/direct-card-fallback-design.md +66 -0
- package/runtime/datarc-analysis-report/references/human-in-the-loop.md +142 -0
- package/runtime/datarc-analysis-report/references/loop-personalization-policy.md +138 -0
- package/runtime/datarc-analysis-report/references/manifest-example.json +779 -0
- package/runtime/datarc-analysis-report/references/narrative-schema.md +160 -0
- package/runtime/datarc-analysis-report/references/question-syntax.md +151 -0
- package/runtime/datarc-analysis-report/scripts/run_analysis_report.py +2225 -0
- package/runtime/datarc-analysis-report/scripts/run_dataseek_cards.py +1914 -0
- package/runtime/datarc-analysis-report/scripts/test_run_analysis_report.py +5295 -0
- package/runtime/datarc-data-search/SKILL.md +243 -0
- package/runtime/datarc-data-search/scripts/calculate.py +116 -0
- package/runtime/datarc-data-search/scripts/data-search.mjs +628 -0
- package/runtime/datarc-data-search/scripts/datarc-client.mjs +464 -0
- package/runtime/datarc-data-search/scripts/search-result.mjs +211 -0
- package/runtime/datarc-dataseek-batch-evaluation/SKILL.md +59 -0
- package/runtime/datarc-dataseek-batch-evaluation/references/artifacts.md +36 -0
- package/runtime/datarc-dataseek-batch-evaluation/references/equivalence.md +30 -0
- package/runtime/datarc-dataseek-batch-evaluation/scripts/datarc-client.mjs +464 -0
- package/runtime/datarc-dataseek-batch-evaluation/scripts/dataseek-batch-evaluation.mjs +1020 -0
- package/runtime/datarc-dataseek-search/SKILL.md +96 -0
- package/runtime/datarc-dataseek-search/scripts/datarc-client.mjs +464 -0
- package/runtime/datarc-dataseek-search/scripts/dataseek-search.mjs +257 -0
- package/runtime/datarc-dataseek-semantic-debugging/SKILL.md +44 -0
- package/runtime/datarc-dataseek-semantic-debugging/agents/openai.yaml +4 -0
- package/runtime/datarc-dataseek-semantic-debugging/evals/evals.json +165 -0
- package/runtime/datarc-dataseek-semantic-debugging/references/dataset.md +77 -0
- package/runtime/datarc-dataseek-semantic-debugging/references/input-and-resolution.md +93 -0
- package/runtime/datarc-dataseek-semantic-debugging/references/interventions.md +64 -0
- package/runtime/datarc-dataseek-semantic-debugging/references/knowledge-and-prompts.md +47 -0
- package/runtime/datarc-dataseek-semantic-debugging/references/rollback.md +11 -0
- package/runtime/datarc-dataseek-semantic-debugging/references/verification-and-rollback.md +95 -0
- package/runtime/datarc-dataseek-semantic-debugging/scripts/semantic-debugging.mjs +29 -0
- package/runtime/datarc-dataseek-testset-generation/SKILL.md +47 -0
- package/runtime/datarc-dataseek-testset-generation/scripts/datarc-client.mjs +464 -0
- package/runtime/datarc-dataseek-testset-generation/scripts/dataseek-testset-generation.mjs +526 -0
- package/runtime/datarc-datasource/SKILL.md +97 -0
- package/runtime/datarc-oauth/SKILL.md +50 -0
- package/runtime/datarc-oauth/scripts/auth.mjs +192 -0
- package/runtime/datarc-oauth/scripts/credentials.mjs +237 -0
- package/runtime/datarc-report-add-card/SKILL.md +90 -0
- package/runtime/datarc-report-add-card/agents/openai.yaml +4 -0
- package/runtime/datarc-report-add-card/scripts/datarc-client.mjs +464 -0
- package/runtime/datarc-report-add-card/scripts/report-card.mjs +439 -0
- package/runtime/datarc-semantic-alias/SKILL.md +20 -0
- package/runtime/datarc-semantic-alias/scripts/alias-plan.mjs +422 -0
- package/runtime/datarc-semantic-alias/scripts/alias.mjs +11 -0
- package/runtime/datarc-semantic-calibration/SKILL.md +20 -0
- package/runtime/datarc-semantic-calibration/scripts/calibration-plan.mjs +683 -0
- package/runtime/datarc-semantic-calibration/scripts/calibration.mjs +11 -0
- package/runtime/datarc-semantic-core/SKILL.md +12 -0
- package/runtime/datarc-semantic-core/scripts/artifact-journal.mjs +853 -0
- package/runtime/datarc-semantic-core/scripts/canonical.mjs +48 -0
- package/runtime/datarc-semantic-core/scripts/case-model.mjs +608 -0
- package/runtime/datarc-semantic-core/scripts/cli.mjs +180 -0
- package/runtime/datarc-semantic-core/scripts/datarc-client.mjs +180 -0
- package/runtime/datarc-semantic-core/scripts/interpretation-pairs.mjs +57 -0
- package/runtime/datarc-semantic-core/scripts/interventions.mjs +693 -0
- package/runtime/datarc-semantic-core/scripts/live-resolution.mjs +305 -0
- package/runtime/datarc-semantic-core/scripts/model-scope.mjs +49 -0
- package/runtime/datarc-semantic-core/scripts/reproduction.mjs +330 -0
- package/runtime/datarc-semantic-core/scripts/semantic-cli.mjs +799 -0
- package/runtime/datarc-semantic-core/scripts/shared.mjs +312 -0
- package/runtime/datarc-semantic-core/scripts/verification.mjs +1111 -0
- package/runtime/datarc-semantic-dataset/SKILL.md +20 -0
- package/runtime/datarc-semantic-dataset/scripts/dataset-plan.mjs +749 -0
- package/runtime/datarc-semantic-dataset/scripts/dataset-preflight.mjs +813 -0
- package/runtime/datarc-semantic-dataset/scripts/dataset.mjs +11 -0
- package/runtime/datarc-semantic-knowledge/SKILL.md +38 -0
- package/runtime/datarc-semantic-knowledge/references/knowledge-drafts.md +61 -0
- package/runtime/datarc-semantic-knowledge/references/knowledge-generation.json +16 -0
- package/runtime/datarc-semantic-knowledge/scripts/knowledge-draft.mjs +347 -0
- package/runtime/datarc-semantic-knowledge/scripts/knowledge-plan.mjs +848 -0
- package/runtime/datarc-semantic-knowledge/scripts/knowledge.mjs +31 -0
- package/runtime/datarc-semantic-prompt/SKILL.md +20 -0
- package/runtime/datarc-semantic-prompt/scripts/prompt-plan.mjs +598 -0
- package/runtime/datarc-semantic-prompt/scripts/prompt.mjs +15 -0
- package/runtime/datarc-semantic-synonym/SKILL.md +20 -0
- package/runtime/datarc-semantic-synonym/scripts/synonym-plan.mjs +688 -0
- package/runtime/datarc-semantic-synonym/scripts/synonym.mjs +11 -0
- package/runtime/datarc-viz-analysis-report/SKILL.md +108 -0
- package/runtime/datarc-viz-analysis-report/assets/LICENSE-echarts.md +8 -0
- package/runtime/datarc-viz-analysis-report/assets/echarts.min.js +45 -0
- package/runtime/datarc-viz-analysis-report/references/api-contracts.md +163 -0
- package/runtime/datarc-viz-analysis-report/references/derivation-log.md +157 -0
- package/runtime/datarc-viz-analysis-report/references/evidence-framework.md +76 -0
- package/runtime/datarc-viz-analysis-report/references/html-template.md +92 -0
- package/runtime/datarc-viz-analysis-report/references/provenance-format.md +56 -0
- package/runtime/datarc-viz-analysis-report/references/question-syntax.md +151 -0
- package/runtime/datarc-viz-analysis-report/scripts/render_viz_report.py +1708 -0
- package/runtime/datarc-viz-analysis-report/scripts/test_render_viz_report.py +964 -0
- package/runtime/datarc-workspace-configuration/SKILL.md +59 -0
- package/runtime/datarc-workspace-configuration/references/artifacts.md +75 -0
- package/runtime/datarc-workspace-configuration/references/verification.md +20 -0
- package/runtime/datarc-workspace-configuration/scripts/configuration.mjs +722 -0
- package/runtime/datarc-workspace-context/SKILL.md +43 -0
- package/runtime/datarc-workspace-context/agents/openai.yaml +4 -0
- package/runtime/datarc-workspace-context/scripts/datarc-client.mjs +31 -0
- package/runtime/datarc-workspace-context/scripts/query-display.mjs +114 -0
- package/runtime/datarc-workspace-context/scripts/workspace-context.mjs +58 -0
- package/runtime/datarc-workspace-custom-tables/SKILL.md +89 -0
- package/runtime/datarc-workspace-custom-tables/scripts/datarc-client.mjs +165 -0
- package/runtime/datarc-workspace-custom-tables/scripts/workspace-custom-tables.mjs +601 -0
- package/runtime/datarc-workspace-keywords/SKILL.md +197 -0
- package/runtime/datarc-workspace-keywords/agents/openai.yaml +4 -0
- package/runtime/datarc-workspace-keywords/references/api-fields.md +79 -0
- package/runtime/datarc-workspace-keywords/references/derived-measures.md +177 -0
- package/runtime/datarc-workspace-keywords/scripts/datarc-client.mjs +145 -0
- package/runtime/datarc-workspace-keywords/scripts/workspace-keywords.mjs +2421 -0
- package/runtime/datarc-workspace-membership/SKILL.md +29 -0
- package/runtime/datarc-workspace-membership/references/api.md +19 -0
- package/runtime/datarc-workspace-modeling/SKILL.md +209 -0
- package/runtime/datarc-workspace-modeling/agents/openai.yaml +4 -0
- package/runtime/datarc-workspace-modeling/references/join-preview.md +38 -0
- package/runtime/datarc-workspace-modeling/references/model-plan.md +300 -0
- package/runtime/datarc-workspace-modeling/references/model-tags.md +95 -0
- package/runtime/datarc-workspace-modeling/references/modeling-contract.json +29 -0
- package/runtime/datarc-workspace-modeling/references/modeling-fixtures.json +2423 -0
- package/runtime/datarc-workspace-modeling/scripts/datarc-client.mjs +137 -0
- package/runtime/datarc-workspace-modeling/scripts/workspace-model-tags.mjs +238 -0
- package/runtime/datarc-workspace-modeling/scripts/workspace-modeling.mjs +1261 -0
- package/skills-provider.js +51 -0
- package/workflow-index.json +434 -0
package/README.md
CHANGED
|
@@ -1,3 +1,47 @@
|
|
|
1
|
-
#
|
|
1
|
+
# 北极九章
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
北极九章(datarc)是 DSH 中的业务分析工作台。用户直接描述业务目标,无需选择技能、输入斜杠命令或手工运行脚本。工作台负责目录、最近分析和草稿;业务操作通过 DSH 原生工具执行,复用北极九章已有 CLI 与受限 API,不是另一套聊天服务或重写业务后端。
|
|
4
|
+
|
|
5
|
+
支持 DSH `>=0.2.2-rc.5 <0.3.0-0`。工具可发现、测试或安装成功不等于真实业务验收;实际授权、查询、报告与管理操作仍需在获准的测试工作区验证。
|
|
6
|
+
|
|
7
|
+
## 从工作台开始
|
|
8
|
+
|
|
9
|
+
1. 点击左侧“北极九章”,显式选择 **DSH 本地工作文件夹**。尚未添加目录时,点击工作台“添加文件夹”,通过宿主目录选择器添加。
|
|
10
|
+
2. 从“最近分析”继续该目录的 `datarc` 会话,或点击“新建分析”。宿主可复用同目录、同预设的空白会话及其未发送草稿,不会每次都新增空会话,也不把普通会话转换为专属会话。
|
|
11
|
+
3. 描述业务目标。示例填入问题框并聚焦;已有内容时以新段落追加,不自动发送。问题按目录在插件本次生命周期内保留,刷新后不保证恢复。新建后问题作为原生草稿追加,检查后自行发送;重复新建可能重复追加,建议继续“未发送”分析。
|
|
12
|
+
4. 分析仍在 DSH 原生会话执行,保留追问、历史、后台任务和文件交付。使用“返回工作台”或左侧入口返回,不会因此再建会话。
|
|
13
|
+
|
|
14
|
+
**本地目录不是业务工作区。** 目录决定会话文件与登录配置位置;业务工作区、模型与分析口径由助手在对话中按需确认。本版工作台不直连展示业务工作区、授权状态或模型列表。打开工作台、查看最近分析或填写示例不触发业务服务或模型请求。
|
|
15
|
+
|
|
16
|
+
## 一个自动入口,按需开放业务工具
|
|
17
|
+
|
|
18
|
+
插件只发布一个由模型自动加载的入口 `datarc-assistant`(`modelInvocable: true`、`userInvocable: false`),不提供技能菜单或 `/` 调用项。Host 全局与专属预设的独立 registry 都只发布这个入口;原 24 项流程的原文和脚本作为内部 runtime 资源保留,不再注册为 24 个技能。
|
|
19
|
+
|
|
20
|
+
宿主实际选择北极九章专属 `datarc` 预设时,普通业务问数默认使用北极九章服务及原生工具,首次问数不再重复确认数据平台;这不代表已确认服务网址、授权、业务工作区、模型或口径,缺失时仍按流程确认。其他预设下,入口仍先判别目标平台;用户明确改用其他平台或本地文件时遵从,不强行接管。预设身份来自宿主实际挂载的专属 persona,不从用户文本、前端显示名称或本地工作目录推定。确认任务归属后,通过 `datarc_guide` 按需读取业务规范。成功读取后,**下一模型步骤**才开放该业务域工具以及认证、工作区共享工具;每个 Turn 结束清空激活,下一轮按需重新读取。原生工具按公布的 operation 适配原脚本或固定HTTP端点;复杂输入使用当前会话目录中的文件。`calculate_custom`接受Python文件和argv数组,提供原`calculate.load_series`导入路径,不再使用额外表达式DSL;不拼接任意shell或接受任意API URL。
|
|
21
|
+
|
|
22
|
+
- **推荐入口**:工作台“新建分析”自动使用北极九章专属 `datarc` 预设,显式采用 Native executor,不修改 DSH 默认预设。也可在新会话首条消息前手动选择“北极九章”。
|
|
23
|
+
- **普通会话**:Native Standard 会话也可自动匹配明确的北极九章任务,不要求先切换预设;不接管所有数据问题、Excel 文件分析或其他 BI 平台,目标不明时先确认平台。
|
|
24
|
+
- **执行模式限制**:PTC 标准会话的 wrapper 不支持这条原生业务执行链路,调用会被拒绝。请从工作台新建专属预设会话,不要用终端绕过限制,也不承诺迁移原会话历史。
|
|
25
|
+
- **旧安装**:专属预设的 registry 不合并全局、用户或项目技能目录。插件不会删除用户以前自行安装在 `~/.dsh` 等目录的旧技能;这些来源应单独管理。技能发现隔离不是数据或文件权限沙箱。
|
|
26
|
+
|
|
27
|
+
## 可以做什么
|
|
28
|
+
|
|
29
|
+
按需支持查数、连续追问、对比与导出、系统或 HTML 报告,以及有权限的工作区配置、建模、成员、数据权限、语义维护与验收。业务工具采用14个定义(1个guide与13个领域工具),本地候选174项operation:120项原CLI适配、53项固定HTTP动作、1项自定义Python。成员、权限和报告API按原端点粒度提供,不再要求先preview、签名receipt或run_file。报告仍使用原collect_cards/build_report/validate_report/render_html辅助脚本;原Plan批准后的轮次不重复审批,原锁内读写顺序和取数/AI任务轮询由Agent按规范组织。具体动作以当前schema为准,操作数量不证明真实业务全部验收。
|
|
30
|
+
|
|
31
|
+
## 登录、执行与安全
|
|
32
|
+
|
|
33
|
+
- 沿用现有网页授权与目录内 `.datarc/config.toml`,不把令牌交给工作台前端,也不让用户在聊天中粘贴密码、令牌或 API 密钥。业务权限由服务端鉴权。
|
|
34
|
+
- 原生业务工具经调用者当前 DSH `pwsh`/`bash` 工具,在其沙箱、审批和实际会话目录内运行随包可信 runner 与原有业务脚本,继承取消及后台 job 机制;不会在 Host 里直接读写业务文件或直接请求业务 API。内部规范读取不等于业务执行。
|
|
35
|
+
- 底层终端及依赖工具必须在调用者当前 toolSet 可用。缺失、被过滤或权限拒绝时停止并说明下一步,不隐藏借用其他工具、不自动提权。优先使用 DSH runtime 提供的 Node.js/Python;部分 Python 操作需要已有 `httpx2` 等依赖,插件不偷偷运行 pip 安装。
|
|
36
|
+
- 输入、执行顺序、确认时点、回读及异常处理以原skills为准。Agent展示影响并在原规定时点取得用户确认,不为每个工具调用重复弹窗;范围变化或原流程要求二次确认时仍须询问。工具不另加审批摘要、签名回执、nonce、冻结快照、规划/证明或恢复状态机,也不自设业务输入规模预算。原语义CLI已有planHash、journal、回执和验证照常执行,不能把脚本confirm或模型字段当作用户同意。未知结果按原规范先回读,不自动重放写入。
|
|
37
|
+
- 权限 API 必须成对配置宿主安全环境 `DATARC_ENDPOINT` 与 `DATARC_OPENAPI_KEY`,不回退到可变业务登录地址或 `DATARC_TOKEN`。没有聊天配置密钥字段;管理员配置后重启。仅配置独立密钥体系即可先查 scopes、列工作区名称,不要求业务登录或预先工作区 ID;其他动作须明确选择工作区。
|
|
38
|
+
- 发送问题后,问题、上下文及工具结果可能发送给 DSH 配置的模型,业务请求发送到配置的北极九章服务。只处理获准的数据;选择目录与工具 schema 不构成数据权限沙箱隔离。
|
|
39
|
+
- 后台 jobId 或进程退出成功不等于业务成功。需跟踪至终态、核对服务端结果和证据,文件核验后再交付;取消本地任务不等于远端任务已经停止。
|
|
40
|
+
|
|
41
|
+
## 停用与已有数据
|
|
42
|
+
|
|
43
|
+
停用或卸载撤销工作台、专属预设、自动入口及原生业务工具,已有会话可能缺少继续执行能力。历史、草稿、本地报告和登录配置不自动删除;原脚本的任务结果、语义journal/回执及私有API原始结果可能保存在临时目录,卸载不自动清理。停用不会自动取消已发请求、撤销授权或回滚操作。请先核查运行任务并按需取消;凭据清理与授权撤销另行处理。
|
|
44
|
+
|
|
45
|
+
## 图标来源
|
|
46
|
+
|
|
47
|
+
使用 [官网](https://dev.arcticdata.cn/) 的[真实 favicon](https://dev.arcticdata.cn/favicon.ico),原始 PNG 随包保存为 [icon.png](icon.png),未重画或修改。该标识用于本产品品牌识别,不授予独立使用或再许可权利。
|
|
@@ -0,0 +1,404 @@
|
|
|
1
|
+
// Fixed original HTTP actions. Workflow decisions and confirmation follow SKILL.md.
|
|
2
|
+
const string = (description, extra = {}) => ({
|
|
3
|
+
type: 'string',
|
|
4
|
+
description,
|
|
5
|
+
...extra,
|
|
6
|
+
});
|
|
7
|
+
const integer = (description) => ({ type: 'integer', description });
|
|
8
|
+
const file = (description) => ({ ...string(description), file: true });
|
|
9
|
+
const workspace = { workspace_id: integer('按名称确认的目标工作区ID。') };
|
|
10
|
+
const paging = {
|
|
11
|
+
offset: integer('原接口分页offset。'),
|
|
12
|
+
limit: integer('原接口分页limit。'),
|
|
13
|
+
};
|
|
14
|
+
const language = string('原报告流程确定的output_language。', {
|
|
15
|
+
enum: ['zh-CN', 'en-US'],
|
|
16
|
+
});
|
|
17
|
+
const input = {
|
|
18
|
+
input_file: file('符合原接口请求体的JSON文件;不在工具参数中传凭据。'),
|
|
19
|
+
};
|
|
20
|
+
const action = (description, method, path, parameters = {}, required = [], extra = {}) => ({
|
|
21
|
+
builtin: 'api',
|
|
22
|
+
interpreter: 'node',
|
|
23
|
+
description,
|
|
24
|
+
parameters: { ...workspace, ...parameters },
|
|
25
|
+
required: ['workspace_id', ...required],
|
|
26
|
+
write: !['GET', 'HEAD'].includes(method),
|
|
27
|
+
route: { method, path, ...extra },
|
|
28
|
+
});
|
|
29
|
+
const admin = '/api/v2/admin-projects/{workspace_id}';
|
|
30
|
+
const account = '/api/v3/account-projects/{workspace_id}';
|
|
31
|
+
const open = '/openapi/v1/workspaces/{workspace_id}';
|
|
32
|
+
const source = '/api/v3/admin-projects/{workspace_id}';
|
|
33
|
+
const report = account + '/pinboards/{report_uid}';
|
|
34
|
+
|
|
35
|
+
export const API_DOMAINS = {
|
|
36
|
+
datasource: {
|
|
37
|
+
title: '数据源配置',
|
|
38
|
+
description: '按原流程读取、候选验连、二次确认后保存并回读数据源。',
|
|
39
|
+
workflows: ['datarc-datasource'],
|
|
40
|
+
inputContracts: {
|
|
41
|
+
candidate_file:
|
|
42
|
+
'原adapter、databaseConfig或databaseUrl及可选databaseSettings;validate仅发送adapter和选定连接字段,apply仅提交原流程已验证且二次确认的同一候选。旧连接清理空值须事先展示确认。',
|
|
43
|
+
confirmation:
|
|
44
|
+
'展示非敏感连接字段、已验证版本及影响后由Agent取得原规定二次确认;不另发签名回执,不在apply重复验连。保存后用inspect/verify回读;HTTP成功不是后续查询验收。',
|
|
45
|
+
},
|
|
46
|
+
operations: {
|
|
47
|
+
inspect: action('读取当前配置,不返回密码。', 'GET', admin + '/datasource/'),
|
|
48
|
+
validate: action(
|
|
49
|
+
'只测试候选连接,不保存;按原流程修正失败信息。',
|
|
50
|
+
'POST',
|
|
51
|
+
admin + '/database-version/',
|
|
52
|
+
{ candidate_file: file('候选数据源JSON。') },
|
|
53
|
+
['candidate_file'],
|
|
54
|
+
{ body: 'datasource-test' },
|
|
55
|
+
),
|
|
56
|
+
apply: action(
|
|
57
|
+
'提交原流程已验证并经用户二次确认的候选;不额外审批或重试。',
|
|
58
|
+
'POST',
|
|
59
|
+
admin + '/datasource/',
|
|
60
|
+
{
|
|
61
|
+
candidate_file: file('验证成功并获确认的同一候选JSON,含明确批准的旧连接清理字段。'),
|
|
62
|
+
},
|
|
63
|
+
['candidate_file'],
|
|
64
|
+
{ body: 'datasource' },
|
|
65
|
+
),
|
|
66
|
+
verify: action('回读保存结果;可传候选核对非敏感字段,不重做连接测试。', 'GET', admin + '/datasource/', {
|
|
67
|
+
candidate_file: file('可选:本次已保存的候选。'),
|
|
68
|
+
}),
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
membership: {
|
|
72
|
+
title: '成员与用户组',
|
|
73
|
+
description: '固定成员和用户组接口;按原文核对资格、归属、自动化影响、确认及回读。',
|
|
74
|
+
workflows: ['datarc-workspace-membership'],
|
|
75
|
+
inputContracts: {
|
|
76
|
+
input_file:
|
|
77
|
+
'原API请求体:新增成员{memberUIDs:[账号UID]};更新成员role仅0/1、groupUIDs为完整组列表;用户组name/desc/auto_add_member。账号创建、密码及负责人转移不在范围。',
|
|
78
|
+
workflow:
|
|
79
|
+
'Agent按原流程预览并确认影响,逐对象执行;先核对管理员资格和组归属,不以旧快照覆盖可能未结束的自动入组。仅只读核对未知结果,不自动从头重放。工具不另造preview/apply状态机。',
|
|
80
|
+
},
|
|
81
|
+
operations: {
|
|
82
|
+
accounts: action(
|
|
83
|
+
'列出当前客户已有账号;仅入区任务需要,团队版可能禁用。',
|
|
84
|
+
'GET',
|
|
85
|
+
admin + '/accounts/',
|
|
86
|
+
{
|
|
87
|
+
...paging,
|
|
88
|
+
query: string('原q模糊搜索,结果须唯一核对。'),
|
|
89
|
+
in_project: integer('0未入区,1已入区。'),
|
|
90
|
+
},
|
|
91
|
+
[],
|
|
92
|
+
{
|
|
93
|
+
query: {
|
|
94
|
+
query: 'q',
|
|
95
|
+
offset: 'offset',
|
|
96
|
+
limit: 'limit',
|
|
97
|
+
in_project: 'in_project',
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
),
|
|
101
|
+
members: action('分页读取成员,含原管理员资格字段。', 'GET', admin + '/members/', paging, [], { query: { offset: 'offset', limit: 'limit' } }),
|
|
102
|
+
get_member: action('读取已确认成员角色与完整组关系。', 'GET', admin + '/members/{member_uid}/', { member_uid: string('当前工作区成员UID。') }, [
|
|
103
|
+
'member_uid',
|
|
104
|
+
]),
|
|
105
|
+
add_member: action('把已有账号加入工作区;不创建账号,随后按原流程核对自动化结果。', 'POST', admin + '/members/', input, ['input_file'], {
|
|
106
|
+
body: 'json',
|
|
107
|
+
}),
|
|
108
|
+
update_member: action(
|
|
109
|
+
'更新已确认成员角色或完整groupUIDs,按原规范先核对后回读。',
|
|
110
|
+
'PATCH',
|
|
111
|
+
admin + '/members/{member_uid}/',
|
|
112
|
+
{ member_uid: string('当前工作区成员UID。'), ...input },
|
|
113
|
+
['member_uid', 'input_file'],
|
|
114
|
+
{ body: 'member' },
|
|
115
|
+
),
|
|
116
|
+
remove_member: action(
|
|
117
|
+
'仅在明确要求并确认影响后移除成员。',
|
|
118
|
+
'DELETE',
|
|
119
|
+
admin + '/members/{member_uid}/',
|
|
120
|
+
{ member_uid: string('当前工作区成员UID。') },
|
|
121
|
+
['member_uid'],
|
|
122
|
+
),
|
|
123
|
+
groups: action('分页列出当前工作区用户组。', 'GET', admin + '/member-groups/', paging, [], { query: { offset: 'offset', limit: 'limit' } }),
|
|
124
|
+
get_group: action('读取用户组定义和成员关系。', 'GET', admin + '/member-groups/{group_uid}/', { group_uid: string('当前工作区组UID。') }, [
|
|
125
|
+
'group_uid',
|
|
126
|
+
]),
|
|
127
|
+
create_group: action('按已确认name/desc/auto_add_member创建用户组。', 'POST', admin + '/member-groups/', input, ['input_file'], {
|
|
128
|
+
body: 'json',
|
|
129
|
+
}),
|
|
130
|
+
update_group: action(
|
|
131
|
+
'更新已确认用户组定义,随后回读。',
|
|
132
|
+
'PATCH',
|
|
133
|
+
admin + '/member-groups/{group_uid}/',
|
|
134
|
+
{ group_uid: string('当前工作区组UID。'), ...input },
|
|
135
|
+
['group_uid', 'input_file'],
|
|
136
|
+
{ body: 'json' },
|
|
137
|
+
),
|
|
138
|
+
delete_group: action(
|
|
139
|
+
'按原流程确认影响后删除用户组。',
|
|
140
|
+
'DELETE',
|
|
141
|
+
admin + '/member-groups/{group_uid}/',
|
|
142
|
+
{ group_uid: string('当前工作区组UID。') },
|
|
143
|
+
['group_uid'],
|
|
144
|
+
),
|
|
145
|
+
automation_rules: action('只读自动入组规则;规则修改不在原技能范围。', 'GET', source + '/group-add-member-rules/', paging, [], {
|
|
146
|
+
query: { offset: 'offset', limit: 'limit' },
|
|
147
|
+
}),
|
|
148
|
+
},
|
|
149
|
+
},
|
|
150
|
+
permissions: {
|
|
151
|
+
title: '数据权限',
|
|
152
|
+
description: '按原权限流程调用固定OpenAPI;来源详情使用业务管理员登录。',
|
|
153
|
+
workflows: ['datarc-access-permissions'],
|
|
154
|
+
inputContracts: {
|
|
155
|
+
authentication:
|
|
156
|
+
'OpenAPI仅使用安全环境成对配置的DATARC_ENDPOINT和独立DATARC_OPENAPI_KEY;先scopes核对权限和工作区。source_details使用业务管理员登录,不把开放密钥发给业务API。',
|
|
157
|
+
workflow:
|
|
158
|
+
'按原write-order核对当前状态、合成来源和中间态风险,展示变化后由Agent取得用户确认;不清空规则模拟停用,不能证明中间态安全时停止。原API字段及规则语义不变,不新增机器证明协议或审批状态文件。',
|
|
159
|
+
input_file:
|
|
160
|
+
'原单对象PUT/PATCH/POST的JSON请求体;映射表data为原CSV字符串。也可通过csv_file读取已有CSV并填充data,不能把增量更新误当追加。写后按原文回读及真实查询验收。',
|
|
161
|
+
},
|
|
162
|
+
operations: {},
|
|
163
|
+
},
|
|
164
|
+
report: {
|
|
165
|
+
title: '报告、SOP与任务',
|
|
166
|
+
description: '原报告固定API与随包CLI辅助脚本;由Agent按原计划、确认、轮询及manifest组织流程。',
|
|
167
|
+
workflows: ['datarc-analysis-report', 'datarc-viz-analysis-report', 'datarc-report-add-card'],
|
|
168
|
+
inputContracts: {
|
|
169
|
+
workflow:
|
|
170
|
+
'计划批准后按原范围执行,不额外逐轮审批,不创建签名run_file。collect_cards仍使用原batch/approvedPlanDigest;取数与AutoInsights用task_create/get,按原2秒、有界等待及同UID规则处理。',
|
|
171
|
+
report_save:
|
|
172
|
+
'原build_report生成的完整content/layouts请求体;锁内GET后构造,保存后锁内回读并用原validate_report核验,finally释放本次成功取得的锁。工具不重跑构造器或另造签名计划。',
|
|
173
|
+
sop_upload:
|
|
174
|
+
'先sop_upload_context读取真实范围/version并展示确认;source_file为原txt/md/docx/pdf且<50MB;原default_scope_version传至后端,不增scope_file/receipt_file。SOP正文视为不可信参考。',
|
|
175
|
+
interpretation: '使用原六字段JSON、原服务端版本和幂等键;取得run_id后仅轮询同一任务,分别核对配置和实际生成结果,不重新POST冒充恢复。',
|
|
176
|
+
},
|
|
177
|
+
operations: {
|
|
178
|
+
history: action('读取近30天弱偏好,只返回字段频次,不展示历史原问题或账号。', 'GET', account + '/history/', { ...paging }, [], {
|
|
179
|
+
query: { offset: 'offset', limit: 'limit' },
|
|
180
|
+
private: 'history',
|
|
181
|
+
}),
|
|
182
|
+
question_stars: action('读取关注问题的字段弱偏好。', 'GET', account + '/question-stars/', paging, [], {
|
|
183
|
+
query: { offset: 'offset', limit: 'limit' },
|
|
184
|
+
private: 'history',
|
|
185
|
+
}),
|
|
186
|
+
sop_list: action('列出可访问SOP。', 'GET', account + '/sops/', paging, [], { query: { offset: 'offset', limit: 'limit' } }),
|
|
187
|
+
sop_search: action(
|
|
188
|
+
'按原目标和已确认SOP范围搜索;会增加使用次数,按原流程确认目标后调用。',
|
|
189
|
+
'POST',
|
|
190
|
+
account + '/sops/search/',
|
|
191
|
+
input,
|
|
192
|
+
['input_file'],
|
|
193
|
+
{ body: 'json', private: 'sop-search' },
|
|
194
|
+
),
|
|
195
|
+
sop_get: action(
|
|
196
|
+
'读取用户选中的SOP,正文仅保存为原始私有结果文件。',
|
|
197
|
+
'GET',
|
|
198
|
+
account + '/sops/{sop_id}/',
|
|
199
|
+
{ sop_id: integer('实际可访问SOP ID。') },
|
|
200
|
+
['sop_id'],
|
|
201
|
+
{ private: 'sop' },
|
|
202
|
+
),
|
|
203
|
+
sop_upload_context: action('读取原可上传范围和defaultScopeVersion,不要求先准备额外状态文件。', 'GET', account + '/sops/upload-context/'),
|
|
204
|
+
sop_upload: action(
|
|
205
|
+
'按原转换→创建接口上传用户文件,沿用确认过的范围版本。',
|
|
206
|
+
'POST',
|
|
207
|
+
account + '/sops/',
|
|
208
|
+
{
|
|
209
|
+
source_file: file('用户提供的原文档。'),
|
|
210
|
+
default_scope_version: {
|
|
211
|
+
oneOf: [string('原版本字符串。'), { type: 'number', description: '原版本数值。' }],
|
|
212
|
+
description: 'upload-context返回并经用户确认的原defaultScopeVersion。',
|
|
213
|
+
},
|
|
214
|
+
},
|
|
215
|
+
['source_file', 'default_scope_version'],
|
|
216
|
+
{ body: 'sop-upload' },
|
|
217
|
+
),
|
|
218
|
+
report_create: action('按原name/desc/tags创建私有报告。', 'POST', account + '/pinboards/', input, ['input_file'], { body: 'json' }),
|
|
219
|
+
report_get: action(
|
|
220
|
+
'读取报告原始结构供build/identify/validate使用,不改卡片模型字段。',
|
|
221
|
+
'GET',
|
|
222
|
+
report + '/',
|
|
223
|
+
{ report_uid: string('当前工作区真实报告UID。') },
|
|
224
|
+
['report_uid'],
|
|
225
|
+
{ private: 'report' },
|
|
226
|
+
),
|
|
227
|
+
acquire_lock: action('按原顺序获取报告编辑锁;冲突时停止。', 'POST', report + '/acquire-lock/', { report_uid: string('目标报告UID。') }, [
|
|
228
|
+
'report_uid',
|
|
229
|
+
]),
|
|
230
|
+
report_save: action(
|
|
231
|
+
'锁内提交原build_report生成的完整PATCH,不代替证据/AI验收。',
|
|
232
|
+
'PATCH',
|
|
233
|
+
report + '/',
|
|
234
|
+
{ report_uid: string('本次成功持锁的报告UID。'), ...input },
|
|
235
|
+
['report_uid', 'input_file'],
|
|
236
|
+
{ body: 'json', private: 'report' },
|
|
237
|
+
),
|
|
238
|
+
release_lock: action(
|
|
239
|
+
'finally释放本次成功取得的报告锁。',
|
|
240
|
+
'POST',
|
|
241
|
+
report + '/release-lock/',
|
|
242
|
+
{ report_uid: string('本次成功取得锁的报告UID。') },
|
|
243
|
+
['report_uid'],
|
|
244
|
+
),
|
|
245
|
+
report_verify: action(
|
|
246
|
+
'读取报告原始结构,随后由原validate_report和Agent进行原核验。',
|
|
247
|
+
'GET',
|
|
248
|
+
report + '/',
|
|
249
|
+
{ report_uid: string('当前报告UID。') },
|
|
250
|
+
['report_uid'],
|
|
251
|
+
{ private: 'report' },
|
|
252
|
+
),
|
|
253
|
+
task_create: action(
|
|
254
|
+
'按原taskType8/11请求创建一次取数或洞察任务,不启动额外状态机。',
|
|
255
|
+
'POST',
|
|
256
|
+
'/api/v2/account-projects/{workspace_id}/async-tasks/',
|
|
257
|
+
{ ...input, language },
|
|
258
|
+
['input_file', 'language'],
|
|
259
|
+
{ body: 'report-task', private: 'task' },
|
|
260
|
+
),
|
|
261
|
+
task_get: action(
|
|
262
|
+
'只读取已知同一任务UID;Agent按原状态/截止规则轮询。',
|
|
263
|
+
'GET',
|
|
264
|
+
'/api/v2/account-projects/{workspace_id}/async-tasks/{task_uid}/',
|
|
265
|
+
{ task_uid: string('服务端返回的原任务UID。'), language },
|
|
266
|
+
['task_uid', 'language'],
|
|
267
|
+
{ private: 'task' },
|
|
268
|
+
),
|
|
269
|
+
interpretation_prompt: action(
|
|
270
|
+
'读取原effective-prompt版本、变量及模型可用性;完整正文保存在私有文件。',
|
|
271
|
+
'GET',
|
|
272
|
+
report + '/interpretations/effective-prompt/',
|
|
273
|
+
{ report_uid: string('报告UID。'), language },
|
|
274
|
+
['report_uid', 'language'],
|
|
275
|
+
{ query: { language: 'language' }, private: 'prompt' },
|
|
276
|
+
),
|
|
277
|
+
interpretation_start: action(
|
|
278
|
+
'使用原六字段请求启动或取得现有解读run,不自动重试。',
|
|
279
|
+
'POST',
|
|
280
|
+
report + '/interpretations/{pin_id}/runs/',
|
|
281
|
+
{
|
|
282
|
+
report_uid: string('报告UID。'),
|
|
283
|
+
pin_id: string('报告中已保存的解读pin ID。'),
|
|
284
|
+
...input,
|
|
285
|
+
},
|
|
286
|
+
['report_uid', 'pin_id', 'input_file'],
|
|
287
|
+
{ body: 'json', private: 'interpretation' },
|
|
288
|
+
),
|
|
289
|
+
interpretation_get: action(
|
|
290
|
+
'读取同一解读run;不创建新任务。',
|
|
291
|
+
'GET',
|
|
292
|
+
report + '/interpretations/{pin_id}/runs/{run_id}/',
|
|
293
|
+
{
|
|
294
|
+
report_uid: string('报告UID。'),
|
|
295
|
+
pin_id: string('已保存的解读pin ID。'),
|
|
296
|
+
run_id: string('原run ID。'),
|
|
297
|
+
},
|
|
298
|
+
['report_uid', 'pin_id', 'run_id'],
|
|
299
|
+
{ private: 'interpretation' },
|
|
300
|
+
),
|
|
301
|
+
interpretations: action(
|
|
302
|
+
'按同一筛选读取当前成员解读快照供原业务验收。',
|
|
303
|
+
'GET',
|
|
304
|
+
report + '/interpretations/',
|
|
305
|
+
{ report_uid: string('报告UID。'), ...input },
|
|
306
|
+
['report_uid', 'input_file'],
|
|
307
|
+
{ filters: true, private: 'interpretation' },
|
|
308
|
+
),
|
|
309
|
+
interpretation_export: action(
|
|
310
|
+
'按最新版本固定已有解读结果,不启动生成。',
|
|
311
|
+
'POST',
|
|
312
|
+
report + '/interpretations/export-snapshots/',
|
|
313
|
+
{ report_uid: string('报告UID。'), ...input },
|
|
314
|
+
['report_uid', 'input_file'],
|
|
315
|
+
{ body: 'json', private: 'interpretation' },
|
|
316
|
+
),
|
|
317
|
+
},
|
|
318
|
+
},
|
|
319
|
+
};
|
|
320
|
+
|
|
321
|
+
for (const spec of Object.values(API_DOMAINS.report.operations)) spec.parameters.language ??= language;
|
|
322
|
+
|
|
323
|
+
const permissions = API_DOMAINS.permissions.operations;
|
|
324
|
+
permissions.scopes = {
|
|
325
|
+
...action('只读核对独立key权限和工作区范围。', 'GET', '/openapi/v1/scopes/'),
|
|
326
|
+
parameters: {},
|
|
327
|
+
required: [],
|
|
328
|
+
};
|
|
329
|
+
permissions.source_details = action(
|
|
330
|
+
'业务管理员读取原合成权限来源,不能作为真实查询验收。',
|
|
331
|
+
'GET',
|
|
332
|
+
source + '/members/{member_uid}/{kind}-permission-detail/',
|
|
333
|
+
{
|
|
334
|
+
member_uid: string('当前工作区成员UID。'),
|
|
335
|
+
kind: string('原权限类别。', { enum: ['model', 'col', 'row'] }),
|
|
336
|
+
},
|
|
337
|
+
['member_uid', 'kind'],
|
|
338
|
+
{ businessAuth: true },
|
|
339
|
+
);
|
|
340
|
+
for (const [plural, singular, id] of [
|
|
341
|
+
['members', 'member', 'member_uid'],
|
|
342
|
+
['groups', 'group', 'group_uid'],
|
|
343
|
+
]) {
|
|
344
|
+
const path = open + '/' + (plural === 'members' ? 'members' : 'member-groups');
|
|
345
|
+
permissions[plural] = action('分页读取目标工作区' + plural + '。', 'GET', path + '/', paging, [], { query: { offset: 'offset', limit: 'limit' } });
|
|
346
|
+
permissions['get_' + singular] = action(
|
|
347
|
+
'读取已确认' + singular + '详情。',
|
|
348
|
+
'GET',
|
|
349
|
+
path + '/{' + id + '}/',
|
|
350
|
+
{ [id]: string('当前工作区真实对象UID。') },
|
|
351
|
+
[id],
|
|
352
|
+
);
|
|
353
|
+
}
|
|
354
|
+
const subject = {
|
|
355
|
+
target: string('原规则目标类型。', { enum: ['member', 'group'] }),
|
|
356
|
+
target_uid: string('在当前工作区核对过的目标UID。'),
|
|
357
|
+
kind: string('原权限类别。', { enum: ['model', 'col', 'row'] }),
|
|
358
|
+
};
|
|
359
|
+
for (const [name, method, enabled] of [
|
|
360
|
+
['get_rules', 'GET', false],
|
|
361
|
+
['set_rules', 'PUT', false],
|
|
362
|
+
['get_enabled', 'GET', true],
|
|
363
|
+
['set_enabled', 'PUT', true],
|
|
364
|
+
])
|
|
365
|
+
permissions[name] = action(
|
|
366
|
+
'按原状态相关写入顺序处理权限' + (enabled ? '开关' : '规则') + ',无法证明中间态安全时由原流程停止。',
|
|
367
|
+
method,
|
|
368
|
+
open + '/{subject}/{target_uid}/' + (enabled ? 'enable-' : '') + '{kind}-permission/',
|
|
369
|
+
{ ...subject, ...(method === 'PUT' ? input : {}) },
|
|
370
|
+
['target', 'target_uid', 'kind', ...(method === 'PUT' ? ['input_file'] : [])],
|
|
371
|
+
{ body: method === 'PUT' ? 'json' : undefined },
|
|
372
|
+
);
|
|
373
|
+
permissions.mappings = action('分页读取权限映射表。', 'GET', open + '/attribute-permissions/', paging, [], {
|
|
374
|
+
query: { offset: 'offset', limit: 'limit' },
|
|
375
|
+
});
|
|
376
|
+
for (const [name, method, suffix, body] of [
|
|
377
|
+
['get_mapping', 'GET', '/', false],
|
|
378
|
+
['mapping_rows', 'GET', '/rows/', false],
|
|
379
|
+
['mapping_update', 'POST', '/update/', true],
|
|
380
|
+
['mapping_patch', 'PATCH', '/', true],
|
|
381
|
+
['mapping_delete', 'DELETE', '/', false],
|
|
382
|
+
])
|
|
383
|
+
permissions[name] = action(
|
|
384
|
+
'调用原映射表' + name + ';按原数据/状态/影响规则确认及回读。',
|
|
385
|
+
method,
|
|
386
|
+
open + '/attribute-permissions/{table_id}' + suffix,
|
|
387
|
+
{
|
|
388
|
+
table_id: integer('原映射表整数ID。'),
|
|
389
|
+
...(body ? { ...input, csv_file: file('可选原CSV文件,填入请求体data。') } : paging),
|
|
390
|
+
},
|
|
391
|
+
['table_id', ...(body ? ['input_file'] : [])],
|
|
392
|
+
{
|
|
393
|
+
body: body ? 'mapping' : undefined,
|
|
394
|
+
...(name === 'mapping_rows' ? { query: { offset: 'offset', limit: 'limit' } } : {}),
|
|
395
|
+
},
|
|
396
|
+
);
|
|
397
|
+
permissions.mapping_create = action(
|
|
398
|
+
'按原name/data/attributeLength/modelUids创建映射表并回读异步状态。',
|
|
399
|
+
'POST',
|
|
400
|
+
open + '/attribute-permissions/',
|
|
401
|
+
{ ...input, csv_file: file('可选原CSV文件,填入请求体data。') },
|
|
402
|
+
['input_file'],
|
|
403
|
+
{ body: 'mapping' },
|
|
404
|
+
);
|