@epoch-agent/core 3.1.1 → 3.1.2

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 CHANGED
@@ -2706,6 +2706,65 @@ type DeliveryResult = {
2706
2706
  to: string;
2707
2707
  reason: string;
2708
2708
  };
2709
+ /**
2710
+ * 宿主交给成员表的两样能力(2026-11-02)。
2711
+ *
2712
+ * 成员表住在 core 里,而「这段主会话在本进程 / 库里存在吗」「把它叫起来跑一轮」
2713
+ * 只有宿主知道 —— core 不许 import runtime / server。所以照
2714
+ * `SubAgentRunner` 的形状:core 定义接口,宿主实现之后注入。
2715
+ *
2716
+ * 没注入(CLI 单会话 / 嵌入宿主)= 这两件事都答不出,所有判据落回
2717
+ * 「没在跑就当它不在」那一档:**宁可报错,也不报一个假的成功**。
2718
+ */
2719
+ interface SessionBridge {
2720
+ /** 这段主会话在本进程里活着、或者会话库里还有吗 */
2721
+ exists(sessionId: string): boolean;
2722
+ /**
2723
+ * 把它叫起来跑一轮。**不等它跑完** —— 喂进去就返回,和 codex 的
2724
+ * `TriggerTurn` 一样是异步的。
2725
+ *
2726
+ * `ok: false` 时 `reason` 要能原样给模型看(目录没了 / 接不回来 / 队列满了)。
2727
+ */
2728
+ wake(sessionId: string, text: string): Promise<{
2729
+ ok: boolean;
2730
+ reason?: string;
2731
+ }>;
2732
+ /**
2733
+ * 这段会话的**标题**(2026-11-03)。答不出就 `undefined`。
2734
+ *
2735
+ * 只用来拼「这条消息是谁发的」那一句(`sessionSenderLabel`)—— 被叫醒
2736
+ * 的一方看到裸 UUID 没法一眼认出是谁,得再 `session_list` 去对一次。
2737
+ * 可选:不提供就回落成裸 id,和加这一格之前逐字节相同。
2738
+ */
2739
+ title?(sessionId: string): string | undefined;
2740
+ }
2741
+ /**
2742
+ * 一次能并行到多少(2026-11-03)。
2743
+ *
2744
+ * 两档数的都是**同时在跑**,不是「一共叫过几次」:
2745
+ * - `maxRunningMembers`:一个主会话同时能有多少个子 agent 在干活;
2746
+ * - `maxWokenSessions`:智能体同时能叫醒多少段别的主会话。
2747
+ *
2748
+ * 为什么要有:这两个动作都是模型自己就能发的(`delegate_task` /
2749
+ * `spawn_teammate` / `followup_task`),而每一次都是一份完整的模型调用。
2750
+ * 没有上限时,一句话让模型「并行调研五个模块」可以轻易变成二十个同时在跑的
2751
+ * 子 agent —— codex 那边对应的护栏是 `max_concurrent_threads_per_session`
2752
+ * 与 `AgentLimitReached`(超了直接报错,不排队)。
2753
+ */
2754
+ interface TeamLimits {
2755
+ maxRunningMembers: number;
2756
+ maxWokenSessions: number;
2757
+ }
2758
+ /**
2759
+ * 一个会话同时能跑几个成员。
2760
+ *
2761
+ * **3** 而不是更大:和 `DelegateManager` 的 `max_concurrent_children` 缺省值
2762
+ * 对齐(同一个数在两处不一致时,用户会看到「一批 3 个能跑、再派一个就被拒」),
2763
+ * 也和 codex 的 4 线程 / 给 root 留 1 个同一个量级。
2764
+ */
2765
+ declare const DEFAULT_MAX_RUNNING_MEMBERS = 3;
2766
+ /** 智能体同时能叫起来几段会话。判据同 {@link DEFAULT_MAX_RUNNING_MEMBERS} */
2767
+ declare const DEFAULT_MAX_WOKEN_SESSIONS = 3;
2709
2768
  declare class TeamRegistry {
2710
2769
  private readonly inboxCapacity;
2711
2770
  private readonly members;
@@ -2720,6 +2779,30 @@ declare class TeamRegistry {
2720
2779
  private readonly mainInboxes;
2721
2780
  /** 登记过的主会话 id(判据在 `registerSession` 上) */
2722
2781
  private readonly sessions;
2782
+ /**
2783
+ * 此刻真有一轮在跑的主会话(2026-11-02)。
2784
+ *
2785
+ * 和 `sessions` 是两个集合,别合并:`sessions` 的意思是「这个 id 是本进程
2786
+ * 认识的主会话」(跑过至少一轮,只增不删),而 `send_message` 要判的是
2787
+ * 「它现在真在跑吗」—— 拿前者当后者,消息会投进一个休眠会话的内存收件箱,
2788
+ * 而没有任何一轮会来读它。
2789
+ *
2790
+ * 引用计数而不是布尔:同一会话重入(`runTurns` 嵌套 / 排队紧接着开下一轮)
2791
+ * 时,早退的那一层不该把计数清零。
2792
+ */
2793
+ private readonly activeTurns;
2794
+ /**
2795
+ * 被智能体叫起来、还没跑完的那几段主会话 → 叫起来的时刻(2026-11-03)。
2796
+ *
2797
+ * 用途只有两个:数「同时在跑几段被叫醒的会话」(`maxWokenSessions`),
2798
+ * 以及挡住 {@link WAKE_RAMP_MS} 那段缝里的重复唤醒。**跑完就删** ——
2799
+ * 删除点在 `endSessionTurn`(目标会话那一轮的最外层 `finally`)。
2800
+ */
2801
+ private readonly wokenSessions;
2802
+ /** 并发上限。判据和缺省值都在 {@link TeamLimits} 上 */
2803
+ private readonly limits;
2804
+ /** 宿主注入的那两样能力(判据在 {@link SessionBridge} 上) */
2805
+ private bridge;
2723
2806
  /**
2724
2807
  * 打断用的回调(`interrupt_agent` 拉的就是它们)。
2725
2808
  *
@@ -2732,7 +2815,7 @@ declare class TeamRegistry {
2732
2815
  private readonly listeners;
2733
2816
  /** 共享任务板(阶段 2)。它也变动时也会叫醒 `wait_agent` */
2734
2817
  readonly tasks: TeamTaskBoard;
2735
- constructor(inboxCapacity?: number);
2818
+ constructor(inboxCapacity?: number, limits?: Partial<TeamLimits>);
2736
2819
  /** 订阅「团队变了」。返回取消订阅 */
2737
2820
  onChange(cb: () => void): () => void;
2738
2821
  /**
@@ -2804,6 +2887,71 @@ declare class TeamRegistry {
2804
2887
  registerSession(sessionId: string): void;
2805
2888
  /** 这个 id 是不是一段登记过的主会话(诊断和 `list_agents --all` 用) */
2806
2889
  hasSession(sessionId: string): boolean;
2890
+ /**
2891
+ * 这一轮开跑了。
2892
+ *
2893
+ * 调用点只有 `AgentLoop.runTurns()`:它开跑时登记、最外层 `finally` 里注销。
2894
+ * 子 agent 的 `AgentLoop` 没有 `team`(判据在 `session-factory` 的 `subRunner`
2895
+ * 那一格),所以这里不会出现 `delegate-xxxx`。
2896
+ */
2897
+ beginSessionTurn(sessionId: string): void;
2898
+ /**
2899
+ * 这一轮结束了。多调用一次是空操作。
2900
+ *
2901
+ * **不 `notify()`**:一轮结束不是 `wait_agent` 等的那种变化(判据在
2902
+ * `notify()` 上),叫醒它只会在每个回合边界白返回一次。
2903
+ */
2904
+ endSessionTurn(sessionId: string): void;
2905
+ /** 这段主会话此刻真有一轮在跑吗 */
2906
+ isSessionActive(sessionId: string): boolean;
2907
+ /** 宿主注入「这段会话在不在」「把它叫起来」两件事。传 `undefined` = 撤掉 */
2908
+ setSessionBridge(bridge: SessionBridge | undefined): void;
2909
+ /**
2910
+ * 唤醒一段没在跑的主会话。
2911
+ *
2912
+ * 没注入 bridge 时**明说「这个宿主不支持」**,不假装成功:CLI 单会话模式
2913
+ * 里确实没有可唤醒的对象,而调用方(模型)会照着回执决定要不要等回音。
2914
+ */
2915
+ wakeSession(sessionId: string, text: string): Promise<{
2916
+ ok: boolean;
2917
+ reason?: string;
2918
+ }>;
2919
+ /**
2920
+ * 清掉「叫过但始终没跑起来」的旧条目。
2921
+ *
2922
+ * 真跑起来的会在 `endSessionTurn` 里被删;这里管的是另一种:`wake` 报了
2923
+ * 成功、但那一轮根本没开(引擎起不来 / 排队排到一半被丢掉)。不清理的话
2924
+ * 一条这种记录会永久占掉一个名额,或者把那一段会话永久钉在「别重复叫」上。
2925
+ * 只清「不在跑且过了宽限」的 —— 真在跑的一直算在内。
2926
+ */
2927
+ private reapWokenSessions;
2928
+ /** 同时能跑几个成员(给派活那一侧的报错文案用) */
2929
+ get memberLimit(): number;
2930
+ /**
2931
+ * 这个会话此刻还能再起几个成员。
2932
+ *
2933
+ * 判据是**同一个 `parentSessionId` 名下 `status === 'running'` 的成员数**,
2934
+ * 不是「一共派过几个」:收工的不占名额(`markFinished` 把状态翻掉),
2935
+ * 于是长时间使用的会话不会被历史成员卡死。
2936
+ *
2937
+ * `0` = 一个都起不了,调用方要把它当成一次失败告诉模型(codex 那边叫
2938
+ * `AgentLimitReached`,超了也是报错而不是排队)。
2939
+ */
2940
+ availableMemberSlots(parentSessionId: string): number;
2941
+ /**
2942
+ * 这个 id 指向一段**真实存在**的主会话吗。
2943
+ *
2944
+ * 有 bridge 时问宿主(它能看到会话库),没有时回落成「登记过」——
2945
+ * 和加这个判据之前逐字节相同。
2946
+ */
2947
+ sessionExists(sessionId: string): boolean;
2948
+ /**
2949
+ * 这段主会话的标题,答不出就 `undefined`。
2950
+ *
2951
+ * 没注入 bridge / 宿主不提供标题 = 永远答不出,调用方回落成裸 id ——
2952
+ * 和加这一格之前逐字节相同。
2953
+ */
2954
+ sessionTitle(sessionId: string): string | undefined;
2807
2955
  /** 登记过的全部主会话 id,按登记先后 */
2808
2956
  sessionIds(): string[];
2809
2957
  /**
@@ -2859,6 +3007,8 @@ declare class TeamRegistry {
2859
3007
  from: string;
2860
3008
  to: string;
2861
3009
  text: string;
3010
+ /** `from` 的可读写法(主会话之间才需要,判据在 `AgentMessage.fromLabel`) */
3011
+ fromLabel?: string;
2862
3012
  }): AgentMessage;
2863
3013
  }
2864
3014
 
@@ -6108,13 +6258,19 @@ declare function createScheduleDraftTool(deps: ScheduleDraftDeps): EpochTool;
6108
6258
  *
6109
6259
  * - **发给一个 running 成员**:进它的收件箱,引擎在**下一个步骤边界**取走
6110
6260
  * (`loop.ts:723` 的 `steer.take()`)。它当轮就会看到,不用等这一轮跑完
6111
- * - **发给 `lead`**:进主会话的收件箱,下一轮 `TaskNoticeTracker` 在请求前
6112
- * 拼成一条 note(`loop.ts:1367`)。**父会话没在跑时它待在那儿不动**
6261
+ * - **发给 `lead`**:进主会话的收件箱。父会话在跑时,`TaskNoticeTracker` 在它
6262
+ * **下一次请求之前**把它拼成一条 note(`loop.ts:1405`);父会话没在跑时这条
6263
+ * 只是**排在那里**,要等它下次跑起来才读得到 —— 回执照这两种情形分开写
6264
+ * - **发给另一段主会话**:只有它**此刻真有一轮在跑**时才送得到(2026-11-02)。
6265
+ * 休眠的那一段会收到一句明说的失败,而不是一条扔进没人读的箱子的消息
6113
6266
  * - **发给已经收工的成员**:直接失败。收进一个永远不会有下一轮读它的箱子
6114
6267
  * 等于给调用方一个假成功 —— 父 agent 会照着它继续等回音
6115
6268
  *
6116
- * 第三条是 codex `api.rs:35-36` 那条规矩的本地版:通知**不唤醒**已终结的 agent。
6117
- * 阶段 2 有了 `followup_task`,唤醒才会变成一条显式的路。
6269
+ * 后三条是同一个判据:**消息只在对方真会读到它的前提下才算「送到了」**。
6270
+ * 差别落在收件人休眠时的那一档:主会话能自己把对方叫醒(`followup_task`),
6271
+ * 所以直接失败并指路;**成员叫不醒**(那个工具在 `BLOCKED_TOOLS` 里),所以
6272
+ * 排队 + 说清「要等它下次跑起来」。两者都是 codex `api.rs:35-36` 那条规矩
6273
+ * (通知不唤醒已终结的 agent)的本地版 —— 叫醒走的是另一条显式路。
6118
6274
  */
6119
6275
 
6120
6276
  /** 工具名。`BLOCKED_TOOLS` 那边按这个名字放行,别各写各的 */
@@ -6681,12 +6837,21 @@ interface SearchMessagesOutput {
6681
6837
  interface ReadMessagesInput extends Omit<SessionVisibilityInput, 'db'> {
6682
6838
  /** 读哪段会话 */
6683
6839
  sessionId: string;
6684
- /** 锚点消息(`messages.id`,来自两个检索工具的命中) */
6685
- messageId: number;
6840
+ /**
6841
+ * 锚点消息(`messages.id`,来自两个检索工具的命中)。
6842
+ *
6843
+ * **省略 = 「这段会话最近在说什么」**。这一档是 2026-11-03 加的,理由是现场:
6844
+ * 模型要找一段没有独特可搜词的会话,拿不到任何 id,于是照着错误里的「it has 9」
6845
+ * 去猜 #9、再猜 #1,三次调用换回三次 8010 —— 而 `messages.id` 是**全库自增**的,
6846
+ * 本来就不可能猜得中。省略时改看 {@link tail}。
6847
+ */
6848
+ messageId?: number | undefined;
6686
6849
  /** 锚点之前取几条。调用方负责夹紧 */
6687
6850
  before: number;
6688
6851
  /** 锚点之后取几条。调用方负责夹紧 */
6689
6852
  after: number;
6853
+ /** 省略 `messageId` 时读最近几条(时间正序由这一层翻好)。调用方负责夹紧 */
6854
+ tail?: number | undefined;
6690
6855
  }
6691
6856
  /**
6692
6857
  * 一条消息的**原文**(不是片段)。
@@ -6718,6 +6883,14 @@ interface ReadMessagesOutput {
6718
6883
  before: MessageRecord[];
6719
6884
  /** 锚点之后那几条,同样正序 */
6720
6885
  after: MessageRecord[];
6886
+ /**
6887
+ * 省略 `messageId` 时给「最近几条」,**时间正序**。
6888
+ *
6889
+ * 这一档存在时 `anchor` 必然缺席 —— 两条路要的不一样:一个是「围绕这一条看」,
6890
+ * 一个是「尾部长什么样」。合进 `after` 会让渲染那一侧分不清「锚点之后」和
6891
+ * 「整段会话的最后几条」。
6892
+ */
6893
+ tail?: MessageRecord[] | undefined;
6721
6894
  /** 这段会话一共多少条。让模型知道自己这个窗口在整段里占多少 */
6722
6895
  total: number;
6723
6896
  }
@@ -6821,6 +6994,8 @@ declare class SessionQueries {
6821
6994
  * 就能探出别的工作区有哪些会话,所以连「它存不存在」都不能泄露)
6822
6995
  * - 在范围里、但这段会话没有这个 messageId → `authorized: true` + `anchor`
6823
6996
  * 缺席。这是模型自己传错了 id,该告诉它,而不是含混成「不可读」
6997
+ * - **根本没传 messageId** → `authorized: true` + `tail` 那几条。这不是错误,
6998
+ * 是「不知道从哪条读起」时唯一还能用的读法(判据在 `ReadMessagesInput.messageId`)
6824
6999
  */
