@ai-setting/roy-agent-core 1.7.65 → 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 +56 -3
- package/dist/env/agent/agent-component.js +2 -2
- package/dist/env/agent/index.js +2 -2
- package/dist/env/agent/types.d.ts +28 -0
- package/dist/env/environment.d.ts +13 -0
- package/dist/env/event-source/command-card-action.d.ts +105 -0
- package/dist/env/event-source/command-cards.d.ts +72 -0
- package/dist/env/event-source/command-registry.d.ts +181 -0
- package/dist/env/event-source/command-types.d.ts +8 -0
- package/dist/env/event-source/event-source-handlers.d.ts +66 -0
- package/dist/env/event-source/event-source-handlers.js +7 -4
- package/dist/env/event-source/fallback-model-command.d.ts +80 -0
- package/dist/env/event-source/index.d.ts +7 -0
- package/dist/env/event-source/index.js +48 -7
- package/dist/env/event-source/timer-handler.d.ts +93 -1
- package/dist/env/index.js +15 -14
- package/dist/env/llm/index.js +1 -1
- package/dist/env/prompt/index.js +3 -2
- package/dist/env/prompt/prompts-index.d.ts +3 -8
- package/dist/env/task/delegate/delegate-tool.d.ts +58 -2
- package/dist/env/task/delegate/delegate-tool.js +5 -2
- package/dist/env/task/delegate/index.js +3 -2
- package/dist/env/task/index.js +9 -8
- package/dist/env/task/mcp/index.js +3 -2
- package/dist/env/task/plugins/__e2e__/laya-completion-e2e.d.ts +16 -0
- package/dist/env/task/plugins/index.js +4 -3
- 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/storage/index.js +2 -2
- package/dist/env/task/storage/migrations/003_add_process_description.d.ts +1 -1
- package/dist/env/task/storage/migrations/log-migration.d.ts +49 -3
- 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/env/task/tools/operation/create-tool.d.ts +1 -1
- package/dist/env/task/tools/operation/index.js +1 -1
- package/dist/env/task/tools/operation/operation-types.d.ts +10 -8
- package/dist/env/task/types.d.ts +3 -3
- package/dist/env/tool/built-in/index.js +2 -2
- package/dist/env/tool/built-in/query-background-process-tool.d.ts +10 -0
- package/dist/env/tool/index.js +3 -3
- package/dist/env/tool/types.d.ts +6 -0
- package/dist/index.js +60 -19
- package/dist/shared/@ai-setting/{roy-agent-core-rjzdj0xb.js → roy-agent-core-02j24hrg.js} +2 -0
- package/dist/shared/@ai-setting/{roy-agent-core-hmdcz3g9.js → roy-agent-core-1k83dq3a.js} +16 -6
- package/dist/shared/@ai-setting/{roy-agent-core-e42v9bcq.js → roy-agent-core-1kxf910n.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-amkqnyzy.js → roy-agent-core-58804s3j.js} +10 -0
- 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-9bs6xrav.js → roy-agent-core-abqhkbn3.js} +6 -3
- package/dist/shared/@ai-setting/{roy-agent-core-f6c0nadn.js → roy-agent-core-b7jbqfsy.js} +25 -11
- package/dist/shared/@ai-setting/{roy-agent-core-hjejpcg5.js → roy-agent-core-dnjm17sa.js} +51 -9
- 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-xhrrgfdy.js → roy-agent-core-hfr6bzts.js} +168 -52
- package/dist/shared/@ai-setting/{roy-agent-core-18am1h07.js → roy-agent-core-k4ps1hxp.js} +1085 -46
- package/dist/shared/@ai-setting/{roy-agent-core-jz8dsypm.js → roy-agent-core-kpg25s2q.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-6masakz4.js → roy-agent-core-ma35jyd9.js} +19 -8
- package/dist/shared/@ai-setting/{roy-agent-core-gxzxq1sf.js → roy-agent-core-ntq0gz7q.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-rn57psp0.js → roy-agent-core-p5cz9m8v.js} +3 -3
- package/dist/shared/@ai-setting/{roy-agent-core-w07ymg29.js → roy-agent-core-wksgtqf9.js} +1 -1
- package/package.json +1 -1
- package/dist/shared/@ai-setting/roy-agent-core-6z412atw.js +0 -654
- /package/dist/shared/@ai-setting/{roy-agent-core-5enxfga2.js → roy-agent-core-b4x6x4k2.js} +0 -0
- /package/dist/shared/@ai-setting/{roy-agent-core-es467wsz.js → roy-agent-core-dt104qa1.js} +0 -0
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Task #4722 — `fallback-model` command
|
|
3
|
+
*
|
|
4
|
+
* 管理 `~/.roy-agent/config.jsonc` 里的兜底模型列表:
|
|
5
|
+
*
|
|
6
|
+
* "llm": {
|
|
7
|
+
* "fallbackModels": ["a/M1", "b/M2"] // 有序 = 优先级,index 0 最高
|
|
8
|
+
* }
|
|
9
|
+
*
|
|
10
|
+
* ## 与 Task #4623/#4682 的关系
|
|
11
|
+
*
|
|
12
|
+
* 现有 fallback 机制读 `llm.fallbackModel`(单字符串,见
|
|
13
|
+
* agent-component.ts 的 resolveFallbackModel)。本 command 引入
|
|
14
|
+
* `llm.fallbackModels` **数组**(有序列表),并保持向后兼容:
|
|
15
|
+
*
|
|
16
|
+
* - list:fallbackModels 数组优先;无数组时回落 fallbackModel 单值
|
|
17
|
+
* - add:单值 → 自动迁移成数组
|
|
18
|
+
*
|
|
19
|
+
* agent 侧消费数组的接线(resolveFallbackModel 读数组首项)是
|
|
20
|
+
* 后续 commit,本文件先保证 command 层读写正确。
|
|
21
|
+
*
|
|
22
|
+
* ## JSONC 注释保留
|
|
23
|
+
*
|
|
24
|
+
* config.jsonc 有用户注释,不能 parse→stringify 整文件重写
|
|
25
|
+
* (注释会丢)。用 jsonc-parser 的 modify + applyEdits 做
|
|
26
|
+
* **最小编辑**,注释原样保留。
|
|
27
|
+
*/
|
|
28
|
+
import type { CommandDefinition } from "./command-registry";
|
|
29
|
+
/**
|
|
30
|
+
* 默认配置路径(生产环境)
|
|
31
|
+
*
|
|
32
|
+
* ★ Task #4722 round3(交叉验证第 2 轮 MINOR m7):用 `os.homedir()` 而不是
|
|
33
|
+
* `process.env.HOME ?? process.env.HOMEPATH ?? "~"` ——
|
|
34
|
+
* 后者在 HOME 未设置时会退化成**相对路径** `~/.roy-agent/config.jsonc`,
|
|
35
|
+
* 读写会落到当前工作目录(行为不可预期)。
|
|
36
|
+
*/
|
|
37
|
+
export declare const DEFAULT_CONFIG_PATH: string;
|
|
38
|
+
/**
|
|
39
|
+
* 读 fallback 模型列表(有序 = 优先级)。
|
|
40
|
+
*
|
|
41
|
+
* 兼容两种存量形态:
|
|
42
|
+
* - `llm.fallbackModels`: string[](新)
|
|
43
|
+
* - `llm.fallbackModel`: string(旧,单值)
|
|
44
|
+
*
|
|
45
|
+
* ★ Task #4722 round2(交叉验证 MINOR-6):数组里的**非字符串 / 空串条目**
|
|
46
|
+
* 会被过滤掉(展示层要的是有效模型名),但这会造成「展示索引」与
|
|
47
|
+
* 「存储数组」的下标错位 —— 首次写入时那些无效条目会被静默删掉。
|
|
48
|
+
* 为避免这种意外数据丢失,读取时**保留原始条目位置**:
|
|
49
|
+
* 非字符串条目用空串占位(数量不变 → 下标对齐),
|
|
50
|
+
* 命令层再把空串当作「无效项」跳过。
|
|
51
|
+
*/
|
|
52
|
+
export declare function readFallbackModelList(configPath: string): string[];
|
|
53
|
+
/**
|
|
54
|
+
* 读取**原始** fallbackModels 数组(不做任何过滤/归一化)。
|
|
55
|
+
*
|
|
56
|
+
* ★ Task #4722 round2(MINOR-6):写回时用它,保证用户手写的异常条目
|
|
57
|
+
* (非字符串 / 空串)**原样保留**,不会被一次 add/remove 静默删掉。
|
|
58
|
+
*/
|
|
59
|
+
export declare function readRawFallbackModelArray(configPath: string): unknown[];
|
|
60
|
+
/**
|
|
61
|
+
* 写回 fallback 模型列表(有序 = 优先级)。
|
|
62
|
+
*
|
|
63
|
+
* 走 jsonc modify → **保留用户注释**(config.jsonc 是用户手写的,
|
|
64
|
+
* parse→stringify 重写会丢注释)。
|
|
65
|
+
*
|
|
66
|
+
* ★ Task #4722 round3(交叉验证第 2 轮 MINOR m5):这个公开 API 与
|
|
67
|
+
* 命令层的「原始条目保留」保证保持一致 —— 写入时保留原有数组里
|
|
68
|
+
* 非字符串条目的**位置**(空串占位),不会把用户手写的异常条目删掉。
|
|
69
|
+
* (与 add/remove/reorder 走同一条 raw 数组路径)
|
|
70
|
+
*/
|
|
71
|
+
export declare function writeFallbackModelList(configPath: string, list: string[]): void;
|
|
72
|
+
/** fallback-model command 定义(注册进 CommandRegistry) */
|
|
73
|
+
export declare const fallbackModelCommand: CommandDefinition;
|
|
74
|
+
/**
|
|
75
|
+
* `list` command:`list model` → fallback-model list 的快捷方式。
|
|
76
|
+
*
|
|
77
|
+
* 用户需求示例消息是 `##command##: list model`,注册这个别名
|
|
78
|
+
* 让示例开箱即用。未来可扩展 `list <其他资源>`。
|
|
79
|
+
*/
|
|
80
|
+
export declare const listCommand: CommandDefinition;
|
|
@@ -8,6 +8,13 @@ export { EventSourceInitHooks } from "./types";
|
|
|
8
8
|
export { BUILT_IN_EVENT_SOURCE_TYPES, BUILT_IN_EVENT_SOURCE_TYPE_LIST } from "./types";
|
|
9
9
|
export { isBuiltInEventSourceType, isValidEventSourceType, getDefaultConfigForType, validateEventSourceConfig, } from "./types";
|
|
10
10
|
export { EventSourceComponent } from "./event-source-component";
|
|
11
|
+
export { COMMAND_PREFIX, isCommandMessage, extractCommandInvocation, CommandRegistry, getGlobalCommandRegistry, handleCommandMessage, } from "./command-registry";
|
|
12
|
+
export type { CommandInvocation, CommandContext, CommandOutput, CommandTextOutput, CommandCardOutput, CommandResult, CommandDefinition, } from "./command-registry";
|
|
13
|
+
export { renderTextCard, renderFallbackModelCard, isFallbackModelCard, FALLBACK_MODEL_ACTIONS, FALLBACK_MODEL_ACTION_NS, } from "./command-cards";
|
|
14
|
+
export type { LarkCard } from "./command-types";
|
|
15
|
+
export { isCommandCardAction, translateCardActionToCommand, handleCommandCardAction, } from "./command-card-action";
|
|
16
|
+
export type { CommandCardActionEvent, CommandCardActionPorts, CommandCardActionResult, } from "./command-card-action";
|
|
17
|
+
export { fallbackModelCommand, listCommand, readFallbackModelList, readRawFallbackModelArray, writeFallbackModelList, DEFAULT_CONFIG_PATH, } from "./fallback-model-command";
|
|
11
18
|
export { EventStoreImpl, setSharedEventStore, getSharedEventStore, resetSharedEventStore, } from "./event-store";
|
|
12
19
|
export type { EventStore, TriggerEventInput, TriggerEventMetadata, PersistedEvent, EventStoreOptions, } from "./event-store";
|
|
13
20
|
export { larkCliHandler, timerHandler, bountyIMHandler, cliCommandHandler, builtInHandlers, getBuiltInHandler, extractMetadata, } from "./event-source-handlers";
|
|
@@ -1,19 +1,39 @@
|
|
|
1
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
1
|
+
import"../../shared/@ai-setting/roy-agent-core-b4x6x4k2.js";
|
|
2
2
|
import {
|
|
3
3
|
EventSourceComponent
|
|
4
|
-
} from "../../shared/@ai-setting/roy-agent-core-
|
|
4
|
+
} from "../../shared/@ai-setting/roy-agent-core-1kxf910n.js";
|
|
5
5
|
import {
|
|
6
6
|
BountyIMInstance,
|
|
7
|
+
COMMAND_PREFIX,
|
|
8
|
+
CommandRegistry,
|
|
9
|
+
DEFAULT_CONFIG_PATH,
|
|
10
|
+
FALLBACK_MODEL_ACTIONS,
|
|
11
|
+
FALLBACK_MODEL_ACTION_NS,
|
|
7
12
|
TimerInstance,
|
|
8
13
|
bountyIMHandler,
|
|
9
14
|
buildDefaultBountyIMSystemPrompt,
|
|
10
15
|
builtInHandlers,
|
|
16
|
+
extractCommandInvocation,
|
|
11
17
|
extractMetadata,
|
|
18
|
+
fallbackModelCommand,
|
|
12
19
|
getBuiltInHandler,
|
|
20
|
+
getGlobalCommandRegistry,
|
|
21
|
+
handleCommandCardAction,
|
|
22
|
+
handleCommandMessage,
|
|
23
|
+
isCommandCardAction,
|
|
24
|
+
isCommandMessage,
|
|
25
|
+
isFallbackModelCard,
|
|
13
26
|
larkCliHandler,
|
|
27
|
+
listCommand,
|
|
28
|
+
readFallbackModelList,
|
|
29
|
+
readRawFallbackModelArray,
|
|
30
|
+
renderFallbackModelCard,
|
|
31
|
+
renderTextCard,
|
|
14
32
|
resolveBountyIMSystemPrompt,
|
|
15
|
-
timerHandler
|
|
16
|
-
|
|
33
|
+
timerHandler,
|
|
34
|
+
translateCardActionToCommand,
|
|
35
|
+
writeFallbackModelList
|
|
36
|
+
} from "../../shared/@ai-setting/roy-agent-core-k4ps1hxp.js";
|
|
17
37
|
import {
|
|
18
38
|
BUILT_IN_EVENT_SOURCE_TYPES,
|
|
19
39
|
BUILT_IN_EVENT_SOURCE_TYPE_LIST,
|
|
@@ -32,17 +52,18 @@ import {
|
|
|
32
52
|
parseCliSessionChatId
|
|
33
53
|
} from "../../shared/@ai-setting/roy-agent-core-v0hf14bj.js";
|
|
34
54
|
import"../../shared/@ai-setting/roy-agent-core-tm1mxttk.js";
|
|
35
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
55
|
+
import"../../shared/@ai-setting/roy-agent-core-b7jbqfsy.js";
|
|
36
56
|
import {
|
|
37
57
|
EventStoreImpl,
|
|
38
58
|
getSharedEventStore,
|
|
39
59
|
resetSharedEventStore,
|
|
40
60
|
setSharedEventStore
|
|
41
61
|
} from "../../shared/@ai-setting/roy-agent-core-na18zwj0.js";
|
|
42
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
62
|
+
import"../../shared/@ai-setting/roy-agent-core-abqhkbn3.js";
|
|
43
63
|
import"../../shared/@ai-setting/roy-agent-core-1pg0fepg.js";
|
|
44
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
64
|
+
import"../../shared/@ai-setting/roy-agent-core-ma35jyd9.js";
|
|
45
65
|
import"../../shared/@ai-setting/roy-agent-core-tr3ep81v.js";
|
|
66
|
+
import"../../shared/@ai-setting/roy-agent-core-6m4bw8jy.js";
|
|
46
67
|
import"../../shared/@ai-setting/roy-agent-core-0ys85x46.js";
|
|
47
68
|
import"../../shared/@ai-setting/roy-agent-core-zk2jg0v7.js";
|
|
48
69
|
import"../../shared/@ai-setting/roy-agent-core-c2gbt68e.js";
|
|
@@ -65,28 +86,48 @@ import"../../shared/@ai-setting/roy-agent-core-7f7t9wwp.js";
|
|
|
65
86
|
import"../../shared/@ai-setting/roy-agent-core-85xyctnb.js";
|
|
66
87
|
import"../../shared/@ai-setting/roy-agent-core-fs0mn2jk.js";
|
|
67
88
|
export {
|
|
89
|
+
writeFallbackModelList,
|
|
68
90
|
validateEventSourceConfig,
|
|
91
|
+
translateCardActionToCommand,
|
|
69
92
|
timerHandler,
|
|
70
93
|
setSharedEventStore,
|
|
71
94
|
resolveBountyIMSystemPrompt,
|
|
72
95
|
resetSharedEventStore,
|
|
96
|
+
renderTextCard,
|
|
97
|
+
renderFallbackModelCard,
|
|
98
|
+
readRawFallbackModelArray,
|
|
99
|
+
readFallbackModelList,
|
|
73
100
|
parseCliSessionChatId,
|
|
101
|
+
listCommand,
|
|
74
102
|
larkCliHandler,
|
|
75
103
|
isValidEventSourceType,
|
|
104
|
+
isFallbackModelCard,
|
|
105
|
+
isCommandMessage,
|
|
106
|
+
isCommandCardAction,
|
|
76
107
|
isBuiltInEventSourceType,
|
|
108
|
+
handleCommandMessage,
|
|
109
|
+
handleCommandCardAction,
|
|
77
110
|
getSharedEventStore,
|
|
111
|
+
getGlobalCommandRegistry,
|
|
78
112
|
getDefaultConfigForType,
|
|
79
113
|
getBuiltInHandler,
|
|
114
|
+
fallbackModelCommand,
|
|
80
115
|
extractMetadata,
|
|
116
|
+
extractCommandInvocation,
|
|
81
117
|
cliCommandHandler,
|
|
82
118
|
builtInHandlers,
|
|
83
119
|
buildDefaultBountyIMSystemPrompt,
|
|
84
120
|
buildCliReplyChannel,
|
|
85
121
|
bountyIMHandler,
|
|
86
122
|
TimerInstance,
|
|
123
|
+
FALLBACK_MODEL_ACTION_NS,
|
|
124
|
+
FALLBACK_MODEL_ACTIONS,
|
|
87
125
|
EventStoreImpl,
|
|
88
126
|
EventSourceInitHooks,
|
|
89
127
|
EventSourceComponent,
|
|
128
|
+
DEFAULT_CONFIG_PATH,
|
|
129
|
+
CommandRegistry,
|
|
130
|
+
COMMAND_PREFIX,
|
|
90
131
|
CLI_SESSION_CHAT_ID_PREFIX,
|
|
91
132
|
CLI_COMMAND_ES_TYPE,
|
|
92
133
|
BountyIMInstance,
|
|
@@ -29,6 +29,53 @@ export type GetRunningTasksFn = () => BackgroundTask[];
|
|
|
29
29
|
* 用于注入 BackgroundTaskManager 的 options key
|
|
30
30
|
*/
|
|
31
31
|
export declare const TIMER_OPTIONS_KEY_GET_MANAGER = "getBackgroundTaskManager";
|
|
32
|
+
/** schedule 模式下的低频 tick 间隔(30 秒) */
|
|
33
|
+
export declare const SCHEDULE_TICK_INTERVAL_MS: number;
|
|
34
|
+
/** options key:多时刻配置 */
|
|
35
|
+
export declare const TIMER_OPTIONS_KEY_SCHEDULE = "schedule";
|
|
36
|
+
/** options key:显式指定事件路由到的 session(独立 session) */
|
|
37
|
+
export declare const TIMER_OPTIONS_KEY_SESSION_ID = "sessionId";
|
|
38
|
+
/** options key:schedule 模式下是否在有运行中后台任务时跳过 */
|
|
39
|
+
export declare const TIMER_OPTIONS_KEY_SKIP_WHEN_RUNNING = "skipWhenRunning";
|
|
40
|
+
/**
|
|
41
|
+
* 单条 schedule 项
|
|
42
|
+
*
|
|
43
|
+
* - time: `HH:MM`(24 小时制,本地时区)
|
|
44
|
+
* - prompt: 该时刻触发时注入的 prompt
|
|
45
|
+
* - label: 可选标签(写入 event metadata.scheduleLabel,便于下游识别)
|
|
46
|
+
* - sessionId: 可选,覆盖实例级 session(该时刻走独立 session)
|
|
47
|
+
*/
|
|
48
|
+
export interface TimerScheduleEntry {
|
|
49
|
+
time: string;
|
|
50
|
+
prompt: string;
|
|
51
|
+
label?: string;
|
|
52
|
+
sessionId?: string;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* 校验 `HH:MM` 格式
|
|
56
|
+
*
|
|
57
|
+
* @returns 合法返回 true;非法返回 false
|
|
58
|
+
*/
|
|
59
|
+
export declare function isValidScheduleTime(time: unknown): time is string;
|
|
60
|
+
/**
|
|
61
|
+
* 解析 options.schedule 为合法的 schedule 项数组
|
|
62
|
+
*
|
|
63
|
+
* 非法项被静默丢弃(validateConfig 负责报错),返回的数组只含合法项。
|
|
64
|
+
*
|
|
65
|
+
* @param raw 原始值(通常是 config.options.schedule)
|
|
66
|
+
* @returns 合法 schedule 项数组;不是数组时返回空数组
|
|
67
|
+
*/
|
|
68
|
+
export declare function parseSchedule(raw: unknown): TimerScheduleEntry[];
|
|
69
|
+
/**
|
|
70
|
+
* 校验 schedule 配置,返回错误列表(空数组 = 合法)
|
|
71
|
+
*
|
|
72
|
+
* 规则:
|
|
73
|
+
* 1. schedule 必须是数组且非空
|
|
74
|
+
* 2. 每项 time 必须是 `HH:MM`
|
|
75
|
+
* 3. 每项 prompt 必须是非空字符串
|
|
76
|
+
* 4. schedule 与 interval 互斥
|
|
77
|
+
*/
|
|
78
|
+
export declare function validateScheduleConfig(config: EventSourceConfig): string[];
|
|
32
79
|
/**
|
|
33
80
|
* Timer EventSourceInstance 实现
|
|
34
81
|
*
|
|
@@ -41,6 +88,20 @@ export declare class TimerInstance implements EventSourceInstance {
|
|
|
41
88
|
private readonly sessionId;
|
|
42
89
|
private readonly getRunningTasks;
|
|
43
90
|
private readonly customPrompt?;
|
|
91
|
+
/** schedule 模式:合法 schedule 项 */
|
|
92
|
+
private readonly schedule;
|
|
93
|
+
/** 是否处于 schedule 模式(配置了 schedule 键即为 true,即使全项非法) */
|
|
94
|
+
private readonly scheduleMode;
|
|
95
|
+
/** 非法 schedule 的告警是否已打印(只打一次,避免刷屏) */
|
|
96
|
+
private invalidScheduleWarned;
|
|
97
|
+
/** schedule 模式下实例级默认 session(跨重启稳定) */
|
|
98
|
+
private readonly scheduleSessionId;
|
|
99
|
+
/** schedule 模式下是否在有运行中后台任务时跳过 */
|
|
100
|
+
private readonly skipWhenRunning;
|
|
101
|
+
/** 已触发标记:`YYYY-MM-DD#HH:MM` → true(当日去重) */
|
|
102
|
+
private readonly firedKeys;
|
|
103
|
+
/** 可注入时钟(测试用) */
|
|
104
|
+
private readonly now;
|
|
44
105
|
private status;
|
|
45
106
|
private timerId?;
|
|
46
107
|
private eventHandler?;
|
|
@@ -48,8 +109,11 @@ export declare class TimerInstance implements EventSourceInstance {
|
|
|
48
109
|
* @param config 事件源配置
|
|
49
110
|
* @param getRunningTasks 可选的回调,用于获取当前所有后台任务。
|
|
50
111
|
* 测试时可直接传入;生产环境通过 config.options.getBackgroundTaskManager 注入。
|
|
112
|
+
* @param now 可选的时钟注入(返回 epoch ms),测试用。
|
|
51
113
|
*/
|
|
52
|
-
constructor(config: EventSourceConfig, getRunningTasks?: GetRunningTasksFn);
|
|
114
|
+
constructor(config: EventSourceConfig, getRunningTasks?: GetRunningTasksFn, now?: () => number);
|
|
115
|
+
/** 当前是否为 schedule 模式 */
|
|
116
|
+
private get isScheduleMode();
|
|
53
117
|
start(): Promise<void>;
|
|
54
118
|
stop(): Promise<void>;
|
|
55
119
|
getStatus(): EventSourceStatus;
|
|
@@ -61,10 +125,38 @@ export declare class TimerInstance implements EventSourceInstance {
|
|
|
61
125
|
* Rule-based 检查:有 status === "running" 的后台任务时跳过本次触发
|
|
62
126
|
*/
|
|
63
127
|
private tick;
|
|
128
|
+
/**
|
|
129
|
+
* ★ Task #4815:schedule 模式 tick
|
|
130
|
+
*
|
|
131
|
+
* 逻辑:
|
|
132
|
+
* 1. 取当前本地时刻(HH:MM)与日期(YYYY-MM-DD)
|
|
133
|
+
* 2. 找出与当前时刻匹配的 schedule 项
|
|
134
|
+
* 3. 若该 `日期#时刻` 今日已触发 → 跳过(当日去重)
|
|
135
|
+
* 4. schedule 模式默认**不**做 rule-based 跳过;
|
|
136
|
+
* 仅当 options.skipWhenRunning=true 时才检查后台任务
|
|
137
|
+
* 5. 命中 → 标记已触发 + 构建事件(prompt 取当次命中项)
|
|
138
|
+
*/
|
|
139
|
+
private tickSchedule;
|
|
140
|
+
/**
|
|
141
|
+
* 清理过期的去重标记(只保留当天的)
|
|
142
|
+
*
|
|
143
|
+
* 防止长期运行时 Set 无限增长(每天新增若干 key)。
|
|
144
|
+
* 实现:只保留 `currentDateKey` 当天的标记。
|
|
145
|
+
* 说明:跨天时昨天的 key 失去意义(dateKey 不同即不同 key),删掉是安全的。
|
|
146
|
+
*/
|
|
147
|
+
private pruneFiredKeys;
|
|
64
148
|
/**
|
|
65
149
|
* 构建 SelfReminder 事件
|
|
66
150
|
*
|
|
67
151
|
* 结构参考 LarkCliInstance.handleEvent() 输出的 EventSourceEvent
|
|
152
|
+
*
|
|
153
|
+
* ★ Task #4815:schedule 模式下
|
|
154
|
+
* - message 取命中 schedule 项的 prompt
|
|
155
|
+
* - metadata 注入 `trigger_session_id`(EventHandler 用它把事件路由到
|
|
156
|
+
* 独立 session,而不是主会话)
|
|
157
|
+
* - metadata 注入 `scheduleLabel`(可选,便于下游识别是哪个时刻)
|
|
158
|
+
*
|
|
159
|
+
* @param entry 命中的 schedule 项;interval 模式不传
|
|
68
160
|
*/
|
|
69
161
|
private buildSelfReminderEvent;
|
|
70
162
|
}
|
package/dist/env/index.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BaseEnvironment
|
|
3
|
-
} from "../shared/@ai-setting/roy-agent-core-
|
|
3
|
+
} from "../shared/@ai-setting/roy-agent-core-8zas6w5q.js";
|
|
4
4
|
import {
|
|
5
5
|
TaskComponent
|
|
6
|
-
} from "../shared/@ai-setting/roy-agent-core-
|
|
7
|
-
import"../shared/@ai-setting/roy-agent-core-
|
|
6
|
+
} from "../shared/@ai-setting/roy-agent-core-1k83dq3a.js";
|
|
7
|
+
import"../shared/@ai-setting/roy-agent-core-58804s3j.js";
|
|
8
8
|
import"../shared/@ai-setting/roy-agent-core-jm136jzh.js";
|
|
9
|
-
import"../shared/@ai-setting/roy-agent-core-
|
|
9
|
+
import"../shared/@ai-setting/roy-agent-core-dnjm17sa.js";
|
|
10
10
|
import"../shared/@ai-setting/roy-agent-core-fttgm52a.js";
|
|
11
|
-
import"../shared/@ai-setting/roy-agent-core-
|
|
11
|
+
import"../shared/@ai-setting/roy-agent-core-ntq0gz7q.js";
|
|
12
12
|
import"../shared/@ai-setting/roy-agent-core-8gxth0eh.js";
|
|
13
|
-
import"../shared/@ai-setting/roy-agent-core-
|
|
14
|
-
import"../shared/@ai-setting/roy-agent-core-
|
|
13
|
+
import"../shared/@ai-setting/roy-agent-core-h5vmff8w.js";
|
|
14
|
+
import"../shared/@ai-setting/roy-agent-core-p5cz9m8v.js";
|
|
15
15
|
import {
|
|
16
16
|
EventSourceComponent
|
|
17
|
-
} from "../shared/@ai-setting/roy-agent-core-
|
|
17
|
+
} from "../shared/@ai-setting/roy-agent-core-1kxf910n.js";
|
|
18
18
|
import {
|
|
19
19
|
builtInHandlers,
|
|
20
20
|
larkCliHandler
|
|
21
|
-
} from "../shared/@ai-setting/roy-agent-core-
|
|
21
|
+
} from "../shared/@ai-setting/roy-agent-core-k4ps1hxp.js";
|
|
22
22
|
import {
|
|
23
23
|
EventSourceInitHooks,
|
|
24
24
|
getDefaultConfigForType,
|
|
@@ -29,12 +29,13 @@ import {
|
|
|
29
29
|
import"../shared/@ai-setting/roy-agent-core-add1zqsh.js";
|
|
30
30
|
import"../shared/@ai-setting/roy-agent-core-v0hf14bj.js";
|
|
31
31
|
import"../shared/@ai-setting/roy-agent-core-tm1mxttk.js";
|
|
32
|
-
import"../shared/@ai-setting/roy-agent-core-
|
|
32
|
+
import"../shared/@ai-setting/roy-agent-core-b7jbqfsy.js";
|
|
33
33
|
import"../shared/@ai-setting/roy-agent-core-na18zwj0.js";
|
|
34
|
-
import"../shared/@ai-setting/roy-agent-core-
|
|
34
|
+
import"../shared/@ai-setting/roy-agent-core-abqhkbn3.js";
|
|
35
35
|
import"../shared/@ai-setting/roy-agent-core-1pg0fepg.js";
|
|
36
|
-
import"../shared/@ai-setting/roy-agent-core-
|
|
36
|
+
import"../shared/@ai-setting/roy-agent-core-ma35jyd9.js";
|
|
37
37
|
import"../shared/@ai-setting/roy-agent-core-tr3ep81v.js";
|
|
38
|
+
import"../shared/@ai-setting/roy-agent-core-6m4bw8jy.js";
|
|
38
39
|
import"../shared/@ai-setting/roy-agent-core-0ys85x46.js";
|
|
39
40
|
import"../shared/@ai-setting/roy-agent-core-zk2jg0v7.js";
|
|
40
41
|
import {
|
|
@@ -67,8 +68,8 @@ import"../shared/@ai-setting/roy-agent-core-jagkferh.js";
|
|
|
67
68
|
import {
|
|
68
69
|
AgentComponent,
|
|
69
70
|
AgentComponentConfigSchema
|
|
70
|
-
} from "../shared/@ai-setting/roy-agent-core-
|
|
71
|
-
import"../shared/@ai-setting/roy-agent-core-
|
|
71
|
+
} from "../shared/@ai-setting/roy-agent-core-hfr6bzts.js";
|
|
72
|
+
import"../shared/@ai-setting/roy-agent-core-dt104qa1.js";
|
|
72
73
|
import"../shared/@ai-setting/roy-agent-core-jvv2h3d6.js";
|
|
73
74
|
import"../shared/@ai-setting/roy-agent-core-07fvy74y.js";
|
|
74
75
|
import {
|
package/dist/env/llm/index.js
CHANGED
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
createLLMAdapter,
|
|
14
14
|
getLLMProviderOverride,
|
|
15
15
|
setLLMProvider
|
|
16
|
-
} from "../../shared/@ai-setting/roy-agent-core-
|
|
16
|
+
} from "../../shared/@ai-setting/roy-agent-core-02j24hrg.js";
|
|
17
17
|
import"../../shared/@ai-setting/roy-agent-core-adg9ghbt.js";
|
|
18
18
|
import {
|
|
19
19
|
PiAiAdapter,
|
package/dist/env/prompt/index.js
CHANGED
|
@@ -3,8 +3,9 @@ import {
|
|
|
3
3
|
PromptConfigSchema,
|
|
4
4
|
PromptPathSchema,
|
|
5
5
|
PromptRenderer
|
|
6
|
-
} from "../../shared/@ai-setting/roy-agent-core-
|
|
7
|
-
import"../../shared/@ai-setting/roy-agent-core-
|
|
6
|
+
} from "../../shared/@ai-setting/roy-agent-core-wksgtqf9.js";
|
|
7
|
+
import"../../shared/@ai-setting/roy-agent-core-ma35jyd9.js";
|
|
8
|
+
import"../../shared/@ai-setting/roy-agent-core-6m4bw8jy.js";
|
|
8
9
|
import"../../shared/@ai-setting/roy-agent-core-qxnbvgwe.js";
|
|
9
10
|
import"../../shared/@ai-setting/roy-agent-core-7hh0brvs.js";
|
|
10
11
|
import"../../shared/@ai-setting/roy-agent-core-pgvcf91v.js";
|