@appport/sdk 1.1.19 → 1.1.20

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 (479) hide show
  1. package/LICENSE +126 -0
  2. package/README.md +86 -9
  3. package/dist/application-onboarding.d.ts +52 -0
  4. package/dist/application-onboarding.d.ts.map +1 -0
  5. package/dist/application-onboarding.js +50 -0
  6. package/dist/application-onboarding.js.map +1 -0
  7. package/dist/external-compatibility.d.ts +142 -0
  8. package/dist/external-compatibility.d.ts.map +1 -0
  9. package/dist/external-compatibility.js +132 -0
  10. package/dist/external-compatibility.js.map +1 -0
  11. package/dist/index.d.ts +18 -13
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/index.js +18 -13
  14. package/dist/index.js.map +1 -1
  15. package/dist/node.d.ts +1 -1
  16. package/dist/node.js +1 -1
  17. package/dist/provider-lifecycle.d.ts +247 -0
  18. package/dist/provider-lifecycle.d.ts.map +1 -0
  19. package/dist/provider-lifecycle.js +314 -0
  20. package/dist/provider-lifecycle.js.map +1 -0
  21. package/dist/resolution-policy.d.ts +81 -0
  22. package/dist/resolution-policy.d.ts.map +1 -0
  23. package/dist/resolution-policy.js +131 -0
  24. package/dist/resolution-policy.js.map +1 -0
  25. package/package.json +32 -22
  26. package/vendor/@appport/authorization/README.md +28 -0
  27. package/vendor/@appport/authorization/dist/index.d.ts +94 -0
  28. package/vendor/@appport/authorization/dist/index.d.ts.map +1 -0
  29. package/vendor/@appport/authorization/dist/index.js +131 -0
  30. package/vendor/@appport/authorization/dist/index.js.map +1 -0
  31. package/vendor/@appport/authorization/package.json +28 -0
  32. package/vendor/@appport/client/README.md +35 -0
  33. package/vendor/@appport/client/dist/channel.d.ts +14 -0
  34. package/vendor/@appport/client/dist/channel.d.ts.map +1 -0
  35. package/vendor/@appport/client/dist/channel.js +58 -0
  36. package/vendor/@appport/client/dist/channel.js.map +1 -0
  37. package/vendor/@appport/client/dist/client.d.ts +61 -0
  38. package/vendor/@appport/client/dist/client.d.ts.map +1 -0
  39. package/vendor/@appport/client/dist/client.js +214 -0
  40. package/vendor/@appport/client/dist/client.js.map +1 -0
  41. package/vendor/@appport/client/dist/contract.d.ts +55 -0
  42. package/vendor/@appport/client/dist/contract.d.ts.map +1 -0
  43. package/vendor/@appport/client/dist/contract.js +12 -0
  44. package/vendor/@appport/client/dist/contract.js.map +1 -0
  45. package/vendor/@appport/client/dist/discovery.d.ts +17 -0
  46. package/vendor/@appport/client/dist/discovery.d.ts.map +1 -0
  47. package/vendor/@appport/client/dist/discovery.js +56 -0
  48. package/vendor/@appport/client/dist/discovery.js.map +1 -0
  49. package/vendor/@appport/client/dist/duplex.d.ts +25 -0
  50. package/vendor/@appport/client/dist/duplex.d.ts.map +1 -0
  51. package/vendor/@appport/client/dist/duplex.js +194 -0
  52. package/vendor/@appport/client/dist/duplex.js.map +1 -0
  53. package/vendor/@appport/client/dist/host.d.ts +62 -0
  54. package/vendor/@appport/client/dist/host.d.ts.map +1 -0
  55. package/vendor/@appport/client/dist/host.js +139 -0
  56. package/vendor/@appport/client/dist/host.js.map +1 -0
  57. package/vendor/@appport/client/dist/index.d.ts +14 -0
  58. package/vendor/@appport/client/dist/index.d.ts.map +1 -0
  59. package/vendor/@appport/client/dist/index.js +14 -0
  60. package/vendor/@appport/client/dist/index.js.map +1 -0
  61. package/vendor/@appport/client/dist/transport.d.ts +42 -0
  62. package/vendor/@appport/client/dist/transport.d.ts.map +1 -0
  63. package/vendor/@appport/client/dist/transport.js +2 -0
  64. package/vendor/@appport/client/dist/transport.js.map +1 -0
  65. package/vendor/@appport/client/package.json +32 -0
  66. package/vendor/@appport/core/README.md +91 -0
  67. package/vendor/@appport/core/dist/appboundry-capability-catalog.d.ts +930 -0
  68. package/vendor/@appport/core/dist/appboundry-capability-catalog.d.ts.map +1 -0
  69. package/vendor/@appport/core/dist/appboundry-capability-catalog.js +352 -0
  70. package/vendor/@appport/core/dist/appboundry-capability-catalog.js.map +1 -0
  71. package/vendor/@appport/core/dist/appboundry-composition.d.ts +93 -0
  72. package/vendor/@appport/core/dist/appboundry-composition.d.ts.map +1 -0
  73. package/vendor/@appport/core/dist/appboundry-composition.js +184 -0
  74. package/vendor/@appport/core/dist/appboundry-composition.js.map +1 -0
  75. package/vendor/@appport/core/dist/appboundry-contract.d.ts +80 -0
  76. package/vendor/@appport/core/dist/appboundry-contract.d.ts.map +1 -0
  77. package/vendor/@appport/core/dist/appboundry-contract.js +160 -0
  78. package/vendor/@appport/core/dist/appboundry-contract.js.map +1 -0
  79. package/vendor/@appport/core/dist/appboundry-diagnostics.d.ts +107 -0
  80. package/vendor/@appport/core/dist/appboundry-diagnostics.d.ts.map +1 -0
  81. package/vendor/@appport/core/dist/appboundry-diagnostics.js +358 -0
  82. package/vendor/@appport/core/dist/appboundry-diagnostics.js.map +1 -0
  83. package/vendor/@appport/core/dist/appboundry-discovery.d.ts +110 -0
  84. package/vendor/@appport/core/dist/appboundry-discovery.d.ts.map +1 -0
  85. package/vendor/@appport/core/dist/appboundry-discovery.js +141 -0
  86. package/vendor/@appport/core/dist/appboundry-discovery.js.map +1 -0
  87. package/vendor/@appport/core/dist/appboundry-entitlements.d.ts +128 -0
  88. package/vendor/@appport/core/dist/appboundry-entitlements.d.ts.map +1 -0
  89. package/vendor/@appport/core/dist/appboundry-entitlements.js +312 -0
  90. package/vendor/@appport/core/dist/appboundry-entitlements.js.map +1 -0
  91. package/vendor/@appport/core/dist/appboundry-execution.d.ts +84 -0
  92. package/vendor/@appport/core/dist/appboundry-execution.d.ts.map +1 -0
  93. package/vendor/@appport/core/dist/appboundry-execution.js +150 -0
  94. package/vendor/@appport/core/dist/appboundry-execution.js.map +1 -0
  95. package/vendor/@appport/core/dist/appboundry-exercise.d.ts +152 -0
  96. package/vendor/@appport/core/dist/appboundry-exercise.d.ts.map +1 -0
  97. package/vendor/@appport/core/dist/appboundry-exercise.js +416 -0
  98. package/vendor/@appport/core/dist/appboundry-exercise.js.map +1 -0
  99. package/vendor/@appport/core/dist/appboundry-materialization.d.ts +222 -0
  100. package/vendor/@appport/core/dist/appboundry-materialization.d.ts.map +1 -0
  101. package/vendor/@appport/core/dist/appboundry-materialization.js +494 -0
  102. package/vendor/@appport/core/dist/appboundry-materialization.js.map +1 -0
  103. package/vendor/@appport/core/dist/appboundry-migration.d.ts +195 -0
  104. package/vendor/@appport/core/dist/appboundry-migration.d.ts.map +1 -0
  105. package/vendor/@appport/core/dist/appboundry-migration.js +227 -0
  106. package/vendor/@appport/core/dist/appboundry-migration.js.map +1 -0
  107. package/vendor/@appport/core/dist/appboundry-onboarding.d.ts +70 -0
  108. package/vendor/@appport/core/dist/appboundry-onboarding.d.ts.map +1 -0
  109. package/vendor/@appport/core/dist/appboundry-onboarding.js +232 -0
  110. package/vendor/@appport/core/dist/appboundry-onboarding.js.map +1 -0
  111. package/vendor/@appport/core/dist/appboundry-operation-discovery.d.ts +93 -0
  112. package/vendor/@appport/core/dist/appboundry-operation-discovery.d.ts.map +1 -0
  113. package/vendor/@appport/core/dist/appboundry-operation-discovery.js +89 -0
  114. package/vendor/@appport/core/dist/appboundry-operation-discovery.js.map +1 -0
  115. package/vendor/@appport/core/dist/appboundry-resolution.d.ts +160 -0
  116. package/vendor/@appport/core/dist/appboundry-resolution.d.ts.map +1 -0
  117. package/vendor/@appport/core/dist/appboundry-resolution.js +218 -0
  118. package/vendor/@appport/core/dist/appboundry-resolution.js.map +1 -0
  119. package/vendor/@appport/core/dist/appboundry-surface.d.ts +96 -0
  120. package/vendor/@appport/core/dist/appboundry-surface.d.ts.map +1 -0
  121. package/vendor/@appport/core/dist/appboundry-surface.js +223 -0
  122. package/vendor/@appport/core/dist/appboundry-surface.js.map +1 -0
  123. package/vendor/@appport/core/dist/appboundry-usage.d.ts +94 -0
  124. package/vendor/@appport/core/dist/appboundry-usage.d.ts.map +1 -0
  125. package/vendor/@appport/core/dist/appboundry-usage.js +80 -0
  126. package/vendor/@appport/core/dist/appboundry-usage.js.map +1 -0
  127. package/vendor/@appport/core/dist/application-conformance.d.ts +68 -0
  128. package/vendor/@appport/core/dist/application-conformance.d.ts.map +1 -0
  129. package/vendor/@appport/core/dist/application-conformance.js +108 -0
  130. package/vendor/@appport/core/dist/application-conformance.js.map +1 -0
  131. package/vendor/@appport/core/dist/application-implementation.d.ts +125 -0
  132. package/vendor/@appport/core/dist/application-implementation.d.ts.map +1 -0
  133. package/vendor/@appport/core/dist/application-implementation.js +220 -0
  134. package/vendor/@appport/core/dist/application-implementation.js.map +1 -0
  135. package/vendor/@appport/core/dist/application-lifecycle.d.ts +150 -0
  136. package/vendor/@appport/core/dist/application-lifecycle.d.ts.map +1 -0
  137. package/vendor/@appport/core/dist/application-lifecycle.js +70 -0
  138. package/vendor/@appport/core/dist/application-lifecycle.js.map +1 -0
  139. package/vendor/@appport/core/dist/application-package.d.ts +105 -0
  140. package/vendor/@appport/core/dist/application-package.d.ts.map +1 -0
  141. package/vendor/@appport/core/dist/application-package.js +349 -0
  142. package/vendor/@appport/core/dist/application-package.js.map +1 -0
  143. package/vendor/@appport/core/dist/application-source.d.ts +109 -0
  144. package/vendor/@appport/core/dist/application-source.d.ts.map +1 -0
  145. package/vendor/@appport/core/dist/application-source.js +186 -0
  146. package/vendor/@appport/core/dist/application-source.js.map +1 -0
  147. package/vendor/@appport/core/dist/application.d.ts +124 -0
  148. package/vendor/@appport/core/dist/application.d.ts.map +1 -0
  149. package/vendor/@appport/core/dist/application.js +518 -0
  150. package/vendor/@appport/core/dist/application.js.map +1 -0
  151. package/vendor/@appport/core/dist/artifact.d.ts +395 -0
  152. package/vendor/@appport/core/dist/artifact.d.ts.map +1 -0
  153. package/vendor/@appport/core/dist/artifact.js +392 -0
  154. package/vendor/@appport/core/dist/artifact.js.map +1 -0
  155. package/vendor/@appport/core/dist/assembly.d.ts +237 -0
  156. package/vendor/@appport/core/dist/assembly.d.ts.map +1 -0
  157. package/vendor/@appport/core/dist/assembly.js +458 -0
  158. package/vendor/@appport/core/dist/assembly.js.map +1 -0
  159. package/vendor/@appport/core/dist/authority-attestation.d.ts +34 -0
  160. package/vendor/@appport/core/dist/authority-attestation.d.ts.map +1 -0
  161. package/vendor/@appport/core/dist/authority-attestation.js +72 -0
  162. package/vendor/@appport/core/dist/authority-attestation.js.map +1 -0
  163. package/vendor/@appport/core/dist/authorization-grant.d.ts +107 -0
  164. package/vendor/@appport/core/dist/authorization-grant.d.ts.map +1 -0
  165. package/vendor/@appport/core/dist/authorization-grant.js +131 -0
  166. package/vendor/@appport/core/dist/authorization-grant.js.map +1 -0
  167. package/vendor/@appport/core/dist/binding.d.ts +294 -0
  168. package/vendor/@appport/core/dist/binding.d.ts.map +1 -0
  169. package/vendor/@appport/core/dist/binding.js +263 -0
  170. package/vendor/@appport/core/dist/binding.js.map +1 -0
  171. package/vendor/@appport/core/dist/builtins.d.ts +18 -0
  172. package/vendor/@appport/core/dist/builtins.d.ts.map +1 -0
  173. package/vendor/@appport/core/dist/builtins.js +38 -0
  174. package/vendor/@appport/core/dist/builtins.js.map +1 -0
  175. package/vendor/@appport/core/dist/capability.d.ts +94 -0
  176. package/vendor/@appport/core/dist/capability.d.ts.map +1 -0
  177. package/vendor/@appport/core/dist/capability.js +85 -0
  178. package/vendor/@appport/core/dist/capability.js.map +1 -0
  179. package/vendor/@appport/core/dist/concurrency.d.ts +16 -0
  180. package/vendor/@appport/core/dist/concurrency.d.ts.map +1 -0
  181. package/vendor/@appport/core/dist/concurrency.js +46 -0
  182. package/vendor/@appport/core/dist/concurrency.js.map +1 -0
  183. package/vendor/@appport/core/dist/context.d.ts +59 -0
  184. package/vendor/@appport/core/dist/context.d.ts.map +1 -0
  185. package/vendor/@appport/core/dist/context.js +14 -0
  186. package/vendor/@appport/core/dist/context.js.map +1 -0
  187. package/vendor/@appport/core/dist/contract-artifact.d.ts +15 -0
  188. package/vendor/@appport/core/dist/contract-artifact.d.ts.map +1 -0
  189. package/vendor/@appport/core/dist/contract-artifact.js +161 -0
  190. package/vendor/@appport/core/dist/contract-artifact.js.map +1 -0
  191. package/vendor/@appport/core/dist/contract-attestation.d.ts +68 -0
  192. package/vendor/@appport/core/dist/contract-attestation.d.ts.map +1 -0
  193. package/vendor/@appport/core/dist/contract-attestation.js +76 -0
  194. package/vendor/@appport/core/dist/contract-attestation.js.map +1 -0
  195. package/vendor/@appport/core/dist/crash-injection.d.ts +3 -0
  196. package/vendor/@appport/core/dist/crash-injection.d.ts.map +1 -0
  197. package/vendor/@appport/core/dist/crash-injection.js +8 -0
  198. package/vendor/@appport/core/dist/crash-injection.js.map +1 -0
  199. package/vendor/@appport/core/dist/events.d.ts +33 -0
  200. package/vendor/@appport/core/dist/events.d.ts.map +1 -0
  201. package/vendor/@appport/core/dist/events.js +79 -0
  202. package/vendor/@appport/core/dist/events.js.map +1 -0
  203. package/vendor/@appport/core/dist/execution-barrier.d.ts +13 -0
  204. package/vendor/@appport/core/dist/execution-barrier.d.ts.map +1 -0
  205. package/vendor/@appport/core/dist/execution-barrier.js +33 -0
  206. package/vendor/@appport/core/dist/execution-barrier.js.map +1 -0
  207. package/vendor/@appport/core/dist/execution-ledger.d.ts +81 -0
  208. package/vendor/@appport/core/dist/execution-ledger.d.ts.map +1 -0
  209. package/vendor/@appport/core/dist/execution-ledger.js +173 -0
  210. package/vendor/@appport/core/dist/execution-ledger.js.map +1 -0
  211. package/vendor/@appport/core/dist/execution.d.ts +387 -0
  212. package/vendor/@appport/core/dist/execution.d.ts.map +1 -0
  213. package/vendor/@appport/core/dist/execution.js +165 -0
  214. package/vendor/@appport/core/dist/execution.js.map +1 -0
  215. package/vendor/@appport/core/dist/idempotency.d.ts +36 -0
  216. package/vendor/@appport/core/dist/idempotency.d.ts.map +1 -0
  217. package/vendor/@appport/core/dist/idempotency.js +36 -0
  218. package/vendor/@appport/core/dist/idempotency.js.map +1 -0
  219. package/vendor/@appport/core/dist/implementation.d.ts +110 -0
  220. package/vendor/@appport/core/dist/implementation.d.ts.map +1 -0
  221. package/vendor/@appport/core/dist/implementation.js +65 -0
  222. package/vendor/@appport/core/dist/implementation.js.map +1 -0
  223. package/vendor/@appport/core/dist/index.d.ts +62 -0
  224. package/vendor/@appport/core/dist/index.d.ts.map +1 -0
  225. package/vendor/@appport/core/dist/index.js +61 -0
  226. package/vendor/@appport/core/dist/index.js.map +1 -0
  227. package/vendor/@appport/core/dist/invocation.d.ts +253 -0
  228. package/vendor/@appport/core/dist/invocation.d.ts.map +1 -0
  229. package/vendor/@appport/core/dist/invocation.js +258 -0
  230. package/vendor/@appport/core/dist/invocation.js.map +1 -0
  231. package/vendor/@appport/core/dist/manifest.d.ts +157 -0
  232. package/vendor/@appport/core/dist/manifest.d.ts.map +1 -0
  233. package/vendor/@appport/core/dist/manifest.js +255 -0
  234. package/vendor/@appport/core/dist/manifest.js.map +1 -0
  235. package/vendor/@appport/core/dist/memory-application-data-store.d.ts +19 -0
  236. package/vendor/@appport/core/dist/memory-application-data-store.d.ts.map +1 -0
  237. package/vendor/@appport/core/dist/memory-application-data-store.js +161 -0
  238. package/vendor/@appport/core/dist/memory-application-data-store.js.map +1 -0
  239. package/vendor/@appport/core/dist/operations.d.ts +61 -0
  240. package/vendor/@appport/core/dist/operations.d.ts.map +1 -0
  241. package/vendor/@appport/core/dist/operations.js +210 -0
  242. package/vendor/@appport/core/dist/operations.js.map +1 -0
  243. package/vendor/@appport/core/dist/provider-contract.d.ts +89 -0
  244. package/vendor/@appport/core/dist/provider-contract.d.ts.map +1 -0
  245. package/vendor/@appport/core/dist/provider-contract.js +40 -0
  246. package/vendor/@appport/core/dist/provider-contract.js.map +1 -0
  247. package/vendor/@appport/core/dist/public.d.ts +23 -0
  248. package/vendor/@appport/core/dist/public.d.ts.map +1 -0
  249. package/vendor/@appport/core/dist/public.js +22 -0
  250. package/vendor/@appport/core/dist/public.js.map +1 -0
  251. package/vendor/@appport/core/dist/registration.d.ts +165 -0
  252. package/vendor/@appport/core/dist/registration.d.ts.map +1 -0
  253. package/vendor/@appport/core/dist/registration.js +253 -0
  254. package/vendor/@appport/core/dist/registration.js.map +1 -0
  255. package/vendor/@appport/core/dist/registry.d.ts +30 -0
  256. package/vendor/@appport/core/dist/registry.d.ts.map +1 -0
  257. package/vendor/@appport/core/dist/registry.js +149 -0
  258. package/vendor/@appport/core/dist/registry.js.map +1 -0
  259. package/vendor/@appport/core/dist/resolver.d.ts +130 -0
  260. package/vendor/@appport/core/dist/resolver.d.ts.map +1 -0
  261. package/vendor/@appport/core/dist/resolver.js +252 -0
  262. package/vendor/@appport/core/dist/resolver.js.map +1 -0
  263. package/vendor/@appport/core/dist/runtime-manifest.d.ts +68 -0
  264. package/vendor/@appport/core/dist/runtime-manifest.d.ts.map +1 -0
  265. package/vendor/@appport/core/dist/runtime-manifest.js +84 -0
  266. package/vendor/@appport/core/dist/runtime-manifest.js.map +1 -0
  267. package/vendor/@appport/core/dist/sanitize.d.ts +14 -0
  268. package/vendor/@appport/core/dist/sanitize.d.ts.map +1 -0
  269. package/vendor/@appport/core/dist/sanitize.js +49 -0
  270. package/vendor/@appport/core/dist/sanitize.js.map +1 -0
  271. package/vendor/@appport/core/dist/server-internal.d.ts +5 -0
  272. package/vendor/@appport/core/dist/server-internal.d.ts.map +1 -0
  273. package/vendor/@appport/core/dist/server-internal.js +4 -0
  274. package/vendor/@appport/core/dist/server-internal.js.map +1 -0
  275. package/vendor/@appport/core/dist/sessions.d.ts +29 -0
  276. package/vendor/@appport/core/dist/sessions.d.ts.map +1 -0
  277. package/vendor/@appport/core/dist/sessions.js +39 -0
  278. package/vendor/@appport/core/dist/sessions.js.map +1 -0
  279. package/vendor/@appport/core/dist/sha256.d.ts +3 -0
  280. package/vendor/@appport/core/dist/sha256.d.ts.map +1 -0
  281. package/vendor/@appport/core/dist/sha256.js +46 -0
  282. package/vendor/@appport/core/dist/sha256.js.map +1 -0
  283. package/vendor/@appport/core/dist/source-verification.d.ts +53 -0
  284. package/vendor/@appport/core/dist/source-verification.d.ts.map +1 -0
  285. package/vendor/@appport/core/dist/source-verification.js +92 -0
  286. package/vendor/@appport/core/dist/source-verification.js.map +1 -0
  287. package/vendor/@appport/core/dist/state-context.d.ts +312 -0
  288. package/vendor/@appport/core/dist/state-context.d.ts.map +1 -0
  289. package/vendor/@appport/core/dist/state-context.js +100 -0
  290. package/vendor/@appport/core/dist/state-context.js.map +1 -0
  291. package/vendor/@appport/core/dist/state.d.ts +96 -0
  292. package/vendor/@appport/core/dist/state.d.ts.map +1 -0
  293. package/vendor/@appport/core/dist/state.js +89 -0
  294. package/vendor/@appport/core/dist/state.js.map +1 -0
  295. package/vendor/@appport/core/dist/streams.d.ts +38 -0
  296. package/vendor/@appport/core/dist/streams.d.ts.map +1 -0
  297. package/vendor/@appport/core/dist/streams.js +123 -0
  298. package/vendor/@appport/core/dist/streams.js.map +1 -0
  299. package/vendor/@appport/core/dist/telemetry.d.ts +42 -0
  300. package/vendor/@appport/core/dist/telemetry.d.ts.map +1 -0
  301. package/vendor/@appport/core/dist/telemetry.js +32 -0
  302. package/vendor/@appport/core/dist/telemetry.js.map +1 -0
  303. package/vendor/@appport/core/dist/wasm-engine.d.ts +24 -0
  304. package/vendor/@appport/core/dist/wasm-engine.d.ts.map +1 -0
  305. package/vendor/@appport/core/dist/wasm-engine.js +376 -0
  306. package/vendor/@appport/core/dist/wasm-engine.js.map +1 -0
  307. package/vendor/@appport/core/package.json +58 -0
  308. package/vendor/@appport/mcp/README.md +29 -0
  309. package/vendor/@appport/mcp/dist/index.d.ts +59 -0
  310. package/vendor/@appport/mcp/dist/index.d.ts.map +1 -0
  311. package/vendor/@appport/mcp/dist/index.js +70 -0
  312. package/vendor/@appport/mcp/dist/index.js.map +1 -0
  313. package/vendor/@appport/mcp/package.json +29 -0
  314. package/vendor/@appport/mobile/README.md +10 -0
  315. package/vendor/@appport/mobile/dist/index.d.ts +66 -0
  316. package/vendor/@appport/mobile/dist/index.d.ts.map +1 -0
  317. package/vendor/@appport/mobile/dist/index.js +182 -0
  318. package/vendor/@appport/mobile/dist/index.js.map +1 -0
  319. package/vendor/@appport/mobile/package.json +33 -0
  320. package/vendor/@appport/protocol/README.md +41 -0
  321. package/vendor/@appport/protocol/dist/blob.d.ts +46 -0
  322. package/vendor/@appport/protocol/dist/blob.d.ts.map +1 -0
  323. package/vendor/@appport/protocol/dist/blob.js +23 -0
  324. package/vendor/@appport/protocol/dist/blob.js.map +1 -0
  325. package/vendor/@appport/protocol/dist/compatibility.d.ts +25 -0
  326. package/vendor/@appport/protocol/dist/compatibility.d.ts.map +1 -0
  327. package/vendor/@appport/protocol/dist/compatibility.js +189 -0
  328. package/vendor/@appport/protocol/dist/compatibility.js.map +1 -0
  329. package/vendor/@appport/protocol/dist/envelopes.d.ts +175 -0
  330. package/vendor/@appport/protocol/dist/envelopes.d.ts.map +1 -0
  331. package/vendor/@appport/protocol/dist/envelopes.js +97 -0
  332. package/vendor/@appport/protocol/dist/envelopes.js.map +1 -0
  333. package/vendor/@appport/protocol/dist/errors.d.ts +74 -0
  334. package/vendor/@appport/protocol/dist/errors.d.ts.map +1 -0
  335. package/vendor/@appport/protocol/dist/errors.js +92 -0
  336. package/vendor/@appport/protocol/dist/errors.js.map +1 -0
  337. package/vendor/@appport/protocol/dist/ids.d.ts +12 -0
  338. package/vendor/@appport/protocol/dist/ids.d.ts.map +1 -0
  339. package/vendor/@appport/protocol/dist/ids.js +50 -0
  340. package/vendor/@appport/protocol/dist/ids.js.map +1 -0
  341. package/vendor/@appport/protocol/dist/index.d.ts +21 -0
  342. package/vendor/@appport/protocol/dist/index.d.ts.map +1 -0
  343. package/vendor/@appport/protocol/dist/index.js +21 -0
  344. package/vendor/@appport/protocol/dist/index.js.map +1 -0
  345. package/vendor/@appport/protocol/dist/jsonschema.d.ts +50 -0
  346. package/vendor/@appport/protocol/dist/jsonschema.d.ts.map +1 -0
  347. package/vendor/@appport/protocol/dist/jsonschema.js +6 -0
  348. package/vendor/@appport/protocol/dist/jsonschema.js.map +1 -0
  349. package/vendor/@appport/protocol/dist/manifest.d.ts +134 -0
  350. package/vendor/@appport/protocol/dist/manifest.d.ts.map +1 -0
  351. package/vendor/@appport/protocol/dist/manifest.js +20 -0
  352. package/vendor/@appport/protocol/dist/manifest.js.map +1 -0
  353. package/vendor/@appport/protocol/dist/materialization.d.ts +59 -0
  354. package/vendor/@appport/protocol/dist/materialization.d.ts.map +1 -0
  355. package/vendor/@appport/protocol/dist/materialization.js +2 -0
  356. package/vendor/@appport/protocol/dist/materialization.js.map +1 -0
  357. package/vendor/@appport/protocol/dist/names.d.ts +26 -0
  358. package/vendor/@appport/protocol/dist/names.d.ts.map +1 -0
  359. package/vendor/@appport/protocol/dist/names.js +85 -0
  360. package/vendor/@appport/protocol/dist/names.js.map +1 -0
  361. package/vendor/@appport/protocol/dist/operations.d.ts +34 -0
  362. package/vendor/@appport/protocol/dist/operations.d.ts.map +1 -0
  363. package/vendor/@appport/protocol/dist/operations.js +9 -0
  364. package/vendor/@appport/protocol/dist/operations.js.map +1 -0
  365. package/vendor/@appport/protocol/dist/session.d.ts +27 -0
  366. package/vendor/@appport/protocol/dist/session.d.ts.map +1 -0
  367. package/vendor/@appport/protocol/dist/session.js +7 -0
  368. package/vendor/@appport/protocol/dist/session.js.map +1 -0
  369. package/vendor/@appport/protocol/dist/validate.d.ts +37 -0
  370. package/vendor/@appport/protocol/dist/validate.d.ts.map +1 -0
  371. package/vendor/@appport/protocol/dist/validate.js +321 -0
  372. package/vendor/@appport/protocol/dist/validate.js.map +1 -0
  373. package/vendor/@appport/protocol/dist/version.d.ts +27 -0
  374. package/vendor/@appport/protocol/dist/version.d.ts.map +1 -0
  375. package/vendor/@appport/protocol/dist/version.js +26 -0
  376. package/vendor/@appport/protocol/dist/version.js.map +1 -0
  377. package/vendor/@appport/protocol/package.json +25 -0
  378. package/vendor/@appport/schema/README.md +32 -0
  379. package/vendor/@appport/schema/dist/builder.d.ts +85 -0
  380. package/vendor/@appport/schema/dist/builder.d.ts.map +1 -0
  381. package/vendor/@appport/schema/dist/builder.js +278 -0
  382. package/vendor/@appport/schema/dist/builder.js.map +1 -0
  383. package/vendor/@appport/schema/dist/from-json-schema.d.ts +12 -0
  384. package/vendor/@appport/schema/dist/from-json-schema.d.ts.map +1 -0
  385. package/vendor/@appport/schema/dist/from-json-schema.js +186 -0
  386. package/vendor/@appport/schema/dist/from-json-schema.js.map +1 -0
  387. package/vendor/@appport/schema/dist/index.d.ts +23 -0
  388. package/vendor/@appport/schema/dist/index.d.ts.map +1 -0
  389. package/vendor/@appport/schema/dist/index.js +22 -0
  390. package/vendor/@appport/schema/dist/index.js.map +1 -0
  391. package/vendor/@appport/schema/dist/standard.d.ts +46 -0
  392. package/vendor/@appport/schema/dist/standard.d.ts.map +1 -0
  393. package/vendor/@appport/schema/dist/standard.js +42 -0
  394. package/vendor/@appport/schema/dist/standard.js.map +1 -0
  395. package/vendor/@appport/schema/dist/types.d.ts +40 -0
  396. package/vendor/@appport/schema/dist/types.d.ts.map +1 -0
  397. package/vendor/@appport/schema/dist/types.js +19 -0
  398. package/vendor/@appport/schema/dist/types.js.map +1 -0
  399. package/vendor/@appport/schema/package.json +28 -0
  400. package/vendor/@appport/server/README.md +39 -0
  401. package/vendor/@appport/server/dist/connection.d.ts +45 -0
  402. package/vendor/@appport/server/dist/connection.d.ts.map +1 -0
  403. package/vendor/@appport/server/dist/connection.js +217 -0
  404. package/vendor/@appport/server/dist/connection.js.map +1 -0
  405. package/vendor/@appport/server/dist/fetch.d.ts +10 -0
  406. package/vendor/@appport/server/dist/fetch.d.ts.map +1 -0
  407. package/vendor/@appport/server/dist/fetch.js +50 -0
  408. package/vendor/@appport/server/dist/fetch.js.map +1 -0
  409. package/vendor/@appport/server/dist/http.d.ts +80 -0
  410. package/vendor/@appport/server/dist/http.d.ts.map +1 -0
  411. package/vendor/@appport/server/dist/http.js +307 -0
  412. package/vendor/@appport/server/dist/http.js.map +1 -0
  413. package/vendor/@appport/server/dist/index.d.ts +11 -0
  414. package/vendor/@appport/server/dist/index.d.ts.map +1 -0
  415. package/vendor/@appport/server/dist/index.js +11 -0
  416. package/vendor/@appport/server/dist/index.js.map +1 -0
  417. package/vendor/@appport/server/dist/node-entry.d.ts +4 -0
  418. package/vendor/@appport/server/dist/node-entry.d.ts.map +1 -0
  419. package/vendor/@appport/server/dist/node-entry.js +4 -0
  420. package/vendor/@appport/server/dist/node-entry.js.map +1 -0
  421. package/vendor/@appport/server/dist/node.d.ts +45 -0
  422. package/vendor/@appport/server/dist/node.d.ts.map +1 -0
  423. package/vendor/@appport/server/dist/node.js +190 -0
  424. package/vendor/@appport/server/dist/node.js.map +1 -0
  425. package/vendor/@appport/server/dist/server.d.ts +83 -0
  426. package/vendor/@appport/server/dist/server.d.ts.map +1 -0
  427. package/vendor/@appport/server/dist/server.js +114 -0
  428. package/vendor/@appport/server/dist/server.js.map +1 -0
  429. package/vendor/@appport/server/dist/websocket.d.ts +25 -0
  430. package/vendor/@appport/server/dist/websocket.d.ts.map +1 -0
  431. package/vendor/@appport/server/dist/websocket.js +221 -0
  432. package/vendor/@appport/server/dist/websocket.js.map +1 -0
  433. package/vendor/@appport/server/package.json +34 -0
  434. package/vendor/@appport/transport-electron/README.md +56 -0
  435. package/vendor/@appport/transport-electron/dist/index.d.ts +11 -0
  436. package/vendor/@appport/transport-electron/dist/index.d.ts.map +1 -0
  437. package/vendor/@appport/transport-electron/dist/index.js +11 -0
  438. package/vendor/@appport/transport-electron/dist/index.js.map +1 -0
  439. package/vendor/@appport/transport-electron/dist/main.d.ts +31 -0
  440. package/vendor/@appport/transport-electron/dist/main.d.ts.map +1 -0
  441. package/vendor/@appport/transport-electron/dist/main.js +61 -0
  442. package/vendor/@appport/transport-electron/dist/main.js.map +1 -0
  443. package/vendor/@appport/transport-electron/dist/preload.d.ts +22 -0
  444. package/vendor/@appport/transport-electron/dist/preload.d.ts.map +1 -0
  445. package/vendor/@appport/transport-electron/dist/preload.js +29 -0
  446. package/vendor/@appport/transport-electron/dist/preload.js.map +1 -0
  447. package/vendor/@appport/transport-electron/dist/renderer.d.ts +16 -0
  448. package/vendor/@appport/transport-electron/dist/renderer.d.ts.map +1 -0
  449. package/vendor/@appport/transport-electron/dist/renderer.js +36 -0
  450. package/vendor/@appport/transport-electron/dist/renderer.js.map +1 -0
  451. package/vendor/@appport/transport-electron/dist/types.d.ts +49 -0
  452. package/vendor/@appport/transport-electron/dist/types.d.ts.map +1 -0
  453. package/vendor/@appport/transport-electron/dist/types.js +5 -0
  454. package/vendor/@appport/transport-electron/dist/types.js.map +1 -0
  455. package/vendor/@appport/transport-electron/package.json +46 -0
  456. package/vendor/@appport/transport-http/README.md +24 -0
  457. package/vendor/@appport/transport-http/dist/index.d.ts +18 -0
  458. package/vendor/@appport/transport-http/dist/index.d.ts.map +1 -0
  459. package/vendor/@appport/transport-http/dist/index.js +223 -0
  460. package/vendor/@appport/transport-http/dist/index.js.map +1 -0
  461. package/vendor/@appport/transport-http/package.json +29 -0
  462. package/vendor/@appport/transport-inprocess/README.md +24 -0
  463. package/vendor/@appport/transport-inprocess/dist/index.d.ts +16 -0
  464. package/vendor/@appport/transport-inprocess/dist/index.d.ts.map +1 -0
  465. package/vendor/@appport/transport-inprocess/dist/index.js +30 -0
  466. package/vendor/@appport/transport-inprocess/dist/index.js.map +1 -0
  467. package/vendor/@appport/transport-inprocess/package.json +30 -0
  468. package/vendor/@appport/transport-tauri/README.md +45 -0
  469. package/vendor/@appport/transport-tauri/dist/index.d.ts +23 -0
  470. package/vendor/@appport/transport-tauri/dist/index.d.ts.map +1 -0
  471. package/vendor/@appport/transport-tauri/dist/index.js +44 -0
  472. package/vendor/@appport/transport-tauri/dist/index.js.map +1 -0
  473. package/vendor/@appport/transport-tauri/package.json +29 -0
  474. package/vendor/@appport/transport-websocket/README.md +22 -0
  475. package/vendor/@appport/transport-websocket/dist/index.d.ts +26 -0
  476. package/vendor/@appport/transport-websocket/dist/index.d.ts.map +1 -0
  477. package/vendor/@appport/transport-websocket/dist/index.js +72 -0
  478. package/vendor/@appport/transport-websocket/dist/index.js.map +1 -0
  479. package/vendor/@appport/transport-websocket/package.json +29 -0
