@ai-setting/roy-agent-core 1.7.1 → 1.7.2
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/env/index.js +2 -2
- package/dist/env/task/index.js +2 -2
- package/dist/env/task/tools/index.js +1 -1
- package/dist/index.js +2 -2
- package/dist/shared/@ai-setting/{roy-agent-core-hks28tys.js → roy-agent-core-k4byknt1.js} +37 -6
- package/dist/shared/@ai-setting/{roy-agent-core-8s7qyr5y.js → roy-agent-core-y9q3jdcx.js} +29 -6
- package/package.json +1 -1
package/dist/env/index.js
CHANGED
|
@@ -48,7 +48,7 @@ import"../shared/@ai-setting/roy-agent-core-t3yqzgse.js";
|
|
|
48
48
|
import"../shared/@ai-setting/roy-agent-core-e25xkv53.js";
|
|
49
49
|
import {
|
|
50
50
|
TaskComponent
|
|
51
|
-
} from "../shared/@ai-setting/roy-agent-core-
|
|
51
|
+
} from "../shared/@ai-setting/roy-agent-core-y9q3jdcx.js";
|
|
52
52
|
import"../shared/@ai-setting/roy-agent-core-amkqnyzy.js";
|
|
53
53
|
import"../shared/@ai-setting/roy-agent-core-8gxth0eh.js";
|
|
54
54
|
import"../shared/@ai-setting/roy-agent-core-50jdqb7r.js";
|
|
@@ -62,7 +62,7 @@ import {
|
|
|
62
62
|
getXDGPaths
|
|
63
63
|
} from "../shared/@ai-setting/roy-agent-core-qxnbvgwe.js";
|
|
64
64
|
import"../shared/@ai-setting/roy-agent-core-c1v263jn.js";
|
|
65
|
-
import"../shared/@ai-setting/roy-agent-core-
|
|
65
|
+
import"../shared/@ai-setting/roy-agent-core-k4byknt1.js";
|
|
66
66
|
import"../shared/@ai-setting/roy-agent-core-rn57psp0.js";
|
|
67
67
|
import"../shared/@ai-setting/roy-agent-core-1pg0fepg.js";
|
|
68
68
|
import {
|
package/dist/env/task/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
TaskPriorityEnum,
|
|
6
6
|
TaskStatusEnum,
|
|
7
7
|
TaskTypeEnum
|
|
8
|
-
} from "../../shared/@ai-setting/roy-agent-core-
|
|
8
|
+
} from "../../shared/@ai-setting/roy-agent-core-y9q3jdcx.js";
|
|
9
9
|
import"../../shared/@ai-setting/roy-agent-core-amkqnyzy.js";
|
|
10
10
|
import {
|
|
11
11
|
TaskEntityEventTypes
|
|
@@ -20,7 +20,7 @@ import"../../shared/@ai-setting/roy-agent-core-skqt40yy.js";
|
|
|
20
20
|
import"../../shared/@ai-setting/roy-agent-core-x0yztmm6.js";
|
|
21
21
|
import"../../shared/@ai-setting/roy-agent-core-qxnbvgwe.js";
|
|
22
22
|
import"../../shared/@ai-setting/roy-agent-core-c1v263jn.js";
|
|
23
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
23
|
+
import"../../shared/@ai-setting/roy-agent-core-k4byknt1.js";
|
|
24
24
|
import"../../shared/@ai-setting/roy-agent-core-rn57psp0.js";
|
|
25
25
|
import"../../shared/@ai-setting/roy-agent-core-1pg0fepg.js";
|
|
26
26
|
import"../../shared/@ai-setting/roy-agent-core-7hh0brvs.js";
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
searchTasksTool,
|
|
10
10
|
treeTasksTool,
|
|
11
11
|
updateTaskTool
|
|
12
|
-
} from "../../../shared/@ai-setting/roy-agent-core-
|
|
12
|
+
} from "../../../shared/@ai-setting/roy-agent-core-k4byknt1.js";
|
|
13
13
|
import"../../../shared/@ai-setting/roy-agent-core-xrr7t0qc.js";
|
|
14
14
|
import"../../../shared/@ai-setting/roy-agent-core-gb7pm9c0.js";
|
|
15
15
|
import"../../../shared/@ai-setting/roy-agent-core-kaq037np.js";
|
package/dist/index.js
CHANGED
|
@@ -145,7 +145,7 @@ import {
|
|
|
145
145
|
} from "./shared/@ai-setting/roy-agent-core-e25xkv53.js";
|
|
146
146
|
import {
|
|
147
147
|
TaskComponent
|
|
148
|
-
} from "./shared/@ai-setting/roy-agent-core-
|
|
148
|
+
} from "./shared/@ai-setting/roy-agent-core-y9q3jdcx.js";
|
|
149
149
|
import"./shared/@ai-setting/roy-agent-core-amkqnyzy.js";
|
|
150
150
|
import"./shared/@ai-setting/roy-agent-core-8gxth0eh.js";
|
|
151
151
|
import"./shared/@ai-setting/roy-agent-core-50jdqb7r.js";
|
|
@@ -167,7 +167,7 @@ import {
|
|
|
167
167
|
getXDGPaths
|
|
168
168
|
} from "./shared/@ai-setting/roy-agent-core-qxnbvgwe.js";
|
|
169
169
|
import"./shared/@ai-setting/roy-agent-core-c1v263jn.js";
|
|
170
|
-
import"./shared/@ai-setting/roy-agent-core-
|
|
170
|
+
import"./shared/@ai-setting/roy-agent-core-k4byknt1.js";
|
|
171
171
|
import"./shared/@ai-setting/roy-agent-core-rn57psp0.js";
|
|
172
172
|
import {
|
|
173
173
|
TaskHookPoints
|
|
@@ -72,6 +72,10 @@ var UpdateTaskToolSchema = z.object({
|
|
|
72
72
|
var DeleteTaskToolSchema = z.object({
|
|
73
73
|
task_id: z.number().describe("Task ID")
|
|
74
74
|
});
|
|
75
|
+
var CompleteTaskToolSchema = z.object({
|
|
76
|
+
task_id: z.number().describe("Task ID"),
|
|
77
|
+
deliverable_storage_path: z.string().optional().describe("交付物的寻址地址(路径 / URL / 分支名等)。" + "调用本工具前,请先读取任务的 goal(description)和 delivery(goals_and_expected_deliverables)栏位," + "建议验证目标和交付物是否符合预期,然后将实际交付物的寻址地址填入此参数。")
|
|
78
|
+
});
|
|
75
79
|
var BatchArchiveToolSchema = z.object({
|
|
76
80
|
task_ids: z.array(z.number()).describe("要归档的任务 ID 列表"),
|
|
77
81
|
reason: z.string().optional().describe("归档原因(可选,会写入每个任务的 operation 记录)")
|
|
@@ -817,13 +821,38 @@ function deleteTaskTool(taskComponent) {
|
|
|
817
821
|
init_env_context();
|
|
818
822
|
init_logger();
|
|
819
823
|
var logger4 = createLogger("task:tools:complete");
|
|
824
|
+
var TASK_COMPLETE_DESCRIPTION = `
|
|
825
|
+
Mark a task as completed (progress=100, status=completed). Creates an operation record.
|
|
826
|
+
|
|
827
|
+
**Before calling this tool**, you MUST:
|
|
828
|
+
|
|
829
|
+
1. Read the task's \`goal\` (description) and \`delivery\` (goals_and_expected_deliverables) fields.
|
|
830
|
+
- Use \`task_get(task_id=<id>)\` to fetch the full task record.
|
|
831
|
+
2. **Validate** whether the goal and delivery match what you actually delivered.
|
|
832
|
+
- If mismatch, either: (a) extend the task via \`task_update\`, or (b) honestly note the discrepancy in your final report.
|
|
833
|
+
3. **Provide \`deliverable_storage_path\`** parameter with the deliverable's address:
|
|
834
|
+
- Feishu doc URL (e.g., https://my.feishu.cn/docx/abc)
|
|
835
|
+
- Local file path (e.g., /tmp/report.md)
|
|
836
|
+
- Git branch or worktree path (e.g., feature/my-feature)
|
|
837
|
+
- GitHub commit URL or PR URL
|
|
838
|
+
- Cloud drive URL (e.g., https://my.feishu.cn/file/abc)
|
|
839
|
+
- Or any other locator that points to where the work product lives
|
|
840
|
+
|
|
841
|
+
The \`deliverable_storage_path\` will be persisted to the task's \`context.deliverable_storage_path\` for future reference and traceability.
|
|
842
|
+
|
|
843
|
+
**Restrictions**:
|
|
844
|
+
- Cannot complete cycle-type tasks (they are periodic). Use \`task_update\` to reset progress instead.
|
|
845
|
+
- Marks the task as 100% complete; use \`task_update\` to record partial progress first if needed.
|
|
846
|
+
|
|
847
|
+
**Backward compatibility**: \`deliverable_storage_path\` is optional. Existing callers that omit it continue to work as before.
|
|
848
|
+
`.trim();
|
|
820
849
|
function completeTaskTool(taskComponent) {
|
|
821
850
|
return {
|
|
822
851
|
name: "task_complete",
|
|
823
|
-
description:
|
|
824
|
-
parameters:
|
|
852
|
+
description: TASK_COMPLETE_DESCRIPTION,
|
|
853
|
+
parameters: CompleteTaskToolSchema,
|
|
825
854
|
execute: async (args, ctx) => {
|
|
826
|
-
const params =
|
|
855
|
+
const params = CompleteTaskToolSchema.parse(args);
|
|
827
856
|
const sessionId = ctx.session_id || "unknown";
|
|
828
857
|
try {
|
|
829
858
|
const currentTask = await taskComponent.getTask(params.task_id);
|
|
@@ -843,7 +872,7 @@ function completeTaskTool(taskComponent) {
|
|
|
843
872
|
metadata: { execution_time_ms: 0 }
|
|
844
873
|
};
|
|
845
874
|
}
|
|
846
|
-
const task = await taskComponent.completeTask(params.task_id, sessionId);
|
|
875
|
+
const task = await taskComponent.completeTask(params.task_id, sessionId, params.deliverable_storage_path);
|
|
847
876
|
if (!task) {
|
|
848
877
|
return {
|
|
849
878
|
success: false,
|
|
@@ -853,10 +882,12 @@ function completeTaskTool(taskComponent) {
|
|
|
853
882
|
};
|
|
854
883
|
}
|
|
855
884
|
setCurrentTaskId(undefined);
|
|
856
|
-
logger4.info(`[completeTask] Trace: Task #${params.task_id} completed, currentTaskId cleared from EnvContext`);
|
|
885
|
+
logger4.info(`[completeTask] Trace: Task #${params.task_id} completed, deliverable=${params.deliverable_storage_path || "(none)"}, currentTaskId cleared from EnvContext`);
|
|
857
886
|
return {
|
|
858
887
|
success: true,
|
|
859
|
-
output: `Task completed: #${task.id} - ${task.title}
|
|
888
|
+
output: params.deliverable_storage_path ? `Task completed: #${task.id} - ${task.title}
|
|
889
|
+
Deliverable (context + operation): ${params.deliverable_storage_path}` : `Task completed: #${task.id} - ${task.title}
|
|
890
|
+
Deliverable: (no path provided)`,
|
|
860
891
|
metadata: { execution_time_ms: 0, task }
|
|
861
892
|
};
|
|
862
893
|
} catch (error) {
|
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
searchTasksTool,
|
|
25
25
|
treeTasksTool,
|
|
26
26
|
updateTaskTool
|
|
27
|
-
} from "./roy-agent-core-
|
|
27
|
+
} from "./roy-agent-core-k4byknt1.js";
|
|
28
28
|
import {
|
|
29
29
|
createOperationTool,
|
|
30
30
|
deleteOperationTool,
|
|
@@ -182,6 +182,12 @@ class DefaultTagService {
|
|
|
182
182
|
// src/env/task/task-component.ts
|
|
183
183
|
init_decorator();
|
|
184
184
|
var logger2 = createLogger("task");
|
|
185
|
+
var DELIVERABLE_OPERATION_PREFIX = "Deliverable: ";
|
|
186
|
+
function formatDeliverableForOperation(deliverableStoragePath) {
|
|
187
|
+
if (!deliverableStoragePath)
|
|
188
|
+
return;
|
|
189
|
+
return `${DELIVERABLE_OPERATION_PREFIX}${deliverableStoragePath}`;
|
|
190
|
+
}
|
|
185
191
|
|
|
186
192
|
class TaskComponent extends BaseComponent {
|
|
187
193
|
name = "task";
|
|
@@ -489,24 +495,41 @@ class TaskComponent extends BaseComponent {
|
|
|
489
495
|
async getChildTasks(taskId, options) {
|
|
490
496
|
return this.store.getChildTasks(taskId, options);
|
|
491
497
|
}
|
|
492
|
-
async completeTask(id, sessionId) {
|
|
498
|
+
async completeTask(id, sessionId, deliverableStoragePath) {
|
|
493
499
|
const existing = await this.store.getTask(id);
|
|
494
500
|
if (existing && existing.type === "cycle") {
|
|
495
501
|
throw new Error(`Cannot complete cycle task: #${id} - ${existing.title}. Cycle tasks are not meant to be completed.`);
|
|
496
502
|
}
|
|
497
|
-
const
|
|
503
|
+
const updateOptions = {
|
|
498
504
|
status: "completed",
|
|
499
505
|
progress: 100
|
|
500
|
-
}
|
|
506
|
+
};
|
|
507
|
+
if (deliverableStoragePath) {
|
|
508
|
+
let existingContext = {};
|
|
509
|
+
if (existing?.context) {
|
|
510
|
+
try {
|
|
511
|
+
const parsed = JSON.parse(existing.context);
|
|
512
|
+
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
513
|
+
existingContext = parsed;
|
|
514
|
+
}
|
|
515
|
+
} catch {
|
|
516
|
+
logger2.warn(`[TaskComponent] Task #${id} context is not valid JSON, ignoring when merging deliverable`);
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
existingContext.deliverable_storage_path = deliverableStoragePath;
|
|
520
|
+
updateOptions.context = JSON.stringify(existingContext);
|
|
521
|
+
}
|
|
522
|
+
const task = await this.updateTask(id, updateOptions);
|
|
501
523
|
if (task) {
|
|
502
524
|
await this.createOperation({
|
|
503
525
|
taskId: id,
|
|
504
526
|
sessionId,
|
|
505
527
|
milestoneType: "completed",
|
|
506
|
-
milestoneTitle: "Task completed"
|
|
528
|
+
milestoneTitle: "Task completed",
|
|
529
|
+
milestoneDescription: formatDeliverableForOperation(deliverableStoragePath)
|
|
507
530
|
});
|
|
508
531
|
this.publishEvent(TaskEntityEventTypes.COMPLETED, { task, sessionId }, sessionId);
|
|
509
|
-
logger2.info(`[TaskComponent] Task completed: ${id}`);
|
|
532
|
+
logger2.info(`[TaskComponent] Task completed: ${id}, deliverable=${deliverableStoragePath || "(none)"}`);
|
|
510
533
|
}
|
|
511
534
|
return task;
|
|
512
535
|
}
|