import type { AnyToolDefinition } from "../contracts.js";
import { toRuntimeToolDefinition } from "../definition-adapter.js";
import {
  createAttachTextTool,
  createVerifySwiftPackageTool,
  createWriteArtifactTool,
} from "./artifact-tools.js";
import { createAskUserTool } from "./ask-user.js";
import { createEchoTool } from "./echo.js";
import { createFetchUrlTool, createWebSearchTool } from "./fetch-tools.js";
import { createInspectEnvTool } from "./inspect-env.js";
import { createProcessSessionTools } from "./process-session-tools.js";
import { createReadFileTool } from "./read-tools.js";
import {
  createContentSearchTool,
  createWorkspaceFilesTool,
  createWorkspaceSearchTool,
} from "./search-tools.js";
import { createShellTool } from "./shell.js";
import {
  createAppendScratchTool,
  createApplyPatchTool,
  createEditTool,
  createReadScratchTool,
  createWriteScratchTool,
  createWriteWorkspaceTool,
} from "./write-tools.js";

export function createBuiltInTools(): AnyToolDefinition[] {
  return [
    toRuntimeToolDefinition(createEchoTool()),
    toRuntimeToolDefinition(createAskUserTool()),
    toRuntimeToolDefinition(createWorkspaceSearchTool()),
    toRuntimeToolDefinition(createContentSearchTool()),
    toRuntimeToolDefinition(createWorkspaceFilesTool()),
    toRuntimeToolDefinition(createReadFileTool()),
    toRuntimeToolDefinition(createInspectEnvTool()),
    toRuntimeToolDefinition(createShellTool()),
    ...createProcessSessionTools().map(toRuntimeToolDefinition),
    toRuntimeToolDefinition(createFetchUrlTool()),
    toRuntimeToolDefinition(createWebSearchTool()),
    toRuntimeToolDefinition(createWriteScratchTool()),
    toRuntimeToolDefinition(createReadScratchTool()),
    toRuntimeToolDefinition(createAppendScratchTool()),
    toRuntimeToolDefinition(createWriteWorkspaceTool()),
    toRuntimeToolDefinition(createEditTool()),
    toRuntimeToolDefinition(createApplyPatchTool()),
    toRuntimeToolDefinition(createVerifySwiftPackageTool()),
    toRuntimeToolDefinition(createAttachTextTool()),
    toRuntimeToolDefinition(createWriteArtifactTool()),
  ];
}
