@guandata/decidex 0.5.0 → 0.7.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 +55 -10
- package/docs/api-coverage.md +25 -9
- package/package.json +1 -1
- package/src/api-catalog.json +548 -311
- package/src/cli.js +121 -14
- package/src/compatibility.js +18 -5
package/src/cli.js
CHANGED
|
@@ -7,7 +7,7 @@ import { homedir } from "node:os";
|
|
|
7
7
|
import { basename, dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
|
|
8
8
|
import { parseArgs } from "node:util";
|
|
9
9
|
|
|
10
|
-
import { ADAPTED_SERVER_VERSION, ADAPTED_SERVER_COMMIT, COMMAND_COMPATIBILITY, compareVersions, resolveCommandCompatibility, adaptAutomationSchedule } from "./compatibility.js";
|
|
10
|
+
import { ADAPTED_SERVER_VERSION, ADAPTED_SERVER_COMMIT, COLLABORATION_DISCLOSURE_VERSION, LEGACY_COLLABORATION_VERSIONS, COMMAND_COMPATIBILITY, compareVersions, resolveCommandCompatibility, adaptAutomationSchedule } from "./compatibility.js";
|
|
11
11
|
|
|
12
12
|
import { apiCatalog, apiOperation, parameterFlag, operationPath, appendQuery } from "./catalog.js";
|
|
13
13
|
|
|
@@ -42,19 +42,22 @@ Usage:
|
|
|
42
42
|
decidex agent file delete ID FILE_ID
|
|
43
43
|
decidex agent file download ID FILE_ID FILE
|
|
44
44
|
decidex agent models ID
|
|
45
|
-
decidex agent improvement get|enable|disable AGENT_ID
|
|
45
|
+
decidex agent improvement get|enable|disable AGENT_ID # server 0.0.8..0.0.10 only
|
|
46
46
|
decidex agent run ID (--message TEXT | --input FILE | --attach FILE) [--model-entry-id ID] [--reasoning-effort LEVEL] [--wait] [--follow] [--output FILE] [--timeout SECONDS]
|
|
47
47
|
|
|
48
48
|
decidex session list [--status all|running|completed] [--query TEXT] [--cursor CURSOR] [--agent-id ID] [--pinned-session-id ID] [--pinned-agent-id ID]
|
|
49
49
|
decidex session view SESSION_ID [--before CURSOR | --since CURSOR]
|
|
50
|
+
decidex session follow-ups SESSION_ID --run-id RUN_ID
|
|
51
|
+
decidex session evidence SESSION_ID --message-id ID --path BOE_PATH [--file SOURCE_PATH --output FILE]
|
|
50
52
|
decidex session send SESSION_ID (--message TEXT | --input FILE) [--wait] [--follow]
|
|
51
53
|
decidex session stop SESSION_ID
|
|
52
54
|
decidex session rename SESSION_ID TITLE
|
|
53
55
|
decidex session delete SESSION_ID
|
|
54
56
|
decidex session model SESSION_ID MODEL_ENTRY_ID
|
|
55
57
|
decidex session fork SESSION_ID RUN_ID
|
|
56
|
-
decidex session collaboration status|activate|continue|stop|task|download ...
|
|
58
|
+
decidex session collaboration status|disclosure|consent|activate|continue|stop|task|download ...
|
|
57
59
|
decidex session queue list SESSION_ID
|
|
60
|
+
decidex session queue add SESSION_ID (--message TEXT | --input FILE)
|
|
58
61
|
decidex session queue edit SESSION_ID DRAFT_ID (--message TEXT | --input FILE)
|
|
59
62
|
decidex session queue delete SESSION_ID DRAFT_ID
|
|
60
63
|
decidex session queue continue SESSION_ID [--wait] [--follow] [--output FILE]
|
|
@@ -116,6 +119,7 @@ Usage:
|
|
|
116
119
|
decidex api METHOD PATH [--data FILE] [--output FILE]
|
|
117
120
|
decidex version --json # local CLI version
|
|
118
121
|
decidex server version # target version and commit
|
|
122
|
+
decidex server license # product license status; server >= 0.0.9
|
|
119
123
|
decidex server check [COMMAND...] # version rules and selected protocol
|
|
120
124
|
|
|
121
125
|
Turn options (agent run / session send):
|
|
@@ -201,7 +205,7 @@ released minimum versions are checked against the target server.`,
|
|
|
201
205
|
decidex agent knowledge list|add|remove ...
|
|
202
206
|
decidex agent file list|add|delete|download ...
|
|
203
207
|
decidex agent models AGENT_ID
|
|
204
|
-
decidex agent improvement get|enable|disable AGENT_ID
|
|
208
|
+
decidex agent improvement get|enable|disable AGENT_ID # server 0.0.8..0.0.10 only
|
|
205
209
|
decidex agent run AGENT_ID (--message TEXT | --input FILE) [--wait] [--follow] [--output FILE]`,
|
|
206
210
|
"agent run": `Usage:
|
|
207
211
|
decidex agent run AGENT_ID (--message TEXT | --input FILE | --attach FILE) [--model-entry-id ID] [--reasoning-effort LEVEL] [--wait] [--follow] [--output FILE] [--timeout SECONDS]
|
|
@@ -214,12 +218,15 @@ to stderr, so stdout or --output remains machine-readable.
|
|
|
214
218
|
accept JSON arrays. --reasoning-effort null uses the model default.
|
|
215
219
|
Use agent models AGENT_ID to discover supported catalog entries and efforts.`,
|
|
216
220
|
"agent improvement": `Usage:
|
|
217
|
-
decidex agent improvement get|enable|disable AGENT_ID
|
|
221
|
+
decidex agent improvement get|enable|disable AGENT_ID # server 0.0.8..0.0.10 only
|
|
218
222
|
|
|
219
|
-
|
|
223
|
+
Only server 0.0.8..0.0.10 with edit permission; removed in 0.0.11.
|
|
224
|
+
Enabling processes new feedback only;
|
|
220
225
|
it does not replay feedback collected while disabled. Generated changes still require review.`,
|
|
221
226
|
"session collaboration": `Usage:
|
|
222
227
|
decidex session collaboration status SESSION_ID
|
|
228
|
+
decidex session collaboration disclosure [--agent-id ID]
|
|
229
|
+
decidex session collaboration consent --accept-governance-notice
|
|
223
230
|
decidex session collaboration activate SESSION_ID --accept-governance-notice
|
|
224
231
|
decidex session collaboration continue SESSION_ID --submission-id UUID
|
|
225
232
|
decidex session collaboration stop SESSION_ID --epoch N
|
|
@@ -227,22 +234,43 @@ it does not replay feedback collected while disabled. Generated changes still re
|
|
|
227
234
|
decidex session collaboration download SESSION_ID REMOTE_PATH FILE
|
|
228
235
|
|
|
229
236
|
Requires server >= 0.0.8. Only an idle normal Personal Agent user session can activate.
|
|
237
|
+
On >= 0.0.9, read disclosure and explicitly consent first; consent is saved for the current
|
|
238
|
+
organization membership (notice version 1), not automatically by activate.
|
|
239
|
+
On >= 0.0.10, the Agent must enable betaFeatures.collaborationEnabled before session creation.
|
|
230
240
|
Experts work with the owner's authority and may consume additional model credits.
|
|
231
241
|
Expert maintainers can review received and shared materials; share only necessary data.
|
|
232
242
|
Read status for the current work epoch before stopping. Keep the same submission UUID
|
|
233
243
|
for the same continuation; after an uncertain response inspect status, do not blindly retry.
|
|
234
244
|
download uses a material path returned by status, not a local path.`,
|
|
245
|
+
"session send": `Usage:
|
|
246
|
+
decidex session send SESSION_ID (--message TEXT | --input FILE) [--wait] [--follow]
|
|
247
|
+
decidex session send SESSION_ID --message TEXT --expected-run-id RUN_ID --submission-id UUID
|
|
248
|
+
|
|
249
|
+
Server >= 0.0.11 may deliver non-waiting plain text to the active Run.
|
|
250
|
+
Use queue add to explicitly keep a message for the next turn. Pinned active input is text-only,
|
|
251
|
+
requires both flags and cannot combine --wait or reasoning settings. If the Run changes, 409
|
|
252
|
+
is preserved; inspect session view after an uncertain response, do not trigger a new Run.`,
|
|
253
|
+
"session evidence": `Usage:
|
|
254
|
+
decidex session evidence SESSION_ID --message-id MESSAGE_ID --path BOE_PATH
|
|
255
|
+
decidex session evidence SESSION_ID --message-id MESSAGE_ID --path BOE_PATH --file SOURCE_PATH --output FILE
|
|
256
|
+
|
|
257
|
+
Requires server >= 0.0.11. Uses the answer's fixed snapshot when available.
|
|
258
|
+
status=fixed/legacy/unavailable is preserved. Legacy reads can reflect live files;
|
|
259
|
+
only files belonging to the bound evidence can be downloaded.`,
|
|
235
260
|
session: `Usage:
|
|
236
261
|
decidex session list [--status all|running|completed] [--query TEXT] [--cursor CURSOR] [--agent-id ID] [--pinned-session-id ID] [--pinned-agent-id ID]
|
|
237
262
|
decidex session view SESSION_ID [--before CURSOR | --since CURSOR]
|
|
263
|
+
decidex session follow-ups SESSION_ID --run-id RUN_ID
|
|
264
|
+
decidex session evidence SESSION_ID --message-id ID --path BOE_PATH [--file SOURCE_PATH --output FILE]
|
|
238
265
|
decidex session send SESSION_ID (--message TEXT | --input FILE) [--wait] [--follow]
|
|
239
266
|
decidex session stop SESSION_ID
|
|
240
267
|
decidex session rename SESSION_ID TITLE
|
|
241
268
|
decidex session delete SESSION_ID
|
|
242
269
|
decidex session model SESSION_ID MODEL_ENTRY_ID
|
|
243
270
|
decidex session fork SESSION_ID RUN_ID
|
|
244
|
-
decidex session collaboration status|activate|continue|stop|task|download ...
|
|
271
|
+
decidex session collaboration status|disclosure|consent|activate|continue|stop|task|download ...
|
|
245
272
|
decidex session queue list SESSION_ID
|
|
273
|
+
decidex session queue add SESSION_ID (--message TEXT | --input FILE)
|
|
246
274
|
decidex session queue edit SESSION_ID DRAFT_ID (--message TEXT | --input FILE)
|
|
247
275
|
decidex session queue delete SESSION_ID DRAFT_ID
|
|
248
276
|
decidex session queue continue SESSION_ID [--wait] [--follow] [--output FILE]
|
|
@@ -308,6 +336,7 @@ Runtime Pod termination details require backend support.`,
|
|
|
308
336
|
decidex ontology versions create NETWORK_ID [--description TEXT]`,
|
|
309
337
|
server: `Usage:
|
|
310
338
|
decidex server version
|
|
339
|
+
decidex server license # product license status; server >= 0.0.9
|
|
311
340
|
decidex server check [COMMAND...]
|
|
312
341
|
|
|
313
342
|
Unknown rules report supported=null; a newer server alone is not proof of compatibility.`,
|
|
@@ -445,6 +474,8 @@ async function request(path, { method = "GET", body, deadline, headers: extraHea
|
|
|
445
474
|
const error = new Error(`Decidex ${response.status}: ${detail || response.statusText}`);
|
|
446
475
|
error.httpStatus = response.status;
|
|
447
476
|
error.code = payload && typeof payload === "object" ? payload.code : undefined;
|
|
477
|
+
error.reason = payload && typeof payload === "object" ? payload.reason : undefined;
|
|
478
|
+
if (error.code === "decidexLicenseAdmissionBlocked") error.message += ";请用 decidex server license 查询产品授权状态,这不等同于登录失效";
|
|
448
479
|
error.requestId = payload && typeof payload === "object" ? payload.requestId : undefined;
|
|
449
480
|
throw error;
|
|
450
481
|
}
|
|
@@ -873,6 +904,7 @@ async function targetVersion(values, deadline = Date.now() + 10_000) {
|
|
|
873
904
|
async function commandCompatibility(command, values) {
|
|
874
905
|
const server = await targetVersion(values);
|
|
875
906
|
const result = resolveCommandCompatibility(command, server.version);
|
|
907
|
+
if (result.reason === "removed_in_release") throw new Error(`decidex ${command} 自服务端 ${result.removedIn} 起已移除,目标 ${server.version} 不支持;仅在该版本之前的旧环境保留此用法`);
|
|
876
908
|
if (result.supported === false) throw new Error(`decidex ${command} 需要服务端 >= ${result.minVersion};目标版本为 ${server.version},该版本不支持此命令`);
|
|
877
909
|
return result;
|
|
878
910
|
}
|
|
@@ -888,6 +920,10 @@ async function readIdentity(command, values) {
|
|
|
888
920
|
|
|
889
921
|
async function serverCommand(action, args) {
|
|
890
922
|
const { values, positionals } = commandArgs(args);
|
|
923
|
+
if (action === "license") {
|
|
924
|
+
expectPositionals(positionals, 0, "server license");
|
|
925
|
+
return print(await taskApi("decidex-license.list", {}, { values }));
|
|
926
|
+
}
|
|
891
927
|
if (!["version", "check"].includes(action)) throw new Error(`未知 server 命令:${action || "(空)"}`);
|
|
892
928
|
if (action === "version") expectPositionals(positionals, 0, "server version");
|
|
893
929
|
const server = await targetVersion(values);
|
|
@@ -1027,7 +1063,7 @@ async function agentCommand(action, args) {
|
|
|
1027
1063
|
expectPositionals(positionals, 2, "agent improvement get|enable|disable AGENT_ID");
|
|
1028
1064
|
const [operation, agentId] = positionals;
|
|
1029
1065
|
if (!["get", "enable", "disable"].includes(operation)) throw new Error("improvement 只支持 get、enable、disable");
|
|
1030
|
-
return print(await
|
|
1066
|
+
return print(await request(`/api/personal-agents/${encodeURIComponent(agentId)}/background-improvement`, { method: operation === "get" ? "GET" : "PUT", body: operation === "get" ? undefined : { enabled: operation === "enable" }, values, deadline: Date.now() + positiveSeconds(values.timeout) * 1000 }));
|
|
1031
1067
|
}
|
|
1032
1068
|
if (action === "get") return print(await request(`/api/personal-agents/${encodeURIComponent(required(positionals[0], "ID"))}`, { values }));
|
|
1033
1069
|
if (action === "apply") {
|
|
@@ -1036,11 +1072,31 @@ async function agentCommand(action, args) {
|
|
|
1036
1072
|
if (!spec || typeof spec !== "object" || Array.isArray(spec)) throw new Error("Agent 文件必须是 JSON 对象");
|
|
1037
1073
|
const id = spec.id;
|
|
1038
1074
|
if (id !== undefined && (typeof id !== "string" || !id.trim())) throw new Error("Agent id 必须是非空字符串");
|
|
1039
|
-
const allowed = new Set(["id", "name", "description", "instructions", "avatarIcon", "avatarColor", "avatarImageDataUrl", "openingMessage", "presetQuestions", "contextReferences", "bizOntologyBindings", "betaFeatures", "actionSuggestionsEnabled", "biUserPropertiesEnabled", "biUserPropertyKeys", "biExplorationPolicy", "pluginSelection", "useScope", "sessionDefaultModelCatalogEntryId", "sessionDefaultReasoningEffort", ...(id ? ["builtInInstructions"] : [])]);
|
|
1075
|
+
const allowed = new Set(["id", "name", "description", "instructions", "avatarIcon", "avatarColor", "avatarImageDataUrl", "openingMessage", "presetQuestions", "contextReferences", "bizOntologyBindings", "betaFeatures", "actionSuggestionsEnabled", "promptSuggestionsEnabled", "biUserPropertiesEnabled", "biUserPropertyKeys", "biExplorationPolicy", "pluginSelection", "useScope", "sessionDefaultModelCatalogEntryId", "sessionDefaultReasoningEffort", ...(id ? ["builtInInstructions"] : [])]);
|
|
1040
1076
|
const unknown = Object.keys(spec).filter((key) => !allowed.has(key));
|
|
1041
1077
|
if (unknown.length) throw new Error(`Agent 文件包含不支持的字段:${unknown.join(", ")}`);
|
|
1042
1078
|
const body = { ...spec };
|
|
1043
1079
|
delete body.id;
|
|
1080
|
+
if (body.promptSuggestionsEnabled !== undefined) {
|
|
1081
|
+
if (typeof body.promptSuggestionsEnabled !== "boolean") throw new Error("promptSuggestionsEnabled 必须是布尔值");
|
|
1082
|
+
await commandCompatibility("agent apply prompt-suggestions", values);
|
|
1083
|
+
}
|
|
1084
|
+
if (body.betaFeatures?.collaborationDefaultEnabled !== undefined || body.betaFeatures?.collaborationExpertEnabled !== undefined) {
|
|
1085
|
+
if ([body.betaFeatures.collaborationDefaultEnabled, body.betaFeatures.collaborationExpertEnabled].some((value) => value !== undefined && typeof value !== "boolean")) throw new Error("旧协作开关必须是布尔值");
|
|
1086
|
+
const server = await targetVersion(values);
|
|
1087
|
+
if (compareVersions(server.version, LEGACY_COLLABORATION_VERSIONS.minVersion) < 0 || compareVersions(server.version, LEGACY_COLLABORATION_VERSIONS.before) >= 0) throw new Error("collaborationDefaultEnabled / collaborationExpertEnabled 仅适用于服务端 0.0.9;0.0.10 起需显式迁移为 collaborationEnabled 和专家名单,不能自动转换授权");
|
|
1088
|
+
}
|
|
1089
|
+
if (body.betaFeatures?.collaborationEnabled !== undefined || body.betaFeatures?.collaborationExpertAgentIds !== undefined) {
|
|
1090
|
+
const features = body.betaFeatures;
|
|
1091
|
+
if (features.collaborationEnabled !== undefined && typeof features.collaborationEnabled !== "boolean") throw new Error("collaborationEnabled 必须是布尔值");
|
|
1092
|
+
if (features.collaborationExpertAgentIds !== undefined) {
|
|
1093
|
+
const ids = features.collaborationExpertAgentIds;
|
|
1094
|
+
if (!Array.isArray(ids) || ids.length > 20 || ids.some((id) => typeof id !== "string" || !id.trim() || id.trim().length > 120)) throw new Error("collaborationExpertAgentIds 最多 20 项,每项为 1..120 字符的 Agent ID");
|
|
1095
|
+
features.collaborationExpertAgentIds = ids.map((id) => id.trim());
|
|
1096
|
+
if (new Set(features.collaborationExpertAgentIds).size !== ids.length) throw new Error("专家名单不能重复");
|
|
1097
|
+
}
|
|
1098
|
+
await commandCompatibility("agent apply collaboration", values);
|
|
1099
|
+
}
|
|
1044
1100
|
if (body.biUserPropertiesEnabled !== undefined || body.biUserPropertyKeys !== undefined) {
|
|
1045
1101
|
if (body.biUserPropertiesEnabled !== undefined && typeof body.biUserPropertiesEnabled !== "boolean") throw new Error("biUserPropertiesEnabled 必须是布尔值");
|
|
1046
1102
|
if (body.biUserPropertyKeys !== undefined) {
|
|
@@ -1133,6 +1189,11 @@ async function sessionCommand(action, args) {
|
|
|
1133
1189
|
"pinned-agent-id": { type: "string", multiple: true },
|
|
1134
1190
|
"accept-governance-notice": { type: "boolean", default: false },
|
|
1135
1191
|
"submission-id": { type: "string" },
|
|
1192
|
+
"run-id": { type: "string" },
|
|
1193
|
+
"expected-run-id": { type: "string" },
|
|
1194
|
+
"message-id": { type: "string" },
|
|
1195
|
+
path: { type: "string" },
|
|
1196
|
+
file: { type: "string" },
|
|
1136
1197
|
epoch: { type: "string" },
|
|
1137
1198
|
"model-entry-id": { type: "string" },
|
|
1138
1199
|
before: { type: "string" },
|
|
@@ -1154,6 +1215,16 @@ async function sessionCommand(action, args) {
|
|
|
1154
1215
|
});
|
|
1155
1216
|
if (action === "collaboration") {
|
|
1156
1217
|
const [operation, sessionId, third, fourth] = positionals;
|
|
1218
|
+
if (["disclosure", "consent"].includes(operation)) {
|
|
1219
|
+
expectPositionals(positionals, 1, `session collaboration ${operation}`);
|
|
1220
|
+
if (operation === "consent" && !values["accept-governance-notice"]) throw new Error("确认材料共享、专家管理者审查及模型消耗后添加 --accept-governance-notice;本确认按当前组织成员保存");
|
|
1221
|
+
const disclosure = await taskApi("agent-collaboration.disclosure.list", {}, { query: values["agent-id"] ? { agentId: values["agent-id"] } : {}, values });
|
|
1222
|
+
if (operation === "disclosure") return emit(disclosure, values.output);
|
|
1223
|
+
if (!disclosure.available) throw new Error("目标尚未开放专家协作,未保存确认");
|
|
1224
|
+
if (disclosure.version !== COLLABORATION_DISCLOSURE_VERSION) throw new Error("协作说明版本已变化,请更新 CLI 并重新阅读说明,未保存确认");
|
|
1225
|
+
if (disclosure.accepted) return emit(disclosure, values.output);
|
|
1226
|
+
return emit(await taskApi("agent-collaboration.disclosure.create", {}, { body: { version: disclosure.version }, values }), values.output);
|
|
1227
|
+
}
|
|
1157
1228
|
if (!["status", "activate", "continue", "stop", "task", "download"].includes(operation)) throw new Error("collaboration 只支持 status、activate、continue、stop、task、download");
|
|
1158
1229
|
expectPositionals(positionals, operation === "download" ? 4 : operation === "task" ? 3 : 2, `session collaboration ${operation} SESSION_ID${operation === "download" ? " REMOTE_PATH FILE" : operation === "task" ? " TASK_ID" : ""}`);
|
|
1159
1230
|
let body;
|
|
@@ -1170,11 +1241,34 @@ async function sessionCommand(action, args) {
|
|
|
1170
1241
|
if (operation === "download" && (!third || third.length > 2048)) throw new Error("REMOTE_PATH 需要 1..2048 字符的远端材料路径");
|
|
1171
1242
|
const deadline = Date.now() + positiveSeconds(values.timeout) * 1000;
|
|
1172
1243
|
const session = await resolveSession(sessionId, values, deadline);
|
|
1244
|
+
if (operation === "activate" && (await commandCompatibility("session collaboration", values)).protocol === "member-disclosure") {
|
|
1245
|
+
const disclosure = await taskApi("agent-collaboration.disclosure.list", {}, { query: { agentId: session.agentId }, values, deadline });
|
|
1246
|
+
if (!disclosure.available) throw new Error("目标尚未开放专家协作");
|
|
1247
|
+
if (!disclosure.accepted) throw new Error("请先阅读 session collaboration --help,然后显式运行 session collaboration consent --accept-governance-notice;本确认按当前组织成员保存");
|
|
1248
|
+
}
|
|
1173
1249
|
const parameters = { agentId: session.agentId, sessionId, ...(operation === "task" ? { taskId: third } : {}) };
|
|
1174
1250
|
const id = operation === "download" ? "materials.list" : operation === "task" ? "tasks.get" : body ? "create" : "list";
|
|
1175
1251
|
const result = await taskApi(`personal-agents.sessions.collaboration.${id}`, parameters, { body, query: operation === "download" ? { path: third } : {}, output: operation === "download" ? fourth : undefined, values, deadline });
|
|
1176
1252
|
return operation === "download" ? print(result) : emit(result, values.output);
|
|
1177
1253
|
}
|
|
1254
|
+
if (action === "follow-ups") {
|
|
1255
|
+
expectPositionals(positionals, 1, "session follow-ups SESSION_ID --run-id RUN_ID");
|
|
1256
|
+
const runId = required(values["run-id"], "--run-id RUN_ID");
|
|
1257
|
+
const deadline = Date.now() + positiveSeconds(values.timeout) * 1000;
|
|
1258
|
+
const session = await resolveSession(positionals[0], values, deadline);
|
|
1259
|
+
return emit(await taskApi("personal-agents.sessions.follow-ups.list", { agentId: session.agentId, sessionId: positionals[0] }, { query: { runId }, values, deadline }), values.output);
|
|
1260
|
+
}
|
|
1261
|
+
if (action === "evidence") {
|
|
1262
|
+
expectPositionals(positionals, 1, "session evidence SESSION_ID --message-id ID --path BOE_PATH [--file SOURCE_PATH --output FILE]");
|
|
1263
|
+
const messageId = required(values["message-id"], "--message-id ID");
|
|
1264
|
+
const path = required(values.path, "--path BOE_PATH");
|
|
1265
|
+
if (path.length > 2000 || (values.file && values.file.length > 2000)) throw new Error("证据路径最多 2000 字符");
|
|
1266
|
+
if (values.file && !values.output) throw new Error("证据文件下载需要 --output FILE");
|
|
1267
|
+
const deadline = Date.now() + positiveSeconds(values.timeout) * 1000;
|
|
1268
|
+
const session = await resolveSession(positionals[0], values, deadline);
|
|
1269
|
+
const result = await taskApi("personal-agents.sessions.evidence.get", { agentId: session.agentId, sessionId: positionals[0], messageId }, { query: { path, ...(values.file ? { file: values.file } : {}) }, output: values.file ? values.output : undefined, values, deadline });
|
|
1270
|
+
return values.file ? print(result) : emit(result, values.output);
|
|
1271
|
+
}
|
|
1178
1272
|
if (action === "list") {
|
|
1179
1273
|
expectPositionals(positionals, 0, "session list");
|
|
1180
1274
|
if (!new Set(["all", "running", "completed"]).has(values.status)) throw new Error("--status 只支持 all、running、completed");
|
|
@@ -1195,16 +1289,20 @@ async function sessionCommand(action, args) {
|
|
|
1195
1289
|
}
|
|
1196
1290
|
if (action === "queue") {
|
|
1197
1291
|
const [operation, sessionId, draftId] = positionals;
|
|
1198
|
-
if (!["list", "edit", "delete", "continue"].includes(operation)) throw new Error("queue 只支持 list、edit、delete、continue");
|
|
1292
|
+
if (!["list", "add", "edit", "delete", "continue"].includes(operation)) throw new Error("queue 只支持 list、add、edit、delete、continue");
|
|
1199
1293
|
expectPositionals(positionals, ["edit", "delete"].includes(operation) ? 3 : 2, `session queue ${operation} SESSION_ID [DRAFT_ID]`);
|
|
1200
|
-
|
|
1294
|
+
if (operation === "add") {
|
|
1295
|
+
if (values.attach?.length || values["context-references"] || values["conversation-references"]) throw new Error("排队只支持纯文本,不支持附件或引用");
|
|
1296
|
+
await commandCompatibility("session queue add", values);
|
|
1297
|
+
}
|
|
1298
|
+
const body = ["edit", "add"].includes(operation) ? { message: await readMessage(values), ...(operation === "add" && values["reasoning-effort"] !== undefined ? { reasoningEffort: values["reasoning-effort"] === "null" ? null : values["reasoning-effort"] } : {}) } : undefined;
|
|
1201
1299
|
if (values.follow && (!values.wait || operation !== "continue")) throw new Error("--follow 仅支持 queue continue --wait");
|
|
1202
1300
|
if (values.wait && operation !== "continue") throw new Error("--wait 仅支持 queue continue");
|
|
1203
1301
|
if (values.wait) positiveSeconds(values.timeout);
|
|
1204
1302
|
const session = await resolveSession(sessionId, values);
|
|
1205
1303
|
const path = `${sessionPath(session.agentId, sessionId)}/queued-turn-drafts`;
|
|
1206
1304
|
const suffix = draftId ? `/${encodeURIComponent(draftId)}` : operation === "continue" ? "/continue" : "";
|
|
1207
|
-
const result = await request(`${path}${suffix}`, { method: { list: "GET", edit: "PATCH", delete: "DELETE", continue: "POST" }[operation], body, values });
|
|
1305
|
+
const result = await request(`${path}${suffix}`, { method: { list: "GET", add: "POST", edit: "PATCH", delete: "DELETE", continue: "POST" }[operation], body, values });
|
|
1208
1306
|
if (operation !== "continue") return emit(result, values.output);
|
|
1209
1307
|
await rememberRunBestEffort(session.agentId, sessionId, result.runId, values);
|
|
1210
1308
|
if (!values.wait) return emit(result, values.output);
|
|
@@ -1269,6 +1367,14 @@ async function sessionCommand(action, args) {
|
|
|
1269
1367
|
if (values.follow && !values.wait) throw new Error("--follow 需要同时指定 --wait");
|
|
1270
1368
|
if (values["model-entry-id"]) throw new Error("续问切换模型请先执行 session model SESSION_ID MODEL_ENTRY_ID");
|
|
1271
1369
|
const body = await turnBody(values);
|
|
1370
|
+
if (values["expected-run-id"] !== undefined || values["submission-id"] !== undefined) {
|
|
1371
|
+
if (!values["expected-run-id"]?.trim() || values["expected-run-id"].trim().length > 120 || !values["submission-id"]) throw new Error("向本轮发送时须同时传 --expected-run-id(1..120 字符)和 --submission-id UUID");
|
|
1372
|
+
if (!/^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(values["submission-id"])) throw new Error("--submission-id 必须是 UUID");
|
|
1373
|
+
if (values.wait || values.attach?.length || values["context-references"] || values["conversation-references"] || values["reasoning-effort"] !== undefined) throw new Error("向指定本轮输入只支持纯文本,不能带 --wait、附件、引用或推理强度;结果需从会话查看");
|
|
1374
|
+
await commandCompatibility("session send active-input", values);
|
|
1375
|
+
body.expectedRunId = values["expected-run-id"].trim();
|
|
1376
|
+
body.submissionId = values["submission-id"];
|
|
1377
|
+
}
|
|
1272
1378
|
if (values.wait) positiveSeconds(values.timeout);
|
|
1273
1379
|
const started = await request(`${sessionPath(session.agentId, sessionId)}/chat`, {
|
|
1274
1380
|
method: "POST",
|
|
@@ -1955,7 +2061,8 @@ async function trackingCommand(action, args) {
|
|
|
1955
2061
|
const session = await resolveSession(sessionId, values, deadline);
|
|
1956
2062
|
const parameters = { agentId: session.agentId, sessionId };
|
|
1957
2063
|
if (action === "lookup") return emit(await taskApi("personal-agents.sessions.decision-tracking-tasks.list", parameters, { query: { candidatePath, boePath }, values, deadline }), values.output);
|
|
1958
|
-
const
|
|
2064
|
+
const useSnapshot = values["source-message-id"] && (await commandCompatibility("tracking source-evidence", values)).protocol === "message-snapshot";
|
|
2065
|
+
const preview = await taskApi("personal-agents.sessions.decision-tracking-candidate-preview.list", parameters, { query: { candidatePath, boePath, language: values.language, ...(useSnapshot ? { sourceMessageId: values["source-message-id"] } : {}) }, values, deadline });
|
|
1959
2066
|
if (action === "preview") return emit(preview, values.output);
|
|
1960
2067
|
if (!preview.candidate || !/^[a-f0-9]{64}$/.test(preview.evidenceVersion ?? "")) throw new Error("服务端未返回有效候选或 evidenceVersion,未创建任务");
|
|
1961
2068
|
const body = { candidatePath, boePath, candidate: preview.candidate, evidenceVersion: preview.evidenceVersion };
|
|
@@ -2148,7 +2255,7 @@ async function main() {
|
|
|
2148
2255
|
|
|
2149
2256
|
main().catch((error) => {
|
|
2150
2257
|
if (process.argv.includes("--json")) {
|
|
2151
|
-
process.stderr.write(`${JSON.stringify({ schemaVersion: 1, error: { message: error.message, httpStatus: error.httpStatus ?? null, code: error.code ?? null, requestId: error.requestId ?? null } })}\n`);
|
|
2258
|
+
process.stderr.write(`${JSON.stringify({ schemaVersion: 1, error: { message: error.message, httpStatus: error.httpStatus ?? null, code: error.code ?? null, requestId: error.requestId ?? null, ...(error.reason !== undefined ? { reason: error.reason } : {}) } })}\n`);
|
|
2152
2259
|
} else {
|
|
2153
2260
|
const command = process.argv.slice(2, 4).filter((item) => !item.startsWith("-")).join(" ");
|
|
2154
2261
|
process.stderr.write(`Error: ${error.message}${command ? `\nTry: decidex ${command} --help` : ""}\n`);
|
package/src/compatibility.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
export const ADAPTED_SERVER_VERSION = "0.0.
|
|
2
|
-
export const ADAPTED_SERVER_COMMIT = "
|
|
1
|
+
export const ADAPTED_SERVER_VERSION = "0.0.12";
|
|
2
|
+
export const ADAPTED_SERVER_COMMIT = "43ec18de2dd7dbd936b25caa431f78de1a06398c";
|
|
3
|
+
export const COLLABORATION_DISCLOSURE_VERSION = 1; // Identical in tags 0.0.9 and 0.0.10.
|
|
4
|
+
export const LEGACY_COLLABORATION_VERSIONS = { minVersion: "0.0.9", before: "0.0.10" };
|
|
3
5
|
|
|
4
6
|
// Version boundaries must be backed by release tags, not the current main version.
|
|
5
7
|
// /api/auth/context first appears between tags 0.0.4 and 0.0.5 (a860e97ad).
|
|
@@ -16,8 +18,16 @@ export const COMMAND_COMPATIBILITY = {
|
|
|
16
18
|
"automation apply bi-groups": { minVersion: "0.0.7" },
|
|
17
19
|
"automation apply partial": { minVersion: "0.0.7" },
|
|
18
20
|
// Collaboration routes and the background improvement switch first ship in 0.0.8.
|
|
19
|
-
"session collaboration": { minVersion: "0.0.8" },
|
|
20
|
-
"agent improvement": { minVersion: "0.0.8" },
|
|
21
|
+
"session collaboration": { minVersion: "0.0.8", protocol: "member-disclosure", legacy: { before: "0.0.9", protocol: "session-notice" } },
|
|
22
|
+
"agent improvement": { minVersion: "0.0.8", removedIn: "0.0.11" },
|
|
23
|
+
"server license": { minVersion: "0.0.9" },
|
|
24
|
+
"session follow-ups": { minVersion: "0.0.9" },
|
|
25
|
+
"agent apply prompt-suggestions": { minVersion: "0.0.9" },
|
|
26
|
+
"agent apply collaboration": { minVersion: "0.0.10" },
|
|
27
|
+
"session queue add": { minVersion: "0.0.11" },
|
|
28
|
+
"session send active-input": { minVersion: "0.0.11" },
|
|
29
|
+
"session evidence": { minVersion: "0.0.11" },
|
|
30
|
+
"tracking source-evidence": { protocol: "message-snapshot", legacy: { before: "0.0.11", protocol: "session-file" } },
|
|
21
31
|
};
|
|
22
32
|
|
|
23
33
|
export function adaptAutomationSchedule(input, protocol, now = Date.now()) {
|
|
@@ -97,6 +107,9 @@ export function resolveCommandCompatibility(command, version, rules = COMMAND_CO
|
|
|
97
107
|
if (rule.minVersion && compareVersions(version, rule.minVersion) < 0) {
|
|
98
108
|
return { command, supported: false, minVersion: rule.minVersion, protocol: null, reason: "server_too_old" };
|
|
99
109
|
}
|
|
110
|
+
if (rule.removedIn && compareVersions(version, rule.removedIn) >= 0) {
|
|
111
|
+
return { command, supported: false, removedIn: rule.removedIn, protocol: null, reason: "removed_in_release" };
|
|
112
|
+
}
|
|
100
113
|
const legacy = Boolean(rule.legacy && compareVersions(version, rule.legacy.before) < 0);
|
|
101
|
-
return { command, supported: true, minVersion: rule.minVersion ?? null, protocol: legacy ? rule.legacy.protocol : rule.protocol ?? "current", legacy };
|
|
114
|
+
return { command, supported: true, minVersion: rule.minVersion ?? null, ...(rule.removedIn ? { removedIn: rule.removedIn } : {}), protocol: legacy ? rule.legacy.protocol : rule.protocol ?? "current", legacy };
|
|
102
115
|
}
|