Compare commits

...

2 Commits

Author SHA1 Message Date
claude-code-best
d60e0eaccb fix: 修复部分溢出的问题 2026-04-17 15:14:59 +08:00
claude-code-best
a3fa374bb3 feat: 清理掉一大堆的文件 2026-04-17 11:35:14 +08:00
646 changed files with 20 additions and 5268 deletions

View File

@@ -1,81 +0,0 @@
/** SDK 消息类型 — 与 CC CLI bridge 模块兼容 */
export interface SDKMessage {
type: string;
content?: unknown;
[key: string]: unknown;
}
export interface UserMessage extends SDKMessage {
type: "user";
content: string;
}
export interface AssistantMessage extends SDKMessage {
type: "assistant";
content: string;
}
export interface PermissionRequest extends SDKMessage {
type: "permission_request";
tool_name: string;
tool_input: unknown;
}
export interface PermissionResponse extends SDKMessage {
type: "permission_response";
approved: boolean;
request_id: string;
}
export interface ControlRequest extends SDKMessage {
type: "control_request";
action: string;
[key: string]: unknown;
}
export type SessionEventType =
| "user"
| "assistant"
| "permission_request"
| "permission_response"
| "control_request"
| "tool_use"
| "tool_result"
| "status"
| "error";
// --- Normalized Event Payloads (SSE contract) ---
export interface NormalizedEventPayload {
content: string;
raw?: unknown;
[key: string]: unknown;
}
export interface UserEventPayload extends NormalizedEventPayload {
content: string;
}
export interface AssistantEventPayload extends NormalizedEventPayload {
content: string;
}
export interface ToolUseEventPayload extends NormalizedEventPayload {
content: string;
tool_name: string;
tool_input: unknown;
}
export interface ToolResultEventPayload extends NormalizedEventPayload {
content: string;
}
export interface PermissionEventPayload extends NormalizedEventPayload {
content: string;
request_id: string;
request: {
subtype: string;
tool_name: string;
tool_input: unknown;
};
}

View File

