@mondaydotcomorg/atp-server 0.17.14

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 (307) hide show
  1. package/README.md +489 -0
  2. package/dist/aggregator/index.d.ts +59 -0
  3. package/dist/aggregator/index.d.ts.map +1 -0
  4. package/dist/aggregator/index.js +171 -0
  5. package/dist/aggregator/index.js.map +1 -0
  6. package/dist/callback/index.d.ts +98 -0
  7. package/dist/callback/index.d.ts.map +1 -0
  8. package/dist/callback/index.js +136 -0
  9. package/dist/callback/index.js.map +1 -0
  10. package/dist/client-sessions.d.ts +82 -0
  11. package/dist/client-sessions.d.ts.map +1 -0
  12. package/dist/client-sessions.js +174 -0
  13. package/dist/client-sessions.js.map +1 -0
  14. package/dist/controllers/definitions.controller.d.ts +4 -0
  15. package/dist/controllers/definitions.controller.d.ts.map +1 -0
  16. package/dist/controllers/definitions.controller.js +11 -0
  17. package/dist/controllers/definitions.controller.js.map +1 -0
  18. package/dist/controllers/execute.controller.d.ts +18 -0
  19. package/dist/controllers/execute.controller.d.ts.map +1 -0
  20. package/dist/controllers/execute.controller.js +122 -0
  21. package/dist/controllers/execute.controller.js.map +1 -0
  22. package/dist/controllers/info.controller.d.ts +3 -0
  23. package/dist/controllers/info.controller.d.ts.map +1 -0
  24. package/dist/controllers/info.controller.js +13 -0
  25. package/dist/controllers/info.controller.js.map +1 -0
  26. package/dist/controllers/resume.controller.d.ts +11 -0
  27. package/dist/controllers/resume.controller.d.ts.map +1 -0
  28. package/dist/controllers/resume.controller.js +61 -0
  29. package/dist/controllers/resume.controller.js.map +1 -0
  30. package/dist/controllers/search.controller.d.ts +4 -0
  31. package/dist/controllers/search.controller.d.ts.map +1 -0
  32. package/dist/controllers/search.controller.js +7 -0
  33. package/dist/controllers/search.controller.js.map +1 -0
  34. package/dist/controllers/stream.controller.d.ts +19 -0
  35. package/dist/controllers/stream.controller.d.ts.map +1 -0
  36. package/dist/controllers/stream.controller.js +141 -0
  37. package/dist/controllers/stream.controller.js.map +1 -0
  38. package/dist/core/config.d.ts +161 -0
  39. package/dist/core/config.d.ts.map +1 -0
  40. package/dist/core/config.js +7 -0
  41. package/dist/core/config.js.map +1 -0
  42. package/dist/core/http.d.ts +4 -0
  43. package/dist/core/http.d.ts.map +1 -0
  44. package/dist/core/http.js +17 -0
  45. package/dist/core/http.js.map +1 -0
  46. package/dist/create-server.d.ts +120 -0
  47. package/dist/create-server.d.ts.map +1 -0
  48. package/dist/create-server.js +423 -0
  49. package/dist/create-server.js.map +1 -0
  50. package/dist/execution-state/index.d.ts +95 -0
  51. package/dist/execution-state/index.d.ts.map +1 -0
  52. package/dist/execution-state/index.js +128 -0
  53. package/dist/execution-state/index.js.map +1 -0
  54. package/dist/executor/ast-provenance-bridge.d.ts +12 -0
  55. package/dist/executor/ast-provenance-bridge.d.ts.map +1 -0
  56. package/dist/executor/ast-provenance-bridge.js +66 -0
  57. package/dist/executor/ast-provenance-bridge.js.map +1 -0
  58. package/dist/executor/ast-tracking-runtime.d.ts +7 -0
  59. package/dist/executor/ast-tracking-runtime.d.ts.map +1 -0
  60. package/dist/executor/ast-tracking-runtime.js +559 -0
  61. package/dist/executor/ast-tracking-runtime.js.map +1 -0
  62. package/dist/executor/bootstrap-generated.d.ts +32 -0
  63. package/dist/executor/bootstrap-generated.d.ts.map +1 -0
  64. package/dist/executor/bootstrap-generated.js +90 -0
  65. package/dist/executor/bootstrap-generated.js.map +1 -0
  66. package/dist/executor/compiler-config.d.ts +32 -0
  67. package/dist/executor/compiler-config.d.ts.map +1 -0
  68. package/dist/executor/compiler-config.js +99 -0
  69. package/dist/executor/compiler-config.js.map +1 -0
  70. package/dist/executor/constants.d.ts +4 -0
  71. package/dist/executor/constants.d.ts.map +1 -0
  72. package/dist/executor/constants.js +4 -0
  73. package/dist/executor/constants.js.map +1 -0
  74. package/dist/executor/error-handler.d.ts +9 -0
  75. package/dist/executor/error-handler.d.ts.map +1 -0
  76. package/dist/executor/error-handler.js +95 -0
  77. package/dist/executor/error-handler.js.map +1 -0
  78. package/dist/executor/execution-error-handler.d.ts +7 -0
  79. package/dist/executor/execution-error-handler.d.ts.map +1 -0
  80. package/dist/executor/execution-error-handler.js +136 -0
  81. package/dist/executor/execution-error-handler.js.map +1 -0
  82. package/dist/executor/executor.d.ts +20 -0
  83. package/dist/executor/executor.d.ts.map +1 -0
  84. package/dist/executor/executor.js +452 -0
  85. package/dist/executor/executor.js.map +1 -0
  86. package/dist/executor/index.d.ts +4 -0
  87. package/dist/executor/index.d.ts.map +1 -0
  88. package/dist/executor/index.js +3 -0
  89. package/dist/executor/index.js.map +1 -0
  90. package/dist/executor/resume-handler.d.ts +9 -0
  91. package/dist/executor/resume-handler.d.ts.map +1 -0
  92. package/dist/executor/resume-handler.js +22 -0
  93. package/dist/executor/resume-handler.js.map +1 -0
  94. package/dist/executor/sandbox-builder.d.ts +29 -0
  95. package/dist/executor/sandbox-builder.d.ts.map +1 -0
  96. package/dist/executor/sandbox-builder.js +538 -0
  97. package/dist/executor/sandbox-builder.js.map +1 -0
  98. package/dist/executor/sandbox-injector.d.ts +7 -0
  99. package/dist/executor/sandbox-injector.d.ts.map +1 -0
  100. package/dist/executor/sandbox-injector.js +293 -0
  101. package/dist/executor/sandbox-injector.js.map +1 -0
  102. package/dist/executor/types.d.ts +21 -0
  103. package/dist/executor/types.d.ts.map +1 -0
  104. package/dist/executor/types.js +2 -0
  105. package/dist/executor/types.js.map +1 -0
  106. package/dist/explorer/index.d.ts +69 -0
  107. package/dist/explorer/index.d.ts.map +1 -0
  108. package/dist/explorer/index.js +228 -0
  109. package/dist/explorer/index.js.map +1 -0
  110. package/dist/handlers/definitions.handler.d.ts +3 -0
  111. package/dist/handlers/definitions.handler.d.ts.map +1 -0
  112. package/dist/handlers/definitions.handler.js +11 -0
  113. package/dist/handlers/definitions.handler.js.map +1 -0
  114. package/dist/handlers/execute.handler.d.ts +7 -0
  115. package/dist/handlers/execute.handler.d.ts.map +1 -0
  116. package/dist/handlers/execute.handler.js +225 -0
  117. package/dist/handlers/execute.handler.js.map +1 -0
  118. package/dist/handlers/explorer.handler.d.ts +4 -0
  119. package/dist/handlers/explorer.handler.d.ts.map +1 -0
  120. package/dist/handlers/explorer.handler.js +10 -0
  121. package/dist/handlers/explorer.handler.js.map +1 -0
  122. package/dist/handlers/init.handler.d.ts +5 -0
  123. package/dist/handlers/init.handler.d.ts.map +1 -0
  124. package/dist/handlers/init.handler.js +41 -0
  125. package/dist/handlers/init.handler.js.map +1 -0
  126. package/dist/handlers/resume.handler.d.ts +6 -0
  127. package/dist/handlers/resume.handler.d.ts.map +1 -0
  128. package/dist/handlers/resume.handler.js +256 -0
  129. package/dist/handlers/resume.handler.js.map +1 -0
  130. package/dist/handlers/search.handler.d.ts +5 -0
  131. package/dist/handlers/search.handler.d.ts.map +1 -0
  132. package/dist/handlers/search.handler.js +11 -0
  133. package/dist/handlers/search.handler.js.map +1 -0
  134. package/dist/http/request-handler.d.ts +15 -0
  135. package/dist/http/request-handler.d.ts.map +1 -0
  136. package/dist/http/request-handler.js +94 -0
  137. package/dist/http/request-handler.js.map +1 -0
  138. package/dist/http/router.d.ts +4 -0
  139. package/dist/http/router.d.ts.map +1 -0
  140. package/dist/http/router.js +32 -0
  141. package/dist/http/router.js.map +1 -0
  142. package/dist/index.d.ts +10 -0
  143. package/dist/index.d.ts.map +1 -0
  144. package/dist/index.js +8 -0
  145. package/dist/index.js.map +1 -0
  146. package/dist/instrumentation/index.d.ts +5 -0
  147. package/dist/instrumentation/index.d.ts.map +1 -0
  148. package/dist/instrumentation/index.js +5 -0
  149. package/dist/instrumentation/index.js.map +1 -0
  150. package/dist/instrumentation/serializer.d.ts +61 -0
  151. package/dist/instrumentation/serializer.d.ts.map +1 -0
  152. package/dist/instrumentation/serializer.js +334 -0
  153. package/dist/instrumentation/serializer.js.map +1 -0
  154. package/dist/instrumentation/state-manager.d.ts +61 -0
  155. package/dist/instrumentation/state-manager.d.ts.map +1 -0
  156. package/dist/instrumentation/state-manager.js +205 -0
  157. package/dist/instrumentation/state-manager.js.map +1 -0
  158. package/dist/instrumentation/transformer.d.ts +9 -0
  159. package/dist/instrumentation/transformer.d.ts.map +1 -0
  160. package/dist/instrumentation/transformer.js +70 -0
  161. package/dist/instrumentation/transformer.js.map +1 -0
  162. package/dist/instrumentation/types.d.ts +59 -0
  163. package/dist/instrumentation/types.d.ts.map +1 -0
  164. package/dist/instrumentation/types.js +5 -0
  165. package/dist/instrumentation/types.js.map +1 -0
  166. package/dist/middleware/audit.d.ts +18 -0
  167. package/dist/middleware/audit.d.ts.map +1 -0
  168. package/dist/middleware/audit.js +76 -0
  169. package/dist/middleware/audit.js.map +1 -0
  170. package/dist/openapi/index.d.ts +133 -0
  171. package/dist/openapi/index.d.ts.map +1 -0
  172. package/dist/openapi/index.js +235 -0
  173. package/dist/openapi/index.js.map +1 -0
  174. package/dist/openapi-loader.d.ts +87 -0
  175. package/dist/openapi-loader.d.ts.map +1 -0
  176. package/dist/openapi-loader.js +491 -0
  177. package/dist/openapi-loader.js.map +1 -0
  178. package/dist/routes/index.d.ts +21 -0
  179. package/dist/routes/index.d.ts.map +1 -0
  180. package/dist/routes/index.js +47 -0
  181. package/dist/routes/index.js.map +1 -0
  182. package/dist/search/index.d.ts +48 -0
  183. package/dist/search/index.d.ts.map +1 -0
  184. package/dist/search/index.js +156 -0
  185. package/dist/search/index.js.map +1 -0
  186. package/dist/security/index.d.ts +2 -0
  187. package/dist/security/index.d.ts.map +1 -0
  188. package/dist/security/index.js +2 -0
  189. package/dist/security/index.js.map +1 -0
  190. package/dist/shutdown.d.ts +19 -0
  191. package/dist/shutdown.d.ts.map +1 -0
  192. package/dist/shutdown.js +87 -0
  193. package/dist/shutdown.js.map +1 -0
  194. package/dist/utils/banner.d.ts +12 -0
  195. package/dist/utils/banner.d.ts.map +1 -0
  196. package/dist/utils/banner.js +18 -0
  197. package/dist/utils/banner.js.map +1 -0
  198. package/dist/utils/context.d.ts +16 -0
  199. package/dist/utils/context.d.ts.map +1 -0
  200. package/dist/utils/context.js +44 -0
  201. package/dist/utils/context.js.map +1 -0
  202. package/dist/utils/error.d.ts +8 -0
  203. package/dist/utils/error.d.ts.map +1 -0
  204. package/dist/utils/error.js +17 -0
  205. package/dist/utils/error.js.map +1 -0
  206. package/dist/utils/hint-based-instrumentation.d.ts +14 -0
  207. package/dist/utils/hint-based-instrumentation.d.ts.map +1 -0
  208. package/dist/utils/hint-based-instrumentation.js +84 -0
  209. package/dist/utils/hint-based-instrumentation.js.map +1 -0
  210. package/dist/utils/index.d.ts +8 -0
  211. package/dist/utils/index.d.ts.map +1 -0
  212. package/dist/utils/index.js +8 -0
  213. package/dist/utils/index.js.map +1 -0
  214. package/dist/utils/info.d.ts +20 -0
  215. package/dist/utils/info.d.ts.map +1 -0
  216. package/dist/utils/info.js +15 -0
  217. package/dist/utils/info.js.map +1 -0
  218. package/dist/utils/provenance-reattachment.d.ts +32 -0
  219. package/dist/utils/provenance-reattachment.d.ts.map +1 -0
  220. package/dist/utils/provenance-reattachment.js +115 -0
  221. package/dist/utils/provenance-reattachment.js.map +1 -0
  222. package/dist/utils/request.d.ts +21 -0
  223. package/dist/utils/request.d.ts.map +1 -0
  224. package/dist/utils/request.js +44 -0
  225. package/dist/utils/request.js.map +1 -0
  226. package/dist/utils/response.d.ts +30 -0
  227. package/dist/utils/response.d.ts.map +1 -0
  228. package/dist/utils/response.js +53 -0
  229. package/dist/utils/response.js.map +1 -0
  230. package/dist/utils/runtime-types.d.ts +6 -0
  231. package/dist/utils/runtime-types.d.ts.map +1 -0
  232. package/dist/utils/runtime-types.js +14 -0
  233. package/dist/utils/runtime-types.js.map +1 -0
  234. package/dist/utils/schema.d.ts +9 -0
  235. package/dist/utils/schema.d.ts.map +1 -0
  236. package/dist/utils/schema.js +13 -0
  237. package/dist/utils/schema.js.map +1 -0
  238. package/dist/utils/token-emitter.d.ts +21 -0
  239. package/dist/utils/token-emitter.d.ts.map +1 -0
  240. package/dist/utils/token-emitter.js +129 -0
  241. package/dist/utils/token-emitter.js.map +1 -0
  242. package/dist/validator/index.d.ts +36 -0
  243. package/dist/validator/index.d.ts.map +1 -0
  244. package/dist/validator/index.js +224 -0
  245. package/dist/validator/index.js.map +1 -0
  246. package/package.json +68 -0
  247. package/src/aggregator/index.ts +207 -0
  248. package/src/callback/index.ts +191 -0
  249. package/src/client-sessions.ts +234 -0
  250. package/src/controllers/definitions.controller.ts +19 -0
  251. package/src/controllers/execute.controller.ts +166 -0
  252. package/src/controllers/info.controller.ts +14 -0
  253. package/src/controllers/resume.controller.ts +92 -0
  254. package/src/controllers/search.controller.ts +16 -0
  255. package/src/controllers/stream.controller.ts +190 -0
  256. package/src/core/config.ts +180 -0
  257. package/src/core/http.ts +21 -0
  258. package/src/create-server.ts +536 -0
  259. package/src/execution-state/index.ts +204 -0
  260. package/src/executor/ast-provenance-bridge.ts +80 -0
  261. package/src/executor/ast-tracking-runtime.ts +558 -0
  262. package/src/executor/bootstrap-generated.ts +90 -0
  263. package/src/executor/compiler-config.ts +146 -0
  264. package/src/executor/constants.ts +5 -0
  265. package/src/executor/error-handler.ts +118 -0
  266. package/src/executor/execution-error-handler.ts +178 -0
  267. package/src/executor/executor.ts +631 -0
  268. package/src/executor/index.ts +3 -0
  269. package/src/executor/resume-handler.ts +39 -0
  270. package/src/executor/sandbox-builder.ts +684 -0
  271. package/src/executor/sandbox-injector.ts +345 -0
  272. package/src/executor/types.ts +22 -0
  273. package/src/explorer/index.ts +297 -0
  274. package/src/handlers/definitions.handler.ts +13 -0
  275. package/src/handlers/execute.handler.ts +286 -0
  276. package/src/handlers/explorer.handler.ts +18 -0
  277. package/src/handlers/init.handler.ts +53 -0
  278. package/src/handlers/resume.handler.ts +316 -0
  279. package/src/handlers/search.handler.ts +32 -0
  280. package/src/http/request-handler.ts +117 -0
  281. package/src/http/router.ts +29 -0
  282. package/src/index.ts +60 -0
  283. package/src/instrumentation/index.ts +4 -0
  284. package/src/instrumentation/serializer.ts +421 -0
  285. package/src/instrumentation/state-manager.ts +237 -0
  286. package/src/instrumentation/transformer.ts +84 -0
  287. package/src/instrumentation/types.ts +76 -0
  288. package/src/middleware/audit.ts +101 -0
  289. package/src/openapi/index.ts +378 -0
  290. package/src/openapi-loader.ts +744 -0
  291. package/src/routes/index.ts +93 -0
  292. package/src/search/index.ts +216 -0
  293. package/src/security/index.ts +1 -0
  294. package/src/shutdown.ts +108 -0
  295. package/src/utils/banner.ts +25 -0
  296. package/src/utils/context.ts +58 -0
  297. package/src/utils/error.ts +25 -0
  298. package/src/utils/hint-based-instrumentation.ts +99 -0
  299. package/src/utils/index.ts +15 -0
  300. package/src/utils/info.ts +31 -0
  301. package/src/utils/provenance-reattachment.ts +144 -0
  302. package/src/utils/request.ts +53 -0
  303. package/src/utils/response.ts +69 -0
  304. package/src/utils/runtime-types.ts +14 -0
  305. package/src/utils/schema.ts +18 -0
  306. package/src/utils/token-emitter.ts +182 -0
  307. package/src/validator/index.ts +253 -0
