@ai-setting/roy-agent-core 1.7.66 → 1.7.67
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/agent/agent-component.d.ts +29 -0
- package/dist/env/agent/agent-component.js +1 -1
- package/dist/env/agent/index.js +1 -1
- package/dist/env/agent/types.d.ts +16 -0
- package/dist/env/environment.d.ts +13 -0
- package/dist/env/event-source/event-source-handlers.js +4 -3
- package/dist/env/event-source/index.js +5 -4
- package/dist/env/event-source/timer-handler.d.ts +93 -1
- package/dist/env/index.js +10 -9
- package/dist/env/prompt/index.js +3 -2
- package/dist/env/prompt/prompts-index.d.ts +2 -7
- package/dist/env/task/delegate/delegate-tool.d.ts +21 -1
- package/dist/env/task/delegate/delegate-tool.js +3 -2
- package/dist/env/task/delegate/index.js +3 -2
- package/dist/env/task/index.js +5 -4
- package/dist/env/task/mcp/index.js +2 -1
- package/dist/env/task/plugins/__e2e__/laya-completion-e2e.d.ts +16 -0
- package/dist/env/task/plugins/index.js +3 -2
- package/dist/env/task/plugins/laya-completion-plugin.d.ts +133 -0
- package/dist/env/task/plugins/laya-port.d.ts +23 -0
- package/dist/env/task/task-component.d.ts +43 -0
- package/dist/env/task/tools/completion-copy.d.ts +27 -0
- package/dist/env/task/tools/index.js +2 -1
- package/dist/index.js +11 -10
- package/dist/shared/@ai-setting/{roy-agent-core-nr2m4xw1.js → roy-agent-core-1k83dq3a.js} +13 -3
- package/dist/shared/@ai-setting/{roy-agent-core-4882qsjx.js → roy-agent-core-1kxf910n.js} +1 -1
- package/dist/shared/@ai-setting/roy-agent-core-6m4bw8jy.js +6 -0
- package/dist/shared/@ai-setting/roy-agent-core-8zas6w5q.js +1083 -0
- package/dist/shared/@ai-setting/{roy-agent-core-v8bz7d8x.js → roy-agent-core-b7jbqfsy.js} +24 -10
- package/dist/shared/@ai-setting/{roy-agent-core-2wxbx36p.js → roy-agent-core-dnjm17sa.js} +21 -2
- package/dist/shared/@ai-setting/{roy-agent-core-t0ktaevq.js → roy-agent-core-h5vmff8w.js} +60 -4
- package/dist/shared/@ai-setting/{roy-agent-core-j1kksatb.js → roy-agent-core-hfr6bzts.js} +67 -10
- package/dist/shared/@ai-setting/{roy-agent-core-8nksrtnf.js → roy-agent-core-k4ps1hxp.js} +201 -16
- package/dist/shared/@ai-setting/{roy-agent-core-vs5gxgwh.js → roy-agent-core-ma35jyd9.js} +14 -3
- package/dist/shared/@ai-setting/{roy-agent-core-cvm1xgmg.js → roy-agent-core-wksgtqf9.js} +1 -1
- package/package.json +1 -1
- package/dist/shared/@ai-setting/roy-agent-core-8mjnb7xc.js +0 -654
|
@@ -131,6 +131,17 @@ export interface LayaAuthConfig {
|
|
|
131
131
|
apiKey: string;
|
|
132
132
|
model: string;
|
|
133
133
|
}
|
|
134
|
+
/**
|
|
135
|
+
* Task #4804 — provider 名常量(provider 分离):
|
|
136
|
+
* - create hook(task:before.create,判新建 vs 复用)→ laya-decision
|
|
137
|
+
* - completion hook(task:after.complete,判目标 vs 交付物)→ laya-goal-decision
|
|
138
|
+
* (缺失时保守回退 laya-decision —— fail-open 语义不变)
|
|
139
|
+
*/
|
|
140
|
+
export declare const LAYA_DECISION_PROVIDER = "laya-decision";
|
|
141
|
+
export declare const LAYA_GOAL_DECISION_PROVIDER = "laya-goal-decision";
|
|
142
|
+
/** hook 用途 → provider 名(Task #4804 provider 分离的唯一映射点) */
|
|
143
|
+
export type LayaHookPurpose = "create" | "goal";
|
|
144
|
+
export declare function providerNameForPurpose(purpose: LayaHookPurpose): string;
|
|
134
145
|
/**
|
|
135
146
|
* 从 `~/.roy-agent/auth.json` 的 `providers["laya-decision"]` 读取端点配置。
|
|
136
147
|
*
|
|
@@ -139,5 +150,17 @@ export interface LayaAuthConfig {
|
|
|
139
150
|
* → providers["laya-decision"].model(可选)
|
|
140
151
|
*
|
|
141
152
|
* ⚠️ 读不到就返回 null —— 调用方必须 fail-open(不提示、不报错)。
|
|
153
|
+
*
|
|
154
|
+
* Task #4804 — 向后兼容:默认仍读 laya-decision(create hook 语义)。
|
|
155
|
+
* completion hook 侧请用 `loadLayaAuthForPurpose(path, "goal")`。
|
|
142
156
|
*/
|
|
143
157
|
export declare function loadLayaAuth(authPath?: string): Promise<LayaAuthConfig | null>;
|
|
158
|
+
/**
|
|
159
|
+
* Task #4804 — 按用途读 provider:
|
|
160
|
+
* - "create" → providers["laya-decision"]
|
|
161
|
+
* - "goal" → providers["laya-goal-decision"],缺失时保守回退
|
|
162
|
+
* providers["laya-decision"](共享共享配置,fail-open 不变)
|
|
163
|
+
*
|
|
164
|
+
* ⚠️ 读不到就返回 null —— 调用方必须 fail-open(不提示、不报错)。
|
|
165
|
+
*/
|
|
166
|
+
export declare function loadLayaAuthForPurpose(authPath?: string, purpose?: LayaHookPurpose): Promise<LayaAuthConfig | null>;
|
|
@@ -41,6 +41,21 @@ export interface TaskComponentOptions {
|
|
|
41
41
|
envPrefix?: string;
|
|
42
42
|
/** 直接传入的配置对象(可选,优先级最高) */
|
|
43
43
|
config?: Partial<TaskConfig>;
|
|
44
|
+
/**
|
|
45
|
+
* Task #4794 — 组件 stop() 时 BackgroundTaskManager.dispose() 的收尾行为。
|
|
46
|
+
*
|
|
47
|
+
* CLI `act` 一次性命令收尾时传 true(主 run 已结束,后台子 agent
|
|
48
|
+
* 是有意留下继续跑的);REPL / ESC cascade 等用户主动退出场景
|
|
49
|
+
* 保持默认 false(abort 全部,语义不变)。
|
|
50
|
+
*/
|
|
51
|
+
skipAbortRunningTasksOnDispose?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Task #4794 — 与 skipAbortRunningTasksOnDispose 配套:
|
|
54
|
+
* stop() 时等待运行中的后台任务完成后再返回。
|
|
55
|
+
* 子 agent 是同进程异步 run,进程 exit 会直接杀死它们,
|
|
56
|
+
* 所以 act 收尾必须等待。默认 false。
|
|
57
|
+
*/
|
|
58
|
+
waitForRunningTasksOnDispose?: boolean;
|
|
44
59
|
}
|
|
45
60
|
export declare class TaskComponent extends BaseComponent {
|
|
46
61
|
name: string;
|
|
@@ -49,6 +64,17 @@ export declare class TaskComponent extends BaseComponent {
|
|
|
49
64
|
private config?;
|
|
50
65
|
private toolComponent?;
|
|
51
66
|
private backgroundTaskManager?;
|
|
67
|
+
/**
|
|
68
|
+
* Task #4794 — stop() 时是否跳过 abort 仍在运行的后台任务
|
|
69
|
+
* (act 一次性命令收尾 = true;用户主动退出 = false 默认)。
|
|
70
|
+
*/
|
|
71
|
+
private skipAbortRunningTasksOnDispose;
|
|
72
|
+
/**
|
|
73
|
+
* Task #4794 — stop() 时是否等待运行中任务完成
|
|
74
|
+
* (act 收尾配套:跳过 abort 后必须等子 agent 跑完,
|
|
75
|
+
* 否则 process.exit 仍会杀死同进程子 agent)。
|
|
76
|
+
*/
|
|
77
|
+
private waitForRunningTasksOnDispose;
|
|
52
78
|
private configComponent?;
|
|
53
79
|
private tagService;
|
|
54
80
|
private plugins;
|
|
@@ -235,6 +261,23 @@ export declare class TaskComponent extends BaseComponent {
|
|
|
235
261
|
* @returns 更新后的 Task 或 undefined
|
|
236
262
|
*/
|
|
237
263
|
completeTask(id: number, sessionId: string, deliverableStoragePath?: string): Promise<Task | undefined>;
|
|
264
|
+
/**
|
|
265
|
+
* 直接更新任务 context(不触发 BEFORE/AFTER_UPDATE hook、不发事件)
|
|
266
|
+
*
|
|
267
|
+
* ★ Task #4776 review MINOR-1:AFTER_COMPLETE hook 内的嵌套
|
|
268
|
+
* updateTask({context}) 会二次 fire AFTER_UPDATE,把订阅者
|
|
269
|
+
* (LarkCliTaskNotifyHook 等)无谓拉起 —— 终态任务被再次走
|
|
270
|
+
* cardStatusOf 终态路径。hint 回写这类「内部簿记」不应有通知副作用,
|
|
271
|
+
* 因此提供本方法绕过 hook 链,直接走 store 层。
|
|
272
|
+
*
|
|
273
|
+
* 语义与 updateTask({context}) 完全一致:整份覆盖 context 字段。
|
|
274
|
+
* 调用方负责自己 merge 既有字段(不要拿快照整份覆盖别人写的内容)。
|
|
275
|
+
*
|
|
276
|
+
* @param id 任务 ID
|
|
277
|
+
* @param context 新的 context JSON 字符串(整份覆盖)
|
|
278
|
+
* @returns 更新后的 Task,任务不存在时返回 undefined
|
|
279
|
+
*/
|
|
280
|
+
updateTaskContext(id: number, context: string): Promise<Task | undefined>;
|
|
238
281
|
/**
|
|
239
282
|
* Create operation record
|
|
240
283
|
*/
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Task #4834 — F3: task_complete 验收文案同源锚点
|
|
3
|
+
*
|
|
4
|
+
* 背景(reports/goals-criteria-rules-e2e-rebase.md §遗留 F3):
|
|
5
|
+
* prompts-index.ts 的 COMPLETE 生命周期步骤与工具描述
|
|
6
|
+
* (TASK_COMPLETE_DESCRIPTION)**不同源** —— 文案漂移会
|
|
7
|
+
* 稀释工具描述的遵循度。
|
|
8
|
+
*
|
|
9
|
+
* 方案:三个关键短语定义于此,complete-tool 与
|
|
10
|
+
* prompts-index(default prompt)都引用同一常量,
|
|
11
|
+
* 文案一致性由 completion-copy-consistency.test.ts 守住。
|
|
12
|
+
*
|
|
13
|
+
* ⚠️ 本模块必须保持**零依赖**(不 import 任何其他模块),
|
|
14
|
+
* 以便 prompts-index(超大模板串)与 tools 层都能安全引用。
|
|
15
|
+
*/
|
|
16
|
+
/** 逐条验收短语(工具描述 / default prompt 共用) */
|
|
17
|
+
export declare const TASK_COMPLETE_ITEM_BY_ITEM = "\u6309\u5B50\u9879\u9010\u6761\u9A8C\u6536";
|
|
18
|
+
/** hint 锚点 token(completion hook 写入 task context 的标记) */
|
|
19
|
+
export declare const TASK_COMPLETION_HINT_ANCHOR = "TASK_COMPLETION_HINT";
|
|
20
|
+
/** 核实义务短语(收到 hint 后必须核实,二选一) */
|
|
21
|
+
export declare const TASK_COMPLETE_VERIFY_DUTY = "\u6838\u5B9E\u4E49\u52A1";
|
|
22
|
+
/** F3 同源文案集合(聚合导出,便于测试解构) */
|
|
23
|
+
export declare const TASK_COMPLETE_ACCEPTANCE: {
|
|
24
|
+
readonly itemByItem: "按子项逐条验收";
|
|
25
|
+
readonly hintAnchor: "TASK_COMPLETION_HINT";
|
|
26
|
+
readonly verifyDuty: "核实义务";
|
|
27
|
+
};
|
|
@@ -9,8 +9,9 @@ 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-h5vmff8w.js";
|
|
13
13
|
import"../../../shared/@ai-setting/roy-agent-core-tr3ep81v.js";
|
|
14
|
+
import"../../../shared/@ai-setting/roy-agent-core-6m4bw8jy.js";
|
|
14
15
|
import"../../../shared/@ai-setting/roy-agent-core-7cbpmk4q.js";
|
|
15
16
|
import"../../../shared/@ai-setting/roy-agent-core-qq96p0tj.js";
|
|
16
17
|
import"../../../shared/@ai-setting/roy-agent-core-7f7t9wwp.js";
|
package/dist/index.js
CHANGED
|
@@ -31,7 +31,7 @@ import"./shared/@ai-setting/roy-agent-core-adg9ghbt.js";
|
|
|
31
31
|
import {
|
|
32
32
|
PromptComponent,
|
|
33
33
|
PromptStore
|
|
34
|
-
} from "./shared/@ai-setting/roy-agent-core-
|
|
34
|
+
} from "./shared/@ai-setting/roy-agent-core-wksgtqf9.js";
|
|
35
35
|
import {
|
|
36
36
|
MemoryComponent
|
|
37
37
|
} from "./shared/@ai-setting/roy-agent-core-nwbfepba.js";
|
|
@@ -61,21 +61,21 @@ import {
|
|
|
61
61
|
BaseEnvironment,
|
|
62
62
|
generateDescendingId,
|
|
63
63
|
generateId
|
|
64
|
-
} from "./shared/@ai-setting/roy-agent-core-
|
|
64
|
+
} from "./shared/@ai-setting/roy-agent-core-8zas6w5q.js";
|
|
65
65
|
import {
|
|
66
66
|
TaskComponent
|
|
67
|
-
} from "./shared/@ai-setting/roy-agent-core-
|
|
67
|
+
} from "./shared/@ai-setting/roy-agent-core-1k83dq3a.js";
|
|
68
68
|
import"./shared/@ai-setting/roy-agent-core-58804s3j.js";
|
|
69
69
|
import"./shared/@ai-setting/roy-agent-core-jm136jzh.js";
|
|
70
|
-
import"./shared/@ai-setting/roy-agent-core-
|
|
70
|
+
import"./shared/@ai-setting/roy-agent-core-dnjm17sa.js";
|
|
71
71
|
import"./shared/@ai-setting/roy-agent-core-fttgm52a.js";
|
|
72
72
|
import"./shared/@ai-setting/roy-agent-core-ntq0gz7q.js";
|
|
73
73
|
import"./shared/@ai-setting/roy-agent-core-8gxth0eh.js";
|
|
74
|
-
import"./shared/@ai-setting/roy-agent-core-
|
|
74
|
+
import"./shared/@ai-setting/roy-agent-core-h5vmff8w.js";
|
|
75
75
|
import"./shared/@ai-setting/roy-agent-core-p5cz9m8v.js";
|
|
76
76
|
import {
|
|
77
77
|
EventSourceComponent
|
|
78
|
-
} from "./shared/@ai-setting/roy-agent-core-
|
|
78
|
+
} from "./shared/@ai-setting/roy-agent-core-1kxf910n.js";
|
|
79
79
|
import {
|
|
80
80
|
BountyIMInstance,
|
|
81
81
|
COMMAND_PREFIX,
|
|
@@ -107,7 +107,7 @@ import {
|
|
|
107
107
|
timerHandler,
|
|
108
108
|
translateCardActionToCommand,
|
|
109
109
|
writeFallbackModelList
|
|
110
|
-
} from "./shared/@ai-setting/roy-agent-core-
|
|
110
|
+
} from "./shared/@ai-setting/roy-agent-core-k4ps1hxp.js";
|
|
111
111
|
import {
|
|
112
112
|
BUILT_IN_EVENT_SOURCE_TYPES,
|
|
113
113
|
BUILT_IN_EVENT_SOURCE_TYPE_LIST,
|
|
@@ -132,7 +132,7 @@ import {
|
|
|
132
132
|
import {
|
|
133
133
|
TaskTagPlugin,
|
|
134
134
|
createAutoTaskPlugin
|
|
135
|
-
} from "./shared/@ai-setting/roy-agent-core-
|
|
135
|
+
} from "./shared/@ai-setting/roy-agent-core-b7jbqfsy.js";
|
|
136
136
|
import {
|
|
137
137
|
EventStoreImpl,
|
|
138
138
|
getSharedEventStore,
|
|
@@ -149,8 +149,9 @@ import {
|
|
|
149
149
|
import {
|
|
150
150
|
getBuiltInPrompt,
|
|
151
151
|
getBuiltInPromptNames
|
|
152
|
-
} from "./shared/@ai-setting/roy-agent-core-
|
|
152
|
+
} from "./shared/@ai-setting/roy-agent-core-ma35jyd9.js";
|
|
153
153
|
import"./shared/@ai-setting/roy-agent-core-tr3ep81v.js";
|
|
154
|
+
import"./shared/@ai-setting/roy-agent-core-6m4bw8jy.js";
|
|
154
155
|
import"./shared/@ai-setting/roy-agent-core-0ys85x46.js";
|
|
155
156
|
import"./shared/@ai-setting/roy-agent-core-zk2jg0v7.js";
|
|
156
157
|
import {
|
|
@@ -199,7 +200,7 @@ import"./shared/@ai-setting/roy-agent-core-jagkferh.js";
|
|
|
199
200
|
import {
|
|
200
201
|
AgentComponent,
|
|
201
202
|
AgentComponentConfigSchema
|
|
202
|
-
} from "./shared/@ai-setting/roy-agent-core-
|
|
203
|
+
} from "./shared/@ai-setting/roy-agent-core-hfr6bzts.js";
|
|
203
204
|
import {
|
|
204
205
|
ToolComponent,
|
|
205
206
|
ToolRegistry,
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
import {
|
|
8
8
|
BackgroundTaskManager,
|
|
9
9
|
createDelegateTool
|
|
10
|
-
} from "./roy-agent-core-
|
|
10
|
+
} from "./roy-agent-core-dnjm17sa.js";
|
|
11
11
|
import {
|
|
12
12
|
TaskEntityEventTypes
|
|
13
13
|
} from "./roy-agent-core-8gxth0eh.js";
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
searchTasksTool,
|
|
23
23
|
treeTasksTool,
|
|
24
24
|
updateTaskTool
|
|
25
|
-
} from "./roy-agent-core-
|
|
25
|
+
} from "./roy-agent-core-h5vmff8w.js";
|
|
26
26
|
import {
|
|
27
27
|
createOperationTool,
|
|
28
28
|
deleteOperationTool,
|
|
@@ -198,6 +198,8 @@ class TaskComponent extends BaseComponent {
|
|
|
198
198
|
config;
|
|
199
199
|
toolComponent;
|
|
200
200
|
backgroundTaskManager;
|
|
201
|
+
skipAbortRunningTasksOnDispose = false;
|
|
202
|
+
waitForRunningTasksOnDispose = false;
|
|
201
203
|
configComponent;
|
|
202
204
|
tagService;
|
|
203
205
|
plugins = new Map;
|
|
@@ -227,6 +229,8 @@ class TaskComponent extends BaseComponent {
|
|
|
227
229
|
throw new Error("ConfigComponent is required for TaskComponent initialization");
|
|
228
230
|
}
|
|
229
231
|
this.configComponent = options.configComponent;
|
|
232
|
+
this.skipAbortRunningTasksOnDispose = options.skipAbortRunningTasksOnDispose === true;
|
|
233
|
+
this.waitForRunningTasksOnDispose = options.waitForRunningTasksOnDispose === true;
|
|
230
234
|
await this.registerConfig(options);
|
|
231
235
|
this.setStatus("running");
|
|
232
236
|
logger2.info("[TaskComponent] Initialized");
|
|
@@ -350,7 +354,10 @@ class TaskComponent extends BaseComponent {
|
|
|
350
354
|
}
|
|
351
355
|
}
|
|
352
356
|
if (this.backgroundTaskManager) {
|
|
353
|
-
this.backgroundTaskManager.dispose(
|
|
357
|
+
await this.backgroundTaskManager.dispose(this.skipAbortRunningTasksOnDispose ? {
|
|
358
|
+
skipAbortRunningTasks: true,
|
|
359
|
+
waitForRunningTasks: this.waitForRunningTasksOnDispose
|
|
360
|
+
} : undefined);
|
|
354
361
|
this.backgroundTaskManager = undefined;
|
|
355
362
|
}
|
|
356
363
|
if (this.store) {
|
|
@@ -539,6 +546,9 @@ class TaskComponent extends BaseComponent {
|
|
|
539
546
|
}
|
|
540
547
|
return task;
|
|
541
548
|
}
|
|
549
|
+
async updateTaskContext(id, context) {
|
|
550
|
+
return this.store.updateTask(id, { context });
|
|
551
|
+
}
|
|
542
552
|
async createOperation(options) {
|
|
543
553
|
const createCtx = {
|
|
544
554
|
options: { ...options }
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// src/env/task/tools/completion-copy.ts
|
|
2
|
+
var TASK_COMPLETE_ITEM_BY_ITEM = "按子项逐条验收";
|
|
3
|
+
var TASK_COMPLETION_HINT_ANCHOR = "TASK_COMPLETION_HINT";
|
|
4
|
+
var TASK_COMPLETE_VERIFY_DUTY = "核实义务";
|
|
5
|
+
|
|
6
|
+
export { TASK_COMPLETE_ITEM_BY_ITEM, TASK_COMPLETION_HINT_ANCHOR, TASK_COMPLETE_VERIFY_DUTY };
|