@anvia/core 1.0.0-rc.1 → 1.0.0-rc.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.
Files changed (136) hide show
  1. package/README.md +283 -84
  2. package/dist/agent/index.d.ts +26 -18
  3. package/dist/agent/index.js +19 -15
  4. package/dist/agent-yBG8e9Jj.d.ts +153 -0
  5. package/dist/chunk-4WI3VGZK.js +127 -0
  6. package/dist/chunk-4WI3VGZK.js.map +1 -0
  7. package/dist/{chunk-R2LJSQUW.js → chunk-77AIYARB.js} +251 -104
  8. package/dist/chunk-77AIYARB.js.map +1 -0
  9. package/dist/chunk-AI5JMUW7.js +45 -0
  10. package/dist/chunk-AI5JMUW7.js.map +1 -0
  11. package/dist/chunk-BEYBU7VJ.js +53 -0
  12. package/dist/chunk-BEYBU7VJ.js.map +1 -0
  13. package/dist/chunk-CWM7B2OO.js +315 -0
  14. package/dist/chunk-CWM7B2OO.js.map +1 -0
  15. package/dist/{chunk-6WGGTJE6.js → chunk-D37WMSP6.js} +52 -60
  16. package/dist/chunk-D37WMSP6.js.map +1 -0
  17. package/dist/{chunk-IL3ZSNJI.js → chunk-DBSCKTUL.js} +845 -800
  18. package/dist/chunk-DBSCKTUL.js.map +1 -0
  19. package/dist/chunk-EINTGEGY.js +629 -0
  20. package/dist/chunk-EINTGEGY.js.map +1 -0
  21. package/dist/chunk-FMHLROPQ.js +351 -0
  22. package/dist/chunk-FMHLROPQ.js.map +1 -0
  23. package/dist/{chunk-A3UBYTJT.js → chunk-FN7HLLAZ.js} +60 -6
  24. package/dist/chunk-FN7HLLAZ.js.map +1 -0
  25. package/dist/chunk-GKDERULJ.js +50 -0
  26. package/dist/chunk-GKDERULJ.js.map +1 -0
  27. package/dist/{chunk-FNQB2JEH.js → chunk-KIDGIJM7.js} +26 -5
  28. package/dist/chunk-KIDGIJM7.js.map +1 -0
  29. package/dist/chunk-KR3RCCHJ.js +500 -0
  30. package/dist/chunk-KR3RCCHJ.js.map +1 -0
  31. package/dist/{chunk-I6G7BC42.js → chunk-MGNTXGTX.js} +2 -6
  32. package/dist/chunk-MGNTXGTX.js.map +1 -0
  33. package/dist/{chunk-5XKDW36Z.js → chunk-OJH6HWHX.js} +64 -75
  34. package/dist/chunk-OJH6HWHX.js.map +1 -0
  35. package/dist/chunk-QOUPWOGW.js +29 -0
  36. package/dist/chunk-QOUPWOGW.js.map +1 -0
  37. package/dist/chunk-TIZYTPJO.js +208 -0
  38. package/dist/chunk-TIZYTPJO.js.map +1 -0
  39. package/dist/{chunk-DMPUP4R3.js → chunk-XKYYBABH.js} +5 -5
  40. package/dist/client-B8DT1vUG.d.ts +83 -0
  41. package/dist/completion/index.d.ts +5 -4
  42. package/dist/completion/index.js +25 -28
  43. package/dist/{dynamic-tools-i9woysFa.d.ts → dynamic-tools-KwEGRbHp.d.ts} +21 -9
  44. package/dist/embeddings/index.d.ts +11 -9
  45. package/dist/embeddings/index.js +2 -3
  46. package/dist/evals/index.d.ts +44 -24
  47. package/dist/evals/index.js +86 -69
  48. package/dist/evals/index.js.map +1 -1
  49. package/dist/extractor/index.d.ts +23 -26
  50. package/dist/extractor/index.js +7 -8
  51. package/dist/guardrails/index.d.ts +2 -1
  52. package/dist/guardrails/index.js +1 -1
  53. package/dist/image-generation/index.d.ts +18 -16
  54. package/dist/image-generation/index.js +2 -2
  55. package/dist/index.d.ts +24 -22
  56. package/dist/index.js +50 -48
  57. package/dist/internal/agent.d.ts +30 -19
  58. package/dist/internal/agent.js +13 -11
  59. package/dist/loaders/index.d.ts +2 -1
  60. package/dist/mcp/index.d.ts +19 -13
  61. package/dist/mcp/index.js +13 -348
  62. package/dist/mcp/index.js.map +1 -1
  63. package/dist/memory/index.d.ts +20 -6
  64. package/dist/memory/index.js +10 -10
  65. package/dist/message-schema-Cn7ezRfJ.d.ts +52 -0
  66. package/dist/{middleware-KynLg_RW.d.ts → middleware-C7PdmKF7.d.ts} +4 -4
  67. package/dist/model-call-options-CZkSw_xN.d.ts +6 -0
  68. package/dist/model-listing/index.d.ts +3 -1
  69. package/dist/observability/index.d.ts +19 -5
  70. package/dist/observability/index.js +8 -5
  71. package/dist/observability/index.js.map +1 -1
  72. package/dist/pipeline/index.d.ts +105 -56
  73. package/dist/pipeline/index.js +422 -230
  74. package/dist/pipeline/index.js.map +1 -1
  75. package/dist/{retry-D3Ruy-ba.d.ts → retry-CjvSlKGW.d.ts} +2 -1
  76. package/dist/skills/index.d.ts +5 -4
  77. package/dist/skills/index.js +7 -7
  78. package/dist/speech-generation/index.d.ts +37 -0
  79. package/dist/speech-generation/index.js +8 -0
  80. package/dist/{think-tool-DZqZj2LV.d.ts → think-tool-6H2QNQzQ.d.ts} +1 -1
  81. package/dist/tool/index.d.ts +9 -7
  82. package/dist/tool/index.js +7 -10
  83. package/dist/{tool-C_8GudXn.d.ts → tool--Mz4v1eL.d.ts} +15 -7
  84. package/dist/transcription/index.d.ts +23 -14
  85. package/dist/transcription/index.js +2 -2
  86. package/dist/{index-DxB74ybJ.d.ts → types-3x3mOLHU.d.ts} +94 -64
  87. package/dist/types-BVzM4RsC.d.ts +155 -0
  88. package/dist/types-CQ_ioXWK.d.ts +319 -0
  89. package/dist/types-Cr4uiYo5.d.ts +99 -0
  90. package/dist/{types-DhQfwiZn.d.ts → types-DiJqJejp.d.ts} +1 -1
  91. package/dist/types-Dld1TpWj.d.ts +130 -0
  92. package/dist/vector-store/index.d.ts +33 -34
  93. package/dist/vector-store/index.js +6 -6
  94. package/package.json +6 -10
  95. package/dist/agent-DGYY_onS.d.ts +0 -145
  96. package/dist/audio-generation/index.d.ts +0 -31
  97. package/dist/audio-generation/index.js +0 -8
  98. package/dist/chunk-5XKDW36Z.js.map +0 -1
  99. package/dist/chunk-6WGGTJE6.js.map +0 -1
  100. package/dist/chunk-A3UBYTJT.js.map +0 -1
  101. package/dist/chunk-ADH7NNCS.js +0 -512
  102. package/dist/chunk-ADH7NNCS.js.map +0 -1
  103. package/dist/chunk-DZ3CKYTH.js +0 -267
  104. package/dist/chunk-DZ3CKYTH.js.map +0 -1
  105. package/dist/chunk-FNQB2JEH.js.map +0 -1
  106. package/dist/chunk-I6G7BC42.js.map +0 -1
  107. package/dist/chunk-IL3ZSNJI.js.map +0 -1
  108. package/dist/chunk-J6GNQART.js +0 -122
  109. package/dist/chunk-J6GNQART.js.map +0 -1
  110. package/dist/chunk-M3IOWB4Y.js +0 -280
  111. package/dist/chunk-M3IOWB4Y.js.map +0 -1
  112. package/dist/chunk-QY5GZ7HR.js +0 -39
  113. package/dist/chunk-QY5GZ7HR.js.map +0 -1
  114. package/dist/chunk-R2LJSQUW.js.map +0 -1
  115. package/dist/chunk-RFDVKCIE.js +0 -12
  116. package/dist/chunk-RFDVKCIE.js.map +0 -1
  117. package/dist/chunk-RMUBRRSK.js +0 -34
  118. package/dist/chunk-RMUBRRSK.js.map +0 -1
  119. package/dist/chunk-RXKHOYEH.js +0 -466
  120. package/dist/chunk-RXKHOYEH.js.map +0 -1
  121. package/dist/chunk-XDRSPSR7.js +0 -38
  122. package/dist/chunk-XDRSPSR7.js.map +0 -1
  123. package/dist/chunk-XWUC7CIT.js +0 -1
  124. package/dist/chunk-XWUC7CIT.js.map +0 -1
  125. package/dist/errors-CYKUcU89.d.ts +0 -17
  126. package/dist/json-Zo7K3xmt.d.ts +0 -40
  127. package/dist/types-B3A4YxaA.d.ts +0 -354
  128. package/dist/types-BBEGKB9m.d.ts +0 -119
  129. package/dist/types-DT3nEemY.d.ts +0 -79
  130. package/dist/types-DulRCYdB.d.ts +0 -70
  131. package/dist/types-p55Jc-sr.d.ts +0 -47
  132. package/dist/ui/index.d.ts +0 -107
  133. package/dist/ui/index.js +0 -10
  134. package/dist/ui/index.js.map +0 -1
  135. /package/dist/{chunk-DMPUP4R3.js.map → chunk-XKYYBABH.js.map} +0 -0
  136. /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 { b as AgentApprovalRequiredResult, i as AgentInput, p as AgentRunSettings } from '../types-3x3mOLHU.js';
