Circle V2 API Docs
    Preparing search index...

    Calendar / date-intent helpers shared by chart-review v2 and @repo/ai-agents. Includes pure logic, the LLM schema bridge, and framework-agnostic classify/ground helpers. Pipeline-local code is limited to LLM invocation adapters (extractDateIntentWithLLM in legacy, ExtractDateIntentPrompt in ai-agents).

    • Narrow the flat LLM output into a real DateIntent, validating through the discriminated union. An incoherent combination (e.g. rolling_days without n) degrades to unresolvable instead of throwing — the resolution stage treats that as "no window".

      Parameters

      • flat: PartialDateIntent

      Returns
          | { kind: "rolling_days"; n: number }
          | {
              cadence?: "per_day";
              kind: "calendar_week";
              subset?: "full" | "mon_fri" | "weekend";
              which: "last" | "current" | "most_recent_completed";
          }
          | {
              kind: "specific_weekday";
              weekday: | "sunday"
              | "monday"
              | "tuesday"
              | "wednesday"
              | "thursday"
              | "friday"
              | "saturday";
              which: "most_recent";
          }
          | {
              event: "session"
              | "admission"
              | "discharge"
              | "assessment"
              | "other";
              everyNDays?: number;
              kind: "since_event";
              withinHours?: number;
          }
          | { kind: "none" }
          | { kind: "unresolvable" }