@genesislcap/foundation-ai 14.421.1 → 14.422.1-alpha-6f2ae99.0
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/index.d.ts +1 -1
- package/dist/dts/index.d.ts.map +1 -1
- package/dist/dts/transports/gemini-transport.d.ts +2 -0
- package/dist/dts/transports/gemini-transport.d.ts.map +1 -1
- package/dist/dts/types/chat.types.d.ts +49 -1
- package/dist/dts/types/chat.types.d.ts.map +1 -1
- package/dist/dts/types/config.types.d.ts +1 -1
- package/dist/dts/types/config.types.d.ts.map +1 -1
- package/dist/esm/transports/gemini-transport.js +24 -6
- package/dist/esm/types/config.types.js +1 -0
- package/dist/foundation-ai.api.json +157 -6
- package/dist/foundation-ai.d.ts +53 -2
- package/package.json +11 -11
package/dist/dts/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export { GeminiTransport, MalformedFunctionCallError } from './transports/gemini
|
|
|
4
4
|
export { AI_FEATURE_FLAG, isAIFeatureEnabled } from './utils/feature-flags';
|
|
5
5
|
export { SUPPORTED_GEMINI_MODEL_IDS } from './types';
|
|
6
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, ChatToolCallUnknown, ChatToolDefinition, ChatToolHandlers, ChatToolResult, ChatUiConfig, ChatSuggestionsConfig, InteractionResult, } from './types/chat.types';
|
|
7
|
+
export type { ChatAgentConfig, ChatAnimationsConfig, ChatAttachment, ChatConfig, ChatDriverResult, ChatMessage, ChatInteraction, ChatRequestOptions, ChatRole, ChatStreamChunk, ChatToolCall, ChatToolCallUnknown, ChatToolDefinition, ChatToolHandlers, ChatToolResult, ChatUiConfig, ChatSuggestionsConfig, InteractionResult, SubAgentRequestOptions, } from './types/chat.types';
|
|
8
8
|
export { isChatToolCallUnknown } from './types/chat.types';
|
|
9
9
|
export type { ChatTransport } from './types/chat-transport.types';
|
|
10
10
|
export type { ResolveAIConfigOptions } from './ai-provider';
|
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,OAAO,EAAE,0BAA0B,EAAE,MAAM,SAAS,CAAC;AACrD,YAAY,EACV,QAAQ,EACR,QAAQ,EACR,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,cAAc,EACd,aAAa,EACb,cAAc,GACf,MAAM,SAAS,CAAC;AACjB,YAAY,EACV,eAAe,EACf,oBAAoB,EACpB,cAAc,EACd,UAAU,EACV,gBAAgB,EAChB,WAAW,EACX,eAAe,EACf,kBAAkB,EAClB,QAAQ,EACR,eAAe,EACf,YAAY,EACZ,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,EAChB,cAAc,EACd,YAAY,EACZ,qBAAqB,EACrB,iBAAiB,
|
|
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,OAAO,EAAE,0BAA0B,EAAE,MAAM,SAAS,CAAC;AACrD,YAAY,EACV,QAAQ,EACR,QAAQ,EACR,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,cAAc,EACd,aAAa,EACb,cAAc,GACf,MAAM,SAAS,CAAC;AACjB,YAAY,EACV,eAAe,EACf,oBAAoB,EACpB,cAAc,EACd,UAAU,EACV,gBAAgB,EAChB,WAAW,EACX,eAAe,EACf,kBAAkB,EAClB,QAAQ,EACR,eAAe,EACf,YAAY,EACZ,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,EAChB,cAAc,EACd,YAAY,EACZ,qBAAqB,EACrB,iBAAiB,EACjB,sBAAsB,GACvB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,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"}
|
|
@@ -60,6 +60,8 @@ export declare class GeminiTransport implements AITransport, ChatTransport {
|
|
|
60
60
|
private buildEndpoint;
|
|
61
61
|
private static readonly MAX_RETRIES;
|
|
62
62
|
private static readonly RATE_LIMIT_STATUS;
|
|
63
|
+
private static readonly SERVICE_UNAVAILABLE_STATUS;
|
|
64
|
+
private static readonly RETRYABLE_STATUSES;
|
|
63
65
|
private static readonly BACKOFF_BASE_MS;
|
|
64
66
|
private post;
|
|
65
67
|
private toDirectPayload;
|
|
@@ -1 +1 @@
|
|
|
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;
|
|
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;AAgC7B,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;IAmB9C,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;IAwDxB,OAAO,CAAC,kBAAkB;IAkE1B,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,0BAA0B,CAAO;IACzD,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,kBAAkB,CAGxC;IACF,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,eAAe,CAAQ;YAEjC,IAAI;IAgDlB,OAAO,CAAC,eAAe;CAexB"}
|
|
@@ -25,6 +25,12 @@ type ChatToolCallBase = {
|
|
|
25
25
|
* Not sent to the AI provider.
|
|
26
26
|
*/
|
|
27
27
|
foldPath?: string[];
|
|
28
|
+
/**
|
|
29
|
+
* Full message history from the sub-agent run that produced this tool call's result.
|
|
30
|
+
* Populated by SubAgentRunner when a tool handler delegates to a sub-agent.
|
|
31
|
+
* UI-only — not sent to the AI provider.
|
|
32
|
+
*/
|
|
33
|
+
subAgentTrace?: ChatMessage[];
|
|
28
34
|
};
|
|
29
35
|
/**
|
|
30
36
|
* A tool call for a tool name the driver could not resolve to any handler.
|
|
@@ -122,13 +128,55 @@ export interface ChatToolDefinition {
|
|
|
122
128
|
description: string;
|
|
123
129
|
parameters: Record<string, unknown>;
|
|
124
130
|
}
|
|
131
|
+
/**
|
|
132
|
+
* Options passed to `requestSubAgent` at call time.
|
|
133
|
+
*
|
|
134
|
+
* @beta
|
|
135
|
+
*/
|
|
136
|
+
export interface SubAgentRequestOptions {
|
|
137
|
+
/** Plain-language description of what this specific invocation should do. */
|
|
138
|
+
task?: string;
|
|
139
|
+
/** Per-call override of the config-level historyCap. */
|
|
140
|
+
historyCap?: number;
|
|
141
|
+
/** Extra dynamic data injected as a primer message before the task. */
|
|
142
|
+
context?: Record<string, unknown>;
|
|
143
|
+
}
|
|
125
144
|
/**
|
|
126
145
|
* Map of tool name to async handler function.
|
|
127
146
|
*
|
|
147
|
+
* Optionally parameterised with the sub-agents available to this handler set.
|
|
148
|
+
* Pass the config objects (not string literals) so the name union is derived
|
|
149
|
+
* from the actual configs:
|
|
150
|
+
*
|
|
151
|
+
* ```ts
|
|
152
|
+
* const mySubAgent = { name: 'my_sub_agent', ... } satisfies AgentConfig;
|
|
153
|
+
* type MyHandlers = ChatToolHandlers<typeof mySubAgent>;
|
|
154
|
+
* // requestSubAgent's name param is now typed as 'my_sub_agent'
|
|
155
|
+
* ```
|
|
156
|
+
*
|
|
157
|
+
* Multiple sub-agents: `ChatToolHandlers<typeof agentA | typeof agentB>`.
|
|
158
|
+
* Default (`{ name: string }`) leaves the name param as `string` — no breaking change.
|
|
159
|
+
*
|
|
128
160
|
* @beta
|
|
129
161
|
*/
|
|
130
|
-
export type ChatToolHandlers
|
|
162
|
+
export type ChatToolHandlers<TSubAgent extends {
|
|
163
|
+
name: string;
|
|
164
|
+
} = {
|
|
165
|
+
name: string;
|
|
166
|
+
}> = Record<string, (args: Record<string, unknown>, context: {
|
|
131
167
|
requestInteraction: <T = unknown>(componentName: string, data: any) => Promise<T>;
|
|
168
|
+
/**
|
|
169
|
+
* Delegate to a named sub-agent declared on the parent agent config.
|
|
170
|
+
* Returns the sub-agent's structured result (when `completeSubAgent` was called) or
|
|
171
|
+
* its final assistant message text as a fallback.
|
|
172
|
+
*/
|
|
173
|
+
requestSubAgent?: <T = never>(name: TSubAgent['name'], options?: SubAgentRequestOptions) => Promise<T | string>;
|
|
174
|
+
/**
|
|
175
|
+
* Signal explicit completion from within a sub-agent tool handler.
|
|
176
|
+
* The resolved value is returned to the parent handler as the structured result of
|
|
177
|
+
* `requestSubAgent`. Only available inside sub-agent tool handlers.
|
|
178
|
+
*/
|
|
179
|
+
completeSubAgent?: (result: unknown) => void;
|
|
132
180
|
}) => Promise<unknown>>;
|
|
133
181
|
/**
|
|
134
182
|
* Options for a chat request.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat.types.d.ts","sourceRoot":"","sources":["../../../src/types/chat.types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,WAAW,GAAG,QAAQ,GAAG,MAAM,GAAG,cAAc,CAAC;AAEjF;;;;GAIG;AACH,KAAK,gBAAgB,GAAG;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9B;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAC7B;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"chat.types.d.ts","sourceRoot":"","sources":["../../../src/types/chat.types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,WAAW,GAAG,QAAQ,GAAG,MAAM,GAAG,cAAc,CAAC;AAEjF;;;;GAIG;AACH,KAAK,gBAAgB,GAAG;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,IA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'none';
|
|
|
9
9
|
*
|
|
10
10
|
* @beta
|
|
11
11
|
*/
|
|
12
|
-
export type GeminiModelId = 'gemini-2.5-flash' | 'gemini-2.5-flash-lite';
|
|
12
|
+
export type GeminiModelId = 'gemini-2.5-pro' | 'gemini-2.5-flash' | 'gemini-2.5-flash-lite';
|
|
13
13
|
/** @beta */
|
|
14
14
|
export declare const SUPPORTED_GEMINI_MODEL_IDS: readonly GeminiModelId[];
|
|
15
15
|
/**
|
|
@@ -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;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG,kBAAkB,GAAG,uBAAuB,CAAC;
|
|
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;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG,gBAAgB,GAAG,kBAAkB,GAAG,uBAAuB,CAAC;AAE5F,YAAY;AACZ,eAAO,MAAM,0BAA0B,EAAE,SAAS,aAAa,EAIrD,CAAC;AAEX;;;;;;;;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,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,cAAe,SAAQ,gBAAgB;IACtD,YAAY,EAAE,QAAQ,CAAC;IACvB,4GAA4G;IAC5G,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;GAKG;AACH,MAAM,MAAM,QAAQ,GAAG,cAAc,GAAG,cAAc,GAAG,cAAc,CAAC"}
|
|
@@ -16,6 +16,9 @@ function estimatedGeminiPaidRatesUsdPerMillion(model) {
|
|
|
16
16
|
if (model === 'gemini-2.5-flash-lite') {
|
|
17
17
|
return { promptPerMillion: 0.1, candidatePerMillion: 0.4 };
|
|
18
18
|
}
|
|
19
|
+
if (model === 'gemini-2.5-pro') {
|
|
20
|
+
return { promptPerMillion: 1.25, candidatePerMillion: 10.0 };
|
|
21
|
+
}
|
|
19
22
|
return { promptPerMillion: 0.3, candidatePerMillion: 2.5 };
|
|
20
23
|
}
|
|
21
24
|
/**
|
|
@@ -50,6 +53,9 @@ export class GeminiTransport {
|
|
|
50
53
|
if (model === 'gemini-2.5-flash') {
|
|
51
54
|
logger.warn('GeminiTransport: using gemini-2.5-flash — higher cost than flash-lite; use for harder reasoning or agent tasks.');
|
|
52
55
|
}
|
|
56
|
+
else if (model === 'gemini-2.5-pro') {
|
|
57
|
+
logger.warn('GeminiTransport: using gemini-2.5-pro — significantly higher cost; reserve for tasks where flash reliability is insufficient.');
|
|
58
|
+
}
|
|
53
59
|
this.timeout = (_b = config.timeout) !== null && _b !== void 0 ? _b : DEFAULT_TIMEOUT;
|
|
54
60
|
this.apiKey = config.apiKey;
|
|
55
61
|
this.serverEndpoint = config.serverEndpoint;
|
|
@@ -107,26 +113,33 @@ export class GeminiTransport {
|
|
|
107
113
|
console.log('--------------------------');
|
|
108
114
|
}
|
|
109
115
|
toGeminiContents(history, userMessage, attachments) {
|
|
110
|
-
var _a, _b;
|
|
116
|
+
var _a, _b, _c;
|
|
111
117
|
const contents = [];
|
|
118
|
+
// Gemini requires functionResponse.name to match the original functionCall.name.
|
|
119
|
+
// Our internal IDs are UUIDs, so build a lookup from ID → function name as we go.
|
|
120
|
+
const toolCallNameById = new Map();
|
|
112
121
|
for (const msg of history) {
|
|
113
122
|
if (msg.role === 'system' || msg.role === 'system-event' || msg.thinking)
|
|
114
123
|
continue;
|
|
115
124
|
const role = msg.role === 'user' ? 'user' : 'model';
|
|
116
125
|
if (msg.toolResult) {
|
|
126
|
+
const fnName = (_a = toolCallNameById.get(msg.toolResult.toolCallId)) !== null && _a !== void 0 ? _a : msg.toolResult.toolCallId;
|
|
117
127
|
contents.push({
|
|
118
128
|
role: 'user',
|
|
119
129
|
parts: [
|
|
120
130
|
{
|
|
121
131
|
functionResponse: {
|
|
122
|
-
name:
|
|
132
|
+
name: fnName,
|
|
123
133
|
response: { content: msg.toolResult.content },
|
|
124
134
|
},
|
|
125
135
|
},
|
|
126
136
|
],
|
|
127
137
|
});
|
|
128
138
|
}
|
|
129
|
-
else if ((
|
|
139
|
+
else if ((_b = msg.toolCalls) === null || _b === void 0 ? void 0 : _b.length) {
|
|
140
|
+
for (const tc of msg.toolCalls) {
|
|
141
|
+
toolCallNameById.set(tc.id, tc.name);
|
|
142
|
+
}
|
|
130
143
|
contents.push({
|
|
131
144
|
role: 'model',
|
|
132
145
|
parts: msg.toolCalls.map((tc) => ({
|
|
@@ -134,7 +147,7 @@ export class GeminiTransport {
|
|
|
134
147
|
})),
|
|
135
148
|
});
|
|
136
149
|
}
|
|
137
|
-
else if (role === 'user' && ((
|
|
150
|
+
else if (role === 'user' && ((_c = msg.attachments) === null || _c === void 0 ? void 0 : _c.length)) {
|
|
138
151
|
const msgAttachmentParts = msg.attachments.map((att) => ({
|
|
139
152
|
text: `[File: ${att.name}]\n${att.content}`,
|
|
140
153
|
}));
|
|
@@ -174,7 +187,7 @@ export class GeminiTransport {
|
|
|
174
187
|
for (const part of parts) {
|
|
175
188
|
if (part.functionCall) {
|
|
176
189
|
toolCalls.push({
|
|
177
|
-
id:
|
|
190
|
+
id: crypto.randomUUID(),
|
|
178
191
|
name: part.functionCall.name,
|
|
179
192
|
args: (_e = part.functionCall.args) !== null && _e !== void 0 ? _e : {},
|
|
180
193
|
});
|
|
@@ -241,7 +254,7 @@ export class GeminiTransport {
|
|
|
241
254
|
throw e;
|
|
242
255
|
}
|
|
243
256
|
clearTimeout(timeoutId);
|
|
244
|
-
if (response.status
|
|
257
|
+
if (GeminiTransport.RETRYABLE_STATUSES.includes(response.status) &&
|
|
245
258
|
attempt < GeminiTransport.MAX_RETRIES) {
|
|
246
259
|
// Exponential backoff: 1s, 2s, 4s, 8s, 16s
|
|
247
260
|
yield new Promise((resolve) => {
|
|
@@ -274,4 +287,9 @@ GeminiTransport.TOKENS_PER_MILLION = 1000000;
|
|
|
274
287
|
GeminiTransport.COST_DECIMAL_PLACES = 6;
|
|
275
288
|
GeminiTransport.MAX_RETRIES = 5;
|
|
276
289
|
GeminiTransport.RATE_LIMIT_STATUS = 429;
|
|
290
|
+
GeminiTransport.SERVICE_UNAVAILABLE_STATUS = 503;
|
|
291
|
+
GeminiTransport.RETRYABLE_STATUSES = [
|
|
292
|
+
GeminiTransport.RATE_LIMIT_STATUS,
|
|
293
|
+
GeminiTransport.SERVICE_UNAVAILABLE_STATUS,
|
|
294
|
+
];
|
|
277
295
|
GeminiTransport.BACKOFF_BASE_MS = 1000;
|
|
@@ -2125,11 +2125,27 @@
|
|
|
2125
2125
|
{
|
|
2126
2126
|
"kind": "TypeAlias",
|
|
2127
2127
|
"canonicalReference": "@genesislcap/foundation-ai!ChatToolHandlers:type",
|
|
2128
|
-
"docComment": "/**\n * Map of tool name to async handler function.\n *\n * @beta\n */\n",
|
|
2128
|
+
"docComment": "/**\n * Map of tool name to async handler function.\n *\n * Optionally parameterised with the sub-agents available to this handler set. Pass the config objects (not string literals) so the name union is derived from the actual configs:\n * ```ts\n * const mySubAgent = { name: 'my_sub_agent', ... } satisfies AgentConfig;\n * type MyHandlers = ChatToolHandlers<typeof mySubAgent>;\n * // requestSubAgent's name param is now typed as 'my_sub_agent'\n * ```\n *\n * Multiple sub-agents: `ChatToolHandlers<typeof agentA | typeof agentB>`. Default (`{ name: string }`) leaves the name param as `string` — no breaking change.\n *\n * @beta\n */\n",
|
|
2129
2129
|
"excerptTokens": [
|
|
2130
2130
|
{
|
|
2131
2131
|
"kind": "Content",
|
|
2132
|
-
"text": "export type ChatToolHandlers
|
|
2132
|
+
"text": "export type ChatToolHandlers<TSubAgent extends "
|
|
2133
|
+
},
|
|
2134
|
+
{
|
|
2135
|
+
"kind": "Content",
|
|
2136
|
+
"text": "{\n name: string;\n}"
|
|
2137
|
+
},
|
|
2138
|
+
{
|
|
2139
|
+
"kind": "Content",
|
|
2140
|
+
"text": " = "
|
|
2141
|
+
},
|
|
2142
|
+
{
|
|
2143
|
+
"kind": "Content",
|
|
2144
|
+
"text": "{\n name: string;\n}"
|
|
2145
|
+
},
|
|
2146
|
+
{
|
|
2147
|
+
"kind": "Content",
|
|
2148
|
+
"text": "> = "
|
|
2133
2149
|
},
|
|
2134
2150
|
{
|
|
2135
2151
|
"kind": "Reference",
|
|
@@ -2156,7 +2172,25 @@
|
|
|
2156
2172
|
},
|
|
2157
2173
|
{
|
|
2158
2174
|
"kind": "Content",
|
|
2159
|
-
"text": "<T>;\n
|
|
2175
|
+
"text": "<T>;\n requestSubAgent?: <T = never>(name: TSubAgent['name'], options?: "
|
|
2176
|
+
},
|
|
2177
|
+
{
|
|
2178
|
+
"kind": "Reference",
|
|
2179
|
+
"text": "SubAgentRequestOptions",
|
|
2180
|
+
"canonicalReference": "@genesislcap/foundation-ai!SubAgentRequestOptions:interface"
|
|
2181
|
+
},
|
|
2182
|
+
{
|
|
2183
|
+
"kind": "Content",
|
|
2184
|
+
"text": ") => "
|
|
2185
|
+
},
|
|
2186
|
+
{
|
|
2187
|
+
"kind": "Reference",
|
|
2188
|
+
"text": "Promise",
|
|
2189
|
+
"canonicalReference": "!Promise:interface"
|
|
2190
|
+
},
|
|
2191
|
+
{
|
|
2192
|
+
"kind": "Content",
|
|
2193
|
+
"text": "<T | string>;\n completeSubAgent?: (result: unknown) => void;\n}) => "
|
|
2160
2194
|
},
|
|
2161
2195
|
{
|
|
2162
2196
|
"kind": "Reference",
|
|
@@ -2175,9 +2209,22 @@
|
|
|
2175
2209
|
"fileUrlPath": "src/types/chat.types.ts",
|
|
2176
2210
|
"releaseTag": "Beta",
|
|
2177
2211
|
"name": "ChatToolHandlers",
|
|
2212
|
+
"typeParameters": [
|
|
2213
|
+
{
|
|
2214
|
+
"typeParameterName": "TSubAgent",
|
|
2215
|
+
"constraintTokenRange": {
|
|
2216
|
+
"startIndex": 1,
|
|
2217
|
+
"endIndex": 2
|
|
2218
|
+
},
|
|
2219
|
+
"defaultTypeTokenRange": {
|
|
2220
|
+
"startIndex": 3,
|
|
2221
|
+
"endIndex": 4
|
|
2222
|
+
}
|
|
2223
|
+
}
|
|
2224
|
+
],
|
|
2178
2225
|
"typeTokenRange": {
|
|
2179
|
-
"startIndex":
|
|
2180
|
-
"endIndex":
|
|
2226
|
+
"startIndex": 5,
|
|
2227
|
+
"endIndex": 17
|
|
2181
2228
|
}
|
|
2182
2229
|
},
|
|
2183
2230
|
{
|
|
@@ -3397,7 +3444,7 @@
|
|
|
3397
3444
|
},
|
|
3398
3445
|
{
|
|
3399
3446
|
"kind": "Content",
|
|
3400
|
-
"text": "'gemini-2.5-flash' | 'gemini-2.5-flash-lite'"
|
|
3447
|
+
"text": "'gemini-2.5-pro' | 'gemini-2.5-flash' | 'gemini-2.5-flash-lite'"
|
|
3401
3448
|
},
|
|
3402
3449
|
{
|
|
3403
3450
|
"kind": "Content",
|
|
@@ -4722,6 +4769,110 @@
|
|
|
4722
4769
|
],
|
|
4723
4770
|
"name": "startSpeechRecognition"
|
|
4724
4771
|
},
|
|
4772
|
+
{
|
|
4773
|
+
"kind": "Interface",
|
|
4774
|
+
"canonicalReference": "@genesislcap/foundation-ai!SubAgentRequestOptions:interface",
|
|
4775
|
+
"docComment": "/**\n * Options passed to `requestSubAgent` at call time.\n *\n * @beta\n */\n",
|
|
4776
|
+
"excerptTokens": [
|
|
4777
|
+
{
|
|
4778
|
+
"kind": "Content",
|
|
4779
|
+
"text": "export interface SubAgentRequestOptions "
|
|
4780
|
+
}
|
|
4781
|
+
],
|
|
4782
|
+
"fileUrlPath": "src/types/chat.types.ts",
|
|
4783
|
+
"releaseTag": "Beta",
|
|
4784
|
+
"name": "SubAgentRequestOptions",
|
|
4785
|
+
"preserveMemberOrder": false,
|
|
4786
|
+
"members": [
|
|
4787
|
+
{
|
|
4788
|
+
"kind": "PropertySignature",
|
|
4789
|
+
"canonicalReference": "@genesislcap/foundation-ai!SubAgentRequestOptions#context:member",
|
|
4790
|
+
"docComment": "/**\n * Extra dynamic data injected as a primer message before the task.\n */\n",
|
|
4791
|
+
"excerptTokens": [
|
|
4792
|
+
{
|
|
4793
|
+
"kind": "Content",
|
|
4794
|
+
"text": "context?: "
|
|
4795
|
+
},
|
|
4796
|
+
{
|
|
4797
|
+
"kind": "Reference",
|
|
4798
|
+
"text": "Record",
|
|
4799
|
+
"canonicalReference": "!Record:type"
|
|
4800
|
+
},
|
|
4801
|
+
{
|
|
4802
|
+
"kind": "Content",
|
|
4803
|
+
"text": "<string, unknown>"
|
|
4804
|
+
},
|
|
4805
|
+
{
|
|
4806
|
+
"kind": "Content",
|
|
4807
|
+
"text": ";"
|
|
4808
|
+
}
|
|
4809
|
+
],
|
|
4810
|
+
"isReadonly": false,
|
|
4811
|
+
"isOptional": true,
|
|
4812
|
+
"releaseTag": "Beta",
|
|
4813
|
+
"name": "context",
|
|
4814
|
+
"propertyTypeTokenRange": {
|
|
4815
|
+
"startIndex": 1,
|
|
4816
|
+
"endIndex": 3
|
|
4817
|
+
}
|
|
4818
|
+
},
|
|
4819
|
+
{
|
|
4820
|
+
"kind": "PropertySignature",
|
|
4821
|
+
"canonicalReference": "@genesislcap/foundation-ai!SubAgentRequestOptions#historyCap:member",
|
|
4822
|
+
"docComment": "/**\n * Per-call override of the config-level historyCap.\n */\n",
|
|
4823
|
+
"excerptTokens": [
|
|
4824
|
+
{
|
|
4825
|
+
"kind": "Content",
|
|
4826
|
+
"text": "historyCap?: "
|
|
4827
|
+
},
|
|
4828
|
+
{
|
|
4829
|
+
"kind": "Content",
|
|
4830
|
+
"text": "number"
|
|
4831
|
+
},
|
|
4832
|
+
{
|
|
4833
|
+
"kind": "Content",
|
|
4834
|
+
"text": ";"
|
|
4835
|
+
}
|
|
4836
|
+
],
|
|
4837
|
+
"isReadonly": false,
|
|
4838
|
+
"isOptional": true,
|
|
4839
|
+
"releaseTag": "Beta",
|
|
4840
|
+
"name": "historyCap",
|
|
4841
|
+
"propertyTypeTokenRange": {
|
|
4842
|
+
"startIndex": 1,
|
|
4843
|
+
"endIndex": 2
|
|
4844
|
+
}
|
|
4845
|
+
},
|
|
4846
|
+
{
|
|
4847
|
+
"kind": "PropertySignature",
|
|
4848
|
+
"canonicalReference": "@genesislcap/foundation-ai!SubAgentRequestOptions#task:member",
|
|
4849
|
+
"docComment": "/**\n * Plain-language description of what this specific invocation should do.\n */\n",
|
|
4850
|
+
"excerptTokens": [
|
|
4851
|
+
{
|
|
4852
|
+
"kind": "Content",
|
|
4853
|
+
"text": "task?: "
|
|
4854
|
+
},
|
|
4855
|
+
{
|
|
4856
|
+
"kind": "Content",
|
|
4857
|
+
"text": "string"
|
|
4858
|
+
},
|
|
4859
|
+
{
|
|
4860
|
+
"kind": "Content",
|
|
4861
|
+
"text": ";"
|
|
4862
|
+
}
|
|
4863
|
+
],
|
|
4864
|
+
"isReadonly": false,
|
|
4865
|
+
"isOptional": true,
|
|
4866
|
+
"releaseTag": "Beta",
|
|
4867
|
+
"name": "task",
|
|
4868
|
+
"propertyTypeTokenRange": {
|
|
4869
|
+
"startIndex": 1,
|
|
4870
|
+
"endIndex": 2
|
|
4871
|
+
}
|
|
4872
|
+
}
|
|
4873
|
+
],
|
|
4874
|
+
"extendsTokenRanges": []
|
|
4875
|
+
},
|
|
4725
4876
|
{
|
|
4726
4877
|
"kind": "Variable",
|
|
4727
4878
|
"canonicalReference": "@genesislcap/foundation-ai!SUPPORTED_GEMINI_MODEL_IDS:var",
|
package/dist/foundation-ai.d.ts
CHANGED
|
@@ -310,6 +310,12 @@ declare type ChatToolCallBase = {
|
|
|
310
310
|
* Not sent to the AI provider.
|
|
311
311
|
*/
|
|
312
312
|
foldPath?: string[];
|
|
313
|
+
/**
|
|
314
|
+
* Full message history from the sub-agent run that produced this tool call's result.
|
|
315
|
+
* Populated by SubAgentRunner when a tool handler delegates to a sub-agent.
|
|
316
|
+
* UI-only — not sent to the AI provider.
|
|
317
|
+
*/
|
|
318
|
+
subAgentTrace?: ChatMessage[];
|
|
313
319
|
};
|
|
314
320
|
|
|
315
321
|
/**
|
|
@@ -338,10 +344,39 @@ export declare interface ChatToolDefinition {
|
|
|
338
344
|
/**
|
|
339
345
|
* Map of tool name to async handler function.
|
|
340
346
|
*
|
|
347
|
+
* Optionally parameterised with the sub-agents available to this handler set.
|
|
348
|
+
* Pass the config objects (not string literals) so the name union is derived
|
|
349
|
+
* from the actual configs:
|
|
350
|
+
*
|
|
351
|
+
* ```ts
|
|
352
|
+
* const mySubAgent = { name: 'my_sub_agent', ... } satisfies AgentConfig;
|
|
353
|
+
* type MyHandlers = ChatToolHandlers<typeof mySubAgent>;
|
|
354
|
+
* // requestSubAgent's name param is now typed as 'my_sub_agent'
|
|
355
|
+
* ```
|
|
356
|
+
*
|
|
357
|
+
* Multiple sub-agents: `ChatToolHandlers<typeof agentA | typeof agentB>`.
|
|
358
|
+
* Default (`{ name: string }`) leaves the name param as `string` — no breaking change.
|
|
359
|
+
*
|
|
341
360
|
* @beta
|
|
342
361
|
*/
|
|
343
|
-
export declare type ChatToolHandlers
|
|
362
|
+
export declare type ChatToolHandlers<TSubAgent extends {
|
|
363
|
+
name: string;
|
|
364
|
+
} = {
|
|
365
|
+
name: string;
|
|
366
|
+
}> = Record<string, (args: Record<string, unknown>, context: {
|
|
344
367
|
requestInteraction: <T = unknown>(componentName: string, data: any) => Promise<T>;
|
|
368
|
+
/**
|
|
369
|
+
* Delegate to a named sub-agent declared on the parent agent config.
|
|
370
|
+
* Returns the sub-agent's structured result (when `completeSubAgent` was called) or
|
|
371
|
+
* its final assistant message text as a fallback.
|
|
372
|
+
*/
|
|
373
|
+
requestSubAgent?: <T = never>(name: TSubAgent['name'], options?: SubAgentRequestOptions) => Promise<T | string>;
|
|
374
|
+
/**
|
|
375
|
+
* Signal explicit completion from within a sub-agent tool handler.
|
|
376
|
+
* The resolved value is returned to the parent handler as the structured result of
|
|
377
|
+
* `requestSubAgent`. Only available inside sub-agent tool handlers.
|
|
378
|
+
*/
|
|
379
|
+
completeSubAgent?: (result: unknown) => void;
|
|
345
380
|
}) => Promise<unknown>>;
|
|
346
381
|
|
|
347
382
|
/**
|
|
@@ -525,7 +560,7 @@ export declare interface GeminiAIConfig extends AIProviderConfig {
|
|
|
525
560
|
*
|
|
526
561
|
* @beta
|
|
527
562
|
*/
|
|
528
|
-
export declare type GeminiModelId = 'gemini-2.5-flash' | 'gemini-2.5-flash-lite';
|
|
563
|
+
export declare type GeminiModelId = 'gemini-2.5-pro' | 'gemini-2.5-flash' | 'gemini-2.5-flash-lite';
|
|
529
564
|
|
|
530
565
|
/**
|
|
531
566
|
* Gemini AI provider. Uses {@link GeminiTransport} to handle requests.
|
|
@@ -577,6 +612,8 @@ export declare class GeminiTransport implements AITransport, ChatTransport {
|
|
|
577
612
|
private buildEndpoint;
|
|
578
613
|
private static readonly MAX_RETRIES;
|
|
579
614
|
private static readonly RATE_LIMIT_STATUS;
|
|
615
|
+
private static readonly SERVICE_UNAVAILABLE_STATUS;
|
|
616
|
+
private static readonly RETRYABLE_STATUSES;
|
|
580
617
|
private static readonly BACKOFF_BASE_MS;
|
|
581
618
|
private post;
|
|
582
619
|
private toDirectPayload;
|
|
@@ -730,6 +767,20 @@ declare interface StructuredPromptOptions {
|
|
|
730
767
|
responseSchema?: object;
|
|
731
768
|
}
|
|
732
769
|
|
|
770
|
+
/**
|
|
771
|
+
* Options passed to `requestSubAgent` at call time.
|
|
772
|
+
*
|
|
773
|
+
* @beta
|
|
774
|
+
*/
|
|
775
|
+
export declare interface SubAgentRequestOptions {
|
|
776
|
+
/** Plain-language description of what this specific invocation should do. */
|
|
777
|
+
task?: string;
|
|
778
|
+
/** Per-call override of the config-level historyCap. */
|
|
779
|
+
historyCap?: number;
|
|
780
|
+
/** Extra dynamic data injected as a primer message before the task. */
|
|
781
|
+
context?: Record<string, unknown>;
|
|
782
|
+
}
|
|
783
|
+
|
|
733
784
|
/** @beta */
|
|
734
785
|
export declare const SUPPORTED_GEMINI_MODEL_IDS: readonly GeminiModelId[];
|
|
735
786
|
|
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.
|
|
4
|
+
"version": "14.422.1-alpha-6f2ae99.0",
|
|
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.
|
|
55
|
-
"@genesislcap/genx": "14.
|
|
56
|
-
"@genesislcap/rollup-builder": "14.
|
|
57
|
-
"@genesislcap/ts-builder": "14.
|
|
58
|
-
"@genesislcap/uvu-playwright-builder": "14.
|
|
59
|
-
"@genesislcap/vite-builder": "14.
|
|
60
|
-
"@genesislcap/webpack-builder": "14.
|
|
54
|
+
"@genesislcap/foundation-testing": "14.422.1-alpha-6f2ae99.0",
|
|
55
|
+
"@genesislcap/genx": "14.422.1-alpha-6f2ae99.0",
|
|
56
|
+
"@genesislcap/rollup-builder": "14.422.1-alpha-6f2ae99.0",
|
|
57
|
+
"@genesislcap/ts-builder": "14.422.1-alpha-6f2ae99.0",
|
|
58
|
+
"@genesislcap/uvu-playwright-builder": "14.422.1-alpha-6f2ae99.0",
|
|
59
|
+
"@genesislcap/vite-builder": "14.422.1-alpha-6f2ae99.0",
|
|
60
|
+
"@genesislcap/webpack-builder": "14.422.1-alpha-6f2ae99.0"
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
|
-
"@genesislcap/foundation-logger": "14.
|
|
64
|
-
"@genesislcap/foundation-utils": "14.
|
|
63
|
+
"@genesislcap/foundation-logger": "14.422.1-alpha-6f2ae99.0",
|
|
64
|
+
"@genesislcap/foundation-utils": "14.422.1-alpha-6f2ae99.0",
|
|
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": "945d2b920b348b5d2cbd2ed34cb3cc2ff338a375"
|
|
76
76
|
}
|