@ai-setting/roy-agent-cli 1.5.103 → 1.5.105
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 +66 -4
- package/dist/index.js +66 -4
- package/dist/roy-agent-linux-x64/bin/roy-agent +0 -0
- package/package.json +1 -1
package/dist/bin/roy-agent.js
CHANGED
|
@@ -7427,7 +7427,7 @@ var require_dist = __commonJS((exports) => {
|
|
|
7427
7427
|
var require_package = __commonJS((exports, module) => {
|
|
7428
7428
|
module.exports = {
|
|
7429
7429
|
name: "@ai-setting/roy-agent-cli",
|
|
7430
|
-
version: "1.5.
|
|
7430
|
+
version: "1.5.105",
|
|
7431
7431
|
type: "module",
|
|
7432
7432
|
description: "CLI for roy-agent - Non-interactive command execution",
|
|
7433
7433
|
main: "./dist/index.js",
|
|
@@ -9084,13 +9084,23 @@ class QueryExecutor {
|
|
|
9084
9084
|
this.output.info(`执行: ${message}`);
|
|
9085
9085
|
}
|
|
9086
9086
|
const contextHandler = new ContextHandlerService(this.env, this.sessionComponent, { maxRetries: 1, autoCompact: true });
|
|
9087
|
-
const {
|
|
9087
|
+
const {
|
|
9088
|
+
systemPrompt: agentContextSystemPrompt,
|
|
9089
|
+
eventSourceSystemPrompt: agentContextPreloadedPrompts,
|
|
9090
|
+
...restAgentContext
|
|
9091
|
+
} = agentContext ?? {};
|
|
9092
|
+
let eventSourceFinalPrompt;
|
|
9093
|
+
if (typeof agentContextSystemPrompt === "string" && agentContextSystemPrompt.length > 0) {
|
|
9094
|
+
eventSourceFinalPrompt = agentContextSystemPrompt;
|
|
9095
|
+
} else if (typeof agentContextPreloadedPrompts === "string" && agentContextPreloadedPrompts.length > 0) {
|
|
9096
|
+
eventSourceFinalPrompt = agentContextPreloadedPrompts;
|
|
9097
|
+
}
|
|
9088
9098
|
const context = {
|
|
9089
9099
|
sessionId,
|
|
9090
9100
|
metadata: {
|
|
9091
9101
|
originalQuery: message,
|
|
9092
9102
|
traceId,
|
|
9093
|
-
systemPrompt:
|
|
9103
|
+
systemPrompt: eventSourceFinalPrompt
|
|
9094
9104
|
},
|
|
9095
9105
|
...restAgentContext
|
|
9096
9106
|
};
|
|
@@ -9668,6 +9678,41 @@ async function startSingleEventSourceImpl(eventSourceComponent, output, eventSou
|
|
|
9668
9678
|
}
|
|
9669
9679
|
}
|
|
9670
9680
|
|
|
9681
|
+
// src/commands/collect-event-source-system-prompts.ts
|
|
9682
|
+
import { resolveBountyIMSystemPrompt } from "@ai-setting/roy-agent-core";
|
|
9683
|
+
function resolveSystemPromptForSource(config) {
|
|
9684
|
+
if (config.type === "bounty-im") {
|
|
9685
|
+
const imServerUrl = config.imServerUrl || config.options && config.options.imServerUrl;
|
|
9686
|
+
const address = config.address || config.options && config.options.address || "unknown";
|
|
9687
|
+
return resolveBountyIMSystemPrompt({
|
|
9688
|
+
configSystemPrompt: config.systemPrompt,
|
|
9689
|
+
currentAddress: address,
|
|
9690
|
+
imServerUrl
|
|
9691
|
+
});
|
|
9692
|
+
}
|
|
9693
|
+
return config.systemPrompt;
|
|
9694
|
+
}
|
|
9695
|
+
function collectEventSourceSystemPrompts(eventSourceIds, eventSourceComponent) {
|
|
9696
|
+
const result = [];
|
|
9697
|
+
for (const id of eventSourceIds) {
|
|
9698
|
+
const config = eventSourceComponent.get(id);
|
|
9699
|
+
if (!config)
|
|
9700
|
+
continue;
|
|
9701
|
+
const prompt = resolveSystemPromptForSource(config);
|
|
9702
|
+
if (!prompt)
|
|
9703
|
+
continue;
|
|
9704
|
+
result.push({ id, type: config.type, prompt });
|
|
9705
|
+
}
|
|
9706
|
+
return result;
|
|
9707
|
+
}
|
|
9708
|
+
function joinResolvedSystemPrompts(prompts) {
|
|
9709
|
+
return prompts.map((p) => p.prompt).join(`
|
|
9710
|
+
|
|
9711
|
+
---
|
|
9712
|
+
|
|
9713
|
+
`);
|
|
9714
|
+
}
|
|
9715
|
+
|
|
9671
9716
|
// src/commands/shared/ask-user-handler.ts
|
|
9672
9717
|
import * as readline from "readline";
|
|
9673
9718
|
import chalk3 from "chalk";
|
|
@@ -10435,6 +10480,7 @@ function createInteractiveCommand(externalEnvService) {
|
|
|
10435
10480
|
const output = new OutputService2;
|
|
10436
10481
|
const shouldDisposeEnvService = !externalEnvService;
|
|
10437
10482
|
const envService = externalEnvService ?? new EnvironmentService(output);
|
|
10483
|
+
let eventSourceSystemPrompts = [];
|
|
10438
10484
|
const CODER_HARNESS_PLUGINS = new Set([
|
|
10439
10485
|
"lsp",
|
|
10440
10486
|
"code-check",
|
|
@@ -10589,10 +10635,13 @@ function createInteractiveCommand(externalEnvService) {
|
|
|
10589
10635
|
sessionTitle,
|
|
10590
10636
|
onExecute: async (message, traceId, agentContext) => {
|
|
10591
10637
|
resetStreamAbort();
|
|
10638
|
+
const preloadedPrompts = eventSourceSystemPrompts;
|
|
10639
|
+
const eventSourceSystemPrompt = preloadedPrompts.length > 0 ? joinResolvedSystemPrompts(preloadedPrompts) : undefined;
|
|
10592
10640
|
const mergedContext = {
|
|
10593
10641
|
...currentAgentContext,
|
|
10594
10642
|
model: args.model,
|
|
10595
|
-
...agentContext
|
|
10643
|
+
...agentContext,
|
|
10644
|
+
eventSourceSystemPrompt
|
|
10596
10645
|
};
|
|
10597
10646
|
const effectiveSessionId = mergedContext.eventSessionId ?? sessionId;
|
|
10598
10647
|
const result = await queryExecutor.execute(message, effectiveSessionId, {
|
|
@@ -10673,6 +10722,10 @@ function createInteractiveCommand(externalEnvService) {
|
|
|
10673
10722
|
process.exit(1);
|
|
10674
10723
|
}
|
|
10675
10724
|
const summary = await startEventSources(eventSourceIds, eventSourceComponent, output);
|
|
10725
|
+
eventSourceSystemPrompts = collectEventSourceSystemPrompts(eventSourceIds, eventSourceComponent);
|
|
10726
|
+
if (eventSourceSystemPrompts.length > 0) {
|
|
10727
|
+
output.info(`\uD83D\uDCE6 Preloaded ${eventSourceSystemPrompts.length} event-source systemPrompt(s)`);
|
|
10728
|
+
}
|
|
10676
10729
|
if (eventSourceIds.length === 1 && summary.failedCount > 0) {
|
|
10677
10730
|
process.exit(1);
|
|
10678
10731
|
}
|
|
@@ -13836,6 +13889,11 @@ var ListCommand4 = {
|
|
|
13836
13889
|
process.exit(1);
|
|
13837
13890
|
}
|
|
13838
13891
|
let agents;
|
|
13892
|
+
const builtInSubAgentNames = new Set([
|
|
13893
|
+
"general",
|
|
13894
|
+
"explore",
|
|
13895
|
+
"roy"
|
|
13896
|
+
]);
|
|
13839
13897
|
if (args.type && args.type !== "all") {
|
|
13840
13898
|
agents = registry.listAgentsByType(args.type);
|
|
13841
13899
|
} else {
|
|
@@ -13847,6 +13905,7 @@ var ListCommand4 = {
|
|
|
13847
13905
|
agents: agents.map((a) => ({
|
|
13848
13906
|
name: a.name,
|
|
13849
13907
|
type: a.type,
|
|
13908
|
+
source: builtInSubAgentNames.has(a.name) ? "built-in" : "user",
|
|
13850
13909
|
description: a.description,
|
|
13851
13910
|
workflow: a.workflow,
|
|
13852
13911
|
model: a.model,
|
|
@@ -13860,6 +13919,7 @@ var ListCommand4 = {
|
|
|
13860
13919
|
const header = [
|
|
13861
13920
|
chalk31.bold("Name"),
|
|
13862
13921
|
chalk31.bold("Type"),
|
|
13922
|
+
chalk31.bold("Source"),
|
|
13863
13923
|
chalk31.bold("Model"),
|
|
13864
13924
|
chalk31.bold("Workflow"),
|
|
13865
13925
|
chalk31.bold("Description")
|
|
@@ -13875,9 +13935,11 @@ var ListCommand4 = {
|
|
|
13875
13935
|
const desc2 = (a.description || "").length > 40 ? (a.description || "").slice(0, 37) + "..." : a.description || "-";
|
|
13876
13936
|
const workflowDisplay = a.type === "workflow" && a.workflow ? chalk31.cyan(a.workflow.length > 30 ? a.workflow.slice(0, 27) + "..." : a.workflow) : chalk31.gray("-");
|
|
13877
13937
|
const modelDisplay = a.model ? chalk31.yellow(a.model.length > 20 ? a.model.slice(0, 17) + "..." : a.model) : chalk31.gray("-");
|
|
13938
|
+
const sourceDisplay = builtInSubAgentNames.has(a.name) ? chalk31.green("built-in") : chalk31.gray("user");
|
|
13878
13939
|
return [
|
|
13879
13940
|
chalk31.cyan(a.name),
|
|
13880
13941
|
typeColor(a.type)(a.type),
|
|
13942
|
+
sourceDisplay,
|
|
13881
13943
|
modelDisplay,
|
|
13882
13944
|
workflowDisplay,
|
|
13883
13945
|
desc2
|
package/dist/index.js
CHANGED
|
@@ -7426,7 +7426,7 @@ var require_dist = __commonJS((exports) => {
|
|
|
7426
7426
|
var require_package = __commonJS((exports, module) => {
|
|
7427
7427
|
module.exports = {
|
|
7428
7428
|
name: "@ai-setting/roy-agent-cli",
|
|
7429
|
-
version: "1.5.
|
|
7429
|
+
version: "1.5.105",
|
|
7430
7430
|
type: "module",
|
|
7431
7431
|
description: "CLI for roy-agent - Non-interactive command execution",
|
|
7432
7432
|
main: "./dist/index.js",
|
|
@@ -9083,13 +9083,23 @@ class QueryExecutor {
|
|
|
9083
9083
|
this.output.info(`执行: ${message}`);
|
|
9084
9084
|
}
|
|
9085
9085
|
const contextHandler = new ContextHandlerService(this.env, this.sessionComponent, { maxRetries: 1, autoCompact: true });
|
|
9086
|
-
const {
|
|
9086
|
+
const {
|
|
9087
|
+
systemPrompt: agentContextSystemPrompt,
|
|
9088
|
+
eventSourceSystemPrompt: agentContextPreloadedPrompts,
|
|
9089
|
+
...restAgentContext
|
|
9090
|
+
} = agentContext ?? {};
|
|
9091
|
+
let eventSourceFinalPrompt;
|
|
9092
|
+
if (typeof agentContextSystemPrompt === "string" && agentContextSystemPrompt.length > 0) {
|
|
9093
|
+
eventSourceFinalPrompt = agentContextSystemPrompt;
|
|
9094
|
+
} else if (typeof agentContextPreloadedPrompts === "string" && agentContextPreloadedPrompts.length > 0) {
|
|
9095
|
+
eventSourceFinalPrompt = agentContextPreloadedPrompts;
|
|
9096
|
+
}
|
|
9087
9097
|
const context = {
|
|
9088
9098
|
sessionId,
|
|
9089
9099
|
metadata: {
|
|
9090
9100
|
originalQuery: message,
|
|
9091
9101
|
traceId,
|
|
9092
|
-
systemPrompt:
|
|
9102
|
+
systemPrompt: eventSourceFinalPrompt
|
|
9093
9103
|
},
|
|
9094
9104
|
...restAgentContext
|
|
9095
9105
|
};
|
|
@@ -9667,6 +9677,41 @@ async function startSingleEventSourceImpl(eventSourceComponent, output, eventSou
|
|
|
9667
9677
|
}
|
|
9668
9678
|
}
|
|
9669
9679
|
|
|
9680
|
+
// src/commands/collect-event-source-system-prompts.ts
|
|
9681
|
+
import { resolveBountyIMSystemPrompt } from "@ai-setting/roy-agent-core";
|
|
9682
|
+
function resolveSystemPromptForSource(config) {
|
|
9683
|
+
if (config.type === "bounty-im") {
|
|
9684
|
+
const imServerUrl = config.imServerUrl || config.options && config.options.imServerUrl;
|
|
9685
|
+
const address = config.address || config.options && config.options.address || "unknown";
|
|
9686
|
+
return resolveBountyIMSystemPrompt({
|
|
9687
|
+
configSystemPrompt: config.systemPrompt,
|
|
9688
|
+
currentAddress: address,
|
|
9689
|
+
imServerUrl
|
|
9690
|
+
});
|
|
9691
|
+
}
|
|
9692
|
+
return config.systemPrompt;
|
|
9693
|
+
}
|
|
9694
|
+
function collectEventSourceSystemPrompts(eventSourceIds, eventSourceComponent) {
|
|
9695
|
+
const result = [];
|
|
9696
|
+
for (const id of eventSourceIds) {
|
|
9697
|
+
const config = eventSourceComponent.get(id);
|
|
9698
|
+
if (!config)
|
|
9699
|
+
continue;
|
|
9700
|
+
const prompt = resolveSystemPromptForSource(config);
|
|
9701
|
+
if (!prompt)
|
|
9702
|
+
continue;
|
|
9703
|
+
result.push({ id, type: config.type, prompt });
|
|
9704
|
+
}
|
|
9705
|
+
return result;
|
|
9706
|
+
}
|
|
9707
|
+
function joinResolvedSystemPrompts(prompts) {
|
|
9708
|
+
return prompts.map((p) => p.prompt).join(`
|
|
9709
|
+
|
|
9710
|
+
---
|
|
9711
|
+
|
|
9712
|
+
`);
|
|
9713
|
+
}
|
|
9714
|
+
|
|
9670
9715
|
// src/commands/shared/ask-user-handler.ts
|
|
9671
9716
|
import * as readline from "readline";
|
|
9672
9717
|
import chalk3 from "chalk";
|
|
@@ -10434,6 +10479,7 @@ function createInteractiveCommand(externalEnvService) {
|
|
|
10434
10479
|
const output = new OutputService2;
|
|
10435
10480
|
const shouldDisposeEnvService = !externalEnvService;
|
|
10436
10481
|
const envService = externalEnvService ?? new EnvironmentService(output);
|
|
10482
|
+
let eventSourceSystemPrompts = [];
|
|
10437
10483
|
const CODER_HARNESS_PLUGINS = new Set([
|
|
10438
10484
|
"lsp",
|
|
10439
10485
|
"code-check",
|
|
@@ -10588,10 +10634,13 @@ function createInteractiveCommand(externalEnvService) {
|
|
|
10588
10634
|
sessionTitle,
|
|
10589
10635
|
onExecute: async (message, traceId, agentContext) => {
|
|
10590
10636
|
resetStreamAbort();
|
|
10637
|
+
const preloadedPrompts = eventSourceSystemPrompts;
|
|
10638
|
+
const eventSourceSystemPrompt = preloadedPrompts.length > 0 ? joinResolvedSystemPrompts(preloadedPrompts) : undefined;
|
|
10591
10639
|
const mergedContext = {
|
|
10592
10640
|
...currentAgentContext,
|
|
10593
10641
|
model: args.model,
|
|
10594
|
-
...agentContext
|
|
10642
|
+
...agentContext,
|
|
10643
|
+
eventSourceSystemPrompt
|
|
10595
10644
|
};
|
|
10596
10645
|
const effectiveSessionId = mergedContext.eventSessionId ?? sessionId;
|
|
10597
10646
|
const result = await queryExecutor.execute(message, effectiveSessionId, {
|
|
@@ -10672,6 +10721,10 @@ function createInteractiveCommand(externalEnvService) {
|
|
|
10672
10721
|
process.exit(1);
|
|
10673
10722
|
}
|
|
10674
10723
|
const summary = await startEventSources(eventSourceIds, eventSourceComponent, output);
|
|
10724
|
+
eventSourceSystemPrompts = collectEventSourceSystemPrompts(eventSourceIds, eventSourceComponent);
|
|
10725
|
+
if (eventSourceSystemPrompts.length > 0) {
|
|
10726
|
+
output.info(`\uD83D\uDCE6 Preloaded ${eventSourceSystemPrompts.length} event-source systemPrompt(s)`);
|
|
10727
|
+
}
|
|
10675
10728
|
if (eventSourceIds.length === 1 && summary.failedCount > 0) {
|
|
10676
10729
|
process.exit(1);
|
|
10677
10730
|
}
|
|
@@ -13835,6 +13888,11 @@ var ListCommand4 = {
|
|
|
13835
13888
|
process.exit(1);
|
|
13836
13889
|
}
|
|
13837
13890
|
let agents;
|
|
13891
|
+
const builtInSubAgentNames = new Set([
|
|
13892
|
+
"general",
|
|
13893
|
+
"explore",
|
|
13894
|
+
"roy"
|
|
13895
|
+
]);
|
|
13838
13896
|
if (args.type && args.type !== "all") {
|
|
13839
13897
|
agents = registry.listAgentsByType(args.type);
|
|
13840
13898
|
} else {
|
|
@@ -13846,6 +13904,7 @@ var ListCommand4 = {
|
|
|
13846
13904
|
agents: agents.map((a) => ({
|
|
13847
13905
|
name: a.name,
|
|
13848
13906
|
type: a.type,
|
|
13907
|
+
source: builtInSubAgentNames.has(a.name) ? "built-in" : "user",
|
|
13849
13908
|
description: a.description,
|
|
13850
13909
|
workflow: a.workflow,
|
|
13851
13910
|
model: a.model,
|
|
@@ -13859,6 +13918,7 @@ var ListCommand4 = {
|
|
|
13859
13918
|
const header = [
|
|
13860
13919
|
chalk31.bold("Name"),
|
|
13861
13920
|
chalk31.bold("Type"),
|
|
13921
|
+
chalk31.bold("Source"),
|
|
13862
13922
|
chalk31.bold("Model"),
|
|
13863
13923
|
chalk31.bold("Workflow"),
|
|
13864
13924
|
chalk31.bold("Description")
|
|
@@ -13874,9 +13934,11 @@ var ListCommand4 = {
|
|
|
13874
13934
|
const desc2 = (a.description || "").length > 40 ? (a.description || "").slice(0, 37) + "..." : a.description || "-";
|
|
13875
13935
|
const workflowDisplay = a.type === "workflow" && a.workflow ? chalk31.cyan(a.workflow.length > 30 ? a.workflow.slice(0, 27) + "..." : a.workflow) : chalk31.gray("-");
|
|
13876
13936
|
const modelDisplay = a.model ? chalk31.yellow(a.model.length > 20 ? a.model.slice(0, 17) + "..." : a.model) : chalk31.gray("-");
|
|
13937
|
+
const sourceDisplay = builtInSubAgentNames.has(a.name) ? chalk31.green("built-in") : chalk31.gray("user");
|
|
13877
13938
|
return [
|
|
13878
13939
|
chalk31.cyan(a.name),
|
|
13879
13940
|
typeColor(a.type)(a.type),
|
|
13941
|
+
sourceDisplay,
|
|
13880
13942
|
modelDisplay,
|
|
13881
13943
|
workflowDisplay,
|
|
13882
13944
|
desc2
|
|
Binary file
|