@epoch-agent/core 0.12.0 → 0.14.0
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/index.d.ts +237 -58
- package/dist/index.js +191 -78
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -1342,9 +1342,12 @@ interface GoalToolDeps {
|
|
|
1342
1342
|
declare function createGoalTool(deps: GoalToolDeps): EpochTool;
|
|
1343
1343
|
|
|
1344
1344
|
/**
|
|
1345
|
-
*
|
|
1345
|
+
* 记忆系统类型。
|
|
1346
1346
|
*
|
|
1347
|
-
* 参考 Hermes tools/memory_tool.py + memory_provider.py
|
|
1347
|
+
* 参考 Hermes tools/memory_tool.py + memory_provider.py。
|
|
1348
|
+
* (原来这里写着「对齐 `docs/design/memory-system.md`」,而那整个目录已随
|
|
1349
|
+
* `5bbf3c8c` 删掉 —— 今天面向用户那半边在
|
|
1350
|
+
* [TOOLS.md](../../../../docs/TOOLS.md) 的「待办、目标、记忆、沙箱、委托」一节。)
|
|
1348
1351
|
*/
|
|
1349
1352
|
type MemoryTarget = 'memory' | 'user';
|
|
1350
1353
|
/** 配额信息 */
|
|
@@ -2569,7 +2572,7 @@ declare function createSessionTraceTool(deps: SessionSearchDeps): EpochTool;
|
|
|
2569
2572
|
*
|
|
2570
2573
|
* 两条,第二条是硬的:
|
|
2571
2574
|
*
|
|
2572
|
-
* 1. [manager.ts](./manager.ts) 那时已经 501 行,压着
|
|
2575
|
+
* 1. [manager.ts](./manager.ts) 那时已经 501 行,压着 AGENTS.md 铁律 3 的 500 行线。
|
|
2573
2576
|
* 往里再塞封顶和收窄是把违规做实,搬出来是**减**不是加;
|
|
2574
2577
|
* 2. **`agent/` 不许 import 这一族**(技能索引接线那一轮的决定 2.2):`agent/` 收的是
|
|
2575
2578
|
* 拼好的成品串,不是技能列表。而 web 能力页那句「界面上显示的那一行 = 真进上下文
|
|
@@ -3314,19 +3317,14 @@ declare class TrackerDB {
|
|
|
3314
3317
|
* 所以这个文件里加一个属性,`evals/*.eval.ts` 里**每一条**录像都会对不上 ——
|
|
3315
3318
|
* 不是只有跟 todo 有关的那几条。这一轮改完 17 条全红,逐条按新值更新过了。
|
|
3316
3319
|
*
|
|
3317
|
-
*
|
|
3318
|
-
*
|
|
3320
|
+
* ⚠️ **合并时那些 `fingerprint:` 行的值一个都别手挑。** 它们是**天然的冲突面**
|
|
3321
|
+
* —— 任何一条也动了 prompt 或工具定义的分支,改的是同样那批行。冲突时合完之后
|
|
3322
|
+
* 跑一次 `pnpm eval`,拿它打出来的当前值统一覆盖一遍(诊断里会逐条打印
|
|
3323
|
+
* 「旧 → 新」)。手挑等于赌两边的改动恰好互不影响,而那正是这个安全阀要防的事。
|
|
3319
3324
|
*
|
|
3320
|
-
*
|
|
3321
|
-
*
|
|
3322
|
-
*
|
|
3323
|
-
* > 「旧 → 新」)。手挑等于赌两边的改动恰好互不影响,而那正是这个安全阀要防的事。
|
|
3324
|
-
*
|
|
3325
|
-
* 那一轮四条分支里只有这一条动了指纹,**四次合并零冲突**,合完 `pnpm eval` 全绿
|
|
3326
|
-
* (10 个测试文件 51 条),所以一个值都没有手动挑过。⚠️ 同一轮还纠正了一处
|
|
3327
|
-
* 口口相传的错话:**指纹是 `evals/*.eval.ts` 里的内联字符串字面量** ——
|
|
3328
|
-
* 19 处、摊在 7 个 `.eval.ts` 里,全仓**没有** `.eval-recordings/` 这个目录,
|
|
3329
|
-
* 别照着那个名字去找(找不到就以为「录像不在仓里」,那是这条规矩最容易断的地方)。
|
|
3325
|
+
* ⚠️ **指纹是 `evals/*.eval.ts` 里的内联字符串字面量**,全仓**没有**
|
|
3326
|
+
* `.eval-recordings/` 这个目录 —— 别照那个名字去找。找不到就会以为「录像不在仓里」,
|
|
3327
|
+
* 那是这条规矩最容易断的地方。
|
|
3330
3328
|
*/
|
|
3331
3329
|
|
|
3332
3330
|
declare function createTodoTool(db: TrackerDB): EpochTool;
|
|
@@ -10123,7 +10121,7 @@ declare function classifyProviderError(err: unknown): {
|
|
|
10123
10121
|
*
|
|
10124
10122
|
* 单独一个文件而不是塞进 `router.ts`:
|
|
10125
10123
|
*
|
|
10126
|
-
* 1. `router.ts` 已经 700 多行(
|
|
10124
|
+
* 1. `router.ts` 已经 700 多行(AGENTS.md 铁律 3 的上限是 500),不该再长
|
|
10127
10125
|
* 2. 这三道检查是**纯函数** —— 给它「有没有凭据」和「模型什么能力」,
|
|
10128
10126
|
* 它就能算出换不换得成。抽出来之后单测不用造一个 `ProviderRouter`
|
|
10129
10127
|
* (那要真凭据、要碰 `readProviderKeyEnv()`),直接喂假事实就行
|
|
@@ -11507,6 +11505,10 @@ declare const EpochConfigSchema: z.ZodObject<{
|
|
|
11507
11505
|
retentionDays: z.ZodDefault<z.ZodInt>;
|
|
11508
11506
|
vacuumAfterPrune: z.ZodDefault<z.ZodBoolean>;
|
|
11509
11507
|
}, z.core.$strip>>;
|
|
11508
|
+
automation: z.ZodPrefault<z.ZodObject<{
|
|
11509
|
+
keepRuns: z.ZodDefault<z.ZodInt>;
|
|
11510
|
+
maxRecordingMb: z.ZodDefault<z.ZodInt>;
|
|
11511
|
+
}, z.core.$strip>>;
|
|
11510
11512
|
budget: z.ZodOptional<z.ZodObject<{
|
|
11511
11513
|
maxCostUsd: z.ZodOptional<z.ZodNumber>;
|
|
11512
11514
|
maxTokens: z.ZodOptional<z.ZodInt>;
|
|
@@ -11858,7 +11860,7 @@ declare function isSettingWriteLayer(value: string): value is SettingWriteLayer;
|
|
|
11858
11860
|
* 安全中心指两件事(「新会话从哪一档起」vs「这个会话此刻哪一档」),
|
|
11859
11861
|
* 而那正是决定 20 ④ 拆开的那个歧义 —— 记住上一次那一档没有把这个歧义请回来。
|
|
11860
11862
|
*/
|
|
11861
|
-
declare const SETTING_WRITE_KEYS: readonly ["model", "maxTurns", "models.utility", "fallback.model", "contextLength", "maxOutputTokens", "compression.enabled", "compression.threshold", "memory.memoryCharLimit", "memory.userCharLimit", "memory.indexCharLimit", "budget.maxCostUsd", "budget.maxTokens", "budget.warnAtPercent", "budget.onUnknownPricing", "sessions.autoPrune", "sessions.retentionDays", "sessions.vacuumAfterPrune", "permission"];
|
|
11863
|
+
declare const SETTING_WRITE_KEYS: readonly ["model", "maxTurns", "models.utility", "fallback.model", "contextLength", "maxOutputTokens", "compression.enabled", "compression.threshold", "memory.memoryCharLimit", "memory.userCharLimit", "memory.indexCharLimit", "budget.maxCostUsd", "budget.maxTokens", "budget.warnAtPercent", "budget.onUnknownPricing", "sessions.autoPrune", "sessions.retentionDays", "sessions.vacuumAfterPrune", "automation.keepRuns", "automation.maxRecordingMb", "permission"];
|
|
11862
11864
|
type SettingWriteKey = (typeof SETTING_WRITE_KEYS)[number];
|
|
11863
11865
|
/** 这个键写得进去吗。名单就是 {@link SETTING_WRITE_KEYS} 本身,别在别处抄一份字面量 */
|
|
11864
11866
|
declare function isWritableSettingKey(value: string): value is SettingWriteKey;
|
|
@@ -12503,6 +12505,23 @@ declare class MemoryManager {
|
|
|
12503
12505
|
*
|
|
12504
12506
|
* 取首行而不是前 N 字符:条目是「一条一个事实」,第一行基本就是那句结论,
|
|
12505
12507
|
* 而横跨换行去截会把下一行的开头黏上来,读起来像一句破句。
|
|
12508
|
+
*
|
|
12509
|
+
* ## 🔴 按**码点**切,不是按 `.length`
|
|
12510
|
+
*
|
|
12511
|
+
* 判据全文在 infra 的 `text-slice.ts` 上(「截断不许切出半个字符」全仓只实现
|
|
12512
|
+
* 一次)。这里漏掉它的后果不是「显示成 `�`」那么轻:
|
|
12513
|
+
*
|
|
12514
|
+
* 首行第 79/80 个码元正好落在一个代理对中间时(首行超过 80 字、末尾带 emoji
|
|
12515
|
+
* 的记忆条目,中文用户写起来很容易),裸 `.slice()` 切出一个**孤立的高代理**。
|
|
12516
|
+
* 它随索引块进 system prompt,`JSON.stringify` 把它写成不配对的 `\ud83d`,
|
|
12517
|
+
* 而严格的 JSON 解析器(serde_json)拒收 —— DeepSeek 回 400
|
|
12518
|
+
* 「unexpected end of hex escape」,这一轮 0 token、**首次模型请求直接挂**。
|
|
12519
|
+
* 一条记忆就能让整个会话开不了口,而且报错指向的是「网络/供应商」,
|
|
12520
|
+
* 没人会想到是记忆索引切坏了。2026-09-20 复现确认。
|
|
12521
|
+
*
|
|
12522
|
+
* ⚠️ 长度那一比也要按码点。按 `.length`(码元)比的话,一条 41 个 emoji 的
|
|
12523
|
+
* 首行会被判「超过 80」,然后 `headCodePoints` 原样还回来 —— 末尾多一个
|
|
12524
|
+
* 没有截断任何东西的省略号。
|
|
12506
12525
|
*/
|
|
12507
12526
|
private indexEntries;
|
|
12508
12527
|
/**
|
|
@@ -13051,7 +13070,10 @@ declare function stripArtifactData(artifacts: readonly ToolArtifact[]): ToolArti
|
|
|
13051
13070
|
declare function persistToolResults(results: readonly EpochToolResult[]): EpochToolResult[];
|
|
13052
13071
|
|
|
13053
13072
|
/**
|
|
13054
|
-
*
|
|
13073
|
+
* 会话管理类型。
|
|
13074
|
+
*
|
|
13075
|
+
* (原来这里写着「对齐 `docs/design/session-manager.md`」,而那整个目录已随
|
|
13076
|
+
* `5bbf3c8c` 删掉,这条指针一直悬着。)
|
|
13055
13077
|
*
|
|
13056
13078
|
* 参考来源:
|
|
13057
13079
|
* - [Hermes] ~/.hermes/state.db schema
|
|
@@ -13224,7 +13246,30 @@ interface SessionMeta {
|
|
|
13224
13246
|
* 缺席 = 这段会话没有开着的轮(正常态),以及 v13 之前的所有老库。
|
|
13225
13247
|
*/
|
|
13226
13248
|
openTurnFrom?: number | null;
|
|
13249
|
+
/**
|
|
13250
|
+
* 这一段**这次运行**结束的时刻。缺席 = 还开着。
|
|
13251
|
+
*
|
|
13252
|
+
* ⚠️ **它不是「这段会话完了」** —— 会话是可恢复的,resume 回到一段已经关掉的
|
|
13253
|
+
* 会话时这一格会被擦掉(`SessionManager.reopen()`)。语义同 `openTurnFrom`
|
|
13254
|
+
* 那一对「开始写下、收尾擦掉」,只是尺度从一轮放大到一次运行。
|
|
13255
|
+
*
|
|
13256
|
+
* ⚠️ **打这一格不算活动**,所以它不推动 {@link updatedAt}(判据在那一格上)。
|
|
13257
|
+
* 保留期清理同时看两格,判据在 `SessionDB.pruneCandidates` 的 ① / ①b。
|
|
13258
|
+
*/
|
|
13227
13259
|
endedAt?: Date;
|
|
13260
|
+
/**
|
|
13261
|
+
* 为什么结束的。
|
|
13262
|
+
*
|
|
13263
|
+
* | 值 | 谁写的 |
|
|
13264
|
+
* | --------------- | -------------------------------------------------------- |
|
|
13265
|
+
* | `user_stop` | 用户显式停止 |
|
|
13266
|
+
* | `max_turns` | 撞上轮数上限 |
|
|
13267
|
+
* | `error` | 出错收尾 |
|
|
13268
|
+
* | `process_exit` | 进程干净退出时统一打的(`SessionStore.endOpenSessions()`)|
|
|
13269
|
+
* | `orphan_sweep` | 维护扫除超期孤儿(`SessionDB.sweepOrphanedSessions()`) |
|
|
13270
|
+
*
|
|
13271
|
+
* 后两个 2026-09-17 加的,判据见那两个方法。
|
|
13272
|
+
*/
|
|
13228
13273
|
endReason?: string;
|
|
13229
13274
|
}
|
|
13230
13275
|
/**
|
|
@@ -13401,6 +13446,14 @@ interface SessionStats {
|
|
|
13401
13446
|
interface SessionManager$1 {
|
|
13402
13447
|
create(input?: CreateSessionInput): Session;
|
|
13403
13448
|
get(id: string): Session | undefined;
|
|
13449
|
+
/**
|
|
13450
|
+
* 库里有没有这一行。**和 `get()` 不是一回事**:那个会把整段消息读出来,
|
|
13451
|
+
* 而问「在不在」的调用方(`SessionStore.ensure()`)一条消息都不需要。
|
|
13452
|
+
*
|
|
13453
|
+
* 判据全文在 `SessionDB.hasSession` 上 —— 一句话:它是用来把「已经存在」
|
|
13454
|
+
* 和「写不进去」分开的,而那两件事在 `catch` 里长得一模一样。
|
|
13455
|
+
*/
|
|
13456
|
+
has(id: string): boolean;
|
|
13404
13457
|
updateMeta(id: string, patch: Partial<SessionMeta>): void;
|
|
13405
13458
|
archive(id: string): void;
|
|
13406
13459
|
unarchive(id: string): void;
|
|
@@ -13410,6 +13463,10 @@ interface SessionManager$1 {
|
|
|
13410
13463
|
*/
|
|
13411
13464
|
delete(id: string): boolean;
|
|
13412
13465
|
endSession(id: string, reason?: string): void;
|
|
13466
|
+
/** 擦掉结束标记(resume 回到一段已关闭的会话)。见 `SessionMeta.endedAt` */
|
|
13467
|
+
reopen(id: string): void;
|
|
13468
|
+
/** 退出时给本进程碰过的会话统一打结束标记。返回打了几段,**从不抛** */
|
|
13469
|
+
endTouchedSessions(reason?: string): number;
|
|
13413
13470
|
list(input?: ListSessionsInput): ListSessionsOutput;
|
|
13414
13471
|
search(input: SearchInput): SearchOutput;
|
|
13415
13472
|
/** @returns 这条消息的 DB id(按步增量落盘要它,见实现处) */
|
|
@@ -13445,6 +13502,20 @@ interface SessionManager$1 {
|
|
|
13445
13502
|
|
|
13446
13503
|
declare class SessionManager implements SessionManager$1 {
|
|
13447
13504
|
private db;
|
|
13505
|
+
/**
|
|
13506
|
+
* 这个进程**碰过**的会话 id —— {@link endTouchedSessions} 退出时照着它打标记。
|
|
13507
|
+
*
|
|
13508
|
+
* ## 口径:和 `SessionMeta.updatedAt` 那条「什么算活动」对齐
|
|
13509
|
+
*
|
|
13510
|
+
* 只有 {@link create}(建出来了)/ {@link appendMessage}(产生内容)/
|
|
13511
|
+
* {@link recordUsage}(花掉钱)这三处往里加。**读不算**:`epoch sessions list`
|
|
13512
|
+
* 逐个 `get()` 一遍之后,不该把全库都判成「这个进程开着的」,那样退出时会
|
|
13513
|
+
* 给一百段陈年会话统统盖上今天的 `ended_at`,等于把它们的清理倒计时集体重置。
|
|
13514
|
+
*
|
|
13515
|
+
* ⚠️ 只活在内存里,也只该活在内存里:它回答的是「**本进程**手上有谁」,
|
|
13516
|
+
* 而进程没了这个问题就不存在了 —— 那时该问的是库里那格 `ended_at`。
|
|
13517
|
+
*/
|
|
13518
|
+
private readonly touched;
|
|
13448
13519
|
/**
|
|
13449
13520
|
* 开给**模型**那一侧的检索层(方案 48)。
|
|
13450
13521
|
*
|
|
@@ -13504,6 +13575,8 @@ declare class SessionManager implements SessionManager$1 {
|
|
|
13504
13575
|
private generateId;
|
|
13505
13576
|
create(input?: CreateSessionInput): Session;
|
|
13506
13577
|
get(id: string): Session | undefined;
|
|
13578
|
+
/** 判据全文在 {@link SessionDB.hasSession} 上 */
|
|
13579
|
+
has(id: string): boolean;
|
|
13507
13580
|
/**
|
|
13508
13581
|
* 最近的一个会话(`epoch -r` / `sessions resume` 不带 id 时落到这里)。
|
|
13509
13582
|
*
|
|
@@ -13559,6 +13632,18 @@ declare class SessionManager implements SessionManager$1 {
|
|
|
13559
13632
|
olderThanMs: number;
|
|
13560
13633
|
includePinned?: boolean;
|
|
13561
13634
|
}): number;
|
|
13635
|
+
/**
|
|
13636
|
+
* 关掉超期还开着的会话(崩溃残留)。判据全文在
|
|
13637
|
+
* {@link SessionDB.sweepOrphanedSessions} 上 —— 尤其「凭什么敢关」那一节。
|
|
13638
|
+
*
|
|
13639
|
+
* @returns 关掉了几段
|
|
13640
|
+
*/
|
|
13641
|
+
sweepOrphans(input: {
|
|
13642
|
+
olderThanMs: number;
|
|
13643
|
+
now: number;
|
|
13644
|
+
}): number;
|
|
13645
|
+
/** 擦掉结束标记(resume 回到一段已关闭的会话)。见 {@link SessionDB.reopenSession} */
|
|
13646
|
+
reopen(id: string): void;
|
|
13562
13647
|
/** `VACUUM` 能还回来的比例。判据在 {@link SessionDB.freelistRatio} 上 */
|
|
13563
13648
|
freelistRatio(): number;
|
|
13564
13649
|
/**
|
|
@@ -13583,6 +13668,11 @@ declare class SessionManager implements SessionManager$1 {
|
|
|
13583
13668
|
* ⚠️ **第一道和后两道不是一回事**:关掉 `autoPrune` 之后手动那条
|
|
13584
13669
|
* (`epoch sessions prune`)照常能用,那条路上一道节流都没有 ——
|
|
13585
13670
|
* 给用户亲手敲的命令加「你上周刚跑过」说不通。
|
|
13671
|
+
*
|
|
13672
|
+
* ## 它做两件事,不是一件(2026-09-17)
|
|
13673
|
+
*
|
|
13674
|
+
* 先**扫孤儿**({@link SessionDB.sweepOrphanedSessions})再**选候选**。
|
|
13675
|
+
* 顺序和「为什么这一轮扫到的这一轮删不掉」写在底下那段块注释上。
|
|
13586
13676
|
*/
|
|
13587
13677
|
maybeAutoPrune(opts: {
|
|
13588
13678
|
enabled: boolean;
|
|
@@ -13596,6 +13686,7 @@ declare class SessionManager implements SessionManager$1 {
|
|
|
13596
13686
|
now?: () => number;
|
|
13597
13687
|
}): {
|
|
13598
13688
|
skipped: boolean;
|
|
13689
|
+
swept: number;
|
|
13599
13690
|
pruned: number;
|
|
13600
13691
|
vacuumed: boolean;
|
|
13601
13692
|
error?: string;
|
|
@@ -13628,6 +13719,38 @@ declare class SessionManager implements SessionManager$1 {
|
|
|
13628
13719
|
delete(id: string): boolean;
|
|
13629
13720
|
/** 标记会话结束,记录结束时间和原因 */
|
|
13630
13721
|
endSession(id: string, reason?: SessionMeta['endReason']): void;
|
|
13722
|
+
/**
|
|
13723
|
+
* 进程干净退出时,把**本进程碰过的**会话全部打上结束标记(2026-09-17)。
|
|
13724
|
+
*
|
|
13725
|
+
* ## 它补的是一条断链,而那条断链让整个保留期清理成了空转
|
|
13726
|
+
*
|
|
13727
|
+
* {@link endSession} 从写下来那天起**一个生产调用点都没有** —— 2026-09-17
|
|
13728
|
+
* 全仓 grep 只有用例在调,真库实测 **100 段会话里 `ended_at` 非空 0 段**。
|
|
13729
|
+
* 而 {@link SessionDB.pruneCandidates} 的第一道硬闸是 `ended_at IS NOT NULL`,
|
|
13730
|
+
* 于是 `epoch sessions prune` 和开机自动清理**恒选中 0 段**:方案 64 PR-4
|
|
13731
|
+
* 那三格配置接是接上了,却一格都推不动任何东西。
|
|
13732
|
+
*
|
|
13733
|
+
* ⚠️ 这和方案 64 自己要修的那条是**同一个形状**(「读侧全在岗、
|
|
13734
|
+
* 写侧零生产调用点」),只是换了一列 —— 那一份的 §零 逐字写着这句话。
|
|
13735
|
+
*
|
|
13736
|
+
* ## 为什么尺度是「进程退出」,不是「这轮完了」也不是「用户说删」
|
|
13737
|
+
*
|
|
13738
|
+
* 会话是可恢复的,所以 `ended_at` 只能记「**这次运行**结束了」。
|
|
13739
|
+
* 再细一档(每轮收尾就写)会让它退化成 `updatedAt` 的冗余副本,「结束」这个词
|
|
13740
|
+
* 失去含义;再粗一档(只有显式操作才写)等于要求用户手动收工,而没人会做 ——
|
|
13741
|
+
* 那道闸就照旧近似永远关着。接回来的那一下由
|
|
13742
|
+
* `SessionStore.ensure()` 擦掉标记(判据在那儿)。
|
|
13743
|
+
*
|
|
13744
|
+
* ## ⚠️ 它**从不抛**,而且挡不住 `kill -9`
|
|
13745
|
+
*
|
|
13746
|
+
* 它跑在退出路径上:一段会话没打上标记的代价只是「它晚一个保留期才被清理」,
|
|
13747
|
+
* 而抛出去的代价是进程退不干净。所以逐个 try,坏一个不碍着其余。
|
|
13748
|
+
* 强杀 / 崩溃那一档这里一行都跑不到 —— 那是 {@link sweepOrphans} 的差事,
|
|
13749
|
+
* **两者合起来才盖得全**,缺哪一半都会让一批会话永远留在库里。
|
|
13750
|
+
*
|
|
13751
|
+
* @returns 打上标记的会话数
|
|
13752
|
+
*/
|
|
13753
|
+
endTouchedSessions(reason?: SessionMeta['endReason']): number;
|
|
13631
13754
|
/**
|
|
13632
13755
|
* @returns 这条消息的 DB id。按步增量落盘(2026-09-16)之后两处要它:
|
|
13633
13756
|
* 「在飞那一轮从哪条起」的水位线,以及收尾时把这一轮的账挂到**最后一条
|
|
@@ -15384,7 +15507,13 @@ type ScheduleIssueCode =
|
|
|
15384
15507
|
| 'date-range-on-once'
|
|
15385
15508
|
/** 清单里有一条规则写错了(`detail` 是 `rule-validate` 给的位置与原因) */
|
|
15386
15509
|
| 'rule-invalid'
|
|
15387
|
-
/**
|
|
15510
|
+
/**
|
|
15511
|
+
* 「跳过全部检查」+ 空工作区。
|
|
15512
|
+
*
|
|
15513
|
+
* ⚠️ **2026-09-18 起没有产出点了** —— 空着落到的是 `~/.epoch/automation/<id>/`,
|
|
15514
|
+
* 一个确定、专属、隔离的目录,不是「不确定的 cwd」。判据全文在
|
|
15515
|
+
* `validate.ts` 的 `bypassIssues()` 第 1 条上。保留这条 code 是为了不破坏协议。
|
|
15516
|
+
*/
|
|
15388
15517
|
| 'bypass-needs-workdir'
|
|
15389
15518
|
/** 「跳过全部检查」的工作区指到了家目录本身 —— 那和不绑定没有区别 */
|
|
15390
15519
|
| 'bypass-workdir-too-broad'
|
|
@@ -15415,6 +15544,15 @@ interface CreateScheduleInput {
|
|
|
15415
15544
|
/** 不给就落到 `~/.epoch/automation/<id>/`(协议上 `workDir` 那段写了理由) */
|
|
15416
15545
|
workDir?: string;
|
|
15417
15546
|
model?: string;
|
|
15547
|
+
/**
|
|
15548
|
+
* 「召唤专家」——这条任务用哪个身份跑(2026-09-17 接通)。
|
|
15549
|
+
*
|
|
15550
|
+
* ⚠️ **这一格以前不在这个类型上,而 `ScheduleDefinition.role` 一直在** ——
|
|
15551
|
+
* 于是调用方用展开语法(`...(x ? { role: x } : {})`)写进来时 TS **不报**
|
|
15552
|
+
* (多余属性检查对展开不生效),值走到这儿被**静默丢掉**。
|
|
15553
|
+
* 那正是这一格「库里有列、类型里有位、就是永远没有值」的最后一段。
|
|
15554
|
+
*/
|
|
15555
|
+
role?: string;
|
|
15418
15556
|
permission: PermissionLevel;
|
|
15419
15557
|
allowTools?: readonly string[];
|
|
15420
15558
|
allowOperations?: readonly OperationType[];
|
|
@@ -15423,6 +15561,15 @@ interface CreateScheduleInput {
|
|
|
15423
15561
|
/** **必填**,没有默认值 */
|
|
15424
15562
|
maxBudgetUsd: number;
|
|
15425
15563
|
timeoutMs?: number;
|
|
15564
|
+
/**
|
|
15565
|
+
* 跑完的会话直接进会话列表吗。缺省 `false` = 收起来(归档),
|
|
15566
|
+
* 判据全文在 `ScheduleDefinition.showInSessionList` 上。
|
|
15567
|
+
*
|
|
15568
|
+
* ⚠️ **这一格必须在这个类型上**,不能只在 `ScheduleDefinition` 上有位 ——
|
|
15569
|
+
* 判据逐字同上面 `role` 那段:调用方用展开语法写进来时 TS 不报,
|
|
15570
|
+
* 值会被静默丢掉,而表现是「勾了没用」。
|
|
15571
|
+
*/
|
|
15572
|
+
showInSessionList?: boolean;
|
|
15426
15573
|
trigger: ScheduleTrigger;
|
|
15427
15574
|
startDate?: string;
|
|
15428
15575
|
endDate?: string;
|
|
@@ -15459,18 +15606,28 @@ interface CreateScheduleInput {
|
|
|
15459
15606
|
* `ScheduleControl.update` 解析掉;**`ScheduleStore.update` 的入参不收它**
|
|
15460
15607
|
* (同 `create(input & { workDir: string })` 那条契约,收窄在编译期)。
|
|
15461
15608
|
*/
|
|
15462
|
-
type UpdateScheduleInput = Partial<Omit<CreateScheduleInput, 'maxBudgetUsd' | 'workDir' | 'model' | 'startDate' | 'endDate'>> & {
|
|
15609
|
+
type UpdateScheduleInput = Partial<Omit<CreateScheduleInput, 'maxBudgetUsd' | 'workDir' | 'model' | 'role' | 'startDate' | 'endDate'>> & {
|
|
15463
15610
|
maxBudgetUsd?: number;
|
|
15464
15611
|
/** `null` = 不绑工作区了 → 落回 `~/.epoch/automation/<id>/`,**不是**删掉这一格 */
|
|
15465
15612
|
workDir?: string | null;
|
|
15466
15613
|
model?: string | null;
|
|
15614
|
+
/** `null` = 回到默认 agent */
|
|
15615
|
+
role?: string | null;
|
|
15467
15616
|
startDate?: string | null;
|
|
15468
15617
|
endDate?: string | null;
|
|
15469
15618
|
};
|
|
15470
15619
|
/**
|
|
15471
|
-
*
|
|
15620
|
+
* 三把尺子的缺省值 —— **「调 API / CLI 没给这一格时引擎用什么」**。
|
|
15472
15621
|
*
|
|
15473
|
-
* `maxBudgetUsd`
|
|
15622
|
+
* ## ⚠️ `maxBudgetUsd` **不在这里**,而 2026-09-18 之后这句话更要紧了
|
|
15623
|
+
*
|
|
15624
|
+
* 它没有引擎兜底:没给就是一条 `budget-required`(网线上 400,CLI 上必给 `--budget`)。
|
|
15625
|
+
*
|
|
15626
|
+
* 那一天新建**表单**上它开始预填 200 了,而那是**另一份缺省**
|
|
15627
|
+
* (protocol 的 `WireScheduleDefaults.maxBudgetUsd`,判据全文在那个接口上):
|
|
15628
|
+
* 一份说「表单打开时格子里印什么」,一份说「没给值时引擎用什么」。
|
|
15629
|
+
* 把 200 抄进这一份的表现是**网线那一道闸整个消失** —— 任何一个不经表单的调用方
|
|
15630
|
+
* 从此都能建出一条没人想过预算的任务,而那正是这一格的缺席拦着的事。
|
|
15474
15631
|
*/
|
|
15475
15632
|
declare const SCHEDULE_DEFAULTS: {
|
|
15476
15633
|
/**
|
|
@@ -15494,9 +15651,40 @@ declare const SCHEDULE_DEFAULTS: {
|
|
|
15494
15651
|
* 那一格自己填一个数。
|
|
15495
15652
|
*/
|
|
15496
15653
|
readonly maxTurns: 0;
|
|
15497
|
-
/**
|
|
15654
|
+
/**
|
|
15655
|
+
* 墙钟超时。唯一能拦住「一条命令挂住了」的那把尺子 —— 前两把在那种情形下
|
|
15656
|
+
* 都不增长(轮次不动、花费不动)。
|
|
15657
|
+
*
|
|
15658
|
+
* ⚠️ **2026-09-18 从 15 分钟抬到 60 分钟**(用户定的)。15 分钟那条线当初是
|
|
15659
|
+
* 照着「一次巡检」估的,而它砍掉的不是跑飞,是**本来就要跑久的那种任务**:
|
|
15660
|
+
* 一条被这把尺子掐断的运行和跑飞长得一模一样(都是 `timeout`),
|
|
15661
|
+
* 而定时任务的反馈回路按天算 —— 第二天早上看到的只有「超时了」三个字。
|
|
15662
|
+
*
|
|
15663
|
+
* 兜住真正跑飞的是必填的 `maxBudgetUsd`(钱是比时间准的尺子),
|
|
15664
|
+
* 判据同上面 `maxTurns` 那一段。
|
|
15665
|
+
*
|
|
15666
|
+
* ⚠️ 这个数**两条路共用**(CLI 不给 `--timeout`、表单预填,都读它)——
|
|
15667
|
+
* 在服务端那侧另写一份的表现,`runtime/schedule/control.ts` 那段注释记着:
|
|
15668
|
+
* 「表单预填 200、直接调这个 API 却得到 20」。
|
|
15669
|
+
*/
|
|
15498
15670
|
readonly timeoutMs: number;
|
|
15499
15671
|
};
|
|
15672
|
+
/**
|
|
15673
|
+
* 新建**表单**里预算那一格印什么(2026-09-18,用户定的 200 美元)。
|
|
15674
|
+
*
|
|
15675
|
+
* ## ⚠️ 它**刻意不在** {@link SCHEDULE_DEFAULTS} 里,这一条是承重的
|
|
15676
|
+
*
|
|
15677
|
+
* 那一份答的是「调 API / CLI 没给这一格时引擎用什么」,而这一格**没有**那种兜底:
|
|
15678
|
+
* 网线上没给预算就是 400(`budget-required`),CLI 上 `--budget` 照旧必给。
|
|
15679
|
+
*
|
|
15680
|
+
* 这一份答的是另一个问题:「表单打开时那个格子里印着什么」。两者混成一份的表现是
|
|
15681
|
+
* 网线那道闸整个消失 —— 任何一个不经表单的调用方从此都能建出一条没人想过预算的
|
|
15682
|
+
* 任务,而定时任务是没人看着的(一觉醒来那笔账已经花完了)。
|
|
15683
|
+
*
|
|
15684
|
+
* 判据全文、以及这个数撤掉了方案 45 §3.5 的哪一半,写在 protocol 的
|
|
15685
|
+
* `WireScheduleDefaults` 上。
|
|
15686
|
+
*/
|
|
15687
|
+
declare const SCHEDULE_FORM_BUDGET_USD = 200;
|
|
15500
15688
|
/**
|
|
15501
15689
|
* 新建任务时预填的最小清单(方案 45 §3.2 的落点)。
|
|
15502
15690
|
*
|
|
@@ -15615,6 +15803,22 @@ declare class ScheduleStore {
|
|
|
15615
15803
|
recordRun(input: RecordRunInput): ScheduleRun;
|
|
15616
15804
|
/** 最近 N 次运行,最新的在前 */
|
|
15617
15805
|
listRuns(scheduleId: string, limit?: number): ScheduleRun[];
|
|
15806
|
+
/**
|
|
15807
|
+
* 这个任务**最近 N 次运行留下的会话 id**,最新的在前。
|
|
15808
|
+
*
|
|
15809
|
+
* 执行器收尾时拿它去删(缺省不留会话,判据在 runtime 的 `dropSessions` 上)。
|
|
15810
|
+
*
|
|
15811
|
+
* ## 三件刻意的事
|
|
15812
|
+
*
|
|
15813
|
+
* 1. **只回有会话的那几次**(`session_id IS NOT NULL`):三种 `skipped-*` 和
|
|
15814
|
+
* `missed` 压根没起过会话,让它们占掉名额的话,`limit: 2` 会在「昨天跳过
|
|
15815
|
+
* 两次」之后**一条真会话都翻不到**,而那正是要收的残骸。
|
|
15816
|
+
* 2. **回的是 id 不是整行**:调用方只拿它去 `delete()`,交出整行等于多给它
|
|
15817
|
+
* 一堆用不着的字段(以及一个「顺手改点别的」的机会)。
|
|
15818
|
+
* 3. **`schedule_runs` 那一行本身不删**:状态 / 花费 / 欠条永远留着 ——
|
|
15819
|
+
* 被清掉的只是「点开能看的内容」。
|
|
15820
|
+
*/
|
|
15821
|
+
recordedSessions(scheduleId: string, limit?: number): string[];
|
|
15618
15822
|
/**
|
|
15619
15823
|
* 全部任务的最近运行,最新的在前(运行记录那个 tab / TUI 启动提示要的那份)。
|
|
15620
15824
|
*/
|
|
@@ -18713,46 +18917,21 @@ declare function pendingImageTokens(messages: readonly EpochMessage[]): number;
|
|
|
18713
18917
|
*
|
|
18714
18918
|
* ---
|
|
18715
18919
|
*
|
|
18716
|
-
*
|
|
18717
|
-
*
|
|
18718
|
-
* 那一行接上了:`runtime/src/services.ts` 的 `new ContextCompressor()` 现在带着
|
|
18719
|
-
* `...compressionOptions(config)`,收的那一笔在那儿的注释里点名回指了这张 📮。
|
|
18720
|
-
* **下面这一整段原文一个字没改** —— 它是判据(「不收的后果是一句谎话」),
|
|
18721
|
-
* 不是待办;哪天有人重构那个装配点,该重读的就是它。
|
|
18722
|
-
*
|
|
18723
|
-
* ---
|
|
18724
|
-
*
|
|
18725
|
-
* **写这张 📮 的那一轮的禁区是 `packages/runtime/**`,而这个类的装配点正在那儿。**
|
|
18726
|
-
* 所以「配置真的接到压缩器上」这最后一根线,我只做到了给它一个够不错的接头
|
|
18727
|
-
* ({@link compressionOptions}),没能接上去。
|
|
18728
|
-
*
|
|
18729
|
-
* ## 要收的是一处,一行
|
|
18730
|
-
*
|
|
18731
|
-
* [runtime/src/services.ts](../../../runtime/src/services.ts) 里那个
|
|
18732
|
-
* `new ContextCompressor({ summarize })`(`// ---- 上下文压缩 ----` 那一段):
|
|
18733
|
-
*
|
|
18734
|
-
* ```ts
|
|
18735
|
-
* new ContextCompressor({
|
|
18736
|
-
* ...compressionOptions(config), // ← 加这一行
|
|
18737
|
-
* summarize: async (prompt) => { … },
|
|
18738
|
-
* })
|
|
18739
|
-
* ```
|
|
18740
|
-
*
|
|
18741
|
-
* ## 为什么不能绕过去
|
|
18742
|
-
*
|
|
18743
|
-
* 三条路(方案 30 §12.1):**绕过去**等于在 core 里自己读一遍配置 ——
|
|
18744
|
-
* 而 core 拿不到 `config`,`ContextCompressor` 的构造函数是它唯一的入口;
|
|
18745
|
-
* **伸手改**是直接动 runtime,合并必冲突。所以走第三条。
|
|
18920
|
+
* ## ⚠️ 配置必须在装配点接上来,否则那两个开关是**一句谎话**
|
|
18746
18921
|
*
|
|
18747
|
-
*
|
|
18922
|
+
* `ContextCompressor` 的构造函数是配置进来的唯一入口(core 拿不到 `config`),
|
|
18923
|
+
* 接头是 {@link compressionOptions},装配点在
|
|
18924
|
+
* [runtime/src/services.ts](../../../runtime/src/services.ts):
|
|
18925
|
+
* `new ContextCompressor({ ...compressionOptions(config), summarize })`。
|
|
18926
|
+
* **别把那一行摘掉。**
|
|
18748
18927
|
*
|
|
18749
|
-
*
|
|
18750
|
-
*
|
|
18928
|
+
* 摘掉之后:schema 照认这两个键、`epoch config set compression.enabled false`
|
|
18929
|
+
* 照样写得进去、设置页那一行也会把它印出来并标上「② 用户级」—— 而压缩**照压不误**。
|
|
18751
18930
|
* 一个配了、界面确认了、却不生效的开关,比压根没有这个开关坏得多:
|
|
18752
18931
|
* 后者用户会去问,前者他会以为自己已经关掉了。
|
|
18753
18932
|
*
|
|
18754
18933
|
* 这正是设计稿连着两轮记「只记不改」时说的那个空壳(判据逐字:「没有配置项就别画
|
|
18755
|
-
* 开关」)——
|
|
18934
|
+
* 开关」)—— 那一行没接上之前,它只是从「稿子上的空壳」搬成了「配置里的空壳」。
|
|
18756
18935
|
*/
|
|
18757
18936
|
|
|
18758
18937
|
interface ContextCompressorOptions {
|
|
@@ -19504,4 +19683,4 @@ declare function resolveCodeModeWorker(baseDir: string, exists?: typeof existsSy
|
|
|
19504
19683
|
*/
|
|
19505
19684
|
declare function codeModeWorkerPath(): string | undefined;
|
|
19506
19685
|
|
|
19507
|
-
export { AGENT_ROLE_DIAG_MODULE, ARTIFACT_MAX_TOTAL_BYTES, ARTIFACT_RETENTION_DEFAULTS, ATTACHMENT_MAX_TOTAL_BYTES, ATTACHMENT_RETENTION_DEFAULTS, type AcquireResult, type AgentConfig, AgentLoop, type AgentProvider, type AgentSite, type AgentSiteRef, type AppendMessageInput, ApprovalCache, type ApprovalDecision, type ApprovalScope, type ArtifactOpenRefusal, type ArtifactRetention, type AskQuestionDeps, type AttachmentRetention, BLOCKED_TOOLS, type BackendOptions, type BackendOutcome, type BackgroundTaskSource, type BaseOrigin, type BaseSlot, type BeginTurnInput, type BreakdownInput, BudgetGuard, type BudgetGuardOptions, type BudgetInfo, type BudgetLevel, type BudgetOptions, type BudgetStatus, BudgetStore, type BudgetStoreOptions, type BuildFireArgvInput, type BuildIndexOptions, CHECKPOINT_MAX_TOTAL_BYTES, CLAUDE_EVENT_NAMES, CLAUDE_TOOL_NAMES, CODE_MODE_LIMITS, CODE_MODE_SDK_TAG, CONFIG_KEYS, CURRENT_CONFIG_VERSION, type CachedApproval, type CachedDecision, type CheckpointCapture, type CheckpointFile, CheckpointManager, type CheckpointManagerOptions, type CheckpointManifest, CheckpointStore, type CheckpointStoreOptions, type CheckpointSummary, type ClaudeHooksParseOptions, type CodeModeLimits, type CodeRequest, type CodeResult, CodeSandbox, type CommandHookConfig, type CommandHookResult, type CommandLoadOutcome, type CommandLoadSummary, type CommandResult, type CommandRunner, type CompactionResult, type CompiledRules, type ComplianceDirSpec, type ComplianceDirsSummary, ComplianceEngine, type ComplianceEngineInput, type ComplianceGate, type ComplianceHit, type ComplianceRule, type ComplianceRuleSource, type ComplianceSettings, type ComplianceVerdict, type CompressConfig, type CompressResult, type ConfigMigration, type ConfigOrigins, ContextCompressor, type ContextEngine, type CreateScheduleInput, type CreateSessionInput, DEFAULT_COMPLIANCE_ACTIONS, DEFAULT_COMPLIANCE_SETTINGS, DEFAULT_COMPRESSION_THRESHOLD, DEFAULT_GOAL_MAX_ROUNDS, DEFAULT_MAX_HOLD_CHARS, type DelegateArgs, type DelegateConfig, DelegateManager, type DelegateTaskResult, type DiagnoseOptions, type DiscoverOutcome, type DiscoveredFile, type DoctorReport, type DraftParse, EMPTY_RULES, EPOCH_DISK_LEDGER, EpochConfigSchema, type ExpandOptions, type ExtractOutcome, FTS_TABLES, FTS_TRIGGERS, type FallbackEvent, type FileSlots, type FileSourceKind, type ForkInput, type FrontmatterParse, type FrontmatterSplit, type FtsHealth, type FtsReclaim, type FtsSpace, type FtsTableHealth, GOAL_BLOCK_CODES, type GateAxis, type GateVerdict, type GenerateInput, type GenerateOutput, type Goal, type GoalBlockReason, type GoalClear, type GoalPhase, type GoalPromptView, type GoalRefusal, type GoalRoundResult, GoalService, GoalStore, type GoalToolDeps, type GoalWrite, HEADLESS_AUDIT_CODES, type HeadlessPolicy, type HookConfigEntry, HookManager, type HookManagerOptions, type HookMatcher, type HookSourceKind, type HookSourceStatus, type HookSourcesOptions, type HookSourcesSummary, type HooksParseOutcome, type MemoryManager$1 as IMemoryManager, INSTRUCTION_BUDGET_CHARS, INSTRUCTION_FILES, type SessionManager$1 as ISessionManager, type SkillSystem$1 as ISkillSystem, ImageLoadError, type ImageSize, type ImportDecision, type ImportGate, type ImportNode, type ImportSkipReason, ImportTrustStore, type InstallOptions, type InstallOutcome, type InstallPreview, type InstructionScan, type InstructionSource, type IsolationReason, type IsolationReport, type JsonSchemaDocument, LAUNCHD_LABEL_PREFIX, LOCK_HEARTBEAT_MS, LOCK_STALE_MS, type LastOpenSession, LastOpenSessions, type LayerOutcome, type LayerScalars, type LayerStatus, type LearningContext, type LearningResult, type LearningSkipReason, type LexiconLoadOutcome, type LifecycleOutcome, type ListCandidatesInput, type ListSessionsInput, type ListSessionsOutput, type LoadCommandsOptions, type LoadConfigOptions, type LoadKeybindingsOptions, type LoadKeybindingsResult, type LoadRolesOptions, type LoadedPlugin, type LockHolder, MARKETPLACE_DISPLAY_FIELDS, MARKETPLACE_FILE, MAX_AUDIT_ENTRIES, MAX_COMMAND_DEPTH, MAX_GOAL_MAX_ROUNDS, MAX_IMPORT_DEPTH, MAX_LAST_OPEN_SESSIONS, MAX_OBJECTIVE_CHARS, MAX_REASON_CHARS, MAX_RECENT_WORKSPACES, MODEL_GIVE_UP_THRESHOLD, MULTIMODAL_DEFAULTS, type ManagedPolicy, ManagedPolicyError, type ManagedSettings, ManagedSettingsSchema, type MarketplaceCatalog, type MarketplaceDisplay, type MarketplaceDisplayField, type MarketplaceEntry, type MarketplaceOutcome, type MarketplaceRecord, type MarketplaceStatus, type MemoryConfig, type MemoryEntry, MemoryManager, MemoryReviewer, type MemorySearchResult, type MemoryTarget, type MemoryWriteResult, type MentionPart, type MentionResolution, type Message, type MessageHit, type MessageRecord, type MessageSurface, type ModelCapability, ModelFailureTracker, type ModelMetaEntry, type ModelPricing, type MultimodalPolicy, NOMINAL_TOTAL_BYTES, NO_REVEALED_TOOLS, type NonInteractiveProbe, type OsTaskSnapshot, type OutputGuard, PACK_EXCLUDES, PACK_MAX_BYTES, PACK_MAX_FILES, PERMISSION_AUDIT_CODES, PLUGIN_LAYOUT, PLUGIN_MANIFEST_FILE, PLUGIN_MANIFEST_KEYS, PLUGIN_NAME_PATTERN, PLUGIN_ROOT_ENV, PLUGIN_ROOT_TOKEN, PLUGIN_VISIBILITY, POLICY_DECISIONS, PROBE_VERSION, PROJECT_AGENTS_SUBDIR, PROVIDER_NO_CREDENTIAL, type PackFile, type PackLimits, type PackOutcome, type PackPlan, type PackPlanOutcome, type PermissionAuditCode, type PermissionAuditEntry, type PermissionAuditOutcome, type PermissionAuditScope, type PermissionAuditSnapshot, PermissionManager, type PersistedBudget, type PersistedPart, type PlanApprovalFn, type PlanEnterResult, type PlanModeDeps, PlanModeState, type PlanSettlement, type PluginArtifacts, type PluginAuthor, PluginAuthorSchema, type PluginCommandDir, type PluginCounts, type PluginHookFile, type PluginInventory, type PluginLoadOptions, type PluginManifest, type PluginPathRef, type PluginRecord, type PluginSettingsFile, type PluginSourceType, type PluginStateReadOutcome, PluginStore, type PluginVisibility, type PolicyDirSpec, type PolicyDirsSummary, type PolicyLoadOutcome, type PolicyRule, PolicyRuleSchema, type PricingAt, type PricingOverride, type ProjectContext, type ProjectExtensionInventory, ProviderError, ProviderRouter, type ProviderStreamChunk, type ProviderToolCall$1 as ProviderToolCall, type ProviderWarning, type PruneResult, type QuestionAskFn, RECORDING_KEEP_RUNS, RECORDING_MAX_BYTES, ROLE_FRONTMATTER_SCHEMA, RUN_CODE_TOOL, type ReadMessagesInput, type ReadMessagesOutput, type RecentWorkspace, RecentWorkspaces, type RecordRunInput, type RecorderOptions, type RecoveryAction, type RegisterInput, type RegisterOutcome, type RegistrarOptions, type RegistrationPatch, type RepairOutcome, type ResolveMentionsOptions, type ResolveReferenceInput, type ResolveSettingsOptions, type ResolvedCompression, type ResolvedReference, type ResolvedSource, type ResponseFormat, type RestorePartsOptions, type ReviewIssue, type RewindAction, type RewindDrift, type RewindFilePlan, type RewindOptions, type RewindOutcome, type RewindPreview, type RoleCreateFailure, type RoleCreateInput, type RoleCreateOptions, type RoleCreateOutcome, type RoleLoadOutcome, type RoleLoadSummary, type RoleMergeNotice, type RoleMergeResult, type RoleRemoveFailure, type RoleRemoveOptions, type RoleRemoveOutcome, type RoleScope, type RuleMatch, type RuleSuggestion, type RuleVerdict, type RunCodeFailure, type RunCodeInput, type RunCodeOutcome, type RunCodeToolDeps, type RunEstimateInput, type RunInput, type RunResult, type RunningSchedule, SANDBOX_COVERS, SANDBOX_EXCLUDES, SCALAR_KEYS, SCHEDULE_DEFAULTS, SCHEDULE_DEFAULT_ALLOWLIST, SCHEDULE_ISSUE_CODES, SCHTASKS_FOLDER, SESSION_MESSAGES_READ_TOOL, SESSION_MESSAGES_SEARCH_TOOL, SESSION_QUERY_TOOLS, SESSION_SEARCH_TOOL, SESSION_TRACE_TOOL, SETTINGS_LAYER_ORDER, SETTING_WRITE_KEYS, SETTING_WRITE_LAYERS, SKILL_CREATE_TOOL, SKILL_EDIT_TOOL, SKILL_PATCH_TOOL, SKILL_VIEW_TOOL, SKILL_WRITE_FILE_TOOL, SLASH_COMMANDS_DIAG_MODULE, type ScalarKey, type ScanInstructionsOptions, type ScheduleArgvRefusal, type ScheduleArgvResult, type ScheduleArgvWarning, type ScheduleBackend, type ScheduleCliEntry, type ScheduleDraftDeps, type ScheduleDrift, type ScheduleDriftKind, type ScheduleInstallForm, type ScheduleIssue, type ScheduleIssueCode, type ScheduleLock, ScheduleRecorder, ScheduleRegistrar, ScheduleStore, type ScheduleValidation, type SchemaExport, type SearchHit, type SearchInput, type SearchMessagesInput, type SearchMessagesOutput, type SearchOutput, type SearchSessionsInput, type SelectionDeps, type SelfConnector, type SelfIndexInput, type SelfSettings, type Session, type SessionCandidate, type SessionHit, SessionManager, type SessionMentionDeps, type SessionMeta, SessionQueries, SessionReferences, type SessionSearchDeps, type SessionStats, type SessionSurface, type SessionTrace, type SessionVisibility, type SessionVisibilityInput, type SettingApply, type SettingApplyFacts, type SettingChain, type SettingFutile, type SettingLayer, type SettingStep, type SettingValue, type SettingValueKind, type SettingWriteFailure, type SettingWriteKey, type SettingWriteLayer, type SettingWriteOutcome, type SettingWriteRequest, type SettingWriteTarget, type SettingWriteTargetsOptions, type SettingsFile, SettingsFileError, SettingsFileSchema, type SettingsLayer, type SettingsResolution, type ShadowFinding, type ShadowKind, type Skill, type SkillDirSource, type SkillDirSpec, type SkillDirsSummary, type SkillImportConflict, type SkillImportDone, type SkillImportEntry, type SkillImportFailure, type SkillImportForm, type SkillImportOptions, type SkillImportPreview, type SkillImportResult, type SkillIndexEntry, type SkillIndexOptions, type SkillIndexResidency, type SkillIndexStats, SkillLearner, type SkillLearningProvider, type SkillMeta, type SkillStats, SkillSystem, type SkillSystemOptions, type SkillViewDeps, type SkillWriteDeps, type SteerSource, type SubAgentRunner, type SubTask, type SubToolCaller, type SummarizeOutput, type SurfaceMessage, type SystemPromptParams, type SystemPromptSegments, TOOL_SEARCH_TOOL, TaskNoticeTracker, type TodoItem, type ToolCall, type ToolConflict, type ToolGate, type ToolNameFidelity, type ToolNameLookup, ToolRegistry, type ToolRevealState, type ToolScope, type ToolSearchDeps, type ToolTableCost, type TraceInput, type TraceNode, TrackerDB, type TrustDecision, type TrustGate, type TrustGateOptions, TrustManager, type TurnRecord, type TurnTiming, type UpdateScheduleInput, type UtilityModelInfo, type ValidateScheduleInput, type VersionCheck, Workspace, type WorkspaceFiles, type WorkspaceIssue, type WorkspaceIssueKind, acquireScheduleLock, addMarketplace, addUsage, admitArtifact, admitArtifacts, affectedPaths, artifactLaunchArgv, artifactOpenRefusal, assertLevelAllowed, blockedRoleTools, buildContextBreakdown, buildFireArgv, buildFtsMatchQuery, buildSchemaExports, buildSystemPrompt, buildTrigramMatchQuery, builtinRoles, checkEpochVersion, checkFtsHealth, checkShadowing, classifyProviderError, clearModelCache, coalesceRecording, codeModeWorkerPath, commandNameFromRelPath, compileRuleLists, compressionOptions, computeCost, computeCostMicros, computeExecHash, countRules, createAllowAllGate, createAllowAllImportGate, createAskQuestionTool, createCodeExecTool, createDelegateTool, createDenyAllGate, createDenyAllImportGate, createGoalTool, createImportGate, createMemoryTool, createPlanModeTools, createRoleFile, createRoleScope, createRunCodeTool, createScheduleDraftTool, createSessionMessagesReadTool, createSessionMessagesSearchTool, createSessionSearchTool, createSessionSearchTools, createSessionTraceTool, createSkillViewTool, createSkillWriteTools, createTodoTool, createToolRevealState, createToolScope, createToolSearchTool, createTrustGate, currentEpochVersion, decideImport, decideTrust, defaultConfig, defaultModelOf, describeArtifactRefusal, describeBackgroundTask, describeHeadlessPolicy, describeIsolation, describeJsonError, diagnoseSchedules, discoverMarkdown, discoverModels, discoverProject, displayCurrency, draftCommandLine, draftWidening, escapeRuleContent, estimateImageTokens, estimateRunTokens, estimateTokens, evaluateSelection, expandCommand, expandImports, explainSetting, extractArchive, findInstructionFiles, findProjectInstructions, findRole, formatBytes, formatSkillIndex, formatUsd, gateForTool, getCapability, getConfigIssues, getConfigOrigins, getImportGate, getTrustGate, hasDedicatedExecContent, hasExecTierContent, hasPromptCaching, hasProviderCredentials, hasReadTierContent, imageFromBase64, imageFromPath, imagePartTokens, importSkills, installPlugin, instructionDirs, instructionNotices, intervalSlots, inventoryProjectExtensions, inventoryTotal, isBlockCode, isCodeModeDeferred, isEmptyRules, isGoalPhase, isNonInteractive, isReadOnlySubCall, isSettingWriteLayer, isValidPluginName, isWithinWindow, isWritableSettingKey, labelSlug, layerRank, listRunningSchedules, listSessionCandidates, listWorkspaceFiles, loadCommandDefinitions, loadCommandFile, loadCommands, loadConfig, loadHookSources, loadKeybindings, loadLexiconDir, loadLexiconFiles, loadPlugins, loadPolicyFiles, loadPolicyRules, loadRoleDefinitions, loadRoleDir, loadedImports, localDateString, managedSwitchNotes, mapClaudeToolName, mapEpochToolName, mapOperationType, matchPreauthorization, matchRuleLists, matchesHook, mentionsPluginRoot, mergeHeadlessPolicy, mergeRoles, mergeSchedulePatch, microsToUsd, modelListCandidates, needsAllowlist, nextFallbackModel, nextRunAt, noConfigOrigins, noManagedPolicy, noPlugins, openArtifact, originOf, packFileName, packPlugin, parseClaudeSettingsHooks, parseClock, parseDate, parseFrontmatter, parseHooksConfig, parseHooksConfigVerbose, parseImportLine, parseModelList, parseRoleDefinition, parseScheduleDraft, parseSkillFrontmatter, parseTrigger, pendingImageTokens, persistParts, persistToolResults, persistedUsage, planPack, previewSkillImport, pricingFor, projectEntryForDisplay, pruneArtifacts, pruneAttachments, pruneRecordings, pruneSchedules, readImageSize, readMarketplaces, readPluginManifest, readPluginRecords, readProviderKeyEnv, readRecording, readSessionSurface, reclaimFtsSpace, redactLine, refreshOpenRouterMetadata, removeMarketplace, removeRecordings, removeRoleFile, removeSessionArtifacts, removeSessionAttachments, renderImportTree, renderProjectContext, renderSdkDeclaration, renderSelfIndex, repairSchedules, resolveArtifactRetention, resolveCodeModeWorker, resolveComplianceDirs, resolveEntrySource, resolveInWorkspace, resolveMarketplaceRef, resolveMentions, resolveMultimodalPolicy, resolvePolicyDirs, resolvePricingAt, resolveProjectRoot, resolveScheduleBackend, resolveSessionReference, resolveSessionVisibility, resolveSettings, resolveSkillDirs, resolveSource, resolveTar, resolveWorkspace, restoreParts, revealScopedProvider, roleScopedProvider, roleSourceLabel, ruleCovers, ruleFromString, ruleToString, runCode, runCommand, sanitizeArgNames, sanitizeCommand, sanitizeFtsQuery, sanitizePath, sanitizeToolOutput, scanInstructions, scanPluginDir, scanSkillDirs, searchMarketplaces, setDisplayCurrency, setImportGate, setPluginEnabled, setTrustGate, settingValueChoices, settingValueKind, settingWriteApply, settingWriteLayers, settingWriteTargets, skillIndexDescription, skillIndexResidency, skillIndexStats, sniffMediaType, splitFrontmatter, staticToolProvider, stripArtifactData, substitutePluginRoot, suggestRuleFromApproval, systemOpenArgv, systemPromptSegments, toPosix, toolDefinitionTokens, toolMatches, toolTableTokens, totalTokens, traceSession, triggerPeriodMs, unescapeRuleContent, uninstallPlugin, unknownRoleSkills, unknownRoleTools, unloadedInstructionFiles, updateMarketplace, updatePlugin, usdToMicros, validateSchedule, validateTrigger, validateWindow, withGoalCompression, withGoalPrompt, workspaceDisplayPath, writeSettingValue };
|
|
19686
|
+
export { AGENT_ROLE_DIAG_MODULE, ARTIFACT_MAX_TOTAL_BYTES, ARTIFACT_RETENTION_DEFAULTS, ATTACHMENT_MAX_TOTAL_BYTES, ATTACHMENT_RETENTION_DEFAULTS, type AcquireResult, type AgentConfig, AgentLoop, type AgentProvider, type AgentSite, type AgentSiteRef, type AppendMessageInput, ApprovalCache, type ApprovalDecision, type ApprovalScope, type ArtifactOpenRefusal, type ArtifactRetention, type AskQuestionDeps, type AttachmentRetention, BLOCKED_TOOLS, type BackendOptions, type BackendOutcome, type BackgroundTaskSource, type BaseOrigin, type BaseSlot, type BeginTurnInput, type BreakdownInput, BudgetGuard, type BudgetGuardOptions, type BudgetInfo, type BudgetLevel, type BudgetOptions, type BudgetStatus, BudgetStore, type BudgetStoreOptions, type BuildFireArgvInput, type BuildIndexOptions, CHECKPOINT_MAX_TOTAL_BYTES, CLAUDE_EVENT_NAMES, CLAUDE_TOOL_NAMES, CODE_MODE_LIMITS, CODE_MODE_SDK_TAG, CONFIG_KEYS, CURRENT_CONFIG_VERSION, type CachedApproval, type CachedDecision, type CheckpointCapture, type CheckpointFile, CheckpointManager, type CheckpointManagerOptions, type CheckpointManifest, CheckpointStore, type CheckpointStoreOptions, type CheckpointSummary, type ClaudeHooksParseOptions, type CodeModeLimits, type CodeRequest, type CodeResult, CodeSandbox, type CommandHookConfig, type CommandHookResult, type CommandLoadOutcome, type CommandLoadSummary, type CommandResult, type CommandRunner, type CompactionResult, type CompiledRules, type ComplianceDirSpec, type ComplianceDirsSummary, ComplianceEngine, type ComplianceEngineInput, type ComplianceGate, type ComplianceHit, type ComplianceRule, type ComplianceRuleSource, type ComplianceSettings, type ComplianceVerdict, type CompressConfig, type CompressResult, type ConfigMigration, type ConfigOrigins, ContextCompressor, type ContextEngine, type CreateScheduleInput, type CreateSessionInput, DEFAULT_COMPLIANCE_ACTIONS, DEFAULT_COMPLIANCE_SETTINGS, DEFAULT_COMPRESSION_THRESHOLD, DEFAULT_GOAL_MAX_ROUNDS, DEFAULT_MAX_HOLD_CHARS, type DelegateArgs, type DelegateConfig, DelegateManager, type DelegateTaskResult, type DiagnoseOptions, type DiscoverOutcome, type DiscoveredFile, type DoctorReport, type DraftParse, EMPTY_RULES, EPOCH_DISK_LEDGER, EpochConfigSchema, type ExpandOptions, type ExtractOutcome, FTS_TABLES, FTS_TRIGGERS, type FallbackEvent, type FileSlots, type FileSourceKind, type ForkInput, type FrontmatterParse, type FrontmatterSplit, type FtsHealth, type FtsReclaim, type FtsSpace, type FtsTableHealth, GOAL_BLOCK_CODES, type GateAxis, type GateVerdict, type GenerateInput, type GenerateOutput, type Goal, type GoalBlockReason, type GoalClear, type GoalPhase, type GoalPromptView, type GoalRefusal, type GoalRoundResult, GoalService, GoalStore, type GoalToolDeps, type GoalWrite, HEADLESS_AUDIT_CODES, type HeadlessPolicy, type HookConfigEntry, HookManager, type HookManagerOptions, type HookMatcher, type HookSourceKind, type HookSourceStatus, type HookSourcesOptions, type HookSourcesSummary, type HooksParseOutcome, type MemoryManager$1 as IMemoryManager, INSTRUCTION_BUDGET_CHARS, INSTRUCTION_FILES, type SessionManager$1 as ISessionManager, type SkillSystem$1 as ISkillSystem, ImageLoadError, type ImageSize, type ImportDecision, type ImportGate, type ImportNode, type ImportSkipReason, ImportTrustStore, type InstallOptions, type InstallOutcome, type InstallPreview, type InstructionScan, type InstructionSource, type IsolationReason, type IsolationReport, type JsonSchemaDocument, LAUNCHD_LABEL_PREFIX, LOCK_HEARTBEAT_MS, LOCK_STALE_MS, type LastOpenSession, LastOpenSessions, type LayerOutcome, type LayerScalars, type LayerStatus, type LearningContext, type LearningResult, type LearningSkipReason, type LexiconLoadOutcome, type LifecycleOutcome, type ListCandidatesInput, type ListSessionsInput, type ListSessionsOutput, type LoadCommandsOptions, type LoadConfigOptions, type LoadKeybindingsOptions, type LoadKeybindingsResult, type LoadRolesOptions, type LoadedPlugin, type LockHolder, MARKETPLACE_DISPLAY_FIELDS, MARKETPLACE_FILE, MAX_AUDIT_ENTRIES, MAX_COMMAND_DEPTH, MAX_GOAL_MAX_ROUNDS, MAX_IMPORT_DEPTH, MAX_LAST_OPEN_SESSIONS, MAX_OBJECTIVE_CHARS, MAX_REASON_CHARS, MAX_RECENT_WORKSPACES, MODEL_GIVE_UP_THRESHOLD, MULTIMODAL_DEFAULTS, type ManagedPolicy, ManagedPolicyError, type ManagedSettings, ManagedSettingsSchema, type MarketplaceCatalog, type MarketplaceDisplay, type MarketplaceDisplayField, type MarketplaceEntry, type MarketplaceOutcome, type MarketplaceRecord, type MarketplaceStatus, type MemoryConfig, type MemoryEntry, MemoryManager, MemoryReviewer, type MemorySearchResult, type MemoryTarget, type MemoryWriteResult, type MentionPart, type MentionResolution, type Message, type MessageHit, type MessageRecord, type MessageSurface, type ModelCapability, ModelFailureTracker, type ModelMetaEntry, type ModelPricing, type MultimodalPolicy, NOMINAL_TOTAL_BYTES, NO_REVEALED_TOOLS, type NonInteractiveProbe, type OsTaskSnapshot, type OutputGuard, PACK_EXCLUDES, PACK_MAX_BYTES, PACK_MAX_FILES, PERMISSION_AUDIT_CODES, PLUGIN_LAYOUT, PLUGIN_MANIFEST_FILE, PLUGIN_MANIFEST_KEYS, PLUGIN_NAME_PATTERN, PLUGIN_ROOT_ENV, PLUGIN_ROOT_TOKEN, PLUGIN_VISIBILITY, POLICY_DECISIONS, PROBE_VERSION, PROJECT_AGENTS_SUBDIR, PROVIDER_NO_CREDENTIAL, type PackFile, type PackLimits, type PackOutcome, type PackPlan, type PackPlanOutcome, type PermissionAuditCode, type PermissionAuditEntry, type PermissionAuditOutcome, type PermissionAuditScope, type PermissionAuditSnapshot, PermissionManager, type PersistedBudget, type PersistedPart, type PlanApprovalFn, type PlanEnterResult, type PlanModeDeps, PlanModeState, type PlanSettlement, type PluginArtifacts, type PluginAuthor, PluginAuthorSchema, type PluginCommandDir, type PluginCounts, type PluginHookFile, type PluginInventory, type PluginLoadOptions, type PluginManifest, type PluginPathRef, type PluginRecord, type PluginSettingsFile, type PluginSourceType, type PluginStateReadOutcome, PluginStore, type PluginVisibility, type PolicyDirSpec, type PolicyDirsSummary, type PolicyLoadOutcome, type PolicyRule, PolicyRuleSchema, type PricingAt, type PricingOverride, type ProjectContext, type ProjectExtensionInventory, ProviderError, ProviderRouter, type ProviderStreamChunk, type ProviderToolCall$1 as ProviderToolCall, type ProviderWarning, type PruneResult, type QuestionAskFn, RECORDING_KEEP_RUNS, RECORDING_MAX_BYTES, ROLE_FRONTMATTER_SCHEMA, RUN_CODE_TOOL, type ReadMessagesInput, type ReadMessagesOutput, type RecentWorkspace, RecentWorkspaces, type RecordRunInput, type RecorderOptions, type RecoveryAction, type RegisterInput, type RegisterOutcome, type RegistrarOptions, type RegistrationPatch, type RepairOutcome, type ResolveMentionsOptions, type ResolveReferenceInput, type ResolveSettingsOptions, type ResolvedCompression, type ResolvedReference, type ResolvedSource, type ResponseFormat, type RestorePartsOptions, type ReviewIssue, type RewindAction, type RewindDrift, type RewindFilePlan, type RewindOptions, type RewindOutcome, type RewindPreview, type RoleCreateFailure, type RoleCreateInput, type RoleCreateOptions, type RoleCreateOutcome, type RoleLoadOutcome, type RoleLoadSummary, type RoleMergeNotice, type RoleMergeResult, type RoleRemoveFailure, type RoleRemoveOptions, type RoleRemoveOutcome, type RoleScope, type RuleMatch, type RuleSuggestion, type RuleVerdict, type RunCodeFailure, type RunCodeInput, type RunCodeOutcome, type RunCodeToolDeps, type RunEstimateInput, type RunInput, type RunResult, type RunningSchedule, SANDBOX_COVERS, SANDBOX_EXCLUDES, SCALAR_KEYS, SCHEDULE_DEFAULTS, SCHEDULE_DEFAULT_ALLOWLIST, SCHEDULE_FORM_BUDGET_USD, SCHEDULE_ISSUE_CODES, SCHTASKS_FOLDER, SESSION_MESSAGES_READ_TOOL, SESSION_MESSAGES_SEARCH_TOOL, SESSION_QUERY_TOOLS, SESSION_SEARCH_TOOL, SESSION_TRACE_TOOL, SETTINGS_LAYER_ORDER, SETTING_WRITE_KEYS, SETTING_WRITE_LAYERS, SKILL_CREATE_TOOL, SKILL_EDIT_TOOL, SKILL_PATCH_TOOL, SKILL_VIEW_TOOL, SKILL_WRITE_FILE_TOOL, SLASH_COMMANDS_DIAG_MODULE, type ScalarKey, type ScanInstructionsOptions, type ScheduleArgvRefusal, type ScheduleArgvResult, type ScheduleArgvWarning, type ScheduleBackend, type ScheduleCliEntry, type ScheduleDraftDeps, type ScheduleDrift, type ScheduleDriftKind, type ScheduleInstallForm, type ScheduleIssue, type ScheduleIssueCode, type ScheduleLock, ScheduleRecorder, ScheduleRegistrar, ScheduleStore, type ScheduleValidation, type SchemaExport, type SearchHit, type SearchInput, type SearchMessagesInput, type SearchMessagesOutput, type SearchOutput, type SearchSessionsInput, type SelectionDeps, type SelfConnector, type SelfIndexInput, type SelfSettings, type Session, type SessionCandidate, type SessionHit, SessionManager, type SessionMentionDeps, type SessionMeta, SessionQueries, SessionReferences, type SessionSearchDeps, type SessionStats, type SessionSurface, type SessionTrace, type SessionVisibility, type SessionVisibilityInput, type SettingApply, type SettingApplyFacts, type SettingChain, type SettingFutile, type SettingLayer, type SettingStep, type SettingValue, type SettingValueKind, type SettingWriteFailure, type SettingWriteKey, type SettingWriteLayer, type SettingWriteOutcome, type SettingWriteRequest, type SettingWriteTarget, type SettingWriteTargetsOptions, type SettingsFile, SettingsFileError, SettingsFileSchema, type SettingsLayer, type SettingsResolution, type ShadowFinding, type ShadowKind, type Skill, type SkillDirSource, type SkillDirSpec, type SkillDirsSummary, type SkillImportConflict, type SkillImportDone, type SkillImportEntry, type SkillImportFailure, type SkillImportForm, type SkillImportOptions, type SkillImportPreview, type SkillImportResult, type SkillIndexEntry, type SkillIndexOptions, type SkillIndexResidency, type SkillIndexStats, SkillLearner, type SkillLearningProvider, type SkillMeta, type SkillStats, SkillSystem, type SkillSystemOptions, type SkillViewDeps, type SkillWriteDeps, type SteerSource, type SubAgentRunner, type SubTask, type SubToolCaller, type SummarizeOutput, type SurfaceMessage, type SystemPromptParams, type SystemPromptSegments, TOOL_SEARCH_TOOL, TaskNoticeTracker, type TodoItem, type ToolCall, type ToolConflict, type ToolGate, type ToolNameFidelity, type ToolNameLookup, ToolRegistry, type ToolRevealState, type ToolScope, type ToolSearchDeps, type ToolTableCost, type TraceInput, type TraceNode, TrackerDB, type TrustDecision, type TrustGate, type TrustGateOptions, TrustManager, type TurnRecord, type TurnTiming, type UpdateScheduleInput, type UtilityModelInfo, type ValidateScheduleInput, type VersionCheck, Workspace, type WorkspaceFiles, type WorkspaceIssue, type WorkspaceIssueKind, acquireScheduleLock, addMarketplace, addUsage, admitArtifact, admitArtifacts, affectedPaths, artifactLaunchArgv, artifactOpenRefusal, assertLevelAllowed, blockedRoleTools, buildContextBreakdown, buildFireArgv, buildFtsMatchQuery, buildSchemaExports, buildSystemPrompt, buildTrigramMatchQuery, builtinRoles, checkEpochVersion, checkFtsHealth, checkShadowing, classifyProviderError, clearModelCache, coalesceRecording, codeModeWorkerPath, commandNameFromRelPath, compileRuleLists, compressionOptions, computeCost, computeCostMicros, computeExecHash, countRules, createAllowAllGate, createAllowAllImportGate, createAskQuestionTool, createCodeExecTool, createDelegateTool, createDenyAllGate, createDenyAllImportGate, createGoalTool, createImportGate, createMemoryTool, createPlanModeTools, createRoleFile, createRoleScope, createRunCodeTool, createScheduleDraftTool, createSessionMessagesReadTool, createSessionMessagesSearchTool, createSessionSearchTool, createSessionSearchTools, createSessionTraceTool, createSkillViewTool, createSkillWriteTools, createTodoTool, createToolRevealState, createToolScope, createToolSearchTool, createTrustGate, currentEpochVersion, decideImport, decideTrust, defaultConfig, defaultModelOf, describeArtifactRefusal, describeBackgroundTask, describeHeadlessPolicy, describeIsolation, describeJsonError, diagnoseSchedules, discoverMarkdown, discoverModels, discoverProject, displayCurrency, draftCommandLine, draftWidening, escapeRuleContent, estimateImageTokens, estimateRunTokens, estimateTokens, evaluateSelection, expandCommand, expandImports, explainSetting, extractArchive, findInstructionFiles, findProjectInstructions, findRole, formatBytes, formatSkillIndex, formatUsd, gateForTool, getCapability, getConfigIssues, getConfigOrigins, getImportGate, getTrustGate, hasDedicatedExecContent, hasExecTierContent, hasPromptCaching, hasProviderCredentials, hasReadTierContent, imageFromBase64, imageFromPath, imagePartTokens, importSkills, installPlugin, instructionDirs, instructionNotices, intervalSlots, inventoryProjectExtensions, inventoryTotal, isBlockCode, isCodeModeDeferred, isEmptyRules, isGoalPhase, isNonInteractive, isReadOnlySubCall, isSettingWriteLayer, isValidPluginName, isWithinWindow, isWritableSettingKey, labelSlug, layerRank, listRunningSchedules, listSessionCandidates, listWorkspaceFiles, loadCommandDefinitions, loadCommandFile, loadCommands, loadConfig, loadHookSources, loadKeybindings, loadLexiconDir, loadLexiconFiles, loadPlugins, loadPolicyFiles, loadPolicyRules, loadRoleDefinitions, loadRoleDir, loadedImports, localDateString, managedSwitchNotes, mapClaudeToolName, mapEpochToolName, mapOperationType, matchPreauthorization, matchRuleLists, matchesHook, mentionsPluginRoot, mergeHeadlessPolicy, mergeRoles, mergeSchedulePatch, microsToUsd, modelListCandidates, needsAllowlist, nextFallbackModel, nextRunAt, noConfigOrigins, noManagedPolicy, noPlugins, openArtifact, originOf, packFileName, packPlugin, parseClaudeSettingsHooks, parseClock, parseDate, parseFrontmatter, parseHooksConfig, parseHooksConfigVerbose, parseImportLine, parseModelList, parseRoleDefinition, parseScheduleDraft, parseSkillFrontmatter, parseTrigger, pendingImageTokens, persistParts, persistToolResults, persistedUsage, planPack, previewSkillImport, pricingFor, projectEntryForDisplay, pruneArtifacts, pruneAttachments, pruneRecordings, pruneSchedules, readImageSize, readMarketplaces, readPluginManifest, readPluginRecords, readProviderKeyEnv, readRecording, readSessionSurface, reclaimFtsSpace, redactLine, refreshOpenRouterMetadata, removeMarketplace, removeRecordings, removeRoleFile, removeSessionArtifacts, removeSessionAttachments, renderImportTree, renderProjectContext, renderSdkDeclaration, renderSelfIndex, repairSchedules, resolveArtifactRetention, resolveCodeModeWorker, resolveComplianceDirs, resolveEntrySource, resolveInWorkspace, resolveMarketplaceRef, resolveMentions, resolveMultimodalPolicy, resolvePolicyDirs, resolvePricingAt, resolveProjectRoot, resolveScheduleBackend, resolveSessionReference, resolveSessionVisibility, resolveSettings, resolveSkillDirs, resolveSource, resolveTar, resolveWorkspace, restoreParts, revealScopedProvider, roleScopedProvider, roleSourceLabel, ruleCovers, ruleFromString, ruleToString, runCode, runCommand, sanitizeArgNames, sanitizeCommand, sanitizeFtsQuery, sanitizePath, sanitizeToolOutput, scanInstructions, scanPluginDir, scanSkillDirs, searchMarketplaces, setDisplayCurrency, setImportGate, setPluginEnabled, setTrustGate, settingValueChoices, settingValueKind, settingWriteApply, settingWriteLayers, settingWriteTargets, skillIndexDescription, skillIndexResidency, skillIndexStats, sniffMediaType, splitFrontmatter, staticToolProvider, stripArtifactData, substitutePluginRoot, suggestRuleFromApproval, systemOpenArgv, systemPromptSegments, toPosix, toolDefinitionTokens, toolMatches, toolTableTokens, totalTokens, traceSession, triggerPeriodMs, unescapeRuleContent, uninstallPlugin, unknownRoleSkills, unknownRoleTools, unloadedInstructionFiles, updateMarketplace, updatePlugin, usdToMicros, validateSchedule, validateTrigger, validateWindow, withGoalCompression, withGoalPrompt, workspaceDisplayPath, writeSettingValue };
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { existsSync, statSync, readdirSync, readFileSync, mkdirSync, writeFileSy
|
|
|
2
2
|
import { homedir, platform, tmpdir, hostname } from 'os';
|
|
3
3
|
import { join, dirname, resolve, relative, isAbsolute, sep, extname, basename } from 'path';
|
|
4
4
|
import { execFile, execSync, execFileSync, spawn } from 'child_process';
|
|
5
|
-
import { createLogger, dbPath, resolveHomeDir, DEFAULT_MAX_TURNS, PROJECT_DIR_NAME, t, suggestKey, misspelledKeyIssues, openDatabase, migrate, releaseDatabase, parseLenient, issueDetails, splitWords, unknownKeyIssues, checkpointsDir, pluginsDir, projectHooksPath, projectClaudeSettingsPath, projectClaudeLocalSettingsPath, projectSettingsPath, projectLocalSettingsPath, projectPoliciesDir, trustedImportsPath, budgetStatePath, artifactsDir, UNLIMITED_TURNS, turnLimitOf, configPath, managedSettingsPath, getSecretValues, listStoredSecretNames, maskApiKey, setSectionField, isInWorkspace, workspacesPath, samePath, lastSessionsPath, automationLogsDir, projectComplianceDir, projectSkillsDir, attachmentsDir, trustPath, projectCommandsDir, detectBackend, EXEC_PATH_AS_NODE_ENV, isolate, createStreamDecoder, parseShellCommand, writeArtifact, envPath, checkDangerousCommand, checkObfuscation,
|
|
5
|
+
import { createLogger, dbPath, resolveHomeDir, DEFAULT_MAX_TURNS, PROJECT_DIR_NAME, guardSpawn, t, suggestKey, misspelledKeyIssues, openDatabase, migrate, releaseDatabase, parseLenient, issueDetails, splitWords, unknownKeyIssues, checkpointsDir, pluginsDir, projectHooksPath, projectClaudeSettingsPath, projectClaudeLocalSettingsPath, projectSettingsPath, projectLocalSettingsPath, projectPoliciesDir, trustedImportsPath, budgetStatePath, artifactsDir, UNLIMITED_TURNS, turnLimitOf, configPath, managedSettingsPath, getSecretValues, listStoredSecretNames, maskApiKey, setSectionField, countCodePoints, headCodePoints, isInWorkspace, workspacesPath, samePath, lastSessionsPath, automationLogsDir, projectComplianceDir, projectSkillsDir, attachmentsDir, trustPath, projectCommandsDir, detectBackend, EXEC_PATH_AS_NODE_ENV, isolate, createStreamDecoder, parseShellCommand, writeArtifact, envPath, checkDangerousCommand, checkObfuscation, keepHeadAndTail, normalizeForMatch, isReadOnlyCommand, CODE_EXEC_ROOTS, tailCodePoints } from '@epoch-agent/infra';
|
|
6
6
|
export { IS_WINDOWS, WINDOWS_HIDE_FLAGS, buildBwrapArgs, buildProfile, checkDangerousCommand, checkObfuscation, createLogger, detectBackend, getDefaultShell, getPythonCommand, isInWorkspace, isReadOnlyCommand, isolate, maskApiKey, probeBubblewrap, probeSeatbelt, complianceDir as resolveComplianceDir, policiesDir as resolvePoliciesDir, setLogLevel } from '@epoch-agent/infra';
|
|
7
7
|
import { PROVIDER_TYPES, OPERATION_TYPES as OPERATION_TYPES$1, COMPLIANCE_CATEGORIES, COMPLIANCE_ACTIONS, SEARCH_PROVIDER_TYPES, CURRENCIES, LANGS, PERMISSION_LEVELS, SHELL_KINDS, ToolExposure, MAX_OPTIONS, MIN_OPTIONS, MAX_HEADER_CHARS, MAX_QUESTIONS, SCHEDULE_INTERVAL_MINUTES, isPermissionLevel, SCHEDULE_DRAFT_TOOL, isValidAgentRoleName, DEFAULT_AGENT_ROLE, isValidCommandName, RESERVED_COMMAND_NAMES, parseModelRef, isWirePluginArchiveName, systemNote, formatMoney, totalUsageTokens, NOOP_TELEMETRY, METRIC, contentToText, GEN_AI, isPromptOversize, promptTokens, apiKeyEnvVar, PROVIDER_INFOS, isProviderType, API_KEY_ENV_VARS, KEY_ACTIONS, tableOf, perAction, isKeyAction, parseSequence, RESERVED_CHORDS, chordId, sequenceId, ACTION_CONTEXTS, SEQUENCE_CONTEXTS, assertNeverPart, MAX_ATTACH_FILES, MAX_ATTACH_TOTAL_BYTES, MAX_SESSION_REFS, utf8ByteLength, truncateToBudget, attachSessionSurface, isContextNearlyFull, isOperationType, normalizeApproval, imagePartOmittedSummary, MAX_ATTACH_BYTES, SIMULTANEOUS_CONTEXTS, SESSION_REFERENCE_ERROR_CODES, filePartSummary, sessionPartSummary } from '@epoch-agent/protocol';
|
|
8
8
|
export { API_KEY_ENV_VARS, COMPLIANCE_ACTIONS, COMPLIANCE_CATEGORIES, MAX_ATTACH_BYTES, MAX_ATTACH_FILES, MAX_ATTACH_TOTAL_BYTES, MAX_SESSION_ATTACH_BYTES, MAX_SESSION_REFS, OPERATION_TYPES, PERMISSION_LEVELS, PLAN_OUTCOMES, PROVIDER_INFOS, PROVIDER_TYPES, ToolExposure, apiKeyEnvVar, extractAllMentions, extractMentions, extractSessionMentions, getProviderInfo, isOperationType, isPermissionLevel, isPlanOutcome, isProviderType, normalizeApproval } from '@epoch-agent/protocol';
|
|
@@ -476,10 +476,18 @@ var runCommand2;
|
|
|
476
476
|
var init_backend = __esm({
|
|
477
477
|
"src/schedule/os/backend.ts"() {
|
|
478
478
|
runCommand2 = (file, args) => new Promise((resolve16) => {
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
479
|
+
guardSpawn(
|
|
480
|
+
() => execFile(
|
|
481
|
+
file,
|
|
482
|
+
[...args],
|
|
483
|
+
{ encoding: "buffer", windowsHide: true },
|
|
484
|
+
(err, stdout, stderr) => {
|
|
485
|
+
const code = err && typeof err.code === "number" ? err.code ?? 1 : err ? 1 : 0;
|
|
486
|
+
resolve16({ code, stdout: decodeOutput(stdout), stderr: decodeOutput(stderr) });
|
|
487
|
+
}
|
|
488
|
+
),
|
|
489
|
+
(err) => resolve16({ code: 1, stdout: "", stderr: `${file}: ${err.message}` })
|
|
490
|
+
);
|
|
483
491
|
});
|
|
484
492
|
}
|
|
485
493
|
});
|
|
@@ -2430,8 +2438,9 @@ var SCHEDULE_ISSUE_CODES = [
|
|
|
2430
2438
|
];
|
|
2431
2439
|
var SCHEDULE_DEFAULTS = {
|
|
2432
2440
|
maxTurns: DEFAULT_MAX_TURNS,
|
|
2433
|
-
timeoutMs:
|
|
2441
|
+
timeoutMs: 60 * 60 * 1e3
|
|
2434
2442
|
};
|
|
2443
|
+
var SCHEDULE_FORM_BUDGET_USD = 200;
|
|
2435
2444
|
var SCHEDULE_DEFAULT_ALLOWLIST = {
|
|
2436
2445
|
allowTools: [],
|
|
2437
2446
|
allowOperations: ["file_read"],
|
|
@@ -3039,9 +3048,7 @@ function validateSchedule(input) {
|
|
|
3039
3048
|
}
|
|
3040
3049
|
function bypassIssues(input) {
|
|
3041
3050
|
const issues = [];
|
|
3042
|
-
if (
|
|
3043
|
-
issues.push({ code: "bypass-needs-workdir" });
|
|
3044
|
-
} else if (isTooBroad(input.workDir, input.homeDir)) {
|
|
3051
|
+
if (input.workDir.trim() && isTooBroad(input.workDir, input.homeDir)) {
|
|
3045
3052
|
issues.push({ code: "bypass-workdir-too-broad", detail: input.workDir });
|
|
3046
3053
|
}
|
|
3047
3054
|
const missingRuler = !(input.maxBudgetUsd > 0) || !(input.timeoutMs > 0);
|
|
@@ -6363,30 +6370,41 @@ function runCommand(file, args, opts = {}) {
|
|
|
6363
6370
|
const spawnFile = viaCmd ? process.env["ComSpec"] ?? "cmd.exe" : file;
|
|
6364
6371
|
const spawnArgs = viaCmd ? ["/d", "/s", "/c", cmdLine(file, args)] : [...args];
|
|
6365
6372
|
return new Promise((resolvePromise) => {
|
|
6366
|
-
|
|
6367
|
-
|
|
6368
|
-
|
|
6369
|
-
|
|
6370
|
-
|
|
6371
|
-
|
|
6372
|
-
|
|
6373
|
-
|
|
6374
|
-
|
|
6375
|
-
|
|
6376
|
-
|
|
6377
|
-
|
|
6378
|
-
|
|
6379
|
-
|
|
6380
|
-
|
|
6381
|
-
|
|
6373
|
+
guardSpawn(
|
|
6374
|
+
() => execFile(
|
|
6375
|
+
spawnFile,
|
|
6376
|
+
spawnArgs,
|
|
6377
|
+
{
|
|
6378
|
+
timeout: opts.timeoutMs ?? COMMAND_TIMEOUT_MS,
|
|
6379
|
+
maxBuffer: MAX_OUTPUT_BYTES,
|
|
6380
|
+
windowsHide: true,
|
|
6381
|
+
windowsVerbatimArguments: viaCmd,
|
|
6382
|
+
...opts.cwd ? { cwd: opts.cwd } : {}
|
|
6383
|
+
},
|
|
6384
|
+
(err, stdout, stderr) => {
|
|
6385
|
+
const out = String(stdout ?? "");
|
|
6386
|
+
const errOut = String(stderr ?? "");
|
|
6387
|
+
if (!err) {
|
|
6388
|
+
resolvePromise({ ok: true, stdout: out, stderr: errOut });
|
|
6389
|
+
return;
|
|
6390
|
+
}
|
|
6391
|
+
const detail = describe3(file, err, errOut);
|
|
6392
|
+
resolvePromise({
|
|
6393
|
+
ok: false,
|
|
6394
|
+
detail,
|
|
6395
|
+
stdout: out,
|
|
6396
|
+
stderr: errOut,
|
|
6397
|
+
...err.code === "ENOENT" ? { notFound: true } : {}
|
|
6398
|
+
});
|
|
6382
6399
|
}
|
|
6383
|
-
|
|
6400
|
+
),
|
|
6401
|
+
(err) => {
|
|
6384
6402
|
resolvePromise({
|
|
6385
6403
|
ok: false,
|
|
6386
|
-
detail,
|
|
6387
|
-
stdout:
|
|
6388
|
-
stderr:
|
|
6389
|
-
...err.code === "ENOENT" ? { notFound: true } : {}
|
|
6404
|
+
detail: describe3(file, err, ""),
|
|
6405
|
+
stdout: "",
|
|
6406
|
+
stderr: "",
|
|
6407
|
+
...err.code === "ENOENT" || err.code === "ENOTDIR" ? { notFound: true } : {}
|
|
6390
6408
|
});
|
|
6391
6409
|
}
|
|
6392
6410
|
);
|
|
@@ -11471,6 +11489,9 @@ var AgentLoop = class {
|
|
|
11471
11489
|
let blankAfterNudge = false;
|
|
11472
11490
|
for (let turn = 1; turn <= maxTurns; turn++) {
|
|
11473
11491
|
if (this.isAborted(input.signal)) {
|
|
11492
|
+
if (turns.length > 0 || lastText) {
|
|
11493
|
+
yield { type: "notice", code: "aborted", text: t("agent_run.aborted") };
|
|
11494
|
+
}
|
|
11474
11495
|
yield finish("aborted");
|
|
11475
11496
|
await this.prompt.syncMemory(userText, lastText);
|
|
11476
11497
|
return;
|
|
@@ -11902,6 +11923,12 @@ ${finalText}` };
|
|
|
11902
11923
|
});
|
|
11903
11924
|
yield finish("max-turns");
|
|
11904
11925
|
} catch (err) {
|
|
11926
|
+
if (this.isAborted(input.signal)) {
|
|
11927
|
+
await this.prompt.syncMemory(userText, lastText);
|
|
11928
|
+
yield { type: "notice", code: "aborted", text: t("agent_run.aborted") };
|
|
11929
|
+
yield finish("aborted");
|
|
11930
|
+
return;
|
|
11931
|
+
}
|
|
11905
11932
|
const msg = err instanceof Error ? err.message : String(err);
|
|
11906
11933
|
runSpan.recordError(err);
|
|
11907
11934
|
await this.prompt.syncMemory(userText, "");
|
|
@@ -12148,6 +12175,10 @@ var SessionsSchema = z.object({
|
|
|
12148
12175
|
retentionDays: z.int().positive().max(3650).default(90),
|
|
12149
12176
|
vacuumAfterPrune: z.boolean().default(true)
|
|
12150
12177
|
});
|
|
12178
|
+
var AutomationSchema = z.object({
|
|
12179
|
+
keepRuns: z.int().positive().max(1e4).default(200),
|
|
12180
|
+
maxRecordingMb: z.int().positive().max(1e5).default(64)
|
|
12181
|
+
});
|
|
12151
12182
|
var TelemetrySchema = z.object({
|
|
12152
12183
|
enabled: z.boolean().optional(),
|
|
12153
12184
|
target: z.enum(["file", "console", "otlp"]).optional(),
|
|
@@ -12186,6 +12217,7 @@ var EpochConfigSchema = z.object({
|
|
|
12186
12217
|
memory: MemorySchema.prefault({}),
|
|
12187
12218
|
artifacts: ArtifactsSchema.prefault({}),
|
|
12188
12219
|
sessions: SessionsSchema.prefault({}),
|
|
12220
|
+
automation: AutomationSchema.prefault({}),
|
|
12189
12221
|
budget: BudgetSchema.optional(),
|
|
12190
12222
|
compliance: ComplianceSchema.optional(),
|
|
12191
12223
|
headless: HeadlessSchema.optional(),
|
|
@@ -14246,6 +14278,8 @@ var SETTING_WRITE_KEYS = [
|
|
|
14246
14278
|
"sessions.autoPrune",
|
|
14247
14279
|
"sessions.retentionDays",
|
|
14248
14280
|
"sessions.vacuumAfterPrune",
|
|
14281
|
+
"automation.keepRuns",
|
|
14282
|
+
"automation.maxRecordingMb",
|
|
14249
14283
|
"permission"
|
|
14250
14284
|
];
|
|
14251
14285
|
function isWritableSettingKey(value) {
|
|
@@ -14313,6 +14347,8 @@ var VALUE_SCHEMA = {
|
|
|
14313
14347
|
"sessions.autoPrune": EpochConfigSchema.shape.sessions.unwrap().shape.autoPrune.unwrap(),
|
|
14314
14348
|
"sessions.retentionDays": EpochConfigSchema.shape.sessions.unwrap().shape.retentionDays.unwrap(),
|
|
14315
14349
|
"sessions.vacuumAfterPrune": EpochConfigSchema.shape.sessions.unwrap().shape.vacuumAfterPrune.unwrap(),
|
|
14350
|
+
"automation.keepRuns": EpochConfigSchema.shape.automation.unwrap().shape.keepRuns.unwrap(),
|
|
14351
|
+
"automation.maxRecordingMb": EpochConfigSchema.shape.automation.unwrap().shape.maxRecordingMb.unwrap(),
|
|
14316
14352
|
permission: EpochConfigSchema.shape.permission.unwrap()
|
|
14317
14353
|
};
|
|
14318
14354
|
function settingValueKind(key) {
|
|
@@ -15245,8 +15281,8 @@ var MemoryManager = class {
|
|
|
15245
15281
|
return "";
|
|
15246
15282
|
}
|
|
15247
15283
|
}
|
|
15248
|
-
if (content
|
|
15249
|
-
return content
|
|
15284
|
+
if (countCodePoints(content) > MAX_ENTRY_CHARS) {
|
|
15285
|
+
return headCodePoints(content, MAX_ENTRY_CHARS) + " \u2026[\u6761\u76EE\u8FC7\u957F\u5DF2\u622A\u65AD]";
|
|
15250
15286
|
}
|
|
15251
15287
|
return content;
|
|
15252
15288
|
}
|
|
@@ -15256,7 +15292,7 @@ var MemoryManager = class {
|
|
|
15256
15292
|
const id = this.idByContent.get(contentKey(target, content));
|
|
15257
15293
|
if (!id) continue;
|
|
15258
15294
|
const firstLine4 = (content.split("\n")[0] ?? "").trim();
|
|
15259
|
-
const summary = firstLine4
|
|
15295
|
+
const summary = countCodePoints(firstLine4) > INDEX_SUMMARY_CHARS ? `${headCodePoints(firstLine4, INDEX_SUMMARY_CHARS)}\u2026` : firstLine4;
|
|
15260
15296
|
out.push({ id, target, summary, charLength: content.length });
|
|
15261
15297
|
}
|
|
15262
15298
|
return out;
|
|
@@ -16204,6 +16240,9 @@ var SessionDB = class {
|
|
|
16204
16240
|
if (!row) return null;
|
|
16205
16241
|
return this.rowToMeta(row);
|
|
16206
16242
|
}
|
|
16243
|
+
hasSession(id) {
|
|
16244
|
+
return this.db.prepare("SELECT 1 FROM sessions WHERE id = ? LIMIT 1").get(id) !== void 0;
|
|
16245
|
+
}
|
|
16207
16246
|
listSessions(input) {
|
|
16208
16247
|
const limit = input.limit ?? 20;
|
|
16209
16248
|
const key = input.sortKey ?? "startedAt";
|
|
@@ -16444,7 +16483,7 @@ var SessionDB = class {
|
|
|
16444
16483
|
return { results };
|
|
16445
16484
|
}
|
|
16446
16485
|
pruneCandidates(input) {
|
|
16447
|
-
const clauses = ["ended_at IS NOT NULL", "updated_at < @cutoff"];
|
|
16486
|
+
const clauses = ["ended_at IS NOT NULL", "updated_at < @cutoff", "ended_at < @cutoff"];
|
|
16448
16487
|
const params = { cutoff: input.olderThanMs };
|
|
16449
16488
|
if (typeof input.archived === "boolean") {
|
|
16450
16489
|
clauses.push("archived = @archived");
|
|
@@ -16454,6 +16493,15 @@ var SessionDB = class {
|
|
|
16454
16493
|
const rows = this.db.prepare(`SELECT * FROM sessions WHERE ${clauses.join(" AND ")} ORDER BY updated_at ASC`).all(params);
|
|
16455
16494
|
return rows.map((r) => this.rowToMeta(r));
|
|
16456
16495
|
}
|
|
16496
|
+
sweepOrphanedSessions(input) {
|
|
16497
|
+
const info = this.db.prepare(
|
|
16498
|
+
"UPDATE sessions SET ended_at = @now, end_reason = 'orphan_sweep' WHERE ended_at IS NULL AND updated_at < @cutoff"
|
|
16499
|
+
).run({ now: input.now, cutoff: input.olderThanMs });
|
|
16500
|
+
return info.changes;
|
|
16501
|
+
}
|
|
16502
|
+
reopenSession(id) {
|
|
16503
|
+
this.db.prepare("UPDATE sessions SET ended_at = NULL, end_reason = NULL WHERE id = ?").run(id);
|
|
16504
|
+
}
|
|
16457
16505
|
openPruneMatches(input) {
|
|
16458
16506
|
const clauses = ["ended_at IS NULL", "updated_at < @cutoff"];
|
|
16459
16507
|
if (!input.includePinned) clauses.push("COALESCE(pinned, 0) = 0");
|
|
@@ -16872,6 +16920,7 @@ var SessionReferences = class {
|
|
|
16872
16920
|
var AUTO_VACUUM_MIN_FREELIST_RATIO = 0.25;
|
|
16873
16921
|
var SessionManager = class {
|
|
16874
16922
|
db;
|
|
16923
|
+
touched = /* @__PURE__ */ new Set();
|
|
16875
16924
|
queries;
|
|
16876
16925
|
goals;
|
|
16877
16926
|
references;
|
|
@@ -16930,6 +16979,7 @@ var SessionManager = class {
|
|
|
16930
16979
|
endReason: void 0
|
|
16931
16980
|
};
|
|
16932
16981
|
this.db.insertSession(meta);
|
|
16982
|
+
this.touched.add(id);
|
|
16933
16983
|
if (input?.systemPrompt) {
|
|
16934
16984
|
this.appendMessage(id, { role: "system", content: input.systemPrompt });
|
|
16935
16985
|
}
|
|
@@ -16942,6 +16992,9 @@ var SessionManager = class {
|
|
|
16942
16992
|
const messages = this.db.getMessages(id);
|
|
16943
16993
|
return this.buildSession(id, messages);
|
|
16944
16994
|
}
|
|
16995
|
+
has(id) {
|
|
16996
|
+
return this.db.hasSession(id);
|
|
16997
|
+
}
|
|
16945
16998
|
getLatest() {
|
|
16946
16999
|
const result = this.db.listSessions({ limit: 1, sortKey: "updatedAt", direction: "desc" });
|
|
16947
17000
|
if (result.sessions.length === 0) return void 0;
|
|
@@ -16970,11 +17023,17 @@ var SessionManager = class {
|
|
|
16970
17023
|
openPruneMatches(input) {
|
|
16971
17024
|
return this.db.openPruneMatches(input);
|
|
16972
17025
|
}
|
|
17026
|
+
sweepOrphans(input) {
|
|
17027
|
+
return this.db.sweepOrphanedSessions(input);
|
|
17028
|
+
}
|
|
17029
|
+
reopen(id) {
|
|
17030
|
+
this.db.reopenSession(id);
|
|
17031
|
+
}
|
|
16973
17032
|
freelistRatio() {
|
|
16974
17033
|
return this.db.freelistRatio();
|
|
16975
17034
|
}
|
|
16976
17035
|
maybeAutoPrune(opts) {
|
|
16977
|
-
const result = { skipped: false, pruned: 0, vacuumed: false };
|
|
17036
|
+
const result = { skipped: false, swept: 0, pruned: 0, vacuumed: false };
|
|
16978
17037
|
if (!opts.enabled) return { ...result, skipped: true };
|
|
16979
17038
|
const now = opts.now?.() ?? Date.now();
|
|
16980
17039
|
const minInterval = opts.minIntervalMs ?? 24 * 60 * 60 * 1e3;
|
|
@@ -16984,6 +17043,7 @@ var SessionManager = class {
|
|
|
16984
17043
|
return { ...result, skipped: true };
|
|
16985
17044
|
}
|
|
16986
17045
|
const cutoff = now - opts.retentionDays * 24 * 60 * 60 * 1e3;
|
|
17046
|
+
const swept = this.db.sweepOrphanedSessions({ olderThanMs: cutoff, now });
|
|
16987
17047
|
const victims = this.db.pruneCandidates({ olderThanMs: cutoff });
|
|
16988
17048
|
let pruned = 0;
|
|
16989
17049
|
for (const s of victims) if (this.db.deleteSession(s.id)) pruned++;
|
|
@@ -16997,7 +17057,7 @@ var SessionManager = class {
|
|
|
16997
17057
|
if (vacuumed) this.db.setMeta("last_vacuum", String(now));
|
|
16998
17058
|
}
|
|
16999
17059
|
}
|
|
17000
|
-
return { skipped: false, pruned, vacuumed };
|
|
17060
|
+
return { skipped: false, swept, pruned, vacuumed };
|
|
17001
17061
|
} catch (cause) {
|
|
17002
17062
|
return { ...result, error: cause instanceof Error ? cause.message : String(cause) };
|
|
17003
17063
|
}
|
|
@@ -17008,7 +17068,19 @@ var SessionManager = class {
|
|
|
17008
17068
|
endSession(id, reason9 = "user_stop") {
|
|
17009
17069
|
this.db.updateSessionMeta(id, { endedAt: /* @__PURE__ */ new Date(), endReason: reason9 });
|
|
17010
17070
|
}
|
|
17071
|
+
endTouchedSessions(reason9 = "process_exit") {
|
|
17072
|
+
let ended = 0;
|
|
17073
|
+
for (const id of this.touched) {
|
|
17074
|
+
try {
|
|
17075
|
+
this.endSession(id, reason9);
|
|
17076
|
+
ended++;
|
|
17077
|
+
} catch {
|
|
17078
|
+
}
|
|
17079
|
+
}
|
|
17080
|
+
return ended;
|
|
17081
|
+
}
|
|
17011
17082
|
appendMessage(sessionId, msg) {
|
|
17083
|
+
this.touched.add(sessionId);
|
|
17012
17084
|
const id = this.db.nextMessageId();
|
|
17013
17085
|
this.db.insertMessage({ ...msg, sessionId, id, timestamp: Date.now() });
|
|
17014
17086
|
const meta = this.db.getSessionMeta(sessionId);
|
|
@@ -17026,6 +17098,7 @@ var SessionManager = class {
|
|
|
17026
17098
|
this.db.setOpenTurn(sessionId, from);
|
|
17027
17099
|
}
|
|
17028
17100
|
recordUsage(sessionId, usage) {
|
|
17101
|
+
this.touched.add(sessionId);
|
|
17029
17102
|
this.db.recordUsage(sessionId, usage);
|
|
17030
17103
|
}
|
|
17031
17104
|
markObserved(sessionId, messageId) {
|
|
@@ -18456,6 +18529,14 @@ var MIGRATIONS3 = [
|
|
|
18456
18529
|
);
|
|
18457
18530
|
`);
|
|
18458
18531
|
}
|
|
18532
|
+
},
|
|
18533
|
+
{
|
|
18534
|
+
id: "schedule-show-in-session-list",
|
|
18535
|
+
version: 2,
|
|
18536
|
+
description: "\u4EFB\u52A1\u591A\u4E00\u683C\uFF1A\u8DD1\u5B8C\u7684\u4F1A\u8BDD\u76F4\u63A5\u8FDB\u4F1A\u8BDD\u5217\u8868\u5417\uFF08\u7F3A\u7701\u4E0D\u8FDB\uFF09",
|
|
18537
|
+
up: (db) => {
|
|
18538
|
+
db.exec(`ALTER TABLE schedules ADD COLUMN show_in_session_list INTEGER NOT NULL DEFAULT 0;`);
|
|
18539
|
+
}
|
|
18459
18540
|
}
|
|
18460
18541
|
];
|
|
18461
18542
|
var ScheduleStore = class {
|
|
@@ -18480,6 +18561,7 @@ var ScheduleStore = class {
|
|
|
18480
18561
|
prompt: input.prompt,
|
|
18481
18562
|
workDir: input.workDir,
|
|
18482
18563
|
...input.model !== void 0 ? { model: input.model } : {},
|
|
18564
|
+
...input.role !== void 0 ? { role: input.role } : {},
|
|
18483
18565
|
permission: input.permission,
|
|
18484
18566
|
allowTools: input.allowTools ?? [],
|
|
18485
18567
|
allowOperations: input.allowOperations ?? [],
|
|
@@ -18487,6 +18569,7 @@ var ScheduleStore = class {
|
|
|
18487
18569
|
maxTurns: input.maxTurns ?? SCHEDULE_DEFAULTS.maxTurns,
|
|
18488
18570
|
maxBudgetUsd: input.maxBudgetUsd,
|
|
18489
18571
|
timeoutMs: input.timeoutMs ?? SCHEDULE_DEFAULTS.timeoutMs,
|
|
18572
|
+
...input.showInSessionList === true ? { showInSessionList: true } : {},
|
|
18490
18573
|
trigger: input.trigger,
|
|
18491
18574
|
...input.startDate !== void 0 ? { startDate: input.startDate } : {},
|
|
18492
18575
|
...input.endDate !== void 0 ? { endDate: input.endDate } : {},
|
|
@@ -18498,13 +18581,15 @@ var ScheduleStore = class {
|
|
|
18498
18581
|
`INSERT INTO schedules (
|
|
18499
18582
|
id, name, enabled, created_at, updated_at, prompt, work_dir, model, role,
|
|
18500
18583
|
skills, mcp_servers, permission, allow_tools, allow_operations, allow_rules,
|
|
18501
|
-
max_turns, max_budget_usd, timeout_ms,
|
|
18584
|
+
max_turns, max_budget_usd, timeout_ms, show_in_session_list,
|
|
18585
|
+
trigger_kind, trigger_spec,
|
|
18502
18586
|
start_date, end_date, os_backend, os_task_id, os_registered_at, os_command,
|
|
18503
18587
|
last_run_at, last_status
|
|
18504
18588
|
) VALUES (
|
|
18505
18589
|
@id, @name, @enabled, @created_at, @updated_at, @prompt, @work_dir, @model, @role,
|
|
18506
18590
|
@skills, @mcp_servers, @permission, @allow_tools, @allow_operations, @allow_rules,
|
|
18507
|
-
@max_turns, @max_budget_usd, @timeout_ms, @
|
|
18591
|
+
@max_turns, @max_budget_usd, @timeout_ms, @show_in_session_list,
|
|
18592
|
+
@trigger_kind, @trigger_spec,
|
|
18508
18593
|
@start_date, @end_date, @os_backend, @os_task_id, @os_registered_at, @os_command,
|
|
18509
18594
|
@last_run_at, @last_status
|
|
18510
18595
|
)`
|
|
@@ -18590,6 +18675,16 @@ var ScheduleStore = class {
|
|
|
18590
18675
|
const rows = this.db.prepare("SELECT * FROM schedule_runs WHERE schedule_id = ? ORDER BY started_at DESC LIMIT ?").all(scheduleId, limit);
|
|
18591
18676
|
return rows.map(runFromRow);
|
|
18592
18677
|
}
|
|
18678
|
+
recordedSessions(scheduleId, limit = 2) {
|
|
18679
|
+
if (limit <= 0) return [];
|
|
18680
|
+
const rows = this.db.prepare(
|
|
18681
|
+
`SELECT session_id FROM schedule_runs
|
|
18682
|
+
WHERE schedule_id = ? AND session_id IS NOT NULL
|
|
18683
|
+
ORDER BY started_at DESC
|
|
18684
|
+
LIMIT ?`
|
|
18685
|
+
).all(scheduleId, limit);
|
|
18686
|
+
return rows.map((r) => r.session_id);
|
|
18687
|
+
}
|
|
18593
18688
|
listRecentRuns(limit = 50) {
|
|
18594
18689
|
const rows = this.db.prepare("SELECT * FROM schedule_runs ORDER BY started_at DESC LIMIT ?").all(limit);
|
|
18595
18690
|
return rows.map(runFromRow);
|
|
@@ -18611,6 +18706,7 @@ var ScheduleStore = class {
|
|
|
18611
18706
|
mcp_servers = @mcp_servers, permission = @permission, allow_tools = @allow_tools,
|
|
18612
18707
|
allow_operations = @allow_operations, allow_rules = @allow_rules,
|
|
18613
18708
|
max_turns = @max_turns, max_budget_usd = @max_budget_usd, timeout_ms = @timeout_ms,
|
|
18709
|
+
show_in_session_list = @show_in_session_list,
|
|
18614
18710
|
trigger_kind = @trigger_kind, trigger_spec = @trigger_spec,
|
|
18615
18711
|
start_date = @start_date, end_date = @end_date, os_backend = @os_backend,
|
|
18616
18712
|
os_task_id = @os_task_id, os_registered_at = @os_registered_at,
|
|
@@ -18633,6 +18729,7 @@ function mergeSchedulePatch(current, patch) {
|
|
|
18633
18729
|
"maxTurns",
|
|
18634
18730
|
"maxBudgetUsd",
|
|
18635
18731
|
"timeoutMs",
|
|
18732
|
+
"showInSessionList",
|
|
18636
18733
|
"trigger",
|
|
18637
18734
|
"enabled"
|
|
18638
18735
|
])
|
|
@@ -18643,9 +18740,10 @@ function mergeSchedulePatch(current, patch) {
|
|
|
18643
18740
|
if (value === null) delete next[key];
|
|
18644
18741
|
else next[key] = value;
|
|
18645
18742
|
}
|
|
18743
|
+
if (next.showInSessionList !== true) delete next.showInSessionList;
|
|
18646
18744
|
return next;
|
|
18647
18745
|
}
|
|
18648
|
-
var CLEARABLE = ["model", "startDate", "endDate"];
|
|
18746
|
+
var CLEARABLE = ["model", "role", "startDate", "endDate"];
|
|
18649
18747
|
function toRow(def) {
|
|
18650
18748
|
return {
|
|
18651
18749
|
id: def.id,
|
|
@@ -18666,6 +18764,7 @@ function toRow(def) {
|
|
|
18666
18764
|
max_turns: def.maxTurns,
|
|
18667
18765
|
max_budget_usd: def.maxBudgetUsd,
|
|
18668
18766
|
timeout_ms: def.timeoutMs,
|
|
18767
|
+
show_in_session_list: def.showInSessionList === true ? 1 : 0,
|
|
18669
18768
|
trigger_kind: def.trigger.kind,
|
|
18670
18769
|
trigger_spec: JSON.stringify(def.trigger),
|
|
18671
18770
|
start_date: def.startDate ?? null,
|
|
@@ -18698,6 +18797,7 @@ function fromRow(row) {
|
|
|
18698
18797
|
maxTurns: row.max_turns,
|
|
18699
18798
|
maxBudgetUsd: row.max_budget_usd,
|
|
18700
18799
|
timeoutMs: row.timeout_ms,
|
|
18800
|
+
...row.show_in_session_list !== 0 ? { showInSessionList: true } : {},
|
|
18701
18801
|
trigger: JSON.parse(row.trigger_spec),
|
|
18702
18802
|
...row.start_date !== null ? { startDate: row.start_date } : {},
|
|
18703
18803
|
...row.end_date !== null ? { endDate: row.end_date } : {},
|
|
@@ -20210,15 +20310,30 @@ function runCommandHook(config, event, workDir) {
|
|
|
20210
20310
|
const injectedEnv = injectEpochEnv(event, config.pluginRoot);
|
|
20211
20311
|
const hookEnv = { ...baseEnv, ...injectedEnv, ...config.env };
|
|
20212
20312
|
return new Promise((resolve16) => {
|
|
20213
|
-
const child = spawn(config.command, {
|
|
20214
|
-
shell: true,
|
|
20215
|
-
cwd: workDir,
|
|
20216
|
-
env: hookEnv,
|
|
20217
|
-
stdio: ["pipe", "pipe", "pipe"]
|
|
20218
|
-
});
|
|
20219
20313
|
let stdout = "";
|
|
20220
20314
|
let stderr = "";
|
|
20221
20315
|
let settled = false;
|
|
20316
|
+
const failToStart = (err) => {
|
|
20317
|
+
if (settled) return;
|
|
20318
|
+
settled = true;
|
|
20319
|
+
resolve16({
|
|
20320
|
+
exitCode: -1,
|
|
20321
|
+
stdout,
|
|
20322
|
+
stderr,
|
|
20323
|
+
blocked: false,
|
|
20324
|
+
rejectReason: t("hook_load.spawn_failed", { message: err.message })
|
|
20325
|
+
});
|
|
20326
|
+
};
|
|
20327
|
+
const child = guardSpawn(
|
|
20328
|
+
() => spawn(config.command, {
|
|
20329
|
+
shell: true,
|
|
20330
|
+
cwd: workDir,
|
|
20331
|
+
env: hookEnv,
|
|
20332
|
+
stdio: ["pipe", "pipe", "pipe"]
|
|
20333
|
+
}),
|
|
20334
|
+
failToStart
|
|
20335
|
+
);
|
|
20336
|
+
if (!child) return;
|
|
20222
20337
|
const timer = setTimeout(() => {
|
|
20223
20338
|
if (!settled) {
|
|
20224
20339
|
settled = true;
|
|
@@ -20270,15 +20385,7 @@ function runCommandHook(config, event, workDir) {
|
|
|
20270
20385
|
});
|
|
20271
20386
|
child.on("error", (err) => {
|
|
20272
20387
|
clearTimeout(timer);
|
|
20273
|
-
|
|
20274
|
-
settled = true;
|
|
20275
|
-
resolve16({
|
|
20276
|
-
exitCode: -1,
|
|
20277
|
-
stdout,
|
|
20278
|
-
stderr,
|
|
20279
|
-
blocked: false,
|
|
20280
|
-
rejectReason: t("hook_load.spawn_failed", { message: err.message })
|
|
20281
|
-
});
|
|
20388
|
+
failToStart(err);
|
|
20282
20389
|
});
|
|
20283
20390
|
const input = JSON.stringify({
|
|
20284
20391
|
session_id: event.sessionId,
|
|
@@ -23025,31 +23132,15 @@ var CodeSandbox = class {
|
|
|
23025
23132
|
stdio: ["ignore", "pipe", "pipe"],
|
|
23026
23133
|
...IS_WINDOWS ? { windowsHide: true } : {}
|
|
23027
23134
|
};
|
|
23028
|
-
const child = spawn(command, args, spawnOpts);
|
|
23029
23135
|
return new Promise((resolve16) => {
|
|
23030
23136
|
let stdout = "";
|
|
23031
23137
|
let stderr = "";
|
|
23032
23138
|
let killedForOutput = false;
|
|
23033
|
-
let
|
|
23034
|
-
|
|
23035
|
-
|
|
23036
|
-
|
|
23037
|
-
|
|
23038
|
-
stdout += outDecoder.write(c);
|
|
23039
|
-
if (stdout.length >= MAX_OUTPUT) {
|
|
23040
|
-
killedForOutput = true;
|
|
23041
|
-
stdout = stdout.slice(0, MAX_OUTPUT);
|
|
23042
|
-
child.kill("SIGKILL");
|
|
23043
|
-
}
|
|
23044
|
-
});
|
|
23045
|
-
child.stderr?.on("data", (c) => {
|
|
23046
|
-
if (stderr.length >= MAX_OUTPUT) return;
|
|
23047
|
-
errDecoder ??= createStreamDecoder();
|
|
23048
|
-
stderr += errDecoder.write(c);
|
|
23049
|
-
});
|
|
23050
|
-
const onAbort = () => child.kill("SIGKILL");
|
|
23051
|
-
opts.signal?.addEventListener("abort", onAbort, { once: true });
|
|
23052
|
-
child.on("error", (err) => {
|
|
23139
|
+
let child = null;
|
|
23140
|
+
const onAbort = () => {
|
|
23141
|
+
child?.kill("SIGKILL");
|
|
23142
|
+
};
|
|
23143
|
+
const failToStart = (err) => {
|
|
23053
23144
|
opts.signal?.removeEventListener("abort", onAbort);
|
|
23054
23145
|
if (err.code === "ENOENT") {
|
|
23055
23146
|
resolve16({
|
|
@@ -23064,12 +23155,34 @@ var CodeSandbox = class {
|
|
|
23064
23155
|
resolve16({
|
|
23065
23156
|
success: false,
|
|
23066
23157
|
output: "",
|
|
23067
|
-
error: `[\u9519\u8BEF] ${err.message}`,
|
|
23158
|
+
error: `[\u9519\u8BEF] ${err.message}\uFF08command=${command}\uFF0Ccwd=${spawnOpts.cwd ?? ""}\uFF09`,
|
|
23068
23159
|
errorType: "runtime",
|
|
23069
23160
|
duration: Date.now() - start
|
|
23070
23161
|
});
|
|
23162
|
+
};
|
|
23163
|
+
child = guardSpawn(() => spawn(command, args, spawnOpts), failToStart);
|
|
23164
|
+
if (!child) return;
|
|
23165
|
+
const proc = child;
|
|
23166
|
+
let outDecoder = null;
|
|
23167
|
+
let errDecoder = null;
|
|
23168
|
+
proc.stdout?.on("data", (c) => {
|
|
23169
|
+
if (killedForOutput) return;
|
|
23170
|
+
outDecoder ??= createStreamDecoder();
|
|
23171
|
+
stdout += outDecoder.write(c);
|
|
23172
|
+
if (stdout.length >= MAX_OUTPUT) {
|
|
23173
|
+
killedForOutput = true;
|
|
23174
|
+
stdout = stdout.slice(0, MAX_OUTPUT);
|
|
23175
|
+
proc.kill("SIGKILL");
|
|
23176
|
+
}
|
|
23071
23177
|
});
|
|
23072
|
-
|
|
23178
|
+
proc.stderr?.on("data", (c) => {
|
|
23179
|
+
if (stderr.length >= MAX_OUTPUT) return;
|
|
23180
|
+
errDecoder ??= createStreamDecoder();
|
|
23181
|
+
stderr += errDecoder.write(c);
|
|
23182
|
+
});
|
|
23183
|
+
opts.signal?.addEventListener("abort", onAbort, { once: true });
|
|
23184
|
+
proc.on("error", failToStart);
|
|
23185
|
+
proc.on("close", (code, sig) => {
|
|
23073
23186
|
opts.signal?.removeEventListener("abort", onAbort);
|
|
23074
23187
|
if (!killedForOutput) stdout += outDecoder?.end() ?? "";
|
|
23075
23188
|
if (stderr.length < MAX_OUTPUT) stderr += errDecoder?.end() ?? "";
|
|
@@ -23166,4 +23279,4 @@ function trunc(stdout, stderr) {
|
|
|
23166
23279
|
* `--tree` 的命令帮助里,让用户自己知道 `--tree` 意味着什么。
|
|
23167
23280
|
*/
|
|
23168
23281
|
|
|
23169
|
-
export { AGENT_ROLE_DIAG_MODULE, ARTIFACT_MAX_TOTAL_BYTES, ARTIFACT_RETENTION_DEFAULTS, ATTACHMENT_MAX_TOTAL_BYTES, ATTACHMENT_RETENTION_DEFAULTS, AgentLoop, ApprovalCache, BLOCKED_TOOLS, BudgetGuard, BudgetStore, CHECKPOINT_MAX_TOTAL_BYTES, CLAUDE_EVENT_NAMES, CLAUDE_TOOL_NAMES, CODE_MODE_LIMITS, CODE_MODE_SDK_TAG, CONFIG_KEYS, CURRENT_CONFIG_VERSION, CheckpointManager, CheckpointStore, CodeSandbox, ComplianceEngine, ContextCompressor, DEFAULT_COMPLIANCE_ACTIONS, DEFAULT_COMPLIANCE_SETTINGS, DEFAULT_COMPRESSION_THRESHOLD, DEFAULT_GOAL_MAX_ROUNDS, DEFAULT_MAX_HOLD_CHARS, DelegateManager, EMPTY_RULES, EPOCH_DISK_LEDGER, EpochConfigSchema, FTS_TABLES, FTS_TRIGGERS, GOAL_BLOCK_CODES, GoalService, GoalStore, HEADLESS_AUDIT_CODES, HookManager, INSTRUCTION_BUDGET_CHARS, INSTRUCTION_FILES, ImageLoadError, ImportTrustStore, LAUNCHD_LABEL_PREFIX, LOCK_HEARTBEAT_MS, LOCK_STALE_MS, LastOpenSessions, MARKETPLACE_DISPLAY_FIELDS, MARKETPLACE_FILE, MAX_AUDIT_ENTRIES, MAX_COMMAND_DEPTH, MAX_GOAL_MAX_ROUNDS, MAX_IMPORT_DEPTH, MAX_LAST_OPEN_SESSIONS, MAX_OBJECTIVE_CHARS, MAX_REASON_CHARS, MAX_RECENT_WORKSPACES, MODEL_GIVE_UP_THRESHOLD, MULTIMODAL_DEFAULTS, ManagedPolicyError, ManagedSettingsSchema, MemoryManager, MemoryReviewer, ModelFailureTracker, NOMINAL_TOTAL_BYTES, NO_REVEALED_TOOLS, PACK_EXCLUDES, PACK_MAX_BYTES, PACK_MAX_FILES, PERMISSION_AUDIT_CODES, PLUGIN_LAYOUT, PLUGIN_MANIFEST_FILE, PLUGIN_MANIFEST_KEYS, PLUGIN_NAME_PATTERN, PLUGIN_ROOT_ENV, PLUGIN_ROOT_TOKEN, PLUGIN_VISIBILITY, POLICY_DECISIONS, PROBE_VERSION, PROJECT_AGENTS_SUBDIR, PROVIDER_NO_CREDENTIAL, PermissionManager, PlanModeState, PluginAuthorSchema, PluginStore, PolicyRuleSchema, ProviderError, ProviderRouter, RECORDING_KEEP_RUNS, RECORDING_MAX_BYTES, ROLE_FRONTMATTER_SCHEMA, RUN_CODE_TOOL, RecentWorkspaces, SANDBOX_COVERS, SANDBOX_EXCLUDES, SCALAR_KEYS, SCHEDULE_DEFAULTS, SCHEDULE_DEFAULT_ALLOWLIST, SCHEDULE_ISSUE_CODES, SCHTASKS_FOLDER, SESSION_MESSAGES_READ_TOOL, SESSION_MESSAGES_SEARCH_TOOL, SESSION_QUERY_TOOLS, SESSION_SEARCH_TOOL, SESSION_TRACE_TOOL, SETTINGS_LAYER_ORDER, SETTING_WRITE_KEYS, SETTING_WRITE_LAYERS, SKILL_CREATE_TOOL, SKILL_EDIT_TOOL, SKILL_PATCH_TOOL, SKILL_VIEW_TOOL, SKILL_WRITE_FILE_TOOL, SLASH_COMMANDS_DIAG_MODULE, ScheduleRecorder, ScheduleRegistrar, ScheduleStore, SessionManager, SessionQueries, SessionReferences, SettingsFileError, SettingsFileSchema, SkillLearner, SkillSystem, TOOL_SEARCH_TOOL, TaskNoticeTracker, ToolRegistry, TrackerDB, TrustManager, Workspace, acquireScheduleLock, addMarketplace, addUsage, admitArtifact, admitArtifacts, affectedPaths, artifactLaunchArgv, artifactOpenRefusal, assertLevelAllowed, blockedRoleTools, buildContextBreakdown, buildFireArgv, buildFtsMatchQuery, buildSchemaExports, buildSystemPrompt, buildTrigramMatchQuery, builtinRoles, checkEpochVersion, checkFtsHealth, checkShadowing, classifyProviderError, clearModelCache, coalesceRecording, codeModeWorkerPath, commandNameFromRelPath, compileRuleLists, compressionOptions, computeCost, computeCostMicros, computeExecHash, countRules, createAllowAllGate, createAllowAllImportGate, createAskQuestionTool, createCodeExecTool, createDelegateTool, createDenyAllGate, createDenyAllImportGate, createGoalTool, createImportGate, createMemoryTool, createPlanModeTools, createRoleFile, createRoleScope, createRunCodeTool, createScheduleDraftTool, createSessionMessagesReadTool, createSessionMessagesSearchTool, createSessionSearchTool, createSessionSearchTools, createSessionTraceTool, createSkillViewTool, createSkillWriteTools, createTodoTool, createToolRevealState, createToolScope, createToolSearchTool, createTrustGate, currentEpochVersion, decideImport, decideTrust, defaultConfig, defaultModelOf, describeArtifactRefusal, describeBackgroundTask, describeHeadlessPolicy, describeIsolation, describeJsonError, diagnoseSchedules, discoverMarkdown, discoverModels, discoverProject, displayCurrency, draftCommandLine, draftWidening, escapeRuleContent, estimateImageTokens, estimateRunTokens, estimateTokens, evaluateSelection, expandCommand, expandImports, explainSetting, extractArchive, findInstructionFiles, findProjectInstructions, findRole, formatBytes, formatSkillIndex, formatUsd, gateForTool, getCapability, getConfigIssues, getConfigOrigins, getImportGate, getTrustGate, hasDedicatedExecContent, hasExecTierContent, hasPromptCaching, hasProviderCredentials, hasReadTierContent, imageFromBase64, imageFromPath, imagePartTokens, importSkills, installPlugin, instructionDirs, instructionNotices, intervalSlots, inventoryProjectExtensions, inventoryTotal, isBlockCode, isCodeModeDeferred, isEmptyRules, isGoalPhase, isNonInteractive, isReadOnlySubCall, isSettingWriteLayer, isValidPluginName, isWithinWindow, isWritableSettingKey, labelSlug, layerRank, listRunningSchedules, listSessionCandidates, listWorkspaceFiles, loadCommandDefinitions, loadCommandFile, loadCommands, loadConfig, loadHookSources, loadKeybindings, loadLexiconDir, loadLexiconFiles, loadPlugins, loadPolicyFiles, loadPolicyRules, loadRoleDefinitions, loadRoleDir, loadedImports, localDateString, managedSwitchNotes, mapClaudeToolName, mapEpochToolName, mapOperationType, matchPreauthorization, matchRuleLists, matchesHook, mentionsPluginRoot, mergeHeadlessPolicy, mergeRoles, mergeSchedulePatch, microsToUsd, modelListCandidates, needsAllowlist, nextFallbackModel, nextRunAt, noConfigOrigins, noManagedPolicy, noPlugins, openArtifact, originOf, packFileName, packPlugin, parseClaudeSettingsHooks, parseClock, parseDate, parseFrontmatter, parseHooksConfig, parseHooksConfigVerbose, parseImportLine, parseModelList, parseRoleDefinition, parseScheduleDraft, parseSkillFrontmatter, parseTrigger, pendingImageTokens, persistParts, persistToolResults, persistedUsage, planPack, previewSkillImport, pricingFor, projectEntryForDisplay, pruneArtifacts, pruneAttachments, pruneRecordings, pruneSchedules, readImageSize, readMarketplaces, readPluginManifest, readPluginRecords, readProviderKeyEnv, readRecording, readSessionSurface, reclaimFtsSpace, redactLine, refreshOpenRouterMetadata, removeMarketplace, removeRecordings, removeRoleFile, removeSessionArtifacts, removeSessionAttachments, renderImportTree, renderProjectContext, renderSdkDeclaration, renderSelfIndex, repairSchedules, resolveArtifactRetention, resolveCodeModeWorker, resolveComplianceDirs, resolveEntrySource, resolveInWorkspace, resolveMarketplaceRef, resolveMentions, resolveMultimodalPolicy, resolvePolicyDirs, resolvePricingAt, resolveProjectRoot, resolveScheduleBackend, resolveSessionReference, resolveSessionVisibility, resolveSettings, resolveSkillDirs, resolveSource, resolveTar, resolveWorkspace, restoreParts, revealScopedProvider, roleScopedProvider, roleSourceLabel, ruleCovers, ruleFromString, ruleToString, runCode, runCommand2 as runCommand, sanitizeArgNames, sanitizeCommand, sanitizeFtsQuery, sanitizePath, sanitizeToolOutput, scanInstructions, scanPluginDir, scanSkillDirs, searchMarketplaces, setDisplayCurrency, setImportGate, setPluginEnabled, setTrustGate, settingValueChoices, settingValueKind, settingWriteApply, settingWriteLayers, settingWriteTargets, skillIndexDescription, skillIndexResidency, skillIndexStats, sniffMediaType, splitFrontmatter, staticToolProvider, stripArtifactData, substitutePluginRoot, suggestRuleFromApproval, systemOpenArgv, systemPromptSegments, toPosix, toolDefinitionTokens, toolMatches, toolTableTokens, totalTokens, traceSession, triggerPeriodMs, unescapeRuleContent, uninstallPlugin, unknownRoleSkills, unknownRoleTools, unloadedInstructionFiles, updateMarketplace, updatePlugin, usdToMicros, validateSchedule, validateTrigger, validateWindow, withGoalCompression, withGoalPrompt, workspaceDisplayPath, writeSettingValue };
|
|
23282
|
+
export { AGENT_ROLE_DIAG_MODULE, ARTIFACT_MAX_TOTAL_BYTES, ARTIFACT_RETENTION_DEFAULTS, ATTACHMENT_MAX_TOTAL_BYTES, ATTACHMENT_RETENTION_DEFAULTS, AgentLoop, ApprovalCache, BLOCKED_TOOLS, BudgetGuard, BudgetStore, CHECKPOINT_MAX_TOTAL_BYTES, CLAUDE_EVENT_NAMES, CLAUDE_TOOL_NAMES, CODE_MODE_LIMITS, CODE_MODE_SDK_TAG, CONFIG_KEYS, CURRENT_CONFIG_VERSION, CheckpointManager, CheckpointStore, CodeSandbox, ComplianceEngine, ContextCompressor, DEFAULT_COMPLIANCE_ACTIONS, DEFAULT_COMPLIANCE_SETTINGS, DEFAULT_COMPRESSION_THRESHOLD, DEFAULT_GOAL_MAX_ROUNDS, DEFAULT_MAX_HOLD_CHARS, DelegateManager, EMPTY_RULES, EPOCH_DISK_LEDGER, EpochConfigSchema, FTS_TABLES, FTS_TRIGGERS, GOAL_BLOCK_CODES, GoalService, GoalStore, HEADLESS_AUDIT_CODES, HookManager, INSTRUCTION_BUDGET_CHARS, INSTRUCTION_FILES, ImageLoadError, ImportTrustStore, LAUNCHD_LABEL_PREFIX, LOCK_HEARTBEAT_MS, LOCK_STALE_MS, LastOpenSessions, MARKETPLACE_DISPLAY_FIELDS, MARKETPLACE_FILE, MAX_AUDIT_ENTRIES, MAX_COMMAND_DEPTH, MAX_GOAL_MAX_ROUNDS, MAX_IMPORT_DEPTH, MAX_LAST_OPEN_SESSIONS, MAX_OBJECTIVE_CHARS, MAX_REASON_CHARS, MAX_RECENT_WORKSPACES, MODEL_GIVE_UP_THRESHOLD, MULTIMODAL_DEFAULTS, ManagedPolicyError, ManagedSettingsSchema, MemoryManager, MemoryReviewer, ModelFailureTracker, NOMINAL_TOTAL_BYTES, NO_REVEALED_TOOLS, PACK_EXCLUDES, PACK_MAX_BYTES, PACK_MAX_FILES, PERMISSION_AUDIT_CODES, PLUGIN_LAYOUT, PLUGIN_MANIFEST_FILE, PLUGIN_MANIFEST_KEYS, PLUGIN_NAME_PATTERN, PLUGIN_ROOT_ENV, PLUGIN_ROOT_TOKEN, PLUGIN_VISIBILITY, POLICY_DECISIONS, PROBE_VERSION, PROJECT_AGENTS_SUBDIR, PROVIDER_NO_CREDENTIAL, PermissionManager, PlanModeState, PluginAuthorSchema, PluginStore, PolicyRuleSchema, ProviderError, ProviderRouter, RECORDING_KEEP_RUNS, RECORDING_MAX_BYTES, ROLE_FRONTMATTER_SCHEMA, RUN_CODE_TOOL, RecentWorkspaces, SANDBOX_COVERS, SANDBOX_EXCLUDES, SCALAR_KEYS, SCHEDULE_DEFAULTS, SCHEDULE_DEFAULT_ALLOWLIST, SCHEDULE_FORM_BUDGET_USD, SCHEDULE_ISSUE_CODES, SCHTASKS_FOLDER, SESSION_MESSAGES_READ_TOOL, SESSION_MESSAGES_SEARCH_TOOL, SESSION_QUERY_TOOLS, SESSION_SEARCH_TOOL, SESSION_TRACE_TOOL, SETTINGS_LAYER_ORDER, SETTING_WRITE_KEYS, SETTING_WRITE_LAYERS, SKILL_CREATE_TOOL, SKILL_EDIT_TOOL, SKILL_PATCH_TOOL, SKILL_VIEW_TOOL, SKILL_WRITE_FILE_TOOL, SLASH_COMMANDS_DIAG_MODULE, ScheduleRecorder, ScheduleRegistrar, ScheduleStore, SessionManager, SessionQueries, SessionReferences, SettingsFileError, SettingsFileSchema, SkillLearner, SkillSystem, TOOL_SEARCH_TOOL, TaskNoticeTracker, ToolRegistry, TrackerDB, TrustManager, Workspace, acquireScheduleLock, addMarketplace, addUsage, admitArtifact, admitArtifacts, affectedPaths, artifactLaunchArgv, artifactOpenRefusal, assertLevelAllowed, blockedRoleTools, buildContextBreakdown, buildFireArgv, buildFtsMatchQuery, buildSchemaExports, buildSystemPrompt, buildTrigramMatchQuery, builtinRoles, checkEpochVersion, checkFtsHealth, checkShadowing, classifyProviderError, clearModelCache, coalesceRecording, codeModeWorkerPath, commandNameFromRelPath, compileRuleLists, compressionOptions, computeCost, computeCostMicros, computeExecHash, countRules, createAllowAllGate, createAllowAllImportGate, createAskQuestionTool, createCodeExecTool, createDelegateTool, createDenyAllGate, createDenyAllImportGate, createGoalTool, createImportGate, createMemoryTool, createPlanModeTools, createRoleFile, createRoleScope, createRunCodeTool, createScheduleDraftTool, createSessionMessagesReadTool, createSessionMessagesSearchTool, createSessionSearchTool, createSessionSearchTools, createSessionTraceTool, createSkillViewTool, createSkillWriteTools, createTodoTool, createToolRevealState, createToolScope, createToolSearchTool, createTrustGate, currentEpochVersion, decideImport, decideTrust, defaultConfig, defaultModelOf, describeArtifactRefusal, describeBackgroundTask, describeHeadlessPolicy, describeIsolation, describeJsonError, diagnoseSchedules, discoverMarkdown, discoverModels, discoverProject, displayCurrency, draftCommandLine, draftWidening, escapeRuleContent, estimateImageTokens, estimateRunTokens, estimateTokens, evaluateSelection, expandCommand, expandImports, explainSetting, extractArchive, findInstructionFiles, findProjectInstructions, findRole, formatBytes, formatSkillIndex, formatUsd, gateForTool, getCapability, getConfigIssues, getConfigOrigins, getImportGate, getTrustGate, hasDedicatedExecContent, hasExecTierContent, hasPromptCaching, hasProviderCredentials, hasReadTierContent, imageFromBase64, imageFromPath, imagePartTokens, importSkills, installPlugin, instructionDirs, instructionNotices, intervalSlots, inventoryProjectExtensions, inventoryTotal, isBlockCode, isCodeModeDeferred, isEmptyRules, isGoalPhase, isNonInteractive, isReadOnlySubCall, isSettingWriteLayer, isValidPluginName, isWithinWindow, isWritableSettingKey, labelSlug, layerRank, listRunningSchedules, listSessionCandidates, listWorkspaceFiles, loadCommandDefinitions, loadCommandFile, loadCommands, loadConfig, loadHookSources, loadKeybindings, loadLexiconDir, loadLexiconFiles, loadPlugins, loadPolicyFiles, loadPolicyRules, loadRoleDefinitions, loadRoleDir, loadedImports, localDateString, managedSwitchNotes, mapClaudeToolName, mapEpochToolName, mapOperationType, matchPreauthorization, matchRuleLists, matchesHook, mentionsPluginRoot, mergeHeadlessPolicy, mergeRoles, mergeSchedulePatch, microsToUsd, modelListCandidates, needsAllowlist, nextFallbackModel, nextRunAt, noConfigOrigins, noManagedPolicy, noPlugins, openArtifact, originOf, packFileName, packPlugin, parseClaudeSettingsHooks, parseClock, parseDate, parseFrontmatter, parseHooksConfig, parseHooksConfigVerbose, parseImportLine, parseModelList, parseRoleDefinition, parseScheduleDraft, parseSkillFrontmatter, parseTrigger, pendingImageTokens, persistParts, persistToolResults, persistedUsage, planPack, previewSkillImport, pricingFor, projectEntryForDisplay, pruneArtifacts, pruneAttachments, pruneRecordings, pruneSchedules, readImageSize, readMarketplaces, readPluginManifest, readPluginRecords, readProviderKeyEnv, readRecording, readSessionSurface, reclaimFtsSpace, redactLine, refreshOpenRouterMetadata, removeMarketplace, removeRecordings, removeRoleFile, removeSessionArtifacts, removeSessionAttachments, renderImportTree, renderProjectContext, renderSdkDeclaration, renderSelfIndex, repairSchedules, resolveArtifactRetention, resolveCodeModeWorker, resolveComplianceDirs, resolveEntrySource, resolveInWorkspace, resolveMarketplaceRef, resolveMentions, resolveMultimodalPolicy, resolvePolicyDirs, resolvePricingAt, resolveProjectRoot, resolveScheduleBackend, resolveSessionReference, resolveSessionVisibility, resolveSettings, resolveSkillDirs, resolveSource, resolveTar, resolveWorkspace, restoreParts, revealScopedProvider, roleScopedProvider, roleSourceLabel, ruleCovers, ruleFromString, ruleToString, runCode, runCommand2 as runCommand, sanitizeArgNames, sanitizeCommand, sanitizeFtsQuery, sanitizePath, sanitizeToolOutput, scanInstructions, scanPluginDir, scanSkillDirs, searchMarketplaces, setDisplayCurrency, setImportGate, setPluginEnabled, setTrustGate, settingValueChoices, settingValueKind, settingWriteApply, settingWriteLayers, settingWriteTargets, skillIndexDescription, skillIndexResidency, skillIndexStats, sniffMediaType, splitFrontmatter, staticToolProvider, stripArtifactData, substitutePluginRoot, suggestRuleFromApproval, systemOpenArgv, systemPromptSegments, toPosix, toolDefinitionTokens, toolMatches, toolTableTokens, totalTokens, traceSession, triggerPeriodMs, unescapeRuleContent, uninstallPlugin, unknownRoleSkills, unknownRoleTools, unloadedInstructionFiles, updateMarketplace, updatePlugin, usdToMicros, validateSchedule, validateTrigger, validateWindow, withGoalCompression, withGoalPrompt, workspaceDisplayPath, writeSettingValue };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@epoch-agent/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "epoch-agent 核心引擎:ReAct 循环、Provider 路由、工具调度、记忆管理",
|
|
6
6
|
"repository": {
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
"gpt-tokenizer": "^3.4.0",
|
|
28
28
|
"js-yaml": "^5.2.3",
|
|
29
29
|
"zod": "^4.4.3",
|
|
30
|
-
"@epoch-agent/infra": "0.
|
|
31
|
-
"@epoch-agent/protocol": "0.
|
|
30
|
+
"@epoch-agent/infra": "0.14.0",
|
|
31
|
+
"@epoch-agent/protocol": "0.14.0"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@ai-sdk/amazon-bedrock": "^5.0.40",
|