Restore helper layout in auth, isolation, runtime, and profiles from main

This commit is contained in:
Danny Kim
2026-10-17 18:49:28 +09:00
parent 0c5059e3b4
commit cd1864e1a9
5 changed files with 40 additions and 59 deletions
+6 -2
View File
@@ -5,8 +5,8 @@ import process from "node:process";
import { isNotFound } from "./errors.ts";
import { isObject } from "./json.ts";
import { failureFooter, isFailureReason, isProfileType, withProfile } from "./profiles.ts";
import type { ProfileFailure } from "./profiles.ts";
import { failureFooter, withProfile } from "./profiles.ts";
import type { FailureReason, ProfileFailure } from "./profiles.ts";
import { readRuntimeManifest } from "./runtime.ts";
import type { RuntimeManifest, RuntimeOutcome } from "./runtime.ts";
@@ -30,6 +30,10 @@ const VERDICTS: Record<string, [event: string, mark: string]> = {
Approved: ["APPROVED", "✅"],
"Changes requested": ["REQUEST_CHANGES", "🛑"],
};
const PROFILE_TYPES: Set<unknown> = new Set(["claude", "codex", "opencode"]);
const FAILURE_REASONS: Set<unknown> = new Set(["sign-in failed", "usage exhausted", "failed"]);
const isProfileType = (value: unknown): value is ProfileFailure["type"] => PROFILE_TYPES.has(value);
const isFailureReason = (value: unknown): value is FailureReason => FAILURE_REASONS.has(value);
const failureComment = (failures: ProfileFailure[]): string =>
`AI bot failed.\n\n${failureFooter(failures)}`;