extrait 0.7.0 → 0.7.2
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/README.md +2 -0
- package/dist/extract-parse-hint.d.ts +3 -0
- package/dist/extract-shape.d.ts +21 -0
- package/dist/generate-debug.d.ts +26 -0
- package/dist/generate-model-call.d.ts +3 -0
- package/dist/generate-output.d.ts +10 -0
- package/dist/generate-shared.d.ts +6 -10
- package/dist/generate-tool-timeout.d.ts +3 -0
- package/dist/index.cjs +1016 -1121
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1016 -1121
- package/dist/prompt.d.ts +14 -0
- package/dist/providers/mcp-runtime-debug.d.ts +3 -0
- package/dist/providers/mcp-runtime.d.ts +1 -1
- package/dist/structured-streaming.d.ts +1 -0
- package/dist/type-definitions/llm.d.ts +246 -0
- package/dist/type-definitions/markdown.d.ts +10 -0
- package/dist/type-definitions/parse.d.ts +93 -0
- package/dist/type-definitions/structured.d.ts +123 -0
- package/dist/types.d.ts +4 -468
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -658,6 +658,8 @@ type MCPCallToolParams = {
|
|
|
658
658
|
};
|
|
659
659
|
```
|
|
660
660
|
|
|
661
|
+
MCP toolsets may change between tool rounds. Providers call `listTools()` before each round, so a client can expose additional tools after a previous `callTool()` result, or remove tools that are no longer available.
|
|
662
|
+
|
|
661
663
|
Use `transformToolCallParams()` when you need to attach MCP-specific metadata, override the final remote tool name, or otherwise change the full request passed to `client.callTool()`. This hook is exported as `LLMToolCallParamsTransformer`.
|
|
662
664
|
|
|
663
665
|
### Timeouts
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ExtractionCandidate, ExtractionHeuristicsOptions } from "./types";
|
|
2
|
+
export interface RankedCandidate extends ExtractionCandidate {
|
|
3
|
+
shapeScore: number;
|
|
4
|
+
}
|
|
5
|
+
export declare function looksLikeJsonEnvelope(content: string, acceptArrays: boolean): boolean;
|
|
6
|
+
export declare function languageBonus(language: string | null): number;
|
|
7
|
+
export declare function jsonShapeScore(content: string, acceptArrays: boolean): number;
|
|
8
|
+
export declare function boundaryScore(input: string, start: number, end: number): number;
|
|
9
|
+
export declare function lengthScore(length: number): number;
|
|
10
|
+
export declare function passesShapeFilter(candidate: RankedCandidate): boolean;
|
|
11
|
+
export declare function sortCandidates<T extends {
|
|
12
|
+
score: number;
|
|
13
|
+
start: number;
|
|
14
|
+
end: number;
|
|
15
|
+
}>(candidates: T[]): T[];
|
|
16
|
+
export declare function dedupeCandidates<T extends {
|
|
17
|
+
content: string;
|
|
18
|
+
}>(candidates: T[]): T[];
|
|
19
|
+
export declare function clamp(value: number, min: number, max: number): number;
|
|
20
|
+
export declare function normalizeInteger(value: unknown, fallback: number): number;
|
|
21
|
+
export declare function resolveExtractionHeuristics(input: Partial<ExtractionHeuristicsOptions> | undefined, defaults: ExtractionHeuristicsOptions): ExtractionHeuristicsOptions;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { LLMRequest, LLMUsage } from "./types";
|
|
2
|
+
import type { NormalizedDebugConfig } from "./generate-shared";
|
|
3
|
+
export interface DebugRequestInput {
|
|
4
|
+
label: string;
|
|
5
|
+
provider?: string;
|
|
6
|
+
model?: string;
|
|
7
|
+
attempt: number;
|
|
8
|
+
selfHealAttempt: boolean;
|
|
9
|
+
selfHealEnabled: boolean;
|
|
10
|
+
stream: boolean;
|
|
11
|
+
requestPayload: LLMRequest;
|
|
12
|
+
}
|
|
13
|
+
export interface DebugResponseInput {
|
|
14
|
+
label: string;
|
|
15
|
+
attempt: number;
|
|
16
|
+
selfHealAttempt: boolean;
|
|
17
|
+
selfHealEnabled: boolean;
|
|
18
|
+
via: "complete" | "stream";
|
|
19
|
+
text: string;
|
|
20
|
+
reasoning: string;
|
|
21
|
+
parseSource: string;
|
|
22
|
+
usage?: LLMUsage;
|
|
23
|
+
finishReason?: string;
|
|
24
|
+
}
|
|
25
|
+
export declare function emitDebugRequest(config: NormalizedDebugConfig, input: DebugRequestInput): void;
|
|
26
|
+
export declare function emitDebugResponse(config: NormalizedDebugConfig, input: DebugResponseInput): void;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { LLMAdapter } from "./types";
|
|
2
|
+
import type { ModelCallOptions, ModelCallResult } from "./generate-shared";
|
|
3
|
+
export declare function callModel<TSnapshot, TTraceEvent>(adapter: LLMAdapter, options: ModelCallOptions<TSnapshot, TTraceEvent>): Promise<ModelCallResult>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { LLMUsage, ReasoningBlock, StreamTurnTransition } from "./types";
|
|
2
|
+
import type { NormalizedModelOutput } from "./generate-shared";
|
|
3
|
+
export declare function normalizeModelOutput(text: string, dedicatedReasoning?: string, reasoningBlocks?: ReasoningBlock[]): NormalizedModelOutput;
|
|
4
|
+
export declare function appendReasoningBlock(blocks: ReasoningBlock[] | undefined, transition: StreamTurnTransition): ReasoningBlock[] | undefined;
|
|
5
|
+
export declare function composeParseSource(text: string, reasoning?: string): string;
|
|
6
|
+
export declare function aggregateUsage<T extends {
|
|
7
|
+
usage?: LLMUsage;
|
|
8
|
+
}>(attempts: T[]): LLMUsage | undefined;
|
|
9
|
+
export declare function mergeUsage(base: LLMUsage | undefined, next: LLMUsage | undefined): LLMUsage | undefined;
|
|
10
|
+
export declare function toStreamDataFingerprint(value: unknown): string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { LLMMessage, LLMRequest, LLMToolCall, LLMUsage, ReasoningBlock, StreamTurnTransition, StructuredDebugOptions, StructuredPromptBuilder, StructuredPromptContext, StructuredPromptPayload, StructuredPromptValue, StructuredTimeoutOptions, ThinkBlock } from "./types";
|
|
2
2
|
export type PromptRequestOptions = Omit<LLMRequest, "prompt" | "systemPrompt" | "messages">;
|
|
3
3
|
export interface StreamDelta {
|
|
4
4
|
text: string;
|
|
@@ -74,12 +74,8 @@ export declare function normalizeStreamConfig<TSnapshot>(option: boolean | {
|
|
|
74
74
|
to?: "stdout";
|
|
75
75
|
} | undefined): NormalizedStreamConfig<TSnapshot>;
|
|
76
76
|
export declare function normalizeDebugConfig(option: StructuredDebugOptions | boolean | undefined): NormalizedDebugConfig;
|
|
77
|
-
export
|
|
78
|
-
export
|
|
79
|
-
export
|
|
80
|
-
export
|
|
81
|
-
export
|
|
82
|
-
export declare function aggregateUsage<T extends {
|
|
83
|
-
usage?: LLMUsage;
|
|
84
|
-
}>(attempts: T[]): LLMUsage | undefined;
|
|
85
|
-
export declare function mergeUsage(base: LLMUsage | undefined, next: LLMUsage | undefined): LLMUsage | undefined;
|
|
77
|
+
export { withToolTimeout, applyToolTimeout } from "./generate-tool-timeout";
|
|
78
|
+
export { callModel } from "./generate-model-call";
|
|
79
|
+
export { aggregateUsage, appendReasoningBlock, composeParseSource, mergeUsage, normalizeModelOutput, toStreamDataFingerprint, } from "./generate-output";
|
|
80
|
+
export type { DebugRequestInput, DebugResponseInput } from "./generate-debug";
|
|
81
|
+
export { emitDebugRequest, emitDebugResponse } from "./generate-debug";
|