@mirra-messenger/sdk 0.1.0

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/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Oz Networks Ltd
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
package/README.md ADDED
@@ -0,0 +1,290 @@
1
+ # Mirra SDK for TypeScript/JavaScript
2
+
3
+ Official TypeScript/JavaScript SDK for the [Mirra API](https://docs.getmirra.app).
4
+
5
+ Build, deploy, and monetize AI agents, serverless scripts, and API integrations with a simple, type-safe client library.
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ npm install @mirra-messenger/sdk
11
+ ```
12
+
13
+ or with yarn:
14
+
15
+ ```bash
16
+ yarn add @mirra-messenger/sdk
17
+ ```
18
+
19
+ ## Quick Start
20
+
21
+ ```typescript
22
+ import { MirraSDK } from '@mirra-messenger/sdk';
23
+
24
+ // Initialize the SDK with your API key
25
+ const mirra = new MirraSDK({
26
+ apiKey: 'your_api_key_here'
27
+ });
28
+
29
+ // Create a memory
30
+ const memory = await mirra.memory.create({
31
+ content: 'Important information to remember',
32
+ type: 'note',
33
+ metadata: { category: 'work' }
34
+ });
35
+
36
+ // Chat with AI
37
+ const response = await mirra.ai.chat({
38
+ messages: [
39
+ { role: 'user', content: 'Hello, how are you?' }
40
+ ]
41
+ });
42
+
43
+ console.log(response.content);
44
+ ```
45
+
46
+ ## Authentication
47
+
48
+ Get your API key from the Mirra mobile app:
49
+ 1. Open the Mirra app
50
+ 2. Go to **Settings** → **API Keys**
51
+ 3. Click **Generate New Key**
52
+ 4. Copy your API key
53
+
54
+ ⚠️ **Keep your API key secure!** Never commit it to version control or expose it in client-side code.
55
+
56
+ ## Usage Examples
57
+
58
+ ### Memory Operations
59
+
60
+ ```typescript
61
+ // Create a memory
62
+ const memory = await mirra.memory.create({
63
+ content: 'Meeting notes from today',
64
+ type: 'note',
65
+ metadata: { date: '2025-11-15', attendees: ['Alice', 'Bob'] }
66
+ });
67
+
68
+ // Search memories
69
+ const results = await mirra.memory.search({
70
+ query: 'meeting notes',
71
+ limit: 10,
72
+ threshold: 0.7
73
+ });
74
+
75
+ // Update a memory
76
+ await mirra.memory.update(memory.id, {
77
+ content: 'Updated meeting notes',
78
+ metadata: { status: 'reviewed' }
79
+ });
80
+
81
+ // Delete a memory
82
+ await mirra.memory.delete(memory.id);
83
+ ```
84
+
85
+ ### AI Operations
86
+
87
+ ```typescript
88
+ // Simple chat
89
+ const chat = await mirra.ai.chat({
90
+ messages: [
91
+ { role: 'system', content: 'You are a helpful assistant.' },
92
+ { role: 'user', content: 'Explain quantum computing in simple terms.' }
93
+ ],
94
+ model: 'claude-3-5-sonnet-20241022',
95
+ temperature: 0.7,
96
+ maxTokens: 1000
97
+ });
98
+
99
+ // Decision making
100
+ const decision = await mirra.ai.decide({
101
+ prompt: 'Which shipping method should I use?',
102
+ options: [
103
+ { id: 'ground', label: 'Ground Shipping', metadata: { days: 5, cost: 5 } },
104
+ { id: 'express', label: 'Express', metadata: { days: 2, cost: 15 } },
105
+ { id: 'overnight', label: 'Overnight', metadata: { days: 1, cost: 30 } }
106
+ ],
107
+ context: { urgency: 'high', budget: 'medium' }
108
+ });
109
+
110
+ console.log(`Selected: ${decision.selectedOption}`);
111
+ console.log(`Reasoning: ${decision.reasoning}`);
112
+
113
+ // Batch chat
114
+ const batch = await mirra.ai.batchChat({
115
+ requests: [
116
+ { message: 'What is 2+2?' },
117
+ { message: 'What is the capital of France?' },
118
+ { message: 'Explain photosynthesis briefly.' }
119
+ ]
120
+ });
121
+ ```
122
+
123
+ ### Agent Management
124
+
125
+ ```typescript
126
+ // Create an agent
127
+ const agent = await mirra.agents.create({
128
+ subdomain: 'my-assistant',
129
+ name: 'My Personal Assistant',
130
+ systemPrompt: 'You are a helpful personal assistant.',
131
+ description: 'An AI assistant for daily tasks',
132
+ enabled: true
133
+ });
134
+
135
+ // List agents
136
+ const agents = await mirra.agents.list();
137
+
138
+ // Update an agent
139
+ await mirra.agents.update(agent.id, {
140
+ name: 'Updated Assistant Name',
141
+ enabled: false
142
+ });
143
+
144
+ // Delete an agent
145
+ await mirra.agents.delete(agent.id);
146
+ ```
147
+
148
+ ### Script Operations
149
+
150
+ ```typescript
151
+ // Create a script
152
+ const script = await mirra.scripts.create({
153
+ name: 'Data Processor',
154
+ description: 'Processes incoming data',
155
+ code: `
156
+ export async function handler(event, context, mirra) {
157
+ // Your script logic here
158
+ const result = await mirra.memory.search({
159
+ query: event.query,
160
+ limit: 5
161
+ });
162
+
163
+ return { success: true, results: result };
164
+ }
165
+ `,
166
+ runtime: 'nodejs18',
167
+ config: {
168
+ timeout: 30,
169
+ memory: 256,
170
+ allowedResources: []
171
+ }
172
+ });
173
+
174
+ // Deploy a script
175
+ await mirra.scripts.deploy(script.id);
176
+
177
+ // Invoke a script
178
+ const result = await mirra.scripts.invoke({
179
+ scriptId: script.id,
180
+ payload: { query: 'test data' }
181
+ });
182
+
183
+ console.log(result);
184
+ ```
185
+
186
+ ### Resource Operations
187
+
188
+ ```typescript
189
+ // List available resources
190
+ const resources = await mirra.resources.list();
191
+
192
+ // Call a resource method
193
+ const result = await mirra.resources.call({
194
+ resourceId: 'weather-api',
195
+ method: 'getCurrentWeather',
196
+ params: { city: 'San Francisco' }
197
+ });
198
+ ```
199
+
200
+ ### Template Operations
201
+
202
+ ```typescript
203
+ // List templates
204
+ const templates = await mirra.templates.list();
205
+
206
+ // Get template details
207
+ const template = await mirra.templates.get('template-id');
208
+
209
+ // Install a template
210
+ await mirra.templates.install('template-id');
211
+ ```
212
+
213
+ ### Marketplace
214
+
215
+ ```typescript
216
+ // Browse marketplace
217
+ const items = await mirra.marketplace.browse({
218
+ type: 'agent',
219
+ category: 'productivity',
220
+ limit: 20
221
+ });
222
+
223
+ // Search marketplace
224
+ const searchResults = await mirra.marketplace.search('weather assistant');
225
+ ```
226
+
227
+ ## Configuration
228
+
229
+ ### Custom Base URL
230
+
231
+ For development or custom deployments:
232
+
233
+ ```typescript
234
+ const mirra = new MirraSDK({
235
+ apiKey: 'your_api_key',
236
+ baseUrl: 'http://localhost:3000/api/sdk/v1'
237
+ });
238
+ ```
239
+
240
+ ### Error Handling
241
+
242
+ All SDK methods throw errors that include:
243
+ - `message`: Human-readable error message
244
+ - `code`: Error code (e.g., 'VALIDATION_ERROR', 'NOT_FOUND')
245
+ - `statusCode`: HTTP status code
246
+ - `details`: Additional error details (if available)
247
+
248
+ ```typescript
249
+ try {
250
+ await mirra.memory.create({ content: '' }); // Invalid: empty content
251
+ } catch (error) {
252
+ console.error('Error code:', error.code);
253
+ console.error('Message:', error.message);
254
+ console.error('Status:', error.statusCode);
255
+ console.error('Details:', error.details);
256
+ }
257
+ ```
258
+
259
+ ## TypeScript Support
260
+
261
+ This SDK is written in TypeScript and provides full type definitions out of the box. No additional `@types` packages needed!
262
+
263
+ ```typescript
264
+ import { MirraSDK, ChatMessage, Agent } from '@mirra-messenger/sdk';
265
+
266
+ const messages: ChatMessage[] = [
267
+ { role: 'user', content: 'Hello!' }
268
+ ];
269
+
270
+ const agent: Agent = await mirra.agents.create({
271
+ subdomain: 'test',
272
+ name: 'Test Agent',
273
+ systemPrompt: 'You are helpful.'
274
+ });
275
+ ```
276
+
277
+ ## API Reference
278
+
279
+ For complete API documentation, visit [https://docs.getmirra.app](https://docs.getmirra.app)
280
+
281
+ ## Support
282
+
283
+ - **Documentation**: [https://docs.getmirra.app](https://docs.getmirra.app)
284
+ - **Issues**: [GitHub Issues](https://github.com/Oz-Networks/fxn-monorepo/issues)
285
+ - **Email**: support@getmirra.app
286
+
287
+ ## License
288
+
289
+ MIT
290
+
@@ -0,0 +1,154 @@
1
+ /**
2
+ * Mirra SDK Client
3
+ */
4
+ import { MirraSDKConfig, MemoryEntity, MemorySearchQuery, MemorySearchResult, MemoryQueryParams, MemoryUpdateParams, ChatRequest, ChatResponse, DecideRequest, DecideResponse, BatchChatRequest, Agent, CreateAgentParams, UpdateAgentParams, Script, CreateScriptParams, UpdateScriptParams, InvokeScriptParams, ScriptInvocationResult, Resource, CallResourceParams, Template, MarketplaceItem, MarketplaceFilters } from './types';
5
+ export declare class MirraSDK {
6
+ private client;
7
+ private apiKey;
8
+ constructor(config: MirraSDKConfig);
9
+ memory: {
10
+ /**
11
+ * Create a new memory entity
12
+ */
13
+ create: (entity: MemoryEntity) => Promise<{
14
+ id: string;
15
+ }>;
16
+ /**
17
+ * Search memories by semantic similarity
18
+ */
19
+ search: (query: MemorySearchQuery) => Promise<MemorySearchResult[]>;
20
+ /**
21
+ * Query memories with filters
22
+ */
23
+ query: (params: MemoryQueryParams) => Promise<MemoryEntity[]>;
24
+ /**
25
+ * Find a single memory by ID
26
+ */
27
+ findOne: (id: string) => Promise<MemoryEntity | null>;
28
+ /**
29
+ * Update a memory entity
30
+ */
31
+ update: (id: string, updates: MemoryUpdateParams) => Promise<{
32
+ success: boolean;
33
+ }>;
34
+ /**
35
+ * Delete a memory entity
36
+ */
37
+ delete: (id: string) => Promise<{
38
+ success: boolean;
39
+ }>;
40
+ };
41
+ ai: {
42
+ /**
43
+ * Send a chat request to the AI
44
+ */
45
+ chat: (request: ChatRequest) => Promise<ChatResponse>;
46
+ /**
47
+ * Ask AI to make a decision from options
48
+ */
49
+ decide: (request: DecideRequest) => Promise<DecideResponse>;
50
+ /**
51
+ * Process multiple chat requests in batch
52
+ */
53
+ batchChat: (request: BatchChatRequest) => Promise<ChatResponse[]>;
54
+ };
55
+ agents: {
56
+ /**
57
+ * Create a new agent
58
+ */
59
+ create: (params: CreateAgentParams) => Promise<Agent>;
60
+ /**
61
+ * Get an agent by ID
62
+ */
63
+ get: (id: string) => Promise<Agent>;
64
+ /**
65
+ * List all agents
66
+ */
67
+ list: () => Promise<Agent[]>;
68
+ /**
69
+ * Update an agent
70
+ */
71
+ update: (id: string, params: UpdateAgentParams) => Promise<Agent>;
72
+ /**
73
+ * Delete an agent
74
+ */
75
+ delete: (id: string) => Promise<{
76
+ success: boolean;
77
+ }>;
78
+ };
79
+ scripts: {
80
+ /**
81
+ * Create a new script
82
+ */
83
+ create: (params: CreateScriptParams) => Promise<Script>;
84
+ /**
85
+ * Get a script by ID
86
+ */
87
+ get: (id: string) => Promise<Script>;
88
+ /**
89
+ * List all scripts
90
+ */
91
+ list: () => Promise<Script[]>;
92
+ /**
93
+ * Update a script
94
+ */
95
+ update: (id: string, params: UpdateScriptParams) => Promise<Script>;
96
+ /**
97
+ * Delete a script
98
+ */
99
+ delete: (id: string) => Promise<{
100
+ success: boolean;
101
+ }>;
102
+ /**
103
+ * Deploy a script
104
+ */
105
+ deploy: (id: string) => Promise<{
106
+ success: boolean;
107
+ }>;
108
+ /**
109
+ * Invoke a script
110
+ */
111
+ invoke: (params: InvokeScriptParams) => Promise<ScriptInvocationResult>;
112
+ };
113
+ resources: {
114
+ /**
115
+ * Call a resource method
116
+ */
117
+ call: (params: CallResourceParams) => Promise<any>;
118
+ /**
119
+ * List available resources
120
+ */
121
+ list: () => Promise<Resource[]>;
122
+ /**
123
+ * Get a resource by ID
124
+ */
125
+ get: (id: string) => Promise<Resource>;
126
+ };
127
+ templates: {
128
+ /**
129
+ * List available templates
130
+ */
131
+ list: () => Promise<Template[]>;
132
+ /**
133
+ * Get a template by ID
134
+ */
135
+ get: (id: string) => Promise<Template>;
136
+ /**
137
+ * Install a template
138
+ */
139
+ install: (id: string) => Promise<{
140
+ success: boolean;
141
+ }>;
142
+ };
143
+ marketplace: {
144
+ /**
145
+ * Browse marketplace items
146
+ */
147
+ browse: (filters?: MarketplaceFilters) => Promise<MarketplaceItem[]>;
148
+ /**
149
+ * Search marketplace
150
+ */
151
+ search: (query: string) => Promise<MarketplaceItem[]>;
152
+ };
153
+ }
154
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EACL,cAAc,EAEd,YAAY,EACZ,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,kBAAkB,EAClB,WAAW,EACX,YAAY,EACZ,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,KAAK,EACL,iBAAiB,EACjB,iBAAiB,EACjB,MAAM,EACN,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,sBAAsB,EACtB,QAAQ,EACR,kBAAkB,EAClB,QAAQ,EACR,eAAe,EACf,kBAAkB,EACnB,MAAM,SAAS,CAAC;AAEjB,qBAAa,QAAQ;IACnB,OAAO,CAAC,MAAM,CAAgB;IAC9B,OAAO,CAAC,MAAM,CAAS;gBAEX,MAAM,EAAE,cAAc;IAgClC,MAAM;QACJ;;WAEG;yBACoB,YAAY,KAAG,OAAO,CAAC;YAAE,EAAE,EAAE,MAAM,CAAA;SAAE,CAAC;QAQ7D;;WAEG;wBAEM,iBAAiB,KACvB,OAAO,CAAC,kBAAkB,EAAE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;WAEG;qBACgB,MAAM,KAAG,OAAO,CAAC;YAAE,OAAO,EAAE,OAAO,CAAA;SAAE,CAAC;QAOzD;;WAEG;yBAEO,kBAAkB,KACzB,OAAO,CAAC,sBAAsB,CAAC;MAQlC;IAMF,SAAS;QACP;;WAEG;uBACkB,kBAAkB,KAAG,OAAO,CAAC,GAAG,CAAC;QAQtD;;WAEG;oBACa,OAAO,CAAC,QAAQ,EAAE,CAAC;QAOnC;;WAEG;kBACa,MAAM,KAAG,OAAO,CAAC,QAAQ,CAAC;MAM1C;IAMF,SAAS;QACP;;WAEG;oBACa,OAAO,CAAC,QAAQ,EAAE,CAAC;QAOnC;;WAEG;kBACa,MAAM,KAAG,OAAO,CAAC,QAAQ,CAAC;QAO1C;;WAEG;sBACiB,MAAM,KAAG,OAAO,CAAC;YAAE,OAAO,EAAE,OAAO,CAAA;SAAE,CAAC;MAM1D;IAMF,WAAW;QACT;;WAEG;2BACsB,kBAAkB,KAAG,OAAO,CAAC,eAAe,EAAE,CAAC;QAQxE;;WAEG;wBACmB,MAAM,KAAG,OAAO,CAAC,eAAe,EAAE,CAAC;MAOzD;CACH"}
package/dist/client.js ADDED
@@ -0,0 +1,276 @@
1
+ "use strict";
2
+ /**
3
+ * Mirra SDK Client
4
+ */
5
+ var __importDefault = (this && this.__importDefault) || function (mod) {
6
+ return (mod && mod.__esModule) ? mod : { "default": mod };
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.MirraSDK = void 0;
10
+ const axios_1 = __importDefault(require("axios"));
11
+ class MirraSDK {
12
+ constructor(config) {
13
+ // ============================================================================
14
+ // Memory Operations
15
+ // ============================================================================
16
+ this.memory = {
17
+ /**
18
+ * Create a new memory entity
19
+ */
20
+ create: async (entity) => {
21
+ const response = await this.client.post('/memory', entity);
22
+ return response.data.data;
23
+ },
24
+ /**
25
+ * Search memories by semantic similarity
26
+ */
27
+ search: async (query) => {
28
+ const response = await this.client.post('/memory/search', query);
29
+ return response.data.data;
30
+ },
31
+ /**
32
+ * Query memories with filters
33
+ */
34
+ query: async (params) => {
35
+ const response = await this.client.post('/memory/query', params);
36
+ return response.data.data;
37
+ },
38
+ /**
39
+ * Find a single memory by ID
40
+ */
41
+ findOne: async (id) => {
42
+ const response = await this.client.post('/memory/findOne', { id });
43
+ return response.data.data;
44
+ },
45
+ /**
46
+ * Update a memory entity
47
+ */
48
+ update: async (id, updates) => {
49
+ const response = await this.client.post('/memory/update', { id, ...updates });
50
+ return response.data.data;
51
+ },
52
+ /**
53
+ * Delete a memory entity
54
+ */
55
+ delete: async (id) => {
56
+ const response = await this.client.post('/memory/delete', { id });
57
+ return response.data.data;
58
+ },
59
+ };
60
+ // ============================================================================
61
+ // AI Operations
62
+ // ============================================================================
63
+ this.ai = {
64
+ /**
65
+ * Send a chat request to the AI
66
+ */
67
+ chat: async (request) => {
68
+ const response = await this.client.post('/ai/chat', request);
69
+ return response.data.data;
70
+ },
71
+ /**
72
+ * Ask AI to make a decision from options
73
+ */
74
+ decide: async (request) => {
75
+ const response = await this.client.post('/ai/decide', request);
76
+ return response.data.data;
77
+ },
78
+ /**
79
+ * Process multiple chat requests in batch
80
+ */
81
+ batchChat: async (request) => {
82
+ const response = await this.client.post('/ai/batchChat', request);
83
+ return response.data.data;
84
+ },
85
+ };
86
+ // ============================================================================
87
+ // Agent Operations
88
+ // ============================================================================
89
+ this.agents = {
90
+ /**
91
+ * Create a new agent
92
+ */
93
+ create: async (params) => {
94
+ const response = await this.client.post('/agents', params);
95
+ return response.data.data;
96
+ },
97
+ /**
98
+ * Get an agent by ID
99
+ */
100
+ get: async (id) => {
101
+ const response = await this.client.get(`/agents/${id}`);
102
+ return response.data.data;
103
+ },
104
+ /**
105
+ * List all agents
106
+ */
107
+ list: async () => {
108
+ const response = await this.client.get('/agents');
109
+ return response.data.data;
110
+ },
111
+ /**
112
+ * Update an agent
113
+ */
114
+ update: async (id, params) => {
115
+ const response = await this.client.patch(`/agents/${id}`, params);
116
+ return response.data.data;
117
+ },
118
+ /**
119
+ * Delete an agent
120
+ */
121
+ delete: async (id) => {
122
+ const response = await this.client.delete(`/agents/${id}`);
123
+ return response.data.data;
124
+ },
125
+ };
126
+ // ============================================================================
127
+ // Script Operations
128
+ // ============================================================================
129
+ this.scripts = {
130
+ /**
131
+ * Create a new script
132
+ */
133
+ create: async (params) => {
134
+ const response = await this.client.post('/scripts', params);
135
+ return response.data.data;
136
+ },
137
+ /**
138
+ * Get a script by ID
139
+ */
140
+ get: async (id) => {
141
+ const response = await this.client.get(`/scripts/${id}`);
142
+ return response.data.data;
143
+ },
144
+ /**
145
+ * List all scripts
146
+ */
147
+ list: async () => {
148
+ const response = await this.client.get('/scripts');
149
+ return response.data.data;
150
+ },
151
+ /**
152
+ * Update a script
153
+ */
154
+ update: async (id, params) => {
155
+ const response = await this.client.patch(`/scripts/${id}`, params);
156
+ return response.data.data;
157
+ },
158
+ /**
159
+ * Delete a script
160
+ */
161
+ delete: async (id) => {
162
+ const response = await this.client.delete(`/scripts/${id}`);
163
+ return response.data.data;
164
+ },
165
+ /**
166
+ * Deploy a script
167
+ */
168
+ deploy: async (id) => {
169
+ const response = await this.client.post(`/scripts/${id}/deploy`);
170
+ return response.data.data;
171
+ },
172
+ /**
173
+ * Invoke a script
174
+ */
175
+ invoke: async (params) => {
176
+ const response = await this.client.post(`/scripts/${params.scriptId}/invoke`, {
177
+ payload: params.payload,
178
+ });
179
+ return response.data.data;
180
+ },
181
+ };
182
+ // ============================================================================
183
+ // Resource Operations
184
+ // ============================================================================
185
+ this.resources = {
186
+ /**
187
+ * Call a resource method
188
+ */
189
+ call: async (params) => {
190
+ const response = await this.client.post('/resources/call', params);
191
+ return response.data.data;
192
+ },
193
+ /**
194
+ * List available resources
195
+ */
196
+ list: async () => {
197
+ const response = await this.client.get('/resources');
198
+ return response.data.data;
199
+ },
200
+ /**
201
+ * Get a resource by ID
202
+ */
203
+ get: async (id) => {
204
+ const response = await this.client.get(`/resources/${id}`);
205
+ return response.data.data;
206
+ },
207
+ };
208
+ // ============================================================================
209
+ // Template Operations
210
+ // ============================================================================
211
+ this.templates = {
212
+ /**
213
+ * List available templates
214
+ */
215
+ list: async () => {
216
+ const response = await this.client.get('/templates');
217
+ return response.data.data;
218
+ },
219
+ /**
220
+ * Get a template by ID
221
+ */
222
+ get: async (id) => {
223
+ const response = await this.client.get(`/templates/${id}`);
224
+ return response.data.data;
225
+ },
226
+ /**
227
+ * Install a template
228
+ */
229
+ install: async (id) => {
230
+ const response = await this.client.post(`/templates/${id}/install`);
231
+ return response.data.data;
232
+ },
233
+ };
234
+ // ============================================================================
235
+ // Marketplace Operations
236
+ // ============================================================================
237
+ this.marketplace = {
238
+ /**
239
+ * Browse marketplace items
240
+ */
241
+ browse: async (filters) => {
242
+ const response = await this.client.get('/marketplace', { params: filters });
243
+ return response.data.data;
244
+ },
245
+ /**
246
+ * Search marketplace
247
+ */
248
+ search: async (query) => {
249
+ const response = await this.client.get('/marketplace/search', { params: { q: query } });
250
+ return response.data.data;
251
+ },
252
+ };
253
+ this.apiKey = config.apiKey;
254
+ const baseUrl = config.baseUrl || 'https://api.fxn.world/api/sdk/v1';
255
+ this.client = axios_1.default.create({
256
+ baseURL: baseUrl,
257
+ headers: {
258
+ 'Content-Type': 'application/json',
259
+ 'X-API-Key': this.apiKey,
260
+ },
261
+ });
262
+ // Response interceptor to handle errors
263
+ this.client.interceptors.response.use((response) => response, (error) => {
264
+ if (error.response?.data?.error) {
265
+ const err = new Error(error.response.data.error.message);
266
+ err.code = error.response.data.error.code;
267
+ err.details = error.response.data.error.details;
268
+ err.statusCode = error.response.status;
269
+ throw err;
270
+ }
271
+ throw error;
272
+ });
273
+ }
274
+ }
275
+ exports.MirraSDK = MirraSDK;
276
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;AAEH,kDAAyD;AA6BzD,MAAa,QAAQ;IAInB,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,EAAE,IAAI,CAAC,MAAM;aACzB;SACF,CAAC,CAAC;QAEH,wCAAwC;QACxC,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,QAAQ,CAAC,GAAG,CACnC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,EACtB,CAAC,KAAgC,EAAE,EAAE;YACnC,IAAI,KAAK,CAAC,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;gBAChC,MAAM,GAAG,GAAG,IAAI,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;gBACxD,GAAW,CAAC,IAAI,GAAG,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;gBAClD,GAAW,CAAC,OAAO,GAAG,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC;gBACxD,GAAW,CAAC,UAAU,GAAG,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC;gBAChD,MAAM,GAAG,CAAC;YACZ,CAAC;YACD,MAAM,KAAK,CAAC;QACd,CAAC,CACF,CAAC;IACJ,CAAC;CAoWF;AAlYD,4BAkYC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Mirra SDK - Official TypeScript/JavaScript Client
3
+ *
4
+ * @packageDocumentation
5
+ */
6
+ export { MirraSDK } from './client';
7
+ export * from './types';
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACpC,cAAc,SAAS,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ /**
3
+ * Mirra SDK - Official TypeScript/JavaScript Client
4
+ *
5
+ * @packageDocumentation
6
+ */
7
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
8
+ if (k2 === undefined) k2 = k;
9
+ var desc = Object.getOwnPropertyDescriptor(m, k);
10
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
11
+ desc = { enumerable: true, get: function() { return m[k]; } };
12
+ }
13
+ Object.defineProperty(o, k2, desc);
14
+ }) : (function(o, m, k, k2) {
15
+ if (k2 === undefined) k2 = k;
16
+ o[k2] = m[k];
17
+ }));
18
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
19
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
20
+ };
21
+ Object.defineProperty(exports, "__esModule", { value: true });
22
+ exports.MirraSDK = void 0;
23
+ var client_1 = require("./client");
24
+ Object.defineProperty(exports, "MirraSDK", { enumerable: true, get: function () { return client_1.MirraSDK; } });
25
+ __exportStar(require("./types"), exports);
26
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;AAEH,mCAAoC;AAA3B,kGAAA,QAAQ,OAAA;AACjB,0CAAwB"}
@@ -0,0 +1,197 @@
1
+ /**
2
+ * Mirra SDK Types
3
+ */
4
+ export interface MirraSDKConfig {
5
+ apiKey: string;
6
+ baseUrl?: string;
7
+ }
8
+ export interface MirraResponse<T = any> {
9
+ success: boolean;
10
+ data?: T;
11
+ error?: {
12
+ code: string;
13
+ message: string;
14
+ details?: any;
15
+ };
16
+ }
17
+ export interface MemoryEntity {
18
+ content: string;
19
+ type?: string;
20
+ metadata?: Record<string, any>;
21
+ embedding?: number[];
22
+ }
23
+ export interface MemorySearchQuery {
24
+ query: string;
25
+ limit?: number;
26
+ threshold?: number;
27
+ filters?: Record<string, any>;
28
+ }
29
+ export interface MemorySearchResult {
30
+ id: string;
31
+ content: string;
32
+ type?: string;
33
+ metadata?: Record<string, any>;
34
+ score: number;
35
+ }
36
+ export interface MemoryQueryParams {
37
+ filters?: Record<string, any>;
38
+ limit?: number;
39
+ }
40
+ export interface MemoryUpdateParams {
41
+ content?: string;
42
+ metadata?: Record<string, any>;
43
+ }
44
+ export interface ChatMessage {
45
+ role: 'user' | 'assistant' | 'system';
46
+ content: string;
47
+ }
48
+ export interface ChatRequest {
49
+ messages: ChatMessage[];
50
+ model?: string;
51
+ temperature?: number;
52
+ maxTokens?: number;
53
+ }
54
+ export interface ChatResponse {
55
+ content: string;
56
+ model: string;
57
+ usage: {
58
+ inputTokens: number;
59
+ outputTokens: number;
60
+ };
61
+ }
62
+ export interface DecisionOption {
63
+ id: string;
64
+ label: string;
65
+ metadata?: Record<string, any>;
66
+ }
67
+ export interface DecideRequest {
68
+ prompt: string;
69
+ options: DecisionOption[];
70
+ context?: Record<string, any>;
71
+ model?: string;
72
+ }
73
+ export interface DecideResponse {
74
+ selectedOption: string;
75
+ reasoning: string;
76
+ }
77
+ export interface BatchChatRequest {
78
+ requests: Array<{
79
+ message: string;
80
+ model?: string;
81
+ }>;
82
+ }
83
+ export interface Agent {
84
+ id: string;
85
+ subdomain: string;
86
+ name: string;
87
+ description?: string;
88
+ systemPrompt: string;
89
+ enabled: boolean;
90
+ status: 'draft' | 'published';
91
+ createdAt: string;
92
+ updatedAt?: string;
93
+ }
94
+ export interface CreateAgentParams {
95
+ subdomain: string;
96
+ name: string;
97
+ systemPrompt: string;
98
+ description?: string;
99
+ enabled?: boolean;
100
+ }
101
+ export interface UpdateAgentParams {
102
+ name?: string;
103
+ systemPrompt?: string;
104
+ description?: string;
105
+ enabled?: boolean;
106
+ }
107
+ export interface Script {
108
+ id: string;
109
+ name: string;
110
+ description?: string;
111
+ code: string;
112
+ runtime: 'nodejs18' | 'python3.11';
113
+ config: {
114
+ timeout: number;
115
+ memory: number;
116
+ allowedResources?: string[];
117
+ };
118
+ status: 'draft' | 'deployed' | 'failed';
119
+ createdAt: string;
120
+ updatedAt?: string;
121
+ }
122
+ export interface CreateScriptParams {
123
+ name: string;
124
+ description?: string;
125
+ code: string;
126
+ runtime?: 'nodejs18' | 'python3.11';
127
+ config?: {
128
+ timeout?: number;
129
+ memory?: number;
130
+ allowedResources?: string[];
131
+ };
132
+ }
133
+ export interface UpdateScriptParams {
134
+ name?: string;
135
+ description?: string;
136
+ code?: string;
137
+ config?: {
138
+ timeout?: number;
139
+ memory?: number;
140
+ allowedResources?: string[];
141
+ };
142
+ }
143
+ export interface InvokeScriptParams {
144
+ scriptId: string;
145
+ payload?: any;
146
+ }
147
+ export interface ScriptInvocationResult {
148
+ success: boolean;
149
+ result?: any;
150
+ logs?: string;
151
+ error?: string;
152
+ duration?: number;
153
+ }
154
+ export interface Resource {
155
+ id: string;
156
+ name: string;
157
+ description?: string;
158
+ type: string;
159
+ config: Record<string, any>;
160
+ status: 'active' | 'inactive';
161
+ createdAt: string;
162
+ }
163
+ export interface CallResourceParams {
164
+ resourceId: string;
165
+ method: string;
166
+ params?: Record<string, any>;
167
+ }
168
+ export interface Template {
169
+ id: string;
170
+ name: string;
171
+ description?: string;
172
+ category?: string;
173
+ components: {
174
+ agents?: string[];
175
+ scripts?: string[];
176
+ resources?: string[];
177
+ };
178
+ createdAt: string;
179
+ }
180
+ export interface MarketplaceItem {
181
+ id: string;
182
+ name: string;
183
+ description?: string;
184
+ type: 'agent' | 'script' | 'resource' | 'template';
185
+ author: string;
186
+ price?: number;
187
+ rating?: number;
188
+ installs?: number;
189
+ }
190
+ export interface MarketplaceFilters {
191
+ type?: 'agent' | 'script' | 'resource' | 'template';
192
+ category?: string;
193
+ search?: string;
194
+ limit?: number;
195
+ offset?: number;
196
+ }
197
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,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AE,CAAC;QAClB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;QACnB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;KACtB,CAAC;IACF,SAAS,EAAE,MAAM,CAAC;CACnB;AAMD,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,OAAO,GAAG,QAAQ,GAAG,UAAU,GAAG,UAAU,CAAC;IACnD,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,kBAAkB;IACjC,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,UAAU,GAAG,UAAU,CAAC;IACpD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB"}
package/dist/types.js ADDED
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ /**
3
+ * Mirra SDK Types
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AAAA;;GAEG"}
package/package.json ADDED
@@ -0,0 +1,53 @@
1
+ {
2
+ "name": "@mirra-messenger/sdk",
3
+ "version": "0.1.0",
4
+ "description": "Official TypeScript/JavaScript SDK for the Mirra API",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "files": [
8
+ "dist",
9
+ "README.md",
10
+ "LICENSE"
11
+ ],
12
+ "scripts": {
13
+ "build": "tsc",
14
+ "prepublishOnly": "npm run build",
15
+ "test": "jest",
16
+ "lint": "eslint src --ext .ts",
17
+ "format": "prettier --write \"src/**/*.ts\""
18
+ },
19
+ "keywords": [
20
+ "mirra",
21
+ "ai",
22
+ "sdk",
23
+ "agents",
24
+ "automation",
25
+ "api"
26
+ ],
27
+ "author": "Mirra",
28
+ "license": "MIT",
29
+ "repository": {
30
+ "type": "git",
31
+ "url": "https://github.com/Oz-Networks/fxn-monorepo.git",
32
+ "directory": "packages/mirra-sdk-js"
33
+ },
34
+ "bugs": {
35
+ "url": "https://github.com/Oz-Networks/fxn-monorepo/issues"
36
+ },
37
+ "homepage": "https://docs.getmirra.app",
38
+ "dependencies": {
39
+ "axios": "^1.10.0"
40
+ },
41
+ "devDependencies": {
42
+ "@types/node": "^20.14.0",
43
+ "typescript": "^5.5.2",
44
+ "prettier": "^3.0.0",
45
+ "eslint": "^8.57.0",
46
+ "@typescript-eslint/eslint-plugin": "^6.0.0",
47
+ "@typescript-eslint/parser": "^6.0.0"
48
+ },
49
+ "engines": {
50
+ "node": ">=18.0.0"
51
+ }
52
+ }
53
+