@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,36 +1,32 @@
1
- import { A as Agent } from '../agent-DGYY_onS.js';
2
- import { J as JsonObject, C as CompletionModel } from '../types-B3A4YxaA.js';
3
- import { Extractor } from '../extractor/index.js';
1
+ import { t as AgentSuspendedResult, f as AgentInput, m as AgentRunSettings } from '../types-CElwurHZ.js';
2
+ import { A as Agent } from '../agent-CXScUOpX.js';
3
+ import { J as JsonObject, C as CompletionModel } from '../types-D9rKQ_as.js';
4
+ import { ExtractOptions } from '../extractor/index.js';
4
5
  import { z } from 'zod';
5
- import '../guardrails/index.js';
6
+ import '../interactions-csssHYcN.js';
6
7
  import '../type-utils-CtHVDRn_.js';
7
- import '../types-BBEGKB9m.js';
8
- import '../index-DxB74ybJ.js';
9
- import '../retry-D3Ruy-ba.js';
10
- import '../middleware-KynLg_RW.js';
11
- import '../tool-C_8GudXn.js';
8
+ import '../retry-CjvSlKGW.js';
9
+ import '../types-CIPaIbZo.js';
10
+ import '../types-DbolvLtZ.js';
11
+ import '../tool-r62gf3QY.js';
12
12
  import '../zod-schema-C7F4clpm.js';
13
- import '../types-DulRCYdB.js';
14
- import '@modelcontextprotocol/sdk/client/sse.js';
15
- import '@modelcontextprotocol/sdk/client/stdio.js';
13
+ import '../client-DvUatElp.js';
14
+ import 'node:child_process';
15
+ import 'node:stream';
16
+ import '@modelcontextprotocol/sdk/client/auth.js';
16
17
  import '@modelcontextprotocol/sdk/client/streamableHttp.js';
17
- import '../types-DhQfwiZn.js';
18
- import '../dynamic-tools-i9woysFa.js';
19
- import '../types-p55Jc-sr.js';
20
- import '../types-DT3nEemY.js';
18
+ import '@modelcontextprotocol/sdk/shared/transport.js';
19
+ import '../types-RT3cuyRk.js';
20
+ import '../dynamic-tools-AEBOTgu1.js';
21
+ import '../types-Cr4uiYo5.js';
22
+ import '../model-call-options-CZkSw_xN.js';
23
+ import '../types-C3gv9EX6.js';
21
24
 
