@anvia/core 1.0.0-rc.1 → 1.0.0-rc.3

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.
Files changed (151) hide show
  1. package/README.md +344 -85
  2. package/dist/agent/index.d.ts +33 -18
  3. package/dist/agent/index.js +42 -17
  4. package/dist/agent-CXScUOpX.d.ts +150 -0
  5. package/dist/{chunk-R2LJSQUW.js → chunk-3CMWKK32.js} +260 -104
  6. package/dist/chunk-3CMWKK32.js.map +1 -0
  7. package/dist/chunk-3RM57ZT2.js +31 -0
  8. package/dist/chunk-3RM57ZT2.js.map +1 -0
  9. package/dist/chunk-5MK3BISB.js +704 -0
  10. package/dist/chunk-5MK3BISB.js.map +1 -0
  11. package/dist/chunk-AI5JMUW7.js +45 -0
  12. package/dist/chunk-AI5JMUW7.js.map +1 -0
  13. package/dist/{chunk-FNQB2JEH.js → chunk-AZB6N7P4.js} +94 -65
  14. package/dist/chunk-AZB6N7P4.js.map +1 -0
  15. package/dist/chunk-BEYBU7VJ.js +53 -0
  16. package/dist/chunk-BEYBU7VJ.js.map +1 -0
  17. package/dist/chunk-BY4OMNIU.js +4699 -0
  18. package/dist/chunk-BY4OMNIU.js.map +1 -0
  19. package/dist/chunk-D2ECOWN5.js +515 -0
  20. package/dist/chunk-D2ECOWN5.js.map +1 -0
  21. package/dist/{chunk-A3UBYTJT.js → chunk-FN7HLLAZ.js} +60 -6
  22. package/dist/chunk-FN7HLLAZ.js.map +1 -0
  23. package/dist/chunk-GKDERULJ.js +50 -0
  24. package/dist/chunk-GKDERULJ.js.map +1 -0
  25. package/dist/chunk-GQL5KRAH.js +331 -0
  26. package/dist/chunk-GQL5KRAH.js.map +1 -0
  27. package/dist/{chunk-5XKDW36Z.js → chunk-KFR4CDGK.js} +70 -75
  28. package/dist/chunk-KFR4CDGK.js.map +1 -0
  29. package/dist/chunk-KV6QCRQ4.js +171 -0
  30. package/dist/chunk-KV6QCRQ4.js.map +1 -0
  31. package/dist/{chunk-DMPUP4R3.js → chunk-LXMAFD23.js} +5 -5
  32. package/dist/{chunk-I6G7BC42.js → chunk-MGNTXGTX.js} +2 -6
  33. package/dist/chunk-MGNTXGTX.js.map +1 -0
  34. package/dist/chunk-PK5LKOFL.js +239 -0
  35. package/dist/chunk-PK5LKOFL.js.map +1 -0
  36. package/dist/chunk-QOUPWOGW.js +29 -0
  37. package/dist/chunk-QOUPWOGW.js.map +1 -0
  38. package/dist/chunk-TRQ3XRFD.js +54 -0
  39. package/dist/chunk-TRQ3XRFD.js.map +1 -0
  40. package/dist/chunk-VKYZZXP5.js +323 -0
  41. package/dist/chunk-VKYZZXP5.js.map +1 -0
  42. package/dist/chunk-ZCPOIDAQ.js +127 -0
  43. package/dist/chunk-ZCPOIDAQ.js.map +1 -0
  44. package/dist/client-DvUatElp.d.ts +84 -0
  45. package/dist/completion/index.d.ts +5 -4
  46. package/dist/completion/index.js +25 -28
  47. package/dist/documents/index.d.ts +34 -0
  48. package/dist/documents/index.js +315 -0
  49. package/dist/documents/index.js.map +1 -0
  50. package/dist/{dynamic-tools-i9woysFa.d.ts → dynamic-tools-AEBOTgu1.d.ts} +21 -9
  51. package/dist/embeddings/index.d.ts +11 -9
  52. package/dist/embeddings/index.js +3 -3
  53. package/dist/evals/index.d.ts +53 -25
  54. package/dist/evals/index.js +153 -103
  55. package/dist/evals/index.js.map +1 -1
  56. package/dist/extractor/index.d.ts +23 -26
  57. package/dist/extractor/index.js +7 -8
  58. package/dist/guardrails/index.d.ts +7 -129
  59. package/dist/guardrails/index.js +1 -1
  60. package/dist/image-generation/index.d.ts +18 -16
  61. package/dist/image-generation/index.js +2 -2
  62. package/dist/index.d.ts +26 -23
  63. package/dist/index.js +71 -48
  64. package/dist/interactions-csssHYcN.d.ts +174 -0
  65. package/dist/internal/agent.d.ts +36 -29
  66. package/dist/internal/agent.js +48 -15
  67. package/dist/internal/agent.js.map +1 -1
  68. package/dist/mcp/index.d.ts +19 -13
  69. package/dist/mcp/index.js +14 -348
  70. package/dist/mcp/index.js.map +1 -1
  71. package/dist/memory/index.d.ts +20 -6
  72. package/dist/memory/index.js +10 -10
  73. package/dist/message-schema-B2M7AYzR.d.ts +52 -0
  74. package/dist/model-call-options-CZkSw_xN.d.ts +6 -0
  75. package/dist/model-listing/index.d.ts +3 -1
  76. package/dist/observability/index.d.ts +21 -6
  77. package/dist/observability/index.js +8 -5
  78. package/dist/observability/index.js.map +1 -1
  79. package/dist/pipeline/index.d.ts +106 -57
  80. package/dist/pipeline/index.js +419 -236
  81. package/dist/pipeline/index.js.map +1 -1
  82. package/dist/{retry-D3Ruy-ba.d.ts → retry-CjvSlKGW.d.ts} +2 -1
  83. package/dist/skills/index.d.ts +5 -4
  84. package/dist/skills/index.js +8 -7
  85. package/dist/speech-generation/index.d.ts +37 -0
  86. package/dist/speech-generation/index.js +8 -0
  87. package/dist/text-C_6eKrbC.d.ts +32 -0
  88. package/dist/{think-tool-DZqZj2LV.d.ts → think-tool-D8frXxwV.d.ts} +16 -2
  89. package/dist/tool/index.d.ts +9 -7
  90. package/dist/tool/index.js +12 -10
  91. package/dist/{tool-C_8GudXn.d.ts → tool-r62gf3QY.d.ts} +17 -8
  92. package/dist/transcription/index.d.ts +23 -14
  93. package/dist/transcription/index.js +2 -2
  94. package/dist/types-C3gv9EX6.d.ts +130 -0
  95. package/dist/{index-DxB74ybJ.d.ts → types-CElwurHZ.d.ts} +139 -88
  96. package/dist/types-CIPaIbZo.d.ts +105 -0
  97. package/dist/types-Cr4uiYo5.d.ts +99 -0
  98. package/dist/types-D9rKQ_as.d.ts +341 -0
  99. package/dist/types-DbolvLtZ.d.ts +155 -0
  100. package/dist/{types-DhQfwiZn.d.ts → types-RT3cuyRk.d.ts} +1 -1
  101. package/dist/vector-store/index.d.ts +33 -34
  102. package/dist/vector-store/index.js +7 -6
  103. package/package.json +10 -14
  104. package/dist/agent-DGYY_onS.d.ts +0 -145
  105. package/dist/audio-generation/index.d.ts +0 -31
  106. package/dist/audio-generation/index.js +0 -8
  107. package/dist/chunk-5XKDW36Z.js.map +0 -1
  108. package/dist/chunk-6WGGTJE6.js +0 -139
  109. package/dist/chunk-6WGGTJE6.js.map +0 -1
  110. package/dist/chunk-A3UBYTJT.js.map +0 -1
  111. package/dist/chunk-ADH7NNCS.js +0 -512
  112. package/dist/chunk-ADH7NNCS.js.map +0 -1
  113. package/dist/chunk-DZ3CKYTH.js +0 -267
  114. package/dist/chunk-DZ3CKYTH.js.map +0 -1
  115. package/dist/chunk-FNQB2JEH.js.map +0 -1
  116. package/dist/chunk-I6G7BC42.js.map +0 -1
  117. package/dist/chunk-IL3ZSNJI.js +0 -3748
  118. package/dist/chunk-IL3ZSNJI.js.map +0 -1
  119. package/dist/chunk-J6GNQART.js +0 -122
  120. package/dist/chunk-J6GNQART.js.map +0 -1
  121. package/dist/chunk-M3IOWB4Y.js +0 -280
  122. package/dist/chunk-M3IOWB4Y.js.map +0 -1
  123. package/dist/chunk-QY5GZ7HR.js +0 -39
  124. package/dist/chunk-QY5GZ7HR.js.map +0 -1
  125. package/dist/chunk-R2LJSQUW.js.map +0 -1
  126. package/dist/chunk-RFDVKCIE.js +0 -12
  127. package/dist/chunk-RFDVKCIE.js.map +0 -1
  128. package/dist/chunk-RMUBRRSK.js +0 -34
  129. package/dist/chunk-RMUBRRSK.js.map +0 -1
  130. package/dist/chunk-RXKHOYEH.js +0 -466
  131. package/dist/chunk-RXKHOYEH.js.map +0 -1
  132. package/dist/chunk-XDRSPSR7.js +0 -38
  133. package/dist/chunk-XDRSPSR7.js.map +0 -1
  134. package/dist/chunk-XWUC7CIT.js +0 -1
  135. package/dist/chunk-XWUC7CIT.js.map +0 -1
  136. package/dist/errors-CYKUcU89.d.ts +0 -17
  137. package/dist/json-Zo7K3xmt.d.ts +0 -40
  138. package/dist/loaders/index.d.ts +0 -86
  139. package/dist/loaders/index.js +0 -299
  140. package/dist/loaders/index.js.map +0 -1
  141. package/dist/middleware-KynLg_RW.d.ts +0 -56
  142. package/dist/types-B3A4YxaA.d.ts +0 -354
  143. package/dist/types-BBEGKB9m.d.ts +0 -119
  144. package/dist/types-DT3nEemY.d.ts +0 -79
  145. package/dist/types-DulRCYdB.d.ts +0 -70
  146. package/dist/types-p55Jc-sr.d.ts +0 -47
  147. package/dist/ui/index.d.ts +0 -107
  148. package/dist/ui/index.js +0 -10
  149. package/dist/ui/index.js.map +0 -1
  150. /package/dist/{chunk-DMPUP4R3.js.map → chunk-LXMAFD23.js.map} +0 -0
  151. /package/dist/{audio-generation → speech-generation}/index.js.map +0 -0
