Apply biome formatting to reception changes
Co-authored-by: cynarAI <cynarAI@users.noreply.github.com>
This commit is contained in:
parent
eae3a91ef5
commit
e45b9ff720
@ -15,9 +15,9 @@ import { loadMessagePage } from "./thread-message-pages.js";
|
||||
|
||||
export interface ReceptionService {
|
||||
isEnabled(): boolean;
|
||||
plan(input: Omit<ReceptionPlanInput, "history" | "botName"> & { botName: string }): Promise<
|
||||
ReceptionPlan | null
|
||||
>;
|
||||
plan(
|
||||
input: Omit<ReceptionPlanInput, "history" | "botName"> & { botName: string },
|
||||
): Promise<ReceptionPlan | null>;
|
||||
}
|
||||
|
||||
export function createReceptionService(deps: {
|
||||
|
||||
@ -40,8 +40,8 @@ import {
|
||||
resolveSendAttachments,
|
||||
} from "./artifacts.js";
|
||||
import { resolveBusyBotName, toComputerStatus } from "./computer-status.js";
|
||||
import { withSerializableRetry } from "./serializable-retry.js";
|
||||
import type { ReceptionService } from "./reception.js";
|
||||
import { withSerializableRetry } from "./serializable-retry.js";
|
||||
import { loadMessagePage } from "./thread-message-pages.js";
|
||||
|
||||
export type ThreadTarget =
|
||||
|
||||
@ -51,9 +51,7 @@ describe("heuristicReceptionRoute", () => {
|
||||
});
|
||||
|
||||
it("routes clear work orders to work", () => {
|
||||
expect(
|
||||
heuristicReceptionRoute("Split executor.ts into modules and open a PR"),
|
||||
).toBe("work");
|
||||
expect(heuristicReceptionRoute("Split executor.ts into modules and open a PR")).toBe("work");
|
||||
expect(heuristicReceptionRoute("Refactor the login flow and add tests")).toBe("work");
|
||||
});
|
||||
|
||||
|
||||
@ -64,11 +64,7 @@ export function receptionMaxHistoryMessages(env: NodeJS.ProcessEnv = process.env
|
||||
return Math.floor(value);
|
||||
}
|
||||
|
||||
function receptionTokenLimit(
|
||||
env: NodeJS.ProcessEnv,
|
||||
name: string,
|
||||
fallback: number,
|
||||
): number {
|
||||
function receptionTokenLimit(env: NodeJS.ProcessEnv, name: string, fallback: number): number {
|
||||
const raw = env[name]?.trim();
|
||||
if (!raw) return fallback;
|
||||
const value = Number(raw);
|
||||
@ -106,10 +102,9 @@ export function isReceptionConfigured(env: NodeJS.ProcessEnv = process.env): boo
|
||||
}
|
||||
|
||||
/** Hard skips before any model call. */
|
||||
export function shouldSkipReception(input: Pick<
|
||||
ReceptionPlanInput,
|
||||
"hasAttachments" | "text"
|
||||
>): boolean {
|
||||
export function shouldSkipReception(
|
||||
input: Pick<ReceptionPlanInput, "hasAttachments" | "text">,
|
||||
): boolean {
|
||||
if (input.hasAttachments) return true;
|
||||
const text = input.text?.trim();
|
||||
if (!text) return true;
|
||||
@ -172,8 +167,7 @@ export function parseReceptionResponse(raw: string | undefined): ReceptionPlan |
|
||||
const parsed = JSON.parse(object) as { route?: unknown; reply?: unknown };
|
||||
if (parsed.route === "work") return { route: "work" };
|
||||
if (parsed.route === "chat" || parsed.route === "clarify") {
|
||||
const reply =
|
||||
typeof parsed.reply === "string" ? truncate(parsed.reply, MAX_REPLY_CHARS) : "";
|
||||
const reply = typeof parsed.reply === "string" ? truncate(parsed.reply, MAX_REPLY_CHARS) : "";
|
||||
if (!reply) return parsed.route === "clarify" ? { route: "clarify" } : null;
|
||||
return { route: parsed.route, reply };
|
||||
}
|
||||
@ -261,7 +255,10 @@ export async function runReceptionPlan(
|
||||
}
|
||||
|
||||
function defaultGreetingReply(botName: string): string {
|
||||
return truncate(`Hi! I'm ${cleanLine(botName)}. What would you like to work on?`, MAX_REPLY_CHARS);
|
||||
return truncate(
|
||||
`Hi! I'm ${cleanLine(botName)}. What would you like to work on?`,
|
||||
MAX_REPLY_CHARS,
|
||||
);
|
||||
}
|
||||
|
||||
export function receptionBotName(name: string): string {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user