@withgateway/sdk 0.1.20 → 0.2.1

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 (1222) hide show
  1. package/README.md +165 -2
  2. package/dist/cli.js +14075 -1326
  3. package/dist/cli.js.map +1 -1
  4. package/dist/cli.mjs +14073 -1325
  5. package/dist/cli.mjs.map +1 -1
  6. package/dist/files/index.d.mts +2 -0
  7. package/dist/files/index.d.ts +2 -0
  8. package/dist/files/index.js +446 -0
  9. package/dist/files/index.js.map +1 -0
  10. package/dist/files/index.mjs +395 -0
  11. package/dist/files/index.mjs.map +1 -0
  12. package/dist/index-BgvvQ3BC.d.ts +170 -0
  13. package/dist/index-CLkMr6VG.d.ts +171 -0
  14. package/dist/index-CdbmO4aX.d.mts +171 -0
  15. package/dist/index-CiKWoroJ.d.mts +170 -0
  16. package/dist/index.d.mts +3 -1
  17. package/dist/index.d.ts +3 -1
  18. package/dist/index.js +3341 -241
  19. package/dist/index.js.map +1 -1
  20. package/dist/index.mjs +3279 -235
  21. package/dist/index.mjs.map +1 -1
  22. package/dist/traces/index.d.mts +2 -0
  23. package/dist/traces/index.d.ts +2 -0
  24. package/dist/traces/index.js +320 -0
  25. package/dist/traces/index.js.map +1 -0
  26. package/dist/traces/index.mjs +278 -0
  27. package/dist/traces/index.mjs.map +1 -0
  28. package/dist/tracing/index.js +24 -2
  29. package/dist/tracing/index.js.map +1 -1
  30. package/dist/tracing/index.mjs +24 -2
  31. package/dist/tracing/index.mjs.map +1 -1
  32. package/dist/worlds/index.d.mts +1419 -25
  33. package/dist/worlds/index.d.ts +1419 -25
  34. package/dist/worlds/index.js +2829 -87
  35. package/dist/worlds/index.js.map +1 -1
  36. package/dist/worlds/index.mjs +2824 -83
  37. package/dist/worlds/index.mjs.map +1 -1
  38. package/package.json +24 -2
  39. package/runtime/gatewaysdk/__init__.py +0 -0
  40. package/runtime/gatewaysdk/environment/__init__.py +108 -0
  41. package/runtime/gatewaysdk/environment/_bundle.py +281 -0
  42. package/runtime/gatewaysdk/environment/_harbor.py +276 -0
  43. package/runtime/gatewaysdk/environment/_materialize.py +97 -0
  44. package/runtime/gatewaysdk/environment/_tar.py +33 -0
  45. package/runtime/gatewaysdk/environment/_world.py +359 -0
  46. package/runtime/gatewaysdk/environment/core.py +527 -0
  47. package/runtime/gatewaysdk/environment/errors.py +58 -0
  48. package/runtime/gatewaysdk/environment/runtime.py +150 -0
  49. package/runtime/gatewaysdk/environment/schema/__init__.py +43 -0
  50. package/runtime/gatewaysdk/environment/schema/__main__.py +360 -0
  51. package/runtime/gatewaysdk/environment/schema/_slack_fidelity.py +116 -0
  52. package/runtime/gatewaysdk/environment/schema/_slack_scenario.py +183 -0
  53. package/runtime/gatewaysdk/environment/schema/api.py +1824 -0
  54. package/runtime/gatewaysdk/environment/schema/batch.py +785 -0
  55. package/runtime/gatewaysdk/environment/schema/compiler.py +693 -0
  56. package/runtime/gatewaysdk/environment/schema/conform.py +520 -0
  57. package/runtime/gatewaysdk/environment/schema/connector.py +1116 -0
  58. package/runtime/gatewaysdk/environment/schema/connectors/apple-business-manager/api/handlers.py +778 -0
  59. package/runtime/gatewaysdk/environment/schema/connectors/apple-business-manager/connector.toml +671 -0
  60. package/runtime/gatewaysdk/environment/schema/connectors/apple-business-manager/handlers.py +18 -0
  61. package/runtime/gatewaysdk/environment/schema/connectors/apple-business-manager/parity.json +34 -0
  62. package/runtime/gatewaysdk/environment/schema/connectors/apple-business-manager/provenance.json +1768 -0
  63. package/runtime/gatewaysdk/environment/schema/connectors/apple-business-manager/scenarios/default/instruction.md +7 -0
  64. package/runtime/gatewaysdk/environment/schema/connectors/apple-business-manager/scenarios/default/scenario.toml +2 -0
  65. package/runtime/gatewaysdk/environment/schema/connectors/apple-business-manager/scenarios/default/seed/abm_activities.json +24 -0
  66. package/runtime/gatewaysdk/environment/schema/connectors/apple-business-manager/scenarios/default/seed/abm_activity_devices.json +12 -0
  67. package/runtime/gatewaysdk/environment/schema/connectors/apple-business-manager/scenarios/default/seed/abm_applecare_coverages.json +52 -0
  68. package/runtime/gatewaysdk/environment/schema/connectors/apple-business-manager/scenarios/default/seed/abm_apps.json +35 -0
  69. package/runtime/gatewaysdk/environment/schema/connectors/apple-business-manager/scenarios/default/seed/abm_audit_events.json +139 -0
  70. package/runtime/gatewaysdk/environment/schema/connectors/apple-business-manager/scenarios/default/seed/abm_blueprint_apps.json +12 -0
  71. package/runtime/gatewaysdk/environment/schema/connectors/apple-business-manager/scenarios/default/seed/abm_blueprint_configurations.json +20 -0
  72. package/runtime/gatewaysdk/environment/schema/connectors/apple-business-manager/scenarios/default/seed/abm_blueprint_devices.json +16 -0
  73. package/runtime/gatewaysdk/environment/schema/connectors/apple-business-manager/scenarios/default/seed/abm_blueprint_packages.json +8 -0
  74. package/runtime/gatewaysdk/environment/schema/connectors/apple-business-manager/scenarios/default/seed/abm_blueprint_user_groups.json +12 -0
  75. package/runtime/gatewaysdk/environment/schema/connectors/apple-business-manager/scenarios/default/seed/abm_blueprint_users.json +12 -0
  76. package/runtime/gatewaysdk/environment/schema/connectors/apple-business-manager/scenarios/default/seed/abm_blueprints.json +39 -0
  77. package/runtime/gatewaysdk/environment/schema/connectors/apple-business-manager/scenarios/default/seed/abm_configurations.json +64 -0
  78. package/runtime/gatewaysdk/environment/schema/connectors/apple-business-manager/scenarios/default/seed/abm_device_assignments.json +20 -0
  79. package/runtime/gatewaysdk/environment/schema/connectors/apple-business-manager/scenarios/default/seed/abm_mdm_device_details.json +55 -0
  80. package/runtime/gatewaysdk/environment/schema/connectors/apple-business-manager/scenarios/default/seed/abm_mdm_devices.json +33 -0
  81. package/runtime/gatewaysdk/environment/schema/connectors/apple-business-manager/scenarios/default/seed/abm_mdm_servers.json +56 -0
  82. package/runtime/gatewaysdk/environment/schema/connectors/apple-business-manager/scenarios/default/seed/abm_org_devices.json +178 -0
  83. package/runtime/gatewaysdk/environment/schema/connectors/apple-business-manager/scenarios/default/seed/abm_organizational_unit_memberships.json +16 -0
  84. package/runtime/gatewaysdk/environment/schema/connectors/apple-business-manager/scenarios/default/seed/abm_organizational_units.json +24 -0
  85. package/runtime/gatewaysdk/environment/schema/connectors/apple-business-manager/scenarios/default/seed/abm_packages.json +20 -0
  86. package/runtime/gatewaysdk/environment/schema/connectors/apple-business-manager/scenarios/default/seed/abm_user_group_memberships.json +16 -0
  87. package/runtime/gatewaysdk/environment/schema/connectors/apple-business-manager/scenarios/default/seed/abm_user_groups.json +30 -0
  88. package/runtime/gatewaysdk/environment/schema/connectors/apple-business-manager/scenarios/default/seed/abm_users.json +115 -0
  89. package/runtime/gatewaysdk/environment/schema/connectors/apple-business-manager/scope.toml +139 -0
  90. package/runtime/gatewaysdk/environment/schema/connectors/apple-business-manager/tests/tools.json +48 -0
  91. package/runtime/gatewaysdk/environment/schema/connectors/apple-business-manager/world.json +2366 -0
  92. package/runtime/gatewaysdk/environment/schema/connectors/asana/api/handlers.py +1026 -0
  93. package/runtime/gatewaysdk/environment/schema/connectors/asana/connector.toml +511 -0
  94. package/runtime/gatewaysdk/environment/schema/connectors/asana/fidelity.json +89 -0
  95. package/runtime/gatewaysdk/environment/schema/connectors/asana/handlers.py +40 -0
  96. package/runtime/gatewaysdk/environment/schema/connectors/asana/provenance.json +101 -0
  97. package/runtime/gatewaysdk/environment/schema/connectors/asana/scenarios/default/scenario.toml +2 -0
  98. package/runtime/gatewaysdk/environment/schema/connectors/asana/scenarios/default/seed/account_settings.json +12 -0
  99. package/runtime/gatewaysdk/environment/schema/connectors/asana/scenarios/default/seed/custom_field_settings.json +60 -0
  100. package/runtime/gatewaysdk/environment/schema/connectors/asana/scenarios/default/seed/custom_fields.json +43 -0
  101. package/runtime/gatewaysdk/environment/schema/connectors/asana/scenarios/default/seed/enum_options.json +52 -0
  102. package/runtime/gatewaysdk/environment/schema/connectors/asana/scenarios/default/seed/notifications.json +103 -0
  103. package/runtime/gatewaysdk/environment/schema/connectors/asana/scenarios/default/seed/project_favorites.json +12 -0
  104. package/runtime/gatewaysdk/environment/schema/connectors/asana/scenarios/default/seed/project_memberships.json +144 -0
  105. package/runtime/gatewaysdk/environment/schema/connectors/asana/scenarios/default/seed/projects.json +120 -0
  106. package/runtime/gatewaysdk/environment/schema/connectors/asana/scenarios/default/seed/recent_projects.json +19 -0
  107. package/runtime/gatewaysdk/environment/schema/connectors/asana/scenarios/default/seed/sections.json +102 -0
  108. package/runtime/gatewaysdk/environment/schema/connectors/asana/scenarios/default/seed/stories.json +852 -0
  109. package/runtime/gatewaysdk/environment/schema/connectors/asana/scenarios/default/seed/task_custom_fields.json +508 -0
  110. package/runtime/gatewaysdk/environment/schema/connectors/asana/scenarios/default/seed/task_followers.json +368 -0
  111. package/runtime/gatewaysdk/environment/schema/connectors/asana/scenarios/default/seed/task_memberships.json +184 -0
  112. package/runtime/gatewaysdk/environment/schema/connectors/asana/scenarios/default/seed/tasks.json +1921 -0
  113. package/runtime/gatewaysdk/environment/schema/connectors/asana/scenarios/default/seed/teams.json +22 -0
  114. package/runtime/gatewaysdk/environment/schema/connectors/asana/scenarios/default/seed/user_task_list_sections.json +32 -0
  115. package/runtime/gatewaysdk/environment/schema/connectors/asana/scenarios/default/seed/user_task_lists.json +11 -0
  116. package/runtime/gatewaysdk/environment/schema/connectors/asana/scenarios/default/seed/users.json +60 -0
  117. package/runtime/gatewaysdk/environment/schema/connectors/asana/scenarios/default/seed/workspace_memberships.json +76 -0
  118. package/runtime/gatewaysdk/environment/schema/connectors/asana/scenarios/default/seed/workspaces.json +13 -0
  119. package/runtime/gatewaysdk/environment/schema/connectors/asana/scope.toml +156 -0
  120. package/runtime/gatewaysdk/environment/schema/connectors/asana/tests/routes.json +298 -0
  121. package/runtime/gatewaysdk/environment/schema/connectors/asana/tests/tools.json +152 -0
  122. package/runtime/gatewaysdk/environment/schema/connectors/asana/ui/static/assets/index-DTTTJ6a4.css +1 -0
  123. package/runtime/gatewaysdk/environment/schema/connectors/asana/ui/static/assets/index-WS8dLEjv.js +67 -0
  124. package/runtime/gatewaysdk/environment/schema/connectors/asana/ui/static/index.html +40 -0
  125. package/runtime/gatewaysdk/environment/schema/connectors/asana/world.json +1911 -0
  126. package/runtime/gatewaysdk/environment/schema/connectors/base.json +28 -0
  127. package/runtime/gatewaysdk/environment/schema/connectors/confluence/api/handlers.py +847 -0
  128. package/runtime/gatewaysdk/environment/schema/connectors/confluence/connector.toml +457 -0
  129. package/runtime/gatewaysdk/environment/schema/connectors/confluence/handlers.py +176 -0
  130. package/runtime/gatewaysdk/environment/schema/connectors/confluence/provenance.json +187 -0
  131. package/runtime/gatewaysdk/environment/schema/connectors/confluence/scenarios/default/instruction.md +39 -0
  132. package/runtime/gatewaysdk/environment/schema/connectors/confluence/scenarios/default/scenario.toml +3 -0
  133. package/runtime/gatewaysdk/environment/schema/connectors/confluence/scenarios/default/seed/confluence_favourites.json +29 -0
  134. package/runtime/gatewaysdk/environment/schema/connectors/confluence/scenarios/default/seed/confluence_footer_comments.json +984 -0
  135. package/runtime/gatewaysdk/environment/schema/connectors/confluence/scenarios/default/seed/confluence_inline_comments.json +355 -0
  136. package/runtime/gatewaysdk/environment/schema/connectors/confluence/scenarios/default/seed/confluence_labels.json +99 -0
  137. package/runtime/gatewaysdk/environment/schema/connectors/confluence/scenarios/default/seed/confluence_notifications.json +40 -0
  138. package/runtime/gatewaysdk/environment/schema/connectors/confluence/scenarios/default/seed/confluence_page_labels.json +209 -0
  139. package/runtime/gatewaysdk/environment/schema/connectors/confluence/scenarios/default/seed/confluence_page_versions.json +828 -0
  140. package/runtime/gatewaysdk/environment/schema/connectors/confluence/scenarios/default/seed/confluence_pages.json +949 -0
  141. package/runtime/gatewaysdk/environment/schema/connectors/confluence/scenarios/default/seed/confluence_recently_viewed_pages.json +59 -0
  142. package/runtime/gatewaysdk/environment/schema/connectors/confluence/scenarios/default/seed/confluence_sites.json +12 -0
  143. package/runtime/gatewaysdk/environment/schema/connectors/confluence/scenarios/default/seed/confluence_spaces.json +128 -0
  144. package/runtime/gatewaysdk/environment/schema/connectors/confluence/scenarios/default/seed/confluence_users.json +100 -0
  145. package/runtime/gatewaysdk/environment/schema/connectors/confluence/scenarios/default/seed/confluence_watches.json +96 -0
  146. package/runtime/gatewaysdk/environment/schema/connectors/confluence/tests/routes.json +212 -0
  147. package/runtime/gatewaysdk/environment/schema/connectors/confluence/tests/tools.json +140 -0
  148. package/runtime/gatewaysdk/environment/schema/connectors/confluence/tests/writes.json +201 -0
  149. package/runtime/gatewaysdk/environment/schema/connectors/confluence/ui/static/assets/index-BWaOVdpn.js +70 -0
  150. package/runtime/gatewaysdk/environment/schema/connectors/confluence/ui/static/assets/index-CKyfi3i5.css +1 -0
  151. package/runtime/gatewaysdk/environment/schema/connectors/confluence/ui/static/avatars/acct-01.svg +1 -0
  152. package/runtime/gatewaysdk/environment/schema/connectors/confluence/ui/static/avatars/acct-02.svg +1 -0
  153. package/runtime/gatewaysdk/environment/schema/connectors/confluence/ui/static/avatars/acct-03.svg +1 -0
  154. package/runtime/gatewaysdk/environment/schema/connectors/confluence/ui/static/avatars/acct-04.svg +1 -0
  155. package/runtime/gatewaysdk/environment/schema/connectors/confluence/ui/static/avatars/acct-05.svg +1 -0
  156. package/runtime/gatewaysdk/environment/schema/connectors/confluence/ui/static/avatars/acct-06.svg +1 -0
  157. package/runtime/gatewaysdk/environment/schema/connectors/confluence/ui/static/avatars/space-DES.svg +1 -0
  158. package/runtime/gatewaysdk/environment/schema/connectors/confluence/ui/static/avatars/space-ENG.svg +1 -0
  159. package/runtime/gatewaysdk/environment/schema/connectors/confluence/ui/static/avatars/space-OPS.svg +1 -0
  160. package/runtime/gatewaysdk/environment/schema/connectors/confluence/ui/static/avatars/space-ORB.svg +1 -0
  161. package/runtime/gatewaysdk/environment/schema/connectors/confluence/ui/static/avatars/space-PN.svg +1 -0
  162. package/runtime/gatewaysdk/environment/schema/connectors/confluence/ui/static/fonts/AtlassianMono-latin.woff2 +0 -0
  163. package/runtime/gatewaysdk/environment/schema/connectors/confluence/ui/static/fonts/AtlassianSans-latin.woff2 +0 -0
  164. package/runtime/gatewaysdk/environment/schema/connectors/confluence/ui/static/fonts/AtlassianSansItalic-latin.woff2 +0 -0
  165. package/runtime/gatewaysdk/environment/schema/connectors/confluence/ui/static/index.html +47 -0
  166. package/runtime/gatewaysdk/environment/schema/connectors/confluence/world.json +1346 -0
  167. package/runtime/gatewaysdk/environment/schema/connectors/custom/handlers.py +18 -0
  168. package/runtime/gatewaysdk/environment/schema/connectors/custom/provenance.json +35 -0
  169. package/runtime/gatewaysdk/environment/schema/connectors/custom/tests/tools.json +123 -0
  170. package/runtime/gatewaysdk/environment/schema/connectors/custom/world.json +211 -0
  171. package/runtime/gatewaysdk/environment/schema/connectors/github/api/handlers.py +2923 -0
  172. package/runtime/gatewaysdk/environment/schema/connectors/github/connector.toml +2091 -0
  173. package/runtime/gatewaysdk/environment/schema/connectors/github/handlers.py +81 -0
  174. package/runtime/gatewaysdk/environment/schema/connectors/github/parity.json +37 -0
  175. package/runtime/gatewaysdk/environment/schema/connectors/github/provenance.json +162 -0
  176. package/runtime/gatewaysdk/environment/schema/connectors/github/scenarios/default/instruction.md +18 -0
  177. package/runtime/gatewaysdk/environment/schema/connectors/github/scenarios/default/scenario.toml +2 -0
  178. package/runtime/gatewaysdk/environment/schema/connectors/github/scenarios/default/seed/github_apps.json +49 -0
  179. package/runtime/gatewaysdk/environment/schema/connectors/github/scenarios/default/seed/github_artifacts.json +26 -0
  180. package/runtime/gatewaysdk/environment/schema/connectors/github/scenarios/default/seed/github_branches.json +443 -0
  181. package/runtime/gatewaysdk/environment/schema/connectors/github/scenarios/default/seed/github_check_runs.json +220 -0
  182. package/runtime/gatewaysdk/environment/schema/connectors/github/scenarios/default/seed/github_check_suites.json +404 -0
  183. package/runtime/gatewaysdk/environment/schema/connectors/github/scenarios/default/seed/github_code_scanning_alerts.json +126 -0
  184. package/runtime/gatewaysdk/environment/schema/connectors/github/scenarios/default/seed/github_collaborators.json +100 -0
  185. package/runtime/gatewaysdk/environment/schema/connectors/github/scenarios/default/seed/github_commit_comments.json +43 -0
  186. package/runtime/gatewaysdk/environment/schema/connectors/github/scenarios/default/seed/github_commit_statuses.json +80 -0
  187. package/runtime/gatewaysdk/environment/schema/connectors/github/scenarios/default/seed/github_commits.json +461 -0
  188. package/runtime/gatewaysdk/environment/schema/connectors/github/scenarios/default/seed/github_dependabot_alerts.json +168 -0
  189. package/runtime/gatewaysdk/environment/schema/connectors/github/scenarios/default/seed/github_deployment_statuses.json +86 -0
  190. package/runtime/gatewaysdk/environment/schema/connectors/github/scenarios/default/seed/github_deployments.json +94 -0
  191. package/runtime/gatewaysdk/environment/schema/connectors/github/scenarios/default/seed/github_environments.json +31 -0
  192. package/runtime/gatewaysdk/environment/schema/connectors/github/scenarios/default/seed/github_gist_comments.json +38 -0
  193. package/runtime/gatewaysdk/environment/schema/connectors/github/scenarios/default/seed/github_gists.json +118 -0
  194. package/runtime/gatewaysdk/environment/schema/connectors/github/scenarios/default/seed/github_git_refs.json +59 -0
  195. package/runtime/gatewaysdk/environment/schema/connectors/github/scenarios/default/seed/github_installations.json +54 -0
  196. package/runtime/gatewaysdk/environment/schema/connectors/github/scenarios/default/seed/github_issue_comments.json +151 -0
  197. package/runtime/gatewaysdk/environment/schema/connectors/github/scenarios/default/seed/github_issue_events.json +606 -0
  198. package/runtime/gatewaysdk/environment/schema/connectors/github/scenarios/default/seed/github_issue_types.json +26 -0
  199. package/runtime/gatewaysdk/environment/schema/connectors/github/scenarios/default/seed/github_issues.json +758 -0
  200. package/runtime/gatewaysdk/environment/schema/connectors/github/scenarios/default/seed/github_labels.json +64 -0
  201. package/runtime/gatewaysdk/environment/schema/connectors/github/scenarios/default/seed/github_licenses.json +54 -0
  202. package/runtime/gatewaysdk/environment/schema/connectors/github/scenarios/default/seed/github_milestones.json +130 -0
  203. package/runtime/gatewaysdk/environment/schema/connectors/github/scenarios/default/seed/github_organization_memberships.json +139 -0
  204. package/runtime/gatewaysdk/environment/schema/connectors/github/scenarios/default/seed/github_organizations.json +38 -0
  205. package/runtime/gatewaysdk/environment/schema/connectors/github/scenarios/default/seed/github_pull_requests.json +874 -0
  206. package/runtime/gatewaysdk/environment/schema/connectors/github/scenarios/default/seed/github_release_assets.json +45 -0
  207. package/runtime/gatewaysdk/environment/schema/connectors/github/scenarios/default/seed/github_releases.json +92 -0
  208. package/runtime/gatewaysdk/environment/schema/connectors/github/scenarios/default/seed/github_repositories.json +797 -0
  209. package/runtime/gatewaysdk/environment/schema/connectors/github/scenarios/default/seed/github_repository_invitations.json +184 -0
  210. package/runtime/gatewaysdk/environment/schema/connectors/github/scenarios/default/seed/github_review_comments.json +66 -0
  211. package/runtime/gatewaysdk/environment/schema/connectors/github/scenarios/default/seed/github_reviews.json +138 -0
  212. package/runtime/gatewaysdk/environment/schema/connectors/github/scenarios/default/seed/github_secret_scanning_alerts.json +50 -0
  213. package/runtime/gatewaysdk/environment/schema/connectors/github/scenarios/default/seed/github_stargazers.json +88 -0
  214. package/runtime/gatewaysdk/environment/schema/connectors/github/scenarios/default/seed/github_tags.json +28 -0
  215. package/runtime/gatewaysdk/environment/schema/connectors/github/scenarios/default/seed/github_team_memberships.json +25 -0
  216. package/runtime/gatewaysdk/environment/schema/connectors/github/scenarios/default/seed/github_team_repositories.json +258 -0
  217. package/runtime/gatewaysdk/environment/schema/connectors/github/scenarios/default/seed/github_teams.json +130 -0
  218. package/runtime/gatewaysdk/environment/schema/connectors/github/scenarios/default/seed/github_users.json +174 -0
  219. package/runtime/gatewaysdk/environment/schema/connectors/github/scenarios/default/seed/github_webhooks.json +31 -0
  220. package/runtime/gatewaysdk/environment/schema/connectors/github/scenarios/default/seed/github_workflow_jobs.json +115 -0
  221. package/runtime/gatewaysdk/environment/schema/connectors/github/scenarios/default/seed/github_workflow_runs.json +1021 -0
  222. package/runtime/gatewaysdk/environment/schema/connectors/github/scenarios/default/seed/github_workflows.json +30 -0
  223. package/runtime/gatewaysdk/environment/schema/connectors/github/scope.toml +597 -0
  224. package/runtime/gatewaysdk/environment/schema/connectors/github/tests/tools.json +79 -0
  225. package/runtime/gatewaysdk/environment/schema/connectors/github/vendor-openapi.json +1 -0
  226. package/runtime/gatewaysdk/environment/schema/connectors/github/world.json +15762 -0
  227. package/runtime/gatewaysdk/environment/schema/connectors/gmail/api/handlers.py +1413 -0
  228. package/runtime/gatewaysdk/environment/schema/connectors/gmail/connector.toml +630 -0
  229. package/runtime/gatewaysdk/environment/schema/connectors/gmail/handlers.py +136 -0
  230. package/runtime/gatewaysdk/environment/schema/connectors/gmail/scenarios/default/scenario.toml +1 -0
  231. package/runtime/gatewaysdk/environment/schema/connectors/gmail/scenarios/default/seed/10-gmail_profiles.json +10 -0
  232. package/runtime/gatewaysdk/environment/schema/connectors/gmail/scenarios/default/seed/20-gmail_labels.json +205 -0
  233. package/runtime/gatewaysdk/environment/schema/connectors/gmail/scenarios/default/seed/30-gmail_contacts.json +234 -0
  234. package/runtime/gatewaysdk/environment/schema/connectors/gmail/scenarios/default/seed/40-gmail_threads.json +374 -0
  235. package/runtime/gatewaysdk/environment/schema/connectors/gmail/scenarios/default/seed/50-gmail_messages.json +1015 -0
  236. package/runtime/gatewaysdk/environment/schema/connectors/gmail/scenarios/default/seed/60-gmail_message_parts.json +3039 -0
  237. package/runtime/gatewaysdk/environment/schema/connectors/gmail/scenarios/default/seed/70-gmail_attachments.json +28 -0
  238. package/runtime/gatewaysdk/environment/schema/connectors/gmail/scenarios/default/seed/80-gmail_drafts.json +39 -0
  239. package/runtime/gatewaysdk/environment/schema/connectors/gmail/scenarios/default/seed/90-gmail_client_settings.json +103 -0
  240. package/runtime/gatewaysdk/environment/schema/connectors/gmail/world.json +784 -0
  241. package/runtime/gatewaysdk/environment/schema/connectors/google-calendar/api/handlers.py +454 -0
  242. package/runtime/gatewaysdk/environment/schema/connectors/google-calendar/connector.toml +519 -0
  243. package/runtime/gatewaysdk/environment/schema/connectors/google-calendar/handlers.py +23 -0
  244. package/runtime/gatewaysdk/environment/schema/connectors/google-calendar/provenance.json +229 -0
  245. package/runtime/gatewaysdk/environment/schema/connectors/google-calendar/scenarios/default/instruction.md +25 -0
  246. package/runtime/gatewaysdk/environment/schema/connectors/google-calendar/scenarios/default/scenario.toml +1 -0
  247. package/runtime/gatewaysdk/environment/schema/connectors/google-calendar/scenarios/default/seed/10-calendar_calendars.json +75 -0
  248. package/runtime/gatewaysdk/environment/schema/connectors/google-calendar/scenarios/default/seed/20-calendar_calendar_list_entries.json +115 -0
  249. package/runtime/gatewaysdk/environment/schema/connectors/google-calendar/scenarios/default/seed/30-calendar_acl_rules.json +124 -0
  250. package/runtime/gatewaysdk/environment/schema/connectors/google-calendar/scenarios/default/seed/40-calendar_events.json +810 -0
  251. package/runtime/gatewaysdk/environment/schema/connectors/google-calendar/scenarios/default/seed/50-calendar_settings.json +76 -0
  252. package/runtime/gatewaysdk/environment/schema/connectors/google-calendar/scenarios/default/seed/60-calendar_channels.json +26 -0
  253. package/runtime/gatewaysdk/environment/schema/connectors/google-calendar/scenarios/default/seed/70-calendar_colors.json +48 -0
  254. package/runtime/gatewaysdk/environment/schema/connectors/google-calendar/scope.toml +105 -0
  255. package/runtime/gatewaysdk/environment/schema/connectors/google-calendar/tests/tools.json +53 -0
  256. package/runtime/gatewaysdk/environment/schema/connectors/google-calendar/vendor-openapi.json +4185 -0
  257. package/runtime/gatewaysdk/environment/schema/connectors/google-calendar/world.json +1384 -0
  258. package/runtime/gatewaysdk/environment/schema/connectors/google-docs/api/handlers.py +782 -0
  259. package/runtime/gatewaysdk/environment/schema/connectors/google-docs/connector.toml +373 -0
  260. package/runtime/gatewaysdk/environment/schema/connectors/google-docs/google-docs-types.json +4939 -0
  261. package/runtime/gatewaysdk/environment/schema/connectors/google-docs/handlers.py +197 -0
  262. package/runtime/gatewaysdk/environment/schema/connectors/google-docs/provenance.json +191 -0
  263. package/runtime/gatewaysdk/environment/schema/connectors/google-docs/scenarios/default/instruction.md +29 -0
  264. package/runtime/gatewaysdk/environment/schema/connectors/google-docs/scenarios/default/scenario.toml +2 -0
  265. package/runtime/gatewaysdk/environment/schema/connectors/google-docs/scenarios/default/seed/gdocs_comments.json +50 -0
  266. package/runtime/gatewaysdk/environment/schema/connectors/google-docs/scenarios/default/seed/gdocs_documents.json +8096 -0
  267. package/runtime/gatewaysdk/environment/schema/connectors/google-docs/scenarios/default/seed/gdocs_files.json +1187 -0
  268. package/runtime/gatewaysdk/environment/schema/connectors/google-docs/scenarios/default/seed/gdocs_permissions.json +543 -0
  269. package/runtime/gatewaysdk/environment/schema/connectors/google-docs/scenarios/default/seed/gdocs_replies.json +22 -0
  270. package/runtime/gatewaysdk/environment/schema/connectors/google-docs/scenarios/default/seed/gdocs_revisions.json +643 -0
  271. package/runtime/gatewaysdk/environment/schema/connectors/google-docs/scenarios/default/seed/gdocs_users.json +32 -0
  272. package/runtime/gatewaysdk/environment/schema/connectors/google-docs/scope.toml +148 -0
  273. package/runtime/gatewaysdk/environment/schema/connectors/google-docs/tests/api.json +319 -0
  274. package/runtime/gatewaysdk/environment/schema/connectors/google-docs/tests/tools.json +262 -0
  275. package/runtime/gatewaysdk/environment/schema/connectors/google-docs/ui/static/assets/index-BH9fmZSS.css +1 -0
  276. package/runtime/gatewaysdk/environment/schema/connectors/google-docs/ui/static/assets/index-CU4Fk9dX.js +67 -0
  277. package/runtime/gatewaysdk/environment/schema/connectors/google-docs/ui/static/fonts/README.md +20 -0
  278. package/runtime/gatewaysdk/environment/schema/connectors/google-docs/ui/static/fonts/google-sans-variable.woff2 +0 -0
  279. package/runtime/gatewaysdk/environment/schema/connectors/google-docs/ui/static/fonts/roboto-italic-variable-latin.woff2 +0 -0
  280. package/runtime/gatewaysdk/environment/schema/connectors/google-docs/ui/static/fonts/roboto-variable-latin-ext.woff2 +0 -0
  281. package/runtime/gatewaysdk/environment/schema/connectors/google-docs/ui/static/fonts/roboto-variable-latin.woff2 +0 -0
  282. package/runtime/gatewaysdk/environment/schema/connectors/google-docs/ui/static/icons/material_common_sprite1038_gm3_grey_medium.svg +1 -0
  283. package/runtime/gatewaysdk/environment/schema/connectors/google-docs/ui/static/index.html +13 -0
  284. package/runtime/gatewaysdk/environment/schema/connectors/google-docs/world.json +4489 -0
  285. package/runtime/gatewaysdk/environment/schema/connectors/google-drive/api/handlers.py +466 -0
  286. package/runtime/gatewaysdk/environment/schema/connectors/google-drive/connector.toml +626 -0
  287. package/runtime/gatewaysdk/environment/schema/connectors/google-drive/handlers.py +55 -0
  288. package/runtime/gatewaysdk/environment/schema/connectors/google-drive/provenance.json +342 -0
  289. package/runtime/gatewaysdk/environment/schema/connectors/google-drive/scenarios/default/instruction.md +11 -0
  290. package/runtime/gatewaysdk/environment/schema/connectors/google-drive/scenarios/default/scenario.toml +2 -0
  291. package/runtime/gatewaysdk/environment/schema/connectors/google-drive/scenarios/default/seed/drive_access_proposals.json +31 -0
  292. package/runtime/gatewaysdk/environment/schema/connectors/google-drive/scenarios/default/seed/drive_approvals.json +145 -0
  293. package/runtime/gatewaysdk/environment/schema/connectors/google-drive/scenarios/default/seed/drive_apps.json +81 -0
  294. package/runtime/gatewaysdk/environment/schema/connectors/google-drive/scenarios/default/seed/drive_comments.json +70 -0
  295. package/runtime/gatewaysdk/environment/schema/connectors/google-drive/scenarios/default/seed/drive_drives.json +71 -0
  296. package/runtime/gatewaysdk/environment/schema/connectors/google-drive/scenarios/default/seed/drive_files.json +700 -0
  297. package/runtime/gatewaysdk/environment/schema/connectors/google-drive/scenarios/default/seed/drive_labels.json +75 -0
  298. package/runtime/gatewaysdk/environment/schema/connectors/google-drive/scenarios/default/seed/drive_permissions.json +93 -0
  299. package/runtime/gatewaysdk/environment/schema/connectors/google-drive/scenarios/default/seed/drive_replies.json +66 -0
  300. package/runtime/gatewaysdk/environment/schema/connectors/google-drive/scenarios/default/seed/drive_revisions.json +82 -0
  301. package/runtime/gatewaysdk/environment/schema/connectors/google-drive/scope.toml +126 -0
  302. package/runtime/gatewaysdk/environment/schema/connectors/google-drive/tests/tools.json +101 -0
  303. package/runtime/gatewaysdk/environment/schema/connectors/google-drive/vendor-openapi.json +6193 -0
  304. package/runtime/gatewaysdk/environment/schema/connectors/google-drive/world.json +2150 -0
  305. package/runtime/gatewaysdk/environment/schema/connectors/google-sheets/api/handlers.py +1645 -0
  306. package/runtime/gatewaysdk/environment/schema/connectors/google-sheets/connector.toml +414 -0
  307. package/runtime/gatewaysdk/environment/schema/connectors/google-sheets/handlers.py +200 -0
  308. package/runtime/gatewaysdk/environment/schema/connectors/google-sheets/scenarios/default/scenario.toml +2 -0
  309. package/runtime/gatewaysdk/environment/schema/connectors/google-sheets/scenarios/default/seed/gsheets_cells.json +10252 -0
  310. package/runtime/gatewaysdk/environment/schema/connectors/google-sheets/scenarios/default/seed/gsheets_charts.json +103 -0
  311. package/runtime/gatewaysdk/environment/schema/connectors/google-sheets/scenarios/default/seed/gsheets_conditional_formats.json +138 -0
  312. package/runtime/gatewaysdk/environment/schema/connectors/google-sheets/scenarios/default/seed/gsheets_dimensions.json +256 -0
  313. package/runtime/gatewaysdk/environment/schema/connectors/google-sheets/scenarios/default/seed/gsheets_named_ranges.json +16 -0
  314. package/runtime/gatewaysdk/environment/schema/connectors/google-sheets/scenarios/default/seed/gsheets_permissions.json +31 -0
  315. package/runtime/gatewaysdk/environment/schema/connectors/google-sheets/scenarios/default/seed/gsheets_sheets.json +95 -0
  316. package/runtime/gatewaysdk/environment/schema/connectors/google-sheets/scenarios/default/seed/gsheets_spreadsheets.json +14 -0
  317. package/runtime/gatewaysdk/environment/schema/connectors/google-sheets/scenarios/default/seed/gsheets_view_states.json +26 -0
  318. package/runtime/gatewaysdk/environment/schema/connectors/google-sheets/tests/page.json +311 -0
  319. package/runtime/gatewaysdk/environment/schema/connectors/google-sheets/tests/vendor.json +843 -0
  320. package/runtime/gatewaysdk/environment/schema/connectors/google-sheets/ui/static/assets/index-CUpfKgm_.js +40 -0
  321. package/runtime/gatewaysdk/environment/schema/connectors/google-sheets/ui/static/assets/index-D3VhwBIC.css +1 -0
  322. package/runtime/gatewaysdk/environment/schema/connectors/google-sheets/ui/static/fonts/GoogleSans-400.woff2 +0 -0
  323. package/runtime/gatewaysdk/environment/schema/connectors/google-sheets/ui/static/fonts/GoogleSans-500.woff2 +0 -0
  324. package/runtime/gatewaysdk/environment/schema/connectors/google-sheets/ui/static/fonts/GoogleSans-700.woff2 +0 -0
  325. package/runtime/gatewaysdk/environment/schema/connectors/google-sheets/ui/static/fonts/GoogleSansText-400.woff2 +0 -0
  326. package/runtime/gatewaysdk/environment/schema/connectors/google-sheets/ui/static/fonts/GoogleSansText-500.woff2 +0 -0
  327. package/runtime/gatewaysdk/environment/schema/connectors/google-sheets/ui/static/fonts/GoogleSansText-700.woff2 +0 -0
  328. package/runtime/gatewaysdk/environment/schema/connectors/google-sheets/ui/static/fonts/Roboto-400.woff2 +0 -0
  329. package/runtime/gatewaysdk/environment/schema/connectors/google-sheets/ui/static/fonts/Roboto-500.woff2 +0 -0
  330. package/runtime/gatewaysdk/environment/schema/connectors/google-sheets/ui/static/fonts/Roboto-700.woff2 +0 -0
  331. package/runtime/gatewaysdk/environment/schema/connectors/google-sheets/ui/static/index.html +26 -0
  332. package/runtime/gatewaysdk/environment/schema/connectors/google-sheets/world.json +4029 -0
  333. package/runtime/gatewaysdk/environment/schema/connectors/hubspot/api/handlers.py +800 -0
  334. package/runtime/gatewaysdk/environment/schema/connectors/hubspot/connector.toml +776 -0
  335. package/runtime/gatewaysdk/environment/schema/connectors/hubspot/handlers.py +226 -0
  336. package/runtime/gatewaysdk/environment/schema/connectors/hubspot/scenarios/default/instruction.md +11 -0
  337. package/runtime/gatewaysdk/environment/schema/connectors/hubspot/scenarios/default/scenario.toml +2 -0
  338. package/runtime/gatewaysdk/environment/schema/connectors/hubspot/scenarios/default/seed/hubspot_accounts.json +17 -0
  339. package/runtime/gatewaysdk/environment/schema/connectors/hubspot/scenarios/default/seed/hubspot_associations.json +1478 -0
  340. package/runtime/gatewaysdk/environment/schema/connectors/hubspot/scenarios/default/seed/hubspot_calls.json +147 -0
  341. package/runtime/gatewaysdk/environment/schema/connectors/hubspot/scenarios/default/seed/hubspot_companies.json +144 -0
  342. package/runtime/gatewaysdk/environment/schema/connectors/hubspot/scenarios/default/seed/hubspot_contacts.json +284 -0
  343. package/runtime/gatewaysdk/environment/schema/connectors/hubspot/scenarios/default/seed/hubspot_deals.json +204 -0
  344. package/runtime/gatewaysdk/environment/schema/connectors/hubspot/scenarios/default/seed/hubspot_emails.json +160 -0
  345. package/runtime/gatewaysdk/environment/schema/connectors/hubspot/scenarios/default/seed/hubspot_meetings.json +147 -0
  346. package/runtime/gatewaysdk/environment/schema/connectors/hubspot/scenarios/default/seed/hubspot_nav_items.json +204 -0
  347. package/runtime/gatewaysdk/environment/schema/connectors/hubspot/scenarios/default/seed/hubspot_notes.json +160 -0
  348. package/runtime/gatewaysdk/environment/schema/connectors/hubspot/scenarios/default/seed/hubspot_notifications.json +25 -0
  349. package/runtime/gatewaysdk/environment/schema/connectors/hubspot/scenarios/default/seed/hubspot_object_views.json +334 -0
  350. package/runtime/gatewaysdk/environment/schema/connectors/hubspot/scenarios/default/seed/hubspot_owners.json +76 -0
  351. package/runtime/gatewaysdk/environment/schema/connectors/hubspot/scenarios/default/seed/hubspot_pipeline_stages.json +109 -0
  352. package/runtime/gatewaysdk/environment/schema/connectors/hubspot/scenarios/default/seed/hubspot_pipelines.json +13 -0
  353. package/runtime/gatewaysdk/environment/schema/connectors/hubspot/scenarios/default/seed/hubspot_properties.json +1220 -0
  354. package/runtime/gatewaysdk/environment/schema/connectors/hubspot/scenarios/default/seed/hubspot_tasks.json +394 -0
  355. package/runtime/gatewaysdk/environment/schema/connectors/hubspot/scenarios/default/seed/hubspot_tickets.json +34 -0
  356. package/runtime/gatewaysdk/environment/schema/connectors/hubspot/ui/static/assets/index-hdb5vB78.css +1 -0
  357. package/runtime/gatewaysdk/environment/schema/connectors/hubspot/ui/static/assets/index-xhg5ASqE.js +68 -0
  358. package/runtime/gatewaysdk/environment/schema/connectors/hubspot/ui/static/fonts/lexend-deca-300.ttf +0 -0
  359. package/runtime/gatewaysdk/environment/schema/connectors/hubspot/ui/static/fonts/lexend-deca-400.ttf +0 -0
  360. package/runtime/gatewaysdk/environment/schema/connectors/hubspot/ui/static/fonts/lexend-deca-500.ttf +0 -0
  361. package/runtime/gatewaysdk/environment/schema/connectors/hubspot/ui/static/fonts/lexend-deca-600.ttf +0 -0
  362. package/runtime/gatewaysdk/environment/schema/connectors/hubspot/ui/static/fonts/lexend-deca-700.ttf +0 -0
  363. package/runtime/gatewaysdk/environment/schema/connectors/hubspot/ui/static/fonts/lexend-deca-latin.woff2 +0 -0
  364. package/runtime/gatewaysdk/environment/schema/connectors/hubspot/ui/static/icons/add.svg +1 -0
  365. package/runtime/gatewaysdk/environment/schema/connectors/hubspot/ui/static/icons/avatar.svg +1 -0
  366. package/runtime/gatewaysdk/environment/schema/connectors/hubspot/ui/static/icons/bell.svg +3 -0
  367. package/runtime/gatewaysdk/environment/schema/connectors/hubspot/ui/static/icons/breeze.svg +4 -0
  368. package/runtime/gatewaysdk/environment/schema/connectors/hubspot/ui/static/icons/call.svg +1 -0
  369. package/runtime/gatewaysdk/environment/schema/connectors/hubspot/ui/static/icons/chevron-up.svg +3 -0
  370. package/runtime/gatewaysdk/environment/schema/connectors/hubspot/ui/static/icons/companies.svg +1 -0
  371. package/runtime/gatewaysdk/environment/schema/connectors/hubspot/ui/static/icons/contact.svg +1 -0
  372. package/runtime/gatewaysdk/environment/schema/connectors/hubspot/ui/static/icons/contacts.svg +1 -0
  373. package/runtime/gatewaysdk/environment/schema/connectors/hubspot/ui/static/icons/date.svg +1 -0
  374. package/runtime/gatewaysdk/environment/schema/connectors/hubspot/ui/static/icons/deals.svg +1 -0
  375. package/runtime/gatewaysdk/environment/schema/connectors/hubspot/ui/static/icons/duplicate.svg +1 -0
  376. package/runtime/gatewaysdk/environment/schema/connectors/hubspot/ui/static/icons/export.svg +3 -0
  377. package/runtime/gatewaysdk/environment/schema/connectors/hubspot/ui/static/icons/external-link.svg +1 -0
  378. package/runtime/gatewaysdk/environment/schema/connectors/hubspot/ui/static/icons/filter-lines.svg +3 -0
  379. package/runtime/gatewaysdk/environment/schema/connectors/hubspot/ui/static/icons/frame-expand.svg +3 -0
  380. package/runtime/gatewaysdk/environment/schema/connectors/hubspot/ui/static/icons/funnel.svg +3 -0
  381. package/runtime/gatewaysdk/environment/schema/connectors/hubspot/ui/static/icons/help.svg +1 -0
  382. package/runtime/gatewaysdk/environment/schema/connectors/hubspot/ui/static/icons/hierarchy.svg +4 -0
  383. package/runtime/gatewaysdk/environment/schema/connectors/hubspot/ui/static/icons/home.svg +1 -0
  384. package/runtime/gatewaysdk/environment/schema/connectors/hubspot/ui/static/icons/hubspot-logo.svg +1 -0
  385. package/runtime/gatewaysdk/environment/schema/connectors/hubspot/ui/static/icons/info.svg +1 -0
  386. package/runtime/gatewaysdk/environment/schema/connectors/hubspot/ui/static/icons/kanban.svg +1 -0
  387. package/runtime/gatewaysdk/environment/schema/connectors/hubspot/ui/static/icons/marketing-email.svg +1 -0
  388. package/runtime/gatewaysdk/environment/schema/connectors/hubspot/ui/static/icons/marketplace.svg +1 -0
  389. package/runtime/gatewaysdk/environment/schema/connectors/hubspot/ui/static/icons/meetings.svg +1 -0
  390. package/runtime/gatewaysdk/environment/schema/connectors/hubspot/ui/static/icons/more.svg +1 -0
  391. package/runtime/gatewaysdk/environment/schema/connectors/hubspot/ui/static/icons/pencil.svg +3 -0
  392. package/runtime/gatewaysdk/environment/schema/connectors/hubspot/ui/static/icons/pin.svg +3 -0
  393. package/runtime/gatewaysdk/environment/schema/connectors/hubspot/ui/static/icons/prospecting.svg +1 -0
  394. package/runtime/gatewaysdk/environment/schema/connectors/hubspot/ui/static/icons/refresh.svg +1 -0
  395. package/runtime/gatewaysdk/environment/schema/connectors/hubspot/ui/static/icons/search.svg +1 -0
  396. package/runtime/gatewaysdk/environment/schema/connectors/hubspot/ui/static/icons/settings.svg +1 -0
  397. package/runtime/gatewaysdk/environment/schema/connectors/hubspot/ui/static/icons/sidebar-collapse.svg +3 -0
  398. package/runtime/gatewaysdk/environment/schema/connectors/hubspot/ui/static/icons/sort.svg +3 -0
  399. package/runtime/gatewaysdk/environment/schema/connectors/hubspot/ui/static/icons/table.svg +1 -0
  400. package/runtime/gatewaysdk/environment/schema/connectors/hubspot/ui/static/icons/tasks.svg +1 -0
  401. package/runtime/gatewaysdk/environment/schema/connectors/hubspot/ui/static/icons/thumbs-down.svg +1 -0
  402. package/runtime/gatewaysdk/environment/schema/connectors/hubspot/ui/static/icons/thumbs-up.svg +1 -0
  403. package/runtime/gatewaysdk/environment/schema/connectors/hubspot/ui/static/icons/undo.svg +3 -0
  404. package/runtime/gatewaysdk/environment/schema/connectors/hubspot/ui/static/icons/upgrade-arrow.svg +1 -0
  405. package/runtime/gatewaysdk/environment/schema/connectors/hubspot/ui/static/icons/vertical-dots.svg +5 -0
  406. package/runtime/gatewaysdk/environment/schema/connectors/hubspot/ui/static/icons/workflows.svg +1 -0
  407. package/runtime/gatewaysdk/environment/schema/connectors/hubspot/ui/static/index.html +37 -0
  408. package/runtime/gatewaysdk/environment/schema/connectors/hubspot/world.json +1347 -0
  409. package/runtime/gatewaysdk/environment/schema/connectors/jamf/api/handlers.py +987 -0
  410. package/runtime/gatewaysdk/environment/schema/connectors/jamf/connector.toml +3057 -0
  411. package/runtime/gatewaysdk/environment/schema/connectors/jamf/handlers.py +34 -0
  412. package/runtime/gatewaysdk/environment/schema/connectors/jamf/parity.json +49 -0
  413. package/runtime/gatewaysdk/environment/schema/connectors/jamf/provenance.json +9495 -0
  414. package/runtime/gatewaysdk/environment/schema/connectors/jamf/scenarios/default/scenario.toml +4 -0
  415. package/runtime/gatewaysdk/environment/schema/connectors/jamf/scenarios/default/seed/jamf_account_groups.json +64 -0
  416. package/runtime/gatewaysdk/environment/schema/connectors/jamf/scenarios/default/seed/jamf_accounts.json +58 -0
  417. package/runtime/gatewaysdk/environment/schema/connectors/jamf/scenarios/default/seed/jamf_advanced_computer_searches.json +139 -0
  418. package/runtime/gatewaysdk/environment/schema/connectors/jamf/scenarios/default/seed/jamf_advanced_mobile_device_searches.json +61 -0
  419. package/runtime/gatewaysdk/environment/schema/connectors/jamf/scenarios/default/seed/jamf_advanced_user_content_searches.json +61 -0
  420. package/runtime/gatewaysdk/environment/schema/connectors/jamf/scenarios/default/seed/jamf_advanced_user_searches.json +124 -0
  421. package/runtime/gatewaysdk/environment/schema/connectors/jamf/scenarios/default/seed/jamf_api_integrations.json +37 -0
  422. package/runtime/gatewaysdk/environment/schema/connectors/jamf/scenarios/default/seed/jamf_api_roles.json +25 -0
  423. package/runtime/gatewaysdk/environment/schema/connectors/jamf/scenarios/default/seed/jamf_app_request_form_input_fields.json +22 -0
  424. package/runtime/gatewaysdk/environment/schema/connectors/jamf/scenarios/default/seed/jamf_buildings.json +34 -0
  425. package/runtime/gatewaysdk/environment/schema/connectors/jamf/scenarios/default/seed/jamf_byo_profiles.json +46 -0
  426. package/runtime/gatewaysdk/environment/schema/connectors/jamf/scenarios/default/seed/jamf_categories.json +19 -0
  427. package/runtime/gatewaysdk/environment/schema/connectors/jamf/scenarios/default/seed/jamf_classes.json +217 -0
  428. package/runtime/gatewaysdk/environment/schema/connectors/jamf/scenarios/default/seed/jamf_cloud_idps.json +19 -0
  429. package/runtime/gatewaysdk/environment/schema/connectors/jamf/scenarios/default/seed/jamf_computer_group_members.json +16 -0
  430. package/runtime/gatewaysdk/environment/schema/connectors/jamf/scenarios/default/seed/jamf_computer_groups.json +38 -0
  431. package/runtime/gatewaysdk/environment/schema/connectors/jamf/scenarios/default/seed/jamf_computer_invitations.json +82 -0
  432. package/runtime/gatewaysdk/environment/schema/connectors/jamf/scenarios/default/seed/jamf_computer_prestages.json +274 -0
  433. package/runtime/gatewaysdk/environment/schema/connectors/jamf/scenarios/default/seed/jamf_computers.json +1537 -0
  434. package/runtime/gatewaysdk/environment/schema/connectors/jamf/scenarios/default/seed/jamf_configuration_profiles.json +649 -0
  435. package/runtime/gatewaysdk/environment/schema/connectors/jamf/scenarios/default/seed/jamf_departments.json +16 -0
  436. package/runtime/gatewaysdk/environment/schema/connectors/jamf/scenarios/default/seed/jamf_device_enrollment_devices.json +70 -0
  437. package/runtime/gatewaysdk/environment/schema/connectors/jamf/scenarios/default/seed/jamf_device_enrollments.json +46 -0
  438. package/runtime/gatewaysdk/environment/schema/connectors/jamf/scenarios/default/seed/jamf_directory_bindings.json +34 -0
  439. package/runtime/gatewaysdk/environment/schema/connectors/jamf/scenarios/default/seed/jamf_disk_encryption_configurations.json +22 -0
  440. package/runtime/gatewaysdk/environment/schema/connectors/jamf/scenarios/default/seed/jamf_distribution_points.json +91 -0
  441. package/runtime/gatewaysdk/environment/schema/connectors/jamf/scenarios/default/seed/jamf_dock_items.json +25 -0
  442. package/runtime/gatewaysdk/environment/schema/connectors/jamf/scenarios/default/seed/jamf_ebooks.json +43 -0
  443. package/runtime/gatewaysdk/environment/schema/connectors/jamf/scenarios/default/seed/jamf_enrollment_customizations.json +43 -0
  444. package/runtime/gatewaysdk/environment/schema/connectors/jamf/scenarios/default/seed/jamf_extension_attributes.json +52 -0
  445. package/runtime/gatewaysdk/environment/schema/connectors/jamf/scenarios/default/seed/jamf_ibeacons.json +25 -0
  446. package/runtime/gatewaysdk/environment/schema/connectors/jamf/scenarios/default/seed/jamf_inventory_preload_records.json +100 -0
  447. package/runtime/gatewaysdk/environment/schema/connectors/jamf/scenarios/default/seed/jamf_ios_branding_configurations.json +31 -0
  448. package/runtime/gatewaysdk/environment/schema/connectors/jamf/scenarios/default/seed/jamf_ldap_servers.json +16 -0
  449. package/runtime/gatewaysdk/environment/schema/connectors/jamf/scenarios/default/seed/jamf_licensed_software_records.json +244 -0
  450. package/runtime/gatewaysdk/environment/schema/connectors/jamf/scenarios/default/seed/jamf_mac_applications.json +610 -0
  451. package/runtime/gatewaysdk/environment/schema/connectors/jamf/scenarios/default/seed/jamf_macos_branding_configurations.json +34 -0
  452. package/runtime/gatewaysdk/environment/schema/connectors/jamf/scenarios/default/seed/jamf_managed_software_update_plans.json +67 -0
  453. package/runtime/gatewaysdk/environment/schema/connectors/jamf/scenarios/default/seed/jamf_mdm_commands.json +58 -0
  454. package/runtime/gatewaysdk/environment/schema/connectors/jamf/scenarios/default/seed/jamf_mobile_device_applications.json +700 -0
  455. package/runtime/gatewaysdk/environment/schema/connectors/jamf/scenarios/default/seed/jamf_mobile_device_configuration_profiles.json +652 -0
  456. package/runtime/gatewaysdk/environment/schema/connectors/jamf/scenarios/default/seed/jamf_mobile_device_enrollment_profiles.json +160 -0
  457. package/runtime/gatewaysdk/environment/schema/connectors/jamf/scenarios/default/seed/jamf_mobile_device_extension_attributes.json +43 -0
  458. package/runtime/gatewaysdk/environment/schema/connectors/jamf/scenarios/default/seed/jamf_mobile_device_group_members.json +16 -0
  459. package/runtime/gatewaysdk/environment/schema/connectors/jamf/scenarios/default/seed/jamf_mobile_device_groups.json +38 -0
  460. package/runtime/gatewaysdk/environment/schema/connectors/jamf/scenarios/default/seed/jamf_mobile_device_prestages.json +280 -0
  461. package/runtime/gatewaysdk/environment/schema/connectors/jamf/scenarios/default/seed/jamf_mobile_device_provisioning_profiles.json +31 -0
  462. package/runtime/gatewaysdk/environment/schema/connectors/jamf/scenarios/default/seed/jamf_mobile_devices.json +1558 -0
  463. package/runtime/gatewaysdk/environment/schema/connectors/jamf/scenarios/default/seed/jamf_network_segments.json +46 -0
  464. package/runtime/gatewaysdk/environment/schema/connectors/jamf/scenarios/default/seed/jamf_packages.json +118 -0
  465. package/runtime/gatewaysdk/environment/schema/connectors/jamf/scenarios/default/seed/jamf_patch_software_title_configurations.json +88 -0
  466. package/runtime/gatewaysdk/environment/schema/connectors/jamf/scenarios/default/seed/jamf_policies.json +1054 -0
  467. package/runtime/gatewaysdk/environment/schema/connectors/jamf/scenarios/default/seed/jamf_printers.json +52 -0
  468. package/runtime/gatewaysdk/environment/schema/connectors/jamf/scenarios/default/seed/jamf_removable_mac_addresses.json +16 -0
  469. package/runtime/gatewaysdk/environment/schema/connectors/jamf/scenarios/default/seed/jamf_restricted_software_titles.json +289 -0
  470. package/runtime/gatewaysdk/environment/schema/connectors/jamf/scenarios/default/seed/jamf_return_to_service_configurations.json +19 -0
  471. package/runtime/gatewaysdk/environment/schema/connectors/jamf/scenarios/default/seed/jamf_scripts.json +61 -0
  472. package/runtime/gatewaysdk/environment/schema/connectors/jamf/scenarios/default/seed/jamf_sites.json +19 -0
  473. package/runtime/gatewaysdk/environment/schema/connectors/jamf/scenarios/default/seed/jamf_software_update_servers.json +25 -0
  474. package/runtime/gatewaysdk/environment/schema/connectors/jamf/scenarios/default/seed/jamf_supervision_identities.json +22 -0
  475. package/runtime/gatewaysdk/environment/schema/connectors/jamf/scenarios/default/seed/jamf_user_extension_attributes.json +31 -0
  476. package/runtime/gatewaysdk/environment/schema/connectors/jamf/scenarios/default/seed/jamf_user_groups.json +112 -0
  477. package/runtime/gatewaysdk/environment/schema/connectors/jamf/scenarios/default/seed/jamf_users.json +37 -0
  478. package/runtime/gatewaysdk/environment/schema/connectors/jamf/scenarios/default/seed/jamf_volume_purchasing_locations.json +106 -0
  479. package/runtime/gatewaysdk/environment/schema/connectors/jamf/scenarios/default/seed/jamf_volume_purchasing_subscriptions.json +76 -0
  480. package/runtime/gatewaysdk/environment/schema/connectors/jamf/scenarios/default/seed/jamf_webhooks.json +70 -0
  481. package/runtime/gatewaysdk/environment/schema/connectors/jamf/scope.toml +900 -0
  482. package/runtime/gatewaysdk/environment/schema/connectors/jamf/tests/tools.json +95 -0
  483. package/runtime/gatewaysdk/environment/schema/connectors/jamf/vendor-openapi.json +1 -0
  484. package/runtime/gatewaysdk/environment/schema/connectors/jamf/world.json +11559 -0
  485. package/runtime/gatewaysdk/environment/schema/connectors/jira/api/handlers.py +1056 -0
  486. package/runtime/gatewaysdk/environment/schema/connectors/jira/connector.toml +955 -0
  487. package/runtime/gatewaysdk/environment/schema/connectors/jira/handlers.py +87 -0
  488. package/runtime/gatewaysdk/environment/schema/connectors/jira/parity.json +27 -0
  489. package/runtime/gatewaysdk/environment/schema/connectors/jira/provenance.json +166 -0
  490. package/runtime/gatewaysdk/environment/schema/connectors/jira/scenarios/default/instruction.md +22 -0
  491. package/runtime/gatewaysdk/environment/schema/connectors/jira/scenarios/default/scenario.toml +3 -0
  492. package/runtime/gatewaysdk/environment/schema/connectors/jira/scenarios/default/seed/jira_boards.json +61 -0
  493. package/runtime/gatewaysdk/environment/schema/connectors/jira/scenarios/default/seed/jira_changelogs.json +136 -0
  494. package/runtime/gatewaysdk/environment/schema/connectors/jira/scenarios/default/seed/jira_comments.json +205 -0
  495. package/runtime/gatewaysdk/environment/schema/connectors/jira/scenarios/default/seed/jira_components.json +78 -0
  496. package/runtime/gatewaysdk/environment/schema/connectors/jira/scenarios/default/seed/jira_fields.json +498 -0
  497. package/runtime/gatewaysdk/environment/schema/connectors/jira/scenarios/default/seed/jira_issue_link_types.json +25 -0
  498. package/runtime/gatewaysdk/environment/schema/connectors/jira/scenarios/default/seed/jira_issue_links.json +190 -0
  499. package/runtime/gatewaysdk/environment/schema/connectors/jira/scenarios/default/seed/jira_issue_types.json +44 -0
  500. package/runtime/gatewaysdk/environment/schema/connectors/jira/scenarios/default/seed/jira_issues.json +1448 -0
  501. package/runtime/gatewaysdk/environment/schema/connectors/jira/scenarios/default/seed/jira_priorities.json +40 -0
  502. package/runtime/gatewaysdk/environment/schema/connectors/jira/scenarios/default/seed/jira_project_categories.json +16 -0
  503. package/runtime/gatewaysdk/environment/schema/connectors/jira/scenarios/default/seed/jira_projects.json +111 -0
  504. package/runtime/gatewaysdk/environment/schema/connectors/jira/scenarios/default/seed/jira_resolutions.json +22 -0
  505. package/runtime/gatewaysdk/environment/schema/connectors/jira/scenarios/default/seed/jira_sprint_issues.json +20 -0
  506. package/runtime/gatewaysdk/environment/schema/connectors/jira/scenarios/default/seed/jira_sprints.json +39 -0
  507. package/runtime/gatewaysdk/environment/schema/connectors/jira/scenarios/default/seed/jira_status_categories.json +25 -0
  508. package/runtime/gatewaysdk/environment/schema/connectors/jira/scenarios/default/seed/jira_statuses.json +60 -0
  509. package/runtime/gatewaysdk/environment/schema/connectors/jira/scenarios/default/seed/jira_transitions.json +179 -0
  510. package/runtime/gatewaysdk/environment/schema/connectors/jira/scenarios/default/seed/jira_users.json +83 -0
  511. package/runtime/gatewaysdk/environment/schema/connectors/jira/scenarios/default/seed/jira_versions.json +30 -0
  512. package/runtime/gatewaysdk/environment/schema/connectors/jira/scenarios/default/seed/jira_worklogs.json +96 -0
  513. package/runtime/gatewaysdk/environment/schema/connectors/jira/scope.toml +255 -0
  514. package/runtime/gatewaysdk/environment/schema/connectors/jira/tests/tools.json +151 -0
  515. package/runtime/gatewaysdk/environment/schema/connectors/jira/vendor-openapi.json +13562 -0
  516. package/runtime/gatewaysdk/environment/schema/connectors/jira/world.json +3587 -0
  517. package/runtime/gatewaysdk/environment/schema/connectors/kandji/api/handlers.py +406 -0
  518. package/runtime/gatewaysdk/environment/schema/connectors/kandji/connector.toml +531 -0
  519. package/runtime/gatewaysdk/environment/schema/connectors/kandji/handlers.py +38 -0
  520. package/runtime/gatewaysdk/environment/schema/connectors/kandji/parity.json +29 -0
  521. package/runtime/gatewaysdk/environment/schema/connectors/kandji/provenance.json +335 -0
  522. package/runtime/gatewaysdk/environment/schema/connectors/kandji/scenarios/default/scenario.toml +2 -0
  523. package/runtime/gatewaysdk/environment/schema/connectors/kandji/scenarios/default/seed/kandji_blueprint_items.json +22 -0
  524. package/runtime/gatewaysdk/environment/schema/connectors/kandji/scenarios/default/seed/kandji_blueprint_template_categories.json +14 -0
  525. package/runtime/gatewaysdk/environment/schema/connectors/kandji/scenarios/default/seed/kandji_blueprint_templates.json +38 -0
  526. package/runtime/gatewaysdk/environment/schema/connectors/kandji/scenarios/default/seed/kandji_blueprints.json +52 -0
  527. package/runtime/gatewaysdk/environment/schema/connectors/kandji/scenarios/default/seed/kandji_custom_apps.json +45 -0
  528. package/runtime/gatewaysdk/environment/schema/connectors/kandji/scenarios/default/seed/kandji_custom_profiles.json +32 -0
  529. package/runtime/gatewaysdk/environment/schema/connectors/kandji/scenarios/default/seed/kandji_custom_scripts.json +27 -0
  530. package/runtime/gatewaysdk/environment/schema/connectors/kandji/scenarios/default/seed/kandji_device_activities.json +43 -0
  531. package/runtime/gatewaysdk/environment/schema/connectors/kandji/scenarios/default/seed/kandji_device_apps.json +52 -0
  532. package/runtime/gatewaysdk/environment/schema/connectors/kandji/scenarios/default/seed/kandji_device_commands.json +41 -0
  533. package/runtime/gatewaysdk/environment/schema/connectors/kandji/scenarios/default/seed/kandji_device_notes.json +20 -0
  534. package/runtime/gatewaysdk/environment/schema/connectors/kandji/scenarios/default/seed/kandji_device_parameters.json +28 -0
  535. package/runtime/gatewaysdk/environment/schema/connectors/kandji/scenarios/default/seed/kandji_device_tags.json +16 -0
  536. package/runtime/gatewaysdk/environment/schema/connectors/kandji/scenarios/default/seed/kandji_devices.json +122 -0
  537. package/runtime/gatewaysdk/environment/schema/connectors/kandji/scenarios/default/seed/kandji_in_house_apps.json +33 -0
  538. package/runtime/gatewaysdk/environment/schema/connectors/kandji/scenarios/default/seed/kandji_library_item_activities.json +33 -0
  539. package/runtime/gatewaysdk/environment/schema/connectors/kandji/scenarios/default/seed/kandji_library_item_statuses.json +98 -0
  540. package/runtime/gatewaysdk/environment/schema/connectors/kandji/scenarios/default/seed/kandji_library_items.json +24 -0
  541. package/runtime/gatewaysdk/environment/schema/connectors/kandji/scenarios/default/seed/kandji_self_service_categories.json +12 -0
  542. package/runtime/gatewaysdk/environment/schema/connectors/kandji/scenarios/default/seed/kandji_tags.json +16 -0
  543. package/runtime/gatewaysdk/environment/schema/connectors/kandji/scenarios/default/seed/kandji_users.json +61 -0
  544. package/runtime/gatewaysdk/environment/schema/connectors/kandji/scope.toml +199 -0
  545. package/runtime/gatewaysdk/environment/schema/connectors/kandji/tests/tools.json +64 -0
  546. package/runtime/gatewaysdk/environment/schema/connectors/kandji/vendor-openapi.json +5463 -0
  547. package/runtime/gatewaysdk/environment/schema/connectors/kandji/world.json +1817 -0
  548. package/runtime/gatewaysdk/environment/schema/connectors/linear/api/handlers.py +139 -0
  549. package/runtime/gatewaysdk/environment/schema/connectors/linear/connector.toml +1574 -0
  550. package/runtime/gatewaysdk/environment/schema/connectors/linear/handlers.py +23 -0
  551. package/runtime/gatewaysdk/environment/schema/connectors/linear/provenance.json +142 -0
  552. package/runtime/gatewaysdk/environment/schema/connectors/linear/scenarios/default/scenario.toml +2 -0
  553. package/runtime/gatewaysdk/environment/schema/connectors/linear/scenarios/default/seed/attachments.json +21 -0
  554. package/runtime/gatewaysdk/environment/schema/connectors/linear/scenarios/default/seed/comments.json +79 -0
  555. package/runtime/gatewaysdk/environment/schema/connectors/linear/scenarios/default/seed/customer_needs.json +21 -0
  556. package/runtime/gatewaysdk/environment/schema/connectors/linear/scenarios/default/seed/customer_statuses.json +26 -0
  557. package/runtime/gatewaysdk/environment/schema/connectors/linear/scenarios/default/seed/customer_tiers.json +26 -0
  558. package/runtime/gatewaysdk/environment/schema/connectors/linear/scenarios/default/seed/customers.json +48 -0
  559. package/runtime/gatewaysdk/environment/schema/connectors/linear/scenarios/default/seed/cycles.json +86 -0
  560. package/runtime/gatewaysdk/environment/schema/connectors/linear/scenarios/default/seed/documents.json +27 -0
  561. package/runtime/gatewaysdk/environment/schema/connectors/linear/scenarios/default/seed/initiative_projects.json +13 -0
  562. package/runtime/gatewaysdk/environment/schema/connectors/linear/scenarios/default/seed/initiative_updates.json +23 -0
  563. package/runtime/gatewaysdk/environment/schema/connectors/linear/scenarios/default/seed/initiatives.json +41 -0
  564. package/runtime/gatewaysdk/environment/schema/connectors/linear/scenarios/default/seed/issue_labels.json +16 -0
  565. package/runtime/gatewaysdk/environment/schema/connectors/linear/scenarios/default/seed/issue_relations.json +13 -0
  566. package/runtime/gatewaysdk/environment/schema/connectors/linear/scenarios/default/seed/issues.json +264 -0
  567. package/runtime/gatewaysdk/environment/schema/connectors/linear/scenarios/default/seed/labels.json +52 -0
  568. package/runtime/gatewaysdk/environment/schema/connectors/linear/scenarios/default/seed/organizations.json +53 -0
  569. package/runtime/gatewaysdk/environment/schema/connectors/linear/scenarios/default/seed/project_labels.json +34 -0
  570. package/runtime/gatewaysdk/environment/schema/connectors/linear/scenarios/default/seed/project_members.json +16 -0
  571. package/runtime/gatewaysdk/environment/schema/connectors/linear/scenarios/default/seed/project_milestones.json +30 -0
  572. package/runtime/gatewaysdk/environment/schema/connectors/linear/scenarios/default/seed/project_relations.json +18 -0
  573. package/runtime/gatewaysdk/environment/schema/connectors/linear/scenarios/default/seed/project_statuses.json +76 -0
  574. package/runtime/gatewaysdk/environment/schema/connectors/linear/scenarios/default/seed/project_updates.json +42 -0
  575. package/runtime/gatewaysdk/environment/schema/connectors/linear/scenarios/default/seed/projects.json +110 -0
  576. package/runtime/gatewaysdk/environment/schema/connectors/linear/scenarios/default/seed/reactions.json +28 -0
  577. package/runtime/gatewaysdk/environment/schema/connectors/linear/scenarios/default/seed/roadmap_projects.json +13 -0
  578. package/runtime/gatewaysdk/environment/schema/connectors/linear/scenarios/default/seed/roadmaps.json +19 -0
  579. package/runtime/gatewaysdk/environment/schema/connectors/linear/scenarios/default/seed/team_memberships.json +34 -0
  580. package/runtime/gatewaysdk/environment/schema/connectors/linear/scenarios/default/seed/teams.json +114 -0
  581. package/runtime/gatewaysdk/environment/schema/connectors/linear/scenarios/default/seed/templates.json +27 -0
  582. package/runtime/gatewaysdk/environment/schema/connectors/linear/scenarios/default/seed/users.json +106 -0
  583. package/runtime/gatewaysdk/environment/schema/connectors/linear/scenarios/default/seed/webhooks.json +21 -0
  584. package/runtime/gatewaysdk/environment/schema/connectors/linear/scenarios/default/seed/workflow_states.json +108 -0
  585. package/runtime/gatewaysdk/environment/schema/connectors/linear/scope.toml +87 -0
  586. package/runtime/gatewaysdk/environment/schema/connectors/linear/tests/tools.json +52 -0
  587. package/runtime/gatewaysdk/environment/schema/connectors/linear/world.json +6148 -0
  588. package/runtime/gatewaysdk/environment/schema/connectors/microsoft-teams/api/handlers.py +1218 -0
  589. package/runtime/gatewaysdk/environment/schema/connectors/microsoft-teams/connector.toml +1246 -0
  590. package/runtime/gatewaysdk/environment/schema/connectors/microsoft-teams/fidelity.json +75 -0
  591. package/runtime/gatewaysdk/environment/schema/connectors/microsoft-teams/handlers.py +1 -0
  592. package/runtime/gatewaysdk/environment/schema/connectors/microsoft-teams/provenance.json +1632 -0
  593. package/runtime/gatewaysdk/environment/schema/connectors/microsoft-teams/scenarios/default/instruction.md +12 -0
  594. package/runtime/gatewaysdk/environment/schema/connectors/microsoft-teams/scenarios/default/scenario.toml +2 -0
  595. package/runtime/gatewaysdk/environment/schema/connectors/microsoft-teams/scenarios/default/seed/teams_async_operations.json +47 -0
  596. package/runtime/gatewaysdk/environment/schema/connectors/microsoft-teams/scenarios/default/seed/teams_channel_hosted_contents.json +12 -0
  597. package/runtime/gatewaysdk/environment/schema/connectors/microsoft-teams/scenarios/default/seed/teams_channel_members.json +88 -0
  598. package/runtime/gatewaysdk/environment/schema/connectors/microsoft-teams/scenarios/default/seed/teams_channel_messages.json +313 -0
  599. package/runtime/gatewaysdk/environment/schema/connectors/microsoft-teams/scenarios/default/seed/teams_channel_replies.json +128 -0
  600. package/runtime/gatewaysdk/environment/schema/connectors/microsoft-teams/scenarios/default/seed/teams_channels.json +319 -0
  601. package/runtime/gatewaysdk/environment/schema/connectors/microsoft-teams/scenarios/default/seed/teams_chat_hosted_contents.json +18 -0
  602. package/runtime/gatewaysdk/environment/schema/connectors/microsoft-teams/scenarios/default/seed/teams_chat_members.json +155 -0
  603. package/runtime/gatewaysdk/environment/schema/connectors/microsoft-teams/scenarios/default/seed/teams_chat_messages.json +265 -0
  604. package/runtime/gatewaysdk/environment/schema/connectors/microsoft-teams/scenarios/default/seed/teams_chat_views.json +37 -0
  605. package/runtime/gatewaysdk/environment/schema/connectors/microsoft-teams/scenarios/default/seed/teams_chats.json +167 -0
  606. package/runtime/gatewaysdk/environment/schema/connectors/microsoft-teams/scenarios/default/seed/teams_incoming_channels.json +25 -0
  607. package/runtime/gatewaysdk/environment/schema/connectors/microsoft-teams/scenarios/default/seed/teams_pinned_messages.json +9 -0
  608. package/runtime/gatewaysdk/environment/schema/connectors/microsoft-teams/scenarios/default/seed/teams_reply_hosted_contents.json +13 -0
  609. package/runtime/gatewaysdk/environment/schema/connectors/microsoft-teams/scenarios/default/seed/teams_shared_channel_teams.json +32 -0
  610. package/runtime/gatewaysdk/environment/schema/connectors/microsoft-teams/scenarios/default/seed/teams_tag_members.json +31 -0
  611. package/runtime/gatewaysdk/environment/schema/connectors/microsoft-teams/scenarios/default/seed/teams_tags.json +32 -0
  612. package/runtime/gatewaysdk/environment/schema/connectors/microsoft-teams/scenarios/default/seed/teams_team_members.json +117 -0
  613. package/runtime/gatewaysdk/environment/schema/connectors/microsoft-teams/scenarios/default/seed/teams_teams.json +193 -0
  614. package/runtime/gatewaysdk/environment/schema/connectors/microsoft-teams/scope.md +303 -0
  615. package/runtime/gatewaysdk/environment/schema/connectors/microsoft-teams/teams-types.json +1739 -0
  616. package/runtime/gatewaysdk/environment/schema/connectors/microsoft-teams/tests/routes.json +101 -0
  617. package/runtime/gatewaysdk/environment/schema/connectors/microsoft-teams/vendor-openapi.json +11280 -0
  618. package/runtime/gatewaysdk/environment/schema/connectors/microsoft-teams/world.json +926 -0
  619. package/runtime/gatewaysdk/environment/schema/connectors/netsuite/api/handlers.py +571 -0
  620. package/runtime/gatewaysdk/environment/schema/connectors/netsuite/connector.toml +1484 -0
  621. package/runtime/gatewaysdk/environment/schema/connectors/netsuite/handlers.py +32 -0
  622. package/runtime/gatewaysdk/environment/schema/connectors/netsuite/parity.json +77 -0
  623. package/runtime/gatewaysdk/environment/schema/connectors/netsuite/provenance.json +303 -0
  624. package/runtime/gatewaysdk/environment/schema/connectors/netsuite/scenarios/default/instruction.md +11 -0
  625. package/runtime/gatewaysdk/environment/schema/connectors/netsuite/scenarios/default/scenario.toml +2 -0
  626. package/runtime/gatewaysdk/environment/schema/connectors/netsuite/scenarios/default/seed/netsuite_accounting_periods.json +107 -0
  627. package/runtime/gatewaysdk/environment/schema/connectors/netsuite/scenarios/default/seed/netsuite_accounts.json +514 -0
  628. package/runtime/gatewaysdk/environment/schema/connectors/netsuite/scenarios/default/seed/netsuite_classifications.json +64 -0
  629. package/runtime/gatewaysdk/environment/schema/connectors/netsuite/scenarios/default/seed/netsuite_contacts.json +90 -0
  630. package/runtime/gatewaysdk/environment/schema/connectors/netsuite/scenarios/default/seed/netsuite_credit_memos.json +112 -0
  631. package/runtime/gatewaysdk/environment/schema/connectors/netsuite/scenarios/default/seed/netsuite_currencies.json +37 -0
  632. package/runtime/gatewaysdk/environment/schema/connectors/netsuite/scenarios/default/seed/netsuite_customer_payments.json +108 -0
  633. package/runtime/gatewaysdk/environment/schema/connectors/netsuite/scenarios/default/seed/netsuite_customers.json +232 -0
  634. package/runtime/gatewaysdk/environment/schema/connectors/netsuite/scenarios/default/seed/netsuite_departments.json +80 -0
  635. package/runtime/gatewaysdk/environment/schema/connectors/netsuite/scenarios/default/seed/netsuite_employees.json +124 -0
  636. package/runtime/gatewaysdk/environment/schema/connectors/netsuite/scenarios/default/seed/netsuite_invoices.json +229 -0
  637. package/runtime/gatewaysdk/environment/schema/connectors/netsuite/scenarios/default/seed/netsuite_item_fulfillments.json +85 -0
  638. package/runtime/gatewaysdk/environment/schema/connectors/netsuite/scenarios/default/seed/netsuite_items.json +237 -0
  639. package/runtime/gatewaysdk/environment/schema/connectors/netsuite/scenarios/default/seed/netsuite_journal_entries.json +217 -0
  640. package/runtime/gatewaysdk/environment/schema/connectors/netsuite/scenarios/default/seed/netsuite_locations.json +62 -0
  641. package/runtime/gatewaysdk/environment/schema/connectors/netsuite/scenarios/default/seed/netsuite_price_levels.json +28 -0
  642. package/runtime/gatewaysdk/environment/schema/connectors/netsuite/scenarios/default/seed/netsuite_purchase_orders.json +152 -0
  643. package/runtime/gatewaysdk/environment/schema/connectors/netsuite/scenarios/default/seed/netsuite_sales_order_lines.json +235 -0
  644. package/runtime/gatewaysdk/environment/schema/connectors/netsuite/scenarios/default/seed/netsuite_sales_orders.json +219 -0
  645. package/runtime/gatewaysdk/environment/schema/connectors/netsuite/scenarios/default/seed/netsuite_subsidiaries.json +85 -0
  646. package/runtime/gatewaysdk/environment/schema/connectors/netsuite/scenarios/default/seed/netsuite_terms.json +48 -0
  647. package/runtime/gatewaysdk/environment/schema/connectors/netsuite/scenarios/default/seed/netsuite_vendor_bills.json +170 -0
  648. package/runtime/gatewaysdk/environment/schema/connectors/netsuite/scenarios/default/seed/netsuite_vendors.json +140 -0
  649. package/runtime/gatewaysdk/environment/schema/connectors/netsuite/scope.toml +296 -0
  650. package/runtime/gatewaysdk/environment/schema/connectors/netsuite/tests/tools.json +82 -0
  651. package/runtime/gatewaysdk/environment/schema/connectors/netsuite/world.json +39076 -0
  652. package/runtime/gatewaysdk/environment/schema/connectors/notion/api/handlers.py +1330 -0
  653. package/runtime/gatewaysdk/environment/schema/connectors/notion/connector.toml +386 -0
  654. package/runtime/gatewaysdk/environment/schema/connectors/notion/handlers.py +54 -0
  655. package/runtime/gatewaysdk/environment/schema/connectors/notion/scenarios/default/scenario.toml +2 -0
  656. package/runtime/gatewaysdk/environment/schema/connectors/notion/scenarios/default/seed/blocks.json +4197 -0
  657. package/runtime/gatewaysdk/environment/schema/connectors/notion/scenarios/default/seed/calendar_events.json +18 -0
  658. package/runtime/gatewaysdk/environment/schema/connectors/notion/scenarios/default/seed/collection_views.json +175 -0
  659. package/runtime/gatewaysdk/environment/schema/connectors/notion/scenarios/default/seed/comments.json +109 -0
  660. package/runtime/gatewaysdk/environment/schema/connectors/notion/scenarios/default/seed/databases.json +417 -0
  661. package/runtime/gatewaysdk/environment/schema/connectors/notion/scenarios/default/seed/favorites.json +3 -0
  662. package/runtime/gatewaysdk/environment/schema/connectors/notion/scenarios/default/seed/notifications.json +49 -0
  663. package/runtime/gatewaysdk/environment/schema/connectors/notion/scenarios/default/seed/pages.json +3758 -0
  664. package/runtime/gatewaysdk/environment/schema/connectors/notion/scenarios/default/seed/spaces.json +28 -0
  665. package/runtime/gatewaysdk/environment/schema/connectors/notion/scenarios/default/seed/teamspaces.json +3 -0
  666. package/runtime/gatewaysdk/environment/schema/connectors/notion/scenarios/default/seed/users.json +92 -0
  667. package/runtime/gatewaysdk/environment/schema/connectors/notion/tests/01-reads.json +165 -0
  668. package/runtime/gatewaysdk/environment/schema/connectors/notion/ui/static/assets/index-DQ36W7RG.css +1 -0
  669. package/runtime/gatewaysdk/environment/schema/connectors/notion/ui/static/assets/index-DythuuUy.js +67 -0
  670. package/runtime/gatewaysdk/environment/schema/connectors/notion/ui/static/avatars/eeee0000000000000000000000000002.svg +1 -0
  671. package/runtime/gatewaysdk/environment/schema/connectors/notion/ui/static/avatars/eeee0000000000000000000000000003.svg +1 -0
  672. package/runtime/gatewaysdk/environment/schema/connectors/notion/ui/static/avatars/eeee0000000000000000000000000004.svg +1 -0
  673. package/runtime/gatewaysdk/environment/schema/connectors/notion/ui/static/avatars/eeee0000000000000000000000000005.svg +1 -0
  674. package/runtime/gatewaysdk/environment/schema/connectors/notion/ui/static/avatars/eeee0000000000000000000000000006.svg +1 -0
  675. package/runtime/gatewaysdk/environment/schema/connectors/notion/ui/static/avatars/eeee0000000000000000000000000007.svg +1 -0
  676. package/runtime/gatewaysdk/environment/schema/connectors/notion/ui/static/avatars/eeee0000000000000000000000000008.svg +1 -0
  677. package/runtime/gatewaysdk/environment/schema/connectors/notion/ui/static/covers/dusk-harbor.png +0 -0
  678. package/runtime/gatewaysdk/environment/schema/connectors/notion/ui/static/covers/ember-coast.png +0 -0
  679. package/runtime/gatewaysdk/environment/schema/connectors/notion/ui/static/covers/green-ridge.png +0 -0
  680. package/runtime/gatewaysdk/environment/schema/connectors/notion/ui/static/emoji/1f30a.svg +1 -0
  681. package/runtime/gatewaysdk/environment/schema/connectors/notion/ui/static/emoji/1f331.svg +1 -0
  682. package/runtime/gatewaysdk/environment/schema/connectors/notion/ui/static/emoji/1f373.svg +1 -0
  683. package/runtime/gatewaysdk/environment/schema/connectors/notion/ui/static/emoji/1f3a7.svg +1 -0
  684. package/runtime/gatewaysdk/environment/schema/connectors/notion/ui/static/emoji/1f3a8.svg +1 -0
  685. package/runtime/gatewaysdk/environment/schema/connectors/notion/ui/static/emoji/1f3ac.svg +1 -0
  686. package/runtime/gatewaysdk/environment/schema/connectors/notion/ui/static/emoji/1f3af.svg +1 -0
  687. package/runtime/gatewaysdk/environment/schema/connectors/notion/ui/static/emoji/1f3c4.svg +1 -0
  688. package/runtime/gatewaysdk/environment/schema/connectors/notion/ui/static/emoji/1f3d6.svg +1 -0
  689. package/runtime/gatewaysdk/environment/schema/connectors/notion/ui/static/emoji/1f3e0.svg +1 -0
  690. package/runtime/gatewaysdk/environment/schema/connectors/notion/ui/static/emoji/1f44b.svg +1 -0
  691. package/runtime/gatewaysdk/environment/schema/connectors/notion/ui/static/emoji/1f4a1.svg +1 -0
  692. package/runtime/gatewaysdk/environment/schema/connectors/notion/ui/static/emoji/1f4b0.svg +1 -0
  693. package/runtime/gatewaysdk/environment/schema/connectors/notion/ui/static/emoji/1f4bc.svg +1 -0
  694. package/runtime/gatewaysdk/environment/schema/connectors/notion/ui/static/emoji/1f4c5.svg +1 -0
  695. package/runtime/gatewaysdk/environment/schema/connectors/notion/ui/static/emoji/1f4c8.svg +1 -0
  696. package/runtime/gatewaysdk/environment/schema/connectors/notion/ui/static/emoji/1f4cb.svg +1 -0
  697. package/runtime/gatewaysdk/environment/schema/connectors/notion/ui/static/emoji/1f4ce.svg +1 -0
  698. package/runtime/gatewaysdk/environment/schema/connectors/notion/ui/static/emoji/1f4d1.svg +1 -0
  699. package/runtime/gatewaysdk/environment/schema/connectors/notion/ui/static/emoji/1f4d3.svg +1 -0
  700. package/runtime/gatewaysdk/environment/schema/connectors/notion/ui/static/emoji/1f4d6.svg +1 -0
  701. package/runtime/gatewaysdk/environment/schema/connectors/notion/ui/static/emoji/1f4da.svg +1 -0
  702. package/runtime/gatewaysdk/environment/schema/connectors/notion/ui/static/emoji/1f4dd.svg +1 -0
  703. package/runtime/gatewaysdk/environment/schema/connectors/notion/ui/static/emoji/1f4ec.svg +1 -0
  704. package/runtime/gatewaysdk/environment/schema/connectors/notion/ui/static/emoji/1f4f7.svg +1 -0
  705. package/runtime/gatewaysdk/environment/schema/connectors/notion/ui/static/emoji/1f527.svg +1 -0
  706. package/runtime/gatewaysdk/environment/schema/connectors/notion/ui/static/emoji/1f55b.svg +1 -0
  707. package/runtime/gatewaysdk/environment/schema/connectors/notion/ui/static/emoji/1f5c2.svg +1 -0
  708. package/runtime/gatewaysdk/environment/schema/connectors/notion/ui/static/emoji/1f5d3.svg +1 -0
  709. package/runtime/gatewaysdk/environment/schema/connectors/notion/ui/static/emoji/1f680.svg +1 -0
  710. package/runtime/gatewaysdk/environment/schema/connectors/notion/ui/static/emoji/1f6a2.svg +1 -0
  711. package/runtime/gatewaysdk/environment/schema/connectors/notion/ui/static/emoji/1f9ca.svg +1 -0
  712. package/runtime/gatewaysdk/environment/schema/connectors/notion/ui/static/emoji/1f9e0.svg +1 -0
  713. package/runtime/gatewaysdk/environment/schema/connectors/notion/ui/static/emoji/1f9ea.svg +1 -0
  714. package/runtime/gatewaysdk/environment/schema/connectors/notion/ui/static/emoji/1f9ed.svg +1 -0
  715. package/runtime/gatewaysdk/environment/schema/connectors/notion/ui/static/emoji/1f9f0.svg +1 -0
  716. package/runtime/gatewaysdk/environment/schema/connectors/notion/ui/static/emoji/1fab6.svg +1 -0
  717. package/runtime/gatewaysdk/environment/schema/connectors/notion/ui/static/emoji/2600.svg +1 -0
  718. package/runtime/gatewaysdk/environment/schema/connectors/notion/ui/static/emoji/2693.svg +1 -0
  719. package/runtime/gatewaysdk/environment/schema/connectors/notion/ui/static/emoji/2705.svg +1 -0
  720. package/runtime/gatewaysdk/environment/schema/connectors/notion/ui/static/emoji/2708.svg +1 -0
  721. package/runtime/gatewaysdk/environment/schema/connectors/notion/ui/static/emoji/270f.svg +1 -0
  722. package/runtime/gatewaysdk/environment/schema/connectors/notion/ui/static/emoji/2b50.svg +1 -0
  723. package/runtime/gatewaysdk/environment/schema/connectors/notion/ui/static/favicon.svg +1 -0
  724. package/runtime/gatewaysdk/environment/schema/connectors/notion/ui/static/fonts/SourceSerif4-latin.woff2 +0 -0
  725. package/runtime/gatewaysdk/environment/schema/connectors/notion/ui/static/index.html +31 -0
  726. package/runtime/gatewaysdk/environment/schema/connectors/notion/ui/static/learn/content-blocks.png +0 -0
  727. package/runtime/gatewaysdk/environment/schema/connectors/notion/ui/static/learn/databases.png +0 -0
  728. package/runtime/gatewaysdk/environment/schema/connectors/notion/ui/static/learn/sharing.png +0 -0
  729. package/runtime/gatewaysdk/environment/schema/connectors/notion/ui/static/learn/style-content.png +0 -0
  730. package/runtime/gatewaysdk/environment/schema/connectors/notion/ui/static/photos/home-icon.png +0 -0
  731. package/runtime/gatewaysdk/environment/schema/connectors/notion/ui/static/photos/viewer.png +0 -0
  732. package/runtime/gatewaysdk/environment/schema/connectors/notion/ui/static/photos/workspace.png +0 -0
  733. package/runtime/gatewaysdk/environment/schema/connectors/notion/world.json +2796 -0
  734. package/runtime/gatewaysdk/environment/schema/connectors/okta/scenarios/default/seed/okta_admin_role_assignments.json +44 -0
  735. package/runtime/gatewaysdk/environment/schema/connectors/okta/scenarios/default/seed/okta_app_assignments.json +40 -0
  736. package/runtime/gatewaysdk/environment/schema/connectors/okta/scenarios/default/seed/okta_app_group_assignments.json +59 -0
  737. package/runtime/gatewaysdk/environment/schema/connectors/okta/scenarios/default/seed/okta_applications.json +265 -0
  738. package/runtime/gatewaysdk/environment/schema/connectors/okta/scenarios/default/seed/okta_console_dashboards.json +91 -0
  739. package/runtime/gatewaysdk/environment/schema/connectors/okta/scenarios/default/seed/okta_device_users.json +32 -0
  740. package/runtime/gatewaysdk/environment/schema/connectors/okta/scenarios/default/seed/okta_devices.json +89 -0
  741. package/runtime/gatewaysdk/environment/schema/connectors/okta/scenarios/default/seed/okta_group_memberships.json +156 -0
  742. package/runtime/gatewaysdk/environment/schema/connectors/okta/scenarios/default/seed/okta_groups.json +100 -0
  743. package/runtime/gatewaysdk/environment/schema/connectors/okta/scenarios/default/seed/okta_orgs.json +20 -0
  744. package/runtime/gatewaysdk/environment/schema/connectors/okta/scenarios/default/seed/okta_policies.json +84 -0
  745. package/runtime/gatewaysdk/environment/schema/connectors/okta/scenarios/default/seed/okta_system_log_events.json +9656 -0
  746. package/runtime/gatewaysdk/environment/schema/connectors/okta/scenarios/default/seed/okta_users.json +744 -0
  747. package/runtime/gatewaysdk/environment/schema/connectors/outlook/api/handlers.py +624 -0
  748. package/runtime/gatewaysdk/environment/schema/connectors/outlook/connector.toml +381 -0
  749. package/runtime/gatewaysdk/environment/schema/connectors/outlook/handlers.py +54 -0
  750. package/runtime/gatewaysdk/environment/schema/connectors/outlook/provenance.json +408 -0
  751. package/runtime/gatewaysdk/environment/schema/connectors/outlook/scenarios/default/instruction.md +22 -0
  752. package/runtime/gatewaysdk/environment/schema/connectors/outlook/scenarios/default/scenario.toml +2 -0
  753. package/runtime/gatewaysdk/environment/schema/connectors/outlook/scenarios/default/seed/outlook_attachments.json +44 -0
  754. package/runtime/gatewaysdk/environment/schema/connectors/outlook/scenarios/default/seed/outlook_calendars.json +52 -0
  755. package/runtime/gatewaysdk/environment/schema/connectors/outlook/scenarios/default/seed/outlook_contacts.json +326 -0
  756. package/runtime/gatewaysdk/environment/schema/connectors/outlook/scenarios/default/seed/outlook_events.json +3050 -0
  757. package/runtime/gatewaysdk/environment/schema/connectors/outlook/scenarios/default/seed/outlook_mail_folders.json +84 -0
  758. package/runtime/gatewaysdk/environment/schema/connectors/outlook/scenarios/default/seed/outlook_mailbox_settings.json +35 -0
  759. package/runtime/gatewaysdk/environment/schema/connectors/outlook/scenarios/default/seed/outlook_mailboxes.json +14 -0
  760. package/runtime/gatewaysdk/environment/schema/connectors/outlook/scenarios/default/seed/outlook_messages.json +1400 -0
  761. package/runtime/gatewaysdk/environment/schema/connectors/outlook/scenarios/default/seed/outlook_system_senders.json +44 -0
  762. package/runtime/gatewaysdk/environment/schema/connectors/outlook/scenarios/default/seed/outlook_users.json +256 -0
  763. package/runtime/gatewaysdk/environment/schema/connectors/outlook/tests/routes.json +333 -0
  764. package/runtime/gatewaysdk/environment/schema/connectors/outlook/ui/static/assets/index-DRVA5ahH.js +67 -0
  765. package/runtime/gatewaysdk/environment/schema/connectors/outlook/ui/static/assets/index-kOnvVBhA.css +1 -0
  766. package/runtime/gatewaysdk/environment/schema/connectors/outlook/ui/static/fonts/FluentSystemIcons-Filled.woff2 +0 -0
  767. package/runtime/gatewaysdk/environment/schema/connectors/outlook/ui/static/fonts/FluentSystemIcons-Regular.woff2 +0 -0
  768. package/runtime/gatewaysdk/environment/schema/connectors/outlook/ui/static/fonts/FluentSystemIcons-Resizable.woff2 +0 -0
  769. package/runtime/gatewaysdk/environment/schema/connectors/outlook/ui/static/fonts/controlIcons.woff +0 -0
  770. package/runtime/gatewaysdk/environment/schema/connectors/outlook/ui/static/fonts/segoeui-bold.woff2 +0 -0
  771. package/runtime/gatewaysdk/environment/schema/connectors/outlook/ui/static/fonts/segoeui-light.woff2 +0 -0
  772. package/runtime/gatewaysdk/environment/schema/connectors/outlook/ui/static/fonts/segoeui-regular.woff2 +0 -0
  773. package/runtime/gatewaysdk/environment/schema/connectors/outlook/ui/static/fonts/segoeui-semibold.woff2 +0 -0
  774. package/runtime/gatewaysdk/environment/schema/connectors/outlook/ui/static/fonts/segoeui-semilight.woff2 +0 -0
  775. package/runtime/gatewaysdk/environment/schema/connectors/outlook/ui/static/img/bookings.svg +1 -0
  776. package/runtime/gatewaysdk/environment/schema/connectors/outlook/ui/static/img/calendar.svg +35 -0
  777. package/runtime/gatewaysdk/environment/schema/connectors/outlook/ui/static/img/copilot.png +0 -0
  778. package/runtime/gatewaysdk/environment/schema/connectors/outlook/ui/static/img/excel.svg +1 -0
  779. package/runtime/gatewaysdk/environment/schema/connectors/outlook/ui/static/img/mail.svg +32 -0
  780. package/runtime/gatewaysdk/environment/schema/connectors/outlook/ui/static/img/my-day.svg +1 -0
  781. package/runtime/gatewaysdk/environment/schema/connectors/outlook/ui/static/img/newsletters.svg +37 -0
  782. package/runtime/gatewaysdk/environment/schema/connectors/outlook/ui/static/img/no-mail-selected-dark.svg +1 -0
  783. package/runtime/gatewaysdk/environment/schema/connectors/outlook/ui/static/img/no-mail-selected.svg +1 -0
  784. package/runtime/gatewaysdk/environment/schema/connectors/outlook/ui/static/img/onedrive.svg +1 -0
  785. package/runtime/gatewaysdk/environment/schema/connectors/outlook/ui/static/img/onenote.svg +1 -0
  786. package/runtime/gatewaysdk/environment/schema/connectors/outlook/ui/static/img/org-explorer.png +0 -0
  787. package/runtime/gatewaysdk/environment/schema/connectors/outlook/ui/static/img/outlook.svg +1 -0
  788. package/runtime/gatewaysdk/environment/schema/connectors/outlook/ui/static/img/people.svg +34 -0
  789. package/runtime/gatewaysdk/environment/schema/connectors/outlook/ui/static/img/powerpoint.svg +1 -0
  790. package/runtime/gatewaysdk/environment/schema/connectors/outlook/ui/static/img/ribbon-layout.svg +1 -0
  791. package/runtime/gatewaysdk/environment/schema/connectors/outlook/ui/static/img/sharepoint.svg +1 -0
  792. package/runtime/gatewaysdk/environment/schema/connectors/outlook/ui/static/img/teams-chat.svg +1 -0
  793. package/runtime/gatewaysdk/environment/schema/connectors/outlook/ui/static/img/teams.svg +1 -0
  794. package/runtime/gatewaysdk/environment/schema/connectors/outlook/ui/static/img/to-do.png +0 -0
  795. package/runtime/gatewaysdk/environment/schema/connectors/outlook/ui/static/img/viva.svg +1 -0
  796. package/runtime/gatewaysdk/environment/schema/connectors/outlook/ui/static/img/word.svg +1 -0
  797. package/runtime/gatewaysdk/environment/schema/connectors/outlook/ui/static/index.html +34 -0
  798. package/runtime/gatewaysdk/environment/schema/connectors/outlook/world.json +686 -0
  799. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/api/handlers.py +447 -0
  800. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/connector.toml +3478 -0
  801. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/handlers.py +885 -0
  802. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/parity.json +46 -0
  803. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/provenance.json +4286 -0
  804. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/instruction.md +8 -0
  805. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/scenario.toml +2 -0
  806. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_account_contact_relations.json +20 -0
  807. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_account_contact_roles.json +16 -0
  808. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_account_partners.json +18 -0
  809. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_account_team_members.json +16 -0
  810. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_accounts.json +38 -0
  811. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_assets.json +35 -0
  812. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_attachments.json +16 -0
  813. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_business_hours.json +16 -0
  814. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_campaign_member_statuses.json +16 -0
  815. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_campaign_members.json +38 -0
  816. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_campaigns.json +35 -0
  817. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_case_comments.json +14 -0
  818. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_case_histories.json +18 -0
  819. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_case_milestones.json +18 -0
  820. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_case_statuses.json +16 -0
  821. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_case_team_members.json +14 -0
  822. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_case_team_roles.json +12 -0
  823. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_cases.json +42 -0
  824. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_collaboration_group_members.json +16 -0
  825. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_collaboration_groups.json +16 -0
  826. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_contact_point_addresses.json +14 -0
  827. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_contact_point_emails.json +14 -0
  828. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_contact_point_phones.json +14 -0
  829. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_contacts.json +34 -0
  830. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_content_document_links.json +14 -0
  831. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_content_documents.json +18 -0
  832. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_content_folders.json +13 -0
  833. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_content_notes.json +12 -0
  834. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_content_versions.json +24 -0
  835. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_content_workspaces.json +16 -0
  836. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_contract_contact_roles.json +16 -0
  837. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_contract_line_items.json +32 -0
  838. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_contracts.json +40 -0
  839. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_dashboards.json +20 -0
  840. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_documents.json +22 -0
  841. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_email_message_relations.json +14 -0
  842. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_email_messages.json +21 -0
  843. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_email_templates.json +24 -0
  844. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_entitlements.json +32 -0
  845. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_events.json +26 -0
  846. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_feed_comments.json +19 -0
  847. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_feed_items.json +24 -0
  848. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_fiscal_year_settings.json +20 -0
  849. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_folders.json +18 -0
  850. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_group_members.json +12 -0
  851. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_groups.json +20 -0
  852. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_holidays.json +16 -0
  853. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_individuals.json +21 -0
  854. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_lead_statuses.json +14 -0
  855. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_leads.json +45 -0
  856. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_list_views.json +16 -0
  857. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_login_histories.json +18 -0
  858. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_milestone_types.json +14 -0
  859. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_notes.json +16 -0
  860. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_object_territory_associations.json +14 -0
  861. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_opportunities.json +48 -0
  862. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_opportunity_competitors.json +12 -0
  863. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_opportunity_contact_roles.json +16 -0
  864. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_opportunity_field_histories.json +18 -0
  865. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_opportunity_histories.json +20 -0
  866. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_opportunity_line_items.json +32 -0
  867. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_opportunity_partners.json +16 -0
  868. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_opportunity_stages.json +22 -0
  869. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_opportunity_team_members.json +18 -0
  870. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_order_items.json +33 -0
  871. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_orders.json +44 -0
  872. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_organizations.json +18 -0
  873. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_partners.json +18 -0
  874. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_periods.json +18 -0
  875. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_permission_set_assignments.json +16 -0
  876. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_permission_sets.json +18 -0
  877. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_pricebook_entries.json +22 -0
  878. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_pricebooks.json +16 -0
  879. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_products.json +20 -0
  880. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_profiles.json +14 -0
  881. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_queue_sobjects.json +12 -0
  882. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_quote_line_items.json +43 -0
  883. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_quotes.json +40 -0
  884. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_record_actions.json +16 -0
  885. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_record_types.json +18 -0
  886. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_reports.json +18 -0
  887. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_service_contracts.json +32 -0
  888. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_sla_processes.json +18 -0
  889. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_solutions.json +18 -0
  890. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_task_priorities.json +14 -0
  891. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_task_relations.json +14 -0
  892. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_task_statuses.json +16 -0
  893. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_tasks.json +26 -0
  894. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_territories.json +20 -0
  895. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_territory_models.json +16 -0
  896. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_territory_types.json +18 -0
  897. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_topic_assignments.json +12 -0
  898. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_topics.json +14 -0
  899. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_user_roles.json +16 -0
  900. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_user_territory_associations.json +16 -0
  901. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_users.json +57 -0
  902. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_web_links.json +26 -0
  903. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_work_order_line_items.json +42 -0
  904. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scenarios/default/seed/sf_work_orders.json +46 -0
  905. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/scope.toml +694 -0
  906. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/tests/tools.json +69 -0
  907. package/runtime/gatewaysdk/environment/schema/connectors/salesforce/world.json +21263 -0
  908. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/api/handlers.py +630 -0
  909. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/connector.toml +266 -0
  910. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/handlers.py +3 -0
  911. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/provenance.json +245 -0
  912. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/scenarios/default/instruction.md +15 -0
  913. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/scenarios/default/scenario.toml +1 -0
  914. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/scenarios/default/seed/10-snow_users.json +268 -0
  915. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/scenarios/default/seed/11-snow_user_groups.json +40 -0
  916. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/scenarios/default/seed/20-snow_configuration_items.json +684 -0
  917. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/scenarios/default/seed/30-snow_catalog_categories.json +52 -0
  918. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/scenarios/default/seed/31-snow_catalog_items.json +334 -0
  919. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/scenarios/default/seed/40-snow_incidents.json +3086 -0
  920. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/scenarios/default/seed/41-snow_incident_tasks.json +54 -0
  921. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/scenarios/default/seed/42-snow_task_slas.json +64 -0
  922. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/scenarios/default/seed/43-snow_problems.json +148 -0
  923. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/scenarios/default/seed/44-snow_change_requests.json +364 -0
  924. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/scenarios/default/seed/45-snow_knowledge_articles.json +214 -0
  925. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/scenarios/default/seed/46-snow_journal_entries.json +1612 -0
  926. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/scenarios/default/seed/60-snow_ui_current_users.json +19 -0
  927. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/scenarios/default/seed/61-snow_ui_navigation_applications.json +187 -0
  928. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/scenarios/default/seed/62-snow_ui_home_widgets.json +91 -0
  929. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/scenarios/default/seed/63-snow_ui_notifications.json +3 -0
  930. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/scenarios/default/seed/64-snow_ui_employee_center_pages.json +74 -0
  931. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/scenarios/default/seed/65-snow_ui_list_layouts.json +54 -0
  932. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/scenarios/default/seed/66-snow_ui_search_facets.json +29 -0
  933. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/scenarios/default/seed/67-snow_ui_activity_entries.json +1076 -0
  934. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/scenarios/default/seed/68-snow_ui_instances.json +9 -0
  935. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/scope.toml +166 -0
  936. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/tests/routes.json +272 -0
  937. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/assets/index-5QHcQLCI.css +1 -0
  938. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/assets/index-BzeVnzFt.js +67 -0
  939. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/fonts/cabin-400-700-italic.woff2 +0 -0
  940. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/fonts/cabin-400-700.woff2 +0 -0
  941. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/fonts/font-0-lato-v17-latin-ext_latin-100.woff2 +0 -0
  942. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/fonts/font-1-lato-v17-latin-ext_latin-100.woff +0 -0
  943. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/fonts/font-10-lato-v17-latin-ext_latin-italic.woff2 +0 -0
  944. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/fonts/font-11-lato-v17-latin-ext_latin-italic.woff +0 -0
  945. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/fonts/font-12-lato-v17-latin-ext_latin-700.woff2 +0 -0
  946. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/fonts/font-13-lato-v17-latin-ext_latin-700.woff +0 -0
  947. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/fonts/font-14-lato-v17-latin-ext_latin-700italic.woff2 +0 -0
  948. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/fonts/font-15-lato-v17-latin-ext_latin-700italic.woff +0 -0
  949. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/fonts/font-16-source-sans-pro-v11-latin-300.woff2 +0 -0
  950. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/fonts/font-17-source-sans-pro-v11-latin-300.woff +0 -0
  951. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/fonts/font-18-source-sans-pro-v11-latin-regular.woff2 +0 -0
  952. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/fonts/font-19-source-sans-pro-v11-latin-regular.woff +0 -0
  953. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/fonts/font-2-lato-v17-latin-ext_latin-100italic.woff2 +0 -0
  954. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/fonts/font-20-source-sans-pro-v11-latin-600.woff2 +0 -0
  955. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/fonts/font-21-source-sans-pro-v11-latin-600.woff +0 -0
  956. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/fonts/font-22-source-sans-pro-v11-latin-700.woff2 +0 -0
  957. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/fonts/font-23-source-sans-pro-v11-latin-700.woff +0 -0
  958. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/fonts/font-3-lato-v17-latin-ext_latin-100italic.woff +0 -0
  959. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/fonts/font-4-lato-v17-latin-ext_latin-300.woff2 +0 -0
  960. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/fonts/font-5-lato-v17-latin-ext_latin-300.woff +0 -0
  961. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/fonts/font-6-lato-v17-latin-ext_latin-300italic.woff2 +0 -0
  962. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/fonts/font-7-lato-v17-latin-ext_latin-300italic.woff +0 -0
  963. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/fonts/font-8-lato-v17-latin-ext_latin-regular.woff2 +0 -0
  964. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/fonts/font-9-lato-v17-latin-ext_latin-regular.woff +0 -0
  965. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/fonts/index.json +122 -0
  966. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/fonts/lato-300.woff2 +0 -0
  967. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/fonts/lato-600-italic.woff2 +0 -0
  968. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/fonts/lato-600.woff2 +0 -0
  969. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/fonts/lato-bold-italic.woff2 +0 -0
  970. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/fonts/lato-bold.woff2 +0 -0
  971. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/fonts/lato-normal-italic.woff2 +0 -0
  972. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/fonts/lato-normal.woff2 +0 -0
  973. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/icons/appsee-outline.svg +1 -0
  974. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/icons/arrow-up-outline.svg +1 -0
  975. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/icons/available.svg +1 -0
  976. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/icons/bell-outline.svg +1 -0
  977. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/icons/caret-down-fill.svg +1 -0
  978. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/icons/check-fill.svg +1 -0
  979. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/icons/chevron-right-outline.svg +1 -0
  980. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/icons/circle-close-outline.svg +1 -0
  981. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/icons/circle-info-outline.svg +1 -0
  982. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/icons/circle-question-outline.svg +1 -0
  983. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/icons/circleinfooutline.svg +1 -0
  984. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/icons/ellipsis-v-outline.svg +1 -0
  985. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/icons/eye-outline.svg +1 -0
  986. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/icons/fa-bell-fill.svg +1 -0
  987. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/icons/fa-caret-down-fill.svg +1 -0
  988. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/icons/fa-check-square.svg +1 -0
  989. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/icons/fa-chevron-right.svg +1 -0
  990. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/icons/fa-clock-outline.svg +1 -0
  991. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/icons/fa-comment-chat.svg +1 -0
  992. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/icons/fa-external-link.svg +1 -0
  993. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/icons/fa-facebook.svg +1 -0
  994. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/icons/fa-heart-fill.svg +1 -0
  995. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/icons/fa-heart-outline.svg +1 -0
  996. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/icons/fa-home-fill-teal.svg +1 -0
  997. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/icons/fa-home-fill.svg +1 -0
  998. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/icons/fa-linkedin.svg +1 -0
  999. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/icons/fa-list-alt-fill.svg +1 -0
  1000. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/icons/fa-pencil-square.svg +1 -0
  1001. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/icons/fa-question-circle-fill.svg +1 -0
  1002. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/icons/fa-times.svg +1 -0
  1003. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/icons/fa-twitter.svg +1 -0
  1004. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/icons/filter-outline.svg +1 -0
  1005. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/icons/gear-outline.svg +1 -0
  1006. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/icons/globe-outline.svg +1 -0
  1007. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/icons/home-outline.svg +1 -0
  1008. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/icons/icon-2.svg +17 -0
  1009. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/icons/icon-3.svg +1 -0
  1010. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/icons/icon-4.svg +1 -0
  1011. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/icons/icon.svg +45 -0
  1012. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/icons/keyboard-outline.svg +1 -0
  1013. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/icons/link-icon-associated-to-view-all-adoption-blueprints.svg +1 -0
  1014. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/icons/link-icon-associated-to-view-all-applications.svg +1 -0
  1015. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/icons/list-fill.svg +1 -0
  1016. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/icons/loading-2.svg +1 -0
  1017. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/icons/loading.svg +1 -0
  1018. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/icons/magnifying-glass-outline.svg +1 -0
  1019. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/icons/ongoing-outline.svg +1 -0
  1020. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/icons/open-link-right-fill.svg +1 -0
  1021. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/icons/open-link-right-outline.svg +1 -0
  1022. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/icons/pencil-page-outline.svg +1 -0
  1023. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/icons/plus-fill.svg +1 -0
  1024. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/icons/serverbox-outline.svg +1 -0
  1025. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/icons/servicenow-wordmark.svg +20 -0
  1026. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/icons/signal-live-outline.svg +1 -0
  1027. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/icons/square-arrow-left-outline.svg +1 -0
  1028. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/icons/star-outline.svg +1 -0
  1029. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/icons/sync-outline.svg +1 -0
  1030. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/icons/task-slas-related-list.svg +24 -0
  1031. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/icons/thumbtack-outline.svg +1 -0
  1032. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/icons/trending-downward.svg +1 -0
  1033. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/icons/trending-neutral.svg +1 -0
  1034. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/icons/unpinned-all-menu.svg +1 -0
  1035. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/icons/unpinned-favorites-menu.svg +1 -0
  1036. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/icons/unpinned-history-menu.svg +1 -0
  1037. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/icons/user-outline.svg +1 -0
  1038. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/img/adoption-blueprints.svg +40 -0
  1039. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/img/avatar-admin.jpg +0 -0
  1040. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/img/now-assist-admin.svg +17 -0
  1041. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/img/quick-link-desk.jpg +0 -0
  1042. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/img/quick-link-password.jpg +0 -0
  1043. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/img/quick-link-status.jpg +0 -0
  1044. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/img/topic-accessories.svg +1 -0
  1045. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/img/topic-computers.svg +1 -0
  1046. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/img/topic-developer.svg +1 -0
  1047. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/img/topic-email.svg +1 -0
  1048. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/img/topic-phone.svg +1 -0
  1049. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/img/topic-software-catalog.svg +1 -0
  1050. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/img/topic-software.svg +1 -0
  1051. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/img/topic-technology.svg +1 -0
  1052. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/ui/static/index.html +36 -0
  1053. package/runtime/gatewaysdk/environment/schema/connectors/servicenow/world.json +2004 -0
  1054. package/runtime/gatewaysdk/environment/schema/connectors/slack/MODEL.md +264 -0
  1055. package/runtime/gatewaysdk/environment/schema/connectors/slack/api/handlers.py +1880 -0
  1056. package/runtime/gatewaysdk/environment/schema/connectors/slack/capabilities.json +1056 -0
  1057. package/runtime/gatewaysdk/environment/schema/connectors/slack/connector.toml +892 -0
  1058. package/runtime/gatewaysdk/environment/schema/connectors/slack/handlers.py +762 -0
  1059. package/runtime/gatewaysdk/environment/schema/connectors/slack/parity.json +65 -0
  1060. package/runtime/gatewaysdk/environment/schema/connectors/slack/provenance.json +349 -0
  1061. package/runtime/gatewaysdk/environment/schema/connectors/slack/scenarios/default/scenario.toml +1 -0
  1062. package/runtime/gatewaysdk/environment/schema/connectors/slack/scenarios/default/seed/slack_apps.json +22 -0
  1063. package/runtime/gatewaysdk/environment/schema/connectors/slack/scenarios/default/seed/slack_bookmarks.json +22 -0
  1064. package/runtime/gatewaysdk/environment/schema/connectors/slack/scenarios/default/seed/slack_bots.json +19 -0
  1065. package/runtime/gatewaysdk/environment/schema/connectors/slack/scenarios/default/seed/slack_channels.json +206 -0
  1066. package/runtime/gatewaysdk/environment/schema/connectors/slack/scenarios/default/seed/slack_conversation_states.json +50 -0
  1067. package/runtime/gatewaysdk/environment/schema/connectors/slack/scenarios/default/seed/slack_emojis.json +19 -0
  1068. package/runtime/gatewaysdk/environment/schema/connectors/slack/scenarios/default/seed/slack_ephemeral_message_files.json +12 -0
  1069. package/runtime/gatewaysdk/environment/schema/connectors/slack/scenarios/default/seed/slack_ephemeral_message_threads.json +11 -0
  1070. package/runtime/gatewaysdk/environment/schema/connectors/slack/scenarios/default/seed/slack_ephemeral_messages.json +16 -0
  1071. package/runtime/gatewaysdk/environment/schema/connectors/slack/scenarios/default/seed/slack_file_channel_observations.json +16 -0
  1072. package/runtime/gatewaysdk/environment/schema/connectors/slack/scenarios/default/seed/slack_file_reaction_summaries.json +10 -0
  1073. package/runtime/gatewaysdk/environment/schema/connectors/slack/scenarios/default/seed/slack_file_reaction_users.json +10 -0
  1074. package/runtime/gatewaysdk/environment/schema/connectors/slack/scenarios/default/seed/slack_file_shares.json +29 -0
  1075. package/runtime/gatewaysdk/environment/schema/connectors/slack/scenarios/default/seed/slack_file_user_states.json +10 -0
  1076. package/runtime/gatewaysdk/environment/schema/connectors/slack/scenarios/default/seed/slack_files.json +64 -0
  1077. package/runtime/gatewaysdk/environment/schema/connectors/slack/scenarios/default/seed/slack_memberships.json +79 -0
  1078. package/runtime/gatewaysdk/environment/schema/connectors/slack/scenarios/default/seed/slack_message_files.json +18 -0
  1079. package/runtime/gatewaysdk/environment/schema/connectors/slack/scenarios/default/seed/slack_message_threads.json +10 -0
  1080. package/runtime/gatewaysdk/environment/schema/connectors/slack/scenarios/default/seed/slack_message_user_states.json +14 -0
  1081. package/runtime/gatewaysdk/environment/schema/connectors/slack/scenarios/default/seed/slack_messages.json +127 -0
  1082. package/runtime/gatewaysdk/environment/schema/connectors/slack/scenarios/default/seed/slack_pins.json +11 -0
  1083. package/runtime/gatewaysdk/environment/schema/connectors/slack/scenarios/default/seed/slack_presence.json +35 -0
  1084. package/runtime/gatewaysdk/environment/schema/connectors/slack/scenarios/default/seed/slack_reaction_summaries.json +25 -0
  1085. package/runtime/gatewaysdk/environment/schema/connectors/slack/scenarios/default/seed/slack_reaction_users.json +32 -0
  1086. package/runtime/gatewaysdk/environment/schema/connectors/slack/scenarios/default/seed/slack_scheduled_message_threads.json +10 -0
  1087. package/runtime/gatewaysdk/environment/schema/connectors/slack/scenarios/default/seed/slack_scheduled_messages.json +15 -0
  1088. package/runtime/gatewaysdk/environment/schema/connectors/slack/scenarios/default/seed/slack_unavailable_message_files.json +14 -0
  1089. package/runtime/gatewaysdk/environment/schema/connectors/slack/scenarios/default/seed/slack_user_profile_fields.json +28 -0
  1090. package/runtime/gatewaysdk/environment/schema/connectors/slack/scenarios/default/seed/slack_usergroup_channels.json +10 -0
  1091. package/runtime/gatewaysdk/environment/schema/connectors/slack/scenarios/default/seed/slack_usergroup_memberships.json +14 -0
  1092. package/runtime/gatewaysdk/environment/schema/connectors/slack/scenarios/default/seed/slack_usergroups.json +33 -0
  1093. package/runtime/gatewaysdk/environment/schema/connectors/slack/scenarios/default/seed/slack_users.json +228 -0
  1094. package/runtime/gatewaysdk/environment/schema/connectors/slack/scenarios/default/seed/slack_view_state_entries.json +22 -0
  1095. package/runtime/gatewaysdk/environment/schema/connectors/slack/scenarios/default/seed/slack_views.json +53 -0
  1096. package/runtime/gatewaysdk/environment/schema/connectors/slack/scenarios/default/seed/slack_workspaces.json +37 -0
  1097. package/runtime/gatewaysdk/environment/schema/connectors/slack/scope.toml +48 -0
  1098. package/runtime/gatewaysdk/environment/schema/connectors/slack/tests/api.json +177 -0
  1099. package/runtime/gatewaysdk/environment/schema/connectors/slack/tests/test_threads.py +49 -0
  1100. package/runtime/gatewaysdk/environment/schema/connectors/slack/tests/tools.json +92 -0
  1101. package/runtime/gatewaysdk/environment/schema/connectors/slack/ui/static/assets/index-BSqGskph.css +1 -0
  1102. package/runtime/gatewaysdk/environment/schema/connectors/slack/ui/static/assets/index-CKQh1igo.js +81 -0
  1103. package/runtime/gatewaysdk/environment/schema/connectors/slack/ui/static/fonts/README.md +15 -0
  1104. package/runtime/gatewaysdk/environment/schema/connectors/slack/ui/static/fonts/lato-black.woff2 +0 -0
  1105. package/runtime/gatewaysdk/environment/schema/connectors/slack/ui/static/fonts/lato-bold.woff2 +0 -0
  1106. package/runtime/gatewaysdk/environment/schema/connectors/slack/ui/static/fonts/lato-italic-black.woff2 +0 -0
  1107. package/runtime/gatewaysdk/environment/schema/connectors/slack/ui/static/fonts/lato-italic-bold.woff2 +0 -0
  1108. package/runtime/gatewaysdk/environment/schema/connectors/slack/ui/static/fonts/lato-italic-light.woff2 +0 -0
  1109. package/runtime/gatewaysdk/environment/schema/connectors/slack/ui/static/fonts/lato-italic.woff2 +0 -0
  1110. package/runtime/gatewaysdk/environment/schema/connectors/slack/ui/static/fonts/lato-light.woff2 +0 -0
  1111. package/runtime/gatewaysdk/environment/schema/connectors/slack/ui/static/fonts/lato-regular.woff2 +0 -0
  1112. package/runtime/gatewaysdk/environment/schema/connectors/slack/ui/static/fonts/slack-icons-v2.woff2 +0 -0
  1113. package/runtime/gatewaysdk/environment/schema/connectors/slack/ui/static/index.html +35 -0
  1114. package/runtime/gatewaysdk/environment/schema/connectors/slack/vendor-openapi.json +12515 -0
  1115. package/runtime/gatewaysdk/environment/schema/connectors/slack/world.json +5381 -0
  1116. package/runtime/gatewaysdk/environment/schema/connectors/workday/api/handlers.py +175 -0
  1117. package/runtime/gatewaysdk/environment/schema/connectors/workday/connector.toml +610 -0
  1118. package/runtime/gatewaysdk/environment/schema/connectors/workday/handlers.py +75 -0
  1119. package/runtime/gatewaysdk/environment/schema/connectors/workday/parity.json +69 -0
  1120. package/runtime/gatewaysdk/environment/schema/connectors/workday/provenance.json +407 -0
  1121. package/runtime/gatewaysdk/environment/schema/connectors/workday/scenarios/default/instruction.md +10 -0
  1122. package/runtime/gatewaysdk/environment/schema/connectors/workday/scenarios/default/scenario.toml +2 -0
  1123. package/runtime/gatewaysdk/environment/schema/connectors/workday/scenarios/default/seed/workday_compensations.json +219 -0
  1124. package/runtime/gatewaysdk/environment/schema/connectors/workday/scenarios/default/seed/workday_job_profiles.json +76 -0
  1125. package/runtime/gatewaysdk/environment/schema/connectors/workday/scenarios/default/seed/workday_locations.json +142 -0
  1126. package/runtime/gatewaysdk/environment/schema/connectors/workday/scenarios/default/seed/workday_organizations.json +124 -0
  1127. package/runtime/gatewaysdk/environment/schema/connectors/workday/scenarios/default/seed/workday_positions.json +280 -0
  1128. package/runtime/gatewaysdk/environment/schema/connectors/workday/scenarios/default/seed/workday_rest_absence_leaves.json +66 -0
  1129. package/runtime/gatewaysdk/environment/schema/connectors/workday/scenarios/default/seed/workday_rest_business_title_changes.json +44 -0
  1130. package/runtime/gatewaysdk/environment/schema/connectors/workday/scenarios/default/seed/workday_rest_check_in_topics.json +48 -0
  1131. package/runtime/gatewaysdk/environment/schema/connectors/workday/scenarios/default/seed/workday_rest_check_ins.json +46 -0
  1132. package/runtime/gatewaysdk/environment/schema/connectors/workday/scenarios/default/seed/workday_rest_countries.json +28 -0
  1133. package/runtime/gatewaysdk/environment/schema/connectors/workday/scenarios/default/seed/workday_rest_currencies.json +25 -0
  1134. package/runtime/gatewaysdk/environment/schema/connectors/workday/scenarios/default/seed/workday_rest_job_change_reasons.json +28 -0
  1135. package/runtime/gatewaysdk/environment/schema/connectors/workday/scenarios/default/seed/workday_rest_job_families.json +40 -0
  1136. package/runtime/gatewaysdk/environment/schema/connectors/workday/scenarios/default/seed/workday_rest_job_profiles.json +202 -0
  1137. package/runtime/gatewaysdk/environment/schema/connectors/workday/scenarios/default/seed/workday_rest_jobs.json +120 -0
  1138. package/runtime/gatewaysdk/environment/schema/connectors/workday/scenarios/default/seed/workday_rest_organization_types.json +19 -0
  1139. package/runtime/gatewaysdk/environment/schema/connectors/workday/scenarios/default/seed/workday_rest_organizations.json +24 -0
  1140. package/runtime/gatewaysdk/environment/schema/connectors/workday/scenarios/default/seed/workday_rest_persons.json +100 -0
  1141. package/runtime/gatewaysdk/environment/schema/connectors/workday/scenarios/default/seed/workday_rest_scorecard_results.json +57 -0
  1142. package/runtime/gatewaysdk/environment/schema/connectors/workday/scenarios/default/seed/workday_rest_scorecards.json +68 -0
  1143. package/runtime/gatewaysdk/environment/schema/connectors/workday/scenarios/default/seed/workday_rest_supervisory_organizations.json +64 -0
  1144. package/runtime/gatewaysdk/environment/schema/connectors/workday/scenarios/default/seed/workday_rest_time_off_details.json +112 -0
  1145. package/runtime/gatewaysdk/environment/schema/connectors/workday/scenarios/default/seed/workday_rest_time_off_entries.json +91 -0
  1146. package/runtime/gatewaysdk/environment/schema/connectors/workday/scenarios/default/seed/workday_rest_worker_history_events.json +58 -0
  1147. package/runtime/gatewaysdk/environment/schema/connectors/workday/scenarios/default/seed/workday_rest_workers.json +90 -0
  1148. package/runtime/gatewaysdk/environment/schema/connectors/workday/scenarios/default/seed/workday_time_off_requests.json +181 -0
  1149. package/runtime/gatewaysdk/environment/schema/connectors/workday/scenarios/default/seed/workday_workers.json +492 -0
  1150. package/runtime/gatewaysdk/environment/schema/connectors/workday/scope.toml +344 -0
  1151. package/runtime/gatewaysdk/environment/schema/connectors/workday/tests/tools.json +81 -0
  1152. package/runtime/gatewaysdk/environment/schema/connectors/workday/vendor-openapi.json +10646 -0
  1153. package/runtime/gatewaysdk/environment/schema/connectors/workday/world.json +4186 -0
  1154. package/runtime/gatewaysdk/environment/schema/connectors/zendesk/api/handlers.py +1183 -0
  1155. package/runtime/gatewaysdk/environment/schema/connectors/zendesk/connector.toml +645 -0
  1156. package/runtime/gatewaysdk/environment/schema/connectors/zendesk/handlers.py +377 -0
  1157. package/runtime/gatewaysdk/environment/schema/connectors/zendesk/scenarios/default/instruction.md +22 -0
  1158. package/runtime/gatewaysdk/environment/schema/connectors/zendesk/scenarios/default/scenario.toml +3 -0
  1159. package/runtime/gatewaysdk/environment/schema/connectors/zendesk/scenarios/default/seed/zendesk_brands.json +25 -0
  1160. package/runtime/gatewaysdk/environment/schema/connectors/zendesk/scenarios/default/seed/zendesk_group_memberships.json +49 -0
  1161. package/runtime/gatewaysdk/environment/schema/connectors/zendesk/scenarios/default/seed/zendesk_groups.json +37 -0
  1162. package/runtime/gatewaysdk/environment/schema/connectors/zendesk/scenarios/default/seed/zendesk_macros.json +154 -0
  1163. package/runtime/gatewaysdk/environment/schema/connectors/zendesk/scenarios/default/seed/zendesk_organizations.json +65 -0
  1164. package/runtime/gatewaysdk/environment/schema/connectors/zendesk/scenarios/default/seed/zendesk_ticket_audits.json +3328 -0
  1165. package/runtime/gatewaysdk/environment/schema/connectors/zendesk/scenarios/default/seed/zendesk_ticket_comments.json +2642 -0
  1166. package/runtime/gatewaysdk/environment/schema/connectors/zendesk/scenarios/default/seed/zendesk_tickets.json +1439 -0
  1167. package/runtime/gatewaysdk/environment/schema/connectors/zendesk/scenarios/default/seed/zendesk_users.json +624 -0
  1168. package/runtime/gatewaysdk/environment/schema/connectors/zendesk/scenarios/default/seed/zendesk_views.json +510 -0
  1169. package/runtime/gatewaysdk/environment/schema/connectors/zendesk/scenarios/default/seed/zendesk_workspace_tabs.json +10 -0
  1170. package/runtime/gatewaysdk/environment/schema/connectors/zendesk/ui/static/assets/index-JWq7XNO5.css +1 -0
  1171. package/runtime/gatewaysdk/environment/schema/connectors/zendesk/ui/static/assets/index-bn8ezNTi.js +67 -0
  1172. package/runtime/gatewaysdk/environment/schema/connectors/zendesk/ui/static/index.html +22 -0
  1173. package/runtime/gatewaysdk/environment/schema/connectors/zendesk/world.json +1707 -0
  1174. package/runtime/gatewaysdk/environment/schema/data.py +907 -0
  1175. package/runtime/gatewaysdk/environment/schema/dependencies.py +235 -0
  1176. package/runtime/gatewaysdk/environment/schema/extract.py +263 -0
  1177. package/runtime/gatewaysdk/environment/schema/host.py +2571 -0
  1178. package/runtime/gatewaysdk/environment/schema/host_surfaces.py +320 -0
  1179. package/runtime/gatewaysdk/environment/schema/ingest.py +528 -0
  1180. package/runtime/gatewaysdk/environment/schema/local.py +536 -0
  1181. package/runtime/gatewaysdk/environment/schema/mapping.py +944 -0
  1182. package/runtime/gatewaysdk/environment/schema/platform.py +1748 -0
  1183. package/runtime/gatewaysdk/environment/schema/reconcile.py +202 -0
  1184. package/runtime/gatewaysdk/environment/schema/redaction.py +378 -0
  1185. package/runtime/gatewaysdk/environment/schema/scaffold.py +311 -0
  1186. package/runtime/gatewaysdk/environment/schema/skill.py +119 -0
  1187. package/runtime/gatewaysdk/environment/schema/skills/agents/connector-template-author.md +202 -0
  1188. package/runtime/gatewaysdk/environment/schema/skills/benchmarks-getting-started/SKILL.md +391 -0
  1189. package/runtime/gatewaysdk/environment/schema/skills/connector-schema-authoring/CONNECTORS.md +364 -0
  1190. package/runtime/gatewaysdk/environment/schema/skills/connector-schema-authoring/CONVENTIONS.md +100 -0
  1191. package/runtime/gatewaysdk/environment/schema/skills/connector-schema-authoring/SKILL.md +363 -0
  1192. package/runtime/gatewaysdk/environment/schema/skills/world-data-ingestion/ROWS.md +243 -0
  1193. package/runtime/gatewaysdk/environment/schema/skills/world-data-ingestion/SKILL.md +460 -0
  1194. package/runtime/gatewaysdk/environment/schema/skills/worlds-getting-started/SKILL.md +500 -0
  1195. package/runtime/gatewaysdk/environment/schema/skills/worlds-getting-started/references/cli-mcp-map.md +49 -0
  1196. package/runtime/gatewaysdk/environment/schema/skills/worlds-getting-started/references/ui-map.md +18 -0
  1197. package/runtime/gatewaysdk/environment/schema/slack.py +757 -0
  1198. package/runtime/gatewaysdk/environment/schema/snapshot.py +479 -0
  1199. package/runtime/gatewaysdk/environment/schema/store.py +1004 -0
  1200. package/runtime/gatewaysdk/environment/schema/tasks.py +530 -0
  1201. package/runtime/gatewaysdk/environment/schema/tools_world.py +689 -0
  1202. package/runtime/gatewaysdk/environment/schema/transform.py +200 -0
  1203. package/runtime/gatewaysdk/environment/schema/transforms.py +103 -0
  1204. package/runtime/gatewaysdk/environment/schema/ui.py +455 -0
  1205. package/runtime/gatewaysdk/environment/schema/ui_static/app.js +581 -0
  1206. package/runtime/gatewaysdk/environment/schema/ui_static/index.html +72 -0
  1207. package/runtime/gatewaysdk/environment/schema/validation.py +624 -0
  1208. package/runtime/gatewaysdk/environment/schema/worker.py +78 -0
  1209. package/runtime/gatewaysdk/environment/schema/workers.py +500 -0
  1210. package/runtime/gatewaysdk/environment/schema/world_tests.py +530 -0
  1211. package/skills/agents/connector-template-author.md +202 -0
  1212. package/skills/benchmarks-getting-started/SKILL.md +391 -0
  1213. package/skills/connector-schema-authoring/CONNECTORS.md +364 -0
  1214. package/skills/connector-schema-authoring/CONVENTIONS.md +100 -0
  1215. package/skills/connector-schema-authoring/SKILL.md +363 -0
  1216. package/skills/connector-schema-authoring/connector-worlds.md +355 -0
  1217. package/skills/connector-schema-authoring/world-schema.md +620 -0
  1218. package/skills/world-data-ingestion/ROWS.md +243 -0
  1219. package/skills/world-data-ingestion/SKILL.md +460 -0
  1220. package/skills/worlds-getting-started/SKILL.md +500 -0
  1221. package/skills/worlds-getting-started/references/cli-mcp-map.md +49 -0
  1222. package/skills/worlds-getting-started/references/ui-map.md +18 -0
