@elizaos/capacitor-phone 1.0.0 → 2.0.11-beta.7

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,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Shaw Walters and elizaOS Contributors
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.
package/README.md ADDED
@@ -0,0 +1,116 @@
1
+ # @elizaos/capacitor-phone
2
+
3
+ Android phone and Telecom bridge for elizaOS. A [Capacitor](https://capacitorjs.com/) plugin that gives Eliza agents running inside a Capacitor-wrapped Android application access to native phone capabilities: placing calls, opening the system dialer, reading the call log, and persisting agent-authored transcripts alongside call records.
4
+
5
+ ## Capabilities
6
+
7
+ | Capability | Description |
8
+ |---|---|
9
+ | **Check phone status** | Query whether the Telecom service is available, whether `CALL_PHONE` permission is granted, and whether the host app is the system default dialer. |
10
+ | **Place a call** | Initiate an outgoing call to any number via `TelecomManager`. Requires the `CALL_PHONE` runtime permission. |
11
+ | **Open the system dialer** | Launch the Android dialer activity, optionally pre-filled with a phone number. Does not require the `CALL_PHONE` permission. |
12
+ | **Read the call log** | Retrieve recent call records (incoming, outgoing, missed, voicemail, rejected, blocked). Supports filtering by phone number and limiting result count (max 500). Requires `READ_CALL_LOG` runtime permission. |
13
+ | **Save call transcripts** | Persist an agent-authored transcript and optional summary for a specific call. The data is stored in Android SharedPreferences and automatically merged into call log entries on subsequent reads. |
14
+
15
+ ## Platform support
16
+
17
+ | Platform | Status |
18
+ |---|---|
19
+ | Android | Full native implementation |
20
+ | Web / browser | `getStatus` returns all-false; `listRecentCalls` returns empty; all other methods throw |
21
+ | iOS | Unsupported |
22
+
23
+ ## Installation
24
+
25
+ Add the package to your Capacitor app:
26
+
27
+ ```bash
28
+ bun add @elizaos/capacitor-phone
29
+ ```
30
+
31
+ Then register the plugin in your Android project's `MainActivity`:
32
+
33
+ ```kotlin
34
+ import ai.eliza.plugins.phone.PhonePlugin
35
+
36
+ class MainActivity : BridgeActivity() {
37
+ override fun onCreate(savedInstanceState: Bundle?) {
38
+ registerPlugin(PhonePlugin::class.java)
39
+ super.onCreate(savedInstanceState)
40
+ }
41
+ }
42
+ ```
43
+
44
+ ## Required Android permissions
45
+
46
+ The plugin declares the following permissions in its `AndroidManifest.xml`. Some must also be granted at runtime:
47
+
48
+ | Permission | Required for | Runtime prompt |
49
+ |---|---|---|
50
+ | `CALL_PHONE` | `placeCall` | Yes |
51
+ | `READ_CALL_LOG` | `listRecentCalls` | Yes |
52
+ | `READ_PHONE_STATE` | Telecom status queries | Declared |
53
+ | `ANSWER_PHONE_CALLS` | Future Telecom connection service | Declared |
54
+ | `MANAGE_OWN_CALLS` | Future Telecom connection service | Declared |
55
+ | `WRITE_CALL_LOG` | Future write support | Declared |
56
+
57
+ ## Usage
58
+
59
+ ```typescript
60
+ import { Phone } from "@elizaos/capacitor-phone";
61
+
62
+ // Check capabilities
63
+ const status = await Phone.getStatus();
64
+ console.log(status.canPlaceCalls, status.isDefaultDialer);
65
+
66
+ // Open dialer (no CALL_PHONE permission needed)
67
+ await Phone.openDialer({ number: "+15555550100" });
68
+
69
+ // Place a call (requires CALL_PHONE permission)
70
+ await Phone.placeCall({ number: "+15555550100" });
71
+
72
+ // Read recent calls
73
+ const { calls } = await Phone.listRecentCalls({ limit: 20 });
74
+
75
+ // Filter by number
76
+ const { calls: filtered } = await Phone.listRecentCalls({ number: "555" });
77
+
78
+ // Save an agent transcript for a call
79
+ const { updatedAt } = await Phone.saveCallTranscript({
80
+ callId: calls[0].id,
81
+ transcript: "Hello, how can I help you today?...",
82
+ summary: "Customer asked about account balance.",
83
+ });
84
+ ```
85
+
86
+ ## Call log entry shape
87
+
88
+ Each entry returned by `listRecentCalls` conforms to `CallLogEntry`:
89
+
90
+ ```typescript
91
+ interface CallLogEntry {
92
+ id: string;
93
+ number: string;
94
+ cachedName: string | null;
95
+ date: number; // epoch ms
96
+ durationSeconds: number;
97
+ type: CallLogType; // "incoming" | "outgoing" | "missed" | "voicemail" | "rejected" | "blocked" | "answered_externally" | "unknown"
98
+ rawType: number;
99
+ isNew: boolean;
100
+ phoneAccountId: string | null;
101
+ geocodedLocation: string | null;
102
+ transcription: string | null; // system-provided (OS voicemail transcription)
103
+ voicemailUri: string | null;
104
+ agentTranscript: string | null; // agent-saved via saveCallTranscript
105
+ agentSummary: string | null;
106
+ agentTranscriptUpdatedAt: number | null;
107
+ }
108
+ ```
109
+
110
+ ## Build
111
+
112
+ ```bash
113
+ bun run --cwd plugins/plugin-native-phone build
114
+ ```
115
+
116
+ This runs `tsc` (TypeScript compilation to `dist/esm/`) followed by rollup (bundling to `dist/plugin.js` and `dist/plugin.cjs.js`).
@@ -6,6 +6,11 @@ ext {
6
6
  }
7
7
 
8
8
  apply plugin: 'com.android.library'
9
+ // Apply the Kotlin Android plugin so the plugin's .kt class is bundled into the
10
+ // library AAR. Without it AGP's built-in kotlinc compiles the sources but does
11
+ // NOT bundle the .class files, so the Capacitor plugin class is absent from the
12
+ // app dex at runtime (PluginLoadException -> the whole plugin set fails to load).
13
+ apply plugin: 'org.jetbrains.kotlin.android'
9
14
  android {
10
15
  namespace = "ai.eliza.plugins.phone"
11
16
  compileSdk project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 34
@@ -17,11 +22,14 @@ android {
17
22
  sourceCompatibility JavaVersion.VERSION_17
18
23
  targetCompatibility JavaVersion.VERSION_17
19
24
  }
25
+ kotlinOptions {
26
+ jvmTarget = "17"
27
+ }
20
28
  }
21
29
 
22
30
  repositories {
23
31
  google()
24
- maven { url = uri(rootProject.ext.mavenCentralMirrorUrl) }
32
+ maven { url = uri(rootProject.ext.has('mavenCentralMirrorUrl') ? rootProject.ext.mavenCentralMirrorUrl : 'https://repo.maven.apache.org/maven2') }
25
33
  mavenCentral()
26
34
  }
27
35
 
@@ -13,9 +13,25 @@ import com.getcapacitor.Plugin
13
13
  import com.getcapacitor.PluginCall
14
14
  import com.getcapacitor.PluginMethod
15
15
  import com.getcapacitor.annotation.CapacitorPlugin
16
+ import com.getcapacitor.annotation.Permission
16
17
  import org.json.JSONObject
17
18
 
18
- @CapacitorPlugin(name = "ElizaPhone")
19
+ // Declares the `phone` alias so the Capacitor base Plugin auto-provides
20
+ // checkPermissions()/requestPermissions() — call placement + call-log access are
21
+ // requested on first use of the Phone view, not at app launch.
22
+ @CapacitorPlugin(
23
+ name = "ElizaPhone",
24
+ permissions = [
25
+ Permission(
26
+ alias = "phone",
27
+ strings = [
28
+ Manifest.permission.CALL_PHONE,
29
+ Manifest.permission.READ_CALL_LOG,
30
+ Manifest.permission.READ_PHONE_STATE,
31
+ ],
32
+ ),
33
+ ],
34
+ )
19
35
  class PhonePlugin : Plugin() {
20
36
  private val transcriptPreferencesName = "eliza_phone_call_transcripts"
21
37
 
@@ -44,5 +44,15 @@ export interface PhonePlugin {
44
44
  saveCallTranscript(options: SaveCallTranscriptOptions): Promise<{
45
45
  updatedAt: number;
46
46
  }>;
47
+ /** Current phone (CALL_PHONE/READ_CALL_LOG/READ_PHONE_STATE) permission state.
48
+ * Web: granted. */
49
+ checkPermissions(): Promise<PhonePermissionStatus>;
50
+ /** Prompt for phone access (no-op grant on web). Feature-gated to the Phone
51
+ * view; never requested at launch. */
52
+ requestPermissions(): Promise<PhonePermissionStatus>;
53
+ }
54
+ /** Runtime permission state for the phone (CALL_PHONE/READ_CALL_LOG) alias. */
55
+ export interface PhonePermissionStatus {
56
+ phone: import("@capacitor/core").PermissionState;
47
57
  }
48
58
  //# sourceMappingURL=definitions.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"definitions.d.ts","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,WAAW;IAC1B,UAAU,EAAE,OAAO,CAAC;IACpB,aAAa,EAAE,OAAO,CAAC;IACvB,eAAe,EAAE,OAAO,CAAC;IACzB,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAC;CACrC;AAED,MAAM,MAAM,WAAW,GACnB,UAAU,GACV,UAAU,GACV,QAAQ,GACR,WAAW,GACX,UAAU,GACV,SAAS,GACT,qBAAqB,GACrB,SAAS,CAAC;AAEd,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,eAAe,EAAE,MAAM,CAAC;IACxB,IAAI,EAAE,WAAW,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,OAAO,CAAC;IACf,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,YAAY,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AAC,CAAC;IACH,kBAAkB,CAAC,OAAO,EAAE,yBAAyB,GAAG,OAAO,CAAC;QAC9D,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC,CAAC;IACH;wBACoB;IACpB,gBAAgB,IAAI,OAAO,CAAC,qBAAqB,CAAC,CAAC;IACnD;2CACuC;IACvC,kBAAkB,IAAI,OAAO,CAAC,qBAAqB,CAAC,CAAC;CACtD;AAED,+EAA+E;AAC/E,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,OAAO,iBAAiB,EAAE,eAAe,CAAC;CAClD"}
package/dist/esm/web.d.ts CHANGED
@@ -1,14 +1,16 @@
1
1
  import { WebPlugin } from "@capacitor/core";
2
- import type { CallLogEntry, ListRecentCallsOptions, PhonePlugin, PhoneStatus, PlaceCallOptions, SaveCallTranscriptOptions } from "./definitions";
2
+ import type { CallLogEntry, ListRecentCallsOptions, PhonePermissionStatus, PhonePlugin, PhoneStatus, PlaceCallOptions, SaveCallTranscriptOptions } from "./definitions";
3
3
  export declare class PhoneWeb extends WebPlugin implements PhonePlugin {
4
4
  getStatus(): Promise<PhoneStatus>;
5
- placeCall(_options: PlaceCallOptions): Promise<void>;
6
- openDialer(_options?: Partial<PlaceCallOptions>): Promise<void>;
7
- listRecentCalls(_options?: ListRecentCallsOptions): Promise<{
5
+ placeCall(options: PlaceCallOptions): Promise<void>;
6
+ openDialer(options?: Partial<PlaceCallOptions>): Promise<void>;
7
+ listRecentCalls(options?: ListRecentCallsOptions): Promise<{
8
8
  calls: CallLogEntry[];
9
9
  }>;
10
- saveCallTranscript(_options: SaveCallTranscriptOptions): Promise<{
10
+ saveCallTranscript(options: SaveCallTranscriptOptions): Promise<{
11
11
  updatedAt: number;
12
12
  }>;
13
+ checkPermissions(): Promise<PhonePermissionStatus>;
14
+ requestPermissions(): Promise<PhonePermissionStatus>;
13
15
  }
14
16
  //# sourceMappingURL=web.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"web.d.ts","sourceRoot":"","sources":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OAAO,CAAC;QAAE,KAAK,EAAE,YAAY,EAAE,CAAA;KAAE,CAAC;IAK/B,kBAAkB,CACtB,OAAO,EAAE,yBAAyB,GACjC,OAAO,CAAC;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC;IAO3B,gBAAgB,IAAI,OAAO,CAAC,qBAAqB,CAAC;IAIlD,kBAAkB,IAAI,OAAO,CAAC,qBAAqB,CAAC;CAG3D"}
package/dist/esm/web.js CHANGED
@@ -1,4 +1,49 @@
1
1
  import { WebPlugin } from "@capacitor/core";
2
+ function nonEmptyString(value) {
3
+ return typeof value === "string" ? value.trim() : "";
4
+ }
5
+ function isRecord(value) {
6
+ return typeof value === "object" && value !== null;
7
+ }
8
+ function validateCallTarget(options, { requireNumber }) {
9
+ if (!isRecord(options)) {
10
+ if (requireNumber) {
11
+ throw new Error("number is required");
12
+ }
13
+ return;
14
+ }
15
+ if ((requireNumber && options.number === undefined) ||
16
+ (options.number !== undefined && !nonEmptyString(options.number))) {
17
+ throw new Error("number is required");
18
+ }
19
+ }
20
+ function validateRecentCallsOptions(options) {
21
+ if (options === undefined) {
22
+ return;
23
+ }
24
+ if (!isRecord(options)) {
25
+ throw new Error("options must be an object");
26
+ }
27
+ if (options.limit !== undefined) {
28
+ if (typeof options.limit !== "number" ||
29
+ !Number.isFinite(options.limit) ||
30
+ options.limit < 1 ||
31
+ options.limit > 500) {
32
+ throw new Error("limit must be between 1 and 500");
33
+ }
34
+ }
35
+ if (options.number !== undefined && !nonEmptyString(options.number)) {
36
+ throw new Error("number must be a non-empty string");
37
+ }
38
+ }
39
+ function validateTranscriptOptions(options) {
40
+ if (!isRecord(options) || !nonEmptyString(options.callId)) {
41
+ throw new Error("callId is required");
42
+ }
43
+ if (!nonEmptyString(options.transcript)) {
44
+ throw new Error("transcript is required");
45
+ }
46
+ }
2
47
  export class PhoneWeb extends WebPlugin {
3
48
  async getStatus() {
4
49
  return {
@@ -8,17 +53,29 @@ export class PhoneWeb extends WebPlugin {
8
53
  defaultDialerPackage: null,
9
54
  };
10
55
  }
11
- async placeCall(_options) {
56
+ async placeCall(options) {
57
+ validateCallTarget(options, { requireNumber: true });
12
58
  throw new Error("Phone calls are only available on Android.");
13
59
  }
14
- async openDialer(_options) {
60
+ async openDialer(options) {
61
+ validateCallTarget(options, { requireNumber: false });
15
62
  throw new Error("Phone dialer is only available on Android.");
16
63
  }
17
- async listRecentCalls(_options) {
64
+ async listRecentCalls(options) {
65
+ validateRecentCallsOptions(options);
18
66
  return { calls: [] };
19
67
  }
20
- async saveCallTranscript(_options) {
68
+ async saveCallTranscript(options) {
69
+ validateTranscriptOptions(options);
21
70
  throw new Error("Call transcripts are only available on Android.");
22
71
  }
72
+ // Web has no phone permission model; report granted so the shared view flow
73
+ // proceeds (call placement / call-log throw or return empty on web anyway).
74
+ async checkPermissions() {
75
+ return { phone: "granted" };
76
+ }
77
+ async requestPermissions() {
78
+ return { phone: "granted" };
79
+ }
23
80
  }
24
81
  //# sourceMappingURL=web.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAW5C,MAAM,OAAO,QAAS,SAAQ,SAAS;IACrC,KAAK,CAAC,SAAS;QACb,OAAO;YACL,UAAU,EAAE,KAAK;YACjB,aAAa,EAAE,KAAK;YACpB,eAAe,EAAE,KAAK;YACtB,oBAAoB,EAAE,IAAI;SAC3B,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,SAAS,CAAC,QAA0B;QACxC,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;IAChE,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,QAAoC;QACnD,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;IAChE,CAAC;IAED,KAAK,CAAC,eAAe,CACnB,QAAiC;QAEjC,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;IACvB,C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AAE,KAAK,EAAE,CAAC,CAAC;QACtD,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;IAChE,CAAC;IAED,KAAK,CAAC,eAAe,CACnB,OAAgC;QAEhC,0BAA0B,CAAC,OAAO,CAAC,CAAC;QACpC,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;IACvB,CAAC;IAED,KAAK,CAAC,kBAAkB,CACtB,OAAkC;QAElC,yBAAyB,CAAC,OAAO,CAAC,CAAC;QACnC,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;IACrE,CAAC;IAED,4EAA4E;IAC5E,4EAA4E;IAC5E,KAAK,CAAC,gBAAgB;QACpB,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC;IAC9B,CAAC;IAED,KAAK,CAAC,kBAAkB;QACtB,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC;IAC9B,CAAC;CACF"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=web.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"web.test.d.ts","sourceRoot":"","sources":["../../src/web.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,56 @@
1
+ import { describe, expect, it } from "vitest";
2
+ import { PhoneWeb } from "./web";
3
+ describe("PhoneWeb fallback", () => {
4
+ it("returns disabled phone status on non-Android runtimes", async () => {
5
+ await expect(new PhoneWeb().getStatus()).resolves.toEqual({
6
+ hasTelecom: false,
7
+ canPlaceCalls: false,
8
+ isDefaultDialer: false,
9
+ defaultDialerPackage: null,
10
+ });
11
+ });
12
+ it("rejects malformed call targets before Android-only fallback errors", async () => {
13
+ const phone = new PhoneWeb();
14
+ await expect(phone.placeCall(undefined)).rejects.toThrow("number is required");
15
+ await expect(phone.placeCall({ number: "" })).rejects.toThrow("number is required");
16
+ await expect(phone.placeCall({ number: ["+15550100"] })).rejects.toThrow("number is required");
17
+ await expect(phone.openDialer({ number: "\n\t" })).rejects.toThrow("number is required");
18
+ await expect(phone.placeCall({ number: "+15550100" })).rejects.toThrow("Phone calls are only available on Android.");
19
+ await expect(phone.openDialer()).rejects.toThrow("Phone dialer is only available on Android.");
20
+ });
21
+ it.each([
22
+ 0,
23
+ -1,
24
+ 501,
25
+ Number.POSITIVE_INFINITY,
26
+ Number.NaN,
27
+ ])("rejects malformed recent-call limit %s", async (limit) => {
28
+ const phone = new PhoneWeb();
29
+ await expect(phone.listRecentCalls({ limit })).rejects.toThrow("limit must be between 1 and 500");
30
+ });
31
+ it("rejects non-object recent-call options without poisoning later calls", async () => {
32
+ const phone = new PhoneWeb();
33
+ await expect(phone.listRecentCalls("limit=1")).rejects.toThrow("options must be an object");
34
+ await expect(phone.listRecentCalls({ limit: 1 })).resolves.toEqual({
35
+ calls: [],
36
+ });
37
+ });
38
+ it("rejects malformed recent-call filters and transcript payloads", async () => {
39
+ const phone = new PhoneWeb();
40
+ await expect(phone.listRecentCalls({ number: " " })).rejects.toThrow("number must be a non-empty string");
41
+ await expect(phone.saveCallTranscript({ callId: "", transcript: "hello" })).rejects.toThrow("callId is required");
42
+ await expect(phone.saveCallTranscript({ callId: "call-1", transcript: "\n\t" })).rejects.toThrow("transcript is required");
43
+ await expect(phone.saveCallTranscript(null)).rejects.toThrow("callId is required");
44
+ await expect(phone.saveCallTranscript({ callId: "call-1", transcript: "hello" })).rejects.toThrow("Call transcripts are only available on Android.");
45
+ });
46
+ it("accepts hostile-looking user strings only after validation succeeds", async () => {
47
+ const phone = new PhoneWeb();
48
+ await expect(phone.listRecentCalls({ number: "%' OR 1=1 --", limit: 2 })).resolves.toEqual({ calls: [] });
49
+ await expect(phone.saveCallTranscript({
50
+ callId: "__proto__",
51
+ transcript: "<script>alert(1)</script>",
52
+ summary: "{\"polluted\":true}",
53
+ })).rejects.toThrow("Call transcripts are only available on Android.");
54
+ });
55
+ });
56
+ //# sourceMappingURL=web.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"web.test.js","sourceRoot":"","sources":["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
9
9
 
10
+ function nonEmptyString(value) {
11
+ return typeof value === "string" ? value.trim() : "";
12
+ }
13
+ function isRecord(value) {
14
+ return typeof value === "object" && value !== null;
15
+ }
16
+ function validateCallTarget(options, { requireNumber }) {
17
+ if (!isRecord(options)) {
18
+ if (requireNumber) {
19
+ throw new Error("number is required");
20
+ }
21
+ return;
22
+ }
23
+ if ((requireNumber && options.number === undefined) ||
24
+ (options.number !== undefined && !nonEmptyString(options.number))) {
25
+ throw new Error("number is required");
26
+ }
27
+ }
28
+ function validateRecentCallsOptions(options) {
29
+ if (options === undefined) {
30
+ return;
31
+ }
32
+ if (!isRecord(options)) {
33
+ throw new Error("options must be an object");
34
+ }
35
+ if (options.limit !== undefined) {
36
+ if (typeof options.limit !== "number" ||
37
+ !Number.isFinite(options.limit) ||
38
+ options.limit < 1 ||
39
+ options.limit > 500) {
40
+ throw new Error("limit must be between 1 and 500");
41
+ }
42
+ }
43
+ if (options.number !== undefined && !nonEmptyString(options.number)) {
44
+ throw new Error("number must be a non-empty string");
45
+ }
46
+ }
47
+ function validateTranscriptOptions(options) {
48
+ if (!isRecord(options) || !nonEmptyString(options.callId)) {
49
+ throw new Error("callId is required");
50
+ }
51
+ if (!nonEmptyString(options.transcript)) {
52
+ throw new Error("transcript is required");
53
+ }
54
+ }
10
55
  class PhoneWeb extends core.WebPlugin {
11
56
  async getStatus() {
12
57
  return {
@@ -16,18 +61,30 @@ class PhoneWeb extends core.WebPlugin {
16
61
  defaultDialerPackage: null,
17
62
  };
18
63
  }
19
- async placeCall(_options) {
64
+ async placeCall(options) {
65
+ validateCallTarget(options, { requireNumber: true });
20
66
  throw new Error("Phone calls are only available on Android.");
21
67
  }
22
- async openDialer(_options) {
68
+ async openDialer(options) {
69
+ validateCallTarget(options, { requireNumber: false });
23
70
  throw new Error("Phone dialer is only available on Android.");
24
71
  }
25
- async listRecentCalls(_options) {
72
+ async listRecentCalls(options) {
73
+ validateRecentCallsOptions(options);
26
74
  return { calls: [] };
27
75
  }
28
- async saveCallTranscript(_options) {
76
+ async saveCallTranscript(options) {
77
+ validateTranscriptOptions(options);
29
78
  throw new Error("Call transcripts are only available on Android.");
30
79
  }
80
+ // Web has no phone permission model; report granted so the shared view flow
81
+ // proceeds (call placement / call-log throw or return empty on web anyway).
82
+ async checkPermissions() {
83
+ return { phone: "granted" };
84
+ }
85
+ async requestPermissions() {
86
+ return { phone: "granted" };
87
+ }
31
88
  }
32
89
 
33
90
  var web = /*#__PURE__*/Object.freeze({
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from \"@capacitor/core\";\nexport * from \"./definitions\";\nconst loadWeb = () => import(\"./web\").then((m) => new m.PhoneWeb());\nexport const Phone = registerPlugin(\"ElizaPhone\", {\n web: loadWeb,\n});\n//# sourceMappingURL=index.js.map","import { WebPlugin } from \"@capacitor/core\";\nexport class PhoneWeb extends WebPlugin {\n async getStatus() {\n return {\n hasTelecom: false,\n canPlaceCalls: false,\n isDefaultDialer: false,\n defaultDialerPackage: null,\n };\n }\n async placeCall(_options) {\n throw new Error(\"Phone calls are only available on Android.\");\n }\n async openDialer(_options) {\n throw new Error(\"Phone dialer is only available on Android.\");\n }\n async listRecentCalls(_options) {\n return { calls: [] };\n }\n async saveCallTranscript(_options) {\n throw new Error(\"Call transcripts are only available on Android.\");\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;AAEA,MAAM,OAAO,GAAG,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC;AACvD,MAAC,KAAK,GAAGA,mBAAc,CAAC,YAAY,EAAE;AAClD,IAAI,GAAG,EAAE,OAAO;AAChB,CAAC;;ACJM,MAAM,QAAQ,SAASC,cAAS,CAAC;AACxC,IAAI,MAAM,SAAS,GAAG;AACtB,QAAQ,OAAO;AACf,YAAY,UAAU,EAAE,KAAK;AAC7B,YAAY,aAAa,EAAE,KAAK;AAChC,YAAY,eAAe,EAAE,KAAK;AAClC,YAAY,oBAAoB,EAAE,IAAI;AACtC,SAAS;AACT,IAAI;AACJ,IAAI,MAAM,SAAS,CAAC,QAAQ,EAAE;AAC9B,QAAQ,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC;AACrE,IAAI;AACJ,IAAI,MAAM,UAAU,CAAC,QAAQ,EAAE;AAC/B,QAAQ,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC;AACrE,IAAI;AACJ,IAAI,MAAM,eAAe,CAAC,QAAQ,EAAE;AACpC,QAAQ,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE;AAC5B,IAAI;AACJ,IAAI,MAAM,kBAAkB,CAAC,QAAQ,EAAE;AACvC,QAAQ,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC;AAC1E,IAAI;AACJ;;;;;;;;;"}
1
+ {"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from \"@capacitor/core\";\nexport * from \"./definitions\";\nconst loadWeb = () => import(\"./web\").then((m) => new m.PhoneWeb());\nexport const Phone = registerPlugin(\"ElizaPhone\", {\n web: loadWeb,\n});\n//# sourceMappingURL=index.js.map","import { WebPlugin } from \"@capacitor/core\";\nfunction nonEmptyString(value) {\n return typeof value === \"string\" ? value.trim() : \"\";\n}\nfunction isRecord(value) {\n return typeof value === \"object\" && value !== null;\n}\nfunction validateCallTarget(options, { requireNumber }) {\n if (!isRecord(options)) {\n if (requireNumber) {\n throw new Error(\"number is required\");\n }\n return;\n }\n if ((requireNumber && options.number === undefined) ||\n (options.number !== undefined && !nonEmptyString(options.number))) {\n throw new Error(\"number is required\");\n }\n}\nfunction validateRecentCallsOptions(options) {\n if (options === undefined) {\n return;\n }\n if (!isRecord(options)) {\n throw new Error(\"options must be an object\");\n }\n if (options.limit !== undefined) {\n if (typeof options.limit !== \"number\" ||\n !Number.isFinite(options.limit) ||\n options.limit < 1 ||\n options.limit > 500) {\n throw new Error(\"limit must be between 1 and 500\");\n }\n }\n if (options.number !== undefined && !nonEmptyString(options.number)) {\n throw new Error(\"number must be a non-empty string\");\n }\n}\nfunction validateTranscriptOptions(options) {\n if (!isRecord(options) || !nonEmptyString(options.callId)) {\n throw new Error(\"callId is required\");\n }\n if (!nonEmptyString(options.transcript)) {\n throw new Error(\"transcript is required\");\n }\n}\nexport class PhoneWeb extends WebPlugin {\n async getStatus() {\n return {\n hasTelecom: false,\n canPlaceCalls: false,\n isDefaultDialer: false,\n defaultDialerPackage: null,\n };\n }\n async placeCall(options) {\n validateCallTarget(options, { requireNumber: true });\n throw new Error(\"Phone calls are only available on Android.\");\n }\n async openDialer(options) {\n validateCallTarget(options, { requireNumber: false });\n throw new Error(\"Phone dialer is only available on Android.\");\n }\n async listRecentCalls(options) {\n validateRecentCallsOptions(options);\n return { calls: [] };\n }\n async saveCallTranscript(options) {\n validateTranscriptOptions(options);\n throw new Error(\"Call transcripts are only available on Android.\");\n }\n // Web has no phone permission model; report granted so the shared view flow\n // proceeds (call placement / call-log throw or return empty on web anyway).\n async checkPermissions() {\n return { phone: \"granted\" };\n }\n async requestPermissions() {\n return { phone: \"granted\" };\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;AAEA,MAAM,OAAO,GAAG,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC;AACvD,MAAC,KAAK,GAAGA,mBAAc,CAAC,YAAY,EAAE;AAClD,IAAI,GAAG,EAAE,OAAO;AAChB,CAAC;;ACJD,SAAS,cAAc,CAAC,KAAK,EAAE;AAC/B,IAAI,OAAO,OAAO,KAAK,KAAK,QAAQ,GAAG,KAAK,CAAC,IAAI,EAAE,GAAG,EAAE;AACxD;AACA,SAAS,QAAQ,CAAC,KAAK,EAAE;AACzB,IAAI,OAAO,OAAO,KAAK,KAA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,KAAK,CAAC,iDAAiD,CAAC;AAC1E,IAAI;AACJ;AACA;AACA,IAAI,MAAM,gBAAgB,GAAG;AAC7B,QAAQ,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE;AACnC,IAAI;AACJ,IAAI,MAAM,kBAAkB,GAAG;AAC/B,QAAQ,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE;AACnC,IAAI;AACJ;;;;;;;;;"}
package/dist/plugin.js CHANGED
@@ -6,6 +6,51 @@ var capacitorPhone = (function (exports, core) {
6
6
  web: loadWeb,
7
7
  });
8
8
 
9
+ function nonEmptyString(value) {
10
+ return typeof value === "string" ? value.trim() : "";
11
+ }
12
+ function isRecord(value) {
13
+ return typeof value === "object" && value !== null;
14
+ }
15
+ function validateCallTarget(options, { requireNumber }) {
16
+ if (!isRecord(options)) {
17
+ if (requireNumber) {
18
+ throw new Error("number is required");
19
+ }
20
+ return;
21
+ }
22
+ if ((requireNumber && options.number === undefined) ||
23
+ (options.number !== undefined && !nonEmptyString(options.number))) {
24
+ throw new Error("number is required");
25
+ }
26
+ }
27
+ function validateRecentCallsOptions(options) {
28
+ if (options === undefined) {
29
+ return;
30
+ }
31
+ if (!isRecord(options)) {
32
+ throw new Error("options must be an object");
33
+ }
34
+ if (options.limit !== undefined) {
35
+ if (typeof options.limit !== "number" ||
36
+ !Number.isFinite(options.limit) ||
37
+ options.limit < 1 ||
38
+ options.limit > 500) {
39
+ throw new Error("limit must be between 1 and 500");
40
+ }
41
+ }
42
+ if (options.number !== undefined && !nonEmptyString(options.number)) {
43
+ throw new Error("number must be a non-empty string");
44
+ }
45
+ }
46
+ function validateTranscriptOptions(options) {
47
+ if (!isRecord(options) || !nonEmptyString(options.callId)) {
48
+ throw new Error("callId is required");
49
+ }
50
+ if (!nonEmptyString(options.transcript)) {
51
+ throw new Error("transcript is required");
52
+ }
53
+ }
9
54
  class PhoneWeb extends core.WebPlugin {
10
55
  async getStatus() {
11
56
  return {
@@ -15,18 +60,30 @@ var capacitorPhone = (function (exports, core) {
15
60
  defaultDialerPackage: null,
16
61
  };
17
62
  }
18
- async placeCall(_options) {
63
+ async placeCall(options) {
64
+ validateCallTarget(options, { requireNumber: true });
19
65
  throw new Error("Phone calls are only available on Android.");
20
66
  }
21
- async openDialer(_options) {
67
+ async openDialer(options) {
68
+ validateCallTarget(options, { requireNumber: false });
22
69
  throw new Error("Phone dialer is only available on Android.");
23
70
  }
24
- async listRecentCalls(_options) {
71
+ async listRecentCalls(options) {
72
+ validateRecentCallsOptions(options);
25
73
  return { calls: [] };
26
74
  }
27
- async saveCallTranscript(_options) {
75
+ async saveCallTranscript(options) {
76
+ validateTranscriptOptions(options);
28
77
  throw new Error("Call transcripts are only available on Android.");
29
78
  }
79
+ // Web has no phone permission model; report granted so the shared view flow
80
+ // proceeds (call placement / call-log throw or return empty on web anyway).
81
+ async checkPermissions() {
82
+ return { phone: "granted" };
83
+ }
84
+ async requestPermissions() {
85
+ return { phone: "granted" };
86
+ }
30
87
  }
31
88
 
32
89
  var web = /*#__PURE__*/Object.freeze({
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from \"@capacitor/core\";\nexport * from \"./definitions\";\nconst loadWeb = () => import(\"./web\").then((m) => new m.PhoneWeb());\nexport const Phone = registerPlugin(\"ElizaPhone\", {\n web: loadWeb,\n});\n//# sourceMappingURL=index.js.map","import { WebPlugin } from \"@capacitor/core\";\nexport class PhoneWeb extends WebPlugin {\n async getStatus() {\n return {\n hasTelecom: false,\n canPlaceCalls: false,\n isDefaultDialer: false,\n defaultDialerPackage: null,\n };\n }\n async placeCall(_options) {\n throw new Error(\"Phone calls are only available on Android.\");\n }\n async openDialer(_options) {\n throw new Error(\"Phone dialer is only available on Android.\");\n }\n async listRecentCalls(_options) {\n return { calls: [] };\n }\n async saveCallTranscript(_options) {\n throw new Error(\"Call transcripts are only available on Android.\");\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;IAEA,MAAM,OAAO,GAAG,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC;AACvD,UAAC,KAAK,GAAGA,mBAAc,CAAC,YAAY,EAAE;IAClD,IAAI,GAAG,EAAE,OAAO;IAChB,CAAC;;ICJM,MAAM,QAAQ,SAASC,cAAS,CAAC;IACxC,IAAI,MAAM,SAAS,GAAG;IACtB,QAAQ,OAAO;IACf,YAAY,UAAU,EAAE,KAAK;IAC7B,YAAY,aAAa,EAAE,KAAK;IAChC,YAAY,eAAe,EAAE,KAAK;IAClC,YAAY,oBAAoB,EAAE,IAAI;IACtC,SAAS;IACT,IAAI;IACJ,IAAI,MAAM,SAAS,CAAC,QAAQ,EAAE;IAC9B,QAAQ,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC;IACrE,IAAI;IACJ,IAAI,MAAM,UAAU,CAAC,QAAQ,EAAE;IAC/B,QAAQ,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC;IACrE,IAAI;IACJ,IAAI,MAAM,eAAe,CAAC,QAAQ,EAAE;IACpC,QAAQ,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE;IAC5B,IAAI;IACJ,IAAI,MAAM,kBAAkB,CAAC,QAAQ,EAAE;IACvC,QAAQ,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC;IAC1E,IAAI;IACJ;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from \"@capacitor/core\";\nexport * from \"./definitions\";\nconst loadWeb = () => import(\"./web\").then((m) => new m.PhoneWeb());\nexport const Phone = registerPlugin(\"ElizaPhone\", {\n web: loadWeb,\n});\n//# sourceMappingURL=index.js.map","import { WebPlugin } from \"@capacitor/core\";\nfunction nonEmptyString(value) {\n return typeof value === \"string\" ? value.trim() : \"\";\n}\nfunction isRecord(value) {\n return typeof value === \"object\" && value !== null;\n}\nfunction validateCallTarget(options, { requireNumber }) {\n if (!isRecord(options)) {\n if (requireNumber) {\n throw new Error(\"number is required\");\n }\n return;\n }\n if ((requireNumber && options.number === undefined) ||\n (options.number !== undefined && !nonEmptyString(options.number))) {\n throw new Error(\"number is required\");\n }\n}\nfunction validateRecentCallsOptions(options) {\n if (options === undefined) {\n return;\n }\n if (!isRecord(options)) {\n throw new Error(\"options must be an object\");\n }\n if (options.limit !== undefined) {\n if (typeof options.limit !== \"number\" ||\n !Number.isFinite(options.limit) ||\n options.limit < 1 ||\n options.limit > 500) {\n throw new Error(\"limit must be between 1 and 500\");\n }\n }\n if (options.number !== undefined && !nonEmptyString(options.number)) {\n throw new Error(\"number must be a non-empty string\");\n }\n}\nfunction validateTranscriptOptions(options) {\n if (!isRecord(options) || !nonEmptyString(options.callId)) {\n throw new Error(\"callId is required\");\n }\n if (!nonEmptyString(options.transcript)) {\n throw new Error(\"transcript is required\");\n }\n}\nexport class PhoneWeb extends WebPlugin {\n async getStatus() {\n return {\n hasTelecom: false,\n canPlaceCalls: false,\n isDefaultDialer: false,\n defaultDialerPackage: null,\n };\n }\n async placeCall(options) {\n validateCallTarget(options, { requireNumber: true });\n throw new Error(\"Phone calls are only available on Android.\");\n }\n async openDialer(options) {\n validateCallTarget(options, { requireNumber: false });\n throw new Error(\"Phone dialer is only available on Android.\");\n }\n async listRecentCalls(options) {\n validateRecentCallsOptions(options);\n return { calls: [] };\n }\n async saveCallTranscript(options) {\n validateTranscriptOptions(options);\n throw new Error(\"Call transcripts are only available on Android.\");\n }\n // Web has no phone permission model; report granted so the shared view flow\n // proceeds (call placement / call-log throw or return empty on web anyway).\n async checkPermissions() {\n return { phone: \"granted\" };\n }\n async requestPermissions() {\n return { phone: \"granted\" };\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;IAEA,MAAM,OAAO,GAAG,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CA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,KAAK,EAAE,CAAC;IAC7D,QAAQ,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC;IACrE,IAAI;IACJ,IAAI,MAAM,eAAe,CAAC,OAAO,EAAE;IACnC,QAAQ,0BAA0B,CAAC,OAAO,CAAC;IAC3C,QAAQ,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE;IAC5B,IAAI;IACJ,IAAI,MAAM,kBAAkB,CAAC,OAAO,EAAE;IACtC,QAAQ,yBAAyB,CAAC,OAAO,CAAC;IAC1C,QAAQ,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC;IAC1E,IAAI;IACJ;IACA;IACA,IAAI,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE;IACnC,IAAI;IACJ,IAAI,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE;IACnC,IAAI;IACJ;;;;;;;;;;;;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elizaos/capacitor-phone",
3
- "version": "1.0.0",
3
+ "version": "2.0.11-beta.7",
4
4
  "description": "Android phone and Telecom bridge for ElizaOS.",
5
5
  "main": "./dist/plugin.cjs.js",
6
6
  "module": "./dist/esm/index.js",
@@ -8,6 +8,8 @@
8
8
  "exports": {
9
9
  ".": {
10
10
  "types": "./dist/esm/index.d.ts",
11
+ "bun": "./src/index.ts",
12
+ "development": "./src/index.ts",
11
13
  "import": "./dist/esm/index.js",
12
14
  "require": "./dist/plugin.cjs.js"
13
15
  },
@@ -16,12 +18,15 @@
16
18
  "files": [
17
19
  "android/src/main/",
18
20
  "android/build.gradle",
19
- "dist/"
21
+ "dist/",
22
+ "dist"
20
23
  ],
21
24
  "scripts": {
22
- "build": "npm run clean && tsc && rollup -c rollup.config.mjs",
23
- "clean": "rimraf ./dist",
24
- "prepublishOnly": "npm run build"
25
+ "build": "node ../../packages/scripts/with-package-build-lock.mjs plugins/plugin-native-phone -- bun run build:unlocked",
26
+ "clean": "node ../../packages/scripts/rm-path-recursive.mjs dist",
27
+ "test": "vitest run",
28
+ "prepublishOnly": "bun run build",
29
+ "build:unlocked": "bun run clean && tsc && bunx rollup -c rollup.config.mjs"
25
30
  },
26
31
  "license": "MIT",
27
32
  "capacitor": {
@@ -30,11 +35,10 @@
30
35
  }
31
36
  },
32
37
  "devDependencies": {
33
- "@capacitor/cli": "^8.0.0",
34
38
  "@capacitor/core": "^8.3.1",
35
- "rimraf": "^6.0.0",
36
39
  "rollup": "^4.60.2",
37
- "typescript": "^6.0.0"
40
+ "typescript": "^6.0.3",
41
+ "vitest": "^4.0.0"
38
42
  },
39
43
  "peerDependencies": {
40
44
  "@capacitor/core": "^8.3.1"
@@ -52,5 +56,6 @@
52
56
  },
53
57
  "publishConfig": {
54
58
  "access": "public"
55
- }
59
+ },
60
+ "gitHead": "cdbc876f793d96073d7eb0d09715a031ce0cd32e"
56
61
  }