@@ -1,107 +0,0 @@
#!/usr/bin/env bun
/**
* Verify GrowthBook gate defaults and compile-time feature flags.
*
* Usage:
* bun run scripts/verify-gates.ts
*
* This script checks that LOCAL_GATE_DEFAULTS are being returned correctly
* when GrowthBook is not connected, and that compile-time feature flags
* are properly enabled.
*/
// We can't import feature() from bun:bundle in a standalone script,
// so we test the GrowthBook layer directly.
import {
getFeatureValue_CACHED_MAY_BE_STALE,
checkStatsigFeatureGate_CACHED_MAY_BE_STALE,
} from '../src/services/analytics/growthbook.js'
interface GateCheck {
name: string
gate: string
expected: unknown
category: string
/** If set, this compile flag must also be enabled at build time */
compileFlag?: string
}
const gates: GateCheck[] = [
// P0: Pure local
{ name: 'Custom keybindings', gate: 'tengu_keybinding_customization_release', expected: true, category: 'P0' },
{ name: 'Streaming tool exec', gate: 'tengu_streaming_tool_execution2', expected: true, category: 'P0' },
{ name: 'Cron tasks', gate: 'tengu_kairos_cron', expected: true, category: 'P0' },
{ name: 'JSON tools format', gate: 'tengu_amber_json_tools', expected: true, category: 'P0' },
{ name: 'Immediate model cmd', gate: 'tengu_immediate_model_command', expected: true, category: 'P0' },
{ name: 'MCP delta', gate: 'tengu_basalt_3kr', expected: true, category: 'P0' },
{ name: 'Leaf pruning', gate: 'tengu_pebble_leaf_prune', expected: true, category: 'P0' },
{ name: 'Message smooshing', gate: 'tengu_chair_sermon', expected: true, category: 'P0' },
{ name: 'Deep link', gate: 'tengu_lodestone_enabled', expected: true, category: 'P0', compileFlag: 'LODESTONE' },
{ name: 'Auto background', gate: 'tengu_auto_background_agents', expected: true, category: 'P0' },
{ name: 'Fine-grained tools', gate: 'tengu_fgts', expected: true, category: 'P0' },
// P1: API-dependent
{ name: 'Session memory', gate: 'tengu_session_memory', expected: true, category: 'P1' },
{ name: 'Auto memory extract', gate: 'tengu_passport_quail', expected: true, category: 'P1', compileFlag: 'EXTRACT_MEMORIES' },
{ name: 'Memory skip index', gate: 'tengu_moth_copse', expected: true, category: 'P1' },
{ name: 'Memory search section', gate: 'tengu_coral_fern', expected: true, category: 'P1' },
{ name: 'Prompt suggestions', gate: 'tengu_chomp_inflection', expected: true, category: 'P1' },
{ name: 'Verification agent', gate: 'tengu_hive_evidence', expected: true, category: 'P1', compileFlag: 'VERIFICATION_AGENT' },
{ name: 'Brief mode', gate: 'tengu_kairos_brief', expected: true, category: 'P1', compileFlag: 'KAIROS_BRIEF' },
{ name: 'Away summary', gate: 'tengu_sedge_lantern', expected: true, category: 'P1', compileFlag: 'AWAY_SUMMARY' },
{ name: 'Idle return prompt', gate: 'tengu_willow_mode', expected: 'dialog', category: 'P1' },
// Kill switches
{ name: 'Ultrathink', gate: 'tengu_turtle_carbon', expected: true, category: 'KS', compileFlag: 'ULTRATHINK' },
{ name: 'Explore/Plan agents', gate: 'tengu_amber_stoat', expected: true, category: 'KS', compileFlag: 'BUILTIN_EXPLORE_PLAN_AGENTS' },
{ name: 'Agent teams', gate: 'tengu_amber_flint', expected: true, category: 'KS' },
{ name: 'Slim subagent CLAUDE.md', gate: 'tengu_slim_subagent_claudemd', expected: true, category: 'KS' },
{ name: 'Bash security', gate: 'tengu_birch_trellis', expected: true, category: 'KS' },
{ name: 'macOS clipboard', gate: 'tengu_collage_kaleidoscope', expected: true, category: 'KS' },
{ name: 'Compact cache prefix', gate: 'tengu_compact_cache_prefix', expected: true, category: 'KS' },
{ name: 'Durable cron', gate: 'tengu_kairos_cron_durable', expected: true, category: 'KS' },
{ name: 'Attribution header', gate: 'tengu_attribution_header', expected: true, category: 'KS' },
{ name: 'Agent progress', gate: 'tengu_slate_prism', expected: true, category: 'KS' },
]
console.log('=== GrowthBook Local Gate Verification ===\n')
let pass = 0
let fail = 0
for (const category of ['P0', 'P1', 'KS']) {
const label = category === 'KS' ? 'Kill Switches' : category
console.log(`--- ${label} ---`)
for (const check of gates.filter(g => g.category === category)) {
const actual = typeof check.expected === 'boolean'
? checkStatsigFeatureGate_CACHED_MAY_BE_STALE(check.gate)
: getFeatureValue_CACHED_MAY_BE_STALE(check.gate, null)
const matches = typeof check.expected === 'boolean'
? actual === check.expected
: actual === check.expected || JSON.stringify(actual) === JSON.stringify(check.expected)
const status = matches ? '\x1b[32mPASS\x1b[0m' : '\x1b[31mFAIL\x1b[0m'
const flagNote = check.compileFlag ? ` [needs feature('${check.compileFlag}')]` : ''
console.log(` ${status} ${check.name}: ${check.gate} = ${JSON.stringify(actual)}${flagNote}`)
if (matches) pass++
else fail++
}
console.log()
}
console.log(`\nResult: ${pass} passed, ${fail} failed out of ${pass + fail} gates`)
if (fail > 0) {
console.log('\n\x1b[31mSome gates are not returning expected values!\x1b[0m')
console.log('If CLAUDE_CODE_DISABLE_LOCAL_GATES=1 is set, all gates will return defaults.')
process.exit(1)
}
console.log('\n\x1b[32mAll GrowthBook gates returning expected local defaults.\x1b[0m')
console.log('\nNote: Compile-time feature() flags cannot be verified in this script.')
console.log('Use "bun run dev" and test manually for features with [needs feature()] markers.')

View File

@@ -1,3 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type HookEvent = any;
export type ModelUsage = any;

View File

@@ -1,2 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type AgentColorName = any;

View File

@@ -1,2 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type HookCallbackMatcher = any;

View File

@@ -1,2 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type SessionId = any;

View File

@@ -1,2 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type randomUUID = any;

View File

@@ -1,2 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type ModelSetting = any;

View File

@@ -1,2 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type ModelStrings = any;

View File

@@ -1,2 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type SettingSource = any;

View File

@@ -1,2 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type resetSettingsCache = any;

View File

@@ -1,2 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type PluginHookMatcher = any;

View File

@@ -1,2 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type createSignal = any;

View File

@@ -1,2 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type StdoutMessage = any;

View File

@@ -1,2 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type ask = any;

