@honeagents/hone 0.1.0 → 0.1.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.
package/README.md CHANGED
@@ -42,6 +42,7 @@ console.log(agent.temperature);
42
42
  ## Features
43
43
 
44
44
  - **Agent Management**: Define and fetch agent configurations with system prompts and hyperparameters
45
+ - **Zero-Friction Tracking**: Track conversations by passing native provider formats directly - no conversion needed
45
46
  - **Tool Definitions**: Manage tool/function descriptions for function calling
46
47
  - **Text Prompts**: Reusable text templates that can be nested in agents or tools
47
48
  - **Parameter Substitution**: Dynamic prompt templates with `{{variable}}` syntax
@@ -126,11 +127,12 @@ const prompt = await hone.prompt("tone-guidelines", {
126
127
  console.log(prompt.text); // "Always be friendly and professional."
127
128
  ```
128
129
 
129
- ### `hone.track(id, messages, options)`
130
+ ### `hone.track(id, input, options)`
130
131
 
131
- Track a conversation for analysis.
132
+ Track a conversation for analysis. Accepts either normalized messages or **provider-specific formats** for zero-friction tracking.
132
133
 
133
134
  ```typescript
135
+ // Normalized format (works with any provider)
134
136
  await hone.track(
135
137
  "conversation-123",
136
138
  [
@@ -141,6 +143,8 @@ await hone.track(
141
143
  );
142
144
  ```
143
145
 
146
+ See [Zero-Friction Tracking](#zero-friction-tracking) for provider-specific examples.
147
+
144
148
  ## Nesting Entities
145
149
 
146
150
  You can compose complex prompts by nesting tools and prompts within agents:
@@ -170,6 +174,183 @@ You have access to these tools:
170
174
  });
171
175
  ```
172
176
 
177
+ ## Zero-Friction Tracking
178
+
179
+ The SDK supports **zero-friction tracking** - pass your messages and responses in the provider's native format without any conversion. The SDK normalizes everything internally.
180
+
181
+ ### Why Zero-Friction?
182
+
183
+ Different LLM providers have different message formats:
184
+ - **OpenAI**: Messages with `role` and `content`, tool calls in `tool_calls` array
185
+ - **Anthropic**: Separate `system` parameter, content blocks instead of strings
186
+ - **Gemini**: Uses `contents` with `parts`, roles are `user`/`model`
187
+
188
+ Instead of manually converting between formats, just pass what you already have.
189
+
190
+ ### OpenAI
191
+
192
+ ```typescript
193
+ import OpenAI from "openai";
194
+ import { Hone } from "@honeagents/hone";
195
+
196
+ const openai = new OpenAI();
197
+ const hone = new Hone({ apiKey: process.env.HONE_API_KEY! });
198
+
199
+ // Your messages in OpenAI's native format
200
+ const messages: OpenAI.ChatCompletionMessageParam[] = [
201
+ { role: "system", content: "You are a helpful assistant." },
202
+ { role: "user", content: "What's the capital of France?" },
203
+ ];
204
+
205
+ // Make the API call
206
+ const response = await openai.chat.completions.create({
207
+ model: "gpt-4o",
208
+ messages,
209
+ });
210
+
211
+ // Zero-friction tracking - just pass what you have!
212
+ await hone.track(
213
+ "my-conversation",
214
+ {
215
+ provider: "openai",
216
+ messages, // Your OpenAI messages array
217
+ response, // The raw ChatCompletion response
218
+ },
219
+ { sessionId: "session-123" }
220
+ );
221
+ ```
222
+
223
+ ### Anthropic
224
+
225
+ ```typescript
226
+ import Anthropic from "@anthropic-ai/sdk";
227
+ import { Hone } from "@honeagents/hone";
228
+
229
+ const anthropic = new Anthropic();
230
+ const hone = new Hone({ apiKey: process.env.HONE_API_KEY! });
231
+
232
+ // Anthropic has system prompt separate from messages
233
+ const systemPrompt = "You are a helpful assistant.";
234
+ const messages: Anthropic.MessageParam[] = [
235
+ { role: "user", content: "What's the capital of Japan?" },
236
+ ];
237
+
238
+ // Make the API call
239
+ const response = await anthropic.messages.create({
240
+ model: "claude-sonnet-4-20250514",
241
+ system: systemPrompt,
242
+ messages,
243
+ max_tokens: 1024,
244
+ });
245
+
246
+ // Zero-friction tracking - include the system prompt
247
+ await hone.track(
248
+ "my-conversation",
249
+ {
250
+ provider: "anthropic",
251
+ messages, // Your Anthropic messages array
252
+ system: systemPrompt, // Anthropic's separate system prompt
253
+ response, // The raw Message response
254
+ },
255
+ { sessionId: "session-123" }
256
+ );
257
+ ```
258
+
259
+ ### Google Gemini
260
+
261
+ ```typescript
262
+ import { GoogleGenerativeAI } from "@google/generative-ai";
263
+ import { Hone } from "@honeagents/hone";
264
+
265
+ const genAI = new GoogleGenerativeAI(process.env.GOOGLE_API_KEY!);
266
+ const hone = new Hone({ apiKey: process.env.HONE_API_KEY! });
267
+
268
+ // Gemini uses "contents" with "parts"
269
+ const systemInstruction = "You are a helpful assistant.";
270
+ const model = genAI.getGenerativeModel({
271
+ model: "gemini-1.5-flash",
272
+ systemInstruction,
273
+ });
274
+
275
+ const contents = [
276
+ { role: "user" as const, parts: [{ text: "What's the capital of Brazil?" }] },
277
+ ];
278
+
279
+ // Make the API call
280
+ const response = await model.generateContent({ contents });
281
+
282
+ // Zero-friction tracking
283
+ await hone.track(
284
+ "my-conversation",
285
+ {
286
+ provider: "gemini",
287
+ contents, // Your Gemini contents array
288
+ systemInstruction, // Gemini's system instruction
289
+ response, // The raw GenerateContentResult
290
+ },
291
+ { sessionId: "session-123" }
292
+ );
293
+ ```
294
+
295
+ ### Multi-Turn Conversations
296
+
297
+ For multi-turn conversations, just keep adding to your messages array and track after each turn:
298
+
299
+ ```typescript
300
+ // OpenAI example
301
+ const messages: OpenAI.ChatCompletionMessageParam[] = [
302
+ { role: "system", content: agent.systemPrompt },
303
+ { role: "user", content: "Hello!" },
304
+ ];
305
+
306
+ // First turn
307
+ const response1 = await openai.chat.completions.create({ model: "gpt-4o", messages });
308
+ await hone.track("convo", { provider: "openai", messages, response: response1 }, { sessionId });
309
+
310
+ // Add assistant response and user follow-up
311
+ messages.push({ role: "assistant", content: response1.choices[0].message.content ?? "" });
312
+ messages.push({ role: "user", content: "Tell me more!" });
313
+
314
+ // Second turn
315
+ const response2 = await openai.chat.completions.create({ model: "gpt-4o", messages });
316
+ await hone.track("convo", { provider: "openai", messages, response: response2 }, { sessionId });
317
+ ```
318
+
319
+ ### With Tool Calls
320
+
321
+ Tool calls are automatically extracted and normalized:
322
+
323
+ ```typescript
324
+ // OpenAI with tools
325
+ const response = await openai.chat.completions.create({
326
+ model: "gpt-4o",
327
+ messages,
328
+ tools: [{ type: "function", function: { name: "get_weather", ... } }],
329
+ });
330
+
331
+ // If the model made tool calls, they're automatically extracted
332
+ await hone.track("convo", { provider: "openai", messages, response }, { sessionId });
333
+
334
+ // After executing the tool, add the result and continue
335
+ messages.push(response.choices[0].message); // Contains tool_calls
336
+ messages.push({
337
+ role: "tool",
338
+ tool_call_id: response.choices[0].message.tool_calls![0].id,
339
+ content: JSON.stringify({ temperature: 72 }),
340
+ });
341
+
342
+ const response2 = await openai.chat.completions.create({ model: "gpt-4o", messages });
343
+ await hone.track("convo", { provider: "openai", messages, response: response2 }, { sessionId });
344
+ ```
345
+
346
+ ### Supported Formats Summary
347
+
348
+ | Provider | Input Type | System Prompt | Response Type |
349
+ |----------|------------|---------------|---------------|
350
+ | OpenAI | `ChatCompletionMessageParam[]` | In messages array | `ChatCompletion` |
351
+ | Anthropic | `MessageParam[]` | Separate `system` param | `Message` |
352
+ | Gemini | `Content[]` | Separate `systemInstruction` | `GenerateContentResult` |
353
+
173
354
  ## Provider Constants
174
355
 
175
356
  Use type-safe provider constants:
@@ -267,16 +448,34 @@ The SDK is written in TypeScript and provides comprehensive type definitions:
267
448
 
268
449
  ```typescript
269
450
  import type {
451
+ // Client types
270
452
  HoneClient,
271
453
  HoneConfig,
454
+
455
+ // Agent types
272
456
  AgentResult,
273
- ToolResult,
274
- TextPromptResult,
275
457
  GetAgentOptions,
458
+
459
+ // Tool types
460
+ ToolResult,
276
461
  GetToolOptions,
462
+
463
+ // Prompt types
464
+ TextPromptResult,
277
465
  GetTextPromptOptions,
466
+
467
+ // Message types
278
468
  Message,
279
469
  ToolCall,
470
+
471
+ // Tracking types (zero-friction)
472
+ TrackInput,
473
+ TrackOpenAIInput,
474
+ TrackAnthropicInput,
475
+ TrackGeminiInput,
476
+ TrackConversationOptions,
477
+
478
+ // Provider types
280
479
  AIProviderValue,
281
480
  } from "@honeagents/hone";
282
481
  ```
package/dist/index.d.mts CHANGED
@@ -1,3 +1,7 @@
1
+ import { ChatCompletionMessageParam, ChatCompletion } from 'openai/resources/chat/completions';
2
+ import { MessageParam, Message as Message$1 } from '@anthropic-ai/sdk/resources/messages';
3
+ import { Content, GenerateContentResult } from '@google/generative-ai';
4
+
1
5
  /**
2
6
  * AI Provider definitions compatible with Vercel AI SDK.
3
7
  *
@@ -336,7 +340,54 @@ type Message = {
336
340
  type TrackConversationOptions = {
337
341
  sessionId: string;
338
342
  };
339
- type HoneTrack = (id: string, messages: Message[], options: TrackConversationOptions) => Promise<void>;
343
+ type HoneTrack = (id: string, input: TrackInput, options: TrackConversationOptions) => Promise<void>;
344
+ /**
345
+ * Track input for OpenAI conversations.
346
+ * Pass your messages and response exactly as-is from the OpenAI SDK.
347
+ */
348
+ type TrackOpenAIInput = {
349
+ provider: "openai";
350
+ messages: ChatCompletionMessageParam[];
351
+ response: ChatCompletion;
352
+ };
353
+ /**
354
+ * Track input for Anthropic conversations.
355
+ * Pass your messages, system prompt, and response exactly as-is from the Anthropic SDK.
356
+ */
357
+ type TrackAnthropicInput = {
358
+ provider: "anthropic";
359
+ messages: MessageParam[];
360
+ system?: string;
361
+ response: Message$1;
362
+ };
363
+ /**
364
+ * Track input for Gemini conversations.
365
+ * Pass your contents, system instruction, and response exactly as-is from the Gemini SDK.
366
+ */
367
+ type TrackGeminiInput = {
368
+ provider: "gemini";
369
+ contents: Content[];
370
+ systemInstruction?: string;
371
+ response: GenerateContentResult;
372
+ };
373
+ /**
374
+ * Union type for all track inputs.
375
+ * Accepts either the normalized Message[] format or provider-specific formats.
376
+ *
377
+ * @example
378
+ * // OpenAI - just pass what you have
379
+ * await hone.track("convo", { provider: "openai", messages, response }, { sessionId })
380
+ *
381
+ * // Anthropic
382
+ * await hone.track("convo", { provider: "anthropic", messages, system, response }, { sessionId })
383
+ *
384
+ * // Gemini
385
+ * await hone.track("convo", { provider: "gemini", contents, systemInstruction, response }, { sessionId })
386
+ *
387
+ * // Or use the normalized format directly
388
+ * await hone.track("convo", normalizedMessages, { sessionId })
389
+ */
390
+ type TrackInput = Message[] | TrackOpenAIInput | TrackAnthropicInput | TrackGeminiInput;
340
391
  type HoneClient = {
341
392
  /**
342
393
  * Fetches and evaluates an agent by its ID with the given options.
@@ -360,10 +411,25 @@ type HoneClient = {
360
411
  */
361
412
  prompt: HoneTextPrompt;
362
413
  /**
363
- * Adds messages to track a conversation under the given ID.
414
+ * Tracks a conversation under the given ID.
415
+ * Accepts either normalized Message[] or provider-specific formats for zero-friction tracking.
416
+ *
364
417
  * @param id The unique identifier for the conversation to track.
365
- * @param messages An array of Message objects representing the conversation.
366
- * @param options Optional TrackConversationOptions such as sessionId.
418
+ * @param input Either a Message[] array or a provider-specific input object.
419
+ * @param options TrackConversationOptions including sessionId.
420
+ *
421
+ * @example
422
+ * // OpenAI - just pass your messages and response
423
+ * await hone.track("convo", { provider: "openai", messages, response }, { sessionId })
424
+ *
425
+ * // Anthropic - include system prompt
426
+ * await hone.track("convo", { provider: "anthropic", messages, system, response }, { sessionId })
427
+ *
428
+ * // Gemini - use contents and systemInstruction
429
+ * await hone.track("convo", { provider: "gemini", contents, systemInstruction, response }, { sessionId })
430
+ *
431
+ * // Or use normalized format directly
432
+ * await hone.track("convo", normalizedMessages, { sessionId })
367
433
  */
368
434
  track: HoneTrack;
369
435
  };
@@ -428,7 +494,7 @@ declare class Hone implements HoneClient {
428
494
  agent<TExtra extends Record<string, unknown> = Record<string, unknown>>(id: string, options: GetAgentOptions<TExtra>): Promise<AgentResult<TExtra>>;
429
495
  tool(id: string, options: GetToolOptions): Promise<ToolResult>;
430
496
  prompt(id: string, options: GetTextPromptOptions): Promise<TextPromptResult>;
431
- track(id: string, messages: Message[], options: TrackConversationOptions): Promise<void>;
497
+ track(id: string, input: TrackInput, options: TrackConversationOptions): Promise<void>;
432
498
  }
433
499
  declare function createHoneClient(config: HoneConfig): HoneClient;
434
500
 
@@ -492,21 +558,7 @@ declare function createToolResultMessage(toolCallId: string, result: unknown): M
492
558
  * await hone.track("conversation", [...existingMessages, ...messages], { sessionId });
493
559
  * ```
494
560
  */
495
- declare function extractOpenAIMessages(response: {
496
- choices: Array<{
497
- message: {
498
- role: string;
499
- content: string | null;
500
- tool_calls?: Array<{
501
- id: string;
502
- function: {
503
- name: string;
504
- arguments: string;
505
- };
506
- }>;
507
- };
508
- }>;
509
- }): Message[];
561
+ declare function extractOpenAIMessages(response: ChatCompletion): Message[];
510
562
  /**
511
563
  * Extracts messages from an Anthropic Claude response.
512
564
  *
@@ -530,18 +582,7 @@ declare function extractOpenAIMessages(response: {
530
582
  * await hone.track("conversation", [...existingMessages, ...messages], { sessionId });
531
583
  * ```
532
584
  */
533
- declare function extractAnthropicMessages(response: {
534
- role: string;
535
- content: Array<{
536
- type: "text";
537
- text: string;
538
- } | {
539
- type: "tool_use";
540
- id: string;
541
- name: string;
542
- input: unknown;
543
- }>;
544
- }): Message[];
585
+ declare function extractAnthropicMessages(response: Message$1): Message[];
545
586
  /**
546
587
  * Extracts messages from a Google Gemini response.
547
588
  *
@@ -568,21 +609,31 @@ declare function extractAnthropicMessages(response: {
568
609
  * await hone.track("conversation", [...existingMessages, ...messages], { sessionId });
569
610
  * ```
570
611
  */
571
- declare function extractGeminiMessages(response: {
572
- candidates?: Array<{
573
- content?: {
574
- role?: string;
575
- parts?: Array<{
576
- text: string;
577
- } | {
578
- functionCall: {
579
- name: string;
580
- args: Record<string, unknown>;
581
- };
582
- }>;
583
- };
584
- }>;
585
- }): Message[];
612
+ declare function extractGeminiMessages(response: GenerateContentResult): Message[];
613
+
614
+ /**
615
+ * Normalizes OpenAI input messages to Hone's Message format.
616
+ *
617
+ * @param messages - Array of OpenAI ChatCompletionMessageParam
618
+ * @returns Array of normalized Message objects
619
+ */
620
+ declare function normalizeOpenAIMessages(messages: ChatCompletionMessageParam[]): Message[];
621
+ /**
622
+ * Normalizes Anthropic input messages to Hone's Message format.
623
+ * Note: System prompt should be passed separately to track().
624
+ *
625
+ * @param messages - Array of Anthropic MessageParam
626
+ * @returns Array of normalized Message objects
627
+ */
628
+ declare function normalizeAnthropicMessages(messages: MessageParam[]): Message[];
629
+ /**
630
+ * Normalizes Gemini input contents to Hone's Message format.
631
+ * Note: System instruction should be passed separately to track().
632
+ *
633
+ * @param contents - Array of Gemini Content
634
+ * @returns Array of normalized Message objects
635
+ */
636
+ declare function normalizeGeminiContents(contents: Content[]): Message[];
586
637
  /**
587
638
  * Short alias for createToolResultMessage.
588
639
  * Creates a tool result message responding to a specific tool call.
@@ -671,4 +722,4 @@ declare const formatPromptRequest: typeof formatAgentRequest;
671
722
  /** @deprecated Use updateAgentNodes instead */
672
723
  declare const updatePromptNodes: typeof updateAgentNodes;
673
724
 
674
- export { AIProvider, type AIProviderValue, AI_PROVIDER_VALUES, type AgentNode, type AgentRequest, type AgentResponse, type AgentResponseItem, type AgentResult, type GetAgentOptions, type GetPromptOptions, Hone, type HoneAgent, type HoneClient, type HonePrompt, type HoneTrack, type Hyperparameters, type Message, type PromptNode, type PromptRequest, type PromptResponse, type ToolCall, createHoneClient, createToolCallMessage, createToolResultMessage, evaluateAgent, evaluatePrompt, extractAnthropicMessages, extractGeminiMessages, extractOpenAIMessages, formatAgentRequest, formatPromptRequest, fromAnthropic, fromGemini, fromOpenAI, getAgentNode, getPromptNode, getProviderDisplayName, insertParamsIntoPrompt, isValidProvider, toolResult, traverseAgentNode, traversePromptNode, updateAgentNodes, updatePromptNodes };
725
+ export { AIProvider, type AIProviderValue, AI_PROVIDER_VALUES, type AgentNode, type AgentRequest, type AgentResponse, type AgentResponseItem, type AgentResult, type GetAgentOptions, type GetPromptOptions, Hone, type HoneAgent, type HoneClient, type HonePrompt, type HoneTrack, type Hyperparameters, type Message, type PromptNode, type PromptRequest, type PromptResponse, type ToolCall, type TrackAnthropicInput, type TrackConversationOptions, type TrackGeminiInput, type TrackInput, type TrackOpenAIInput, createHoneClient, createToolCallMessage, createToolResultMessage, evaluateAgent, evaluatePrompt, extractAnthropicMessages, extractGeminiMessages, extractOpenAIMessages, formatAgentRequest, formatPromptRequest, fromAnthropic, fromGemini, fromOpenAI, getAgentNode, getPromptNode, getProviderDisplayName, insertParamsIntoPrompt, isValidProvider, normalizeAnthropicMessages, normalizeGeminiContents, normalizeOpenAIMessages, toolResult, traverseAgentNode, traversePromptNode, updateAgentNodes, updatePromptNodes };
package/dist/index.d.ts CHANGED
@@ -1,3 +1,7 @@
1
+ import { ChatCompletionMessageParam, ChatCompletion } from 'openai/resources/chat/completions';
2
+ import { MessageParam, Message as Message$1 } from '@anthropic-ai/sdk/resources/messages';
3
+ import { Content, GenerateContentResult } from '@google/generative-ai';
4
+
1
5
  /**
2
6
  * AI Provider definitions compatible with Vercel AI SDK.
3
7
  *
@@ -336,7 +340,54 @@ type Message = {
336
340
  type TrackConversationOptions = {
337
341
  sessionId: string;
338
342
  };
339
- type HoneTrack = (id: string, messages: Message[], options: TrackConversationOptions) => Promise<void>;
343
+ type HoneTrack = (id: string, input: TrackInput, options: TrackConversationOptions) => Promise<void>;
344
+ /**
345
+ * Track input for OpenAI conversations.
346
+ * Pass your messages and response exactly as-is from the OpenAI SDK.
347
+ */
348
+ type TrackOpenAIInput = {
349
+ provider: "openai";
350
+ messages: ChatCompletionMessageParam[];
351
+ response: ChatCompletion;
352
+ };
353
+ /**
354
+ * Track input for Anthropic conversations.
355
+ * Pass your messages, system prompt, and response exactly as-is from the Anthropic SDK.
356
+ */
357
+ type TrackAnthropicInput = {
358
+ provider: "anthropic";
359
+ messages: MessageParam[];
360
+ system?: string;
361
+ response: Message$1;
362
+ };
363
+ /**
364
+ * Track input for Gemini conversations.
365
+ * Pass your contents, system instruction, and response exactly as-is from the Gemini SDK.
366
+ */
367
+ type TrackGeminiInput = {
368
+ provider: "gemini";
369
+ contents: Content[];
370
+ systemInstruction?: string;
371
+ response: GenerateContentResult;
372
+ };
373
+ /**
374
+ * Union type for all track inputs.
375
+ * Accepts either the normalized Message[] format or provider-specific formats.
376
+ *
377
+ * @example
378
+ * // OpenAI - just pass what you have
379
+ * await hone.track("convo", { provider: "openai", messages, response }, { sessionId })
380
+ *
381
+ * // Anthropic
382
+ * await hone.track("convo", { provider: "anthropic", messages, system, response }, { sessionId })
383
+ *
384
+ * // Gemini
385
+ * await hone.track("convo", { provider: "gemini", contents, systemInstruction, response }, { sessionId })
386
+ *
387
+ * // Or use the normalized format directly
388
+ * await hone.track("convo", normalizedMessages, { sessionId })
389
+ */
390
+ type TrackInput = Message[] | TrackOpenAIInput | TrackAnthropicInput | TrackGeminiInput;
340
391
  type HoneClient = {
341
392
  /**
342
393
  * Fetches and evaluates an agent by its ID with the given options.
@@ -360,10 +411,25 @@ type HoneClient = {
360
411
  */
361
412
  prompt: HoneTextPrompt;
362
413
  /**
363
- * Adds messages to track a conversation under the given ID.
414
+ * Tracks a conversation under the given ID.
415
+ * Accepts either normalized Message[] or provider-specific formats for zero-friction tracking.
416
+ *
364
417
  * @param id The unique identifier for the conversation to track.
365
- * @param messages An array of Message objects representing the conversation.
366
- * @param options Optional TrackConversationOptions such as sessionId.
418
+ * @param input Either a Message[] array or a provider-specific input object.
419
+ * @param options TrackConversationOptions including sessionId.
420
+ *
421
+ * @example
422
+ * // OpenAI - just pass your messages and response
423
+ * await hone.track("convo", { provider: "openai", messages, response }, { sessionId })
424
+ *
425
+ * // Anthropic - include system prompt
426
+ * await hone.track("convo", { provider: "anthropic", messages, system, response }, { sessionId })
427
+ *
428
+ * // Gemini - use contents and systemInstruction
429
+ * await hone.track("convo", { provider: "gemini", contents, systemInstruction, response }, { sessionId })
430
+ *
431
+ * // Or use normalized format directly
432
+ * await hone.track("convo", normalizedMessages, { sessionId })
367
433
  */
368
434
  track: HoneTrack;
369
435
  };
@@ -428,7 +494,7 @@ declare class Hone implements HoneClient {
428
494
  agent<TExtra extends Record<string, unknown> = Record<string, unknown>>(id: string, options: GetAgentOptions<TExtra>): Promise<AgentResult<TExtra>>;
429
495
  tool(id: string, options: GetToolOptions): Promise<ToolResult>;
430
496
  prompt(id: string, options: GetTextPromptOptions): Promise<TextPromptResult>;
431
- track(id: string, messages: Message[], options: TrackConversationOptions): Promise<void>;
497
+ track(id: string, input: TrackInput, options: TrackConversationOptions): Promise<void>;
432
498
  }
433
499
  declare function createHoneClient(config: HoneConfig): HoneClient;
434
500
 
@@ -492,21 +558,7 @@ declare function createToolResultMessage(toolCallId: string, result: unknown): M
492
558
  * await hone.track("conversation", [...existingMessages, ...messages], { sessionId });
493
559
  * ```
494
560
  */
495
- declare function extractOpenAIMessages(response: {
496
- choices: Array<{
497
- message: {
498
- role: string;
499
- content: string | null;
500
- tool_calls?: Array<{
501
- id: string;
502
- function: {
503
- name: string;
504
- arguments: string;
505
- };
506
- }>;
507
- };
508
- }>;
509
- }): Message[];
561
+ declare function extractOpenAIMessages(response: ChatCompletion): Message[];
510
562
  /**
511
563
  * Extracts messages from an Anthropic Claude response.
512
564
  *
@@ -530,18 +582,7 @@ declare function extractOpenAIMessages(response: {
530
582
  * await hone.track("conversation", [...existingMessages, ...messages], { sessionId });
531
583
  * ```
532
584
  */
533
- declare function extractAnthropicMessages(response: {
534
- role: string;
535
- content: Array<{
536
- type: "text";
537
- text: string;
538
- } | {
539
- type: "tool_use";
540
- id: string;
541
- name: string;
542
- input: unknown;
543
- }>;
544
- }): Message[];
585
+ declare function extractAnthropicMessages(response: Message$1): Message[];
545
586
  /**
546
587
  * Extracts messages from a Google Gemini response.
547
588
  *
@@ -568,21 +609,31 @@ declare function extractAnthropicMessages(response: {
568
609
  * await hone.track("conversation", [...existingMessages, ...messages], { sessionId });
569
610
  * ```
570
611
  */
571
- declare function extractGeminiMessages(response: {
572
- candidates?: Array<{
573
- content?: {
574
- role?: string;
575
- parts?: Array<{
576
- text: string;
577
- } | {
578
- functionCall: {
579
- name: string;
580
- args: Record<string, unknown>;
581
- };
582
- }>;
583
- };
584
- }>;
585
- }): Message[];
612
+ declare function extractGeminiMessages(response: GenerateContentResult): Message[];
613
+
614
+ /**
615
+ * Normalizes OpenAI input messages to Hone's Message format.
616
+ *
617
+ * @param messages - Array of OpenAI ChatCompletionMessageParam
618
+ * @returns Array of normalized Message objects
619
+ */
620
+ declare function normalizeOpenAIMessages(messages: ChatCompletionMessageParam[]): Message[];
621
+ /**
622
+ * Normalizes Anthropic input messages to Hone's Message format.
623
+ * Note: System prompt should be passed separately to track().
624
+ *
625
+ * @param messages - Array of Anthropic MessageParam
626
+ * @returns Array of normalized Message objects
627
+ */
628
+ declare function normalizeAnthropicMessages(messages: MessageParam[]): Message[];
629
+ /**
630
+ * Normalizes Gemini input contents to Hone's Message format.
631
+ * Note: System instruction should be passed separately to track().
632
+ *
633
+ * @param contents - Array of Gemini Content
634
+ * @returns Array of normalized Message objects
635
+ */
636
+ declare function normalizeGeminiContents(contents: Content[]): Message[];
586
637
  /**
587
638
  * Short alias for createToolResultMessage.
588
639
  * Creates a tool result message responding to a specific tool call.
@@ -671,4 +722,4 @@ declare const formatPromptRequest: typeof formatAgentRequest;
671
722
  /** @deprecated Use updateAgentNodes instead */
672
723
  declare const updatePromptNodes: typeof updateAgentNodes;
673
724
 
674
- export { AIProvider, type AIProviderValue, AI_PROVIDER_VALUES, type AgentNode, type AgentRequest, type AgentResponse, type AgentResponseItem, type AgentResult, type GetAgentOptions, type GetPromptOptions, Hone, type HoneAgent, type HoneClient, type HonePrompt, type HoneTrack, type Hyperparameters, type Message, type PromptNode, type PromptRequest, type PromptResponse, type ToolCall, createHoneClient, createToolCallMessage, createToolResultMessage, evaluateAgent, evaluatePrompt, extractAnthropicMessages, extractGeminiMessages, extractOpenAIMessages, formatAgentRequest, formatPromptRequest, fromAnthropic, fromGemini, fromOpenAI, getAgentNode, getPromptNode, getProviderDisplayName, insertParamsIntoPrompt, isValidProvider, toolResult, traverseAgentNode, traversePromptNode, updateAgentNodes, updatePromptNodes };
725
+ export { AIProvider, type AIProviderValue, AI_PROVIDER_VALUES, type AgentNode, type AgentRequest, type AgentResponse, type AgentResponseItem, type AgentResult, type GetAgentOptions, type GetPromptOptions, Hone, type HoneAgent, type HoneClient, type HonePrompt, type HoneTrack, type Hyperparameters, type Message, type PromptNode, type PromptRequest, type PromptResponse, type ToolCall, type TrackAnthropicInput, type TrackConversationOptions, type TrackGeminiInput, type TrackInput, type TrackOpenAIInput, createHoneClient, createToolCallMessage, createToolResultMessage, evaluateAgent, evaluatePrompt, extractAnthropicMessages, extractGeminiMessages, extractOpenAIMessages, formatAgentRequest, formatPromptRequest, fromAnthropic, fromGemini, fromOpenAI, getAgentNode, getPromptNode, getProviderDisplayName, insertParamsIntoPrompt, isValidProvider, normalizeAnthropicMessages, normalizeGeminiContents, normalizeOpenAIMessages, toolResult, traverseAgentNode, traversePromptNode, updateAgentNodes, updatePromptNodes };