@genesislcap/foundation-ai 14.409.0-FUI-2495.2 → 14.409.0-FUI-2495.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dts/ai-provider.d.ts +10 -2
- package/dist/dts/ai-provider.d.ts.map +1 -1
- package/dist/dts/index.d.ts +3 -2
- package/dist/dts/index.d.ts.map +1 -1
- package/dist/dts/providers/gemini-provider.d.ts +1 -0
- package/dist/dts/providers/gemini-provider.d.ts.map +1 -1
- package/dist/dts/transports/gemini-transport.d.ts +6 -5
- package/dist/dts/transports/gemini-transport.d.ts.map +1 -1
- package/dist/dts/types/chat.types.d.ts +37 -0
- package/dist/dts/types/chat.types.d.ts.map +1 -1
- package/dist/dts/types/config.types.d.ts +10 -1
- package/dist/dts/types/config.types.d.ts.map +1 -1
- package/dist/esm/ai-provider.js +8 -3
- package/dist/esm/index.js +1 -0
- package/dist/esm/providers/gemini-provider.js +6 -0
- package/dist/esm/transports/gemini-transport.js +29 -10
- package/dist/esm/types/config.types.js +5 -1
- package/dist/foundation-ai.api.json +292 -6
- package/dist/foundation-ai.d.ts +65 -6
- package/package.json +11 -11
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CriteriaInterpretContext } from './interactions';
|
|
2
|
-
import type
|
|
2
|
+
import { type AIConfig, type AIStatus, type CriteriaInterpretationResult } from './types';
|
|
3
3
|
import type { ChatMessage, ChatRequestOptions, ChatStreamChunk } from './types/chat.types';
|
|
4
4
|
/**
|
|
5
5
|
* AI Provider interface for foundation-ai.
|
|
@@ -21,6 +21,14 @@ export interface AIProvider {
|
|
|
21
21
|
* Must be called from a user gesture (e.g. click).
|
|
22
22
|
*/
|
|
23
23
|
triggerDownload?(): Promise<void>;
|
|
24
|
+
/**
|
|
25
|
+
* Stateless one-off prompt. No conversation history is maintained.
|
|
26
|
+
* Returns the plain text response.
|
|
27
|
+
* Use this for side-calls (suggestions, summarisation, classification) that
|
|
28
|
+
* should not interact with any ongoing conversation context.
|
|
29
|
+
* Providers that support chat implement this.
|
|
30
|
+
*/
|
|
31
|
+
prompt?(message: string, options?: ChatRequestOptions): Promise<string>;
|
|
24
32
|
/**
|
|
25
33
|
* Multi-turn chat (non-streaming). Returns the assistant's response message.
|
|
26
34
|
* Providers that support chat (Gemini, OpenAI) implement this.
|
|
@@ -50,7 +58,7 @@ export declare function createAIProvider(config?: AIConfig | null): AIProvider;
|
|
|
50
58
|
export interface ResolveAIConfigOptions {
|
|
51
59
|
/** Cloud provider (openai, gemini). Default: openai */
|
|
52
60
|
provider?: 'openai' | 'gemini';
|
|
53
|
-
/** Model name
|
|
61
|
+
/** Model name. OpenAI default: gpt-4o-mini. Gemini: only {@link SUPPORTED_GEMINI_MODEL_IDS} (default flash-lite). */
|
|
54
62
|
model?: string;
|
|
55
63
|
/** Prefer Chrome built-in AI when available */
|
|
56
64
|
preferChrome?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai-provider.d.ts","sourceRoot":"","sources":["../../src/ai-provider.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAQ/D,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"ai-provider.d.ts","sourceRoot":"","sources":["../../src/ai-provider.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAQ/D,OAAO,EAEL,KAAK,QAAQ,EACb,KAAK,QAAQ,EAEb,KAAK,4BAA4B,EAIlC,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,EAAE,WAAW,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAI3F;;;;;;;;GAQG;AACH,MAAM,WAAW,UAAU;IACzB,iBAAiB,CAAC,CAChB,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,wBAAwB,GAChC,OAAO,CAAC,4BAA4B,GAAG,IAAI,CAAC,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getAIProvider, resolveAIConfig } from './
|
|
|
2
2
|
export { GeminiProvider } from './providers/gemini-provider';
|
|
3
3
|
export { GeminiTransport, MalformedFunctionCallError } from './transports/gemini-transport';
|
|
4
4
|
export { AI_FEATURE_FLAG, isAIFeatureEnabled } from './utils/feature-flags';
|
|
5
|
-
export
|
|
6
|
-
export type {
|
|
5
|
+
export { SUPPORTED_GEMINI_MODEL_IDS } from './types';
|
|
6
|
+
export type { AIConfig, AIStatus, AIProviderType, ChromeAIConfig, ChromeAvailability, GeminiAIConfig, GeminiModelId, ServerAIConfig, } from './types';
|
|
7
|
+
export type { ChatAgentConfig, ChatAnimationsConfig, ChatAttachment, ChatConfig, ChatDriverResult, ChatMessage, ChatInteraction, ChatRequestOptions, ChatRole, ChatStreamChunk, ChatToolCall, ChatToolDefinition, ChatToolHandlers, ChatToolResult, ChatUiConfig, ChatSuggestionsConfig, InteractionResult, } from './types/chat.types';
|
|
7
8
|
export type { ChatTransport } from './types/chat-transport.types';
|
|
8
9
|
export type { ResolveAIConfigOptions } from './ai-provider';
|
|
9
10
|
export type { CriteriaInterpretContext, FieldLike } from './interactions';
|
package/dist/dts/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAC7F,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AAC5F,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC5E,YAAY,EACV,QAAQ,EACR,QAAQ,EACR,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,cAAc,EACd,cAAc,GACf,MAAM,SAAS,CAAC;AACjB,YAAY,EACV,eAAe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AChB,cAAc,EACd,YAAY,EACZ,qBAAqB,EACrB,iBAAiB,GAClB,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAClE,YAAY,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAC5D,YAAY,EAAE,wBAAwB,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC1E,YAAY,EACV,oBAAoB,EACpB,mBAAmB,EACnB,4BAA4B,GAC7B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,4BAA4B,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC"}
|
|
@@ -19,6 +19,7 @@ export declare class GeminiProvider implements AIProvider {
|
|
|
19
19
|
constructor(config: GeminiProviderConfig, transport: GeminiTransport);
|
|
20
20
|
getStatus(): Promise<AIStatus>;
|
|
21
21
|
interpretCriteria(input: string, context: CriteriaInterpretContext): Promise<CriteriaInterpretationResult | null>;
|
|
22
|
+
prompt(message: string, options?: ChatRequestOptions): Promise<string>;
|
|
22
23
|
chat(history: ChatMessage[], userMessage: string, options?: ChatRequestOptions): Promise<ChatMessage>;
|
|
23
24
|
streamChat(history: ChatMessage[], userMessage: string, options?: ChatRequestOptions): AsyncIterable<ChatStreamChunk>;
|
|
24
25
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gemini-provider.d.ts","sourceRoot":"","sources":["../../../src/providers/gemini-provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAOhE,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,KAAK,EAAE,WAAW,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC5F,OA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nC,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED;;;;;GAKG;AACH,qBAAa,cAAe,YAAW,UAAU;IAC/C,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAkB;IAC5C,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAAC,CAAS;gBAEnC,MAAM,EAAE,oBAAoB,EAAE,SAAS,EAAE,eAAe;IAK9D,SAAS,IAAI,OAAO,CAAC,QAAQ,CAAC;IAK9B,iBAAiB,CACrB,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,wBAAwB,GAChC,OAAO,CAAC,4BAA4B,GAAG,IAAI,CAAC;IAkBzC,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC;IAKtE,IAAI,CACR,OAAO,EAAE,WAAW,EAAE,EACtB,WAAW,EAAE,MAAM,EACnB,OAAO,CAAC,EAAE,kBAAkB,GAC3B,OAAO,CAAC,WAAW,CAAC;IAIhB,UAAU,CACf,OAAO,EAAE,WAAW,EAAE,EACtB,WAAW,EAAE,MAAM,EACnB,OAAO,CAAC,EAAE,kBAAkB,GAC3B,aAAa,CAAC,eAAe,CAAC;CAYlC"}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type AITransport, type GeminiModelId, type StructuredPromptOptions } from '../types';
|
|
2
2
|
import type { ChatTransport } from '../types/chat-transport.types';
|
|
3
3
|
import type { ChatMessage, ChatRequestOptions } from '../types/chat.types';
|
|
4
4
|
export interface GeminiTransportConfig {
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Defaults to `gemini-2.5-flash-lite`. Only {@link SUPPORTED_GEMINI_MODEL_IDS} are accepted.
|
|
7
|
+
*/
|
|
8
|
+
model?: GeminiModelId;
|
|
6
9
|
timeout?: number;
|
|
7
10
|
/**
|
|
8
11
|
* API key for direct calls to the Gemini API.
|
|
@@ -45,13 +48,11 @@ export declare class GeminiTransport implements AITransport, ChatTransport {
|
|
|
45
48
|
constructor(config?: GeminiTransportConfig);
|
|
46
49
|
getConfig(): {
|
|
47
50
|
provider: 'gemini';
|
|
48
|
-
model:
|
|
51
|
+
model: GeminiModelId;
|
|
49
52
|
};
|
|
50
53
|
sendStructuredPrompt(options: StructuredPromptOptions): Promise<string>;
|
|
51
54
|
sendChatMessage(history: ChatMessage[], userMessage: string, options?: ChatRequestOptions): Promise<ChatMessage>;
|
|
52
55
|
private static readonly TOKENS_PER_MILLION;
|
|
53
|
-
private static readonly PROMPT_COST_PER_MILLION;
|
|
54
|
-
private static readonly CANDIDATE_COST_PER_MILLION;
|
|
55
56
|
private static readonly COST_DECIMAL_PLACES;
|
|
56
57
|
private logTokenUsage;
|
|
57
58
|
private toGeminiContents;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gemini-transport.d.ts","sourceRoot":"","sources":["../../../src/transports/gemini-transport.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"gemini-transport.d.ts","sourceRoot":"","sources":["../../../src/transports/gemini-transport.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,uBAAuB,EAC7B,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,KAAK,EAEV,WAAW,EACX,kBAAkB,EAEnB,MAAM,qBAAqB,CAAC;AA6B7B,MAAM,WAAW,qBAAqB;IACpC;;OAEG;IACH,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAUD;;;;;;GAMG;AACH,qBAAa,0BAA2B,SAAQ,KAAK;IACvC,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM;gBAAtB,aAAa,CAAC,EAAE,MAAM;CAI5C;AAED;;;;;;;;GAQG;AACH,qBAAa,eAAgB,YAAW,WAAW,EAAE,aAAa;IAChE,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAgB;IACtC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAqB;IAC5C,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAqB;gBAExC,MAAM,GAAE,qBAA0B;IAe9C,SAAS,IAAI;QAAE,QAAQ,EAAE,QAAQ,CAAC;QAAC,KAAK,EAAE,aAAa,CAAA;KAAE;IAMnD,oBAAoB,CAAC,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC,MAAM,CAAC;IAgBvE,eAAe,CACnB,OAAO,EAAE,WAAW,EAAE,EACtB,WAAW,EAAE,MAAM,EACnB,OAAO,CAAC,EAAE,kBAAkB,GAC3B,OAAO,CAAC,WAAW,CAAC;IA4BvB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,kBAAkB,CAAa;IACvD,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,mBAAmB,CAAK;IAEhD,OAAO,CAAC,aAAa;IAoBrB,OAAO,CAAC,gBAAgB;IAgDxB,OAAO,CAAC,kBAAkB;IAwD1B,OAAO,CAAC,aAAa;IAyBrB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAK;IACxC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,iBAAiB,CAAO;IAChD,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,eAAe,CAAQ;YAEjC,IAAI;IAgDlB,OAAO,CAAC,eAAe;CAexB"}
|
|
@@ -165,6 +165,12 @@ export interface ChatUiConfig {
|
|
|
165
165
|
loadingDelay?: number;
|
|
166
166
|
/** Animations feature configuration. */
|
|
167
167
|
animations?: ChatAnimationsConfig;
|
|
168
|
+
/**
|
|
169
|
+
* When `true`, shows the `slot="splash"` content when there are no messages.
|
|
170
|
+
* The host element reflects a `showing-splash` boolean attribute that consumers
|
|
171
|
+
* can use as a CSS hook to animate the splash in and out. Default: `false`.
|
|
172
|
+
*/
|
|
173
|
+
showSplash?: boolean;
|
|
168
174
|
/**
|
|
169
175
|
* Show an inline divider in the message list when the active specialist changes.
|
|
170
176
|
* Also shown automatically when showToolCalls is true.
|
|
@@ -199,5 +205,36 @@ export interface ChatConfig {
|
|
|
199
205
|
ui?: ChatUiConfig;
|
|
200
206
|
/** Agent engine settings — iteration limits, handoff caps, classifier tuning. */
|
|
201
207
|
agent?: ChatAgentConfig;
|
|
208
|
+
/** Query suggestions feature configuration. */
|
|
209
|
+
suggestions?: ChatSuggestionsConfig;
|
|
202
210
|
}
|
|
211
|
+
/**
|
|
212
|
+
* Configuration for the chat suggestions feature.
|
|
213
|
+
*
|
|
214
|
+
* @beta
|
|
215
|
+
*/
|
|
216
|
+
export type ChatSuggestionsConfig = {
|
|
217
|
+
/** Suggestions are disabled. */
|
|
218
|
+
behavior: 'never';
|
|
219
|
+
/** Not applicable when behavior is 'never'. */
|
|
220
|
+
count?: never;
|
|
221
|
+
/** Not applicable when behavior is 'never'. */
|
|
222
|
+
prompt?: never;
|
|
223
|
+
} | {
|
|
224
|
+
/**
|
|
225
|
+
* 'initial': Show suggestions on first load before any messages are sent.
|
|
226
|
+
* 'always': Show suggestions after every assistant response.
|
|
227
|
+
*/
|
|
228
|
+
behavior: 'initial' | 'always';
|
|
229
|
+
/**
|
|
230
|
+
* Number of suggestions to generate.
|
|
231
|
+
* @default 3
|
|
232
|
+
*/
|
|
233
|
+
count?: number;
|
|
234
|
+
/**
|
|
235
|
+
* Custom prompt to steer the suggestion generation. If omitted, a
|
|
236
|
+
* default prompt is used.
|
|
237
|
+
*/
|
|
238
|
+
prompt?: string;
|
|
239
|
+
};
|
|
203
240
|
//# sourceMappingURL=chat.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat.types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C,EAAE,MAAM,CAAC;IACtB,wCAAwC;IACxC,UAAU,CAAC,EAAE,oBAAoB,CAAC;IAClC;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;;;OAMG;IACH,wBAAwB,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;CAC3C;AAED;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B,mFAAmF;IACnF,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,2EAA2E;IAC3E,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kFAAkF;IAClF,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,2EAA2E;IAC3E,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED;;;;GAIG;AACH,MAAM,WAAW,UAAU;IACzB,mEAAmE;IACnE,EAAE,CAAC,EAAE,YAAY,CAAC;IAClB,iFAAiF;IACjF,KAAK,CAAC,EAAE,eAAe,CAAC;IACxB,+CAA+C;IAC/C,WAAW,CAAC,EAAE,qBAAqB,CAAC;CACrC;AAED;;;;GAIG;AACH,MAAM,MAAM,qBAAqB,GAC7B;IACE,gCAAgC;IAChC,QAAQ,EAAE,OAAO,CAAC;IAClB,+CAA+C;IAC/C,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,+CAA+C;IAC/C,MAAM,CAAC,EAAE,KAAK,CAAC;CAChB,GACD;IACE;;;OAGG;IACH,QAAQ,EAAE,SAAS,GAAG,QAAQ,CAAC;IAC/B;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC"}
|
|
@@ -4,6 +4,14 @@
|
|
|
4
4
|
* @beta
|
|
5
5
|
*/
|
|
6
6
|
export type AIProviderType = 'openai' | 'chrome' | 'gemini' | 'none';
|
|
7
|
+
/**
|
|
8
|
+
* Gemini REST model ids supported by {@link GeminiTransport}.
|
|
9
|
+
*
|
|
10
|
+
* @beta
|
|
11
|
+
*/
|
|
12
|
+
export type GeminiModelId = 'gemini-2.5-flash' | 'gemini-2.5-flash-lite';
|
|
13
|
+
/** @beta */
|
|
14
|
+
export declare const SUPPORTED_GEMINI_MODEL_IDS: readonly GeminiModelId[];
|
|
7
15
|
/**
|
|
8
16
|
* Base provider-level configuration.
|
|
9
17
|
*
|
|
@@ -56,7 +64,8 @@ export interface ChromeAIConfig extends AIProviderConfig {
|
|
|
56
64
|
*/
|
|
57
65
|
export interface GeminiAIConfig extends AIProviderConfig {
|
|
58
66
|
providerType: 'gemini';
|
|
59
|
-
|
|
67
|
+
/** Defaults to `gemini-2.5-flash-lite`. Only {@link SUPPORTED_GEMINI_MODEL_IDS} are accepted at runtime. */
|
|
68
|
+
model?: GeminiModelId;
|
|
60
69
|
serverEndpoint?: string;
|
|
61
70
|
apiKey?: string;
|
|
62
71
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.types.d.ts","sourceRoot":"","sources":["../../../src/types/config.types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,MAAM,CAAC;AAErE;;;;;;;;GAQG;AACH,MAAM,WAAW,gBAAgB;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gEAAgE;IAChE,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED,6DAA6D;AAC7D,MAAM,MAAM,oBAAoB,GAAG,OAAO,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAC;AAErE;;;;;;;;GAQG;AACH,MAAM,WAAW,cAAe,SAAQ,gBAAgB;IACtD,QAAQ,EAAE,oBAAoB,CAAC;CAChC;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,cAAe,SAAQ,gBAAgB;IACtD,YAAY,CAAC,EAAE,QAAQ,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM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;CACjB;AAED;;;;;GAKG;AACH,MAAM,MAAM,QAAQ,GAAG,cAAc,GAAG,cAAc,GAAG,cAAc,CAAC"}
|
package/dist/esm/ai-provider.js
CHANGED
|
@@ -7,6 +7,7 @@ import { OpenAIProvider } from './providers/openai-provider';
|
|
|
7
7
|
import { ChromePromptTransport } from './transports/chrome-prompt-transport';
|
|
8
8
|
import { GeminiTransport } from './transports/gemini-transport';
|
|
9
9
|
import { ServerOpenAITransport } from './transports/server-openai-transport';
|
|
10
|
+
import { SUPPORTED_GEMINI_MODEL_IDS, } from './types';
|
|
10
11
|
import { logger } from './utils';
|
|
11
12
|
import { isAIFeatureEnabled } from './utils/feature-flags';
|
|
12
13
|
function isChromeConfig(config) {
|
|
@@ -74,7 +75,7 @@ export function resolveAIConfig() {
|
|
|
74
75
|
logger.warn('resolveAIConfig: AI feature flag disabled');
|
|
75
76
|
return null;
|
|
76
77
|
}
|
|
77
|
-
const { provider = 'openai', model
|
|
78
|
+
const { provider = 'openai', model, preferChrome = true } = options;
|
|
78
79
|
if (preferChrome) {
|
|
79
80
|
const transport = new ChromePromptTransport();
|
|
80
81
|
const availability = yield transport.getAvailability();
|
|
@@ -86,9 +87,13 @@ export function resolveAIConfig() {
|
|
|
86
87
|
logger.warn('resolveAIConfig: Chrome not available', availability);
|
|
87
88
|
}
|
|
88
89
|
if (provider === 'gemini') {
|
|
89
|
-
|
|
90
|
+
const geminiModel = model !== null && model !== void 0 ? model : 'gemini-2.5-flash-lite';
|
|
91
|
+
if (!SUPPORTED_GEMINI_MODEL_IDS.includes(geminiModel)) {
|
|
92
|
+
throw new Error(`resolveAIConfig: unsupported Gemini model "${geminiModel}". Use one of: ${SUPPORTED_GEMINI_MODEL_IDS.join(', ')}.`);
|
|
93
|
+
}
|
|
94
|
+
return { providerType: 'gemini', model: geminiModel };
|
|
90
95
|
}
|
|
91
|
-
return { provider, model };
|
|
96
|
+
return { provider, model: model !== null && model !== void 0 ? model : 'gpt-4o-mini' };
|
|
92
97
|
});
|
|
93
98
|
}
|
|
94
99
|
/**
|
package/dist/esm/index.js
CHANGED
|
@@ -2,4 +2,5 @@ export { AIProvider, createAIProvider, getAIProvider, resolveAIConfig } from './
|
|
|
2
2
|
export { GeminiProvider } from './providers/gemini-provider';
|
|
3
3
|
export { GeminiTransport, MalformedFunctionCallError } from './transports/gemini-transport';
|
|
4
4
|
export { AI_FEATURE_FLAG, isAIFeatureEnabled } from './utils/feature-flags';
|
|
5
|
+
export { SUPPORTED_GEMINI_MODEL_IDS } from './types';
|
|
5
6
|
export { isSpeechRecognitionAvailable, startSpeechRecognition } from './utils/speech-to-text';
|
|
@@ -38,6 +38,12 @@ export class GeminiProvider {
|
|
|
38
38
|
}
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
|
+
prompt(message, options) {
|
|
42
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
43
|
+
const response = yield this.transport.sendChatMessage([], message, options);
|
|
44
|
+
return response.content;
|
|
45
|
+
});
|
|
46
|
+
}
|
|
41
47
|
chat(history, userMessage, options) {
|
|
42
48
|
return __awaiter(this, void 0, void 0, function* () {
|
|
43
49
|
return this.transport.sendChatMessage(history, userMessage, options);
|
|
@@ -1,7 +1,23 @@
|
|
|
1
1
|
import { __awaiter } from "tslib";
|
|
2
|
+
import { SUPPORTED_GEMINI_MODEL_IDS, } from '../types';
|
|
3
|
+
import { logger } from '../utils/logger';
|
|
2
4
|
const GEMINI_DIRECT_URL = (model) => `https://generativelanguage.googleapis.com/v1beta/models/${model}:generateContent`;
|
|
3
|
-
const DEFAULT_MODEL = 'gemini-2.
|
|
5
|
+
const DEFAULT_MODEL = 'gemini-2.5-flash-lite';
|
|
4
6
|
const DEFAULT_TIMEOUT = 180000; // 3 minutes
|
|
7
|
+
function assertSupportedGeminiModel(model) {
|
|
8
|
+
if (!SUPPORTED_GEMINI_MODEL_IDS.includes(model)) {
|
|
9
|
+
throw new Error(`GeminiTransport: unsupported model "${model}". Use one of: ${SUPPORTED_GEMINI_MODEL_IDS.join(', ')}.`);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Paid Standard tier for supported models — https://ai.google.dev/gemini-api/docs/pricing
|
|
14
|
+
*/
|
|
15
|
+
function estimatedGeminiPaidRatesUsdPerMillion(model) {
|
|
16
|
+
if (model === 'gemini-2.5-flash-lite') {
|
|
17
|
+
return { promptPerMillion: 0.1, candidatePerMillion: 0.4 };
|
|
18
|
+
}
|
|
19
|
+
return { promptPerMillion: 0.3, candidatePerMillion: 2.5 };
|
|
20
|
+
}
|
|
5
21
|
/**
|
|
6
22
|
* Thrown when Gemini returns a `MALFORMED_FUNCTION_CALL` finish reason,
|
|
7
23
|
* typically because the model tried to batch multiple tool calls using
|
|
@@ -28,7 +44,12 @@ export class MalformedFunctionCallError extends Error {
|
|
|
28
44
|
export class GeminiTransport {
|
|
29
45
|
constructor(config = {}) {
|
|
30
46
|
var _a, _b;
|
|
31
|
-
|
|
47
|
+
const model = (_a = config.model) !== null && _a !== void 0 ? _a : DEFAULT_MODEL;
|
|
48
|
+
assertSupportedGeminiModel(model);
|
|
49
|
+
this.model = model;
|
|
50
|
+
if (model === 'gemini-2.5-flash') {
|
|
51
|
+
logger.warn('GeminiTransport: using gemini-2.5-flash — higher cost than flash-lite; use for harder reasoning or agent tasks.');
|
|
52
|
+
}
|
|
32
53
|
this.timeout = (_b = config.timeout) !== null && _b !== void 0 ? _b : DEFAULT_TIMEOUT;
|
|
33
54
|
this.apiKey = config.apiKey;
|
|
34
55
|
this.serverEndpoint = config.serverEndpoint;
|
|
@@ -75,11 +96,11 @@ export class GeminiTransport {
|
|
|
75
96
|
});
|
|
76
97
|
}
|
|
77
98
|
logTokenUsage(promptTokens, candidateTokens) {
|
|
78
|
-
const
|
|
79
|
-
const
|
|
80
|
-
|
|
99
|
+
const { promptPerMillion, candidatePerMillion } = estimatedGeminiPaidRatesUsdPerMillion(this.model);
|
|
100
|
+
const promptCost = (promptTokens / GeminiTransport.TOKENS_PER_MILLION) * promptPerMillion;
|
|
101
|
+
const candidateCost = (candidateTokens / GeminiTransport.TOKENS_PER_MILLION) * candidatePerMillion;
|
|
81
102
|
const totalCost = promptCost + candidateCost;
|
|
82
|
-
console.log(
|
|
103
|
+
console.log(`--- Gemini Token Usage (${this.model}) ---`);
|
|
83
104
|
console.log(`Prompt Tokens: ${promptTokens} ($${promptCost.toFixed(GeminiTransport.COST_DECIMAL_PLACES)})`);
|
|
84
105
|
console.log(`Candidate Tokens: ${candidateTokens} ($${candidateCost.toFixed(GeminiTransport.COST_DECIMAL_PLACES)})`);
|
|
85
106
|
console.log(`Total Cost: $${totalCost.toFixed(GeminiTransport.COST_DECIMAL_PLACES)}`);
|
|
@@ -89,7 +110,7 @@ export class GeminiTransport {
|
|
|
89
110
|
var _a, _b;
|
|
90
111
|
const contents = [];
|
|
91
112
|
for (const msg of history) {
|
|
92
|
-
if (msg.role === 'system' || msg.thinking)
|
|
113
|
+
if (msg.role === 'system' || msg.role === 'system-event' || msg.thinking)
|
|
93
114
|
continue;
|
|
94
115
|
const role = msg.role === 'user' ? 'user' : 'model';
|
|
95
116
|
if (msg.toolResult) {
|
|
@@ -163,7 +184,7 @@ export class GeminiTransport {
|
|
|
163
184
|
}
|
|
164
185
|
// For tool-call responses, surface thought parts as `content` so the UI can
|
|
165
186
|
// render them as a collapsible thinking block. Fall back to text narration
|
|
166
|
-
// (textParts) for models that don't emit native thought parts (e.g.
|
|
187
|
+
// (textParts) for models that don't emit native thought parts (e.g. some Flash models)
|
|
167
188
|
// but do narrate alongside tool calls when prompted to do so.
|
|
168
189
|
// For final answers, surface only the response text.
|
|
169
190
|
return toolCalls.length > 0
|
|
@@ -241,8 +262,6 @@ export class GeminiTransport {
|
|
|
241
262
|
}
|
|
242
263
|
// ── Private helpers ────────────────────────────────────────────────────
|
|
243
264
|
GeminiTransport.TOKENS_PER_MILLION = 1000000;
|
|
244
|
-
GeminiTransport.PROMPT_COST_PER_MILLION = 0.1;
|
|
245
|
-
GeminiTransport.CANDIDATE_COST_PER_MILLION = 0.4;
|
|
246
265
|
GeminiTransport.COST_DECIMAL_PLACES = 6;
|
|
247
266
|
GeminiTransport.MAX_RETRIES = 5;
|
|
248
267
|
GeminiTransport.RATE_LIMIT_STATUS = 429;
|
|
@@ -474,6 +474,73 @@
|
|
|
474
474
|
],
|
|
475
475
|
"name": "interpretCriteria"
|
|
476
476
|
},
|
|
477
|
+
{
|
|
478
|
+
"kind": "MethodSignature",
|
|
479
|
+
"canonicalReference": "@genesislcap/foundation-ai!AIProvider#prompt:member(1)",
|
|
480
|
+
"docComment": "/**\n * Stateless one-off prompt. No conversation history is maintained. Returns the plain text response. Use this for side-calls (suggestions, summarisation, classification) that should not interact with any ongoing conversation context. Providers that support chat implement this.\n */\n",
|
|
481
|
+
"excerptTokens": [
|
|
482
|
+
{
|
|
483
|
+
"kind": "Content",
|
|
484
|
+
"text": "prompt?(message: "
|
|
485
|
+
},
|
|
486
|
+
{
|
|
487
|
+
"kind": "Content",
|
|
488
|
+
"text": "string"
|
|
489
|
+
},
|
|
490
|
+
{
|
|
491
|
+
"kind": "Content",
|
|
492
|
+
"text": ", options?: "
|
|
493
|
+
},
|
|
494
|
+
{
|
|
495
|
+
"kind": "Reference",
|
|
496
|
+
"text": "ChatRequestOptions",
|
|
497
|
+
"canonicalReference": "@genesislcap/foundation-ai!ChatRequestOptions:interface"
|
|
498
|
+
},
|
|
499
|
+
{
|
|
500
|
+
"kind": "Content",
|
|
501
|
+
"text": "): "
|
|
502
|
+
},
|
|
503
|
+
{
|
|
504
|
+
"kind": "Reference",
|
|
505
|
+
"text": "Promise",
|
|
506
|
+
"canonicalReference": "!Promise:interface"
|
|
507
|
+
},
|
|
508
|
+
{
|
|
509
|
+
"kind": "Content",
|
|
510
|
+
"text": "<string>"
|
|
511
|
+
},
|
|
512
|
+
{
|
|
513
|
+
"kind": "Content",
|
|
514
|
+
"text": ";"
|
|
515
|
+
}
|
|
516
|
+
],
|
|
517
|
+
"isOptional": true,
|
|
518
|
+
"returnTypeTokenRange": {
|
|
519
|
+
"startIndex": 5,
|
|
520
|
+
"endIndex": 7
|
|
521
|
+
},
|
|
522
|
+
"releaseTag": "Beta",
|
|
523
|
+
"overloadIndex": 1,
|
|
524
|
+
"parameters": [
|
|
525
|
+
{
|
|
526
|
+
"parameterName": "message",
|
|
527
|
+
"parameterTypeTokenRange": {
|
|
528
|
+
"startIndex": 1,
|
|
529
|
+
"endIndex": 2
|
|
530
|
+
},
|
|
531
|
+
"isOptional": false
|
|
532
|
+
},
|
|
533
|
+
{
|
|
534
|
+
"parameterName": "options",
|
|
535
|
+
"parameterTypeTokenRange": {
|
|
536
|
+
"startIndex": 3,
|
|
537
|
+
"endIndex": 4
|
|
538
|
+
},
|
|
539
|
+
"isOptional": true
|
|
540
|
+
}
|
|
541
|
+
],
|
|
542
|
+
"name": "prompt"
|
|
543
|
+
},
|
|
477
544
|
{
|
|
478
545
|
"kind": "MethodSignature",
|
|
479
546
|
"canonicalReference": "@genesislcap/foundation-ai!AIProvider#streamChat:member(1)",
|
|
@@ -1074,6 +1141,34 @@
|
|
|
1074
1141
|
"endIndex": 2
|
|
1075
1142
|
}
|
|
1076
1143
|
},
|
|
1144
|
+
{
|
|
1145
|
+
"kind": "PropertySignature",
|
|
1146
|
+
"canonicalReference": "@genesislcap/foundation-ai!ChatConfig#suggestions:member",
|
|
1147
|
+
"docComment": "/**\n * Query suggestions feature configuration.\n */\n",
|
|
1148
|
+
"excerptTokens": [
|
|
1149
|
+
{
|
|
1150
|
+
"kind": "Content",
|
|
1151
|
+
"text": "suggestions?: "
|
|
1152
|
+
},
|
|
1153
|
+
{
|
|
1154
|
+
"kind": "Reference",
|
|
1155
|
+
"text": "ChatSuggestionsConfig",
|
|
1156
|
+
"canonicalReference": "@genesislcap/foundation-ai!ChatSuggestionsConfig:type"
|
|
1157
|
+
},
|
|
1158
|
+
{
|
|
1159
|
+
"kind": "Content",
|
|
1160
|
+
"text": ";"
|
|
1161
|
+
}
|
|
1162
|
+
],
|
|
1163
|
+
"isReadonly": false,
|
|
1164
|
+
"isOptional": true,
|
|
1165
|
+
"releaseTag": "Beta",
|
|
1166
|
+
"name": "suggestions",
|
|
1167
|
+
"propertyTypeTokenRange": {
|
|
1168
|
+
"startIndex": 1,
|
|
1169
|
+
"endIndex": 2
|
|
1170
|
+
}
|
|
1171
|
+
},
|
|
1077
1172
|
{
|
|
1078
1173
|
"kind": "PropertySignature",
|
|
1079
1174
|
"canonicalReference": "@genesislcap/foundation-ai!ChatConfig#ui:member",
|
|
@@ -1771,6 +1866,32 @@
|
|
|
1771
1866
|
],
|
|
1772
1867
|
"extendsTokenRanges": []
|
|
1773
1868
|
},
|
|
1869
|
+
{
|
|
1870
|
+
"kind": "TypeAlias",
|
|
1871
|
+
"canonicalReference": "@genesislcap/foundation-ai!ChatSuggestionsConfig:type",
|
|
1872
|
+
"docComment": "/**\n * Configuration for the chat suggestions feature.\n *\n * @beta\n */\n",
|
|
1873
|
+
"excerptTokens": [
|
|
1874
|
+
{
|
|
1875
|
+
"kind": "Content",
|
|
1876
|
+
"text": "export type ChatSuggestionsConfig = "
|
|
1877
|
+
},
|
|
1878
|
+
{
|
|
1879
|
+
"kind": "Content",
|
|
1880
|
+
"text": "{\n behavior: 'never';\n count?: never;\n prompt?: never;\n} | {\n behavior: 'initial' | 'always';\n count?: number;\n prompt?: string;\n}"
|
|
1881
|
+
},
|
|
1882
|
+
{
|
|
1883
|
+
"kind": "Content",
|
|
1884
|
+
"text": ";"
|
|
1885
|
+
}
|
|
1886
|
+
],
|
|
1887
|
+
"fileUrlPath": "src/types/chat.types.ts",
|
|
1888
|
+
"releaseTag": "Beta",
|
|
1889
|
+
"name": "ChatSuggestionsConfig",
|
|
1890
|
+
"typeTokenRange": {
|
|
1891
|
+
"startIndex": 1,
|
|
1892
|
+
"endIndex": 2
|
|
1893
|
+
}
|
|
1894
|
+
},
|
|
1774
1895
|
{
|
|
1775
1896
|
"kind": "Interface",
|
|
1776
1897
|
"canonicalReference": "@genesislcap/foundation-ai!ChatToolCall:interface",
|
|
@@ -2472,6 +2593,33 @@
|
|
|
2472
2593
|
"endIndex": 2
|
|
2473
2594
|
}
|
|
2474
2595
|
},
|
|
2596
|
+
{
|
|
2597
|
+
"kind": "PropertySignature",
|
|
2598
|
+
"canonicalReference": "@genesislcap/foundation-ai!ChatUiConfig#showSplash:member",
|
|
2599
|
+
"docComment": "/**\n * When `true`, shows the `slot=\"splash\"` content when there are no messages. The host element reflects a `showing-splash` boolean attribute that consumers can use as a CSS hook to animate the splash in and out. Default: `false`.\n */\n",
|
|
2600
|
+
"excerptTokens": [
|
|
2601
|
+
{
|
|
2602
|
+
"kind": "Content",
|
|
2603
|
+
"text": "showSplash?: "
|
|
2604
|
+
},
|
|
2605
|
+
{
|
|
2606
|
+
"kind": "Content",
|
|
2607
|
+
"text": "boolean"
|
|
2608
|
+
},
|
|
2609
|
+
{
|
|
2610
|
+
"kind": "Content",
|
|
2611
|
+
"text": ";"
|
|
2612
|
+
}
|
|
2613
|
+
],
|
|
2614
|
+
"isReadonly": false,
|
|
2615
|
+
"isOptional": true,
|
|
2616
|
+
"releaseTag": "Beta",
|
|
2617
|
+
"name": "showSplash",
|
|
2618
|
+
"propertyTypeTokenRange": {
|
|
2619
|
+
"startIndex": 1,
|
|
2620
|
+
"endIndex": 2
|
|
2621
|
+
}
|
|
2622
|
+
},
|
|
2475
2623
|
{
|
|
2476
2624
|
"kind": "PropertySignature",
|
|
2477
2625
|
"canonicalReference": "@genesislcap/foundation-ai!ChatUiConfig#showThinkingSteps:member",
|
|
@@ -3102,15 +3250,16 @@
|
|
|
3102
3250
|
{
|
|
3103
3251
|
"kind": "PropertySignature",
|
|
3104
3252
|
"canonicalReference": "@genesislcap/foundation-ai!GeminiAIConfig#model:member",
|
|
3105
|
-
"docComment": "",
|
|
3253
|
+
"docComment": "/**\n * Defaults to `gemini-2.5-flash-lite`. Only {@link SUPPORTED_GEMINI_MODEL_IDS} are accepted at runtime.\n */\n",
|
|
3106
3254
|
"excerptTokens": [
|
|
3107
3255
|
{
|
|
3108
3256
|
"kind": "Content",
|
|
3109
3257
|
"text": "model?: "
|
|
3110
3258
|
},
|
|
3111
3259
|
{
|
|
3112
|
-
"kind": "
|
|
3113
|
-
"text": "
|
|
3260
|
+
"kind": "Reference",
|
|
3261
|
+
"text": "GeminiModelId",
|
|
3262
|
+
"canonicalReference": "@genesislcap/foundation-ai!GeminiModelId:type"
|
|
3114
3263
|
},
|
|
3115
3264
|
{
|
|
3116
3265
|
"kind": "Content",
|
|
@@ -3188,6 +3337,32 @@
|
|
|
3188
3337
|
}
|
|
3189
3338
|
]
|
|
3190
3339
|
},
|
|
3340
|
+
{
|
|
3341
|
+
"kind": "TypeAlias",
|
|
3342
|
+
"canonicalReference": "@genesislcap/foundation-ai!GeminiModelId:type",
|
|
3343
|
+
"docComment": "/**\n * Gemini REST model ids supported by {@link GeminiTransport}.\n *\n * @beta\n */\n",
|
|
3344
|
+
"excerptTokens": [
|
|
3345
|
+
{
|
|
3346
|
+
"kind": "Content",
|
|
3347
|
+
"text": "export type GeminiModelId = "
|
|
3348
|
+
},
|
|
3349
|
+
{
|
|
3350
|
+
"kind": "Content",
|
|
3351
|
+
"text": "'gemini-2.5-flash' | 'gemini-2.5-flash-lite'"
|
|
3352
|
+
},
|
|
3353
|
+
{
|
|
3354
|
+
"kind": "Content",
|
|
3355
|
+
"text": ";"
|
|
3356
|
+
}
|
|
3357
|
+
],
|
|
3358
|
+
"fileUrlPath": "src/types/config.types.ts",
|
|
3359
|
+
"releaseTag": "Beta",
|
|
3360
|
+
"name": "GeminiModelId",
|
|
3361
|
+
"typeTokenRange": {
|
|
3362
|
+
"startIndex": 1,
|
|
3363
|
+
"endIndex": 2
|
|
3364
|
+
}
|
|
3365
|
+
},
|
|
3191
3366
|
{
|
|
3192
3367
|
"kind": "Class",
|
|
3193
3368
|
"canonicalReference": "@genesislcap/foundation-ai!GeminiProvider:class",
|
|
@@ -3487,6 +3662,76 @@
|
|
|
3487
3662
|
"isAbstract": false,
|
|
3488
3663
|
"name": "interpretCriteria"
|
|
3489
3664
|
},
|
|
3665
|
+
{
|
|
3666
|
+
"kind": "Method",
|
|
3667
|
+
"canonicalReference": "@genesislcap/foundation-ai!GeminiProvider#prompt:member(1)",
|
|
3668
|
+
"docComment": "",
|
|
3669
|
+
"excerptTokens": [
|
|
3670
|
+
{
|
|
3671
|
+
"kind": "Content",
|
|
3672
|
+
"text": "prompt(message: "
|
|
3673
|
+
},
|
|
3674
|
+
{
|
|
3675
|
+
"kind": "Content",
|
|
3676
|
+
"text": "string"
|
|
3677
|
+
},
|
|
3678
|
+
{
|
|
3679
|
+
"kind": "Content",
|
|
3680
|
+
"text": ", options?: "
|
|
3681
|
+
},
|
|
3682
|
+
{
|
|
3683
|
+
"kind": "Reference",
|
|
3684
|
+
"text": "ChatRequestOptions",
|
|
3685
|
+
"canonicalReference": "@genesislcap/foundation-ai!ChatRequestOptions:interface"
|
|
3686
|
+
},
|
|
3687
|
+
{
|
|
3688
|
+
"kind": "Content",
|
|
3689
|
+
"text": "): "
|
|
3690
|
+
},
|
|
3691
|
+
{
|
|
3692
|
+
"kind": "Reference",
|
|
3693
|
+
"text": "Promise",
|
|
3694
|
+
"canonicalReference": "!Promise:interface"
|
|
3695
|
+
},
|
|
3696
|
+
{
|
|
3697
|
+
"kind": "Content",
|
|
3698
|
+
"text": "<string>"
|
|
3699
|
+
},
|
|
3700
|
+
{
|
|
3701
|
+
"kind": "Content",
|
|
3702
|
+
"text": ";"
|
|
3703
|
+
}
|
|
3704
|
+
],
|
|
3705
|
+
"isStatic": false,
|
|
3706
|
+
"returnTypeTokenRange": {
|
|
3707
|
+
"startIndex": 5,
|
|
3708
|
+
"endIndex": 7
|
|
3709
|
+
},
|
|
3710
|
+
"releaseTag": "Beta",
|
|
3711
|
+
"isProtected": false,
|
|
3712
|
+
"overloadIndex": 1,
|
|
3713
|
+
"parameters": [
|
|
3714
|
+
{
|
|
3715
|
+
"parameterName": "message",
|
|
3716
|
+
"parameterTypeTokenRange": {
|
|
3717
|
+
"startIndex": 1,
|
|
3718
|
+
"endIndex": 2
|
|
3719
|
+
},
|
|
3720
|
+
"isOptional": false
|
|
3721
|
+
},
|
|
3722
|
+
{
|
|
3723
|
+
"parameterName": "options",
|
|
3724
|
+
"parameterTypeTokenRange": {
|
|
3725
|
+
"startIndex": 3,
|
|
3726
|
+
"endIndex": 4
|
|
3727
|
+
},
|
|
3728
|
+
"isOptional": true
|
|
3729
|
+
}
|
|
3730
|
+
],
|
|
3731
|
+
"isOptional": false,
|
|
3732
|
+
"isAbstract": false,
|
|
3733
|
+
"name": "prompt"
|
|
3734
|
+
},
|
|
3490
3735
|
{
|
|
3491
3736
|
"kind": "Method",
|
|
3492
3737
|
"canonicalReference": "@genesislcap/foundation-ai!GeminiProvider#streamChat:member(1)",
|
|
@@ -3673,7 +3918,16 @@
|
|
|
3673
3918
|
},
|
|
3674
3919
|
{
|
|
3675
3920
|
"kind": "Content",
|
|
3676
|
-
"text": "{\n provider: 'gemini';\n model:
|
|
3921
|
+
"text": "{\n provider: 'gemini';\n model: "
|
|
3922
|
+
},
|
|
3923
|
+
{
|
|
3924
|
+
"kind": "Reference",
|
|
3925
|
+
"text": "GeminiModelId",
|
|
3926
|
+
"canonicalReference": "@genesislcap/foundation-ai!GeminiModelId:type"
|
|
3927
|
+
},
|
|
3928
|
+
{
|
|
3929
|
+
"kind": "Content",
|
|
3930
|
+
"text": ";\n }"
|
|
3677
3931
|
},
|
|
3678
3932
|
{
|
|
3679
3933
|
"kind": "Content",
|
|
@@ -3683,7 +3937,7 @@
|
|
|
3683
3937
|
"isStatic": false,
|
|
3684
3938
|
"returnTypeTokenRange": {
|
|
3685
3939
|
"startIndex": 1,
|
|
3686
|
-
"endIndex":
|
|
3940
|
+
"endIndex": 4
|
|
3687
3941
|
},
|
|
3688
3942
|
"releaseTag": "Beta",
|
|
3689
3943
|
"isProtected": false,
|
|
@@ -4159,7 +4413,7 @@
|
|
|
4159
4413
|
{
|
|
4160
4414
|
"kind": "PropertySignature",
|
|
4161
4415
|
"canonicalReference": "@genesislcap/foundation-ai!ResolveAIConfigOptions#model:member",
|
|
4162
|
-
"docComment": "/**\n * Model name
|
|
4416
|
+
"docComment": "/**\n * Model name. OpenAI default: gpt-4o-mini. Gemini: only {@link SUPPORTED_GEMINI_MODEL_IDS} (default flash-lite).\n */\n",
|
|
4163
4417
|
"excerptTokens": [
|
|
4164
4418
|
{
|
|
4165
4419
|
"kind": "Content",
|
|
@@ -4362,6 +4616,38 @@
|
|
|
4362
4616
|
}
|
|
4363
4617
|
],
|
|
4364
4618
|
"name": "startSpeechRecognition"
|
|
4619
|
+
},
|
|
4620
|
+
{
|
|
4621
|
+
"kind": "Variable",
|
|
4622
|
+
"canonicalReference": "@genesislcap/foundation-ai!SUPPORTED_GEMINI_MODEL_IDS:var",
|
|
4623
|
+
"docComment": "/**\n * @beta\n */\n",
|
|
4624
|
+
"excerptTokens": [
|
|
4625
|
+
{
|
|
4626
|
+
"kind": "Content",
|
|
4627
|
+
"text": "SUPPORTED_GEMINI_MODEL_IDS: "
|
|
4628
|
+
},
|
|
4629
|
+
{
|
|
4630
|
+
"kind": "Content",
|
|
4631
|
+
"text": "readonly "
|
|
4632
|
+
},
|
|
4633
|
+
{
|
|
4634
|
+
"kind": "Reference",
|
|
4635
|
+
"text": "GeminiModelId",
|
|
4636
|
+
"canonicalReference": "@genesislcap/foundation-ai!GeminiModelId:type"
|
|
4637
|
+
},
|
|
4638
|
+
{
|
|
4639
|
+
"kind": "Content",
|
|
4640
|
+
"text": "[]"
|
|
4641
|
+
}
|
|
4642
|
+
],
|
|
4643
|
+
"fileUrlPath": "src/types/config.types.ts",
|
|
4644
|
+
"isReadonly": true,
|
|
4645
|
+
"releaseTag": "Beta",
|
|
4646
|
+
"name": "SUPPORTED_GEMINI_MODEL_IDS",
|
|
4647
|
+
"variableTypeTokenRange": {
|
|
4648
|
+
"startIndex": 1,
|
|
4649
|
+
"endIndex": 4
|
|
4650
|
+
}
|
|
4365
4651
|
}
|
|
4366
4652
|
]
|
|
4367
4653
|
}
|
package/dist/foundation-ai.d.ts
CHANGED
|
@@ -31,6 +31,14 @@ export declare interface AIProvider {
|
|
|
31
31
|
* Must be called from a user gesture (e.g. click).
|
|
32
32
|
*/
|
|
33
33
|
triggerDownload?(): Promise<void>;
|
|
34
|
+
/**
|
|
35
|
+
* Stateless one-off prompt. No conversation history is maintained.
|
|
36
|
+
* Returns the plain text response.
|
|
37
|
+
* Use this for side-calls (suggestions, summarisation, classification) that
|
|
38
|
+
* should not interact with any ongoing conversation context.
|
|
39
|
+
* Providers that support chat implement this.
|
|
40
|
+
*/
|
|
41
|
+
prompt?(message: string, options?: ChatRequestOptions): Promise<string>;
|
|
34
42
|
/**
|
|
35
43
|
* Multi-turn chat (non-streaming). Returns the assistant's response message.
|
|
36
44
|
* Providers that support chat (Gemini, OpenAI) implement this.
|
|
@@ -156,6 +164,8 @@ export declare interface ChatConfig {
|
|
|
156
164
|
ui?: ChatUiConfig;
|
|
157
165
|
/** Agent engine settings — iteration limits, handoff caps, classifier tuning. */
|
|
158
166
|
agent?: ChatAgentConfig;
|
|
167
|
+
/** Query suggestions feature configuration. */
|
|
168
|
+
suggestions?: ChatSuggestionsConfig;
|
|
159
169
|
}
|
|
160
170
|
|
|
161
171
|
/**
|
|
@@ -231,6 +241,36 @@ export declare interface ChatStreamChunk {
|
|
|
231
241
|
toolCalls?: ChatToolCall[];
|
|
232
242
|
}
|
|
233
243
|
|
|
244
|
+
/**
|
|
245
|
+
* Configuration for the chat suggestions feature.
|
|
246
|
+
*
|
|
247
|
+
* @beta
|
|
248
|
+
*/
|
|
249
|
+
export declare type ChatSuggestionsConfig = {
|
|
250
|
+
/** Suggestions are disabled. */
|
|
251
|
+
behavior: 'never';
|
|
252
|
+
/** Not applicable when behavior is 'never'. */
|
|
253
|
+
count?: never;
|
|
254
|
+
/** Not applicable when behavior is 'never'. */
|
|
255
|
+
prompt?: never;
|
|
256
|
+
} | {
|
|
257
|
+
/**
|
|
258
|
+
* 'initial': Show suggestions on first load before any messages are sent.
|
|
259
|
+
* 'always': Show suggestions after every assistant response.
|
|
260
|
+
*/
|
|
261
|
+
behavior: 'initial' | 'always';
|
|
262
|
+
/**
|
|
263
|
+
* Number of suggestions to generate.
|
|
264
|
+
* @default 3
|
|
265
|
+
*/
|
|
266
|
+
count?: number;
|
|
267
|
+
/**
|
|
268
|
+
* Custom prompt to steer the suggestion generation. If omitted, a
|
|
269
|
+
* default prompt is used.
|
|
270
|
+
*/
|
|
271
|
+
prompt?: string;
|
|
272
|
+
};
|
|
273
|
+
|
|
234
274
|
/**
|
|
235
275
|
* A tool call requested by the assistant.
|
|
236
276
|
*
|
|
@@ -313,6 +353,12 @@ export declare interface ChatUiConfig {
|
|
|
313
353
|
loadingDelay?: number;
|
|
314
354
|
/** Animations feature configuration. */
|
|
315
355
|
animations?: ChatAnimationsConfig;
|
|
356
|
+
/**
|
|
357
|
+
* When `true`, shows the `slot="splash"` content when there are no messages.
|
|
358
|
+
* The host element reflects a `showing-splash` boolean attribute that consumers
|
|
359
|
+
* can use as a CSS hook to animate the splash in and out. Default: `false`.
|
|
360
|
+
*/
|
|
361
|
+
showSplash?: boolean;
|
|
316
362
|
/**
|
|
317
363
|
* Show an inline divider in the message list when the active specialist changes.
|
|
318
364
|
* Also shown automatically when showToolCalls is true.
|
|
@@ -419,11 +465,19 @@ export declare type FieldLike = string | {
|
|
|
419
465
|
*/
|
|
420
466
|
export declare interface GeminiAIConfig extends AIProviderConfig {
|
|
421
467
|
providerType: 'gemini';
|
|
422
|
-
|
|
468
|
+
/** Defaults to `gemini-2.5-flash-lite`. Only {@link SUPPORTED_GEMINI_MODEL_IDS} are accepted at runtime. */
|
|
469
|
+
model?: GeminiModelId;
|
|
423
470
|
serverEndpoint?: string;
|
|
424
471
|
apiKey?: string;
|
|
425
472
|
}
|
|
426
473
|
|
|
474
|
+
/**
|
|
475
|
+
* Gemini REST model ids supported by {@link GeminiTransport}.
|
|
476
|
+
*
|
|
477
|
+
* @beta
|
|
478
|
+
*/
|
|
479
|
+
export declare type GeminiModelId = 'gemini-2.5-flash' | 'gemini-2.5-flash-lite';
|
|
480
|
+
|
|
427
481
|
/**
|
|
428
482
|
* Gemini AI provider. Uses {@link GeminiTransport} to handle requests.
|
|
429
483
|
* Implements criteria interpretation and multi-turn chat.
|
|
@@ -436,6 +490,7 @@ export declare class GeminiProvider implements AIProvider {
|
|
|
436
490
|
constructor(config: GeminiProviderConfig, transport: GeminiTransport);
|
|
437
491
|
getStatus(): Promise<AIStatus>;
|
|
438
492
|
interpretCriteria(input: string, context: CriteriaInterpretContext): Promise<CriteriaInterpretationResult | null>;
|
|
493
|
+
prompt(message: string, options?: ChatRequestOptions): Promise<string>;
|
|
439
494
|
chat(history: ChatMessage[], userMessage: string, options?: ChatRequestOptions): Promise<ChatMessage>;
|
|
440
495
|
streamChat(history: ChatMessage[], userMessage: string, options?: ChatRequestOptions): AsyncIterable<ChatStreamChunk>;
|
|
441
496
|
}
|
|
@@ -461,13 +516,11 @@ export declare class GeminiTransport implements AITransport, ChatTransport {
|
|
|
461
516
|
constructor(config?: GeminiTransportConfig);
|
|
462
517
|
getConfig(): {
|
|
463
518
|
provider: 'gemini';
|
|
464
|
-
model:
|
|
519
|
+
model: GeminiModelId;
|
|
465
520
|
};
|
|
466
521
|
sendStructuredPrompt(options: StructuredPromptOptions): Promise<string>;
|
|
467
522
|
sendChatMessage(history: ChatMessage[], userMessage: string, options?: ChatRequestOptions): Promise<ChatMessage>;
|
|
468
523
|
private static readonly TOKENS_PER_MILLION;
|
|
469
|
-
private static readonly PROMPT_COST_PER_MILLION;
|
|
470
|
-
private static readonly CANDIDATE_COST_PER_MILLION;
|
|
471
524
|
private static readonly COST_DECIMAL_PLACES;
|
|
472
525
|
private logTokenUsage;
|
|
473
526
|
private toGeminiContents;
|
|
@@ -481,7 +534,10 @@ export declare class GeminiTransport implements AITransport, ChatTransport {
|
|
|
481
534
|
}
|
|
482
535
|
|
|
483
536
|
declare interface GeminiTransportConfig {
|
|
484
|
-
|
|
537
|
+
/**
|
|
538
|
+
* Defaults to `gemini-2.5-flash-lite`. Only {@link SUPPORTED_GEMINI_MODEL_IDS} are accepted.
|
|
539
|
+
*/
|
|
540
|
+
model?: GeminiModelId;
|
|
485
541
|
timeout?: number;
|
|
486
542
|
/**
|
|
487
543
|
* API key for direct calls to the Gemini API.
|
|
@@ -573,7 +629,7 @@ export declare function resolveAIConfig(options?: ResolveAIConfigOptions): Promi
|
|
|
573
629
|
export declare interface ResolveAIConfigOptions {
|
|
574
630
|
/** Cloud provider (openai, gemini). Default: openai */
|
|
575
631
|
provider?: 'openai' | 'gemini';
|
|
576
|
-
/** Model name
|
|
632
|
+
/** Model name. OpenAI default: gpt-4o-mini. Gemini: only {@link SUPPORTED_GEMINI_MODEL_IDS} (default flash-lite). */
|
|
577
633
|
model?: string;
|
|
578
634
|
/** Prefer Chrome built-in AI when available */
|
|
579
635
|
preferChrome?: boolean;
|
|
@@ -618,4 +674,7 @@ declare interface StructuredPromptOptions {
|
|
|
618
674
|
responseSchema?: object;
|
|
619
675
|
}
|
|
620
676
|
|
|
677
|
+
/** @beta */
|
|
678
|
+
export declare const SUPPORTED_GEMINI_MODEL_IDS: readonly GeminiModelId[];
|
|
679
|
+
|
|
621
680
|
export { }
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@genesislcap/foundation-ai",
|
|
3
3
|
"description": "Genesis Foundation AI - Provider-agnostic AI configuration and shared utilities",
|
|
4
|
-
"version": "14.409.0-FUI-2495.
|
|
4
|
+
"version": "14.409.0-FUI-2495.4",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"license": "SEE LICENSE IN license.txt",
|
|
7
7
|
"main": "dist/esm/index.js",
|
|
@@ -51,17 +51,17 @@
|
|
|
51
51
|
}
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
|
-
"@genesislcap/foundation-testing": "14.409.0-FUI-2495.
|
|
55
|
-
"@genesislcap/genx": "14.409.0-FUI-2495.
|
|
56
|
-
"@genesislcap/rollup-builder": "14.409.0-FUI-2495.
|
|
57
|
-
"@genesislcap/ts-builder": "14.409.0-FUI-2495.
|
|
58
|
-
"@genesislcap/uvu-playwright-builder": "14.409.0-FUI-2495.
|
|
59
|
-
"@genesislcap/vite-builder": "14.409.0-FUI-2495.
|
|
60
|
-
"@genesislcap/webpack-builder": "14.409.0-FUI-2495.
|
|
54
|
+
"@genesislcap/foundation-testing": "14.409.0-FUI-2495.4",
|
|
55
|
+
"@genesislcap/genx": "14.409.0-FUI-2495.4",
|
|
56
|
+
"@genesislcap/rollup-builder": "14.409.0-FUI-2495.4",
|
|
57
|
+
"@genesislcap/ts-builder": "14.409.0-FUI-2495.4",
|
|
58
|
+
"@genesislcap/uvu-playwright-builder": "14.409.0-FUI-2495.4",
|
|
59
|
+
"@genesislcap/vite-builder": "14.409.0-FUI-2495.4",
|
|
60
|
+
"@genesislcap/webpack-builder": "14.409.0-FUI-2495.4"
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
|
-
"@genesislcap/foundation-logger": "14.409.0-FUI-2495.
|
|
64
|
-
"@genesislcap/foundation-utils": "14.409.0-FUI-2495.
|
|
63
|
+
"@genesislcap/foundation-logger": "14.409.0-FUI-2495.4",
|
|
64
|
+
"@genesislcap/foundation-utils": "14.409.0-FUI-2495.4",
|
|
65
65
|
"@microsoft/fast-foundation": "2.50.0"
|
|
66
66
|
},
|
|
67
67
|
"repository": {
|
|
@@ -72,5 +72,5 @@
|
|
|
72
72
|
"publishConfig": {
|
|
73
73
|
"access": "public"
|
|
74
74
|
},
|
|
75
|
-
"gitHead": "
|
|
75
|
+
"gitHead": "776a61e07afe56f5e9521ccee55034385cc03d44"
|
|
76
76
|
}
|