View File

@@ -1,2 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type installOAuthTokens = any;

View File

@@ -1,2 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type RemoteIO = any;

View File

@@ -1,2 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type StructuredIO = any;

View File

@@ -1,2 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type collectContextData = any;

View File

@@ -1,14 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type SDKStatus = any;
export type ModelInfo = any;
export type SDKMessage = any;
export type SDKUserMessage = any;
export type SDKUserMessageReplay = any;
export type PermissionResult = any;
export type McpServerConfigForProcessTransport = any;
export type McpServerStatus = any;
export type RewindFilesResult = any;
export type HookEvent = any;
export type HookInput = any;
export type HookJSONOutput = any;
export type PermissionUpdate = any;

View File

@@ -1,2 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type SDKControlElicitationResponseSchema = any;

View File

@@ -1,9 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type StdoutMessage = any;
export type SDKControlInitializeRequest = any;
export type SDKControlInitializeResponse = any;
export type SDKControlRequest = any;
export type SDKControlResponse = any;
export type SDKControlMcpSetServersResponse = any;
export type SDKControlReloadPluginsResponse = any;
export type StdinMessage = any;

View File

@@ -1,2 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type CanUseToolFn = any;

View File

@@ -1,5 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type tryGenerateSuggestion = any;
export type logSuggestionOutcome = any;
export type logSuggestionSuppressed = any;
export type PromptVariant = any;

View File

@@ -1,2 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type getFeatureValue_CACHED_MAY_BE_STALE = any;

View File

@@ -1,3 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type logEvent = any;
export type AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS = any;

View File

@@ -1,3 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type isQualifiedForGrove = any;
export type checkGroveForNonInteractive = any;

View File

@@ -1,2 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type EMPTY_USAGE = any;

View File

@@ -1,3 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type statusListeners = any;
export type ClaudeAILimits = any;

View File

@@ -1,3 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type performMCPOAuthFlow = any;
export type revokeServerTokens = any;

View File

@@ -1,3 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type isChannelAllowlisted = any;
export type isChannelsEnabled = any;

View File

@@ -1,5 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type ChannelMessageNotificationSchema = any;
export type gateChannelServer = any;
export type wrapChannelMessage = any;
export type findChannelEntry = any;

View File

@@ -1,7 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type setupSdkMcpClients = any;
export type connectToServer = any;
export type clearServerCache = any;
export type fetchToolsForClient = any;
export type areMcpConfigsEqual = any;
export type reconnectMcpServerImpl = any;

View File

@@ -1,6 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type filterMcpServersByPolicy = any;
export type getMcpConfigByName = any;
export type isMcpServerDisabled = any;
export type setMcpServerEnabled = any;
export type getAllMcpConfigs = any;

View File

@@ -1,3 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type runElicitationHooks = any;
export type runElicitationResultHooks = any;

View File

@@ -1,2 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type getMcpPrefix = any;

View File

@@ -1,4 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type MCPServerConnection = any;
export type McpSdkServerConfig = any;
export type ScopedMcpServerConfig = any;

View File

@@ -1,3 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type commandBelongsToServer = any;
export type filterToolsByServer = any;

View File

@@ -1,2 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type setupVscodeSdkMcp = any;

View File

@@ -1,2 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type OAuthService = any;

View File

@@ -1,2 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type isPolicyAllowed = any;

View File

@@ -1,2 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type waitForRemoteManagedSettingsToLoad = any;

View File

@@ -1,3 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type downloadUserSettings = any;
export type redownloadUserSettings = any;

View File

@@ -1,2 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type AppState = any;

View File

@@ -1,2 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type externalMetadataToAppState = any;

View File

@@ -1,3 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type assembleToolPool = any;
export type filterToolsByDenyRules = any;

View File

@@ -1,2 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type createAbortController = any;

View File

@@ -1,2 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type uniq = any;

View File

@@ -1,2 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type getAccountInformation = any;

View File

@@ -1,4 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type getLatestVersion = any;
export type InstallStatus = any;
export type installGlobalPackage = any;

View File

@@ -1,2 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type AwsAuthStatusManager = any;

View File

@@ -1,2 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type modelSupportsAutoMode = any;

View File

@@ -1,2 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type registerCleanup = any;

View File

@@ -1,2 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type createCombinedAbortSignal = any;

View File

@@ -1,2 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type notifyCommandLifecycle = any;

View File

@@ -1,2 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type incrementPromptCount = any;

View File

@@ -1,2 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type regenerateCompletionCache = any;

View File

@@ -1,4 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type getGlobalConfig = any;
export type InstallMethod = any;
export type saveGlobalConfig = any;