@@ -0,0 +1,258 @@
1
+ /**
2
+ * Capability Invocation Layer (PR24)
3
+ *
4
+ * The canonical invocation abstraction that turns an authorized relationship
5
+ * into an executable invocation without introducing WASM, persistent runtime
6
+ * processes, or remote transports.
7
+ *
8
+ * CRITICAL INVARIANT: A capability cannot be invoked without an AuthorizedCapabilityBinding.
9
+ *
10
+ * Architecture:
11
+ * Discover (PR21) → Resolve (PR22) → Authorize (PR23) → Bind (PR23) → Invoke (PR24)
12
+ *
13
+ * The invocation layer:
14
+ * - Receives an already-authorized binding
15
+ * - Validates binding/context consistency (no re-authorization)
16
+ * - Resolves the capability implementation (no re-discovery)
17
+ * - Validates input before handler execution
18
+ * - Executes the implementation
19
+ * - Validates output after execution
20
+ * - Returns explicit result (SUCCESS, FAILED, CANCELLED, TIMED_OUT)
21
+ * - Never implicitly falls back to another provider
22
+ * - Never retries or changes topology
23
+ * - Remains execution-engine-neutral for future WASM integration
24
+ */
25
+ import { assertIssuedAuthorizedBinding } from "./binding.js";
26
+ import { assertBindingAuthoritative } from "./authority-attestation.js";
27
+ import { errors } from "../../protocol/dist/index.js";
28
+ /**
29
+ * Capability Invoker: executes authorized capabilities with semantic enforcement.
30
+ *
31
+ * The invoker:
32
+ * - Requires AuthorizedCapabilityBinding for every invocation
33
+ * - Validates binding/context consistency
34
+ * - Validates input before handler execution
35
+ * - Executes the capability implementation
36
+ * - Validates output after execution
37
+ * - Returns explicit result types
38
+ * - Never re-discovers providers or re-authorizes
39
+ * - Never implicitly falls back to another provider
40
+ * - Remains execution-engine-neutral
41
+ *
42
+ * Flow:
43
+ * 1. Validate binding matches invocation context
44
+ * 2. Validate input against capability schema
45
+ * 3. Resolve capability definition and implementation
46
+ * 4. Execute implementation with context
47
+ * 5. Validate output against capability schema
48
+ * 6. Return explicit result
49
+ */
50
+ export class CapabilityInvoker {
51
+ /**
52
+ * Invoke a capability through an authorized binding.
53
+ *
54
+ * @param request The invocation request containing binding and input
55
+ * @param capabilityDefinition The capability definition from the registry
56
+ * @param executionContext The execution context (from Application)
57
+ * @returns The invocation result with explicit outcome
58
+ */
59
+ async invoke(request, capabilityDefinition, executionContext) {
60
+ const invocationId = executionContext.requestId;
61
+ const { binding, input } = request;
62
+ const { consumer, provider, capability } = binding;
63
+ try {
64
+ assertIssuedAuthorizedBinding(binding);
65
+ await assertBindingAuthoritative(binding);
66
+ // STEP 1: Validate binding matches invocation context
67
+ // This enforces the critical invariant: invocation uses exactly the binding provided.
68
+ this.#validateBindingConsistency(binding, executionContext, invocationId);
69
+ // STEP 2: Validate input against capability schema
70
+ // This MUST happen before implementation executes.
71
+ // Invalid input immediately produces a failed result without touching the handler.
72
+ const inputValidation = capabilityDefinition.input.validate(input);
73
+ if (!inputValidation.ok) {
74
+ return {
75
+ kind: "failed",
76
+ invocationId,
77
+ consumer,
78
+ provider,
79
+ capability: { name: capability.name, version: capability.version },
80
+ error: {
81
+ kind: "invalid_input",
82
+ reason: `Input validation failed: ${this.#formatValidationIssues(inputValidation.issues)}`
83
+ }
84
+ };
85
+ }
86
+ // STEP 3: Check for cancellation BEFORE execution
87
+ if (executionContext.signal?.aborted) {
88
+ return {
89
+ kind: "cancelled",
90
+ invocationId,
91
+ consumer,
92
+ provider,
93
+ capability: { name: capability.name, version: capability.version },
94
+ reason: "Invocation was cancelled before execution"
95
+ };
96
+ }
97
+ // STEP 4: Execute implementation
98
+ // The implementation is resolved from the capability definition, not re-discovered.
99
+ let output;
100
+ try {
101
+ if (capabilityDefinition.implementation) {
102
+ // Execute the bound implementation
103
+ output = await capabilityDefinition.implementation.execute(inputValidation.value, executionContext);
104
+ }
105
+ else {
106
+ // Fall back to the handler (for backward compatibility)
107
+ output = await capabilityDefinition.handler(inputValidation.value, executionContext);
108
+ }
109
+ }
110
+ catch (error) {
111
+ // Handle implementation failure
112
+ // Do NOT expose internal error details like stack traces, credentials, or error messages.
113
+ // Use a generic error message instead.
114
+ return {
115
+ kind: "failed",
116
+ invocationId,
117
+ consumer,
118
+ provider,
119
+ capability: { name: capability.name, version: capability.version },
120
+ error: {
121
+ kind: "implementation_failure",
122
+ reason: "Implementation execution failed"
123
+ }
124
+ };
125
+ }
126
+ // STEP 5: Check for cancellation AFTER execution
127
+ if (executionContext.signal?.aborted) {
128
+ return {
129
+ kind: "cancelled",
130
+ invocationId,
131
+ consumer,
132
+ provider,
133
+ capability: { name: capability.name, version: capability.version },
134
+ reason: "Invocation was cancelled after execution"
135
+ };
136
+ }
137
+ // STEP 6: Validate output against capability schema
138
+ const outputValidation = capabilityDefinition.output.validate(output);
139
+ if (!outputValidation.ok) {
140
+ return {
141
+ kind: "failed",
142
+ invocationId,
143
+ consumer,
144
+ provider,
145
+ capability: { name: capability.name, version: capability.version },
146
+ error: {
147
+ kind: "invalid_output",
148
+ reason: `Output validation failed: ${this.#formatValidationIssues(outputValidation.issues)}`
149
+ }
150
+ };
151
+ }
152
+ // SUCCESS
153
+ return {
154
+ kind: "success",
155
+ invocationId,
156
+ consumer,
157
+ provider,
158
+ capability: { name: capability.name, version: capability.version },
159
+ output: outputValidation.value
160
+ };
161
+ }
162
+ catch (error) {
163
+ // Unexpected errors in invocation orchestration itself
164
+ const reason = error instanceof Error ? error.message : String(error);
165
+ return {
166
+ kind: "failed",
167
+ invocationId,
168
+ consumer: binding.consumer,
169
+ provider: binding.provider,
170
+ capability: { name: binding.capability.name, version: binding.capability.version },
171
+ error: {
172
+ kind: "implementation_failure",
173
+ reason: `Invocation failed: ${reason}`
174
+ }
175
+ };
176
+ }
177
+ }
178
+ /**
179
+ * Validate that the binding is consistent with the execution context.
180
+ *
181
+ * This enforces the critical invariant:
182
+ * - binding.consumer MUST match the actual caller
183
+ * - binding.provider MUST match the selected provider
184
+ * - binding.capability MUST match the capability being invoked
185
+ *
186
+ * Throws InvalidBindingError if any consistency check fails.
187
+ * This error is NOT recovered — it represents an architectural violation.
188
+ */
189
+ #validateBindingConsistency(binding, context, invocationId) {
190
+ // Note: The consumer identity comes from the execution context.
191
+ // This is the caller identity as established by the application/transport layer.
192
+ // We validate that it matches the binding consumer.
193
+ const callerIdentity = context.principal?.id ?? context.session?.principal?.id ?? "unknown";
194
+ // The binding consumer application ID should match the caller identity context.
195
+ // This prevents a binding created for one consumer from being used by another.
196
+ if (binding.consumer.id && context.authorization) {
197
+ // Binding consumer is an ApplicationState, which has the application ID.
198
+ // We verify that this binding was intended for invocation in this context.
199
+ // The authorization context should reflect the binding consumer's permissions.
200
+ // For now, we verify the structure is present and valid.
201
+ // Deep validation depends on the specific authorization context format.
202
+ if (!binding.consumer.id) {
203
+ throw {
204
+ kind: "invalid_binding",
205
+ reason: "Binding consumer application identity is missing"
206
+ };
207
+ }
208
+ }
209
+ // Verify binding capability matches the executing capability
210
+ // (This is already checked at the binding creation level, but we verify again)
211
+ if (binding.capability.name && binding.capability.version) {
212
+ // The capability definition should be for this capability
213
+ // This check prevents invoking the wrong capability through a binding
214
+ if (typeof binding.capability.name !== "string" || typeof binding.capability.version !== "number") {
215
+ throw {
216
+ kind: "invalid_binding",
217
+ reason: "Binding capability identity is invalid"
218
+ };
219
+ }
220
+ }
221
+ // Verify binding provider is valid
222
+ if (!binding.provider || !binding.provider.id) {
223
+ throw {
224
+ kind: "invalid_binding",
225
+ reason: "Binding provider identity is missing or invalid"
226
+ };
227
+ }
228
+ // Verify authorization decision is present and authorized
229
+ if (!binding.authorization || binding.authorization.kind !== "authorized") {
230
+ throw {
231
+ kind: "invalid_binding",
232
+ reason: "Binding authorization is not authorized (should be denied at binding creation, not invocation)"
233
+ };
234
+ }
235
+ }
236
+ /**
237
+ * Format validation issues for error messages.
238
+ * This helper abstracts the schema validation issue format.
239
+ */
240
+ #formatValidationIssues(issues) {
241
+ if (!issues || issues.length === 0) {
242
+ return "Unknown validation error";
243
+ }
244
+ if (issues.length === 1) {
245
+ const issue = issues[0];
246
+ if (typeof issue === "object" && issue !== null && "message" in issue) {
247
+ return String(issue.message);
248
+ }
249
+ return String(issue);
250
+ }
251
+ return `${issues.length} validation errors`;
252
+ }
253
+ }
254
+ /**
255
+ * Default capability invoker: a singleton for common use.
256
+ */
257
+ export const defaultCapabilityInvoker = new CapabilityInvoker();
258
+ //# sourceMappingURL=invocation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invocation.js","sourceRoot":"","sources":["../src/invocation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAGH,OAAO,EAAE,6BAA6B,EAAoC,MAAM,cAAc,CAAC;AAC/F,OAAO,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAC;AAIxE,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAyN3C;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,OAAO,iBAAiB;IAC5B;;;;;;;OAOG;IACH,KAAK,CAAC,MAAM,CACV,OAA4C,EAC5C,oBAA2D,EAC3D,gBAA4C;QAE5C,MAAM,YAAY,GAAG,gBAAgB,CAAC,SAAS,CAAC;QAChD,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC;QACnC,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;QAEnD,IAAI,CAAC;YACH,6BAA6B,CAAC,OAAO,CAAC,CAAC;YACvC,MAAM,0BAA0B,CAAC,OAAO,CAAC,CAAC;YAC1C,sDAAsD;YACtD,sFAAsF;YACtF,IAAI,CAAC,2BAA2B,CAAC,OAAO,EAAE,gBAAgB,EAAE,YAAY,CAAC,CAAC;YAE1E,mDAAmD;YACnD,mDAAmD;YACnD,mFAAmF;YACnF,MAAM,eAAe,GAAG,oBAAoB,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;YACnE,IAAI,CAAC,eAAe,CAAC,EAAE,EAAE,CAAC;gBACxB,OAAO;oBACL,IAAI,EAAE,QAAQ;oBACd,YAAY;oBACZ,QAAQ;oBACR,QAAQ;oBACR,UAAU,EAAE,EAAE,IAAI,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)
3
+ *
4
+ * Canonical application identity and contract description.
5
+ *
6
+ * The manifest represents the externally meaningful boundary of an application:
7
+ * what it provides, what it requires, and the contract metadata.
8
+ *
9
+ * CRITICAL: The manifest contains NO implementation details:
10
+ * - No JavaScript functions
11
+ * - No handlers
12
+ * - No runtime closures
13
+ * - No filesystem paths
14
+ * - No process information
15
+ * - No secrets or credentials
16
+ * - No transport-specific bindings
17
+ *
18
+ * This allows the same application contract to be implemented in any language
19
+ * while maintaining an identical manifest, identity, and fingerprint.
20
+ */
21
+ import type { ApplicationAssembly, VerificationResult } from "./assembly.js";
22
+ import type { JsonValue } from "../../protocol/dist/index.d.ts";
23
+ /**
24
+ * Application Identity: uniquely identifies an application version.
25
+ */
26
+ export interface ApplicationIdentity {
27
+ readonly id: string;
28
+ readonly name: string;
29
+ readonly version: string;
30
+ }
31
+ /**
32
+ * Capability manifest entry: semantic contract information for a capability.
33
+ * Contains no implementation details.
34
+ */
35
+ export interface CapabilityManifestEntry {
36
+ readonly name: string;
37
+ readonly version: number;
38
+ readonly kind: "request" | "stream";
39
+ readonly description?: string;
40
+ readonly inputSchema: JsonValue;
41
+ readonly outputSchema: JsonValue;
42
+ readonly authorization: readonly string[];
43
+ readonly idempotency?: "supported" | "unsupported";
44
+ readonly concurrency?: {
45
+ readonly mode: "parallel" | "serialized" | "keyed";
46
+ readonly key?: string;
47
+ };
48
+ readonly timeoutMs?: number;
49
+ readonly emits: readonly string[];
50
+ readonly deprecated: boolean;
51
+ }
52
+ /**
53
+ * Requirement manifest entry: semantic contract information for a required capability.
54
+ * Contains no implementation details.
55
+ *
56
+ * Supports version constraints (e.g., "^1", "~1.2", ">=2") for deterministic
57
+ * capability resolution (PR22).
58
+ */
59
+ export interface RequirementManifestEntry {
60
+ readonly name: string;
61
+ readonly version: number;
62
+ readonly versionConstraint?: string;
63
+ readonly provider?: {
64
+ readonly applicationId?: string;
65
+ };
66
+ }
67
+ /**
68
+ * Canonical application manifest.
69
+ *
70
+ * This describes what an application provides and requires,
71
+ * independent of implementation.
72
+ *
73
+ * The manifest is:
74
+ * - Implementation-agnostic (no code/handlers/functions)
75
+ * - Serializable to deterministic JSON
76
+ * - Hashable for fingerprinting
77
+ * - Suitable for discovery and registration
78
+ */
79
+ export interface ApplicationManifest {
80
+ readonly protocol: "AppPort/1";
81
+ readonly application: ApplicationIdentity;
82
+ readonly metadata?: Readonly<Record<string, JsonValue>>;
83
+ readonly provides: readonly CapabilityManifestEntry[];
84
+ readonly requires: readonly RequirementManifestEntry[];
85
+ }
86
+ /**
87
+ * Canonical manifest serialization.
88
+ *
89
+ * Deterministic JSON representation with:
90
+ * - Alphabetical property ordering
91
+ * - Sorted capability lists
92
+ * - Sorted requirement lists
93
+ * - Consistent formatting
94
+ *
95
+ * Equivalent manifests produce identical serializations.
96
+ */
97
+ export declare function serializeManifest(manifest: ApplicationManifest): string;
98
+ /**
99
+ * Calculate deterministic fingerprint of a manifest.
100
+ *
101
+ * The fingerprint is a SHA256 hash of the canonical serialization.
102
+ * Identical application contracts produce identical fingerprints
103
+ * regardless of:
104
+ * - Implementation language
105
+ * - Declaration order
106
+ * - Implementation details
107
+ * - Runtime state
108
+ *
109
+ * The fingerprint CHANGES when:
110
+ * - Capability version changes
111
+ * - Authorization requirements change
112
+ * - Input/output schema changes
113
+ * - Concurrency policy changes
114
+ * - Timeouts change
115
+ * - Required capabilities change
116
+ * - Any contract metadata changes
117
+ *
118
+ * The fingerprint DOES NOT CHANGE when:
119
+ * - Implementation functions change
120
+ * - Handler logic changes
121
+ * - Declaration order changes
122
+ * - Only runtime state changes
123
+ */
124
+ export declare function fingerprintManifest(manifest: ApplicationManifest): string;
125
+ /**
126
+ * Generate a canonical ApplicationManifest from a verified ApplicationAssembly.
127
+ *
128
+ * IMPORTANT: The assembly must be verified and ready before generating the manifest.
129
+ * A manifest should represent a coherent, ready-to-run application.
130
+ *
131
+ * If you need to generate a manifest from an invalid assembly for debugging,
132
+ * use generateManifestUnchecked() instead.
133
+ */
134
+ export declare function generateManifest(assembly: ApplicationAssembly, verification: VerificationResult): ApplicationManifest;
135
+ /**
136
+ * Generate an ApplicationManifest from an ApplicationAssembly without verification.
137
+ *
138
+ * WARNING: This generates a manifest even if the assembly is invalid.
139
+ * Only use this for debugging or testing invalid applications.
140
+ *
141
+ * For production code, use generateManifest() which requires verification.
142
+ */
143
+ export declare function generateManifestUnchecked(assembly: ApplicationAssembly): ApplicationManifest;
144
+ /**
145
+ * Convert a manifest to a JSON-compatible object suitable for serialization.
146
+ *
147
+ * This is equivalent to JSON.parse(serializeManifest(manifest)).
148
+ */
149
+ export declare function manifestToJson(manifest: ApplicationManifest): any;
150
+ /**
151
+ * Verify that two manifests are semantically equivalent.
152
+ *
153
+ * Returns true if they describe the same application contract,
154
+ * regardless of declaration order or other non-semantic differences.
155
+ */
156
+ export declare function manifestsAreEqual(a: ApplicationManifest, b: ApplicationManifest): boolean;
157
+ //# sourceMappingURL=manifest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../src/manifest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,OAAO,KAAK,EAAE,mBAAmB,EAAuB,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAGlG,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED;;;GAGG;AACH,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,SAAS,GAAG,QAAQ,CAAC;IACpC,QAAQ,CAAC,WAAW,CAAC,EAA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B,CAAC,QAAQ,EAAE,mBAAmB,GAAG,MAAM,CAGvE;AAmFD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,mBAAmB,GAAG,MAAM,CAGzE;AA6CD;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,mBAAmB,EAAE,YAAY,EAAE,kBAAkB,GAAG,mBAAmB,CAMrH;AAED;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,mBAAmB,GAAG,mBAAmB,CAyC5F;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,mBAAmB,GAAG,GAAG,CAEjE;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,mBAAmB,EAAE,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAEzF"}
@@ -0,0 +1,255 @@
1
+ /**
2
+ * Application Manifest (PR19)
3
+ *
4
+ * Canonical application identity and contract description.
5
+ *
6
+ * The manifest represents the externally meaningful boundary of an application:
7
+ * what it provides, what it requires, and the contract metadata.
8
+ *
9
+ * CRITICAL: The manifest contains NO implementation details:
10
+ * - No JavaScript functions
11
+ * - No handlers
12
+ * - No runtime closures
13
+ * - No filesystem paths
14
+ * - No process information
15
+ * - No secrets or credentials
16
+ * - No transport-specific bindings
17
+ *
18
+ * This allows the same application contract to be implemented in any language
19
+ * while maintaining an identical manifest, identity, and fingerprint.
20
+ */
21
+ import { sha256 } from "./sha256.js";
22
+ /**
23
+ * Canonical manifest serialization.
24
+ *
25
+ * Deterministic JSON representation with:
26
+ * - Alphabetical property ordering
27
+ * - Sorted capability lists
28
+ * - Sorted requirement lists
29
+ * - Consistent formatting
30
+ *
31
+ * Equivalent manifests produce identical serializations.
32
+ */
33
+ export function serializeManifest(manifest) {
34
+ const canonical = canonicalizeManifest(manifest);
35
+ return JSON.stringify(canonical);
36
+ }
37
+ /**
38
+ * Convert manifest to canonical form for serialization.
39
+ * Ensures deterministic property and array ordering.
40
+ */
41
+ function canonicalizeManifest(manifest) {
42
+ return {
43
+ protocol: manifest.protocol,
44
+ application: {
45
+ id: manifest.application.id,
46
+ name: manifest.application.name,
47
+ version: manifest.application.version
48
+ },
49
+ ...(manifest.metadata !== undefined ? { metadata: canonicalizeJson(manifest.metadata) } : {}),
50
+ provides: manifest.provides
51
+ .slice() // Copy to avoid mutation
52
+ .sort((a, b) => {
53
+ const nameComp = a.name.localeCompare(b.name);
54
+ return nameComp !== 0 ? nameComp : a.version - b.version;
55
+ })
56
+ .map(canonicalizeCapabilityManifest),
57
+ requires: manifest.requires
58
+ .slice() // Copy to avoid mutation
59
+ .sort((a, b) => {
60
+ const nameComp = a.name.localeCompare(b.name);
61
+ return nameComp !== 0 ? nameComp : a.version - b.version;
62
+ })
63
+ .map((r) => ({
64
+ name: r.name,
65
+ version: r.version,
66
+ ...(r.versionConstraint !== undefined ? { versionConstraint: r.versionConstraint } : {}),
67
+ ...(r.provider !== undefined ? { provider: r.provider } : {})
68
+ }))
69
+ };
70
+ }
71
+ function canonicalizeJson(value) {
72
+ if (Array.isArray(value))
73
+ return value.map(canonicalizeJson);
74
+ if (value !== null && typeof value === "object") {
75
+ return Object.fromEntries(Object.keys(value).sort().map(key => [key, canonicalizeJson(value[key])]));
76
+ }
77
+ return value;
78
+ }
79
+ /**
80
+ * Canonicalize a capability manifest entry.
81
+ */
82
+ function canonicalizeCapabilityManifest(cap) {
83
+ const result = {
84
+ name: cap.name,
85
+ version: cap.version,
86
+ kind: cap.kind,
87
+ inputSchema: canonicalizeJson(cap.inputSchema),
88
+ outputSchema: canonicalizeJson(cap.outputSchema),
89
+ authorization: Array.from(cap.authorization).sort()
90
+ };
91
+ if (cap.description !== undefined) {
92
+ result.description = cap.description;
93
+ }
94
+ if (cap.idempotency !== undefined) {
95
+ result.idempotency = cap.idempotency;
96
+ }
97
+ if (cap.concurrency !== undefined) {
98
+ result.concurrency = {
99
+ mode: cap.concurrency.mode,
100
+ ...(cap.concurrency.key !== undefined ? { key: cap.concurrency.key } : {})
101
+ };
102
+ }
103
+ if (cap.timeoutMs !== undefined) {
104
+ result.timeoutMs = cap.timeoutMs;
105
+ }
106
+ result.emits = Array.from(cap.emits).sort();
107
+ result.deprecated = cap.deprecated;
108
+ return result;
109
+ }
110
+ /**
111
+ * Calculate deterministic fingerprint of a manifest.
112
+ *
113
+ * The fingerprint is a SHA256 hash of the canonical serialization.
114
+ * Identical application contracts produce identical fingerprints
115
+ * regardless of:
116
+ * - Implementation language
117
+ * - Declaration order
118
+ * - Implementation details
119
+ * - Runtime state
120
+ *
121
+ * The fingerprint CHANGES when:
122
+ * - Capability version changes
123
+ * - Authorization requirements change
124
+ * - Input/output schema changes
125
+ * - Concurrency policy changes
126
+ * - Timeouts change
127
+ * - Required capabilities change
128
+ * - Any contract metadata changes
129
+ *
130
+ * The fingerprint DOES NOT CHANGE when:
131
+ * - Implementation functions change
132
+ * - Handler logic changes
133
+ * - Declaration order changes
134
+ * - Only runtime state changes
135
+ */
136
+ export function fingerprintManifest(manifest) {
137
+ const canonical = serializeManifest(manifest);
138
+ return sha256(canonical);
139
+ }
140
+ /**
141
+ * Convert a CapabilityDefinition to a CapabilityManifestEntry.
142
+ *
143
+ * Extracts contract information while excluding implementation details:
144
+ * - Excludes handler function
145
+ * - Excludes implementation binding
146
+ * - Preserves all contract metadata
147
+ */
148
+ function capabilityToManifestEntry(capability) {
149
+ return {
150
+ name: capability.name,
151
+ version: capability.version,
152
+ kind: capability.kind,
153
+ ...(capability.description ? { description: capability.description } : {}),
154
+ inputSchema: schemaToJsonValue(capability.input),
155
+ outputSchema: schemaToJsonValue(capability.output),
156
+ authorization: capability.authorization,
157
+ ...(capability.idempotency ? { idempotency: capability.idempotency } : {}),
158
+ ...(capability.concurrency ? { concurrency: capability.concurrency } : {}),
159
+ ...(capability.timeoutMs ? { timeoutMs: capability.timeoutMs } : {}),
160
+ emits: capability.emits,
161
+ deprecated: capability.deprecated
162
+ };
163
+ }
164
+ /**
165
+ * Convert a Schema to a JSON-serializable value.
166
+ * This is needed because Schema objects are not directly JSON-serializable.
167
+ */
168
+ function schemaToJsonValue(schema) {
169
+ // Schemas have a toJSONSchema() method for serialization
170
+ if (typeof schema === "object" && schema !== null && "toJSONSchema" in schema) {
171
+ return schema.toJSONSchema();
172
+ }
173
+ // Fallback: convert to JSON string and parse (for direct JSON schemas)
174
+ if (typeof schema === "object" && schema !== null) {
175
+ return schema;
176
+ }
177
+ return schema;
178
+ }
179
+ /**
180
+ * Generate a canonical ApplicationManifest from a verified ApplicationAssembly.
181
+ *
182
+ * IMPORTANT: The assembly must be verified and ready before generating the manifest.
183
+ * A manifest should represent a coherent, ready-to-run application.
184
+ *
185
+ * If you need to generate a manifest from an invalid assembly for debugging,
186
+ * use generateManifestUnchecked() instead.
187
+ */
188
+ export function generateManifest(assembly, verification) {
189
+ if (!verification.ready) {
190
+ throw new Error("Cannot generate manifest: application is not verified and ready. Call assembly.verify() first.");
191
+ }
192
+ return generateManifestUnchecked(assembly);
193
+ }
194
+ /**
195
+ * Generate an ApplicationManifest from an ApplicationAssembly without verification.
196
+ *
197
+ * WARNING: This generates a manifest even if the assembly is invalid.
198
+ * Only use this for debugging or testing invalid applications.
199
+ *
200
+ * For production code, use generateManifest() which requires verification.
201
+ */
202
+ export function generateManifestUnchecked(assembly) {
203
+ const provides = [];
204
+ for (const capability of assembly.provides) {
205
+ provides.push(capabilityToManifestEntry(capability));
206
+ }
207
+ // Sort provides by name then version for determinism
208
+ provides.sort((a, b) => {
209
+ const nameComp = a.name.localeCompare(b.name);
210
+ return nameComp !== 0 ? nameComp : a.version - b.version;
211
+ });
212
+ const requires = [];
213
+ for (const required of assembly.requires) {
214
+ requires.push({
215
+ name: required.name,
216
+ version: required.version,
217
+ ...(required.versionConstraint ? { versionConstraint: required.versionConstraint } : {}),
218
+ ...(required.provider ? { provider: required.provider } : {})
219
+ });
220
+ }
221
+ // Sort requires by name then version for determinism
222
+ requires.sort((a, b) => {
223
+ const nameComp = a.name.localeCompare(b.name);
224
+ return nameComp !== 0 ? nameComp : a.version - b.version;
225
+ });
226
+ return {
227
+ protocol: "AppPort/1",
228
+ application: {
229
+ id: assembly.identity.id,
230
+ name: assembly.identity.name,
231
+ version: assembly.identity.version
232
+ },
233
+ ...(assembly.metadata ? { metadata: assembly.metadata } : {}),
234
+ provides,
235
+ requires
236
+ };
237
+ }
238
+ /**
239
+ * Convert a manifest to a JSON-compatible object suitable for serialization.
240
+ *
241
+ * This is equivalent to JSON.parse(serializeManifest(manifest)).
242
+ */
243
+ export function manifestToJson(manifest) {
244
+ return JSON.parse(serializeManifest(manifest));
245
+ }
246
+ /**
247
+ * Verify that two manifests are semantically equivalent.
248
+ *
249
+ * Returns true if they describe the same application contract,
250
+ * regardless of declaration order or other non-semantic differences.
251
+ */
252
+ export function manifestsAreEqual(a, b) {
253
+ return fingerprintManifest(a) === fingerprintManifest(b);
254
+ }
255
+ //# sourceMappingURL=manifest.js.map