Fix Vite runtime requires for restored features
This commit is contained in:
parent
f16fdc6691
commit
2c31cc2723
|
|
@ -352,23 +352,26 @@ import { initializeGrowthBook } from '../services/analytics/growthbook.js'
|
||||||
import { errorMessage, toError } from '../utils/errors.js'
|
import { errorMessage, toError } from '../utils/errors.js'
|
||||||
import { sleep } from '../utils/sleep.js'
|
import { sleep } from '../utils/sleep.js'
|
||||||
import { isExtractModeActive } from '../memdir/paths.js'
|
import { isExtractModeActive } from '../memdir/paths.js'
|
||||||
|
import * as proactiveModuleValue from '../proactive/index.js'
|
||||||
|
import * as coordinatorModeModuleValue from '../coordinator/coordinatorMode.js'
|
||||||
|
import * as cronSchedulerModuleValue from '../utils/cronScheduler.js'
|
||||||
|
import * as cronJitterConfigModuleValue from '../utils/cronJitterConfig.js'
|
||||||
|
import * as cronGateValue from '../tools/ScheduleCronTool/prompt.js'
|
||||||
|
import * as extractMemoriesModuleValue from '../services/extractMemories/extractMemories.js'
|
||||||
|
|
||||||
// Dead code elimination: conditional imports
|
|
||||||
/* eslint-disable @typescript-eslint/no-require-imports */
|
|
||||||
const coordinatorModeModule = feature('COORDINATOR_MODE')
|
const coordinatorModeModule = feature('COORDINATOR_MODE')
|
||||||
? (require('../coordinator/coordinatorMode.js') as typeof import('../coordinator/coordinatorMode.js'))
|
? coordinatorModeModuleValue
|
||||||
: null
|
: null
|
||||||
const proactiveModule =
|
const proactiveModule =
|
||||||
feature('PROACTIVE') || feature('KAIROS')
|
feature('PROACTIVE') || feature('KAIROS')
|
||||||
? (require('../proactive/index.js') as typeof import('../proactive/index.js'))
|
? proactiveModuleValue
|
||||||
: null
|
: null
|
||||||
const cronSchedulerModule = require('../utils/cronScheduler.js') as typeof import('../utils/cronScheduler.js')
|
const cronSchedulerModule = cronSchedulerModuleValue
|
||||||
const cronJitterConfigModule = require('../utils/cronJitterConfig.js') as typeof import('../utils/cronJitterConfig.js')
|
const cronJitterConfigModule = cronJitterConfigModuleValue
|
||||||
const cronGate = require('../tools/ScheduleCronTool/prompt.js') as typeof import('../tools/ScheduleCronTool/prompt.js')
|
const cronGate = cronGateValue
|
||||||
const extractMemoriesModule = feature('EXTRACT_MEMORIES')
|
const extractMemoriesModule = feature('EXTRACT_MEMORIES')
|
||||||
? (require('../services/extractMemories/extractMemories.js') as typeof import('../services/extractMemories/extractMemories.js'))
|
? extractMemoriesModuleValue
|
||||||
: null
|
: null
|
||||||
/* eslint-enable @typescript-eslint/no-require-imports */
|
|
||||||
|
|
||||||
const SHUTDOWN_TEAM_PROMPT = `<system-reminder>
|
const SHUTDOWN_TEAM_PROMPT = `<system-reminder>
|
||||||
You are running in non-interactive mode and cannot return a response to the user until your team is shut down.
|
You are running in non-interactive mode and cannot return a response to the user until your team is shut down.
|
||||||
|
|
|
||||||
|
|
@ -57,39 +57,48 @@ import usage from './commands/usage/index.js'
|
||||||
import theme from './commands/theme/index.js'
|
import theme from './commands/theme/index.js'
|
||||||
import vim from './commands/vim/index.js'
|
import vim from './commands/vim/index.js'
|
||||||
import { feature } from 'bun:bundle'
|
import { feature } from 'bun:bundle'
|
||||||
// Dead code elimination: conditional imports
|
import { clearSkillIndexCache as clearSkillIndexCacheValue } from './services/skillSearch/localSearch.js'
|
||||||
/* eslint-disable @typescript-eslint/no-require-imports */
|
import proactiveValue from './commands/proactive.js'
|
||||||
|
import briefCommandValue from './commands/brief.js'
|
||||||
|
import assistantCommandValue from './commands/assistant/index.js'
|
||||||
|
import bridgeValue from './commands/bridge/index.js'
|
||||||
|
import remoteControlServerCommandValue from './commands/remoteControlServer/index.js'
|
||||||
|
import voiceCommandValue from './commands/voice/index.js'
|
||||||
|
import coordinatorCmdValue from './commands/coordinator.js'
|
||||||
|
import workflowsCmdValue from './commands/workflows/index.js'
|
||||||
|
import ultraplanValue from './commands/ultraplan.js'
|
||||||
|
import buddyValue from './commands/buddy/index.js'
|
||||||
|
import { getWorkflowCommands as getWorkflowCommandsValue } from './tools/WorkflowTool/createWorkflowCommand.js'
|
||||||
|
|
||||||
const proactive =
|
const proactive =
|
||||||
feature('PROACTIVE') || feature('KAIROS')
|
feature('PROACTIVE') || feature('KAIROS')
|
||||||
? require('./commands/proactive.js').default
|
? proactiveValue
|
||||||
: null
|
: null
|
||||||
const briefCommand =
|
const briefCommand =
|
||||||
feature('KAIROS') || feature('KAIROS_BRIEF')
|
feature('KAIROS') || feature('KAIROS_BRIEF')
|
||||||
? require('./commands/brief.js').default
|
? briefCommandValue
|
||||||
: null
|
: null
|
||||||
const assistantCommand = feature('KAIROS')
|
const assistantCommand = feature('KAIROS')
|
||||||
? require('./commands/assistant/index.js').default
|
? assistantCommandValue
|
||||||
: null
|
: null
|
||||||
const bridge = feature('BRIDGE_MODE')
|
const bridge = feature('BRIDGE_MODE')
|
||||||
? require('./commands/bridge/index.js').default
|
? bridgeValue
|
||||||
: null
|
: null
|
||||||
const remoteControlServerCommand =
|
const remoteControlServerCommand =
|
||||||
feature('DAEMON') && feature('BRIDGE_MODE')
|
feature('DAEMON') && feature('BRIDGE_MODE')
|
||||||
? require('./commands/remoteControlServer/index.js').default
|
? remoteControlServerCommandValue
|
||||||
: null
|
: null
|
||||||
const voiceCommand = feature('VOICE_MODE')
|
const voiceCommand = feature('VOICE_MODE')
|
||||||
? require('./commands/voice/index.js').default
|
? voiceCommandValue
|
||||||
: null
|
: null
|
||||||
const coordinatorCmd = feature('COORDINATOR_MODE')
|
const coordinatorCmd = feature('COORDINATOR_MODE')
|
||||||
? require('./commands/coordinator.js').default
|
? coordinatorCmdValue
|
||||||
: null
|
: null
|
||||||
const forceSnip = feature('HISTORY_SNIP')
|
const forceSnip = feature('HISTORY_SNIP')
|
||||||
? require('./commands/force-snip.js').default
|
? require('./commands/force-snip.js').default
|
||||||
: null
|
: null
|
||||||
const workflowsCmd = feature('WORKFLOW_SCRIPTS')
|
const workflowsCmd = feature('WORKFLOW_SCRIPTS')
|
||||||
? (
|
? workflowsCmdValue
|
||||||
require('./commands/workflows/index.js') as typeof import('./commands/workflows/index.js')
|
|
||||||
).default
|
|
||||||
: null
|
: null
|
||||||
const webCmd = feature('CCR_REMOTE_SETUP')
|
const webCmd = feature('CCR_REMOTE_SETUP')
|
||||||
? (
|
? (
|
||||||
|
|
@ -97,15 +106,13 @@ const webCmd = feature('CCR_REMOTE_SETUP')
|
||||||
).default
|
).default
|
||||||
: null
|
: null
|
||||||
const clearSkillIndexCache = feature('EXPERIMENTAL_SKILL_SEARCH')
|
const clearSkillIndexCache = feature('EXPERIMENTAL_SKILL_SEARCH')
|
||||||
? (
|
? clearSkillIndexCacheValue
|
||||||
require('./services/skillSearch/localSearch.js') as typeof import('./services/skillSearch/localSearch.js')
|
|
||||||
).clearSkillIndexCache
|
|
||||||
: null
|
: null
|
||||||
const subscribePr = feature('KAIROS_GITHUB_WEBHOOKS')
|
const subscribePr = feature('KAIROS_GITHUB_WEBHOOKS')
|
||||||
? require('./commands/subscribe-pr.js').default
|
? require('./commands/subscribe-pr.js').default
|
||||||
: null
|
: null
|
||||||
const ultraplan = feature('ULTRAPLAN')
|
const ultraplan = feature('ULTRAPLAN')
|
||||||
? require('./commands/ultraplan.js').default
|
? ultraplanValue
|
||||||
: null
|
: null
|
||||||
const torch = feature('TORCH') ? require('./commands/torch.js').default : null
|
const torch = feature('TORCH') ? require('./commands/torch.js').default : null
|
||||||
const peersCmd = feature('UDS_INBOX')
|
const peersCmd = feature('UDS_INBOX')
|
||||||
|
|
@ -119,11 +126,8 @@ const forkCmd = feature('FORK_SUBAGENT')
|
||||||
).default
|
).default
|
||||||
: null
|
: null
|
||||||
const buddy = feature('BUDDY')
|
const buddy = feature('BUDDY')
|
||||||
? (
|
? buddyValue
|
||||||
require('./commands/buddy/index.js') as typeof import('./commands/buddy/index.js')
|
|
||||||
).default
|
|
||||||
: null
|
: null
|
||||||
/* eslint-enable @typescript-eslint/no-require-imports */
|
|
||||||
import thinkback from './commands/thinkback/index.js'
|
import thinkback from './commands/thinkback/index.js'
|
||||||
import thinkbackPlay from './commands/thinkback-play/index.js'
|
import thinkbackPlay from './commands/thinkback-play/index.js'
|
||||||
import permissions from './commands/permissions/index.js'
|
import permissions from './commands/permissions/index.js'
|
||||||
|
|
@ -405,13 +409,9 @@ async function getSkills(cwd: string): Promise<{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* eslint-disable @typescript-eslint/no-require-imports */
|
|
||||||
const getWorkflowCommands = feature('WORKFLOW_SCRIPTS')
|
const getWorkflowCommands = feature('WORKFLOW_SCRIPTS')
|
||||||
? (
|
? getWorkflowCommandsValue
|
||||||
require('./tools/WorkflowTool/createWorkflowCommand.js') as typeof import('./tools/WorkflowTool/createWorkflowCommand.js')
|
|
||||||
).getWorkflowCommands
|
|
||||||
: null
|
: null
|
||||||
/* eslint-enable @typescript-eslint/no-require-imports */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filters commands by their declared `availability` (auth/provider requirement).
|
* Filters commands by their declared `availability` (auth/provider requirement).
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
* This module has heavier dependencies and should be lazy-loaded when possible.
|
* This module has heavier dependencies and should be lazy-loaded when possible.
|
||||||
*/
|
*/
|
||||||
import { feature } from 'bun:bundle'
|
import { feature } from 'bun:bundle'
|
||||||
|
import { setContextBlocked } from '../../proactive/index.js'
|
||||||
import { randomUUID, type UUID } from 'crypto'
|
import { randomUUID, type UUID } from 'crypto'
|
||||||
import {
|
import {
|
||||||
getLastMainRequestId,
|
getLastMainRequestId,
|
||||||
|
|
@ -110,9 +111,6 @@ export async function clearConversation({
|
||||||
|
|
||||||
// Clear context-blocked flag so proactive ticks resume after /clear
|
// Clear context-blocked flag so proactive ticks resume after /clear
|
||||||
if (feature('PROACTIVE') || feature('KAIROS')) {
|
if (feature('PROACTIVE') || feature('KAIROS')) {
|
||||||
/* eslint-disable @typescript-eslint/no-require-imports */
|
|
||||||
const { setContextBlocked } = require('../../proactive/index.js')
|
|
||||||
/* eslint-enable @typescript-eslint/no-require-imports */
|
|
||||||
setContextBlocked(false)
|
setContextBlocked(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ import type {
|
||||||
LocalJSXCommandContext,
|
LocalJSXCommandContext,
|
||||||
LocalJSXCommandOnDone,
|
LocalJSXCommandOnDone,
|
||||||
} from '../types/command.js'
|
} from '../types/command.js'
|
||||||
|
import * as proactiveModuleValue from '../proactive/index.js'
|
||||||
|
|
||||||
const proactive = {
|
const proactive = {
|
||||||
type: 'local-jsx',
|
type: 'local-jsx',
|
||||||
|
|
@ -29,15 +30,11 @@ const proactive = {
|
||||||
onDone: LocalJSXCommandOnDone,
|
onDone: LocalJSXCommandOnDone,
|
||||||
_context: ToolUseContext & LocalJSXCommandContext,
|
_context: ToolUseContext & LocalJSXCommandContext,
|
||||||
): Promise<React.ReactNode> {
|
): Promise<React.ReactNode> {
|
||||||
// Dynamic require to avoid pulling proactive into non-gated builds
|
if (proactiveModuleValue.isProactiveActive()) {
|
||||||
const mod =
|
proactiveModuleValue.deactivateProactive()
|
||||||
require('../proactive/index.js') as typeof import('../proactive/index.js')
|
|
||||||
|
|
||||||
if (mod.isProactiveActive()) {
|
|
||||||
mod.deactivateProactive()
|
|
||||||
onDone('Proactive mode disabled', { display: 'system' })
|
onDone('Proactive mode disabled', { display: 'system' })
|
||||||
} else {
|
} else {
|
||||||
mod.activateProactive('slash_command')
|
proactiveModuleValue.activateProactive('slash_command')
|
||||||
onDone(
|
onDone(
|
||||||
'Proactive mode enabled — model will work autonomously between ticks',
|
'Proactive mode enabled — model will work autonomously between ticks',
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@ import { ALL_MODEL_CONFIGS } from '../utils/model/configs.js';
|
||||||
import { updateTaskState } from '../utils/task/framework.js';
|
import { updateTaskState } from '../utils/task/framework.js';
|
||||||
import { archiveRemoteSession, teleportToRemote } from '../utils/teleport.js';
|
import { archiveRemoteSession, teleportToRemote } from '../utils/teleport.js';
|
||||||
import { pollForApprovedExitPlanMode, UltraplanPollError } from '../utils/ultraplan/ccrSession.js';
|
import { pollForApprovedExitPlanMode, UltraplanPollError } from '../utils/ultraplan/ccrSession.js';
|
||||||
|
import rawUltraplanPrompt from '../utils/ultraplan/prompt.txt';
|
||||||
|
|
||||||
// TODO(prod-hardening): OAuth token may go stale over the 30min poll;
|
// TODO(prod-hardening): OAuth token may go stale over the 30min poll;
|
||||||
// consider refresh.
|
// consider refresh.
|
||||||
|
|
@ -51,11 +52,7 @@ function getUltraplanModel(): string {
|
||||||
// any tag stripping, and a bare "ultraplan" in the prompt would self-trigger as
|
// any tag stripping, and a bare "ultraplan" in the prompt would self-trigger as
|
||||||
// /ultraplan, which is filtered out of headless mode as "Unknown skill"
|
// /ultraplan, which is filtered out of headless mode as "Unknown skill"
|
||||||
//
|
//
|
||||||
// Bundler inlines .txt as a string; the test runner wraps it as {default}.
|
const DEFAULT_INSTRUCTIONS: string = rawUltraplanPrompt.trimEnd();
|
||||||
/* eslint-disable @typescript-eslint/no-require-imports */
|
|
||||||
const _rawPrompt = require('../utils/ultraplan/prompt.txt');
|
|
||||||
/* eslint-enable @typescript-eslint/no-require-imports */
|
|
||||||
const DEFAULT_INSTRUCTIONS: string = (typeof _rawPrompt === 'string' ? _rawPrompt : _rawPrompt.default).trimEnd();
|
|
||||||
|
|
||||||
// Dev-only prompt override resolved eagerly at module load.
|
// Dev-only prompt override resolved eagerly at module load.
|
||||||
// Gated to ant builds (USER_TYPE is a build-time define,
|
// Gated to ant builds (USER_TYPE is a build-time define,
|
||||||
|
|
|
||||||
|
|
@ -69,6 +69,7 @@ import type { ToolUseConfirm } from './permissions/PermissionRequest.js'
|
||||||
import { StatusNotices } from './StatusNotices.js'
|
import { StatusNotices } from './StatusNotices.js'
|
||||||
import type { JumpHandle } from './VirtualMessageList.js'
|
import type { JumpHandle } from './VirtualMessageList.js'
|
||||||
import { VirtualMessageList } from './VirtualMessageList.js'
|
import { VirtualMessageList } from './VirtualMessageList.js'
|
||||||
|
import * as proactiveModuleValue from '../proactive/index.js'
|
||||||
|
|
||||||
// Memoed logo header: this box is the FIRST sibling before all MessageRows
|
// Memoed logo header: this box is the FIRST sibling before all MessageRows
|
||||||
// in main-screen mode. If it becomes dirty on every Messages re-render,
|
// in main-screen mode. If it becomes dirty on every Messages re-render,
|
||||||
|
|
@ -98,13 +99,10 @@ const LogoHeader = React.memo(function LogoHeader({
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
// Dead code elimination: conditional import for proactive mode
|
|
||||||
/* eslint-disable @typescript-eslint/no-require-imports */
|
|
||||||
const proactiveModule =
|
const proactiveModule =
|
||||||
feature('PROACTIVE') || feature('KAIROS')
|
feature('PROACTIVE') || feature('KAIROS')
|
||||||
? require('../proactive/index.js')
|
? proactiveModuleValue
|
||||||
: null
|
: null
|
||||||
/* eslint-enable @typescript-eslint/no-require-imports */
|
|
||||||
|
|
||||||
const BRIEF_TOOL_NAME: string | null =
|
const BRIEF_TOOL_NAME: string | null =
|
||||||
feature('KAIROS') || feature('KAIROS_BRIEF') ? BRIEF_TOOL_NAME_VALUE : null
|
feature('KAIROS') || feature('KAIROS_BRIEF') ? BRIEF_TOOL_NAME_VALUE : null
|
||||||
|
|
|
||||||
|
|
@ -51,14 +51,12 @@ import { isXtermJs, useHasSelection, useSelection } from '@anthropic/ink'
|
||||||
import { getGlobalConfig, saveGlobalConfig } from '../../utils/config.js'
|
import { getGlobalConfig, saveGlobalConfig } from '../../utils/config.js'
|
||||||
import { getPlatform } from '../../utils/platform.js'
|
import { getPlatform } from '../../utils/platform.js'
|
||||||
import { PrBadge } from '../PrBadge.js'
|
import { PrBadge } from '../PrBadge.js'
|
||||||
|
import * as proactiveModuleValue from '../../proactive/index.js'
|
||||||
|
|
||||||
// Dead code elimination: conditional import for proactive mode
|
|
||||||
/* eslint-disable @typescript-eslint/no-require-imports */
|
|
||||||
const proactiveModule =
|
const proactiveModule =
|
||||||
feature('PROACTIVE') || feature('KAIROS')
|
feature('PROACTIVE') || feature('KAIROS')
|
||||||
? require('../../proactive/index.js')
|
? proactiveModuleValue
|
||||||
: null
|
: null
|
||||||
/* eslint-enable @typescript-eslint/no-require-imports */
|
|
||||||
const NO_OP_SUBSCRIBE = (_cb: () => void) => () => {}
|
const NO_OP_SUBSCRIBE = (_cb: () => void) => () => {}
|
||||||
const NULL = () => null
|
const NULL = () => null
|
||||||
const MAX_VOICE_HINT_SHOWS = 3
|
const MAX_VOICE_HINT_SHOWS = 3
|
||||||
|
|
|
||||||
|
|
@ -5,12 +5,11 @@ import { useAppState } from 'src/state/AppState.js'
|
||||||
import { getGlobalConfig } from 'src/utils/config.js'
|
import { getGlobalConfig } from 'src/utils/config.js'
|
||||||
import { getExampleCommandFromCache } from 'src/utils/exampleCommands.js'
|
import { getExampleCommandFromCache } from 'src/utils/exampleCommands.js'
|
||||||
import { isQueuedCommandEditable } from 'src/utils/messageQueueManager.js'
|
import { isQueuedCommandEditable } from 'src/utils/messageQueueManager.js'
|
||||||
|
import * as proactiveModuleValue from '../../proactive/index.js'
|
||||||
|
|
||||||
// Dead code elimination: conditional import for proactive mode
|
|
||||||
/* eslint-disable @typescript-eslint/no-require-imports */
|
|
||||||
const proactiveModule =
|
const proactiveModule =
|
||||||
feature('PROACTIVE') || feature('KAIROS')
|
feature('PROACTIVE') || feature('KAIROS')
|
||||||
? require('../../proactive/index.js')
|
? proactiveModuleValue
|
||||||
: null
|
: null
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
|
|
|
||||||
|
|
@ -86,17 +86,16 @@ import { Markdown } from '../../Markdown.js'
|
||||||
import { PermissionDialog } from '../PermissionDialog.js'
|
import { PermissionDialog } from '../PermissionDialog.js'
|
||||||
import type { PermissionRequestProps } from '../PermissionRequest.js'
|
import type { PermissionRequestProps } from '../PermissionRequest.js'
|
||||||
import { PermissionRuleExplanation } from '../PermissionRuleExplanation.js'
|
import { PermissionRuleExplanation } from '../PermissionRuleExplanation.js'
|
||||||
|
import * as autoModeStateModuleValue from '../../../utils/permissions/autoModeState.js'
|
||||||
|
|
||||||
/* eslint-disable @typescript-eslint/no-require-imports */
|
|
||||||
const autoModeStateModule = feature('TRANSCRIPT_CLASSIFIER')
|
const autoModeStateModule = feature('TRANSCRIPT_CLASSIFIER')
|
||||||
? (require('../../../utils/permissions/autoModeState.js') as typeof import('../../../utils/permissions/autoModeState.js'))
|
? autoModeStateModuleValue
|
||||||
: null
|
: null
|
||||||
|
|
||||||
import type {
|
import type {
|
||||||
Base64ImageSource,
|
Base64ImageSource,
|
||||||
ImageBlockParam,
|
ImageBlockParam,
|
||||||
} from '@anthropic-ai/sdk/resources/messages.mjs'
|
} from '@anthropic-ai/sdk/resources/messages.mjs'
|
||||||
/* eslint-enable @typescript-eslint/no-require-imports */
|
|
||||||
import type { PastedContent } from '../../../utils/config.js'
|
import type { PastedContent } from '../../../utils/config.js'
|
||||||
import type { ImageDimensions } from '../../../utils/imageResizer.js'
|
import type { ImageDimensions } from '../../../utils/imageResizer.js'
|
||||||
import { maybeResizeAndDownsampleImageBlock } from '../../../utils/imageResizer.js'
|
import { maybeResizeAndDownsampleImageBlock } from '../../../utils/imageResizer.js'
|
||||||
|
|
|
||||||
|
|
@ -28,8 +28,16 @@ import { LocalAgentTask } from 'src/tasks/LocalAgentTask/LocalAgentTask.js'
|
||||||
import type { LocalShellTaskState } from 'src/tasks/LocalShellTask/guards.js'
|
import type { LocalShellTaskState } from 'src/tasks/LocalShellTask/guards.js'
|
||||||
import { LocalShellTask } from 'src/tasks/LocalShellTask/LocalShellTask.js'
|
import { LocalShellTask } from 'src/tasks/LocalShellTask/LocalShellTask.js'
|
||||||
// Type import is erased at build time — safe even though module is ant-gated.
|
// Type import is erased at build time — safe even though module is ant-gated.
|
||||||
import type { LocalWorkflowTaskState } from 'src/tasks/LocalWorkflowTask/LocalWorkflowTask.js'
|
import {
|
||||||
import type { MonitorMcpTaskState } from 'src/tasks/MonitorMcpTask/MonitorMcpTask.js'
|
killWorkflowTask as killWorkflowTaskValue,
|
||||||
|
retryWorkflowAgent as retryWorkflowAgentValue,
|
||||||
|
skipWorkflowAgent as skipWorkflowAgentValue,
|
||||||
|
type LocalWorkflowTaskState,
|
||||||
|
} from 'src/tasks/LocalWorkflowTask/LocalWorkflowTask.js'
|
||||||
|
import {
|
||||||
|
killMonitorMcp as killMonitorMcpValue,
|
||||||
|
type MonitorMcpTaskState,
|
||||||
|
} from 'src/tasks/MonitorMcpTask/MonitorMcpTask.js'
|
||||||
import {
|
import {
|
||||||
RemoteAgentTask,
|
RemoteAgentTask,
|
||||||
type RemoteAgentTaskState,
|
type RemoteAgentTaskState,
|
||||||
|
|
@ -43,6 +51,8 @@ import type { DeepImmutable } from 'src/types/utils.js'
|
||||||
import { intersperse } from 'src/utils/array.js'
|
import { intersperse } from 'src/utils/array.js'
|
||||||
import { TEAM_LEAD_NAME } from 'src/utils/swarm/constants.js'
|
import { TEAM_LEAD_NAME } from 'src/utils/swarm/constants.js'
|
||||||
import { stopUltraplan } from '../../commands/ultraplan.js'
|
import { stopUltraplan } from '../../commands/ultraplan.js'
|
||||||
|
import { MonitorMcpDetailDialog as MonitorMcpDetailDialogValue } from './MonitorMcpDetailDialog.js'
|
||||||
|
import { WorkflowDetailDialog as WorkflowDetailDialogValue } from './WorkflowDetailDialog.js'
|
||||||
import type { CommandResultDisplay } from '../../commands.js'
|
import type { CommandResultDisplay } from '../../commands.js'
|
||||||
import { useRegisterOverlay } from '../../context/overlayContext.js'
|
import { useRegisterOverlay } from '../../context/overlayContext.js'
|
||||||
import type { ExitState } from '../../hooks/useExitOnCtrlCDWithKeybindings.js'
|
import type { ExitState } from '../../hooks/useExitOnCtrlCDWithKeybindings.js'
|
||||||
|
|
@ -129,31 +139,22 @@ type ListItem =
|
||||||
// WORKFLOW_SCRIPTS is ant-only (build_flags.yaml). Static imports would leak
|
// WORKFLOW_SCRIPTS is ant-only (build_flags.yaml). Static imports would leak
|
||||||
// ~1.3K lines into external builds. Gate with feature() + require so the
|
// ~1.3K lines into external builds. Gate with feature() + require so the
|
||||||
// bundler can dead-code-eliminate the branch.
|
// bundler can dead-code-eliminate the branch.
|
||||||
/* eslint-disable @typescript-eslint/no-require-imports */
|
|
||||||
const WorkflowDetailDialog = feature('WORKFLOW_SCRIPTS')
|
const WorkflowDetailDialog = feature('WORKFLOW_SCRIPTS')
|
||||||
? (
|
? WorkflowDetailDialogValue
|
||||||
require('./WorkflowDetailDialog.js') as typeof import('./WorkflowDetailDialog.js')
|
|
||||||
).WorkflowDetailDialog
|
|
||||||
: null
|
: null
|
||||||
const workflowTaskModule = feature('WORKFLOW_SCRIPTS')
|
const killWorkflowTask = feature('WORKFLOW_SCRIPTS')
|
||||||
? (require('src/tasks/LocalWorkflowTask/LocalWorkflowTask.js') as typeof import('src/tasks/LocalWorkflowTask/LocalWorkflowTask.js'))
|
? killWorkflowTaskValue
|
||||||
: null
|
: null
|
||||||
const killWorkflowTask = workflowTaskModule?.killWorkflowTask ?? null
|
const skipWorkflowAgent = feature('WORKFLOW_SCRIPTS')
|
||||||
const skipWorkflowAgent = workflowTaskModule?.skipWorkflowAgent ?? null
|
? skipWorkflowAgentValue
|
||||||
const retryWorkflowAgent = workflowTaskModule?.retryWorkflowAgent ?? null
|
|
||||||
// Relative path, not `src/...` path-mapping — Bun's DCE can statically
|
|
||||||
// resolve + eliminate `./` requires, but path-mapped strings stay opaque
|
|
||||||
// and survive as dead literals in the bundle. Matches tasks.ts pattern.
|
|
||||||
const monitorMcpModule = feature('MONITOR_TOOL')
|
|
||||||
? (require('../../tasks/MonitorMcpTask/MonitorMcpTask.js') as typeof import('../../tasks/MonitorMcpTask/MonitorMcpTask.js'))
|
|
||||||
: null
|
: null
|
||||||
const killMonitorMcp = monitorMcpModule?.killMonitorMcp ?? null
|
const retryWorkflowAgent = feature('WORKFLOW_SCRIPTS')
|
||||||
|
? retryWorkflowAgentValue
|
||||||
|
: null
|
||||||
|
const killMonitorMcp = feature('MONITOR_TOOL') ? killMonitorMcpValue : null
|
||||||
const MonitorMcpDetailDialog = feature('MONITOR_TOOL')
|
const MonitorMcpDetailDialog = feature('MONITOR_TOOL')
|
||||||
? (
|
? MonitorMcpDetailDialogValue
|
||||||
require('./MonitorMcpDetailDialog.js') as typeof import('./MonitorMcpDetailDialog.js')
|
|
||||||
).MonitorMcpDetailDialog
|
|
||||||
: null
|
: null
|
||||||
/* eslint-enable @typescript-eslint/no-require-imports */
|
|
||||||
|
|
||||||
// Helper to get filtered background tasks (excludes foregrounded local_agent)
|
// Helper to get filtered background tasks (excludes foregrounded local_agent)
|
||||||
function getSelectableBackgroundTasks(
|
function getSelectableBackgroundTasks(
|
||||||
|
|
|
||||||
|
|
@ -61,6 +61,11 @@ import { loadMemoryPrompt } from '../memdir/memdir.js'
|
||||||
import { isUndercover } from '../utils/undercover.js'
|
import { isUndercover } from '../utils/undercover.js'
|
||||||
import { getAntModelOverrideConfig } from '../utils/model/antModels.js'
|
import { getAntModelOverrideConfig } from '../utils/model/antModels.js'
|
||||||
import { isMcpInstructionsDeltaEnabled } from '../utils/mcpInstructionsDelta.js'
|
import { isMcpInstructionsDeltaEnabled } from '../utils/mcpInstructionsDelta.js'
|
||||||
|
import { BRIEF_PROACTIVE_SECTION as BRIEF_PROACTIVE_SECTION_VALUE } from '../tools/BriefTool/prompt.js'
|
||||||
|
import * as proactiveModuleValue from '../proactive/index.js'
|
||||||
|
import * as briefToolModuleValue from '../tools/BriefTool/BriefTool.js'
|
||||||
|
import { DISCOVER_SKILLS_TOOL_NAME as DISCOVER_SKILLS_TOOL_NAME_VALUE } from '../tools/DiscoverSkillsTool/prompt.js'
|
||||||
|
import * as skillSearchFeatureCheckValue from '../services/skillSearch/featureCheck.js'
|
||||||
|
|
||||||
// Dead code elimination: conditional imports for feature-gated modules
|
// Dead code elimination: conditional imports for feature-gated modules
|
||||||
/* eslint-disable @typescript-eslint/no-require-imports */
|
/* eslint-disable @typescript-eslint/no-require-imports */
|
||||||
|
|
@ -71,30 +76,24 @@ const getCachedMCConfigForFRC = feature('CACHED_MICROCOMPACT')
|
||||||
: null
|
: null
|
||||||
|
|
||||||
const proactiveModule =
|
const proactiveModule =
|
||||||
feature('PROACTIVE') || feature('KAIROS')
|
feature('PROACTIVE') || feature('KAIROS') ? proactiveModuleValue : null
|
||||||
? require('../proactive/index.js')
|
|
||||||
: null
|
|
||||||
const BRIEF_PROACTIVE_SECTION: string | null =
|
const BRIEF_PROACTIVE_SECTION: string | null =
|
||||||
feature('KAIROS') || feature('KAIROS_BRIEF')
|
feature('KAIROS') || feature('KAIROS_BRIEF')
|
||||||
? (
|
? BRIEF_PROACTIVE_SECTION_VALUE
|
||||||
require('../tools/BriefTool/prompt.js') as typeof import('../tools/BriefTool/prompt.js')
|
|
||||||
).BRIEF_PROACTIVE_SECTION
|
|
||||||
: null
|
: null
|
||||||
const briefToolModule =
|
const briefToolModule =
|
||||||
feature('KAIROS') || feature('KAIROS_BRIEF')
|
feature('KAIROS') || feature('KAIROS_BRIEF')
|
||||||
? (require('../tools/BriefTool/BriefTool.js') as typeof import('../tools/BriefTool/BriefTool.js'))
|
? briefToolModuleValue
|
||||||
: null
|
: null
|
||||||
const DISCOVER_SKILLS_TOOL_NAME: string | null = feature(
|
const DISCOVER_SKILLS_TOOL_NAME: string | null = feature(
|
||||||
'EXPERIMENTAL_SKILL_SEARCH',
|
'EXPERIMENTAL_SKILL_SEARCH',
|
||||||
)
|
)
|
||||||
? (
|
? DISCOVER_SKILLS_TOOL_NAME_VALUE
|
||||||
require('../tools/DiscoverSkillsTool/prompt.js') as typeof import('../tools/DiscoverSkillsTool/prompt.js')
|
|
||||||
).DISCOVER_SKILLS_TOOL_NAME
|
|
||||||
: null
|
: null
|
||||||
// Capture the module (not .isSkillSearchEnabled directly) so spyOn() in tests
|
// Capture the module (not .isSkillSearchEnabled directly) so spyOn() in tests
|
||||||
// patches what we actually call — a captured function ref would point past the spy.
|
// patches what we actually call — a captured function ref would point past the spy.
|
||||||
const skillSearchFeatureCheck = feature('EXPERIMENTAL_SKILL_SEARCH')
|
const skillSearchFeatureCheck = feature('EXPERIMENTAL_SKILL_SEARCH')
|
||||||
? (require('../services/skillSearch/featureCheck.js') as typeof import('../services/skillSearch/featureCheck.js'))
|
? skillSearchFeatureCheckValue
|
||||||
: null
|
: null
|
||||||
/* eslint-enable @typescript-eslint/no-require-imports */
|
/* eslint-enable @typescript-eslint/no-require-imports */
|
||||||
import type { OutputStyleConfig } from './outputStyles.js'
|
import type { OutputStyleConfig } from './outputStyles.js'
|
||||||
|
|
|
||||||
35
src/main.tsx
35
src/main.tsx
|
|
@ -77,6 +77,10 @@ import {
|
||||||
createSyntheticOutputTool,
|
createSyntheticOutputTool,
|
||||||
isSyntheticOutputToolEnabled,
|
isSyntheticOutputToolEnabled,
|
||||||
} from "./tools/SyntheticOutputTool/SyntheticOutputTool.js";
|
} from "./tools/SyntheticOutputTool/SyntheticOutputTool.js";
|
||||||
|
import {
|
||||||
|
BRIEF_TOOL_NAME as BRIEF_TOOL_NAME_VALUE,
|
||||||
|
LEGACY_BRIEF_TOOL_NAME as LEGACY_BRIEF_TOOL_NAME_VALUE,
|
||||||
|
} from "./tools/BriefTool/prompt.js";
|
||||||
import { getTools } from "./tools.js";
|
import { getTools } from "./tools.js";
|
||||||
import {
|
import {
|
||||||
canUserConfigureAdvisor,
|
canUserConfigureAdvisor,
|
||||||
|
|
@ -121,6 +125,10 @@ import { jsonParse, writeFileSync_DEPRECATED } from "./utils/slowOperations.js";
|
||||||
import { computeInitialTeamContext } from "./utils/swarm/reconnection.js";
|
import { computeInitialTeamContext } from "./utils/swarm/reconnection.js";
|
||||||
import { initializeWarningHandler } from "./utils/warningHandler.js";
|
import { initializeWarningHandler } from "./utils/warningHandler.js";
|
||||||
import { isWorktreeModeEnabled } from "./utils/worktreeModeEnabled.js";
|
import { isWorktreeModeEnabled } from "./utils/worktreeModeEnabled.js";
|
||||||
|
import * as coordinatorModeModuleValue from "./coordinator/coordinatorMode.js";
|
||||||
|
import * as assistantModuleValue from "./assistant/index.js";
|
||||||
|
import * as kairosGateValue from "./assistant/gate.js";
|
||||||
|
import * as proactiveModuleValue from "./proactive/index.js";
|
||||||
|
|
||||||
// Lazy require to avoid circular dependency: teammate.ts -> AppState.tsx -> ... -> main.tsx
|
// Lazy require to avoid circular dependency: teammate.ts -> AppState.tsx -> ... -> main.tsx
|
||||||
/* eslint-disable @typescript-eslint/no-require-imports */
|
/* eslint-disable @typescript-eslint/no-require-imports */
|
||||||
|
|
@ -131,19 +139,14 @@ const getTeammatePromptAddendum = () =>
|
||||||
const getTeammateModeSnapshot = () =>
|
const getTeammateModeSnapshot = () =>
|
||||||
require("./utils/swarm/backends/teammateModeSnapshot.js") as typeof import("./utils/swarm/backends/teammateModeSnapshot.js");
|
require("./utils/swarm/backends/teammateModeSnapshot.js") as typeof import("./utils/swarm/backends/teammateModeSnapshot.js");
|
||||||
/* eslint-enable @typescript-eslint/no-require-imports */
|
/* eslint-enable @typescript-eslint/no-require-imports */
|
||||||
// Dead code elimination: conditional import for COORDINATOR_MODE
|
|
||||||
/* eslint-disable @typescript-eslint/no-require-imports */
|
|
||||||
const coordinatorModeModule = feature("COORDINATOR_MODE")
|
const coordinatorModeModule = feature("COORDINATOR_MODE")
|
||||||
? (require("./coordinator/coordinatorMode.js") as typeof import("./coordinator/coordinatorMode.js"))
|
? coordinatorModeModuleValue
|
||||||
: null;
|
: null;
|
||||||
/* eslint-enable @typescript-eslint/no-require-imports */
|
|
||||||
// Dead code elimination: conditional import for KAIROS (assistant mode)
|
|
||||||
/* eslint-disable @typescript-eslint/no-require-imports */
|
|
||||||
const assistantModule = feature("KAIROS")
|
const assistantModule = feature("KAIROS")
|
||||||
? (require("./assistant/index.js") as typeof import("./assistant/index.js"))
|
? assistantModuleValue
|
||||||
: null;
|
: null;
|
||||||
const kairosGate = feature("KAIROS")
|
const kairosGate = feature("KAIROS")
|
||||||
? (require("./assistant/gate.js") as typeof import("./assistant/gate.js"))
|
? kairosGateValue
|
||||||
: null;
|
: null;
|
||||||
|
|
||||||
import { relative, resolve } from "path";
|
import { relative, resolve } from "path";
|
||||||
|
|
@ -382,10 +385,10 @@ import {
|
||||||
setUserMsgOptIn,
|
setUserMsgOptIn,
|
||||||
switchSession,
|
switchSession,
|
||||||
} from "./bootstrap/state.js";
|
} from "./bootstrap/state.js";
|
||||||
|
import * as autoModeStateModuleValue from "./utils/permissions/autoModeState.js";
|
||||||
|
|
||||||
/* eslint-disable @typescript-eslint/no-require-imports */
|
|
||||||
const autoModeStateModule = feature("TRANSCRIPT_CLASSIFIER")
|
const autoModeStateModule = feature("TRANSCRIPT_CLASSIFIER")
|
||||||
? (require("./utils/permissions/autoModeState.js") as typeof import("./utils/permissions/autoModeState.js"))
|
? autoModeStateModuleValue
|
||||||
: null;
|
: null;
|
||||||
|
|
||||||
// TeleportRepoMismatchDialog, TeleportResumeWrapper dynamically imported at call sites
|
// TeleportRepoMismatchDialog, TeleportResumeWrapper dynamically imported at call sites
|
||||||
|
|
@ -2664,15 +2667,13 @@ async function run(): Promise<CommanderCommand> {
|
||||||
baseTools.length > 0
|
baseTools.length > 0
|
||||||
) {
|
) {
|
||||||
/* eslint-disable @typescript-eslint/no-require-imports */
|
/* eslint-disable @typescript-eslint/no-require-imports */
|
||||||
const { BRIEF_TOOL_NAME, LEGACY_BRIEF_TOOL_NAME } =
|
|
||||||
require("./tools/BriefTool/prompt.js") as typeof import("./tools/BriefTool/prompt.js");
|
|
||||||
const { isBriefEntitled } =
|
const { isBriefEntitled } =
|
||||||
require("./tools/BriefTool/BriefTool.js") as typeof import("./tools/BriefTool/BriefTool.js");
|
require("./tools/BriefTool/BriefTool.js") as typeof import("./tools/BriefTool/BriefTool.js");
|
||||||
/* eslint-enable @typescript-eslint/no-require-imports */
|
/* eslint-enable @typescript-eslint/no-require-imports */
|
||||||
const parsed = parseToolListFromCLI(baseTools);
|
const parsed = parseToolListFromCLI(baseTools);
|
||||||
if (
|
if (
|
||||||
(parsed.includes(BRIEF_TOOL_NAME) ||
|
(parsed.includes(BRIEF_TOOL_NAME_VALUE) ||
|
||||||
parsed.includes(LEGACY_BRIEF_TOOL_NAME)) &&
|
parsed.includes(LEGACY_BRIEF_TOOL_NAME_VALUE)) &&
|
||||||
isBriefEntitled()
|
isBriefEntitled()
|
||||||
) {
|
) {
|
||||||
setUserMsgOptIn(true);
|
setUserMsgOptIn(true);
|
||||||
|
|
@ -6948,10 +6949,8 @@ function maybeActivateProactive(options: unknown): void {
|
||||||
((options as { proactive?: boolean }).proactive ||
|
((options as { proactive?: boolean }).proactive ||
|
||||||
isEnvTruthy(process.env.CLAUDE_CODE_PROACTIVE))
|
isEnvTruthy(process.env.CLAUDE_CODE_PROACTIVE))
|
||||||
) {
|
) {
|
||||||
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
if (!proactiveModuleValue.isProactiveActive()) {
|
||||||
const proactiveModule = require("./proactive/index.js");
|
proactiveModuleValue.activateProactive("command");
|
||||||
if (!proactiveModule.isProactiveActive()) {
|
|
||||||
proactiveModule.activateProactive("command");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -65,12 +65,14 @@ import {
|
||||||
getAttachmentMessages,
|
getAttachmentMessages,
|
||||||
startRelevantMemoryPrefetch,
|
startRelevantMemoryPrefetch,
|
||||||
} from './utils/attachments.js'
|
} from './utils/attachments.js'
|
||||||
|
import * as skillPrefetchValue from './services/skillSearch/prefetch.js'
|
||||||
|
import * as jobClassifierValue from './jobs/classifier.js'
|
||||||
/* eslint-disable @typescript-eslint/no-require-imports */
|
/* eslint-disable @typescript-eslint/no-require-imports */
|
||||||
const skillPrefetch = feature('EXPERIMENTAL_SKILL_SEARCH')
|
const skillPrefetch = feature('EXPERIMENTAL_SKILL_SEARCH')
|
||||||
? (require('./services/skillSearch/prefetch.js') as typeof import('./services/skillSearch/prefetch.js'))
|
? skillPrefetchValue
|
||||||
: null
|
: null
|
||||||
const jobClassifier = feature('TEMPLATES')
|
const jobClassifier = feature('TEMPLATES')
|
||||||
? (require('./jobs/classifier.js') as typeof import('./jobs/classifier.js'))
|
? jobClassifierValue
|
||||||
: null
|
: null
|
||||||
/* eslint-enable @typescript-eslint/no-require-imports */
|
/* eslint-enable @typescript-eslint/no-require-imports */
|
||||||
import {
|
import {
|
||||||
|
|
@ -121,13 +123,14 @@ import {
|
||||||
isLangfuseEnabled,
|
isLangfuseEnabled,
|
||||||
} from './services/langfuse/index.js'
|
} from './services/langfuse/index.js'
|
||||||
import { getAPIProvider } from './utils/model/providers.js'
|
import { getAPIProvider } from './utils/model/providers.js'
|
||||||
|
import * as taskSummaryModuleValue from './utils/taskSummary.js'
|
||||||
|
|
||||||
/* eslint-disable @typescript-eslint/no-require-imports */
|
/* eslint-disable @typescript-eslint/no-require-imports */
|
||||||
const snipModule = feature('HISTORY_SNIP')
|
const snipModule = feature('HISTORY_SNIP')
|
||||||
? (require('./services/compact/snipCompact.js') as typeof import('./services/compact/snipCompact.js'))
|
? (require('./services/compact/snipCompact.js') as typeof import('./services/compact/snipCompact.js'))
|
||||||
: null
|
: null
|
||||||
const taskSummaryModule = feature('BG_SESSIONS')
|
const taskSummaryModule = feature('BG_SESSIONS')
|
||||||
? (require('./utils/taskSummary.js') as typeof import('./utils/taskSummary.js'))
|
? taskSummaryModuleValue
|
||||||
: null
|
: null
|
||||||
/* eslint-enable @typescript-eslint/no-require-imports */
|
/* eslint-enable @typescript-eslint/no-require-imports */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -37,13 +37,15 @@ import {
|
||||||
import type { SystemPrompt } from '../utils/systemPromptType.js'
|
import type { SystemPrompt } from '../utils/systemPromptType.js'
|
||||||
import { getTaskListId, listTasks } from '../utils/tasks.js'
|
import { getTaskListId, listTasks } from '../utils/tasks.js'
|
||||||
import { getAgentName, getTeamName, isTeammate } from '../utils/teammate.js'
|
import { getAgentName, getTeamName, isTeammate } from '../utils/teammate.js'
|
||||||
|
import * as extractMemoriesModuleValue from '../services/extractMemories/extractMemories.js'
|
||||||
|
import * as jobClassifierModuleValue from '../jobs/classifier.js'
|
||||||
|
|
||||||
/* eslint-disable @typescript-eslint/no-require-imports */
|
/* eslint-disable @typescript-eslint/no-require-imports */
|
||||||
const extractMemoriesModule = feature('EXTRACT_MEMORIES')
|
const extractMemoriesModule = feature('EXTRACT_MEMORIES')
|
||||||
? (require('../services/extractMemories/extractMemories.js') as typeof import('../services/extractMemories/extractMemories.js'))
|
? extractMemoriesModuleValue
|
||||||
: null
|
: null
|
||||||
const jobClassifierModule = feature('TEMPLATES')
|
const jobClassifierModule = feature('TEMPLATES')
|
||||||
? (require('../jobs/classifier.js') as typeof import('../jobs/classifier.js'))
|
? jobClassifierModuleValue
|
||||||
: null
|
: null
|
||||||
|
|
||||||
/* eslint-enable @typescript-eslint/no-require-imports */
|
/* eslint-enable @typescript-eslint/no-require-imports */
|
||||||
|
|
|
||||||
|
|
@ -324,16 +324,16 @@ import { isBgSession, updateSessionName, updateSessionActivity } from '../utils/
|
||||||
import { isInProcessTeammateTask, type InProcessTeammateTaskState } from '../tasks/InProcessTeammateTask/types.js';
|
import { isInProcessTeammateTask, type InProcessTeammateTaskState } from '../tasks/InProcessTeammateTask/types.js';
|
||||||
import { restoreRemoteAgentTasks } from '../tasks/RemoteAgentTask/RemoteAgentTask.js';
|
import { restoreRemoteAgentTasks } from '../tasks/RemoteAgentTask/RemoteAgentTask.js';
|
||||||
import { useInboxPoller } from '../hooks/useInboxPoller.js';
|
import { useInboxPoller } from '../hooks/useInboxPoller.js';
|
||||||
// Dead code elimination: conditional import for loop mode
|
import * as proactiveModuleValue from '../proactive/index.js';
|
||||||
/* eslint-disable @typescript-eslint/no-require-imports */
|
import { useProactive as useProactiveValue } from '../proactive/useProactive.js';
|
||||||
const proactiveModule = feature('PROACTIVE') || feature('KAIROS') ? require('../proactive/index.js') : null;
|
import { useScheduledTasks as useScheduledTasksValue } from '../hooks/useScheduledTasks.js';
|
||||||
|
const proactiveModule = feature('PROACTIVE') || feature('KAIROS') ? proactiveModuleValue : null;
|
||||||
const PROACTIVE_NO_OP_SUBSCRIBE = (_cb: () => void) => () => {};
|
const PROACTIVE_NO_OP_SUBSCRIBE = (_cb: () => void) => () => {};
|
||||||
const PROACTIVE_FALSE = () => false;
|
const PROACTIVE_FALSE = () => false;
|
||||||
const SUGGEST_BG_PR_NOOP = (_p: string, _n: string): boolean => false;
|
const SUGGEST_BG_PR_NOOP = (_p: string, _n: string): boolean => false;
|
||||||
const useProactive =
|
const useProactive =
|
||||||
feature('PROACTIVE') || feature('KAIROS') ? require('../proactive/useProactive.js').useProactive : null;
|
feature('PROACTIVE') || feature('KAIROS') ? useProactiveValue : null;
|
||||||
const useScheduledTasks = feature('AGENT_TRIGGERS') ? require('../hooks/useScheduledTasks.js').useScheduledTasks : null;
|
const useScheduledTasks = feature('AGENT_TRIGGERS') ? useScheduledTasksValue : null;
|
||||||
/* eslint-enable @typescript-eslint/no-require-imports */
|
|
||||||
import { isAgentSwarmsEnabled } from '../utils/agentSwarmsEnabled.js';
|
import { isAgentSwarmsEnabled } from '../utils/agentSwarmsEnabled.js';
|
||||||
import { useTaskListWatcher } from '../hooks/useTaskListWatcher.js';
|
import { useTaskListWatcher } from '../hooks/useTaskListWatcher.js';
|
||||||
import type { SandboxAskCallback, NetworkHostPattern } from '../utils/sandbox/sandbox-adapter.js';
|
import type { SandboxAskCallback, NetworkHostPattern } from '../utils/sandbox/sandbox-adapter.js';
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,7 @@ import {
|
||||||
isTeammate,
|
isTeammate,
|
||||||
} from '../../utils/teammate.js'
|
} from '../../utils/teammate.js'
|
||||||
import { feature } from 'bun:bundle'
|
import { feature } from 'bun:bundle'
|
||||||
|
import { COMPUTER_USE_MCP_SERVER_NAME } from '../../utils/computerUse/common.js'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Marker type for verifying analytics metadata doesn't contain sensitive data
|
* Marker type for verifying analytics metadata doesn't contain sensitive data
|
||||||
|
|
@ -125,17 +126,9 @@ export function isAnalyticsToolDetailsLoggingEnabled(
|
||||||
* reservation (main.tsx, config.ts addMcpServer) is itself feature-gated, so
|
* reservation (main.tsx, config.ts addMcpServer) is itself feature-gated, so
|
||||||
* a user-configured 'computer-use' is possible in builds without the feature.
|
* a user-configured 'computer-use' is possible in builds without the feature.
|
||||||
*/
|
*/
|
||||||
/* eslint-disable @typescript-eslint/no-require-imports */
|
|
||||||
const BUILTIN_MCP_SERVER_NAMES: ReadonlySet<string> = new Set(
|
const BUILTIN_MCP_SERVER_NAMES: ReadonlySet<string> = new Set(
|
||||||
feature('CHICAGO_MCP')
|
feature('CHICAGO_MCP') ? [COMPUTER_USE_MCP_SERVER_NAME] : [],
|
||||||
? [
|
|
||||||
(
|
|
||||||
require('../../utils/computerUse/common.js') as typeof import('../../utils/computerUse/common.js')
|
|
||||||
).COMPUTER_USE_MCP_SERVER_NAME,
|
|
||||||
]
|
|
||||||
: [],
|
|
||||||
)
|
)
|
||||||
/* eslint-enable @typescript-eslint/no-require-imports */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Spreadable helper for logEvent payloads — returns {mcpServerName, mcpToolName}
|
* Spreadable helper for logEvent payloads — returns {mcpServerName, mcpToolName}
|
||||||
|
|
|
||||||
|
|
@ -101,10 +101,10 @@ import {
|
||||||
extractQuotaStatusFromHeaders,
|
extractQuotaStatusFromHeaders,
|
||||||
} from '../claudeAiLimits.js'
|
} from '../claudeAiLimits.js'
|
||||||
import { getAPIContextManagement } from '../compact/apiMicrocompact.js'
|
import { getAPIContextManagement } from '../compact/apiMicrocompact.js'
|
||||||
|
import * as autoModeStateModuleValue from '../../utils/permissions/autoModeState.js'
|
||||||
|
|
||||||
/* eslint-disable @typescript-eslint/no-require-imports */
|
|
||||||
const autoModeStateModule = feature('TRANSCRIPT_CLASSIFIER')
|
const autoModeStateModule = feature('TRANSCRIPT_CLASSIFIER')
|
||||||
? (require('../../utils/permissions/autoModeState.js') as typeof import('../../utils/permissions/autoModeState.js'))
|
? autoModeStateModuleValue
|
||||||
: null
|
: null
|
||||||
|
|
||||||
import { feature } from 'bun:bundle'
|
import { feature } from 'bun:bundle'
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,11 @@
|
||||||
import { feature } from 'bun:bundle'
|
import { feature } from 'bun:bundle'
|
||||||
import type { UUID } from 'crypto'
|
import type { UUID } from 'crypto'
|
||||||
import uniqBy from 'lodash-es/uniqBy.js'
|
import uniqBy from 'lodash-es/uniqBy.js'
|
||||||
|
import * as sessionTranscriptModuleValue from '../sessionTranscript/sessionTranscript.js'
|
||||||
|
|
||||||
/* eslint-disable @typescript-eslint/no-require-imports */
|
|
||||||
const sessionTranscriptModule = feature('KAIROS')
|
const sessionTranscriptModule = feature('KAIROS')
|
||||||
? (require('../sessionTranscript/sessionTranscript.js') as typeof import('../sessionTranscript/sessionTranscript.js'))
|
? sessionTranscriptModuleValue
|
||||||
: null
|
: null
|
||||||
|
|
||||||
import { APIUserAbortError } from '@anthropic-ai/sdk'
|
import { APIUserAbortError } from '@anthropic-ai/sdk'
|
||||||
import { markPostCompaction } from 'src/bootstrap/state.js'
|
import { markPostCompaction } from 'src/bootstrap/state.js'
|
||||||
import { getInvokedSkillsForAgent } from '../../bootstrap/state.js'
|
import { getInvokedSkillsForAgent } from '../../bootstrap/state.js'
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,11 @@
|
||||||
import { feature } from 'bun:bundle'
|
import { feature } from 'bun:bundle'
|
||||||
import type { PartialCompactDirection } from '../../types/message.js'
|
import type { PartialCompactDirection } from '../../types/message.js'
|
||||||
|
import * as proactiveModuleValue from '../../proactive/index.js'
|
||||||
|
|
||||||
// Dead code elimination: conditional import for proactive mode
|
|
||||||
/* eslint-disable @typescript-eslint/no-require-imports */
|
|
||||||
const proactiveModule =
|
const proactiveModule =
|
||||||
feature('PROACTIVE') || feature('KAIROS')
|
feature('PROACTIVE') || feature('KAIROS')
|
||||||
? (require('../../proactive/index.js') as typeof import('../../proactive/index.js'))
|
? proactiveModuleValue
|
||||||
: null
|
: null
|
||||||
/* eslint-enable @typescript-eslint/no-require-imports */
|
|
||||||
|
|
||||||
// Aggressive no-tools preamble. The cache-sharing fork path inherits the
|
// Aggressive no-tools preamble. The cache-sharing fork path inherits the
|
||||||
// parent's full tool set (required for cache-key match), and on Sonnet 4.6+
|
// parent's full tool set (required for cache-key match), and on Sonnet 4.6+
|
||||||
|
|
|
||||||
|
|
@ -230,6 +230,7 @@ function getMcpToolTimeoutMs(): number {
|
||||||
}
|
}
|
||||||
|
|
||||||
import { isClaudeInChromeMCPServer } from '../../utils/claudeInChrome/common.js'
|
import { isClaudeInChromeMCPServer } from '../../utils/claudeInChrome/common.js'
|
||||||
|
import { isComputerUseMCPServer as isComputerUseMCPServerValue } from '../../utils/computerUse/common.js'
|
||||||
|
|
||||||
// Lazy: toolRendering.tsx pulls React/ink; only needed when Claude-in-Chrome MCP server is connected
|
// Lazy: toolRendering.tsx pulls React/ink; only needed when Claude-in-Chrome MCP server is connected
|
||||||
/* eslint-disable @typescript-eslint/no-require-imports */
|
/* eslint-disable @typescript-eslint/no-require-imports */
|
||||||
|
|
@ -244,9 +245,7 @@ const computerUseWrapper = feature('CHICAGO_MCP')
|
||||||
require('../../utils/computerUse/wrapper.js')
|
require('../../utils/computerUse/wrapper.js')
|
||||||
: undefined
|
: undefined
|
||||||
const isComputerUseMCPServer = feature('CHICAGO_MCP')
|
const isComputerUseMCPServer = feature('CHICAGO_MCP')
|
||||||
? (
|
? isComputerUseMCPServerValue
|
||||||
require('../../utils/computerUse/common.js') as typeof import('../../utils/computerUse/common.js')
|
|
||||||
).isComputerUseMCPServer
|
|
||||||
: undefined
|
: undefined
|
||||||
|
|
||||||
import { mkdir, readFile, unlink, writeFile } from 'fs/promises'
|
import { mkdir, readFile, unlink, writeFile } from 'fs/promises'
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ import { getErrnoCode } from '../../utils/errors.js'
|
||||||
import { getFsImplementation } from '../../utils/fsOperations.js'
|
import { getFsImplementation } from '../../utils/fsOperations.js'
|
||||||
import { safeParseJSON } from '../../utils/json.js'
|
import { safeParseJSON } from '../../utils/json.js'
|
||||||
import { logError } from '../../utils/log.js'
|
import { logError } from '../../utils/log.js'
|
||||||
|
import { COMPUTER_USE_MCP_SERVER_NAME } from '../../utils/computerUse/common.js'
|
||||||
import { getPluginMcpServers } from '../../utils/plugins/mcpPluginIntegration.js'
|
import { getPluginMcpServers } from '../../utils/plugins/mcpPluginIntegration.js'
|
||||||
import { loadAllPluginsCacheOnly } from '../../utils/plugins/pluginLoader.js'
|
import { loadAllPluginsCacheOnly } from '../../utils/plugins/pluginLoader.js'
|
||||||
import { isSettingSourceEnabled } from '../../utils/settings/constants.js'
|
import { isSettingSourceEnabled } from '../../utils/settings/constants.js'
|
||||||
|
|
@ -1509,13 +1510,9 @@ export function areMcpConfigsAllowedWithEnterpriseMcpConfig(
|
||||||
* (opt-out via disabledMcpServers), this requires explicit opt-in via
|
* (opt-out via disabledMcpServers), this requires explicit opt-in via
|
||||||
* enabledMcpServers. Shows up in /mcp as disabled until the user enables it.
|
* enabledMcpServers. Shows up in /mcp as disabled until the user enables it.
|
||||||
*/
|
*/
|
||||||
/* eslint-disable @typescript-eslint/no-require-imports */
|
|
||||||
const DEFAULT_DISABLED_BUILTIN = feature('CHICAGO_MCP')
|
const DEFAULT_DISABLED_BUILTIN = feature('CHICAGO_MCP')
|
||||||
? (
|
? COMPUTER_USE_MCP_SERVER_NAME
|
||||||
require('../../utils/computerUse/common.js') as typeof import('../../utils/computerUse/common.js')
|
|
||||||
).COMPUTER_USE_MCP_SERVER_NAME
|
|
||||||
: null
|
: null
|
||||||
/* eslint-enable @typescript-eslint/no-require-imports */
|
|
||||||
|
|
||||||
function isDefaultDisabledBuiltin(name: string): boolean {
|
function isDefaultDisabledBuiltin(name: string): boolean {
|
||||||
return DEFAULT_DISABLED_BUILTIN !== null && name === DEFAULT_DISABLED_BUILTIN
|
return DEFAULT_DISABLED_BUILTIN !== null && name === DEFAULT_DISABLED_BUILTIN
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ import { basename } from 'path'
|
||||||
import { useCallback, useEffect, useRef } from 'react'
|
import { useCallback, useEffect, useRef } from 'react'
|
||||||
import { getSessionId } from '../../bootstrap/state.js'
|
import { getSessionId } from '../../bootstrap/state.js'
|
||||||
import type { Command } from '../../commands.js'
|
import type { Command } from '../../commands.js'
|
||||||
|
import { clearSkillIndexCache as clearSkillIndexCacheValue } from '../skillSearch/localSearch.js'
|
||||||
import type { Tool } from '../../Tool.js'
|
import type { Tool } from '../../Tool.js'
|
||||||
import {
|
import {
|
||||||
clearServerCache,
|
clearServerCache,
|
||||||
|
|
@ -25,9 +26,7 @@ const fetchMcpSkillsForClient = feature('MCP_SKILLS')
|
||||||
).fetchMcpSkillsForClient
|
).fetchMcpSkillsForClient
|
||||||
: null
|
: null
|
||||||
const clearSkillIndexCache = feature('EXPERIMENTAL_SKILL_SEARCH')
|
const clearSkillIndexCache = feature('EXPERIMENTAL_SKILL_SEARCH')
|
||||||
? (
|
? clearSkillIndexCacheValue
|
||||||
require('../skillSearch/localSearch.js') as typeof import('../skillSearch/localSearch.js')
|
|
||||||
).clearSkillIndexCache
|
|
||||||
: null
|
: null
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ import React, {
|
||||||
useSyncExternalStore,
|
useSyncExternalStore,
|
||||||
} from 'react'
|
} from 'react'
|
||||||
import { MailboxProvider } from '../context/mailbox.js'
|
import { MailboxProvider } from '../context/mailbox.js'
|
||||||
|
import { VoiceProvider as VoiceProviderValue } from '../context/voice.js'
|
||||||
import { useSettingsChange } from '../hooks/useSettingsChange.js'
|
import { useSettingsChange } from '../hooks/useSettingsChange.js'
|
||||||
import { logForDebugging } from '../utils/debug.js'
|
import { logForDebugging } from '../utils/debug.js'
|
||||||
import {
|
import {
|
||||||
|
|
@ -17,14 +18,8 @@ import { applySettingsChange } from '../utils/settings/applySettingsChange.js'
|
||||||
import type { SettingSource } from '../utils/settings/constants.js'
|
import type { SettingSource } from '../utils/settings/constants.js'
|
||||||
import { createStore } from './store.js'
|
import { createStore } from './store.js'
|
||||||
|
|
||||||
// DCE: voice context is ant-only. External builds get a passthrough.
|
|
||||||
/* eslint-disable @typescript-eslint/no-require-imports */
|
|
||||||
const VoiceProvider: (props: { children: React.ReactNode }) => React.ReactNode =
|
const VoiceProvider: (props: { children: React.ReactNode }) => React.ReactNode =
|
||||||
feature('VOICE_MODE')
|
feature('VOICE_MODE') ? VoiceProviderValue : ({ children }) => children
|
||||||
? require('../context/voice.js').VoiceProvider
|
|
||||||
: ({ children }) => children
|
|
||||||
|
|
||||||
/* eslint-enable @typescript-eslint/no-require-imports */
|
|
||||||
import {
|
import {
|
||||||
type AppState,
|
type AppState,
|
||||||
type AppStateStore,
|
type AppStateStore,
|
||||||
|
|
|
||||||
10
src/tasks.ts
10
src/tasks.ts
|
|
@ -5,14 +5,8 @@ import { LocalAgentTask } from './tasks/LocalAgentTask/LocalAgentTask.js'
|
||||||
import { LocalShellTask } from './tasks/LocalShellTask/LocalShellTask.js'
|
import { LocalShellTask } from './tasks/LocalShellTask/LocalShellTask.js'
|
||||||
import { RemoteAgentTask } from './tasks/RemoteAgentTask/RemoteAgentTask.js'
|
import { RemoteAgentTask } from './tasks/RemoteAgentTask/RemoteAgentTask.js'
|
||||||
|
|
||||||
/* eslint-disable @typescript-eslint/no-require-imports */
|
const LocalWorkflowTask: Task | null = feature('WORKFLOW_SCRIPTS') ? null : null
|
||||||
const LocalWorkflowTask: Task | null = feature('WORKFLOW_SCRIPTS')
|
const MonitorMcpTask: Task | null = feature('MONITOR_TOOL') ? null : null
|
||||||
? require('./tasks/LocalWorkflowTask/LocalWorkflowTask.js').LocalWorkflowTask
|
|
||||||
: null
|
|
||||||
const MonitorMcpTask: Task | null = feature('MONITOR_TOOL')
|
|
||||||
? require('./tasks/MonitorMcpTask/MonitorMcpTask.js').MonitorMcpTask
|
|
||||||
: null
|
|
||||||
/* eslint-enable @typescript-eslint/no-require-imports */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all tasks.
|
* Get all tasks.
|
||||||
|
|
|
||||||
54
src/tools.ts
54
src/tools.ts
|
|
@ -11,6 +11,20 @@ import { NotebookEditTool } from './tools/NotebookEditTool/NotebookEditTool.js'
|
||||||
import { WebFetchTool } from './tools/WebFetchTool/WebFetchTool.js'
|
import { WebFetchTool } from './tools/WebFetchTool/WebFetchTool.js'
|
||||||
import { TaskStopTool } from './tools/TaskStopTool/TaskStopTool.js'
|
import { TaskStopTool } from './tools/TaskStopTool/TaskStopTool.js'
|
||||||
import { BriefTool } from './tools/BriefTool/BriefTool.js'
|
import { BriefTool } from './tools/BriefTool/BriefTool.js'
|
||||||
|
import { SleepTool as SleepToolValue } from './tools/SleepTool/SleepTool.js'
|
||||||
|
import { CronCreateTool } from './tools/ScheduleCronTool/CronCreateTool.js'
|
||||||
|
import { CronDeleteTool } from './tools/ScheduleCronTool/CronDeleteTool.js'
|
||||||
|
import { CronListTool } from './tools/ScheduleCronTool/CronListTool.js'
|
||||||
|
import { RemoteTriggerTool as RemoteTriggerToolValue } from './tools/RemoteTriggerTool/RemoteTriggerTool.js'
|
||||||
|
import { MonitorTool as MonitorToolValue } from './tools/MonitorTool/MonitorTool.js'
|
||||||
|
import { SendUserFileTool as SendUserFileToolValue } from './tools/SendUserFileTool/SendUserFileTool.js'
|
||||||
|
import { PushNotificationTool as PushNotificationToolValue } from './tools/PushNotificationTool/PushNotificationTool.js'
|
||||||
|
import { TeamCreateTool as TeamCreateToolValue } from './tools/TeamCreateTool/TeamCreateTool.js'
|
||||||
|
import { TeamDeleteTool as TeamDeleteToolValue } from './tools/TeamDeleteTool/TeamDeleteTool.js'
|
||||||
|
import { SendMessageTool as SendMessageToolValue } from './tools/SendMessageTool/SendMessageTool.js'
|
||||||
|
import { initBundledWorkflows } from './tools/WorkflowTool/bundled/index.js'
|
||||||
|
import { WorkflowTool as WorkflowToolValue } from './tools/WorkflowTool/WorkflowTool.js'
|
||||||
|
import * as coordinatorModeModuleValue from './coordinator/coordinatorMode.js'
|
||||||
// Dead code elimination: conditional import for ant-only tools
|
// Dead code elimination: conditional import for ant-only tools
|
||||||
/* eslint-disable custom-rules/no-process-env-top-level, @typescript-eslint/no-require-imports */
|
/* eslint-disable custom-rules/no-process-env-top-level, @typescript-eslint/no-require-imports */
|
||||||
const REPLTool =
|
const REPLTool =
|
||||||
|
|
@ -23,27 +37,20 @@ const SuggestBackgroundPRTool =
|
||||||
.SuggestBackgroundPRTool
|
.SuggestBackgroundPRTool
|
||||||
: null
|
: null
|
||||||
const SleepTool =
|
const SleepTool =
|
||||||
feature('PROACTIVE') || feature('KAIROS')
|
feature('PROACTIVE') || feature('KAIROS') ? SleepToolValue : null
|
||||||
? require('./tools/SleepTool/SleepTool.js').SleepTool
|
const cronTools = [CronCreateTool, CronDeleteTool, CronListTool]
|
||||||
: null
|
|
||||||
const cronTools = [
|
|
||||||
require('./tools/ScheduleCronTool/CronCreateTool.js').CronCreateTool,
|
|
||||||
require('./tools/ScheduleCronTool/CronDeleteTool.js').CronDeleteTool,
|
|
||||||
require('./tools/ScheduleCronTool/CronListTool.js').CronListTool,
|
|
||||||
]
|
|
||||||
const RemoteTriggerTool = feature('AGENT_TRIGGERS_REMOTE')
|
const RemoteTriggerTool = feature('AGENT_TRIGGERS_REMOTE')
|
||||||
? require('./tools/RemoteTriggerTool/RemoteTriggerTool.js').RemoteTriggerTool
|
? RemoteTriggerToolValue
|
||||||
: null
|
: null
|
||||||
const MonitorTool = feature('MONITOR_TOOL')
|
const MonitorTool = feature('MONITOR_TOOL')
|
||||||
? require('./tools/MonitorTool/MonitorTool.js').MonitorTool
|
? MonitorToolValue
|
||||||
: null
|
: null
|
||||||
const SendUserFileTool = feature('KAIROS')
|
const SendUserFileTool = feature('KAIROS')
|
||||||
? require('./tools/SendUserFileTool/SendUserFileTool.js').SendUserFileTool
|
? SendUserFileToolValue
|
||||||
: null
|
: null
|
||||||
const PushNotificationTool =
|
const PushNotificationTool =
|
||||||
feature('KAIROS') || feature('KAIROS_PUSH_NOTIFICATION')
|
feature('KAIROS') || feature('KAIROS_PUSH_NOTIFICATION')
|
||||||
? require('./tools/PushNotificationTool/PushNotificationTool.js')
|
? PushNotificationToolValue
|
||||||
.PushNotificationTool
|
|
||||||
: null
|
: null
|
||||||
const SubscribePRTool = feature('KAIROS_GITHUB_WEBHOOKS')
|
const SubscribePRTool = feature('KAIROS_GITHUB_WEBHOOKS')
|
||||||
? require('./tools/SubscribePRTool/SubscribePRTool.js').SubscribePRTool
|
? require('./tools/SubscribePRTool/SubscribePRTool.js').SubscribePRTool
|
||||||
|
|
@ -56,18 +63,9 @@ import { ExitPlanModeV2Tool } from './tools/ExitPlanModeTool/ExitPlanModeV2Tool.
|
||||||
import { TestingPermissionTool } from './tools/testing/TestingPermissionTool.js'
|
import { TestingPermissionTool } from './tools/testing/TestingPermissionTool.js'
|
||||||
import { GrepTool } from './tools/GrepTool/GrepTool.js'
|
import { GrepTool } from './tools/GrepTool/GrepTool.js'
|
||||||
import { TungstenTool } from './tools/TungstenTool/TungstenTool.js'
|
import { TungstenTool } from './tools/TungstenTool/TungstenTool.js'
|
||||||
// Lazy require to break circular dependency: tools.ts -> TeamCreateTool/TeamDeleteTool -> ... -> tools.ts
|
const getTeamCreateTool = () => TeamCreateToolValue
|
||||||
/* eslint-disable @typescript-eslint/no-require-imports */
|
const getTeamDeleteTool = () => TeamDeleteToolValue
|
||||||
const getTeamCreateTool = () =>
|
const getSendMessageTool = () => SendMessageToolValue
|
||||||
require('./tools/TeamCreateTool/TeamCreateTool.js')
|
|
||||||
.TeamCreateTool as typeof import('./tools/TeamCreateTool/TeamCreateTool.js').TeamCreateTool
|
|
||||||
const getTeamDeleteTool = () =>
|
|
||||||
require('./tools/TeamDeleteTool/TeamDeleteTool.js')
|
|
||||||
.TeamDeleteTool as typeof import('./tools/TeamDeleteTool/TeamDeleteTool.js').TeamDeleteTool
|
|
||||||
const getSendMessageTool = () =>
|
|
||||||
require('./tools/SendMessageTool/SendMessageTool.js')
|
|
||||||
.SendMessageTool as typeof import('./tools/SendMessageTool/SendMessageTool.js').SendMessageTool
|
|
||||||
/* eslint-enable @typescript-eslint/no-require-imports */
|
|
||||||
import { AskUserQuestionTool } from './tools/AskUserQuestionTool/AskUserQuestionTool.js'
|
import { AskUserQuestionTool } from './tools/AskUserQuestionTool/AskUserQuestionTool.js'
|
||||||
import { LSPTool } from './tools/LSPTool/LSPTool.js'
|
import { LSPTool } from './tools/LSPTool/LSPTool.js'
|
||||||
import { ListMcpResourcesTool } from './tools/ListMcpResourcesTool/ListMcpResourcesTool.js'
|
import { ListMcpResourcesTool } from './tools/ListMcpResourcesTool/ListMcpResourcesTool.js'
|
||||||
|
|
@ -116,7 +114,7 @@ const WebBrowserTool = feature('WEB_BROWSER_TOOL')
|
||||||
? require('./tools/WebBrowserTool/WebBrowserTool.js').WebBrowserTool
|
? require('./tools/WebBrowserTool/WebBrowserTool.js').WebBrowserTool
|
||||||
: null
|
: null
|
||||||
const coordinatorModeModule = feature('COORDINATOR_MODE')
|
const coordinatorModeModule = feature('COORDINATOR_MODE')
|
||||||
? (require('./coordinator/coordinatorMode.js') as typeof import('./coordinator/coordinatorMode.js'))
|
? coordinatorModeModuleValue
|
||||||
: null
|
: null
|
||||||
const SnipTool = feature('HISTORY_SNIP')
|
const SnipTool = feature('HISTORY_SNIP')
|
||||||
? require('./tools/SnipTool/SnipTool.js').SnipTool
|
? require('./tools/SnipTool/SnipTool.js').SnipTool
|
||||||
|
|
@ -126,8 +124,8 @@ const ListPeersTool = feature('UDS_INBOX')
|
||||||
: null
|
: null
|
||||||
const WorkflowTool = feature('WORKFLOW_SCRIPTS')
|
const WorkflowTool = feature('WORKFLOW_SCRIPTS')
|
||||||
? (() => {
|
? (() => {
|
||||||
require('./tools/WorkflowTool/bundled/index.js').initBundledWorkflows()
|
initBundledWorkflows()
|
||||||
return require('./tools/WorkflowTool/WorkflowTool.js').WorkflowTool
|
return WorkflowToolValue
|
||||||
})()
|
})()
|
||||||
: null
|
: null
|
||||||
/* eslint-enable custom-rules/no-process-env-top-level, @typescript-eslint/no-require-imports */
|
/* eslint-enable custom-rules/no-process-env-top-level, @typescript-eslint/no-require-imports */
|
||||||
|
|
|
||||||
|
|
@ -132,13 +132,12 @@ import {
|
||||||
userFacingName,
|
userFacingName,
|
||||||
userFacingNameBackgroundColor,
|
userFacingNameBackgroundColor,
|
||||||
} from './UI.js'
|
} from './UI.js'
|
||||||
|
import * as proactiveModuleValue from '../../proactive/index.js'
|
||||||
|
|
||||||
/* eslint-disable @typescript-eslint/no-require-imports */
|
|
||||||
const proactiveModule =
|
const proactiveModule =
|
||||||
feature('PROACTIVE') || feature('KAIROS')
|
feature('PROACTIVE') || feature('KAIROS')
|
||||||
? (require('../../proactive/index.js') as typeof import('../../proactive/index.js'))
|
? proactiveModuleValue
|
||||||
: null
|
: null
|
||||||
/* eslint-enable @typescript-eslint/no-require-imports */
|
|
||||||
|
|
||||||
// Progress display constants (for showing background hint)
|
// Progress display constants (for showing background hint)
|
||||||
const PROGRESS_THRESHOLD_MS = 2000 // Show background hint after 2 seconds
|
const PROGRESS_THRESHOLD_MS = 2000 // Show background hint after 2 seconds
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@ import type {
|
||||||
} from '../../services/mcp/types.js'
|
} from '../../services/mcp/types.js'
|
||||||
import type { Tool, Tools, ToolUseContext } from '../../Tool.js'
|
import type { Tool, Tools, ToolUseContext } from '../../Tool.js'
|
||||||
import { killShellTasksForAgent } from '../../tasks/LocalShellTask/killShellTasks.js'
|
import { killShellTasksForAgent } from '../../tasks/LocalShellTask/killShellTasks.js'
|
||||||
|
import { killMonitorMcpTasksForAgent } from '../../tasks/MonitorMcpTask/MonitorMcpTask.js'
|
||||||
import type { Command } from '../../types/command.js'
|
import type { Command } from '../../types/command.js'
|
||||||
import type { AgentId } from '../../types/ids.js'
|
import type { AgentId } from '../../types/ids.js'
|
||||||
import type {
|
import type {
|
||||||
|
|
@ -872,17 +873,13 @@ export async function* runAgent({
|
||||||
// `run_in_background` shell loop (e.g. test fixture fake-logs.sh) outlives
|
// `run_in_background` shell loop (e.g. test fixture fake-logs.sh) outlives
|
||||||
// the agent as a PPID=1 zombie once the main session eventually exits.
|
// the agent as a PPID=1 zombie once the main session eventually exits.
|
||||||
killShellTasksForAgent(agentId, toolUseContext.getAppState, rootSetAppState)
|
killShellTasksForAgent(agentId, toolUseContext.getAppState, rootSetAppState)
|
||||||
/* eslint-disable @typescript-eslint/no-require-imports */
|
|
||||||
if (feature('MONITOR_TOOL')) {
|
if (feature('MONITOR_TOOL')) {
|
||||||
const mcpMod =
|
killMonitorMcpTasksForAgent(
|
||||||
require('../../tasks/MonitorMcpTask/MonitorMcpTask.js') as typeof import('../../tasks/MonitorMcpTask/MonitorMcpTask.js')
|
|
||||||
mcpMod.killMonitorMcpTasksForAgent(
|
|
||||||
agentId,
|
agentId,
|
||||||
toolUseContext.getAppState,
|
toolUseContext.getAppState,
|
||||||
rootSetAppState,
|
rootSetAppState,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
/* eslint-enable @typescript-eslint/no-require-imports */
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -47,15 +47,15 @@ import {
|
||||||
renderToolUseMessage,
|
renderToolUseMessage,
|
||||||
renderToolUseRejectedMessage,
|
renderToolUseRejectedMessage,
|
||||||
} from './UI.js'
|
} from './UI.js'
|
||||||
|
import * as autoModeStateModuleValue from '../../utils/permissions/autoModeState.js'
|
||||||
|
import * as permissionSetupModuleValue from '../../utils/permissions/permissionSetup.js'
|
||||||
|
|
||||||
/* eslint-disable @typescript-eslint/no-require-imports */
|
|
||||||
const autoModeStateModule = feature('TRANSCRIPT_CLASSIFIER')
|
const autoModeStateModule = feature('TRANSCRIPT_CLASSIFIER')
|
||||||
? (require('../../utils/permissions/autoModeState.js') as typeof import('../../utils/permissions/autoModeState.js'))
|
? autoModeStateModuleValue
|
||||||
: null
|
: null
|
||||||
const permissionSetupModule = feature('TRANSCRIPT_CLASSIFIER')
|
const permissionSetupModule = feature('TRANSCRIPT_CLASSIFIER')
|
||||||
? (require('../../utils/permissions/permissionSetup.js') as typeof import('../../utils/permissions/permissionSetup.js'))
|
? permissionSetupModuleValue
|
||||||
: null
|
: null
|
||||||
/* eslint-enable @typescript-eslint/no-require-imports */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Schema for prompt-based permission requests.
|
* Schema for prompt-based permission requests.
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,10 @@ import {
|
||||||
parsePluginIdentifier,
|
parsePluginIdentifier,
|
||||||
} from 'src/utils/plugins/pluginIdentifier.js'
|
} from 'src/utils/plugins/pluginIdentifier.js'
|
||||||
import { buildPluginCommandTelemetryFields } from 'src/utils/telemetry/pluginTelemetry.js'
|
import { buildPluginCommandTelemetryFields } from 'src/utils/telemetry/pluginTelemetry.js'
|
||||||
|
import * as remoteSkillFeatureCheck from '../../services/skillSearch/featureCheck.js'
|
||||||
|
import * as remoteSkillLoader from '../../services/skillSearch/remoteSkillLoader.js'
|
||||||
|
import * as remoteSkillState from '../../services/skillSearch/remoteSkillState.js'
|
||||||
|
import * as remoteSkillTelemetry from '../../services/skillSearch/telemetry.js'
|
||||||
import { z } from 'zod/v4'
|
import { z } from 'zod/v4'
|
||||||
import {
|
import {
|
||||||
addInvokedSkill,
|
addInvokedSkill,
|
||||||
|
|
@ -104,16 +108,14 @@ import type { SkillToolProgress as Progress } from '../../types/tools.js'
|
||||||
// side-effecting initializers. All usages are inside
|
// side-effecting initializers. All usages are inside
|
||||||
// feature('EXPERIMENTAL_SKILL_SEARCH') guards, so remoteSkillModules is
|
// feature('EXPERIMENTAL_SKILL_SEARCH') guards, so remoteSkillModules is
|
||||||
// non-null at every call site.
|
// non-null at every call site.
|
||||||
/* eslint-disable @typescript-eslint/no-require-imports */
|
|
||||||
const remoteSkillModules = feature('EXPERIMENTAL_SKILL_SEARCH')
|
const remoteSkillModules = feature('EXPERIMENTAL_SKILL_SEARCH')
|
||||||
? {
|
? {
|
||||||
...(require('../../services/skillSearch/remoteSkillState.js') as typeof import('../../services/skillSearch/remoteSkillState.js')),
|
...remoteSkillState,
|
||||||
...(require('../../services/skillSearch/remoteSkillLoader.js') as typeof import('../../services/skillSearch/remoteSkillLoader.js')),
|
...remoteSkillLoader,
|
||||||
...(require('../../services/skillSearch/telemetry.js') as typeof import('../../services/skillSearch/telemetry.js')),
|
...remoteSkillTelemetry,
|
||||||
...(require('../../services/skillSearch/featureCheck.js') as typeof import('../../services/skillSearch/featureCheck.js')),
|
...remoteSkillFeatureCheck,
|
||||||
}
|
}
|
||||||
: null
|
: null
|
||||||
/* eslint-enable @typescript-eslint/no-require-imports */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Executes a skill in a forked sub-agent context.
|
* Executes a skill in a forked sub-agent context.
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import type { ToolResultBlockParam } from '@anthropic-ai/sdk/resources/index.mjs
|
||||||
import { buildTool } from '../../Tool.js'
|
import { buildTool } from '../../Tool.js'
|
||||||
import { lazySchema } from '../../utils/lazySchema.js'
|
import { lazySchema } from '../../utils/lazySchema.js'
|
||||||
import { SLEEP_TOOL_NAME, DESCRIPTION, SLEEP_TOOL_PROMPT } from './prompt.js'
|
import { SLEEP_TOOL_NAME, DESCRIPTION, SLEEP_TOOL_PROMPT } from './prompt.js'
|
||||||
|
import * as proactiveModuleValue from '../../proactive/index.js'
|
||||||
|
|
||||||
const inputSchema = lazySchema(() =>
|
const inputSchema = lazySchema(() =>
|
||||||
z.strictObject({
|
z.strictObject({
|
||||||
|
|
@ -70,9 +71,7 @@ export const SleepTool = buildTool({
|
||||||
// Refuse to sleep when proactive mode is off — prevents the model from
|
// Refuse to sleep when proactive mode is off — prevents the model from
|
||||||
// re-issuing Sleep after an interruption caused by /proactive disable.
|
// re-issuing Sleep after an interruption caused by /proactive disable.
|
||||||
if (feature('PROACTIVE') || feature('KAIROS')) {
|
if (feature('PROACTIVE') || feature('KAIROS')) {
|
||||||
const mod =
|
if (!proactiveModuleValue.isProactiveActive()) {
|
||||||
require('../../proactive/index.js') as typeof import('../../proactive/index.js')
|
|
||||||
if (!mod.isProactiveActive()) {
|
|
||||||
return {
|
return {
|
||||||
data: {
|
data: {
|
||||||
slept_seconds: 0,
|
slept_seconds: 0,
|
||||||
|
|
@ -105,9 +104,7 @@ export const SleepTool = buildTool({
|
||||||
const proactiveCheck =
|
const proactiveCheck =
|
||||||
feature('PROACTIVE') || feature('KAIROS')
|
feature('PROACTIVE') || feature('KAIROS')
|
||||||
? setInterval(() => {
|
? setInterval(() => {
|
||||||
const mod =
|
if (!proactiveModuleValue.isProactiveActive()) {
|
||||||
require('../../proactive/index.js') as typeof import('../../proactive/index.js')
|
|
||||||
if (!mod.isProactiveActive()) {
|
|
||||||
clearTimeout(timer)
|
clearTimeout(timer)
|
||||||
clearInterval(proactiveCheck)
|
clearInterval(proactiveCheck)
|
||||||
reject(new Error('interrupted'))
|
reject(new Error('interrupted'))
|
||||||
|
|
|
||||||
|
|
@ -3,23 +3,18 @@ import { isReplBridgeActive } from '../../bootstrap/state.js'
|
||||||
import { getFeatureValue_CACHED_MAY_BE_STALE } from '../../services/analytics/growthbook.js'
|
import { getFeatureValue_CACHED_MAY_BE_STALE } from '../../services/analytics/growthbook.js'
|
||||||
import type { Tool } from '../../Tool.js'
|
import type { Tool } from '../../Tool.js'
|
||||||
import { AGENT_TOOL_NAME } from '../AgentTool/constants.js'
|
import { AGENT_TOOL_NAME } from '../AgentTool/constants.js'
|
||||||
|
import { BRIEF_TOOL_NAME as BRIEF_TOOL_NAME_VALUE } from '../BriefTool/prompt.js'
|
||||||
|
import { SEND_USER_FILE_TOOL_NAME as SEND_USER_FILE_TOOL_NAME_VALUE } from '../SendUserFileTool/prompt.js'
|
||||||
|
|
||||||
// Dead code elimination: Brief tool name only needed when KAIROS or KAIROS_BRIEF is on
|
// Dead code elimination: Brief tool names are only used when KAIROS/KAIROS_BRIEF is on.
|
||||||
/* eslint-disable @typescript-eslint/no-require-imports */
|
|
||||||
const BRIEF_TOOL_NAME: string | null =
|
const BRIEF_TOOL_NAME: string | null =
|
||||||
feature('KAIROS') || feature('KAIROS_BRIEF')
|
feature('KAIROS') || feature('KAIROS_BRIEF')
|
||||||
? (
|
? BRIEF_TOOL_NAME_VALUE
|
||||||
require('../BriefTool/prompt.js') as typeof import('../BriefTool/prompt.js')
|
|
||||||
).BRIEF_TOOL_NAME
|
|
||||||
: null
|
: null
|
||||||
const SEND_USER_FILE_TOOL_NAME: string | null = feature('KAIROS')
|
const SEND_USER_FILE_TOOL_NAME: string | null = feature('KAIROS')
|
||||||
? (
|
? SEND_USER_FILE_TOOL_NAME_VALUE
|
||||||
require('../SendUserFileTool/prompt.js') as typeof import('../SendUserFileTool/prompt.js')
|
|
||||||
).SEND_USER_FILE_TOOL_NAME
|
|
||||||
: null
|
: null
|
||||||
|
|
||||||
/* eslint-enable @typescript-eslint/no-require-imports */
|
|
||||||
|
|
||||||
export { TOOL_SEARCH_TOOL_NAME } from './constants.js'
|
export { TOOL_SEARCH_TOOL_NAME } from './constants.js'
|
||||||
|
|
||||||
import { TOOL_SEARCH_TOOL_NAME } from './constants.js'
|
import { TOOL_SEARCH_TOOL_NAME } from './constants.js'
|
||||||
|
|
|
||||||
|
|
@ -86,6 +86,10 @@ import { getProjectRoot } from '../bootstrap/state.js'
|
||||||
import { formatCommandsWithinBudget } from '../tools/SkillTool/prompt.js'
|
import { formatCommandsWithinBudget } from '../tools/SkillTool/prompt.js'
|
||||||
import { getContextWindowForModel } from './context.js'
|
import { getContextWindowForModel } from './context.js'
|
||||||
import type { DiscoverySignal } from '../services/skillSearch/signals.js'
|
import type { DiscoverySignal } from '../services/skillSearch/signals.js'
|
||||||
|
import * as skillSearchFeatureCheck from '../services/skillSearch/featureCheck.js'
|
||||||
|
import * as skillSearchPrefetch from '../services/skillSearch/prefetch.js'
|
||||||
|
import { BRIEF_TOOL_NAME as BRIEF_TOOL_NAME_VALUE } from '../tools/BriefTool/prompt.js'
|
||||||
|
import * as autoModeStateModuleValue from './permissions/autoModeState.js'
|
||||||
// Conditional require for DCE. All skill-search string literals that would
|
// Conditional require for DCE. All skill-search string literals that would
|
||||||
// otherwise leak into external builds live inside these modules. The only
|
// otherwise leak into external builds live inside these modules. The only
|
||||||
// surfaces in THIS file are: the maybe() call (gated via spread below) and
|
// surfaces in THIS file are: the maybe() call (gated via spread below) and
|
||||||
|
|
@ -94,14 +98,12 @@ import type { DiscoverySignal } from '../services/skillSearch/signals.js'
|
||||||
/* eslint-disable @typescript-eslint/no-require-imports */
|
/* eslint-disable @typescript-eslint/no-require-imports */
|
||||||
const skillSearchModules = feature('EXPERIMENTAL_SKILL_SEARCH')
|
const skillSearchModules = feature('EXPERIMENTAL_SKILL_SEARCH')
|
||||||
? {
|
? {
|
||||||
featureCheck:
|
featureCheck: skillSearchFeatureCheck,
|
||||||
require('../services/skillSearch/featureCheck.js') as typeof import('../services/skillSearch/featureCheck.js'),
|
prefetch: skillSearchPrefetch,
|
||||||
prefetch:
|
|
||||||
require('../services/skillSearch/prefetch.js') as typeof import('../services/skillSearch/prefetch.js'),
|
|
||||||
}
|
}
|
||||||
: null
|
: null
|
||||||
const autoModeStateModule = feature('TRANSCRIPT_CLASSIFIER')
|
const autoModeStateModule = feature('TRANSCRIPT_CLASSIFIER')
|
||||||
? (require('./permissions/autoModeState.js') as typeof import('./permissions/autoModeState.js'))
|
? autoModeStateModuleValue
|
||||||
: null
|
: null
|
||||||
/* eslint-enable @typescript-eslint/no-require-imports */
|
/* eslint-enable @typescript-eslint/no-require-imports */
|
||||||
import {
|
import {
|
||||||
|
|
@ -196,15 +198,14 @@ import {
|
||||||
import { isHumanTurn } from './messagePredicates.js'
|
import { isHumanTurn } from './messagePredicates.js'
|
||||||
import { isEnvTruthy, getClaudeConfigHomeDir } from './envUtils.js'
|
import { isEnvTruthy, getClaudeConfigHomeDir } from './envUtils.js'
|
||||||
import { feature } from 'bun:bundle'
|
import { feature } from 'bun:bundle'
|
||||||
|
import * as sessionTranscriptModuleValue from '../services/sessionTranscript/sessionTranscript.js'
|
||||||
/* eslint-disable @typescript-eslint/no-require-imports */
|
/* eslint-disable @typescript-eslint/no-require-imports */
|
||||||
const BRIEF_TOOL_NAME: string | null =
|
const BRIEF_TOOL_NAME: string | null =
|
||||||
feature('KAIROS') || feature('KAIROS_BRIEF')
|
feature('KAIROS') || feature('KAIROS_BRIEF')
|
||||||
? (
|
? BRIEF_TOOL_NAME_VALUE
|
||||||
require('../tools/BriefTool/prompt.js') as typeof import('../tools/BriefTool/prompt.js')
|
|
||||||
).BRIEF_TOOL_NAME
|
|
||||||
: null
|
: null
|
||||||
const sessionTranscriptModule = feature('KAIROS')
|
const sessionTranscriptModule = feature('KAIROS')
|
||||||
? (require('../services/sessionTranscript/sessionTranscript.js') as typeof import('../services/sessionTranscript/sessionTranscript.js'))
|
? sessionTranscriptModuleValue
|
||||||
: null
|
: null
|
||||||
/* eslint-enable @typescript-eslint/no-require-imports */
|
/* eslint-enable @typescript-eslint/no-require-imports */
|
||||||
import { hasUltrathinkKeyword, isUltrathinkEnabled } from './thinking.js'
|
import { hasUltrathinkKeyword, isUltrathinkEnabled } from './thinking.js'
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,12 @@
|
||||||
import { feature } from 'bun:bundle'
|
import { feature } from 'bun:bundle'
|
||||||
import { initAutoDream } from '../services/autoDream/autoDream.js'
|
import { initAutoDream } from '../services/autoDream/autoDream.js'
|
||||||
|
import * as extractMemoriesModuleValue from '../services/extractMemories/extractMemories.js'
|
||||||
import { initMagicDocs } from '../services/MagicDocs/magicDocs.js'
|
import { initMagicDocs } from '../services/MagicDocs/magicDocs.js'
|
||||||
import { initSkillImprovement } from './hooks/skillImprovement.js'
|
import { initSkillImprovement } from './hooks/skillImprovement.js'
|
||||||
|
|
||||||
/* eslint-disable @typescript-eslint/no-require-imports */
|
/* eslint-disable @typescript-eslint/no-require-imports */
|
||||||
const extractMemoriesModule = feature('EXTRACT_MEMORIES')
|
const extractMemoriesModule = feature('EXTRACT_MEMORIES')
|
||||||
? (require('../services/extractMemories/extractMemories.js') as typeof import('../services/extractMemories/extractMemories.js'))
|
? extractMemoriesModuleValue
|
||||||
: null
|
: null
|
||||||
const registerProtocolModule = feature('LODESTONE')
|
const registerProtocolModule = feature('LODESTONE')
|
||||||
? (require('./deepLink/registerProtocol.js') as typeof import('./deepLink/registerProtocol.js'))
|
? (require('./deepLink/registerProtocol.js') as typeof import('./deepLink/registerProtocol.js'))
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,11 @@ import type { UUID } from 'crypto'
|
||||||
import { relative } from 'path'
|
import { relative } from 'path'
|
||||||
import { getCwd } from 'src/utils/cwd.js'
|
import { getCwd } from 'src/utils/cwd.js'
|
||||||
import { addInvokedSkill } from '../bootstrap/state.js'
|
import { addInvokedSkill } from '../bootstrap/state.js'
|
||||||
|
import {
|
||||||
|
BRIEF_TOOL_NAME as BRIEF_TOOL_NAME_VALUE,
|
||||||
|
LEGACY_BRIEF_TOOL_NAME as LEGACY_BRIEF_TOOL_NAME_VALUE,
|
||||||
|
} from '../tools/BriefTool/prompt.js'
|
||||||
|
import { SEND_USER_FILE_TOOL_NAME as SEND_USER_FILE_TOOL_NAME_VALUE } from '../tools/SendUserFileTool/prompt.js'
|
||||||
import { asSessionId } from '../types/ids.js'
|
import { asSessionId } from '../types/ids.js'
|
||||||
import type {
|
import type {
|
||||||
AttributionSnapshotMessage,
|
AttributionSnapshotMessage,
|
||||||
|
|
@ -49,27 +54,17 @@ import {
|
||||||
} from './sessionStorage.js'
|
} from './sessionStorage.js'
|
||||||
import type { ContentReplacementRecord } from './toolResultStorage.js'
|
import type { ContentReplacementRecord } from './toolResultStorage.js'
|
||||||
|
|
||||||
// Dead code elimination: ant-only tool names are conditionally required so
|
|
||||||
// their strings don't leak into external builds. Static imports always bundle.
|
|
||||||
/* eslint-disable @typescript-eslint/no-require-imports */
|
|
||||||
const BRIEF_TOOL_NAME: string | null =
|
const BRIEF_TOOL_NAME: string | null =
|
||||||
feature('KAIROS') || feature('KAIROS_BRIEF')
|
feature('KAIROS') || feature('KAIROS_BRIEF')
|
||||||
? (
|
? BRIEF_TOOL_NAME_VALUE
|
||||||
require('../tools/BriefTool/prompt.js') as typeof import('../tools/BriefTool/prompt.js')
|
|
||||||
).BRIEF_TOOL_NAME
|
|
||||||
: null
|
: null
|
||||||
const LEGACY_BRIEF_TOOL_NAME: string | null =
|
const LEGACY_BRIEF_TOOL_NAME: string | null =
|
||||||
feature('KAIROS') || feature('KAIROS_BRIEF')
|
feature('KAIROS') || feature('KAIROS_BRIEF')
|
||||||
? (
|
? LEGACY_BRIEF_TOOL_NAME_VALUE
|
||||||
require('../tools/BriefTool/prompt.js') as typeof import('../tools/BriefTool/prompt.js')
|
|
||||||
).LEGACY_BRIEF_TOOL_NAME
|
|
||||||
: null
|
: null
|
||||||
const SEND_USER_FILE_TOOL_NAME: string | null = feature('KAIROS')
|
const SEND_USER_FILE_TOOL_NAME: string | null = feature('KAIROS')
|
||||||
? (
|
? SEND_USER_FILE_TOOL_NAME_VALUE
|
||||||
require('../tools/SendUserFileTool/prompt.js') as typeof import('../tools/SendUserFileTool/prompt.js')
|
|
||||||
).SEND_USER_FILE_TOOL_NAME
|
|
||||||
: null
|
: null
|
||||||
/* eslint-enable @typescript-eslint/no-require-imports */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Transforms legacy attachment types to current types for backward compatibility
|
* Transforms legacy attachment types to current types for backward compatibility
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ import { TEAM_CREATE_TOOL_NAME } from '../../tools/TeamCreateTool/constants.js'
|
||||||
import { TEAM_DELETE_TOOL_NAME } from '../../tools/TeamDeleteTool/constants.js'
|
import { TEAM_DELETE_TOOL_NAME } from '../../tools/TeamDeleteTool/constants.js'
|
||||||
import { TODO_WRITE_TOOL_NAME } from '../../tools/TodoWriteTool/constants.js'
|
import { TODO_WRITE_TOOL_NAME } from '../../tools/TodoWriteTool/constants.js'
|
||||||
import { TOOL_SEARCH_TOOL_NAME } from '../../tools/ToolSearchTool/prompt.js'
|
import { TOOL_SEARCH_TOOL_NAME } from '../../tools/ToolSearchTool/prompt.js'
|
||||||
|
import { WORKFLOW_TOOL_NAME as WORKFLOW_TOOL_NAME_VALUE } from '../../tools/WorkflowTool/constants.js'
|
||||||
import { YOLO_CLASSIFIER_TOOL_NAME } from './yoloClassifier.js'
|
import { YOLO_CLASSIFIER_TOOL_NAME } from './yoloClassifier.js'
|
||||||
|
|
||||||
// Ant-only tool names: conditional require so Bun can DCE these in external builds.
|
// Ant-only tool names: conditional require so Bun can DCE these in external builds.
|
||||||
|
|
@ -41,9 +42,7 @@ const VERIFY_PLAN_EXECUTION_TOOL_NAME =
|
||||||
).VERIFY_PLAN_EXECUTION_TOOL_NAME
|
).VERIFY_PLAN_EXECUTION_TOOL_NAME
|
||||||
: null
|
: null
|
||||||
const WORKFLOW_TOOL_NAME = feature('WORKFLOW_SCRIPTS')
|
const WORKFLOW_TOOL_NAME = feature('WORKFLOW_SCRIPTS')
|
||||||
? (
|
? WORKFLOW_TOOL_NAME_VALUE
|
||||||
require('../../tools/WorkflowTool/constants.js') as typeof import('../../tools/WorkflowTool/constants.js')
|
|
||||||
).WORKFLOW_TOOL_NAME
|
|
||||||
: null
|
: null
|
||||||
/* eslint-enable @typescript-eslint/no-require-imports */
|
/* eslint-enable @typescript-eslint/no-require-imports */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,19 +1,14 @@
|
||||||
import { feature } from 'bun:bundle'
|
import { feature } from 'bun:bundle'
|
||||||
import { AGENT_TOOL_NAME } from '../../tools/AgentTool/constants.js'
|
import { AGENT_TOOL_NAME } from '../../tools/AgentTool/constants.js'
|
||||||
|
import { BRIEF_TOOL_NAME as BRIEF_TOOL_NAME_VALUE } from '../../tools/BriefTool/prompt.js'
|
||||||
import { TASK_OUTPUT_TOOL_NAME } from '../../tools/TaskOutputTool/constants.js'
|
import { TASK_OUTPUT_TOOL_NAME } from '../../tools/TaskOutputTool/constants.js'
|
||||||
import { TASK_STOP_TOOL_NAME } from '../../tools/TaskStopTool/prompt.js'
|
import { TASK_STOP_TOOL_NAME } from '../../tools/TaskStopTool/prompt.js'
|
||||||
import type { PermissionRuleValue } from './PermissionRule.js'
|
import type { PermissionRuleValue } from './PermissionRule.js'
|
||||||
|
|
||||||
// Dead code elimination: ant-only tool names are conditionally required so
|
|
||||||
// their strings don't leak into external builds. Static imports always bundle.
|
|
||||||
/* eslint-disable @typescript-eslint/no-require-imports */
|
|
||||||
const BRIEF_TOOL_NAME: string | null =
|
const BRIEF_TOOL_NAME: string | null =
|
||||||
feature('KAIROS') || feature('KAIROS_BRIEF')
|
feature('KAIROS') || feature('KAIROS_BRIEF')
|
||||||
? (
|
? BRIEF_TOOL_NAME_VALUE
|
||||||
require('../../tools/BriefTool/prompt.js') as typeof import('../../tools/BriefTool/prompt.js')
|
|
||||||
).BRIEF_TOOL_NAME
|
|
||||||
: null
|
: null
|
||||||
/* eslint-enable @typescript-eslint/no-require-imports */
|
|
||||||
|
|
||||||
// Maps legacy tool names to their current canonical names.
|
// Maps legacy tool names to their current canonical names.
|
||||||
// When a tool is renamed, add old → new here so permission rules,
|
// When a tool is renamed, add old → new here so permission rules,
|
||||||
|
|
|
||||||
|
|
@ -27,10 +27,10 @@ import {
|
||||||
} from './PermissionMode.js'
|
} from './PermissionMode.js'
|
||||||
import { applyPermissionRulesToPermissionContext } from './permissions.js'
|
import { applyPermissionRulesToPermissionContext } from './permissions.js'
|
||||||
import { loadAllPermissionRulesFromDisk } from './permissionsLoader.js'
|
import { loadAllPermissionRulesFromDisk } from './permissionsLoader.js'
|
||||||
|
import * as autoModeStateModuleValue from './autoModeState.js'
|
||||||
|
|
||||||
/* eslint-disable @typescript-eslint/no-require-imports */
|
|
||||||
const autoModeStateModule = feature('TRANSCRIPT_CLASSIFIER')
|
const autoModeStateModule = feature('TRANSCRIPT_CLASSIFIER')
|
||||||
? (require('./autoModeState.js') as typeof import('./autoModeState.js'))
|
? autoModeStateModuleValue
|
||||||
: null
|
: null
|
||||||
|
|
||||||
import { resolve } from 'path'
|
import { resolve } from 'path'
|
||||||
|
|
|
||||||
|
|
@ -54,13 +54,14 @@ import {
|
||||||
type PermissionRuleFromEditableSettings,
|
type PermissionRuleFromEditableSettings,
|
||||||
shouldAllowManagedPermissionRulesOnly,
|
shouldAllowManagedPermissionRulesOnly,
|
||||||
} from './permissionsLoader.js'
|
} from './permissionsLoader.js'
|
||||||
|
import * as autoModeStateModuleValue from './autoModeState.js'
|
||||||
|
import * as classifierDecisionModuleValue from './classifierDecision.js'
|
||||||
|
|
||||||
/* eslint-disable @typescript-eslint/no-require-imports */
|
|
||||||
const classifierDecisionModule = feature('TRANSCRIPT_CLASSIFIER')
|
const classifierDecisionModule = feature('TRANSCRIPT_CLASSIFIER')
|
||||||
? (require('./classifierDecision.js') as typeof import('./classifierDecision.js'))
|
? classifierDecisionModuleValue
|
||||||
: null
|
: null
|
||||||
const autoModeStateModule = feature('TRANSCRIPT_CLASSIFIER')
|
const autoModeStateModule = feature('TRANSCRIPT_CLASSIFIER')
|
||||||
? (require('./autoModeState.js') as typeof import('./autoModeState.js'))
|
? autoModeStateModuleValue
|
||||||
: null
|
: null
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
|
|
||||||
|
|
@ -43,31 +43,25 @@ import {
|
||||||
parseClassifierResponse,
|
parseClassifierResponse,
|
||||||
} from './classifierShared.js'
|
} from './classifierShared.js'
|
||||||
import { getClaudeTempDir } from './filesystem.js'
|
import { getClaudeTempDir } from './filesystem.js'
|
||||||
|
import autoModeSystemPrompt from './yolo-classifier-prompts/auto_mode_system_prompt.txt'
|
||||||
// Dead code elimination: conditional imports for auto mode classifier prompts.
|
import permissionsAnthropic from './yolo-classifier-prompts/permissions_anthropic.txt'
|
||||||
// At build time, the bundler inlines .txt files as string literals. At test
|
import permissionsExternal from './yolo-classifier-prompts/permissions_external.txt'
|
||||||
// time, require() returns {default: string} — txtRequire normalizes both.
|
|
||||||
/* eslint-disable custom-rules/no-process-env-top-level, @typescript-eslint/no-require-imports */
|
|
||||||
function txtRequire(mod: string | { default: string }): string {
|
|
||||||
return typeof mod === 'string' ? mod : mod.default
|
|
||||||
}
|
|
||||||
|
|
||||||
const BASE_PROMPT: string = feature('TRANSCRIPT_CLASSIFIER')
|
const BASE_PROMPT: string = feature('TRANSCRIPT_CLASSIFIER')
|
||||||
? txtRequire(require('./yolo-classifier-prompts/auto_mode_system_prompt.txt'))
|
? autoModeSystemPrompt
|
||||||
: ''
|
: ''
|
||||||
|
|
||||||
// External template is loaded separately so it's available for
|
// External template is loaded separately so it's available for
|
||||||
// `claude auto-mode defaults` even in ant builds. Ant builds use
|
// `claude auto-mode defaults` even in ant builds. Ant builds use
|
||||||
// permissions_anthropic.txt at runtime but should dump external defaults.
|
// permissions_anthropic.txt at runtime but should dump external defaults.
|
||||||
const EXTERNAL_PERMISSIONS_TEMPLATE: string = feature('TRANSCRIPT_CLASSIFIER')
|
const EXTERNAL_PERMISSIONS_TEMPLATE: string = feature('TRANSCRIPT_CLASSIFIER')
|
||||||
? txtRequire(require('./yolo-classifier-prompts/permissions_external.txt'))
|
? permissionsExternal
|
||||||
: ''
|
: ''
|
||||||
|
|
||||||
const ANTHROPIC_PERMISSIONS_TEMPLATE: string =
|
const ANTHROPIC_PERMISSIONS_TEMPLATE: string =
|
||||||
feature('TRANSCRIPT_CLASSIFIER') && process.env.USER_TYPE === 'ant'
|
feature('TRANSCRIPT_CLASSIFIER') && process.env.USER_TYPE === 'ant'
|
||||||
? txtRequire(require('./yolo-classifier-prompts/permissions_anthropic.txt'))
|
? permissionsAnthropic
|
||||||
: ''
|
: ''
|
||||||
/* eslint-enable custom-rules/no-process-env-top-level, @typescript-eslint/no-require-imports */
|
|
||||||
|
|
||||||
function isUsingExternalPermissions(): boolean {
|
function isUsingExternalPermissions(): boolean {
|
||||||
if (process.env.USER_TYPE !== 'ant') return true
|
if (process.env.USER_TYPE !== 'ant') return true
|
||||||
|
|
|
||||||
|
|
@ -8,18 +8,14 @@ import type { AgentDefinition } from '../tools/AgentTool/loadAgentsDir.js'
|
||||||
import { isBuiltInAgent } from '../tools/AgentTool/loadAgentsDir.js'
|
import { isBuiltInAgent } from '../tools/AgentTool/loadAgentsDir.js'
|
||||||
import { isEnvTruthy } from './envUtils.js'
|
import { isEnvTruthy } from './envUtils.js'
|
||||||
import { asSystemPrompt, type SystemPrompt } from './systemPromptType.js'
|
import { asSystemPrompt, type SystemPrompt } from './systemPromptType.js'
|
||||||
|
import * as proactiveModuleValue from '../proactive/index.js'
|
||||||
|
|
||||||
export { asSystemPrompt, type SystemPrompt } from './systemPromptType.js'
|
export { asSystemPrompt, type SystemPrompt } from './systemPromptType.js'
|
||||||
|
|
||||||
// Dead code elimination: conditional import for proactive mode.
|
|
||||||
// Same pattern as prompts.ts — lazy require to avoid pulling the module
|
|
||||||
// into non-proactive builds.
|
|
||||||
/* eslint-disable @typescript-eslint/no-require-imports */
|
|
||||||
const proactiveModule =
|
const proactiveModule =
|
||||||
feature('PROACTIVE') || feature('KAIROS')
|
feature('PROACTIVE') || feature('KAIROS')
|
||||||
? (require('../proactive/index.js') as typeof import('../proactive/index.js'))
|
? proactiveModuleValue
|
||||||
: null
|
: null
|
||||||
/* eslint-enable @typescript-eslint/no-require-imports */
|
|
||||||
|
|
||||||
function isProactiveActive_SAFE_TO_CALL_ANYWHERE(): boolean {
|
function isProactiveActive_SAFE_TO_CALL_ANYWHERE(): boolean {
|
||||||
return proactiveModule?.isProactiveActive() ?? false
|
return proactiveModule?.isProactiveActive() ?? false
|
||||||
|
|
|
||||||
|
|
@ -84,6 +84,9 @@ export default defineConfig({
|
||||||
copyPublicDir: false,
|
copyPublicDir: false,
|
||||||
sourcemap: false,
|
sourcemap: false,
|
||||||
minify: true,
|
minify: true,
|
||||||
|
commonjsOptions: {
|
||||||
|
transformMixedEsModules: true,
|
||||||
|
},
|
||||||
|
|
||||||
// SSR build mode — uses Rollup with Node.js target
|
// SSR build mode — uses Rollup with Node.js target
|
||||||
ssr: true,
|
ssr: true,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user