@anvia/core 0.21.0 → 0.23.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/agent/index.d.ts +11 -11
- package/dist/agent/index.js +9 -9
- package/dist/{agent-Q7FT1xmG.d.ts → agent-x3YTyv5i.d.ts} +8 -7
- package/dist/audio-generation/index.d.ts +1 -1
- package/dist/{chunk-PJDL5UT2.js → chunk-ADH7NNCS.js} +63 -1
- package/dist/chunk-ADH7NNCS.js.map +1 -0
- package/dist/{chunk-3IYTCGHS.js → chunk-BALBBVI3.js} +14 -7
- package/dist/{chunk-3IYTCGHS.js.map → chunk-BALBBVI3.js.map} +1 -1
- package/dist/{chunk-N3YV3WCO.js → chunk-DALYP4PX.js} +21 -4
- package/dist/chunk-DALYP4PX.js.map +1 -0
- package/dist/{chunk-6X2UTX3L.js → chunk-HYUYZEAJ.js} +2 -2
- package/dist/{chunk-SWUH4G2I.js → chunk-I6XOQ4LK.js} +2 -2
- package/dist/{chunk-WHAPIIEZ.js → chunk-JI5YZWNT.js} +5 -5
- package/dist/{chunk-F56AMXMQ.js → chunk-MC3CCKEB.js} +2 -2
- package/dist/{chunk-TGLNXVII.js → chunk-MRQLEK2B.js} +3 -3
- package/dist/{chunk-MTGNA4OS.js → chunk-Q25IWLBT.js} +2 -2
- package/dist/{chunk-ZNTIUOKL.js → chunk-UQX6EXWG.js} +2 -2
- package/dist/{chunk-ZSTUMG7G.js → chunk-YLMDBQO4.js} +5 -5
- package/dist/completion/index.d.ts +3 -3
- package/dist/completion/index.js +11 -5
- package/dist/{errors-Bf661V89.d.ts → errors-2moLDuuN.d.ts} +2 -2
- package/dist/evals/index.d.ts +124 -10
- package/dist/evals/index.js +1021 -29
- package/dist/evals/index.js.map +1 -1
- package/dist/extractor/index.d.ts +8 -8
- package/dist/extractor/index.js +10 -10
- package/dist/guardrails/index.d.ts +1 -1
- package/dist/hooks/index.d.ts +3 -3
- package/dist/image-generation/index.d.ts +1 -1
- package/dist/{index-XTUEMWhU.d.ts → index-BxSbmOMr.d.ts} +4 -2
- package/dist/index.d.ts +13 -13
- package/dist/index.js +18 -12
- package/dist/internal/agent.d.ts +8 -8
- package/dist/internal/agent.js +7 -7
- package/dist/{json-D9IvOgx_.d.ts → json-BVPssigK.d.ts} +1 -1
- package/dist/loaders/index.d.ts +1 -1
- package/dist/mcp/index.d.ts +4 -4
- package/dist/memory/index.d.ts +4 -4
- package/dist/memory/index.js +4 -4
- package/dist/{middleware-DfMc30in.d.ts → middleware-Dp3d_pxi.d.ts} +3 -3
- package/dist/observability/index.d.ts +3 -3
- package/dist/pipeline/index.d.ts +8 -8
- package/dist/request/index.d.ts +8 -8
- package/dist/request/index.js +6 -6
- package/dist/skills/index.d.ts +4 -4
- package/dist/skills/index.js +2 -2
- package/dist/{think-tool-CpCKo8Q8.d.ts → think-tool-DfCMuO8e.d.ts} +1 -1
- package/dist/tool/index.d.ts +5 -5
- package/dist/tool/index.js +2 -2
- package/dist/{tool-Dhwg__1L.d.ts → tool-Cohdv5GC.d.ts} +1 -1
- package/dist/transcription/index.d.ts +1 -1
- package/dist/{types-fBv8mhvP.d.ts → types-04LqWrmy.d.ts} +1 -1
- package/dist/{types-DBHzPsbx.d.ts → types-BrLbKnEz.d.ts} +1 -1
- package/dist/{types-BCA8p0sb.d.ts → types-D9JpeAPF.d.ts} +1 -1
- package/dist/{types-XjIh933x.d.ts → types-G12i56s2.d.ts} +26 -1
- package/dist/{types-BBEf34DP.d.ts → types-JJCxRnaZ.d.ts} +2 -2
- package/dist/{types-BrxxAtcJ.d.ts → types-O-abTIin.d.ts} +1 -1
- package/dist/ui/index.d.ts +2 -1
- package/dist/ui/index.js +2 -2
- package/dist/vector-store/index.d.ts +4 -4
- package/package.json +1 -1
- package/dist/chunk-N3YV3WCO.js.map +0 -1
- package/dist/chunk-PJDL5UT2.js.map +0 -1
- /package/dist/{chunk-6X2UTX3L.js.map → chunk-HYUYZEAJ.js.map} +0 -0
- /package/dist/{chunk-SWUH4G2I.js.map → chunk-I6XOQ4LK.js.map} +0 -0
- /package/dist/{chunk-WHAPIIEZ.js.map → chunk-JI5YZWNT.js.map} +0 -0
- /package/dist/{chunk-F56AMXMQ.js.map → chunk-MC3CCKEB.js.map} +0 -0
- /package/dist/{chunk-TGLNXVII.js.map → chunk-MRQLEK2B.js.map} +0 -0
- /package/dist/{chunk-MTGNA4OS.js.map → chunk-Q25IWLBT.js.map} +0 -0
- /package/dist/{chunk-ZNTIUOKL.js.map → chunk-UQX6EXWG.js.map} +0 -0
- /package/dist/{chunk-ZSTUMG7G.js.map → chunk-YLMDBQO4.js.map} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Z as ZodSchema } from './zod-schema-C7F4clpm.js';
|
|
2
|
-
import { M as Message, D as Document,
|
|
2
|
+
import { M as Message, D as Document, i as CompletionTool, L as ToolChoice, J as JsonObject, l as JsonValue, A as AssistantContent, U as Usage, g as CompletionResponse, C as CompletionModel, Z as StreamingCompletionModel, Q as CompletionStreamEvent } from './types-G12i56s2.js';
|
|
3
3
|
|
|
4
4
|
type CreateCompletionInput = string | Message | Message[];
|
|
5
5
|
type CreateCompletionBaseOptions = {
|
package/dist/loaders/index.d.ts
CHANGED
package/dist/mcp/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { M as McpConnection, a as McpServer, b as McpStdioOptions, c as McpHttpOptions, d as McpSseOptions } from '../types-
|
|
2
|
-
export { e as McpClient, f as McpToolCallContent, g as McpToolCallResult, h as McpToolDefinition } from '../types-
|
|
1
|
+
import { M as McpConnection, a as McpServer, b as McpStdioOptions, c as McpHttpOptions, d as McpSseOptions } from '../types-JJCxRnaZ.js';
|
|
2
|
+
export { e as McpClient, f as McpToolCallContent, g as McpToolCallResult, h as McpToolDefinition } from '../types-JJCxRnaZ.js';
|
|
3
3
|
import '@modelcontextprotocol/sdk/client/sse.js';
|
|
4
4
|
import '@modelcontextprotocol/sdk/client/stdio.js';
|
|
5
5
|
import '@modelcontextprotocol/sdk/client/streamableHttp.js';
|
|
6
|
-
import '../types-
|
|
7
|
-
import '../tool-
|
|
6
|
+
import '../types-G12i56s2.js';
|
|
7
|
+
import '../tool-Cohdv5GC.js';
|
|
8
8
|
|
|
9
9
|
declare function connectMcp(connection: McpConnection): Promise<McpServer>;
|
|
10
10
|
|
package/dist/memory/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { M as MemoryCompactionConflictError, a as MemoryCompactionError, c as createSummaryMemoryCompactor, i as isMemoryCompactionSummary } from '../errors-
|
|
2
|
-
import { n as MemoryOptions, o as ResolvedMemoryOptions } from '../types-
|
|
3
|
-
export { p as MemoryAppendInput, M as MemoryCompactionCommitInput, a as MemoryCompactionCommitResult, b as MemoryCompactionOptions, c as MemoryCompactionSnapshot, d as MemoryCompactionStore, e as MemoryCompactor, f as MemoryCompactorInput, g as MemoryCompactorResult, q as MemoryContext, h as MemoryConversation, i as MemoryConversationListOptions, j as MemoryConversationMessage, k as MemoryConversationSummary, r as MemoryErrorInput, l as MemoryInspector, s as MemoryRegistration, t as MemorySavePolicy, m as MemoryStore, R as ResolvedMemoryCompactionOptions, u as SessionOptions, S as SummaryMemoryCompactorOptions } from '../types-
|
|
4
|
-
import '../types-
|
|
1
|
+
export { M as MemoryCompactionConflictError, a as MemoryCompactionError, c as createSummaryMemoryCompactor, i as isMemoryCompactionSummary } from '../errors-2moLDuuN.js';
|
|
2
|
+
import { n as MemoryOptions, o as ResolvedMemoryOptions } from '../types-BrLbKnEz.js';
|
|
3
|
+
export { p as MemoryAppendInput, M as MemoryCompactionCommitInput, a as MemoryCompactionCommitResult, b as MemoryCompactionOptions, c as MemoryCompactionSnapshot, d as MemoryCompactionStore, e as MemoryCompactor, f as MemoryCompactorInput, g as MemoryCompactorResult, q as MemoryContext, h as MemoryConversation, i as MemoryConversationListOptions, j as MemoryConversationMessage, k as MemoryConversationSummary, r as MemoryErrorInput, l as MemoryInspector, s as MemoryRegistration, t as MemorySavePolicy, m as MemoryStore, R as ResolvedMemoryCompactionOptions, u as SessionOptions, S as SummaryMemoryCompactorOptions } from '../types-BrLbKnEz.js';
|
|
4
|
+
import '../types-G12i56s2.js';
|
|
5
5
|
|
|
6
6
|
declare function resolveMemoryOptions(options?: MemoryOptions): ResolvedMemoryOptions;
|
|
7
7
|
|
package/dist/memory/index.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import "../chunk-XWUC7CIT.js";
|
|
2
2
|
import {
|
|
3
3
|
resolveMemoryOptions
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-UQX6EXWG.js";
|
|
5
5
|
import {
|
|
6
6
|
MemoryCompactionConflictError,
|
|
7
7
|
MemoryCompactionError,
|
|
8
8
|
createSummaryMemoryCompactor,
|
|
9
9
|
isMemoryCompactionSummary
|
|
10
|
-
} from "../chunk-
|
|
11
|
-
import "../chunk-
|
|
12
|
-
import "../chunk-
|
|
10
|
+
} from "../chunk-MRQLEK2B.js";
|
|
11
|
+
import "../chunk-MC3CCKEB.js";
|
|
12
|
+
import "../chunk-ADH7NNCS.js";
|
|
13
13
|
import "../chunk-WQKHFADH.js";
|
|
14
14
|
export {
|
|
15
15
|
MemoryCompactionConflictError,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { r as ToolDefinition, f as CompletionRequest, g as CompletionResponse, l as JsonValue, u as ToolResultContent } from './types-G12i56s2.js';
|
|
2
2
|
import { V as VectorMetadata, E as EmbeddingModel, c as EmbeddedDocument } from './types-BCTRUGex.js';
|
|
3
|
-
import { A as AnyTool, f as ToolCallContext, N as NormalizedToolOutput } from './tool-
|
|
4
|
-
import { a as VectorSearchIndex } from './types-
|
|
3
|
+
import { A as AnyTool, f as ToolCallContext, N as NormalizedToolOutput } from './tool-Cohdv5GC.js';
|
|
4
|
+
import { a as VectorSearchIndex } from './types-O-abTIin.js';
|
|
5
5
|
|
|
6
6
|
declare class ToolSet {
|
|
7
7
|
private readonly tools;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { m as AgentGenerationEndArgs, n as AgentGenerationErrorArgs, o as AgentGenerationModelInfo, p as AgentGenerationObserver, q as AgentGenerationStartArgs, r as AgentGenerationUpdateArgs, i as AgentObserver, k as AgentObserverRegistration, s as AgentRunEndArgs, t as AgentRunErrorArgs, u as AgentRunEventArgs, v as AgentRunObserver, w as AgentRunPromptRef, x as AgentRunStartArgs, y as AgentToolEndArgs, z as AgentToolErrorArgs, B as AgentToolObserver, C as AgentToolStartArgs, D as AgentToolStreamEventArgs, E as AgentTraceInfo, j as AgentTraceOptions, O as ObserveOptions, F as createObserver } from '../index-
|
|
2
|
-
import '../types-
|
|
1
|
+
export { m as AgentGenerationEndArgs, n as AgentGenerationErrorArgs, o as AgentGenerationModelInfo, p as AgentGenerationObserver, q as AgentGenerationStartArgs, r as AgentGenerationUpdateArgs, i as AgentObserver, k as AgentObserverRegistration, s as AgentRunEndArgs, t as AgentRunErrorArgs, u as AgentRunEventArgs, v as AgentRunObserver, w as AgentRunPromptRef, x as AgentRunStartArgs, y as AgentToolEndArgs, z as AgentToolErrorArgs, B as AgentToolObserver, C as AgentToolStartArgs, D as AgentToolStreamEventArgs, E as AgentTraceInfo, j as AgentTraceOptions, O as ObserveOptions, F as createObserver } from '../index-BxSbmOMr.js';
|
|
2
|
+
import '../types-G12i56s2.js';
|
|
3
3
|
import '../guardrails/index.js';
|
|
4
|
-
import '../tool-
|
|
4
|
+
import '../tool-Cohdv5GC.js';
|
package/dist/pipeline/index.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { A as Agent } from '../agent-
|
|
3
|
-
import { J as JsonObject, C as CompletionModel } from '../types-
|
|
2
|
+
import { A as Agent } from '../agent-x3YTyv5i.js';
|
|
3
|
+
import { J as JsonObject, C as CompletionModel } from '../types-G12i56s2.js';
|
|
4
4
|
import { Extractor } from '../extractor/index.js';
|
|
5
5
|
import '../guardrails/index.js';
|
|
6
|
-
import '../types-
|
|
7
|
-
import '../types-
|
|
8
|
-
import '../index-
|
|
9
|
-
import '../tool-
|
|
10
|
-
import '../middleware-
|
|
6
|
+
import '../types-D9JpeAPF.js';
|
|
7
|
+
import '../types-BrLbKnEz.js';
|
|
8
|
+
import '../index-BxSbmOMr.js';
|
|
9
|
+
import '../tool-Cohdv5GC.js';
|
|
10
|
+
import '../middleware-Dp3d_pxi.js';
|
|
11
11
|
import '../types-BCTRUGex.js';
|
|
12
|
-
import '../types-
|
|
12
|
+
import '../types-O-abTIin.js';
|
|
13
13
|
import '../zod-schema-C7F4clpm.js';
|
|
14
14
|
|
|
15
15
|
/** Minimal interface for anything that can run as a pipeline stage. */
|
package/dist/request/index.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { M as Message } from '../types-
|
|
2
|
-
import { d as ToolApprovalRequest } from '../tool-
|
|
3
|
-
export { C as CompletionRetryContext, a as CompletionRetryOptions, P as PromptRequest } from '../agent-
|
|
4
|
-
export { A as AgentChildStreamEvent, a as AgentChildStreamEventWithToolCallDeltas, b as AgentChildStreamEventWithoutToolCallDeltas, l as AgentDeltaEvent, c as AgentErrorStreamEvent, d as AgentStreamEvent, e as AgentStreamEventWithToolCallDeltas, f as AgentStreamEventWithoutToolCallDeltas, g as AgentStreamOptions, h as AgentToolCallDeltaEvent, P as PromptResponse } from '../index-
|
|
1
|
+
import { M as Message } from '../types-G12i56s2.js';
|
|
2
|
+
import { d as ToolApprovalRequest } from '../tool-Cohdv5GC.js';
|
|
3
|
+
export { C as CompletionRetryContext, a as CompletionRetryOptions, P as PromptRequest } from '../agent-x3YTyv5i.js';
|
|
4
|
+
export { A as AgentChildStreamEvent, a as AgentChildStreamEventWithToolCallDeltas, b as AgentChildStreamEventWithoutToolCallDeltas, l as AgentDeltaEvent, c as AgentErrorStreamEvent, d as AgentStreamEvent, e as AgentStreamEventWithToolCallDeltas, f as AgentStreamEventWithoutToolCallDeltas, g as AgentStreamOptions, h as AgentToolCallDeltaEvent, P as PromptResponse } from '../index-BxSbmOMr.js';
|
|
5
5
|
import '../guardrails/index.js';
|
|
6
|
-
import '../types-
|
|
7
|
-
import '../types-
|
|
8
|
-
import '../middleware-
|
|
6
|
+
import '../types-D9JpeAPF.js';
|
|
7
|
+
import '../types-BrLbKnEz.js';
|
|
8
|
+
import '../middleware-Dp3d_pxi.js';
|
|
9
9
|
import '../types-BCTRUGex.js';
|
|
10
|
-
import '../types-
|
|
10
|
+
import '../types-O-abTIin.js';
|
|
11
11
|
|
|
12
12
|
declare class MaxTurnsError extends Error {
|
|
13
13
|
readonly maxTurns: number;
|
package/dist/request/index.js
CHANGED
|
@@ -3,17 +3,17 @@ import {
|
|
|
3
3
|
PromptCancelledError,
|
|
4
4
|
PromptRequest,
|
|
5
5
|
ToolApprovalRequiredError
|
|
6
|
-
} from "../chunk-
|
|
6
|
+
} from "../chunk-BALBBVI3.js";
|
|
7
7
|
import "../chunk-XUUY2L2D.js";
|
|
8
|
-
import "../chunk-
|
|
8
|
+
import "../chunk-HYUYZEAJ.js";
|
|
9
9
|
import "../chunk-MELYDKWQ.js";
|
|
10
10
|
import "../chunk-2ODTMRHP.js";
|
|
11
|
-
import "../chunk-
|
|
11
|
+
import "../chunk-MRQLEK2B.js";
|
|
12
12
|
import "../chunk-MNWK2USR.js";
|
|
13
13
|
import "../chunk-OIMLU4SF.js";
|
|
14
|
-
import "../chunk-
|
|
15
|
-
import "../chunk-
|
|
16
|
-
import "../chunk-
|
|
14
|
+
import "../chunk-Q25IWLBT.js";
|
|
15
|
+
import "../chunk-MC3CCKEB.js";
|
|
16
|
+
import "../chunk-ADH7NNCS.js";
|
|
17
17
|
import "../chunk-WQKHFADH.js";
|
|
18
18
|
import "../chunk-CWUJUSOS.js";
|
|
19
19
|
export {
|
package/dist/skills/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { b as SkillLoader, a as SkillSet } from '../types-
|
|
2
|
-
export { c as Skill, S as SkillValidationError, d as SkillValidationIssue } from '../types-
|
|
3
|
-
import '../tool-
|
|
4
|
-
import '../types-
|
|
1
|
+
import { b as SkillLoader, a as SkillSet } from '../types-04LqWrmy.js';
|
|
2
|
+
export { c as Skill, S as SkillValidationError, d as SkillValidationIssue } from '../types-04LqWrmy.js';
|
|
3
|
+
import '../tool-Cohdv5GC.js';
|
|
4
|
+
import '../types-G12i56s2.js';
|
|
5
5
|
|
|
6
6
|
declare function loadSkills(loaders: SkillLoader | SkillLoader[]): Promise<SkillSet>;
|
|
7
7
|
|
package/dist/skills/index.js
CHANGED
|
@@ -5,11 +5,11 @@ import {
|
|
|
5
5
|
} from "../chunk-NCPN4SJR.js";
|
|
6
6
|
import "../chunk-CQNNSZPG.js";
|
|
7
7
|
import "../chunk-YK4WAAS4.js";
|
|
8
|
-
import "../chunk-
|
|
8
|
+
import "../chunk-HYUYZEAJ.js";
|
|
9
9
|
import "../chunk-MELYDKWQ.js";
|
|
10
10
|
import "../chunk-MNWK2USR.js";
|
|
11
11
|
import "../chunk-OIMLU4SF.js";
|
|
12
|
-
import "../chunk-
|
|
12
|
+
import "../chunk-ADH7NNCS.js";
|
|
13
13
|
import "../chunk-WQKHFADH.js";
|
|
14
14
|
export {
|
|
15
15
|
SkillValidationError,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { Z as ZodSchema } from './zod-schema-C7F4clpm.js';
|
|
3
|
-
import { c as ToolApprovalPolicy, f as ToolCallContext, T as Tool } from './tool-
|
|
3
|
+
import { c as ToolApprovalPolicy, f as ToolCallContext, T as Tool } from './tool-Cohdv5GC.js';
|
|
4
4
|
|
|
5
5
|
type CreateToolOptions<InputSchema extends ZodSchema, OutputSchema extends ZodSchema | undefined = undefined, Output = unknown> = {
|
|
6
6
|
name: string;
|
package/dist/tool/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export { b as CreateThinkToolOptions, C as CreateToolOptions, c as createThinkTool, a as createTool } from '../think-tool-
|
|
2
|
-
export { A as AgentMiddleware, C as CompletionRequestMiddlewareArgs, a as CompletionRequestMiddlewareResult, b as CompletionResponseMiddlewareArgs, c as CompletionResponseMiddlewareResult, D as DynamicToolIndex, E as EmbedToolsOptions, T as ToolInputMiddlewareArgs, d as ToolInputMiddlewareResult, e as ToolOutputMiddlewareArgs, f as ToolOutputMiddlewareResult, g as ToolResultMiddlewareArgs, i as ToolSearchDocument, j as ToolSet, h as createMiddleware, k as createToolIndex, l as embedTools, m as isDynamicToolIndex } from '../middleware-
|
|
3
|
-
export { A as AnyTool, N as NormalizedToolOutput, T as Tool, a as ToolApprovalContext, b as ToolApprovalDecision, c as ToolApprovalPolicy, d as ToolApprovalRequest, h as ToolApprovalRunContext, e as ToolApprovalsOptions, f as ToolCallContext, g as ToolCallStreamEvent, i as ToolOutput, n as normalizeToolResultOutput, p as parseToolArgs, t as toolResultContentToText } from '../tool-
|
|
4
|
-
export {
|
|
1
|
+
export { b as CreateThinkToolOptions, C as CreateToolOptions, c as createThinkTool, a as createTool } from '../think-tool-DfCMuO8e.js';
|
|
2
|
+
export { A as AgentMiddleware, C as CompletionRequestMiddlewareArgs, a as CompletionRequestMiddlewareResult, b as CompletionResponseMiddlewareArgs, c as CompletionResponseMiddlewareResult, D as DynamicToolIndex, E as EmbedToolsOptions, T as ToolInputMiddlewareArgs, d as ToolInputMiddlewareResult, e as ToolOutputMiddlewareArgs, f as ToolOutputMiddlewareResult, g as ToolResultMiddlewareArgs, i as ToolSearchDocument, j as ToolSet, h as createMiddleware, k as createToolIndex, l as embedTools, m as isDynamicToolIndex } from '../middleware-Dp3d_pxi.js';
|
|
3
|
+
export { A as AnyTool, N as NormalizedToolOutput, T as Tool, a as ToolApprovalContext, b as ToolApprovalDecision, c as ToolApprovalPolicy, d as ToolApprovalRequest, h as ToolApprovalRunContext, e as ToolApprovalsOptions, f as ToolCallContext, g as ToolCallStreamEvent, i as ToolOutput, n as normalizeToolResultOutput, p as parseToolArgs, t as toolResultContentToText } from '../tool-Cohdv5GC.js';
|
|
4
|
+
export { H as isToolResultContentArray, K as serializeToolOutput } from '../types-G12i56s2.js';
|
|
5
5
|
import 'zod';
|
|
6
6
|
import '../zod-schema-C7F4clpm.js';
|
|
7
7
|
import '../types-BCTRUGex.js';
|
|
8
|
-
import '../types-
|
|
8
|
+
import '../types-O-abTIin.js';
|
|
9
9
|
|
|
10
10
|
declare class ToolCallError extends Error {
|
|
11
11
|
readonly cause?: unknown | undefined;
|
package/dist/tool/index.js
CHANGED
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
normalizeToolResultOutput,
|
|
13
13
|
parseToolArgs,
|
|
14
14
|
toolResultContentToText
|
|
15
|
-
} from "../chunk-
|
|
15
|
+
} from "../chunk-HYUYZEAJ.js";
|
|
16
16
|
import {
|
|
17
17
|
createTool
|
|
18
18
|
} from "../chunk-MELYDKWQ.js";
|
|
@@ -21,7 +21,7 @@ import "../chunk-OIMLU4SF.js";
|
|
|
21
21
|
import {
|
|
22
22
|
isToolResultContentArray,
|
|
23
23
|
serializeToolResultOutput
|
|
24
|
-
} from "../chunk-
|
|
24
|
+
} from "../chunk-ADH7NNCS.js";
|
|
25
25
|
import "../chunk-WQKHFADH.js";
|
|
26
26
|
export {
|
|
27
27
|
ToolCallError,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { J as JsonObject,
|
|
1
|
+
import { J as JsonObject, r as ToolDefinition, u as ToolResultContent, l as JsonValue } from './types-G12i56s2.js';
|
|
2
2
|
|
|
3
3
|
type ToolApprovalRunContext = {
|
|
4
4
|
agentId: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { J as JsonObject, M as Message, S as SystemMessage, U as Usage } from './types-
|
|
1
|
+
import { J as JsonObject, M as Message, S as SystemMessage, U as Usage } from './types-G12i56s2.js';
|
|
2
2
|
|
|
3
3
|
type MemorySavePolicy = "message" | "turn" | "run";
|
|
4
4
|
type MemoryContext = {
|
|
@@ -217,10 +217,33 @@ type ProviderToolCall = {
|
|
|
217
217
|
* only aggregate key and should equal the sum of the other buckets.
|
|
218
218
|
*/
|
|
219
219
|
type UsageDetails = Record<string, number>;
|
|
220
|
+
type ModelContextLimits = {
|
|
221
|
+
contextWindow: number;
|
|
222
|
+
maxInputTokens?: number;
|
|
223
|
+
maxOutputTokens?: number;
|
|
224
|
+
};
|
|
225
|
+
type CompletionModelInfo<ModelName extends string = string> = {
|
|
226
|
+
id: ModelName;
|
|
227
|
+
context: ModelContextLimits;
|
|
228
|
+
};
|
|
229
|
+
type CompletionModelMetadataOptions = {
|
|
230
|
+
modelOverrides?: Readonly<Record<string, ModelContextLimits>>;
|
|
231
|
+
};
|
|
232
|
+
type ContextUsage<ModelName extends string = string> = {
|
|
233
|
+
model: CompletionModelInfo<ModelName>;
|
|
234
|
+
usedTokens: number;
|
|
235
|
+
remainingTokens: number;
|
|
236
|
+
usedPercent: number;
|
|
237
|
+
remainingPercent: number;
|
|
238
|
+
};
|
|
239
|
+
declare function calculateContextUsage<ModelName extends string>(usage: Usage, model: CompletionModelInfo<ModelName> | undefined): ContextUsage<ModelName> | undefined;
|
|
240
|
+
declare function withContextUsage<RawResponse, ModelName extends string>(response: CompletionResponse<RawResponse>, model: CompletionModelInfo<ModelName> | undefined): CompletionResponse<RawResponse>;
|
|
241
|
+
declare function resolveCompletionModelInfo<ModelName extends string>(model: ModelName, catalog: Readonly<Record<string, ModelContextLimits>>, overrides?: Readonly<Record<string, ModelContextLimits>>): CompletionModelInfo<ModelName> | undefined;
|
|
220
242
|
type AssistantGenerationMetadata = {
|
|
221
243
|
provider: string;
|
|
222
244
|
model: string;
|
|
223
245
|
usage: Usage;
|
|
246
|
+
contextUsage?: ContextUsage;
|
|
224
247
|
sources?: CompletionSource[];
|
|
225
248
|
providerToolCalls?: ProviderToolCall[];
|
|
226
249
|
};
|
|
@@ -253,6 +276,7 @@ type CompletionRequest<ModelName extends string = string> = {
|
|
|
253
276
|
type CompletionResponse<RawResponse = unknown> = {
|
|
254
277
|
choice: AssistantContent[];
|
|
255
278
|
usage: Usage;
|
|
279
|
+
contextUsage?: ContextUsage;
|
|
256
280
|
rawResponse: RawResponse;
|
|
257
281
|
messageId?: string;
|
|
258
282
|
sources?: CompletionSource[];
|
|
@@ -272,6 +296,7 @@ interface CompletionModel<RawResponse = unknown, ModelName extends string = stri
|
|
|
272
296
|
readonly provider: string;
|
|
273
297
|
readonly defaultModel: ModelName;
|
|
274
298
|
readonly capabilities: CompletionModelCapabilities;
|
|
299
|
+
getModelInfo?(model?: ModelName): CompletionModelInfo<ModelName> | undefined;
|
|
275
300
|
traceRequest?(request: CompletionRequest<ModelName>, options?: {
|
|
276
301
|
stream?: boolean | undefined;
|
|
277
302
|
}): JsonObject | undefined;
|
|
@@ -326,4 +351,4 @@ declare function assertCompletionRequestSupported(model: CompletionModel, reques
|
|
|
326
351
|
}): void;
|
|
327
352
|
declare function textFromAssistantContent(content: AssistantContent[]): string;
|
|
328
353
|
|
|
329
|
-
export { AssistantContent as A,
|
|
354
|
+
export { type ToolFunction as $, AssistantContent as A, getAssistantGenerationMetadata as B, type CompletionModel as C, type Document as D, isProviderTool as E, resolveCompletionModelInfo as F, withContextUsage as G, isToolResultContentArray as H, type ImageContent as I, type JsonObject as J, serializeToolResultOutput as K, type ToolChoice as L, Message as M, CompletionCapabilityError as N, type CompletionModelCapabilities as O, type ProviderTool as P, type CompletionStreamEvent as Q, type DocumentContent as R, type SystemMessage as S, type Text as T, Usage as U, type ImageDetail as V, type Reasoning as W, type ReasoningContent as X, type ReasoningContentType as Y, type StreamingCompletionModel as Z, type ToolCallArgumentsMode as _, type AssistantGenerationMetadata as a, type UsageDetails as a0, assertCompletionRequestSupported as a1, reasoningDisplayText as a2, textFromAssistantContent as a3, type AssistantMessage as b, type AssistantMessageOptions as c, type CompletionModelInfo as d, type CompletionModelMetadataOptions as e, type CompletionRequest as f, type CompletionResponse as g, type CompletionSource as h, type CompletionTool as i, type ContextUsage as j, type JsonPrimitive as k, type JsonValue as l, type MessageOptions as m, type ModelContextLimits as n, type ProviderToolCall as o, type ToolCall as p, ToolContent as q, type ToolDefinition as r, type ToolMessage as s, type ToolResult as t, type ToolResultContent as u, type ToolResultMessageOptions as v, type ToolResultOptions as w, UserContent as x, type UserMessage as y, calculateContextUsage as z };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { SSEClientTransportOptions } from '@modelcontextprotocol/sdk/client/sse.js';
|
|
2
2
|
import { StdioServerParameters } from '@modelcontextprotocol/sdk/client/stdio.js';
|
|
3
3
|
import { StreamableHTTPClientTransportOptions } from '@modelcontextprotocol/sdk/client/streamableHttp.js';
|
|
4
|
-
import { J as JsonObject } from './types-
|
|
5
|
-
import { A as AnyTool } from './tool-
|
|
4
|
+
import { J as JsonObject } from './types-G12i56s2.js';
|
|
5
|
+
import { A as AnyTool } from './tool-Cohdv5GC.js';
|
|
6
6
|
|
|
7
7
|
type McpToolDefinition = {
|
|
8
8
|
name: string;
|
package/dist/ui/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { V as ImageDetail, l as JsonValue, U as Usage, j as ContextUsage, M as Message } from '../types-G12i56s2.js';
|
|
2
2
|
|
|
3
3
|
type UIMessageRole = "system" | "user" | "assistant" | "tool";
|
|
4
4
|
type UIError = {
|
|
@@ -94,6 +94,7 @@ type UIStreamEvent = {
|
|
|
94
94
|
type: "message_end";
|
|
95
95
|
messageId: string;
|
|
96
96
|
usage?: Usage;
|
|
97
|
+
contextUsage?: ContextUsage;
|
|
97
98
|
metadata?: JsonValue;
|
|
98
99
|
} | {
|
|
99
100
|
type: "error";
|
package/dist/ui/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { a as VectorMetadataValue, V as VectorMetadata, E as EmbeddingModel, c as EmbeddedDocument, f as Embedding } from '../types-BCTRUGex.js';
|
|
2
|
-
import { T as Tool } from '../tool-
|
|
3
|
-
import { V as VectorFilter, a as VectorSearchIndex, I as IndexStrategy, b as VectorSearchRequest, c as VectorSearchResult, d as VectorInspectRequest, e as VectorInspectPage, f as VectorSearchToolOptions } from '../types-
|
|
4
|
-
export { L as LshOptions, g as VectorInspectItem } from '../types-
|
|
5
|
-
import '../types-
|
|
2
|
+
import { T as Tool } from '../tool-Cohdv5GC.js';
|
|
3
|
+
import { V as VectorFilter, a as VectorSearchIndex, I as IndexStrategy, b as VectorSearchRequest, c as VectorSearchResult, d as VectorInspectRequest, e as VectorInspectPage, f as VectorSearchToolOptions } from '../types-O-abTIin.js';
|
|
4
|
+
export { L as LshOptions, g as VectorInspectItem } from '../types-O-abTIin.js';
|
|
5
|
+
import '../types-G12i56s2.js';
|
|
6
6
|
|
|
7
7
|
declare const vectorFilter: {
|
|
8
8
|
eq(key: string, value: VectorMetadataValue): VectorFilter;
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/agent/agent.ts","../src/agent/ids.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { isStreamingCompletionModel } from \"../completion/create-completion\";\nimport type {\n CompletionModel,\n Document,\n JsonObject,\n JsonValue,\n Message as MessageType,\n ProviderTool,\n ToolChoice,\n} from \"../completion/index\";\nimport type { GuardrailPolicy } from \"../guardrails\";\nimport type { PromptHook } from \"../hooks\";\nimport type { MemoryContext, MemoryRegistration, SessionOptions } from \"../memory/types\";\nimport type { AgentObserverRegistration } from \"../observability\";\nimport { PromptRequest } from \"../request\";\nimport { createTool } from \"../tool/create-tool\";\nimport type { ToolSearchDocument } from \"../tool/dynamic-tools\";\nimport type { AgentMiddleware } from \"../tool/middleware\";\nimport { isSkillTool } from \"../tool/skill-tool-marker\";\nimport type {\n AnyTool,\n NormalizedToolOutput,\n Tool,\n ToolApprovalsOptions,\n ToolCallContext,\n ToolCallStreamEvent,\n} from \"../tool/tool\";\nimport { ToolSet } from \"../tool/tool-set\";\nimport type { VectorSearchIndex } from \"../vector-store\";\nimport { normalizeAgentId } from \"./ids\";\nimport type {\n AgentEventStoreRegistration,\n AgentOptions,\n AgentToolOptions,\n DynamicContextRegistration,\n DynamicToolRegistration,\n} from \"./types\";\n\nexport const DEFAULT_MAX_TURNS = 20;\n\nexport class Agent<M extends CompletionModel = CompletionModel> {\n readonly id: string;\n readonly name: string | undefined;\n readonly description: string | undefined;\n readonly model: M;\n readonly instructions: string | undefined;\n readonly staticContext: Document[];\n readonly temperature: number | undefined;\n readonly maxTokens: number | undefined;\n readonly additionalParams: JsonValue | undefined;\n readonly toolSet: ToolSet;\n readonly providerTools: ProviderTool[];\n readonly toolChoice: ToolChoice | undefined;\n readonly defaultMaxTurns: number | undefined;\n readonly hook: PromptHook | undefined;\n readonly outputSchema: JsonObject | undefined;\n readonly observers: AgentObserverRegistration[];\n readonly approvals: ToolApprovalsOptions | undefined;\n readonly guardrails: GuardrailPolicy[];\n readonly dynamicContexts: DynamicContextRegistration[];\n readonly dynamicTools: DynamicToolRegistration[];\n readonly middlewares: AgentMiddleware[];\n readonly memory: MemoryRegistration | undefined;\n readonly eventStore: AgentEventStoreRegistration | undefined;\n\n constructor(options: AgentOptions<M>) {\n this.id = normalizeAgentId(options.id);\n this.name = options.name;\n this.description = options.description;\n this.model = options.model;\n this.instructions = options.instructions;\n this.staticContext = [...(options.staticContext ?? [])];\n this.temperature = options.temperature;\n this.maxTokens = options.maxTokens;\n this.additionalParams = options.additionalParams;\n this.toolSet = options.toolSet ?? new ToolSet();\n this.providerTools = [...(options.providerTools ?? [])];\n this.toolChoice = options.toolChoice;\n this.defaultMaxTurns = options.defaultMaxTurns ?? DEFAULT_MAX_TURNS;\n this.hook = options.hook;\n this.outputSchema = options.outputSchema;\n this.observers = [...(options.observers ?? [])];\n this.approvals = options.approvals;\n this.guardrails = [...(options.guardrails ?? [])];\n this.dynamicContexts = [...(options.dynamicContexts ?? [])];\n this.dynamicTools = [...(options.dynamicTools ?? [])];\n this.middlewares = [...(options.middlewares ?? [])];\n this.memory = options.memory;\n this.eventStore = options.eventStore;\n }\n\n prompt(prompt: string | MessageType | MessageType[]): PromptRequest<M> {\n return PromptRequest.fromAgent(this, prompt);\n }\n\n session(sessionId: string, options: SessionOptions = {}): AgentSession<M> {\n if (this.memory === undefined) {\n throw new Error(`Agent \"${this.id}\" has no memory store configured.`);\n }\n const normalized = sessionId.trim();\n if (normalized.length === 0) {\n throw new TypeError(\"Session id must be a non-empty string.\");\n }\n const context: MemoryContext = {\n sessionId: normalized,\n };\n if (options.userId !== undefined) {\n context.userId = options.userId;\n }\n if (options.metadata !== undefined) {\n context.metadata = options.metadata;\n }\n return new AgentSession(this, context);\n }\n\n asTool(options: AgentToolOptions): Tool<{ prompt: string }, string> {\n const description =\n options.description ?? this.description ?? `Prompt the ${options.name} agent.`;\n\n return createTool({\n name: options.name,\n description,\n input: z.object({\n prompt: z.string().describe(\"The prompt to send to the agent.\"),\n }),\n output: z.string(),\n execute: async ({ prompt }, context: ToolCallContext) => {\n const request = this.prompt(prompt);\n const childRequest =\n options.maxTurns === undefined ? request : request.maxTurns(options.maxTurns);\n if (\n options.stream === true &&\n context.emitStreamEvent !== undefined &&\n this.model.capabilities.streaming &&\n isStreamingCompletionModel(this.model)\n ) {\n let output = \"\";\n const childStream =\n context.includeToolCallDeltas === false\n ? childRequest.stream({ includeToolCallDeltas: false })\n : childRequest.stream();\n for await (const event of childStream) {\n const streamEvent: ToolCallStreamEvent = {\n agentId: this.id,\n event,\n };\n if (this.name !== undefined) {\n streamEvent.agentName = this.name;\n }\n await context.emitStreamEvent(streamEvent);\n if (event.type === \"final\") {\n output = event.output;\n }\n }\n return output;\n }\n const response = await childRequest.send();\n return response.output;\n },\n });\n }\n\n getTool(toolName: string): AnyTool | undefined {\n const staticTool = this.toolSet.get(toolName);\n if (staticTool !== undefined) {\n return staticTool;\n }\n\n for (const registration of this.dynamicTools) {\n const dynamicTool = dynamicToolSetFromIndex(registration.index)?.get(toolName);\n if (dynamicTool !== undefined) {\n return dynamicTool;\n }\n }\n\n return undefined;\n }\n\n async callTool(\n toolName: string,\n args: string,\n context?: ToolCallContext,\n ): Promise<NormalizedToolOutput> {\n if (this.toolSet.contains(toolName)) {\n return this.toolSet.call(toolName, args, context);\n }\n\n for (const registration of this.dynamicTools) {\n const toolSet = dynamicToolSetFromIndex(registration.index);\n if (toolSet?.contains(toolName)) {\n return toolSet.call(toolName, args, context);\n }\n }\n\n return this.toolSet.call(toolName, args, context);\n }\n\n shouldApplyToolMiddleware(toolName: string): boolean {\n return !isSkillTool(this.getTool(toolName));\n }\n}\n\nexport class AgentSession<M extends CompletionModel = CompletionModel> {\n constructor(\n private readonly agent: Agent<M>,\n private readonly context: {\n sessionId: string;\n userId?: string | undefined;\n metadata?: JsonObject | undefined;\n },\n ) {}\n\n prompt(prompt: string | MessageType): PromptRequest<M> {\n if (Array.isArray(prompt)) {\n throw new TypeError(\"AgentSession.prompt does not accept Message[] transcripts.\");\n }\n return PromptRequest.fromAgent(this.agent, prompt, { memoryContext: this.context });\n }\n\n async messages(): Promise<MessageType[]> {\n const memory = this.agent.memory;\n if (memory === undefined) {\n throw new Error(`Agent \"${this.agent.id}\" has no memory store configured.`);\n }\n return memory.store.load(this.context);\n }\n\n async clear(): Promise<void> {\n const memory = this.agent.memory;\n if (memory === undefined) {\n throw new Error(`Agent \"${this.agent.id}\" has no memory store configured.`);\n }\n await memory.store.clear(this.context);\n }\n}\n\nfunction dynamicToolSetFromIndex(\n index: VectorSearchIndex<ToolSearchDocument>,\n): ToolSet | undefined {\n const maybeIndex = index as { toolSet?: unknown };\n return maybeIndex.toolSet instanceof ToolSet ? maybeIndex.toolSet : undefined;\n}\n","export function normalizeAgentId(id: string): string {\n if (typeof id !== \"string\") {\n throw new TypeError(\"Agent id must be a string.\");\n }\n\n const normalized = id.trim();\n if (normalized.length === 0) {\n throw new TypeError(\"Agent id must be a non-empty string.\");\n }\n\n return normalized;\n}\n"],"mappings":";;;;;;;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K,QAAQ,KAAK,UAAU,MAAM,OAAO;AAAA,EAClD;AAAA,EAEA,0BAA0B,UAA2B;AACnD,WAAO,CAAC,YAAY,KAAK,QAAQ,QAAQ,CAAC;AAAA,EAC5C;AACF;AAEO,IAAM,eAAN,MAAgE;AAAA,EACrE,YACmB,OACA,SAKjB;AANiB;AACA;AAAA,EAKhB;AAAA,EANgB;AAAA,EACA;AAAA,EAOnB,OAAO,QAAgD;AACrD,QAAI,MAAM,QAAQ,MAAM,GAAG;AACzB,YAAM,IAAI,UAAU,4DAA4D;AAAA,IAClF;AACA,WAAO,cAAc,UAAU,KAAK,OAAO,QAAQ,EAAE,eAAe,KAAK,QAAQ,CAAC;AAAA,EACpF;AAAA,EAEA,MAAM,WAAmC;AACvC,UAAM,SAAS,KAAK,MAAM;AAC1B,QAAI,WAAW,QAAW;AACxB,YAAM,IAAI,MAAM,UAAU,KAAK,MAAM,EAAE,mCAAmC;AAAA,IAC5E;AACA,WAAO,OAAO,MAAM,KAAK,KAAK,OAAO;AAAA,EACvC;AAAA,EAEA,MAAM,QAAuB;AAC3B,UAAM,SAAS,KAAK,MAAM;AAC1B,QAAI,WAAW,QAAW;AACxB,YAAM,IAAI,MAAM,UAAU,KAAK,MAAM,EAAE,mCAAmC;AAAA,IAC5E;AACA,UAAM,OAAO,MAAM,MAAM,KAAK,OAAO;AAAA,EACvC;AACF;AAEA,SAAS,wBACP,OACqB;AACrB,QAAM,aAAa;AACnB,SAAO,WAAW,mBAAmB,UAAU,WAAW,UAAU;AACtE;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/completion/json.ts","../src/completion/types.ts"],"sourcesContent":["import type { JsonValue } from \"./types\";\n\nexport function isJsonValue(value: unknown): value is JsonValue {\n return isJsonValueWithAncestors(value, new WeakSet<object>());\n}\n\nfunction isJsonValueWithAncestors(value: unknown, ancestors: WeakSet<object>): value is JsonValue {\n if (value === null || typeof value === \"string\" || typeof value === \"boolean\") {\n return true;\n }\n if (typeof value === \"number\") {\n return Number.isFinite(value);\n }\n if (typeof value !== \"object\" || ancestors.has(value)) {\n return false;\n }\n\n ancestors.add(value);\n try {\n if (Array.isArray(value)) {\n if (!hasOnlyDenseArrayProperties(value)) {\n return false;\n }\n for (let index = 0; index < value.length; index += 1) {\n if (!isJsonValueWithAncestors(value[index], ancestors)) {\n return false;\n }\n }\n return true;\n }\n\n const prototype = Object.getPrototypeOf(value);\n if (prototype !== Object.prototype && prototype !== null) {\n return false;\n }\n for (const key of Reflect.ownKeys(value)) {\n if (typeof key !== \"string\") {\n return false;\n }\n const descriptor = Object.getOwnPropertyDescriptor(value, key);\n if (\n descriptor === undefined ||\n !descriptor.enumerable ||\n !(\"value\" in descriptor) ||\n !isJsonValueWithAncestors(descriptor.value, ancestors)\n ) {\n return false;\n }\n }\n return true;\n } catch {\n return false;\n } finally {\n ancestors.delete(value);\n }\n}\n\nfunction hasOnlyDenseArrayProperties(value: unknown[]): boolean {\n const keys = Reflect.ownKeys(value);\n if (keys.length !== value.length + 1 || keys.at(-1) !== \"length\") {\n return false;\n }\n for (let index = 0; index < value.length; index += 1) {\n const key = String(index);\n if (keys[index] !== key) {\n return false;\n }\n const descriptor = Object.getOwnPropertyDescriptor(value, key);\n if (descriptor === undefined || !descriptor.enumerable || !(\"value\" in descriptor)) {\n return false;\n }\n }\n return true;\n}\n","import { isJsonValue } from \"./json\";\n\nexport type JsonPrimitive = string | number | boolean | null;\nexport type JsonValue = JsonPrimitive | JsonObject | JsonValue[];\nexport type JsonObject = { [key: string]: JsonValue | undefined };\n\nexport type Document = {\n id: string;\n text: string;\n additionalProps?: Record<string, string>;\n};\n\nexport type Text = {\n type: \"text\";\n text: string;\n signature?: string;\n};\n\nexport type ImageDetail = \"auto\" | \"low\" | \"high\";\n\nexport type ImageContent = {\n type: \"image\";\n source:\n | {\n type: \"url\";\n url: string;\n }\n | {\n type: \"base64\";\n data: string;\n mediaType: string;\n };\n detail?: ImageDetail;\n};\n\nexport type DocumentContent = {\n type: \"document\";\n source:\n | {\n type: \"url\";\n url: string;\n mediaType: string;\n filename?: string;\n }\n | {\n type: \"base64\";\n data: string;\n mediaType: string;\n filename?: string;\n }\n | {\n type: \"text\";\n text: string;\n mediaType?: string;\n filename?: string;\n };\n};\n\nexport type Reasoning = {\n type: \"reasoning\";\n text: string;\n id?: string;\n content?: ReasoningContent[];\n};\n\nexport type ReasoningContent =\n | {\n type: \"text\";\n text: string;\n signature?: string;\n }\n | {\n type: \"summary\";\n text: string;\n }\n | {\n type: \"encrypted\";\n data: string;\n }\n | {\n type: \"redacted\";\n data: string;\n };\n\nexport type ReasoningContentType = ReasoningContent[\"type\"];\n\nexport type ToolFunction = {\n name: string;\n arguments: JsonValue;\n};\n\nexport type ToolCall = {\n type: \"tool_call\";\n id: string;\n callId?: string;\n function: ToolFunction;\n signature?: string;\n additionalParams?: JsonValue;\n};\n\nexport type ToolResultContent =\n | { type: \"text\"; text: string }\n | { type: \"image\"; data: string; mediaType?: string };\n\nexport type ToolResult = {\n type: \"tool_result\";\n id: string;\n callId?: string;\n toolName?: string;\n content: ToolResultContent[];\n};\n\nexport type MessageOptions = {\n metadata?: JsonValue | undefined;\n};\n\nexport type AssistantMessageOptions = MessageOptions & {\n id?: string | undefined;\n};\n\nexport type ToolResultOptions = {\n callId?: string | undefined;\n toolName?: string | undefined;\n};\n\nexport type ToolResultMessageOptions = ToolResultOptions & MessageOptions;\n\nexport type UserContent = Text | ImageContent | DocumentContent;\nexport type AssistantContent = Text | ToolCall | Reasoning | ImageContent;\nexport type ToolContent = ToolResult;\n\nexport type SystemMessage = {\n role: \"system\";\n content: string;\n metadata?: JsonValue;\n};\n\nexport type UserMessage = {\n role: \"user\";\n content: UserContent[];\n metadata?: JsonValue;\n};\n\nexport type AssistantMessage = {\n role: \"assistant\";\n id?: string;\n content: AssistantContent[];\n metadata?: JsonValue;\n};\n\nexport type ToolMessage = {\n role: \"tool\";\n content: ToolContent[];\n metadata?: JsonValue;\n};\n\nexport type Message = SystemMessage | UserMessage | AssistantMessage | ToolMessage;\n\nexport const UserContent = {\n text(text: string): Text {\n return { type: \"text\", text };\n },\n imageUrl(url: string, options: { detail?: ImageDetail } = {}): ImageContent {\n const image: ImageContent = { type: \"image\", source: { type: \"url\", url } };\n if (options.detail !== undefined) {\n image.detail = options.detail;\n }\n return image;\n },\n imageBase64(\n data: string,\n mediaType: string,\n options: { detail?: ImageDetail } = {},\n ): ImageContent {\n const image: ImageContent = {\n type: \"image\",\n source: { type: \"base64\", data, mediaType },\n };\n if (options.detail !== undefined) {\n image.detail = options.detail;\n }\n return image;\n },\n documentUrl(\n url: string,\n mediaType: string,\n options: { filename?: string | undefined } = {},\n ): DocumentContent {\n return {\n type: \"document\",\n source:\n options.filename === undefined\n ? { type: \"url\", url, mediaType }\n : { type: \"url\", url, mediaType, filename: options.filename },\n };\n },\n documentBase64(\n data: string,\n mediaType: string,\n options: { filename?: string | undefined } = {},\n ): DocumentContent {\n return {\n type: \"document\",\n source:\n options.filename === undefined\n ? { type: \"base64\", data, mediaType }\n : { type: \"base64\", data, mediaType, filename: options.filename },\n };\n },\n documentText(text: string): Text {\n return { type: \"text\", text };\n },\n};\n\nexport const ToolContent = {\n toolResult(\n id: string,\n content: string | ToolResultContent[],\n callIdOrOptions?: string | ToolResultOptions,\n toolName?: string,\n ): ToolResult {\n const normalized =\n typeof content === \"string\" ? [{ type: \"text\" as const, text: content }] : content;\n const options = normalizeToolResultOptions(callIdOrOptions, toolName);\n const result: ToolResult = { type: \"tool_result\", id, content: normalized };\n if (options.callId !== undefined) {\n result.callId = options.callId;\n }\n if (options.toolName !== undefined) {\n result.toolName = options.toolName;\n }\n return result;\n },\n};\n\nfunction normalizeToolResultOptions(\n callIdOrOptions?: string | ToolResultOptions,\n toolName?: string,\n): ToolResultOptions {\n if (callIdOrOptions === undefined) {\n return toolName === undefined ? {} : { toolName };\n }\n if (typeof callIdOrOptions === \"string\") {\n return toolName === undefined\n ? { callId: callIdOrOptions }\n : { callId: callIdOrOptions, toolName };\n }\n return toolName === undefined ? callIdOrOptions : { ...callIdOrOptions, toolName };\n}\n\nexport function serializeToolResultOutput(output: unknown): string {\n if (typeof output === \"string\") {\n return output;\n }\n\n try {\n const serialized = JSON.stringify(output);\n return serialized === undefined ? String(output) : serialized;\n } catch {\n return String(output);\n }\n}\n\nexport function isToolResultContentArray(value: unknown): value is ToolResultContent[] {\n return (\n Array.isArray(value) &&\n value.length > 0 &&\n value.every((item) => {\n if (typeof item !== \"object\" || item === null || !(\"type\" in item)) {\n return false;\n }\n if (item.type === \"text\") {\n return \"text\" in item && typeof item.text === \"string\";\n }\n if (item.type === \"image\") {\n return (\n \"data\" in item &&\n typeof item.data === \"string\" &&\n (!(\"mediaType\" in item) ||\n item.mediaType === undefined ||\n typeof item.mediaType === \"string\")\n );\n }\n return false;\n })\n );\n}\n\nexport const AssistantContent = {\n text(text: string): Text {\n return { type: \"text\", text };\n },\n imageUrl(url: string, options: { detail?: ImageDetail } = {}): ImageContent {\n const image: ImageContent = { type: \"image\", source: { type: \"url\", url } };\n if (options.detail !== undefined) {\n image.detail = options.detail;\n }\n return image;\n },\n imageBase64(\n data: string,\n mediaType: string,\n options: { detail?: ImageDetail } = {},\n ): ImageContent {\n const image: ImageContent = {\n type: \"image\",\n source: { type: \"base64\", data, mediaType },\n };\n if (options.detail !== undefined) {\n image.detail = options.detail;\n }\n return image;\n },\n reasoning(text: string, id?: string): Reasoning {\n return id === undefined ? { type: \"reasoning\", text } : { type: \"reasoning\", text, id };\n },\n reasoningFromContent(content: ReasoningContent[], id?: string): Reasoning {\n const text = reasoningDisplayText(content);\n const reasoning: Reasoning = { type: \"reasoning\", text, content };\n return id === undefined ? reasoning : { ...reasoning, id };\n },\n reasoningSummary(text: string, id?: string): Reasoning {\n return AssistantContent.reasoningFromContent([{ type: \"summary\", text }], id);\n },\n reasoningEncrypted(data: string, id?: string): Reasoning {\n return AssistantContent.reasoningFromContent([{ type: \"encrypted\", data }], id);\n },\n reasoningRedacted(data: string, id?: string): Reasoning {\n return AssistantContent.reasoningFromContent([{ type: \"redacted\", data }], id);\n },\n toolCall(id: string, name: string, args: JsonValue, callId?: string): ToolCall {\n const base: ToolCall = {\n type: \"tool_call\",\n id,\n function: {\n name,\n arguments: args,\n },\n };\n return callId === undefined ? base : { ...base, callId };\n },\n};\n\nexport function reasoningDisplayText(reasoning: Reasoning | ReasoningContent[]): string {\n const content = Array.isArray(reasoning) ? reasoning : reasoning.content;\n if (content === undefined) {\n return Array.isArray(reasoning) ? \"\" : reasoning.text;\n }\n return content\n .flatMap((item) => {\n if (item.type === \"text\" || item.type === \"summary\") {\n return [item.text];\n }\n return [];\n })\n .join(\"\");\n}\n\nexport const Message = {\n system(content: string, options: MessageOptions = {}): Message {\n return { role: \"system\", content, ...messageMetadata(options) };\n },\n user(content: string | UserContent[], options: MessageOptions = {}): Message {\n return {\n role: \"user\",\n content: typeof content === \"string\" ? [UserContent.text(content)] : content,\n ...messageMetadata(options),\n };\n },\n assistant(\n content: string | AssistantContent[],\n idOrOptions?: string | AssistantMessageOptions,\n ): Message {\n const normalized = typeof content === \"string\" ? [AssistantContent.text(content)] : content;\n const options = typeof idOrOptions === \"string\" ? { id: idOrOptions } : (idOrOptions ?? {});\n const metadata = messageMetadata(options).metadata;\n const message: AssistantMessage =\n options.id === undefined\n ? { role: \"assistant\", content: normalized }\n : { role: \"assistant\", id: options.id, content: normalized };\n if (metadata !== undefined) {\n message.metadata = metadata;\n }\n return message;\n },\n tool(content: ToolContent | ToolContent[], options: MessageOptions = {}): Message {\n return {\n role: \"tool\",\n content: Array.isArray(content) ? content : [content],\n ...messageMetadata(options),\n };\n },\n toolResult(id: string, output: unknown, options: ToolResultMessageOptions = {}): Message {\n const content = isToolResultContentArray(output) ? output : serializeToolResultOutput(output);\n return Message.tool(\n ToolContent.toolResult(id, content, {\n callId: options.callId,\n toolName: options.toolName,\n }),\n { metadata: options.metadata },\n );\n },\n};\n\nfunction messageMetadata(options: MessageOptions): { metadata?: JsonValue } {\n if (options.metadata === undefined) {\n return {};\n }\n if (!isJsonValue(options.metadata)) {\n throw new TypeError(\"Message metadata must be a strict JSON value.\");\n }\n return { metadata: options.metadata };\n}\n\nexport type ToolChoice =\n | \"auto\"\n | \"required\"\n | \"none\"\n | {\n type: \"function\";\n name: string;\n };\n\nexport type ToolDefinition = {\n name: string;\n description: string;\n parameters: JsonObject;\n};\n\n/**\n * A tool executed by the model provider rather than by Anvia's local tool runtime.\n *\n * Provider packages expose typed factories for these values. Application code can\n * pass them through the same high-level `tools` APIs used for local tools.\n */\nexport type ProviderTool = {\n kind: \"provider\";\n provider: string;\n name: string;\n configuration?: JsonObject;\n};\n\nexport type CompletionTool = ToolDefinition | ProviderTool;\n\nexport function isProviderTool(value: unknown): value is ProviderTool {\n if (typeof value !== \"object\" || value === null || Array.isArray(value)) {\n return false;\n }\n const candidate = value as Partial<ProviderTool>;\n return (\n candidate.kind === \"provider\" &&\n typeof candidate.provider === \"string\" &&\n candidate.provider.trim().length > 0 &&\n typeof candidate.name === \"string\" &&\n candidate.name.trim().length > 0 &&\n (candidate.configuration === undefined ||\n (typeof candidate.configuration === \"object\" &&\n candidate.configuration !== null &&\n !Array.isArray(candidate.configuration) &&\n isJsonValue(candidate.configuration)))\n );\n}\n\nexport type CompletionSource = {\n type: \"url\";\n url: string;\n title?: string;\n id?: string;\n startIndex?: number;\n endIndex?: number;\n};\n\nexport type ProviderToolCall = {\n id: string;\n name: string;\n status?: string;\n details?: JsonObject;\n};\n\n/**\n * Provider-normalized, mutually exclusive usage buckets.\n *\n * Every token should appear in exactly one non-total bucket. `total` is the\n * only aggregate key and should equal the sum of the other buckets.\n */\nexport type UsageDetails = Record<string, number>;\n\nexport type Usage = {\n inputTokens: number;\n outputTokens: number;\n totalTokens: number;\n cachedInputTokens: number;\n cacheCreationInputTokens: number;\n details?: UsageDetails;\n};\n\nexport type AssistantGenerationMetadata = {\n provider: string;\n model: string;\n usage: Usage;\n sources?: CompletionSource[];\n providerToolCalls?: ProviderToolCall[];\n};\n\nexport const Usage = {\n empty(): Usage {\n return {\n inputTokens: 0,\n outputTokens: 0,\n totalTokens: 0,\n cachedInputTokens: 0,\n cacheCreationInputTokens: 0,\n };\n },\n add(left: Usage, right: Usage): Usage {\n const result: Usage = {\n inputTokens: left.inputTokens + right.inputTokens,\n outputTokens: left.outputTokens + right.outputTokens,\n totalTokens: left.totalTokens + right.totalTokens,\n cachedInputTokens: left.cachedInputTokens + right.cachedInputTokens,\n cacheCreationInputTokens: left.cacheCreationInputTokens + right.cacheCreationInputTokens,\n };\n const details = addUsageDetails(left, right);\n if (details !== undefined) {\n result.details = details;\n }\n return result;\n },\n};\n\nfunction addUsageDetails(left: Usage, right: Usage): UsageDetails | undefined {\n if (isEmptyUsage(left) && left.details === undefined) {\n return right.details === undefined ? undefined : { ...right.details };\n }\n if (isEmptyUsage(right) && right.details === undefined) {\n return left.details === undefined ? undefined : { ...left.details };\n }\n if (left.details === undefined || right.details === undefined) {\n return undefined;\n }\n const details: UsageDetails = { ...left.details };\n for (const [key, value] of Object.entries(right.details)) {\n details[key] = (details[key] ?? 0) + value;\n }\n return details;\n}\n\nfunction isEmptyUsage(usage: Usage): boolean {\n return (\n usage.inputTokens === 0 &&\n usage.outputTokens === 0 &&\n usage.totalTokens === 0 &&\n usage.cachedInputTokens === 0 &&\n usage.cacheCreationInputTokens === 0\n );\n}\n\nexport function getAssistantGenerationMetadata(\n message: Message,\n): AssistantGenerationMetadata | undefined {\n if (message.role !== \"assistant\" || !isJsonObjectValue(message.metadata)) {\n return undefined;\n }\n const frameworkMetadata = message.metadata.anvia;\n if (!isJsonObjectValue(frameworkMetadata)) {\n return undefined;\n }\n const generation = frameworkMetadata.generation;\n if (\n !isJsonObjectValue(generation) ||\n typeof generation.provider !== \"string\" ||\n typeof generation.model !== \"string\" ||\n !isUsageValue(generation.usage)\n ) {\n return undefined;\n }\n const metadata: AssistantGenerationMetadata = {\n provider: generation.provider,\n model: generation.model,\n usage: {\n ...generation.usage,\n ...(generation.usage.details === undefined\n ? {}\n : { details: { ...generation.usage.details } }),\n },\n };\n if (isCompletionSourceArray(generation.sources)) {\n metadata.sources = generation.sources.map((source) => ({ ...source }));\n }\n if (isProviderToolCallArray(generation.providerToolCalls)) {\n metadata.providerToolCalls = generation.providerToolCalls.map((toolCall) => ({\n ...toolCall,\n ...(toolCall.details === undefined ? {} : { details: { ...toolCall.details } }),\n }));\n }\n return metadata;\n}\n\nfunction isJsonObjectValue(value: JsonValue | undefined): value is JsonObject {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction isUsageValue(value: JsonValue | undefined): value is JsonObject & Usage {\n if (!isJsonObjectValue(value)) {\n return false;\n }\n return (\n isNonnegativeFiniteNumber(value.inputTokens) &&\n isNonnegativeFiniteNumber(value.outputTokens) &&\n isNonnegativeFiniteNumber(value.totalTokens) &&\n isNonnegativeFiniteNumber(value.cachedInputTokens) &&\n isNonnegativeFiniteNumber(value.cacheCreationInputTokens) &&\n isUsageDetailsValue(value.details)\n );\n}\n\nfunction isNonnegativeFiniteNumber(value: JsonValue | undefined): value is number {\n return typeof value === \"number\" && Number.isFinite(value) && value >= 0;\n}\n\nfunction isUsageDetailsValue(value: JsonValue | undefined): value is JsonObject | undefined {\n if (value === undefined) {\n return true;\n }\n if (!isJsonObjectValue(value)) {\n return false;\n }\n let total: number | undefined;\n let bucketSum = 0;\n for (const [key, detail] of Object.entries(value)) {\n if (detail === undefined || !isNonnegativeFiniteNumber(detail)) {\n return false;\n }\n if (key === \"total\") {\n total = detail;\n } else {\n bucketSum += detail;\n }\n }\n return total !== undefined && total === bucketSum;\n}\n\nfunction isCompletionSourceArray(value: JsonValue | undefined): value is CompletionSource[] {\n return (\n Array.isArray(value) &&\n value.every(\n (source) =>\n isJsonObjectValue(source) &&\n source.type === \"url\" &&\n typeof source.url === \"string\" &&\n (source.title === undefined || typeof source.title === \"string\") &&\n (source.id === undefined || typeof source.id === \"string\") &&\n (source.startIndex === undefined || typeof source.startIndex === \"number\") &&\n (source.endIndex === undefined || typeof source.endIndex === \"number\"),\n )\n );\n}\n\nfunction isProviderToolCallArray(value: JsonValue | undefined): value is ProviderToolCall[] {\n return (\n Array.isArray(value) &&\n value.every(\n (toolCall) =>\n isJsonObjectValue(toolCall) &&\n typeof toolCall.id === \"string\" &&\n typeof toolCall.name === \"string\" &&\n (toolCall.status === undefined || typeof toolCall.status === \"string\") &&\n (toolCall.details === undefined || isJsonObjectValue(toolCall.details)),\n )\n );\n}\n\nexport type CompletionRequest<ModelName extends string = string> = {\n model?: ModelName;\n instructions?: string;\n chatHistory: Message[];\n documents: Document[];\n tools: ToolDefinition[];\n providerTools?: ProviderTool[];\n temperature?: number;\n maxTokens?: number;\n toolChoice?: ToolChoice;\n additionalParams?: JsonValue;\n outputSchema?: JsonObject;\n};\n\nexport type CompletionResponse<RawResponse = unknown> = {\n choice: AssistantContent[];\n usage: Usage;\n rawResponse: RawResponse;\n messageId?: string;\n sources?: CompletionSource[];\n providerToolCalls?: ProviderToolCall[];\n};\n\nexport type CompletionModelCapabilities = {\n streaming: boolean;\n tools: boolean;\n toolChoice: boolean;\n imageInput: boolean;\n documentInput: boolean;\n outputSchema: boolean;\n reasoning: boolean;\n providerTools?: boolean;\n};\n\nexport interface CompletionModel<RawResponse = unknown, ModelName extends string = string> {\n readonly provider: string;\n readonly defaultModel: ModelName;\n readonly capabilities: CompletionModelCapabilities;\n traceRequest?(\n request: CompletionRequest<ModelName>,\n options?: { stream?: boolean | undefined },\n ): JsonObject | undefined;\n completion(request: CompletionRequest<ModelName>): Promise<CompletionResponse<RawResponse>>;\n}\n\nexport type ToolCallArgumentsMode = \"append\" | \"replace\";\n\nexport type CompletionStreamEvent<RawResponse = unknown> =\n | {\n type: \"text_delta\";\n delta: string;\n }\n | {\n type: \"reasoning_delta\";\n delta: string;\n id?: string;\n contentType?: ReasoningContentType;\n signature?: string;\n }\n | {\n type: \"tool_call_delta\";\n id: string;\n callId?: string;\n name?: string;\n argumentsDelta?: string;\n argumentsMode?: ToolCallArgumentsMode;\n signature?: string;\n }\n | {\n type: \"tool_call\";\n toolCall: ToolCall;\n }\n | {\n type: \"source\";\n source: CompletionSource;\n }\n | {\n type: \"provider_tool_call\";\n toolCall: ProviderToolCall;\n }\n | {\n type: \"message_id\";\n id: string;\n }\n | {\n type: \"final\";\n response: CompletionResponse<RawResponse>;\n }\n | {\n type: \"error\";\n error: unknown;\n usage?: Usage;\n };\n\nexport interface StreamingCompletionModel<RawResponse = unknown, ModelName extends string = string>\n extends CompletionModel<RawResponse, ModelName> {\n streamCompletion(\n request: CompletionRequest<ModelName>,\n ): AsyncIterable<CompletionStreamEvent<RawResponse>>;\n}\n\nexport class CompletionCapabilityError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"CompletionCapabilityError\";\n }\n}\n\nexport function assertCompletionRequestSupported(\n model: CompletionModel,\n request: CompletionRequest,\n options: { streaming?: boolean | undefined } = {},\n): void {\n const modelLabel = `${model.provider}:${request.model ?? model.defaultModel}`;\n const capabilities = model.capabilities;\n\n if (options.streaming === true && !capabilities.streaming) {\n throw new CompletionCapabilityError(`${modelLabel} does not support streaming completions.`);\n }\n\n if (request.tools.length > 0 && !capabilities.tools) {\n throw new CompletionCapabilityError(`${modelLabel} does not support tool definitions.`);\n }\n\n if ((request.providerTools?.length ?? 0) > 0 && capabilities.providerTools !== true) {\n throw new CompletionCapabilityError(`${modelLabel} does not support provider-executed tools.`);\n }\n\n if (request.toolChoice !== undefined && !capabilities.toolChoice) {\n throw new CompletionCapabilityError(`${modelLabel} does not support tool choice.`);\n }\n\n if (request.outputSchema !== undefined && !capabilities.outputSchema) {\n throw new CompletionCapabilityError(`${modelLabel} does not support output schemas.`);\n }\n\n if (!capabilities.imageInput && requestHasImageInput(request)) {\n throw new CompletionCapabilityError(`${modelLabel} does not support image input.`);\n }\n\n if (!capabilities.documentInput && requestHasFileDocumentInput(request)) {\n throw new CompletionCapabilityError(`${modelLabel} does not support document file input.`);\n }\n}\n\nexport function textFromAssistantContent(content: AssistantContent[]): string {\n return content.flatMap((item) => (item.type === \"text\" ? [item.text] : [])).join(\"\\n\");\n}\n\nfunction requestHasImageInput(request: CompletionRequest): boolean {\n return request.chatHistory.some((message) =>\n message.role === \"system\" ? false : message.content.some((content) => content.type === \"image\"),\n );\n}\n\nfunction requestHasFileDocumentInput(request: CompletionRequest): boolean {\n return request.chatHistory.some((message) =>\n message.role === \"user\"\n ? message.content.some(\n (content) => content.type === \"document\" && content.source.type !== \"text\",\n )\n : false,\n );\n}\n"],"mappings":";AAEO,SAAS,YAAY,OAAoC;AAC9D,SAAO,yBAAyB,OAAO,oBAAI,QAAgB,CAAC;AAC9D;AAEA,SAAS,yBAAyB,OAAgB,WAAgD;AAChG,MAAI,UAAU,QAAQ,OAAO,UAAU,YAAY,OAAO,UAAU,WAAW;AAC7E,WAAO;AAAA,EACT;AACA,MAAI,OAAO,UAAU,UAAU;AAC7B,WAAO,OAAO,SAAS,KAAK;AAAA,EAC9B;AACA,MAAI,OAAO,UAAU,YAAY,UAAU,IAAI,KAAK,GAAG;AACrD,WAAO;AAAA,EACT;AAEA,YAAU,IAAI,KAAK;AACnB,MAAI;AACF,QAAI,MAAM,QAAQ,KAAK,GAAG;AACxB,UAAI,CAAC,4BAA4B,KAAK,GAAG;AACvC,eAAO;AAAA,MACT;AACA,eAAS,QAAQ,GAAG,QAAQ,MAAM,QAAQ,SAAS,GAAG;AACpD,YAAI,CAAC,yBAAyB,MAAM,KAAK,GAAG,SAAS,GAAG;AACtD,iBAAO;AAAA,QACT;AAAA,MACF;AACA,aAAO;AAAA,IACT;AAEA,UAAM,YAAY,OAAO,eAAe,KAAK;AAC7C,QAAI,cAAc,OAAO,aAAa,cAAc,MAAM;AACxD,aAAO;AAAA,IACT;AACA,eAAW,OAAO,QAAQ,QAAQ,KAAK,GAAG;AACxC,UAAI,OAAO,QAAQ,UAAU;AAC3B,eAAO;AAAA,MACT;AACA,YAAM,aAAa,OAAO,yBA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0B,GAAG,UAAU,4CAA4C;AAAA,EAC/F;AAEA,MAAI,QAAQ,eAAe,UAAa,CAAC,aAAa,YAAY;AAChE,UAAM,IAAI,0BAA0B,GAAG,UAAU,gCAAgC;AAAA,EACnF;AAEA,MAAI,QAAQ,iBAAiB,UAAa,CAAC,aAAa,cAAc;AACpE,UAAM,IAAI,0BAA0B,GAAG,UAAU,mCAAmC;AAAA,EACtF;AAEA,MAAI,CAAC,aAAa,cAAc,qBAAqB,OAAO,GAAG;AAC7D,UAAM,IAAI,0BAA0B,GAAG,UAAU,gCAAgC;AAAA,EACnF;AAEA,MAAI,CAAC,aAAa,iBAAiB,4BAA4B,OAAO,GAAG;AACvE,UAAM,IAAI,0BAA0B,GAAG,UAAU,wCAAwC;AAAA,EAC3F;AACF;AAEO,SAAS,yBAAyB,SAAqC;AAC5E,SAAO,QAAQ,QAAQ,CAAC,SAAU,KAAK,SAAS,SAAS,CAAC,KAAK,IAAI,IAAI,CAAC,CAAE,EAAE,KAAK,IAAI;AACvF;AAEA,SAAS,qBAAqB,SAAqC;AACjE,SAAO,QAAQ,YAAY;AAAA,IAAK,CAAC,YAC/B,QAAQ,SAAS,WAAW,QAAQ,QAAQ,QAAQ,KAAK,CAAC,YAAY,QAAQ,SAAS,OAAO;AAAA,EAChG;AACF;AAEA,SAAS,4BAA4B,SAAqC;AACxE,SAAO,QAAQ,YAAY;AAAA,IAAK,CAAC,YAC/B,QAAQ,SAAS,SACb,QAAQ,QAAQ;AAAA,MACd,CAAC,YAAY,QAAQ,SAAS,cAAc,QAAQ,OAAO,SAAS;AAAA,IACtE,IACA;AAAA,EACN;AACF;","names":[]}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|