@fgv/ts-extras 5.1.0-44 → 5.1.0-46
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/packlets/ai-assist/apiClient.js +38 -14
- package/dist/packlets/ai-assist/apiClient.js.map +1 -1
- package/dist/packlets/ai-assist/index.js +2 -2
- package/dist/packlets/ai-assist/index.js.map +1 -1
- package/dist/packlets/ai-assist/jsonResponse.js +284 -10
- package/dist/packlets/ai-assist/jsonResponse.js.map +1 -1
- package/dist/packlets/ai-assist/model.js +108 -0
- package/dist/packlets/ai-assist/model.js.map +1 -1
- package/dist/packlets/ai-assist/registry.js +75 -17
- package/dist/packlets/ai-assist/registry.js.map +1 -1
- package/dist/packlets/ai-assist/streamingAdapters/anthropic.js +17 -6
- package/dist/packlets/ai-assist/streamingAdapters/anthropic.js.map +1 -1
- package/dist/packlets/ai-assist/streamingAdapters/clientToolContinuationBuilder.js +5 -5
- package/dist/packlets/ai-assist/streamingAdapters/clientToolContinuationBuilder.js.map +1 -1
- package/dist/packlets/ai-assist/streamingAdapters/common.js.map +1 -1
- package/dist/packlets/ai-assist/streamingAdapters/gemini.js +4 -1
- package/dist/packlets/ai-assist/streamingAdapters/gemini.js.map +1 -1
- package/dist/packlets/ai-assist/streamingAdapters/openaiChat.js +6 -1
- package/dist/packlets/ai-assist/streamingAdapters/openaiChat.js.map +1 -1
- package/dist/packlets/ai-assist/streamingAdapters/openaiResponses.js +5 -1
- package/dist/packlets/ai-assist/streamingAdapters/openaiResponses.js.map +1 -1
- package/dist/packlets/ai-assist/streamingAdapters/proxy.js +6 -1
- package/dist/packlets/ai-assist/streamingAdapters/proxy.js.map +1 -1
- package/dist/packlets/ai-assist/streamingClient.js +6 -6
- package/dist/packlets/ai-assist/streamingClient.js.map +1 -1
- package/dist/packlets/zip-file-tree/zipFileTreeAccessors.js +65 -7
- package/dist/packlets/zip-file-tree/zipFileTreeAccessors.js.map +1 -1
- package/dist/packlets/zip-file-tree/zipFileTreeWriter.js +16 -1
- package/dist/packlets/zip-file-tree/zipFileTreeWriter.js.map +1 -1
- package/dist/ts-extras.d.ts +396 -14
- package/lib/packlets/ai-assist/apiClient.d.ts +9 -0
- package/lib/packlets/ai-assist/apiClient.d.ts.map +1 -1
- package/lib/packlets/ai-assist/apiClient.js +37 -13
- package/lib/packlets/ai-assist/apiClient.js.map +1 -1
- package/lib/packlets/ai-assist/index.d.ts +2 -2
- package/lib/packlets/ai-assist/index.d.ts.map +1 -1
- package/lib/packlets/ai-assist/index.js +7 -1
- package/lib/packlets/ai-assist/index.js.map +1 -1
- package/lib/packlets/ai-assist/jsonResponse.d.ts +103 -0
- package/lib/packlets/ai-assist/jsonResponse.d.ts.map +1 -1
- package/lib/packlets/ai-assist/jsonResponse.js +285 -10
- package/lib/packlets/ai-assist/jsonResponse.js.map +1 -1
- package/lib/packlets/ai-assist/model.d.ts +144 -1
- package/lib/packlets/ai-assist/model.d.ts.map +1 -1
- package/lib/packlets/ai-assist/model.js +112 -1
- package/lib/packlets/ai-assist/model.js.map +1 -1
- package/lib/packlets/ai-assist/registry.d.ts +26 -6
- package/lib/packlets/ai-assist/registry.d.ts.map +1 -1
- package/lib/packlets/ai-assist/registry.js +75 -17
- package/lib/packlets/ai-assist/registry.js.map +1 -1
- package/lib/packlets/ai-assist/streamingAdapters/anthropic.d.ts +1 -1
- package/lib/packlets/ai-assist/streamingAdapters/anthropic.d.ts.map +1 -1
- package/lib/packlets/ai-assist/streamingAdapters/anthropic.js +17 -6
- package/lib/packlets/ai-assist/streamingAdapters/anthropic.js.map +1 -1
- package/lib/packlets/ai-assist/streamingAdapters/clientToolContinuationBuilder.d.ts +9 -0
- package/lib/packlets/ai-assist/streamingAdapters/clientToolContinuationBuilder.d.ts.map +1 -1
- package/lib/packlets/ai-assist/streamingAdapters/clientToolContinuationBuilder.js +4 -4
- package/lib/packlets/ai-assist/streamingAdapters/clientToolContinuationBuilder.js.map +1 -1
- package/lib/packlets/ai-assist/streamingAdapters/common.d.ts +9 -0
- package/lib/packlets/ai-assist/streamingAdapters/common.d.ts.map +1 -1
- package/lib/packlets/ai-assist/streamingAdapters/common.js.map +1 -1
- package/lib/packlets/ai-assist/streamingAdapters/gemini.d.ts +1 -1
- package/lib/packlets/ai-assist/streamingAdapters/gemini.d.ts.map +1 -1
- package/lib/packlets/ai-assist/streamingAdapters/gemini.js +4 -1
- package/lib/packlets/ai-assist/streamingAdapters/gemini.js.map +1 -1
- package/lib/packlets/ai-assist/streamingAdapters/openaiChat.d.ts +1 -1
- package/lib/packlets/ai-assist/streamingAdapters/openaiChat.d.ts.map +1 -1
- package/lib/packlets/ai-assist/streamingAdapters/openaiChat.js +6 -1
- package/lib/packlets/ai-assist/streamingAdapters/openaiChat.js.map +1 -1
- package/lib/packlets/ai-assist/streamingAdapters/openaiResponses.d.ts +1 -1
- package/lib/packlets/ai-assist/streamingAdapters/openaiResponses.d.ts.map +1 -1
- package/lib/packlets/ai-assist/streamingAdapters/openaiResponses.js +5 -1
- package/lib/packlets/ai-assist/streamingAdapters/openaiResponses.js.map +1 -1
- package/lib/packlets/ai-assist/streamingAdapters/proxy.d.ts.map +1 -1
- package/lib/packlets/ai-assist/streamingAdapters/proxy.js +6 -1
- package/lib/packlets/ai-assist/streamingAdapters/proxy.js.map +1 -1
- package/lib/packlets/ai-assist/streamingClient.d.ts.map +1 -1
- package/lib/packlets/ai-assist/streamingClient.js +5 -5
- package/lib/packlets/ai-assist/streamingClient.js.map +1 -1
- package/lib/packlets/zip-file-tree/zipFileTreeAccessors.d.ts +54 -6
- package/lib/packlets/zip-file-tree/zipFileTreeAccessors.d.ts.map +1 -1
- package/lib/packlets/zip-file-tree/zipFileTreeAccessors.js +65 -7
- package/lib/packlets/zip-file-tree/zipFileTreeAccessors.js.map +1 -1
- package/lib/packlets/zip-file-tree/zipFileTreeWriter.d.ts +26 -1
- package/lib/packlets/zip-file-tree/zipFileTreeWriter.d.ts.map +1 -1
- package/lib/packlets/zip-file-tree/zipFileTreeWriter.js +17 -1
- package/lib/packlets/zip-file-tree/zipFileTreeWriter.js.map +1 -1
- package/package.json +7 -7
package/dist/ts-extras.d.ts
CHANGED
|
@@ -42,6 +42,7 @@ declare namespace AiAssist {
|
|
|
42
42
|
IAiClientToolTurnResult,
|
|
43
43
|
IAiToolEnablement,
|
|
44
44
|
IAiCompletionResponse,
|
|
45
|
+
DEFAULT_ANTHROPIC_MAX_TOKENS,
|
|
45
46
|
IChatMessage,
|
|
46
47
|
IChatRequest,
|
|
47
48
|
AiApiFormat,
|
|
@@ -58,6 +59,7 @@ declare namespace AiAssist {
|
|
|
58
59
|
IAiAssistSettings,
|
|
59
60
|
DEFAULT_AI_ASSIST,
|
|
60
61
|
IAiAssistKeyStore,
|
|
62
|
+
providerApiKeySecretName,
|
|
61
63
|
IAiImageAttachment,
|
|
62
64
|
IAiImageData,
|
|
63
65
|
AiImageSize,
|
|
@@ -101,6 +103,8 @@ declare namespace AiAssist {
|
|
|
101
103
|
resolveModelAlias,
|
|
102
104
|
resolveProviderModel,
|
|
103
105
|
isResponsesOnlyModel,
|
|
106
|
+
isAdaptiveThinkingModel,
|
|
107
|
+
usesMaxCompletionTokensField,
|
|
104
108
|
toDataUrl,
|
|
105
109
|
AiThinkingMode,
|
|
106
110
|
IThinkingConfig,
|
|
@@ -160,10 +164,12 @@ declare namespace AiAssist {
|
|
|
160
164
|
modelSpecKey,
|
|
161
165
|
modelSpec,
|
|
162
166
|
resolveEffectiveTools,
|
|
167
|
+
classifyJsonParseFailure,
|
|
163
168
|
extractJsonText,
|
|
164
169
|
fencedStringifiedJson,
|
|
165
170
|
IFencedStringifiedJsonExtractorOptions,
|
|
166
171
|
IFencedStringifiedJsonOptions,
|
|
172
|
+
JsonParseFailureReason,
|
|
167
173
|
JsonTextExtractor,
|
|
168
174
|
generateJsonCompletion,
|
|
169
175
|
SMART_JSON_PROMPT_HINT,
|
|
@@ -632,6 +638,53 @@ declare function callProxiedImageGeneration(proxyUrl: string, params: IProviderI
|
|
|
632
638
|
*/
|
|
633
639
|
declare function callProxiedListModels(proxyUrl: string, params: IProviderListModelsParams): Promise<Result<ReadonlyArray<IAiModelInfo>>>;
|
|
634
640
|
|
|
641
|
+
/**
|
|
642
|
+
* Classifies why a JSON-shaped LLM response would not parse, returning a
|
|
643
|
+
* {@link AiAssist.JsonParseFailureReason} a caller can branch on — repair the
|
|
644
|
+
* cheap cases, re-prompt the expensive ones, fail outright on the rest —
|
|
645
|
+
* instead of regex-matching an engine-specific `JSON.parse` message.
|
|
646
|
+
*
|
|
647
|
+
* Pass the same raw model text you handed
|
|
648
|
+
* {@link AiAssist.fencedStringifiedJson} or {@link AiAssist.extractJsonText};
|
|
649
|
+
* this applies the same BOM / whitespace / fence / preamble handling before
|
|
650
|
+
* scanning, and reports `offset` against that original text.
|
|
651
|
+
*
|
|
652
|
+
* Classification is **structural and deliberately conservative**. The scan
|
|
653
|
+
* walks the JSON grammar itself rather than reading the engine's error string,
|
|
654
|
+
* so its verdicts are stable across Node versions — and any fault it cannot
|
|
655
|
+
* name with confidence comes back as `'unknown'` rather than a guess. In
|
|
656
|
+
* particular an input that opened a structure and never closed it (the
|
|
657
|
+
* truncated-response shape {@link AiAssist.extractJsonText} already diagnoses)
|
|
658
|
+
* classifies as `'unknown'` here; the two diagnostics are complementary, not
|
|
659
|
+
* competing.
|
|
660
|
+
*
|
|
661
|
+
* This never fails and never repairs — it only names the fault. It is a
|
|
662
|
+
* diagnostic on the failure path, so calling it on text that parses fine is
|
|
663
|
+
* harmless but pointless: it returns `'unknown'`.
|
|
664
|
+
*
|
|
665
|
+
* @example
|
|
666
|
+
* ```ts
|
|
667
|
+
* const parsed = fencedStringifiedJson({ inner }).convert(raw);
|
|
668
|
+
* if (parsed.isFailure()) {
|
|
669
|
+
* const reason = classifyJsonParseFailure(raw);
|
|
670
|
+
* switch (reason.kind) {
|
|
671
|
+
* case 'unquoted-property-name': // cheap to repair
|
|
672
|
+
* case 'single-quoted-property-name':
|
|
673
|
+
* break;
|
|
674
|
+
* case 'elided-member':
|
|
675
|
+
* case 'unterminated-property-name': // worth a re-prompt
|
|
676
|
+
* break;
|
|
677
|
+
* default: // 'unknown' — fail outright
|
|
678
|
+
* }
|
|
679
|
+
* }
|
|
680
|
+
* ```
|
|
681
|
+
*
|
|
682
|
+
* @param text - Raw model output (the same string handed to the extractor).
|
|
683
|
+
* @returns A {@link AiAssist.JsonParseFailureReason}.
|
|
684
|
+
* @public
|
|
685
|
+
*/
|
|
686
|
+
declare function classifyJsonParseFailure(text: string): JsonParseFailureReason;
|
|
687
|
+
|
|
635
688
|
declare namespace Constants {
|
|
636
689
|
export {
|
|
637
690
|
ENCRYPTED_FILE_FORMAT,
|
|
@@ -706,8 +759,22 @@ declare function createEncryptedFile<TMetadata = JsonValue>(params: ICreateEncry
|
|
|
706
759
|
*/
|
|
707
760
|
declare function createEncryptedFileConverter<TMetadata = JsonValue>(metadataConverter?: Converter<TMetadata>): Converter<IEncryptedFile<TMetadata>>;
|
|
708
761
|
|
|
762
|
+
/**
|
|
763
|
+
* Creates a zip file from an array of files whose contents are either text or raw bytes.
|
|
764
|
+
*
|
|
765
|
+
* @remarks
|
|
766
|
+
* String contents are encoded as UTF-8; `Uint8Array` contents are stored verbatim, so
|
|
767
|
+
* arbitrary binary payloads round-trip through the archive unchanged.
|
|
768
|
+
* @public
|
|
769
|
+
*/
|
|
770
|
+
declare function createZipFromFiles(files: ReadonlyArray<IZipFile>, options?: ICreateZipOptions): Result<Uint8Array>;
|
|
771
|
+
|
|
709
772
|
/**
|
|
710
773
|
* Creates a zip file from an array of text files.
|
|
774
|
+
*
|
|
775
|
+
* @remarks
|
|
776
|
+
* Contents are encoded as UTF-8. Use `createZipFromFiles` to write entries whose
|
|
777
|
+
* contents are raw bytes.
|
|
711
778
|
* @public
|
|
712
779
|
*/
|
|
713
780
|
declare function createZipFromTextFiles(files: ReadonlyArray<IZipTextFile>, options?: ICreateZipOptions): Result<Uint8Array>;
|
|
@@ -816,6 +883,28 @@ declare const DEFAULT_AI_ASSIST: IAiAssistSettings;
|
|
|
816
883
|
*/
|
|
817
884
|
declare const DEFAULT_ALGORITHM: "AES-256-GCM";
|
|
818
885
|
|
|
886
|
+
/**
|
|
887
|
+
* Default `max_tokens` sent to the Anthropic Messages API when the caller does
|
|
888
|
+
* not supply an explicit `maxTokens` override.
|
|
889
|
+
*
|
|
890
|
+
* @remarks
|
|
891
|
+
* Anthropic's Messages API requires `max_tokens` on every request — there is
|
|
892
|
+
* no provider-side default the way there is for OpenAI Chat/Responses,
|
|
893
|
+
* Gemini, or xAI, all of which accept a request with no cap and apply their
|
|
894
|
+
* own default. Anthropic is therefore the only provider that needs — or
|
|
895
|
+
* gets — a library-supplied fallback; every other provider omits the field
|
|
896
|
+
* entirely when the caller doesn't set `maxTokens` (see
|
|
897
|
+
* `IProviderCompletionParams.maxTokens`).
|
|
898
|
+
*
|
|
899
|
+
* Callers whose structured/JSON output scales with input size and hits this
|
|
900
|
+
* ceiling see a silent truncation that often surfaces downstream as a
|
|
901
|
+
* confusing `extractJsonText` parse failure rather than an obvious "too
|
|
902
|
+
* short" error — pass `maxTokens` explicitly to raise the cap for those
|
|
903
|
+
* requests.
|
|
904
|
+
* @public
|
|
905
|
+
*/
|
|
906
|
+
declare const DEFAULT_ANTHROPIC_MAX_TOKENS: number;
|
|
907
|
+
|
|
819
908
|
/**
|
|
820
909
|
* Default PBKDF2 iterations for key store encryption.
|
|
821
910
|
* Higher than regular files since this protects the master key vault.
|
|
@@ -1221,6 +1310,13 @@ declare function extendedArrayOf<T, TC = undefined>(label: string, converter: Co
|
|
|
1221
1310
|
*
|
|
1222
1311
|
* Out of scope: repairing malformed JSON, handling smart quotes, etc.
|
|
1223
1312
|
*
|
|
1313
|
+
* When an object or array opens but never closes before the end of input —
|
|
1314
|
+
* the shape a response truncated by a token cap leaves behind — the failure
|
|
1315
|
+
* names that specifically (distinct from the generic "no JSON-shaped
|
|
1316
|
+
* substring found" for input that never looked like JSON at all) and points
|
|
1317
|
+
* at `IAiCompletionResponse.truncated` and the `maxTokens` request option as
|
|
1318
|
+
* the likely cause and fix.
|
|
1319
|
+
*
|
|
1224
1320
|
* @param text - Raw model output.
|
|
1225
1321
|
* @returns A `Result<string>` containing the JSON-shaped substring, or a
|
|
1226
1322
|
* `Failure` if no JSON-shaped substring was found.
|
|
@@ -2355,6 +2451,27 @@ declare interface IAiProviderDescriptor {
|
|
|
2355
2451
|
* Responses-only.
|
|
2356
2452
|
*/
|
|
2357
2453
|
readonly responsesOnlyModelPrefixes?: ReadonlyArray<string>;
|
|
2454
|
+
/**
|
|
2455
|
+
* Concrete Anthropic model ids (exact-or-dash-bounded-prefix-matched) that require the
|
|
2456
|
+
* adaptive thinking wire shape (`thinking: { type: 'adaptive' }` + top-level
|
|
2457
|
+
* `output_config: { effort }`) rather than the legacy manual-budget shape
|
|
2458
|
+
* (`thinking: { type: 'enabled', budget_tokens }`). Non-Anthropic `apiFormat`s ignore this.
|
|
2459
|
+
*
|
|
2460
|
+
* @remarks
|
|
2461
|
+
* The Claude 5 family (`claude-sonnet-5`, `claude-opus-5`, `claude-fable-5`, including their
|
|
2462
|
+
* dated snapshots) rejects `thinking.type: 'enabled'` with an HTTP 400 and requires the
|
|
2463
|
+
* adaptive shape; older models (`claude-sonnet-4-6`, `claude-opus-4-8`, `claude-haiku-4-5`,
|
|
2464
|
+
* etc.) keep the legacy shape. The completion (`callProviderCompletion`), streaming
|
|
2465
|
+
* (`callProviderCompletionStream`), and client-tool (`executeClientToolTurn`) Anthropic
|
|
2466
|
+
* dispatch sites consult this list (via the sibling predicate
|
|
2467
|
+
* `isAdaptiveThinkingModel`) to pick the correct wire shape for the resolved
|
|
2468
|
+
* model. Mirrors the prefix-matching shape of `responsesOnlyModelPrefixes`, but with
|
|
2469
|
+
* exact-or-dash-bounded matching (an entry matches a resolved model that equals it or starts
|
|
2470
|
+
* with it followed by `-`) rather than a plain prefix, since Anthropic model families share
|
|
2471
|
+
* numeric leading characters (`claude-sonnet-5` vs. a hypothetical `claude-sonnet-50`).
|
|
2472
|
+
* Empty or undefined means no model uses the adaptive shape.
|
|
2473
|
+
*/
|
|
2474
|
+
readonly adaptiveThinkingModelPrefixes?: ReadonlyArray<string>;
|
|
2358
2475
|
}
|
|
2359
2476
|
|
|
2360
2477
|
/**
|
|
@@ -3404,6 +3521,15 @@ declare interface IExecuteClientToolTurnParams extends IChatRequest {
|
|
|
3404
3521
|
* turn with an `isError` result. A deny must therefore be explicit.
|
|
3405
3522
|
*/
|
|
3406
3523
|
readonly onBeforeToolExecute?: (tool: IAiClientTool, args: unknown) => Promise<Result<IToolExecutionDecision>>;
|
|
3524
|
+
/**
|
|
3525
|
+
* Optional cap on generated output tokens, mapped to each provider's native field:
|
|
3526
|
+
* Anthropic `max_tokens`, OpenAI/xAI Responses `max_output_tokens` (client-tool turns always
|
|
3527
|
+
* route OpenAI through the Responses API), Gemini `generationConfig.maxOutputTokens`. When
|
|
3528
|
+
* unset, every provider except Anthropic omits the field and applies its own default;
|
|
3529
|
+
* Anthropic's Messages API requires the field, so it falls back to
|
|
3530
|
+
* `DEFAULT_ANTHROPIC_MAX_TOKENS`.
|
|
3531
|
+
*/
|
|
3532
|
+
readonly maxTokens?: number;
|
|
3407
3533
|
}
|
|
3408
3534
|
|
|
3409
3535
|
/**
|
|
@@ -4357,6 +4483,15 @@ declare interface IProviderCompletionParams extends IChatRequest {
|
|
|
4357
4483
|
* the effective merged effort is non-`'none'`; Gemini always accepts both.
|
|
4358
4484
|
*/
|
|
4359
4485
|
readonly thinking?: IThinkingConfig;
|
|
4486
|
+
/**
|
|
4487
|
+
* Optional cap on generated output tokens, mapped to each provider's native field:
|
|
4488
|
+
* Anthropic `max_tokens`, OpenAI Chat Completions `max_completion_tokens`, OpenAI/xAI
|
|
4489
|
+
* Responses `max_output_tokens`, Gemini `generationConfig.maxOutputTokens`, and the
|
|
4490
|
+
* xAI/Groq/Mistral/Ollama/`openai-compat` chat-completions path `max_tokens`. When unset,
|
|
4491
|
+
* every provider except Anthropic omits the field and applies its own default; Anthropic's
|
|
4492
|
+
* Messages API requires the field, so it falls back to `DEFAULT_ANTHROPIC_MAX_TOKENS`.
|
|
4493
|
+
*/
|
|
4494
|
+
readonly maxTokens?: number;
|
|
4360
4495
|
}
|
|
4361
4496
|
|
|
4362
4497
|
/**
|
|
@@ -4409,6 +4544,15 @@ declare interface IProviderCompletionStreamParams extends IChatRequest {
|
|
|
4409
4544
|
* Optional thinking/reasoning mode configuration.
|
|
4410
4545
|
*/
|
|
4411
4546
|
readonly thinking?: IThinkingConfig;
|
|
4547
|
+
/**
|
|
4548
|
+
* Optional cap on generated output tokens, mapped to each provider's native field:
|
|
4549
|
+
* Anthropic `max_tokens`, OpenAI Chat Completions `max_completion_tokens`, OpenAI/xAI
|
|
4550
|
+
* Responses `max_output_tokens`, Gemini `generationConfig.maxOutputTokens`, and the
|
|
4551
|
+
* xAI/Groq/Mistral/Ollama/`openai-compat` chat-completions path `max_tokens`. When unset,
|
|
4552
|
+
* every provider except Anthropic omits the field and applies its own default; Anthropic's
|
|
4553
|
+
* Messages API requires the field, so it falls back to `DEFAULT_ANTHROPIC_MAX_TOKENS`.
|
|
4554
|
+
*/
|
|
4555
|
+
readonly maxTokens?: number;
|
|
4412
4556
|
}
|
|
4413
4557
|
|
|
4414
4558
|
/**
|
|
@@ -4554,6 +4698,32 @@ declare interface IResolvedThinkingConfig {
|
|
|
4554
4698
|
readonly otherParams?: JsonObject;
|
|
4555
4699
|
}
|
|
4556
4700
|
|
|
4701
|
+
/**
|
|
4702
|
+
* Determines whether a concrete (already-resolved) Anthropic model id uses the adaptive
|
|
4703
|
+
* thinking wire shape (`thinking: { type: 'adaptive' }` + top-level `output_config.effort`)
|
|
4704
|
+
* rather than the legacy manual-budget shape (`thinking: { type: 'enabled', budget_tokens }`).
|
|
4705
|
+
*
|
|
4706
|
+
* @remarks
|
|
4707
|
+
* Matches `modelId` against the descriptor's
|
|
4708
|
+
* {@link IAiProviderDescriptor.adaptiveThinkingModelPrefixes} using the same
|
|
4709
|
+
* exact-or-dash-bounded matcher semantics as the model-specific blocks in
|
|
4710
|
+
* `mergeThinkingConfig` (an entry matches when it equals the resolved model or when the
|
|
4711
|
+
* resolved model starts with the entry followed by a `-`) — a plain prefix match would risk a
|
|
4712
|
+
* false positive against an unrelated model sharing the same leading characters. A provider
|
|
4713
|
+
* that declares no list (the common case — this is Anthropic-specific) always returns `false`.
|
|
4714
|
+
* Consulted by the completion (`callProviderCompletion`), streaming
|
|
4715
|
+
* (`callProviderCompletionStream`), and client-tool (`executeClientToolTurn`) Anthropic
|
|
4716
|
+
* dispatch sites so every Anthropic wire-request path picks the correct thinking shape for the
|
|
4717
|
+
* resolved model.
|
|
4718
|
+
*
|
|
4719
|
+
* @param descriptor - The provider descriptor supplying the prefix list.
|
|
4720
|
+
* @param modelId - The resolved concrete model id to test.
|
|
4721
|
+
* @returns `true` when `modelId` exactly matches or is dash-bounded-prefixed by any declared
|
|
4722
|
+
* adaptive-thinking prefix.
|
|
4723
|
+
* @public
|
|
4724
|
+
*/
|
|
4725
|
+
declare function isAdaptiveThinkingModel(descriptor: IAiProviderDescriptor, modelId: string): boolean;
|
|
4726
|
+
|
|
4557
4727
|
/**
|
|
4558
4728
|
* Checks if a JSON object appears to be an encrypted file.
|
|
4559
4729
|
* Uses the format field as a discriminator.
|
|
@@ -4816,7 +4986,20 @@ declare interface IYamlSerializeOptions {
|
|
|
4816
4986
|
}
|
|
4817
4987
|
|
|
4818
4988
|
/**
|
|
4819
|
-
*
|
|
4989
|
+
* Interface for a file to be added to a zip file, whose contents are either text or
|
|
4990
|
+
* raw bytes.
|
|
4991
|
+
*
|
|
4992
|
+
* @remarks
|
|
4993
|
+
* String contents are encoded as UTF-8; `Uint8Array` contents are stored verbatim.
|
|
4994
|
+
* @public
|
|
4995
|
+
*/
|
|
4996
|
+
declare interface IZipFile {
|
|
4997
|
+
readonly path: string;
|
|
4998
|
+
readonly contents: string | Uint8Array;
|
|
4999
|
+
}
|
|
5000
|
+
|
|
5001
|
+
/**
|
|
5002
|
+
* Simple interface for a text file to be added to a zip file.
|
|
4820
5003
|
* @public
|
|
4821
5004
|
*/
|
|
4822
5005
|
declare interface IZipTextFile {
|
|
@@ -4844,6 +5027,57 @@ declare interface JarRecordParserOptions {
|
|
|
4844
5027
|
readonly fixedContinuationSize?: number;
|
|
4845
5028
|
}
|
|
4846
5029
|
|
|
5030
|
+
/**
|
|
5031
|
+
* Typed reason a JSON-shaped LLM response failed to parse, so a caller can
|
|
5032
|
+
* branch on the failure class instead of regex-matching the engine's
|
|
5033
|
+
* `JSON.parse` message (whose wording varies across V8 / Node versions).
|
|
5034
|
+
*
|
|
5035
|
+
* Every classified arm describes a fault at an **object property-name
|
|
5036
|
+
* position** — the position an LLM most often gets wrong, and the one whose
|
|
5037
|
+
* repair strategy differs most by case:
|
|
5038
|
+
*
|
|
5039
|
+
* - `'unquoted-property-name'`: a bare identifier where a quoted name belongs
|
|
5040
|
+
* (`{ key: 1 }`). `token` is the identifier run, `offset` its first
|
|
5041
|
+
* character. Identifier recognition is ASCII-only, so a non-ASCII bare name
|
|
5042
|
+
* (`{ ключ: 1 }`) reports `'unknown'` rather than being named.
|
|
5043
|
+
* - `'single-quoted-property-name'`: a single-quoted name (`{ 'key': 1 }`).
|
|
5044
|
+
* `token` is the quoted literal (or just `'` if it never closes), `offset`
|
|
5045
|
+
* the opening quote.
|
|
5046
|
+
* - `'unterminated-property-name'`: a name whose closing `"` is missing, and
|
|
5047
|
+
* whose body swallowed structural text (`{ "key: 1 }`). `token` is the
|
|
5048
|
+
* unterminated fragment, `offset` the opening quote.
|
|
5049
|
+
* - `'elided-member'`: a `,` where a member is expected — a leading or doubled
|
|
5050
|
+
* comma in an object (`{ , "a": 1 }`, `{ "a":1, , "b":2 }`) or an array
|
|
5051
|
+
* (`[1, , 2]`). `token` is `','`, `offset` its position.
|
|
5052
|
+
* - `'unknown'`: the catch-all. The scan reached the end of the text, or hit a
|
|
5053
|
+
* fault it cannot name with confidence, and reports nothing rather than
|
|
5054
|
+
* guessing. Truncated responses, missing colons, trailing commas, bad number
|
|
5055
|
+
* literals, and anything else not listed above land here.
|
|
5056
|
+
*
|
|
5057
|
+
* `offset` is a 0-based index into the `text` passed to
|
|
5058
|
+
* {@link AiAssist.classifyJsonParseFailure}, not into the extracted substring.
|
|
5059
|
+
* @public
|
|
5060
|
+
*/
|
|
5061
|
+
declare type JsonParseFailureReason = {
|
|
5062
|
+
readonly kind: 'unquoted-property-name';
|
|
5063
|
+
readonly token: string;
|
|
5064
|
+
readonly offset: number;
|
|
5065
|
+
} | {
|
|
5066
|
+
readonly kind: 'single-quoted-property-name';
|
|
5067
|
+
readonly token: string;
|
|
5068
|
+
readonly offset: number;
|
|
5069
|
+
} | {
|
|
5070
|
+
readonly kind: 'unterminated-property-name';
|
|
5071
|
+
readonly token: string;
|
|
5072
|
+
readonly offset: number;
|
|
5073
|
+
} | {
|
|
5074
|
+
readonly kind: 'elided-member';
|
|
5075
|
+
readonly token: string;
|
|
5076
|
+
readonly offset: number;
|
|
5077
|
+
} | {
|
|
5078
|
+
readonly kind: 'unknown';
|
|
5079
|
+
};
|
|
5080
|
+
|
|
4847
5081
|
/**
|
|
4848
5082
|
* Controls the optional system-prompt augmentation applied by
|
|
4849
5083
|
* {@link AiAssist.generateJsonCompletion}.
|
|
@@ -5710,6 +5944,35 @@ declare const modelSpec: Converter<ModelSpec>;
|
|
|
5710
5944
|
|
|
5711
5945
|
/**
|
|
5712
5946
|
* Known context keys for model specification maps.
|
|
5947
|
+
*
|
|
5948
|
+
* @remarks
|
|
5949
|
+
* Two axes live here and nothing else: the **quality tier** (`base` / `advanced`
|
|
5950
|
+
* / `frontier`) selects the *completion* model, and `image` / `embedding` select
|
|
5951
|
+
* the non-completion modalities.
|
|
5952
|
+
*
|
|
5953
|
+
* There is deliberately **no `tools` or `thinking` key**. Both existed before the
|
|
5954
|
+
* quality-tier axis landed and were removed with it: server-side tools and
|
|
5955
|
+
* reasoning effort are orthogonal *request* params that ride on top of whatever
|
|
5956
|
+
* model the tier already selected — they never select a model. A tool-using or
|
|
5957
|
+
* thinking-enabled call passes a tier like any other call (omit → `base`, or
|
|
5958
|
+
* `'advanced'` / `'frontier'`) and sets the tools / thinking request params
|
|
5959
|
+
* independently. Thinking composes with any tier without a tier-level capability
|
|
5960
|
+
* check — but that is a statement about the tier axis, not a claim that every
|
|
5961
|
+
* provider supports thinking: several descriptors declare
|
|
5962
|
+
* `thinkingMode: 'unsupported'` (e.g. `copy-paste`, `groq`, `mistral`, `ollama`,
|
|
5963
|
+
* `openai-compat`).
|
|
5964
|
+
*
|
|
5965
|
+
* Thinking availability is declared **per provider**, on the descriptor's
|
|
5966
|
+
* `thinkingMode`; the descriptor does not encode per-model thinking availability at
|
|
5967
|
+
* all, so a provider that declares support may still have individual models its own
|
|
5968
|
+
* API rejects thinking on. (`adaptiveThinkingModelPrefixes` is per-model but selects
|
|
5969
|
+
* a wire *shape*, not availability.) What the tier axis guarantees is therefore
|
|
5970
|
+
* narrow and exact: a tier selects a model within one provider and never changes the
|
|
5971
|
+
* provider, so it never changes `thinkingMode`.
|
|
5972
|
+
*
|
|
5973
|
+
* Do not add a `'tools'` or `'thinking'` key here, and do not hand-roll a
|
|
5974
|
+
* `resolveModel` + `resolveModelAlias` walk to emulate one — call
|
|
5975
|
+
* `resolveProviderModel` with the tier you want.
|
|
5713
5976
|
* @public
|
|
5714
5977
|
*/
|
|
5715
5978
|
declare type ModelSpecKey = 'base' | 'advanced' | 'frontier' | 'image' | 'embedding';
|
|
@@ -6133,6 +6396,18 @@ declare function parseRecordJarLines(lines: string[], options?: JarRecordParserO
|
|
|
6133
6396
|
*/
|
|
6134
6397
|
declare const pbkdf2KeyDerivationParams: Converter<IPbkdf2KeyDerivationParams>;
|
|
6135
6398
|
|
|
6399
|
+
/**
|
|
6400
|
+
* Returns the canonical `CryptoUtils.KeyStore.KeyStore` secret name for a provider's API key,
|
|
6401
|
+
* of the form `provider:<providerId>`. Apps that store provider API keys in a `KeyStore`
|
|
6402
|
+
* should use this name (rather than inventing their own) so that a single keystore vault
|
|
6403
|
+
* works consistently across every fgv app.
|
|
6404
|
+
*
|
|
6405
|
+
* @param providerId - The provider whose API key secret name is requested.
|
|
6406
|
+
* @returns The canonical keystore secret name, e.g. `'provider:openai'`.
|
|
6407
|
+
* @public
|
|
6408
|
+
*/
|
|
6409
|
+
declare function providerApiKeySecretName(providerId: AiProviderId): string;
|
|
6410
|
+
|
|
6136
6411
|
/**
|
|
6137
6412
|
* Simple implementation of a possibly open-ended range of some comparable
|
|
6138
6413
|
* type `<T>` with test and formatting.
|
|
@@ -6341,10 +6616,20 @@ declare function resolveEffectiveTools(descriptor: IAiProviderDescriptor, settin
|
|
|
6341
6616
|
* `modelPrefix` is the longest prefix of `modelId`. Ties are broken by
|
|
6342
6617
|
* first-encountered.
|
|
6343
6618
|
*
|
|
6619
|
+
* @remarks
|
|
6620
|
+
* `modelId` may be either a concrete provider model id or an fgv model alias
|
|
6621
|
+
* (`@<provider>:<role>`, see `MODEL_ALIAS_SIGIL`) — it is resolved via
|
|
6622
|
+
* `resolveModelAlias` against `descriptor.aliases` before prefix matching,
|
|
6623
|
+
* so both forms select the same capability. A raw provider id passes through
|
|
6624
|
+
* unchanged. An alias that is not registered on `descriptor` (or is cyclic)
|
|
6625
|
+
* names no model and yields `undefined` rather than falling through to the
|
|
6626
|
+
* `modelPrefix: ''` catch-all.
|
|
6627
|
+
*
|
|
6344
6628
|
* @param descriptor - The provider descriptor
|
|
6345
|
-
* @param modelId - The
|
|
6346
|
-
* @returns The matching capability, or `undefined` when no rule matches
|
|
6347
|
-
* provider declares no embedding capabilities
|
|
6629
|
+
* @param modelId - The embedding model id — concrete or an fgv alias
|
|
6630
|
+
* @returns The matching capability, or `undefined` when no rule matches, the
|
|
6631
|
+
* provider declares no embedding capabilities, or `modelId` is an
|
|
6632
|
+
* unresolvable alias.
|
|
6348
6633
|
* @public
|
|
6349
6634
|
*/
|
|
6350
6635
|
declare function resolveEmbeddingCapability(descriptor: IAiProviderDescriptor, modelId: string): IAiEmbeddingModelCapability | undefined;
|
|
@@ -6357,10 +6642,20 @@ declare function resolveEmbeddingCapability(descriptor: IAiProviderDescriptor, m
|
|
|
6357
6642
|
* order does not matter for correctness — only for tie-breaking among rules
|
|
6358
6643
|
* with identical-length prefixes (an unusual case).
|
|
6359
6644
|
*
|
|
6645
|
+
* @remarks
|
|
6646
|
+
* `modelId` may be either a concrete provider model id or an fgv model alias
|
|
6647
|
+
* (`@<provider>:<role>`, see `MODEL_ALIAS_SIGIL`) — it is resolved via
|
|
6648
|
+
* `resolveModelAlias` against `descriptor.aliases` before prefix matching,
|
|
6649
|
+
* so both forms select the same capability. A raw provider id passes through
|
|
6650
|
+
* unchanged. An alias that is not registered on `descriptor` (or is cyclic)
|
|
6651
|
+
* names no model and yields `undefined` rather than falling through to the
|
|
6652
|
+
* `modelPrefix: ''` catch-all.
|
|
6653
|
+
*
|
|
6360
6654
|
* @param descriptor - The provider descriptor
|
|
6361
|
-
* @param modelId - The
|
|
6362
|
-
* @returns The matching capability, or `undefined` when no rule matches
|
|
6363
|
-
*
|
|
6655
|
+
* @param modelId - The image model id — concrete or an fgv alias
|
|
6656
|
+
* @returns The matching capability, or `undefined` when no rule matches, the
|
|
6657
|
+
* provider declares no image-generation capabilities, or `modelId` is an
|
|
6658
|
+
* unresolvable alias.
|
|
6364
6659
|
* @public
|
|
6365
6660
|
*/
|
|
6366
6661
|
declare function resolveImageCapability(descriptor: IAiProviderDescriptor, modelId: string): IAiImageModelCapability | undefined;
|
|
@@ -6441,6 +6736,20 @@ declare function resolveModelAlias(descriptor: IAiProviderDescriptor, model: str
|
|
|
6441
6736
|
* `ModelSpec` branch is selected first; the resulting string — which may itself
|
|
6442
6737
|
* be an fgv alias — is then resolved to a concrete id.
|
|
6443
6738
|
*
|
|
6739
|
+
* **This is the whole model-selection surface — do not hand-roll the walk.**
|
|
6740
|
+
* Callers should pass the `ModelSpecKey` they want and use the concrete id
|
|
6741
|
+
* this returns; a manual `resolveModel` + `resolveModelAlias` sequence is
|
|
6742
|
+
* both redundant and easy to get wrong (it is how alias-form ids leak into
|
|
6743
|
+
* capability lookups such as `resolveImageCapability`).
|
|
6744
|
+
*
|
|
6745
|
+
* **`context` carries the quality tier and the modality — never tools or
|
|
6746
|
+
* thinking.** `ModelSpecKey` has no `tools` / `thinking` key: server-side
|
|
6747
|
+
* tools and reasoning effort are orthogonal request params that ride on top of
|
|
6748
|
+
* whatever model the tier selected, and never select a model. A tool-path caller
|
|
6749
|
+
* passes a tier like any other caller — omit `context` for `base`, or pass
|
|
6750
|
+
* `'advanced'` / `'frontier'` — and sets the tools / thinking request params
|
|
6751
|
+
* separately.
|
|
6752
|
+
*
|
|
6444
6753
|
* @param descriptor - The provider descriptor (supplies `defaultModel` and `aliases`).
|
|
6445
6754
|
* @param modelOverride - An optional caller-supplied `ModelSpec` that takes precedence
|
|
6446
6755
|
* over `descriptor.defaultModel`. May itself contain or be an alias.
|
|
@@ -6570,6 +6879,29 @@ declare function tryDecryptFile<TPayload extends JsonValue = JsonValue, TMetadat
|
|
|
6570
6879
|
*/
|
|
6571
6880
|
declare const uint8ArrayFromBase64: Converter<Uint8Array>;
|
|
6572
6881
|
|
|
6882
|
+
/**
|
|
6883
|
+
* Determines whether a provider's OpenAI-compatible Chat Completions request
|
|
6884
|
+
* should use the modern `max_completion_tokens` field instead of the legacy
|
|
6885
|
+
* `max_tokens` field for capping output length.
|
|
6886
|
+
*
|
|
6887
|
+
* @remarks
|
|
6888
|
+
* OpenAI's Chat Completions API deprecated `max_tokens` in favor of
|
|
6889
|
+
* `max_completion_tokens`. Every other provider routed through the shared
|
|
6890
|
+
* OpenAI-compatible chat-completions adapter (xAI Grok, Groq, Mistral, Ollama,
|
|
6891
|
+
* self-hosted `openai-compat` servers) still expects the legacy `max_tokens`
|
|
6892
|
+
* field, so this returns `true` only for the `'openai'` provider id. Consulted
|
|
6893
|
+
* by both the completion (`callProviderCompletion`) and streaming
|
|
6894
|
+
* (`callProviderCompletionStream`) chat-completions dispatch branches. Not
|
|
6895
|
+
* consulted on the Responses API path — `max_output_tokens` applies uniformly
|
|
6896
|
+
* there for both OpenAI and xAI (see `isResponsesOnlyModel`) —
|
|
6897
|
+
* nor by any non-`'openai'`-format provider (Anthropic, Gemini).
|
|
6898
|
+
*
|
|
6899
|
+
* @param descriptor - The provider descriptor.
|
|
6900
|
+
* @returns `true` only for the `'openai'` provider id.
|
|
6901
|
+
* @public
|
|
6902
|
+
*/
|
|
6903
|
+
declare function usesMaxCompletionTokensField(descriptor: IAiProviderDescriptor): boolean;
|
|
6904
|
+
|
|
6573
6905
|
/**
|
|
6574
6906
|
* Validates the resolved options against per-model registry constraints.
|
|
6575
6907
|
*
|
|
@@ -6589,7 +6921,7 @@ declare function validateResolvedOptions(modelId: string, capability: IAiImageMo
|
|
|
6589
6921
|
* Model IDs for xAI thinking-capable models.
|
|
6590
6922
|
* @public
|
|
6591
6923
|
*/
|
|
6592
|
-
declare type XAiThinkingModelNames = 'grok-3-mini' | 'grok-4.3' | 'grok-4';
|
|
6924
|
+
declare type XAiThinkingModelNames = 'grok-3-mini' | 'grok-4.3' | 'grok-4' | 'grok-4.5';
|
|
6593
6925
|
|
|
6594
6926
|
declare namespace Yaml {
|
|
6595
6927
|
export {
|
|
@@ -6660,9 +6992,15 @@ declare class ZipDirectoryItem<TCT extends string = string> implements FileTree.
|
|
|
6660
6992
|
* Implementation of `FileTree.IFileTreeFileItem` for files in a ZIP archive.
|
|
6661
6993
|
* ZIP files are read-only, so this item does not support mutation.
|
|
6662
6994
|
* Use {@link FileTree.isMutableFileItem | isMutableFileItem} to check before attempting mutations.
|
|
6995
|
+
*
|
|
6996
|
+
* @remarks
|
|
6997
|
+
* ZIP entries are byte-native, so this item also implements the read half of the
|
|
6998
|
+
* optional binary capability (`FileTree.IBinaryFileTreeFileItem`) — use
|
|
6999
|
+
* `FileTree.isBinaryFileItem` to narrow and `getRawBytes()` to read the entry's
|
|
7000
|
+
* undecoded bytes.
|
|
6663
7001
|
* @public
|
|
6664
7002
|
*/
|
|
6665
|
-
declare class ZipFileItem<TCT extends string = string> implements FileTree.
|
|
7003
|
+
declare class ZipFileItem<TCT extends string = string> implements FileTree.IBinaryFileTreeFileItem<TCT> {
|
|
6666
7004
|
/**
|
|
6667
7005
|
* Indicates that this `FileTree.FileTreeItem` is a file.
|
|
6668
7006
|
*/
|
|
@@ -6688,9 +7026,13 @@ declare class ZipFileItem<TCT extends string = string> implements FileTree.IFile
|
|
|
6688
7026
|
*/
|
|
6689
7027
|
get contentType(): TCT | undefined;
|
|
6690
7028
|
/**
|
|
6691
|
-
* The pre-loaded
|
|
7029
|
+
* The pre-loaded raw bytes of the ZIP entry.
|
|
6692
7030
|
*/
|
|
6693
|
-
private readonly
|
|
7031
|
+
private readonly _bytes;
|
|
7032
|
+
/**
|
|
7033
|
+
* Text form of the entry, decoded lazily from the raw bytes on first text read.
|
|
7034
|
+
*/
|
|
7035
|
+
private _contents;
|
|
6694
7036
|
/**
|
|
6695
7037
|
* The ZIP file tree accessors that created this item.
|
|
6696
7038
|
*/
|
|
@@ -6706,10 +7048,12 @@ declare class ZipFileItem<TCT extends string = string> implements FileTree.IFile
|
|
|
6706
7048
|
/**
|
|
6707
7049
|
* Constructor for ZipFileItem.
|
|
6708
7050
|
* @param zipFilePath - The path of the file within the ZIP.
|
|
6709
|
-
* @param contents - The pre-loaded contents of the
|
|
7051
|
+
* @param contents - The pre-loaded contents of the entry, either as raw bytes or as
|
|
7052
|
+
* already-decoded text. Text is encoded as UTF-8 for the byte accessor and is also
|
|
7053
|
+
* retained verbatim, so supplying text never round-trips through a decode.
|
|
6710
7054
|
* @param accessors - The ZIP file tree accessors.
|
|
6711
7055
|
*/
|
|
6712
|
-
constructor(zipFilePath: string, contents: string, accessors: ZipFileTreeAccessors<TCT>);
|
|
7056
|
+
constructor(zipFilePath: string, contents: string | Uint8Array, accessors: ZipFileTreeAccessors<TCT>);
|
|
6713
7057
|
/**
|
|
6714
7058
|
* Sets the content type of the file.
|
|
6715
7059
|
* @param contentType - The content type of the file.
|
|
@@ -6722,8 +7066,21 @@ declare class ZipFileItem<TCT extends string = string> implements FileTree.IFile
|
|
|
6722
7066
|
getContents<T>(converter: Validator<T> | Converter<T>): Result<T>;
|
|
6723
7067
|
/**
|
|
6724
7068
|
* Gets the raw contents of the file as a string.
|
|
7069
|
+
*
|
|
7070
|
+
* @remarks
|
|
7071
|
+
* The entry's bytes are decoded as UTF-8 with the lenient WHATWG default, so
|
|
7072
|
+
* malformed input is silently replaced with U+FFFD. Use `getRawBytes()` for the
|
|
7073
|
+
* undecoded bytes — and `new TextDecoder('utf-8', { fatal: true }).decode(bytes)`
|
|
7074
|
+
* for a decode that fails loudly instead.
|
|
6725
7075
|
*/
|
|
6726
7076
|
getRawContents(): Result<string>;
|
|
7077
|
+
/**
|
|
7078
|
+
* Gets the raw bytes of the ZIP entry, with no text decoding applied.
|
|
7079
|
+
*
|
|
7080
|
+
* @remarks
|
|
7081
|
+
* The returned array is the item's internal buffer and must not be modified.
|
|
7082
|
+
*/
|
|
7083
|
+
getRawBytes(): Result<Uint8Array>;
|
|
6727
7084
|
}
|
|
6728
7085
|
|
|
6729
7086
|
declare namespace ZipFileTree {
|
|
@@ -6732,7 +7089,9 @@ declare namespace ZipFileTree {
|
|
|
6732
7089
|
ZipFileItem,
|
|
6733
7090
|
ZipDirectoryItem,
|
|
6734
7091
|
createZipFromTextFiles,
|
|
7092
|
+
createZipFromFiles,
|
|
6735
7093
|
IZipTextFile,
|
|
7094
|
+
IZipFile,
|
|
6736
7095
|
ZipCompressionLevel,
|
|
6737
7096
|
ICreateZipOptions
|
|
6738
7097
|
}
|
|
@@ -6743,9 +7102,15 @@ export { ZipFileTree }
|
|
|
6743
7102
|
* Read-only file tree accessors for ZIP archives.
|
|
6744
7103
|
* ZIP archives are read-only by design — use {@link FileTree.isMutableAccessors | isMutableAccessors}
|
|
6745
7104
|
* to check before attempting mutations.
|
|
7105
|
+
*
|
|
7106
|
+
* @remarks
|
|
7107
|
+
* ZIP entries are byte-native, so these accessors also implement the read half of the
|
|
7108
|
+
* optional binary capability (`FileTree.IBinaryFileTreeAccessors`) — use
|
|
7109
|
+
* `FileTree.isBinaryAccessors` to narrow and `getFileBytes()` to read an entry's
|
|
7110
|
+
* undecoded bytes.
|
|
6746
7111
|
* @public
|
|
6747
7112
|
*/
|
|
6748
|
-
declare class ZipFileTreeAccessors<TCT extends string = string> implements FileTree.
|
|
7113
|
+
declare class ZipFileTreeAccessors<TCT extends string = string> implements FileTree.IBinaryFileTreeAccessors<TCT> {
|
|
6749
7114
|
/**
|
|
6750
7115
|
* The unzipped file data.
|
|
6751
7116
|
*/
|
|
@@ -6839,8 +7204,25 @@ declare class ZipFileTreeAccessors<TCT extends string = string> implements FileT
|
|
|
6839
7204
|
getItem(path: string): Result<FileTree.FileTreeItem<TCT>>;
|
|
6840
7205
|
/**
|
|
6841
7206
|
* Gets the contents of a file in the file tree.
|
|
7207
|
+
*
|
|
7208
|
+
* @remarks
|
|
7209
|
+
* The entry's bytes are decoded as UTF-8 with the lenient WHATWG default. Use
|
|
7210
|
+
* `getFileBytes()` for the undecoded bytes.
|
|
6842
7211
|
*/
|
|
6843
7212
|
getFileContents(path: string): Result<string>;
|
|
7213
|
+
/**
|
|
7214
|
+
* Gets the raw bytes of a ZIP entry, with no text decoding applied.
|
|
7215
|
+
*
|
|
7216
|
+
* @remarks
|
|
7217
|
+
* The returned array is the archive's internal buffer and must not be modified.
|
|
7218
|
+
*/
|
|
7219
|
+
getFileBytes(path: string): Result<Uint8Array>;
|
|
7220
|
+
/**
|
|
7221
|
+
* Resolves a path to the ZIP file item it names.
|
|
7222
|
+
* @param path - Path of the entry to look up.
|
|
7223
|
+
* @returns `Success` with the item, or `Failure` if it is missing or is a directory.
|
|
7224
|
+
*/
|
|
7225
|
+
private _getFileItem;
|
|
6844
7226
|
/**
|
|
6845
7227
|
* Gets the content type of a file in the file tree.
|
|
6846
7228
|
*/
|
|
@@ -43,6 +43,15 @@ export interface IProviderCompletionParams extends IChatRequest {
|
|
|
43
43
|
* the effective merged effort is non-`'none'`; Gemini always accepts both.
|
|
44
44
|
*/
|
|
45
45
|
readonly thinking?: IThinkingConfig;
|
|
46
|
+
/**
|
|
47
|
+
* Optional cap on generated output tokens, mapped to each provider's native field:
|
|
48
|
+
* Anthropic `max_tokens`, OpenAI Chat Completions `max_completion_tokens`, OpenAI/xAI
|
|
49
|
+
* Responses `max_output_tokens`, Gemini `generationConfig.maxOutputTokens`, and the
|
|
50
|
+
* xAI/Groq/Mistral/Ollama/`openai-compat` chat-completions path `max_tokens`. When unset,
|
|
51
|
+
* every provider except Anthropic omits the field and applies its own default; Anthropic's
|
|
52
|
+
* Messages API requires the field, so it falls back to `DEFAULT_ANTHROPIC_MAX_TOKENS`.
|
|
53
|
+
*/
|
|
54
|
+
readonly maxTokens?: number;
|
|
46
55
|
}
|
|
47
56
|
/**
|
|
48
57
|
* Calls the appropriate chat completion API for a given provider. Routes by
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apiClient.d.ts","sourceRoot":"","sources":["../../../src/packlets/ai-assist/apiClient.ts"],"names":[],"mappings":"AA+BA,OAAO,EAAQ,KAAK,OAAO,EAAc,MAAM,EAAuC,MAAM,eAAe,CAAC;AAE5G,OAAO,EAEL,KAAK,iBAAiB,EAEtB,KAAK,kBAAkB,
|
|
1
|
+
{"version":3,"file":"apiClient.d.ts","sourceRoot":"","sources":["../../../src/packlets/ai-assist/apiClient.ts"],"names":[],"mappings":"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"}
|