@voltro/ai 0.84.0 → 0.86.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 (61) hide show
  1. package/CHANGELOG.md +1215 -0
  2. package/THIRD-PARTY-NOTICES.md +5 -151
  3. package/dist/agent.d.ts +34 -41
  4. package/dist/agent.js +64 -2
  5. package/dist/agentConstants.js +4 -0
  6. package/dist/agentExecutor.js +51 -0
  7. package/dist/api.js +199 -0
  8. package/dist/appTools.js +80 -0
  9. package/dist/budget.js +201 -0
  10. package/dist/callEvidence.js +51 -0
  11. package/dist/copilot.js +126 -0
  12. package/dist/cost.js +242 -0
  13. package/dist/embed.js +41 -0
  14. package/dist/embeddingProvider.js +51 -0
  15. package/dist/eval.js +130 -0
  16. package/dist/events.d.ts +171 -168
  17. package/dist/events.js +81 -2
  18. package/dist/executableModalities.js +13 -0
  19. package/dist/gateway.js +58 -0
  20. package/dist/gatewayCatalog.js +47 -0
  21. package/dist/gatewayMedia.js +88 -0
  22. package/dist/index.d.ts +328 -326
  23. package/dist/index.js +42 -2581
  24. package/dist/inferenceDispatch.js +493 -0
  25. package/dist/inferenceQueue.js +96 -0
  26. package/dist/jsonOutputValidation.js +27 -0
  27. package/dist/mcpClient.js +332 -0
  28. package/dist/mcpTools.js +80 -0
  29. package/dist/media.js +182 -0
  30. package/dist/mediaBytes.js +19 -0
  31. package/dist/mediaCall.js +13 -0
  32. package/dist/mediaTaskProvider.js +16 -0
  33. package/dist/middleware.js +32 -0
  34. package/dist/observe.js +52 -0
  35. package/dist/prompts.js +103 -0
  36. package/dist/provider.js +303 -0
  37. package/dist/realtimeEvent.js +97 -0
  38. package/dist/realtimeSession.js +154 -0
  39. package/dist/rerank.js +61 -0
  40. package/dist/resumableStream.js +321 -0
  41. package/dist/retrieveReranked.js +16 -0
  42. package/dist/runAndPersist.js +148 -0
  43. package/dist/semanticCache.js +66 -0
  44. package/dist/speechProvider.js +16 -0
  45. package/dist/streamRegistry.js +14 -0
  46. package/dist/streamText.js +170 -0
  47. package/dist/streamTranscribe.js +74 -0
  48. package/dist/streamWakeups.js +44 -0
  49. package/dist/structuredEvidence.js +48 -0
  50. package/dist/test.js +1 -1
  51. package/dist/threads.js +92 -0
  52. package/dist/tools.js +68 -0
  53. package/dist/transcribe.js +64 -0
  54. package/dist/transcriptionEvent.js +46 -0
  55. package/dist/workflow.d.ts +12 -10
  56. package/dist/workflow.js +117 -112
  57. package/package.json +6 -6
  58. package/dist/agentDescriptor-DuxvWGDi.js +0 -63
  59. package/dist/agentEvent-BuXA7sRt.js +0 -152
  60. package/dist/inferenceQueue-BmtEm3YI.js +0 -1061
  61. package/dist/provider-BnemgE4D.js +0 -409