@@ -0,0 +1,559 @@
1
+ /**
2
+ * AST Provenance Tracking Runtime for isolated-vm
3
+ * This code is injected into the isolate and runs INSIDE the sandbox
4
+ * It must be plain JavaScript with no imports
5
+ */
6
+ // TODO: need to create atp.internal with internal functions like has to reduce complexity
7
+ export const AST_TRACKING_RUNTIME = `
8
+ // Pure JavaScript SHA-256 implementation for digest computation
9
+ function sha256(str) {
10
+ function rightRotate(value, amount) {
11
+ return (value >>> amount) | (value << (32 - amount));
12
+ }
13
+
14
+ const mathPow = Math.pow;
15
+ const maxWord = mathPow(2, 32);
16
+ const lengthProperty = 'length';
17
+ let i, j;
18
+ let result = '';
19
+
20
+ const words = [];
21
+ const asciiBitLength = str[lengthProperty] * 8;
22
+
23
+ let hash = sha256.h = sha256.h || [];
24
+ const k = sha256.k = sha256.k || [];
25
+ let primeCounter = k[lengthProperty];
26
+
27
+ const isComposite = {};
28
+ for (let candidate = 2; primeCounter < 64; candidate++) {
29
+ if (!isComposite[candidate]) {
30
+ for (i = 0; i < 313; i += candidate) {
31
+ isComposite[i] = candidate;
32
+ }
33
+ hash[primeCounter] = (mathPow(candidate, .5) * maxWord) | 0;
34
+ k[primeCounter++] = (mathPow(candidate, 1 / 3) * maxWord) | 0;
35
+ }
36
+ }
37
+
38
+ str += '\\x80';
39
+ while (str[lengthProperty] % 64 - 56) str += '\\x00';
40
+ for (i = 0; i < str[lengthProperty]; i++) {
41
+ j = str.charCodeAt(i);
42
+ if (j >> 8) return;
43
+ words[i >> 2] |= j << ((3 - i) % 4) * 8;
44
+ }
45
+ words[words[lengthProperty]] = ((asciiBitLength / maxWord) | 0);
46
+ words[words[lengthProperty]] = (asciiBitLength);
47
+
48
+ for (j = 0; j < words[lengthProperty];) {
49
+ const w = words.slice(j, j += 16);
50
+ const oldHash = hash;
51
+ hash = hash.slice(0, 8);
52
+
53
+ for (i = 0; i < 64; i++) {
54
+ const w15 = w[i - 15], w2 = w[i - 2];
55
+
56
+ const a = hash[0], e = hash[4];
57
+ const temp1 = hash[7]
58
+ + (rightRotate(e, 6) ^ rightRotate(e, 11) ^ rightRotate(e, 25))
59
+ + ((e & hash[5]) ^ ((~e) & hash[6]))
60
+ + k[i]
61
+ + (w[i] = (i < 16) ? w[i] : (
62
+ w[i - 16]
63
+ + (rightRotate(w15, 7) ^ rightRotate(w15, 18) ^ (w15 >>> 3))
64
+ + w[i - 7]
65
+ + (rightRotate(w2, 17) ^ rightRotate(w2, 19) ^ (w2 >>> 10))
66
+ ) | 0
67
+ );
68
+ const temp2 = (rightRotate(a, 2) ^ rightRotate(a, 13) ^ rightRotate(a, 22))
69
+ + ((a & hash[1]) ^ (a & hash[2]) ^ (hash[1] & hash[2]));
70
+
71
+ hash = [(temp1 + temp2) | 0].concat(hash);
72
+ hash[4] = (hash[4] + temp1) | 0;
73
+ }
74
+
75
+ for (i = 0; i < 8; i++) {
76
+ hash[i] = (hash[i] + oldHash[i]) | 0;
77
+ }
78
+ }
79
+
80
+ for (i = 0; i < 8; i++) {
81
+ for (j = 3; j + 1; j--) {
82
+ const b = (hash[i] >> (j * 8)) & 255;
83
+ result += ((b < 16) ? 0 : '') + b.toString(16);
84
+ }
85
+ }
86
+
87
+ // Convert hex to base64url
88
+ const hex = result;
89
+ const bytes = [];
90
+ for (let i = 0; i < hex.length; i += 2) {
91
+ bytes.push(parseInt(hex.substring(i, i + 2), 16));
92
+ }
93
+ let binary = '';
94
+ for (let i = 0; i < bytes.length; i++) {
95
+ binary += String.fromCharCode(bytes[i]);
96
+ }
97
+ const base64 = btoa(binary);
98
+ return base64.replace(/\\+/g, '-').replace(/\\//g, '_').replace(/=/g, '');
99
+ }
100
+
101
+ const __astTracker = {
102
+ metadata: new Map(),
103
+ nextId: 0,
104
+ hints: new Map(globalThis.__provenance_hints || []),
105
+ hintValues: new Map(globalThis.__provenance_hint_values || []),
106
+
107
+ // SHA-256 digest computation to match server-side
108
+ computeDigest(value) {
109
+ try {
110
+ const str = JSON.stringify(value);
111
+ return sha256(str);
112
+ } catch (e) {
113
+ return null;
114
+ }
115
+ },
116
+
117
+ getId(value) {
118
+ if (typeof value === 'object' && value !== null) {
119
+ if (!value.__prov_id__) {
120
+ const id = 'tracked_' + this.nextId++;
121
+ try {
122
+ Object.defineProperty(value, '__prov_id__', {
123
+ value: id,
124
+ writable: false,
125
+ enumerable: false,
126
+ configurable: true
127
+ });
128
+ } catch (e) {
129
+ return 'temp_' + Date.now() + '_' + Math.random();
130
+ }
131
+ return id;
132
+ }
133
+ return value.__prov_id__;
134
+ }
135
+ return 'primitive_' + Date.now() + '_' + Math.random();
136
+ },
137
+
138
+ track(value, source, deps) {
139
+ try {
140
+ const id = this.getId(value);
141
+ this.metadata.set(id, { id, source, deps: deps || [] });
142
+ console.log('[__track] Stored metadata:', id, 'source:', source.type, 'metadataSize:', this.metadata.size);
143
+ return value;
144
+ } catch (error) {
145
+ console.error('[__track] Error:', error);
146
+ return value;
147
+ }
148
+ },
149
+
150
+ trackBinary(left, right, operator) {
151
+ // Perform the actual operation
152
+ let result;
153
+ switch (operator) {
154
+ case '+': result = left + right; break;
155
+ case '-': result = left - right; break;
156
+ case '*': result = left * right; break;
157
+ case '/': result = left / right; break;
158
+ case '%': result = left % right; break;
159
+ case '==': result = left == right; break;
160
+ case '===': result = left === right; break;
161
+ case '!=': result = left != right; break;
162
+ case '!==': result = left !== right; break;
163
+ case '<': result = left < right; break;
164
+ case '>': result = left > right; break;
165
+ case '<=': result = left <= right; break;
166
+ case '>=': result = left >= right; break;
167
+ case '&&': result = left && right; break;
168
+ case '||': result = left || right; break;
169
+ default: result = left;
170
+ }
171
+
172
+ // Check if either operand has provenance
173
+ let hasToolSource = false;
174
+ let toolMetadata = null;
175
+
176
+ // Helper to check primitive provenance
177
+ const checkPrimitive = (value) => {
178
+ if (typeof value !== 'string' && typeof value !== 'number') {
179
+ return null;
180
+ }
181
+
182
+ // Check tainted key first
183
+ const taintedKey = 'tainted:' + String(value);
184
+ const taintedMeta = this.metadata.get(taintedKey);
185
+ if (taintedMeta && taintedMeta.source && taintedMeta.source.type === 'tool') {
186
+ return taintedMeta;
187
+ }
188
+
189
+ // Check hint-based tracking
190
+ const digest = this.computeDigest(value);
191
+ const hintMeta = this.hints.get(digest);
192
+ if (hintMeta && hintMeta.source && hintMeta.source.type === 'tool') {
193
+ return hintMeta;
194
+ }
195
+
196
+ // Check primitive map (id:key:value format)
197
+ for (const [key, meta] of this.metadata.entries()) {
198
+ if (!key.startsWith('tainted:') && key.includes(':')) {
199
+ const parts = key.split(':');
200
+ if (parts.length >= 3) {
201
+ const primitiveValue = parts.slice(2).join(':');
202
+ if (primitiveValue === String(value) && meta.source && meta.source.type === 'tool') {
203
+ return meta;
204
+ }
205
+ }
206
+ }
207
+ }
208
+
209
+ return null;
210
+ };
211
+
212
+ // Check left operand
213
+ if (typeof left === 'object' && left && left.__prov_id__) {
214
+ const leftMeta = this.metadata.get(left.__prov_id__);
215
+ if (leftMeta && leftMeta.source && leftMeta.source.type === 'tool') {
216
+ hasToolSource = true;
217
+ toolMetadata = leftMeta;
218
+ }
219
+ } else {
220
+ const primMeta = checkPrimitive(left);
221
+ if (primMeta) {
222
+ hasToolSource = true;
223
+ toolMetadata = primMeta;
224
+ }
225
+ }
226
+
227
+ // Check right operand
228
+ if (!hasToolSource) {
229
+ if (typeof right === 'object' && right && right.__prov_id__) {
230
+ const rightMeta = this.metadata.get(right.__prov_id__);
231
+ if (rightMeta && rightMeta.source && rightMeta.source.type === 'tool') {
232
+ hasToolSource = true;
233
+ toolMetadata = rightMeta;
234
+ }
235
+ } else {
236
+ const primMeta = checkPrimitive(right);
237
+ if (primMeta) {
238
+ hasToolSource = true;
239
+ toolMetadata = primMeta;
240
+ }
241
+ }
242
+ }
243
+
244
+ // If result is a string and has tool-sourced operand, mark it as tainted
245
+ if (hasToolSource && toolMetadata && (typeof result === 'string' || typeof result === 'number')) {
246
+ const taintedKey = 'tainted:' + String(result);
247
+ // Ensure metadata has all required fields, preserving readers from source
248
+ const fullMetadata = {
249
+ ...toolMetadata,
250
+ readers: toolMetadata.readers || { type: 'restricted', readers: [] },
251
+ dependencies: toolMetadata.dependencies || toolMetadata.deps || []
252
+ };
253
+ this.metadata.set(taintedKey, fullMetadata);
254
+ }
255
+
256
+ return result;
257
+ },
258
+
259
+ trackAssign(name, value) {
260
+ return value;
261
+ },
262
+
263
+ async trackMethod(object, method, args) {
264
+ // Recursively wrap tainted primitives in arguments before calling the method
265
+ function wrapTaintedInArgs(val, visited = new WeakSet()) {
266
+ if (val === null || val === undefined) return val;
267
+
268
+ // Check if this value has provenance
269
+ const prov = this.checkProvenance(val);
270
+ if (prov && (typeof val === 'string' || typeof val === 'number')) {
271
+ // Wrap tainted primitive
272
+ return { __tainted_value: val, __prov_meta: prov };
273
+ }
274
+
275
+ // Recursively process objects/arrays
276
+ if (typeof val === 'object') {
277
+ if (visited.has(val)) return val;
278
+ visited.add(val);
279
+
280
+ if (Array.isArray(val)) {
281
+ return val.map(item => wrapTaintedInArgs.call(this, item, visited));
282
+ } else {
283
+ const wrapped = {};
284
+ for (const [key, v] of Object.entries(val)) {
285
+ wrapped[key] = wrapTaintedInArgs.call(this, v, visited);
286
+ }
287
+ return wrapped;
288
+ }
289
+ }
290
+
291
+ return val;
292
+ }
293
+
294
+ // Wrap arguments
295
+ const wrappedArgs = args.map(arg => wrapTaintedInArgs.call(this, arg));
296
+
297
+ // Call the method with wrapped arguments
298
+ if (typeof object === 'object' && object !== null && method in object) {
299
+ const result = await object[method](...wrappedArgs);
300
+
301
+ // Track the result
302
+ if (result && typeof result === 'object') {
303
+ const id = this.getId(result);
304
+
305
+ // Extract authorized readers from common param patterns (email, userId, username, user)
306
+ // Match server-side logic in sandbox-builder.ts (lines 459-470)
307
+ let authorizedReaders = [];
308
+ for (const arg of args) {
309
+ if (arg && typeof arg === 'object') {
310
+ // Check for user identifier fields (email, user, userId only - no generic 'id')
311
+ const value = arg.email || arg.user || arg.userId;
312
+ if (typeof value === 'string' && value.length > 0) {
313
+ authorizedReaders.push(value);
314
+ break; // Only take first identifier
315
+ }
316
+ }
317
+ }
318
+
319
+ // If no email found, use tool-scoped authorization (matches server logic line 467-470)
320
+ if (authorizedReaders.length === 0) {
321
+ authorizedReaders = ['tool:' + method];
322
+ }
323
+
324
+ // Tool data should be restricted by default to prevent exfiltration
325
+ const metadata = {
326
+ id,
327
+ source: {
328
+ type: 'tool',
329
+ operation: method,
330
+ toolName: method,
331
+ timestamp: Date.now()
332
+ },
333
+ readers: { type: 'restricted', readers: authorizedReaders },
334
+ deps: [this.getId(object), ...args.map(a => this.getId(a))],
335
+ dependencies: []
336
+ };
337
+ this.metadata.set(id, metadata);
338
+
339
+ // Track primitive properties for token emission
340
+ for (const key in result) {
341
+ if (Object.prototype.hasOwnProperty.call(result, key)) {
342
+ const value = result[key];
343
+ if (typeof value === 'string' || typeof value === 'number') {
344
+ // Check if this primitive matches any hints
345
+ const digest = this.computeDigest(value);
346
+ const hintMeta = this.hints.get(digest);
347
+
348
+ const primitiveKey = id + ':' + key + ':' + String(value);
349
+ // Use hint metadata if available, otherwise use result metadata
350
+ this.metadata.set(primitiveKey, hintMeta || metadata);
351
+
352
+ // Also store by digest for cross-execution matching
353
+ if (hintMeta) {
354
+ const taintedKey = 'tainted:' + String(value);
355
+ this.metadata.set(taintedKey, hintMeta);
356
+ }
357
+ }
358
+ }
359
+ }
360
+ }
361
+
362
+ return result;
363
+ }
364
+ return undefined;
365
+ },
366
+
367
+ trackTemplate(expressions, quasis) {
368
+ let result = '';
369
+ let hasToolSource = false;
370
+ let toolMetadata = null;
371
+
372
+ // Helper to check primitive provenance
373
+ const checkPrimitive = (value) => {
374
+ if (typeof value !== 'string' && typeof value !== 'number') {
375
+ return null;
376
+ }
377
+
378
+ // Check tainted key first
379
+ const taintedKey = 'tainted:' + String(value);
380
+ const taintedMeta = this.metadata.get(taintedKey);
381
+ if (taintedMeta && taintedMeta.source && taintedMeta.source.type === 'tool') {
382
+ return taintedMeta;
383
+ }
384
+
385
+ // Check hint-based tracking
386
+ const digest = this.computeDigest(value);
387
+ const hintMeta = this.hints.get(digest);
388
+ if (hintMeta && hintMeta.source && hintMeta.source.type === 'tool') {
389
+ return hintMeta;
390
+ }
391
+
392
+ // Check primitive map (id:key:value format)
393
+ for (const [key, meta] of this.metadata.entries()) {
394
+ if (!key.startsWith('tainted:') && key.includes(':')) {
395
+ const parts = key.split(':');
396
+ if (parts.length >= 3) {
397
+ const primitiveValue = parts.slice(2).join(':');
398
+ if (primitiveValue === String(value) && meta.source && meta.source.type === 'tool') {
399
+ return meta;
400
+ }
401
+ }
402
+ }
403
+ }
404
+
405
+ return null;
406
+ };
407
+
408
+ for (let i = 0; i < quasis.length; i++) {
409
+ result += quasis[i] || '';
410
+ if (i < expressions.length) {
411
+ const expr = expressions[i];
412
+ result += String(expr);
413
+
414
+ // Check if expression has provenance
415
+ if (!hasToolSource) {
416
+ // Check object provenance
417
+ if (typeof expr === 'object' && expr && expr.__prov_id__) {
418
+ const exprMeta = this.metadata.get(expr.__prov_id__);
419
+ if (exprMeta && exprMeta.source && exprMeta.source.type === 'tool') {
420
+ hasToolSource = true;
421
+ toolMetadata = exprMeta;
422
+ }
423
+ } else {
424
+ const primMeta = checkPrimitive(expr);
425
+ if (primMeta) {
426
+ hasToolSource = true;
427
+ toolMetadata = primMeta;
428
+ }
429
+ }
430
+ }
431
+ }
432
+ }
433
+
434
+ // If template contains tool-sourced data, mark result as tainted
435
+ if (hasToolSource && toolMetadata) {
436
+ const taintedKey = 'tainted:' + result;
437
+ // Ensure metadata has all required fields, preserving readers from source
438
+ const fullMetadata = {
439
+ ...toolMetadata,
440
+ readers: toolMetadata.readers || { type: 'restricted', readers: [] },
441
+ dependencies: toolMetadata.dependencies || toolMetadata.deps || []
442
+ };
443
+ this.metadata.set(taintedKey, fullMetadata);
444
+ }
445
+
446
+ return result;
447
+ },
448
+
449
+ getMetadata(value) {
450
+ const id = typeof value === 'object' && value && value.__prov_id__;
451
+ return id ? this.metadata.get(id) : null;
452
+ },
453
+
454
+ getAllMetadata() {
455
+ return Array.from(this.metadata.entries());
456
+ },
457
+
458
+ // Check if a value or any nested value has tool-sourced provenance
459
+ checkProvenance(value) {
460
+ if (value === null || value === undefined) {
461
+ return null;
462
+ }
463
+
464
+ // Check if it's an object with __prov_id__
465
+ if (typeof value === 'object' && value.__prov_id__) {
466
+ const meta = this.metadata.get(value.__prov_id__);
467
+ if (meta && meta.source && meta.source.type === 'tool') {
468
+ return meta;
469
+ }
470
+ }
471
+
472
+ // Check if it's a primitive with tainted metadata
473
+ if (typeof value === 'string' || typeof value === 'number') {
474
+ const taintedKey = 'tainted:' + String(value);
475
+ const taintedMeta = this.metadata.get(taintedKey);
476
+ if (taintedMeta && taintedMeta.source && taintedMeta.source.type === 'tool') {
477
+ return taintedMeta;
478
+ }
479
+
480
+ // Check primitive map
481
+ for (const [key, meta] of this.metadata.entries()) {
482
+ if (!key.startsWith('tainted:') && key.includes(':')) {
483
+ const parts = key.split(':');
484
+ if (parts.length >= 3) {
485
+ const primitiveValue = parts.slice(2).join(':');
486
+ if (primitiveValue === String(value) && meta.source && meta.source.type === 'tool') {
487
+ return meta;
488
+ }
489
+ }
490
+ }
491
+ }
492
+
493
+ // Check hints
494
+ const digest = this.computeDigest(value);
495
+ const hintMeta = this.hints.get(digest);
496
+ if (hintMeta && hintMeta.source && hintMeta.source.type === 'tool') {
497
+ return hintMeta;
498
+ }
499
+ }
500
+
501
+ // For objects/arrays, recursively check all values
502
+ if (typeof value === 'object') {
503
+ for (const key in value) {
504
+ if (Object.prototype.hasOwnProperty.call(value, key)) {
505
+ const nestedMeta = this.checkProvenance(value[key]);
506
+ if (nestedMeta) {
507
+ return nestedMeta;
508
+ }
509
+ }
510
+ }
511
+ }
512
+
513
+ return null;
514
+ }
515
+ };
516
+
517
+ // Expose tracking functions globally
518
+ globalThis.__track = (v, s, d) => __astTracker.track(v, s, d);
519
+ globalThis.__track_binary = (l, r, o) => __astTracker.trackBinary(l, r, o);
520
+ globalThis.__track_assign = (n, v) => __astTracker.trackAssign(n, v);
521
+ globalThis.__track_method = (o, m, a) => __astTracker.trackMethod(o, m, a);
522
+ globalThis.__track_template = (e, q) => __astTracker.trackTemplate(e, q);
523
+ globalThis.__get_provenance = (v) => __astTracker.getMetadata(v);
524
+ globalThis.__get_all_metadata = () => __astTracker.getAllMetadata();
525
+ globalThis.__check_provenance = (v) => __astTracker.checkProvenance(v);
526
+
527
+ // Mark a string literal as tainted (for cross-execution tracking)
528
+ globalThis.__mark_tainted = (value) => {
529
+ // Check if this value matches a hint by exact digest
530
+ const digest = __astTracker.computeDigest(value);
531
+ const hintMeta = __astTracker.hints.get(digest);
532
+ if (hintMeta) {
533
+ const taintedKey = 'tainted:' + String(value);
534
+ __astTracker.metadata.set(taintedKey, hintMeta);
535
+ return value;
536
+ }
537
+
538
+ // ALSO check if this value CONTAINS any hint values (substring match)
539
+ // This enables cross-execution tracking for template literals/concatenation
540
+ if (typeof value === 'string' && __astTracker.hintValues && __astTracker.hintValues.size > 0) {
541
+ for (const [hintValue, metadata] of __astTracker.hintValues.entries()) {
542
+ if (value.includes(hintValue)) {
543
+ const taintedKey = 'tainted:' + String(value);
544
+ // Ensure metadata has all required fields, use restricted readers for tool data
545
+ const fullMetadata = {
546
+ ...metadata,
547
+ readers: metadata.readers || { type: 'restricted', readers: [] },
548
+ dependencies: metadata.dependencies || metadata.deps || []
549
+ };
550
+ __astTracker.metadata.set(taintedKey, fullMetadata);
551
+ return value;
552
+ }
553
+ }
554
+ }
555
+
556
+ return value;
557
+ };
558
+ `;
559
+ //# sourceMappingURL=ast-tracking-runtime.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ast-tracking-runtime.js","sourceRoot":"","sources":["../../src/executor/ast-tracking-runtime.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,0FAA0F;AAC1F,MAAM,CAAC,MAAM,oBAAoB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuiBnC,CAAC"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * AUTO-GENERATED - DO NOT EDIT
3
+ * Generated by scripts/generate-bootstrap.ts
4
+ *
5
+ * This file contains the bootstrap code injected into the isolated-vm sandbox
6
+
7
+ /**
8
+ * Bootstrap code for isolated-vm context
9
+ * Creates the globalThis.atp object with all runtime APIs
10
+ *
11
+ * Each method is a wrapper that calls the corresponding isolated-vm Reference
12
+ * The References must be set using context.global.set() before evaluating this code
13
+ *
14
+ * Required References (11 total):
15
+ * - __atp_approval_request
16
+ * - __atp_cache_delete
17
+ * - __atp_cache_get
18
+ * - __atp_cache_has
19
+ * - __atp_cache_set
20
+ * - __atp_embedding_embed
21
+ * - __atp_embedding_search
22
+ * - __atp_llm_call
23
+ * - __atp_llm_classify
24
+ * - __atp_llm_extract
25
+ * - __atp_progress_report
26
+ */
27
+ export declare const BOOTSTRAP_CODE = "\n\t\tglobalThis.atp = {\n\t\t\t\tapproval: {\n\t\t\t\t\trequest: async (message, approvalContext) => {\n\t\t\t\t\t\treturn await __atp_approval_request.apply(undefined, [message, approvalContext], { arguments: { copy: true }, result: { promise: true } });\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tllm: {\n\t\t\t\t\tcall: async (options) => {\n\t\t\t\t\t\treturn await __atp_llm_call.apply(undefined, [options], { arguments: { copy: true }, result: { promise: true } });\n\t\t\t\t\t},\n\t\t\t\t\textract: async (options) => {\n\t\t\t\t\t\treturn await __atp_llm_extract.apply(undefined, [options], { arguments: { copy: true }, result: { promise: true } });\n\t\t\t\t\t},\n\t\t\t\t\tclassify: async (options) => {\n\t\t\t\t\t\treturn await __atp_llm_classify.apply(undefined, [options], { arguments: { copy: true }, result: { promise: true } });\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tcache: {\n\t\t\t\t\tget: async (key) => {\n\t\t\t\t\t\treturn await __atp_cache_get.apply(undefined, [key], { arguments: { copy: true }, result: { promise: true } });\n\t\t\t\t\t},\n\t\t\t\t\tset: async (key, value, ttl) => {\n\t\t\t\t\t\treturn await __atp_cache_set.apply(undefined, [key, value, ttl], { arguments: { copy: true }, result: { promise: true } });\n\t\t\t\t\t},\n\t\t\t\t\tdelete: async (key) => {\n\t\t\t\t\t\treturn await __atp_cache_delete.apply(undefined, [key], { arguments: { copy: true }, result: { promise: true } });\n\t\t\t\t\t},\n\t\t\t\t\thas: async (key) => {\n\t\t\t\t\t\treturn await __atp_cache_has.apply(undefined, [key], { arguments: { copy: true }, result: { promise: true } });\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tembedding: {\n\t\t\t\t\tembed: async (text, options) => {\n\t\t\t\t\t\treturn await __atp_embedding_embed.apply(undefined, [text, options], { arguments: { copy: true }, result: { promise: true } });\n\t\t\t\t\t},\n\t\t\t\t\tsearch: async (query, options) => {\n\t\t\t\t\t\treturn await __atp_embedding_search.apply(undefined, [query, options], { arguments: { copy: true }, result: { promise: true } });\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tprogress: {\n\t\t\t\t\treport: (message, fraction) => {\n\t\t\t\t\t\t__atp_progress_report.applyIgnored(undefined, [message, fraction], { arguments: { copy: true } });\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t};\n";
28
+ /**
29
+ * List of all isolated-vm Reference names that must be injected
30
+ */
31
+ export declare const REQUIRED_REFERENCES: string[];
32
+ //# sourceMappingURL=bootstrap-generated.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bootstrap-generated.d.ts","sourceRoot":"","sources":["../../src/executor/bootstrap-generated.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,cAAc,0tEA8C1B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,mBAAmB,UAY/B,CAAC"}
@@ -0,0 +1,90 @@
1
+ /**
2
+ * AUTO-GENERATED - DO NOT EDIT
3
+ * Generated by scripts/generate-bootstrap.ts
4
+ *
5
+ * This file contains the bootstrap code injected into the isolated-vm sandbox
6
+
7
+ /**
8
+ * Bootstrap code for isolated-vm context
9
+ * Creates the globalThis.atp object with all runtime APIs
10
+ *
11
+ * Each method is a wrapper that calls the corresponding isolated-vm Reference
12
+ * The References must be set using context.global.set() before evaluating this code
13
+ *
14
+ * Required References (11 total):
15
+ * - __atp_approval_request
16
+ * - __atp_cache_delete
17
+ * - __atp_cache_get
18
+ * - __atp_cache_has
19
+ * - __atp_cache_set
20
+ * - __atp_embedding_embed
21
+ * - __atp_embedding_search
22
+ * - __atp_llm_call
23
+ * - __atp_llm_classify
24
+ * - __atp_llm_extract
25
+ * - __atp_progress_report
26
+ */
27
+ export const BOOTSTRAP_CODE = `
28
+ globalThis.atp = {
29
+ approval: {
30
+ request: async (message, approvalContext) => {
31
+ return await __atp_approval_request.apply(undefined, [message, approvalContext], { arguments: { copy: true }, result: { promise: true } });
32
+ }
33
+ },
34
+ llm: {
35
+ call: async (options) => {
36
+ return await __atp_llm_call.apply(undefined, [options], { arguments: { copy: true }, result: { promise: true } });
37
+ },
38
+ extract: async (options) => {
39
+ return await __atp_llm_extract.apply(undefined, [options], { arguments: { copy: true }, result: { promise: true } });
40
+ },
41
+ classify: async (options) => {
42
+ return await __atp_llm_classify.apply(undefined, [options], { arguments: { copy: true }, result: { promise: true } });
43
+ }
44
+ },
45
+ cache: {
46
+ get: async (key) => {
47
+ return await __atp_cache_get.apply(undefined, [key], { arguments: { copy: true }, result: { promise: true } });
48
+ },
49
+ set: async (key, value, ttl) => {
50
+ return await __atp_cache_set.apply(undefined, [key, value, ttl], { arguments: { copy: true }, result: { promise: true } });
51
+ },
52
+ delete: async (key) => {
53
+ return await __atp_cache_delete.apply(undefined, [key], { arguments: { copy: true }, result: { promise: true } });
54
+ },
55
+ has: async (key) => {
56
+ return await __atp_cache_has.apply(undefined, [key], { arguments: { copy: true }, result: { promise: true } });
57
+ }
58
+ },
59
+ embedding: {
60
+ embed: async (text, options) => {
61
+ return await __atp_embedding_embed.apply(undefined, [text, options], { arguments: { copy: true }, result: { promise: true } });
62
+ },
63
+ search: async (query, options) => {
64
+ return await __atp_embedding_search.apply(undefined, [query, options], { arguments: { copy: true }, result: { promise: true } });
65
+ }
66
+ },
67
+ progress: {
68
+ report: (message, fraction) => {
69
+ __atp_progress_report.applyIgnored(undefined, [message, fraction], { arguments: { copy: true } });
70
+ }
71
+ }
72
+ };
73
+ `;
74
+ /**
75
+ * List of all isolated-vm Reference names that must be injected
76
+ */
77
+ export const REQUIRED_REFERENCES = [
78
+ '__atp_approval_request',
79
+ '__atp_cache_delete',
80
+ '__atp_cache_get',
81
+ '__atp_cache_has',
82
+ '__atp_cache_set',
83
+ '__atp_embedding_embed',
84
+ '__atp_embedding_search',
85
+ '__atp_llm_call',
86
+ '__atp_llm_classify',
87
+ '__atp_llm_extract',
88
+ '__atp_progress_report',
89
+ ];
90
+ //# sourceMappingURL=bootstrap-generated.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bootstrap-generated.js","sourceRoot":"","sources":["../../src/executor/bootstrap-generated.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8C7B,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG;IAClC,wBAAwB;IACxB,oBAAoB;IACpB,iBAAiB;IACjB,iBAAiB;IACjB,iBAAiB;IACjB,uBAAuB;IACvB,wBAAwB;IACxB,gBAAgB;IAChB,oBAAoB;IACpB,mBAAmB;IACnB,uBAAuB;CACvB,CAAC"}