viatris-exam-cli 1.3.0 → 1.4.0
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 +27 -2
- package/package.json +1 -1
- package/skills/viatris-exam-cli/SKILL.md +5 -3
- package/skills/viatris-exam-cli/references/cli-reference.md +77 -8
- package/skills/viatris-exam-cli.zip +0 -0
- package/src/command-handlers/knowledge.js +130 -0
- package/src/commands.js +2 -0
- package/src/help.js +12 -0
- package/src/metadata.js +83 -4
package/README.md
CHANGED
|
@@ -50,7 +50,7 @@ export VIATRIS_API_KEY_PREFIX="Bearer "
|
|
|
50
50
|
- API Key 只从 `VIATRIS_API_KEY` 环境变量读取。
|
|
51
51
|
- 默认使用线上环境,可通过 `VIATRIS_API_ENV=development` 切换到开发环境。
|
|
52
52
|
- `VIATRIS_API_BASE_URL` 可覆盖当前环境地址。
|
|
53
|
-
- GET 请求遇到网络错误、HTTP 429 或 5xx 时自动重试,POST/PUT 不自动重试。
|
|
53
|
+
- GET 请求遇到网络错误、HTTP 429 或 5xx 时自动重试,POST/PUT/PATCH/DELETE 不自动重试。
|
|
54
54
|
- `describe` 返回机器可读的命令、参数、认证和退出码清单。
|
|
55
55
|
- ID 路径参数自动进行 URL 编码。
|
|
56
56
|
- HTTP 401/403 使用专用退出码,方便 Agent 判断需要刷新认证。
|
|
@@ -80,7 +80,28 @@ viatris-exam products update-knowledge-tree "$PRODUCT_ID" \
|
|
|
80
80
|
--input knowledge-tree.json
|
|
81
81
|
```
|
|
82
82
|
|
|
83
|
-
|
|
83
|
+
产品是隐藏系统容器,不属于业务知识树层级。固定维度为 L1;知识树回写是完整替换操作,必须一次提交全部 15-500 个 L2/L3/L4 动态节点。先查询产品以获取固定 L1 维度的 `clientRef`。
|
|
84
|
+
|
|
85
|
+
### 知识节点与文档
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
viatris-exam knowledge tree <product-code>
|
|
89
|
+
viatris-exam knowledge nodes by-path --input path.json
|
|
90
|
+
viatris-exam knowledge nodes create --input node.json
|
|
91
|
+
viatris-exam knowledge nodes get <node-id>
|
|
92
|
+
viatris-exam knowledge nodes update <node-id> --input changes.json
|
|
93
|
+
viatris-exam knowledge nodes move <node-id> --input move.json
|
|
94
|
+
viatris-exam knowledge nodes delete <node-id>
|
|
95
|
+
viatris-exam knowledge documents list <node-id>
|
|
96
|
+
viatris-exam knowledge documents create <node-id> --input document.json
|
|
97
|
+
viatris-exam knowledge documents upsert <node-id> --input documents.json
|
|
98
|
+
viatris-exam knowledge documents update <document-id> --input changes.json
|
|
99
|
+
viatris-exam knowledge documents delete <document-id>
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
节点删除会级联删除整棵子树及文档。产品根和固定维度受保护,不能改名、移动或删除。
|
|
103
|
+
|
|
104
|
+
`/knowledge` CRUD 响应中的 `level` 是物理存储层级(产品根为 1、固定维度为 2);产品生成接口使用业务层级(产品隐藏、固定维度为 L1、动态节点为 L2-L4)。
|
|
84
105
|
|
|
85
106
|
### 出题任务
|
|
86
107
|
|
|
@@ -92,6 +113,8 @@ viatris-exam gen-tasks submit "$TASK_ID" --input examples/generated-questions.js
|
|
|
92
113
|
|
|
93
114
|
`externalRef` 是题目回写的幂等键。Agent 重试 POST 前应复用原值。
|
|
94
115
|
|
|
116
|
+
产品全节点任务的 `dimension` 为 `all`。应按 `knowledgeContexts` 覆盖每个叶子节点,并在回写题目时携带对应 `knowledgeNodeId`。
|
|
117
|
+
|
|
95
118
|
### 考试记录
|
|
96
119
|
|
|
97
120
|
```bash
|
|
@@ -136,6 +159,8 @@ printf '%s' '{"query":"阿托伐他汀 适应症","limit":4}' |
|
|
|
136
159
|
viatris-exam medical-search search
|
|
137
160
|
```
|
|
138
161
|
|
|
162
|
+
响应中的 `rawJson` 已是结构化对象,可直接读取 `rawJson.documents`,无需再次 `JSON.parse`。
|
|
163
|
+
|
|
139
164
|
## 错误格式
|
|
140
165
|
|
|
141
166
|
```json
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: viatris-exam-cli
|
|
3
|
-
description: Operate the Viatris exam OpenAPI through its agent-friendly CLI. Use for products, knowledge
|
|
4
|
-
version: 1.
|
|
3
|
+
description: Operate the Viatris exam OpenAPI through its agent-friendly CLI. Use for products, knowledge nodes or documents, generation tasks, exam records, scoring, exams, questions, or medical search.
|
|
4
|
+
version: 1.4.0
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# Viatris Exam CLI
|
|
@@ -23,8 +23,10 @@ Use the repository-local CLI for every supported API operation. Do not call the
|
|
|
23
23
|
- Parse successful `stdout` as JSON.
|
|
24
24
|
- Parse failed `stderr` as JSON and branch on both exit code and `error.type`.
|
|
25
25
|
- Preserve `externalRef` when retrying question submission. It is the idempotency key.
|
|
26
|
+
- For product-wide generation tasks, create one or more questions for every entry in `knowledgeContexts` and include its `knowledgeNodeId`.
|
|
26
27
|
- Prefer scoring rule V2 for generated questions and scoring results. Use stable point and deduction-rule IDs.
|
|
27
|
-
-
|
|
28
|
+
- Treat product IDs as hidden containers, not knowledge-tree levels. Fixed dimensions are business L1; generated nodes are L2-L4.
|
|
29
|
+
- Do not automatically retry POST, PUT, PATCH, or DELETE commands. Inspect the returned error and determine whether the server accepted the request.
|
|
28
30
|
- Keep temporary payloads outside the repository unless they are requested deliverables.
|
|
29
31
|
|
|
30
32
|
## Maintain
|
|
@@ -42,13 +42,13 @@ node src/cli.js --version
|
|
|
42
42
|
|
|
43
43
|
## Commands
|
|
44
44
|
|
|
45
|
-
Get a product and its fixed
|
|
45
|
+
Get a product and its fixed L1 dimensions:
|
|
46
46
|
|
|
47
47
|
```bash
|
|
48
48
|
node src/cli.js products get "$PRODUCT_ID" --compact
|
|
49
49
|
```
|
|
50
50
|
|
|
51
|
-
Use each returned `fixedDimensions[].clientRef` as the parent reference for an
|
|
51
|
+
The product ID represents a hidden system container and is not part of business levels L1-L4. Use each returned `fixedDimensions[].clientRef` as the parent reference for an L2 node. Each fixed dimension also returns `level: 1` and a display `codePrefix`.
|
|
52
52
|
|
|
53
53
|
Replace a product knowledge tree:
|
|
54
54
|
|
|
@@ -66,17 +66,25 @@ Payload shape:
|
|
|
66
66
|
{
|
|
67
67
|
"clientRef": "disease.hypertension",
|
|
68
68
|
"parentClientRef": "dimension:disease",
|
|
69
|
-
"level":
|
|
69
|
+
"level": 2,
|
|
70
70
|
"dimensionCode": "disease",
|
|
71
71
|
"name": "高血压",
|
|
72
72
|
"sortOrder": 1
|
|
73
73
|
},
|
|
74
74
|
{
|
|
75
|
-
"clientRef": "disease.hypertension.
|
|
75
|
+
"clientRef": "disease.hypertension.diagnosis",
|
|
76
76
|
"parentClientRef": "disease.hypertension",
|
|
77
|
-
"level":
|
|
77
|
+
"level": 3,
|
|
78
78
|
"dimensionCode": "disease",
|
|
79
79
|
"name": "定义与诊断",
|
|
80
|
+
"sortOrder": 1
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"clientRef": "disease.hypertension.diagnosis.threshold",
|
|
84
|
+
"parentClientRef": "disease.hypertension.diagnosis",
|
|
85
|
+
"level": 4,
|
|
86
|
+
"dimensionCode": "disease",
|
|
87
|
+
"name": "诊断阈值",
|
|
80
88
|
"sortOrder": 1,
|
|
81
89
|
"documents": [
|
|
82
90
|
{
|
|
@@ -90,7 +98,61 @@ Payload shape:
|
|
|
90
98
|
}
|
|
91
99
|
```
|
|
92
100
|
|
|
93
|
-
Submit the complete L3/L4 node set, between
|
|
101
|
+
Submit the complete L2/L3/L4 node set, between 15 and 500 nodes. Every `clientRef` must be unique within the payload. L2 nodes use `dimension:<code>` as `parentClientRef`; L3/L4 nodes use their direct parent's `clientRef`. Every L4 node needs at least one document. A successful PUT replaces the previous dynamic nodes, so do not send a partial tree.
|
|
102
|
+
|
|
103
|
+
### Incremental Knowledge Management
|
|
104
|
+
|
|
105
|
+
Get the complete physical tree and all product documents:
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
node src/cli.js knowledge tree lipitor --compact
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
The incremental `/knowledge` responses expose physical storage levels where the product root is 1 and fixed dimensions are 2. This differs from the product-generation business taxonomy, where the product is hidden, fixed dimensions are L1, and generated content is L2-L4.
|
|
112
|
+
|
|
113
|
+
Create or reuse a visible path:
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
node src/cli.js knowledge nodes by-path --json \
|
|
117
|
+
'{"product":"lipitor","path":["疾病知识","血脂异常基础","ASCVD 风险评估"]}'
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
The path has one to three entries. The first entry must be a fixed dimension name. The response separates all resolved `nodes` from nodes newly `created`.
|
|
121
|
+
|
|
122
|
+
Create or reuse one node under a known parent:
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
node src/cli.js knowledge nodes create --json \
|
|
126
|
+
'{"parentId":"PARENT_ID","name":"ASCVD 风险评估","sortOrder":20}'
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Read, update, move, or delete a node:
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
node src/cli.js knowledge nodes get "$NODE_ID"
|
|
133
|
+
node src/cli.js knowledge nodes update "$NODE_ID" \
|
|
134
|
+
--json '{"name":"血脂异常与他汀治疗","sortOrder":5}'
|
|
135
|
+
node src/cli.js knowledge nodes move "$NODE_ID" \
|
|
136
|
+
--json '{"newParentId":"NEW_PARENT_ID","sortOrder":30}'
|
|
137
|
+
node src/cli.js knowledge nodes delete "$NODE_ID"
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
Product roots and fixed dimensions are protected from rename, move, and deletion. Moving cannot cross products, target the node itself or its descendants, or produce levels deeper than L4. Deleting a node deletes its entire subtree and attached documents; inspect the node first and only delete when explicitly required.
|
|
141
|
+
|
|
142
|
+
Manage documents:
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
node src/cli.js knowledge documents list "$NODE_ID"
|
|
146
|
+
node src/cli.js knowledge documents create "$NODE_ID" \
|
|
147
|
+
--json '{"title":"说明书","url":"https://example.com/source","summary":"摘录"}'
|
|
148
|
+
node src/cli.js knowledge documents upsert "$NODE_ID" \
|
|
149
|
+
--json '{"items":[{"title":"说明书","summary":"更新后的摘录"}]}'
|
|
150
|
+
node src/cli.js knowledge documents update "$DOCUMENT_ID" \
|
|
151
|
+
--json '{"url":null,"summary":"更新后的摘要"}'
|
|
152
|
+
node src/cli.js knowledge documents delete "$DOCUMENT_ID"
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
Create reuses a document with the same title under the node. Batch upsert accepts 1-20 items and updates `url` and `summary` for existing titles. A single-document update changes only supplied fields; send `null` to clear `url` or `summary`. Inspect a document before an explicitly requested delete.
|
|
94
156
|
|
|
95
157
|
List generation tasks:
|
|
96
158
|
|
|
@@ -109,6 +171,8 @@ Get one generation task:
|
|
|
109
171
|
node src/cli.js gen-tasks get "$TASK_ID" --compact
|
|
110
172
|
```
|
|
111
173
|
|
|
174
|
+
For a leaf-node task, `knowledgeContext` is the mandatory target context. For a product-wide task, `dimension` is `all`, `knowledgeContext` is null, and `knowledgeContexts` contains every leaf context. Generate `questionsPerNode` questions for every listed context and follow all returned `rules`.
|
|
175
|
+
|
|
112
176
|
Submit generated questions:
|
|
113
177
|
|
|
114
178
|
```bash
|
|
@@ -123,6 +187,7 @@ Payload shape:
|
|
|
123
187
|
{
|
|
124
188
|
"externalRef": "agent-q-0001",
|
|
125
189
|
"failureId": "optional-failure-id",
|
|
190
|
+
"knowledgeNodeId": "required-for-product-wide-task",
|
|
126
191
|
"content": {
|
|
127
192
|
"stem": "Question stem",
|
|
128
193
|
"referenceAnswer": "Reference answer",
|
|
@@ -177,6 +242,8 @@ Payload shape:
|
|
|
177
242
|
}
|
|
178
243
|
```
|
|
179
244
|
|
|
245
|
+
Omit `knowledgeNodeId` for ordinary tasks. For a product-wide task it is required and must match a node in the task's `knowledgeContexts`.
|
|
246
|
+
|
|
180
247
|
Get a submitted exam record and its frozen answers:
|
|
181
248
|
|
|
182
249
|
```bash
|
|
@@ -274,6 +341,8 @@ printf '%s' '{"query":"阿托伐他汀 适应症","limit":4}' |
|
|
|
274
341
|
|
|
275
342
|
Do not combine query flags with JSON input.
|
|
276
343
|
|
|
344
|
+
The response `rawJson` is already a structured object. Read `rawJson.documents` directly; do not call `JSON.parse`. Each result contains `rank`, `doc_info`, optional `medical_info`, and the upstream `logid`.
|
|
345
|
+
|
|
277
346
|
## Input Rules
|
|
278
347
|
|
|
279
348
|
Choose exactly one input form:
|
|
@@ -313,7 +382,7 @@ Success writes API JSON to `stdout`. Errors write one JSON object to `stderr`:
|
|
|
313
382
|
| `1` | API error | Inspect status and response |
|
|
314
383
|
| `2` | Usage, validation, or input error | Correct command or payload |
|
|
315
384
|
| `3` | Configuration error | Check environment configuration |
|
|
316
|
-
| `4` | Network or timeout error | GET may be retried; inspect
|
|
385
|
+
| `4` | Network or timeout error | GET may be retried; inspect write state first |
|
|
317
386
|
| `5` | Authentication or authorization error | Refresh or correct credentials |
|
|
318
387
|
|
|
319
|
-
GET automatically retries network errors, HTTP 429, and HTTP 5xx. POST and
|
|
388
|
+
GET automatically retries network errors, HTTP 429, and HTTP 5xx. POST, PUT, PATCH, and DELETE never retry automatically.
|
|
Binary file
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import {
|
|
2
|
+
assertNoExtraPositionals,
|
|
3
|
+
assertOptions,
|
|
4
|
+
requiredId,
|
|
5
|
+
} from "../args.js";
|
|
6
|
+
import { readJsonInput } from "../input.js";
|
|
7
|
+
|
|
8
|
+
function jsonCommand(method, path, options) {
|
|
9
|
+
assertOptions(options, ["input", "json"]);
|
|
10
|
+
return readJsonInput(options).then((body) => ({ method, path, body }));
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function nodePath(positionals, label) {
|
|
14
|
+
return requiredId(positionals, 3, label);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export async function resolveKnowledge(positionals, options) {
|
|
18
|
+
const [resource, area, action] = positionals;
|
|
19
|
+
if (resource !== "knowledge") return null;
|
|
20
|
+
|
|
21
|
+
if (area === "tree") {
|
|
22
|
+
assertNoExtraPositionals(positionals, 3);
|
|
23
|
+
assertOptions(options);
|
|
24
|
+
const product = requiredId(positionals, 2, "product code");
|
|
25
|
+
return {
|
|
26
|
+
method: "GET",
|
|
27
|
+
path: `/openapi/knowledge/tree?product=${product}`,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (area === "nodes" && action === "by-path") {
|
|
32
|
+
assertNoExtraPositionals(positionals, 3);
|
|
33
|
+
return jsonCommand(
|
|
34
|
+
"POST",
|
|
35
|
+
"/openapi/knowledge/nodes/by-path",
|
|
36
|
+
options,
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (area === "nodes" && action === "create") {
|
|
41
|
+
assertNoExtraPositionals(positionals, 3);
|
|
42
|
+
return jsonCommand("POST", "/openapi/knowledge/nodes", options);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if (area === "nodes" && action === "get") {
|
|
46
|
+
assertNoExtraPositionals(positionals, 4);
|
|
47
|
+
assertOptions(options);
|
|
48
|
+
const id = nodePath(positionals, "knowledge node ID");
|
|
49
|
+
return { method: "GET", path: `/openapi/knowledge/nodes/${id}` };
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (area === "nodes" && action === "update") {
|
|
53
|
+
assertNoExtraPositionals(positionals, 4);
|
|
54
|
+
const id = nodePath(positionals, "knowledge node ID");
|
|
55
|
+
return jsonCommand(
|
|
56
|
+
"PATCH",
|
|
57
|
+
`/openapi/knowledge/nodes/${id}`,
|
|
58
|
+
options,
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (area === "nodes" && action === "delete") {
|
|
63
|
+
assertNoExtraPositionals(positionals, 4);
|
|
64
|
+
assertOptions(options);
|
|
65
|
+
const id = nodePath(positionals, "knowledge node ID");
|
|
66
|
+
return { method: "DELETE", path: `/openapi/knowledge/nodes/${id}` };
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
if (area === "nodes" && action === "move") {
|
|
70
|
+
assertNoExtraPositionals(positionals, 4);
|
|
71
|
+
const id = nodePath(positionals, "knowledge node ID");
|
|
72
|
+
return jsonCommand(
|
|
73
|
+
"PUT",
|
|
74
|
+
`/openapi/knowledge/nodes/${id}/move`,
|
|
75
|
+
options,
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if (area === "documents" && action === "list") {
|
|
80
|
+
assertNoExtraPositionals(positionals, 4);
|
|
81
|
+
assertOptions(options);
|
|
82
|
+
const id = nodePath(positionals, "knowledge node ID");
|
|
83
|
+
return {
|
|
84
|
+
method: "GET",
|
|
85
|
+
path: `/openapi/knowledge/nodes/${id}/documents`,
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if (area === "documents" && action === "create") {
|
|
90
|
+
assertNoExtraPositionals(positionals, 4);
|
|
91
|
+
const id = nodePath(positionals, "knowledge node ID");
|
|
92
|
+
return jsonCommand(
|
|
93
|
+
"POST",
|
|
94
|
+
`/openapi/knowledge/nodes/${id}/documents`,
|
|
95
|
+
options,
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
if (area === "documents" && action === "upsert") {
|
|
100
|
+
assertNoExtraPositionals(positionals, 4);
|
|
101
|
+
const id = nodePath(positionals, "knowledge node ID");
|
|
102
|
+
return jsonCommand(
|
|
103
|
+
"PUT",
|
|
104
|
+
`/openapi/knowledge/nodes/${id}/documents`,
|
|
105
|
+
options,
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
if (area === "documents" && action === "update") {
|
|
110
|
+
assertNoExtraPositionals(positionals, 4);
|
|
111
|
+
const id = nodePath(positionals, "knowledge document ID");
|
|
112
|
+
return jsonCommand(
|
|
113
|
+
"PUT",
|
|
114
|
+
`/openapi/knowledge/documents/${id}`,
|
|
115
|
+
options,
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
if (area === "documents" && action === "delete") {
|
|
120
|
+
assertNoExtraPositionals(positionals, 4);
|
|
121
|
+
assertOptions(options);
|
|
122
|
+
const id = nodePath(positionals, "knowledge document ID");
|
|
123
|
+
return {
|
|
124
|
+
method: "DELETE",
|
|
125
|
+
path: `/openapi/knowledge/documents/${id}`,
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
return null;
|
|
130
|
+
}
|
package/src/commands.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { resolveContent } from "./command-handlers/content.js";
|
|
2
2
|
import { resolveExamRecords } from "./command-handlers/exam-records.js";
|
|
3
3
|
import { resolveGenTasks } from "./command-handlers/gen-tasks.js";
|
|
4
|
+
import { resolveKnowledge } from "./command-handlers/knowledge.js";
|
|
4
5
|
import { resolveMedicalSearch } from "./command-handlers/medical-search.js";
|
|
5
6
|
import { resolveProducts } from "./command-handlers/products.js";
|
|
6
7
|
import { resolveScoring } from "./command-handlers/scoring.js";
|
|
@@ -8,6 +9,7 @@ import { CliError } from "./errors.js";
|
|
|
8
9
|
|
|
9
10
|
const resolvers = [
|
|
10
11
|
resolveProducts,
|
|
12
|
+
resolveKnowledge,
|
|
11
13
|
resolveGenTasks,
|
|
12
14
|
resolveExamRecords,
|
|
13
15
|
resolveScoring,
|
package/src/help.js
CHANGED
|
@@ -10,6 +10,18 @@ Usage:
|
|
|
10
10
|
Commands:
|
|
11
11
|
products get <product-id>
|
|
12
12
|
products update-knowledge-tree <product-id> --input <file|->
|
|
13
|
+
knowledge tree <product-code>
|
|
14
|
+
knowledge nodes by-path --input <file|->
|
|
15
|
+
knowledge nodes create --input <file|->
|
|
16
|
+
knowledge nodes get <node-id>
|
|
17
|
+
knowledge nodes update <node-id> --input <file|->
|
|
18
|
+
knowledge nodes delete <node-id>
|
|
19
|
+
knowledge nodes move <node-id> --input <file|->
|
|
20
|
+
knowledge documents list <node-id>
|
|
21
|
+
knowledge documents create <node-id> --input <file|->
|
|
22
|
+
knowledge documents upsert <node-id> --input <file|->
|
|
23
|
+
knowledge documents update <document-id> --input <file|->
|
|
24
|
+
knowledge documents delete <document-id>
|
|
13
25
|
gen-tasks list [--status STATUS] [--limit N]
|
|
14
26
|
gen-tasks get <task-id>
|
|
15
27
|
gen-tasks submit <task-id> --input <file|->
|
package/src/metadata.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export const VERSION = "1.
|
|
1
|
+
export const VERSION = "1.4.0";
|
|
2
2
|
export const DEFAULT_TIMEOUT_MS = 30_000;
|
|
3
3
|
export const DEFAULT_RETRIES = 2;
|
|
4
4
|
|
|
@@ -26,7 +26,86 @@ export const COMMANDS = Object.freeze([
|
|
|
26
26
|
method: "PUT",
|
|
27
27
|
path: "/openapi/products/{id}/knowledge-tree",
|
|
28
28
|
input: "{nodes: [...]}",
|
|
29
|
-
summary: "Replace the product's dynamic L3/L4 knowledge-tree nodes.",
|
|
29
|
+
summary: "Replace the product's dynamic L2/L3/L4 knowledge-tree nodes.",
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
command: "knowledge tree <product-code>",
|
|
33
|
+
method: "GET",
|
|
34
|
+
path: "/openapi/knowledge/tree",
|
|
35
|
+
summary: "Get a product's complete physical knowledge tree and documents.",
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
command: "knowledge nodes by-path",
|
|
39
|
+
method: "POST",
|
|
40
|
+
path: "/openapi/knowledge/nodes/by-path",
|
|
41
|
+
input: "{product, path}",
|
|
42
|
+
summary: "Idempotently create or reuse nodes along a visible path.",
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
command: "knowledge nodes create",
|
|
46
|
+
method: "POST",
|
|
47
|
+
path: "/openapi/knowledge/nodes",
|
|
48
|
+
input: "{parentId, name, sortOrder?}",
|
|
49
|
+
summary: "Idempotently create a node under a parent.",
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
command: "knowledge nodes get <node-id>",
|
|
53
|
+
method: "GET",
|
|
54
|
+
path: "/openapi/knowledge/nodes/{id}",
|
|
55
|
+
summary: "Get a knowledge node with its path and documents.",
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
command: "knowledge nodes update <node-id>",
|
|
59
|
+
method: "PATCH",
|
|
60
|
+
path: "/openapi/knowledge/nodes/{id}",
|
|
61
|
+
input: "{name?, sortOrder?}",
|
|
62
|
+
summary: "Update a knowledge node's name or sort order.",
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
command: "knowledge nodes delete <node-id>",
|
|
66
|
+
method: "DELETE",
|
|
67
|
+
path: "/openapi/knowledge/nodes/{id}",
|
|
68
|
+
summary: "Delete a knowledge node, its subtree, and documents.",
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
command: "knowledge nodes move <node-id>",
|
|
72
|
+
method: "PUT",
|
|
73
|
+
path: "/openapi/knowledge/nodes/{id}/move",
|
|
74
|
+
input: "{newParentId, sortOrder?}",
|
|
75
|
+
summary: "Move a knowledge node and cascade subtree levels.",
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
command: "knowledge documents list <node-id>",
|
|
79
|
+
method: "GET",
|
|
80
|
+
path: "/openapi/knowledge/nodes/{id}/documents",
|
|
81
|
+
summary: "List evidence documents attached to a node.",
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
command: "knowledge documents create <node-id>",
|
|
85
|
+
method: "POST",
|
|
86
|
+
path: "/openapi/knowledge/nodes/{id}/documents",
|
|
87
|
+
input: "{title, url?, summary?}",
|
|
88
|
+
summary: "Idempotently create a document under a node.",
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
command: "knowledge documents upsert <node-id>",
|
|
92
|
+
method: "PUT",
|
|
93
|
+
path: "/openapi/knowledge/nodes/{id}/documents",
|
|
94
|
+
input: "{items: [...]}",
|
|
95
|
+
summary: "Batch upsert node documents by title.",
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
command: "knowledge documents update <document-id>",
|
|
99
|
+
method: "PUT",
|
|
100
|
+
path: "/openapi/knowledge/documents/{id}",
|
|
101
|
+
input: "{title?, url?, summary?}",
|
|
102
|
+
summary: "Update supplied fields on a knowledge document.",
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
command: "knowledge documents delete <document-id>",
|
|
106
|
+
method: "DELETE",
|
|
107
|
+
path: "/openapi/knowledge/documents/{id}",
|
|
108
|
+
summary: "Delete a knowledge document.",
|
|
30
109
|
},
|
|
31
110
|
{
|
|
32
111
|
command: "gen-tasks list",
|
|
@@ -42,13 +121,13 @@ export const COMMANDS = Object.freeze([
|
|
|
42
121
|
command: "gen-tasks get <task-id>",
|
|
43
122
|
method: "GET",
|
|
44
123
|
path: "/openapi/gen-tasks/{taskId}",
|
|
45
|
-
summary: "Get a
|
|
124
|
+
summary: "Get a task, knowledge contexts, rules, and pending failures.",
|
|
46
125
|
},
|
|
47
126
|
{
|
|
48
127
|
command: "gen-tasks submit <task-id>",
|
|
49
128
|
method: "POST",
|
|
50
129
|
path: "/openapi/gen-tasks/{taskId}/questions",
|
|
51
|
-
input: "{items: [
|
|
130
|
+
input: "{items: [{externalRef, knowledgeNodeId?, content}], finished?}",
|
|
52
131
|
summary: "Submit generated questions. externalRef is the idempotency key.",
|
|
53
132
|
},
|
|
54
133
|
{
|