Skip to content

DeepTutor: Lifelong Personalized Tutoring. https://deeptutor.info/.

20.8 KB
Raw Blame
/* eslint-disable */
/**
 * This file was automatically generated by json-schema-to-typescript.
 * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
 * and run json-schema-to-typescript to regenerate this file.
 */

export type ClientCommand =
  | StartTurnCommand
  | SubscribeTurnCommand
  | SubscribeSessionCommand
  | ResumeTurnCommand
  | UnsubscribeCommand
  | CancelTurnCommand
  | RegenerateCommand
  | SubmitUserReplyCommand
  | UserInputCommand
  | CheckActiveTurnCommand
  | PingCommand;
export type AnswerBy = string | null;
export type Base64 = string | null;
export type Filename = string | null;
export type Id = string | null;
export type MimeType = string | null;
export type Type = string;
export type Url = string | null;
export type Attachments = OutgoingAttachment[];
export type AutoRoute = boolean | null;
export type BookId = string;
export type PageIds = string[];
export type BookReferences = BookReference[];
export type Capability = string | null;
export type CapabilityOnce = boolean;
export type ClientSubmissionId = string | null;
export type ConsultPartnerId = string | null;
export type Content = string;
export type FollowupQuestionContext = {
  [k: string]: unknown;
} | null;
export type HistoryReferences = string[];
export type KnowledgeBases = string[];
export type Language = string | null;
export type ModelId = string;
export type ProfileId = string;
export type Answers = {
  [k: string]: string;
} | null;
export type QuestionId = string;
export type Text = string;
export type MasteryPathId = string | null;
export type MasteryPathLeaseManaged = boolean;
export type MasterySessionMode = string | null;
export type QuestionId1 = string;
export type Mcp = string[];
export type MemoryReferences = (
  "recent" | "profile" | "scope" | "preferences" | "summary"
)[];
export type NoteDocumentId = string | null;
export type BlockId = string;
export type Kind = string;
export type NotebookId = string;
export type RecordIds = string[];
export type NotebookReferences = NotebookReference[];
export type ParentMessageId = number | null;
export type PartnerDiscussionGroupId = string | null;
export type PartnerGroupReferences = {
  [k: string]: unknown;
}[];
export type PersistUserMessage = boolean;
export type Persona = string | null;
export type PreserveSessionPreferences = boolean;
export type ProtocolVersion = "2.0";
export type QuestionNotebookReferences = number[];
export type ReadingMaterialId = string | null;
export type ReadingMaterialRevision = number | null;
export type Locators = number[];
export type MaterialId = string;
export type Revision = number;
export type ReadingReferences = ReadingReference[];
export type Locator = number | null;
export type Selection = string | null;
export type TimeSeconds = number | null;
export type ReadingWorkspaceId = string | null;
export type Regenerate = boolean;
export type RegeneratedFromMessageId = number | string | null;
export type ReplyLanguageOverride = string | null;
export type SelectionTutorContext = {
  [k: string]: unknown;
} | null;
export type SessionId = string | null;
export type Skills = string[];
export type SubagentConsultBudget = number | null;
export type SupersededTurnId = string | null;
export type TimedMediaId = string | null;
export type TimeSeconds1 = number;
export type Tools = string[] | null;
export type Type1 = "message" | "start_turn";
export type WorkspaceId = string | null;
export type WorkspaceMode = string | null;
export type AfterSeq = number;
export type ProtocolVersion1 = "2.0";
export type TurnId = string;
export type Type2 = "subscribe_turn";
export type AfterSeq1 = number;
export type ProtocolVersion2 = "2.0";
export type SessionId1 = string;
export type Type3 = "subscribe_session";
export type ProtocolVersion3 = "2.0";
export type Seq = number;
export type TurnId1 = string;
export type Type4 = "resume_from";
export type ProtocolVersion4 = "2.0";
export type SessionId2 = string | null;
export type TurnId2 = string | null;
export type Type5 = "unsubscribe";
export type CommandId = string;
export type ProtocolVersion5 = "2.0";
export type TurnId3 = string;
export type Type6 = "cancel_turn";
export type ProtocolVersion6 = "2.0";
export type SessionId3 = string;
export type Type7 = "regenerate";
export type Answers1 = UserAnswer[] | null;
export type Questionid = string;
export type Text1 = string;
export type CommandId1 = string;
export type ProtocolVersion7 = "2.0";
export type Text2 = string | null;
export type TurnId4 = string;
export type Type8 = "submit_user_reply";
export type CommandId2 = string;
export type Content1 = string;
export type ProtocolVersion8 = "2.0";
export type TurnId5 = string;
export type Type9 = "user_input";
export type Withdraw = string | null;
export type ProtocolVersion9 = "2.0";
export type SessionId4 = string;
export type Type10 = "check_active_turn";
export type ProtocolVersion10 = "2.0";
export type Type11 = "ping";
export type CorrelationId = string | null;
export type ErrorCode = string;
export type Message = string;
export type Retryable = boolean;
export type MinimumWebProtocolVersion = "2.0";
export type ProtocolVersion11 = "2.0";
export type CoordinationMode = "memory" | "redis";
export type LeaderHealthy = boolean | null;
export type LeaderId = string | null;
export type LeaseTtlSeconds = number;
export type MinimumWebProtocolVersion1 = "2.0";
export type OwnerTurnCount = number;
export type ProtocolVersion12 = "2.0";
export type RecoveryBacklog = number;
export type RecoveryIntervalSeconds = number;
export type RedisConfigured = boolean;
export type RedisStatus = "ok" | "unavailable" | "not_configured";
export type RenewIntervalSeconds = number;
export type WorkerCount = number;
export type WorkerId = string;
export type ServerEvent =
  | StreamEvent
  | ActiveTurnInfo
  | PongEvent
  | CommandAckEvent
  | ProtocolErrorEvent;
