@anvia/core 0.16.0 → 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/dist/agent/index.d.ts +11 -11
  2. package/dist/agent/index.js +8 -8
  3. package/dist/{agent-BTiQ4RZn.d.ts → agent-Cg0UigNK.d.ts} +7 -7
  4. package/dist/audio-generation/index.d.ts +1 -1
  5. package/dist/{chunk-3PRP2DV4.js → chunk-54S4I3SX.js} +6 -6
  6. package/dist/{chunk-DC2GJDPR.js → chunk-77D7XBWL.js} +2 -2
  7. package/dist/{chunk-3QG4SFH4.js → chunk-BQCTJSNL.js} +5 -5
  8. package/dist/{chunk-I7TM7TKX.js → chunk-F3C5653H.js} +4 -4
  9. package/dist/{chunk-K72JKDZ7.js → chunk-GCED5ZNM.js} +2 -2
  10. package/dist/{chunk-PJCJ45RJ.js → chunk-OPAEENGD.js} +38 -13
  11. package/dist/chunk-OPAEENGD.js.map +1 -0
  12. package/dist/{chunk-R6QERZAB.js → chunk-PJDL5UT2.js} +52 -4
  13. package/dist/chunk-PJDL5UT2.js.map +1 -0
  14. package/dist/{chunk-A7AYX6BD.js → chunk-RWAOHGRL.js} +4 -4
  15. package/dist/{chunk-IT426VXL.js → chunk-SWUH4G2I.js} +2 -2
  16. package/dist/{chunk-4PMAWIGM.js → chunk-SWUIBS4N.js} +6 -6
  17. package/dist/completion/index.d.ts +3 -3
  18. package/dist/completion/index.js +2 -2
  19. package/dist/evals/index.d.ts +8 -8
  20. package/dist/evals/index.js +9 -9
  21. package/dist/extractor/index.d.ts +8 -8
  22. package/dist/extractor/index.js +9 -9
  23. package/dist/guardrails/index.d.ts +1 -1
  24. package/dist/hooks/index.d.ts +3 -3
  25. package/dist/image-generation/index.d.ts +1 -1
  26. package/dist/{index-Du1vCw6J.d.ts → index-XTUEMWhU.d.ts} +16 -8
  27. package/dist/index.d.ts +12 -12
  28. package/dist/index.js +11 -11
  29. package/dist/internal/agent.d.ts +8 -8
  30. package/dist/internal/agent.js +7 -7
  31. package/dist/{json-D_Ijo4lJ.d.ts → json-D9IvOgx_.d.ts} +1 -1
  32. package/dist/loaders/index.d.ts +1 -1
  33. package/dist/mcp/index.d.ts +4 -4
  34. package/dist/memory/index.d.ts +3 -3
  35. package/dist/{middleware-CsxdqqjJ.d.ts → middleware-Cp0tm6zE.d.ts} +3 -3
  36. package/dist/observability/index.d.ts +3 -3
  37. package/dist/observability/index.js.map +1 -1
  38. package/dist/pipeline/index.d.ts +8 -8
  39. package/dist/request/index.d.ts +8 -8
  40. package/dist/request/index.js +6 -6
  41. package/dist/skills/index.d.ts +4 -4
  42. package/dist/skills/index.js +5 -5
  43. package/dist/{think-tool-BTFFKn1m.d.ts → think-tool-CpCKo8Q8.d.ts} +1 -1
  44. package/dist/tool/index.d.ts +5 -5
  45. package/dist/tool/index.js +5 -5
  46. package/dist/{tool-sKozRXMI.d.ts → tool-Dhwg__1L.d.ts} +1 -1
  47. package/dist/transcription/index.d.ts +1 -1
  48. package/dist/{types-yf-Exga_.d.ts → types-BBEf34DP.d.ts} +2 -2
  49. package/dist/{types-CHFrSm-3.d.ts → types-BCA8p0sb.d.ts} +1 -1
  50. package/dist/{types-DMQ8JEf8.d.ts → types-CBmhLT_r.d.ts} +1 -1
  51. package/dist/{types-BkTDw00d.d.ts → types-DMGvEFRf.d.ts} +1 -1
  52. package/dist/{types-nybevqL9.d.ts → types-XjIh933x.d.ts} +9 -1
  53. package/dist/{types-BT1n5oU4.d.ts → types-fBv8mhvP.d.ts} +1 -1
  54. package/dist/ui/index.d.ts +1 -1
  55. package/dist/ui/index.js +2 -2
  56. package/dist/vector-store/index.d.ts +4 -4
  57. package/dist/vector-store/index.js +2 -2
  58. package/package.json +1 -1
  59. package/dist/chunk-PJCJ45RJ.js.map +0 -1
  60. package/dist/chunk-R6QERZAB.js.map +0 -1
  61. /package/dist/{chunk-3PRP2DV4.js.map → chunk-54S4I3SX.js.map} +0 -0
  62. /package/dist/{chunk-DC2GJDPR.js.map → chunk-77D7XBWL.js.map} +0 -0
  63. /package/dist/{chunk-3QG4SFH4.js.map → chunk-BQCTJSNL.js.map} +0 -0
  64. /package/dist/{chunk-I7TM7TKX.js.map → chunk-F3C5653H.js.map} +0 -0
  65. /package/dist/{chunk-K72JKDZ7.js.map → chunk-GCED5ZNM.js.map} +0 -0
  66. /package/dist/{chunk-A7AYX6BD.js.map → chunk-RWAOHGRL.js.map} +0 -0
  67. /package/dist/{chunk-IT426VXL.js.map → chunk-SWUH4G2I.js.map} +0 -0
  68. /package/dist/{chunk-4PMAWIGM.js.map → chunk-SWUIBS4N.js.map} +0 -0
