@epoch-agent/core 0.22.0 → 0.25.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 +171 -16
- package/dist/index.js +140 -57
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ToolProvider, EpochTool, EpochPlugin, ToolExposure, EpochSkill, HookType, EpochHook, PluginContext, QuestionRequest, QuestionAnswer, ComplianceCategory, ComplianceAction, ToolArtifactInput, ToolArtifact, TrustLevel, TrustManager as TrustManager$1, TokenUsage, EpochConfig, BudgetBreach, NoticeCode, ProviderType, EpochMessage, JsonSchema, ModelSelection, BackgroundTaskInfo, EpochToolCall, Telemetry, HookManager as HookManager$1, Lang, PermissionManager as PermissionManager$1, ApprovalRequest, ApprovalReply, AgentRoleScope, AgentRoleSource, EpochUserContent, EpochContentPart, AgentRole, PermissionLevel, PlanProposal, ScheduleDefinition, DiagnosticSink, CustomCommandDef, ModelRef, ExpandedCommand, CustomCommandSource, ContextBreakdown, WireMcpConnector, AgentEvent, SelectionContext, SetSelectionResult, MoneyDigits, CurrencyDisplay, PermissionRuleLists, KeybindingTable, Diagnostic, KeybindingReport, FileOmitReason, SessionOmitReason, EpochToolResult, EpochTurnFacts, LocalizedDetail, OperationType, RuleValue, Operation, ApprovalOutcome, PermissionDecision, ScheduleTrigger, ScheduleAllowlist, ScheduleBackendKind, ScheduleRunStatus, ScheduleRun, SchedulePendingApproval, ScheduleDraft, ScheduleWideningKind, WireAgentEvent, WireAgentEnvelope, ScheduleRunnerSpec, HookEvent, LogFn, HookRegistration, HookHandler, HookContext, VerifyResult, EpochFilePart, EpochSessionPart, MentionSet, EpochImagePart, TrustExecGrant, DecidedTrustLevel, TrustScope, TrustGrant, TrustRecord } from '@epoch-agent/protocol';
|
|
2
|
-
export { API_KEY_ENV_VARS, AgentEvent, AgentEventOf, AgentEventType, ApprovalAnswer, ApprovalOutcome, ApprovalReply, ApprovalRequest, BudgetBreach, COMPLIANCE_ACTIONS, COMPLIANCE_CATEGORIES, ComplianceAction, ComplianceCategory, DecidedTrustLevel, EpochConfig, EpochHook, EpochPlugin, EpochSkill, EpochTool, FinishReason, HookContext, HookEvent, HookHandler, HookRegistration, HookType, HookManager as IHookManager, PermissionManager as IPermissionManager, TrustManager as ITrustManager, JsonSchema, MAX_ATTACH_BYTES, MAX_ATTACH_FILES, MAX_ATTACH_TOTAL_BYTES, MAX_SESSION_ATTACH_BYTES, MAX_SESSION_REFS, OPERATION_TYPES, Operation, OperationType, PERMISSION_LEVELS, PLAN_OUTCOMES, PROVIDER_INFOS, PROVIDER_TYPES, PermissionDecision, PermissionLevel, PlanApprovalOutcome, PlanProposal, PluginContext, ProviderInfo, ProviderType, TokenUsage, ToolContext, ToolDefinition, ToolExposure, ToolResult, TrustExecGrant, TrustGrant, TrustLevel, TrustRecord, TrustScope, TrustTier, VerifyResult, apiKeyEnvVar, extractAllMentions, extractMentions, extractSessionMentions, getProviderInfo, isOperationType, isPermissionLevel, isPlanOutcome, isProviderType, normalizeApproval } from '@epoch-agent/protocol';
|
|
1
|
+
import { ToolProvider, EpochTool, EpochPlugin, ToolExposure, EpochSkill, HookType, EpochHook, PluginContext, QuestionRequest, QuestionAnswer, ComplianceCategory, ComplianceAction, ToolArtifactInput, ToolArtifact, TrustLevel, TrustManager as TrustManager$1, TokenUsage, EpochConfig, BudgetBreach, NoticeCode, ProviderType, EpochMessage, JsonSchema, ModelSelection, BackgroundTaskInfo, EpochToolCall, Telemetry, HookManager as HookManager$1, Lang, PermissionManager as PermissionManager$1, ApprovalRequest, ApprovalReply, AgentRoleScope, AgentRoleSource, EpochUserContent, EpochContentPart, AgentRole, PermissionLevel, PlanProposal, ScheduleDefinition, DiagnosticSink, CustomCommandDef, ModelRef, ExpandedCommand, CustomCommandSource, ContextBreakdown, WireMcpConnector, AgentEvent, SelectionContext, SetSelectionResult, MoneyDigits, CurrencyDisplay, PermissionRuleLists, KeybindingTable, Diagnostic, KeybindingReport, FileOmitReason, SessionOmitReason, EpochToolResult, EpochTurnFacts, LocalizedDetail, ApprovalScope, OperationType, RuleValue, Operation, ApprovalOutcome, PermissionDecision, ScheduleTrigger, ScheduleAllowlist, ScheduleBackendKind, ScheduleRunStatus, ScheduleRun, SchedulePendingApproval, ScheduleDraft, ScheduleWideningKind, WireAgentEvent, WireAgentEnvelope, ScheduleRunnerSpec, HookEvent, LogFn, HookRegistration, HookHandler, HookContext, VerifyResult, EpochFilePart, EpochSessionPart, MentionSet, EpochImagePart, TrustExecGrant, DecidedTrustLevel, TrustScope, TrustGrant, TrustRecord } from '@epoch-agent/protocol';
|
|
2
|
+
export { API_KEY_ENV_VARS, AgentEvent, AgentEventOf, AgentEventType, ApprovalAnswer, ApprovalOutcome, ApprovalReply, ApprovalRequest, ApprovalScope, BudgetBreach, COMPLIANCE_ACTIONS, COMPLIANCE_CATEGORIES, ComplianceAction, ComplianceCategory, DecidedTrustLevel, EpochConfig, EpochHook, EpochPlugin, EpochSkill, EpochTool, FinishReason, HookContext, HookEvent, HookHandler, HookRegistration, HookType, HookManager as IHookManager, PermissionManager as IPermissionManager, TrustManager as ITrustManager, JsonSchema, MAX_ATTACH_BYTES, MAX_ATTACH_FILES, MAX_ATTACH_TOTAL_BYTES, MAX_SESSION_ATTACH_BYTES, MAX_SESSION_REFS, OPERATION_TYPES, Operation, OperationType, PERMISSION_LEVELS, PLAN_OUTCOMES, PROVIDER_INFOS, PROVIDER_TYPES, PermissionDecision, PermissionLevel, PlanApprovalOutcome, PlanProposal, PluginContext, ProviderInfo, ProviderType, TokenUsage, ToolContext, ToolDefinition, ToolExposure, ToolResult, TrustExecGrant, TrustGrant, TrustLevel, TrustRecord, TrustScope, TrustTier, VerifyResult, apiKeyEnvVar, extractAllMentions, extractMentions, extractSessionMentions, getProviderInfo, isOperationType, isPermissionLevel, isPlanOutcome, isProviderType, normalizeApproval } from '@epoch-agent/protocol';
|
|
3
3
|
import { IsolationBackend, SqliteDatabase, ParseIssue, ShellFlavor } from '@epoch-agent/infra';
|
|
4
4
|
export { BubblewrapOptions, DangerMatch, IS_WINDOWS, IsolationBackend, IsolationOptions, LogLevel, SeatbeltOptions, WINDOWS_HIDE_FLAGS, buildBwrapArgs, buildProfile, checkDangerousCommand, checkObfuscation, createLogger, detectBackend, getDefaultShell, getPythonCommand, isInWorkspace, isReadOnlyCommand, isolate, maskApiKey, probeBubblewrap, probeSeatbelt, complianceDir as resolveComplianceDir, policiesDir as resolvePoliciesDir, setLogLevel } from '@epoch-agent/infra';
|
|
5
5
|
import { z } from 'zod';
|
|
@@ -3020,6 +3020,22 @@ interface AgentConfig {
|
|
|
3020
3020
|
*/
|
|
3021
3021
|
role?: () => {
|
|
3022
3022
|
name: string;
|
|
3023
|
+
/**
|
|
3024
|
+
* 给人看的称呼(`AgentRole.displayName`,2026-10-08)。**缺省回落
|
|
3025
|
+
* `name`**(判据在 protocol 的 `AgentRole.displayName` 上)。
|
|
3026
|
+
*
|
|
3027
|
+
* 消费点只有两个,都在这一格的叙述半径内:身份行那一句
|
|
3028
|
+
* (`message-utils.ts` 的 `identityLine()`)和 `run-start` 那枚徽标。
|
|
3029
|
+
*
|
|
3030
|
+
* ⚠️ **同下面 `source`:纯展示,引擎一处都不许据此分叉。** 它当不了
|
|
3031
|
+
* 标识 —— `delegate_task` 的取值、同名合并的 key、`--agent` 的取值
|
|
3032
|
+
* 用的全是 `name`,这一格换了它们一个都不动。
|
|
3033
|
+
*
|
|
3034
|
+
* 拿不到就不给(没写过 `displayName` 的角色)。**别在这一层拿 `name`
|
|
3035
|
+
* 兜底**:填一个等于 `name` 的值会让「他有没有自己的称呼」这件事在
|
|
3036
|
+
* 这一格上消失,而 `run-start` 那边的投影正是按有没有来分叉的。
|
|
3037
|
+
*/
|
|
3038
|
+
displayName?: string;
|
|
3023
3039
|
prompt?: string;
|
|
3024
3040
|
/**
|
|
3025
3041
|
* 这一份角色是谁在扮演。**缺省 `'delegate'`** —— 那是这个字段出现之前
|
|
@@ -5907,6 +5923,7 @@ declare function createTodoTool(db: TrackerDB): EpochTool;
|
|
|
5907
5923
|
* ```markdown
|
|
5908
5924
|
* ---
|
|
5909
5925
|
* name: explore
|
|
5926
|
+
* displayName: 检索
|
|
5910
5927
|
* description: 只读检索。找文件、找符号、回答"X 在哪实现的"
|
|
5911
5928
|
* tools: [file_read, file_multi_read, file_list, file_search]
|
|
5912
5929
|
* maxTurns: 8
|
|
@@ -5971,6 +5988,7 @@ declare const AGENT_ROLE_DIAG_MODULE = "AgentRole";
|
|
|
5971
5988
|
*/
|
|
5972
5989
|
declare const ROLE_FRONTMATTER_SCHEMA: z.ZodObject<{
|
|
5973
5990
|
name: z.ZodOptional<z.ZodString>;
|
|
5991
|
+
displayName: z.ZodOptional<z.ZodString>;
|
|
5974
5992
|
description: z.ZodString;
|
|
5975
5993
|
tools: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
5976
5994
|
skills: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
@@ -6103,8 +6121,15 @@ interface RoleMergeResult {
|
|
|
6103
6121
|
* 就换个名字(换了名字也仍然受 `roleScopedProvider` 的父可用集约束,
|
|
6104
6122
|
* 所以这不是一个绕过口子,只是让「叫 explore 的东西一定只读」成立)。
|
|
6105
6123
|
*
|
|
6106
|
-
* `prompt` / `description` / `maxTurns` 允许整体替换 ——
|
|
6107
|
-
*
|
|
6124
|
+
* `prompt` / `description` / `maxTurns` / `displayName` 允许整体替换 —— 它们是文案、
|
|
6125
|
+
* 预算和称呼,不是边界。
|
|
6126
|
+
*
|
|
6127
|
+
* ⚠️ **`displayName` 不写就沿用被覆盖的那一份**(下面 `...existing` 那个展开)。
|
|
6128
|
+
* 内置三个现在都带展示名,所以一份只改了 prompt 的 `explore.md` 在屏幕上仍然是
|
|
6129
|
+
* 「检索」。这是**刻意**的,和 `description` 一条口径:同名就是同一个角色,
|
|
6130
|
+
* 覆盖方只改它关心的那几格,其余的跟着原样;要换称呼就自己写一行 `displayName:`。
|
|
6131
|
+
* (反过来的代价是:一个项目级 `explore` 如果完全是另一回事,屏幕上仍然叫
|
|
6132
|
+
* 「检索」—— 那种情况正确动作是换个名字,不是靠展示名区分。)
|
|
6108
6133
|
*
|
|
6109
6134
|
* @param overrides 外部定义,按优先级**从低到高**排列(user 在前,project 在后)
|
|
6110
6135
|
*/
|
|
@@ -6183,18 +6208,34 @@ declare function roleSourceLabel(source: AgentRoleSource): string;
|
|
|
6183
6208
|
*/
|
|
6184
6209
|
|
|
6185
6210
|
/**
|
|
6186
|
-
*
|
|
6187
|
-
* `tools` / `skills` / `maxTurns`
|
|
6211
|
+
* 要建的那一份。**和 frontmatter 逐格对上,一格不多**(`name` / `description` /
|
|
6212
|
+
* `displayName` / `tools` / `skills` / `maxTurns` 六个键 + 正文就是 `prompt`)。
|
|
6188
6213
|
*
|
|
6189
6214
|
* > ⚠️ **`skills` 是 2026-08-27 补的,而补它的那一轮同时补了界面上那一格。**
|
|
6190
6215
|
* > 2026-08-26 加 `AgentRole.skills` 时这里刻意没加,理由逐字是「加了就是一个
|
|
6191
6216
|
* > 界面写得出、引擎读得到、但**没有一张表单会填它**的字段」——
|
|
6192
|
-
* >
|
|
6217
|
+
* > 那条理由现在被满足了,不是被推翻了。往这里加一格的人照旧受它约束:
|
|
6193
6218
|
* > 要么连写口一路加到界面,要么别加。
|
|
6219
|
+
* >
|
|
6220
|
+
* > 📮 **2026-10-08 的 `displayName` 是照那条规矩加的第三例**:读口、
|
|
6221
|
+
* > 这一份、wire 请求体、`role-add.tsx` 那张表单、两条 catalog 文案,同一天一起落。
|
|
6222
|
+
* > 「六个键」这个数是那天起的,**别拿它当门禁** —— 真源是
|
|
6223
|
+
* > `ROLE_FRONTMATTER_SCHEMA` 的 `shape`。
|
|
6194
6224
|
*/
|
|
6195
6225
|
interface RoleCreateInput {
|
|
6196
6226
|
/** slug,`[a-z0-9-]`。同时是文件名(`<name>.md`)和 `delegate_task` 的 `role` 取值 */
|
|
6197
6227
|
name: string;
|
|
6228
|
+
/**
|
|
6229
|
+
* 给人看的称呼(2026-10-08)。**不给 = 回落 `name`**。
|
|
6230
|
+
*
|
|
6231
|
+
* ⚠️ 它**不参与任何标识语义**:不改文件名、不进 `delegate_task` 的取值、
|
|
6232
|
+
* 不参与同名合并。判据和分工在 protocol 的 `AgentRole.displayName` 上。
|
|
6233
|
+
*
|
|
6234
|
+
* 空串 / 全空白 = 没写这一格(整个不发)—— 判据同下面 `tools` 那一格:
|
|
6235
|
+
* 写一个空串进去是替他做了一个他没做过的表态,而读口那边 `min(1)` 会**整份
|
|
6236
|
+
* 拒掉这个角色**,两份口径在这儿劈叉的表现是「建好了但列表里没有它」。
|
|
6237
|
+
*/
|
|
6238
|
+
displayName?: string;
|
|
6198
6239
|
/** 给**主 agent** 看的「什么时候该派给我」。缺了它读口会整份跳过这个角色 */
|
|
6199
6240
|
description: string;
|
|
6200
6241
|
/** 角色段正文。空着 = 这份 md 只有 frontmatter,那是合法的一档 */
|
|
@@ -8094,6 +8135,15 @@ interface InstallDependency {
|
|
|
8094
8135
|
source?: string;
|
|
8095
8136
|
/** `unresolved` 的原因,给人看 */
|
|
8096
8137
|
reason?: string;
|
|
8138
|
+
/**
|
|
8139
|
+
* 给人看的名字(清单里的 `displayName`)。
|
|
8140
|
+
*
|
|
8141
|
+
* ⚠️ **两档有、一档没有**:`plan` 从刚取回来的那份清单里拿,`installed` 从那个
|
|
8142
|
+
* 已装目录现读一份;`unresolved` 那个包压根没取到,所以那一档没有。
|
|
8143
|
+
* ⚠️ 它是**可选**的(`ManifestSchema.displayName` 本来就可选),所以界面得分开
|
|
8144
|
+
* 「没有」和「有」—— 拿标识串顶上去假装有,用户看到的是「b-kit(b-kit)」。
|
|
8145
|
+
*/
|
|
8146
|
+
displayName?: string;
|
|
8097
8147
|
/** `plan` 专有:这个包自己的清单 */
|
|
8098
8148
|
manifest?: PluginManifest;
|
|
8099
8149
|
/** `plan` 专有:它会带来什么(那一屏照根那一份的画法画) */
|
|
@@ -9224,6 +9274,7 @@ interface SystemPromptParams {
|
|
|
9224
9274
|
date: string;
|
|
9225
9275
|
role?: {
|
|
9226
9276
|
name: string;
|
|
9277
|
+
displayName?: string;
|
|
9227
9278
|
prompt?: string;
|
|
9228
9279
|
scope?: AgentRoleScope;
|
|
9229
9280
|
};
|
|
@@ -14292,6 +14343,15 @@ declare class SessionManager implements SessionManager$1 {
|
|
|
14292
14343
|
private generateId;
|
|
14293
14344
|
create(input?: CreateSessionInput): Session;
|
|
14294
14345
|
get(id: string): Session | undefined;
|
|
14346
|
+
/**
|
|
14347
|
+
* 只要元信息时走这里,**不读消息**。
|
|
14348
|
+
*
|
|
14349
|
+
* `get()` 会把整段消息 `SELECT *` 出来再组装:553 条消息的会话一次约 8ms。
|
|
14350
|
+
* 2026-10-09 实测 server 每个流式帧都经 `readTitle` 调一次它,一轮回复
|
|
14351
|
+
* 几百帧,桌面端主线程被连续占满好几秒。meta 只来自 sessions 那一行,
|
|
14352
|
+
* 和 `get().meta` 是同一份。
|
|
14353
|
+
*/
|
|
14354
|
+
getMeta(id: string): SessionMeta | undefined;
|
|
14295
14355
|
/** 判据全文在 {@link SessionDB.hasSession} 上 */
|
|
14296
14356
|
has(id: string): boolean;
|
|
14297
14357
|
/**
|
|
@@ -15239,12 +15299,7 @@ type ApprovalDecision = 'deny' | 'allow-once' | 'allow-always' | 'allow-session'
|
|
|
15239
15299
|
* 变的只有「**存下来之后**那一格可能是什么」。
|
|
15240
15300
|
*/
|
|
15241
15301
|
type CachedDecision = Exclude<ApprovalDecision, 'allow-once'>;
|
|
15242
|
-
|
|
15243
|
-
type ApprovalScope =
|
|
15244
|
-
/** 只对这一个目标生效(默认) */
|
|
15245
|
-
'exact'
|
|
15246
|
-
/** 对该目录及其子树生效——只有用户明确选择时才用 */
|
|
15247
|
-
| 'prefix';
|
|
15302
|
+
|
|
15248
15303
|
/** 单条审批缓存储存 */
|
|
15249
15304
|
interface CachedApproval {
|
|
15250
15305
|
id: string;
|
|
@@ -15479,9 +15534,15 @@ declare const MAX_AUDIT_ENTRIES = 500;
|
|
|
15479
15534
|
* | ------------- | -------------------------------------------------- |
|
|
15480
15535
|
* | `bypass` | 全放行 —— 但**挡不住第 1 层那两条 deny**,那层在前面 |
|
|
15481
15536
|
* | `auto` | 信任 agent:这一档自己不拦,边界全在第 1 层 |
|
|
15482
|
-
* | `plan` | 只读:写入 / 命令 / 网络 /
|
|
15537
|
+
* | `plan` | 只读:写入 / 命令 / 网络 / 执行代码一律拒;区外**读**要问 |
|
|
15483
15538
|
* | `acceptEdits` | 同 `auto`,但**工作区外的文件**要确认 |
|
|
15484
|
-
* | `default` |
|
|
15539
|
+
* | `default` | 只读操作免确认(**工作区外的读除外**),其余一律确认 |
|
|
15540
|
+
*
|
|
15541
|
+
* ⚠️ **「工作区外」那一格是 `plan` / `default` / `acceptEdits` 三档共用的**
|
|
15542
|
+
* (2026-10-08):`auto` / `bypass` 放行,其余三档问一句,判据在
|
|
15543
|
+
* {@link outsideWorkspace} 上。**档位管的是「问了之后算不算数」,不是「要不要问」**
|
|
15544
|
+
* —— 而「算不算数」由权限层算出来的 `grantedPaths` 兑现,工具层照它放行
|
|
15545
|
+
* (判据在 protocol 的 `ToolContext.grantedPaths` 上)。
|
|
15485
15546
|
*
|
|
15486
15547
|
* ⚠️ 这一层**只负责「没有规则命中时怎么办」**。它给出的 allow 不是最终答案 ——
|
|
15487
15548
|
* 回到 `check()` 之后还要过第 3 层 headless 预授权。
|
|
@@ -16114,6 +16175,100 @@ declare class PermissionManager implements PermissionManager$1 {
|
|
|
16114
16175
|
type OperationSource = Pick<EpochTool, 'name'> & Partial<Pick<EpochTool, 'operation' | 'annotations'>>;
|
|
16115
16176
|
declare function mapOperationType(toolName: string): OperationType;
|
|
16116
16177
|
|
|
16178
|
+
/**
|
|
16179
|
+
* 「这一次放行了工作区外的哪些路径」—— 权限层给工具层的那**唯一一个答案**
|
|
16180
|
+
* (2026-10-08)。
|
|
16181
|
+
*
|
|
16182
|
+
* ## 它要解决的是哪一件事
|
|
16183
|
+
*
|
|
16184
|
+
* 边界这回事在 2026-10-08 之前有三处各说各话:
|
|
16185
|
+
*
|
|
16186
|
+
* - 权限层按档位判「要不要问」(`by-level.ts`);
|
|
16187
|
+
* - 工具层(`plugin-file` / `plugin-terminal`)自己判「越界就拒」;
|
|
16188
|
+
* - 两者**互相看不见**,于是 `acceptEdits` 下用户点了「允许」,工具层照旧
|
|
16189
|
+
* 抛 `PathEscapeError` —— 那次批准批的是权限层,管不到工具层那道闸。
|
|
16190
|
+
*
|
|
16191
|
+
* 治法不是让工具层也去读档位(那是第二张档位表,分叉了同样没人抓得到),
|
|
16192
|
+
* 而是**权限层把结论算出来交下去**:这个函数算出「这次操作涉及、且在工作区外
|
|
16193
|
+
* 的路径」,`tool-executor` 把它填进 `ToolContext.grantedPaths`,工具层拿它当
|
|
16194
|
+
* 额外的根用(判据在 protocol 的 `ToolContext.grantedPaths` 上)。
|
|
16195
|
+
*
|
|
16196
|
+
* ## ⚠️ 它是纯计算,但**不是纯函数** —— 它读文件系统
|
|
16197
|
+
*
|
|
16198
|
+
* {@link approvalRootFor} 要 `statSync` 一下才知道某个目标是目录还是文件,
|
|
16199
|
+
* 而这一下决定放开的范围差一整层。所以别把它塞进 `by-level.ts`(那个文件的
|
|
16200
|
+
* 文件头写着「纯函数:只看级别 + 这次操作 + 沙箱」,而且它自己已经很长)。
|
|
16201
|
+
*
|
|
16202
|
+
* ## 为什么按「目录」放行,而不是精确到那一个文件
|
|
16203
|
+
*
|
|
16204
|
+
* 2026-10-08 用户拍的:**批准一次 = 打开这个目标所在的那一层**。理由是一次点击
|
|
16205
|
+
* 换来的是「这个目录别再问了」,而精确到文件的话,同一个目录读第二个文件要再点
|
|
16206
|
+
* 一次 —— 那正是弹窗疲劳的成因(`ruleAskActive` 的 JSDoc 里那句「会让用户学会
|
|
16207
|
+
* 闭眼点允许」是同一个判据)。
|
|
16208
|
+
*
|
|
16209
|
+
* 规则的形状**不按工具名写死**,只问一句「这个目标是不是一个已经存在的目录」:
|
|
16210
|
+
*
|
|
16211
|
+
* | 目标 | 放开的根 |
|
|
16212
|
+
* | --------------------------- | --------------- |
|
|
16213
|
+
* | `file_write('/out/a.txt')` | `/out` |
|
|
16214
|
+
* | `file_list('/out')` | `/out`(不是 `/`) |
|
|
16215
|
+
* | `file_read('/out/a/b.txt')` | `/out/a` |
|
|
16216
|
+
*
|
|
16217
|
+
* 按工具名写死(「`file_list` 的目标是目录、`file_write` 的是文件」)会漏掉
|
|
16218
|
+
* `file_read` 读目录里任何一个文件这一族,而漏掉的表现是**静默地少放一格**。
|
|
16219
|
+
*/
|
|
16220
|
+
/**
|
|
16221
|
+
* 这次调用要放行的工作区外路径 —— 已经按「目录」展开过,供
|
|
16222
|
+
* `ToolContext.grantedPaths` 直接使用。
|
|
16223
|
+
*
|
|
16224
|
+
* @param args 工具参数原文。路径从 `affectedPaths()` 抽(`path` / `paths` /
|
|
16225
|
+
* `files` / V4A 补丁头),**和检查点快照用的是同一份抽取** —— 「这次调用会碰
|
|
16226
|
+
* 哪些文件」只该有一个答案,两份分头实现的下场是「快照覆盖到 3 个、
|
|
16227
|
+
* 放行的却是另外 5 个」
|
|
16228
|
+
* @param workDir 主根
|
|
16229
|
+
* @param extraRoots `--add-dir` 的额外根。**它们里的路径不算「工作区外」**,
|
|
16230
|
+
* 所以不进 grantedPaths(进了也不出错,但会让这个字段名不副实)
|
|
16231
|
+
* @returns 去重后的绝对路径列表。**在工作区内、或抽不出路径时是空数组** ——
|
|
16232
|
+
* 空数组和 undefined 在 `ToolContext` 上是两回事(后者 = 宿主没实现这一格)
|
|
16233
|
+
*/
|
|
16234
|
+
declare function grantedPathsFor(args: Record<string, unknown>, workDir: string, extraRoots?: readonly string[]): readonly string[];
|
|
16235
|
+
/**
|
|
16236
|
+
* 放开的根:**目标本身是目录就用它,否则用它的父目录**。
|
|
16237
|
+
*
|
|
16238
|
+
* `statSync` 失败(路径不存在)时按文件处理 —— 那是绝大多数写类调用的形状
|
|
16239
|
+
* (`file_write` 的目标常常还不存在),而把它当目录会放开一个不存在的路径,
|
|
16240
|
+
* 等于什么都没放开,下一次照样弹窗。
|
|
16241
|
+
*/
|
|
16242
|
+
declare function approvalRootFor(target: string, workDir: string): string;
|
|
16243
|
+
/**
|
|
16244
|
+
* 一次批准**该往缓存里记什么** —— 记哪个 target、管多大范围。
|
|
16245
|
+
*
|
|
16246
|
+
* ## ⚠️ 这个函数存在的唯一理由:别的目标不许被「路径化」
|
|
16247
|
+
*
|
|
16248
|
+
* 直觉写法是「用户批准了,就把 `approvalRootFor(opTarget)` 记进去」。它错在
|
|
16249
|
+
* `opTarget` **不一定是路径** —— `terminal` 的 target 是整条命令串,
|
|
16250
|
+
* 猜不出目标的 MCP 工具给的是参数 JSON(`argsKey()` 的产物)。把那些东西喂给
|
|
16251
|
+
* `approvalRootFor`,`toAbsolute` 会把它们当成相对路径 resolve 到主工作目录下,
|
|
16252
|
+
* 于是:
|
|
16253
|
+
*
|
|
16254
|
+
* - `recordApproval` 记下的 target 与下一次 `check()` 查的 target **不是同一个
|
|
16255
|
+
* 值**,那条缓存永远命不中 —— 症状是「同一个问题问不完」,读起来像缓存坏了;
|
|
16256
|
+
* - 更糟的是它顺手产出一条 `scope: 'prefix'`、target 是**整个工作目录**的
|
|
16257
|
+
* 条目 —— 批准一条 `ls` 等于给整个工作区开了一张通行证。
|
|
16258
|
+
*
|
|
16259
|
+
* 2026-10-08 抓到的就是前者(`tool-executor.test.ts` 的「批准过的 target 与下次
|
|
16260
|
+
* 查询的 target 是同一个值」)。后者当时还没发生,但它离前者只差一个
|
|
16261
|
+
* `scope` 参数,所以判据写成一条:**只有真的落在某个放行根里的目标才记成
|
|
16262
|
+
* 目录**,其余一律原样记、`exact`。
|
|
16263
|
+
*
|
|
16264
|
+
* @param opTarget `resolveTarget()` 给的那个值(命令串 / 路径 / 参数 JSON)
|
|
16265
|
+
* @param grantedRoots {@link grantedPathsFor} 这次算出来的放行根
|
|
16266
|
+
*/
|
|
16267
|
+
declare function approvalEntryFor(opTarget: string, workDir: string, grantedRoots: readonly string[]): {
|
|
16268
|
+
target: string;
|
|
16269
|
+
scope: 'exact' | 'prefix';
|
|
16270
|
+
};
|
|
16271
|
+
|
|
16117
16272
|
/**
|
|
16118
16273
|
* 紧凑权限规则的字符串语法 —— `Tool(content)`(方案 22 §2.1)。
|
|
16119
16274
|
*
|
|
@@ -20695,4 +20850,4 @@ declare function resolveCodeModeWorker(baseDir: string, exists?: typeof existsSy
|
|
|
20695
20850
|
*/
|
|
20696
20851
|
declare function codeModeWorkerPath(): string | undefined;
|
|
20697
20852
|
|
|
20698
|
-
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 ApprovalScope, type ArtifactOpenRefusal, type ArtifactRetention, type AskQuestionDeps, type AttachmentRetention, BLOCKED_TOOLS, type BackendOptions, type BackendOutcome, type BackgroundTaskSource, type BaseOrigin, type BaseSlot, type BeginTurnInput, type BreakdownInput, BudgetGuard, type BudgetGuardOptions, type BudgetInfo, type BudgetLevel, type BudgetOptions, type BudgetStatus, BudgetStore, type BudgetStoreOptions, type BuildFireArgvInput, type BuildIndexOptions, CHECKPOINT_MAX_TOTAL_BYTES, CLAUDE_EVENT_NAMES, CLAUDE_TOOL_NAMES, CODE_MODE_LIMITS, CODE_MODE_SDK_TAG, CONFIG_KEYS, CURRENT_CONFIG_VERSION, type CachedApproval, type CachedDecision, type CheckpointCapture, type CheckpointFile, CheckpointManager, type CheckpointManagerOptions, type CheckpointManifest, CheckpointStore, type CheckpointStoreOptions, type CheckpointSummary, type ClaudeHooksParseOptions, type CodeModeLimits, type CodeRequest, type CodeResult, CodeSandbox, type CommandHookConfig, type CommandHookResult, type CommandLoadOutcome, type CommandLoadSummary, type CommandResult, type CommandRunner, type CompactionResult, type CompiledRules, type ComplianceDirSpec, type ComplianceDirsSummary, ComplianceEngine, type ComplianceEngineInput, type ComplianceGate, type ComplianceHit, type ComplianceRule, type ComplianceRuleSource, type ComplianceSettings, type ComplianceVerdict, type CompressConfig, type CompressResult, type ConfigMigration, type ConfigOrigins, ContextCompressor, type ContextEngine, type CreateScheduleInput, type CreateSessionInput, DEFAULT_COMPLIANCE_ACTIONS, DEFAULT_COMPLIANCE_SETTINGS, DEFAULT_COMPRESSION_THRESHOLD, DEFAULT_GOAL_MAX_ROUNDS, DEFAULT_MAX_HOLD_CHARS, type DelegateArgs, type DelegateConfig, DelegateManager, type DelegateTaskResult, type DiagnoseOptions, type DiscoverOutcome, type DiscoveredFile, type DoctorReport, type DraftParse, EMPTY_RULES, EPOCH_DISK_LEDGER, EpochConfigSchema, type ExpandOptions, type ExtractOutcome, FTS_TABLES, FTS_TRIGGERS, type FallbackEvent, type FileSlots, type FileSourceKind, type ForkInput, type FrontmatterParse, type FrontmatterSplit, type FtsHealth, type FtsReclaim, type FtsSpace, type FtsTableHealth, GOAL_BLOCK_CODES, type GateAxis, type GateVerdict, type GenerateInput, type GenerateOutput, type Goal, type GoalBlockReason, type GoalClear, type GoalPhase, type GoalPromptView, type GoalRefusal, type GoalRoundResult, GoalService, GoalStore, type GoalToolDeps, type GoalWrite, HEADLESS_AUDIT_CODES, type HeadlessPolicy, type HookConfigEntry, HookManager, type HookManagerOptions, type HookMatcher, type HookSourceKind, type HookSourceStatus, type HookSourcesOptions, type HookSourcesSummary, type HooksParseOutcome, type MemoryManager$1 as IMemoryManager, INSTRUCTION_BUDGET_CHARS, INSTRUCTION_FILES, type SessionManager$1 as ISessionManager, type SkillSystem$1 as ISkillSystem, ImageLoadError, type ImageSize, type ImportDecision, type ImportGate, type 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, 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, 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 };
|
|
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 };
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { existsSync, statSync, readdirSync, readFileSync, mkdirSync, writeFileSy
|
|
|
2
2
|
import { homedir, platform, tmpdir, hostname } from 'os';
|
|
3
3
|
import { join, dirname, resolve, relative, isAbsolute, sep, extname, basename } from 'path';
|
|
4
4
|
import { execFile, execSync, execFileSync, spawn } from 'child_process';
|
|
5
|
-
import { createLogger, dbPath, resolveHomeDir, DEFAULT_MAX_TURNS, PROJECT_DIR_NAME, guardSpawn, t, suggestKey, misspelledKeyIssues, openDatabase, migrate, releaseDatabase, parseLenient, issueDetails, splitWords, unknownKeyIssues, checkpointsDir, pluginsDir, projectHooksPath, projectClaudeSettingsPath, projectClaudeLocalSettingsPath, projectSettingsPath, projectLocalSettingsPath, projectPoliciesDir, trustedImportsPath, canProbeGit, budgetStatePath, artifactsDir, UNLIMITED_TURNS, turnLimitOf, configPath, managedSettingsPath, getSecretValues, listStoredSecretNames, maskApiKey, setSectionField, countCodePoints, headCodePoints, attachmentsDir,
|
|
5
|
+
import { createLogger, dbPath, resolveHomeDir, DEFAULT_MAX_TURNS, PROJECT_DIR_NAME, guardSpawn, t, suggestKey, misspelledKeyIssues, openDatabase, migrate, releaseDatabase, parseLenient, issueDetails, splitWords, unknownKeyIssues, checkpointsDir, expandPath, pluginsDir, projectHooksPath, projectClaudeSettingsPath, projectClaudeLocalSettingsPath, projectSettingsPath, projectLocalSettingsPath, projectPoliciesDir, trustedImportsPath, canProbeGit, budgetStatePath, artifactsDir, isInWorkspace, UNLIMITED_TURNS, turnLimitOf, configPath, managedSettingsPath, getSecretValues, listStoredSecretNames, maskApiKey, setSectionField, countCodePoints, headCodePoints, attachmentsDir, workspacesPath, samePath, lastSessionsPath, appearancePath, automationLogsDir, projectComplianceDir, projectSkillsDir, trustPath, projectCommandsDir, detectBackend, EXEC_PATH_AS_NODE_ENV, isolate, createStreamDecoder, parseShellCommand, writeArtifact, envPath, checkDangerousCommand, checkObfuscation, keepHeadAndTail, normalizeForMatch, isReadOnlyCommand, CODE_EXEC_ROOTS, tailCodePoints } from '@epoch-agent/infra';
|
|
6
6
|
export { IS_WINDOWS, WINDOWS_HIDE_FLAGS, buildBwrapArgs, buildProfile, checkDangerousCommand, checkObfuscation, createLogger, detectBackend, getDefaultShell, getPythonCommand, isInWorkspace, isReadOnlyCommand, isolate, maskApiKey, probeBubblewrap, probeSeatbelt, complianceDir as resolveComplianceDir, policiesDir as resolvePoliciesDir, setLogLevel } from '@epoch-agent/infra';
|
|
7
7
|
import { PROVIDER_TYPES, OPERATION_TYPES as OPERATION_TYPES$1, COMPLIANCE_CATEGORIES, COMPLIANCE_ACTIONS, SEARCH_PROVIDER_TYPES, CURRENCIES, LANGS, isSettingsPaneId, SETTINGS_PANE_IDS, PERMISSION_LEVELS, SHELL_KINDS, ToolExposure, MAX_OPTIONS, MIN_OPTIONS, MAX_HEADER_CHARS, MAX_QUESTIONS, SCHEDULE_INTERVAL_MINUTES, isPermissionLevel, SCHEDULE_DRAFT_TOOL, isValidAgentRoleName, DEFAULT_AGENT_ROLE, isValidCommandName, RESERVED_COMMAND_NAMES, parseModelRef, isWirePluginArchiveName, systemNote, formatMoney, totalUsageTokens, NOOP_TELEMETRY, METRIC, contentToText, GEN_AI, isPromptOversize, promptTokens, apiKeyEnvVar, PROVIDER_INFOS, isProviderType, API_KEY_ENV_VARS, KEY_ACTIONS, tableOf, perAction, isKeyAction, parseSequence, RESERVED_CHORDS, chordId, sequenceId, ACTION_CONTEXTS, SEQUENCE_CONTEXTS, assertNeverPart, MAX_ATTACH_FILES, MAX_ATTACH_TOTAL_BYTES, MAX_SESSION_REFS, utf8ByteLength, truncateToBudget, attachSessionSurface, isContextNearlyFull, isOperationType, normalizeApproval, imagePartOmittedSummary, MAX_ATTACH_BYTES, SIMULTANEOUS_CONTEXTS, SESSION_REFERENCE_ERROR_CODES, filePartSummary, sessionPartSummary } from '@epoch-agent/protocol';
|
|
8
8
|
export { API_KEY_ENV_VARS, COMPLIANCE_ACTIONS, COMPLIANCE_CATEGORIES, MAX_ATTACH_BYTES, MAX_ATTACH_FILES, MAX_ATTACH_TOTAL_BYTES, MAX_SESSION_ATTACH_BYTES, MAX_SESSION_REFS, OPERATION_TYPES, PERMISSION_LEVELS, PLAN_OUTCOMES, PROVIDER_INFOS, PROVIDER_TYPES, ToolExposure, apiKeyEnvVar, extractAllMentions, extractMentions, extractSessionMentions, getProviderInfo, isOperationType, isPermissionLevel, isPlanOutcome, isProviderType, normalizeApproval } from '@epoch-agent/protocol';
|
|
@@ -487,7 +487,7 @@ function intervalSlots(everyMinutes) {
|
|
|
487
487
|
var runCommand2;
|
|
488
488
|
var init_backend = __esm({
|
|
489
489
|
"src/schedule/os/backend.ts"() {
|
|
490
|
-
runCommand2 = (file, args) => new Promise((
|
|
490
|
+
runCommand2 = (file, args) => new Promise((resolve17) => {
|
|
491
491
|
guardSpawn(
|
|
492
492
|
() => execFile(
|
|
493
493
|
file,
|
|
@@ -495,10 +495,10 @@ var init_backend = __esm({
|
|
|
495
495
|
{ encoding: "buffer", windowsHide: true },
|
|
496
496
|
(err, stdout, stderr) => {
|
|
497
497
|
const code = err && typeof err.code === "number" ? err.code ?? 1 : err ? 1 : 0;
|
|
498
|
-
|
|
498
|
+
resolve17({ code, stdout: decodeOutput(stdout), stderr: decodeOutput(stderr) });
|
|
499
499
|
}
|
|
500
500
|
),
|
|
501
|
-
(err) =>
|
|
501
|
+
(err) => resolve17({ code: 1, stdout: "", stderr: `${file}: ${err.message}` })
|
|
502
502
|
);
|
|
503
503
|
});
|
|
504
504
|
}
|
|
@@ -2065,7 +2065,7 @@ async function runCode(input) {
|
|
|
2065
2065
|
let toolCalls = 0;
|
|
2066
2066
|
let capped2 = false;
|
|
2067
2067
|
let ending = null;
|
|
2068
|
-
return await new Promise((
|
|
2068
|
+
return await new Promise((resolve17) => {
|
|
2069
2069
|
let settled = false;
|
|
2070
2070
|
const finish = () => {
|
|
2071
2071
|
if (settled) return;
|
|
@@ -2074,7 +2074,7 @@ async function runCode(input) {
|
|
|
2074
2074
|
clearInterval(abortWatch);
|
|
2075
2075
|
void worker.terminate().catch(() => {
|
|
2076
2076
|
}).then(() => Promise.race([drained, delay(STREAM_DRAIN_MS)])).then(() => {
|
|
2077
|
-
|
|
2077
|
+
resolve17(toOutcome(ending, { printed, toolCalls, capped: capped2, limits}));
|
|
2078
2078
|
});
|
|
2079
2079
|
};
|
|
2080
2080
|
const timer = setTimeout(() => {
|
|
@@ -2145,14 +2145,14 @@ async function runCode(input) {
|
|
|
2145
2145
|
var ABORT_POLL_MS = 100;
|
|
2146
2146
|
var STREAM_DRAIN_MS = 500;
|
|
2147
2147
|
function streamEnd(stream) {
|
|
2148
|
-
return new Promise((
|
|
2149
|
-
stream.once("end", () =>
|
|
2150
|
-
stream.once("close", () =>
|
|
2148
|
+
return new Promise((resolve17) => {
|
|
2149
|
+
stream.once("end", () => resolve17());
|
|
2150
|
+
stream.once("close", () => resolve17());
|
|
2151
2151
|
});
|
|
2152
2152
|
}
|
|
2153
2153
|
function delay(ms) {
|
|
2154
|
-
return new Promise((
|
|
2155
|
-
setTimeout(
|
|
2154
|
+
return new Promise((resolve17) => {
|
|
2155
|
+
setTimeout(resolve17, ms).unref();
|
|
2156
2156
|
});
|
|
2157
2157
|
}
|
|
2158
2158
|
function timeoutMessage(timeoutMs, toolCalls) {
|
|
@@ -5287,6 +5287,7 @@ var PROJECT_AGENTS_SUBDIR = join(".epoch", "agents");
|
|
|
5287
5287
|
var AGENT_ROLE_DIAG_MODULE = "AgentRole";
|
|
5288
5288
|
var ROLE_FRONTMATTER_SCHEMA = z.object({
|
|
5289
5289
|
name: z.string().min(1).optional(),
|
|
5290
|
+
displayName: z.string().min(1).optional(),
|
|
5290
5291
|
description: z.string().min(1),
|
|
5291
5292
|
tools: z.array(z.string().min(1)).optional(),
|
|
5292
5293
|
skills: z.array(z.string().min(1)).optional(),
|
|
@@ -5361,6 +5362,7 @@ function parseRoleDefinition(raw, file, source) {
|
|
|
5361
5362
|
return {
|
|
5362
5363
|
role: {
|
|
5363
5364
|
name,
|
|
5365
|
+
...fm.displayName ? { displayName: fm.displayName } : {},
|
|
5364
5366
|
description: fm.description,
|
|
5365
5367
|
...prompt ? { prompt } : {},
|
|
5366
5368
|
...fm.tools ? { tools: fm.tools } : {},
|
|
@@ -5463,8 +5465,17 @@ var BUILTIN_ROLES = [
|
|
|
5463
5465
|
source: "builtin"
|
|
5464
5466
|
}
|
|
5465
5467
|
];
|
|
5468
|
+
var BUILTIN_DISPLAY_NAME_KEYS = {
|
|
5469
|
+
[DEFAULT_AGENT_ROLE]: "agent_role.display_general",
|
|
5470
|
+
explore: "agent_role.display_explore",
|
|
5471
|
+
review: "agent_role.display_review"
|
|
5472
|
+
};
|
|
5466
5473
|
function builtinRoles() {
|
|
5467
|
-
return BUILTIN_ROLES.map((
|
|
5474
|
+
return BUILTIN_ROLES.map((role) => {
|
|
5475
|
+
const copied = cloneRole(role);
|
|
5476
|
+
const key = BUILTIN_DISPLAY_NAME_KEYS[role.name];
|
|
5477
|
+
return key ? { ...copied, displayName: t(key) } : copied;
|
|
5478
|
+
});
|
|
5468
5479
|
}
|
|
5469
5480
|
function cloneRole(role) {
|
|
5470
5481
|
return {
|
|
@@ -5490,6 +5501,7 @@ function mergeRoles(overrides) {
|
|
|
5490
5501
|
merged.set(incoming.name, {
|
|
5491
5502
|
...existing,
|
|
5492
5503
|
...incoming.description ? { description: incoming.description } : {},
|
|
5504
|
+
...incoming.displayName ? { displayName: incoming.displayName } : {},
|
|
5493
5505
|
...incoming.prompt ? { prompt: incoming.prompt } : {},
|
|
5494
5506
|
...incoming.maxTurns !== void 0 ? { maxTurns: incoming.maxTurns } : {},
|
|
5495
5507
|
...tools ? { tools } : {},
|
|
@@ -5569,9 +5581,15 @@ function createRoleFile(input, opts) {
|
|
|
5569
5581
|
}
|
|
5570
5582
|
return { ok: true, path, role: back.role };
|
|
5571
5583
|
}
|
|
5584
|
+
function displayNameOf(value) {
|
|
5585
|
+
const trimmed = value?.trim();
|
|
5586
|
+
return trimmed ? trimmed : void 0;
|
|
5587
|
+
}
|
|
5572
5588
|
function frontmatterOf(name, input) {
|
|
5589
|
+
const displayName = displayNameOf(input.displayName);
|
|
5573
5590
|
return {
|
|
5574
5591
|
name,
|
|
5592
|
+
...displayName ? { displayName } : {},
|
|
5575
5593
|
description: input.description.trim(),
|
|
5576
5594
|
...input.tools === void 0 ? {} : { tools: [...input.tools] },
|
|
5577
5595
|
...input.skills === void 0 ? {} : { skills: [...input.skills] },
|
|
@@ -5588,6 +5606,8 @@ ${body2}${body2 ? "\n" : ""}`;
|
|
|
5588
5606
|
}
|
|
5589
5607
|
function driftOf(role, name, input) {
|
|
5590
5608
|
if (role.name !== name) return `name: ${role.name} \u2260 ${name}`;
|
|
5609
|
+
if ((role.displayName ?? null) !== (displayNameOf(input.displayName) ?? null))
|
|
5610
|
+
return "displayName";
|
|
5591
5611
|
if (role.description !== input.description.trim()) return "description";
|
|
5592
5612
|
if ((role.prompt ?? "") !== (input.prompt ?? "").trim()) return "prompt";
|
|
5593
5613
|
const tools = input.tools === void 0 ? void 0 : [...input.tools];
|
|
@@ -6635,7 +6655,7 @@ var PluginStore = class {
|
|
|
6635
6655
|
}
|
|
6636
6656
|
};
|
|
6637
6657
|
function sleep(ms) {
|
|
6638
|
-
return new Promise((
|
|
6658
|
+
return new Promise((resolve17) => setTimeout(resolve17, ms));
|
|
6639
6659
|
}
|
|
6640
6660
|
// src/plugin/loader.ts
|
|
6641
6661
|
var MODULE = "Plugin";
|
|
@@ -7495,7 +7515,9 @@ ${detail}` }) };
|
|
|
7495
7515
|
const closure = await resolveClosure({
|
|
7496
7516
|
root: manifest.name,
|
|
7497
7517
|
declared: manifest.dependencies ?? [],
|
|
7498
|
-
installed: new
|
|
7518
|
+
installed: new Map(
|
|
7519
|
+
new PluginStore(opts.statePath).read().records.map((r) => [r.name, r.path])
|
|
7520
|
+
),
|
|
7499
7521
|
staging,
|
|
7500
7522
|
opts
|
|
7501
7523
|
});
|
|
@@ -7613,8 +7635,14 @@ async function resolveClosure(input) {
|
|
|
7613
7635
|
const { name, requiredBy } = next;
|
|
7614
7636
|
if (seen.has(name)) continue;
|
|
7615
7637
|
seen.add(name);
|
|
7616
|
-
|
|
7617
|
-
|
|
7638
|
+
const installedAt = input.installed.get(name);
|
|
7639
|
+
if (installedAt !== void 0) {
|
|
7640
|
+
report3.push({
|
|
7641
|
+
name,
|
|
7642
|
+
status: "installed",
|
|
7643
|
+
requiredBy,
|
|
7644
|
+
...installedDisplayName(installedAt)
|
|
7645
|
+
});
|
|
7618
7646
|
continue;
|
|
7619
7647
|
}
|
|
7620
7648
|
if (plans.length >= DEPENDENCY_LIMIT) {
|
|
@@ -7694,6 +7722,7 @@ async function resolveClosure(input) {
|
|
|
7694
7722
|
status: "plan",
|
|
7695
7723
|
requiredBy,
|
|
7696
7724
|
source: located.source,
|
|
7725
|
+
...manifest.displayName ? { displayName: manifest.displayName } : {},
|
|
7697
7726
|
manifest,
|
|
7698
7727
|
inventory: scanPluginDir(readDir, manifest.name),
|
|
7699
7728
|
...versionUnmet ? { versionUnmet } : {}
|
|
@@ -7711,6 +7740,10 @@ async function resolveClosure(input) {
|
|
|
7711
7740
|
}
|
|
7712
7741
|
return { report: report3, plans };
|
|
7713
7742
|
}
|
|
7743
|
+
function installedDisplayName(dir) {
|
|
7744
|
+
const displayName = readPluginManifest(dir).manifest?.displayName;
|
|
7745
|
+
return displayName ? { displayName } : {};
|
|
7746
|
+
}
|
|
7714
7747
|
async function locateDependency(name, opts) {
|
|
7715
7748
|
const local = opts.marketplacesStatePath ? findMarketplaceEntryByName(name, opts.marketplacesStatePath) : void 0;
|
|
7716
7749
|
if (local) return { source: local.source, marketplace: local.marketplace };
|
|
@@ -8465,7 +8498,8 @@ function asStringList(value) {
|
|
|
8465
8498
|
return value.filter((v) => typeof v === "string" && v.length > 0);
|
|
8466
8499
|
}
|
|
8467
8500
|
function toAbsolute(path, workDir) {
|
|
8468
|
-
|
|
8501
|
+
const expanded = expandPath(path);
|
|
8502
|
+
return isAbsolute(expanded) ? resolve(expanded) : resolve(workDir, expanded);
|
|
8469
8503
|
}
|
|
8470
8504
|
var MAX_FILE_BYTES2 = 128 * 1024;
|
|
8471
8505
|
var MAX_CALL_BYTES = 512 * 1024;
|
|
@@ -8876,8 +8910,8 @@ function sanitizeToolOutput(text) {
|
|
|
8876
8910
|
if (!stripped.includes("\r")) return stripped;
|
|
8877
8911
|
return stripped.split("\n").map((line) => line.includes("\r") ? line.slice(line.lastIndexOf("\r") + 1) : line).join("\n");
|
|
8878
8912
|
}
|
|
8879
|
-
var sleep2 = (ms) => new Promise((
|
|
8880
|
-
setTimeout(
|
|
8913
|
+
var sleep2 = (ms) => new Promise((resolve17) => {
|
|
8914
|
+
setTimeout(resolve17, ms);
|
|
8881
8915
|
});
|
|
8882
8916
|
async function* pumpToolOutput(target, start, options = {}) {
|
|
8883
8917
|
const flushMs = options.flushMs ?? FLUSH_MS;
|
|
@@ -8945,8 +8979,8 @@ async function* pumpToolOutput(target, start, options = {}) {
|
|
|
8945
8979
|
continue;
|
|
8946
8980
|
}
|
|
8947
8981
|
if (!running) break;
|
|
8948
|
-
await new Promise((
|
|
8949
|
-
wake =
|
|
8982
|
+
await new Promise((resolve17) => {
|
|
8983
|
+
wake = resolve17;
|
|
8950
8984
|
});
|
|
8951
8985
|
if (running && flushMs > 0) await sleep2(flushMs);
|
|
8952
8986
|
}
|
|
@@ -8962,10 +8996,11 @@ var REPLY_LANG_RULE = {
|
|
|
8962
8996
|
var REPLY_LANG_MATCH_USER = "- \u7528\u7528\u6237\u8DDF\u4F60\u8BF4\u8BDD\u7684\u90A3\u79CD\u8BED\u8A00\u56DE\u590D\u4ED6\uFF1A\u6B63\u6587\u548C\u601D\u8003\u90FD\u7528\u90A3\u79CD\u8BED\u8A00\u3002\u4EE3\u7801\u5E93\u3001\u5DE5\u5177\u8F93\u51FA\u3001\u62A5\u9519\u662F\u4EC0\u4E48\u8BED\u8A00\uFF0C\u90FD\u4E0D\u6539\u53D8\u8FD9\u4E00\u6761";
|
|
8963
8997
|
function identityLine(role) {
|
|
8964
8998
|
if (!role) return "\u4F60\u662F\u4E00\u4E2A\u672C\u5730\u667A\u80FD\u4F53\uFF0C\u53EF\u4EE5\u6267\u884C\u7EC8\u7AEF\u547D\u4EE4\u548C\u64CD\u4F5C\u6587\u4EF6\u3002";
|
|
8999
|
+
const who = role.displayName ?? role.name;
|
|
8965
9000
|
if (role.scope === "session") {
|
|
8966
|
-
return `\u4F60\u662F\u4E00\u4E2A\u672C\u5730\u667A\u80FD\u4F53\uFF0C\u8FD9\u4E00\u6B21\u4EE5\u300C${
|
|
9001
|
+
return `\u4F60\u662F\u4E00\u4E2A\u672C\u5730\u667A\u80FD\u4F53\uFF0C\u8FD9\u4E00\u6B21\u4EE5\u300C${who}\u300D\u7684\u8EAB\u4EFD\u5DE5\u4F5C\u3002`;
|
|
8967
9002
|
}
|
|
8968
|
-
return `\u4F60\u662F\u300C${
|
|
9003
|
+
return `\u4F60\u662F\u300C${who}\u300D\u5B50\u667A\u80FD\u4F53\uFF0C\u7531\u4E3B\u667A\u80FD\u4F53\u6D3E\u6765\u5B8C\u6210\u4E00\u4E2A\u72EC\u7ACB\u5B50\u4EFB\u52A1\u3002`;
|
|
8969
9004
|
}
|
|
8970
9005
|
function systemPromptSegments(params) {
|
|
8971
9006
|
return {
|
|
@@ -11219,6 +11254,37 @@ function pruneArtifacts(root, keepSession, retention = ARTIFACT_RETENTION_DEFAUL
|
|
|
11219
11254
|
async function removeSessionArtifacts(sessionId, homeDir) {
|
|
11220
11255
|
await rm(artifactsDir(sessionId, homeDir), { recursive: true, force: true });
|
|
11221
11256
|
}
|
|
11257
|
+
function grantedPathsFor(args, workDir, extraRoots = []) {
|
|
11258
|
+
const out = /* @__PURE__ */ new Set();
|
|
11259
|
+
const add = (raw) => {
|
|
11260
|
+
if (isInWorkspace(toAbsolute2(raw, workDir), workDir, extraRoots)) return;
|
|
11261
|
+
out.add(approvalRootFor(raw, workDir));
|
|
11262
|
+
};
|
|
11263
|
+
for (const p of affectedPaths(args, workDir)) add(p);
|
|
11264
|
+
const workdir = args["workdir"];
|
|
11265
|
+
if (typeof workdir === "string" && workdir) add(workdir);
|
|
11266
|
+
return [...out];
|
|
11267
|
+
}
|
|
11268
|
+
function approvalRootFor(target, workDir) {
|
|
11269
|
+
const abs = toAbsolute2(target, workDir);
|
|
11270
|
+
try {
|
|
11271
|
+
if (statSync(abs).isDirectory()) return abs;
|
|
11272
|
+
} catch {
|
|
11273
|
+
}
|
|
11274
|
+
return dirname(abs);
|
|
11275
|
+
}
|
|
11276
|
+
function approvalEntryFor(opTarget, workDir, grantedRoots) {
|
|
11277
|
+
const abs = toAbsolute2(opTarget, workDir);
|
|
11278
|
+
if (isInWorkspace(abs, workDir, [])) return { target: opTarget, scope: "exact" };
|
|
11279
|
+
for (const root of grantedRoots) {
|
|
11280
|
+
if (isInWorkspace(abs, workDir, [root])) return { target: root, scope: "prefix" };
|
|
11281
|
+
}
|
|
11282
|
+
return { target: opTarget, scope: "exact" };
|
|
11283
|
+
}
|
|
11284
|
+
function toAbsolute2(path, workDir) {
|
|
11285
|
+
const expanded = expandPath(path);
|
|
11286
|
+
return isAbsolute(expanded) ? resolve(expanded) : resolve(workDir, expanded);
|
|
11287
|
+
}
|
|
11222
11288
|
var MAX_TOOL_OUTPUT = 3e4;
|
|
11223
11289
|
var MAX_SUB_CALL_OUTPUT = CODE_MODE_LIMITS.maxValueChars;
|
|
11224
11290
|
function budgetOf2(tool, depth, path = "success") {
|
|
@@ -11466,6 +11532,7 @@ var ToolExecutor = class {
|
|
|
11466
11532
|
sessionId,
|
|
11467
11533
|
workDir: this.deps.workDir(),
|
|
11468
11534
|
...extraRoots?.length ? { extraRoots } : {},
|
|
11535
|
+
...gate.grantedPaths?.length ? { grantedPaths: gate.grantedPaths } : {},
|
|
11469
11536
|
...homeDir ? { homeDir } : {},
|
|
11470
11537
|
...this.deps.sandboxTerminal !== void 0 ? { sandboxTerminal: this.deps.sandboxTerminal } : {},
|
|
11471
11538
|
permissionLevel: this.deps.permissionManager?.getLevel() || "auto",
|
|
@@ -11600,6 +11667,11 @@ var ToolExecutor = class {
|
|
|
11600
11667
|
const pm = this.deps.permissionManager;
|
|
11601
11668
|
if (!pm) return { allowed: true };
|
|
11602
11669
|
const toolName = et.name;
|
|
11670
|
+
const granted = () => grantedPathsFor(args, this.deps.workDir(), pm.getExtraRoots?.() ?? []);
|
|
11671
|
+
const allow = () => {
|
|
11672
|
+
const paths = granted();
|
|
11673
|
+
return paths.length > 0 ? { allowed: true, grantedPaths: paths } : { allowed: true };
|
|
11674
|
+
};
|
|
11603
11675
|
const opType = mapOperation(et);
|
|
11604
11676
|
const opTarget = this.resolveTarget(et, args);
|
|
11605
11677
|
const opDetail = (typeof args["command"] === "string" ? args["command"] : typeof args["path"] === "string" ? args["path"] : opTarget) || argsKey(args);
|
|
@@ -11610,7 +11682,7 @@ var ToolExecutor = class {
|
|
|
11610
11682
|
target: opTarget,
|
|
11611
11683
|
toolName
|
|
11612
11684
|
});
|
|
11613
|
-
if (decision.allowed) return
|
|
11685
|
+
if (decision.allowed) return allow();
|
|
11614
11686
|
if (!decision.requireApproval) {
|
|
11615
11687
|
return { allowed: false, output: `\u64CD\u4F5C\u88AB\u62E6\u622A [\u6743\u9650]: ${decision.reason || "\u9700\u8981\u6388\u6743"}` };
|
|
11616
11688
|
}
|
|
@@ -11649,9 +11721,10 @@ var ToolExecutor = class {
|
|
|
11649
11721
|
};
|
|
11650
11722
|
}
|
|
11651
11723
|
if (outcome === "allow-session" || outcome === "allow-always") {
|
|
11652
|
-
|
|
11724
|
+
const entry = approvalEntryFor(opTarget, this.deps.workDir(), granted());
|
|
11725
|
+
pm.recordApproval(toolName, entry.target, outcome, entry.scope);
|
|
11653
11726
|
}
|
|
11654
|
-
return
|
|
11727
|
+
return allow();
|
|
11655
11728
|
}
|
|
11656
11729
|
};
|
|
11657
11730
|
// src/agent/loop.ts
|
|
@@ -12053,7 +12126,13 @@ var AgentLoop = class {
|
|
|
12053
12126
|
const role = this.config.role?.();
|
|
12054
12127
|
yield {
|
|
12055
12128
|
type: "run-start",
|
|
12056
|
-
...role ? {
|
|
12129
|
+
...role ? {
|
|
12130
|
+
role: {
|
|
12131
|
+
name: role.name,
|
|
12132
|
+
...role.displayName ? { displayName: role.displayName } : {},
|
|
12133
|
+
...role.source ? { source: role.source } : {}
|
|
12134
|
+
}
|
|
12135
|
+
} : {},
|
|
12057
12136
|
estimatedTokens: estimated
|
|
12058
12137
|
};
|
|
12059
12138
|
if (learned.length > 0) {
|
|
@@ -17653,6 +17732,9 @@ var SessionManager = class {
|
|
|
17653
17732
|
const messages = this.db.getMessages(id);
|
|
17654
17733
|
return this.buildSession(id, messages);
|
|
17655
17734
|
}
|
|
17735
|
+
getMeta(id) {
|
|
17736
|
+
return this.db.getSessionMeta(id) ?? void 0;
|
|
17737
|
+
}
|
|
17656
17738
|
has(id) {
|
|
17657
17739
|
return this.db.hasSession(id);
|
|
17658
17740
|
}
|
|
@@ -18554,7 +18636,17 @@ function checkCodeExec(isolation) {
|
|
|
18554
18636
|
function checkAuto() {
|
|
18555
18637
|
return { allowed: true, code: "level-default" };
|
|
18556
18638
|
}
|
|
18557
|
-
function
|
|
18639
|
+
function outsideWorkspace(operation, extraRoots) {
|
|
18640
|
+
if (operation.type !== "file_read" && operation.type !== "file_write") return null;
|
|
18641
|
+
if (isInWorkspace(operation.target, operation.workDir, extraRoots)) return null;
|
|
18642
|
+
return {
|
|
18643
|
+
allowed: false,
|
|
18644
|
+
requireApproval: true,
|
|
18645
|
+
reason: t("permission_reason.outside_workspace"),
|
|
18646
|
+
code: "level-default"
|
|
18647
|
+
};
|
|
18648
|
+
}
|
|
18649
|
+
function checkPlan(operation, extraRoots) {
|
|
18558
18650
|
if (operation.type === "code_exec") {
|
|
18559
18651
|
return {
|
|
18560
18652
|
allowed: false,
|
|
@@ -18572,25 +18664,16 @@ function checkPlan(operation) {
|
|
|
18572
18664
|
code: "level-default"
|
|
18573
18665
|
};
|
|
18574
18666
|
}
|
|
18575
|
-
return { allowed: true, code: "level-default" };
|
|
18667
|
+
return outsideWorkspace(operation, extraRoots) ?? { allowed: true, code: "level-default" };
|
|
18576
18668
|
}
|
|
18577
18669
|
function checkAcceptEdits(operation, isolation, extraRoots) {
|
|
18578
18670
|
if (operation.type === "code_exec") return checkCodeExec(isolation);
|
|
18579
|
-
|
|
18580
|
-
if (isInWorkspace(operation.target, operation.workDir, extraRoots)) {
|
|
18581
|
-
return { allowed: true, code: "level-default" };
|
|
18582
|
-
}
|
|
18583
|
-
return {
|
|
18584
|
-
allowed: false,
|
|
18585
|
-
requireApproval: true,
|
|
18586
|
-
reason: t("permission_reason.outside_workspace"),
|
|
18587
|
-
code: "level-default"
|
|
18588
|
-
};
|
|
18589
|
-
}
|
|
18590
|
-
return { allowed: true, code: "level-default" };
|
|
18671
|
+
return outsideWorkspace(operation, extraRoots) ?? { allowed: true, code: "level-default" };
|
|
18591
18672
|
}
|
|
18592
|
-
function checkDefault(operation) {
|
|
18593
|
-
if (operation.type === "file_read")
|
|
18673
|
+
function checkDefault(operation, extraRoots) {
|
|
18674
|
+
if (operation.type === "file_read") {
|
|
18675
|
+
return outsideWorkspace(operation, extraRoots) ?? { allowed: true, code: "level-default" };
|
|
18676
|
+
}
|
|
18594
18677
|
if (operation.type === "command" && isReadOnlyCommand(operation.detail)) {
|
|
18595
18678
|
return { allowed: true, code: "level-default" };
|
|
18596
18679
|
}
|
|
@@ -18611,12 +18694,12 @@ function decideByLevel(level, operation, isolation, extraRoots = []) {
|
|
|
18611
18694
|
case "auto":
|
|
18612
18695
|
return checkAuto();
|
|
18613
18696
|
case "plan":
|
|
18614
|
-
return checkPlan(operation);
|
|
18697
|
+
return checkPlan(operation, extraRoots);
|
|
18615
18698
|
case "acceptEdits":
|
|
18616
18699
|
return checkAcceptEdits(operation, isolation, extraRoots);
|
|
18617
18700
|
case "default":
|
|
18618
18701
|
default:
|
|
18619
|
-
return checkDefault(operation);
|
|
18702
|
+
return checkDefault(operation, extraRoots);
|
|
18620
18703
|
}
|
|
18621
18704
|
}
|
|
18622
18705
|
var SENSITIVE_PATHS = [
|
|
@@ -21143,14 +21226,14 @@ function runCommandHook(config, event, workDir) {
|
|
|
21143
21226
|
const baseEnv = sanitizeEnvironment(process.env);
|
|
21144
21227
|
const injectedEnv = injectEpochEnv(event, config.pluginRoot);
|
|
21145
21228
|
const hookEnv = { ...baseEnv, ...injectedEnv, ...config.env };
|
|
21146
|
-
return new Promise((
|
|
21229
|
+
return new Promise((resolve17) => {
|
|
21147
21230
|
let stdout = "";
|
|
21148
21231
|
let stderr = "";
|
|
21149
21232
|
let settled = false;
|
|
21150
21233
|
const failToStart = (err) => {
|
|
21151
21234
|
if (settled) return;
|
|
21152
21235
|
settled = true;
|
|
21153
|
-
|
|
21236
|
+
resolve17({
|
|
21154
21237
|
exitCode: -1,
|
|
21155
21238
|
stdout,
|
|
21156
21239
|
stderr,
|
|
@@ -21172,7 +21255,7 @@ function runCommandHook(config, event, workDir) {
|
|
|
21172
21255
|
if (!settled) {
|
|
21173
21256
|
settled = true;
|
|
21174
21257
|
child.kill("SIGKILL");
|
|
21175
|
-
|
|
21258
|
+
resolve17({
|
|
21176
21259
|
exitCode: -1,
|
|
21177
21260
|
stdout,
|
|
21178
21261
|
stderr,
|
|
@@ -21208,7 +21291,7 @@ function runCommandHook(config, event, workDir) {
|
|
|
21208
21291
|
}
|
|
21209
21292
|
} catch {
|
|
21210
21293
|
}
|
|
21211
|
-
|
|
21294
|
+
resolve17({
|
|
21212
21295
|
exitCode,
|
|
21213
21296
|
stdout: stdout.trim(),
|
|
21214
21297
|
stderr: stderr.trim(),
|
|
@@ -23991,7 +24074,7 @@ var CodeSandbox = class {
|
|
|
23991
24074
|
stdio: ["ignore", "pipe", "pipe"],
|
|
23992
24075
|
...IS_WINDOWS ? { windowsHide: true } : {}
|
|
23993
24076
|
};
|
|
23994
|
-
return new Promise((
|
|
24077
|
+
return new Promise((resolve17) => {
|
|
23995
24078
|
let stdout = "";
|
|
23996
24079
|
let stderr = "";
|
|
23997
24080
|
let killedForOutput = false;
|
|
@@ -24002,7 +24085,7 @@ var CodeSandbox = class {
|
|
|
24002
24085
|
const failToStart = (err) => {
|
|
24003
24086
|
opts.signal?.removeEventListener("abort", onAbort);
|
|
24004
24087
|
if (err.code === "ENOENT") {
|
|
24005
|
-
|
|
24088
|
+
resolve17({
|
|
24006
24089
|
success: false,
|
|
24007
24090
|
output: "",
|
|
24008
24091
|
error: `[\u9519\u8BEF] \u627E\u4E0D\u5230\u89E3\u91CA\u5668: ${command}`,
|
|
@@ -24011,7 +24094,7 @@ var CodeSandbox = class {
|
|
|
24011
24094
|
});
|
|
24012
24095
|
return;
|
|
24013
24096
|
}
|
|
24014
|
-
|
|
24097
|
+
resolve17({
|
|
24015
24098
|
success: false,
|
|
24016
24099
|
output: "",
|
|
24017
24100
|
error: `[\u9519\u8BEF] ${err.message}\uFF08command=${command}\uFF0Ccwd=${spawnOpts.cwd ?? ""}\uFF09`,
|
|
@@ -24047,7 +24130,7 @@ var CodeSandbox = class {
|
|
|
24047
24130
|
if (stderr.length < MAX_OUTPUT) stderr += errDecoder?.end() ?? "";
|
|
24048
24131
|
const duration = Date.now() - start;
|
|
24049
24132
|
if (killedForOutput) {
|
|
24050
|
-
|
|
24133
|
+
resolve17({
|
|
24051
24134
|
success: false,
|
|
24052
24135
|
output: trunc(stdout, stderr),
|
|
24053
24136
|
error: `[\u8F93\u51FA\u8D85\u9650] \u8D85\u8FC7 ${MAX_OUTPUT} \u5B57\u8282\uFF0C\u5DF2\u7EC8\u6B62`,
|
|
@@ -24057,7 +24140,7 @@ var CodeSandbox = class {
|
|
|
24057
24140
|
return;
|
|
24058
24141
|
}
|
|
24059
24142
|
if (sig) {
|
|
24060
|
-
|
|
24143
|
+
resolve17({
|
|
24061
24144
|
success: false,
|
|
24062
24145
|
output: trunc(stdout, stderr),
|
|
24063
24146
|
error: opts.signal?.aborted ? "[\u5DF2\u53D6\u6D88]" : "[\u8D85\u65F6] \u6267\u884C\u8D85\u65F6",
|
|
@@ -24069,7 +24152,7 @@ var CodeSandbox = class {
|
|
|
24069
24152
|
const output = trunc(stdout, stderr);
|
|
24070
24153
|
if (code !== 0 && code !== null) {
|
|
24071
24154
|
const oom = /heap out of memory|allocation failed/i.test(stderr);
|
|
24072
|
-
|
|
24155
|
+
resolve17({
|
|
24073
24156
|
success: false,
|
|
24074
24157
|
output,
|
|
24075
24158
|
error: oom ? `[\u5185\u5B58\u8D85\u9650] \u8D85\u8FC7 ${MAX_MEMORY}MB` : `[\u8FD0\u884C\u65F6\u9519\u8BEF] exit ${code}: ${stderr.slice(0, 200)}`,
|
|
@@ -24078,7 +24161,7 @@ var CodeSandbox = class {
|
|
|
24078
24161
|
});
|
|
24079
24162
|
return;
|
|
24080
24163
|
}
|
|
24081
|
-
|
|
24164
|
+
resolve17({ success: true, output, duration });
|
|
24082
24165
|
});
|
|
24083
24166
|
});
|
|
24084
24167
|
}
|
|
@@ -24138,4 +24221,4 @@ function trunc(stdout, stderr) {
|
|
|
24138
24221
|
* `--tree` 的命令帮助里,让用户自己知道 `--tree` 意味着什么。
|
|
24139
24222
|
*/
|
|
24140
24223
|
|
|
24141
|
-
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, 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, 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 };
|
|
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 };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@epoch-agent/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.25.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/
|
|
31
|
-
"@epoch-agent/
|
|
30
|
+
"@epoch-agent/infra": "0.25.0",
|
|
31
|
+
"@epoch-agent/protocol": "0.25.0"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@ai-sdk/alibaba": "^2.0.59",
|