export type Content2 = string;
export type ProtocolVersion13 = "2.0";
export type Seq1 = number;
export type SessionId5 = string;
export type Source = string;
export type Stage = string;
export type Timestamp = number;
export type TurnId6 = string;
/**
 * This interface was referenced by `TurnProtocolDocument`'s JSON-Schema
 * via the `definition` "StreamEventType".
 */
export type StreamEventType =
  | "stage_start"
  | "stage_end"
  | "thinking"
  | "observation"
  | "content"
  | "tool_call"
  | "tool_result"
  | "progress"
  | "sources"
  | "result"
  | "error"
  | "session"
  | "session_meta"
  | "wait_for_input"
  | "done";
export type OwnerId = string;
export type ProtocolVersion14 = "2.0";
export type Status = TurnQueryState | "none";
/**
 * Client observation state, including server-side recovery windows.
 *
 * This interface was referenced by `TurnProtocolDocument`'s JSON-Schema
 * via the `definition` "TurnQueryState".
 */
export type TurnQueryState =
  | "queued"
  | "running"
  | "waiting_input"
  | "recovering"
  | "completed"
  | "failed"
  | "cancelled";
export type TurnId7 = string;
export type Type12 = "active_turn_info";
export type ProtocolVersion15 = "2.0";
export type Type13 = "pong";
export type Accepted = boolean;
export type CommandId3 = string;
export type CommandType = "cancel_turn" | "submit_user_reply" | "user_input";
export type ErrorCode1 = string;
export type Message1 = string;
export type ProtocolVersion16 = "2.0";
export type TurnId8 = string;
export type Type14 = "command_ack";
export type ErrorCode2 = string;
export type Message2 = string;
export type ProtocolVersion17 = "2.0";
export type Retryable1 = boolean;
export type SessionId6 = string;
export type TurnId9 = string;
export type Type15 = "protocol_error";
export type Capability1 = string;
export type CreatedAt = number | null;
export type Error = string;
/**
 * This interface was referenced by `TurnProtocolDocument`'s JSON-Schema
 * via the `definition` "TurnFailureCode".
 */
