Skip to content

Commit a517e04

Browse files
committed
Biome format
1 parent 12ff380 commit a517e04

11 files changed

Lines changed: 89 additions & 36 deletions

apps/web/src/app/api/telegram/webhook/route.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1194,7 +1194,9 @@ describe("telegram webhook route", () => {
11941194
operationKind: "plan",
11951195
targetRef: null,
11961196
resolvedFields: {
1197-
scheduleFields: { time: { kind: "absolute", hour: 15, minute: 0 } },
1197+
scheduleFields: {
1198+
time: { kind: "absolute", hour: 15, minute: 0 },
1199+
},
11981200
},
11991201
missingFields: [],
12001202
originatingText: "Schedule the dentist reminder",

apps/web/src/lib/server/conversation-state.test.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
import type { ConversationStateSnapshot, PendingWriteOperation, TimeSpec } from "@atlas/core";
1+
import type {
2+
ConversationStateSnapshot,
3+
PendingWriteOperation,
4+
TimeSpec,
5+
} from "@atlas/core";
26
import type { ProcessedInboxResult } from "@atlas/db";
37
import { describe, expect, it } from "vitest";
48

@@ -298,7 +302,9 @@ describe("deriveConversationReplyState", () => {
298302
policy: {
299303
action: "present_proposal",
300304
resolvedOperation: buildPendingWriteOperation({
301-
resolvedFields: { scheduleFields: { day: "tomorrow", time: t(17, 0) } },
305+
resolvedFields: {
306+
scheduleFields: { day: "tomorrow", time: t(17, 0) },
307+
},
302308
missingFields: [],
303309
}),
304310
},

apps/web/src/lib/server/conversation-state.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,7 @@ type DeriveConversationReplyStateInput = {
2121
snapshot: ConversationStateSnapshot;
2222
policy: Pick<
2323
TurnPolicyDecision,
24-
| "action"
25-
| "clarificationSlots"
26-
| "targetProposalId"
27-
| "resolvedOperation"
24+
"action" | "clarificationSlots" | "targetProposalId" | "resolvedOperation"
2825
> & {
2926
action: Extract<
3027
TurnPolicyAction,
@@ -108,7 +105,8 @@ export function deriveConversationReplyState(
108105
confirmationRequired: true,
109106
originatingTurnText: input.userTurnText,
110107
missingSlots: input.policy.clarificationSlots,
111-
slotSnapshot: input.policy.resolvedOperation?.resolvedFields.scheduleFields ?? {},
108+
slotSnapshot:
109+
input.policy.resolvedOperation?.resolvedFields.scheduleFields ?? {},
112110
},
113111
}),
114112
);

apps/web/src/lib/server/decide-turn-policy.test.ts

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,11 @@ describe("decideTurnPolicy", () => {
9898
decideTurnPolicy(
9999
input(
100100
{ turnType: "planning_request", confidence: 0.68 },
101-
{ resolvedFields: { scheduleFields: { day: "tomorrow", time: t(18, 0) } } },
101+
{
102+
resolvedFields: {
103+
scheduleFields: { day: "tomorrow", time: t(18, 0) },
104+
},
105+
},
102106
{
103107
rawText: "Schedule gym tomorrow at 6pm",
104108
normalizedText: "Schedule gym tomorrow at 6pm",
@@ -368,7 +372,11 @@ describe("decideTurnPolicy", () => {
368372
resolvedEntityIds: ["task-1"],
369373
resolvedProposalId: "proposal-1",
370374
},
371-
{ resolvedFields: { scheduleFields: { time: t(15, 0), day: "tomorrow" } } },
375+
{
376+
resolvedFields: {
377+
scheduleFields: { time: t(15, 0), day: "tomorrow" },
378+
},
379+
},
372380
{
373381
rawText: "make it 3 instead",
374382
normalizedText: "make it 3 instead",
@@ -542,7 +550,11 @@ describe("decideTurnPolicy", () => {
542550
confidence: 0.9,
543551
resolvedEntityIds: ["task-1"],
544552
},
545-
{ resolvedFields: { scheduleFields: { day: "tomorrow", time: t(17, 0) } } },
553+
{
554+
resolvedFields: {
555+
scheduleFields: { day: "tomorrow", time: t(17, 0) },
556+
},
557+
},
546558
{
547559
rawText: "ok but make it 5pm",
548560
normalizedText: "ok but make it 5pm",
@@ -616,5 +628,4 @@ describe("decideTurnPolicy", () => {
616628
clarificationSlots: expect.arrayContaining(["scheduleFields.time"]),
617629
});
618630
});
619-
620631
});

apps/web/src/lib/server/decide-turn-policy.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,9 @@ export function decideTurnPolicy(
6666
case "confirmation": {
6767
const proposalId =
6868
classification.resolvedProposalId ??
69-
resolveSingleActiveProposalId(input.routingContext.entityRegistry ?? []);
69+
resolveSingleActiveProposalId(
70+
input.routingContext.entityRegistry ?? [],
71+
);
7072

7173
if (proposalId) {
7274
return {
@@ -132,7 +134,10 @@ function deriveStructuredWriteReadiness(
132134
): StructuredWriteReadiness {
133135
const { classification, commitResult } = input;
134136
const allClarificationSlots = Array.from(
135-
new Set([...commitResult.missingFields, ...commitResult.needsClarification]),
137+
new Set([
138+
...commitResult.missingFields,
139+
...commitResult.needsClarification,
140+
]),
136141
);
137142

138143
if (ambiguity === "high") {

apps/web/src/lib/server/telegram-webhook.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,9 @@ export async function handleTelegramWebhook(
453453
);
454454

455455
const synthesis = synthesizeMutationText({
456-
resolvedSlots: routedWithContext.policy.resolvedOperation?.resolvedFields.scheduleFields ?? {},
456+
resolvedSlots:
457+
routedWithContext.policy.resolvedOperation?.resolvedFields
458+
.scheduleFields ?? {},
457459
proposalEntity,
458460
entityRegistry,
459461
});

apps/web/src/lib/server/turn-router.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,12 @@ export async function routeMessageTurn(
8888
let slotExtraction = null;
8989

9090
if (SLOT_COMMITTING_TURN_TYPES.has(classification.turnType)) {
91-
const priorScheduleFields = priorOperation?.resolvedFields.scheduleFields ?? {};
91+
const priorScheduleFields =
92+
priorOperation?.resolvedFields.scheduleFields ?? {};
9293
const pendingSlots = requiredSlotsForOperation(operationKind).filter(
93-
(slot) => priorScheduleFields[slot as keyof typeof priorScheduleFields] === undefined,
94+
(slot) =>
95+
priorScheduleFields[slot as keyof typeof priorScheduleFields] ===
96+
undefined,
9497
);
9598

9699
slotExtraction = await extractSlots({
@@ -154,8 +157,12 @@ function buildResolvedOperation(
154157
targetRef: commitResult.resolvedTargetRef,
155158
resolvedFields: commitResult.resolvedFields,
156159
missingFields: commitResult.missingFields,
157-
originatingText: isNewWorkflow ? currentTurnText : priorOperation.originatingText,
158-
startedAt: isNewWorkflow ? new Date().toISOString() : priorOperation.startedAt,
160+
originatingText: isNewWorkflow
161+
? currentTurnText
162+
: priorOperation.originatingText,
163+
startedAt: isNewWorkflow
164+
? new Date().toISOString()
165+
: priorOperation.startedAt,
159166
};
160167
}
161168

packages/core/src/commit-policy.test.ts

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,11 @@ describe("applyCommitPolicy", () => {
274274
const result = applyCommitPolicy(
275275
buildInput({
276276
turnType: "clarification_answer",
277-
priorPendingWriteOperation: priorOp("plan", { day: "tomorrow" }, "task-abc"),
277+
priorPendingWriteOperation: priorOp(
278+
"plan",
279+
{ day: "tomorrow" },
280+
"task-abc",
281+
),
278282
}),
279283
);
280284

@@ -289,7 +293,11 @@ describe("applyCommitPolicy", () => {
289293
extractedValues: { day: "friday" },
290294
confidence: { day: 0.9 },
291295
currentTargetEntityId: "task-xyz",
292-
priorPendingWriteOperation: priorOp("plan", { time: t(14, 0) }, "task-abc"),
296+
priorPendingWriteOperation: priorOp(
297+
"plan",
298+
{ time: t(14, 0) },
299+
"task-abc",
300+
),
293301
}),
294302
);
295303

@@ -306,7 +314,11 @@ describe("applyCommitPolicy", () => {
306314
extractedValues: { time: t(17, 0) },
307315
confidence: { time: 0.9 },
308316
currentTargetEntityId: "task-abc",
309-
priorPendingWriteOperation: priorOp("plan", { day: "tomorrow" }, "task-abc"),
317+
priorPendingWriteOperation: priorOp(
318+
"plan",
319+
{ day: "tomorrow" },
320+
"task-abc",
321+
),
310322
}),
311323
);
312324

packages/core/src/commit-policy.ts

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ const CORRECTION_THRESHOLD = 0.9;
3737

3838
// Required schedule fields per operation kind.
3939
// Contract derivation lives here rather than as a pre-extraction gate.
40-
function requiredFieldsForOperation(operationKind: OperationKind): ScheduleSlot[] {
40+
function requiredFieldsForOperation(
41+
operationKind: OperationKind,
42+
): ScheduleSlot[] {
4143
switch (operationKind) {
4244
case "plan":
4345
return ["day", "time"];
@@ -72,12 +74,15 @@ export function applyCommitPolicy(
7274

7375
const operationChanged =
7476
priorPendingWriteOperation != null &&
75-
(operationKind !== priorPendingWriteOperation.operationKind || targetChanged);
77+
(operationKind !== priorPendingWriteOperation.operationKind ||
78+
targetChanged);
7679

7780
const priorScheduleFields: Partial<Record<ScheduleSlot, unknown>> =
7881
operationChanged
7982
? {}
80-
: { ...(priorPendingWriteOperation?.resolvedFields.scheduleFields ?? {}) };
83+
: {
84+
...(priorPendingWriteOperation?.resolvedFields.scheduleFields ?? {}),
85+
};
8186

8287
const needsClarification: string[] = [];
8388
const committedSchedule: Partial<Record<ScheduleSlot, unknown>> = {
@@ -142,7 +147,13 @@ export function applyCommitPolicy(
142147
? { entityId: currentTargetEntityId }
143148
: (priorPendingWriteOperation?.targetRef ?? null);
144149

145-
return { resolvedFields, resolvedTargetRef, needsClarification, missingFields, workflowChanged: operationChanged };
150+
return {
151+
resolvedFields,
152+
resolvedTargetRef,
153+
needsClarification,
154+
missingFields,
155+
workflowChanged: operationChanged,
156+
};
146157
}
147158

148159
function slotValuesEqual(slot: ScheduleSlot, a: unknown, b: unknown): boolean {

packages/core/src/proposal-rules.test.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
import { describe, expect, it } from "vitest";
2-
import type { ConversationEntity, ResolvedFields, ResolvedSlots, TimeSpec } from "./index";
2+
import type {
3+
ConversationEntity,
4+
ResolvedFields,
5+
ResolvedSlots,
6+
TimeSpec,
7+
} from "./index";
38
import { deriveProposalCompatibility } from "./proposal-rules";
49

510
function t(hour: number, minute: number): TimeSpec {

0 commit comments

Comments
 (0)