mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-22 16:25:51 +00:00
chore: 移除 packages/ 下多处未引用的导出
涉及 11 个 workspace 包文件,每处均为独立的 unreferenced export 删除或 export 关键字冗余移除: - @ant/ink/core/termio/csi.ts(eraseLine) - acp-link/manager/types.ts、acp-link/ws-message.ts - builtin-tools/AgentTool/agentMemory.ts、BashTool/bashSecurity.ts、BashTool/sedEditParser.ts - builtin-tools/ConfigTool/supportedSettings.ts、FileEditTool/utils.ts - remote-control-server/store.ts、transport/event-bus.ts、types/messages.ts Co-Authored-By: glm-5.2 <zai-org@claude-code-best.win>
This commit is contained in:
@@ -203,11 +203,6 @@ export function eraseToStartOfLine(): string {
|
|||||||
return csi(1, 'K')
|
return csi(1, 'K')
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Erase entire line (CSI 2 K) */
|
|
||||||
export function eraseLine(): string {
|
|
||||||
return csi(2, 'K')
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Erase entire line - constant form */
|
/** Erase entire line - constant form */
|
||||||
export const ERASE_LINE = csi(2, 'K')
|
export const ERASE_LINE = csi(2, 'K')
|
||||||
|
|
||||||
|
|||||||
@@ -18,11 +18,6 @@ export interface LogEntry {
|
|||||||
text: string
|
text: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CreateInstanceRequest {
|
|
||||||
group: string
|
|
||||||
command: string
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface InstanceSummary {
|
export interface InstanceSummary {
|
||||||
id: string
|
id: string
|
||||||
group: string
|
group: string
|
||||||
|
|||||||
@@ -100,16 +100,6 @@ export function isAgentMemoryPath(absolutePath: string): boolean {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the agent memory file path for a given agent type and scope.
|
|
||||||
*/
|
|
||||||
export function getAgentMemoryEntrypoint(
|
|
||||||
agentType: string,
|
|
||||||
scope: AgentMemoryScope,
|
|
||||||
): string {
|
|
||||||
return join(getAgentMemoryDir(agentType, scope), 'MEMORY.md')
|
|
||||||
}
|
|
||||||
|
|
||||||
export function getMemoryScopeDisplay(
|
export function getMemoryScopeDisplay(
|
||||||
memory: AgentMemoryScope | undefined,
|
memory: AgentMemoryScope | undefined,
|
||||||
): string {
|
): string {
|
||||||
|
|||||||
@@ -579,11 +579,6 @@ export function stripSafeHeredocSubstitutions(command: string): string | null {
|
|||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Detection-only check: does the command contain a safe heredoc substitution? */
|
|
||||||
export function hasSafeHeredocSubstitution(command: string): boolean {
|
|
||||||
return stripSafeHeredocSubstitutions(command) !== null
|
|
||||||
}
|
|
||||||
|
|
||||||
function validateSafeCommandSubstitution(
|
function validateSafeCommandSubstitution(
|
||||||
context: ValidationContext,
|
context: ValidationContext,
|
||||||
): PermissionResult {
|
): PermissionResult {
|
||||||
|
|||||||
@@ -33,15 +33,6 @@ export type SedEditInfo = {
|
|||||||
extendedRegex: boolean
|
extendedRegex: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Check if a command is a sed in-place edit command
|
|
||||||
* Returns true only for simple sed -i 's/pattern/replacement/flags' file commands
|
|
||||||
*/
|
|
||||||
export function isSedInPlaceEdit(command: string): boolean {
|
|
||||||
const info = parseSedEditCommand(command)
|
|
||||||
return info !== null
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parse a sed edit command and extract the edit information
|
* Parse a sed edit command and extract the edit information
|
||||||
* Returns null if the command is not a valid sed in-place edit
|
* Returns null if the command is not a valid sed in-place edit
|
||||||
|
|||||||
@@ -193,10 +193,6 @@ export function getConfig(key: string): SettingConfig | undefined {
|
|||||||
return SUPPORTED_SETTINGS[key]
|
return SUPPORTED_SETTINGS[key]
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getAllKeys(): string[] {
|
|
||||||
return Object.keys(SUPPORTED_SETTINGS)
|
|
||||||
}
|
|
||||||
|
|
||||||
export function getOptionsForSetting(key: string): string[] | undefined {
|
export function getOptionsForSetting(key: string): string[] | undefined {
|
||||||
const config = SUPPORTED_SETTINGS[key]
|
const config = SUPPORTED_SETTINGS[key]
|
||||||
if (!config) return undefined
|
if (!config) return undefined
|
||||||
|
|||||||
@@ -317,42 +317,6 @@ export function getSnippetForPatch(
|
|||||||
return { formattedSnippet, startLine }
|
return { formattedSnippet, startLine }
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets a snippet from a file showing the context around a single edit.
|
|
||||||
* This is a convenience function that uses the original algorithm.
|
|
||||||
* @param originalFile The original file content
|
|
||||||
* @param oldString The text to replace
|
|
||||||
* @param newString The text to replace it with
|
|
||||||
* @param contextLines The number of lines to show before and after the change
|
|
||||||
* @returns The snippet and the starting line number
|
|
||||||
*/
|
|
||||||
export function getSnippet(
|
|
||||||
originalFile: string,
|
|
||||||
oldString: string,
|
|
||||||
newString: string,
|
|
||||||
contextLines: number = 4,
|
|
||||||
): { snippet: string; startLine: number } {
|
|
||||||
// Use the original algorithm from FileEditTool.tsx
|
|
||||||
const before = originalFile.split(oldString)[0] ?? ''
|
|
||||||
const replacementLine = before.split(/\r?\n/).length - 1
|
|
||||||
const newFileLines = applyEditToFile(
|
|
||||||
originalFile,
|
|
||||||
oldString,
|
|
||||||
newString,
|
|
||||||
).split(/\r?\n/)
|
|
||||||
|
|
||||||
// Calculate the start and end line numbers for the snippet
|
|
||||||
const startLine = Math.max(0, replacementLine - contextLines)
|
|
||||||
const endLine =
|
|
||||||
replacementLine + contextLines + newString.split(/\r?\n/).length
|
|
||||||
|
|
||||||
// Get snippet
|
|
||||||
const snippetLines = newFileLines.slice(startLine, endLine)
|
|
||||||
const snippet = snippetLines.join('\n')
|
|
||||||
|
|
||||||
return { snippet, startLine: startLine + 1 }
|
|
||||||
}
|
|
||||||
|
|
||||||
export function getEditsForPatch(patch: StructuredPatchHunk[]): FileEdit[] {
|
export function getEditsForPatch(patch: StructuredPatchHunk[]): FileEdit[] {
|
||||||
return patch.map(hunk => {
|
return patch.map(hunk => {
|
||||||
// Extract the changes from this hunk
|
// Extract the changes from this hunk
|
||||||
|
|||||||
@@ -405,13 +405,6 @@ export function storeListAcpAgentsByChannelGroup(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** List online ACP agents */
|
|
||||||
export function storeListOnlineAcpAgents(): EnvironmentRecord[] {
|
|
||||||
return [...environments.values()].filter(
|
|
||||||
e => e.workerType === 'acp' && e.status === 'active',
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Mark an ACP agent as offline */
|
/** Mark an ACP agent as offline */
|
||||||
export function storeMarkAcpAgentOffline(id: string): boolean {
|
export function storeMarkAcpAgentOffline(id: string): boolean {
|
||||||
const rec = environments.get(id)
|
const rec = environments.get(id)
|
||||||
|
|||||||
@@ -106,11 +106,3 @@ export function getAcpEventBus(channelGroupId: string): EventBus {
|
|||||||
}
|
}
|
||||||
return bus
|
return bus
|
||||||
}
|
}
|
||||||
|
|
||||||
export function removeAcpEventBus(channelGroupId: string) {
|
|
||||||
const bus = acpBuses.get(channelGroupId)
|
|
||||||
if (bus) {
|
|
||||||
bus.close()
|
|
||||||
acpBuses.delete(channelGroupId)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -33,18 +33,6 @@ export interface ControlRequest extends SDKMessage {
|
|||||||
[key: string]: unknown
|
[key: string]: unknown
|
||||||
}
|
}
|
||||||
|
|
||||||
export type SessionEventType =
|
|
||||||
| 'user'
|
|
||||||
| 'assistant'
|
|
||||||
| 'automation_state'
|
|
||||||
| 'permission_request'
|
|
||||||
| 'permission_response'
|
|
||||||
| 'control_request'
|
|
||||||
| 'tool_use'
|
|
||||||
| 'tool_result'
|
|
||||||
| 'status'
|
|
||||||
| 'error'
|
|
||||||
|
|
||||||
// --- Normalized Event Payloads (SSE contract) ---
|
// --- Normalized Event Payloads (SSE contract) ---
|
||||||
|
|
||||||
export interface NormalizedEventPayload {
|
export interface NormalizedEventPayload {
|
||||||
|
|||||||
Reference in New Issue
Block a user