export type TurnFailureCode =
  | "worker_lost"
  | "lease_lost"
  | "coordination_unavailable"
  | "provider_error"
  | "internal_error"
  | "rejected"
  | "server_shutdown";
export type Id1 = string;
export type LastSeq = number;
export type OwnerId1 = string;
export type Retryable2 = boolean;
export type SessionId7 = string;
/**
 * This interface was referenced by `TurnProtocolDocument`'s JSON-Schema
 * via the `definition` "TurnStatus".
 */
export type TurnStatus =
  "queued" | "running" | "waiting_input" | "completed" | "failed" | "cancelled";
export type UpdatedAt = number | null;
export type CreatedAt1 = number | null;
export type Id2 = string;
export type Messages = {
  [k: string]: unknown;
}[];
export type Title = string;
export type UpdatedAt1 = number | null;
export type CreatedAt2 = number | null;
export type Id3 = string;
export type Title1 = string;
export type UpdatedAt2 = number | null;

export interface TurnProtocolDocument {
  client_command: ClientCommand;
  error: ErrorEnvelope;
  minimum_web_protocol_version?: MinimumWebProtocolVersion;
  protocol_version?: ProtocolVersion11;
  runtime_status: RuntimeStatus;
  server_event: ServerEvent;
  session_detail: SessionDetail;
  session_summary: SessionSummary;
}
/**
 * This interface was referenced by `TurnProtocolDocument`'s JSON-Schema
 * via the `definition` "StartTurnCommand".
 */
export interface StartTurnCommand {
  answer_by?: AnswerBy;
  attachments?: Attachments;
  auto_route?: AutoRoute;
  book_references?: BookReferences;
  capability?: Capability;
  capability_once?: CapabilityOnce;
  client_submission_id?: ClientSubmissionId;
  config?: Config;
  consult_partner_id?: ConsultPartnerId;
  content: Content;
  followup_question_context?: FollowupQuestionContext;
  history_references?: HistoryReferences;
  knowledge_bases?: KnowledgeBases;
  language?: Language;
  llm_selection?: LLMSelection | null;
  mastery_answer?: MasteryCardAnswer | null;
  mastery_path_id?: MasteryPathId;
  mastery_path_lease_managed?: MasteryPathLeaseManaged;
  mastery_session_mode?: MasterySessionMode;
  mastery_skip?: MasteryCardSkip | null;
  mcp?: Mcp;
  memory_references?: MemoryReferences;
  note_document_id?: NoteDocumentId;
  note_generation?: NoteGeneration | null;
  notebook_references?: NotebookReferences;
  parent_message_id?: ParentMessageId;
  partner_discussion_group_id?: PartnerDiscussionGroupId;
  partner_group_references?: PartnerGroupReferences;
  persist_user_message?: PersistUserMessage;
  persona?: Persona;
  preserve_session_preferences?: PreserveSessionPreferences;
  protocol_version: ProtocolVersion;
  question_notebook_references?: QuestionNotebookReferences;
  reading_material_id?: ReadingMaterialId;
  reading_material_revision?: ReadingMaterialRevision;
  reading_references?: ReadingReferences;
  reading_viewport?: ReadingViewport | null;
  reading_workspace_id?: ReadingWorkspaceId;
  regenerate?: Regenerate;
  regenerated_from_message_id?: RegeneratedFromMessageId;
  reply_language_override?: ReplyLanguageOverride;
  selection_tutor_context?: SelectionTutorContext;
  session_id?: SessionId;
  skills?: Skills;
  subagent_consult_budget?: SubagentConsultBudget;
  superseded_turn_id?: SupersededTurnId;
  timed_media_id?: TimedMediaId;
  timed_media_viewport?: TimedMediaViewport | null;
  tools?: Tools;
  type?: Type1;
  workspace_id?: WorkspaceId;
  workspace_mode?: WorkspaceMode;
}
/**
 * This interface was referenced by `TurnProtocolDocument`'s JSON-Schema
 * via the `definition` "OutgoingAttachment".
 */