@@ -1,16 +1,16 @@
1
- import { D as DynamicContextOptions, b as DynamicToolOptions, c as AgentEventStore, d as AgentEventStoreOptions, A as Agent } from '../agent-BTiQ4RZn.js';
2
- export { e as AgentEventAppendInput, f as AgentEventRecord, g as AgentEventStoreInclude, h as AgentSession, i as AgentToolOptions } from '../agent-BTiQ4RZn.js';
1
+ import { D as DynamicContextOptions, b as DynamicToolOptions, c as AgentEventStore, d as AgentEventStoreOptions, A as Agent } from '../agent-Cg0UigNK.js';
2
+ export { e as AgentEventAppendInput, f as AgentEventRecord, g as AgentEventStoreInclude, h as AgentSession, i as AgentToolOptions } from '../agent-Cg0UigNK.js';
3
3
  import { Z as ZodSchema } from '../zod-schema-C7F4clpm.js';
4
- import { C as CompletionModel, P as ProviderTool, i as JsonValue, z as ToolChoice } from '../types-nybevqL9.js';
4
+ import { C as CompletionModel, P as ProviderTool, i as JsonValue, z as ToolChoice } from '../types-XjIh933x.js';
5
5
  import { GuardrailPolicyInput } from '../guardrails/index.js';
6
- import { P as PromptHook } from '../types-CHFrSm-3.js';
7
- import { a as McpServer } from '../types-yf-Exga_.js';
8
- import { e as MemoryStore, f as MemoryOptions } from '../types-DMQ8JEf8.js';
9
- import { i as AgentObserver, O as ObserveOptions } from '../index-Du1vCw6J.js';
10
- import { a as SkillSet } from '../types-BT1n5oU4.js';
11
- import { k as ToolSearchDocument, l as ToolSet, A as AgentMiddleware, e as ToolMiddleware } from '../middleware-CsxdqqjJ.js';
12
- import { A as AnyTool, e as ToolApprovalsOptions } from '../tool-sKozRXMI.js';
13
- import { a as VectorSearchIndex } from '../types-BkTDw00d.js';
6
+ import { P as PromptHook } from '../types-BCA8p0sb.js';
7
+ import { a as McpServer } from '../types-BBEf34DP.js';
8
+ import { e as MemoryStore, f as MemoryOptions } from '../types-CBmhLT_r.js';
9
+ import { i as AgentObserver, O as ObserveOptions } from '../index-XTUEMWhU.js';
10
+ import { a as SkillSet } from '../types-fBv8mhvP.js';
11
+ import { k as ToolSearchDocument, l as ToolSet, A as AgentMiddleware, e as ToolMiddleware } from '../middleware-Cp0tm6zE.js';
12
+ import { A as AnyTool, e as ToolApprovalsOptions } from '../tool-Dhwg__1L.js';
13
+ import { a as VectorSearchIndex } from '../types-DMGvEFRf.js';
14
14
  import 'zod';
15
15
  import '@modelcontextprotocol/sdk/client/sse.js';
16
16
  import '@modelcontextprotocol/sdk/client/stdio.js';
@@ -1,19 +1,19 @@
1
1
  import {
2
2
  AgentBuilder
3
- } from "../chunk-A7AYX6BD.js";
4
- import "../chunk-3QG4SFH4.js";
5
- import "../chunk-PJCJ45RJ.js";
3
+ } from "../chunk-RWAOHGRL.js";
4
+ import "../chunk-BQCTJSNL.js";
5
+ import "../chunk-OPAEENGD.js";
6
6
  import "../chunk-YK4WAAS4.js";
