Skip to content

Commit babb497

Browse files
MaxLinCodeclaude
andcommitted
Add ResolvedSlots, WriteContract types and proposal statuses to core
Phase 1 of turn routing refactor: extend DiscourseState with resolved_slots and pending_write_contract fields, and add "presented" and "confirmed" to the entity base status enum. Purely additive — no routing logic changes. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 653abb9 commit babb497

2 files changed

Lines changed: 21 additions & 1 deletion

File tree

packages/core/src/discourse-state.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,31 @@ export const pendingClarificationSchema = z.object({
4444
priority: z.number().int().optional()
4545
});
4646

47+
export const resolvedSlotsSchema = z.object({
48+
day: z.string().optional(),
49+
time: z.string().optional(),
50+
duration: z.number().optional(),
51+
target: z.string().optional()
52+
});
53+
54+
export type ResolvedSlots = z.infer<typeof resolvedSlotsSchema>;
55+
56+
export const writeContractSchema = z.object({
57+
requiredSlots: z.array(z.enum(["day", "time", "duration", "target"])),
58+
optionalSlots: z.array(z.enum(["day", "time", "duration", "target"])).optional(),
59+
intentKind: z.enum(["plan", "edit"])
60+
});
61+
62+
export type WriteContract = z.infer<typeof writeContractSchema>;
63+
4764
export const discourseStateSchema = z.object({
4865
focus_entity_id: z.string().min(1).nullable(),
4966
currently_editable_entity_id: z.string().min(1).nullable(),
5067
last_user_mentioned_entity_ids: z.array(z.string().min(1)),
5168
last_presented_items: z.array(presentedItemSchema),
5269
pending_clarifications: z.array(pendingClarificationSchema),
70+
resolved_slots: resolvedSlotsSchema.optional(),
71+
pending_write_contract: writeContractSchema.optional(),
5372
mode: conversationModeSchema
5473
});
5574

@@ -140,6 +159,7 @@ export function createEmptyDiscourseState(): DiscourseState {
140159
last_user_mentioned_entity_ids: [],
141160
last_presented_items: [],
142161
pending_clarifications: [],
162+
resolved_slots: {},
143163
mode: "planning"
144164
});
145165
}

packages/core/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,7 @@ const conversationEntityBaseSchema = z.object({
679679
id: z.string().min(1),
680680
conversationId: z.string().min(1),
681681
label: z.string().min(1),
682-
status: z.enum(["active", "resolved", "superseded"]),
682+
status: z.enum(["active", "presented", "confirmed", "resolved", "superseded"]),
683683
createdAt: z.string().datetime(),
684684
updatedAt: z.string().datetime()
685685
});

0 commit comments

Comments
 (0)