Merge branch 'dev' of https://github.com/777genius/claude_agent_teams_ui into dev
# Conflicts: # src/main/services/team/TeamProvisioningService.ts # src/renderer/components/team/ClaudeLogsSection.tsx # src/renderer/components/team/dialogs/SendMessageDialog.tsx # src/renderer/components/team/dialogs/TaskCommentsSection.tsx # src/renderer/components/team/members/MemberLogsTab.tsx
This commit is contained in:
commit
8da7e1f8e2
60 changed files with 1234 additions and 1123 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,
|
||||
|
|
@ -962,7 +963,7 @@ export class TeamDataService {
|
|||
summary: `Task #${task.id} started`,
|
||||
});
|
||||
} catch (error) {
|
||||
logger.warn(`[TeamDataService] notifyLeadOnTeammateTaskStart failed: ${error}`);
|
||||
logger.warn(`[TeamDataService] notifyLeadOnTeammateTaskStart failed: ${String(error)}`);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -993,7 +994,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);
|
||||
}
|
||||
|
|
@ -1036,7 +1037,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,
|
||||
|
|
@ -1051,8 +1052,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') {
|
||||
|
|
|
|||
|
|
@ -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[];
|
||||
|
|
|
|||
|
|
@ -60,7 +60,6 @@ const STDOUT_RING_LIMIT = 64 * 1024;
|
|||
const LOG_PROGRESS_THROTTLE_MS = 300;
|
||||
const UI_LOGS_TAIL_LIMIT = 128 * 1024;
|
||||
const SHELL_ENV_TIMEOUT_MS = 12000;
|
||||
// const CLI_PREPARE_TIMEOUT_MS = 10000;
|
||||
const PROBE_CACHE_TTL_MS = 10 * 60_000;
|
||||
const PREFLIGHT_TIMEOUT_MS = 60000;
|
||||
const PREFLIGHT_AUTH_RETRY_DELAY_MS = 2000;
|
||||
|
|
@ -1095,10 +1094,10 @@ export class TeamProvisioningService {
|
|||
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,
|
||||
|
|
@ -1393,12 +1392,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();
|
||||
|
|
@ -2560,7 +2560,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',
|
||||
|
|
@ -2781,7 +2781,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?.({
|
||||
|
|
@ -3202,9 +3202,7 @@ 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)` : '';
|
||||
|
|
@ -3323,7 +3321,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
|
||||
|
|
@ -3408,7 +3406,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)}`)
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -4050,7 +4048,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,
|
||||
|
|
@ -4098,7 +4096,7 @@ 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) {
|
||||
|
|
|
|||
|
|
@ -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,61 +169,69 @@ 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);
|
||||
|
||||
const init = async (): Promise<void> => {
|
||||
const config = await api.config.get();
|
||||
if (destroyed) return;
|
||||
try {
|
||||
const config = await api.config.get();
|
||||
if (destroyed) return;
|
||||
|
||||
const jsonText = JSON.stringify(config, null, 2);
|
||||
initialConfigRef.current = jsonText;
|
||||
setLoading(false);
|
||||
const jsonText = JSON.stringify(config, null, 2);
|
||||
initialConfigRef.current = jsonText;
|
||||
setLoading(false);
|
||||
|
||||
// Wait for DOM render
|
||||
requestAnimationFrame(() => {
|
||||
if (destroyed || !editorRef.current) return;
|
||||
// Wait for DOM render
|
||||
requestAnimationFrame(() => {
|
||||
if (destroyed || !editorRef.current) return;
|
||||
|
||||
// Clean up existing view
|
||||
if (viewRef.current) {
|
||||
viewRef.current.destroy();
|
||||
viewRef.current = null;
|
||||
}
|
||||
// Clean up existing view
|
||||
if (viewRef.current) {
|
||||
viewRef.current.destroy();
|
||||
viewRef.current = null;
|
||||
}
|
||||
|
||||
const state = EditorState.create({
|
||||
doc: jsonText,
|
||||
extensions: [
|
||||
lineNumbers(),
|
||||
highlightActiveLineGutter(),
|
||||
highlightActiveLine(),
|
||||
history(),
|
||||
foldGutter(),
|
||||
indentOnInput(),
|
||||
bracketMatching(),
|
||||
json(),
|
||||
syntaxHighlighting(oneDarkHighlightStyle),
|
||||
jsonLinter,
|
||||
lintGutter(),
|
||||
search(),
|
||||
keymap.of([...defaultKeymap, ...historyKeymap, ...foldKeymap, ...searchKeymap]),
|
||||
baseEditorTheme,
|
||||
configEditorTheme,
|
||||
EditorView.updateListener.of((update) => {
|
||||
if (update.docChanged) {
|
||||
const text = update.state.doc.toString();
|
||||
scheduleSave(text);
|
||||
}
|
||||
}),
|
||||
],
|
||||
const state = EditorState.create({
|
||||
doc: jsonText,
|
||||
extensions: [
|
||||
lineNumbers(),
|
||||
highlightActiveLineGutter(),
|
||||
highlightActiveLine(),
|
||||
history(),
|
||||
foldGutter(),
|
||||
indentOnInput(),
|
||||
bracketMatching(),
|
||||
json(),
|
||||
syntaxHighlighting(oneDarkHighlightStyle),
|
||||
jsonLinter,
|
||||
lintGutter(),
|
||||
search(),
|
||||
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();
|
||||
scheduleSave(text);
|
||||
}
|
||||
}),
|
||||
],
|
||||
});
|
||||
|
||||
const view = new EditorView({
|
||||
state,
|
||||
parent: editorRef.current,
|
||||
});
|
||||
viewRef.current = view;
|
||||
});
|
||||
|
||||
const view = new EditorView({
|
||||
state,
|
||||
parent: editorRef.current,
|
||||
});
|
||||
viewRef.current = view;
|
||||
});
|
||||
} catch (e) {
|
||||
if (destroyed) return;
|
||||
setLoading(false);
|
||||
setJsonError(e instanceof Error ? e.message : 'Failed to load config');
|
||||
}
|
||||
};
|
||||
|
||||
void init();
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -6,17 +6,19 @@ import { cn } from '@renderer/lib/utils';
|
|||
import { useStore } from '@renderer/store';
|
||||
import { Search, Terminal, X } from 'lucide-react';
|
||||
|
||||
import { CollapsibleTeamSection } from './CollapsibleTeamSection';
|
||||
import { CliLogsRichView } from './CliLogsRichView';
|
||||
import { ClaudeLogsFilterPopover, DEFAULT_CLAUDE_LOGS_FILTER } from './ClaudeLogsFilterPopover';
|
||||
import { CliLogsRichView } from './CliLogsRichView';
|
||||
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;
|
||||
}
|
||||
|
|
@ -35,9 +37,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]');
|
||||
|
|
@ -82,8 +84,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 => {
|
||||
|
|
|
|||
|
|
@ -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,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);
|
||||
|
|
@ -101,6 +102,10 @@ export const CreateTaskDialog = ({
|
|||
descChipDraft.setChips([defaultChip]);
|
||||
} else if (defaultDescription) {
|
||||
descriptionDraft.setValue(defaultDescription);
|
||||
descChipDraft.clearChipDraft();
|
||||
} else {
|
||||
descriptionDraft.clearDraft();
|
||||
descChipDraft.clearChipDraft();
|
||||
}
|
||||
setOwner(defaultOwner);
|
||||
setBlockedBy([]);
|
||||
|
|
|
|||
|
|
@ -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,6 +25,7 @@ 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 { getModifierKeyName } from '@renderer/utils/keyboardUtils';
|
||||
import { buildMemberColorMap } from '@renderer/utils/memberHelpers';
|
||||
import { AlertCircle, ImagePlus, Send, X } from 'lucide-react';
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -125,7 +125,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;
|
||||
|
|
@ -239,6 +239,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,9 @@ 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';
|
||||
import { formatDistanceToNow } from 'date-fns';
|
||||
|
|
@ -91,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);
|
||||
|
|
|
|||
|
|
@ -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,6 @@
|
|||
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 { formatAgentRole } from '@renderer/utils/formatAgentRole';
|
||||
import { agentAvatarUrl, getMemberDotClass, getPresenceLabel } from '@renderer/utils/memberHelpers';
|
||||
import { GitBranch, Loader2, MessageSquare, Plus } from 'lucide-react';
|
||||
|
|
@ -40,7 +39,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 +183,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';
|
||||
|
|
|
|||
|
|
@ -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';
|
||||
|
||||
|
|
|
|||
|
|
@ -36,7 +36,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;
|
||||
|
|
@ -150,7 +150,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
|
||||
|
|
@ -307,6 +307,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
|
||||
|
|
@ -428,7 +429,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,6 +54,7 @@ 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);
|
||||
// eslint-disable-next-line react-hooks/refs -- synchronous ref sync during render is intentional to avoid stale key in callbacks
|
||||
keyRef.current = persistenceKey;
|
||||
|
||||
// Sync ref with state
|
||||
|
|
@ -105,13 +106,21 @@ export function useAttachments(options?: UseAttachmentsOptions): UseAttachmentsR
|
|||
|
||||
// Load persisted attachments on mount
|
||||
useEffect(() => {
|
||||
if (!persistenceKey) return;
|
||||
if (!persistenceKey) {
|
||||
// Transitioning to non-persistent context: flush pending save and clear stale state
|
||||
flushPending();
|
||||
attachmentsRef.current = [];
|
||||
// eslint-disable-next-line react-hooks/set-state-in-effect -- intentional sync reset on key transition
|
||||
setAttachments([]);
|
||||
return;
|
||||
}
|
||||
|
||||
let cancelled = false;
|
||||
// Flush any pending debounced save for the previous key before switching.
|
||||
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 +204,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 +217,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