Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion packages/@ant/computer-use-mcp/src/toolCalls.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/**

Check failure on line 1 in packages/@ant/computer-use-mcp/src/toolCalls.ts

View workflow job for this annotation

GitHub Actions / ci

format

File content differs from formatting output
* Tool dispatch. Every security decision from plan §2 is enforced HERE,
* before any executor method is called.
*
Expand Down Expand Up @@ -1262,7 +1262,10 @@
// resolved goes in the exempt set.
const exemptForPreview = [
...allowedApps.map(a => a.bundleId),
...surviving.filter(r => r.resolved).map(r => r.resolved!.bundleId),
...surviving.reduce((acc: string[], r) => {
if (r.resolved) acc.push(r.resolved.bundleId);
return acc;
}, []),
]
const willHide = await adapter.executor.previewHideSet(
exemptForPreview,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { z } from 'zod/v4'

Check failure on line 1 in packages/builtin-tools/src/tools/TaskListTool/TaskListTool.ts

View workflow job for this annotation

GitHub Actions / ci

format

File content differs from formatting output
import { buildTool, type ToolDef } from 'src/Tool.js'
import { lazySchema } from 'src/utils/lazySchema.js'
import {
Expand Down Expand Up @@ -71,7 +71,10 @@

// Build a set of resolved task IDs for filtering
const resolvedTaskIds = new Set(
allTasks.filter(t => t.status === 'completed').map(t => t.id),
allTasks.reduce((acc: string[], t) => {
if (t.status === 'completed') acc.push(t.id);
return acc;
}, [])
)

const tasks = allTasks.map(task => ({
Expand Down
5 changes: 4 additions & 1 deletion src/commands/plugin/ManagePlugins.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import figures from 'figures';

Check failure on line 1 in src/commands/plugin/ManagePlugins.tsx

View workflow job for this annotation

GitHub Actions / ci

format

File content differs from formatting output
import type { Dirent } from 'fs';
import * as fs from 'fs/promises';
import * as path from 'path';
Expand Down Expand Up @@ -855,7 +855,10 @@
// Mark flagged plugins as seen when the Installed view renders them.
// After 48 hours from seenAt, they auto-clear on next load.
const flaggedIds = useMemo(
() => unifiedItems.filter(item => item.type === 'flagged-plugin').map(item => item.id),
() => unifiedItems.reduce((acc: string[], item) => {
if (item.type === 'flagged-plugin') acc.push(item.id);
return acc;
}, []),
[unifiedItems],
);
useEffect(() => {
Expand Down
5 changes: 4 additions & 1 deletion src/components/Spinner.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// biome-ignore-all assist/source/organizeImports: ANT-ONLY import markers must not be reordered

Check failure on line 1 in src/components/Spinner.tsx

View workflow job for this annotation

GitHub Actions / ci

format

File content differs from formatting output
import { Box, Text, stringWidth } from '@anthropic/ink';
import * as React from 'react';
import { useEffect, useMemo, useRef, useState } from 'react';
Expand Down Expand Up @@ -550,6 +550,9 @@
if (pendingTasks.length === 0) {
return undefined;
}
const unresolvedIds = new Set(tasks.filter(t => t.status !== 'completed').map(t => t.id));
const unresolvedIds = new Set(tasks.reduce((acc: string[], t) => {
if (t.status !== 'completed') acc.push(t.id);
return acc;
}, []));
return pendingTasks.find(t => !t.blockedBy.some(id => unresolvedIds.has(id))) ?? pendingTasks[0];
}
15 changes: 12 additions & 3 deletions src/components/TaskListV2.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import figures from 'figures';

Check failure on line 1 in src/components/TaskListV2.tsx

View workflow job for this annotation

GitHub Actions / ci

format

File content differs from formatting output
import * as React from 'react';
import { useTerminalSize } from '../hooks/useTerminalSize.js';
import { Box, Text, stringWidth } from '@anthropic/ink';
Expand Down Expand Up @@ -42,12 +42,18 @@
const completionTimestampsRef = React.useRef(new Map<string, number>());
const previousCompletedIdsRef = React.useRef<Set<string> | null>(null);
if (previousCompletedIdsRef.current === null) {
previousCompletedIdsRef.current = new Set(tasks.filter(t => t.status === 'completed').map(t => t.id));
previousCompletedIdsRef.current = new Set(tasks.reduce((acc: string[], t) => {
if (t.status === 'completed') acc.push(t.id);
return acc;
}, []));
}
const maxDisplay = rows <= 10 ? 0 : Math.min(10, Math.max(3, rows - 14));

// Update completion timestamps: reset when a task transitions to completed
const currentCompletedIds = new Set(tasks.filter(t => t.status === 'completed').map(t => t.id));
const currentCompletedIds = new Set(tasks.reduce((acc: string[], t) => {
if (t.status === 'completed') acc.push(t.id);
return acc;
}, []));
const now = Date.now();
for (const id of currentCompletedIds) {
if (!previousCompletedIdsRef.current.has(id)) {
Expand Down Expand Up @@ -136,7 +142,10 @@
const pendingCount = count(tasks, t => t.status === 'pending');
const inProgressCount = tasks.length - completedCount - pendingCount;
// Unresolved tasks (open or in_progress) block dependent tasks
const unresolvedTaskIds = new Set(tasks.filter(t => t.status !== 'completed').map(t => t.id));
const unresolvedTaskIds = new Set(tasks.reduce((acc: string[], t) => {
if (t.status !== 'completed') acc.push(t.id);
return acc;
}, []));

// Check if we need to truncate
const needsTruncation = tasks.length > maxDisplay;
Expand Down
8 changes: 6 additions & 2 deletions src/components/agents/AgentsList.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import figures from 'figures';

Check failure on line 1 in src/components/agents/AgentsList.tsx

View workflow job for this annotation

GitHub Actions / ci

format

File content differs from formatting output
import * as React from 'react';
import type { SettingSource } from 'src/utils/settings/constants.js';
import { type KeyboardEvent, Box, Text } from '@anthropic/ink';
Expand Down Expand Up @@ -242,7 +242,9 @@
{onCreateNew && <Box marginBottom={1}>{renderCreateNewOption()}</Box>}
{source === 'all' ? (
<>
{AGENT_SOURCE_GROUPS.filter(g => g.source !== 'built-in').map(({ label, source: groupSource }) => (
{AGENT_SOURCE_GROUPS.flatMap(g =>
g.source !== 'built-in' ? [{label: g.label, source: g.source}] : []
).map(({ label, source: groupSource }) => (
<React.Fragment key={groupSource}>
{renderAgentGroup(
label,
Expand Down Expand Up @@ -270,7 +272,9 @@
</>
) : (
<>
{sortedAgents.filter(a => a.source !== 'built-in').map(agent => renderAgent(agent))}
{sortedAgents.flatMap(agent =>
agent.source !== 'built-in' ? [agent] : []
).map(agent => renderAgent(agent))}
{sortedAgents.some(a => a.source === 'built-in') && (
<>
<Divider />
Expand Down
5 changes: 4 additions & 1 deletion src/components/memory/MemoryFileSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,10 @@ export function MemoryFileSelector({ onSelect, onCancel }: Props): React.ReactNo
// /memory already surfaces "Open auto-memory folder" / "Open team memory
// folder" options below. Listing the entrypoint file separately is redundant.
const allMemoryFiles: ExtendedMemoryFileInfo[] = [
...existingMemoryFiles.filter(f => f.type !== 'AutoMem' && f.type !== 'TeamMem').map(f => ({ ...f, exists: true })),
...existingMemoryFiles.reduce((acc: ExtendedMemoryFileInfo[], f) => {
if (f.type !== 'AutoMem' && f.type !== 'TeamMem') acc.push({ ...f, exists: true });
return acc;
}, []),
// Add User memory if it doesn't exist
...(hasUserMemory
? []
Expand Down
5 changes: 4 additions & 1 deletion src/components/messages/CollapsedReadSearchContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,10 @@ export function CollapsedReadSearchContent({
'cherry-picked': 'cherry-picked',
};
for (const kind of ['committed', 'amended', 'cherry-picked'] as const) {
const shas = message.commits.filter(c => c.kind === kind).map(c => c.sha);
const shas = message.commits.reduce((acc: string[], c) => {
if (c.kind === kind) acc.push(c.sha);
return acc;
}, []);
if (shas.length) {
pushPart(kind, byKind[kind], <Text bold>{shas.join(', ')}</Text>);
}
Expand Down
5 changes: 4 additions & 1 deletion src/components/permissions/rules/PermissionRuleList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,10 @@ export function PermissionRuleList({ onExit, initialTab, onRetryDenials }: Props
// Find the adjacent rule to focus on after deletion
const { options } = getRulesOptions(selectedRule.ruleBehavior as TabType);
const selectedKey = jsonStringify(selectedRule);
const ruleKeys = options.filter(opt => opt.value !== 'add-new-rule').map(opt => opt.value);
const ruleKeys = options.reduce((acc: string[], opt) => {
if (opt.value !== 'add-new-rule') acc.push(opt.value as string);
return acc;
}, []);
const currentIndex = ruleKeys.indexOf(selectedKey);

// Try to focus on the next rule, or the previous if deleting the last one
Expand Down
5 changes: 4 additions & 1 deletion src/hooks/useTaskListWatcher.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type FSWatcher, watch } from 'fs'

Check failure on line 1 in src/hooks/useTaskListWatcher.ts

View workflow job for this annotation

GitHub Actions / ci

format

File content differs from formatting output
import { useEffect, useRef } from 'react'
import { logForDebugging } from '../utils/debug.js'
import {
Expand Down Expand Up @@ -196,7 +196,10 @@
*/
function findAvailableTask(tasks: Task[]): Task | undefined {
const unresolvedTaskIds = new Set(
tasks.filter(t => t.status !== 'completed').map(t => t.id),
tasks.reduce((acc: string[], t) => {
if (t.status !== 'completed') acc.push(t.id);
return acc;
}, [])
)

return tasks.find(task => {
Expand Down
5 changes: 4 additions & 1 deletion src/services/autoDream/consolidationLock.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Lock file whose mtime IS lastConsolidatedAt. Body is the holder's PID.

Check failure on line 1 in src/services/autoDream/consolidationLock.ts

View workflow job for this annotation

GitHub Actions / ci

format

File content differs from formatting output
//
// Lives inside the memory dir (getAutoMemPath) so it keys on git-root
// like memory does, and so it's writable even when the memory path comes
Expand Down Expand Up @@ -120,7 +120,10 @@
): Promise<string[]> {
const dir = getProjectDir(getOriginalCwd())
const candidates = await listCandidates(dir, true)
return candidates.filter(c => c.mtime > sinceMs).map(c => c.sessionId)
return candidates.reduce((acc: string[], c) => {
if (c.mtime > sinceMs) acc.push(c.sessionId);
return acc;
}, [])
}

/**
Expand Down
5 changes: 4 additions & 1 deletion src/skills/bundled/ultracode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,10 @@ while (dry < 2) { // loop-until-dry
parallel(['correctness','security','repro'].map(lens => () => // ...each by 3 distinct lenses
agent(\`Judge "\${b.desc}" via the \${lens} lens — real?\`, {phase: 'Verify', schema: VERDICT})))
.then(vs => ({ b, real: vs.filter(Boolean).filter(v => v.real).length >= 2 }))))
confirmed.push(...judged.filter(v => v.real).map(v => v.b))
confirmed.push(...judged.reduce((acc: typeof judged, v) => {
if (v.real) acc.push(v);
return acc;
}, []).map(v => v.b))
}
return confirmed
// dedup vs \`seen\`, NOT \`confirmed\` — else judge-rejected findings reappear every round and it never converges.
Expand Down
5 changes: 4 additions & 1 deletion src/utils/groupToolUses.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { BetaToolUseBlock } from '@anthropic-ai/sdk/resources/beta/messages/messages.mjs'

Check failure on line 1 in src/utils/groupToolUses.ts

View workflow job for this annotation

GitHub Actions / ci

format

File content differs from formatting output
import type {
ContentBlockParam,
ToolResultBlockParam,
Expand Down Expand Up @@ -28,7 +28,10 @@
function getToolsWithGrouping(tools: Tools): Set<string> {
let cached = GROUPING_CACHE.get(tools)
if (!cached) {
cached = new Set(tools.filter(t => t.renderGroupedToolUse).map(t => t.name))
cached = new Set(tools.reduce((acc: string[], t) => {
if (t.renderGroupedToolUse) acc.push(t.name);
return acc;
}, []))
GROUPING_CACHE.set(tools, cached)
}
return cached
Expand Down
5 changes: 4 additions & 1 deletion src/utils/messages.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { feature } from 'bun:bundle'

Check failure on line 1 in src/utils/messages.ts

View workflow job for this annotation

GitHub Actions / ci

format

File content differs from formatting output
import type { BetaUsage as Usage } from '@anthropic-ai/sdk/resources/beta/messages/messages.mjs'
import type {
ContentBlock,
Expand Down Expand Up @@ -2199,7 +2199,10 @@
if (!Array.isArray(trContent)) return b
if (trContent.every(c => c.type === 'text')) return b
changed = true
const texts = trContent.filter(c => c.type === 'text').map(c => c.text)
const texts = trContent.reduce((acc: string[], c) => {
if (c.type === 'text') acc.push(c.text);
return acc;
}, [])
const textOnly: TextBlockParam[] =
texts.length > 0 ? [{ type: 'text', text: texts.join('\n\n') }] : []
return { ...b, content: textOnly }
Expand Down
5 changes: 4 additions & 1 deletion src/utils/pipeRegistry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,10 @@ export async function cleanupStaleEntries(): Promise<void> {
}

const deadNames = new Set(
subResults.filter(r => !r.alive).map(r => r.sub.pipeName),
subResults.reduce((acc: string[], r) => {
if (!r.alive) acc.push(r.sub.pipeName);
return acc;
}, [])
)
const aliveSubs = fresh.subs.filter(s => !deadNames.has(s.pipeName))
if (aliveSubs.length !== fresh.subs.length) {
Expand Down
10 changes: 8 additions & 2 deletions src/utils/plugins/dependencyResolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,10 @@ export function verifyAndDemote(plugins: readonly LoadedPlugin[]): {
errors: PluginError[]
} {
const known = new Set(plugins.map(p => p.source))
const enabled = new Set(plugins.filter(p => p.enabled).map(p => p.source))
const enabled = new Set(plugins.reduce((acc: string[], p) => {
if (p.enabled) acc.push(p.source);
return acc;
}, []))
// Name-only indexes for bare deps from --plugin-dir (@inline) plugins:
// the real marketplace is unknown, so match "B" against any enabled "B@*".
// enabledByName is a multiset: if B@epic AND B@other are both enabled,
Expand Down Expand Up @@ -228,7 +231,10 @@ export function verifyAndDemote(plugins: readonly LoadedPlugin[]): {
}

const demoted = new Set(
plugins.filter(p => p.enabled && !enabled.has(p.source)).map(p => p.source),
plugins.reduce((acc: string[], p) => {
if (p.enabled && !enabled.has(p.source)) acc.push(p.source);
return acc;
}, [])
)
return { demoted, errors }
}
Expand Down
5 changes: 4 additions & 1 deletion src/utils/plugins/pluginDirectories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,10 @@ export function getPluginSeedDirs(): string[] {
// Same tilde-expansion rationale as getPluginsDirectory (gh-30794).
const raw = process.env.CLAUDE_CODE_PLUGIN_SEED_DIR
if (!raw) return []
return raw.split(delimiter).filter(Boolean).map(expandTilde)
return raw.split(delimiter).reduce((acc: string[], p) => {
if (p) acc.push(expandTilde(p));
return acc;
}, [])
}

function sanitizePluginId(pluginId: string): string {
Expand Down
5 changes: 4 additions & 1 deletion src/utils/swarm/inProcessRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,10 @@ async function sendIdleNotification(
*/
function findAvailableTask(tasks: Task[]): Task | undefined {
const unresolvedTaskIds = new Set(
tasks.filter(t => t.status !== 'completed').map(t => t.id),
tasks.reduce((acc: string[], t) => {
if (t.status !== 'completed') acc.push(t.id);
return acc;
}, [])
)

return tasks.find(task => {
Expand Down
10 changes: 8 additions & 2 deletions src/utils/tasks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,10 @@ export async function claimTask(
// Check for unresolved blockers (open or in_progress tasks block)
const allTasks = await listTasks(taskListId)
const unresolvedTaskIds = new Set(
allTasks.filter(t => t.status !== 'completed').map(t => t.id),
allTasks.reduce((acc: string[], t) => {
if (t.status !== 'completed') acc.push(t.id);
return acc;
}, [])
)
const blockedByTasks = task.blockedBy.filter(id =>
unresolvedTaskIds.has(id),
Expand Down Expand Up @@ -648,7 +651,10 @@ async function claimTaskWithBusyCheck(

// Check for unresolved blockers (open or in_progress tasks block)
const unresolvedTaskIds = new Set(
allTasks.filter(t => t.status !== 'completed').map(t => t.id),
allTasks.reduce((acc: string[], t) => {
if (t.status !== 'completed') acc.push(t.id);
return acc;
}, [])
)
const blockedByTasks = task.blockedBy.filter(id =>
unresolvedTaskIds.has(id),
Expand Down