2
+ import { A as Agent } from '../agent-yBG8e9Jj.js';
3
+ import { J as JsonObject, C as CompletionModel } from '../types-CQ_ioXWK.js';
4
+ import { ExtractOptions } from '../extractor/index.js';
4
5
  import { z } from 'zod';
6
+ import '../retry-CjvSlKGW.js';
5
7
  import '../guardrails/index.js';
6
8
  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';
9
+ import '../model-call-options-CZkSw_xN.js';
10
+ import '../types-BVzM4RsC.js';
11
+ import '../tool--Mz4v1eL.js';
12
+ import '../middleware-C7PdmKF7.js';
12
13
  import '../zod-schema-C7F4clpm.js';
13
- import '../types-DulRCYdB.js';
14
- import '@modelcontextprotocol/sdk/client/sse.js';
15
- import '@modelcontextprotocol/sdk/client/stdio.js';
14
+ import '../client-B8DT1vUG.js';
15
+ import 'node:child_process';
16
+ import 'node:stream';
17
+ import '@modelcontextprotocol/sdk/client/auth.js';
16
18
  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';
19
+ import '@modelcontextprotocol/sdk/shared/transport.js';
20
+ import '../types-DiJqJejp.js';
21
+ import '../dynamic-tools-KwEGRbHp.js';
22
+ import '../types-Cr4uiYo5.js';
23
+ import '../types-Dld1TpWj.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 PipelineAgentApprovalError extends Error {
26
+ readonly result: AgentApprovalRequiredResult;
27
+ constructor(result: AgentApprovalRequiredResult);
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
+ approval: "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, PipelineAgentApprovalError, type PipelineAgentOptions, 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 };