export interface OutgoingAttachment {
  base64?: Base64;
  filename?: Filename;
  id?: Id;
  mime_type?: MimeType;
  type: Type;
  url?: Url;
}
/**
 * This interface was referenced by `TurnProtocolDocument`'s JSON-Schema
 * via the `definition` "BookReference".
 */
export interface BookReference {
  book_id: BookId;
  page_ids?: PageIds;
}
export interface Config {
  [k: string]: unknown;
}
/**
 * This interface was referenced by `TurnProtocolDocument`'s JSON-Schema
 * via the `definition` "LLMSelection".
 */
export interface LLMSelection {
  model_id: ModelId;
  profile_id: ProfileId;
}
/**
 * An answer submitted from a mastery question card.
 *
 * The card outlives the turn that posed it — posing a question ends that
 * turn — so the answer arrives as the next turn's message. This says which
 * question the message is answering, letting the runtime commit it to the
 * engine before the tutor's first token instead of asking the model to
 * recover the pairing from prose.
 *
 * This interface was referenced by `TurnProtocolDocument`'s JSON-Schema
 * via the `definition` "MasteryCardAnswer".
 */
export interface MasteryCardAnswer {
  answers?: Answers;
  question_id: QuestionId;
  text: Text;
}
/**
 * A question the learner dropped instead of answering.
 *
 * The same shape of problem as :class:`MasteryCardAnswer`: the card outlives
 * the turn that posed it, so "not this one" also arrives as the next turn's
 * message. Naming the question is what keeps the runtime from abandoning
 * whatever happens to be open by the time the turn starts.
 *
 * This interface was referenced by `TurnProtocolDocument`'s JSON-Schema
 * via the `definition` "MasteryCardSkip".
 */
export interface MasteryCardSkip {
  question_id: QuestionId1;
}
/**
 * The learning block on the open note page this turn fills in.
 *
 * Sent by the note companion when a block's own "Generate" runs. The server
 * owns the instructions that follow from it, so the learner's message stays
 * exactly what they see in the conversation.
 *
 * This interface was referenced by `TurnProtocolDocument`'s JSON-Schema
 * via the `definition` "NoteGeneration".
 */
export interface NoteGeneration {
  block_id: BlockId;
  kind?: Kind;
}
/**
 * This interface was referenced by `TurnProtocolDocument`'s JSON-Schema
 * via the `definition` "NotebookReference".
 */
export interface NotebookReference {
  notebook_id: NotebookId;
  record_ids?: RecordIds;
}
/**
 * This interface was referenced by `TurnProtocolDocument`'s JSON-Schema
 * via the `definition` "ReadingReference".
 */
export interface ReadingReference {
  locators?: Locators;
  material_id: MaterialId;
  revision: Revision;
}
/**
 * This interface was referenced by `TurnProtocolDocument`'s JSON-Schema
 * via the `definition` "ReadingViewport".
 */
export interface ReadingViewport {
  locator?: Locator;
  selection?: Selection;
  time_seconds?: TimeSeconds;
}
/**
 * This interface was referenced by `TurnProtocolDocument`'s JSON-Schema
 * via the `definition` "TimedMediaViewport".
 */
export interface TimedMediaViewport {
  time_seconds: TimeSeconds1;
}
/**
 * This interface was referenced by `TurnProtocolDocument`'s JSON-Schema
 * via the `definition` "SubscribeTurnCommand".
 */
