@capgo/capacitor-llm 7.1.2

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/dist/docs.json ADDED
@@ -0,0 +1,466 @@
1
+ {
2
+ "api": {
3
+ "name": "LLMPlugin",
4
+ "slug": "llmplugin",
5
+ "docs": "LLM Plugin interface for interacting with on-device language models",
6
+ "tags": [],
7
+ "methods": [
8
+ {
9
+ "name": "createChat",
10
+ "signature": "() => Promise<{ id: string; instructions?: string; }>",
11
+ "parameters": [],
12
+ "returns": "Promise<{ id: string; instructions?: string | undefined; }>",
13
+ "tags": [
14
+ {
15
+ "name": "returns",
16
+ "text": "Promise with chat id and optional instructions"
17
+ }
18
+ ],
19
+ "docs": "Creates a new chat session",
20
+ "complexTypes": [],
21
+ "slug": "createchat"
22
+ },
23
+ {
24
+ "name": "sendMessage",
25
+ "signature": "(options: { chatId: string; message: string; }) => Promise<void>",
26
+ "parameters": [
27
+ {
28
+ "name": "options",
29
+ "docs": "- The chat id and message to send",
30
+ "type": "{ chatId: string; message: string; }"
31
+ }
32
+ ],
33
+ "returns": "Promise<void>",
34
+ "tags": [
35
+ {
36
+ "name": "param",
37
+ "text": "options - The chat id and message to send"
38
+ },
39
+ {
40
+ "name": "returns",
41
+ "text": "Promise that resolves when message is sent"
42
+ }
43
+ ],
44
+ "docs": "Sends a message to the AI in a specific chat session",
45
+ "complexTypes": [],
46
+ "slug": "sendmessage"
47
+ },
48
+ {
49
+ "name": "getReadiness",
50
+ "signature": "() => Promise<{ readiness: string; }>",
51
+ "parameters": [],
52
+ "returns": "Promise<{ readiness: string; }>",
53
+ "tags": [
54
+ {
55
+ "name": "returns",
56
+ "text": "Promise with readiness status string"
57
+ }
58
+ ],
59
+ "docs": "Gets the readiness status of the LLM",
60
+ "complexTypes": [],
61
+ "slug": "getreadiness"
62
+ },
63
+ {
64
+ "name": "setModel",
65
+ "signature": "(options: ModelOptions) => Promise<void>",
66
+ "parameters": [
67
+ {
68
+ "name": "options",
69
+ "docs": "- The model configuration",
70
+ "type": "ModelOptions"
71
+ }
72
+ ],
73
+ "returns": "Promise<void>",
74
+ "tags": [
75
+ {
76
+ "name": "param",
77
+ "text": "options - The model configuration"
78
+ },
79
+ {
80
+ "name": "returns",
81
+ "text": "Promise that resolves when model is loaded"
82
+ }
83
+ ],
84
+ "docs": "Sets the model configuration\n- iOS: Use \"Apple Intelligence\" as path for system model, or provide path to MediaPipe model\n- Android: Path to a MediaPipe model file (in assets or files directory)",
85
+ "complexTypes": [
86
+ "ModelOptions"
87
+ ],
88
+ "slug": "setmodel"
89
+ },
90
+ {
91
+ "name": "downloadModel",
92
+ "signature": "(options: DownloadModelOptions) => Promise<DownloadModelResult>",
93
+ "parameters": [
94
+ {
95
+ "name": "options",
96
+ "docs": "- The download configuration",
97
+ "type": "DownloadModelOptions"
98
+ }
99
+ ],
100
+ "returns": "Promise<DownloadModelResult>",
101
+ "tags": [
102
+ {
103
+ "name": "param",
104
+ "text": "options - The download configuration"
105
+ },
106
+ {
107
+ "name": "returns",
108
+ "text": "Promise with download result including the saved path"
109
+ }
110
+ ],
111
+ "docs": "Downloads a model from a URL and saves it to the appropriate location\n- iOS: Downloads to the app's documents directory\n- Android: Downloads to the app's files directory",
112
+ "complexTypes": [
113
+ "DownloadModelResult",
114
+ "DownloadModelOptions"
115
+ ],
116
+ "slug": "downloadmodel"
117
+ },
118
+ {
119
+ "name": "addListener",
120
+ "signature": "(eventName: 'textFromAi', listenerFunc: (event: TextFromAiEvent) => void) => Promise<{ remove: () => Promise<void>; }>",
121
+ "parameters": [
122
+ {
123
+ "name": "eventName",
124
+ "docs": "- Event name 'textFromAi'",
125
+ "type": "'textFromAi'"
126
+ },
127
+ {
128
+ "name": "listenerFunc",
129
+ "docs": "- Callback function for text events",
130
+ "type": "(event: TextFromAiEvent) => void"
131
+ }
132
+ ],
133
+ "returns": "Promise<{ remove: () => Promise<void>; }>",
134
+ "tags": [
135
+ {
136
+ "name": "param",
137
+ "text": "eventName - Event name 'textFromAi'"
138
+ },
139
+ {
140
+ "name": "param",
141
+ "text": "listenerFunc - Callback function for text events"
142
+ },
143
+ {
144
+ "name": "returns",
145
+ "text": "Promise with remove function to unsubscribe"
146
+ }
147
+ ],
148
+ "docs": "Adds a listener for text received from AI",
149
+ "complexTypes": [
150
+ "TextFromAiEvent"
151
+ ],
152
+ "slug": "addlistenertextfromai-"
153
+ },
154
+ {
155
+ "name": "addListener",
156
+ "signature": "(eventName: 'aiFinished', listenerFunc: (event: AiFinishedEvent) => void) => Promise<{ remove: () => Promise<void>; }>",
157
+ "parameters": [
158
+ {
159
+ "name": "eventName",
160
+ "docs": "- Event name 'aiFinished'",
161
+ "type": "'aiFinished'"
162
+ },
163
+ {
164
+ "name": "listenerFunc",
165
+ "docs": "- Callback function for finish events",
166
+ "type": "(event: AiFinishedEvent) => void"
167
+ }
168
+ ],
169
+ "returns": "Promise<{ remove: () => Promise<void>; }>",
170
+ "tags": [
171
+ {
172
+ "name": "param",
173
+ "text": "eventName - Event name 'aiFinished'"
174
+ },
175
+ {
176
+ "name": "param",
177
+ "text": "listenerFunc - Callback function for finish events"
178
+ },
179
+ {
180
+ "name": "returns",
181
+ "text": "Promise with remove function to unsubscribe"
182
+ }
183
+ ],
184
+ "docs": "Adds a listener for AI completion events",
185
+ "complexTypes": [
186
+ "AiFinishedEvent"
187
+ ],
188
+ "slug": "addlisteneraifinished-"
189
+ },
190
+ {
191
+ "name": "addListener",
192
+ "signature": "(eventName: 'downloadProgress', listenerFunc: (event: DownloadProgressEvent) => void) => Promise<{ remove: () => Promise<void>; }>",
193
+ "parameters": [
194
+ {
195
+ "name": "eventName",
196
+ "docs": "- Event name 'downloadProgress'",
197
+ "type": "'downloadProgress'"
198
+ },
199
+ {
200
+ "name": "listenerFunc",
201
+ "docs": "- Callback function for progress events",
202
+ "type": "(event: DownloadProgressEvent) => void"
203
+ }
204
+ ],
205
+ "returns": "Promise<{ remove: () => Promise<void>; }>",
206
+ "tags": [
207
+ {
208
+ "name": "param",
209
+ "text": "eventName - Event name 'downloadProgress'"
210
+ },
211
+ {
212
+ "name": "param",
213
+ "text": "listenerFunc - Callback function for progress events"
214
+ },
215
+ {
216
+ "name": "returns",
217
+ "text": "Promise with remove function to unsubscribe"
218
+ }
219
+ ],
220
+ "docs": "Adds a listener for model download progress events",
221
+ "complexTypes": [
222
+ "DownloadProgressEvent"
223
+ ],
224
+ "slug": "addlistenerdownloadprogress-"
225
+ },
226
+ {
227
+ "name": "addListener",
228
+ "signature": "(eventName: 'readinessChange', listenerFunc: (event: ReadinessChangeEvent) => void) => Promise<{ remove: () => Promise<void>; }>",
229
+ "parameters": [
230
+ {
231
+ "name": "eventName",
232
+ "docs": "- Event name 'readinessChange'",
233
+ "type": "'readinessChange'"
234
+ },
235
+ {
236
+ "name": "listenerFunc",
237
+ "docs": "- Callback function for readiness events",
238
+ "type": "(event: ReadinessChangeEvent) => void"
239
+ }
240
+ ],
241
+ "returns": "Promise<{ remove: () => Promise<void>; }>",
242
+ "tags": [
243
+ {
244
+ "name": "param",
245
+ "text": "eventName - Event name 'readinessChange'"
246
+ },
247
+ {
248
+ "name": "param",
249
+ "text": "listenerFunc - Callback function for readiness events"
250
+ },
251
+ {
252
+ "name": "returns",
253
+ "text": "Promise with remove function to unsubscribe"
254
+ }
255
+ ],
256
+ "docs": "Adds a listener for readiness status changes",
257
+ "complexTypes": [
258
+ "ReadinessChangeEvent"
259
+ ],
260
+ "slug": "addlistenerreadinesschange-"
261
+ }
262
+ ],
263
+ "properties": []
264
+ },
265
+ "interfaces": [
266
+ {
267
+ "name": "ModelOptions",
268
+ "slug": "modeloptions",
269
+ "docs": "Model configuration options",
270
+ "tags": [],
271
+ "methods": [],
272
+ "properties": [
273
+ {
274
+ "name": "path",
275
+ "tags": [],
276
+ "docs": "Model path or \"Apple Intelligence\" for iOS system model",
277
+ "complexTypes": [],
278
+ "type": "string"
279
+ },
280
+ {
281
+ "name": "modelType",
282
+ "tags": [],
283
+ "docs": "Model file type/extension (e.g., \"task\", \"bin\", \"litertlm\"). If not provided, will be extracted from path.",
284
+ "complexTypes": [],
285
+ "type": "string | undefined"
286
+ },
287
+ {
288
+ "name": "maxTokens",
289
+ "tags": [],
290
+ "docs": "Maximum number of tokens the model handles",
291
+ "complexTypes": [],
292
+ "type": "number | undefined"
293
+ },
294
+ {
295
+ "name": "topk",
296
+ "tags": [],
297
+ "docs": "Number of tokens the model considers at each step",
298
+ "complexTypes": [],
299
+ "type": "number | undefined"
300
+ },
301
+ {
302
+ "name": "temperature",
303
+ "tags": [],
304
+ "docs": "Amount of randomness in generation (0.0-1.0)",
305
+ "complexTypes": [],
306
+ "type": "number | undefined"
307
+ },
308
+ {
309
+ "name": "randomSeed",
310
+ "tags": [],
311
+ "docs": "Random seed for generation",
312
+ "complexTypes": [],
313
+ "type": "number | undefined"
314
+ }
315
+ ]
316
+ },
317
+ {
318
+ "name": "DownloadModelResult",
319
+ "slug": "downloadmodelresult",
320
+ "docs": "Result of model download",
321
+ "tags": [],
322
+ "methods": [],
323
+ "properties": [
324
+ {
325
+ "name": "path",
326
+ "tags": [],
327
+ "docs": "Path where the model was saved",
328
+ "complexTypes": [],
329
+ "type": "string"
330
+ },
331
+ {
332
+ "name": "companionPath",
333
+ "tags": [],
334
+ "docs": "Path where the companion file was saved (if applicable)",
335
+ "complexTypes": [],
336
+ "type": "string | undefined"
337
+ }
338
+ ]
339
+ },
340
+ {
341
+ "name": "DownloadModelOptions",
342
+ "slug": "downloadmodeloptions",
343
+ "docs": "Options for downloading a model",
344
+ "tags": [],
345
+ "methods": [],
346
+ "properties": [
347
+ {
348
+ "name": "url",
349
+ "tags": [],
350
+ "docs": "URL of the model file to download",
351
+ "complexTypes": [],
352
+ "type": "string"
353
+ },
354
+ {
355
+ "name": "companionUrl",
356
+ "tags": [],
357
+ "docs": "Optional: URL of companion file (e.g., .litertlm for Android)",
358
+ "complexTypes": [],
359
+ "type": "string | undefined"
360
+ },
361
+ {
362
+ "name": "filename",
363
+ "tags": [],
364
+ "docs": "Optional: Custom filename (defaults to filename from URL)",
365
+ "complexTypes": [],
366
+ "type": "string | undefined"
367
+ }
368
+ ]
369
+ },
370
+ {
371
+ "name": "TextFromAiEvent",
372
+ "slug": "textfromaievent",
373
+ "docs": "Event data for text received from AI",
374
+ "tags": [],
375
+ "methods": [],
376
+ "properties": [
377
+ {
378
+ "name": "text",
379
+ "tags": [],
380
+ "docs": "The text content from AI - this is an incremental chunk, not the full text",
381
+ "complexTypes": [],
382
+ "type": "string"
383
+ },
384
+ {
385
+ "name": "chatId",
386
+ "tags": [],
387
+ "docs": "The chat session ID",
388
+ "complexTypes": [],
389
+ "type": "string"
390
+ },
391
+ {
392
+ "name": "isChunk",
393
+ "tags": [],
394
+ "docs": "Whether this is a complete chunk (true) or partial streaming data (false)",
395
+ "complexTypes": [],
396
+ "type": "boolean | undefined"
397
+ }
398
+ ]
399
+ },
400
+ {
401
+ "name": "AiFinishedEvent",
402
+ "slug": "aifinishedevent",
403
+ "docs": "Event data for AI completion",
404
+ "tags": [],
405
+ "methods": [],
406
+ "properties": [
407
+ {
408
+ "name": "chatId",
409
+ "tags": [],
410
+ "docs": "The chat session ID that finished",
411
+ "complexTypes": [],
412
+ "type": "string"
413
+ }
414
+ ]
415
+ },
416
+ {
417
+ "name": "DownloadProgressEvent",
418
+ "slug": "downloadprogressevent",
419
+ "docs": "Event data for download progress",
420
+ "tags": [],
421
+ "methods": [],
422
+ "properties": [
423
+ {
424
+ "name": "progress",
425
+ "tags": [],
426
+ "docs": "Percentage of download completed (0-100)",
427
+ "complexTypes": [],
428
+ "type": "number"
429
+ },
430
+ {
431
+ "name": "totalBytes",
432
+ "tags": [],
433
+ "docs": "Total bytes to download",
434
+ "complexTypes": [],
435
+ "type": "number | undefined"
436
+ },
437
+ {
438
+ "name": "downloadedBytes",
439
+ "tags": [],
440
+ "docs": "Bytes downloaded so far",
441
+ "complexTypes": [],
442
+ "type": "number | undefined"
443
+ }
444
+ ]
445
+ },
446
+ {
447
+ "name": "ReadinessChangeEvent",
448
+ "slug": "readinesschangeevent",
449
+ "docs": "Event data for readiness status changes",
450
+ "tags": [],
451
+ "methods": [],
452
+ "properties": [
453
+ {
454
+ "name": "readiness",
455
+ "tags": [],
456
+ "docs": "The readiness status",
457
+ "complexTypes": [],
458
+ "type": "string"
459
+ }
460
+ ]
461
+ }
462
+ ],
463
+ "enums": [],
464
+ "typeAliases": [],
465
+ "pluginConfigs": []
466
+ }
@@ -0,0 +1,154 @@
1
+ /**
2
+ * LLM Plugin interface for interacting with on-device language models
3
+ */
4
+ export interface LLMPlugin {
5
+ /**
6
+ * Creates a new chat session
7
+ * @returns Promise with chat id and optional instructions
8
+ */
9
+ createChat(): Promise<{
10
+ id: string;
11
+ instructions?: string;
12
+ }>;
13
+ /**
14
+ * Sends a message to the AI in a specific chat session
15
+ * @param options - The chat id and message to send
16
+ * @returns Promise that resolves when message is sent
17
+ */
18
+ sendMessage(options: {
19
+ chatId: string;
20
+ message: string;
21
+ }): Promise<void>;
22
+ /**
23
+ * Gets the readiness status of the LLM
24
+ * @returns Promise with readiness status string
25
+ */
26
+ getReadiness(): Promise<{
27
+ readiness: string;
28
+ }>;
29
+ /**
30
+ * Sets the model configuration
31
+ * - iOS: Use "Apple Intelligence" as path for system model, or provide path to MediaPipe model
32
+ * - Android: Path to a MediaPipe model file (in assets or files directory)
33
+ * @param options - The model configuration
34
+ * @returns Promise that resolves when model is loaded
35
+ */
36
+ setModel(options: ModelOptions): Promise<void>;
37
+ /**
38
+ * Downloads a model from a URL and saves it to the appropriate location
39
+ * - iOS: Downloads to the app's documents directory
40
+ * - Android: Downloads to the app's files directory
41
+ * @param options - The download configuration
42
+ * @returns Promise with download result including the saved path
43
+ */
44
+ downloadModel(options: DownloadModelOptions): Promise<DownloadModelResult>;
45
+ /**
46
+ * Adds a listener for text received from AI
47
+ * @param eventName - Event name 'textFromAi'
48
+ * @param listenerFunc - Callback function for text events
49
+ * @returns Promise with remove function to unsubscribe
50
+ */
51
+ addListener(eventName: 'textFromAi', listenerFunc: (event: TextFromAiEvent) => void): Promise<{
52
+ remove: () => Promise<void>;
53
+ }>;
54
+ /**
55
+ * Adds a listener for AI completion events
56
+ * @param eventName - Event name 'aiFinished'
57
+ * @param listenerFunc - Callback function for finish events
58
+ * @returns Promise with remove function to unsubscribe
59
+ */
60
+ addListener(eventName: 'aiFinished', listenerFunc: (event: AiFinishedEvent) => void): Promise<{
61
+ remove: () => Promise<void>;
62
+ }>;
63
+ /**
64
+ * Adds a listener for model download progress events
65
+ * @param eventName - Event name 'downloadProgress'
66
+ * @param listenerFunc - Callback function for progress events
67
+ * @returns Promise with remove function to unsubscribe
68
+ */
69
+ addListener(eventName: 'downloadProgress', listenerFunc: (event: DownloadProgressEvent) => void): Promise<{
70
+ remove: () => Promise<void>;
71
+ }>;
72
+ /**
73
+ * Adds a listener for readiness status changes
74
+ * @param eventName - Event name 'readinessChange'
75
+ * @param listenerFunc - Callback function for readiness events
76
+ * @returns Promise with remove function to unsubscribe
77
+ */
78
+ addListener(eventName: 'readinessChange', listenerFunc: (event: ReadinessChangeEvent) => void): Promise<{
79
+ remove: () => Promise<void>;
80
+ }>;
81
+ }
82
+ /**
83
+ * Event data for text received from AI
84
+ */
85
+ export interface TextFromAiEvent {
86
+ /** The text content from AI - this is an incremental chunk, not the full text */
87
+ text: string;
88
+ /** The chat session ID */
89
+ chatId: string;
90
+ /** Whether this is a complete chunk (true) or partial streaming data (false) */
91
+ isChunk?: boolean;
92
+ }
93
+ /**
94
+ * Event data for AI completion
95
+ */
96
+ export interface AiFinishedEvent {
97
+ /** The chat session ID that finished */
98
+ chatId: string;
99
+ }
100
+ /**
101
+ * Options for downloading a model
102
+ */
103
+ export interface DownloadModelOptions {
104
+ /** URL of the model file to download */
105
+ url: string;
106
+ /** Optional: URL of companion file (e.g., .litertlm for Android) */
107
+ companionUrl?: string;
108
+ /** Optional: Custom filename (defaults to filename from URL) */
109
+ filename?: string;
110
+ }
111
+ /**
112
+ * Result of model download
113
+ */
114
+ export interface DownloadModelResult {
115
+ /** Path where the model was saved */
116
+ path: string;
117
+ /** Path where the companion file was saved (if applicable) */
118
+ companionPath?: string;
119
+ }
120
+ /**
121
+ * Event data for download progress
122
+ */
123
+ export interface DownloadProgressEvent {
124
+ /** Percentage of download completed (0-100) */
125
+ progress: number;
126
+ /** Total bytes to download */
127
+ totalBytes?: number;
128
+ /** Bytes downloaded so far */
129
+ downloadedBytes?: number;
130
+ }
131
+ /**
132
+ * Event data for readiness status changes
133
+ */
134
+ export interface ReadinessChangeEvent {
135
+ /** The readiness status */
136
+ readiness: string;
137
+ }
138
+ /**
139
+ * Model configuration options
140
+ */
141
+ export interface ModelOptions {
142
+ /** Model path or "Apple Intelligence" for iOS system model */
143
+ path: string;
144
+ /** Model file type/extension (e.g., "task", "bin", "litertlm"). If not provided, will be extracted from path. */
145
+ modelType?: string;
146
+ /** Maximum number of tokens the model handles */
147
+ maxTokens?: number;
148
+ /** Number of tokens the model considers at each step */
149
+ topk?: number;
150
+ /** Amount of randomness in generation (0.0-1.0) */
151
+ temperature?: number;
152
+ /** Random seed for generation */
153
+ randomSeed?: number;
154
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=definitions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * LLM Plugin interface for interacting with on-device language models\n */\nexport interface LLMPlugin {\n /**\n * Creates a new chat session\n * @returns Promise with chat id and optional instructions\n */\n createChat(): Promise<{ id: string; instructions?: string }>;\n\n /**\n * Sends a message to the AI in a specific chat session\n * @param options - The chat id and message to send\n * @returns Promise that resolves when message is sent\n */\n sendMessage(options: { chatId: string; message: string }): Promise<void>;\n\n /**\n * Gets the readiness status of the LLM\n * @returns Promise with readiness status string\n */\n getReadiness(): Promise<{ readiness: string }>;\n\n /**\n * Sets the model configuration\n * - iOS: Use \"Apple Intelligence\" as path for system model, or provide path to MediaPipe model\n * - Android: Path to a MediaPipe model file (in assets or files directory)\n * @param options - The model configuration\n * @returns Promise that resolves when model is loaded\n */\n setModel(options: ModelOptions): Promise<void>;\n\n /**\n * Downloads a model from a URL and saves it to the appropriate location\n * - iOS: Downloads to the app's documents directory\n * - Android: Downloads to the app's files directory\n * @param options - The download configuration\n * @returns Promise with download result including the saved path\n */\n downloadModel(options: DownloadModelOptions): Promise<DownloadModelResult>;\n\n /**\n * Adds a listener for text received from AI\n * @param eventName - Event name 'textFromAi'\n * @param listenerFunc - Callback function for text events\n * @returns Promise with remove function to unsubscribe\n */\n addListener(\n eventName: 'textFromAi',\n listenerFunc: (event: TextFromAiEvent) => void,\n ): Promise<{ remove: () => Promise<void> }>;\n\n /**\n * Adds a listener for AI completion events\n * @param eventName - Event name 'aiFinished'\n * @param listenerFunc - Callback function for finish events\n * @returns Promise with remove function to unsubscribe\n */\n addListener(\n eventName: 'aiFinished',\n listenerFunc: (event: AiFinishedEvent) => void,\n ): Promise<{ remove: () => Promise<void> }>;\n\n /**\n * Adds a listener for model download progress events\n * @param eventName - Event name 'downloadProgress'\n * @param listenerFunc - Callback function for progress events\n * @returns Promise with remove function to unsubscribe\n */\n addListener(\n eventName: 'downloadProgress',\n listenerFunc: (event: DownloadProgressEvent) => void,\n ): Promise<{ remove: () => Promise<void> }>;\n\n /**\n * Adds a listener for readiness status changes\n * @param eventName - Event name 'readinessChange'\n * @param listenerFunc - Callback function for readiness events\n * @returns Promise with remove function to unsubscribe\n */\n addListener(\n eventName: 'readinessChange',\n listenerFunc: (event: ReadinessChangeEvent) => void,\n ): Promise<{ remove: () => Promise<void> }>;\n}\n\n/**\n * Event data for text received from AI\n */\nexport interface TextFromAiEvent {\n /** The text content from AI - this is an incremental chunk, not the full text */\n text: string;\n /** The chat session ID */\n chatId: string;\n /** Whether this is a complete chunk (true) or partial streaming data (false) */\n isChunk?: boolean;\n}\n\n/**\n * Event data for AI completion\n */\nexport interface AiFinishedEvent {\n /** The chat session ID that finished */\n chatId: string;\n}\n\n/**\n * Options for downloading a model\n */\nexport interface DownloadModelOptions {\n /** URL of the model file to download */\n url: string;\n /** Optional: URL of companion file (e.g., .litertlm for Android) */\n companionUrl?: string;\n /** Optional: Custom filename (defaults to filename from URL) */\n filename?: string;\n}\n\n/**\n * Result of model download\n */\nexport interface DownloadModelResult {\n /** Path where the model was saved */\n path: string;\n /** Path where the companion file was saved (if applicable) */\n companionPath?: string;\n}\n\n/**\n * Event data for download progress\n */\nexport interface DownloadProgressEvent {\n /** Percentage of download completed (0-100) */\n progress: number;\n /** Total bytes to download */\n totalBytes?: number;\n /** Bytes downloaded so far */\n downloadedBytes?: number;\n}\n\n/**\n * Event data for readiness status changes\n */\nexport interface ReadinessChangeEvent {\n /** The readiness status */\n readiness: string;\n}\n\n/**\n * Model configuration options\n */\nexport interface ModelOptions {\n /** Model path or \"Apple Intelligence\" for iOS system model */\n path: string;\n /** Model file type/extension (e.g., \"task\", \"bin\", \"litertlm\"). If not provided, will be extracted from path. */\n modelType?: string;\n /** Maximum number of tokens the model handles */\n maxTokens?: number;\n /** Number of tokens the model considers at each step */\n topk?: number;\n /** Amount of randomness in generation (0.0-1.0) */\n temperature?: number;\n /** Random seed for generation */\n randomSeed?: number;\n}\n"]}
@@ -0,0 +1,4 @@
1
+ import type { LLMPlugin } from './definitions';
2
+ declare const CapgoLLM: LLMPlugin;
3
+ export * from './definitions';
4
+ export { CapgoLLM };
@@ -0,0 +1,7 @@
1
+ import { registerPlugin } from '@capacitor/core';
2
+ const CapgoLLM = registerPlugin('CapgoLLM', {
3
+ web: () => import('./web').then((m) => new m.CapgoLLMWeb()),
4
+ });
5
+ export * from './definitions';
6
+ export { CapgoLLM };
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAIjD,MAAM,QAAQ,GAAG,cAAc,CAAY,UAAU,EAAE;IACrD,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC;CAC5D,CAAC,CAAC;AAEH,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,QAAQ,EAAE,CAAC","sourcesContent":["import { registerPlugin } from '@capacitor/core';\n\nimport type { LLMPlugin } from './definitions';\n\nconst CapgoLLM = registerPlugin<LLMPlugin>('CapgoLLM', {\n web: () => import('./web').then((m) => new m.CapgoLLMWeb()),\n});\n\nexport * from './definitions';\nexport { CapgoLLM };\n"]}
@@ -0,0 +1,20 @@
1
+ import { WebPlugin } from '@capacitor/core';
2
+ import type { LLMPlugin, DownloadModelOptions, DownloadModelResult, ModelOptions } from './definitions';
3
+ export declare class CapgoLLMWeb extends WebPlugin implements LLMPlugin {
4
+ private llm;
5
+ private chatSessions;
6
+ private readiness;
7
+ getReadiness(): Promise<{
8
+ readiness: string;
9
+ }>;
10
+ createChat(): Promise<{
11
+ id: string;
12
+ instructions?: string;
13
+ }>;
14
+ sendMessage(options: {
15
+ chatId: string;
16
+ message: string;
17
+ }): Promise<void>;
18
+ setModel(options: ModelOptions): Promise<void>;
19
+ downloadModel(options: DownloadModelOptions): Promise<DownloadModelResult>;
20
+ }