@mobileaidev/ai-app-bridge 0.2.15 → 0.3.0-rc.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.
Files changed (156) hide show
  1. package/LICENSE +201 -0
  2. package/NOTICE +7 -0
  3. package/README.md +306 -53
  4. package/bin/ai-app-bridge.js +51 -4504
  5. package/bin/android-permissions.js +152 -0
  6. package/bin/android-uia-xml.js +74 -0
  7. package/bin/artifact-paths.js +127 -1
  8. package/bin/bridge-forward.js +56 -0
  9. package/bin/command-discovery.js +86 -0
  10. package/bin/command-errors.js +60 -0
  11. package/bin/command-registry.js +504 -0
  12. package/bin/command-request.js +14 -0
  13. package/bin/command-router.js +80 -0
  14. package/bin/connection-cache.js +119 -0
  15. package/bin/device-provider.js +2934 -0
  16. package/bin/execution-host.js +596 -0
  17. package/bin/execution-runtime.js +101 -0
  18. package/bin/fact-codec.js +321 -0
  19. package/bin/fact-recorder.js +691 -0
  20. package/bin/fact-store.js +226 -0
  21. package/bin/feedback-probe.js +285 -0
  22. package/bin/intent/install-intent.js +267 -0
  23. package/bin/intent/intent-action-executor.js +129 -0
  24. package/bin/intent/intent-autonomous-adapter.js +46 -0
  25. package/bin/intent/intent-capture-port.js +64 -0
  26. package/bin/intent/intent-entry.js +226 -0
  27. package/bin/intent/intent-errors.js +28 -0
  28. package/bin/intent/intent-evidence-store.js +121 -0
  29. package/bin/intent/intent-lifetime.js +62 -0
  30. package/bin/intent/intent-observation-target.js +33 -0
  31. package/bin/intent/intent-observer.js +194 -0
  32. package/bin/intent/intent-production-adapter.js +334 -0
  33. package/bin/intent/intent-provider.js +27 -0
  34. package/bin/intent/intent-runtime.js +63 -0
  35. package/bin/intent/intent-worker.js +432 -0
  36. package/bin/intent/ios-intent-adapter.js +90 -0
  37. package/bin/intent/permission-intent.js +239 -0
  38. package/bin/intent/web-intent-adapter.js +31 -0
  39. package/bin/ios-device-outcome.js +47 -0
  40. package/bin/ios-execution.js +108 -0
  41. package/bin/ios-provider.js +497 -583
  42. package/bin/ios-runtime-binding.js +54 -0
  43. package/bin/ios-wda-execution.js +70 -0
  44. package/bin/ios-wda-port.js +98 -0
  45. package/bin/ios-wda-project.js +79 -0
  46. package/bin/mcp-server.js +83 -1040
  47. package/bin/mmap-scan-index.js +329 -0
  48. package/bin/observation-collector.js +862 -0
  49. package/bin/runtime-client.js +154 -0
  50. package/bin/runtime-directory.js +107 -0
  51. package/bin/runtime-protocol.js +36 -0
  52. package/bin/script/bounded-script-registry.js +103 -0
  53. package/bin/script/node-runtime-adapter.js +233 -0
  54. package/bin/script/progress-projector.js +63 -0
  55. package/bin/script/python-runtime-adapter.js +111 -0
  56. package/bin/script/rolling-summary.js +134 -0
  57. package/bin/script/script-agent-port.js +40 -0
  58. package/bin/script/script-assert.js +95 -0
  59. package/bin/script/script-capture-port.js +76 -0
  60. package/bin/script/script-catalog.js +85 -0
  61. package/bin/script/script-durable-restore.js +195 -0
  62. package/bin/script/script-entry-code.js +26 -0
  63. package/bin/script/script-entry-route.js +38 -0
  64. package/bin/script/script-entry.js +3 -0
  65. package/bin/script/script-errors.js +29 -0
  66. package/bin/script/script-evidence-store.js +22 -0
  67. package/bin/script/script-format-removed.js +26 -0
  68. package/bin/script/script-host-port.js +397 -0
  69. package/bin/script/script-ledger.js +64 -0
  70. package/bin/script/script-result.js +57 -0
  71. package/bin/script/script-sdk.js +152 -0
  72. package/bin/script/script-sdk.py +153 -0
  73. package/bin/script/script-session-channel.js +127 -0
  74. package/bin/script/script-spec.js +86 -0
  75. package/bin/script/script-supervisor.js +919 -0
  76. package/bin/script/templates/checkpoint-reentry.js +13 -0
  77. package/bin/segment-index.js +481 -0
  78. package/bin/segmented-fact-store.js +1571 -0
  79. package/bin/shared-kernel/android-h5-target.js +10 -0
  80. package/bin/shared-kernel/android-install-execution.js +176 -0
  81. package/bin/shared-kernel/android-sdk-endpoint.js +42 -0
  82. package/bin/shared-kernel/android-shell-execution.js +195 -0
  83. package/bin/shared-kernel/argument-schema.js +117 -0
  84. package/bin/shared-kernel/canonical-path.js +17 -0
  85. package/bin/shared-kernel/device-acknowledgements.js +53 -0
  86. package/bin/shared-kernel/device-completion-history.js +52 -0
  87. package/bin/shared-kernel/device-mutation-lease.js +219 -0
  88. package/bin/shared-kernel/device-ownership-recovery.js +95 -0
  89. package/bin/shared-kernel/device-ownership-store.js +94 -0
  90. package/bin/shared-kernel/evidence-adapters.js +251 -0
  91. package/bin/shared-kernel/evidence-archive.js +329 -0
  92. package/bin/shared-kernel/evidence-recording.js +131 -0
  93. package/bin/shared-kernel/evidence-schema.js +194 -0
  94. package/bin/shared-kernel/evidence-store.js +190 -0
  95. package/bin/shared-kernel/execution-admission.js +22 -0
  96. package/bin/shared-kernel/execution-contracts.js +171 -0
  97. package/bin/shared-kernel/execution-io.js +106 -0
  98. package/bin/shared-kernel/execution-ledger.js +125 -0
  99. package/bin/shared-kernel/execution-scope.js +87 -0
  100. package/bin/shared-kernel/execution-target.js +115 -0
  101. package/bin/shared-kernel/flutter-execution.js +13 -0
  102. package/bin/shared-kernel/flutter-h5-port.js +60 -0
  103. package/bin/shared-kernel/flutter-h5-target.js +9 -0
  104. package/bin/shared-kernel/flutter-target.js +75 -0
  105. package/bin/shared-kernel/h5-execution.js +11 -0
  106. package/bin/shared-kernel/h5-target.js +31 -0
  107. package/bin/shared-kernel/host-fact-store.js +49 -0
  108. package/bin/shared-kernel/ios-h5-target.js +9 -0
  109. package/bin/shared-kernel/ios-native-target.js +71 -0
  110. package/bin/shared-kernel/live-capture-query.js +115 -0
  111. package/bin/shared-kernel/managed-sdk-execution.js +78 -0
  112. package/bin/shared-kernel/native-execution.js +13 -0
  113. package/bin/shared-kernel/native-target.js +156 -0
  114. package/bin/shared-kernel/provider-command-contracts.js +55 -0
  115. package/bin/shared-kernel/recorded-payload-archive.js +195 -0
  116. package/bin/shared-kernel/request-context.js +35 -0
  117. package/bin/shared-kernel/semantic-node.js +55 -0
  118. package/bin/shared-kernel/summary-transformer.js +352 -0
  119. package/bin/shared-kernel/target-lease-protocol.js +47 -0
  120. package/bin/shared-kernel/text-wait.js +111 -0
  121. package/bin/shared-kernel/uia-execution.js +96 -0
  122. package/bin/shared-kernel/uia-protocol.js +214 -0
  123. package/bin/shared-kernel/uia-runtime-port.js +377 -0
  124. package/bin/shared-kernel/uia-target.js +39 -0
  125. package/bin/shared-kernel/web-dom-target.js +44 -0
  126. package/bin/shared-kernel/xml-attributes.js +25 -0
  127. package/bin/target-execution.js +275 -0
  128. package/bin/web/command-schema.js +60 -0
  129. package/bin/web/session-store.js +157 -0
  130. package/bin/web-provider.js +334 -553
  131. package/docs/COMMAND_CONTRACT.md +1563 -0
  132. package/docs/EVIDENCE_ARCHIVE.md +214 -0
  133. package/docs/INTENT_FOREGROUND.md +71 -0
  134. package/docs/INTENT_NATIVE_EDITING.md +79 -0
  135. package/docs/RELEASE.md +59 -0
  136. package/docs/SCRIPT_AUTHORING.md +489 -0
  137. package/node_modules/@mobileaidev/segmented-fact-store-native/LICENSE +201 -0
  138. package/node_modules/@mobileaidev/segmented-fact-store-native/NOTICE +7 -0
  139. package/node_modules/@mobileaidev/segmented-fact-store-native/binding.gyp +36 -0
  140. package/node_modules/@mobileaidev/segmented-fact-store-native/bindings/node/sfs_node.c +597 -0
  141. package/node_modules/@mobileaidev/segmented-fact-store-native/include/sfs.h +178 -0
  142. package/node_modules/@mobileaidev/segmented-fact-store-native/index.js +5 -0
  143. package/node_modules/@mobileaidev/segmented-fact-store-native/package.json +24 -0
  144. package/node_modules/@mobileaidev/segmented-fact-store-native/src/sfs.c +2349 -0
  145. package/package.json +60 -5
  146. package/runtime/ios-wda/AABWDABinding.h +19 -0
  147. package/runtime/ios-wda/AABWDABinding.m +97 -0
  148. package/runtime/ios-wda/AABWDAExecution.h +26 -0
  149. package/runtime/ios-wda/AABWDAExecution.m +172 -0
  150. package/runtime/ios-wda/AABWDAIntegration.h +71 -0
  151. package/runtime/ios-wda/AABWDAManagedRoutes.h +392 -0
  152. package/runtime/ios-wda/AABWDAReceiptStore.h +10 -0
  153. package/runtime/ios-wda/AABWDAReceiptStore.m +116 -0
  154. package/runtime/uia/ai-app-bridge-uia.jar +0 -0
  155. package/runtime/uia/manifest.json +22 -0
  156. package/skills/ai-app-bridge-use/SKILL.md +23 -360
