@imalec/resolvai-types
v1.0.3
Published
Resolvai Types - Shared type definitions for ResolvAI ecosystem
Readme
@imalec/resolvai-types
ResolvAI Types - Shared type definitions for the ResolvAI ecosystem.
📦 Installation
npm install @imalec/resolvai-types
# or
yarn add @imalec/resolvai-types
# or
pnpm add @imalec/resolvai-types🚀 Usage
Basic Import
import { ResolvAITask, ResolvAIMessage, ResolvAIEvent } from '@imalec/resolvai-types';Type Definitions
ResolvAI Task
import { ResolvAITask, ResolvAITaskStatus, ResolvAITaskPriority } from '@imalec/resolvai-types';
const task: ResolvAITask = {
id: 'task-123',
title: 'Call Restaurant',
description: 'Call the restaurant to make a reservation',
status: 'completed',
priority: 'high',
tags: ['phone', 'reservation'],
createdAt: new Date(),
updatedAt: new Date(),
completedAt: new Date(),
toolCall: {
id: 'tool-call-123',
name: 'make_phone_call',
args: {
businessName: 'Pizza Palace',
phoneNumber: '+1-555-0123',
inquiryType: 'reservation',
},
timestamp: new Date(),
},
result: {
businessName: 'Pizza Palace',
phoneNumber: '+1-555-0123',
inquiryType: 'reservation',
duration: 120,
recordingUrl: 'https://api.twilio.com/...',
},
};ResolvAI Message
import { ResolvAIMessage, ResolvAIMessageRole } from '@imalec/resolvai-types';
const message: ResolvAIMessage = {
id: 'msg-123',
role: 'user',
parts: [
{
type: 'text',
text: 'I need to call Pizza Palace to make a reservation',
},
],
createdAt: new Date(),
turnId: 1,
taskId: 'task-123',
};ResolvAI Event
import { ResolvAIEvent, ResolvAIEventType } from '@imalec/resolvai-types';
const event: ResolvAIEvent = {
id: 'event-123',
type: 'call_started',
title: 'Call Started',
description: 'Started calling Pizza Palace',
createdAt: new Date(),
taskId: 'task-123',
data: {
duration: 120,
recordingUrl: 'https://api.twilio.com/...',
},
};ResolvAI Google Event
import { ResolvAIGoogleEvent } from '@imalec/resolvai-types';
const googleEvent: ResolvAIGoogleEvent = {
id: 'google-event-123',
title: 'Team Meeting',
description: 'Weekly team sync',
source: 'Google Calendar',
startTime: '2024-01-15T10:00:00Z',
endTime: '2024-01-15T11:00:00Z',
hasMeeting: true,
meetingUrl: 'https://meet.google.com/abc-defg-hij',
location: 'Conference Room A',
attendees: ['[email protected]', '[email protected]'],
isAllDay: false,
isExpired: false,
timeDistance: '2 hours ago',
updatedAt: new Date(),
};API Response Types
import {
ResolvAIAPIResponse,
ResolvAITaskListResponse,
ResolvAITaskDetailResponse,
} from '@imalec/resolvai-types';
// Generic API response
const response: ResolvAIAPIResponse<ResolvAITask> = {
success: true,
data: task,
metadata: { timestamp: new Date() },
};
// Task list response
const taskListResponse: ResolvAITaskListResponse = {
success: true,
data: [task1, task2, task3],
total: 100,
page: 1,
limit: 10,
hasMore: true,
};
// Task detail response
const taskDetailResponse: ResolvAITaskDetailResponse = {
success: true,
data: {
task: task,
messages: [message1, message2],
events: [event1, event2],
},
};Filter and Pagination Types
import { ResolvAITaskFilterParams, ResolvAIEventFilterParams } from '@imalec/resolvai-types';
const taskFilters: ResolvAITaskFilterParams = {
status: 'completed',
priority: 'high',
tags: ['phone', 'reservation'],
startDate: new Date('2024-01-01'),
endDate: new Date('2024-01-31'),
query: 'restaurant',
page: 1,
limit: 20,
sortBy: 'createdAt',
sortOrder: 'desc',
};
const eventFilters: ResolvAIEventFilterParams = {
type: 'call_started',
taskId: 'task-123',
startDate: new Date('2024-01-01'),
endDate: new Date('2024-01-31'),
page: 1,
limit: 50,
};📋 Available Types
Core Types
ResolvAITask- Main task interfaceResolvAIMessage- Message interfaceResolvAIEvent- Event interfaceResolvAIGoogleEvent- Google Calendar event interface
Status Types
ResolvAITaskStatus- Task status enumResolvAITaskPriority- Task priority enumResolvAIMessageRole- Message role enumResolvAIEventType- Event type enum
Tool Types
ResolvAIToolCall- Tool call interfaceResolvAIToolCallArgs- Tool call argumentsResolvAITaskResult- Task result interface
API Types
ResolvAIAPIResponse<T>- Generic API responseResolvAITaskListResponse- Task list responseResolvAITaskDetailResponse- Task detail response
Filter Types
ResolvAIPaginationParams- Pagination parametersResolvAITaskFilterParams- Task filter parametersResolvAIEventFilterParams- Event filter parameters
🔧 Development
Building
# Build type declarations
npm run build
# Clean build output
npm run cleanPublishing
# Update version (patch/minor/major)
npm run version:patch
npm run version:minor
npm run version:major
# Publish to npm
npm run releaseBuild Process
This package uses TypeScript to generate type declarations:
- Source:
src/index.ts- Contains all type definitions - Build:
npm run build- Generatesdist/index.d.ts - Output:
dist/directory - Contains compiled type declarations
TypeScript Configuration
This package is built with TypeScript and includes:
- Strict type checking
- Declaration files generation only (
--emitDeclarationOnly) - ES2020 target
- CommonJS module system
📄 License
ISC
🤝 Contributing
When contributing to this package:
- Ensure all types are properly documented with JSDoc comments
- Maintain backward compatibility when possible
- Add tests for new types if applicable
- Update this README when adding new types
📞 Support
For questions or issues, please contact: [email protected]