7
7
  import "../chunk-XUUY2L2D.js";
8
- import "../chunk-4PMAWIGM.js";
9
- import "../chunk-I7TM7TKX.js";
8
+ import "../chunk-SWUIBS4N.js";
9
+ import "../chunk-F3C5653H.js";
10
10
  import "../chunk-2ODTMRHP.js";
11
11
  import "../chunk-M6RPFHG7.js";
12
- import "../chunk-K72JKDZ7.js";
13
- import "../chunk-R6QERZAB.js";
14
- import "../chunk-WQKHFADH.js";
15
12
  import "../chunk-YBBD4HZ3.js";
16
13
  import "../chunk-OIMLU4SF.js";
14
+ import "../chunk-GCED5ZNM.js";
15
+ import "../chunk-PJDL5UT2.js";
16
+ import "../chunk-WQKHFADH.js";
17
17
  import "../chunk-CWUJUSOS.js";
18
18
  export {
19
19
  AgentBuilder
@@ -1,11 +1,11 @@
1
- import { C as CompletionModel, M as Message, D as Document, i as JsonValue, P as ProviderTool, z as ToolChoice, J as JsonObject } from './types-nybevqL9.js';
1
+ import { C as CompletionModel, M as Message, D as Document, i as JsonValue, P as ProviderTool, z as ToolChoice, J as JsonObject } from './types-XjIh933x.js';
2
2
  import { GuardrailPolicyInput, GuardrailPolicy } from './guardrails/index.js';
3
- import { P as PromptHook } from './types-CHFrSm-3.js';
4
- import { h as MemoryContext, j as MemoryRegistration, S as SessionOptions } from './types-DMQ8JEf8.js';
5
- import { j as AgentTraceOptions, P as PromptResponse, d as AgentStreamEvent, f as AgentStreamEventWithoutToolCallDeltas, g as AgentStreamOptions, k as AgentObserverRegistration } from './index-Du1vCw6J.js';
6
- import { e as ToolApprovalsOptions, T as Tool, A as AnyTool, f as ToolCallContext, N as NormalizedToolOutput } from './tool-sKozRXMI.js';
7
- import { A as AgentMiddleware, e as ToolMiddleware, k as ToolSearchDocument, l as ToolSet } from './middleware-CsxdqqjJ.js';
8
- import { V as VectorFilter, c as VectorSearchResult, a as VectorSearchIndex } from './types-BkTDw00d.js';
3
+ import { P as PromptHook } from './types-BCA8p0sb.js';
4
+ import { h as MemoryContext, j as MemoryRegistration, S as SessionOptions } from './types-CBmhLT_r.js';
5
+ import { j as AgentTraceOptions, P as PromptResponse, d as AgentStreamEvent, f as AgentStreamEventWithoutToolCallDeltas, g as AgentStreamOptions, k as AgentObserverRegistration } from './index-XTUEMWhU.js';
6
+ import { e as ToolApprovalsOptions, T as Tool, A as AnyTool, f as ToolCallContext, N as NormalizedToolOutput } from './tool-Dhwg__1L.js';
7
+ import { A as AgentMiddleware, e as ToolMiddleware, k as ToolSearchDocument, l as ToolSet } from './middleware-Cp0tm6zE.js';
8
+ import { V as VectorFilter, c as VectorSearchResult, a as VectorSearchIndex } from './types-DMGvEFRf.js';
9
9
 
10
10
  type CompletionRetryContext = {
11
11
  error: unknown;
@@ -1,4 +1,4 @@
1
- import { i as JsonValue } from '../types-nybevqL9.js';
1
+ import { i as JsonValue } from '../types-XjIh933x.js';
2
2
 
3
3
  type AudioGenerationRequest = {
4
4
  text: string;
@@ -1,20 +1,20 @@
1
1
  import {
2
2
  AgentBuilder
3
- } from "./chunk-A7AYX6BD.js";
3
+ } from "./chunk-RWAOHGRL.js";
4
4
  import {
5
5
  extractRagText
6
- } from "./chunk-PJCJ45RJ.js";
6
+ } from "./chunk-OPAEENGD.js";
7
7
  import {
8
8
  createTool
9
- } from "./chunk-I7TM7TKX.js";
9
+ } from "./chunk-F3C5653H.js";
10
10
  import {
11
11
  CompletionRequestBuilder
12
- } from "./chunk-K72JKDZ7.js";
12
+ } from "./chunk-GCED5ZNM.js";
13
13
  import {
14
14
  CompletionCapabilityError,
15
15
  Message,
16
16
  Usage
17
- } from "./chunk-R6QERZAB.js";
17
+ } from "./chunk-PJDL5UT2.js";
18
18
 
