fauna-api 0.0.0-stage → 1.0.679

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 (171) hide show
  1. package/dist/brands.d.ts +2 -0
  2. package/dist/brands.js +2 -0
  3. package/dist/index.d.ts +64 -0
  4. package/dist/index.js +121 -0
  5. package/dist/src/ant/chat.d.ts +130 -0
  6. package/dist/src/ant/chat.js +467 -0
  7. package/dist/src/ant/format.d.ts +40 -0
  8. package/dist/src/ant/format.js +143 -0
  9. package/dist/src/ant/graph.d.ts +130 -0
  10. package/dist/src/ant/graph.js +449 -0
  11. package/dist/src/ant/index.d.ts +16 -0
  12. package/dist/src/ant/index.js +61 -0
  13. package/dist/src/ant/persona.d.ts +151 -0
  14. package/dist/src/ant/persona.js +136 -0
  15. package/dist/src/ant/timeline.d.ts +283 -0
  16. package/dist/src/ant/timeline.js +1025 -0
  17. package/dist/src/authentification.d.ts +45 -0
  18. package/dist/src/authentification.js +194 -0
  19. package/dist/src/billing.d.ts +135 -0
  20. package/dist/src/billing.js +128 -0
  21. package/dist/src/calendar.d.ts +83 -0
  22. package/dist/src/calendar.js +133 -0
  23. package/dist/src/chats.d.ts +113 -0
  24. package/dist/src/chats.js +100 -0
  25. package/dist/src/cicada/contacts.d.ts +31 -0
  26. package/dist/src/cicada/contacts.js +28 -0
  27. package/dist/src/cicada/conversations.d.ts +73 -0
  28. package/dist/src/cicada/conversations.js +236 -0
  29. package/dist/src/cicada/inboxes.d.ts +48 -0
  30. package/dist/src/cicada/inboxes.js +82 -0
  31. package/dist/src/cicada/index.d.ts +16 -0
  32. package/dist/src/cicada/index.js +61 -0
  33. package/dist/src/cicada/phone.d.ts +48 -0
  34. package/dist/src/cicada/phone.js +306 -0
  35. package/dist/src/drive.d.ts +80 -0
  36. package/dist/src/drive.js +472 -0
  37. package/dist/src/extensions/index.d.ts +4 -0
  38. package/dist/src/extensions/index.js +5 -0
  39. package/dist/src/extensions/web/index.d.ts +6 -0
  40. package/dist/src/extensions/web/index.js +7 -0
  41. package/dist/src/extensions/web/session.d.ts +108 -0
  42. package/dist/src/extensions/web/session.js +470 -0
  43. package/dist/src/extensions/web/tools.d.ts +13 -0
  44. package/dist/src/extensions/web/tools.js +72 -0
  45. package/dist/src/friends.d.ts +39 -0
  46. package/dist/src/friends.js +119 -0
  47. package/dist/src/groups.d.ts +82 -0
  48. package/dist/src/groups.js +269 -0
  49. package/dist/src/inbox.d.ts +11 -0
  50. package/dist/src/inbox.js +35 -0
  51. package/dist/src/integrations.d.ts +52 -0
  52. package/dist/src/integrations.js +205 -0
  53. package/dist/src/magpie/explorer.d.ts +14 -0
  54. package/dist/src/magpie/explorer.js +36 -0
  55. package/dist/src/magpie/index.d.ts +16 -0
  56. package/dist/src/magpie/index.js +61 -0
  57. package/dist/src/magpie/portfolio.d.ts +52 -0
  58. package/dist/src/magpie/portfolio.js +179 -0
  59. package/dist/src/magpie/quotes.d.ts +35 -0
  60. package/dist/src/magpie/quotes.js +47 -0
  61. package/dist/src/magpie/room.d.ts +61 -0
  62. package/dist/src/magpie/room.js +238 -0
  63. package/dist/src/maps.d.ts +159 -0
  64. package/dist/src/maps.js +171 -0
  65. package/dist/src/marmot/browser.d.ts +139 -0
  66. package/dist/src/marmot/browser.js +389 -0
  67. package/dist/src/marmot/index.d.ts +20 -0
  68. package/dist/src/marmot/index.js +65 -0
  69. package/dist/src/marmot/media.d.ts +56 -0
  70. package/dist/src/marmot/media.js +265 -0
  71. package/dist/src/marmot/research.d.ts +337 -0
  72. package/dist/src/marmot/research.js +1138 -0
  73. package/dist/src/marmot/scraper.d.ts +59 -0
  74. package/dist/src/marmot/scraper.js +94 -0
  75. package/dist/src/marmot/web.d.ts +402 -0
  76. package/dist/src/marmot/web.js +2586 -0
  77. package/dist/src/marmot/workspace.d.ts +81 -0
  78. package/dist/src/marmot/workspace.js +263 -0
  79. package/dist/src/parrot/agent.d.ts +53 -0
  80. package/dist/src/parrot/agent.js +93 -0
  81. package/dist/src/parrot/chat.d.ts +84 -0
  82. package/dist/src/parrot/chat.js +237 -0
  83. package/dist/src/parrot/format.d.ts +128 -0
  84. package/dist/src/parrot/format.js +639 -0
  85. package/dist/src/parrot/generative.d.ts +261 -0
  86. package/dist/src/parrot/generative.js +185 -0
  87. package/dist/src/parrot/index.d.ts +22 -0
  88. package/dist/src/parrot/index.js +67 -0
  89. package/dist/src/parrot/room.d.ts +225 -0
  90. package/dist/src/parrot/room.js +466 -0
  91. package/dist/src/parrot/routing.d.ts +90 -0
  92. package/dist/src/parrot/routing.js +78 -0
  93. package/dist/src/parrot/share.d.ts +126 -0
  94. package/dist/src/parrot/share.js +261 -0
  95. package/dist/src/parrot/socket.d.ts +41 -0
  96. package/dist/src/parrot/socket.js +478 -0
  97. package/dist/src/payments.d.ts +73 -0
  98. package/dist/src/payments.js +107 -0
  99. package/dist/src/private/cards.css +75 -0
  100. package/dist/src/rooms.d.ts +76 -0
  101. package/dist/src/rooms.js +168 -0
  102. package/dist/src/shared/schema.d.ts +24 -0
  103. package/dist/src/shared/schema.js +1 -0
  104. package/dist/src/shared/server.d.ts +65 -0
  105. package/dist/src/shared/server.js +302 -0
  106. package/dist/src/termite/environment.d.ts +110 -0
  107. package/dist/src/termite/environment.js +263 -0
  108. package/dist/src/termite/index.d.ts +14 -0
  109. package/dist/src/termite/index.js +59 -0
  110. package/dist/src/termite/os.d.ts +326 -0
  111. package/dist/src/termite/os.js +572 -0
  112. package/dist/src/termite/versioning.d.ts +94 -0
  113. package/dist/src/termite/versioning.js +217 -0
  114. package/dist/src/tickets.d.ts +43 -0
  115. package/dist/src/tickets.js +138 -0
  116. package/dist/src/travel.d.ts +85 -0
  117. package/dist/src/travel.js +44 -0
  118. package/dist/src/ui/authentification.d.ts +24 -0
  119. package/dist/src/ui/authentification.js +177 -0
  120. package/dist/src/ui/brands.css +11 -0
  121. package/dist/src/ui/brands.d.ts +7 -0
  122. package/dist/src/ui/brands.js +14 -0
  123. package/dist/src/ui/browser.d.ts +74 -0
  124. package/dist/src/ui/browser.js +470 -0
  125. package/dist/src/ui/chat.d.ts +183 -0
  126. package/dist/src/ui/chat.js +2379 -0
  127. package/dist/src/ui/chatPanel.d.ts +109 -0
  128. package/dist/src/ui/chatPanel.js +768 -0
  129. package/dist/src/ui/chatSequence.d.ts +36 -0
  130. package/dist/src/ui/chatSequence.js +42 -0
  131. package/dist/src/ui/crown.d.ts +19 -0
  132. package/dist/src/ui/crown.js +199 -0
  133. package/dist/src/ui/cursor.d.ts +73 -0
  134. package/dist/src/ui/cursor.js +175 -0
  135. package/dist/src/ui/device.d.ts +33 -0
  136. package/dist/src/ui/device.js +49 -0
  137. package/dist/src/ui/drive.d.ts +69 -0
  138. package/dist/src/ui/drive.js +1243 -0
  139. package/dist/src/ui/generative.d.ts +39 -0
  140. package/dist/src/ui/generative.js +313 -0
  141. package/dist/src/ui/hover.d.ts +6 -0
  142. package/dist/src/ui/hover.js +210 -0
  143. package/dist/src/ui/index.d.ts +42 -0
  144. package/dist/src/ui/index.js +87 -0
  145. package/dist/src/ui/integrations.d.ts +13 -0
  146. package/dist/src/ui/integrations.js +175 -0
  147. package/dist/src/ui/maps.d.ts +87 -0
  148. package/dist/src/ui/maps.js +547 -0
  149. package/dist/src/ui/roster.d.ts +32 -0
  150. package/dist/src/ui/roster.js +163 -0
  151. package/dist/src/ui/talk.d.ts +12 -0
  152. package/dist/src/ui/talk.js +560 -0
  153. package/dist/src/ui/tickets.d.ts +13 -0
  154. package/dist/src/ui/tickets.js +966 -0
  155. package/dist/src/ui/toast.d.ts +7 -0
  156. package/dist/src/ui/toast.js +258 -0
  157. package/dist/src/ui/tokenText.d.ts +18 -0
  158. package/dist/src/ui/tokenText.js +96 -0
  159. package/dist/src/ui/tokenized.d.ts +42 -0
  160. package/dist/src/ui/tokenized.js +622 -0
  161. package/dist/src/ui/ui.css +4763 -0
  162. package/dist/src/ui/view.d.ts +23 -0
  163. package/dist/src/ui/view.js +584 -0
  164. package/dist/src/view.d.ts +113 -0
  165. package/dist/src/view.js +386 -0
  166. package/dist/src/webhooks.d.ts +66 -0
  167. package/dist/src/webhooks.js +78 -0
  168. package/dist/ui.d.ts +1 -0
  169. package/dist/ui.js +1 -0
  170. package/package.json +87 -4
  171. package/README.md +0 -3
