@genesislcap/foundation-ai 14.494.0 → 14.496.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/ai-provider-di.d.ts +136 -0
- package/dist/dts/ai-provider-di.d.ts.map +1 -0
- package/dist/dts/ai-provider.d.ts +1 -112
- package/dist/dts/ai-provider.d.ts.map +1 -1
- package/dist/dts/index.d.ts +5 -3
- package/dist/dts/index.d.ts.map +1 -1
- package/dist/dts/transports/anthropic-transport.d.ts.map +1 -1
- package/dist/dts/transports/gemini-transport.d.ts.map +1 -1
- package/dist/dts/types/chat.types.d.ts +63 -0
- 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/ai-provider-di.js +84 -0
- package/dist/esm/ai-provider.js +0 -83
- package/dist/esm/index.js +6 -1
- package/dist/esm/transports/anthropic-transport.js +99 -31
- package/dist/esm/transports/gemini-transport.js +12 -1
- package/dist/esm/types/config.types.js +2 -0
- package/dist/foundation-ai.api.json +174 -8
- package/dist/foundation-ai.d.ts +66 -1
- package/package.json +11 -11
package/dist/foundation-ai.d.ts
CHANGED
|
@@ -227,7 +227,7 @@ export declare interface AnthropicAIConfig extends AIProviderConfig {
|
|
|
227
227
|
*
|
|
228
228
|
* @beta
|
|
229
229
|
*/
|
|
230
|
-
export declare type AnthropicModelId = 'claude-opus-4-7' | 'claude-sonnet-5' | 'claude-sonnet-4-6' | 'claude-haiku-4-5-20251001';
|
|
230
|
+
export declare type AnthropicModelId = 'claude-fable-5' | 'claude-opus-4-8' | 'claude-opus-4-7' | 'claude-sonnet-5' | 'claude-sonnet-4-6' | 'claude-haiku-4-5-20251001';
|
|
231
231
|
|
|
232
232
|
/**
|
|
233
233
|
* Anthropic Claude AI provider. Uses {@link AnthropicTransport} to handle requests.
|
|
@@ -565,12 +565,32 @@ export declare interface ChatCostHistoryConfig {
|
|
|
565
565
|
*/
|
|
566
566
|
export declare type ChatDriverResult = {
|
|
567
567
|
reason: 'done';
|
|
568
|
+
/**
|
|
569
|
+
* Set when the turn ended in a typed failure rather than a clean completion
|
|
570
|
+
* (see {@link TurnFailureReason}). **Additive and optional**: the discriminant
|
|
571
|
+
* stays `'done'` for every exit — success and failure alike — so existing
|
|
572
|
+
* consumers matching on `reason === 'done'` behave identically. Absent on a
|
|
573
|
+
* successful turn, a user cancel, and a driver dispose (none are failures).
|
|
574
|
+
*/
|
|
575
|
+
failureReason?: TurnFailureReason;
|
|
568
576
|
} | {
|
|
569
577
|
reason: 'agent-handoff';
|
|
570
578
|
summary: string;
|
|
571
579
|
remainingTask: string;
|
|
572
580
|
};
|
|
573
581
|
|
|
582
|
+
/**
|
|
583
|
+
* One entry in a {@link ChatRequestOptions.fallbacks} chain.
|
|
584
|
+
*
|
|
585
|
+
* @beta
|
|
586
|
+
*/
|
|
587
|
+
export declare interface ChatFallback {
|
|
588
|
+
/** Model id to fall back to (e.g. `'claude-opus-4-8'`). */
|
|
589
|
+
model: string;
|
|
590
|
+
/** Optional per-hop `max_tokens` cap for this fallback attempt. */
|
|
591
|
+
maxTokens?: number;
|
|
592
|
+
}
|
|
593
|
+
|
|
574
594
|
/**
|
|
575
595
|
* Controls how the main chat input area behaves while an agent (or sub-agent)
|
|
576
596
|
* is executing.
|
|
@@ -775,6 +795,29 @@ export declare interface ChatRequestOptions {
|
|
|
775
795
|
* @beta
|
|
776
796
|
*/
|
|
777
797
|
tailContext?: string;
|
|
798
|
+
/**
|
|
799
|
+
* Provider-neutral refusal-fallback chain: if the model declines the request
|
|
800
|
+
* (`stop_reason: 'refusal'`, e.g. Fable 5 safety classifiers), the provider re-runs the
|
|
801
|
+
* same request on the next listed model and returns its answer. Ordered most- to
|
|
802
|
+
* least-preferred; each entry may cap its own `maxTokens`. Providers that support it
|
|
803
|
+
* apply it server-side (Anthropic: `fallbacks` + the `server-side-fallback` beta); others
|
|
804
|
+
* ignore it. Typical use: Fable 5 with an Opus 4.8 fallback.
|
|
805
|
+
*
|
|
806
|
+
* @beta
|
|
807
|
+
*/
|
|
808
|
+
fallbacks?: ChatFallback[];
|
|
809
|
+
/**
|
|
810
|
+
* Structured-output schema (JSON Schema) for this turn. When set, the model's final (non-tool)
|
|
811
|
+
* answer is constrained to it instead of free text. Composes with `tools` — the model may still
|
|
812
|
+
* call tools this turn, then conform its closing answer to the schema. Providers apply it
|
|
813
|
+
* natively where the model supports it (Anthropic `output_config.format`, Gemini JSON mode) and
|
|
814
|
+
* drop it otherwise (caller keeps a prompt-instruction + validator fallback). Keep to the
|
|
815
|
+
* portable JSON-Schema subset providers share (`additionalProperties: false`, explicit
|
|
816
|
+
* `required`, enums, `anyOf` for nullables — no numeric/string constraints or recursion).
|
|
817
|
+
*
|
|
818
|
+
* @beta
|
|
819
|
+
*/
|
|
820
|
+
responseSchema?: object;
|
|
778
821
|
}
|
|
779
822
|
|
|
780
823
|
/**
|
|
@@ -2096,4 +2139,26 @@ export declare const SUPPORTED_ANTHROPIC_MODEL_IDS: readonly AnthropicModelId[];
|
|
|
2096
2139
|
/** @beta */
|
|
2097
2140
|
export declare const SUPPORTED_GEMINI_MODEL_IDS: readonly GeminiModelId[];
|
|
2098
2141
|
|
|
2142
|
+
/**
|
|
2143
|
+
* Why a driver turn ended in failure — the typed taxonomy the tool loop already
|
|
2144
|
+
* records onto its debug-log timeline (`turn.error` / `turn.retry` details),
|
|
2145
|
+
* surfaced here so callers of a turn can read the outcome structurally instead of
|
|
2146
|
+
* scraping prose. Distinct from {@link SubAgentFailureReason} (underscored, its own
|
|
2147
|
+
* `timeout` member) because the two enums serialise into different log surfaces and
|
|
2148
|
+
* READMEs; a transport request timeout on the main turn is recorded as `exception`.
|
|
2149
|
+
*
|
|
2150
|
+
* - `exception` — an uncaught error escaped the tool loop (catch-all,
|
|
2151
|
+
* includes a transport request timeout).
|
|
2152
|
+
* - `malformed-function-call` — the provider returned an unparseable tool call.
|
|
2153
|
+
* - `empty-response` — the model returned no content and no tool calls.
|
|
2154
|
+
* - `unknown-tool-limit` — the model repeatedly called tools it couldn't dispatch,
|
|
2155
|
+
* whether hallucinated or stale (real earlier, retired now).
|
|
2156
|
+
* - `max-iterations` — the tool loop hit its iteration cap.
|
|
2157
|
+
* - `response-truncated` — a turn stopped at the provider's output-token cap with an
|
|
2158
|
+
* incomplete tool call; deterministic, so it bails without retry.
|
|
2159
|
+
*
|
|
2160
|
+
* @beta
|
|
2161
|
+
*/
|
|
2162
|
+
export declare type TurnFailureReason = 'exception' | 'malformed-function-call' | 'empty-response' | 'unknown-tool-limit' | 'max-iterations' | 'response-truncated';
|
|
2163
|
+
|
|
2099
2164
|
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.
|
|
4
|
+
"version": "14.496.0",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"license": "SEE LICENSE IN license.txt",
|
|
7
7
|
"main": "dist/esm/index.js",
|
|
@@ -52,17 +52,17 @@
|
|
|
52
52
|
}
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"@genesislcap/foundation-testing": "14.
|
|
56
|
-
"@genesislcap/genx": "14.
|
|
57
|
-
"@genesislcap/rollup-builder": "14.
|
|
58
|
-
"@genesislcap/ts-builder": "14.
|
|
59
|
-
"@genesislcap/uvu-playwright-builder": "14.
|
|
60
|
-
"@genesislcap/vite-builder": "14.
|
|
61
|
-
"@genesislcap/webpack-builder": "14.
|
|
55
|
+
"@genesislcap/foundation-testing": "14.496.0",
|
|
56
|
+
"@genesislcap/genx": "14.496.0",
|
|
57
|
+
"@genesislcap/rollup-builder": "14.496.0",
|
|
58
|
+
"@genesislcap/ts-builder": "14.496.0",
|
|
59
|
+
"@genesislcap/uvu-playwright-builder": "14.496.0",
|
|
60
|
+
"@genesislcap/vite-builder": "14.496.0",
|
|
61
|
+
"@genesislcap/webpack-builder": "14.496.0"
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@genesislcap/foundation-logger": "14.
|
|
65
|
-
"@genesislcap/foundation-utils": "14.
|
|
64
|
+
"@genesislcap/foundation-logger": "14.496.0",
|
|
65
|
+
"@genesislcap/foundation-utils": "14.496.0",
|
|
66
66
|
"@microsoft/fast-foundation": "2.50.0"
|
|
67
67
|
},
|
|
68
68
|
"repository": {
|
|
@@ -73,5 +73,5 @@
|
|
|
73
73
|
"publishConfig": {
|
|
74
74
|
"access": "public"
|
|
75
75
|
},
|
|
76
|
-
"gitHead": "
|
|
76
|
+
"gitHead": "2ae3ec60cab8440c6beb1da84e2d47239b11e9b5"
|
|
77
77
|
}
|