19
19
  // src/extractor/extractor.ts
20
20
  var SUBMIT_TOOL_NAME = "submit";
@@ -138,4 +138,4 @@ export {
138
138
  Extractor,
139
139
  ExtractorBuilder
140
140
  };
141
- //# sourceMappingURL=chunk-3PRP2DV4.js.map
141
+ //# sourceMappingURL=chunk-54S4I3SX.js.map
@@ -6,7 +6,7 @@ import {
6
6
  } from "./chunk-YK4WAAS4.js";
7
7
  import {
8
8
  createTool
9
- } from "./chunk-I7TM7TKX.js";
9
+ } from "./chunk-F3C5653H.js";
10
10
 
11
11
  // src/skills/instructions.ts
12
12
  function skillInstructions(skills) {
@@ -395,4 +395,4 @@ export {
395
395
  SkillValidationError,
396
396
  skill
397
397
  };
398
- //# sourceMappingURL=chunk-DC2GJDPR.js.map
398
+ //# sourceMappingURL=chunk-77D7XBWL.js.map
@@ -1,18 +1,18 @@
1
1
  import {
2
2
  PromptRequest
3
- } from "./chunk-PJCJ45RJ.js";
3
+ } from "./chunk-OPAEENGD.js";
4
4
  import {
5
5
  isSkillTool
6
6
  } from "./chunk-YK4WAAS4.js";
7
7
  import {
8
8
  ToolSet
9
- } from "./chunk-4PMAWIGM.js";
9
+ } from "./chunk-SWUIBS4N.js";
10
10
  import {
11
11
  createTool
12
- } from "./chunk-I7TM7TKX.js";
12
+ } from "./chunk-F3C5653H.js";
13
13
  import {
14
14
  isStreamingCompletionModel
15
- } from "./chunk-K72JKDZ7.js";
15
+ } from "./chunk-GCED5ZNM.js";
16
16
 
17
17
  // src/agent/agent.ts
18
18
  import { z } from "zod";
@@ -210,4 +210,4 @@ export {
210
210
  Agent,
211
211
  AgentSession
212
212
  };
213
- //# sourceMappingURL=chunk-3QG4SFH4.js.map
213
+ //# sourceMappingURL=chunk-BQCTJSNL.js.map
@@ -1,10 +1,10 @@
1
- import {
2
- toProviderJsonSchema
3
- } from "./chunk-WQKHFADH.js";
4
1
  import {
5
2
  cosineSimilarity,
6
3
  embedText
7
4
  } from "./chunk-YBBD4HZ3.js";
5
+ import {
6
+ toProviderJsonSchema
7
+ } from "./chunk-WQKHFADH.js";
8
8
 
9
9
  // src/vector-store/index.ts
10
10
  import { z } from "zod";
@@ -334,4 +334,4 @@ export {
334
334
  InMemoryVectorIndex,
335
335
  createVectorSearchTool
336
336
  };
337
- //# sourceMappingURL=chunk-I7TM7TKX.js.map
337
+ //# sourceMappingURL=chunk-F3C5653H.js.map
@@ -3,7 +3,7 @@ import {
3
3
  assertCompletionRequestSupported,
4
4
  isProviderTool,
5
5
  textFromAssistantContent
6
- } from "./chunk-R6QERZAB.js";
6
+ } from "./chunk-PJDL5UT2.js";
7
7
  import {
8
8
  toProviderJsonSchema
9
9
  } from "./chunk-WQKHFADH.js";
@@ -347,4 +347,4 @@ export {
347
347
  formatDocument,
348
348
  CompletionRequestBuilder
349
349
  };
350
- //# sourceMappingURL=chunk-K72JKDZ7.js.map
350
+ //# sourceMappingURL=chunk-GCED5ZNM.js.map
@@ -4,15 +4,18 @@ import {
4
4
  import {
5
5
  parseToolArgs,
6
6
  toolResultContentToText
7
- } from "./chunk-4PMAWIGM.js";
7
+ } from "./chunk-SWUIBS4N.js";
8
8
  import {
9
9
  runControl,
10
10
  toolCallControl
11
11
  } from "./chunk-2ODTMRHP.js";