@@ -1,26 +1,51 @@
1
1
  import {
2
2
  Agent,
3
- AgentRunCancelledError,
4
- MaxTurnsError,
5
- createContextIndex,
6
- isContextIndex
7
- } from "../chunk-IL3ZSNJI.js";
3
+ agentContinuationSchema,
4
+ agentInteractionRequestSchema,
5
+ agentInteractionResponseSchema,
6
+ assertAgentInteractionResponse,
7
+ createVectorContext,
8
+ isVectorContext,
9
+ parseAgentContinuation,
10
+ parseAgentInteractionRequest,
11
+ parseAgentInteractionResponse
12
+ } from "../chunk-BY4OMNIU.js";
8
13
  import "../chunk-YK4WAAS4.js";
9
- import "../chunk-6WGGTJE6.js";
10
- import "../chunk-R2LJSQUW.js";
11
- import "../chunk-5XKDW36Z.js";
12
- import "../chunk-DZ3CKYTH.js";
13
- import "../chunk-I6G7BC42.js";
14
- import "../chunk-M3IOWB4Y.js";
15
- import "../chunk-RFDVKCIE.js";
16
- import "../chunk-ADH7NNCS.js";
17
- import "../chunk-A3UBYTJT.js";
18
- import "../chunk-FNQB2JEH.js";
14
+ import "../chunk-5MK3BISB.js";
15
+ import "../chunk-CQNNSZPG.js";
16
+ import "../chunk-KV6QCRQ4.js";
17
+ import "../chunk-3CMWKK32.js";
18
+ import "../chunk-KFR4CDGK.js";
19
+ import "../chunk-VKYZZXP5.js";
20
+ import {
21
+ AgentRunBlockedError,
22
+ AgentRunCancelledError,
23
+ AgentStreamClosedError,
24
+ AgentToolSuspensionError,
25
+ MaxTurnsError
26
+ } from "../chunk-TRQ3XRFD.js";
27
+ import "../chunk-GQL5KRAH.js";
28
+ import "../chunk-3RM57ZT2.js";
29
+ import "../chunk-MGNTXGTX.js";
30
+ import "../chunk-D2ECOWN5.js";
31
+ import "../chunk-PK5LKOFL.js";
32
+ import "../chunk-FN7HLLAZ.js";
33
+ import "../chunk-AZB6N7P4.js";
19
34
  export {
20
35
  Agent,
36
+ AgentRunBlockedError,
21
37
  AgentRunCancelledError,
38
+ AgentStreamClosedError,
39
+ AgentToolSuspensionError,
22
40
  MaxTurnsError,
23
- createContextIndex,
24
- isContextIndex
41
+ agentContinuationSchema,
42
+ agentInteractionRequestSchema,
43
+ agentInteractionResponseSchema,
44
+ assertAgentInteractionResponse,
45
+ createVectorContext,
46
+ isVectorContext,
47
+ parseAgentContinuation,
48
+ parseAgentInteractionRequest,
49
+ parseAgentInteractionResponse
25
50
  };