22
- /** Minimal interface for anything that can run as a pipeline stage. */
23
- interface PipelineOp<Input = unknown, Output = unknown> {
24
- run(input: Input): Output | Promise<Output>;
25
+ declare class PipelineAgentSuspensionError extends Error {
26
+ readonly result: AgentSuspendedResult;
27
+ constructor(result: AgentSuspendedResult);
25
28
  }
26
- interface PipelineBatchOptions {
27
- /** Maximum number of inputs processed at the same time. */
28
- concurrency: number;
29
- }
30
- type AwaitedOutput<Op> = Op extends PipelineOp<unknown, infer Output> ? Awaited<Output> : never;
31
- type ParallelOutput<Branches extends Record<string, PipelineOp<unknown, unknown>>> = {
32
- [Key in keyof Branches]: AwaitedOutput<Branches[Key]>;
33
- };
29
+
34
30
  type PipelineMetadata = {
35
31
  id?: string | undefined;
36
32
  name?: string | undefined;
@@ -45,14 +41,23 @@ type PipelineOptions<Input, Parsed = Input> = {
45
41
  metadata?: JsonObject | undefined;
46
42
  };
47
43
  type PipelineStageMetadata = {
48
- id?: string | undefined;
44
+ id: string;
49
45
  name?: string | undefined;
50
46
  description?: string | undefined;
51
47
  metadata?: JsonObject | undefined;
52
48
  };
49
+ type PipelineStageContext<Input> = {
50
+ input: Input;
51
+ runId: string;
52
+ pipelineId: string;
53
+ runMetadata?: JsonObject | undefined;
54
+ abortSignal?: AbortSignal | undefined;
55
+ };
53
56
  type PipelineStageKind = "input" | "step" | "pipeline" | "parallel" | "branch" | "agent" | "extractor" | "output";
57
+ type PipelineNodePath = readonly string[];
54
58
  type PipelineGraphNode = {
55
59
  id: string;
60
+ path: PipelineNodePath;
56
61
  kind: PipelineStageKind;
57
62
  label: string;
58
63
  description?: string | undefined;
@@ -64,8 +69,8 @@ type PipelineGraphNode = {
64
69
  };
65
70
  type PipelineGraphEdge = {
66
71
  id: string;
67
- source: string;
68
- target: string;
72
+ source: PipelineNodePath;
73
+ target: PipelineNodePath;
69
74
  label?: string | undefined;
70
75
  };
71
76
  type PipelineGraph = PipelineMetadata & {
@@ -73,28 +78,80 @@ type PipelineGraph = PipelineMetadata & {
73
78
  nodes: PipelineGraphNode[];
74
79
  edges: PipelineGraphEdge[];
75
80
  };
76
- type PipelineRunEvent = {
77
- type: "stage_started";
81
+ type PipelineRunEventBase = {
82
+ runId: string;
83
+ pipelineId: string;
84
+ path: PipelineNodePath;
78
85
  node: PipelineGraphNode;
79
- } | {
86
+ };
87
+ type PipelineRunEvent = (PipelineRunEventBase & {
88
+ type: "stage_started";
89
+ }) | (PipelineRunEventBase & {
80
90
  type: "stage_completed";
81
- node: PipelineGraphNode;
82
91
  durationMs: number;
83
- } | {
92
+ }) | (PipelineRunEventBase & {
84
93
  type: "stage_failed";
85
- node: PipelineGraphNode;
86
94
  durationMs: number;
87
95
  error: unknown;
88
- };
96
+ });
89
97
  type PipelineRunObserver = {
90
98
  onEvent(event: PipelineRunEvent): void | Promise<void>;
91
99
  };
92
- type PipelineRunOptions = {
100
+ type PipelineRunOptions<Input> = {
101
+ input: Input;
102
+ runId?: string | undefined;
103
+ metadata?: JsonObject | undefined;
104
+ abortSignal?: AbortSignal | undefined;
105
+ observer?: PipelineRunObserver | undefined;
106
+ failOnObserverError?: boolean | undefined;
107
+ };
108
+ type PipelineRunResult<Output> = {
109
+ runId: string;
110
+ output: Awaited<Output>;
111
+ };
112
+ type PipelineBatchOptions<Input> = {
113
+ inputs: Iterable<Input>;
114
+ concurrency: number;
115
+ metadata?: JsonObject | undefined;
116
+ abortSignal?: AbortSignal | undefined;
93
117
  observer?: PipelineRunObserver | undefined;
118
+ failOnObserverError?: boolean | undefined;
119
+ };
120
+ type PipelineBatchItem<Output> = {
121
+ status: "completed";
122
+ runId: string;
123
+ output: Awaited<Output>;
124
+ } | {
125
+ status: "failed";
126
+ runId: string;
127
+ error: unknown;
128
+ };
129
+ type PipelineOutput<Value> = Value extends Pipeline<infer _Input, infer Output> ? Awaited<Output> : never;
130
+ type ParallelOutput<Branches extends Record<string, unknown>> = {
131
+ [Key in keyof Branches]: PipelineOutput<Branches[Key]>;
94
132
  };
95
133
 
96
- /** Immutable, typed pipeline that can be composed and run directly. */
97
- declare class Pipeline<Input, Output = Input> implements PipelineOp<Input, Awaited<Output>> {
134
+ type RawResponseOf<Model> = Model extends CompletionModel<infer RawResponse> ? RawResponse : unknown;
135
+ type PipelineAgentRequest<Output, Model extends CompletionModel> = AgentInput & Omit<AgentRunSettings<Output, RawResponseOf<Model>>, "abortSignal">;
136
+ type PipelineStepOptions<Input, Output> = PipelineStageMetadata & {
137
+ run(context: PipelineStageContext<Input>): Output | Promise<Output>;
138
+ };
139
+ type PipelineComposeOptions<Input, Output> = PipelineStageMetadata & {
140
+ pipeline: Pipeline<Input, Output>;
141
+ };
142
+ type PipelineParallelOptions<Input, Branches extends Record<string, Pipeline<Input, unknown>>> = PipelineStageMetadata & {
143
+ branches: Branches;
144
+ };
145
+ type PipelineAgentOptions<Input, AgentOutput, Model extends CompletionModel> = PipelineStageMetadata & {
146
+ agent: Agent<AgentOutput, Model>;
147
+ request(context: PipelineStageContext<Input>): PipelineAgentRequest<AgentOutput, Model> | Promise<PipelineAgentRequest<AgentOutput, Model>>;
148
+ suspension: "reject";
149
+ };
150
+ type PipelineExtractOptions<Input, Extracted, Model extends CompletionModel> = PipelineStageMetadata & Omit<ExtractOptions<Extracted, Model>, "text" | "abortSignal"> & {
151
+ text(context: PipelineStageContext<Input>): string | Promise<string>;
152
+ };
153
+ /** Immutable, typed Pipeline with explicit stage and execution boundaries. */
154
+ declare class Pipeline<Input, Output = Input> {
98
155
  readonly id: string;
99
156
  readonly name: string | undefined;
100
157
  readonly description: string | undefined;
@@ -102,24 +159,16 @@ declare class Pipeline<Input, Output = Input> implements PipelineOp<Input, Await
102
159
  private readonly executor;
103
160
  private readonly state;
104
161
  constructor(options: PipelineOptions<Input, Output>);
105
- /** Add a synchronous or asynchronous transform stage. */
106
- step<Next>(fn: (input: Awaited<Output>) => Next | Promise<Next>, metadata?: PipelineStageMetadata): Pipeline<Input, Awaited<Next>>;
107
- /** Compose another pipeline operation after the current stage. */
108
- use<Next>(op: PipelineOp<Awaited<Output>, Next>, metadata?: PipelineStageMetadata): Pipeline<Input, Awaited<Next>>;
109
- /** Run named branch operations concurrently from the current value. */
110
- parallel<Branches extends Record<string, PipelineOp<Awaited<Output>, unknown>>>(branches: Branches, metadata?: PipelineStageMetadata): Pipeline<Input, ParallelOutput<Branches>>;
111
- /** Send the current value to an agent as text and continue with the agent output. */
112
- agent(agent: Agent<CompletionModel>, metadata?: PipelineStageMetadata): Pipeline<Input, string>;
113
- /** Send the current value to an extractor as text and continue with typed schema data. */
114
- extract<T>(extractor: Extractor<T, CompletionModel>, metadata?: PipelineStageMetadata): Pipeline<Input, T>;
115
- /** Run one input through the pipeline and return the final stage output. */
116
- run(input: Input, options?: PipelineRunOptions): Promise<Awaited<Output>>;
117
- /** Run many inputs through the same pipeline with bounded concurrency. */
118
- batch<I extends Iterable<Input>>(inputs: I, options: PipelineBatchOptions): Promise<Array<Awaited<Output>>>;
119
- /** Return an isolated graph snapshot for the current pipeline stages. */
162
+ step<Next>(options: PipelineStepOptions<Awaited<Output>, Next>): Pipeline<Input, Awaited<Next>>;
163
+ compose<Next>(options: PipelineComposeOptions<Awaited<Output>, Next>): Pipeline<Input, Awaited<Next>>;
164
+ parallel<Branches extends Record<string, Pipeline<Awaited<Output>, unknown>>>(options: PipelineParallelOptions<Awaited<Output>, Branches>): Pipeline<Input, ParallelOutput<Branches>>;
165
+ agent<AgentOutput, Model extends CompletionModel>(options: PipelineAgentOptions<Awaited<Output>, AgentOutput, Model>): Pipeline<Input, AgentOutput>;
166
+ extract<Extracted, Model extends CompletionModel>(options: PipelineExtractOptions<Awaited<Output>, Extracted, Model>): Pipeline<Input, Extracted>;
167
+ run(options: PipelineRunOptions<Input>): Promise<PipelineRunResult<Output>>;
168
+ runBatch(options: PipelineBatchOptions<Input>): Promise<Array<PipelineBatchItem<Output>>>;
120
169
  graph(): PipelineGraph;
121
170
  private derive;
122
- private runStep;
171
+ private execute;
123
172
  }
124
173
 
125
- export { Pipeline, type PipelineBatchOptions, type PipelineGraph, type PipelineGraphEdge, type PipelineGraphNode, type PipelineMetadata, type PipelineOp, type PipelineOptions, type PipelineRunEvent, type PipelineRunObserver, type PipelineRunOptions, type PipelineStageKind, type PipelineStageMetadata };
174
+ export { type ParallelOutput, Pipeline, type PipelineAgentOptions, PipelineAgentSuspensionError, type PipelineBatchItem, type PipelineBatchOptions, type PipelineComposeOptions, type PipelineExtractOptions, type PipelineGraph, type PipelineGraphEdge, type PipelineGraphNode, type PipelineMetadata, type PipelineNodePath, type PipelineOptions, type PipelineParallelOptions, type PipelineRunEvent, type PipelineRunObserver, type PipelineRunOptions, type PipelineRunResult, type PipelineStageContext, type PipelineStageKind, type PipelineStageMetadata, type PipelineStepOptions };