6825
7000
  readMessages(input: ReadMessagesInput): ReadMessagesOutput;
6826
7001
  /**
@@ -6888,6 +7063,14 @@ declare class SessionQueries {
6888
7063
  * (`before: 0` 是合法用法:只要后面那几条)。
6889
7064
  */
6890
7065
  private neighbourRows;
7066
+ /**
7067
+ * 会话最后 n 条(**倒序取,调用方翻**)。
7068
+ *
7069
+ * 不塞进 {@link neighbourRows}:那一份的 WHERE 以锚点为界,而这一条压根没有锚点
7070
+ * —— 合成一份就得给 `anchorId` 编一个哨兵值(0 或 -1),那正是「读着像同一件事、
7071
+ * 其实不是」的开头,而它会在某个 id 真的小于哨兵时静默出错。
7072
+ */
7073
+ private tailRows;
6891
7074
  /**
6892
7075
  * 会话内的逐条命中。授权已经在 `searchMessages` 里判过,这里只按 sessionId 收窄
6893
7076
  * —— 不重复拼 `visClause`:同一个判定在一次调用里做两遍,将来改一处漏一处。
@@ -12353,6 +12536,15 @@ declare class AgentLoop {
12353
12536
  /** 见 {@link CompressResult.carriedHead} —— 落库那一步要用(方案 64 PR-1) */
12354
12537
  carriedHead?: number;
12355
12538
  carriedTail?: number;
12539
+ /**
12540
+ * 这一次**一发摘要请求都没打**(中段为空 / 裁完就够)—— 见
12541
+ * {@link CompressResult.summarySkipped}。
12542
+ *
12543
+ * 手动 `/compact` 那一侧靠它把「没压动」分两档说:
12544
+ * `after === before` 现在有两种来路,**一种花了钱、一种一分没花**,
12545
+ * 而界面上原来只有一种说法(「那笔钱花掉了」),在短会话上就是假话。
12546
+ */
12547
+ summarySkipped?: boolean;
12356
12548
  }>;
12357
12549
  /**
12358
12550
  * 真正压一次。调用方负责决定「该不该压」。
@@ -23354,4 +23546,4 @@ declare function resolveCodeModeWorker(baseDir: string, exists?: typeof existsSy
23354
23546
  */
23355
23547
  declare function codeModeWorkerPath(): string | undefined;
23356
23548
 
