fix: resolve all CI lint errors and flaky test
- Fix React hooks violations: ref updates during render (useDraftPersistence, useChipDraftPersistence, useAttachments), setState in effects across 15+ components, useCallback self-reference TDZ in useResizableColumns - Fix TypeScript lint: remove unnecessary type assertions, replace inline import() annotations with direct imports, remove unused variables/imports - Fix SonarJS issues: prefer-regexp-exec, slow-regex in SubagentResolver, no-misleading-array-reverse in TeamProvisioningService, use-type-alias in ClaudeLogsSection, variable shadowing in ChangeExtractorService - Fix accessibility: associate labels with controls in filter popovers - Fix template expression safety: wrap unknown errors with String() - Fix flaky FileWatcher test: floor instanceCreatedAt to second granularity to match filesystem birthtimeMs resolution on Linux - Replace TODO comments with NOTE where features are intentionally disabled - Remove unused leadContextByTeam from TeamDetailView store selector 62 files changed across main process, renderer, shared types, and hooks. All 1646 tests pass, typecheck clean, 0 lint errors.
This commit is contained in:
parent
6a67838d20
commit
2ceed41e00
62 changed files with 1432 additions and 1294 deletions
|
|
@ -426,7 +426,7 @@ function wireFileWatcherEvents(context: ServiceContext): void {
|
|||
return teamProvisioningService.relayLeadInboxMessages(teamName);
|
||||
})
|
||||
.catch((e: unknown) =>
|
||||
logger.warn(`[FileWatcher] relay failed for ${teamName}: ${e}`)
|
||||
logger.warn(`[FileWatcher] relay failed for ${teamName}: ${String(e)}`)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -466,7 +466,9 @@ function wireFileWatcherEvents(context: ServiceContext): void {
|
|||
void teamDataService
|
||||
.notifyLeadOnTeammateTaskStart(teamName, taskId)
|
||||
.catch((e: unknown) =>
|
||||
logger.warn(`[FileWatcher] task start notify failed for ${teamName}#${taskId}: ${e}`)
|
||||
logger.warn(
|
||||
`[FileWatcher] task start notify failed for ${teamName}#${taskId}: ${String(e)}`
|
||||
)
|
||||
);
|
||||
}
|
||||
} catch {
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import {
|
|||
TEAM_CREATE,
|
||||
TEAM_CREATE_CONFIG,
|
||||
TEAM_CREATE_TASK,
|
||||
TEAM_DELETE_TASK_ATTACHMENT,
|
||||
TEAM_DELETE_TEAM,
|
||||
TEAM_GET_ALL_TASKS,
|
||||
TEAM_GET_ATTACHMENTS,
|
||||
|
|
@ -21,6 +22,7 @@ import {
|
|||
TEAM_GET_MEMBER_LOGS,
|
||||
TEAM_GET_MEMBER_STATS,
|
||||
TEAM_GET_PROJECT_BRANCH,
|
||||
TEAM_GET_TASK_ATTACHMENT,
|
||||
TEAM_KILL_PROCESS,
|
||||
TEAM_LAUNCH,
|
||||
TEAM_LEAD_ACTIVITY,
|
||||
|
|
@ -38,6 +40,7 @@ import {
|
|||
TEAM_REQUEST_REVIEW,
|
||||
TEAM_RESTORE,
|
||||
TEAM_RESTORE_TASK,
|
||||
TEAM_SAVE_TASK_ATTACHMENT,
|
||||
TEAM_SEND_MESSAGE,
|
||||
TEAM_SET_TASK_CLARIFICATION,
|
||||
TEAM_SHOW_MESSAGE_NOTIFICATION,
|
||||
|
|
@ -51,9 +54,6 @@ import {
|
|||
TEAM_UPDATE_TASK_FIELDS,
|
||||
TEAM_UPDATE_TASK_OWNER,
|
||||
TEAM_UPDATE_TASK_STATUS,
|
||||
TEAM_SAVE_TASK_ATTACHMENT,
|
||||
TEAM_GET_TASK_ATTACHMENT,
|
||||
TEAM_DELETE_TASK_ATTACHMENT,
|
||||
// eslint-disable-next-line boundaries/element-types -- IPC channel constants are shared between main and preload by design
|
||||
} from '@preload/constants/ipcChannels';
|
||||
import { AGENT_BLOCK_CLOSE, AGENT_BLOCK_OPEN } from '@shared/constants/agentBlocks';
|
||||
|
|
@ -91,7 +91,6 @@ import type {
|
|||
} from '../services';
|
||||
import type {
|
||||
AttachmentFileData,
|
||||
AttachmentMediaType,
|
||||
AttachmentMeta,
|
||||
AttachmentPayload,
|
||||
CreateTaskRequest,
|
||||
|
|
@ -105,13 +104,13 @@ import type {
|
|||
SendMessageResult,
|
||||
TaskAttachmentMeta,
|
||||
TaskComment,
|
||||
TeamClaudeLogsQuery,
|
||||
TeamClaudeLogsResponse,
|
||||
TeamConfig,
|
||||
TeamCreateConfigRequest,
|
||||
TeamCreateRequest,
|
||||
TeamCreateResponse,
|
||||
TeamData,
|
||||
TeamClaudeLogsQuery,
|
||||
TeamClaudeLogsResponse,
|
||||
TeamLaunchRequest,
|
||||
TeamLaunchResponse,
|
||||
TeamMessageNotificationData,
|
||||
|
|
@ -1049,7 +1048,9 @@ async function handleSendMessage(
|
|||
if (isLeadRecipient && isAlive) {
|
||||
void provisioning
|
||||
.relayLeadInboxMessages(tn)
|
||||
.catch((e: unknown) => logger.warn(`Relay after sendMessage failed for ${tn}: ${e}`));
|
||||
.catch((e: unknown) =>
|
||||
logger.warn(`Relay after sendMessage failed for ${tn}: ${String(e)}`)
|
||||
);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
|
@ -2038,7 +2039,7 @@ async function handleAddTaskComment(
|
|||
vTask.value!,
|
||||
safeId,
|
||||
a.filename,
|
||||
a.mimeType as AttachmentMediaType,
|
||||
a.mimeType,
|
||||
a.base64Data
|
||||
);
|
||||
savedAttachments.push(meta);
|
||||
|
|
@ -2160,9 +2161,9 @@ async function handleSaveTaskAttachment(
|
|||
vTeam.value!,
|
||||
vTask.value!,
|
||||
safeAttId,
|
||||
filename as string,
|
||||
mimeType as AttachmentMediaType,
|
||||
base64Data as string
|
||||
filename,
|
||||
mimeType,
|
||||
base64Data
|
||||
);
|
||||
// Write metadata into the task JSON
|
||||
await getTeamDataService().addTaskAttachment(vTeam.value!, vTask.value!, meta);
|
||||
|
|
@ -2193,12 +2194,7 @@ async function handleGetTaskAttachment(
|
|||
}
|
||||
|
||||
return wrapTeamHandler('getTaskAttachment', () =>
|
||||
taskAttachmentStore.getAttachment(
|
||||
vTeam.value!,
|
||||
vTask.value!,
|
||||
safeAttId,
|
||||
mimeType as AttachmentMediaType
|
||||
)
|
||||
taskAttachmentStore.getAttachment(vTeam.value!, vTask.value!, safeAttId, mimeType)
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -2225,12 +2221,7 @@ async function handleDeleteTaskAttachment(
|
|||
}
|
||||
|
||||
return wrapTeamHandler('deleteTaskAttachment', async () => {
|
||||
await taskAttachmentStore.deleteAttachment(
|
||||
vTeam.value!,
|
||||
vTask.value!,
|
||||
safeAttId,
|
||||
mimeType as AttachmentMediaType
|
||||
);
|
||||
await taskAttachmentStore.deleteAttachment(vTeam.value!, vTask.value!, safeAttId, mimeType);
|
||||
// Remove metadata from task JSON
|
||||
await getTeamDataService().removeTaskAttachment(vTeam.value!, vTask.value!, safeAttId);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -162,7 +162,7 @@ export class SubagentResolver {
|
|||
if (!firstUserMessage) return undefined;
|
||||
|
||||
const text = typeof firstUserMessage.content === 'string' ? firstUserMessage.content : '';
|
||||
const match = /<teammate-message\s+[^>]*\bteammate_id="([^"]+)"/.exec(text);
|
||||
const match = /<teammate-message\s[^>]*?\bteammate_id="([^"]+)"/.exec(text);
|
||||
return match?.[1];
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -97,8 +97,11 @@ export class FileWatcher extends EventEmitter {
|
|||
private pendingReprocess = new Set<string>();
|
||||
/** Flag to prevent reuse after disposal */
|
||||
private disposed = false;
|
||||
/** Timestamp when this FileWatcher instance was created (used to distinguish old vs new files) */
|
||||
private readonly instanceCreatedAt = Date.now();
|
||||
/** Timestamp when this FileWatcher instance was created (used to distinguish old vs new files).
|
||||
* Floored to second granularity because filesystem birthtimeMs may have lower resolution
|
||||
* than Date.now() — without this, a file created in the same millisecond-window could
|
||||
* appear older than the watcher on some platforms (e.g. ext4 on Linux). */
|
||||
private readonly instanceCreatedAt = Math.floor(Date.now() / 1000) * 1000;
|
||||
|
||||
constructor(
|
||||
dataCache: DataCache,
|
||||
|
|
|
|||
|
|
@ -449,16 +449,16 @@ export class ChangeExtractorService {
|
|||
const isError = erroredIds.has(toolUseId);
|
||||
|
||||
if (toolName === 'Edit') {
|
||||
const path = typeof input.file_path === 'string' ? input.file_path : '';
|
||||
const targetPath = typeof input.file_path === 'string' ? input.file_path : '';
|
||||
const oldString = typeof input.old_string === 'string' ? input.old_string : '';
|
||||
const newString = typeof input.new_string === 'string' ? input.new_string : '';
|
||||
const replaceAll = input.replace_all === true;
|
||||
|
||||
if (path) {
|
||||
seenFiles.add(path);
|
||||
if (targetPath) {
|
||||
seenFiles.add(targetPath);
|
||||
snippets.push({
|
||||
toolUseId,
|
||||
filePath: path,
|
||||
filePath: targetPath,
|
||||
toolName: 'Edit',
|
||||
type: 'edit',
|
||||
oldString,
|
||||
|
|
@ -470,15 +470,15 @@ export class ChangeExtractorService {
|
|||
});
|
||||
}
|
||||
} else if (toolName === 'Write') {
|
||||
const path = typeof input.file_path === 'string' ? input.file_path : '';
|
||||
const targetPath = typeof input.file_path === 'string' ? input.file_path : '';
|
||||
const writeContent = typeof input.content === 'string' ? input.content : '';
|
||||
|
||||
if (path) {
|
||||
const isNew = !seenFiles.has(path);
|
||||
seenFiles.add(path);
|
||||
if (targetPath) {
|
||||
const isNew = !seenFiles.has(targetPath);
|
||||
seenFiles.add(targetPath);
|
||||
snippets.push({
|
||||
toolUseId,
|
||||
filePath: path,
|
||||
filePath: targetPath,
|
||||
toolName: 'Write',
|
||||
type: isNew ? 'write-new' : 'write-update',
|
||||
oldString: '',
|
||||
|
|
@ -490,11 +490,11 @@ export class ChangeExtractorService {
|
|||
});
|
||||
}
|
||||
} else if (toolName === 'MultiEdit') {
|
||||
const path = typeof input.file_path === 'string' ? input.file_path : '';
|
||||
const targetPath = typeof input.file_path === 'string' ? input.file_path : '';
|
||||
const edits = Array.isArray(input.edits) ? input.edits : [];
|
||||
|
||||
if (path) {
|
||||
seenFiles.add(path);
|
||||
if (targetPath) {
|
||||
seenFiles.add(targetPath);
|
||||
for (const edit of edits) {
|
||||
if (!edit || typeof edit !== 'object') continue;
|
||||
const editObj = edit as Record<string, unknown>;
|
||||
|
|
@ -502,7 +502,7 @@ export class ChangeExtractorService {
|
|||
const newString = typeof editObj.new_string === 'string' ? editObj.new_string : '';
|
||||
snippets.push({
|
||||
toolUseId,
|
||||
filePath: path,
|
||||
filePath: targetPath,
|
||||
toolName: 'MultiEdit',
|
||||
type: 'multi-edit',
|
||||
oldString,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import { FileReadTimeoutError, readFileUtf8WithTimeout } from '@main/utils/fsRead';
|
||||
import { getTeamsBasePath } from '@main/utils/pathDecoder';
|
||||
import { createLogger } from '@shared/utils/logger';
|
||||
import { createCliAutoSuffixNameGuard } from '@shared/utils/teamMemberName';
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
|
||||
|
|
@ -8,7 +9,6 @@ import { getTeamFsWorkerClient } from './TeamFsWorkerClient';
|
|||
import { TeamMembersMetaStore } from './TeamMembersMetaStore';
|
||||
|
||||
import type { TeamConfig, TeamMember, TeamSummary, TeamSummaryMember } from '@shared/types';
|
||||
import { createCliAutoSuffixNameGuard } from '@shared/utils/teamMemberName';
|
||||
|
||||
const logger = createLogger('Service:TeamConfigReader');
|
||||
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ import type {
|
|||
ResolvedTeamMember,
|
||||
SendMessageRequest,
|
||||
SendMessageResult,
|
||||
TaskAttachmentMeta,
|
||||
TaskComment,
|
||||
TeamConfig,
|
||||
TeamCreateConfigRequest,
|
||||
|
|
@ -933,7 +934,7 @@ export class TeamDataService {
|
|||
summary: `Task #${task.id} started`,
|
||||
});
|
||||
} catch (error) {
|
||||
logger.warn(`[TeamDataService] notifyLeadOnTeammateTaskStart failed: ${error}`);
|
||||
logger.warn(`[TeamDataService] notifyLeadOnTeammateTaskStart failed: ${String(error)}`);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -964,7 +965,7 @@ export class TeamDataService {
|
|||
async addTaskAttachment(
|
||||
teamName: string,
|
||||
taskId: string,
|
||||
meta: import('@shared/types').TaskAttachmentMeta
|
||||
meta: TaskAttachmentMeta
|
||||
): Promise<void> {
|
||||
await this.taskWriter.addAttachment(teamName, taskId, meta);
|
||||
}
|
||||
|
|
@ -1007,7 +1008,7 @@ export class TeamDataService {
|
|||
teamName: string,
|
||||
taskId: string,
|
||||
text: string,
|
||||
attachments?: import('@shared/types').TaskAttachmentMeta[]
|
||||
attachments?: TaskAttachmentMeta[]
|
||||
): Promise<TaskComment> {
|
||||
const comment = await this.taskWriter.addComment(teamName, taskId, text, {
|
||||
attachments,
|
||||
|
|
@ -1022,8 +1023,6 @@ export class TeamDataService {
|
|||
const task = tasks.find((t) => t.id === taskId);
|
||||
const leadName = this.resolveLeadNameFromConfig(config);
|
||||
const owner = task?.owner?.trim() || null;
|
||||
const normalizedOwner = owner?.toLowerCase() ?? null;
|
||||
|
||||
// Auto-clear needsClarification: "user" on UI comment
|
||||
// UI comments always have author "user" (TeamTaskWriter default)
|
||||
if (task?.needsClarification === 'user') {
|
||||
|
|
@ -1214,7 +1213,8 @@ export class TeamDataService {
|
|||
name: (() => {
|
||||
const name = member.name.trim();
|
||||
if (!name) throw new Error('Member name cannot be empty');
|
||||
if (name.toLowerCase() === 'team-lead') throw new Error('Member name "team-lead" is reserved');
|
||||
if (name.toLowerCase() === 'team-lead')
|
||||
throw new Error('Member name "team-lead" is reserved');
|
||||
const suffixInfo = parseNumericSuffixName(name);
|
||||
if (suffixInfo && suffixInfo.suffix >= 2) {
|
||||
throw new Error(
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
import { createCliAutoSuffixNameGuard } from '@shared/utils/teamMemberName';
|
||||
|
||||
import type {
|
||||
InboxMessage,
|
||||
MemberStatus,
|
||||
|
|
@ -6,8 +8,6 @@ import type {
|
|||
TeamTaskWithKanban,
|
||||
} from '@shared/types';
|
||||
|
||||
import { createCliAutoSuffixNameGuard } from '@shared/utils/teamMemberName';
|
||||
|
||||
export class TeamMemberResolver {
|
||||
resolveMembers(
|
||||
config: TeamConfig,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import { FileReadTimeoutError, readFileUtf8WithTimeout } from '@main/utils/fsRead';
|
||||
import { getTeamsBasePath } from '@main/utils/pathDecoder';
|
||||
import { createCliAutoSuffixNameGuard } from '@shared/utils/teamMemberName';
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
|
||||
|
|
@ -7,8 +8,6 @@ import { atomicWriteAsync } from './atomicWrite';
|
|||
|
||||
import type { TeamMember } from '@shared/types';
|
||||
|
||||
import { createCliAutoSuffixNameGuard } from '@shared/utils/teamMemberName';
|
||||
|
||||
interface TeamMembersMetaFile {
|
||||
version: 1;
|
||||
members: TeamMember[];
|
||||
|
|
|
|||
|
|
@ -1008,8 +1008,11 @@ interface CachedProbeResult {
|
|||
}
|
||||
|
||||
let cachedProbeResult: CachedProbeResult | null = null;
|
||||
let probeInFlight: Promise<{ claudePath: string; authSource: ProvisioningAuthSource; warning?: string } | null> | null =
|
||||
null;
|
||||
let probeInFlight: Promise<{
|
||||
claudePath: string;
|
||||
authSource: ProvisioningAuthSource;
|
||||
warning?: string;
|
||||
} | null> | null = null;
|
||||
|
||||
export class TeamProvisioningService {
|
||||
private static readonly CLAUDE_LOG_LINES_LIMIT = 50_000;
|
||||
|
|
@ -1046,7 +1049,9 @@ export class TeamProvisioningService {
|
|||
const offsetRaw = query?.offset ?? 0;
|
||||
const limitRaw = query?.limit ?? 100;
|
||||
const offset = Number.isFinite(offsetRaw) ? Math.max(0, Math.floor(offsetRaw)) : 0;
|
||||
const limit = Number.isFinite(limitRaw) ? Math.max(1, Math.min(1000, Math.floor(limitRaw))) : 100;
|
||||
const limit = Number.isFinite(limitRaw)
|
||||
? Math.max(1, Math.min(1000, Math.floor(limitRaw)))
|
||||
: 100;
|
||||
|
||||
const total = run.claudeLogLines.length;
|
||||
if (total === 0) {
|
||||
|
|
@ -1057,15 +1062,17 @@ export class TeamProvisioningService {
|
|||
const oldestInclusive = Math.max(0, newestExclusive - limit);
|
||||
const normalizeLine = (line: string): string => {
|
||||
// Back-compat: older builds prefixed every line with "[stdout] " / "[stderr] "
|
||||
if (line.startsWith('[stdout] ') && line !== '[stdout]') return line.slice('[stdout] '.length);
|
||||
if (line.startsWith('[stderr] ') && line !== '[stderr]') return line.slice('[stderr] '.length);
|
||||
if (line.startsWith('[stdout] ') && line !== '[stdout]')
|
||||
return line.slice('[stdout] '.length);
|
||||
if (line.startsWith('[stderr] ') && line !== '[stderr]')
|
||||
return line.slice('[stderr] '.length);
|
||||
return line;
|
||||
};
|
||||
|
||||
const windowOldestToNewest = run.claudeLogLines
|
||||
const lines = run.claudeLogLines
|
||||
.slice(oldestInclusive, newestExclusive)
|
||||
.map(normalizeLine);
|
||||
const lines = windowOldestToNewest.reverse();
|
||||
.map(normalizeLine)
|
||||
.toReversed();
|
||||
return {
|
||||
lines,
|
||||
total,
|
||||
|
|
@ -1201,7 +1208,8 @@ export class TeamProvisioningService {
|
|||
|
||||
async warmup(): Promise<void> {
|
||||
try {
|
||||
if (cachedProbeResult && Date.now() - cachedProbeResult.cachedAtMs < PROBE_CACHE_TTL_MS) return;
|
||||
if (cachedProbeResult && Date.now() - cachedProbeResult.cachedAtMs < PROBE_CACHE_TTL_MS)
|
||||
return;
|
||||
const result = await this.getCachedOrProbeResult(process.cwd());
|
||||
if (!result) return;
|
||||
logger.info('CLI warmup completed');
|
||||
|
|
@ -1287,7 +1295,11 @@ export class TeamProvisioningService {
|
|||
): Promise<{ claudePath: string; authSource: ProvisioningAuthSource; warning?: string } | null> {
|
||||
const cached = this.getFreshCachedProbeResult();
|
||||
if (cached) {
|
||||
return { claudePath: cached.claudePath, authSource: cached.authSource, warning: cached.warning };
|
||||
return {
|
||||
claudePath: cached.claudePath,
|
||||
authSource: cached.authSource,
|
||||
warning: cached.warning,
|
||||
};
|
||||
}
|
||||
|
||||
if (probeInFlight) {
|
||||
|
|
@ -1300,7 +1312,11 @@ export class TeamProvisioningService {
|
|||
|
||||
const { env, authSource } = await this.buildProvisioningEnv();
|
||||
const probe = await this.probeClaudeRuntime(claudePath, cwd, env);
|
||||
const result = { claudePath, authSource, ...(probe.warning ? { warning: probe.warning } : {}) };
|
||||
const result = {
|
||||
claudePath,
|
||||
authSource,
|
||||
...(probe.warning ? { warning: probe.warning } : {}),
|
||||
};
|
||||
|
||||
if (!probe.warning || !this.isAuthFailureWarning(probe.warning)) {
|
||||
cachedProbeResult = { ...result, cachedAtMs: Date.now() };
|
||||
|
|
@ -1340,12 +1356,13 @@ export class TeamProvisioningService {
|
|||
private sanitizeCliSnippet(text: string): string {
|
||||
// Remove control characters that often show up as binary noise in CLI error payloads.
|
||||
// Preserve newlines/tabs for readability.
|
||||
return text.replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F]/g, '');
|
||||
// eslint-disable-next-line no-control-regex, sonarjs/no-control-regex -- intentionally stripping control chars
|
||||
return text.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]/g, '');
|
||||
}
|
||||
|
||||
private extractApiErrorSnippet(text: string): string | null {
|
||||
const match = /api error:\s*\d{3}\b/i.exec(text) ?? /invalid_request_error/i.exec(text);
|
||||
if (!match || match.index === undefined) return null;
|
||||
if (match?.index === undefined) return null;
|
||||
const start = Math.max(0, match.index - 200);
|
||||
const end = Math.min(text.length, match.index + 4000);
|
||||
const raw = text.slice(start, end).trim();
|
||||
|
|
@ -2505,7 +2522,7 @@ export class TeamProvisioningService {
|
|||
void this.sentMessagesStore
|
||||
.appendMessage(teamName, relayMsg)
|
||||
.catch((e: unknown) =>
|
||||
logger.warn(`[${teamName}] sentMessagesStore persist failed: ${e}`)
|
||||
logger.warn(`[${teamName}] sentMessagesStore persist failed: ${String(e)}`)
|
||||
);
|
||||
this.teamChangeEmitter?.({
|
||||
type: 'inbox',
|
||||
|
|
@ -2726,7 +2743,7 @@ export class TeamProvisioningService {
|
|||
.appendMessage(run.teamName, msg)
|
||||
.catch((e: unknown) =>
|
||||
logger.warn(
|
||||
`[${run.teamName}] sentMessagesStore persist (SendMessage capture) failed: ${e}`
|
||||
`[${run.teamName}] sentMessagesStore persist (SendMessage capture) failed: ${String(e)}`
|
||||
)
|
||||
);
|
||||
this.teamChangeEmitter?.({
|
||||
|
|
@ -2831,7 +2848,10 @@ export class TeamProvisioningService {
|
|||
run.leadTextPushedInCurrentTurn = true;
|
||||
|
||||
const now = Date.now();
|
||||
if (now - run.lastLeadTextEmitMs >= TeamProvisioningService.LEAD_TEXT_EMIT_THROTTLE_MS) {
|
||||
if (
|
||||
now - run.lastLeadTextEmitMs >=
|
||||
TeamProvisioningService.LEAD_TEXT_EMIT_THROTTLE_MS
|
||||
) {
|
||||
run.lastLeadTextEmitMs = now;
|
||||
this.teamChangeEmitter?.({
|
||||
type: 'inbox',
|
||||
|
|
@ -3030,7 +3050,7 @@ export class TeamProvisioningService {
|
|||
void this.sentMessagesStore
|
||||
.appendMessage(run.teamName, replyMsg)
|
||||
.catch((e: unknown) =>
|
||||
logger.warn(`[${run.teamName}] sentMessagesStore persist failed: ${e}`)
|
||||
logger.warn(`[${run.teamName}] sentMessagesStore persist failed: ${String(e)}`)
|
||||
);
|
||||
this.teamChangeEmitter?.({
|
||||
type: 'inbox',
|
||||
|
|
@ -3053,7 +3073,7 @@ export class TeamProvisioningService {
|
|||
void this.sentMessagesStore
|
||||
.appendMessage(run.teamName, fallbackMsg)
|
||||
.catch((e: unknown) =>
|
||||
logger.warn(`[${run.teamName}] sentMessagesStore persist failed: ${e}`)
|
||||
logger.warn(`[${run.teamName}] sentMessagesStore persist failed: ${String(e)}`)
|
||||
);
|
||||
this.teamChangeEmitter?.({
|
||||
type: 'inbox',
|
||||
|
|
@ -3121,14 +3141,10 @@ export class TeamProvisioningService {
|
|||
}
|
||||
|
||||
// Extract compact metadata for the system message
|
||||
const meta = (msg as Record<string, unknown>).compact_metadata as
|
||||
| Record<string, unknown>
|
||||
| undefined;
|
||||
const meta = msg.compact_metadata as Record<string, unknown> | undefined;
|
||||
const trigger = typeof meta?.trigger === 'string' ? meta.trigger : 'auto';
|
||||
const preTokens = typeof meta?.pre_tokens === 'number' ? meta.pre_tokens : null;
|
||||
const tokenInfo = preTokens
|
||||
? ` (was ~${(preTokens / 1000).toFixed(0)}k tokens)`
|
||||
: '';
|
||||
const tokenInfo = preTokens ? ` (was ~${(preTokens / 1000).toFixed(0)}k tokens)` : '';
|
||||
|
||||
const compactMsg: InboxMessage = {
|
||||
from: 'system',
|
||||
|
|
@ -3160,7 +3176,12 @@ export class TeamProvisioningService {
|
|||
private async handleProvisioningTurnComplete(run: ProvisioningRun): Promise<void> {
|
||||
// Guard: must be set synchronously BEFORE any await to prevent
|
||||
// double-invocation from filesystem monitor + stream-json racing.
|
||||
if (run.provisioningComplete || run.cancelRequested || run.processKilled || run.progress.state === 'failed')
|
||||
if (
|
||||
run.provisioningComplete ||
|
||||
run.cancelRequested ||
|
||||
run.processKilled ||
|
||||
run.progress.state === 'failed'
|
||||
)
|
||||
return;
|
||||
|
||||
// Prevent false "ready" when auth failure was printed as assistant text or logs
|
||||
|
|
@ -3172,7 +3193,11 @@ export class TeamProvisioningService {
|
|||
.filter(Boolean)
|
||||
.join('\n')
|
||||
.trim();
|
||||
if (preCompleteText && this.hasApiError(preCompleteText) && !this.isAuthFailureWarning(preCompleteText)) {
|
||||
if (
|
||||
preCompleteText &&
|
||||
this.hasApiError(preCompleteText) &&
|
||||
!this.isAuthFailureWarning(preCompleteText)
|
||||
) {
|
||||
this.failProvisioningWithApiError(run, preCompleteText);
|
||||
return;
|
||||
}
|
||||
|
|
@ -3235,7 +3260,7 @@ export class TeamProvisioningService {
|
|||
|
||||
// Pick up any direct messages that arrived before/while reconnecting.
|
||||
void this.relayLeadInboxMessages(run.teamName).catch((e: unknown) =>
|
||||
logger.warn(`[${run.teamName}] post-reconnect relay failed: ${e}`)
|
||||
logger.warn(`[${run.teamName}] post-reconnect relay failed: ${String(e)}`)
|
||||
);
|
||||
|
||||
// Solo teams have no teammate processes to resume work; kick off task execution
|
||||
|
|
@ -3320,7 +3345,7 @@ export class TeamProvisioningService {
|
|||
|
||||
// Pick up any direct messages that arrived during provisioning.
|
||||
void this.relayLeadInboxMessages(run.teamName).catch((e: unknown) =>
|
||||
logger.warn(`[${run.teamName}] post-provisioning relay failed: ${e}`)
|
||||
logger.warn(`[${run.teamName}] post-provisioning relay failed: ${String(e)}`)
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -3962,7 +3987,7 @@ export class TeamProvisioningService {
|
|||
private async cleanupCliAutoSuffixedMembers(teamName: string): Promise<void> {
|
||||
const configPath = path.join(getTeamsBasePath(), teamName, 'config.json');
|
||||
|
||||
let removedFromConfig: string[] = [];
|
||||
const removedFromConfig: string[] = [];
|
||||
try {
|
||||
const raw = await tryReadRegularFileUtf8(configPath, {
|
||||
timeoutMs: TEAM_JSON_READ_TIMEOUT_MS,
|
||||
|
|
@ -3976,7 +4001,9 @@ export class TeamProvisioningService {
|
|||
if (membersRaw.length > 0) {
|
||||
const teammateNames = membersRaw
|
||||
.map((m) => (typeof m.name === 'string' ? m.name.trim() : ''))
|
||||
.filter((n) => n.length > 0 && n.toLowerCase() !== 'team-lead' && n.toLowerCase() !== 'user');
|
||||
.filter(
|
||||
(n) => n.length > 0 && n.toLowerCase() !== 'team-lead' && n.toLowerCase() !== 'user'
|
||||
);
|
||||
|
||||
const keepName = createCliAutoSuffixNameGuard(teammateNames);
|
||||
const nextMembers: Record<string, unknown>[] = [];
|
||||
|
|
@ -4008,14 +4035,16 @@ export class TeamProvisioningService {
|
|||
// best-effort
|
||||
}
|
||||
|
||||
let activeNamesForInboxCleanup: Set<string> = new Set();
|
||||
let activeNamesForInboxCleanup = new Set<string>();
|
||||
try {
|
||||
const metaMembers = await this.membersMetaStore.getMembers(teamName);
|
||||
if (metaMembers.length > 0) {
|
||||
const activeNames = metaMembers
|
||||
.filter((m) => !m.removedAt)
|
||||
.map((m) => m.name.trim())
|
||||
.filter((n) => n.length > 0 && n.toLowerCase() !== 'team-lead' && n.toLowerCase() !== 'user');
|
||||
.filter(
|
||||
(n) => n.length > 0 && n.toLowerCase() !== 'team-lead' && n.toLowerCase() !== 'user'
|
||||
);
|
||||
|
||||
const keepName = createCliAutoSuffixNameGuard(activeNames);
|
||||
const removedFromMeta: string[] = [];
|
||||
|
|
@ -4042,7 +4071,9 @@ export class TeamProvisioningService {
|
|||
nextMeta
|
||||
.filter((m) => !m.removedAt)
|
||||
.map((m) => m.name.trim())
|
||||
.filter((n) => n.length > 0 && n.toLowerCase() !== 'team-lead' && n.toLowerCase() !== 'user')
|
||||
.filter(
|
||||
(n) => n.length > 0 && n.toLowerCase() !== 'team-lead' && n.toLowerCase() !== 'user'
|
||||
)
|
||||
);
|
||||
}
|
||||
} catch {
|
||||
|
|
|
|||
|
|
@ -258,7 +258,7 @@ function dropCliAutoSuffixedMembers(
|
|||
for (const key of keys) {
|
||||
const member = memberMap.get(key);
|
||||
const name = member?.name ?? '';
|
||||
const match = name.trim().match(/^(.+)-(\d+)$/);
|
||||
const match = /^(.+)-(\d+)$/.exec(name.trim());
|
||||
if (!match?.[1] || !match[2]) continue;
|
||||
const suffix = Number(match[2]);
|
||||
if (!Number.isFinite(suffix) || suffix < 2) continue;
|
||||
|
|
|
|||
|
|
@ -67,6 +67,7 @@ import {
|
|||
TEAM_CREATE,
|
||||
TEAM_CREATE_CONFIG,
|
||||
TEAM_CREATE_TASK,
|
||||
TEAM_DELETE_TASK_ATTACHMENT,
|
||||
TEAM_DELETE_TEAM,
|
||||
TEAM_GET_ALL_TASKS,
|
||||
TEAM_GET_ATTACHMENTS,
|
||||
|
|
@ -77,6 +78,7 @@ import {
|
|||
TEAM_GET_MEMBER_LOGS,
|
||||
TEAM_GET_MEMBER_STATS,
|
||||
TEAM_GET_PROJECT_BRANCH,
|
||||
TEAM_GET_TASK_ATTACHMENT,
|
||||
TEAM_KILL_PROCESS,
|
||||
TEAM_LAUNCH,
|
||||
TEAM_LEAD_ACTIVITY,
|
||||
|
|
@ -91,12 +93,10 @@ import {
|
|||
TEAM_REMOVE_MEMBER,
|
||||
TEAM_REMOVE_TASK_RELATIONSHIP,
|
||||
TEAM_REPLACE_MEMBERS,
|
||||
TEAM_SAVE_TASK_ATTACHMENT,
|
||||
TEAM_GET_TASK_ATTACHMENT,
|
||||
TEAM_DELETE_TASK_ATTACHMENT,
|
||||
TEAM_REQUEST_REVIEW,
|
||||
TEAM_RESTORE,
|
||||
TEAM_RESTORE_TASK,
|
||||
TEAM_SAVE_TASK_ATTACHMENT,
|
||||
TEAM_SEND_MESSAGE,
|
||||
TEAM_SET_TASK_CLARIFICATION,
|
||||
TEAM_SHOW_MESSAGE_NOTIFICATION,
|
||||
|
|
@ -168,6 +168,7 @@ import type {
|
|||
ClaudeRootInfo,
|
||||
CliInstallationStatus,
|
||||
CliInstallerProgress,
|
||||
CommentAttachmentPayload,
|
||||
ConflictCheckResult,
|
||||
ContextInfo,
|
||||
CreateTaskRequest,
|
||||
|
|
@ -193,7 +194,6 @@ import type {
|
|||
SshConnectionConfig,
|
||||
SshConnectionStatus,
|
||||
SshLastConnection,
|
||||
CommentAttachmentPayload,
|
||||
TaskAttachmentMeta,
|
||||
TaskChangeSetV2,
|
||||
TaskComment,
|
||||
|
|
|
|||
|
|
@ -12,11 +12,11 @@ import {
|
|||
COLOR_TEXT_MUTED,
|
||||
COLOR_TEXT_SECONDARY,
|
||||
} from '@renderer/constants/cssVariables';
|
||||
import { formatPercentOfTotal } from '@renderer/utils/contextMath';
|
||||
import { formatCostUsd } from '@shared/utils/costFormatting';
|
||||
import { ArrowDownWideNarrow, FileText, LayoutList, X } from 'lucide-react';
|
||||
|
||||
import { formatTokens } from '../utils/formatting';
|
||||
import { formatPercentOfTotal } from '@renderer/utils/contextMath';
|
||||
|
||||
import { SessionContextHelpTooltip } from './SessionContextHelpTooltip';
|
||||
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import {
|
|||
COLOR_SURFACE_OVERLAY,
|
||||
COLOR_TEXT_MUTED,
|
||||
} from '@renderer/constants/cssVariables';
|
||||
import { sumContextInjectionTokens } from '@renderer/utils/contextMath';
|
||||
|
||||
import { ClaudeMdFilesSection } from './components/ClaudeMdFilesSection';
|
||||
import { FlatInjectionList } from './components/FlatInjectionList';
|
||||
|
|
@ -29,7 +30,6 @@ import {
|
|||
SECTION_TOOL_OUTPUTS,
|
||||
SECTION_USER_MESSAGES,
|
||||
} from './types';
|
||||
import { sumContextInjectionTokens } from '@renderer/utils/contextMath';
|
||||
|
||||
import type { ContextViewMode, SectionType, SessionContextPanelProps } from './types';
|
||||
import type {
|
||||
|
|
@ -133,10 +133,7 @@ export const SessionContextPanel = ({
|
|||
}, [injections]);
|
||||
|
||||
// Calculate total tokens
|
||||
const totalTokens = useMemo(
|
||||
() => sumContextInjectionTokens(injections),
|
||||
[injections]
|
||||
);
|
||||
const totalTokens = useMemo(() => sumContextInjectionTokens(injections), [injections]);
|
||||
|
||||
// Section token counts
|
||||
const claudeMdTokens = useMemo(
|
||||
|
|
|
|||
|
|
@ -28,6 +28,8 @@ import {
|
|||
} from '@shared/constants/triggerColors';
|
||||
import { Wrench } from 'lucide-react';
|
||||
|
||||
import { highlightQueryInText } from '../searchHighlightUtils';
|
||||
|
||||
import { BaseItem, StatusDot } from './BaseItem';
|
||||
import { formatDuration } from './baseItemHelpers';
|
||||
import {
|
||||
|
|
@ -38,7 +40,6 @@ import {
|
|||
ToolErrorDisplay,
|
||||
WriteToolViewer,
|
||||
} from './linkedTool';
|
||||
import { highlightQueryInText } from '../searchHighlightUtils';
|
||||
|
||||
import type { LinkedToolItem as LinkedToolItemType } from '@renderer/types/groups';
|
||||
|
||||
|
|
@ -72,9 +73,14 @@ export const LinkedToolItem: React.FC<LinkedToolItemProps> = ({
|
|||
const summary = getToolSummary(linkedTool.name, linkedTool.input);
|
||||
const summaryNode =
|
||||
searchQueryOverride && searchQueryOverride.trim().length > 0
|
||||
? highlightQueryInText(summary, searchQueryOverride, `${linkedTool.id ?? linkedTool.name}:summary`, {
|
||||
forceAllActive: true,
|
||||
})
|
||||
? highlightQueryInText(
|
||||
summary,
|
||||
searchQueryOverride,
|
||||
`${linkedTool.id ?? linkedTool.name}:summary`,
|
||||
{
|
||||
forceAllActive: true,
|
||||
}
|
||||
)
|
||||
: summary;
|
||||
const elementRef = useRef<HTMLDivElement>(null);
|
||||
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@ import React from 'react';
|
|||
|
||||
import { MessageSquare } from 'lucide-react';
|
||||
|
||||
import { MarkdownViewer } from '../viewers';
|
||||
import { highlightQueryInText } from '../searchHighlightUtils';
|
||||
import { MarkdownViewer } from '../viewers';
|
||||
|
||||
import { BaseItem } from './BaseItem';
|
||||
import { truncateText } from './baseItemHelpers';
|
||||
|
|
@ -42,9 +42,14 @@ export const TextItem: React.FC<TextItemProps> = ({
|
|||
const fullContent = step.content.outputText ?? preview;
|
||||
const truncatedPreview = truncateText(preview, 60);
|
||||
const summary = searchQueryOverride
|
||||
? highlightQueryInText(truncatedPreview, searchQueryOverride, `${markdownItemId ?? step.id}:summary`, {
|
||||
forceAllActive: true,
|
||||
})
|
||||
? highlightQueryInText(
|
||||
truncatedPreview,
|
||||
searchQueryOverride,
|
||||
`${markdownItemId ?? step.id}:summary`,
|
||||
{
|
||||
forceAllActive: true,
|
||||
}
|
||||
)
|
||||
: truncatedPreview;
|
||||
|
||||
// Get token count from step.tokens.output or step.content.tokenCount
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@ import React from 'react';
|
|||
|
||||
import { Brain } from 'lucide-react';
|
||||
|
||||
import { MarkdownViewer } from '../viewers';
|
||||
import { highlightQueryInText } from '../searchHighlightUtils';
|
||||
import { MarkdownViewer } from '../viewers';
|
||||
|
||||
import { BaseItem } from './BaseItem';
|
||||
import { truncateText } from './baseItemHelpers';
|
||||
|
|
@ -42,9 +42,14 @@ export const ThinkingItem: React.FC<ThinkingItemProps> = ({
|
|||
const fullContent = step.content.thinkingText ?? preview;
|
||||
const truncatedPreview = truncateText(preview, 60);
|
||||
const summary = searchQueryOverride
|
||||
? highlightQueryInText(truncatedPreview, searchQueryOverride, `${markdownItemId ?? step.id}:summary`, {
|
||||
forceAllActive: true,
|
||||
})
|
||||
? highlightQueryInText(
|
||||
truncatedPreview,
|
||||
searchQueryOverride,
|
||||
`${markdownItemId ?? step.id}:summary`,
|
||||
{
|
||||
forceAllActive: true,
|
||||
}
|
||||
)
|
||||
: truncatedPreview;
|
||||
|
||||
// Get token count from step.tokens.output or step.content.tokenCount
|
||||
|
|
|
|||
|
|
@ -112,6 +112,7 @@ function highlightSearchText(text: string, ctx: SearchContext): React.ReactNode
|
|||
return parts;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line sonarjs/function-return-type -- React child manipulation inherently returns mixed node types
|
||||
export function highlightQueryInText(
|
||||
text: string,
|
||||
query: string,
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import ReactMarkdown, { type Components, defaultUrlTransform } from 'react-markd
|
|||
import { api } from '@renderer/api';
|
||||
import { CopyButton } from '@renderer/components/common/CopyButton';
|
||||
import { TaskTooltip } from '@renderer/components/team/TaskTooltip';
|
||||
import { getTeamColorSet } from '@renderer/constants/teamColors';
|
||||
import {
|
||||
CODE_BG,
|
||||
CODE_BORDER,
|
||||
|
|
@ -24,6 +23,7 @@ import {
|
|||
PROSE_TABLE_BORDER,
|
||||
PROSE_TABLE_HEADER_BG,
|
||||
} from '@renderer/constants/cssVariables';
|
||||
import { getTeamColorSet } from '@renderer/constants/teamColors';
|
||||
import { useStore } from '@renderer/store';
|
||||
import { REHYPE_PLUGINS, REHYPE_PLUGINS_NO_HIGHLIGHT } from '@renderer/utils/markdownPlugins';
|
||||
import { FileText } from 'lucide-react';
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ export const SettingsView = (): React.JSX.Element | null => {
|
|||
// Consume pending section (avoid setState during render)
|
||||
useEffect(() => {
|
||||
if (pendingSettingsSection) {
|
||||
// eslint-disable-next-line react-hooks/set-state-in-effect -- intentional sync on prop change
|
||||
setActiveSection(pendingSettingsSection as SettingsSection);
|
||||
clearPendingSettingsSection();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,8 +9,14 @@ import { useCallback, useEffect, useRef, useState } from 'react';
|
|||
|
||||
import { defaultKeymap, history, historyKeymap } from '@codemirror/commands';
|
||||
import { json } from '@codemirror/lang-json';
|
||||
import { bracketMatching, foldGutter, foldKeymap, indentOnInput, syntaxHighlighting } from '@codemirror/language';
|
||||
import { lintGutter, linter, type Diagnostic } from '@codemirror/lint';
|
||||
import {
|
||||
bracketMatching,
|
||||
foldGutter,
|
||||
foldKeymap,
|
||||
indentOnInput,
|
||||
syntaxHighlighting,
|
||||
} from '@codemirror/language';
|
||||
import { type Diagnostic, linter, lintGutter } from '@codemirror/lint';
|
||||
import { search, searchKeymap } from '@codemirror/search';
|
||||
import { EditorState } from '@codemirror/state';
|
||||
import { oneDarkHighlightStyle } from '@codemirror/theme-one-dark';
|
||||
|
|
@ -45,7 +51,7 @@ const jsonLinter = linter((view: EditorView) => {
|
|||
JSON.parse(text);
|
||||
} catch (e) {
|
||||
if (e instanceof SyntaxError) {
|
||||
const match = e.message.match(/position (\d+)/);
|
||||
const match = /position (\d+)/.exec(e.message);
|
||||
const pos = match ? parseInt(match[1], 10) : 0;
|
||||
const safePos = Math.min(pos, text.length);
|
||||
diagnostics.push({
|
||||
|
|
@ -163,6 +169,7 @@ export const ConfigEditorDialog = ({
|
|||
if (!open) return;
|
||||
|
||||
let destroyed = false;
|
||||
// eslint-disable-next-line react-hooks/set-state-in-effect -- intentional sync on prop change
|
||||
setLoading(true);
|
||||
setSaveStatus('idle');
|
||||
setJsonError(null);
|
||||
|
|
@ -203,6 +210,7 @@ export const ConfigEditorDialog = ({
|
|||
keymap.of([...defaultKeymap, ...historyKeymap, ...foldKeymap, ...searchKeymap]),
|
||||
baseEditorTheme,
|
||||
configEditorTheme,
|
||||
// eslint-disable-next-line sonarjs/no-nested-functions -- CodeMirror listener callback within useEffect setup
|
||||
EditorView.updateListener.of((update) => {
|
||||
if (update.docChanged) {
|
||||
const text = update.state.doc.toString();
|
||||
|
|
|
|||
|
|
@ -250,6 +250,7 @@ export const GlobalTaskList = ({
|
|||
// Reset showArchived when archive becomes empty
|
||||
useEffect(() => {
|
||||
if (showArchived && !hasArchivedTasks) {
|
||||
// eslint-disable-next-line react-hooks/set-state-in-effect -- intentional sync on prop change
|
||||
setShowArchived(false);
|
||||
}
|
||||
}, [showArchived, hasArchivedTasks]);
|
||||
|
|
|
|||
|
|
@ -96,6 +96,7 @@ export const SidebarTaskItem = ({
|
|||
// Reset edit value when renaming starts
|
||||
useEffect(() => {
|
||||
if (isRenaming) {
|
||||
// eslint-disable-next-line react-hooks/set-state-in-effect -- intentional sync on prop change
|
||||
setEditValue(displaySubject);
|
||||
}
|
||||
}, [isRenaming, displaySubject]);
|
||||
|
|
|
|||
|
|
@ -127,12 +127,26 @@ export const ClaudeLogsFilterPopover = ({
|
|||
Stream
|
||||
</p>
|
||||
<div className="space-y-1">
|
||||
<label className="flex cursor-pointer items-center gap-2 rounded-md px-1 py-0.5 text-xs text-[var(--color-text-secondary)] hover:bg-[var(--color-surface-raised)]">
|
||||
<Checkbox checked={draft.streams.has('stdout')} onCheckedChange={() => toggleStream('stdout')} />
|
||||
<label
|
||||
htmlFor="filter-stream-stdout"
|
||||
className="flex cursor-pointer items-center gap-2 rounded-md px-1 py-0.5 text-xs text-[var(--color-text-secondary)] hover:bg-[var(--color-surface-raised)]"
|
||||
>
|
||||
<Checkbox
|
||||
id="filter-stream-stdout"
|
||||
checked={draft.streams.has('stdout')}
|
||||
onCheckedChange={() => toggleStream('stdout')}
|
||||
/>
|
||||
stdout
|
||||
</label>
|
||||
<label className="flex cursor-pointer items-center gap-2 rounded-md px-1 py-0.5 text-xs text-[var(--color-text-secondary)] hover:bg-[var(--color-surface-raised)]">
|
||||
<Checkbox checked={draft.streams.has('stderr')} onCheckedChange={() => toggleStream('stderr')} />
|
||||
<label
|
||||
htmlFor="filter-stream-stderr"
|
||||
className="flex cursor-pointer items-center gap-2 rounded-md px-1 py-0.5 text-xs text-[var(--color-text-secondary)] hover:bg-[var(--color-surface-raised)]"
|
||||
>
|
||||
<Checkbox
|
||||
id="filter-stream-stderr"
|
||||
checked={draft.streams.has('stderr')}
|
||||
onCheckedChange={() => toggleStream('stderr')}
|
||||
/>
|
||||
stderr
|
||||
</label>
|
||||
</div>
|
||||
|
|
@ -143,16 +157,37 @@ export const ClaudeLogsFilterPopover = ({
|
|||
Content
|
||||
</p>
|
||||
<div className="space-y-1">
|
||||
<label className="flex cursor-pointer items-center gap-2 rounded-md px-1 py-0.5 text-xs text-[var(--color-text-secondary)] hover:bg-[var(--color-surface-raised)]">
|
||||
<Checkbox checked={draft.kinds.has('output')} onCheckedChange={() => toggleKind('output')} />
|
||||
<label
|
||||
htmlFor="filter-kind-output"
|
||||
className="flex cursor-pointer items-center gap-2 rounded-md px-1 py-0.5 text-xs text-[var(--color-text-secondary)] hover:bg-[var(--color-surface-raised)]"
|
||||
>
|
||||
<Checkbox
|
||||
id="filter-kind-output"
|
||||
checked={draft.kinds.has('output')}
|
||||
onCheckedChange={() => toggleKind('output')}
|
||||
/>
|
||||
Output
|
||||
</label>
|
||||
<label className="flex cursor-pointer items-center gap-2 rounded-md px-1 py-0.5 text-xs text-[var(--color-text-secondary)] hover:bg-[var(--color-surface-raised)]">
|
||||
<Checkbox checked={draft.kinds.has('thinking')} onCheckedChange={() => toggleKind('thinking')} />
|
||||
<label
|
||||
htmlFor="filter-kind-thinking"
|
||||
className="flex cursor-pointer items-center gap-2 rounded-md px-1 py-0.5 text-xs text-[var(--color-text-secondary)] hover:bg-[var(--color-surface-raised)]"
|
||||
>
|
||||
<Checkbox
|
||||
id="filter-kind-thinking"
|
||||
checked={draft.kinds.has('thinking')}
|
||||
onCheckedChange={() => toggleKind('thinking')}
|
||||
/>
|
||||
Thinking
|
||||
</label>
|
||||
<label className="flex cursor-pointer items-center gap-2 rounded-md px-1 py-0.5 text-xs text-[var(--color-text-secondary)] hover:bg-[var(--color-surface-raised)]">
|
||||
<Checkbox checked={draft.kinds.has('tool')} onCheckedChange={() => toggleKind('tool')} />
|
||||
<label
|
||||
htmlFor="filter-kind-tool"
|
||||
className="flex cursor-pointer items-center gap-2 rounded-md px-1 py-0.5 text-xs text-[var(--color-text-secondary)] hover:bg-[var(--color-surface-raised)]"
|
||||
>
|
||||
<Checkbox
|
||||
id="filter-kind-tool"
|
||||
checked={draft.kinds.has('tool')}
|
||||
onCheckedChange={() => toggleKind('tool')}
|
||||
/>
|
||||
Tool calls
|
||||
</label>
|
||||
</div>
|
||||
|
|
@ -176,4 +211,3 @@ export const ClaudeLogsFilterPopover = ({
|
|||
</Popover>
|
||||
);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -5,20 +5,19 @@ import { Button } from '@renderer/components/ui/button';
|
|||
import { cn } from '@renderer/lib/utils';
|
||||
import { Search, Terminal, X } from 'lucide-react';
|
||||
|
||||
import { CollapsibleTeamSection } from './CollapsibleTeamSection';
|
||||
import { ClaudeLogsFilterPopover, DEFAULT_CLAUDE_LOGS_FILTER } from './ClaudeLogsFilterPopover';
|
||||
import { CliLogsRichView } from './CliLogsRichView';
|
||||
import {
|
||||
ClaudeLogsFilterPopover,
|
||||
DEFAULT_CLAUDE_LOGS_FILTER,
|
||||
} from './ClaudeLogsFilterPopover';
|
||||
import { CollapsibleTeamSection } from './CollapsibleTeamSection';
|
||||
|
||||
import type { TeamClaudeLogsResponse } from '@shared/types';
|
||||
import type { ClaudeLogsFilterState } from './ClaudeLogsFilterPopover';
|
||||
import type { TeamClaudeLogsResponse } from '@shared/types';
|
||||
|
||||
const PAGE_SIZE = 100;
|
||||
const POLL_MS = 2000;
|
||||
const ONLINE_WINDOW_MS = 10_000;
|
||||
|
||||
type StreamType = 'stdout' | 'stderr';
|
||||
|
||||
interface ClaudeLogsSectionProps {
|
||||
teamName: string;
|
||||
}
|
||||
|
|
@ -37,9 +36,9 @@ function normalizeToStreamJsonText(linesNewestFirst: string[]): string {
|
|||
const chronological = [...linesNewestFirst].reverse();
|
||||
|
||||
const out: string[] = [];
|
||||
let lastStream: 'stdout' | 'stderr' | null = null;
|
||||
let lastStream: StreamType | null = null;
|
||||
|
||||
const pushMarker = (stream: 'stdout' | 'stderr'): void => {
|
||||
const pushMarker = (stream: StreamType): void => {
|
||||
if (lastStream === stream) return;
|
||||
lastStream = stream;
|
||||
out.push(stream === 'stdout' ? '[stdout]' : '[stderr]');
|
||||
|
|
@ -84,8 +83,8 @@ function filterStreamJsonText(
|
|||
const q = queryRaw.trim().toLowerCase();
|
||||
const chronological = normalizeToStreamJsonText(linesNewestFirst).split('\n');
|
||||
|
||||
let currentStream: 'stdout' | 'stderr' | null = null;
|
||||
let lastEmittedStream: 'stdout' | 'stderr' | null = null;
|
||||
let currentStream: StreamType | null = null;
|
||||
let lastEmittedStream: StreamType | null = null;
|
||||
const out: string[] = [];
|
||||
|
||||
const emitMarker = (): void => {
|
||||
|
|
@ -108,7 +107,10 @@ function filterStreamJsonText(
|
|||
return null;
|
||||
};
|
||||
|
||||
const writeBlocks = (parsed: Record<string, unknown>, blocks: AssistantContentBlock[]): Record<string, unknown> => {
|
||||
const writeBlocks = (
|
||||
parsed: Record<string, unknown>,
|
||||
blocks: AssistantContentBlock[]
|
||||
): Record<string, unknown> => {
|
||||
if (Array.isArray(parsed.content)) {
|
||||
return { ...parsed, content: blocks };
|
||||
}
|
||||
|
|
@ -233,12 +235,16 @@ export const ClaudeLogsSection = ({ teamName }: ClaudeLogsSectionProps): React.J
|
|||
useEffect(() => {
|
||||
let cancelled = false;
|
||||
|
||||
const computeNewCount = (committed: TeamClaudeLogsResponse, latest: TeamClaudeLogsResponse): number => {
|
||||
const computeNewCount = (
|
||||
committed: TeamClaudeLogsResponse,
|
||||
latest: TeamClaudeLogsResponse
|
||||
): number => {
|
||||
if (committed.lines.length === 0) return latest.lines.length;
|
||||
const marker = committed.lines[0];
|
||||
const idx = latest.lines.indexOf(marker);
|
||||
if (idx >= 0) return idx;
|
||||
const diff = (latest.total ?? latest.lines.length) - (committed.total ?? committed.lines.length);
|
||||
const diff =
|
||||
(latest.total ?? latest.lines.length) - (committed.total ?? committed.lines.length);
|
||||
return Math.max(0, diff);
|
||||
};
|
||||
|
||||
|
|
@ -386,12 +392,7 @@ export const ClaudeLogsSection = ({ teamName }: ClaudeLogsSectionProps): React.J
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div
|
||||
className={cn(
|
||||
'rounded',
|
||||
loading && 'opacity-80'
|
||||
)}
|
||||
>
|
||||
<div className={cn('rounded', loading && 'opacity-80')}>
|
||||
{error ? <p className="p-2 text-xs text-red-300">{error}</p> : null}
|
||||
{!error && filteredText.trim().length > 0 ? (
|
||||
<CliLogsRichView
|
||||
|
|
@ -418,12 +419,9 @@ export const ClaudeLogsSection = ({ teamName }: ClaudeLogsSectionProps): React.J
|
|||
</p>
|
||||
) : null}
|
||||
{!error && data.lines.length > 0 && filteredText.trim().length === 0 ? (
|
||||
<p className="p-2 text-xs text-[var(--color-text-muted)]">
|
||||
No matching logs.
|
||||
</p>
|
||||
<p className="p-2 text-xs text-[var(--color-text-muted)]">No matching logs.</p>
|
||||
) : null}
|
||||
</div>
|
||||
</CollapsibleTeamSection>
|
||||
);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@ function useElapsedTimer(startedAt?: string, isRunning = true): string | null {
|
|||
|
||||
useEffect(() => {
|
||||
if (!startedAt) {
|
||||
// eslint-disable-next-line react-hooks/set-state-in-effect -- intentional sync on prop change
|
||||
setElapsedSeconds(null);
|
||||
return;
|
||||
}
|
||||
|
|
@ -201,7 +202,8 @@ export const ProvisioningProgressBlock = ({
|
|||
variant="secondary"
|
||||
className={cn(
|
||||
'whitespace-nowrap px-2 py-0.5 text-[11px] font-normal',
|
||||
isDone && 'border-[var(--step-done-border)] bg-[var(--step-done-bg)] text-[var(--step-done-text)]',
|
||||
isDone &&
|
||||
'border-[var(--step-done-border)] bg-[var(--step-done-bg)] text-[var(--step-done-text)]',
|
||||
isCurrent &&
|
||||
'border-[var(--step-current-border)] bg-[var(--step-current-bg)] text-[var(--step-current-text)]'
|
||||
)}
|
||||
|
|
|
|||
|
|
@ -3,17 +3,7 @@ import React, { useCallback, useMemo, useState } from 'react';
|
|||
import { Combobox } from '@renderer/components/ui/combobox';
|
||||
import { Input } from '@renderer/components/ui/input';
|
||||
import { CUSTOM_ROLE, FORBIDDEN_ROLES, NO_ROLE, PRESET_ROLES } from '@renderer/constants/teamRoles';
|
||||
import {
|
||||
Blocks,
|
||||
BookOpen,
|
||||
Bug,
|
||||
Check,
|
||||
Code2,
|
||||
FileText,
|
||||
Pencil,
|
||||
Shield,
|
||||
Zap,
|
||||
} from 'lucide-react';
|
||||
import { Blocks, BookOpen, Bug, Check, Code2, FileText, Pencil, Shield, Zap } from 'lucide-react';
|
||||
|
||||
import type { ComboboxOption } from '@renderer/components/ui/combobox';
|
||||
import type { LucideIcon } from 'lucide-react';
|
||||
|
|
@ -61,13 +51,14 @@ const roleOptions: ComboboxOption[] = [
|
|||
{ value: CUSTOM_ROLE, label: 'Custom role...' },
|
||||
];
|
||||
|
||||
// eslint-disable-next-line sonarjs/function-return-type -- option renderer returns mixed node structure
|
||||
const renderRoleOption = (option: ComboboxOption, isSelected: boolean): React.ReactNode => {
|
||||
const Icon =
|
||||
option.value === CUSTOM_ROLE
|
||||
? CUSTOM_ICON
|
||||
: option.value === NO_ROLE
|
||||
? null
|
||||
: ROLE_ICONS[option.value] ?? null;
|
||||
: (ROLE_ICONS[option.value] ?? null);
|
||||
|
||||
return (
|
||||
<>
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -1,6 +1,5 @@
|
|||
import { useEffect, useMemo, useRef, useState } from 'react';
|
||||
|
||||
import { parseStructuredAgentMessage } from '@renderer/utils/agentMessageFormatting';
|
||||
import { buildMemberColorMap } from '@renderer/utils/memberHelpers';
|
||||
|
||||
import { ActivityItem, isNoiseMessage } from './ActivityItem';
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { useMemo, useState } from 'react';
|
||||
import { useState } from 'react';
|
||||
|
||||
import { MarkdownViewer } from '@renderer/components/chat/viewers/MarkdownViewer';
|
||||
import { MemberBadge } from '@renderer/components/team/MemberBadge';
|
||||
|
|
@ -42,14 +42,8 @@ export const ReplyQuoteBlock = ({
|
|||
</div>
|
||||
|
||||
{/* Quote text */}
|
||||
<div
|
||||
className={`pr-5 opacity-50 ${expanded ? '' : 'max-h-[3.75rem] overflow-hidden'}`}
|
||||
>
|
||||
<MarkdownViewer
|
||||
content={reply.originalText}
|
||||
bare
|
||||
maxHeight={quoteMaxHeight}
|
||||
/>
|
||||
<div className={`pr-5 opacity-50 ${expanded ? '' : 'max-h-[3.75rem] overflow-hidden'}`}>
|
||||
<MarkdownViewer content={reply.originalText} bare maxHeight={quoteMaxHeight} />
|
||||
</div>
|
||||
|
||||
{/* More/less toggle */}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,12 @@
|
|||
import 'yet-another-react-lightbox/styles.css';
|
||||
import 'yet-another-react-lightbox/plugins/counter.css';
|
||||
|
||||
import { useMemo } from 'react';
|
||||
|
||||
import Lightbox from 'yet-another-react-lightbox';
|
||||
import Counter from 'yet-another-react-lightbox/plugins/counter';
|
||||
import Fullscreen from 'yet-another-react-lightbox/plugins/fullscreen';
|
||||
import Zoom from 'yet-another-react-lightbox/plugins/zoom';
|
||||
import 'yet-another-react-lightbox/styles.css';
|
||||
import 'yet-another-react-lightbox/plugins/counter.css';
|
||||
|
||||
import type { Plugin, Slide } from 'yet-another-react-lightbox';
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import { useCallback, useMemo, useState } from 'react';
|
||||
|
||||
import { RoleSelect } from '@renderer/components/team/RoleSelect';
|
||||
import { Button } from '@renderer/components/ui/button';
|
||||
import {
|
||||
Dialog,
|
||||
|
|
@ -12,7 +13,6 @@ import {
|
|||
import { Input } from '@renderer/components/ui/input';
|
||||
import { Label } from '@renderer/components/ui/label';
|
||||
import { MentionableTextarea } from '@renderer/components/ui/MentionableTextarea';
|
||||
import { RoleSelect } from '@renderer/components/team/RoleSelect';
|
||||
import { CUSTOM_ROLE, NO_ROLE } from '@renderer/constants/teamRoles';
|
||||
import { useDraftPersistence } from '@renderer/hooks/useDraftPersistence';
|
||||
import { useFileListCacheWarmer } from '@renderer/hooks/useFileListCacheWarmer';
|
||||
|
|
|
|||
|
|
@ -94,6 +94,7 @@ export const CreateTaskDialog = ({
|
|||
// Reset form when dialog opens (avoid setState during render)
|
||||
useEffect(() => {
|
||||
if (open && !prevOpenRef.current) {
|
||||
// eslint-disable-next-line react-hooks/set-state-in-effect -- intentional sync on prop change
|
||||
setSubject(defaultSubject);
|
||||
if (defaultChip) {
|
||||
const token = chipToken(defaultChip);
|
||||
|
|
|
|||
|
|
@ -559,6 +559,7 @@ export const CreateTeamDialog = ({
|
|||
setTeamName(value);
|
||||
setFieldErrors((prev) => {
|
||||
if (!prev.teamName) return prev;
|
||||
// eslint-disable-next-line sonarjs/no-unused-vars -- destructured to omit teamName from rest
|
||||
const { teamName: _teamName, ...rest } = prev;
|
||||
if (!rest.members && !rest.cwd && localError === 'Check form fields') {
|
||||
setLocalError(null);
|
||||
|
|
@ -636,7 +637,11 @@ export const CreateTeamDialog = ({
|
|||
{prepareWarnings.length > 0 ? (
|
||||
<div className="space-y-0.5">
|
||||
{prepareWarnings.map((warning) => (
|
||||
<p key={warning} className="text-[11px]" style={{ color: 'var(--warning-text)' }}>
|
||||
<p
|
||||
key={warning}
|
||||
className="text-[11px]"
|
||||
style={{ color: 'var(--warning-text)' }}
|
||||
>
|
||||
{warning}
|
||||
</p>
|
||||
))}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
||||
|
||||
import { MarkdownViewer } from '@renderer/components/chat/viewers/MarkdownViewer';
|
||||
import { AttachmentPreviewList } from '@renderer/components/team/attachments/AttachmentPreviewList';
|
||||
import { DropZoneOverlay } from '@renderer/components/team/attachments/DropZoneOverlay';
|
||||
import { MarkdownViewer } from '@renderer/components/chat/viewers/MarkdownViewer';
|
||||
import { Button } from '@renderer/components/ui/button';
|
||||
import {
|
||||
Dialog,
|
||||
|
|
@ -25,8 +25,8 @@ import { chipToken, serializeChipsWithText } from '@renderer/types/inlineChip';
|
|||
import { buildReplyBlock } from '@renderer/utils/agentMessageFormatting';
|
||||
import { removeChipTokenFromText } from '@renderer/utils/chipUtils';
|
||||
import { formatAgentRole } from '@renderer/utils/formatAgentRole';
|
||||
import { buildMemberColorMap } from '@renderer/utils/memberHelpers';
|
||||
import { getModifierKeyName } from '@renderer/utils/keyboardUtils';
|
||||
import { buildMemberColorMap } from '@renderer/utils/memberHelpers';
|
||||
import { AlertCircle, ImagePlus, Send, X } from 'lucide-react';
|
||||
|
||||
import { MemberBadge } from '../MemberBadge';
|
||||
|
|
@ -129,7 +129,16 @@ export const SendMessageDialog = ({
|
|||
}
|
||||
}
|
||||
prevOpenRef.current = open;
|
||||
}, [open, defaultRecipient, defaultText, defaultChip, quotedMessage, lastResult, textDraft, chipDraft]);
|
||||
}, [
|
||||
open,
|
||||
defaultRecipient,
|
||||
defaultText,
|
||||
defaultChip,
|
||||
quotedMessage,
|
||||
lastResult,
|
||||
textDraft,
|
||||
chipDraft,
|
||||
]);
|
||||
|
||||
// Track whether auto-close is needed (avoid setState in render)
|
||||
useEffect(() => {
|
||||
|
|
@ -421,7 +430,9 @@ export const SendMessageDialog = ({
|
|||
</span>
|
||||
) : null}
|
||||
{textDraft.isSaved ? (
|
||||
<span className="text-[10px] text-[var(--color-text-muted)]">Draft saved</span>
|
||||
<span className="text-[10px] text-[var(--color-text-muted)]">
|
||||
Draft saved
|
||||
</span>
|
||||
) : null}
|
||||
</div>
|
||||
}
|
||||
|
|
@ -442,7 +453,6 @@ export const SendMessageDialog = ({
|
|||
Shown as notification preview. Team lead also sees this for peer messages.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<DialogFooter>
|
||||
|
|
|
|||
|
|
@ -1,11 +1,10 @@
|
|||
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
||||
|
||||
import { ImageLightbox } from '@renderer/components/team/attachments/ImageLightbox';
|
||||
import { Button } from '@renderer/components/ui/button';
|
||||
import { useStore } from '@renderer/store';
|
||||
import { File, ImagePlus, Loader2, Trash2 } from 'lucide-react';
|
||||
|
||||
import { ImageLightbox } from '@renderer/components/team/attachments/ImageLightbox';
|
||||
import { isImageMimeType } from '@renderer/utils/attachmentUtils';
|
||||
import { File, ImagePlus, Loader2, Trash2 } from 'lucide-react';
|
||||
|
||||
import type { TaskAttachmentMeta } from '@shared/types';
|
||||
|
||||
|
|
@ -105,7 +104,10 @@ export const TaskAttachments = ({
|
|||
setError('Attachment file not found');
|
||||
return;
|
||||
}
|
||||
const mime = att.mimeType && typeof att.mimeType === 'string' ? att.mimeType : 'application/octet-stream';
|
||||
const mime =
|
||||
att.mimeType && typeof att.mimeType === 'string'
|
||||
? att.mimeType
|
||||
: 'application/octet-stream';
|
||||
const dataUrl = `data:${mime};base64,${base64}`;
|
||||
const blob = await fetch(dataUrl).then((r) => r.blob());
|
||||
const url = URL.createObjectURL(blob);
|
||||
|
|
@ -212,8 +214,14 @@ export const TaskAttachments = ({
|
|||
teamName={teamName}
|
||||
taskId={taskId}
|
||||
isDeleting={deletingId === att.id}
|
||||
onPreview={() => void handlePreview(att)}
|
||||
onDelete={() => void handleDelete(att.id, att.mimeType)}
|
||||
onPreview={() => {
|
||||
// eslint-disable-next-line sonarjs/void-use -- void needed to mark floating promise
|
||||
void handlePreview(att);
|
||||
}}
|
||||
onDelete={() => {
|
||||
// eslint-disable-next-line sonarjs/void-use -- void needed to mark floating promise
|
||||
void handleDelete(att.id, att.mimeType);
|
||||
}}
|
||||
onDataLoaded={handleThumbLoaded}
|
||||
/>
|
||||
))}
|
||||
|
|
@ -327,7 +335,7 @@ const AttachmentThumbnail = ({
|
|||
|
||||
return (
|
||||
<div
|
||||
className={`group relative flex size-20 cursor-pointer items-center justify-center overflow-hidden rounded border transition-colors border-[var(--color-border)] hover:border-[var(--color-border-emphasis)] bg-[var(--color-surface)]`}
|
||||
className={`group relative flex size-20 cursor-pointer items-center justify-center overflow-hidden rounded border border-[var(--color-border)] bg-[var(--color-surface)] transition-colors hover:border-[var(--color-border-emphasis)]`}
|
||||
onClick={onPreview}
|
||||
>
|
||||
{isImageMimeType(attachment.mimeType) ? (
|
||||
|
|
@ -381,7 +389,7 @@ function fileToBase64(file: File): Promise<string> {
|
|||
reject(new Error('Failed to read file as base64'));
|
||||
}
|
||||
};
|
||||
reader.onerror = () => reject(reader.error);
|
||||
reader.onerror = () => reject(reader.error ?? new Error('File read failed'));
|
||||
reader.readAsDataURL(file);
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,50 +71,45 @@ export const TaskCommentInput = ({
|
|||
trimmed.length <= MAX_COMMENT_LENGTH &&
|
||||
!addingComment;
|
||||
|
||||
const addFiles = useCallback(
|
||||
(files: FileList | File[]) => {
|
||||
setAttachError(null);
|
||||
const fileArray = Array.from(files);
|
||||
for (const file of fileArray) {
|
||||
if (!ACCEPTED_TYPES.has(file.type)) {
|
||||
setAttachError(`Unsupported type: ${file.type}`);
|
||||
continue;
|
||||
}
|
||||
if (file.size > MAX_FILE_SIZE) {
|
||||
setAttachError(
|
||||
`File too large: ${(file.size / (1024 * 1024)).toFixed(1)} MB (max 20 MB)`
|
||||
);
|
||||
continue;
|
||||
}
|
||||
const reader = new FileReader();
|
||||
reader.onload = () => {
|
||||
const result = reader.result as string;
|
||||
const base64 = result.split(',')[1];
|
||||
if (!base64) return;
|
||||
const id = crypto.randomUUID();
|
||||
setPendingAttachments((prev) => {
|
||||
if (prev.length >= MAX_ATTACHMENTS) {
|
||||
setAttachError(`Maximum ${MAX_ATTACHMENTS} attachments per comment`);
|
||||
return prev;
|
||||
}
|
||||
return [
|
||||
...prev,
|
||||
{
|
||||
id,
|
||||
filename: file.name,
|
||||
mimeType: file.type,
|
||||
base64Data: base64,
|
||||
previewUrl: result,
|
||||
size: file.size,
|
||||
},
|
||||
];
|
||||
});
|
||||
};
|
||||
reader.readAsDataURL(file);
|
||||
const addFiles = useCallback((files: FileList | File[]) => {
|
||||
setAttachError(null);
|
||||
const fileArray = Array.from(files);
|
||||
for (const file of fileArray) {
|
||||
if (!ACCEPTED_TYPES.has(file.type)) {
|
||||
setAttachError(`Unsupported type: ${file.type}`);
|
||||
continue;
|
||||
}
|
||||
},
|
||||
[]
|
||||
);
|
||||
if (file.size > MAX_FILE_SIZE) {
|
||||
setAttachError(`File too large: ${(file.size / (1024 * 1024)).toFixed(1)} MB (max 20 MB)`);
|
||||
continue;
|
||||
}
|
||||
const reader = new FileReader();
|
||||
reader.onload = () => {
|
||||
const result = reader.result as string;
|
||||
const base64 = result.split(',')[1];
|
||||
if (!base64) return;
|
||||
const id = crypto.randomUUID();
|
||||
setPendingAttachments((prev) => {
|
||||
if (prev.length >= MAX_ATTACHMENTS) {
|
||||
setAttachError(`Maximum ${MAX_ATTACHMENTS} attachments per comment`);
|
||||
return prev;
|
||||
}
|
||||
return [
|
||||
...prev,
|
||||
{
|
||||
id,
|
||||
filename: file.name,
|
||||
mimeType: file.type,
|
||||
base64Data: base64,
|
||||
previewUrl: result,
|
||||
size: file.size,
|
||||
},
|
||||
];
|
||||
});
|
||||
};
|
||||
reader.readAsDataURL(file);
|
||||
}
|
||||
}, []);
|
||||
|
||||
const removeAttachment = useCallback((id: string) => {
|
||||
setPendingAttachments((prev) => prev.filter((a) => a.id !== id));
|
||||
|
|
@ -131,7 +126,7 @@ export const TaskCommentInput = ({
|
|||
? pendingAttachments.map((a) => ({
|
||||
id: a.id,
|
||||
filename: a.filename,
|
||||
mimeType: a.mimeType as CommentAttachmentPayload['mimeType'],
|
||||
mimeType: a.mimeType,
|
||||
base64Data: a.base64Data,
|
||||
}))
|
||||
: undefined;
|
||||
|
|
@ -245,6 +240,7 @@ export const TaskCommentInput = ({
|
|||
className="hidden"
|
||||
onChange={(e) => {
|
||||
if (e.target.files) addFiles(e.target.files);
|
||||
// eslint-disable-next-line no-param-reassign -- reset file input to allow re-selecting same file
|
||||
e.target.value = '';
|
||||
}}
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@ import { useCallback, useEffect, useMemo, useState } from 'react';
|
|||
|
||||
import { MarkdownViewer } from '@renderer/components/chat/viewers/MarkdownViewer';
|
||||
import { ReplyQuoteBlock } from '@renderer/components/team/activity/ReplyQuoteBlock';
|
||||
import { MemberBadge } from '@renderer/components/team/MemberBadge';
|
||||
import { ImageLightbox } from '@renderer/components/team/attachments/ImageLightbox';
|
||||
import { MemberBadge } from '@renderer/components/team/MemberBadge';
|
||||
import { ExpandableContent } from '@renderer/components/ui/ExpandableContent';
|
||||
import { MentionableTextarea } from '@renderer/components/ui/MentionableTextarea';
|
||||
import { Tooltip, TooltipContent, TooltipTrigger } from '@renderer/components/ui/tooltip';
|
||||
|
|
@ -11,8 +11,8 @@ import { useDraftPersistence } from '@renderer/hooks/useDraftPersistence';
|
|||
import { useMarkCommentsRead } from '@renderer/hooks/useMarkCommentsRead';
|
||||
import { useStore } from '@renderer/store';
|
||||
import { buildReplyBlock, parseMessageReply } from '@renderer/utils/agentMessageFormatting';
|
||||
import { formatAgentRole } from '@renderer/utils/formatAgentRole';
|
||||
import { isImageMimeType } from '@renderer/utils/attachmentUtils';
|
||||
import { formatAgentRole } from '@renderer/utils/formatAgentRole';
|
||||
import { getModifierKeyName } from '@renderer/utils/keyboardUtils';
|
||||
import { buildMemberColorMap } from '@renderer/utils/memberHelpers';
|
||||
import { stripAgentBlocks } from '@shared/constants/agentBlocks';
|
||||
|
|
@ -92,6 +92,7 @@ export const TaskCommentsSection = ({
|
|||
|
||||
// Reset local UI state when team/task changes.
|
||||
useEffect(() => {
|
||||
// eslint-disable-next-line react-hooks/set-state-in-effect -- intentional sync on prop change
|
||||
setVisibleCount(INITIAL_VISIBLE_COMMENTS);
|
||||
setReplyTo(null);
|
||||
setPreviewImageUrl(null);
|
||||
|
|
@ -169,125 +170,128 @@ export const TaskCommentsSection = ({
|
|||
) : null}
|
||||
|
||||
<div className={containerClassName ?? ''}>
|
||||
{visibleComments.map((comment, index) => (
|
||||
<div
|
||||
key={comment.id}
|
||||
className={[
|
||||
'group px-4 py-2.5',
|
||||
comment.type === 'review_approved'
|
||||
? 'border-y border-emerald-500/20 bg-emerald-500/5'
|
||||
: comment.type === 'review_request'
|
||||
? 'border-y border-blue-500/20 bg-blue-500/5'
|
||||
: '',
|
||||
].join(' ')}
|
||||
style={
|
||||
!comment.type || comment.type === 'regular'
|
||||
? { backgroundColor: index % 2 === 1 ? 'var(--card-bg-zebra)' : 'var(--card-bg)' }
|
||||
: undefined
|
||||
}
|
||||
>
|
||||
<div className="mb-1 flex items-center gap-2 text-[10px] text-[var(--color-text-muted)]">
|
||||
<MemberBadge name={comment.author} color={colorMap.get(comment.author)} />
|
||||
{comment.type === 'review_approved' ? (
|
||||
<span className="inline-flex items-center gap-0.5 rounded-full bg-emerald-500/15 px-1.5 py-0.5 text-[10px] font-medium text-emerald-400">
|
||||
<CheckCircle2 size={10} />
|
||||
Approved
|
||||
{visibleComments.map((comment, index) => (
|
||||
<div
|
||||
key={comment.id}
|
||||
className={[
|
||||
'group px-4 py-2.5',
|
||||
comment.type === 'review_approved'
|
||||
? 'border-y border-emerald-500/20 bg-emerald-500/5'
|
||||
: comment.type === 'review_request'
|
||||
? 'border-y border-blue-500/20 bg-blue-500/5'
|
||||
: '',
|
||||
].join(' ')}
|
||||
style={
|
||||
!comment.type || comment.type === 'regular'
|
||||
? {
|
||||
backgroundColor:
|
||||
index % 2 === 1 ? 'var(--card-bg-zebra)' : 'var(--card-bg)',
|
||||
}
|
||||
: undefined
|
||||
}
|
||||
>
|
||||
<div className="mb-1 flex items-center gap-2 text-[10px] text-[var(--color-text-muted)]">
|
||||
<MemberBadge name={comment.author} color={colorMap.get(comment.author)} />
|
||||
{comment.type === 'review_approved' ? (
|
||||
<span className="inline-flex items-center gap-0.5 rounded-full bg-emerald-500/15 px-1.5 py-0.5 text-[10px] font-medium text-emerald-400">
|
||||
<CheckCircle2 size={10} />
|
||||
Approved
|
||||
</span>
|
||||
) : comment.type === 'review_request' ? (
|
||||
<span className="inline-flex items-center gap-0.5 rounded-full bg-blue-500/15 px-1.5 py-0.5 text-[10px] font-medium text-blue-400">
|
||||
<Eye size={10} />
|
||||
Review requested
|
||||
</span>
|
||||
) : null}
|
||||
<span>
|
||||
{(() => {
|
||||
const date = new Date(comment.createdAt);
|
||||
return isNaN(date.getTime())
|
||||
? 'unknown time'
|
||||
: formatDistanceToNow(date, { addSuffix: true });
|
||||
})()}
|
||||
</span>
|
||||
) : comment.type === 'review_request' ? (
|
||||
<span className="inline-flex items-center gap-0.5 rounded-full bg-blue-500/15 px-1.5 py-0.5 text-[10px] font-medium text-blue-400">
|
||||
<Eye size={10} />
|
||||
Review requested
|
||||
</span>
|
||||
) : null}
|
||||
<span>
|
||||
{(() => {
|
||||
const date = new Date(comment.createdAt);
|
||||
return isNaN(date.getTime())
|
||||
? 'unknown time'
|
||||
: formatDistanceToNow(date, { addSuffix: true });
|
||||
})()}
|
||||
</span>
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<button
|
||||
type="button"
|
||||
className="ml-auto flex items-center gap-0.5 text-[var(--color-text-muted)] opacity-0 transition-opacity hover:text-[var(--color-text-secondary)] group-hover:opacity-100"
|
||||
onClick={() => {
|
||||
const replyText = stripAgentBlocks(
|
||||
parseMessageReply(comment.text)?.replyText ?? comment.text
|
||||
);
|
||||
if (onReply) {
|
||||
onReply(comment.author, replyText);
|
||||
} else {
|
||||
setReplyTo({ author: comment.author, text: replyText });
|
||||
}
|
||||
}}
|
||||
>
|
||||
<Reply size={11} />
|
||||
Reply
|
||||
</button>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent side="left">Reply to comment</TooltipContent>
|
||||
</Tooltip>
|
||||
</div>
|
||||
{(() => {
|
||||
const reply = parseMessageReply(comment.text);
|
||||
const rawForDisplay = reply ? reply.replyText : comment.text;
|
||||
const displayText = normalizeLiteralNewlines(stripAgentBlocks(rawForDisplay));
|
||||
return (
|
||||
<ExpandableContent collapsedHeight={120} className="text-xs">
|
||||
{reply ? (
|
||||
<ReplyQuoteBlock
|
||||
reply={{
|
||||
...reply,
|
||||
originalText: stripAgentBlocks(reply.originalText),
|
||||
replyText: stripAgentBlocks(reply.replyText),
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<button
|
||||
type="button"
|
||||
className="ml-auto flex items-center gap-0.5 text-[var(--color-text-muted)] opacity-0 transition-opacity hover:text-[var(--color-text-secondary)] group-hover:opacity-100"
|
||||
onClick={() => {
|
||||
const replyText = stripAgentBlocks(
|
||||
parseMessageReply(comment.text)?.replyText ?? comment.text
|
||||
);
|
||||
if (onReply) {
|
||||
onReply(comment.author, replyText);
|
||||
} else {
|
||||
setReplyTo({ author: comment.author, text: replyText });
|
||||
}
|
||||
}}
|
||||
memberColor={colorMap.get(reply.agentName)}
|
||||
bodyMaxHeight="max-h-none"
|
||||
/>
|
||||
) : (
|
||||
<span
|
||||
onClickCapture={
|
||||
onTaskIdClick
|
||||
? (e) => {
|
||||
const link = (e.target as HTMLElement).closest<HTMLAnchorElement>(
|
||||
'a[href^="task://"]'
|
||||
);
|
||||
if (link) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
const id = link.getAttribute('href')?.replace('task://', '');
|
||||
if (id) onTaskIdClick(id);
|
||||
}
|
||||
}
|
||||
: undefined
|
||||
}
|
||||
>
|
||||
<MarkdownViewer
|
||||
content={(() => {
|
||||
let t = linkifyTaskIdsInMarkdown(displayText);
|
||||
if (colorMap.size > 0) t = linkifyMentionsInMarkdown(t, colorMap);
|
||||
return t;
|
||||
})()}
|
||||
maxHeight="max-h-none"
|
||||
bare
|
||||
<Reply size={11} />
|
||||
Reply
|
||||
</button>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent side="left">Reply to comment</TooltipContent>
|
||||
</Tooltip>
|
||||
</div>
|
||||
{(() => {
|
||||
const reply = parseMessageReply(comment.text);
|
||||
const rawForDisplay = reply ? reply.replyText : comment.text;
|
||||
const displayText = normalizeLiteralNewlines(stripAgentBlocks(rawForDisplay));
|
||||
return (
|
||||
<ExpandableContent collapsedHeight={120} className="text-xs">
|
||||
{reply ? (
|
||||
<ReplyQuoteBlock
|
||||
reply={{
|
||||
...reply,
|
||||
originalText: stripAgentBlocks(reply.originalText),
|
||||
replyText: stripAgentBlocks(reply.replyText),
|
||||
}}
|
||||
memberColor={colorMap.get(reply.agentName)}
|
||||
bodyMaxHeight="max-h-none"
|
||||
/>
|
||||
</span>
|
||||
)}
|
||||
</ExpandableContent>
|
||||
);
|
||||
})()}
|
||||
{comment.attachments && comment.attachments.length > 0 ? (
|
||||
<CommentAttachments
|
||||
attachments={comment.attachments}
|
||||
teamName={teamName}
|
||||
taskId={taskId}
|
||||
onPreview={setPreviewImageUrl}
|
||||
/>
|
||||
) : null}
|
||||
</div>
|
||||
))}
|
||||
) : (
|
||||
<span
|
||||
onClickCapture={
|
||||
onTaskIdClick
|
||||
? (e) => {
|
||||
const link = (e.target as HTMLElement).closest<HTMLAnchorElement>(
|
||||
'a[href^="task://"]'
|
||||
);
|
||||
if (link) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
const id = link.getAttribute('href')?.replace('task://', '');
|
||||
if (id) onTaskIdClick(id);
|
||||
}
|
||||
}
|
||||
: undefined
|
||||
}
|
||||
>
|
||||
<MarkdownViewer
|
||||
content={(() => {
|
||||
let t = linkifyTaskIdsInMarkdown(displayText);
|
||||
if (colorMap.size > 0) t = linkifyMentionsInMarkdown(t, colorMap);
|
||||
return t;
|
||||
})()}
|
||||
maxHeight="max-h-none"
|
||||
bare
|
||||
/>
|
||||
</span>
|
||||
)}
|
||||
</ExpandableContent>
|
||||
);
|
||||
})()}
|
||||
{comment.attachments && comment.attachments.length > 0 ? (
|
||||
<CommentAttachments
|
||||
attachments={comment.attachments}
|
||||
teamName={teamName}
|
||||
taskId={taskId}
|
||||
onPreview={setPreviewImageUrl}
|
||||
/>
|
||||
) : null}
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
|
||||
{sortedComments.length > visibleComments.length ? (
|
||||
|
|
|
|||
|
|
@ -6,8 +6,6 @@ import { MemberBadge } from '@renderer/components/team/MemberBadge';
|
|||
import { MemberLogsTab } from '@renderer/components/team/members/MemberLogsTab';
|
||||
import { Badge } from '@renderer/components/ui/badge';
|
||||
import { Button } from '@renderer/components/ui/button';
|
||||
import { ExpandableContent } from '@renderer/components/ui/ExpandableContent';
|
||||
import { MemberSelect } from '@renderer/components/ui/MemberSelect';
|
||||
import {
|
||||
Dialog,
|
||||
DialogContent,
|
||||
|
|
@ -16,7 +14,9 @@ import {
|
|||
DialogHeader,
|
||||
DialogTitle,
|
||||
} from '@renderer/components/ui/dialog';
|
||||
import { ExpandableContent } from '@renderer/components/ui/ExpandableContent';
|
||||
import { Input } from '@renderer/components/ui/input';
|
||||
import { MemberSelect } from '@renderer/components/ui/MemberSelect';
|
||||
import { Textarea } from '@renderer/components/ui/textarea';
|
||||
import { Tooltip, TooltipContent, TooltipTrigger } from '@renderer/components/ui/tooltip';
|
||||
import { markAsRead } from '@renderer/services/commentReadStorage';
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ export const EditorImagePreview = ({
|
|||
|
||||
// Reset state when filePath changes
|
||||
useEffect(() => {
|
||||
// eslint-disable-next-line react-hooks/set-state-in-effect -- intentional sync on prop change
|
||||
setLoading(true);
|
||||
setError(null);
|
||||
setDataUrl(null);
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ export const QuickOpenDialog = ({
|
|||
useEffect(() => {
|
||||
let cancelled = false;
|
||||
|
||||
// eslint-disable-next-line react-hooks/set-state-in-effect -- intentional sync on prop change
|
||||
setLoading(true);
|
||||
window.electronAPI.editor
|
||||
.listFiles()
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { Badge } from '@renderer/components/ui/badge';
|
||||
import { Tooltip, TooltipContent, TooltipTrigger } from '@renderer/components/ui/tooltip';
|
||||
import { getTeamColorSet } from '@renderer/constants/teamColors';
|
||||
// import { useStore } from '@renderer/store'; // TODO: disabled — lead context display
|
||||
// import { useStore } from '@renderer/store'; // NOTE: disabled — lead context display
|
||||
import { formatAgentRole } from '@renderer/utils/formatAgentRole';
|
||||
import { agentAvatarUrl, getMemberDotClass, getPresenceLabel } from '@renderer/utils/memberHelpers';
|
||||
import { GitBranch, Loader2, MessageSquare, Plus } from 'lucide-react';
|
||||
|
|
@ -40,7 +40,7 @@ export const MemberCard = ({
|
|||
onSendMessage,
|
||||
onAssignTask,
|
||||
}: MemberCardProps): React.JSX.Element => {
|
||||
// TODO: lead context display disabled — usage formula is inaccurate
|
||||
// NOTE: lead context display disabled — usage formula is inaccurate
|
||||
// const teamName = useStore((s) => s.selectedTeamName);
|
||||
// const leadContext = useStore((s) =>
|
||||
// member.agentType === 'team-lead' && teamName ? s.leadContextByTeam[teamName] : undefined
|
||||
|
|
@ -184,7 +184,7 @@ export const MemberCard = ({
|
|||
/>
|
||||
</div>
|
||||
)}
|
||||
{/* TODO: lead context bar disabled — usage formula is inaccurate */}
|
||||
{/* NOTE: lead context bar disabled — usage formula is inaccurate */}
|
||||
</div>
|
||||
{!isRemoved && (
|
||||
<div className="flex shrink-0 items-center gap-0.5">
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ import { useState } from 'react';
|
|||
import { Badge } from '@renderer/components/ui/badge';
|
||||
import { DialogDescription, DialogTitle } from '@renderer/components/ui/dialog';
|
||||
import { getTeamColorSet } from '@renderer/constants/teamColors';
|
||||
// import { useStore } from '@renderer/store'; // TODO: disabled — lead context display
|
||||
import { formatAgentRole } from '@renderer/utils/formatAgentRole';
|
||||
import { agentAvatarUrl, getMemberDotClass, getPresenceLabel } from '@renderer/utils/memberHelpers';
|
||||
import { Pencil } from 'lucide-react';
|
||||
|
|
@ -31,7 +30,7 @@ export const MemberDetailHeader = ({
|
|||
}: MemberDetailHeaderProps): React.JSX.Element => {
|
||||
const [editing, setEditing] = useState(false);
|
||||
|
||||
// TODO: lead context display disabled — usage formula is inaccurate
|
||||
// NOTE: lead context display disabled — usage formula is inaccurate
|
||||
// const teamName = useStore((s) => s.selectedTeamName);
|
||||
// const leadContext = useStore((s) =>
|
||||
// member.agentType === 'team-lead' && teamName ? s.leadContextByTeam[teamName] : undefined
|
||||
|
|
@ -102,7 +101,7 @@ export const MemberDetailHeader = ({
|
|||
>
|
||||
{presenceLabel}
|
||||
</Badge>
|
||||
{/* TODO: lead context token display disabled — usage formula is inaccurate */}
|
||||
{/* NOTE: lead context token display disabled — usage formula is inaccurate */}
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
||||
|
||||
import { RoleSelect } from '@renderer/components/team/RoleSelect';
|
||||
import { Button } from '@renderer/components/ui/button';
|
||||
import { Input } from '@renderer/components/ui/input';
|
||||
import { MentionableTextarea } from '@renderer/components/ui/MentionableTextarea';
|
||||
import { RoleSelect } from '@renderer/components/team/RoleSelect';
|
||||
import { getTeamColorSet } from '@renderer/constants/teamColors';
|
||||
import { useDraftPersistence } from '@renderer/hooks/useDraftPersistence';
|
||||
import { useFileListCacheWarmer } from '@renderer/hooks/useFileListCacheWarmer';
|
||||
|
|
@ -144,7 +144,7 @@ export const MemberDraftRow = ({
|
|||
onCustomRoleChange={(customRole) => onCustomRoleChange(member.id, customRole)}
|
||||
triggerClassName="h-8 text-xs"
|
||||
inputClassName="h-8 text-xs"
|
||||
/>
|
||||
/>
|
||||
</div>
|
||||
<div className="flex flex-col gap-2 sm:flex-row">
|
||||
{showWorkflow && onWorkflowChange ? (
|
||||
|
|
|
|||
|
|
@ -152,14 +152,17 @@ export const MemberLogsTab = ({
|
|||
// eslint-disable-next-line react-hooks/exhaustive-deps -- intervalsKey drives refresh; deps intentionally minimal to avoid refetch loops
|
||||
}, [teamName, memberName, taskId, taskOwner, taskStatus, intervalsKey]);
|
||||
|
||||
const fetchDetailForLog = useCallback(async (log: MemberLogSummary): Promise<EnhancedChunk[] | null> => {
|
||||
if (log.kind === 'subagent') {
|
||||
const d = await api.getSubagentDetail(log.projectId, log.sessionId, log.subagentId);
|
||||
return (d?.chunks ?? null) as EnhancedChunk[] | null;
|
||||
}
|
||||
const d = await api.getSessionDetail(log.projectId, log.sessionId);
|
||||
return (d?.chunks ?? null) as unknown as EnhancedChunk[] | null;
|
||||
}, []);
|
||||
const fetchDetailForLog = useCallback(
|
||||
async (log: MemberLogSummary): Promise<EnhancedChunk[] | null> => {
|
||||
if (log.kind === 'subagent') {
|
||||
const d = await api.getSubagentDetail(log.projectId, log.sessionId, log.subagentId);
|
||||
return d?.chunks ?? null;
|
||||
}
|
||||
const d = await api.getSessionDetail(log.projectId, log.sessionId);
|
||||
return (d?.chunks ?? null) as unknown as EnhancedChunk[] | null;
|
||||
},
|
||||
[]
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
const shouldAutoRefreshSummary = taskId != null && taskStatus === 'in_progress';
|
||||
|
|
@ -250,12 +253,8 @@ export const MemberLogsTab = ({
|
|||
key={getRowId(log)}
|
||||
log={log}
|
||||
expanded={expandedId === getRowId(log)}
|
||||
detailChunks={
|
||||
expandedId === getRowId(log) ? detailChunks : null
|
||||
}
|
||||
detailLoading={
|
||||
expandedId === getRowId(log) && detailLoading
|
||||
}
|
||||
detailChunks={expandedId === getRowId(log) ? detailChunks : null}
|
||||
detailLoading={expandedId === getRowId(log) && detailLoading}
|
||||
onToggle={() => void handleExpand(log)}
|
||||
/>
|
||||
))}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { useState } from 'react';
|
||||
|
||||
import { Button } from '@renderer/components/ui/button';
|
||||
import { RoleSelect } from '@renderer/components/team/RoleSelect';
|
||||
import { Button } from '@renderer/components/ui/button';
|
||||
import { CUSTOM_ROLE, FORBIDDEN_ROLES, NO_ROLE, PRESET_ROLES } from '@renderer/constants/teamRoles';
|
||||
import { Check, Loader2, X } from 'lucide-react';
|
||||
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ interface MessageComposerProps {
|
|||
const MAX_MESSAGE_LENGTH = 4000;
|
||||
|
||||
/** Circular progress indicator for lead context usage. */
|
||||
const ContextRing = ({ ctx }: { ctx: LeadContextUsage }): React.JSX.Element => {
|
||||
const _ContextRing = ({ ctx }: { ctx: LeadContextUsage }): React.JSX.Element => {
|
||||
const size = 26;
|
||||
const stroke = 2.5;
|
||||
const radius = (size - stroke) / 2;
|
||||
|
|
@ -49,7 +49,10 @@ const ContextRing = ({ ctx }: { ctx: LeadContextUsage }): React.JSX.Element => {
|
|||
return (
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<div className="relative flex shrink-0 cursor-default items-center justify-center" style={{ width: size, height: size }}>
|
||||
<div
|
||||
className="relative flex shrink-0 cursor-default items-center justify-center"
|
||||
style={{ width: size, height: size }}
|
||||
>
|
||||
<svg width={size} height={size} className="-rotate-90">
|
||||
<circle
|
||||
cx={size / 2}
|
||||
|
|
@ -148,7 +151,7 @@ export const MessageComposer = ({
|
|||
const selectedMember = members.find((m) => m.name === recipient);
|
||||
const selectedResolvedColor = selectedMember ? colorMap.get(selectedMember.name) : undefined;
|
||||
const isLeadRecipient = selectedMember?.role === 'lead' || selectedMember?.name === 'team-lead';
|
||||
// TODO: lead context ring disabled — usage formula is inaccurate
|
||||
// NOTE: lead context ring disabled — usage formula is inaccurate
|
||||
// const isLeadAgentRecipient = selectedMember?.agentType === 'team-lead';
|
||||
// const leadContext = useStore((s) =>
|
||||
// isLeadAgentRecipient ? s.leadContextByTeam[teamName] : undefined
|
||||
|
|
@ -290,7 +293,10 @@ export const MessageComposer = ({
|
|||
>
|
||||
{members.length > 5 && (
|
||||
<div className="relative mb-1">
|
||||
<Search size={12} className="absolute left-2 top-1/2 -translate-y-1/2 text-[var(--color-text-muted)]" />
|
||||
<Search
|
||||
size={12}
|
||||
className="absolute left-2 top-1/2 -translate-y-1/2 text-[var(--color-text-muted)]"
|
||||
/>
|
||||
<input
|
||||
ref={recipientSearchRef}
|
||||
type="text"
|
||||
|
|
@ -302,6 +308,7 @@ export const MessageComposer = ({
|
|||
</div>
|
||||
)}
|
||||
<div className="max-h-48 space-y-0.5 overflow-y-auto">
|
||||
{/* eslint-disable-next-line sonarjs/function-return-type -- IIFE rendering mixed elements/null */}
|
||||
{(() => {
|
||||
const query = recipientSearch.toLowerCase().trim();
|
||||
const filtered = query
|
||||
|
|
@ -392,7 +399,9 @@ export const MessageComposer = ({
|
|||
) : null}
|
||||
|
||||
{!isTeamAlive ? (
|
||||
<span className="ml-auto text-[10px]" style={{ color: 'var(--warning-text)' }}>Team offline</span>
|
||||
<span className="ml-auto text-[10px]" style={{ color: 'var(--warning-text)' }}>
|
||||
Team offline
|
||||
</span>
|
||||
) : null}
|
||||
</div>
|
||||
|
||||
|
|
@ -421,7 +430,7 @@ export const MessageComposer = ({
|
|||
disabled={sending}
|
||||
cornerAction={
|
||||
<div className="flex items-center gap-2">
|
||||
{/* TODO: ContextRing disabled — usage formula is inaccurate */}
|
||||
{/* NOTE: ContextRing disabled — usage formula is inaccurate */}
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<button
|
||||
|
|
|
|||
|
|
@ -137,6 +137,7 @@ export const MessagesFilterPopover = ({
|
|||
<p className="text-xs italic text-[var(--color-text-muted)]">No data</p>
|
||||
) : (
|
||||
fromOptions.map((name) => (
|
||||
// eslint-disable-next-line jsx-a11y/label-has-associated-control -- wraps Radix Checkbox which renders native input internally
|
||||
<label
|
||||
key={name}
|
||||
className="flex cursor-pointer items-center gap-2 rounded-md px-1 py-0.5 text-xs text-[var(--color-text-secondary)] hover:bg-[var(--color-surface-raised)]"
|
||||
|
|
@ -145,7 +146,12 @@ export const MessagesFilterPopover = ({
|
|||
checked={draft.from.has(name)}
|
||||
onCheckedChange={() => toggleFrom(name)}
|
||||
/>
|
||||
<MemberBadge name={name} color={colorMap.get(name)} size="sm" hideAvatar={name === 'user'} />
|
||||
<MemberBadge
|
||||
name={name}
|
||||
color={colorMap.get(name)}
|
||||
size="sm"
|
||||
hideAvatar={name === 'user'}
|
||||
/>
|
||||
</label>
|
||||
))
|
||||
)}
|
||||
|
|
@ -160,18 +166,25 @@ export const MessagesFilterPopover = ({
|
|||
<p className="text-xs italic text-[var(--color-text-muted)]">No data</p>
|
||||
) : (
|
||||
toOptions.map((name) => (
|
||||
// eslint-disable-next-line jsx-a11y/label-has-associated-control -- wraps Radix Checkbox which renders native input internally
|
||||
<label
|
||||
key={name}
|
||||
className="flex cursor-pointer items-center gap-2 rounded-md px-1 py-0.5 text-xs text-[var(--color-text-secondary)] hover:bg-[var(--color-surface-raised)]"
|
||||
>
|
||||
<Checkbox checked={draft.to.has(name)} onCheckedChange={() => toggleTo(name)} />
|
||||
<MemberBadge name={name} color={colorMap.get(name)} size="sm" hideAvatar={name === 'user'} />
|
||||
<MemberBadge
|
||||
name={name}
|
||||
color={colorMap.get(name)}
|
||||
size="sm"
|
||||
hideAvatar={name === 'user'}
|
||||
/>
|
||||
</label>
|
||||
))
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
<div className="border-b border-[var(--color-border)] p-3">
|
||||
{/* eslint-disable-next-line jsx-a11y/label-has-associated-control -- wraps Radix Checkbox */}
|
||||
<label className="flex cursor-pointer items-center gap-2 rounded-md px-1 py-0.5 text-xs text-[var(--color-text-secondary)] hover:bg-[var(--color-surface-raised)]">
|
||||
<Checkbox
|
||||
checked={draft.showNoise}
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ export const ExpandableContent = ({
|
|||
}
|
||||
},
|
||||
// Re-measure when children identity changes (content prop in callers)
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps -- children identity triggers re-measure
|
||||
[children, collapsedHeight]
|
||||
);
|
||||
|
||||
|
|
@ -59,10 +59,8 @@ export const ExpandableContent = ({
|
|||
? {
|
||||
maxHeight: collapsedHeight,
|
||||
overflow: 'hidden',
|
||||
WebkitMaskImage:
|
||||
'linear-gradient(to bottom, black 60%, transparent 100%)',
|
||||
maskImage:
|
||||
'linear-gradient(to bottom, black 60%, transparent 100%)',
|
||||
WebkitMaskImage: 'linear-gradient(to bottom, black 60%, transparent 100%)',
|
||||
maskImage: 'linear-gradient(to bottom, black 60%, transparent 100%)',
|
||||
}
|
||||
: undefined
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ export const MemberSelect = ({
|
|||
const colorMap = React.useMemo(() => buildMemberColorMap(members), [members]);
|
||||
const selectedMember = React.useMemo(
|
||||
() => (value ? members.find((m) => m.name === value) : null),
|
||||
[members, value],
|
||||
[members, value]
|
||||
);
|
||||
|
||||
const avatarSize = size === 'md' ? 32 : 24;
|
||||
|
|
@ -51,6 +51,7 @@ export const MemberSelect = ({
|
|||
const textSize = size === 'md' ? 'text-xs' : 'text-[10px]';
|
||||
const triggerHeight = size === 'md' ? 'h-9' : 'h-8';
|
||||
|
||||
// eslint-disable-next-line sonarjs/function-return-type -- option renderer returns mixed node structure
|
||||
const renderMemberInline = (member: ResolvedTeamMember): React.ReactNode => {
|
||||
const resolvedColor = colorMap.get(member.name);
|
||||
const colors = getTeamColorSet(resolvedColor ?? '');
|
||||
|
|
@ -87,7 +88,7 @@ export const MemberSelect = ({
|
|||
disabled={disabled}
|
||||
className={cn(
|
||||
`flex ${triggerHeight} w-full items-center justify-between rounded-md border border-[var(--color-border)] bg-transparent px-2 py-1 text-xs shadow-sm transition-colors placeholder:text-[var(--color-text-muted)] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[var(--color-border-emphasis)] disabled:cursor-not-allowed disabled:opacity-50`,
|
||||
className,
|
||||
className
|
||||
)}
|
||||
>
|
||||
<span className="min-w-0 truncate text-left">
|
||||
|
|
@ -178,10 +179,7 @@ export const MemberSelect = ({
|
|||
className={`${avatarClass} shrink-0 rounded-full bg-[var(--color-surface-raised)]`}
|
||||
loading="lazy"
|
||||
/>
|
||||
<span
|
||||
className="min-w-0 truncate font-medium"
|
||||
style={{ color: colors.text }}
|
||||
>
|
||||
<span className="min-w-0 truncate font-medium" style={{ color: colors.text }}>
|
||||
{m.name === 'team-lead' ? 'lead' : m.name}
|
||||
</span>
|
||||
{role ? (
|
||||
|
|
|
|||
|
|
@ -54,7 +54,9 @@ export function useAttachments(options?: UseAttachmentsOptions): UseAttachmentsR
|
|||
const timerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
|
||||
const pendingRef = useRef<{ key: string; value: AttachmentPayload[] } | null>(null);
|
||||
const keyRef = useRef(persistenceKey);
|
||||
keyRef.current = persistenceKey;
|
||||
useEffect(() => {
|
||||
keyRef.current = persistenceKey;
|
||||
}, [persistenceKey]);
|
||||
|
||||
// Sync ref with state
|
||||
const updateAttachments = useCallback((next: AttachmentPayload[]) => {
|
||||
|
|
@ -112,6 +114,7 @@ export function useAttachments(options?: UseAttachmentsOptions): UseAttachmentsR
|
|||
flushPending();
|
||||
// Clear stale attachments from previous persistenceKey before loading
|
||||
attachmentsRef.current = [];
|
||||
// eslint-disable-next-line react-hooks/set-state-in-effect -- intentional sync reset before async load
|
||||
setAttachments([]);
|
||||
void (async () => {
|
||||
const raw = await draftStorage.loadDraft(persistenceKey);
|
||||
|
|
@ -195,7 +198,6 @@ export function useAttachments(options?: UseAttachmentsOptions): UseAttachmentsR
|
|||
schedulePersist(next);
|
||||
return next;
|
||||
});
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps -- schedulePersist is stable
|
||||
},
|
||||
[schedulePersist]
|
||||
);
|
||||
|
|
@ -209,7 +211,6 @@ export function useAttachments(options?: UseAttachmentsOptions): UseAttachmentsR
|
|||
return next;
|
||||
});
|
||||
setError(null);
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps -- schedulePersist is stable
|
||||
},
|
||||
[schedulePersist]
|
||||
);
|
||||
|
|
|
|||
|
|
@ -48,7 +48,10 @@ export function useChipDraftPersistence(key: string): UseChipDraftResult {
|
|||
const timerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
|
||||
const pendingRef = useRef<{ key: string; value: InlineChip[] } | null>(null);
|
||||
const keyRef = useRef(key);
|
||||
keyRef.current = key;
|
||||
|
||||
useEffect(() => {
|
||||
keyRef.current = key;
|
||||
}, [key]);
|
||||
// Ref for current chips — allows addChip/removeChip to read latest value
|
||||
// without stale closures, using the same sync-ref pattern as keyRef.
|
||||
const chipsRef = useRef<InlineChip[]>([]);
|
||||
|
|
@ -83,7 +86,9 @@ export function useChipDraftPersistence(key: string): UseChipDraftResult {
|
|||
// Flush any pending debounced save for the previous key and reset local state for the new key.
|
||||
flushPending();
|
||||
chipsRef.current = [];
|
||||
// eslint-disable-next-line react-hooks/set-state-in-effect -- intentional reset on key change before async load
|
||||
setChipsState([]);
|
||||
|
||||
setIsSaved(false);
|
||||
void (async () => {
|
||||
const raw = await draftStorage.loadDraft(key);
|
||||
|
|
|
|||
|
|
@ -27,9 +27,12 @@ export function useDraftPersistence({
|
|||
const timerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
|
||||
const pendingValueRef = useRef<{ key: string; value: string } | null>(null);
|
||||
const keyRef = useRef(key);
|
||||
keyRef.current = key;
|
||||
const mountedRef = useRef(true);
|
||||
|
||||
useEffect(() => {
|
||||
keyRef.current = key;
|
||||
}, [key]);
|
||||
|
||||
useEffect(() => {
|
||||
mountedRef.current = true;
|
||||
return () => {
|
||||
|
|
@ -59,12 +62,15 @@ export function useDraftPersistence({
|
|||
// Prevent debounced saves for the previous key from landing under the new key.
|
||||
flushPending();
|
||||
// Reset local state for the new key immediately. If a draft exists, it will overwrite below.
|
||||
// eslint-disable-next-line react-hooks/set-state-in-effect -- intentional reset on key change before async load
|
||||
setValueState(initialValue ?? '');
|
||||
|
||||
setIsSaved(false);
|
||||
|
||||
if (!enabled) return () => {
|
||||
cancelled = true;
|
||||
};
|
||||
if (!enabled)
|
||||
return () => {
|
||||
cancelled = true;
|
||||
};
|
||||
void (async () => {
|
||||
const draft = await draftStorage.loadDraft(key);
|
||||
if (cancelled) return;
|
||||
|
|
|
|||
|
|
@ -75,6 +75,7 @@ export function useFileSuggestions(
|
|||
// Re-seed from cache when projectPath changes
|
||||
useEffect(() => {
|
||||
if (!projectPath) {
|
||||
// eslint-disable-next-line react-hooks/set-state-in-effect -- intentional sync with prop change
|
||||
setAllFiles([]);
|
||||
return;
|
||||
}
|
||||
|
|
@ -91,6 +92,7 @@ export function useFileSuggestions(
|
|||
const prevEnabledRef = useRef(enabled);
|
||||
useEffect(() => {
|
||||
if (enabled && !prevEnabledRef.current && projectPath && !getQuickOpenCache(projectPath)) {
|
||||
// eslint-disable-next-line react-hooks/set-state-in-effect -- intentional trigger on state transition
|
||||
setFetchTrigger((n) => n + 1);
|
||||
}
|
||||
prevEnabledRef.current = enabled;
|
||||
|
|
|
|||
|
|
@ -66,6 +66,7 @@ export function useResizableColumns({
|
|||
startX: number;
|
||||
startWidth: number;
|
||||
} | null>(null);
|
||||
const abortRef = useRef<AbortController | null>(null);
|
||||
|
||||
const widths = new Map<string, number>();
|
||||
for (const id of columnIds) {
|
||||
|
|
@ -84,8 +85,8 @@ export function useResizableColumns({
|
|||
const drag = draggingRef.current;
|
||||
if (!drag) return;
|
||||
draggingRef.current = null;
|
||||
document.removeEventListener('pointermove', handlePointerMove);
|
||||
document.removeEventListener('pointerup', handlePointerUp);
|
||||
abortRef.current?.abort();
|
||||
abortRef.current = null;
|
||||
document.body.style.cursor = '';
|
||||
document.body.style.userSelect = '';
|
||||
// Persist
|
||||
|
|
@ -93,18 +94,18 @@ export function useResizableColumns({
|
|||
saveWidths(storageKey, current);
|
||||
return current;
|
||||
});
|
||||
}, [handlePointerMove, storageKey]);
|
||||
}, [storageKey]);
|
||||
|
||||
// Safety: if the board unmounts or storageKey changes mid-drag, clean up global listeners/styles.
|
||||
useEffect(() => {
|
||||
return () => {
|
||||
draggingRef.current = null;
|
||||
document.removeEventListener('pointermove', handlePointerMove);
|
||||
document.removeEventListener('pointerup', handlePointerUp);
|
||||
abortRef.current?.abort();
|
||||
abortRef.current = null;
|
||||
document.body.style.cursor = '';
|
||||
document.body.style.userSelect = '';
|
||||
};
|
||||
}, [handlePointerMove, handlePointerUp]);
|
||||
}, []);
|
||||
|
||||
const getHandleProps = useCallback(
|
||||
(leftColumnId: string) => ({
|
||||
|
|
@ -116,8 +117,11 @@ export function useResizableColumns({
|
|||
startX: e.clientX,
|
||||
startWidth: currentWidth,
|
||||
};
|
||||
document.addEventListener('pointermove', handlePointerMove);
|
||||
document.addEventListener('pointerup', handlePointerUp);
|
||||
abortRef.current?.abort();
|
||||
const ac = new AbortController();
|
||||
abortRef.current = ac;
|
||||
document.addEventListener('pointermove', handlePointerMove, { signal: ac.signal });
|
||||
document.addEventListener('pointerup', handlePointerUp, { signal: ac.signal });
|
||||
document.body.style.cursor = 'col-resize';
|
||||
document.body.style.userSelect = 'none';
|
||||
},
|
||||
|
|
|
|||
|
|
@ -370,9 +370,7 @@ export function initializeNotificationListeners(): () => void {
|
|||
// Clear context data when lead goes offline
|
||||
if (nextActivity === 'offline') {
|
||||
nextState.leadContextByTeam = { ...prev.leadContextByTeam };
|
||||
delete (nextState.leadContextByTeam as Record<string, LeadContextUsage>)[
|
||||
event.teamName
|
||||
];
|
||||
delete nextState.leadContextByTeam[event.teamName];
|
||||
}
|
||||
|
||||
return nextState as typeof prev;
|
||||
|
|
|
|||
|
|
@ -65,6 +65,7 @@ import type { AppState } from '../types';
|
|||
import type { AppConfig } from '@renderer/types/data';
|
||||
import type {
|
||||
AddMemberRequest,
|
||||
CommentAttachmentPayload,
|
||||
CreateTaskRequest,
|
||||
GlobalTask,
|
||||
KanbanColumnId,
|
||||
|
|
@ -294,7 +295,7 @@ export interface TeamSlice {
|
|||
teamName: string,
|
||||
taskId: string,
|
||||
text: string,
|
||||
attachments?: import('@shared/types').CommentAttachmentPayload[]
|
||||
attachments?: CommentAttachmentPayload[]
|
||||
) => Promise<TaskComment>;
|
||||
addMember: (teamName: string, request: AddMemberRequest) => Promise<void>;
|
||||
removeMember: (teamName: string, memberName: string) => Promise<void>;
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ function decodeReplyField(value: string): string {
|
|||
* Returns null if no reply block is found.
|
||||
*/
|
||||
export function parseMessageReply(content: string): ParsedMessageReply | null {
|
||||
const match = content.match(REPLY_BLOCK_RE);
|
||||
const match = REPLY_BLOCK_RE.exec(content);
|
||||
if (!match) return null;
|
||||
return {
|
||||
agentName: match[1],
|
||||
|
|
|
|||
|
|
@ -234,7 +234,7 @@ export function parseStreamJsonToGroups(cliLogsTail: string): StreamJsonGroup[]
|
|||
ts = new Date();
|
||||
if (lineTimestampCache.size >= MAX_TIMESTAMP_CACHE_SIZE) {
|
||||
// Evict oldest entry (first inserted)
|
||||
const firstKey = lineTimestampCache.keys().next().value as string;
|
||||
const firstKey = lineTimestampCache.keys().next().value!;
|
||||
lineTimestampCache.delete(firstKey);
|
||||
}
|
||||
lineTimestampCache.set(trimmed, ts);
|
||||
|
|
@ -246,15 +246,14 @@ export function parseStreamJsonToGroups(cliLogsTail: string): StreamJsonGroup[]
|
|||
if (msgId) {
|
||||
const occurrence = msgIdOccurrences.get(msgId) ?? 0;
|
||||
msgIdOccurrences.set(msgId, occurrence + 1);
|
||||
currentGroupId = occurrence === 0
|
||||
? `stream-group-${msgId}`
|
||||
: `stream-group-${msgId}-${occurrence}`;
|
||||
currentGroupId =
|
||||
occurrence === 0 ? `stream-group-${msgId}` : `stream-group-${msgId}-${occurrence}`;
|
||||
} else {
|
||||
currentGroupId = `stream-group-L${lineIndex}`;
|
||||
}
|
||||
}
|
||||
|
||||
const items = contentBlocksToDisplayItems(blocks, currentTimestamp!, lineIndex);
|
||||
const items = contentBlocksToDisplayItems(blocks, currentTimestamp, lineIndex);
|
||||
currentItems.push(...items);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -30,7 +30,6 @@ import type {
|
|||
import type {
|
||||
AddMemberRequest,
|
||||
AttachmentFileData,
|
||||
AttachmentMediaType,
|
||||
CommentAttachmentPayload,
|
||||
CreateTaskRequest,
|
||||
GlobalTask,
|
||||
|
|
@ -45,6 +44,8 @@ import type {
|
|||
TaskAttachmentMeta,
|
||||
TaskComment,
|
||||
TeamChangeEvent,
|
||||
TeamClaudeLogsQuery,
|
||||
TeamClaudeLogsResponse,
|
||||
TeamConfig,
|
||||
TeamCreateConfigRequest,
|
||||
TeamCreateRequest,
|
||||
|
|
@ -398,10 +399,7 @@ export interface HttpServerAPI {
|
|||
export interface TeamsAPI {
|
||||
list: () => Promise<TeamSummary[]>;
|
||||
getData: (teamName: string) => Promise<TeamData>;
|
||||
getClaudeLogs: (
|
||||
teamName: string,
|
||||
query?: import('./team').TeamClaudeLogsQuery
|
||||
) => Promise<import('./team').TeamClaudeLogsResponse>;
|
||||
getClaudeLogs: (teamName: string, query?: TeamClaudeLogsQuery) => Promise<TeamClaudeLogsResponse>;
|
||||
deleteTeam: (teamName: string) => Promise<void>;
|
||||
restoreTeam: (teamName: string) => Promise<void>;
|
||||
permanentlyDeleteTeam: (teamName: string) => Promise<void>;
|
||||
|
|
|
|||
|
|
@ -163,6 +163,7 @@ export interface CommentAttachmentPayload {
|
|||
* Note: the UI may still choose to preview only certain types (e.g. images),
|
||||
* but tasks/comments can store arbitrary attachments for agent workflows.
|
||||
*/
|
||||
// eslint-disable-next-line sonarjs/redundant-type-aliases -- semantic alias for documentation/readability
|
||||
export type AttachmentMediaType = string;
|
||||
|
||||
/** Supported image MIME types (used for preview/validation in UI). */
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
export function parseNumericSuffixName(
|
||||
name: string
|
||||
): { base: string; suffix: number } | null {
|
||||
export function parseNumericSuffixName(name: string): { base: string; suffix: number } | null {
|
||||
const trimmed = name.trim();
|
||||
if (!trimmed) return null;
|
||||
const match = trimmed.match(/^(.+)-(\d+)$/);
|
||||
const match = /^(.+)-(\d+)$/.exec(trimmed);
|
||||
if (!match?.[1] || !match[2]) return null;
|
||||
const suffix = Number(match[2]);
|
||||
if (!Number.isFinite(suffix)) return null;
|
||||
|
|
@ -17,7 +15,9 @@ export function parseNumericSuffixName(
|
|||
*
|
||||
* Important: do NOT treat "-1" as auto-suffix; it's commonly intentional ("dev-1").
|
||||
*/
|
||||
export function createCliAutoSuffixNameGuard(allNames: Iterable<string>): (name: string) => boolean {
|
||||
export function createCliAutoSuffixNameGuard(
|
||||
allNames: Iterable<string>
|
||||
): (name: string) => boolean {
|
||||
const trimmed: string[] = [];
|
||||
const seen = new Set<string>();
|
||||
for (const n of allNames) {
|
||||
|
|
@ -38,4 +38,3 @@ export function createCliAutoSuffixNameGuard(allNames: Iterable<string>): (name:
|
|||
return !allLower.has(info.base.toLowerCase());
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue