capacitor-apple-intelligence 1.0.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.
@@ -0,0 +1,36 @@
1
+ import { registerPlugin } from '@capacitor/core';
2
+ /**
3
+ * Apple Intelligence Plugin instance.
4
+ *
5
+ * Provides schema-constrained JSON generation using Apple's on-device
6
+ * Foundation Models framework.
7
+ *
8
+ * @example
9
+ * ```typescript
10
+ * import { AppleIntelligence } from 'capacitor-apple-intelligence';
11
+ *
12
+ * const result = await AppleIntelligence.generate({
13
+ * messages: [{ role: "user", content: "Suggest 3 books" }],
14
+ * response_format: {
15
+ * type: "json_schema",
16
+ * schema: {
17
+ * type: "array",
18
+ * items: {
19
+ * type: "object",
20
+ * properties: {
21
+ * title: { type: "string" },
22
+ * author: { type: "string" }
23
+ * },
24
+ * required: ["title", "author"]
25
+ * }
26
+ * }
27
+ * }
28
+ * });
29
+ * ```
30
+ */
31
+ const AppleIntelligence = registerPlugin('AppleIntelligence', {
32
+ web: () => import('./web').then((m) => new m.AppleIntelligenceWeb()),
33
+ });
34
+ export * from './definitions';
35
+ export { AppleIntelligence };
36
+ //# 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;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,iBAAiB,GAAG,cAAc,CAA0B,mBAAmB,EAAE;IACrF,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,oBAAoB,EAAE,CAAC;CACrE,CAAC,CAAC;AAEH,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { WebPlugin } from '@capacitor/core';
2
+ import type { AppleIntelligencePlugin, GenerateRequest, GenerateResponse } from './definitions';
3
+ /**
4
+ * Web implementation stub for Apple Intelligence.
5
+ * Always returns UNAVAILABLE since Apple Intelligence is iOS-only.
6
+ */
7
+ export declare class AppleIntelligenceWeb extends WebPlugin implements AppleIntelligencePlugin {
8
+ generate(_request: GenerateRequest): Promise<GenerateResponse>;
9
+ generateText(_request: unknown): Promise<any>;
10
+ generateTextWithLanguage(_request: unknown): Promise<any>;
11
+ checkAvailability(): Promise<any>;
12
+ }
@@ -0,0 +1,47 @@
1
+ import { WebPlugin } from '@capacitor/core';
2
+ /**
3
+ * Web implementation stub for Apple Intelligence.
4
+ * Always returns UNAVAILABLE since Apple Intelligence is iOS-only.
5
+ */
6
+ export class AppleIntelligenceWeb extends WebPlugin {
7
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
8
+ async generate(_request) {
9
+ return {
10
+ success: false,
11
+ error: {
12
+ code: 'UNAVAILABLE',
13
+ message: 'Apple Intelligence is only available on iOS 26+ devices with Apple Intelligence enabled.',
14
+ },
15
+ };
16
+ }
17
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
18
+ async generateText(_request) {
19
+ return {
20
+ success: false,
21
+ error: {
22
+ code: 'UNAVAILABLE',
23
+ message: 'Apple Intelligence is only available on iOS 26+ devices with Apple Intelligence enabled.',
24
+ },
25
+ };
26
+ }
27
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
28
+ async generateTextWithLanguage(_request) {
29
+ return {
30
+ success: false,
31
+ error: {
32
+ code: 'UNAVAILABLE',
33
+ message: 'Apple Intelligence is only available on iOS 26+ devices with Apple Intelligence enabled.',
34
+ },
35
+ };
36
+ }
37
+ async checkAvailability() {
38
+ return {
39
+ available: false,
40
+ error: {
41
+ code: 'UNAVAILABLE',
42
+ message: 'Apple Intelligence is only available on iOS 26+ devices with Apple Intelligence enabled.',
43
+ },
44
+ };
45
+ }
46
+ }
47
+ //# sourceMappingURL=web.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAI5C;;;GAGG;AACH,MAAM,OAAO,oBAAqB,SAAQ,SAAS;IACjD,6DAA6D;IAC7D,KAAK,CAAC,QAAQ,CAAC,QAAyB;QACtC,OAAO;YACL,OAAO,EAAE,KAAK;YACd,KAAK,EAAE;gBACL,IAAI,EAAE,aAAa;gBACnB,OAAO,EAAE,0FAA0F;aACpG;SACF,CAAC;IACJ,CAAC;IAED,6DAA6D;IAC7D,KAAK,CAAC,YAAY,CAAC,QAAiB;QAClC,OAAO;YACL,OAAO,EAAE,KAAK;YACd,KAAK,EAAE;gBACL,IAAI,EAAE,aAAa;gBACnB,OAAO,EAAE,0FAA0F;aACpG;SACF,CAAC;IACJ,CAAC;IAED,6DAA6D;IAC7D,KAAK,CAAC,wBAAwB,CAAC,QAAiB;QAC9C,OAAO;YACL,OAAO,EAAE,KAAK;YACd,KAAK,EAAE;gBACL,IAAI,EAAE,aAAa;gBACnB,OAAO,EAAE,0FAA0F;aACpG;SACF,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,iBAAiB;QACrB,OAAO;YACL,SAAS,EAAE,KAAK;YAChB,KAAK,EAAE;gBACL,IAAI,EAAE,aAAa;gBACnB,OAAO,EAAE,0FAA0F;aACpG;SACF,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,90 @@
1
+ 'use strict';
2
+
3
+ var core = require('@capacitor/core');
4
+
5
+ /**
6
+ * Apple Intelligence Plugin instance.
7
+ *
8
+ * Provides schema-constrained JSON generation using Apple's on-device
9
+ * Foundation Models framework.
10
+ *
11
+ * @example
12
+ * ```typescript
13
+ * import { AppleIntelligence } from 'capacitor-apple-intelligence';
14
+ *
15
+ * const result = await AppleIntelligence.generate({
16
+ * messages: [{ role: "user", content: "Suggest 3 books" }],
17
+ * response_format: {
18
+ * type: "json_schema",
19
+ * schema: {
20
+ * type: "array",
21
+ * items: {
22
+ * type: "object",
23
+ * properties: {
24
+ * title: { type: "string" },
25
+ * author: { type: "string" }
26
+ * },
27
+ * required: ["title", "author"]
28
+ * }
29
+ * }
30
+ * }
31
+ * });
32
+ * ```
33
+ */
34
+ const AppleIntelligence = core.registerPlugin('AppleIntelligence', {
35
+ web: () => Promise.resolve().then(function () { return web; }).then((m) => new m.AppleIntelligenceWeb()),
36
+ });
37
+
38
+ /**
39
+ * Web implementation stub for Apple Intelligence.
40
+ * Always returns UNAVAILABLE since Apple Intelligence is iOS-only.
41
+ */
42
+ class AppleIntelligenceWeb extends core.WebPlugin {
43
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
44
+ async generate(_request) {
45
+ return {
46
+ success: false,
47
+ error: {
48
+ code: 'UNAVAILABLE',
49
+ message: 'Apple Intelligence is only available on iOS 26+ devices with Apple Intelligence enabled.',
50
+ },
51
+ };
52
+ }
53
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
54
+ async generateText(_request) {
55
+ return {
56
+ success: false,
57
+ error: {
58
+ code: 'UNAVAILABLE',
59
+ message: 'Apple Intelligence is only available on iOS 26+ devices with Apple Intelligence enabled.',
60
+ },
61
+ };
62
+ }
63
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
64
+ async generateTextWithLanguage(_request) {
65
+ return {
66
+ success: false,
67
+ error: {
68
+ code: 'UNAVAILABLE',
69
+ message: 'Apple Intelligence is only available on iOS 26+ devices with Apple Intelligence enabled.',
70
+ },
71
+ };
72
+ }
73
+ async checkAvailability() {
74
+ return {
75
+ available: false,
76
+ error: {
77
+ code: 'UNAVAILABLE',
78
+ message: 'Apple Intelligence is only available on iOS 26+ devices with Apple Intelligence enabled.',
79
+ },
80
+ };
81
+ }
82
+ }
83
+
84
+ var web = /*#__PURE__*/Object.freeze({
85
+ __proto__: null,
86
+ AppleIntelligenceWeb: AppleIntelligenceWeb
87
+ });
88
+
89
+ exports.AppleIntelligence = AppleIntelligence;
90
+ //# sourceMappingURL=plugin.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\n/**\n * Apple Intelligence Plugin instance.\n *\n * Provides schema-constrained JSON generation using Apple's on-device\n * Foundation Models framework.\n *\n * @example\n * ```typescript\n * import { AppleIntelligence } from 'capacitor-apple-intelligence';\n *\n * const result = await AppleIntelligence.generate({\n * messages: [{ role: \"user\", content: \"Suggest 3 books\" }],\n * response_format: {\n * type: \"json_schema\",\n * schema: {\n * type: \"array\",\n * items: {\n * type: \"object\",\n * properties: {\n * title: { type: \"string\" },\n * author: { type: \"string\" }\n * },\n * required: [\"title\", \"author\"]\n * }\n * }\n * }\n * });\n * ```\n */\nconst AppleIntelligence = registerPlugin('AppleIntelligence', {\n web: () => import('./web').then((m) => new m.AppleIntelligenceWeb()),\n});\nexport * from './definitions';\nexport { AppleIntelligence };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\n/**\n * Web implementation stub for Apple Intelligence.\n * Always returns UNAVAILABLE since Apple Intelligence is iOS-only.\n */\nexport class AppleIntelligenceWeb extends WebPlugin {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n async generate(_request) {\n return {\n success: false,\n error: {\n code: 'UNAVAILABLE',\n message: 'Apple Intelligence is only available on iOS 26+ devices with Apple Intelligence enabled.',\n },\n };\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n async generateText(_request) {\n return {\n success: false,\n error: {\n code: 'UNAVAILABLE',\n message: 'Apple Intelligence is only available on iOS 26+ devices with Apple Intelligence enabled.',\n },\n };\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n async generateTextWithLanguage(_request) {\n return {\n success: false,\n error: {\n code: 'UNAVAILABLE',\n message: 'Apple Intelligence is only available on iOS 26+ devices with Apple Intelligence enabled.',\n },\n };\n }\n async checkAvailability() {\n return {\n available: false,\n error: {\n code: 'UNAVAILABLE',\n message: 'Apple Intelligence is only available on iOS 26+ devices with Apple Intelligence enabled.',\n },\n };\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACK,MAAC,iBAAiB,GAAGA,mBAAc,CAAC,mBAAmB,EAAE;AAC9D,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,oBAAoB,EAAE,CAAC;AACxE,CAAC;;AC/BD;AACA;AACA;AACA;AACO,MAAM,oBAAoB,SAASC,cAAS,CAAC;AACpD;AACA,IAAI,MAAM,QAAQ,CAAC,QAAQ,EAAE;AAC7B,QAAQ,OAAO;AACf,YAAY,OAAO,EAAE,KAAK;AAC1B,YAAY,KAAK,EAAE;AACnB,gBAAgB,IAAI,EAAE,aAAa;AACnC,gBAAgB,OAAO,EAAE,0FAA0F;AACnH,aAAa;AACb,SAAS;AACT,IAAI;AACJ;AACA,IAAI,MAAM,YAAY,CAAC,QAAQ,EAAE;AACjC,QAAQ,OAAO;AACf,YAAY,OAAO,EAAE,KAAK;AAC1B,YAAY,KAAK,EAAE;AACnB,gBAAgB,IAAI,EAAE,aAAa;AACnC,gBAAgB,OAAO,EAAE,0FAA0F;AACnH,aAAa;AACb,SAAS;AACT,IAAI;AACJ;AACA,IAAI,MAAM,wBAAwB,CAAC,QAAQ,EAAE;AAC7C,QAAQ,OAAO;AACf,YAAY,OAAO,EAAE,KAAK;AAC1B,YAAY,KAAK,EAAE;AACnB,gBAAgB,IAAI,EAAE,aAAa;AACnC,gBAAgB,OAAO,EAAE,0FAA0F;AACnH,aAAa;AACb,SAAS;AACT,IAAI;AACJ,IAAI,MAAM,iBAAiB,GAAG;AAC9B,QAAQ,OAAO;AACf,YAAY,SAAS,EAAE,KAAK;AAC5B,YAAY,KAAK,EAAE;AACnB,gBAAgB,IAAI,EAAE,aAAa;AACnC,gBAAgB,OAAO,EAAE,0FAA0F;AACnH,aAAa;AACb,SAAS;AACT,IAAI;AACJ;;;;;;;;;"}
package/dist/plugin.js ADDED
@@ -0,0 +1,93 @@
1
+ var capacitorAppleIntelligence = (function (exports, core) {
2
+ 'use strict';
3
+
4
+ /**
5
+ * Apple Intelligence Plugin instance.
6
+ *
7
+ * Provides schema-constrained JSON generation using Apple's on-device
8
+ * Foundation Models framework.
9
+ *
10
+ * @example
11
+ * ```typescript
12
+ * import { AppleIntelligence } from 'capacitor-apple-intelligence';
13
+ *
14
+ * const result = await AppleIntelligence.generate({
15
+ * messages: [{ role: "user", content: "Suggest 3 books" }],
16
+ * response_format: {
17
+ * type: "json_schema",
18
+ * schema: {
19
+ * type: "array",
20
+ * items: {
21
+ * type: "object",
22
+ * properties: {
23
+ * title: { type: "string" },
24
+ * author: { type: "string" }
25
+ * },
26
+ * required: ["title", "author"]
27
+ * }
28
+ * }
29
+ * }
30
+ * });
31
+ * ```
32
+ */
33
+ const AppleIntelligence = core.registerPlugin('AppleIntelligence', {
34
+ web: () => Promise.resolve().then(function () { return web; }).then((m) => new m.AppleIntelligenceWeb()),
35
+ });
36
+
37
+ /**
38
+ * Web implementation stub for Apple Intelligence.
39
+ * Always returns UNAVAILABLE since Apple Intelligence is iOS-only.
40
+ */
41
+ class AppleIntelligenceWeb extends core.WebPlugin {
42
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
43
+ async generate(_request) {
44
+ return {
45
+ success: false,
46
+ error: {
47
+ code: 'UNAVAILABLE',
48
+ message: 'Apple Intelligence is only available on iOS 26+ devices with Apple Intelligence enabled.',
49
+ },
50
+ };
51
+ }
52
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
53
+ async generateText(_request) {
54
+ return {
55
+ success: false,
56
+ error: {
57
+ code: 'UNAVAILABLE',
58
+ message: 'Apple Intelligence is only available on iOS 26+ devices with Apple Intelligence enabled.',
59
+ },
60
+ };
61
+ }
62
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
63
+ async generateTextWithLanguage(_request) {
64
+ return {
65
+ success: false,
66
+ error: {
67
+ code: 'UNAVAILABLE',
68
+ message: 'Apple Intelligence is only available on iOS 26+ devices with Apple Intelligence enabled.',
69
+ },
70
+ };
71
+ }
72
+ async checkAvailability() {
73
+ return {
74
+ available: false,
75
+ error: {
76
+ code: 'UNAVAILABLE',
77
+ message: 'Apple Intelligence is only available on iOS 26+ devices with Apple Intelligence enabled.',
78
+ },
79
+ };
80
+ }
81
+ }
82
+
83
+ var web = /*#__PURE__*/Object.freeze({
84
+ __proto__: null,
85
+ AppleIntelligenceWeb: AppleIntelligenceWeb
86
+ });
87
+
88
+ exports.AppleIntelligence = AppleIntelligence;
89
+
90
+ return exports;
91
+
92
+ })({}, capacitorExports);
93
+ //# sourceMappingURL=plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\n/**\n * Apple Intelligence Plugin instance.\n *\n * Provides schema-constrained JSON generation using Apple's on-device\n * Foundation Models framework.\n *\n * @example\n * ```typescript\n * import { AppleIntelligence } from 'capacitor-apple-intelligence';\n *\n * const result = await AppleIntelligence.generate({\n * messages: [{ role: \"user\", content: \"Suggest 3 books\" }],\n * response_format: {\n * type: \"json_schema\",\n * schema: {\n * type: \"array\",\n * items: {\n * type: \"object\",\n * properties: {\n * title: { type: \"string\" },\n * author: { type: \"string\" }\n * },\n * required: [\"title\", \"author\"]\n * }\n * }\n * }\n * });\n * ```\n */\nconst AppleIntelligence = registerPlugin('AppleIntelligence', {\n web: () => import('./web').then((m) => new m.AppleIntelligenceWeb()),\n});\nexport * from './definitions';\nexport { AppleIntelligence };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\n/**\n * Web implementation stub for Apple Intelligence.\n * Always returns UNAVAILABLE since Apple Intelligence is iOS-only.\n */\nexport class AppleIntelligenceWeb extends WebPlugin {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n async generate(_request) {\n return {\n success: false,\n error: {\n code: 'UNAVAILABLE',\n message: 'Apple Intelligence is only available on iOS 26+ devices with Apple Intelligence enabled.',\n },\n };\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n async generateText(_request) {\n return {\n success: false,\n error: {\n code: 'UNAVAILABLE',\n message: 'Apple Intelligence is only available on iOS 26+ devices with Apple Intelligence enabled.',\n },\n };\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n async generateTextWithLanguage(_request) {\n return {\n success: false,\n error: {\n code: 'UNAVAILABLE',\n message: 'Apple Intelligence is only available on iOS 26+ devices with Apple Intelligence enabled.',\n },\n };\n }\n async checkAvailability() {\n return {\n available: false,\n error: {\n code: 'UNAVAILABLE',\n message: 'Apple Intelligence is only available on iOS 26+ devices with Apple Intelligence enabled.',\n },\n };\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;AACK,UAAC,iBAAiB,GAAGA,mBAAc,CAAC,mBAAmB,EAAE;IAC9D,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,oBAAoB,EAAE,CAAC;IACxE,CAAC;;IC/BD;IACA;IACA;IACA;IACO,MAAM,oBAAoB,SAASC,cAAS,CAAC;IACpD;IACA,IAAI,MAAM,QAAQ,CAAC,QAAQ,EAAE;IAC7B,QAAQ,OAAO;IACf,YAAY,OAAO,EAAE,KAAK;IAC1B,YAAY,KAAK,EAAE;IACnB,gBAAgB,IAAI,EAAE,aAAa;IACnC,gBAAgB,OAAO,EAAE,0FAA0F;IACnH,aAAa;IACb,SAAS;IACT,IAAI;IACJ;IACA,IAAI,MAAM,YAAY,CAAC,QAAQ,EAAE;IACjC,QAAQ,OAAO;IACf,YAAY,OAAO,EAAE,KAAK;IAC1B,YAAY,KAAK,EAAE;IACnB,gBAAgB,IAAI,EAAE,aAAa;IACnC,gBAAgB,OAAO,EAAE,0FAA0F;IACnH,aAAa;IACb,SAAS;IACT,IAAI;IACJ;IACA,IAAI,MAAM,wBAAwB,CAAC,QAAQ,EAAE;IAC7C,QAAQ,OAAO;IACf,YAAY,OAAO,EAAE,KAAK;IAC1B,YAAY,KAAK,EAAE;IACnB,gBAAgB,IAAI,EAAE,aAAa;IACnC,gBAAgB,OAAO,EAAE,0FAA0F;IACnH,aAAa;IACb,SAAS;IACT,IAAI;IACJ,IAAI,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,OAAO;IACf,YAAY,SAAS,EAAE,KAAK;IAC5B,YAAY,KAAK,EAAE;IACnB,gBAAgB,IAAI,EAAE,aAAa;IACnC,gBAAgB,OAAO,EAAE,0FAA0F;IACnH,aAAa;IACb,SAAS;IACT,IAAI;IACJ;;;;;;;;;;;;;;;"}