23357
- export { ABOUT_DESC_MAX_CHARS, ABOUT_README_MAX_CHARS, AGENT_ROLE_DIAG_MODULE, ARTIFACT_MAX_TOTAL_BYTES, ARTIFACT_RETENTION_DEFAULTS, ATTACHMENT_MAX_TOTAL_BYTES, ATTACHMENT_RETENTION_DEFAULTS, type AcquireResult, type ActivePlugin, type AgentConfig, AgentInbox, AgentLoop, type AgentProvider, type AgentSite, type AgentSiteRef, AppearanceStore, type AppendMessageInput, ApprovalCache, type ApprovalDecision, type ArtifactOpenRefusal, type ArtifactRetention, type AskQuestionDeps, type AttachmentRetention, BLOCKED_TOOLS, BOARD_TOOL_NAMES, type BackendOptions, type BackendOutcome, type BackgroundTaskSource, type BaseOrigin, type BaseSlot, type BeginTurnInput, type BoardPending, BoardStore, type BoardTarget, 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 ConfigKeyEntry, type ConfigKeyKind, type ConfigKeyReason, type ConfigKeyWrite, type ConfigMigration, type ConfigOrigins, type ConfigValueCheck, type ConfigValueProblem, ContextCompressor, type ContextEngine, type CreateScheduleInput, type CreateSessionInput, DEFAULT_COMPLIANCE_ACTIONS, DEFAULT_COMPLIANCE_SETTINGS, DEFAULT_COMPRESSION_THRESHOLD, DEFAULT_GOAL_MAX_ROUNDS, DEFAULT_INBOX_CAPACITY, DEFAULT_MAX_HOLD_CHARS, DELEGATE_SESSION_SOURCE, type DelegateArgs, type DelegateConfig, DelegateManager, type DelegateTaskResult, type DeliveryResult, type DiagnoseOptions, type DiscoverOutcome, type DiscoveredFile, type DoctorReport, type DraftParse, EMPTY_RULES, EPOCH_DISK_LEDGER, type EntryProbeCode, type EntryProbeResult, EpochConfigSchema, type ExpandOptions, type ExtractOutcome, FTS_TABLES, FTS_TRIGGERS, type FallbackEvent, type FileSlots, type FileSourceKind, type ForkInput, type FrontmatterParse, type FrontmatterSplit, type FtsHealth, type FtsReclaim, type FtsSpace, type FtsTableHealth, GOAL_BLOCK_CODES, type GateAxis, type GateVerdict, type GenerateInput, type GenerateOutput, type Goal, type GoalBlockReason, type GoalClear, type GoalPhase, type GoalPromptView, type GoalRefusal, type GoalRoundResult, GoalService, GoalStore, type GoalToolDeps, type GoalWrite, HEADLESS_AUDIT_CODES, type HeadlessPolicy, type HookConfigEntry, HookManager, type HookManagerOptions, type HookMatcher, type HookSourceKind, type HookSourceStatus, type HookSourcesOptions, type HookSourcesSummary, type HooksParseOutcome, type MemoryManager$1 as IMemoryManager, INSTRUCTION_BUDGET_CHARS, INSTRUCTION_FILES, type SessionManager$1 as ISessionManager, type SkillSystem$1 as ISkillSystem, ImageLoadError, type ImageSize, type ImportDecision, type ImportGate, type ImportGoal, type ImportMessage, type ImportNode, type ImportPartsResult, type ImportSessionInput, type ImportSessionMeta, type ImportSessionResult, type ImportSkipReason, type ImportTodo, ImportTrustStore, type InstallDependency, type InstallOptions, type InstallOutcome, type InstallPreview, type InstallStep, 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_POST_CHARS, MAX_REASON_CHARS, MAX_RECENT_WORKSPACES, MODEL_ENTRIES_FILE, MODEL_GIVE_UP_THRESHOLD, MULTIMODAL_DEFAULTS, type ManagedPolicy, ManagedPolicyError, type ManagedSettings, ManagedSettingsSchema, type MarketplaceCatalog, type MarketplaceCategory, type MarketplaceDisplay, type MarketplaceDisplayField, type MarketplaceEntry, type MarketplaceOutcome, type MarketplaceRecord, type MarketplaceStatus, type MemoryConfig, type MemoryEntry, type MemoryImportRecord, type MemoryImportResult, MemoryManager, type MemoryManagerOptions, type MemoryNotice, type MemoryRemoval, type MemorySearchResult, type MemoryTarget, type MemoryWriteResult, type MentionPart, type MentionResolution, type Message, type MessageHit, type MessageRecord, type MessageSurface, type ModelCapability, ModelFailureTracker, type ModelMetaEntry, type ModelPricing, type MultimodalPolicy, NOMINAL_TOTAL_BYTES, NO_REVEALED_TOOLS, type NonInteractiveProbe, type OsTaskSnapshot, type OutputGuard, PACK_EXCLUDES, PERMISSION_AUDIT_CODES, PLUGIN_ICON_MAX_BYTES, PLUGIN_LAYOUT, PLUGIN_MANIFEST_FILE, PLUGIN_MANIFEST_KEYS, PLUGIN_NAME_PATTERN, PLUGIN_ROOT_ENV, PLUGIN_ROOT_TOKEN, PLUGIN_VISIBILITY, POLICY_DECISIONS, PROBE_VERSION, PROJECT_AGENTS_SUBDIR, PROVIDER_NO_CREDENTIAL, type PackFile, type PackLimits, type PackOutcome, type PackPlan, type PackPlanOutcome, type PermissionAuditCode, type PermissionAuditEntry, type PermissionAuditOutcome, type PermissionAuditScope, type PermissionAuditSnapshot, PermissionManager, type PersistFailureKind, type PersistedBudget, type PersistedPart, type PlanApprovalFn, type PlanEnterResult, type PlanModeDeps, PlanModeState, type PlanSettlement, type PluginAbout, type PluginArtifacts, type PluginAuthor, PluginAuthorSchema, type PluginCommandDir, type PluginCounts, type PluginDoc, type PluginHookFile, type PluginInventory, type PluginLoadOptions, type PluginManifest, type PluginPathRef, type PluginRecord, type PluginScope, 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_ISSUE_CODES, SCHTASKS_FOLDER, SEND_MESSAGE_TOOL, SESSION_MESSAGES_READ_TOOL, SESSION_MESSAGES_SEARCH_TOOL, SESSION_QUERY_TOOLS, SESSION_SEARCH_TOOL, SESSION_TRACE_TOOL, SETTINGS_LAYER_ORDER, SETTING_WRITE_KEYS, SETTING_WRITE_LAYERS, SKILL_ASSET_DIRS, SKILL_CREATE_TOOL, SKILL_EDIT_TOOL, SKILL_FILE, SKILL_PATCH_TOOL, SKILL_VIEW_TOOL, SKILL_WRITE_FILE_TOOL, SLASH_COMMANDS_DIAG_MODULE, type ScalarKey, type ScanInstructionsOptions, type ScheduleArgvRefusal, type ScheduleArgvResult, type ScheduleArgvWarning, type ScheduleBackend, type ScheduleCliEntry, type ScheduleDraftDeps, type ScheduleDrift, type ScheduleDriftKind, type ScheduleImportInput, type ScheduleInstallForm, type ScheduleIssue, type ScheduleIssueCode, type ScheduleLock, ScheduleRecorder, ScheduleRegistrar, ScheduleStore, type ScheduleValidation, type SchemaExport, type SearchHit, type SearchInput, type SearchMessagesInput, type SearchMessagesOutput, type SearchOutput, type SearchSessionsInput, type SelectionDeps, type SelfConnector, type SelfIndexInput, type SelfSettings, type Session, type SessionCandidate, type SessionHit, SessionManager, type SessionMentionDeps, type SessionMeta, SessionQueries, SessionReferences, type SessionSearchDeps, type SessionStats, type SessionSurface, type SessionTrace, type SessionVisibility, type SessionVisibilityInput, type SettingApply, type SettingApplyFacts, type SettingChain, type SettingFutile, type SettingLayer, type SettingStep, type SettingValue, type SettingValueKind, type SettingWriteFailure, type SettingWriteKey, type SettingWriteLayer, type SettingWriteOutcome, type SettingWriteRequest, type SettingWriteTarget, type SettingWriteTargetsOptions, type SettingsFile, SettingsFileError, SettingsFileSchema, type SettingsLayer, type SettingsResolution, type ShadowFinding, type ShadowKind, type Skill, type SkillDirSource, type SkillDirSpec, type SkillDirsSummary, type SkillImportConflict, type SkillImportDone, type SkillImportEntry, type SkillImportFailure, type SkillImportForm, type SkillImportOptions, type SkillImportPreview, type SkillImportResult, type SkillIndexEntry, type SkillIndexOptions, type SkillIndexResidency, type SkillIndexStats, SkillLearner, type SkillLearningProvider, type SkillMeta, type SkillStats, SkillSystem, type SkillSystemOptions, type SkillViewDeps, type SkillWriteDeps, type SteerSource, type StoredAppearance, type SubAgentRunner, type SubTask, type SubToolCaller, type SummarizeOutput, type SurfaceMessage, type SystemPromptParams, type SystemPromptSegments, TEAM_TOOL_NAMES, TOOL_SEARCH_TOOL, TaskNoticeTracker, TeamRegistry, type TodoItem, type ToggleOutcome, 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, UNSETTABLE_USER_KEYS, 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, capabilityOfRef, checkConfigValue, checkEpochVersion, checkFtsHealth, checkShadowing, classifyPersistFailure, classifyProviderError, clearModelCache, coalesceRecording, codeModeWorkerPath, commandNameFromRelPath, compileRuleLists, compressionOptions, computeCost, computeCostMicros, computeExecHash, configKeyByPath, configKeyTable, countRules, createAllowAllGate, createAllowAllImportGate, createAskQuestionTool, createBoardTools, createCodeExecTool, createDelegateTool, createDenyAllGate, createDenyAllImportGate, createGoalTool, createImportGate, createMemoryTool, createPlanModeTools, createPluginScope, createRoleFile, createRoleScope, createRunCodeTool, createScheduleDraftTool, createSendMessageTool, createSessionMessagesReadTool, createSessionMessagesSearchTool, createSessionSearchTool, createSessionSearchTools, createSessionTraceTool, createSkillViewTool, createSkillWriteTools, createTeamTools, createTodoTool, createToolRevealState, createToolScope, createToolSearchTool, createTrustGate, currentEpochVersion, decideImport, decideTrust, defaultConfig, describeArtifactRefusal, describeBackgroundTask, describeHeadlessPolicy, describeIsolation, describeJsonError, diagnoseSchedules, discoverMarkdown, discoverModels, discoverProject, discoverySpec, 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, hasUsableModel, imageFromBase64, imageFromPath, imagePartTokens, importParts, importSkills, installPlugin, instructionDirs, instructionNotices, intervalSlots, inventoryProjectExtensions, inventoryTotal, isBlockCode, isCodeModeDeferred, isEmptyRules, isGoalPhase, isNonInteractive, isReadOnlySubCall, isSettingWriteLayer, isTransientPersistFailure, isValidInterval, isValidPluginName, isWithinWindow, isWritableSettingKey, labelSlug, layerRank, listEntryModels, listRunningSchedules, listSessionCandidates, listWorkspaceFiles, loadCommandDefinitions, loadCommandFile, loadCommands, loadConfig, loadHookSources, loadKeybindings, loadLexiconDir, loadLexiconFiles, loadModelEntries, loadPlugins, loadPolicyFiles, loadPolicyRules, loadRoleDefinitions, loadRoleDir, loadedImports, localDateString, managedSwitchNotes, mapClaudeToolName, mapEpochToolName, mapOperationType, matchPreauthorization, matchRuleLists, matchesHook, mentionsPluginRoot, mergeHeadlessPolicy, mergeRoles, mergeSchedulePatch, microsToUsd, modelEntriesPath, modelListCandidates, needsAllowlist, nextRunAt, noConfigOrigins, noManagedPolicy, noPlugins, normalizeModelEntry, normalizeTrigger, offloadOldestImages, openArtifact, originOf, packFileName, packPlugin, parseClaudeSettingsHooks, parseClock, parseDate, parseFrontmatter, parseHooksConfig, parseHooksConfigVerbose, parseImportLine, parseModelEntry, parseModelList, parseRoleDefinition, parseScheduleDraft, parseSkillFrontmatter, parseTrigger, pendingImageTokens, persistFailureCode, persistParts, persistToolResults, persistedUsage, planPack, previewSkillImport, pricingFor, projectEntryForDisplay, pruneArtifacts, pruneAttachments, pruneRecordings, pruneSchedules, readEntryKey, readImageSize, readMarketplaces, readPluginAbout, readPluginIcon, readPluginManifest, readPluginRecords, readRecording, readSessionSurface, reclaimFtsSpace, redactLine, refreshOpenRouterMetadata, removeMarketplace, removeRecordings, removeRoleFile, removeSessionArtifacts, removeSessionAttachments, renderImportTree, renderProjectContext, renderSdkDeclaration, renderSelfIndex, repairSchedules, requestImageBytes, 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, saveModelEntries, scanInstructions, scanPluginDir, scanSkillDirs, searchMarketplaces, setDisplayCurrency, setImportGate, setPluginEnabled, setTrustGate, settingValueChoices, settingValueKind, settingWriteApply, settingWriteLayers, settingWriteTargets, skillIndexDescription, skillIndexResidency, skillIndexStats, sniffMediaType, splitFrontmatter, staticToolProvider, stripArtifactData, substitutePluginRoot, suggestRuleFromApproval, systemOpenArgv, systemPromptSegments, testModelEntry, toPosix, toolDefinitionTokens, toolMatches, toolTableTokens, totalTokens, traceSession, triggerPeriodMs, unescapeRuleContent, uninstallPlugin, unknownRoleSkills, unknownRoleTools, unloadedInstructionFiles, unsetUserSetting, updateMarketplace, updatePlugin, usdToMicros, validateSchedule, validateTrigger, validateWindow, withGoalCompression, withGoalPrompt, workspaceDisplayPath, writableConfigKeys, writeSettingValue };
23549
+ export { ABOUT_DESC_MAX_CHARS, ABOUT_README_MAX_CHARS, AGENT_ROLE_DIAG_MODULE, ARTIFACT_MAX_TOTAL_BYTES, ARTIFACT_RETENTION_DEFAULTS, ATTACHMENT_MAX_TOTAL_BYTES, ATTACHMENT_RETENTION_DEFAULTS, type AcquireResult, type ActivePlugin, type AgentConfig, AgentInbox, AgentLoop, type AgentProvider, type AgentSite, type AgentSiteRef, AppearanceStore, type AppendMessageInput, ApprovalCache, type ApprovalDecision, type ArtifactOpenRefusal, type ArtifactRetention, type AskQuestionDeps, type AttachmentRetention, BLOCKED_TOOLS, BOARD_TOOL_NAMES, type BackendOptions, type BackendOutcome, type BackgroundTaskSource, type BaseOrigin, type BaseSlot, type BeginTurnInput, type BoardPending, BoardStore, type BoardTarget, 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 ConfigKeyEntry, type ConfigKeyKind, type ConfigKeyReason, type ConfigKeyWrite, type ConfigMigration, type ConfigOrigins, type ConfigValueCheck, type ConfigValueProblem, ContextCompressor, type ContextEngine, type CreateScheduleInput, type CreateSessionInput, DEFAULT_COMPLIANCE_ACTIONS, DEFAULT_COMPLIANCE_SETTINGS, DEFAULT_COMPRESSION_THRESHOLD, DEFAULT_GOAL_MAX_ROUNDS, DEFAULT_INBOX_CAPACITY, DEFAULT_MAX_HOLD_CHARS, DEFAULT_MAX_RUNNING_MEMBERS, DEFAULT_MAX_WOKEN_SESSIONS, DELEGATE_SESSION_SOURCE, type DelegateArgs, type DelegateConfig, DelegateManager, type DelegateTaskResult, type DeliveryResult, type DiagnoseOptions, type DiscoverOutcome, type DiscoveredFile, type DoctorReport, type DraftParse, EMPTY_RULES, EPOCH_DISK_LEDGER, type EntryProbeCode, type EntryProbeResult, EpochConfigSchema, type ExpandOptions, type ExtractOutcome, FTS_TABLES, FTS_TRIGGERS, type FallbackEvent, type FileSlots, type FileSourceKind, type ForkInput, type FrontmatterParse, type FrontmatterSplit, type FtsHealth, type FtsReclaim, type FtsSpace, type FtsTableHealth, GOAL_BLOCK_CODES, type GateAxis, type GateVerdict, type GenerateInput, type GenerateOutput, type Goal, type GoalBlockReason, type GoalClear, type GoalPhase, type GoalPromptView, type GoalRefusal, type GoalRoundResult, GoalService, GoalStore, type GoalToolDeps, type GoalWrite, HEADLESS_AUDIT_CODES, type HeadlessPolicy, type HookConfigEntry, HookManager, type HookManagerOptions, type HookMatcher, type HookSourceKind, type HookSourceStatus, type HookSourcesOptions, type HookSourcesSummary, type HooksParseOutcome, type MemoryManager$1 as IMemoryManager, INSTRUCTION_BUDGET_CHARS, INSTRUCTION_FILES, type SessionManager$1 as ISessionManager, type SkillSystem$1 as ISkillSystem, ImageLoadError, type ImageSize, type ImportDecision, type ImportGate, type ImportGoal, type ImportMessage, type ImportNode, type ImportPartsResult, type ImportSessionInput, type ImportSessionMeta, type ImportSessionResult, type ImportSkipReason, type ImportTodo, ImportTrustStore, type InstallDependency, type InstallOptions, type InstallOutcome, type InstallPreview, type InstallStep, 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_POST_CHARS, MAX_REASON_CHARS, MAX_RECENT_WORKSPACES, MODEL_ENTRIES_FILE, MODEL_GIVE_UP_THRESHOLD, MULTIMODAL_DEFAULTS, type ManagedPolicy, ManagedPolicyError, type ManagedSettings, ManagedSettingsSchema, type MarketplaceCatalog, type MarketplaceCategory, type MarketplaceDisplay, type MarketplaceDisplayField, type MarketplaceEntry, type MarketplaceOutcome, type MarketplaceRecord, type MarketplaceStatus, type MemoryConfig, type MemoryEntry, type MemoryImportRecord, type MemoryImportResult, MemoryManager, type MemoryManagerOptions, type MemoryNotice, type MemoryRemoval, type MemorySearchResult, type MemoryTarget, type MemoryWriteResult, type MentionPart, type MentionResolution, type Message, type MessageHit, type MessageRecord, type MessageSurface, type ModelCapability, ModelFailureTracker, type ModelMetaEntry, type ModelPricing, type MultimodalPolicy, NOMINAL_TOTAL_BYTES, NO_REVEALED_TOOLS, type NonInteractiveProbe, type OsTaskSnapshot, type OutputGuard, PACK_EXCLUDES, PERMISSION_AUDIT_CODES, PLUGIN_ICON_MAX_BYTES, PLUGIN_LAYOUT, PLUGIN_MANIFEST_FILE, PLUGIN_MANIFEST_KEYS, PLUGIN_NAME_PATTERN, PLUGIN_ROOT_ENV, PLUGIN_ROOT_TOKEN, PLUGIN_VISIBILITY, POLICY_DECISIONS, PROBE_VERSION, PROJECT_AGENTS_SUBDIR, PROVIDER_NO_CREDENTIAL, type PackFile, type PackLimits, type PackOutcome, type PackPlan, type PackPlanOutcome, type PermissionAuditCode, type PermissionAuditEntry, type PermissionAuditOutcome, type PermissionAuditScope, type PermissionAuditSnapshot, PermissionManager, type PersistFailureKind, type PersistedBudget, type PersistedPart, type PlanApprovalFn, type PlanEnterResult, type PlanModeDeps, PlanModeState, type PlanSettlement, type PluginAbout, type PluginArtifacts, type PluginAuthor, PluginAuthorSchema, type PluginCommandDir, type PluginCounts, type PluginDoc, type PluginHookFile, type PluginInventory, type PluginLoadOptions, type PluginManifest, type PluginPathRef, type PluginRecord, type PluginScope, 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_ISSUE_CODES, SCHTASKS_FOLDER, SEND_MESSAGE_TOOL, SESSION_MESSAGES_READ_TOOL, SESSION_MESSAGES_SEARCH_TOOL, SESSION_QUERY_TOOLS, SESSION_SEARCH_TOOL, SESSION_TRACE_TOOL, SETTINGS_LAYER_ORDER, SETTING_WRITE_KEYS, SETTING_WRITE_LAYERS, SKILL_ASSET_DIRS, SKILL_CREATE_TOOL, SKILL_EDIT_TOOL, SKILL_FILE, SKILL_PATCH_TOOL, SKILL_VIEW_TOOL, SKILL_WRITE_FILE_TOOL, SLASH_COMMANDS_DIAG_MODULE, type ScalarKey, type ScanInstructionsOptions, type ScheduleArgvRefusal, type ScheduleArgvResult, type ScheduleArgvWarning, type ScheduleBackend, type ScheduleCliEntry, type ScheduleDraftDeps, type ScheduleDrift, type ScheduleDriftKind, type ScheduleImportInput, type ScheduleInstallForm, type ScheduleIssue, type ScheduleIssueCode, type ScheduleLock, ScheduleRecorder, ScheduleRegistrar, ScheduleStore, type ScheduleValidation, type SchemaExport, type SearchHit, type SearchInput, type SearchMessagesInput, type SearchMessagesOutput, type SearchOutput, type SearchSessionsInput, type SelectionDeps, type SelfConnector, type SelfIndexInput, type SelfSettings, type Session, type SessionBridge, 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, TEAM_TOOL_NAMES, TOOL_SEARCH_TOOL, TaskNoticeTracker, type TeamLimits, TeamRegistry, type TodoItem, type ToggleOutcome, 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, UNSETTABLE_USER_KEYS, 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, capabilityOfRef, checkConfigValue, checkEpochVersion, checkFtsHealth, checkShadowing, classifyPersistFailure, classifyProviderError, clearModelCache, coalesceRecording, codeModeWorkerPath, commandNameFromRelPath, compileRuleLists, compressionOptions, computeCost, computeCostMicros, computeExecHash, configKeyByPath, configKeyTable, countRules, createAllowAllGate, createAllowAllImportGate, createAskQuestionTool, createBoardTools, createCodeExecTool, createDelegateTool, createDenyAllGate, createDenyAllImportGate, createGoalTool, createImportGate, createMemoryTool, createPlanModeTools, createPluginScope, createRoleFile, createRoleScope, createRunCodeTool, createScheduleDraftTool, createSendMessageTool, createSessionMessagesReadTool, createSessionMessagesSearchTool, createSessionSearchTool, createSessionSearchTools, createSessionTraceTool, createSkillViewTool, createSkillWriteTools, createTeamTools, createTodoTool, createToolRevealState, createToolScope, createToolSearchTool, createTrustGate, currentEpochVersion, decideImport, decideTrust, defaultConfig, describeArtifactRefusal, describeBackgroundTask, describeHeadlessPolicy, describeIsolation, describeJsonError, diagnoseSchedules, discoverMarkdown, discoverModels, discoverProject, discoverySpec, 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, hasUsableModel, imageFromBase64, imageFromPath, imagePartTokens, importParts, importSkills, installPlugin, instructionDirs, instructionNotices, intervalSlots, inventoryProjectExtensions, inventoryTotal, isBlockCode, isCodeModeDeferred, isEmptyRules, isGoalPhase, isNonInteractive, isReadOnlySubCall, isSettingWriteLayer, isTransientPersistFailure, isValidInterval, isValidPluginName, isWithinWindow, isWritableSettingKey, labelSlug, layerRank, listEntryModels, listRunningSchedules, listSessionCandidates, listWorkspaceFiles, loadCommandDefinitions, loadCommandFile, loadCommands, loadConfig, loadHookSources, loadKeybindings, loadLexiconDir, loadLexiconFiles, loadModelEntries, loadPlugins, loadPolicyFiles, loadPolicyRules, loadRoleDefinitions, loadRoleDir, loadedImports, localDateString, managedSwitchNotes, mapClaudeToolName, mapEpochToolName, mapOperationType, matchPreauthorization, matchRuleLists, matchesHook, mentionsPluginRoot, mergeHeadlessPolicy, mergeRoles, mergeSchedulePatch, microsToUsd, modelEntriesPath, modelListCandidates, needsAllowlist, nextRunAt, noConfigOrigins, noManagedPolicy, noPlugins, normalizeModelEntry, normalizeTrigger, offloadOldestImages, openArtifact, originOf, packFileName, packPlugin, parseClaudeSettingsHooks, parseClock, parseDate, parseFrontmatter, parseHooksConfig, parseHooksConfigVerbose, parseImportLine, parseModelEntry, parseModelList, parseRoleDefinition, parseScheduleDraft, parseSkillFrontmatter, parseTrigger, pendingImageTokens, persistFailureCode, persistParts, persistToolResults, persistedUsage, planPack, previewSkillImport, pricingFor, projectEntryForDisplay, pruneArtifacts, pruneAttachments, pruneRecordings, pruneSchedules, readEntryKey, readImageSize, readMarketplaces, readPluginAbout, readPluginIcon, readPluginManifest, readPluginRecords, readRecording, readSessionSurface, reclaimFtsSpace, redactLine, refreshOpenRouterMetadata, removeMarketplace, removeRecordings, removeRoleFile, removeSessionArtifacts, removeSessionAttachments, renderImportTree, renderProjectContext, renderSdkDeclaration, renderSelfIndex, repairSchedules, requestImageBytes, 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, saveModelEntries, scanInstructions, scanPluginDir, scanSkillDirs, searchMarketplaces, setDisplayCurrency, setImportGate, setPluginEnabled, setTrustGate, settingValueChoices, settingValueKind, settingWriteApply, settingWriteLayers, settingWriteTargets, skillIndexDescription, skillIndexResidency, skillIndexStats, sniffMediaType, splitFrontmatter, staticToolProvider, stripArtifactData, substitutePluginRoot, suggestRuleFromApproval, systemOpenArgv, systemPromptSegments, testModelEntry, toPosix, toolDefinitionTokens, toolMatches, toolTableTokens, totalTokens, traceSession, triggerPeriodMs, unescapeRuleContent, uninstallPlugin, unknownRoleSkills, unknownRoleTools, unloadedInstructionFiles, unsetUserSetting, updateMarketplace, updatePlugin, usdToMicros, validateSchedule, validateTrigger, validateWindow, withGoalCompression, withGoalPrompt, workspaceDisplayPath, writableConfigKeys, writeSettingValue };
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { REASONING_EFFORTS, MODEL_ENTRY_PROTOCOLS, PROVIDER_TYPES, isModelEntryId, parseModelRef, OPERATION_TYPES as OPERATION_TYPES$1, COMPLIANCE_CATEGORIES, COMPLIANCE_ACTIONS, SEARCH_PROVIDER_TYPES, CURRENCIES, LANGS, isSettingsPaneId, SETTINGS_PANE_IDS, BRAND_WHEN_SIDEBAR_COLLAPSED, DEFAULT_PERMISSION_LEVEL, resolvePermissionLevel, PERMISSION_LEVELS, SHELL_KINDS, cronTimes, SCHEDULE_MAX_TIMES_PER_DAY, SCHEDULE_INTERVAL_MIN_MINUTES, SCHEDULE_INTERVAL_MAX_MINUTES, ToolExposure, MIN_OPTIONS, MAX_OPTIONS, MAX_HEADER_CHARS, MAX_QUESTIONS, SCHEDULE_DEFAULT_PERMISSION, approvalPolicyForLevel, SCHEDULE_DRAFT_TOOL, agentMessageLine, systemNote, LEAD_AGENT_ID, isValidAgentRoleName, DEFAULT_AGENT_ROLE, isValidCommandName, RESERVED_COMMAND_NAMES, isWirePluginArchiveName, contentToText, AGENT_MESSAGE_NOTE_TITLE, formatMoney, totalUsageTokens, OFFLOADED_IMAGE_NOTE, NOOP_TELEMETRY, METRIC, GEN_AI, isPromptOversize, promptTokens, entrySecretName, isEntrySecretName, entryRef, KEY_ACTIONS, tableOf, perAction, isKeyAction, parseSequence, RESERVED_CHORDS, chordId, sequenceId, ACTION_CONTEXTS, SEQUENCE_CONTEXTS, assertNeverPart, normalizeAppearanceTranslucent, MAX_ATTACH_FILES, MAX_ATTACH_TOTAL_BYTES, MAX_SESSION_REFS, utf8ByteLength, truncateToBudget, attachSessionSurface, isContextNearlyFull, isOperationType, normalizeApproval, SCHEDULE_DRAFT_SAVED_MARK, imagePartOmittedSummary, ENTRY_REF_PREFIX, placeholdersOf, SCHEDULE_CONFIRM_PLACEHOLDER, MAX_ATTACH_BYTES, SIMULTANEOUS_CONTEXTS, SESSION_REFERENCE_ERROR_CODES, filePartSummary, sessionPartSummary } from '@epoch-agent/protocol';
1
+ import { REASONING_EFFORTS, MODEL_ENTRY_PROTOCOLS, PROVIDER_TYPES, isModelEntryId, parseModelRef, OPERATION_TYPES as OPERATION_TYPES$1, COMPLIANCE_CATEGORIES, COMPLIANCE_ACTIONS, SEARCH_PROVIDER_TYPES, CURRENCIES, LANGS, isSettingsPaneId, SETTINGS_PANE_IDS, BRAND_WHEN_SIDEBAR_COLLAPSED, DEFAULT_PERMISSION_LEVEL, resolvePermissionLevel, PERMISSION_LEVELS, SHELL_KINDS, cronTimes, SCHEDULE_MAX_TIMES_PER_DAY, SCHEDULE_INTERVAL_MIN_MINUTES, SCHEDULE_INTERVAL_MAX_MINUTES, ToolExposure, MIN_OPTIONS, MAX_OPTIONS, MAX_HEADER_CHARS, MAX_QUESTIONS, SCHEDULE_DEFAULT_PERMISSION, approvalPolicyForLevel, SCHEDULE_DRAFT_TOOL, agentMessageLine, systemNote, LEAD_AGENT_ID, sessionSenderLabel, isValidAgentRoleName, DEFAULT_AGENT_ROLE, isValidCommandName, RESERVED_COMMAND_NAMES, isWirePluginArchiveName, contentToText, AGENT_MESSAGE_NOTE_TITLE, formatMoney, totalUsageTokens, OFFLOADED_IMAGE_NOTE, NOOP_TELEMETRY, METRIC, GEN_AI, isPromptOversize, promptTokens, entrySecretName, isEntrySecretName, entryRef, KEY_ACTIONS, tableOf, perAction, isKeyAction, parseSequence, RESERVED_CHORDS, chordId, sequenceId, ACTION_CONTEXTS, SEQUENCE_CONTEXTS, assertNeverPart, normalizeAppearanceTranslucent, MAX_ATTACH_FILES, MAX_ATTACH_TOTAL_BYTES, MAX_SESSION_REFS, utf8ByteLength, truncateToBudget, attachSessionSurface, isContextNearlyFull, isOperationType, normalizeApproval, SCHEDULE_DRAFT_SAVED_MARK, imagePartOmittedSummary, ENTRY_REF_PREFIX, placeholdersOf, SCHEDULE_CONFIRM_PLACEHOLDER, MAX_ATTACH_BYTES, SIMULTANEOUS_CONTEXTS, SESSION_REFERENCE_ERROR_CODES, filePartSummary, sessionPartSummary } from '@epoch-agent/protocol';
2
2
  export { API_KEY_ENV_VARS, COMPLIANCE_ACTIONS, COMPLIANCE_CATEGORIES, LEGACY_LEVEL_ALIASES, 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, approvalPolicyForLevel, extractAllMentions, extractMentions, extractSessionMentions, getProviderInfo, isOperationType, isPermissionLevel, isPlanOutcome, isProviderType, normalizeApproval, resolvePermissionLevel } from '@epoch-agent/protocol';