export interface SubscribeTurnCommand {
  after_seq?: AfterSeq;
  protocol_version: ProtocolVersion1;
  turn_id: TurnId;
  type?: Type2;
}
/**
 * This interface was referenced by `TurnProtocolDocument`'s JSON-Schema
 * via the `definition` "SubscribeSessionCommand".
 */
export interface SubscribeSessionCommand {
  after_seq?: AfterSeq1;
  protocol_version: ProtocolVersion2;
  session_id: SessionId1;
  type?: Type3;
}
/**
 * This interface was referenced by `TurnProtocolDocument`'s JSON-Schema
 * via the `definition` "ResumeTurnCommand".
 */
export interface ResumeTurnCommand {
  protocol_version: ProtocolVersion3;
  seq?: Seq;
  turn_id: TurnId1;
  type?: Type4;
}
/**
 * This interface was referenced by `TurnProtocolDocument`'s JSON-Schema
 * via the `definition` "UnsubscribeCommand".
 */
export interface UnsubscribeCommand {
  protocol_version: ProtocolVersion4;
  session_id?: SessionId2;
  turn_id?: TurnId2;
  type?: Type5;
}
/**
 * This interface was referenced by `TurnProtocolDocument`'s JSON-Schema
 * via the `definition` "CancelTurnCommand".
 */
export interface CancelTurnCommand {
  command_id: CommandId;
  protocol_version: ProtocolVersion5;
  turn_id: TurnId3;
  type?: Type6;
}
/**
 * This interface was referenced by `TurnProtocolDocument`'s JSON-Schema
 * via the `definition` "RegenerateCommand".
 */
export interface RegenerateCommand {
  overrides?: Overrides;
  protocol_version: ProtocolVersion6;
  session_id: SessionId3;
  type?: Type7;
}
export interface Overrides {
  [k: string]: unknown;
}
/**
 * This interface was referenced by `TurnProtocolDocument`'s JSON-Schema
 * via the `definition` "SubmitUserReplyCommand".
 */
export interface SubmitUserReplyCommand {
  answers?: Answers1;
  command_id: CommandId1;
  protocol_version: ProtocolVersion7;
  text?: Text2;
  turn_id: TurnId4;
  type?: Type8;
}
/**
 * This interface was referenced by `TurnProtocolDocument`'s JSON-Schema
 * via the `definition` "UserAnswer".
 */
export interface UserAnswer {
  questionId: Questionid;
  text?: Text1;
}
/**
 * A message for a turn that is still running, read at its next step.
 *
 * This interface was referenced by `TurnProtocolDocument`'s JSON-Schema
 * via the `definition` "UserInputCommand".
 */
export interface UserInputCommand {
  command_id: CommandId2;
  content: Content1;
  protocol_version: ProtocolVersion8;
  turn_id: TurnId5;
  type?: Type9;
  withdraw?: Withdraw;
}
/**
 * This interface was referenced by `TurnProtocolDocument`'s JSON-Schema
 * via the `definition` "CheckActiveTurnCommand".
 */
export interface CheckActiveTurnCommand {
  protocol_version: ProtocolVersion9;
  session_id: SessionId4;
  type?: Type10;
}
/**
 * This interface was referenced by `TurnProtocolDocument`'s JSON-Schema
 * via the `definition` "PingCommand".
 */
export interface PingCommand {
  protocol_version: ProtocolVersion10;
  type?: Type11;
}
/**
 * This interface was referenced by `TurnProtocolDocument`'s JSON-Schema
 * via the `definition` "ErrorEnvelope".
 */
export interface ErrorEnvelope {
  correlation_id?: CorrelationId;
  error_code: ErrorCode;
  message: Message;
  retryable?: Retryable;
}
/**
 * This interface was referenced by `TurnProtocolDocument`'s JSON-Schema
 * via the `definition` "RuntimeStatus".
 */
