mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-18 06:15:51 +00:00
feat: 完成第二版类型清理
This commit is contained in:
@@ -1,12 +1,37 @@
|
||||
// Auto-generated stub — replace with real implementation
|
||||
export {};
|
||||
export const isCachedMicrocompactEnabled: any = (() => {}) as any;
|
||||
export const isModelSupportedForCacheEditing: any = (() => {}) as any;
|
||||
export const getCachedMCConfig: any = (() => {}) as any;
|
||||
export const createCachedMCState: any = (() => {}) as any;
|
||||
export const markToolsSentToAPI: any = (() => {}) as any;
|
||||
export const resetCachedMCState: any = (() => {}) as any;
|
||||
export const registerToolResult: any = (() => {}) as any;
|
||||
export const registerToolMessage: any = (() => {}) as any;
|
||||
export const getToolResultsToDelete: any = (() => {}) as any;
|
||||
export const createCacheEditsBlock: any = (() => {}) as any;
|
||||
|
||||
export type CachedMCState = {
|
||||
registeredTools: Set<string>
|
||||
toolOrder: string[]
|
||||
deletedRefs: Set<string>
|
||||
pinnedEdits: PinnedCacheEdits[]
|
||||
toolsSentToAPI: boolean
|
||||
}
|
||||
|
||||
export type CacheEditsBlock = {
|
||||
type: 'cache_edits'
|
||||
edits: Array<{ type: string; tool_use_id: string }>
|
||||
}
|
||||
|
||||
export type PinnedCacheEdits = {
|
||||
userMessageIndex: number
|
||||
block: CacheEditsBlock
|
||||
}
|
||||
|
||||
export const isCachedMicrocompactEnabled: () => boolean = () => false;
|
||||
export const isModelSupportedForCacheEditing: (model: string) => boolean = () => false;
|
||||
export const getCachedMCConfig: () => { triggerThreshold: number; keepRecent: number } = () => ({ triggerThreshold: 0, keepRecent: 0 });
|
||||
export const createCachedMCState: () => CachedMCState = () => ({
|
||||
registeredTools: new Set(),
|
||||
toolOrder: [],
|
||||
deletedRefs: new Set(),
|
||||
pinnedEdits: [],
|
||||
toolsSentToAPI: false,
|
||||
});
|
||||
export const markToolsSentToAPI: (state: CachedMCState) => void = () => {};
|
||||
export const resetCachedMCState: (state: CachedMCState) => void = () => {};
|
||||
export const registerToolResult: (state: CachedMCState, toolId: string) => void = () => {};
|
||||
export const registerToolMessage: (state: CachedMCState, groupIds: string[]) => void = () => {};
|
||||
export const getToolResultsToDelete: (state: CachedMCState) => string[] = () => [];
|
||||
export const createCacheEditsBlock: (state: CachedMCState, toolIds: string[]) => CacheEditsBlock | null = () => null;
|
||||
|
||||
@@ -436,7 +436,7 @@ export function evaluateTimeBasedTrigger(
|
||||
return null
|
||||
}
|
||||
const gapMinutes =
|
||||
(Date.now() - new Date(lastAssistant.timestamp).getTime()) / 60_000
|
||||
(Date.now() - new Date(lastAssistant.timestamp as string | number).getTime()) / 60_000
|
||||
if (!Number.isFinite(gapMinutes) || gapMinutes < config.gapThresholdMinutes) {
|
||||
return null
|
||||
}
|
||||
|
||||
@@ -135,7 +135,7 @@ async function initSessionMemoryCompactConfig(): Promise<void> {
|
||||
export function hasTextBlocks(message: Message): boolean {
|
||||
if (message.type === 'assistant') {
|
||||
const content = message.message.content
|
||||
return content.some(block => block.type === 'text')
|
||||
return Array.isArray(content) && content.some(block => block.type === 'text')
|
||||
}
|
||||
if (message.type === 'user') {
|
||||
const content = message.message.content
|
||||
|
||||
Reference in New Issue
Block a user