9bd21c8a67
This PR ports the hashline edit tool from oh-my-pi to oh-my-opencode as an experimental feature. ## Features - New experimental.hashline_edit config flag - hashline_edit tool with 4 operations: set_line, replace_lines, insert_after, replace - Hash-based line anchors for safe concurrent editing - Edit tool disabler for non-OpenAI providers - Read output enhancer with LINE:HASH prefixes - Provider state tracking module ## Technical Details - xxHash32-based 2-char hex hashes - Bottom-up edit application to prevent index shifting - OpenAI provider exemption (uses native apply_patch) - 90 tests covering all operations and edge cases - All files under 200 LOC limit ## Files Added/Modified - src/tools/hashline-edit/ (7 files, ~400 LOC) - src/hooks/hashline-edit-disabler/ (4 files, ~200 LOC) - src/hooks/hashline-read-enhancer/ (3 files, ~400 LOC) - src/features/hashline-provider-state.ts (13 LOC) - src/config/schema/experimental.ts (hashline_edit flag) - src/config/schema/hooks.ts (2 new hook names) - src/plugin/tool-registry.ts (conditional registration) - src/plugin/chat-params.ts (provider state tracking) - src/tools/index.ts (export) - src/hooks/index.ts (exports)
65 lines
1.9 KiB
TypeScript
65 lines
1.9 KiB
TypeScript
import {
|
|
lsp_goto_definition,
|
|
lsp_find_references,
|
|
lsp_symbols,
|
|
lsp_diagnostics,
|
|
lsp_prepare_rename,
|
|
lsp_rename,
|
|
lspManager,
|
|
} from "./lsp"
|
|
|
|
export { lspManager }
|
|
|
|
export { createAstGrepTools } from "./ast-grep"
|
|
export { createGrepTools } from "./grep"
|
|
export { createGlobTools } from "./glob"
|
|
export { createSlashcommandTool, discoverCommandsSync } from "./slashcommand"
|
|
export { createSessionManagerTools } from "./session-manager"
|
|
|
|
export { sessionExists } from "./session-manager/storage"
|
|
|
|
export { interactive_bash, startBackgroundCheck as startTmuxCheck } from "./interactive-bash"
|
|
export { createSkillTool } from "./skill"
|
|
export { createSkillMcpTool } from "./skill-mcp"
|
|
|
|
import {
|
|
createBackgroundOutput,
|
|
createBackgroundCancel,
|
|
type BackgroundOutputManager,
|
|
type BackgroundCancelClient,
|
|
} from "./background-task"
|
|
|
|
import type { PluginInput, ToolDefinition } from "@opencode-ai/plugin"
|
|
import type { BackgroundManager } from "../features/background-agent"
|
|
|
|
type OpencodeClient = PluginInput["client"]
|
|
|
|
export { createCallOmoAgent } from "./call-omo-agent"
|
|
export { createLookAt } from "./look-at"
|
|
export { createDelegateTask } from "./delegate-task"
|
|
export {
|
|
createTaskCreateTool,
|
|
createTaskGetTool,
|
|
createTaskList,
|
|
createTaskUpdateTool,
|
|
} from "./task"
|
|
export { createHashlineEditTool } from "./hashline-edit"
|
|
|
|
export function createBackgroundTools(manager: BackgroundManager, client: OpencodeClient): Record<string, ToolDefinition> {
|
|
const outputManager: BackgroundOutputManager = manager
|
|
const cancelClient: BackgroundCancelClient = client
|
|
return {
|
|
background_output: createBackgroundOutput(outputManager, client),
|
|
background_cancel: createBackgroundCancel(manager, cancelClient),
|
|
}
|
|
}
|
|
|
|
export const builtinTools: Record<string, ToolDefinition> = {
|
|
lsp_goto_definition,
|
|
lsp_find_references,
|
|
lsp_symbols,
|
|
lsp_diagnostics,
|
|
lsp_prepare_rename,
|
|
lsp_rename,
|
|
}
|