12
+ import {
13
+ mapWithConcurrency
14
+ } from "./chunk-OIMLU4SF.js";
12
15
  import {
13
16
  CompletionRequestBuilder,
14
17
  isStreamingCompletionModel
15
- } from "./chunk-K72JKDZ7.js";
18
+ } from "./chunk-GCED5ZNM.js";
16
19
  import {
17
20
  AssistantContent,
18
21
  Message,
@@ -21,10 +24,7 @@ import {
21
24
  assertCompletionRequestSupported,
22
25
  getAssistantGenerationMetadata,
23
26
  textFromAssistantContent
24
- } from "./chunk-R6QERZAB.js";
25
- import {
26
- mapWithConcurrency
27
- } from "./chunk-OIMLU4SF.js";
27
+ } from "./chunk-PJDL5UT2.js";
28
28
  import {
29
29
  appendGuardrailPolicies,
30
30
  hasEnforcedOutputGuardrails,
@@ -1830,11 +1830,20 @@ var PromptRequest = class _PromptRequest {
1830
1830
  );
1831
1831
  assertCompletionRequestSupported(this.agent.model, request, { streaming: true });
1832
1832
  const providerRequest = this.providerTraceRequest(request, { stream: true });
1833
- const generationObservers = await runObservers.startGeneration(
1834
- this.generationStartArgs(currentTurns, request, providerRequest)
1833
+ const generationStartArgs = this.generationStartArgs(
1834
+ currentTurns,
1835
+ request,
1836
+ providerRequest
1835
1837
  );
1836
- const accumulator = new CompletionStreamAccumulator();
1838
+ const generationObservers = await runObservers.startGeneration(generationStartArgs);
1837
1839
  const generationStartedAt = Date.now();
1840
+ yield await emit({
1841
+ type: "generation_start",
1842
+ turn: currentTurns,
1843
+ request,
1844
+ modelInfo: generationStartArgs.modelInfo
1845
+ });
1846
+ const accumulator = new CompletionStreamAccumulator();
1838
1847
  let firstDeltaMs;
1839
1848
  const bufferResponseEvents = this.shouldBufferStreamResponseEvents();
1840
1849
  const emittedToolCallIds = /* @__PURE__ */ new Set();
@@ -1916,7 +1925,12 @@ var PromptRequest = class _PromptRequest {
1916
1925
  yield await emit(event);
1917
1926
  }
1918
1927
  }
1919
- yield await emit({ type: "turn_end", turn: currentTurns, response });
1928
+ yield await emit({
1929
+ type: "turn_end",
1930
+ turn: currentTurns,
1931
+ response,
1932
+ firstDeltaMs
1933
+ });
1920
1934
  emittedTurnEnd = true;
1921
1935
  }
1922
1936
  if (this.steeringMessages.length > 0) {
@@ -1960,7 +1974,12 @@ var PromptRequest = class _PromptRequest {
1960
1974
  }
1961
1975
  }
1962
1976
  if (!emittedTurnEnd) {
1963
- yield await emit({ type: "turn_end", turn: currentTurns, response });
1977
+ yield await emit({
1978
+ type: "turn_end",
1979
+ turn: currentTurns,
1980
+ response,
1981
+ firstDeltaMs
1982
+ });
1964
1983
  }
1965
1984
  const result = {
1966
1985
  output: guardedOutput.output,
@@ -2009,7 +2028,12 @@ var PromptRequest = class _PromptRequest {
2009
2028
  [assistantMessage],
2010
2029
  pendingTurnMessages
2011
2030
  );
2012
- yield await emit({ type: "turn_end", turn: currentTurns, response });
2031
+ yield await emit({
2032
+ type: "turn_end",
2033
+ turn: currentTurns,
2034
+ response,
2035
+ firstDeltaMs
2036
+ });
2013
2037
  const toolResultEvents = createAsyncQueue();
2014
2038
  const toolResultsPromise = this.executeToolCalls(
2015
2039
  runId,
@@ -2242,6 +2266,7 @@ var PromptRequest = class _PromptRequest {
2242
2266
  agentDescription: this.agent.description,
2243
2267
  instructions: this.agent.instructions,
2244
2268
  trace: this.traceOptions,
2269
+ promptRef: this.traceOptions?.promptRef,
2245
2270
  prompt: this.promptMessage,
2246
2271
  history: this.chatHistory,
2247
2272
  maxTurns: this.maxTurnCount
@@ -2568,4 +2593,4 @@ export {
2568
2593
  extractRagText,
2569
2594
  PromptRequest
2570
2595
  };
2571
- //# sourceMappingURL=chunk-PJCJ45RJ.js.map
2596
+ //# sourceMappingURL=chunk-OPAEENGD.js.map