@fastpaca/cria 0.0.1 → 1.0.1

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 (140) hide show
  1. package/README.md +93 -106
  2. package/dist/ai-sdk/index.d.ts +43 -0
  3. package/dist/ai-sdk/index.d.ts.map +1 -0
  4. package/dist/ai-sdk/index.js +303 -0
  5. package/dist/ai-sdk/index.js.map +1 -0
  6. package/dist/ai-sdk/index.test.d.ts +2 -0
  7. package/dist/ai-sdk/index.test.d.ts.map +1 -0
  8. package/dist/ai-sdk/index.test.js +101 -0
  9. package/dist/ai-sdk/index.test.js.map +1 -0
  10. package/dist/anthropic/index.d.ts +74 -0
  11. package/dist/anthropic/index.d.ts.map +1 -0
  12. package/dist/anthropic/index.js +238 -0
  13. package/dist/anthropic/index.js.map +1 -0
  14. package/dist/anthropic/index.test.d.ts +2 -0
  15. package/dist/anthropic/index.test.d.ts.map +1 -0
  16. package/dist/anthropic/index.test.js +115 -0
  17. package/dist/anthropic/index.test.js.map +1 -0
  18. package/dist/components/additional.test.d.ts +2 -0
  19. package/dist/components/additional.test.d.ts.map +1 -0
  20. package/dist/components/additional.test.js +31 -0
  21. package/dist/components/additional.test.js.map +1 -0
  22. package/dist/components/index.d.ts +148 -0
  23. package/dist/components/index.d.ts.map +1 -0
  24. package/dist/components/index.js +184 -0
  25. package/dist/components/index.js.map +1 -0
  26. package/dist/components/summary.d.ts +91 -0
  27. package/dist/components/summary.d.ts.map +1 -0
  28. package/dist/components/summary.js +118 -0
  29. package/dist/components/summary.js.map +1 -0
  30. package/dist/components/summary.test.d.ts +2 -0
  31. package/dist/components/summary.test.d.ts.map +1 -0
  32. package/dist/components/summary.test.js +101 -0
  33. package/dist/components/summary.test.js.map +1 -0
  34. package/dist/components/vector-search.d.ts +70 -0
  35. package/dist/components/vector-search.d.ts.map +1 -0
  36. package/dist/components/vector-search.js +110 -0
  37. package/dist/components/vector-search.js.map +1 -0
  38. package/dist/components/vector-search.test.d.ts +2 -0
  39. package/dist/components/vector-search.test.d.ts.map +1 -0
  40. package/dist/components/vector-search.test.js +113 -0
  41. package/dist/components/vector-search.test.js.map +1 -0
  42. package/dist/index.d.ts +12 -5
  43. package/dist/index.d.ts.map +1 -1
  44. package/dist/index.js +9 -5
  45. package/dist/index.js.map +1 -1
  46. package/dist/instrumentation/otel.d.ts +19 -0
  47. package/dist/instrumentation/otel.d.ts.map +1 -0
  48. package/dist/instrumentation/otel.js +102 -0
  49. package/dist/instrumentation/otel.js.map +1 -0
  50. package/dist/instrumentation/otel.test.d.ts +2 -0
  51. package/dist/instrumentation/otel.test.d.ts.map +1 -0
  52. package/dist/instrumentation/otel.test.js +116 -0
  53. package/dist/instrumentation/otel.test.js.map +1 -0
  54. package/dist/jsx-dev-runtime.d.ts +2 -0
  55. package/dist/jsx-dev-runtime.d.ts.map +1 -0
  56. package/dist/jsx-dev-runtime.js +2 -0
  57. package/dist/jsx-dev-runtime.js.map +1 -0
  58. package/dist/jsx-runtime.d.ts +30 -8
  59. package/dist/jsx-runtime.d.ts.map +1 -1
  60. package/dist/jsx-runtime.js +13 -10
  61. package/dist/jsx-runtime.js.map +1 -1
  62. package/dist/memory/chroma/index.d.ts +59 -0
  63. package/dist/memory/chroma/index.d.ts.map +1 -0
  64. package/dist/memory/chroma/index.js +172 -0
  65. package/dist/memory/chroma/index.js.map +1 -0
  66. package/dist/memory/index.d.ts +4 -0
  67. package/dist/memory/index.d.ts.map +1 -0
  68. package/dist/memory/index.js +2 -0
  69. package/dist/memory/index.js.map +1 -0
  70. package/dist/memory/key-value.d.ts +71 -0
  71. package/dist/memory/key-value.d.ts.map +1 -0
  72. package/dist/memory/key-value.js +34 -0
  73. package/dist/memory/key-value.js.map +1 -0
  74. package/dist/memory/postgres.d.ts +71 -0
  75. package/dist/memory/postgres.d.ts.map +1 -0
  76. package/dist/memory/postgres.js +109 -0
  77. package/dist/memory/postgres.js.map +1 -0
  78. package/dist/memory/qdrant/index.d.ts +64 -0
  79. package/dist/memory/qdrant/index.d.ts.map +1 -0
  80. package/dist/memory/qdrant/index.js +136 -0
  81. package/dist/memory/qdrant/index.js.map +1 -0
  82. package/dist/memory/redis.d.ts +70 -0
  83. package/dist/memory/redis.d.ts.map +1 -0
  84. package/dist/memory/redis.js +100 -0
  85. package/dist/memory/redis.js.map +1 -0
  86. package/dist/memory/vector.d.ts +53 -0
  87. package/dist/memory/vector.d.ts.map +1 -0
  88. package/dist/memory/vector.js +2 -0
  89. package/dist/memory/vector.js.map +1 -0
  90. package/dist/openai/index.d.ts +46 -0
  91. package/dist/openai/index.d.ts.map +1 -0
  92. package/dist/openai/index.js +260 -0
  93. package/dist/openai/index.js.map +1 -0
  94. package/dist/openai/index.test.d.ts +2 -0
  95. package/dist/openai/index.test.d.ts.map +1 -0
  96. package/dist/openai/index.test.js +204 -0
  97. package/dist/openai/index.test.js.map +1 -0
  98. package/dist/providers/index.d.ts +2 -0
  99. package/dist/providers/index.d.ts.map +1 -0
  100. package/dist/providers/index.js +2 -0
  101. package/dist/providers/index.js.map +1 -0
  102. package/dist/providers/types.d.ts +2 -0
  103. package/dist/providers/types.d.ts.map +1 -0
  104. package/dist/providers/types.js +2 -0
  105. package/dist/providers/types.js.map +1 -0
  106. package/dist/render.d.ts +44 -40
  107. package/dist/render.d.ts.map +1 -1
  108. package/dist/render.js +162 -148
  109. package/dist/render.js.map +1 -1
  110. package/dist/render.test.js +146 -28
  111. package/dist/render.test.js.map +1 -1
  112. package/dist/renderers/markdown.d.ts +3 -0
  113. package/dist/renderers/markdown.d.ts.map +1 -0
  114. package/dist/renderers/markdown.js +43 -0
  115. package/dist/renderers/markdown.js.map +1 -0
  116. package/dist/renderers/shared.d.ts +82 -0
  117. package/dist/renderers/shared.d.ts.map +1 -0
  118. package/dist/renderers/shared.js +156 -0
  119. package/dist/renderers/shared.js.map +1 -0
  120. package/dist/snapshot.d.ts +47 -0
  121. package/dist/snapshot.d.ts.map +1 -0
  122. package/dist/snapshot.js +140 -0
  123. package/dist/snapshot.js.map +1 -0
  124. package/dist/snapshot.test.d.ts +2 -0
  125. package/dist/snapshot.test.d.ts.map +1 -0
  126. package/dist/snapshot.test.js +68 -0
  127. package/dist/snapshot.test.js.map +1 -0
  128. package/dist/tokenizers.d.ts +14 -0
  129. package/dist/tokenizers.d.ts.map +1 -0
  130. package/dist/tokenizers.js +45 -0
  131. package/dist/tokenizers.js.map +1 -0
  132. package/dist/types.d.ts +212 -84
  133. package/dist/types.d.ts.map +1 -1
  134. package/dist/types.js +109 -0
  135. package/dist/types.js.map +1 -1
  136. package/package.json +88 -3
  137. package/dist/components.d.ts +0 -78
  138. package/dist/components.d.ts.map +0 -1
  139. package/dist/components.js +0 -98
  140. package/dist/components.js.map +0 -1
