@epoch-agent/core 0.25.0 → 0.27.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 +263 -2
- package/dist/index.js +406 -54
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -2111,6 +2111,59 @@ interface MemoryManager$1 {
|
|
|
2111
2111
|
flushToDisk(): Promise<void>;
|
|
2112
2112
|
close(): void;
|
|
2113
2113
|
}
|
|
2114
|
+
/**
|
|
2115
|
+
* 从别处(云同步)落一条记忆进来:**带着它原来的 id 和时间戳**({@link MemoryManager.importEntry})。
|
|
2116
|
+
*
|
|
2117
|
+
* 不带位置:位置是这台机器上文件里的顺序,`reloadFromDisk` 会照文件重编,跨机器同步它只会来回改。
|
|
2118
|
+
*/
|
|
2119
|
+
interface MemoryImportRecord {
|
|
2120
|
+
id: string;
|
|
2121
|
+
target: MemoryTarget;
|
|
2122
|
+
content: string;
|
|
2123
|
+
/** epoch 毫秒 */
|
|
2124
|
+
createdAt: number;
|
|
2125
|
+
/** epoch 毫秒 */
|
|
2126
|
+
updatedAt: number;
|
|
2127
|
+
}
|
|
2128
|
+
type MemoryImportResult = {
|
|
2129
|
+
ok: true;
|
|
2130
|
+
action: 'inserted' | 'updated' | 'unchanged';
|
|
2131
|
+
blocked: boolean;
|
|
2132
|
+
}
|
|
2133
|
+
/** 同一个库里已经有一条**内容一模一样**、id 不同的 —— 文件里两条同内容会在下次加载时并成一条 */
|
|
2134
|
+
| {
|
|
2135
|
+
ok: false;
|
|
2136
|
+
reason: 'duplicate-content';
|
|
2137
|
+
existingId: string;
|
|
2138
|
+
}
|
|
2139
|
+
/** `expectUpdatedAt` 对不上:落之前本机这条被改过 */
|
|
2140
|
+
| {
|
|
2141
|
+
ok: false;
|
|
2142
|
+
reason: 'conflict';
|
|
2143
|
+
}
|
|
2144
|
+
/** 内容过不了「写进文件再读回来还是它」(空、超长、中间夹着 `§` 开头的行) */
|
|
2145
|
+
| {
|
|
2146
|
+
ok: false;
|
|
2147
|
+
reason: 'invalid';
|
|
2148
|
+
detail: string;
|
|
2149
|
+
};
|
|
2150
|
+
/** 一条记忆被删了({@link MemoryManagerOptions.onRemoved})。 */
|
|
2151
|
+
interface MemoryRemoval {
|
|
2152
|
+
id: string;
|
|
2153
|
+
target: MemoryTarget;
|
|
2154
|
+
/** `remove` = 工具 / 用户删的;`file-edit` = 有人手改 MEMORY.md / USER.md 把它去掉了 */
|
|
2155
|
+
cause: 'remove' | 'file-edit';
|
|
2156
|
+
}
|
|
2157
|
+
interface MemoryManagerOptions {
|
|
2158
|
+
/**
|
|
2159
|
+
* 删掉一条记忆之后。宿主(云同步)靠它知道「这条是被删的,不是还没同步过来」。
|
|
2160
|
+
*
|
|
2161
|
+
* ⚠️ **文件整个不见了**(被删、读不到)导致的清空**不报**:那多半是事故不是用户的意思,
|
|
2162
|
+
* 报出去就是让每一台机器都跟着把这个库清空。
|
|
2163
|
+
* ⚠️ 回调里抛什么都吞掉(删除已经发生了),契约同 runtime 的 `onSessionDeleted`。
|
|
2164
|
+
*/
|
|
2165
|
+
onRemoved?: (removal: MemoryRemoval) => void;
|
|
2166
|
+
}
|
|
2114
2167
|
|
|
2115
2168
|
/**
|
|
2116
2169
|
* Provider 层的 SPI 类型 —— 「一次模型请求进什么、出什么」。
|
|
@@ -7747,6 +7800,71 @@ declare function inventoryTotal(inv: PluginInventory): number;
|
|
|
7747
7800
|
*/
|
|
7748
7801
|
declare function scanPluginDir(dir: string, pluginName: string): PluginInventory;
|
|
7749
7802
|
|
|
7803
|
+
/**
|
|
7804
|
+
* 「这个插件是干什么的」—— 安装前那一屏上**给人读的那一半**(2026-10-09)。
|
|
7805
|
+
*
|
|
7806
|
+
* [inventory.ts](./inventory.ts) 答的是「装下去这台机器上会多出什么」,只数数、
|
|
7807
|
+
* 不读正文;这里答的是另一个问题:**这些东西各自是干什么用的**。材料全是作者
|
|
7808
|
+
* 已经写在包里的散文:
|
|
7809
|
+
*
|
|
7810
|
+
* - 根下的 `README.md`(docs/PLUGINS.md「模型怎么回答『这个插件能干嘛』」那一节
|
|
7811
|
+
* 本来就请作者写它 —— 模型读得到,而装之前的人一直读不到);
|
|
7812
|
+
* - 每条命令 / 身份 / 技能 frontmatter 里的那句 `description`。
|
|
7813
|
+
*
|
|
7814
|
+
* ## 为什么不并进 `scanPluginDir`
|
|
7815
|
+
*
|
|
7816
|
+
* 那份盘点有一条承重的不变式:总数必须等于 `LoadedPlugin.counts` 六格之和
|
|
7817
|
+
* (`inventoryTotal` 上那段),而它刻意「这一层不读 frontmatter」。
|
|
7818
|
+
* 说明文字和那个数毫无关系,塞进去只会让那份盘点多一种失败形态
|
|
7819
|
+
* (一句写坏的 YAML 让盘点多一条 issue)。所以这里**各读各的、失败一律静默**:
|
|
7820
|
+
* 一条读不出说明的命令仍然是一条命令,盘点那边照样列它的名字。
|
|
7821
|
+
*
|
|
7822
|
+
* ## 名字的口径**逐字同** inventory
|
|
7823
|
+
*
|
|
7824
|
+
* 三类的键都是**已加前缀**的那个名字,推导方式和 `scanCommands` / `scanRoles` /
|
|
7825
|
+
* `scanSkills` 一模一样 —— 界面拿盘点里的名字来这儿查说明,两边推导方式一分叉,
|
|
7826
|
+
* 查不到的那几条就只剩光秃秃一个名字,而且没有任何一处会报错。
|
|
7827
|
+
* 由 `plugin-about.test.ts` 里那条「每个名字都在盘点里」钉着。
|
|
7828
|
+
*
|
|
7829
|
+
* ## 不进预览摘要(token)
|
|
7830
|
+
*
|
|
7831
|
+
* 判据同 runtime `plugin-install.ts` 文件头那条「不哈希文件内容」:token 防的是
|
|
7832
|
+
* 「界面显示的和真装的是两份**扩展物**」,而一句说明改了,装下去的东西一样都没变。
|
|
7833
|
+
*/
|
|
7834
|
+
/**
|
|
7835
|
+
* README 读进来的上限(字符)。
|
|
7836
|
+
*
|
|
7837
|
+
* 32k 字符够一份写得很长的 README(`feishu-kit` 那份约 3k)。卡它是因为这一份会
|
|
7838
|
+
* 原样走网线、在浏览器里过一遍 markdown 管线 —— 一个把 changelog 全塞进 README
|
|
7839
|
+
* 的包不该让那一屏卡住。超了就截断并如实说(`truncated`),不静默。
|
|
7840
|
+
*/
|
|
7841
|
+
declare const ABOUT_README_MAX_CHARS = 32000;
|
|
7842
|
+
/**
|
|
7843
|
+
* 一句说明的上限(字符)。frontmatter 里那句是给模型挑工具用的,有人写成三行;
|
|
7844
|
+
* 那一屏上它是一行列表的说明格,过长就截,带省略号。
|
|
7845
|
+
*/
|
|
7846
|
+
declare const ABOUT_DESC_MAX_CHARS = 280;
|
|
7847
|
+
/** 一个扩展物和它那句说明 */
|
|
7848
|
+
interface PluginDoc {
|
|
7849
|
+
/** 已加前缀的名字,口径同 {@link PluginInventory} 那几格 */
|
|
7850
|
+
name: string;
|
|
7851
|
+
/** 压成一行、去首尾空白、超长截断过的说明。**空串的不收** */
|
|
7852
|
+
description: string;
|
|
7853
|
+
}
|
|
7854
|
+
interface PluginAbout {
|
|
7855
|
+
/** 根下的 README(大小写不敏感)。没有 / 读不出 / 是空的 → 缺席 */
|
|
7856
|
+
readme?: {
|
|
7857
|
+
text: string;
|
|
7858
|
+
truncated: boolean;
|
|
7859
|
+
};
|
|
7860
|
+
/** 只收**写了说明**的那几条,按名字排序 */
|
|
7861
|
+
commands: PluginDoc[];
|
|
7862
|
+
roles: PluginDoc[];
|
|
7863
|
+
skills: PluginDoc[];
|
|
7864
|
+
}
|
|
7865
|
+
/** 读一个插件目录里给人看的那几段散文。**任何一格读不出都只是缺席,不抛、不报** */
|
|
7866
|
+
declare function readPluginAbout(dir: string, pluginName: string): PluginAbout;
|
|
7867
|
+
|
|
7750
7868
|
/**
|
|
7751
7869
|
* 插件安装记录 —— `~/.epoch/plugins.json` 的读写(方案 32)。
|
|
7752
7870
|
*
|
|
@@ -8072,6 +8190,14 @@ interface InstallPreview {
|
|
|
8072
8190
|
manifest: PluginManifest;
|
|
8073
8191
|
source: ResolvedSource;
|
|
8074
8192
|
inventory: PluginInventory;
|
|
8193
|
+
/**
|
|
8194
|
+
* 给人读的那一半:README + 每条扩展物的那句说明(2026-10-09,判据在 about.ts 文件头)。
|
|
8195
|
+
*
|
|
8196
|
+
* ⚠️ **可选,而且只有根有** —— 依赖那几段只列名字(`InstallDependency` 上没有这一格):
|
|
8197
|
+
* 那一屏要回答的是「我装的这个插件是干什么的」,依赖是它的实现细节。
|
|
8198
|
+
* 缺席 = 构造这份预览的那条路没读(老的调用方、用例里手写的预览),界面照旧只画名字。
|
|
8199
|
+
*/
|
|
8200
|
+
about?: PluginAbout;
|
|
8075
8201
|
/**
|
|
8076
8202
|
* 已经装过的同名插件;有值时这次安装会被拒(验收 #8)。
|
|
8077
8203
|
*
|
|
@@ -12811,6 +12937,7 @@ declare function loadKeybindings({ path, defaults }: LoadKeybindingsOptions): Lo
|
|
|
12811
12937
|
*/
|
|
12812
12938
|
|
|
12813
12939
|
declare class MemoryManager {
|
|
12940
|
+
private readonly options;
|
|
12814
12941
|
private db;
|
|
12815
12942
|
private config;
|
|
12816
12943
|
private memDir;
|
|
@@ -12912,7 +13039,7 @@ declare class MemoryManager {
|
|
|
12912
13039
|
* 压根不存在,于是 `MemoryConfig` 这个类型有、却没有任何人给得出非默认值 ——
|
|
12913
13040
|
* 用户抱怨的「设置里改不了」就是这一格。
|
|
12914
13041
|
*/
|
|
12915
|
-
constructor(dbPath?: string, memDir?: string, config?: Partial<MemoryConfig
|
|
13042
|
+
constructor(dbPath?: string, memDir?: string, config?: Partial<MemoryConfig>, options?: MemoryManagerOptions);
|
|
12916
13043
|
initialize(_sessionId: string): Promise<string>;
|
|
12917
13044
|
prefetch(userQuery: string): Promise<string>;
|
|
12918
13045
|
sync(_userMessage: string, _assistantResponse: string): Promise<void>;
|
|
@@ -13054,6 +13181,40 @@ declare class MemoryManager {
|
|
|
13054
13181
|
* 在调用方那里长得一模一样,模型会以为腾出了地方然后继续撞墙。
|
|
13055
13182
|
*/
|
|
13056
13183
|
remove(target: MemoryTarget, oldText: string): Promise<boolean>;
|
|
13184
|
+
/**
|
|
13185
|
+
* 从别处落一条记忆进来,**带着它原来的 id 和时间戳**(云同步,2026-10-09)。
|
|
13186
|
+
*
|
|
13187
|
+
* ## 为什么要它
|
|
13188
|
+
*
|
|
13189
|
+
* {@link add} 每次都发一个新 UUID、时间戳取现在。云同步拿它落别的电脑的记忆的话,
|
|
13190
|
+
* 这台上那条就成了一条新 id 的记录,下一轮又被当成新记忆推上去 —— 两台电脑来回复制。
|
|
13191
|
+
*
|
|
13192
|
+
* ## 规矩
|
|
13193
|
+
*
|
|
13194
|
+
* - 内容先过「写进文件再读回来还是它」({@link fileSafe}):过不了就 `invalid`,不替调用方改 ——
|
|
13195
|
+
* 改了的话 id 对上了、内容对不上,下一次 reload 照内容重新认,id 又变了;
|
|
13196
|
+
* - 同一个库里有**另一个 id**、内容一模一样 → `duplicate-content`(回那条的 id)。文件里两条
|
|
13197
|
+
* 同内容会在下次加载时被去重成一条,两个 id 留下一个,另一个就像被删了;
|
|
13198
|
+
* - `expectUpdatedAt` 给了而本机那条的 `updatedAt` 对不上 → `conflict`(落之前本机被改过);
|
|
13199
|
+
* - 注入检测**照常打标记、不拒**(同从文件加载那一侧),配额**不拦**:这是别处已经写成了的
|
|
13200
|
+
* 一条,拒掉它只会让两台机器永远对不齐;
|
|
13201
|
+
* - 不报 {@link MemoryManagerOptions.onRemoved}、不动快照(同 {@link add})。
|
|
13202
|
+
*/
|
|
13203
|
+
importEntry(rec: MemoryImportRecord, opts?: {
|
|
13204
|
+
expectUpdatedAt?: number;
|
|
13205
|
+
}): Promise<MemoryImportResult>;
|
|
13206
|
+
/**
|
|
13207
|
+
* 按 id 删一条(云同步落「别处删了」那一下)。`notify: false` 时不报 {@link MemoryManagerOptions.onRemoved}
|
|
13208
|
+
* —— 这一删本来就是从别处同步来的,再报回去就是在云上再写一遍同一块墓碑。
|
|
13209
|
+
*
|
|
13210
|
+
* `expectUpdatedAt` 给了而对不上 → 不删(落之前本机改过它,删除和本机改动谁赢不该由这里定)。
|
|
13211
|
+
*/
|
|
13212
|
+
removeById(id: string, opts?: {
|
|
13213
|
+
notify?: boolean;
|
|
13214
|
+
expectUpdatedAt?: number;
|
|
13215
|
+
}): Promise<boolean>;
|
|
13216
|
+
/** 回调里抛什么都吞掉 —— 删除已经发生了({@link MemoryManagerOptions.onRemoved})。 */
|
|
13217
|
+
private notifyRemoved;
|
|
13057
13218
|
/**
|
|
13058
13219
|
* 按「全文」或「索引里的短 id」定位一条记忆。
|
|
13059
13220
|
*
|
|
@@ -14155,6 +14316,39 @@ interface ImportSessionInput {
|
|
|
14155
14316
|
meta: ImportSessionMeta;
|
|
14156
14317
|
/** 按时间正序。空数组合法(一段还没说话的会话也是会话) */
|
|
14157
14318
|
messages: ImportMessage[];
|
|
14319
|
+
/**
|
|
14320
|
+
* 这段会话的待办(2026-10-09,云同步导入会话时一起带过来)。**id 一律重发**:待办 id 是 6 位
|
|
14321
|
+
* 短 hex、全库一张表,沿用来源的号迟早撞上本机已有的;结果里 {@link ImportSessionResult} 的
|
|
14322
|
+
* `todoIds` 按下标对齐给回新号。
|
|
14323
|
+
*/
|
|
14324
|
+
todos?: ImportTodo[];
|
|
14325
|
+
/**
|
|
14326
|
+
* 这段会话的目标(同上)。**只有一个**:一段会话在库里只存一个目标(`GoalStore.put` 先删后插)。
|
|
14327
|
+
* id 同样重发。
|
|
14328
|
+
*/
|
|
14329
|
+
goal?: ImportGoal;
|
|
14330
|
+
}
|
|
14331
|
+
/** 导进来的一条待办。时刻是 ISO 字符串(`todos` 表那两列就是这么存的)。 */
|
|
14332
|
+
interface ImportTodo {
|
|
14333
|
+
content: string;
|
|
14334
|
+
status: 'pending' | 'in_progress' | 'completed' | 'cancelled';
|
|
14335
|
+
reason?: string;
|
|
14336
|
+
createdAt: string;
|
|
14337
|
+
updatedAt: string;
|
|
14338
|
+
}
|
|
14339
|
+
/** 导进来的目标。不变式照 `GoalStore`:`blocked` 要有码、`complete` 要有依据。 */
|
|
14340
|
+
interface ImportGoal {
|
|
14341
|
+
objective: string;
|
|
14342
|
+
phase: 'active' | 'paused' | 'blocked' | 'complete';
|
|
14343
|
+
blockCode?: string;
|
|
14344
|
+
blockMsg?: string;
|
|
14345
|
+
maxRounds: number;
|
|
14346
|
+
roundsUsed: number;
|
|
14347
|
+
completeEvidence?: string;
|
|
14348
|
+
/** epoch 毫秒 */
|
|
14349
|
+
createdAt: number;
|
|
14350
|
+
/** epoch 毫秒 */
|
|
14351
|
+
updatedAt: number;
|
|
14158
14352
|
}
|
|
14159
14353
|
/**
|
|
14160
14354
|
* 导入的结果。
|
|
@@ -14176,6 +14370,10 @@ type ImportSessionResult = {
|
|
|
14176
14370
|
idMap: Record<number, number>;
|
|
14177
14371
|
/** 父指针被丢掉了的话,这里是被丢掉的那个 id。见 `ImportSessionMeta.parentId` */
|
|
14178
14372
|
droppedParentId?: string;
|
|
14373
|
+
/** 带了待办时:本机给的新 id,下标与 `ImportSessionInput.todos` 对齐 */
|
|
14374
|
+
todoIds?: string[];
|
|
14375
|
+
/** 带了目标时:本机给的新 id */
|
|
14376
|
+
goalId?: string;
|
|
14179
14377
|
} | {
|
|
14180
14378
|
ok: false;
|
|
14181
14379
|
id: string;
|
|
@@ -16615,6 +16813,37 @@ interface ScheduleIssue {
|
|
|
16615
16813
|
* 和 `ScheduleDefinition` 的差别全在「谁来定」:`id` / 时间戳 / `os*` 那几样
|
|
16616
16814
|
* 由 store 和注册器写,调用方给不了也不该给。
|
|
16617
16815
|
*/
|
|
16816
|
+
/**
|
|
16817
|
+
* 从别处(云同步)落一条定时任务进来:**带着它原来的 id 和时间戳**({@link ScheduleStore.importDefinition})。
|
|
16818
|
+
*
|
|
16819
|
+
* 只有「用户的意图」那几格,没有本机那几格:`os_*`(注册信息)、`lastRunAt` / `lastStatus`(运行痕迹)
|
|
16820
|
+
* 和 `enabled`(这台要不要跑)都是**这台机器自己的**,更新时原样留着;新建时一律不启用、不注册 ——
|
|
16821
|
+
* 同步的是任务的定义,要不要在这台跑由这台的用户点头。
|
|
16822
|
+
*/
|
|
16823
|
+
interface ScheduleImportInput {
|
|
16824
|
+
id: string;
|
|
16825
|
+
name: string;
|
|
16826
|
+
prompt: string;
|
|
16827
|
+
model?: string;
|
|
16828
|
+
role?: string;
|
|
16829
|
+
skills?: readonly string[];
|
|
16830
|
+
mcpServers?: readonly string[];
|
|
16831
|
+
permission: PermissionLevel;
|
|
16832
|
+
allowTools: readonly string[];
|
|
16833
|
+
allowOperations: readonly OperationType[];
|
|
16834
|
+
allowRules: readonly string[];
|
|
16835
|
+
maxTurns: number;
|
|
16836
|
+
maxBudgetUsd: number;
|
|
16837
|
+
timeoutMs: number;
|
|
16838
|
+
showInSessionList?: boolean;
|
|
16839
|
+
trigger: ScheduleTrigger;
|
|
16840
|
+
startDate?: string;
|
|
16841
|
+
endDate?: string;
|
|
16842
|
+
/** epoch 毫秒 */
|
|
16843
|
+
createdAt: number;
|
|
16844
|
+
/** epoch 毫秒 */
|
|
16845
|
+
updatedAt: number;
|
|
16846
|
+
}
|
|
16618
16847
|
interface CreateScheduleInput {
|
|
16619
16848
|
name: string;
|
|
16620
16849
|
prompt: string;
|
|
@@ -16836,6 +17065,21 @@ declare class ScheduleStore {
|
|
|
16836
17065
|
create(input: CreateScheduleInput & {
|
|
16837
17066
|
workDir: string;
|
|
16838
17067
|
}): ScheduleDefinition;
|
|
17068
|
+
/**
|
|
17069
|
+
* 落一条**别处来的**任务,带着它原来的 id 和时间戳(云同步,2026-10-09)。判据在 {@link ScheduleImportInput} 上。
|
|
17070
|
+
*
|
|
17071
|
+
* - 库里没有这个 id → 新建:**不启用、不注册**(`osBackend: 'host'`、`osTaskId: ''`)。
|
|
17072
|
+
* `workDir` 由调用方算好(这台机器上的目录,不是原来那台的);
|
|
17073
|
+
* - 库里有 → 只改「用户的意图」那几格;`enabled`、`workDir`、`os_*`、`last_*` 原样留着 ——
|
|
17074
|
+
* 这台机器上用户启没启用、绑了哪个目录、注册成了什么样,都不该被另一台机器改掉。
|
|
17075
|
+
*/
|
|
17076
|
+
importDefinition(input: ScheduleImportInput & {
|
|
17077
|
+
workDir: string;
|
|
17078
|
+
}): {
|
|
17079
|
+
action: 'inserted' | 'updated';
|
|
17080
|
+
schedule: ScheduleDefinition;
|
|
17081
|
+
};
|
|
17082
|
+
private insertRow;
|
|
16839
17083
|
get(id: string): ScheduleDefinition | undefined;
|
|
16840
17084
|
/**
|
|
16841
17085
|
* 按 id 前缀找(`epoch schedule show sch_1a2b`)。
|
|
@@ -19237,6 +19481,15 @@ declare function scanSkillDirs(dirs: readonly SkillDirSpec[]): SkillScanOutcome;
|
|
|
19237
19481
|
* `lstatSync`:不是普通文件也不是目录,就跳过并说一句。
|
|
19238
19482
|
*/
|
|
19239
19483
|
|
|
19484
|
+
/**
|
|
19485
|
+
* `SKILL.md` 之外,一个技能目录里允许存在的四个子目录。
|
|
19486
|
+
*
|
|
19487
|
+
* **真源在这里,`SkillSystem.writeFile` 从这儿取** —— 文件头那条 ⚠️ 说的就是
|
|
19488
|
+
* 为什么它不能有第二份。
|
|
19489
|
+
*/
|
|
19490
|
+
declare const SKILL_ASSET_DIRS: readonly ["references", "templates", "scripts", "assets"];
|
|
19491
|
+
/** 技能正文的文件名,两层布局里的那个叶子 */
|
|
19492
|
+
declare const SKILL_FILE = "SKILL.md";
|
|
19240
19493
|
/** 导入源的四种形态 */
|
|
19241
19494
|
type SkillImportForm = 'markdown' | 'skill-dir' | 'tree' | 'archive';
|
|
19242
19495
|
|
|
@@ -19378,6 +19631,14 @@ interface SkillImportOptions {
|
|
|
19378
19631
|
* 让一段比这次响应活得久的文本跟着某一次请求的语言走,是这个方案明确禁止的事。
|
|
19379
19632
|
*/
|
|
19380
19633
|
lang?: Lang;
|
|
19634
|
+
/**
|
|
19635
|
+
* 同名的**用户级**技能要不要换成这一份(2026-10-09,云同步要用)。不给 = 不换(照旧跳过)。
|
|
19636
|
+
*
|
|
19637
|
+
* 换法是「旧的挪进 `<skillsDir>/.trash-<uuid>/` → 新的 `rename` 到位 → 删掉回收目录」,三步同一个
|
|
19638
|
+
* 文件系统;新的没到位就把旧的挪回来。所以任何时刻磁盘上都有**一份完整的**技能,不会出现
|
|
19639
|
+
* 「先删、再装、装失败了就一份都没有」那个窗口。⚠️ 项目级 / 插件 / 宿主那几档照旧不碰。
|
|
19640
|
+
*/
|
|
19641
|
+
replace?: boolean;
|
|
19381
19642
|
}
|
|
19382
19643
|
/** 「将导入什么」。**一个字节都不写**(staging 用完就删) */
|
|
19383
19644
|
declare function previewSkillImport(source: string, opts: SkillImportOptions): Promise<SkillImportResult<{
|
|
@@ -20850,4 +21111,4 @@ declare function resolveCodeModeWorker(baseDir: string, exists?: typeof existsSy
|
|
|
20850
21111
|
*/
|
|
20851
21112
|
declare function codeModeWorkerPath(): string | undefined;
|
|
20852
21113
|
|
|
20853
|
-
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, AppearanceStore, type AppendMessageInput, ApprovalCache, type ApprovalDecision, 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 ImportMessage, type ImportNode, type ImportPartsResult, type ImportSessionInput, type ImportSessionMeta, type ImportSessionResult, type ImportSkipReason, ImportTrustStore, type InstallDependency, 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 MarketplaceCategory, type MarketplaceDisplay, type MarketplaceDisplayField, type MarketplaceEntry, type MarketplaceOutcome, type MarketplaceRecord, type MarketplaceStatus, type MemoryConfig, type MemoryEntry, MemoryManager, type MemoryNotice, 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 PersistFailureKind, 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 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 StoredAppearance, 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, approvalEntryFor, approvalRootFor, artifactLaunchArgv, artifactOpenRefusal, assertLevelAllowed, blockedRoleTools, buildContextBreakdown, buildFireArgv, buildFtsMatchQuery, buildSchemaExports, buildSystemPrompt, buildTrigramMatchQuery, builtinRoles, checkEpochVersion, checkFtsHealth, checkShadowing, classifyPersistFailure, 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, displayAllows, displayCurrency, draftCommandLine, draftWidening, escapeRuleContent, estimateImageTokens, estimateRunTokens, estimateTokens, evaluateSelection, expandCommand, expandImports, explainSetting, extractArchive, findInstructionFiles, findProjectInstructions, findRole, formatBytes, formatSkillIndex, formatUsd, gateForTool, getCapability, getConfigIssues, getConfigOrigins, getImportGate, getTrustGate, grantedPathsFor, hasDedicatedExecContent, hasExecTierContent, hasPromptCaching, hasProviderCredentials, hasReadTierContent, imageFromBase64, imageFromPath, imagePartTokens, importParts, importSkills, installPlugin, instructionDirs, instructionNotices, intervalSlots, inventoryProjectExtensions, inventoryTotal, isBlockCode, isCodeModeDeferred, isEmptyRules, isGoalPhase, isNonInteractive, isReadOnlySubCall, isSettingWriteLayer, isTransientPersistFailure, 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, persistFailureCode, 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 };
|
|
21114
|
+
export { ABOUT_DESC_MAX_CHARS, ABOUT_README_MAX_CHARS, 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, AppearanceStore, type AppendMessageInput, ApprovalCache, type ApprovalDecision, 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 ImportGoal, type ImportMessage, type ImportNode, type ImportPartsResult, type ImportSessionInput, type ImportSessionMeta, type ImportSessionResult, type ImportSkipReason, type ImportTodo, ImportTrustStore, type InstallDependency, 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 MarketplaceCategory, type MarketplaceDisplay, type MarketplaceDisplayField, type MarketplaceEntry, type MarketplaceOutcome, type MarketplaceRecord, type MarketplaceStatus, type MemoryConfig, type MemoryEntry, type MemoryImportRecord, type MemoryImportResult, MemoryManager, type MemoryManagerOptions, type MemoryNotice, type MemoryRemoval, 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 PersistFailureKind, type PersistedBudget, type PersistedPart, type PlanApprovalFn, type PlanEnterResult, type PlanModeDeps, PlanModeState, type PlanSettlement, type PluginAbout, type PluginArtifacts, type PluginAuthor, PluginAuthorSchema, type PluginCommandDir, type PluginCounts, type PluginDoc, 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 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_ASSET_DIRS, SKILL_CREATE_TOOL, SKILL_EDIT_TOOL, SKILL_FILE, 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 ScheduleImportInput, 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 StoredAppearance, 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, approvalEntryFor, approvalRootFor, artifactLaunchArgv, artifactOpenRefusal, assertLevelAllowed, blockedRoleTools, buildContextBreakdown, buildFireArgv, buildFtsMatchQuery, buildSchemaExports, buildSystemPrompt, buildTrigramMatchQuery, builtinRoles, checkEpochVersion, checkFtsHealth, checkShadowing, classifyPersistFailure, 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, displayAllows, displayCurrency, draftCommandLine, draftWidening, escapeRuleContent, estimateImageTokens, estimateRunTokens, estimateTokens, evaluateSelection, expandCommand, expandImports, explainSetting, extractArchive, findInstructionFiles, findProjectInstructions, findRole, formatBytes, formatSkillIndex, formatUsd, gateForTool, getCapability, getConfigIssues, getConfigOrigins, getImportGate, getTrustGate, grantedPathsFor, hasDedicatedExecContent, hasExecTierContent, hasPromptCaching, hasProviderCredentials, hasReadTierContent, imageFromBase64, imageFromPath, imagePartTokens, importParts, importSkills, installPlugin, instructionDirs, instructionNotices, intervalSlots, inventoryProjectExtensions, inventoryTotal, isBlockCode, isCodeModeDeferred, isEmptyRules, isGoalPhase, isNonInteractive, isReadOnlySubCall, isSettingWriteLayer, isTransientPersistFailure, 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, persistFailureCode, persistParts, persistToolResults, persistedUsage, planPack, previewSkillImport, pricingFor, projectEntryForDisplay, pruneArtifacts, pruneAttachments, pruneRecordings, pruneSchedules, readImageSize, readMarketplaces, readPluginAbout, 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
|
@@ -274,7 +274,7 @@ function createLaunchdBackend(opts = {}) {
|
|
|
274
274
|
mkdirSync(input.logDir, { recursive: true });
|
|
275
275
|
writeFileSync(path, renderPlist(label, input), "utf-8");
|
|
276
276
|
} catch (err) {
|
|
277
|
-
return { ok: false, detail: `plist-write-failed: ${
|
|
277
|
+
return { ok: false, detail: `plist-write-failed: ${describe10(err)}` };
|
|
278
278
|
}
|
|
279
279
|
await run("launchctl", ["bootout", `${guiDomain()}/${label}`]);
|
|
280
280
|
const toggle = await backend.setEnabled(label, input.enabled);
|
|
@@ -290,7 +290,7 @@ function createLaunchdBackend(opts = {}) {
|
|
|
290
290
|
try {
|
|
291
291
|
rmSync(plistPath(label), { force: true });
|
|
292
292
|
} catch (err) {
|
|
293
|
-
return { ok: false, detail: `plist-remove-failed: ${
|
|
293
|
+
return { ok: false, detail: `plist-remove-failed: ${describe10(err)}` };
|
|
294
294
|
}
|
|
295
295
|
return { ok: true };
|
|
296
296
|
},
|
|
@@ -447,7 +447,7 @@ function detailOf2(what, res) {
|
|
|
447
447
|
const msg = (res.stderr || res.stdout).trim();
|
|
448
448
|
return `${what} exit ${res.code}${msg ? `: ${msg}` : ""}`;
|
|
449
449
|
}
|
|
450
|
-
function
|
|
450
|
+
function describe10(err) {
|
|
451
451
|
return err instanceof Error ? err.message : String(err);
|
|
452
452
|
}
|
|
453
453
|
var LAUNCHD_LABEL_PREFIX;
|
|
@@ -7083,6 +7083,92 @@ function firstLine3(err) {
|
|
|
7083
7083
|
const message = err instanceof Error ? err.message : String(err);
|
|
7084
7084
|
return message.split("\n")[0] ?? message;
|
|
7085
7085
|
}
|
|
7086
|
+
var ABOUT_README_MAX_CHARS = 32e3;
|
|
7087
|
+
var ABOUT_DESC_MAX_CHARS = 280;
|
|
7088
|
+
function readPluginAbout(dir, pluginName) {
|
|
7089
|
+
const readme = readReadme(dir);
|
|
7090
|
+
return {
|
|
7091
|
+
...readme ? { readme } : {},
|
|
7092
|
+
commands: aboutCommands(dir, pluginName),
|
|
7093
|
+
roles: aboutRoles(dir, pluginName),
|
|
7094
|
+
skills: aboutSkills(dir, pluginName)
|
|
7095
|
+
};
|
|
7096
|
+
}
|
|
7097
|
+
function readReadme(dir) {
|
|
7098
|
+
let names;
|
|
7099
|
+
try {
|
|
7100
|
+
names = readdirSync(dir);
|
|
7101
|
+
} catch {
|
|
7102
|
+
return void 0;
|
|
7103
|
+
}
|
|
7104
|
+
const hit = names.find((n) => /^readme\.md$/i.test(n));
|
|
7105
|
+
if (hit === void 0) return void 0;
|
|
7106
|
+
const text = readText(join(dir, hit))?.trim();
|
|
7107
|
+
if (!text) return void 0;
|
|
7108
|
+
return text.length > ABOUT_README_MAX_CHARS ? { text: text.slice(0, ABOUT_README_MAX_CHARS), truncated: true } : { text, truncated: false };
|
|
7109
|
+
}
|
|
7110
|
+
function aboutCommands(dir, plugin) {
|
|
7111
|
+
const found = discoverMarkdown(join(dir, PLUGIN_LAYOUT.commands));
|
|
7112
|
+
return collect2(
|
|
7113
|
+
found.files.map((f) => ({
|
|
7114
|
+
name: `${plugin}:${commandNameFromRelPath(f.relPath)}`,
|
|
7115
|
+
path: f.path
|
|
7116
|
+
}))
|
|
7117
|
+
);
|
|
7118
|
+
}
|
|
7119
|
+
function aboutRoles(dir, plugin) {
|
|
7120
|
+
const root = join(dir, PLUGIN_LAYOUT.agents);
|
|
7121
|
+
return collect2(
|
|
7122
|
+
listNames(root, "file").filter((f) => f.endsWith(".md")).map((f) => ({
|
|
7123
|
+
name: `${plugin}:${f.replace(/\.md$/i, "").toLowerCase()}`,
|
|
7124
|
+
path: join(root, f)
|
|
7125
|
+
}))
|
|
7126
|
+
);
|
|
7127
|
+
}
|
|
7128
|
+
function aboutSkills(dir, plugin) {
|
|
7129
|
+
const root = join(dir, PLUGIN_LAYOUT.skills);
|
|
7130
|
+
const out = [];
|
|
7131
|
+
for (const category of listNames(root, "dir")) {
|
|
7132
|
+
for (const name of listNames(join(root, category), "dir")) {
|
|
7133
|
+
out.push({ name: `${plugin}:${name}`, path: join(root, category, name, "SKILL.md") });
|
|
7134
|
+
}
|
|
7135
|
+
}
|
|
7136
|
+
return collect2(out);
|
|
7137
|
+
}
|
|
7138
|
+
function collect2(files) {
|
|
7139
|
+
const out = [];
|
|
7140
|
+
for (const f of files) {
|
|
7141
|
+
const description = describe4(f.path);
|
|
7142
|
+
if (description) out.push({ name: f.name, description });
|
|
7143
|
+
}
|
|
7144
|
+
return out.sort((a, b) => a.name.localeCompare(b.name));
|
|
7145
|
+
}
|
|
7146
|
+
function describe4(path) {
|
|
7147
|
+
const raw = readText(path);
|
|
7148
|
+
if (raw === void 0) return "";
|
|
7149
|
+
const parsed = parseFrontmatter(raw);
|
|
7150
|
+
if ("error" in parsed) return "";
|
|
7151
|
+
const value = parsed.data?.description;
|
|
7152
|
+
if (typeof value !== "string") return "";
|
|
7153
|
+
const line = value.replace(/\s+/g, " ").trim();
|
|
7154
|
+
return line.length > ABOUT_DESC_MAX_CHARS ? `${line.slice(0, ABOUT_DESC_MAX_CHARS - 1).trimEnd()}\u2026` : line;
|
|
7155
|
+
}
|
|
7156
|
+
function readText(path) {
|
|
7157
|
+
if (!existsSync(path)) return void 0;
|
|
7158
|
+
try {
|
|
7159
|
+
return readFileSync(path, "utf-8");
|
|
7160
|
+
} catch {
|
|
7161
|
+
return void 0;
|
|
7162
|
+
}
|
|
7163
|
+
}
|
|
7164
|
+
function listNames(dir, kind) {
|
|
7165
|
+
if (!existsSync(dir)) return [];
|
|
7166
|
+
try {
|
|
7167
|
+
return readdirSync(dir, { withFileTypes: true }).filter((e) => kind === "file" ? e.isFile() : !e.isFile() && !e.name.startsWith(".")).map((e) => e.name);
|
|
7168
|
+
} catch {
|
|
7169
|
+
return [];
|
|
7170
|
+
}
|
|
7171
|
+
}
|
|
7086
7172
|
var MARKETPLACE_FILE = "epoch-marketplace.json";
|
|
7087
7173
|
var NAME_PATTERN = PLUGIN_NAME_PATTERN;
|
|
7088
7174
|
var EntryCategoryInput = z.union([z.string().min(1), z.array(z.string().min(1))]).optional().catch(void 0);
|
|
@@ -7525,6 +7611,7 @@ ${detail}` }) };
|
|
|
7525
7611
|
manifest,
|
|
7526
7612
|
source: resolved,
|
|
7527
7613
|
inventory: scanPluginDir(readDir, manifest.name),
|
|
7614
|
+
about: readPluginAbout(readDir, manifest.name),
|
|
7528
7615
|
...conflict ? { conflict } : {},
|
|
7529
7616
|
...versionUnmet ? { versionUnmet } : {},
|
|
7530
7617
|
...closure.report.length > 0 ? { dependencies: closure.report } : {}
|
|
@@ -9390,7 +9477,7 @@ function decideTrust(dir) {
|
|
|
9390
9477
|
return ambient ? ambient.decide(dir) : noGate();
|
|
9391
9478
|
}
|
|
9392
9479
|
var FILE_VERSION = 1;
|
|
9393
|
-
function
|
|
9480
|
+
function describe5(err) {
|
|
9394
9481
|
return err instanceof Error ? err.message : String(err);
|
|
9395
9482
|
}
|
|
9396
9483
|
var ImportTrustStore = class {
|
|
@@ -9432,7 +9519,7 @@ var ImportTrustStore = class {
|
|
|
9432
9519
|
raw = readFileSync(this.filePath, "utf-8");
|
|
9433
9520
|
} catch (err) {
|
|
9434
9521
|
this.loadErrors.push(
|
|
9435
|
-
t("import_trust.read_failed", { path: this.filePath, reason:
|
|
9522
|
+
t("import_trust.read_failed", { path: this.filePath, reason: describe5(err) })
|
|
9436
9523
|
);
|
|
9437
9524
|
return;
|
|
9438
9525
|
}
|
|
@@ -9441,7 +9528,7 @@ var ImportTrustStore = class {
|
|
|
9441
9528
|
parsed = JSON.parse(raw);
|
|
9442
9529
|
} catch (err) {
|
|
9443
9530
|
this.loadErrors.push(
|
|
9444
|
-
t("import_trust.bad_json", { path: this.filePath, reason:
|
|
9531
|
+
t("import_trust.bad_json", { path: this.filePath, reason: describe5(err) })
|
|
9445
9532
|
);
|
|
9446
9533
|
return;
|
|
9447
9534
|
}
|
|
@@ -9499,7 +9586,7 @@ var ImportTrustStore = class {
|
|
|
9499
9586
|
} catch (err) {
|
|
9500
9587
|
rmSync(tmp, { force: true });
|
|
9501
9588
|
throw new Error(
|
|
9502
|
-
t("import_trust.write_failed", { path: this.filePath, reason:
|
|
9589
|
+
t("import_trust.write_failed", { path: this.filePath, reason: describe5(err) })
|
|
9503
9590
|
);
|
|
9504
9591
|
}
|
|
9505
9592
|
}
|
|
@@ -13068,12 +13155,12 @@ function finishLayer(source, read, execTrusted, issues) {
|
|
|
13068
13155
|
status: gated ? "gated" : "loaded",
|
|
13069
13156
|
lists: checked.lists,
|
|
13070
13157
|
scalars: {},
|
|
13071
|
-
detail:
|
|
13158
|
+
detail: describe6(layer, gated, checked.lists)
|
|
13072
13159
|
},
|
|
13073
13160
|
file: { ...file, permissions: checked.lists }
|
|
13074
13161
|
};
|
|
13075
13162
|
}
|
|
13076
|
-
function
|
|
13163
|
+
function describe6(layer, gated, lists) {
|
|
13077
13164
|
const label = layerLabel(layer);
|
|
13078
13165
|
if (gated) {
|
|
13079
13166
|
const deny = lists.deny?.length ?? 0;
|
|
@@ -15562,6 +15649,27 @@ var MemoryDB = class {
|
|
|
15562
15649
|
const rows = this.db.prepare("SELECT content FROM memory_entries WHERE target = ? ORDER BY position ASC").all(target);
|
|
15563
15650
|
return rows.map((r) => r.content);
|
|
15564
15651
|
}
|
|
15652
|
+
getById(id) {
|
|
15653
|
+
const row = this.db.prepare("SELECT * FROM memory_entries WHERE id = ?").get(id);
|
|
15654
|
+
return row ? this.rowToEntry(row) : void 0;
|
|
15655
|
+
}
|
|
15656
|
+
updateById(entry) {
|
|
15657
|
+
const existing = this.db.prepare("SELECT rowid FROM memory_entries WHERE id = ?").get(entry.id);
|
|
15658
|
+
if (!existing) return;
|
|
15659
|
+
this.db.prepare(
|
|
15660
|
+
"UPDATE memory_entries SET target = @target, content = @content, char_length = @charLength, created_at = @createdAt, updated_at = @updatedAt, blocked = @blocked WHERE rowid = @rowid"
|
|
15661
|
+
).run({
|
|
15662
|
+
target: entry.target,
|
|
15663
|
+
content: entry.content,
|
|
15664
|
+
charLength: entry.content.length,
|
|
15665
|
+
createdAt: entry.createdAt.getTime(),
|
|
15666
|
+
updatedAt: entry.updatedAt.getTime(),
|
|
15667
|
+
blocked: entry.blocked ? 1 : 0,
|
|
15668
|
+
rowid: existing.rowid
|
|
15669
|
+
});
|
|
15670
|
+
this.unsyncFts(existing.rowid);
|
|
15671
|
+
this.writeFts(existing.rowid, entry.content);
|
|
15672
|
+
}
|
|
15565
15673
|
findByContent(target, content) {
|
|
15566
15674
|
const row = this.db.prepare("SELECT * FROM memory_entries WHERE target = ? AND content = ?").get(target, content);
|
|
15567
15675
|
return row ? this.rowToEntry(row) : void 0;
|
|
@@ -15677,6 +15785,15 @@ var MEM_DIR = join(homedir(), ".epoch", "memories");
|
|
|
15677
15785
|
var ENTRY_DELIMITER = "\n\xA7 ";
|
|
15678
15786
|
var MAX_ENTRY_CHARS = 4e3;
|
|
15679
15787
|
var MAX_CONSOLIDATION_FAILURES_PER_TURN = 3;
|
|
15788
|
+
function fileSafe(content) {
|
|
15789
|
+
if (content.trim() === "") return "empty";
|
|
15790
|
+
if (content !== content.trim()) return "leading or trailing whitespace";
|
|
15791
|
+
if (content.split("\n").slice(1).some((line) => line.startsWith("\xA7")))
|
|
15792
|
+
return "a line starts with \xA7";
|
|
15793
|
+
if (countCodePoints(content) > MAX_ENTRY_CHARS)
|
|
15794
|
+
return `longer than ${String(MAX_ENTRY_CHARS)} characters`;
|
|
15795
|
+
return null;
|
|
15796
|
+
}
|
|
15680
15797
|
var QUOTA_WARN_PCT = 90;
|
|
15681
15798
|
var SHORT_ID_HEX = 6;
|
|
15682
15799
|
var INDEX_SUMMARY_CHARS = 80;
|
|
@@ -15700,6 +15817,17 @@ function stripUndefined(obj) {
|
|
|
15700
15817
|
return Object.fromEntries(Object.entries(obj).filter(([, v]) => v !== void 0));
|
|
15701
15818
|
}
|
|
15702
15819
|
var MemoryManager = class {
|
|
15820
|
+
constructor(dbPath, memDir, config, options = {}) {
|
|
15821
|
+
this.options = options;
|
|
15822
|
+
const dp = dbPath ?? DB_PATH;
|
|
15823
|
+
const md = memDir ?? MEM_DIR;
|
|
15824
|
+
this.memDir = md;
|
|
15825
|
+
mkdirSync(dirname(dp), { recursive: true });
|
|
15826
|
+
mkdirSync(this.memDir, { recursive: true });
|
|
15827
|
+
this.db = new MemoryDB(dp);
|
|
15828
|
+
this.config = { ...defaultMemoryConfig(), ...stripUndefined(config) };
|
|
15829
|
+
}
|
|
15830
|
+
options;
|
|
15703
15831
|
db;
|
|
15704
15832
|
config;
|
|
15705
15833
|
memDir;
|
|
@@ -15712,15 +15840,6 @@ var MemoryManager = class {
|
|
|
15712
15840
|
notices = [];
|
|
15713
15841
|
notifiedBlocked = false;
|
|
15714
15842
|
notifiedQuota = false;
|
|
15715
|
-
constructor(dbPath, memDir, config) {
|
|
15716
|
-
const dp = dbPath ?? DB_PATH;
|
|
15717
|
-
const md = memDir ?? MEM_DIR;
|
|
15718
|
-
this.memDir = md;
|
|
15719
|
-
mkdirSync(dirname(dp), { recursive: true });
|
|
15720
|
-
mkdirSync(this.memDir, { recursive: true });
|
|
15721
|
-
this.db = new MemoryDB(dp);
|
|
15722
|
-
this.config = { ...defaultMemoryConfig(), ...stripUndefined(config) };
|
|
15723
|
-
}
|
|
15724
15843
|
async initialize(_sessionId) {
|
|
15725
15844
|
this.initialized = true;
|
|
15726
15845
|
await this.reloadFromDisk();
|
|
@@ -15742,11 +15861,12 @@ var MemoryManager = class {
|
|
|
15742
15861
|
let blockedCount = 0;
|
|
15743
15862
|
for (const target of ["memory", "user"]) {
|
|
15744
15863
|
const file = target === "memory" ? "MEMORY.md" : "USER.md";
|
|
15745
|
-
const
|
|
15864
|
+
const path = join(this.memDir, file);
|
|
15865
|
+
const fromDisk = this.readFile(path);
|
|
15746
15866
|
const deduped = [...new Set(fromDisk)];
|
|
15747
15867
|
const classified = deduped.map((c) => this.classifyEntry(c));
|
|
15748
15868
|
blockedCount += classified.filter((e) => e.blocked).length;
|
|
15749
|
-
this.syncTarget(target, classified);
|
|
15869
|
+
this.syncTarget(target, classified, existsSync(path));
|
|
15750
15870
|
}
|
|
15751
15871
|
this.assignIds();
|
|
15752
15872
|
this.snapshot = this.renderIndexBlock();
|
|
@@ -15811,11 +15931,13 @@ var MemoryManager = class {
|
|
|
15811
15931
|
}
|
|
15812
15932
|
}
|
|
15813
15933
|
}
|
|
15814
|
-
syncTarget(target, desired) {
|
|
15934
|
+
syncTarget(target, desired, notify = true) {
|
|
15815
15935
|
const existing = new Map(this.db.getAll(target).map((e) => [e.content, e]));
|
|
15816
15936
|
const desiredSet = new Set(desired.map((d) => d.content));
|
|
15817
15937
|
for (const [content, entry] of existing) {
|
|
15818
|
-
if (
|
|
15938
|
+
if (desiredSet.has(content)) continue;
|
|
15939
|
+
this.db.removeById(entry.id);
|
|
15940
|
+
if (notify) this.notifyRemoved({ id: entry.id, target, cause: "file-edit" });
|
|
15819
15941
|
}
|
|
15820
15942
|
for (const [i, item] of desired.entries()) {
|
|
15821
15943
|
const prev = existing.get(item.content);
|
|
@@ -15969,10 +16091,69 @@ var MemoryManager = class {
|
|
|
15969
16091
|
const existing = this.locate(target, oldText);
|
|
15970
16092
|
if (!existing) return false;
|
|
15971
16093
|
this.db.remove(target, existing.content);
|
|
16094
|
+
this.notifyRemoved({ id: existing.id, target, cause: "remove" });
|
|
15972
16095
|
this.consolidationFailures = 0;
|
|
15973
16096
|
await this.flushToDisk();
|
|
15974
16097
|
return true;
|
|
15975
16098
|
}
|
|
16099
|
+
async importEntry(rec, opts = {}) {
|
|
16100
|
+
const invalid = fileSafe(rec.content);
|
|
16101
|
+
if (invalid !== null) return { ok: false, reason: "invalid", detail: invalid };
|
|
16102
|
+
const blocked = injectionLabelOf(rec.content) !== void 0;
|
|
16103
|
+
const prev = this.db.getById(rec.id);
|
|
16104
|
+
if (prev && opts.expectUpdatedAt !== void 0 && prev.updatedAt.getTime() !== opts.expectUpdatedAt) {
|
|
16105
|
+
return { ok: false, reason: "conflict" };
|
|
16106
|
+
}
|
|
16107
|
+
const twin = this.db.findByContent(rec.target, rec.content);
|
|
16108
|
+
if (twin && twin.id !== rec.id)
|
|
16109
|
+
return { ok: false, reason: "duplicate-content", existingId: twin.id };
|
|
16110
|
+
if (prev) {
|
|
16111
|
+
if (prev.target === rec.target && prev.content === rec.content && prev.createdAt.getTime() === rec.createdAt && prev.updatedAt.getTime() === rec.updatedAt) {
|
|
16112
|
+
return { ok: true, action: "unchanged", blocked: prev.blocked };
|
|
16113
|
+
}
|
|
16114
|
+
this.db.updateById({
|
|
16115
|
+
id: rec.id,
|
|
16116
|
+
target: rec.target,
|
|
16117
|
+
content: rec.content,
|
|
16118
|
+
createdAt: new Date(rec.createdAt),
|
|
16119
|
+
updatedAt: new Date(rec.updatedAt),
|
|
16120
|
+
blocked
|
|
16121
|
+
});
|
|
16122
|
+
await this.flushToDisk();
|
|
16123
|
+
return { ok: true, action: "updated", blocked };
|
|
16124
|
+
}
|
|
16125
|
+
this.db.insert({
|
|
16126
|
+
id: rec.id,
|
|
16127
|
+
target: rec.target,
|
|
16128
|
+
content: rec.content,
|
|
16129
|
+
position: this.db.nextPos(rec.target),
|
|
16130
|
+
charLength: rec.content.length,
|
|
16131
|
+
accessCount: 0,
|
|
16132
|
+
lastAccessedAt: new Date(rec.updatedAt),
|
|
16133
|
+
createdAt: new Date(rec.createdAt),
|
|
16134
|
+
updatedAt: new Date(rec.updatedAt),
|
|
16135
|
+
blocked
|
|
16136
|
+
});
|
|
16137
|
+
await this.flushToDisk();
|
|
16138
|
+
return { ok: true, action: "inserted", blocked };
|
|
16139
|
+
}
|
|
16140
|
+
async removeById(id, opts = {}) {
|
|
16141
|
+
const prev = this.db.getById(id);
|
|
16142
|
+
if (!prev) return false;
|
|
16143
|
+
if (opts.expectUpdatedAt !== void 0 && prev.updatedAt.getTime() !== opts.expectUpdatedAt) {
|
|
16144
|
+
return false;
|
|
16145
|
+
}
|
|
16146
|
+
this.db.removeById(id);
|
|
16147
|
+
if (opts.notify !== false) this.notifyRemoved({ id, target: prev.target, cause: "remove" });
|
|
16148
|
+
await this.flushToDisk();
|
|
16149
|
+
return true;
|
|
16150
|
+
}
|
|
16151
|
+
notifyRemoved(removal) {
|
|
16152
|
+
try {
|
|
16153
|
+
this.options.onRemoved?.(removal);
|
|
16154
|
+
} catch {
|
|
16155
|
+
}
|
|
16156
|
+
}
|
|
15976
16157
|
locate(target, ref) {
|
|
15977
16158
|
const key = ref.trim();
|
|
15978
16159
|
const byId = this.ids.get(key);
|
|
@@ -16978,6 +17159,9 @@ var SessionDB = class {
|
|
|
16978
17159
|
const run = this.db.transaction((sessionId) => {
|
|
16979
17160
|
this.db.prepare("UPDATE sessions SET parent_id = NULL WHERE parent_id = ?").run(sessionId);
|
|
16980
17161
|
this.db.prepare("DELETE FROM goals WHERE session_id = ?").run(sessionId);
|
|
17162
|
+
if (this.hasTable("todos")) {
|
|
17163
|
+
this.db.prepare("DELETE FROM todos WHERE session_id = ?").run(sessionId);
|
|
17164
|
+
}
|
|
16981
17165
|
this.db.prepare("DELETE FROM messages WHERE session_id = ?").run(sessionId);
|
|
16982
17166
|
return this.db.prepare("DELETE FROM sessions WHERE id = ?").run(sessionId).changes;
|
|
16983
17167
|
});
|
|
@@ -16989,15 +17173,57 @@ var SessionDB = class {
|
|
|
16989
17173
|
unarchiveSession(id) {
|
|
16990
17174
|
this.db.prepare("UPDATE sessions SET archived = 0 WHERE id = ?").run(id);
|
|
16991
17175
|
}
|
|
16992
|
-
importSession(meta, messages) {
|
|
17176
|
+
importSession(meta, messages, extras = {}) {
|
|
17177
|
+
if ((extras.todos?.length ?? 0) > 0) this.ensureTodoTable();
|
|
16993
17178
|
const run = this.db.transaction(
|
|
16994
17179
|
(m, list) => {
|
|
16995
17180
|
this.insertSession(m);
|
|
16996
|
-
|
|
17181
|
+
const ids = list.map((msg) => this.insertMessage({ ...msg, sessionId: m.id }));
|
|
17182
|
+
if ((extras.todos?.length ?? 0) > 0) {
|
|
17183
|
+
const todo = this.db.prepare(
|
|
17184
|
+
"INSERT INTO todos (id, session_id, content, status, reason, created_at, updated_at) VALUES (@id, @sessionId, @content, @status, @reason, @createdAt, @updatedAt)"
|
|
17185
|
+
);
|
|
17186
|
+
for (const t81 of extras.todos ?? []) {
|
|
17187
|
+
todo.run({ ...t81, sessionId: m.id, reason: t81.reason || null });
|
|
17188
|
+
}
|
|
17189
|
+
}
|
|
17190
|
+
const g = extras.goal;
|
|
17191
|
+
if (g) {
|
|
17192
|
+
this.db.prepare(
|
|
17193
|
+
`INSERT INTO goals (
|
|
17194
|
+
id, session_id, objective, phase, block_code, block_msg,
|
|
17195
|
+
max_rounds, rounds_used, complete_evidence, created_at, updated_at
|
|
17196
|
+
) VALUES (
|
|
17197
|
+
@id, @sessionId, @objective, @phase, @blockCode, @blockMsg,
|
|
17198
|
+
@maxRounds, @roundsUsed, @completeEvidence, @createdAt, @updatedAt
|
|
17199
|
+
)`
|
|
17200
|
+
).run({
|
|
17201
|
+
...g,
|
|
17202
|
+
sessionId: m.id,
|
|
17203
|
+
blockCode: g.blockCode ?? null,
|
|
17204
|
+
blockMsg: g.blockMsg ?? null,
|
|
17205
|
+
completeEvidence: g.completeEvidence ?? null
|
|
17206
|
+
});
|
|
17207
|
+
}
|
|
17208
|
+
return ids;
|
|
16997
17209
|
}
|
|
16998
17210
|
);
|
|
16999
17211
|
return run(meta, messages);
|
|
17000
17212
|
}
|
|
17213
|
+
freshTodoId() {
|
|
17214
|
+
const taken = this.hasTable("todos") ? (id) => this.db.prepare("SELECT 1 FROM todos WHERE id = ?").get(id) !== void 0 : () => false;
|
|
17215
|
+
for (; ; ) {
|
|
17216
|
+
const id = randomBytes(3).toString("hex");
|
|
17217
|
+
if (!taken(id)) return id;
|
|
17218
|
+
}
|
|
17219
|
+
}
|
|
17220
|
+
hasTable(name) {
|
|
17221
|
+
return this.db.prepare("SELECT 1 FROM sqlite_master WHERE type = 'table' AND name = ?").get(name) !== void 0;
|
|
17222
|
+
}
|
|
17223
|
+
ensureTodoTable() {
|
|
17224
|
+
if (this.hasTable("todos")) return;
|
|
17225
|
+
new TrackerDB(this.path).close();
|
|
17226
|
+
}
|
|
17001
17227
|
insertMessage(msg) {
|
|
17002
17228
|
const info = this.db.prepare(
|
|
17003
17229
|
`
|
|
@@ -17604,7 +17830,29 @@ var SessionReferences = class {
|
|
|
17604
17830
|
// src/session/manager.ts
|
|
17605
17831
|
var AUTO_VACUUM_MIN_FREELIST_RATIO = 0.25;
|
|
17606
17832
|
var IMPORT_ROLES = /* @__PURE__ */ new Set(["system", "user", "assistant", "tool"]);
|
|
17833
|
+
var TODO_STATUSES = /* @__PURE__ */ new Set(["pending", "in_progress", "completed", "cancelled"]);
|
|
17834
|
+
function validateImportExtras(input) {
|
|
17835
|
+
for (const [i, t81] of (input.todos ?? []).entries()) {
|
|
17836
|
+
if (typeof t81.content !== "string" || t81.content === "") return `todos[${i}].content`;
|
|
17837
|
+
if (!TODO_STATUSES.has(t81.status)) return `todos[${i}].status`;
|
|
17838
|
+
if (typeof t81.createdAt !== "string" || typeof t81.updatedAt !== "string") return `todos[${i}].at`;
|
|
17839
|
+
}
|
|
17840
|
+
const g = input.goal;
|
|
17841
|
+
if (g === void 0) return void 0;
|
|
17842
|
+
if (typeof g.objective !== "string" || g.objective.trim() === "") return "goal.objective";
|
|
17843
|
+
if (g.objective.length > MAX_OBJECTIVE_CHARS) return "goal.objective";
|
|
17844
|
+
if (!isGoalPhase(g.phase)) return "goal.phase";
|
|
17845
|
+
if (g.phase === "blocked" && !g.blockCode) return "goal.blockCode";
|
|
17846
|
+
if (g.phase === "complete" && !g.completeEvidence) return "goal.completeEvidence";
|
|
17847
|
+
if (!Number.isInteger(g.maxRounds) || g.maxRounds < 1 || g.maxRounds > MAX_GOAL_MAX_ROUNDS)
|
|
17848
|
+
return "goal.maxRounds";
|
|
17849
|
+
if (!Number.isInteger(g.roundsUsed) || g.roundsUsed < 0) return "goal.roundsUsed";
|
|
17850
|
+
if (!Number.isFinite(g.createdAt) || !Number.isFinite(g.updatedAt)) return "goal.at";
|
|
17851
|
+
return void 0;
|
|
17852
|
+
}
|
|
17607
17853
|
function validateImport(input) {
|
|
17854
|
+
const extras = validateImportExtras(input);
|
|
17855
|
+
if (extras) return extras;
|
|
17608
17856
|
const { meta, messages } = input;
|
|
17609
17857
|
if (typeof meta.id !== "string" || meta.id.length === 0) return "meta.id";
|
|
17610
17858
|
if (!Number.isFinite(meta.startedAt)) return "meta.startedAt";
|
|
@@ -17776,10 +18024,13 @@ var SessionManager = class {
|
|
|
17776
18024
|
converted.push({ ...rest, parts: result.parts });
|
|
17777
18025
|
}
|
|
17778
18026
|
const droppedParentId = meta.parentId !== void 0 && !this.db.hasSession(meta.parentId) ? meta.parentId : void 0;
|
|
18027
|
+
const todos = (input.todos ?? []).map((t81) => ({ ...t81, id: this.db.freshTodoId() }));
|
|
18028
|
+
const goal = input.goal === void 0 ? void 0 : { ...input.goal, id: `goal_${randomUUID().replace(/-/g, "")}` };
|
|
17779
18029
|
try {
|
|
17780
18030
|
const newIds = this.db.importSession(
|
|
17781
18031
|
buildImportedMeta(meta, droppedParentId === void 0),
|
|
17782
|
-
converted
|
|
18032
|
+
converted,
|
|
18033
|
+
{ todos, ...goal ? { goal } : {} }
|
|
17783
18034
|
);
|
|
17784
18035
|
const idMap = {};
|
|
17785
18036
|
messages.forEach((msg, i) => {
|
|
@@ -17790,7 +18041,9 @@ var SessionManager = class {
|
|
|
17790
18041
|
id,
|
|
17791
18042
|
messageCount: newIds.length,
|
|
17792
18043
|
idMap,
|
|
17793
|
-
...droppedParentId === void 0 ? {} : { droppedParentId }
|
|
18044
|
+
...droppedParentId === void 0 ? {} : { droppedParentId },
|
|
18045
|
+
...input.todos === void 0 ? {} : { todoIds: todos.map((t81) => t81.id) },
|
|
18046
|
+
...goal === void 0 ? {} : { goalId: goal.id }
|
|
17794
18047
|
};
|
|
17795
18048
|
} catch (err) {
|
|
17796
18049
|
return {
|
|
@@ -18372,7 +18625,7 @@ function inspect(input, resolved, root, accepted) {
|
|
|
18372
18625
|
}
|
|
18373
18626
|
var MAX_RECENT_WORKSPACES = 20;
|
|
18374
18627
|
var FILE_VERSION2 = 1;
|
|
18375
|
-
function
|
|
18628
|
+
function describe7(err) {
|
|
18376
18629
|
return err instanceof Error ? err.message : String(err);
|
|
18377
18630
|
}
|
|
18378
18631
|
var RecentWorkspaces = class {
|
|
@@ -18412,7 +18665,7 @@ var RecentWorkspaces = class {
|
|
|
18412
18665
|
parsed = JSON.parse(readFileSync(this.filePath, "utf-8"));
|
|
18413
18666
|
} catch (err) {
|
|
18414
18667
|
this.loadErrors.push(
|
|
18415
|
-
(lang) => t("workspace.recent_unreadable", { path: this.filePath, reason:
|
|
18668
|
+
(lang) => t("workspace.recent_unreadable", { path: this.filePath, reason: describe7(err) }, lang)
|
|
18416
18669
|
);
|
|
18417
18670
|
return;
|
|
18418
18671
|
}
|
|
@@ -18465,7 +18718,7 @@ var RecentWorkspaces = class {
|
|
|
18465
18718
|
} catch (err) {
|
|
18466
18719
|
rmSync(tmp, { force: true });
|
|
18467
18720
|
this.writeErrors.push(
|
|
18468
|
-
(lang) => t("workspace.recent_write_failed", { path: this.filePath, reason:
|
|
18721
|
+
(lang) => t("workspace.recent_write_failed", { path: this.filePath, reason: describe7(err) }, lang)
|
|
18469
18722
|
);
|
|
18470
18723
|
}
|
|
18471
18724
|
}
|
|
@@ -18477,7 +18730,7 @@ function isRecentWorkspace(value) {
|
|
|
18477
18730
|
}
|
|
18478
18731
|
var MAX_LAST_OPEN_SESSIONS = 20;
|
|
18479
18732
|
var FILE_VERSION3 = 1;
|
|
18480
|
-
function
|
|
18733
|
+
function describe8(err) {
|
|
18481
18734
|
return err instanceof Error ? err.message : String(err);
|
|
18482
18735
|
}
|
|
18483
18736
|
var LastOpenSessions = class {
|
|
@@ -18516,7 +18769,7 @@ var LastOpenSessions = class {
|
|
|
18516
18769
|
parsed = JSON.parse(readFileSync(this.filePath, "utf-8"));
|
|
18517
18770
|
} catch (err) {
|
|
18518
18771
|
this.loadErrors.push(
|
|
18519
|
-
(lang) => t("last_session.unreadable", { path: this.filePath, reason:
|
|
18772
|
+
(lang) => t("last_session.unreadable", { path: this.filePath, reason: describe8(err) }, lang)
|
|
18520
18773
|
);
|
|
18521
18774
|
return;
|
|
18522
18775
|
}
|
|
@@ -18543,7 +18796,7 @@ var LastOpenSessions = class {
|
|
|
18543
18796
|
} catch (err) {
|
|
18544
18797
|
rmSync(tmp, { force: true });
|
|
18545
18798
|
this.writeErrors.push(
|
|
18546
|
-
(lang) => t("last_session.write_failed", { path: this.filePath, reason:
|
|
18799
|
+
(lang) => t("last_session.write_failed", { path: this.filePath, reason: describe8(err) }, lang)
|
|
18547
18800
|
);
|
|
18548
18801
|
}
|
|
18549
18802
|
}
|
|
@@ -18554,7 +18807,7 @@ function isLastOpenSession(value) {
|
|
|
18554
18807
|
return typeof v["root"] === "string" && v["root"].length > 0 && typeof v["sessionId"] === "string" && v["sessionId"].length > 0 && typeof v["at"] === "number";
|
|
18555
18808
|
}
|
|
18556
18809
|
var FILE_VERSION4 = 1;
|
|
18557
|
-
function
|
|
18810
|
+
function describe9(err) {
|
|
18558
18811
|
return err instanceof Error ? err.message : String(err);
|
|
18559
18812
|
}
|
|
18560
18813
|
var AppearanceStore = class {
|
|
@@ -18587,7 +18840,7 @@ var AppearanceStore = class {
|
|
|
18587
18840
|
parsed = JSON.parse(readFileSync(this.filePath, "utf-8"));
|
|
18588
18841
|
} catch (err) {
|
|
18589
18842
|
this.loadErrors.push(
|
|
18590
|
-
(lang) => t("appearance.unreadable", { path: this.filePath, reason:
|
|
18843
|
+
(lang) => t("appearance.unreadable", { path: this.filePath, reason: describe9(err) }, lang)
|
|
18591
18844
|
);
|
|
18592
18845
|
return;
|
|
18593
18846
|
}
|
|
@@ -18614,7 +18867,7 @@ var AppearanceStore = class {
|
|
|
18614
18867
|
} catch (err) {
|
|
18615
18868
|
rmSync(tmp, { force: true });
|
|
18616
18869
|
this.writeErrors.push(
|
|
18617
|
-
(lang) => t("appearance.write_failed", { path: this.filePath, reason:
|
|
18870
|
+
(lang) => t("appearance.write_failed", { path: this.filePath, reason: describe9(err) }, lang)
|
|
18618
18871
|
);
|
|
18619
18872
|
}
|
|
18620
18873
|
}
|
|
@@ -19472,6 +19725,60 @@ var ScheduleStore = class {
|
|
|
19472
19725
|
osTaskId: "",
|
|
19473
19726
|
osCommand: []
|
|
19474
19727
|
};
|
|
19728
|
+
this.insertRow(def);
|
|
19729
|
+
return def;
|
|
19730
|
+
}
|
|
19731
|
+
importDefinition(input) {
|
|
19732
|
+
const synced = {
|
|
19733
|
+
name: input.name,
|
|
19734
|
+
prompt: input.prompt,
|
|
19735
|
+
...input.model !== void 0 ? { model: input.model } : {},
|
|
19736
|
+
...input.role !== void 0 ? { role: input.role } : {},
|
|
19737
|
+
...input.skills !== void 0 ? { skills: [...input.skills] } : {},
|
|
19738
|
+
...input.mcpServers !== void 0 ? { mcpServers: [...input.mcpServers] } : {},
|
|
19739
|
+
permission: input.permission,
|
|
19740
|
+
allowTools: [...input.allowTools],
|
|
19741
|
+
allowOperations: [...input.allowOperations],
|
|
19742
|
+
allowRules: [...input.allowRules],
|
|
19743
|
+
maxTurns: input.maxTurns,
|
|
19744
|
+
maxBudgetUsd: input.maxBudgetUsd,
|
|
19745
|
+
timeoutMs: input.timeoutMs,
|
|
19746
|
+
...input.showInSessionList === true ? { showInSessionList: true } : {},
|
|
19747
|
+
trigger: input.trigger,
|
|
19748
|
+
...input.startDate !== void 0 ? { startDate: input.startDate } : {},
|
|
19749
|
+
...input.endDate !== void 0 ? { endDate: input.endDate } : {},
|
|
19750
|
+
createdAt: input.createdAt,
|
|
19751
|
+
updatedAt: input.updatedAt
|
|
19752
|
+
};
|
|
19753
|
+
const current = this.get(input.id);
|
|
19754
|
+
if (current) {
|
|
19755
|
+
const {
|
|
19756
|
+
model: _m,
|
|
19757
|
+
role: _r,
|
|
19758
|
+
skills: _s,
|
|
19759
|
+
mcpServers: _mc,
|
|
19760
|
+
showInSessionList: _sh,
|
|
19761
|
+
startDate: _sd,
|
|
19762
|
+
endDate: _ed,
|
|
19763
|
+
...kept
|
|
19764
|
+
} = current;
|
|
19765
|
+
const next = { ...kept, ...synced };
|
|
19766
|
+
this.writeRow(next);
|
|
19767
|
+
return { action: "updated", schedule: next };
|
|
19768
|
+
}
|
|
19769
|
+
const def = {
|
|
19770
|
+
id: input.id,
|
|
19771
|
+
...synced,
|
|
19772
|
+
enabled: false,
|
|
19773
|
+
workDir: input.workDir,
|
|
19774
|
+
osBackend: "host",
|
|
19775
|
+
osTaskId: "",
|
|
19776
|
+
osCommand: []
|
|
19777
|
+
};
|
|
19778
|
+
this.insertRow(def);
|
|
19779
|
+
return { action: "inserted", schedule: def };
|
|
19780
|
+
}
|
|
19781
|
+
insertRow(def) {
|
|
19475
19782
|
this.db.prepare(
|
|
19476
19783
|
`INSERT INTO schedules (
|
|
19477
19784
|
id, name, enabled, created_at, updated_at, prompt, work_dir, model, role,
|
|
@@ -19489,7 +19796,6 @@ var ScheduleStore = class {
|
|
|
19489
19796
|
@last_run_at, @last_status
|
|
19490
19797
|
)`
|
|
19491
19798
|
).run(toRow(def));
|
|
19492
|
-
return def;
|
|
19493
19799
|
}
|
|
19494
19800
|
get(id) {
|
|
19495
19801
|
const row = this.db.prepare("SELECT * FROM schedules WHERE id = ?").get(id);
|
|
@@ -21133,7 +21439,7 @@ function loadLexiconDir(dir, source) {
|
|
|
21133
21439
|
});
|
|
21134
21440
|
continue;
|
|
21135
21441
|
}
|
|
21136
|
-
|
|
21442
|
+
collect3(content, file, spec, source, out);
|
|
21137
21443
|
}
|
|
21138
21444
|
return out;
|
|
21139
21445
|
}
|
|
@@ -21146,7 +21452,7 @@ function classify(file) {
|
|
|
21146
21452
|
}
|
|
21147
21453
|
return CATEGORY_SET.has(base) ? { kind: "terms", category: base } : null;
|
|
21148
21454
|
}
|
|
21149
|
-
function
|
|
21455
|
+
function collect3(content, file, spec, source, out) {
|
|
21150
21456
|
const lines = content.split("\n");
|
|
21151
21457
|
for (let i = 0; i < lines.length; i++) {
|
|
21152
21458
|
const line = (lines[i] ?? "").trim();
|
|
@@ -21409,7 +21715,7 @@ var HookManager = class {
|
|
|
21409
21715
|
return { blocked: true, reason: result.rejectReason || t("hook_load.rejected") };
|
|
21410
21716
|
}
|
|
21411
21717
|
} catch (err) {
|
|
21412
|
-
this.log("warn", `[HookManager] ${type} \u7684 command hook \u6267\u884C\u5F02\u5E38: ${
|
|
21718
|
+
this.log("warn", `[HookManager] ${type} \u7684 command hook \u6267\u884C\u5F02\u5E38: ${describe11(err)}`, {
|
|
21413
21719
|
hookType: type,
|
|
21414
21720
|
command: config.command
|
|
21415
21721
|
});
|
|
@@ -21427,7 +21733,7 @@ var HookManager = class {
|
|
|
21427
21733
|
(_, reject2) => setTimeout(() => reject2(new Error("Hook timeout")), HOOK_TIMEOUT_MS)
|
|
21428
21734
|
)
|
|
21429
21735
|
]).catch((err) => {
|
|
21430
|
-
this.log("warn", `[HookManager] ${type} (${reg.plugin}) \u5931\u8D25: ${
|
|
21736
|
+
this.log("warn", `[HookManager] ${type} (${reg.plugin}) \u5931\u8D25: ${describe11(err)}`, {
|
|
21431
21737
|
hookType: type,
|
|
21432
21738
|
plugin: reg.plugin
|
|
21433
21739
|
});
|
|
@@ -21439,7 +21745,7 @@ var HookManager = class {
|
|
|
21439
21745
|
if (!matchesHook(entry.matcher, event)) continue;
|
|
21440
21746
|
for (const config of entry.configs) {
|
|
21441
21747
|
runCommandHook(config, event, ctx.workDir).then((result) => reportIfNeverRan(this.log, type, config, result)).catch((err) => {
|
|
21442
|
-
this.log("warn", `[HookManager] ${type} \u7684 command hook \u5F02\u6B65\u5F02\u5E38: ${
|
|
21748
|
+
this.log("warn", `[HookManager] ${type} \u7684 command hook \u5F02\u6B65\u5F02\u5E38: ${describe11(err)}`, {
|
|
21443
21749
|
hookType: type,
|
|
21444
21750
|
command: config.command
|
|
21445
21751
|
});
|
|
@@ -21460,7 +21766,7 @@ var HookManager = class {
|
|
|
21460
21766
|
]);
|
|
21461
21767
|
if (result !== null && result !== void 0) return result;
|
|
21462
21768
|
} catch (err) {
|
|
21463
|
-
this.log("warn", `[HookManager] ${type} (${reg.plugin}) \u5931\u8D25: ${
|
|
21769
|
+
this.log("warn", `[HookManager] ${type} (${reg.plugin}) \u5931\u8D25: ${describe11(err)}`, {
|
|
21464
21770
|
hookType: type,
|
|
21465
21771
|
plugin: reg.plugin
|
|
21466
21772
|
});
|
|
@@ -21481,7 +21787,7 @@ var HookManager = class {
|
|
|
21481
21787
|
]);
|
|
21482
21788
|
if (result) results.push(result);
|
|
21483
21789
|
} catch (err) {
|
|
21484
|
-
this.log("warn", `[HookManager] ${type} (${reg.plugin}) \u5931\u8D25: ${
|
|
21790
|
+
this.log("warn", `[HookManager] ${type} (${reg.plugin}) \u5931\u8D25: ${describe11(err)}`, {
|
|
21485
21791
|
hookType: type,
|
|
21486
21792
|
plugin: reg.plugin
|
|
21487
21793
|
});
|
|
@@ -21498,7 +21804,7 @@ var HookManager = class {
|
|
|
21498
21804
|
const verdict = verdictOf2(result);
|
|
21499
21805
|
if (verdict) results.push(verdict);
|
|
21500
21806
|
} catch (err) {
|
|
21501
|
-
this.log("warn", `[HookManager] ${type} \u7684 command hook \u6267\u884C\u5F02\u5E38: ${
|
|
21807
|
+
this.log("warn", `[HookManager] ${type} \u7684 command hook \u6267\u884C\u5F02\u5E38: ${describe11(err)}`, {
|
|
21502
21808
|
hookType: type,
|
|
21503
21809
|
command: config.command
|
|
21504
21810
|
});
|
|
@@ -21514,7 +21820,7 @@ var HookManager = class {
|
|
|
21514
21820
|
return [...list].sort((a, b) => a.priority - b.priority);
|
|
21515
21821
|
}
|
|
21516
21822
|
};
|
|
21517
|
-
function
|
|
21823
|
+
function describe11(err) {
|
|
21518
21824
|
return err instanceof Error ? err.message : String(err);
|
|
21519
21825
|
}
|
|
21520
21826
|
function verdictOf2(result) {
|
|
@@ -22803,7 +23109,10 @@ async function importSkills(source, opts) {
|
|
|
22803
23109
|
detail: t("skill.import_stale", void 0, opts.lang)
|
|
22804
23110
|
};
|
|
22805
23111
|
}
|
|
22806
|
-
return {
|
|
23112
|
+
return {
|
|
23113
|
+
ok: true,
|
|
23114
|
+
...commit3(preview3, staged, opts.skillsDir, opts.lang, opts.replace === true)
|
|
23115
|
+
};
|
|
22807
23116
|
});
|
|
22808
23117
|
}
|
|
22809
23118
|
async function withStaged(source, opts, fn) {
|
|
@@ -22837,7 +23146,7 @@ async function withStaged(source, opts, fn) {
|
|
|
22837
23146
|
shape = existsSync(join(unpacked, SKILL_FILE)) ? "skill-dir" : "tree";
|
|
22838
23147
|
}
|
|
22839
23148
|
const staged = stageImport(root, staging, shape, opts.lang);
|
|
22840
|
-
const preview3 =
|
|
23149
|
+
const preview3 = describe12(source, form, staged.skills, staged.issues, opts.existing, opts.lang);
|
|
22841
23150
|
if (preview3.skills.length === 0) {
|
|
22842
23151
|
const detail = t("skill.import_empty", { path: source }, opts.lang);
|
|
22843
23152
|
return { ok: false, reason: "empty", detail, issues: preview3.issues };
|
|
@@ -22848,7 +23157,7 @@ async function withStaged(source, opts, fn) {
|
|
|
22848
23157
|
rmSync(unpacked, { recursive: true, force: true });
|
|
22849
23158
|
}
|
|
22850
23159
|
}
|
|
22851
|
-
function
|
|
23160
|
+
function describe12(source, form, staged, issues, existing, lang) {
|
|
22852
23161
|
const byName = new Map(existing.map((s) => [s.name, s.scope]));
|
|
22853
23162
|
const entries2 = [];
|
|
22854
23163
|
const taken = /* @__PURE__ */ new Set();
|
|
@@ -22890,6 +23199,35 @@ function renameStaged(skill, name) {
|
|
|
22890
23199
|
skill.name = name;
|
|
22891
23200
|
skill.dir = next;
|
|
22892
23201
|
}
|
|
23202
|
+
function findUserSkillDir(skillsDir, name) {
|
|
23203
|
+
if (!existsSync(skillsDir)) return void 0;
|
|
23204
|
+
for (const category of readdirSync(skillsDir, { withFileTypes: true })) {
|
|
23205
|
+
if (!category.isDirectory() || category.name.startsWith(".")) continue;
|
|
23206
|
+
const dir = join(skillsDir, category.name, name);
|
|
23207
|
+
if (existsSync(join(dir, SKILL_FILE))) return dir;
|
|
23208
|
+
}
|
|
23209
|
+
return void 0;
|
|
23210
|
+
}
|
|
23211
|
+
function swapInto(from, old, dest, skillsDir) {
|
|
23212
|
+
const trash = join(skillsDir, `.trash-${randomUUID()}`);
|
|
23213
|
+
try {
|
|
23214
|
+
mkdirSync(trash, { recursive: true });
|
|
23215
|
+
renameSync(old, join(trash, "old"));
|
|
23216
|
+
} catch (err) {
|
|
23217
|
+
rmSync(trash, { recursive: true, force: true });
|
|
23218
|
+
return err instanceof Error ? err.message : String(err);
|
|
23219
|
+
}
|
|
23220
|
+
try {
|
|
23221
|
+
mkdirSync(dirname(dest), { recursive: true });
|
|
23222
|
+
renameSync(from, dest);
|
|
23223
|
+
} catch (err) {
|
|
23224
|
+
renameSync(join(trash, "old"), old);
|
|
23225
|
+
rmSync(trash, { recursive: true, force: true });
|
|
23226
|
+
return err instanceof Error ? err.message : String(err);
|
|
23227
|
+
}
|
|
23228
|
+
rmSync(trash, { recursive: true, force: true });
|
|
23229
|
+
return null;
|
|
23230
|
+
}
|
|
22893
23231
|
function conflictOf(name, existing) {
|
|
22894
23232
|
const scope = existing.get(name);
|
|
22895
23233
|
if (scope === void 0) return {};
|
|
@@ -22922,12 +23260,26 @@ function digest(entries2, staged) {
|
|
|
22922
23260
|
}
|
|
22923
23261
|
return hash.digest("hex").slice(0, 32);
|
|
22924
23262
|
}
|
|
22925
|
-
function commit3(preview3, staged, skillsDir, lang) {
|
|
23263
|
+
function commit3(preview3, staged, skillsDir, lang, replace = false) {
|
|
22926
23264
|
const byName = new Map(staged.map((s) => [s.name, s.dir]));
|
|
22927
23265
|
const imported = [];
|
|
22928
23266
|
const skipped = [];
|
|
22929
23267
|
for (const entry of preview3.skills) {
|
|
22930
23268
|
const label = `${entry.category}/${entry.name}`;
|
|
23269
|
+
if (replace && entry.conflict?.scope === "user") {
|
|
23270
|
+
const from2 = byName.get(entry.name);
|
|
23271
|
+
const old = findUserSkillDir(skillsDir, entry.name);
|
|
23272
|
+
if (from2 !== void 0 && old !== void 0) {
|
|
23273
|
+
const swapped = swapInto(from2, old, join(skillsDir, entry.category, entry.name), skillsDir);
|
|
23274
|
+
if (swapped === null) imported.push(entry.name);
|
|
23275
|
+
else
|
|
23276
|
+
skipped.push({
|
|
23277
|
+
path: label,
|
|
23278
|
+
message: t("skill.import_write_failed", { reason: swapped }, lang)
|
|
23279
|
+
});
|
|
23280
|
+
continue;
|
|
23281
|
+
}
|
|
23282
|
+
}
|
|
22931
23283
|
if (entry.conflict?.verdict === "refuse") {
|
|
22932
23284
|
skipped.push({
|
|
22933
23285
|
path: label,
|
|
@@ -23700,7 +24052,7 @@ ${extra}` : withGoal;
|
|
|
23700
24052
|
var FILE_VERSION5 = 1;
|
|
23701
24053
|
var LEVELS = ["trusted", "untrusted"];
|
|
23702
24054
|
var SCOPES = ["directory", "directory-tree"];
|
|
23703
|
-
function
|
|
24055
|
+
function describe13(err) {
|
|
23704
24056
|
return err instanceof Error ? err.message : String(err);
|
|
23705
24057
|
}
|
|
23706
24058
|
function covers(base, target, scope) {
|
|
@@ -23774,7 +24126,7 @@ var TrustManager = class {
|
|
|
23774
24126
|
raw = readFileSync(this.filePath, "utf-8");
|
|
23775
24127
|
} catch (err) {
|
|
23776
24128
|
this.loadErrors.push(
|
|
23777
|
-
t("trust_gate.record_read_failed", { path: this.filePath, reason:
|
|
24129
|
+
t("trust_gate.record_read_failed", { path: this.filePath, reason: describe13(err) })
|
|
23778
24130
|
);
|
|
23779
24131
|
return;
|
|
23780
24132
|
}
|
|
@@ -23783,7 +24135,7 @@ var TrustManager = class {
|
|
|
23783
24135
|
parsed = JSON.parse(raw);
|
|
23784
24136
|
} catch (err) {
|
|
23785
24137
|
this.loadErrors.push(
|
|
23786
|
-
t("trust_gate.record_bad_json", { path: this.filePath, reason:
|
|
24138
|
+
t("trust_gate.record_bad_json", { path: this.filePath, reason: describe13(err) })
|
|
23787
24139
|
);
|
|
23788
24140
|
return;
|
|
23789
24141
|
}
|
|
@@ -23832,7 +24184,7 @@ var TrustManager = class {
|
|
|
23832
24184
|
} catch (err) {
|
|
23833
24185
|
rmSync(tmp, { force: true });
|
|
23834
24186
|
throw new Error(
|
|
23835
|
-
t("trust_gate.record_write_failed", { path: this.filePath, reason:
|
|
24187
|
+
t("trust_gate.record_write_failed", { path: this.filePath, reason: describe13(err) })
|
|
23836
24188
|
);
|
|
23837
24189
|
}
|
|
23838
24190
|
}
|
|
@@ -24221,4 +24573,4 @@ function trunc(stdout, stderr) {
|
|
|
24221
24573
|
* `--tree` 的命令帮助里,让用户自己知道 `--tree` 意味着什么。
|
|
24222
24574
|
*/
|
|
24223
24575
|
|
|
24224
|
-
export { AGENT_ROLE_DIAG_MODULE, ARTIFACT_MAX_TOTAL_BYTES, ARTIFACT_RETENTION_DEFAULTS, ATTACHMENT_MAX_TOTAL_BYTES, ATTACHMENT_RETENTION_DEFAULTS, AgentLoop, AppearanceStore, 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, 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, approvalEntryFor, approvalRootFor, artifactLaunchArgv, artifactOpenRefusal, assertLevelAllowed, blockedRoleTools, buildContextBreakdown, buildFireArgv, buildFtsMatchQuery, buildSchemaExports, buildSystemPrompt, buildTrigramMatchQuery, builtinRoles, checkEpochVersion, checkFtsHealth, checkShadowing, classifyPersistFailure, 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, displayAllows, displayCurrency, draftCommandLine, draftWidening, escapeRuleContent, estimateImageTokens, estimateRunTokens, estimateTokens, evaluateSelection, expandCommand, expandImports, explainSetting, extractArchive, findInstructionFiles, findProjectInstructions, findRole, formatBytes, formatSkillIndex, formatUsd, gateForTool, getCapability, getConfigIssues, getConfigOrigins, getImportGate, getTrustGate, grantedPathsFor, hasDedicatedExecContent, hasExecTierContent, hasPromptCaching, hasProviderCredentials, hasReadTierContent, imageFromBase64, imageFromPath, imagePartTokens, importParts, importSkills, installPlugin, instructionDirs, instructionNotices, intervalSlots, inventoryProjectExtensions, inventoryTotal, isBlockCode, isCodeModeDeferred, isEmptyRules, isGoalPhase, isNonInteractive, isReadOnlySubCall, isSettingWriteLayer, isTransientPersistFailure, 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, persistFailureCode, 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 };
|
|
24576
|
+
export { ABOUT_DESC_MAX_CHARS, ABOUT_README_MAX_CHARS, AGENT_ROLE_DIAG_MODULE, ARTIFACT_MAX_TOTAL_BYTES, ARTIFACT_RETENTION_DEFAULTS, ATTACHMENT_MAX_TOTAL_BYTES, ATTACHMENT_RETENTION_DEFAULTS, AgentLoop, AppearanceStore, 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, 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_ASSET_DIRS, SKILL_CREATE_TOOL, SKILL_EDIT_TOOL, SKILL_FILE, 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, approvalEntryFor, approvalRootFor, artifactLaunchArgv, artifactOpenRefusal, assertLevelAllowed, blockedRoleTools, buildContextBreakdown, buildFireArgv, buildFtsMatchQuery, buildSchemaExports, buildSystemPrompt, buildTrigramMatchQuery, builtinRoles, checkEpochVersion, checkFtsHealth, checkShadowing, classifyPersistFailure, 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, displayAllows, displayCurrency, draftCommandLine, draftWidening, escapeRuleContent, estimateImageTokens, estimateRunTokens, estimateTokens, evaluateSelection, expandCommand, expandImports, explainSetting, extractArchive, findInstructionFiles, findProjectInstructions, findRole, formatBytes, formatSkillIndex, formatUsd, gateForTool, getCapability, getConfigIssues, getConfigOrigins, getImportGate, getTrustGate, grantedPathsFor, hasDedicatedExecContent, hasExecTierContent, hasPromptCaching, hasProviderCredentials, hasReadTierContent, imageFromBase64, imageFromPath, imagePartTokens, importParts, importSkills, installPlugin, instructionDirs, instructionNotices, intervalSlots, inventoryProjectExtensions, inventoryTotal, isBlockCode, isCodeModeDeferred, isEmptyRules, isGoalPhase, isNonInteractive, isReadOnlySubCall, isSettingWriteLayer, isTransientPersistFailure, 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, persistFailureCode, persistParts, persistToolResults, persistedUsage, planPack, previewSkillImport, pricingFor, projectEntryForDisplay, pruneArtifacts, pruneAttachments, pruneRecordings, pruneSchedules, readImageSize, readMarketplaces, readPluginAbout, 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.27.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.27.0",
|
|
31
|
+
"@epoch-agent/protocol": "0.27.0"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@ai-sdk/alibaba": "^2.0.59",
|