@ai-setting/roy-agent-cli 1.5.89 → 1.5.90
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/dist/bin/roy-agent.js +37 -54
- package/dist/index.js +37 -54
- package/dist/roy-agent-linux-x64/bin/roy-agent +0 -0
- package/package.json +1 -1
package/dist/bin/roy-agent.js
CHANGED
|
@@ -7320,7 +7320,7 @@ var require_dist = __commonJS((exports) => {
|
|
|
7320
7320
|
var require_package = __commonJS((exports, module) => {
|
|
7321
7321
|
module.exports = {
|
|
7322
7322
|
name: "@ai-setting/roy-agent-cli",
|
|
7323
|
-
version: "1.5.
|
|
7323
|
+
version: "1.5.90",
|
|
7324
7324
|
type: "module",
|
|
7325
7325
|
description: "CLI for roy-agent - Non-interactive command execution",
|
|
7326
7326
|
main: "./dist/index.js",
|
|
@@ -8092,8 +8092,8 @@ class ContextHandlerService {
|
|
|
8092
8092
|
}
|
|
8093
8093
|
throw error;
|
|
8094
8094
|
}
|
|
8095
|
-
if (!compactResult.newQuery
|
|
8096
|
-
logger3.error("Compact succeeded but produced
|
|
8095
|
+
if (!compactResult.newQuery) {
|
|
8096
|
+
logger3.error("Compact succeeded but produced undefined query, terminating", {
|
|
8097
8097
|
compactCount,
|
|
8098
8098
|
query
|
|
8099
8099
|
});
|
|
@@ -8185,36 +8185,14 @@ class ContextHandlerService {
|
|
|
8185
8185
|
async compactSession(sessionId, originalQuery) {
|
|
8186
8186
|
return this.compactSessionWithTwoPhases(sessionId, originalQuery);
|
|
8187
8187
|
}
|
|
8188
|
-
constructQueryWithCheckpoint(
|
|
8189
|
-
const
|
|
8190
|
-
|
|
8191
|
-
|
|
8192
|
-
|
|
8193
|
-
|
|
8194
|
-
parts.push("【已完成的工作】");
|
|
8195
|
-
checkpoint.processKeyPoints.forEach((point, i) => {
|
|
8196
|
-
parts.push(`${i + 1}. ${point}`);
|
|
8197
|
-
});
|
|
8198
|
-
}
|
|
8199
|
-
if (checkpoint.currentState) {
|
|
8200
|
-
parts.push("");
|
|
8201
|
-
parts.push("【当前状态】");
|
|
8202
|
-
parts.push(checkpoint.currentState);
|
|
8203
|
-
}
|
|
8204
|
-
if (checkpoint.nextSteps.length > 0) {
|
|
8205
|
-
parts.push("");
|
|
8206
|
-
parts.push("【待完成的任务】");
|
|
8207
|
-
checkpoint.nextSteps.forEach((step, i) => {
|
|
8208
|
-
parts.push(`${i + 1}. ${step}`);
|
|
8209
|
-
});
|
|
8210
|
-
}
|
|
8211
|
-
if (originalQuery) {
|
|
8212
|
-
parts.push("");
|
|
8213
|
-
parts.push("【用户新输入】");
|
|
8214
|
-
parts.push(originalQuery);
|
|
8188
|
+
constructQueryWithCheckpoint(_checkpoint, originalQuery) {
|
|
8189
|
+
const MAX_QUERY_LENGTH = 4000;
|
|
8190
|
+
if (originalQuery && originalQuery.trim().length > 0) {
|
|
8191
|
+
const trimmedQuery = originalQuery.length > MAX_QUERY_LENGTH ? originalQuery.substring(0, MAX_QUERY_LENGTH) + `
|
|
8192
|
+
... (原始输入共 ${originalQuery.length} 字符,已截断至 ${MAX_QUERY_LENGTH})` : originalQuery;
|
|
8193
|
+
return trimmedQuery;
|
|
8215
8194
|
}
|
|
8216
|
-
return
|
|
8217
|
-
`);
|
|
8195
|
+
return "Please continue to work on the current task.";
|
|
8218
8196
|
}
|
|
8219
8197
|
}
|
|
8220
8198
|
__legacyDecorateClassTS([
|
|
@@ -8532,10 +8510,6 @@ function createActCommand(externalEnvService) {
|
|
|
8532
8510
|
output.error("Environment not available");
|
|
8533
8511
|
process.exit(1);
|
|
8534
8512
|
}
|
|
8535
|
-
const promptComponent = env.getComponent("prompt");
|
|
8536
|
-
if (llmComponent && promptComponent) {
|
|
8537
|
-
sessionComponent.setSummaryComponents(promptComponent, llmComponent);
|
|
8538
|
-
}
|
|
8539
8513
|
if (coderPluginNames.includes("lsp")) {
|
|
8540
8514
|
try {
|
|
8541
8515
|
const enabledPlugins = coderPluginNames.filter((p) => CODER_HARNESS_PLUGINS.has(p.split(":")[0]));
|
|
@@ -8803,9 +8777,7 @@ class QueryExecutor {
|
|
|
8803
8777
|
this.output = options.output;
|
|
8804
8778
|
this.quiet = options.quiet;
|
|
8805
8779
|
}
|
|
8806
|
-
initSummaryAgent(
|
|
8807
|
-
this.sessionComponent.setSummaryComponents(promptComponent, llmComponent);
|
|
8808
|
-
}
|
|
8780
|
+
initSummaryAgent(_llmComponent, _promptComponent) {}
|
|
8809
8781
|
initStreamOutput(llmComponent, providerId = "minimax") {
|
|
8810
8782
|
if (llmComponent) {
|
|
8811
8783
|
const contextConfig = llmComponent.getContextThresholdConfig(providerId);
|
|
@@ -10012,9 +9984,6 @@ function createInteractiveCommand(externalEnvService) {
|
|
|
10012
9984
|
});
|
|
10013
9985
|
const sessionResult = await sessionManager.init(args.session, args.continue);
|
|
10014
9986
|
const { sessionId, sessionTitle } = sessionResult;
|
|
10015
|
-
if (llmComponent && promptComponent) {
|
|
10016
|
-
sessionComponent.setSummaryComponents(promptComponent, llmComponent);
|
|
10017
|
-
}
|
|
10018
9987
|
const queryExecutor = new QueryExecutor({
|
|
10019
9988
|
env,
|
|
10020
9989
|
sessionComponent,
|
|
@@ -11049,9 +11018,7 @@ var CompactCommand = {
|
|
|
11049
11018
|
}
|
|
11050
11019
|
const llmComponent = env.getComponent("llm");
|
|
11051
11020
|
const promptComponent = env.getComponent("prompt");
|
|
11052
|
-
if (llmComponent
|
|
11053
|
-
sessionComponent.setSummaryComponents(promptComponent, llmComponent);
|
|
11054
|
-
} else {
|
|
11021
|
+
if (!llmComponent || !promptComponent) {
|
|
11055
11022
|
output.error("LLMComponent or PromptComponent not available. Cannot generate checkpoint.");
|
|
11056
11023
|
process.exit(1);
|
|
11057
11024
|
}
|
|
@@ -18006,10 +17973,10 @@ class WorkflowValidator {
|
|
|
18006
17973
|
}
|
|
18007
17974
|
|
|
18008
17975
|
// src/commands/workflow/commands/add.ts
|
|
17976
|
+
import { validateWorkflowDefinition } from "@ai-setting/roy-agent-core/env/workflow/utils/validate-workflow-definition";
|
|
18009
17977
|
import chalk63 from "chalk";
|
|
18010
17978
|
import fs3 from "fs";
|
|
18011
17979
|
import path6 from "path";
|
|
18012
|
-
import { createWorkflowExtractorAgent } from "@ai-setting/roy-agent-core/env/task/plugins";
|
|
18013
17980
|
async function parseWorkflowContent(content, filename) {
|
|
18014
17981
|
const isYaml = filename.endsWith(".yaml") || filename.endsWith(".yml");
|
|
18015
17982
|
const isJson = filename.endsWith(".json");
|
|
@@ -18150,6 +18117,15 @@ var WorkflowAddCommand = {
|
|
|
18150
18117
|
workflowName = a.name || definition.name || path6.basename(filePath);
|
|
18151
18118
|
if (a.validate) {
|
|
18152
18119
|
output.log(chalk63.blue("\uD83D\uDD0D Validating workflow..."));
|
|
18120
|
+
const dagResult = validateWorkflowDefinition(definition);
|
|
18121
|
+
if (!dagResult.valid) {
|
|
18122
|
+
output.error(`
|
|
18123
|
+
❌ Workflow validation FAILED (${dagResult.errors.length} errors found)`);
|
|
18124
|
+
dagResult.errors.forEach((msg, i) => {
|
|
18125
|
+
output.error(`[Error ${i + 1}/${dagResult.errors.length}] ${msg}`);
|
|
18126
|
+
});
|
|
18127
|
+
process.exit(1);
|
|
18128
|
+
}
|
|
18153
18129
|
const validator = new WorkflowValidator;
|
|
18154
18130
|
const result = validator.validate(definition);
|
|
18155
18131
|
if (!result.valid) {
|
|
@@ -18175,12 +18151,9 @@ var WorkflowAddCommand = {
|
|
|
18175
18151
|
output.error("AgentComponent not available");
|
|
18176
18152
|
process.exit(1);
|
|
18177
18153
|
}
|
|
18178
|
-
if (!agentComponent.getAgent("workflow-
|
|
18179
|
-
output.
|
|
18180
|
-
|
|
18181
|
-
agentComponent.registerAgent(extractorConfig.name, extractorConfig);
|
|
18182
|
-
output.log(chalk63.green(`✅ workflow-extractor agent registered
|
|
18183
|
-
`));
|
|
18154
|
+
if (!agentComponent.getAgent("workflow-extract")) {
|
|
18155
|
+
output.error("Built-in 'workflow-extract' agent is not available. This usually means the environment was not fully initialized.");
|
|
18156
|
+
process.exit(1);
|
|
18184
18157
|
}
|
|
18185
18158
|
const prompt = `## 任务
|
|
18186
18159
|
请根据以下描述,构建一个可复用的 Workflow。
|
|
@@ -18193,8 +18166,8 @@ ${a.desc}
|
|
|
18193
18166
|
1. 先用 \`roy-agent workflow nodes\` 查看可用的节点类型
|
|
18194
18167
|
2. 生成的 YAML 必须通过 \`roy-agent workflow validate --yaml "<yaml>"\` 验证
|
|
18195
18168
|
3. 验证通过后才输出最终 YAML`;
|
|
18196
|
-
output.log(chalk63.gray("Running workflow-
|
|
18197
|
-
const result = await agentComponent.run("workflow-
|
|
18169
|
+
output.log(chalk63.gray("Running workflow-extract agent..."));
|
|
18170
|
+
const result = await agentComponent.run("workflow-extract", prompt);
|
|
18198
18171
|
const agentOutput = result.finalText || "";
|
|
18199
18172
|
definition = parseYamlFromAgentOutput(agentOutput);
|
|
18200
18173
|
if (definition === null) {
|
|
@@ -18208,6 +18181,16 @@ Agent output:
|
|
|
18208
18181
|
if (a.validate) {
|
|
18209
18182
|
output.log(chalk63.blue(`
|
|
18210
18183
|
\uD83D\uDD0D Validating generated workflow...`));
|
|
18184
|
+
const dagResult = validateWorkflowDefinition(definition);
|
|
18185
|
+
if (!dagResult.valid) {
|
|
18186
|
+
output.error(`
|
|
18187
|
+
❌ Generated workflow validation FAILED (${dagResult.errors.length} errors found)`);
|
|
18188
|
+
dagResult.errors.forEach((msg, i) => {
|
|
18189
|
+
output.error(`[Error ${i + 1}/${dagResult.errors.length}] ${msg}`);
|
|
18190
|
+
});
|
|
18191
|
+
output.log(chalk63.yellow("请修正描述后重新尝试,或使用 --file 选项直接提供 YAML"));
|
|
18192
|
+
process.exit(1);
|
|
18193
|
+
}
|
|
18211
18194
|
const validator = new WorkflowValidator;
|
|
18212
18195
|
const result2 = validator.validate(definition);
|
|
18213
18196
|
if (!result2.valid) {
|
package/dist/index.js
CHANGED
|
@@ -7319,7 +7319,7 @@ var require_dist = __commonJS((exports) => {
|
|
|
7319
7319
|
var require_package = __commonJS((exports, module) => {
|
|
7320
7320
|
module.exports = {
|
|
7321
7321
|
name: "@ai-setting/roy-agent-cli",
|
|
7322
|
-
version: "1.5.
|
|
7322
|
+
version: "1.5.90",
|
|
7323
7323
|
type: "module",
|
|
7324
7324
|
description: "CLI for roy-agent - Non-interactive command execution",
|
|
7325
7325
|
main: "./dist/index.js",
|
|
@@ -8091,8 +8091,8 @@ class ContextHandlerService {
|
|
|
8091
8091
|
}
|
|
8092
8092
|
throw error;
|
|
8093
8093
|
}
|
|
8094
|
-
if (!compactResult.newQuery
|
|
8095
|
-
logger3.error("Compact succeeded but produced
|
|
8094
|
+
if (!compactResult.newQuery) {
|
|
8095
|
+
logger3.error("Compact succeeded but produced undefined query, terminating", {
|
|
8096
8096
|
compactCount,
|
|
8097
8097
|
query
|
|
8098
8098
|
});
|
|
@@ -8184,36 +8184,14 @@ class ContextHandlerService {
|
|
|
8184
8184
|
async compactSession(sessionId, originalQuery) {
|
|
8185
8185
|
return this.compactSessionWithTwoPhases(sessionId, originalQuery);
|
|
8186
8186
|
}
|
|
8187
|
-
constructQueryWithCheckpoint(
|
|
8188
|
-
const
|
|
8189
|
-
|
|
8190
|
-
|
|
8191
|
-
|
|
8192
|
-
|
|
8193
|
-
parts.push("【已完成的工作】");
|
|
8194
|
-
checkpoint.processKeyPoints.forEach((point, i) => {
|
|
8195
|
-
parts.push(`${i + 1}. ${point}`);
|
|
8196
|
-
});
|
|
8197
|
-
}
|
|
8198
|
-
if (checkpoint.currentState) {
|
|
8199
|
-
parts.push("");
|
|
8200
|
-
parts.push("【当前状态】");
|
|
8201
|
-
parts.push(checkpoint.currentState);
|
|
8202
|
-
}
|
|
8203
|
-
if (checkpoint.nextSteps.length > 0) {
|
|
8204
|
-
parts.push("");
|
|
8205
|
-
parts.push("【待完成的任务】");
|
|
8206
|
-
checkpoint.nextSteps.forEach((step, i) => {
|
|
8207
|
-
parts.push(`${i + 1}. ${step}`);
|
|
8208
|
-
});
|
|
8209
|
-
}
|
|
8210
|
-
if (originalQuery) {
|
|
8211
|
-
parts.push("");
|
|
8212
|
-
parts.push("【用户新输入】");
|
|
8213
|
-
parts.push(originalQuery);
|
|
8187
|
+
constructQueryWithCheckpoint(_checkpoint, originalQuery) {
|
|
8188
|
+
const MAX_QUERY_LENGTH = 4000;
|
|
8189
|
+
if (originalQuery && originalQuery.trim().length > 0) {
|
|
8190
|
+
const trimmedQuery = originalQuery.length > MAX_QUERY_LENGTH ? originalQuery.substring(0, MAX_QUERY_LENGTH) + `
|
|
8191
|
+
... (原始输入共 ${originalQuery.length} 字符,已截断至 ${MAX_QUERY_LENGTH})` : originalQuery;
|
|
8192
|
+
return trimmedQuery;
|
|
8214
8193
|
}
|
|
8215
|
-
return
|
|
8216
|
-
`);
|
|
8194
|
+
return "Please continue to work on the current task.";
|
|
8217
8195
|
}
|
|
8218
8196
|
}
|
|
8219
8197
|
__legacyDecorateClassTS([
|
|
@@ -8531,10 +8509,6 @@ function createActCommand(externalEnvService) {
|
|
|
8531
8509
|
output.error("Environment not available");
|
|
8532
8510
|
process.exit(1);
|
|
8533
8511
|
}
|
|
8534
|
-
const promptComponent = env.getComponent("prompt");
|
|
8535
|
-
if (llmComponent && promptComponent) {
|
|
8536
|
-
sessionComponent.setSummaryComponents(promptComponent, llmComponent);
|
|
8537
|
-
}
|
|
8538
8512
|
if (coderPluginNames.includes("lsp")) {
|
|
8539
8513
|
try {
|
|
8540
8514
|
const enabledPlugins = coderPluginNames.filter((p) => CODER_HARNESS_PLUGINS.has(p.split(":")[0]));
|
|
@@ -8802,9 +8776,7 @@ class QueryExecutor {
|
|
|
8802
8776
|
this.output = options.output;
|
|
8803
8777
|
this.quiet = options.quiet;
|
|
8804
8778
|
}
|
|
8805
|
-
initSummaryAgent(
|
|
8806
|
-
this.sessionComponent.setSummaryComponents(promptComponent, llmComponent);
|
|
8807
|
-
}
|
|
8779
|
+
initSummaryAgent(_llmComponent, _promptComponent) {}
|
|
8808
8780
|
initStreamOutput(llmComponent, providerId = "minimax") {
|
|
8809
8781
|
if (llmComponent) {
|
|
8810
8782
|
const contextConfig = llmComponent.getContextThresholdConfig(providerId);
|
|
@@ -10011,9 +9983,6 @@ function createInteractiveCommand(externalEnvService) {
|
|
|
10011
9983
|
});
|
|
10012
9984
|
const sessionResult = await sessionManager.init(args.session, args.continue);
|
|
10013
9985
|
const { sessionId, sessionTitle } = sessionResult;
|
|
10014
|
-
if (llmComponent && promptComponent) {
|
|
10015
|
-
sessionComponent.setSummaryComponents(promptComponent, llmComponent);
|
|
10016
|
-
}
|
|
10017
9986
|
const queryExecutor = new QueryExecutor({
|
|
10018
9987
|
env,
|
|
10019
9988
|
sessionComponent,
|
|
@@ -11048,9 +11017,7 @@ var CompactCommand = {
|
|
|
11048
11017
|
}
|
|
11049
11018
|
const llmComponent = env.getComponent("llm");
|
|
11050
11019
|
const promptComponent = env.getComponent("prompt");
|
|
11051
|
-
if (llmComponent
|
|
11052
|
-
sessionComponent.setSummaryComponents(promptComponent, llmComponent);
|
|
11053
|
-
} else {
|
|
11020
|
+
if (!llmComponent || !promptComponent) {
|
|
11054
11021
|
output.error("LLMComponent or PromptComponent not available. Cannot generate checkpoint.");
|
|
11055
11022
|
process.exit(1);
|
|
11056
11023
|
}
|
|
@@ -18005,10 +17972,10 @@ class WorkflowValidator {
|
|
|
18005
17972
|
}
|
|
18006
17973
|
|
|
18007
17974
|
// src/commands/workflow/commands/add.ts
|
|
17975
|
+
import { validateWorkflowDefinition } from "@ai-setting/roy-agent-core/env/workflow/utils/validate-workflow-definition";
|
|
18008
17976
|
import chalk63 from "chalk";
|
|
18009
17977
|
import fs3 from "fs";
|
|
18010
17978
|
import path6 from "path";
|
|
18011
|
-
import { createWorkflowExtractorAgent } from "@ai-setting/roy-agent-core/env/task/plugins";
|
|
18012
17979
|
async function parseWorkflowContent(content, filename) {
|
|
18013
17980
|
const isYaml = filename.endsWith(".yaml") || filename.endsWith(".yml");
|
|
18014
17981
|
const isJson = filename.endsWith(".json");
|
|
@@ -18149,6 +18116,15 @@ var WorkflowAddCommand = {
|
|
|
18149
18116
|
workflowName = a.name || definition.name || path6.basename(filePath);
|
|
18150
18117
|
if (a.validate) {
|
|
18151
18118
|
output.log(chalk63.blue("\uD83D\uDD0D Validating workflow..."));
|
|
18119
|
+
const dagResult = validateWorkflowDefinition(definition);
|
|
18120
|
+
if (!dagResult.valid) {
|
|
18121
|
+
output.error(`
|
|
18122
|
+
❌ Workflow validation FAILED (${dagResult.errors.length} errors found)`);
|
|
18123
|
+
dagResult.errors.forEach((msg, i) => {
|
|
18124
|
+
output.error(`[Error ${i + 1}/${dagResult.errors.length}] ${msg}`);
|
|
18125
|
+
});
|
|
18126
|
+
process.exit(1);
|
|
18127
|
+
}
|
|
18152
18128
|
const validator = new WorkflowValidator;
|
|
18153
18129
|
const result = validator.validate(definition);
|
|
18154
18130
|
if (!result.valid) {
|
|
@@ -18174,12 +18150,9 @@ var WorkflowAddCommand = {
|
|
|
18174
18150
|
output.error("AgentComponent not available");
|
|
18175
18151
|
process.exit(1);
|
|
18176
18152
|
}
|
|
18177
|
-
if (!agentComponent.getAgent("workflow-
|
|
18178
|
-
output.
|
|
18179
|
-
|
|
18180
|
-
agentComponent.registerAgent(extractorConfig.name, extractorConfig);
|
|
18181
|
-
output.log(chalk63.green(`✅ workflow-extractor agent registered
|
|
18182
|
-
`));
|
|
18153
|
+
if (!agentComponent.getAgent("workflow-extract")) {
|
|
18154
|
+
output.error("Built-in 'workflow-extract' agent is not available. This usually means the environment was not fully initialized.");
|
|
18155
|
+
process.exit(1);
|
|
18183
18156
|
}
|
|
18184
18157
|
const prompt = `## 任务
|
|
18185
18158
|
请根据以下描述,构建一个可复用的 Workflow。
|
|
@@ -18192,8 +18165,8 @@ ${a.desc}
|
|
|
18192
18165
|
1. 先用 \`roy-agent workflow nodes\` 查看可用的节点类型
|
|
18193
18166
|
2. 生成的 YAML 必须通过 \`roy-agent workflow validate --yaml "<yaml>"\` 验证
|
|
18194
18167
|
3. 验证通过后才输出最终 YAML`;
|
|
18195
|
-
output.log(chalk63.gray("Running workflow-
|
|
18196
|
-
const result = await agentComponent.run("workflow-
|
|
18168
|
+
output.log(chalk63.gray("Running workflow-extract agent..."));
|
|
18169
|
+
const result = await agentComponent.run("workflow-extract", prompt);
|
|
18197
18170
|
const agentOutput = result.finalText || "";
|
|
18198
18171
|
definition = parseYamlFromAgentOutput(agentOutput);
|
|
18199
18172
|
if (definition === null) {
|
|
@@ -18207,6 +18180,16 @@ Agent output:
|
|
|
18207
18180
|
if (a.validate) {
|
|
18208
18181
|
output.log(chalk63.blue(`
|
|
18209
18182
|
\uD83D\uDD0D Validating generated workflow...`));
|
|
18183
|
+
const dagResult = validateWorkflowDefinition(definition);
|
|
18184
|
+
if (!dagResult.valid) {
|
|
18185
|
+
output.error(`
|
|
18186
|
+
❌ Generated workflow validation FAILED (${dagResult.errors.length} errors found)`);
|
|
18187
|
+
dagResult.errors.forEach((msg, i) => {
|
|
18188
|
+
output.error(`[Error ${i + 1}/${dagResult.errors.length}] ${msg}`);
|
|
18189
|
+
});
|
|
18190
|
+
output.log(chalk63.yellow("请修正描述后重新尝试,或使用 --file 选项直接提供 YAML"));
|
|
18191
|
+
process.exit(1);
|
|
18192
|
+
}
|
|
18210
18193
|
const validator = new WorkflowValidator;
|
|
18211
18194
|
const result2 = validator.validate(definition);
|
|
18212
18195
|
if (!result2.valid) {
|
|
Binary file
|