3
3
  import { existsSync, mkdirSync, rmSync, writeFileSync, statSync, readdirSync, readFileSync, renameSync, realpathSync, symlinkSync, cpSync, lstatSync, unlinkSync, rmdirSync, mkdtempSync, copyFileSync, openSync, writeSync, closeSync, readSync } from 'fs';
4
4
  import { platform, tmpdir, homedir, hostname } from 'os';
@@ -2034,7 +2034,7 @@ var DelegateManager = class {
2034
2034
  async delegate(args, parentSessionId, signal) {
2035
2035
  const start = Date.now();
2036
2036
  const tasks = this.normalizeTasks(args);
2037
- const maxConcurrent = args.max_concurrent ?? this.config.max_concurrent_children;
2037
+ let maxConcurrent = args.max_concurrent ?? this.config.max_concurrent_children;
2038
2038
  if (this.currentDepth >= this.config.max_spawn_depth) {
2039
2039
  return {
2040
2040
  success: false,
@@ -2046,6 +2046,18 @@ var DelegateManager = class {
2046
2046
  return { success: true, output: this.buildSummary([], Date.now() - start), duration: 0 };
2047
2047
  }
2048
2048
  const background = args.background === true;
2049
+ const team = this.config.team;
2050
+ if (team) {
2051
+ const slots = team.availableMemberSlots(parentSessionId);
2052
+ if (slots <= 0) {
2053
+ return {
2054
+ success: false,
2055
+ output: `\u8FD9\u4E2A\u4F1A\u8BDD\u5DF2\u7ECF\u6709 ${team.memberLimit} \u4E2A\u6210\u5458\u5728\u8DD1\uFF08\u5E76\u53D1\u4E0A\u9650\uFF09\uFF0C\u8FD9\u4E00\u6279\u6CA1\u6D3E\u51FA\u53BB \u2014\u2014 \u7B49\u5176\u4E2D\u4E00\u4E2A\u6536\u5DE5\u518D\u6765\uFF0C\u6216\u8005\u5148 interrupt_agent \u6536\u6389\u4E00\u4E2A`,
2056
+ duration: 0
2057
+ };
2058
+ }
2059
+ maxConcurrent = Math.min(maxConcurrent, slots);
2060
+ }
2049
2061
  if (signal?.aborted) {
2050
2062
  return { success: false, output: ABORTED, duration: 0 };
2051
2063
  }
@@ -2151,6 +2163,21 @@ ${summary}`);
2151
2163
  const resuming = task.resumeSessionId !== void 0;
2152
2164
  const sessionId = task.resumeSessionId ?? `delegate-${randomUUID().slice(0, 8)}`;
2153
2165
  const memberId = task.agentId ?? sessionId;
2166
+ const failed = (error, summary = "") => ({
2167
+ goal: task.goal,
2168
+ success: false,
2169
+ summary,
2170
+ error,
2171
+ duration: Date.now() - start,
2172
+ ...task.role ? { role: task.role } : {}
2173
+ });
2174
+ const team = this.config.team;
2175
+ if (signal?.aborted) return failed(ABORTED);
2176
+ if (team && team.availableMemberSlots(parentSessionId) <= 0) {
2177
+ return failed(
2178
+ `\u8FD9\u4E2A\u4F1A\u8BDD\u5DF2\u7ECF\u6709 ${team.memberLimit} \u4E2A\u6210\u5458\u5728\u8DD1\uFF08\u5E76\u53D1\u4E0A\u9650\uFF09\uFF0C\u8FD9\u4E00\u4E2A\u6CA1\u6D3E\u51FA\u53BB\u3002\u7B49\u5176\u4E2D\u4E00\u4E2A\u6536\u5DE5\u518D\u6765\uFF0C\u6216\u8005\u5148 interrupt_agent \u6536\u6389\u4E00\u4E2A`
2179
+ );
2180
+ }
2154
2181
  if (resuming) {
2155
2182
  this.config.team?.markRunning(memberId);
2156
2183
  } else {
@@ -2161,15 +2188,6 @@ ${summary}`);
2161
2188
  ...task.role ? { role: task.role } : {}
2162
2189
  });
2163
2190
  }
2164
- const failed = (error, summary = "") => ({
2165
- goal: task.goal,
2166
- success: false,
2167
- summary,
2168
- error,
2169
- duration: Date.now() - start,
2170
- ...task.role ? { role: task.role } : {}
2171
- });
2172
- if (signal?.aborted) return failed(ABORTED);
2173
2191
  const controller = new AbortController();
2174
2192
  this.config.team?.setAbort(memberId, () => controller.abort());
2175
2193
  const unlink = linkAbort(isAbortSignal(signal) ? signal : void 0, controller);
@@ -4427,9 +4445,16 @@ var TeamTaskBoard = class {
4427
4445
  }
4428
4446
  };
4429
4447
  // src/team/registry.ts