export interface RuntimeStatus {
  coordination_mode: CoordinationMode;
  leader_healthy?: LeaderHealthy;
  leader_id?: LeaderId;
  lease_ttl_seconds: LeaseTtlSeconds;
  minimum_web_protocol_version?: MinimumWebProtocolVersion1;
  owner_turn_count?: OwnerTurnCount;
  protocol_version?: ProtocolVersion12;
  recovery_backlog?: RecoveryBacklog;
  recovery_interval_seconds: RecoveryIntervalSeconds;
  redis_configured: RedisConfigured;
  redis_status: RedisStatus;
  renew_interval_seconds: RenewIntervalSeconds;
  worker_count: WorkerCount;
  worker_id: WorkerId;
}
/**
 * This interface was referenced by `TurnProtocolDocument`'s JSON-Schema
 * via the `definition` "StreamEvent".
 */
export interface StreamEvent {
  content?: Content2;
  metadata?: Metadata;
  protocol_version?: ProtocolVersion13;
  seq?: Seq1;
  session_id?: SessionId5;
  source?: Source;
  stage?: Stage;
  timestamp: Timestamp;
  turn_id?: TurnId6;
  type: StreamEventType;
}
export interface Metadata {
  [k: string]: unknown;
}
/**
 * This interface was referenced by `TurnProtocolDocument`'s JSON-Schema
 * via the `definition` "ActiveTurnInfo".
 */
export interface ActiveTurnInfo {
  owner_id?: OwnerId;
  protocol_version?: ProtocolVersion14;
  status?: Status;
  turn_id?: TurnId7;
  type?: Type12;
}
/**
 * This interface was referenced by `TurnProtocolDocument`'s JSON-Schema
 * via the `definition` "PongEvent".
 */
export interface PongEvent {
  protocol_version?: ProtocolVersion15;
  type?: Type13;
}
/**
 * This interface was referenced by `TurnProtocolDocument`'s JSON-Schema
 * via the `definition` "CommandAckEvent".
 */
export interface CommandAckEvent {
  accepted: Accepted;
  command_id: CommandId3;
  command_type: CommandType;
  error_code?: ErrorCode1;
  message?: Message1;
  protocol_version?: ProtocolVersion16;
  turn_id?: TurnId8;
  type?: Type14;
}
/**
 * This interface was referenced by `TurnProtocolDocument`'s JSON-Schema
 * via the `definition` "ProtocolErrorEvent".
 */
export interface ProtocolErrorEvent {
  error_code: ErrorCode2;
  message: Message2;
  protocol_version?: ProtocolVersion17;
  retryable?: Retryable1;
  session_id?: SessionId6;
  turn_id?: TurnId9;
  type?: Type15;
}
/**
 * This interface was referenced by `TurnProtocolDocument`'s JSON-Schema
 * via the `definition` "SessionDetail".
 */
export interface SessionDetail {
  active_turn?: TurnSummary | null;
  created_at?: CreatedAt1;
  id: Id2;
  messages?: Messages;
  preferences?: Preferences;
  title: Title;
  updated_at?: UpdatedAt1;
}
/**
 * This interface was referenced by `TurnProtocolDocument`'s JSON-Schema
 * via the `definition` "TurnSummary".
 */
export interface TurnSummary {
  capability?: Capability1;
  created_at?: CreatedAt;
  error?: Error;
  error_code?: TurnFailureCode | null;
  id: Id1;
  last_seq?: LastSeq;
  owner_id?: OwnerId1;
  query_state?: TurnQueryState | null;
  retryable?: Retryable2;
  session_id: SessionId7;
  status: TurnStatus;
  updated_at?: UpdatedAt;
}
export interface Preferences {
  [k: string]: unknown;
}
/**
 * This interface was referenced by `TurnProtocolDocument`'s JSON-Schema
 * via the `definition` "SessionSummary".
 */
export interface SessionSummary {
  active_turn?: TurnSummary | null;
  created_at?: CreatedAt2;
  id: Id3;
  title: Title1;
  updated_at?: UpdatedAt2;
}