mirror of
https://github.com/murashit/codex-panel.git
synced 2026-07-22 06:57:10 +00:00
Inline trivial local helper wrappers
This commit is contained in:
parent
acf2fb9409
commit
6bfc6828ae
4 changed files with 10 additions and 28 deletions
|
|
@ -16,7 +16,7 @@ export interface ConfigReadResult {
|
|||
}
|
||||
|
||||
export function runtimeConfigSnapshotFromAppServerConfig(response: ConfigReadResult): RuntimeConfigSnapshot {
|
||||
const config = asConfigRecord(response.config);
|
||||
const config = asRecord(response.config);
|
||||
const tools = asRecordOrNull(config["tools"]);
|
||||
const workspaceWrite = asRecordOrNull(config["sandbox_workspace_write"]);
|
||||
const effort = config["model_reasoning_effort"];
|
||||
|
|
@ -42,8 +42,6 @@ export function runtimeConfigSnapshotFromAppServerConfig(response: ConfigReadRes
|
|||
};
|
||||
}
|
||||
|
||||
type ConfigProjectionRecord = Record<string, unknown>;
|
||||
|
||||
function asRecord(value: unknown): Record<string, unknown> {
|
||||
return value && typeof value === "object" ? (value as Record<string, unknown>) : {};
|
||||
}
|
||||
|
|
@ -52,10 +50,6 @@ function asRecordOrNull(value: unknown): Record<string, unknown> | null {
|
|||
return value && typeof value === "object" ? (value as Record<string, unknown>) : null;
|
||||
}
|
||||
|
||||
function asConfigRecord(value: unknown): ConfigProjectionRecord {
|
||||
return asRecord(value);
|
||||
}
|
||||
|
||||
function selectedConfigProfile(layers: ConfigReadResult["layers"]): string | null {
|
||||
let selected: string | null = null;
|
||||
if (!layers) return null;
|
||||
|
|
|
|||
|
|
@ -5,11 +5,11 @@ import { collabAgentStateExecutionState } from "../../../domain/message-stream/a
|
|||
type MessageStreamExecutionState = Exclude<ExecutionState, null>;
|
||||
type ExecutionStateByStatus = Readonly<Record<string, MessageStreamExecutionState>>;
|
||||
|
||||
const STANDARD_TOOL_STATES = {
|
||||
const STANDARD_TOOL_STATES: ExecutionStateByStatus = {
|
||||
inProgress: "running",
|
||||
completed: "completed",
|
||||
failed: "failed",
|
||||
} as const satisfies ExecutionStateByStatus;
|
||||
};
|
||||
|
||||
interface MessageStreamCollabAgentToolCall {
|
||||
id: string;
|
||||
|
|
@ -72,9 +72,5 @@ function collabAgentExecutionState(tool: string, status: string, receiverThreadI
|
|||
}
|
||||
|
||||
function collabAgentToolCallExecutionState(status: string): ExecutionState {
|
||||
return executionStateFromStatus(status, STANDARD_TOOL_STATES);
|
||||
}
|
||||
|
||||
function executionStateFromStatus(status: string, states: ExecutionStateByStatus): ExecutionState {
|
||||
return states[status] ?? null;
|
||||
return STANDARD_TOOL_STATES[status] ?? null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,13 +13,13 @@ interface MessageStreamHookRun {
|
|||
type MessageStreamExecutionState = Exclude<ExecutionState, null>;
|
||||
type ExecutionStateByStatus = Readonly<Record<string, MessageStreamExecutionState>>;
|
||||
|
||||
const HOOK_RUN_STATES = {
|
||||
const HOOK_RUN_STATES: ExecutionStateByStatus = {
|
||||
running: "running",
|
||||
completed: "completed",
|
||||
failed: "failed",
|
||||
blocked: "failed",
|
||||
stopped: "failed",
|
||||
} as const satisfies ExecutionStateByStatus;
|
||||
};
|
||||
|
||||
export function hookRunMessageStreamItem(run: MessageStreamHookRun, turnId: string | null, status: string): HookMessageStreamItem | null {
|
||||
if (run.id.length === 0) return null;
|
||||
|
|
@ -48,11 +48,7 @@ export function hookRunMessageStreamItem(run: MessageStreamHookRun, turnId: stri
|
|||
}
|
||||
|
||||
function hookRunExecutionState(status: string): ExecutionState {
|
||||
return executionStateFromStatus(status, HOOK_RUN_STATES);
|
||||
}
|
||||
|
||||
function executionStateFromStatus(status: string, states: ExecutionStateByStatus): ExecutionState {
|
||||
return states[status] ?? null;
|
||||
return HOOK_RUN_STATES[status] ?? null;
|
||||
}
|
||||
|
||||
function hookRunDisplayId(run: MessageStreamHookRun): string {
|
||||
|
|
|
|||
|
|
@ -5,13 +5,13 @@ import { permissionRows } from "../../../domain/message-stream/format/permission
|
|||
type MessageStreamExecutionState = Exclude<ExecutionState, null>;
|
||||
type ExecutionStateByStatus = Readonly<Record<string, MessageStreamExecutionState>>;
|
||||
|
||||
const AUTO_REVIEW_STATES = {
|
||||
const AUTO_REVIEW_STATES: ExecutionStateByStatus = {
|
||||
inProgress: "running",
|
||||
approved: "completed",
|
||||
denied: "failed",
|
||||
timedOut: "failed",
|
||||
aborted: "failed",
|
||||
} as const satisfies ExecutionStateByStatus;
|
||||
};
|
||||
|
||||
type AutoReviewNotification = AutoReviewStartedNotification | AutoReviewCompletedNotification;
|
||||
|
||||
|
|
@ -187,9 +187,5 @@ function autoReviewActionLabel(action: AutoReviewAction): string {
|
|||
}
|
||||
|
||||
function autoReviewExecutionState(status: string): ExecutionState {
|
||||
return executionStateFromStatus(status, AUTO_REVIEW_STATES);
|
||||
}
|
||||
|
||||
function executionStateFromStatus(status: string, states: ExecutionStateByStatus): ExecutionState {
|
||||
return states[status] ?? null;
|
||||
return AUTO_REVIEW_STATES[status] ?? null;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue