@ai-setting/roy-agent-cli 1.5.7 → 1.5.9
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 +143 -13
- package/dist/index.js +143 -13
- package/package.json +10 -10
- package/dist/roy-agent-linux-x64/bin/roy-agent +0 -0
package/dist/bin/roy-agent.js
CHANGED
|
@@ -7220,7 +7220,7 @@ var require_dist = __commonJS((exports) => {
|
|
|
7220
7220
|
var require_package = __commonJS((exports, module) => {
|
|
7221
7221
|
module.exports = {
|
|
7222
7222
|
name: "@ai-setting/roy-agent-cli",
|
|
7223
|
-
version: "1.5.
|
|
7223
|
+
version: "1.5.9",
|
|
7224
7224
|
type: "module",
|
|
7225
7225
|
description: "CLI for roy-agent - Non-interactive command execution",
|
|
7226
7226
|
main: "./dist/index.js",
|
|
@@ -7848,7 +7848,6 @@ class EnvironmentService {
|
|
|
7848
7848
|
data.renderedContent += `
|
|
7849
7849
|
|
|
7850
7850
|
` + commandsSection;
|
|
7851
|
-
this.output.log(`[Environment] Injected ${metaList.length} commands into default prompt`);
|
|
7852
7851
|
} catch (error) {
|
|
7853
7852
|
this.output.error(`Failed to inject commands into prompt: ${error}`);
|
|
7854
7853
|
}
|
|
@@ -8154,6 +8153,111 @@ __legacyDecorateClassTS([
|
|
|
8154
8153
|
|
|
8155
8154
|
// src/commands/act.ts
|
|
8156
8155
|
import { ContextError as ContextError2, ErrorCodes as ErrorCodes2, getTracerProvider as getTracerProvider2 } from "@ai-setting/roy-agent-core";
|
|
8156
|
+
|
|
8157
|
+
// src/commands/shared/task-event-handler.ts
|
|
8158
|
+
var TASK_EVENTS = {
|
|
8159
|
+
CREATED: "task.created",
|
|
8160
|
+
UPDATED: "task.updated",
|
|
8161
|
+
COMPLETED: "task.completed",
|
|
8162
|
+
DELETED: "task.deleted",
|
|
8163
|
+
OPERATION_ADDED: "task.operation_added",
|
|
8164
|
+
DELEGATED: "task.delegated"
|
|
8165
|
+
};
|
|
8166
|
+
|
|
8167
|
+
class TaskEventHandler {
|
|
8168
|
+
env;
|
|
8169
|
+
enabled;
|
|
8170
|
+
unsubscribe = null;
|
|
8171
|
+
constructor(options) {
|
|
8172
|
+
this.env = options.env;
|
|
8173
|
+
this.enabled = options.enabled ?? true;
|
|
8174
|
+
}
|
|
8175
|
+
start() {
|
|
8176
|
+
if (!this.enabled) {
|
|
8177
|
+
return () => {};
|
|
8178
|
+
}
|
|
8179
|
+
this.unsubscribe = this.env.subscribeAll((event) => {
|
|
8180
|
+
if (event.type.startsWith("task.")) {
|
|
8181
|
+
this.handleEvent(event);
|
|
8182
|
+
}
|
|
8183
|
+
});
|
|
8184
|
+
console.log("[TaskEventHandler] Started");
|
|
8185
|
+
return () => this.stop();
|
|
8186
|
+
}
|
|
8187
|
+
stop() {
|
|
8188
|
+
if (this.unsubscribe) {
|
|
8189
|
+
this.unsubscribe();
|
|
8190
|
+
this.unsubscribe = null;
|
|
8191
|
+
console.log("[TaskEventHandler] Stopped");
|
|
8192
|
+
}
|
|
8193
|
+
}
|
|
8194
|
+
handleEvent(event) {
|
|
8195
|
+
const payload = event.payload;
|
|
8196
|
+
switch (event.type) {
|
|
8197
|
+
case TASK_EVENTS.CREATED:
|
|
8198
|
+
this.logTaskCreated(payload);
|
|
8199
|
+
break;
|
|
8200
|
+
case TASK_EVENTS.UPDATED:
|
|
8201
|
+
this.logTaskUpdated(payload);
|
|
8202
|
+
break;
|
|
8203
|
+
case TASK_EVENTS.COMPLETED:
|
|
8204
|
+
this.logTaskCompleted(payload);
|
|
8205
|
+
break;
|
|
8206
|
+
case TASK_EVENTS.DELETED:
|
|
8207
|
+
this.logTaskDeleted(payload);
|
|
8208
|
+
break;
|
|
8209
|
+
case TASK_EVENTS.OPERATION_ADDED:
|
|
8210
|
+
this.logOperationAdded(payload);
|
|
8211
|
+
break;
|
|
8212
|
+
case TASK_EVENTS.DELEGATED:
|
|
8213
|
+
this.logTaskDelegated(payload);
|
|
8214
|
+
break;
|
|
8215
|
+
default:
|
|
8216
|
+
console.log(`[${event.type}]`, payload);
|
|
8217
|
+
}
|
|
8218
|
+
}
|
|
8219
|
+
logTaskCreated(payload) {
|
|
8220
|
+
const task = payload.task;
|
|
8221
|
+
console.log(`\uD83D\uDCDD Task created: #${task.id} - ${task.title}`);
|
|
8222
|
+
console.log(` Status: ${task.status}, Priority: ${task.priority}`);
|
|
8223
|
+
if (task.project_path) {
|
|
8224
|
+
console.log(` Project: ${task.project_path}`);
|
|
8225
|
+
}
|
|
8226
|
+
if (task.context) {
|
|
8227
|
+
console.log(` Context: ${task.context}`);
|
|
8228
|
+
}
|
|
8229
|
+
}
|
|
8230
|
+
logTaskUpdated(payload) {
|
|
8231
|
+
const task = payload.task;
|
|
8232
|
+
const changes = payload.changes;
|
|
8233
|
+
console.log(`✏️ Task updated: #${task.id} - ${task.title}`);
|
|
8234
|
+
console.log(` Status: ${task.status}, Progress: ${task.progress}%`);
|
|
8235
|
+
if (changes) {
|
|
8236
|
+
console.log(` Changes: ${JSON.stringify(changes)}`);
|
|
8237
|
+
}
|
|
8238
|
+
}
|
|
8239
|
+
logTaskCompleted(payload) {
|
|
8240
|
+
const task = payload.task;
|
|
8241
|
+
console.log(`✅ Task completed: #${task.id} - ${task.title}`);
|
|
8242
|
+
console.log(` Progress: ${task.progress}%, Updated: ${task.updatedAt}`);
|
|
8243
|
+
}
|
|
8244
|
+
logTaskDeleted(payload) {
|
|
8245
|
+
console.log(`\uD83D\uDDD1️ Task deleted: #${payload.taskId}`);
|
|
8246
|
+
}
|
|
8247
|
+
logOperationAdded(payload) {
|
|
8248
|
+
const op = payload.operation;
|
|
8249
|
+
console.log(`\uD83D\uDCCB Operation added to task #${payload.taskId}:`);
|
|
8250
|
+
console.log(` [${op.actionType}] ${op.actionTitle}`);
|
|
8251
|
+
console.log(` Session: ${op.sessionId}`);
|
|
8252
|
+
}
|
|
8253
|
+
logTaskDelegated(payload) {
|
|
8254
|
+
console.log(`\uD83D\uDE80 Task delegated: #${payload.taskId}`);
|
|
8255
|
+
console.log(` Background: ${payload.backgroundTaskId}, Type: ${payload.subagentType}`);
|
|
8256
|
+
console.log(` ${payload.description}`);
|
|
8257
|
+
}
|
|
8258
|
+
}
|
|
8259
|
+
|
|
8260
|
+
// src/commands/act.ts
|
|
8157
8261
|
var ActCommand = {
|
|
8158
8262
|
command: "act [message]",
|
|
8159
8263
|
describe: "自然语言交互 - 通过自然语言驱动整个操作系统",
|
|
@@ -8251,6 +8355,11 @@ var ActCommand = {
|
|
|
8251
8355
|
output.error("SessionComponent not available");
|
|
8252
8356
|
process.exit(1);
|
|
8253
8357
|
}
|
|
8358
|
+
const taskEventHandlerForCleanup = new TaskEventHandler({
|
|
8359
|
+
env,
|
|
8360
|
+
enabled: true
|
|
8361
|
+
});
|
|
8362
|
+
const stopTaskEventHandlerCleanup2 = taskEventHandlerForCleanup.start();
|
|
8254
8363
|
let sessionId = args.session;
|
|
8255
8364
|
let isNewSession = false;
|
|
8256
8365
|
if (args.continue && !sessionId) {
|
|
@@ -8458,6 +8567,9 @@ var ActCommand = {
|
|
|
8458
8567
|
}
|
|
8459
8568
|
process.exit(1);
|
|
8460
8569
|
} finally {
|
|
8570
|
+
if (typeof stopTaskEventHandlerCleanup === "function") {
|
|
8571
|
+
stopTaskEventHandlerCleanup();
|
|
8572
|
+
}
|
|
8461
8573
|
if (lspManagerDispose) {
|
|
8462
8574
|
await lspManagerDispose();
|
|
8463
8575
|
}
|
|
@@ -8721,12 +8833,12 @@ class QueryExecutor {
|
|
|
8721
8833
|
|
|
8722
8834
|
// src/commands/shared/event-message-formatter.ts
|
|
8723
8835
|
var TaskEventTypes = {
|
|
8724
|
-
TASK_STARTED: "task.started",
|
|
8725
|
-
TASK_PROGRESS: "task.progress",
|
|
8726
|
-
TASK_COMPLETED: "task.completed",
|
|
8727
|
-
TASK_FAILED: "task.failed",
|
|
8728
|
-
TASK_TIMEOUT: "task.timeout",
|
|
8729
|
-
TASK_STOPPED: "task.stopped"
|
|
8836
|
+
TASK_STARTED: "task.background.started",
|
|
8837
|
+
TASK_PROGRESS: "task.background.progress",
|
|
8838
|
+
TASK_COMPLETED: "task.background.completed",
|
|
8839
|
+
TASK_FAILED: "task.background.failed",
|
|
8840
|
+
TASK_TIMEOUT: "task.background.timeout",
|
|
8841
|
+
TASK_STOPPED: "task.background.stopped"
|
|
8730
8842
|
};
|
|
8731
8843
|
var EventSourceEventTypes = {
|
|
8732
8844
|
EVENT_SOURCE_STARTED: "event-source.started",
|
|
@@ -8788,7 +8900,7 @@ class EventMessageFormatter {
|
|
|
8788
8900
|
const time = payload.executionTimeMs ? `(${this.formatDuration(payload.executionTimeMs)})` : "";
|
|
8789
8901
|
let message = `${this.prefix} ✅ 后台任务「${desc}」已完成 ${time}`;
|
|
8790
8902
|
if (result) {
|
|
8791
|
-
const truncatedResult = result.length >
|
|
8903
|
+
const truncatedResult = result.length > 1e4 ? result.substring(0, 100) + "...[TRUNCATED]" : result;
|
|
8792
8904
|
message += `
|
|
8793
8905
|
结果: ${truncatedResult}`;
|
|
8794
8906
|
}
|
|
@@ -9683,7 +9795,7 @@ var InteractiveCommand = {
|
|
|
9683
9795
|
}, env);
|
|
9684
9796
|
const eventHandler = new EventHandler({
|
|
9685
9797
|
env,
|
|
9686
|
-
eventTypes: ["task.*", "event-source.event.*"],
|
|
9798
|
+
eventTypes: ["task.background.*", "event-source.event.*"],
|
|
9687
9799
|
formatter: new EventMessageFormatter({ prefix: "[通知]" }),
|
|
9688
9800
|
isIdle: () => repl.isIdle(),
|
|
9689
9801
|
onEvent: async (message) => {
|
|
@@ -11388,6 +11500,8 @@ var ListCommand2 = {
|
|
|
11388
11500
|
priority: t.priority,
|
|
11389
11501
|
progress: t.progress,
|
|
11390
11502
|
current_status: t.current_status,
|
|
11503
|
+
project_path: t.project_path,
|
|
11504
|
+
context: t.context,
|
|
11391
11505
|
createdAt: t.createdAt,
|
|
11392
11506
|
updatedAt: t.updatedAt
|
|
11393
11507
|
})),
|
|
@@ -11479,6 +11593,8 @@ Task #${result.task.id}: ${result.task.title}
|
|
|
11479
11593
|
`));
|
|
11480
11594
|
output.log(`Status: ${chalk17.blue(result.task.status)} | Priority: ${result.task.priority} | Progress: ${result.task.progress}%`);
|
|
11481
11595
|
output.log(`Created: ${result.task.createdAt} | Updated: ${result.task.updatedAt}`);
|
|
11596
|
+
output.log(`Project Path: ${result.task.project_path}`);
|
|
11597
|
+
output.log(`Context: ${result.task.context}`);
|
|
11482
11598
|
if (result.task.current_status) {
|
|
11483
11599
|
output.log(`
|
|
11484
11600
|
Current Status: ${result.task.current_status}`);
|
|
@@ -11508,6 +11624,8 @@ Task #${task.id}: ${task.title}
|
|
|
11508
11624
|
`));
|
|
11509
11625
|
output.log(`Status: ${chalk17.blue(task.status)} | Priority: ${task.priority} | Progress: ${task.progress}%`);
|
|
11510
11626
|
output.log(`Created: ${task.createdAt} | Updated: ${task.updatedAt}`);
|
|
11627
|
+
output.log(`Project Path: ${task.project_path}`);
|
|
11628
|
+
output.log(`Context: ${task.context}`);
|
|
11511
11629
|
if (task.current_status) {
|
|
11512
11630
|
output.log(`
|
|
11513
11631
|
Current Status: ${task.current_status}`);
|
|
@@ -11557,6 +11675,12 @@ var CreateCommand = {
|
|
|
11557
11675
|
}).option("tags", {
|
|
11558
11676
|
type: "string",
|
|
11559
11677
|
description: "标签 (逗号分隔)"
|
|
11678
|
+
}).option("project-path", {
|
|
11679
|
+
type: "string",
|
|
11680
|
+
description: "项目路径"
|
|
11681
|
+
}).option("context", {
|
|
11682
|
+
type: "string",
|
|
11683
|
+
description: "任务上下文 (JSON 字符串)"
|
|
11560
11684
|
}).option("json", { alias: "j", type: "boolean", default: false, description: "JSON 输出" }),
|
|
11561
11685
|
async handler(args) {
|
|
11562
11686
|
const output = new OutputService;
|
|
@@ -11582,7 +11706,9 @@ var CreateCommand = {
|
|
|
11582
11706
|
goals_and_expected_deliverables: args.goals,
|
|
11583
11707
|
due_date: args.due,
|
|
11584
11708
|
tags: args.tags ? args.tags.split(",").map((t) => t.trim()) : undefined,
|
|
11585
|
-
sessionId: currentSessionId
|
|
11709
|
+
sessionId: currentSessionId,
|
|
11710
|
+
project_path: args["project-path"] || process.cwd(),
|
|
11711
|
+
context: args.context || "{}"
|
|
11586
11712
|
};
|
|
11587
11713
|
const task = await taskComponent.createTask(createOptions);
|
|
11588
11714
|
if (args.json) {
|
|
@@ -11614,7 +11740,7 @@ var UpdateCommand = {
|
|
|
11614
11740
|
type: "number",
|
|
11615
11741
|
describe: "任务 ID",
|
|
11616
11742
|
demandOption: true
|
|
11617
|
-
}).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("progress", { type: "number", min: 0, max: 100, description: "进度 (0-100)" }).option("current_status", { alias: "c", type: "string", description: "当前状态描述" }).option("json", { alias: "j", type: "boolean", default: false, description: "JSON 输出" }),
|
|
11743
|
+
}).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("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 输出" }),
|
|
11618
11744
|
async handler(args) {
|
|
11619
11745
|
const output = new OutputService;
|
|
11620
11746
|
const envService = new EnvironmentService(output);
|
|
@@ -11638,7 +11764,9 @@ var UpdateCommand = {
|
|
|
11638
11764
|
status: args.status,
|
|
11639
11765
|
priority: args.priority,
|
|
11640
11766
|
progress: args.progress,
|
|
11641
|
-
current_status: args.current_status
|
|
11767
|
+
current_status: args.current_status,
|
|
11768
|
+
project_path: args["project-path"],
|
|
11769
|
+
context: args.context
|
|
11642
11770
|
};
|
|
11643
11771
|
const task = await taskComponent.updateTask(args.id, updateOptions);
|
|
11644
11772
|
if (!task) {
|
|
@@ -11666,6 +11794,8 @@ var UpdateCommand = {
|
|
|
11666
11794
|
output.log(` Status: ${task.status}`);
|
|
11667
11795
|
output.log(` Priority: ${task.priority}`);
|
|
11668
11796
|
output.log(` Progress: ${task.progress}%`);
|
|
11797
|
+
output.log(` Project Path: ${task.project_path}`);
|
|
11798
|
+
output.log(` Context: ${task.context}`);
|
|
11669
11799
|
if (task.current_status) {
|
|
11670
11800
|
output.log(` Current Status: ${task.current_status}`);
|
|
11671
11801
|
}
|
package/dist/index.js
CHANGED
|
@@ -7219,7 +7219,7 @@ var require_dist = __commonJS((exports) => {
|
|
|
7219
7219
|
var require_package = __commonJS((exports, module) => {
|
|
7220
7220
|
module.exports = {
|
|
7221
7221
|
name: "@ai-setting/roy-agent-cli",
|
|
7222
|
-
version: "1.5.
|
|
7222
|
+
version: "1.5.9",
|
|
7223
7223
|
type: "module",
|
|
7224
7224
|
description: "CLI for roy-agent - Non-interactive command execution",
|
|
7225
7225
|
main: "./dist/index.js",
|
|
@@ -7847,7 +7847,6 @@ class EnvironmentService {
|
|
|
7847
7847
|
data.renderedContent += `
|
|
7848
7848
|
|
|
7849
7849
|
` + commandsSection;
|
|
7850
|
-
this.output.log(`[Environment] Injected ${metaList.length} commands into default prompt`);
|
|
7851
7850
|
} catch (error) {
|
|
7852
7851
|
this.output.error(`Failed to inject commands into prompt: ${error}`);
|
|
7853
7852
|
}
|
|
@@ -8153,6 +8152,111 @@ __legacyDecorateClassTS([
|
|
|
8153
8152
|
|
|
8154
8153
|
// src/commands/act.ts
|
|
8155
8154
|
import { ContextError as ContextError2, ErrorCodes as ErrorCodes2, getTracerProvider as getTracerProvider2 } from "@ai-setting/roy-agent-core";
|
|
8155
|
+
|
|
8156
|
+
// src/commands/shared/task-event-handler.ts
|
|
8157
|
+
var TASK_EVENTS = {
|
|
8158
|
+
CREATED: "task.created",
|
|
8159
|
+
UPDATED: "task.updated",
|
|
8160
|
+
COMPLETED: "task.completed",
|
|
8161
|
+
DELETED: "task.deleted",
|
|
8162
|
+
OPERATION_ADDED: "task.operation_added",
|
|
8163
|
+
DELEGATED: "task.delegated"
|
|
8164
|
+
};
|
|
8165
|
+
|
|
8166
|
+
class TaskEventHandler {
|
|
8167
|
+
env;
|
|
8168
|
+
enabled;
|
|
8169
|
+
unsubscribe = null;
|
|
8170
|
+
constructor(options) {
|
|
8171
|
+
this.env = options.env;
|
|
8172
|
+
this.enabled = options.enabled ?? true;
|
|
8173
|
+
}
|
|
8174
|
+
start() {
|
|
8175
|
+
if (!this.enabled) {
|
|
8176
|
+
return () => {};
|
|
8177
|
+
}
|
|
8178
|
+
this.unsubscribe = this.env.subscribeAll((event) => {
|
|
8179
|
+
if (event.type.startsWith("task.")) {
|
|
8180
|
+
this.handleEvent(event);
|
|
8181
|
+
}
|
|
8182
|
+
});
|
|
8183
|
+
console.log("[TaskEventHandler] Started");
|
|
8184
|
+
return () => this.stop();
|
|
8185
|
+
}
|
|
8186
|
+
stop() {
|
|
8187
|
+
if (this.unsubscribe) {
|
|
8188
|
+
this.unsubscribe();
|
|
8189
|
+
this.unsubscribe = null;
|
|
8190
|
+
console.log("[TaskEventHandler] Stopped");
|
|
8191
|
+
}
|
|
8192
|
+
}
|
|
8193
|
+
handleEvent(event) {
|
|
8194
|
+
const payload = event.payload;
|
|
8195
|
+
switch (event.type) {
|
|
8196
|
+
case TASK_EVENTS.CREATED:
|
|
8197
|
+
this.logTaskCreated(payload);
|
|
8198
|
+
break;
|
|
8199
|
+
case TASK_EVENTS.UPDATED:
|
|
8200
|
+
this.logTaskUpdated(payload);
|
|
8201
|
+
break;
|
|
8202
|
+
case TASK_EVENTS.COMPLETED:
|
|
8203
|
+
this.logTaskCompleted(payload);
|
|
8204
|
+
break;
|
|
8205
|
+
case TASK_EVENTS.DELETED:
|
|
8206
|
+
this.logTaskDeleted(payload);
|
|
8207
|
+
break;
|
|
8208
|
+
case TASK_EVENTS.OPERATION_ADDED:
|
|
8209
|
+
this.logOperationAdded(payload);
|
|
8210
|
+
break;
|
|
8211
|
+
case TASK_EVENTS.DELEGATED:
|
|
8212
|
+
this.logTaskDelegated(payload);
|
|
8213
|
+
break;
|
|
8214
|
+
default:
|
|
8215
|
+
console.log(`[${event.type}]`, payload);
|
|
8216
|
+
}
|
|
8217
|
+
}
|
|
8218
|
+
logTaskCreated(payload) {
|
|
8219
|
+
const task = payload.task;
|
|
8220
|
+
console.log(`\uD83D\uDCDD Task created: #${task.id} - ${task.title}`);
|
|
8221
|
+
console.log(` Status: ${task.status}, Priority: ${task.priority}`);
|
|
8222
|
+
if (task.project_path) {
|
|
8223
|
+
console.log(` Project: ${task.project_path}`);
|
|
8224
|
+
}
|
|
8225
|
+
if (task.context) {
|
|
8226
|
+
console.log(` Context: ${task.context}`);
|
|
8227
|
+
}
|
|
8228
|
+
}
|
|
8229
|
+
logTaskUpdated(payload) {
|
|
8230
|
+
const task = payload.task;
|
|
8231
|
+
const changes = payload.changes;
|
|
8232
|
+
console.log(`✏️ Task updated: #${task.id} - ${task.title}`);
|
|
8233
|
+
console.log(` Status: ${task.status}, Progress: ${task.progress}%`);
|
|
8234
|
+
if (changes) {
|
|
8235
|
+
console.log(` Changes: ${JSON.stringify(changes)}`);
|
|
8236
|
+
}
|
|
8237
|
+
}
|
|
8238
|
+
logTaskCompleted(payload) {
|
|
8239
|
+
const task = payload.task;
|
|
8240
|
+
console.log(`✅ Task completed: #${task.id} - ${task.title}`);
|
|
8241
|
+
console.log(` Progress: ${task.progress}%, Updated: ${task.updatedAt}`);
|
|
8242
|
+
}
|
|
8243
|
+
logTaskDeleted(payload) {
|
|
8244
|
+
console.log(`\uD83D\uDDD1️ Task deleted: #${payload.taskId}`);
|
|
8245
|
+
}
|
|
8246
|
+
logOperationAdded(payload) {
|
|
8247
|
+
const op = payload.operation;
|
|
8248
|
+
console.log(`\uD83D\uDCCB Operation added to task #${payload.taskId}:`);
|
|
8249
|
+
console.log(` [${op.actionType}] ${op.actionTitle}`);
|
|
8250
|
+
console.log(` Session: ${op.sessionId}`);
|
|
8251
|
+
}
|
|
8252
|
+
logTaskDelegated(payload) {
|
|
8253
|
+
console.log(`\uD83D\uDE80 Task delegated: #${payload.taskId}`);
|
|
8254
|
+
console.log(` Background: ${payload.backgroundTaskId}, Type: ${payload.subagentType}`);
|
|
8255
|
+
console.log(` ${payload.description}`);
|
|
8256
|
+
}
|
|
8257
|
+
}
|
|
8258
|
+
|
|
8259
|
+
// src/commands/act.ts
|
|
8156
8260
|
var ActCommand = {
|
|
8157
8261
|
command: "act [message]",
|
|
8158
8262
|
describe: "自然语言交互 - 通过自然语言驱动整个操作系统",
|
|
@@ -8250,6 +8354,11 @@ var ActCommand = {
|
|
|
8250
8354
|
output.error("SessionComponent not available");
|
|
8251
8355
|
process.exit(1);
|
|
8252
8356
|
}
|
|
8357
|
+
const taskEventHandlerForCleanup = new TaskEventHandler({
|
|
8358
|
+
env,
|
|
8359
|
+
enabled: true
|
|
8360
|
+
});
|
|
8361
|
+
const stopTaskEventHandlerCleanup2 = taskEventHandlerForCleanup.start();
|
|
8253
8362
|
let sessionId = args.session;
|
|
8254
8363
|
let isNewSession = false;
|
|
8255
8364
|
if (args.continue && !sessionId) {
|
|
@@ -8457,6 +8566,9 @@ var ActCommand = {
|
|
|
8457
8566
|
}
|
|
8458
8567
|
process.exit(1);
|
|
8459
8568
|
} finally {
|
|
8569
|
+
if (typeof stopTaskEventHandlerCleanup === "function") {
|
|
8570
|
+
stopTaskEventHandlerCleanup();
|
|
8571
|
+
}
|
|
8460
8572
|
if (lspManagerDispose) {
|
|
8461
8573
|
await lspManagerDispose();
|
|
8462
8574
|
}
|
|
@@ -8720,12 +8832,12 @@ class QueryExecutor {
|
|
|
8720
8832
|
|
|
8721
8833
|
// src/commands/shared/event-message-formatter.ts
|
|
8722
8834
|
var TaskEventTypes = {
|
|
8723
|
-
TASK_STARTED: "task.started",
|
|
8724
|
-
TASK_PROGRESS: "task.progress",
|
|
8725
|
-
TASK_COMPLETED: "task.completed",
|
|
8726
|
-
TASK_FAILED: "task.failed",
|
|
8727
|
-
TASK_TIMEOUT: "task.timeout",
|
|
8728
|
-
TASK_STOPPED: "task.stopped"
|
|
8835
|
+
TASK_STARTED: "task.background.started",
|
|
8836
|
+
TASK_PROGRESS: "task.background.progress",
|
|
8837
|
+
TASK_COMPLETED: "task.background.completed",
|
|
8838
|
+
TASK_FAILED: "task.background.failed",
|
|
8839
|
+
TASK_TIMEOUT: "task.background.timeout",
|
|
8840
|
+
TASK_STOPPED: "task.background.stopped"
|
|
8729
8841
|
};
|
|
8730
8842
|
var EventSourceEventTypes = {
|
|
8731
8843
|
EVENT_SOURCE_STARTED: "event-source.started",
|
|
@@ -8787,7 +8899,7 @@ class EventMessageFormatter {
|
|
|
8787
8899
|
const time = payload.executionTimeMs ? `(${this.formatDuration(payload.executionTimeMs)})` : "";
|
|
8788
8900
|
let message = `${this.prefix} ✅ 后台任务「${desc}」已完成 ${time}`;
|
|
8789
8901
|
if (result) {
|
|
8790
|
-
const truncatedResult = result.length >
|
|
8902
|
+
const truncatedResult = result.length > 1e4 ? result.substring(0, 100) + "...[TRUNCATED]" : result;
|
|
8791
8903
|
message += `
|
|
8792
8904
|
结果: ${truncatedResult}`;
|
|
8793
8905
|
}
|
|
@@ -9682,7 +9794,7 @@ var InteractiveCommand = {
|
|
|
9682
9794
|
}, env);
|
|
9683
9795
|
const eventHandler = new EventHandler({
|
|
9684
9796
|
env,
|
|
9685
|
-
eventTypes: ["task.*", "event-source.event.*"],
|
|
9797
|
+
eventTypes: ["task.background.*", "event-source.event.*"],
|
|
9686
9798
|
formatter: new EventMessageFormatter({ prefix: "[通知]" }),
|
|
9687
9799
|
isIdle: () => repl.isIdle(),
|
|
9688
9800
|
onEvent: async (message) => {
|
|
@@ -11387,6 +11499,8 @@ var ListCommand2 = {
|
|
|
11387
11499
|
priority: t.priority,
|
|
11388
11500
|
progress: t.progress,
|
|
11389
11501
|
current_status: t.current_status,
|
|
11502
|
+
project_path: t.project_path,
|
|
11503
|
+
context: t.context,
|
|
11390
11504
|
createdAt: t.createdAt,
|
|
11391
11505
|
updatedAt: t.updatedAt
|
|
11392
11506
|
})),
|
|
@@ -11478,6 +11592,8 @@ Task #${result.task.id}: ${result.task.title}
|
|
|
11478
11592
|
`));
|
|
11479
11593
|
output.log(`Status: ${chalk17.blue(result.task.status)} | Priority: ${result.task.priority} | Progress: ${result.task.progress}%`);
|
|
11480
11594
|
output.log(`Created: ${result.task.createdAt} | Updated: ${result.task.updatedAt}`);
|
|
11595
|
+
output.log(`Project Path: ${result.task.project_path}`);
|
|
11596
|
+
output.log(`Context: ${result.task.context}`);
|
|
11481
11597
|
if (result.task.current_status) {
|
|
11482
11598
|
output.log(`
|
|
11483
11599
|
Current Status: ${result.task.current_status}`);
|
|
@@ -11507,6 +11623,8 @@ Task #${task.id}: ${task.title}
|
|
|
11507
11623
|
`));
|
|
11508
11624
|
output.log(`Status: ${chalk17.blue(task.status)} | Priority: ${task.priority} | Progress: ${task.progress}%`);
|
|
11509
11625
|
output.log(`Created: ${task.createdAt} | Updated: ${task.updatedAt}`);
|
|
11626
|
+
output.log(`Project Path: ${task.project_path}`);
|
|
11627
|
+
output.log(`Context: ${task.context}`);
|
|
11510
11628
|
if (task.current_status) {
|
|
11511
11629
|
output.log(`
|
|
11512
11630
|
Current Status: ${task.current_status}`);
|
|
@@ -11556,6 +11674,12 @@ var CreateCommand = {
|
|
|
11556
11674
|
}).option("tags", {
|
|
11557
11675
|
type: "string",
|
|
11558
11676
|
description: "标签 (逗号分隔)"
|
|
11677
|
+
}).option("project-path", {
|
|
11678
|
+
type: "string",
|
|
11679
|
+
description: "项目路径"
|
|
11680
|
+
}).option("context", {
|
|
11681
|
+
type: "string",
|
|
11682
|
+
description: "任务上下文 (JSON 字符串)"
|
|
11559
11683
|
}).option("json", { alias: "j", type: "boolean", default: false, description: "JSON 输出" }),
|
|
11560
11684
|
async handler(args) {
|
|
11561
11685
|
const output = new OutputService;
|
|
@@ -11581,7 +11705,9 @@ var CreateCommand = {
|
|
|
11581
11705
|
goals_and_expected_deliverables: args.goals,
|
|
11582
11706
|
due_date: args.due,
|
|
11583
11707
|
tags: args.tags ? args.tags.split(",").map((t) => t.trim()) : undefined,
|
|
11584
|
-
sessionId: currentSessionId
|
|
11708
|
+
sessionId: currentSessionId,
|
|
11709
|
+
project_path: args["project-path"] || process.cwd(),
|
|
11710
|
+
context: args.context || "{}"
|
|
11585
11711
|
};
|
|
11586
11712
|
const task = await taskComponent.createTask(createOptions);
|
|
11587
11713
|
if (args.json) {
|
|
@@ -11613,7 +11739,7 @@ var UpdateCommand = {
|
|
|
11613
11739
|
type: "number",
|
|
11614
11740
|
describe: "任务 ID",
|
|
11615
11741
|
demandOption: true
|
|
11616
|
-
}).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("progress", { type: "number", min: 0, max: 100, description: "进度 (0-100)" }).option("current_status", { alias: "c", type: "string", description: "当前状态描述" }).option("json", { alias: "j", type: "boolean", default: false, description: "JSON 输出" }),
|
|
11742
|
+
}).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("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 输出" }),
|
|
11617
11743
|
async handler(args) {
|
|
11618
11744
|
const output = new OutputService;
|
|
11619
11745
|
const envService = new EnvironmentService(output);
|
|
@@ -11637,7 +11763,9 @@ var UpdateCommand = {
|
|
|
11637
11763
|
status: args.status,
|
|
11638
11764
|
priority: args.priority,
|
|
11639
11765
|
progress: args.progress,
|
|
11640
|
-
current_status: args.current_status
|
|
11766
|
+
current_status: args.current_status,
|
|
11767
|
+
project_path: args["project-path"],
|
|
11768
|
+
context: args.context
|
|
11641
11769
|
};
|
|
11642
11770
|
const task = await taskComponent.updateTask(args.id, updateOptions);
|
|
11643
11771
|
if (!task) {
|
|
@@ -11665,6 +11793,8 @@ var UpdateCommand = {
|
|
|
11665
11793
|
output.log(` Status: ${task.status}`);
|
|
11666
11794
|
output.log(` Priority: ${task.priority}`);
|
|
11667
11795
|
output.log(` Progress: ${task.progress}%`);
|
|
11796
|
+
output.log(` Project Path: ${task.project_path}`);
|
|
11797
|
+
output.log(` Context: ${task.context}`);
|
|
11668
11798
|
if (task.current_status) {
|
|
11669
11799
|
output.log(` Current Status: ${task.current_status}`);
|
|
11670
11800
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-setting/roy-agent-cli",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.9",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "CLI for roy-agent - Non-interactive command execution",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -20,14 +20,7 @@
|
|
|
20
20
|
"dist/**/*",
|
|
21
21
|
"README.md"
|
|
22
22
|
],
|
|
23
|
-
"scripts": {
|
|
24
|
-
"build": "bunup",
|
|
25
|
-
"clean": "rm -rf dist",
|
|
26
|
-
"typecheck": "npx tsc --noEmit --skipLibCheck"
|
|
27
|
-
},
|
|
28
23
|
"dependencies": {
|
|
29
|
-
"@ai-setting/roy-agent-coder-harness": "workspace:*",
|
|
30
|
-
"@ai-setting/roy-agent-core": "workspace:*",
|
|
31
24
|
"chalk": "^5.6.2",
|
|
32
25
|
"commander": "^14.0.3",
|
|
33
26
|
"pyright": "^1.1.409",
|
|
@@ -36,7 +29,9 @@
|
|
|
36
29
|
"vscode-html-languageserver-bin": "^1.4.0",
|
|
37
30
|
"vscode-json-languageserver": "^1.3.4",
|
|
38
31
|
"yargs": "^17.7.2",
|
|
39
|
-
"zod-to-json-schema": "^3.25.2"
|
|
32
|
+
"zod-to-json-schema": "^3.25.2",
|
|
33
|
+
"@ai-setting/roy-agent-core": "1.5.9",
|
|
34
|
+
"@ai-setting/roy-agent-coder-harness": "1.5.9"
|
|
40
35
|
},
|
|
41
36
|
"devDependencies": {
|
|
42
37
|
"@types/node": "^20.10.0",
|
|
@@ -67,5 +62,10 @@
|
|
|
67
62
|
"license": "MIT",
|
|
68
63
|
"bugs": {
|
|
69
64
|
"url": "https://github.com/ai-setting/roy-agent/issues"
|
|
65
|
+
},
|
|
66
|
+
"scripts": {
|
|
67
|
+
"build": "bunup",
|
|
68
|
+
"clean": "rm -rf dist",
|
|
69
|
+
"typecheck": "npx tsc --noEmit --skipLibCheck"
|
|
70
70
|
}
|
|
71
|
-
}
|
|
71
|
+
}
|
|
Binary file
|