@@ -0,0 +1,261 @@
1
+ import { Credentials, ApiKey, Profile } from "../authentification.js";
2
+ import type { File as FaunaFile } from "../drive.js";
3
+ import type { Demographic } from "../ant/persona.js";
4
+ import type { Schema } from "../shared/schema.js";
5
+ import type { Group } from "../groups.js";
6
+ export type { Demographic };
7
+ export declare enum Text {
8
+ AUTO = "auto",
9
+ GPT_5_4 = "gpt-5.4",
10
+ GPT_5_4_MINI = "gpt-5.4-mini",
11
+ GPT_5_4_NANO = "gpt-5.4-nano",
12
+ GPT_5_4_PRO = "gpt-5.4-pro",
13
+ GPT_5_5 = "gpt-5.5",
14
+ GPT_5_5_PRO = "gpt-5.5-pro",
15
+ GPT_5_6_SOL = "gpt-5.6-sol",
16
+ GPT_5_6_TERRA = "gpt-5.6-terra",
17
+ GPT_5_6_LUNA = "gpt-5.6-luna",
18
+ CLAUDE_SONNET_4_6 = "claude-sonnet-4-6",
19
+ CLAUDE_SONNET_5 = "claude-sonnet-5",
20
+ CLAUDE_OPUS_4_6 = "claude-opus-4-6",
21
+ CLAUDE_OPUS_4_7 = "claude-opus-4-7",
22
+ CLAUDE_OPUS_4_8 = "claude-opus-4-8",
23
+ CLAUDE_OPUS_5 = "claude-opus-5",
24
+ CLAUDE_FABLE_5 = "claude-fable-5",
25
+ GEMINI_3_1_PRO = "gemini-3.1-pro-preview",
26
+ GEMINI_3_FLASH = "gemini-3-flash-preview",
27
+ GEMINI_3_1_FLASH_LITE = "gemini-3.1-flash-lite",
28
+ GEMINI_3_5_FLASH = "gemini-3.5-flash",
29
+ GROK_4_20_REASONING = "grok-4.20-reasoning-latest",
30
+ GROK_4_20_NON_REASONING = "grok-4.20-non-reasoning-latest",
31
+ GROK_4_3 = "grok-4.3-latest",
32
+ GROK_4_5 = "grok-4.5",
33
+ GROK_4_6 = "grok-4.6",
34
+ GROK_CODE_4_1_FAST = "grok-code-fast-1"
35
+ }
36
+ export declare enum Image {
37
+ GROK_IMAGINE_IMAGE = "grok-imagine-image",
38
+ GROK_IMAGINE_IMAGE_2 = "grok-imagine-image-2.0",
39
+ GROK_IMAGINE_IMAGE_QUALITY = "grok-imagine-image-quality",
40
+ GPT_IMAGE_1_5 = "gpt-image-1.5",
41
+ GPT_IMAGE_1_MINI = "gpt-image-1-mini"
42
+ }
43
+ export declare enum Video {
44
+ GROK_IMAGINE_VIDEO = "grok-imagine-video",
45
+ GROK_IMAGINE_VIDEO_1_5 = "grok-imagine-video-1.5",
46
+ SORA_2 = "sora-2",
47
+ SORA_2_PRO = "sora-2-pro"
48
+ }
49
+ export declare enum Speech {
50
+ GPT_4O_MINI_TTS = "gpt-4o-mini-tts",
51
+ GROK_TTS = "grok-tts",
52
+ ELEVEN_V3 = "eleven_v3",
53
+ ELEVEN_FLASH_V2_5 = "eleven_flash_v2_5"
54
+ }
55
+ export declare enum Transcription {
56
+ GPT_TRANSCRIBE = "gpt-transcribe",
57
+ GROK_STT = "grok-stt",
58
+ SCRIBE_V2 = "scribe_v2"
59
+ }
60
+ export declare enum Embedding {
61
+ TEXT_EMBEDDING_3_SMALL = "text-embedding-3-small",
62
+ TEXT_EMBEDDING_3_LARGE = "text-embedding-3-large",
63
+ GEMINI_EMBEDDING_001 = "gemini-embedding-001",
64
+ GEMINI_EMBEDDING_2_PREVIEW = "gemini-embedding-2-preview",
65
+ VOYAGE_3 = "voyage-3",
66
+ VOYAGE_3_LARGE = "voyage-3-large",
67
+ VOYAGE_3_LITE = "voyage-3-lite",
68
+ VOYAGE_CODE_3 = "voyage-code-3",
69
+ VOYAGE_FINANCE_2 = "voyage-finance-2",
70
+ VOYAGE_LAW_2 = "voyage-law-2"
71
+ }
72
+ export declare enum Voice {
73
+ GPT_REALTIME = "gpt-realtime-2",
74
+ GROK_VOICE = "grok-voice-think-fast-2.0",
75
+ ELEVEN_V3 = "eleven_v3_conversational"
76
+ }
77
+ export declare enum Decision {
78
+ JEV_1_13 = "jev-1.13.0",
79
+ JEV_1_14 = "jev-1.14.0",
80
+ GPT_6_LUNA = "gpt-6-luna"
81
+ }
82
+ export declare enum Role {
83
+ USER = "USER",
84
+ MODEL = "MODEL",
85
+ SYSTEM = "SYSTEM",
86
+ TOOL = "TOOL"
87
+ }
88
+ export type TextPart = {
89
+ type: 'TEXT';
90
+ text: string;
91
+ };
92
+ export type File = {
93
+ type: 'FILE';
94
+ file: FaunaFile;
95
+ };
96
+ export type Invocation = {
97
+ type: 'INVOCATION';
98
+ id?: string;
99
+ args?: Record<string, unknown>;
100
+ name: string;
101
+ status?: 'success' | 'error';
102
+ result?: string;
103
+ };
104
+ export type Result = {
105
+ type: 'RESULT';
106
+ id: string;
107
+ result: string;
108
+ };
109
+ /**
110
+ * A reaction to the message at transcript `position`. It travels as its own
111
+ * USER message; chat UIs fold it onto that message instead of drawing a bubble.
112
+ * `on: false` takes the reaction back; the latest one per person, message and
113
+ * emoji wins.
114
+ */
115
+ export type Reaction = {
116
+ type: 'REACTION';
117
+ emoji: string;
118
+ position: number;
119
+ on: boolean;
120
+ };
121
+ export type Part = TextPart | File | Invocation | Result | Reaction;
122
+ export type Function = {
123
+ name: string;
124
+ parameters: Schema;
125
+ description?: string;
126
+ default?: unknown;
127
+ example?: unknown;
128
+ behavior?: 'BLOCKING' | 'NON_BLOCKING';
129
+ };
130
+ export type Tool = {
131
+ function: Function;
132
+ evaluate: (params: any) => Promise<string>;
133
+ instruction?: (params: any) => string;
134
+ };
135
+ export type Content = {
136
+ parts: Part[];
137
+ role: Role;
138
+ createdAt: Date;
139
+ author?: Profile;
140
+ /** Text model id that produced a MODEL turn (for UI avatar / rehydrate). */
141
+ model?: string;
142
+ /** The name of the API key an agent posted this with, for its author. */
143
+ via?: string;
144
+ };
145
+ export type TextResponse = {
146
+ content: Content;
147
+ usage: {
148
+ promptTokens: number;
149
+ completionTokens: number;
150
+ };
151
+ };
152
+ export type EmbeddingResponse = {
153
+ embedding: number[];
154
+ usage: {
155
+ promptTokens: number;
156
+ };
157
+ };
158
+ export type StreamEvent = {
159
+ event: 'text';
160
+ delta: string;
161
+ } | {
162
+ event: 'tool_call';
163
+ id: string;
164
+ name: string;
165
+ args: Record<string, unknown>;
166
+ server?: boolean;
167
+ } | {
168
+ event: 'done';
169
+ usage: {
170
+ promptTokens: number;
171
+ completionTokens: number;
172
+ };
173
+ } | {
174
+ event: 'error';
175
+ message: string;
176
+ code?: string;
177
+ };
178
+ export type VoiceEvent = {
179
+ event: 'audio';
180
+ delta: Uint8Array;
181
+ contentType: 'audio/pcm';
182
+ } | {
183
+ event: 'input_transcript';
184
+ delta: string;
185
+ } | {
186
+ event: 'output_transcript';
187
+ delta: string;
188
+ } | {
189
+ event: 'tool_call';
190
+ id: string;
191
+ name: string;
192
+ args: Record<string, unknown>;
193
+ } | {
194
+ event: 'speech_started';
195
+ } | {
196
+ event: 'speech_stopped';
197
+ } | {
198
+ event: 'done';
199
+ usage: {
200
+ promptTokens: number;
201
+ completionTokens: number;
202
+ };
203
+ } | {
204
+ event: 'error';
205
+ message: string;
206
+ code?: string;
207
+ };
208
+ export declare function generateText(authorization: Credentials | ApiKey, model: Text, options?: Partial<{
209
+ content: Content[];
210
+ tools: Tool[] | Tool;
211
+ maxTools: number;
212
+ reasoning: string;
213
+ signal: AbortSignal;
214
+ group: Group;
215
+ }>): AsyncGenerator<StreamEvent>;
216
+ export declare function generateTextSync(authorization: Credentials | ApiKey, model: Text, options?: Partial<{
217
+ content: Content[];
218
+ tools: Tool[] | Tool;
219
+ maxTools: number;
220
+ reasoning: string;
221
+ group: Group;
222
+ }>): Promise<TextResponse>;
223
+ export declare function generateEmbedding(authorization: Credentials | ApiKey, model: Embedding, content: string, group?: Group): Promise<EmbeddingResponse>;
224
+ export declare function generateDecision(authorization: Credentials | ApiKey, model: Decision, content: Content[], questions: Record<string, string[]>, group?: Group): Promise<Record<string, Record<string, number>>>;
225
+ export declare function generateImage(authorization: Credentials | ApiKey, model: Image, options?: Partial<{
226
+ content: Content[];
227
+ size: [number, number];
228
+ group: Group;
229
+ }>): Promise<TextResponse>;
230
+ export declare function generateVideo(authorization: Credentials | ApiKey, model: Video, options?: Partial<{
231
+ content: Content[];
232
+ duration: number;
233
+ size: [number, number];
234
+ group: Group;
235
+ }>): Promise<TextResponse>;
236
+ export declare function generateSpeech(authorization: Credentials | ApiKey, model: Speech, options?: Partial<{
237
+ content: Content[];
238
+ voice: Demographic;
239
+ group: Group;
240
+ }>): Promise<TextResponse>;
241
+ export declare function generateTranscription(authorization: Credentials | ApiKey, model: Transcription, options?: Partial<{
242
+ content: Content[];
243
+ group: Group;
244
+ }>): Promise<TextResponse>;
245
+ export declare function generateVoice(authorization: Credentials | ApiKey, model: Voice, options?: Partial<{
246
+ content: Content[];
247
+ audio: AsyncIterable<Uint8Array>;
248
+ tools: Tool[] | Tool;
249
+ maxTools: number;
250
+ voice: Partial<Demographic>;
251
+ signal: AbortSignal;
252
+ group: Group;
253
+ }>): AsyncGenerator<VoiceEvent>;
254
+ export declare function generateVoiceSync(authorization: Credentials | ApiKey, model: Voice, options?: Partial<{
255
+ content: Content[];
256
+ audio: AsyncIterable<Uint8Array>;
257
+ tools: Tool[] | Tool;
258
+ maxTools: number;
259
+ voice: Partial<Demographic>;
260
+ group: Group;
261
+ }>): Promise<TextResponse>;
@@ -0,0 +1,185 @@
1
+ import { Parrot } from "./index.js";
2
+ import { collectText, collectVoice, generateMedia, prepareMessages, streamText, streamVoice } from "./socket.js";
3
+ // Text Clients
4
+ export var Text;
5
+ (function (Text) {
6
+ Text["AUTO"] = "auto";
7
+ // OpenAI
8
+ Text["GPT_5_4"] = "gpt-5.4";
9
+ Text["GPT_5_4_MINI"] = "gpt-5.4-mini";
10
+ Text["GPT_5_4_NANO"] = "gpt-5.4-nano";
11
+ Text["GPT_5_4_PRO"] = "gpt-5.4-pro";
12
+ Text["GPT_5_5"] = "gpt-5.5";
13
+ Text["GPT_5_5_PRO"] = "gpt-5.5-pro";
14
+ Text["GPT_5_6_SOL"] = "gpt-5.6-sol";
15
+ Text["GPT_5_6_TERRA"] = "gpt-5.6-terra";
16
+ Text["GPT_5_6_LUNA"] = "gpt-5.6-luna";
17
+ // Anthropic
18
+ Text["CLAUDE_SONNET_4_6"] = "claude-sonnet-4-6";
19
+ Text["CLAUDE_SONNET_5"] = "claude-sonnet-5";
20
+ Text["CLAUDE_OPUS_4_6"] = "claude-opus-4-6";
21
+ Text["CLAUDE_OPUS_4_7"] = "claude-opus-4-7";
22
+ Text["CLAUDE_OPUS_4_8"] = "claude-opus-4-8";
23
+ Text["CLAUDE_OPUS_5"] = "claude-opus-5";
24
+ Text["CLAUDE_FABLE_5"] = "claude-fable-5";
25
+ // Google (Pro and 3-Flash are still preview-only, hence the -preview suffix;
26
+ // 3.5-flash and 3.1-flash-lite are GA and use bare IDs)
27
+ Text["GEMINI_3_1_PRO"] = "gemini-3.1-pro-preview";
28
+ Text["GEMINI_3_FLASH"] = "gemini-3-flash-preview";
29
+ Text["GEMINI_3_1_FLASH_LITE"] = "gemini-3.1-flash-lite";
30
+ Text["GEMINI_3_5_FLASH"] = "gemini-3.5-flash";
31
+ // Grok
32
+ Text["GROK_4_20_REASONING"] = "grok-4.20-reasoning-latest";
33
+ Text["GROK_4_20_NON_REASONING"] = "grok-4.20-non-reasoning-latest";
34
+ Text["GROK_4_3"] = "grok-4.3-latest";
35
+ Text["GROK_4_5"] = "grok-4.5";
36
+ Text["GROK_4_6"] = "grok-4.6";
37
+ Text["GROK_CODE_4_1_FAST"] = "grok-code-fast-1";
38
+ })(Text || (Text = {}));
39
+ export var Image;
40
+ (function (Image) {
41
+ Image["GROK_IMAGINE_IMAGE"] = "grok-imagine-image";
42
+ Image["GROK_IMAGINE_IMAGE_2"] = "grok-imagine-image-2.0";
43
+ Image["GROK_IMAGINE_IMAGE_QUALITY"] = "grok-imagine-image-quality";
44
+ Image["GPT_IMAGE_1_5"] = "gpt-image-1.5";
45
+ Image["GPT_IMAGE_1_MINI"] = "gpt-image-1-mini";
46
+ })(Image || (Image = {}));
47
+ export var Video;
48
+ (function (Video) {
49
+ // Grok
50
+ Video["GROK_IMAGINE_VIDEO"] = "grok-imagine-video";
51
+ Video["GROK_IMAGINE_VIDEO_1_5"] = "grok-imagine-video-1.5";
52
+ // OpenAI
53
+ Video["SORA_2"] = "sora-2";
54
+ Video["SORA_2_PRO"] = "sora-2-pro";
55
+ })(Video || (Video = {}));
56
+ export var Speech;
57
+ (function (Speech) {
58
+ // OpenAI
59
+ Speech["GPT_4O_MINI_TTS"] = "gpt-4o-mini-tts";
60
+ // xAI
61
+ Speech["GROK_TTS"] = "grok-tts";
62
+ // ElevenLabs
63
+ Speech["ELEVEN_V3"] = "eleven_v3";
64
+ Speech["ELEVEN_FLASH_V2_5"] = "eleven_flash_v2_5";
65
+ })(Speech || (Speech = {}));
66
+ export var Transcription;
67
+ (function (Transcription) {
68
+ // OpenAI
69
+ Transcription["GPT_TRANSCRIBE"] = "gpt-transcribe";
70
+ // xAI
71
+ Transcription["GROK_STT"] = "grok-stt";
72
+ // ElevenLabs
73
+ Transcription["SCRIBE_V2"] = "scribe_v2";
74
+ })(Transcription || (Transcription = {}));
75
+ // Embedding Clients
76
+ export var Embedding;
77
+ (function (Embedding) {
78
+ // OpenAI
79
+ Embedding["TEXT_EMBEDDING_3_SMALL"] = "text-embedding-3-small";
80
+ Embedding["TEXT_EMBEDDING_3_LARGE"] = "text-embedding-3-large";
81
+ // Google
82
+ Embedding["GEMINI_EMBEDDING_001"] = "gemini-embedding-001";
83
+ Embedding["GEMINI_EMBEDDING_2_PREVIEW"] = "gemini-embedding-2-preview";
84
+ // Voyage
85
+ Embedding["VOYAGE_3"] = "voyage-3";
86
+ Embedding["VOYAGE_3_LARGE"] = "voyage-3-large";
87
+ Embedding["VOYAGE_3_LITE"] = "voyage-3-lite";
88
+ Embedding["VOYAGE_CODE_3"] = "voyage-code-3";
89
+ Embedding["VOYAGE_FINANCE_2"] = "voyage-finance-2";
90
+ Embedding["VOYAGE_LAW_2"] = "voyage-law-2";
91
+ })(Embedding || (Embedding = {}));
92
+ export var Voice;
93
+ (function (Voice) {
94
+ Voice["GPT_REALTIME"] = "gpt-realtime-2";
95
+ Voice["GROK_VOICE"] = "grok-voice-think-fast-2.0";
96
+ Voice["ELEVEN_V3"] = "eleven_v3_conversational";
97
+ })(Voice || (Voice = {}));
98
+ export var Decision;
99
+ (function (Decision) {
100
+ // TypeSafe
101
+ Decision["JEV_1_13"] = "jev-1.13.0";
102
+ Decision["JEV_1_14"] = "jev-1.14.0";
103
+ // OpenAI
104
+ Decision["GPT_6_LUNA"] = "gpt-6-luna";
105
+ })(Decision || (Decision = {}));
106
+ // Roles
107
+ export var Role;
108
+ (function (Role) {
109
+ Role["USER"] = "USER";
110
+ Role["MODEL"] = "MODEL";
111
+ Role["SYSTEM"] = "SYSTEM";
112
+ Role["TOOL"] = "TOOL";
113
+ })(Role || (Role = {}));
114
+ // Streaming Text Generation. A singular Tool forces it; an array lets the model choose.
115
+ export async function* generateText(authorization, model, options = {}) {
116
+ yield* streamText(authorization, '/generative/text', model, options);
117
+ }
118
+ // Synchronous wrapper — buffers the stream and returns full TextResponse
119
+ export async function generateTextSync(authorization, model, options = {}) {
120
+ return collectText(generateText(authorization, model, options));
121
+ }
122
+ // Embedding (stays HTTP). With `group`, the group pays.
123
+ export async function generateEmbedding(authorization, model, content, group) {
124
+ const response = await fetch(`${Parrot.getURL()}/generative/embed`, {
125
+ method: "POST",
126
+ headers: {
127
+ "Content-Type": "application/json",
128
+ "Authorization": 'email' in authorization ? `Token ${authorization.token}` : `ApiKey ${authorization.id}`,
129
+ ...(group ? { "Group": group.id } : {})
130
+ },
131
+ body: JSON.stringify({
132
+ model: model,
133
+ content: content
134
+ })
135
+ });
136
+ if (!response.ok) {
137
+ throw new Error(`Failed to generate embedding: ${response.statusText}`);
138
+ }
139
+ return await response.json();
140
+ }
141
+ // Decision (stays HTTP). Each question lists its options; every option comes back
142
+ // with its probability. A question the model declines is left out. With `group`,
143
+ // the group pays.
144
+ export async function generateDecision(authorization, model, content, questions, group) {
145
+ const response = await fetch(`${Parrot.getURL()}/generative/decision`, {
146
+ method: "POST",
147
+ headers: {
148
+ "Content-Type": "application/json",
149
+ "Authorization": 'email' in authorization ? `Token ${authorization.token}` : `ApiKey ${authorization.id}`,
150
+ ...(group ? { "Group": group.id } : {})
151
+ },
152
+ body: JSON.stringify({
153
+ model: model,
154
+ messages: await prepareMessages(authorization, content),
155
+ questions: questions
156
+ })
157
+ });
158
+ if (!response.ok) {
159
+ throw new Error(await response.text());
160
+ }
161
+ return await response.json();
162
+ }
163
+ // Image Generation
164
+ export async function generateImage(authorization, model, options = {}) {
165
+ return generateMedia(authorization, '/generative/image', model, options, 'image/png');
166
+ }
167
+ // Video Generation
168
+ export async function generateVideo(authorization, model, options = {}) {
169
+ return generateMedia(authorization, '/generative/video', model, options, 'video/mp4');
170
+ }
171
+ // Speech Generation
172
+ export async function generateSpeech(authorization, model, options = {}) {
173
+ return generateMedia(authorization, '/generative/speech', model, options, 'audio/mpeg');
174
+ }
175
+ // Transcription Generation
176
+ export async function generateTranscription(authorization, model, options = {}) {
177
+ return generateMedia(authorization, '/generative/transcription', model, options, 'application/octet-stream');
178
+ }
179
+ // Streaming Voice Generation
180
+ export async function* generateVoice(authorization, model, options = {}) {
181
+ yield* streamVoice(authorization, '/generative/voice', model, options);
182
+ }
183
+ export async function generateVoiceSync(authorization, model, options = {}) {
184
+ return collectVoice(authorization, generateVoice(authorization, model, options));
185
+ }
@@ -0,0 +1,22 @@
1
+ import * as GenerativeAPI from "./generative.js";
2
+ import * as RoutingAPI from "./routing.js";
3
+ import * as FormatAPI from "./format.js";
4
+ import * as ChatAPI from "./chat.js";
5
+ import * as AgentAPI from "./agent.js";
6
+ import * as ShareAPI from "./share.js";
7
+ import * as RoomAPI from "./room.js";
8
+ export declare namespace Parrot {
9
+ function setRoute(route: string): void;
10
+ function getIP(): string;
11
+ function getPort(): number;
12
+ function getRoute(): string;
13
+ function getURL(): string;
14
+ function ping(): Promise<number>;
15
+ export import Generative = GenerativeAPI;
16
+ export import Routing = RoutingAPI;
17
+ export import Format = FormatAPI;
18
+ export import Chat = ChatAPI;
19
+ export import Agent = AgentAPI;
20
+ export import Share = ShareAPI;
21
+ export import Room = RoomAPI;
22
+ }
@@ -0,0 +1,67 @@
1
+ import * as GenerativeAPI from "./generative.js";
2
+ import * as RoutingAPI from "./routing.js";
3
+ import * as FormatAPI from "./format.js";
4
+ import * as ChatAPI from "./chat.js";
5
+ import * as AgentAPI from "./agent.js";
6
+ import * as ShareAPI from "./share.js";
7
+ import * as RoomAPI from "./room.js";
8
+ export var Parrot;
9
+ (function (Parrot) {
10
+ var PREFIX = 'https://';
11
+ var IP = 'api.faunakit.com';
12
+ var PORT = 443;
13
+ function setRoute(route) {
14
+ const parts_0 = route.split('//');
15
+ if (parts_0.length > 1) {
16
+ PREFIX = parts_0[0] + '//';
17
+ const parts_1 = parts_0[1].split(':');
18
+ if (parts_1.length > 1) {
19
+ IP = parts_1[0];
20
+ PORT = Number(parts_1[1]);
21
+ }
22
+ else {
23
+ IP = parts_1[0];
24
+ }
25
+ }
26
+ else {
27
+ const parts_1 = parts_0[0].split(':');
28
+ if (parts_1.length > 1) {
29
+ IP = parts_1[0];
30
+ PORT = Number(parts_1[1]);
31
+ }
32
+ else {
33
+ IP = parts_1[0];
34
+ }
35
+ }
36
+ }
37
+ Parrot.setRoute = setRoute;
38
+ function getIP() {
39
+ return IP;
40
+ }
41
+ Parrot.getIP = getIP;
42
+ function getPort() {
43
+ return PORT;
44
+ }
45
+ Parrot.getPort = getPort;
46
+ function getRoute() {
47
+ return IP + ':' + PORT;
48
+ }
49
+ Parrot.getRoute = getRoute;
50
+ function getURL() {
51
+ return PREFIX + IP + ':' + PORT;
52
+ }
53
+ Parrot.getURL = getURL;
54
+ async function ping() {
55
+ const start = Date.now();
56
+ await fetch(`${getURL()}/`);
57
+ return Date.now() - start;
58
+ }
59
+ Parrot.ping = ping;
60
+ Parrot.Generative = GenerativeAPI;
61
+ Parrot.Routing = RoutingAPI;
62
+ Parrot.Format = FormatAPI;
63
+ Parrot.Chat = ChatAPI;
64
+ Parrot.Agent = AgentAPI;
65
+ Parrot.Share = ShareAPI;
66
+ Parrot.Room = RoomAPI;
67
+ })(Parrot || (Parrot = {}));