onairos 2.0.6 → 2.0.8

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.
@@ -19,8 +19,6 @@ export default function UniversalOnboarding({ onComplete, appIcon, appName = 'Ap
19
19
  if (isConnecting) return;
20
20
 
21
21
  setIsConnecting(true);
22
-
23
- // Simulate connection delay
24
22
  await new Promise(resolve => setTimeout(resolve, 1000));
25
23
 
26
24
  setConnectedAccounts(prev => ({
@@ -45,112 +43,114 @@ export default function UniversalOnboarding({ onComplete, appIcon, appName = 'Ap
45
43
  const connectedCount = Object.values(connectedAccounts).filter(Boolean).length;
46
44
 
47
45
  return (
48
- <div className="max-w-md mx-auto bg-white p-6 min-h-[500px]">
49
- {/* Header with App Logo and Arrow to Onairos */}
50
- <div className="flex items-center justify-center mb-6">
51
- <div className="flex items-center space-x-3">
52
- <img
53
- src={appIcon || "https://onairos.sirv.com/Images/OnairosBlack.png"}
54
- alt={appName}
55
- className="w-10 h-10 rounded-lg"
56
- />
57
- <div className="flex items-center text-gray-400">
58
- <svg className="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
59
- <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M17 8l4 4m0 0l-4 4m4-4H3" />
60
- </svg>
46
+ <div className="w-full max-w-md mx-auto bg-white rounded-lg shadow-xl overflow-hidden" style={{ maxHeight: '90vh', height: 'auto' }}>
47
+ <div className="p-4 sm:p-6 overflow-y-auto" style={{ maxHeight: 'calc(90vh - 4rem)' }}>
48
+ {/* Header with App Logo and Arrow to Onairos */}
49
+ <div className="flex items-center justify-center mb-4 sm:mb-6">
50
+ <div className="flex items-center space-x-3">
51
+ <img
52
+ src={appIcon || "https://onairos.sirv.com/Images/OnairosBlack.png"}
53
+ alt={appName}
54
+ className="w-8 h-8 sm:w-10 sm:h-10 rounded-lg"
55
+ />
56
+ <div className="flex items-center text-gray-400">
57
+ <svg className="w-5 h-5 sm:w-6 sm:h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
58
+ <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M17 8l4 4m0 0l-4 4m4-4H3" />
59
+ </svg>
60
+ </div>
61
+ <img
62
+ src="https://onairos.sirv.com/Images/OnairosBlack.png"
63
+ alt="Onairos"
64
+ className="w-8 h-8 sm:w-10 sm:h-10 rounded-lg"
65
+ />
61
66
  </div>
62
- <img
63
- src="https://onairos.sirv.com/Images/OnairosBlack.png"
64
- alt="Onairos"
65
- className="w-10 h-10 rounded-lg"
66
- />
67
67
  </div>
68
- </div>
69
68
 
70
- <div className="text-center mb-6">
71
- <h2 className="text-xl font-bold text-gray-900 mb-2">Connect Your Accounts</h2>
72
- <p className="text-gray-600 text-sm">
73
- Choose which accounts to connect for a personalized experience
74
- </p>
75
- </div>
69
+ <div className="text-center mb-4 sm:mb-6">
70
+ <h2 className="text-lg sm:text-xl font-bold text-gray-900 mb-2">Connect Your Accounts</h2>
71
+ <p className="text-gray-600 text-xs sm:text-sm">
72
+ Choose which accounts to connect for a personalized experience
73
+ </p>
74
+ </div>
76
75
 
77
- {/* Privacy Notice */}
78
- <div className="mb-6 p-3 bg-blue-50 border border-blue-200 rounded-lg">
79
- <p className="text-blue-800 text-sm">
80
- 🔒 Your data is never shared with anyone. It's only used to train your personal model and is stored securely.
81
- </p>
82
- </div>
76
+ {/* Privacy Notice */}
77
+ <div className="mb-4 sm:mb-6 p-2 sm:p-3 bg-blue-50 border border-blue-200 rounded-lg">
78
+ <p className="text-blue-800 text-xs sm:text-sm">
79
+ 🔒 Your data is never shared with anyone. It's only used to train your personal model and is stored securely.
80
+ </p>
81
+ </div>
83
82
 
84
- {/* Platform List - Vertical Layout with Toggles */}
85
- <div className="space-y-3 mb-6">
86
- {platforms.map((platform) => {
87
- const isConnected = connectedAccounts[platform.name] || false;
88
-
89
- return (
90
- <div
91
- key={platform.name}
92
- className="flex items-center justify-between p-4 border rounded-lg hover:bg-gray-50 transition-colors"
93
- >
94
- <div className="flex items-center space-x-3">
95
- <div className={`w-10 h-10 rounded-lg ${platform.color} flex items-center justify-center text-white text-lg`}>
96
- {platform.icon}
97
- </div>
98
- <div>
99
- <h3 className="font-medium text-gray-900">{platform.name}</h3>
100
- <p className="text-sm text-gray-500">
101
- {isConnected ? 'Connected' : 'Not connected'}
102
- </p>
83
+ {/* Platform List - Vertical Layout with Toggles */}
84
+ <div className="space-y-2 sm:space-y-3 mb-4 sm:mb-6">
85
+ {platforms.map((platform) => {
86
+ const isConnected = connectedAccounts[platform.name] || false;
87
+
88
+ return (
89
+ <div
90
+ key={platform.name}
91
+ className="flex items-center justify-between p-3 sm:p-4 border rounded-lg hover:bg-gray-50 transition-colors"
92
+ >
93
+ <div className="flex items-center space-x-3">
94
+ <div className={`w-8 h-8 sm:w-10 sm:h-10 rounded-lg ${platform.color} flex items-center justify-center text-white text-base sm:text-lg`}>
95
+ {platform.icon}
96
+ </div>
97
+ <div>
98
+ <h3 className="font-medium text-gray-900 text-sm sm:text-base">{platform.name}</h3>
99
+ <p className="text-xs sm:text-sm text-gray-500">
100
+ {isConnected ? 'Connected' : 'Not connected'}
101
+ </p>
102
+ </div>
103
103
  </div>
104
+
105
+ {/* Toggle Switch */}
106
+ <button
107
+ onClick={() => handleToggle(platform.name)}
108
+ disabled={isConnecting}
109
+ className={`relative inline-flex h-5 sm:h-6 w-9 sm:w-11 items-center rounded-full transition-colors focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 ${
110
+ isConnected ? 'bg-blue-600' : 'bg-gray-200'
111
+ } ${isConnecting ? 'opacity-50 cursor-not-allowed' : 'cursor-pointer'}`}
112
+ >
113
+ <span
114
+ className={`inline-block h-3 sm:h-4 w-3 sm:w-4 transform rounded-full bg-white transition-transform ${
115
+ isConnected ? 'translate-x-5 sm:translate-x-6' : 'translate-x-1'
116
+ }`}
117
+ />
118
+ </button>
104
119
  </div>
105
-
106
- {/* Toggle Switch */}
107
- <button
108
- onClick={() => handleToggle(platform.name)}
109
- disabled={isConnecting}
110
- className={`relative inline-flex h-6 w-11 items-center rounded-full transition-colors focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 ${
111
- isConnected ? 'bg-blue-600' : 'bg-gray-200'
112
- } ${isConnecting ? 'opacity-50 cursor-not-allowed' : 'cursor-pointer'}`}
113
- >
114
- <span
115
- className={`inline-block h-4 w-4 transform rounded-full bg-white transition-transform ${
116
- isConnected ? 'translate-x-6' : 'translate-x-1'
117
- }`}
118
- />
119
- </button>
120
- </div>
121
- );
122
- })}
123
- </div>
124
-
125
- {/* Connection Status */}
126
- {connectedCount > 0 && (
127
- <div className="mb-4 p-3 bg-green-50 border border-green-200 rounded-lg">
128
- <p className="text-green-800 text-sm">
129
- ✅ {connectedCount} account{connectedCount > 1 ? 's' : ''} connected
130
- </p>
120
+ );
121
+ })}
131
122
  </div>
132
- )}
133
123
 
134
- {/* Continue Button */}
135
- <button
136
- onClick={handleContinue}
137
- disabled={connectedCount === 0}
138
- className={`w-full py-3 px-4 rounded-lg font-semibold transition-colors ${
139
- connectedCount > 0
140
- ? 'bg-blue-600 text-white hover:bg-blue-700'
141
- : 'bg-gray-300 text-gray-500 cursor-not-allowed'
142
- }`}
143
- >
144
- Continue {connectedCount > 0 ? `with ${connectedCount} account${connectedCount > 1 ? 's' : ''}` : ''}
145
- </button>
124
+ {/* Connection Status */}
125
+ {connectedCount > 0 && (
126
+ <div className="mb-3 sm:mb-4 p-2 sm:p-3 bg-green-50 border border-green-200 rounded-lg">
127
+ <p className="text-green-800 text-xs sm:text-sm">
128
+ {connectedCount} account{connectedCount > 1 ? 's' : ''} connected
129
+ </p>
130
+ </div>
131
+ )}
132
+
133
+ {/* Continue Button */}
134
+ <button
135
+ onClick={handleContinue}
136
+ disabled={connectedCount === 0}
137
+ className={`w-full py-2 sm:py-3 px-4 rounded-lg font-semibold transition-colors text-sm sm:text-base ${
138
+ connectedCount > 0
139
+ ? 'bg-blue-600 text-white hover:bg-blue-700'
140
+ : 'bg-gray-300 text-gray-500 cursor-not-allowed'
141
+ }`}
142
+ >
143
+ Continue {connectedCount > 0 ? `with ${connectedCount} account${connectedCount > 1 ? 's' : ''}` : ''}
144
+ </button>
146
145
 
147
- {/* Skip Option */}
148
- <button
149
- onClick={() => onComplete({ connectedAccounts: [], totalConnections: 0 })}
150
- className="w-full mt-2 py-2 text-gray-500 hover:text-gray-700 text-sm"
151
- >
152
- Skip for now
153
- </button>
146
+ {/* Skip Option */}
147
+ <button
148
+ onClick={() => onComplete({ connectedAccounts: [], totalConnections: 0 })}
149
+ className="w-full mt-2 py-2 text-gray-500 hover:text-gray-700 text-xs sm:text-sm"
150
+ >
151
+ Skip for now
152
+ </button>
153
+ </div>
154
154
  </div>
155
155
  );
156
156
  }
package/src/index.js CHANGED
@@ -1,7 +1,6 @@
1
1
  // src/index.js
2
2
 
3
3
  import { Onairos } from "./onairos.jsx";
4
- import { OnairosClient } from "./sdk/OnairosClient.js";
5
4
 
6
5
  // Export the original Onairos component
7
6
  export { Onairos };
@@ -9,12 +8,4 @@ export { Onairos };
9
8
  // Export the new Onairos SDK
10
9
  export { OnairosClient };
11
10
 
12
- // Export SDK components for advanced usage
13
- export { LLMWrapper } from "./sdk/LLMWrapper.js";
14
- export { MemoryManager } from "./sdk/MemoryManager.js";
15
- export { SessionManager } from "./sdk/SessionManager.js";
16
-
17
- // Export utility functions
18
- export { extractMemory, hasMeaningfulMemory, cleanMemoryData } from "./utils/extractMemory.js";
19
-
20
11
  // You can also export additional functions or constants if needed
package/src/onairos.jsx CHANGED
@@ -1,13 +1,6 @@
1
1
  import React from 'react';
2
2
  import { OnairosButton } from './onairosButton.jsx';
3
3
 
4
- // Import SDK components
5
- import { OnairosClient } from './sdk/OnairosClient.js';
6
- import { LLMWrapper } from './sdk/LLMWrapper.js';
7
- import { MemoryManager } from './sdk/MemoryManager.js';
8
- import { SessionManager } from './sdk/SessionManager.js';
9
- import { extractMemory } from './utils/extractMemory.js';
10
-
11
4
  // Configuration object for the Telegram SDK
12
5
 
13
6
  export function Onairos(props) {
@@ -19,13 +12,4 @@ export function Onairos(props) {
19
12
  );
20
13
  }
21
14
 
22
- // Export SDK components for direct usage
23
- export {
24
- OnairosClient,
25
- LLMWrapper,
26
- MemoryManager,
27
- SessionManager,
28
- extractMemory
29
- };
30
-
31
15
  export default Onairos;
@@ -1,221 +0,0 @@
1
- import OpenAI from 'openai';
2
- import Anthropic from '@anthropic-ai/sdk';
3
- import { GoogleGenerativeAI } from '@google/generative-ai';
4
-
5
- /**
6
- * LLM Wrapper that provides unified interface for multiple LLM providers
7
- * Supports OpenAI, Anthropic Claude, and Google Gemini
8
- */
9
- export class LLMWrapper {
10
- constructor({ openaiApiKey, anthropicApiKey, googleApiKey }) {
11
- // Initialize OpenAI client
12
- this.openai = openaiApiKey ? new OpenAI({ apiKey: openaiApiKey }) : null;
13
-
14
- // Initialize Anthropic client
15
- this.anthropic = anthropicApiKey ? new Anthropic({ apiKey: anthropicApiKey }) : null;
16
-
17
- // Initialize Google Gemini client
18
- this.google = googleApiKey ? new GoogleGenerativeAI(googleApiKey) : null;
19
- }
20
-
21
- /**
22
- * Create a completion using the specified model
23
- * @param {Object} params - Completion parameters
24
- * @param {string} params.model - Model name
25
- * @param {Array} params.messages - Messages array
26
- * @param {Object} params.options - Additional options
27
- * @returns {Promise<Object>} Standardized response
28
- */
29
- async createCompletion({ model, messages, options = {} }) {
30
- const modelLower = model.toLowerCase();
31
-
32
- // OpenAI models
33
- if (modelLower.includes('gpt') || modelLower.includes('o1')) {
34
- return this._createOpenAICompletion({ model, messages, options });
35
- }
36
-
37
- // Anthropic models
38
- if (modelLower.includes('claude')) {
39
- return this._createAnthropicCompletion({ model, messages, options });
40
- }
41
-
42
- // Google Gemini models
43
- if (modelLower.includes('gemini')) {
44
- return this._createGoogleCompletion({ model, messages, options });
45
- }
46
-
47
- throw new Error(`Unsupported model: ${model}`);
48
- }
49
-
50
- /**
51
- * Create OpenAI completion
52
- */
53
- async _createOpenAICompletion({ model, messages, options }) {
54
- if (!this.openai) {
55
- throw new Error('OpenAI not configured. Please provide openaiApiKey.');
56
- }
57
-
58
- try {
59
- const completion = await this.openai.chat.completions.create({
60
- model,
61
- messages,
62
- temperature: options.temperature || 0.7,
63
- max_tokens: options.max_tokens || 1000,
64
- top_p: options.top_p || 1,
65
- frequency_penalty: options.frequency_penalty || 0,
66
- presence_penalty: options.presence_penalty || 0,
67
- ...options
68
- });
69
-
70
- return {
71
- id: completion.id,
72
- content: completion.choices[0].message.content,
73
- finish_reason: completion.choices[0].finish_reason,
74
- usage: completion.usage
75
- };
76
- } catch (error) {
77
- throw new Error(`OpenAI API error: ${error.message}`);
78
- }
79
- }
80
-
81
- /**
82
- * Create Anthropic completion
83
- */
84
- async _createAnthropicCompletion({ model, messages, options }) {
85
- if (!this.anthropic) {
86
- throw new Error('Anthropic not configured. Please provide anthropicApiKey.');
87
- }
88
-
89
- try {
90
- // Convert messages format for Anthropic
91
- const anthropicMessages = this._convertMessagesForAnthropic(messages);
92
-
93
- const completion = await this.anthropic.messages.create({
94
- model,
95
- messages: anthropicMessages.messages,
96
- system: anthropicMessages.system,
97
- max_tokens: options.max_tokens || 1000,
98
- temperature: options.temperature || 0.7,
99
- top_p: options.top_p || 1,
100
- ...options
101
- });
102
-
103
- return {
104
- id: completion.id,
105
- content: completion.content[0].text,
106
- finish_reason: completion.stop_reason,
107
- usage: {
108
- prompt_tokens: completion.usage.input_tokens,
109
- completion_tokens: completion.usage.output_tokens,
110
- total_tokens: completion.usage.input_tokens + completion.usage.output_tokens
111
- }
112
- };
113
- } catch (error) {
114
- throw new Error(`Anthropic API error: ${error.message}`);
115
- }
116
- }
117
-
118
- /**
119
- * Create Google Gemini completion
120
- */
121
- async _createGoogleCompletion({ model, messages, options }) {
122
- if (!this.google) {
123
- throw new Error('Google not configured. Please provide googleApiKey.');
124
- }
125
-
126
- try {
127
- const geminiModel = this.google.getGenerativeModel({ model });
128
-
129
- // Convert messages to Gemini format
130
- const geminiMessages = this._convertMessagesForGemini(messages);
131
-
132
- const result = await geminiModel.generateContent({
133
- contents: geminiMessages,
134
- generationConfig: {
135
- temperature: options.temperature || 0.7,
136
- maxOutputTokens: options.max_tokens || 1000,
137
- topP: options.top_p || 1,
138
- ...options
139
- }
140
- });
141
-
142
- const response = await result.response;
143
-
144
- return {
145
- id: `gemini-${Date.now()}`,
146
- content: response.text(),
147
- finish_reason: 'stop',
148
- usage: {
149
- prompt_tokens: 0, // Gemini doesn't provide token counts
150
- completion_tokens: 0,
151
- total_tokens: 0
152
- }
153
- };
154
- } catch (error) {
155
- throw new Error(`Google Gemini API error: ${error.message}`);
156
- }
157
- }
158
-
159
- /**
160
- * Convert messages format for Anthropic (separate system messages)
161
- */
162
- _convertMessagesForAnthropic(messages) {
163
- const systemMessages = [];
164
- const conversationMessages = [];
165
-
166
- for (const message of messages) {
167
- if (message.role === 'system') {
168
- systemMessages.push(message.content);
169
- } else {
170
- conversationMessages.push({
171
- role: message.role,
172
- content: message.content
173
- });
174
- }
175
- }
176
-
177
- return {
178
- system: systemMessages.join('\n'),
179
- messages: conversationMessages
180
- };
181
- }
182
-
183
- /**
184
- * Convert messages format for Google Gemini
185
- */
186
- _convertMessagesForGemini(messages) {
187
- return messages.map(message => ({
188
- role: message.role === 'assistant' ? 'model' : 'user',
189
- parts: [{ text: message.content }]
190
- }));
191
- }
192
-
193
- /**
194
- * Get available models for each provider
195
- */
196
- getAvailableModels() {
197
- return {
198
- openai: [
199
- 'gpt-4',
200
- 'gpt-4-turbo',
201
- 'gpt-4-turbo-preview',
202
- 'gpt-3.5-turbo',
203
- 'gpt-3.5-turbo-16k',
204
- 'o1-preview',
205
- 'o1-mini'
206
- ],
207
- anthropic: [
208
- 'claude-3-opus-20240229',
209
- 'claude-3-sonnet-20240229',
210
- 'claude-3-haiku-20240307',
211
- 'claude-3-5-sonnet-20241022'
212
- ],
213
- google: [
214
- 'gemini-pro',
215
- 'gemini-pro-vision',
216
- 'gemini-1.5-pro',
217
- 'gemini-1.5-flash'
218
- ]
219
- };
220
- }
221
- }