@ai-setting/roy-agent-cli 1.7.18 → 1.7.19
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 +49 -4
- package/dist/index.js +49 -4
- package/dist/roy-agent-linux-x64/bin/roy-agent +0 -0
- package/package.json +1 -1
package/dist/bin/roy-agent.js
CHANGED
|
@@ -9461,7 +9461,7 @@ class CliQuietModeService {
|
|
|
9461
9461
|
// package.json
|
|
9462
9462
|
var package_default = {
|
|
9463
9463
|
name: "@ai-setting/roy-agent-cli",
|
|
9464
|
-
version: "1.7.
|
|
9464
|
+
version: "1.7.19",
|
|
9465
9465
|
type: "module",
|
|
9466
9466
|
description: "CLI for roy-agent - Non-interactive command execution",
|
|
9467
9467
|
main: "./dist/index.js",
|
|
@@ -11294,7 +11294,8 @@ var TaskEventTypes = {
|
|
|
11294
11294
|
TASK_COMPLETED: "task.background.completed",
|
|
11295
11295
|
TASK_FAILED: "task.background.failed",
|
|
11296
11296
|
TASK_TIMEOUT: "task.background.timeout",
|
|
11297
|
-
TASK_STOPPED: "task.background.stopped"
|
|
11297
|
+
TASK_STOPPED: "task.background.stopped",
|
|
11298
|
+
TASK_ASK_USER: "task.background.ask_user"
|
|
11298
11299
|
};
|
|
11299
11300
|
var EventSourceEventTypes = {
|
|
11300
11301
|
EVENT_SOURCE_STARTED: "event-source.started",
|
|
@@ -11324,6 +11325,8 @@ class EventMessageFormatter {
|
|
|
11324
11325
|
return this.formatTaskTimeout(payload);
|
|
11325
11326
|
case TaskEventTypes.TASK_STOPPED:
|
|
11326
11327
|
return this.formatTaskStopped(payload);
|
|
11328
|
+
case TaskEventTypes.TASK_ASK_USER:
|
|
11329
|
+
return this.formatTaskAskUser(payload);
|
|
11327
11330
|
case EventSourceEventTypes.EVENT_SOURCE_STARTED:
|
|
11328
11331
|
return this.formatEventSourceStarted(payload);
|
|
11329
11332
|
case EventSourceEventTypes.EVENT_SOURCE_STOPPED:
|
|
@@ -11431,6 +11434,34 @@ Task #${taskId}`;
|
|
|
11431
11434
|
message += this.appendSubSessionId(payload);
|
|
11432
11435
|
return message;
|
|
11433
11436
|
}
|
|
11437
|
+
formatTaskAskUser(payload) {
|
|
11438
|
+
const desc = payload.description || "未命名任务";
|
|
11439
|
+
const bgProcessId = payload.backgroundTaskId || "";
|
|
11440
|
+
const subSessionId = payload.subSessionId || "";
|
|
11441
|
+
const query = payload.query || "(空问题)";
|
|
11442
|
+
let message = `${this.prefix} ❓ 后台子代理「${desc}」请求用户输入`;
|
|
11443
|
+
if (bgProcessId) {
|
|
11444
|
+
message += `
|
|
11445
|
+
bgprocess: ${bgProcessId}`;
|
|
11446
|
+
}
|
|
11447
|
+
if (subSessionId) {
|
|
11448
|
+
message += `
|
|
11449
|
+
subSessionId: ${subSessionId}`;
|
|
11450
|
+
}
|
|
11451
|
+
message += `
|
|
11452
|
+
|
|
11453
|
+
${query}`;
|
|
11454
|
+
if (payload.hints && payload.hints.length > 0) {
|
|
11455
|
+
message += `
|
|
11456
|
+
|
|
11457
|
+
[\uD83E\uDD16 Agent 操作提示]`;
|
|
11458
|
+
for (const hint of payload.hints) {
|
|
11459
|
+
message += `
|
|
11460
|
+
${hint}`;
|
|
11461
|
+
}
|
|
11462
|
+
}
|
|
11463
|
+
return message;
|
|
11464
|
+
}
|
|
11434
11465
|
appendSubSessionId(payload) {
|
|
11435
11466
|
if (payload.subSessionId) {
|
|
11436
11467
|
return `
|
|
@@ -12839,10 +12870,23 @@ ${COLORS.system("[通知2] ❯ " + message.replace(/\n/g, `
|
|
|
12839
12870
|
}
|
|
12840
12871
|
}
|
|
12841
12872
|
const agentFromEvent = envEvent.metadata?.agent;
|
|
12873
|
+
let envEventForAgent = envEvent;
|
|
12874
|
+
const eventReplyChannel = envEvent?.metadata?.replyChannel;
|
|
12875
|
+
if (eventReplyChannel) {
|
|
12876
|
+
this.lastReplyChannel = eventReplyChannel;
|
|
12877
|
+
} else if (this.lastReplyChannel) {
|
|
12878
|
+
envEventForAgent = {
|
|
12879
|
+
...envEvent,
|
|
12880
|
+
metadata: {
|
|
12881
|
+
...envEvent?.metadata ?? {},
|
|
12882
|
+
replyChannel: this.lastReplyChannel
|
|
12883
|
+
}
|
|
12884
|
+
};
|
|
12885
|
+
}
|
|
12842
12886
|
this.currentAgentContext = {
|
|
12843
12887
|
agentType: agentFromEvent,
|
|
12844
12888
|
pluginEnabled,
|
|
12845
|
-
envEvent,
|
|
12889
|
+
envEvent: envEventForAgent,
|
|
12846
12890
|
plugins,
|
|
12847
12891
|
eventSessionId,
|
|
12848
12892
|
systemPrompt: envEvent.metadata?.systemPrompt
|
|
@@ -12850,6 +12894,7 @@ ${COLORS.system("[通知2] ❯ " + message.replace(/\n/g, `
|
|
|
12850
12894
|
await this.executeInternal(message, { showPrompt: true });
|
|
12851
12895
|
}
|
|
12852
12896
|
currentAgentContext = undefined;
|
|
12897
|
+
lastReplyChannel = undefined;
|
|
12853
12898
|
isIdle() {
|
|
12854
12899
|
return !this.isExecuting;
|
|
12855
12900
|
}
|
|
@@ -23694,7 +23739,7 @@ var WorkflowAddCommand = {
|
|
|
23694
23739
|
process.exit(1);
|
|
23695
23740
|
}
|
|
23696
23741
|
if (!agentComponent.getAgent("workflow-extract")) {
|
|
23697
|
-
output.error("Built-in 'workflow-extract' agent is not available.
|
|
23742
|
+
output.error("Built-in 'workflow-extract' agent is not available. ");
|
|
23698
23743
|
process.exit(1);
|
|
23699
23744
|
}
|
|
23700
23745
|
const prompt = `## 任务
|
package/dist/index.js
CHANGED
|
@@ -9460,7 +9460,7 @@ class CliQuietModeService {
|
|
|
9460
9460
|
// package.json
|
|
9461
9461
|
var package_default = {
|
|
9462
9462
|
name: "@ai-setting/roy-agent-cli",
|
|
9463
|
-
version: "1.7.
|
|
9463
|
+
version: "1.7.19",
|
|
9464
9464
|
type: "module",
|
|
9465
9465
|
description: "CLI for roy-agent - Non-interactive command execution",
|
|
9466
9466
|
main: "./dist/index.js",
|
|
@@ -11293,7 +11293,8 @@ var TaskEventTypes = {
|
|
|
11293
11293
|
TASK_COMPLETED: "task.background.completed",
|
|
11294
11294
|
TASK_FAILED: "task.background.failed",
|
|
11295
11295
|
TASK_TIMEOUT: "task.background.timeout",
|
|
11296
|
-
TASK_STOPPED: "task.background.stopped"
|
|
11296
|
+
TASK_STOPPED: "task.background.stopped",
|
|
11297
|
+
TASK_ASK_USER: "task.background.ask_user"
|
|
11297
11298
|
};
|
|
11298
11299
|
var EventSourceEventTypes = {
|
|
11299
11300
|
EVENT_SOURCE_STARTED: "event-source.started",
|
|
@@ -11323,6 +11324,8 @@ class EventMessageFormatter {
|
|
|
11323
11324
|
return this.formatTaskTimeout(payload);
|
|
11324
11325
|
case TaskEventTypes.TASK_STOPPED:
|
|
11325
11326
|
return this.formatTaskStopped(payload);
|
|
11327
|
+
case TaskEventTypes.TASK_ASK_USER:
|
|
11328
|
+
return this.formatTaskAskUser(payload);
|
|
11326
11329
|
case EventSourceEventTypes.EVENT_SOURCE_STARTED:
|
|
11327
11330
|
return this.formatEventSourceStarted(payload);
|
|
11328
11331
|
case EventSourceEventTypes.EVENT_SOURCE_STOPPED:
|
|
@@ -11430,6 +11433,34 @@ Task #${taskId}`;
|
|
|
11430
11433
|
message += this.appendSubSessionId(payload);
|
|
11431
11434
|
return message;
|
|
11432
11435
|
}
|
|
11436
|
+
formatTaskAskUser(payload) {
|
|
11437
|
+
const desc = payload.description || "未命名任务";
|
|
11438
|
+
const bgProcessId = payload.backgroundTaskId || "";
|
|
11439
|
+
const subSessionId = payload.subSessionId || "";
|
|
11440
|
+
const query = payload.query || "(空问题)";
|
|
11441
|
+
let message = `${this.prefix} ❓ 后台子代理「${desc}」请求用户输入`;
|
|
11442
|
+
if (bgProcessId) {
|
|
11443
|
+
message += `
|
|
11444
|
+
bgprocess: ${bgProcessId}`;
|
|
11445
|
+
}
|
|
11446
|
+
if (subSessionId) {
|
|
11447
|
+
message += `
|
|
11448
|
+
subSessionId: ${subSessionId}`;
|
|
11449
|
+
}
|
|
11450
|
+
message += `
|
|
11451
|
+
|
|
11452
|
+
${query}`;
|
|
11453
|
+
if (payload.hints && payload.hints.length > 0) {
|
|
11454
|
+
message += `
|
|
11455
|
+
|
|
11456
|
+
[\uD83E\uDD16 Agent 操作提示]`;
|
|
11457
|
+
for (const hint of payload.hints) {
|
|
11458
|
+
message += `
|
|
11459
|
+
${hint}`;
|
|
11460
|
+
}
|
|
11461
|
+
}
|
|
11462
|
+
return message;
|
|
11463
|
+
}
|
|
11433
11464
|
appendSubSessionId(payload) {
|
|
11434
11465
|
if (payload.subSessionId) {
|
|
11435
11466
|
return `
|
|
@@ -12838,10 +12869,23 @@ ${COLORS.system("[通知2] ❯ " + message.replace(/\n/g, `
|
|
|
12838
12869
|
}
|
|
12839
12870
|
}
|
|
12840
12871
|
const agentFromEvent = envEvent.metadata?.agent;
|
|
12872
|
+
let envEventForAgent = envEvent;
|
|
12873
|
+
const eventReplyChannel = envEvent?.metadata?.replyChannel;
|
|
12874
|
+
if (eventReplyChannel) {
|
|
12875
|
+
this.lastReplyChannel = eventReplyChannel;
|
|
12876
|
+
} else if (this.lastReplyChannel) {
|
|
12877
|
+
envEventForAgent = {
|
|
12878
|
+
...envEvent,
|
|
12879
|
+
metadata: {
|
|
12880
|
+
...envEvent?.metadata ?? {},
|
|
12881
|
+
replyChannel: this.lastReplyChannel
|
|
12882
|
+
}
|
|
12883
|
+
};
|
|
12884
|
+
}
|
|
12841
12885
|
this.currentAgentContext = {
|
|
12842
12886
|
agentType: agentFromEvent,
|
|
12843
12887
|
pluginEnabled,
|
|
12844
|
-
envEvent,
|
|
12888
|
+
envEvent: envEventForAgent,
|
|
12845
12889
|
plugins,
|
|
12846
12890
|
eventSessionId,
|
|
12847
12891
|
systemPrompt: envEvent.metadata?.systemPrompt
|
|
@@ -12849,6 +12893,7 @@ ${COLORS.system("[通知2] ❯ " + message.replace(/\n/g, `
|
|
|
12849
12893
|
await this.executeInternal(message, { showPrompt: true });
|
|
12850
12894
|
}
|
|
12851
12895
|
currentAgentContext = undefined;
|
|
12896
|
+
lastReplyChannel = undefined;
|
|
12852
12897
|
isIdle() {
|
|
12853
12898
|
return !this.isExecuting;
|
|
12854
12899
|
}
|
|
@@ -23693,7 +23738,7 @@ var WorkflowAddCommand = {
|
|
|
23693
23738
|
process.exit(1);
|
|
23694
23739
|
}
|
|
23695
23740
|
if (!agentComponent.getAgent("workflow-extract")) {
|
|
23696
|
-
output.error("Built-in 'workflow-extract' agent is not available.
|
|
23741
|
+
output.error("Built-in 'workflow-extract' agent is not available. ");
|
|
23697
23742
|
process.exit(1);
|
|
23698
23743
|
}
|
|
23699
23744
|
const prompt = `## 任务
|
|
Binary file
|