mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-15 12:55:51 +00:00
Merge pull request #413 from claude-code-best/performance/20260505/memory-leak-fix
feat: 继续进行内存泄露修复及垃圾代码清理
This commit is contained in:
8
build.ts
8
build.ts
@@ -21,7 +21,13 @@ const result = await Bun.build({
|
||||
outdir,
|
||||
target: 'bun',
|
||||
splitting: true,
|
||||
define: getMacroDefines(),
|
||||
define: {
|
||||
...getMacroDefines(),
|
||||
// React production mode — eliminates _debugStack Error objects
|
||||
// (6,889 objects × ~1.7KB = 12MB in development builds) and removes
|
||||
// prop-type / key warnings not useful in a production CLI tool.
|
||||
'process.env.NODE_ENV': JSON.stringify('production'),
|
||||
},
|
||||
features,
|
||||
})
|
||||
|
||||
|
||||
@@ -14,7 +14,12 @@ const __dirname = dirname(__filename)
|
||||
const projectRoot = join(__dirname, '..')
|
||||
const cliPath = join(projectRoot, 'src/entrypoints/cli.tsx')
|
||||
|
||||
const defines = getMacroDefines()
|
||||
const defines = {
|
||||
...getMacroDefines(),
|
||||
// React production mode — prevents 6,889+ _debugStack Error objects
|
||||
// (12MB) from accumulating during long-running sessions.
|
||||
'process.env.NODE_ENV': JSON.stringify('production'),
|
||||
}
|
||||
|
||||
const defineArgs = Object.entries(defines).flatMap(([k, v]) => [
|
||||
'-d',
|
||||
|
||||
@@ -41,11 +41,7 @@ import { type Tools, type ToolUseContext, toolMatchesName } from './Tool.js'
|
||||
import type { AgentDefinition } from '@claude-code-best/builtin-tools/tools/AgentTool/loadAgentsDir.js'
|
||||
import { SYNTHETIC_OUTPUT_TOOL_NAME } from '@claude-code-best/builtin-tools/tools/SyntheticOutputTool/SyntheticOutputTool.js'
|
||||
import type { APIError } from '@anthropic-ai/sdk'
|
||||
import type {
|
||||
CompactMetadata,
|
||||
Message,
|
||||
SystemCompactBoundaryMessage,
|
||||
} from './types/message.js'
|
||||
import type { Message, SystemCompactBoundaryMessage } from './types/message.js'
|
||||
import type { OrphanedPermission } from './types/textInputTypes.js'
|
||||
import { createAbortController } from './utils/abortController.js'
|
||||
import type { AttributionState } from './utils/commitAttribution.js'
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { feature } from 'bun:bundle'
|
||||
import { getKairosActive } from '../bootstrap/state.js'
|
||||
import { getFeatureValue_CACHED_MAY_BE_STALE } from '../services/analytics/growthbook.js'
|
||||
|
||||
/**
|
||||
|
||||
@@ -11,7 +11,6 @@ import {
|
||||
logEvent,
|
||||
logEventAsync,
|
||||
} from '../services/analytics/index.js'
|
||||
import { isInBundledMode } from '../utils/bundledMode.js'
|
||||
import { getBootstrapArgs, getScriptPath } from '../utils/cliLaunch.js'
|
||||
import { logForDebugging } from '../utils/debug.js'
|
||||
import { rcLog } from './rcDebugLog.js'
|
||||
|
||||
@@ -72,7 +72,6 @@ import type {
|
||||
SDKControlResponse,
|
||||
} from '../entrypoints/sdk/controlTypes.js'
|
||||
import type { StdoutMessage } from '../entrypoints/sdk/controlTypes.js'
|
||||
import type { SDKResultSuccess } from '../entrypoints/sdk/coreTypes.js'
|
||||
import type { PermissionMode } from '../utils/permissions/PermissionMode.js'
|
||||
import { setSessionMetadataChangedListener } from '../utils/sessionState.js'
|
||||
|
||||
|
||||
@@ -55,7 +55,6 @@ import type {
|
||||
SDKControlResponse,
|
||||
} from '../entrypoints/sdk/controlTypes.js'
|
||||
import type { StdoutMessage } from '../entrypoints/sdk/controlTypes.js'
|
||||
import type { SDKResultSuccess } from '../entrypoints/sdk/coreTypes.js'
|
||||
|
||||
/**
|
||||
* StdoutMessage with optional session_id. The transport layer accepts
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
* Companion display card — shown by /buddy (no args).
|
||||
* Mirrors official vc8 component: bordered box with sprite, stats, last reaction.
|
||||
*/
|
||||
import React from 'react';
|
||||
import { Box, Text } from '@anthropic/ink';
|
||||
import { useInput } from '@anthropic/ink';
|
||||
import { renderSprite } from './sprites.js';
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
import { stat } from 'fs/promises';
|
||||
import pMap from 'p-map';
|
||||
import { cwd } from 'process';
|
||||
import React from 'react';
|
||||
import { MCPServerDesktopImportDialog } from '../../components/MCPServerDesktopImportDialog.js';
|
||||
import { wrappedRender as render } from '@anthropic/ink';
|
||||
import { KeybindingSetup } from '../../keybindings/KeybindingProviderSetup.js';
|
||||
|
||||
@@ -112,7 +112,6 @@ import type {
|
||||
ModelInfo,
|
||||
SDKMessage,
|
||||
SDKUserMessage,
|
||||
SDKUserMessageReplay,
|
||||
PermissionResult,
|
||||
McpServerConfigForProcessTransport,
|
||||
McpServerStatus,
|
||||
@@ -5477,7 +5476,7 @@ function getStructuredIO(
|
||||
*/
|
||||
export async function handleOrphanedPermissionResponse({
|
||||
message,
|
||||
setAppState,
|
||||
setAppState: _setAppState,
|
||||
onEnqueued,
|
||||
handledToolUseIds,
|
||||
}: {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import * as React from 'react';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { useState } from 'react';
|
||||
import { resolve } from 'path';
|
||||
import { Box, Text } from '@anthropic/ink';
|
||||
import { Dialog } from '../../components/design-system/Dialog.js';
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import * as React from 'react';
|
||||
import { Settings } from '../../components/Settings/Settings.js';
|
||||
import type { LocalJSXCommandCall } from '../../types/command.js';
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import * as React from 'react';
|
||||
import type { LocalJSXCommandCall } from '../../types/command.js';
|
||||
|
||||
export const call: LocalJSXCommandCall = async (onDone, context) => {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import React from 'react';
|
||||
import { Doctor } from '../../screens/Doctor.js';
|
||||
import type { LocalJSXCommandCall } from '../../types/command.js';
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import * as React from 'react';
|
||||
import { HelpV2 } from '../../components/HelpV2/HelpV2.js';
|
||||
import type { LocalJSXCommandCall } from '../../types/command.js';
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import * as React from 'react';
|
||||
import { HooksConfigMenu } from '../../components/hooks/HooksConfigMenu.js';
|
||||
import { logEvent } from '../../services/analytics/index.js';
|
||||
import { getTools } from '../../tools.js';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { useCallback, useState } from 'react';
|
||||
import { useCallback, useState } from 'react';
|
||||
import TextInput from '../../components/TextInput.js';
|
||||
import { useTerminalSize } from '../../hooks/useTerminalSize.js';
|
||||
import { Box, color, Text, useTheme } from '@anthropic/ink';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { useCallback, useState } from 'react';
|
||||
import { useCallback, useState } from 'react';
|
||||
import TextInput from '../../components/TextInput.js';
|
||||
import { useTerminalSize } from '../../hooks/useTerminalSize.js';
|
||||
import { Box, color, Text, useTheme } from '@anthropic/ink';
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import React from 'react';
|
||||
import { Text } from '@anthropic/ink';
|
||||
|
||||
export function CheckGitHubStep() {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { useCallback, useState } from 'react';
|
||||
import { useCallback, useState } from 'react';
|
||||
import TextInput from '../../components/TextInput.js';
|
||||
import { useTerminalSize } from '../../hooks/useTerminalSize.js';
|
||||
import { Box, Text } from '@anthropic/ink';
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import React from 'react';
|
||||
import { Box, Text } from '@anthropic/ink';
|
||||
import type { Workflow } from './types.js';
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import React from 'react';
|
||||
import { GITHUB_ACTION_SETUP_DOCS_URL } from '../../constants/github-app.js';
|
||||
import { Box, Text } from '@anthropic/ink';
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import React from 'react';
|
||||
import { Select } from 'src/components/CustomSelect/index.js';
|
||||
import { Box, Text } from '@anthropic/ink';
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import figures from 'figures';
|
||||
import React from 'react';
|
||||
import { GITHUB_ACTION_SETUP_DOCS_URL } from '../../constants/github-app.js';
|
||||
import { Box, Text } from '@anthropic/ink';
|
||||
import { useKeybinding } from '../../keybindings/useKeybinding.js';
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import figures from 'figures';
|
||||
import React from 'react';
|
||||
import { GITHUB_ACTION_SETUP_DOCS_URL } from '../../constants/github-app.js';
|
||||
import { Box, Text } from '@anthropic/ink';
|
||||
import { useKeybinding } from '../../keybindings/useKeybinding.js';
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { feature } from 'bun:bundle';
|
||||
import * as React from 'react';
|
||||
import { resetCostState } from '../../bootstrap/state.js';
|
||||
import { clearTrustedDeviceToken, enrollTrustedDevice } from '../../bridge/trustedDevice.js';
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import * as React from 'react';
|
||||
import { PermissionRuleList } from '../../components/permissions/rules/PermissionRuleList.js';
|
||||
import type { LocalJSXCommandCall } from '../../types/command.js';
|
||||
import { createPermissionRetryMessage } from '../../utils/messages.js';
|
||||
|
||||
@@ -36,7 +36,7 @@ function getMergedEnv(): Record<string, string> {
|
||||
return merged
|
||||
}
|
||||
|
||||
const call: LocalCommandCall = async (args, context) => {
|
||||
const call: LocalCommandCall = async (args, _context) => {
|
||||
const arg = args.trim().toLowerCase()
|
||||
|
||||
// No argument: show current provider
|
||||
|
||||
@@ -2,7 +2,7 @@ import { type ChildProcess } from 'child_process';
|
||||
import { resolve } from 'path';
|
||||
import * as React from 'react';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { getBridgeDisabledReason, isBridgeEnabled } from '../../bridge/bridgeEnabled.js';
|
||||
import { getBridgeDisabledReason } from '../../bridge/bridgeEnabled.js';
|
||||
import { getBridgeAccessToken } from '../../bridge/bridgeConfig.js';
|
||||
import { BRIDGE_LOGIN_INSTRUCTION } from '../../bridge/types.js';
|
||||
import { Dialog } from '../../components/design-system/Dialog.js';
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import type { ContentBlockParam } from '@anthropic-ai/sdk/resources/messages.js';
|
||||
import React from 'react';
|
||||
import type { LocalJSXCommandCall, LocalJSXCommandOnDone } from '../../types/command.js';
|
||||
import { checkOverageGate, confirmOverage, launchRemoteReview } from './reviewRemote.js';
|
||||
import { UltrareviewOverageDialog } from './UltrareviewOverageDialog.js';
|
||||
|
||||
@@ -9,7 +9,6 @@ import {
|
||||
exportInstincts,
|
||||
findPromotionCandidates,
|
||||
generateSkillCandidates,
|
||||
importInstincts,
|
||||
ingestTranscript,
|
||||
listKnownProjects,
|
||||
loadInstincts,
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import * as React from 'react';
|
||||
import { Stats } from '../../components/Stats.js';
|
||||
import type { LocalJSXCommandCall } from '../../types/command.js';
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { readFileSync } from 'fs';
|
||||
import { REMOTE_CONTROL_DISCONNECTED_MSG } from '../bridge/types.js';
|
||||
import type { Command } from '../commands.js';
|
||||
import { DIAMOND_OPEN } from '../constants/figures.js';
|
||||
@@ -21,7 +20,6 @@ import { logForDebugging } from '../utils/debug.js';
|
||||
import { errorMessage } from '../utils/errors.js';
|
||||
import { logError } from '../utils/log.js';
|
||||
import { enqueuePendingNotification } from '../utils/messageQueueManager.js';
|
||||
import { ALL_MODEL_CONFIGS } from '../utils/model/configs.js';
|
||||
import { updateTaskState } from '../utils/task/framework.js';
|
||||
import { archiveRemoteSession, teleportToRemote } from '../utils/teleport.js';
|
||||
import { pollForApprovedExitPlanMode, UltraplanPollError } from '../utils/ultraplan/ccrSession.js';
|
||||
@@ -36,13 +34,6 @@ import { registerCleanup } from '../utils/cleanupRegistry.js';
|
||||
// TODO(prod-hardening): OAuth token may go stale over the 30min poll;
|
||||
// consider refresh.
|
||||
|
||||
/**
|
||||
* Multi-agent exploration is slow; 30min timeout.
|
||||
*
|
||||
* @deprecated use getUltraplanTimeoutMs()
|
||||
*/
|
||||
const ULTRAPLAN_TIMEOUT_MS = 30 * 60 * 1000;
|
||||
|
||||
export const CCR_TERMS_URL = 'https://code.claude.com/docs/en/claude-code-on-the-web';
|
||||
|
||||
export function getUltraplanTimeoutMs(): number {
|
||||
@@ -61,15 +52,6 @@ export function isUltraplanEnabled(): boolean {
|
||||
);
|
||||
}
|
||||
|
||||
// CCR runs against the first-party API — use the canonical ID, not the
|
||||
// provider-specific string getModelStrings() would return (which may be a
|
||||
// Bedrock ARN or Vertex ID on the local CLI). Read at call time, not module
|
||||
// load: the GrowthBook cache is empty at import and `/config` Gates can flip
|
||||
// it between invocations.
|
||||
function getUltraplanModel(): string {
|
||||
return getFeatureValue_CACHED_MAY_BE_STALE('tengu_ultraplan_model', ALL_MODEL_CONFIGS.opus47.firstParty);
|
||||
}
|
||||
|
||||
// prompt.txt is wrapped in <system-reminder> so the CCR browser hides
|
||||
// scaffolding (CLI_BLOCK_TAGS dropped by stripSystemNotifications)
|
||||
// while the model still sees full text.
|
||||
@@ -84,19 +66,6 @@ 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.
|
||||
// Gated to ant builds (USER_TYPE is a build-time define,
|
||||
// so the override path is DCE'd from external builds).
|
||||
// Shell-set env only, so top-level process.env read is fine
|
||||
// — settings.env never injects this.
|
||||
// @deprecated use buildUltraplanPrompt()
|
||||
/* eslint-disable custom-rules/no-process-env-top-level, custom-rules/no-sync-fs -- ant-only dev override; eager top-level read is the point (crash at startup, not silently inside the slash-command try/catch) */
|
||||
const ULTRAPLAN_INSTRUCTIONS: string =
|
||||
process.env.USER_TYPE === 'ant' && process.env.ULTRAPLAN_PROMPT_FILE
|
||||
? readFileSync(process.env.ULTRAPLAN_PROMPT_FILE, 'utf8').trimEnd()
|
||||
: DEFAULT_INSTRUCTIONS;
|
||||
/* eslint-enable custom-rules/no-process-env-top-level, custom-rules/no-sync-fs */
|
||||
|
||||
/**
|
||||
* Assemble the initial CCR user message. seedPlan and blurb stay outside the
|
||||
* system-reminder so the browser renders them; scaffolding is hidden.
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import * as React from 'react';
|
||||
import { Settings } from '../../components/Settings/Settings.js';
|
||||
import type { LocalJSXCommandCall } from '../../types/command.js';
|
||||
|
||||
|
||||
@@ -1,151 +0,0 @@
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { formatCost } from '../cost-tracker.js';
|
||||
import { Box, Text, ProgressBar } from '@anthropic/ink';
|
||||
import { formatTokens } from '../utils/format.js';
|
||||
import { useTerminalSize } from '../hooks/useTerminalSize.js';
|
||||
|
||||
type RateLimitBucket = {
|
||||
utilization: number;
|
||||
resets_at: number;
|
||||
};
|
||||
|
||||
type BuiltinStatusLineProps = {
|
||||
modelName: string;
|
||||
contextUsedPct: number;
|
||||
usedTokens: number;
|
||||
contextWindowSize: number;
|
||||
totalCostUsd: number;
|
||||
rateLimits: {
|
||||
five_hour?: RateLimitBucket;
|
||||
seven_day?: RateLimitBucket;
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Format a countdown from now until the given epoch time (in seconds).
|
||||
* Returns a compact human-readable string like "3h12m", "5d20h", "45m", or "now".
|
||||
*/
|
||||
export function formatCountdown(epochSeconds: number): string {
|
||||
const diff = epochSeconds - Date.now() / 1000;
|
||||
if (diff <= 0) return 'now';
|
||||
|
||||
const days = Math.floor(diff / 86400);
|
||||
const hours = Math.floor((diff % 86400) / 3600);
|
||||
const minutes = Math.floor((diff % 3600) / 60);
|
||||
|
||||
if (days >= 1) return `${days}d${hours}h`;
|
||||
if (hours >= 1) return `${hours}h${minutes}m`;
|
||||
return `${minutes}m`;
|
||||
}
|
||||
|
||||
function Separator() {
|
||||
return <Text dimColor>{' \u2502 '}</Text>;
|
||||
}
|
||||
|
||||
function BuiltinStatusLineInner({
|
||||
modelName,
|
||||
contextUsedPct,
|
||||
usedTokens,
|
||||
contextWindowSize,
|
||||
totalCostUsd,
|
||||
rateLimits,
|
||||
}: BuiltinStatusLineProps) {
|
||||
const { columns } = useTerminalSize();
|
||||
|
||||
// Force re-render every 60s so countdowns stay current
|
||||
const [tick, setTick] = useState(0);
|
||||
useEffect(() => {
|
||||
const hasResetTime = (rateLimits.five_hour?.resets_at ?? 0) || (rateLimits.seven_day?.resets_at ?? 0);
|
||||
if (!hasResetTime) return;
|
||||
const id = setInterval(() => setTick(t => t + 1), 60_000);
|
||||
return () => clearInterval(id);
|
||||
}, [rateLimits.five_hour?.resets_at, rateLimits.seven_day?.resets_at]);
|
||||
|
||||
// Suppress unused-variable lint for tick (it exists only to trigger re-renders)
|
||||
void tick;
|
||||
|
||||
// Model display: use first two words (e.g. "Opus 4.6") instead of just first word
|
||||
const modelParts = modelName.split(' ');
|
||||
const shortModel = modelParts.length >= 2 ? `${modelParts[0]} ${modelParts[1]}` : modelName;
|
||||
|
||||
const wide = columns >= 100;
|
||||
const narrow = columns < 60;
|
||||
|
||||
const hasFiveHour = rateLimits.five_hour != null;
|
||||
const hasSevenDay = rateLimits.seven_day != null;
|
||||
|
||||
const fiveHourPct = hasFiveHour ? Math.round(rateLimits.five_hour!.utilization * 100) : 0;
|
||||
const sevenDayPct = hasSevenDay ? Math.round(rateLimits.seven_day!.utilization * 100) : 0;
|
||||
|
||||
// Token display: "50k/1M"
|
||||
const tokenDisplay = `${formatTokens(usedTokens)}/${formatTokens(contextWindowSize)}`;
|
||||
|
||||
return (
|
||||
<Box>
|
||||
{/* Model name */}
|
||||
<Text>{shortModel}</Text>
|
||||
|
||||
{/* Context usage with token counts */}
|
||||
<Separator />
|
||||
<Text dimColor>Context </Text>
|
||||
<Text>{contextUsedPct}%</Text>
|
||||
{!narrow && <Text dimColor> ({tokenDisplay})</Text>}
|
||||
|
||||
{/* 5-hour session rate limit */}
|
||||
{hasFiveHour && (
|
||||
<>
|
||||
<Separator />
|
||||
<Text dimColor>Session </Text>
|
||||
{wide && (
|
||||
<>
|
||||
<ProgressBar
|
||||
ratio={rateLimits.five_hour!.utilization}
|
||||
width={10}
|
||||
fillColor="rate_limit_fill"
|
||||
emptyColor="rate_limit_empty"
|
||||
/>
|
||||
<Text> </Text>
|
||||
</>
|
||||
)}
|
||||
<Text>{fiveHourPct}%</Text>
|
||||
{!narrow && rateLimits.five_hour!.resets_at > 0 && (
|
||||
<Text dimColor> {formatCountdown(rateLimits.five_hour!.resets_at)}</Text>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
|
||||
{/* 7-day weekly rate limit */}
|
||||
{hasSevenDay && (
|
||||
<>
|
||||
<Separator />
|
||||
<Text dimColor>Weekly </Text>
|
||||
{wide && (
|
||||
<>
|
||||
<ProgressBar
|
||||
ratio={rateLimits.seven_day!.utilization}
|
||||
width={10}
|
||||
fillColor="rate_limit_fill"
|
||||
emptyColor="rate_limit_empty"
|
||||
/>
|
||||
<Text> </Text>
|
||||
</>
|
||||
)}
|
||||
<Text>{sevenDayPct}%</Text>
|
||||
{!narrow && rateLimits.seven_day!.resets_at > 0 && (
|
||||
<Text dimColor> {formatCountdown(rateLimits.seven_day!.resets_at)}</Text>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
|
||||
{/* Cost */}
|
||||
{totalCostUsd > 0 && (
|
||||
<>
|
||||
<Separator />
|
||||
<Text>{formatCost(totalCostUsd)}</Text>
|
||||
</>
|
||||
)}
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
||||
export const BuiltinStatusLine = React.memo(BuiltinStatusLineInner);
|
||||
@@ -11,12 +11,12 @@ import { getSSLErrorHint } from '@ant/model-provider';
|
||||
import { sendNotification } from '../services/notifier.js';
|
||||
import { OAuthService } from '../services/oauth/index.js';
|
||||
import { getOauthAccountInfo, validateForceLoginOrg } from '../utils/auth.js';
|
||||
|
||||
import { logError } from '../utils/log.js';
|
||||
import { getSettings_DEPRECATED, updateSettingsForSource } from '../utils/settings/settings.js';
|
||||
import { Select } from './CustomSelect/select.js';
|
||||
import { Spinner } from './Spinner.js';
|
||||
import TextInput from './TextInput.js';
|
||||
import { fi } from 'zod/v4/locales';
|
||||
|
||||
type Props = {
|
||||
onDone(): void;
|
||||
@@ -596,7 +596,7 @@ function OAuthStatusMessage({
|
||||
[activeField, baseUrl, apiKey, haikuModel, sonnetModel, opusModel],
|
||||
);
|
||||
|
||||
const switchTo = useCallback(
|
||||
const _switchTo = useCallback(
|
||||
(target: Field) => {
|
||||
setOAuthStatus(buildState(activeField, inputValue, target));
|
||||
setInputValue(displayValues[target] ?? '');
|
||||
|
||||
@@ -12,7 +12,7 @@ type Props = {
|
||||
};
|
||||
|
||||
export function FileEditToolUpdatedMessage({
|
||||
filePath,
|
||||
filePath: _filePath,
|
||||
structuredPatch,
|
||||
style,
|
||||
verbose,
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import * as React from 'react';
|
||||
import { type ReactNode, useEffect } from 'react';
|
||||
import { useMainLoopModel } from '../../hooks/useMainLoopModel.js';
|
||||
import { useTerminalSize } from '../../hooks/useTerminalSize.js';
|
||||
|
||||
@@ -63,7 +63,6 @@ import {
|
||||
incrementOverageCreditUpsellSeenCount,
|
||||
createOverageCreditFeed,
|
||||
} from './OverageCreditUpsell.js';
|
||||
import { plural } from '../../utils/stringUtils.js';
|
||||
import { useAppState } from '../../state/AppState.js';
|
||||
import { getEffortSuffix } from '../../utils/effort.js';
|
||||
import { useMainLoopModel } from '../../hooks/useMainLoopModel.js';
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import figures from 'figures';
|
||||
import { homedir } from 'os';
|
||||
import * as React from 'react';
|
||||
import { Box, Text } from '@anthropic/ink';
|
||||
import type { Step } from '../../projectOnboardingState.js';
|
||||
import { formatCreditAmount, getCachedReferrerReward } from '../../services/api/referral.js';
|
||||
|
||||
@@ -111,7 +111,7 @@ export function Onboarding({ onDone }: Props): React.ReactNode {
|
||||
</Box>
|
||||
);
|
||||
|
||||
const preflightStep = <PreflightStep onSuccess={goToNextStep} />;
|
||||
const _preflightStep = <PreflightStep onSuccess={goToNextStep} />;
|
||||
// Create the steps array - determine which steps to include based on reAuth and oauthEnabled
|
||||
const apiKeyNeedingApproval = useMemo(() => {
|
||||
// Add API key step if needed
|
||||
|
||||
@@ -24,7 +24,6 @@ import { setEnvHookNotifier } from '../../utils/hooks/fileChangedWatcher.js';
|
||||
import { toIDEDisplayName } from '../../utils/ide.js';
|
||||
import { getMessagesAfterCompactBoundary } from '../../utils/messages.js';
|
||||
import { tokenCountFromLastAPIResponse } from '../../utils/tokens.js';
|
||||
import { AutoUpdaterWrapper } from '../AutoUpdaterWrapper.js';
|
||||
import { ConfigurableShortcutHint } from '../ConfigurableShortcutHint.js';
|
||||
import { IdeStatusIndicator } from '../IdeStatusIndicator.js';
|
||||
import { MemoryUsageIndicator } from '../MemoryUsageIndicator.js';
|
||||
@@ -57,13 +56,13 @@ type Props = {
|
||||
|
||||
export function Notifications({
|
||||
apiKeyStatus,
|
||||
autoUpdaterResult,
|
||||
autoUpdaterResult: _autoUpdaterResult,
|
||||
debug,
|
||||
isAutoUpdating,
|
||||
isAutoUpdating: _isAutoUpdating,
|
||||
verbose,
|
||||
messages,
|
||||
onAutoUpdaterResult,
|
||||
onChangeIsUpdating,
|
||||
onAutoUpdaterResult: _onAutoUpdaterResult,
|
||||
onChangeIsUpdating: _onChangeIsUpdating,
|
||||
ideSelection,
|
||||
mcpClients,
|
||||
isInputWrapped = false,
|
||||
@@ -102,9 +101,6 @@ export function Notifications({
|
||||
const shouldShowIdeSelection =
|
||||
ideStatus === 'connected' && (ideSelection?.filePath || (ideSelection?.text && ideSelection.lineCount > 0));
|
||||
|
||||
// Hide update installed message when showing IDE selection
|
||||
const shouldShowAutoUpdater = !shouldShowIdeSelection || isAutoUpdating || autoUpdaterResult?.status !== 'success';
|
||||
|
||||
// Check if we're in overage mode for UI indicators
|
||||
const isInOverageMode = claudeAiLimits.isUsingOverage;
|
||||
const subscriptionType = getSubscriptionType();
|
||||
@@ -157,12 +153,6 @@ export function Notifications({
|
||||
verbose={verbose}
|
||||
tokenUsage={tokenUsage}
|
||||
mainLoopModel={mainLoopModel}
|
||||
shouldShowAutoUpdater={shouldShowAutoUpdater}
|
||||
autoUpdaterResult={autoUpdaterResult}
|
||||
isAutoUpdating={isAutoUpdating}
|
||||
isShowingCompactMessage={isShowingCompactMessage}
|
||||
onAutoUpdaterResult={onAutoUpdaterResult}
|
||||
onChangeIsUpdating={onChangeIsUpdating}
|
||||
/>
|
||||
</Box>
|
||||
</SentryErrorBoundary>
|
||||
@@ -180,12 +170,6 @@ function NotificationContent({
|
||||
verbose,
|
||||
tokenUsage,
|
||||
mainLoopModel,
|
||||
shouldShowAutoUpdater,
|
||||
autoUpdaterResult,
|
||||
isAutoUpdating,
|
||||
isShowingCompactMessage,
|
||||
onAutoUpdaterResult,
|
||||
onChangeIsUpdating,
|
||||
}: {
|
||||
ideSelection: IDESelection | undefined;
|
||||
mcpClients?: MCPServerConnection[];
|
||||
@@ -200,12 +184,6 @@ function NotificationContent({
|
||||
verbose: boolean;
|
||||
tokenUsage: number;
|
||||
mainLoopModel: string;
|
||||
shouldShowAutoUpdater: boolean;
|
||||
autoUpdaterResult: AutoUpdaterResult | null;
|
||||
isAutoUpdating: boolean;
|
||||
isShowingCompactMessage: boolean;
|
||||
onAutoUpdaterResult: (result: AutoUpdaterResult) => void;
|
||||
onChangeIsUpdating: (isUpdating: boolean) => void;
|
||||
}): ReactNode {
|
||||
// Poll apiKeyHelper inflight state to show slow-helper notice.
|
||||
// Gated on configuration — most users never set apiKeyHelper, so the
|
||||
|
||||
@@ -55,7 +55,6 @@ import {
|
||||
} from '@claude-code-best/builtin-tools/tools/AgentTool/agentColorManager.js';
|
||||
import type { AgentDefinition } from '@claude-code-best/builtin-tools/tools/AgentTool/loadAgentsDir.js';
|
||||
import type { Message } from '../../types/message.js';
|
||||
import type { PermissionMode } from '../../types/permissions.js';
|
||||
import type { BaseTextInputProps, PromptInputMode, VimMode } from '../../types/textInputTypes.js';
|
||||
import { isAgentSwarmsEnabled } from '../../utils/agentSwarmsEnabled.js';
|
||||
import { count } from '../../utils/array.js';
|
||||
@@ -329,7 +328,7 @@ function PromptInput({
|
||||
const hasTungstenSession = useAppState(s => process.env.USER_TYPE === 'ant' && s.tungstenActiveSession !== undefined);
|
||||
const tmuxFooterVisible = process.env.USER_TYPE === 'ant' && hasTungstenSession;
|
||||
// WebBrowser pill — visible when a browser is open
|
||||
const bagelFooterVisible = useAppState(s => false);
|
||||
const bagelFooterVisible = useAppState(_s => false);
|
||||
const teamContext = useAppState(s => s.teamContext);
|
||||
const queuedCommands = useCommandQueue();
|
||||
const promptSuggestionState = useAppState(s => s.promptSuggestion);
|
||||
@@ -538,7 +537,7 @@ function PromptInput({
|
||||
|
||||
const tasksSelected = footerItemSelected === 'tasks';
|
||||
const tmuxSelected = footerItemSelected === 'tmux';
|
||||
const bagelSelected = footerItemSelected === 'bagel';
|
||||
const _bagelSelected = footerItemSelected === 'bagel';
|
||||
const teamsSelected = footerItemSelected === 'teams';
|
||||
const bridgeSelected = footerItemSelected === 'bridge';
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { feature } from 'bun:bundle';
|
||||
import * as React from 'react';
|
||||
import { memo, type ReactNode, useCallback, useMemo, useRef, useState } from 'react';
|
||||
import { memo, type ReactNode, useMemo, useRef, useState } from 'react';
|
||||
import { isBridgeEnabled } from '../../bridge/bridgeEnabled.js';
|
||||
import { getBridgeStatus } from '../../bridge/bridgeStatusUtil.js';
|
||||
import { useSetPromptOverlay } from '../../context/promptOverlayContext.js';
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import * as React from 'react';
|
||||
import { memo, type ReactNode } from 'react';
|
||||
import { useTerminalSize } from '../../hooks/useTerminalSize.js';
|
||||
import { Box, Text, stringWidth } from '@anthropic/ink';
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import * as React from 'react';
|
||||
import { type ReactNode, useEffect, useRef, useState } from 'react';
|
||||
import { Box, Text } from '@anthropic/ink';
|
||||
import { useShortcutDisplay } from '../../keybindings/useShortcutDisplay.js';
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import * as React from 'react';
|
||||
import { type ReactNode, useEffect, useState } from 'react';
|
||||
import { Box, Text } from '@anthropic/ink';
|
||||
import type { SandboxViolationEvent } from '../utils/sandbox/sandbox-adapter.js';
|
||||
|
||||
@@ -15,14 +15,11 @@ import {
|
||||
} from '../../utils/config.js';
|
||||
import chalk from 'chalk';
|
||||
import {
|
||||
permissionModeTitle,
|
||||
permissionModeShortTitle,
|
||||
permissionModeFromString,
|
||||
toExternalPermissionMode,
|
||||
isExternalPermissionMode,
|
||||
EXTERNAL_PERMISSION_MODES,
|
||||
PERMISSION_MODES,
|
||||
type ExternalPermissionMode,
|
||||
type PermissionMode,
|
||||
} from '../../utils/permissions/PermissionMode.js';
|
||||
import {
|
||||
|
||||
@@ -9,7 +9,7 @@ import { getFeatureValue_CACHED_MAY_BE_STALE } from '../services/analytics/growt
|
||||
import { isEnvTruthy } from '../utils/envUtils.js';
|
||||
import { count } from '../utils/array.js';
|
||||
import sample from 'lodash-es/sample.js';
|
||||
import { formatDuration, formatNumber, formatSecondsShort } from '../utils/format.js';
|
||||
import { formatDuration, formatNumber } from '../utils/format.js';
|
||||
import type { Theme } from 'src/utils/theme.js';
|
||||
import { activityManager } from '../utils/activityManager.js';
|
||||
import { getSpinnerVerbs } from '../constants/spinnerVerbs.js';
|
||||
@@ -244,7 +244,7 @@ function SpinnerWithVerbInner({
|
||||
|
||||
// TTFT display is gated to internal builds — apiMetricsRef was removed from
|
||||
// props during a refactor, so skip this until it's re-threaded.
|
||||
let ttftText: string | null = null;
|
||||
const _ttftText: string | null = null;
|
||||
|
||||
// When leader is idle but teammates are running (and we're viewing the leader),
|
||||
// show a static dim idle display instead of the animated spinner — otherwise
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { type ReactNode } from 'react';
|
||||
import { type ReactNode } from 'react';
|
||||
import { isAutoMemoryEnabled } from '../../../memdir/paths.js';
|
||||
import type { Tools } from '../../../Tool.js';
|
||||
import type { AgentDefinition } from '@claude-code-best/builtin-tools/tools/AgentTool/loadAgentsDir.js';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { type ReactNode } from 'react';
|
||||
import { type ReactNode } from 'react';
|
||||
import { Box, Byline, KeyboardShortcutHint } from '@anthropic/ink';
|
||||
import { useKeybinding } from '../../../../keybindings/useKeybinding.js';
|
||||
import type { AgentColorName } from '@claude-code-best/builtin-tools/tools/AgentTool/agentColorManager.js';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { type ReactNode } from 'react';
|
||||
import { type ReactNode } from 'react';
|
||||
import { type KeyboardEvent, Box, Byline, KeyboardShortcutHint, Text } from '@anthropic/ink';
|
||||
import { useKeybinding } from '../../../../keybindings/useKeybinding.js';
|
||||
import { isAutoMemoryEnabled } from '../../../../memdir/paths.js';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import chalk from 'chalk';
|
||||
import React, { type ReactNode, useCallback, useState } from 'react';
|
||||
import { type ReactNode, useCallback, useState } from 'react';
|
||||
import {
|
||||
type AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS,
|
||||
logEvent,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { type ReactNode, useCallback, useState } from 'react';
|
||||
import { type ReactNode, useCallback, useState } from 'react';
|
||||
import { Box, Byline, KeyboardShortcutHint, Text } from '@anthropic/ink';
|
||||
import { useKeybinding } from '../../../../keybindings/useKeybinding.js';
|
||||
import { editPromptInEditor } from '../../../../utils/promptEditor.js';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { APIUserAbortError } from '@anthropic-ai/sdk';
|
||||
import React, { type ReactNode, useCallback, useRef, useState } from 'react';
|
||||
import { type ReactNode, useCallback, useRef, useState } from 'react';
|
||||
import { useMainLoopModel } from '../../../../hooks/useMainLoopModel.js';
|
||||
import { Box, Byline, Text } from '@anthropic/ink';
|
||||
import { useKeybinding } from '../../../../keybindings/useKeybinding.js';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { type ReactNode } from 'react';
|
||||
import { type ReactNode } from 'react';
|
||||
import { Box, Byline, KeyboardShortcutHint } from '@anthropic/ink';
|
||||
import type { SettingSource } from '../../../../utils/settings/constants.js';
|
||||
import { ConfigurableShortcutHint } from '../../../ConfigurableShortcutHint.js';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { type ReactNode } from 'react';
|
||||
import { type ReactNode } from 'react';
|
||||
import { Box, Byline, KeyboardShortcutHint } from '@anthropic/ink';
|
||||
import { useKeybinding } from '../../../../keybindings/useKeybinding.js';
|
||||
import { isAutoMemoryEnabled } from '../../../../memdir/paths.js';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { type ReactNode } from 'react';
|
||||
import { type ReactNode } from 'react';
|
||||
import { Box, Byline, KeyboardShortcutHint } from '@anthropic/ink';
|
||||
import { ConfigurableShortcutHint } from '../../../ConfigurableShortcutHint.js';
|
||||
import { Select } from '../../../CustomSelect/select.js';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { type ReactNode } from 'react';
|
||||
import { type ReactNode } from 'react';
|
||||
import { ConfigurableShortcutHint } from '../../../ConfigurableShortcutHint.js';
|
||||
import { Byline, KeyboardShortcutHint } from '@anthropic/ink';
|
||||
import { useWizard } from '../../../wizard/index.js';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { type ReactNode, useCallback, useState } from 'react';
|
||||
import { type ReactNode, useCallback, useState } from 'react';
|
||||
import { Box, Byline, KeyboardShortcutHint, Text } from '@anthropic/ink';
|
||||
import { useKeybinding } from '../../../../keybindings/useKeybinding.js';
|
||||
import { editPromptInEditor } from '../../../../utils/promptEditor.js';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { type ReactNode } from 'react';
|
||||
import { type ReactNode } from 'react';
|
||||
import type { Tools } from '../../../../Tool.js';
|
||||
import { Byline, KeyboardShortcutHint } from '@anthropic/ink';
|
||||
import { ConfigurableShortcutHint } from '../../../ConfigurableShortcutHint.js';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { type ReactNode, useState } from 'react';
|
||||
import { type ReactNode, useState } from 'react';
|
||||
import { Box, Byline, KeyboardShortcutHint, Text } from '@anthropic/ink';
|
||||
import { useKeybinding } from '../../../../keybindings/useKeybinding.js';
|
||||
import type { AgentDefinition } from '@claude-code-best/builtin-tools/tools/AgentTool/loadAgentsDir.js';
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
// Auto-generated stub — replace with real implementation
|
||||
export {}
|
||||
export const SnipBoundaryMessage: (props: Record<string, unknown>) => null =
|
||||
() => null
|
||||
@@ -1,4 +0,0 @@
|
||||
// Auto-generated stub — replace with real implementation
|
||||
export {}
|
||||
export const UserCrossSessionMessage: (props: Record<string, unknown>) => null =
|
||||
() => null
|
||||
@@ -1,5 +0,0 @@
|
||||
// Auto-generated stub — replace with real implementation
|
||||
export {}
|
||||
export const UserForkBoilerplateMessage: (
|
||||
props: Record<string, unknown>,
|
||||
) => null = () => null
|
||||
@@ -1,5 +0,0 @@
|
||||
// Auto-generated stub — replace with real implementation
|
||||
export {}
|
||||
export const UserGitHubWebhookMessage: (
|
||||
props: Record<string, unknown>,
|
||||
) => null = () => null
|
||||
@@ -1,6 +1,6 @@
|
||||
import { homedir } from 'os';
|
||||
import { basename, join, sep } from 'path';
|
||||
import React, { type ReactNode } from 'react';
|
||||
import { type ReactNode } from 'react';
|
||||
import { getOriginalCwd } from '../../../bootstrap/state.js';
|
||||
import { Text } from '@anthropic/ink';
|
||||
import { getShortcutDisplay } from '../../../keybindings/shortcutFormat.js';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { basename, sep } from 'path';
|
||||
import React, { type ReactNode } from 'react';
|
||||
import { type ReactNode } from 'react';
|
||||
import { getOriginalCwd } from '../../bootstrap/state.js';
|
||||
import { Text } from '@anthropic/ink';
|
||||
import type { PermissionUpdate } from '../../utils/permissions/PermissionUpdateSchema.js';
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import type { ReactNode } from 'react';
|
||||
import React from 'react';
|
||||
import { Text } from '@anthropic/ink';
|
||||
import type { TaskStatus } from 'src/Task.js';
|
||||
import type { LocalShellTaskState } from 'src/tasks/LocalShellTask/guards.js';
|
||||
|
||||
@@ -24,7 +24,7 @@ type Props = {
|
||||
*/
|
||||
export function WorkflowDetailDialog({
|
||||
workflow,
|
||||
onDone,
|
||||
onDone: _onDone,
|
||||
onKill,
|
||||
onSkipAgent: _onSkipAgent,
|
||||
onRetryAgent: _onRetryAgent,
|
||||
|
||||
@@ -26,13 +26,7 @@ import { IT2_COMMAND, isInsideTmuxSync } from '../../utils/swarm/backends/detect
|
||||
import { ensureBackendsRegistered, getBackendByType, getCachedBackend } from '../../utils/swarm/backends/registry.js';
|
||||
import { isPaneBackend, type PaneBackendType } from '../../utils/swarm/backends/types.js';
|
||||
import { getSwarmSocketName, TMUX_COMMAND } from '../../utils/swarm/constants.js';
|
||||
import {
|
||||
addHiddenPaneId,
|
||||
removeHiddenPaneId,
|
||||
removeMemberFromTeam,
|
||||
setMemberMode,
|
||||
setMultipleMemberModes,
|
||||
} from '../../utils/swarm/teamHelpers.js';
|
||||
import { removeMemberFromTeam, setMemberMode, setMultipleMemberModes } from '../../utils/swarm/teamHelpers.js';
|
||||
import { listTasks, type Task, unassignTeammateTasks } from '../../utils/tasks.js';
|
||||
import { getTeammateStatuses, type TeammateStatus, type TeamSummary } from '../../utils/teamDiscovery.js';
|
||||
import {
|
||||
@@ -560,13 +554,13 @@ async function toggleTeammateVisibility(teammate: TeammateStatus, teamName: stri
|
||||
* Hide a teammate pane using the backend abstraction.
|
||||
* Only available for ant users (gated for dead code elimination in external builds)
|
||||
*/
|
||||
async function hideTeammate(teammate: TeammateStatus, teamName: string): Promise<void> {}
|
||||
async function hideTeammate(_teammate: TeammateStatus, _teamName: string): Promise<void> {}
|
||||
|
||||
/**
|
||||
* Show a previously hidden teammate pane using the backend abstraction.
|
||||
* Only available for ant users (gated for dead code elimination in external builds)
|
||||
*/
|
||||
async function showTeammate(teammate: TeammateStatus, teamName: string): Promise<void> {}
|
||||
async function showTeammate(_teammate: TeammateStatus, _teamName: string): Promise<void> {}
|
||||
|
||||
/**
|
||||
* Send a mode change message to a single teammate
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { type ReactNode } from 'react';
|
||||
import { type ReactNode } from 'react';
|
||||
import type { Theme } from '../../utils/theme.js';
|
||||
import { Dialog } from '@anthropic/ink';
|
||||
import { useWizard } from './useWizard.js';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { type ReactNode } from 'react';
|
||||
import { type ReactNode } from 'react';
|
||||
import { useExitOnCtrlCDWithKeybindings } from '../../hooks/useExitOnCtrlCDWithKeybindings.js';
|
||||
import { Box, Text } from '@anthropic/ink';
|
||||
import { ConfigurableShortcutHint } from '../ConfigurableShortcutHint.js';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { createContext, type ReactNode, useCallback, useEffect, useMemo, useState } from 'react';
|
||||
import { createContext, type ReactNode, useCallback, useEffect, useMemo, useState } from 'react';
|
||||
import { useExitOnCtrlCDWithKeybindings } from '../../hooks/useExitOnCtrlCDWithKeybindings.js';
|
||||
import type { WizardContextValue, WizardProviderProps } from './types.js';
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
* Split into data/setter context pairs so writers never re-render on
|
||||
* their own writes — the setter contexts are stable.
|
||||
*/
|
||||
import React, { createContext, type ReactNode, useContext, useEffect, useState } from 'react';
|
||||
import { createContext, type ReactNode, useContext, useEffect, useState } from 'react';
|
||||
import type { SuggestionItem } from '../components/PromptInput/PromptInputFooterSuggestions.js';
|
||||
|
||||
export type PromptOverlayData = {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { type ChildProcess } from 'child_process'
|
||||
import { resolve } from 'path'
|
||||
import { buildCliLaunch, spawnCli } from '../utils/cliLaunch.js'
|
||||
import { errorMessage } from '../utils/errors.js'
|
||||
import {
|
||||
writeDaemonState,
|
||||
removeDaemonState,
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
#!/usr/bin/env bun
|
||||
// Performance shim MUST be the first import — it replaces globalThis.performance
|
||||
// with a JS-backed implementation before React/OTel capture the native reference.
|
||||
// Without this, JSC's C++ Vector grows without bound in long-running sessions.
|
||||
import '../utils/performanceShim.js';
|
||||
import { feature } from 'bun:bundle';
|
||||
import { isEnvTruthy } from '../utils/envUtils.js';
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import * as React from 'react';
|
||||
import { getOauthProfileFromApiKey } from 'src/services/oauth/getOauthProfile.js';
|
||||
import { isClaudeAISubscriber } from 'src/utils/auth.js';
|
||||
import { Text } from '@anthropic/ink';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { useEffect, useRef } from 'react';
|
||||
import { useEffect, useRef } from 'react';
|
||||
import { useNotifications } from 'src/context/notifications.js';
|
||||
import { Text } from '@anthropic/ink';
|
||||
import type { MCPServerConnection } from 'src/services/mcp/types.js';
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import * as React from 'react';
|
||||
import { useEffect } from 'react';
|
||||
import { useNotifications } from 'src/context/notifications.js';
|
||||
import { getIsRemoteMode } from '../../bootstrap/state.js';
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import * as React from 'react';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { getIsRemoteMode } from '../../bootstrap/state.js';
|
||||
import { useNotifications } from '../../context/notifications.js';
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import * as React from 'react';
|
||||
import { useEffect, useMemo } from 'react';
|
||||
import { getIsRemoteMode } from '../../bootstrap/state.js';
|
||||
import { useNotifications } from '../../context/notifications.js';
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import * as React from 'react';
|
||||
import { useEffect, useMemo, useRef, useState } from 'react';
|
||||
import { useNotifications } from 'src/context/notifications.js';
|
||||
import { Text } from '@anthropic/ink';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { useCallback, useRef, useState } from 'react';
|
||||
import { useCallback, useRef, useState } from 'react';
|
||||
import { getModeFromInput } from 'src/components/PromptInput/inputModes.js';
|
||||
import { useNotifications } from 'src/context/notifications.js';
|
||||
import { ConfigurableShortcutHint } from '../components/ConfigurableShortcutHint.js';
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import * as React from 'react';
|
||||
import { Text } from '@anthropic/ink';
|
||||
import { isClaudeAISubscriber } from '../utils/auth.js';
|
||||
import { isChromeExtensionInstalled, shouldEnableClaudeInChrome } from '../utils/claudeInChrome/setup.js';
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
import { useMemo } from 'react'
|
||||
import type { Tools, ToolPermissionContext } from '../Tool.js'
|
||||
import { assembleToolPool } from '../tools.js'
|
||||
import { useAppState } from '../state/AppState.js'
|
||||
import { mergeAndFilterTools } from '../utils/toolPool.js'
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import * as React from 'react';
|
||||
import type { Notification } from '../context/notifications.js';
|
||||
import { Text } from '@anthropic/ink';
|
||||
import { logForDebugging } from '../utils/debug.js';
|
||||
|
||||
@@ -21,10 +21,7 @@ import {
|
||||
isSessionEndMessage,
|
||||
} from '../remote/sdkMessageAdapter.js'
|
||||
import type { SSHSession } from '../ssh/createSSHSession.js'
|
||||
import type {
|
||||
SSHSessionManager,
|
||||
SSHPermissionRequest,
|
||||
} from '../ssh/SSHSessionManager.js'
|
||||
import type { SSHSessionManager } from '../ssh/SSHSessionManager.js'
|
||||
import type { Tool } from '../Tool.js'
|
||||
import { findToolByName } from '../Tool.js'
|
||||
import type { Message as MessageType } from '../types/message.js'
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import * as React from 'react';
|
||||
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
||||
import { useNotifications } from 'src/context/notifications.js';
|
||||
import { Text } from '@anthropic/ink';
|
||||
|
||||
@@ -19,11 +19,7 @@ import { isSynchronizedOutputSupported } from '@anthropic/ink';
|
||||
import type { RenderOptions, Root, TextProps } from '@anthropic/ink';
|
||||
import { KeybindingSetup } from './keybindings/KeybindingProviderSetup.js';
|
||||
import { startDeferredPrefetches } from './main.js';
|
||||
import {
|
||||
checkGate_CACHED_OR_BLOCKING,
|
||||
initializeGrowthBook,
|
||||
resetGrowthBook,
|
||||
} from './services/analytics/growthbook.js';
|
||||
import { initializeGrowthBook, resetGrowthBook } from './services/analytics/growthbook.js';
|
||||
import { isQualifiedForGrove } from './services/api/grove.js';
|
||||
import { handleMcpjsonServerApprovals } from './services/mcpServerApproval.js';
|
||||
import { AppStateProvider } from './state/AppState.js';
|
||||
|
||||
@@ -28,7 +28,6 @@ import { readFileSync } from 'fs';
|
||||
import mapValues from 'lodash-es/mapValues.js';
|
||||
import pickBy from 'lodash-es/pickBy.js';
|
||||
import uniqBy from 'lodash-es/uniqBy.js';
|
||||
import React from 'react';
|
||||
import { getOauthConfig } from './constants/oauth.js';
|
||||
import { getRemoteSessionUrl } from './constants/product.js';
|
||||
import { getSystemContext, getUserContext } from './context.js';
|
||||
@@ -383,7 +382,7 @@ function logManagedSettings(): void {
|
||||
}
|
||||
|
||||
// Check if running in debug/inspection mode
|
||||
function isBeingDebugged() {
|
||||
function _isBeingDebugged() {
|
||||
const isBun = isRunningWithBun();
|
||||
|
||||
// Check for inspect flags in process arguments (including all variants)
|
||||
|
||||
24
src/query.ts
24
src/query.ts
@@ -8,7 +8,6 @@ import { FallbackTriggeredError } from './services/api/withRetry.js'
|
||||
import {
|
||||
calculateTokenWarningState,
|
||||
estimateMaxTurnGrowth,
|
||||
getAutoCompactThreshold,
|
||||
getEffectiveContextWindowSize,
|
||||
isAutoCompactEnabled,
|
||||
type AutoCompactTrackingState,
|
||||
@@ -69,7 +68,7 @@ import {
|
||||
const skillPrefetch = feature('EXPERIMENTAL_SKILL_SEARCH')
|
||||
? (require('./services/skillSearch/prefetch.js') as typeof import('./services/skillSearch/prefetch.js'))
|
||||
: null
|
||||
const jobClassifier = feature('TEMPLATES')
|
||||
const _jobClassifier = feature('TEMPLATES')
|
||||
? (require('./jobs/classifier.js') as typeof import('./jobs/classifier.js'))
|
||||
: null
|
||||
/* eslint-enable @typescript-eslint/no-require-imports */
|
||||
@@ -124,6 +123,7 @@ import { count } from './utils/array.js'
|
||||
import {
|
||||
createTrace,
|
||||
endTrace,
|
||||
flushLangfuse,
|
||||
isLangfuseEnabled,
|
||||
} from './services/langfuse/index.js'
|
||||
import { getAPIProvider } from './utils/model/providers.js'
|
||||
@@ -339,6 +339,11 @@ export async function* query(
|
||||
terminal?.reason === 'aborted_streaming' ||
|
||||
terminal?.reason === 'aborted_tools'
|
||||
endTrace(langfuseTrace, undefined, isAborted ? 'interrupted' : undefined)
|
||||
// Flush the processor to release span data (including serialized
|
||||
// conversation history stored as langfuse.observation.input). Without
|
||||
// this, SpanImpl objects retain hundreds of KB of JSON until the
|
||||
// processor's batch timer fires (default 10s).
|
||||
await flushLangfuse()
|
||||
}
|
||||
|
||||
// Break the closure chain: toolUseContext captures langfuseTrace which
|
||||
@@ -349,6 +354,21 @@ export async function* query(
|
||||
paramsWithTrace.toolUseContext.langfuseRootTrace = null
|
||||
paramsWithTrace.toolUseContext.langfuseBatchSpan = null
|
||||
}
|
||||
|
||||
// Clear JSC's native Performance buffers. OTel (otperformance) references
|
||||
// globalThis.performance which stores marks/measures/resource timings in a
|
||||
// C++ Vector that never shrinks. Long-running sessions accumulate hundreds
|
||||
// of MB of dead capacity even after spans are flushed and nullified.
|
||||
const gPerf = globalThis.performance
|
||||
if (gPerf && typeof gPerf.clearMarks === 'function') {
|
||||
try {
|
||||
gPerf.clearMarks()
|
||||
gPerf.clearMeasures?.()
|
||||
gPerf.clearResourceTimings?.()
|
||||
} catch {
|
||||
// Non-critical — some environments may not support all methods
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Only reached if queryLoop returned normally. Skipped on throw (error
|
||||
|
||||
@@ -270,7 +270,7 @@ import { useManagePlugins } from '../hooks/useManagePlugins.js';
|
||||
import { Messages } from '../components/Messages.js';
|
||||
import { TaskListV2 } from '../components/TaskListV2.js';
|
||||
import { TeammateViewHeader } from '../components/TeammateViewHeader.js';
|
||||
import { getPipeDisplayRole, getPipeIpc, isPipeControlled } from '../utils/pipeTransport.js';
|
||||
import { getPipeIpc } from '../utils/pipeTransport.js';
|
||||
import { useTasksV2WithCollapseEffect } from '../hooks/useTasksV2.js';
|
||||
import { maybeMarkProjectOnboardingComplete } from '../projectOnboardingState.js';
|
||||
import type { MCPServerConnection } from '../services/mcp/types.js';
|
||||
@@ -808,8 +808,8 @@ export function REPL({
|
||||
pendingHookMessages,
|
||||
initialFileHistorySnapshots,
|
||||
initialContentReplacements,
|
||||
initialAgentName,
|
||||
initialAgentColor,
|
||||
initialAgentName: _initialAgentName,
|
||||
initialAgentColor: _initialAgentColor,
|
||||
mcpClients: initialMcpClients,
|
||||
dynamicMcpConfig: initialDynamicMcpConfig,
|
||||
autoConnectIdeFlag,
|
||||
@@ -2797,7 +2797,7 @@ export function REPL({
|
||||
const getToolUseContext = useCallback(
|
||||
(
|
||||
messages: MessageType[],
|
||||
newMessages: MessageType[],
|
||||
_newMessages: MessageType[],
|
||||
abortController: AbortController,
|
||||
mainLoopModel: string,
|
||||
): ProcessUserInputContext => {
|
||||
@@ -4937,7 +4937,7 @@ export function REPL({
|
||||
useMailboxBridge({ isLoading, onSubmitMessage: handleIncomingPrompt });
|
||||
useMasterMonitor();
|
||||
useSlaveNotifications();
|
||||
const pipeIpcState = useAppState(s => getPipeIpc(s as any));
|
||||
const _pipeIpcState = useAppState(s => getPipeIpc(s as any));
|
||||
|
||||
usePipePermissionForward({ store, tools, setMessages, setToolUseConfirmQueue, getToolUseContext, mainLoopModel });
|
||||
usePipeMuteSync({ setToolUseConfirmQueue });
|
||||
|
||||
@@ -32,7 +32,7 @@ import { toolInfoFromToolUse } from './bridge.js'
|
||||
export function createAcpCanUseTool(
|
||||
conn: AgentSideConnection,
|
||||
sessionId: string,
|
||||
getCurrentMode: () => string,
|
||||
_getCurrentMode: () => string,
|
||||
clientCapabilities?: ClientCapabilities,
|
||||
cwd?: string,
|
||||
onModeChange?: (modeId: string) => void,
|
||||
|
||||
@@ -121,7 +121,6 @@ import {
|
||||
getAfkModeHeaderLatched,
|
||||
getCacheEditingHeaderLatched,
|
||||
getFastModeHeaderLatched,
|
||||
getLastApiCompletionTimestamp,
|
||||
getPromptCache1hAllowlist,
|
||||
getPromptCache1hEligible,
|
||||
getSessionId,
|
||||
@@ -253,7 +252,6 @@ import {
|
||||
type NonNullableUsage,
|
||||
} from './logging.js'
|
||||
import {
|
||||
CACHE_TTL_1HOUR_MS,
|
||||
checkResponseForCacheBreak,
|
||||
recordPromptState,
|
||||
} from './promptCacheBreakDetection.js'
|
||||
|
||||
@@ -6,7 +6,7 @@ import type {
|
||||
StreamEvent,
|
||||
SystemAPIErrorMessage,
|
||||
} from '../../../types/message.js'
|
||||
import { getEmptyToolPermissionContext, type Tools } from '../../../Tool.js'
|
||||
import { type Tools } from '../../../Tool.js'
|
||||
import { toolToAPISchema } from '../../../utils/api.js'
|
||||
import { logForDebugging } from '../../../utils/debug.js'
|
||||
import {
|
||||
|
||||
@@ -2,7 +2,6 @@ import OpenAI from 'openai'
|
||||
import { openaiAdapter } from 'src/services/providerUsage/adapters/openai.js'
|
||||
import { updateProviderBuckets } from 'src/services/providerUsage/store.js'
|
||||
import { getProxyFetchOptions } from 'src/utils/proxy.js'
|
||||
import { isEnvTruthy } from 'src/utils/envUtils.js'
|
||||
|
||||
/**
|
||||
* Environment variables:
|
||||
|
||||
@@ -9,8 +9,6 @@ import type {
|
||||
} from '../../../types/message.js'
|
||||
import type { AgentId } from '../../../types/ids.js'
|
||||
import type { Tools } from '../../../Tool.js'
|
||||
import type { Stream } from 'openai/streaming.mjs'
|
||||
import type { ChatCompletionCreateParamsStreaming } from 'openai/resources/chat/completions/completions.mjs'
|
||||
import { getOpenAIClient } from './client.js'
|
||||
import {
|
||||
anthropicMessagesToOpenAI,
|
||||
|
||||
@@ -98,7 +98,7 @@ export function getToolResultsToDelete(state: CachedMCState): string[] {
|
||||
* Returns null if toolIds is empty.
|
||||
*/
|
||||
export function createCacheEditsBlock(
|
||||
state: CachedMCState,
|
||||
_state: CachedMCState,
|
||||
toolIds: string[],
|
||||
): CacheEditsBlock | null {
|
||||
if (toolIds.length === 0) return null
|
||||
|
||||
@@ -82,7 +82,7 @@ function estimateMessageTokens(message: Message): number {
|
||||
*/
|
||||
export function snipCompactIfNeeded(
|
||||
messages: Message[],
|
||||
options?: { force?: boolean },
|
||||
_options?: { force?: boolean },
|
||||
): {
|
||||
messages: Message[]
|
||||
executed: boolean
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user