@anvia/core 0.12.0 → 0.12.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/dist/agent/index.d.ts +8 -8
- package/dist/agent/index.js +6 -6
- package/dist/{agent-BWF8_O8k.d.ts → agent-BBj3jvBi.d.ts} +4 -4
- package/dist/{chunk-KTTIPWE7.js → chunk-4NCRFQHS.js} +20 -140
- package/dist/chunk-4NCRFQHS.js.map +1 -0
- package/dist/{chunk-YRERPIA5.js → chunk-CWUJUSOS.js} +4 -164
- package/dist/chunk-CWUJUSOS.js.map +1 -0
- package/dist/{chunk-ZGIE73BH.js → chunk-J3ROUB3P.js} +2 -2
- package/dist/{chunk-JNO4AR7Q.js → chunk-LKLKEECY.js} +93 -5
- package/dist/chunk-LKLKEECY.js.map +1 -0
- package/dist/{chunk-PGFYN5ZX.js → chunk-QKA6OQTH.js} +2 -4
- package/dist/chunk-QKA6OQTH.js.map +1 -0
- package/dist/{chunk-MIJUAWHU.js → chunk-QNVLGAPV.js} +4 -4
- package/dist/{chunk-4AJJIIAQ.js → chunk-TUDZBJGF.js} +4 -4
- package/dist/{chunk-TIH4QM55.js → chunk-XUO3KR5T.js} +4 -4
- package/dist/{chunk-R7F2JF7J.js → chunk-YVQBC3SJ.js} +2 -2
- package/dist/chunk-YVQBC3SJ.js.map +1 -0
- package/dist/evals/index.d.ts +5 -5
- package/dist/evals/index.js +7 -7
- package/dist/extractor/index.d.ts +5 -5
- package/dist/extractor/index.js +7 -7
- package/dist/guardrails/index.d.ts +6 -84
- package/dist/guardrails/index.js +3 -11
- package/dist/{index-DsWWqP0Q.d.ts → index-Oucb3Ljj.d.ts} +1 -1
- package/dist/index.d.ts +10 -10
- package/dist/index.js +8 -12
- package/dist/internal/agent.d.ts +5 -5
- package/dist/internal/agent.js +5 -5
- package/dist/mcp/index.d.ts +3 -4
- package/dist/{middleware-BTR0eRtx.d.ts → middleware-ByyL6Rj0.d.ts} +2 -2
- package/dist/observability/index.d.ts +2 -2
- package/dist/pipeline/index.d.ts +5 -5
- package/dist/request/index.d.ts +5 -5
- package/dist/request/index.js +4 -4
- package/dist/skills/index.d.ts +3 -4
- package/dist/skills/index.js +3 -3
- package/dist/{think-tool-Bn3HHu_z.d.ts → think-tool-B065hm73.d.ts} +1 -4
- package/dist/tool/index.d.ts +4 -5
- package/dist/tool/index.js +2 -2
- package/dist/{tool-DGELXD2z.d.ts → tool-B8K543oQ.d.ts} +0 -3
- package/dist/{types-Dc83Qzch.d.ts → types-7F_IKQQW.d.ts} +1 -1
- package/dist/{types-Bx_ZtjPi.d.ts → types-BzUuhjKr.d.ts} +1 -1
- package/dist/{types-9VPKg7ih.d.ts → types-Pl4PFQWL.d.ts} +1 -1
- package/dist/ui/index.d.ts +20 -2
- package/dist/ui/index.js +1 -1
- package/dist/vector-store/index.d.ts +3 -4
- package/dist/vector-store/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-JNO4AR7Q.js.map +0 -1
- package/dist/chunk-KTTIPWE7.js.map +0 -1
- package/dist/chunk-PGFYN5ZX.js.map +0 -1
- package/dist/chunk-R7F2JF7J.js.map +0 -1
- package/dist/chunk-YRERPIA5.js.map +0 -1
- /package/dist/{chunk-ZGIE73BH.js.map → chunk-J3ROUB3P.js.map} +0 -0
- /package/dist/{chunk-MIJUAWHU.js.map → chunk-QNVLGAPV.js.map} +0 -0
- /package/dist/{chunk-4AJJIIAQ.js.map → chunk-TUDZBJGF.js.map} +0 -0
- /package/dist/{chunk-TIH4QM55.js.map → chunk-XUO3KR5T.js.map} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/tool/errors.ts","../src/tool/tool.ts","../src/tool/tool-set.ts","../src/tool/dynamic-tools.ts","../src/tool/middleware.ts","../src/tool/think-tool.ts"],"sourcesContent":["export class ToolCallError extends Error {\n constructor(\n message: string,\n readonly cause?: unknown,\n ) {\n super(message);\n this.name = \"ToolCallError\";\n }\n}\n\nexport class ToolNotFoundError extends Error {\n constructor(readonly toolName: string) {\n super(`Tool not found: ${toolName}`);\n this.name = \"ToolNotFoundError\";\n }\n}\n\nexport class ToolJsonError extends Error {\n constructor(\n message: string,\n readonly cause?: unknown,\n ) {\n super(message);\n this.name = \"ToolJsonError\";\n }\n}\n","import type { JsonObject, JsonValue, ToolDefinition, ToolResultContent } from \"../completion/types\";\nimport {\n isToolResultContentArray,\n serializeToolResultOutput as serializeToolOutput,\n} from \"../completion/types\";\n\nexport type ToolApprovalRunContext = {\n agentId: string;\n runId: string;\n sessionId?: string;\n metadata?: JsonObject;\n};\n\nexport type ToolApprovalContext<Args = unknown> = {\n toolName: string;\n args: Args;\n rawArgs: string;\n toolCallId?: string;\n internalCallId: string;\n run: ToolApprovalRunContext;\n};\n\nexport type ToolApprovalPolicy<Args = unknown> = {\n when(ctx: ToolApprovalContext<Args>): boolean | Promise<boolean>;\n reason?: string | ((ctx: ToolApprovalContext<Args>) => string | Promise<string>);\n rejectMessage?: string | ((ctx: ToolApprovalContext<Args>) => string | Promise<string>);\n};\n\nexport type ToolApprovalRequest<Args = unknown> = ToolApprovalContext<Args> & {\n reason?: string;\n rejectMessage?: string;\n};\n\nexport type ToolApprovalDecision =\n | boolean\n | { approved: true; reason?: string }\n | { approved: false; reason?: string; rejectMessage?: string };\n\nexport type ToolApprovalsOptions = {\n handler(request: ToolApprovalRequest): ToolApprovalDecision | Promise<ToolApprovalDecision>;\n};\n\nexport type ToolCallStreamEvent = {\n agentId: string;\n agentName?: string | undefined;\n event: unknown;\n};\n\nexport type ToolCallContext = {\n emitStreamEvent?(event: ToolCallStreamEvent): void | Promise<void>;\n};\n\nexport interface Tool<Args = unknown, Output = unknown> {\n readonly name: string;\n readonly approval?: ToolApprovalPolicy<Args>;\n definition(prompt: string): ToolDefinition | Promise<ToolDefinition>;\n call(args: Args, context?: ToolCallContext): Output | Promise<Output>;\n parseApprovalArgs?(args: unknown): Args;\n}\n\nexport type AnyTool = Omit<Tool<unknown, unknown>, \"approval\"> & {\n readonly approval?: unknown;\n};\n\nexport type NormalizedToolOutput = string | ToolResultContent[];\n\nexport const ToolOutput = {\n content(content: ToolResultContent[]): ToolResultContent[] {\n return content;\n },\n};\n\nexport { isToolResultContentArray, serializeToolOutput };\n\nexport function normalizeToolResultOutput(output: unknown): NormalizedToolOutput {\n return isToolResultContentArray(output) ? output : serializeToolOutput(output);\n}\n\nexport function toolResultContentToText(content: ToolResultContent[]): string {\n return content\n .map((item) => (item.type === \"text\" ? item.text : `[image:${item.mediaType ?? \"image/png\"}]`))\n .join(\"\\n\");\n}\n\nexport function parseToolArgs(args: string): JsonValue {\n if (args.trim() === \"\") {\n return {};\n }\n\n return JSON.parse(args) as JsonValue;\n}\n","import type { ToolDefinition } from \"../completion/types\";\nimport { ToolCallError, ToolJsonError, ToolNotFoundError } from \"./errors\";\nimport {\n type AnyTool,\n type NormalizedToolOutput,\n normalizeToolResultOutput,\n parseToolArgs,\n type ToolCallContext,\n} from \"./tool\";\n\nexport class ToolSet {\n private readonly tools = new Map<string, AnyTool>();\n\n static fromTools(tools: AnyTool[]): ToolSet {\n const toolSet = new ToolSet();\n for (const tool of tools) {\n toolSet.addTool(tool);\n }\n return toolSet;\n }\n\n addTool(tool: AnyTool): this {\n this.tools.set(tool.name, tool);\n return this;\n }\n\n addTools(tools: AnyTool[] | ToolSet): this {\n const values = Array.isArray(tools) ? tools : tools.values();\n for (const tool of values) {\n this.addTool(tool);\n }\n return this;\n }\n\n deleteTool(toolName: string): boolean {\n return this.tools.delete(toolName);\n }\n\n contains(toolName: string): boolean {\n return this.tools.has(toolName);\n }\n\n get(toolName: string): AnyTool | undefined {\n return this.tools.get(toolName);\n }\n\n values(): AnyTool[] {\n return [...this.tools.values()];\n }\n\n async getToolDefinitions(prompt = \"\"): Promise<ToolDefinition[]> {\n const defs: ToolDefinition[] = [];\n for (const tool of this.tools.values()) {\n defs.push(await tool.definition(prompt));\n }\n return defs;\n }\n\n async call(\n toolName: string,\n args: string,\n context?: ToolCallContext,\n ): Promise<NormalizedToolOutput> {\n const tool = this.tools.get(toolName);\n if (tool === undefined) {\n throw new ToolNotFoundError(toolName);\n }\n\n let parsedArgs: unknown;\n try {\n parsedArgs = parseToolArgs(args);\n } catch (error) {\n throw new ToolJsonError(`Invalid JSON arguments for tool ${toolName}`, error);\n }\n\n try {\n const output = await tool.call(parsedArgs, context);\n return normalizeToolResultOutput(output);\n } catch (error) {\n if (error instanceof Error) {\n throw new ToolCallError(error.message, error);\n }\n throw new ToolCallError(`Tool ${toolName} failed`, error);\n }\n }\n}\n","import type { ToolDefinition } from \"../completion\";\nimport type { EmbeddedDocument, EmbeddingModel, VectorMetadata } from \"../embeddings\";\nimport { embedDocuments } from \"../embeddings\";\nimport { compact } from \"../internal/compact\";\nimport type {\n VectorInspectPage,\n VectorInspectRequest,\n VectorSearchResult,\n VectorSearchToolOptions,\n} from \"../vector-store\";\nimport {\n InMemoryVectorStore,\n type VectorSearchIndex,\n type VectorSearchRequest,\n} from \"../vector-store\";\nimport type { AnyTool, Tool } from \"./tool\";\nimport { ToolSet } from \"./tool-set\";\n\nexport type ToolSearchDocument<Metadata extends VectorMetadata = VectorMetadata> = {\n toolName: string;\n definition: ToolDefinition;\n text: string;\n metadata?: Metadata | undefined;\n};\n\nexport type EmbedToolsOptions<Metadata extends VectorMetadata = VectorMetadata> = {\n content?: ((tool: AnyTool, definition: ToolDefinition) => string | string[]) | undefined;\n metadata?: ((tool: AnyTool, definition: ToolDefinition) => Metadata | undefined) | undefined;\n concurrency?: number | undefined;\n};\n\nexport interface DynamicToolIndex<Metadata extends VectorMetadata = VectorMetadata>\n extends VectorSearchIndex<ToolSearchDocument<Metadata>, Metadata> {\n readonly toolSet: ToolSet;\n}\n\nexport async function embedTools<Metadata extends VectorMetadata = VectorMetadata>(\n model: EmbeddingModel,\n tools: AnyTool[] | ToolSet,\n options: EmbedToolsOptions<Metadata> = {},\n): Promise<Array<EmbeddedDocument<ToolSearchDocument<Metadata>, Metadata>>> {\n const toolList = Array.isArray(tools) ? tools : tools.values();\n const definitions = await Promise.all(\n toolList.map(async (tool) => ({ tool, definition: await tool.definition(\"\") })),\n );\n const documents = definitions.map(({ tool, definition }) => {\n const content = options.content?.(tool, definition) ?? defaultToolEmbeddingText(definition);\n const texts = Array.isArray(content) ? content : [content];\n const metadata = options.metadata?.(tool, definition);\n const document: ToolSearchDocument<Metadata> = compact({\n toolName: tool.name,\n definition,\n text: texts.join(\"\\n\"),\n metadata,\n }) as ToolSearchDocument<Metadata>;\n return { tool, document, texts, metadata };\n });\n\n return embedDocuments(model, documents, {\n id: (item) => item.tool.name,\n content: (item) => item.texts,\n metadata: (item) => item.metadata,\n concurrency: options.concurrency,\n }).then((embedded) =>\n embedded.map((item) => ({\n ...item,\n document: item.document.document,\n })),\n );\n}\n\nexport async function createToolIndex<Metadata extends VectorMetadata = VectorMetadata>(\n model: EmbeddingModel,\n tools: AnyTool[] | ToolSet,\n options: EmbedToolsOptions<Metadata> = {},\n): Promise<DynamicToolIndex<Metadata>> {\n const toolSet = Array.isArray(tools) ? ToolSet.fromTools(tools) : tools;\n const embedded = await embedTools(model, toolSet, options);\n const index = InMemoryVectorStore.fromDocuments(embedded).index(model);\n return new DynamicToolSearchIndex(index, toolSet);\n}\n\nexport function isDynamicToolIndex(value: unknown): value is DynamicToolIndex {\n return (\n typeof value === \"object\" &&\n value !== null &&\n \"toolSet\" in value &&\n (value as { toolSet?: unknown }).toolSet instanceof ToolSet\n );\n}\n\nclass DynamicToolSearchIndex<Metadata extends VectorMetadata>\n implements DynamicToolIndex<Metadata>\n{\n readonly inspect?: (\n request: VectorInspectRequest,\n ) => Promise<VectorInspectPage<ToolSearchDocument<Metadata>, Metadata>>;\n\n constructor(\n private readonly index: VectorSearchIndex<ToolSearchDocument<Metadata>, Metadata>,\n readonly toolSet: ToolSet,\n ) {\n if (index.inspect !== undefined) {\n this.inspect = (request) =>\n index.inspect?.(request) as Promise<\n VectorInspectPage<ToolSearchDocument<Metadata>, Metadata>\n >;\n }\n }\n\n search(\n request: VectorSearchRequest,\n ): Promise<Array<VectorSearchResult<ToolSearchDocument<Metadata>, Metadata>>> {\n return this.index.search(request);\n }\n\n searchIds(request: VectorSearchRequest): Promise<Array<{ score: number; id: string }>> {\n return this.index.searchIds(request);\n }\n\n asTool(options: VectorSearchToolOptions): Tool<{ query: string; topK?: number }, unknown> {\n return this.index.asTool(options);\n }\n}\n\nfunction defaultToolEmbeddingText(definition: ToolDefinition): string[] {\n return [definition.name, definition.description, JSON.stringify(definition.parameters)];\n}\n","import type {\n CompletionRequest,\n CompletionResponse,\n JsonValue,\n ToolResultContent,\n} from \"../completion\";\n\ntype MaybePromise<T> = T | Promise<T>;\n\nexport type CompletionRequestMiddlewareArgs = {\n turn: number;\n request: CompletionRequest;\n originalRequest: CompletionRequest;\n};\n\nexport type CompletionRequestMiddlewareResult =\n | {\n request: CompletionRequest;\n }\n | undefined;\n\nexport type CompletionResponseMiddlewareArgs<RawResponse = unknown> = {\n turn: number;\n request: CompletionRequest;\n response: CompletionResponse<RawResponse>;\n originalResponse: CompletionResponse<RawResponse>;\n};\n\nexport type CompletionResponseMiddlewareResult<RawResponse = unknown> =\n | {\n response: CompletionResponse<RawResponse>;\n }\n | undefined;\n\nexport type ToolInputMiddlewareArgs = {\n toolName: string;\n args: string;\n originalArgs: string;\n turn: number;\n toolCallId?: string | undefined;\n internalCallId: string;\n};\n\nexport type ToolInputMiddlewareResult =\n | {\n args: JsonValue | string;\n }\n | undefined;\n\nexport type ToolResultMiddlewareArgs = {\n toolName: string;\n args: string;\n result: string;\n originalResult: string;\n structuredResult?: ToolResultContent[] | undefined;\n originalStructuredResult?: ToolResultContent[] | undefined;\n turn: number;\n toolCallId?: string | undefined;\n internalCallId: string;\n};\n\nexport type ToolOutputMiddlewareArgs = ToolResultMiddlewareArgs;\n\nexport type ToolOutputMiddlewareResult =\n | string\n | {\n result?: string | undefined;\n structuredResult?: ToolResultContent[] | undefined;\n }\n | undefined;\n\nexport interface AgentMiddleware<RawResponse = unknown> {\n onCompletionRequest?(\n args: CompletionRequestMiddlewareArgs,\n ): MaybePromise<CompletionRequestMiddlewareResult>;\n onCompletionResponse?(\n args: CompletionResponseMiddlewareArgs<RawResponse>,\n ): MaybePromise<CompletionResponseMiddlewareResult<RawResponse>>;\n onToolInput?(args: ToolInputMiddlewareArgs): MaybePromise<ToolInputMiddlewareResult>;\n onToolOutput?(args: ToolOutputMiddlewareArgs): MaybePromise<ToolOutputMiddlewareResult>;\n /**\n * @deprecated Use `onToolOutput` instead.\n */\n onResult?(args: ToolResultMiddlewareArgs): string | undefined | Promise<string | undefined>;\n}\n\n/**\n * @deprecated Use `AgentMiddleware` instead.\n */\nexport type ToolMiddleware<RawResponse = unknown> = AgentMiddleware<RawResponse>;\n\nexport function createMiddleware<RawResponse = unknown>(\n middleware: AgentMiddleware<RawResponse>,\n): AgentMiddleware<RawResponse> {\n return middleware;\n}\n\n/**\n * @deprecated Use `createMiddleware` instead.\n */\nexport function createToolMiddleware<RawResponse = unknown>(\n middleware: ToolMiddleware<RawResponse>,\n): ToolMiddleware<RawResponse> {\n return middleware;\n}\n","import { z } from \"zod\";\nimport { createTool } from \"./create-tool\";\n\nconst defaultThinkToolDescription =\n \"Use this tool to record a thought while reasoning through a complex task. It does not retrieve information, store memory, or change external state.\";\n\nconst thinkToolInput = z.object({\n thought: z.string().describe(\"A thought to record while reasoning through a task.\"),\n});\n\nexport type CreateThinkToolOptions = {\n name?: string;\n description?: string;\n};\n\nexport function createThinkTool(options: CreateThinkToolOptions = {}) {\n return createTool({\n name: options.name ?? \"think\",\n description: options.description ?? defaultThinkToolDescription,\n input: thinkToolInput,\n output: z.string(),\n execute: (args) => args.thought,\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAO,IAAM,gBAAN,cAA4B,MAAM;AAAA,EACvC,YACE,SACS,OACT;AACA,UAAM,OAAO;AAFJ;AAGT,SAAK,OAAO;AAAA,EACd;AAAA,EAJW;AAKb;AAEO,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YAAY,QAAW;AAC/B,WAAK,UAAU,CAAC,YACd,MAAM,UAAU,OAAO;AAAA,IAG3B;AAAA,EACF;AAAA,EATmB;AAAA,EACR;AAAA,EANF;AAAA,EAgBT,OACE,SAC4E;AAC5E,WAAO,KAAK,MAAM,OAAO,OAAO;AAAA,EAClC;AAAA,EAEA,UAAU,SAA6E;AACrF,WAAO,KAAK,MAAM,UAAU,OAAO;AAAA,EACrC;AAAA,EAEA,OAAO,SAAmF;AACxF,WAAO,KAAK,MAAM,OAAO,OAAO;AAAA,EAClC;AACF;AAEA,SAAS,yBAAyB,YAAsC;AACtE,SAAO,CAAC,WAAW,MAAM,WAAW,aAAa,KAAK,UAAU,WAAW,UAAU,CAAC;AACxF;;;ACpCO,SAAS,iBACd,YAC8B;AAC9B,SAAO;AACT;AAKO,SAAS,qBACd,YAC6B;AAC7B,SAAO;AACT;;;ACxGA,SAAS,SAAS;AAGlB,IAAM,8BACJ;AAEF,IAAM,iBAAiB,EAAE,OAAO;AAAA,EAC9B,SAAS,EAAE,OAAO,EAAE,SAAS,qDAAqD;AACpF,CAAC;AAOM,SAAS,gBAAgB,UAAkC,CAAC,GAAG;AACpE,SAAO,WAAW;AAAA,IAChB,MAAM,QAAQ,QAAQ;AAAA,IACtB,aAAa,QAAQ,eAAe;AAAA,IACpC,OAAO;AAAA,IACP,QAAQ,EAAE,OAAO;AAAA,IACjB,SAAS,CAAC,SAAS,KAAK;AAAA,EAC1B,CAAC;AACH;","names":[]}
|
package/dist/evals/index.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { A as Agent } from '../agent-
|
|
1
|
+
import { A as Agent } from '../agent-BBj3jvBi.js';
|
|
2
2
|
import { e as JsonValue, M as Message, C as CompletionModel } from '../types-q9G7Bvwl.js';
|
|
3
|
-
import { P as PromptResponse } from '../index-
|
|
3
|
+
import { P as PromptResponse } from '../index-Oucb3Ljj.js';
|
|
4
4
|
import { Z as ZodSchema } from '../zod-schema-C7F4clpm.js';
|
|
5
5
|
import { E as EmbeddingModel } from '../types-DHHZztGO.js';
|
|
6
6
|
import '../guardrails/index.js';
|
|
7
7
|
import '../types-CGML74sE.js';
|
|
8
8
|
import '../types-CqG6d7Ce.js';
|
|
9
|
-
import '../tool-
|
|
10
|
-
import '../middleware-
|
|
11
|
-
import '../types-
|
|
9
|
+
import '../tool-B8K543oQ.js';
|
|
10
|
+
import '../middleware-ByyL6Rj0.js';
|
|
11
|
+
import '../types-Pl4PFQWL.js';
|
|
12
12
|
import 'zod';
|
|
13
13
|
|
|
14
14
|
type EvalOutcome<Score = unknown> = {
|
package/dist/evals/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ExtractorBuilder
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
5
|
-
import "../chunk-
|
|
6
|
-
import "../chunk-
|
|
3
|
+
} from "../chunk-QNVLGAPV.js";
|
|
4
|
+
import "../chunk-XUO3KR5T.js";
|
|
5
|
+
import "../chunk-TUDZBJGF.js";
|
|
6
|
+
import "../chunk-4NCRFQHS.js";
|
|
7
7
|
import "../chunk-YK4WAAS4.js";
|
|
8
8
|
import "../chunk-XUUY2L2D.js";
|
|
9
|
-
import "../chunk-
|
|
10
|
-
import "../chunk-
|
|
9
|
+
import "../chunk-YVQBC3SJ.js";
|
|
10
|
+
import "../chunk-QKA6OQTH.js";
|
|
11
11
|
import "../chunk-NPZDYOE6.js";
|
|
12
12
|
import {
|
|
13
13
|
compact
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
import {
|
|
24
24
|
mapWithConcurrency
|
|
25
25
|
} from "../chunk-OIMLU4SF.js";
|
|
26
|
-
import "../chunk-
|
|
26
|
+
import "../chunk-CWUJUSOS.js";
|
|
27
27
|
|
|
28
28
|
// src/evals/agent-target.ts
|
|
29
29
|
function agentEvalTarget(agent, options = {}) {
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { A as Agent } from '../agent-
|
|
1
|
+
import { A as Agent } from '../agent-BBj3jvBi.js';
|
|
2
2
|
import { Z as ZodSchema } from '../zod-schema-C7F4clpm.js';
|
|
3
3
|
import { U as Usage, M as Message, C as CompletionModel, e as JsonValue, n as ToolChoice } from '../types-q9G7Bvwl.js';
|
|
4
4
|
import '../guardrails/index.js';
|
|
5
5
|
import '../types-CGML74sE.js';
|
|
6
6
|
import '../types-CqG6d7Ce.js';
|
|
7
|
-
import '../index-
|
|
8
|
-
import '../tool-
|
|
9
|
-
import '../middleware-
|
|
7
|
+
import '../index-Oucb3Ljj.js';
|
|
8
|
+
import '../tool-B8K543oQ.js';
|
|
9
|
+
import '../middleware-ByyL6Rj0.js';
|
|
10
10
|
import '../types-DHHZztGO.js';
|
|
11
|
-
import '../types-
|
|
11
|
+
import '../types-Pl4PFQWL.js';
|
|
12
12
|
import 'zod';
|
|
13
13
|
|
|
14
14
|
type ExtractionResponse<T> = {
|
package/dist/extractor/index.js
CHANGED
|
@@ -2,14 +2,14 @@ import {
|
|
|
2
2
|
ExtractionError,
|
|
3
3
|
Extractor,
|
|
4
4
|
ExtractorBuilder
|
|
5
|
-
} from "../chunk-
|
|
6
|
-
import "../chunk-
|
|
7
|
-
import "../chunk-
|
|
8
|
-
import "../chunk-
|
|
5
|
+
} from "../chunk-QNVLGAPV.js";
|
|
6
|
+
import "../chunk-XUO3KR5T.js";
|
|
7
|
+
import "../chunk-TUDZBJGF.js";
|
|
8
|
+
import "../chunk-4NCRFQHS.js";
|
|
9
9
|
import "../chunk-YK4WAAS4.js";
|
|
10
10
|
import "../chunk-XUUY2L2D.js";
|
|
11
|
-
import "../chunk-
|
|
12
|
-
import "../chunk-
|
|
11
|
+
import "../chunk-YVQBC3SJ.js";
|
|
12
|
+
import "../chunk-QKA6OQTH.js";
|
|
13
13
|
import "../chunk-NPZDYOE6.js";
|
|
14
14
|
import "../chunk-MMHG7WAM.js";
|
|
15
15
|
import "../chunk-M6RPFHG7.js";
|
|
@@ -18,7 +18,7 @@ import "../chunk-5LFGEMIW.js";
|
|
|
18
18
|
import "../chunk-WQKHFADH.js";
|
|
19
19
|
import "../chunk-JS5MGVNM.js";
|
|
20
20
|
import "../chunk-OIMLU4SF.js";
|
|
21
|
-
import "../chunk-
|
|
21
|
+
import "../chunk-CWUJUSOS.js";
|
|
22
22
|
export {
|
|
23
23
|
ExtractionError,
|
|
24
24
|
Extractor,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { M as Message, J as JsonObject, U as Usage } from '../types-q9G7Bvwl.js';
|
|
2
2
|
|
|
3
3
|
type MaybePromise<T> = T | Promise<T>;
|
|
4
4
|
type GuardrailMode = "enforce" | "observe";
|
|
5
|
-
type GuardrailBoundary = "input" | "
|
|
5
|
+
type GuardrailBoundary = "input" | "output";
|
|
6
6
|
type GuardrailRunContext = {
|
|
7
7
|
agentId: string;
|
|
8
8
|
runId: string;
|
|
@@ -21,7 +21,7 @@ type GuardrailDecisionRecord = {
|
|
|
21
21
|
metadata?: JsonObject | undefined;
|
|
22
22
|
latencyMs: number;
|
|
23
23
|
};
|
|
24
|
-
type GuardrailActionName = "allow" | "block" | "rewrite" | "
|
|
24
|
+
type GuardrailActionName = "allow" | "block" | "rewrite" | "error";
|
|
25
25
|
type GuardrailActionBase = {
|
|
26
26
|
reason?: string | undefined;
|
|
27
27
|
metadata?: JsonObject | undefined;
|
|
@@ -39,27 +39,11 @@ type InputGuardrailRewrite = GuardrailActionBase & {
|
|
|
39
39
|
prompt?: Message | undefined;
|
|
40
40
|
inputText?: string | undefined;
|
|
41
41
|
};
|
|
42
|
-
type ToolGuardrailRewrite = GuardrailActionBase & {
|
|
43
|
-
action: "rewrite";
|
|
44
|
-
args: JsonValue | string;
|
|
45
|
-
};
|
|
46
|
-
type ToolResultGuardrailRewrite = GuardrailActionBase & {
|
|
47
|
-
action: "rewrite";
|
|
48
|
-
result?: string | undefined;
|
|
49
|
-
structuredResult?: ToolResultContent[] | undefined;
|
|
50
|
-
};
|
|
51
42
|
type OutputGuardrailRewrite = GuardrailActionBase & {
|
|
52
43
|
action: "rewrite";
|
|
53
44
|
outputText: string;
|
|
54
45
|
};
|
|
55
|
-
type ToolGuardrailApprovalRequest = GuardrailActionBase & {
|
|
56
|
-
action: "request_approval";
|
|
57
|
-
reason?: string | undefined;
|
|
58
|
-
rejectMessage?: string | undefined;
|
|
59
|
-
};
|
|
60
46
|
type InputGuardrailResult = GuardrailAllow | GuardrailBlock | InputGuardrailRewrite;
|
|
61
|
-
type ToolGuardrailResult = GuardrailAllow | GuardrailBlock | ToolGuardrailRewrite | ToolGuardrailApprovalRequest;
|
|
62
|
-
type ToolResultGuardrailResult = GuardrailAllow | GuardrailBlock | ToolResultGuardrailRewrite;
|
|
63
47
|
type OutputGuardrailResult = GuardrailAllow | GuardrailBlock | OutputGuardrailRewrite;
|
|
64
48
|
type GuardrailCommonActions = {
|
|
65
49
|
allow(options?: GuardrailActionBase): GuardrailAllow;
|
|
@@ -68,13 +52,6 @@ type GuardrailCommonActions = {
|
|
|
68
52
|
type InputGuardrailActions = GuardrailCommonActions & {
|
|
69
53
|
rewrite(options: Omit<InputGuardrailRewrite, "action">): InputGuardrailRewrite;
|
|
70
54
|
};
|
|
71
|
-
type ToolGuardrailActions = GuardrailCommonActions & {
|
|
72
|
-
rewrite(options: Omit<ToolGuardrailRewrite, "action">): ToolGuardrailRewrite;
|
|
73
|
-
requestApproval(options?: Omit<ToolGuardrailApprovalRequest, "action">): ToolGuardrailApprovalRequest;
|
|
74
|
-
};
|
|
75
|
-
type ToolResultGuardrailActions = GuardrailCommonActions & {
|
|
76
|
-
rewrite(options: Omit<ToolResultGuardrailRewrite, "action">): ToolResultGuardrailRewrite;
|
|
77
|
-
};
|
|
78
55
|
type OutputGuardrailActions = GuardrailCommonActions & {
|
|
79
56
|
rewrite(options: Omit<OutputGuardrailRewrite, "action">): OutputGuardrailRewrite;
|
|
80
57
|
};
|
|
@@ -84,26 +61,6 @@ type InputGuardrailContext = {
|
|
|
84
61
|
inputText: string;
|
|
85
62
|
run: GuardrailRunContext;
|
|
86
63
|
};
|
|
87
|
-
type ToolGuardrailContext<Args = unknown> = {
|
|
88
|
-
toolName: string;
|
|
89
|
-
args: Args;
|
|
90
|
-
rawArgs: string;
|
|
91
|
-
toolCallId?: string | undefined;
|
|
92
|
-
internalCallId: string;
|
|
93
|
-
turn: number;
|
|
94
|
-
run: GuardrailRunContext;
|
|
95
|
-
};
|
|
96
|
-
type ToolResultGuardrailContext<Args = unknown> = {
|
|
97
|
-
toolName: string;
|
|
98
|
-
args: Args;
|
|
99
|
-
rawArgs: string;
|
|
100
|
-
result: string;
|
|
101
|
-
structuredResult?: ToolResultContent[] | undefined;
|
|
102
|
-
toolCallId?: string | undefined;
|
|
103
|
-
internalCallId: string;
|
|
104
|
-
turn: number;
|
|
105
|
-
run: GuardrailRunContext;
|
|
106
|
-
};
|
|
107
64
|
type OutputGuardrailContext = {
|
|
108
65
|
outputText: string;
|
|
109
66
|
messages: Message[];
|
|
@@ -114,16 +71,6 @@ type InputGuardrail = {
|
|
|
114
71
|
id: string;
|
|
115
72
|
check(context: InputGuardrailContext, actions: InputGuardrailActions): MaybePromise<InputGuardrailResult | undefined>;
|
|
116
73
|
};
|
|
117
|
-
type ToolGuardrail<Args = unknown> = {
|
|
118
|
-
id: string;
|
|
119
|
-
tool?: string | string[] | undefined;
|
|
120
|
-
check(context: ToolGuardrailContext<Args>, actions: ToolGuardrailActions): MaybePromise<ToolGuardrailResult | undefined>;
|
|
121
|
-
};
|
|
122
|
-
type ToolResultGuardrail<Args = unknown> = {
|
|
123
|
-
id: string;
|
|
124
|
-
tool?: string | string[] | undefined;
|
|
125
|
-
check(context: ToolResultGuardrailContext<Args>, actions: ToolResultGuardrailActions): MaybePromise<ToolResultGuardrailResult | undefined>;
|
|
126
|
-
};
|
|
127
74
|
type OutputGuardrail = {
|
|
128
75
|
id: string;
|
|
129
76
|
check(context: OutputGuardrailContext, actions: OutputGuardrailActions): MaybePromise<OutputGuardrailResult | undefined>;
|
|
@@ -132,16 +79,12 @@ type GuardrailPolicy = {
|
|
|
132
79
|
id: string;
|
|
133
80
|
mode: GuardrailMode;
|
|
134
81
|
input: InputGuardrail[];
|
|
135
|
-
tools: ToolGuardrail[];
|
|
136
|
-
toolResults: ToolResultGuardrail[];
|
|
137
82
|
output: OutputGuardrail[];
|
|
138
83
|
};
|
|
139
84
|
type GuardrailPolicyOptions = {
|
|
140
85
|
id: string;
|
|
141
86
|
mode?: GuardrailMode | undefined;
|
|
142
87
|
input?: InputGuardrail[] | undefined;
|
|
143
|
-
tools?: ToolGuardrail[] | undefined;
|
|
144
|
-
toolResults?: ToolResultGuardrail[] | undefined;
|
|
145
88
|
output?: OutputGuardrail[] | undefined;
|
|
146
89
|
};
|
|
147
90
|
type GuardrailPolicyInput = GuardrailPolicy | GuardrailPolicy[];
|
|
@@ -152,23 +95,6 @@ type InputGuardrailRunResult = {
|
|
|
152
95
|
message?: string | undefined;
|
|
153
96
|
decisions: GuardrailDecisionRecord[];
|
|
154
97
|
};
|
|
155
|
-
type ToolGuardrailRunResult = {
|
|
156
|
-
rawArgs: string;
|
|
157
|
-
blocked: boolean;
|
|
158
|
-
message?: string | undefined;
|
|
159
|
-
approval?: {
|
|
160
|
-
reason?: string | undefined;
|
|
161
|
-
rejectMessage?: string | undefined;
|
|
162
|
-
} | undefined;
|
|
163
|
-
decisions: GuardrailDecisionRecord[];
|
|
164
|
-
};
|
|
165
|
-
type ToolResultGuardrailRunResult = {
|
|
166
|
-
result: string;
|
|
167
|
-
structuredResult?: ToolResultContent[] | undefined;
|
|
168
|
-
blocked: boolean;
|
|
169
|
-
message?: string | undefined;
|
|
170
|
-
decisions: GuardrailDecisionRecord[];
|
|
171
|
-
};
|
|
172
98
|
type OutputGuardrailRunResult = {
|
|
173
99
|
outputText: string;
|
|
174
100
|
blocked: boolean;
|
|
@@ -177,8 +103,6 @@ type OutputGuardrailRunResult = {
|
|
|
177
103
|
};
|
|
178
104
|
declare function defineGuardrailPolicy(options: GuardrailPolicyOptions): GuardrailPolicy;
|
|
179
105
|
declare function defineInputGuardrail(guardrail: InputGuardrail): InputGuardrail;
|
|
180
|
-
declare function defineToolGuardrail<Args = unknown>(guardrail: ToolGuardrail<Args>): ToolGuardrail<Args>;
|
|
181
|
-
declare function defineToolResultGuardrail<Args = unknown>(guardrail: ToolResultGuardrail<Args>): ToolResultGuardrail<Args>;
|
|
182
106
|
declare function defineOutputGuardrail(guardrail: OutputGuardrail): OutputGuardrail;
|
|
183
107
|
declare function allow(options?: GuardrailActionBase): GuardrailAllow;
|
|
184
108
|
declare function block(options: Omit<GuardrailBlock, "action">): GuardrailBlock;
|
|
@@ -190,11 +114,9 @@ declare function normalizeGuardrailPolicies(policies: GuardrailPolicyInput | und
|
|
|
190
114
|
declare function appendGuardrailPolicies(current: GuardrailPolicy[], next: GuardrailPolicyInput): GuardrailPolicy[];
|
|
191
115
|
declare function hasEnforcedOutputGuardrails(policies: GuardrailPolicy[]): boolean;
|
|
192
116
|
declare function runInputGuardrails(policies: GuardrailPolicy[], context: InputGuardrailContext): Promise<InputGuardrailRunResult>;
|
|
193
|
-
declare function runToolGuardrails<Args>(policies: GuardrailPolicy[], toolGuardrails: ToolGuardrail<Args>[], context: ToolGuardrailContext<Args>): Promise<ToolGuardrailRunResult>;
|
|
194
|
-
declare function runToolResultGuardrails<Args>(policies: GuardrailPolicy[], toolGuardrails: ToolResultGuardrail<Args>[], context: ToolResultGuardrailContext<Args>): Promise<ToolResultGuardrailRunResult>;
|
|
195
117
|
declare function runOutputGuardrails(policies: GuardrailPolicy[], context: OutputGuardrailContext): Promise<OutputGuardrailRunResult>;
|
|
196
|
-
type TextPatternBoundary = "input" | "output"
|
|
197
|
-
type TextPatternGuardrailFor<Boundary extends TextPatternBoundary> = Boundary extends "input" ? InputGuardrail :
|
|
118
|
+
type TextPatternBoundary = "input" | "output";
|
|
119
|
+
type TextPatternGuardrailFor<Boundary extends TextPatternBoundary> = Boundary extends "input" ? InputGuardrail : OutputGuardrail;
|
|
198
120
|
type TextPatternGuardrailOptions<Boundary extends TextPatternBoundary = TextPatternBoundary> = {
|
|
199
121
|
id: string;
|
|
200
122
|
boundary: Boundary;
|
|
@@ -208,4 +130,4 @@ type TextPatternRedactOptions<Boundary extends TextPatternBoundary = TextPattern
|
|
|
208
130
|
declare function blockText<Boundary extends TextPatternBoundary>(options: TextPatternGuardrailOptions<Boundary>): TextPatternGuardrailFor<Boundary>;
|
|
209
131
|
declare function redactText<Boundary extends TextPatternBoundary>(options: TextPatternRedactOptions<Boundary>): TextPatternGuardrailFor<Boundary>;
|
|
210
132
|
|
|
211
|
-
export { type GuardrailActionBase, type GuardrailActionName, type GuardrailAllow, type GuardrailBlock, type GuardrailBoundary, type GuardrailCommonActions, type GuardrailDecisionRecord, type GuardrailMode, type GuardrailPolicy, type GuardrailPolicyInput, type GuardrailPolicyOptions, type GuardrailRunContext, type InputGuardrail, type InputGuardrailActions, type InputGuardrailContext, type InputGuardrailResult, type InputGuardrailRewrite, type InputGuardrailRunResult, type OutputGuardrail, type OutputGuardrailActions, type OutputGuardrailContext, type OutputGuardrailResult, type OutputGuardrailRewrite, type OutputGuardrailRunResult,
|
|
133
|
+
export { type GuardrailActionBase, type GuardrailActionName, type GuardrailAllow, type GuardrailBlock, type GuardrailBoundary, type GuardrailCommonActions, type GuardrailDecisionRecord, type GuardrailMode, type GuardrailPolicy, type GuardrailPolicyInput, type GuardrailPolicyOptions, type GuardrailRunContext, type InputGuardrail, type InputGuardrailActions, type InputGuardrailContext, type InputGuardrailResult, type InputGuardrailRewrite, type InputGuardrailRunResult, type OutputGuardrail, type OutputGuardrailActions, type OutputGuardrailContext, type OutputGuardrailResult, type OutputGuardrailRewrite, type OutputGuardrailRunResult, allow, appendGuardrailPolicies, block, defineGuardrailPolicy, defineInputGuardrail, defineOutputGuardrail, guardrails, hasEnforcedOutputGuardrails, normalizeGuardrailPolicies, runInputGuardrails, runOutputGuardrails };
|
package/dist/guardrails/index.js
CHANGED
|
@@ -5,16 +5,12 @@ import {
|
|
|
5
5
|
defineGuardrailPolicy,
|
|
6
6
|
defineInputGuardrail,
|
|
7
7
|
defineOutputGuardrail,
|
|
8
|
-
defineToolGuardrail,
|
|
9
|
-
defineToolResultGuardrail,
|
|
10
8
|
guardrails,
|
|
11
9
|
hasEnforcedOutputGuardrails,
|
|
12
10
|
normalizeGuardrailPolicies,
|
|
13
11
|
runInputGuardrails,
|
|
14
|
-
runOutputGuardrails
|
|
15
|
-
|
|
16
|
-
runToolResultGuardrails
|
|
17
|
-
} from "../chunk-YRERPIA5.js";
|
|
12
|
+
runOutputGuardrails
|
|
13
|
+
} from "../chunk-CWUJUSOS.js";
|
|
18
14
|
export {
|
|
19
15
|
allow,
|
|
20
16
|
appendGuardrailPolicies,
|
|
@@ -22,14 +18,10 @@ export {
|
|
|
22
18
|
defineGuardrailPolicy,
|
|
23
19
|
defineInputGuardrail,
|
|
24
20
|
defineOutputGuardrail,
|
|
25
|
-
defineToolGuardrail,
|
|
26
|
-
defineToolResultGuardrail,
|
|
27
21
|
guardrails,
|
|
28
22
|
hasEnforcedOutputGuardrails,
|
|
29
23
|
normalizeGuardrailPolicies,
|
|
30
24
|
runInputGuardrails,
|
|
31
|
-
runOutputGuardrails
|
|
32
|
-
runToolGuardrails,
|
|
33
|
-
runToolResultGuardrails
|
|
25
|
+
runOutputGuardrails
|
|
34
26
|
};
|
|
35
27
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { x as ReasoningContentType, f as ToolCall, U as Usage, M as Message, k as ToolResultContent, c as CompletionResponse, b as CompletionRequest, J as JsonObject, t as CompletionModelCapabilities, h as ToolDefinition, e as JsonValue } from './types-q9G7Bvwl.js';
|
|
2
2
|
import { GuardrailDecisionRecord } from './guardrails/index.js';
|
|
3
|
-
import { g as ToolCallStreamEvent } from './tool-
|
|
3
|
+
import { g as ToolCallStreamEvent } from './tool-B8K543oQ.js';
|
|
4
4
|
|
|
5
5
|
type PromptResponse = {
|
|
6
6
|
output: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
export { AgentBuilder } from './agent/index.js';
|
|
2
2
|
export { C as CreateCompletionBaseOptions, a as CreateCompletionInput, b as CreateCompletionOptions, c as CreateCompletionResult, d as CreateCompletionStreamOptions, e as CreateParsedCompletionOptions, f as CreateParsedCompletionResult, g as createCompletion, h as createCompletionStream, i as createParsedCompletion } from './create-completion-Y6YsYbQB.js';
|
|
3
3
|
export { A as AssistantContent, a as AssistantMessage, C as CompletionModel, b as CompletionRequest, c as CompletionResponse, D as Document, I as ImageContent, J as JsonObject, d as JsonPrimitive, e as JsonValue, M as Message, S as SystemMessage, T as Text, f as ToolCall, g as ToolContent, h as ToolDefinition, i as ToolMessage, j as ToolResult, k as ToolResultContent, U as Usage, l as UserContent, m as UserMessage } from './types-q9G7Bvwl.js';
|
|
4
|
+
export { GuardrailBoundary, GuardrailDecisionRecord, GuardrailMode, GuardrailPolicy, GuardrailPolicyInput, GuardrailPolicyOptions, InputGuardrail, InputGuardrailActions, InputGuardrailContext, OutputGuardrail, OutputGuardrailActions, OutputGuardrailContext, allow, block, defineGuardrailPolicy, defineInputGuardrail, defineOutputGuardrail, guardrails } from './guardrails/index.js';
|
|
4
5
|
export { cancelPrompt, createHook, requestToolApproval, runControl, skipTool, toolCallControl } from './hooks/index.js';
|
|
5
|
-
export { GuardrailBoundary, GuardrailDecisionRecord, GuardrailMode, GuardrailPolicy, GuardrailPolicyInput, GuardrailPolicyOptions, InputGuardrail, InputGuardrailActions, InputGuardrailContext, OutputGuardrail, OutputGuardrailActions, OutputGuardrailContext, ToolGuardrail, ToolGuardrailActions, ToolGuardrailContext, ToolResultGuardrail, ToolResultGuardrailActions, ToolResultGuardrailContext, allow, block, defineGuardrailPolicy, defineInputGuardrail, defineOutputGuardrail, defineToolGuardrail, defineToolResultGuardrail, guardrails } from './guardrails/index.js';
|
|
6
6
|
export { M as MemoryStore } from './types-CqG6d7Ce.js';
|
|
7
7
|
export { MaxTurnsError, PromptCancelledError, ToolApprovalRequiredError } from './request/index.js';
|
|
8
|
-
export { A as AgentChildStreamEvent, a as AgentStreamEvent, P as PromptResponse } from './index-
|
|
8
|
+
export { A as AgentChildStreamEvent, a as AgentStreamEvent, P as PromptResponse } from './index-Oucb3Ljj.js';
|
|
9
9
|
export { Z as ZodSchema } from './zod-schema-C7F4clpm.js';
|
|
10
10
|
export { loadSkills, skill } from './skills/index.js';
|
|
11
|
-
export { S as SkillValidationError } from './types-
|
|
12
|
-
export { C as CreateToolOptions, c as createThinkTool, a as createTool } from './think-tool-
|
|
13
|
-
export { A as AnyTool, T as Tool, a as ToolApprovalContext, b as ToolApprovalDecision, c as ToolApprovalPolicy, d as ToolApprovalRequest, e as ToolApprovalsOptions, f as ToolCallContext, g as ToolCallStreamEvent } from './tool-
|
|
14
|
-
export { A as AgentMiddleware, C as CompletionRequestMiddlewareArgs, a as CompletionRequestMiddlewareResult, b as CompletionResponseMiddlewareArgs, c as CompletionResponseMiddlewareResult, T as ToolInputMiddlewareArgs, d as ToolInputMiddlewareResult, e as ToolMiddleware, f as ToolOutputMiddlewareArgs, g as ToolOutputMiddlewareResult, h as ToolResultMiddlewareArgs, i as createMiddleware, j as createToolMiddleware } from './middleware-
|
|
15
|
-
export { UIError, UIMessage, UIMessagePart, UIMessageRole, UIStreamEvent, UIStreamRequest, coreMessagesToUIMessages, uiMessagesToCoreMessages } from './ui/index.js';
|
|
16
|
-
import './agent-
|
|
11
|
+
export { S as SkillValidationError } from './types-BzUuhjKr.js';
|
|
12
|
+
export { C as CreateToolOptions, c as createThinkTool, a as createTool } from './think-tool-B065hm73.js';
|
|
13
|
+
export { A as AnyTool, T as Tool, a as ToolApprovalContext, b as ToolApprovalDecision, c as ToolApprovalPolicy, d as ToolApprovalRequest, e as ToolApprovalsOptions, f as ToolCallContext, g as ToolCallStreamEvent } from './tool-B8K543oQ.js';
|
|
14
|
+
export { A as AgentMiddleware, C as CompletionRequestMiddlewareArgs, a as CompletionRequestMiddlewareResult, b as CompletionResponseMiddlewareArgs, c as CompletionResponseMiddlewareResult, T as ToolInputMiddlewareArgs, d as ToolInputMiddlewareResult, e as ToolMiddleware, f as ToolOutputMiddlewareArgs, g as ToolOutputMiddlewareResult, h as ToolResultMiddlewareArgs, i as createMiddleware, j as createToolMiddleware } from './middleware-ByyL6Rj0.js';
|
|
15
|
+
export { CreateUIAttachment, UIAttachment, UIError, UIMessage, UIMessagePart, UIMessageRole, UIStreamEvent, UIStreamRequest, coreMessagesToUIMessages, uiMessagesToCoreMessages } from './ui/index.js';
|
|
16
|
+
import './agent-BBj3jvBi.js';
|
|
17
17
|
import './types-CGML74sE.js';
|
|
18
|
-
import './types-
|
|
18
|
+
import './types-Pl4PFQWL.js';
|
|
19
19
|
import './types-DHHZztGO.js';
|
|
20
|
-
import './types-
|
|
20
|
+
import './types-7F_IKQQW.js';
|
|
21
21
|
import '@modelcontextprotocol/sdk/client/sse.js';
|
|
22
22
|
import '@modelcontextprotocol/sdk/client/stdio.js';
|
|
23
23
|
import '@modelcontextprotocol/sdk/client/streamableHttp.js';
|
package/dist/index.js
CHANGED
|
@@ -2,30 +2,30 @@ import {
|
|
|
2
2
|
SkillValidationError,
|
|
3
3
|
loadSkills,
|
|
4
4
|
skill
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-J3ROUB3P.js";
|
|
6
6
|
import {
|
|
7
7
|
coreMessagesToUIMessages,
|
|
8
8
|
uiMessagesToCoreMessages
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-LKLKEECY.js";
|
|
10
10
|
import {
|
|
11
11
|
AgentBuilder
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import "./chunk-
|
|
12
|
+
} from "./chunk-XUO3KR5T.js";
|
|
13
|
+
import "./chunk-TUDZBJGF.js";
|
|
14
14
|
import {
|
|
15
15
|
MaxTurnsError,
|
|
16
16
|
PromptCancelledError,
|
|
17
17
|
ToolApprovalRequiredError
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-4NCRFQHS.js";
|
|
19
19
|
import "./chunk-YK4WAAS4.js";
|
|
20
20
|
import "./chunk-XUUY2L2D.js";
|
|
21
21
|
import {
|
|
22
22
|
createMiddleware,
|
|
23
23
|
createThinkTool,
|
|
24
24
|
createToolMiddleware
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-YVQBC3SJ.js";
|
|
26
26
|
import {
|
|
27
27
|
createTool
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-QKA6OQTH.js";
|
|
29
29
|
import {
|
|
30
30
|
cancelPrompt,
|
|
31
31
|
createHook,
|
|
@@ -57,10 +57,8 @@ import {
|
|
|
57
57
|
defineGuardrailPolicy,
|
|
58
58
|
defineInputGuardrail,
|
|
59
59
|
defineOutputGuardrail,
|
|
60
|
-
defineToolGuardrail,
|
|
61
|
-
defineToolResultGuardrail,
|
|
62
60
|
guardrails
|
|
63
|
-
} from "./chunk-
|
|
61
|
+
} from "./chunk-CWUJUSOS.js";
|
|
64
62
|
export {
|
|
65
63
|
AgentBuilder,
|
|
66
64
|
AssistantContent,
|
|
@@ -87,8 +85,6 @@ export {
|
|
|
87
85
|
defineGuardrailPolicy,
|
|
88
86
|
defineInputGuardrail,
|
|
89
87
|
defineOutputGuardrail,
|
|
90
|
-
defineToolGuardrail,
|
|
91
|
-
defineToolResultGuardrail,
|
|
92
88
|
guardrails,
|
|
93
89
|
loadSkills,
|
|
94
90
|
requestToolApproval,
|
package/dist/internal/agent.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export { A as Agent, d as AgentEventAppendInput, e as AgentEventRecord, b as AgentEventStore, f as AgentEventStoreInclude, c as AgentEventStoreOptions, i as AgentEventStoreRegistration, j as AgentOptions, g as AgentSession, h as AgentToolOptions, k as DEFAULT_MAX_TURNS, D as DynamicContextOptions, l as DynamicContextRegistration, a as DynamicToolOptions, m as DynamicToolRegistration } from '../agent-
|
|
1
|
+
export { A as Agent, d as AgentEventAppendInput, e as AgentEventRecord, b as AgentEventStore, f as AgentEventStoreInclude, c as AgentEventStoreOptions, i as AgentEventStoreRegistration, j as AgentOptions, g as AgentSession, h as AgentToolOptions, k as DEFAULT_MAX_TURNS, D as DynamicContextOptions, l as DynamicContextRegistration, a as DynamicToolOptions, m as DynamicToolRegistration } from '../agent-BBj3jvBi.js';
|
|
2
2
|
import '../types-q9G7Bvwl.js';
|
|
3
3
|
import '../guardrails/index.js';
|
|
4
4
|
import '../types-CGML74sE.js';
|
|
5
5
|
import '../types-CqG6d7Ce.js';
|
|
6
|
-
import '../index-
|
|
7
|
-
import '../tool-
|
|
8
|
-
import '../middleware-
|
|
6
|
+
import '../index-Oucb3Ljj.js';
|
|
7
|
+
import '../tool-B8K543oQ.js';
|
|
8
|
+
import '../middleware-ByyL6Rj0.js';
|
|
9
9
|
import '../types-DHHZztGO.js';
|
|
10
|
-
import '../types-
|
|
10
|
+
import '../types-Pl4PFQWL.js';
|
package/dist/internal/agent.js
CHANGED
|
@@ -2,12 +2,12 @@ import {
|
|
|
2
2
|
Agent,
|
|
3
3
|
AgentSession,
|
|
4
4
|
DEFAULT_MAX_TURNS
|
|
5
|
-
} from "../chunk-
|
|
6
|
-
import "../chunk-
|
|
5
|
+
} from "../chunk-TUDZBJGF.js";
|
|
6
|
+
import "../chunk-4NCRFQHS.js";
|
|
7
7
|
import "../chunk-YK4WAAS4.js";
|
|
8
8
|
import "../chunk-XUUY2L2D.js";
|
|
9
|
-
import "../chunk-
|
|
10
|
-
import "../chunk-
|
|
9
|
+
import "../chunk-YVQBC3SJ.js";
|
|
10
|
+
import "../chunk-QKA6OQTH.js";
|
|
11
11
|
import "../chunk-NPZDYOE6.js";
|
|
12
12
|
import "../chunk-MMHG7WAM.js";
|
|
13
13
|
import "../chunk-SRBW3LD7.js";
|
|
@@ -15,7 +15,7 @@ import "../chunk-5LFGEMIW.js";
|
|
|
15
15
|
import "../chunk-WQKHFADH.js";
|
|
16
16
|
import "../chunk-JS5MGVNM.js";
|
|
17
17
|
import "../chunk-OIMLU4SF.js";
|
|
18
|
-
import "../chunk-
|
|
18
|
+
import "../chunk-CWUJUSOS.js";
|
|
19
19
|
export {
|
|
20
20
|
Agent,
|
|
21
21
|
AgentSession,
|
package/dist/mcp/index.d.ts
CHANGED
|
@@ -1,11 +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-7F_IKQQW.js';
|
|
2
|
+
export { e as McpClient, f as McpToolCallContent, g as McpToolCallResult, h as McpToolDefinition } from '../types-7F_IKQQW.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
6
|
import '../types-q9G7Bvwl.js';
|
|
7
|
-
import '../tool-
|
|
8
|
-
import '../guardrails/index.js';
|
|
7
|
+
import '../tool-B8K543oQ.js';
|
|
9
8
|
|
|
10
9
|
declare function connectMcp(connection: McpConnection): Promise<McpServer>;
|
|
11
10
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { h as ToolDefinition, b as CompletionRequest, c as CompletionResponse, e as JsonValue, k as ToolResultContent } from './types-q9G7Bvwl.js';
|
|
2
2
|
import { V as VectorMetadata, E as EmbeddingModel, c as EmbeddedDocument } from './types-DHHZztGO.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-B8K543oQ.js';
|
|
4
|
+
import { a as VectorSearchIndex } from './types-Pl4PFQWL.js';
|
|
5
5
|
|
|
6
6
|
declare class ToolSet {
|
|
7
7
|
private readonly tools;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { f as AgentGenerationEndArgs, g as AgentGenerationErrorArgs, h as AgentGenerationObserver, i as AgentGenerationStartArgs, j as AgentGenerationUpdateArgs, b as AgentObserver, d as AgentObserverRegistration, k as AgentRunEndArgs, l as AgentRunErrorArgs, m as AgentRunEventArgs, n as AgentRunObserver, o as AgentRunPromptRef, p as AgentRunStartArgs, q as AgentToolEndArgs, r as AgentToolErrorArgs, s as AgentToolObserver, t as AgentToolStartArgs, u as AgentToolStreamEventArgs, v as AgentTraceInfo, c as AgentTraceOptions, O as ObserveOptions, w as createObserver } from '../index-
|
|
1
|
+
export { f as AgentGenerationEndArgs, g as AgentGenerationErrorArgs, h as AgentGenerationObserver, i as AgentGenerationStartArgs, j as AgentGenerationUpdateArgs, b as AgentObserver, d as AgentObserverRegistration, k as AgentRunEndArgs, l as AgentRunErrorArgs, m as AgentRunEventArgs, n as AgentRunObserver, o as AgentRunPromptRef, p as AgentRunStartArgs, q as AgentToolEndArgs, r as AgentToolErrorArgs, s as AgentToolObserver, t as AgentToolStartArgs, u as AgentToolStreamEventArgs, v as AgentTraceInfo, c as AgentTraceOptions, O as ObserveOptions, w as createObserver } from '../index-Oucb3Ljj.js';
|
|
2
2
|
import '../types-q9G7Bvwl.js';
|
|
3
3
|
import '../guardrails/index.js';
|
|
4
|
-
import '../tool-
|
|
4
|
+
import '../tool-B8K543oQ.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-
|
|
2
|
+
import { A as Agent } from '../agent-BBj3jvBi.js';
|
|
3
3
|
import { J as JsonObject, C as CompletionModel } from '../types-q9G7Bvwl.js';
|
|
4
4
|
import { Extractor } from '../extractor/index.js';
|
|
5
5
|
import '../guardrails/index.js';
|
|
6
6
|
import '../types-CGML74sE.js';
|
|
7
7
|
import '../types-CqG6d7Ce.js';
|
|
8
|
-
import '../index-
|
|
9
|
-
import '../tool-
|
|
10
|
-
import '../middleware-
|
|
8
|
+
import '../index-Oucb3Ljj.js';
|
|
9
|
+
import '../tool-B8K543oQ.js';
|
|
10
|
+
import '../middleware-ByyL6Rj0.js';
|
|
11
11
|
import '../types-DHHZztGO.js';
|
|
12
|
-
import '../types-
|
|
12
|
+
import '../types-Pl4PFQWL.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
1
|
import { M as Message } from '../types-q9G7Bvwl.js';
|
|
2
|
-
import { d as ToolApprovalRequest } from '../tool-
|
|
3
|
-
export { P as PromptRequest } from '../agent-
|
|
4
|
-
export { A as AgentChildStreamEvent, e as AgentDeltaEvent, a as AgentStreamEvent, P as PromptResponse } from '../index-
|
|
2
|
+
import { d as ToolApprovalRequest } from '../tool-B8K543oQ.js';
|
|
3
|
+
export { P as PromptRequest } from '../agent-BBj3jvBi.js';
|
|
4
|
+
export { A as AgentChildStreamEvent, e as AgentDeltaEvent, a as AgentStreamEvent, P as PromptResponse } from '../index-Oucb3Ljj.js';
|
|
5
5
|
import '../guardrails/index.js';
|
|
6
6
|
import '../types-CGML74sE.js';
|
|
7
7
|
import '../types-CqG6d7Ce.js';
|
|
8
|
-
import '../middleware-
|
|
8
|
+
import '../middleware-ByyL6Rj0.js';
|
|
9
9
|
import '../types-DHHZztGO.js';
|
|
10
|
-
import '../types-
|
|
10
|
+
import '../types-Pl4PFQWL.js';
|
|
11
11
|
|
|
12
12
|
declare class MaxTurnsError extends Error {
|
|
13
13
|
readonly maxTurns: number;
|
package/dist/request/index.js
CHANGED
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
PromptCancelledError,
|
|
4
4
|
PromptRequest,
|
|
5
5
|
ToolApprovalRequiredError
|
|
6
|
-
} from "../chunk-
|
|
6
|
+
} from "../chunk-4NCRFQHS.js";
|
|
7
7
|
import "../chunk-XUUY2L2D.js";
|
|
8
|
-
import "../chunk-
|
|
9
|
-
import "../chunk-
|
|
8
|
+
import "../chunk-YVQBC3SJ.js";
|
|
9
|
+
import "../chunk-QKA6OQTH.js";
|
|
10
10
|
import "../chunk-NPZDYOE6.js";
|
|
11
11
|
import "../chunk-MMHG7WAM.js";
|
|
12
12
|
import "../chunk-SRBW3LD7.js";
|
|
@@ -14,7 +14,7 @@ import "../chunk-5LFGEMIW.js";
|
|
|
14
14
|
import "../chunk-WQKHFADH.js";
|
|
15
15
|
import "../chunk-JS5MGVNM.js";
|
|
16
16
|
import "../chunk-OIMLU4SF.js";
|
|
17
|
-
import "../chunk-
|
|
17
|
+
import "../chunk-CWUJUSOS.js";
|
|
18
18
|
export {
|
|
19
19
|
MaxTurnsError,
|
|
20
20
|
PromptCancelledError,
|
package/dist/skills/index.d.ts
CHANGED
|
@@ -1,8 +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-
|
|
1
|
+
import { b as SkillLoader, a as SkillSet } from '../types-BzUuhjKr.js';
|
|
2
|
+
export { c as Skill, S as SkillValidationError, d as SkillValidationIssue } from '../types-BzUuhjKr.js';
|
|
3
|
+
import '../tool-B8K543oQ.js';
|
|
4
4
|
import '../types-q9G7Bvwl.js';
|
|
5
|
-
import '../guardrails/index.js';
|
|
6
5
|
|
|
7
6
|
declare function loadSkills(loaders: SkillLoader | SkillLoader[]): Promise<SkillSet>;
|
|
8
7
|
|