chore(typecheck-green): fix 28 tsc errors — baseline 62→34
Quick wins: - Export ToolResultBlockParam from Tool.ts (fixes 14 errors) - Add 'xhigh' to EffortLevel Union types in settings/schemas (fixes 3) - Fix color-diff test: add null second arg to detectLanguage (fixes 6) - Add typed params to keychain stub (fixes 5) - Create stubs: searchExtraTools.ts, toolIndex.ts (fixes 4) - Add CORE_TOOLS set export to constants/tools.ts (fixes 1) Remaining: 34 errors across 10 categories (ACP, SendMessageTool TCP, ListPeersTool UDS, acp-link, etc.)
This commit is contained in:
parent
a9e1a1e4d0
commit
fa954535b0
90
docs/typecheck-baseline.md
Normal file
90
docs/typecheck-baseline.md
Normal file
|
|
@ -0,0 +1,90 @@
|
|||
# TypeScript Error Baseline — chore/typecheck-green
|
||||
|
||||
Date: 2026-06-02
|
||||
Command: `bun x tsc --noEmit`
|
||||
Total: **62 errors** across 22 files
|
||||
|
||||
---
|
||||
|
||||
## Group 1 — Core src/runtime errors (11 errors)
|
||||
|
||||
| File | Line | Error | Category |
|
||||
|------|------|-------|----------|
|
||||
| `src/entrypoints/cli.tsx` | 140 | `ChannelPermissionRequestNotificationSchema` not on type | Missing export |
|
||||
| `src/services/acp/entry.ts` | 1,2,4 | Cannot find `@agentclientprotocol/sdk`, `./agent.js` | Missing module (ACP, gated) |
|
||||
| `src/services/localVault/store.ts` | 354,355,389,429,430 | Expected 0 arguments, got 1-2 | Decompile — `Keychain.setPassword()` sig mismatch |
|
||||
| `src/commands/effort/effort.tsx` | 30 | `EffortLevel` missing `"xhigh"` | Type union incomplete |
|
||||
| `src/components/EffortCallout.tsx` | 64 | Same `xhigh` issue | Type union incomplete |
|
||||
| `src/components/ModelPicker.tsx` | 204 | Same `xhigh` issue | Type union incomplete |
|
||||
|
||||
---
|
||||
|
||||
## Group 2 — provider / sideQuery / model-provider (0 errors)
|
||||
|
||||
✅ All clear — sideQuery routing and @ant/model-provider pass typecheck.
|
||||
|
||||
---
|
||||
|
||||
## Group 3 — packages/@ant/* edge packages (8 errors)
|
||||
|
||||
| File | Line | Error | Category |
|
||||
|------|------|-------|----------|
|
||||
| `packages/@ant/computer-use-swift/.../win32.ts` | 257 | `captureWindowTarget` not in `ScreenshotAPI` | Stub incomplete |
|
||||
| `packages/acp-link/src/cli/command.ts` | 22-66 | Boolean/string → undefined, missing `optional` prop | Decompile — Commander.js types |
|
||||
|
||||
---
|
||||
|
||||
## Group 4 — tests (7 errors)
|
||||
|
||||
| File | Line | Error | Category |
|
||||
|------|------|-------|----------|
|
||||
| `packages/color-diff-napi/src/__tests__/color-diff.test.ts` | 75-86 | Expected 2 args, got 1 (6×) | Test interface mismatch |
|
||||
| `packages/remote-control-server/src/__tests__/disconnect-monitor.test.ts` | 78 | `status` not in session init type | Stale test |
|
||||
|
||||
---
|
||||
|
||||
## Group 5 — decompile residue (36 errors)
|
||||
|
||||
### 5a — `ToolResultBlockParam` not exported (14 errors)
|
||||
Files: `CtxInspectTool`, `DiscoverSkillsTool`, `ListPeersTool`, `MonitorTool`, `PushNotificationTool`, `REPLTool`, `SendUserFileTool`, `SleepTool`, `SnipTool`, `SubscribePRTool`, `SuggestBackgroundPRTool`, `TerminalCaptureTool`, `VerifyPlanExecutionTool`, `WebBrowserTool`, `WorkflowTool`
|
||||
→ `src/Tool.ts` defines `ToolResultBlockParam` locally but doesn't export it. Add one `export` keyword.
|
||||
|
||||
### 5b — Missing `searchExtraTools` module (4 errors)
|
||||
Files: `ExecuteTool/ExecuteTool.ts`, `SearchExtraToolsTool/SearchExtraToolsTool.ts`
|
||||
→ `src/utils/searchExtraTools.ts` and `src/services/searchExtraTools/toolIndex.ts` don't exist. Create stubs.
|
||||
|
||||
### 5c — Missing `CORE_TOOLS` export (1 error)
|
||||
File: `SearchExtraToolsTool/prompt.ts`
|
||||
→ `src/constants/tools.ts` lacks `CORE_TOOLS`. Add the missing constant.
|
||||
|
||||
### 5d — TCP type mismatches in SendMessageTool (5 errors)
|
||||
File: `SendMessageTool/SendMessageTool.ts` (lines 636,662,722,872,873)
|
||||
→ `peerType` union `"other" | "bridge" | "uds"` doesn't include `"tcp"`. `parseTcpTarget` missing from `peerAddress`.
|
||||
|
||||
### 5e — `udsMessaging` / `bridge/peerSessions` missing exports (3 errors)
|
||||
File: `ListPeersTool` — `getUdsMessagingSocketPath`, `formatUdsAddress`, `listPeers`, `listBridgePeers`
|
||||
→ Stub the missing exports or add to existing stub files.
|
||||
|
||||
### 5f — `updateSessionInit` missing `status` (1 error)
|
||||
See Group 4 above — test uses stale interface.
|
||||
|
||||
---
|
||||
|
||||
## Action Plan (Priority Order)
|
||||
|
||||
### Quick wins (high impact, low risk):
|
||||
1. **Export `ToolResultBlockParam`** from `src/Tool.ts` — fixes 14 errors in one edit
|
||||
2. **Add `"xhigh"` to Effort union types** (3 components) — fixes 3 core errors
|
||||
3. **Fix `color-diff` test** — update argument count (6 errors)
|
||||
|
||||
### Medium:
|
||||
4. **Create stubs** for `searchExtraTools.ts`, `toolIndex.ts` — fixes 4 errors
|
||||
5. **Add `CORE_TOOLS` export** — fixes 1 error
|
||||
6. **Fix `SendMessageTool` TCP types** — add `"tcp"` to union, stub `parseTcpTarget`
|
||||
|
||||
### Deferred (gated features, low priority):
|
||||
7. **ACP module** (`@agentclientprotocol/sdk`) — feature-gated, install as devDep or stub
|
||||
8. **`ChannelPermissionRequestNotificationSchema`** — add export or stub
|
||||
9. **localVault Keychain sig** — fix method signatures on stub
|
||||
10. **acp-link Commander.js types** — add missing `optional` field
|
||||
11. **computer-use-swift win32** — add `captureWindowTarget` to interface (win32-only)
|
||||
|
|
@ -72,18 +72,18 @@ describe("detectColorMode", () => {
|
|||
|
||||
describe("detectLanguage", () => {
|
||||
test("detects language from file extension", () => {
|
||||
expect(detectLanguage("index.ts")).toBe("ts");
|
||||
expect(detectLanguage("main.py")).toBe("py");
|
||||
expect(detectLanguage("style.css")).toBe("css");
|
||||
expect(detectLanguage("index.ts", null)).toBe("ts");
|
||||
expect(detectLanguage("main.py", null)).toBe("py");
|
||||
expect(detectLanguage("style.css", null)).toBe("css");
|
||||
});
|
||||
|
||||
test("detects language from known filenames", () => {
|
||||
expect(detectLanguage("Makefile")).toBe("makefile");
|
||||
expect(detectLanguage("Dockerfile")).toBe("dockerfile");
|
||||
expect(detectLanguage("Makefile", null)).toBe("makefile");
|
||||
expect(detectLanguage("Dockerfile", null)).toBe("dockerfile");
|
||||
});
|
||||
|
||||
test("returns null for unknown extensions", () => {
|
||||
expect(detectLanguage("file.xyz123")).toBeNull();
|
||||
expect(detectLanguage("file.xyz123", null)).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -70,6 +70,7 @@ export type {
|
|||
SkillToolProgress,
|
||||
TaskOutputProgress,
|
||||
WebSearchProgress,
|
||||
ToolResultBlockParam,
|
||||
}
|
||||
|
||||
import type { SpinnerMode } from './components/Spinner.js'
|
||||
|
|
|
|||
|
|
@ -111,3 +111,25 @@ export const COORDINATOR_MODE_ALLOWED_TOOLS = new Set([
|
|||
SEND_MESSAGE_TOOL_NAME,
|
||||
SYNTHETIC_OUTPUT_TOOL_NAME,
|
||||
])
|
||||
|
||||
/**
|
||||
* Core tools that are always loaded and available in every session.
|
||||
* These appear directly in the tool list — agents call them without SearchExtraTools.
|
||||
*/
|
||||
export const CORE_TOOLS = new Set<string>([
|
||||
FILE_READ_TOOL_NAME,
|
||||
FILE_EDIT_TOOL_NAME,
|
||||
FILE_WRITE_TOOL_NAME,
|
||||
GREP_TOOL_NAME,
|
||||
GLOB_TOOL_NAME,
|
||||
WEB_SEARCH_TOOL_NAME,
|
||||
WEB_FETCH_TOOL_NAME,
|
||||
SKILL_TOOL_NAME,
|
||||
TODO_WRITE_TOOL_NAME,
|
||||
AGENT_TOOL_NAME,
|
||||
TASK_CREATE_TOOL_NAME,
|
||||
TASK_GET_TOOL_NAME,
|
||||
TASK_LIST_TOOL_NAME,
|
||||
TASK_UPDATE_TOOL_NAME,
|
||||
...SHELL_TOOL_NAMES,
|
||||
])
|
||||
|
|
|
|||
|
|
@ -507,7 +507,7 @@ export const SDKControlGetSettingsResponseSchema = lazySchema(() =>
|
|||
model: z.string(),
|
||||
// String levels only — numeric effort is ant-only and the
|
||||
// Zod→proto generator can't emit enum∪number unions.
|
||||
effort: z.enum(['low', 'medium', 'high', 'max']).nullable(),
|
||||
effort: z.enum(['low', 'medium', 'high', 'xhigh', 'max']).nullable(),
|
||||
})
|
||||
.optional()
|
||||
.describe(
|
||||
|
|
|
|||
|
|
@ -1065,7 +1065,7 @@ export const ModelInfoSchema = lazySchema(() =>
|
|||
.optional()
|
||||
.describe('Whether this model supports effort levels'),
|
||||
supportedEffortLevels: z
|
||||
.array(z.enum(['low', 'medium', 'high', 'max']))
|
||||
.array(z.enum(['low', 'medium', 'high', 'xhigh', 'max']))
|
||||
.optional()
|
||||
.describe('Available effort levels for this model'),
|
||||
supportsAdaptiveThinking: z
|
||||
|
|
@ -1174,7 +1174,7 @@ export const AgentDefinitionSchema = lazySchema(() =>
|
|||
"Scope for auto-loading agent memory files. 'user' - ~/.claude/agent-memory/<agentType>/, 'project' - .claude/agent-memory/<agentType>/, 'local' - .claude/agent-memory-local/<agentType>/",
|
||||
),
|
||||
effort: z
|
||||
.union([z.enum(['low', 'medium', 'high', 'max']), z.number().int()])
|
||||
.union([z.enum(['low', 'medium', 'high', 'xhigh', 'max']), z.number().int()])
|
||||
.optional()
|
||||
.describe(
|
||||
'Reasoning effort level for this agent. Either a named level or an integer',
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ export class KeychainUnavailableError extends Error {
|
|||
}
|
||||
}
|
||||
|
||||
const unavailable = () => {
|
||||
const unavailable = (..._args: unknown[]) => {
|
||||
throw new KeychainUnavailableError()
|
||||
}
|
||||
|
||||
|
|
@ -24,4 +24,11 @@ export const tryKeychain = {
|
|||
list: unavailable,
|
||||
_addToIndex: unavailable,
|
||||
_removeFromIndex: unavailable,
|
||||
} as {
|
||||
set(key: string, value: string): Promise<void>
|
||||
get(key: string): Promise<string | undefined>
|
||||
delete(key: string): Promise<boolean>
|
||||
list(): Promise<string[]>
|
||||
_addToIndex(key: string): Promise<void>
|
||||
_removeFromIndex(key: string): Promise<void>
|
||||
}
|
||||
|
|
|
|||
30
src/services/searchExtraTools/toolIndex.ts
Normal file
30
src/services/searchExtraTools/toolIndex.ts
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
/**
|
||||
* Stub — searchExtraTools/toolIndex module.
|
||||
* CC_Pure defers tool indexing to the main tool registry.
|
||||
* This stub provides the minimum type surface.
|
||||
*/
|
||||
|
||||
export interface SearchExtraToolsResult {
|
||||
tools: ToolIndexEntry[]
|
||||
}
|
||||
|
||||
export interface ToolIndexEntry {
|
||||
name: string
|
||||
description: string
|
||||
schema: unknown
|
||||
}
|
||||
|
||||
/** Get the current tool index. */
|
||||
export function getToolIndex(): ToolIndexEntry[] {
|
||||
return []
|
||||
}
|
||||
|
||||
/** Search tools in the index by query string. */
|
||||
export function searchTools(_query: string): SearchExtraToolsResult {
|
||||
return { tools: [] }
|
||||
}
|
||||
|
||||
/** Build a search index of all available deferred tools. */
|
||||
export function buildToolIndex(): ToolIndexEntry[] {
|
||||
return []
|
||||
}
|
||||
36
src/utils/searchExtraTools.ts
Normal file
36
src/utils/searchExtraTools.ts
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
/**
|
||||
* Stub — searchExtraTools module.
|
||||
* CC_Pure defers tool search to the main tool registry.
|
||||
* This stub provides the minimum type surface for typecheck passage.
|
||||
*/
|
||||
|
||||
/** Check if SearchExtraTools feature is enabled (optimistic). */
|
||||
export function isSearchExtraToolsEnabledOptimistic(): boolean {
|
||||
return false
|
||||
}
|
||||
|
||||
/** Check if SearchExtraTools tool is available. */
|
||||
export function isSearchExtraToolsToolAvailable(): boolean {
|
||||
return false
|
||||
}
|
||||
|
||||
/** Extract discovered tool names from a search result. */
|
||||
export function extractDiscoveredToolNames(
|
||||
_result: unknown,
|
||||
): string[] {
|
||||
return []
|
||||
}
|
||||
|
||||
/** Search for deferred tools by query string. */
|
||||
export async function searchExtraTools(
|
||||
_query: string,
|
||||
): Promise<Array<{ name: string; description: string; schema: unknown }>> {
|
||||
return []
|
||||
}
|
||||
|
||||
/** Load a specific deferred tool by name. */
|
||||
export async function loadDeferredTool(
|
||||
_toolName: string,
|
||||
): Promise<{ name: string; call: (...args: unknown[]) => Promise<unknown> } | null> {
|
||||
return null
|
||||
}
|
||||
|
|
@ -710,8 +710,8 @@ export const SettingsSchema = lazySchema(() =>
|
|||
effortLevel: z
|
||||
.enum(
|
||||
process.env.USER_TYPE === 'ant'
|
||||
? ['low', 'medium', 'high', 'max']
|
||||
: ['low', 'medium', 'high'],
|
||||
? ['low', 'medium', 'high', 'xhigh', 'max']
|
||||
: ['low', 'medium', 'high', 'xhigh'],
|
||||
)
|
||||
.optional()
|
||||
.catch(undefined)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user