@ansight/capacitor 1.0.2-preview.6

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,14 @@
1
+ Pod::Spec.new do |s|
2
+ s.name = 'AnsightCapacitor'
3
+ s.version = '1.0.2-preview.6'
4
+ s.summary = 'Capacitor bridge for the Ansight mobile observability SDK.'
5
+ s.license = { :type => 'Ansight SDK Source-Available License', :file => 'LICENSE' }
6
+ s.homepage = 'https://github.com/ansight-ai/ansight-sdk'
7
+ s.author = { 'Ansight' => 'hello@ansight.ai' }
8
+ s.source = { :git => 'https://github.com/ansight-ai/ansight-sdk.git', :tag => s.version.to_s }
9
+ s.source_files = 'ios/Sources/AnsightCapacitorPlugin/**/*.{swift,h,m,c,cc,mm,cpp}'
10
+ s.ios.deployment_target = '15.0'
11
+ s.swift_version = '5.9'
12
+ s.dependency 'Capacitor'
13
+ s.dependency 'Ansight', s.version.to_s
14
+ end
package/LICENSE ADDED
@@ -0,0 +1,200 @@
1
+ Ansight SDK Source-Available License
2
+ Version 1.0
3
+
4
+ Copyright (c) 2026 Ansight, Inc. All rights reserved.
5
+
6
+ This license governs the Ansight SDK and associated source code, documentation,
7
+ examples, build files, binaries, and other materials made available with it
8
+ (the "SDK").
9
+
10
+ The SDK is source-available software. It is not open-source software.
11
+
12
+ By downloading, installing, copying, modifying, distributing, or using the SDK,
13
+ you accept this license. If you do not accept this license, you may not use the
14
+ SDK.
15
+
16
+ 1. Purpose
17
+
18
+ Ansight makes the SDK source available so developers, customers, researchers,
19
+ and security reviewers can inspect how the SDK works, evaluate its security,
20
+ debug integrations, report issues, and propose improvements.
21
+
22
+ Except for the rights expressly granted below, Ansight reserves all rights.
23
+
24
+ 2. Definitions
25
+
26
+ "Ansight Services" means services, APIs, systems, products, accounts,
27
+ infrastructure, software, development tools, test endpoints, sandbox
28
+ environments, local tools, or other components operated by, provided by,
29
+ authorized by, or on behalf of Ansight, Inc. or its affiliates. This includes
30
+ Ansight-hosted services, Ansight Studio, Ansight APIs, Ansight-issued accounts
31
+ or API keys, and any service or component expressly authorized by Ansight in
32
+ writing.
33
+
34
+ "Non-Ansight Services" means any service, API, backend, product, infrastructure,
35
+ system, software, or component that is not an Ansight Service.
36
+
37
+ "Application" means software developed by you that incorporates, links to, or
38
+ uses the SDK.
39
+
40
+ 3. Permitted Uses
41
+
42
+ Subject to this license, you may:
43
+
44
+ (a) read, inspect, and analyze the SDK source code;
45
+
46
+ (b) copy and build the SDK for evaluation, testing, debugging, security review,
47
+ and development of Applications that use Ansight Services;
48
+
49
+ (c) modify the SDK for your own internal development, testing, debugging,
50
+ security review, or use with Ansight Services;
51
+
52
+ (d) use and distribute the SDK, including in source, compiled, or object-code
53
+ form, only as part of an Application that connects to or interoperates with
54
+ Ansight Services;
55
+
56
+ (e) distribute Applications containing the SDK through app stores, package
57
+ managers, enterprise distribution systems, mobile device management systems,
58
+ continuous integration systems, TestFlight, Google Play testing tracks, or
59
+ similar software distribution channels, provided the SDK is used only with
60
+ Ansight Services;
61
+
62
+ (f) share bug reports, vulnerability reports, patches, pull requests, and other
63
+ proposed improvements with Ansight; and
64
+
65
+ (g) make public forks or copies of the SDK solely for review, discussion,
66
+ security research, issue reporting, or contribution back to Ansight, provided
67
+ that this license and all copyright, trademark, attribution, and other notices
68
+ remain intact.
69
+
70
+ 4. Restrictions
71
+
72
+ You may not:
73
+
74
+ (a) use the SDK with, connect the SDK to, or adapt the SDK for any Non-Ansight
75
+ Services;
76
+
77
+ (b) use the SDK to develop, operate, enable, or support any service or product
78
+ that replaces, proxies, emulates, competes with, or avoids the need for Ansight
79
+ Services;
80
+
81
+ (c) sell, sublicense, rent, lease, host, or provide the SDK as a standalone
82
+ product, SDK-as-a-service, managed service, hosted service, or competing SDK
83
+ distribution;
84
+
85
+ (d) remove, obscure, or alter any copyright, license, trademark, attribution,
86
+ security, telemetry, pairing, provenance, or service-association notices in the
87
+ SDK;
88
+
89
+ (e) circumvent license checks, authentication, pairing, service association,
90
+ security controls, or technical measures in the SDK or Ansight Services;
91
+
92
+ (f) use Ansight names, logos, or trademarks except as necessary to accurately
93
+ identify the SDK or Ansight Services;
94
+
95
+ (g) use the SDK in violation of applicable law, regulation, sanctions,
96
+ export-control rules, privacy rules, app-store policies, or third-party rights;
97
+ or
98
+
99
+ (h) grant any rights in the SDK to others beyond the rights expressly permitted
100
+ by this license.
101
+
102
+ 5. Contributions
103
+
104
+ If you submit a patch, pull request, issue comment, vulnerability report, code,
105
+ documentation, suggestion, or other contribution to Ansight relating to the SDK,
106
+ you grant Ansight a perpetual, worldwide, irrevocable, sublicensable,
107
+ transferable, royalty-free license to use, reproduce, modify, distribute,
108
+ perform, display, commercialize, and otherwise exploit that contribution for any
109
+ purpose.
110
+
111
+ You represent that you have the right to grant this license for your
112
+ contribution.
113
+
114
+ To the extent permitted by law, you waive and agree not to assert moral rights
115
+ in your contribution against Ansight, its affiliates, its customers, or its
116
+ users.
117
+
118
+ 6. Security Research
119
+
120
+ Ansight welcomes good-faith security review of the SDK. You may inspect, test,
121
+ and analyze the SDK for security issues and disclose suspected vulnerabilities
122
+ to Ansight through the security reporting process published by Ansight.
123
+
124
+ This license does not authorize access to systems, services, accounts, devices,
125
+ networks, data, or infrastructure without permission. It does not authorize
126
+ disruption, degradation, data exfiltration, privacy violations, or activity that
127
+ would harm Ansight, its customers, or third parties.
128
+
129
+ 7. Separate Agreements
130
+
131
+ If you have a separate written agreement with Ansight governing your use of the
132
+ SDK, that agreement controls to the extent of any conflict with this license.
133
+
134
+ 8. Third-Party Software
135
+
136
+ The SDK may include or depend on third-party software, libraries, tools, or
137
+ materials. Those components are licensed under their own terms. This license
138
+ applies only to the SDK materials provided by Ansight.
139
+
140
+ 9. No Support Obligation
141
+
142
+ Ansight has no obligation under this license to provide support, maintenance,
143
+ updates, hosted services, compatibility fixes, security fixes, or other
144
+ assistance for the SDK.
145
+
146
+ 10. Trademarks
147
+
148
+ No trademark rights are granted under this license. You may use Ansight names
149
+ only as necessary to accurately identify the SDK or Ansight Services, and only
150
+ in a way that does not imply endorsement, sponsorship, or affiliation except as
151
+ expressly authorized by Ansight.
152
+
153
+ 11. Termination
154
+
155
+ If you violate this license, your rights under it terminate automatically. Upon
156
+ termination, you must stop using, copying, modifying, and distributing the SDK.
157
+
158
+ Sections 4 through 18 survive termination.
159
+
160
+ 12. No Warranty
161
+
162
+ The SDK is provided "as is" and "as available", without warranties or conditions
163
+ of any kind, whether express, implied, statutory, or otherwise, including
164
+ warranties of merchantability, fitness for a particular purpose, title,
165
+ non-infringement, security, accuracy, availability, or error-free operation.
166
+
167
+ 13. Limitation of Liability
168
+
169
+ To the maximum extent permitted by law, Ansight will not be liable for any
170
+ indirect, incidental, special, consequential, exemplary, or punitive damages, or
171
+ for lost profits, lost revenues, lost data, loss of goodwill, business
172
+ interruption, security incidents, or service interruption, arising out of or
173
+ relating to the SDK or this license.
174
+
175
+ 14. Assignment
176
+
177
+ You may not assign or transfer this license without Ansight's prior written
178
+ consent. Ansight may assign or transfer this license without restriction.
179
+
180
+ 15. Waiver
181
+
182
+ Failure by Ansight to enforce any provision of this license does not waive its
183
+ right to enforce that provision or any other provision later.
184
+
185
+ 16. Severability
186
+
187
+ If any provision of this license is found unenforceable, the remaining
188
+ provisions remain in effect, and the unenforceable provision will be interpreted
189
+ to the maximum extent permitted by law.
190
+
191
+ 17. Entire Agreement
192
+
193
+ This license is the entire agreement between you and Ansight regarding the SDK,
194
+ except to the extent you have a separate written agreement with Ansight that
195
+ controls under Section 7.
196
+
197
+ 18. No Other Rights
198
+
199
+ No rights are granted except as expressly stated in this license. All rights not
200
+ expressly granted are reserved by Ansight.
package/Package.swift ADDED
@@ -0,0 +1,38 @@
1
+ // swift-tools-version: 5.9
2
+ import PackageDescription
3
+ import Foundation
4
+
5
+ let useLocalAnsightSdk = ProcessInfo.processInfo.environment["ANSIGHT_USE_LOCAL_SDK"] == "1"
6
+ let ansightSdkDependency: Package.Dependency = useLocalAnsightSdk
7
+ ? .package(name: "AnsightSDK", path: "../ios")
8
+ : .package(
9
+ url: "https://github.com/ansight-ai/ansight-sdk.git",
10
+ exact: "1.0.2-preview.6"
11
+ )
12
+ let ansightTargetDependency: Target.Dependency = .product(
13
+ name: "Ansight",
14
+ package: useLocalAnsightSdk ? "AnsightSDK" : "ansight-sdk"
15
+ )
16
+
17
+ let package = Package(
18
+ name: "AnsightCapacitor",
19
+ platforms: [.iOS(.v15), .macOS(.v11)],
20
+ products: [
21
+ .library(name: "AnsightCapacitor", targets: ["AnsightCapacitorPlugin"])
22
+ ],
23
+ dependencies: [
24
+ .package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "8.0.0"),
25
+ ansightSdkDependency
26
+ ],
27
+ targets: [
28
+ .target(
29
+ name: "AnsightCapacitorPlugin",
30
+ dependencies: [
31
+ .product(name: "Capacitor", package: "capacitor-swift-pm"),
32
+ .product(name: "Cordova", package: "capacitor-swift-pm"),
33
+ ansightTargetDependency
34
+ ],
35
+ path: "ios/Sources/AnsightCapacitorPlugin"
36
+ )
37
+ ]
38
+ )
package/README.md ADDED
@@ -0,0 +1,139 @@
1
+ # Ansight for Capacitor
2
+
3
+ `@ansight/capacitor` brings the Ansight Android and iOS runtimes to Capacitor 8
4
+ applications. It exposes native telemetry, pairing, screenshots, touch capture,
5
+ session properties, logs, guarded remote tools, JavaScript custom tools,
6
+ artifacts, DOM inspection, route tracking, lifecycle tracking, and JavaScript
7
+ error capture through one TypeScript API.
8
+
9
+ ## Install
10
+
11
+ ```bash
12
+ npm install @ansight/capacitor
13
+ npx cap sync
14
+ ```
15
+
16
+ Requirements are Node 22+, Capacitor 8, Android API 24+ with Java 21, and iOS
17
+ 15+. The npm package links `ai.ansight:ansight-android` on Android and the
18
+ `Ansight` Swift package/CocoaPod on iOS.
19
+
20
+ ## Start Ansight
21
+
22
+ ```ts
23
+ import Ansight from '@ansight/capacitor';
24
+
25
+ await Ansight.initializeAndActivate(
26
+ Ansight.createOptionsBuilder()
27
+ .withAnsightDefaults()
28
+ .withReadOnlyToolAccess()
29
+ .withDomTools()
30
+ .withErrorCapture()
31
+ .registerCustomProperty('app', 'flavour', 'development')
32
+ .build(),
33
+ );
34
+
35
+ await Ansight.connect(null, { clientName: 'Capacitor app' });
36
+ ```
37
+
38
+ Use `.withAnsightSdk()` or `.withAllToolAccess()` only in trusted development
39
+ builds. Do not embed developer pairing material or unrestricted remote tools in
40
+ store builds.
41
+
42
+ Pair with an explicit JSON document when needed:
43
+
44
+ ```ts
45
+ await Ansight.savePairingConfig(pairingJson);
46
+ await Ansight.connect(pairingJson, {
47
+ expectedAppId: 'your-app-id',
48
+ clientName: 'Capacitor app',
49
+ });
50
+ ```
51
+
52
+ ## Telemetry and capture
53
+
54
+ ```ts
55
+ await Ansight.registerMetricChannel({
56
+ id: 42,
57
+ name: 'Queue depth',
58
+ unit: 'items',
59
+ });
60
+ await Ansight.metric(7, 42);
61
+ await Ansight.event({
62
+ label: 'Sync completed',
63
+ type: 'App',
64
+ details: JSON.stringify({ records: 7 }),
65
+ });
66
+ await Ansight.screenViewed('Settings');
67
+ await Ansight.sendClientLog('Settings loaded');
68
+ await Ansight.captureScreenFrame({ quality: 70, maxWidth: 720 });
69
+ ```
70
+
71
+ The facade also exposes `recordedMetrics`, `recordedEvents`, FPS and touch
72
+ capture controls, lifecycle state, runtime snapshots, current options, host
73
+ status/capabilities, and session custom-property mutations.
74
+
75
+ The builder mirrors the portable React Native helpers for memory-channel
76
+ exclusions, numeric JPEG capture configuration, bundled host configuration,
77
+ discovery/retention settings, and visual-tree enable/disable. App-state
78
+ tracking is available under both `startLifecycleTracking` /
79
+ `stopLifecycleTracking` and `startAppStateTracking` / `stopAppStateTracking`.
80
+
81
+ ## JavaScript tools and artifacts
82
+
83
+ ```ts
84
+ const tool = Ansight.registerTool(
85
+ {
86
+ id: 'app.get_state',
87
+ name: 'Get app state',
88
+ category: 'App',
89
+ scope: 'read',
90
+ },
91
+ async () => ({ success: true, result: { ready: true } }),
92
+ );
93
+ await tool.ready;
94
+
95
+ const provider = Ansight.registerArtifactProvider({
96
+ descriptor: { id: 'app.exports', name: 'App exports' },
97
+ query: async () => [{ id: 'state', name: 'State JSON', contentType: 'application/json' }],
98
+ create: async () => ({
99
+ payload: { text: JSON.stringify({ ready: true }) },
100
+ metadata: { fileName: 'state.json', contentType: 'application/json' },
101
+ }),
102
+ });
103
+ await provider.ready;
104
+ ```
105
+
106
+ Artifact payloads may be text, `Uint8Array`, `ArrayBuffer`, or byte arrays.
107
+ Binary payloads use the native live-session transfer channel.
108
+
109
+ ## WebView DOM tools
110
+
111
+ `.withDomTools()` registers `dom.get_document`, `dom.inspect_node`, and
112
+ `dom.query_selector`. Pass `{ allowActions: true }` to add the write-scoped
113
+ `dom.invoke_action` tool for click, focus, blur, and value-change operations.
114
+ Native `ui.*` tools remain available for the Android/iOS view hierarchy.
115
+ Call `uninstallDomTools()` to remove the adapter and its registrations.
116
+
117
+ For no-bundler applications, `dist/standalone.js` is a self-contained script
118
+ that initializes the developer defaults. Configure it before loading:
119
+
120
+ ```html
121
+ <script>
122
+ globalThis.__ANSIGHT_CAPACITOR_STANDALONE_OPTIONS__ = {
123
+ toolGuard: 'readOnly',
124
+ };
125
+ </script>
126
+ <script src="./node_modules/@ansight/capacitor/dist/standalone.js"></script>
127
+ ```
128
+
129
+ ## Validation
130
+
131
+ The complete interactive harness is in
132
+ [`example-app`](./example-app/README.md). It contains 54 feature checks and
133
+ buildable Android and iOS projects. The repository also provides a pinned
134
+ 25-application open-source compatibility corpus:
135
+
136
+ ```bash
137
+ npm --prefix src/capacitor run verify
138
+ node scripts/setup-capacitor-test-apps.mjs
139
+ ```
@@ -0,0 +1,52 @@
1
+ buildscript {
2
+ repositories {
3
+ google()
4
+ mavenCentral()
5
+ gradlePluginPortal()
6
+ }
7
+ dependencies {
8
+ classpath "com.android.tools.build:gradle:8.13.0"
9
+ classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:2.2.20"
10
+ }
11
+ }
12
+
13
+ apply plugin: "com.android.library"
14
+ apply plugin: "org.jetbrains.kotlin.android"
15
+
16
+ android {
17
+ namespace = "ai.ansight.capacitor"
18
+ compileSdk = project.hasProperty("compileSdkVersion") ? rootProject.ext.compileSdkVersion : 36
19
+
20
+ defaultConfig {
21
+ minSdk = project.hasProperty("minSdkVersion") ? rootProject.ext.minSdkVersion : 24
22
+ targetSdk = project.hasProperty("targetSdkVersion") ? rootProject.ext.targetSdkVersion : 36
23
+ versionCode = 1
24
+ versionName = "1.0"
25
+ }
26
+
27
+ sourceSets {
28
+ main.java.srcDirs += "src/main/kotlin"
29
+ }
30
+
31
+ compileOptions {
32
+ sourceCompatibility JavaVersion.VERSION_21
33
+ targetCompatibility JavaVersion.VERSION_21
34
+ }
35
+
36
+ kotlin {
37
+ jvmToolchain(21)
38
+ }
39
+
40
+ lint {
41
+ abortOnError = false
42
+ }
43
+
44
+ publishing {
45
+ singleVariant("release")
46
+ }
47
+ }
48
+
49
+ dependencies {
50
+ implementation project(":capacitor-android")
51
+ implementation "ai.ansight:ansight-android:1.0.2-preview.6"
52
+ }
@@ -0,0 +1,20 @@
1
+ pluginManagement {
2
+ repositories {
3
+ google()
4
+ mavenCentral()
5
+ gradlePluginPortal()
6
+ }
7
+ }
8
+
9
+ dependencyResolutionManagement {
10
+ repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
11
+ repositories {
12
+ mavenLocal()
13
+ google()
14
+ mavenCentral()
15
+ }
16
+ }
17
+
18
+ rootProject.name = "ansight-capacitor"
19
+ include(":capacitor-android")
20
+ project(":capacitor-android").projectDir = new File("../node_modules/@capacitor/android/capacitor")
@@ -0,0 +1 @@
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android" />