Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/types/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
AddFactsPayload,
ConfigureSessionPayload,
CreateInteractionPayload,
DeviceLinkTokenResponse,
Fact,
KeycloakTokenResponse,
NavigatePayload,
Expand All @@ -27,11 +28,12 @@
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
Expand Down Expand Up @@ -91,6 +93,7 @@
setCredentials(payload: SetCredentialsPayload): Promise<void>;
getStatus(): Promise<GetStatusResponse>;
getTemplates(): Promise<GetTemplatesResponse>;
showDeviceLinkQR(payload: DeviceLinkTokenResponse): Promise<ShowDeviceLinkQRResponse>;
}
export interface CortiEmbeddedWindowAPI {
v1: CortiEmbeddedV1API;
Expand All @@ -99,7 +102,7 @@
// Extend Window interface
declare global {
interface Window {
CortiEmbedded?: CortiEmbeddedWindowAPI;

Check failure on line 105 in src/types/api.ts

View workflow job for this annotation

GitHub Actions / edge-integration

Subsequent property declarations must have the same type. Property 'CortiEmbedded' must be of type 'CortiEmbeddedWindowAPI | undefined', but here has type 'CortiEmbeddedWindowAPI | undefined'.

Check failure on line 105 in src/types/api.ts

View workflow job for this annotation

GitHub Actions / test

Subsequent property declarations must have the same type. Property 'CortiEmbedded' must be of type 'CortiEmbeddedWindowAPI | undefined', but here has type 'CortiEmbeddedWindowAPI | undefined'.

Check failure on line 105 in src/types/api.ts

View workflow job for this annotation

GitHub Actions / build

Subsequent property declarations must have the same type. Property 'CortiEmbedded' must be of type 'CortiEmbeddedWindowAPI | undefined', but here has type 'CortiEmbeddedWindowAPI | undefined'.

Check failure on line 105 in src/types/api.ts

View workflow job for this annotation

GitHub Actions / typecheck

Subsequent property declarations must have the same type. Property 'CortiEmbedded' must be of type 'CortiEmbeddedWindowAPI | undefined', but here has type 'CortiEmbeddedWindowAPI | undefined'.
}
}

Expand Down Expand Up @@ -212,4 +215,6 @@
* Hide the embedded UI
*/
hide(): void;

showDeviceLinkQR(payload: DeviceLinkTokenResponse): Promise<ShowDeviceLinkQRResponse>;
}
5 changes: 5 additions & 0 deletions src/types/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ export interface UIConfig {
navigation: boolean;
}

export interface CompanionAppConfig {
enabled: boolean;
}

export interface ConfigureFeaturesConfig {
interactionTitle: boolean;
aiChat: boolean;
Expand Down Expand Up @@ -42,6 +46,7 @@ export interface ConfigurePayload {
export interface ConfigureAppPayload {
debug?: boolean;
ui?: Partial<UIConfig>;
companionApp?: CompanionAppConfig;
appearance?: Partial<AppearanceConfig>;
locale?: Partial<LocaleConfig>;
network?: Partial<NetworkConfig>;
Expand Down
62 changes: 56 additions & 6 deletions src/types/payloads.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ export interface KeycloakTokenResponse {
};
}

export type DeviceLinkTokenResponse = KeycloakTokenResponse & { refresh_token: string };

// Fact structure
export interface Fact {
text: Corti.FactsCreateInput["text"];
Expand Down Expand Up @@ -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<string, unknown>;
}

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;
Expand Down Expand Up @@ -114,6 +163,7 @@ export interface InteractionDocumentOptions {
sync?: boolean;
};
allowedLanguages?: string[];
maxGenerated?: number | "unlimited";
}

export interface SetInteractionOptionsPayload {
Expand Down
10 changes: 8 additions & 2 deletions src/types/protocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ export type EmbeddedAction =
| "getStatus"
| "getTemplates"
| "configure"
| "setCredentials";
| "setCredentials"
| "showDeviceLinkQR";

export type DeprecatedEmbeddedEvent =
| "ready"
Expand Down Expand Up @@ -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";
Expand Down Expand Up @@ -186,7 +191,8 @@ export type AnyEmbeddedRequest =
| StopRecordingRequest
| GetStatusRequest
| ConfigureRequest
| SetCredentialsRequest;
| SetCredentialsRequest
| ShowDeviceLinkQRRequest;

export type AnyEmbeddedResponse = EmbeddedResponse;

Expand Down
6 changes: 6 additions & 0 deletions src/types/responses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import type {
AppearanceConfig,
CompanionAppConfig,
ConfigureFeaturesConfig,
LocaleConfig,
NetworkConfig,
Expand Down Expand Up @@ -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";
}
Loading