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 {
|
export interface ReceptionService {
|
||||||
isEnabled(): boolean;
|
isEnabled(): boolean;
|
||||||
plan(input: Omit<ReceptionPlanInput, "history" | "botName"> & { botName: string }): Promise<
|
plan(
|
||||||
ReceptionPlan | null
|
input: Omit<ReceptionPlanInput, "history" | "botName"> & { botName: string },
|
||||||
>;
|
): Promise<ReceptionPlan | null>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function createReceptionService(deps: {
|
export function createReceptionService(deps: {
|
||||||
|
|||||||
@ -40,8 +40,8 @@ import {
|
|||||||
resolveSendAttachments,
|
resolveSendAttachments,
|
||||||
} from "./artifacts.js";
|
} from "./artifacts.js";
|
||||||
import { resolveBusyBotName, toComputerStatus } from "./computer-status.js";
|
import { resolveBusyBotName, toComputerStatus } from "./computer-status.js";
|
||||||
import { withSerializableRetry } from "./serializable-retry.js";
|
|
||||||
import type { ReceptionService } from "./reception.js";
|
import type { ReceptionService } from "./reception.js";
|
||||||
|
import { withSerializableRetry } from "./serializable-retry.js";
|
||||||
import { loadMessagePage } from "./thread-message-pages.js";
|
import { loadMessagePage } from "./thread-message-pages.js";
|
||||||
|
|
||||||
export type ThreadTarget =
|
export type ThreadTarget =
|
||||||
|
|||||||
@ -51,9 +51,7 @@ describe("heuristicReceptionRoute", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("routes clear work orders to work", () => {
|
it("routes clear work orders to work", () => {
|
||||||
expect(
|
expect(heuristicReceptionRoute("Split executor.ts into modules and open a PR")).toBe("work");
|
||||||
heuristicReceptionRoute("Split executor.ts into modules and open a PR"),
|
|
||||||
).toBe("work");
|
|
||||||
expect(heuristicReceptionRoute("Refactor the login flow and add tests")).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);
|
return Math.floor(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
function receptionTokenLimit(
|
function receptionTokenLimit(env: NodeJS.ProcessEnv, name: string, fallback: number): number {
|
||||||
env: NodeJS.ProcessEnv,
|
|
||||||
name: string,
|
|
||||||
fallback: number,
|
|
||||||
): number {
|
|
||||||
const raw = env[name]?.trim();
|
const raw = env[name]?.trim();
|
||||||
if (!raw) return fallback;
|
if (!raw) return fallback;
|
||||||
const value = Number(raw);
|
const value = Number(raw);
|
||||||
@ -106,10 +102,9 @@ export function isReceptionConfigured(env: NodeJS.ProcessEnv = process.env): boo
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Hard skips before any model call. */
|
/** Hard skips before any model call. */
|
||||||
export function shouldSkipReception(input: Pick<
|
export function shouldSkipReception(
|
||||||
ReceptionPlanInput,
|
input: Pick<ReceptionPlanInput, "hasAttachments" | "text">,
|
||||||
"hasAttachments" | "text"
|
): boolean {
|
||||||
>): boolean {
|
|
||||||
if (input.hasAttachments) return true;
|
if (input.hasAttachments) return true;
|
||||||
const text = input.text?.trim();
|
const text = input.text?.trim();
|
||||||
if (!text) return true;
|
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 };
|
const parsed = JSON.parse(object) as { route?: unknown; reply?: unknown };
|
||||||
if (parsed.route === "work") return { route: "work" };
|
if (parsed.route === "work") return { route: "work" };
|
||||||
if (parsed.route === "chat" || parsed.route === "clarify") {
|
if (parsed.route === "chat" || parsed.route === "clarify") {
|
||||||
const reply =
|
const reply = typeof parsed.reply === "string" ? truncate(parsed.reply, MAX_REPLY_CHARS) : "";
|
||||||
typeof parsed.reply === "string" ? truncate(parsed.reply, MAX_REPLY_CHARS) : "";
|
|
||||||
if (!reply) return parsed.route === "clarify" ? { route: "clarify" } : null;
|
if (!reply) return parsed.route === "clarify" ? { route: "clarify" } : null;
|
||||||
return { route: parsed.route, reply };
|
return { route: parsed.route, reply };
|
||||||
}
|
}
|
||||||
@ -261,7 +255,10 @@ export async function runReceptionPlan(
|
|||||||
}
|
}
|
||||||
|
|
||||||
function defaultGreetingReply(botName: string): string {
|
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 {
|
export function receptionBotName(name: string): string {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user