diff --git a/bun.lock b/bun.lock index 6d1819e..79fd739 100644 --- a/bun.lock +++ b/bun.lock @@ -109,6 +109,7 @@ "zod": "^4.3.6", }, "devDependencies": { + "@biomejs/biome": "^2.4.10", "@types/bun": "^1.3.11", "@types/cacache": "^20.0.1", "@types/plist": "^3.0.5", @@ -286,6 +287,24 @@ "@babel/runtime": ["@babel/runtime@7.29.2", "https://registry.npmmirror.com/@babel/runtime/-/runtime-7.29.2.tgz", {}, "sha512-JiDShH45zKHWyGe4ZNVRrCjBz8Nh9TMmZG1kh4QTK8hCBTWBi8Da+i7s1fJw7/lYpM4ccepSNfqzZ/QvABBi5g=="], + "@biomejs/biome": ["@biomejs/biome@2.4.10", "https://registry.npmmirror.com/@biomejs/biome/-/biome-2.4.10.tgz", { "optionalDependencies": { "@biomejs/cli-darwin-arm64": "2.4.10", "@biomejs/cli-darwin-x64": "2.4.10", "@biomejs/cli-linux-arm64": "2.4.10", "@biomejs/cli-linux-arm64-musl": "2.4.10", "@biomejs/cli-linux-x64": "2.4.10", "@biomejs/cli-linux-x64-musl": "2.4.10", "@biomejs/cli-win32-arm64": "2.4.10", "@biomejs/cli-win32-x64": "2.4.10" }, "bin": { "biome": "bin/biome" } }, "sha512-xxA3AphFQ1geij4JTHXv4EeSTda1IFn22ye9LdyVPoJU19fNVl0uzfEuhsfQ4Yue/0FaLs2/ccVi4UDiE7R30w=="], + + "@biomejs/cli-darwin-arm64": ["@biomejs/cli-darwin-arm64@2.4.10", "https://registry.npmmirror.com/@biomejs/cli-darwin-arm64/-/cli-darwin-arm64-2.4.10.tgz", { "os": "darwin", "cpu": "arm64" }, "sha512-vuzzI1cWqDVzOMIkYyHbKqp+AkQq4K7k+UCXWpkYcY/HDn1UxdsbsfgtVpa40shem8Kax4TLDLlx8kMAecgqiw=="], + + "@biomejs/cli-darwin-x64": ["@biomejs/cli-darwin-x64@2.4.10", "https://registry.npmmirror.com/@biomejs/cli-darwin-x64/-/cli-darwin-x64-2.4.10.tgz", { "os": "darwin", "cpu": "x64" }, "sha512-14fzASRo+BPotwp7nWULy2W5xeUyFnTaq1V13Etrrxkrih+ez/2QfgFm5Ehtf5vSjtgx/IJycMMpn5kPd5ZNaA=="], + + "@biomejs/cli-linux-arm64": ["@biomejs/cli-linux-arm64@2.4.10", "https://registry.npmmirror.com/@biomejs/cli-linux-arm64/-/cli-linux-arm64-2.4.10.tgz", { "os": "linux", "cpu": "arm64" }, "sha512-7MH1CMW5uuxQ/s7FLST63qF8B3Hgu2HRdZ7tA1X1+mk+St4JOuIrqdhIBnnyqeyWJNI+Bww7Es5QZ0wIc1Cmkw=="], + + "@biomejs/cli-linux-arm64-musl": ["@biomejs/cli-linux-arm64-musl@2.4.10", "https://registry.npmmirror.com/@biomejs/cli-linux-arm64-musl/-/cli-linux-arm64-musl-2.4.10.tgz", { "os": "linux", "cpu": "arm64" }, "sha512-WrJY6UuiSD/Dh+nwK2qOTu8kdMDlLV3dLMmychIghHPAysWFq1/DGC1pVZx8POE3ZkzKR3PUUnVrtZfMfaJjyQ=="], + + "@biomejs/cli-linux-x64": ["@biomejs/cli-linux-x64@2.4.10", "https://registry.npmmirror.com/@biomejs/cli-linux-x64/-/cli-linux-x64-2.4.10.tgz", { "os": "linux", "cpu": "x64" }, "sha512-tZLvEEi2u9Xu1zAqRjTcpIDGVtldigVvzug2fTuPG0ME/g8/mXpRPcNgLB22bGn6FvLJpHHnqLnwliOu8xjYrg=="], + + "@biomejs/cli-linux-x64-musl": ["@biomejs/cli-linux-x64-musl@2.4.10", "https://registry.npmmirror.com/@biomejs/cli-linux-x64-musl/-/cli-linux-x64-musl-2.4.10.tgz", { "os": "linux", "cpu": "x64" }, "sha512-kDTi3pI6PBN6CiczsWYOyP2zk0IJI08EWEQyDMQWW221rPaaEz6FvjLhnU07KMzLv8q3qSuoB93ua6inSQ55Tw=="], + + "@biomejs/cli-win32-arm64": ["@biomejs/cli-win32-arm64@2.4.10", "https://registry.npmmirror.com/@biomejs/cli-win32-arm64/-/cli-win32-arm64-2.4.10.tgz", { "os": "win32", "cpu": "arm64" }, "sha512-umwQU6qPzH+ISTf/eHyJ/QoQnJs3V9Vpjz2OjZXe9MVBZ7prgGafMy7yYeRGnlmDAn87AKTF3Q6weLoMGpeqdQ=="], + + "@biomejs/cli-win32-x64": ["@biomejs/cli-win32-x64@2.4.10", "https://registry.npmmirror.com/@biomejs/cli-win32-x64/-/cli-win32-x64-2.4.10.tgz", { "os": "win32", "cpu": "x64" }, "sha512-aW/JU5GuyH4uxMrNYpoC2kjaHlyJGLgIa3XkhPEZI0uKhZhJZU8BuEyJmvgzSPQNGozBwWjC972RaNdcJ9KyJg=="], + "@commander-js/extra-typings": ["@commander-js/extra-typings@14.0.0", "https://registry.npmmirror.com/@commander-js/extra-typings/-/extra-typings-14.0.0.tgz", { "peerDependencies": { "commander": "~14.0.0" } }, "sha512-hIn0ncNaJRLkZrxBIp5AsW/eXEHNKYQBh0aPdoUqNgD+Io3NIykQqpKFyKcuasZhicGaEZJX/JBSIkZ4e5x8Dg=="], "@emnapi/runtime": ["@emnapi/runtime@1.9.1", "https://registry.npmmirror.com/@emnapi/runtime/-/runtime-1.9.1.tgz", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-VYi5+ZVLhpgK4hQ0TAjiQiZ6ol0oe4mBx7mVv7IflsiEp0OWoVsp/+f9Vc1hOhE0TtkORVrI1GvzyreqpgWtkA=="], diff --git a/package.json b/package.json index 2a3dfdf..cf4e4fb 100644 --- a/package.json +++ b/package.json @@ -119,6 +119,7 @@ "zod": "^4.3.6" }, "devDependencies": { + "@biomejs/biome": "^2.4.10", "@types/bun": "^1.3.11", "@types/cacache": "^20.0.1", "@types/plist": "^3.0.5", diff --git a/src/QueryEngine.ts b/src/QueryEngine.ts index 2b89d53..1166151 100644 --- a/src/QueryEngine.ts +++ b/src/QueryEngine.ts @@ -1276,7 +1276,7 @@ export async function* ask({ tools, commands, mcpClients, - agents, + agents: agents ?? [], canUseTool, getAppState, setAppState, diff --git a/src/assistant/AssistantSessionChooser.ts b/src/assistant/AssistantSessionChooser.ts index 1ebdf1c..e61ba6c 100644 --- a/src/assistant/AssistantSessionChooser.ts +++ b/src/assistant/AssistantSessionChooser.ts @@ -1,3 +1,3 @@ // Auto-generated stub — replace with real implementation export {}; -export const AssistantSessionChooser: any = (() => {}) as any; +export const AssistantSessionChooser: (props: Record) => null = () => null; diff --git a/src/assistant/gate.ts b/src/assistant/gate.ts index 2bb8e34..c08265c 100644 --- a/src/assistant/gate.ts +++ b/src/assistant/gate.ts @@ -1,3 +1,3 @@ // Auto-generated stub — replace with real implementation export {}; -export const isKairosEnabled: any = (() => {}) as any; +export const isKairosEnabled: () => Promise = () => Promise.resolve(false); diff --git a/src/assistant/index.ts b/src/assistant/index.ts index e7dc0e9..3e23f69 100644 --- a/src/assistant/index.ts +++ b/src/assistant/index.ts @@ -1,8 +1,8 @@ // Auto-generated stub — replace with real implementation export {}; -export const isAssistantMode: any = (() => {}) as any; -export const initializeAssistantTeam: any = (() => {}) as any; -export const markAssistantForced: any = (() => {}) as any; -export const isAssistantForced: any = (() => {}) as any; -export const getAssistantSystemPromptAddendum: any = (() => {}) as any; -export const getAssistantActivationPath: any = (() => {}) as any; +export const isAssistantMode: () => boolean = () => false; +export const initializeAssistantTeam: () => Promise = async () => {}; +export const markAssistantForced: () => void = () => {}; +export const isAssistantForced: () => boolean = () => false; +export const getAssistantSystemPromptAddendum: () => string = () => ''; +export const getAssistantActivationPath: () => string | undefined = () => undefined; diff --git a/src/assistant/sessionDiscovery.ts b/src/assistant/sessionDiscovery.ts index 708cf3c..424564c 100644 --- a/src/assistant/sessionDiscovery.ts +++ b/src/assistant/sessionDiscovery.ts @@ -1,3 +1,3 @@ // Auto-generated stub — replace with real implementation -export type AssistantSession = any; -export const discoverAssistantSessions: any = (() => {}) as any; +export type AssistantSession = { id: string; [key: string]: unknown }; +export const discoverAssistantSessions: () => Promise = () => Promise.resolve([]); diff --git a/src/bridge/peerSessions.ts b/src/bridge/peerSessions.ts index f9b0336..57fa165 100644 --- a/src/bridge/peerSessions.ts +++ b/src/bridge/peerSessions.ts @@ -1,3 +1,3 @@ // Auto-generated stub — replace with real implementation export {}; -export const postInterClaudeMessage: any = (() => {}) as any; +export const postInterClaudeMessage: (target: string, message: string) => Promise<{ ok: boolean; error?: string }> = () => Promise.resolve({ ok: false }); diff --git a/src/bridge/webhookSanitizer.ts b/src/bridge/webhookSanitizer.ts index 30d33e6..c32323e 100644 --- a/src/bridge/webhookSanitizer.ts +++ b/src/bridge/webhookSanitizer.ts @@ -1,3 +1,3 @@ // Auto-generated stub — replace with real implementation export {}; -export const sanitizeInboundWebhookContent: any = (() => {}) as any; +export const sanitizeInboundWebhookContent: (content: string) => string = (content) => content; diff --git a/src/cli/bg.ts b/src/cli/bg.ts index 3b2ee55..709e7df 100644 --- a/src/cli/bg.ts +++ b/src/cli/bg.ts @@ -1,7 +1,7 @@ // Auto-generated stub — replace with real implementation export {}; -export const psHandler: any = (() => {}) as any; -export const logsHandler: any = (() => {}) as any; -export const attachHandler: any = (() => {}) as any; -export const killHandler: any = (() => {}) as any; -export const handleBgFlag: any = (() => {}) as any; +export const psHandler: (args: string[]) => Promise = (async () => {}) as (args: string[]) => Promise; +export const logsHandler: (sessionId: string | undefined) => Promise = (async () => {}) as (sessionId: string | undefined) => Promise; +export const attachHandler: (sessionId: string | undefined) => Promise = (async () => {}) as (sessionId: string | undefined) => Promise; +export const killHandler: (sessionId: string | undefined) => Promise = (async () => {}) as (sessionId: string | undefined) => Promise; +export const handleBgFlag: (args: string[]) => Promise = (async () => {}) as (args: string[]) => Promise; diff --git a/src/cli/handlers/ant.ts b/src/cli/handlers/ant.ts index c6fdee9..74e5335 100644 --- a/src/cli/handlers/ant.ts +++ b/src/cli/handlers/ant.ts @@ -1,11 +1,13 @@ // Auto-generated stub — replace with real implementation +import type { Command } from '@commander-js/extra-typings'; + export {}; -export const logHandler: any = (() => {}) as any; -export const errorHandler: any = (() => {}) as any; -export const exportHandler: any = (() => {}) as any; -export const taskCreateHandler: any = (() => {}) as any; -export const taskListHandler: any = (() => {}) as any; -export const taskGetHandler: any = (() => {}) as any; -export const taskUpdateHandler: any = (() => {}) as any; -export const taskDirHandler: any = (() => {}) as any; -export const completionHandler: any = (() => {}) as any; +export const logHandler: (logId: string | number | undefined) => Promise = (async () => {}) as (logId: string | number | undefined) => Promise; +export const errorHandler: (num: number | undefined) => Promise = (async () => {}) as (num: number | undefined) => Promise; +export const exportHandler: (source: string, outputFile: string) => Promise = (async () => {}) as (source: string, outputFile: string) => Promise; +export const taskCreateHandler: (subject: string, opts: { description?: string; list?: string }) => Promise = (async () => {}) as (subject: string, opts: { description?: string; list?: string }) => Promise; +export const taskListHandler: (opts: { list?: string; pending?: boolean; json?: boolean }) => Promise = (async () => {}) as (opts: { list?: string; pending?: boolean; json?: boolean }) => Promise; +export const taskGetHandler: (id: string, opts: { list?: string }) => Promise = (async () => {}) as (id: string, opts: { list?: string }) => Promise; +export const taskUpdateHandler: (id: string, opts: { list?: string; status?: string; subject?: string; description?: string; owner?: string; clearOwner?: boolean }) => Promise = (async () => {}) as (id: string, opts: { list?: string; status?: string; subject?: string; description?: string; owner?: string; clearOwner?: boolean }) => Promise; +export const taskDirHandler: (opts: { list?: string }) => Promise = (async () => {}) as (opts: { list?: string }) => Promise; +export const completionHandler: (shell: string, opts: { output?: string }, program: Command) => Promise = (async () => {}) as (shell: string, opts: { output?: string }, program: Command) => Promise; diff --git a/src/cli/handlers/templateJobs.ts b/src/cli/handlers/templateJobs.ts index 261e7da..aefb232 100644 --- a/src/cli/handlers/templateJobs.ts +++ b/src/cli/handlers/templateJobs.ts @@ -1,3 +1,3 @@ // Auto-generated stub — replace with real implementation export {}; -export const templatesMain: any = (() => {}) as any; +export const templatesMain: (args: string[]) => Promise = () => Promise.resolve(); diff --git a/src/commands/assistant/assistant.ts b/src/commands/assistant/assistant.ts index 3e6525c..80a04ca 100644 --- a/src/commands/assistant/assistant.ts +++ b/src/commands/assistant/assistant.ts @@ -1,4 +1,11 @@ // Auto-generated stub — replace with real implementation +import type React from 'react'; + export {}; -export const NewInstallWizard: any = (() => {}) as any; -export const computeDefaultInstallDir: any = (() => {}) as any; +export const NewInstallWizard: React.FC<{ + defaultDir: string; + onInstalled: (dir: string) => void; + onCancel: () => void; + onError: (message: string) => void; +}> = (() => null); +export const computeDefaultInstallDir: () => Promise = (() => Promise.resolve('')); diff --git a/src/commands/buddy/index.ts b/src/commands/buddy/index.ts index 85b4cbf..29ae609 100644 --- a/src/commands/buddy/index.ts +++ b/src/commands/buddy/index.ts @@ -1,3 +1,3 @@ // Auto-generated stub — replace with real implementation -const _default: any = (() => {}) as any; +const _default: Record = {}; export default _default; diff --git a/src/commands/compact/compact.ts b/src/commands/compact/compact.ts index 62ed4d3..b61e8f8 100644 --- a/src/commands/compact/compact.ts +++ b/src/commands/compact/compact.ts @@ -207,14 +207,14 @@ async function compactViaReactive( // they can merge its userDisplayMessage with PostCompact's here. This // caller additionally runs it concurrently with getCacheSharingParams. const combinedMessage = - [hookResult.userDisplayMessage, outcome.result.userDisplayMessage] + [hookResult.userDisplayMessage, outcome.result!.userDisplayMessage] .filter(Boolean) .join('\n') || undefined return { type: 'compact', compactionResult: { - ...outcome.result, + ...outcome.result!, userDisplayMessage: combinedMessage, }, displayText: buildDisplayText(context, combinedMessage), diff --git a/src/commands/fork/index.ts b/src/commands/fork/index.ts index 85b4cbf..29ae609 100644 --- a/src/commands/fork/index.ts +++ b/src/commands/fork/index.ts @@ -1,3 +1,3 @@ // Auto-generated stub — replace with real implementation -const _default: any = (() => {}) as any; +const _default: Record = {}; export default _default; diff --git a/src/commands/peers/index.ts b/src/commands/peers/index.ts index 85b4cbf..29ae609 100644 --- a/src/commands/peers/index.ts +++ b/src/commands/peers/index.ts @@ -1,3 +1,3 @@ // Auto-generated stub — replace with real implementation -const _default: any = (() => {}) as any; +const _default: Record = {}; export default _default; diff --git a/src/commands/plugin/BrowseMarketplace.tsx b/src/commands/plugin/BrowseMarketplace.tsx index 2f1d7f1..862281e 100644 --- a/src/commands/plugin/BrowseMarketplace.tsx +++ b/src/commands/plugin/BrowseMarketplace.tsx @@ -140,7 +140,7 @@ export function BrowseMarketplace({ } of marketplaces_0) { if (marketplace) { // Count how many plugins from this marketplace are installed - const installedFromThisMarketplace = count(marketplace.plugins, (plugin: any) => isPluginInstalled(createPluginId(plugin.name, name))); + const installedFromThisMarketplace = count(marketplace.plugins, (plugin: { name: string }) => isPluginInstalled(createPluginId(plugin.name, name))); marketplaceInfos.push({ name, totalPlugins: marketplace.plugins.length, diff --git a/src/commands/workflows/index.ts b/src/commands/workflows/index.ts index 85b4cbf..29ae609 100644 --- a/src/commands/workflows/index.ts +++ b/src/commands/workflows/index.ts @@ -1,3 +1,3 @@ // Auto-generated stub — replace with real implementation -const _default: any = (() => {}) as any; +const _default: Record = {}; export default _default; diff --git a/src/components/agents/SnapshotUpdateDialog.ts b/src/components/agents/SnapshotUpdateDialog.ts index 9fdc7f4..3ef0733 100644 --- a/src/components/agents/SnapshotUpdateDialog.ts +++ b/src/components/agents/SnapshotUpdateDialog.ts @@ -1,4 +1,13 @@ // Auto-generated stub — replace with real implementation +import type React from 'react'; +import type { AgentMemoryScope } from '../../tools/AgentTool/agentMemory.js'; + export {}; -export const SnapshotUpdateDialog: any = (() => {}) as any; -export const buildMergePrompt: any = (() => {}) as any; +export const SnapshotUpdateDialog: React.FC<{ + agentType: string; + scope: AgentMemoryScope; + snapshotTimestamp: string; + onComplete: (choice: 'merge' | 'keep' | 'replace') => void; + onCancel: () => void; +}> = (() => null); +export const buildMergePrompt: (agentType: string, scope: AgentMemoryScope) => string = (() => ''); diff --git a/src/components/agents/ToolSelector.tsx b/src/components/agents/ToolSelector.tsx index 046f41b..dadecfd 100644 --- a/src/components/agents/ToolSelector.tsx +++ b/src/components/agents/ToolSelector.tsx @@ -251,7 +251,7 @@ export function ToolSelector(t0) { let t9; if ($[22] !== selectedSet) { t9 = bucketTools => { - const selected = count(bucketTools, (t_5: any) => selectedSet.has(t_5.name)); + const selected = count(bucketTools, (t_5: Tool) => selectedSet.has(t_5.name)); const needsSelection = selected < bucketTools.length; return () => { const toolNames_1 = bucketTools.map(_temp4); @@ -321,7 +321,7 @@ export function ToolSelector(t0) { if (bucketTools_0.length === 0) { return; } - const selected_0 = count(bucketTools_0, (t_8: any) => selectedSet.has(t_8.name)); + const selected_0 = count(bucketTools_0, (t_8: Tool) => selectedSet.has(t_8.name)); const isFullySelected = selected_0 === bucketTools_0.length; navigableItems.push({ id, diff --git a/src/components/messages/SnipBoundaryMessage.ts b/src/components/messages/SnipBoundaryMessage.ts index 3b94518..898e2d0 100644 --- a/src/components/messages/SnipBoundaryMessage.ts +++ b/src/components/messages/SnipBoundaryMessage.ts @@ -1,3 +1,3 @@ // Auto-generated stub — replace with real implementation export {}; -export const SnipBoundaryMessage: any = (() => {}) as any; +export const SnipBoundaryMessage: (props: Record) => null = () => null; diff --git a/src/components/messages/UserCrossSessionMessage.ts b/src/components/messages/UserCrossSessionMessage.ts index 21b438e..5b86d78 100644 --- a/src/components/messages/UserCrossSessionMessage.ts +++ b/src/components/messages/UserCrossSessionMessage.ts @@ -1,3 +1,3 @@ // Auto-generated stub — replace with real implementation export {}; -export const UserCrossSessionMessage: any = (() => {}) as any; +export const UserCrossSessionMessage: (props: Record) => null = () => null; diff --git a/src/components/messages/UserForkBoilerplateMessage.ts b/src/components/messages/UserForkBoilerplateMessage.ts index df6fead..8d79de6 100644 --- a/src/components/messages/UserForkBoilerplateMessage.ts +++ b/src/components/messages/UserForkBoilerplateMessage.ts @@ -1,3 +1,3 @@ // Auto-generated stub — replace with real implementation export {}; -export const UserForkBoilerplateMessage: any = (() => {}) as any; +export const UserForkBoilerplateMessage: (props: Record) => null = () => null; diff --git a/src/components/messages/UserGitHubWebhookMessage.ts b/src/components/messages/UserGitHubWebhookMessage.ts index 4689a5e..6ed1e01 100644 --- a/src/components/messages/UserGitHubWebhookMessage.ts +++ b/src/components/messages/UserGitHubWebhookMessage.ts @@ -1,3 +1,3 @@ // Auto-generated stub — replace with real implementation export {}; -export const UserGitHubWebhookMessage: any = (() => {}) as any; +export const UserGitHubWebhookMessage: (props: Record) => null = () => null; diff --git a/src/components/permissions/MonitorPermissionRequest/MonitorPermissionRequest.ts b/src/components/permissions/MonitorPermissionRequest/MonitorPermissionRequest.ts index e84c239..ea96e4e 100644 --- a/src/components/permissions/MonitorPermissionRequest/MonitorPermissionRequest.ts +++ b/src/components/permissions/MonitorPermissionRequest/MonitorPermissionRequest.ts @@ -1,3 +1,3 @@ // Auto-generated stub — replace with real implementation export {}; -export const MonitorPermissionRequest: any = (() => {}) as any; +export const MonitorPermissionRequest: (props: Record) => null = () => null; diff --git a/src/components/permissions/ReviewArtifactPermissionRequest/ReviewArtifactPermissionRequest.ts b/src/components/permissions/ReviewArtifactPermissionRequest/ReviewArtifactPermissionRequest.ts index cd52659..a812ebe 100644 --- a/src/components/permissions/ReviewArtifactPermissionRequest/ReviewArtifactPermissionRequest.ts +++ b/src/components/permissions/ReviewArtifactPermissionRequest/ReviewArtifactPermissionRequest.ts @@ -1,3 +1,3 @@ // Auto-generated stub — replace with real implementation export {}; -export const ReviewArtifactPermissionRequest: any = (() => {}) as any; +export const ReviewArtifactPermissionRequest: (props: Record) => null = () => null; diff --git a/src/components/tasks/MonitorMcpDetailDialog.ts b/src/components/tasks/MonitorMcpDetailDialog.ts index 64d4c11..fca5d57 100644 --- a/src/components/tasks/MonitorMcpDetailDialog.ts +++ b/src/components/tasks/MonitorMcpDetailDialog.ts @@ -1,3 +1,3 @@ // Auto-generated stub — replace with real implementation export {}; -export const MonitorMcpDetailDialog: any = (() => {}) as any; +export const MonitorMcpDetailDialog: (props: Record) => null = () => null; diff --git a/src/components/tasks/WorkflowDetailDialog.ts b/src/components/tasks/WorkflowDetailDialog.ts index f8e7111..34509d0 100644 --- a/src/components/tasks/WorkflowDetailDialog.ts +++ b/src/components/tasks/WorkflowDetailDialog.ts @@ -1,3 +1,3 @@ // Auto-generated stub — replace with real implementation export {}; -export const WorkflowDetailDialog: any = (() => {}) as any; +export const WorkflowDetailDialog: (props: Record) => null = () => null; diff --git a/src/constants/betas.ts b/src/constants/betas.ts index d87dfc4..f1ba0c6 100644 --- a/src/constants/betas.ts +++ b/src/constants/betas.ts @@ -50,4 +50,4 @@ export const VERTEX_COUNT_TOKENS_ALLOWED_BETAS = new Set([ INTERLEAVED_THINKING_BETA_HEADER, CONTEXT_MANAGEMENT_BETA_HEADER, ]) -export const CACHE_EDITING_BETA_HEADER: any = (() => {}) as any; +export const CACHE_EDITING_BETA_HEADER: string = ''; diff --git a/src/coordinator/workerAgent.ts b/src/coordinator/workerAgent.ts index 4489762..e11e147 100644 --- a/src/coordinator/workerAgent.ts +++ b/src/coordinator/workerAgent.ts @@ -1,3 +1,4 @@ // Auto-generated stub — replace with real implementation export {}; -export const getCoordinatorAgents: any = (() => {}) as any; +import type { AgentDefinition } from '../tools/AgentTool/loadAgentsDir.js'; +export const getCoordinatorAgents: () => AgentDefinition[] = () => []; diff --git a/src/daemon/main.ts b/src/daemon/main.ts index c2e1c99..ce3a9fb 100644 --- a/src/daemon/main.ts +++ b/src/daemon/main.ts @@ -1,3 +1,3 @@ // Auto-generated stub — replace with real implementation export {}; -export const daemonMain: any = (() => {}) as any; +export const daemonMain: (args: string[]) => Promise = () => Promise.resolve(); diff --git a/src/daemon/workerRegistry.ts b/src/daemon/workerRegistry.ts index 0065803..4665990 100644 --- a/src/daemon/workerRegistry.ts +++ b/src/daemon/workerRegistry.ts @@ -1,3 +1,3 @@ // Auto-generated stub — replace with real implementation export {}; -export const runDaemonWorker: any = (() => {}) as any; +export const runDaemonWorker: (workerId: string) => Promise = () => Promise.resolve(); diff --git a/src/entrypoints/sdk/runtimeTypes.js b/src/entrypoints/sdk/runtimeTypes.js index bdcefcb..9ce95c9 100644 --- a/src/entrypoints/sdk/runtimeTypes.js +++ b/src/entrypoints/sdk/runtimeTypes.js @@ -1,2 +1,2 @@ // Auto-generated type stub — replace with real implementation -export type EffortLevel = any; +export type EffortLevel = 'low' | 'medium' | 'high' | 'max'; diff --git a/src/entrypoints/sdk/runtimeTypes.ts b/src/entrypoints/sdk/runtimeTypes.ts index 262fb9d..212c06e 100644 --- a/src/entrypoints/sdk/runtimeTypes.ts +++ b/src/entrypoints/sdk/runtimeTypes.ts @@ -3,8 +3,8 @@ * Non-serializable types: callbacks, interfaces with methods. */ -export type AnyZodRawShape = Record -export type InferShape = { [K in keyof T]: any } +export type AnyZodRawShape = Record +export type InferShape = { [K in keyof T]: unknown } export type ForkSessionOptions = { dir?: string; upToMessageId?: string; title?: string } export type ForkSessionResult = { sessionId: string } @@ -60,4 +60,4 @@ export interface Query { export interface InternalQuery extends Query { [key: string]: unknown } -export type EffortLevel = any; +export type EffortLevel = 'low' | 'medium' | 'high' | 'max'; diff --git a/src/environment-runner/main.ts b/src/environment-runner/main.ts index e60abec..d384342 100644 --- a/src/environment-runner/main.ts +++ b/src/environment-runner/main.ts @@ -1,3 +1,3 @@ // Auto-generated stub — replace with real implementation export {}; -export const environmentRunnerMain: any = (() => {}) as any; +export const environmentRunnerMain: (args: string[]) => Promise = () => Promise.resolve(); diff --git a/src/hooks/src/tools/AgentTool/loadAgentsDir.ts b/src/hooks/src/tools/AgentTool/loadAgentsDir.ts index 527a816..3fa66c4 100644 --- a/src/hooks/src/tools/AgentTool/loadAgentsDir.ts +++ b/src/hooks/src/tools/AgentTool/loadAgentsDir.ts @@ -1,2 +1,2 @@ // Auto-generated type stub — replace with real implementation -export type AgentDefinition = any; +export type AgentDefinition = { name: string; [key: string]: unknown }; diff --git a/src/hooks/useManagePlugins.ts b/src/hooks/useManagePlugins.ts index 994b9d3..5029f45 100644 --- a/src/hooks/useManagePlugins.ts +++ b/src/hooks/useManagePlugins.ts @@ -21,6 +21,7 @@ import { loadPluginMcpServers } from '../utils/plugins/mcpPluginIntegration.js' import { detectAndUninstallDelistedPlugins } from '../utils/plugins/pluginBlocklist.js' import { getFlaggedPlugins } from '../utils/plugins/pluginFlagging.js' import { loadAllPlugins } from '../utils/plugins/pluginLoader.js' +import type { PluginLoadResult } from '../types/plugin.js' /** * Hook to manage plugin state and synchronize with AppState. @@ -51,7 +52,7 @@ export function useManagePlugins({ const initialPluginLoad = useCallback(async () => { try { // Load all plugins - capture errors array - const { enabled, disabled, errors } = await loadAllPlugins() + const { enabled, disabled, errors }: PluginLoadResult = await loadAllPlugins() // Detect delisted plugins, auto-uninstall them, and record as flagged. await detectAndUninstallDelistedPlugins() @@ -188,9 +189,9 @@ export function useManagePlugins({ if (!p.hooksConfig) return sum return ( sum + - Object.values(p.hooksConfig).reduce( + (Object.values(p.hooksConfig) as Array | undefined>).reduce( (s, matchers) => - s + ((matchers as any)?.reduce((h: number, m: any) => h + m.hooks.length, 0) ?? 0), + s + (matchers?.reduce((h: number, m: { hooks: unknown[] }) => h + m.hooks.length, 0) ?? 0), 0, ) ) @@ -199,8 +200,8 @@ export function useManagePlugins({ return { enabled_count: enabled.length, disabled_count: disabled.length, - inline_count: count(enabled, (p: any) => p.source.endsWith('@inline')), - marketplace_count: count(enabled, (p: any) => !p.source.endsWith('@inline')), + inline_count: count(enabled, p => p.source.endsWith('@inline')), + marketplace_count: count(enabled, p => !p.source.endsWith('@inline')), error_count: errors.length, skill_count: commands.length, agent_count: agents.length, diff --git a/src/hooks/useReplBridge.tsx b/src/hooks/useReplBridge.tsx index 91fe582..a70bc2b 100644 --- a/src/hooks/useReplBridge.tsx +++ b/src/hooks/useReplBridge.tsx @@ -196,7 +196,9 @@ export function useReplBridge(messages: Message[], setMessages: (action: React.S sanitizeInboundWebhookContent } = require('../bridge/webhookSanitizer.js') as typeof import('../bridge/webhookSanitizer.js'); /* eslint-enable @typescript-eslint/no-require-imports */ - sanitized = sanitizeInboundWebhookContent(fields.content); + if (typeof fields.content === 'string') { + sanitized = sanitizeInboundWebhookContent(fields.content); + } } const content = await resolveAndPrepend(msg, sanitized); const preview = typeof content === 'string' ? content.slice(0, 80) : `[${content.length} content blocks]`; diff --git a/src/hooks/useSSHSession.ts b/src/hooks/useSSHSession.ts index 35b3a06..1453231 100644 --- a/src/hooks/useSSHSession.ts +++ b/src/hooks/useSSHSession.ts @@ -21,7 +21,7 @@ import { isSessionEndMessage, } from '../remote/sdkMessageAdapter.js' import type { SSHSession } from '../ssh/createSSHSession.js' -import type { SSHSessionManager } from '../ssh/SSHSessionManager.js' +import type { SSHSessionManager, SSHPermissionRequest } from '../ssh/SSHSessionManager.js' import type { Tool } from '../Tool.js' import { findToolByName } from '../Tool.js' import type { Message as MessageType } from '../types/message.js' diff --git a/src/ink/reconciler.ts b/src/ink/reconciler.ts index f5c6813..831366f 100644 --- a/src/ink/reconciler.ts +++ b/src/ink/reconciler.ts @@ -35,8 +35,8 @@ if (process.env.NODE_ENV === 'development') { // eslint-disable-next-line custom-rules/no-top-level-dynamic-import -- dev-only; NODE_ENV check is DCE'd in production void import('./devtools.js') // eslint-disable-next-line @typescript-eslint/no-explicit-any - } catch (error: any) { - if (error.code === 'ERR_MODULE_NOT_FOUND') { + } catch (error: unknown) { + if (error instanceof Error && (error as NodeJS.ErrnoException).code === 'ERR_MODULE_NOT_FOUND') { // biome-ignore lint/suspicious/noConsole: intentional warning console.warn( ` diff --git a/src/jobs/classifier.ts b/src/jobs/classifier.ts index 8e29d2a..8cd2663 100644 --- a/src/jobs/classifier.ts +++ b/src/jobs/classifier.ts @@ -1,3 +1,3 @@ // Auto-generated stub — replace with real implementation export {}; -export const classifyAndWriteState: any = (() => {}) as any; +export const classifyAndWriteState: (...args: unknown[]) => Promise = () => Promise.resolve(); diff --git a/src/keybindings/template.ts b/src/keybindings/template.ts index fafdcd8..2b069d7 100644 --- a/src/keybindings/template.ts +++ b/src/keybindings/template.ts @@ -25,7 +25,7 @@ function filterReservedShortcuts(blocks: KeybindingBlock[]): KeybindingBlock[] { const filteredBindings: Record = {} for (const [key, action] of Object.entries(block.bindings)) { if (!reservedKeys.has(normalizeKeyForComparison(key))) { - filteredBindings[key] = action + filteredBindings[key] = action as string | null } } return { context: block.context, bindings: filteredBindings } diff --git a/src/main.tsx b/src/main.tsx index a2ee69b..27cd8a3 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -3032,7 +3032,7 @@ async function run(): Promise { // KAIROS block so Agent(name: "foo") can spawn in-process teammates // without TeamCreate. computeInitialTeamContext() is for tmux-spawned // teammates reading their own identity, not the assistant-mode leader. - teamContext: feature('KAIROS') ? assistantTeamContext ?? computeInitialTeamContext?.() : computeInitialTeamContext?.() + teamContext: (feature('KAIROS') ? assistantTeamContext ?? computeInitialTeamContext?.() : computeInitialTeamContext?.()) || undefined }; // Add CLI initial prompt to history diff --git a/src/memdir/memoryShapeTelemetry.ts b/src/memdir/memoryShapeTelemetry.ts index 4a54291..60c31ac 100644 --- a/src/memdir/memoryShapeTelemetry.ts +++ b/src/memdir/memoryShapeTelemetry.ts @@ -1,4 +1,7 @@ // Auto-generated stub — replace with real implementation +import type { MemoryHeader } from './memoryScan.js'; +import type { MemoryScope } from '../utils/memoryFileDetection.js'; + export {}; -export const logMemoryRecallShape: any = (() => {}) as any; -export const logMemoryWriteShape: any = (() => {}) as any; +export const logMemoryRecallShape: (memories: MemoryHeader[], selected: MemoryHeader[]) => void = (() => {}); +export const logMemoryWriteShape: (toolName: string, toolInput: Record, filePath: string, scope: MemoryScope) => void = (() => {}); diff --git a/src/proactive/index.ts b/src/proactive/index.ts index c7f7bfc..e4c87a4 100644 --- a/src/proactive/index.ts +++ b/src/proactive/index.ts @@ -1,6 +1,6 @@ // Auto-generated stub — replace with real implementation export {}; -export const isProactiveActive: any = (() => {}) as any; -export const activateProactive: any = (() => {}) as any; -export const isProactivePaused: any = (() => {}) as any; -export const deactivateProactive: any = (() => {}) as any; +export const isProactiveActive: () => boolean = () => false; +export const activateProactive: (source?: string) => void = () => {}; +export const isProactivePaused: () => boolean = () => false; +export const deactivateProactive: () => void = () => {}; diff --git a/src/query.ts b/src/query.ts index 259f424..fec85af 100644 --- a/src/query.ts +++ b/src/query.ts @@ -802,7 +802,7 @@ async function* queryLoop( if (feature('CONTEXT_COLLAPSE')) { if ( contextCollapse?.isWithheldPromptTooLong( - message, + message as Message, isPromptTooLongMessage, querySource, ) @@ -810,12 +810,12 @@ async function* queryLoop( withheld = true } } - if (reactiveCompact?.isWithheldPromptTooLong(message)) { + if (reactiveCompact?.isWithheldPromptTooLong(message as Message)) { withheld = true } if ( mediaRecoveryEnabled && - reactiveCompact?.isWithheldMediaSizeError(message) + reactiveCompact?.isWithheldMediaSizeError(message as Message) ) { withheld = true } diff --git a/src/self-hosted-runner/main.ts b/src/self-hosted-runner/main.ts index 5e4ecd8..09139d2 100644 --- a/src/self-hosted-runner/main.ts +++ b/src/self-hosted-runner/main.ts @@ -1,3 +1,3 @@ // Auto-generated stub — replace with real implementation export {}; -export const selfHostedRunnerMain: any = (() => {}) as any; +export const selfHostedRunnerMain: (args: string[]) => Promise = () => Promise.resolve(); diff --git a/src/server/backends/dangerousBackend.ts b/src/server/backends/dangerousBackend.ts index 7ba48a6..8bb43e5 100644 --- a/src/server/backends/dangerousBackend.ts +++ b/src/server/backends/dangerousBackend.ts @@ -1,3 +1,3 @@ // Auto-generated stub — replace with real implementation export {}; -export const DangerousBackend: any = (() => {}) as any; +export const DangerousBackend: new (...args: unknown[]) => Record = class {} as never; diff --git a/src/server/connectHeadless.ts b/src/server/connectHeadless.ts index b365bf5..110ea47 100644 --- a/src/server/connectHeadless.ts +++ b/src/server/connectHeadless.ts @@ -1,3 +1,3 @@ // Auto-generated stub — replace with real implementation export {}; -export const runConnectHeadless: any = (() => {}) as any; +export const runConnectHeadless: (...args: unknown[]) => Promise = () => Promise.resolve(); diff --git a/src/server/lockfile.ts b/src/server/lockfile.ts index fd5f8c0..7efc3e8 100644 --- a/src/server/lockfile.ts +++ b/src/server/lockfile.ts @@ -1,5 +1,13 @@ // Auto-generated stub — replace with real implementation -export {}; -export const writeServerLock: any = (() => {}) as any; -export const removeServerLock: any = (() => {}) as any; -export const probeRunningServer: any = (() => {}) as any; + +export interface ServerLockInfo { + pid: number + port: number + host: string + httpUrl: string + startedAt: number +} + +export const writeServerLock: (info: ServerLockInfo) => Promise = (async () => {}); +export const removeServerLock: () => Promise = (async () => {}); +export const probeRunningServer: () => Promise = (async () => null); diff --git a/src/server/parseConnectUrl.ts b/src/server/parseConnectUrl.ts index edaaf0c..f60ad4e 100644 --- a/src/server/parseConnectUrl.ts +++ b/src/server/parseConnectUrl.ts @@ -1,3 +1,3 @@ // Auto-generated stub — replace with real implementation export {}; -export const parseConnectUrl: any = (() => {}) as any; +export const parseConnectUrl: (url: string) => { serverUrl: string; authToken: string; [key: string]: unknown } = () => ({ serverUrl: '', authToken: '' }); diff --git a/src/server/server.ts b/src/server/server.ts index b4f4d83..94a3771 100644 --- a/src/server/server.ts +++ b/src/server/server.ts @@ -1,3 +1,3 @@ // Auto-generated stub — replace with real implementation export {}; -export const startServer: any = (() => {}) as any; +export const startServer: (...args: unknown[]) => { port?: number; stop: (closeActiveConnections: boolean) => void } = () => ({ stop() {} }); diff --git a/src/server/serverBanner.ts b/src/server/serverBanner.ts index 7066fdd..b91b6b4 100644 --- a/src/server/serverBanner.ts +++ b/src/server/serverBanner.ts @@ -1,3 +1,3 @@ // Auto-generated stub — replace with real implementation export {}; -export const printBanner: any = (() => {}) as any; +export const printBanner: (...args: unknown[]) => void = () => {}; diff --git a/src/server/serverLog.ts b/src/server/serverLog.ts index 21142d5..e89c000 100644 --- a/src/server/serverLog.ts +++ b/src/server/serverLog.ts @@ -1,3 +1,3 @@ // Auto-generated stub — replace with real implementation export {}; -export const createServerLogger: any = (() => {}) as any; +export const createServerLogger: () => Record = () => ({}); diff --git a/src/server/sessionManager.ts b/src/server/sessionManager.ts index 0bc5b7e..5684d78 100644 --- a/src/server/sessionManager.ts +++ b/src/server/sessionManager.ts @@ -1,3 +1,3 @@ // Auto-generated stub — replace with real implementation export {}; -export const SessionManager: any = (() => {}) as any; +export const SessionManager: new (...args: unknown[]) => { destroyAll(): Promise; [key: string]: unknown } = class { async destroyAll() {} } as never; diff --git a/src/services/PromptSuggestion/promptSuggestion.ts b/src/services/PromptSuggestion/promptSuggestion.ts index 8f636ee..69412f7 100644 --- a/src/services/PromptSuggestion/promptSuggestion.ts +++ b/src/services/PromptSuggestion/promptSuggestion.ts @@ -334,22 +334,22 @@ export async function generateSuggestion( const firstAssistantMsg = result.messages.find(m => m.type === 'assistant') const generationRequestId = firstAssistantMsg?.type === 'assistant' - ? (firstAssistantMsg.requestId ?? null) + ? ((firstAssistantMsg.requestId as string) ?? null) : null for (const msg of result.messages) { if (msg.type !== 'assistant') continue - const contentArr = Array.isArray(msg.message.content) ? msg.message.content : [] + const contentArr = Array.isArray(msg.message.content) ? msg.message.content as Array<{ type: string; text?: string }> : [] const textBlock = contentArr.find(b => b.type === 'text') - if (textBlock?.type === 'text') { + if (textBlock?.type === 'text' && typeof textBlock.text === 'string') { const suggestion = textBlock.text.trim() if (suggestion) { - return { suggestion: textBlock.text.trim() as string, generationRequestId } + return { suggestion, generationRequestId } } } } - return { suggestion: null as string | null, generationRequestId } + return { suggestion: null as (string | null), generationRequestId } } export function shouldFilterSuggestion( diff --git a/src/services/api/claude.ts b/src/services/api/claude.ts index a5c03a6..c45ea63 100644 --- a/src/services/api/claude.ts +++ b/src/services/api/claude.ts @@ -2079,7 +2079,7 @@ async function* queryModel( }) throw new Error('Content block is not a connector_text block') } - contentBlock.connector_text += delta.connector_text + ;(contentBlock as { connector_text: string }).connector_text += delta.connector_text } else { switch (delta.type) { case 'citations_delta': @@ -2123,7 +2123,7 @@ async function* queryModel( }) throw new Error('Content block is not a text block') } - contentBlock.text += delta.text + ;(contentBlock as { text: string }).text += delta.text break case 'signature_delta': if ( @@ -2158,7 +2158,7 @@ async function* queryModel( }) throw new Error('Content block is not a thinking block') } - contentBlock.thinking += delta.thinking + ;(contentBlock as { thinking: string }).thinking += delta.thinking break } } diff --git a/src/services/api/client.ts b/src/services/api/client.ts index ccc9672..166eaad 100644 --- a/src/services/api/client.ts +++ b/src/services/api/client.ts @@ -159,7 +159,7 @@ export async function getAnthropicClient({ ? process.env.ANTHROPIC_SMALL_FAST_MODEL_AWS_REGION : getAWSRegion() - const bedrockArgs: any = { + const bedrockArgs: Record = { ...ARGS, awsRegion, ...(isEnvTruthy(process.env.CLAUDE_CODE_SKIP_BEDROCK_AUTH) && { @@ -173,7 +173,7 @@ export async function getAnthropicClient({ bedrockArgs.skipAuth = true // Add the Bearer token for Bedrock API key authentication bedrockArgs.defaultHeaders = { - ...bedrockArgs.defaultHeaders, + ...(bedrockArgs.defaultHeaders as Record | undefined), Authorization: `Bearer ${process.env.AWS_BEARER_TOKEN_BEDROCK}`, } } else if (!isEnvTruthy(process.env.CLAUDE_CODE_SKIP_BEDROCK_AUTH)) { diff --git a/src/services/api/promptCacheBreakDetection.ts b/src/services/api/promptCacheBreakDetection.ts index 1599d53..0630721 100644 --- a/src/services/api/promptCacheBreakDetection.ts +++ b/src/services/api/promptCacheBreakDetection.ts @@ -459,7 +459,7 @@ export async function checkResponseForCacheBreak( // assistant message timestamp in the messages array (before the current response) const lastAssistantMessage = messages.findLast(m => m.type === 'assistant') const timeSinceLastAssistantMsg = lastAssistantMessage - ? Date.now() - new Date(lastAssistantMessage.timestamp).getTime() + ? Date.now() - new Date(lastAssistantMessage.timestamp as string | number).getTime() : null // Skip the first call — no previous value to compare against diff --git a/src/services/api/sessionIngress.ts b/src/services/api/sessionIngress.ts index a664316..ae24a56 100644 --- a/src/services/api/sessionIngress.ts +++ b/src/services/api/sessionIngress.ts @@ -232,7 +232,7 @@ export async function getSessionLogs( // Update our lastUuid to the last entry's UUID const lastEntry = logs.at(-1) if (lastEntry && 'uuid' in lastEntry && lastEntry.uuid) { - lastUuidMap.set(sessionId, lastEntry.uuid as string) + lastUuidMap.set(sessionId, lastEntry.uuid as UUID) } } diff --git a/src/services/api/src/types/connectorText.ts b/src/services/api/src/types/connectorText.ts index 46108d9..6af50eb 100644 --- a/src/services/api/src/types/connectorText.ts +++ b/src/services/api/src/types/connectorText.ts @@ -1,2 +1,2 @@ // Auto-generated type stub — replace with real implementation -export type isConnectorTextBlock = any; +export type isConnectorTextBlock = (block: unknown) => boolean; diff --git a/src/services/api/src/utils/effort.ts b/src/services/api/src/utils/effort.ts index f91f421..c3acecb 100644 --- a/src/services/api/src/utils/effort.ts +++ b/src/services/api/src/utils/effort.ts @@ -1,4 +1,4 @@ // Auto-generated type stub — replace with real implementation -export type EffortValue = any; -export type modelSupportsEffort = any; -export type EffortLevel = any; +export type EffortValue = 'low' | 'medium' | 'high' | 'max' | number; +export type modelSupportsEffort = (model: string) => boolean; +export type EffortLevel = 'low' | 'medium' | 'high' | 'max'; diff --git a/src/services/compact/cachedMCConfig.ts b/src/services/compact/cachedMCConfig.ts index 5f51bab..67d7264 100644 --- a/src/services/compact/cachedMCConfig.ts +++ b/src/services/compact/cachedMCConfig.ts @@ -1,3 +1,3 @@ // Auto-generated stub — replace with real implementation export {}; -export const getCachedMCConfig: any = (() => {}) as any; +export const getCachedMCConfig: () => { enabled?: boolean; systemPromptSuggestSummaries?: boolean; supportedModels?: string[]; [key: string]: unknown } = () => ({}); diff --git a/src/services/compact/reactiveCompact.ts b/src/services/compact/reactiveCompact.ts index e29f9b7..67c872c 100644 --- a/src/services/compact/reactiveCompact.ts +++ b/src/services/compact/reactiveCompact.ts @@ -1,8 +1,22 @@ // Auto-generated stub — replace with real implementation export {}; -export const isReactiveOnlyMode: any = (() => {}) as any; -export const reactiveCompactOnPromptTooLong: any = (() => {}) as any; -export const isReactiveCompactEnabled: any = (() => {}) as any; -export const isWithheldPromptTooLong: any = (() => {}) as any; -export const isWithheldMediaSizeError: any = (() => {}) as any; -export const tryReactiveCompact: any = (() => {}) as any; + +import type { Message } from 'src/types/message'; +import type { CompactionResult } from './compact.js'; + +export const isReactiveOnlyMode: () => boolean = () => false; +export const reactiveCompactOnPromptTooLong: ( + messages: Message[], + cacheSafeParams: Record, + options: { customInstructions?: string; trigger?: string }, +) => Promise<{ ok: boolean; reason?: string; result?: CompactionResult }> = async () => ({ ok: false }); +export const isReactiveCompactEnabled: () => boolean = () => false; +export const isWithheldPromptTooLong: (message: Message) => boolean = () => false; +export const isWithheldMediaSizeError: (message: Message) => boolean = () => false; +export const tryReactiveCompact: (params: { + hasAttempted: boolean; + querySource: string; + aborted: boolean; + messages: Message[]; + cacheSafeParams: Record; +}) => Promise = async () => null; diff --git a/src/services/compact/snipCompact.ts b/src/services/compact/snipCompact.ts index 39c9c04..ecd7217 100644 --- a/src/services/compact/snipCompact.ts +++ b/src/services/compact/snipCompact.ts @@ -1,7 +1,17 @@ // Auto-generated stub — replace with real implementation export {}; -export const isSnipMarkerMessage: any = (() => {}) as any; -export const snipCompactIfNeeded: any = (() => {}) as any; -export const isSnipRuntimeEnabled: any = (() => {}) as any; -export const shouldNudgeForSnips: any = (() => {}) as any; -export const SNIP_NUDGE_TEXT: any = (() => {}) as any; + +import type { Message } from 'src/types/message'; + +export const isSnipMarkerMessage: (message: Message) => boolean = () => false; +export const snipCompactIfNeeded: ( + messages: Message[], + options?: { force?: boolean }, +) => { messages: Message[]; executed: boolean; tokensFreed: number; boundaryMessage?: Message } = (messages) => ({ + messages, + executed: false, + tokensFreed: 0, +}); +export const isSnipRuntimeEnabled: () => boolean = () => false; +export const shouldNudgeForSnips: (messages: Message[]) => boolean = () => false; +export const SNIP_NUDGE_TEXT: string = ''; diff --git a/src/services/compact/snipProjection.ts b/src/services/compact/snipProjection.ts index c60ec5f..80efe38 100644 --- a/src/services/compact/snipProjection.ts +++ b/src/services/compact/snipProjection.ts @@ -1,4 +1,7 @@ // Auto-generated stub — replace with real implementation export {}; -export const isSnipBoundaryMessage: any = (() => {}) as any; -export const projectSnippedView: any = (() => {}) as any; + +import type { Message } from 'src/types/message'; + +export const isSnipBoundaryMessage: (message: Message) => boolean = () => false; +export const projectSnippedView: (messages: Message[]) => Message[] = (messages) => messages; diff --git a/src/services/contextCollapse/index.ts b/src/services/contextCollapse/index.ts index f503368..09fb3c5 100644 --- a/src/services/contextCollapse/index.ts +++ b/src/services/contextCollapse/index.ts @@ -1,10 +1,66 @@ // Auto-generated stub — replace with real implementation -export {}; -export const getStats: any = (() => {}) as any; -export const isContextCollapseEnabled: any = (() => {}) as any; -export const subscribe: any = (() => {}) as any; -export const applyCollapsesIfNeeded: any = (() => {}) as any; -export const isWithheldPromptTooLong: any = (() => {}) as any; -export const recoverFromOverflow: any = (() => {}) as any; -export const resetContextCollapse: any = (() => {}) as any; -export const initContextCollapse: any = (() => {}) as any; +import type { Message } from '../../types/message.js' +import type { ToolUseContext } from '../../Tool.js' +import type { QuerySource } from '../../constants/querySource.js' + +export interface ContextCollapseHealth { + totalSpawns: number + totalErrors: number + lastError: string | null + emptySpawnWarningEmitted: boolean + totalEmptySpawns: number +} + +export interface ContextCollapseStats { + collapsedSpans: number + collapsedMessages: number + stagedSpans: number + health: ContextCollapseHealth +} + +export interface CollapseResult { + messages: Message[] +} + +export interface DrainResult { + committed: number + messages: Message[] +} + +export const getStats: () => ContextCollapseStats = (() => ({ + collapsedSpans: 0, + collapsedMessages: 0, + stagedSpans: 0, + health: { + totalSpawns: 0, + totalErrors: 0, + lastError: null, + emptySpawnWarningEmitted: false, + totalEmptySpawns: 0, + }, +})); + +export const isContextCollapseEnabled: () => boolean = (() => false); + +export const subscribe: (callback: () => void) => () => void = ((_callback: () => void) => () => {}); + +export const applyCollapsesIfNeeded: ( + messages: Message[], + toolUseContext: ToolUseContext, + querySource: QuerySource, +) => Promise = (async (messages: Message[]) => ({ messages })); + +export const isWithheldPromptTooLong: ( + message: Message, + isPromptTooLongMessage: (msg: Message) => boolean, + querySource: QuerySource, +) => boolean = (() => false); + +export const recoverFromOverflow: ( + messages: Message[], + querySource: QuerySource, +) => DrainResult = ((messages: Message[]) => ({ committed: 0, messages })); + +export const resetContextCollapse: () => void = (() => {}); + +export const initContextCollapse: () => void = (() => {}); diff --git a/src/services/contextCollapse/operations.ts b/src/services/contextCollapse/operations.ts index 1feb6c1..731e30c 100644 --- a/src/services/contextCollapse/operations.ts +++ b/src/services/contextCollapse/operations.ts @@ -1,3 +1,4 @@ // Auto-generated stub — replace with real implementation export {}; -export const projectView: any = (() => {}) as any; +import type { Message } from 'src/types/message.js'; +export const projectView: (messages: Message[]) => Message[] = (messages) => messages; diff --git a/src/services/contextCollapse/persist.ts b/src/services/contextCollapse/persist.ts index d5a0814..b89c2b8 100644 --- a/src/services/contextCollapse/persist.ts +++ b/src/services/contextCollapse/persist.ts @@ -1,3 +1,3 @@ // Auto-generated stub — replace with real implementation export {}; -export const restoreFromEntries: any = (() => {}) as any; +export const restoreFromEntries: (...args: unknown[]) => void = () => {}; diff --git a/src/services/extractMemories/extractMemories.ts b/src/services/extractMemories/extractMemories.ts index 708d47d..ad6d574 100644 --- a/src/services/extractMemories/extractMemories.ts +++ b/src/services/extractMemories/extractMemories.ts @@ -273,7 +273,7 @@ function extractWrittenPaths(agentMessages: Message[]): string[] { // ============================================================================ type AppendSystemMessageFn = ( - msg: Exclude, + msg: SystemMessage, ) => void /** The active extractor function, set by initExtractMemories(). */ diff --git a/src/services/sessionTranscript/sessionTranscript.ts b/src/services/sessionTranscript/sessionTranscript.ts index 121abee..3b3b4e7 100644 --- a/src/services/sessionTranscript/sessionTranscript.ts +++ b/src/services/sessionTranscript/sessionTranscript.ts @@ -1,4 +1,6 @@ // Auto-generated stub — replace with real implementation +import type { Message } from '../../types/message.js'; + export {}; -export const writeSessionTranscriptSegment: any = (() => {}) as any; -export const flushOnDateChange: any = (() => {}) as any; +export const writeSessionTranscriptSegment: (messages: Message[]) => void = (() => {}); +export const flushOnDateChange: (messages: Message[], currentDate: string) => void = (() => {}); diff --git a/src/services/skillSearch/featureCheck.ts b/src/services/skillSearch/featureCheck.ts index 3880c55..ff8950f 100644 --- a/src/services/skillSearch/featureCheck.ts +++ b/src/services/skillSearch/featureCheck.ts @@ -1,3 +1,3 @@ // Auto-generated stub — replace with real implementation export {}; -export const isSkillSearchEnabled: any = (() => {}) as any; +export const isSkillSearchEnabled: () => boolean = () => false; diff --git a/src/services/skillSearch/localSearch.ts b/src/services/skillSearch/localSearch.ts index 679b8fd..f8139d6 100644 --- a/src/services/skillSearch/localSearch.ts +++ b/src/services/skillSearch/localSearch.ts @@ -1,3 +1,3 @@ // Auto-generated stub — replace with real implementation export {}; -export const clearSkillIndexCache: any = (() => {}) as any; +export const clearSkillIndexCache: () => void = () => {}; diff --git a/src/services/skillSearch/prefetch.ts b/src/services/skillSearch/prefetch.ts index 1940912..50c8729 100644 --- a/src/services/skillSearch/prefetch.ts +++ b/src/services/skillSearch/prefetch.ts @@ -1,5 +1,18 @@ // Auto-generated stub — replace with real implementation -export {}; -export const startSkillDiscoveryPrefetch: any = (() => {}) as any; -export const collectSkillDiscoveryPrefetch: any = (() => {}) as any; -export const getTurnZeroSkillDiscovery: any = (() => {}) as any; +import type { Attachment } from '../../utils/attachments.js' +import type { Message } from '../../types/message.js' +import type { ToolUseContext } from '../../Tool.js' + +export const startSkillDiscoveryPrefetch: ( + input: string | null, + messages: Message[], + toolUseContext: ToolUseContext, +) => Promise = (async () => []); +export const collectSkillDiscoveryPrefetch: ( + pending: Promise, +) => Promise = (async (pending) => pending); +export const getTurnZeroSkillDiscovery: ( + input: string, + messages: Message[], + context: ToolUseContext, +) => Promise = (async () => null); diff --git a/src/skills/bundled/skillify.ts b/src/skills/bundled/skillify.ts index daf9529..c147598 100644 --- a/src/skills/bundled/skillify.ts +++ b/src/skills/bundled/skillify.ts @@ -5,10 +5,11 @@ import { registerBundledSkill } from '../bundledSkills.js' function extractUserMessages(messages: Message[]): string[] { return messages - .filter((m): m is Extract => m.type === 'user') + .filter(m => m.type === 'user') .map(m => { - const content = m.message.content + const content = m.message?.content if (typeof content === 'string') return content + if (!Array.isArray(content)) return '' return content .filter( (b): b is Extract => b.type === 'text', diff --git a/src/skills/mcpSkills.ts b/src/skills/mcpSkills.ts index f535e24..122e62f 100644 --- a/src/skills/mcpSkills.ts +++ b/src/skills/mcpSkills.ts @@ -1,3 +1,7 @@ // Auto-generated stub — replace with real implementation export {}; -export const fetchMcpSkillsForClient: any = (() => {}) as any; +import type { Command } from 'src/types/command.js'; +export const fetchMcpSkillsForClient: ((...args: unknown[]) => Promise) & { cache: Map } = Object.assign( + (..._args: unknown[]) => Promise.resolve([] as Command[]), + { cache: new Map() } +); diff --git a/src/ssh/SSHSessionManager.ts b/src/ssh/SSHSessionManager.ts index c38bf76..6a2faae 100644 --- a/src/ssh/SSHSessionManager.ts +++ b/src/ssh/SSHSessionManager.ts @@ -1,2 +1,30 @@ // Auto-generated stub — replace with real implementation -export type SSHSessionManager = any; +import type { SDKMessage } from '../entrypoints/sdk/coreTypes.js' +import type { PermissionUpdate } from '../types/permissions.js' +import type { RemoteMessageContent } from '../utils/teleport/api.js' + +export interface SSHSessionManagerOptions { + onMessage: (sdkMessage: SDKMessage) => void + onPermissionRequest: (request: SSHPermissionRequest, requestId: string) => void + onConnected: () => void + onReconnecting: (attempt: number, max: number) => void + onDisconnected: () => void + onError: (error: Error) => void +} + +export interface SSHPermissionRequest { + tool_name: string + tool_use_id: string + description?: string + permission_suggestions?: PermissionUpdate[] + blocked_path?: string + input: { [key: string]: unknown } +} + +export interface SSHSessionManager { + connect(): void + disconnect(): void + sendMessage(content: RemoteMessageContent): Promise + sendInterrupt(): void + respondToPermissionRequest(requestId: string, response: { behavior: string; message?: string; updatedInput?: unknown }): void +} diff --git a/src/ssh/createSSHSession.ts b/src/ssh/createSSHSession.ts index c606586..1db14a1 100644 --- a/src/ssh/createSSHSession.ts +++ b/src/ssh/createSSHSession.ts @@ -1,5 +1,29 @@ // Auto-generated stub — replace with real implementation -export type SSHSession = any; -export const createSSHSession: any = (() => {}) as any; -export const createLocalSSHSession: any = (() => {}) as any; -export const SSHSessionError: any = (() => {}) as any; +import type { Subprocess } from 'bun' +import type { SSHSessionManager, SSHSessionManagerOptions } from './SSHSessionManager.js' + +export interface SSHAuthProxy { + stop(): void +} + +export interface SSHSession { + remoteCwd: string + proc: Subprocess + proxy: SSHAuthProxy + createManager(options: SSHSessionManagerOptions): SSHSessionManager + getStderrTail(): string +} + +export class SSHSessionError extends Error { + constructor(message: string) { + super(message) + this.name = 'SSHSessionError' + } +} + +export const createSSHSession: (...args: unknown[]) => Promise = (async () => { + throw new SSHSessionError('SSH sessions are not supported in this build') +}); +export const createLocalSSHSession: (...args: unknown[]) => Promise = (async () => { + throw new SSHSessionError('Local SSH sessions are not supported in this build') +}); diff --git a/src/tasks/LocalWorkflowTask/LocalWorkflowTask.ts b/src/tasks/LocalWorkflowTask/LocalWorkflowTask.ts index 6dea0a6..f2f9131 100644 --- a/src/tasks/LocalWorkflowTask/LocalWorkflowTask.ts +++ b/src/tasks/LocalWorkflowTask/LocalWorkflowTask.ts @@ -1,5 +1,11 @@ // Auto-generated stub — replace with real implementation -export type LocalWorkflowTaskState = any; -export const killWorkflowTask: any = (() => {}) as any; -export const skipWorkflowAgent: any = (() => {}) as any; -export const retryWorkflowAgent: any = (() => {}) as any; +import type { TaskStateBase, SetAppState } from '../../Task.js' + +export type LocalWorkflowTaskState = TaskStateBase & { + type: 'local_workflow' + summary?: string + description: string +} +export const killWorkflowTask: (id: string, setAppState: SetAppState) => void = (() => {}); +export const skipWorkflowAgent: (id: string, agentId: string, setAppState: SetAppState) => void = (() => {}); +export const retryWorkflowAgent: (id: string, agentId: string, setAppState: SetAppState) => void = (() => {}); diff --git a/src/tasks/MonitorMcpTask/MonitorMcpTask.ts b/src/tasks/MonitorMcpTask/MonitorMcpTask.ts index 965c054..59edd09 100644 --- a/src/tasks/MonitorMcpTask/MonitorMcpTask.ts +++ b/src/tasks/MonitorMcpTask/MonitorMcpTask.ts @@ -1,4 +1,10 @@ // Auto-generated stub — replace with real implementation -export type MonitorMcpTaskState = any; -export const killMonitorMcp: any = (() => {}) as any; -export const killMonitorMcpTasksForAgent: any = (() => {}) as any; +import type { TaskStateBase, SetAppState } from '../../Task.js'; +import type { AppState } from '../../state/AppState.js'; +import type { AgentId } from '../../types/ids.js'; + +export type MonitorMcpTaskState = TaskStateBase & { + type: 'monitor_mcp'; +}; +export const killMonitorMcp: (taskId: string, setAppState: SetAppState) => void = (() => {}); +export const killMonitorMcpTasksForAgent: (agentId: AgentId, getAppState: () => AppState, setAppState: SetAppState) => void = (() => {}); diff --git a/src/tools/AgentTool/UI.tsx b/src/tools/AgentTool/UI.tsx index 324f42a..368b35f 100644 --- a/src/tools/AgentTool/UI.tsx +++ b/src/tools/AgentTool/UI.tsx @@ -382,7 +382,7 @@ export function renderToolResultMessage(data: Output, progressMessagesForMessage inference_geo: null, iterations: null, speed: null - } + } as import('@anthropic-ai/sdk/resources/beta/messages/messages.mjs').BetaUsage }); return {("external" as string) === 'ant' && diff --git a/src/tools/BashTool/bashPermissions.ts b/src/tools/BashTool/bashPermissions.ts index 83b3c63..a8997f0 100644 --- a/src/tools/BashTool/bashPermissions.ts +++ b/src/tools/BashTool/bashPermissions.ts @@ -1783,7 +1783,7 @@ export async function bashToolHasPermission( if (earlyExit !== null) return earlyExit const decisionReason: PermissionDecisionReason = { type: 'other' as const, - reason: sem.reason, + reason: (sem as { ok: false; reason: string }).reason, } return { behavior: 'ask', @@ -1816,7 +1816,7 @@ export async function bashToolHasPermission( if (!parseResult.success) { const decisionReason = { type: 'other' as const, - reason: `Command contains malformed syntax that cannot be parsed: ${parseResult.error}`, + reason: `Command contains malformed syntax that cannot be parsed: ${(parseResult as { success: false; error: string }).error}`, } return { behavior: 'ask', diff --git a/src/tools/BashTool/sedValidation.ts b/src/tools/BashTool/sedValidation.ts index d6507db..989b9e3 100644 --- a/src/tools/BashTool/sedValidation.ts +++ b/src/tools/BashTool/sedValidation.ts @@ -403,7 +403,7 @@ export function extractSedExpressions(command: string): string[] { const parseResult = tryParseShellCommand(withoutSed) if (!parseResult.success) { // Malformed shell syntax - throw error to be caught by caller - throw new Error(`Malformed shell syntax: ${parseResult.error}`) + throw new Error(`Malformed shell syntax: ${(parseResult as { success: false; error: string }).error}`) } const parsed = parseResult.tokens try { diff --git a/src/tools/DiscoverSkillsTool/prompt.ts b/src/tools/DiscoverSkillsTool/prompt.ts index b498276..20ddc1a 100644 --- a/src/tools/DiscoverSkillsTool/prompt.ts +++ b/src/tools/DiscoverSkillsTool/prompt.ts @@ -1,3 +1,3 @@ // Auto-generated stub — replace with real implementation export {}; -export const DISCOVER_SKILLS_TOOL_NAME: any = (() => {}) as any; +export const DISCOVER_SKILLS_TOOL_NAME: string = ''; diff --git a/src/tools/FileReadTool/imageProcessor.ts b/src/tools/FileReadTool/imageProcessor.ts index 20afa90..87537ad 100644 --- a/src/tools/FileReadTool/imageProcessor.ts +++ b/src/tools/FileReadTool/imageProcessor.ts @@ -44,7 +44,7 @@ export async function getImageProcessor(): Promise { try { // Use the native image processor module const imageProcessor = await import('image-processor-napi') - const sharp = imageProcessor.sharp || imageProcessor.default + const sharp = (imageProcessor as Record).sharp || imageProcessor.default imageProcessorModule = { default: sharp } return sharp } catch { diff --git a/src/tools/MonitorTool/MonitorTool.ts b/src/tools/MonitorTool/MonitorTool.ts index 71be11b..a24da77 100644 --- a/src/tools/MonitorTool/MonitorTool.ts +++ b/src/tools/MonitorTool/MonitorTool.ts @@ -1,3 +1,3 @@ // Auto-generated stub — replace with real implementation export {}; -export const MonitorTool: any = (() => {}) as any; +export const MonitorTool: Record = {}; diff --git a/src/tools/OverflowTestTool/OverflowTestTool.ts b/src/tools/OverflowTestTool/OverflowTestTool.ts index bad391f..e3dfc5d 100644 --- a/src/tools/OverflowTestTool/OverflowTestTool.ts +++ b/src/tools/OverflowTestTool/OverflowTestTool.ts @@ -1,3 +1,3 @@ // Auto-generated stub — replace with real implementation export {}; -export const OVERFLOW_TEST_TOOL_NAME: any = (() => {}) as any; +export const OVERFLOW_TEST_TOOL_NAME: string = ''; diff --git a/src/tools/PowerShellTool/pathValidation.ts b/src/tools/PowerShellTool/pathValidation.ts index d26c74c..79813f1 100644 --- a/src/tools/PowerShellTool/pathValidation.ts +++ b/src/tools/PowerShellTool/pathValidation.ts @@ -907,8 +907,8 @@ function isPathAllowed( allowed: false, decisionReason: { type: 'safetyCheck', - reason: safetyCheck.message, - classifierApprovable: safetyCheck.classifierApprovable, + reason: (safetyCheck as { safe: false; message: string; classifierApprovable: boolean }).message, + classifierApprovable: (safetyCheck as { safe: false; message: string; classifierApprovable: boolean }).classifierApprovable, }, } } diff --git a/src/tools/ReviewArtifactTool/ReviewArtifactTool.ts b/src/tools/ReviewArtifactTool/ReviewArtifactTool.ts index eb04bc7..b141b60 100644 --- a/src/tools/ReviewArtifactTool/ReviewArtifactTool.ts +++ b/src/tools/ReviewArtifactTool/ReviewArtifactTool.ts @@ -1,3 +1,3 @@ // Auto-generated stub — replace with real implementation export {}; -export const ReviewArtifactTool: any = (() => {}) as any; +export const ReviewArtifactTool: Record = {}; diff --git a/src/tools/SendUserFileTool/prompt.ts b/src/tools/SendUserFileTool/prompt.ts index ad1dbf6..65f8174 100644 --- a/src/tools/SendUserFileTool/prompt.ts +++ b/src/tools/SendUserFileTool/prompt.ts @@ -1,3 +1,3 @@ // Auto-generated stub — replace with real implementation export {}; -export const SEND_USER_FILE_TOOL_NAME: any = (() => {}) as any; +export const SEND_USER_FILE_TOOL_NAME: string = ''; diff --git a/src/tools/SnipTool/prompt.ts b/src/tools/SnipTool/prompt.ts index 525f52d..dc82319 100644 --- a/src/tools/SnipTool/prompt.ts +++ b/src/tools/SnipTool/prompt.ts @@ -1,3 +1,3 @@ // Auto-generated stub — replace with real implementation export {}; -export const SNIP_TOOL_NAME: any = (() => {}) as any; +export const SNIP_TOOL_NAME: string = ''; diff --git a/src/tools/TaskOutputTool/TaskOutputTool.tsx b/src/tools/TaskOutputTool/TaskOutputTool.tsx index 02e82d6..2a28f57 100644 --- a/src/tools/TaskOutputTool/TaskOutputTool.tsx +++ b/src/tools/TaskOutputTool/TaskOutputTool.tsx @@ -220,7 +220,7 @@ export const TaskOutputTool: Tool = buildTool // Non-blocking: return current state if (task.status !== 'running' && task.status !== 'pending') { // Mark as notified - updateTaskState(task_id, toolUseContext.setAppState, t => ({ + updateTaskState(task_id, toolUseContext.setAppState, (t: TaskState) => ({ ...t, notified: true })); @@ -269,7 +269,7 @@ export const TaskOutputTool: Tool = buildTool } // Mark as notified - updateTaskState(task_id, toolUseContext.setAppState, t => ({ + updateTaskState(task_id, toolUseContext.setAppState, (t: TaskState) => ({ ...t, notified: true })); diff --git a/src/tools/TerminalCaptureTool/prompt.ts b/src/tools/TerminalCaptureTool/prompt.ts index 565bbf1..90c4589 100644 --- a/src/tools/TerminalCaptureTool/prompt.ts +++ b/src/tools/TerminalCaptureTool/prompt.ts @@ -1,3 +1,3 @@ // Auto-generated stub — replace with real implementation export {}; -export const TERMINAL_CAPTURE_TOOL_NAME: any = (() => {}) as any; +export const TERMINAL_CAPTURE_TOOL_NAME: string = ''; diff --git a/src/tools/TungstenTool/TungstenLiveMonitor.ts b/src/tools/TungstenTool/TungstenLiveMonitor.ts index 6f28974..3b1d890 100644 --- a/src/tools/TungstenTool/TungstenLiveMonitor.ts +++ b/src/tools/TungstenTool/TungstenLiveMonitor.ts @@ -1,2 +1,2 @@ // Auto-generated stub — replace with real implementation -export const TungstenLiveMonitor: any = (() => {}) as any; +export const TungstenLiveMonitor: (props: Record) => null = () => null; diff --git a/src/tools/TungstenTool/TungstenTool.ts b/src/tools/TungstenTool/TungstenTool.ts index e0ec66d..3542a05 100644 --- a/src/tools/TungstenTool/TungstenTool.ts +++ b/src/tools/TungstenTool/TungstenTool.ts @@ -1,4 +1,6 @@ // Auto-generated stub — replace with real implementation -export const TungstenTool: any = (() => {}) as any; -export const clearSessionsWithTungstenUsage: any = (() => {}) as any; -export const resetInitializationState: any = (() => {}) as any; +import type { Tool } from '../../Tool.js' + +export const TungstenTool: Tool = (() => {}) as unknown as Tool; +export const clearSessionsWithTungstenUsage: () => void = (() => {}); +export const resetInitializationState: () => void = (() => {}); diff --git a/src/tools/VerifyPlanExecutionTool/constants.ts b/src/tools/VerifyPlanExecutionTool/constants.ts index 122a40b..7d65d5d 100644 --- a/src/tools/VerifyPlanExecutionTool/constants.ts +++ b/src/tools/VerifyPlanExecutionTool/constants.ts @@ -1,3 +1,3 @@ // Auto-generated stub — replace with real implementation export {}; -export const VERIFY_PLAN_EXECUTION_TOOL_NAME: any = (() => {}) as any; +export const VERIFY_PLAN_EXECUTION_TOOL_NAME: string = ''; diff --git a/src/tools/WebBrowserTool/WebBrowserPanel.ts b/src/tools/WebBrowserTool/WebBrowserPanel.ts index 870ac51..abbd389 100644 --- a/src/tools/WebBrowserTool/WebBrowserPanel.ts +++ b/src/tools/WebBrowserTool/WebBrowserPanel.ts @@ -1,3 +1,3 @@ // Auto-generated stub — replace with real implementation export {}; -export const WebBrowserPanel: any = (() => {}) as any; +export const WebBrowserPanel: (props: Record) => null = () => null; diff --git a/src/tools/WebFetchTool/utils.ts b/src/tools/WebFetchTool/utils.ts index 6d55f70..a805792 100644 --- a/src/tools/WebFetchTool/utils.ts +++ b/src/tools/WebFetchTool/utils.ts @@ -522,8 +522,8 @@ export async function applyPromptToMarkdown( const { content } = assistantMessage.message if (content.length > 0) { const contentBlock = content[0] - if ('text' in contentBlock!) { - return contentBlock.text + if (contentBlock && typeof contentBlock === 'object' && 'text' in contentBlock) { + return (contentBlock as { text: string }).text } } return 'No response from model' diff --git a/src/tools/WorkflowTool/WorkflowPermissionRequest.ts b/src/tools/WorkflowTool/WorkflowPermissionRequest.ts index 97ee001..8d51683 100644 --- a/src/tools/WorkflowTool/WorkflowPermissionRequest.ts +++ b/src/tools/WorkflowTool/WorkflowPermissionRequest.ts @@ -1,3 +1,3 @@ // Auto-generated stub — replace with real implementation export {}; -export const WorkflowPermissionRequest: any = (() => {}) as any; +export const WorkflowPermissionRequest: (props: Record) => null = () => null; diff --git a/src/tools/WorkflowTool/WorkflowTool.ts b/src/tools/WorkflowTool/WorkflowTool.ts index ce2fd7c..10873c7 100644 --- a/src/tools/WorkflowTool/WorkflowTool.ts +++ b/src/tools/WorkflowTool/WorkflowTool.ts @@ -1,3 +1,3 @@ // Auto-generated stub — replace with real implementation export {}; -export const WorkflowTool: any = (() => {}) as any; +export const WorkflowTool: Record = {}; diff --git a/src/tools/WorkflowTool/constants.ts b/src/tools/WorkflowTool/constants.ts index 16b10bd..9e49474 100644 --- a/src/tools/WorkflowTool/constants.ts +++ b/src/tools/WorkflowTool/constants.ts @@ -1,2 +1,2 @@ // Auto-generated stub — replace with real implementation -export const WORKFLOW_TOOL_NAME: any = (() => {}) as any; +export const WORKFLOW_TOOL_NAME: string = ''; diff --git a/src/tools/WorkflowTool/createWorkflowCommand.ts b/src/tools/WorkflowTool/createWorkflowCommand.ts index e05aba8..cf9046a 100644 --- a/src/tools/WorkflowTool/createWorkflowCommand.ts +++ b/src/tools/WorkflowTool/createWorkflowCommand.ts @@ -1,3 +1,3 @@ // Auto-generated stub — replace with real implementation export {}; -export const getWorkflowCommands: any = (() => {}) as any; +export const getWorkflowCommands: (...args: unknown[]) => unknown = () => {}; diff --git a/src/types/connectorText.ts b/src/types/connectorText.ts index a2e0fe1..a9aa085 100644 --- a/src/types/connectorText.ts +++ b/src/types/connectorText.ts @@ -1,4 +1,4 @@ // Auto-generated stub — replace with real implementation -export type ConnectorTextBlock = any; -export type ConnectorTextDelta = any; -export const isConnectorTextBlock: any = (() => {}) as any; +export type ConnectorTextBlock = { type: string; connector_text: string; signature?: string; [key: string]: unknown }; +export type ConnectorTextDelta = { type: string; connector_text: string; text?: string; thinking?: string; signature?: string; [key: string]: unknown }; +export const isConnectorTextBlock: (block: unknown) => block is ConnectorTextBlock = (_block): _block is ConnectorTextBlock => false; diff --git a/src/types/global.d.ts b/src/types/global.d.ts index cc5d367..ceb2f55 100644 --- a/src/types/global.d.ts +++ b/src/types/global.d.ts @@ -23,8 +23,8 @@ declare function MACRO(fn: () => T): T // These are referenced inside `MACRO(() => ...)` or `false && ...` blocks. // Model resolution (internal) -declare function resolveAntModel(model: string): any -declare function getAntModels(): any[] +declare function resolveAntModel(model: string): import('../utils/model/antModels.js').AntModel | undefined +declare function getAntModels(): import('../utils/model/antModels.js').AntModel[] declare function getAntModelOverrideConfig(): { defaultSystemPromptSuffix?: string [key: string]: unknown @@ -37,11 +37,12 @@ declare function fireCompanionObserver( ): void // Metrics (internal) -declare const apiMetricsRef: React.RefObject | null -declare function computeTtftText(metrics: any[]): string +type ApiMetricEntry = { ttftMs: number; firstTokenTime: number; lastTokenTime: number; responseLengthBaseline: number; endResponseLength: number } +declare const apiMetricsRef: React.RefObject | null +declare function computeTtftText(metrics: ApiMetricEntry[]): string // Gate/feature system (internal) -declare const Gates: Record +declare const Gates: Record declare function GateOverridesWarning(): JSX.Element | null declare function ExperimentEnrollmentNotice(): JSX.Element | null @@ -55,7 +56,7 @@ declare function launchUltraplan(...args: unknown[]): Promise // T — Generic type parameter leaked from React compiler output // (react/compiler-runtime emits compiled JSX that loses generic type params) -declare type T = any +declare type T = unknown // Tungsten (internal) declare function TungstenPill(props?: { key?: string; selected?: boolean }): JSX.Element | null @@ -68,15 +69,7 @@ declare const BUILD_ENV: string declare const INTERFACE_TYPE: string // ============================================================================ -// Ink custom JSX intrinsic elements — used by the internal Ink framework -declare namespace JSX { - interface IntrinsicElements { - 'ink-box': any; - 'ink-text': any; - 'ink-link': any; - 'ink-raw-ansi': any; - } -} +// Ink custom JSX intrinsic elements — see src/types/ink-jsx.d.ts // ============================================================================ // Bun text/file loaders — allow importing non-TS assets as strings diff --git a/src/types/hooks.ts b/src/types/hooks.ts index fd779f8..313ceb4 100644 --- a/src/types/hooks.ts +++ b/src/types/hooks.ts @@ -193,12 +193,10 @@ export function isAsyncHookJSONOutput( } // Compile-time assertion that SDK and Zod types match -import type { IsEqual } from 'type-fest' -type Assert = T -// @ts-expect-error decompilation type mismatch -type _assertSDKTypesMatch = Assert< - IsEqual -> +// Disabled: decompilation type mismatch makes these types non-equal +// import type { IsEqual } from 'type-fest' +// type Assert = T +// type _assertSDKTypesMatch = Assert> /** Context passed to callback hooks for state access */ export type HookCallbackContext = { diff --git a/src/types/ink-elements.d.ts b/src/types/ink-elements.d.ts index 535c172..d505328 100644 --- a/src/types/ink-elements.d.ts +++ b/src/types/ink-elements.d.ts @@ -1,11 +1,47 @@ // Type declarations for custom Ink JSX elements +// Note: The detailed prop types are defined in ink-jsx.d.ts via React module augmentation. +// This file provides the global JSX namespace fallback declarations. +import type { ReactNode, Ref } from 'react'; +import type { ClickEvent } from '../ink/events/click-event.js'; +import type { FocusEvent } from '../ink/events/focus-event.js'; +import type { KeyboardEvent } from '../ink/events/keyboard-event.js'; +import type { Styles, TextStyles } from '../ink/styles.js'; +import type { DOMElement } from '../ink/dom.js'; + declare global { namespace JSX { interface IntrinsicElements { - 'ink-box': any; - 'ink-text': any; - 'ink-link': any; - 'ink-raw-ansi': any; + 'ink-box': { + ref?: Ref; + tabIndex?: number; + autoFocus?: boolean; + onClick?: (event: ClickEvent) => void; + onFocus?: (event: FocusEvent) => void; + onFocusCapture?: (event: FocusEvent) => void; + onBlur?: (event: FocusEvent) => void; + onBlurCapture?: (event: FocusEvent) => void; + onMouseEnter?: () => void; + onMouseLeave?: () => void; + onKeyDown?: (event: KeyboardEvent) => void; + onKeyDownCapture?: (event: KeyboardEvent) => void; + style?: Styles; + stickyScroll?: boolean; + children?: ReactNode; + }; + 'ink-text': { + style?: Styles; + textStyles?: TextStyles; + children?: ReactNode; + }; + 'ink-link': { + href?: string; + children?: ReactNode; + }; + 'ink-raw-ansi': { + rawText?: string; + rawWidth?: number; + rawHeight?: number; + }; } } } diff --git a/src/types/ink-jsx.d.ts b/src/types/ink-jsx.d.ts new file mode 100644 index 0000000..8c37049 --- /dev/null +++ b/src/types/ink-jsx.d.ts @@ -0,0 +1,54 @@ +/** + * Ink custom JSX intrinsic elements. + * + * With "jsx": "react-jsx", TypeScript resolves JSX types from react/jsx-runtime + * whose IntrinsicElements extends React.JSX.IntrinsicElements. We augment the + * 'react' module to inject our custom elements into React.JSX.IntrinsicElements. + * + * This file must be a module (have an import/export) for `declare module` + * augmentation to work correctly. + */ +import type { ReactNode, Ref } from 'react'; +import type { ClickEvent } from '../ink/events/click-event.js'; +import type { FocusEvent } from '../ink/events/focus-event.js'; +import type { KeyboardEvent } from '../ink/events/keyboard-event.js'; +import type { Styles, TextStyles } from '../ink/styles.js'; +import type { DOMElement } from '../ink/dom.js'; + +declare module 'react' { + namespace JSX { + interface IntrinsicElements { + 'ink-box': { + ref?: Ref; + tabIndex?: number; + autoFocus?: boolean; + onClick?: (event: ClickEvent) => void; + onFocus?: (event: FocusEvent) => void; + onFocusCapture?: (event: FocusEvent) => void; + onBlur?: (event: FocusEvent) => void; + onBlurCapture?: (event: FocusEvent) => void; + onMouseEnter?: () => void; + onMouseLeave?: () => void; + onKeyDown?: (event: KeyboardEvent) => void; + onKeyDownCapture?: (event: KeyboardEvent) => void; + style?: Styles; + stickyScroll?: boolean; + children?: ReactNode; + }; + 'ink-text': { + style?: Styles; + textStyles?: TextStyles; + children?: ReactNode; + }; + 'ink-link': { + href?: string; + children?: ReactNode; + }; + 'ink-raw-ansi': { + rawText?: string; + rawWidth?: number; + rawHeight?: number; + }; + } + } +} diff --git a/src/types/internal-modules.d.ts b/src/types/internal-modules.d.ts index 03f4708..bf1d214 100644 --- a/src/types/internal-modules.d.ts +++ b/src/types/internal-modules.d.ts @@ -13,7 +13,7 @@ declare module "bun:bundle" { } declare module "bun:ffi" { - export function dlopen(path: string, symbols: Record): any; + export function dlopen>(path: string, symbols: T): { symbols: { [K in keyof T]: (...args: unknown[]) => unknown }; close(): void }; } // diff --git a/src/utils/attachments.ts b/src/utils/attachments.ts index 4dc162c..8cc818a 100644 --- a/src/utils/attachments.ts +++ b/src/utils/attachments.ts @@ -802,13 +802,14 @@ export async function getAttachments( skillSearchModules && !options?.skipSkillDiscovery ? [ - maybe('skill_discovery', () => - skillSearchModules.prefetch.getTurnZeroSkillDiscovery( + maybe('skill_discovery', async () => { + const result = await skillSearchModules.prefetch.getTurnZeroSkillDiscovery( input, messages ?? [], context, - ), - ), + ) + return result ? [result] : [] + }), ] : []), ] diff --git a/src/utils/attributionHooks.ts b/src/utils/attributionHooks.ts index 7bef7c6..3ce54f9 100644 --- a/src/utils/attributionHooks.ts +++ b/src/utils/attributionHooks.ts @@ -1,5 +1,4 @@ // Auto-generated stub — replace with real implementation -export {}; -export const clearAttributionCaches: any = (() => {}) as any; -export const sweepFileContentCache: any = (() => {}) as any; -export const registerAttributionHooks: any = (() => {}) as any; +export const clearAttributionCaches: () => void = () => {}; +export const sweepFileContentCache: () => void = () => {}; +export const registerAttributionHooks: () => void = () => {}; diff --git a/src/utils/attributionTrailer.ts b/src/utils/attributionTrailer.ts index 46b7e3b..6761691 100644 --- a/src/utils/attributionTrailer.ts +++ b/src/utils/attributionTrailer.ts @@ -1,3 +1,3 @@ // Auto-generated stub — replace with real implementation export {}; -export const buildPRTrailers: any = (() => {}) as any; +export const buildPRTrailers: (attributionData: unknown, attribution: unknown) => string[] = () => []; diff --git a/src/utils/ccshareResume.ts b/src/utils/ccshareResume.ts index 1efb038..297f08b 100644 --- a/src/utils/ccshareResume.ts +++ b/src/utils/ccshareResume.ts @@ -1,4 +1,4 @@ // Auto-generated stub — replace with real implementation -export {}; -export const parseCcshareId: any = (() => {}) as any; -export const loadCcshare: any = (() => {}) as any; +import type { LogOption } from 'src/types/logs.js'; +export const parseCcshareId: (resume: string) => string | null = () => null; +export const loadCcshare: (ccshareId: string) => Promise = async () => { throw new Error('ccshare not implemented'); }; diff --git a/src/utils/cliHighlight.ts b/src/utils/cliHighlight.ts index 111f8a4..e87663c 100644 --- a/src/utils/cliHighlight.ts +++ b/src/utils/cliHighlight.ts @@ -18,14 +18,14 @@ export type CliHighlight = { // faulted in. let cliHighlightPromise: Promise | undefined -let loadedGetLanguage: any +let loadedGetLanguage: ((name: string) => { name: string } | undefined) | undefined async function loadCliHighlight(): Promise { try { const cliHighlight = await import('cli-highlight') // cache hit — cli-highlight already loaded highlight.js const highlightJs = await import('highlight.js') - loadedGetLanguage = (highlightJs as any).getLanguage + loadedGetLanguage = (highlightJs as { getLanguage?: typeof loadedGetLanguage }).getLanguage return { highlight: cliHighlight.highlight, supportsLanguage: cliHighlight.supportsLanguage, diff --git a/src/utils/effort.ts b/src/utils/effort.ts index c576b50..abca97b 100644 --- a/src/utils/effort.ts +++ b/src/utils/effort.ts @@ -285,7 +285,7 @@ export function getDefaultEffortForModel( config?.defaultModel !== undefined && model.toLowerCase() === (config.defaultModel as string).toLowerCase() if (isDefaultModel && config?.defaultModelEffortLevel) { - return config.defaultModelEffortLevel + return config.defaultModelEffortLevel as EffortValue } const antModel = resolveAntModel(model) if (antModel) { diff --git a/src/utils/eventLoopStallDetector.ts b/src/utils/eventLoopStallDetector.ts index ef5f367..998b547 100644 --- a/src/utils/eventLoopStallDetector.ts +++ b/src/utils/eventLoopStallDetector.ts @@ -1,3 +1,3 @@ // Auto-generated stub — replace with real implementation export {}; -export const startEventLoopStallDetector: any = (() => {}) as any; +export const startEventLoopStallDetector: () => void = () => {}; diff --git a/src/utils/imagePaste.ts b/src/utils/imagePaste.ts index de82781..ed66c1c 100644 --- a/src/utils/imagePaste.ts +++ b/src/utils/imagePaste.ts @@ -106,7 +106,8 @@ export async function hasImageInClipboard(): Promise { // as an unhandled rejection in useClipboardImageHint's setTimeout. try { const { getNativeModule } = await import('image-processor-napi') - const hasImage = getNativeModule()!?.hasClipboardImage + const nativeModule = getNativeModule() as Record | null + const hasImage = nativeModule?.hasClipboardImage if (hasImage) { return hasImage() } @@ -135,7 +136,8 @@ export async function getImageFromClipboard(): Promise | null + const readClipboard = nativeModule?.readClipboardImage if (!readClipboard) { throw new Error('native clipboard reader unavailable') } diff --git a/src/utils/log.ts b/src/utils/log.ts index b3cded2..da9b1d6 100644 --- a/src/utils/log.ts +++ b/src/utils/log.ts @@ -238,7 +238,7 @@ async function loadLogList(path: string): Promise { } const logData = await Promise.all( files.map(async (file, i) => { - const fullPath = join(path, file.name as string) + const fullPath = join(path, String(file.name)) const content = await readFile(fullPath, { encoding: 'utf8' }) const messages = jsonParse(content) as SerializedMessage[] const firstMessage = messages[0] diff --git a/src/utils/plugins/refresh.ts b/src/utils/plugins/refresh.ts index 38f29f4..fafbee6 100644 --- a/src/utils/plugins/refresh.ts +++ b/src/utils/plugins/refresh.ts @@ -164,9 +164,9 @@ export async function refreshActivePlugins( if (!p.hooksConfig) return sum return ( sum + - Object.values(p.hooksConfig).reduce( + (Object.values(p.hooksConfig) as Array | undefined>).reduce( (s, matchers) => - s + ((matchers as any)?.reduce((h: number, m: any) => h + m.hooks.length, 0) ?? 0), + s + (matchers?.reduce((h: number, m: { hooks: { length: number } }) => h + m.hooks.length, 0) ?? 0), 0, ) ) diff --git a/src/utils/postCommitAttribution.ts b/src/utils/postCommitAttribution.ts index d9b8fde..b078505 100644 --- a/src/utils/postCommitAttribution.ts +++ b/src/utils/postCommitAttribution.ts @@ -1,3 +1,3 @@ // Auto-generated stub — replace with real implementation export {}; -export const installPrepareCommitMsgHook: any = (() => {}) as any; +export const installPrepareCommitMsgHook: (worktreePath: string, worktreeHooksDir?: string) => Promise = async () => {}; diff --git a/src/utils/protectedNamespace.ts b/src/utils/protectedNamespace.ts index a787d72..3cb94be 100644 --- a/src/utils/protectedNamespace.ts +++ b/src/utils/protectedNamespace.ts @@ -1,3 +1,3 @@ // Auto-generated stub — replace with real implementation export {}; -export const checkProtectedNamespace: any = (() => {}) as any; +export const checkProtectedNamespace: () => boolean = () => false; diff --git a/src/utils/sdkHeapDumpMonitor.ts b/src/utils/sdkHeapDumpMonitor.ts index e5fcd08..949cf8d 100644 --- a/src/utils/sdkHeapDumpMonitor.ts +++ b/src/utils/sdkHeapDumpMonitor.ts @@ -1,3 +1,3 @@ // Auto-generated stub — replace with real implementation export {}; -export const startSdkMemoryMonitor: any = (() => {}) as any; +export const startSdkMemoryMonitor: () => void = () => {}; diff --git a/src/utils/sessionDataUploader.ts b/src/utils/sessionDataUploader.ts index fba6961..5de7955 100644 --- a/src/utils/sessionDataUploader.ts +++ b/src/utils/sessionDataUploader.ts @@ -1,3 +1,3 @@ // Auto-generated stub — replace with real implementation export {}; -export const createSessionTurnUploader: any = (() => {}) as any; +export const createSessionTurnUploader: () => void = () => {}; diff --git a/src/utils/sessionFileAccessHooks.ts b/src/utils/sessionFileAccessHooks.ts index 135c07c..d4b401d 100644 --- a/src/utils/sessionFileAccessHooks.ts +++ b/src/utils/sessionFileAccessHooks.ts @@ -215,8 +215,8 @@ async function handleSessionFileAccess( input.tool_name === FILE_WRITE_TOOL_NAME) ) { memoryShapeTelemetry!.logMemoryWriteShape( - input.tool_name, - input.tool_input, + input.tool_name as string, + input.tool_input as Record, filePath, scope, ) diff --git a/src/utils/src/entrypoints/sdk/runtimeTypes.ts b/src/utils/src/entrypoints/sdk/runtimeTypes.ts index bdcefcb..9ce95c9 100644 --- a/src/utils/src/entrypoints/sdk/runtimeTypes.ts +++ b/src/utils/src/entrypoints/sdk/runtimeTypes.ts @@ -1,2 +1,2 @@ // Auto-generated type stub — replace with real implementation -export type EffortLevel = any; +export type EffortLevel = 'low' | 'medium' | 'high' | 'max'; diff --git a/src/utils/systemThemeWatcher.ts b/src/utils/systemThemeWatcher.ts index 7957c5c..3c61f95 100644 --- a/src/utils/systemThemeWatcher.ts +++ b/src/utils/systemThemeWatcher.ts @@ -1,3 +1,3 @@ // Auto-generated stub — replace with real implementation export {}; -export const watchSystemTheme: any = (() => {}) as any; +export const watchSystemTheme: (querier: unknown, setTheme: React.Dispatch>) => (() => void) = () => () => {}; diff --git a/src/utils/taskSummary.ts b/src/utils/taskSummary.ts index 332cba2..514e894 100644 --- a/src/utils/taskSummary.ts +++ b/src/utils/taskSummary.ts @@ -1,4 +1,3 @@ // Auto-generated stub — replace with real implementation -export {}; -export const shouldGenerateTaskSummary: any = (() => {}) as any; -export const maybeGenerateTaskSummary: any = (() => {}) as any; +export const shouldGenerateTaskSummary: () => boolean = () => false; +export const maybeGenerateTaskSummary: (options: Record) => void = () => {}; diff --git a/src/utils/udsClient.ts b/src/utils/udsClient.ts index 4fcc821..fdadc94 100644 --- a/src/utils/udsClient.ts +++ b/src/utils/udsClient.ts @@ -1,4 +1,3 @@ // Auto-generated stub — replace with real implementation -export {}; -export const sendToUdsSocket: any = (() => {}) as any; -export const listAllLiveSessions: any = (() => {}) as any; +export const sendToUdsSocket: (target: string, message: string) => Promise = async () => {}; +export const listAllLiveSessions: () => Promise> = async () => []; diff --git a/src/utils/udsMessaging.ts b/src/utils/udsMessaging.ts index 965e598..3f717be 100644 --- a/src/utils/udsMessaging.ts +++ b/src/utils/udsMessaging.ts @@ -1,4 +1,3 @@ // Auto-generated stub — replace with real implementation -export {}; -export const startUdsMessaging: any = (() => {}) as any; -export const getDefaultUdsSocketPath: any = (() => {}) as any; +export const startUdsMessaging: (socketPath: string, options: { isExplicit: boolean }) => Promise = async () => {}; +export const getDefaultUdsSocketPath: () => string = () => '';