@epoch-agent/core 0.3.1 → 0.4.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 +119 -2
- package/dist/index.js +134 -81
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -4869,6 +4869,80 @@ type InstallOutcome = {
|
|
|
4869
4869
|
*/
|
|
4870
4870
|
declare function installPlugin(source: string, opts: InstallOptions): Promise<InstallOutcome>;
|
|
4871
4871
|
|
|
4872
|
+
/**
|
|
4873
|
+
* `${EPOCH_PLUGIN_ROOT}` —— 插件指向**自己包里那个文件**的唯一办法。
|
|
4874
|
+
*
|
|
4875
|
+
* ## 这一格补的是什么
|
|
4876
|
+
*
|
|
4877
|
+
* 一包插件里可以带脚本(`.py` / `.sh` / `.js` / 任何有解释器的东西),而它们的
|
|
4878
|
+
* 调用点只有两处:`hooks.json` 里那条 shell 命令,和 `mcp.json` 里那台 stdio
|
|
4879
|
+
* server 的 `command` / `args`。**两处以前都写不出一条指得到自己的路径**:
|
|
4880
|
+
*
|
|
4881
|
+
* - 插件装在 `~/.epoch/plugins/<名字>/`,而 `<名字>` 由**安装记录**说了算 ——
|
|
4882
|
+
* 作者写文件的时候不知道它,甚至连家目录都不知道(`EPOCH_HOME` 可以搬);
|
|
4883
|
+
* - hook 的子进程 `cwd` 是**工作区**(`command-runner.ts` 那一行),不是插件根。
|
|
4884
|
+
* 于是相对路径 `scripts/check.py` 指向的是用户当前那个仓库里的同名文件 ——
|
|
4885
|
+
* **不是报错,是指到了另一个真实存在的位置**,这是最坏的一档失败;
|
|
4886
|
+
* - MCP 那边的 `McpServerConfig` 压根没有 `cwd` 这一格。
|
|
4887
|
+
*
|
|
4888
|
+
* 结果是插件作者只能在 README 里写「请把这个脚本拷到某处」,而那正是插件系统
|
|
4889
|
+
* 存在的理由本身。
|
|
4890
|
+
*
|
|
4891
|
+
* ## 为什么是**替换**,不是只给一个环境变量
|
|
4892
|
+
*
|
|
4893
|
+
* 环境变量单独用不了,两条:
|
|
4894
|
+
*
|
|
4895
|
+
* 1. **MCP 那边给不了。** SDK 的 `StdioClientTransport` 在 `env` 给了值的时候
|
|
4896
|
+
* **拿它当整份环境**(不与 `process.env` 合并)—— 我们为了塞一个变量而
|
|
4897
|
+
* 构造一份 env,等于把没写 `env` 的 server 的 `PATH` 一起拿掉,
|
|
4898
|
+
* 那是一个「配置没动、昨天还好好的、今天起不来」的失败形态;
|
|
4899
|
+
* 2. **Windows 上写法不通用。** hook 走 `shell: true`,那个 shell 在 win32 上是
|
|
4900
|
+
* `cmd.exe`:`$EPOCH_PLUGIN_ROOT` 在那儿不展开(要写 `%EPOCH_PLUGIN_ROOT%`)。
|
|
4901
|
+
* 一份想跨平台的 `hooks.json` 于是写不出一行两边都对的命令。
|
|
4902
|
+
*
|
|
4903
|
+
* 在**解析这一刻**替换掉就两条全绕开了。做法和形状照 `hook/claude-settings.ts`
|
|
4904
|
+
* 的 `substitute()`(那儿替的是 `${CLAUDE_PROJECT_DIR}`)—— 同一个理由的第二次
|
|
4905
|
+
* 应用:**这个 token 的值我们知道、shell 不知道,留给 shell 等于展开成空串**,
|
|
4906
|
+
* 而 `${EPOCH_PLUGIN_ROOT}/scripts/check.py` 变成 `/scripts/check.py` 之后
|
|
4907
|
+
* 报的是「文件不存在」,一个字都不会提到插件。
|
|
4908
|
+
*
|
|
4909
|
+
* ⚠️ hook 那一侧**额外**还注入一个同名环境变量(`command-runner.ts` 的
|
|
4910
|
+
* `injectEpochEnv`),因为那一侧的 env 是**并到 `process.env` 上**的,没有第 1 条
|
|
4911
|
+
* 那个风险;而脚本跑起来之后要找自己包里的**兄弟文件**时,拿环境变量比让
|
|
4912
|
+
* 调用方把路径传进来省事。MCP 那一侧没有这一份,判据同上第 1 条 ——
|
|
4913
|
+
* 真需要的作者自己在 `mcp.json` 里写 `"env": { "EPOCH_PLUGIN_ROOT": "${EPOCH_PLUGIN_ROOT}" }`,
|
|
4914
|
+
* 那时整份 env 是他自己写的,`PATH` 该带什么由他负责。
|
|
4915
|
+
*
|
|
4916
|
+
* ## ⚠️ 只在**插件带来的**那几份文件上替换
|
|
4917
|
+
*
|
|
4918
|
+
* 用户自己的 `~/.epoch/hooks.json` 和项目里那份没有「插件根」这个东西 ——
|
|
4919
|
+
* 在那儿写了这个 token 会得到一条 issue(`hook_load.no_plugin_root`),
|
|
4920
|
+
* 不是静默留着原文。口径逐字同 `${CLAUDE_PLUGIN_ROOT}` 落在一份 `settings.json`
|
|
4921
|
+
* 上时那一条:**给不出值就说出来**,因为静默的表现是「路径莫名其妙少了一截」。
|
|
4922
|
+
*/
|
|
4923
|
+
/** 写在 `hooks.json` / `mcp.json` 里的那个占位符 */
|
|
4924
|
+
declare const PLUGIN_ROOT_TOKEN = "${EPOCH_PLUGIN_ROOT}";
|
|
4925
|
+
/**
|
|
4926
|
+
* 同名环境变量的名字。**只有 hook 那一侧注入**,判据见文件头。
|
|
4927
|
+
*
|
|
4928
|
+
* 和 token 共用一个名字是刻意的:作者在 `hooks.json` 里写
|
|
4929
|
+
* `python3 "${EPOCH_PLUGIN_ROOT}/scripts/x.py"`,脚本里再读
|
|
4930
|
+
* `os.environ['EPOCH_PLUGIN_ROOT']` 找兄弟文件 —— 两处是同一个概念,
|
|
4931
|
+
* 不该有两个名字。
|
|
4932
|
+
*/
|
|
4933
|
+
declare const PLUGIN_ROOT_ENV = "EPOCH_PLUGIN_ROOT";
|
|
4934
|
+
/** 这段文本里有没有那个占位符 */
|
|
4935
|
+
declare function mentionsPluginRoot(text: string): boolean;
|
|
4936
|
+
/**
|
|
4937
|
+
* 把 `${EPOCH_PLUGIN_ROOT}` 换成插件根的绝对路径。
|
|
4938
|
+
*
|
|
4939
|
+
* 用 `split().join()` 而不是 `replaceAll` 的正则形态:`root` 是一条真实路径,
|
|
4940
|
+
* Windows 上带反斜杠,而反斜杠在替换串里是转义引导符(`$&` 那一套)——
|
|
4941
|
+
* `String.prototype.replace` 的第二个参数会把 `C:\temp\$&` 里的东西当特殊记号。
|
|
4942
|
+
* `join` 没有这一层解释。
|
|
4943
|
+
*/
|
|
4944
|
+
declare function substitutePluginRoot(text: string, root: string): string;
|
|
4945
|
+
|
|
4872
4946
|
/**
|
|
4873
4947
|
* 插件生命周期 —— 卸载 / 启用 / 停用 / 更新(方案 32)。
|
|
4874
4948
|
*
|
|
@@ -6946,6 +7020,25 @@ interface PersistedBudget {
|
|
|
6946
7020
|
/** 最后更新时间戳,用于过期清理 */
|
|
6947
7021
|
updatedAt: number;
|
|
6948
7022
|
}
|
|
7023
|
+
/**
|
|
7024
|
+
* 落盘那一条 → `usage` 事件里那个 `cumulative`。
|
|
7025
|
+
*
|
|
7026
|
+
* ## 为什么单独一个函数,而不是在两处各写一遍
|
|
7027
|
+
*
|
|
7028
|
+
* 落盘的形状(`{microUsd, usage}`,两格分开)和网线上那个形状
|
|
7029
|
+
* (`TokenUsage`,钱在 `costUsd` 里)**不一样**,中间隔着一次微美元 → 美元。
|
|
7030
|
+
* 在库里跑着的那一份由 `BudgetGuard.snapshot()` 产出,而**没有 guard 的时候**
|
|
7031
|
+
* (上一个进程留下的会话,Hub 里压根没有它)只剩这条落盘记录 ——
|
|
7032
|
+
* 两条路都要答同一个问题「这段会话到此刻累计花了多少」。
|
|
7033
|
+
*
|
|
7034
|
+
* 两处各写一套算术的结果是可以预演的:某一天有人给 `snapshot()` 加了一格
|
|
7035
|
+
* (比如把 `callMicros` 也算进去),另一条路**不会红,只会开始说另一个数**。
|
|
7036
|
+
* 所以 `snapshot()` 自己也走这一支,它是仓库里唯一的那套算术。
|
|
7037
|
+
*
|
|
7038
|
+
* ⚠️ **`microUsd` 缺席时不写 `costUsd: 0`** —— 全程查不到定价和「这段会话免费」
|
|
7039
|
+
* 是两件事,界面上前者写「未上报」,后者写 `$0.0000`(判据在 `pricing.ts`)。
|
|
7040
|
+
*/
|
|
7041
|
+
declare function persistedUsage(entry: Pick<PersistedBudget, 'microUsd' | 'usage'>): TokenUsage;
|
|
6949
7042
|
interface BudgetStoreOptions {
|
|
6950
7043
|
/** 状态文件路径,默认 infra 的 budgetStatePath() */
|
|
6951
7044
|
path?: string;
|
|
@@ -8825,7 +8918,13 @@ declare class BudgetGuard {
|
|
|
8825
8918
|
costUsd?: number;
|
|
8826
8919
|
tokens?: number;
|
|
8827
8920
|
};
|
|
8828
|
-
/**
|
|
8921
|
+
/**
|
|
8922
|
+
* 累计用量快照。有定价数据时带上 costUsd。
|
|
8923
|
+
*
|
|
8924
|
+
* ⚠️ 算术**借 {@link persistedUsage}**,不在这儿再写一遍:没有 guard 的时候
|
|
8925
|
+
* (上一个进程留下的会话)同一个数要从落盘那条记录里重建,两处必须逐字相同。
|
|
8926
|
+
* 判据全文在那个函数上。
|
|
8927
|
+
*/
|
|
8829
8928
|
snapshot(): TokenUsage;
|
|
8830
8929
|
/**
|
|
8831
8930
|
* 当前状态。
|
|
@@ -9718,6 +9817,13 @@ declare const EpochConfigSchema: z.ZodObject<{
|
|
|
9718
9817
|
label: z.ZodString;
|
|
9719
9818
|
icon: z.ZodOptional<z.ZodString>;
|
|
9720
9819
|
}, z.core.$strip>>>;
|
|
9820
|
+
blankCards: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
9821
|
+
id: z.ZodString;
|
|
9822
|
+
title: z.ZodString;
|
|
9823
|
+
subtitle: z.ZodOptional<z.ZodString>;
|
|
9824
|
+
prompt: z.ZodString;
|
|
9825
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
9826
|
+
}, z.core.$strip>>>;
|
|
9721
9827
|
}, z.core.$strip>;
|
|
9722
9828
|
/**
|
|
9723
9829
|
* 全默认配置 —— 从 schema 派生,不是第二份字面量。
|
|
@@ -14099,6 +14205,17 @@ interface CommandHookConfig {
|
|
|
14099
14205
|
timeout?: number;
|
|
14100
14206
|
/** 额外环境变量 */
|
|
14101
14207
|
env?: Record<string, string>;
|
|
14208
|
+
/**
|
|
14209
|
+
* 这条 hook 来自哪个插件的根目录(绝对路径)。**不是配置文件里的字段** ——
|
|
14210
|
+
* 由 [sources.ts](./sources.js) 在读完插件那份 `hooks.json` 之后盖上去,
|
|
14211
|
+
* 所以插件作者没有办法自己声明一个(`HookEntrySchema` 里没有这一格,写了会
|
|
14212
|
+
* 落进「未知配置项」)。
|
|
14213
|
+
*
|
|
14214
|
+
* 有值时子进程多一个 `EPOCH_PLUGIN_ROOT` 环境变量,判据全文在
|
|
14215
|
+
* [plugin/root-token.ts](../plugin/root-token.js):脚本要找自己包里的兄弟文件时
|
|
14216
|
+
* 靠它,而命令行里那个 `${EPOCH_PLUGIN_ROOT}` 占位符在解析那一刻就已经换掉了。
|
|
14217
|
+
*/
|
|
14218
|
+
pluginRoot?: string;
|
|
14102
14219
|
}
|
|
14103
14220
|
/** Command hook 执行结果 */
|
|
14104
14221
|
interface CommandHookResult {
|
|
@@ -16186,4 +16303,4 @@ declare function resolveCodeModeWorker(baseDir: string, exists?: typeof existsSy
|
|
|
16186
16303
|
*/
|
|
16187
16304
|
declare function codeModeWorkerPath(): string | undefined;
|
|
16188
16305
|
|
|
16189
|
-
export { AGENT_ROLE_DIAG_MODULE, ARTIFACT_MAX_TOTAL_BYTES, ARTIFACT_RETENTION_DEFAULTS, type AcquireResult, type AgentConfig, AgentLoop, type AgentProvider, type AgentSite, type AgentSiteRef, type AppendMessageInput, ApprovalCache, type ApprovalDecision, type ApprovalScope, type ArtifactOpenRefusal, type ArtifactRetention, type AskQuestionDeps, 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_GOAL_MAX_ROUNDS, DEFAULT_MAX_HOLD_CHARS, type DelegateArgs, type DelegateConfig, DelegateManager, type DelegateTaskResult, type DiagnoseOptions, type DiscoverOutcome, type DiscoveredFile, type DoctorReport, EMPTY_RULES, EPOCH_DISK_LEDGER, EpochConfigSchema, type ExpandOptions, FTS_TABLES, FTS_TRIGGERS, type FallbackEvent, type FileSlots, type FileSourceKind, type ForkInput, type FrontmatterParse, type FrontmatterSplit, type FtsHealth, type FtsReclaim, type FtsSpace, type FtsTableHealth, GOAL_BLOCK_CODES, type GateAxis, type GateVerdict, type GenerateInput, type GenerateOutput, type Goal, type GoalBlockReason, type GoalClear, type GoalPhase, type GoalPromptView, type GoalRefusal, type GoalRoundResult, GoalService, GoalStore, type GoalToolDeps, type GoalWrite, HEADLESS_AUDIT_CODES, type HeadlessPolicy, type HookConfigEntry, HookManager, type HookManagerOptions, type HookMatcher, type HookSourceKind, type HookSourceStatus, type HookSourcesOptions, type HookSourcesSummary, type HooksParseOutcome, type MemoryManager$1 as IMemoryManager, INSTRUCTION_BUDGET_CHARS, INSTRUCTION_FILES, type SessionManager$1 as ISessionManager, type SkillSystem$1 as ISkillSystem, ImageLoadError, type ImageSize, type ImportDecision, type ImportGate, type ImportNode, type ImportSkipReason, ImportTrustStore, type InstallOptions, type InstallOutcome, type InstallPreview, type InstructionScan, type InstructionSource, type IsolationReason, type IsolationReport, type JsonSchemaDocument, LAUNCHD_LABEL_PREFIX, LOCK_HEARTBEAT_MS, LOCK_STALE_MS, type 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_FILE, MAX_AUDIT_ENTRIES, MAX_COMMAND_DEPTH, MAX_GOAL_MAX_ROUNDS, MAX_IMPORT_DEPTH, MAX_OBJECTIVE_CHARS, MAX_REASON_CHARS, MAX_RECENT_WORKSPACES, MODEL_GIVE_UP_THRESHOLD, MULTIMODAL_DEFAULTS, type ManagedPolicy, ManagedPolicyError, type ManagedSettings, ManagedSettingsSchema, type MarketplaceCatalog, type MarketplaceEntry, type MarketplaceOutcome, type MarketplaceRecord, type MemoryConfig, type MemoryEntry, MemoryManager, MemoryReviewer, type MemorySearchResult, type MemoryTarget, type MemoryWriteResult, type MentionPart, type MentionResolution, type Message, type MessageHit, type MessageRecord, type MessageSurface, type ModelCapability, ModelFailureTracker, type ModelMetaEntry, type ModelPricing, type MultimodalPolicy, NOMINAL_TOTAL_BYTES, NO_REVEALED_TOOLS, type NonInteractiveProbe, type OsTaskSnapshot, type OutputGuard, PERMISSION_AUDIT_CODES, PLUGIN_LAYOUT, PLUGIN_MANIFEST_FILE, PLUGIN_NAME_PATTERN, POLICY_DECISIONS, PROJECT_AGENTS_SUBDIR, PROVIDER_NO_CREDENTIAL, type PermissionAuditCode, type PermissionAuditEntry, type PermissionAuditOutcome, type PermissionAuditScope, type PermissionAuditSnapshot, PermissionManager, type PersistedBudget, type PersistedPart, type PlanApprovalFn, type PlanEnterResult, type PlanModeDeps, PlanModeState, type PlanSettlement, type PluginArtifacts, type PluginCommandDir, type PluginCounts, type PluginHookFile, type PluginInventory, type PluginLoadOptions, type PluginManifest, type PluginPathRef, type PluginRecord, type PluginSettingsFile, type PluginSourceType, type PluginStateReadOutcome, PluginStore, type PolicyDirSpec, type PolicyDirsSummary, type PolicyLoadOutcome, type PolicyRule, PolicyRuleSchema, type ProjectContext, ProviderError, ProviderRouter, type ProviderStreamChunk, type ProviderToolCall$1 as ProviderToolCall, type ProviderWarning, type PruneResult, type QuestionAskFn, RECORDING_KEEP_RUNS, RECORDING_MAX_BYTES, ROLE_FRONTMATTER_SCHEMA, RUN_CODE_TOOL, type ReadMessagesInput, type ReadMessagesOutput, type RecentWorkspace, RecentWorkspaces, type RecordRunInput, type RecorderOptions, type RecoveryAction, type RegisterInput, type RegisterOutcome, type RegistrarOptions, type RegistrationPatch, type RepairOutcome, type ResolveMentionsOptions, type ResolveReferenceInput, type ResolveSettingsOptions, type ResolvedCompression, type ResolvedReference, type ResolvedSource, type ResponseFormat, type RestorePartsOptions, type ReviewIssue, type RewindAction, type RewindDrift, type RewindFilePlan, type RewindOptions, type RewindOutcome, type RewindPreview, type RoleCreateFailure, type RoleCreateInput, type RoleCreateOptions, type RoleCreateOutcome, type RoleLoadOutcome, type RoleLoadSummary, type RoleMergeNotice, type RoleMergeResult, type RoleScope, type RuleMatch, type RuleSuggestion, type RuleVerdict, type RunCodeFailure, type RunCodeInput, type RunCodeOutcome, type RunCodeToolDeps, type RunEstimateInput, type RunInput, type RunResult, SANDBOX_COVERS, SANDBOX_EXCLUDES, SCALAR_KEYS, SCHEDULE_DEFAULTS, SCHEDULE_DEFAULT_ALLOWLIST, SCHEDULE_ISSUE_CODES, SCHTASKS_FOLDER, SESSION_MESSAGES_READ_TOOL, SESSION_MESSAGES_SEARCH_TOOL, SESSION_QUERY_TOOLS, SESSION_SEARCH_TOOL, SESSION_TRACE_TOOL, SETTINGS_LAYER_ORDER, SETTING_WRITE_APPLY, 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 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 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 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 SubAgentRunner, type SubTask, type SubToolCaller, type SummarizeOutput, type SurfaceMessage, type SystemPromptParams, type SystemPromptSegments, TOOL_SEARCH_TOOL, TaskNoticeTracker, type TodoItem, type ToolCall, type ToolConflict, type ToolGate, type ToolNameFidelity, type ToolNameLookup, ToolRegistry, type ToolRevealState, type ToolScope, type ToolSearchDeps, type ToolTableCost, type TraceInput, type TraceNode, TrackerDB, type TrustDecision, type TrustGate, type TrustGateOptions, TrustManager, type TurnRecord, type TurnTiming, type UpdateScheduleInput, type UtilityModelInfo, type ValidateScheduleInput, type VersionCheck, Workspace, type WorkspaceFiles, type WorkspaceIssue, type WorkspaceIssueKind, acquireScheduleLock, addMarketplace, addUsage, admitArtifact, admitArtifacts, affectedPaths, artifactLaunchArgv, artifactOpenRefusal, assertLevelAllowed, blockedRoleTools, buildContextBreakdown, buildFireArgv, buildFtsMatchQuery, buildSchemaExports, buildSystemPrompt, buildTrigramMatchQuery, builtinRoles, checkEpochVersion, checkFtsHealth, checkShadowing, classifyProviderError, clearModelCache, codeModeWorkerPath, commandNameFromRelPath, compileRuleLists, compressionOptions, computeCost, computeCostMicros, countRules, createAllowAllGate, createAllowAllImportGate, createAskQuestionTool, createCodeExecTool, createDelegateTool, createDenyAllGate, createDenyAllImportGate, createGoalTool, createImportGate, createMemoryTool, createPlanModeTools, createRoleFile, createRoleScope, createRunCodeTool, 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, escapeRuleContent, estimateImageTokens, estimateRunTokens, estimateTokens, evaluateSelection, expandCommand, expandImports, explainSetting, findInstructionFiles, findProjectInstructions, findRole, formatBytes, formatSkillIndex, formatUsd, gateForTool, getCapability, getConfigIssues, getConfigOrigins, getImportGate, getTrustGate, hasPromptCaching, hasProviderCredentials, imageFromBase64, imageFromPath, imagePartTokens, importSkills, installPlugin, instructionDirs, instructionNotices, intervalSlots, inventoryTotal, isBlockCode, isCodeModeDeferred, isEmptyRules, isGoalPhase, isNonInteractive, isReadOnlySubCall, isSettingWriteLayer, isValidPluginName, isWithinWindow, isWritableSettingKey, labelSlug, layerRank, listSessionCandidates, listWorkspaceFiles, loadCommandDefinitions, loadCommandFile, loadCommands, loadConfig, loadHookSources, loadKeybindings, loadLexiconDir, loadLexiconFiles, loadPlugins, loadPolicyFiles, loadPolicyRules, loadRoleDefinitions, loadRoleDir, loadedImports, localDateString, managedSwitchNotes, mapClaudeToolName, mapEpochToolName, mapOperationType, matchPreauthorization, matchRuleLists, matchesHook, mergeHeadlessPolicy, mergeRoles, microsToUsd, modelListCandidates, needsAllowlist, nextFallbackModel, nextRunAt, noConfigOrigins, noManagedPolicy, noPlugins, openArtifact, originOf, parseClaudeSettingsHooks, parseClock, parseDate, parseFrontmatter, parseHooksConfig, parseHooksConfigVerbose, parseImportLine, parseModelList, parseRoleDefinition, parseSkillFrontmatter, pendingImageTokens, persistParts, persistToolResults, previewSkillImport, pruneArtifacts, pruneRecordings, pruneSchedules, readImageSize, readMarketplaces, readPluginManifest, readPluginRecords, readProviderKeyEnv, readRecording, readSessionSurface, reclaimFtsSpace, redactLine, refreshOpenRouterMetadata, removeMarketplace, removeSessionArtifacts, renderImportTree, renderProjectContext, renderSdkDeclaration, repairSchedules, resolveArtifactRetention, resolveCodeModeWorker, resolveComplianceDirs, resolveEntrySource, resolveInWorkspace, resolveMarketplaceRef, resolveMentions, resolveMultimodalPolicy, resolvePolicyDirs, resolveProjectRoot, resolveScheduleBackend, resolveSessionReference, resolveSessionVisibility, resolveSettings, resolveSkillDirs, resolveSource, resolveWorkspace, restoreParts, revealScopedProvider, roleScopedProvider, roleSourceLabel, ruleCovers, ruleFromString, ruleToString, runCode, runCommand, sanitizeArgNames, sanitizeCommand, sanitizeFtsQuery, sanitizePath, sanitizeToolOutput, scanInstructions, scanPluginDir, scanSkillDirs, searchMarketplaces, setImportGate, setPluginEnabled, setTrustGate, settingValueChoices, settingValueKind, settingWriteLayers, settingWriteTargets, skillIndexDescription, skillIndexResidency, skillIndexStats, sniffMediaType, splitFrontmatter, staticToolProvider, stripArtifactData, 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 };
|
|
16306
|
+
export { AGENT_ROLE_DIAG_MODULE, ARTIFACT_MAX_TOTAL_BYTES, ARTIFACT_RETENTION_DEFAULTS, type AcquireResult, type AgentConfig, AgentLoop, type AgentProvider, type AgentSite, type AgentSiteRef, type AppendMessageInput, ApprovalCache, type ApprovalDecision, type ApprovalScope, type ArtifactOpenRefusal, type ArtifactRetention, type AskQuestionDeps, 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_GOAL_MAX_ROUNDS, DEFAULT_MAX_HOLD_CHARS, type DelegateArgs, type DelegateConfig, DelegateManager, type DelegateTaskResult, type DiagnoseOptions, type DiscoverOutcome, type DiscoveredFile, type DoctorReport, EMPTY_RULES, EPOCH_DISK_LEDGER, EpochConfigSchema, type ExpandOptions, FTS_TABLES, FTS_TRIGGERS, type FallbackEvent, type FileSlots, type FileSourceKind, type ForkInput, type FrontmatterParse, type FrontmatterSplit, type FtsHealth, type FtsReclaim, type FtsSpace, type FtsTableHealth, GOAL_BLOCK_CODES, type GateAxis, type GateVerdict, type GenerateInput, type GenerateOutput, type Goal, type GoalBlockReason, type GoalClear, type GoalPhase, type GoalPromptView, type GoalRefusal, type GoalRoundResult, GoalService, GoalStore, type GoalToolDeps, type GoalWrite, HEADLESS_AUDIT_CODES, type HeadlessPolicy, type HookConfigEntry, HookManager, type HookManagerOptions, type HookMatcher, type HookSourceKind, type HookSourceStatus, type HookSourcesOptions, type HookSourcesSummary, type HooksParseOutcome, type MemoryManager$1 as IMemoryManager, INSTRUCTION_BUDGET_CHARS, INSTRUCTION_FILES, type SessionManager$1 as ISessionManager, type SkillSystem$1 as ISkillSystem, ImageLoadError, type ImageSize, type ImportDecision, type ImportGate, type ImportNode, type ImportSkipReason, ImportTrustStore, type InstallOptions, type InstallOutcome, type InstallPreview, type InstructionScan, type InstructionSource, type IsolationReason, type IsolationReport, type JsonSchemaDocument, LAUNCHD_LABEL_PREFIX, LOCK_HEARTBEAT_MS, LOCK_STALE_MS, type 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_FILE, MAX_AUDIT_ENTRIES, MAX_COMMAND_DEPTH, MAX_GOAL_MAX_ROUNDS, MAX_IMPORT_DEPTH, MAX_OBJECTIVE_CHARS, MAX_REASON_CHARS, MAX_RECENT_WORKSPACES, MODEL_GIVE_UP_THRESHOLD, MULTIMODAL_DEFAULTS, type ManagedPolicy, ManagedPolicyError, type ManagedSettings, ManagedSettingsSchema, type MarketplaceCatalog, type MarketplaceEntry, type MarketplaceOutcome, type MarketplaceRecord, type MemoryConfig, type MemoryEntry, MemoryManager, MemoryReviewer, type MemorySearchResult, type MemoryTarget, type MemoryWriteResult, type MentionPart, type MentionResolution, type Message, type MessageHit, type MessageRecord, type MessageSurface, type ModelCapability, ModelFailureTracker, type ModelMetaEntry, type ModelPricing, type MultimodalPolicy, NOMINAL_TOTAL_BYTES, NO_REVEALED_TOOLS, type NonInteractiveProbe, type OsTaskSnapshot, type OutputGuard, PERMISSION_AUDIT_CODES, PLUGIN_LAYOUT, PLUGIN_MANIFEST_FILE, PLUGIN_NAME_PATTERN, PLUGIN_ROOT_ENV, PLUGIN_ROOT_TOKEN, POLICY_DECISIONS, PROJECT_AGENTS_SUBDIR, PROVIDER_NO_CREDENTIAL, type PermissionAuditCode, type PermissionAuditEntry, type PermissionAuditOutcome, type PermissionAuditScope, type PermissionAuditSnapshot, PermissionManager, type PersistedBudget, type PersistedPart, type PlanApprovalFn, type PlanEnterResult, type PlanModeDeps, PlanModeState, type PlanSettlement, type PluginArtifacts, type PluginCommandDir, type PluginCounts, type PluginHookFile, type PluginInventory, type PluginLoadOptions, type PluginManifest, type PluginPathRef, type PluginRecord, type PluginSettingsFile, type PluginSourceType, type PluginStateReadOutcome, PluginStore, type PolicyDirSpec, type PolicyDirsSummary, type PolicyLoadOutcome, type PolicyRule, PolicyRuleSchema, type ProjectContext, ProviderError, ProviderRouter, type ProviderStreamChunk, type ProviderToolCall$1 as ProviderToolCall, type ProviderWarning, type PruneResult, type QuestionAskFn, RECORDING_KEEP_RUNS, RECORDING_MAX_BYTES, ROLE_FRONTMATTER_SCHEMA, RUN_CODE_TOOL, type ReadMessagesInput, type ReadMessagesOutput, type RecentWorkspace, RecentWorkspaces, type RecordRunInput, type RecorderOptions, type RecoveryAction, type RegisterInput, type RegisterOutcome, type RegistrarOptions, type RegistrationPatch, type RepairOutcome, type ResolveMentionsOptions, type ResolveReferenceInput, type ResolveSettingsOptions, type ResolvedCompression, type ResolvedReference, type ResolvedSource, type ResponseFormat, type RestorePartsOptions, type ReviewIssue, type RewindAction, type RewindDrift, type RewindFilePlan, type RewindOptions, type RewindOutcome, type RewindPreview, type RoleCreateFailure, type RoleCreateInput, type RoleCreateOptions, type RoleCreateOutcome, type RoleLoadOutcome, type RoleLoadSummary, type RoleMergeNotice, type RoleMergeResult, type RoleScope, type RuleMatch, type RuleSuggestion, type RuleVerdict, type RunCodeFailure, type RunCodeInput, type RunCodeOutcome, type RunCodeToolDeps, type RunEstimateInput, type RunInput, type RunResult, SANDBOX_COVERS, SANDBOX_EXCLUDES, SCALAR_KEYS, SCHEDULE_DEFAULTS, SCHEDULE_DEFAULT_ALLOWLIST, SCHEDULE_ISSUE_CODES, SCHTASKS_FOLDER, SESSION_MESSAGES_READ_TOOL, SESSION_MESSAGES_SEARCH_TOOL, SESSION_QUERY_TOOLS, SESSION_SEARCH_TOOL, SESSION_TRACE_TOOL, SETTINGS_LAYER_ORDER, SETTING_WRITE_APPLY, 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 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 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 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 SubAgentRunner, type SubTask, type SubToolCaller, type SummarizeOutput, type SurfaceMessage, type SystemPromptParams, type SystemPromptSegments, TOOL_SEARCH_TOOL, TaskNoticeTracker, type TodoItem, type ToolCall, type ToolConflict, type ToolGate, type ToolNameFidelity, type ToolNameLookup, ToolRegistry, type ToolRevealState, type ToolScope, type ToolSearchDeps, type ToolTableCost, type TraceInput, type TraceNode, TrackerDB, type TrustDecision, type TrustGate, type TrustGateOptions, TrustManager, type TurnRecord, type TurnTiming, type UpdateScheduleInput, type UtilityModelInfo, type ValidateScheduleInput, type VersionCheck, Workspace, type WorkspaceFiles, type WorkspaceIssue, type WorkspaceIssueKind, acquireScheduleLock, addMarketplace, addUsage, admitArtifact, admitArtifacts, affectedPaths, artifactLaunchArgv, artifactOpenRefusal, assertLevelAllowed, blockedRoleTools, buildContextBreakdown, buildFireArgv, buildFtsMatchQuery, buildSchemaExports, buildSystemPrompt, buildTrigramMatchQuery, builtinRoles, checkEpochVersion, checkFtsHealth, checkShadowing, classifyProviderError, clearModelCache, codeModeWorkerPath, commandNameFromRelPath, compileRuleLists, compressionOptions, computeCost, computeCostMicros, countRules, createAllowAllGate, createAllowAllImportGate, createAskQuestionTool, createCodeExecTool, createDelegateTool, createDenyAllGate, createDenyAllImportGate, createGoalTool, createImportGate, createMemoryTool, createPlanModeTools, createRoleFile, createRoleScope, createRunCodeTool, 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, escapeRuleContent, estimateImageTokens, estimateRunTokens, estimateTokens, evaluateSelection, expandCommand, expandImports, explainSetting, findInstructionFiles, findProjectInstructions, findRole, formatBytes, formatSkillIndex, formatUsd, gateForTool, getCapability, getConfigIssues, getConfigOrigins, getImportGate, getTrustGate, hasPromptCaching, hasProviderCredentials, imageFromBase64, imageFromPath, imagePartTokens, importSkills, installPlugin, instructionDirs, instructionNotices, intervalSlots, inventoryTotal, isBlockCode, isCodeModeDeferred, isEmptyRules, isGoalPhase, isNonInteractive, isReadOnlySubCall, isSettingWriteLayer, isValidPluginName, isWithinWindow, isWritableSettingKey, labelSlug, layerRank, 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, microsToUsd, modelListCandidates, needsAllowlist, nextFallbackModel, nextRunAt, noConfigOrigins, noManagedPolicy, noPlugins, openArtifact, originOf, parseClaudeSettingsHooks, parseClock, parseDate, parseFrontmatter, parseHooksConfig, parseHooksConfigVerbose, parseImportLine, parseModelList, parseRoleDefinition, parseSkillFrontmatter, pendingImageTokens, persistParts, persistToolResults, persistedUsage, previewSkillImport, pruneArtifacts, pruneRecordings, pruneSchedules, readImageSize, readMarketplaces, readPluginManifest, readPluginRecords, readProviderKeyEnv, readRecording, readSessionSurface, reclaimFtsSpace, redactLine, refreshOpenRouterMetadata, removeMarketplace, removeSessionArtifacts, renderImportTree, renderProjectContext, renderSdkDeclaration, repairSchedules, resolveArtifactRetention, resolveCodeModeWorker, resolveComplianceDirs, resolveEntrySource, resolveInWorkspace, resolveMarketplaceRef, resolveMentions, resolveMultimodalPolicy, resolvePolicyDirs, resolveProjectRoot, resolveScheduleBackend, resolveSessionReference, resolveSessionVisibility, resolveSettings, resolveSkillDirs, resolveSource, resolveWorkspace, restoreParts, revealScopedProvider, roleScopedProvider, roleSourceLabel, ruleCovers, ruleFromString, ruleToString, runCode, runCommand, sanitizeArgNames, sanitizeCommand, sanitizeFtsQuery, sanitizePath, sanitizeToolOutput, scanInstructions, scanPluginDir, scanSkillDirs, searchMarketplaces, setImportGate, setPluginEnabled, setTrustGate, settingValueChoices, settingValueKind, 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, readdirSync, readFileSync, mkdirSync, writeFileSync, rmSync
|
|
|
2
2
|
import { homedir, platform, tmpdir, hostname } from 'os';
|
|
3
3
|
import { join, dirname, isAbsolute, resolve, relative, sep, extname, basename } from 'path';
|
|
4
4
|
import { execFile, execSync, execFileSync, spawn } from 'child_process';
|
|
5
|
-
import { createLogger, dbPath, resolveHomeDir, t, unknownKeyIssues, parseLenient, issueDetails, splitWords, checkpointsDir, trustedImportsPath, artifactsDir, configPath, managedSettingsPath, projectSettingsPath, projectLocalSettingsPath, getSecretValues, listStoredSecretNames, maskApiKey,
|
|
5
|
+
import { createLogger, dbPath, resolveHomeDir, t, unknownKeyIssues, parseLenient, issueDetails, splitWords, checkpointsDir, trustedImportsPath, budgetStatePath, artifactsDir, configPath, managedSettingsPath, projectSettingsPath, projectLocalSettingsPath, getSecretValues, listStoredSecretNames, maskApiKey, setSectionField, isInWorkspace, workspacesPath, openDatabase, migrate, releaseDatabase, automationLogsDir, projectPoliciesDir, projectComplianceDir, projectHooksPath, projectClaudeSettingsPath, projectClaudeLocalSettingsPath, projectSkillsDir, trustPath, detectBackend, EXEC_PATH_AS_NODE_ENV, isolate, createStreamDecoder, writeArtifact, parseShellCommand, envPath, checkDangerousCommand, checkObfuscation, countCodePoints, keepHeadAndTail, normalizeForMatch, isReadOnlyCommand, CODE_EXEC_ROOTS } 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, COMPLIANCE_CATEGORIES, COMPLIANCE_ACTIONS, SEARCH_PROVIDER_TYPES, LANGS, PERMISSION_LEVELS, SHELL_KINDS, ToolExposure, MAX_OPTIONS, MIN_OPTIONS, MAX_HEADER_CHARS, MAX_QUESTIONS, isValidAgentRoleName, DEFAULT_AGENT_ROLE, isValidCommandName, RESERVED_COMMAND_NAMES, parseModelRef, systemNote, totalUsageTokens, NOOP_TELEMETRY, METRIC, contentToText, GEN_AI, promptTokens, apiKeyEnvVar, PROVIDER_INFOS, isProviderType, API_KEY_ENV_VARS, isPermissionLevel, KEY_ACTIONS, tableOf, perAction, isKeyAction, parseSequence, RESERVED_CHORDS, chordId, sequenceId, ACTION_CONTEXTS, SEQUENCE_CONTEXTS, assertNeverPart, SCHEDULE_INTERVAL_MINUTES, MAX_ATTACH_FILES, MAX_ATTACH_TOTAL_BYTES, MAX_SESSION_REFS, utf8ByteLength, attachSessionSurface, isContextNearlyFull, isOperationType, normalizeApproval, 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';
|
|
@@ -5346,6 +5346,15 @@ async function withDownloadDir(fn) {
|
|
|
5346
5346
|
rmSync(dir, { recursive: true, force: true });
|
|
5347
5347
|
}
|
|
5348
5348
|
}
|
|
5349
|
+
// src/plugin/root-token.ts
|
|
5350
|
+
var PLUGIN_ROOT_TOKEN = "${EPOCH_PLUGIN_ROOT}";
|
|
5351
|
+
var PLUGIN_ROOT_ENV = "EPOCH_PLUGIN_ROOT";
|
|
5352
|
+
function mentionsPluginRoot(text) {
|
|
5353
|
+
return text.includes(PLUGIN_ROOT_TOKEN);
|
|
5354
|
+
}
|
|
5355
|
+
function substitutePluginRoot(text, root) {
|
|
5356
|
+
return text.split(PLUGIN_ROOT_TOKEN).join(root);
|
|
5357
|
+
}
|
|
5349
5358
|
async function uninstallPlugin(name, opts) {
|
|
5350
5359
|
const removed = await new PluginStore(opts.statePath).mutate((records) => {
|
|
5351
5360
|
const hit = records.find((r) => r.name === name);
|
|
@@ -7513,6 +7522,80 @@ function getGitStatus(rootDir) {
|
|
|
7513
7522
|
function findProjectInstructions(rootDir, workDir = rootDir) {
|
|
7514
7523
|
return findInstructionFiles(rootDir, workDir)[0];
|
|
7515
7524
|
}
|
|
7525
|
+
function persistedUsage(entry) {
|
|
7526
|
+
return {
|
|
7527
|
+
...entry.usage,
|
|
7528
|
+
...entry.microUsd !== void 0 ? { costUsd: microsToUsd(entry.microUsd) } : {}
|
|
7529
|
+
};
|
|
7530
|
+
}
|
|
7531
|
+
var RETENTION_DAYS = 7;
|
|
7532
|
+
var BudgetStore = class {
|
|
7533
|
+
path;
|
|
7534
|
+
onWarn;
|
|
7535
|
+
constructor(opts = {}) {
|
|
7536
|
+
this.path = opts.path ?? budgetStatePath();
|
|
7537
|
+
this.onWarn = opts.onWarn;
|
|
7538
|
+
}
|
|
7539
|
+
load(sessionId) {
|
|
7540
|
+
const state = this.read();
|
|
7541
|
+
const entry = state.sessions[sessionId];
|
|
7542
|
+
return isPersisted(entry) ? entry : void 0;
|
|
7543
|
+
}
|
|
7544
|
+
save(sessionId, entry) {
|
|
7545
|
+
const state = this.read();
|
|
7546
|
+
state.sessions[sessionId] = entry;
|
|
7547
|
+
prune(state, entry.updatedAt);
|
|
7548
|
+
this.write(state);
|
|
7549
|
+
}
|
|
7550
|
+
read() {
|
|
7551
|
+
const empty = { version: 1, sessions: {} };
|
|
7552
|
+
if (!existsSync(this.path)) return empty;
|
|
7553
|
+
try {
|
|
7554
|
+
const parsed = JSON.parse(readFileSync(this.path, "utf-8"));
|
|
7555
|
+
const sessions = parsed?.sessions;
|
|
7556
|
+
if (!sessions || typeof sessions !== "object" || Array.isArray(sessions)) {
|
|
7557
|
+
throw new Error(t("budget.state_missing_sessions"));
|
|
7558
|
+
}
|
|
7559
|
+
return { version: 1, sessions };
|
|
7560
|
+
} catch (err) {
|
|
7561
|
+
const reason9 = err instanceof Error ? err.message : String(err);
|
|
7562
|
+
this.quarantine();
|
|
7563
|
+
this.onWarn?.(t("budget.state_corrupt", { reason: reason9, path: this.path }));
|
|
7564
|
+
return empty;
|
|
7565
|
+
}
|
|
7566
|
+
}
|
|
7567
|
+
quarantine() {
|
|
7568
|
+
try {
|
|
7569
|
+
renameSync(this.path, `${this.path}.corrupt`);
|
|
7570
|
+
} catch {
|
|
7571
|
+
}
|
|
7572
|
+
}
|
|
7573
|
+
write(state) {
|
|
7574
|
+
try {
|
|
7575
|
+
mkdirSync(dirname(this.path), { recursive: true });
|
|
7576
|
+
writeFileSync(this.path, JSON.stringify(state, null, 2));
|
|
7577
|
+
} catch (err) {
|
|
7578
|
+
this.onWarn?.(
|
|
7579
|
+
t("budget.state_write_failed", {
|
|
7580
|
+
message: err instanceof Error ? err.message : String(err)
|
|
7581
|
+
})
|
|
7582
|
+
);
|
|
7583
|
+
}
|
|
7584
|
+
}
|
|
7585
|
+
};
|
|
7586
|
+
function isPersisted(entry) {
|
|
7587
|
+
if (!entry || typeof entry !== "object") return false;
|
|
7588
|
+
const e = entry;
|
|
7589
|
+
return typeof e.usage?.inputTokens === "number" && typeof e.usage?.outputTokens === "number" && Number.isFinite(e.usage.inputTokens) && Number.isFinite(e.usage.outputTokens);
|
|
7590
|
+
}
|
|
7591
|
+
function prune(state, now) {
|
|
7592
|
+
const cutoff = now - RETENTION_DAYS * 24 * 60 * 60 * 1e3;
|
|
7593
|
+
for (const [id, entry] of Object.entries(state.sessions)) {
|
|
7594
|
+
if (!isPersisted(entry) || (entry.updatedAt ?? 0) < cutoff) {
|
|
7595
|
+
delete state.sessions[id];
|
|
7596
|
+
}
|
|
7597
|
+
}
|
|
7598
|
+
}
|
|
7516
7599
|
// src/cost/types.ts
|
|
7517
7600
|
var DEFAULT_WARN_AT_PERCENT = 80;
|
|
7518
7601
|
// src/cost/budget-guard.ts
|
|
@@ -7636,10 +7719,10 @@ var BudgetGuard = class {
|
|
|
7636
7719
|
};
|
|
7637
7720
|
}
|
|
7638
7721
|
snapshot() {
|
|
7639
|
-
return {
|
|
7640
|
-
|
|
7641
|
-
...this.micros !== void 0 ? {
|
|
7642
|
-
};
|
|
7722
|
+
return persistedUsage({
|
|
7723
|
+
usage: this.usage,
|
|
7724
|
+
...this.micros !== void 0 ? { microUsd: this.micros } : {}
|
|
7725
|
+
});
|
|
7643
7726
|
}
|
|
7644
7727
|
status() {
|
|
7645
7728
|
const breach = this.breachReason();
|
|
@@ -9530,6 +9613,13 @@ var SidebarMenuItemSchema = z.object({
|
|
|
9530
9613
|
label: z.string().min(1),
|
|
9531
9614
|
icon: z.string().min(1).optional()
|
|
9532
9615
|
});
|
|
9616
|
+
var BlankCardSchema = z.object({
|
|
9617
|
+
id: z.string().min(1),
|
|
9618
|
+
title: z.string().min(1),
|
|
9619
|
+
subtitle: z.string().min(1).optional(),
|
|
9620
|
+
prompt: z.string().min(1),
|
|
9621
|
+
icon: z.string().min(1).optional()
|
|
9622
|
+
});
|
|
9533
9623
|
var ArtifactsSchema = z.object({
|
|
9534
9624
|
maxAgeDays: z.int().positive().max(3650).default(ARTIFACT_RETENTION_DEFAULTS.maxAgeDays),
|
|
9535
9625
|
maxTotalBytes: z.int().positive().default(ARTIFACT_RETENTION_DEFAULTS.maxTotalBytes)
|
|
@@ -9580,6 +9670,9 @@ var EpochConfigSchema = z.object({
|
|
|
9580
9670
|
brand: z.string().min(1).optional(),
|
|
9581
9671
|
sidebarMenu: z.array(SidebarMenuItemSchema).min(1).refine((items) => new Set(items.map((item) => item.id)).size === items.length, {
|
|
9582
9672
|
message: "sidebarMenu: id must be unique"
|
|
9673
|
+
}).optional(),
|
|
9674
|
+
blankCards: z.array(BlankCardSchema).min(1).refine((items) => new Set(items.map((item) => item.id)).size === items.length, {
|
|
9675
|
+
message: "blankCards: id must be unique"
|
|
9583
9676
|
}).optional()
|
|
9584
9677
|
});
|
|
9585
9678
|
function defaultConfig() {
|
|
@@ -11742,74 +11835,6 @@ function clearModelCache(homeDir, provider) {
|
|
|
11742
11835
|
} catch {
|
|
11743
11836
|
}
|
|
11744
11837
|
}
|
|
11745
|
-
var RETENTION_DAYS = 7;
|
|
11746
|
-
var BudgetStore = class {
|
|
11747
|
-
path;
|
|
11748
|
-
onWarn;
|
|
11749
|
-
constructor(opts = {}) {
|
|
11750
|
-
this.path = opts.path ?? budgetStatePath();
|
|
11751
|
-
this.onWarn = opts.onWarn;
|
|
11752
|
-
}
|
|
11753
|
-
load(sessionId) {
|
|
11754
|
-
const state = this.read();
|
|
11755
|
-
const entry = state.sessions[sessionId];
|
|
11756
|
-
return isPersisted(entry) ? entry : void 0;
|
|
11757
|
-
}
|
|
11758
|
-
save(sessionId, entry) {
|
|
11759
|
-
const state = this.read();
|
|
11760
|
-
state.sessions[sessionId] = entry;
|
|
11761
|
-
prune(state, entry.updatedAt);
|
|
11762
|
-
this.write(state);
|
|
11763
|
-
}
|
|
11764
|
-
read() {
|
|
11765
|
-
const empty = { version: 1, sessions: {} };
|
|
11766
|
-
if (!existsSync(this.path)) return empty;
|
|
11767
|
-
try {
|
|
11768
|
-
const parsed = JSON.parse(readFileSync(this.path, "utf-8"));
|
|
11769
|
-
const sessions = parsed?.sessions;
|
|
11770
|
-
if (!sessions || typeof sessions !== "object" || Array.isArray(sessions)) {
|
|
11771
|
-
throw new Error(t("budget.state_missing_sessions"));
|
|
11772
|
-
}
|
|
11773
|
-
return { version: 1, sessions };
|
|
11774
|
-
} catch (err) {
|
|
11775
|
-
const reason9 = err instanceof Error ? err.message : String(err);
|
|
11776
|
-
this.quarantine();
|
|
11777
|
-
this.onWarn?.(t("budget.state_corrupt", { reason: reason9, path: this.path }));
|
|
11778
|
-
return empty;
|
|
11779
|
-
}
|
|
11780
|
-
}
|
|
11781
|
-
quarantine() {
|
|
11782
|
-
try {
|
|
11783
|
-
renameSync(this.path, `${this.path}.corrupt`);
|
|
11784
|
-
} catch {
|
|
11785
|
-
}
|
|
11786
|
-
}
|
|
11787
|
-
write(state) {
|
|
11788
|
-
try {
|
|
11789
|
-
mkdirSync(dirname(this.path), { recursive: true });
|
|
11790
|
-
writeFileSync(this.path, JSON.stringify(state, null, 2));
|
|
11791
|
-
} catch (err) {
|
|
11792
|
-
this.onWarn?.(
|
|
11793
|
-
t("budget.state_write_failed", {
|
|
11794
|
-
message: err instanceof Error ? err.message : String(err)
|
|
11795
|
-
})
|
|
11796
|
-
);
|
|
11797
|
-
}
|
|
11798
|
-
}
|
|
11799
|
-
};
|
|
11800
|
-
function isPersisted(entry) {
|
|
11801
|
-
if (!entry || typeof entry !== "object") return false;
|
|
11802
|
-
const e = entry;
|
|
11803
|
-
return typeof e.usage?.inputTokens === "number" && typeof e.usage?.outputTokens === "number" && Number.isFinite(e.usage.inputTokens) && Number.isFinite(e.usage.outputTokens);
|
|
11804
|
-
}
|
|
11805
|
-
function prune(state, now) {
|
|
11806
|
-
const cutoff = now - RETENTION_DAYS * 24 * 60 * 60 * 1e3;
|
|
11807
|
-
for (const [id, entry] of Object.entries(state.sessions)) {
|
|
11808
|
-
if (!isPersisted(entry) || (entry.updatedAt ?? 0) < cutoff) {
|
|
11809
|
-
delete state.sessions[id];
|
|
11810
|
-
}
|
|
11811
|
-
}
|
|
11812
|
-
}
|
|
11813
11838
|
var SETTING_WRITE_LAYERS = ["user", "projectLocal"];
|
|
11814
11839
|
function isSettingWriteLayer(value) {
|
|
11815
11840
|
return SETTING_WRITE_LAYERS.includes(value);
|
|
@@ -17617,17 +17642,18 @@ function sanitizeEnvironment(env) {
|
|
|
17617
17642
|
}
|
|
17618
17643
|
return clean;
|
|
17619
17644
|
}
|
|
17620
|
-
function injectEpochEnv(event) {
|
|
17645
|
+
function injectEpochEnv(event, pluginRoot2) {
|
|
17621
17646
|
return {
|
|
17622
17647
|
EPOCH_SESSION_ID: event.sessionId,
|
|
17623
17648
|
EPOCH_CWD: process.cwd(),
|
|
17624
|
-
EPOCH_EVENT_NAME: event.type
|
|
17649
|
+
EPOCH_EVENT_NAME: event.type,
|
|
17650
|
+
...pluginRoot2 === void 0 ? {} : { [PLUGIN_ROOT_ENV]: pluginRoot2 }
|
|
17625
17651
|
};
|
|
17626
17652
|
}
|
|
17627
17653
|
function runCommandHook(config, event, workDir) {
|
|
17628
17654
|
const timeout = config.timeout ?? 3e4;
|
|
17629
17655
|
const baseEnv = sanitizeEnvironment(process.env);
|
|
17630
|
-
const injectedEnv = injectEpochEnv(event);
|
|
17656
|
+
const injectedEnv = injectEpochEnv(event, config.pluginRoot);
|
|
17631
17657
|
const hookEnv = { ...baseEnv, ...injectedEnv, ...config.env };
|
|
17632
17658
|
return new Promise((resolve15) => {
|
|
17633
17659
|
const child = spawn(config.command, {
|
|
@@ -18111,7 +18137,7 @@ var FATAL_HOOK_FIELDS = ["args"];
|
|
|
18111
18137
|
var COSMETIC_HOOK_FIELDS = ["statusMessage"];
|
|
18112
18138
|
var PROJECT_DIR_TOKEN = "${CLAUDE_PROJECT_DIR}";
|
|
18113
18139
|
var PROJECT_DIR_ENV = "CLAUDE_PROJECT_DIR";
|
|
18114
|
-
var
|
|
18140
|
+
var PLUGIN_ROOT_TOKEN2 = "${CLAUDE_PLUGIN_ROOT}";
|
|
18115
18141
|
function parseClaudeSettingsHooks(raw, opts = {}) {
|
|
18116
18142
|
const entries = /* @__PURE__ */ new Map();
|
|
18117
18143
|
const issues = [];
|
|
@@ -18242,7 +18268,7 @@ function substitute(command, at, opts, issues) {
|
|
|
18242
18268
|
out = out.split(PROJECT_DIR_TOKEN).join(opts.projectDir);
|
|
18243
18269
|
}
|
|
18244
18270
|
}
|
|
18245
|
-
if (out.includes(
|
|
18271
|
+
if (out.includes(PLUGIN_ROOT_TOKEN2)) {
|
|
18246
18272
|
issues.push({ path: at, message: t("hook.claude_no_plugin_root") });
|
|
18247
18273
|
}
|
|
18248
18274
|
return out;
|
|
@@ -18261,7 +18287,8 @@ function loadHookSources(opts) {
|
|
|
18261
18287
|
let pluginCount = 0;
|
|
18262
18288
|
for (const entry of opts.pluginPaths ?? []) {
|
|
18263
18289
|
const pluginIssues = [];
|
|
18264
|
-
const
|
|
18290
|
+
const parsed = readAndParse(entry.path, pluginIssues, { pluginRoot: dirname(entry.path) });
|
|
18291
|
+
const count = mergeInto(entries, parsed);
|
|
18265
18292
|
pluginCount += count;
|
|
18266
18293
|
sources.push({ kind: "plugin", path: entry.path, count, plugin: entry.plugin });
|
|
18267
18294
|
for (const issue of pluginIssues) {
|
|
@@ -18270,6 +18297,7 @@ function loadHookSources(opts) {
|
|
|
18270
18297
|
}
|
|
18271
18298
|
const legacy = parseHooksConfigVerbose(legacyHooks);
|
|
18272
18299
|
issues.push(...atFile(LEGACY_AT, legacy.issues));
|
|
18300
|
+
applyPluginRoot(legacy.entries, void 0, LEGACY_AT, issues);
|
|
18273
18301
|
const legacyCount = mergeInto(entries, legacy.entries);
|
|
18274
18302
|
if (legacyCount > 0) {
|
|
18275
18303
|
sources.push({ kind: "legacy", path: LEGACY_AT, count: legacyCount });
|
|
@@ -18371,15 +18399,40 @@ function readAndParseClaude(path, projectRoot, issues) {
|
|
|
18371
18399
|
projectRoot === void 0 ? {} : { projectDir: projectRoot }
|
|
18372
18400
|
);
|
|
18373
18401
|
issues.push(...atFile(path, parsed.issues));
|
|
18402
|
+
applyPluginRoot(parsed.entries, void 0, path, issues);
|
|
18374
18403
|
return parsed.entries;
|
|
18375
18404
|
}
|
|
18376
|
-
function readAndParse(path, issues) {
|
|
18405
|
+
function readAndParse(path, issues, opts = {}) {
|
|
18377
18406
|
const raw = readHooksFile(path, issues);
|
|
18378
18407
|
if (!raw) return /* @__PURE__ */ new Map();
|
|
18379
18408
|
const parsed = parseHooksConfigVerbose(raw);
|
|
18380
18409
|
issues.push(...atFile(path, parsed.issues));
|
|
18410
|
+
applyPluginRoot(parsed.entries, opts.pluginRoot, path, issues);
|
|
18381
18411
|
return parsed.entries;
|
|
18382
18412
|
}
|
|
18413
|
+
function applyPluginRoot(entries, root, path, issues) {
|
|
18414
|
+
for (const [type, list] of entries) {
|
|
18415
|
+
for (const [i, entry] of list.entries()) {
|
|
18416
|
+
for (const [j, hook] of entry.hooks.entries()) {
|
|
18417
|
+
const at = `${path}: hooks.${type}.${i}.${j}`;
|
|
18418
|
+
const envValues = Object.values(hook.env ?? {});
|
|
18419
|
+
if (root === void 0) {
|
|
18420
|
+
if (mentionsPluginRoot(hook.command) || envValues.some(mentionsPluginRoot)) {
|
|
18421
|
+
issues.push({ path: at, message: t("hook_load.no_plugin_root") });
|
|
18422
|
+
}
|
|
18423
|
+
continue;
|
|
18424
|
+
}
|
|
18425
|
+
hook.command = substitutePluginRoot(hook.command, root);
|
|
18426
|
+
if (hook.env !== void 0) {
|
|
18427
|
+
for (const [key, value] of Object.entries(hook.env)) {
|
|
18428
|
+
hook.env[key] = substitutePluginRoot(value, root);
|
|
18429
|
+
}
|
|
18430
|
+
}
|
|
18431
|
+
hook.pluginRoot = root;
|
|
18432
|
+
}
|
|
18433
|
+
}
|
|
18434
|
+
}
|
|
18435
|
+
}
|
|
18383
18436
|
function readHooksFile(path, issues, opts = {}) {
|
|
18384
18437
|
if (!existsSync(path)) return void 0;
|
|
18385
18438
|
let raw;
|
|
@@ -20405,4 +20458,4 @@ var TrackerDB = class {
|
|
|
20405
20458
|
* `--tree` 的命令帮助里,让用户自己知道 `--tree` 意味着什么。
|
|
20406
20459
|
*/
|
|
20407
20460
|
|
|
20408
|
-
export { AGENT_ROLE_DIAG_MODULE, ARTIFACT_MAX_TOTAL_BYTES, ARTIFACT_RETENTION_DEFAULTS, AgentLoop, ApprovalCache, BLOCKED_TOOLS, BudgetGuard, BudgetStore, CHECKPOINT_MAX_TOTAL_BYTES, CLAUDE_EVENT_NAMES, CLAUDE_TOOL_NAMES, CODE_MODE_LIMITS, CODE_MODE_SDK_TAG, CONFIG_KEYS, CURRENT_CONFIG_VERSION, CheckpointManager, CheckpointStore, CodeSandbox, ComplianceEngine, ContextCompressor, DEFAULT_COMPLIANCE_ACTIONS, DEFAULT_COMPLIANCE_SETTINGS, DEFAULT_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, MARKETPLACE_FILE, MAX_AUDIT_ENTRIES, MAX_COMMAND_DEPTH, MAX_GOAL_MAX_ROUNDS, MAX_IMPORT_DEPTH, MAX_OBJECTIVE_CHARS, MAX_REASON_CHARS, MAX_RECENT_WORKSPACES, MODEL_GIVE_UP_THRESHOLD, MULTIMODAL_DEFAULTS, ManagedPolicyError, ManagedSettingsSchema, MemoryManager, MemoryReviewer, ModelFailureTracker, NOMINAL_TOTAL_BYTES, NO_REVEALED_TOOLS, PERMISSION_AUDIT_CODES, PLUGIN_LAYOUT, PLUGIN_MANIFEST_FILE, PLUGIN_NAME_PATTERN, POLICY_DECISIONS, PROJECT_AGENTS_SUBDIR, PROVIDER_NO_CREDENTIAL, PermissionManager, PlanModeState, PluginStore, PolicyRuleSchema, ProviderError, ProviderRouter, RECORDING_KEEP_RUNS, RECORDING_MAX_BYTES, ROLE_FRONTMATTER_SCHEMA, RUN_CODE_TOOL, RecentWorkspaces, SANDBOX_COVERS, SANDBOX_EXCLUDES, SCALAR_KEYS, SCHEDULE_DEFAULTS, SCHEDULE_DEFAULT_ALLOWLIST, SCHEDULE_ISSUE_CODES, SCHTASKS_FOLDER, SESSION_MESSAGES_READ_TOOL, SESSION_MESSAGES_SEARCH_TOOL, SESSION_QUERY_TOOLS, SESSION_SEARCH_TOOL, SESSION_TRACE_TOOL, SETTINGS_LAYER_ORDER, SETTING_WRITE_APPLY, SETTING_WRITE_KEYS, SETTING_WRITE_LAYERS, SKILL_CREATE_TOOL, SKILL_EDIT_TOOL, SKILL_PATCH_TOOL, SKILL_VIEW_TOOL, SKILL_WRITE_FILE_TOOL, SLASH_COMMANDS_DIAG_MODULE, ScheduleRecorder, ScheduleRegistrar, ScheduleStore, SessionManager, SessionQueries, SessionReferences, SettingsFileError, SettingsFileSchema, SkillLearner, SkillSystem, TOOL_SEARCH_TOOL, TaskNoticeTracker, ToolRegistry, TrackerDB, TrustManager, Workspace, acquireScheduleLock, addMarketplace, addUsage, admitArtifact, admitArtifacts, affectedPaths, artifactLaunchArgv, artifactOpenRefusal, assertLevelAllowed, blockedRoleTools, buildContextBreakdown, buildFireArgv, buildFtsMatchQuery, buildSchemaExports, buildSystemPrompt, buildTrigramMatchQuery, builtinRoles, checkEpochVersion, checkFtsHealth, checkShadowing, classifyProviderError, clearModelCache, codeModeWorkerPath, commandNameFromRelPath, compileRuleLists, compressionOptions, computeCost, computeCostMicros, countRules, createAllowAllGate, createAllowAllImportGate, createAskQuestionTool, createCodeExecTool, createDelegateTool, createDenyAllGate, createDenyAllImportGate, createGoalTool, createImportGate, createMemoryTool, createPlanModeTools, createRoleFile, createRoleScope, createRunCodeTool, 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, escapeRuleContent, estimateImageTokens, estimateRunTokens, estimateTokens, evaluateSelection, expandCommand, expandImports, explainSetting, findInstructionFiles, findProjectInstructions, findRole, formatBytes, formatSkillIndex, formatUsd, gateForTool, getCapability, getConfigIssues, getConfigOrigins, getImportGate, getTrustGate, hasPromptCaching, hasProviderCredentials, imageFromBase64, imageFromPath, imagePartTokens, importSkills, installPlugin, instructionDirs, instructionNotices, intervalSlots, inventoryTotal, isBlockCode, isCodeModeDeferred, isEmptyRules, isGoalPhase, isNonInteractive, isReadOnlySubCall, isSettingWriteLayer, isValidPluginName, isWithinWindow, isWritableSettingKey, labelSlug, layerRank, listSessionCandidates, listWorkspaceFiles, loadCommandDefinitions, loadCommandFile, loadCommands, loadConfig, loadHookSources, loadKeybindings, loadLexiconDir, loadLexiconFiles, loadPlugins, loadPolicyFiles, loadPolicyRules, loadRoleDefinitions, loadRoleDir, loadedImports, localDateString, managedSwitchNotes, mapClaudeToolName, mapEpochToolName, mapOperationType, matchPreauthorization, matchRuleLists, matchesHook, mergeHeadlessPolicy, mergeRoles, microsToUsd, modelListCandidates, needsAllowlist, nextFallbackModel, nextRunAt, noConfigOrigins, noManagedPolicy, noPlugins, openArtifact, originOf, parseClaudeSettingsHooks, parseClock, parseDate, parseFrontmatter, parseHooksConfig, parseHooksConfigVerbose, parseImportLine, parseModelList, parseRoleDefinition, parseSkillFrontmatter, pendingImageTokens, persistParts, persistToolResults, previewSkillImport, pruneArtifacts, pruneRecordings, pruneSchedules, readImageSize, readMarketplaces, readPluginManifest, readPluginRecords, readProviderKeyEnv, readRecording, readSessionSurface, reclaimFtsSpace, redactLine, refreshOpenRouterMetadata, removeMarketplace, removeSessionArtifacts, renderImportTree, renderProjectContext, renderSdkDeclaration, repairSchedules, resolveArtifactRetention, resolveCodeModeWorker, resolveComplianceDirs, resolveEntrySource, resolveInWorkspace, resolveMarketplaceRef, resolveMentions, resolveMultimodalPolicy, resolvePolicyDirs, resolveProjectRoot, resolveScheduleBackend, resolveSessionReference, resolveSessionVisibility, resolveSettings, resolveSkillDirs, resolveSource, resolveWorkspace, restoreParts, revealScopedProvider, roleScopedProvider, roleSourceLabel, ruleCovers, ruleFromString, ruleToString, runCode, runCommand2 as runCommand, sanitizeArgNames, sanitizeCommand, sanitizeFtsQuery, sanitizePath, sanitizeToolOutput, scanInstructions, scanPluginDir, scanSkillDirs, searchMarketplaces, setImportGate, setPluginEnabled, setTrustGate, settingValueChoices, settingValueKind, settingWriteLayers, settingWriteTargets, skillIndexDescription, skillIndexResidency, skillIndexStats, sniffMediaType, splitFrontmatter, staticToolProvider, stripArtifactData, 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 };
|
|
20461
|
+
export { AGENT_ROLE_DIAG_MODULE, ARTIFACT_MAX_TOTAL_BYTES, ARTIFACT_RETENTION_DEFAULTS, AgentLoop, ApprovalCache, BLOCKED_TOOLS, BudgetGuard, BudgetStore, CHECKPOINT_MAX_TOTAL_BYTES, CLAUDE_EVENT_NAMES, CLAUDE_TOOL_NAMES, CODE_MODE_LIMITS, CODE_MODE_SDK_TAG, CONFIG_KEYS, CURRENT_CONFIG_VERSION, CheckpointManager, CheckpointStore, CodeSandbox, ComplianceEngine, ContextCompressor, DEFAULT_COMPLIANCE_ACTIONS, DEFAULT_COMPLIANCE_SETTINGS, DEFAULT_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, MARKETPLACE_FILE, MAX_AUDIT_ENTRIES, MAX_COMMAND_DEPTH, MAX_GOAL_MAX_ROUNDS, MAX_IMPORT_DEPTH, MAX_OBJECTIVE_CHARS, MAX_REASON_CHARS, MAX_RECENT_WORKSPACES, MODEL_GIVE_UP_THRESHOLD, MULTIMODAL_DEFAULTS, ManagedPolicyError, ManagedSettingsSchema, MemoryManager, MemoryReviewer, ModelFailureTracker, NOMINAL_TOTAL_BYTES, NO_REVEALED_TOOLS, PERMISSION_AUDIT_CODES, PLUGIN_LAYOUT, PLUGIN_MANIFEST_FILE, PLUGIN_NAME_PATTERN, PLUGIN_ROOT_ENV, PLUGIN_ROOT_TOKEN, POLICY_DECISIONS, PROJECT_AGENTS_SUBDIR, PROVIDER_NO_CREDENTIAL, PermissionManager, PlanModeState, PluginStore, PolicyRuleSchema, ProviderError, ProviderRouter, RECORDING_KEEP_RUNS, RECORDING_MAX_BYTES, ROLE_FRONTMATTER_SCHEMA, RUN_CODE_TOOL, RecentWorkspaces, SANDBOX_COVERS, SANDBOX_EXCLUDES, SCALAR_KEYS, SCHEDULE_DEFAULTS, SCHEDULE_DEFAULT_ALLOWLIST, SCHEDULE_ISSUE_CODES, SCHTASKS_FOLDER, SESSION_MESSAGES_READ_TOOL, SESSION_MESSAGES_SEARCH_TOOL, SESSION_QUERY_TOOLS, SESSION_SEARCH_TOOL, SESSION_TRACE_TOOL, SETTINGS_LAYER_ORDER, SETTING_WRITE_APPLY, SETTING_WRITE_KEYS, SETTING_WRITE_LAYERS, SKILL_CREATE_TOOL, SKILL_EDIT_TOOL, SKILL_PATCH_TOOL, SKILL_VIEW_TOOL, SKILL_WRITE_FILE_TOOL, SLASH_COMMANDS_DIAG_MODULE, ScheduleRecorder, ScheduleRegistrar, ScheduleStore, SessionManager, SessionQueries, SessionReferences, SettingsFileError, SettingsFileSchema, SkillLearner, SkillSystem, TOOL_SEARCH_TOOL, TaskNoticeTracker, ToolRegistry, TrackerDB, TrustManager, Workspace, acquireScheduleLock, addMarketplace, addUsage, admitArtifact, admitArtifacts, affectedPaths, artifactLaunchArgv, artifactOpenRefusal, assertLevelAllowed, blockedRoleTools, buildContextBreakdown, buildFireArgv, buildFtsMatchQuery, buildSchemaExports, buildSystemPrompt, buildTrigramMatchQuery, builtinRoles, checkEpochVersion, checkFtsHealth, checkShadowing, classifyProviderError, clearModelCache, codeModeWorkerPath, commandNameFromRelPath, compileRuleLists, compressionOptions, computeCost, computeCostMicros, countRules, createAllowAllGate, createAllowAllImportGate, createAskQuestionTool, createCodeExecTool, createDelegateTool, createDenyAllGate, createDenyAllImportGate, createGoalTool, createImportGate, createMemoryTool, createPlanModeTools, createRoleFile, createRoleScope, createRunCodeTool, 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, escapeRuleContent, estimateImageTokens, estimateRunTokens, estimateTokens, evaluateSelection, expandCommand, expandImports, explainSetting, findInstructionFiles, findProjectInstructions, findRole, formatBytes, formatSkillIndex, formatUsd, gateForTool, getCapability, getConfigIssues, getConfigOrigins, getImportGate, getTrustGate, hasPromptCaching, hasProviderCredentials, imageFromBase64, imageFromPath, imagePartTokens, importSkills, installPlugin, instructionDirs, instructionNotices, intervalSlots, inventoryTotal, isBlockCode, isCodeModeDeferred, isEmptyRules, isGoalPhase, isNonInteractive, isReadOnlySubCall, isSettingWriteLayer, isValidPluginName, isWithinWindow, isWritableSettingKey, labelSlug, layerRank, 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, microsToUsd, modelListCandidates, needsAllowlist, nextFallbackModel, nextRunAt, noConfigOrigins, noManagedPolicy, noPlugins, openArtifact, originOf, parseClaudeSettingsHooks, parseClock, parseDate, parseFrontmatter, parseHooksConfig, parseHooksConfigVerbose, parseImportLine, parseModelList, parseRoleDefinition, parseSkillFrontmatter, pendingImageTokens, persistParts, persistToolResults, persistedUsage, previewSkillImport, pruneArtifacts, pruneRecordings, pruneSchedules, readImageSize, readMarketplaces, readPluginManifest, readPluginRecords, readProviderKeyEnv, readRecording, readSessionSurface, reclaimFtsSpace, redactLine, refreshOpenRouterMetadata, removeMarketplace, removeSessionArtifacts, renderImportTree, renderProjectContext, renderSdkDeclaration, repairSchedules, resolveArtifactRetention, resolveCodeModeWorker, resolveComplianceDirs, resolveEntrySource, resolveInWorkspace, resolveMarketplaceRef, resolveMentions, resolveMultimodalPolicy, resolvePolicyDirs, resolveProjectRoot, resolveScheduleBackend, resolveSessionReference, resolveSessionVisibility, resolveSettings, resolveSkillDirs, resolveSource, resolveWorkspace, restoreParts, revealScopedProvider, roleScopedProvider, roleSourceLabel, ruleCovers, ruleFromString, ruleToString, runCode, runCommand2 as runCommand, sanitizeArgNames, sanitizeCommand, sanitizeFtsQuery, sanitizePath, sanitizeToolOutput, scanInstructions, scanPluginDir, scanSkillDirs, searchMarketplaces, setImportGate, setPluginEnabled, setTrustGate, settingValueChoices, settingValueKind, 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.4.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "epoch-agent 核心引擎:ReAct 循环、Provider 路由、工具调度、记忆管理",
|
|
6
6
|
"repository": {
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
"gpt-tokenizer": "^3.4.0",
|
|
28
28
|
"js-yaml": "^5.2.3",
|
|
29
29
|
"zod": "^4.4.3",
|
|
30
|
-
"@epoch-agent/infra": "0.
|
|
31
|
-
"@epoch-agent/protocol": "0.
|
|
30
|
+
"@epoch-agent/infra": "0.4.0",
|
|
31
|
+
"@epoch-agent/protocol": "0.4.0"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@ai-sdk/amazon-bedrock": "^5.0.40",
|