|
1 | 1 | import crypto from "node:crypto"; |
2 | 2 | import type { ClearSessionQueueResult } from "../auto-reply/reply/queue.js"; |
3 | | -import { |
4 | | - resolveSubagentLabel, |
5 | | - resolveSubagentTargetFromRuns, |
6 | | - sortSubagentRuns, |
7 | | - type SubagentTargetResolution, |
8 | | -} from "../auto-reply/reply/subagents-utils.js"; |
| 3 | +import { resolveSubagentLabel, sortSubagentRuns } from "../auto-reply/reply/subagents-utils.js"; |
9 | 4 | import { resolveStorePath } from "../config/sessions/paths.js"; |
10 | 5 | import { loadSessionStore, updateSessionStore } from "../config/sessions/store.js"; |
11 | 6 | import type { SessionEntry } from "../config/sessions/types.js"; |
@@ -41,7 +36,6 @@ import { resolveInternalSessionKey, resolveMainSessionAlias } from "./tools/sess |
41 | 36 |
|
42 | 37 | export const DEFAULT_RECENT_MINUTES = 30; |
43 | 38 | export const MAX_RECENT_MINUTES = 24 * 60; |
44 | | -export const MAX_STEER_MESSAGE_CHARS = 4_000; |
45 | 39 | const STEER_RATE_LIMIT_MS = 2_000; |
46 | 40 | const STEER_ABORT_SETTLE_TIMEOUT_MS = 5_000; |
47 | 41 | const SUBAGENT_REPLY_HISTORY_LIMIT = 50; |
@@ -154,15 +148,8 @@ function ensureControllerOwnsRun(params: { |
154 | 148 | return "Subagents can only control runs spawned from their own session."; |
155 | 149 | } |
156 | 150 |
|
157 | | -function isFinishedForSteerControl( |
158 | | - entry: SubagentRunRecord, |
159 | | - hasPendingDescendants: boolean, |
160 | | -) { |
161 | | - return ( |
162 | | - Boolean(entry.endedAt) && |
163 | | - entry.pauseReason !== "sessions_yield" && |
164 | | - !hasPendingDescendants |
165 | | - ); |
| 151 | +function isFinishedForSteerControl(entry: SubagentRunRecord, hasPendingDescendants: boolean) { |
| 152 | + return Boolean(entry.endedAt) && entry.pauseReason !== "sessions_yield" && !hasPendingDescendants; |
166 | 153 | } |
167 | 154 |
|
168 | 155 | async function killSubagentRun(params: { |
@@ -717,30 +704,6 @@ export async function sendControlledSubagentMessage(params: { |
717 | 704 | } |
718 | 705 | } |
719 | 706 |
|
720 | | -export function resolveControlledSubagentTarget( |
721 | | - runs: SubagentRunRecord[], |
722 | | - token: string | undefined, |
723 | | - options?: { recentMinutes?: number; isActive?: (entry: SubagentRunRecord) => boolean }, |
724 | | -): SubagentTargetResolution { |
725 | | - return resolveSubagentTargetFromRuns({ |
726 | | - runs, |
727 | | - token, |
728 | | - recentWindowMinutes: options?.recentMinutes ?? DEFAULT_RECENT_MINUTES, |
729 | | - label: (entry) => resolveSubagentLabel(entry), |
730 | | - aliases: (entry) => (entry.taskName ? [entry.taskName] : []), |
731 | | - isActive: options?.isActive, |
732 | | - errors: { |
733 | | - missingTarget: "Missing subagent target.", |
734 | | - invalidIndex: (value) => `Invalid subagent index: ${value}`, |
735 | | - unknownSession: (value) => `Unknown subagent session: ${value}`, |
736 | | - ambiguousLabel: (value) => `Ambiguous subagent label: ${value}`, |
737 | | - ambiguousLabelPrefix: (value) => `Ambiguous subagent label prefix: ${value}`, |
738 | | - ambiguousRunIdPrefix: (value) => `Ambiguous subagent run id prefix: ${value}`, |
739 | | - unknownTarget: (value) => `Unknown subagent target: ${value}`, |
740 | | - }, |
741 | | - }); |
742 | | -} |
743 | | - |
744 | 707 | export const testing = { |
745 | 708 | setDepsForTest( |
746 | 709 | overrides?: Partial<{ |
|
0 commit comments