View File

@@ -1,3 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type loadConversationForResume = any;
export type TurnInterruptionState = any;

View File

@@ -1,2 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type getCwd = any;

View File

@@ -1,2 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type logForDebugging = any;

View File

@@ -1,3 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type logForDiagnosticsNoPII = any;
export type withDiagnosticsTiming = any;

View File

@@ -1,2 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type getDoctorDiagnostic = any;

View File

@@ -1,5 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type modelSupportsEffort = any;
export type modelSupportsMaxEffort = any;
export type EFFORT_LEVELS = any;
export type resolveAppliedEffort = any;

View File

@@ -1,2 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type AbortError = any;

View File

@@ -1,5 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type isFastModeAvailable = any;
export type isFastModeEnabled = any;
export type isFastModeSupportedByModel = any;
export type getFastModeState = any;

View File

@@ -1,5 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type fileHistoryRewind = any;
export type fileHistoryCanRestore = any;
export type fileHistoryEnabled = any;
export type fileHistoryGetDiffStats = any;

View File

@@ -1,2 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type executeFilePersistence = any;

View File

@@ -1,4 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type createFileStateCacheWithSizeLimit = any;
export type mergeFileStateCaches = any;
export type READ_FILE_STATE_CACHE_SIZE = any;

View File

@@ -1,2 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type getLastCacheSafeParams = any;

View File

@@ -1,2 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type fromArray = any;

View File

@@ -1,4 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type gracefulShutdown = any;
export type gracefulShutdownSync = any;
export type isShuttingDown = any;

View File

@@ -1,4 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type headlessProfilerStartTurn = any;
export type headlessProfilerCheckpoint = any;
export type logHeadlessProfilerTurn = any;

View File

@@ -1,2 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type executeNotificationHooks = any;

View File

@@ -1,2 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type finalizePendingAsyncHooks = any;

View File

@@ -1,2 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type registerHookEventHandler = any;

View File

@@ -1,2 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type createIdleTimeoutManager = any;

View File

@@ -1,2 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type safeParseJSON = any;

View File

@@ -1,3 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type installOrUpdateClaudePackage = any;
export type localInstallationExists = any;

View File

@@ -1,4 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type getInMemoryErrors = any;
export type logError = any;
export type logMCPDebug = any;

View File

@@ -1,8 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type dequeue = any;
export type dequeueAllMatching = any;
export type enqueue = any;
export type hasCommandsInQueue = any;
export type peek = any;
export type subscribeToCommandQueue = any;
export type getCommandsByMaxPriority = any;

View File

@@ -1,2 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type createModelSwitchBreadcrumbs = any;

View File

@@ -1,3 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type toInternalMessages = any;
export type toSDKRateLimitInfo = any;

View File

@@ -1,5 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type getDefaultMainLoopModel = any;
export type getMainLoopModel = any;
export type modelDisplayString = any;
export type parseUserSpecifiedModel = any;

View File

@@ -1,2 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type getModelOptions = any;

View File

@@ -1,2 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type ensureModelStringsInitialized = any;

View File

@@ -1,2 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type getAPIProvider = any;

View File

@@ -1,3 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type installLatest = any;
export type removeInstalledSymlink = any;

View File

@@ -1,2 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type getPackageManager = any;

View File

@@ -1,2 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type expandPath = any;

View File

@@ -1,4 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type outputSchema = any;
export type permissionPromptToolResultToPermissionDecision = any;
export type Output = any;

View File

@@ -1,3 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type PermissionDecision = any;
export type PermissionDecisionReason = any;

View File

@@ -1,6 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type isAutoModeGateEnabled = any;
export type getAutoModeUnavailableNotification = any;
export type getAutoModeUnavailableReason = any;
export type isBypassPermissionsModeDisabled = any;
export type transitionPermissionMode = any;

View File

@@ -1,2 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type hasPermissionsToUseTool = any;

View File

@@ -1,2 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type parsePluginIdentifier = any;

View File

@@ -1,3 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type writeToStdout = any;
export type registerProcessOutputErrorHandlers = any;

View File

@@ -1,2 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type buildSideQuestionFallbackParams = any;

View File

@@ -1,3 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type PermissionPromptTool = any;
export type extractReadFilesFromMessages = any;

View File

@@ -1,3 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type startQueryProfile = any;
export type logQueryProfileReport = any;

View File

@@ -1,2 +0,0 @@
// Auto-generated type stub — replace with real implementation
export type SandboxManager = any;

Some files were not shown because too many files have changed in this diff Show More