@@ -0,0 +1,46 @@
1
+ import type OpenAI from "openai";
2
+ import type { ChatCompletionMessageParam } from "openai/resources/chat/completions";
3
+ import type { ResponseInputItem } from "openai/resources/responses/responses";
4
+ import type { Child } from "../jsx-runtime";
5
+ import type { PromptElement, PromptRenderer, Tokenizer } from "../types";
6
+ /**
7
+ * Renderer that outputs ChatCompletionMessageParam[] for the OpenAI Chat Completions API.
8
+ * Pass this to render() to get messages compatible with client.chat.completions.create().
9
+ *
10
+ * @example
11
+ * ```ts
12
+ * import { render } from "@fastpaca/cria";
13
+ * import { chatCompletions } from "@fastpaca/cria/openai";
14
+ *
15
+ * const messages = await render(prompt, { tokenizer, budget, renderer: chatCompletions });
16
+ * const response = await openai.chat.completions.create({ model: "gpt-4", messages });
17
+ * ```
18
+ */
19
+ export declare const chatCompletions: PromptRenderer<ChatCompletionMessageParam[]>;
20
+ /**
21
+ * Renderer that outputs ResponseInputItem[] for the OpenAI Responses API.
22
+ * Use this with reasoning models that support native reasoning.
23
+ *
24
+ * @example
25
+ * ```ts
26
+ * import { render } from "@fastpaca/cria";
27
+ * import { responses } from "@fastpaca/cria/openai";
28
+ *
29
+ * const input = await render(prompt, { tokenizer, budget, renderer: responses });
30
+ * const response = await openai.responses.create({ model: "o3", input });
31
+ * ```
32
+ */
33
+ export declare const responses: PromptRenderer<ResponseInputItem[]>;
34
+ interface OpenAIProviderProps {
35
+ /** OpenAI client instance */
36
+ client: OpenAI;
37
+ /** Model to use (e.g. "gpt-4o", "gpt-4o-mini") */
38
+ model: string;
39
+ /** Optional tokenizer to use for budgeting; defaults to a tiktoken-based tokenizer */
40
+ tokenizer?: Tokenizer;
41
+ /** Child components that will have access to this provider */
42
+ children?: Child;
43
+ }
44
+ export declare function OpenAIProvider({ client, model, tokenizer, children, }: OpenAIProviderProps): PromptElement;
45
+ export {};
46
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/openai/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AACjC,OAAO,KAAK,EAEV,0BAA0B,EAK3B,MAAM,mCAAmC,CAAC;AAC3C,OAAO,KAAK,EAEV,iBAAiB,EAElB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAY5C,OAAO,KAAK,EAKV,aAAa,EACb,cAAc,EACd,SAAS,EACV,MAAM,UAAU,CAAC;AAElB;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,eAAe,EAAE,cAAc,CAAC,0BAA0B,EAAE,CAKxE,CAAC;AAiHF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,SAAS,EAAE,cAAc,CAAC,iBAAiB,EAAE,CAKzD,CAAC;AA4IF,UAAU,mBAAmB;IAC3B,6BAA6B;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,kDAAkD;IAClD,KAAK,EAAE,MAAM,CAAC;IACd,sFAAsF;IACtF,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,8DAA8D;IAC9D,QAAQ,CAAC,EAAE,KAAK,CAAC;CAClB;AA8BD,wBAAgB,cAAc,CAAC,EAC7B,MAAM,EACN,KAAK,EACL,SAAS,EACT,QAAa,GACd,EAAE,mBAAmB,GAAG,aAAa,CA8BrC"}
@@ -0,0 +1,260 @@
1
+ import { markdownRenderer } from "../renderers/markdown";
2
+ import { coalesceTextParts, collectMessageNodes, collectSemanticParts, partsToText, safeStringify, } from "../renderers/shared";
3
+ import { tiktokenTokenizer } from "../tokenizers";
4
+ /**
5
+ * Renderer that outputs ChatCompletionMessageParam[] for the OpenAI Chat Completions API.
6
+ * Pass this to render() to get messages compatible with client.chat.completions.create().
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * import { render } from "@fastpaca/cria";
11
+ * import { chatCompletions } from "@fastpaca/cria/openai";
12
+ *
13
+ * const messages = await render(prompt, { tokenizer, budget, renderer: chatCompletions });
14
+ * const response = await openai.chat.completions.create({ model: "gpt-4", messages });
15
+ * ```
16
+ */
17
+ export const chatCompletions = {
18
+ name: "openai-chat-completions",
19
+ tokenString: markdownRenderer.tokenString,
20
+ render: (element) => renderToChatCompletions(element),
21
+ empty: () => [],
22
+ };
23
+ function renderToChatCompletions(root) {
24
+ const messageNodes = collectMessageNodes(root);
25
+ const result = [];
26
+ for (const messageNode of messageNodes) {
27
+ result.push(...messageNodeToParams(messageNode));
28
+ }
29
+ return result;
30
+ }
31
+ function messageNodeToParams(messageNode) {
32
+ const parts = coalesceTextParts(collectSemanticParts(messageNode.children));
33
+ if (messageNode.role === "system") {
34
+ return [toSystemMessage(parts)];
35
+ }
36
+ if (messageNode.role === "user") {
37
+ return [toUserMessage(parts)];
38
+ }
39
+ // Assistant message: may contain tool calls, and tool results become separate messages
40
+ // Preserve original part ordering - only separate out tool results
41
+ const assistantParts = parts.filter((p) => p.type !== "tool-result");
42
+ const toolResultParts = parts.filter((p) => p.type === "tool-result");
43
+ const result = [];
44
+ if (assistantParts.length > 0 || toolResultParts.length === 0) {
45
+ result.push(toAssistantMessage(assistantParts));
46
+ }
47
+ for (const toolResult of toolResultParts) {
48
+ result.push(toToolMessage(toolResult));
49
+ }
50
+ return result;
51
+ }
52
+ function toSystemMessage(parts) {
53
+ return {
54
+ role: "system",
55
+ content: partsToText(parts, { wrapReasoning: true }),
56
+ };
57
+ }
58
+ function toUserMessage(parts) {
59
+ return {
60
+ role: "user",
61
+ content: partsToText(parts, { wrapReasoning: true }),
62
+ };
63
+ }
64
+ function toAssistantMessage(parts) {
65
+ const textContent = partsToText(parts, { wrapReasoning: true });
66
+ const toolCalls = parts
67
+ .filter((part) => part.type === "tool-call")
68
+ .map((part) => ({
69
+ id: part.toolCallId,
70
+ type: "function",
71
+ function: {
72
+ name: part.toolName,
73
+ arguments: safeStringify(part.input),
74
+ },
75
+ }));
76
+ const result = {
77
+ role: "assistant",
78
+ };
79
+ if (textContent.length > 0) {
80
+ result.content = textContent;
81
+ }
82
+ if (toolCalls.length > 0) {
83
+ result.tool_calls = toolCalls;
84
+ }
85
+ return result;
86
+ }
87
+ function toToolMessage(part) {
88
+ return {
89
+ role: "tool",
90
+ tool_call_id: part.toolCallId,
91
+ content: safeStringify(part.output),
92
+ };
93
+ }
94
+ // ============================================================================
95
+ // Responses API Renderer (for reasoning models)
96
+ // ============================================================================
97
+ /**
98
+ * Renderer that outputs ResponseInputItem[] for the OpenAI Responses API.
99
+ * Use this with reasoning models that support native reasoning.
100
+ *
101
+ * @example
102
+ * ```ts
103
+ * import { render } from "@fastpaca/cria";
104
+ * import { responses } from "@fastpaca/cria/openai";
105
+ *
106
+ * const input = await render(prompt, { tokenizer, budget, renderer: responses });
107
+ * const response = await openai.responses.create({ model: "o3", input });
108
+ * ```
109
+ */
110
+ export const responses = {
111
+ name: "openai-responses",
112
+ tokenString: markdownRenderer.tokenString,
113
+ render: (element) => renderToResponses(element),
114
+ empty: () => [],
115
+ };
116
+ function renderToResponses(root) {
117
+ const result = [];
118
+ collectResponseItems(root, result);
119
+ return result;
120
+ }
121
+ /**
122
+ * Convert a message element's parts into ResponseInputItems.
123
+ * Handles text, reasoning, tool calls, and tool results.
124
+ */
125
+ function collectMessageResponseItems(element, acc) {
126
+ const parts = coalesceTextParts(collectSemanticParts(element.children));
127
+ const role = mapRoleForResponses(element.role);
128
+ let textBuffer = "";
129
+ let reasoningIndex = 0;
130
+ const flushTextBuffer = () => {
131
+ if (textBuffer.length > 0) {
132
+ acc.push({ role, content: textBuffer });
133
+ textBuffer = "";
134
+ }
135
+ };
136
+ for (const part of parts) {
137
+ switch (part.type) {
138
+ case "text":
139
+ textBuffer += part.text;
140
+ break;
141
+ case "reasoning": {
142
+ flushTextBuffer();
143
+ acc.push({
144
+ id: element.id
145
+ ? `${element.id}-reasoning-${reasoningIndex}`
146
+ : `reasoning_${reasoningIndex}`,
147
+ type: "reasoning",
148
+ summary: [{ type: "summary_text", text: part.text }],
149
+ });
150
+ reasoningIndex += 1;
151
+ break;
152
+ }
153
+ case "tool-call":
154
+ flushTextBuffer();
155
+ acc.push({
156
+ type: "function_call",
157
+ call_id: part.toolCallId,
158
+ name: part.toolName,
159
+ arguments: safeStringify(part.input),
160
+ });
161
+ break;
162
+ case "tool-result":
163
+ flushTextBuffer();
164
+ acc.push({
165
+ type: "function_call_output",
166
+ call_id: part.toolCallId,
167
+ output: safeStringify(part.output),
168
+ });
169
+ break;
170
+ default:
171
+ // Exhaustive check - all SemanticPart types handled above
172
+ break;
173
+ }
174
+ }
175
+ flushTextBuffer();
176
+ }
177
+ function collectResponseItems(element, acc) {
178
+ switch (element.kind) {
179
+ case "message": {
180
+ collectMessageResponseItems(element, acc);
181
+ break;
182
+ }
183
+ case "reasoning": {
184
+ // Native reasoning support in Responses API
185
+ if (element.text.length > 0) {
186
+ const reasoningItem = {
187
+ id: element.id ?? `rs_${Date.now()}`,
188
+ type: "reasoning",
189
+ summary: [{ type: "summary_text", text: element.text }],
190
+ };
191
+ acc.push(reasoningItem);
192
+ }
193
+ break;
194
+ }
195
+ case "tool-call": {
196
+ const toolCall = {
197
+ type: "function_call",
198
+ call_id: element.toolCallId,
199
+ name: element.toolName,
200
+ arguments: safeStringify(element.input),
201
+ };
202
+ acc.push(toolCall);
203
+ break;
204
+ }
205
+ case "tool-result": {
206
+ const toolResult = {
207
+ type: "function_call_output",
208
+ call_id: element.toolCallId,
209
+ output: safeStringify(element.output),
210
+ };
211
+ acc.push(toolResult);
212
+ break;
213
+ }
214
+ default: {
215
+ // Recurse into children for regions without semantic kind
216
+ for (const child of element.children) {
217
+ if (typeof child !== "string") {
218
+ collectResponseItems(child, acc);
219
+ }
220
+ }
221
+ }
222
+ }
223
+ }
224
+ const RESPONSE_ROLE_MAP = {
225
+ system: "system",
226
+ developer: "developer",
227
+ user: "user",
228
+ };
229
+ function mapRoleForResponses(role) {
230
+ return RESPONSE_ROLE_MAP[role] ?? "assistant";
231
+ }
232
+ const VALID_OPENAI_ROLES = new Set(["user", "assistant", "system"]);
233
+ export function OpenAIProvider({ client, model, tokenizer, children = [], }) {
234
+ const provider = {
235
+ name: "openai",
236
+ tokenizer: tokenizer ?? tiktokenTokenizer(model),
237
+ async completion(request) {
238
+ const messages = request.system
239
+ ? [{ role: "system", content: request.system }]
240
+ : [];
241
+ for (const msg of request.messages) {
242
+ if (VALID_OPENAI_ROLES.has(msg.role)) {
243
+ messages.push({ role: msg.role, content: msg.content });
244
+ }
245
+ }
246
+ const response = await client.chat.completions.create({
247
+ model,
248
+ messages,
249
+ });
250
+ const text = response.choices[0]?.message?.content ?? "";
251
+ return { text };
252
+ },
253
+ };
254
+ return {
255
+ priority: 0,
256
+ children: children,
257
+ context: { provider },
258
+ };
259
+ }
260
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/openai/index.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,oBAAoB,EACpB,WAAW,EAEX,aAAa,GAEd,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC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,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,GAAG,CAAC,IAAkB,EAAE,OAAO,EAAE,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;gBACxE,CAAC;YACH,CAAC;YAED,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC;gBACpD,KAAK;gBACL,QAAQ;aACT,CAAC,CAAC;YAEH,MAAM,IAAI,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,IAAI,EAAE,CAAC;YACzD,OAAO,EAAE,IAAI,EAAE,CAAC;QAClB,CAAC;KACF,CAAC;IAEF,OAAO;QACL,QAAQ,EAAE,CAAC;QACX,QAAQ,EAAE,QAA0B;QACpC,OAAO,EAAE,EAAE,QAAQ,EAAE;KACtB,CAAC;AACJ,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../../src/openai/index.test.tsx"],"names":[],"mappings":""}
@@ -0,0 +1,204 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "@fastpaca/cria/jsx-runtime";
2
+ import { expect, test } from "vitest";
3
+ import { Message, Reasoning, Region, ToolCall, ToolResult, } from "../components";
4
+ import { render } from "../render";
5
+ import { chatCompletions, responses } from "./index";
6
+ const tokenizer = (text) => Math.ceil(text.length / 4);
7
+ test("chatCompletions: renders system message", async () => {
8
+ const prompt = (_jsx(Region, { priority: 0, children: _jsx(Message, { messageRole: "system", children: "You are a helpful assistant." }) }));
9
+ const messages = await render(prompt, {
10
+ tokenizer,
11
+ budget: 10_000,
12
+ renderer: chatCompletions,
13
+ });
14
+ expect(messages).toHaveLength(1);
15
+ expect(messages[0]).toEqual({
16
+ role: "system",
17
+ content: "You are a helpful assistant.",
18
+ });
19
+ });
20
+ test("chatCompletions: renders user and assistant messages", async () => {
21
+ const prompt = (_jsxs(Region, { priority: 0, children: [_jsx(Message, { messageRole: "user", children: "Hello!" }), _jsx(Message, { messageRole: "assistant", children: "Hi there! How can I help?" })] }));
22
+ const messages = await render(prompt, {
23
+ tokenizer,
24
+ budget: 10_000,
25
+ renderer: chatCompletions,
26
+ });
27
+ expect(messages).toHaveLength(2);
28
+ expect(messages[0]).toEqual({ role: "user", content: "Hello!" });
29
+ expect(messages[1]).toEqual({
30
+ role: "assistant",
31
+ content: "Hi there! How can I help?",
32
+ });
33
+ });
34
+ test("chatCompletions: renders tool calls on assistant message", async () => {
35
+ const prompt = (_jsx(Region, { priority: 0, children: _jsxs(Message, { messageRole: "assistant", children: ["Let me check the weather.", _jsx(ToolCall, { input: { city: "Paris" }, priority: 1, toolCallId: "call_123", toolName: "getWeather" })] }) }));
36
+ const messages = await render(prompt, {
37
+ tokenizer,
38
+ budget: 10_000,
39
+ renderer: chatCompletions,
40
+ });
41
+ expect(messages).toHaveLength(1);
42
+ expect(messages[0]).toEqual({
43
+ role: "assistant",
44
+ content: "Let me check the weather.",
45
+ tool_calls: [
46
+ {
47
+ id: "call_123",
48
+ type: "function",
49
+ function: {
50
+ name: "getWeather",
51
+ arguments: '{"city":"Paris"}',
52
+ },
53
+ },
54
+ ],
55
+ });
56
+ });
57
+ test("chatCompletions: renders tool results as separate tool messages", async () => {
58
+ const prompt = (_jsx(Region, { priority: 0, children: _jsxs(Message, { messageRole: "assistant", children: [_jsx(ToolCall, { input: { city: "Paris" }, priority: 1, toolCallId: "call_123", toolName: "getWeather" }), _jsx(ToolResult, { output: { temperature: 20 }, priority: 1, toolCallId: "call_123", toolName: "getWeather" })] }) }));
59
+ const messages = await render(prompt, {
60
+ tokenizer,
61
+ budget: 10_000,
62
+ renderer: chatCompletions,
63
+ });
64
+ expect(messages).toHaveLength(2);
65
+ expect(messages[0]).toEqual({
66
+ role: "assistant",
67
+ tool_calls: [
68
+ {
69
+ id: "call_123",
70
+ type: "function",
71
+ function: {
72
+ name: "getWeather",
73
+ arguments: '{"city":"Paris"}',
74
+ },
75
+ },
76
+ ],
77
+ });
78
+ expect(messages[1]).toEqual({
79
+ role: "tool",
80
+ tool_call_id: "call_123",
81
+ content: '{"temperature":20}',
82
+ });
83
+ });
84
+ test("chatCompletions: full conversation flow", async () => {
85
+ const prompt = (_jsxs(Region, { priority: 0, children: [_jsx(Message, { messageRole: "system", children: "You are a weather assistant." }), _jsx(Message, { messageRole: "user", children: "What's the weather in Paris?" }), _jsxs(Message, { messageRole: "assistant", children: [_jsx(ToolCall, { input: { city: "Paris" }, priority: 1, toolCallId: "call_1", toolName: "getWeather" }), _jsx(ToolResult, { output: { temp: 18, condition: "sunny" }, priority: 1, toolCallId: "call_1", toolName: "getWeather" })] }), _jsx(Message, { messageRole: "assistant", children: "The weather in Paris is sunny with a temperature of 18\u00B0C." })] }));
86
+ const messages = await render(prompt, {
87
+ tokenizer,
88
+ budget: 10_000,
89
+ renderer: chatCompletions,
90
+ });
91
+ expect(messages).toHaveLength(5);
92
+ expect(messages[0]?.role).toBe("system");
93
+ expect(messages[1]?.role).toBe("user");
94
+ expect(messages[2]?.role).toBe("assistant");
95
+ expect(messages[3]?.role).toBe("tool");
96
+ expect(messages[4]?.role).toBe("assistant");
97
+ });
98
+ // ============================================================================
99
+ // Responses API Tests
100
+ // ============================================================================
101
+ test("responses: renders messages as EasyInputMessage", async () => {
102
+ const prompt = (_jsxs(Region, { priority: 0, children: [_jsx(Message, { messageRole: "system", children: "You are a helpful assistant." }), _jsx(Message, { messageRole: "user", children: "Hello!" })] }));
103
+ const input = await render(prompt, {
104
+ tokenizer,
105
+ budget: 10_000,
106
+ renderer: responses,
107
+ });
108
+ expect(input).toHaveLength(2);
109
+ expect(input[0]).toMatchObject({
110
+ role: "system",
111
+ content: "You are a helpful assistant.",
112
+ });
113
+ expect(input[1]).toMatchObject({
114
+ role: "user",
115
+ content: "Hello!",
116
+ });
117
+ });
118
+ test("responses: renders tool calls as function_call items", async () => {
119
+ const prompt = (_jsx(Region, { priority: 0, children: _jsx(Message, { messageRole: "assistant", children: _jsx(ToolCall, { input: { city: "Paris" }, priority: 1, toolCallId: "call_123", toolName: "getWeather" }) }) }));
120
+ const input = await render(prompt, {
121
+ tokenizer,
122
+ budget: 10_000,
123
+ renderer: responses,
124
+ });
125
+ expect(input).toHaveLength(1);
126
+ expect(input[0]).toMatchObject({
127
+ type: "function_call",
128
+ call_id: "call_123",
129
+ name: "getWeather",
130
+ arguments: '{"city":"Paris"}',
131
+ });
132
+ });
133
+ test("responses: renders tool results as function_call_output items", async () => {
134
+ const prompt = (_jsx(Region, { priority: 0, children: _jsx(ToolResult, { output: { temperature: 20 }, priority: 1, toolCallId: "call_123", toolName: "getWeather" }) }));
135
+ const input = await render(prompt, {
136
+ tokenizer,
137
+ budget: 10_000,
138
+ renderer: responses,
139
+ });
140
+ expect(input).toHaveLength(1);
141
+ expect(input[0]).toMatchObject({
142
+ type: "function_call_output",
143
+ call_id: "call_123",
144
+ output: '{"temperature":20}',
145
+ });
146
+ });
147
+ test("responses: renders reasoning as native reasoning item", async () => {
148
+ const prompt = (_jsx(Region, { priority: 0, children: _jsx(Reasoning, { priority: 1, text: "Let me think about this..." }) }));
149
+ const input = await render(prompt, {
150
+ tokenizer,
151
+ budget: 10_000,
152
+ renderer: responses,
153
+ });
154
+ expect(input).toHaveLength(1);
155
+ expect(input[0]).toMatchObject({
156
+ type: "reasoning",
157
+ summary: [{ type: "summary_text", text: "Let me think about this..." }],
158
+ });
159
+ });
160
+ test("responses: preserves reasoning inside messages and keeps ordering", async () => {
161
+ const prompt = (_jsx(Region, { priority: 0, children: _jsx(Message, { messageRole: "assistant", children: [
162
+ "Before",
163
+ _jsx(Reasoning, { priority: 1, text: "thinking..." }),
164
+ _jsx(ToolCall, { input: { city: "Paris" }, priority: 1, toolCallId: "call_123", toolName: "getWeather" }),
165
+ "After",
166
+ ] }) }));
167
+ const input = await render(prompt, {
168
+ tokenizer,
169
+ budget: 10_000,
170
+ renderer: responses,
171
+ });
172
+ expect(input).toHaveLength(4);
173
+ expect(input[0]).toMatchObject({
174
+ role: "assistant",
175
+ content: "Before",
176
+ });
177
+ expect(input[1]).toMatchObject({
178
+ type: "reasoning",
179
+ summary: [{ type: "summary_text", text: "thinking..." }],
180
+ });
181
+ expect(input[2]).toMatchObject({
182
+ type: "function_call",
183
+ call_id: "call_123",
184
+ name: "getWeather",
185
+ });
186
+ expect(input[3]).toMatchObject({
187
+ role: "assistant",
188
+ content: "After",
189
+ });
190
+ });
191
+ test("responses: full conversation with reasoning", async () => {
192
+ const prompt = (_jsxs(Region, { priority: 0, children: [_jsx(Message, { messageRole: "system", children: "You are a helpful assistant." }), _jsx(Message, { messageRole: "user", children: "What is 2+2?" }), _jsx(Reasoning, { priority: 1, text: "This is basic arithmetic." }), _jsx(Message, { messageRole: "assistant", children: "The answer is 4." })] }));
193
+ const input = await render(prompt, {
194
+ tokenizer,
195
+ budget: 10_000,
196
+ renderer: responses,
197
+ });
198
+ expect(input).toHaveLength(4);
199
+ expect(input[0]).toMatchObject({ role: "system" });
200
+ expect(input[1]).toMatchObject({ role: "user" });
201
+ expect(input[2]).toMatchObject({ type: "reasoning" });
202
+ expect(input[3]).toMatchObject({ role: "assistant" });
203
+ });
204
+ //# sourceMappingURL=index.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.test.js","sourceRoot":"","sources":["../../src/openai/index.test.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EACL,OAAO,EACP,SAAS,EACT,MAAM,EACN,QAAQ,EACR,UAAU,GACX,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAErD,MAAM,SAAS,GAAG,CAAC,IAAY,EAAU,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC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=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/providers/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,WAAW,EACX,aAAa,GACd,MAAM,SAAS,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/providers/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export type { CompletionMessage, CompletionRequest, CompletionResult, CriaContext, ModelProvider, } from "../types";
2
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/providers/types.ts"],"names":[],"mappings":"AACA,YAAY,EACV,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,WAAW,EACX,aAAa,GACd,MAAM,UAAU,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/providers/types.ts"],"names":[],"mappings":""}