diff --git a/src/types/api.ts b/src/types/api.ts index a7175d2..7cdb1c0 100644 --- a/src/types/api.ts +++ b/src/types/api.ts @@ -13,6 +13,7 @@ import type { AddFactsPayload, ConfigureSessionPayload, CreateInteractionPayload, + DeviceLinkTokenResponse, Fact, KeycloakTokenResponse, NavigatePayload, @@ -27,11 +28,12 @@ import type { CreateInteractionResponse, GetStatusResponse, GetTemplatesResponse, + ShowDeviceLinkQRResponse, } from "./responses.js"; export type { ConfigureAppPayload, ConfigurePayload } from "./config.js"; // Re-export common types for public API -export type { UserInfo } from "./responses.js"; +export type { ShowDeviceLinkQRResponse, UserInfo } from "./responses.js"; /** * User information returned from authentication @@ -91,6 +93,7 @@ export interface CortiEmbeddedV1API { setCredentials(payload: SetCredentialsPayload): Promise; getStatus(): Promise; getTemplates(): Promise; + showDeviceLinkQR(payload: DeviceLinkTokenResponse): Promise; } export interface CortiEmbeddedWindowAPI { v1: CortiEmbeddedV1API; @@ -212,4 +215,6 @@ export interface CortiEmbeddedAPI { * Hide the embedded UI */ hide(): void; + + showDeviceLinkQR(payload: DeviceLinkTokenResponse): Promise; } diff --git a/src/types/config.ts b/src/types/config.ts index 68ec05c..f1e8d80 100644 --- a/src/types/config.ts +++ b/src/types/config.ts @@ -11,6 +11,10 @@ export interface UIConfig { navigation: boolean; } +export interface CompanionAppConfig { + enabled: boolean; +} + export interface ConfigureFeaturesConfig { interactionTitle: boolean; aiChat: boolean; @@ -42,6 +46,7 @@ export interface ConfigurePayload { export interface ConfigureAppPayload { debug?: boolean; ui?: Partial; + companionApp?: CompanionAppConfig; appearance?: Partial; locale?: Partial; network?: Partial; diff --git a/src/types/payloads.ts b/src/types/payloads.ts index eb31ae4..6d94752 100644 --- a/src/types/payloads.ts +++ b/src/types/payloads.ts @@ -22,6 +22,8 @@ export interface KeycloakTokenResponse { }; } +export type DeviceLinkTokenResponse = KeycloakTokenResponse & { refresh_token: string }; + // Fact structure export interface Fact { text: Corti.FactsCreateInput["text"]; @@ -64,27 +66,74 @@ export interface ConfigureSessionPayload { } export interface InteractionModeOptions { - fallback: DefaultMode; + fallback?: DefaultMode; options: DefaultMode[]; } export interface SpokenLanguageOptions { - fallback: string; + fallback?: string; + options?: string[]; +} + +export interface InlineTemplateLabel { + key: string; + value: string; +} + +export interface InlineTemplateSectionInstructions { + contentPrompt: string; + writingStylePrompt?: string; + miscPrompt?: string; +} + +export interface InlineTemplateSection { + heading: string; + labels?: InlineTemplateLabel[]; + instructions: InlineTemplateSectionInstructions; + outputSchema?: Record; +} + +export interface InlineTemplate { + id?: string; + name: string; + labels?: InlineTemplateLabel[]; + generation: { + instructions: { + prompt: string; + }; + sections: InlineTemplateSection[]; + }; } export interface InteractionTemplateReference { - source: "standard"; + source: "standard" | "project"; id: string; } export interface DefaultInteractionTemplateOptions { - behaviour: "fallback"; - template: InteractionTemplateReference; + behaviour?: "fallback"; + template?: InteractionTemplateReference; + allowUserSelection?: boolean; +} + +export interface PersonalTemplateSectionFieldConfig { + visible?: boolean; + editable?: boolean; +} + +export interface PersonalTemplateSectionFields { + heading?: { editable?: boolean }; + description?: { editable?: boolean }; + contentPrompt?: PersonalTemplateSectionFieldConfig; + writingStylePrompt?: PersonalTemplateSectionFieldConfig; + miscPrompt?: PersonalTemplateSectionFieldConfig; + outputSchema?: PersonalTemplateSectionFieldConfig; } export interface InteractionTemplateSources { personal?: { - enabled: boolean; + enabled?: boolean; + sectionFields?: PersonalTemplateSectionFields; }; standard?: { enabled?: boolean; @@ -114,6 +163,7 @@ export interface InteractionDocumentOptions { sync?: boolean; }; allowedLanguages?: string[]; + maxGenerated?: number | "unlimited"; } export interface SetInteractionOptionsPayload { diff --git a/src/types/protocol.ts b/src/types/protocol.ts index 8f9574e..fd90f6b 100644 --- a/src/types/protocol.ts +++ b/src/types/protocol.ts @@ -19,7 +19,8 @@ export type EmbeddedAction = | "getStatus" | "getTemplates" | "configure" - | "setCredentials"; + | "setCredentials" + | "showDeviceLinkQR"; export type DeprecatedEmbeddedEvent = | "ready" @@ -127,6 +128,10 @@ export interface SetCredentialsRequest extends EmbeddedRequest { action: "setCredentials"; } +export interface ShowDeviceLinkQRRequest extends EmbeddedRequest { + action: "showDeviceLinkQR"; +} + // Event Types export interface ReadyEvent extends DeprecatedEmbeddedEventMessage { event: "ready"; @@ -186,7 +191,8 @@ export type AnyEmbeddedRequest = | StopRecordingRequest | GetStatusRequest | ConfigureRequest - | SetCredentialsRequest; + | SetCredentialsRequest + | ShowDeviceLinkQRRequest; export type AnyEmbeddedResponse = EmbeddedResponse; diff --git a/src/types/responses.ts b/src/types/responses.ts index 0821d43..3b93bdc 100644 --- a/src/types/responses.ts +++ b/src/types/responses.ts @@ -2,6 +2,7 @@ import type { AppearanceConfig, + CompanionAppConfig, ConfigureFeaturesConfig, LocaleConfig, NetworkConfig, @@ -75,6 +76,11 @@ export interface ConfigureAppResponse { debug?: boolean; appearance: AppearanceConfig; ui: UIConfig; + companionApp: CompanionAppConfig; locale: LocaleConfig; network: NetworkConfig; } + +export interface ShowDeviceLinkQRResponse { + status: "approved" | "denied" | "expired" | "dismissed"; +}