26
51
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,150 @@
1
+ import { b as RetrySetting } from './retry-CjvSlKGW.js';
2
+ import { D as Document, C as CompletionModel, P as ProviderTool, J as JsonObject, u as ToolChoice } from './types-D9rKQ_as.js';
3
+ import { Z as ZodSchema } from './zod-schema-C7F4clpm.js';
4
+ import { d as GuardrailPolicyInput, c as GuardrailPolicy } from './types-CIPaIbZo.js';
5
+ import { a as McpServer } from './client-DvUatElp.js';
6
+ import { g as AgentLifecycle, E as AgentObservabilityOptions, l as AgentRunOptions, k as AgentResult, r as AgentStream, s as AgentStreamEvent } from './types-CElwurHZ.js';
7
+ import { c as AgentMiddleware } from './interactions-csssHYcN.js';
8
+ import { A as AnyTool, T as Tool, c as ToolCallContext, N as NormalizedToolOutput } from './tool-r62gf3QY.js';
9
+ import { D as MemoryStore, y as MemorySavePolicy, m as MemoryCompactor, d as MemoryCompactionConflictRetryOptions, x as MemoryOptions } from './types-DbolvLtZ.js';
10
+ import { a as SkillSet } from './types-RT3cuyRk.js';
11
+ import { T as ToolIndex } from './dynamic-tools-AEBOTgu1.js';
12
+ import { E as EmbeddingModel, c as SparseEmbeddingModel } from './types-Cr4uiYo5.js';
13
+ import { V as VectorFilter, a as VectorSearchResult, d as VectorStore, H as HybridVectorStore, e as VectorFusion } from './types-C3gv9EX6.js';
14
+
15
+ type VectorContextBaseOptions<T = unknown> = {
16
+ topK: number;
17
+ minScore?: number | undefined;
18
+ filter?: VectorFilter | undefined;
19
+ retries?: RetrySetting | undefined;
20
+ format?(result: VectorSearchResult<T>): Document;
21
+ };
22
+ type CreateVectorContextOptions<T = unknown> = VectorContextBaseOptions<T> & {
23
+ store: VectorStore<T>;
24
+ model: EmbeddingModel;
25
+ models?: never;
26
+ };
27
+ type CreateHybridVectorContextOptions<T = unknown> = VectorContextBaseOptions<T> & {
28
+ store: HybridVectorStore<T>;
29
+ model?: never;
30
+ models: {
31
+ dense: EmbeddingModel;
32
+ sparse: SparseEmbeddingModel;
33
+ };
34
+ fusion?: VectorFusion | undefined;
35
+ };
36
+ type VectorContext<T = unknown> = (CreateVectorContextOptions<T> | CreateHybridVectorContextOptions<T>) & {
37
+ readonly kind: "vector-context";
38
+ };
39
+ declare function createVectorContext<T>(options: CreateVectorContextOptions<T>): VectorContext<T>;
40
+ declare function createVectorContext<T>(options: CreateHybridVectorContextOptions<T>): VectorContext<T>;
41
+ declare function isVectorContext(value: unknown): value is VectorContext;
42
+
43
+ type AgentToolInput = AnyTool | ProviderTool | ToolIndex;
44
+ type AgentContextInput<T = unknown> = Document | VectorContext<T>;
45
+ type RawResponseOf$1<Model> = Model extends CompletionModel<infer RawResponse> ? RawResponse : unknown;
46
+ type AgentOptions<Output = string, M extends CompletionModel = CompletionModel, ContextDocument = unknown> = {
47
+ id: string;
48
+ name?: string | undefined;
49
+ description?: string | undefined;
50
+ model: M;
51
+ instructions?: string | undefined;
52
+ context?: readonly AgentContextInput<ContextDocument>[] | undefined;
53
+ tools?: readonly AgentToolInput[] | undefined;
54
+ mcpServers?: readonly McpServer[] | undefined;
55
+ skills?: SkillSet | undefined;
56
+ temperature?: number | undefined;
57
+ maxTokens?: number | undefined;
58
+ providerOptions?: JsonObject | undefined;
59
+ retries?: RetrySetting | undefined;
60
+ toolChoice?: ToolChoice | undefined;
61
+ maxTurns?: number | undefined;
62
+ lifecycle?: AgentLifecycle<Output, RawResponseOf$1<M>> | undefined;
63
+ outputSchema?: ZodSchema<Output> | undefined;
64
+ observability?: AgentObservabilityOptions | undefined;
65
+ guardrails?: GuardrailPolicyInput | undefined;
66
+ middlewares?: readonly AgentMiddleware[] | undefined;
67
+ memory?: AgentMemoryOptions | undefined;
68
+ };
69
+ type AgentMemoryOptions = MemoryOptions & {
70
+ store: MemoryStore;
71
+ };
72
+ type AgentMemory = {
73
+ store: MemoryStore;
74
+ savePolicy: MemorySavePolicy;
75
+ compaction?: {
76
+ trigger: {
77
+ afterMessages: number;
78
+ };
79
+ retention: {
80
+ recentUserTurns: number;
81
+ };
82
+ compactor: MemoryCompactor;
83
+ conflictRetries: false | MemoryCompactionConflictRetryOptions;
84
+ } | undefined;
85
+ };
86
+ type ResolvedAgentOptions<Output = string, M extends CompletionModel = CompletionModel, ContextDocument = unknown> = {
87
+ id: string;
88
+ name?: string | undefined;
89
+ description?: string | undefined;
90
+ model: M;
91
+ instructions?: string | undefined;
92
+ context?: readonly AgentContextInput<ContextDocument>[] | undefined;
93
+ temperature?: number | undefined;
94
+ maxTokens?: number | undefined;
95
+ providerOptions?: JsonObject | undefined;
96
+ retries?: RetrySetting | undefined;
97
+ tools?: readonly AnyTool[] | undefined;
98
+ mcpServers?: readonly McpServer[] | undefined;
99
+ providerTools?: readonly ProviderTool[] | undefined;
100
+ toolIndexes?: readonly ToolIndex[] | undefined;
101
+ toolChoice?: ToolChoice | undefined;
102
+ defaultMaxTurns?: number | undefined;
103
+ lifecycle?: AgentLifecycle<Output, RawResponseOf$1<M>> | undefined;
104
+ outputSchema?: ZodSchema<Output> | undefined;
105
+ observability?: AgentObservabilityOptions | undefined;
106
+ guardrails?: readonly GuardrailPolicy[] | undefined;
107
+ middlewares?: readonly AgentMiddleware[] | undefined;
108
+ memory?: AgentMemory | undefined;
109
+ };
110
+ type AgentToolOptions = {
111
+ name: string;
112
+ suspension: "reject";
113
+ description?: string | undefined;
114
+ maxTurns?: number | undefined;
115
+ stream?: boolean | undefined;
116
+ };
117
+
118
+ type RawResponseOf<Model> = Model extends CompletionModel<infer RawResponse> ? RawResponse : unknown;
119
+ declare class Agent<Output = string, M extends CompletionModel = CompletionModel, ContextDocument = unknown> {
120
+ readonly id: string;
121
+ readonly name: string | undefined;
122
+ readonly description: string | undefined;
123
+ readonly model: M;
124
+ readonly instructions: string | undefined;
125
+ readonly context: readonly AgentContextInput<ContextDocument>[];
126
+ readonly temperature: number | undefined;
127
+ readonly maxTokens: number | undefined;
128
+ readonly providerOptions: JsonObject | undefined;
129
+ readonly retries: RetrySetting | undefined;
130
+ readonly mcpServers: readonly McpServer[];
131
+ readonly tools: readonly AnyTool[];
132
+ readonly toolChoice: ToolChoice | undefined;
133
+ readonly defaultMaxTurns: number | undefined;
134
+ readonly lifecycle: AgentLifecycle<Output, RawResponseOf<M>> | undefined;
135
+ readonly outputSchema: ZodSchema<Output> | undefined;
136
+ readonly observability: AgentObservabilityOptions | undefined;
137
+ readonly guardrails: readonly GuardrailPolicy[];
138
+ readonly middlewares: readonly AgentMiddleware[];
139
+ readonly memory: AgentMemory | undefined;
140
+ constructor(options: AgentOptions<Output, M, ContextDocument>);
141
+ generate(options: AgentRunOptions<Output, RawResponseOf<M>>): Promise<AgentResult<Output>>;
142
+ stream(options: AgentRunOptions<Output, RawResponseOf<M>>): AgentStream<AgentStreamEvent<Output, RawResponseOf<M>>>;
143
+ asTool(options: AgentToolOptions): Tool<{
144
+ prompt: string;
145
+ }, Output>;
146
+ getTool(toolName: string): AnyTool | undefined;
147
+ callTool(toolName: string, args: string, context?: ToolCallContext): Promise<NormalizedToolOutput>;
148
+ }
149
+
150
+ export { Agent as A, type CreateHybridVectorContextOptions as C, type ResolvedAgentOptions as R, type VectorContext as V, type AgentContextInput as a, type AgentMemory as b, type AgentMemoryOptions as c, type AgentOptions as d, type AgentToolInput as e, type AgentToolOptions as f, type CreateVectorContextOptions as g, type VectorContextBaseOptions as h, createVectorContext as i, isVectorContext as j };