@ai-setting/roy-agent-cli 1.6.2 → 1.6.4
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 +39 -15
- package/dist/index.js +39 -15
- package/dist/roy-agent-linux-x64/bin/roy-agent +0 -0
- package/package.json +1 -1
package/dist/bin/roy-agent.js
CHANGED
|
@@ -207,9 +207,8 @@ ${COLORS.system("[已中断]")}
|
|
|
207
207
|
process.stdout.write(COLORS.reasoning(delta));
|
|
208
208
|
return;
|
|
209
209
|
}
|
|
210
|
-
if (this.reasoningClosedByText)
|
|
211
|
-
|
|
212
|
-
}
|
|
210
|
+
if (this.reasoningClosedByText)
|
|
211
|
+
return;
|
|
213
212
|
this.reasoningBuffer += delta;
|
|
214
213
|
if (this.reasoningBuffer.length >= 15) {
|
|
215
214
|
this.flushReasoningBuffer();
|
|
@@ -7407,7 +7406,7 @@ var require_dist = __commonJS((exports) => {
|
|
|
7407
7406
|
var require_package = __commonJS((exports, module) => {
|
|
7408
7407
|
module.exports = {
|
|
7409
7408
|
name: "@ai-setting/roy-agent-cli",
|
|
7410
|
-
version: "1.6.
|
|
7409
|
+
version: "1.6.4",
|
|
7411
7410
|
type: "module",
|
|
7412
7411
|
description: "CLI for roy-agent - Non-interactive command execution",
|
|
7413
7412
|
main: "./dist/index.js",
|
|
@@ -9016,7 +9015,12 @@ class QueryExecutor {
|
|
|
9016
9015
|
this.output = options.output;
|
|
9017
9016
|
this.quiet = options.quiet;
|
|
9018
9017
|
}
|
|
9019
|
-
initSummaryAgent(
|
|
9018
|
+
initSummaryAgent(llmComponent, promptComponent) {
|
|
9019
|
+
const session = this.sessionComponent;
|
|
9020
|
+
if (typeof session.setSummaryComponents === "function") {
|
|
9021
|
+
session.setSummaryComponents(promptComponent, llmComponent);
|
|
9022
|
+
}
|
|
9023
|
+
}
|
|
9020
9024
|
initStreamOutput(llmComponent, providerId = "minimax") {
|
|
9021
9025
|
if (llmComponent) {
|
|
9022
9026
|
const contextConfig = llmComponent.getContextThresholdConfig(providerId);
|
|
@@ -10616,6 +10620,11 @@ function createInteractiveCommand(externalEnvService) {
|
|
|
10616
10620
|
}).option("model", {
|
|
10617
10621
|
describe: "使用的模型",
|
|
10618
10622
|
type: "string"
|
|
10623
|
+
}).option("default-agent-name", {
|
|
10624
|
+
alias: "dan",
|
|
10625
|
+
describe: "Default agent 名字(默认 Roy,可被覆盖)",
|
|
10626
|
+
type: "string",
|
|
10627
|
+
default: "Roy"
|
|
10619
10628
|
}),
|
|
10620
10629
|
async handler(args) {
|
|
10621
10630
|
CliQuietModeService.getInstance().setQuiet(true);
|
|
@@ -10785,7 +10794,12 @@ function createInteractiveCommand(externalEnvService) {
|
|
|
10785
10794
|
...currentAgentContext,
|
|
10786
10795
|
model: args.model,
|
|
10787
10796
|
...agentContext,
|
|
10788
|
-
eventSourceSystemPrompt
|
|
10797
|
+
eventSourceSystemPrompt,
|
|
10798
|
+
metadata: {
|
|
10799
|
+
...currentAgentContext?.metadata ?? {},
|
|
10800
|
+
...agentContext?.metadata ?? {},
|
|
10801
|
+
defaultAgentName: args.defaultAgentName
|
|
10802
|
+
}
|
|
10789
10803
|
};
|
|
10790
10804
|
const effectiveSessionId = mergedContext.eventSessionId ?? sessionId;
|
|
10791
10805
|
const result = await queryExecutor.execute(message, effectiveSessionId, {
|
|
@@ -13359,7 +13373,7 @@ var UpdateCommand = {
|
|
|
13359
13373
|
type: "number",
|
|
13360
13374
|
describe: "任务 ID",
|
|
13361
13375
|
demandOption: true
|
|
13362
|
-
}).option("title", { alias: "t", type: "string", description: "标题" }).option("description", { alias: "d", type: "string", description: "描述" }).option("status", { alias: "s", type: "string", choices: ["todo", "active", "completed", "paused", "cancelled"], description: "状态" }).option("priority", { alias: "p", type: "string", choices: ["low", "medium", "high"], description: "优先级" }).option("type", { type: "string", choices: ["normal", "cycle", "longterm"], description: "任务类型 (normal/cycle/longterm)" }).option("progress", { type: "number", min: 0, max: 100, description: "进度 (0-100)" }).option("current_status", { alias: "c", type: "string", description: "当前状态描述" }).option("project-path", { type: "string", description: "项目路径" }).option("context", { type: "string", description: "任务上下文 (JSON 字符串)" }).option("json", { alias: "j", type: "boolean", default: false, description: "JSON 输出" }),
|
|
13376
|
+
}).option("title", { alias: "t", type: "string", description: "标题" }).option("description", { alias: "d", type: "string", description: "描述" }).option("status", { alias: "s", type: "string", choices: ["todo", "active", "completed", "paused", "cancelled"], description: "状态" }).option("priority", { alias: "p", type: "string", choices: ["low", "medium", "high"], description: "优先级" }).option("type", { type: "string", choices: ["normal", "cycle", "longterm"], description: "任务类型 (normal/cycle/longterm)" }).option("progress", { type: "number", min: 0, max: 100, description: "进度 (0-100)" }).option("current_status", { alias: "c", type: "string", description: "当前状态描述" }).option("project-path", { type: "string", description: "项目路径" }).option("context", { type: "string", description: "任务上下文 (JSON 字符串)" }).option("parent-id", { type: "number", description: "父任务 ID(不传则保持原父任务;传 null 可提升为根任务)" }).option("json", { alias: "j", type: "boolean", default: false, description: "JSON 输出" }),
|
|
13363
13377
|
async handler(args) {
|
|
13364
13378
|
const output = new OutputService2;
|
|
13365
13379
|
const envService = new EnvironmentService(output);
|
|
@@ -13377,6 +13391,7 @@ var UpdateCommand = {
|
|
|
13377
13391
|
process.exit(1);
|
|
13378
13392
|
}
|
|
13379
13393
|
const currentSessionId = sessionComponent?.getActiveSessionId() || "cli";
|
|
13394
|
+
const parentTaskId = Object.prototype.hasOwnProperty.call(args, "parent-id") ? args["parent-id"] : undefined;
|
|
13380
13395
|
const updateOptions = {
|
|
13381
13396
|
title: args.title,
|
|
13382
13397
|
description: args.description,
|
|
@@ -13386,7 +13401,8 @@ var UpdateCommand = {
|
|
|
13386
13401
|
progress: args.progress,
|
|
13387
13402
|
current_status: args.current_status,
|
|
13388
13403
|
project_path: args["project-path"],
|
|
13389
|
-
context: args.context
|
|
13404
|
+
context: args.context,
|
|
13405
|
+
parent_task_id: parentTaskId
|
|
13390
13406
|
};
|
|
13391
13407
|
const task = await taskComponent.updateTask(args.id, updateOptions);
|
|
13392
13408
|
if (!task) {
|
|
@@ -21620,7 +21636,15 @@ function savePlugins(plugins, scope) {
|
|
|
21620
21636
|
const config = { plugins };
|
|
21621
21637
|
writeFileSync(configPath, JSON.stringify(config, null, 2), "utf-8");
|
|
21622
21638
|
}
|
|
21639
|
+
function stripVersionSpec(packageName) {
|
|
21640
|
+
const atIdx = packageName.lastIndexOf("@");
|
|
21641
|
+
if (atIdx > 0) {
|
|
21642
|
+
return packageName.substring(0, atIdx);
|
|
21643
|
+
}
|
|
21644
|
+
return packageName;
|
|
21645
|
+
}
|
|
21623
21646
|
function readPackageInfo(packageName) {
|
|
21647
|
+
const bareName = packageName.startsWith("/") || packageName.startsWith(".") ? packageName : stripVersionSpec(packageName);
|
|
21624
21648
|
if (packageName.startsWith("/") || packageName.startsWith(".")) {
|
|
21625
21649
|
const localPkgPath = join4(packageName, "package.json");
|
|
21626
21650
|
if (existsSync3(localPkgPath)) {
|
|
@@ -21637,13 +21661,13 @@ function readPackageInfo(packageName) {
|
|
|
21637
21661
|
}
|
|
21638
21662
|
}
|
|
21639
21663
|
const searchPaths = [
|
|
21640
|
-
join4(process.cwd(), "node_modules",
|
|
21641
|
-
resolve(process.cwd(), "..", "node_modules",
|
|
21642
|
-
join4(process.cwd(), ".roy", "plugins",
|
|
21643
|
-
join4(homedir3(), ".roy-agent", "node_modules",
|
|
21664
|
+
join4(process.cwd(), "node_modules", bareName, "package.json"),
|
|
21665
|
+
resolve(process.cwd(), "..", "node_modules", bareName, "package.json"),
|
|
21666
|
+
join4(process.cwd(), ".roy", "plugins", bareName, "package.json"),
|
|
21667
|
+
join4(homedir3(), ".roy-agent", "node_modules", bareName, "package.json"),
|
|
21644
21668
|
...(() => {
|
|
21645
21669
|
const globalRoot = getNpmGlobalRoot();
|
|
21646
|
-
return globalRoot ? [join4(globalRoot,
|
|
21670
|
+
return globalRoot ? [join4(globalRoot, bareName, "package.json")] : [];
|
|
21647
21671
|
})()
|
|
21648
21672
|
];
|
|
21649
21673
|
for (const pkgPath of searchPaths) {
|
|
@@ -21652,7 +21676,7 @@ function readPackageInfo(packageName) {
|
|
|
21652
21676
|
const pkg = JSON.parse(readFileSync2(pkgPath, "utf-8"));
|
|
21653
21677
|
return {
|
|
21654
21678
|
version: pkg.version ?? "0.0.0",
|
|
21655
|
-
name: pkg.name ??
|
|
21679
|
+
name: pkg.name ?? bareName,
|
|
21656
21680
|
description: pkg.description
|
|
21657
21681
|
};
|
|
21658
21682
|
}
|
|
@@ -21785,7 +21809,7 @@ var InstallPackageCommand = {
|
|
|
21785
21809
|
}
|
|
21786
21810
|
resolvedGlobalName = info2.name;
|
|
21787
21811
|
} else {
|
|
21788
|
-
resolvedGlobalName = packageName;
|
|
21812
|
+
resolvedGlobalName = stripVersionSpec(packageName);
|
|
21789
21813
|
}
|
|
21790
21814
|
const result = spawnSync("npm", ["install", "-g", packageName], {
|
|
21791
21815
|
stdio: "inherit",
|
package/dist/index.js
CHANGED
|
@@ -206,9 +206,8 @@ ${COLORS.system("[已中断]")}
|
|
|
206
206
|
process.stdout.write(COLORS.reasoning(delta));
|
|
207
207
|
return;
|
|
208
208
|
}
|
|
209
|
-
if (this.reasoningClosedByText)
|
|
210
|
-
|
|
211
|
-
}
|
|
209
|
+
if (this.reasoningClosedByText)
|
|
210
|
+
return;
|
|
212
211
|
this.reasoningBuffer += delta;
|
|
213
212
|
if (this.reasoningBuffer.length >= 15) {
|
|
214
213
|
this.flushReasoningBuffer();
|
|
@@ -7406,7 +7405,7 @@ var require_dist = __commonJS((exports) => {
|
|
|
7406
7405
|
var require_package = __commonJS((exports, module) => {
|
|
7407
7406
|
module.exports = {
|
|
7408
7407
|
name: "@ai-setting/roy-agent-cli",
|
|
7409
|
-
version: "1.6.
|
|
7408
|
+
version: "1.6.4",
|
|
7410
7409
|
type: "module",
|
|
7411
7410
|
description: "CLI for roy-agent - Non-interactive command execution",
|
|
7412
7411
|
main: "./dist/index.js",
|
|
@@ -9015,7 +9014,12 @@ class QueryExecutor {
|
|
|
9015
9014
|
this.output = options.output;
|
|
9016
9015
|
this.quiet = options.quiet;
|
|
9017
9016
|
}
|
|
9018
|
-
initSummaryAgent(
|
|
9017
|
+
initSummaryAgent(llmComponent, promptComponent) {
|
|
9018
|
+
const session = this.sessionComponent;
|
|
9019
|
+
if (typeof session.setSummaryComponents === "function") {
|
|
9020
|
+
session.setSummaryComponents(promptComponent, llmComponent);
|
|
9021
|
+
}
|
|
9022
|
+
}
|
|
9019
9023
|
initStreamOutput(llmComponent, providerId = "minimax") {
|
|
9020
9024
|
if (llmComponent) {
|
|
9021
9025
|
const contextConfig = llmComponent.getContextThresholdConfig(providerId);
|
|
@@ -10615,6 +10619,11 @@ function createInteractiveCommand(externalEnvService) {
|
|
|
10615
10619
|
}).option("model", {
|
|
10616
10620
|
describe: "使用的模型",
|
|
10617
10621
|
type: "string"
|
|
10622
|
+
}).option("default-agent-name", {
|
|
10623
|
+
alias: "dan",
|
|
10624
|
+
describe: "Default agent 名字(默认 Roy,可被覆盖)",
|
|
10625
|
+
type: "string",
|
|
10626
|
+
default: "Roy"
|
|
10618
10627
|
}),
|
|
10619
10628
|
async handler(args) {
|
|
10620
10629
|
CliQuietModeService.getInstance().setQuiet(true);
|
|
@@ -10784,7 +10793,12 @@ function createInteractiveCommand(externalEnvService) {
|
|
|
10784
10793
|
...currentAgentContext,
|
|
10785
10794
|
model: args.model,
|
|
10786
10795
|
...agentContext,
|
|
10787
|
-
eventSourceSystemPrompt
|
|
10796
|
+
eventSourceSystemPrompt,
|
|
10797
|
+
metadata: {
|
|
10798
|
+
...currentAgentContext?.metadata ?? {},
|
|
10799
|
+
...agentContext?.metadata ?? {},
|
|
10800
|
+
defaultAgentName: args.defaultAgentName
|
|
10801
|
+
}
|
|
10788
10802
|
};
|
|
10789
10803
|
const effectiveSessionId = mergedContext.eventSessionId ?? sessionId;
|
|
10790
10804
|
const result = await queryExecutor.execute(message, effectiveSessionId, {
|
|
@@ -13358,7 +13372,7 @@ var UpdateCommand = {
|
|
|
13358
13372
|
type: "number",
|
|
13359
13373
|
describe: "任务 ID",
|
|
13360
13374
|
demandOption: true
|
|
13361
|
-
}).option("title", { alias: "t", type: "string", description: "标题" }).option("description", { alias: "d", type: "string", description: "描述" }).option("status", { alias: "s", type: "string", choices: ["todo", "active", "completed", "paused", "cancelled"], description: "状态" }).option("priority", { alias: "p", type: "string", choices: ["low", "medium", "high"], description: "优先级" }).option("type", { type: "string", choices: ["normal", "cycle", "longterm"], description: "任务类型 (normal/cycle/longterm)" }).option("progress", { type: "number", min: 0, max: 100, description: "进度 (0-100)" }).option("current_status", { alias: "c", type: "string", description: "当前状态描述" }).option("project-path", { type: "string", description: "项目路径" }).option("context", { type: "string", description: "任务上下文 (JSON 字符串)" }).option("json", { alias: "j", type: "boolean", default: false, description: "JSON 输出" }),
|
|
13375
|
+
}).option("title", { alias: "t", type: "string", description: "标题" }).option("description", { alias: "d", type: "string", description: "描述" }).option("status", { alias: "s", type: "string", choices: ["todo", "active", "completed", "paused", "cancelled"], description: "状态" }).option("priority", { alias: "p", type: "string", choices: ["low", "medium", "high"], description: "优先级" }).option("type", { type: "string", choices: ["normal", "cycle", "longterm"], description: "任务类型 (normal/cycle/longterm)" }).option("progress", { type: "number", min: 0, max: 100, description: "进度 (0-100)" }).option("current_status", { alias: "c", type: "string", description: "当前状态描述" }).option("project-path", { type: "string", description: "项目路径" }).option("context", { type: "string", description: "任务上下文 (JSON 字符串)" }).option("parent-id", { type: "number", description: "父任务 ID(不传则保持原父任务;传 null 可提升为根任务)" }).option("json", { alias: "j", type: "boolean", default: false, description: "JSON 输出" }),
|
|
13362
13376
|
async handler(args) {
|
|
13363
13377
|
const output = new OutputService2;
|
|
13364
13378
|
const envService = new EnvironmentService(output);
|
|
@@ -13376,6 +13390,7 @@ var UpdateCommand = {
|
|
|
13376
13390
|
process.exit(1);
|
|
13377
13391
|
}
|
|
13378
13392
|
const currentSessionId = sessionComponent?.getActiveSessionId() || "cli";
|
|
13393
|
+
const parentTaskId = Object.prototype.hasOwnProperty.call(args, "parent-id") ? args["parent-id"] : undefined;
|
|
13379
13394
|
const updateOptions = {
|
|
13380
13395
|
title: args.title,
|
|
13381
13396
|
description: args.description,
|
|
@@ -13385,7 +13400,8 @@ var UpdateCommand = {
|
|
|
13385
13400
|
progress: args.progress,
|
|
13386
13401
|
current_status: args.current_status,
|
|
13387
13402
|
project_path: args["project-path"],
|
|
13388
|
-
context: args.context
|
|
13403
|
+
context: args.context,
|
|
13404
|
+
parent_task_id: parentTaskId
|
|
13389
13405
|
};
|
|
13390
13406
|
const task = await taskComponent.updateTask(args.id, updateOptions);
|
|
13391
13407
|
if (!task) {
|
|
@@ -21619,7 +21635,15 @@ function savePlugins(plugins, scope) {
|
|
|
21619
21635
|
const config = { plugins };
|
|
21620
21636
|
writeFileSync(configPath, JSON.stringify(config, null, 2), "utf-8");
|
|
21621
21637
|
}
|
|
21638
|
+
function stripVersionSpec(packageName) {
|
|
21639
|
+
const atIdx = packageName.lastIndexOf("@");
|
|
21640
|
+
if (atIdx > 0) {
|
|
21641
|
+
return packageName.substring(0, atIdx);
|
|
21642
|
+
}
|
|
21643
|
+
return packageName;
|
|
21644
|
+
}
|
|
21622
21645
|
function readPackageInfo(packageName) {
|
|
21646
|
+
const bareName = packageName.startsWith("/") || packageName.startsWith(".") ? packageName : stripVersionSpec(packageName);
|
|
21623
21647
|
if (packageName.startsWith("/") || packageName.startsWith(".")) {
|
|
21624
21648
|
const localPkgPath = join4(packageName, "package.json");
|
|
21625
21649
|
if (existsSync3(localPkgPath)) {
|
|
@@ -21636,13 +21660,13 @@ function readPackageInfo(packageName) {
|
|
|
21636
21660
|
}
|
|
21637
21661
|
}
|
|
21638
21662
|
const searchPaths = [
|
|
21639
|
-
join4(process.cwd(), "node_modules",
|
|
21640
|
-
resolve(process.cwd(), "..", "node_modules",
|
|
21641
|
-
join4(process.cwd(), ".roy", "plugins",
|
|
21642
|
-
join4(homedir3(), ".roy-agent", "node_modules",
|
|
21663
|
+
join4(process.cwd(), "node_modules", bareName, "package.json"),
|
|
21664
|
+
resolve(process.cwd(), "..", "node_modules", bareName, "package.json"),
|
|
21665
|
+
join4(process.cwd(), ".roy", "plugins", bareName, "package.json"),
|
|
21666
|
+
join4(homedir3(), ".roy-agent", "node_modules", bareName, "package.json"),
|
|
21643
21667
|
...(() => {
|
|
21644
21668
|
const globalRoot = getNpmGlobalRoot();
|
|
21645
|
-
return globalRoot ? [join4(globalRoot,
|
|
21669
|
+
return globalRoot ? [join4(globalRoot, bareName, "package.json")] : [];
|
|
21646
21670
|
})()
|
|
21647
21671
|
];
|
|
21648
21672
|
for (const pkgPath of searchPaths) {
|
|
@@ -21651,7 +21675,7 @@ function readPackageInfo(packageName) {
|
|
|
21651
21675
|
const pkg = JSON.parse(readFileSync2(pkgPath, "utf-8"));
|
|
21652
21676
|
return {
|
|
21653
21677
|
version: pkg.version ?? "0.0.0",
|
|
21654
|
-
name: pkg.name ??
|
|
21678
|
+
name: pkg.name ?? bareName,
|
|
21655
21679
|
description: pkg.description
|
|
21656
21680
|
};
|
|
21657
21681
|
}
|
|
@@ -21784,7 +21808,7 @@ var InstallPackageCommand = {
|
|
|
21784
21808
|
}
|
|
21785
21809
|
resolvedGlobalName = info2.name;
|
|
21786
21810
|
} else {
|
|
21787
|
-
resolvedGlobalName = packageName;
|
|
21811
|
+
resolvedGlobalName = stripVersionSpec(packageName);
|
|
21788
21812
|
}
|
|
21789
21813
|
const result = spawnSync("npm", ["install", "-g", packageName], {
|
|
21790
21814
|
stdio: "inherit",
|
|
Binary file
|