@@ -0,0 +1,178 @@
1
+ #ifndef SFS_H
2
+ #define SFS_H
3
+
4
+ #include <stddef.h>
5
+ #include <stdint.h>
6
+
7
+ #ifdef __cplusplus
8
+ extern "C" {
9
+ #endif
10
+
11
+ #if defined(_WIN32) && defined(SFS_SHARED)
12
+ #if defined(SFS_BUILDING_LIBRARY)
13
+ #define SFS_API __declspec(dllexport)
14
+ #else
15
+ #define SFS_API __declspec(dllimport)
16
+ #endif
17
+ #else
18
+ #define SFS_API
19
+ #endif
20
+
21
+ #define SFS_FORMAT_VERSION 1u
22
+ #define SFS_SEGMENT_HEADER_SIZE 64u
23
+ #define SFS_DEFAULT_SEGMENT_SIZE (1024u * 1024u)
24
+ #define SFS_MAX_PARTITIONS 8u
25
+ #define SFS_PARTITION_ALL UINT32_MAX
26
+
27
+ typedef struct sfs_store sfs_store_t;
28
+
29
+ typedef int32_t sfs_result_t;
30
+ enum {
31
+ SFS_OK = 0,
32
+ SFS_END = 1,
33
+ SFS_BUFFER_TOO_SMALL = 2,
34
+ SFS_ERR_INVALID_ARGUMENT = -1,
35
+ SFS_ERR_IO = -2,
36
+ SFS_ERR_FORMAT_VERSION = -3,
37
+ SFS_ERR_CORRUPT = -4,
38
+ SFS_ERR_FULL = -5,
39
+ SFS_ERR_BUSY = -6,
40
+ SFS_ERR_NOMEM = -7,
41
+ SFS_ERR_CLOSED = -8,
42
+ SFS_ERR_PARTITION_DISABLED = -9
43
+ };
44
+
45
+ typedef uint32_t sfs_open_flags_t;
46
+ enum {
47
+ SFS_OPEN_CREATE = 1u << 0
48
+ };
49
+
50
+ typedef int32_t sfs_durability_t;
51
+ enum {
52
+ SFS_DURABILITY_MEMORY = 0,
53
+ SFS_DURABILITY_SYNC = 1
54
+ };
55
+
56
+ typedef uint32_t sfs_status_flags_t;
57
+ enum {
58
+ SFS_STATUS_RECOVERED_TAIL = 1u << 0
59
+ };
60
+
61
+ typedef uint32_t sfs_partition_status_flags_t;
62
+ enum {
63
+ SFS_PARTITION_ENABLED = 1u << 0
64
+ };
65
+
66
+ typedef uint32_t sfs_record_flags_t;
67
+ enum {
68
+ SFS_RECORD_GAP_BEFORE = 1u << 0
69
+ };
70
+
71
+ typedef struct sfs_open_options {
72
+ uint32_t struct_size;
73
+ uint32_t flags;
74
+ const char *directory;
75
+ uint64_t segment_size;
76
+ uint64_t partition_quotas[SFS_MAX_PARTITIONS];
77
+ } sfs_open_options_t;
78
+
79
+ typedef struct sfs_cursor {
80
+ uint32_t partition_id;
81
+ uint32_t flags;
82
+ uint64_t after_sequence;
83
+ uint64_t segment_id;
84
+ uint64_t offset;
85
+ } sfs_cursor_t;
86
+
87
+ #define SFS_CURSOR_BEGIN \
88
+ { SFS_PARTITION_ALL, 0u, 0u, 0u, 0u }
89
+
90
+ #define SFS_CURSOR_PARTITION(partition) \
91
+ { (partition), 0u, 0u, 0u, 0u }
92
+
93
+ typedef struct sfs_record_info {
94
+ uint32_t struct_size;
95
+ uint32_t payload_length;
96
+ uint32_t partition_id;
97
+ uint32_t flags;
98
+ uint64_t sequence;
99
+ uint64_t segment_id;
100
+ uint64_t frame_offset;
101
+ uint64_t gap_first_sequence;
102
+ uint64_t gap_last_sequence;
103
+ } sfs_record_info_t;
104
+
105
+ typedef struct sfs_partition_status {
106
+ uint32_t partition_id;
107
+ uint32_t flags;
108
+ uint64_t quota_bytes;
109
+ uint64_t allocated_bytes;
110
+ uint64_t segment_count;
111
+ uint64_t first_segment_id;
112
+ uint64_t active_segment_id;
113
+ uint64_t active_write_offset;
114
+ uint64_t record_count;
115
+ uint64_t payload_bytes;
116
+ uint64_t first_sequence;
117
+ uint64_t last_sequence;
118
+ uint64_t evicted_segments;
119
+ uint64_t evicted_records;
120
+ uint64_t evicted_payload_bytes;
121
+ } sfs_partition_status_t;
122
+
123
+ typedef struct sfs_status {
124
+ uint32_t struct_size;
125
+ uint32_t format_version;
126
+ uint32_t flags;
127
+ uint32_t reserved;
128
+ uint64_t segment_size;
129
+ uint64_t segment_count;
130
+ uint64_t record_count;
131
+ uint64_t payload_bytes;
132
+ uint64_t next_sequence;
133
+ uint32_t recovery_partition_id;
134
+ uint32_t recovery_reserved;
135
+ uint64_t recovery_segment_id;
136
+ uint64_t recovery_offset;
137
+ uint64_t recovery_discarded_bytes;
138
+ sfs_partition_status_t partitions[SFS_MAX_PARTITIONS];
139
+ } sfs_status_t;
140
+
141
+ typedef struct sfs_error {
142
+ int32_t code;
143
+ int32_t system_code;
144
+ char message[160];
145
+ } sfs_error_t;
146
+
147
+ SFS_API sfs_result_t sfs_open(const sfs_open_options_t *options,
148
+ sfs_store_t **out_store,
149
+ sfs_error_t *error);
150
+
151
+ SFS_API sfs_result_t sfs_append(sfs_store_t *store,
152
+ uint32_t partition_id,
153
+ const void *payload,
154
+ uint32_t payload_length,
155
+ sfs_durability_t durability,
156
+ sfs_record_info_t *out_record,
157
+ sfs_error_t *error);
158
+
159
+ SFS_API sfs_result_t sfs_scan(sfs_store_t *store,
160
+ sfs_cursor_t *cursor,
161
+ void *buffer,
162
+ uint32_t buffer_capacity,
163
+ sfs_record_info_t *out_record,
164
+ sfs_error_t *error);
165
+
166
+ SFS_API sfs_result_t sfs_status(sfs_store_t *store,
167
+ sfs_status_t *out_status,
168
+ sfs_error_t *error);
169
+
170
+ SFS_API sfs_result_t sfs_flush(sfs_store_t *store, sfs_error_t *error);
171
+
172
+ SFS_API sfs_result_t sfs_close(sfs_store_t *store, sfs_error_t *error);
173
+
174
+ #ifdef __cplusplus
175
+ }
176
+ #endif
177
+
178
+ #endif
@@ -0,0 +1,5 @@
1
+ 'use strict';
2
+
3
+ const path = require('node:path');
4
+
5
+ module.exports = require(path.join(__dirname, 'build', 'Release', 'segmented_fact_store.node'));
@@ -0,0 +1,24 @@
1
+ {
2
+ "name": "@mobileaidev/segmented-fact-store-native",
3
+ "version": "0.1.0",
4
+ "description": "Portable segmented mmap fact-store core and Node-API binding for AI App Bridge.",
5
+ "main": "index.js",
6
+ "gypfile": true,
7
+ "files": [
8
+ "binding.gyp",
9
+ "index.js",
10
+ "include",
11
+ "src",
12
+ "bindings/node/sfs_node.c",
13
+ "LICENSE",
14
+ "NOTICE"
15
+ ],
16
+ "scripts": {
17
+ "build": "node-gyp rebuild",
18
+ "test": "node --test bindings/node/test/*.test.js"
19
+ },
20
+ "engines": {
21
+ "node": ">=18"
22
+ },
23
+ "license": "Apache-2.0"
24
+ }