@genesislcap/foundation-ai 14.454.2 → 14.455.1
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 +2 -1
- 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-malformed-call.d.ts +17 -0
- package/dist/dts/transports/gemini-malformed-call.d.ts.map +1 -0
- package/dist/dts/transports/gemini-transport.d.ts +10 -0
- package/dist/dts/transports/gemini-transport.d.ts.map +1 -1
- package/dist/dts/types/chat.types.d.ts +87 -9
- package/dist/dts/types/chat.types.d.ts.map +1 -1
- package/dist/dts/utils/temperature.d.ts +49 -0
- package/dist/dts/utils/temperature.d.ts.map +1 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/transports/anthropic-transport.js +32 -5
- package/dist/esm/transports/gemini-malformed-call.js +242 -0
- package/dist/esm/transports/gemini-transport.js +156 -31
- package/dist/esm/utils/temperature.js +56 -0
- package/dist/foundation-ai.api.json +234 -3
- package/dist/foundation-ai.d.ts +126 -9
- package/package.json +11 -11
package/dist/foundation-ai.d.ts
CHANGED
|
@@ -512,6 +512,15 @@ export declare interface ChatMessage {
|
|
|
512
512
|
* cost without re-deriving rates.
|
|
513
513
|
*/
|
|
514
514
|
cost?: number;
|
|
515
|
+
/**
|
|
516
|
+
* Provider diagnostic for the request that produced this message — the raw
|
|
517
|
+
* finish reason plus, where the provider reports them, the reasoning-token
|
|
518
|
+
* count and a parts breakdown. Set by transports that expose it (Gemini); the
|
|
519
|
+
* driver folds it into the debug-log meta events (e.g. an empty-response
|
|
520
|
+
* `turn.retry`/`turn.error`) so a blank or truncated turn's cause is legible.
|
|
521
|
+
* Not shown to the user.
|
|
522
|
+
*/
|
|
523
|
+
responseMeta?: ChatResponseMeta;
|
|
515
524
|
}
|
|
516
525
|
|
|
517
526
|
/**
|
|
@@ -525,19 +534,59 @@ export declare interface ChatRequestOptions {
|
|
|
525
534
|
attachments?: ChatAttachment[];
|
|
526
535
|
signal?: AbortSignal;
|
|
527
536
|
/**
|
|
528
|
-
* Whether the model
|
|
529
|
-
*
|
|
530
|
-
*
|
|
531
|
-
*
|
|
532
|
-
* can only end a turn by calling a tool (e.g. its completion tool), never by
|
|
533
|
-
* emitting a free-text answer.
|
|
537
|
+
* Whether (and how) the model may call a tool this turn. Defaults to `'auto'`
|
|
538
|
+
* when omitted. Used by sub-agent loops (which force `'required'` so a turn
|
|
539
|
+
* can only end via a tool call) and configurable per agent / per agent state.
|
|
540
|
+
* See {@link ChatToolChoice}.
|
|
534
541
|
*
|
|
535
|
-
*
|
|
536
|
-
|
|
542
|
+
* @beta
|
|
543
|
+
*/
|
|
544
|
+
toolChoice?: ChatToolChoice;
|
|
545
|
+
/**
|
|
546
|
+
* Provider-agnostic sampling temperature, normalized to `0`–`1` and anchored
|
|
547
|
+
* on each provider's own default: `0` is fully deterministic, `0.5` is the
|
|
548
|
+
* provider's default, and `1` is the most random it allows. So `< 0.5` is
|
|
549
|
+
* "more focused than default" and `> 0.5` is "more random than default" on
|
|
550
|
+
* every provider, even though their native ranges differ (Anthropic
|
|
551
|
+
* `temperature` `0`–`1`, Gemini `generationConfig.temperature` `0`–`2`). Where
|
|
552
|
+
* a provider's default equals its max (Anthropic), the upper half is flat.
|
|
553
|
+
* Values outside `0`–`1` are clamped. Omit to use the provider/model default
|
|
554
|
+
* (equivalent to `0.5`). Prefer the `ChatTemperature` presets for common
|
|
555
|
+
* intents.
|
|
537
556
|
*
|
|
538
557
|
* @beta
|
|
539
558
|
*/
|
|
540
|
-
|
|
559
|
+
temperature?: number;
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
/**
|
|
563
|
+
* Provider-reported diagnostic for a single chat response, surfaced so the
|
|
564
|
+
* driver can attribute a blank/abnormal turn without re-deriving it. All fields
|
|
565
|
+
* are optional — a transport sets only what its provider reports.
|
|
566
|
+
*
|
|
567
|
+
* @beta
|
|
568
|
+
*/
|
|
569
|
+
export declare interface ChatResponseMeta {
|
|
570
|
+
/**
|
|
571
|
+
* Raw provider finish reason for the turn, verbatim — e.g. Gemini `'STOP'` |
|
|
572
|
+
* `'MAX_TOKENS'` | `'SAFETY'` | `'RECITATION'`. The key signal when triaging a
|
|
573
|
+
* blank or truncated turn.
|
|
574
|
+
*/
|
|
575
|
+
finishReason?: string;
|
|
576
|
+
/**
|
|
577
|
+
* Reasoning ("thinking") tokens billed for this turn, when the provider
|
|
578
|
+
* reports them (Gemini 2.5). A high count alongside ~0 output tokens and a
|
|
579
|
+
* `'STOP'` finish is the "thought, then stopped without answering" signature.
|
|
580
|
+
*/
|
|
581
|
+
thoughtsTokens?: number;
|
|
582
|
+
/** Count of response parts by kind — distinguishes a truly empty turn from a thinking-only one. */
|
|
583
|
+
parts?: {
|
|
584
|
+
functionCall: number;
|
|
585
|
+
thought: number;
|
|
586
|
+
text: number;
|
|
587
|
+
};
|
|
588
|
+
/** Provider block reason when the prompt/response was blocked rather than generated. */
|
|
589
|
+
blockReason?: string;
|
|
541
590
|
}
|
|
542
591
|
|
|
543
592
|
/**
|
|
@@ -588,6 +637,33 @@ export declare type ChatSuggestionsConfig = {
|
|
|
588
637
|
prompt?: string;
|
|
589
638
|
};
|
|
590
639
|
|
|
640
|
+
/**
|
|
641
|
+
* Provider-agnostic, normalized sampling-temperature presets in `0`–`1` space —
|
|
642
|
+
* named handles for the values most callers actually want, so intent reads
|
|
643
|
+
* better than a bare magnitude. Each maps through `scaleTemperature` to the
|
|
644
|
+
* active provider's native range, so the same preset means the same intent
|
|
645
|
+
* whichever provider services the turn:
|
|
646
|
+
*
|
|
647
|
+
* - `ChatTemperature.Deterministic` (`0`) — greedy/argmax sampling.
|
|
648
|
+
* - `ChatTemperature.Focused` (`0.25`) — low but not greedy; precise tool calls
|
|
649
|
+
* and extraction work where you still want a little slack.
|
|
650
|
+
* - `ChatTemperature.Balanced` (`0.5`) — the provider's own default.
|
|
651
|
+
* - `ChatTemperature.Creative` (`0.75`) — hotter than default, short of the ceiling.
|
|
652
|
+
* - `ChatTemperature.Maximum` (`1`) — the hottest the active provider allows.
|
|
653
|
+
*
|
|
654
|
+
* (On a provider whose default equals its max — Anthropic — `Creative` and
|
|
655
|
+
* `Maximum` coincide; see `scaleTemperature`.)
|
|
656
|
+
*
|
|
657
|
+
* @beta
|
|
658
|
+
*/
|
|
659
|
+
export declare const ChatTemperature: {
|
|
660
|
+
readonly Deterministic: 0;
|
|
661
|
+
readonly Focused: 0.25;
|
|
662
|
+
readonly Balanced: 0.5;
|
|
663
|
+
readonly Creative: 0.75;
|
|
664
|
+
readonly Maximum: 1;
|
|
665
|
+
};
|
|
666
|
+
|
|
591
667
|
/**
|
|
592
668
|
* A tool call requested by the assistant.
|
|
593
669
|
*
|
|
@@ -644,6 +720,37 @@ export declare type ChatToolCallUnknown = ChatToolCallBase & {
|
|
|
644
720
|
stale?: boolean;
|
|
645
721
|
};
|
|
646
722
|
|
|
723
|
+
/**
|
|
724
|
+
* Controls whether (and how) the model may call a tool on a given turn. Maps to
|
|
725
|
+
* each provider's "tool choice" / "function calling mode" control:
|
|
726
|
+
*
|
|
727
|
+
* - `'auto'` (the default when omitted) — the model decides whether to call a
|
|
728
|
+
* tool or answer with text. Anthropic leaves `tool_choice` unset; Gemini
|
|
729
|
+
* leaves `functionCallingConfig` unset (`AUTO`).
|
|
730
|
+
* - `'required'` — the model MUST call one of the available tools. Maps to
|
|
731
|
+
* Anthropic `tool_choice: { type: 'any' }` and Gemini
|
|
732
|
+
* `functionCallingConfig.mode: 'ANY'`.
|
|
733
|
+
* - `'none'` — the model MUST NOT call a tool (text answer only). Maps to
|
|
734
|
+
* Anthropic `tool_choice: { type: 'none' }` and Gemini
|
|
735
|
+
* `functionCallingConfig.mode: 'NONE'`.
|
|
736
|
+
* - `{ tool: name }` — the model MUST call exactly the named tool. Maps to
|
|
737
|
+
* Anthropic `tool_choice: { type: 'tool', name }` and Gemini
|
|
738
|
+
* `functionCallingConfig.mode: 'ANY', allowedFunctionNames: [name]`. Use this
|
|
739
|
+
* for surgical forcing at a single-tool juncture (e.g. force a classifier
|
|
740
|
+
* tool in an intake step) while leaving `'auto'` everywhere multi-step work
|
|
741
|
+
* happens.
|
|
742
|
+
*
|
|
743
|
+
* Forcing (`'required'` / `{ tool }`) is a no-op when no tools are advertised.
|
|
744
|
+
*
|
|
745
|
+
* NOTE: forcing is incompatible with Anthropic extended/adaptive thinking — a
|
|
746
|
+
* request must not enable both.
|
|
747
|
+
*
|
|
748
|
+
* @beta
|
|
749
|
+
*/
|
|
750
|
+
export declare type ChatToolChoice = 'auto' | 'required' | 'none' | {
|
|
751
|
+
tool: string;
|
|
752
|
+
};
|
|
753
|
+
|
|
647
754
|
/**
|
|
648
755
|
* JSON Schema-based tool definition for function calling.
|
|
649
756
|
*
|
|
@@ -1019,6 +1126,16 @@ export declare class GeminiTransport implements AITransport, ChatTransport, Cost
|
|
|
1019
1126
|
private logTokenUsage;
|
|
1020
1127
|
private toGeminiContents;
|
|
1021
1128
|
private fromGeminiResponse;
|
|
1129
|
+
/**
|
|
1130
|
+
* Log the full shape of a blank or non-STOP response so its cause is legible
|
|
1131
|
+
* without re-deriving it: a thinking-only STOP (substantial `thoughtsTokenCount`,
|
|
1132
|
+
* ~0 `candidatesTokenCount`) vs a content block (`SAFETY` / `RECITATION`) vs a
|
|
1133
|
+
* token cap (`MAX_TOKENS`) vs a prompt-level block (top-level
|
|
1134
|
+
* `promptFeedback.blockReason`). On 2.5 Pro — which always thinks — a blank
|
|
1135
|
+
* STOP carrying substantial thought tokens is the "thought, then stopped
|
|
1136
|
+
* without answering" signature.
|
|
1137
|
+
*/
|
|
1138
|
+
private logAbnormalResponse;
|
|
1022
1139
|
private buildEndpoint;
|
|
1023
1140
|
private static readonly MAX_RETRIES;
|
|
1024
1141
|
private static readonly RATE_LIMIT_STATUS;
|
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.455.1",
|
|
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.455.1",
|
|
55
|
+
"@genesislcap/genx": "14.455.1",
|
|
56
|
+
"@genesislcap/rollup-builder": "14.455.1",
|
|
57
|
+
"@genesislcap/ts-builder": "14.455.1",
|
|
58
|
+
"@genesislcap/uvu-playwright-builder": "14.455.1",
|
|
59
|
+
"@genesislcap/vite-builder": "14.455.1",
|
|
60
|
+
"@genesislcap/webpack-builder": "14.455.1"
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
|
-
"@genesislcap/foundation-logger": "14.
|
|
64
|
-
"@genesislcap/foundation-utils": "14.
|
|
63
|
+
"@genesislcap/foundation-logger": "14.455.1",
|
|
64
|
+
"@genesislcap/foundation-utils": "14.455.1",
|
|
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": "241f307737ad1b5c690bb4c947e61b2697159196"
|
|
76
76
|
}
|