4448
+ var DEFAULT_MAX_RUNNING_MEMBERS = 3;
4449
+ var DEFAULT_MAX_WOKEN_SESSIONS = 3;
4450
+ var WAKE_RAMP_MS = 6e4;
4430
4451
  var TeamRegistry = class {
4431
- constructor(inboxCapacity = DEFAULT_INBOX_CAPACITY) {
4452
+ constructor(inboxCapacity = DEFAULT_INBOX_CAPACITY, limits = {}) {
4432
4453
  this.inboxCapacity = inboxCapacity;
4454
+ this.limits = {
4455
+ maxRunningMembers: limits.maxRunningMembers ?? DEFAULT_MAX_RUNNING_MEMBERS,
4456
+ maxWokenSessions: limits.maxWokenSessions ?? DEFAULT_MAX_WOKEN_SESSIONS
4457
+ };
4433
4458
  this.tasks = new TeamTaskBoard();
4434
4459
  this.tasks.onChange(() => this.notify());
4435
4460
  }
@@ -4438,6 +4463,10 @@ var TeamRegistry = class {
4438
4463
  bySessionId = /* @__PURE__ */ new Map();
4439
4464
  mainInboxes = /* @__PURE__ */ new Map();
4440
4465
  sessions = /* @__PURE__ */ new Set();
4466
+ activeTurns = /* @__PURE__ */ new Map();
4467
+ wokenSessions = /* @__PURE__ */ new Map();
4468
+ limits;
4469
+ bridge;
4441
4470
  aborters = /* @__PURE__ */ new Map();
4442
4471
  listeners = /* @__PURE__ */ new Set();
4443
4472
  tasks;
@@ -4533,6 +4562,74 @@ var TeamRegistry = class {
4533
4562
  hasSession(sessionId) {
4534
4563
  return this.sessions.has(sessionId);
4535
4564
  }
4565
+ beginSessionTurn(sessionId) {
4566
+ this.activeTurns.set(sessionId, (this.activeTurns.get(sessionId) ?? 0) + 1);
4567
+ }
4568
+ endSessionTurn(sessionId) {
4569
+ const n = this.activeTurns.get(sessionId);
4570
+ if (n === void 0) return;
4571
+ if (n <= 1) {
4572
+ this.activeTurns.delete(sessionId);
4573
+ this.wokenSessions.delete(sessionId);
4574
+ return;
4575
+ }
4576
+ this.activeTurns.set(sessionId, n - 1);
4577
+ }
4578
+ isSessionActive(sessionId) {
4579
+ return this.activeTurns.has(sessionId);
4580
+ }
4581
+ setSessionBridge(bridge) {
4582
+ this.bridge = bridge;
4583
+ }
4584
+ async wakeSession(sessionId, text) {
4585
+ if (!this.bridge) {
4586
+ return {
4587
+ ok: false,
4588
+ reason: "\u8FD9\u4E2A\u5BBF\u4E3B\u4E0D\u652F\u6301\u5524\u9192\u522B\u7684\u4F1A\u8BDD\uFF08CLI \u5355\u4F1A\u8BDD\u6A21\u5F0F\uFF09\u3002\u8BA9\u5B83\u81EA\u5DF1\u53D1\u4E00\u53E5\u8BDD\u624D\u80FD\u63A5\u4E0A"
4589
+ };
4590
+ }
4591
+ const now = Date.now();
4592
+ this.reapWokenSessions(now);
4593
+ if (this.wokenSessions.has(sessionId)) {
4594
+ return {
4595
+ ok: false,
4596
+ reason: `${sessionId} \u521A\u88AB\u53EB\u8D77\u6765\uFF0C\u8FD8\u6CA1\u771F\u6B63\u5F00\u8DD1 \u2014\u2014 \u522B\u91CD\u590D\u53EB\u3002\u770B\u5B83\u7B54\u4E86\u4EC0\u4E48\uFF1Asession_messages_read ${sessionId}`
4597
+ };
4598
+ }
4599
+ if (this.wokenSessions.size >= this.limits.maxWokenSessions) {
4600
+ return {
4601
+ ok: false,
4602
+ reason: `\u73B0\u5728\u5DF2\u7ECF\u6709 ${this.wokenSessions.size} \u6BB5\u88AB\u53EB\u9192\u7684\u4F1A\u8BDD\u5728\u8DD1\uFF08\u4E0A\u9650 ${this.limits.maxWokenSessions} \u6BB5\uFF09\u2014\u2014 \u7B49\u5176\u4E2D\u4E00\u6BB5\u8DD1\u5B8C\u518D\u53EB\u4E0B\u4E00\u4E2A\uFF0C\u6216\u8005\u628A\u5B83\u4EEC\u8981\u5E72\u7684\u4E8B\u5199\u8FDB\u4F60\u81EA\u5DF1\u7684\u7ED3\u8BBA\u91CC`
4603
+ };
4604
+ }
4605
+ const r = await this.bridge.wake(sessionId, text);
4606
+ if (r.ok) this.wokenSessions.set(sessionId, now);
4607
+ return r;
4608
+ }
4609
+ reapWokenSessions(now) {
4610
+ for (const [id, at] of this.wokenSessions) {
4611
+ if (!this.activeTurns.has(id) && now - at > WAKE_RAMP_MS) this.wokenSessions.delete(id);
4612
+ }
4613
+ }
4614
+ get memberLimit() {
4615
+ return this.limits.maxRunningMembers;
4616
+ }
4617
+ availableMemberSlots(parentSessionId) {
4618
+ let running = 0;
4619
+ for (const entry of this.members.values()) {
4620
+ if (entry.info.parentSessionId === parentSessionId && entry.info.status === "running") {
4621
+ running += 1;
4622
+ }
4623
+ }
4624
+ return Math.max(0, this.limits.maxRunningMembers - running);
4625
+ }
4626
+ sessionExists(sessionId) {
4627
+ if (this.bridge) return this.bridge.exists(sessionId);
4628
+ return this.sessions.has(sessionId);
4629
+ }
4630
+ sessionTitle(sessionId) {
4631
+ return this.bridge?.title?.(sessionId);
4632
+ }
4536
4633
  sessionIds() {
4537
4634
  return [...this.sessions];
4538
4635
  }
@@ -4570,9 +4667,10 @@ var TeamRegistry = class {
4570
4667
  if (msg.to === LEAD_AGENT_ID) {
4571
4668
  const sender = this.members.get(msg.from);
4572
4669
  if (sender) {
4573
- this.mainInbox(sender.info.parentSessionId).push(msg);
4670
+ const parent = sender.info.parentSessionId;
4671
+ this.mainInbox(parent).push(msg);
4574
4672
  this.notify();
4575
- return { ok: true, to: msg.to, status: "running" };
4673
+ return { ok: true, to: msg.to, status: this.isSessionActive(parent) ? "running" : "idle" };
4576
4674
  }
4577
4675
  return { ok: false, to: msg.to, reason: `\u4E3B\u4F1A\u8BDD\u4E0D\u80FD\u53D1\u7ED9 ${LEAD_AGENT_ID}` };
4578
4676
  }
@@ -4589,11 +4687,19 @@ var TeamRegistry = class {
4589
4687
  this.notify();
4590
4688
  return { ok: true, to: msg.to, status: entry.info.status };
4591
4689
  }
4592
- if (this.sessions.has(msg.to)) {
4690
+ if (this.isSessionActive(msg.to)) {
4593
4691
  this.mainInbox(msg.to).push(msg);
4594
4692
  this.notify();
4595
4693
  return { ok: true, to: msg.to, status: "running" };
4596
4694
  }
4695
+ if (this.sessionExists(msg.to)) {
4696
+ const senderIsMember = this.members.has(msg.from);
4697
+ return {
4698
+ ok: false,
4699
+ to: msg.to,
4700
+ reason: senderIsMember ? `${msg.to} \u73B0\u5728\u6CA1\u5728\u8DD1\uFF0C\u4E0B\u4E00\u8F6E\u4E0D\u4F1A\u6765 \u2014\u2014 \u8FD9\u6761\u6D88\u606F\u6CA1\u9001\u51FA\u53BB\u3002\u4F60\u53EB\u4E0D\u9192\u522B\u7684\u4F1A\u8BDD\uFF08\u6210\u5458\u62FF\u4E0D\u5230 followup_task\uFF09\uFF1A\u8981\u7D27\u7684\u8BDD\u5199\u8FDB\u4F60\u8FD9\u4E00\u8F6E\u7684\u7ED3\u8BBA\u91CC\uFF0C\u6D3E\u4F60\u51FA\u6765\u7684\u4F1A\u8BDD\u4F1A\u770B\u5230` : `${msg.to} \u73B0\u5728\u6CA1\u5728\u8DD1\uFF0C\u4E0B\u4E00\u8F6E\u4E0D\u4F1A\u6765 \u2014\u2014 \u8FD9\u6761\u6D88\u606F\u6CA1\u9001\u51FA\u53BB\u3002\u8981\u7528 followup_task \u628A\u5B83\u53EB\u8D77\u6765\u8DD1\u4E00\u8F6E\uFF08agentId \u586B ${msg.to}\uFF0Cmessage \u586B\u4F60\u8981\u8BF4\u7684\u8BDD\uFF09`
4701
+ };
4702
+ }
4597
4703
  return {
4598
4704
  ok: false,
4599
4705
  to: msg.to,
@@ -4606,7 +4712,8 @@ var TeamRegistry = class {
4606
4712
  from: args.from,
4607
4713
  to: args.to,
4608
4714
  text: args.text,
4609
- sentAt: Date.now()
4715
+ sentAt: Date.now(),
4716
+ ...args.fromLabel ? { fromLabel: args.fromLabel } : {}
4610
4717
  };
4611
4718
  }
4612
4719
  };
@@ -4616,11 +4723,11 @@ function createSendMessageTool(team) {
4616
4723
  return {
4617
4724
  name: SEND_MESSAGE_TOOL,
4618
4725
  description: [
4619
- "\u7ED9\u53E6\u4E00\u4E2A agent \u6216**\u53E6\u4E00\u6BB5\u4F1A\u8BDD**\u53D1\u4E00\u6761\u6D88\u606F\u3002**\u4E0D\u662F\u6D3E\u6D3B** \u2014\u2014 \u4E0D\u4F1A\u65B0\u5F00\u6210\u5458\u3001\u4E0D\u4F1A\u7B49\u5B83\u4EA4\u7ED3\u8BBA\u3002",
4726
+ "\u7ED9\u53E6\u4E00\u4E2A agent \u6216**\u6B63\u6709\u4E00\u6BB5\u5728\u8DD1\u7684\u4E3B\u4F1A\u8BDD**\u53D1\u4E00\u6761\u6D88\u606F\u3002**\u4E0D\u662F\u6D3E\u6D3B** \u2014\u2014 \u4E0D\u4F1A\u65B0\u5F00\u6210\u5458\u3001\u4E0D\u4F1A\u7B49\u5B83\u4EA4\u7ED3\u8BBA\u3002",
4620
4727
  "\u53D1\u7ED9\u6B63\u5728\u8DD1\u7684\u6210\u5458\uFF08\u5B50 agent\uFF09\uFF1A\u5B83\u5728\u4E0B\u4E00\u6B65\u5C31\u6536\u5230\uFF0C\u5F53\u8F6E\u5C31\u80FD\u636E\u6B64\u6539\u53D8\u884C\u4E3A\u3002",
4621
- `\u53D1\u7ED9 \`${LEAD_AGENT_ID}\`\uFF08\u6D3E\u4F60\u51FA\u6765\u7684\u90A3\u4E2A\u4F1A\u8BDD\uFF09\uFF1A\u5B83\u4E0B\u4E00\u8F6E\u5F00\u5934\u4F1A\u770B\u5230\u3002`,
4622
- "\u53D1\u7ED9**\u53E6\u4E00\u6BB5\u4E3B\u4F1A\u8BDD**\uFF08\u7528 list_agents --all \u770B\u5230\u7684\u90A3\u4E2A sessionId\uFF09\uFF1A\u5B83\u4E0B\u4E00\u8F6E\u5F00\u5934\u4F1A\u770B\u5230\u3002",
4623
- "\u53D1\u7ED9\u5DF2\u7ECF\u6536\u5DE5\u7684\u6210\u5458\u4F1A\u5931\u8D25 \u2014\u2014 \u90A3\u4E9B\u8981\u9760 delegate_task \u91CD\u65B0\u6D3E\u3002",
4728
+ `\u53D1\u7ED9 \`${LEAD_AGENT_ID}\`\uFF08\u6D3E\u4F60\u51FA\u6765\u7684\u90A3\u4E2A\u4F1A\u8BDD\uFF09\uFF1A\u5B83\u5728\u8DD1\u65F6\u63A5\u4E0B\u6765\u7684\u6B65\u9AA4\u91CC\u4F1A\u770B\u5230\uFF1B\u5B83\u6CA1\u5728\u8DD1\u65F6\u8FD9\u6761\u53EA\u662F\u6392\u8FDB\u5B83\u7684\u6536\u4EF6\u7BB1\uFF0C\u7B49\u5B83\u4E0B\u6B21\u8DD1\u8D77\u6765\u624D\u8BFB\u5F97\u5230\uFF08\u4F60\u73B0\u5728\u7B49\u4E0D\u5230\u56DE\u97F3\uFF09\u3002`,
4729
+ "\u53D1\u7ED9**\u53E6\u4E00\u6BB5\u4E3B\u4F1A\u8BDD**\uFF08\u7528 list_agents --all \u770B\u5230\u7684\u90A3\u4E2A sessionId\uFF09\uFF1A\u53EA\u6709\u5B83**\u6B64\u523B\u6B63\u5728\u8DD1**\u624D\u9001\u5F97\u5230\u3002",
4730
+ "\u5BF9\u65B9\u6CA1\u5728\u8DD1\uFF08\u4F11\u7720 / \u5DF2\u7ECF\u6536\u5DE5\uFF09\u4F1A\u5F53\u573A\u5931\u8D25\uFF08\u53D1\u7ED9 lead \u90A3\u4E00\u6761\u9664\u5916\uFF0C\u5B83\u6392\u961F\uFF09\u2014\u2014 \u90A3\u79CD\u60C5\u51B5\u7528 followup_task \u628A\u5B83\u53EB\u8D77\u6765\u8DD1\u4E00\u8F6E\uFF0C\u522B\u5E72\u7B49\u3002",
4624
4731
  "\u7528 list_agents \u770B\u672C\u4F1A\u8BDD\u7684\u6210\u5458\uFF1B\u52A0 --all \u770B\u6240\u6709\u4F1A\u8BDD\u548C\u6210\u5458\u3002"
4625
4732
  ].join("\n"),
4626
4733
  parameters: {
@@ -4675,7 +4782,15 @@ function createSendMessageTool(team) {
4675
4782
  const target = team.get(to);
4676
4783
  const ownMember = target !== void 0 && target.parentSessionId === ctx.sessionId;
4677
4784
  const from = memberInfo ? memberInfo.agentId : ownMember ? LEAD_AGENT_ID : ctx.sessionId;
4678
- const result = team.deliver(TeamRegistry.message({ from, to, text }));
4785
+ const labelled = from === ctx.sessionId ? sessionSenderLabel(from, team.sessionTitle(from)) : "";
4786
+ const result = team.deliver(
4787
+ TeamRegistry.message({
4788
+ from,
4789
+ to,
4790
+ text,
4791
+ ...labelled && labelled !== from ? { fromLabel: labelled } : {}
4792
+ })
4793
+ );
4679
4794
  if (!result.ok) {
4680
4795
  return {
4681
4796
  success: false,
@@ -4684,9 +4799,17 @@ function createSendMessageTool(team) {
4684
4799
  duration: Date.now() - start
4685
4800
  };
4686
4801
  }
4802
+ if (result.status !== "running") {
4803
+ const who = result.to === LEAD_AGENT_ID ? "lead" : result.to;
4804
+ return {
4805
+ success: true,
4806
+ output: `\u5DF2\u6392\u8FDB ${who} \u7684\u6536\u4EF6\u7BB1\uFF0C\u4F46\u5B83\u73B0\u5728\u6CA1\u5728\u8DD1 \u2014\u2014 \u8FD9\u6761\u8981\u7B49\u5B83\u4E0B\u6B21\u8DD1\u8D77\u6765\u624D\u4F1A\u88AB\u8BFB\u5230\uFF0C\u4F60\u73B0\u5728\u7B49\u4E0D\u5230\u56DE\u97F3\u3002` + (result.to === LEAD_AGENT_ID ? "\u8981\u7D27\u7684\u8BDD\u4E5F\u5199\u8FDB\u4F60\u8FD9\u4E00\u8F6E\u7684\u7ED3\u8BBA\u91CC\u3002" : ""),
4807
+ duration: Date.now() - start
4808
+ };
4809
+ }
4687
4810
  return {
4688
4811
  success: true,
4689
- output: result.to === LEAD_AGENT_ID ? `\u5DF2\u9001\u5230 lead\uFF0C\u5B83\u4E0B\u4E00\u8F6E\u5F00\u5934\u4F1A\u770B\u5230\u3002` : `\u5DF2\u9001\u5230 ${result.to}\uFF08${result.status}\uFF09\uFF0C\u5B83\u4E0B\u4E00\u8F6E\u5F00\u5934\u4F1A\u770B\u5230\u3002`,
4812
+ output: result.to === LEAD_AGENT_ID ? `\u5DF2\u9001\u5230 lead\uFF0C\u5B83\u63A5\u4E0B\u6765\u7684\u6B65\u9AA4\u91CC\u4F1A\u770B\u5230\u3002` : `\u5DF2\u9001\u5230 ${result.to}\uFF0C\u5B83\u6B63\u5728\u8DD1\u7684\u90A3\u4E00\u8F6E\u4F1A\u770B\u5230\u3002`,
4690
4813
  duration: Date.now() - start
4691
4814
  };
4692
4815
  }
@@ -5107,7 +5230,8 @@ function spawnTeammate(team, manager) {
5107
5230
  "\u6D3E\u4E00\u4E2A**\u5177\u540D**\u7684\u6210\u5458\u5230\u540E\u53F0\u53BB\u5E72\u4E00\u4EF6\u6D3B\u3002\u5B83\u8DD1\u7740\u7684\u65F6\u5019\u4F60\u80FD\u7528 send_message \u8DDF\u5B83\u8BF4\u8BDD\u3002",
5108
5231
  "\u548C delegate_task \u7684\u533A\u522B\uFF1Adelegate_task \u662F\u4E00\u6B21\u6027\u7684\uFF08\u6D3E\u5B8C\u7B49\u7ED3\u8BBA\uFF0C\u4E2D\u9014\u8BF4\u4E0D\u4E0A\u8BDD\uFF09\uFF1B",
5109
5232
  "\u8FD9\u4E2A\u6D3E\u51FA\u53BB\u7684\u6210\u5458\u6709\u540D\u5B57\u3001\u5728\u540E\u53F0\u8DD1\u3001**\u4E2D\u9014\u6536\u5F97\u5230\u4F60\u7684\u6D88\u606F**\uFF0C\u4E5F\u80FD\u88AB interrupt_agent \u6253\u65AD\u3002",
5110
- "\u7528 list_agents \u770B\u73B0\u5728\u6709\u8C01\u3001\u5404\u81EA\u5728\u5E72\u4EC0\u4E48\uFF1Bteam_task_* \u90A3\u56DB\u4E2A\u5DE5\u5177\u7ED9\u5B83\u4EEC\u5206\u6D3B\u3002"
5233
+ "\u7528 list_agents \u770B\u73B0\u5728\u6709\u8C01\u3001\u5404\u81EA\u5728\u5E72\u4EC0\u4E48\uFF1Bteam_task_* \u90A3\u56DB\u4E2A\u5DE5\u5177\u7ED9\u5B83\u4EEC\u5206\u6D3B\u3002",
5234
+ "\u540C\u4E00\u4E2A\u4F1A\u8BDD\u6700\u591A\u540C\u65F6\u8DD1\u51E0\u4E2A\u6210\u5458\u662F\u6709\u4E0A\u9650\u7684\uFF08list_agents \u91CC\u6570 running \u90A3\u51E0\u6761\uFF09\uFF0C\u6EE1\u4E86\u4F1A\u6D3E\u4E0D\u51FA\u53BB \u2014\u2014 \u7B49\u4E00\u4E2A\u6536\u5DE5\uFF0C\u6216\u8005\u5148 interrupt_agent \u6536\u6389\u4E00\u4E2A\u3002"
5111
5235
  ].join("\n"),
5112
5236
  parameters: {
5113
5237
  type: "object",
@@ -5211,7 +5335,9 @@ function listAgents(team) {
5211
5335
  const self = team.bySession(ctx.sessionId);
5212
5336
  const scopeParent = self?.parentSessionId ?? ctx.sessionId;
5213
5337
  const members = showAll ? team.list() : team.list().filter((m) => m.parentSessionId === scopeParent);
5214
- const others = showAll ? team.sessionIds().filter((id) => id !== ctx.sessionId).map((id) => `- ${id} [\u4F1A\u8BDD] running \u2014 \u53E6\u4E00\u6BB5\u4E3B\u4F1A\u8BDD`) : [];
5338
+ const others = showAll ? team.sessionIds().filter((id) => id !== ctx.sessionId).map(
5339
+ (id) => `- ${id} [\u4F1A\u8BDD] ${team.isSessionActive(id) ? "running" : "idle"} \u2014 \u53E6\u4E00\u6BB5\u4E3B\u4F1A\u8BDD`
5340
+ ) : [];
5215
5341
  if (members.length === 0 && others.length === 0) {
5216
5342
  return ok3(
5217
5343
  showAll ? `\u8FD8\u6CA1\u6709\u4EFB\u4F55\u6210\u5458\u6216\u522B\u7684\u4F1A\u8BDD\u3002\u7528 spawn_teammate \u6216 delegate_task \u6D3E\u4E00\u4E2A\u3002` : `\u672C\u4F1A\u8BDD\u8FD8\u6CA1\u6D3E\u51FA\u4EFB\u4F55\u6210\u5458\u3002\u7528 spawn_teammate \u6216 delegate_task \u6D3E\u4E00\u4E2A\uFF0C\u6216\u52A0 --all \u770B\u6240\u6709\u4F1A\u8BDD\u3002`
@@ -5493,10 +5619,13 @@ function followupTask(team, manager) {
5493
5619
  return {
5494
5620
  name: "followup_task",
5495
5621
  description: [
5496
- "\u7ED9\u4E00\u4E2A**\u5DF2\u7ECF\u6536\u5DE5**\u7684\u6210\u5458\u518D\u6D3E\u4E00\u53E5\u8BDD\uFF0C\u8BA9\u5B83\u5E26\u7740\u4E0A\u4E00\u6B21\u7684\u5168\u90E8\u4E0A\u4E0B\u6587\u518D\u8DD1\u4E00\u8F6E\u3002",
5622
+ "\u53EB\u9192\u4E00\u4E2A**\u6CA1\u5728\u8DD1**\u7684\u5BF9\u65B9\uFF0C\u8BA9\u5B83\u5E26\u7740\u4E0A\u4E00\u6B21\u7684\u5168\u90E8\u4E0A\u4E0B\u6587\u518D\u8DD1\u4E00\u8F6E\u3002",
5623
+ "\u5BF9\u8C61\u53EF\u4EE5\u662F\uFF1A\u5DF2\u7ECF\u6536\u5DE5\u7684\u6210\u5458\uFF08list_agents \u91CC\u7684 agentId\uFF09\uFF0C\u6216\u8005**\u53E6\u4E00\u6BB5\u4E3B\u4F1A\u8BDD**\uFF08list_agents --all \u91CC\u7684 sessionId\uFF09\u3002",
5497
5624
  "\u548C send_message \u7684\u5206\u5DE5\uFF1Asend_message \u53EA\u5728\u5BF9\u65B9**\u6B63\u5728\u8DD1**\u7684\u65F6\u5019\u6709\u7528\uFF08\u5F53\u8F6E\u751F\u6548\uFF09\uFF1B",
5498
- "\u5BF9\u65B9\u5DF2\u7ECF\u6536\u5DE5\u4E86\u5C31\u7528\u8FD9\u4E2A \u2014\u2014 \u5B83\u63A5\u7740\u81EA\u5DF1\u90A3\u6BB5\u4F1A\u8BDD\u7EE7\u7EED\uFF0C\u4E0D\u662F\u4ECE\u96F6\u5F00\u59CB\u3002",
5499
- "\u4E00\u6B21\u5524\u9192 = \u4E00\u6B21\u5B8C\u6574\u7684\u6A21\u578B\u8C03\u7528\uFF08\u5168\u91CF\u5386\u53F2\u91CD\u53D1\uFF09\uFF0C\u80FD\u4E00\u6B21\u8BF4\u5B8C\u5C31\u522B\u62C6\u6210\u4E09\u6B21\u3002"
5625
+ "\u5BF9\u65B9\u6CA1\u5728\u8DD1\u5C31\u7528\u8FD9\u4E2A \u2014\u2014 \u5B83\u63A5\u7740\u81EA\u5DF1\u90A3\u6BB5\u4F1A\u8BDD\u7EE7\u7EED\uFF0C\u4E0D\u662F\u4ECE\u96F6\u5F00\u59CB\u3002",
5626
+ "\u53EB\u9192\u662F\u5F02\u6B65\u7684\uFF1A\u5DE5\u5177\u4E00\u8FD4\u56DE\u5C31\u7B97\u5B8C\u6210\uFF0C\u5B83\u81EA\u5DF1\u90A3\u4E00\u8F6E\u5728\u540E\u53F0\u8DD1\uFF0C\u4E0D\u7528\u7B49\u5B83\u7B54\u5B8C\u3002",
5627
+ "\u4E00\u6B21\u5524\u9192 = \u4E00\u6B21\u5B8C\u6574\u7684\u6A21\u578B\u8C03\u7528\uFF08\u5168\u91CF\u5386\u53F2\u91CD\u53D1\uFF09\uFF0C\u80FD\u4E00\u6B21\u8BF4\u5B8C\u5C31\u522B\u62C6\u6210\u4E09\u6B21\u3002",
5628
+ "\u540C\u65F6\u88AB\u53EB\u9192\u7684\u4F1A\u8BDD\u662F\u6709\u4E0A\u9650\u7684\uFF08\u9ED8\u8BA4 3 \u6BB5\uFF09\uFF0C\u8FDE\u7740\u53EB\u7B2C\u56DB\u6BB5\u4F1A\u88AB\u62D2 \u2014\u2014 \u7B49\u4E00\u6BB5\u8DD1\u5B8C\u518D\u53EB\u3002"
5500
5629
  ].join("\n"),
5501
5630
  parameters: {
5502
5631
  type: "object",
@@ -5523,40 +5652,64 @@ function followupTask(team, manager) {
5523
5652
  if (!agentId) return err2(7205, "\u7F3A\u5C11 agentId");
5524
5653
  if (!message) return err2(7206, "\u7F3A\u5C11 message");
5525
5654
  const member = team.get(agentId);
5526
- if (!member) {
5527
- return err2(7207, `\u6CA1\u6709\u8FD9\u4E2A\u6210\u5458\uFF1A${agentId}`, "\u7528 list_agents \u770B\u5F53\u524D\u6709\u8C01");
5655
+ if (member) {
5656
+ if (member.status === "running") {
5657
+ return err2(
5658
+ 7208,
5659
+ `${agentId} \u6B63\u5728\u8DD1\uFF0C\u4E0D\u9700\u8981\u5524\u9192`,
5660
+ "\u73B0\u5728\u7ED9\u5B83\u8BF4\u8BDD\u7528 send_message \u2014\u2014 \u90A3\u6761\u4F1A\u63D2\u5230\u5B83\u4E0B\u4E00\u4E2A\u6B65\u9AA4\u8FB9\u754C\uFF0C\u5F53\u8F6E\u5C31\u751F\u6548"
5661
+ );
5662
+ }
5663
+ const r = await manager.delegate(
5664
+ {
5665
+ tasks: [
5666
+ {
5667
+ goal: message,
5668
+ agentId,
5669
+ resumeSessionId: member.sessionId,
5670
+ ...member.role ? { role: member.role } : {}
5671
+ }
5672
+ ],
5673
+ background: true,
5674
+ max_concurrent: 1
5675
+ },
5676
+ ctx.sessionId,
5677
+ ctx.signal
5678
+ );
5679
+ if (!r.success) return { ...err2(7209, r.output), duration: Date.now() - start };
5680
+ return ok3(
5681
+ [
5682
+ `\u5DF2\u5524\u9192 ${agentId}\uFF08\u540E\u53F0\u4F5C\u4E1A ${r.jobId ?? "(\u65E0)"}\uFF09\uFF0C\u5B83\u5E26\u7740\u4E0A\u4E00\u6B21\u7684\u4E0A\u4E0B\u6587\u63A5\u7740\u5E72\u3002`,
5683
+ `\u770B\u5B83\u5E72\u5230\u54EA\u513F\u4E86\uFF1Atask_output ${r.jobId ?? ""} \u6216 list_agents`
5684
+ ].join("\n"),
5685
+ start
5686
+ );
5528
5687
  }
5529
- if (member.status === "running") {
5530
- return err2(
5531
- 7208,
5532
- `${agentId} \u6B63\u5728\u8DD1\uFF0C\u4E0D\u9700\u8981\u5524\u9192`,
5533
- "\u73B0\u5728\u7ED9\u5B83\u8BF4\u8BDD\u7528 send_message \u2014\u2014 \u90A3\u6761\u4F1A\u63D2\u5230\u5B83\u4E0B\u4E00\u4E2A\u6B65\u9AA4\u8FB9\u754C\uFF0C\u5F53\u8F6E\u5C31\u751F\u6548"
5688
+ if (team.sessionExists(agentId)) {
5689
+ if (team.isSessionActive(agentId)) {
5690
+ return err2(
5691
+ 7210,
5692
+ `${agentId} \u6B63\u5728\u8DD1\uFF0C\u4E0D\u9700\u8981\u5524\u9192`,
5693
+ "\u73B0\u5728\u7ED9\u5B83\u8BF4\u8BDD\u7528 send_message \u2014\u2014 \u90A3\u6761\u4F1A\u8FDB\u5B83\u6B63\u5728\u8DD1\u7684\u90A3\u4E00\u8F6E"
5694
+ );
5695
+ }
5696
+ const self = team.bySession(ctx.sessionId);
5697
+ const from = self ? self.agentId : ctx.sessionId;
5698
+ const fromLabel = self ? void 0 : sessionSenderLabel(from, team.sessionTitle(from));
5699
+ const r = await team.wakeSession(
5700
+ agentId,
5701
+ agentMessageLine({ from, text: message, ...fromLabel ? { fromLabel } : {} })
5702
+ );
5703
+ if (!r.ok) return { ...err2(7211, r.reason ?? "\u5524\u9192\u5931\u8D25"), duration: Date.now() - start };
5704
+ return ok3(
5705
+ [
5706
+ `\u5DF2\u628A\u4F1A\u8BDD ${agentId} \u53EB\u8D77\u6765\u8DD1\u4E00\u8F6E\uFF08\u4E0D\u7B49\u5B83\u7B54\u5B8C\uFF0C\u5B83\u81EA\u5DF1\u90A3\u4E00\u8F6E\u5728\u540E\u53F0\u8DD1\uFF09\u3002`,
5707
+ `\u770B\u5B83\u7B54\u4E86\u4EC0\u4E48\uFF1Asession_messages_read ${agentId}\uFF1B\u6216\u8005\u7B49\u5B83\u7ED9\u4F60\u56DE\u6D88\u606F\u3002`
5708
+ ].join("\n"),
5709
+ start
5534
5710
  );
5535
5711
  }
5536
- const r = await manager.delegate(
5537
- {
5538
- tasks: [
5539
- {
5540
- goal: message,
5541
- agentId,
5542
- resumeSessionId: member.sessionId,
5543
- ...member.role ? { role: member.role } : {}
5544
- }
5545
- ],
5546
- background: true,
5547
- max_concurrent: 1
5548
- },
5549
- ctx.sessionId,
5550
- ctx.signal
5551
- );
5552
- if (!r.success) return { ...err2(7209, r.output), duration: Date.now() - start };
5553
- return ok3(
5554
- [
5555
- `\u5DF2\u5524\u9192 ${agentId}\uFF08\u540E\u53F0\u4F5C\u4E1A ${r.jobId ?? "(\u65E0)"}\uFF09\uFF0C\u5B83\u5E26\u7740\u4E0A\u4E00\u6B21\u7684\u4E0A\u4E0B\u6587\u63A5\u7740\u5E72\u3002`,
5556
- `\u770B\u5B83\u5E72\u5230\u54EA\u513F\u4E86\uFF1Atask_output ${r.jobId ?? ""} \u6216 list_agents`
5557
- ].join("\n"),
5558
- start
5559
- );
5712
+ return err2(7207, `\u6CA1\u6709\u8FD9\u4E2A\u6210\u5458\u6216\u4F1A\u8BDD\uFF1A${agentId}`, "\u7528 list_agents --all \u770B\u5F53\u524D\u6709\u8C01");
5560
5713
  }
5561
5714
  };
5562
5715
  }
@@ -5839,6 +5992,14 @@ var SessionQueries = class {
5839
5992
  if (!meta) return { authorized: false, title: "", before: [], after: [], total: 0 };
5840
5993
  const total = this.db.prepare(`SELECT count(*) AS n FROM messages WHERE session_id = @sid`).get({ sid: input.sessionId }).n;
5841
5994
  const base2 = { authorized: true, title: meta.title, total };
5995
+ if (input.messageId === void 0) {
5996
+ return {
5997
+ ...base2,
5998
+ before: [],
5999
+ after: [],
6000
+ tail: this.tailRows(input.sessionId, input.tail ?? 0).reverse().map(toRecord)
6001
+ };
6002
+ }
5842
6003
  const anchor = this.recordRow(input.sessionId, input.messageId);
5843
6004
  if (!anchor) return { ...base2, before: [], after: [] };
5844
6005
  return {
@@ -5944,6 +6105,16 @@ var SessionQueries = class {
5944
6105
  LIMIT @n`
5945
6106
  ).all({ sid: sessionId, anchor: anchorId, n });
5946
6107
  }
6108
+ tailRows(sessionId, n) {
6109
+ if (n <= 0) return [];
6110
+ return this.db.prepare(
6111
+ `SELECT id, role, content, timestamp, active, tool_name
6112
+ FROM messages
6113
+ WHERE session_id = @sid
6114
+ ORDER BY id DESC
6115
+ LIMIT @n`
6116
+ ).all({ sid: sessionId, n });
6117
+ }
5947
6118
  messageRows(safe, sessionId, limit) {
5948
6119
  const sql = (table) => `
5949
6120
  SELECT m.id, m.session_id, m.role, m.content, m.timestamp, m.active,
@@ -6076,6 +6247,8 @@ function createSessionListTool(deps) {
6076
6247
  }
6077
6248
  var DEFAULT_WINDOW = 2;
6078
6249
  var MAX_WINDOW = 10;
6250
+ var DEFAULT_TAIL = 5;
6251
+ var MAX_TAIL = MAX_WINDOW;
6079
6252
  var DEFAULT_TRACE_LIMIT = 20;
6080
6253
  var MAX_TRACE_LIMIT = 50;
6081
6254
  var BODY_BUDGET = 1500;
@@ -6108,7 +6281,7 @@ function body(text, budget) {
6108
6281
  if (flat.length <= budget) return flat;
6109
6282
  const rest = flat.length - budget;
6110
6283
  return `${flat.slice(0, budget)}
6111
- \u2026[cut ${rest} more chars \u2014 lower before/after to spend the budget on fewer messages]`;
6284
+ \u2026[cut ${rest} more chars \u2014 narrow the window (before / after / tail) to spend the budget on fewer messages]`;
6112
6285
  }
6113
6286
  function surfaceOf(record, isCurrent) {
6114
6287
  if (!isCurrent) return record.surface === "active" ? "active there" : "compacted there";
@@ -6121,7 +6294,21 @@ function renderRecord(record, mark, budget, isCurrent) {
6121
6294
  ` ${body(record.content, budget).split("\n").join("\n ")}`
6122
6295
  ].join("\n");
6123
6296
  }
6297
+ function tailBudgetOf(count) {
6298
+ return Math.max(MIN_BODY, Math.floor(BODY_BUDGET / Math.max(1, count)));
6299
+ }
6300
+ function renderTail(out, sessionId, isCurrent) {
6301
+ const tail = out.tail ?? [];
6302
+ const head = [
6303
+ `Session ${sessionId}${isCurrent ? " (this session)" : ""} \u2014 ${out.title || "(untitled)"}`,
6304
+ tail.length === 0 ? "this session has no messages." : `latest ${tail.length} of ${out.total} message(s), oldest first:`
6305
+ ];
6306
+ if (tail.length === 0) return head.join("\n");
6307
+ const budget = tailBudgetOf(tail.length);
6308
+ return [...head, "", ...tail.map((r) => renderRecord(r, " ", budget, isCurrent))].join("\n");
6309
+ }
6124
6310
  function renderWindow(out, sessionId, isCurrent) {
6311
+ if (out.tail) return renderTail(out, sessionId, isCurrent);
6125
6312
  const anchor = out.anchor;
6126
6313
  if (!anchor) return "";
6127
6314
  const count = out.before.length + out.after.length + 1;
@@ -6140,6 +6327,7 @@ function createSessionMessagesReadTool(deps) {
6140
6327
  name: SESSION_MESSAGES_READ_TOOL,
6141
6328
  description: `\u628A\u67D0\u4E00\u6761\u5386\u53F2\u6D88\u606F\u8FDE\u540C\u5B83\u524D\u540E\u51E0\u6761\u4E00\u8D77\u8BFB\u51FA\u6765 \u2014\u2014 \u68C0\u7D22\u7ED9\u7684\u662F\u7247\u6BB5\uFF0C\u8FD9\u4E2A\u7ED9\u7684\u662F\u539F\u6587\u3002
6142
6329
  sessionId + messageId \u6765\u81EA session_search / session_messages_search \u7684\u547D\u4E2D\u3002
6330
+ **\u4E0D\u4F20 messageId \u5C31\u6539\u8BFB\u8FD9\u6BB5\u4F1A\u8BDD\u6700\u8FD1\u51E0\u6761** \u2014\u2014 \u6CA1\u547D\u4E2D\u3001\u4E0D\u77E5\u9053\u4ECE\u54EA\u8BFB\u8D77\u65F6\u7528\u8FD9\u4E2A\uFF0C\u522B\u53BB\u731C id\uFF08id \u662F\u5168\u5E93\u81EA\u589E\u7684\uFF0C\u731C\u4E0D\u4E2D\uFF09\u3002
6143
6331
  before / after \u5404\u9ED8\u8BA4 ${DEFAULT_WINDOW}\u3001\u4E0A\u9650 ${MAX_WINDOW}\uFF08\u4F20\u5927\u4E86\u81EA\u52A8\u5939\u7D27\uFF0C\u4E0D\u62A5\u9519\uFF09\u3002
6144
6332
  \u6B63\u6587\u6709\u5B57\u7B26\u9884\u7B97\uFF0C\u8D85\u4E86\u4F1A\u622A\u65AD\u5E76\u660E\u8BF4\u622A\u4E86\u591A\u5C11 \u2014\u2014 \u60F3\u770B\u5168\u5C31\u628A before / after \u8C03\u5C0F\u3002
6145
6333
  \u5DF2\u7ECF\u88AB\u538B\u7F29\u76D6\u6389\u7684\u539F\u6587\u7167\u6837\u8BFB\u5F97\u5230\uFF0C\u90A3\u6B63\u662F\u8FD9\u4E2A\u5DE5\u5177\u5B58\u5728\u7684\u7406\u7531\u3002`,
@@ -6150,7 +6338,11 @@ before / after \u5404\u9ED8\u8BA4 ${DEFAULT_WINDOW}\u3001\u4E0A\u9650 ${MAX_WIND
6150
6338
  sessionId: { type: "string", description: "\u8BFB\u54EA\u6BB5\u4F1A\u8BDD\u3002\u6765\u81EA\u68C0\u7D22\u7ED3\u679C" },
6151
6339
  messageId: {
6152
6340
  type: "number",
6153
- description: "\u951A\u70B9\u6D88\u606F\u7684 id\uFF08\u68C0\u7D22\u547D\u4E2D\u91CC # \u540E\u9762\u90A3\u4E2A\u6570\u5B57\uFF09"
6341
+ description: `\u951A\u70B9\u6D88\u606F\u7684 id\uFF08\u68C0\u7D22\u547D\u4E2D\u91CC # \u540E\u9762\u90A3\u4E2A\u6570\u5B57\uFF09\u3002\u7701\u7565\u65F6\u6539\u4E3A\u8BFB\u6700\u8FD1 ${DEFAULT_TAIL} \u6761`
6342
+ },
6343
+ tail: {
6344
+ type: "number",
6345
+ description: `\u7701\u7565 messageId \u65F6\u8BFB\u6700\u8FD1\u51E0\u6761\uFF0C\u9ED8\u8BA4 ${DEFAULT_TAIL}\uFF0C\u4E0A\u9650 ${MAX_TAIL}`
6154
6346
  },
6155
6347
  before: {
6156
6348
  type: "number",
@@ -6167,7 +6359,7 @@ before / after \u5404\u9ED8\u8BA4 ${DEFAULT_WINDOW}\u3001\u4E0A\u9650 ${MAX_WIND
6167
6359
  }
6168
6360
  } : {}
6169
6361
  },
6170
- required: ["sessionId", "messageId"]
6362
+ required: ["sessionId"]
6171
6363
  };
6172
6364
  },
6173
6365
  exposure: ToolExposure.Direct,
@@ -6184,14 +6376,15 @@ before / after \u5404\u9ED8\u8BA4 ${DEFAULT_WINDOW}\u3001\u4E0A\u9650 ${MAX_WIND
6184
6376
  const start = Date.now();
6185
6377
  const sessionId = String(args["sessionId"] ?? "").trim();
6186
6378
  if (!sessionId) return Promise.resolve(fail4("sessionId must not be empty", start, 8007));
6187
- const messageId = Number(args["messageId"]);
6188
- if (!Number.isInteger(messageId) || messageId <= 0) {
6379
+ const rawId = args["messageId"];
6380
+ const messageId = rawId === void 0 || rawId === null || rawId === "" ? void 0 : Number(rawId);
6381
+ if (messageId !== void 0 && (!Number.isInteger(messageId) || messageId <= 0)) {
6189
6382
  return Promise.resolve(
6190
6383
  fail4(
6191
6384
  "messageId must be a positive integer",
6192
6385
  start,
6193
6386
  8008,
6194
- "Use the number after # from a session_search / session_messages_search hit"
6387
+ "Use the number after # from a session_search / session_messages_search hit \u2014 or omit messageId entirely to read the latest messages in that session"
6195
6388
  )
6196
6389
  );
6197
6390
  }
@@ -6199,9 +6392,10 @@ before / after \u5404\u9ED8\u8BA4 ${DEFAULT_WINDOW}\u3001\u4E0A\u9650 ${MAX_WIND
6199
6392
  try {
6200
6393
  const out = deps.queries.readMessages({
6201
6394
  sessionId,
6202
- messageId,
6395
+ ...messageId === void 0 ? {} : { messageId },
6203
6396
  before: clampWindow(args["before"], DEFAULT_WINDOW, MAX_WINDOW),
6204
6397
  after: clampWindow(args["after"], DEFAULT_WINDOW, MAX_WINDOW),
6398
+ tail: clampWindow(args["tail"], DEFAULT_TAIL, MAX_TAIL),
6205
6399
  currentSessionId: ctx.sessionId,
6206
6400
  workspaceCwd: deps.workspaceCwd,
6207
6401
  allWorkspaces
@@ -6216,13 +6410,13 @@ before / after \u5404\u9ED8\u8BA4 ${DEFAULT_WINDOW}\u3001\u4E0A\u9650 ${MAX_WIND
6216
6410
  )
6217
6411
  );
6218
6412
  }
6219
- if (!out.anchor) {
6413
+ if (messageId !== void 0 && !out.anchor) {
6220
6414
  return Promise.resolve(
6221
6415
  fail4(
6222
6416
  `session ${sessionId} has no message #${messageId} (it has ${out.total})`,
6223
6417
  start,
6224
6418
  8010,
6225
- "messageId must come from a hit in that same session \u2014 ids are not positions"
6419
+ "messageId must come from a hit in that same session \u2014 ids are not positions. Omit messageId entirely to read the latest messages instead."
6226
6420
  )
6227
6421
  );
6228
6422
  }
@@ -6355,7 +6549,9 @@ function fail5(message, start, code, suggestion) {
6355
6549
  };
6356
6550
  }
6357
6551
  function emptyHint(query) {
6358
- return belowTrigramFloor(sanitizeFtsQuery(query)) ? ` Note: every word here is shorter than ${TRIGRAM_MIN_CHARS} characters, which the substring index cannot match at all \u2014 this is "cannot search", not "not found". Retry with a longer phrase.` : " Try fewer or different words.";
6552
+ return belowTrigramFloor(sanitizeFtsQuery(query)) ? ` Note: every word here is shorter than ${TRIGRAM_MIN_CHARS} characters, which the substring index cannot match at all \u2014 this is "cannot search", not "not found". Retry with a longer phrase.` : (
6553
+ " Try a shorter phrase copied verbatim from the text you expect \u2014 matching is on a continuous substring (at least 3 characters), not on separate keywords joined together."
6554
+ );
6359
6555
  }
6360
6556
  function clampLimit2(raw) {
6361
6557
  const n = Number(raw);
@@ -6397,7 +6593,7 @@ function createSessionSearchTool(deps) {
6397
6593
  properties: {
6398
6594
  query: {
6399
6595
  type: "string",
6400
- description: "\u68C0\u7D22\u8BCD\u3002\u5F53\u666E\u901A\u6587\u672C\u5199\uFF0C\u4E0D\u8981\u5199 FTS5 \u8BED\u6CD5\uFF08\u5F15\u53F7 / \u62EC\u53F7 / AND \u4F1A\u88AB\u6E05\u6389\uFF09"
6596
+ description: "\u68C0\u7D22\u8BCD\u3002\u5F53\u666E\u901A\u6587\u672C\u5199\uFF0C\u4E0D\u8981\u5199 FTS5 \u8BED\u6CD5\uFF08\u5F15\u53F7 / \u62EC\u53F7 / AND \u4F1A\u88AB\u6E05\u6389\uFF09\u3002\n\u5339\u914D\u7684\u662F**\u539F\u6587\u91CC\u8FDE\u7EED\u51FA\u73B0\u7684\u4E00\u6BB5**\uFF08\u81F3\u5C11 3 \u4E2A\u5B57\uFF09\uFF0C\u4E0D\u662F\u5206\u8BCD \u2014\u2014 \u6284\u539F\u6587\u91CC\u8FB9\u8FDE\u7740\u7684\u51E0\u4E2A\u5B57\u6BD4\u62FC\u5173\u952E\u8BCD\u51C6\u3002"
6401
6597
  },
6402
6598
  limit: {
6403
6599
  type: "number",
@@ -6489,7 +6685,7 @@ function createSessionMessagesSearchTool(deps) {
6489
6685
  },
6490
6686
  query: {
6491
6687
  type: "string",
6492
- description: "\u68C0\u7D22\u8BCD\u3002\u5F53\u666E\u901A\u6587\u672C\u5199\uFF0C\u4E0D\u8981\u5199 FTS5 \u8BED\u6CD5"
6688
+ description: "\u68C0\u7D22\u8BCD\u3002\u5F53\u666E\u901A\u6587\u672C\u5199\uFF0C\u4E0D\u8981\u5199 FTS5 \u8BED\u6CD5\u3002\n\u5339\u914D\u7684\u662F**\u539F\u6587\u91CC\u8FDE\u7EED\u51FA\u73B0\u7684\u4E00\u6BB5**\uFF08\u81F3\u5C11 3 \u4E2A\u5B57\uFF09\uFF0C\u4E0D\u662F\u5206\u8BCD \u2014\u2014 \u6284\u539F\u6587\u91CC\u8FB9\u8FDE\u7740\u7684\u51E0\u4E2A\u5B57\u6BD4\u62FC\u5173\u952E\u8BCD\u51C6\u3002"
6493
6689
  },
6494
6690
  limit: {
6495
6691
  type: "number",
@@ -6999,7 +7195,7 @@ function matches(tool, terms) {
6999
7195
  function createToolSearchTool(deps) {
7000
7196
  return {
7001
7197
  name: "tool_search",
7002
- description: '\u6309\u5173\u952E\u8BCD\u627E\u51FA**\u5F53\u524D\u5DE5\u5177\u5217\u8868\u91CC\u6CA1\u6709**\u7684\u5DE5\u5177\uFF0C\u627E\u5230\u4E4B\u540E\u5B83\u4EEC\u5C31\u4F1A\u51FA\u73B0\u5728\u4F60\u7684\u5DE5\u5177\u5217\u8868\u91CC\u3002\n\u8FD9\u53F0\u673A\u5668\u4E0A\u63A5\u7684\u5DE5\u5177\u53EF\u80FD\u5F88\u591A\uFF08\u6BD4\u5982\u5404\u79CD MCP server\uFF09\uFF0C\u5168\u90E8\u585E\u8FDB\u5217\u8868\u4F1A\u5360\u6389\u5927\u91CF\u4E0A\u4E0B\u6587\uFF0C\u6240\u4EE5\u4E0D\u5E38\u7528\u7684\u90A3\u4E9B\u9ED8\u8BA4\u4E0D\u5728\u91CC\u9762 \u2014\u2014 \u9700\u8981\u65F6\u7528\u8FD9\u4E2A\u5DE5\u5177\u628A\u5B83\u4EEC\u627E\u51FA\u6765\u3002\n\u67E5\u8BE2\u8BCD\u5199\u4F60\u60F3\u5E72\u7684\u4E8B\u6216\u76EE\u6807\u7CFB\u7EDF\uFF0C\u6BD4\u5982 "github issue"\u3001"\u6570\u636E\u5E93 \u67E5\u8BE2"\u3002\u591A\u4E2A\u8BCD\u662F\u300C\u90FD\u8981\u547D\u4E2D\u300D\uFF0C\u5148\u5199\u5BBD\u4E00\u70B9\u518D\u6536\u7A84\u3002\n\u26A0\uFE0F \u627E\u5230\u4E4B\u540E**\u4E0D\u8981\u5728\u8FD9\u4E00\u8F6E\u91CC\u8C03\u5B83** \u2014\u2014 \u5B83\u8981\u5230\u4F60\u7684\u4E0B\u4E00\u6B21\u53D1\u8A00\u624D\u771F\u6B63\u51FA\u73B0\u5728\u5DE5\u5177\u5217\u8868\u91CC\uFF0C\u76F4\u63A5\u8C03\u4F1A\u5931\u8D25\u3002',
7198
+ description: '\u6309\u5173\u952E\u8BCD\u627E\u51FA**\u5F53\u524D\u5DE5\u5177\u5217\u8868\u91CC\u6CA1\u6709**\u7684\u5DE5\u5177\uFF0C\u627E\u5230\u4E4B\u540E\u5B83\u4EEC\u5C31\u4F1A\u51FA\u73B0\u5728\u4F60\u7684\u5DE5\u5177\u5217\u8868\u91CC\u3002\n\u8FD9\u53F0\u673A\u5668\u4E0A\u63A5\u7684\u5DE5\u5177\u53EF\u80FD\u5F88\u591A\uFF08\u6BD4\u5982\u5404\u79CD MCP server\uFF09\uFF0C\u5168\u90E8\u585E\u8FDB\u5217\u8868\u4F1A\u5360\u6389\u5927\u91CF\u4E0A\u4E0B\u6587\uFF0C\u6240\u4EE5\u4E0D\u5E38\u7528\u7684\u90A3\u4E9B\u9ED8\u8BA4\u4E0D\u5728\u91CC\u9762 \u2014\u2014 \u9700\u8981\u65F6\u7528\u8FD9\u4E2A\u5DE5\u5177\u628A\u5B83\u4EEC\u627E\u51FA\u6765\u3002\n\u67E5\u8BE2\u8BCD\u5199\u4F60\u60F3\u5E72\u7684\u4E8B\u6216\u76EE\u6807\u7CFB\u7EDF\uFF0C\u6BD4\u5982 "github issue"\u3001"\u6570\u636E\u5E93 \u67E5\u8BE2"\u3002\u591A\u4E2A\u8BCD\u662F\u300C\u90FD\u8981\u547D\u4E2D\u300D\uFF0C\u5148\u5199\u5BBD\u4E00\u70B9\u518D\u6536\u7A84\u3002\n\u26A0\uFE0F \u627E\u5230\u4E4B\u540E**\u4E0D\u8981\u505C\u4E0B\u6765\u7B49\u7528\u6237** \u2014\u2014 \u7D27\u63A5\u7740\u518D\u53D1\u8D77\u4E00\u6B21\u8BF7\u6C42\uFF0C\u5B83\u4EEC\u5C31\u5DF2\u7ECF\u5728\u4F60\u7684\u5DE5\u5177\u5217\u8868\u91CC\u4E86\uFF1B\n\u552F\u4E00\u505A\u4E0D\u5230\u7684\u662F\u548C `tool_search` \u5728**\u540C\u4E00\u6B21\u54CD\u5E94\u91CC**\u5E76\u884C\u8C03\u5B83\u4EEC\uFF08\u53D1\u8FD9\u6B21\u8BF7\u6C42\u65F6\u5B83\u4EEC\u8FD8\u4E0D\u5728\u5217\u8868\u91CC\uFF09\u3002',
7003
7199
  parameters: {
7004
7200
  type: "object",
7005
7201
  properties: {
@@ -7040,7 +7236,7 @@ function createToolSearchTool(deps) {
7040
7236
  (${hits.length - picked.length} more matched but were not added \u2014 narrow the query if the tool you want is missing.)` : "";
7041
7237
  return Promise.resolve({
7042
7238
  success: true,
7043
- output: `Added ${picked.length} tool(s) to your tool list. They become callable on your next turn \u2014 do not call them in this one.
7239
+ output: `Added ${picked.length} tool(s) to your tool list. They are callable on your **next request** \u2014 the next step of this same turn. The only thing you cannot do is call them in the same response that ran this search. Do not stop and wait for the user.
7044
7240
 
7045
7241
  ${lines.join("\n")}${truncated}`,
7046
7242
  duration: Date.now() - start
@@ -14355,7 +14551,10 @@ function outputText(output) {
14355
14551
  function failureText(r) {
14356
14552
  const detail = r.error?.message?.trim() || outputText(r.output).trim();
14357
14553
  if (!detail) return "\u5DE5\u5177\u6267\u884C\u5931\u8D25\uFF08\u5DE5\u5177\u672A\u63D0\u4F9B\u539F\u56E0\uFF09";
14358
- return r.error?.code === void 0 ? `\u5DE5\u5177\u6267\u884C\u5931\u8D25\uFF1A${detail}` : `\u5DE5\u5177\u6267\u884C\u5931\u8D25 [${r.error.code}]: ${detail}`;
14554
+ const head = r.error?.code === void 0 ? `\u5DE5\u5177\u6267\u884C\u5931\u8D25\uFF1A${detail}` : `\u5DE5\u5177\u6267\u884C\u5931\u8D25 [${r.error.code}]: ${detail}`;
14555
+ const hint = r.error?.suggestion?.trim();
14556
+ return hint ? `${head}
14557
+ ${hint}` : head;
14359
14558
  }
14360
14559
  var ToolExecutor = class {
14361
14560
  constructor(deps) {
@@ -15007,6 +15206,7 @@ var AgentLoop = class {
15007
15206
  [GEN_AI.CONVERSATION_ID]: input.sessionId
15008
15207
  });
15009
15208
  try {
15209
+ this.config.team?.beginSessionTurn(input.sessionId);
15010
15210
  const rawHistory = (input.history ?? []).map((h) => ({
15011
15211
  role: h.role,
15012
15212
  content: h.content,
@@ -15604,6 +15804,7 @@ ${finalText}` };
15604
15804
  sessionId: input.sessionId,
15605
15805
  totalTokens: totalInput + totalOutput
15606
15806
  });
15807
+ this.config.team?.endSessionTurn(input.sessionId);
15607
15808
  runSpan.setAttribute("epoch.turns", turns.length);
15608
15809
  runSpan.setAttribute(GEN_AI.USAGE_INPUT_TOKENS, totalInput);
15609
15810
  runSpan.setAttribute(GEN_AI.USAGE_OUTPUT_TOKENS, totalOutput);
@@ -15674,7 +15875,8 @@ ${finalText}` };
15674
15875
  messages: compressed.messages.map((m) => unflattenMessage(m)),
15675
15876
  ...bill,
15676
15877
  ...compressed.carriedHead === void 0 ? {} : { carriedHead: compressed.carriedHead },
15677
- ...compressed.carriedTail === void 0 ? {} : { carriedTail: compressed.carriedTail }
15878
+ ...compressed.carriedTail === void 0 ? {} : { carriedTail: compressed.carriedTail },
15879
+ summarySkipped: compressed.summarySkipped === true
15678
15880
  };
15679
15881
  } catch {
15680
15882
  return { messages };
@@ -28372,4 +28574,4 @@ function hasDedicatedExecContent(inv) {
28372
28574
  * `--tree` 的命令帮助里,让用户自己知道 `--tree` 意味着什么。
28373
28575
  */
28374
28576
 
28375
- export { ABOUT_DESC_MAX_CHARS, ABOUT_README_MAX_CHARS, AGENT_ROLE_DIAG_MODULE, ARTIFACT_MAX_TOTAL_BYTES, ARTIFACT_RETENTION_DEFAULTS, ATTACHMENT_MAX_TOTAL_BYTES, ATTACHMENT_RETENTION_DEFAULTS, AgentInbox, AgentLoop, AppearanceStore, ApprovalCache, BLOCKED_TOOLS, BOARD_TOOL_NAMES, BoardStore, 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_INBOX_CAPACITY, DEFAULT_MAX_HOLD_CHARS, DELEGATE_SESSION_SOURCE, 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_POST_CHARS, MAX_REASON_CHARS, MAX_RECENT_WORKSPACES, MODEL_ENTRIES_FILE, MODEL_GIVE_UP_THRESHOLD, MULTIMODAL_DEFAULTS, ManagedPolicyError, ManagedSettingsSchema, MemoryManager, ModelFailureTracker, NOMINAL_TOTAL_BYTES, NO_REVEALED_TOOLS, PACK_EXCLUDES, PERMISSION_AUDIT_CODES, PLUGIN_ICON_MAX_BYTES, PLUGIN_LAYOUT, PLUGIN_MANIFEST_FILE, PLUGIN_MANIFEST_KEYS, PLUGIN_NAME_PATTERN, PLUGIN_ROOT_ENV, PLUGIN_ROOT_TOKEN, PLUGIN_VISIBILITY, POLICY_DECISIONS, PROBE_VERSION, PROJECT_AGENTS_SUBDIR, PROVIDER_NO_CREDENTIAL, PermissionManager, PlanModeState, PluginAuthorSchema, PluginStore, PolicyRuleSchema, ProviderError, ProviderRouter, RECORDING_KEEP_RUNS, RECORDING_MAX_BYTES, ROLE_FRONTMATTER_SCHEMA, RUN_CODE_TOOL, RecentWorkspaces, SANDBOX_COVERS, SANDBOX_EXCLUDES, SCALAR_KEYS, SCHEDULE_DEFAULTS, SCHEDULE_DEFAULT_ALLOWLIST, SCHEDULE_ISSUE_CODES, SCHTASKS_FOLDER, SEND_MESSAGE_TOOL, SESSION_MESSAGES_READ_TOOL, SESSION_MESSAGES_SEARCH_TOOL, SESSION_QUERY_TOOLS, SESSION_SEARCH_TOOL, SESSION_TRACE_TOOL, SETTINGS_LAYER_ORDER, SETTING_WRITE_KEYS, SETTING_WRITE_LAYERS, SKILL_ASSET_DIRS, SKILL_CREATE_TOOL, SKILL_EDIT_TOOL, SKILL_FILE, SKILL_PATCH_TOOL, SKILL_VIEW_TOOL, SKILL_WRITE_FILE_TOOL, SLASH_COMMANDS_DIAG_MODULE, ScheduleRecorder, ScheduleRegistrar, ScheduleStore, SessionManager, SessionQueries, SessionReferences, SettingsFileError, SettingsFileSchema, SkillLearner, SkillSystem, TEAM_TOOL_NAMES, TOOL_SEARCH_TOOL, TaskNoticeTracker, TeamRegistry, ToolRegistry, TrackerDB, TrustManager, UNSETTABLE_USER_KEYS, Workspace, acquireScheduleLock, addMarketplace, addUsage, admitArtifact, admitArtifacts, affectedPaths, approvalEntryFor, approvalRootFor, artifactLaunchArgv, artifactOpenRefusal, assertLevelAllowed, blockedRoleTools, buildContextBreakdown, buildFireArgv, buildFtsMatchQuery, buildSchemaExports, buildSystemPrompt, buildTrigramMatchQuery, builtinRoles, capabilityOfRef, checkConfigValue, checkEpochVersion, checkFtsHealth, checkShadowing, classifyPersistFailure, classifyProviderError, clearModelCache, coalesceRecording, codeModeWorkerPath, commandNameFromRelPath, compileRuleLists, compressionOptions, computeCost, computeCostMicros, computeExecHash, configKeyByPath, configKeyTable, countRules, createAllowAllGate, createAllowAllImportGate, createAskQuestionTool, createBoardTools, createCodeExecTool, createDelegateTool, createDenyAllGate, createDenyAllImportGate, createGoalTool, createImportGate, createMemoryTool, createPlanModeTools, createPluginScope, createRoleFile, createRoleScope, createRunCodeTool, createScheduleDraftTool, createSendMessageTool, createSessionMessagesReadTool, createSessionMessagesSearchTool, createSessionSearchTool, createSessionSearchTools, createSessionTraceTool, createSkillViewTool, createSkillWriteTools, createTeamTools, createTodoTool, createToolRevealState, createToolScope, createToolSearchTool, createTrustGate, currentEpochVersion, decideImport, decideTrust, defaultConfig, describeArtifactRefusal, describeBackgroundTask, describeHeadlessPolicy, describeIsolation, describeJsonError, diagnoseSchedules, discoverMarkdown, discoverModels, discoverProject, discoverySpec, 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, hasUsableModel, imageFromBase64, imageFromPath, imagePartTokens, importParts, importSkills, installPlugin, instructionDirs, instructionNotices, intervalSlots, inventoryProjectExtensions, inventoryTotal, isBlockCode, isCodeModeDeferred, isEmptyRules, isGoalPhase, isNonInteractive, isReadOnlySubCall, isSettingWriteLayer, isTransientPersistFailure, isValidInterval, isValidPluginName, isWithinWindow, isWritableSettingKey, labelSlug, layerRank, listEntryModels, listRunningSchedules, listSessionCandidates, listWorkspaceFiles, loadCommandDefinitions, loadCommandFile, loadCommands, loadConfig, loadHookSources, loadKeybindings, loadLexiconDir, loadLexiconFiles, loadModelEntries, loadPlugins, loadPolicyFiles, loadPolicyRules, loadRoleDefinitions, loadRoleDir, loadedImports, localDateString, managedSwitchNotes, mapClaudeToolName, mapEpochToolName, mapOperationType, matchPreauthorization, matchRuleLists, matchesHook, mentionsPluginRoot, mergeHeadlessPolicy, mergeRoles, mergeSchedulePatch, microsToUsd, modelEntriesPath, modelListCandidates, needsAllowlist, nextRunAt, noConfigOrigins, noManagedPolicy, noPlugins, normalizeModelEntry, normalizeTrigger, offloadOldestImages, openArtifact, originOf, packFileName, packPlugin, parseClaudeSettingsHooks, parseClock, parseDate, parseFrontmatter, parseHooksConfig, parseHooksConfigVerbose, parseImportLine, parseModelEntry, parseModelList, parseRoleDefinition, parseScheduleDraft, parseSkillFrontmatter, parseTrigger, pendingImageTokens, persistFailureCode, persistParts, persistToolResults, persistedUsage, planPack, previewSkillImport, pricingFor, projectEntryForDisplay, pruneArtifacts, pruneAttachments, pruneRecordings, pruneSchedules, readEntryKey, readImageSize, readMarketplaces, readPluginAbout, readPluginIcon, readPluginManifest, readPluginRecords, readRecording, readSessionSurface, reclaimFtsSpace, redactLine, refreshOpenRouterMetadata, removeMarketplace, removeRecordings, removeRoleFile, removeSessionArtifacts, removeSessionAttachments, renderImportTree, renderProjectContext, renderSdkDeclaration, renderSelfIndex, repairSchedules, requestImageBytes, 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, saveModelEntries, scanInstructions, scanPluginDir, scanSkillDirs, searchMarketplaces, setDisplayCurrency, setImportGate, setPluginEnabled, setTrustGate, settingValueChoices, settingValueKind, settingWriteApply, settingWriteLayers, settingWriteTargets, skillIndexDescription, skillIndexResidency, skillIndexStats, sniffMediaType, splitFrontmatter, staticToolProvider, stripArtifactData, substitutePluginRoot, suggestRuleFromApproval, systemOpenArgv, systemPromptSegments, testModelEntry, toPosix, toolDefinitionTokens, toolMatches, toolTableTokens, totalTokens, traceSession, triggerPeriodMs, unescapeRuleContent, uninstallPlugin, unknownRoleSkills, unknownRoleTools, unloadedInstructionFiles, unsetUserSetting, updateMarketplace, updatePlugin, usdToMicros, validateSchedule, validateTrigger, validateWindow, withGoalCompression, withGoalPrompt, workspaceDisplayPath, writableConfigKeys, writeSettingValue };
28577
+ export { ABOUT_DESC_MAX_CHARS, ABOUT_README_MAX_CHARS, AGENT_ROLE_DIAG_MODULE, ARTIFACT_MAX_TOTAL_BYTES, ARTIFACT_RETENTION_DEFAULTS, ATTACHMENT_MAX_TOTAL_BYTES, ATTACHMENT_RETENTION_DEFAULTS, AgentInbox, AgentLoop, AppearanceStore, ApprovalCache, BLOCKED_TOOLS, BOARD_TOOL_NAMES, BoardStore, 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_INBOX_CAPACITY, DEFAULT_MAX_HOLD_CHARS, DEFAULT_MAX_RUNNING_MEMBERS, DEFAULT_MAX_WOKEN_SESSIONS, DELEGATE_SESSION_SOURCE, 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_POST_CHARS, MAX_REASON_CHARS, MAX_RECENT_WORKSPACES, MODEL_ENTRIES_FILE, MODEL_GIVE_UP_THRESHOLD, MULTIMODAL_DEFAULTS, ManagedPolicyError, ManagedSettingsSchema, MemoryManager, ModelFailureTracker, NOMINAL_TOTAL_BYTES, NO_REVEALED_TOOLS, PACK_EXCLUDES, PERMISSION_AUDIT_CODES, PLUGIN_ICON_MAX_BYTES, PLUGIN_LAYOUT, PLUGIN_MANIFEST_FILE, PLUGIN_MANIFEST_KEYS, PLUGIN_NAME_PATTERN, PLUGIN_ROOT_ENV, PLUGIN_ROOT_TOKEN, PLUGIN_VISIBILITY, POLICY_DECISIONS, PROBE_VERSION, PROJECT_AGENTS_SUBDIR, PROVIDER_NO_CREDENTIAL, PermissionManager, PlanModeState, PluginAuthorSchema, PluginStore, PolicyRuleSchema, ProviderError, ProviderRouter, RECORDING_KEEP_RUNS, RECORDING_MAX_BYTES, ROLE_FRONTMATTER_SCHEMA, RUN_CODE_TOOL, RecentWorkspaces, SANDBOX_COVERS, SANDBOX_EXCLUDES, SCALAR_KEYS, SCHEDULE_DEFAULTS, SCHEDULE_DEFAULT_ALLOWLIST, SCHEDULE_ISSUE_CODES, SCHTASKS_FOLDER, SEND_MESSAGE_TOOL, SESSION_MESSAGES_READ_TOOL, SESSION_MESSAGES_SEARCH_TOOL, SESSION_QUERY_TOOLS, SESSION_SEARCH_TOOL, SESSION_TRACE_TOOL, SETTINGS_LAYER_ORDER, SETTING_WRITE_KEYS, SETTING_WRITE_LAYERS, SKILL_ASSET_DIRS, SKILL_CREATE_TOOL, SKILL_EDIT_TOOL, SKILL_FILE, SKILL_PATCH_TOOL, SKILL_VIEW_TOOL, SKILL_WRITE_FILE_TOOL, SLASH_COMMANDS_DIAG_MODULE, ScheduleRecorder, ScheduleRegistrar, ScheduleStore, SessionManager, SessionQueries, SessionReferences, SettingsFileError, SettingsFileSchema, SkillLearner, SkillSystem, TEAM_TOOL_NAMES, TOOL_SEARCH_TOOL, TaskNoticeTracker, TeamRegistry, ToolRegistry, TrackerDB, TrustManager, UNSETTABLE_USER_KEYS, Workspace, acquireScheduleLock, addMarketplace, addUsage, admitArtifact, admitArtifacts, affectedPaths, approvalEntryFor, approvalRootFor, artifactLaunchArgv, artifactOpenRefusal, assertLevelAllowed, blockedRoleTools, buildContextBreakdown, buildFireArgv, buildFtsMatchQuery, buildSchemaExports, buildSystemPrompt, buildTrigramMatchQuery, builtinRoles, capabilityOfRef, checkConfigValue, checkEpochVersion, checkFtsHealth, checkShadowing, classifyPersistFailure, classifyProviderError, clearModelCache, coalesceRecording, codeModeWorkerPath, commandNameFromRelPath, compileRuleLists, compressionOptions, computeCost, computeCostMicros, computeExecHash, configKeyByPath, configKeyTable, countRules, createAllowAllGate, createAllowAllImportGate, createAskQuestionTool, createBoardTools, createCodeExecTool, createDelegateTool, createDenyAllGate, createDenyAllImportGate, createGoalTool, createImportGate, createMemoryTool, createPlanModeTools, createPluginScope, createRoleFile, createRoleScope, createRunCodeTool, createScheduleDraftTool, createSendMessageTool, createSessionMessagesReadTool, createSessionMessagesSearchTool, createSessionSearchTool, createSessionSearchTools, createSessionTraceTool, createSkillViewTool, createSkillWriteTools, createTeamTools, createTodoTool, createToolRevealState, createToolScope, createToolSearchTool, createTrustGate, currentEpochVersion, decideImport, decideTrust, defaultConfig, describeArtifactRefusal, describeBackgroundTask, describeHeadlessPolicy, describeIsolation, describeJsonError, diagnoseSchedules, discoverMarkdown, discoverModels, discoverProject, discoverySpec, 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, hasUsableModel, imageFromBase64, imageFromPath, imagePartTokens, importParts, importSkills, installPlugin, instructionDirs, instructionNotices, intervalSlots, inventoryProjectExtensions, inventoryTotal, isBlockCode, isCodeModeDeferred, isEmptyRules, isGoalPhase, isNonInteractive, isReadOnlySubCall, isSettingWriteLayer, isTransientPersistFailure, isValidInterval, isValidPluginName, isWithinWindow, isWritableSettingKey, labelSlug, layerRank, listEntryModels, listRunningSchedules, listSessionCandidates, listWorkspaceFiles, loadCommandDefinitions, loadCommandFile, loadCommands, loadConfig, loadHookSources, loadKeybindings, loadLexiconDir, loadLexiconFiles, loadModelEntries, loadPlugins, loadPolicyFiles, loadPolicyRules, loadRoleDefinitions, loadRoleDir, loadedImports, localDateString, managedSwitchNotes, mapClaudeToolName, mapEpochToolName, mapOperationType, matchPreauthorization, matchRuleLists, matchesHook, mentionsPluginRoot, mergeHeadlessPolicy, mergeRoles, mergeSchedulePatch, microsToUsd, modelEntriesPath, modelListCandidates, needsAllowlist, nextRunAt, noConfigOrigins, noManagedPolicy, noPlugins, normalizeModelEntry, normalizeTrigger, offloadOldestImages, openArtifact, originOf, packFileName, packPlugin, parseClaudeSettingsHooks, parseClock, parseDate, parseFrontmatter, parseHooksConfig, parseHooksConfigVerbose, parseImportLine, parseModelEntry, parseModelList, parseRoleDefinition, parseScheduleDraft, parseSkillFrontmatter, parseTrigger, pendingImageTokens, persistFailureCode, persistParts, persistToolResults, persistedUsage, planPack, previewSkillImport, pricingFor, projectEntryForDisplay, pruneArtifacts, pruneAttachments, pruneRecordings, pruneSchedules, readEntryKey, readImageSize, readMarketplaces, readPluginAbout, readPluginIcon, readPluginManifest, readPluginRecords, readRecording, readSessionSurface, reclaimFtsSpace, redactLine, refreshOpenRouterMetadata, removeMarketplace, removeRecordings, removeRoleFile, removeSessionArtifacts, removeSessionAttachments, renderImportTree, renderProjectContext, renderSdkDeclaration, renderSelfIndex, repairSchedules, requestImageBytes, 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, saveModelEntries, scanInstructions, scanPluginDir, scanSkillDirs, searchMarketplaces, setDisplayCurrency, setImportGate, setPluginEnabled, setTrustGate, settingValueChoices, settingValueKind, settingWriteApply, settingWriteLayers, settingWriteTargets, skillIndexDescription, skillIndexResidency, skillIndexStats, sniffMediaType, splitFrontmatter, staticToolProvider, stripArtifactData, substitutePluginRoot, suggestRuleFromApproval, systemOpenArgv, systemPromptSegments, testModelEntry, toPosix, toolDefinitionTokens, toolMatches, toolTableTokens, totalTokens, traceSession, triggerPeriodMs, unescapeRuleContent, uninstallPlugin, unknownRoleSkills, unknownRoleTools, unloadedInstructionFiles, unsetUserSetting, updateMarketplace, updatePlugin, usdToMicros, validateSchedule, validateTrigger, validateWindow, withGoalCompression, withGoalPrompt, workspaceDisplayPath, writableConfigKeys, writeSettingValue };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@epoch-agent/core",
3
- "version": "3.1.1",
3
+ "version": "3.1.2",
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": "3.1.1",
31
- "@epoch-agent/protocol": "3.1.1"
30
+ "@epoch-agent/infra": "3.1.2",
31
+ "@epoch-agent/protocol": "3.1.2"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@ai-sdk/alibaba": "^2.0.69",