@@ -1,63 +0,0 @@
1
- import { Schema as e } from "effect";
2
- import { defineAction as t, defineQuery as n } from "@voltro/protocol";
3
- //#region src/agentConstants.ts
4
- var r = "_voltro_agent_threads", i = "_voltro_agent_messages", a = e.Struct({ prompt: e.String }), o = "@voltro/ai/AgentDescriptor", s = class extends e.TaggedError()("AgentThreadAccessDenied", { threadId: e.String }) {
5
- get message() {
6
- return `agent thread '${this.threadId}' belongs to another subject`;
7
- }
8
- }, c = (e) => {
9
- if (e.guards !== void 0 && e.guards.length === 0) throw Error(`defineAgent("${e.name}"): \`guards: []\` is empty, so it enforces nothing —\n but it reads at the call site as if the agent were protected. Omit the field
10
- and decide with \`openAccess\`, or list the scopes that may talk to it.`);
11
- if (e.openAccess !== void 0 && e.guards !== void 0 && e.guards.length > 0) throw Error(`defineAgent("${e.name}"): \`openAccess\` and \`guards\` are two different access\n decisions, so declaring both says the agent is protected AND open. Keep the
12
- guards if a caller must hold a scope; drop them if anyone may talk to it.`);
13
- return {
14
- _brand: o,
15
- name: e.name,
16
- ...e.input === void 0 ? {} : { input: e.input },
17
- ...e.guards === void 0 ? {} : { guards: e.guards },
18
- ...e.openAccess === void 0 ? {} : { openAccess: e.openAccess }
19
- };
20
- }, l = (e) => typeof e == "object" && !!e && e._brand === o, u = (e) => e.input ?? a, d = e.Struct({ type: e.String }, {
21
- key: e.String,
22
- value: e.Unknown
23
- }), f = e.Struct({
24
- id: e.String,
25
- threadId: e.String,
26
- role: e.String,
27
- content: e.String,
28
- streaming: e.Boolean,
29
- order: e.Number,
30
- stepOrder: e.Number,
31
- parts: e.Array(d)
32
- }), p = (t) => {
33
- let n = u(t), r = e.Struct({
34
- threadId: e.String,
35
- order: e.Number
36
- });
37
- try {
38
- return e.extend(n, r);
39
- } catch {
40
- return r;
41
- }
42
- }, m = (r) => {
43
- let a = {};
44
- return r.openAccess === void 0 ? r.guards !== void 0 && (a.guards = r.guards) : a.openAccess = r.openAccess, {
45
- send: t({
46
- name: `${r.name}.send`,
47
- input: p(r),
48
- output: e.Struct({ text: e.String }),
49
- error: s,
50
- ...a
51
- }),
52
- messages: n({
53
- name: `${r.name}.messages`,
54
- input: e.Struct({ threadId: e.String }),
55
- output: e.Array(f),
56
- source: i,
57
- error: s,
58
- ...a
59
- })
60
- };
61
- };
62
- //#endregion
63
- export { c as a, r as c, m as i, u as n, l as o, f as r, i as s, s as t };
@@ -1,152 +0,0 @@
1
- import { Schema as e } from "effect";
2
- //#region src/transcriptionEvent.ts
3
- var t = class extends e.TaggedError()("TranscriptionStreamError", {
4
- reason: e.Literal("input", "unsupported", "provider", "cancelled"),
5
- message: e.String
6
- }) {}, n = e.Struct({
7
- text: e.String,
8
- start: e.Number,
9
- end: e.Number
10
- }), r = { id: e.optional(e.String) }, i = e.Union(e.Struct({
11
- type: e.Literal("transcript-delta"),
12
- ...r,
13
- delta: e.String
14
- }), e.Struct({
15
- type: e.Literal("transcript-partial"),
16
- ...r,
17
- text: e.String,
18
- startSecond: e.optional(e.Number),
19
- durationInSeconds: e.optional(e.Number),
20
- channelIndex: e.optional(e.Number)
21
- }), e.Struct({
22
- type: e.Literal("transcript-final"),
23
- ...r,
24
- text: e.String,
25
- startSecond: e.optional(e.Number),
26
- endSecond: e.optional(e.Number),
27
- channelIndex: e.optional(e.Number)
28
- }), e.Struct({
29
- type: e.Literal("finish"),
30
- text: e.String,
31
- segments: e.Array(n),
32
- language: e.optional(e.String),
33
- durationSec: e.optional(e.Number)
34
- })), a = e.String.pipe(e.pattern(/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/)), o = e.Number.pipe(e.finite(), e.nonNegative()), s = e.Union(e.Struct({
35
- type: e.Literal("input-audio-append"),
36
- audio: a
37
- }), e.Struct({ type: e.Literal("input-audio-commit", "input-audio-clear", "response-create", "response-cancel") }), e.Struct({
38
- type: e.Literal("conversation-item-create"),
39
- item: e.Struct({
40
- type: e.Literal("text-message"),
41
- role: e.Literal("user"),
42
- text: e.String
43
- })
44
- }), e.Struct({
45
- type: e.Literal("conversation-item-truncate"),
46
- itemId: e.String,
47
- contentIndex: o.pipe(e.int()),
48
- audioEndMs: o
49
- })), c = { itemId: e.String }, l = {
50
- responseId: e.String,
51
- ...c
52
- }, u = e.Union(e.Struct({ type: e.Literal("ready") }), e.Struct({
53
- type: e.Literal("session-created"),
54
- sessionId: e.optional(e.String)
55
- }), e.Struct({ type: e.Literal("session-updated") }), e.Struct({
56
- type: e.Literal("speech-started", "speech-stopped"),
57
- itemId: e.optional(e.String)
58
- }), e.Struct({
59
- type: e.Literal("audio-committed"),
60
- itemId: e.optional(e.String),
61
- previousItemId: e.optional(e.String)
62
- }), e.Struct({
63
- type: e.Literal("conversation-item-added"),
64
- ...c
65
- }), e.Struct({
66
- type: e.Literal("input-transcription-completed"),
67
- ...c,
68
- transcript: e.String
69
- }), e.Struct({
70
- type: e.Literal("response-created"),
71
- responseId: e.String
72
- }), e.Struct({
73
- type: e.Literal("response-done"),
74
- responseId: e.String,
75
- status: e.String
76
- }), e.Struct({
77
- type: e.Literal("output-item-added", "output-item-done", "content-part-added", "content-part-done", "audio-done"),
78
- ...l
79
- }), e.Struct({
80
- type: e.Literal("audio-delta"),
81
- ...l,
82
- delta: a
83
- }), e.Struct({
84
- type: e.Literal("text-delta", "audio-transcript-delta"),
85
- ...l,
86
- delta: e.String
87
- }), e.Struct({
88
- type: e.Literal("text-done"),
89
- ...l,
90
- text: e.optional(e.String)
91
- }), e.Struct({
92
- type: e.Literal("audio-transcript-done"),
93
- ...l,
94
- transcript: e.optional(e.String)
95
- })), d = e.Literal("provider", "tool", "timeout", "cancelled", "decode", "internal"), f = e.Struct({
96
- inputTokens: e.optional(e.Number),
97
- outputTokens: e.optional(e.Number),
98
- totalTokens: e.optional(e.Number)
99
- }), p = e.Union(e.Struct({
100
- _tag: e.Literal("token"),
101
- text: e.String
102
- }), e.Struct({
103
- _tag: e.Literal("reasoning"),
104
- text: e.String
105
- }), e.Struct({
106
- _tag: e.Literal("toolCall"),
107
- id: e.String,
108
- name: e.String,
109
- input: e.Unknown
110
- }), e.Struct({
111
- _tag: e.Literal("toolResult"),
112
- id: e.String,
113
- name: e.String,
114
- output: e.optional(e.Unknown),
115
- error: e.optional(e.String)
116
- }), e.Struct({
117
- _tag: e.Literal("source"),
118
- sourceType: e.Literal("url", "document"),
119
- id: e.String,
120
- url: e.optional(e.String),
121
- title: e.optional(e.String),
122
- mediaType: e.optional(e.String),
123
- filename: e.optional(e.String),
124
- providerMetadata: e.optional(e.Unknown)
125
- }), e.Struct({
126
- _tag: e.Literal("file"),
127
- mediaType: e.String,
128
- data: e.String,
129
- providerMetadata: e.optional(e.Unknown)
130
- }), e.Struct({
131
- _tag: e.Literal("stepMetadata"),
132
- step: e.Int.pipe(e.nonNegative()),
133
- providerMetadata: e.Unknown
134
- }), e.Struct({
135
- _tag: e.Literal("message"),
136
- role: e.String,
137
- content: e.String
138
- }), e.Struct({
139
- _tag: e.Literal("error"),
140
- code: d,
141
- message: e.String,
142
- retryable: e.Boolean
143
- }), e.Struct({
144
- _tag: e.Literal("done"),
145
- finishReason: e.String,
146
- usage: f
147
- })), m = e.Struct({
148
- seq: e.Number,
149
- event: p
150
- });
151
- //#endregion
152
- export { u as a, s as i, p as n, t as o, m as r, i as s, d as t };