@@ -0,0 +1,2571 @@
1
+ """The World Host: one long-lived process that serves many world sessions.
2
+
3
+ Where the pod engine boots a container per session, the host keeps each
4
+ world VERSION cached once and opens a SESSION as a copy-on-write clone of that
5
+ version's snapshot — a file operation, not a scheduling one. One process
6
+ answers for every session it owns, routed by the ``w-<sid>[-api]`` Host header
7
+ the platform already mints (``worldSurfaces.sessionOrigins``), so there is
8
+ nothing per session in Kubernetes or the load balancer.
9
+
10
+ Two planes on one HTTP server:
11
+
12
+ * the **control plane** (``/__host/*``, behind ``X-Host-Secret``) is the
13
+ platform's half: open, close, reset, seed, state, grade, call. It is
14
+ synchronous — a ``seed`` or ``grade`` completes in the response, not over a
15
+ poll — because the host holds the world in memory.
16
+ * the **data plane** (everything else) is the end user's half: the world's own
17
+ vendor routes, selected by session and checked against that session's token,
18
+ answered in-process by :class:`WorldApp`.
19
+
20
+ Every session carries a lease. Control calls and data-plane requests renew it;
21
+ a session the platform stops touching expires on the host and is unlinked, so
22
+ a missed reconcile tick on the platform is recovered, not leaked.
23
+
24
+ A session's state is one sqlite file, so it is also its own durable form: the
25
+ platform asks the host to **export** a session (a consistent copy, hashed) and
26
+ to **upload** that copy to a presigned URL the platform holds the key for, and
27
+ later **opens** the same session id on any host with ``restore`` naming the
28
+ export, which is how a session survives the host that held it.
29
+
30
+ The host serves schema worlds (a ``gateway-world/1`` tree :class:`WorldState`
31
+ can open) with the ``tools`` and ``api`` surfaces. A world with no code of its
32
+ own is answered in this process. A world that brings an ``api/handlers.py`` is
33
+ placed on a **version worker** (:mod:`workers`): a subprocess of this host, one
34
+ per version, reached over a unix socket, with rlimits and a scrubbed
35
+ environment, running the same :class:`WorldHost` with ``run_handlers`` on. The
36
+ supervisor keeps the registry, the leases and the token gate; the worker keeps
37
+ the world. The **ui** surface is the version's prebuilt static app, served from
38
+ the cache by the supervisor with its ``api_path`` rewritten onto the session's
39
+ api; the **browser** surface is a websocket tunnel to the pool Chromium the
40
+ platform leased for the session (:mod:`host_surfaces`). Custom-server worlds
41
+ stay on pods; this module refuses a version it cannot open rather than
42
+ guessing.
43
+ """
44
+
45
+ from __future__ import annotations
46
+
47
+ import base64
48
+ import fcntl
49
+ import hashlib
50
+ import hmac
51
+ import http.client
52
+ import json
53
+ import os
54
+ import re
55
+ import shutil
56
+ import signal
57
+ import subprocess
58
+ import sys
59
+ import tarfile
60
+ import threading
61
+ import time
62
+ import urllib.error
63
+ import urllib.parse
64
+ import urllib.request
65
+ import uuid
66
+ from collections import Counter
67
+ from collections.abc import Callable, Iterable, Iterator
68
+ from contextlib import contextmanager
69
+ from dataclasses import dataclass, field
70
+ from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
71
+ from pathlib import Path
72
+ from typing import Any, Protocol
73
+
74
+ from .._tar import safe_tar_extract
75
+ from . import snapshot as snapshots
76
+ from .api import (
77
+ SCENARIOS,
78
+ ApiSettings,
79
+ Handler,
80
+ Router,
81
+ WorldApp,
82
+ WorldState,
83
+ load_api_settings,
84
+ load_handlers,
85
+ send_response,
86
+ vendor_credential,
87
+ with_query,
88
+ )
89
+ from .compiler import check_bundle
90
+ from .connector import Spec, load_spec
91
+ from .host_surfaces import (
92
+ HOP_HEADER,
93
+ UiSurface,
94
+ api_target,
95
+ cookie_token,
96
+ load_ui_surface,
97
+ matches,
98
+ mint_live_grant,
99
+ query_token,
100
+ session_cookie,
101
+ static_file,
102
+ tunnel,
103
+ verify_live_grant,
104
+ without_query_token,
105
+ )
106
+ from .tasks import (
107
+ TaskSpec,
108
+ evaluate_assertions,
109
+ parse_task_spec,
110
+ unknown_task_entities,
111
+ unknown_task_tools,
112
+ write_task_dir,
113
+ )
114
+ from .tools_world import (
115
+ DependencyWorld,
116
+ ToolsVersion,
117
+ ToolsWorld,
118
+ ToolsWorldState,
119
+ inline_task,
120
+ is_tools_bundle,
121
+ load_tools_version,
122
+ served_with_dependencies,
123
+ )
124
+ from .validation import ContractError, fail
125
+ from .workers import (
126
+ DEFAULT_WORKER_BUDGET_MB,
127
+ DEFAULT_WORKER_MEMORY_MB,
128
+ Worker,
129
+ WorkerCapacity,
130
+ WorkerGone,
131
+ WorkerPool,
132
+ confined_command,
133
+ verifier_environment,
134
+ )
135
+
136
+ #: The world tree inside an api bundle, or the bundle root for a bare tree.
137
+ BUNDLED_WORLD = "server/world"
138
+ API_BUNDLE = "gateway-api-world.toml"
139
+ VERIFY_TIMEOUT_S = 30.0
140
+ #: How long a session lives with no control call or request renewing it.
141
+ DEFAULT_LEASE_S = 3600.0
142
+ #: How often the host sweeps expired leases.
143
+ LEASE_SWEEP_S = 30.0
144
+ #: How long an owner lookup answer is trusted before asking the platform again.
145
+ #: An owner that does not answer a proxied request is asked about again at once.
146
+ OWNER_CACHE_S = 60.0
147
+ #: How long "no owner" is trusted: long enough that a client hammering a closed
148
+ #: session costs the platform one call at a time, short enough that a session
149
+ #: recovered onto another host is reached at once.
150
+ OWNER_MISS_S = 2.0
151
+ #: How many sessions one host takes before the platform places elsewhere.
152
+ DEFAULT_MAX_SESSIONS = 1500
153
+ #: The error code (and a 404) a control call gets for a session this host does
154
+ #: not hold. The platform treats exactly this answer as "the host lost it".
155
+ UNKNOWN_SESSION = "unknown_session"
156
+ #: How often a host tells the platform it is alive and what it holds.
157
+ HEARTBEAT_S = 10.0
158
+ #: How long a draining host waits for its sessions to close before it exits.
159
+ DEFAULT_DRAIN_S = 45.0
160
+ #: Response headers a relayed answer does NOT keep: the framing is this
161
+ #: connection's, everything else the world set (its ``page_headers``, a
162
+ #: handler's own headers) passes through, from a worker and from an owner alike.
163
+ FRAMING_HEADERS = frozenset({"content-length", "connection", "transfer-encoding", "server", "date"})
164
+ #: Hop-by-hop headers (RFC 9110 §7.6.1) an owner's answer does not carry past
165
+ #: the proxying replica.
166
+ HOP_BY_HOP_HEADERS = frozenset(
167
+ {"keep-alive", "proxy-authenticate", "proxy-authorization", "te", "trailer", "upgrade", "proxy-connection"}
168
+ )
169
+ PROXIED_DROP_HEADERS = FRAMING_HEADERS | HOP_BY_HOP_HEADERS
170
+
171
+
172
+ class _NoRedirect(urllib.request.HTTPRedirectHandler):
173
+ """An owner's redirect is the client's to follow, not the proxy's: the ui
174
+ token exchange answers 303 with the session cookie, and following it here
175
+ would drop the cookie and land on the owner's 401."""
176
+
177
+ def redirect_request(self, req, fp, code, msg, headers, newurl):
178
+ return None
179
+
180
+
181
+ #: The opener the one-hop proxy uses: relays the owner's answer as is, a
182
+ #: redirect included, rather than following it.
183
+ _PROXY_OPENER = urllib.request.build_opener(_NoRedirect)
184
+ #: How long the grant the host mints towards the relay lives: the viewer's own
185
+ #: grant was already checked, this one only has to survive the handshake.
186
+ LIVE_RELAY_GRANT_MS = 60_000
187
+ #: What a session export is: the session's sqlite file, as the store wrote it.
188
+ EXPORT_CONTENT_TYPE = "application/vnd.sqlite3"
189
+ #: How long one export upload or restore download may take.
190
+ TRANSFER_TIMEOUT_S = 300.0
191
+ #: The most a version bundle may weigh, compressed and extracted, before the
192
+ #: host refuses it: the cache is one shared disk and a build's memory is the
193
+ #: supervisor's.
194
+ DEFAULT_MAX_BUNDLE_MB = 2048
195
+ MAX_BUNDLE_MEMBERS = 200_000
196
+ #: The largest request body the host reads, on either plane. A body is held
197
+ #: in memory whole (the seed rows, a tool call's args, a vendor route's
198
+ #: payload), and the memory is the supervisor's, shared by every session on
199
+ #: the replica; a client cannot be let size that allocation.
200
+ DEFAULT_MAX_BODY_MB = 32
201
+
202
+
203
+ # --------------------------------------------------------------------------- #
204
+ # Reflink: a session's state is a copy-on-write clone of the version snapshot.
205
+ # --------------------------------------------------------------------------- #
206
+
207
+ _FICLONE = 0x40049409 # ioctl: clone one file's extents into another (btrfs/XFS)
208
+
209
+
210
+ def clone_file(src: Path, dst: Path) -> None:
211
+ """Copy ``src`` to ``dst`` cheaply. A reflink (``FICLONE``) shares the
212
+ version snapshot's blocks copy-on-write, so opening a session costs the
213
+ same whatever the snapshot's size; a filesystem without reflink falls back
214
+ to a plain copy, which is what the pod engine does today."""
215
+ dst.parent.mkdir(parents=True, exist_ok=True)
216
+ try:
217
+ with open(src, "rb") as s, open(dst, "wb") as d:
218
+ fcntl.ioctl(d.fileno(), _FICLONE, s.fileno())
219
+ return
220
+ except OSError:
221
+ pass # not supported here (tmpfs, ext4, cross-device) — copy instead
222
+ shutil.copyfile(src, dst)
223
+
224
+
225
+ OBJECT_STORE_ANY = "any"
226
+ _ORIGIN_HOST = re.compile(r"^[A-Za-z0-9.-]+(:[0-9]+)?$")
227
+
228
+
229
+ def parse_origins(value: str | None) -> frozenset[str] | None:
230
+ """``WORLDS_HOST_OBJECT_STORE``: the origins (``scheme://host[:port]``,
231
+ comma-separated) the platform's presigned URLs may point at, or the word
232
+ ``any`` for a dev host reading ``file://`` bundles (``None``: every URL
233
+ admitted). Unset is refused rather than read as ``any``: a deployed host
234
+ with no allowlist is a host whose secret can aim it anywhere, and a
235
+ template's placeholder (``https://<bucket>.s3...``) is refused by name."""
236
+ if value is None or not value.strip():
237
+ fail(
238
+ "host",
239
+ "WORLDS_HOST_OBJECT_STORE is unset; name the object store's origins "
240
+ f"(https://bucket.s3.amazonaws.com) or {OBJECT_STORE_ANY!r} for a dev host",
241
+ )
242
+ raise AssertionError # fail() never returns
243
+ if value.strip().lower() == OBJECT_STORE_ANY:
244
+ return None
245
+ origins = set()
246
+ for item in value.split(","):
247
+ item = item.strip()
248
+ if not item:
249
+ continue
250
+ parts = urllib.parse.urlsplit(item)
251
+ if parts.scheme not in ("http", "https") or not parts.netloc or parts.path not in ("", "/"):
252
+ fail(
253
+ "host",
254
+ f"WORLDS_HOST_OBJECT_STORE entries are origins like https://bucket.s3.amazonaws.com, not {item!r}",
255
+ )
256
+ if not _ORIGIN_HOST.match(parts.netloc):
257
+ fail(
258
+ "host",
259
+ f"WORLDS_HOST_OBJECT_STORE names a placeholder, not a host: {item!r}; set the real bucket origin",
260
+ )
261
+ origins.add(f"{parts.scheme}://{parts.netloc}".lower())
262
+ return frozenset(origins)
263
+
264
+
265
+ def check_object_store_url(url: object, origins: frozenset[str] | None, what: str) -> str:
266
+ """The presigned URL the control plane handed us, once it is a string on one
267
+ of the object store's origins. The control plane is trusted with the host
268
+ secret, not with the host's network: a URL pointing anywhere else (the
269
+ metadata service, a cluster Service, the internet) is refused before a
270
+ byte moves, so a leaked secret cannot turn a session's state or the host's
271
+ reach into someone else's download."""
272
+ if not isinstance(url, str) or not url:
273
+ fail("host", f"{what} must be a presigned url")
274
+ raise AssertionError # fail() never returns
275
+ if origins is None:
276
+ return url
277
+ parts = urllib.parse.urlsplit(url)
278
+ origin = f"{parts.scheme}://{parts.netloc}".lower()
279
+ if origin not in origins:
280
+ fail("host", f"{what} must be on the object store ({', '.join(sorted(origins))}), not {origin}")
281
+ return url
282
+
283
+
284
+ def file_digest(path: Path) -> tuple[str, int]:
285
+ """The hex sha256 and size of a file, streamed."""
286
+ digest = hashlib.sha256()
287
+ size = 0
288
+ with open(path, "rb") as fh:
289
+ for chunk in iter(lambda: fh.read(1 << 20), b""):
290
+ digest.update(chunk)
291
+ size += len(chunk)
292
+ return digest.hexdigest(), size
293
+
294
+
295
+ def download_verified(url: str, sha256: str, dest: Path) -> Path:
296
+ """Fetch ``url`` into ``dest`` and refuse it unless its bytes hash to
297
+ ``sha256``; a mismatch leaves nothing behind."""
298
+ dest.parent.mkdir(parents=True, exist_ok=True)
299
+ staging = dest.with_name(f".{dest.name}.{uuid.uuid4().hex}")
300
+ try:
301
+ try:
302
+ with (
303
+ urllib.request.urlopen(urllib.request.Request(url), timeout=TRANSFER_TIMEOUT_S) as r,
304
+ open(staging, "wb") as out,
305
+ ):
306
+ shutil.copyfileobj(r, out)
307
+ except Exception as error: # noqa: BLE001 - name the stage in the message
308
+ fail("host", f"could not download the session export: {error}")
309
+ actual, _ = file_digest(staging)
310
+ if actual != sha256.lower():
311
+ fail("host", f"session export checksum mismatch: expected {sha256}, got {actual}")
312
+ os.replace(staging, dest)
313
+ finally:
314
+ staging.unlink(missing_ok=True)
315
+ return dest
316
+
317
+
318
+ def upload_file(url: str, path: Path, sha256: str, size: int, content_type: str = EXPORT_CONTENT_TYPE) -> None:
319
+ """PUT a file to a presigned URL, sending exactly the headers the platform
320
+ signed for it: content type, length and the base64 sha256 the object store
321
+ verifies on receipt."""
322
+ headers = {
323
+ "Content-Type": content_type,
324
+ "Content-Length": str(size),
325
+ "x-amz-checksum-sha256": base64.b64encode(bytes.fromhex(sha256)).decode("ascii"),
326
+ }
327
+ with open(path, "rb") as fh:
328
+ request = urllib.request.Request(url, data=fh, method="PUT", headers=headers)
329
+ try:
330
+ with urllib.request.urlopen(request, timeout=TRANSFER_TIMEOUT_S) as response:
331
+ response.read()
332
+ except urllib.error.HTTPError as error:
333
+ fail("host", f"the export upload was refused: HTTP {error.code} {error.read()[:200]!r}")
334
+ except urllib.error.URLError as error:
335
+ fail("host", f"could not upload the export: {error.reason}")
336
+
337
+
338
+ # --------------------------------------------------------------------------- #
339
+ # Locating and reading a world tree.
340
+ # --------------------------------------------------------------------------- #
341
+
342
+
343
+ def world_tree(bundle: Path) -> Path:
344
+ """The gateway-world tree inside an extracted bundle. ``bench push`` packages
345
+ a schema world as its api bundle with the tree under ``server/world``; a bare
346
+ tree is its own root."""
347
+ nested = bundle / BUNDLED_WORLD
348
+ if (bundle / API_BUNDLE).is_file() and (nested / "schema/world.json").is_file():
349
+ return nested
350
+ if (bundle / "schema/world.json").is_file():
351
+ return bundle
352
+ fail(
353
+ "host",
354
+ f"{bundle} holds no schema world the host can open (no {BUNDLED_WORLD}/schema/world.json "
355
+ "nor schema/world.json); the host serves schema worlds and api bundles only",
356
+ )
357
+ raise AssertionError # fail() never returns
358
+
359
+
360
+ def _scenario_dir(bundle: Path, tree: Path, task: str) -> Path | None:
361
+ """A task's scenario directory, checked at the bundle root first (where
362
+ ``build_api_bundle`` writes them) then in the tree."""
363
+ for root in (bundle / SCENARIOS / task, tree / SCENARIOS / task):
364
+ if (root / "scenario.toml").is_file():
365
+ return root
366
+ return None
367
+
368
+
369
+ # --------------------------------------------------------------------------- #
370
+ # Per-version cache: bundle + snapshot + parsed spec, fetched once per host.
371
+ # --------------------------------------------------------------------------- #
372
+
373
+
374
+ @dataclass
375
+ class CachedVersion:
376
+ """One cached version, of either shape the host serves: an api bundle (a
377
+ connector ``spec`` and ``settings``, sessions cloned from ``snapshot``) or a
378
+ schema world stored as itself (``tools``: handlers, tasks and verifiers,
379
+ sessions copied from its template — and ``spec`` + ``settings`` too when
380
+ its tree carries connector.toml, the HTTP surface the same session serves
381
+ over the same store). ``snapshot`` is set for an api bundle only."""
382
+
383
+ version_id: str
384
+ bundle: Path
385
+ tree: Path
386
+ spec: Spec | None
387
+ settings: ApiSettings | None
388
+ snapshot: Path | None
389
+ #: The world's own code, imported once per version — only in a process
390
+ #: that runs handlers (a worker). None in the supervisor.
391
+ handlers: dict[str, Handler] | None = None
392
+ #: The version's prebuilt static ui, when its manifest declares one.
393
+ ui: UiSurface | None = None
394
+ #: A mock-tools version; None for an api world.
395
+ tools: ToolsVersion | None = None
396
+
397
+ @property
398
+ def needs_worker(self) -> bool:
399
+ """Whether the version runs world-authored code: a mock-tools world
400
+ always (its tools ARE handlers), an api world when it declares some."""
401
+ if self.tools is not None:
402
+ return True
403
+ return self.settings is not None and self.settings.handlers is not None
404
+
405
+ def router(self) -> Router:
406
+ """A fresh router per session: routes are compiled from the shared spec,
407
+ but the oauth2 tokens a world mints must stay that session's own."""
408
+ assert self.spec is not None and self.settings is not None
409
+ return Router(self.spec, self.settings)
410
+
411
+
412
+ class VersionCache:
413
+ """Every world version this host has seen, on local disk. The first session
414
+ of a version pays for the download and extract; the rest clone its
415
+ snapshot. Nothing here is per session, so a hot version is cheap to serve
416
+ many times over."""
417
+
418
+ def __init__(self, root: Path, *, run_handlers: bool = False, max_bundle_mb: int = DEFAULT_MAX_BUNDLE_MB):
419
+ self.root = Path(root)
420
+ self.root.mkdir(parents=True, exist_ok=True)
421
+ #: Whether this process imports a version's ``handlers.py``. Off in the
422
+ #: supervisor, on in a version worker.
423
+ self.run_handlers = run_handlers
424
+ self.max_bundle_bytes = max_bundle_mb * (1 << 20)
425
+ self._lock = threading.Lock()
426
+ self._versions: dict[str, CachedVersion] = {}
427
+ #: One build at a time per version: the first open of a version does the
428
+ #: download, concurrent opens of the same version wait for it.
429
+ self._building: dict[str, threading.Lock] = {}
430
+
431
+ def ensure(
432
+ self,
433
+ version_id: str,
434
+ bundle_url: str,
435
+ snapshot: dict[str, str] | None,
436
+ ) -> CachedVersion:
437
+ with self._lock:
438
+ hit = self._versions.get(version_id)
439
+ if hit is not None:
440
+ return hit
441
+ building = self._building.setdefault(version_id, threading.Lock())
442
+ with building:
443
+ with self._lock:
444
+ hit = self._versions.get(version_id)
445
+ if hit is not None:
446
+ return hit
447
+ try:
448
+ cached = self._build(version_id, bundle_url, snapshot)
449
+ with self._lock:
450
+ self._versions[version_id] = cached
451
+ return cached
452
+ finally:
453
+ # Success or failure, the build slot is over: a failed build
454
+ # leaves nothing behind, and the next open of the version starts
455
+ # a fresh one.
456
+ with self._lock:
457
+ self._building.pop(version_id, None)
458
+
459
+ def has(self, version_id: str) -> bool:
460
+ with self._lock:
461
+ return version_id in self._versions
462
+
463
+ def version_ids(self) -> list[str]:
464
+ with self._lock:
465
+ return sorted(self._versions)
466
+
467
+ def _build(self, version_id: str, bundle_url: str, snapshot: dict[str, str] | None) -> CachedVersion:
468
+ bundle = self.root / version_id / "bundle"
469
+ if not bundle.is_dir():
470
+ self._download(bundle_url, bundle)
471
+ if is_tools_bundle(bundle):
472
+ tools = load_tools_version(
473
+ bundle, self.root / version_id / "template.db", snapshot, run_handlers=self.run_handlers
474
+ )
475
+ # A schema world stored as itself: its tools, and — when the tree
476
+ # carries connector.toml — its HTTP surface from the same session,
477
+ # plus the static ui that connector.toml's [ui] declares over it.
478
+ return CachedVersion(
479
+ version_id=version_id,
480
+ bundle=bundle,
481
+ tree=bundle,
482
+ spec=tools.spec,
483
+ settings=tools.settings,
484
+ snapshot=None,
485
+ handlers=tools.api_handlers,
486
+ ui=load_ui_surface(bundle) if tools.spec is not None else None,
487
+ tools=tools,
488
+ )
489
+ tree = world_tree(bundle)
490
+ contract = check_bundle(tree)
491
+ if snapshot:
492
+ snapshots.fetch(tree, contract, snapshot["url"], snapshot["sha256"], snapshot["digest"])
493
+ spec = load_spec(tree)
494
+ settings = load_api_settings(tree, spec)
495
+ handlers = load_handlers(settings) if self.run_handlers and settings.handlers is not None else None
496
+ snap = snapshots.default_snapshot(tree)
497
+ if not snap.is_file():
498
+ fail(
499
+ "host",
500
+ f"version {version_id} has no compiled snapshot (db/state.sqlite); "
501
+ "publish a data snapshot or pin one on the version",
502
+ )
503
+ return CachedVersion(
504
+ version_id=version_id,
505
+ bundle=bundle,
506
+ tree=tree,
507
+ spec=spec,
508
+ settings=settings,
509
+ snapshot=snap,
510
+ handlers=handlers,
511
+ ui=load_ui_surface(bundle),
512
+ )
513
+
514
+ def _download(self, url: str, dest: Path) -> None:
515
+ """Fetch and extract into a sibling staging directory, then rename it into
516
+ place: ``dest`` exists only once it is complete, so a download that dies
517
+ halfway is never mistaken for a cached bundle on the next open."""
518
+ dest.parent.mkdir(parents=True, exist_ok=True)
519
+ staging = dest.parent / f".{dest.name}.{uuid.uuid4().hex}"
520
+ tgz = staging.with_suffix(".tar.gz")
521
+ limit = self.max_bundle_bytes
522
+ try:
523
+ try:
524
+ with (
525
+ urllib.request.urlopen(urllib.request.Request(url), timeout=TRANSFER_TIMEOUT_S) as r,
526
+ open(tgz, "wb") as out,
527
+ ):
528
+ copied = 0
529
+ for chunk in iter(lambda: r.read(1 << 20), b""):
530
+ copied += len(chunk)
531
+ if copied > limit:
532
+ raise ValueError(f"the bundle is larger than {limit} bytes")
533
+ out.write(chunk)
534
+ except Exception as error: # noqa: BLE001 - name the stage in the message
535
+ fail("host", f"could not download the bundle from {url}: {error}")
536
+ staging.mkdir()
537
+ with tarfile.open(tgz, "r:gz") as t:
538
+ members = t.getmembers()
539
+ if len(members) > MAX_BUNDLE_MEMBERS:
540
+ fail("host", f"the bundle holds {len(members)} files, more than the {MAX_BUNDLE_MEMBERS} allowed")
541
+ extracted = sum(m.size for m in members)
542
+ if extracted > limit:
543
+ fail("host", f"the bundle extracts to {extracted} bytes, more than the {limit} allowed")
544
+ safe_tar_extract(t, staging)
545
+ os.replace(staging, dest)
546
+ finally:
547
+ tgz.unlink(missing_ok=True)
548
+ shutil.rmtree(staging, ignore_errors=True)
549
+
550
+
551
+ # --------------------------------------------------------------------------- #
552
+ # Session state: the cached snapshot, cloned into this session's own file.
553
+ # --------------------------------------------------------------------------- #
554
+
555
+
556
+ class HostWorldState(WorldState):
557
+ """A session's world, opened by cloning the version's cached snapshot into a
558
+ file on the host's own volume — the reflink is the whole per-session cost.
559
+ Otherwise a plain :class:`WorldState`."""
560
+
561
+ def __init__(self, cached: CachedVersion, session_dir: Path):
562
+ self._session_dir = Path(session_dir)
563
+ self._session_dir.mkdir(parents=True, exist_ok=True)
564
+ self._cached = cached
565
+ self._database: Path | None = None
566
+ super().__init__(cached.tree)
567
+
568
+ @property
569
+ def session_dir(self) -> Path:
570
+ return self._session_dir
571
+
572
+ def _open(self, snapshot: Path | None, *, initial: bool = True) -> None:
573
+ # A snapshot start is a clone of the version's cached snapshot into this
574
+ # session's file; the legacy no-snapshot path stays as the base class runs it.
575
+ if snapshot is None:
576
+ return super()._open(None, initial=initial)
577
+ if self.store is not None:
578
+ self.store.close()
579
+ if self._database is not None:
580
+ self._database.unlink(missing_ok=True)
581
+ database = self._session_dir / f"{uuid.uuid4().hex}.db"
582
+ clone_file(snapshot, database)
583
+ self.store = snapshots.SQLiteStore.open(database, self.contract, audit=False)
584
+ self._database = database
585
+
586
+ def export(self, destination: Path) -> Path:
587
+ """The session's state as one sqlite file: the store's own audited
588
+ online backup, consistent while requests keep writing."""
589
+ assert self.store is not None
590
+ with self._lock:
591
+ return self.store.snapshot(destination)
592
+
593
+ def restore(self, source: Path) -> None:
594
+ """Continue from a file :meth:`export` wrote. The file is audited row by
595
+ row on open: it came over the network, not from this store."""
596
+ with self._lock:
597
+ if self.store is not None:
598
+ self.store.close()
599
+ if self._database is not None:
600
+ self._database.unlink(missing_ok=True)
601
+ database = self._session_dir / f"{uuid.uuid4().hex}.db"
602
+ clone_file(source, database)
603
+ self.store = snapshots.SQLiteStore.open(database, self.contract, audit=True)
604
+ self._database = database
605
+
606
+ def close(self) -> None:
607
+ super().close()
608
+ shutil.rmtree(self._session_dir, ignore_errors=True)
609
+
610
+
611
+ @dataclass
612
+ class Export:
613
+ """A session's state copied to a file on this host, hashed, waiting for the
614
+ platform to hand over the presigned URL it goes to."""
615
+
616
+ export_id: str
617
+ path: Path
618
+ sha256: str
619
+ bytes: int
620
+
621
+ def describe(self) -> dict:
622
+ return {
623
+ "exportId": self.export_id,
624
+ "sha256": self.sha256,
625
+ "bytes": self.bytes,
626
+ "contentType": EXPORT_CONTENT_TYPE,
627
+ }
628
+
629
+
630
+ @dataclass
631
+ class Session:
632
+ session_id: str
633
+ version_id: str
634
+ #: The bundled task (a ``scenarios/<task>`` of the version), or None for a
635
+ #: session opened on a task of its own.
636
+ task: str | None
637
+ #: The connector spec of an api bundle, or of a schema world whose tree
638
+ #: carries connector.toml; None for a tools-only tree, which has no http
639
+ #: surface (its data plane is 404, its tools are ``call``).
640
+ spec: Spec | None
641
+ token: str | None
642
+ bundle: Path
643
+ tree: Path
644
+ #: Unix time the lease runs out unless renewed.
645
+ lease_until: float
646
+ #: The world, when this process serves it. None for a session placed on a
647
+ #: worker, whose state lives in that process.
648
+ state: HostWorldState | None = None
649
+ app: WorldApp | None = None
650
+ #: The mock-tools world, when this process (a worker) serves one.
651
+ tools: ToolsWorld | None = None
652
+ #: The version worker serving this session, or None for in-process.
653
+ worker: Worker | None = None
654
+ #: The version's static ui, served by the supervisor for this session.
655
+ ui: UiSurface | None = None
656
+ #: The pool browser leased for this session: its relay's ``ws://ip:port``
657
+ #: and the token that relay answers to. None when the session has no
658
+ #: browser surface.
659
+ browser_url: str | None = None
660
+ browser_token: str | None = None
661
+ #: For an oauth2 world: the bearer this world minted for the host itself,
662
+ #: presented on behalf of a caller who authenticated with the session token.
663
+ grant: str | None = None
664
+ #: Requests inside the world right now. A session is only torn down once
665
+ #: this reaches zero, so a close or an expiry never pulls the database out
666
+ #: from under a handler mid-request.
667
+ inflight: int = 0
668
+ #: Set once the session has left the registry; the last request out closes
669
+ #: the state.
670
+ closing: bool = False
671
+ #: Unix time the session was opened; its session-seconds are counted on close.
672
+ opened_at: float = field(default_factory=time.time)
673
+ #: Unix time of the last request that used the world: a data-plane call or
674
+ #: a control operation (seed, reset, grade, call, state). A renewal or an
675
+ #: export is the platform looking, not the session working, and does not
676
+ #: move it. Reported on renew so the platform's idle clock follows traffic
677
+ #: that never passes through it.
678
+ touched_at: float = field(default_factory=time.time)
679
+ #: The last export taken and not yet uploaded, if any.
680
+ export: Export | None = None
681
+ #: Set when the session was opened from an export rather than the snapshot.
682
+ restored: bool = False
683
+ #: The task supplied at open, when the session has one instead of a
684
+ #: bundled task: its seed is applied after the clone, its grader answers
685
+ #: ``grade``, and it lives under ``<session>/task/`` (:mod:`tasks`).
686
+ task_spec: TaskSpec | None = None
687
+
688
+ @property
689
+ def task_key(self) -> tuple[str | None, dict | None]:
690
+ """What an open retry must match: the bundled name or the spec itself."""
691
+ return self.task, self.task_spec.raw if self.task_spec is not None else None
692
+
693
+ def renew(self, lease_s: float) -> None:
694
+ self.lease_until = time.time() + lease_s
695
+
696
+ @property
697
+ def seconds(self) -> float:
698
+ return max(0.0, time.time() - self.opened_at)
699
+
700
+
701
+ @dataclass(frozen=True)
702
+ class DependencyRef:
703
+ """One entry of an open's ``dependencies``: the version a manifest alias
704
+ resolved to, and where its bundle (and pinned snapshot) are."""
705
+
706
+ alias: str
707
+ version_id: str
708
+ bundle_url: str
709
+ snapshot: dict[str, str] | None
710
+ raw: dict[str, Any]
711
+
712
+
713
+ def parse_dependency_refs(dependencies: Any) -> list[DependencyRef]:
714
+ if dependencies is None:
715
+ return []
716
+ if not isinstance(dependencies, list):
717
+ fail("host", "dependencies must be a list of {alias, versionId, bundleUrl, snapshot?}")
718
+ refs: list[DependencyRef] = []
719
+ seen: set[str] = set()
720
+ for entry in dependencies:
721
+ if not isinstance(entry, dict):
722
+ fail("host", "dependencies must be a list of {alias, versionId, bundleUrl, snapshot?}")
723
+ alias, version_id, bundle_url = entry.get("alias"), entry.get("versionId"), entry.get("bundleUrl")
724
+ if not (isinstance(alias, str) and isinstance(version_id, str) and isinstance(bundle_url, str)) or not (
725
+ alias and version_id and bundle_url
726
+ ):
727
+ fail("host", "each dependency needs alias, versionId and bundleUrl")
728
+ raise AssertionError # fail() never returns
729
+ if alias in seen:
730
+ fail("host", f"dependency alias '{alias}' is listed twice")
731
+ seen.add(alias)
732
+ snapshot = entry.get("snapshot")
733
+ if snapshot is not None and not isinstance(snapshot, dict):
734
+ fail("host", f"dependency '{alias}': snapshot must be {{url, sha256, digest}}")
735
+ refs.append(DependencyRef(alias, version_id, bundle_url, snapshot, dict(entry)))
736
+ return refs
737
+
738
+
739
+ def browser_lease(browser: dict[str, str] | None) -> tuple[str | None, str | None]:
740
+ """The ``browser`` field of an open request: the leased relay's ``url`` and
741
+ ``token``, both required when either is given, or ``(None, None)``."""
742
+ if not browser:
743
+ return None, None
744
+ url, token = browser.get("url"), browser.get("token")
745
+ if not isinstance(url, str) or not url.startswith("ws://") or not isinstance(token, str) or not token:
746
+ fail("host", "browser must be {url: 'ws://host:port', token: <relay token>}")
747
+ raise AssertionError # fail() never returns
748
+ return url.rstrip("/"), token
749
+
750
+
751
+ # --------------------------------------------------------------------------- #
752
+ # The host: the session registry and the control operations.
753
+ # --------------------------------------------------------------------------- #
754
+
755
+
756
+ class WorldHost:
757
+ """The session registry and the control operations, in one of two roles:
758
+
759
+ * the **supervisor** (the deployed host): serves code-free worlds in
760
+ process and places worlds with handlers on its :class:`WorkerPool`;
761
+ * a **worker** (``run_handlers=True``, ``pinned_version=...``): serves one
762
+ version, handlers included, for its supervisor.
763
+ """
764
+
765
+ def __init__(
766
+ self,
767
+ cache_root: Path,
768
+ *,
769
+ lease_s: float = DEFAULT_LEASE_S,
770
+ advertise_url: str | None = None,
771
+ workers: WorkerPool | None = None,
772
+ versions_root: Path | None = None,
773
+ run_handlers: bool = False,
774
+ pinned_version: str | None = None,
775
+ limits: dict[str, int] | None = None,
776
+ max_sessions: int = DEFAULT_MAX_SESSIONS,
777
+ max_bundle_mb: int = DEFAULT_MAX_BUNDLE_MB,
778
+ object_store: frozenset[str] | None = None,
779
+ ):
780
+ #: Where every presigned URL the control plane hands this host must
781
+ #: point (bundle, snapshot, export upload, restore); None admits any.
782
+ self.object_store = object_store
783
+ self.cache = VersionCache(
784
+ versions_root or Path(cache_root) / "versions", run_handlers=run_handlers, max_bundle_mb=max_bundle_mb
785
+ )
786
+ self.sessions_root = Path(cache_root) / "sessions"
787
+ # Sessions live in this process; whatever a previous one left on disk is
788
+ # unreachable, so a start begins with an empty sessions tree.
789
+ shutil.rmtree(self.sessions_root, ignore_errors=True)
790
+ self.sessions_root.mkdir(parents=True, exist_ok=True)
791
+ self.lease_s = lease_s
792
+ #: The address the platform pins a session to, so control calls reach
793
+ #: this replica and not the Service's round-robin. None = one replica.
794
+ self.advertise_url = advertise_url
795
+ self.workers = workers
796
+ self.run_handlers = run_handlers
797
+ self.pinned_version = pinned_version
798
+ #: The rlimits this process runs under (a worker's), for ``/healthz``.
799
+ self.limits = limits
800
+ #: Sessions this host admits before ``open`` answers 503 and the
801
+ #: platform places elsewhere; the heartbeat advertises it as capacity.
802
+ self.max_sessions = max_sessions
803
+ #: Set on SIGTERM: no new sessions, existing ones served until they
804
+ #: close or the drain grace runs out.
805
+ self.draining = False
806
+ self.started_at = time.time()
807
+ self._lock = threading.Lock()
808
+ self._sessions: dict[str, Session] = {}
809
+ #: Ids of sessions being opened: each holds one of ``max_sessions`` from
810
+ #: the moment its open is admitted, so concurrent opens cannot all pass
811
+ #: the capacity check and land past the limit.
812
+ self._opening: set[str] = set()
813
+ #: Opens the platform closed before they finished: it gave up waiting
814
+ #: and told this host to forget the session, so the session is closed
815
+ #: the moment it exists rather than held until its lease runs out.
816
+ self._abandoned: set[str] = set()
817
+ #: Lifetime counts for ``/metrics``: opens, closes by reason, requests
818
+ #: by surface, session-seconds of closed sessions.
819
+ self._counters: Counter[str] = Counter()
820
+ self._session_seconds = 0.0
821
+
822
+ # -- lifecycle ---------------------------------------------------------- #
823
+
824
+ def open(
825
+ self,
826
+ session_id: str,
827
+ version_id: str,
828
+ bundle_url: str,
829
+ task: str | None,
830
+ token: str | None,
831
+ snapshot: dict[str, str] | None,
832
+ browser: dict[str, str] | None = None,
833
+ restore: dict[str, str] | None = None,
834
+ task_spec: Any = None,
835
+ dependencies: list[dict[str, Any]] | None = None,
836
+ ) -> dict:
837
+ """Open ``session_id`` on ``version_id``, either on the bundled ``task``
838
+ or on ``task_spec``, a session task of its own (:mod:`tasks`); exactly
839
+ one of the two. ``dependencies`` are the versions the world's
840
+ ``[dependencies]`` resolved to, one ``{alias, versionId, bundleUrl,
841
+ snapshot?}`` per alias the manifest declares, opened beside it."""
842
+ if self.pinned_version is not None and version_id != self.pinned_version:
843
+ fail("host", f"this worker serves version {self.pinned_version} only, not {version_id}")
844
+ if (task is None) == (task_spec is None):
845
+ fail("host", "an open names a bundled task or carries a task spec, one of the two")
846
+ if task is not None and not isinstance(task, str):
847
+ fail("host", "task is the bundled task's name")
848
+ spec = parse_task_spec(task_spec) if task_spec is not None else None
849
+ deps = parse_dependency_refs(dependencies)
850
+ with self._lock:
851
+ existing = self._sessions.get(session_id)
852
+ if existing is None:
853
+ # A retry of an open this host already served is answered even
854
+ # while draining: refusing it would send the platform to open
855
+ # the same id elsewhere while this copy holds the live writes.
856
+ if self.draining:
857
+ fail("draining", "this host is draining and takes no new sessions")
858
+ self._admit(session_id)
859
+ if existing is not None:
860
+ # The platform retried an open that already succeeded: the same
861
+ # session is the answer, never a rebuild that drops its writes.
862
+ wanted = (version_id, (task, spec.raw if spec is not None else None), token)
863
+ if (existing.version_id, existing.task_key, existing.token) != wanted:
864
+ fail("host", f"session {session_id} is already open as another version, task or token")
865
+ return self._describe(existing)
866
+ try:
867
+ described = self._open(
868
+ session_id, version_id, bundle_url, task, spec, token, snapshot, browser, restore, deps
869
+ )
870
+ except Exception:
871
+ self.tally("open_failures")
872
+ with self._lock:
873
+ self._opening.discard(session_id)
874
+ self._abandoned.discard(session_id)
875
+ raise
876
+ with self._lock:
877
+ self._opening.discard(session_id)
878
+ abandoned = session_id in self._abandoned
879
+ self._abandoned.discard(session_id)
880
+ if abandoned:
881
+ self.close(session_id)
882
+ fail(UNKNOWN_SESSION, f"session {session_id} was closed while it opened")
883
+ return described
884
+
885
+ def _admit(self, session_id: str) -> None:
886
+ """Reserve one of this host's ``max_sessions`` for ``session_id`` while it
887
+ opens. Under ``_lock``."""
888
+ if session_id in self._opening:
889
+ fail("host", f"session {session_id} is being opened already")
890
+ if len(self._sessions) + len(self._opening) >= self.max_sessions:
891
+ fail("at_capacity", f"this host holds its {self.max_sessions} sessions; place elsewhere")
892
+ self._opening.add(session_id)
893
+
894
+ def _open(
895
+ self,
896
+ session_id: str,
897
+ version_id: str,
898
+ bundle_url: str,
899
+ task: str | None,
900
+ spec: TaskSpec | None,
901
+ token: str | None,
902
+ snapshot: dict[str, str] | None,
903
+ browser: dict[str, str] | None,
904
+ restore: dict[str, str] | None,
905
+ deps: list[DependencyRef],
906
+ ) -> dict:
907
+ cached = self.cache.ensure(version_id, *self._trusted_version(bundle_url, snapshot))
908
+ dependencies = self._dependency_worlds(cached, deps)
909
+ # A session task runs on either shape the host serves: an api bundle
910
+ # clones its snapshot and grades by the spec; a schema world copies its
911
+ # template and grades with its bundled verifiers (:func:`inline_task`
912
+ # refuses a spec that brings a grader of its own). Its allow-list may
913
+ # name a tool or, on a tree with connector.toml, an operation.
914
+ if cached.spec is not None:
915
+ unsupported = unsupported_auth(cached.spec)
916
+ if unsupported:
917
+ fail("host", unsupported)
918
+ if spec is not None:
919
+ if cached.tools is not None:
920
+ self._check_task_tools(spec, served_with_dependencies(cached.tools, dependencies))
921
+ else:
922
+ assert cached.spec is not None
923
+ self._check_task_tools(spec, cached.spec.operations)
924
+ browser_url, browser_token = browser_lease(browser)
925
+ if cached.needs_worker and not self.run_handlers:
926
+ if self.workers is None:
927
+ fail(
928
+ "host",
929
+ f"version {version_id} runs world-authored code ({_code_of(cached)}); "
930
+ "this host runs none in its process and has no version workers",
931
+ )
932
+ return self._open_on_worker(
933
+ cached, session_id, bundle_url, task, spec, token, browser_url, browser_token, restore, deps
934
+ )
935
+ if cached.tools is not None:
936
+ return self._open_tools(cached, cached.tools, session_id, task, spec, token, restore, dependencies)
937
+ assert cached.snapshot is not None and cached.spec is not None
938
+ state = HostWorldState(cached, self.sessions_root / session_id)
939
+ try:
940
+ if spec is not None:
941
+ self._check_task_entities(spec, state)
942
+ write_task_dir(spec, state.session_dir)
943
+ self._apply_task_seed(state, spec)
944
+ else:
945
+ assert task is not None
946
+ self._apply_scenario(cached, state, task)
947
+ restored = self._restore_into(restore, self.sessions_root / session_id, state.restore)
948
+ except Exception:
949
+ state.close()
950
+ raise
951
+ # ``handlers={}`` for a code-free world: WorldApp would otherwise import
952
+ # the module itself, and only a worker may do that.
953
+ app = WorldApp(
954
+ state,
955
+ cached.router(),
956
+ token,
957
+ handlers=cached.handlers or {},
958
+ allowed=frozenset(spec.tools) if spec is not None and spec.tools is not None else None,
959
+ )
960
+ session = Session(
961
+ session_id=session_id,
962
+ version_id=version_id,
963
+ task=task,
964
+ spec=cached.spec,
965
+ token=token,
966
+ bundle=cached.bundle,
967
+ tree=cached.tree,
968
+ lease_until=time.time() + self.lease_s,
969
+ state=state,
970
+ app=app,
971
+ ui=cached.ui,
972
+ browser_url=browser_url,
973
+ browser_token=browser_token,
974
+ restored=restored,
975
+ task_spec=spec,
976
+ )
977
+ if cached.spec.scheme == "oauth2":
978
+ # The host's own client-credentials grant, so a caller admitted by
979
+ # the session token is presented to the world as a granted client.
980
+ issued = app.router.issue_token(
981
+ {"grant_type": "client_credentials", "client_secret": token or ""},
982
+ token,
983
+ )
984
+ session.grant = issued["access_token"] if issued else None
985
+ self._register(session)
986
+ return self._describe(session)
987
+
988
+ def _open_tools(
989
+ self,
990
+ cached: CachedVersion,
991
+ tools: ToolsVersion,
992
+ session_id: str,
993
+ task: str | None,
994
+ spec: TaskSpec | None,
995
+ token: str | None,
996
+ restore: dict[str, str] | None,
997
+ dependencies: dict[str, DependencyWorld],
998
+ ) -> dict:
999
+ """A schema world's session in this (worker) process: a copy of the
1000
+ version's template, executed through its handlers, on a bundled ``task``
1001
+ or on the session's own ``spec`` (its seed on the copy, the bundle's
1002
+ verifiers as its grade), beside a copy of each dependency world's. When
1003
+ the tree carries connector.toml the same session answers its HTTP
1004
+ surface over the same store (:class:`ToolsWorldState` under a
1005
+ :class:`WorldApp`), and the static ui its ``[ui]`` declares (served by
1006
+ whichever process fronts the session: the supervisor for a worker's
1007
+ session, this one when it runs the handlers itself); without it there
1008
+ is no http surface, so no ui and no browser, and the agent reaches the
1009
+ world through ``call`` alone."""
1010
+ session_dir = self.sessions_root / session_id
1011
+ allowed = frozenset(spec.tools) if spec is not None and spec.tools is not None else None
1012
+ if spec is not None:
1013
+ world = ToolsWorld(
1014
+ tools, session_dir, inline_task(spec), seed=spec.seed, allowed=allowed, dependencies=dependencies
1015
+ )
1016
+ else:
1017
+ assert task is not None
1018
+ world = ToolsWorld(tools, session_dir, task, dependencies=dependencies)
1019
+ app: WorldApp | None = None
1020
+ try:
1021
+ if spec is not None:
1022
+ # Under the session, as an api session keeps it: where a grade
1023
+ # and a restart find the task.
1024
+ write_task_dir(spec, session_dir)
1025
+ restored = self._restore_into(restore, session_dir, world.restore)
1026
+ if cached.spec is not None:
1027
+ app = WorldApp(
1028
+ ToolsWorldState(world, cached.tree),
1029
+ cached.router(),
1030
+ token,
1031
+ handlers=cached.handlers or {},
1032
+ allowed=allowed,
1033
+ )
1034
+ except Exception:
1035
+ world.close()
1036
+ raise
1037
+ session = Session(
1038
+ session_id=session_id,
1039
+ version_id=cached.version_id,
1040
+ task=task,
1041
+ spec=cached.spec,
1042
+ token=token,
1043
+ bundle=cached.bundle,
1044
+ tree=cached.tree,
1045
+ lease_until=time.time() + self.lease_s,
1046
+ app=app,
1047
+ tools=world,
1048
+ ui=cached.ui,
1049
+ restored=restored,
1050
+ task_spec=spec,
1051
+ )
1052
+ if app is not None and cached.spec is not None and cached.spec.scheme == "oauth2":
1053
+ issued = app.router.issue_token({"grant_type": "client_credentials", "client_secret": token or ""}, token)
1054
+ session.grant = issued["access_token"] if issued else None
1055
+ self._register(session)
1056
+ return self._describe(session)
1057
+
1058
+ def _open_on_worker(
1059
+ self,
1060
+ cached: CachedVersion,
1061
+ session_id: str,
1062
+ bundle_url: str,
1063
+ task: str | None,
1064
+ spec: TaskSpec | None,
1065
+ token: str | None,
1066
+ browser_url: str | None,
1067
+ browser_token: str | None,
1068
+ restore: dict[str, str] | None,
1069
+ deps: list[DependencyRef],
1070
+ ) -> dict:
1071
+ """Place the session on the version's worker. The worker opens it from
1072
+ the bundle this process already cached (no snapshot to fetch: the file
1073
+ is on disk), and the supervisor records only where it went. The ui and
1074
+ browser surfaces are the supervisor's own (static files, a tunnel), so
1075
+ the worker hears nothing of them. An export to restore from is fetched
1076
+ and verified here too, then handed to the worker as a local file.
1077
+ A worker every one of whose peers holds sessions cannot be started
1078
+ past the pool's memory budget: that is ``at_capacity``, and the
1079
+ platform places the session on another replica."""
1080
+ assert self.workers is not None
1081
+ try:
1082
+ worker = self.workers.get(cached.version_id)
1083
+ except WorkerCapacity as error:
1084
+ fail("at_capacity", str(error))
1085
+ # The session is the worker's from here, so another version's open
1086
+ # cannot stop this worker as session-less while it is being placed.
1087
+ with self._lock:
1088
+ worker.sessions.add(session_id)
1089
+ source = None
1090
+ try:
1091
+ source = self._restore_source(restore, self._worker_session_dir(worker, session_id))
1092
+ self._worker_control(
1093
+ worker,
1094
+ "POST",
1095
+ "/__host/sessions",
1096
+ {
1097
+ "sessionId": session_id,
1098
+ "versionId": cached.version_id,
1099
+ "bundleUrl": bundle_url,
1100
+ "task": task,
1101
+ "taskSpec": spec.raw if spec is not None else None,
1102
+ "token": token,
1103
+ "restore": {"path": str(source)} if source is not None else None,
1104
+ "dependencies": [dep.raw for dep in deps],
1105
+ },
1106
+ )
1107
+ except BaseException:
1108
+ with self._lock:
1109
+ worker.sessions.discard(session_id)
1110
+ if not worker.sessions:
1111
+ worker.idle_since = time.time()
1112
+ raise
1113
+ finally:
1114
+ if source is not None:
1115
+ source.unlink(missing_ok=True)
1116
+ session = Session(
1117
+ session_id=session_id,
1118
+ version_id=cached.version_id,
1119
+ task=task,
1120
+ spec=cached.spec,
1121
+ token=token,
1122
+ bundle=cached.bundle,
1123
+ tree=cached.tree,
1124
+ lease_until=time.time() + self.lease_s,
1125
+ worker=worker,
1126
+ ui=cached.ui,
1127
+ browser_url=browser_url,
1128
+ browser_token=browser_token,
1129
+ restored=source is not None,
1130
+ task_spec=spec,
1131
+ )
1132
+ self._register(session)
1133
+ return self._describe(session)
1134
+
1135
+ def _worker_session_dir(self, worker: Worker, session_id: str) -> Path:
1136
+ """Where a worker keeps a session's files: its own ``WorldHost`` runs
1137
+ under ``workers/<version>`` of this host's cache root (:mod:`worker`)."""
1138
+ assert self.workers is not None
1139
+ return self.workers.root / "workers" / worker.version_id / "sessions" / session_id
1140
+
1141
+ def _restore_into(self, restore: dict[str, str] | None, session_dir: Path, load: Callable[[Path], None]) -> bool:
1142
+ """Load the export ``restore`` names into a freshly opened world, then
1143
+ drop the fetched file. False when there was nothing to restore."""
1144
+ source = self._restore_source(restore, session_dir)
1145
+ if source is None:
1146
+ return False
1147
+ try:
1148
+ load(source)
1149
+ finally:
1150
+ source.unlink(missing_ok=True)
1151
+ return True
1152
+
1153
+ def _restore_source(self, restore: dict[str, str] | None, session_dir: Path) -> Path | None:
1154
+ """The export a session continues from, as a local file, or None for a
1155
+ fresh session. The platform names it by ``{url, sha256}`` and the file is
1156
+ fetched into the session's directory and verified; a supervisor names it
1157
+ to its worker by ``{path}``, already verified, and only the supervisor
1158
+ reaches a worker's control socket."""
1159
+ if not restore:
1160
+ return None
1161
+ path = restore.get("path")
1162
+ if path is not None:
1163
+ if not self.run_handlers:
1164
+ fail("host", "restore by path is a worker's; name the export by {url, sha256}")
1165
+ source = Path(path)
1166
+ if not source.is_file():
1167
+ fail("host", f"restore file {path} is missing")
1168
+ return source
1169
+ url, sha256 = restore.get("url"), restore.get("sha256")
1170
+ if not isinstance(url, str) or not isinstance(sha256, str) or len(sha256) != 64:
1171
+ fail("host", "restore must be {url: <presigned export url>, sha256: <hex digest>}")
1172
+ raise AssertionError # fail() never returns
1173
+ check_object_store_url(url, self.object_store, "restore.url")
1174
+ return download_verified(url, sha256, session_dir / "restore.sqlite")
1175
+
1176
+ def _trusted_version(self, bundle_url: str, snapshot: dict[str, str] | None) -> tuple[str, dict[str, str] | None]:
1177
+ check_object_store_url(bundle_url, self.object_store, "bundleUrl")
1178
+ if snapshot:
1179
+ check_object_store_url(snapshot.get("url"), self.object_store, "snapshot.url")
1180
+ return bundle_url, snapshot
1181
+
1182
+ def _register(self, session: Session) -> None:
1183
+ with self._lock:
1184
+ replaced = self._retire(self._sessions.pop(session.session_id, None))
1185
+ self._sessions[session.session_id] = session
1186
+ self._counters["opened"] += 1
1187
+ if replaced is not None:
1188
+ self._finish(replaced, reason="replaced")
1189
+
1190
+ def _describe(self, session: Session) -> dict:
1191
+ return {
1192
+ "sessionId": session.session_id,
1193
+ "versionId": session.version_id,
1194
+ "task": session.task,
1195
+ "taskName": session.task if session.task_spec is None else session.task_spec.name,
1196
+ "taskSource": "bundled" if session.task_spec is None else "inline",
1197
+ "tools": (
1198
+ list(session.task_spec.tools)
1199
+ if session.task_spec is not None and session.task_spec.tools is not None
1200
+ else None
1201
+ ),
1202
+ "ready": True,
1203
+ "hostUrl": self.advertise_url,
1204
+ "leaseSeconds": self.lease_s,
1205
+ "leaseUntil": session.lease_until,
1206
+ "workerPid": session.worker.pid if session.worker is not None else None,
1207
+ "ui": {"entry": session.ui.entry, "apiPath": session.ui.api_path} if session.ui is not None else None,
1208
+ "browser": session.browser_url is not None,
1209
+ "restored": session.restored,
1210
+ "openedAt": session.opened_at,
1211
+ "sessionSeconds": session.seconds,
1212
+ "touchedAt": session.touched_at,
1213
+ }
1214
+
1215
+ def close(self, session_id: str) -> dict:
1216
+ with self._lock:
1217
+ session = self._sessions.pop(session_id, None)
1218
+ idle = self._retire(session)
1219
+ if session is None and session_id in self._opening:
1220
+ self._abandoned.add(session_id)
1221
+ if idle is not None:
1222
+ self._finish(idle, reason="closed")
1223
+ if session is None:
1224
+ return {"closed": True, "openedAt": None, "sessionSeconds": 0.0}
1225
+ return {"closed": True, "openedAt": session.opened_at, "sessionSeconds": session.seconds}
1226
+
1227
+ # -- durability: a session's state as a file the platform keeps ---------- #
1228
+
1229
+ def export(self, session_id: str, known_sha256: str | None = None) -> dict:
1230
+ """Copy the session's state to a file on this host and hash it. The copy
1231
+ is consistent (sqlite's online backup under the store's lock) and waits
1232
+ for :meth:`upload_export`; taking a new one discards the last. A copy
1233
+ that hashes to ``known_sha256`` (the platform's last export of the
1234
+ session) is thrown away and reported ``unchanged``: nothing to upload."""
1235
+ with self.using(session_id, touch=False) as session:
1236
+ if session.worker is not None:
1237
+ answer = self._worker_control(session.worker, "POST", f"/__host/sessions/{session_id}/export", {})
1238
+ path = self._worker_export_path(session, answer)
1239
+ else:
1240
+ exports = self.sessions_root / session_id / "exports"
1241
+ shutil.rmtree(exports, ignore_errors=True)
1242
+ path = exports / f"{uuid.uuid4().hex}.sqlite"
1243
+ if session.tools is not None:
1244
+ session.tools.export(path)
1245
+ else:
1246
+ assert session.state is not None
1247
+ session.state.export(path)
1248
+ sha256, size = file_digest(path)
1249
+ if known_sha256 is not None and sha256 == known_sha256:
1250
+ path.unlink(missing_ok=True)
1251
+ with self._lock:
1252
+ session.export = None
1253
+ self._counters["exports_unchanged"] += 1
1254
+ return {"exportId": None, "sha256": sha256, "bytes": size, "unchanged": True}
1255
+ export = Export(export_id=path.stem, path=path, sha256=sha256, bytes=size)
1256
+ with self._lock:
1257
+ session.export = export
1258
+ self._counters["exports"] += 1
1259
+ described = export.describe()
1260
+ if self.run_handlers:
1261
+ described["path"] = str(path) # for the supervisor, which uploads on the worker's behalf
1262
+ return described
1263
+
1264
+ def _worker_export_path(self, session: Session, answer: dict) -> Path:
1265
+ """The file a worker's export landed in, admitted only from inside that
1266
+ worker's directory for this session: the worker runs tenant code, so
1267
+ what it names is checked, and the bytes are hashed here, not trusted."""
1268
+ assert session.worker is not None
1269
+ exports = self._worker_session_dir(session.worker, session.session_id) / "exports"
1270
+ path = Path(str(answer.get("path") or ""))
1271
+ try:
1272
+ resolved = path.resolve(strict=True)
1273
+ resolved.relative_to(exports.resolve())
1274
+ except (OSError, ValueError):
1275
+ fail("host", f"the worker's export is not where a worker's exports go: {path}")
1276
+ raise AssertionError # fail() never returns
1277
+ return resolved
1278
+
1279
+ def upload_export(self, session_id: str, export_id: str, url: str) -> dict:
1280
+ """PUT the export :meth:`export` took to the presigned URL the platform
1281
+ signed for its hash and size; the local copy goes once it is up."""
1282
+ check_object_store_url(url, self.object_store, "url")
1283
+ with self.using(session_id, touch=False) as session:
1284
+ export = session.export
1285
+ if export is None or export.export_id != export_id:
1286
+ fail("host", f"no export {export_id} for session {session_id}; take one first")
1287
+ raise AssertionError # fail() never returns
1288
+ upload_file(url, export.path, export.sha256, export.bytes)
1289
+ export.path.unlink(missing_ok=True)
1290
+ with self._lock:
1291
+ session.export = None
1292
+ self._counters["exports_uploaded"] += 1
1293
+ return {"uploaded": True, **export.describe()}
1294
+
1295
+ def renew(self, session_id: str) -> dict:
1296
+ with self.using(session_id, touch=False) as session:
1297
+ return self._describe(session)
1298
+
1299
+ def expire_leases(self, now: float | None = None) -> list[str]:
1300
+ """Close every session whose lease has run out; returns their ids. The
1301
+ check and the removal happen under one lock, so a renewal that lands
1302
+ in between keeps its session, and a session with a request in flight
1303
+ is left for the next sweep (the request renewed it anyway)."""
1304
+ now = time.time() if now is None else now
1305
+ with self._lock:
1306
+ expired = [s for s in self._sessions.values() if s.lease_until <= now and s.inflight == 0]
1307
+ for session in expired:
1308
+ del self._sessions[session.session_id]
1309
+ self._retire(session)
1310
+ for session in expired:
1311
+ self._finish(session, reason="expired")
1312
+ return [s.session_id for s in expired]
1313
+
1314
+ def _retire(self, session: Session | None) -> Session | None:
1315
+ """Mark a session that has left the registry; returns it when nobody is
1316
+ inside it, so the caller closes the state now. Otherwise the last
1317
+ request out does (see :meth:`_release`). Call under the lock."""
1318
+ if session is None:
1319
+ return None
1320
+ session.closing = True
1321
+ return session if session.inflight == 0 else None
1322
+
1323
+ def _finish(self, session: Session, *, reason: str = "closed") -> None:
1324
+ """Free a session that has left the registry and has nobody inside it:
1325
+ close its state here, or tell its worker to."""
1326
+ with self._lock:
1327
+ self._counters[f"closed.{reason}"] += 1
1328
+ self._session_seconds += session.seconds
1329
+ if session.worker is None:
1330
+ if session.tools is not None:
1331
+ session.tools.close()
1332
+ return
1333
+ assert session.state is not None
1334
+ session.state.close()
1335
+ return
1336
+ worker = session.worker
1337
+ with self._lock:
1338
+ worker.sessions.discard(session.session_id)
1339
+ if not worker.sessions:
1340
+ worker.idle_since = time.time()
1341
+ try:
1342
+ self._worker_control(worker, "DELETE", f"/__host/sessions/{session.session_id}", None)
1343
+ except (WorkerGone, ContractError):
1344
+ pass # the worker is gone, or already forgot it: either way the session is over
1345
+
1346
+ def _worker_control(self, worker: Worker, method: str, path: str, body: dict | None) -> dict:
1347
+ """One control call to a worker, its answer as this host would give it:
1348
+ the worker's refusal is re-raised as ours, and a worker that has died
1349
+ takes every session it held with it."""
1350
+ raw = json.dumps(body).encode("utf-8") if body is not None else b""
1351
+ try:
1352
+ status, _, payload = worker.request(method, path, {"content-type": "application/json"}, raw, control=True)
1353
+ except WorkerGone:
1354
+ self.lose_worker(worker)
1355
+ raise
1356
+ answer = json.loads(payload or b"null")
1357
+ if status != 200:
1358
+ detail = answer if isinstance(answer, dict) else {}
1359
+ fail(str(detail.get("error") or "host"), str(detail.get("detail") or answer))
1360
+ return answer if isinstance(answer, dict) else {"result": answer}
1361
+
1362
+ def lose_worker(self, worker: Worker) -> list[str]:
1363
+ """A worker exited: forget it and every session it held. Returns the
1364
+ session ids, which are now gone from this host (the platform learns of
1365
+ it on the next renew)."""
1366
+ if self.workers is not None:
1367
+ self.workers.drop(worker.version_id)
1368
+ with self._lock:
1369
+ lost = [sid for sid, s in self._sessions.items() if s.worker is worker]
1370
+ for sid in lost:
1371
+ session = self._sessions.pop(sid)
1372
+ session.closing = True
1373
+ self._counters["closed.lost"] += 1
1374
+ self._session_seconds += session.seconds
1375
+ worker.sessions.clear()
1376
+ return lost
1377
+
1378
+ def reap_workers(self) -> list[str]:
1379
+ """Stop version workers that have had no session for a while."""
1380
+ return self.workers.reap_idle() if self.workers is not None else []
1381
+
1382
+ def session_count(self) -> int:
1383
+ with self._lock:
1384
+ return len(self._sessions)
1385
+
1386
+ def worker_count(self) -> int:
1387
+ return len(self.workers._workers) if self.workers is not None else 0
1388
+
1389
+ # -- fleet: warming, draining, what the platform and prometheus see ------- #
1390
+
1391
+ def warm(self, version_id: str, bundle_url: str, snapshot: dict[str, str] | None) -> dict:
1392
+ """Cache a version before any session asks for it, so the first open
1393
+ pays nothing. Idempotent: a version already here is reported, not
1394
+ rebuilt."""
1395
+ already = self.cache.has(version_id)
1396
+ if not already:
1397
+ self.cache.ensure(version_id, *self._trusted_version(bundle_url, snapshot))
1398
+ return {"versionId": version_id, "cached": True, "alreadyCached": already}
1399
+
1400
+ def drain(self) -> None:
1401
+ """Stop taking sessions; the ones here are served until they close."""
1402
+ self.draining = True
1403
+
1404
+ def tally(self, key: str) -> None:
1405
+ with self._lock:
1406
+ self._counters[key] += 1
1407
+
1408
+ def stats(self) -> dict:
1409
+ """What this host is and holds, for the heartbeat and ``/__host/stats``:
1410
+ the placement inputs (address, load, capacity, draining, which versions
1411
+ are already cached) plus the lifetime counters."""
1412
+ with self._lock:
1413
+ sessions = len(self._sessions)
1414
+ versions_in_use = sorted({s.version_id for s in self._sessions.values()})
1415
+ counters = dict(self._counters)
1416
+ session_seconds = self._session_seconds
1417
+ return {
1418
+ "hostUrl": self.advertise_url,
1419
+ "sessions": sessions,
1420
+ "capacity": self.max_sessions,
1421
+ "draining": self.draining,
1422
+ "workers": self.worker_count(),
1423
+ "versions": self.cache.version_ids(),
1424
+ "versionsInUse": versions_in_use,
1425
+ "uptimeSeconds": time.time() - self.started_at,
1426
+ "counters": counters,
1427
+ "sessionSeconds": session_seconds,
1428
+ "pid": os.getpid(),
1429
+ "limits": self.limits,
1430
+ }
1431
+
1432
+ def metrics_text(self) -> str:
1433
+ """The prometheus exposition of :meth:`stats`. ``worlds_host_sessions``
1434
+ is the number the fleet scales on (sessions per host, not cpu)."""
1435
+ stats = self.stats()
1436
+ counters: dict[str, int] = stats["counters"]
1437
+ lines = [
1438
+ "# TYPE worlds_host_sessions gauge",
1439
+ f"worlds_host_sessions {stats['sessions']}",
1440
+ "# TYPE worlds_host_capacity gauge",
1441
+ f"worlds_host_capacity {stats['capacity']}",
1442
+ "# TYPE worlds_host_draining gauge",
1443
+ f"worlds_host_draining {int(stats['draining'])}",
1444
+ "# TYPE worlds_host_workers gauge",
1445
+ f"worlds_host_workers {stats['workers']}",
1446
+ "# TYPE worlds_host_versions_cached gauge",
1447
+ f"worlds_host_versions_cached {len(stats['versions'])}",
1448
+ "# TYPE worlds_host_uptime_seconds gauge",
1449
+ f"worlds_host_uptime_seconds {stats['uptimeSeconds']:.0f}",
1450
+ "# TYPE worlds_host_sessions_opened_total counter",
1451
+ f"worlds_host_sessions_opened_total {counters.get('opened', 0)}",
1452
+ "# TYPE worlds_host_open_failures_total counter",
1453
+ f"worlds_host_open_failures_total {counters.get('open_failures', 0)}",
1454
+ "# TYPE worlds_host_session_seconds_total counter",
1455
+ f"worlds_host_session_seconds_total {stats['sessionSeconds']:.0f}",
1456
+ "# TYPE worlds_host_exports_total counter",
1457
+ f"worlds_host_exports_total {counters.get('exports', 0)}",
1458
+ "# TYPE worlds_host_exports_uploaded_total counter",
1459
+ f"worlds_host_exports_uploaded_total {counters.get('exports_uploaded', 0)}",
1460
+ "# TYPE worlds_host_sessions_closed_total counter",
1461
+ ]
1462
+ for reason in ("closed", "expired", "lost", "replaced"):
1463
+ lines.append(
1464
+ f'worlds_host_sessions_closed_total{{reason="{reason}"}} {counters.get(f"closed.{reason}", 0)}'
1465
+ )
1466
+ lines.append("# TYPE worlds_host_requests_total counter")
1467
+ for surface in ("api", "ui", "browser", "proxied"):
1468
+ lines.append(f'worlds_host_requests_total{{surface="{surface}"}} {counters.get(f"requests.{surface}", 0)}')
1469
+ return "\n".join(lines) + "\n"
1470
+
1471
+ def _apply_scenario(self, cached: CachedVersion, state: HostWorldState, task: str) -> None:
1472
+ """Start the session in its task's scenario. The compiled snapshot the
1473
+ session is cloned from IS the base state, so a scenario with no seed
1474
+ overlay (the synthesized ``default``) needs nothing; one with an overlay
1475
+ applies it on top of the pinned snapshot the way the runner does."""
1476
+ scenario = _scenario_dir(cached.bundle, cached.tree, task)
1477
+ if scenario is None:
1478
+ if task in state.scenarios():
1479
+ state.apply_scenario(task) # a tree-authored scenario
1480
+ return
1481
+ fail(
1482
+ "host",
1483
+ f"no scenario '{task}' in this world; it has {', '.join(state.scenarios()) or 'default'}",
1484
+ )
1485
+ overlay = snapshots.scenario_overlay(scenario)
1486
+ if not overlay:
1487
+ return # base state; the cloned snapshot already holds it
1488
+ digest = state.digest
1489
+ if digest is None:
1490
+ fail("host", "a scenario overlay needs a compiled snapshot to apply against")
1491
+ state.seed({"base": digest, "rows": overlay, "mode": "replace"})
1492
+
1493
+ @staticmethod
1494
+ def _check_task_entities(spec: TaskSpec, state: HostWorldState) -> None:
1495
+ """A task is refused for a world that does not define every entity it
1496
+ names. The seed would fail on its own; an assertion over an unknown
1497
+ entity would not, selecting no rows, so `absent` or `count: eq 0`
1498
+ checks would pass on a typo and grade a task that can never be graded."""
1499
+ unknown = unknown_task_entities(spec, state.contract.entities)
1500
+ if unknown:
1501
+ defined = ", ".join(sorted(state.contract.entities)) or "none"
1502
+ fail(
1503
+ "task",
1504
+ f"the task names {', '.join(unknown)}, which this world does not define; its entities are {defined}",
1505
+ "/task",
1506
+ )
1507
+
1508
+ def _dependency_worlds(self, cached: CachedVersion, deps: list[DependencyRef]) -> dict[str, DependencyWorld]:
1509
+ """The dependency versions a session opens beside ``cached``, cached the
1510
+ way the root is (a worker imports their handlers too). Every alias the
1511
+ root's manifest declares must be resolved, and nothing else: a version
1512
+ without ``[dependencies]`` opened with any is refused, as is a
1513
+ dependency that is not a schema world."""
1514
+ if not deps:
1515
+ if cached.tools is not None and cached.tools.dependencies:
1516
+ declared = ", ".join(sorted(cached.tools.dependencies))
1517
+ fail("host", f"version {cached.version_id} declares dependencies ({declared}); the open resolved none")
1518
+ return {}
1519
+ if cached.tools is None:
1520
+ fail("host", f"version {cached.version_id} is an api bundle; only a schema world opens beside dependencies")
1521
+ raise AssertionError # fail() never returns
1522
+ worlds: dict[str, DependencyWorld] = {}
1523
+ for ref in deps:
1524
+ declared = cached.tools.dependencies.get(ref.alias)
1525
+ if declared is None:
1526
+ known = ", ".join(sorted(cached.tools.dependencies)) or "none"
1527
+ fail("host", f"version {cached.version_id} declares no dependency '{ref.alias}' (it declares: {known})")
1528
+ raise AssertionError # fail() never returns
1529
+ dep = self.cache.ensure(ref.version_id, *self._trusted_version(ref.bundle_url, ref.snapshot))
1530
+ if dep.tools is None:
1531
+ fail("host", f"dependency '{ref.alias}' ({ref.version_id}) is an api bundle, not a schema world")
1532
+ raise AssertionError # fail() never returns
1533
+ worlds[ref.alias] = DependencyWorld.of(declared, dep.tools)
1534
+ served_with_dependencies(cached.tools, worlds)
1535
+ return worlds
1536
+
1537
+ @staticmethod
1538
+ def _check_task_tools(spec: TaskSpec, served_tools: Iterable[str]) -> None:
1539
+ """A task's allow-list names tools the world serves, every one of them:
1540
+ a misspelt name would narrow the list without anyone noticing. The
1541
+ served tools are an api world's operations or a mock-tools world's
1542
+ handlers."""
1543
+ served_tools = list(served_tools)
1544
+ unknown = unknown_task_tools(spec, served_tools)
1545
+ if unknown:
1546
+ served = ", ".join(sorted(served_tools)) or "none"
1547
+ fail(
1548
+ "task",
1549
+ f"the task allows {', '.join(unknown)}, which this world does not serve; its tools are {served}",
1550
+ "/task/tools",
1551
+ )
1552
+
1553
+ def _apply_task_seed(self, state: HostWorldState, spec: TaskSpec) -> None:
1554
+ """Start the session in its own task's state: the version's snapshot
1555
+ (already cloned) with the task's rows on top, as a session seed lands
1556
+ them. A task without a seed starts on the base data."""
1557
+ if spec.seed is None:
1558
+ return
1559
+ state.seed_live(spec.seed["rows"], spec.seed["mode"], spec.seed.get("redact", "off"))
1560
+
1561
+ @contextmanager
1562
+ def using(self, session_id: str, *, touch: bool = True) -> Iterator[Session]:
1563
+ """The session for the duration of one request: its lease renewed (any
1564
+ traffic keeps it alive), its ``touched_at`` moved unless ``touch`` is
1565
+ off (a renewal or export observing the session, not using it), and its
1566
+ teardown held off until the block ends."""
1567
+ with self._lock:
1568
+ session = self._sessions.get(session_id)
1569
+ if session is not None:
1570
+ session.renew(self.lease_s)
1571
+ if touch:
1572
+ session.touched_at = time.time()
1573
+ session.inflight += 1
1574
+ if session is None:
1575
+ fail(UNKNOWN_SESSION, f"no session {session_id} on this host")
1576
+ raise AssertionError # fail() never returns
1577
+ try:
1578
+ yield session
1579
+ finally:
1580
+ self._release(session)
1581
+
1582
+ def _release(self, session: Session) -> None:
1583
+ with self._lock:
1584
+ session.inflight -= 1
1585
+ last_out = session.closing and session.inflight == 0
1586
+ if last_out:
1587
+ self._finish(session)
1588
+
1589
+ def owns(self, session_id: str) -> bool:
1590
+ with self._lock:
1591
+ return session_id in self._sessions
1592
+
1593
+ # -- control operations (the platform's rendezvous, run in-process) ----- #
1594
+
1595
+ def reset(self, session_id: str) -> dict:
1596
+ with self.using(session_id) as session:
1597
+ if session.worker is not None:
1598
+ return self._worker_control(session.worker, "POST", f"/__host/sessions/{session_id}/reset", {})
1599
+ if session.tools is not None:
1600
+ return session.tools.reset()
1601
+ assert session.state is not None
1602
+ # Back to the task's starting state: re-clone the snapshot, then
1603
+ # re-apply the task's seed or the scenario overlay if it had one.
1604
+ session.state.reset()
1605
+ if session.task_spec is not None:
1606
+ self._apply_task_seed(session.state, session.task_spec)
1607
+ else:
1608
+ assert session.task is not None
1609
+ self._apply_scenario(self.cache._versions[session.version_id], session.state, session.task)
1610
+ return {"reset": True}
1611
+
1612
+ def seed(self, session_id: str, args: dict) -> dict:
1613
+ rows = args.get("rows")
1614
+ if not isinstance(rows, dict):
1615
+ fail("host", "seed needs args.rows as {entity: [row, ...]}")
1616
+ mode = args.get("mode", "append")
1617
+ from .redaction import parse_mode
1618
+
1619
+ redact = parse_mode(args.get("redact"), "/args/redact")
1620
+ with self.using(session_id) as session:
1621
+ if session.worker is not None:
1622
+ return self._worker_control(
1623
+ session.worker, "POST", f"/__host/sessions/{session_id}/seed", {"args": args}
1624
+ )
1625
+ if session.tools is not None:
1626
+ if redact != "off":
1627
+ fail("host", "a mock-tools world has no [redact] policy; seed it with redact=off")
1628
+ return session.tools.seed(args)
1629
+ assert session.state is not None
1630
+ # Onto the live state, the way the runner's session seed lands: an
1631
+ # append upserts by key, a replace swaps the named entities.
1632
+ session.state.seed_live(rows, mode, redact)
1633
+ return {
1634
+ "seeded": sum(len(v) for v in rows.values()),
1635
+ "mode": mode,
1636
+ **({"redact": redact} if redact != "off" else {}),
1637
+ "entity_counts": {
1638
+ entity: len(session.state.rows(entity))
1639
+ for entity in rows
1640
+ if entity in session.state.contract.entities
1641
+ },
1642
+ }
1643
+
1644
+ def state(self, session_id: str) -> dict:
1645
+ with self.using(session_id) as session:
1646
+ if session.worker is not None:
1647
+ return self._worker_control(session.worker, "GET", f"/__host/sessions/{session_id}/state", None)
1648
+ if session.tools is not None:
1649
+ return session.tools.state()
1650
+ assert session.state is not None
1651
+ return {**session.state.dump(), "snapshot": session.state.describe_snapshot()}
1652
+
1653
+ def grade(self, session_id: str) -> dict:
1654
+ with self.using(session_id) as session:
1655
+ if session.worker is not None:
1656
+ return self._worker_control(session.worker, "POST", f"/__host/sessions/{session_id}/grade", {})
1657
+ if session.tools is not None:
1658
+ return session.tools.grade()
1659
+ return self._grade(session)
1660
+
1661
+ def _grade(self, session: Session) -> dict:
1662
+ assert session.state is not None
1663
+ state = {**session.state.dump(), "snapshot": session.state.describe_snapshot()}
1664
+ spec = session.task_spec
1665
+ if spec is not None:
1666
+ # The session's own task: its assertions are evaluated here, pure
1667
+ # Python over the dump; its verify.py runs as a bundled one would.
1668
+ if spec.grader is None:
1669
+ return {"reward": None, "rewards": {}}
1670
+ if spec.grader["kind"] == "assertions":
1671
+ return evaluate_assertions(spec.grader["checks"], state)
1672
+ if spec.graded_on_platform:
1673
+ # A rubric is an LLM judge's brief. The host has no model, no
1674
+ # key and no business calling one from a tenant's session: the
1675
+ # platform grades it from the state and the calls log.
1676
+ return {"reward": None, "rewards": {}, "pending": True, "grader": "rubric"}
1677
+ verify = session.state.session_dir / "task" / "checks" / "verify.py"
1678
+ return self._run_verifier(session, verify, state, spec.grader.get("timeoutSeconds") or VERIFY_TIMEOUT_S)
1679
+ assert session.task is not None
1680
+ scenario = _scenario_dir(session.bundle, session.tree, session.task)
1681
+ verify = scenario / "checks" / "verify.py" if scenario else None
1682
+ if verify is None or not verify.is_file():
1683
+ return {"reward": None, "rewards": {}}
1684
+ return self._run_verifier(session, verify, state, VERIFY_TIMEOUT_S)
1685
+
1686
+ def _run_verifier(self, session: Session, verify: Path, state: dict, timeout_s: float) -> dict:
1687
+ assert session.state is not None
1688
+ if not verify.is_file():
1689
+ fail("host", f"the task's verify.py is missing at {verify}")
1690
+ dump = json.dumps(state)
1691
+ # The verifier is the world's code: it runs confined like a worker, with
1692
+ # a scrubbed environment, and is told the state on stdin. It sees no
1693
+ # secret of this process, be it the host's or a worker's.
1694
+ home = session.state.session_dir / "verify"
1695
+ home.mkdir(parents=True, exist_ok=True)
1696
+ try:
1697
+ proc = subprocess.run(
1698
+ confined_command(verify),
1699
+ input=dump,
1700
+ check=False,
1701
+ capture_output=True,
1702
+ text=True,
1703
+ timeout=timeout_s,
1704
+ cwd=str(verify.parent),
1705
+ env=verifier_environment(home=home),
1706
+ )
1707
+ except subprocess.TimeoutExpired:
1708
+ fail("host", f"verify.py timed out after {timeout_s:g}s")
1709
+ if proc.returncode != 0:
1710
+ fail(
1711
+ "host",
1712
+ f"verify.py exited {proc.returncode}: {proc.stderr.strip()[-800:]}",
1713
+ )
1714
+ try:
1715
+ rewards = json.loads(proc.stdout.strip().splitlines()[-1])
1716
+ except (json.JSONDecodeError, IndexError):
1717
+ fail(
1718
+ "host",
1719
+ f"verify.py printed no rewards JSON: {proc.stdout.strip()[-400:]}",
1720
+ )
1721
+ if not isinstance(rewards, dict):
1722
+ fail("host", "verify.py rewards output is not an object")
1723
+ # The runner's shape (``api_runner.grade_scenario``): the scalar under
1724
+ # ``reward``, every other key the verifier printed under ``rewards``.
1725
+ reward = rewards.get("reward")
1726
+ return {
1727
+ "reward": float(reward) if isinstance(reward, (int, float)) else None,
1728
+ "rewards": {
1729
+ k: (float(v) if isinstance(v, (int, float)) else None) for k, v in rewards.items() if k != "reward"
1730
+ },
1731
+ }
1732
+
1733
+ def call(self, session_id: str, tool: str, args: dict) -> dict:
1734
+ """Invoke one of the world's vendor routes by operation name, in process.
1735
+ The arg shape mirrors the runner's ``execute_route``: ``path``/``query``/
1736
+ ``body``, or leftover top-level keys as the body."""
1737
+ with self.using(session_id) as session:
1738
+ if session.worker is not None:
1739
+ return self._worker_control(
1740
+ session.worker,
1741
+ "POST",
1742
+ f"/__host/sessions/{session_id}/call",
1743
+ {"tool": tool, "args": args},
1744
+ )
1745
+ if session.tools is not None:
1746
+ # A tool by name; on a tree with connector.toml, an operation
1747
+ # by name too, answered by the route over the same store.
1748
+ if (
1749
+ session.spec is not None
1750
+ and session.app is not None
1751
+ and tool not in (session.tools.version.handlers or {})
1752
+ and tool in session.spec.operations
1753
+ ):
1754
+ return self._call(session, tool, args)
1755
+ return session.tools.call(tool, args)
1756
+ return self._call(session, tool, args)
1757
+
1758
+ def _call(self, session: Session, tool: str, args: dict) -> dict:
1759
+ assert session.app is not None and session.spec is not None
1760
+ operation = session.spec.operations.get(tool)
1761
+ if operation is None:
1762
+ known = ", ".join(sorted(session.spec.operations)) or "(none)"
1763
+ fail("host", f"unknown tool '{tool}'; this world serves: {known}")
1764
+ if session.task_spec is not None and not session.task_spec.allows_tool(tool):
1765
+ allowed = ", ".join(session.task_spec.tools or ())
1766
+ fail("tool_not_allowed", f"tool '{tool}' is not allowed by this session's task; it allows: {allowed}")
1767
+ path = operation.path # type: ignore[union-attr]
1768
+ path_params = args.get("path") if isinstance(args.get("path"), dict) else {}
1769
+ for key, value in (path_params or {}).items():
1770
+ path = path.replace("{" + str(key) + "}", urllib.parse.quote(str(value), safe=""))
1771
+ query = args.get("query") if isinstance(args.get("query"), dict) else {}
1772
+ if query:
1773
+ path = f"{path}?" + urllib.parse.urlencode(query)
1774
+ body = args.get("body") if isinstance(args.get("body"), dict) else None
1775
+ if body is None:
1776
+ leftovers = {k: v for k, v in args.items() if k not in ("path", "query", "body")}
1777
+ body = leftovers or None
1778
+ method = operation.method # type: ignore[union-attr]
1779
+ raw = json.dumps(body).encode("utf-8") if body is not None and method != "GET" else b""
1780
+ base = urllib.parse.urlsplit(session.spec.base_url).path.rstrip("/")
1781
+ headers, credential_query = world_credential(session)
1782
+ target = with_query(f"{base}{path}", credential_query)
1783
+ status, answer, _ = session.app.handle(method, target, headers, raw, "127.0.0.1")
1784
+ return {"status": status, "body": answer}
1785
+
1786
+
1787
+ # --------------------------------------------------------------------------- #
1788
+ # The HTTP server: control plane by secret, data plane by Host header.
1789
+ # --------------------------------------------------------------------------- #
1790
+
1791
+
1792
+ def public_host(host_header: str | None, worlds_domain: str) -> bool:
1793
+ """True when ``Host`` names something under the worlds domain: a session,
1794
+ or any other label the wildcard ALB forwarded. That is the public side.
1795
+ Prometheus, the kubelet and the ALB health check address the pod itself
1796
+ (``ip:port``), which is not."""
1797
+ name = (host_header or "").split(":")[0].rstrip(".").lower()
1798
+ domain = worlds_domain.rstrip(".").lower()
1799
+ return bool(domain) and (name == domain or name.endswith("." + domain))
1800
+
1801
+
1802
+ def session_from_host(host_header: str | None) -> tuple[str, str] | None:
1803
+ """``w-<sid>-api.<domain>`` / ``w-<sid>.<domain>`` → (session id, surface).
1804
+ Returns None when the host does not name a session."""
1805
+ if not host_header:
1806
+ return None
1807
+ label = host_header.split(":")[0].split(".")[0]
1808
+ if not label.startswith("w-"):
1809
+ return None
1810
+ rest = label[2:]
1811
+ if rest.endswith("-api"):
1812
+ return rest[: -len("-api")], "api"
1813
+ if rest.endswith("-cdp"):
1814
+ return rest[: -len("-cdp")], "browser"
1815
+ return rest, "ui"
1816
+
1817
+
1818
+ #: Auth schemes the host can present a world's own credential for. Everything
1819
+ #: in ``connector.SCHEMES`` is here; the list is explicit so a new scheme is
1820
+ #: refused at open rather than admitted with no credential.
1821
+ SUPPORTED_AUTH_SCHEMES = ("none", "header", "bearer", "basic", "query", "oauth2")
1822
+
1823
+ #: A caller that satisfies the host's session-token gate has already been
1824
+ #: authorized; the host then presents the credential the WORLD itself expects,
1825
+ #: so the emulated vendor's own auth check passes. The session token is that
1826
+ #: credential; with no session token a sentinel satisfies the world's
1827
+ #: non-empty check (the host's gate is the real access control either way).
1828
+ _WORLD_AUTH_SENTINEL = "gateway-session"
1829
+
1830
+
1831
+ def _code_of(cached: CachedVersion) -> str:
1832
+ """What world-authored code a version runs, for a refusal message."""
1833
+ if cached.tools is not None:
1834
+ return "mock-tools handlers"
1835
+ assert cached.settings is not None and cached.settings.handlers is not None
1836
+ return f"api handlers module {cached.settings.handlers.name}"
1837
+
1838
+
1839
+ def unsupported_auth(spec: Spec) -> str | None:
1840
+ if spec.scheme in SUPPORTED_AUTH_SCHEMES:
1841
+ return None
1842
+ return (
1843
+ f"the host cannot present auth.scheme '{spec.scheme}' to a world; it serves {', '.join(SUPPORTED_AUTH_SCHEMES)}"
1844
+ )
1845
+
1846
+
1847
+ def world_credential(session: Session) -> tuple[dict[str, str], dict[str, str]]:
1848
+ """(headers, query) carrying the world's own credential for this session:
1849
+ the session token in the vendor's shape (:func:`api.vendor_credential`),
1850
+ or for an oauth2 world the grant the host minted for itself."""
1851
+ spec = session.spec
1852
+ assert spec is not None, "a mock-tools session has no http surface to present a credential on"
1853
+ unsupported = unsupported_auth(spec)
1854
+ if unsupported:
1855
+ fail("host", unsupported)
1856
+ return vendor_credential(spec, session.token or _WORLD_AUTH_SENTINEL, grant=session.grant)
1857
+
1858
+
1859
+ def bearer_of(headers: dict[str, str]) -> str | None:
1860
+ auth = headers.get("authorization", "")
1861
+ return auth[7:] if auth.lower().startswith("bearer ") else None
1862
+
1863
+
1864
+ def vendor_shaped_token(spec: Spec, headers: dict[str, str], token: str) -> bool:
1865
+ """Whether the request carries ``token`` the way the world's own auth scheme
1866
+ carries a credential: the declared header for ``header``, the user of a
1867
+ Basic authorization for ``basic``. A ``query`` scheme is not honoured here (a
1868
+ token in the URL outlives the request in logs); ``bearer`` is the gate's
1869
+ own shape and ``oauth2`` has its grant."""
1870
+ if spec.scheme == "header":
1871
+ presented = headers.get((spec.auth_name or "x-api-key").lower())
1872
+ return presented is not None and hmac.compare_digest(presented, token)
1873
+ if spec.scheme == "basic":
1874
+ auth = headers.get("authorization", "")
1875
+ if not auth.lower().startswith("basic "):
1876
+ return False
1877
+ import base64 as _b64
1878
+
1879
+ try:
1880
+ decoded = _b64.b64decode(auth[6:].strip().encode("ascii"), validate=True).decode("utf-8")
1881
+ except (ValueError, UnicodeDecodeError):
1882
+ return False
1883
+ user = decoded.split(":", 1)[0]
1884
+ return hmac.compare_digest(user, token)
1885
+ return False
1886
+
1887
+
1888
+ def admits(session: Session, path: str, headers: dict[str, str]) -> str | None:
1889
+ """How the host's gate admits a data-plane request, or None to refuse.
1890
+
1891
+ ``"session"``: the caller presented the session token as a bearer and the
1892
+ host will present the world's credential for it. Only the header counts: a
1893
+ token in the URL would outlive the request in access logs and referrers.
1894
+ ``"world"``: an oauth2 caller doing the vendor's own dance — the grant
1895
+ request (the world checks ``client_secret`` against the session token) or
1896
+ a bearer this session's world minted — whose headers pass through as sent.
1897
+ """
1898
+ if session.token is None:
1899
+ return "session"
1900
+ bearer = bearer_of(headers)
1901
+ if bearer is not None and hmac.compare_digest(bearer, session.token):
1902
+ return "session"
1903
+ if session.spec is not None and vendor_shaped_token(session.spec, headers, session.token):
1904
+ # The vendor's own wire shape carrying the session token: a client
1905
+ # written against the real vendor (`x-api-key: …`, a Basic user) works
1906
+ # unchanged with the session token as its key. The same secret as the
1907
+ # bearer, in the header the world declares — never in the URL.
1908
+ return "session"
1909
+ if session.spec is not None and session.spec.scheme == "oauth2":
1910
+ if session.app is None:
1911
+ return "world" # the world's tokens live in its worker, which runs this same gate # the world's tokens live in its worker, which runs this same gate
1912
+ token_path = session.app.settings.token_path
1913
+ if token_path and session.app._strip(path) == token_path:
1914
+ return "world"
1915
+ if bearer is not None and session.app.router.authorized(headers, {}, session.token):
1916
+ return "world"
1917
+ return None
1918
+
1919
+
1920
+ class OwnerLookup(Protocol):
1921
+ """Which host owns a session this replica does not: its control-plane
1922
+ URL, or None for a closed or unknown one. ``fresh`` bypasses whatever the
1923
+ lookup remembers, for a caller that has just found the remembered owner
1924
+ dead."""
1925
+
1926
+ def __call__(self, sid: str, *, fresh: bool = False) -> str | None: ...
1927
+
1928
+
1929
+ def platform_owner_lookup(platform_url: str, secret: str | None, self_url: str | None) -> OwnerLookup:
1930
+ """Ask the platform which host owns a session the caller reached us for.
1931
+ ``GET /api/public/world-sessions/{sid}/host`` is host-secret authenticated
1932
+ and answers ``{hostUrl}``; a 404 is a closed or unknown session. Answers are
1933
+ held briefly so a busy session does not cost one platform call per request.
1934
+ Our own address answers None: a session we do not hold but the platform
1935
+ says is ours is gone, not one hop away."""
1936
+ cache: dict[str, tuple[float, str | None]] = {}
1937
+ lock = threading.Lock()
1938
+ base = platform_url.rstrip("/")
1939
+
1940
+ def lookup(sid: str, *, fresh: bool = False) -> str | None:
1941
+ now = time.time()
1942
+ if not fresh:
1943
+ with lock:
1944
+ hit = cache.get(sid)
1945
+ if hit and hit[0] > now:
1946
+ return hit[1]
1947
+ owner: str | None = None
1948
+ req = urllib.request.Request(
1949
+ f"{base}/api/public/world-sessions/{urllib.parse.quote(sid, safe='')}/host",
1950
+ headers={"X-Host-Secret": secret or ""},
1951
+ )
1952
+ try:
1953
+ with urllib.request.urlopen(req, timeout=5) as r:
1954
+ answer = json.loads(r.read() or b"{}")
1955
+ url = answer.get("hostUrl") if isinstance(answer, dict) else None
1956
+ owner = url if isinstance(url, str) and url else None
1957
+ except urllib.error.HTTPError as e:
1958
+ if e.code != 404:
1959
+ raise
1960
+ if owner and self_url and owner.rstrip("/") == self_url.rstrip("/"):
1961
+ owner = None
1962
+ with lock:
1963
+ cache[sid] = (now + (OWNER_CACHE_S if owner else OWNER_MISS_S), owner)
1964
+ return owner
1965
+
1966
+ return lookup
1967
+
1968
+
1969
+ class OwnerUnreachable(Exception):
1970
+ """The owner a request was proxied to did not answer: no connection, or
1971
+ none in time. Not an answer of any status."""
1972
+
1973
+
1974
+ class BodyRefused(Exception):
1975
+ """A request body the host will not read: the answer's status and error."""
1976
+
1977
+ def __init__(self, status: int, error: str):
1978
+ super().__init__(error)
1979
+ self.status = status
1980
+ self.error = error
1981
+
1982
+
1983
+ def make_host_handler(
1984
+ host: WorldHost,
1985
+ secret: str,
1986
+ worlds_domain: str,
1987
+ owner_lookup: OwnerLookup | None = None,
1988
+ *,
1989
+ max_body_mb: int = DEFAULT_MAX_BODY_MB,
1990
+ secure_cookies: bool = True,
1991
+ ):
1992
+ """The request handler class for one host. ``secret`` is required: the
1993
+ control plane is the only trust boundary, so a host with no secret has no
1994
+ control plane at all rather than an open one. ``secure_cookies`` is off
1995
+ only for a host whose public surface is reached over plain http (a dev
1996
+ host); it is the deployment's word, not the request's, since a client
1997
+ writes the forwarding headers a request arrives with."""
1998
+ if not secret:
1999
+ raise ValueError("the world host needs a control-plane secret (WORLDS_HOST_SECRET)")
2000
+ if max_body_mb <= 0:
2001
+ raise ValueError(f"the request body cap must be positive (WORLDS_HOST_MAX_BODY_MB={max_body_mb})")
2002
+ max_body_bytes = max_body_mb * (1 << 20)
2003
+
2004
+ class Handler(BaseHTTPRequestHandler):
2005
+ server_version = "gateway-world-host/1"
2006
+
2007
+ def log_message(self, format: str, *args: object) -> None:
2008
+ pass
2009
+
2010
+ # -- plumbing ------------------------------------------------------- #
2011
+
2012
+ def _read(self) -> bytes:
2013
+ declared = self.headers.get("Content-Length")
2014
+ if declared is None:
2015
+ return b""
2016
+ try:
2017
+ length = int(declared)
2018
+ except ValueError:
2019
+ raise BodyRefused(400, "Content-Length is not a number") from None
2020
+ if length < 0:
2021
+ raise BodyRefused(400, "Content-Length is negative")
2022
+ if length > max_body_bytes:
2023
+ raise BodyRefused(413, f"request body over {max_body_mb} MiB")
2024
+ return self.rfile.read(length) if length else b""
2025
+
2026
+ def _reply(self, status: int, body: Any, extra: dict[str, str] | None = None) -> None:
2027
+ send_response(self, status, body, extra, "application/json")
2028
+
2029
+ def _headers(self) -> dict[str, str]:
2030
+ return {k.lower(): v for k, v in self.headers.items()}
2031
+
2032
+ # -- dispatch ------------------------------------------------------- #
2033
+
2034
+ def do_GET(self):
2035
+ self._dispatch("GET")
2036
+
2037
+ def do_POST(self):
2038
+ self._dispatch("POST")
2039
+
2040
+ def do_PUT(self):
2041
+ self._dispatch("PUT")
2042
+
2043
+ def do_PATCH(self):
2044
+ self._dispatch("PATCH")
2045
+
2046
+ def do_DELETE(self):
2047
+ self._dispatch("DELETE")
2048
+
2049
+ def _dispatch(self, method: str) -> None:
2050
+ url = urllib.parse.urlsplit(self.path)
2051
+ # The public side is whatever arrives under the worlds domain. It
2052
+ # gets sessions and nothing about the host: the probes' answer is
2053
+ # a bare ok, the counters and the rest live on the pod address
2054
+ # (prometheus) or behind the control-plane secret (/__host/stats).
2055
+ if url.path == "/healthz":
2056
+ return self._reply(200, {"ok": True})
2057
+ if url.path == "/metrics" and not public_host(self.headers.get("Host"), worlds_domain):
2058
+ payload = host.metrics_text().encode("utf-8")
2059
+ return self._relay(
2060
+ 200, [("Content-Type", "text/plain; version=0.0.4; charset=utf-8")], payload, drop=FRAMING_HEADERS
2061
+ )
2062
+ try:
2063
+ if url.path.startswith("/__host/"):
2064
+ return self._control(method, url)
2065
+ return self._data(method, url)
2066
+ except BodyRefused as refused:
2067
+ # The body was not read, so the connection cannot carry another
2068
+ # request: answer and hang up.
2069
+ self.close_connection = True
2070
+ return self._reply(refused.status, {"error": refused.error}, {"Connection": "close"})
2071
+
2072
+ # -- control plane -------------------------------------------------- #
2073
+
2074
+ def _control(self, method: str, url) -> None:
2075
+ if not hmac.compare_digest(self.headers.get("X-Host-Secret") or "", secret):
2076
+ return self._reply(403, {"error": "forbidden"})
2077
+ raw = self._read()
2078
+ try:
2079
+ body = json.loads(raw) if raw else {}
2080
+ except ValueError as error:
2081
+ return self._reply(400, {"error": "malformed json", "detail": str(error)})
2082
+ if not isinstance(body, dict):
2083
+ return self._reply(400, {"error": "malformed json", "detail": "the body must be a json object"})
2084
+ parts = url.path.strip("/").split("/") # __host, sessions, [sid], [verb]
2085
+ try:
2086
+ if method == "GET" and parts == ["__host", "stats"]:
2087
+ return self._reply(200, host.stats())
2088
+ if method == "POST" and parts == ["__host", "drain"]:
2089
+ host.drain()
2090
+ return self._reply(200, {"draining": True, "sessions": host.session_count()})
2091
+ if method == "GET" and parts == ["__host", "versions"]:
2092
+ return self._reply(200, {"versions": host.cache.version_ids()})
2093
+ if method == "POST" and parts == ["__host", "versions"]:
2094
+ return self._reply(
2095
+ 200,
2096
+ host.warm(body["versionId"], body["bundleUrl"], body.get("snapshot")),
2097
+ )
2098
+ if method == "POST" and parts == ["__host", "sessions"]:
2099
+ return self._reply(
2100
+ 200,
2101
+ host.open(
2102
+ session_id=body["sessionId"],
2103
+ version_id=body["versionId"],
2104
+ bundle_url=body["bundleUrl"],
2105
+ task=body.get("task"),
2106
+ token=body.get("token"),
2107
+ snapshot=body.get("snapshot"),
2108
+ browser=body.get("browser"),
2109
+ restore=body.get("restore"),
2110
+ task_spec=body.get("taskSpec"),
2111
+ dependencies=body.get("dependencies"),
2112
+ ),
2113
+ )
2114
+ if len(parts) >= 3 and parts[:2] == ["__host", "sessions"]:
2115
+ sid = parts[2]
2116
+ verb = parts[3] if len(parts) > 3 else None
2117
+ if method == "DELETE" and verb is None:
2118
+ return self._reply(200, host.close(sid))
2119
+ if method == "POST" and verb == "renew":
2120
+ return self._reply(200, host.renew(sid))
2121
+ if method == "POST" and verb == "reset":
2122
+ return self._reply(200, host.reset(sid))
2123
+ if method == "POST" and verb == "seed":
2124
+ return self._reply(200, host.seed(sid, body.get("args") or {}))
2125
+ if method == "POST" and verb == "export" and len(parts) == 4:
2126
+ known = body.get("knownSha256")
2127
+ return self._reply(200, host.export(sid, known if isinstance(known, str) else None))
2128
+ if method == "POST" and verb == "export" and len(parts) == 5:
2129
+ url = body.get("url")
2130
+ if not isinstance(url, str) or not url.startswith(("https://", "http://")):
2131
+ return self._reply(400, {"error": "url must be the presigned upload url"})
2132
+ return self._reply(200, host.upload_export(sid, parts[4], url))
2133
+ if method == "GET" and verb == "state":
2134
+ return self._reply(200, host.state(sid))
2135
+ if method == "POST" and verb == "grade":
2136
+ return self._reply(200, host.grade(sid))
2137
+ if method == "POST" and verb == "call":
2138
+ tool = body.get("tool")
2139
+ if not isinstance(tool, str):
2140
+ return self._reply(400, {"error": "tool must be a string"})
2141
+ return self._reply(200, host.call(sid, tool, body.get("args") or {}))
2142
+ return self._reply(404, {"error": "unknown control route"})
2143
+ except ContractError as error:
2144
+ code = error.detail.get("code", "host")
2145
+ # A host that will not take the session is not a bad request:
2146
+ # the platform places it on another replica. A session this
2147
+ # host does not hold is the one answer the platform may read
2148
+ # as "lost"; every other refusal is about the request.
2149
+ if code in ("draining", "at_capacity"):
2150
+ status = 503
2151
+ elif code == UNKNOWN_SESSION:
2152
+ status = 404
2153
+ else:
2154
+ status = 400
2155
+ return self._reply(status, {"error": code, "detail": str(error)})
2156
+ except KeyError as error:
2157
+ return self._reply(400, {"error": "missing field", "field": str(error)})
2158
+ except WorkerGone as error:
2159
+ return self._reply(502, {"error": "worker exited", "detail": str(error)})
2160
+
2161
+ # -- data plane ----------------------------------------------------- #
2162
+
2163
+ def _data(self, method: str, url) -> None:
2164
+ headers = self._headers()
2165
+ named = session_from_host(headers.get("host"))
2166
+ if named is None:
2167
+ return self._reply(404, {"error": "no session named by Host"})
2168
+ sid, surface = named
2169
+ if not host.owns(sid):
2170
+ # Another host owns it (or it is closed). Proxy one hop when the
2171
+ # platform can point us at the owner; a request that already
2172
+ # hopped once is not sent on again.
2173
+ hopped = HOP_HEADER in headers
2174
+ owner = owner_lookup(sid) if owner_lookup and not hopped else None
2175
+ if owner and owner_lookup:
2176
+ host.tally("requests.proxied")
2177
+ return self._proxy(sid, owner, owner_lookup, method, headers)
2178
+ return self._reply(404, {"error": "unknown or closed session"})
2179
+ host.tally(f"requests.{surface}")
2180
+ try:
2181
+ with host.using(sid) as session:
2182
+ if session.spec is None:
2183
+ return self._reply(
2184
+ 404, {"error": "this world has no http surface; reach its tools through call"}
2185
+ )
2186
+ if surface == "browser":
2187
+ self._serve_browser(session, url, headers)
2188
+ elif surface == "ui":
2189
+ self._serve_ui(session, method, url, headers)
2190
+ else:
2191
+ self._serve(session, method, url, headers)
2192
+ except ContractError:
2193
+ # Closed between the ownership check and the lookup.
2194
+ self._reply(404, {"error": "unknown or closed session"})
2195
+
2196
+ def _serve(self, session: Session, method: str, url, headers: dict[str, str]) -> None:
2197
+ admitted = admits(session, url.path, headers)
2198
+ if admitted is None:
2199
+ return self._reply(401, {"error": "invalid session token"})
2200
+ self._serve_api(session, method, self.path, headers, admitted)
2201
+
2202
+ def _serve_api(
2203
+ self, session: Session, method: str, target: str, headers: dict[str, str], admitted: str
2204
+ ) -> None:
2205
+ """Answer ``target`` (a path plus query) from the session's world,
2206
+ in this process or its worker, once the gate has admitted it."""
2207
+ sid = session.session_id
2208
+ raw = self._read()
2209
+ if session.worker is not None:
2210
+ # The gate passed here; the worker runs it again and presents the
2211
+ # world its credential, so the request goes over as it came.
2212
+ try:
2213
+ status, answer_headers, payload = session.worker.request(method, target, headers, raw)
2214
+ except WorkerGone as error:
2215
+ host.lose_worker(session.worker)
2216
+ return self._reply(502, {"error": "worker exited", "detail": str(error)})
2217
+ return self._relay(status, answer_headers, payload, drop=FRAMING_HEADERS)
2218
+ assert session.app is not None
2219
+ world_headers = headers
2220
+ if admitted == "session":
2221
+ # The host's token gate is the access control; present the world
2222
+ # its OWN expected credential so the emulated vendor auth passes.
2223
+ credential_headers, credential_query = world_credential(session)
2224
+ world_headers = {**headers, **credential_headers}
2225
+ target = with_query(target, credential_query)
2226
+ status, body, extra = session.app.handle(method, target, world_headers, raw, f"w-{sid}-api.{worlds_domain}")
2227
+ self._reply(status, body, extra)
2228
+
2229
+ # -- the ui surface -------------------------------------------------- #
2230
+
2231
+ def _serve_ui(self, session: Session, method: str, url, headers: dict[str, str]) -> None:
2232
+ ui = session.ui
2233
+ if ui is None:
2234
+ return self._reply(404, {"error": "this world has no static ui"})
2235
+ token = session.token
2236
+ if token is not None:
2237
+ if matches(query_token(url.query), token):
2238
+ # The way in: trade the one-time ``?token=`` for the cookie
2239
+ # and land on the same page without it.
2240
+ landing = without_query_token(url)
2241
+ return self._reply(
2242
+ 303,
2243
+ {"location": landing},
2244
+ {
2245
+ "Location": landing,
2246
+ "Set-Cookie": session_cookie(token, secure=secure_cookies, max_age_s=host.lease_s),
2247
+ },
2248
+ )
2249
+ if not matches(cookie_token(headers), token) and not matches(bearer_of(headers), token):
2250
+ return self._reply(401, {"error": "invalid session token"})
2251
+ route = api_target(ui, url.path)
2252
+ if route is not None:
2253
+ # The SPA's same-origin api call: strip the prefix and answer it
2254
+ # as the api surface would for a caller holding the session
2255
+ # token (the cookie stood in for the bearer here).
2256
+ target = urllib.parse.urlunsplit(("", "", route, url.query, ""))
2257
+ api_headers = {k: v for k, v in headers.items() if k not in ("cookie", "authorization")}
2258
+ if token is not None:
2259
+ api_headers["authorization"] = f"Bearer {token}"
2260
+ return self._serve_api(session, method, target, api_headers, "session")
2261
+ if method != "GET":
2262
+ return self._reply(405, {"error": "the static ui answers GET only"})
2263
+ status, static_headers, payload = static_file(ui, url.path)
2264
+ self._relay(status, static_headers.items(), payload, drop=FRAMING_HEADERS)
2265
+
2266
+ # -- the browser surface --------------------------------------------- #
2267
+
2268
+ def _serve_browser(self, session: Session, url, headers: dict[str, str]) -> None:
2269
+ """``/cdp/<session token>`` and ``/live/<grant>`` on the session's
2270
+ cdp host: check the credential against the SESSION, then tunnel
2271
+ the websocket to the leased relay with the POOL credential the
2272
+ relay knows. The relay's token never leaves the host."""
2273
+ if session.browser_url is None or session.browser_token is None:
2274
+ return self._reply(404, {"error": "this session has no browser surface"})
2275
+ parts = url.path.strip("/").split("/")
2276
+ if len(parts) != 2 or parts[0] not in ("cdp", "live"):
2277
+ return self._reply(404, {"error": "browser routes are /cdp/<token> and /live/<grant>"})
2278
+ kind, credential = parts
2279
+ token = session.token or ""
2280
+ if kind == "cdp":
2281
+ if not matches(credential, token):
2282
+ return self._reply(401, {"error": "invalid session token"})
2283
+ # The relay decodes the path segment, so a token with '/' or
2284
+ # '=' (openssl rand -base64) must travel percent-encoded.
2285
+ upstream_path = f"/cdp/{urllib.parse.quote(session.browser_token, safe='')}"
2286
+ else:
2287
+ scope = verify_live_grant(credential, token)
2288
+ if scope is None:
2289
+ return self._reply(401, {"error": "invalid or expired live grant"})
2290
+ upstream_path = f"/live/{mint_live_grant(session.browser_token, LIVE_RELAY_GRANT_MS, scope)}"
2291
+ if headers.get("upgrade", "").lower() != "websocket":
2292
+ return self._reply(400, {"error": "the browser surface is a websocket"})
2293
+ self.close_connection = True
2294
+ try:
2295
+ tunnel(self.connection, session.browser_url, upstream_path, headers)
2296
+ except OSError as error:
2297
+ self._reply(502, {"error": "browser unreachable", "detail": str(error)})
2298
+
2299
+ def _proxy(self, sid: str, owner: str, lookup: OwnerLookup, method: str, headers: dict[str, str]) -> None:
2300
+ """Send the request on to ``owner``. An owner that does not answer
2301
+ at all may be a host that died with the session since recovered
2302
+ elsewhere, so the platform is asked once more, uncached, and the
2303
+ request goes to the owner it names now; only then is it a 502.
2304
+ The retry stays one hop (the hop header goes with it)."""
2305
+ websocket = headers.get("upgrade", "").lower() == "websocket"
2306
+ raw = b"" if websocket else self._read()
2307
+ try:
2308
+ return self._forward(owner, method, headers, raw, websocket)
2309
+ except OwnerUnreachable as stale:
2310
+ current = lookup(sid, fresh=True)
2311
+ if not current or current.rstrip("/") == owner.rstrip("/"):
2312
+ return self._reply(502, {"error": "owner unreachable", "detail": str(stale)})
2313
+ host.tally("requests.rerouted")
2314
+ try:
2315
+ self._forward(current, method, headers, raw, websocket)
2316
+ except OwnerUnreachable as error:
2317
+ self._reply(502, {"error": "owner unreachable", "detail": str(error)})
2318
+
2319
+ def _forward(self, owner: str, method: str, headers: dict[str, str], raw: bytes, websocket: bool) -> None:
2320
+ """One attempt at ``owner``; raises :class:`OwnerUnreachable` when it
2321
+ did not answer, before anything has been written to the client."""
2322
+ if websocket:
2323
+ # A browser session on another host: the owner runs the
2324
+ # credential check; this hop only carries bytes. ``tunnel``
2325
+ # fails before the 101 or not at all.
2326
+ owner_ws = "ws://" + owner.split("://", 1)[-1].rstrip("/")
2327
+ self.close_connection = True
2328
+ try:
2329
+ tunnel(self.connection, owner_ws, self.path, {**headers, HOP_HEADER: "1"}, host=headers.get("host"))
2330
+ except OSError as error:
2331
+ raise OwnerUnreachable(str(error)) from error
2332
+ return
2333
+ target = f"{owner.rstrip('/')}{self.path}"
2334
+ forward = {k: v for k, v in headers.items() if k not in ("host", "content-length")}
2335
+ forward["host"] = headers.get("host", "")
2336
+ forward[HOP_HEADER] = "1"
2337
+ req = urllib.request.Request(target, data=raw or None, method=method, headers=forward)
2338
+ try:
2339
+ with _PROXY_OPENER.open(req, timeout=60) as r:
2340
+ self._relay(r.status, r.headers.items(), r.read(), drop=PROXIED_DROP_HEADERS)
2341
+ except urllib.error.HTTPError as e:
2342
+ self._relay(e.code, e.headers.items(), e.read(), drop=PROXIED_DROP_HEADERS)
2343
+ except (OSError, http.client.HTTPException) as error:
2344
+ # URLError is an OSError: no connection, or none in time.
2345
+ raise OwnerUnreachable(str(error)) from error
2346
+
2347
+ def _relay(
2348
+ self,
2349
+ status: int,
2350
+ headers: Iterable[tuple[str, str]],
2351
+ payload: bytes,
2352
+ *,
2353
+ drop: frozenset[str],
2354
+ ) -> None:
2355
+ """Write another process's answer through as it came: same status,
2356
+ same body bytes, every header the world set except ``drop`` (the
2357
+ framing, which is this connection's, and from an owner the
2358
+ hop-by-hop headers too). The world's contract, its ``page_headers``
2359
+ included, reads the same from every replica."""
2360
+ self.send_response(status)
2361
+ content_type = None
2362
+ for name, value in headers:
2363
+ lower = name.lower()
2364
+ if lower == "content-type":
2365
+ content_type = value
2366
+ elif lower not in drop:
2367
+ self.send_header(name, value)
2368
+ self.send_header("Content-Type", content_type or "application/json")
2369
+ self.send_header("Content-Length", str(len(payload)))
2370
+ self.end_headers()
2371
+ self.wfile.write(payload)
2372
+
2373
+ return Handler
2374
+
2375
+
2376
+ def start_lease_sweeper(world_host: WorldHost, interval_s: float = LEASE_SWEEP_S) -> threading.Event:
2377
+ """Expire leases every ``interval_s`` until the returned event is set."""
2378
+ stop = threading.Event()
2379
+
2380
+ def sweep() -> None:
2381
+ while not stop.wait(interval_s):
2382
+ for sid in world_host.expire_leases():
2383
+ print(
2384
+ f"world host: lease expired, closed session {sid}",
2385
+ file=sys.stderr,
2386
+ flush=True,
2387
+ )
2388
+ for version_id in world_host.reap_workers():
2389
+ print(
2390
+ f"world host: stopped idle worker for version {version_id}",
2391
+ file=sys.stderr,
2392
+ flush=True,
2393
+ )
2394
+
2395
+ threading.Thread(target=sweep, name="world-host-leases", daemon=True).start()
2396
+ return stop
2397
+
2398
+
2399
+ def heartbeat_once(world_host: WorldHost, platform_url: str, secret: str, timeout_s: float = 5.0) -> bool:
2400
+ """Tell the platform what this host is and holds (:meth:`WorldHost.stats`).
2401
+ The platform's registry is what places new sessions: a host it has not
2402
+ heard from lately gets none. Returns whether the platform took it."""
2403
+ body = json.dumps(world_host.stats()).encode("utf-8")
2404
+ req = urllib.request.Request(
2405
+ f"{platform_url.rstrip('/')}/api/public/world-hosts",
2406
+ data=body,
2407
+ method="POST",
2408
+ headers={"content-type": "application/json", "x-host-secret": secret},
2409
+ )
2410
+ try:
2411
+ with urllib.request.urlopen(req, timeout=timeout_s) as r:
2412
+ return 200 <= r.status < 300
2413
+ except (urllib.error.URLError, OSError, ValueError) as error:
2414
+ print(f"world host: heartbeat failed: {error}", file=sys.stderr, flush=True)
2415
+ return False
2416
+
2417
+
2418
+ def start_heartbeat(
2419
+ world_host: WorldHost, platform_url: str, secret: str, interval_s: float = HEARTBEAT_S
2420
+ ) -> threading.Event:
2421
+ """Heartbeat every ``interval_s`` until the returned event is set; the
2422
+ first beat goes out at once so a fresh replica is placeable immediately,
2423
+ and a last one goes out on stop so the registry sees it draining."""
2424
+ stop = threading.Event()
2425
+
2426
+ def beat() -> None:
2427
+ heartbeat_once(world_host, platform_url, secret)
2428
+ while not stop.wait(interval_s):
2429
+ heartbeat_once(world_host, platform_url, secret)
2430
+ heartbeat_once(world_host, platform_url, secret)
2431
+
2432
+ threading.Thread(target=beat, name="world-host-heartbeat", daemon=True).start()
2433
+ return stop
2434
+
2435
+
2436
+ class HostServer(ThreadingHTTPServer):
2437
+ """The listening socket plus what shutdown has to stop: the lease sweeper,
2438
+ the heartbeat and the version workers."""
2439
+
2440
+ def __init__(
2441
+ self,
2442
+ address: tuple[str, int],
2443
+ handler: type[BaseHTTPRequestHandler],
2444
+ world_host: WorldHost,
2445
+ *,
2446
+ heartbeat: tuple[str, str] | None = None,
2447
+ heartbeat_s: float = HEARTBEAT_S,
2448
+ drain_s: float = DEFAULT_DRAIN_S,
2449
+ ):
2450
+ super().__init__(address, handler)
2451
+ self.world_host = world_host
2452
+ self.lease_sweeper = start_lease_sweeper(world_host)
2453
+ #: ``(platform url, secret)`` to report to; None runs unregistered (one
2454
+ #: replica behind WORLDS_HOST_URL needs no registry).
2455
+ self.heartbeat = start_heartbeat(world_host, *heartbeat, interval_s=heartbeat_s) if heartbeat else None
2456
+ self.drain_s = drain_s
2457
+
2458
+ def drain(self) -> None:
2459
+ """SIGTERM: refuse new sessions, announce it, serve what is here until
2460
+ it closes or the grace runs out, then stop. Runs off the signal thread
2461
+ so ``serve_forever`` keeps answering meanwhile."""
2462
+ self.world_host.drain()
2463
+ if self.heartbeat is not None:
2464
+ self.heartbeat.set() # its last beat carries ``draining: true``
2465
+
2466
+ def wait_then_stop() -> None:
2467
+ deadline = time.time() + self.drain_s
2468
+ while self.world_host.session_count() > 0 and time.time() < deadline:
2469
+ time.sleep(0.5)
2470
+ self.shutdown()
2471
+
2472
+ threading.Thread(target=wait_then_stop, name="world-host-drain", daemon=True).start()
2473
+
2474
+
2475
+ def serve(cache_root: str | Path, *, port: int = 8080, host_addr: str = "0.0.0.0") -> HostServer:
2476
+ """The host as deployed, configured from the environment:
2477
+
2478
+ ``WORLDS_HOST_SECRET`` gates the control plane; ``WORLDS_INGRESS_DOMAIN`` is
2479
+ the domain the session hostnames live under; ``WORLDS_HOST_ADVERTISE_URL`` is
2480
+ this replica's own address (``http://<pod ip>:<port>``), returned on open so
2481
+ the platform pins the session to it; ``WORLDS_PLATFORM_URL`` lets a
2482
+ non-owner replica ask the platform who owns a session and proxy one hop;
2483
+ ``WORLDS_HOST_LEASE_S`` is how long an untouched session lives;
2484
+ ``WORLDS_HOST_MAX_SESSIONS`` is how many it takes before answering 503;
2485
+ ``WORLDS_HOST_HEARTBEAT_S`` is how often it reports to the platform (with
2486
+ ``WORLDS_PLATFORM_URL`` and an advertised address, else no heartbeat);
2487
+ ``WORLDS_HOST_DRAIN_S`` is how long a SIGTERM waits for sessions to close;
2488
+ ``WORLDS_WORKER_MEMORY_MB`` caps each version worker's address space and
2489
+ ``WORLDS_WORKER_BUDGET_MB`` all of them together (their count is the
2490
+ quotient; one more version answers 503 ``at_capacity``),
2491
+ ``WORLDS_HOST_OBJECT_STORE`` is where every presigned URL it is handed
2492
+ may point (required; ``any`` for a dev host),
2493
+ ``WORLDS_HOST_MAX_BUNDLE_MB`` is the largest version bundle the cache
2494
+ accepts, ``WORLDS_HOST_MAX_BODY_MB`` the largest request body it reads,
2495
+ ``WORLDS_HOST_PLAIN_HTTP=1`` says the public surface is reached over plain
2496
+ http (a dev host: the ui cookie is not marked ``Secure``) and
2497
+ ``WORLDS_HOST_WORKERS=0`` runs without workers (handler worlds refused)."""
2498
+ secret = os.environ.get("WORLDS_HOST_SECRET") or ""
2499
+ if not secret:
2500
+ raise SystemExit("world host: WORLDS_HOST_SECRET is unset; refusing to start without a control-plane secret")
2501
+ try:
2502
+ object_store = parse_origins(os.environ.get("WORLDS_HOST_OBJECT_STORE"))
2503
+ except ContractError as error:
2504
+ raise SystemExit(f"world host: {error}; refusing to start") from error
2505
+ advertise = os.environ.get("WORLDS_HOST_ADVERTISE_URL") or None
2506
+ platform_url = os.environ.get("WORLDS_PLATFORM_URL") or None
2507
+ lease_s = float(os.environ.get("WORLDS_HOST_LEASE_S") or DEFAULT_LEASE_S)
2508
+ worlds_domain = os.environ.get("WORLDS_INGRESS_DOMAIN", "worlds.local")
2509
+ workers = None
2510
+ if os.environ.get("WORLDS_HOST_WORKERS", "1") != "0":
2511
+ workers = WorkerPool(
2512
+ Path(cache_root),
2513
+ worlds_domain=worlds_domain,
2514
+ memory_mb=int(os.environ.get("WORLDS_WORKER_MEMORY_MB") or DEFAULT_WORKER_MEMORY_MB),
2515
+ budget_mb=int(os.environ.get("WORLDS_WORKER_BUDGET_MB") or DEFAULT_WORKER_BUDGET_MB),
2516
+ )
2517
+ world_host = WorldHost(
2518
+ Path(cache_root),
2519
+ lease_s=lease_s,
2520
+ advertise_url=advertise,
2521
+ workers=workers,
2522
+ max_sessions=int(os.environ.get("WORLDS_HOST_MAX_SESSIONS") or DEFAULT_MAX_SESSIONS),
2523
+ max_bundle_mb=int(os.environ.get("WORLDS_HOST_MAX_BUNDLE_MB") or DEFAULT_MAX_BUNDLE_MB),
2524
+ object_store=object_store,
2525
+ )
2526
+ handler = make_host_handler(
2527
+ world_host,
2528
+ secret=secret,
2529
+ worlds_domain=worlds_domain,
2530
+ owner_lookup=platform_owner_lookup(platform_url, secret, advertise) if platform_url else None,
2531
+ max_body_mb=int(os.environ.get("WORLDS_HOST_MAX_BODY_MB") or DEFAULT_MAX_BODY_MB),
2532
+ secure_cookies=os.environ.get("WORLDS_HOST_PLAIN_HTTP", "0") != "1",
2533
+ )
2534
+ return HostServer(
2535
+ (host_addr, port),
2536
+ handler,
2537
+ world_host,
2538
+ heartbeat=(platform_url, secret) if platform_url and advertise else None,
2539
+ heartbeat_s=float(os.environ.get("WORLDS_HOST_HEARTBEAT_S") or HEARTBEAT_S),
2540
+ drain_s=float(os.environ.get("WORLDS_HOST_DRAIN_S") or DEFAULT_DRAIN_S),
2541
+ )
2542
+
2543
+
2544
+ def main(argv: list[str] | None = None) -> int:
2545
+ import argparse
2546
+
2547
+ parser = argparse.ArgumentParser(prog="gateway-world-host")
2548
+ parser.add_argument("--cache-root", default=os.environ.get("WORLDS_HOST_CACHE", "/cache"))
2549
+ parser.add_argument("--port", type=int, default=int(os.environ.get("PORT") or 8080))
2550
+ args = parser.parse_args(argv)
2551
+ server = serve(args.cache_root, port=args.port)
2552
+ print(
2553
+ f"world host listening on :{args.port}, cache {args.cache_root}",
2554
+ file=sys.stderr,
2555
+ flush=True,
2556
+ )
2557
+ signal.signal(signal.SIGTERM, lambda *_: server.drain())
2558
+ try:
2559
+ server.serve_forever()
2560
+ finally:
2561
+ server.lease_sweeper.set()
2562
+ if server.heartbeat is not None:
2563
+ server.heartbeat.set()
2564
+ if server.world_host.workers is not None:
2565
+ server.world_host.workers.stop_all()
2566
+ server.server_close()
2567
+ return 0
2568
+
2569
+
2570
+ if __name__ == "__main__":
2571
+ raise SystemExit(main())