chore: clear low-risk lint warnings
This commit is contained in:
@@ -18,9 +18,7 @@ import {
|
||||
updateScheduledTask,
|
||||
} from './api';
|
||||
import {
|
||||
LOCALES,
|
||||
isLocale,
|
||||
languageNames,
|
||||
localeTags,
|
||||
matchLocale,
|
||||
messages,
|
||||
@@ -206,16 +204,6 @@ const ROOM_BOARD_FORMATTERS = {
|
||||
statusLabel,
|
||||
};
|
||||
|
||||
function queueLabel(
|
||||
pendingTasks: number,
|
||||
pendingMessages: boolean,
|
||||
t: Messages,
|
||||
) {
|
||||
const parts = [`${pendingTasks} ${t.units.task}`];
|
||||
if (pendingMessages) parts.push(t.units.messageShort);
|
||||
return parts.join(' · ');
|
||||
}
|
||||
|
||||
function buildRoomOptions(snapshots: StatusSnapshot[]): RoomOption[] {
|
||||
const rooms = new Map<string, RoomOption>();
|
||||
for (const snapshot of snapshots) {
|
||||
@@ -234,33 +222,6 @@ function buildRoomOptions(snapshots: StatusSnapshot[]): RoomOption[] {
|
||||
);
|
||||
}
|
||||
|
||||
function LanguageSelector({
|
||||
locale,
|
||||
onLocaleChange,
|
||||
t,
|
||||
}: {
|
||||
locale: Locale;
|
||||
onLocaleChange: (locale: Locale) => void;
|
||||
t: Messages;
|
||||
}) {
|
||||
return (
|
||||
<label className="language-select">
|
||||
<span>{t.language.label}</span>
|
||||
<select
|
||||
aria-label={t.language.label}
|
||||
onChange={(event) => onLocaleChange(event.target.value as Locale)}
|
||||
value={locale}
|
||||
>
|
||||
{LOCALES.map((item) => (
|
||||
<option key={item} value={item}>
|
||||
{languageNames[item]}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
);
|
||||
}
|
||||
|
||||
function LoadingSkeleton({ t }: { t: Messages }) {
|
||||
return (
|
||||
<main className="shell shell-loading" aria-busy="true">
|
||||
|
||||
@@ -46,7 +46,6 @@ import {
|
||||
extractAssistantText,
|
||||
normalizeStructuredOutput,
|
||||
readStdin,
|
||||
type RunnerOutput,
|
||||
writeOutput,
|
||||
} from './output-protocol.js';
|
||||
import {
|
||||
@@ -409,7 +408,6 @@ async function runQuery(
|
||||
(message as { subtype?: string }).subtype === 'task_progress'
|
||||
) {
|
||||
const tp = message as Record<string, unknown>;
|
||||
const summary = typeof tp.summary === 'string' ? tp.summary : '';
|
||||
const description =
|
||||
typeof tp.description === 'string' ? tp.description : '';
|
||||
const mapped = buildTaskProgressOutput(
|
||||
|
||||
@@ -488,7 +488,7 @@ server.tool(
|
||||
),
|
||||
},
|
||||
async (args) => {
|
||||
let snapshotId = '';
|
||||
let snapshotId: string;
|
||||
try {
|
||||
snapshotId = computeVerificationSnapshotId(REPO_ROOT);
|
||||
} catch (error) {
|
||||
|
||||
@@ -231,7 +231,7 @@ export function assertReadonlyWorkspaceRepoConnectivity(
|
||||
return;
|
||||
}
|
||||
|
||||
let originUrl = '';
|
||||
let originUrl: string;
|
||||
try {
|
||||
originUrl = readGitOutput(
|
||||
['config', '--get', 'remote.origin.url'],
|
||||
|
||||
@@ -81,7 +81,6 @@ async function measure(page: Page, sel: string) {
|
||||
|
||||
async function evalExpr(page: Page, expr: string) {
|
||||
const result = await page.evaluate((e) => {
|
||||
// eslint-disable-next-line no-eval
|
||||
return eval(e);
|
||||
}, expr);
|
||||
console.log(JSON.stringify(result, null, 2));
|
||||
|
||||
@@ -155,7 +155,7 @@ function getStoredRoomRoleOverrideRows(
|
||||
agent_config_json: string | null;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
}> = [];
|
||||
}>;
|
||||
try {
|
||||
rows = database
|
||||
.prepare(
|
||||
|
||||
@@ -191,7 +191,7 @@ export function ensureLinuxReadonlySandboxAppArmorSupport(options?: {
|
||||
const sysctlContents =
|
||||
'# Managed by EJClaw setup to allow bubblewrap readonly sandboxing.\n' +
|
||||
'kernel.apparmor_restrict_unprivileged_userns=0\n';
|
||||
let existingContents: string | null = null;
|
||||
let existingContents: string | null;
|
||||
|
||||
try {
|
||||
existingContents = readFileSyncFn(sysctlPath, 'utf-8');
|
||||
|
||||
@@ -15,7 +15,6 @@ import {
|
||||
ensureLinuxReadonlySandboxAppArmorSupport,
|
||||
getPlatform,
|
||||
getNodePath,
|
||||
getServiceManager,
|
||||
} from './platform.js';
|
||||
import { getServiceDefs } from './service-defs.js';
|
||||
import { setupLaunchd, setupLinux } from './service-installers.js';
|
||||
@@ -30,7 +29,6 @@ export async function run(_args: string[]): Promise<void> {
|
||||
const platform = getPlatform();
|
||||
const nodePath = getNodePath();
|
||||
const homeDir = os.homedir();
|
||||
const serviceManager = getServiceManager();
|
||||
|
||||
logger.info({ platform, nodePath, projectRoot }, 'Setting up service');
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ vi.mock('./config.js', () => ({
|
||||
|
||||
vi.mock('./env.js', () => ({
|
||||
readEnvFile: mockReadEnvFile,
|
||||
getEnv: vi.fn((key: string) => undefined),
|
||||
getEnv: vi.fn((_key: string) => undefined),
|
||||
}));
|
||||
|
||||
vi.mock('./codex-token-rotation.js', () => ({
|
||||
|
||||
@@ -487,9 +487,6 @@ export function prepareGroupEnvironment(
|
||||
const ownerCommonPairedRoomPrompt = isPairedRoom
|
||||
? readOptionalPromptFile(projectRoot, 'owner-common-paired-room.md')
|
||||
: undefined;
|
||||
const claudePairedRoomPrompt = isPairedRoom
|
||||
? readPairedRoomPrompt('claude-code', projectRoot)
|
||||
: undefined;
|
||||
const globalClaudeMemory =
|
||||
!isMain && fs.existsSync(globalClaudeMdPath)
|
||||
? fs.readFileSync(globalClaudeMdPath, 'utf-8').trim()
|
||||
|
||||
@@ -13,14 +13,13 @@ import {
|
||||
prepareGroupEnvironment,
|
||||
} from './agent-runner-environment.js';
|
||||
import { runSpawnedAgentProcess } from './agent-runner-process.js';
|
||||
import { getEnv } from './env.js';
|
||||
export {
|
||||
type AvailableGroup,
|
||||
writeGroupsSnapshot,
|
||||
writeTasksSnapshot,
|
||||
} from './agent-runner-snapshot.js';
|
||||
import { logger } from './logger.js';
|
||||
import { AgentType, RegisteredGroup, RoomRoleContext } from './types.js';
|
||||
import { RegisteredGroup, RoomRoleContext } from './types.js';
|
||||
|
||||
export interface AgentInput {
|
||||
prompt: string;
|
||||
|
||||
@@ -125,8 +125,6 @@ vi.mock('discord.js', () => {
|
||||
});
|
||||
|
||||
import { DiscordChannel, DiscordChannelOpts } from './discord.js';
|
||||
import { registerChannel } from './registry.js';
|
||||
import { getEnv } from '../env.js';
|
||||
import { logger } from '../logger.js';
|
||||
|
||||
// --- Test helpers ---
|
||||
@@ -787,8 +785,7 @@ describe('DiscordChannel', () => {
|
||||
|
||||
await channel.sendMessage('dc:1234567890123456', 'Hello');
|
||||
|
||||
const fetchedChannel =
|
||||
await currentClient().channels.fetch('1234567890123456');
|
||||
await currentClient().channels.fetch('1234567890123456');
|
||||
expect(currentClient().channels.fetch).toHaveBeenCalledWith(
|
||||
'1234567890123456',
|
||||
);
|
||||
|
||||
@@ -11,12 +11,7 @@ import {
|
||||
TextChannel,
|
||||
} from 'discord.js';
|
||||
|
||||
import {
|
||||
ASSISTANT_NAME,
|
||||
CACHE_DIR,
|
||||
DATA_DIR,
|
||||
TRIGGER_PATTERN,
|
||||
} from '../config.js';
|
||||
import { CACHE_DIR, DATA_DIR } from '../config.js';
|
||||
import { getEnv } from '../env.js';
|
||||
import { logger } from '../logger.js';
|
||||
import { validateOutboundAttachments } from '../outbound-attachments.js';
|
||||
@@ -449,7 +444,7 @@ export class DiscordChannel implements Channel {
|
||||
}
|
||||
|
||||
let cleaned = outbound.cleanText
|
||||
.replace(/^[ \t]*[•\-\*][ \t]*$/gm, '') // remove empty bullet lines
|
||||
.replace(/^[ \t]*[•*-][ \t]*$/gm, '') // remove empty bullet lines
|
||||
.replace(/\n{3,}/g, '\n\n') // collapse excessive blank lines
|
||||
.trim();
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { describe, it, expect, beforeEach } from 'vitest';
|
||||
import { describe, it, expect } from 'vitest';
|
||||
|
||||
import {
|
||||
registerChannel,
|
||||
|
||||
@@ -179,13 +179,9 @@ export function applyCodexUsageToAccount(
|
||||
|
||||
// Select the effective bucket
|
||||
const primaryBucket = usage.find((l) => l.limitId === 'codex');
|
||||
let effective: CodexRateLimit | null = null;
|
||||
const effective = primaryBucket ?? (usage.length === 1 ? usage[0] : null);
|
||||
|
||||
if (primaryBucket) {
|
||||
effective = primaryBucket;
|
||||
} else if (usage.length === 1) {
|
||||
effective = usage[0];
|
||||
} else {
|
||||
if (!effective) {
|
||||
// Multiple unknown buckets — cannot determine which is authoritative
|
||||
logger.warn(
|
||||
{ account: accountIndex + 1 },
|
||||
|
||||
@@ -31,7 +31,6 @@ import {
|
||||
getEffectiveRuntimeRoomMode,
|
||||
getExplicitRoomMode,
|
||||
getLatestMessageSeqAtOrBefore,
|
||||
getLatestPairedTaskForChat,
|
||||
getLatestTurnNumber,
|
||||
getLastRespondingAgentType,
|
||||
getRegisteredGroup,
|
||||
@@ -199,7 +198,7 @@ function getStoredRoleOverridesForLegacyMigration(
|
||||
agent_config_json: string | null;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
}> = [];
|
||||
}>;
|
||||
try {
|
||||
rows = database
|
||||
.prepare(
|
||||
|
||||
@@ -20,7 +20,7 @@ interface RequiredRoleMetadataInput {
|
||||
fallbackAgentType?: AgentType | null;
|
||||
}
|
||||
|
||||
interface OptionalRoleMetadataInput extends RequiredRoleMetadataInput {}
|
||||
type OptionalRoleMetadataInput = RequiredRoleMetadataInput;
|
||||
|
||||
function resolveFilledRequiredAgentType(
|
||||
input: RequiredRoleMetadataInput,
|
||||
|
||||
@@ -20,7 +20,6 @@ import {
|
||||
import {
|
||||
AgentType,
|
||||
PairedProject,
|
||||
PairedRoomRole,
|
||||
PairedTask,
|
||||
PairedTaskStatus,
|
||||
PairedTurnReservationIntentKind,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Database } from 'bun:sqlite';
|
||||
|
||||
import { buildPairedTurnAttemptId } from './paired-turn-attempts.js';
|
||||
import { tableHasColumn, tryExecMigration } from './migrations/helpers.js';
|
||||
import { tableHasColumn } from './migrations/helpers.js';
|
||||
|
||||
// Paired-turn provenance rebuild helpers extracted from the legacy schema
|
||||
// bundle. These remain runtime helpers because v10 replays them during
|
||||
|
||||
@@ -115,7 +115,7 @@ function getStoredRoomRoleOverrideRows(
|
||||
agent_config_json: string | null;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
}> = [];
|
||||
}>;
|
||||
try {
|
||||
rows = database
|
||||
.prepare(
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { describe, it, expect, beforeEach, vi } from 'vitest';
|
||||
import { describe, it, expect, beforeEach } from 'vitest';
|
||||
|
||||
import {
|
||||
_setRegisteredGroupForTests,
|
||||
|
||||
@@ -190,7 +190,7 @@ export async function checkGitHubActionsRun(
|
||||
};
|
||||
}
|
||||
|
||||
let failedJobs: string[] = [];
|
||||
let failedJobs: string[];
|
||||
try {
|
||||
failedJobs = await fetchFailedJobs(metadata);
|
||||
} catch {
|
||||
|
||||
@@ -46,7 +46,7 @@ describe('GroupQueue', () => {
|
||||
let concurrentCount = 0;
|
||||
let maxConcurrent = 0;
|
||||
|
||||
const processMessages = vi.fn(async (groupJid: string) => {
|
||||
const processMessages = vi.fn(async (_groupJid: string) => {
|
||||
concurrentCount++;
|
||||
maxConcurrent = Math.max(maxConcurrent, concurrentCount);
|
||||
// Simulate async work
|
||||
@@ -282,7 +282,7 @@ describe('GroupQueue', () => {
|
||||
let maxActive = 0;
|
||||
const completionCallbacks: Array<() => void> = [];
|
||||
|
||||
const processMessages = vi.fn(async (groupJid: string) => {
|
||||
const processMessages = vi.fn(async (_groupJid: string) => {
|
||||
activeCount++;
|
||||
maxActive = Math.max(maxActive, activeCount);
|
||||
await new Promise<void>((resolve) => completionCallbacks.push(resolve));
|
||||
@@ -360,7 +360,7 @@ describe('GroupQueue', () => {
|
||||
const executionOrder: string[] = [];
|
||||
let resolveFirst: () => void;
|
||||
|
||||
const processMessages = vi.fn(async (groupJid: string) => {
|
||||
const processMessages = vi.fn(async (_groupJid: string) => {
|
||||
if (executionOrder.length === 0) {
|
||||
// First call: block until we release it
|
||||
await new Promise<void>((resolve) => {
|
||||
|
||||
12
src/index.ts
12
src/index.ts
@@ -1,10 +1,8 @@
|
||||
import {
|
||||
ASSISTANT_NAME,
|
||||
DATA_DIR,
|
||||
IDLE_TIMEOUT,
|
||||
POLL_INTERVAL,
|
||||
SERVICE_ID,
|
||||
isSessionCommandSenderAllowed,
|
||||
STATUS_CHANNEL_ID,
|
||||
STATUS_UPDATE_INTERVAL,
|
||||
TIMEZONE,
|
||||
@@ -19,14 +17,11 @@ import {
|
||||
} from './channels/registry.js';
|
||||
import { writeGroupsSnapshot } from './agent-runner.js';
|
||||
import {
|
||||
type AssignRoomInput,
|
||||
getAllTasks,
|
||||
hasRecentRestartAnnouncement,
|
||||
initDatabase,
|
||||
storeChatMetadata,
|
||||
storeMessage,
|
||||
} from './db.js';
|
||||
import { composeDashboardContent } from './dashboard-render.js';
|
||||
import { GroupQueue } from './group-queue.js';
|
||||
import { resolveGroupIpcPath } from './group-folder.js';
|
||||
import { startIpcWatcher } from './ipc.js';
|
||||
@@ -34,11 +29,7 @@ import {
|
||||
deliverCanonicalOutboundMessage,
|
||||
deliverIpcOutboundMessage,
|
||||
} from './ipc-outbound-delivery.js';
|
||||
import {
|
||||
findChannel,
|
||||
formatOutbound,
|
||||
normalizeMessageForDedupe,
|
||||
} from './router.js';
|
||||
import { findChannel, formatOutbound } from './router.js';
|
||||
import {
|
||||
buildRestartAnnouncement,
|
||||
buildInterruptedRestartAnnouncement,
|
||||
@@ -50,7 +41,6 @@ import {
|
||||
} from './restart-context.js';
|
||||
import {
|
||||
isSenderAllowed,
|
||||
isTriggerAllowed,
|
||||
loadSenderAllowlist,
|
||||
shouldDropMessage,
|
||||
} from './sender-allowlist.js';
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
|
||||
import { DATA_DIR, IPC_POLL_INTERVAL, TIMEZONE } from './config.js';
|
||||
import { DATA_DIR, IPC_POLL_INTERVAL } from './config.js';
|
||||
import { readJsonFile } from './utils.js';
|
||||
import { logger } from './logger.js';
|
||||
import {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { logger } from './logger.js';
|
||||
import {
|
||||
handleSessionCommand,
|
||||
type SessionCommandDeps,
|
||||
|
||||
@@ -11,7 +11,6 @@ import {
|
||||
} from './config.js';
|
||||
import { GroupQueue, GroupRunContext } from './group-queue.js';
|
||||
import { findChannel, formatMessages } from './router.js';
|
||||
import { isTriggerAllowed, loadSenderAllowlist } from './sender-allowlist.js';
|
||||
import { enqueueGenericFollowUpAfterDeliveryRetry as enqueueDeliveryRetryFollowUp } from './message-runtime-dispatch.js';
|
||||
import { processOpenWorkItemDelivery } from './message-runtime-delivery.js';
|
||||
import { deliverCanonicalOutboundMessage } from './ipc-outbound-delivery.js';
|
||||
@@ -340,7 +339,6 @@ export function createMessageRuntime(deps: MessageRuntimeDeps): {
|
||||
return true;
|
||||
}
|
||||
|
||||
const isMainGroup = group.isMain === true;
|
||||
while (true) {
|
||||
const sinceSeqCursor = deps.getLastAgentTimestamps()[chatJid] || '0';
|
||||
const rawMissedMessages = getMessagesSinceSeq(
|
||||
|
||||
@@ -15,10 +15,7 @@ import {
|
||||
transitionPairedTaskStatus,
|
||||
} from './paired-task-status.js';
|
||||
import { resolveOwnerCompletionSignal } from './paired-completion-signals.js';
|
||||
import {
|
||||
hasCodeChangesSinceRef,
|
||||
resolveCanonicalSourceRef,
|
||||
} from './paired-source-ref.js';
|
||||
import { hasCodeChangesSinceRef } from './paired-source-ref.js';
|
||||
import { parseVisibleVerdict } from './paired-verdict.js';
|
||||
import type { PairedTask } from './types.js';
|
||||
|
||||
|
||||
@@ -133,7 +133,7 @@ export function handleReviewerCompletion(args: {
|
||||
return;
|
||||
}
|
||||
|
||||
case 'request_arbiter':
|
||||
case 'request_arbiter': {
|
||||
const arbiterLogMessage =
|
||||
verdict === 'blocked' || verdict === 'needs_context'
|
||||
? 'Reviewer blocked/needs_context — requesting arbiter before escalating'
|
||||
@@ -152,6 +152,7 @@ export function handleReviewerCompletion(args: {
|
||||
logContext: { taskId, verdict, summary: summary?.slice(0, 100) },
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
case 'request_owner_changes':
|
||||
transitionPairedTaskStatus({
|
||||
|
||||
@@ -8,14 +8,12 @@ import {
|
||||
} from 'ejclaw-runners-shared';
|
||||
|
||||
import {
|
||||
ARBITER_DEADLOCK_THRESHOLD,
|
||||
ARBITER_AGENT_TYPE,
|
||||
CLAUDE_SERVICE_ID,
|
||||
CODEX_MAIN_SERVICE_ID,
|
||||
CODEX_REVIEW_SERVICE_ID,
|
||||
DATA_DIR,
|
||||
PAIRED_CARRY_FORWARD_LATEST_OWNER_FINAL,
|
||||
PAIRED_MAX_ROUND_TRIPS,
|
||||
REVIEWER_AGENT_TYPE,
|
||||
} from './config.js';
|
||||
import {
|
||||
@@ -26,8 +24,6 @@ import {
|
||||
getPairedTaskById,
|
||||
getPairedTurnById,
|
||||
getPairedTurnOutputs,
|
||||
getPairedWorkspace,
|
||||
hasActiveCiWatcherForChat,
|
||||
insertPairedTurnOutput,
|
||||
releasePairedTaskExecutionLease,
|
||||
updatePairedTask,
|
||||
@@ -50,11 +46,9 @@ import {
|
||||
applyPairedTaskPatch,
|
||||
transitionPairedTaskStatus,
|
||||
} from './paired-task-status.js';
|
||||
import { requestArbiterOrEscalate } from './paired-arbiter-request.js';
|
||||
import { resolveCanonicalSourceRef } from './paired-source-ref.js';
|
||||
import {
|
||||
isOwnerWorkspaceRepairNeededError,
|
||||
markPairedTaskReviewReady,
|
||||
prepareReviewerWorkspaceForExecution,
|
||||
provisionOwnerWorkspaceForPairedTask,
|
||||
} from './paired-workspace-manager.js';
|
||||
|
||||
@@ -16,11 +16,8 @@ import { transitionPairedTaskStatus } from './paired-task-status.js';
|
||||
import type { PairedTask, PairedWorkspace } from './types.js';
|
||||
import { ensureWorkspaceDependenciesInstalled } from './workspace-package-manager.js';
|
||||
|
||||
const REVIEWER_SNAPSHOT_STALE_BLOCK_MESSAGE =
|
||||
'Review workspace is out of date after owner changes. Retry the review once to resync against the latest owner workspace.';
|
||||
const REVIEWER_SNAPSHOT_NOT_READY_BLOCK_MESSAGE =
|
||||
'Review workspace is not ready yet. Wait for the owner to complete a turn so the reviewer workspace can be prepared.';
|
||||
const OWNER_WORKSPACE_REPAIR_PREFIX = 'BLOCKED\nOwner workspace needs repair.';
|
||||
const REVIEWER_SNAPSHOT_DENY_SEGMENTS = new Set([
|
||||
'.git',
|
||||
'.claude',
|
||||
@@ -139,19 +136,6 @@ function isGitWorktreeClean(repoDir: string): boolean {
|
||||
return runGit(['status', '--short'], repoDir).length === 0;
|
||||
}
|
||||
|
||||
function buildOwnerWorkspaceRepairBlockMessage(args: {
|
||||
workspaceDir: string;
|
||||
currentBranch: string;
|
||||
targetBranch: string;
|
||||
reason: string;
|
||||
}): string {
|
||||
return `${OWNER_WORKSPACE_REPAIR_PREFIX}
|
||||
Owner workspace branch mismatch: \`${args.currentBranch}\` -> expected \`${args.targetBranch}\`.
|
||||
${args.reason}
|
||||
Workspace: \`${args.workspaceDir}\`
|
||||
Repair the owner workspace branch, then retry the task.`;
|
||||
}
|
||||
|
||||
function buildOwnerReanchorBackupPrefix(targetBranch: string): string {
|
||||
const groupFolder = targetBranch.startsWith('codex/owner/')
|
||||
? targetBranch.slice('codex/owner/'.length)
|
||||
@@ -286,10 +270,6 @@ function maybeRepairNamedOwnerWorkspaceBranch(args: {
|
||||
return true;
|
||||
}
|
||||
|
||||
function ensureCleanDirectory(targetDir: string): void {
|
||||
fs.mkdirSync(targetDir, { recursive: true });
|
||||
}
|
||||
|
||||
type GitWorktreeEntry = {
|
||||
worktreePath: string;
|
||||
head: string | null;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { describe, it, expect, beforeEach } from 'vitest';
|
||||
|
||||
import { _initTestDatabase, getAllChats, storeChatMetadata } from './db.js';
|
||||
import { _initTestDatabase, storeChatMetadata } from './db.js';
|
||||
import { getAvailableGroups, _setRegisteredGroups } from './index.js';
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import fs from 'fs';
|
||||
import os from 'os';
|
||||
import path from 'path';
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
|
||||
|
||||
import {
|
||||
isSenderAllowed,
|
||||
|
||||
@@ -81,12 +81,6 @@ export interface SessionCommandDeps {
|
||||
killProcess: () => boolean;
|
||||
}
|
||||
|
||||
function resultToText(result: string | object | null | undefined): string {
|
||||
if (!result) return '';
|
||||
const raw = typeof result === 'string' ? result : JSON.stringify(result);
|
||||
return formatOutbound(raw);
|
||||
}
|
||||
|
||||
function agentResultToText(result: AgentResult): string {
|
||||
const raw = getAgentOutputText({
|
||||
result: result.result ?? null,
|
||||
@@ -126,10 +120,6 @@ export async function handleSessionCommand(opts: {
|
||||
const command = cmdMsg
|
||||
? extractSessionCommand(cmdMsg.content, triggerPattern)
|
||||
: null;
|
||||
const normalizedCommandText = cmdMsg
|
||||
? normalizeSessionCommandText(cmdMsg.content, triggerPattern)
|
||||
: '';
|
||||
|
||||
if (!command || !cmdMsg) return { handled: false };
|
||||
|
||||
if (
|
||||
|
||||
@@ -57,7 +57,6 @@ export interface FastModeSnapshot {
|
||||
}
|
||||
|
||||
const ROLE_KEYS = ['OWNER', 'REVIEWER', 'ARBITER'] as const;
|
||||
type RoleKey = (typeof ROLE_KEYS)[number];
|
||||
|
||||
function envFilePath(): string {
|
||||
return path.join(process.cwd(), '.env');
|
||||
@@ -555,7 +554,7 @@ function readCodexFastMode(): boolean {
|
||||
if (!fs.existsSync(file)) return false;
|
||||
const content = fs.readFileSync(file, 'utf-8');
|
||||
// [features] section, look for fast_mode = true|false
|
||||
const featuresMatch = content.match(/\[features\][\s\S]*?(?=^\[|\Z)/m);
|
||||
const featuresMatch = content.match(/\[features\][\s\S]*?(?=^\[|$)/m);
|
||||
const block = featuresMatch ? featuresMatch[0] : content;
|
||||
const m = block.match(/^\s*fast_mode\s*=\s*(true|false)\s*$/m);
|
||||
return m ? m[1] === 'true' : false;
|
||||
@@ -663,7 +662,7 @@ export function addClaudeAccountFromToken(token: string): {
|
||||
if (parts.length < 2) {
|
||||
throw new Error('invalid OAuth token: expected JWT format');
|
||||
}
|
||||
let payload: Record<string, unknown> = {};
|
||||
let payload: Record<string, unknown>;
|
||||
try {
|
||||
payload = JSON.parse(
|
||||
Buffer.from(parts[1], 'base64').toString('utf-8'),
|
||||
|
||||
@@ -533,11 +533,7 @@ describe('evaluateStreamedOutput', () => {
|
||||
reason: '429',
|
||||
});
|
||||
|
||||
const result = evaluateStreamedOutput(
|
||||
errorOutput('429'),
|
||||
freshState(),
|
||||
claudeOpts,
|
||||
);
|
||||
evaluateStreamedOutput(errorOutput('429'), freshState(), claudeOpts);
|
||||
// Claude uses classifyRotationTrigger, not detectCodexRotationTrigger
|
||||
expect(detectCodexRotationTrigger).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
@@ -42,11 +42,7 @@ import {
|
||||
formatSuspensionNotice,
|
||||
suspendTask,
|
||||
} from './task-suspension.js';
|
||||
import {
|
||||
extractWatchCiTarget,
|
||||
getTaskQueueJid,
|
||||
isGitHubCiTask,
|
||||
} from './task-watch-status.js';
|
||||
import { getTaskQueueJid, isGitHubCiTask } from './task-watch-status.js';
|
||||
import { ScheduledTask } from './types.js';
|
||||
import {
|
||||
hasTaskExceededMaxDuration,
|
||||
@@ -163,13 +159,12 @@ async function runTask(
|
||||
);
|
||||
|
||||
let result: string | null = null;
|
||||
let error: string | null = null;
|
||||
let error: string | null;
|
||||
const statusTracker = createTaskStatusTracker(task, {
|
||||
sendTrackedMessage: deps.sendTrackedMessage,
|
||||
editTrackedMessage: deps.editTrackedMessage,
|
||||
});
|
||||
const isClaudeAgent = context.taskAgentType === 'claude-code';
|
||||
const canRotateToken = isClaudeAgent && getTokenCount() > 1;
|
||||
|
||||
try {
|
||||
await statusTracker.update('checking');
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
* All exhausted: surface error to caller
|
||||
*/
|
||||
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
|
||||
import { DATA_DIR } from './config.js';
|
||||
|
||||
@@ -17,7 +17,6 @@ import {
|
||||
getLatestPairedTurnForTask,
|
||||
getRecentDeliveredWorkItemsForChat,
|
||||
getRecentChatMessages,
|
||||
getRecentChatMessagesBatch,
|
||||
getTaskById,
|
||||
hasMessage,
|
||||
storeChatMetadata,
|
||||
|
||||
@@ -68,7 +68,7 @@ async function readJsonObject(
|
||||
request: Request,
|
||||
jsonResponse: JsonResponse,
|
||||
): Promise<Record<string, unknown> | Response> {
|
||||
let body: unknown = null;
|
||||
let body: unknown;
|
||||
try {
|
||||
body = await request.json();
|
||||
} catch {
|
||||
@@ -141,7 +141,7 @@ async function handleClaudeAccountAddRoute(
|
||||
): Promise<Response | null> {
|
||||
if (request.method !== 'POST') return null;
|
||||
|
||||
let body: { token?: unknown } | null = null;
|
||||
let body: { token?: unknown };
|
||||
try {
|
||||
body = (await request.json()) as { token?: unknown };
|
||||
} catch {
|
||||
@@ -213,7 +213,7 @@ async function handleCodexCurrentRoute(
|
||||
): Promise<Response | null> {
|
||||
if (request.method !== 'PUT') return null;
|
||||
|
||||
let body: { index?: unknown } | null = null;
|
||||
let body: { index?: unknown };
|
||||
try {
|
||||
body = (await request.json()) as { index?: unknown };
|
||||
} catch {
|
||||
|
||||
Reference in New Issue
Block a user